[U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree

Joe Hershberger joe.hershberger at ni.com
Mon Jul 16 20:47:06 UTC 2018


On Mon, Jul 16, 2018 at 7:40 AM, Siva Durga Prasad Paladugu
<sivadur at xilinx.com> wrote:
> HI Joe,
>
>> -----Original Message-----
>> From: Siva Durga Prasad Paladugu
>> Sent: Monday, July 16, 2018 2:32 PM
>> To: 'joe.hershberger at ni.com' <joe.hershberger at ni.com>; Grygorii Strashko
>> <grygorii.strashko at ti.com>
>> Cc: u-boot <u-boot at lists.denx.de>; Michal Simek <michals at xilinx.com>;
>> Vipul Kumar <vipulk at xilinx.com>
>> Subject: RE: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use livetree
>>
>> Hi Joe,
>>
>> > -----Original Message-----
>> > From: Joe Hershberger [mailto:joe.hershberger at ni.com]
>> > Sent: Thursday, July 12, 2018 12:26 AM
>> > To: Siva Durga Prasad Paladugu <sivadur at xilinx.com>; Grygorii Strashko
>> > <grygorii.strashko at ti.com>
>> > Cc: u-boot <u-boot at lists.denx.de>; Joe Hershberger
>> > <joe.hershberger at ni.com>; Michal Simek <michals at xilinx.com>; Vipul
>> > Kumar <vipulk at xilinx.com>
>> > Subject: Re: [U-Boot] [PATCH 3/3] net: zynq_gem: convert to use
>> > livetree
>> >
>> > Hi Siva,
>> >
>> > On Fri, Jul 6, 2018 at 5:10 AM, Siva Durga Prasad Paladugu
>> > <siva.durga.paladugu at xilinx.com> wrote:
>> > > This patch updates the zynq gem driver to support livetree.
>> > >
>> > > Signed-off-by: Siva Durga Prasad Paladugu
>> > > <siva.durga.paladugu at xilinx.com>
>> > > Signed-off-by: Vipul Kumar <vipul.kumar at xilinx.com>
>> > > ---
>> > >  drivers/net/zynq_gem.c | 29 ++++++++++++++---------------
>> > >  1 file changed, 14 insertions(+), 15 deletions(-)
>> > >
>> > > diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index
>> > > a817f2e..b9858e4 100644
>> > > --- a/drivers/net/zynq_gem.c
>> > > +++ b/drivers/net/zynq_gem.c
>> > > @@ -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);
>> >
>> > 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.
> Tested-by: Siva Durga Prasad Paladugu <siva.durga.paladugu at xilinx.com>

Added.

> Thanks,
> Siva
>
>>
>> Thanks,
>> Siva
>>
>> >
>> > >         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
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list