ramips: rewrite ZTE E8820S support

- Fixed PCIe reset
- Fixed reset button, WLAN LEDs
- Fixed sysupgrade feature
- Fixed NVMEM bindings

This requires install new custom U-Boot, which can be downloaded at:
https://firmware.download.immortalwrt.eu.org/uboot/ramips/mt7621-zte_e8820s-u-boot.bin

Or build it manually:
git clone https://github.com/DragonBluep/uboot-mt7621 && cd uboot-mt7621
./customize.sh NAND '2176k(Bootloader),1280k(config),1280k(factory),-(firmware)' \
	'0x4a0000' '18' '16' '880' '1200' 'DDR3-512MiB' 'false' '115200'

Flash instructions for existing users:
1. Run the following commands on device:
   opkg install kmod-mtd-rw
   insmod mtd-rw i_want_a_brick=1
   mtd write mt7621-zte_e8820s-u-boot.bin u-boot
2. Cut off the power and re-engage, enter 192.168.1.1 to upload initramfs.bin.
3. After ImmortalWrt has booted, perform sysupgrade.

Flash instructions for new users:
1. Rename the U-Boot file to `ZTE_img.bin`
2. Set static IP on your PC:
   IP 192.168.1.2/24, GW 192.168.1.254
3. Serve the U-Boot file using TFTP server.
4. Cut off the power, keep pressing `reset` button then engage the power.
5. Wait for U-Boot download to complete, enter 192.168.1.1 to upload initramfs.bin.
6. After ImmortalWrt has booted, perform sysupgrade.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
(cherry picked from commit 85e0f369a0)
This commit is contained in:
Tianling Shen 2023-11-07 21:51:29 +08:00
parent 12445fed33
commit 681be7df62
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
5 changed files with 90 additions and 112 deletions

View File

@ -10,10 +10,10 @@
model = "ZTE E8820S"; model = "ZTE E8820S";
aliases { aliases {
led-boot = &led_sys; led-boot = &power_led;
led-failsafe = &led_sys; led-failsafe = &system_led;
led-running = &led_power; led-running = &system_led;
led-upgrade = &led_power; led-upgrade = &system_led;
label-mac-device = &gmac0; label-mac-device = &gmac0;
}; };
@ -21,69 +21,63 @@
bootargs = "console=ttyS0,115200"; bootargs = "console=ttyS0,115200";
}; };
leds { gpio-leds {
compatible = "gpio-leds"; compatible = "gpio-leds";
led_power: power { power_led: led-power {
label = "white:power"; label = "white:power";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>; gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
}; };
led_sys: sys { system_led: led-system {
label = "white:sys"; label = "white:system";
gpios = <&gpio 3 GPIO_ACTIVE_LOW>; gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
}; };
wlan2g {
label = "white:wlan2g";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
wlan5g {
label = "white:wlan5g";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
}; };
keys { gpio-keys {
compatible = "gpio-keys"; compatible = "gpio-keys";
reset { button-reset {
label = "reset"; label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_HIGH>; gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>; linux,code = <KEY_RESTART>;
}; };
wps { button-wifi {
label = "wps";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
wifi {
label = "wifi"; label = "wifi";
gpios = <&gpio 10 GPIO_ACTIVE_LOW>; gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RFKILL>; linux,code = <KEY_RFKILL>;
}; };
};
ubi-concat { button-wps {
compatible = "mtd-concat"; label = "wps";
devices = <&ubipart0 &ubipart1>; gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
ubi@0 {
label = "ubi";
reg = <0x0 0x79c0000>;
};
}; };
}; };
}; };
&gmac0 {
nvmem-cells = <&macaddr_config_12 0>;
nvmem-cell-names = "mac-address";
};
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy4>;
nvmem-cells = <&macaddr_config_12 0>;
nvmem-cell-names = "mac-address";
};
&mdio {
ethphy4: ethernet-phy@4 {
reg = <4>;
};
};
&nand { &nand {
status = "okay"; status = "okay";
@ -93,47 +87,51 @@
#size-cells = <1>; #size-cells = <1>;
partition@0 { partition@0 {
label = "u-boot"; label = "Bootloader";
reg = <0x0 0x80000>; reg = <0x0 0x220000>;
read-only; read-only;
}; };
partition@80000 { partition@80000 {
label = "debug"; compatible = "nvmem-cells";
reg = <0x80000 0x80000>; label = "config";
reg = <0x220000 0x140000>;
read-only; read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
macaddr_config_12: macaddr@12 {
compatible = "mac-base";
reg = <0x12 0x6>;
#nvmem-cell-cells = <1>;
};
};
}; };
factory: partition@100000 { factory: partition@360000 {
label = "factory"; label = "factory";
reg = <0x100000 0x40000>; reg = <0x360000 0x140000>;
read-only; read-only;
}; };
partition@140000 { partition@4a0000 {
label = "kernel"; label = "kernel";
reg = <0x140000 0x400000>; reg = <0x4a0000 0x400000>;
}; };
ubipart0: partition@540000 { partition@8a0000 {
label = "ubipart0"; label = "ubi";
reg = <0x540000 0x1c80000>; reg = <0x8a0000 0x76e0000>;
};
partition@21c0000 {
label = "bdinfo";
reg = <0x21c0000 0x80000>;
read-only;
};
ubipart1: partition@2240000 {
label = "ubipart1";
reg = <0x2240000 0x5d40000>;
}; };
}; };
}; };
&pcie { &pcie {
reset-gpios = <&gpio 19 GPIO_ACTIVE_LOW>,
<&gpio 4 GPIO_ACTIVE_LOW>;
status = "okay"; status = "okay";
}; };
@ -141,8 +139,14 @@
wifi@0,0 { wifi@0,0 {
compatible = "pci14c3,7603"; compatible = "pci14c3,7603";
reg = <0x0000 0 0 0 0>; reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>; mediatek,mtd-eeprom = <&factory 0xf000>;
nvmem-cells = <&macaddr_config_12 0>;
nvmem-cell-names = "mac-address";
ieee80211-freq-limit = <2400000 2500000>; ieee80211-freq-limit = <2400000 2500000>;
led {
led-active-low;
};
}; };
}; };
@ -150,28 +154,15 @@
wifi@0,0 { wifi@0,0 {
compatible = "pci14c3,7662"; compatible = "pci14c3,7662";
reg = <0x0000 0 0 0 0>; reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>; mediatek,mtd-eeprom = <&factory 0xf800>;
nvmem-cells = <&macaddr_config_12 1>;
nvmem-cell-names = "mac-address";
ieee80211-freq-limit = <5000000 6000000>; ieee80211-freq-limit = <5000000 6000000>;
};
};
&gmac0 { led {
nvmem-cells = <&macaddr_factory_e006>; led-active-low;
nvmem-cell-names = "mac-address"; led-sources = <2>;
}; };
&gmac1 {
status = "okay";
label = "wan";
phy-handle = <&ethphy4>;
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};
&mdio {
ethphy4: ethernet-phy@4 {
reg = <4>;
}; };
}; };
@ -205,17 +196,3 @@
function = "gpio"; function = "gpio";
}; };
}; };
&factory {
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>;
};
};

View File

@ -2846,21 +2846,18 @@ endef
TARGET_DEVICES += zio_freezio TARGET_DEVICES += zio_freezio
define Device/zte_e8820s define Device/zte_e8820s
$(Device/dsa-migration) $(Device/nand)
$(Device/uimage-lzma-loader) $(Device/uimage-lzma-loader)
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_SIZE := 4096k
UBINIZE_OPTS := -E 5
IMAGE_SIZE := 32768k
IMAGES += factory.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
check-size
DEVICE_VENDOR := ZTE DEVICE_VENDOR := ZTE
DEVICE_MODEL := E8820S DEVICE_MODEL := E8820S
DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \ DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \
kmod-usb-ledtrig-usbport kmod-usb-ledtrig-usbport automount
DEVICE_COMPAT_VERSION := 2.0
DEVICE_COMPAT_MESSAGE := Partition table has changed to fit the new U-Boot
IMAGE_SIZE := 121728k
IMAGES += factory.bin
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
check-size
endef endef
TARGET_DEVICES += zte_e8820s TARGET_DEVICES += zte_e8820s

View File

@ -241,8 +241,8 @@ yuncore,ax820)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan" ucidef_set_led_netdev "wan" "WAN" "green:wan" "wan"
;; ;;
zte,e8820s) zte,e8820s)
ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "white:wlan2g" "wlan0" ucidef_set_led_netdev "wlan2g" "WiFi 2.4GHz" "mt76-phy0" "phy0-ap0"
ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "white:wlan5g" "wlan1" ucidef_set_led_netdev "wlan5g" "WiFi 5GHz" "mt76-phy1" "phy1-ap0"
;; ;;
zyxel,lte3301-plus) zyxel,lte3301-plus)
ucidef_set_led_netdev "internet" "internet" "white:internet" "wwan0" ucidef_set_led_netdev "internet" "internet" "white:internet" "wwan0"

View File

@ -8,6 +8,9 @@
board_config_update board_config_update
case "$(board_name)" in case "$(board_name)" in
zte,e8820s)
ucidef_set_compat_version "2.0"
;;
*) *)
ucidef_set_compat_version "1.1" ucidef_set_compat_version "1.1"
;; ;;

View File

@ -117,6 +117,7 @@ platform_do_upgrade() {
xiaomi,mi-router-cr6608|\ xiaomi,mi-router-cr6608|\
xiaomi,mi-router-cr6609|\ xiaomi,mi-router-cr6609|\
xiaomi,redmi-router-ac2100|\ xiaomi,redmi-router-ac2100|\
zte,e8820s|\
zyxel,nwa50ax|\ zyxel,nwa50ax|\
zyxel,nwa55axe) zyxel,nwa55axe)
nand_do_upgrade "$1" nand_do_upgrade "$1"