diff options
author | Anton Vorontsov <avorontsov@mvista.com> | 2010-04-23 03:12:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-23 19:20:25 -0400 |
commit | 3b1fd3e55a39824e68bc8dd055d14892476e3671 (patch) | |
tree | 787512b50f0fe920c0ce2e0aaef0cc6d85f3128c /drivers | |
parent | fda48a0d7a8412cedacda46a9c0bf8ef9cd13559 (diff) |
fsl_pq_mdio: Fix kernel oops during OF address translation
Old P1020RDB device trees were not specifing tbipa address for
MDIO nodes, which is now causing this kernel oops:
...
eth2: TX BD ring size for Q[6]: 256
eth2: TX BD ring size for Q[7]: 256
Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc0015504
Oops: Kernel access of bad area, sig: 11 [#1]
...
NIP [c0015504] memcpy+0x3c/0x9c
LR [c000a9f8] __of_translate_address+0xfc/0x21c
Call Trace:
[df839e00] [c000a94c] __of_translate_address+0x50/0x21c (unreliable)
[df839e50] [c01a33e8] get_gfar_tbipa+0xb0/0xe0
...
The old device trees are buggy, though having a dead ethernet is
better than a dead kernel, so fix the issue by using of_iomap().
Also, a somewhat similar issue exist in the probe() routine, though
there the oops is only a possibility. Nonetheless, fix it too.
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fsl_pq_mdio.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c index d5160edf2fcf..3acac5f930c8 100644 --- a/drivers/net/fsl_pq_mdio.c +++ b/drivers/net/fsl_pq_mdio.c | |||
@@ -205,8 +205,6 @@ static int fsl_pq_mdio_find_free(struct mii_bus *new_bus) | |||
205 | static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np) | 205 | static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct device_node *np) |
206 | { | 206 | { |
207 | struct gfar __iomem *enet_regs; | 207 | struct gfar __iomem *enet_regs; |
208 | u32 __iomem *ioremap_tbipa; | ||
209 | u64 addr, size; | ||
210 | 208 | ||
211 | /* | 209 | /* |
212 | * This is mildly evil, but so is our hardware for doing this. | 210 | * This is mildly evil, but so is our hardware for doing this. |
@@ -220,9 +218,7 @@ static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs, struct devi | |||
220 | return &enet_regs->tbipa; | 218 | return &enet_regs->tbipa; |
221 | } else if (of_device_is_compatible(np, "fsl,etsec2-mdio") || | 219 | } else if (of_device_is_compatible(np, "fsl,etsec2-mdio") || |
222 | of_device_is_compatible(np, "fsl,etsec2-tbi")) { | 220 | of_device_is_compatible(np, "fsl,etsec2-tbi")) { |
223 | addr = of_translate_address(np, of_get_address(np, 1, &size, NULL)); | 221 | return of_iomap(np, 1); |
224 | ioremap_tbipa = ioremap(addr, size); | ||
225 | return ioremap_tbipa; | ||
226 | } else | 222 | } else |
227 | return NULL; | 223 | return NULL; |
228 | } | 224 | } |
@@ -279,6 +275,7 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
279 | u32 __iomem *tbipa; | 275 | u32 __iomem *tbipa; |
280 | struct mii_bus *new_bus; | 276 | struct mii_bus *new_bus; |
281 | int tbiaddr = -1; | 277 | int tbiaddr = -1; |
278 | const u32 *addrp; | ||
282 | u64 addr = 0, size = 0; | 279 | u64 addr = 0, size = 0; |
283 | int err = 0; | 280 | int err = 0; |
284 | 281 | ||
@@ -297,8 +294,19 @@ static int fsl_pq_mdio_probe(struct of_device *ofdev, | |||
297 | new_bus->priv = priv; | 294 | new_bus->priv = priv; |
298 | fsl_pq_mdio_bus_name(new_bus->id, np); | 295 | fsl_pq_mdio_bus_name(new_bus->id, np); |
299 | 296 | ||
297 | addrp = of_get_address(np, 0, &size, NULL); | ||
298 | if (!addrp) { | ||
299 | err = -EINVAL; | ||
300 | goto err_free_bus; | ||
301 | } | ||
302 | |||
300 | /* Set the PHY base address */ | 303 | /* Set the PHY base address */ |
301 | addr = of_translate_address(np, of_get_address(np, 0, &size, NULL)); | 304 | addr = of_translate_address(np, addrp); |
305 | if (addr == OF_BAD_ADDR) { | ||
306 | err = -EINVAL; | ||
307 | goto err_free_bus; | ||
308 | } | ||
309 | |||
302 | map = ioremap(addr, size); | 310 | map = ioremap(addr, size); |
303 | if (!map) { | 311 | if (!map) { |
304 | err = -ENOMEM; | 312 | err = -ENOMEM; |