Skip to contentSkip to conversation

net: phy: ti: Modify to support livetree

PATCH New Siva Durga Prasad Paladugu 5 participants 12 messages Jul 6, 2018 – Jul 16, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 net: phy: ti: Modify to support livetree

This patch adds support for livetree by using
dev_.. calls instead of fdtdec_..

---
 drivers/net/phy/ti.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/phy/ti.c +7 -9
index 8f3ed8a..945d9e9 100644
@@ -173,24 +173,22 @@ static int dp83867_of_init(struct phy_device *phydev)
 {
 	struct dp83867_private *dp83867 = phydev->priv;
 	struct udevice *dev = phydev->dev;
-	int node = dev_of_offset(dev);
 	const void *fdt = gd->fdt_blob;
 
-	if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))
+	if (dev_read_bool(dev, "ti,max-output-impedance"))
 		dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
-	else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+	else if (dev_read_bool(dev, "ti,min-output-impedance"))
 		dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;
 	else
 		dp83867->io_impedance = -EINVAL;
 
-	dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-				 "ti,rx-internal-delay", -1);
+	dp83867->rx_id_delay = dev_read_u32_default(dev, "ti,rx-internal-delay",
+						    -1);
 
-	dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-				 "ti,tx-internal-delay", -1);
+	dp83867->tx_id_delay = dev_read_u32_default(dev, "ti,tx-internal-delay",
+						    -1);
 
-	dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-				 "ti,fifo-depth", -1);
+	dp83867->fifo_depth = dev_read_u32_default(dev, "ti,fifo-depth", -1);
 
 	return 0;
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/3 net: phy: xilinx_phy: Add suuport for livetree

This patch adds support for livetree by using dev_.. calls instead of fdtdec_.. .

---
 drivers/net/phy/xilinx_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/xilinx_phy.c +2 -2
index 004cfcf..2e2a5cd 100644
@@ -103,8 +103,8 @@ static int xilinxphy_of_init(struct phy_device *phydev)
 	u32 phytype;
 
 	debug("%s\n", __func__);
-	phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
-				 "xlnx,phy-type", -1);
+	phytype = dev_read_u32_default(phydev->dev,
+				       "xlnx,phy-type", -1);
 	if (phytype == XAE_PHY_TYPE_1000BASE_X)
 		phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 net: phy: xilinx_phy: Add suuport for livetree

Quoted 3 lines · Siva Durga Prasad Paladugu

This patch adds support for livetree by using dev_.. calls instead of fdtdec_.. .

typo in subject.

M

Quoted 21 lines
---
 drivers/net/phy/xilinx_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/xilinx_phy.c +2 -2
index 004cfcf..2e2a5cd 100644
@@ -103,8 +103,8 @@ static int xilinxphy_of_init(struct phy_device *phydev)
 	u32 phytype;
 
 	debug("%s\n", __func__);
-	phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
-				 "xlnx,phy-type", -1);
+	phytype = dev_read_u32_default(phydev->dev,
+				       "xlnx,phy-type", -1);
 	if (phytype == XAE_PHY_TYPE_1000BASE_X)
 		phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
 
#3 lore raw

PATCH 2/3 net: phy: xilinx_phy: Add suuport for livetree

In reply to Siva Durga Prasad Paladugu
Quoted 14 lines · Siva Durga Prasad Paladugu

This patch adds support for livetree by using dev_.. calls instead of fdtdec_.. .

---
  drivers/net/phy/xilinx_phy.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/phy/xilinx_phy.c +0 -0
index 004cfcf..2e2a5cd 100644

drivers/net/phy/xilinx_phy.c static int xilinxphy_of_init(struct phy_device *phydev) · line 110

Quoted 10 lines
drivers/net/phy/xilinx_phy.c +2 -2
@@ -103,8 +103,8 @@ static int xilinxphy_of_init(struct phy_device *phydev)
  	u32 phytype;
 
  	debug("%s\n", __func__);
-	phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
-				 "xlnx,phy-type", -1);
+	phytype = dev_read_u32_default(phydev->dev,
+				       "xlnx,phy-type", -1);
  	if (phytype == XAE_PHY_TYPE_1000BASE_X)
  		phydev->flags |= XAE_PHY_TYPE_1000BASE_X;
 

The same. NACK. Pls, check
https://patchwork.ozlabs.org/cover/936370/
and
https://patchwork.ozlabs.org/cover/936380/

any comments, tested-by are very welcome.

Signature · 2 lines
regards,
-grygorii
#4 lore raw

PATCH 3/3 net: zynq_gem: convert to use livetree

In reply to Siva Durga Prasad Paladugu

This patch updates the zynq gem driver to support
livetree.

---
 drivers/net/zynq_gem.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/net/zynq_gem.c +14 -15
index a817f2e..b9858e4 100644
@@ -178,7 +178,7 @@ struct zynq_gem_priv {
 	struct zynq_gem_regs *iobase;
 	phy_interface_t interface;
 	struct phy_device *phydev;
-	int phy_of_handle;
+	ofnode phy_of_node;
 	struct mii_dev *bus;
 	struct clk clk;
 	u32 max_speed;
@@ -349,8 +349,7 @@ static int zynq_phy_init(struct udevice *dev)
 
 	priv->phydev->advertising = priv->phydev->supported;
 
-	if (priv->phy_of_handle > 0)
-		dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
+	priv->phydev->dev->node = priv->phy_of_node;
 
 	return phy_config(priv->phydev);
 }
@@ -693,21 +692,23 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
 	struct zynq_gem_priv *priv = dev_get_priv(dev);
-	int node = dev_of_offset(dev);
+	struct ofnode_phandle_args phandle_args;
 	const char *phy_mode;
 
-	pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+	pdata->iobase = (phys_addr_t)dev_read_addr(dev);
 	priv->iobase = (struct zynq_gem_regs *)pdata->iobase;
 	/* Hardcode for now */
 	priv->phyaddr = -1;
 
-	priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, node,
-						    "phy-handle");
-	if (priv->phy_of_handle > 0)
-		priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
-					priv->phy_of_handle, "reg", -1);
+	if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+				       &phandle_args)) {
+		debug("phy-handle does not exist %s\n", dev->name);
+		return -ENOENT;
+	}
 
-	phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
+	priv->phyaddr = ofnode_read_u32_default(phandle_args.node, "reg", -1);
+	priv->phy_of_node = phandle_args.node;
+	phy_mode = dev_read_prop(dev, "phy-mode", NULL);
 	if (phy_mode)
 		pdata->phy_interface = phy_get_interface_by_name(phy_mode);
 	if (pdata->phy_interface == -1) {
@@ -716,10 +717,8 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 	}
 	priv->interface = pdata->phy_interface;
 
-	priv->max_speed = fdtdec_get_uint(gd->fdt_blob, priv->phy_of_handle,
-					  "max-speed", SPEED_1000);
-	priv->int_pcs = fdtdec_get_bool(gd->fdt_blob, node,
-					"is-internal-pcspma");
+	priv->max_speed = dev_read_u32_default(dev, "max-speed", SPEED_1000);
+	priv->int_pcs = dev_read_bool(dev, "is-internal-pcspma");
 
 	printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n", (ulong)priv->iobase,
 	       priv->phyaddr, phy_string_for_interface(priv->interface));
Signature · 1 line
2.7.4
#5 lore raw

PATCH 3/3 net: zynq_gem: convert to use livetree

Hi Siva,

Quoted 51 lines · Siva Durga Prasad Paladugu

This patch updates the zynq gem driver to support
livetree.

---
 drivers/net/zynq_gem.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/net/zynq_gem.c +4 -10
index a817f2e..b9858e4 100644
@@ -178,7 +178,7 @@ struct zynq_gem_priv {
        struct zynq_gem_regs *iobase;
        phy_interface_t interface;
        struct phy_device *phydev;
-       int phy_of_handle;
+       ofnode phy_of_node;
        struct mii_dev *bus;
        struct clk clk;
        u32 max_speed;
@@ -349,8 +349,7 @@ static int zynq_phy_init(struct udevice *dev)
 
        priv->phydev->advertising = priv->phydev->supported;
 
-       if (priv->phy_of_handle > 0)
-               dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
+       priv->phydev->dev->node = priv->phy_of_node;
 
        return phy_config(priv->phydev);
 }
@@ -693,21 +692,23 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct zynq_gem_priv *priv = dev_get_priv(dev);
-       int node = dev_of_offset(dev);
+       struct ofnode_phandle_args phandle_args;
        const char *phy_mode;
 
-       pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+       pdata->iobase = (phys_addr_t)dev_read_addr(dev);
        priv->iobase = (struct zynq_gem_regs *)pdata->iobase;
        /* Hardcode for now */
        priv->phyaddr = -1;
 
-       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, node,
-                                                   "phy-handle");
-       if (priv->phy_of_handle > 0)
-               priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
-                                       priv->phy_of_handle, "reg", -1);

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev) · line 711

Quoted 10 lines
drivers/net/zynq_gem.c +8 -1
+       if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+                                      &phandle_args)) {
+               debug("phy-handle does not exist %s\n", dev->name);
+               return -ENOENT;
+       }
 
-       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
+       priv->phyaddr = ofnode_read_u32_default(phandle_args.node, "reg", -1);
+       priv->phy_of_node = phandle_args.node;
+       phy_mode = dev_read_prop(dev, "phy-mode", NULL);

I want to make sure we are in sync here. I plan to take Grygorii's series.

Thanks!

Quoted 23 lines
drivers/net/zynq_gem.c +2 -5
        if (phy_mode)
                pdata->phy_interface = phy_get_interface_by_name(phy_mode);
        if (pdata->phy_interface == -1) {
@@ -716,10 +717,8 @@ static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;
 
-       priv->max_speed = fdtdec_get_uint(gd->fdt_blob, priv->phy_of_handle,
-                                         "max-speed", SPEED_1000);
-       priv->int_pcs = fdtdec_get_bool(gd->fdt_blob, node,
-                                       "is-internal-pcspma");
+       priv->max_speed = dev_read_u32_default(dev, "max-speed", SPEED_1000);
+       priv->int_pcs = dev_read_bool(dev, "is-internal-pcspma");
 
        printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n", (ulong)priv->iobase,
               priv->phyaddr, phy_string_for_interface(priv->interface));
--

2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#6 lore raw

PATCH 3/3 net: zynq_gem: convert to use livetree

Hi Joe,

Quoted 72 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Thursday, July 12, 2018 12:26 AM
To: Siva Durga Prasad Paladugu <[email protected]>; Grygorii Strashko <[email protected]>
Cc: u-boot <[email protected]>; Joe Hershberger <[email protected]>; Michal Simek <[email protected]>; Vipul Kumar <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree

Hi Siva,

Quoted 47 lines · Siva Durga Prasad Paladugu

This patch updates the zynq gem driver to support livetree.

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]>

---
 drivers/net/zynq_gem.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0 -0

a817f2e..b9858e4 100644

drivers/net/zynq_gem.c +2 -3
@@ -178,7 +178,7 @@ struct zynq_gem_priv {
        struct zynq_gem_regs *iobase;
        phy_interface_t interface;
        struct phy_device *phydev;
-       int phy_of_handle;
+       ofnode phy_of_node;
        struct mii_dev *bus;
        struct clk clk;
        u32 max_speed;
@@ -349,8 +349,7 @@ static int zynq_phy_init(struct udevice *dev)
 
        priv->phydev->advertising = priv->phydev->supported;
 
-       if (priv->phy_of_handle > 0)
-               dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
+       priv->phydev->dev->node = priv->phy_of_node;
 
        return phy_config(priv->phydev);  } @@ -693,21 +692,23 @@
 static int zynq_gem_ofdata_to_platdata(struct udevice *dev)  {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct zynq_gem_priv *priv = dev_get_priv(dev);
drivers/net/zynq_gem.c +2 -5
-       int node = dev_of_offset(dev);
+       struct ofnode_phandle_args phandle_args;
        const char *phy_mode;
 
-       pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+       pdata->iobase = (phys_addr_t)dev_read_addr(dev);
        priv->iobase = (struct zynq_gem_regs *)pdata->iobase;
        /* Hardcode for now */
        priv->phyaddr = -1;
 
-       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob, node,
-                                                   "phy-handle");
-       if (priv->phy_of_handle > 0)

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 10 lines
drivers/net/zynq_gem.c +6 -3
-               priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
-                                       priv->phy_of_handle, "reg", -1);
+       if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+                                      &phandle_args)) {
+               debug("phy-handle does not exist %s\n", dev->name);
+               return -ENOENT;
+       }
 
-       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
+       priv->phyaddr = ofnode_read_u32_default(phandle_args.node,

"reg", -1);

Quoted 6 lines

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev) · line 711

Quoted 2 lines
drivers/net/zynq_gem.c +2 -0
+       priv->phy_of_node = phandle_args.node;
+       phy_mode = dev_read_prop(dev, "phy-mode", NULL);

I want to make sure we are in sync here. I plan to take Grygorii's series.

Thanks!

Thanks for informing. No problem, I will make changes as per Grygorii's series and will test it sometime this week.

Thanks,
Siva

Quoted 29 lines
Quoted 3 lines
        if (phy_mode)
                pdata->phy_interface =

phy_get_interface_by_name(phy_mode);

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 11 lines
        if (pdata->phy_interface == -1) { @@ -716,10 +717,8 @@ static
int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;

- priv->max_speed = fdtdec_get_uint(gd->fdt_blob, priv-
phy_of_handle,

drivers/net/zynq_gem.c +1 -3
-                                         "max-speed", SPEED_1000);
-       priv->int_pcs = fdtdec_get_bool(gd->fdt_blob, node,
-                                       "is-internal-pcspma");
+       priv->max_speed = dev_read_u32_default(dev, "max-speed",

SPEED_1000);

Quoted 13 lines

+ priv->int_pcs = dev_read_bool(dev, "is-internal-pcspma");

printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n", (ulong)priv-
iobase,

               priv->phyaddr,

phy_string_for_interface(priv->interface));
--
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#7 lore raw

PATCH 3/3 net: zynq_gem: convert to use livetree

In reply to Joe Hershberger

HI Joe,

Quoted 88 lines

-----Original Message-----
From: Siva Durga Prasad Paladugu
Sent: Monday, July 16, 2018 2:32 PM
To: 'joe.hershberger at ni.com' <[email protected]>; Grygorii Strashko <[email protected]>
Cc: u-boot <[email protected]>; Michal Simek <[email protected]>; Vipul Kumar <[email protected]>
Subject: RE: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree

Hi Joe,

Quoted 53 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Thursday, July 12, 2018 12:26 AM
To: Siva Durga Prasad Paladugu <[email protected]>; Grygorii Strashko <[email protected]>
Cc: u-boot <[email protected]>; Joe Hershberger <[email protected]>; Michal Simek <[email protected]>; Vipul Kumar <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree

Hi Siva,

Quoted 38 lines · Siva Durga Prasad Paladugu

This patch updates the zynq gem driver to support livetree.

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]>

---
 drivers/net/zynq_gem.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0 -0

a817f2e..b9858e4 100644

drivers/net/zynq_gem.c +2 -3
@@ -178,7 +178,7 @@ struct zynq_gem_priv {
        struct zynq_gem_regs *iobase;
        phy_interface_t interface;
        struct phy_device *phydev;
-       int phy_of_handle;
+       ofnode phy_of_node;
        struct mii_dev *bus;
        struct clk clk;
        u32 max_speed;
@@ -349,8 +349,7 @@ static int zynq_phy_init(struct udevice *dev)
 
        priv->phydev->advertising = priv->phydev->supported;
 
-       if (priv->phy_of_handle > 0)
-               dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
+       priv->phydev->dev->node = priv->phy_of_node;
 
        return phy_config(priv->phydev);  } @@ -693,21 +692,23 @@
 static int zynq_gem_ofdata_to_platdata(struct udevice *dev)  {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct zynq_gem_priv *priv = dev_get_priv(dev);
drivers/net/zynq_gem.c +1 -1
-       int node = dev_of_offset(dev);
+       struct ofnode_phandle_args phandle_args;
        const char *phy_mode;
Quoted 7 lines

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 7 lines
drivers/net/zynq_gem.c +1 -2
-       pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+       pdata->iobase = (phys_addr_t)dev_read_addr(dev);
        priv->iobase = (struct zynq_gem_regs *)pdata->iobase;
        /* Hardcode for now */
        priv->phyaddr = -1;
 
-       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,

node,

Quoted 16 lines

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 12 lines
drivers/net/zynq_gem.c +6 -5
-                                                   "phy-handle");
-       if (priv->phy_of_handle > 0)
-               priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
-                                       priv->phy_of_handle, "reg", -1);
+       if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+                                      &phandle_args)) {
+               debug("phy-handle does not exist %s\n", dev->name);
+               return -ENOENT;
+       }
 
-       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
+       priv->phyaddr = ofnode_read_u32_default(phandle_args.node,

"reg", -1);

Quoted 2 lines
drivers/net/zynq_gem.c +2 -0
+       priv->phy_of_node = phandle_args.node;
+       phy_mode = dev_read_prop(dev, "phy-mode", NULL);
Quoted 6 lines
Quoted 3 lines

I want to make sure we are in sync here. I plan to take Grygorii's series.

Thanks!

Thanks for informing. No problem, I will make changes as per Grygorii's series and will test it sometime this week.

I tested by applying both series on ZynqMP zcu102 board(it has ti phy) and its working fine. I also tested by modifying the zynq_gem to support live tree for which I will be sending patch soon.

Grygorii,
You can add my tested-by to TI phy and zynq_gem patches in your series.

Thanks,
Siva

Quoted 33 lines

Thanks,
Siva

Quoted 29 lines
Quoted 3 lines
        if (phy_mode)
                pdata->phy_interface =

phy_get_interface_by_name(phy_mode);

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 11 lines
        if (pdata->phy_interface == -1) { @@ -716,10 +717,8 @@
static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;

- priv->max_speed = fdtdec_get_uint(gd->fdt_blob, priv-
phy_of_handle,

drivers/net/zynq_gem.c +1 -3
-                                         "max-speed", SPEED_1000);
-       priv->int_pcs = fdtdec_get_bool(gd->fdt_blob, node,
-                                       "is-internal-pcspma");
+       priv->max_speed = dev_read_u32_default(dev, "max-speed",

SPEED_1000);

Quoted 13 lines

+ priv->int_pcs = dev_read_bool(dev, "is-internal-pcspma");

printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n",
(ulong)priv- iobase,

               priv->phyaddr,

phy_string_for_interface(priv->interface));
--
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#8 lore raw

PATCH 3/3 net: zynq_gem: convert to use livetree

Quoted 97 lines · Siva Durga Prasad Paladugu

HI Joe,

Quoted 88 lines

-----Original Message-----
From: Siva Durga Prasad Paladugu
Sent: Monday, July 16, 2018 2:32 PM
To: 'joe.hershberger at ni.com' <[email protected]>; Grygorii Strashko <[email protected]>
Cc: u-boot <[email protected]>; Michal Simek <[email protected]>; Vipul Kumar <[email protected]>
Subject: RE: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree

Hi Joe,

Quoted 53 lines

-----Original Message-----
From: Joe Hershberger [mailto:joe.hershberger at ni.com]
Sent: Thursday, July 12, 2018 12:26 AM
To: Siva Durga Prasad Paladugu <[email protected]>; Grygorii Strashko <[email protected]>
Cc: u-boot <[email protected]>; Joe Hershberger <[email protected]>; Michal Simek <[email protected]>; Vipul Kumar <[email protected]>
Subject: Re: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree

Hi Siva,

Quoted 38 lines · Siva Durga Prasad Paladugu

This patch updates the zynq gem driver to support livetree.

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]>

---
 drivers/net/zynq_gem.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/net/zynq_gem.c index renamed from drivers/net/zynq_gem.c +0 -0

a817f2e..b9858e4 100644

drivers/net/zynq_gem.c +2 -3
@@ -178,7 +178,7 @@ struct zynq_gem_priv {
        struct zynq_gem_regs *iobase;
        phy_interface_t interface;
        struct phy_device *phydev;
-       int phy_of_handle;
+       ofnode phy_of_node;
        struct mii_dev *bus;
        struct clk clk;
        u32 max_speed;
@@ -349,8 +349,7 @@ static int zynq_phy_init(struct udevice *dev)
 
        priv->phydev->advertising = priv->phydev->supported;
 
-       if (priv->phy_of_handle > 0)
-               dev_set_of_offset(priv->phydev->dev, priv->phy_of_handle);
+       priv->phydev->dev->node = priv->phy_of_node;
 
        return phy_config(priv->phydev);  } @@ -693,21 +692,23 @@
 static int zynq_gem_ofdata_to_platdata(struct udevice *dev)  {
        struct eth_pdata *pdata = dev_get_platdata(dev);
        struct zynq_gem_priv *priv = dev_get_priv(dev);
drivers/net/zynq_gem.c +1 -1
-       int node = dev_of_offset(dev);
+       struct ofnode_phandle_args phandle_args;
        const char *phy_mode;
Quoted 7 lines

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 7 lines
drivers/net/zynq_gem.c +1 -2
-       pdata->iobase = (phys_addr_t)devfdt_get_addr(dev);
+       pdata->iobase = (phys_addr_t)dev_read_addr(dev);
        priv->iobase = (struct zynq_gem_regs *)pdata->iobase;
        /* Hardcode for now */
        priv->phyaddr = -1;
 
-       priv->phy_of_handle = fdtdec_lookup_phandle(gd->fdt_blob,

node,

Quoted 16 lines

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 12 lines
drivers/net/zynq_gem.c +6 -5
-                                                   "phy-handle");
-       if (priv->phy_of_handle > 0)
-               priv->phyaddr = fdtdec_get_int(gd->fdt_blob,
-                                       priv->phy_of_handle, "reg", -1);
+       if (dev_read_phandle_with_args(dev, "phy-handle", NULL, 0, 0,
+                                      &phandle_args)) {
+               debug("phy-handle does not exist %s\n", dev->name);
+               return -ENOENT;
+       }
 
-       phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
+       priv->phyaddr = ofnode_read_u32_default(phandle_args.node,

"reg", -1);

Quoted 2 lines
drivers/net/zynq_gem.c +2 -0
+       priv->phy_of_node = phandle_args.node;
+       phy_mode = dev_read_prop(dev, "phy-mode", NULL);
Quoted 6 lines
Quoted 3 lines

I want to make sure we are in sync here. I plan to take Grygorii's series.

Thanks!

Thanks for informing. No problem, I will make changes as per Grygorii's series and will test it sometime this week.

Quoted 6 lines

I tested by applying both series on ZynqMP zcu102 board(it has ti phy) and its working fine. I also tested by modifying the zynq_gem to support live tree for which I will be sending patch soon.

Grygorii,
You can add my tested-by to TI phy and zynq_gem patches in your series.

Added.

Quoted 40 lines

Thanks,
Siva

Quoted 33 lines

Thanks,
Siva

Quoted 29 lines
Quoted 3 lines
        if (phy_mode)
                pdata->phy_interface =

phy_get_interface_by_name(phy_mode);

drivers/net/zynq_gem.c static int zynq_gem_ofdata_to_platdata(struct udevice *dev)

Quoted 11 lines
        if (pdata->phy_interface == -1) { @@ -716,10 +717,8 @@
static int zynq_gem_ofdata_to_platdata(struct udevice *dev)
        }
        priv->interface = pdata->phy_interface;

- priv->max_speed = fdtdec_get_uint(gd->fdt_blob, priv-
phy_of_handle,

drivers/net/zynq_gem.c +1 -3
-                                         "max-speed", SPEED_1000);
-       priv->int_pcs = fdtdec_get_bool(gd->fdt_blob, node,
-                                       "is-internal-pcspma");
+       priv->max_speed = dev_read_u32_default(dev, "max-speed",

SPEED_1000);

Quoted 13 lines

+ priv->int_pcs = dev_read_bool(dev, "is-internal-pcspma");

printf("ZYNQ GEM: %lx, phyaddr %x, interface %s\n",
(ulong)priv- iobase,

               priv->phyaddr,

phy_string_for_interface(priv->interface));
--
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#9 lore raw

PATCH 1/3 net: phy: ti: Modify to support livetree

In reply to Siva Durga Prasad Paladugu
Quoted 35 lines · Siva Durga Prasad Paladugu

This patch adds support for livetree by using
dev_.. calls instead of fdtdec_..

---
  drivers/net/phy/ti.c | 16 +++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/phy/ti.c +4 -6
index 8f3ed8a..945d9e9 100644
@@ -173,24 +173,22 @@ static int dp83867_of_init(struct phy_device *phydev)
  {
  	struct dp83867_private *dp83867 = phydev->priv;
  	struct udevice *dev = phydev->dev;
-	int node = dev_of_offset(dev);
  	const void *fdt = gd->fdt_blob;
 
-	if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))
+	if (dev_read_bool(dev, "ti,max-output-impedance"))
  		dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;
-	else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+	else if (dev_read_bool(dev, "ti,min-output-impedance"))
  		dp83867->io_impedance = DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;
  	else
  		dp83867->io_impedance = -EINVAL;
 
-	dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-				 "ti,rx-internal-delay", -1);
+	dp83867->rx_id_delay = dev_read_u32_default(dev, "ti,rx-internal-delay",
+						    -1);
 
-	dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev) · line 194

Quoted 10 lines
drivers/net/phy/ti.c +3 -3
-				 "ti,tx-internal-delay", -1);
+	dp83867->tx_id_delay = dev_read_u32_default(dev, "ti,tx-internal-delay",
+						    -1);
 
-	dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob, dev_of_offset(dev),
-				 "ti,fifo-depth", -1);
+	dp83867->fifo_depth = dev_read_u32_default(dev, "ti,fifo-depth", -1);
 
  	return 0;
  }

NACK. Pls, check
https://patchwork.ozlabs.org/cover/936370/
and
https://patchwork.ozlabs.org/cover/936380/

any comments, tested-by are very welcome.

Signature · 2 lines
regards,
-grygorii
#10 lore raw

PATCH 1/3 net: phy: ti: Modify to support livetree

Hi,

Quoted 72 lines

-----Original Message-----
From: Grygorii Strashko [mailto:grygorii.strashko at ti.com]
Sent: Monday, July 09, 2018 10:51 PM
To: Siva Durga Prasad Paladugu <[email protected]>; u-
boot at lists.denx.de
Cc: joe.hershberger at ni.com; Michal Simek <[email protected]>
Subject: Re: [U-Boot] [PATCH 1/3] net: phy: ti: Modify to support livetree

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device

Quoted 14 lines · Siva Durga Prasad Paladugu

This patch adds support for livetree by using dev_.. calls instead of fdtdec_..

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]>

---
  drivers/net/phy/ti.c | 16 +++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/phy/ti.c index renamed from drivers/net/phy/ti.c +0 -0

8f3ed8a..945d9e9 100644

drivers/net/phy/ti.c +0 -0
@@ -173,24 +173,22 @@ static int dp83867_of_init(struct phy_device

*phydev)

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 9 lines
drivers/net/phy/ti.c +1 -2
  {
  	struct dp83867_private *dp83867 = phydev->priv;
  	struct udevice *dev = phydev->dev;
-	int node = dev_of_offset(dev);
  	const void *fdt = gd->fdt_blob;
 
-	if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))
+	if (dev_read_bool(dev, "ti,max-output-impedance"))
  		dp83867->io_impedance =

DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 3 lines
drivers/net/phy/ti.c +1 -1
-	else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+	else if (dev_read_bool(dev, "ti,min-output-impedance"))
  		dp83867->io_impedance =

DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 4 lines
drivers/net/phy/ti.c +0 -1
  	else
  		dp83867->io_impedance = -EINVAL;
 
-	dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob,

dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device · line 185

Quoted 2 lines
drivers/net/phy/ti.c +1 -1
-				 "ti,rx-internal-delay", -1);
+	dp83867->rx_id_delay = dev_read_u32_default(dev, "ti,rx-internal-

delay",

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 3 lines
drivers/net/phy/ti.c +1 -1
+						    -1);
 
-	dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob,

dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device · line 188

Quoted 2 lines
drivers/net/phy/ti.c +1 -1
-				 "ti,tx-internal-delay", -1);
+	dp83867->tx_id_delay = dev_read_u32_default(dev, "ti,tx-internal-

delay",

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 3 lines
drivers/net/phy/ti.c +1 -1
+						    -1);
 
-	dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob,

dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev) · line 194

Quoted 7 lines
drivers/net/phy/ti.c +2 -1
-				 "ti,fifo-depth", -1);
+	dp83867->fifo_depth = dev_read_u32_default(dev, "ti,fifo-depth",
+-1);
 
  	return 0;
  }

NACK. Pls, check
https://patchwork.ozlabs.org/cover/936370/
and
https://patchwork.ozlabs.org/cover/936380/

Quoted 1 line

any comments, tested-by are very welcome.

Do you mean to say that this patch has to be rebased and tested on the top of your patch.

Thanks,
Siva

Quoted 4 lines

--
regards,
-grygorii

#11 lore raw

PATCH 1/3 net: phy: ti: Modify to support livetree

Hi,

Quoted 82 lines

-----Original Message-----
From: Siva Durga Prasad Paladugu
Sent: Tuesday, July 10, 2018 9:32 AM
To: Grygorii Strashko <[email protected]>; u-boot at lists.denx.de
Cc: joe.hershberger at ni.com; Michal Simek <[email protected]>
Subject: RE: [U-Boot] [PATCH 1/3] net: phy: ti: Modify to support livetree

Hi,

Quoted 73 lines

-----Original Message-----
From: Grygorii Strashko [mailto:grygorii.strashko at ti.com]
Sent: Monday, July 09, 2018 10:51 PM
To: Siva Durga Prasad Paladugu <[email protected]>; u- boot at lists.denx.de
Cc: joe.hershberger at ni.com; Michal Simek <[email protected]>
Subject: Re: [U-Boot] [PATCH 1/3] net: phy: ti: Modify to support livetree

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device

Quoted 14 lines · Siva Durga Prasad Paladugu

This patch adds support for livetree by using dev_.. calls instead of fdtdec_..

Signed-off-by: Siva Durga Prasad Paladugu
<[email protected]>

---
  drivers/net/phy/ti.c | 16 +++++++---------
  1 file changed, 7 insertions(+), 9 deletions(-)
drivers/net/phy/ti.c index renamed from drivers/net/phy/ti.c +0 -0

8f3ed8a..945d9e9 100644

drivers/net/phy/ti.c +0 -0
@@ -173,24 +173,22 @@ static int dp83867_of_init(struct phy_device

*phydev)

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 9 lines
drivers/net/phy/ti.c +1 -2
  {
  	struct dp83867_private *dp83867 = phydev->priv;
  	struct udevice *dev = phydev->dev;
-	int node = dev_of_offset(dev);
  	const void *fdt = gd->fdt_blob;
 
-	if (fdtdec_get_bool(fdt, node, "ti,max-output-impedance"))
+	if (dev_read_bool(dev, "ti,max-output-impedance"))
  		dp83867->io_impedance =

DP83867_IO_MUX_CFG_IO_IMPEDANCE_MAX;

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 3 lines
drivers/net/phy/ti.c +1 -1
-	else if (fdtdec_get_bool(fdt, node, "ti,min-output-impedance"))
+	else if (dev_read_bool(dev, "ti,min-output-impedance"))
  		dp83867->io_impedance =

DP83867_IO_MUX_CFG_IO_IMPEDANCE_MIN;

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 4 lines
drivers/net/phy/ti.c +0 -1
  	else
  		dp83867->io_impedance = -EINVAL;
 
-	dp83867->rx_id_delay = fdtdec_get_uint(gd->fdt_blob,

dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device · line 185

Quoted 2 lines
drivers/net/phy/ti.c +1 -1
-				 "ti,rx-internal-delay", -1);
+	dp83867->rx_id_delay = dev_read_u32_default(dev, "ti,rx-internal-

delay",

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 3 lines
drivers/net/phy/ti.c +1 -1
+						    -1);
 
-	dp83867->tx_id_delay = fdtdec_get_uint(gd->fdt_blob,

dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device · line 188

Quoted 2 lines
drivers/net/phy/ti.c +1 -1
-				 "ti,tx-internal-delay", -1);
+	dp83867->tx_id_delay = dev_read_u32_default(dev, "ti,tx-internal-

delay",

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev)

Quoted 3 lines
drivers/net/phy/ti.c +1 -1
+						    -1);
 
-	dp83867->fifo_depth = fdtdec_get_uint(gd->fdt_blob,

dev_of_offset(dev),

drivers/net/phy/ti.c static int dp83867_of_init(struct phy_device *phydev) · line 194

Quoted 7 lines
drivers/net/phy/ti.c +2 -1
-				 "ti,fifo-depth", -1);
+	dp83867->fifo_depth = dev_read_u32_default(dev, "ti,fifo-depth",
+-1);
 
  	return 0;
  }

NACK. Pls, check
https://patchwork.ozlabs.org/cover/936370/
and
https://patchwork.ozlabs.org/cover/936380/

Quoted 4 lines
Quoted 1 line

any comments, tested-by are very welcome.

Do you mean to say that this patch has to be rebased and tested on the top of your patch.

Oops, I missed your second thread(936380) and replied. Please ignore my last mail.
I will review, test with your series and let you know if any.

Thanks,
Siva

Quoted 8 lines

Thanks,
Siva

Quoted 4 lines

--
regards,
-grygorii