Skip to contentSkip to conversation

phy: nop-phy: add clk bulk

PATCH New Peng Fan 2 participants 2 messages Oct 15, 2020 – Oct 24, 2020 Generic PHY framework

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 phy: nop-phy: add clk bulk

Add clk bulk for nop-phy driver.

---
 drivers/phy/nop-phy.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/phy/nop-phy.c +34 -0
index a5eed20f3f..fbfbe33e4e 100644
@@ -4,17 +4,49 @@
  * Written by Jean-Jacques Hiblot  <[email protected]>
  */
 
+#include <clk.h>
 #include <common.h>
 #include <dm.h>
 #include <dm/device.h>
 #include <generic-phy.h>
 
+struct nop_phy_priv {
+	struct clk_bulk bulk;
+};
+
+static int nop_phy_init(struct phy *phy)
+{
+	struct nop_phy_priv *priv = dev_get_priv(phy->dev);
+
+	if (CONFIG_IS_ENABLED(CLK))
+		return clk_enable_bulk(&priv->bulk);
+
+	return 0;
+}
+
+static int nop_phy_probe(struct udevice *dev)
+{
+	struct nop_phy_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	if (CONFIG_IS_ENABLED(CLK)) {
+		ret = clk_get_bulk(dev, &priv->bulk);
+		if (ret < 0) {
+			dev_err(dev, "Failed to get clk: %d\n", ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
 static const struct udevice_id nop_phy_ids[] = {
 	{ .compatible = "nop-phy" },
 	{ }
 };
 
 static struct phy_ops nop_phy_ops = {
+	.init = nop_phy_init,
 };
 
 U_BOOT_DRIVER(nop_phy) = {
@@ -22,4 +54,6 @@ U_BOOT_DRIVER(nop_phy) = {
 	.id	= UCLASS_PHY,
 	.of_match = nop_phy_ids,
 	.ops = &nop_phy_ops,
+	.probe = nop_phy_probe,
+	.priv_auto_alloc_size = sizeof(struct nop_phy_priv),
 };
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 phy: nop-phy: add clk bulk

Quoted 3 lines · Peng Fan

Add clk bulk for nop-phy driver.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201024/459744de/attachment.sig>