From: Álvaro Fernández Rojas Date: Wed, 22 Mar 2023 19:10:01 +0000 (+0100) Subject: bmips: add support for Sercomm H-500s X-Git-Tag: v23.05.0-rc1~702 X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=6df12200d903338d36008cb207a41bd456346b5d;p=openwrt%2Fopenwrt.git bmips: add support for Sercomm H-500s Sercomm H-500s is a BCM63268 with 128M, internal and external (Quantenna) wifi and external BCM53134S switch. This device is already supported in bcm63xx target, so more information can be found in https://openwrt.org/toh/sercomm/h500-s. It's a perfect example of a device with internal and external switch coexistance since most devices only have ports on one of the switches but not both of them. Signed-off-by: Álvaro Fernández Rojas --- diff --git a/target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts new file mode 100644 index 0000000000..c0ad03fa22 --- /dev/null +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-lowi.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#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/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts new file mode 100644 index 0000000000..830a5cba14 --- /dev/null +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s-vfes.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#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/bmips/dts/bcm63167-sercomm-h500-s.dtsi b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi new file mode 100644 index 0000000000..c7edad8342 --- /dev/null +++ b/target/linux/bmips/dts/bcm63167-sercomm-h500-s.dtsi @@ -0,0 +1,298 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "bcm63268.dtsi" + +/ { + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + + led-internet = &led_internet_green; + led-usb = &led_mobile_green; + led-wireless = &led_wireless_green; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + wps { + label = "wps"; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&gpio 35 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&ehci { + status = "okay"; +}; + +ðernet { + status = "okay"; + + nvmem-cells = <&macaddr_cferom_6a0>; + nvmem-cell-names = "mac-address"; +}; + +&leds { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + led@0 { + reg = <0>; + label = "red:mobile"; + }; + + led_mobile_green: led@1 { + reg = <1>; + label = "green:mobile"; + }; + + led_power_red: led@8 { + reg = <8>; + label = "red:power"; + }; + + led_wireless_green: led@9 { + reg = <9>; + label = "green:wifi"; + }; + + led@12 { + reg = <12>; + label = "red:phone"; + }; + + led@13 { + reg = <13>; + label = "red:wifi"; + }; + + led@14 { + reg = <14>; + label = "red:internet"; + }; + + led_internet_green: led@15 { + reg = <15>; + label = "green:internet"; + }; + + led@16 { + reg = <16>; + label = "green:phone"; + }; + + led_power_green: led@17 { + reg = <17>; + label = "green:power"; + }; + + led@23 { + reg = <23>; + label = "blue:mobile"; + }; +}; + +&mdio_int { + phy12: ethernet-phy@c { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <12>; + }; +}; + +&mdio_ext { + switch@1e { + compatible = "brcm,bcm53134"; + reg = <30>; + + dsa,member = <1 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan3"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan1"; + }; + + port@5 { + reg = <5>; + label = "wifi"; + + phy-mode = "rgmii"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + + port@8 { + reg = <8>; + + phy-mode = "rgmii"; + ethernet = <&switch0port4>; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <4>; + nand-on-flash-bbt; + brcm,nand-oob-sector-size = <64>; + + #address-cells = <1>; + #size-cells = <1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + cferom: 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>; + }; + + partition@6ba0000 { + label = "xml_cfg"; + reg = <0x6ba0000 0x0280000>; + read-only; + }; + + partition@6e20000 { + label = "app_data"; + reg = <0x6e20000 0x0280000>; + read-only; + }; + }; + }; +}; + +&ohci { + status = "okay"; +}; + +&switch0 { + dsa,member = <0 0>; + + ports { + port@3 { + reg = <3>; + label = "wan"; + + phy-handle = <&phy12>; + }; + + switch0port4: port@4 { + reg = <4>; + label = "extsw"; + + phy-mode = "rgmii-txid"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio0", "gpio1", "gpio8", "gpio9", + "gpio12", "gpio13", "gpio14", "gpio15", + "gpio16", "gpio17", "gpio23"; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usbh { + status = "okay"; +}; + +&cferom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_cferom_6a0: macaddr@6a0 { + reg = <0x6a0 0x6>; + }; +}; diff --git a/target/linux/bmips/image/bcm63xx_nand.mk b/target/linux/bmips/image/bcm63xx_nand.mk index 6c4655bbab..01540625ed 100644 --- a/target/linux/bmips/image/bcm63xx_nand.mk +++ b/target/linux/bmips/image/bcm63xx_nand.mk @@ -100,3 +100,57 @@ define Device/netgear_dgnd3700-v2 CFE_WFI_VERSION := 0x5731 endef TARGET_DEVICES += netgear_dgnd3700-v2 + +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/bmips/nand/base-files/etc/board.d/02_network b/target/linux/bmips/nand/base-files/etc/board.d/02_network index ce4440270c..ea95f57251 100644 --- a/target/linux/bmips/nand/base-files/etc/board.d/02_network +++ b/target/linux/bmips/nand/base-files/etc/board.d/02_network @@ -14,6 +14,10 @@ netgear,dgnd3700-v2) ucidef_set_bridge_device switch ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; +sercomm,h500-s-lowi |\ +sercomm,h500-s-vfes) + ucidef_set_bridge_device switch + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 wifi" "wan" esac board_config_flush diff --git a/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh b/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh index 33217ed975..69901eb29c 100644 --- a/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh +++ b/target/linux/bmips/nand/base-files/lib/upgrade/platform.sh @@ -47,7 +47,9 @@ platform_do_upgrade() { case "$(board_name)" in comtrend,vr-3032u|\ huawei,hg253s-v2|\ - netgear,dgnd3700-v2) + netgear,dgnd3700-v2|\ + sercomm,h500-s-lowi|\ + sercomm,h500-s-vfes) cfe_jffs2_nand_upgrade "$1" ;; *) diff --git a/target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch b/target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch new file mode 100644 index 0000000000..3d45f69e03 --- /dev/null +++ b/target/linux/bmips/patches-5.15/210-macronix_nand_block_protection_support.patch @@ -0,0 +1,29 @@ +From 5a37811de679bff03e9c5a746f75574910ede964 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 22 Mar 2023 20:52:13 +0100 +Subject: [PATCH] Revert "mtd: rawnand: Macronix: Add support for block + protection" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This reverts commit 03a539c7a118427a6609a26461358c56ac8f3a06. + +Macronix block protection doesn't seem to be supported on Sercomm H-500s +devices since it hangs the device. + +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/mtd/nand/raw/nand_macronix.c | 5 ----- + 1 file changed, 5 deletions(-) + +--- a/drivers/mtd/nand/raw/nand_macronix.c ++++ b/drivers/mtd/nand/raw/nand_macronix.c +@@ -323,7 +323,6 @@ static int macronix_nand_init(struct nan + + macronix_nand_fix_broken_get_timings(chip); + macronix_nand_onfi_init(chip); +- macronix_nand_block_protection_support(chip); + macronix_nand_deep_power_down_support(chip); + + return 0; diff --git a/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch b/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch new file mode 100644 index 0000000000..3134e292fd --- /dev/null +++ b/target/linux/bmips/patches-5.15/520-net-dsa-b53-add-bcm53134-support.patch @@ -0,0 +1,98 @@ +From 8ec46b847fc64a40da5c2c891e1732c863703bb5 Mon Sep 17 00:00:00 2001 +From: Paul Geurts +Date: Wed, 22 Mar 2023 20:17:04 +0100 +Subject: [PATCH] net: dsa: b53: mdio: add support for BCM53134 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the BCM53134 Ethernet switch in the existing b53 dsa driver. +The BCM53134 is very familiar to the BCM58XX series. + +Signed-off-by: Paul Geurts +Signed-off-by: Álvaro Fernández Rojas +--- + drivers/net/dsa/b53/b53_common.c | 15 +++++++++++++++ + drivers/net/dsa/b53/b53_mdio.c | 5 ++++- + drivers/net/dsa/b53/b53_priv.h | 4 +++- + 3 files changed, 22 insertions(+), 2 deletions(-) + +--- a/drivers/net/dsa/b53/b53_common.c ++++ b/drivers/net/dsa/b53/b53_common.c +@@ -2609,6 +2609,20 @@ static const struct b53_chip_data b53_sw + .jumbo_pm_reg = B53_JUMBO_PORT_MASK, + .jumbo_size_reg = B53_JUMBO_MAX_SIZE, + }, ++ { ++ .chip_id = BCM53134_DEVICE_ID, ++ .dev_name = "BCM53134", ++ .vlans = 4096, ++ .enabled_ports = 0x12f, ++ .imp_port = 8, ++ .cpu_port = B53_CPU_PORT, ++ .vta_regs = B53_VTA_REGS, ++ .arl_bins = 4, ++ .arl_buckets = 1024, ++ .duplex_reg = B53_DUPLEX_STAT_GE, ++ .jumbo_pm_reg = B53_JUMBO_PORT_MASK, ++ .jumbo_size_reg = B53_JUMBO_MAX_SIZE, ++ }, + }; + + static int b53_switch_init(struct b53_device *dev) +@@ -2785,6 +2799,7 @@ int b53_switch_detect(struct b53_device + case BCM53012_DEVICE_ID: + case BCM53018_DEVICE_ID: + case BCM53019_DEVICE_ID: ++ case BCM53134_DEVICE_ID: + dev->chip_id = id32; + break; + default: +--- a/drivers/net/dsa/b53/b53_mdio.c ++++ b/drivers/net/dsa/b53/b53_mdio.c +@@ -286,6 +286,7 @@ static const struct b53_io_ops b53_mdio_ + #define B53_BRCM_OUI_2 0x03625c00 + #define B53_BRCM_OUI_3 0x00406000 + #define B53_BRCM_OUI_4 0x01410c00 ++#define B53_BRCM_OUI_5 0xae025000 + + static int b53_mdio_probe(struct mdio_device *mdiodev) + { +@@ -313,7 +314,8 @@ static int b53_mdio_probe(struct mdio_de + if ((phy_id & 0xfffffc00) != B53_BRCM_OUI_1 && + (phy_id & 0xfffffc00) != B53_BRCM_OUI_2 && + (phy_id & 0xfffffc00) != B53_BRCM_OUI_3 && +- (phy_id & 0xfffffc00) != B53_BRCM_OUI_4) { ++ (phy_id & 0xfffffc00) != B53_BRCM_OUI_4 && ++ (phy_id & 0xfffffc00) != B53_BRCM_OUI_5) { + dev_err(&mdiodev->dev, "Unsupported device: 0x%08x\n", phy_id); + return -ENODEV; + } +@@ -377,6 +379,7 @@ static const struct of_device_id b53_of_ + { .compatible = "brcm,bcm53115" }, + { .compatible = "brcm,bcm53125" }, + { .compatible = "brcm,bcm53128" }, ++ { .compatible = "brcm,bcm53134" }, + { .compatible = "brcm,bcm5365" }, + { .compatible = "brcm,bcm5389" }, + { .compatible = "brcm,bcm5395" }, +--- a/drivers/net/dsa/b53/b53_priv.h ++++ b/drivers/net/dsa/b53/b53_priv.h +@@ -85,6 +85,7 @@ enum { + BCM583XX_DEVICE_ID = 0x58300, + BCM7445_DEVICE_ID = 0x7445, + BCM7278_DEVICE_ID = 0x7278, ++ BCM53134_DEVICE_ID = 0x5075, + }; + + #define B53_N_PORTS 9 +@@ -210,7 +211,8 @@ static inline int is58xx(struct b53_devi + return dev->chip_id == BCM58XX_DEVICE_ID || + dev->chip_id == BCM583XX_DEVICE_ID || + dev->chip_id == BCM7445_DEVICE_ID || +- dev->chip_id == BCM7278_DEVICE_ID; ++ dev->chip_id == BCM7278_DEVICE_ID || ++ dev->chip_id == BCM53134_DEVICE_ID; + } + + #define B53_63XX_RGMII0 4