diff --git a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic index db87120c517..81b0e6a310b 100644 --- a/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic +++ b/package/boot/uboot-tools/uboot-envtools/files/mediatek_filogic @@ -133,6 +133,12 @@ gatonetworks,gdsp) glinet,gl-mt3000) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000" ;; +jiorouter,ax6000-jidu6101) + . /lib/upgrade/nand.sh + envubi=$(nand_find_ubi ubi) + envdev=/dev/$(nand_find_volume "$envubi" u-boot-env) + ubootenv_add_uci_config "$envdev" "0x0" "0x80000" "0x80000" "1" + ;; openembed,som7981) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x80000" ubootenv_add_uci_sys_config "/dev/mtd3" "0x0" "0x100000" "0x100000" diff --git a/target/linux/mediatek/dts/mt7986a-jiorouter-ax6000-jidu6101.dts b/target/linux/mediatek/dts/mt7986a-jiorouter-ax6000-jidu6101.dts new file mode 100644 index 00000000000..e4cd110b75d --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-jiorouter-ax6000-jidu6101.dts @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +#include "mt7986a-jiorouter-common.dtsi" + +/ { + compatible = "jiorouter,ax6000-jidu6101", "mediatek,mt7986a"; + model = "JioRouter AX6000 JIDU6101"; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@3 { + reg = <3>; + label = "lan4"; + }; + + port@4 { + reg = <4>; + label = "lan1"; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; diff --git a/target/linux/mediatek/dts/mt7986a-jiorouter-common.dtsi b/target/linux/mediatek/dts/mt7986a-jiorouter-common.dtsi new file mode 100644 index 00000000000..b7135917b9f --- /dev/null +++ b/target/linux/mediatek/dts/mt7986a-jiorouter-common.dtsi @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +#include +#include +#include +#include + +#include "mt7986a.dtsi" + +/ { + aliases { + serial0 = &uart0; + led-boot = &led_red; + led-failsafe = &led_red; + led-running = &led_red; + led-upgrade = &led_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "dm-mod.create=''"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_red: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_green: led-1 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led_blue: led-2 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 14 GPIO_ACTIVE_LOW>; + }; + }; + + memory@40000000 { + reg = <0 0x40000000 0 0x20000000>; + device_type = "memory"; + }; + + 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; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; +}; + +&crypto { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + }; +}; + +&mdio { + switch: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + reset-gpios = <&pio 5 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <66 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&pio { + spi_flash_pins: spi-flash-pins-33-to-38 { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + conf-pu { + pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; + drive-strength = ; + bias-disable; + }; + conf-pd { + pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; + drive-strength = ; + bias-disable; + }; + }; + + wf_2g_5g_pins: wf_2g_5g-pins { + mux { + function = "wifi"; + groups = "wf_2g", "wf_5g"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = ; + }; + }; + + wf_dbdc_pins: wf_dbdc-pins { + mux { + function = "wifi"; + groups = "wf_dbdc"; + }; + conf { + pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4", + "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6", + "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10", + "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1", + "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0", + "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8", + "WF1_TOP_CLK", "WF1_TOP_DATA"; + drive-strength = ; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi_flash_pins>; + status = "okay"; + + spi_nand_flash: flash@0 { + compatible = "spi-nand"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + spi-max-frequency = <52000000>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x0 0x100000>; + read-only; + }; + + /* Only used for MAC address storage. + * The active U-Boot environment is stored in UBI. + */ + partition@100000 { + label = "u-boot-env"; + reg = <0x100000 0x80000>; + read-only; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + reg = <0x580000 0x8c00000>; + }; + + partition@9180000 { + label = "ubi2"; + reg = <0x9180000 0x5a00000>; + }; + + partition@eb80000 { + label = "MFG"; + reg = <0xeb80000 0x200000>; + read-only; + }; + + partition@ed80000 { + label = "Reserved"; + reg = <0xed80000 0x200000>; + read-only; + }; + }; + }; +}; + +&ssusb { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_5v>; + status = "okay"; +}; + +&trng { + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + pinctrl-names = "default", "dbdc"; + pinctrl-0 = <&wf_2g_5g_pins>; + pinctrl-1 = <&wf_dbdc_pins>; + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network index a48b62f17b0..6770b864243 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network @@ -264,6 +264,11 @@ mediatek_setup_macs() lan_mac=$(macaddr_add "$wan_mac" 1) label_mac=$wan_mac ;; + jiorouter,ax6000-jidu6101) + label_mac=$(mtd_get_mac_ascii u-boot-env mac) + wan_mac=$label_mac + lan_mac=$(macaddr_add "$label_mac" 1) + ;; mercusys,mr80x-v3|\ mercusys,mr85x) mac_dirty=$(cat "/tmp/tp_data/default-mac" | sed -n 's/^'"MAC"'://p') diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index b5ca7d605f2..8bd48a15d26 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -158,6 +158,11 @@ case "$board" in jdcloud,re-cp-03) [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress ;; + jiorouter,ax6000-jidu6101) + addr=$(mtd_get_mac_ascii u-boot-env mac) + [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress + ;; keenetic,kap-630|\ keenetic,kn-3711|\ keenetic,kn-3811|\ diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index 3aac9131b1c..8aadf3e0cf5 100644 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -24,6 +24,27 @@ buffalo_initial_setup() ubiformat /dev/mtd$mtdnum -y } +jiorouter_initial_setup() +{ + [ "$(rootfs_type)" = "tmpfs" ] || return 0 + + local mtdnum="$( find_mtd_index ubi )" + if [ ! "$mtdnum" ]; then + echo "unable to find mtd partition ubi" + return 1 + fi + + ubidetach -m "$mtdnum" 2>/dev/null + ubiformat /dev/mtd$mtdnum -y + ubiattach -m "$mtdnum" + ubimkvol /dev/ubi0 -n 0 -N u-boot-env -s 0x80000 + + # Set boot arguments in freshly created U-Boot environment + fw_setenv bootcmd 'ubi read 46000000 kernel;fdt addr $(fdtcontroladdr);fdt rm /signature;bootm 0x46000000' + fw_setenv bootdelay 0 + fw_setenv ipaddr '' +} + xiaomi_initial_setup() { # initialize UBI and setup uboot-env if it's running on initramfs @@ -209,7 +230,8 @@ platform_do_upgrade() { buffalo,wsr-6000ax8|\ cudy,wr3000h-v1|\ cudy,wr3000p-v1|\ - huasifei,wh3000-pro-nand) + huasifei,wh3000-pro-nand|\ + jiorouter,ax6000-jidu6101) CI_UBIPART="ubi" nand_do_upgrade "$1" ;; @@ -455,6 +477,9 @@ platform_pre_upgrade() { [ -z "$delay" ] || [ "$delay" -eq "0" ] && \ fw_setenv bootmenu_delay 3 ;; + jiorouter,ax6000-jidu6101) + jiorouter_initial_setup + ;; xiaomi,mi-router-ax3000t|\ xiaomi,mi-router-wr30u-stock|\ xiaomi,redmi-router-ax6000-stock) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index ab76132bd49..84369e23ea4 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -2014,6 +2014,21 @@ define Device/jdcloud_re-cp-03 endef TARGET_DEVICES += jdcloud_re-cp-03 +define Device/jiorouter_ax6000-jidu6101 + DEVICE_VENDOR := JioRouter + DEVICE_MODEL := AX6000 + DEVICE_VARIANT := JIDU6101 + DEVICE_DTS := mt7986a-jiorouter-ax6000-jidu6101 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-usb3 kmod-mt7915e kmod-mt7916-firmware kmod-mt7986-firmware mt7986-wo-firmware + UBINIZE_OPTS := -E 5 + UBOOTENV_IN_UBI := 1 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += jiorouter_ax6000-jidu6101 + define Device/kebidumei_ax3000-u22 DEVICE_VENDOR := Kebidumei DEVICE_MODEL := AX3000-U22