diff options
| author | Gabor Juhos <juhosg@openwrt.org> | 2013-10-17 03:42:34 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2013-10-18 14:07:00 -0400 |
| commit | fe7ef7c60c33fd339f40320fae76bc56d368dae5 (patch) | |
| tree | ec3d4ccfce6ac49150d3e0560776093fae062791 | |
| parent | 0b0ee990f402b357422cc7c5cc12915490610e3e (diff) | |
rt2x00: rt2800pci: move SoC specific code into a separate module
The PCI and SoC specific drivers are using separate
code now so it is not reasonable to use the same
module for both drivers anymore.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
| -rw-r--r-- | drivers/net/wireless/rt2x00/Kconfig | 21 | ||||
| -rw-r--r-- | drivers/net/wireless/rt2x00/Makefile | 1 | ||||
| -rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 244 | ||||
| -rw-r--r-- | drivers/net/wireless/rt2x00/rt2800soc.c | 263 |
4 files changed, 284 insertions, 245 deletions
diff --git a/drivers/net/wireless/rt2x00/Kconfig b/drivers/net/wireless/rt2x00/Kconfig index e86324931b63..006b8bcb2e31 100644 --- a/drivers/net/wireless/rt2x00/Kconfig +++ b/drivers/net/wireless/rt2x00/Kconfig | |||
| @@ -58,12 +58,11 @@ config RT61PCI | |||
| 58 | 58 | ||
| 59 | config RT2800PCI | 59 | config RT2800PCI |
| 60 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" | 60 | tristate "Ralink rt27xx/rt28xx/rt30xx (PCI/PCIe/PCMCIA) support" |
| 61 | depends on PCI || SOC_RT288X || SOC_RT305X | 61 | depends on PCI |
| 62 | select RT2800_LIB | 62 | select RT2800_LIB |
| 63 | select RT2800_LIB_MMIO | 63 | select RT2800_LIB_MMIO |
| 64 | select RT2X00_LIB_MMIO | 64 | select RT2X00_LIB_MMIO |
| 65 | select RT2X00_LIB_PCI if PCI | 65 | select RT2X00_LIB_PCI |
| 66 | select RT2X00_LIB_SOC if SOC_RT288X || SOC_RT305X | ||
| 67 | select RT2X00_LIB_FIRMWARE | 66 | select RT2X00_LIB_FIRMWARE |
| 68 | select RT2X00_LIB_CRYPTO | 67 | select RT2X00_LIB_CRYPTO |
| 69 | select CRC_CCITT | 68 | select CRC_CCITT |
| @@ -200,6 +199,22 @@ config RT2800USB_UNKNOWN | |||
| 200 | 199 | ||
| 201 | endif | 200 | endif |
| 202 | 201 | ||
| 202 | config RT2800SOC | ||
| 203 | tristate "Ralink WiSoC support" | ||
| 204 | depends on SOC_RT288X || SOC_RT305X | ||
| 205 | select RT2X00_LIB_SOC | ||
| 206 | select RT2X00_LIB_MMIO | ||
| 207 | select RT2X00_LIB_CRYPTO | ||
| 208 | select RT2X00_LIB_FIRMWARE | ||
| 209 | select RT2800_LIB | ||
| 210 | select RT2800_LIB_MMIO | ||
| 211 | ---help--- | ||
| 212 | This adds support for Ralink WiSoC devices. | ||
| 213 | Supported chips: RT2880, RT3050, RT3052, RT3350, RT3352. | ||
| 214 | |||
| 215 | When compiled as a module, this driver will be called rt2800soc. | ||
| 216 | |||
| 217 | |||
| 203 | config RT2800_LIB | 218 | config RT2800_LIB |
| 204 | tristate | 219 | tristate |
| 205 | 220 | ||
diff --git a/drivers/net/wireless/rt2x00/Makefile b/drivers/net/wireless/rt2x00/Makefile index d11e3562ab46..24a66015a495 100644 --- a/drivers/net/wireless/rt2x00/Makefile +++ b/drivers/net/wireless/rt2x00/Makefile | |||
| @@ -22,3 +22,4 @@ obj-$(CONFIG_RT2800PCI) += rt2800pci.o | |||
| 22 | obj-$(CONFIG_RT2500USB) += rt2500usb.o | 22 | obj-$(CONFIG_RT2500USB) += rt2500usb.o |
| 23 | obj-$(CONFIG_RT73USB) += rt73usb.o | 23 | obj-$(CONFIG_RT73USB) += rt73usb.o |
| 24 | obj-$(CONFIG_RT2800USB) += rt2800usb.o | 24 | obj-$(CONFIG_RT2800USB) += rt2800usb.o |
| 25 | obj-$(CONFIG_RT2800SOC) += rt2800soc.o | ||
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 488d1c449349..260d2fdadc76 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
| @@ -37,13 +37,11 @@ | |||
| 37 | #include <linux/kernel.h> | 37 | #include <linux/kernel.h> |
| 38 | #include <linux/module.h> | 38 | #include <linux/module.h> |
| 39 | #include <linux/pci.h> | 39 | #include <linux/pci.h> |
| 40 | #include <linux/platform_device.h> | ||
| 41 | #include <linux/eeprom_93cx6.h> | 40 | #include <linux/eeprom_93cx6.h> |
| 42 | 41 | ||
| 43 | #include "rt2x00.h" | 42 | #include "rt2x00.h" |
| 44 | #include "rt2x00mmio.h" | 43 | #include "rt2x00mmio.h" |
| 45 | #include "rt2x00pci.h" | 44 | #include "rt2x00pci.h" |
| 46 | #include "rt2x00soc.h" | ||
| 47 | #include "rt2800lib.h" | 45 | #include "rt2800lib.h" |
| 48 | #include "rt2800mmio.h" | 46 | #include "rt2800mmio.h" |
| 49 | #include "rt2800.h" | 47 | #include "rt2800.h" |
| @@ -56,7 +54,6 @@ static bool modparam_nohwcrypt = false; | |||
| 56 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); | 54 | module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO); |
| 57 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); | 55 | MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); |
| 58 | 56 | ||
| 59 | #ifdef CONFIG_PCI | ||
| 60 | static bool rt2800pci_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) | 57 | static bool rt2800pci_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) |
| 61 | { | 58 | { |
| 62 | return modparam_nohwcrypt; | 59 | return modparam_nohwcrypt; |
| @@ -449,230 +446,15 @@ static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { | |||
| 449 | #endif | 446 | #endif |
| 450 | { 0, } | 447 | { 0, } |
| 451 | }; | 448 | }; |
| 452 | #endif /* CONFIG_PCI */ | ||
| 453 | 449 | ||
| 454 | MODULE_AUTHOR(DRV_PROJECT); | 450 | MODULE_AUTHOR(DRV_PROJECT); |
| 455 | MODULE_VERSION(DRV_VERSION); | 451 | MODULE_VERSION(DRV_VERSION); |
| 456 | MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver."); | 452 | MODULE_DESCRIPTION("Ralink RT2800 PCI & PCMCIA Wireless LAN driver."); |
| 457 | MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards"); | 453 | MODULE_SUPPORTED_DEVICE("Ralink RT2860 PCI & PCMCIA chipset based cards"); |
| 458 | #ifdef CONFIG_PCI | ||
| 459 | MODULE_FIRMWARE(FIRMWARE_RT2860); | 454 | MODULE_FIRMWARE(FIRMWARE_RT2860); |
| 460 | MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); | 455 | MODULE_DEVICE_TABLE(pci, rt2800pci_device_table); |
| 461 | #endif /* CONFIG_PCI */ | ||
| 462 | MODULE_LICENSE("GPL"); | 456 | MODULE_LICENSE("GPL"); |
| 463 | 457 | ||
| 464 | #if defined(CONFIG_SOC_RT288X) || defined(CONFIG_SOC_RT305X) | ||
| 465 | static bool rt2800soc_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) | ||
| 466 | { | ||
| 467 | return modparam_nohwcrypt; | ||
| 468 | } | ||
| 469 | |||
| 470 | static void rt2800soc_disable_radio(struct rt2x00_dev *rt2x00dev) | ||
| 471 | { | ||
| 472 | rt2800_disable_radio(rt2x00dev); | ||
| 473 | rt2x00mmio_register_write(rt2x00dev, PWR_PIN_CFG, 0); | ||
| 474 | rt2x00mmio_register_write(rt2x00dev, TX_PIN_CFG, 0); | ||
| 475 | } | ||
| 476 | |||
| 477 | static int rt2800soc_set_device_state(struct rt2x00_dev *rt2x00dev, | ||
| 478 | enum dev_state state) | ||
| 479 | { | ||
| 480 | int retval = 0; | ||
| 481 | |||
| 482 | switch (state) { | ||
| 483 | case STATE_RADIO_ON: | ||
| 484 | retval = rt2800mmio_enable_radio(rt2x00dev); | ||
| 485 | break; | ||
| 486 | |||
| 487 | case STATE_RADIO_OFF: | ||
| 488 | rt2800soc_disable_radio(rt2x00dev); | ||
| 489 | break; | ||
| 490 | |||
| 491 | case STATE_RADIO_IRQ_ON: | ||
| 492 | case STATE_RADIO_IRQ_OFF: | ||
| 493 | rt2800mmio_toggle_irq(rt2x00dev, state); | ||
| 494 | break; | ||
| 495 | |||
| 496 | case STATE_DEEP_SLEEP: | ||
| 497 | case STATE_SLEEP: | ||
| 498 | case STATE_STANDBY: | ||
| 499 | case STATE_AWAKE: | ||
| 500 | /* These states are not supported, but don't report an error */ | ||
| 501 | retval = 0; | ||
| 502 | break; | ||
| 503 | |||
| 504 | default: | ||
| 505 | retval = -ENOTSUPP; | ||
| 506 | break; | ||
| 507 | } | ||
| 508 | |||
| 509 | if (unlikely(retval)) | ||
| 510 | rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", | ||
| 511 | state, retval); | ||
| 512 | |||
| 513 | return retval; | ||
| 514 | } | ||
| 515 | |||
| 516 | static int rt2800soc_read_eeprom(struct rt2x00_dev *rt2x00dev) | ||
| 517 | { | ||
| 518 | void __iomem *base_addr = ioremap(0x1F040000, EEPROM_SIZE); | ||
| 519 | |||
| 520 | if (!base_addr) | ||
| 521 | return -ENOMEM; | ||
| 522 | |||
| 523 | memcpy_fromio(rt2x00dev->eeprom, base_addr, EEPROM_SIZE); | ||
| 524 | |||
| 525 | iounmap(base_addr); | ||
| 526 | return 0; | ||
| 527 | } | ||
| 528 | |||
| 529 | /* Firmware functions */ | ||
| 530 | static char *rt2800soc_get_firmware_name(struct rt2x00_dev *rt2x00dev) | ||
| 531 | { | ||
| 532 | WARN_ON_ONCE(1); | ||
| 533 | return NULL; | ||
| 534 | } | ||
| 535 | |||
| 536 | static int rt2800soc_load_firmware(struct rt2x00_dev *rt2x00dev, | ||
| 537 | const u8 *data, const size_t len) | ||
| 538 | { | ||
| 539 | WARN_ON_ONCE(1); | ||
| 540 | return 0; | ||
| 541 | } | ||
