diff --git a/target/linux/mediatek/dts/mt7981b-airpi-ap3000m.dts b/target/linux/mediatek/dts/mt7981b-airpi-ap3000m.dts new file mode 100644 index 0000000000..c17e8034bb --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-airpi-ap3000m.dts @@ -0,0 +1,222 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; + +#include +#include +#include + +#include "mt7981b.dtsi" + +/ { + model = "Airpi AP3000M"; + compatible = "airpi,ap3000m", "mediatek,mt7981"; + + aliases { + ethernet0 = &gmac0; + ethernet1 = &gmac1; + serial0 = &uart0; + + led-boot = &led_sys_blue; + led-failsafe = &led_sys_blue; + led-running = &led_sys_blue; + led-upgrade = &led_sys_blue; + }; + + chosen { + stdout-path = "serial0:115200n8"; + bootargs = "root=PARTLABEL=rootfs rootwait"; + }; + + memory { + reg = <0 0x40000000 0 0x40000000>; + device_type = "memory"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + led_sys_blue: led-0 { + function = LED_FUNCTION_STATUS; + color = ; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + + led-1 { + function = LED_FUNCTION_WLAN_2GHZ; + color = ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + led-2 { + function = LED_FUNCTION_WLAN_5GHZ; + color = ; + gpios = <&pio 35 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + 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; + }; +}; + +&mmc0 { + pinctrl-names = "default", "state_uhs"; + pinctrl-0 = <&mmc0_pins_default>; + pinctrl-1 = <&mmc0_pins_uhs>; + bus-width = <8>; + cap-mmc-highspeed; + max-frequency = <52000000>; + vmmc-supply = <®_3p3v>; + no-sd; + no-sdio; + non-removable; + status = "okay"; + + card@0 { + compatible = "mmc-card"; + reg = <0>; + + block { + compatible = "block-device"; + + partitions { + block-partition-factory { + partname = "factory"; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + }; + }; + }; + }; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + phy-handle = <&phy1>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "gmii"; + phy-handle = <&int_gbe_phy>; + }; +}; + +&mdio_bus { + phy1: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c45"; + reg = <1>; + reset-assert-us = <100000>; + reset-deassert-us = <100000>; + reset-gpios = <&pio 39 GPIO_ACTIVE_LOW>; + interrupts = <38 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&pio>; + realtek,aldps-enable; + }; +}; + +&pio { + mmc0_pins_default: mmc0-pins-default { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + mmc0_pins_uhs: mmc0-pins-uhs { + mux { + function = "flash"; + groups = "emmc_45"; + }; + }; + + pwm2_pins: pwm2-pins { + mux { + function = "pwm"; + groups = "pwm2"; + }; + }; +}; + +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm2_pins>; + status = "okay"; +}; + +&fan { + pwms = <&pwm 2 40000 0>; + status = "okay"; +}; + +&uart0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +&xhci { + vbus-supply = <®_5v>; + status = "okay"; +}; + +&wifi { + nvmem-cells = <&eeprom_factory_0>; + nvmem-cell-names = "eeprom"; + status = "okay"; +}; diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds index bfa00d1b44..61536f4fdd 100644 --- a/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/01_leds @@ -6,6 +6,10 @@ board=$(board_name) board_config_update case $board in +airpi,ap3000m) + ucidef_set_led_netdev "wlan2g" "WLAN2G" "orange:wlan-2ghz" "phy0-ap0" "link tx rx" + ucidef_set_led_netdev "wlan5g" "WLAN5G" "white:wlan-5ghz" "phy1-ap0" "link tx rx" + ;; abt,asr3000) ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan-2ghz" "phy0-ap0" 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 2519c97b9f..fd7c159aab 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 @@ -88,12 +88,6 @@ mediatek_setup_interfaces() bananapi,bpi-r3) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp2" "sfp1 wan" ;; - bananapi,bpi-r3-mini|\ - edgecore,eap111|\ - huasifei,wh3000|\ - huasifei,wh3000-pro) - ucidef_set_interfaces_lan_wan eth0 eth1 - ;; bananapi,bpi-r4) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 sfp-lan" "wan sfp-wan" ;; @@ -123,6 +117,13 @@ mediatek_setup_interfaces() zyxel,nwa50ax-pro) ucidef_set_interface_lan "eth0" ;; + airpi,ap3000m|\ + bananapi,bpi-r3-mini|\ + edgecore,eap111|\ + huasifei,wh3000|\ + huasifei,wh3000-pro) + ucidef_set_interfaces_lan_wan eth0 eth1 + ;; cudy,m3000-v1|\ cudy,tr3000-256mb-v1|\ cudy,tr3000-v1|\ @@ -210,6 +211,11 @@ mediatek_setup_macs() local label_mac="" case $board in + airpi,ap3000m) + base_mac=$(macaddr_generate_from_mmc_cid mmcblk0) + lan_mac="$base_mac" + wan_mac="$(macaddr_add "$base_mac" 1)" + ;; acer,predator-w6|\ acer,predator-w6d|\ acer,vero-w6m) 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 87d91b401d..907dd00d36 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 @@ -33,6 +33,11 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr 3 > /sys${DEVPATH}/macaddress ;; + airpi,ap3000m) + base_mac=$(macaddr_generate_from_mmc_cid mmcblk0) + [ "$PHYNBR" = "0" ] && macaddr_add $base_mac 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && macaddr_add $base_mac 3 > /sys${DEVPATH}/macaddress + ;; asus,rt-ax59u) CI_UBIPART="UBI_DEV" addr=$(mtd_get_mac_binary_ubi "Factory" 0x4) 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 94a8df37cd..dde54a053d 100644 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -124,6 +124,7 @@ platform_do_upgrade() { acer,predator-w6|\ acer,predator-w6d|\ acer,vero-w6m|\ + airpi,ap3000m|\ arcadyan,mozart|\ glinet,gl-mt2500|\ glinet,gl-mt6000|\ @@ -346,6 +347,7 @@ platform_copy_config() { acer,predator-w6|\ acer,predator-w6d|\ acer,vero-w6m|\ + airpi,ap3000m|\ arcadyan,mozart|\ glinet,gl-mt2500|\ glinet,gl-mt6000|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 3d6dd1ad23..bd320ab343 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -348,6 +348,20 @@ $(call Device/adtran_smartrg) endef TARGET_DEVICES += smartrg_sdg-8734 +define Device/airpi_ap3000m + DEVICE_VENDOR := Airpi + DEVICE_MODEL := AP3000M + DEVICE_DTS := mt7981b-airpi-ap3000m + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-hwmon-pwmfan kmod-usb3 f2fsck mkf2fs + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += airpi_ap3000m + define Device/arcadyan_mozart DEVICE_VENDOR := Arcadyan DEVICE_MODEL := Mozart