ar71xx: move dsa switch device support into a separate file
authorGabor Juhos <juhosg@openwrt.org>
Sat, 26 Dec 2009 14:19:26 +0000 (14:19 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Sat, 26 Dec 2009 14:19:26 +0000 (14:19 +0000)
SVN-Revision: 18943

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-dsa.c [new file with mode: 0644]
target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.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-tl-wr841n.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr941nd.c

index 16c44c2f21b46a50c2d56c627533a82a63ae3e5c..0f0b5419bf695aa26bf165a64f09240fca92fc7d 100644 (file)
@@ -6,6 +6,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
 CONFIG_AR71XX_DEV_AP91_PCI=y
 CONFIG_AR71XX_DEV_AP94_PCI=y
 CONFIG_AR71XX_DEV_AR913X_WMAC=y
+CONFIG_AR71XX_DEV_DSA=y
 CONFIG_AR71XX_DEV_GPIO_BUTTONS=y
 CONFIG_AR71XX_DEV_LEDS_GPIO=y
 CONFIG_AR71XX_DEV_M25P80=y
index be330c7900d5ab10f6e74ac4fd9128971aed29b1..7795cfc5c0eb1d94f78e6b8d7d60cba9d2c15367 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
 CONFIG_AR71XX_DEV_AP91_PCI=y
 CONFIG_AR71XX_DEV_AP94_PCI=y
 CONFIG_AR71XX_DEV_AR913X_WMAC=y
+CONFIG_AR71XX_DEV_DSA=y
 CONFIG_AR71XX_DEV_GPIO_BUTTONS=y
 CONFIG_AR71XX_DEV_LEDS_GPIO=y
 CONFIG_AR71XX_DEV_M25P80=y
index d9db5e8595aff56f368cf17113db03d9f9d4a8e1..6b483b3d7f7324973bf2457d2523fc128592f9ab 100644 (file)
@@ -8,6 +8,7 @@ CONFIG_AG71XX_AR8216_SUPPORT=y
 CONFIG_AR71XX_DEV_AP91_PCI=y
 CONFIG_AR71XX_DEV_AP94_PCI=y
 CONFIG_AR71XX_DEV_AR913X_WMAC=y
+CONFIG_AR71XX_DEV_DSA=y
 CONFIG_AR71XX_DEV_GPIO_BUTTONS=y
 CONFIG_AR71XX_DEV_LEDS_GPIO=y
 CONFIG_AR71XX_DEV_M25P80=y
index e3a9e106d363be9ef4dfe26caffa44ea92bdcfec..e2aaa66066650e86aa7f8ceb4a7a8bd2296b17e1 100644 (file)
@@ -142,6 +142,7 @@ config AR71XX_MACH_TL_WR841N_V1
        bool "TP-LINK TL-WR841N v1 support"
        select AR71XX_DEV_M25P80
        select AR71XX_DEV_PB42_PCI if PCI
+       select AR71XX_DEV_DSA
        select AR71XX_DEV_GPIO_BUTTONS
        select AR71XX_DEV_LEDS_GPIO
        default n
@@ -150,6 +151,7 @@ config AR71XX_MACH_TL_WR941ND
        bool "TP-LINK TL-WR941ND support"
        select AR71XX_DEV_M25P80
        select AR71XX_DEV_AR913X_WMAC
+       select AR71XX_DEV_DSA
        select AR71XX_DEV_GPIO_BUTTONS
        select AR71XX_DEV_LEDS_GPIO
        default n
@@ -195,6 +197,9 @@ config AR71XX_DEV_AP94_PCI
 config AR71XX_DEV_AR913X_WMAC
        def_bool n
 
+config AR71XX_DEV_DSA
+       def_bool n
+
 config AR71XX_DEV_GPIO_BUTTONS
        def_bool n
 
index 9b5c4ddfb485c21ce16c5253c2ca0261dff5aaa4..db118fb29c7c7cd95eb6d2f6c339ac35b2765839 100644 (file)
@@ -16,6 +16,7 @@ obj-$(CONFIG_PCI)                     += pci.o
 obj-$(CONFIG_AR71XX_DEV_AP91_PCI)      += dev-ap91-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_DSA)           += dev-dsa.o
 obj-$(CONFIG_AR71XX_DEV_GPIO_BUTTONS)  += dev-gpio-buttons.o
 obj-$(CONFIG_AR71XX_DEV_LEDS_GPIO)     += dev-leds-gpio.o
 obj-$(CONFIG_AR71XX_DEV_M25P80)                += dev-m25p80.o
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.c
new file mode 100644 (file)
index 0000000..c2877f2
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *  Atheros AR71xx DSA switch device support
+ *
+ *  Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ *  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/init.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-ar71xx/ar71xx.h>
+
+#include "devices.h"
+#include "dev-dsa.h"
+
+static struct platform_device ar71xx_dsa_switch_device = {
+       .name           = "dsa",
+       .id             = 0,
+};
+
+void __init ar71xx_add_device_dsa(unsigned int id,
+                                 struct dsa_platform_data *d)
+{
+       int i;
+
+       switch (id) {
+       case 0:
+               d->netdev = &ar71xx_eth0_device.dev;
+               break;
+       case 1:
+               d->netdev = &ar71xx_eth1_device.dev;
+               break;
+       default:
+               printk(KERN_ERR
+                       "ar71xx: invalid ethernet id %d for DSA switch\n",
+                       id);
+               return;
+       }
+
+       for (i = 0; i < d->nr_chips; i++)
+               d->chip[i].mii_bus = &ar71xx_mdio_device.dev;
+
+       ar71xx_dsa_switch_device.dev.platform_data = d;
+
+       platform_device_register(&ar71xx_dsa_switch_device);
+}
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-dsa.h
new file mode 100644 (file)
index 0000000..2b11882
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ *  Atheros AR71xx DSA switch device support
+ *
+ *  Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
+ *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
+ *
+ *  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_DSA_H
+#define _AR71XX_DEV_DSA_H
+
+#include <net/dsa.h>
+
+void ar71xx_add_device_dsa(unsigned int id,
+                          struct dsa_platform_data *d) __init;
+
+#endif /* _AR71XX_DEV_DSA_H */
index 6261b26cfd9965de20616cee7b4eaec4f9e5bba7..a7b702681da37a50377ebb637d1d3ebea6acd79f 100644 (file)
@@ -72,7 +72,7 @@ static struct resource ar71xx_mdio_resources[] = {
 
 static struct ag71xx_mdio_platform_data ar71xx_mdio_data;
 
-static struct platform_device ar71xx_mdio_device = {
+struct platform_device ar71xx_mdio_device = {
        .name           = "ag71xx-mdio",
        .id             = -1,
        .resource       = ar71xx_mdio_resources,
@@ -252,7 +252,7 @@ struct ag71xx_platform_data ar71xx_eth0_data = {
        .reset_bit      = RESET_MODULE_GE0_MAC,
 };
 
-static struct platform_device ar71xx_eth0_device = {
+struct platform_device ar71xx_eth0_device = {
        .name           = "ag71xx",
        .id             = 0,
        .resource       = ar71xx_eth0_resources,
@@ -285,7 +285,7 @@ struct ag71xx_platform_data ar71xx_eth1_data = {
        .reset_bit      = RESET_MODULE_GE1_MAC,
 };
 
-static struct platform_device ar71xx_eth1_device = {
+struct platform_device ar71xx_eth1_device = {
        .name           = "ag71xx",
        .id             = 1,
        .resource       = ar71xx_eth1_resources,
@@ -545,35 +545,3 @@ void __init ar71xx_parse_mac_addr(char *mac_str)
                printk(KERN_DEBUG "ar71xx: failed to parse mac address "
                                "\"%s\"\n", mac_str);
 }
-
-static struct platform_device ar71xx_dsa_switch_device = {
-       .name           = "dsa",
-       .id             = 0,
-};
-
-void __init ar71xx_add_device_dsa(unsigned int id,
-                                 struct dsa_platform_data *d)
-{
-       int i;
-
-       switch (id) {
-       case 0:
-               d->netdev = &ar71xx_eth0_device.dev;
-               break;
-       case 1:
-               d->netdev = &ar71xx_eth1_device.dev;
-               break;
-       default:
-               printk(KERN_ERR
-                       "ar71xx: invalid ethernet id %d for DSA switch\n",
-                       id);
-               return;
-       }
-
-       for (i = 0; i < d->nr_chips; i++)
-               d->chip[i].mii_bus = &ar71xx_mdio_device.dev;
-
-       ar71xx_dsa_switch_device.dev.platform_data = d;
-
-       platform_device_register(&ar71xx_dsa_switch_device);
-}
index d4dfdcc0dd40d7f037236cac1723d802642a774e..957675b0e15dc9fa50d6f0f4fcd2ea8ccb7bdb06 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <asm/mach-ar71xx/platform.h>
 
-#include <net/dsa.h>
+struct platform_device;
 
 void ar71xx_add_device_spi(struct ar71xx_spi_platform_data *pdata,
                           struct spi_board_info const *info,
@@ -34,15 +34,15 @@ extern struct ar71xx_eth_pll_data ar71xx_eth1_pll_data;
 
 extern struct ag71xx_platform_data ar71xx_eth0_data;
 extern struct ag71xx_platform_data ar71xx_eth1_data;
+extern struct platform_device ar71xx_eth0_device;
+extern struct platform_device ar71xx_eth1_device;
 void ar71xx_add_device_eth(unsigned int id) __init;
 
+extern struct platform_device ar71xx_mdio_device;
 void ar71xx_add_device_mdio(u32 phy_mask) __init;
 
 void ar71xx_add_device_uart(void) __init;
 
 void ar71xx_add_device_wdt(void) __init;
 
-void ar71xx_add_device_dsa(unsigned int id,
-                          struct dsa_platform_data *d) __init;
-
 #endif /* __AR71XX_DEVICES_H */
index a0a4dda84cc78ea5e48e32fbceef95c3b2b1f0e4..10d00c41ed8115bfbc3fb94254f73db5047f7d20 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "machtype.h"
 #include "devices.h"
+#include "dev-dsa.h"
 #include "dev-m25p80.h"
 #include "dev-gpio-buttons.h"
 #include "dev-pb42-pci.h"
index 55fde5cb3aaa9ccc879fd353a05ddc34e69ee011..da26cc51bb8b355796c2a8ef1105d3d12e6385ff 100644 (file)
@@ -15,6 +15,7 @@
 
 #include "machtype.h"
 #include "devices.h"
+#include "dev-dsa.h"
 #include "dev-m25p80.h"
 #include "dev-ar913x-wmac.h"
 #include "dev-gpio-buttons.h"