mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
50 lines
1.4 KiB
Diff
50 lines
1.4 KiB
Diff
From d91c466ec19e5ced30631cec703164c79525b986 Mon Sep 17 00:00:00 2001
|
|
From: Robert Marko <robert.marko@sartura.hr>
|
|
Date: Sun, 27 Dec 2020 18:55:56 +0100
|
|
Subject: [PATCH] net: mdio-ipq4019: add clock handling
|
|
|
|
Newer SoC-s like IPQ807x and IPQ60xx use the same MDIO controller,
|
|
but have separate MDIO clocks that need to be handled.
|
|
So lets add support for doing that.
|
|
|
|
Signed-off-by: Robert Marko <robert.marko@sartura.hr>
|
|
---
|
|
drivers/net/mdio/mdio-ipq4019.c | 12 ++++++++++++
|
|
1 file changed, 12 insertions(+)
|
|
|
|
--- a/drivers/net/mdio/mdio-ipq4019.c
|
|
+++ b/drivers/net/mdio/mdio-ipq4019.c
|
|
@@ -2,6 +2,7 @@
|
|
/* Copyright (c) 2015, The Linux Foundation. All rights reserved. */
|
|
/* Copyright (c) 2020 Sartura Ltd. */
|
|
|
|
+#include <linux/clk.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
@@ -33,6 +34,7 @@
|
|
|
|
struct ipq4019_mdio_data {
|
|
void __iomem *membase;
|
|
+ struct clk *clk;
|
|
};
|
|
|
|
static int ipq4019_mdio_wait_busy(struct mii_bus *bus)
|
|
@@ -187,6 +189,16 @@ static int ipq4019_mdio_probe(struct pla
|
|
if (IS_ERR(priv->membase))
|
|
return PTR_ERR(priv->membase);
|
|
|
|
+ priv->clk = devm_clk_get_optional(&pdev->dev, "mdio_ahb");
|
|
+ if (IS_ERR(priv->clk)) {
|
|
+ dev_err(&pdev->dev, "Failed getting clock!\n");
|
|
+ return PTR_ERR(priv->clk);
|
|
+ }
|
|
+
|
|
+ ret = clk_prepare_enable(priv->clk);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
bus->name = "ipq4019_mdio";
|
|
bus->read = ipq4019_mdio_read;
|
|
bus->write = ipq4019_mdio_write;
|