diff mbox series

[net-next,1/4] dt-bindings: net: add dt binding for realtek rtl82xx phy

Message ID 20210601090408.22025-2-qiangqing.zhang@nxp.com
State New
Headers show
Series net: phy: add dt property for realtek phy | expand

Commit Message

Joakim Zhang June 1, 2021, 9:04 a.m. UTC
Add binding for realtek rtl82xx phy.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 .../bindings/net/realtek,rtl82xx.yaml         | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml

Comments

Andrew Lunn June 2, 2021, 2:39 a.m. UTC | #1
> +properties:
> +  rtl821x,clkout-disable:
> +    description: Disable CLKOUT clock.
> +    type: boolean
> +
> +  rtl821x,aldps-disable:
> +    description: Disable ALDPS mode.
> +    type: boolean

I think most of the problems are the ambiguity in the binding.

If rtl821x,clkout-disable is not present, should it enable the CLKOUT?
That needs clear define here.

Do we actually want a tristate here?

                rtl821x,clkout = <true>;

means ensure the clock is outputting.

                rtl821x,clkout = <false>;

means ensure the clock is not outputting.

And if the property is not in DT at all, leave the hardware alone, at
either its default value, or whatever came before has set it to?

    Andrew
Joakim Zhang June 2, 2021, 3:14 a.m. UTC | #2
Hi Andrew,

> -----Original Message-----

> From: Andrew Lunn <andrew@lunn.ch>

> Sent: 2021年6月2日 10:39

> To: Joakim Zhang <qiangqing.zhang@nxp.com>

> Cc: davem@davemloft.net; kuba@kernel.org; robh+dt@kernel.org;

> hkallweit1@gmail.com; linux@armlinux.org.uk; f.fainelli@gmail.com;

> dl-linux-imx <linux-imx@nxp.com>; netdev@vger.kernel.org;

> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org

> Subject: Re: [PATCH net-next 1/4] dt-bindings: net: add dt binding for realtek

> rtl82xx phy

> 

> > +properties:

> > +  rtl821x,clkout-disable:

> > +    description: Disable CLKOUT clock.

> > +    type: boolean

> > +

> > +  rtl821x,aldps-disable:

> > +    description: Disable ALDPS mode.

> > +    type: boolean

> 

> I think most of the problems are the ambiguity in the binding.

> 

> If rtl821x,clkout-disable is not present, should it enable the CLKOUT?

> That needs clear define here.

No, don't need to, CLKOUT clock default is enabled after PHY hardware reset. Add this property for users
request to disable this clock output. I will improve the description.

> Do we actually want a tristate here?

> 

>                 rtl821x,clkout = <true>;

> 

> means ensure the clock is outputting.

> 

>                 rtl821x,clkout = <false>;

> 

> means ensure the clock is not outputting.

I think it's unnecessary. A boolean type here is enough.

> And if the property is not in DT at all, leave the hardware alone, at either its

> default value, or whatever came before has set it to?

Seems not.
1. If enable CLKOUT in boot loader or keep the hardware default value (CLKOUT enabled), DT would work with this patch.
2. If disable CLKOUT in boot loader, with this patch, driver would enable this clock if this property is not in DT.

So, I need first read PHYCR2 register, if DT has property then disable the clock, if not, keep the original value?

However, for ALDPS mode, the hardware default value is disabled. The driver enable ALDPS by default which caused issue at my side. So need a property to disable it. 

We had better add a property like " rtl821x,aldps-enable", but It seems break the existing behavior.

Best Regards,
Joakim Zhang
>     Andrew
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
new file mode 100644
index 000000000000..0075c06e39bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/realtek,rtl82xx.yaml
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: GPL-2.0+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/realtek,rtl82xx.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek RTL82xx PHY
+
+maintainers:
+  - Andrew Lunn <andrew@lunn.ch>
+  - Florian Fainelli <f.fainelli@gmail.com>
+  - Heiner Kallweit <hkallweit1@gmail.com>
+
+description:
+  Bindings for Realtek RTL82xx PHYs
+
+allOf:
+  - $ref: ethernet-phy.yaml#
+
+properties:
+  rtl821x,clkout-disable:
+    description: Disable CLKOUT clock.
+    type: boolean
+
+  rtl821x,aldps-disable:
+    description: Disable ALDPS mode.
+    type: boolean
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    mdio {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ethphy1: ethernet-phy@1 {
+                reg = <1>;
+                rtl821x,clkout-disable;
+                rtl821x,aldps-disable;
+        };
+    };