* [PATCH 08/12] ath9k: Use standard #defines for PCIe Capability ASPM fields
[not found] <20121205205724.13851.50508.stgit@bhelgaas.mtv.corp.google.com>
@ 2012-12-05 20:58 ` Bjorn Helgaas
2012-12-05 20:58 ` [PATCH 09/12] iwlegacy: collapse wrapper for pcie_capability_read_word() Bjorn Helgaas
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2012-12-05 20:58 UTC (permalink / raw)
To: linux-pci
Cc: Vasanthakumar Thiagarajan, Jouni Malinen, linux-wireless,
John W. Linville, Luis R. Rodriguez, ath9k-devel,
Senthil Balasubramanian
Use the standard #defines for PCIe Capability ASPM fields.
Previously we used PCIE_LINK_STATE_L0S and PCIE_LINK_STATE_L1 directly, but
these are defined for the Linux ASPM interfaces, e.g.,
pci_disable_link_state(), and only coincidentally match the actual register
bits. PCIE_LINK_STATE_CLKPM, also part of that interface, does not match
the register bit.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>
CC: Jouni Malinen <jouni@qca.qualcomm.com>
CC: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
CC: Senthil Balasubramanian <senthilb@qca.qualcomm.com>
CC: linux-wireless@vger.kernel.org
CC: ath9k-devel@lists.ath9k.org
---
drivers/net/wireless/ath/ath9k/pci.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index f088f4b..71d8207 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -125,23 +125,23 @@ static void ath_pci_aspm_init(struct ath_common *common)
if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) &&
(AR_SREV_9285(ah))) {
- /* Bluetooth coexistance requires disabling ASPM. */
+ /* Bluetooth coexistence requires disabling ASPM. */
pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL,
- PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
+ PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);
/*
* Both upstream and downstream PCIe components should
* have the same ASPM settings.
*/
pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
- PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
+ PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);
ath_info(common, "Disabling ASPM since BTCOEX is enabled\n");
return;
}
pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
- if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) {
+ if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {
ah->aspm_enabled = true;
/* Initialize PCIe PM and SERDES registers. */
ath9k_hw_configpcipowersave(ah, false);
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 09/12] iwlegacy: collapse wrapper for pcie_capability_read_word()
[not found] <20121205205724.13851.50508.stgit@bhelgaas.mtv.corp.google.com>
2012-12-05 20:58 ` [PATCH 08/12] ath9k: Use standard #defines for PCIe Capability ASPM fields Bjorn Helgaas
@ 2012-12-05 20:58 ` Bjorn Helgaas
2012-12-06 8:19 ` Stanislaw Gruszka
2012-12-05 20:58 ` [PATCH 10/12] iwlwifi: " Bjorn Helgaas
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2012-12-05 20:58 UTC (permalink / raw)
To: linux-pci; +Cc: linux-wireless, Stanislaw Gruszka, John W. Linville
il_pcie_link_ctl() has only one call site and no longer provides any useful
abstraction, so collapse it into the caller.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Stanislaw Gruszka <sgruszka@redhat.com>
CC: linux-wireless@vger.kernel.org
---
drivers/net/wireless/iwlegacy/common.c | 5 +++--
drivers/net/wireless/iwlegacy/common.h | 8 --------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 318ed3c..1811507 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -1183,8 +1183,9 @@ EXPORT_SYMBOL(il_power_update_mode);
void
il_power_initialize(struct il_priv *il)
{
- u16 lctl = il_pcie_link_ctl(il);
+ u16 lctl;
+ pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
il->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
il->power_data.debug_sleep_level_override = -1;
@@ -4233,7 +4234,7 @@ il_apm_init(struct il_priv *il)
* power savings, even without L1.
*/
if (il->cfg->set_l0s) {
- lctl = il_pcie_link_ctl(il);
+ pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
PCI_CFG_LINK_CTRL_VAL_L1_EN) {
/* L1-ASPM enabled; disable(!) L0S */
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index b4bb813..c9a5022 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -1829,14 +1829,6 @@ int il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd);
* PCI *
*****************************************************/
-static inline u16
-il_pcie_link_ctl(struct il_priv *il)
-{
- u16 pci_lnk_ctl;
- pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &pci_lnk_ctl);
- return pci_lnk_ctl;
-}
-
void il_bg_watchdog(unsigned long data);
u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval);
__le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon,
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 10/12] iwlwifi: collapse wrapper for pcie_capability_read_word()
[not found] <20121205205724.13851.50508.stgit@bhelgaas.mtv.corp.google.com>
2012-12-05 20:58 ` [PATCH 08/12] ath9k: Use standard #defines for PCIe Capability ASPM fields Bjorn Helgaas
2012-12-05 20:58 ` [PATCH 09/12] iwlegacy: collapse wrapper for pcie_capability_read_word() Bjorn Helgaas
@ 2012-12-05 20:58 ` Bjorn Helgaas
2012-12-05 20:58 ` [PATCH 11/12] iwlegacy: Use standard #defines for PCIe Capability ASPM fields Bjorn Helgaas
2012-12-05 20:58 ` [PATCH 12/12] iwlwifi: " Bjorn Helgaas
4 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2012-12-05 20:58 UTC (permalink / raw)
To: linux-pci
Cc: Intel Linux Wireless, linux-wireless, John W. Linville,
Johannes Berg, Wey-Yi Guy
iwl_pciexp_link_ctrl() has only one call site and no longer provides any
useful abstraction, so collapse it into the caller.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Johannes Berg <johannes.berg@intel.com>
CC: Wey-Yi Guy <wey-yi.w.guy@intel.com>
CC: Intel Linux Wireless <ilw@linux.intel.com>
CC: linux-wireless@vger.kernel.org
---
drivers/net/wireless/iwlwifi/pcie/trans.c | 13 +++----------
1 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index fe0fffd..5cd06b3 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -673,18 +673,11 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans)
#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
-static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans)
+static void iwl_apm_config(struct iwl_trans *trans)
{
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
- u16 pci_lnk_ctl;
-
- pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL,
- &pci_lnk_ctl);
- return pci_lnk_ctl;
-}
+ u16 lctl;
-static void iwl_apm_config(struct iwl_trans *trans)
-{
/*
* HW bug W/A for instability in PCIe bus L0S->L1 transition.
* Check if BIOS (or OS) enabled L1-ASPM on this device.
@@ -693,8 +686,8 @@ static void iwl_apm_config(struct iwl_trans *trans)
* If not (unlikely), enable L0S, so there is at least some
* power savings, even without L1.
*/
- u16 lctl = iwl_pciexp_link_ctrl(trans);
+ pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl);
if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
PCI_CFG_LINK_CTRL_VAL_L1_EN) {
/* L1-ASPM enabled; disable(!) L0S */
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 11/12] iwlegacy: Use standard #defines for PCIe Capability ASPM fields
[not found] <20121205205724.13851.50508.stgit@bhelgaas.mtv.corp.google.com>
` (2 preceding siblings ...)
2012-12-05 20:58 ` [PATCH 10/12] iwlwifi: " Bjorn Helgaas
@ 2012-12-05 20:58 ` Bjorn Helgaas
2012-12-06 8:20 ` Stanislaw Gruszka
2012-12-05 20:58 ` [PATCH 12/12] iwlwifi: " Bjorn Helgaas
4 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2012-12-05 20:58 UTC (permalink / raw)
To: linux-pci; +Cc: linux-wireless, Stanislaw Gruszka, John W. Linville
Use the standard #defines rather than creating local definitions for
PCIe Capability ASPM fields.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Stanislaw Gruszka <sgruszka@redhat.com>
CC: linux-wireless@vger.kernel.org
---
drivers/net/wireless/iwlegacy/4965.h | 4 ----
drivers/net/wireless/iwlegacy/common.c | 5 ++---
drivers/net/wireless/iwlegacy/common.h | 4 ----
3 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h
index 2d092f3..1b15b0b 100644
--- a/drivers/net/wireless/iwlegacy/4965.h
+++ b/drivers/net/wireless/iwlegacy/4965.h
@@ -917,10 +917,6 @@ struct il4965_scd_bc_tbl {
/* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041
-/* PCI register values */
-#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
-#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
-
#define IL4965_DEFAULT_TX_RETRY 15
/* EEPROM */
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 1811507..7e16d10 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -1186,7 +1186,7 @@ il_power_initialize(struct il_priv *il)
u16 lctl;
pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
- il->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
+ il->power_data.pci_pm = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
il->power_data.debug_sleep_level_override = -1;
@@ -4235,8 +4235,7 @@ il_apm_init(struct il_priv *il)
*/
if (il->cfg->set_l0s) {
pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
- if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
- PCI_CFG_LINK_CTRL_VAL_L1_EN) {
+ if (lctl & PCI_EXP_LNKCTL_ASPM_L1) {
/* L1-ASPM enabled; disable(!) L0S */
il_set_bit(il, CSR_GIO_REG,
CSR_GIO_REG_VAL_L0S_ENABLED);
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index c9a5022..e181f3b 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -2426,10 +2426,6 @@ struct il_tfd {
/* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041
-/* PCI register values */
-#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
-#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
-
struct il_rate_info {
u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */
u8 plcp_siso; /* uCode API: RATE_SISO_6M_PLCP, etc. */
^ permalink raw reply related [flat|nested] 10+ messages in thread* [PATCH 12/12] iwlwifi: Use standard #defines for PCIe Capability ASPM fields
[not found] <20121205205724.13851.50508.stgit@bhelgaas.mtv.corp.google.com>
` (3 preceding siblings ...)
2012-12-05 20:58 ` [PATCH 11/12] iwlegacy: Use standard #defines for PCIe Capability ASPM fields Bjorn Helgaas
@ 2012-12-05 20:58 ` Bjorn Helgaas
2012-12-05 21:04 ` Johannes Berg
4 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2012-12-05 20:58 UTC (permalink / raw)
To: linux-pci
Cc: Intel Linux Wireless, linux-wireless, John W. Linville,
Johannes Berg, Wey-Yi Guy
Use the standard #defines rather than creating local definitions for
PCIe Capability ASPM fields.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Johannes Berg <johannes.berg@intel.com>
CC: Wey-Yi Guy <wey-yi.w.guy@intel.com>
CC: Intel Linux Wireless <ilw@linux.intel.com>
CC: linux-wireless@vger.kernel.org
---
drivers/net/wireless/iwlwifi/pcie/trans.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 5cd06b3..1dfa6be 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -670,8 +670,6 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans)
/* PCI registers */
#define PCI_CFG_RETRY_TIMEOUT 0x041
-#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
-#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
static void iwl_apm_config(struct iwl_trans *trans)
{
@@ -688,8 +686,7 @@ static void iwl_apm_config(struct iwl_trans *trans)
*/
pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl);
- if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) ==
- PCI_CFG_LINK_CTRL_VAL_L1_EN) {
+ if (lctl & PCI_EXP_LNKCTL_ASPM_L1) {
/* L1-ASPM enabled; disable(!) L0S */
iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
dev_printk(KERN_INFO, trans->dev,
@@ -700,7 +697,7 @@ static void iwl_apm_config(struct iwl_trans *trans)
dev_printk(KERN_INFO, trans->dev,
"L1 Disabled; Enabling L0S\n");
}
- trans->pm_support = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN);
+ trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
}
/*
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH 12/12] iwlwifi: Use standard #defines for PCIe Capability ASPM fields
2012-12-05 20:58 ` [PATCH 12/12] iwlwifi: " Bjorn Helgaas
@ 2012-12-05 21:04 ` Johannes Berg
2012-12-05 21:20 ` Bjorn Helgaas
0 siblings, 1 reply; 10+ messages in thread
From: Johannes Berg @ 2012-12-05 21:04 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, Intel Linux Wireless, linux-wireless, John W. Linville,
Wey-Yi Guy
On Wed, 2012-12-05 at 13:58 -0700, Bjorn Helgaas wrote:
> Use the standard #defines rather than creating local definitions for
> PCIe Capability ASPM fields.
I'll pick up the iwlwifi ones if you want, or do you want to merge them
somewhere centrally instead?
johannes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 12/12] iwlwifi: Use standard #defines for PCIe Capability ASPM fields
2012-12-05 21:04 ` Johannes Berg
@ 2012-12-05 21:20 ` Bjorn Helgaas
2012-12-05 21:26 ` Johannes Berg
0 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2012-12-05 21:20 UTC (permalink / raw)
To: Johannes Berg
Cc: linux-pci, Intel Linux Wireless, linux-wireless, John W. Linville,
Wey-Yi Guy
On Wed, Dec 5, 2012 at 2:04 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2012-12-05 at 13:58 -0700, Bjorn Helgaas wrote:
>> Use the standard #defines rather than creating local definitions for
>> PCIe Capability ASPM fields.
>
> I'll pick up the iwlwifi ones if you want, or do you want to merge them
> somewhere centrally instead?
They do depend on a previous patch that adds the #defines to
include/uapi/linux/pci_regs.h
(http://marc.info/?l=linux-pci&m=135474107109010&w=2).
I think I'll merge at least the PCI core parts of this via my PCI tree
in the v3.8 merge window next week. If it won't cause conflicts for
you, I could include the iwlwifi bits there, too. If it does, at
least the #define will exist and you can merge it at your leisure.
Bjorn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 12/12] iwlwifi: Use standard #defines for PCIe Capability ASPM fields
2012-12-05 21:20 ` Bjorn Helgaas
@ 2012-12-05 21:26 ` Johannes Berg
0 siblings, 0 replies; 10+ messages in thread
From: Johannes Berg @ 2012-12-05 21:26 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, Intel Linux Wireless, linux-wireless, John W. Linville,
Wey-Yi Guy
On Wed, 2012-12-05 at 14:20 -0700, Bjorn Helgaas wrote:
> On Wed, Dec 5, 2012 at 2:04 PM, Johannes Berg <johannes@sipsolutions.net> wrote:
> > On Wed, 2012-12-05 at 13:58 -0700, Bjorn Helgaas wrote:
> >> Use the standard #defines rather than creating local definitions for
> >> PCIe Capability ASPM fields.
> >
> > I'll pick up the iwlwifi ones if you want, or do you want to merge them
> > somewhere centrally instead?
>
> They do depend on a previous patch that adds the #defines to
> include/uapi/linux/pci_regs.h
> (http://marc.info/?l=linux-pci&m=135474107109010&w=2).
>
> I think I'll merge at least the PCI core parts of this via my PCI tree
> in the v3.8 merge window next week. If it won't cause conflicts for
> you, I could include the iwlwifi bits there, too. If it does, at
> least the #define will exist and you can merge it at your leisure.
Ok, that's fine, feel free to include the iwlwifi bits.
Acked-by: Johannes Berg <johannes.berg@intel.com>
:)
johannes
^ permalink raw reply [flat|nested] 10+ messages in thread