ar71xx: ar913x_wmac device support into a separate file
authorGabor Juhos <juhosg@openwrt.org>
Fri, 18 Dec 2009 12:57:09 +0000 (12:57 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 18 Dec 2009 12:57:09 +0000 (12:57 +0000)
SVN-Revision: 18820

19 files changed:
target/linux/ar71xx/config-2.6.30
target/linux/ar71xx/config-2.6.31
target/linux/ar71xx/config-2.6.32
target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar913x-wmac.h [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ar71xx/devices.c
target/linux/ar71xx/files/arch/mips/ar71xx/devices.h
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap81.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-ap83.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-615-c1.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w04nu.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-mzk-w300nh.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tew-632brp.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr1043nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wnr2000.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-wrt160nl.c

index da5f3c4cfceb87314aa704019e2dbfb24c70feaf..f4b6906653827730e9e51419c92a2b16262d1b4d 100644 (file)
@@ -4,6 +4,7 @@ CONFIG_AG71XX=y
 CONFIG_AG71XX_AR8216_SUPPORT=y
 # CONFIG_AG71XX_DEBUG is not set
 CONFIG_AR71XX_DEV_AP94_PCI=y
+CONFIG_AR71XX_DEV_AR913X_WMAC=y
 CONFIG_AR71XX_DEV_M25P80=y
 CONFIG_AR71XX_MACH_AP81=y
 CONFIG_AR71XX_MACH_AP83=y
index 0c85a41168cbb29a4061cfe02ff877b893a5b176..74aa04e3561c20a80546c8d35c0eeb874d07dcb6 100644 (file)
@@ -6,6 +6,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
 # CONFIG_AR7 is not set
 CONFIG_AR71XX_DEV_AP94_PCI=y
+CONFIG_AR71XX_DEV_AR913X_WMAC=y
 CONFIG_AR71XX_DEV_M25P80=y
 CONFIG_AR71XX_MACH_AP81=y
 CONFIG_AR71XX_MACH_AP83=y
index 415917fbac5361b2d94886511053d335ec465c4b..dda7ecee9ae412f2f59ccd39781f72a85d086b95 100644 (file)
@@ -6,6 +6,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
 # CONFIG_ALCHEMY_GPIO_INDIRECT is not set
 # CONFIG_AR7 is not set
 CONFIG_AR71XX_DEV_AP94_PCI=y
+CONFIG_AR71XX_DEV_AR913X_WMAC=y
 CONFIG_AR71XX_DEV_M25P80=y
 CONFIG_AR71XX_MACH_AP81=y
 CONFIG_AR71XX_MACH_AP83=y
index 3999b97c4d4b08bf279a19800835dc4d473b1fff..ebc66497ef88cb1a165a60c6354211950f1ee600 100644 (file)
@@ -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
index 3e2c8da6364cc5c937fe462a47c0a0fd05031b38..54d451323165e3c2dfb9dcf6989188e0b549c813 100644 (file)
@@ -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 (file)
index 0000000..342f8de
--- /dev/null
@@ -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 (file)
index 0000000..1fa0093
--- /dev/null
@@ -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 */
index e9a80ee7b63fa8b4d24257f899c1f95e10dd4dd9..6f6ec421014974fd0e7628a56acfb05d45816640 100644 (file)
@@ -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,
index 6c721269df0b21267b3d69a3b7018f3605cf7d3f..1408629625513c266407a41c84ffe28c35159f58 100644 (file)
@@ -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;
 
index c510f85487f70f2a3546fa7160b2d5bf76525c0f..7f3a6c92c3b7cb24c67d2a18285341b80de08823 100644 (file)
@@ -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);
index 80dd3c64aa8243b8cbfffe7369295346d48c6212..cb7e1d242a1f3bb3de783fd66180e76dfd248f11 100644 (file)
@@ -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);
 
index 1b90105bb3fbdfd2a65af0ac93f37853179ce327..e5ce035699530fdcbdb1b2e8ffe94b19f621847e 100644 (file)
@@ -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);
index 3a149020247dba0a7d795b93f65bfe08ab8c87e7..71b72a6110a1422715be023f72b097ba2f636ee2 100644 (file)
@@ -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);
index 7dea748e05fb321ef706b505fbcc5cd51906da5f..4cf5fc3f911cebf50e4b35dab6407b9183829035 100644 (file)
@@ -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);
index 0c81ec190c52e1b59e10e7b2fc7adcfcb0cfef07..340f35da3d16b48f168d211981980d6fdcd9a228 100644 (file)
@@ -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);
index d612335f9a47bf7b2278bd345ef73d4a9f8f7d40..034427d1bc232ecc95ee5d74e3c753c8c20ba53d 100644 (file)
@@ -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);
index fb42cb006a3b0de93be775e3a2ffd01367b4d905..cd5ca923771c65adfcf70af702a3c4f95847d626 100644 (file)
@@ -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);
index c1674e4690870cd5390d5552ea0a622ed4f2c9a4..4ea615874f9ca9ce38decb34343982eedcc2f8a9 100644 (file)
@@ -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);
index da8bd9bbe2c8f4ea635374a8f94ad967ba447d91..24704aa6842407444c64ebf06e2032ef9940b5e1 100644 (file)
@@ -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);