Skip to content

Commit 575e93f

Browse files
ffainellidavem330
authored andcommitted
ARM: orion: Register DSA switch as a MDIO device
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 648ea01 commit 575e93f

File tree

9 files changed

+29
-36
lines changed

9 files changed

+29
-36
lines changed

arch/arm/mach-orion5x/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void __init orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data)
105105
/*****************************************************************************
106106
* Ethernet switch
107107
****************************************************************************/
108-
void __init orion5x_eth_switch_init(struct dsa_platform_data *d)
108+
void __init orion5x_eth_switch_init(struct dsa_chip_data *d)
109109
{
110110
orion_ge00_switch_init(d);
111111
}

arch/arm/mach-orion5x/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <linux/reboot.h>
55

6-
struct dsa_platform_data;
6+
struct dsa_chip_data;
77
struct mv643xx_eth_platform_data;
88
struct mv_sata_platform_data;
99

@@ -41,7 +41,7 @@ void orion5x_setup_wins(void);
4141
void orion5x_ehci0_init(void);
4242
void orion5x_ehci1_init(void);
4343
void orion5x_eth_init(struct mv643xx_eth_platform_data *eth_data);
44-
void orion5x_eth_switch_init(struct dsa_platform_data *d);
44+
void orion5x_eth_switch_init(struct dsa_chip_data *d);
4545
void orion5x_i2c_init(void);
4646
void orion5x_sata_init(struct mv_sata_platform_data *sata_data);
4747
void orion5x_spi_init(void);

arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@ static struct dsa_chip_data rd88f5181l_fxo_switch_chip_data = {
101101
.port_names[7] = "lan3",
102102
};
103103

104-
static struct dsa_platform_data __initdata rd88f5181l_fxo_switch_plat_data = {
105-
.nr_chips = 1,
106-
.chip = &rd88f5181l_fxo_switch_chip_data,
107-
};
108-
109104
static void __init rd88f5181l_fxo_init(void)
110105
{
111106
/*
@@ -120,7 +115,7 @@ static void __init rd88f5181l_fxo_init(void)
120115
*/
121116
orion5x_ehci0_init();
122117
orion5x_eth_init(&rd88f5181l_fxo_eth_data);
123-
orion5x_eth_switch_init(&rd88f5181l_fxo_switch_plat_data);
118+
orion5x_eth_switch_init(&rd88f5181l_fxo_switch_chip_data);
124119
orion5x_uart0_init();
125120

126121
mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,

arch/arm/mach-orion5x/rd88f5181l-ge-setup.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ static struct dsa_chip_data rd88f5181l_ge_switch_chip_data = {
102102
.port_names[7] = "lan3",
103103
};
104104

105-
static struct dsa_platform_data __initdata rd88f5181l_ge_switch_plat_data = {
106-
.nr_chips = 1,
107-
.chip = &rd88f5181l_ge_switch_chip_data,
108-
};
109-
110105
static struct i2c_board_info __initdata rd88f5181l_ge_i2c_rtc = {
111106
I2C_BOARD_INFO("ds1338", 0x68),
112107
};
@@ -125,7 +120,7 @@ static void __init rd88f5181l_ge_init(void)
125120
*/
126121
orion5x_ehci0_init();
127122
orion5x_eth_init(&rd88f5181l_ge_eth_data);
128-
orion5x_eth_switch_init(&rd88f5181l_ge_switch_plat_data);
123+
orion5x_eth_switch_init(&rd88f5181l_ge_switch_chip_data);
129124
orion5x_i2c_init();
130125
orion5x_uart0_init();
131126

arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
4040
.port_names[5] = "cpu",
4141
};
4242

43-
static struct dsa_platform_data __initdata rd88f6183ap_ge_switch_plat_data = {
44-
.nr_chips = 1,
45-
.chip = &rd88f6183ap_ge_switch_chip_data,
46-
};
47-
4843
static struct mtd_partition rd88f6183ap_ge_partitions[] = {
4944
{
5045
.name = "kernel",
@@ -89,7 +84,7 @@ static void __init rd88f6183ap_ge_init(void)
8984
*/
9085
orion5x_ehci0_init();
9186
orion5x_eth_init(&rd88f6183ap_ge_eth_data);
92-
orion5x_eth_switch_init(&rd88f6183ap_ge_switch_plat_data);
87+
orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
9388
spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
9489
ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
9590
orion5x_spi_init();

arch/arm/mach-orion5x/wnr854t-setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void __init wnr854t_init(void)
124124
* Configure peripherals.
125125
*/
126126
orion5x_eth_init(&wnr854t_eth_data);
127-
orion5x_eth_switch_init(&wnr854t_switch_plat_data);
127+
orion5x_eth_switch_init(&wnr854t_switch_chip_data);
128128
orion5x_uart0_init();
129129

130130
mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,

arch/arm/mach-orion5x/wrt350n-v2-setup.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ static struct dsa_chip_data wrt350n_v2_switch_chip_data = {
191191
.port_names[7] = "lan4",
192192
};
193193

194-
static struct dsa_platform_data __initdata wrt350n_v2_switch_plat_data = {
195-
.nr_chips = 1,
196-
.chip = &wrt350n_v2_switch_chip_data,
197-
};
198-
199194
static void __init wrt350n_v2_init(void)
200195
{
201196
/*
@@ -210,7 +205,7 @@ static void __init wrt350n_v2_init(void)
210205
*/
211206
orion5x_ehci0_init();
212207
orion5x_eth_init(&wrt350n_v2_eth_data);
213-
orion5x_eth_switch_init(&wrt350n_v2_switch_plat_data);
208+
orion5x_eth_switch_init(&wrt350n_v2_switch_chip_data);
214209
orion5x_uart0_init();
215210

216211
mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET,

arch/arm/plat-orion/common.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/platform_data/dma-mv_xor.h>
2323
#include <linux/platform_data/usb-ehci-orion.h>
2424
#include <plat/common.h>
25+
#include <linux/phy.h>
2526

2627
/* Create a clkdev entry for a given device/clk */
2728
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,
470471
/*****************************************************************************
471472
* Ethernet switch
472473
****************************************************************************/
473-
void __init orion_ge00_switch_init(struct dsa_platform_data *d)
474+
static __initconst const char *orion_ge00_mvmdio_bus_name = "orion-mii";
475+
static __initdata struct mdio_board_info
476+
orion_ge00_switch_board_info;
477+
478+
void __init orion_ge00_switch_init(struct dsa_chip_data *d)
474479
{
475-
int i;
480+
struct mdio_board_info *bd;
481+
unsigned int i;
482+
483+
for (i = 0; i < ARRAY_SIZE(d->port_names); i++)
484+
if (!strcmp(d->port_names[i], "cpu"))
485+
break;
476486

477-
d->netdev = &orion_ge00.dev;
478-
for (i = 0; i < d->nr_chips; i++)
479-
d->chip[i].host_dev = &orion_ge_mvmdio.dev;
487+
bd = &orion_ge00_switch_board_info;
488+
bd->bus_id = orion_ge00_mvmdio_bus_name;
489+
bd->mdio_addr = d->sw_addr;
490+
d->netdev[i] = &orion_ge00.dev;
491+
strcpy(bd->modalias, "mv88e6085");
492+
bd->platform_data = d;
480493

481-
platform_device_register_data(NULL, "dsa", 0, d, sizeof(d));
494+
mdiobus_register_board_info(&orion_ge00_switch_board_info, 1);
482495
}
483496

484497
/*****************************************************************************

arch/arm/plat-orion/include/plat/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <linux/mv643xx_eth.h>
1313
#include <linux/platform_data/usb-ehci-orion.h>
1414

15-
struct dsa_platform_data;
15+
struct dsa_chip_data;
1616
struct mv_sata_platform_data;
1717

1818
void __init orion_uart0_init(void __iomem *membase,
@@ -57,7 +57,7 @@ void __init orion_ge11_init(struct mv643xx_eth_platform_data *eth_data,
5757
unsigned long mapbase,
5858
unsigned long irq);
5959

60-
void __init orion_ge00_switch_init(struct dsa_platform_data *d);
60+
void __init orion_ge00_switch_init(struct dsa_chip_data *d);
6161

6262
void __init orion_i2c_init(unsigned long mapbase,
6363
unsigned long irq,

0 commit comments

Comments
 (0)