aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-10-17 03:42:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-10-18 14:07:00 -0400
commit1e7d30355d91c70e2557daf3dac633255202d2df (patch)
tree0b8003d6247451f67d71cbe7de65c0d13bf64f4e
parent28d4d98d7ad11b540f0041be9e7d4dae15ca22fa (diff)
rt2x00: rt2800pci: split rt2800pci_enable_radio function
The function is called for PCI and SoC devices however the MCU related part of the function has no effect on SoC devices. Move the common part of the function into a separate helper and use that for the SoC devices. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index 4cfd8f77fa71..88dd242ac1e3 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -61,6 +61,7 @@ static bool rt2800pci_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev)
61 return modparam_nohwcrypt; 61 return modparam_nohwcrypt;
62} 62}
63 63
64#ifdef CONFIG_PCI
64static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token) 65static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
65{ 66{
66 unsigned int i; 67 unsigned int i;
@@ -91,7 +92,6 @@ static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
91 rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); 92 rt2x00mmio_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0);
92} 93}
93 94
94#ifdef CONFIG_PCI
95static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom) 95static void rt2800pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
96{ 96{
97 struct rt2x00_dev *rt2x00dev = eeprom->data; 97 struct rt2x00_dev *rt2x00dev = eeprom->data;
@@ -210,17 +210,23 @@ static int rt2800pci_write_firmware(struct rt2x00_dev *rt2x00dev,
210/* 210/*
211 * Device state switch handlers. 211 * Device state switch handlers.
212 */ 212 */
213static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev) 213static int rt2800mmio_enable_radio(struct rt2x00_dev *rt2x00dev)
214{ 214{
215 int retval;
216
217 /* Wait for DMA, ignore error until we initialize queues. */ 215 /* Wait for DMA, ignore error until we initialize queues. */
218 rt2800_wait_wpdma_ready(rt2x00dev); 216 rt2800_wait_wpdma_ready(rt2x00dev);
219 217
220 if (unlikely(rt2800mmio_init_queues(rt2x00dev))) 218 if (unlikely(rt2800mmio_init_queues(rt2x00dev)))
221 return -EIO; 219 return -EIO;
222 220
223 retval = rt2800_enable_radio(rt2x00dev); 221 return rt2800_enable_radio(rt2x00dev);
222}
223
224#ifdef CONFIG_PCI
225static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
226{
227 int retval;
228
229 retval = rt2800mmio_enable_radio(rt2x00dev);
224 if (retval) 230 if (retval)
225 return retval; 231 return retval;
226 232
@@ -237,7 +243,6 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
237 return retval; 243 return retval;
238} 244}
239 245
240#ifdef CONFIG_PCI
241static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, 246static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
242 enum dev_state state) 247 enum dev_state state)
243{ 248{
@@ -484,7 +489,7 @@ static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev,
484 489
485 switch (state) { 490 switch (state) {
486 case STATE_RADIO_ON: 491 case STATE_RADIO_ON:
487 retval = rt2800pci_enable_radio(rt2x00dev); 492 retval = rt2800mmio_enable_radio(rt2x00dev);
488 break; 493 break;
489 494
490 case STATE_RADIO_OFF: 495 case STATE_RADIO_OFF: