Message ID | 20200618064029.32168-10-kurt@linutronix.de |
---|---|
State | RFC |
Delegated to: | David Miller |
Headers | show |
Series | Hirschmann Hellcreek DSA driver | expand |
> +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
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.
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
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
> > 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
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
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
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
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
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 --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>; + }; + }; +};
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