From ec135e7aefac08806fbabb0634a2bd88a169dfc6 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 15 Jul 2023 15:25:59 +0200 Subject: [PATCH 58/68] ramips: add mt7621_indio_um-305ax Signed-off-by: John Crispin --- target/linux/ath79/image/generic.mk | 22 +-- .../ramips/dts/mt7621_indio_um-305ax.dts | 146 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 11 ++ .../mt7621/base-files/etc/board.d/02_network | 6 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 6 + 5 files changed, 180 insertions(+), 11 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_indio_um-305ax.dts diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 5882feafcb..a98a5e816f 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1627,6 +1627,17 @@ define Device/hiwifi_hc6361 endef TARGET_DEVICES += hiwifi_hc6361 +define Device/indio_um-305ac + SOC := qca9531 + DEVICE_VENDOR := Indio Network + DEVICE_MODEL := UM-305AC + DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 + IMAGE_SIZE := 16000k + IMAGES += tftp.bin + IMAGE/tftp.bin := $$(IMAGE/sysupgrade.bin) | yuncore-tftp-header-16m +endef +TARGET_DEVICES += indio_um-305ac + define Device/iodata_etg3-r SOC := ar9342 DEVICE_VENDOR := I-O DATA @@ -2991,17 +3002,6 @@ define Device/yuncore_a770 endef TARGET_DEVICES += yuncore_a770 -define Device/indio_um-305ac - SOC := qca9531 - DEVICE_VENDOR := Indio Network - DEVICE_MODEL := UM-305AC - DEVICE_PACKAGES := kmod-ath10k ath10k-firmware-qca9887 - IMAGE_SIZE := 16000k - IMAGES += tftp.bin - IMAGE/tftp.bin := $$(IMAGE/sysupgrade.bin) | yuncore-tftp-header-16m -endef -TARGET_DEVICES += indio_um-305ac - define Device/yuncore_a782 SOC := qca9563 DEVICE_VENDOR := YunCore diff --git a/target/linux/ramips/dts/mt7621_indio_um-305ax.dts b/target/linux/ramips/dts/mt7621_indio_um-305ax.dts new file mode 100644 index 0000000000..79cffbdec2 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_indio_um-305ax.dts @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "indio,um-305ax", "mediatek,mt7621-soc"; + model = "INDIO UM-305AX"; + + aliases { + led-boot = &led_green; + led-failsafe = &led_red; + led-running = &led_blue; + led-upgrade = &led_red; + label-mac-device = &wan_port; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + bootargs-override = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_blue: blue { + label = "blue"; + gpios = <&gpio 24 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_red: red { + label = "red"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + led_green: green { + label = "green"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <50>; + pinctrl-names = "default"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&state_default { + gpio { + groups = "rgmii2"; + function = "gpio"; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + reg = <0x0 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0x4>; +}; + +&switch0 { + ports { + wan_port: port@0 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0x28>; + }; + + port@1 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&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 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + label = "product"; + reg = <0x40000 0x10000>; + read-only; + }; + + factory: partition@50000 { + label = "factory"; + reg = <0x50000 0x40000>; + read-only; + }; + partition@90000 { + compatible = "denx,fit"; + label = "firmware"; + reg = <0x90000 0xf60000>; + }; + + partition@ff0000 { + label = "certificates"; + reg = <0xff0000 0x10000>; + }; + + }; + }; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 962d7ef440..8790a2fa50 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1148,6 +1148,17 @@ define Device/huasifei_ws1208v2 endef TARGET_DEVICES += huasifei_ws1208v2 +define Device/indio_um-305ax + $(Device/dsa-migration) + DEVICE_VENDOR := INDIO + DEVICE_MODEL := UM-305AX + DEVICE_DTS_CONFIG := config@1 + DEVICE_PACKAGES += kmod-mt7915e + KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGE_SIZE := 15774k +endef +TARGET_DEVICES += indio_um-305ax + define Device/iodata_wn-ax1167gr $(Device/dsa-migration) $(Device/uimage-lzma-loader) 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 bd1d394892..0f6b7fd526 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -60,6 +60,7 @@ ramips_setup_interfaces() ;; asiarf,ap7621-001|\ humax,e10|\ + indio,um-305ax|\ wavlink,ws-wn572hp3-4g|\ winstars,ws-wn583a6) ucidef_set_interfaces_lan_wan "lan" "wan" @@ -148,6 +149,11 @@ ramips_setup_interfaces() *) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan" ;; + indio,um-305ax) + label_mac=$(mtd_get_mac_binary factory 0x4) + wan_mac=$(macaddr_add $label_mac 1) + lan_mac=$label_mac + ;; esac } 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 3467e783f0..d5bd50fdf7 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 @@ -60,6 +60,12 @@ case "$board" in macaddr_setbit_la "$base_mac" > /sys${DEVPATH}/macaddress fi ;; + indio,um-305ax) + [ "$PHYNBR" = "0" ] && \ + macaddr_add "$(mtd_get_mac_binary factory 0x4)" 2 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && \ + macaddr_add "$(mtd_get_mac_binary factory 0x4)" 3 > /sys${DEVPATH}/macaddress + ;; glinet,gl-mt1300) [ "$PHYNBR" = "1" ] && \ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress -- 2.34.1