diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2009-12-18 12:57:09 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2009-12-18 12:57:09 +0000 |
commit | a733e30bf6963cccc0b058432044e42ee31af27a (patch) | |
tree | 7e440dbd3092ea8b310ccff4be69e99b324fb6e2 /target/linux/ar71xx/files | |
parent | 70d31d46a85e7dee4274542e3bad29dcaa29b50e (diff) | |
download | mtk-20170518-a733e30bf6963cccc0b058432044e42ee31af27a.zip mtk-20170518-a733e30bf6963cccc0b058432044e42ee31af27a.tar.gz mtk-20170518-a733e30bf6963cccc0b058432044e42ee31af27a.tar.bz2 |
ar71xx: ar913x_wmac device support into a separate file
SVN-Revision: 18820
Diffstat (limited to 'target/linux/ar71xx/files')
16 files changed, 116 insertions, 53 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig index 3999b97..ebc6649 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig @@ -5,15 +5,18 @@ menu "Atheros AR71xx machine selection" config AR71XX_MACH_AP81 bool "Atheros AP81 board support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_AP83 bool "Atheros AP83 board support" + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_DIR_615_C1 bool "D-Link DIR-615 rev. C1 support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_DIR_825_B1 @@ -49,6 +52,7 @@ config AR71XX_MACH_WP543 config AR71XX_MACH_WRT160NL bool "Linksys WRT160NL board support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_WRT400N @@ -69,16 +73,19 @@ config AR71XX_MACH_WNDR3700 config AR71XX_MACH_WNR2000 bool "NETGEAR WNR2000 board support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_MZK_W04NU bool "Planex MZK-W04NU board support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_MZK_W300NH bool "Planex MZK-W300NH board support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_TL_WR741ND @@ -89,16 +96,19 @@ config AR71XX_MACH_TL_WR741ND config AR71XX_MACH_TL_WR941ND bool "TP-LINK TL-WR941ND support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_TL_WR1043ND bool "TP-LINK TL-WR1043ND support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_TEW_632BRP bool "TRENDnet TEW-632BRP support" select AR71XX_DEV_M25P80 + select AR71XX_DEV_AR913X_WMAC default y config AR71XX_MACH_UBNT @@ -114,4 +124,7 @@ config AR71XX_DEV_M25P80 config AR71XX_DEV_AP94_PCI def_bool n +config AR71XX_DEV_AR913X_WMAC + def_bool n + endif diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile index 3e2c8da..54d4513 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_AR71XX_DEV_AP94_PCI) += dev-ap94-pci.o +obj-$(CONFIG_AR71XX_DEV_AR913X_WMAC) += dev-ar913x-wmac.o obj-$(CONFIG_AR71XX_DEV_M25P80) += dev-m25p80.o obj-$(CONFIG_AR71XX_MACH_AP81) += mach-ap81.o diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c new file mode 100644 index 0000000..342f8de --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c @@ -0,0 +1,63 @@ +/* + * Atheros AR913x SoC built-in WMAC device support + * + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> + * + * Parts of this file are based on Atheros' 2.6.15 BSP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/etherdevice.h> +#include <linux/platform_device.h> +#include <linux/ath9k_platform.h> + +#include <asm/mach-ar71xx/ar71xx.h> + +#include "dev-ar913x-wmac.h" + +static struct resource ar913x_wmac_resources[] = { + { + .start = AR91XX_WMAC_BASE, + .end = AR91XX_WMAC_BASE + AR91XX_WMAC_SIZE - 1, + .flags = IORESOURCE_MEM, + }, { + .start = AR71XX_CPU_IRQ_WMAC, + .end = AR71XX_CPU_IRQ_WMAC, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct ath9k_platform_data ar913x_wmac_data; + +static struct platform_device ar913x_wmac_device = { + .name = "ath9k", + .id = -1, + .resource = ar913x_wmac_resources, + .num_resources = ARRAY_SIZE(ar913x_wmac_resources), + .dev = { + .platform_data = &ar913x_wmac_data, + }, +}; + +void __init ar913x_add_device_wmac(void) +{ + u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); + + memcpy(ar913x_wmac_data.eeprom_data, ee, + sizeof(ar913x_wmac_data.eeprom_data)); + + ar71xx_device_stop(RESET_MODULE_AMBA2WMAC); + mdelay(10); + + ar71xx_device_start(RESET_MODULE_AMBA2WMAC); + mdelay(10); + + platform_device_register(&ar913x_wmac_device); +} diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h new file mode 100644 index 0000000..1fa0093 --- /dev/null +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h @@ -0,0 +1,19 @@ +/* + * Atheros AR913x SoC built-in WMAC device support + * + * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org> + * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> + * + * Parts of this file are based on Atheros' 2.6.15 BSP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#ifndef _AR71XX_DEV_AR913X_WMAC_H +#define _AR71XX_DEV_AR913X_WMAC_H + +void ar913x_add_device_wmac(void) __init; + +#endif /* _AR71XX_DEV_AR913X_WMAC_H */ diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c index e9a80ee..6f6ec42 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.c @@ -18,7 +18,6 @@ #include <linux/etherdevice.h> #include <linux/platform_device.h> #include <linux/serial_8250.h> -#include <linux/ath9k_platform.h> #include <asm/mach-ar71xx/ar71xx.h> @@ -777,46 +776,6 @@ void __init ar71xx_parse_mac_addr(char *mac_str) "\"%s\"\n", mac_str); } -static struct resource ar91xx_wmac_resources[] = { - { - .start = AR91XX_WMAC_BASE, - .end = AR91XX_WMAC_BASE + AR91XX_WMAC_SIZE - 1, - .flags = IORESOURCE_MEM, - }, { - .start = AR71XX_CPU_IRQ_WMAC, - .end = AR71XX_CPU_IRQ_WMAC, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct ath9k_platform_data ar91xx_wmac_data; - -static struct platform_device ar91xx_wmac_device = { - .name = "ath9k", - .id = -1, - .resource = ar91xx_wmac_resources, - .num_resources = ARRAY_SIZE(ar91xx_wmac_resources), - .dev = { - .platform_data = &ar91xx_wmac_data, - }, -}; - -void __init ar91xx_add_device_wmac(void) -{ - u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); - - memcpy(ar91xx_wmac_data.eeprom_data, ee, - sizeof(ar91xx_wmac_data.eeprom_data)); - - ar71xx_device_stop(RESET_MODULE_AMBA2WMAC); - mdelay(10); - - ar71xx_device_start(RESET_MODULE_AMBA2WMAC); - mdelay(10); - - platform_device_register(&ar91xx_wmac_device); -} - static struct platform_device ar71xx_dsa_switch_device = { .name = "dsa", .id = 0, diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h index 6c72126..1408629 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/devices.h @@ -54,8 +54,6 @@ void ar71xx_add_device_uart(void) __init; void ar71xx_add_device_wdt(void) __init; -void ar91xx_add_device_wmac(void) __init; - void ar71xx_add_device_dsa(unsigned int id, struct dsa_platform_data *d) __init; diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c index c510f85..7f3a6c9 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c @@ -19,6 +19,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define AP81_GPIO_LED_STATUS 1 #define AP81_GPIO_LED_AOSS 3 @@ -133,7 +134,7 @@ static void __init ap81_setup(void) ARRAY_SIZE(ap81_gpio_buttons), ap81_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c index 80dd3c6..cb7e1d2 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c @@ -23,6 +23,7 @@ #include <asm/mach-ar71xx/ar91xx_flash.h> #include "devices.h" +#include "dev-ar913x-wmac.h" #define AP83_GPIO_LED_WLAN 6 #define AP83_GPIO_LED_POWER 14 @@ -217,7 +218,7 @@ static void __init ap83_generic_setup(void) ar71xx_add_device_usb(); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); platform_device_register(&ap83_flash_device); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c index 1b90105..e5ce035 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c @@ -20,6 +20,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define DIR_615C1_GPIO_LED_ORANGE_STATUS 1 /* ORANGE:STATUS:TRICOLOR */ #define DIR_615C1_GPIO_LED_BLUE_WPS 3 /* BLUE:WPS */ @@ -148,7 +149,7 @@ static void __init dir_615c1_setup(void) ARRAY_SIZE(dir_615c1_gpio_buttons), dir_615c1_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_DIR_615_C1, "D-Link DIR-615 rev. C1", dir_615c1_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c index 3a14902..71b72a6 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c @@ -20,6 +20,7 @@ #include <asm/mach-ar71xx/ar71xx.h> #include "devices.h" +#include "dev-ar913x-wmac.h" #define MZK_W04NU_GPIO_LED_USB 0 #define MZK_W04NU_GPIO_LED_STATUS 1 @@ -167,7 +168,7 @@ static void __init mzk_w04nu_setup(void) mzk_w04nu_gpio_buttons); ar71xx_add_device_usb(); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_MZK_W04NU, "Planex MZK-W04NU", mzk_w04nu_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c index 7dea748..4cf5fc3 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c @@ -20,6 +20,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define MZK_W300NH_GPIO_LED_STATUS 1 #define MZK_W300NH_GPIO_LED_WPS 3 @@ -153,7 +154,7 @@ static void __init mzk_w300nh_setup(void) ar71xx_add_device_gpio_buttons(-1, MZK_W04NU_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(mzk_w300nh_gpio_buttons), mzk_w300nh_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_MZK_W300NH, "Planex MZK-W300NH", mzk_w300nh_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c index 0c81ec1..340f35d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c @@ -19,6 +19,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define TEW_632BRP_GPIO_LED_STATUS 1 #define TEW_632BRP_GPIO_LED_WPS 3 @@ -123,7 +124,7 @@ static void __init tew_632brp_setup(void) ARRAY_SIZE(tew_632brp_gpio_buttons), tew_632brp_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_TEW_632BRP, "TRENDnet TEW-632BRP", tew_632brp_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c index d612335..034427d 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c @@ -19,6 +19,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define TL_WR1043ND_GPIO_LED_SYSTEM 2 #define TL_WR1043ND_GPIO_LED_QSS 5 @@ -118,7 +119,7 @@ static void __init tl_wr1043nd_setup(void) ar71xx_add_device_gpio_buttons(-1, TL_WR1043ND_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(tl_wr1043nd_gpio_buttons), tl_wr1043nd_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TP-LINK TL-WR1043ND", tl_wr1043nd_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c index fb42cb0..cd5ca92 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c @@ -19,6 +19,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define TL_WR941ND_GPIO_LED_SYSTEM 2 #define TL_WR941ND_GPIO_LED_QSS 5 @@ -131,7 +132,7 @@ static void __init tl_wr941nd_setup(void) ar71xx_add_device_gpio_buttons(-1, TL_WR941ND_BUTTONS_POLL_INTERVAL, ARRAY_SIZE(tl_wr941nd_gpio_buttons), tl_wr941nd_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_TL_WR941ND, "TP-LINK TL-WR941ND", tl_wr941nd_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c index c1674e4..4ea6158 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c @@ -21,6 +21,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define WNR2000_GPIO_LED_PWR_GREEN 14 #define WNR2000_GPIO_LED_PWR_AMBER 7 @@ -143,7 +144,7 @@ static void __init wnr2000_setup(void) wnr2000_gpio_buttons); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); } MIPS_MACHINE(AR71XX_MACH_WNR2000, "NETGEAR WNR2000", wnr2000_setup); diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c index da8bd9b..24704aa 100644 --- a/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c +++ b/target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c @@ -18,6 +18,7 @@ #include "devices.h" #include "dev-m25p80.h" +#include "dev-ar913x-wmac.h" #define WRT160NL_GPIO_LED_POWER 14 #define WRT160NL_GPIO_LED_WPS_AMBER 9 @@ -124,7 +125,7 @@ static void __init wrt160nl_setup(void) ar71xx_add_device_m25p80(&wrt160nl_flash_data); ar71xx_add_device_usb(); - ar91xx_add_device_wmac(); + ar913x_add_device_wmac(); ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wrt160nl_leds_gpio), wrt160nl_leds_gpio); |