diff mbox series

sunxi: bring up DSA b53 switch on Lamobo R1

Message ID YTve5pCYUcn1vT7I@makrotopia.org
State Superseded
Delegated to: Daniel Golle
Headers show
Series sunxi: bring up DSA b53 switch on Lamobo R1 | expand

Commit Message

Daniel Golle Sept. 10, 2021, 10:40 p.m. UTC
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@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(-)

Comments

Hauke Mehrtens Sept. 11, 2021, 9:09 a.m. UTC | #1
Hi Daniel,

Thanks for working on this.

On 9/11/21 12:40 AM, Daniel Golle wrote:
> 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.

This patch removes the upstream DTS part for the switch:
target/linux/sunxi/patches-5.4/310-Revert-ARM-dts-sun7i-Add-BCM53125-switch-nodes-to-th.patch

I think you should remove it.

> 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@makrotopia.org>

Currently the switch is broken, at least I saw multiple complains about 
this. Do you have the device and is the switch working? If so I would 
suggest to also backport this to 21.02 as it looks like the switch is 
not working in 21.01.

> ---
>   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(-)
>
Adrian Schmutzler Sept. 11, 2021, 5:19 p.m. UTC | #2
Hi,

> --- 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

compat_version needs to be set in two places. First for the image, which you
did here, and second for the config, which you seem to miss (board.d or
uci-default, depending on what kind of change you do).

Apart from that, note that changing the major version means that upgrade is
not possible at all (even without saving config), and factory flashing is
required. I would rather have expected version 1.1 here, since your change
should be covered by an update without keeping config (sysupgrade -n)?

Apart from that, adding a proper message would help.

You should get an overview of all the necessary changes here:
https://github.com/openwrt/openwrt/commit/494f12c52df6767ec0fabf2b2fac8f4533
23a4c5

For a single device, you would probably not need the separate
Device/dsa-migration definition, though, but could just add the two
variables to the device.

Best

Adrian





>    SOC := sun7i-a20
>  endef
>  TARGET_DEVICES += lamobo_lamobo-r1
> --
> 2.33.0
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

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@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