From: Martin Schiller Date: Tue, 30 Apr 2024 08:50:51 +0000 (+0200) Subject: mediatek: bpi-r4: add support for 2.5GE PoE variant X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=fa804f7d0e5a616ec651f0f2fbb7d1387d8c46f8;p=openwrt%2Fstaging%2Fwigyori.git mediatek: bpi-r4: add support for 2.5GE PoE variant This adds support for the bpi-r4 variant with internal 2.5G PHY and additional ethernet port instead of second sfp. Signed-off-by: Martin Schiller --- diff --git a/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-poe.dts b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-poe.dts new file mode 100644 index 0000000000..efcf0ec358 --- /dev/null +++ b/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4-poe.dts @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2022 MediaTek Inc. + * Author: Sam.Shih + */ + +#include "mt7988a-bananapi-bpi-r4.dtsi" + +/ { + model = "Bananapi BPI-R4 2.5GE PoE"; + compatible = "bananapi,bpi-r4-poe", + "mediatek,mt7988a"; +}; + +&gmac1 { + phy-mode = "internal"; + phy-connection-type = "internal"; + phy = <&int_2p5g_phy>; + status = "okay"; +}; + +&int_2p5g_phy { + pinctrl-names = "i2p5gbe-led"; + pinctrl-0 = <&i2p5gbe_led0_pins>; +}; diff --git a/target/linux/mediatek/files-6.6/drivers/net/phy/mediatek-2p5ge.c b/target/linux/mediatek/files-6.6/drivers/net/phy/mediatek-2p5ge.c index e2e06d1eca..d1d01190ed 100644 --- a/target/linux/mediatek/files-6.6/drivers/net/phy/mediatek-2p5ge.c +++ b/target/linux/mediatek/files-6.6/drivers/net/phy/mediatek-2p5ge.c @@ -137,6 +137,11 @@ static int mt7988_2p5ge_phy_config_init(struct phy_device *phydev) } /* Setup LED */ + + /* Set polarity of led0 to active-high for BPI-R4 */ + phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, + MTK_PHY_LED0_POLARITY); + phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MTK_PHY_LED0_ON_CTRL, MTK_PHY_LED0_ON_LINK10 | MTK_PHY_LED0_ON_LINK100 | 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 7f75de8b3b..b5a2554671 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 @@ -20,7 +20,8 @@ bananapi,bpi-r3-mini) ucidef_set_led_netdev "wlan2g" "WLAN2G" "blue:wlan-1" "phy0-ap0" ucidef_set_led_netdev "wlan5g" "WLAN5G" "blue:wlan-2" "phy1-ap0" ;; -bananapi,bpi-r4) +bananapi,bpi-r4|\ +bananapi,bpi-r4-poe) ucidef_set_led_netdev "wan" "wan" "mt7530-0:00:green:lan" "wan" "link tx rx" ucidef_set_led_netdev "lan1" "lan1" "mt7530-0:01:green:lan" "lan1" "link tx rx" ucidef_set_led_netdev "lan2" "lan2" "mt7530-0:02:green:lan" "lan2" "link tx rx" 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 c9fd8d96e6..a161a86462 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 @@ -41,7 +41,8 @@ mediatek_setup_interfaces() edgecore,eap111) ucidef_set_interfaces_lan_wan eth0 eth1 ;; - bananapi,bpi-r4) + bananapi,bpi-r4|\ + bananapi,bpi-r4-poe) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 eth1" "wan eth2" ;; cmcc,rax3000m|\ diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac index 62860390eb..0c5f66c029 100644 --- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac +++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac @@ -42,7 +42,8 @@ case "$board" in [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress ;; - bananapi,bpi-r4) + bananapi,bpi-r4|\ + bananapi,bpi-r4-poe) addr=$(cat /sys/class/net/eth0/address) [ "$PHYNBR" = "0" ] && macaddr_add $addr 2 > /sys${DEVPATH}/macaddress [ "$PHYNBR" = "1" ] && macaddr_add $addr 3 > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh index ee0e8b62d7..ff791a600a 100755 --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh @@ -83,6 +83,7 @@ platform_do_upgrade() { bananapi,bpi-r3|\ bananapi,bpi-r3-mini|\ bananapi,bpi-r4|\ + bananapi,bpi-r4-poe|\ jdcloud,re-cp-03|\ tplink,tl-xdr4288|\ tplink,tl-xdr6086|\ @@ -196,6 +197,7 @@ platform_check_image() { case "$board" in bananapi,bpi-r3|\ bananapi,bpi-r4|\ + bananapi,bpi-r4-poe|\ cmcc,rax3000m) [ "$magic" != "d00dfeed" ] && { echo "Invalid image type." @@ -223,7 +225,8 @@ platform_copy_config() { ;; bananapi,bpi-r3|\ bananapi,bpi-r3-mini|\ - bananapi,bpi-r4) + bananapi,bpi-r4|\ + bananapi,bpi-r4-poe) case "$(fitblk_get_bootdev)" in mmcblk*) emmc_copy_config diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f99a73ac74..13426f4f3a 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -318,11 +318,8 @@ endif endef TARGET_DEVICES += bananapi_bpi-r3-mini -define Device/bananapi_bpi-r4 +define Device/bananapi_bpi-r4-common DEVICE_VENDOR := Bananapi - DEVICE_MODEL := BPi-R4 - DEVICE_DTS := mt7988a-bananapi-bpi-r4 - DEVICE_DTS_CONFIG := config-mt7988a-bananapi-bpi-r4 DEVICE_DTS_DIR := $(DTS_DIR)/ DEVICE_DTS_LOADADDR := 0x45f00000 DEVICE_DTS_OVERLAY:= mt7988a-bananapi-bpi-r4-emmc mt7988a-bananapi-bpi-r4-rtc mt7988a-bananapi-bpi-r4-sd mt7988a-bananapi-bpi-r4-wifi-mt7996a @@ -337,19 +334,19 @@ define Device/bananapi_bpi-r4 sdcard.img.gz \ snand-preloader.bin snand-bl31-uboot.fip ARTIFACT/emmc-preloader.bin := mt7988-bl2 emmc-comb - ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot bananapi_bpi-r4-emmc + ARTIFACT/emmc-bl31-uboot.fip := mt7988-bl31-uboot $$(DEVICE_NAME)-emmc ARTIFACT/snand-preloader.bin := mt7988-bl2 spim-nand-ubi-comb - ARTIFACT/snand-bl31-uboot.fip := mt7988-bl31-uboot bananapi_bpi-r4-snand + ARTIFACT/snand-bl31-uboot.fip := mt7988-bl31-uboot $$(DEVICE_NAME)-snand ARTIFACT/sdcard.img.gz := mt798x-gpt sdmmc |\ pad-to 17k | mt7988-bl2 sdmmc-comb |\ - pad-to 6656k | mt7988-bl31-uboot bananapi_bpi-r4-sdmmc |\ + pad-to 6656k | mt7988-bl31-uboot $$(DEVICE_NAME)-sdmmc |\ $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\ pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\ ) \ pad-to 44M | mt7988-bl2 spim-nand-ubi-comb |\ - pad-to 45M | mt7988-bl31-uboot bananapi_bpi-r4-snand |\ + pad-to 45M | mt7988-bl31-uboot $$(DEVICE_NAME)-snand |\ pad-to 51M | mt7988-bl2 emmc-comb |\ - pad-to 52M | mt7988-bl31-uboot bananapi_bpi-r4-emmc |\ + pad-to 52M | mt7988-bl31-uboot $$(DEVICE_NAME)-emmc |\ pad-to 56M | mt798x-gpt emmc |\ $(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\ pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\ @@ -361,8 +358,24 @@ define Device/bananapi_bpi-r4 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-with-rootfs | pad-rootfs | append-metadata endef + +define Device/bananapi_bpi-r4 + DEVICE_MODEL := BPi-R4 + DEVICE_DTS := mt7988a-bananapi-bpi-r4 + DEVICE_DTS_CONFIG := config-mt7988a-bananapi-bpi-r4 + $(call Device/bananapi_bpi-r4-common) +endef TARGET_DEVICES += bananapi_bpi-r4 +define Device/bananapi_bpi-r4-poe + DEVICE_MODEL := BPi-R4 2.5GE + DEVICE_DTS := mt7988a-bananapi-bpi-r4-poe + DEVICE_DTS_CONFIG := config-mt7988a-bananapi-bpi-r4-poe + $(call Device/bananapi_bpi-r4-common) + DEVICE_PACKAGES += mt7988-2p5g-phy-firmware +endef +TARGET_DEVICES += bananapi_bpi-r4-poe + define Device/cetron_ct3003 DEVICE_VENDOR := Cetron DEVICE_MODEL := CT3003