From: Álvaro Fernández Rojas Date: Tue, 19 May 2020 11:29:12 +0000 (+0200) Subject: bcm63xx: add unmodded SERCOMM AD1018 support X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=5f826919232db2ca2d3d7e9da00de93c5f6a95bf;p=openwrt%2Fstaging%2Frmilecki.git bcm63xx: add unmodded SERCOMM AD1018 support Until now only HW modded SPI flash version was supported. BCM6328 with 64M RAM and 128M NAND. More info: https://openwrt.org/toh/sercomm/ad1018 Signed-off-by: Álvaro Fernández Rojas --- 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 cdbfa6319be..89105866a41 100755 --- a/target/linux/bcm63xx/base-files/etc/board.d/01_leds +++ b/target/linux/bcm63xx/base-files/etc/board.d/01_leds @@ -84,6 +84,7 @@ sagem,fast-2704n) sagem,fast-2704-v2) ucidef_set_led_usbdev "usb" "USB" "F@ST2704V2:green:usb" "1-1" ;; +sercomm,ad1018|\ sercomm,ad1018-nor) ucidef_set_led_netdev "wlan0" "WLAN" "AD1018:green:wifi" "wlan0" ;; 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 d0c15a9f987..14eb1091f52 100755 --- a/target/linux/bcm63xx/base-files/etc/board.d/02_network +++ b/target/linux/bcm63xx/base-files/etc/board.d/02_network @@ -132,6 +132,7 @@ netgear,dgnd3700-v1) ucidef_add_switch "switch0" \ "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "0:wan" "8t@eth0" ;; +sercomm,ad1018|\ sercomm,ad1018-nor) ucidef_add_switch "switch0" \ "1:lan:3" "2:lan:2" "3:lan:1" "0:wan" "8t@eth0" diff --git a/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc b/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc index c33e56f28e2..813b51fb52c 100644 --- a/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc +++ b/target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc @@ -40,4 +40,7 @@ case "$(board_name)" in zyxel,p870hw-51a-v2) do_fixcrc ;; + sercomm,ad1018) + mtd erase bootflag2 + ;; esac diff --git a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh index e92d025de7d..093eba056ed 100644 --- a/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm63xx/base-files/lib/upgrade/platform.sh @@ -7,7 +7,8 @@ platform_check_image() { case "$(board_name)" in comtrend,vg-8050|\ comtrend,vr-3032u|\ - netgear,dgnd3700-v2) + netgear,dgnd3700-v2|\ + sercomm,ad1018) # NAND sysupgrade return 0 ;; @@ -65,7 +66,8 @@ platform_do_upgrade() { case "$(board_name)" in comtrend,vg-8050|\ comtrend,vr-3032u|\ - netgear,dgnd3700-v2) + netgear,dgnd3700-v2|\ + sercomm,ad1018) REQUIRE_IMAGE_METADATA=1 cfe_jffs2_upgrade_tar "$1" ;; diff --git a/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts new file mode 100644 index 00000000000..7f9a6e2698a --- /dev/null +++ b/target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts @@ -0,0 +1,210 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +/dts-v1/; + +#include "bcm6328.dtsi" + +#include + +/ { + model = "Sercomm AD1018"; + compatible = "sercomm,ad1018", "brcm,bcm6328"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_green; + led-running = &led_power_green; + led-upgrade = &led_power_green; + }; + + chosen { + bootargs = "rootfstype=squashfs,jffs2 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 24 1>; + linux,code = ; + debounce-interval = <60>; + }; + + wifi { + label = "wifi"; + gpios = <&pinctrl 25 1>; + linux,code = ; + debounce-interval = <60>; + }; + + reset { + label = "reset"; + gpios = <&pinctrl 31 1>; + linux,code = ; + debounce-interval = <60>; + }; + }; +}; + +&leds { + status = "ok"; + + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led + &pinctrl_ephy0_spd_led &pinctrl_ephy1_act_led + &pinctrl_ephy2_act_led &pinctrl_ephy3_act_led>; + + brcm,serial-leds; + brcm,serial-shift-inv; + brcm,serial-dat-low; + + led@0 { + reg = <0>; + active-low; + label = "ad1018:red:internet"; + }; + + led@1 { + reg = <1>; + active-low; + label = "ad1018:green:internet"; + }; + + led_power_green: led@8 { + reg = <8>; + active-low; + label = "ad1018:green:power"; + default-state = "on"; + }; + + led@10 { + reg = <10>; + active-low; + label = "ad1018:green:adsl"; + }; + + led@11 { + reg = <11>; + active-low; + label = "ad1018:red:adsl"; + }; + + led@12 { + reg = <12>; + active-low; + label = "ad1018:green:phone"; + }; + + led@13 { + reg = <13>; + active-low; + label = "ad1018:green:wps"; + }; + + led@14 { + reg = <14>; + active-low; + label = "ad1018:green:wifi"; + }; + + led@15 { + reg = <15>; + active-low; + label = "ad1018:green:usb"; + }; + + led@17 { + /* EPHY0 Spd */ + reg = <17>; + brcm,hardware-controlled; + }; +}; + +&nflash { + status = "okay"; + + nandcs@0 { + compatible = "brcm,nandcs"; + #size-cells = <1>; + #address-cells = <1>; + reg = <0>; + nand-ecc-step-size = <512>; + nand-ecc-strength = <15>; + 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 = "mmap"; + reg = <0x0020000 0x00a0000>; + read-only; + }; + + partition@c0000 { + label = "cferam1"; + reg = <0x00c0000 0x0140000>; + read-only; + }; + + partition@200000 { + label = "cferam2"; + reg = <0x0200000 0x0140000>; + read-only; + }; + + partition@520000 { + compatible = "brcm,wfi-sercomm"; + label = "wfi"; + reg = <0x0520000 0x6400000>; + }; + + partition@6920000 { + label = "bootflag1"; + reg = <0x6920000 0x0140000>; + }; + + partition@6a60000 { + label = "bootflag2"; + reg = <0x6a60000 0x0140000>; + }; + + partition@6ba0000 { + label = "xml_cfg"; + reg = <0x6ba0000 0x0280000>; + read-only; + }; + + partition@6e20000 { + label = "app_dat"; + reg = <0x6e20000 0x0280000>; + read-only; + }; + }; + }; +}; + +&pinctrl { + pinctrl_leds: leds { + function = "led"; + pins = "gpio0", "gpio1"; + }; +}; + +&uart0 { + status = "ok"; +}; diff --git a/target/linux/bcm63xx/image/Makefile b/target/linux/bcm63xx/image/Makefile index e392d99f2c5..483e711a5d1 100644 --- a/target/linux/bcm63xx/image/Makefile +++ b/target/linux/bcm63xx/image/Makefile @@ -95,6 +95,31 @@ define Image/FileSystemStrip $(firstword $(subst +,$(space),$(subst root.,,$(notdir $(1))))) endef +define Build/ad1018-jffs2-cferam + mv $@ $@.kernel + + rm -rf $@-cferam + mkdir -p $@-cferam + + # CFE RAM JFFS2 partition + cp $(KDIR)/bcm63xx-cfe/$(CFE_RAM_FILE) $@-cferam/$(CFE_RAM_JFFS2_NAME) + $(call Build/cfe-jffs2,$@-cferam) + mv $@ $@.cferam + + # First block of CFE RAM 1 will be destroyed by MMAP + dd if=$@.cferam bs=$(BLOCKSIZE) count=1 > $@ + dd if=$@.cferam >> $@ + $(call Build/pad-to,896k) + + # CFE RAM 2 + dd if=$@.cferam >> $@ + + # Append kernel @ 4M + $(call Build/pad-to,4096k) + dd if=$@.kernel >> $@ + rm -f $@.kernel +endef + define Build/cfe-bin $(STAGING_DIR_HOST)/bin/imagetag -i $(IMAGE_KERNEL) -f $(IMAGE_ROOTFS) \ --output $@ --boardid $(CFE_BOARD_ID) --chipid $(CFE_CHIP_ID) \ diff --git a/target/linux/bcm63xx/image/bcm63xx_nand.mk b/target/linux/bcm63xx/image/bcm63xx_nand.mk index 9ff2c989b80..012745bbaca 100644 --- a/target/linux/bcm63xx/image/bcm63xx_nand.mk +++ b/target/linux/bcm63xx/image/bcm63xx_nand.mk @@ -85,3 +85,21 @@ define Device/netgear_dgnd3700-v2 CFE_WFI_FLASH_TYPE := 2 endef TARGET_DEVICES += netgear_dgnd3700-v2 + +### Sercomm ### +define Device/sercomm_ad1018 + $(Device/bcm63xx-nand) + IMAGE/cfe.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | ad1018-jffs2-cferam | append-ubi | cfe-wfi-tag + DEVICE_VENDOR := Sercomm + DEVICE_MODEL := AD1018 + CFE_CHIP_ID := 6328 + CFE_RAM_FILE := sercomm,ad1018/cferam + CFE_RAM_JFFS2_NAME := cferam + BLOCKSIZE := 128k + PAGESIZE := 2048 + SUBPAGESIZE := 512 + VID_HDR_OFFSET := 2048 + DEVICE_PACKAGES += $(B43_PACKAGES) $(USB2_PACKAGES) + CFE_WFI_FLASH_TYPE := 3 +endef +TARGET_DEVICES += sercomm_ad1018 diff --git a/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch b/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch index a48ecf961cc..f0c450de38b 100644 --- a/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch +++ b/target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch @@ -82,10 +82,11 @@ &board_AR5381u, &board_AR5387un, &board_963281TAN, -@@ -2719,6 +2787,7 @@ static struct of_device_id const bcm963x +@@ -2719,6 +2787,8 @@ static struct of_device_id const bcm963x { .compatible = "d-link,dsl-274xb-f1", .data = &board_dsl_274xb_f1, }, { .compatible = "nucom,r5010un-v2", .data = &board_R5010UNV2, }, { .compatible = "sagem,fast-2704-v2", .data = &board_FAST2704V2, }, ++ { .compatible = "sercomm,ad1018", .data = &board_AD1018, }, + { .compatible = "sercomm,ad1018-nor", .data = &board_AD1018, }, #endif #ifdef CONFIG_BCM63XX_CPU_6338 diff --git a/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch b/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch index c8db6c13669..d6af1e56b69 100644 --- a/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch +++ b/target/linux/bcm63xx/patches-5.4/562-board_sr102.patch @@ -58,7 +58,7 @@ #endif }; -@@ -2874,6 +2918,7 @@ static struct of_device_id const bcm963x +@@ -2875,6 +2919,7 @@ static struct of_device_id const bcm963x { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, { .compatible = "inteno,vg50", .data = &board_vw6339gu, }, diff --git a/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch b/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch index fa63150a1d8..a7e297d70e9 100644 --- a/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch +++ b/target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch @@ -53,7 +53,7 @@ &board_vw6339gu, &board_BSKYB_63168, #endif -@@ -2917,6 +2956,7 @@ static struct of_device_id const bcm963x +@@ -2918,6 +2957,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_63268 { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, }, diff --git a/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch b/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch index 139d2104c5c..f17c7a843b4 100644 --- a/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch +++ b/target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch @@ -40,7 +40,7 @@ &board_fast2504n, #endif -@@ -2934,6 +2960,7 @@ static struct of_device_id const bcm963x +@@ -2935,6 +2961,7 @@ static struct of_device_id const bcm963x { .compatible = "bt,home-hub-2-a", .data = &board_homehub2a, }, #endif #ifdef CONFIG_BCM63XX_CPU_6362 diff --git a/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch b/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch index 75fdf7a6981..ceca653ac67 100644 --- a/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch +++ b/target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch @@ -38,7 +38,7 @@ &board_VR3032u, &board_vw6339gu, &board_BSKYB_63168, -@@ -2983,6 +3007,7 @@ static struct of_device_id const bcm963x +@@ -2984,6 +3008,7 @@ static struct of_device_id const bcm963x #ifdef CONFIG_BCM63XX_CPU_63268 { .compatible = "brcm,bcm963268bu-p300", .data = &board_963268bu_p300, }, { .compatible = "brcm,bcm963269bhr", .data = &board_963269bhr, },