ar71xx: allow overriding of the lan port names on AP91 based boards
authorGabor Juhos <juhosg@openwrt.org>
Tue, 9 Mar 2010 18:05:45 +0000 (18:05 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Tue, 9 Mar 2010 18:05:45 +0000 (18:05 +0000)
SVN-Revision: 20095

target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-eth.c
target/linux/ar71xx/files/arch/mips/ar71xx/dev-ap91-eth.h
target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-600-a1.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-rb750.c
target/linux/ar71xx/files/arch/mips/ar71xx/mach-tl-wr741nd.c

index be48b8a9ed0406a79c0ab2664cff4582dfd4be74..571901e670b50085a02a3c8943ea4a5df5b83f4f 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "devices.h"
 #include "dev-dsa.h"
+#include "dev-ap91-eth.h"
 
 static struct dsa_chip_data ap91_dsa_chip = {
        .port_names[0]  = "cpu",
@@ -24,11 +25,27 @@ static struct dsa_platform_data ap91_dsa_data = {
        .chip           = &ap91_dsa_chip,
 };
 
-void __init ap91_eth_init(u8 *mac_addr)
+static void ap91_eth_set_port_name(unsigned port, const char *name)
+{
+       if (port < 1 || port > 5)
+               return;
+
+       if (name)
+               ap91_dsa_chip.port_names[port] = (char *) name;
+}
+
+void __init ap91_eth_init(u8 *mac_addr, const char *port_names[])
 {
        if (mac_addr)
                ar71xx_set_mac_base(mac_addr);
 
+       if (port_names) {
+               int i;
+
+               for (i = 0; i < AP91_ETH_NUM_PORT_NAMES; i++)
+                       ap91_eth_set_port_name(i + 1, port_names[i]);
+       }
+
        /* WAN port */
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
        ar71xx_eth0_data.phy_mask = 0x0;
index 424e2ae468cac73adbfec51017a3a51aeb296a78..d9cd2141ada9a118462258083ad60d6dc8a52eca 100644 (file)
 #ifndef _AR71XX_DEV_AP91_ETH_H
 #define _AR71XX_DEV_AP91_ETH_H
 
+#define AP91_ETH_NUM_PORT_NAMES        4
+
 #if defined(CONFIG_AR71XX_DEV_AP91_ETH)
-void ap91_eth_init(u8 *mac_addr) __init;
+void ap91_eth_init(u8 *mac_addr, const char *port_names[]) __init;
 #else
 static inline void ap91_eth_init(u8 *mac_addr) { }
 #endif
index 42146f55c8222f0adfe0df2fb541e46538e6208c..7222405a08d7ff9c7e4f4a8122adbc7759576ce1 100644 (file)
@@ -130,7 +130,7 @@ static void __init dir_600_a1_setup(void)
                                        ARRAY_SIZE(dir_600_a1_gpio_buttons),
                                        dir_600_a1_gpio_buttons);
 
-       ap91_eth_init(mac);
+       ap91_eth_init(mac, NULL);
        ap91_pci_init(ee, mac);
 }
 
index c2c3ee623f999b43623b7abc52edf3cab3f61169..a39101d631c0c44712ce380f598f61aa4eae8376 100644 (file)
@@ -117,7 +117,7 @@ static void __init rb750_setup(void)
                                     AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
                                     AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
 
-       ap91_eth_init(NULL);
+       ap91_eth_init(NULL, NULL);
        platform_device_register(&rb750_leds_device);
        platform_device_register(&rb750_nand_device);
 }
index f6f305982cb91a953255ffaaf77836f2018cf837..510dcf41279ddb59a4e3e923f4b77256f6bfaaf4 100644 (file)
@@ -108,7 +108,7 @@ static void __init tl_wr741nd_setup(void)
                                        ARRAY_SIZE(tl_wr741nd_gpio_buttons),
                                        tl_wr741nd_gpio_buttons);
 
-       ap91_eth_init(mac);
+       ap91_eth_init(mac, NULL);
        ap91_pci_init(ee, mac);
 }
 MIPS_MACHINE(AR71XX_MACH_TL_WR741ND, "TL-WR741ND", "TP-LINK TL-WR741ND",