From c8d39b45b0d1e942eaf66b4d8e21fa1dcb31d29f Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Fri, 9 Jul 2021 11:01:02 +0800 Subject: [PATCH] ramips: sync official source code --- package/boot/uboot-envtools/files/ramips | 12 +- .../dts/mt7620a_wavlink_wl-wn530hg4.dts | 1 - .../dts/mt7621_elecom_wrc-2533ghbk-i.dts | 199 ++++++++++++++++ target/linux/ramips/dts/mt7621_jcg_y2.dts | 5 - .../ramips/dts/mt7621_linksys_ea7300-v2.dts | 8 + .../ramips/dts/mt7621_totolink_x5000r.dts | 138 +++++++++++ .../ramips/dts/mt7621_ubnt_unifi-6-lite.dts | 84 +++++++ .../ramips/dts/mt7621_ubnt_unifi-nanohd.dts | 80 +------ .../linux/ramips/dts/mt7621_ubnt_unifi.dtsi | 81 +++++++ ....dts => mt7621_xiaomi_mi-router-3-pro.dts} | 2 +- .../dts/mt7621_xiaomi_mi-router-3g-v2.dts | 8 + .../ramips/dts/mt7621_xiaomi_mi-router-3g.dts | 117 ++++++++++ .../ramips/dts/mt7621_xiaomi_mi-router-4.dts | 96 ++++++++ ... => mt7621_xiaomi_mi-router-4a-3g-v2.dtsi} | 7 +- .../mt7621_xiaomi_mi-router-4a-gigabit.dts | 8 + .../linux/ramips/dts/mt7621_xiaomi_mir3g.dts | 220 ------------------ ..._mir4.dts => mt7621_xiaomi_nand_128m.dtsi} | 87 +------ .../dts/mt7621_xiaomi_router-ac2100.dtsi | 85 +------ .../dts/mt7628an_tplink_tl-mr6400-v5.dts | 91 ++++++++ ...m.dts => mt7628an_xiaomi_mi-router-4.dtsi} | 58 +---- .../dts/mt7628an_xiaomi_mi-router-4a-100m.dts | 45 ++++ .../dts/mt7628an_xiaomi_mi-router-4c.dts | 124 ++-------- .../ramips/dts/rt3662_engenius_esr600h.dts | 171 ++++++++++++++ target/linux/ramips/image/mt7621.mk | 161 +++++++------ target/linux/ramips/image/mt76x8.mk | 21 +- target/linux/ramips/image/rt305x.mk | 4 +- target/linux/ramips/image/rt3883.mk | 14 ++ target/linux/ramips/modules.mk | 3 +- target/linux/ramips/mt7620/config-5.4 | 1 + .../mt7621/base-files/etc/board.d/01_leds | 1 + .../mt7621/base-files/etc/board.d/02_network | 24 +- .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 1 + .../mt7621/base-files/etc/init.d/bootcount | 1 + .../mt7621/base-files/lib/upgrade/platform.sh | 9 +- target/linux/ramips/mt7621/config-5.4 | 1 + .../mt76x8/base-files/etc/board.d/01_leds | 4 + .../mt76x8/base-files/etc/board.d/02_network | 10 +- ...an-up-boot_command_line-initializati.patch | 192 +++++++++++++++ ...2-MIPS-Always-define-builtin_cmdline.patch | 44 ++++ ...-MIPS-add-bootargs-override-property.patch | 63 +++++ .../rt3883/base-files/etc/board.d/02_network | 18 +- 41 files changed, 1570 insertions(+), 729 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts create mode 100644 target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts create mode 100644 target/linux/ramips/dts/mt7621_totolink_x5000r.dts create mode 100644 target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts create mode 100644 target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi rename target/linux/ramips/dts/{mt7621_xiaomi_mir3p.dts => mt7621_xiaomi_mi-router-3-pro.dts} (98%) create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g-v2.dts create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g.dts create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts rename target/linux/ramips/dts/{mt7621_xiaomi_mir3g-v2.dts => mt7621_xiaomi_mi-router-4a-3g-v2.dtsi} (95%) create mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit.dts delete mode 100644 target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts rename target/linux/ramips/dts/{mt7621_xiaomi_mir4.dts => mt7621_xiaomi_nand_128m.dtsi} (59%) create mode 100644 target/linux/ramips/dts/mt7628an_tplink_tl-mr6400-v5.dts rename target/linux/ramips/dts/{mt7628an_xiaomi_mir4a-100m.dts => mt7628an_xiaomi_mi-router-4.dtsi} (60%) create mode 100644 target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts create mode 100644 target/linux/ramips/dts/rt3662_engenius_esr600h.dts create mode 100644 target/linux/ramips/patches-5.4/0001-MIPS-cmdline-Clean-up-boot_command_line-initializati.patch create mode 100644 target/linux/ramips/patches-5.4/0002-MIPS-Always-define-builtin_cmdline.patch create mode 100644 target/linux/ramips/patches-5.4/0010-MIPS-add-bootargs-override-property.patch diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index cb18ea7810..01795ca10a 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -16,7 +16,8 @@ alfa-network,ac1200rm|\ alfa-network,awusfree1|\ alfa-network,quad-e4g|\ alfa-network,r36m-e4g|\ -alfa-network,tube-e4g) +alfa-network,tube-e4g|\ +engenius,esr600h) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" ;; allnet,all0256n-4m|\ @@ -32,6 +33,8 @@ buffalo,wsr-1166dhp|\ buffalo,wsr-600dhp|\ mediatek,linkit-smart-7688|\ samknows,whitebox-v8|\ +xiaomi,mi-router-3g-v2|\ +xiaomi,mi-router-4a-gigabit|\ xiaomi,mi-router-4c|\ xiaomi,miwifi-nano|\ zbtlink,zbt-wg2626|\ @@ -48,12 +51,13 @@ jcg,q20) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; linksys,ea7300-v1|\ +linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1|\ -xiaomi,mir3p|\ -xiaomi,mir3g|\ -xiaomi,mir4|\ xiaomi,miwifi-r3|\ +xiaomi,mi-router-3g|\ +xiaomi,mi-router-3-pro|\ +xiaomi,mi-router-4|\ xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x20000" diff --git a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn530hg4.dts b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn530hg4.dts index d8ce40c8d1..27fd2e2450 100644 --- a/target/linux/ramips/dts/mt7620a_wavlink_wl-wn530hg4.dts +++ b/target/linux/ramips/dts/mt7620a_wavlink_wl-wn530hg4.dts @@ -14,7 +14,6 @@ led-failsafe = &led_status_blue; led-running = &led_status_blue; led-upgrade = &led_status_blue; - serial0 = &uartlite; }; leds { diff --git a/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts b/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts new file mode 100644 index 0000000000..a5436d55d7 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_elecom_wrc-2533ghbk-i.dts @@ -0,0 +1,199 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "elecom,wrc-2533ghbk-i", "mediatek,mt7621-soc"; + model = "ELECOM WRC-2533GHBK-I"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + wps { + label = "red:wps"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + }; + + led_power: power { + label = "white:power"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + }; + + wlan2g { + label = "white:wlan2g"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0radio"; + }; + + wlan5g { + label = "white:wlan5g"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy1radio"; + }; + }; + + keys { + compatible = "gpio-keys"; + + auto { + label = "auto"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x9a0000>; + }; + + partition@9f0000 { + label = "TM_1"; + reg = <0x9f0000 0x200000>; + read-only; + }; + + partition@bf0000 { + label = "TM_2"; + reg = <0xbf0000 0x200000>; + read-only; + }; + + partition@df0000 { + label = "manufacture"; + reg = <0xdf0000 0x180000>; + read-only; + }; + + partition@f70000 { + label = "backup"; + reg = <0xf70000 0x10000>; + read-only; + }; + + partition@f80000 { + label = "storage"; + reg = <0xf80000 0x80000>; + read-only; + }; + }; + }; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "wan"; + }; + + port@1 { + status = "okay"; + label = "lan4"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan2"; + }; + + port@4 { + status = "okay"; + label = "lan1"; + }; + }; +}; + +&state_default { + gpio { + groups = "uart2", "uart3", "jtag", "wdt"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/dts/mt7621_jcg_y2.dts b/target/linux/ramips/dts/mt7621_jcg_y2.dts index 86c1e5f4dc..d893e9956e 100644 --- a/target/linux/ramips/dts/mt7621_jcg_y2.dts +++ b/target/linux/ramips/dts/mt7621_jcg_y2.dts @@ -1,5 +1,4 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; #include "mt7621.dtsi" @@ -16,10 +15,6 @@ led-upgrade = &led_internet; }; - chosen { - bootargs = "console=ttyS0,57600"; - }; - leds { compatible = "gpio-leds"; diff --git a/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts new file mode 100644 index 0000000000..4ee148828a --- /dev/null +++ b/target/linux/ramips/dts/mt7621_linksys_ea7300-v2.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_linksys_ea7xxx.dtsi" + +/ { + compatible = "linksys,ea7300-v2", "mediatek,mt7621-soc"; + model = "Linksys EA7300 v2"; +}; diff --git a/target/linux/ramips/dts/mt7621_totolink_x5000r.dts b/target/linux/ramips/dts/mt7621_totolink_x5000r.dts new file mode 100644 index 0000000000..ef491087ef --- /dev/null +++ b/target/linux/ramips/dts/mt7621_totolink_x5000r.dts @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "totolink,x5000r", "mediatek,mt7621-soc"; + model = "TOTOLINK X5000R"; + + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + label-mac-device = &gmac0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "console=ttyS0,115200n8"; + }; + + leds { + compatible = "gpio-leds"; + + led_sys: sys { + label = "blue:sys"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe000>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan4"; + }; + + port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe006>; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts new file mode 100644 index 0000000000..d374fd3dde --- /dev/null +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_ubnt_unifi.dtsi" + +/ { + compatible = "ubnt,unifi-6-lite", "mediatek,mt7621-soc"; + model = "Ubiquiti UniFi 6 Lite"; + + chosen { + bootargs-override = "console=ttyS0,115200"; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x60000>; + read-only; + }; + + partition@60000 { + label = "u-boot-env"; + reg = <0x60000 0x10000>; + read-only; + }; + + factory: partition@70000 { + label = "factory"; + reg = <0x70000 0x40000>; + read-only; + }; + + eeprom: partition@b0000 { + label = "eeprom"; + reg = <0xb0000 0x10000>; + read-only; + }; + + partition@c0000 { + label = "bs"; + reg = <0xc0000 0x10000>; + }; + + partition@d0000 { + label = "cfg"; + reg = <0xd0000 0x100000>; + read-only; + }; + + partition@1d0000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x1d0000 0xf10000>; + }; + + partition@10e0000 { + label = "kernel1"; + reg = <0x10e0000 0xf10000>; + }; + }; + }; +}; + +&wlan_2g { + mtd-mac-address = <&eeprom 0x0>; +}; + +&wlan_5g { + mediatek,mtd-eeprom = <&factory 0x20000>; + mtd-mac-address = <&eeprom 0x6>; + ieee80211-freq-limit = <5000000 6000000>; +}; diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts index 4604de531d..7a36ecfa7b 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts @@ -1,49 +1,10 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include +#include "mt7621_ubnt_unifi.dtsi" / { compatible = "ubnt,unifi-nanohd", "mediatek,mt7621-soc"; model = "Ubiquiti UniFi nanoHD"; - - aliases { - led-boot = &led_white; - led-failsafe = &led_white; - led-running = &led_blue; - led-upgrade = &led_blue; - label-mac-device = &gmac0; - }; - - chosen { - bootargs = "console=ttyS0,115200"; - }; - - leds { - compatible = "gpio-leds"; - - led_blue: dome_blue { - label = "blue:dome"; - gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; - }; - - led_white: dome_white { - label = "white:dome"; - gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; }; &spi0 { @@ -53,7 +14,6 @@ compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <50000000>; - broken-flash-reset; partitions { compatible = "fixed-partitions"; @@ -110,40 +70,6 @@ }; }; -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - reg = <0x0 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - }; -}; - -&pcie1 { - wifi@0,0 { - reg = <0x0 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - }; -}; - -&gmac0 { - mtd-mac-address = <&eeprom 0x0>; -}; - -&switch0 { - ports { - port@0 { - status = "okay"; - label = "lan"; - }; - }; -}; - -&state_default { - gpio { - groups = "i2c", "uart2"; - function = "gpio"; - }; +&wlan_5g { + mediatek,mtd-eeprom = <&factory 0x8000>; }; diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi b/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi new file mode 100644 index 0000000000..e0625ba500 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_white; + led-failsafe = &led_white; + led-running = &led_blue; + led-upgrade = &led_blue; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_blue: dome_blue { + label = "blue:dome"; + gpios = <&gpio 3 GPIO_ACTIVE_HIGH>; + }; + + led_white: dome_white { + label = "white:dome"; + gpios = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wlan_2g: wifi@0,0 { + reg = <0x0 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&pcie1 { + wlan_5g: wifi@0,0 { + reg = <0x0 0 0 0 0>; + }; +}; + +&gmac0 { + mtd-mac-address = <&eeprom 0x0>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "uart2"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts similarity index 98% rename from target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts rename to target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts index b296f1fcb3..e8f3a50dbe 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir3p.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3-pro.dts @@ -6,7 +6,7 @@ #include / { - compatible = "xiaomi,mir3p", "mediatek,mt7621-soc"; + compatible = "xiaomi,mi-router-3-pro", "mediatek,mt7621-soc"; model = "Xiaomi Mi Router 3 Pro"; aliases { diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g-v2.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g-v2.dts new file mode 100644 index 0000000000..fe03ff1e6a --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g-v2.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-4a-3g-v2.dtsi" + +/ { + compatible = "xiaomi,mi-router-3g-v2", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router 3G v2"; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g.dts new file mode 100644 index 0000000000..40ea6625d4 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-3g.dts @@ -0,0 +1,117 @@ +#include "mt7621_xiaomi_nand_128m.dtsi" + +/ { + compatible = "xiaomi,mi-router-3g", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router 3G"; + + aliases { + led-boot = &led_status_yellow; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + label-mac-device = &gmac0; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + led_status_yellow: status_yellow { + label = "yellow:status"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + + wan_amber { + label = "amber:wan"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "dsa-0.0:01:1Gbps"; + }; + + lan1_amber { + label = "amber:lan1"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "dsa-0.0:03:1Gbps"; + }; + + lan2_amber { + label = "amber:lan2"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,default-trigger = "dsa-0.0:02:1Gbps"; + }; + }; + + reg_usb_vbus: regulator { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 12 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; +}; + +&xhci { + vbus-supply = <®_usb_vbus>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe006>; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe000>; + }; + + port@2 { + status = "okay"; + label = "lan2"; + }; + + port@3 { + status = "okay"; + label = "lan1"; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts new file mode 100644 index 0000000000..18cbe0c013 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4.dts @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_nand_128m.dtsi" + +/ { + compatible = "xiaomi,mi-router-4", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router 4"; + + aliases { + led-boot = &led_status_yellow; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_yellow; + label-mac-device = &gmac0; + }; + + leds { + compatible = "gpio-leds"; + + led_status_red: status_red { + label = "red:status"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + }; + + led_status_blue: status_blue { + label = "blue:status"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + }; + + led_status_yellow: status_yellow { + label = "yellow:status"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&keys { + minet { + label = "minet"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "pci14c3,7603"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "pci14c3,7662"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe000>; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe006>; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart2", "uart3", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir3g-v2.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi similarity index 95% rename from target/linux/ramips/dts/mt7621_xiaomi_mir3g-v2.dts rename to target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi index 3df6931bd4..cc5abf09b6 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir3g-v2.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-3g-v2.dtsi @@ -6,9 +6,6 @@ #include / { - compatible = "xiaomi,mir3g-v2", "mediatek,mt7621-soc"; - model = "Xiaomi Mi Router 3G v2"; - aliases { led-boot = &led_status_yellow; led-failsafe = &led_status_yellow; @@ -52,7 +49,8 @@ flash@0 { compatible = "jedec,spi-nor"; reg = <0>; - spi-max-frequency = <80000000>; + spi-max-frequency = <50000000>; + m25p,fast-read; partitions { compatible = "fixed-partitions"; @@ -147,6 +145,7 @@ status = "okay"; label = "lan1"; }; + wan: port@4 { status = "okay"; label = "wan"; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit.dts b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit.dts new file mode 100644 index 0000000000..4387d3b79f --- /dev/null +++ b/target/linux/ramips/dts/mt7621_xiaomi_mi-router-4a-gigabit.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_xiaomi_mi-router-4a-3g-v2.dtsi" + +/ { + compatible = "xiaomi,mi-router-4a-gigabit", "mediatek,mt7621-soc"; + model = "Xiaomi Mi Router 4A Gigabit Edition"; +}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts b/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts deleted file mode 100644 index 51f4842255..0000000000 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir3g.dts +++ /dev/null @@ -1,220 +0,0 @@ -#include "mt7621.dtsi" - -#include -#include - -/ { - compatible = "xiaomi,mir3g", "mediatek,mt7621-soc"; - model = "Xiaomi Mi Router 3G"; - - aliases { - led-boot = &led_status_yellow; - led-failsafe = &led_status_red; - led-running = &led_status_blue; - led-upgrade = &led_status_yellow; - label-mac-device = &gmac0; - }; - - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - leds { - compatible = "gpio-leds"; - - led_status_red: status_red { - label = "red:status"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - led_status_blue: status_blue { - label = "blue:status"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - led_status_yellow: status_yellow { - label = "yellow:status"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - - wan_amber { - label = "amber:wan"; - gpios = <&gpio 13 GPIO_ACTIVE_LOW>; - linux,default-trigger = "dsa-0.0:01:1Gbps"; - }; - - lan1_amber { - label = "amber:lan1"; - gpios = <&gpio 14 GPIO_ACTIVE_LOW>; - linux,default-trigger = "dsa-0.0:03:1Gbps"; - }; - - lan2_amber { - label = "amber:lan2"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - linux,default-trigger = "dsa-0.0:02:1Gbps"; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - - reg_usb_vbus: regulator { - compatible = "regulator-fixed"; - regulator-name = "usb_vbus"; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - gpio = <&gpio 12 GPIO_ACTIVE_HIGH>; - enable-active-high; - }; -}; - -&xhci { - vbus-supply = <®_usb_vbus>; -}; - -&nand { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Bootloader"; - reg = <0x0 0x80000>; - read-only; - }; - - partition@80000 { - label = "Config"; - reg = <0x80000 0x40000>; - }; - - partition@c0000 { - label = "Bdata"; - reg = <0xc0000 0x40000>; - read-only; - }; - - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; - - partition@140000 { - label = "crash"; - reg = <0x140000 0x40000>; - }; - - partition@180000 { - label = "crash_syslog"; - reg = <0x180000 0x40000>; - }; - - partition@1c0000 { - label = "reserved0"; - reg = <0x1c0000 0x40000>; - read-only; - }; - - /* uboot expects to find kernels at 0x200000 & 0x600000 - * referred to as system 1 & system 2 respectively. - * a kernel is considered suitable for handing control over - * if its linux magic number exists & uImage CRC are correct. - * If either of those conditions fail, a matching sys'n'_fail flag - * is set in uboot env & a restart performed in the hope that the - * alternate kernel is okay. - * if neither kernel checksums ok and both are marked failed, system 2 - * is booted anyway. - * - * Note uboot's tftp flash install writes the transferred - * image to both kernel partitions. - */ - - partition@200000 { - label = "kernel_stock"; - reg = <0x200000 0x400000>; - }; - - partition@600000 { - label = "kernel"; - reg = <0x600000 0x400000>; - }; - - /* ubi partition is the result of squashing - * next consecutive stock partitions: - * - rootfs0 (rootfs partition for stock kernel0), - * - rootfs1 (rootfs partition for stock failsafe kernel1), - * - overlay (used as ubi overlay in stock fw) - * resulting 117,5MiB space for packages. - */ - - partition@a00000 { - label = "ubi"; - reg = <0xa00000 0x7580000>; - }; - }; -}; - -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; -}; - -&pcie1 { - wifi@0,0 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - -&gmac0 { - mtd-mac-address = <&factory 0xe006>; -}; - -&switch0 { - ports { - port@1 { - status = "okay"; - label = "wan"; - mtd-mac-address = <&factory 0xe000>; - }; - - port@2 { - status = "okay"; - label = "lan2"; - }; - - port@3 { - status = "okay"; - label = "lan1"; - }; - }; -}; - -&state_default { - gpio { - groups = "jtag", "uart2", "uart3", "wdt"; - function = "gpio"; - }; -}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_mir4.dts b/target/linux/ramips/dts/mt7621_xiaomi_nand_128m.dtsi similarity index 59% rename from target/linux/ramips/dts/mt7621_xiaomi_mir4.dts rename to target/linux/ramips/dts/mt7621_xiaomi_nand_128m.dtsi index ffebbcfeb1..12e6bccc2e 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_mir4.dts +++ b/target/linux/ramips/dts/mt7621_xiaomi_nand_128m.dtsi @@ -6,41 +6,11 @@ #include / { - compatible = "xiaomi,mir4", "mediatek,mt7621-soc"; - model = "Xiaomi Mi Router 4"; - - aliases { - led-boot = &led_status_yellow; - led-failsafe = &led_status_red; - led-running = &led_status_blue; - led-upgrade = &led_status_yellow; - label-mac-device = ðernet; - }; - chosen { bootargs = "console=ttyS0,115200n8"; }; - leds { - compatible = "gpio-leds"; - - led_status_red: status_red { - label = "red:status"; - gpios = <&gpio 6 GPIO_ACTIVE_LOW>; - }; - - led_status_blue: status_blue { - label = "blue:status"; - gpios = <&gpio 8 GPIO_ACTIVE_LOW>; - }; - - led_status_yellow: status_yellow { - label = "yellow:status"; - gpios = <&gpio 10 GPIO_ACTIVE_LOW>; - }; - }; - - keys { + keys: keys { compatible = "gpio-keys"; reset { @@ -48,12 +18,6 @@ gpios = <&gpio 18 GPIO_ACTIVE_LOW>; linux,code = ; }; - - minet { - label = "minet"; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - linux,code = ; - }; }; }; @@ -68,6 +32,7 @@ partition@0 { label = "Bootloader"; reg = <0x0 0x80000>; + read-only; }; partition@80000 { @@ -78,11 +43,13 @@ partition@c0000 { label = "Bdata"; reg = <0xc0000 0x40000>; + read-only; }; factory: partition@100000 { label = "factory"; reg = <0x100000 0x40000>; + read-only; }; partition@140000 { @@ -98,6 +65,7 @@ partition@1c0000 { label = "reserved0"; reg = <0x1c0000 0x40000>; + read-only; }; /* uboot expects to find kernels at 0x200000 & 0x600000 @@ -114,6 +82,7 @@ * image to both kernel partitions. */ + /* We keep stock xiaomi firmware (kernel0) here */ partition@200000 { label = "kernel_stock"; reg = <0x200000 0x400000>; @@ -138,47 +107,3 @@ }; }; }; - -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - compatible = "pci14c3,7603"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0000>; - ieee80211-freq-limit = <2400000 2500000>; - }; -}; - -&pcie1 { - wifi@0,0 { - compatible = "pci14c3,7662"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - -ðernet { - compatible = "mediatek,ralink-mt7621-eth"; - mediatek,switch = <&gsw>; - mtd-mac-address = <&factory 0xe006>; -}; - -&switch0 { - /delete-property/ compatible; - phy-mode = "rgmii"; -}; - -&gsw { - compatible = "mediatek,ralink-mt7621-gsw"; -}; - -&state_default { - gpio { - groups = "jtag", "uart2", "uart3", "wdt"; - function = "gpio"; - }; -}; diff --git a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi index 932da173ec..fd21efc398 100644 --- a/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi +++ b/target/linux/ramips/dts/mt7621_xiaomi_router-ac2100.dtsi @@ -1,89 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include - -/ { - chosen { - bootargs = "console=ttyS0,115200n8"; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 18 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; -}; - -&nand { - status = "okay"; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "Bootloader"; - reg = <0x0 0x80000>; - }; - - partition@80000 { - label = "Config"; - reg = <0x80000 0x40000>; - }; - - partition@c0000 { - label = "Bdata"; - reg = <0xc0000 0x40000>; - read-only; - }; - - factory: partition@100000 { - label = "factory"; - reg = <0x100000 0x40000>; - read-only; - }; - - partition@140000 { - label = "crash"; - reg = <0x140000 0x40000>; - }; - - partition@180000 { - label = "crash_syslog"; - reg = <0x180000 0x40000>; - }; - - partition@1c0000 { - label = "reserved0"; - reg = <0x1c0000 0x40000>; - read-only; - }; - - /* We keep stock xiaomi firmware (kernel0) here */ - partition@200000 { - label = "kernel_stock"; - reg = <0x200000 0x400000>; - }; - - partition@600000 { - label = "kernel"; - reg = <0x600000 0x400000>; - }; - - partition@a00000 { - label = "ubi"; - reg = <0xa00000 0x7580000>; - }; - }; -}; +#include "mt7621_xiaomi_nand_128m.dtsi" &pcie { status = "okay"; diff --git a/target/linux/ramips/dts/mt7628an_tplink_tl-mr6400-v5.dts b/target/linux/ramips/dts/mt7628an_tplink_tl-mr6400-v5.dts new file mode 100644 index 0000000000..7ab19632e8 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_tplink_tl-mr6400-v5.dts @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an_tplink_8m.dtsi" + +/ { + compatible = "tplink,tl-mr6400-v5", "mediatek,mt7628an-soc"; + model = "TP-Link TL-MR6400 v5"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + rfkill { + label = "rfkill"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + wlan { + label = "white:wlan"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + lan { + label = "white:lan"; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + }; + + led_power: power { + label = "white:power"; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + }; + + wan { + label = "white:wan"; + gpios = <&gpio 40 GPIO_ACTIVE_LOW>; + }; + + signal1 { + label = "white:signal1"; + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + }; + + signal2 { + label = "white:signal2"; + gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + }; + + signal3 { + label = "white:signal3"; + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "p0led_an", "p1led_an", "p2led_an", "p3led_an", "p4led_an", "uart1", "wdt"; + function = "gpio"; + }; +}; + +&esw { + mediatek,portmap = <0x37>; + mediatek,portdisable = <0x30>; +}; + +&wmac { + mtd-mac-address = <&factory 0x1f100>; +}; + +ðernet { + mtd-mac-address = <&factory 0x1f100>; +}; diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mir4a-100m.dts b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi similarity index 60% rename from target/linux/ramips/dts/mt7628an_xiaomi_mir4a-100m.dts rename to target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi index c4912048f5..0f5897f5c5 100644 --- a/target/linux/ramips/dts/mt7628an_xiaomi_mir4a-100m.dts +++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4.dtsi @@ -6,29 +6,26 @@ #include / { - compatible = "xiaomi,mir4a-100m", "mediatek,mt7628an-soc"; - model = "Xiaomi Mi Router 4A (100M Edition)"; + aliases { + led-boot = &led_power_yellow; + led-failsafe = &led_power_yellow; + led-running = &led_power_blue; + led-upgrade = &led_power_yellow; + }; chosen { bootargs = "console=ttyS0,115200"; }; - aliases { - led-boot = &power_yellow; - led-failsafe = &power_yellow; - led-running = &power_blue; - led-upgrade = &power_yellow; - }; - leds { compatible = "gpio-leds"; - power_blue: power_blue { + led_power_blue: power_blue { label = "blue:power"; gpios = <&gpio 11 GPIO_ACTIVE_LOW>; }; - power_yellow: power_yellow { + led_power_yellow: power_yellow { label = "yellow:power"; gpios = <&gpio 44 GPIO_ACTIVE_LOW>; }; @@ -48,12 +45,12 @@ &spi0 { status = "okay"; - flash@0 { + flash0: flash@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <10000000>; - partitions { + partitions: partitions { compatible = "fixed-partitions"; #address-cells = <1>; #size-cells = <1>; @@ -88,34 +85,11 @@ read-only; }; - partition@60000 { - label = "overlay"; - reg = <0x60000 0x100000>; - read-only; - }; - - partition@160000 { - label = "firmware"; - reg = <0x160000 0xea0000>; - compatible = "denx,uimage"; - }; + /* additional partitions in DTS */ }; }; }; -&pcie { - status = "okay"; -}; - -&pcie0 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x8000>; - ieee80211-freq-limit = <5000000 6000000>; - }; -}; - &state_default { gpio { groups = "gpio", "wdt", "wled_an"; @@ -123,16 +97,6 @@ }; }; -ðernet { - mtd-mac-address = <&factory 0x4>; - mtd-mac-address-increment = <(-1)>; -}; - -&esw { - mediatek,portmap = <0x3e>; - mediatek,portdisable = <0x2a>; -}; - &wmac { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts new file mode 100644 index 0000000000..37797fc368 --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4a-100m.dts @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7628an_xiaomi_mi-router-4.dtsi" + +/ { + compatible = "xiaomi,mi-router-4a-100m", "mediatek,mt7628an-soc"; + model = "Xiaomi Mi Router 4A (100M Edition)"; +}; + +&partitions { + partition@60000 { + label = "overlay"; + reg = <0x60000 0x100000>; + read-only; + }; + + partition@160000 { + label = "firmware"; + reg = <0x160000 0xea0000>; + compatible = "denx,uimage"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0x4>; + mtd-mac-address-increment = <(-1)>; +}; + +&esw { + mediatek,portmap = <0x3e>; + mediatek,portdisable = <0x2a>; +}; diff --git a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4c.dts b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4c.dts index f459ae0358..4389a9daf4 100644 --- a/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4c.dts +++ b/target/linux/ramips/dts/mt7628an_xiaomi_mi-router-4c.dts @@ -1,55 +1,31 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7628an.dtsi" - -#include -#include +#include "mt7628an_xiaomi_mi-router-4.dtsi" / { compatible = "xiaomi,mi-router-4c", "mediatek,mt7628an-soc"; model = "Xiaomi Mi Router 4C"; aliases { - led-boot = &led_power_yellow; - led-failsafe = &led_power_yellow; - led-running = &led_power_blue; - led-upgrade = &led_power_yellow; label-mac-device = ðernet; }; - - chosen { - bootargs = "console=ttyS0,115200"; - }; - - leds { - compatible = "gpio-leds"; - - led_power_blue: power_blue { - label = "blue:power"; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - }; - - led_power_yellow: power_yellow { - label = "yellow:power"; - gpios = <&gpio 44 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio 38 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; }; -&state_default { - gpio { - groups = "gpio", "wdt", "wled_an"; - function = "gpio"; +&flash0 { + spi-max-frequency = <40000000>; +}; + +&partitions { + partition@60000 { + label = "overlay"; + reg = <0x60000 0x100000>; + read-only; + }; + + partition@160000 { + label = "firmware"; + reg = <0x160000 0xea0000>; + compatible = "denx,uimage"; }; }; @@ -61,73 +37,11 @@ status = "disabled"; }; -&esw { - mediatek,portmap = <0x3d>; - mediatek,portdisable = <0x29>; -}; - -&wmac { - status = "okay"; -}; - ðernet { mtd-mac-address = <&factory 0x28>; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <40000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "bootloader"; - reg = <0x0 0x20000>; - read-only; - }; - - partition@20000 { - label = "config"; - reg = <0x20000 0x10000>; - read-only; - }; - - factory: partition@30000 { - label = "factory"; - reg = <0x30000 0x10000>; - read-only; - }; - - partition@40000 { - label = "crash"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - label = "cfg_bak"; - reg = <0x50000 0x10000>; - read-only; - }; - - partition@60000 { - label = "overlay"; - reg = <0x60000 0x100000>; - read-only; - }; - - partition@160000 { - label = "firmware"; - reg = <0x160000 0xea0000>; - compatible = "denx,uimage"; - }; - }; - }; +&esw { + mediatek,portmap = <0x3d>; + mediatek,portdisable = <0x29>; }; diff --git a/target/linux/ramips/dts/rt3662_engenius_esr600h.dts b/target/linux/ramips/dts/rt3662_engenius_esr600h.dts new file mode 100644 index 0000000000..cce44ed4c3 --- /dev/null +++ b/target/linux/ramips/dts/rt3662_engenius_esr600h.dts @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rt3883.dtsi" + +#include +#include + +/ { + compatible = "engenius,esr600h", "ralink,rt3662-soc", "ralink,rt3883-soc"; + model = "EnGenius ESR600H"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "blue:power"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + wps { + label = "blue:wps"; + gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <100>; + + reset-wps { + label = "reset-wps"; + gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + usb { + gpio-export,name = "usb"; + gpio-export,output = <1>; + gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <20000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x1000>; + }; + + partition@32000 { + label = "config"; + reg = <0x32000 0xe000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2c", "jtag", "uartf"; + function = "gpio"; + }; +}; + +ðernet { + status = "okay"; + + port@0 { + phy-handle = <&phy0>; + phy-mode = "rgmii"; + }; + + mdio-bus { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PORT0 PAD MODE CTRL */ + 0x0c 0x07600000 /* PORT6 PAD MODE CTRL */ + 0x10 0x40000000 /* Power-on Strapping: 176-pin interface configuration */ + 0x50 0xc437c437 /* LED Control Register 0 */ + 0x54 0xc337c337 /* LED Control Register 1 */ + 0x58 0x00000000 /* LED Control Register 2 */ + 0x5c 0x03ffff00 /* LED Control Register 3 */ + 0x7c 0x0000007e /* PORT0_STATUS */ + 0x94 0x0000007e /* PORT6 STATUS */ + >; + }; + }; +}; + +&pci { + status = "okay"; +}; + +&pci1 { + status = "okay"; + + wifi@0,1,0 { + compatible = "pci1814,3091"; + reg = <0x0 1 0 0 0>; + ralink,5ghz = <0>; + ralink,mtd-eeprom = <&factory 0x8000>; + }; +}; + +&wmac { + status = "okay"; + + ralink,2ghz = <0>; + ralink,mtd-eeprom = <&factory 0x0>; +}; + +&ehci { + status = "okay"; +}; + +&ohci { + status = "okay"; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 30b8d1d82f..225ad4c0de 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -12,20 +12,8 @@ DEVICE_VARS += ELECOM_HWNAME LINKSYS_HWNAME define Build/elecom-wrc-gs-factory $(eval product=$(word 1,$(1))) $(eval version=$(word 2,$(1))) - ( $(MKHASH) md5 $@ | tr -d '\n' ) >> $@ - ( \ - echo -n "ELECOM $(product) v$(version)" | \ - dd bs=32 count=1 conv=sync; \ - dd if=$@; \ - ) > $@.new - mv $@.new $@ - echo -n "MT7621_ELECOM_$(product)" >> $@ -endef - -define Build/elecom-wrc-factory - $(eval product=$(word 1,$(1))) - $(eval version=$(word 2,$(1))) - $(MKHASH) md5 $@ >> $@ + $(eval hash_opt=$(word 3,$(1))) + $(MKHASH) md5 $(hash_opt) $@ >> $@ ( \ echo -n "ELECOM $(product) v$(version)" | \ dd bs=32 count=1 conv=sync; \ @@ -445,7 +433,7 @@ define Device/elecom_wrc-1167ghbk2-s DEVICE_MODEL := WRC-1167GHBK2-S IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - elecom-wrc-factory WRC-1167GHBK2-S 0.00 + elecom-wrc-gs-factory WRC-1167GHBK2-S 0.00 DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware endef TARGET_DEVICES += elecom_wrc-1167ghbk2-s @@ -455,7 +443,8 @@ define Device/elecom_wrc-gs DEVICE_VENDOR := ELECOM IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - elecom-wrc-gs-factory $$$$(ELECOM_HWNAME) 0.00 + elecom-wrc-gs-factory $$$$(ELECOM_HWNAME) 0.00 -N | \ + append-string MT7621_ELECOM_$$$$(ELECOM_HWNAME) DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware endef @@ -507,6 +496,19 @@ define Device/elecom_wrc-1900gst endef TARGET_DEVICES += elecom_wrc-1900gst +define Device/elecom_wrc-2533ghbk-i + $(Device/uimage-lzma-loader) + DEVICE_VENDOR := ELECOM + DEVICE_MODEL := WRC-2533GHBK-I + IMAGE_SIZE := 9856k + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ + elx-header 0107002d 8844A2D168B45A2D | \ + elecom-product-header WRC-2533GHBK-I + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware +endef +TARGET_DEVICES += elecom_wrc-2533ghbk-i + define Device/elecom_wrc-2533gst $(Device/elecom_wrc-gs) IMAGE_SIZE := 11264k @@ -672,7 +674,8 @@ define Device/iptime_a6ns-m UIMAGE_NAME := a6nm DEVICE_VENDOR := ipTIME DEVICE_MODEL := A6ns-M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 kmod-usb-ledtrig-usbport + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + kmod-usb-ledtrig-usbport endef TARGET_DEVICES += iptime_a6ns-m @@ -692,7 +695,8 @@ define Device/jcg_jhr-ac876m JCG_MAXSIZE := 16064k DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-AC876M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 kmod-usb-ledtrig-usbport + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + kmod-usb-ledtrig-usbport endef TARGET_DEVICES += jcg_jhr-ac876m @@ -769,7 +773,8 @@ define Device/linksys_ea7xxx KERNEL_SIZE := 4096k IMAGE_SIZE := 36864k DEVICE_VENDOR := Linksys - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \ + uboot-envtools UBINIZE_OPTS := -E 5 IMAGES := sysupgrade.bin factory.bin IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | check-size @@ -785,6 +790,15 @@ define Device/linksys_ea7300-v1 endef TARGET_DEVICES += linksys_ea7300-v1 +define Device/linksys_ea7300-v2 + $(Device/linksys_ea7xxx) + DEVICE_MODEL := EA7300 + DEVICE_VARIANT := v2 + LINKSYS_HWNAME := EA7300v2 + DEVICE_PACKAGES += kmod-mt7603 +endef +TARGET_DEVICES += linksys_ea7300-v2 + define Device/linksys_ea7500-v2 $(Device/linksys_ea7xxx) DEVICE_MODEL := EA7500 @@ -1160,6 +1174,15 @@ define Device/totolink_a7000r endef TARGET_DEVICES += totolink_a7000r +define Device/totolink_x5000r + IMAGE_SIZE := 16064k + UIMAGE_NAME := C8343R-9999 + DEVICE_VENDOR := TOTOLINK + DEVICE_MODEL := X5000R + DEVICE_PACKAGES := kmod-mt7915e +endef +TARGET_DEVICES += totolink_x5000r + define Device/tplink_archer-a6-v3 $(Device/tplink-safeloader) DEVICE_MODEL := Archer A6 @@ -1267,6 +1290,16 @@ define Device/ubnt_edgerouter-x-sfp endef TARGET_DEVICES += ubnt_edgerouter-x-sfp +define Device/ubnt_unifi-6-lite + DEVICE_VENDOR := Ubiquiti + DEVICE_MODEL := UniFi 6 Lite + DEVICE_DTS_CONFIG := config@1 + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7915e + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGE_SIZE := 15424k +endef +TARGET_DEVICES += ubnt_unifi-6-lite + define Device/ubnt_unifi-nanohd DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi nanoHD @@ -1352,40 +1385,42 @@ define Device/winstars_ws-wn583a6 endef TARGET_DEVICES += winstars_ws-wn583a6 -define Device/xiaomi_mir3g +define Device/xiaomi_nand_separate $(Device/uimage-lzma-loader) + DEVICE_VENDOR := Xiaomi + DEVICE_PACKAGES := uboot-envtools BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_SIZE := 4096k - IMAGE_SIZE := 124416k UBINIZE_OPTS := -E 5 IMAGES += kernel1.bin rootfs0.bin IMAGE/kernel1.bin := append-kernel IMAGE/rootfs0.bin := append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_VENDOR := Xiaomi - DEVICE_MODEL := Mi Router 3G - SUPPORTED_DEVICES += R3G - SUPPORTED_DEVICES += mir3g - DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \ - kmod-usb-ledtrig-usbport uboot-envtools endef -TARGET_DEVICES += xiaomi_mir3g -define Device/xiaomi_mir3g-v2 +define Device/xiaomi_mi-router-3g + $(Device/xiaomi_nand_separate) + DEVICE_MODEL := Mi Router 3G + IMAGE_SIZE := 124416k + DEVICE_PACKAGES += kmod-mt7603 kmod-mt76x2 kmod-usb3 \ + kmod-usb-ledtrig-usbport + SUPPORTED_DEVICES += R3G mir3g xiaomi,mir3g +endef +TARGET_DEVICES += xiaomi_mi-router-3g + +define Device/xiaomi_mi-router-3g-v2 $(Device/uimage-lzma-loader) IMAGE_SIZE := 14848k DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router 3G DEVICE_VARIANT := v2 - DEVICE_ALT0_VENDOR := Xiaomi - DEVICE_ALT0_MODEL := Mi Router 4A - DEVICE_ALT0_VARIANT := Gigabit Edition DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 + SUPPORTED_DEVICES += xiaomi,mir3g-v2 endef -TARGET_DEVICES += xiaomi_mir3g-v2 +TARGET_DEVICES += xiaomi_mi-router-3g-v2 -define Device/xiaomi_mir3p +define Device/xiaomi_mi-router-3-pro $(Device/uimage-lzma-loader) BLOCKSIZE := 128k PAGESIZE := 2048 @@ -1398,57 +1433,45 @@ define Device/xiaomi_mir3p IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 kmod-usb-ledtrig-usbport \ - uboot-envtools + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + kmod-usb-ledtrig-usbport uboot-envtools + SUPPORTED_DEVICES += xiaomi,mir3p endef -TARGET_DEVICES += xiaomi_mir3p +TARGET_DEVICES += xiaomi_mi-router-3-pro -define Device/xiaomi_mir4 - $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - IMAGE_SIZE := 124416k - UBINIZE_OPTS := -E 5 - IMAGES += kernel1.bin rootfs0.bin - IMAGE/kernel1.bin := append-kernel - IMAGE/rootfs0.bin := append-ubi | check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_VENDOR := Xiaomi +define Device/xiaomi_mi-router-4 + $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router 4 - DEVICE_PACKAGES := kmod-mt7603e kmod-mt76x2e luci-app-mtwifi \ - uboot-envtools -wpad-openssl + IMAGE_SIZE := 124416k + DEVICE_PACKAGES += kmod-mt7603 kmod-mt76x2 endef -TARGET_DEVICES += xiaomi_mir4 +TARGET_DEVICES += xiaomi_mi-router-4 -define Device/xiaomi-ac2100 +define Device/xiaomi_mi-router-4a-gigabit $(Device/uimage-lzma-loader) - BLOCKSIZE := 128k - PAGESIZE := 2048 - KERNEL_SIZE := 4096k - IMAGE_SIZE := 120320k - UBINIZE_OPTS := -E 5 - IMAGES += kernel1.bin rootfs0.bin factory.bin breed-factory.bin - IMAGE/kernel1.bin := append-kernel - IMAGE/rootfs0.bin := append-ubi | check-size - IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size - IMAGE/breed-factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ - append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size + IMAGE_SIZE := 14848k DEVICE_VENDOR := Xiaomi - DEVICE_PACKAGES := kmod-mt7603e kmod-mt7615d luci-app-mtwifi \ - uboot-envtools -wpad-openssl + DEVICE_MODEL := Mi Router 4A + DEVICE_VARIANT := Gigabit Edition + DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 endef +TARGET_DEVICES += xiaomi_mi-router-4a-gigabit define Device/xiaomi_mi-router-ac2100 - $(Device/xiaomi-ac2100) + $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router AC2100 + IMAGE_SIZE := 120320k + DEVICE_PACKAGES += kmod-mt7603e kmod-mt7615d luci-app-mtwifi \ + -wpad-openssl endef TARGET_DEVICES += xiaomi_mi-router-ac2100 define Device/xiaomi_redmi-router-ac2100 - $(Device/xiaomi-ac2100) + $(Device/xiaomi_nand_separate) DEVICE_MODEL := Redmi Router AC2100 + IMAGE_SIZE := 120320k + DEVICE_PACKAGES += kmod-mt7603e kmod-mt7615d luci-app-mtwifi \ + -wpad-openssl endef TARGET_DEVICES += xiaomi_redmi-router-ac2100 diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index d3666dac4c..0505960a31 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -544,6 +544,22 @@ define Device/tplink_tl-mr6400-v4 endef TARGET_DEVICES += tplink_tl-mr6400-v4 +define Device/tplink_tl-mr6400-v5 + $(Device/tplink-v2) + IMAGE_SIZE := 7808k + DEVICE_MODEL := TL-MR6400 + DEVICE_VARIANT := v5 + TPLINK_FLASHLAYOUT := 8Mmtk + TPLINK_HWID := 0x64000005 + TPLINK_HWREV := 0x5 + TPLINK_HWREVADD := 0x5 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport \ + kmod-usb-serial-option kmod-usb-net-qmi-wwan uqmi + IMAGES := sysupgrade.bin tftp-recovery.bin + IMAGE/tftp-recovery.bin := pad-extra 128k | $$(IMAGE/factory.bin) +endef +TARGET_DEVICES += tplink_tl-mr6400-v5 + define Device/tplink_tl-wa801nd-v5 $(Device/tplink-v2) IMAGE_SIZE := 7808k @@ -783,14 +799,15 @@ define Device/wrtnode_wrtnode2r endef TARGET_DEVICES += wrtnode_wrtnode2r -define Device/xiaomi_mir4a-100m +define Device/xiaomi_mi-router-4a-100m IMAGE_SIZE := 14976k DEVICE_VENDOR := Xiaomi DEVICE_MODEL := Mi Router 4A DEVICE_VARIANT := 100M Edition DEVICE_PACKAGES := kmod-mt76x2 + SUPPORTED_DEVICES += xiaomi,mir4a-100m endef -TARGET_DEVICES += xiaomi_mir4a-100m +TARGET_DEVICES += xiaomi_mi-router-4a-100m define Device/xiaomi_mi-router-4c IMAGE_SIZE := 14976k diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index 194550684c..4edc2eb3c4 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -1071,7 +1071,7 @@ define Device/unbranded_a5-v11 IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ poray-header -B A5-V11 -F 4M - DEVICE_VENDOR := + DEVICE_VENDOR := DEVICE_MODEL := A5-V11 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 SUPPORTED_DEVICES += a5-v11 @@ -1190,7 +1190,7 @@ define Device/zte_mf283plus DEVICE_VENDOR := ZTE DEVICE_MODEL := MF283+ DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-net-qmi-wwan uqmi \ - kmod-usb-serial-option + kmod-usb-serial kmod-usb-serial-option endef TARGET_DEVICES += zte_mf283plus diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk index f434172c50..1b46d570fd 100644 --- a/target/linux/ramips/image/rt3883.mk +++ b/target/linux/ramips/image/rt3883.mk @@ -59,6 +59,20 @@ define Device/edimax_br-6475nd endef TARGET_DEVICES += edimax_br-6475nd +define Device/engenius_esr600h + $(Device/uimage-lzma-loader) + SOC := rt3662 + BLOCKSIZE := 4k + IMAGE_SIZE := 7872k + IMAGES += factory.dlf + IMAGE/factory.dlf := $$(sysupgrade_bin) | check-size | \ + senao-header -r 0x101 -p 0x44 -t 2 + DEVICE_VENDOR := EnGenius + DEVICE_MODEL := ESR600H + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 uboot-envtools +endef +TARGET_DEVICES += engenius_esr600h + define Device/loewe_wmdr-143n SOC := rt3662 BLOCKSIZE := 64k diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk index 6de3d5b627..6f199c46a2 100644 --- a/target/linux/ramips/modules.mk +++ b/target/linux/ramips/modules.mk @@ -81,8 +81,7 @@ define KernelPackage/dma-ralink CONFIG_DMA_RALINK FILES:= \ $(LINUX_DIR)/drivers/dma/virt-dma.ko \ - $(LINUX_DIR)/drivers/dma/ralink-gdma.ko@lt5.4 \ - $(LINUX_DIR)/drivers/staging/ralink-gdma/ralink-gdma.ko@ge5.4 + $(LINUX_DIR)/drivers/staging/ralink-gdma/ralink-gdma.ko AUTOLOAD:=$(call AutoLoad,52,ralink-gdma) endef diff --git a/target/linux/ramips/mt7620/config-5.4 b/target/linux/ramips/mt7620/config-5.4 index 038b1a2010..2388789b93 100644 --- a/target/linux/ramips/mt7620/config-5.4 +++ b/target/linux/ramips/mt7620/config-5.4 @@ -133,6 +133,7 @@ CONFIG_MTD_UBI_BLOCK=y # CONFIG_MTD_UBI_FASTMAP is not set # CONFIG_MTD_UBI_GLUEBI is not set CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_RALINK_GSW_MT7620=y diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index d471e2a3d6..c1cb2970b6 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -57,6 +57,7 @@ linksys,e5600) ucidef_set_led_netdev "wan" "wan link" "blue:wan" "wan" "link" ;; linksys,ea7300-v1|\ +linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1) ucidef_set_led_netdev "lan1" "lan1 link" "green:lan1" "lan1" "link" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 52fc2c97f4..9123648480 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -18,12 +18,13 @@ ramips_setup_interfaces() tplink,re350-v1|\ tplink,re500-v1|\ tplink,re650-v1|\ + ubnt,unifi-6-lite|\ ubnt,unifi-nanohd) ucidef_set_interface_lan "lan" ;; ampedwireless,ally-r1900k|\ hiwifi,hc5962|\ - xiaomi,mir3p) + xiaomi,mi-router-3-pro) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan" ;; asiarf,ap7621-001|\ @@ -34,8 +35,10 @@ ramips_setup_interfaces() jcg,q20|\ lenovo,newifi-d1|\ mikrotik,routerboard-m33g|\ - xiaomi,mir3g|\ - xiaomi,mir3g-v2) + xiaomi,mi-router-3g|\ + xiaomi,mi-router-3g-v2|\ + xiaomi,mi-router-4|\ + xiaomi,mi-router-4a-gigabit) ucidef_set_interfaces_lan_wan "lan1 lan2" "wan" ;; d-team,newifi-d2) @@ -97,11 +100,6 @@ ramips_setup_interfaces() ubnt,edgerouter-x-sfp) ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0" ;; - xiaomi,mir4) - ucidef_add_switch "switch0" \ - "1:lan:2" "2:lan:1" "4:wan" "6t@eth0" - ucidef_set_interface_lan "eth0.1 ra0 rai0" - ;; xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) ucidef_add_switch "switch0" \ @@ -161,6 +159,11 @@ ramips_setup_macs() lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) ;; + elecom,wrc-2533ghbk-i) + lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) + wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) + label_mac=$wan_mac + ;; gehua,ghl-r-001) lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(macaddr_add "$lan_mac" 1) @@ -182,6 +185,7 @@ ramips_setup_macs() ;; linksys,e5600|\ linksys,ea7300-v1|\ + linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1) lan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) @@ -209,10 +213,6 @@ ramips_setup_macs() lan_mac=$(cat /sys/class/net/eth0/address) wan_mac=$(mtd_get_mac_binary factory 0xe000) ;; - xiaomi,mir4) - lan_mac=$(mtd_get_mac_binary factory 0xe006) - wan_mac=$(mtd_get_mac_binary factory 0xe000) - ;; xiaoyu,xy-c5) wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1) ;; diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index b5422e7e00..bd0f0254c6 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -20,6 +20,7 @@ case "$board" in ;; linksys,e5600|\ linksys,ea7300-v1|\ + linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1) hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr) diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index 2e2f24cf55..d3525ea0c9 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -10,6 +10,7 @@ boot() { ;; linksys,e5600|\ linksys,ea7300-v1|\ + linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1) mtd resetbc s_env || true diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 536970150b..c2ad4d3ed6 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -37,7 +37,7 @@ platform_do_upgrade() { mikrotik,routerboard-760igs|\ mikrotik,routerboard-m11g|\ mikrotik,routerboard-m33g) - [ -z "$(rootfs_type)" ] && mtd erase firmware + [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware ;; asus,rt-ac65p|\ asus,rt-ac85p) @@ -60,6 +60,7 @@ platform_do_upgrade() { jcg,q20|\ linksys,e5600|\ linksys,ea7300-v1|\ + linksys,ea7300-v2|\ linksys,ea7500-v2|\ linksys,ea8100-v1|\ netgear,r6220|\ @@ -72,9 +73,9 @@ platform_do_upgrade() { netgear,wac124|\ netis,wf2881|\ sercomm,na502|\ - xiaomi,mir3g|\ - xiaomi,mir3p|\ - xiaomi,mir4|\ + xiaomi,mi-router-3g|\ + xiaomi,mi-router-3-pro|\ + xiaomi,mi-router-4|\ xiaomi,mi-router-ac2100|\ xiaomi,redmi-router-ac2100) nand_do_upgrade "$1" diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4 index 8628c742ff..f8993980e3 100644 --- a/target/linux/ramips/mt7621/config-5.4 +++ b/target/linux/ramips/mt7621/config-5.4 @@ -157,6 +157,7 @@ CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NOR=y +CONFIG_MTD_SPLIT_FIT_FW=y CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_TPLINK_FW=y diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 2bfd384229..901cfe1b1f 100755 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -86,6 +86,10 @@ tplink,tl-mr6400-v4) ucidef_set_led_switch "lan" "lan" "white:lan" "switch0" "0x0e" ucidef_set_led_switch "wan" "wan" "white:wan" "switch0" "0x10" ;; +tplink,tl-mr6400-v5) + ucidef_set_led_switch "lan" "lan" "white:lan" "switch0" "0x07" + ucidef_set_led_switch "wan" "wan" "white:wan" "switch0" "0x08" + ;; tplink,tl-wr841n-v13) ucidef_set_led_wlan "wlan2g" "wlan2g" "green:wlan" "phy0tpt" ucidef_set_led_switch "lan1" "lan1" "green:lan1" "switch0" "0x2" diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 9becf131b4..0e241b7396 100755 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -124,6 +124,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:wan" "6@eth0" ;; + tplink,tl-mr6400-v5) + ucidef_add_switch "switch0" \ + "0:lan" "1:lan" "2:lan" "3:wan" "6@eth0" + ;; tplink,tl-wr902ac-v3) ucidef_add_switch "switch0" \ "4:lan" "6@eth0" @@ -137,7 +141,7 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:wan" "3:lan" "4:lan" "6@eth0" ;; - xiaomi,mir4a-100m) + xiaomi,mi-router-4a-100m) ucidef_add_switch "switch0" \ "4:lan:1" "2:lan:2" "0:wan" "6@eth0" ;; @@ -245,8 +249,8 @@ ramips_setup_macs() label_mac=$(mtd_get_mac_binary factory 0x4) wan_mac=$(mtd_get_mac_binary factory 0x28) ;; - xiaomi,mi-router-4c|\ - xiaomi,mir4a-100m) + xiaomi,mi-router-4a-100m|\ + xiaomi,mi-router-4c) wan_mac=$(mtd_get_mac_binary factory 0x4) ;; esac diff --git a/target/linux/ramips/patches-5.4/0001-MIPS-cmdline-Clean-up-boot_command_line-initializati.patch b/target/linux/ramips/patches-5.4/0001-MIPS-cmdline-Clean-up-boot_command_line-initializati.patch new file mode 100644 index 0000000000..eedc7498be --- /dev/null +++ b/target/linux/ramips/patches-5.4/0001-MIPS-cmdline-Clean-up-boot_command_line-initializati.patch @@ -0,0 +1,192 @@ +From: Paul Burton +Date: Wed, 9 Oct 2019 23:09:45 +0000 +Subject: MIPS: cmdline: Clean up boot_command_line initialization + +Our current code to initialize boot_command_line is a mess. Some of this +is due to the addition of too many options over the years, and some of +this is due to workarounds for early_init_dt_scan_chosen() performing +actions specific to options from other architectures that probably +shouldn't be in generic code. + +Clean this up by introducing a new bootcmdline_init() function that +simplifies the initialization somewhat. The major changes are: + +- Because bootcmdline_init() is a function it can return early in the + CONFIG_CMDLINE_OVERRIDE case. + +- We clear boot_command_line rather than inheriting whatever + early_init_dt_scan_chosen() may have left us. This means we no longer + need to set boot_command_line to a space character in an attempt to + prevent early_init_dt_scan_chosen() from copying CONFIG_CMDLINE into + boot_command_line without us knowing about it. + +- Indirection via USE_PROM_CMDLINE, USE_DTB_CMDLINE, EXTEND_WITH_PROM & + BUILTIN_EXTEND_WITH_PROM macros is removed; they seemingly served only + to obfuscate the code. + +- The logic is cleaner, clearer & commented. + +Two minor drawbacks of this approach are: + +1) We call of_scan_flat_dt(), which means we scan through the DT again. + The overhead is fairly minimal & shouldn't be noticeable. + +2) cmdline_scan_chosen() duplicates a small amount of the logic from + early_init_dt_scan_chosen(). Alternatives might be to allow the + generic FDT code to keep & expose a copy of the arguments taken from + the /chosen node's bootargs property, or to introduce a function like + early_init_dt_scan_chosen() that retrieves them without modification + to handle CONFIG_CMDLINE. Neither of these sounds particularly + cleaner though, and this way we at least keep the extra work in + arch/mips. + +Origin: upstream, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7784cac697351f0cc0a4bb619594c0c99348c5aa +Signed-off-by: Paul Burton +Cc: linux-mips@vger.kernel.org + +--- a/arch/mips/kernel/setup.c ++++ b/arch/mips/kernel/setup.c +@@ -538,11 +538,88 @@ static void __init check_kernel_sections + } + } + +-#define USE_PROM_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER) +-#define USE_DTB_CMDLINE IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB) +-#define EXTEND_WITH_PROM IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) +-#define BUILTIN_EXTEND_WITH_PROM \ +- IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND) ++static void __init bootcmdline_append(const char *s, size_t max) ++{ ++ if (!s[0] || !max) ++ return; ++ ++ if (boot_command_line[0]) ++ strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); ++ ++ strlcat(boot_command_line, s, max); ++} ++ ++static int __init bootcmdline_scan_chosen(unsigned long node, const char *uname, ++ int depth, void *data) ++{ ++ bool *dt_bootargs = data; ++ const char *p; ++ int l; ++ ++ if (depth != 1 || !data || ++ (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) ++ return 0; ++ ++ p = of_get_flat_dt_prop(node, "bootargs", &l); ++ if (p != NULL && l > 0) { ++ bootcmdline_append(p, min(l, COMMAND_LINE_SIZE)); ++ *dt_bootargs = true; ++ } ++ ++ return 1; ++} ++ ++static void __init bootcmdline_init(char **cmdline_p) ++{ ++ bool dt_bootargs = false; ++ ++ /* ++ * If CMDLINE_OVERRIDE is enabled then initializing the command line is ++ * trivial - we simply use the built-in command line unconditionally & ++ * unmodified. ++ */ ++ if (IS_ENABLED(CONFIG_CMDLINE_OVERRIDE)) { ++ strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); ++ return; ++ } ++ ++ /* ++ * If the user specified a built-in command line & ++ * MIPS_CMDLINE_BUILTIN_EXTEND, then the built-in command line is ++ * prepended to arguments from the bootloader or DT so we'll copy them ++ * to the start of boot_command_line here. Otherwise, empty ++ * boot_command_line to undo anything early_init_dt_scan_chosen() did. ++ */ ++ if (IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND)) ++ strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); ++ else ++ boot_command_line[0] = 0; ++ ++ /* ++ * If we're configured to take boot arguments from DT, look for those ++ * now. ++ */ ++ if (IS_ENABLED(CONFIG_MIPS_CMDLINE_FROM_DTB)) ++ of_scan_flat_dt(bootcmdline_scan_chosen, &dt_bootargs); ++ ++ /* ++ * If we didn't get any arguments from DT (regardless of whether that's ++ * because we weren't configured to look for them, or because we looked ++ * & found none) then we'll take arguments from the bootloader. ++ * plat_mem_setup() should have filled arcs_cmdline with arguments from ++ * the bootloader. ++ */ ++ if (IS_ENABLED(CONFIG_MIPS_CMDLINE_DTB_EXTEND) || !dt_bootargs) ++ bootcmdline_append(arcs_cmdline, COMMAND_LINE_SIZE); ++ ++ /* ++ * If the user specified a built-in command line & we didn't already ++ * prepend it, we append it to boot_command_line here. ++ */ ++ if (IS_ENABLED(CONFIG_CMDLINE_BOOL) && ++ !IS_ENABLED(CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND)) ++ bootcmdline_append(builtin_cmdline, COMMAND_LINE_SIZE); ++} + + /* + * arch_mem_init - initialize memory management subsystem +@@ -570,48 +647,12 @@ static void __init arch_mem_init(char ** + { + extern void plat_mem_setup(void); + +- /* +- * Initialize boot_command_line to an innocuous but non-empty string in +- * order to prevent early_init_dt_scan_chosen() from copying +- * CONFIG_CMDLINE into it without our knowledge. We handle +- * CONFIG_CMDLINE ourselves below & don't want to duplicate its +- * content because repeating arguments can be problematic. +- */ +- strlcpy(boot_command_line, " ", COMMAND_LINE_SIZE); +- + /* call board setup routine */ + plat_mem_setup(); + memblock_set_bottom_up(true); + +-#if defined(CONFIG_CMDLINE_BOOL) && defined(CONFIG_CMDLINE_OVERRIDE) +- strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); +-#else +- if ((USE_PROM_CMDLINE && arcs_cmdline[0]) || +- (USE_DTB_CMDLINE && !boot_command_line[0])) +- strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); +- +- if (EXTEND_WITH_PROM && arcs_cmdline[0]) { +- if (boot_command_line[0]) +- strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); +- strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); +- } +- +-#if defined(CONFIG_CMDLINE_BOOL) +- if (builtin_cmdline[0]) { +- if (boot_command_line[0]) +- strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); +- strlcat(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); +- } +- +- if (BUILTIN_EXTEND_WITH_PROM && arcs_cmdline[0]) { +- if (boot_command_line[0]) +- strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); +- strlcat(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); +- } +-#endif +-#endif ++ bootcmdline_init(cmdline_p); + strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); +- + *cmdline_p = command_line; + + parse_early_param(); diff --git a/target/linux/ramips/patches-5.4/0002-MIPS-Always-define-builtin_cmdline.patch b/target/linux/ramips/patches-5.4/0002-MIPS-Always-define-builtin_cmdline.patch new file mode 100644 index 0000000000..03124d07d1 --- /dev/null +++ b/target/linux/ramips/patches-5.4/0002-MIPS-Always-define-builtin_cmdline.patch @@ -0,0 +1,44 @@ +From b7340422cc16c5deff100812f38114bb5ec81203 Mon Sep 17 00:00:00 2001 +From: Paul Burton +Date: Sat, 12 Oct 2019 20:43:36 +0000 +Subject: [PATCH] MIPS: Always define builtin_cmdline + +Commit 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line +initialization") made use of builtin_cmdline conditional upon plain C if +statements rather than preprocessor #ifdef's. This caused build failures +for configurations with CONFIG_CMDLINE_BOOL=n where builtin_cmdline +wasn't defined, for example: + + arch/mips/kernel/setup.c: In function 'bootcmdline_init': +>> arch/mips/kernel/setup.c:582:30: error: 'builtin_cmdline' undeclared + (first use in this function); did you mean 'builtin_driver'? + strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); + ^~~~~~~~~~~~~~~ + builtin_driver + arch/mips/kernel/setup.c:582:30: note: each undeclared identifier is + reported only once for each function it appears in + +Fix this by defining builtin_cmdline as an empty string in the affected +configurations. All of the paths that use it should be optimized out +anyway so the data itself gets optimized away too. + +Signed-off-by: Paul Burton +Fixes: 7784cac69735 ("MIPS: cmdline: Clean up boot_command_line initialization") +Reported-by: kbuild test robot +Reported-by: Nathan Chancellor +Cc: linux-mips@vger.kernel.org +--- + arch/mips/kernel/setup.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/mips/kernel/setup.c ++++ b/arch/mips/kernel/setup.c +@@ -68,6 +68,8 @@ char __initdata arcs_cmdline[COMMAND_LIN + + #ifdef CONFIG_CMDLINE_BOOL + static char __initdata builtin_cmdline[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; ++#else ++static const char builtin_cmdline[] __initconst = ""; + #endif + + /* diff --git a/target/linux/ramips/patches-5.4/0010-MIPS-add-bootargs-override-property.patch b/target/linux/ramips/patches-5.4/0010-MIPS-add-bootargs-override-property.patch new file mode 100644 index 0000000000..c19a0fb480 --- /dev/null +++ b/target/linux/ramips/patches-5.4/0010-MIPS-add-bootargs-override-property.patch @@ -0,0 +1,63 @@ +From f15d27f9c90ede4b16eb37f9ae573ef81c2b6996 Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Thu, 31 Dec 2020 18:49:12 +0100 +Subject: [PATCH] MIPS: add bootargs-override property + +Add support for the bootargs-override property to the chosen node +similar to the one used on ipq806x or mpc85xx. + +This is necessary, as the U-Boot used on some boards, notably the +Ubiquiti UniFi 6 Lite, overwrite the bootargs property of the chosen +node leading to a kernel panic when loading OpenWrt. + +Signed-off-by: David Bauer +--- + arch/mips/kernel/setup.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/arch/mips/kernel/setup.c ++++ b/arch/mips/kernel/setup.c +@@ -571,8 +571,28 @@ static int __init bootcmdline_scan_chose + return 1; + } + ++static int __init bootcmdline_scan_chosen_override(unsigned long node, const char *uname, ++ int depth, void *data) ++{ ++ bool *dt_bootargs = data; ++ const char *p; ++ int l; ++ ++ if (depth != 1 || !data || strcmp(uname, "chosen") != 0) ++ return 0; ++ ++ p = of_get_flat_dt_prop(node, "bootargs-override", &l); ++ if (p != NULL && l > 0) { ++ strlcpy(boot_command_line, p, COMMAND_LINE_SIZE); ++ *dt_bootargs = true; ++ } ++ ++ return 1; ++} ++ + static void __init bootcmdline_init(char **cmdline_p) + { ++ bool dt_bootargs_override = false; + bool dt_bootargs = false; + + /* +@@ -586,6 +606,14 @@ static void __init bootcmdline_init(char + } + + /* ++ * If bootargs-override in the chosen node is set, use this as the ++ * command line ++ */ ++ of_scan_flat_dt(bootcmdline_scan_chosen_override, &dt_bootargs_override); ++ if (dt_bootargs_override) ++ return; ++ ++ /* + * If the user specified a built-in command line & + * MIPS_CMDLINE_BUILTIN_EXTEND, then the built-in command line is + * prepended to arguments from the bootloader or DT so we'll copy them diff --git a/target/linux/ramips/rt3883/base-files/etc/board.d/02_network b/target/linux/ramips/rt3883/base-files/etc/board.d/02_network index 7b73f93944..f26199611e 100755 --- a/target/linux/ramips/rt3883/base-files/etc/board.d/02_network +++ b/target/linux/ramips/rt3883/base-files/etc/board.d/02_network @@ -25,6 +25,13 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "9@eth0" ;; + engenius,esr600h|\ + sitecom,wlr-6000|\ + trendnet,tew-691gr|\ + trendnet,tew-692gr) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" + ;; loewe,wmdr-143n|\ omnima,hpm) ucidef_set_interface_lan "eth0" @@ -33,12 +40,6 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "9@eth0" ;; - sitecom,wlr-6000|\ - trendnet,tew-691gr|\ - trendnet,tew-692gr) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" - ;; esac } @@ -66,6 +67,11 @@ ramips_setup_macs() edimax,br-6475nd) wan_mac=$(mtd_get_mac_binary devdata 0x7) ;; + engenius,esr600h) + wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) + lan_mac=$(macaddr_add "$wan_mac" 1) + label_mac=$wan_mac + ;; samsung,cy-swr1100) lan_mac=$(mtd_get_mac_ascii nvram lanmac) wan_mac=$(mtd_get_mac_ascii nvram wanmac)