diff mbox series

[RFC,9/9] dt-bindings: net: dsa: Add documentation for Hellcreek switches

Message ID 20200618064029.32168-10-kurt@linutronix.de
State Superseded
Headers show
Series Hirschmann Hellcreek DSA driver | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 1 warnings, 72 lines checked

Commit Message

Kurt Kanzenbach June 18, 2020, 6:40 a.m. UTC
Add basic documentation and example.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 .../devicetree/bindings/net/dsa/hellcreek.txt | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.txt

Comments

Andrew Lunn June 18, 2020, 1:47 p.m. UTC | #1
> +Ethernet switch connected memory mapped to the host, CPU port wired to gmac0:
> +
> +soc {
> +        switch0: switch@0xff240000 {
> +                compatible = "hirschmann,hellcreek";
> +                status = "okay";
> +                reg = <0xff240000 0x1000   /* TSN base */
> +                       0xff250000 0x1000>; /* PTP base */
> +                dsa,member = <0 0>;
> +
> +                ports {
> +                        #address-cells = <1>;
> +                        #size-cells = <0>;
> +
> +                        port@0 {
> +                                reg = <0>;
> +                                label = "cpu";
> +                                ethernet = <&gmac0>;
> +                        };
> +
> +                        port@2 {
> +                                reg = <2>;
> +                                label = "lan0";
> +                                phy-handle = <&phy1>;
> +                        };
> +
> +                        port@3 {
> +                                reg = <3>;
> +                                label = "lan1";
> +                                phy-handle = <&phy2>;
> +                        };
> +                };
> +        };
> +};
> +
> +&gmac0 {
> +        status = "okay";
> +        phy-mode = "mii";
> +
> +        fixed-link {
> +                speed = <100>;
> +                full-duplex;

Hi Kurt

The switch is 100/100Mbps right? The MAC is only Fast ethernet. Do you
need some properties in the port@0 node to tell the switch to only use
100Mbps? I would expect it to default to 1G. Not looked at the code
yet...

	Andrew
Florian Fainelli June 18, 2020, 5:40 p.m. UTC | #2
On 6/17/2020 11:40 PM, Kurt Kanzenbach wrote:
> Add basic documentation and example.
> 
> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
> ---
>  .../devicetree/bindings/net/dsa/hellcreek.txt | 72 +++++++++++++++++++
>  1 file changed, 72 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.txt
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/hellcreek.txt b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
> new file mode 100644
> index 000000000000..9ea6494dc554
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt

This should be a YAML binding and we should also convert the DSA binding
to YAML one day.

> @@ -0,0 +1,72 @@
> +Hirschmann hellcreek switch driver
> +==================================
> +
> +Required properties:
> +
> +- compatible:
> +	Must be one of:
> +	- "hirschmann,hellcreek"
> +
> +See Documentation/devicetree/bindings/net/dsa/dsa.txt for the list of standard
> +DSA required and optional properties.
> +
> +Example
> +-------
> +
> +Ethernet switch connected memory mapped to the host, CPU port wired to gmac0:
> +
> +soc {
> +        switch0: switch@0xff240000 {

Please remove the leading 0x from the unit address.
Kurt Kanzenbach June 19, 2020, 8:47 a.m. UTC | #3
Hi Andrew,

On Thu Jun 18 2020, Andrew Lunn wrote:
>> +Ethernet switch connected memory mapped to the host, CPU port wired to gmac0:
>> +
>> +soc {
>> +        switch0: switch@0xff240000 {
>> +                compatible = "hirschmann,hellcreek";
>> +                status = "okay";
>> +                reg = <0xff240000 0x1000   /* TSN base */
>> +                       0xff250000 0x1000>; /* PTP base */
>> +                dsa,member = <0 0>;
>> +
>> +                ports {
>> +                        #address-cells = <1>;
>> +                        #size-cells = <0>;
>> +
>> +                        port@0 {
>> +                                reg = <0>;
>> +                                label = "cpu";
>> +                                ethernet = <&gmac0>;
>> +                        };
>> +
>> +                        port@2 {
>> +                                reg = <2>;
>> +                                label = "lan0";
>> +                                phy-handle = <&phy1>;
>> +                        };
>> +
>> +                        port@3 {
>> +                                reg = <3>;
>> +                                label = "lan1";
>> +                                phy-handle = <&phy2>;
>> +                        };
>> +                };
>> +        };
>> +};
>> +
>> +&gmac0 {
>> +        status = "okay";
>> +        phy-mode = "mii";
>> +
>> +        fixed-link {
>> +                speed = <100>;
>> +                full-duplex;
>
> Hi Kurt
>
> The switch is 100/100Mbps right? The MAC is only Fast ethernet. Do you
> need some properties in the port@0 node to tell the switch to only use
> 100Mbps? I would expect it to default to 1G. Not looked at the code
> yet...

No, that is not needed. That is a hardware configuration and AFAIK
cannot be changed at run time.

Thanks,
Kurt
Kurt Kanzenbach June 19, 2020, 8:48 a.m. UTC | #4
Hi Florian,

On Thu Jun 18 2020, Florian Fainelli wrote:
> On 6/17/2020 11:40 PM, Kurt Kanzenbach wrote:
>> Add basic documentation and example.
>> 
>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>> ---
>>  .../devicetree/bindings/net/dsa/hellcreek.txt | 72 +++++++++++++++++++
>>  1 file changed, 72 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>> 
>> diff --git a/Documentation/devicetree/bindings/net/dsa/hellcreek.txt b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>> new file mode 100644
>> index 000000000000..9ea6494dc554
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>
> This should be a YAML binding and we should also convert the DSA binding
> to YAML one day.

OK.

>
>> @@ -0,0 +1,72 @@
>> +Hirschmann hellcreek switch driver
>> +==================================
>> +
>> +Required properties:
>> +
>> +- compatible:
>> +	Must be one of:
>> +	- "hirschmann,hellcreek"
>> +
>> +See Documentation/devicetree/bindings/net/dsa/dsa.txt for the list of standard
>> +DSA required and optional properties.
>> +
>> +Example
>> +-------
>> +
>> +Ethernet switch connected memory mapped to the host, CPU port wired to gmac0:
>> +
>> +soc {
>> +        switch0: switch@0xff240000 {
>
> Please remove the leading 0x from the unit address.

Sure.

Thanks,
Kurt
Andrew Lunn June 19, 2020, 1:56 p.m. UTC | #5
> > The switch is 100/100Mbps right? The MAC is only Fast ethernet. Do you
> > need some properties in the port@0 node to tell the switch to only use
> > 100Mbps? I would expect it to default to 1G. Not looked at the code
> > yet...
> 
> No, that is not needed. That is a hardware configuration and AFAIK
> cannot be changed at run time.

I was wondering about that in general. I did not spot any code in the
driver dealing with results from the PHY auto-neg. So you are saying
the CPU is fixed speed, by strapping? But what about the other ports?
Does the MAC need to know the PHY has negotiated 10Half, not 1G? Would
that not make a difference to your TSN?

     Andrew
Kurt Kanzenbach June 22, 2020, 12:02 p.m. UTC | #6
On Fri Jun 19 2020, Andrew Lunn wrote:
>> > The switch is 100/100Mbps right? The MAC is only Fast ethernet. Do you
>> > need some properties in the port@0 node to tell the switch to only use
>> > 100Mbps? I would expect it to default to 1G. Not looked at the code
>> > yet...
>> 
>> No, that is not needed. That is a hardware configuration and AFAIK
>> cannot be changed at run time.
>
> I was wondering about that in general. I did not spot any code in the
> driver dealing with results from the PHY auto-neg. So you are saying
> the CPU is fixed speed, by strapping? But what about the other ports?
> Does the MAC need to know the PHY has negotiated 10Half, not 1G? Would
> that not make a difference to your TSN?

Indeed, that does make a difference. I've checked with the vendor. The
current version of the switch IP does not support configuring the speed
etc. at run time. It is hard wired to 100 Mbit/s or 1000 Mbit/s for
now. Later versions of the chip might support setting the speed etc. via
configuration registers. As a result the PHYs at the front ports should
be programmed to only advertise 100 Mbit/s or 1G depending on the
hardware setup.

Thanks,
Kurt
Kurt Kanzenbach June 22, 2020, 12:05 p.m. UTC | #7
On Fri Jun 19 2020, Kurt Kanzenbach wrote:
> On Thu Jun 18 2020, Florian Fainelli wrote:
>> On 6/17/2020 11:40 PM, Kurt Kanzenbach wrote:
>>> Add basic documentation and example.
>>> 
>>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>>> ---
>>>  .../devicetree/bindings/net/dsa/hellcreek.txt | 72 +++++++++++++++++++
>>>  1 file changed, 72 insertions(+)
>>>  create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>>> 
>>> diff --git a/Documentation/devicetree/bindings/net/dsa/hellcreek.txt b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>>> new file mode 100644
>>> index 000000000000..9ea6494dc554
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>>
>> This should be a YAML binding and we should also convert the DSA binding
>> to YAML one day.
>
> OK.

I converted it into a YAML binding. Should I provide the dsa.yaml as
well? Otherwise I have to define the DSA properties such as dsa,member
in the hellcreek.yaml file.

Thanks,
Kurt
Andrew Lunn June 22, 2020, 1:49 p.m. UTC | #8
On Mon, Jun 22, 2020 at 02:02:19PM +0200, Kurt Kanzenbach wrote:
> On Fri Jun 19 2020, Andrew Lunn wrote:
> >> > The switch is 100/100Mbps right? The MAC is only Fast ethernet. Do you
> >> > need some properties in the port@0 node to tell the switch to only use
> >> > 100Mbps? I would expect it to default to 1G. Not looked at the code
> >> > yet...
> >> 
> >> No, that is not needed. That is a hardware configuration and AFAIK
> >> cannot be changed at run time.
> >
> > I was wondering about that in general. I did not spot any code in the
> > driver dealing with results from the PHY auto-neg. So you are saying
> > the CPU is fixed speed, by strapping? But what about the other ports?
> > Does the MAC need to know the PHY has negotiated 10Half, not 1G? Would
> > that not make a difference to your TSN?
> 
> Indeed, that does make a difference. I've checked with the vendor. The
> current version of the switch IP does not support configuring the speed
> etc. at run time. It is hard wired to 100 Mbit/s or 1000 Mbit/s for
> now. Later versions of the chip might support setting the speed etc. via
> configuration registers. As a result the PHYs at the front ports should
> be programmed to only advertise 100 Mbit/s or 1G depending on the
> hardware setup.

Hi Kurt

Are there registers which allow you to determine the strapping? There
are phylib/phylink calls you can make to set the advertisement in the
PHY. It would be good to do this in the DSA driver.

     Andrew
Kurt Kanzenbach June 23, 2020, 6:09 a.m. UTC | #9
On Mon Jun 22 2020, Andrew Lunn wrote:
> On Mon, Jun 22, 2020 at 02:02:19PM +0200, Kurt Kanzenbach wrote:
>> On Fri Jun 19 2020, Andrew Lunn wrote:
>> >> > The switch is 100/100Mbps right? The MAC is only Fast ethernet. Do you
>> >> > need some properties in the port@0 node to tell the switch to only use
>> >> > 100Mbps? I would expect it to default to 1G. Not looked at the code
>> >> > yet...
>> >> 
>> >> No, that is not needed. That is a hardware configuration and AFAIK
>> >> cannot be changed at run time.
>> >
>> > I was wondering about that in general. I did not spot any code in the
>> > driver dealing with results from the PHY auto-neg. So you are saying
>> > the CPU is fixed speed, by strapping? But what about the other ports?
>> > Does the MAC need to know the PHY has negotiated 10Half, not 1G? Would
>> > that not make a difference to your TSN?
>> 
>> Indeed, that does make a difference. I've checked with the vendor. The
>> current version of the switch IP does not support configuring the speed
>> etc. at run time. It is hard wired to 100 Mbit/s or 1000 Mbit/s for
>> now. Later versions of the chip might support setting the speed etc. via
>> configuration registers. As a result the PHYs at the front ports should
>> be programmed to only advertise 100 Mbit/s or 1G depending on the
>> hardware setup.
>
> Hi Kurt
>
> Are there registers which allow you to determine the strapping?

No, there are not.

> There are phylib/phylink calls you can make to set the advertisement
> in the PHY. It would be good to do this in the DSA driver.

I will. All the chips currently available are configured to 100
Mbit/s. So, we can assume that for now.

Thanks,
Kurt
Florian Fainelli June 26, 2020, 5:11 p.m. UTC | #10
On 6/22/20 5:05 AM, Kurt Kanzenbach wrote:
> On Fri Jun 19 2020, Kurt Kanzenbach wrote:
>> On Thu Jun 18 2020, Florian Fainelli wrote:
>>> On 6/17/2020 11:40 PM, Kurt Kanzenbach wrote:
>>>> Add basic documentation and example.
>>>>
>>>> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
>>>> ---
>>>>  .../devicetree/bindings/net/dsa/hellcreek.txt | 72 +++++++++++++++++++
>>>>  1 file changed, 72 insertions(+)
>>>>  create mode 100644 Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/net/dsa/hellcreek.txt b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>>>> new file mode 100644
>>>> index 000000000000..9ea6494dc554
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
>>>
>>> This should be a YAML binding and we should also convert the DSA binding
>>> to YAML one day.
>>
>> OK.
> 
> I converted it into a YAML binding. Should I provide the dsa.yaml as
> well? Otherwise I have to define the DSA properties such as dsa,member
> in the hellcreek.yaml file.

If you have the generic DSA binding converted as YAML that would be
highly welcome you can submit that separately from your patch series.

There are quite a few Device Tree sources in tree that can be used as a
validation vector for dsa.yaml.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/hellcreek.txt b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
new file mode 100644
index 000000000000..9ea6494dc554
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/dsa/hellcreek.txt
@@ -0,0 +1,72 @@ 
+Hirschmann hellcreek switch driver
+==================================
+
+Required properties:
+
+- compatible:
+	Must be one of:
+	- "hirschmann,hellcreek"
+
+See Documentation/devicetree/bindings/net/dsa/dsa.txt for the list of standard
+DSA required and optional properties.
+
+Example
+-------
+
+Ethernet switch connected memory mapped to the host, CPU port wired to gmac0:
+
+soc {
+        switch0: switch@0xff240000 {
+                compatible = "hirschmann,hellcreek";
+                status = "okay";
+                reg = <0xff240000 0x1000   /* TSN base */
+                       0xff250000 0x1000>; /* PTP base */
+                dsa,member = <0 0>;
+
+                ports {
+                        #address-cells = <1>;
+                        #size-cells = <0>;
+
+                        port@0 {
+                                reg = <0>;
+                                label = "cpu";
+                                ethernet = <&gmac0>;
+                        };
+
+                        port@2 {
+                                reg = <2>;
+                                label = "lan0";
+                                phy-handle = <&phy1>;
+                        };
+
+                        port@3 {
+                                reg = <3>;
+                                label = "lan1";
+                                phy-handle = <&phy2>;
+                        };
+                };
+        };
+};
+
+&gmac0 {
+        status = "okay";
+        phy-mode = "mii";
+
+        fixed-link {
+                speed = <100>;
+                full-duplex;
+        };
+
+        mdio {
+                #address-cells = <1>;
+                #size-cells = <0>;
+                compatible = "snps,dwmac-mdio";
+
+                phy1: ethernet-phy@1 {
+                        reg = <1>;
+                };
+                phy2: ethernet-phy@2 {
+                        reg = <2>;
+                };
+        };
+};