[U-Boot] [PATCH v4 2/5] net: mvpp2: mark phy as invalid in case of missing appropriate driver

Ramon Fried rfried.dev at gmail.com
Wed Nov 13 22:36:22 UTC 2019


On Fri, Aug 16, 2019 at 1:09 AM <nhed+uboot at starry.com> wrote:
>
> From: Grzegorz Jaszczyk <jaz at semihalf.com>
>
> If the phy doesn't match with any existing u-boot drivers, the phy
> framework will connect it to the generic one which uid ==
> 0xffffffff. In this case, act as if the phy wouldn't be declared in
> dts. Otherwise, in case of 3310 (for which the driver doesn't exist)
> the link is marked as always down. Removing phy entry from dts in case
> of 3310 is not a good option because it is required for the
> phy_fw_down procedure.
>
> This patch fixes the issue with the link always down on MCBIN board.
>
> nhed: added NULL deref test.
>
> Signed-off-by: Grzegorz Jaszczyk <jaz at semihalf.com>
> Reviewed-by: Igal Liberman <igall at marvell.com>
> Tested-by: Igal Liberman <igall at marvell.com>
> Signed-off-by: Nevo Hed <nhed+github at starry.com>
> ---
>  drivers/net/mvpp2.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> index f36c8236b1..4ba6f9be3e 100644
> --- a/drivers/net/mvpp2.c
> +++ b/drivers/net/mvpp2.c
> @@ -4501,6 +4501,29 @@ static void mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port)
>         if (!port->init || port->link == 0) {
>                 phy_dev = phy_connect(port->bus, port->phyaddr, dev,
>                                       port->phy_interface);
> +
> +               /*
> +                * If the phy doesn't match with any existing u-boot drivers the
> +                * phy framework will connect it to generic one which
> +                * uid == 0xffffffff. In this case act as if the phy wouldn't be
> +                * declared in dts. Otherwise in case of 3310 (for which the
> +                * driver doesn't exist) the link will not be correctly
> +                * detected. Removing phy entry from dts in case of 3310 is not
> +                * an option because it is required for the phy_fw_down
> +                * procedure.
> +                */
> +               if (phy_dev &&
> +                   phy_dev->drv->uid == 0xffffffff) {/* Generic phy */
> +                       netdev_warn(port->dev,
> +                                   "Marking phy as invalid, link will not be checked\n");
> +                       /* set phy_addr to invalid value */
> +                       port->phyaddr = PHY_MAX_ADDR;
> +                       mvpp2_egress_enable(port);
> +                       mvpp2_ingress_enable(port);
> +
> +                       return;
> +               }
> +
>                 port->phy_dev = phy_dev;
>                 if (!phy_dev) {
>                         netdev_err(port->dev, "cannot connect to phy\n");
> --
> 2.21.0
>
Reviewed-By: Ramon Fried <rfried.dev at gmail.com>


More information about the U-Boot mailing list