kirkwood: switch from swconfig to dsa
authorPawel Dembicki <paweldembicki@gmail.com>
Mon, 20 Apr 2020 08:06:36 +0000 (10:06 +0200)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Tue, 28 Apr 2020 14:49:31 +0000 (16:49 +0200)
This patch removes support for swconfig and switches to dsa driver.

swconfig and switch drivers are removed. DSA driver is enabled and
configuration is adjusted.

In kirkwood only two devices have switches: Linksys EA3500 and EA4500.

WAN MAC configuration in 02_network is required because otherwise WAN
would have the same MAC address as lan interfaces. In swconfig solution
the WAN address was assigned in u-Boot to eth1. Now, as eth1 is disabled
and wan is part of the switch, we have to set it manually.

Compile tested: EA3500, EA4500
Run tested: EA4500

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[minor commit title/message adjustments, remove swconfig package
for devices]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/kirkwood/base-files/etc/board.d/02_network
target/linux/kirkwood/config-5.4
target/linux/kirkwood/files-5.4/arch/arm/boot/dts/kirkwood-linksys-audi.dts
target/linux/kirkwood/image/Makefile
target/linux/kirkwood/patches-5.4/105-ea4500.patch
target/linux/kirkwood/profiles/00-default.mk

index 15e51d8..df01b0b 100755 (executable)
@@ -26,8 +26,8 @@ case "$board" in
        ;;
 "linksys,audi"|\
 "linksys,viper")
-       ucidef_add_switch "switch0" \
-               "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1"
+       ucidef_set_interfaces_lan_wan "ethernet1 ethernet2 ethernet3 ethernet4" "internet"
+       ucidef_set_interface_macaddr "wan" $( mtd_get_mac_ascii u_env eth1addr )
        ;;
 "zyxel,nsa310b"|\
 "zyxel,nsa325")
index e149631..c14ca37 100644 (file)
@@ -245,10 +245,17 @@ CONFIG_MVEBU_MBUS=y
 CONFIG_MVMDIO=y
 # CONFIG_MVNETA is not set
 # CONFIG_MVPP2 is not set
-CONFIG_MVSW61XX_PHY=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_KUSER_HELPERS=y
 CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NET_DEVLINK=y
+CONFIG_NET_DSA=y
+CONFIG_NET_DSA_MV88E6XXX=y
+CONFIG_NET_DSA_MV88E6XXX_GLOBAL2=y
+# CONFIG_NET_DSA_MV88E6XXX_PTP is not set
+CONFIG_NET_DSA_TAG_DSA=y
+CONFIG_NET_DSA_TAG_EDSA=y
+CONFIG_NET_SWITCHDEV=y
 CONFIG_NLS=y
 CONFIG_NVMEM=y
 # CONFIG_NVMEM_REBOOT_MODE is not set
@@ -276,6 +283,7 @@ CONFIG_PCI_MVEBU=y
 CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PGTABLE_LEVELS=2
 CONFIG_PHYLIB=y
+CONFIG_PHYLINK=y
 # CONFIG_PHY_MVEBU_A3700_UTMI is not set
 # CONFIG_PHY_MVEBU_A38X_COMPHY is not set
 CONFIG_PHY_MVEBU_SATA=y
@@ -317,7 +325,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=999999
 CONFIG_SRAM=y
 CONFIG_SRAM_EXEC=y
 CONFIG_SRCU=y
-CONFIG_SWCONFIG=y
 CONFIG_SWPHY=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
 CONFIG_THERMAL=y
index eff9102..90250fe 100644 (file)
                        default-state = "on";
                };
        };
-
-       mvsw61xx {
-               compatible = "marvell,88e6171";
-               status = "okay";
-               reg = <0x10>;
-
-               mii-bus = <&mdio>;
-               cpu-port-0 = <5>;
-               cpu-port-1 = <6>;
-               is-indirect;
-       };
 };
 
 &pinctrl {
        };
 };
 
+&mdio {
+       status = "okay";
+
+       switch@10 {
+               compatible = "marvell,mv88e6085";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               reg = <16>;
+
+               ports {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+
+                       port@0 {
+                               reg = <0>;
+                               label = "ethernet1";
+                       };
+
+                       port@1 {
+                               reg = <1>;
+                               label = "ethernet2";
+                       };
+
+                       port@2 {
+                               reg = <2>;
+                               label = "ethernet3";
+                       };
+
+                       port@3 {
+                               reg = <3>;
+                               label = "ethernet4";
+                       };
+
+                       port@4 {
+                               reg = <4>;
+                               label = "internet";
+                       };
+
+                       port@5 {
+                               reg = <5>;
+                               label = "cpu";
+                               ethernet = <&eth0port>;
+                               fixed-link {
+                                       speed = <1000>;
+                                       full-duplex;
+                               };
+                       };
+               };
+       };
+};
+
 &nand {
        status = "okay";
 
 };
 
 /* eth1 is connected to the switch at port 6. However DSA only supports a
- * single CPU port. Upstream uses DSA so they disable this port to avoid confusion.
+ * single CPU port. This port is disabled to avoid confusion.
  */
 &eth1 {
-       status = "okay";
-
-       ethernet1-port@0 {
-               speed = <1000>;
-               duplex = <1>;
-       };
+       status = "disabled";
 };
 
 /* There is no battery on the board, so the RTC does not keep
index 865122a..4ba9f9a 100644 (file)
@@ -82,7 +82,7 @@ TARGET_DEVICES += iom_ix2-200
 define Device/linksys_audi
   DEVICE_VENDOR := Linksys
   DEVICE_MODEL := EA3500 (Audi)
-  DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-basic kmod-gpio-button-hotplug
+  DEVICE_PACKAGES := kmod-mwl8k wpad-basic kmod-gpio-button-hotplug
   PAGESIZE := 512
   SUBPAGESIZE := 256
   BLOCKSIZE := 16k
@@ -97,7 +97,7 @@ TARGET_DEVICES += linksys_audi
 define Device/linksys_viper
   DEVICE_VENDOR := Linksys
   DEVICE_MODEL := E4200v2 / EA4500 (Viper)
-  DEVICE_PACKAGES := kmod-mwl8k swconfig wpad-basic kmod-gpio-button-hotplug
+  DEVICE_PACKAGES := kmod-mwl8k wpad-basic kmod-gpio-button-hotplug
   KERNEL_SIZE := 2688k
   KERNEL_IN_UBI :=
   UBINIZE_OPTS := -E 5
index 7302723..0d97ad1 100644 (file)
                };
  
                white-pulse {
-@@ -66,6 +71,17 @@
-                       gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
-               };
-       };
-+
-+      mvsw61xx@10 {
-+              compatible = "marvell,88e6171";
-+              status = "okay";
-+              reg = <0x10>;
-+
-+              mii-bus = <&mdio>;
-+              cpu-port-0 = <5>;
-+              cpu-port-1 = <6>;
-+              is-indirect;
-+      };
- };
- &pinctrl {
-@@ -114,22 +130,22 @@
+@@ -114,22 +119,22 @@
                };
  
                partition@200000 {
                        reg = <0x1EA0000 0x1760000>;
                };
  
-@@ -162,6 +178,7 @@
-       status = "okay";
-       switch@10 {
-+              status = "disabled";
-               compatible = "marvell,mv88e6085";
-               #address-cells = <1>;
-               #size-cells = <0>;
-@@ -225,10 +242,14 @@
- };
- /* eth1 is connected to the switch at port 6. However DSA only supports a
-- * single CPU port. So leave this port disabled to avoid confusion.
-+ * single CPU port. Upstream uses DSA so they disable this port to avoid confusion.
-  */
- &eth1 {
--      status = "disabled";
-+      status = "okay";
-+      ethernet1-port@0 {
-+              speed = <1000>;
-+              duplex = <1>;
-+      };
- };
- /* There is no battery on the board, so the RTC does not keep
index 0027517..bfc2154 100644 (file)
@@ -7,7 +7,7 @@
 
 define Profile/Default
        NAME:=Default Profile
-       PACKAGES:=kmod-mwl8k swconfig wpad-basic
+       PACKAGES:=kmod-mwl8k wpad-basic
        PRIORITY:=1
 endef