[PATCH] sunxi: bring up DSA b53 switch on Lamobo R1

Daniel Golle daniel at makrotopia.org
Fri Sep 10 15:40:38 PDT 2021


Build cortexa7 subtarget with DSA driver for MDIO-connected Broadcom
BCM53xxx switches. This is needed for the Lamobo R1 aka. BananaPi
BPi-R1 board which comes with such a switch IC.

Remove old swconfig driver from target kernel config as the only board
using it is now supported by the DSA driver.

No changes to device tree are needed as upstream DTS already got a
DSA switch definition and we are just using that upstream source.

Update default network config of the Lamobo R1 to create lan bridge
with all 4 lan ports.

Introduce DEVICE_COMPAT_VERSION for the board to inform users about
having the re-create their network configuration and add device alias
as Bananapi BPi-R1 while at it.

Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
 target/linux/sunxi/base-files/etc/board.d/02_network |  3 +--
 target/linux/sunxi/config-5.4                        |  4 ----
 target/linux/sunxi/cortexa7/config-5.4               | 12 ++++++++++++
 target/linux/sunxi/image/cortexa7.mk                 |  5 ++++-
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/target/linux/sunxi/base-files/etc/board.d/02_network b/target/linux/sunxi/base-files/etc/board.d/02_network
index 5b59333b1f..d5c615e7f2 100644
--- a/target/linux/sunxi/base-files/etc/board.d/02_network
+++ b/target/linux/sunxi/base-files/etc/board.d/02_network
@@ -11,8 +11,7 @@ friendlyarm,nanopi-r1)
 	ucidef_set_interfaces_lan_wan "eth1" "eth0"
 	;;
 lamobo,lamobo-r1)
-	ucidef_add_switch "switch0" \
-		"4:lan:1" "0:lan:2" "1:lan:3" "2:lan:4" "3:wan" "8 at eth0"
+	ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" wan
 	;;
 olimex,a20-olinuxino-micro)
 	ucidef_set_interface_lan "wlan0"
diff --git a/target/linux/sunxi/config-5.4 b/target/linux/sunxi/config-5.4
index 377234b828..e01a2cbd5e 100644
--- a/target/linux/sunxi/config-5.4
+++ b/target/linux/sunxi/config-5.4
@@ -523,10 +523,6 @@ CONFIG_SUNXI_SRAM=y
 CONFIG_SUNXI_WATCHDOG=y
 CONFIG_SUSPEND=y
 CONFIG_SUSPEND_FREEZER=y
-CONFIG_SWCONFIG=y
-CONFIG_SWCONFIG_B53=y
-CONFIG_SWCONFIG_B53_PHY_DRIVER=y
-CONFIG_SWCONFIG_B53_PHY_FIXUP=y
 CONFIG_SWIOTLB=y
 CONFIG_SWPHY=y
 CONFIG_SWP_EMULATE=y
diff --git a/target/linux/sunxi/cortexa7/config-5.4 b/target/linux/sunxi/cortexa7/config-5.4
index 0b3697028f..4ead820881 100644
--- a/target/linux/sunxi/cortexa7/config-5.4
+++ b/target/linux/sunxi/cortexa7/config-5.4
@@ -13,3 +13,15 @@ CONFIG_MDIO_BUS_MUX=y
 # CONFIG_PINCTRL_SUN50I_H6 is not set
 # CONFIG_PINCTRL_SUN50I_H6_R is not set
 CONFIG_UNWINDER_ARM=y
+CONFIG_NET_DEVLINK=y
+CONFIG_NET_DSA=y
+CONFIG_NET_DSA_TAG_BRCM=y
+CONFIG_NET_DSA_TAG_BRCM_COMMON=y
+CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
+CONFIG_NET_SWITCHDEV=y
+CONFIG_B53=y
+CONFIG_B53_MDIO_DRIVER=y
+# CONFIG_B53_MMAP_DRIVER is not set
+# CONFIG_B53_SERDES is not set
+# CONFIG_B53_SPI_DRIVER is not set
+# CONFIG_B53_SRAB_DRIVER is not set
diff --git a/target/linux/sunxi/image/cortexa7.mk b/target/linux/sunxi/image/cortexa7.mk
index 59f11bc83c..ac2dd1bc08 100644
--- a/target/linux/sunxi/image/cortexa7.mk
+++ b/target/linux/sunxi/image/cortexa7.mk
@@ -64,7 +64,10 @@ TARGET_DEVICES += friendlyarm_zeropi
 define Device/lamobo_lamobo-r1
   DEVICE_VENDOR := Lamobo
   DEVICE_MODEL := Lamobo R1
-  DEVICE_PACKAGES:=kmod-ata-sunxi kmod-rtl8192cu swconfig wpad-basic-wolfssl
+  DEVICE_ALT0_VENDOR := Bananapi
+  DEVICE_ALT0_MODEL := BPi-R1
+  DEVICE_PACKAGES := kmod-ata-sunxi kmod-rtl8192cu wpad-basic-wolfssl
+  DEVICE_COMPAT_VERSION := 2.0
   SOC := sun7i-a20
 endef
 TARGET_DEVICES += lamobo_lamobo-r1
-- 
2.33.0




More information about the openwrt-devel mailing list