summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-12-10 05:41:46 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-12-10 05:41:46 +0100
commit86d711f394f0449f4420819d7df000fd5f2f769b (patch)
treea81c0473d4b230a7686eac1a8a5f668762f5108a /drivers/net
parent28e374e062aede65b6bb6f341376f196e5ac4fc7 (diff)
parent55246d3136115b18133e6df8e90e0c2056893888 (diff)
downloadbarebox-86d711f394f0449f4420819d7df000fd5f2f769b.tar.gz
Merge branch 'for-next/zynq'
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/macb.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index c4ab9ef..4850e60 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))
@@ -772,6 +792,7 @@ static const struct of_device_id macb_dt_ids[] = {
{ .compatible = "cdns,at91sam9260-macb",},
{ .compatible = "atmel,sama5d2-gem",},
{ .compatible = "atmel,sama5d3-gem",},
+ { .compatible = "cdns,zynq-gem",},
{ .compatible = "cdns,zynqmp-gem",},
{ /* sentinel */ }
};