mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: andrew@lunn.ch, hkallweit1@gmail.com
Cc: linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	quentin.schulz@theobroma-systems.com, heiko@sntech.de,
	Heiko Stuebner <heiko.stuebner@cherry.de>
Subject: [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock
Date: Fri,  1 Dec 2023 16:01:30 +0100	[thread overview]
Message-ID: <20231201150131.326766-2-heiko@sntech.de> (raw)
In-Reply-To: <20231201150131.326766-1-heiko@sntech.de>

From: Heiko Stuebner <heiko.stuebner@cherry.de>

While the external clock input will most likely be enabled, it's not
guaranteed and clk_get_rate in some suppliers will even just return
valid results when the clock is running.

So use devm_clk_get_optional_enabled to retrieve and enable the clock
in one go.

Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
---
 drivers/net/phy/micrel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 08e3915001c3..ec6a39dc9053 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2001,7 +2001,7 @@ static int kszphy_probe(struct phy_device *phydev)
 
 	kszphy_parse_led_mode(phydev);
 
-	clk = devm_clk_get(&phydev->mdio.dev, "rmii-ref");
+	clk = devm_clk_get_optional_enabled(&phydev->mdio.dev, "rmii-ref");
 	/* NOTE: clk may be NULL if building without CONFIG_HAVE_CLK */
 	if (!IS_ERR_OR_NULL(clk)) {
 		unsigned long rate = clk_get_rate(clk);
-- 
2.39.2


  reply	other threads:[~2023-12-01 15:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 15:01 [PATCH 0/2] net: phy: micrel: additional clock handling Heiko Stuebner
2023-12-01 15:01 ` Heiko Stuebner [this message]
2023-12-01 17:03   ` [PATCH 1/2] net: phy: micrel: use devm_clk_get_optional_enabled for the rmii-ref clock Florian Fainelli
2023-12-01 22:19   ` Andrew Lunn
2023-12-01 15:01 ` [PATCH 2/2] net: phy: micrel: allow usage of generic ethernet-phy clock Heiko Stuebner
2023-12-01 17:03   ` Florian Fainelli
2023-12-01 22:21   ` Andrew Lunn
2023-12-04 22:50 ` [PATCH 0/2] net: phy: micrel: additional clock handling patchwork-bot+netdevbpf

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=20231201150131.326766-2-heiko@sntech.de \
    --to=heiko@sntech.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=heiko.stuebner@cherry.de \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quentin.schulz@theobroma-systems.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

all inboxes | Powered by JetHome®