devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Badel, Laurent" <LaurentBadel@eaton.com>
Cc: Marco Felsch <m.felsch@pengutronix.de>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"fugang.duan@nxp.com" <fugang.duan@nxp.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"broonie@kernel.org" <broonie@kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"richard.leitner@skidata.com" <richard.leitner@skidata.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"f.fainelli@gmail.com" <f.fainelli@gmail.com>,
	"Quette, Arnaud" <ArnaudQuette@Eaton.com>
Subject: Re: [EXTERNAL]  Re: [PATCH net 0/4] Restore and fix PHY reset for SMSC LAN8720
Date: Wed, 4 Nov 2020 14:11:04 +0100	[thread overview]
Message-ID: <20201104131104.GV933237@lunn.ch> (raw)
In-Reply-To: <CY4PR1701MB187881808BA7836EE5EDFE06DFEF0@CY4PR1701MB1878.namprd17.prod.outlook.com>

> > > (ii) This defeats the purpose of a previous commit [2] that disabled
> > > the ref clock for power saving reasons. If a ref clock for the PHY is
> > > specified in DT, the SMSC driver will keep it always on (confirmed
> > > with scope).
> > 
> > NACK, the clock provider can be any clock. This has nothing to do with the
> > FEC clocks. The FEC _can_ be used as clock provider.
> 
> I'm sure you understand this much better than I do. What I can say is that I 
> directly measured the ref clk and found that when I add the clock to the DT
> the clock stays on forever. Basically it seems like the FEC calls to 
> clk_disable_unprepare() don't work in this case, though I'm not sure about the
> reason behind this.

The reason is easy to explain. The clock API is reference counted. It
counts how many times a clock is turned on and off. A clock has to be
turned off as many times as it was turned on before the hardware
actually turns off. So you have the FEC turning the clock on during
probe, followed by the phy turning the clock on. Some time later the
FEC turns the clock off for run time power saving, but there is still
one reference to the clock held by the PHY, so the hardware is left
ticking.

	Andrew

  reply	other threads:[~2020-11-04 13:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 23:25 [PATCH net 0/4] Restore and fix PHY reset for SMSC LAN8720 Badel, Laurent
2020-10-28 23:10 ` Jakub Kicinski
2020-11-02 15:24   ` [EXTERNAL] " Badel, Laurent
2020-10-29  8:16 ` Marco Felsch
2020-11-04 12:08   ` [EXTERNAL] " Badel, Laurent
2020-11-04 13:11     ` Andrew Lunn [this message]
2020-11-04 13:14       ` Badel, Laurent

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=20201104131104.GV933237@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ArnaudQuette@Eaton.com \
    --cc=LaurentBadel@eaton.com \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=fugang.duan@nxp.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux@armlinux.org.uk \
    --cc=m.felsch@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=richard.leitner@skidata.com \
    --cc=robh+dt@kernel.org \
    /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).