aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/gianfar.c24
-rw-r--r--drivers/net/gianfar.h8
-rw-r--r--drivers/net/gianfar_ethtool.c8
-rw-r--r--drivers/net/gianfar_mii.c17
4 files changed, 27 insertions, 30 deletions
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0c18dbd67d3b..0e8e3fcde9ff 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -199,8 +199,7 @@ static int gfar_probe(struct platform_device *pdev)
199 199
200 /* get a pointer to the register memory */ 200 /* get a pointer to the register memory */
201 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 201 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
202 priv->regs = (struct gfar *) 202 priv->regs = ioremap(r->start, sizeof (struct gfar));
203 ioremap(r->start, sizeof (struct gfar));
204 203
205 if (NULL == priv->regs) { 204 if (NULL == priv->regs) {
206 err = -ENOMEM; 205 err = -ENOMEM;
@@ -369,7 +368,7 @@ static int gfar_probe(struct platform_device *pdev)
369 return 0; 368 return 0;
370 369
371register_fail: 370register_fail:
372 iounmap((void *) priv->regs); 371 iounmap(priv->regs);
373regs_fail: 372regs_fail:
374 free_netdev(dev); 373 free_netdev(dev);
375 return err; 374 return err;
@@ -382,7 +381,7 @@ static int gfar_remove(struct platform_device *pdev)
382 381
383 platform_set_drvdata(pdev, NULL); 382 platform_set_drvdata(pdev, NULL);
384 383
385 iounmap((void *) priv->regs); 384 iounmap(priv->regs);
386 free_netdev(dev); 385 free_netdev(dev);
387 386
388 return 0; 387 return 0;
@@ -454,8 +453,7 @@ static void init_registers(struct net_device *dev)
454 453
455 /* Zero out the rmon mib registers if it has them */ 454 /* Zero out the rmon mib registers if it has them */
456 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { 455 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
457 memset((void *) &(priv->regs->rmon), 0, 456 memset_io(&(priv->regs->rmon), 0, sizeof (struct rmon_mib));
458 sizeof (struct rmon_mib));
459 457
460 /* Mask off the CAM interrupts */ 458 /* Mask off the CAM interrupts */
461 gfar_write(&priv->regs->rmon.cam1, 0xffffffff); 459 gfar_write(&priv->regs->rmon.cam1, 0xffffffff);
@@ -477,7 +475,7 @@ static void init_registers(struct net_device *dev)
477void gfar_halt(struct net_device *dev) 475void gfar_halt(struct net_device *dev)
478{ 476{
479 struct gfar_private *priv = netdev_priv(dev); 477 struct gfar_private *priv = netdev_priv(dev);
480 struct gfar *regs = priv->regs; 478 struct gfar __iomem *regs = priv->regs;
481 u32 tempval; 479 u32 tempval;
482 480
483 /* Mask all interrupts */ 481 /* Mask all interrupts */
@@ -507,7 +505,7 @@ void gfar_halt(struct net_device *dev)
507void stop_gfar(struct net_device *dev) 505void stop_gfar(struct net_device *dev)
508{ 506{
509 struct gfar_private *priv = netdev_priv(dev); 507 struct gfar_private *priv = netdev_priv(dev);
510 struct gfar *regs = priv->regs; 508 struct gfar __iomem *regs = priv->regs;
511 unsigned long flags; 509 unsigned long flags;
512 510
513 phy_stop(priv->phydev); 511 phy_stop(priv->phydev);
@@ -590,7 +588,7 @@ static void free_skb_resources(struct gfar_private *priv)
590void gfar_start(struct net_device *dev) 588void gfar_start(struct net_device *dev)
591{ 589{
592 struct gfar_private *priv = netdev_priv(dev); 590 struct gfar_private *priv = netdev_priv(dev);
593 struct gfar *regs = priv->regs; 591 struct gfar __iomem *regs = priv->regs;
594 u32 tempval; 592 u32 tempval;
595 593
596 /* Enable Rx and Tx in MACCFG1 */ 594 /* Enable Rx and Tx in MACCFG1 */
@@ -624,7 +622,7 @@ int startup_gfar(struct net_device *dev)
624 unsigned long vaddr; 622 unsigned long vaddr;
625 int i; 623 int i;
626 struct gfar_private *priv = netdev_priv(dev); 624 struct gfar_private *priv = netdev_priv(dev);
627 struct gfar *regs = priv->regs; 625 struct gfar __iomem *regs = priv->regs;
628 int err = 0; 626 int err = 0;
629 u32 rctrl = 0; 627 u32 rctrl = 0;
630 u32 attrs = 0; 628 u32 attrs = 0;
@@ -1622,7 +1620,7 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1622static void adjust_link(struct net_device *dev) 1620static void adjust_link(struct net_device *dev)
1623{ 1621{
1624 struct gfar_private *priv = netdev_priv(dev); 1622 struct gfar_private *priv = netdev_priv(dev);
1625 struct gfar *regs = priv->regs; 1623 struct gfar __iomem *regs = priv->regs;
1626 unsigned long flags; 1624 unsigned long flags;
1627 struct phy_device *phydev = priv->phydev; 1625 struct phy_device *phydev = priv->phydev;
1628 int new_state = 0; 1626 int new_state = 0;
@@ -1703,7 +1701,7 @@ static void gfar_set_multi(struct net_device *dev)
1703{ 1701{
1704 struct dev_mc_list *mc_ptr; 1702 struct dev_mc_list *mc_ptr;
1705 struct gfar_private *priv = netdev_priv(dev); 1703 struct gfar_private *priv = netdev_priv(dev);
1706 struct gfar *regs = priv->regs; 1704 struct gfar __iomem *regs = priv->regs;
1707 u32 tempval; 1705 u32 tempval;
1708 1706
1709 if(dev->flags & IFF_PROMISC) { 1707 if(dev->flags & IFF_PROMISC) {
@@ -1842,7 +1840,7 @@ static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr)
1842 int idx; 1840 int idx;
1843 char tmpbuf[MAC_ADDR_LEN]; 1841 char tmpbuf[MAC_ADDR_LEN];
1844 u32 tempval; 1842 u32 tempval;
1845 u32 *macptr = &priv->regs->macstnaddr1; 1843 u32 __iomem *macptr = &priv->regs->macstnaddr1;
1846 1844
1847 macptr += num*2; 1845 macptr += num*2;
1848 1846
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index cb9d66ac3ab9..d37d5401be6e 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -682,8 +682,8 @@ struct gfar_private {
682 struct rxbd8 *cur_rx; /* Next free rx ring entry */ 682 struct rxbd8 *cur_rx; /* Next free rx ring entry */
683 struct txbd8 *cur_tx; /* Next free ring entry */ 683 struct txbd8 *cur_tx; /* Next free ring entry */
684 struct txbd8 *dirty_tx; /* The Ring entry to be freed. */ 684 struct txbd8 *dirty_tx; /* The Ring entry to be freed. */
685 struct gfar *regs; /* Pointer to the GFAR memory mapped Registers */ 685 struct gfar __iomem *regs; /* Pointer to the GFAR memory mapped Registers */
686 u32 *hash_regs[16]; 686 u32 __iomem *hash_regs[16];
687 int hash_width; 687 int hash_width;
688 struct net_device_stats stats; /* linux network statistics */ 688 struct net_device_stats stats; /* linux network statistics */
689 struct gfar_extra_stats extra_stats; 689 struct gfar_extra_stats extra_stats;
@@ -718,14 +718,14 @@ struct gfar_private {
718 uint32_t msg_enable; 718 uint32_t msg_enable;
719}; 719};
720 720
721static inline u32 gfar_read(volatile unsigned *addr) 721static inline u32 gfar_read(volatile unsigned __iomem *addr)
722{ 722{
723 u32 val; 723 u32 val;
724 val = in_be32(addr); 724 val = in_be32(addr);
725 return val; 725 return val;
726} 726}
727 727
728static inline void gfar_write(volatile unsigned *addr, u32 val) 728static inline void gfar_write(volatile unsigned __iomem *addr, u32 val)
729{ 729{
730 out_be32(addr, val); 730 out_be32(addr, val);
731} 731}
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 765e810620fe..5de7b2e259dc 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -144,11 +144,11 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
144 u64 *extra = (u64 *) & priv->extra_stats; 144 u64 *extra = (u64 *) & priv->extra_stats;
145 145
146 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) { 146 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) {
147 u32 *rmon = (u32 *) & priv->regs->rmon; 147 u32 __iomem *rmon = (u32 __iomem *) & priv->regs->rmon;
148 struct gfar_stats *stats = (struct gfar_stats *) buf; 148 struct gfar_stats *stats = (struct gfar_stats *) buf;
149 149
150 for (i = 0; i < GFAR_RMON_LEN; i++) 150 for (i = 0; i < GFAR_RMON_LEN; i++)
151 stats->rmon[i] = (u64) (rmon[i]); 151 stats->rmon[i] = (u64) gfar_read(&rmon[i]);
152 152
153 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) 153 for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++)
154 stats->extra[i] = extra[i]; 154 stats->extra[i] = extra[i];
@@ -221,11 +221,11 @@ static void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, voi
221{ 221{
222 int i; 222 int i;
223 struct gfar_private *priv = netdev_priv(dev); 223 struct gfar_private *priv = netdev_priv(dev);
224 u32 *theregs = (u32 *) priv->regs; 224 u32 __iomem *theregs = (u32 __iomem *) priv->regs;
225 u32 *buf = (u32 *) regbuf; 225 u32 *buf = (u32 *) regbuf;
226 226
227 for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++) 227 for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
228 buf[i] = theregs[i]; 228 buf[i] = gfar_read(&theregs[i]);
229} 229}
230 230
231/* Convert microseconds to ethernet clock ticks, which changes 231/* Convert microseconds to ethernet clock ticks, which changes
diff --git a/drivers/net/gianfar_mii.c b/drivers/net/gianfar_mii.c
index 74e52fcbf806..c6b725529af5 100644
--- a/drivers/net/gianfar_mii.c
+++ b/drivers/net/gianfar_mii.c
@@ -50,7 +50,7 @@
50 * All PHY configuration is done through the TSEC1 MIIM regs */ 50 * All PHY configuration is done through the TSEC1 MIIM regs */
51int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value) 51int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
52{ 52{
53 struct gfar_mii *regs = bus->priv; 53 struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
54 54
55 /* Set the PHY address and the register address we want to write */ 55 /* Set the PHY address and the register address we want to write */
56 gfar_write(&regs->miimadd, (mii_id << 8) | regnum); 56 gfar_write(&regs->miimadd, (mii_id << 8) | regnum);
@@ -70,7 +70,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
70 * configuration has to be done through the TSEC1 MIIM regs */ 70 * configuration has to be done through the TSEC1 MIIM regs */
71int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum) 71int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
72{ 72{
73 struct gfar_mii *regs = bus->priv; 73 struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
74 u16 value; 74 u16 value;
75 75
76 /* Set the PHY address and the register address we want to read */ 76 /* Set the PHY address and the register address we want to read */
@@ -94,7 +94,7 @@ int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
94/* Reset the MIIM registers, and wait for the bus to free */ 94/* Reset the MIIM registers, and wait for the bus to free */
95int gfar_mdio_reset(struct mii_bus *bus) 95int gfar_mdio_reset(struct mii_bus *bus)
96{ 96{
97 struct gfar_mii *regs = bus->priv; 97 struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
98 unsigned int timeout = PHY_INIT_TIMEOUT; 98 unsigned int timeout = PHY_INIT_TIMEOUT;
99 99
100 spin_lock_bh(&bus->mdio_lock); 100 spin_lock_bh(&bus->mdio_lock);
@@ -126,7 +126,7 @@ int gfar_mdio_probe(struct device *dev)
126{ 126{
127 struct platform_device *pdev = to_platform_device(dev); 127 struct platform_device *pdev = to_platform_device(dev);
128 struct gianfar_mdio_data *pdata; 128 struct gianfar_mdio_data *pdata;
129 struct gfar_mii *regs; 129 struct gfar_mii __iomem *regs;
130 struct mii_bus *new_bus; 130 struct mii_bus *new_bus;
131 struct resource *r; 131 struct resource *r;
132 int err = 0; 132 int err = 0;
@@ -155,15 +155,14 @@ int gfar_mdio_probe(struct device *dev)
155 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 155 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
156 156
157 /* Set the PHY base address */ 157 /* Set the PHY base address */
158 regs = (struct gfar_mii *) ioremap(r->start, 158 regs = ioremap(r->start, sizeof (struct gfar_mii));
159 sizeof (struct gfar_mii));
160 159
161 if (NULL == regs) { 160 if (NULL == regs) {
162 err = -ENOMEM; 161 err = -ENOMEM;
163 goto reg_map_fail; 162 goto reg_map_fail;
164 } 163 }
165 164
166 new_bus->priv = regs; 165 new_bus->priv = (void __force *)regs;
167 166
168 new_bus->irq = pdata->irq; 167 new_bus->irq = pdata->irq;
169 168
@@ -181,7 +180,7 @@ int gfar_mdio_probe(struct device *dev)
181 return 0; 180 return 0;
182 181
183bus_register_fail: 182bus_register_fail:
184 iounmap((void *) regs); 183 iounmap(regs);
185reg_map_fail: 184reg_map_fail:
186 kfree(new_bus); 185 kfree(new_bus);
187 186
@@ -197,7 +196,7 @@ int gfar_mdio_remove(struct device *dev)
197 196
198 dev_set_drvdata(dev, NULL); 197 dev_set_drvdata(dev, NULL);
199 198
200 iounmap((void *) (&bus->priv)); 199 iounmap((void __iomem *)bus->priv);
201 bus->priv = NULL; 200 bus->priv = NULL;
202 kfree(bus); 201 kfree(bus);
203 202