From ff2c96333f418c0c06ebf0bd947b449f579dda7c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20Gonz=C3=A1lez=20Cabanelas?= Date: Sun, 7 Jun 2020 10:55:56 +0200 Subject: [PATCH] bcm63xx: add support for the Sercomm H500-s MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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-ESVodafone-H-500-s or l033i-h500s 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. - The BCM53134S external switch is managed via MDIO which isn't supported in this target. Therefore it will behave as a dumb switch. Signed-off-by: Daniel González Cabanelas --- .../bcm63xx/base-files/etc/board.d/01_leds | 4 + .../bcm63xx/base-files/etc/board.d/02_network | 4 + .../base-files/lib/upgrade/platform.sh | 8 +- .../dts/bcm63167-sercomm-h500-s-lowi.dts | 15 ++ .../dts/bcm63167-sercomm-h500-s-vfes.dts | 15 ++ .../bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi | 194 ++++++++++++++++++ target/linux/bcm63xx/image/bcm63xx_nand.mk | 56 ++++- .../bcm63xx/patches-5.4/568-board-H500s.patch | 57 +++++ 8 files changed, 350 insertions(+), 3 deletions(-) create mode 100644 target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts create mode 100644 target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts create mode 100644 target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi 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..cdaf0e77c9 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,10 @@ sercomm,ad1018) sercomm,ad1018-nor) ucidef_set_led_netdev "wlan0" "WLAN" "AD1018:green:wifi" "wlan0" ;; +sercomm,h500-s-lowi|\ +sercomm,h500-s-vfes) + ucidef_set_led_netdev "wan" "WAN" "h500-s: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..f02eabe68f 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,10 @@ sercomm,ad1018-nor) ucidef_add_switch "switch0" \ "1:lan:3" "2:lan:2" "3:lan:1" "0:wan" "8t@eth0" ;; +sercomm,h500-s-lowi|\ +sercomm,h500-s-vfes) + ucidef_add_switch "switch0" "4:lan" "3:wan" "8t@eth0" + ;; sfr,neufbox-6-sercomm-r0) ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9t@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..525d3b90b5 100644 --- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh @@ -9,7 +9,9 @@ platform_check_image() { comtrend,vr-3032u|\ huawei,hg253s-v2|\ netgear,dgnd3700-v2|\ - sercomm,ad1018) + sercomm,ad1018|\ + sercomm,h500-s-lowi|\ + sercomm,h500-s-vfes) # NAND sysupgrade return 0 ;; @@ -69,7 +71,9 @@ platform_do_upgrade() { comtrend,vr-3032u|\ huawei,hg253s-v2|\ netgear,dgnd3700-v2|\ - sercomm,ad1018) + sercomm,ad1018|\ + sercomm,h500-s-lowi|\ + sercomm,h500-s-vfes) REQUIRE_IMAGE_METADATA=1 cfe_jffs2_upgrade_tar "$1" ;; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts new file mode 100644 index 0000000000..b7203a4fc0 --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-lowi.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for Sercomm H500-s lowi + * + * Copyright (C) 2020 Daniel González Cabanelas + */ + +/dts-v1/; + +#include "bcm63167-sercomm-h500-s.dtsi" + +/ { + model = "Sercomm H500-s lowi"; + compatible = "sercomm,h500-s-lowi", "brcm,bcm63167", "brcm,bcm63268"; +}; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts new file mode 100644 index 0000000000..7a04dcfde0 --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s-vfes.dts @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for Sercomm H500-s vfes + * + * Copyright (C) 2020 Daniel González Cabanelas + */ + +/dts-v1/; + +#include "bcm63167-sercomm-h500-s.dtsi" + +/ { + model = "Sercomm H500-s vfes"; + compatible = "sercomm,h500-s-vfes", "brcm,bcm63167", "brcm,bcm63268"; +}; diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi new file mode 100644 index 0000000000..eb8a9f7ecd --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dtsi @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree file for Sercomm H500-s + * + * Copyright (C) 2020 Daniel González Cabanelas + */ + +#include "bcm63268.dtsi" + +#include + +/ { + 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 = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&pinctrl 35 1>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + mobile_red { + reg = <0>; + label = "h500-s:red:mobile"; + }; + + mobile_green { + reg = <1>; + label = "h500-s:green:mobile"; + }; + + led_power_red: power_red { + reg = <8>; + label = "h500-s:red:power"; + }; + + wifi_green { + reg = <9>; + label = "h500-s:green:wifi"; + }; + + phone_red { + reg = <12>; + label = "h500-s:red:phone"; + }; + + wifi_red { + reg = <13>; + label = "h500-s:red:wifi"; + }; + + internet_red { + reg = <14>; + label = "h500-s:red:internet"; + }; + + internet_green { + reg = <15>; + label = "h500-s:green:internet"; + }; + + phone_green { + reg = <16>; + label = "h500-s:green:phone"; + }; + + led_power_green: power_green { + reg = <17>; + label = "h500-s:green:power"; + default-state = "on"; + }; + + mobile_blue { + reg = <23>; + label = "h500-s:blue:mobile"; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + #size-cells = <1>; + #address-cells = <1>; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <4>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "cferom"; + reg = <0x0000000 0x0020000>; + read-only; + }; + + partition@20000 { + label = "part_map"; + reg = <0x0020000 0x00a0000>; + read-only; + }; + + partition@c0000 { + label = "cferam1"; + reg = <0x00c0000 0x0140000>; + read-only; + }; + + partition@200000 { + label = "cferam2"; + reg = <0x0200000 0x0140000>; + read-only; + }; + + partition@6920000 { + label = "bootflag1"; + reg = <0x6920000 0x0140000>; + }; + + partition@6a60000 { + label = "bootflag2"; + reg = <0x6a60000 0x0140000>; + }; + + partition@520000 { + compatible = "sercomm,wfi"; + label = "wfi"; + reg = <0x0520000 0x6400000>; /* 2 images, 97152 KiB */ + }; + + partition@6ba0000 { + label = "xml_cfg"; + reg = <0x6ba0000 0x0280000>; + read-only; + }; + + partition@6e20000 { + label = "app_data"; + reg = <0x6e20000 0x0280000>; + read-only; + }; + }; + }; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio0", "gpio1", "gpio8", "gpio9", + "gpio12", "gpio13", "gpio14", "gpio15", + "gpio16", "gpio17", "gpio23"; + }; +}; + +&uart0 { + status = "okay"; +}; diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk b/target/linux/bcm63xx/image/bcm63xx_nand.mk index 7b2039c988..81c328b712 100644 --- a/target/linux/bcm63xx/image/bcm63xx_nand.mk +++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk @@ -39,7 +39,7 @@ endef define Device/sercomm-nand $(Device/bcm63xx-nand) - IMAGES = factory.img sysupgrade.bin + IMAGES := factory.img sysupgrade.bin IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | cfe-sercomm-part | gzip | cfe-sercomm-load | cfe-sercomm-crypto SERCOM_PID := SERCOMM_VERSION := @@ -149,3 +149,57 @@ define Device/sercomm_ad1018 SERCOMM_VERSION := 1001 endef TARGET_DEVICES += sercomm_ad1018 + +define Device/sercomm_h500-s-lowi + $(Device/sercomm-nand) + DEVICE_VENDOR := Sercomm + DEVICE_MODEL := H500-s + DEVICE_VARIANT := lowi + DEVICE_LOADADDR := $(KERNEL_LOADADDR) + KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel + CHIP_ID := 63268 + SOC := bcm63167 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_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_h500-s-lowi + +define Device/sercomm_h500-s-vfes + $(Device/sercomm-nand) + DEVICE_VENDOR := Sercomm + DEVICE_MODEL := H500-s + DEVICE_VARIANT := vfes + DEVICE_LOADADDR := $(KERNEL_LOADADDR) + KERNEL := kernel-bin | append-dtb | lzma | cfe-jffs2-kernel + CHIP_ID := 63268 + SOC := bcm63167 + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_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_h500-s-vfes 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..eaa28a9778 --- /dev/null +++ b/target/linux/bcm63xx/patches-5.4/568-board-H500s.patch @@ -0,0 +1,57 @@ +--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c ++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c +@@ -2869,6 +2869,37 @@ static struct board_info __initdata boar + }, + }, + }; ++ ++static struct board_info __initdata board_H500s = { ++ .name = "BXK00C-1.6", ++ .expected_cpu_id = 0x63268, ++ ++ .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 */ + + /* +@@ -2983,6 +3014,7 @@ static const struct board_info __initcon + &board_VR3032u, + &board_vw6339gu, + &board_BSKYB_63168, ++ &board_H500s, + #endif + }; + +@@ -3101,6 +3133,8 @@ static struct of_device_id const bcm963x + { .compatible = "comtrend,vg-8050", .data = &board_VG8050, }, + { .compatible = "comtrend,vr-3032u", .data = &board_VR3032u, }, + { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, ++ { .compatible = "sercomm,h500-s-lowi", .data = &board_H500s, }, ++ { .compatible = "sercomm,h500-s-vfes", .data = &board_H500s, }, + { .compatible = "sky,sr102", .data = &board_BSKYB_63168, }, + #endif + #endif /* CONFIG_OF */ -- 2.30.2