* [U-Boot] [PATCH] net: macb: fix mapping of registers
@ 2018-12-17 1:01 Ramon Fried
2018-12-17 12:08 ` Daniel Schwierzeck
0 siblings, 1 reply; 3+ messages in thread
From: Ramon Fried @ 2018-12-17 1:01 UTC (permalink / raw)
To: u-boot
Some architectures (MIPS) needs mapping to access IOMEM.
Fix that.
Fixes: f1dcc19b213d ("net: macb: Convert to driver model")
Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
---
drivers/net/macb.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 94c89c762b..6e1b479813 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -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);
}
--
2.19.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: macb: fix mapping of registers
2018-12-17 1:01 [U-Boot] [PATCH] net: macb: fix mapping of registers Ramon Fried
@ 2018-12-17 12:08 ` Daniel Schwierzeck
2018-12-17 14:05 ` Ramon Fried
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Schwierzeck @ 2018-12-17 12:08 UTC (permalink / raw)
To: u-boot
Am 17.12.18 um 02:01 schrieb Ramon Fried:
> Some architectures (MIPS) needs mapping to access IOMEM.
> Fix that.
>
> Fixes: f1dcc19b213d ("net: macb: Convert to driver model")
>
> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> ---
>
> drivers/net/macb.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 94c89c762b..6e1b479813 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -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);
> }
>
you should use dev_remap_addr() to avoid all the boiler plate code
--
- 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] net: macb: fix mapping of registers
2018-12-17 12:08 ` Daniel Schwierzeck
@ 2018-12-17 14:05 ` Ramon Fried
0 siblings, 0 replies; 3+ messages in thread
From: Ramon Fried @ 2018-12-17 14:05 UTC (permalink / raw)
To: u-boot
On Mon, Dec 17, 2018 at 2:08 PM Daniel Schwierzeck
<daniel.schwierzeck@gmail.com> wrote:
>
>
>
> Am 17.12.18 um 02:01 schrieb Ramon Fried:
> > Some architectures (MIPS) needs mapping to access IOMEM.
> > Fix that.
> >
> > Fixes: f1dcc19b213d ("net: macb: Convert to driver model")
> >
> > Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> > ---
> >
> > drivers/net/macb.c | 12 +++++++++++-
> > 1 file changed, 11 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> > index 94c89c762b..6e1b479813 100644
> > --- a/drivers/net/macb.c
> > +++ b/drivers/net/macb.c
> > @@ -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);
> > }
> >
>
> you should use dev_remap_addr() to avoid all the boiler plate code
>
Will check it out. Thanks
>
> --
> - Daniel
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-17 14:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-17 1:01 [U-Boot] [PATCH] net: macb: fix mapping of registers Ramon Fried
2018-12-17 12:08 ` Daniel Schwierzeck
2018-12-17 14:05 ` Ramon Fried
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox