mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 07/18] net: macb: handle more clocks
Date: Thu,  7 Nov 2019 22:11:08 +0100	[thread overview]
Message-ID: <20191107211119.68064-8-dev@lynxeye.de> (raw)
In-Reply-To: <20191107211119.68064-1-dev@lynxeye.de>

Both pclk and hclk are required clocks in the DT binding.
rx_clk and tx_clk are optional, but must be enabled if a system
has separate gates for them.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 drivers/net/macb.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index c4ab9efb639c..df1e606454b1 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -69,7 +69,7 @@ struct macb_device {
 
 	int			phy_addr;
 
-	struct clk		*pclk;
+	struct clk		*pclk, *hclk, *txclk, *rxclk;
 	const struct device_d	*dev;
 	struct eth_device	netdev;
 
@@ -653,7 +653,7 @@ static int macb_probe(struct device_d *dev)
 	struct resource *iores;
 	struct eth_device *edev;
 	struct macb_device *macb;
-	const char *pclk_name;
+	const char *pclk_name, *hclk_name;
 	u32 ncfgr;
 
 	macb = xzalloc(sizeof(*macb));
@@ -689,6 +689,7 @@ static int macb_probe(struct device_d *dev)
 		macb->phy_addr = pdata->phy_addr;
 		macb->phy_flags = pdata->phy_flags;
 		pclk_name = "macb_clk";
+		hclk_name = NULL;
 	} else if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node) {
 		int ret;
 		struct device_node *mdiobus;
@@ -705,6 +706,7 @@ static int macb_probe(struct device_d *dev)
 
 		macb->phy_addr = -1;
 		pclk_name = "pclk";
+		hclk_name = "hclk";
 	} else {
 		dev_err(dev, "macb: no platform_data\n");
 		return -ENODEV;
@@ -727,6 +729,24 @@ static int macb_probe(struct device_d *dev)
 
 	clk_enable(macb->pclk);
 
+	if (hclk_name) {
+		macb->hclk = clk_get(dev, pclk_name);
+		if (IS_ERR(macb->pclk)) {
+			dev_err(dev, "no hclk\n");
+			return PTR_ERR(macb->hclk);
+		}
+
+		clk_enable(macb->hclk);
+	}
+
+	macb->txclk = clk_get(dev, "tx_clk");
+	if (!IS_ERR(macb->txclk))
+		clk_enable(macb->txclk);
+
+	macb->rxclk = clk_get(dev, "rx_clk");
+	if (!IS_ERR(macb->rxclk))
+		clk_enable(macb->rxclk);
+
 	macb->is_gem = read_is_gem(macb);
 
 	if (macb_is_gem(macb))
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2019-11-07 21:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 21:11 [PATCH 00/18] Zynq multi-image conversion and improvements Lucas Stach
2019-11-07 21:11 ` [PATCH 01/18] ARM: zynq: zedboard: enable MACB driver in defconfig Lucas Stach
2019-11-07 21:11 ` [PATCH 02/18] ARM: zynq: add trivial image build mechanism Lucas Stach
2019-11-07 21:11 ` [PATCH 03/18] ARM: zynq: use getopt in zynq_mkimage Lucas Stach
2019-11-07 21:11 ` [PATCH 04/18] ARM: zynq: move header generation to zynq_mkimage Lucas Stach
2019-11-07 21:11 ` [PATCH 05/18] ARM: zynq: add size check in zynq_mkimage Lucas Stach
2019-11-07 21:11 ` [PATCH 06/18] ARM: zynq: zedboard: provide DTB Lucas Stach
2019-11-07 21:11 ` Lucas Stach [this message]
2019-11-07 21:11 ` [PATCH 08/18] net: macb: add Zynq compatible Lucas Stach
2019-11-07 21:11 ` [PATCH 09/18] ARM: zynq: move clock controller driver to drivers/clk Lucas Stach
2019-11-07 21:11 ` [PATCH 10/18] clk: zynq: use base address of clock controller Lucas Stach
2019-11-07 21:11 ` [PATCH 11/18] ARM: zynq: fixup SLCR ranges Lucas Stach
2019-11-08  7:16   ` Sascha Hauer
2019-11-07 21:11 ` [PATCH 12/18] clk: zynq: improve PLL enable handling Lucas Stach
2019-11-07 21:11 ` [PATCH 13/18] clk: zynq: partially sync with Linux Lucas Stach
2019-11-07 21:11 ` [PATCH 14/18] ARM: zynq: switch to DT based probing Lucas Stach
2019-11-07 21:11 ` [PATCH 15/18] clk: zynq: remove clkdevs Lucas Stach
2019-11-07 21:11 ` [PATCH 16/18] ARM: zynq: switch to multi-image build Lucas Stach
2019-11-07 21:11 ` [PATCH 17/18] bootsource: add JTAG bootsource Lucas Stach
2019-11-07 21:11 ` [PATCH 18/18] ARM: zynq: add bootsource detection Lucas Stach

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=20191107211119.68064-8-dev@lynxeye.de \
    --to=dev@lynxeye.de \
    --cc=barebox@lists.infradead.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