All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramon Fried <rfried.dev@gmail.com>
To: Dylan Hung <dylan_hung@aspeedtech.com>
Cc: chiawei_wang@aspeedtech.com, Lukasz Majewski <lukma@denx.de>,
	 Sean Anderson <seanga2@gmail.com>,
	ryan_chen@aspeedtech.com,
	 Joe Hershberger <joe.hershberger@ni.com>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	BMC-SW@aspeedtech.com
Subject: Re: [next 1/5] net: ftgmac100: Add DM_MDIO support
Date: Sat, 11 Dec 2021 01:08:50 +0200	[thread overview]
Message-ID: <CAGi-RU+fkZ_DmTGX3hCFqrfFRfjsvoGuzN_NqiK6Rr79zZ4tjQ@mail.gmail.com> (raw)
In-Reply-To: <20211209021228.27597-2-dylan_hung@aspeedtech.com>

On Thu, Dec 9, 2021 at 4:12 AM Dylan Hung <dylan_hung@aspeedtech.com> wrote:
>
> Add support for DM_MDIO to connect to PHY.  For the systems that have a
> stand-alone MDIO hardware block, enable CONFIG_DM_MDIO to use driver
> model for MDIO devices.
>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
> ---
>  drivers/net/ftgmac100.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
> index 0687230b4bb4..b6e9526c3b9f 100644
> --- a/drivers/net/ftgmac100.c
> +++ b/drivers/net/ftgmac100.c
> @@ -220,7 +220,11 @@ static int ftgmac100_phy_init(struct udevice *dev)
>         struct phy_device *phydev;
>         int ret;
>
> -       phydev = phy_connect(priv->bus, priv->phy_addr, dev, priv->phy_mode);
> +       if (IS_ENABLED(CONFIG_DM_MDIO))
> +               phydev = dm_eth_phy_connect(dev);
> +       else
> +               phydev = phy_connect(priv->bus, priv->phy_addr, dev, priv->phy_mode);
> +
>         if (!phydev)
>                 return -ENODEV;
>
> @@ -589,10 +593,16 @@ static int ftgmac100_probe(struct udevice *dev)
>         if (ret)
>                 goto out;
>
> -       ret = ftgmac100_mdio_init(dev);
> -       if (ret) {
> -               dev_err(dev, "Failed to initialize mdiobus: %d\n", ret);
> -               goto out;
> +       /*
> +        * If DM MDIO is enabled, the MDIO bus will be initialized later in
> +        * dm_eth_phy_connect
> +        */
> +       if (!IS_ENABLED(CONFIG_DM_MDIO)) {
> +               ret = ftgmac100_mdio_init(dev);
> +               if (ret) {
> +                       dev_err(dev, "Failed to initialize mdiobus: %d\n", ret);
> +                       goto out;
> +               }
>         }
>
>         ret = ftgmac100_phy_init(dev);
> --
> 2.25.1
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

  reply	other threads:[~2021-12-10 23:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  2:12 [next 0/5] Add support of Ethernet for Aspeed AST2600 SoC Dylan Hung
2021-12-09  2:12 ` [next 1/5] net: ftgmac100: Add DM_MDIO support Dylan Hung
2021-12-10 23:08   ` Ramon Fried [this message]
2022-01-18 21:09   ` Tom Rini
2021-12-09  2:12 ` [next 2/5] net: ftgmac100: Add Aspeed AST2600 support Dylan Hung
2021-12-10 23:09   ` Ramon Fried
2022-01-18 21:09   ` Tom Rini
2021-12-09  2:12 ` [next 3/5] ARM: dts: ast2600: Add MDIO devices Dylan Hung
2021-12-10 23:10   ` Ramon Fried
2022-01-18 21:09   ` Tom Rini
2021-12-09  2:12 ` [next 4/5] configs: ast2600: enable DM_MDIO and MDIO driver Dylan Hung
2021-12-10 23:10   ` Ramon Fried
2022-01-18 21:09   ` Tom Rini
2021-12-09  2:12 ` [next 5/5] clk: ast2600: Revise MII interface delay Dylan Hung
2021-12-10 23:10   ` Ramon Fried
2022-01-18 21:10   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGi-RU+fkZ_DmTGX3hCFqrfFRfjsvoGuzN_NqiK6Rr79zZ4tjQ@mail.gmail.com \
    --to=rfried.dev@gmail.com \
    --cc=BMC-SW@aspeedtech.com \
    --cc=chiawei_wang@aspeedtech.com \
    --cc=dylan_hung@aspeedtech.com \
    --cc=joe.hershberger@ni.com \
    --cc=lukma@denx.de \
    --cc=ryan_chen@aspeedtech.com \
    --cc=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.