diff mbox series

[V2,1/4] dt-bindings: net: renesas,etheravb: Add additional clocks

Message ID 20210115201953.443710-1-aford173@gmail.com
State Superseded
Headers show
Series [V2,1/4] dt-bindings: net: renesas,etheravb: Add additional clocks | expand

Commit Message

Adam Ford Jan. 15, 2021, 8:19 p.m. UTC
The AVB driver assumes there is an external crystal, but it could
be clocked by other means.  In order to enable a programmable
clock, it needs to be added to the clocks list and enabled in the
driver.  Since there currently only one clock, there is no
clock-names list either.

Update bindings to add the additional optional clock, and explicitly
name both of them.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../devicetree/bindings/net/renesas,etheravb.yaml     | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

V2:  Change name from TXC Refclock to refclock
     The r-b and a-b notes were pulled from patchwork.

Comments

Sergei Shtylyov Jan. 16, 2021, 9:55 a.m. UTC | #1
Hello!

On 15.01.2021 23:19, Adam Ford wrote:

> For devices that use a programmable clock for the avb reference clock,


    AVB.

> the driver may need to enable them.  Add code to find the optional clock

> and enable it when available.

> 

> Signed-off-by: Adam Ford <aford173@gmail.com>

[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c

> index bd30505fbc57..739e30f45daa 100644

> --- a/drivers/net/ethernet/renesas/ravb_main.c

> +++ b/drivers/net/ethernet/renesas/ravb_main.c

> @@ -2148,6 +2148,14 @@ static int ravb_probe(struct platform_device *pdev)

>   		goto out_release;

>   	}

>   

> +	priv->refclk = devm_clk_get_optional(&pdev->dev, "refclk");

> +	if (IS_ERR(priv->refclk)) {

> +		error = PTR_ERR(priv->refclk);

> +		goto out_release;

> +	} else {


    No need for *else* after *goto*.

> +		(void)clk_prepare_enable(priv->refclk);


    You can really omit (void)...
    Also, I'm not seeing where do you call clk_disable_unprepare()...

[...]

MBR, Sergei
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
index 244befb6402a..9f84d9c6f141 100644
--- a/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
+++ b/Documentation/devicetree/bindings/net/renesas,etheravb.yaml
@@ -49,7 +49,16 @@  properties:
   interrupt-names: true
 
   clocks:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: AVB functional clock
+      - description: Optional reference clock
+
+  clock-names:
+    items:
+      - const: fck
+      - const: refclk
 
   iommus:
     maxItems: 1