aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2012-12-07 14:11:52 -0500
committerBjorn Helgaas <bhelgaas@google.com>2012-12-07 14:11:52 -0500
commit27e1c8ee0170e80f6426c35d54f3b5cd9dadb25b (patch)
tree5188300ea7cc05db7aebee53366c0556e5d8eaf9 /drivers
parent72e1e868ca8f14ef34c95e0e8b73f64b6acf5934 (diff)
parenta875621ec15318f0ba35907726ee2cb9e9e0c6b7 (diff)
Merge branch 'pci/bjorn-pcie-cap' into next
* pci/bjorn-pcie-cap: ath9k: Use standard #defines for PCIe Capability ASPM fields iwlwifi: Use standard #defines for PCIe Capability ASPM fields iwlwifi: collapse wrapper for pcie_capability_read_word() iwlegacy: Use standard #defines for PCIe Capability ASPM fields iwlegacy: collapse wrapper for pcie_capability_read_word() cxgb3: Use standard #defines for PCIe Capability ASPM fields PCI: Add standard PCIe Capability Link ASPM field names PCI/portdrv: Use PCI Express Capability accessors PCI: Use standard PCIe Capability Link register field names PCI: Add and use standard PCI-X Capability register names
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/chelsio/cxgb3/t3_hw.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c8
-rw-r--r--drivers/net/wireless/iwlegacy/4965.h4
-rw-r--r--drivers/net/wireless/iwlegacy/common.c10
-rw-r--r--drivers/net/wireless/iwlegacy/common.h12
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/trans.c20
-rw-r--r--drivers/pci/pcie/aspm.c11
-rw-r--r--drivers/pci/pcie/portdrv_core.c3
-rw-r--r--drivers/pci/probe.c19
9 files changed, 33 insertions, 56 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
index aef45d3113ba..3dee68612c9e 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c
@@ -3307,7 +3307,7 @@ static void config_pcie(struct adapter *adap)
3307 G_NUMFSTTRNSEQRX(t3_read_reg(adap, A_PCIE_MODE)); 3307 G_NUMFSTTRNSEQRX(t3_read_reg(adap, A_PCIE_MODE));
3308 log2_width = fls(adap->params.pci.width) - 1; 3308 log2_width = fls(adap->params.pci.width) - 1;
3309 acklat = ack_lat[log2_width][pldsize]; 3309 acklat = ack_lat[log2_width][pldsize];
3310 if (val & 1) /* check LOsEnable */ 3310 if (val & PCI_EXP_LNKCTL_ASPM_L0S) /* check LOsEnable */
3311 acklat += fst_trn_tx * 4; 3311 acklat += fst_trn_tx * 4;
3312 rpllmt = rpl_tmr[log2_width][pldsize] + fst_trn_rx * 4; 3312 rpllmt = rpl_tmr[log2_width][pldsize] + fst_trn_rx * 4;
3313 3313
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index f088f4bf9a26..71d82078fc7f 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)
125 125
126 if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) && 126 if ((ath9k_hw_get_btcoex_scheme(ah) != ATH_BTCOEX_CFG_NONE) &&
127 (AR_SREV_9285(ah))) { 127 (AR_SREV_9285(ah))) {
128 /* Bluetooth coexistance requires disabling ASPM. */ 128 /* Bluetooth coexistence requires disabling ASPM. */
129 pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL, 129 pcie_capability_clear_word(pdev, PCI_EXP_LNKCTL,
130 PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); 130 PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);
131 131
132 /* 132 /*
133 * Both upstream and downstream PCIe components should 133 * Both upstream and downstream PCIe components should
134 * have the same ASPM settings. 134 * have the same ASPM settings.
135 */ 135 */
136 pcie_capability_clear_word(parent, PCI_EXP_LNKCTL, 136 pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
137 PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); 137 PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1);
138 138
139 ath_info(common, "Disabling ASPM since BTCOEX is enabled\n"); 139 ath_info(common, "Disabling ASPM since BTCOEX is enabled\n");
140 return; 140 return;
141 } 141 }
142 142
143 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm); 143 pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
144 if (aspm & (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)) { 144 if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {
145 ah->aspm_enabled = true; 145 ah->aspm_enabled = true;
146 /* Initialize PCIe PM and SERDES registers. */ 146 /* Initialize PCIe PM and SERDES registers. */
147 ath9k_hw_configpcipowersave(ah, false); 147 ath9k_hw_configpcipowersave(ah, false);
diff --git a/drivers/net/wireless/iwlegacy/4965.h b/drivers/net/wireless/iwlegacy/4965.h
index 2d092f328547..1b15b0b2292b 100644
--- a/drivers/net/wireless/iwlegacy/4965.h
+++ b/drivers/net/wireless/iwlegacy/4965.h
@@ -917,10 +917,6 @@ struct il4965_scd_bc_tbl {
917/* PCI registers */ 917/* PCI registers */
918#define PCI_CFG_RETRY_TIMEOUT 0x041 918#define PCI_CFG_RETRY_TIMEOUT 0x041
919 919
920/* PCI register values */
921#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
922#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
923
924#define IL4965_DEFAULT_TX_RETRY 15 920#define IL4965_DEFAULT_TX_RETRY 15
925 921
926/* EEPROM */ 922/* EEPROM */
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 318ed3c9fe74..7e16d10a7f14 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -1183,9 +1183,10 @@ EXPORT_SYMBOL(il_power_update_mode);
1183void 1183void
1184il_power_initialize(struct il_priv *il) 1184il_power_initialize(struct il_priv *il)
1185{ 1185{
1186 u16 lctl = il_pcie_link_ctl(il); 1186 u16 lctl;
1187 1187
1188 il->power_data.pci_pm = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); 1188 pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
1189 il->power_data.pci_pm = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
1189 1190
1190 il->power_data.debug_sleep_level_override = -1; 1191 il->power_data.debug_sleep_level_override = -1;
1191 1192
@@ -4233,9 +4234,8 @@ il_apm_init(struct il_priv *il)
4233 * power savings, even without L1. 4234 * power savings, even without L1.
4234 */ 4235 */
4235 if (il->cfg->set_l0s) { 4236 if (il->cfg->set_l0s) {
4236 lctl = il_pcie_link_ctl(il); 4237 pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &lctl);
4237 if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == 4238 if (lctl & PCI_EXP_LNKCTL_ASPM_L1) {
4238 PCI_CFG_LINK_CTRL_VAL_L1_EN) {
4239 /* L1-ASPM enabled; disable(!) L0S */ 4239 /* L1-ASPM enabled; disable(!) L0S */
4240 il_set_bit(il, CSR_GIO_REG, 4240 il_set_bit(il, CSR_GIO_REG,
4241 CSR_GIO_REG_VAL_L0S_ENABLED); 4241 CSR_GIO_REG_VAL_L0S_ENABLED);
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index b4bb813362bd..e181f3b573d9 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);
1829 * PCI * 1829 * PCI *
1830 *****************************************************/ 1830 *****************************************************/
1831 1831
1832static inline u16
1833il_pcie_link_ctl(struct il_priv *il)
1834{
1835 u16 pci_lnk_ctl;
1836 pcie_capability_read_word(il->pci_dev, PCI_EXP_LNKCTL, &pci_lnk_ctl);
1837 return pci_lnk_ctl;
1838}
1839
1840void il_bg_watchdog(unsigned long data); 1832void il_bg_watchdog(unsigned long data);
1841u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval); 1833u32 il_usecs_to_beacons(struct il_priv *il, u32 usec, u32 beacon_interval);
1842__le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon, 1834__le32 il_add_beacon_time(struct il_priv *il, u32 base, u32 addon,
@@ -2434,10 +2426,6 @@ struct il_tfd {
2434/* PCI registers */ 2426/* PCI registers */
2435#define PCI_CFG_RETRY_TIMEOUT 0x041 2427#define PCI_CFG_RETRY_TIMEOUT 0x041
2436 2428
2437/* PCI register values */
2438#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
2439#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
2440
2441struct il_rate_info { 2429struct il_rate_info {
2442 u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */ 2430 u8 plcp; /* uCode API: RATE_6M_PLCP, etc. */
2443 u8 plcp_siso; /* uCode API: RATE_SISO_6M_PLCP, etc. */ 2431 u8 plcp_siso; /* uCode API: RATE_SISO_6M_PLCP, etc. */
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index fe0fffd04304..1dfa6be03058 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -670,21 +670,12 @@ static void iwl_set_pwr_vmain(struct iwl_trans *trans)
670 670
671/* PCI registers */ 671/* PCI registers */
672#define PCI_CFG_RETRY_TIMEOUT 0x041 672#define PCI_CFG_RETRY_TIMEOUT 0x041
673#define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
674#define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
675 673
676static u16 iwl_pciexp_link_ctrl(struct iwl_trans *trans) 674static void iwl_apm_config(struct iwl_trans *trans)
677{ 675{
678 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 676 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
679 u16 pci_lnk_ctl; 677 u16 lctl;
680
681 pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL,
682 &pci_lnk_ctl);
683 return pci_lnk_ctl;
684}
685 678
686static void iwl_apm_config(struct iwl_trans *trans)
687{
688 /* 679 /*
689 * HW bug W/A for instability in PCIe bus L0S->L1 transition. 680 * HW bug W/A for instability in PCIe bus L0S->L1 transition.
690 * Check if BIOS (or OS) enabled L1-ASPM on this device. 681 * Check if BIOS (or OS) enabled L1-ASPM on this device.
@@ -693,10 +684,9 @@ static void iwl_apm_config(struct iwl_trans *trans)
693 * If not (unlikely), enable L0S, so there is at least some 684 * If not (unlikely), enable L0S, so there is at least some
694 * power savings, even without L1. 685 * power savings, even without L1.
695 */ 686 */
696 u16 lctl = iwl_pciexp_link_ctrl(trans);
697 687
698 if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == 688 pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl);
699 PCI_CFG_LINK_CTRL_VAL_L1_EN) { 689 if (lctl & PCI_EXP_LNKCTL_ASPM_L1) {
700 /* L1-ASPM enabled; disable(!) L0S */ 690 /* L1-ASPM enabled; disable(!) L0S */
701 iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); 691 iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
702 dev_printk(KERN_INFO, trans->dev, 692 dev_printk(KERN_INFO, trans->dev,
@@ -707,7 +697,7 @@ static void iwl_apm_config(struct iwl_trans *trans)
707 dev_printk(KERN_INFO, trans->dev, 697 dev_printk(KERN_INFO, trans->dev,
708 "L1 Disabled; Enabling L0S\n"); 698 "L1 Disabled; Enabling L0S\n");
709 } 699 }
710 trans->pm_support = !(lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN); 700 trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S);
711} 701}
712 702
713/* 703/*
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 3da9ecc9ab84..b52630b8eada 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -426,7 +426,8 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
426 426
427static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val) 427static void pcie_config_aspm_dev(struct pci_dev *pdev, u32 val)
428{ 428{
429 pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL, 0x3, val); 429 pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
430 PCI_EXP_LNKCTL_ASPMC, val);
430} 431}
431 432
432static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state) 433static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
@@ -441,12 +442,12 @@ static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state)
441 return; 442 return;
442 /* Convert ASPM state to upstream/downstream ASPM register state */ 443 /* Convert ASPM state to upstream/downstream ASPM register state */
443 if (state & ASPM_STATE_L0S_UP) 444 if (state & ASPM_STATE_L0S_UP)
444 dwstream |= PCIE_LINK_STATE_L0S; 445 dwstream |= PCI_EXP_LNKCTL_ASPM_L0S;
445 if (state & ASPM_STATE_L0S_DW) 446 if (state & ASPM_STATE_L0S_DW)
446 upstream |= PCIE_LINK_STATE_L0S; 447 upstream |= PCI_EXP_LNKCTL_ASPM_L0S;
447 if (state & ASPM_STATE_L1) { 448 if (state & ASPM_STATE_L1) {
448 upstream |= PCIE_LINK_STATE_L1; 449 upstream |= PCI_EXP_LNKCTL_ASPM_L1;
449 dwstream |= PCIE_LINK_STATE_L1; 450 dwstream |= PCI_EXP_LNKCTL_ASPM_L1;
450 } 451 }
451 /* 452 /*
452 * Spec 2.0 suggests all functions should be configured the 453 * Spec 2.0 suggests all functions should be configured the
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index ed129b414624..b42133afca98 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -120,8 +120,7 @@ static int pcie_port_enable_msix(struct pci_dev *dev, int *vectors, int mask)
120 * the value in this field indicates which MSI-X Table entry is 120 * the value in this field indicates which MSI-X Table entry is
121 * used to generate the interrupt message." 121 * used to generate the interrupt message."
122 */ 122 */
123 pos = pci_pcie_cap(dev); 123 pcie_capability_read_word(dev, PCI_EXP_FLAGS, &reg16);
124 pci_read_config_word(dev, pos + PCI_EXP_FLAGS, &reg16);
125 entry = (reg16 & PCI_EXP_FLAGS_IRQ) >> 9; 124 entry = (reg16 & PCI_EXP_FLAGS_IRQ) >> 9;
126 if (entry >= nr_entries) 125 if (entry >= nr_entries)
127 goto Error; 126 goto Error;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 293af5a6f912..d46ef2df23da 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -521,7 +521,7 @@ static unsigned char pcie_link_speed[] = {
521 521
522void pcie_update_link_speed(struct pci_bus *bus, u16 linksta) 522void pcie_update_link_speed(struct pci_bus *bus, u16 linksta)
523{ 523{
524 bus->cur_bus_speed = pcie_link_speed[linksta & 0xf]; 524 bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS];
525} 525}
526EXPORT_SYMBOL_GPL(pcie_update_link_speed); 526EXPORT_SYMBOL_GPL(pcie_update_link_speed);
527 527
@@ -579,14 +579,16 @@ static void pci_set_bus_speed(struct pci_bus *bus)
579 if (pos) { 579 if (pos) {
580 u16 status; 580 u16 status;
581 enum pci_bus_speed max; 581 enum pci_bus_speed max;
582 pci_read_config_word(bridge, pos + 2, &status);
583 582
584 if (status & 0x8000) { 583 pci_read_config_word(bridge, pos + PCI_X_BRIDGE_SSTATUS,
584 &status);
585
586 if (status & PCI_X_SSTATUS_533MHZ) {
585 max = PCI_SPEED_133MHz_PCIX_533; 587 max = PCI_SPEED_133MHz_PCIX_533;
586 } else if (status & 0x4000) { 588 } else if (status & PCI_X_SSTATUS_266MHZ) {
587 max = PCI_SPEED_133MHz_PCIX_266; 589 max = PCI_SPEED_133MHz_PCIX_266;
588 } else if (status & 0x0002) { 590 } else if (status & PCI_X_SSTATUS_133MHZ) {
589 if (((status >> 12) & 0x3) == 2) { 591 if ((status & PCI_X_SSTATUS_VERS) == PCI_X_SSTATUS_V2) {
590 max = PCI_SPEED_133MHz_PCIX_ECC; 592 max = PCI_SPEED_133MHz_PCIX_ECC;
591 } else { 593 } else {
592 max = PCI_SPEED_133MHz_PCIX; 594 max = PCI_SPEED_133MHz_PCIX;
@@ -596,7 +598,8 @@ static void pci_set_bus_speed(struct pci_bus *bus)
596 } 598 }
597 599
598 bus->max_bus_speed = max; 600 bus->max_bus_speed = max;
599 bus->cur_bus_speed = pcix_bus_speed[(status >> 6) & 0xf]; 601 bus->cur_bus_speed = pcix_bus_speed[
602 (status & PCI_X_SSTATUS_FREQ) >> 6];
600 603
601 return; 604 return;
602 } 605 }
@@ -607,7 +610,7 @@ static void pci_set_bus_speed(struct pci_bus *bus)
607 u16 linksta; 610 u16 linksta;
608 611
609 pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap); 612 pcie_capability_read_dword(bridge, PCI_EXP_LNKCAP, &linkcap);
610 bus->max_bus_speed = pcie_link_speed[linkcap & 0xf]; 613 bus->max_bus_speed = pcie_link_speed[linkcap & PCI_EXP_LNKCAP_SLS];
611 614
612 pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta); 615 pcie_capability_read_word(bridge, PCI_EXP_LNKSTA, &linksta);
613 pcie_update_link_speed(bus, linksta); 616 pcie_update_link_speed(bus, linksta);