aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mv643xx_eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r--drivers/net/mv643xx_eth.c19
1 files changed, 11 insertions, 8 deletions
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);