Skip to content

Commit

Permalink
ARM: orion: Register DSA switch as a MDIO device
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Feb 7, 2017
1 parent 648ea01 commit 575e93f
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 36 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-orion5x/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-orion5x/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
Expand All @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
Expand All @@ -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();

Expand Down
7 changes: 1 addition & 6 deletions arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-orion5x/wnr854t-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 1 addition & 6 deletions arch/arm/mach-orion5x/wrt350n-v2-setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
/*
Expand All @@ -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,
Expand Down
25 changes: 19 additions & 6 deletions arch/arm/plat-orion/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

/*****************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/plat-orion/include/plat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 575e93f

Please sign in to comment.