aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mv643xx_eth.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2007-10-18 22:11:17 -0400
committerDale Farnsworth <dale@farnsworth.org>2007-10-23 11:23:05 -0400
commitf9fbbc18dfcdc6156306f475de8b0bb96f97cd0d (patch)
tree88008c5b2e62efe97451e8c569cde477c183b104 /drivers/net/mv643xx_eth.c
parent9c1bbdfe6f70eb9132829caa9341a0294c2aee5d (diff)
mv643xx_eth: Remove SHARED_REGS register address bias
Start counting mv643xx_eth register addresses from zero, instead of from 0x2000 (MV643XX_ETH_SHARED_REGS.) Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Acked-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r--drivers/net/mv643xx_eth.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 98dd9050042..98b30e52f07 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -78,26 +78,19 @@ static const struct ethtool_ops mv643xx_ethtool_ops;
78static char mv643xx_driver_name[] = "mv643xx_eth"; 78static char mv643xx_driver_name[] = "mv643xx_eth";
79static char mv643xx_driver_version[] = "1.0"; 79static char mv643xx_driver_version[] = "1.0";
80 80
81static void __iomem *mv643xx_eth_shared_base; 81static void __iomem *mv643xx_eth_base;
82 82
83/* used to protect MV643XX_ETH_SMI_REG, which is shared across ports */ 83/* used to protect MV643XX_ETH_SMI_REG, which is shared across ports */
84static DEFINE_SPINLOCK(mv643xx_eth_phy_lock); 84static DEFINE_SPINLOCK(mv643xx_eth_phy_lock);
85 85
86static inline u32 mv_read(int offset) 86static inline u32 mv_read(int offset)
87{ 87{
88 void __iomem *reg_base; 88 return readl(mv643xx_eth_base + offset);
89
90 reg_base = mv643xx_eth_shared_base - MV643XX_ETH_SHARED_REGS;
91
92 return readl(reg_base + offset);
93} 89}
94 90
95static inline void mv_write(int offset, u32 data) 91static inline void mv_write(int offset, u32 data)
96{ 92{
97 void __iomem *reg_base; 93 writel(data, mv643xx_eth_base + offset);
98
99 reg_base = mv643xx_eth_shared_base - MV643XX_ETH_SHARED_REGS;
100 writel(data, reg_base + offset);
101} 94}
102 95
103/* 96/*
@@ -1470,9 +1463,8 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
1470 if (res == NULL) 1463 if (res == NULL)
1471 return -ENODEV; 1464 return -ENODEV;
1472 1465
1473 mv643xx_eth_shared_base = ioremap(res->start, 1466 mv643xx_eth_base = ioremap(res->start, res->end - res->start + 1);
1474 MV643XX_ETH_SHARED_REGS_SIZE); 1467 if (mv643xx_eth_base == NULL)
1475 if (mv643xx_eth_shared_base == NULL)
1476 return -ENOMEM; 1468 return -ENOMEM;
1477 1469
1478 return 0; 1470 return 0;
@@ -1481,8 +1473,8 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
1481 1473
1482static int mv643xx_eth_shared_remove(struct platform_device *pdev) 1474static int mv643xx_eth_shared_remove(struct platform_device *pdev)
1483{ 1475{
1484 iounmap(mv643xx_eth_shared_base); 1476 iounmap(mv643xx_eth_base);
1485 mv643xx_eth_shared_base = NULL; 1477 mv643xx_eth_base = NULL;
1486 1478
1487 return 0; 1479 return 0;
1488} 1480}