linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] ravb: Add support for optional txc_refclk
@ 2020-12-12 16:56 Adam Ford
  2020-12-12 17:54 ` Sergei Shtylyov
  2020-12-14 10:05 ` Geert Uytterhoeven
  0 siblings, 2 replies; 6+ messages in thread
From: Adam Ford @ 2020-12-12 16:56 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: aford, charles.stevens, Adam Ford, Sergei Shtylyov,
	David S. Miller, Jakub Kicinski, netdev, linux-kernel

The SoC expects the txv_refclk is provided, but if it is provided
by a programmable clock, there needs to be a way to get and enable
this clock to operate.  It needs to be optional since it's only
necessary for those with programmable clocks.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 7453b17a37a2..ddf3bc5164d2 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -994,6 +994,7 @@ struct ravb_private {
 	struct platform_device *pdev;
 	void __iomem *addr;
 	struct clk *clk;
+	struct clk *ref_clk;
 	struct mdiobb_ctrl mdiobb;
 	u32 num_rx_ring[NUM_RX_QUEUE];
 	u32 num_tx_ring[NUM_TX_QUEUE];
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index bd30505fbc57..4c3f95923ef2 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2148,6 +2148,18 @@ static int ravb_probe(struct platform_device *pdev)
 		goto out_release;
 	}
 
+	priv->ref_clk = devm_clk_get(&pdev->dev, "txc_refclk");
+	if (IS_ERR(priv->ref_clk)) {
+		if (PTR_ERR(priv->ref_clk) == -EPROBE_DEFER) {
+			/* for Probe defer return error */
+			error = PTR_ERR(priv->ref_clk);
+			goto out_release;
+		}
+		/* Ignore other errors since it's optional */
+	} else {
+		(void)clk_prepare_enable(priv->ref_clk);
+	}
+
 	ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
 	ndev->min_mtu = ETH_MIN_MTU;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-28 16:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12 16:56 [RFC] ravb: Add support for optional txc_refclk Adam Ford
2020-12-12 17:54 ` Sergei Shtylyov
2020-12-12 19:38   ` Adam Ford
2020-12-14 10:05 ` Geert Uytterhoeven
2020-12-28 13:49   ` Adam Ford
2020-12-28 16:17     ` Geert Uytterhoeven

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).