From: Daniel Golle Date: Thu, 22 Aug 2024 02:25:12 +0000 (+0100) Subject: ramips: mt76x8: add support for Yuncore CPE200 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=64dae1052b41801c8f4fb038b5e63b11e9001b9b;p=openwrt%2Fstaging%2Fblocktrron.git ramips: mt76x8: add support for Yuncore CPE200 Yuncore CPE200 is an outdoor unit with IEEE 802.11ac radio. Hardware: - SoC: MediaTek MT7628DAN (MIPS 580MHz) - Flash: 8 MiB Spansion S25FL064K - RAM: 64 MiB (built-into SoC) - WLAN: 5 GHz (MT7613AE) - Ethernet: 1x 10/100 Mbps WAN, 1x 10/100 LAN (MT7628) - Buttons: 1 Reset button, 2 buttons for display UI (unsupported) - LEDs: 4x Green (Power, LAN, WAN, WiFi) - Display: 4 digit 7-segment display driven by an additional microcontroller (unsupported) - Serial console: unpopulated header, 57600 8n1 (RX only) - Power: 12 VDC, 1 A Installation: The installation can be done via the recovery HTTP server which is built into the bootloader. Hold down the reset button while connecting the device to power and keep holding a bit more than 3 seconds. Connect to http://192.168.0.100/ and upload sysupgrade.bin file. Signed-off-by: Daniel Golle --- diff --git a/target/linux/ramips/dts/mt7628an_yuncore_cpe200.dts b/target/linux/ramips/dts/mt7628an_yuncore_cpe200.dts new file mode 100644 index 0000000000..c8bd39b6ac --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_yuncore_cpe200.dts @@ -0,0 +1,164 @@ +#include "mt7628an.dtsi" + +#include +#include +#include + +/ { + compatible = "yuncore,cpe200", "mediatek,mt7628an-soc"; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + aliases { + label-mac = ðernet; + 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 = ; + }; + + mode { + label = "mode"; + linux,input-type = ; + linux,code = ; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + function = LED_FUNCTION_POWER; + color = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + lan { + function = LED_FUNCTION_LAN; + color = ; + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + }; + + wan { + function = LED_FUNCTION_WAN; + color = ; + gpios = <&gpio 39 GPIO_ACTIVE_LOW>; + }; + }; + + watchdog { + compatible = "linux,wdt-gpio"; + gpios = <&gpio 37 GPIO_ACTIVE_HIGH>; + hw_algo = "toggle"; + hw_margin_ms = <20000>; + always-running; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + 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 = "factory"; + reg = <0x40000 0x10000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + eeprom_factory_8000: eeprom@8000 { + reg = <0x8000 0x600>; + }; + + macaddr_factory_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x2f>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + ieee80211-freq-limit = <5000000 6000000>; + nvmem-cells = <&eeprom_factory_8000>, <&macaddr_factory_8004>; + nvmem-cell-names = "eeprom", "mac-address"; + + led { + led-sources = <0>; + led-active-low; + }; + }; +}; + +&state_default { + gpio { + groups = "pwm0", "i2c", "refclk", "wdt", "i2s", "spi cs1", + "spis", "gpio", "p0led_an", "p1led_an", "p2led_an", + "p3led_an", "p4led_an", "wled_kn", "p0led_kn", + "p1led_kn", "p2led_kn", "p3led_kn", "p4led_kn", "wled_an"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 1eae3d3dee..8ad840ddfe 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -1136,6 +1136,14 @@ define Device/xiaomi_mi-ra75 endef TARGET_DEVICES += xiaomi_mi-ra75 +define Device/yuncore_cpe200 + IMAGE_SIZE := 7872k + DEVICE_VENDOR := Yuncore + DEVICE_MODEL := CPE200 + DEVICE_PACKAGES := -kmod-mt7603 kmod-mt7615e kmod-mt7663-firmware-ap kmod-mt7663-firmware-sta +endef +TARGET_DEVICES += yuncore_cpe200 + define Device/yuncore_m300 IMAGE_SIZE := 7872k DEVICE_VENDOR := Yuncore 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 5a93761780..5ea668de01 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -19,6 +19,7 @@ asus,rt-n12-vp-b1|\ netgear,r6020|\ netgear,r6080|\ netgear,r6120|\ +yuncore,cpe200|\ yuncore,m300) ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0xf" ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10" 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 2989d36e9b..cb0983b9dc 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -204,6 +204,10 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan:2" "2:lan:1" "4:wan" "6@eth0" ;; + yuncore,cpe200) + ucidef_add_switch "switch0" \ + "0:lan" "4:wan" "6@eth0" + ;; zbtlink,zbt-we1226) ucidef_add_switch "switch0" \ "0:lan:2" "1:lan:1" "4:wan" "6@eth0"