diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-10-17 03:42:27 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-10-18 14:06:59 -0400 |
commit | 68597ea8674bd6c8983abc2a73e1e707af85f38e (patch) | |
tree | 04ba8fe06cba060b56d7aef28988c3b4c065a802 /drivers | |
parent | eeea863eba67adaa1a5b2ff34398207ef5506416 (diff) |
rt2x00: rt2800pci: use separate read_eeprom callback for SoC devices
Rename the 'rt2800pci_read_eeprom_soc function' to
'rt2800soc_read_eeprom' and use that directly in the
SoC specific 'rt2800_ops' structure. Also move the
'rt2800pci_eeprom_read' function into an 'ifdef PCI'
section and remove the 'rt2800pci_read_eeprom_soc'
call from that.
Additionally, remove the dummy inline eeprom functions.
Those are not used anymore.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 56 |
1 files changed, 16 insertions, 40 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 344a73ddd3e5..afd422faaf14 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -91,26 +91,6 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) | |||
91 | rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); | 91 | rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); |
92 | } | 92 | } |
93 | 93 | ||
94 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) | ||
95 | static int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | ||
96 | { | ||
97 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | ||
98 | |||
99 | if (!base_addr) | ||
100 | return -ENOMEM; | ||
101 | |||
102 | memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); | ||
103 | |||
104 | iounmap(base_addr); | ||
105 | return 0; | ||
106 | } | ||
107 | #else | ||
108 | static inline int rt2800pci_read_eeprom_soc(struct rt2x00_dev *rt2x00dev) | ||
109 | { | ||
110 | return -ENOMEM; | ||
111 | } | ||
112 | #endif /* CONFIG_SOC_RT288X || CONFIG_SOC_RT305X */ | ||
113 | |||
114 | #ifdef CONFIG_PCI | 94 | #ifdef CONFIG_PCI |
115 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) | 95 | static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) |
116 | { | 96 | { |
@@ -184,21 +164,6 @@ static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | |||
184 | { | 164 | { |
185 | return rt2800_read_eeprom_efuse(rt2x00dev); | 165 | return rt2800_read_eeprom_efuse(rt2x00dev); |
186 | } | 166 | } |
187 | #else | ||
188 | static inline int rt2800pci_read_eeprom_pci(struct rt2x00_dev *rt2x00dev) | ||
189 | { | ||
190 | return -EOPNOTSUPP; | ||
191 | } | ||
192 | |||
193 | static inline int rt2800pci_efuse_detect(struct rt2x00_dev *rt2x00dev) | ||
194 | { | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | static inline int rt2800pci_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev) | ||
199 | { | ||
200 | return -EOPNOTSUPP; | ||
201 | } | ||
202 | #endif /* CONFIG_PCI */ | 167 | #endif /* CONFIG_PCI */ |
203 | 168 | ||
204 | /* | 169 | /* |
@@ -339,6 +304,7 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev, | |||
339 | return retval; | 304 | return retval; |
340 | } | 305 | } |
341 | 306 | ||
307 | #ifdef CONFIG_PCI | ||
342 | /* | 308 | /* |
343 | * Device probe functions. | 309 | * Device probe functions. |
344 | */ | 310 | */ |
@@ -346,9 +312,7 @@ static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev) | |||
346 | { | 312 | { |
347 | int retval; | 313 | int retval; |
348 | 314 | ||
349 | if (rt2x00_is_soc(rt2x00dev)) | 315 | if (rt2800pci_efuse_detect(rt2x00dev)) |
350 | retval = rt2800pci_read_eeprom_soc(rt2x00dev); | ||
351 | else if (rt2800pci_efuse_detect(rt2x00dev)) | ||
352 | retval = rt2800pci_read_eeprom_efuse(rt2x00dev); | 316 | retval = rt2800pci_read_eeprom_efuse(rt2x00dev); |
353 | else | 317 | else |
354 | retval = rt2800pci_read_eeprom_pci(rt2x00dev); | 318 | retval = rt2800pci_read_eeprom_pci(rt2x00dev); |
@@ -356,7 +320,6 @@ static int rt2800pci_read_eeprom(struct rt2x00_dev *rt2x00dev) | |||
356 | return retval; | 320 | return retval; |
357 | } | 321 | } |
358 | 322 | ||
359 | #ifdef CONFIG_PCI | ||
360 | static const struct ieee80211_ops rt2800pci_mac80211_ops = { | 323 | static const struct ieee80211_ops rt2800pci_mac80211_ops = { |
361 | .tx = rt2x00mac_tx, | 324 | .tx = rt2x00mac_tx, |
362 | .start = rt2x00mac_start, | 325 | .start = rt2x00mac_start, |
@@ -517,6 +480,19 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | |||
517 | MODULE_LICENSE("GPL"); | 480 | MODULE_LICENSE("GPL"); |
518 | 481 | ||
519 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) | 482 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) |
483 | static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev) | ||
484 | { | ||
485 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | ||
486 | |||
487 | if (!base_addr) | ||
488 | return -ENOMEM; | ||
489 | |||
490 | memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); | ||
491 | |||
492 | iounmap(base_addr); | ||
493 | return 0; | ||
494 | } | ||
495 | |||
520 | static const struct ieee80211_ops rt2800soc_mac80211_ops = { | 496 | static const struct ieee80211_ops rt2800soc_mac80211_ops = { |
521 | .tx = rt2x00mac_tx, | 497 | .tx = rt2x00mac_tx, |
522 | .start = rt2x00mac_start, | 498 | .start = rt2x00mac_start, |
@@ -552,7 +528,7 @@ static const struct rt2800_ops rt2800soc_rt2800_ops = { | |||
552 | .register_multiread = rt2x00mmio_register_multiread, | 528 | .register_multiread = rt2x00mmio_register_multiread, |
553 | .register_multiwrite = rt2x00mmio_register_multiwrite, | 529 | .register_multiwrite = rt2x00mmio_register_multiwrite, |
554 | .regbusy_read = rt2x00mmio_regbusy_read, | 530 | .regbusy_read = rt2x00mmio_regbusy_read, |
555 | .read_eeprom = rt2800pci_read_eeprom, | 531 | .read_eeprom = rt2800soc_read_eeprom, |
556 | .hwcrypt_disabled = rt2800pci_hwcrypt_disabled, | 532 | .hwcrypt_disabled = rt2800pci_hwcrypt_disabled, |
557 | .drv_write_firmware = rt2800pci_write_firmware, | 533 | .drv_write_firmware = rt2800pci_write_firmware, |
558 | .drv_init_registers = rt2800mmio_init_registers, | 534 | .drv_init_registers = rt2800mmio_init_registers, |