aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Farnsworth <dale@farnsworth.org>2007-03-01 18:31:48 -0500
committerJeff Garzik <jeff@garzik.org>2007-03-02 20:16:10 -0500
commit5ada386bad58f023686b17113496ff626f10773f (patch)
tree329a34f189f07987d5ec45c874ecb5d6f60b1259
parent471a567144b91c8f2b7a71a1cf8babe7331590b1 (diff)
mv643xx_eth: move mac_addr inside mv643xx_eth_platform_data
The information contained within platform_data should be self-contained. Replace the pointer to a MAC address with the actual MAC address in struct mv643xx_eth_platform_data. Signed-off-by: Dale Farnsworth <dale@farnsworth.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--arch/mips/momentum/jaguar_atx/platform.c20
-rw-r--r--arch/mips/momentum/ocelot_3/platform.c20
-rw-r--r--arch/mips/momentum/ocelot_c/platform.c12
-rw-r--r--drivers/net/mv643xx_eth.c2
-rw-r--r--include/linux/mv643xx.h2
5 files changed, 12 insertions, 44 deletions
diff --git a/arch/mips/momentum/jaguar_atx/platform.c b/arch/mips/momentum/jaguar_atx/platform.c
index 3df36eda75af..771e55f39875 100644
--- a/arch/mips/momentum/jaguar_atx/platform.c
+++ b/arch/mips/momentum/jaguar_atx/platform.c
@@ -47,11 +47,7 @@ static struct resource mv64x60_eth0_resources[] = {
47 }, 47 },
48}; 48};
49 49
50static char eth0_mac_addr[ETH_ALEN];
51
52static struct mv643xx_eth_platform_data eth0_pd = { 50static struct mv643xx_eth_platform_data eth0_pd = {
53 .mac_addr = eth0_mac_addr,
54
55 .tx_sram_addr = MV_SRAM_BASE_ETH0, 51 .tx_sram_addr = MV_SRAM_BASE_ETH0,
56 .tx_sram_size = MV_SRAM_TXRING_SIZE, 52 .tx_sram_size = MV_SRAM_TXRING_SIZE,
57 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, 53 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
@@ -80,11 +76,7 @@ static struct resource mv64x60_eth1_resources[] = {
80 }, 76 },
81}; 77};
82 78
83static char eth1_mac_addr[ETH_ALEN];
84
85static struct mv643xx_eth_platform_data eth1_pd = { 79static struct mv643xx_eth_platform_data eth1_pd = {
86 .mac_addr = eth1_mac_addr,
87
88 .tx_sram_addr = MV_SRAM_BASE_ETH1, 80 .tx_sram_addr = MV_SRAM_BASE_ETH1,
89 .tx_sram_size = MV_SRAM_TXRING_SIZE, 81 .tx_sram_size = MV_SRAM_TXRING_SIZE,
90 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, 82 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
@@ -113,11 +105,7 @@ static struct resource mv64x60_eth2_resources[] = {
113 }, 105 },
114}; 106};
115 107
116static char eth2_mac_addr[ETH_ALEN]; 108static struct mv643xx_eth_platform_data eth2_pd;
117
118static struct mv643xx_eth_platform_data eth2_pd = {
119 .mac_addr = eth2_mac_addr,
120};
121 109
122static struct platform_device eth2_device = { 110static struct platform_device eth2_device = {
123 .name = MV643XX_ETH_NAME, 111 .name = MV643XX_ETH_NAME,
@@ -200,9 +188,9 @@ static int __init mv643xx_eth_add_pds(void)
200 int ret; 188 int ret;
201 189
202 get_mac(mac); 190 get_mac(mac);
203 eth_mac_add(eth0_mac_addr, mac, 0); 191 eth_mac_add(eth0_pd.mac_addr, mac, 0);
204 eth_mac_add(eth1_mac_addr, mac, 1); 192 eth_mac_add(eth1_pd.mac_addr, mac, 1);
205 eth_mac_add(eth2_mac_addr, mac, 2); 193 eth_mac_add(eth2_pd.mac_addr, mac, 2);
206 ret = platform_add_devices(mv643xx_eth_pd_devs, 194 ret = platform_add_devices(mv643xx_eth_pd_devs,
207 ARRAY_SIZE(mv643xx_eth_pd_devs)); 195 ARRAY_SIZE(mv643xx_eth_pd_devs));
208 196
diff --git a/arch/mips/momentum/ocelot_3/platform.c b/arch/mips/momentum/ocelot_3/platform.c
index 024aef25f372..b80733f0c66d 100644
--- a/arch/mips/momentum/ocelot_3/platform.c
+++ b/arch/mips/momentum/ocelot_3/platform.c
@@ -47,11 +47,7 @@ static struct resource mv64x60_eth0_resources[] = {
47 }, 47 },
48}; 48};
49 49
50static char eth0_mac_addr[ETH_ALEN];
51
52static struct mv643xx_eth_platform_data eth0_pd = { 50static struct mv643xx_eth_platform_data eth0_pd = {
53 .mac_addr = eth0_mac_addr,
54
55 .tx_sram_addr = MV_SRAM_BASE_ETH0, 51 .tx_sram_addr = MV_SRAM_BASE_ETH0,
56 .tx_sram_size = MV_SRAM_TXRING_SIZE, 52 .tx_sram_size = MV_SRAM_TXRING_SIZE,
57 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, 53 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
@@ -80,11 +76,7 @@ static struct resource mv64x60_eth1_resources[] = {
80 }, 76 },
81}; 77};
82 78
83static char eth1_mac_addr[ETH_ALEN];
84
85static struct mv643xx_eth_platform_data eth1_pd = { 79static struct mv643xx_eth_platform_data eth1_pd = {
86 .mac_addr = eth1_mac_addr,
87
88 .tx_sram_addr = MV_SRAM_BASE_ETH1, 80 .tx_sram_addr = MV_SRAM_BASE_ETH1,
89 .tx_sram_size = MV_SRAM_TXRING_SIZE, 81 .tx_sram_size = MV_SRAM_TXRING_SIZE,
90 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, 82 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
@@ -113,11 +105,7 @@ static struct resource mv64x60_eth2_resources[] = {
113 }, 105 },
114}; 106};
115 107
116static char eth2_mac_addr[ETH_ALEN]; 108static struct mv643xx_eth_platform_data eth2_pd;
117
118static struct mv643xx_eth_platform_data eth2_pd = {
119 .mac_addr = eth2_mac_addr,
120};
121 109
122static struct platform_device eth2_device = { 110static struct platform_device eth2_device = {
123 .name = MV643XX_ETH_NAME, 111 .name = MV643XX_ETH_NAME,
@@ -200,9 +188,9 @@ static int __init mv643xx_eth_add_pds(void)
200 int ret; 188 int ret;
201 189
202 get_mac(mac); 190 get_mac(mac);
203 eth_mac_add(eth0_mac_addr, mac, 0); 191 eth_mac_add(eth0_pd.mac_addr, mac, 0);
204 eth_mac_add(eth1_mac_addr, mac, 1); 192 eth_mac_add(eth1_pd.mac_addr, mac, 1);
205 eth_mac_add(eth2_mac_addr, mac, 2); 193 eth_mac_add(eth2_pd.mac_addr, mac, 2);
206 ret = platform_add_devices(mv643xx_eth_pd_devs, 194 ret = platform_add_devices(mv643xx_eth_pd_devs,
207 ARRAY_SIZE(mv643xx_eth_pd_devs)); 195 ARRAY_SIZE(mv643xx_eth_pd_devs));
208 196
diff --git a/arch/mips/momentum/ocelot_c/platform.c b/arch/mips/momentum/ocelot_c/platform.c
index fac8b2499387..f7cd303f3eba 100644
--- a/arch/mips/momentum/ocelot_c/platform.c
+++ b/arch/mips/momentum/ocelot_c/platform.c
@@ -46,11 +46,7 @@ static struct resource mv64x60_eth0_resources[] = {
46 }, 46 },
47}; 47};
48 48
49static char eth0_mac_addr[ETH_ALEN];
50
51static struct mv643xx_eth_platform_data eth0_pd = { 49static struct mv643xx_eth_platform_data eth0_pd = {
52 .mac_addr = eth0_mac_addr,
53
54 .tx_sram_addr = MV_SRAM_BASE_ETH0, 50 .tx_sram_addr = MV_SRAM_BASE_ETH0,
55 .tx_sram_size = MV_SRAM_TXRING_SIZE, 51 .tx_sram_size = MV_SRAM_TXRING_SIZE,
56 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, 52 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
@@ -79,11 +75,7 @@ static struct resource mv64x60_eth1_resources[] = {
79 }, 75 },
80}; 76};
81 77
82static char eth1_mac_addr[ETH_ALEN];
83
84static struct mv643xx_eth_platform_data eth1_pd = { 78static struct mv643xx_eth_platform_data eth1_pd = {
85 .mac_addr = eth1_mac_addr,
86
87 .tx_sram_addr = MV_SRAM_BASE_ETH1, 79 .tx_sram_addr = MV_SRAM_BASE_ETH1,
88 .tx_sram_size = MV_SRAM_TXRING_SIZE, 80 .tx_sram_size = MV_SRAM_TXRING_SIZE,
89 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16, 81 .tx_queue_size = MV_SRAM_TXRING_SIZE / 16,
@@ -174,8 +166,8 @@ static int __init mv643xx_eth_add_pds(void)
174 int ret; 166 int ret;
175 167
176 get_mac(mac); 168 get_mac(mac);
177 eth_mac_add(eth0_mac_addr, mac, 0); 169 eth_mac_add(eth0_pd.mac_addr, mac, 0);
178 eth_mac_add(eth1_mac_addr, mac, 1); 170 eth_mac_add(eth1_pd.mac_addr, mac, 1);
179 ret = platform_add_devices(mv643xx_eth_pd_devs, 171 ret = platform_add_devices(mv643xx_eth_pd_devs,
180 ARRAY_SIZE(mv643xx_eth_pd_devs)); 172 ARRAY_SIZE(mv643xx_eth_pd_devs));
181 173
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 3e045a695dbc..be2ddbb6ef56 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1380,7 +1380,7 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
1380 1380
1381 pd = pdev->dev.platform_data; 1381 pd = pdev->dev.platform_data;
1382 if (pd) { 1382 if (pd) {
1383 if (pd->mac_addr) 1383 if (is_valid_ether_addr(pd->mac_addr))
1384 memcpy(dev->dev_addr, pd->mac_addr, 6); 1384 memcpy(dev->dev_addr, pd->mac_addr, 6);
1385 1385
1386 if (pd->phy_addr || pd->force_phy_addr) 1386 if (pd->phy_addr || pd->force_phy_addr)
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h
index aff25c000abf..e7d4da1cc9fa 100644
--- a/include/linux/mv643xx.h
+++ b/include/linux/mv643xx.h
@@ -1288,7 +1288,6 @@ struct mv64xxx_i2c_pdata {
1288#define MV643XX_ETH_NAME "mv643xx_eth" 1288#define MV643XX_ETH_NAME "mv643xx_eth"
1289 1289
1290struct mv643xx_eth_platform_data { 1290struct mv643xx_eth_platform_data {
1291 char *mac_addr; /* pointer to mac address */
1292 u16 force_phy_addr; /* force override if phy_addr == 0 */ 1291 u16 force_phy_addr; /* force override if phy_addr == 0 */
1293 u16 phy_addr; 1292 u16 phy_addr;
1294 1293
@@ -1303,6 +1302,7 @@ struct mv643xx_eth_platform_data {
1303 u32 tx_sram_size; 1302 u32 tx_sram_size;
1304 u32 rx_sram_addr; 1303 u32 rx_sram_addr;
1305 u32 rx_sram_size; 1304 u32 rx_sram_size;
1305 u8 mac_addr[6]; /* mac address if non-zero*/
1306}; 1306};
1307 1307
1308#endif /* __ASM_MV643XX_H */ 1308#endif /* __ASM_MV643XX_H */