From: Ramon Fried <ramon.fried@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: macb: fix mapping of registers
Date: Mon, 17 Dec 2018 03:01:08 +0200 [thread overview]
Message-ID: <20181217010108.15656-1-ramon.fried@gmail.com> (raw)
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
next reply other threads:[~2018-12-17 1:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 1:01 Ramon Fried [this message]
2018-12-17 12:08 ` [U-Boot] [PATCH] net: macb: fix mapping of registers Daniel Schwierzeck
2018-12-17 14:05 ` Ramon Fried
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181217010108.15656-1-ramon.fried@gmail.com \
--to=ramon.fried@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox