[U-Boot] [PATCH 4/5] net: sandbox-raw: Convert raw eth driver to livetree

Joe Hershberger joe.hershberger at ni.com
Tue Jun 26 21:19:25 UTC 2018


Signed-off-by: Joe Hershberger <joe.hershberger at ni.com>
---

 drivers/net/sandbox-raw.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 3f8020f629..f835a6a7f3 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -25,17 +25,19 @@ static int sb_eth_raw_start(struct udevice *dev)
 
 	debug("eth_sandbox_raw: Start\n");
 
-	interface = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
-					    "host-raw-interface", NULL);
-	if (interface == NULL)
-		return -EINVAL;
-
-	if (strcmp(interface, "lo") == 0) {
-		priv->local = 1;
-		env_set("ipaddr", "127.0.0.1");
-		env_set("serverip", "127.0.0.1");
+	interface = dev_read_prop(dev, "host-raw-interface", NULL);
+	if (interface) {
+		printf("eth_sandbox_raw: Using %s from DT\n", interface);
+		if (strcmp(interface, "lo") == 0) {
+			priv->local = 1;
+			env_set("ipaddr", "127.0.0.1");
+			env_set("serverip", "127.0.0.1");
+		}
+		return sandbox_eth_raw_os_start(interface, pdata->enetaddr,
+						priv);
 	}
-	return sandbox_eth_raw_os_start(interface, pdata->enetaddr, priv);
+
+	return -EINVAL;
 }
 
 static int sb_eth_raw_send(struct udevice *dev, void *packet, int length)
@@ -144,7 +146,7 @@ static int sb_eth_raw_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 
-	pdata->iobase = devfdt_get_addr(dev);
+	pdata->iobase = dev_read_addr(dev);
 	return 0;
 }
 
-- 
2.11.0



More information about the U-Boot mailing list