[OpenWrt-Devel] [PATCH 4/4] bcm63xx: add support for the Sercomm H500-s
Álvaro Fernández Rojas
noltari at gmail.com
Thu Jun 4 05:12:39 EDT 2020
Hi Adrian,
> El 4 jun 2020, a las 10:16, Adrian Schmutzler <mail at adrianschmutzler.de> escribió:
>
> Hi,
>
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>> On Behalf Of Daniel González Cabanelas
>> Sent: Donnerstag, 4. Juni 2020 00:48
>> To: openwrt-devel at lists.openwrt.org
>> Cc: noltari at gmail.com
>> Subject: [OpenWrt-Devel] [PATCH 4/4] bcm63xx: add support for the
>> Sercomm H500-s
>>
>> Sercomm H500-s is an xDSL dual band wireless router based on Broadcom
>> BCM63167 SoC
>>
>> Hardware:
>> SoC: Broadcom BCM63167
>> CPU: BMIPS4350 V8.0, 400 MHz, 2 cores
>> Flash: NAND 128 MiB
>> RAM: DDR3 128 MiB
>> Ethernet: 4x 10/100/1000 Mbps
>> Switch: BCM53134S
>> Wireless: 802.11b/g/n: BCM435f (integrated)
>> 802.11ac: Quantenna QT3740BC (onboard SoC)
>> USB: 1x 2.0
>> LEDs/Buttons: 11x / 2x
>>
>> Flash instruction, web UI:
>> 1. Reset to defaults using the reset button if the admin password is
>> unknown
>> 2. Login into the web UI as admin.
>> Address: http://192.168.0.1
>> User: admin
>> Password: VF-ESad1018
>> 3. Go to Settings -> Firmware Update, and select the Openwrt factory
>> firmware
>> 4. Update the firmware.
>> 5. Wait until it finish, the device will reboot with Openwrt installed
>> on the alternative image partitions keeping the stock firmware in
>> the former.
>>
>> Notes:
>> - The patch also adds support for the lowi version. Only the factory
>> firmware is different.
>> - The integrated Wifi in the Broadcom Soc isn't still supported.
>> - The Quantenna 802.11ac wifi works ok, but needs to be configured with
>> the Quantenna client application. It can't be configured with Luci
>> nor any iw command since it's a separated subsystem linked via
>> ethernet.
>>
>> Signed-off-by: Daniel González Cabanelas <dgcbueu at gmail.com>
>> ---
>> .../bcm63xx/base-files/etc/board.d/01_leds | 3 +
>> .../bcm63xx/base-files/etc/board.d/02_network | 3 +
>> .../base-files/lib/upgrade/platform.sh | 3 +-
>> .../bcm63xx/dts/bcm63167-sercomm-h500s.dts | 201
>> ++++++++++++++++++
>> target/linux/bcm63xx/image/bcm63xx_nand.mk | 53 +++++
>> .../bcm63xx/patches-5.4/568-board-H500s.patch | 72 +++++++
>> 6 files changed, 334 insertions(+), 1 deletion(-) create mode 100644
>> target/linux/bcm63xx/dts/bcm63167-sercomm-h500s.dts
>> create mode 100644 target/linux/bcm63xx/patches-5.4/568-board-
>> H500s.patch
>>
>> diff --git a/target/linux/bcm63xx/base-files/etc/board.d/01_leds
>> b/target/linux/bcm63xx/base-files/etc/board.d/01_leds
>> index 91d67f0c0b..5894108457 100755
>> --- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds
>> +++ b/target/linux/bcm63xx/base-files/etc/board.d/01_leds
>> @@ -100,6 +100,9 @@ sercomm,ad1018)
>> sercomm,ad1018-nor)
>> ucidef_set_led_netdev "wlan0" "WLAN" "AD1018:green:wifi"
>> "wlan0"
>> ;;
>> +sercomm,h500s)
>> + ucidef_set_led_netdev "wan" "WAN" "$model:green:internet"
>> "eth0.2"
>> + ;;
>> telsey,cpva502plus)
>> ucidef_set_led_netdev "lan" "LAN" "CPVA502+:amber:link" "eth0"
>> ;;
>> diff --git a/target/linux/bcm63xx/base-files/etc/board.d/02_network
>> b/target/linux/bcm63xx/base-files/etc/board.d/02_network
>> index 784af29cb4..30649b3abe 100755
>> --- a/target/linux/bcm63xx/base-files/etc/board.d/02_network
>> +++ b/target/linux/bcm63xx/base-files/etc/board.d/02_network
>> @@ -142,6 +142,9 @@ sercomm,ad1018-nor)
>> ucidef_add_switch "switch0" \
>> "1:lan:3" "2:lan:2" "3:lan:1" "0:wan" "8t at eth0"
>> ;;
>> +sercomm,h500s)
>> + ucidef_add_switch "switch0" "4:lan" "3:wan" "8t at eth0"
>> + ;;
>> sfr,neufbox-6-sercomm-r0)
>> ucidef_add_switch "switch0" \
>> "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9t at eth0"
>> diff --git a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
>> b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
>> index 7d416297dd..cea66f63ef 100644
>> --- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
>> +++ b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
>> @@ -69,7 +69,8 @@ platform_do_upgrade() {
>> comtrend,vr-3032u|\
>> huawei,hg253s-v2|\
>> netgear,dgnd3700-v2|\
>> - sercomm,ad1018)
>> + sercomm,ad1018|\
>> + sercomm,h500s)
>> REQUIRE_IMAGE_METADATA=1
>> cfe_jffs2_upgrade_tar "$1"
>> ;;
>> diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500s.dts
>> b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500s.dts
>> new file mode 100644
>> index 0000000000..5a999ef24e
>> --- /dev/null
>> +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500s.dts
>> @@ -0,0 +1,201 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>> +/*
>> + * Device Tree file for Sercomm H500-s
>> + *
>> + * Copyright (C) 2020 Daniel González Cabanelas <dgcbueu at gmail.com> */
>> +
>> +/dts-v1/;
>> +
>> +#include "bcm63268.dtsi"
>> +
>> +#include <dt-bindings/input/input.h>
>> +
>> +/ {
>> + model = "Sercomm H500-s";
>> + compatible = "sercomm,h500s", "brcm,bcm63268";
>
> If the model name is H500-s, then the compatible, device node name etc. should also be "sercomm,h500-s"
>
>> +
>> + aliases {
>> + led-boot = &led_power_green;
>> + led-failsafe = &led_power_red;
>> + led-running = &led_power_green;
>> + led-upgrade = &led_power_green;
>> + };
>> +
>> + chosen {
>> + bootargs = "rootfstype=squashfs,ubifs noinitrd
>> console=ttyS0,115200";
>> + stdout-path = "serial0:115200n8";
>> + };
>> +
>> + keys {
>> + compatible = "gpio-keys-polled";
>> + #address-cells = <1>;
>> + #size-cells = <0>;
>> + poll-interval = <20>;
>> +
>> + wps {
>> + label = "wps";
>> + gpios = <&pinctrl 34 1>;
>> + linux,code = <KEY_WPS_BUTTON>;
>> + debounce-interval = <60>;
>> + };
>> +
>> + reset {
>> + label = "reset";
>> + gpios = <&pinctrl 35 1>;
>> + linux,code = <KEY_RESTART>;
>> + debounce-interval = <60>;
>> + };
>> + };
>> +};
>> +
>> +&leds {
>> + status = "ok";
>
> ok -> okay
>
>> +
>> + pinctrl-names = "default";
>> + pinctrl-0 = <&pinctrl_leds>;
>> +
>> + led at 0 {
>
> As stated earlier, it's common in OpenWrt to use the relevant parts of the label for the node name, i.e. "mobile_red" or something similar in this case.
>
> I noticed that Noltari also used this notation here during a recent change, so maybe he can give an update if the old common syntax shouldn't be used for this setup.
>
>> + reg = <0>;
>> + label = "h500s:red:mobile";
>> + };
>> +
>> + led at 1 {
>> + reg = <1>;
>> + label = "h500s:green:mobile";
>> + };
>> +
>> + led_power_red: led at 8 {
>> + reg = <8>;
>> + label = "h500s:red:power";
>> + };
>> +
>> + led at 9 {
>> + reg = <9>;
>> + label = "h500s:green:wifi";
>> + };
>> +
>> + led at 12 {
>> + reg = <12>;
>> + label = "h500s:red:phone";
>> + };
>> +
>> + led at 13 {
>> + reg = <13>;
>> + label = "h500s:red:wifi";
>> + };
>> +
>> + led at 14 {
>> + reg = <14>;
>> + label = "h500s:red:internet";
>> + };
>> +
>> + led at 15 {
>> + reg = <15>;
>> + label = "h500s:green:internet";
>> + };
>> +
>> + led at 16 {
>> + reg = <16>;
>> + label = "h500s:green:phone";
>> + };
>> +
>> + led_power_green: led at 17 {
>> + reg = <17>;
>> + label = "h500s:green:power";
>> + default-state = "on";
>> + };
>> +
>> + led at 23 {
>> + reg = <23>;
>> + label = "h500s:blue:mobile";
>> + };
>> +};
>> +
>> +&nflash {
>> + status = "ok";
>
> okay
>
>> +
>> + nandcs at 0 {
>> + compatible = "brcm,nandcs";
>> + reg = <0>;
>> +
>> + pinctrl-names = "default";
>> + pinctrl-0 = <&pinctrl_nand>;
>> +
>> + nand-on-flash-bbt;
>> + nand-ecc-strength = <4>;
>> + nand-ecc-step-size = <512>;
>> + brcm,nand-oob-sector-size = <64>;
>> +
>> + partitions {
>> + compatible = "fixed-partitions";
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> +
>> + partition at 0 {
>> + label = "cferom";
>> + reg = <0x0000000 0x0020000>; /* 128 KiB */
>
> Personally, I don't think the size comments are necessary, and would drop them completely.
>
>> + read-only;
>> + };
>> +
>> + partition at 20000 {
>> + label = "part_map";
>> + reg = <0x0020000 0x00a0000>; /* 640 KiB */
>> + read-only;
>> + };
>> +
>> + partition at c0000 {
>> + label = "cferam1";
>> + reg = <0x00c0000 0x0140000>; /* 1280 KiB */
>> + read-only;
>> + };
>> +
>> + partition at 200000 {
>> + label = "cferam2";
>> + reg = <0x0200000 0x0140000>; /* 1280 KiB */
>> + read-only;
>> + };
>> +
>> + partition at 6920000 {
>> + label = "bootflag1";
>> + reg = <0x6920000 0x0140000>; /* 1280 KiB */
>> + };
>> +
>> + partition at 6a60000 {
>> + label = "bootflag2";
>> + reg = <0x6a60000 0x0140000>; /* 1280 KiB */
>> + };
>> +
>> + partition at 520000 {
>> + compatible = "sercomm,wfi";
>> + label = "wfi";
>> + reg = <0x0520000 0x6400000>; /* 2 images,
>> 97152 KiB */
>> + };
>
> Can somebody enlighten me why this ordering is used (also in other recent patches)?
These bootflag partitions indicate which rootfs is being booted (the one with the highest number).
The mtdsplit driver relies on these partitions to read both bootflags and create the kernel/rootfs partitions accordingly:
https://github.com/openwrt/openwrt/blob/master/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c#L423
Therefore, the partitions must be defined before the WFI partition, since defining them after the WFI partition would fail when calling get_mtd_device_nm().
>
>> +
>> + partition at 6ba0000 {
>> + label = "xml_cfg";
>> + reg = <0x6ba0000 0x0280000>; /* 2560 KiB */
>> + read-only;
>> + };
>> +
>> + partition at 6e20000 {
>> + label = "app_data";
>> + reg = <0x6e20000 0x0280000>; /* 2560 KiB */
>> + read-only;
>> + };
>> + };
>> + };
>> +};
>> +
>> +&pinctrl {
>> + pinctrl_leds: leds {
>> + function = "led";
>> + pins = "gpio0", "gpio1", "gpio8", "gpio9",
>> + "gpio12", "gpio13", "gpio14", "gpio15",
>> + "gpio16", "gpio17", "gpio23";
>> + };
>> +};
>> +
>> +&uart0 {
>> + status = "ok";
>
> okay
>
>> +};
>> diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk
>> b/target/linux/bcm63xx/image/bcm63xx_nand.mk
>> index 74f23f52af..5cc3f34f0c 100644
>> --- a/target/linux/bcm63xx/image/bcm63xx_nand.mk
>> +++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk
>> @@ -150,3 +150,56 @@ define Device/sercomm_ad1018
>> SERCOMM_VERSION := 1001
>> endef
>> TARGET_DEVICES += sercomm_ad1018
>> +
>> +define Device/sercomm_h500s
>
> As stated above, this should be sercomm_h500-s
>
>> + $(Device/sercomm-nand)
>> + DEVICE_VENDOR := Sercomm
>> + DEVICE_MODEL := H500-s
>> + IMAGES := factory.img sysupgrade.bin
>> + KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel
>> +$$(KERNEL_LOADADDR)
>> + CHIP_ID := 63268
>> + SOC := bcm63167
>> + BLOCKSIZE := 128k
>> + PAGESIZE := 2048
>> + SUBPAGESIZE := 512
>> + VID_HDR_OFFSET := 2048
>> + DEVICE_PACKAGES += $(B43_PACKAGES) $(USB2_PACKAGES)
>> + SERCOMM_PID := \
>> + 30 30 30 30 30 30 30 31 34 32 35 38 34 62 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 33 34 31 37 30 30 30 30 30 30 30 30 \
>> + 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> + SERCOMM_VERSION := 1001
>> +endef
>> +TARGET_DEVICES += sercomm_h500s
>> +
>> +define Device/sercomm_h500s_lowi
>
> Should be sercomm_h500-s-lowi then.
>
>> + $(Device/sercomm-nand)
>> + DEVICE_VENDOR := Sercomm
>> + DEVICE_MODEL := H500-s lowi
>
> I agree with the device variant.
>
>> + DEVICE_DTS := bcm63167-sercomm-h500s
>
> Classic sysupgrade won't work with this approach (as SUPPORTED_DEVICES would not match compatible here), but I don't think that's relevant for bcm63xx?
>
> Personally, I'd prefer a DTSI and separate DTSes for both devices, so the compatible can be matched with the device name.
>
> Best
>
> Adrian
>
>> + IMAGES := factory.img sysupgrade.bin
>> + KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel
>> +$$(KERNEL_LOADADDR)
>> + CHIP_ID := 63268
>> + SOC := bcm63167
>> + BLOCKSIZE := 128k
>> + PAGESIZE := 2048
>> + SUBPAGESIZE := 512
>> + VID_HDR_OFFSET := 2048
>> + DEVICE_PACKAGES += $(B43_PACKAGES) $(USB2_PACKAGES)
>> + SERCOMM_PID := \
>> + 30 30 30 30 30 30 30 31 34 33 34 62 33 31 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 \
>> + 30 30 30 30 33 33 30 35 30 30 30 30 30 30 30 30 \
>> + 0D 0A 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>> + SERCOMM_VERSION := 1001
>> +endef
>> +TARGET_DEVICES += sercomm_h500s_lowi
>> diff --git a/target/linux/bcm63xx/patches-5.4/568-board-H500s.patch
>> b/target/linux/bcm63xx/patches-5.4/568-board-H500s.patch
>> new file mode 100644
>> index 0000000000..f14e29bfba
>> --- /dev/null
>> +++ b/target/linux/bcm63xx/patches-5.4/568-board-H500s.patch
>> @@ -0,0 +1,72 @@
>> +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
>> ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
>> +@@ -2867,10 +2867,45 @@
>> + },
>> +
>> + },
>> + },
>> + };
>> ++
>> ++static struct board_info __initdata board_H500s = {
>> ++ .name = "BXK00C-1.6",
>> ++ .expected_cpu_id = 0x63268,
>> ++
>> ++ .has_pci = 0,
>> ++ .use_fallback_sprom = 0,
>> ++
>> ++ .has_ehci0 = 1,
>> ++ .has_ohci0 = 1,
>> ++ .num_usbh_ports = 1,
>> ++
>> ++ .has_enetsw = 1,
>> ++
>> ++ .enetsw = {
>> ++ .used_ports = {
>> ++ [3] = {
>> ++ .used = 1,
>> ++ .phy_id = 12,
>> ++ .name = "WAN",
>> ++ },
>> ++
>> ++ [4] = {
>> ++ .used = 1,
>> ++ .phy_id = 0,
>> ++ .bypass_link = 1,
>> ++ .force_speed = 1000,
>> ++ .force_duplex_full = 1,
>> ++ .mii_override = 1,
>> ++ .timing_sel = 1,
>> ++ .name = "RGMII",
>> ++ },
>> ++ },
>> ++ },
>> ++};
>> + #endif /* CONFIG_BCM63XX_CPU_63268 */
>> +
>> + /*
>> + * all boards
>> + */
>> +@@ -2981,10 +3016,11 @@
>> + &board_963269bhr,
>> + &board_VG8050,
>> + &board_VR3032u,
>> + &board_vw6339gu,
>> + &board_BSKYB_63168,
>> ++ &board_H500s,
>> + #endif
>> + };
>> +
>> + static struct of_device_id const bcm963xx_boards_dt[] = { #ifdef
>> +CONFIG_OF @@ -3099,10 +3135,11 @@
>> + { .compatible = "brcm,bcm963268bu-p300", .data =
>> &board_963268bu_p300, },
>> + { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, },
>> + { .compatible = "comtrend,vg-8050", .data = &board_VG8050, },
>> + { .compatible = "comtrend,vr-3032u", .data = &board_VR3032u, },
>> + { .compatible = "inteno,vg50", .data = &board_vw6339gu, },
>> ++ { .compatible = "sercomm,h500s", .data = &board_H500s, },
>> + { .compatible = "sky,sr102", .data = &board_BSKYB_63168, }, #endif
>> + #endif /* CONFIG_OF */
>> + { },
>> + };
>> --
>> 2.27.0
>>
>>
>>
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Best regards,
Álvaro.
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list