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