From c16ede8ec71fb0c1df2a4d7567bb3f174ca590f3 Mon Sep 17 00:00:00 2001 From: Zero_Chaos Date: Fri, 16 Apr 2010 03:22:34 +0000 Subject: [PATCH] net-wireless/compat-wireless: version bump and minor style fix --- net-wireless/compat-wireless/Manifest | 3 +- .../compat-wireless-2.6.34_rc3.ebuild | 18 +- .../files/super_secret_patch.diff | 453 ++++++++++++++++++ 3 files changed, 467 insertions(+), 7 deletions(-) create mode 100644 net-wireless/compat-wireless/files/super_secret_patch.diff diff --git a/net-wireless/compat-wireless/Manifest b/net-wireless/compat-wireless/Manifest index 856974915..00cae53e6 100644 --- a/net-wireless/compat-wireless/Manifest +++ b/net-wireless/compat-wireless/Manifest @@ -17,6 +17,7 @@ AUX led-oops.patch 733 RMD160 50dc59a8893e7d77cf41653d8d39e5255dae8273 SHA1 9875 AUX mac80211.compat08082009.wl_frag+ack_v1.patch 1049 RMD160 e864ee2e0c70ce344000baa8ee5fca3b23c3305a SHA1 85f7a1b141549b774f5631fba259bc414aeeffb8 SHA256 e04ed9997e1578cc1becd4ef9d9f2f6f606590aa91a56e42835963913e1b0f52 AUX orinoco-remove-all-which-are-in-hostap-OFFICIAL.patch 12945 RMD160 a9453bfccd20520dc592275b4dd90fe681f272fa SHA1 f032aa4c51360ba793d2a8bf5a393bbfe33b94fa SHA256 38705e63f5034052d48c50a29d5a8bf114a692ce6e76a53b73371180d0e0f14b AUX rtl8187-mac80211-injection-speed-2.6.30-rc3.patch 1179 RMD160 e06fc37c08ce457ebeef7a7eaae8a05fb8aa7513 SHA1 77281c04d0e451860f27d0f621955a77b5e133d6 SHA256 bf6846089eb3d8cf7ebe119b4ffd1c32f7075a98d403fc8f96a5b49017c385b6 +AUX super_secret_patch.diff 13499 RMD160 74c96addab52a869141e0791942357efbc230265 SHA1 49b8c23bd887bbb7656cd2146dba8fdbaac7d5fe SHA256 f4bd054b3348e98700e4481f50a1d809f2d2c89bfd24419b4d17e01bf6a0168e AUX whynot-2.6.31.patch 4272 RMD160 74ec1c66cfb376cf2c83401aa3edcdbfdd019438 SHA1 18f5680625ad68ebba773c8f39a04edf6456e2f2 SHA256 a1839efde553fb6c78b7121f94a3dc5401c146f9ff3e017e61de1b0298f4b371 AUX whynot-2.6.32.patch 666 RMD160 fcca9ac8d2152bebe51643a4250dffed383aae68 SHA1 5d7261437f5c98758f13c6c3f8a5676769b05013 SHA256 07cfc03d0ad5c47bec08d320afa63c79c0e6be9109dcf42b9811aad10bdc9c63 AUX whynot.patch 4106 RMD160 ac38e8dbbe1a59607fe16b36f327a9ba73a001e7 SHA1 2208598c9f9811d368db099c863be2a2af11681e SHA256 956cf3a0a8b8e1f0f0e3df985e351799f325a44e4cddf042d677a9e8109b7c9e @@ -44,5 +45,5 @@ EBUILD compat-wireless-2.6.33_rc1.ebuild 2111 RMD160 4bc302aa5dd8f351d1707189343 EBUILD compat-wireless-2.6.33_rc4.ebuild 2284 RMD160 070ba0026527149e922c324c7bf646d222c88b7d SHA1 ff04bea64a42dbc02215552face3e828e620b6bd SHA256 e45e956ff732cb2e3d5ee68b09c637de7d9d79e32c653e3f2cd7139778758433 EBUILD compat-wireless-2.6.33_rc5.ebuild 2336 RMD160 e46d00fb197714883916c613c2a495e979c31865 SHA1 b24a5ae630ecd556f27d6535d3e19b287e17ea16 SHA256 752f60134a4d851e23a0f4c87e78a89de31850fef6d0cc78ace9674678fb9193 EBUILD compat-wireless-2.6.33_rc8.ebuild 2370 RMD160 62b59c4f6da20f3aa0928d84a3910b1cbf8b7b61 SHA1 b2f0776f94ba2602182577f1af49e93ad6e882a7 SHA256 2fd3d05ac7616935ce3c43d116010f565c50b0c1a09a58371d3a1beb6d06b225 -EBUILD compat-wireless-2.6.34_rc3.ebuild 2646 RMD160 49ce5047d4837b4666c88c50d0bc4bbafb765616 SHA1 77a07fbdd07fd989f3f72d143c02efb435dc0407 SHA256 3bdf504561f76fe3be570e14c922f810f7f4580714491858176937f6185f0693 +EBUILD compat-wireless-2.6.34_rc3.ebuild 2793 RMD160 d68f2fc3a55d4929e3902f36fb4261d4ac987972 SHA1 5f7d95f00c9497b296e5f43e79fe006ca846d5d7 SHA256 9f16bc96c70b7e8a7e3284a83b58d86f41eb7dfef5e3c415c2f93b8f9a1eed85 MISC metadata.xml 228 RMD160 cd3fb26b5d8049ab5dba38f21d7654ec033aa0eb SHA1 3148dfbdced7a623a311d21c6f728ab9c7135dae SHA256 8715828d1bff71d5d96b991ba600bae9376c1c80c96f0f102260fc335ca22487 diff --git a/net-wireless/compat-wireless/compat-wireless-2.6.34_rc3.ebuild b/net-wireless/compat-wireless/compat-wireless-2.6.34_rc3.ebuild index 8465de712..5c1e4e197 100644 --- a/net-wireless/compat-wireless/compat-wireless-2.6.34_rc3.ebuild +++ b/net-wireless/compat-wireless/compat-wireless-2.6.34_rc3.ebuild @@ -8,13 +8,13 @@ inherit linux-mod linux-info versionator ##Stable MY_P=${P/_rc/-rc} MY_PV=v$(get_version_component_range 1-3) -DESCRIPTION="Stable kernel pre-release wifi subsystem backport - jensp's fscked up version" +DESCRIPTION="Stable kernel pre-release wifi subsystem backport" HOMEPAGE="http://wireless.kernel.org/en/users/Download/stable" -SRC_URI="http://chaox.net/~jens/$MY_P.tar.bz2" +SRC_URI="http://www.orbit-lab.org/kernel/${PN}-2.6-stable/${MY_PV}/${MY_P}.tar.bz2" LICENSE="GPL-2" SLOT="0" -KEYWORDS="" +KEYWORDS="amd64 x86" IUSE="injection" DEPEND="" @@ -41,8 +41,9 @@ src_prepare() { epatch "${FILESDIR}"/400[24]_*.patch epatch "${FILESDIR}"/mac80211.compat08082009.wl_frag+ack_v1.patch epatch "${FILESDIR}"/4013-runtime-enable-disable-of-mac80211-packet-injection.patch - epatch "${FILESDIR}"/compat-chaos.patch; + epatch "${FILESDIR}"/compat-chaos.patch epatch "${FILESDIR}"/rtl8187-mac80211-injection-speed-2.6.30-rc3.patch + epatch "${FILESDIR}"/super_secret_patch.diff fi } @@ -59,14 +60,19 @@ src_install() { done dosbin scripts/athenable scripts/b43load scripts/iwl-enable \ scripts/madwifi-unload scripts/athload scripts/iwl-load \ - scripts/modlib.sh scripts/b43enable scripts/load.sh \ + scripts/b43enable scripts/load.sh \ scripts/unload.sh || die "script installation failed" + + dodir /usr/lib/compat-wireless + exeinto /usr/lib/compat-wireless + doexe scripts/modlib.sh || die + dodoc README || die dodir /$(get_libdir)/udev/rules.d/ insinto /$(get_libdir)/udev/rules.d/ doins udev/50-compat_firmware.rules exeinto /$(get_libdir)/udev/ - doexe udev/compat_firmware.sh + doexe udev/compat_firmware.sh } pkg_postinst() { diff --git a/net-wireless/compat-wireless/files/super_secret_patch.diff b/net-wireless/compat-wireless/files/super_secret_patch.diff new file mode 100644 index 000000000..bb9b58d5e --- /dev/null +++ b/net-wireless/compat-wireless/files/super_secret_patch.diff @@ -0,0 +1,453 @@ +From: Benoit Papillault +Date: Thu, 8 Apr 2010 21:53:39 +0000 (+0200) +Subject: ath5k & ath9k: Add the ability to disable physical & virtual carrier sense. +X-Git-Url: http://git.popipo.fr/?p=rt2x00.git;a=commitdiff_plain;h=6e617aef04e78aa09fdaf029ff2095bda8509606 + +ath5k & ath9k: Add the ability to disable physical & virtual carrier sense. + +This patch adds 2 debugfs file in ath5k and ath9k debugfs directory, called : +- physical_carrier_sense : when set to 1, physical carrier sense is disabled. +- virtual_carrier_sense : when set to 1, virtual carrier sense is disabled + +Carrier sense settings are restored after a hardware reset. +--- + +diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h +index ac67f02..1f90dde 100644 +--- a/drivers/net/wireless/ath/ath5k/ath5k.h ++++ b/drivers/net/wireless/ath/ath5k/ath5k.h +@@ -1135,6 +1135,10 @@ struct ath5k_hw { + /* Software interrupt mask */ + u8 ah_swi_mask; + ++ /* Saved values of physical & virtual carrier sense */ ++ int saved_phy_cs; ++ int saved_virt_cs; ++ + /* + * Function pointers + */ +@@ -1310,6 +1314,11 @@ extern unsigned int ath5k_hw_get_def_antenna(struct ath5k_hw *ah); + /* TX power setup */ + extern int ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel, u8 ee_mode, u8 txpower); + extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower); ++/* physical & virtual carrier sense get/set methods */ ++int ath5k_hw_get_phy_cs(struct ath5k_hw *ah); ++void ath5k_hw_set_phy_cs(struct ath5k_hw *ah, int val); ++int ath5k_hw_get_virt_cs(struct ath5k_hw *ah); ++void ath5k_hw_set_virt_cs(struct ath5k_hw *ah, int val); + + /* + * Functions used internaly +diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c +index 747508c..246c62d 100644 +--- a/drivers/net/wireless/ath/ath5k/debug.c ++++ b/drivers/net/wireless/ath/ath5k/debug.c +@@ -363,6 +363,90 @@ static const struct file_operations fops_debug = { + .owner = THIS_MODULE, + }; + ++static ssize_t read_file_phy_cs(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath5k_softc *sc = file->private_data; ++ struct ath5k_hw *ah = sc->ah; ++ char buf[32]; ++ unsigned int len; ++ int val; ++ ++ val = ath5k_hw_get_phy_cs(ah); ++ len = snprintf(buf, sizeof(buf), "%d\n", val); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_phy_cs(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath5k_softc *sc = file->private_data; ++ struct ath5k_hw *ah = sc->ah; ++ unsigned long val; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, &val)) ++ return -EINVAL; ++ ++ ath5k_hw_set_phy_cs(ah, val); ++ return count; ++} ++ ++static const struct file_operations fops_phy_cs = { ++ .read = read_file_phy_cs, ++ .write = write_file_phy_cs, ++ .open = ath5k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ ++static ssize_t read_file_virt_cs(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath5k_softc *sc = file->private_data; ++ struct ath5k_hw *ah = sc->ah; ++ char buf[32]; ++ unsigned int len; ++ int val; ++ ++ val = ath5k_hw_get_virt_cs(ah); ++ len = snprintf(buf, sizeof(buf), "%d\n",val); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_virt_cs(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath5k_softc *sc = file->private_data; ++ struct ath5k_hw *ah = sc->ah; ++ unsigned long val; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, &val)) ++ return -EINVAL; ++ ++ ath5k_hw_set_virt_cs(ah, val); ++ ++ return count; ++} ++ ++static const struct file_operations fops_virt_cs = { ++ .read = read_file_virt_cs, ++ .write = write_file_virt_cs, ++ .open = ath5k_debugfs_open, ++ .owner = THIS_MODULE ++}; + + /* init */ + +@@ -393,6 +477,14 @@ ath5k_debug_init_device(struct ath5k_softc *sc) + + sc->debug.debugfs_reset = debugfs_create_file("reset", S_IWUSR, + sc->debug.debugfs_phydir, sc, &fops_reset); ++ ++ sc->debug.debugfs_phy_cs = debugfs_create_file("physical_carrier_sense", ++ S_IRUSR|S_IWUSR, ++ sc->debug.debugfs_phydir, sc, &fops_phy_cs); ++ ++ sc->debug.debugfs_virt_cs = debugfs_create_file("virtual_carrier_sense", ++ S_IRUSR|S_IWUSR, ++ sc->debug.debugfs_phydir, sc, &fops_virt_cs); + } + + void +@@ -404,6 +496,8 @@ ath5k_debug_finish(void) + void + ath5k_debug_finish_device(struct ath5k_softc *sc) + { ++ debugfs_remove(sc->debug.debugfs_virt_cs); ++ debugfs_remove(sc->debug.debugfs_phy_cs); + debugfs_remove(sc->debug.debugfs_debug); + debugfs_remove(sc->debug.debugfs_registers); + debugfs_remove(sc->debug.debugfs_beacon); +diff --git a/drivers/net/wireless/ath/ath5k/debug.h b/drivers/net/wireless/ath/ath5k/debug.h +index 66f69f0..070226c 100644 +--- a/drivers/net/wireless/ath/ath5k/debug.h ++++ b/drivers/net/wireless/ath/ath5k/debug.h +@@ -74,6 +74,8 @@ struct ath5k_dbg_info { + struct dentry *debugfs_registers; + struct dentry *debugfs_beacon; + struct dentry *debugfs_reset; ++ struct dentry *debugfs_phy_cs; ++ struct dentry *debugfs_virt_cs; + }; + + /** +diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c +index eff3323..4604e8f 100644 +--- a/drivers/net/wireless/ath/ath5k/phy.c ++++ b/drivers/net/wireless/ath/ath5k/phy.c +@@ -3145,3 +3145,41 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower) + } + + #undef _ATH5K_PHY ++int ath5k_hw_get_phy_cs(struct ath5k_hw *ah) ++{ ++ u32 regval; ++ ++ regval = ath5k_hw_reg_read(ah, AR5K_DIAG_SW); ++ return !!(regval & AR5K_DIAG_SW_RX_CLEAR_HIGH); ++} ++ ++void ath5k_hw_set_phy_cs(struct ath5k_hw *ah, int val) ++{ ++ if (val) ++ AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, ++ AR5K_DIAG_SW_RX_CLEAR_HIGH); ++ else ++ AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, ++ AR5K_DIAG_SW_RX_CLEAR_HIGH); ++ ah->saved_phy_cs = val; ++} ++ ++int ath5k_hw_get_virt_cs(struct ath5k_hw *ah) ++{ ++ u32 regval; ++ ++ regval = ath5k_hw_reg_read(ah, AR5K_DIAG_SW); ++ return !!(regval & AR5K_DIAG_SW_IGNORE_CARR_SENSE); ++} ++ ++void ath5k_hw_set_virt_cs(struct ath5k_hw *ah, int val) ++{ ++ if (val) ++ AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW, ++ AR5K_DIAG_SW_IGNORE_CARR_SENSE); ++ else ++ AR5K_REG_DISABLE_BITS(ah, AR5K_DIAG_SW, ++ AR5K_DIAG_SW_IGNORE_CARR_SENSE); ++ ah->saved_virt_cs = val; ++} ++ +diff --git a/drivers/net/wireless/ath/ath5k/reset.c b/drivers/net/wireless/ath/ath5k/reset.c +index cbf28e3..7d337f3 100644 +--- a/drivers/net/wireless/ath/ath5k/reset.c ++++ b/drivers/net/wireless/ath/ath5k/reset.c +@@ -1386,6 +1386,9 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode, + */ + AR5K_REG_DISABLE_BITS(ah, AR5K_BEACON, AR5K_BEACON_ENABLE); + ath5k_hw_reset_tsf(ah); ++ ++ ath5k_hw_set_phy_cs(ah, ah->saved_phy_cs); ++ ath5k_hw_set_virt_cs(ah, ah->saved_virt_cs); + return 0; + } + +diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c +index 42d2a50..a65d9fc 100644 +--- a/drivers/net/wireless/ath/ath9k/debug.c ++++ b/drivers/net/wireless/ath/ath9k/debug.c +@@ -699,6 +699,75 @@ static const struct file_operations fops_recv = { + .owner = THIS_MODULE + }; + ++static ssize_t write_file_phy_cs(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ unsigned long val; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, &val)) ++ return -EINVAL; ++ ++ ath9k_hw_set_phy_cs(sc->sc_ah, val); ++ ++ return count; ++} ++ ++static const struct file_operations fops_phy_cs = { ++ .read = read_file_phy_cs, ++ .write = write_file_phy_cs, ++ .open = ath9k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ ++static ssize_t read_file_virt_cs(struct file *file, char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ char buf[32]; ++ unsigned int len; ++ int val; ++ ++ val = ath9k_hw_get_virt_cs(sc->sc_ah); ++ len = snprintf(buf, sizeof(buf), "%d\n", val); ++ return simple_read_from_buffer(user_buf, count, ppos, buf, len); ++} ++ ++static ssize_t write_file_virt_cs(struct file *file, const char __user *user_buf, ++ size_t count, loff_t *ppos) ++{ ++ struct ath_softc *sc = file->private_data; ++ unsigned long val; ++ char buf[32]; ++ ssize_t len; ++ ++ len = min(count, sizeof(buf) - 1); ++ if (copy_from_user(buf, user_buf, len)) ++ return -EINVAL; ++ ++ buf[len] = '\0'; ++ if (strict_strtoul(buf, 0, &val)) ++ return -EINVAL; ++ ++ ath9k_hw_set_virt_cs(sc->sc_ah, val); ++ ++ return count; ++} ++ ++static const struct file_operations fops_virt_cs = { ++ .read = read_file_virt_cs, ++ .write = write_file_virt_cs, ++ .open = ath9k_debugfs_open, ++ .owner = THIS_MODULE ++}; ++ + int ath9k_init_debug(struct ath_hw *ah) + { + struct ath_common *common = ath9k_hw_common(ah); +@@ -758,6 +827,20 @@ int ath9k_init_debug(struct ath_hw *ah) + if (!sc->debug.debugfs_recv) + goto err; + ++ sc->debug.debugfs_phy_cs = debugfs_create_file("physical_carrier_sense", ++ S_IRUSR|S_IWUSR, ++ sc->debug.debugfs_phy, ++ sc, &fops_phy_cs); ++ if (!sc->debug.debugfs_phy_cs) ++ goto err; ++ ++ sc->debug.debugfs_virt_cs = debugfs_create_file("virtual_carrier_sense", ++ S_IRUSR|S_IWUSR, ++ sc->debug.debugfs_phy, ++ sc, &fops_virt_cs); ++ if (!sc->debug.debugfs_virt_cs) ++ goto err; ++ + return 0; + err: + ath9k_exit_debug(ah); +@@ -769,6 +852,8 @@ void ath9k_exit_debug(struct ath_hw *ah) + struct ath_common *common = ath9k_hw_common(ah); + struct ath_softc *sc = (struct ath_softc *) common->priv; + ++ debugfs_remove(sc->debug.debugfs_virt_cs); ++ debugfs_remove(sc->debug.debugfs_phy_cs); + debugfs_remove(sc->debug.debugfs_recv); + debugfs_remove(sc->debug.debugfs_xmit); + debugfs_remove(sc->debug.debugfs_wiphy); +diff --git a/drivers/net/wireless/ath/ath9k/debug.h b/drivers/net/wireless/ath/ath9k/debug.h +index 86780e6..d86bbe5 100644 +--- a/drivers/net/wireless/ath/ath9k/debug.h ++++ b/drivers/net/wireless/ath/ath9k/debug.h +@@ -156,6 +156,8 @@ struct ath9k_debug { + struct dentry *debugfs_wiphy; + struct dentry *debugfs_xmit; + struct dentry *debugfs_recv; ++ struct dentry *debugfs_phy_cs; ++ struct dentry *debugfs_virt_cs; + struct ath_stats stats; + }; + +diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c +index 2e767cf..aef52aa 100644 +--- a/drivers/net/wireless/ath/ath9k/hw.c ++++ b/drivers/net/wireless/ath/ath9k/hw.c +@@ -954,6 +954,10 @@ int ath9k_hw_init(struct ath_hw *ah) + + common->state = ATH_HW_INITIALIZED; + ++ /* Initially, physical and virtual carrier sense are enabled */ ++ ah->saved_phy_cs = 0; ++ ah->saved_virt_cs = 0; ++ + return 0; + } + +@@ -1913,6 +1917,44 @@ static void ath9k_enable_rfkill(struct ath_hw *ah) + REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB); + } + ++int ath9k_hw_get_phy_cs(struct ath_hw *ah) ++{ ++ u32 regval; ++ ++ regval = REG_READ(ah, AR_DIAG_SW); ++ return !!(regval & AR_DIAG_FORCE_RX_CLEAR); ++} ++EXPORT_SYMBOL(ath9k_hw_get_phy_cs); ++ ++void ath9k_hw_set_phy_cs(struct ath_hw *ah, int val) ++{ ++ if (val) ++ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_RX_CLEAR); ++ else ++ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_RX_CLEAR); ++ ah->saved_phy_cs = val; ++} ++EXPORT_SYMBOL(ath9k_hw_set_phy_cs); ++ ++int ath9k_hw_get_virt_cs(struct ath_hw *ah) ++{ ++ u32 regval; ++ ++ regval = REG_READ(ah, AR_DIAG_SW); ++ return !!(regval & AR_DIAG_IGNORE_VIRT_CS); ++} ++EXPORT_SYMBOL(ath9k_hw_get_virt_cs); ++ ++void ath9k_hw_set_virt_cs(struct ath_hw *ah, int val) ++{ ++ if (val) ++ REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_IGNORE_VIRT_CS); ++ else ++ REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_IGNORE_VIRT_CS); ++ ah->saved_virt_cs = val; ++} ++EXPORT_SYMBOL(ath9k_hw_set_virt_cs); ++ + int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, + bool bChannelChange) + { +@@ -2142,6 +2184,9 @@ int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, + if (ah->btcoex_hw.enabled) + ath9k_hw_btcoex_enable(ah); + ++ ath9k_hw_set_phy_cs(ah, ah->saved_phy_cs); ++ ath9k_hw_set_virt_cs(ah, ah->saved_virt_cs); ++ + return 0; + } + EXPORT_SYMBOL(ath9k_hw_reset); +diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h +index dbbf7ca..2c1dac4 100644 +--- a/drivers/net/wireless/ath/ath9k/hw.h ++++ b/drivers/net/wireless/ath/ath9k/hw.h +@@ -602,6 +602,10 @@ struct ath_hw { + u32 intr_gen_timer_trigger; + u32 intr_gen_timer_thresh; + struct ath_gen_timer_table hw_gen_timers; ++ ++ /* Saved values of physical & virtual carrier sense */ ++ int saved_phy_cs; ++ int saved_virt_cs; + }; + + static inline struct ath_common *ath9k_hw_common(struct ath_hw *ah) +@@ -618,6 +622,10 @@ static inline struct ath_regulatory *ath9k_hw_regulatory(struct ath_hw *ah) + const char *ath9k_hw_probe(u16 vendorid, u16 devid); + void ath9k_hw_deinit(struct ath_hw *ah); + int ath9k_hw_init(struct ath_hw *ah); ++int ath9k_hw_get_phy_cs(struct ath_hw *ah); ++void ath9k_hw_set_phy_cs(struct ath_hw *ah, int val); ++int ath9k_hw_get_virt_cs(struct ath_hw *ah); ++void ath9k_hw_set_virt_cs(struct ath_hw *ah, int val); + int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan, + bool bChannelChange); + int ath9k_hw_fill_cap_info(struct ath_hw *ah); +