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 da5f3c4..f4b6906 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 0c85a41..74aa04e 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 415917f..dda7ece 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 3999b97..ebc6649 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 3e2c8da..54d4513 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 e9a80ee..6f6ec42 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 6c72126..1408629 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 c510f85..7f3a6c9 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 80dd3c6..cb7e1d2 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 1b90105..e5ce035 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 3a14902..71b72a6 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 7dea748..4cf5fc3 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 0c81ec1..340f35d 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 d612335..034427d 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 fb42cb0..cd5ca92 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 c1674e4..4ea6158 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 da8bd9b..24704aa 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);