diff mbox

[v3] ARM: dts: turris-omnia: add support for ethernet switch

Message ID 20170103193501.4827-1-uwe@kleine-koenig.org (mailing list archive)
State New, archived
Headers show

Commit Message

Uwe Kleine-König Jan. 3, 2017, 7:35 p.m. UTC
The Turris Omnia features a Marvell MV88E6176 ethernet switch. Add it to
the dts.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
Changes since (implicit) v1:
 - drop mdio bus and per port phy-handle as they match the default
   setup.

Changes since v2:
 - Fix switch type in comment and commit log
 - drop 2nd cpu port

 arch/arm/boot/dts/armada-385-turris-omnia.dts | 58 +++++++++++++++++++++++++--
 1 file changed, 55 insertions(+), 3 deletions(-)

Comments

Andrew Lunn Jan. 3, 2017, 8:10 p.m. UTC | #1
On Tue, Jan 03, 2017 at 08:35:01PM +0100, Uwe Kleine-König wrote:
> The Turris Omnia features a Marvell MV88E6176 ethernet switch. Add it to
> the dts.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Andreas Färber Jan. 4, 2017, 10:49 a.m. UTC | #2
Hi Uwe,

Am 03.01.2017 um 20:35 schrieb Uwe Kleine-König:
> The Turris Omnia features a Marvell MV88E6176 ethernet switch. Add it to
> the dts.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>

It's still not working for me on next-20170104 with this v3.
Are there any other patches needed?

Should all ports LAN0-LAN4 work with the commented-out second cpu node?

I've been using the WAN port (eth2) just fine. (=eth1 in OpenWrt)

With this patch, eth0 and eth1 are shown as UP by default. If however I
enslave eth0 and eth1 in a br-lan bridge, as seen under OpenWrt for
eth0+eth2, then eth1 is DOWN while eth0 remains UP, and br-lan remains
DOWN. Same issue if I drop eth0 from the bridge - after a reboot eth1 is
UP but br-lan is still DOWN.
I had to manually enable CONFIG_BRIDGE, so maybe I'm missing more kernel
options? Or did you simply not try using a bridge?

Regards,
Andreas
Andrew Lunn Jan. 4, 2017, 1:41 p.m. UTC | #3
On Wed, Jan 04, 2017 at 11:49:12AM +0100, Andreas Färber wrote:
> Hi Uwe,
> 
> Am 03.01.2017 um 20:35 schrieb Uwe Kleine-König:
> > The Turris Omnia features a Marvell MV88E6176 ethernet switch. Add it to
> > the dts.
> > 
> > Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> 
> It's still not working for me on next-20170104 with this v3.
> Are there any other patches needed?
> 
> Should all ports LAN0-LAN4 work with the commented-out second cpu node?
> 
> I've been using the WAN port (eth2) just fine. (=eth1 in OpenWrt)
> 
> With this patch, eth0 and eth1 are shown as UP by default. If however I
> enslave eth0 and eth1 in a br-lan bridge, as seen under OpenWrt for
> eth0+eth2, then eth1 is DOWN while eth0 remains UP, and br-lan remains
> DOWN. Same issue if I drop eth0 from the bridge - after a reboot eth1 is
> UP but br-lan is still DOWN.
> I had to manually enable CONFIG_BRIDGE, so maybe I'm missing more kernel
> options? Or did you simply not try using a bridge?

That is not how you use DSA. It is very different to how OpenWRT
swconfig works. The mainline kernel philosophy is that switch
interfaces are just normal linux interfaces.

You need eth0 up, in order that the slave interfaces work. But then
you can use the slave interfaces just like normal Linux
interfaces. You can put an IP address on them. You can put them into a
bridge, etc. But leave eth0 alone, other than having it up.

	Andrew
Andreas Färber Jan. 5, 2017, 12:40 p.m. UTC | #4
Am 04.01.2017 um 14:41 schrieb Andrew Lunn:
> On Wed, Jan 04, 2017 at 11:49:12AM +0100, Andreas Färber wrote:
>> Am 03.01.2017 um 20:35 schrieb Uwe Kleine-König:
>>> The Turris Omnia features a Marvell MV88E6176 ethernet switch. Add it to
>>> the dts.
>>>
>>> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
>>
>> It's still not working for me on next-20170104 with this v3.
>> Are there any other patches needed?
[...]
>> I've been using the WAN port (eth2) just fine. (=eth1 in OpenWrt)
>>
>> With this patch, eth0 and eth1 are shown as UP by default. If however I
>> enslave eth0 and eth1 in a br-lan bridge, as seen under OpenWrt for
>> eth0+eth2, then eth1 is DOWN while eth0 remains UP, and br-lan remains
>> DOWN. Same issue if I drop eth0 from the bridge - after a reboot eth1 is
>> UP but br-lan is still DOWN.
>> I had to manually enable CONFIG_BRIDGE, so maybe I'm missing more kernel
>> options? Or did you simply not try using a bridge?
> 
> That is not how you use DSA. It is very different to how OpenWRT
> swconfig works. The mainline kernel philosophy is that switch
> interfaces are just normal linux interfaces.
> 
> You need eth0 up, in order that the slave interfaces work. But then
> you can use the slave interfaces just like normal Linux
> interfaces. You can put an IP address on them. You can put them into a
> bridge, etc. But leave eth0 alone, other than having it up.

Thanks, s/eth0/eth1/g here.

There were two hurdles, for one only eth0..eth2 were shown in our yast
tool (https://bugzilla.opensuse.org/show_bug.cgi?id=1018271), and for
another the interface name in manually written config files needed to be
just lan0 instead of lan0@eth1 as shown in ip a.

A br-lan bridge across lan0..lan4 works as expected. Great!

Tested-by: Andreas Färber <afaerber@suse.de>

Unrelated remaining issue is still the misconfigured stdout-path.

Regards,
Andreas
Gregory CLEMENT Jan. 5, 2017, 12:57 p.m. UTC | #5
Hi Uwe,
 
 On mar., janv. 03 2017, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:

> The Turris Omnia features a Marvell MV88E6176 ethernet switch. Add it to
> the dts.
>
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>

Applied on mvebu/dt with Reviewed-by flag from Andrew Lunn
<andrew@lunn.ch> and Tested-by flag from Andreas Färber.

Thanks,

Gregory
> ---
> Changes since (implicit) v1:
>  - drop mdio bus and per port phy-handle as they match the default
>    setup.
>
> Changes since v2:
>  - Fix switch type in comment and commit log
>  - drop 2nd cpu port
>
>  arch/arm/boot/dts/armada-385-turris-omnia.dts | 58 +++++++++++++++++++++++++--
>  1 file changed, 55 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> index ab49acb2d452..28eede180e4f 100644
> --- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
> @@ -122,7 +122,7 @@
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&ge0_rgmii_pins>;
>  	status = "okay";
> -	phy-mode = "rgmii-id";
> +	phy-mode = "rgmii";
>  
>  	fixed-link {
>  		speed = <1000>;
> @@ -135,7 +135,7 @@
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&ge1_rgmii_pins>;
>  	status = "okay";
> -	phy-mode = "rgmii-id";
> +	phy-mode = "rgmii";
>  
>  	fixed-link {
>  		speed = <1000>;
> @@ -273,7 +273,59 @@
>  		/* irq is connected to &pcawan pin 7 */
>  	};
>  
> -	/* Switch MV88E7176 at address 0x10 */
> +	/* Switch MV88E6176 at address 0x10 */
> +	switch@10 {
> +		compatible = "marvell,mv88e6085";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		dsa,member = <0 0>;
> +
> +		reg = <0x10>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			ports@0 {
> +				reg = <0>;
> +				label = "lan0";
> +			};
> +
> +			ports@1 {
> +				reg = <1>;
> +				label = "lan1";
> +			};
> +
> +			ports@2 {
> +				reg = <2>;
> +				label = "lan2";
> +			};
> +
> +			ports@3 {
> +				reg = <3>;
> +				label = "lan3";
> +			};
> +
> +			ports@4 {
> +				reg = <4>;
> +				label = "lan4";
> +			};
> +
> +			ports@5 {
> +				reg = <5>;
> +				label = "cpu";
> +				ethernet = <&eth1>;
> +				phy-mode = "rgmii-id";
> +
> +				fixed-link {
> +					speed = <1000>;
> +					full-duplex;
> +				};
> +			};
> +
> +			/* port 6 is connected to eth0 */
> +		};
> +	};
>  };
>  
>  &pinctrl {
> -- 
> 2.11.0
>
diff mbox

Patch

diff --git a/arch/arm/boot/dts/armada-385-turris-omnia.dts b/arch/arm/boot/dts/armada-385-turris-omnia.dts
index ab49acb2d452..28eede180e4f 100644
--- a/arch/arm/boot/dts/armada-385-turris-omnia.dts
+++ b/arch/arm/boot/dts/armada-385-turris-omnia.dts
@@ -122,7 +122,7 @@ 
 	pinctrl-names = "default";
 	pinctrl-0 = <&ge0_rgmii_pins>;
 	status = "okay";
-	phy-mode = "rgmii-id";
+	phy-mode = "rgmii";
 
 	fixed-link {
 		speed = <1000>;
@@ -135,7 +135,7 @@ 
 	pinctrl-names = "default";
 	pinctrl-0 = <&ge1_rgmii_pins>;
 	status = "okay";
-	phy-mode = "rgmii-id";
+	phy-mode = "rgmii";
 
 	fixed-link {
 		speed = <1000>;
@@ -273,7 +273,59 @@ 
 		/* irq is connected to &pcawan pin 7 */
 	};
 
-	/* Switch MV88E7176 at address 0x10 */
+	/* Switch MV88E6176 at address 0x10 */
+	switch@10 {
+		compatible = "marvell,mv88e6085";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		dsa,member = <0 0>;
+
+		reg = <0x10>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			ports@0 {
+				reg = <0>;
+				label = "lan0";
+			};
+
+			ports@1 {
+				reg = <1>;
+				label = "lan1";
+			};
+
+			ports@2 {
+				reg = <2>;
+				label = "lan2";
+			};
+
+			ports@3 {
+				reg = <3>;
+				label = "lan3";
+			};
+
+			ports@4 {
+				reg = <4>;
+				label = "lan4";
+			};
+
+			ports@5 {
+				reg = <5>;
+				label = "cpu";
+				ethernet = <&eth1>;
+				phy-mode = "rgmii-id";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+				};
+			};
+
+			/* port 6 is connected to eth0 */
+		};
+	};
 };
 
 &pinctrl {