Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2023-05-08 00:05:02 +08:00
commit 705b3baffb
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
19 changed files with 400 additions and 10 deletions

View File

@ -63,6 +63,18 @@ define Trusted-Firmware-A/ls1012a-frwy-sdboot
BOOT_MODE:=qspi
endef
define Trusted-Firmware-A/ls1028a-rdb
TITLE:=NXP LS1028ARDB
PLAT:=ls1028ardb
BOOT_MODE:=flexspi_nor
endef
define Trusted-Firmware-A/ls1028a-rdb-sdboot
TITLE:=NXP LS1028ARDB SD Boot
PLAT:=ls1028ardb
BOOT_MODE:=sd
endef
define Trusted-Firmware-A/ls1043a-rdb
NAME:=NXP LS1043ARDB
PLAT:=ls1043ardb
@ -133,6 +145,8 @@ TFA_TARGETS := \
ls1012a-frdm \
ls1012a-rdb \
ls1012a-frwy-sdboot \
ls1028a-rdb \
ls1028a-rdb-sdboot \
ls1043a-rdb \
ls1043a-rdb-sdboot \
ls1046a-frwy \

View File

@ -87,6 +87,7 @@ linksys,ea8100-v2|\
mts,wg430223)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000"
;;
snr,snr-cpe-me1|\
snr,snr-cpe-me2-sfp|\
snr,cpe-w4n-mt)
idx="$(find_mtd_index uboot-env)"

View File

@ -45,6 +45,16 @@ define U-Boot/fsl_ls1012a-frwy-sdboot
ENV_SIZE:=0x10000
endef
define U-Boot/fsl_ls1028a-rdb
NAME:=NXP LS1028ARDB
UBOOT_CONFIG:=ls1028ardb_tfa
endef
define U-Boot/fsl_ls1028a-rdb-sdboot
NAME:=NXP LS1028ARDB SD Card Boot
UBOOT_CONFIG:=ls1028ardb_tfa
endef
define U-Boot/fsl_ls1043a-rdb
NAME:=NXP LS1043ARDB
UBOOT_CONFIG:=ls1043ardb_tfa
@ -127,6 +137,8 @@ UBOOT_TARGETS := \
fsl_ls1012a-frdm \
fsl_ls1012a-rdb \
fsl_ls1012a-frwy-sdboot \
fsl_ls1028a-rdb \
fsl_ls1028a-rdb-sdboot \
fsl_ls1043a-rdb \
fsl_ls1043a-rdb-sdboot \
fsl_ls1046a-frwy \

View File

@ -0,0 +1,10 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
fdt_high=0x8fffffff
initrd_high=0xffffffffffffffff
hwconfig=fsl_ddr:bank_intlv=auto
sd_boot=ext4load mmc 0:1 $loadaddr fitImage;bootm $loadaddr
bootargs=root=/dev/mmcblk0p2 rw rootwait rootfstype=squashfs,f2fs noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200
bootcmd=echo starting openwrt ...;run sd_boot
bootdelay=3
fsl_bootcmd_mcinitcmd_set=y

View File

@ -0,0 +1,9 @@
fdtaddr=0x8f000000
loadaddr=0x81000000
bootm_size=0x10000000
hwconfig=fsl_ddr:bank_intlv=auto
qspi_boot=sf probe 0:0;sf read $loadaddr 1000000 1000000;bootm $loadaddr
bootargs=rootfstype=squashfs,jffs2 noinitrd earlycon=uart8250,mmio,0x21c0500 console=ttyS0,115200 mtdparts=20c0000.spi:1m(bl2),4m(fip),1m(u-boot-env),128k(secure-boot-headers),48m@0x1000000(firmware)
bootcmd=echo starting openwrt ...;run qspi_boot
bootdelay=3
fsl_bootcmd_mcinitcmd_set=y

View File

@ -0,0 +1,33 @@
Index: uboot-layerscape-lf-6.1.1-1.0.0/arch/arm/cpu/armv8/sec_firmware.c
===================================================================
--- uboot-layerscape-lf-6.1.1-1.0.0.orig/arch/arm/cpu/armv8/sec_firmware.c
+++ uboot-layerscape-lf-6.1.1-1.0.0/arch/arm/cpu/armv8/sec_firmware.c
@@ -473,12 +473,6 @@ int fdt_fixup_kaslr(void *fdt)
return 0;
}
- ret = sec_firmware_get_random(rand, 8);
- if (ret < 0) {
- printf("WARNING: No random number to set kaslr-seed\n");
- return 0;
- }
-
err = fdt_check_header(fdt);
if (err < 0) {
printf("fdt_chosen: %s\n", fdt_strerror(err));
@@ -490,6 +484,15 @@ int fdt_fixup_kaslr(void *fdt)
if (nodeoffset < 0)
return 0;
+ if (fdt_find_or_add_subnode(fdt, nodeoffset, "kaslr-seed"))
+ return 0;
+
+ ret = sec_firmware_get_random(rand, 8);
+ if (ret < 0) {
+ printf("WARNING: No random number to set kaslr-seed\n");
+ return 0;
+ }
+
err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", rand,
sizeof(rand));
if (err < 0) {

View File

@ -0,0 +1,8 @@
--- a/configs/ls1028ardb_tfa_defconfig
+++ b/configs/ls1028ardb_tfa_defconfig
@@ -1,5 +1,4 @@
CONFIG_ARM=y
-CONFIG_GIC_V3_ITS=y
CONFIG_TARGET_LS1028ARDB=y
CONFIG_TFABOOT=y
CONFIG_SYS_MALLOC_F_LEN=0x6000

View File

@ -31,6 +31,8 @@ BOARDS := \
ls1012a-rdb \
ls1012a-frdm \
ls1012a-frwy-sdboot \
ls1028a-rdb \
ls1028a-rdb-sdboot \
ls1043a-rdb \
ls1043a-rdb-sdboot \
ls1046a-frwy \
@ -47,6 +49,8 @@ BOARDS := \
RCW_ls1012a-rdb :=ls1012ardb/R_SPNH_3508/rcw_1000_default.bin
RCW_ls1012a-frdm :=ls1012afrdm/N_SSNP_3305/rcw_800.bin
RCW_ls1012a-frwy-sdboot :=ls1012afrwy/N_SSNP_3305/rcw_1000_default.bin
RCW_ls1028a-rdb :=ls1028ardb/R_SQPP_0x85bb/rcw_1300.bin
RCW_ls1028a-rdb-sdboot :=ls1028ardb/R_SQPP_0x85bb/rcw_1500_sdboot.bin
RCW_ls1043a-rdb :=ls1043ardb/RR_FQPP_1455/rcw_1600.bin
RCW_ls1043a-rdb-sdboot :=ls1043ardb/RR_FQPP_1455/rcw_1600_sdboot.bin
RCW_ls1046a-frwy :=ls1046afrwy/NN_NNQNNPNP_3040_0506/rcw_1600_qspiboot.bin

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=iproute2
PKG_VERSION:=6.2.0
PKG_VERSION:=6.3.0
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
PKG_HASH:=4d72730200ec5b2aabaa1a2f20553c6748292f065d9a154c7d5e22559df9fd62
PKG_HASH:=dfb2a98db96e7a653cffc6693335a1a466e29a34b6ac528be48f35e1d2766732
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=iptables
PKG_LICENSE:=GPL-2.0

View File

@ -20,8 +20,8 @@ proto_mbim_init_config() {
proto_config_add_string username
proto_config_add_string password
[ -e /proc/sys/net/ipv6 ] && proto_config_add_string ipv6
proto_config_add_boolean dhcp
proto_config_add_boolean dhcpv6
proto_config_add_string dhcp
proto_config_add_string dhcpv6
proto_config_add_string pdptype
proto_config_add_int mtu
proto_config_add_defaults
@ -199,15 +199,15 @@ _proto_mbim_setup() {
proto_init_update "$ifname" 1
proto_send_update "$interface"
[ -z "$dhcp" ] && dhcp=1
[ -z "$dhcpv6" ] && dhcpv6=1
[ -z "$dhcp" ] && dhcp="auto"
[ -z "$dhcpv6" ] && dhcpv6="auto"
[ "$iptype" != "ipv6" ] && {
json_init
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
ipv4address=$(_proto_mbim_get_field ipv4address "$mbimconfig")
if [ -n "$ipv4address" ]; then
if [ -n "$ipv4address" -a "$dhcp" != 1 ]; then
json_add_string proto "static"
json_add_array ipaddr
@ -222,7 +222,7 @@ _proto_mbim_setup() {
json_add_string proto "dhcp"
fi
[ "$peerdns" = 0 ] || {
[ "$peerdns" = 0 -a "$dhcp" != 1 ] || {
json_add_array dns
for server in $(_proto_mbim_get_field ipv4dnsserver "$mbimconfig"); do
json_add_string "" "$server"
@ -242,7 +242,7 @@ _proto_mbim_setup() {
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
ipv6address=$(_proto_mbim_get_field ipv6address "$mbimconfig")
if [ -n "$ipv6address" ]; then
if [ -n "$ipv6address" -a "$dhcpv6" != 1 ]; then
json_add_string proto "static"
json_add_array ip6addr
@ -265,7 +265,7 @@ _proto_mbim_setup() {
json_add_string extendprefix 1
fi
[ "$peerdns" = 0 ] || {
[ "$peerdns" = 0 -a "$dhcpv6" != 1 ] || {
json_add_array dns
for server in $(_proto_mbim_get_field ipv6dnsserver "$mbimconfig"); do
json_add_string "" "$server"

View File

@ -12,6 +12,7 @@ users can bring up the board without difficulty.
LS1012ARDB (QSPI NOR boot)
LS1012AFRDM (QSPI NOR boot)
LS1012AFRWY (QSPI NOR boot)
LS1028ARDB (QSPI NOR boot | SD card boot)
LS1043ARDB (NOR boot | SD card boot)
LS1046ARDB (QSPI NOR boot | SD card boot)
LS1046AFRWY (QSPI NOR boot | SD card boot)
@ -95,6 +96,15 @@ from SD card. (sdcard.img images are gz-iped to save space. Please extract them
=> sf write a0000000 0 $filesize
=> reset
* LS1028ARDB
Board has only one bank. Those commands will replace stock bootloader
and firmware.
=> tftp a0000000 <firmware_name>-firmware.bin
=> sf probe 0:0
=> sf erase 0 +$filesize
=> sf write a0000000 0 $filesize
=> reset
* LS1043ARDB
Start up from bank0, and program firmware to bank4 with below commands.
Switch to bank4 to start up OpenWrt.

View File

@ -495,6 +495,7 @@ CONFIG_MOUSE_PS2_TRACKPOINT=y
# CONFIG_MOUSE_VSXXXAA is not set
CONFIG_MPILIB=y
CONFIG_MRP=y
CONFIG_MSCC_OCELOT_SWITCH_LIB=y
CONFIG_MTD_CFI_ADV_OPTIONS=y
# CONFIG_MTD_CFI_GEOMETRY is not set
CONFIG_MTD_CFI_STAA=y
@ -527,6 +528,10 @@ CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_NET_DEVLINK=y
CONFIG_NET_DSA=y
CONFIG_NET_DSA_MSCC_FELIX=y
CONFIG_NET_DSA_TAG_OCELOT=y
CONFIG_NET_DSA_TAG_OCELOT_8021Q=y
CONFIG_NET_FAILOVER=y
CONFIG_NET_FLOW_LIMIT=y
CONFIG_NET_NS=y

View File

@ -5,6 +5,10 @@
board_config_update
case "$(board_name)" in
fsl,ls1028a-rdb|\
fsl,ls1028a-rdb-sdboot)
ucidef_set_interfaces_lan_wan "swp0 swp1 swp2 swp3" "eth0"
;;
traverse,ls1043v)
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
ucidef_set_interface_wan "eth4"

View File

@ -10,6 +10,7 @@ move_config() {
fsl,ls1012a-frwy-sdboot | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1028a-rdb-sdboot | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-frwy-sdboot | \
fsl,ls1046a-rdb-sdboot | \

View File

@ -71,6 +71,7 @@ platform_copy_config() {
fsl,ls1012a-frwy-sdboot | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1028a-rdb-sdboot | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-frwy-sdboot | \
fsl,ls1046a-rdb-sdboot | \
@ -95,6 +96,8 @@ platform_check_image() {
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1028a-rdb | \
fsl,ls1028a-rdb-sdboot | \
fsl,ls1043a-rdb | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-frwy | \
@ -130,6 +133,7 @@ platform_do_upgrade() {
fsl,ls1012a-frdm | \
fsl,ls1012a-rdb | \
fsl,ls1021a-twr | \
fsl,ls1028a-rdb | \
fsl,ls1043a-rdb | \
fsl,ls1046a-frwy | \
fsl,ls1046a-rdb | \
@ -142,6 +146,7 @@ platform_do_upgrade() {
fsl,ls1012a-frwy-sdboot | \
fsl,ls1021a-iot-sdboot | \
fsl,ls1021a-twr-sdboot | \
fsl,ls1028a-rdb-sdboot | \
fsl,ls1043a-rdb-sdboot | \
fsl,ls1046a-frwy-sdboot | \
fsl,ls1046a-rdb-sdboot | \

View File

@ -98,6 +98,53 @@ define Device/fsl_ls1012a-frwy-sdboot
endef
TARGET_DEVICES += fsl_ls1012a-frwy-sdboot
define Device/fsl_ls1028a-rdb
DEVICE_VENDOR := NXP
DEVICE_MODEL := LS1028A-RDB
DEVICE_VARIANT := Default
DEVICE_DTS := freescale/fsl-ls1028a-rdb
KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
DEVICE_PACKAGES += \
trusted-firmware-a-ls1028a-rdb \
kmod-hwmon-ina2xx \
kmod-hwmon-lm90 \
kmod-rtc-pcf2127
IMAGE/firmware.bin := \
ls-clean | \
ls-append $(1)-bl2.pbl | pad-to 1M | \
ls-append $(1)-fip.bin | pad-to 5M | \
ls-append $(1)-uboot-env.bin | pad-to 16M | \
append-kernel | \
append-rootfs | pad-rootfs | check-size
IMAGE/sysupgrade.bin := \
append-kernel | \
append-rootfs | pad-rootfs | \
check-size $(LS_SYSUPGRADE_IMAGE_SIZE) | append-metadata
endef
TARGET_DEVICES += fsl_ls1028a-rdb
define Device/fsl_ls1028a-rdb-sdboot
$(Device/fsl-sdboot)
DEVICE_VENDOR := NXP
DEVICE_MODEL := LS1028A-RDB
DEVICE_VARIANT := SD Card Boot
DEVICE_DTS := freescale/fsl-ls1028a-rdb
DEVICE_PACKAGES += \
trusted-firmware-a-ls1028a-rdb-sdboot \
kmod-hwmon-ina2xx \
kmod-hwmon-lm90 \
kmod-rtc-pcf2127
IMAGE/sdcard.img.gz := \
ls-clean | \
ls-append-sdhead $(1) | pad-to 4K | \
ls-append $(1)-bl2.pbl | pad-to 1M | \
ls-append $(1)-fip.bin | pad-to 5M | \
ls-append $(1)-uboot-env.bin | pad-to 16M | \
ls-append-kernel | pad-to $(LS_SD_ROOTFSPART_OFFSET)M | \
append-rootfs | pad-to $(LS_SD_IMAGE_SIZE)M | gzip
endef
TARGET_DEVICES += fsl_ls1028a-rdb-sdboot
define Device/fsl_ls1043a-rdb
$(Device/fix-sysupgrade)
DEVICE_VENDOR := NXP

View File

@ -0,0 +1,212 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
/ {
compatible = "snr,snr-cpe-me1", "mediatek,mt7621-soc";
model = "SNR-CPE-ME1";
aliases {
label-mac-device = &gmac1;
led-boot = &led_usb;
led-failsafe = &led_vpn;
led-running = &led_green;
led-upgrade = &led_sys;
};
leds {
compatible = "gpio-leds";
led_usb: led-0 { // USB Activity
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_USB;
gpios = <&gpio 13 GPIO_ACTIVE_LOW>; // [JTAG] JTDO
};
led_vpn: led-1 { // VPN Activity
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_INDICATOR;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>; // [JTAG] JTCLK
};
led_sys: led-2 { // System config
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_STATUS;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>; // [I2C] I2C_SD
panic-indicator;
};
led_green: led-3 { // ? LED
color = <LED_COLOR_ID_GREEN>;
function = LED_FUNCTION_HEARTBEAT;
gpios = <&gpio 15 GPIO_ACTIVE_LOW>; // [JTAG] JTMS
};
};
keys {
compatible = "gpio-keys";
reset {
label = "Reset Button";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>; // [JTAG] JTDI
linux,code = <KEY_RESTART>;
};
};
reg_usb_vbus: regulator {
compatible = "regulator-fixed";
regulator-name = "usb_vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio 17 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
reg_3p3v: regulator-3p3v {
compatible = "regulator-fixed";
regulator-name = "fixed-3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-boot-on;
regulator-always-on;
};
};
&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy4>;
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};
&mdio {
ethphy4: ethernet-phy@4 {
reg = <4>;
};
};
&pcie {
status = "okay";
};
&pcie0 { // MT7603EN
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
ieee80211-freq-limit = <2400000 2500000>;
};
};
&pcie1 { // MT7610EN
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
};
};
&spi0 {
status = "okay";
flash@0 { // GD25Q128CSIG
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <44000000>; // 44 MHz
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "Config";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "Factory";
reg = <0x40000 0x10000>;
read-only;
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_factory_e000: macaddr@e000 {
reg = <0xe000 0x6>;
};
macaddr_factory_e006: macaddr@e006 {
reg = <0xe006 0x6>;
};
};
partition@50000 {
compatible = "openwrt,uimage", "denx,uimage";
label = "firmware";
reg = <0x50000 0xfb0000>;
};
partition@30001 {
label = "uboot-env";
reg = <0x30000 0x1000>;
};
};
};
};
&state_default {
gpio {
groups = "i2c", "jtag";
function = "gpio";
};
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "lan4";
};
port@1 {
status = "okay";
label = "lan3";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan1";
};
};
};
&xhci {
vbus-supply = <&reg_usb_vbus>;
vusb33-supply = <&reg_3p3v>;
};

View File

@ -2044,6 +2044,18 @@ define Device/sim_simax1800t
endef
TARGET_DEVICES += sim_simax1800t
define Device/snr_snr-cpe-me1
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
IMAGE_SIZE := 15040k
DEVICE_VENDOR := SNR
DEVICE_MODEL := SNR-CPE-ME1
UIMAGE_NAME := SNR-CPE-ME1-5GHZ-MT
DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x0e kmod-usb3 \
kmod-usb-ledtrig-usbport uboot-envtools
endef
TARGET_DEVICES += snr_snr-cpe-me1
define Device/snr_snr-cpe-me2-lite
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)

View File

@ -163,6 +163,9 @@ oraybox,x3a)
ucidef_set_led_netdev "wan" "wan link" "red:status" "wan"
ucidef_set_led_netdev "lan" "lan link" "green:status" "br-lan"
;;
snr,snr-cpe-me1)
ucidef_set_led_usbport "usb" "USB" "green:usb" "usb1-port1" "usb2-port1"
;;
tplink,archer-a6-v3|\
tplink,archer-ax23-v1|\
tplink,archer-c6-v3|\