From 3d31be189645a68591b59c855b885fdbca77c7af Mon Sep 17 00:00:00 2001 From: Chen Minqiang Date: Sun, 8 Sep 2024 15:16:16 +0800 Subject: [PATCH] mediatek: init add NRadio C8-660 Signed-off-by: Chen Minqiang --- .../mediatek/dts/mt7981b-nradio-c8-660.dts | 283 ++++++++++++++++++ .../filogic/base-files/etc/board.d/01_leds | 4 + .../filogic/base-files/etc/board.d/02_network | 3 + target/linux/mediatek/image/filogic.mk | 16 + 4 files changed, 306 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts diff --git a/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts b/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts new file mode 100644 index 0000000000000..576456f2f6e7c --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-nradio-c8-660.dts @@ -0,0 +1,283 @@ +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "NRadio C8-660"; + compatible = "nradio,c8-660", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + led-boot = &status_blue; + led-failsafe = &status_blue; + led-running = &status_blue; + led-upgrade = &status_blue; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + linux,code = ; + gpios = <&pio 1 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 9 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + cpepower { + gpio-export,name = "cpe-pwr"; + gpio-export,output = <0>; + gpios = <&pio 25 GPIO_ACTIVE_LOW>; + }; + + cpesel0 { + gpio-export,name = "cpe-sel0"; + gpio-export,output = <1>; + gpios = <&pio 24 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status_blue: status { + label = "blue:status"; + gpios = <&pio 10 GPIO_ACTIVE_LOW>; + }; + + cmode5 { + label = "blue:cmode5"; + gpios = <&pio 11 GPIO_ACTIVE_LOW>; + }; + + cmode4 { + label = "blue:cmode4"; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + wifi { + label = "blue:wifi"; + gpios = <&pio 13 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + nvmem-cells = <&macaddr_factory_4 (-1)>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy21>; + nvmem-cells = <&macaddr_factory_4 (-2)>; + nvmem-cell-names = "mac-address"; + }; +}; + +&mdio_bus { + reset-gpios = <&pio 7 GPIO_ACTIVE_LOW>, <&pio 8 GPIO_ACTIVE_LOW>; + reset-delay-us = <600>; + reset-post-delay-us = <20000>; + + phy5: ethernet-phy@5 { + reg = <5>; + compatible = "ethernet-phy-ieee802.3-c45"; + }; + + phy21: ethernet-phy@21 { + reg = <21>; + compatible = "ethernet-phy-ieee802.3-c45"; + }; + + switch0: switch@1f { + compatible = "mediatek,mt7531"; + reg = <31>; + dsa,member = <0 0>; + reset-gpios = <&pio 39 GPIO_ACTIVE_HIGH>; + interrupt-controller; + #interrupt-cells = <1>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_LEVEL_HIGH>; + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@5 { + reg = <5>; + label = "lan4"; + phy-mode = "2500base-x"; + phy-handle = <&phy5>; + }; + + port@6 { + reg = <6>; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + spi_nand: flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "spi-nand"; + reg = <0>; + spi-max-frequency = <52000000>; + + spi-cal-enable; + spi-cal-mode = "read-data"; + spi-cal-datalen = <7>; + spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4E 0x41 0x4E 0x44>; + spi-cal-addrlen = <5>; + spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>; + + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; + mediatek,nmbm; + mediatek,bmt-max-ratio = <1>; + mediatek,bmt-max-reserved-blocks = <64>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "BL2"; + reg = <0x00000 0x0100000>; + read-only; + }; + + partition@100000 { + label = "u-boot-env"; + reg = <0x0100000 0x0080000>; + }; + + factory: partition@180000 { + label = "Factory"; + reg = <0x180000 0x0180000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@300000 { + label = "bdinfo"; + reg = <0x300000 0x0080000>; + }; + + partition@380000 { + label = "FIP"; + reg = <0x380000 0x0200000>; + read-only; + }; + + partition@580000 { + label = "ubi"; + //reg = <0x580000 0x7000000>; + reg = <0x580000 0x1f400000>; + compatible = "linux,ubi"; + }; + }; + }; +}; + +&pio { + spi0_flash_pins: spi0-pins { + mux { + function = "spi"; + groups = "spi0", "spi0_wp_hold"; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; +}; + +&wifi { + mediatek,mtd-eeprom = <&factory 0x0>; + + 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 ad274ea08f2e1..b4ed153266441 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 @@ -75,6 +75,10 @@ nokia,ea0326gmp) ucidef_set_led_netdev "lan" "LAN" "green:lan" "br-lan" "link" ucidef_set_led_netdev "wlan" "WLAN" "green:wlan" "phy1-ap0" "link" ;; +nradio,c8-660) + ucidef_set_led_netdev "wifi" "WIFI" "blue:wifi" "phy0-ap0" + ucidef_set_led_netdev "5g" "5G" "blue:cmode5" "eth1" "link tx rx" + ;; openembed,som7981) ucidef_set_led_netdev "lanact" "LANACT" "green:lan" "eth1" "rx tx" ucidef_set_led_netdev "lanlink" "LANLINK" "amber:lan" "eth1" "link" 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 96d58db867a96..198a84da3192c 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 @@ -100,6 +100,9 @@ mediatek_setup_interfaces() mercusys,mr90x-v1) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; + nradio,c8-660) + ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" eth1 + ;; cudy,ap3000outdoor-v1|\ cudy,re3000-v1|\ netgear,wax220|\ diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index e99d944a8603c..0275e25b974db 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1237,6 +1237,22 @@ define Device/nokia_ea0326gmp endef TARGET_DEVICES += nokia_ea0326gmp +define Device/nradio_c8-660 + DEVICE_VENDOR := NRadio + DEVICE_MODEL := C8-660 + DEVICE_DTS := mt7981b-nradio-c8-660 + DEVICE_DTS_DIR := ../dts + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + IMAGE_SIZE := 131072k + KERNEL_IN_UBI := 1 + IMAGES += factory.bin + IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += nradio_c8-660 + define Device/openembed_som7981 DEVICE_VENDOR := OpenEmbed DEVICE_MODEL := SOM7981