netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH V1 net-next 0/3] net: stmmac: implement clocks
Date: Thu, 25 Feb 2021 03:33:38 +0100	[thread overview]
Message-ID: <YDcMgr2rvcFvs746@lunn.ch> (raw)
In-Reply-To: <DB8PR04MB6795FAE4C1736AABDCA75FA7E69E9@DB8PR04MB6795.eurprd04.prod.outlook.com>

> Hi Andrew,
> 

> I don't have experience with Ethernet switch, according to your
> points, you mean we can connect STMMAC to an Ethernet switch, and
> then Ethernet switch managed STMMAC by the MDIO bus but without
> checking whether STMMAC interface is opened or not, so STMMAC needs
> clocks for MDIO even interface is closed, right?

Correct. The MDIO bus has a different life cycle to the MAC. If any of
stmmac_xgmac2_mdio_read(), stmmac_xgmac2_mdio_write(),
stmmac_mdio_read(), and stmmac_mdio_write() need clocks ticking, you
need to ensure the clock is ticking, because these functions can be
called while the interface is not opened.

> > You said you copied the FEC driver. Take a look at that, it was initially broken in
> > this way, and i needed to extend it when i got a board with an Ethernet switch
> > attached to the FEC.
> 

> Could you point me how to implement clocks management to cover above
> Ethernet switch case? Or can we upstream this first and then fix it
> later for such case?

I actually got is wrong on the first attempt. So you need to look at:

42ea4457ae net: fec: normalize return value of pm_runtime_get_sync() in MDIO write
14d2b7c1a9 net: fec: fix initial runtime PM refcount
8fff755e9f net: fec: Ensure clocks are enabled while using mdio bus

And no, you cannot fix it later, because your patches potentially
break existing systems using an Ethernet switch. See:

ommit da29f2d84bd10234df570b7f07cbd0166e738230
Author: Jose Abreu <Jose.Abreu@synopsys.com>
Date:   Tue Jan 7 13:35:42 2020 +0100

    net: stmmac: Fixed link does not need MDIO Bus
    
    When using fixed link we don't need the MDIO bus support.

...
    Tested-by: Florian Fainelli <f.fainelli@gmail> # Lamobo R1 (fixed-link + MDIO sub node for roboswitch).

So there are boards which make use of a switch and MDIO. Florian might
however be able to run tests for you, if you ask him.

   Andrew

  parent reply	other threads:[~2021-02-25  2:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 10:48 [PATCH V1 net-next 0/3] net: stmmac: implement clocks Joakim Zhang
2021-02-23 10:48 ` [PATCH V1 net-next 1/3] net: stmmac: add clocks management for gmac driver Joakim Zhang
2021-02-23 16:46   ` Jakub Kicinski
2021-02-24  1:46     ` Joakim Zhang
2021-02-23 10:48 ` [PATCH V1 net-next 2/3] net: stmmac: add platform level clocks management Joakim Zhang
2021-02-23 10:48 ` [PATCH V1 net-next 3/3] net: stmmac: add platform level clocks management for i.MX Joakim Zhang
2021-02-23 16:45 ` [PATCH V1 net-next 0/3] net: stmmac: implement clocks Jakub Kicinski
2021-02-24  1:45   ` Joakim Zhang
2021-02-24  1:54     ` Jakub Kicinski
2021-02-24  2:13       ` Joakim Zhang
2021-02-24  2:34         ` Jakub Kicinski
2021-02-24  2:47           ` Joakim Zhang
2021-02-24  3:54             ` Florian Fainelli
2021-02-25  1:42               ` Joakim Zhang
2021-02-24  9:03           ` Joakim Zhang
2021-02-24 13:01       ` Andrew Lunn
2021-02-25  2:15         ` Joakim Zhang
     [not found]         ` <DB8PR04MB6795FAE4C1736AABDCA75FA7E69E9@DB8PR04MB6795.eurprd04.prod.outlook.com>
2021-02-25  2:33           ` Andrew Lunn [this message]
2021-02-25 11:48             ` Joakim Zhang
2021-02-25 13:14               ` Andrew Lunn

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=YDcMgr2rvcFvs746@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=netdev@vger.kernel.org \
    --cc=qiangqing.zhang@nxp.com \
    /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;
as well as URLs for NNTP newsgroup(s).