aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-mv78xx0/common.c6
-rw-r--r--drivers/net/mv643xx_eth.c19
-rw-r--r--include/linux/mv643xx_eth.h2
3 files changed, 15 insertions, 12 deletions
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 953a26c469cb..5842d3bb02b2 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -330,6 +330,7 @@ void __init mv78xx0_ge00_init(struct mv643xx_eth_platform_data *eth_data)
330struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = { 330struct mv643xx_eth_shared_platform_data mv78xx0_ge01_shared_data = {
331 .t_clk = 0, 331 .t_clk = 0,
332 .dram = &mv78xx0_mbus_dram_info, 332 .dram = &mv78xx0_mbus_dram_info,
333 .shared_smi = &mv78xx0_ge00_shared,
333}; 334};
334 335
335static struct resource mv78xx0_ge01_shared_resources[] = { 336static struct resource mv78xx0_ge01_shared_resources[] = {
@@ -370,7 +371,6 @@ static struct platform_device mv78xx0_ge01 = {
370void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data) 371void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
371{ 372{
372 eth_data->shared = &mv78xx0_ge01_shared; 373 eth_data->shared = &mv78xx0_ge01_shared;
373 eth_data->shared_smi = &mv78xx0_ge00_shared;
374 mv78xx0_ge01.dev.platform_data = eth_data; 374 mv78xx0_ge01.dev.platform_data = eth_data;
375 375
376 platform_device_register(&mv78xx0_ge01_shared); 376 platform_device_register(&mv78xx0_ge01_shared);
@@ -384,6 +384,7 @@ void __init mv78xx0_ge01_init(struct mv643xx_eth_platform_data *eth_data)
384struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = { 384struct mv643xx_eth_shared_platform_data mv78xx0_ge10_shared_data = {
385 .t_clk = 0, 385 .t_clk = 0,
386 .dram = &mv78xx0_mbus_dram_info, 386 .dram = &mv78xx0_mbus_dram_info,
387 .shared_smi = &mv78xx0_ge00_shared,
387}; 388};
388 389
389static struct resource mv78xx0_ge10_shared_resources[] = { 390static struct resource mv78xx0_ge10_shared_resources[] = {
@@ -424,7 +425,6 @@ static struct platform_device mv78xx0_ge10 = {
424void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) 425void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
425{ 426{
426 eth_data->shared = &mv78xx0_ge10_shared; 427 eth_data->shared = &mv78xx0_ge10_shared;
427 eth_data->shared_smi = &mv78xx0_ge00_shared;
428 mv78xx0_ge10.dev.platform_data = eth_data; 428 mv78xx0_ge10.dev.platform_data = eth_data;
429 429
430 platform_device_register(&mv78xx0_ge10_shared); 430 platform_device_register(&mv78xx0_ge10_shared);
@@ -438,6 +438,7 @@ void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
438struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = { 438struct mv643xx_eth_shared_platform_data mv78xx0_ge11_shared_data = {
439 .t_clk = 0, 439 .t_clk = 0,
440 .dram = &mv78xx0_mbus_dram_info, 440 .dram = &mv78xx0_mbus_dram_info,
441 .shared_smi = &mv78xx0_ge00_shared,
441}; 442};
442 443
443static struct resource mv78xx0_ge11_shared_resources[] = { 444static struct resource mv78xx0_ge11_shared_resources[] = {
@@ -478,7 +479,6 @@ static struct platform_device mv78xx0_ge11 = {
478void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) 479void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
479{ 480{
480 eth_data->shared = &mv78xx0_ge11_shared; 481 eth_data->shared = &mv78xx0_ge11_shared;
481 eth_data->shared_smi = &mv78xx0_ge00_shared;
482 mv78xx0_ge11.dev.platform_data = eth_data; 482 mv78xx0_ge11.dev.platform_data = eth_data;
483 483
484 platform_device_register(&mv78xx0_ge11_shared); 484 platform_device_register(&mv78xx0_ge11_shared);
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index c41541d8710f..6d3da78b7ad5 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -248,6 +248,11 @@ struct mv643xx_eth_shared_private {
248 void __iomem *base; 248 void __iomem *base;
249 249
250 /* 250 /*
251 * Points at the right SMI instance to use.
252 */
253 struct mv643xx_eth_shared_private *smi;
254
255 /*
251 * Protects access to SMI_REG, which is shared between ports. 256 * Protects access to SMI_REG, which is shared between ports.
252 */ 257 */
253 struct mutex phy_lock; 258 struct mutex phy_lock;
@@ -345,7 +350,6 @@ struct mv643xx_eth_private {
345 350
346 struct net_device *dev; 351 struct net_device *dev;
347 352
348 struct mv643xx_eth_shared_private *shared_smi;
349 int phy_addr; 353 int phy_addr;
350 354
351 spinlock_t lock; 355 spinlock_t lock;
@@ -1015,7 +1019,7 @@ static int smi_wait_ready(struct mv643xx_eth_shared_private *msp)
1015static int smi_reg_read(struct mv643xx_eth_private *mp, 1019static int smi_reg_read(struct mv643xx_eth_private *mp,
1016 unsigned int addr, unsigned int reg) 1020 unsigned int addr, unsigned int reg)
1017{ 1021{
1018 struct mv643xx_eth_shared_private *msp = mp->shared_smi; 1022 struct mv643xx_eth_shared_private *msp = mp->shared->smi;
1019 void __iomem *smi_reg = msp->base + SMI_REG; 1023 void __iomem *smi_reg = msp->base + SMI_REG;
1020 int ret; 1024 int ret;
1021 1025
@@ -1053,7 +1057,7 @@ out:
1053static int smi_reg_write(struct mv643xx_eth_private *mp, unsigned int addr, 1057static int smi_reg_write(struct mv643xx_eth_private *mp, unsigned int addr,
1054 unsigned int reg, unsigned int value) 1058 unsigned int reg, unsigned int value)
1055{ 1059{
1056 struct mv643xx_eth_shared_private *msp = mp->shared_smi; 1060 struct mv643xx_eth_shared_private *msp = mp->shared->smi;
1057 void __iomem *smi_reg = msp->base + SMI_REG; 1061 void __iomem *smi_reg = msp->base + SMI_REG;
1058 1062
1059 mutex_lock(&msp->phy_lock); 1063 mutex_lock(&msp->phy_lock);
@@ -2311,6 +2315,10 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
2311 if (msp->base == NULL) 2315 if (msp->base == NULL)
2312 goto out_free; 2316 goto out_free;
2313 2317
2318 msp->smi = msp;
2319 if (pd != NULL && pd->shared_smi != NULL)
2320 msp->smi = platform_get_drvdata(pd->shared_smi);
2321
2314 mutex_init(&msp->phy_lock); 2322 mutex_init(&msp->phy_lock);
2315 2323
2316 msp->err_interrupt = NO_IRQ; 2324 msp->err_interrupt = NO_IRQ;
@@ -2405,13 +2413,8 @@ static void set_params(struct mv643xx_eth_private *mp,
2405 uc_addr_get(mp, dev->dev_addr); 2413 uc_addr_get(mp, dev->dev_addr);
2406 2414
2407 if (pd->phy_addr == -1) { 2415 if (pd->phy_addr == -1) {
2408 mp->shared_smi = NULL;
2409 mp->phy_addr = -1; 2416 mp->phy_addr = -1;
2410 } else { 2417 } else {
2411 mp->shared_smi = mp->shared;
2412 if (pd->shared_smi != NULL)
2413 mp->shared_smi = platform_get_drvdata(pd->shared_smi);
2414
2415 if (pd->force_phy_addr || pd->phy_addr) { 2418 if (pd->force_phy_addr || pd->phy_addr) {
2416 mp->phy_addr = pd->phy_addr & 0x3f; 2419 mp->phy_addr = pd->phy_addr & 0x3f;
2417 phy_addr_set(mp, mp->phy_addr); 2420 phy_addr_set(mp, mp->phy_addr);
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index eb78b00edcde..12339eb65704 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -17,6 +17,7 @@
17 17
18struct mv643xx_eth_shared_platform_data { 18struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi;
20 unsigned int t_clk; 21 unsigned int t_clk;
21}; 22};
22 23
@@ -30,7 +31,6 @@ struct mv643xx_eth_platform_data {
30 /* 31 /*
31 * Whether a PHY is present, and if yes, at which address. 32 * Whether a PHY is present, and if yes, at which address.
32 */ 33 */
33 struct platform_device *shared_smi;
34 int force_phy_addr; 34 int force_phy_addr;
35 int phy_addr; 35 int phy_addr;
36 36