[U-Boot] [PATCH 5/7] rockchip: net: dm: convert fdt_get to dev_read

Philipp Tomsich philipp.tomsich at theobroma-systems.com
Wed Jun 7 16:46:01 UTC 2017


With the new dev_read functions available, we can convert the rockchip
architecture-specific drivers and common drivers used by these devices
over to the dev_read family of calls.

This covers the Gigabit Ethernet MAC (i.e. common designware driver and
rockchip-specific wrapper).

Signed-off-by: Philipp Tomsich <philipp.tomsich at theobroma-systems.com>
---

 drivers/net/designware.c    |  7 +++----
 drivers/net/gmac_rockchip.c | 10 ++++------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index e8569e6..521e4dd 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -760,15 +760,14 @@ int designware_eth_ofdata_to_platdata(struct udevice *dev)
 		pdata->max_speed = fdt32_to_cpu(*cell);
 
 #ifdef CONFIG_DM_GPIO
-	if (fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-			    "snps,reset-active-low"))
+	if (dev_read_bool(dev, "snps,reset-active-low"))
 		reset_flags |= GPIOD_ACTIVE_LOW;
 
 	ret = gpio_request_by_name(dev, "snps,reset-gpio", 0,
 		&priv->reset_gpio, reset_flags);
 	if (ret == 0) {
-		ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev),
-			"snps,reset-delays-us", dw_pdata->reset_delays, 3);
+		ret = dev_read_u32_array(dev, "snps,reset-delays-us",
+					 dw_pdata->reset_delays, 3);
 	} else if (ret == -ENOENT) {
 		ret = 0;
 	}
diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
index 5e2ca76..c9f9e83 100644
--- a/drivers/net/gmac_rockchip.c
+++ b/drivers/net/gmac_rockchip.c
@@ -43,18 +43,16 @@ struct rk_gmac_ops {
 static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev)
 {
 	struct gmac_rockchip_platdata *pdata = dev_get_platdata(dev);
-	const void *blob = gd->fdt_blob;
-	int node = dev_of_offset(dev);
 
 	/* Check the new naming-style first... */
-	pdata->tx_delay = fdtdec_get_int(blob, node, "tx_delay", -ENOENT);
-	pdata->rx_delay = fdtdec_get_int(blob, node, "rx_delay", -ENOENT);
+	pdata->tx_delay = dev_read_u32_default(dev, "tx_delay", -ENOENT);
+	pdata->rx_delay = dev_read_u32_default(dev, "rx_delay", -ENOENT);
 
 	/* ... and fall back to the old naming style or default, if necessary */
 	if (pdata->tx_delay == -ENOENT)
-		pdata->tx_delay = fdtdec_get_int(blob, node, "tx-delay", 0x30);
+		pdata->tx_delay = dev_read_u32_default(dev, "tx-delay", 0x30);
 	if (pdata->rx_delay == -ENOENT)
-		pdata->rx_delay = fdtdec_get_int(blob, node, "rx-delay", 0x10);
+		pdata->rx_delay = dev_read_u32_default(dev, "rx-delay", 0x10);
 
 	return designware_eth_ofdata_to_platdata(dev);
 }
-- 
2.1.4



More information about the U-Boot mailing list