diff options
-rw-r--r-- | arch/mips/momentum/jaguar_atx/platform.c | 8 | ||||
-rw-r--r-- | arch/mips/momentum/ocelot_3/platform.c | 8 | ||||
-rw-r--r-- | arch/mips/momentum/ocelot_c/platform.c | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/chrp/pegasos_eth.c | 2 | ||||
-rw-r--r-- | arch/ppc/syslib/mv64x60.c | 12 | ||||
-rw-r--r-- | drivers/net/mv643xx_eth.c | 53 | ||||
-rw-r--r-- | include/linux/mv643xx.h | 1 |
7 files changed, 59 insertions, 29 deletions
diff --git a/arch/mips/momentum/jaguar_atx/platform.c b/arch/mips/momentum/jaguar_atx/platform.c index 771e55f39875..561844878a90 100644 --- a/arch/mips/momentum/jaguar_atx/platform.c +++ b/arch/mips/momentum/jaguar_atx/platform.c | |||
@@ -48,6 +48,8 @@ static struct resource mv64x60_eth0_resources[] = { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | static struct mv643xx_eth_platform_data eth0_pd = { | 50 | static struct mv643xx_eth_platform_data eth0_pd = { |
51 | .port_number = 0, | ||
52 | |||
51 | .tx_sram_addr = MV_SRAM_BASE_ETH0, | 53 | .tx_sram_addr = MV_SRAM_BASE_ETH0, |
52 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 54 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
53 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 55 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -77,6 +79,8 @@ static struct resource mv64x60_eth1_resources[] = { | |||
77 | }; | 79 | }; |
78 | 80 | ||
79 | static struct mv643xx_eth_platform_data eth1_pd = { | 81 | static struct mv643xx_eth_platform_data eth1_pd = { |
82 | .port_number = 1, | ||
83 | |||
80 | .tx_sram_addr = MV_SRAM_BASE_ETH1, | 84 | .tx_sram_addr = MV_SRAM_BASE_ETH1, |
81 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 85 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
82 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 86 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -105,7 +109,9 @@ static struct resource mv64x60_eth2_resources[] = { | |||
105 | }, | 109 | }, |
106 | }; | 110 | }; |
107 | 111 | ||
108 | static struct mv643xx_eth_platform_data eth2_pd; | 112 | static struct mv643xx_eth_platform_data eth2_pd = { |
113 | .port_number = 2, | ||
114 | }; | ||
109 | 115 | ||
110 | static struct platform_device eth2_device = { | 116 | static struct platform_device eth2_device = { |
111 | .name = MV643XX_ETH_NAME, | 117 | .name = MV643XX_ETH_NAME, |
diff --git a/arch/mips/momentum/ocelot_3/platform.c b/arch/mips/momentum/ocelot_3/platform.c index b80733f0c66d..44e4c3fc7403 100644 --- a/arch/mips/momentum/ocelot_3/platform.c +++ b/arch/mips/momentum/ocelot_3/platform.c | |||
@@ -48,6 +48,8 @@ static struct resource mv64x60_eth0_resources[] = { | |||
48 | }; | 48 | }; |
49 | 49 | ||
50 | static struct mv643xx_eth_platform_data eth0_pd = { | 50 | static struct mv643xx_eth_platform_data eth0_pd = { |
51 | .port_number = 0, | ||
52 | |||
51 | .tx_sram_addr = MV_SRAM_BASE_ETH0, | 53 | .tx_sram_addr = MV_SRAM_BASE_ETH0, |
52 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 54 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
53 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 55 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -77,6 +79,8 @@ static struct resource mv64x60_eth1_resources[] = { | |||
77 | }; | 79 | }; |
78 | 80 | ||
79 | static struct mv643xx_eth_platform_data eth1_pd = { | 81 | static struct mv643xx_eth_platform_data eth1_pd = { |
82 | .port_number = 1, | ||
83 | |||
80 | .tx_sram_addr = MV_SRAM_BASE_ETH1, | 84 | .tx_sram_addr = MV_SRAM_BASE_ETH1, |
81 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 85 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
82 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 86 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -105,7 +109,9 @@ static struct resource mv64x60_eth2_resources[] = { | |||
105 | }, | 109 | }, |
106 | }; | 110 | }; |
107 | 111 | ||
108 | static struct mv643xx_eth_platform_data eth2_pd; | 112 | static struct mv643xx_eth_platform_data eth2_pd = { |
113 | .port_number = 2, | ||
114 | }; | ||
109 | 115 | ||
110 | static struct platform_device eth2_device = { | 116 | static struct platform_device eth2_device = { |
111 | .name = MV643XX_ETH_NAME, | 117 | .name = MV643XX_ETH_NAME, |
diff --git a/arch/mips/momentum/ocelot_c/platform.c b/arch/mips/momentum/ocelot_c/platform.c index f7cd303f3eba..7780aa0c6555 100644 --- a/arch/mips/momentum/ocelot_c/platform.c +++ b/arch/mips/momentum/ocelot_c/platform.c | |||
@@ -47,6 +47,8 @@ static struct resource mv64x60_eth0_resources[] = { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | static struct mv643xx_eth_platform_data eth0_pd = { | 49 | static struct mv643xx_eth_platform_data eth0_pd = { |
50 | .port_number = 0, | ||
51 | |||
50 | .tx_sram_addr = MV_SRAM_BASE_ETH0, | 52 | .tx_sram_addr = MV_SRAM_BASE_ETH0, |
51 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 53 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
52 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 54 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
@@ -76,6 +78,8 @@ static struct resource mv64x60_eth1_resources[] = { | |||
76 | }; | 78 | }; |
77 | 79 | ||
78 | static struct mv643xx_eth_platform_data eth1_pd = { | 80 | static struct mv643xx_eth_platform_data eth1_pd = { |
81 | .port_number = 1, | ||
82 | |||
79 | .tx_sram_addr = MV_SRAM_BASE_ETH1, | 83 | .tx_sram_addr = MV_SRAM_BASE_ETH1, |
80 | .tx_sram_size = MV_SRAM_TXRING_SIZE, | 84 | .tx_sram_size = MV_SRAM_TXRING_SIZE, |
81 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, | 85 | .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, |
diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c b/arch/powerpc/platforms/chrp/pegasos_eth.c index 6ad4b1a72c96..71045677559a 100644 --- a/arch/powerpc/platforms/chrp/pegasos_eth.c +++ b/arch/powerpc/platforms/chrp/pegasos_eth.c | |||
@@ -58,6 +58,7 @@ static struct resource mv643xx_eth0_resources[] = { | |||
58 | 58 | ||
59 | 59 | ||
60 | static struct mv643xx_eth_platform_data eth0_pd = { | 60 | static struct mv643xx_eth_platform_data eth0_pd = { |
61 | .port_number = 0, | ||
61 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0, | 62 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0, |
62 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, | 63 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, |
63 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, | 64 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, |
@@ -87,6 +88,7 @@ static struct resource mv643xx_eth1_resources[] = { | |||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static struct mv643xx_eth_platform_data eth1_pd = { | 90 | static struct mv643xx_eth_platform_data eth1_pd = { |
91 | .port_number = 1, | ||
90 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1, | 92 | .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1, |
91 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, | 93 | .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE, |
92 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, | 94 | .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16, |
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c index 3b039c30a439..a6f8b686ea83 100644 --- a/arch/ppc/syslib/mv64x60.c +++ b/arch/ppc/syslib/mv64x60.c | |||
@@ -339,7 +339,9 @@ static struct resource mv64x60_eth0_resources[] = { | |||
339 | }, | 339 | }, |
340 | }; | 340 | }; |
341 | 341 | ||
342 | static struct mv643xx_eth_platform_data eth0_pd; | 342 | static struct mv643xx_eth_platform_data eth0_pd = { |
343 | .port_number = 0, | ||
344 | }; | ||
343 | 345 | ||
344 | static struct platform_device eth0_device = { | 346 | static struct platform_device eth0_device = { |
345 | .name = MV643XX_ETH_NAME, | 347 | .name = MV643XX_ETH_NAME, |
@@ -362,7 +364,9 @@ static struct resource mv64x60_eth1_resources[] = { | |||
362 | }, | 364 | }, |
363 | }; | 365 | }; |
364 | 366 | ||
365 | static struct mv643xx_eth_platform_data eth1_pd; | 367 | static struct mv643xx_eth_platform_data eth1_pd = { |
368 | .port_number = 1, | ||
369 | }; | ||
366 | 370 | ||
367 | static struct platform_device eth1_device = { | 371 | static struct platform_device eth1_device = { |
368 | .name = MV643XX_ETH_NAME, | 372 | .name = MV643XX_ETH_NAME, |
@@ -385,7 +389,9 @@ static struct resource mv64x60_eth2_resources[] = { | |||
385 | }, | 389 | }, |
386 | }; | 390 | }; |
387 | 391 | ||
388 | static struct mv643xx_eth_platform_data eth2_pd; | 392 | static struct mv643xx_eth_platform_data eth2_pd = { |
393 | .port_number = 2, | ||
394 | }; | ||
389 | 395 | ||
390 | static struct platform_device eth2_device = { | 396 | static struct platform_device eth2_device = { |
391 | .name = MV643XX_ETH_NAME, | 397 | .name = MV643XX_ETH_NAME, |
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index be2ddbb6ef56..9ba21e0f27c5 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1309,7 +1309,7 @@ static void mv643xx_init_ethtool_cmd(struct net_device *dev, int phy_address, | |||
1309 | static int mv643xx_eth_probe(struct platform_device *pdev) | 1309 | static int mv643xx_eth_probe(struct platform_device *pdev) |
1310 | { | 1310 | { |
1311 | struct mv643xx_eth_platform_data *pd; | 1311 | struct mv643xx_eth_platform_data *pd; |
1312 | int port_num = pdev->id; | 1312 | int port_num; |
1313 | struct mv643xx_private *mp; | 1313 | struct mv643xx_private *mp; |
1314 | struct net_device *dev; | 1314 | struct net_device *dev; |
1315 | u8 *p; | 1315 | u8 *p; |
@@ -1319,6 +1319,12 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1319 | int duplex = DUPLEX_HALF; | 1319 | int duplex = DUPLEX_HALF; |
1320 | int speed = 0; /* default to auto-negotiation */ | 1320 | int speed = 0; /* default to auto-negotiation */ |
1321 | 1321 | ||
1322 | pd = pdev->dev.platform_data; | ||
1323 | if (pd == NULL) { | ||
1324 | printk(KERN_ERR "No mv643xx_eth_platform_data\n"); | ||
1325 | return -ENODEV; | ||
1326 | } | ||
1327 | |||
1322 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); | 1328 | dev = alloc_etherdev(sizeof(struct mv643xx_private)); |
1323 | if (!dev) | 1329 | if (!dev) |
1324 | return -ENOMEM; | 1330 | return -ENOMEM; |
@@ -1331,8 +1337,6 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1331 | BUG_ON(!res); | 1337 | BUG_ON(!res); |
1332 | dev->irq = res->start; | 1338 | dev->irq = res->start; |
1333 | 1339 | ||
1334 | mp->port_num = port_num; | ||
1335 | |||
1336 | dev->open = mv643xx_eth_open; | 1340 | dev->open = mv643xx_eth_open; |
1337 | dev->stop = mv643xx_eth_stop; | 1341 | dev->stop = mv643xx_eth_stop; |
1338 | dev->hard_start_xmit = mv643xx_eth_start_xmit; | 1342 | dev->hard_start_xmit = mv643xx_eth_start_xmit; |
@@ -1373,39 +1377,40 @@ static int mv643xx_eth_probe(struct platform_device *pdev) | |||
1373 | 1377 | ||
1374 | spin_lock_init(&mp->lock); | 1378 | spin_lock_init(&mp->lock); |
1375 | 1379 | ||
1380 | port_num = pd->port_number; | ||
1381 | |||
1376 | /* set default config values */ | 1382 | /* set default config values */ |
1377 | eth_port_uc_addr_get(dev, dev->dev_addr); | 1383 | eth_port_uc_addr_get(dev, dev->dev_addr); |
1378 | mp->rx_ring_size = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE; | 1384 | mp->rx_ring_size = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE; |
1379 | mp->tx_ring_size = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE; | 1385 | mp->tx_ring_size = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE; |
1380 | 1386 | ||
1381 | pd = pdev->dev.platform_data; | 1387 | if (is_valid_ether_addr(pd->mac_addr)) |
1382 | if (pd) { | 1388 | memcpy(dev->dev_addr, pd->mac_addr, 6); |
1383 | if (is_valid_ether_addr(pd->mac_addr)) | ||
1384 | memcpy(dev->dev_addr, pd->mac_addr, 6); | ||
1385 | 1389 | ||
1386 | if (pd->phy_addr || pd->force_phy_addr) | 1390 | if (pd->phy_addr || pd->force_phy_addr) |
1387 | ethernet_phy_set(port_num, pd->phy_addr); | 1391 | ethernet_phy_set(port_num, pd->phy_addr); |
1388 | 1392 | ||
1389 | if (pd->rx_queue_size) | 1393 | if (pd->rx_queue_size) |
1390 | mp->rx_ring_size = pd->rx_queue_size; | 1394 | mp->rx_ring_size = pd->rx_queue_size; |
1391 | 1395 | ||
1392 | if (pd->tx_queue_size) | 1396 | if (pd->tx_queue_size) |
1393 | mp->tx_ring_size = pd->tx_queue_size; | 1397 | mp->tx_ring_size = pd->tx_queue_size; |
1394 | 1398 | ||
1395 | if (pd->tx_sram_size) { | 1399 | if (pd->tx_sram_size) { |
1396 | mp->tx_sram_size = pd->tx_sram_size; | 1400 | mp->tx_sram_size = pd->tx_sram_size; |
1397 | mp->tx_sram_addr = pd->tx_sram_addr; | 1401 | mp->tx_sram_addr = pd->tx_sram_addr; |
1398 | } | 1402 | } |
1399 | |||
1400 | if (pd->rx_sram_size) { | ||
1401 | mp->rx_sram_size = pd->rx_sram_size; | ||
1402 | mp->rx_sram_addr = pd->rx_sram_addr; | ||
1403 | } | ||
1404 | 1403 | ||
1405 | duplex = pd->duplex; | 1404 | if (pd->rx_sram_size) { |
1406 | speed = pd->speed; | 1405 | mp->rx_sram_size = pd->rx_sram_size; |
1406 | mp->rx_sram_addr = pd->rx_sram_addr; | ||
1407 | } | 1407 | } |
1408 | 1408 | ||
1409 | duplex = pd->duplex; | ||
1410 | speed = pd->speed; | ||
1411 | |||
1412 | mp->port_num = port_num; | ||
1413 | |||
1409 | /* Hook up MII support for ethtool */ | 1414 | /* Hook up MII support for ethtool */ |
1410 | mp->mii.dev = dev; | 1415 | mp->mii.dev = dev; |
1411 | mp->mii.mdio_read = mv643xx_mdio_read; | 1416 | mp->mii.mdio_read = mv643xx_mdio_read; |
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h index e7d4da1cc9fa..c6d4ab86b83c 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h | |||
@@ -1288,6 +1288,7 @@ struct mv64xxx_i2c_pdata { | |||
1288 | #define MV643XX_ETH_NAME "mv643xx_eth" | 1288 | #define MV643XX_ETH_NAME "mv643xx_eth" |
1289 | 1289 | ||
1290 | struct mv643xx_eth_platform_data { | 1290 | struct mv643xx_eth_platform_data { |
1291 | int port_number; | ||
1291 | u16 force_phy_addr; /* force override if phy_addr == 0 */ | 1292 | u16 force_phy_addr; /* force override if phy_addr == 0 */ |
1292 | u16 phy_addr; | 1293 | u16 phy_addr; |
1293 | 1294 | ||