mediatek: update Bananapi BPi-R4 Lite support
authorChukun Pan <[email protected]>
Sun, 9 Nov 2025 15:10:06 +0000 (23:10 +0800)
committerDaniel Golle <[email protected]>
Tue, 25 Nov 2025 16:48:28 +0000 (16:48 +0000)
Devices package:
  Add missing USB3 driver

Device tree:
  Fix model name and pwm usage
  Add missing supply for I2C and USB
  Update network port names based on the shell image [1]

[1] https://docs.banana-pi.org/bpi-r4_lite/banana_pi_bpi-r4_lite_case_1.png

Fixes: 8b6c6978 ("mediatek: add support for BananaPi BPi-R4 Lite")
Signed-off-by: Chukun Pan <[email protected]>
target/linux/mediatek/dts/mt7987a-bananapi-bpi-r4-lite.dts
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/image/filogic.mk

index c209b3d4eb15353976b92223c7b0c626044c3f33..d5a66e07a54cbb46d663246edb30b561b73c9d4f 100644 (file)
@@ -11,7 +11,7 @@
 #include "mt7987a-bananapi-bpi-r4-lite-mikrobus.dtsi"
 
 / {
-       model = "Bananapi BPI-R4-LITE";
+       model = "BananaPi BPI-R4 Lite";
        compatible = "bananapi,bpi-r4-lite",
                     "mediatek,mt7987a", "mediatek,mt7987";
 
                i2c2 = &imux1_sfp;
                i2c3 = &imux2_MikroBus;
                i2c4 = &imux3;
-               led-boot = &sys_led_blue;
-               led-failsafe = &sys_led_blue;
-               led-running = &sys_led_blue;
-               led-upgrade = &sys_led_blue;
+               led-boot = &act_led;
+               led-failsafe = &act_led;
+               led-running = &act_led;
+               led-upgrade = &act_led;
                serial0 = &uart0;
        };
 
                compatible = "gpio-leds";
 
                sfp-led {
-                       gpios = <&pca9555 11 GPIO_ACTIVE_LOW>;
                        function = "sfp";
                        color = <LED_COLOR_ID_GREEN>;
+                       gpios = <&pca9555 11 GPIO_ACTIVE_LOW>;
                };
        };
 
        pwm-leds {
                compatible = "pwm-leds";
-               status = "okay";
 
                /* ACT LED on bpi-r4-lite */
-               sys_led_blue: sys-led {
+               act_led: act-led {
                        color = <LED_COLOR_ID_BLUE>;
                        function = LED_FUNCTION_STATUS;
-                       pwms = <&pwm 0 50000>;
+                       pwms = <&pwm 0 50000 0>;
                        max-brightness = <255>;
-                       active-high;
-                       linux,default-trigger = "default-on";
+                       default-state = "on";
                };
        };
 
                regulator-min-microvolt = <5000000>;
                regulator-max-microvolt = <5000000>;
                gpio = <&pca9555 9 GPIO_ACTIVE_HIGH>;
-       };
-
-       usb-vbus-regulator {
-               compatible = "regulator-output";
-               vout-supply = <&reg_usb_5v>;
+               enable-active-high;
        };
 };
 
 &fan {
-       pwms = <&pwm 2 50000>;
+       pwms = <&pwm 2 50000 0>;
        status = "okay";
 };
 
 &gmac0 {
        phy-mode = "2500base-x";
        status = "okay";
+
        fixed-link {
                speed = <2500>;
                full-duplex;
 };
 
 &gmac1 {
+       openwrt,netdev-name = "wan";
        phy-mode = "internal";
        phy-handle = <&phy15>;
        status = "okay";
 };
 
-&pwm {
-       pinctrl-names = "default";
-       pinctrl-0 = <&pwm_pins>;
-       status = "okay";
-};
-
-&pwm_pins {
-       mux {
-               /*
-                * - pwm0   : PWM0@PIN13
-                * - pwm1_0 : PWM@PIN7  (share with JTAG)
-                * - pwm2_0 : PWM2@PIN12 (share with PCM)
-                */
-               function = "pwm";
-               groups = "pwm0", "pwm1_0", "pwm2_0";
-       };
-};
-
 &i2c0 {
        pinctrl-names = "default";
        pinctrl-0 = <&i2c0_pins>;
        pca9545@70 {
                compatible = "nxp,pca9545";
                reg = <0x70>;
+               vdd-supply = <&reg_3p3v>;
                #address-cells = <1>;
                #size-cells = <0>;
 
                                address-bits = <8>;
                                page-size = <8>;
                                size = <256>;
+                               vcc-supply = <&reg_3p3v>;
                        };
                };
 
 
                        pca9555: i2c-gpio-expander@20 {
                                compatible = "nxp,pca9555";
+                               reg = <0x20>;
+                               gpio-controller;
+                               #gpio-cells = <2>;
                                interrupt-controller;
                                interrupt-parent = <&pio>;
                                interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
-                               gpio-controller;
-                               #gpio-cells = <2>;
-                               reg = <0x20>;
+                               vcc-supply = <&reg_3p3v>;
                        };
 
-                       wifi_eeprom@50 {
+                       /* on the Wi-Fi card */
+                       eeprom@50 {
                                compatible = "atmel,24c02";
                                reg = <0x50>;
-                               wp-gpios = <&pca9555 10 GPIO_ACTIVE_LOW>;
                                address-bits = <8>;
                                page-size = <8>;
                                size = <256>;
 &mdio {
        /* built-in 2.5G Ethernet PHY */
        phy15: phy@15 {
-               pinctrl-names = "i2p5gbe-led";
-               pinctrl-0 = <&i2p5gbe_led0_pins>;
                compatible = "ethernet-phy-ieee802.3-c45";
                reg = <15>;
-               phy-mode = "internal";
+               pinctrl-names = "i2p5gbe-led";
+               pinctrl-0 = <&i2p5gbe_led0_pins>;
        };
 
-       switch31: switch@31 {
+       switch: switch@31 {
                compatible = "mediatek,mt7531";
                reg = <31>;
                reset-gpios = <&pio 42 GPIO_ACTIVE_HIGH>;
                #interrupt-cells = <1>;
                interrupt-parent = <&pio>;
                interrupts = <41 IRQ_TYPE_LEVEL_HIGH>;
-               status = "okay";
        };
 };
 
        status = "disabled";
 };
 
+&pwm {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pwm_pins>;
+       status = "okay";
+};
+
+&pwm_pins {
+       mux {
+               /*
+                * - pwm0   : PWM0@PIN13
+                * - pwm1_0 : PWM@PIN7  (share with JTAG)
+                * - pwm2_0 : PWM2@PIN12 (share with PCM)
+                */
+               function = "pwm";
+               groups = "pwm0", "pwm1_0", "pwm2_0";
+       };
+};
+
+&spi2 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&spi2_flash_pins>;
+       status = "okay";
+};
+
 &ssusb {
+       vusb33-supply = <&reg_3p3v>;
+       vbus-supply = <&reg_usb_5v>;
        status = "okay";
 
        /*
        // reset-gpios = <&pca9555 8 GPIO_ACTIVE_HIGH>;
 };
 
-&switch31 {
+&switch {
        ports {
                #address-cells = <1>;
                #size-cells = <0>;
 
                port@0 {
                        reg = <0>;
-                       label = "lan0";
+                       label = "lan1";
                };
 
                port@1 {
                        reg = <1>;
-                       label = "lan1";
+                       label = "lan2";
                };
 
                port@2 {
                        reg = <2>;
-                       label = "lan2";
+                       label = "lan3";
                };
 
                port@3 {
                        reg = <3>;
-                       label = "lan3";
+                       label = "lan4";
                };
 
                port@5 {
                        reg = <5>;
-                       label = "sfp0";
-                       phy-mode = "2500base-x";
+                       label = "sfp";
                        sfp = <&sfp>;
+                       phy-mode = "2500base-x";
                        managed = "in-band-status";
+                       openwrt,netdev-name = "sfp-lan";
                };
 
                port@6 {
        pinctrl-0 = <&uart0_pins>;
        status = "okay";
 };
-
-&spi2 {
-       pinctrl-names = "default";
-       pinctrl-0 = <&spi2_flash_pins>;
-
-       status = "okay";
-};
index 54a68bf57f36f5116ed9db9d49a78c489174c66b..70aa84dca990827c578fdf7533260f2196dd50d7 100644 (file)
@@ -94,7 +94,7 @@ mediatek_setup_interfaces()
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 sfp-lan" "wan sfp-wan"
                ;;
        bananapi,bpi-r4-lite)
-               ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3 sfp0" "eth1"
+               ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 sfp-lan" wan
                ;;
        bananapi,bpi-r4-2g5|\
        bananapi,bpi-r4-poe)
@@ -206,7 +206,8 @@ mediatek_setup_macs()
                ;;
        bananapi,bpi-r3|\
        bananapi,bpi-r3-mini|\
-       bananapi,bpi-r4)
+       bananapi,bpi-r4|\
+       bananapi,bpi-r4-lite)
                wan_mac=$(macaddr_add $(cat /sys/class/net/eth0/address) 1)
                ;;
        h3c,magic-nx30-pro)
index efcbe18712b2b004c22f3bac629a6e15edc975c5..3b5ce14d50e954b246c67fce1c85cfa729b1d4b8 100644 (file)
@@ -668,9 +668,8 @@ define Device/bananapi_bpi-r4-lite
   DEVICE_DTC_FLAGS := --pad 4096
   DEVICE_DTS_DIR := ../dts
   DEVICE_DTS_LOADADDR := 0x4ff00000
-  DEVICE_PACKAGES := mt7987-2p5g-phy-firmware kmod-eeprom-at24 \
-                    kmod-gpio-pca953x kmod-i2c-mux-pca954x kmod-rtc-pcf8563 \
-                    kmod-sfp e2fsprogs mkf2fs
+  DEVICE_PACKAGES := kmod-eeprom-at24 kmod-gpio-pca953x kmod-i2c-mux-pca954x \
+                    kmod-rtc-pcf8563 kmod-sfp kmod-usb3 e2fsprogs mkf2fs mt7987-2p5g-phy-firmware
   BLOCKSIZE := 128k
   PAGESIZE := 2048
   KERNEL_IN_UBI := 1