All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 08/13] net: ftgmac100: add clock support
Date: Mon, 29 Oct 2018 07:06:36 +0100	[thread overview]
Message-ID: <20181029060641.13824-9-clg@kaod.org> (raw)
In-Reply-To: <20181029060641.13824-1-clg@kaod.org>

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/ftgmac100.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index ec46add1d35c..798977616756 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -11,6 +11,7 @@
  * Copyright (C) 2018, IBM Corporation.
  */
 
+#include <clk.h>
 #include <dm.h>
 #include <miiphy.h>
 #include <net.h>
@@ -55,6 +56,7 @@
  * @bus: The mdio bus
  * @phy_mode: The mode of the PHY interface (rgmii, rmii, ...)
  * @max_speed: Maximum speed of Ethernet connection supported by MAC
+ * @clks: The bulk of clocks assigned to the device in the DT
  */
 struct ftgmac100_data {
 	struct ftgmac100 *iobase;
@@ -69,6 +71,8 @@ struct ftgmac100_data {
 	struct mii_dev *bus;
 	u32 phy_mode;
 	u32 max_speed;
+
+	struct clk_bulk clks;
 };
 
 /*
@@ -489,6 +493,7 @@ static int ftgmac100_write_hwaddr(struct udevice *dev)
 static int ftgmac100_ofdata_to_platdata(struct udevice *dev)
 {
 	struct eth_pdata *pdata = dev_get_platdata(dev);
+	struct ftgmac100_data *priv = dev_get_priv(dev);
 	const char *phy_mode;
 
 	pdata->iobase = devfdt_get_addr(dev);
@@ -503,7 +508,7 @@ static int ftgmac100_ofdata_to_platdata(struct udevice *dev)
 
 	pdata->max_speed = dev_read_u32_default(dev, "max-speed", 0);
 
-	return 0;
+	return clk_get_bulk(dev, &priv->clks);
 }
 
 static int ftgmac100_probe(struct udevice *dev)
@@ -517,6 +522,10 @@ static int ftgmac100_probe(struct udevice *dev)
 	priv->max_speed = pdata->max_speed;
 	priv->phy_addr = 0;
 
+	ret = clk_enable_bulk(&priv->clks);
+	if (ret)
+		goto out;
+
 	ret = ftgmac100_mdio_init(dev);
 	if (ret) {
 		dev_err(dev, "Failed to initialize mdiobus: %d\n", ret);
@@ -530,6 +539,9 @@ static int ftgmac100_probe(struct udevice *dev)
 	}
 
 out:
+	if (ret)
+		clk_release_bulk(&priv->clks);
+
 	return ret;
 }
 
@@ -540,6 +552,7 @@ static int ftgmac100_remove(struct udevice *dev)
 	free(priv->phydev);
 	mdio_unregister(priv->bus);
 	mdio_free(priv->bus);
+	clk_release_bulk(&priv->clks);
 
 	return 0;
 }
-- 
2.17.2

  parent reply	other threads:[~2018-10-29  6:06 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29  6:06 [U-Boot] [PATCH v5 00/13] Support for the Faraday ftgmac100 controller Cédric Le Goater
2018-10-29  6:06 ` [U-Boot] [PATCH v5 01/13] net: ftgmac100: use the BIT() macro Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 02/13] net: ftgmac100: use the aligned() macro Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 03/13] net: ftgmac100: convert to driver model Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 04/13] net: ftgmac100: use setbits_le32() in the reset method Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 05/13] net: ftgmac100: add MDIO bus and phylib support Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 06/13] net: ftgmac100: convert the RX/TX descriptor arrays Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 07/13] net: ftgmac100: handle timeouts when transmitting Cédric Le Goater
2018-10-29 19:23   ` Joe Hershberger
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` Cédric Le Goater [this message]
2018-11-05 17:53   ` [U-Boot] net: ftgmac100: add clock support Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 09/13] aspeed: ast2500: fix missing break in D2PLL clock enablement Cédric Le Goater
2018-11-05 17:53   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 10/13] net: ftgmac100: Add support for the Aspeed SoC Cédric Le Goater
2018-11-05 17:54   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 11/13] aspeed: Update ast2500 SoC DTS file to Linux v4.17-rc6 level Cédric Le Goater
2018-11-05 17:54   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 12/13] aspeed: Activate ethernet devices on the ast2500 Eval Board Cédric Le Goater
2018-11-05 17:54   ` [U-Boot] " Joe Hershberger
2018-10-29  6:06 ` [U-Boot] [PATCH v5 13/13] aspeed: ast2500: fix D2-PLL clock setting in RGMII mode Cédric Le Goater
2018-11-05 17:54   ` [U-Boot] " Joe Hershberger

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=20181029060641.13824-9-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.