mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: "Alvin Šipraga" <alvin@pqrs.dk>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	BAREBOX <barebox@lists.infradead.org>
Cc: "Vladimir Oltean" <olteanv@gmail.com>,
	"Luiz Angelo Daros de Luca" <luizluca@gmail.com>,
	"Alvin Šipraga" <alsi@bang-olufsen.dk>
Subject: Re: [PATCH 1/4] net: fec_imx: reverse registration order of mdiobus and edev
Date: Sun, 24 Dec 2023 10:27:04 +0100	[thread overview]
Message-ID: <65e626eb-dc07-41fb-8f51-a7f307e5e360@pengutronix.de> (raw)
In-Reply-To: <20231222-realtek-mdio-fix-v1-1-6bbf80d6a756@bang-olufsen.dk>

Hello Alvin,

On 22.12.23 03:07, Alvin Šipraga wrote:
> From: Alvin Šipraga <alsi@bang-olufsen.dk>
> 
> This is necessary so that on systems with MDIO-connected Etheret
> switches, DSA can find the master edev during switch registration.
> Otherwise the switch setup will fail.

On the other hand, systems, where the PHY supplies a clock to the MAC
need the MDIO bus controller to be registered first, so the PHYs can
probe. In the special case of the FEC driver:

  - there's no struct eth_device::init function 
  - struct eth_device::get_ethaddr doesn't do hardware access


and operations in struct eth_device are only invoked when ->open is initially
called, which won't happen at driver probe time.

I thus think the change is ok, even if not generally applicable to all drivers.

Acked-by: Ahmad Fatoum <a.fatoum@pengutronix.de>


Thanks,
Ahmad

> 
> Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
> ---
>  drivers/net/fec_imx.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 203a2a8aa191..75a65962820b 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -895,18 +895,18 @@ static int fec_probe(struct device *dev)
>  	fec->miibus.priv = fec;
>  	fec->miibus.parent = dev;
>  
> -	ret = mdiobus_register(&fec->miibus);
> +	ret = eth_register(edev);
>  	if (ret)
>  		goto free_receive_packets;
>  
> -	ret = eth_register(edev);
> +	ret = mdiobus_register(&fec->miibus);
>  	if (ret)
> -		goto unregister_mdio;
> +		goto unregister_eth;
>  
>  	return 0;
>  
> -unregister_mdio:
> -	mdiobus_unregister(&fec->miibus);
> +unregister_eth:
> +	eth_unregister(edev);
>  free_receive_packets:
>  	fec_free_receive_packets(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE);
>  free_xbd:
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2023-12-24  9:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22  2:07 [PATCH 0/4] fix barebox support for MDIO-connected Realtek Ethernet switches Alvin Šipraga
2023-12-22  2:07 ` [PATCH 1/4] net: fec_imx: reverse registration order of mdiobus and edev Alvin Šipraga
2023-12-24  9:27   ` Ahmad Fatoum [this message]
2023-12-22  2:07 ` [PATCH 2/4] net: dsa: realtek: fix support for MDIO-connected switches Alvin Šipraga
2023-12-22  2:07 ` [PATCH 3/4] net: dsa: realtek: unify ds_ops Alvin Šipraga
2023-12-22  2:07 ` [PATCH 4/4] net: mdio_bus: associate OF nodes with their devices Alvin Šipraga
2024-01-02  9:01 ` [PATCH 0/4] fix barebox support for MDIO-connected Realtek Ethernet switches Sascha Hauer

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=65e626eb-dc07-41fb-8f51-a7f307e5e360@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=alsi@bang-olufsen.dk \
    --cc=alvin@pqrs.dk \
    --cc=barebox@lists.infradead.org \
    --cc=luizluca@gmail.com \
    --cc=olteanv@gmail.com \
    --cc=s.hauer@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox