diff mbox series

[OpenWrt-Devel,4/4,v2] bcm63xx: add support for the Sercomm H500-s

Message ID 5632296.MCBETrNQTy@tool
State Superseded, archived
Headers show
Series [OpenWrt-Devel,1/4,v2] bcm63xx: kernel: add BCM63167 cpuid variant | expand

Commit Message

Daniel González Cabanelas June 4, 2020, 5:46 p.m. UTC
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.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
Reviewed-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
Changes in v2:
  - Fixed passwords in commit log
  - Added unsupported switch in dts
  - Added custom LOADER_ENTRY to fix the ramdisk for this specific device
  - Removed unneded b43 package
  - Cosmetic changes

---
 .../bcm63xx/base-files/etc/board.d/01_leds    |   3 +
 .../bcm63xx/base-files/etc/board.d/02_network |   3 +
 .../base-files/lib/upgrade/platform.sh        |   6 +-
 .../bcm63xx/dts/bcm63167-sercomm-h500-s.dts   | 260 ++++++++++++++++++
 target/linux/bcm63xx/image/bcm63xx_nand.mk    |  54 ++++
 .../bcm63xx/patches-5.4/568-board-H500s.patch |  71 +++++
 6 files changed, 395 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dts
 create mode 100644 target/linux/bcm63xx/patches-5.4/568-board-H500s.patch
diff mbox series

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..f08d277c06 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,h500-s)
+	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..3042b3682b 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@eth0"
 	;;
+sercomm,h500-s)
+	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..a0750901b2 100644
--- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
@@ -9,7 +9,8 @@  platform_check_image() {
 		comtrend,vr-3032u|\
 		huawei,hg253s-v2|\
 		netgear,dgnd3700-v2|\
-		sercomm,ad1018)
+		sercomm,ad1018|\
+		sercomm,h500-s)
 			# NAND sysupgrade
 			return 0
 			;;
@@ -69,7 +70,8 @@  platform_do_upgrade() {
 		comtrend,vr-3032u|\
 		huawei,hg253s-v2|\
 		netgear,dgnd3700-v2|\
-		sercomm,ad1018)
+		sercomm,ad1018|\
+		sercomm,h500-s)
 			REQUIRE_IMAGE_METADATA=1
 			cfe_jffs2_upgrade_tar "$1"
 			;;
diff --git a/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dts b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dts
new file mode 100644
index 0000000000..6c4f9c23fd
--- /dev/null
+++ b/target/linux/bcm63xx/dts/bcm63167-sercomm-h500-s.dts
@@ -0,0 +1,260 @@ 
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Device Tree file for Sercomm H500-s
+ *
+ * Copyright (C) 2020 Daniel González Cabanelas <dgcbueu@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "bcm63268.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Sercomm H500-s";
+	compatible = "sercomm,h500-s", "brcm,bcm63268";
+
+	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 = "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";
+	};
+};
+
+/* Not supported */
+#if 0
+&mdio {
+	status = "disabled";
+
+	switch@0 {
+		status = "disabled";
+		compatible = "brcm,bcm53134";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		reg = <0>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			lan@1 {
+				reg = <1>;
+				label = "lan3";
+			};
+
+			lan@2 {
+				reg = <2>;
+				label = "lan2";
+			};
+
+			lan@3 {
+				reg = <3>;
+				label = "lan1";
+			};
+
+			wifi@5 {
+				reg = <5>;
+				label = "wifi";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					asym-pause;
+					pause;
+				};
+			};
+
+			cpu@8 {
+				reg = <8>;
+				label = "cpu";
+
+				fixed-link {
+					speed = <1000>;
+					full-duplex;
+					asym-pause;
+					pause;
+				};
+			};
+		};
+	};
+};
+#endif
+
+&nflash {
+	status = "okay";
+
+	nandcs@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@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..01090c2e67 100644
--- a/target/linux/bcm63xx/image/bcm63xx_nand.mk
+++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk
@@ -149,3 +149,57 @@  define Device/sercomm_ad1018
   SERCOMM_VERSION := 1001
 endef
 TARGET_DEVICES += sercomm_ad1018
+
+define Device/sercomm_h500-s
+  $(Device/sercomm-nand)
+  DEVICE_VENDOR := Sercomm
+  DEVICE_MODEL := H500-s
+  LOADER_ENTRY := 0x80010000 
+  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 += $(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
+
+define Device/sercomm_h500-s-lowi
+  $(Device/sercomm-nand)
+  DEVICE_VENDOR := Sercomm
+  DEVICE_MODEL := H500-s
+  DEVICE_VARIANT := lowi
+  DEVICE_DTS := bcm63167-sercomm-h500-s
+  LOADER_ENTRY := 0x80010000
+  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 += $(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
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..8a628e9233
--- /dev/null
+++ b/target/linux/bcm63xx/patches-5.4/568-board-H500s.patch
@@ -0,0 +1,71 @@ 
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -2867,10 +2867,44 @@
+ 			},
+ 
+ 		},
+ 	},
+ };
++
++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 +3015,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 +3134,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,h500-s", .data = &board_H500s, },
+ 	{ .compatible = "sky,sr102", .data = &board_BSKYB_63168, },
+ #endif
+ #endif /* CONFIG_OF */
+ 	{ },
+ };