net: macb: fix mapping of registers
PATCH 1/1 net: macb: fix mapping of registers
Some architectures (MIPS) needs mapping to access IOMEM. Fix that.
---
drivers/net/macb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/net/macb.c +11 -1
@@ -36,6 +36,7 @@#include <miiphy.h> #include <linux/mii.h> +#include <linux/io.h> #include <asm/io.h> #include <asm/dma-mapping.h> #include <asm/arch/clk.h>
@@ -1149,9 +1150,18 @@ int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev)static int macb_eth_ofdata_to_platdata (struct udevice *dev) { +fdt_addr_t addr; +fdt_size_t size; +int node =dev_of_offset (dev);struct eth_pdata *pdata =dev_get_platdata (dev); - pdata->iobase =devfdt_get_addr (dev); + addr =fdtdec_get_addr_size (gd->fdt_blob, node,"reg" , &size); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + pdata->iobase = (phys_addr_t )ioremap (addr, size); +if (!pdata->iobase) +return -EINVAL ;return macb_late_eth_ofdata_to_platdata (dev); }
Signature · 1 line
2.19.2
PATCH 1/1 net: macb: fix mapping of registers
Am 17.12.18 um 02:01 schrieb Ramon Fried:
Quoted 34 lines
Some architectures (MIPS) needs mapping to access IOMEM. Fix that.
Fixes f1dcc19b213d ("net: macb: Convert to driver model")Signed-off-by Ramon Fried <[email protected]>---
drivers/net/macb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)drivers/net/macb.c +4
-1@@ -36,6 +36,7 @@#include <miiphy.h> #include <linux/mii.h> +#include <linux/io.h> #include <asm/io.h> #include <asm/dma-mapping.h> #include <asm/arch/clk.h> @@ -1149,9 +1150,18 @@ int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev)static int macb_eth_ofdata_to_platdata (struct udevice *dev) { +fdt_addr_t addr; +fdt_size_t size; +int node =dev_of_offset (dev);struct eth_pdata *pdata =dev_get_platdata (dev); - pdata->iobase =devfdt_get_addr (dev);
drivers/net/macb.c int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev) · line 1167
Quoted 10 lines
drivers/net/macb.c +7
-0+ addr =fdtdec_get_addr_size (gd->fdt_blob, node,"reg" , &size); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + pdata->iobase = (phys_addr_t )ioremap (addr, size); +if (!pdata->iobase) +return -EINVAL ;return macb_late_eth_ofdata_to_platdata (dev); }
you should use dev_remap_addr() to avoid all the boiler plate code
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181217/754f924d/attachment.sig>
PATCH 1/1 net: macb: fix mapping of registers
Quoted 45 lines · Daniel Schwierzeck
Am 17.12.18 um 02:01 schrieb Ramon Fried:
Quoted 41 lines
Some architectures (MIPS) needs mapping to access IOMEM. Fix that.
Fixes f1dcc19b213d ("net: macb: Convert to driver model")Signed-off-by Ramon Fried <[email protected]>---
drivers/net/macb.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)drivers/net/macb.c +11
-1@@ -36,6 +36,7 @@#include <miiphy.h> #include <linux/mii.h> +#include <linux/io.h> #include <asm/io.h> #include <asm/dma-mapping.h> #include <asm/arch/clk.h> @@ -1149,9 +1150,18 @@ int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev)static int macb_eth_ofdata_to_platdata (struct udevice *dev) { +fdt_addr_t addr; +fdt_size_t size; +int node =dev_of_offset (dev);struct eth_pdata *pdata =dev_get_platdata (dev); - pdata->iobase =devfdt_get_addr (dev); + addr =fdtdec_get_addr_size (gd->fdt_blob, node,"reg" , &size); +if (addr ==FDT_ADDR_T_NONE ) +return -EINVAL ; + + pdata->iobase = (phys_addr_t )ioremap (addr, size); +if (!pdata->iobase) +return -EINVAL ;
Quoted 6 lines
drivers/net/macb.c int __weak macb_late_eth_ofdata_to_platdata(struct udevice *dev) · line 1167
Quoted 3 lines
drivers/net/macb.c +0
-0return macb_late_eth_ofdata_to_platdata (dev); }you should use
dev_remap_addr()to avoid all the boiler plate code
Will check it out. Thanks
Quoted 4 lines
--
- Daniel