bcm63xx: add unmodded SERCOMM AD1018 support
authorÁlvaro Fernández Rojas <noltari@gmail.com>
Tue, 19 May 2020 11:29:12 +0000 (13:29 +0200)
committerÁlvaro Fernández Rojas <noltari@gmail.com>
Tue, 19 May 2020 11:33:39 +0000 (13:33 +0200)
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 <noltari@gmail.com>
12 files changed:
target/linux/bcm63xx/base-files/etc/board.d/01_leds
target/linux/bcm63xx/base-files/etc/board.d/02_network
target/linux/bcm63xx/base-files/etc/uci-defaults/09_fix_crc
target/linux/bcm63xx/base-files/lib/upgrade/platform.sh
target/linux/bcm63xx/dts/bcm6328-sercomm-ad1018.dts [new file with mode: 0644]
target/linux/bcm63xx/image/Makefile
target/linux/bcm63xx/image/bcm63xx_nand.mk
target/linux/bcm63xx/patches-5.4/561-board_AD1018.patch
target/linux/bcm63xx/patches-5.4/562-board_sr102.patch
target/linux/bcm63xx/patches-5.4/563-board-VR-3032u.patch
target/linux/bcm63xx/patches-5.4/564-board-DGND3700v2.patch
target/linux/bcm63xx/patches-5.4/565-board-VG-8050.patch

index cdbfa6319bea112f08d2790cccd26513e5cd48f3..89105866a417201890cae44cb16d97579cccb10e 100755 (executable)
@@ -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"
        ;;
index d0c15a9f9871367d35a095f50bc03a8d6dc8f1e5..14eb1091f52249d8dba53e0348c8abd49817b205 100755 (executable)
@@ -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"
index c33e56f28e22ac3bdee9285dc3cabf2019ce3d35..813b51fb52c79ec6fa84da8dfd230bd796312309 100644 (file)
@@ -40,4 +40,7 @@ case "$(board_name)" in
        zyxel,p870hw-51a-v2)
                do_fixcrc
                ;;
+       sercomm,ad1018)
+               mtd erase bootflag2
+               ;;
 esac
index e92d025de7daeec16ffc4751819036ab1bef36cb..093eba056edc348d6f69e5bb2768483683540a41 100644 (file)
@@ -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 (file)
index 0000000..7f9a6e2
--- /dev/null
@@ -0,0 +1,210 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+/dts-v1/;
+
+#include "bcm6328.dtsi"
+
+#include <dt-bindings/input/input.h>
+
+/ {
+       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 = <KEY_WPS_BUTTON>;
+                       debounce-interval = <60>;
+               };
+
+               wifi {
+                       label = "wifi";
+                       gpios = <&pinctrl 25 1>;
+                       linux,code = <KEY_WLAN>;
+                       debounce-interval = <60>;
+               };
+
+               reset {
+                       label = "reset";
+                       gpios = <&pinctrl 31 1>;
+                       linux,code = <KEY_RESTART>;
+                       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";
+};
index e392d99f2c544370851527b6ddda714b8b5a961e..483e711a5d1eddc86751be3b69d1a40114501571 100644 (file)
@@ -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) \
index 9ff2c989b80d079b67a9f3aeb072813d73ee05d3..012745bbaca2b1e0287aa397bbd403e8db712b66 100644 (file)
@@ -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
index a48ecf961cc1401c1b4c210dd80fbf4c025617f8..f0c450de38b4fbbcf61e3923b5fd504bf2c72df0 100644 (file)
        &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
index c8db6c13669b158670d3d47d4d9c7d5c7180d196..d6af1e56b6943f3859c74f2d1bfa0bcf6bec7333 100644 (file)
@@ -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, },
index fa63150a1d8d87cf93a196ba31b89f9671ddc124..a7e297d70e99d59992b05b1b3057abf98348c070 100644 (file)
@@ -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, },
index 139d2104c5c9fe550d368011c2f0878bb4d9f681..f17c7a843b401dae7281bbc787fa733b4fa6f0ab 100644 (file)
@@ -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
index 75fdf7a698182bd78f3937af5520060cde548eb0..ceca653ac67766b4a03fe59d77b5eb6c47622ab3 100644 (file)
@@ -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, },