Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen
2023-06-16 12:29:54 +08:00
22 changed files with 632 additions and 90 deletions

View File

@@ -301,6 +301,7 @@ nand_upgrade_fit() {
nand_upgrade_tar() {
local tar_file="$1"
local gz="$2"
local jffs2_markers="${CI_JFFS2_CLEAN_MARKERS:-0}"
# WARNING: This fails if tar contains more than one 'sysupgrade-*' directory.
local board_dir="$(tar t${gz}f "$tar_file" | grep -m 1 '^sysupgrade-.*/$')"
@@ -329,6 +330,7 @@ nand_upgrade_tar() {
ubi_kernel_length="$kernel_length"
fi
fi
local has_env=0
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "$ubi_kernel_length" "$has_env" || return 1
@@ -340,8 +342,14 @@ nand_upgrade_tar() {
fi
if [ "$kernel_length" ]; then
if [ "$kernel_mtd" ]; then
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
mtd write - "$CI_KERNPART"
if [ "$jffs2_markers" = 1 ]; then
flash_erase -j "/dev/mtd${kernel_mtd}" 0 0
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
nandwrite "/dev/mtd${kernel_mtd}" -
else
tar xO${gz}f "$tar_file" "$board_dir/kernel" | \
mtd write - "$CI_KERNPART"
fi
else
local ubidev="$( nand_find_ubi "${CI_KERN_UBIPART:-$CI_UBIPART}" )"
local kern_ubivol="$( nand_find_volume $ubidev "$CI_KERNPART" )"

View File

@@ -122,6 +122,7 @@ hostapd_common_add_device_config() {
config_add_array hostapd_options
config_add_int airtime_mode
config_add_int mbssid
hostapd_add_log_config
}
@@ -135,7 +136,7 @@ hostapd_prepare_device_config() {
json_get_vars country country3 country_ie beacon_int:100 doth require_mode legacy_rates \
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \
rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \
vendor_vht
mbssid:0 vendor_vht
hostapd_set_log_options base_cfg
@@ -237,6 +238,7 @@ hostapd_prepare_device_config() {
[ -n "$rts_threshold" ] && append base_cfg "rts_threshold=$rts_threshold" "$N"
[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N"
[ "$mbssid" -gt 0 ] && [ "$mbssid" -le 2 ] && append base_cfg "mbssid=$mbssid" "$N"
json_get_values opts hostapd_options
for val in $opts; do

View File

@@ -9,7 +9,7 @@ ARCH:=mips
BOARD:=bcm63xx
BOARDNAME:=Broadcom BCM63xx
SUBTARGETS:=generic smp
FEATURES:=squashfs usb atm pci pcmcia usbgadget
FEATURES:=squashfs usb atm pci pcmcia usbgadget source-only
KERNEL_PATCHVER:=5.15

View File

@@ -29,42 +29,6 @@ platform_check_image() {
esac
}
cfe_jffs2_upgrade_tar() {
local tar_file="$1"
local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
if [ -z "$kernel_mtd" ]; then
echo "$CI_KERNPART partition not found"
return 1
fi
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c 2> /dev/null)
local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c 2> /dev/null)
if [ "$kernel_length" = 0 ]; then
echo "kernel cannot be empty"
return 1
fi
flash_erase -j /dev/mtd${kernel_mtd} 0 0
tar xf $tar_file ${board_dir}/kernel -O | nandwrite /dev/mtd${kernel_mtd} -
local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "0" "0"
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)"
tar xf $tar_file ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
nand_do_upgrade_success
}
platform_do_upgrade() {
case "$(board_name)" in
comtrend,vg-8050|\
@@ -72,7 +36,8 @@ platform_do_upgrade() {
huawei,hg253s-v2|\
netgear,dgnd3700-v2)
REQUIRE_IMAGE_METADATA=1
cfe_jffs2_upgrade_tar "$1"
CI_JFFS2_CLEAN_MARKERS=1
nand_do_upgrade "$1"
;;
sercomm,ad1018|\
sercomm,h500-s-lowi|\

View File

@@ -167,6 +167,7 @@
compatible = "brcm,wfi";
label = "wfi";
reg = <0x0004000 0x1c7c000>;
brcm,cferam = "cfe";
};
partition@1c80000 {

View File

@@ -1,37 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
cfe_jffs2_nand_upgrade() {
local tar_file="$1"
local kernel_mtd="$(find_mtd_index $CI_KERNPART)"
if [ -z "$kernel_mtd" ]; then
echo "$CI_KERNPART partition not found"
return 1
fi
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
local kernel_length=$(tar xf $tar_file ${board_dir}/kernel -O | wc -c 2> /dev/null)
local rootfs_length=$(tar xf $tar_file ${board_dir}/root -O | wc -c 2> /dev/null)
if [ "$kernel_length" = 0 ]; then
echo "kernel cannot be empty"
return 1
fi
flash_erase -j /dev/mtd${kernel_mtd} 0 0
tar xf $tar_file ${board_dir}/kernel -O | nandwrite /dev/mtd${kernel_mtd} -
local rootfs_type="$(identify_tar "$tar_file" ${board_dir}/root)"
nand_upgrade_prepare_ubi "$rootfs_length" "$rootfs_type" "0" "0"
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
local root_ubivol="$(nand_find_volume $ubidev $CI_ROOTPART)"
tar xf $tar_file ${board_dir}/root -O | \
ubiupdatevol /dev/$root_ubivol -s $rootfs_length -
nand_do_upgrade_success
}

View File

@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
. /lib/upgrade/cfe-jffs2-nand.sh
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
@@ -12,7 +10,8 @@ platform_check_image() {
platform_do_upgrade() {
case "$(board_name)" in
comtrend,vr-3032u)
cfe_jffs2_nand_upgrade "$1"
CI_JFFS2_CLEAN_MARKERS=1
nand_do_upgrade "$1"
;;
sercomm,h500-s-lowi |\
sercomm,h500-s-vfes |\

View File

@@ -0,0 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-or-later
. /lib/functions/leds.sh
. /lib/functions/uci-defaults.sh
board_config_update
case "$(board_name)" in
sercomm,ad1018)
ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
;;
esac
board_config_flush
exit 0

View File

@@ -10,6 +10,10 @@ comtrend,ar-5387un)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
;;
sercomm,ad1018)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "lan1 lan2 lan3 fibre"
;;
esac
board_config_flush

View File

@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
. /lib/upgrade/cfe-jffs2-nand.sh
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
@@ -11,6 +9,9 @@ platform_check_image() {
platform_do_upgrade() {
case "$(board_name)" in
sercomm,ad1018)
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;

View File

@@ -1,7 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
. /lib/upgrade/cfe-jffs2-nand.sh
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
@@ -13,7 +11,8 @@ platform_do_upgrade() {
case "$(board_name)" in
huawei,hg253s-v2 |\
netgear,dgnd3700-v2)
cfe_jffs2_nand_upgrade "$1"
CI_JFFS2_CLEAN_MARKERS=1
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"

View File

@@ -6,6 +6,10 @@
board_config_update
case "$(board_name)" in
actiontec,r1000h)
ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
;;
comtrend,wap-5813n)
ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
;;

View File

@@ -14,6 +14,7 @@ comtrend,vr-3025un)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "lan1 lan2 lan3 iptv"
;;
actiontec,r1000h |\
comtrend,wap-5813n |\
netgear,dgnd3700-v1 |\
netgear,dgnd3800b |\

View File

@@ -3,6 +3,7 @@
. /lib/functions.sh
case "$(board_name)" in
actiontec,r1000h |\
comtrend,vr-3025u |\
comtrend,vr-3025un |\
comtrend,wap-5813n |\

View File

@@ -0,0 +1,312 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "bcm6328.dtsi"
/ {
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;
};
keys {
compatible = "gpio-keys-polled";
poll-interval = <100>;
wps {
label = "wps";
gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
debounce-interval = <60>;
};
wlan {
label = "wlan";
gpios = <&gpio 25 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WLAN>;
debounce-interval = <60>;
};
reset {
label = "reset";
gpios = <&gpio 31 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};
};
bcm432217-sprom {
compatible = "brcm,bcma-sprom";
pci-bus = <1>;
pci-dev = <0>;
nvmem-cells = <&macaddr_cferom_6a0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <1>;
brcm,sprom = "brcm/bcm43217-sprom.bin";
brcm,sprom-fixups = <6 0x1c00>,
<65 0x1256>,
<96 0x2046>,
<97 0xfe69>,
<98 0x1726>,
<99 0xfa5c>,
<112 0x2046>,
<113 0xfea8>,
<114 0x1978>,
<115 0xfa26>,
<161 0x2222>,
<169 0x2222>,
<171 0x2222>,
<173 0x2222>,
<174 0x4444>,
<175 0x2222>,
<176 0x4444>;
};
};
&ehci {
status = "okay";
};
&ethernet {
status = "okay";
nvmem-cells = <&macaddr_cferom_6a0>;
nvmem-cell-names = "mac-address";
};
&leds {
status = "okay";
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 = "red:internet";
};
led@1 {
reg = <1>;
active-low;
label = "green:internet";
};
led_power_green: led@8 {
reg = <8>;
active-low;
label = "green:power";
default-state = "on";
};
led@10 {
reg = <10>;
active-low;
label = "green:adsl";
};
led@11 {
reg = <11>;
active-low;
label = "red:adsl";
};
led@12 {
reg = <12>;
active-low;
label = "green:phone";
};
led@13 {
reg = <13>;
active-low;
label = "green:wps";
};
led@14 {
reg = <14>;
active-low;
label = "green:wifi";
};
led@15 {
reg = <15>;
active-low;
label = "green:usb";
};
led@17 {
/* EPHY0 Spd */
reg = <17>;
brcm,hardware-controlled;
};
};
&ohci {
status = "okay";
};
&pcie {
status = "okay";
};
&pinctrl {
pinctrl_leds: leds {
function = "led";
pins = "gpio0", "gpio1";
};
};
&nflash {
status = "okay";
nandcs@0 {
compatible = "brcm,nandcs";
reg = <0>;
nand-ecc-step-size = <512>;
nand-ecc-strength = <15>;
nand-on-flash-bbt;
#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 = "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@340000 {
label = "serial";
reg = <0x0340000 0x00a0000>;
read-only;
};
partition@3e0000 {
label = "protect";
reg = <0x03e0000 0x0140000>;
read-only;
};
partition@6920000 {
label = "bootflag1";
reg = <0x6920000 0x0140000>;
read-only;
};
partition@6a60000 {
label = "bootflag2";
reg = <0x6a60000 0x0140000>;
read-only;
};
partition@520000 {
compatible = "sercomm,wfi";
label = "wfi";
reg = <0x0520000 0x6400000>;
};
partition@6ba0000 {
label = "xml_cfg";
reg = <0x6ba0000 0x0280000>;
read-only;
};
partition@6e20000 {
label = "app_dat";
reg = <0x6e20000 0x0280000>;
read-only;
};
};
};
};
&switch0 {
ports {
port@0 {
reg = <0>;
label = "fibre";
phy-handle = <&phy1>;
phy-mode = "mii";
};
port@1 {
reg = <1>;
label = "lan3";
phy-handle = <&phy2>;
phy-mode = "mii";
};
port@2 {
reg = <2>;
label = "lan2";
phy-handle = <&phy3>;
phy-mode = "mii";
};
port@3 {
reg = <3>;
label = "lan1";
phy-handle = <&phy4>;
phy-mode = "mii";
};
};
};
&uart0 {
status = "okay";
};
&usbh {
status = "okay";
};
&cferom {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_cferom_6a0: macaddr@6a0 {
reg = <0x6a0 0x6>;
};
};

View File

@@ -222,6 +222,7 @@
compatible = "brcm,wfi";
label = "wfi";
reg = <0x0004000 0x1c7c000>;
brcm,cferam = "cfe";
};
partition@1c80000 {

View File

@@ -0,0 +1,220 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "bcm6368.dtsi"
/ {
model = "Actiontec R1000H";
compatible = "actiontec,r1000h", "brcm,bcm6368";
aliases {
led-boot = &led_power_green;
led-failsafe = &led_power_red;
led-running = &led_power_green;
led-upgrade = &led_power_green;
};
keys {
compatible = "gpio-keys-polled";
poll-interval = <100>;
reset {
label = "reset";
gpios = <&gpio 34 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};
wps {
label = "wps";
gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
led@5 {
label = "green:wan";
gpios = <&gpio 5 GPIO_ACTIVE_HIGH>;
};
led@21 {
label = "green:usb";
gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
};
led_power_green: led@22 {
label = "green:power";
gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
};
led@23 {
label = "green:wps";
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
};
led_power_red: led@24 {
label = "red:power";
gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
panic-indicator;
};
led@30 {
label = "red:wps";
gpios = <&gpio 30 GPIO_ACTIVE_LOW>;
};
led@31 {
label = "red:wan";
gpios = <&gpio 31 GPIO_ACTIVE_HIGH>;
};
};
};
&ehci {
status = "okay";
};
&ethernet {
status = "okay";
nvmem-cells = <&macaddr_cfe_6a0>;
nvmem-cell-names = "mac-address";
};
&mdio_ext {
switch@1e {
compatible = "brcm,bcm53115";
reg = <30>;
dsa,member = <1 0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan1";
};
port@1 {
reg = <1>;
label = "lan2";
};
port@2 {
reg = <2>;
label = "lan3";
};
port@3 {
reg = <3>;
label = "lan4";
};
port@4 {
reg = <4>;
label = "wan";
};
port@5 {
/* HPNA coaxial port */
reg = <5>;
label = "coax";
phy-mode = "mii";
fixed-link {
speed = <100>;
full-duplex;
};
};
port@8 {
reg = <8>;
phy-mode = "rgmii";
ethernet = <&switch0port5>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
};
&switch0 {
dsa,member = <0 0>;
ports {
switch0port5: port@5 {
reg = <5>;
label = "extsw";
phy-mode = "rgmii";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
&pflash {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
cfe: partition@0 {
label = "CFE";
reg = <0x000000 0x020000>;
read-only;
};
partition@20000 {
label = "firmware";
reg = <0x020000 0x1fc0000>;
compatible = "brcm,bcm963xx-imagetag";
};
partition@fe0000 {
label = "nvram";
reg = <0x1fe0000 0x020000>;
};
};
};
&ohci {
status = "okay";
};
&pci {
status = "okay";
};
&uart0 {
status = "okay";
};
&usbh {
status = "okay";
};
&cfe {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_cfe_6a0: macaddr@6a0 {
reg = <0x6a0 0x6>;
};
};

View File

@@ -123,7 +123,7 @@
#address-cells = <1>;
#size-cells = <0>;
wan@0 {
port@0 {
reg = <0>;
label = "wan";
};

View File

@@ -4,7 +4,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
KERNEL_LOADADDR := 0x80010000 # RAM start + 64K
LOADER_ENTRY := 0x80a00000 # RAM start + 10M, for relocate
LOADER_ENTRY := 0x81000000 # RAM start + 16M, for relocate
LZMA_TEXT_START := 0x82000000 # RAM start + 32M
DEVICE_VARS += CFE_BOARD_ID CFE_EXTRAS

View File

@@ -25,3 +25,21 @@ define Device/comtrend_ar-5387un
kmod-leds-bcm6328
endef
TARGET_DEVICES += comtrend_ar-5387un
define Device/sercomm_ad1018
$(Device/sercomm-nand)
DEVICE_VENDOR := Sercomm
DEVICE_MODEL := AD1018
CHIP_ID := 6328
BLOCKSIZE := 128k
PAGESIZE := 2048
SUBPAGESIZE := 512
VID_HDR_OFFSET := 2048
DEVICE_PACKAGES += $(USB2_PACKAGES) \
$(B43_PACKAGES) broadcom-43217-sprom \
kmod-leds-bcm6328
SERCOMM_FSVER := 1001
SERCOMM_HWVER := 1415153
SERCOMM_SWVER := 3013
endef
TARGET_DEVICES += sercomm_ad1018

View File

@@ -1,5 +1,20 @@
# SPDX-License-Identifier: GPL-2.0-or-later
define Device/actiontec_r1000h
$(Device/bcm63xx-cfe)
DEVICE_VENDOR := Actiontec
DEVICE_MODEL := R1000H
CHIP_ID := 6368
CFE_BOARD_ID := 96368VVW
BLOCKSIZE := 0x20000
FLASH_MB := 32
CFE_EXTRAS += --signature "$$(DEVICE_VENDOR)"
DEVICE_PACKAGES += $(USB2_PACKAGES) \
$(B43_PACKAGES) \
kmod-leds-gpio
endef
TARGET_DEVICES += actiontec_r1000h
define Device/comtrend_vr-3025u
$(Device/bcm63xx-cfe)
DEVICE_VENDOR := Comtrend

View File

@@ -31,6 +31,7 @@
#define CFERAM_NAME "cferam"
#define CFERAM_NAME_LEN (sizeof(CFERAM_NAME) - 1)
#define CFERAM_NAME_MAX_LEN 32
#define KERNEL_NAME "vmlinux.lz"
#define KERNEL_NAME_LEN (sizeof(KERNEL_NAME) - 1)
#define OPENWRT_NAME "1-openwrt"
@@ -157,17 +158,28 @@ static int parse_bcm_wfi(struct mtd_info *master,
const struct mtd_partition **pparts,
uint8_t *buf, loff_t off, loff_t size, bool cfe_part)
{
struct device_node *mtd_node;
struct mtd_partition *parts;
loff_t cfe_off, kernel_off, rootfs_off;
unsigned int num_parts = BCM_WFI_PARTS, cur_part = 0;
const char *cferam_name = CFERAM_NAME;
size_t cferam_name_len;
int ret;
mtd_node = mtd_get_of_node(master);
if (mtd_node)
of_property_read_string(mtd_node, "brcm,cferam", &cferam_name);
cferam_name_len = strnlen(cferam_name, CFERAM_NAME_MAX_LEN);
if (cferam_name_len > 0)
cferam_name_len--;
if (cfe_part) {
num_parts++;
cfe_off = off;
ret = jffs2_find_file(master, buf, CFERAM_NAME,
CFERAM_NAME_LEN, &cfe_off,
ret = jffs2_find_file(master, buf, cferam_name,
cferam_name_len, &cfe_off,
size - (cfe_off - off), NULL, NULL);
if (ret)
return ret;