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 <ms@dev.tdt.de>
This commit is contained in:
Martin Schiller 2024-04-30 10:50:51 +02:00
parent 14955dcb7e
commit fa804f7d0e
7 changed files with 62 additions and 13 deletions

View File

@ -0,0 +1,25 @@
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
/*
* Copyright (C) 2022 MediaTek Inc.
* Author: Sam.Shih <sam.shih@mediatek.com>
*/
#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>;
};

View File

@ -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 |

View File

@ -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"

View File

@ -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|\

View File

@ -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

View File

@ -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

View File

@ -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