[U-Boot] [PATCH 5/7] net: mvpp2: allow MDIO registration for fixed links

Nevo Hed nhed+uboot at starry.com
Fri Aug 2 22:33:22 UTC 2019


Thanks Simon
you are correct I should have not selected this commit from the
downstream mvl repo as
this feature of phy_connect is now in upstream (the downstream repo is
2018.12 based)

I will remove and resubmit the set

On Fri, Aug 2, 2019 at 3:01 PM Simon Goldschmidt
<simon.k.r.goldschmidt at gmail.com> wrote:
>
> Am 02.08.2019 um 19:54 schrieb nhed+uboot at starry.com:
> > From: Igal Liberman <igall at marvell.com>
> >
> > Currently, there are 2 valid cases for interface, PHY
> > and mdio relation:
> >    - If an interface has PHY handler, it'll call
> >      mdio_mii_bus_get_from_phy(), which will register
> >      MDIO bus.
> >    - If we want to use fixed-link for an interface,
> >      PHY handle is not defined in the DTS, and no
> >      MDIO is registered.
> >
> > There is a third case, for some boards (with switch),
> > the MDIO is used for switch configuration, but the interface
> > itself uses fixed link. This patch allows this option by
> > checking if fixed-link subnode is defined, in this case,
> > MDIO bus is registers, but the PHY address is set to
> > PHY_MAX_ADDR for this interface, so this interface will
> > not try to access the PHY later on.
>
> Instead of ad-hoc coding this, would it work to use "phy_connect()",
> which also checks for fixed-link?
>
> Regards,
> Simon
>
> >
> > In addition, remove unnecessary check after
> > calling fdtdec_get_int().
> >
> > This squahses a subsequent fix by same author
> >
> > Signed-off-by: Igal Liberman <igall at marvell.com>
> > Reviewed-by: Kostya Porotchkin <kostap at marvell.com>
> > Reviewed-by: Stefan Chulski <stefanc at marvell.com>
> > Signed-off-by: Nevo Hed <nhed+github at starry.com>
> > ---
> >
> >   drivers/net/mvpp2.c | 16 +++++++++-------
> >   1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> > index 5f908113f2..da550450eb 100644
> > --- a/drivers/net/mvpp2.c
> > +++ b/drivers/net/mvpp2.c
> > @@ -4707,6 +4707,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
> >       u32 phyaddr = 0;
> >       int phy_mode = -1;
> >       int ret;
> > +     int fixed_link = 0;
> >
> >       /* Default mdio_base from the same eth base */
> >       if (port->priv->hw_version == MVPP21)
> > @@ -4715,16 +4716,17 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port)
> >               port->mdio_base = port->priv->iface_base + MVPP22_SMI;
> >
> >       phy_node = fdtdec_lookup_phandle(gd->fdt_blob, port_node, "phy");
> > +     fixed_link = fdt_subnode_offset(gd->fdt_blob, port_node, "fixed-link");
> >
> >       if (phy_node > 0) {
> > -             ofnode phy_ofnode;
> > -             fdt_addr_t phy_base;
> > -
> > -             phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node, "reg", 0);
> > -             if (phyaddr < 0) {
> > -                     dev_err(&pdev->dev, "could not find phy address\n");
> > -                     return -1;
> > +             if (fixed_link != -FDT_ERR_NOTFOUND) {
> > +                     /* phy_addr is set to invalid value for fixed links */
> > +                     phyaddr = PHY_MAX_ADDR;
> > +             } else {
> > +                     phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node,
> > +                                              "reg", 0);
> >               }
> > +
> >               ret = mdio_mii_bus_get_from_phy(phy_node, &port->bus);
> >               if (ret)
> >                       return ret;
> >
>


More information about the U-Boot mailing list