]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: orion: Register DSA switch as a MDIO device
authorFlorian Fainelli <f.fainelli@gmail.com>
Sat, 4 Feb 2017 21:02:45 +0000 (13:02 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Feb 2017 15:51:47 +0000 (10:51 -0500)
Utilize the ability to pass board specific MDIO bus information towards a
particular MDIO device thus allowing us to provide the per-port switch layout
to the Marvell 88E6XXX switch driver.

Since we would end-up with conflicting registration paths, do not register the
"dsa" platform device anymore.

Note that the MDIO devices registered by code in net/dsa/dsa2.c does not
parse a dsa_platform_data, but directly take a dsa_chip_data (specific
to a single switch chip), so we update the different call sites to pass
this structure down to orion_ge00_switch_init().

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/arm/mach-orion5x/common.c
arch/arm/mach-orion5x/common.h
arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
arch/arm/mach-orion5x/wnr854t-setup.c
arch/arm/mach-orion5x/wrt350n-v2-setup.c
arch/arm/plat-orion/common.c
arch/arm/plat-orion/include/plat/common.h

index 04910764c38591c6b4d5b7bc14b0ed79ef15c3e6..83a7ec4c16d08e275f28a00de4c8840205676d56 100644 (file)
@@ -105,7 +105,7 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
 /*****************************************************************************
  * Ethernet switch
  ****************************************************************************/
-void __init orion5x_eth_switch_init(struct dsa_platform_data *d)
+void __init orion5x_eth_switch_init(struct dsa_chip_data *d)
 {
        orion_ge00_switch_init(d);
 }
index 8a4115bd441daa2e3c16ff8ec52caafe53c43c6e..efeffc6b4ebbddd63a8a7853a26b806073c061c2 100644 (file)
@@ -3,7 +3,7 @@
 
 #include <linux/reboot.h>
 
-struct dsa_platform_data;
+struct dsa_chip_data;
 struct mv643xx_eth_platform_data;
 struct mv_sata_platform_data;
 
@@ -41,7 +41,7 @@ void orion5x_setup_wins(void);
 void orion5x_ehci0_init(void);
 void orion5x_ehci1_init(void);
 void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
-void orion5x_eth_switch_init(struct dsa_platform_data *d);
+void orion5x_eth_switch_init(struct dsa_chip_data *d);
 void orion5x_i2c_init(void);
 void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
 void orion5x_spi_init(void);
index dccadf68ea2b7bf5277490d6cb198f2b141a96e5..a3c1336d30c930d5da372a570f2e3e49eaffb77d 100644 (file)
@@ -101,11 +101,6 @@ static struct dsa_chip_data rd88f5181l_fxo_switch_chip_data = {
        .port_names[7]  = "lan3",
 };
 
-static struct dsa_platform_data __initdata rd88f5181l_fxo_switch_plat_data = {
-       .nr_chips       = 1,
-       .chip           = &rd88f5181l_fxo_switch_chip_data,
-};
-
 static void __init rd88f5181l_fxo_init(void)
 {
        /*
@@ -120,7 +115,7 @@ static void __init rd88f5181l_fxo_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&rd88f5181l_fxo_eth_data);
-       orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data);
+       orion5x_eth_switch_init(&rd88f5181l_fxo_switch_chip_data);
        orion5x_uart0_init();
 
        mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
index affe5ec825de2cbd819398e52bcb2dc22b6cc8b6..252efe29bd1a7e9867a594c3b6e298e56e2f90dd 100644 (file)
@@ -102,11 +102,6 @@ static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = {
        .port_names[7]  = "lan3",
 };
 
-static struct dsa_platform_data __initdata rd88f5181l_ge_switch_plat_data = {
-       .nr_chips       = 1,
-       .chip           = &rd88f5181l_ge_switch_chip_data,
-};
-
 static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
        I2C_BOARD_INFO("ds1338", 0x68),
 };
@@ -125,7 +120,7 @@ static void __init rd88f5181l_ge_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&rd88f5181l_ge_eth_data);
-       orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data);
+       orion5x_eth_switch_init(&rd88f5181l_ge_switch_chip_data);
        orion5x_i2c_init();
        orion5x_uart0_init();
 
index 67ee8571b03c86e16b014745d1c96de887b3a0e8..f4f1dbe1d91d3544f12401d0ee3da4613f91a951 100644 (file)
@@ -40,11 +40,6 @@ static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
        .port_names[5]  = "cpu",
 };
 
-static struct dsa_platform_data __initdata rd88f6183ap_ge_switch_plat_data = {
-       .nr_chips       = 1,
-       .chip           = &rd88f6183ap_ge_switch_chip_data,
-};
-
 static struct mtd_partition rd88f6183ap_ge_partitions[] = {
        {
                .name   = "kernel",
@@ -89,7 +84,7 @@ static void __init rd88f6183ap_ge_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&rd88f6183ap_ge_eth_data);
-       orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data);
+       orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
        spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
                                ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
        orion5x_spi_init();
index 4dbcdbe1de7ccb2f6e3e4bdc14d478a447c10453..ac3376fc269f0e0c85f1d3298317edbe49bd9794 100644 (file)
@@ -124,7 +124,7 @@ static void __init wnr854t_init(void)
         * Configure peripherals.
         */
        orion5x_eth_init(&wnr854t_eth_data);
-       orion5x_eth_switch_init(&wnr854t_switch_plat_data);
+       orion5x_eth_switch_init(&wnr854t_switch_chip_data);
        orion5x_uart0_init();
 
        mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
index a6a8c4648d74f0382ca283440c359e12e7452d38..9250bb2e429cfc1a2677e5137d0cb5b33f71e24a 100644 (file)
@@ -191,11 +191,6 @@ static struct dsa_chip_data wrt350n_v2_switch_chip_data = {
        .port_names[7]  = "lan4",
 };
 
-static struct dsa_platform_data __initdata wrt350n_v2_switch_plat_data = {
-       .nr_chips       = 1,
-       .chip           = &wrt350n_v2_switch_chip_data,
-};
-
 static void __init wrt350n_v2_init(void)
 {
        /*
@@ -210,7 +205,7 @@ static void __init wrt350n_v2_init(void)
         */
        orion5x_ehci0_init();
        orion5x_eth_init(&wrt350n_v2_eth_data);
-       orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data);
+       orion5x_eth_switch_init(&wrt350n_v2_switch_chip_data);
        orion5x_uart0_init();
 
        mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,
index 272f49b2c68fc5606533b4110ab157bc6318c19e..9255b6d67ba5e3a3b3586639cadc86342e8b4b04 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/platform_data/dma-mv_xor.h>
 #include <linux/platform_data/usb-ehci-orion.h>
 #include <plat/common.h>
+#include <linux/phy.h>
 
 /* Create a clkdev entry for a given device/clk */
 void __init orion_clkdev_add(const char *con_id, const char *dev_id,
@@ -470,15 +471,27 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
 /*****************************************************************************
  * Ethernet switch
  ****************************************************************************/
-void __init orion_ge00_switch_init(struct dsa_platform_data *d)
+static __initconst const char *orion_ge00_mvmdio_bus_name = "orion-mii";
+static __initdata struct mdio_board_info
+                 orion_ge00_switch_board_info;
+
+void __init orion_ge00_switch_init(struct dsa_chip_data *d)
 {
-       int i;
+       struct mdio_board_info *bd;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(d->port_names); i++)
+               if (!strcmp(d->port_names[i], "cpu"))
+                       break;
 
-       d->netdev = &orion_ge00.dev;
-       for (i = 0; i < d->nr_chips; i++)
-               d->chip[i].host_dev = &orion_ge_mvmdio.dev;
+       bd = &orion_ge00_switch_board_info;
+       bd->bus_id = orion_ge00_mvmdio_bus_name;
+       bd->mdio_addr = d->sw_addr;
+       d->netdev[i] = &orion_ge00.dev;
+       strcpy(bd->modalias, "mv88e6085");
+       bd->platform_data = d;
 
-       platform_device_register_data(NULL, "dsa", 0, d, sizeof(d));
+       mdiobus_register_board_info(&orion_ge00_switch_board_info, 1);
 }
 
 /*****************************************************************************
index 9347f3c58a6dfc7f44f340cbd47b8e45f698d04a..3647d3b33c2061e6d1eacef1bc961e3582ad128e 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/platform_data/usb-ehci-orion.h>
 
-struct dsa_platform_data;
+struct dsa_chip_data;
 struct mv_sata_platform_data;
 
 void __init orion_uart0_init(void __iomem *membase,
@@ -57,7 +57,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
                            unsigned long mapbase,
                            unsigned long irq);
 
-void __init orion_ge00_switch_init(struct dsa_platform_data *d);
+void __init orion_ge00_switch_init(struct dsa_chip_data *d);
 
 void __init orion_i2c_init(unsigned long mapbase,
                           unsigned long irq,