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 <noltari@gmail.com>
master
Álvaro Fernández Rojas 2020-05-19 13:29:12 +02:00
parent 5d3bb7ea9a
commit 5f82691923
12 changed files with 268 additions and 7 deletions

View File

@ -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"
;;

View File

@ -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"

View File

@ -40,4 +40,7 @@ case "$(board_name)" in
zyxel,p870hw-51a-v2)
do_fixcrc
;;
sercomm,ad1018)
mtd erase bootflag2
;;
esac

View 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"
;;

View File

@ -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";
};

View 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) \

View 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

View File

@ -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

View 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, },

View 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, },

View 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

View 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, },