diff options
author | Michael Wu <flamingice@sourmilk.net> | 2007-09-24 18:10:25 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:53:09 -0400 |
commit | f6ac0adf54ed3fc7fa47e66b92defcbdf37b44ab (patch) | |
tree | 9a0a07c1de6e0f0cf1ef2963d1e5a0112dc85199 | |
parent | 0d282764eb82f89395493b5e0541c1e30c985838 (diff) |
[PATCH] adm8211: Use revision from pci_dev
No need to load the revision ourselves anymore.
Signed-off-by: Michael Wu <flamingice@sourmilk.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/adm8211.c | 44 | ||||
-rw-r--r-- | drivers/net/wireless/adm8211.h | 4 |
2 files changed, 22 insertions, 26 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index ce1f8e304eaa..e950a7d55711 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c | |||
@@ -117,7 +117,7 @@ static int adm8211_read_eeprom(struct ieee80211_hw *dev) | |||
117 | break; | 117 | break; |
118 | 118 | ||
119 | default: | 119 | default: |
120 | if (priv->revid < ADM8211_REV_CA) | 120 | if (priv->pdev->revision < ADM8211_REV_CA) |
121 | priv->rf_type = ADM8211_TYPE_RFMD; | 121 | priv->rf_type = ADM8211_TYPE_RFMD; |
122 | else | 122 | else |
123 | priv->rf_type = ADM8211_TYPE_AIROHA; | 123 | priv->rf_type = ADM8211_TYPE_AIROHA; |
@@ -135,7 +135,7 @@ static int adm8211_read_eeprom(struct ieee80211_hw *dev) | |||
135 | case ADM8211_TYPE_ADMTEK: | 135 | case ADM8211_TYPE_ADMTEK: |
136 | break; | 136 | break; |
137 | default: | 137 | default: |
138 | if (priv->revid < ADM8211_REV_CA) | 138 | if (priv->pdev->revision < ADM8211_REV_CA) |
139 | priv->bbp_type = ADM8211_TYPE_RFMD; | 139 | priv->bbp_type = ADM8211_TYPE_RFMD; |
140 | else | 140 | else |
141 | priv->bbp_type = ADM8211_TYPE_ADMTEK; | 141 | priv->bbp_type = ADM8211_TYPE_ADMTEK; |
@@ -175,7 +175,7 @@ static int adm8211_read_eeprom(struct ieee80211_hw *dev) | |||
175 | break; | 175 | break; |
176 | 176 | ||
177 | default: | 177 | default: |
178 | if (priv->revid < ADM8211_REV_CA) | 178 | if (priv->pdev->revision < ADM8211_REV_CA) |
179 | priv->specific_bbptype = ADM8211_BBP_RFMD3000; | 179 | priv->specific_bbptype = ADM8211_BBP_RFMD3000; |
180 | else | 180 | else |
181 | priv->specific_bbptype = ADM8211_BBP_ADM8011; | 181 | priv->specific_bbptype = ADM8211_BBP_ADM8011; |
@@ -194,11 +194,11 @@ static int adm8211_read_eeprom(struct ieee80211_hw *dev) | |||
194 | break; | 194 | break; |
195 | 195 | ||
196 | default: | 196 | default: |
197 | if (priv->revid == ADM8211_REV_BA) | 197 | if (priv->pdev->revision == ADM8211_REV_BA) |
198 | priv->transceiver_type = ADM8211_RFMD2958_RF3000_CONTROL_POWER; | 198 | priv->transceiver_type = ADM8211_RFMD2958_RF3000_CONTROL_POWER; |
199 | else if (priv->revid == ADM8211_REV_CA) | 199 | else if (priv->pdev->revision == ADM8211_REV_CA) |
200 | priv->transceiver_type = ADM8211_AL2210L; | 200 | priv->transceiver_type = ADM8211_AL2210L; |
201 | else if (priv->revid == ADM8211_REV_AB) | 201 | else if (priv->pdev->revision == ADM8211_REV_AB) |
202 | priv->transceiver_type = ADM8211_RFMD2948; | 202 | priv->transceiver_type = ADM8211_RFMD2948; |
203 | 203 | ||
204 | printk(KERN_WARNING "%s (adm8211): Unknown transceiver: %d\n", | 204 | printk(KERN_WARNING "%s (adm8211): Unknown transceiver: %d\n", |
@@ -220,7 +220,7 @@ static inline void adm8211_write_sram(struct ieee80211_hw *dev, | |||
220 | struct adm8211_priv *priv = dev->priv; | 220 | struct adm8211_priv *priv = dev->priv; |
221 | 221 | ||
222 | ADM8211_CSR_WRITE(WEPCTL, addr | ADM8211_WEPCTL_TABLE_WR | | 222 | ADM8211_CSR_WRITE(WEPCTL, addr | ADM8211_WEPCTL_TABLE_WR | |
223 | (priv->revid < ADM8211_REV_BA ? | 223 | (priv->pdev->revision < ADM8211_REV_BA ? |
224 | 0 : ADM8211_WEPCTL_SEL_WEPTABLE )); | 224 | 0 : ADM8211_WEPCTL_SEL_WEPTABLE )); |
225 | ADM8211_CSR_READ(WEPCTL); | 225 | ADM8211_CSR_READ(WEPCTL); |
226 | msleep(1); | 226 | msleep(1); |
@@ -238,7 +238,7 @@ static void adm8211_write_sram_bytes(struct ieee80211_hw *dev, | |||
238 | u32 reg = ADM8211_CSR_READ(WEPCTL); | 238 | u32 reg = ADM8211_CSR_READ(WEPCTL); |
239 | unsigned int i; | 239 | unsigned int i; |
240 | 240 | ||
241 | if (priv->revid < ADM8211_REV_BA) { | 241 | if (priv->pdev->revision < ADM8211_REV_BA) { |
242 | for (i = 0; i < len; i += 2) { | 242 | for (i = 0; i < len; i += 2) { |
243 | u16 val = buf[i] | (buf[i + 1] << 8); | 243 | u16 val = buf[i] | (buf[i + 1] << 8); |
244 | adm8211_write_sram(dev, addr + i / 2, val); | 244 | adm8211_write_sram(dev, addr + i / 2, val); |
@@ -421,7 +421,7 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev) | |||
421 | if (skb) { | 421 | if (skb) { |
422 | struct ieee80211_rx_status rx_status = {0}; | 422 | struct ieee80211_rx_status rx_status = {0}; |
423 | 423 | ||
424 | if (priv->revid < ADM8211_REV_CA) | 424 | if (priv->pdev->revision < ADM8211_REV_CA) |
425 | rx_status.ssi = rssi; | 425 | rx_status.ssi = rssi; |
426 | else | 426 | else |
427 | rx_status.ssi = 100 - rssi; | 427 | rx_status.ssi = 100 - rssi; |
@@ -703,7 +703,7 @@ static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan) | |||
703 | adm8211_rf_write_syn_rfmd2958(dev, 0x0A, reg); | 703 | adm8211_rf_write_syn_rfmd2958(dev, 0x0A, reg); |
704 | /* set TXRX TX_GAIN */ | 704 | /* set TXRX TX_GAIN */ |
705 | adm8211_rf_write_syn_rfmd2958(dev, 0x09, 0x00050 | | 705 | adm8211_rf_write_syn_rfmd2958(dev, 0x09, 0x00050 | |
706 | (priv->revid < ADM8211_REV_CA ? tx_power : 0)); | 706 | (priv->pdev->revision < ADM8211_REV_CA ? tx_power : 0)); |
707 | } else { | 707 | } else { |
708 | reg = ADM8211_CSR_READ(PLCPHD); | 708 | reg = ADM8211_CSR_READ(PLCPHD); |
709 | reg &= 0xff00ffff; | 709 | reg &= 0xff00ffff; |
@@ -722,7 +722,7 @@ static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan) | |||
722 | tx_power<<2); | 722 | tx_power<<2); |
723 | adm8211_write_bbp(dev, RF3000_LOW_GAIN_CALIB, lpf_cutoff); | 723 | adm8211_write_bbp(dev, RF3000_LOW_GAIN_CALIB, lpf_cutoff); |
724 | adm8211_write_bbp(dev, RF3000_HIGH_GAIN_CALIB, lnags_thresh); | 724 | adm8211_write_bbp(dev, RF3000_HIGH_GAIN_CALIB, lnags_thresh); |
725 | adm8211_write_bbp(dev, 0x1c, priv->revid == ADM8211_REV_BA ? | 725 | adm8211_write_bbp(dev, 0x1c, priv->pdev->revision == ADM8211_REV_BA ? |
726 | priv->eeprom->cr28 : 0); | 726 | priv->eeprom->cr28 : 0); |
727 | adm8211_write_bbp(dev, 0x1d, priv->eeprom->cr29); | 727 | adm8211_write_bbp(dev, 0x1d, priv->eeprom->cr29); |
728 | 728 | ||
@@ -761,7 +761,7 @@ static void adm8211_update_mode(struct ieee80211_hw *dev) | |||
761 | priv->nar |= ADM8211_NAR_EA | ADM8211_NAR_ST | ADM8211_NAR_SR; | 761 | priv->nar |= ADM8211_NAR_EA | ADM8211_NAR_ST | ADM8211_NAR_SR; |
762 | 762 | ||
763 | /* don't trust the error bits on rev 0x20 and up in adhoc */ | 763 | /* don't trust the error bits on rev 0x20 and up in adhoc */ |
764 | if (priv->revid >= ADM8211_REV_BA) | 764 | if (priv->pdev->revision >= ADM8211_REV_BA) |
765 | priv->soft_rx_crc = 1; | 765 | priv->soft_rx_crc = 1; |
766 | break; | 766 | break; |
767 | case IEEE80211_IF_TYPE_MNTR: | 767 | case IEEE80211_IF_TYPE_MNTR: |
@@ -862,7 +862,7 @@ static int adm8211_hw_init_bbp(struct ieee80211_hw *dev) | |||
862 | break; | 862 | break; |
863 | } | 863 | } |
864 | 864 | ||
865 | switch (priv->revid) { | 865 | switch (priv->pdev->revision) { |
866 | case ADM8211_REV_CA: | 866 | case ADM8211_REV_CA: |
867 | if (priv->transceiver_type == ADM8211_RFMD2958 || | 867 | if (priv->transceiver_type == ADM8211_RFMD2958 || |
868 | priv->transceiver_type == ADM8211_RFMD2958_RF3000_CONTROL_POWER || | 868 | priv->transceiver_type == ADM8211_RFMD2958_RF3000_CONTROL_POWER || |
@@ -920,7 +920,7 @@ static int adm8211_hw_init_bbp(struct ieee80211_hw *dev) | |||
920 | adm8211_write_bbp(dev, 0x1c, 0x00); | 920 | adm8211_write_bbp(dev, 0x1c, 0x00); |
921 | adm8211_write_bbp(dev, 0x1d, 0x80); | 921 | adm8211_write_bbp(dev, 0x1d, 0x80); |
922 | } else { | 922 | } else { |
923 | if (priv->revid == ADM8211_REV_BA) | 923 | if (priv->pdev->revision == ADM8211_REV_BA) |
924 | adm8211_write_bbp(dev, 0x1c, priv->eeprom->cr28); | 924 | adm8211_write_bbp(dev, 0x1c, priv->eeprom->cr28); |
925 | else | 925 | else |
926 | adm8211_write_bbp(dev, 0x1c, 0x00); | 926 | adm8211_write_bbp(dev, 0x1c, 0x00); |
@@ -1052,7 +1052,7 @@ static int adm8211_set_rate(struct ieee80211_hw *dev) | |||
1052 | u8 rate_buf[12] = {0}; | 1052 | u8 rate_buf[12] = {0}; |
1053 | 1053 | ||
1054 | /* write supported rates */ | 1054 | /* write supported rates */ |
1055 | if (priv->revid != ADM8211_REV_BA) { | 1055 | if (priv->pdev->revision != ADM8211_REV_BA) { |
1056 | rate_buf[0] = ARRAY_SIZE(adm8211_rates); | 1056 | rate_buf[0] = ARRAY_SIZE(adm8211_rates); |
1057 | for (i = 0; i < ARRAY_SIZE(adm8211_rates); i++) | 1057 | for (i = 0; i < ARRAY_SIZE(adm8211_rates); i++) |
1058 | rate_buf[i + 1] = (adm8211_rates[i].rate / 5) | 0x80; | 1058 | rate_buf[i + 1] = (adm8211_rates[i].rate / 5) | 0x80; |
@@ -1136,7 +1136,7 @@ static void adm8211_hw_init(struct ieee80211_hw *dev) | |||
1136 | * PWR0PE2 = 13 us | 1136 | * PWR0PE2 = 13 us |
1137 | * PWR1PE2 = 1 us | 1137 | * PWR1PE2 = 1 us |
1138 | * PWR0TXPE = 8 or 6 */ | 1138 | * PWR0TXPE = 8 or 6 */ |
1139 | if (priv->revid < ADM8211_REV_CA) | 1139 | if (priv->pdev->revision < ADM8211_REV_CA) |
1140 | ADM8211_CSR_WRITE(TOFS2, 0x8815cd18); | 1140 | ADM8211_CSR_WRITE(TOFS2, 0x8815cd18); |
1141 | else | 1141 | else |
1142 | ADM8211_CSR_WRITE(TOFS2, 0x8535cd16); | 1142 | ADM8211_CSR_WRITE(TOFS2, 0x8535cd16); |
@@ -1165,7 +1165,7 @@ static void adm8211_hw_init(struct ieee80211_hw *dev) | |||
1165 | 1165 | ||
1166 | /* SLOT=20 us, SIFS=110 cycles of 22 MHz (5 us), | 1166 | /* SLOT=20 us, SIFS=110 cycles of 22 MHz (5 us), |
1167 | * DIFS=50 us, EIFS=100 us */ | 1167 | * DIFS=50 us, EIFS=100 us */ |
1168 | if (priv->revid < ADM8211_REV_CA) | 1168 | if (priv->pdev->revision < ADM8211_REV_CA) |
1169 | ADM8211_CSR_WRITE(IFST, (20 << 23) | (110 << 15) | | 1169 | ADM8211_CSR_WRITE(IFST, (20 << 23) | (110 << 15) | |
1170 | (50 << 9) | 100); | 1170 | (50 << 9) | 100); |
1171 | else | 1171 | else |
@@ -1224,13 +1224,13 @@ static int adm8211_hw_reset(struct ieee80211_hw *dev) | |||
1224 | 1224 | ||
1225 | ADM8211_CSR_WRITE(PAR, tmp); | 1225 | ADM8211_CSR_WRITE(PAR, tmp); |
1226 | 1226 | ||
1227 | if (priv->revid == ADM8211_REV_BA && | 1227 | if (priv->pdev->revision == ADM8211_REV_BA && |
1228 | (priv->transceiver_type == ADM8211_RFMD2958_RF3000_CONTROL_POWER || | 1228 | (priv->transceiver_type == ADM8211_RFMD2958_RF3000_CONTROL_POWER || |
1229 | priv->transceiver_type == ADM8211_RFMD2958)) { | 1229 | priv->transceiver_type == ADM8211_RFMD2958)) { |
1230 | reg = ADM8211_CSR_READ(CSR_TEST1); | 1230 | reg = ADM8211_CSR_READ(CSR_TEST1); |
1231 | reg |= (1 << 4) | (1 << 5); | 1231 | reg |= (1 << 4) | (1 << 5); |
1232 | ADM8211_CSR_WRITE(CSR_TEST1, reg); | 1232 | ADM8211_CSR_WRITE(CSR_TEST1, reg); |
1233 | } else if (priv->revid == ADM8211_REV_CA) { | 1233 | } else if (priv->pdev->revision == ADM8211_REV_CA) { |
1234 | reg = ADM8211_CSR_READ(CSR_TEST1); | 1234 | reg = ADM8211_CSR_READ(CSR_TEST1); |
1235 | reg &= ~((1 << 4) | (1 << 5)); | 1235 | reg &= ~((1 << 4) | (1 << 5)); |
1236 | ADM8211_CSR_WRITE(CSR_TEST1, reg); | 1236 | ADM8211_CSR_WRITE(CSR_TEST1, reg); |
@@ -1866,8 +1866,6 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, | |||
1866 | goto err_iounmap; | 1866 | goto err_iounmap; |
1867 | } | 1867 | } |
1868 | 1868 | ||
1869 | pci_read_config_byte(pdev, PCI_CLASS_REVISION, &priv->revid); | ||
1870 | |||
1871 | *(u32 *)perm_addr = le32_to_cpu((__force __le32)ADM8211_CSR_READ(PAR0)); | 1869 | *(u32 *)perm_addr = le32_to_cpu((__force __le32)ADM8211_CSR_READ(PAR0)); |
1872 | *(u16 *)&perm_addr[4] = | 1870 | *(u16 *)&perm_addr[4] = |
1873 | le16_to_cpu((__force __le16)ADM8211_CSR_READ(PAR1) & 0xFFFF); | 1871 | le16_to_cpu((__force __le16)ADM8211_CSR_READ(PAR1) & 0xFFFF); |
@@ -1902,7 +1900,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, | |||
1902 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 1900 | priv->mode = IEEE80211_IF_TYPE_MNTR; |
1903 | 1901 | ||
1904 | /* Power-on issue. EEPROM won't read correctly without */ | 1902 | /* Power-on issue. EEPROM won't read correctly without */ |
1905 | if (priv->revid >= ADM8211_REV_BA) { | 1903 | if (pdev->revision >= ADM8211_REV_BA) { |
1906 | ADM8211_CSR_WRITE(FRCTL, 0); | 1904 | ADM8211_CSR_WRITE(FRCTL, 0); |
1907 | ADM8211_CSR_READ(FRCTL); | 1905 | ADM8211_CSR_READ(FRCTL); |
1908 | ADM8211_CSR_WRITE(FRCTL, 1); | 1906 | ADM8211_CSR_WRITE(FRCTL, 1); |
@@ -1935,7 +1933,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, | |||
1935 | 1933 | ||
1936 | printk(KERN_INFO "%s: hwaddr %s, Rev 0x%02x\n", | 1934 | printk(KERN_INFO "%s: hwaddr %s, Rev 0x%02x\n", |
1937 | wiphy_name(dev->wiphy), print_mac(mac, dev->wiphy->perm_addr), | 1935 | wiphy_name(dev->wiphy), print_mac(mac, dev->wiphy->perm_addr), |
1938 | priv->revid); | 1936 | pdev->revision); |
1939 | 1937 | ||
1940 | return 0; | 1938 | return 0; |
1941 | 1939 | ||
diff --git a/drivers/net/wireless/adm8211.h b/drivers/net/wireless/adm8211.h index 5991b17c4a7b..ef326fed42e4 100644 --- a/drivers/net/wireless/adm8211.h +++ b/drivers/net/wireless/adm8211.h | |||
@@ -416,7 +416,7 @@ struct adm8211_desc { | |||
416 | #define TDES1_CONTROL_RBS1 (0x00000fff) | 416 | #define TDES1_CONTROL_RBS1 (0x00000fff) |
417 | 417 | ||
418 | /* SRAM offsets */ | 418 | /* SRAM offsets */ |
419 | #define ADM8211_SRAM(x) (priv->revid < ADM8211_REV_BA ? \ | 419 | #define ADM8211_SRAM(x) (priv->pdev->revision < ADM8211_REV_BA ? \ |
420 | ADM8211_SRAM_A_ ## x : ADM8211_SRAM_B_ ## x) | 420 | ADM8211_SRAM_A_ ## x : ADM8211_SRAM_B_ ## x) |
421 | 421 | ||
422 | #define ADM8211_SRAM_INDIV_KEY 0x0000 | 422 | #define ADM8211_SRAM_INDIV_KEY 0x0000 |
@@ -623,8 +623,6 @@ struct adm8211_priv { | |||
623 | struct adm8211_eeprom *eeprom; | 623 | struct adm8211_eeprom *eeprom; |
624 | size_t eeprom_len; | 624 | size_t eeprom_len; |
625 | 625 | ||
626 | u8 revid; | ||
627 | |||
628 | u32 nar; | 626 | u32 nar; |
629 | 627 | ||
630 | #define ADM8211_TYPE_INTERSIL 0x00 | 628 | #define ADM8211_TYPE_INTERSIL 0x00 |