From 8b3c05f087f79b6c2b2b4928dd15af468d0f320d Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Tue, 8 Oct 2024 18:04:22 +0800 Subject: [PATCH] mediatek: update openembed som7981 support The board has been redesigned due to previous hardware bugs (with other reasons maybe). Changes in new board: - Added a gpio beeper - Added a Atmel i2c eeprom - Added a Atmel i2c ECC accelerator - Added a Philips RTC module - Added two RS485 - Removed WPS button - Replaced USB3 port with M.2 B-key for LTE modules Also replace broken 'phy*tpt' trigger with uci netdev configuration. Keeping compatibility for old version is not necessary here as only few samples were sent to those interested in it. Signed-off-by: Tianling Shen --- .../dts/mt7981b-openembed-som7981.dts | 94 ++++++++++++++++--- .../filogic/base-files/etc/board.d/01_leds | 2 + target/linux/mediatek/image/filogic.mk | 5 +- 3 files changed, 85 insertions(+), 16 deletions(-) diff --git a/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts b/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts index 8d63cc56ea..bf2500e40f 100644 --- a/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts +++ b/target/linux/mediatek/dts/mt7981b-openembed-som7981.dts @@ -12,9 +12,9 @@ compatible = "openembed,som7981", "mediatek,mt7981"; aliases { - led-boot = &wlan2g_led; - led-failsafe = &wlan2g_led; - led-upgrade = &wlan2g_led; + led-boot = &wlan5g_led; + led-failsafe = &wlan5g_led; + led-upgrade = &wlan5g_led; serial0 = &uart0; }; @@ -26,6 +26,11 @@ reg = <0 0x40000000 0 0x40000000>; }; + beeper { + compatible = "gpio-beeper"; + gpios = <&pio 2 GPIO_ACTIVE_HIGH>; + }; + gpio-keys { compatible = "gpio-keys"; @@ -34,12 +39,6 @@ linux,code = ; gpios = <&pio 1 GPIO_ACTIVE_LOW>; }; - - button-wps { - label = "wps"; - linux,code = ; - gpios = <&pio 0 GPIO_ACTIVE_LOW>; - }; }; gpio-leds { @@ -57,18 +56,16 @@ gpios = <&pio 13 GPIO_ACTIVE_LOW>; }; - wlan2g_led: led-2 { + led-2 { function = LED_FUNCTION_WLAN_2GHZ; - color = ; + color = ; gpios = <&pio 34 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy0tpt"; }; - led-3 { + wlan5g_led: led-3 { function = LED_FUNCTION_WLAN_5GHZ; color = ; gpios = <&pio 35 GPIO_ACTIVE_LOW>; - linux,default-trigger = "phy1tpt"; }; }; }; @@ -97,6 +94,30 @@ }; }; +&i2c0 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + + eeprom@50 { + compatible = "atmel,24c64"; + reg = <0x50>; + page-size = <32>; + }; + + rtc@51 { + compatible = "nxp,pcf8563"; + reg = <0x51>; + #clock-cells = <0>; + }; + + crypto@60 { + compatible = "atmel,atecc508a"; + reg = <0x60>; + }; +}; + &mdio_bus { phy0: ethernet-phy@5 { reg = <5>; @@ -107,7 +128,8 @@ reset-deassert-us = <50000>; realtek,aldps-enable; realtek,led-link-select = <0x0 0xa7 0xa7>; - realtek,led-act-select = <0x2>; + realtek,led-act-select = <0x2612>; + realtek,led-polarity-select = <0x63>; }; }; @@ -186,6 +208,13 @@ }; &pio { + i2c0_pins: i2c0-pins { + mux { + function = "i2c"; + groups = "i2c0_1"; + }; + }; + spi0_flash_pins: spi0-pins { mux { function = "spi"; @@ -204,12 +233,45 @@ mediatek,pull-down-adv = <0>; }; }; + + uart1_pins: uart1-pins { + mux { + function = "uart1"; + groups = "uart1_1_tx_rx"; + }; + }; + + uart2_pins: uart2-pins { + mux { + function = "uart2"; + groups = "uart2_0_tx_rx"; + }; + }; + + wwan_rst_h: wwan-rst-h { + pins = "GPIO_WPS"; + drive-strength = <8>; + mediatek,pull-down-adv = <0>; + output-low; + }; }; &uart0 { status = "okay"; }; +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pins>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pins>; + status = "okay"; +}; + &usb_phy { status = "okay"; }; @@ -225,5 +287,7 @@ }; &xhci { + pinctrl-names = "default"; + pinctrl-0 = <&wwan_rst_h>; 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 e4801093fb..559dde8f91 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,8 @@ netgear,wax220) openembed,som7981) ucidef_set_led_netdev "lanact" "LANACT" "green:lan" "eth1" "rx tx" ucidef_set_led_netdev "lanlink" "LANLINK" "amber:lan" "eth1" "link" + ucidef_set_led_netdev "wlan2g" "WLAN2G" "green:wlan-2ghz" "phy0-ap0" + ucidef_set_led_netdev "wlan5g" "WLAN5G" "red:wlan-5ghz" "phy1-ap0" ;; openwrt,one) ucidef_set_led_netdev "wanact" "WANACT" "mdio-bus:0f:green:wan" "eth0" "rx tx" diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index cd452afa7d..32918dfa05 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -1232,7 +1232,10 @@ define Device/openembed_som7981 DEVICE_MODEL := SOM7981 DEVICE_DTS := mt7981b-openembed-som7981 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware \ + kmod-crypto-hw-atmel kmod-eeprom-at24 kmod-gpio-beeper kmod-rtc-pcf8563 \ + kmod-usb-net-cdc-mbim kmod-usb-net-qmi-wwan kmod-usb-serial-option \ + kmod-usb3 automount uqmi UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048