Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1715321

Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac

From Chen-Yu Tsai <wens@csie.org>
Newsgroups linux.kernel
Subject Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac
Date 2017-08-18 19:10 +0200
Message-ID <ufSWu-6HW-5@gated-at.bofh.it> (permalink)
References <ufOzw-3Ek-3@gated-at.bofh.it> <ufOzw-3Ek-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Aug 18, 2017 at 8:21 PM, Corentin Labbe
<clabbe.montjoie@gmail.com> wrote:
> In case of a MDIO switch, the registered MDIO node should be
> the parent of the PHY. Otherwise of_phy_connect will fail.
>
> Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> index a366b3747eeb..ca3cc99d8960 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
> @@ -312,10 +312,12 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>         static const struct of_device_id need_mdio_ids[] = {
>                 { .compatible = "snps,dwc-qos-ethernet-4.10" },
>                 { .compatible = "allwinner,sun8i-a83t-emac" },
> -               { .compatible = "allwinner,sun8i-h3-emac" },
>                 { .compatible = "allwinner,sun8i-v3s-emac" },
>                 { .compatible = "allwinner,sun50i-a64-emac" },
>         };
> +       static const struct of_device_id need_mdio_mux_ids[] = {
> +               { .compatible = "allwinner,sun8i-h3-emac" },
> +       };
>
>         /* If phy-handle property is passed from DT, use it as the PHY */
>         plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
> @@ -332,7 +334,13 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
>                 mdio = false;
>         }
>
> -       if (of_match_node(need_mdio_ids, np)) {
> +       /*
> +        * In case of a MDIO switch/mux, the registered MDIO node should be
> +        * the parent of the PHY. Otherwise of_phy_connect will fail.
> +        */
> +       if (of_match_node(need_mdio_mux_ids, np)) {
> +                plat->mdio_node =  of_get_parent(plat->phy_node);

Extra space before of_get_parent.

Also this is going to fail horribly if a fixed link is used.

ChenYu

> +       } else if (of_match_node(need_mdio_ids, np)) {
>                 plat->mdio_node = of_get_child_by_name(np, "mdio");
>         } else {
>                 /**
> --
> 2.13.0
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-18 14:30 +0200
  Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac Chen-Yu Tsai <wens@csie.org> - 2017-08-18 19:10 +0200
    Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-19 21:00 +0200
      Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Andrew Lunn <andrew@lunn.ch> - 2017-08-19 22:40 +0200
        Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-20 09:00 +0200
          Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Andrew Lunn <andrew@lunn.ch> - 2017-08-20 16:30 +0200
            Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac Chen-Yu Tsai <wens@csie.org> - 2017-08-21 10:20 +0200
              Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Andrew Lunn <andrew@lunn.ch> - 2017-08-21 15:30 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-08-21 15:40 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Andrew Lunn <andrew@lunn.ch> - 2017-08-21 16:30 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-22 10:10 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac Chen-Yu Tsai <wens@csie.org> - 2017-08-22 17:40 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Florian Fainelli <f.fainelli@gmail.com> - 2017-08-22 18:50 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-22 20:20 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Florian Fainelli <f.fainelli@gmail.com> - 2017-08-22 20:40 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-22 21:40 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-08-23 09:50 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Florian Fainelli <f.fainelli@gmail.com> - 2017-08-23 18:40 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-08-24 10:20 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-24 10:30 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Corentin Labbe <clabbe.montjoie@gmail.com> - 2017-08-24 21:50 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Florian Fainelli <f.fainelli@gmail.com> - 2017-08-24 22:00 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac Chen-Yu Tsai <wens@csie.org> - 2017-08-25 05:00 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Florian Fainelli <f.fainelli@gmail.com> - 2017-08-25 05:10 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for sun8i-h3-emac Chen-Yu Tsai <wens@csie.org> - 2017-08-25 05:50 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Florian Fainelli <f.fainelli@gmail.com> - 2017-08-25 06:00 +0200
                Re: [PATCH v3 3/4] net: stmmac: register parent MDIO node for  sun8i-h3-emac Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-08-22 19:00 +0200

csiph-web