diff mbox series

[U-Boot,v2] net: macb: fix mapping of registers

Message ID 20181218204903.7211-1-ramon.fried@gmail.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series [U-Boot,v2] net: macb: fix mapping of registers | expand

Commit Message

Ramon Fried Dec. 18, 2018, 8:49 p.m. UTC
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>
---
v2: switched to use dev_reamp_addr() to reduce boilerplate code.
    (as suggested by Daniel Schwierzeck)


 drivers/net/macb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Daniel Schwierzeck Dec. 19, 2018, 3:19 p.m. UTC | #1
Am 18.12.18 um 21:49 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>
> ---
> v2: switched to use dev_reamp_addr() to reduce boilerplate code.
>     (as suggested by Daniel Schwierzeck)
> 
> 
>  drivers/net/macb.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Tom Rini Dec. 27, 2018, 2:35 a.m. UTC | #2
On Tue, Dec 18, 2018 at 10:49:03PM +0200, Ramon Fried wrote:

> 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>
> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> ---
> v2: switched to use dev_reamp_addr() to reduce boilerplate code.
>     (as suggested by Daniel Schwierzeck)

On many platforms:
       arm:  w+   sama5d36ek_cmp_nandflash
+(sama5d36ek_cmp_nandflash)   pdata->iobase = dev_remap_addr(dev);
+(sama5d36ek_cmp_nandflash)                 ^
w+(sama5d36ek_cmp_nandflash) drivers/net/macb.c: In function 'macb_eth_ofdata_to_platdata':
w+(sama5d36ek_cmp_nandflash) drivers/net/macb.c:1154:16: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
Ramon Fried Dec. 27, 2018, 10:08 a.m. UTC | #3
On Thu, Dec 27, 2018 at 4:35 AM Tom Rini <trini@konsulko.com> wrote:
>
> On Tue, Dec 18, 2018 at 10:49:03PM +0200, Ramon Fried wrote:
>
> > 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>
> > Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
> > ---
> > v2: switched to use dev_reamp_addr() to reduce boilerplate code.
> >     (as suggested by Daniel Schwierzeck)
>
> On many platforms:
>        arm:  w+   sama5d36ek_cmp_nandflash
> +(sama5d36ek_cmp_nandflash)   pdata->iobase = dev_remap_addr(dev);
> +(sama5d36ek_cmp_nandflash)                 ^
> w+(sama5d36ek_cmp_nandflash) drivers/net/macb.c: In function 'macb_eth_ofdata_to_platdata':
> w+(sama5d36ek_cmp_nandflash) drivers/net/macb.c:1154:16: warning: assignment makes integer from pointer without a cast [-Wint-conversion]
>
> --
> Tom
Thanks Tom,
I'll look into it.
diff mbox series

Patch

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 94c89c762b..ede1277901 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1151,7 +1151,9 @@  static int macb_eth_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 
-	pdata->iobase = devfdt_get_addr(dev);
+	pdata->iobase = dev_remap_addr(dev);
+	if (!pdata->iobase)
+		return -EINVAL;
 
 	return macb_late_eth_ofdata_to_platdata(dev);
 }