aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-10-17 03:42:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-10-18 14:07:00 -0400
commit6716b3d83221e7aa2623d9a60fdbf7faa836756b (patch)
tree7b21e4eaee8e62b7f75451057c638b07fae3cf31
parent899a5f493a0135c5a676f75a53e70255df25a3e4 (diff)
rt2x00: rt2800pci: use separate set_state callback for SoC devices
The 'rt2800pci_set_state' function uses MCU commands to set the device state, however these have no effect on SoC devices. Use a different set_state callback which does not use the MCU fcuntions. 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.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index efc35b4dd078..e424b7ad5173 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -246,6 +246,7 @@ static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev)
246 } 246 }
247} 247}
248 248
249#ifdef CONFIG_PCI
249static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev, 250static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
250 enum dev_state state) 251 enum dev_state state)
251{ 252{
@@ -304,7 +305,6 @@ static int rt2800pci_set_device_state(struct rt2x00_dev *rt2x00dev,
304 return retval; 305 return retval;
305} 306}
306 307
307#ifdef CONFIG_PCI
308/* 308/*
309 * Device probe functions. 309 * Device probe functions.
310 */ 310 */
@@ -480,6 +480,45 @@ MODULE_DEVICE_TABLE(pci, rt2800pci_device_table);
480MODULE_LICENSE("GPL"); 480MODULE_LICENSE("GPL");
481 481
482#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) 482#if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X)
483static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev,
484 enum dev_state state)
485{
486 int retval = 0;
487
488 switch (state) {
489 case STATE_RADIO_ON:
490 retval = rt2800pci_enable_radio(rt2x00dev);
491 break;
492
493 case STATE_RADIO_OFF:
494 rt2800pci_disable_radio(rt2x00dev);
495 break;
496
497 case STATE_RADIO_IRQ_ON:
498 case STATE_RADIO_IRQ_OFF:
499 rt2800mmio_toggle_irq(rt2x00dev, state);
500 break;
501
502 case STATE_DEEP_SLEEP:
503 case STATE_SLEEP:
504 case STATE_STANDBY:
505 case STATE_AWAKE:
506 /* These states are not supported, but don't report an error */
507 retval = 0;
508 break;
509
510 default:
511 retval = -ENOTSUPP;
512 break;
513 }
514
515 if (unlikely(retval))
516 rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n",
517 state, retval);
518
519 return retval;
520}
521
483static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev) 522static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev)
484{ 523{
485 void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); 524 void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE);
@@ -578,7 +617,7 @@ static const struct rt2x00lib_ops rt2800soc_rt2x00_ops = {
578 .uninitialize = rt2x00mmio_uninitialize, 617 .uninitialize = rt2x00mmio_uninitialize,
579 .get_entry_state = rt2800mmio_get_entry_state, 618 .get_entry_state = rt2800mmio_get_entry_state,
580 .clear_entry = rt2800mmio_clear_entry, 619 .clear_entry = rt2800mmio_clear_entry,
581 .set_device_state = rt2800pci_set_device_state, 620 .set_device_state = rt2800soc_set_device_state,
582 .rfkill_poll = rt2800_rfkill_poll, 621 .rfkill_poll = rt2800_rfkill_poll,
583 .link_stats = rt2800_link_stats, 622 .link_stats = rt2800_link_stats,
584 .reset_tuner = rt2800_reset_tuner, 623 .reset_tuner = rt2800_reset_tuner,