diff mbox series

[U-Boot,v3,05/19] net: designware: Convert to livetree

Message ID 1505160270-10650-6-git-send-email-philipp.tomsich@theobroma-systems.com
State Accepted
Delegated to: Philipp Tomsich
Headers show
Series rockchip: convert the RK3368 to OF_LIVE and validate on the RK3368-uQ7 | expand

Commit Message

Philipp Tomsich Sept. 11, 2017, 8:04 p.m. UTC
Update the Designware Ethernet MAC driver to support a live device
tree.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>

---

Changes in v3:
- added Joe's Acked-by: tag (which I had lost)

Changes in v2: None

 drivers/net/designware.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Philipp Tomsich Sept. 12, 2017, 10:54 a.m. UTC | #1
> Update the Designware Ethernet MAC driver to support a live device
> tree.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
> 
> Changes in v3:
> - added Joe's Acked-by: tag (which I had lost)
> 
> Changes in v2: None
> 
>  drivers/net/designware.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 

Applied to u-boot-rockchip, thanks!
diff mbox series

Patch

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 521e4dd..036d231 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -737,16 +737,14 @@  int designware_eth_ofdata_to_platdata(struct udevice *dev)
 #endif
 	struct eth_pdata *pdata = &dw_pdata->eth_pdata;
 	const char *phy_mode;
-	const fdt32_t *cell;
 #ifdef CONFIG_DM_GPIO
 	int reset_flags = GPIOD_IS_OUT;
 #endif
 	int ret = 0;
 
-	pdata->iobase = devfdt_get_addr(dev);
+	pdata->iobase = dev_read_addr(dev);
 	pdata->phy_interface = -1;
-	phy_mode = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "phy-mode",
-			       NULL);
+	phy_mode = dev_read_string(dev, "phy-mode");
 	if (phy_mode)
 		pdata->phy_interface = phy_get_interface_by_name(phy_mode);
 	if (pdata->phy_interface == -1) {
@@ -754,10 +752,7 @@  int designware_eth_ofdata_to_platdata(struct udevice *dev)
 		return -EINVAL;
 	}
 
-	pdata->max_speed = 0;
-	cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "max-speed", NULL);
-	if (cell)
-		pdata->max_speed = fdt32_to_cpu(*cell);
+	pdata->max_speed = dev_read_u32_default(dev, "max-speed", 0);
 
 #ifdef CONFIG_DM_GPIO
 	if (dev_read_bool(dev, "snps,reset-active-low"))