Skip to content

Commit 08aaf07

Browse files
committed
mediatek: add support for BananaPi BPI-R4 board
Hardware -------- SOC: MediaTek MT7988A (4x Cortex-A73) RAM: 4 GiB DDR4 Flash: 128 MiB Winbond SPI-NAND MMC: 8 GiB eMMC *or* microSD (cannot be used both) ETH: 4x 1GE (1x WAN, 3x LAN) 2x SFP+ (10G, 5G, 2.5G, 1G) USB: on-board USB 3.2 4-port hub 1x USB 3.2 port (type A connector) 1x M.2 for 4G/5G modem 2x mPCIe for additional modems WiFi: optional MediaTek MT7996 Wi-Fi 7 module (using 2x PCIe gen3 x2 on the mPCIe slots and 12V power) Installation ------------ 1. Decompress and write the sdcard image to a micro SD card and use that to boot the R4 (both dip switches in upper position). 2. Use the bootloader menu accessible via the serial console to install to SPI-NAND. 3. Switch to boot from SPI-NAND and install to eMMC. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
1 parent 21ab9a9 commit 08aaf07

15 files changed

Lines changed: 767 additions & 15 deletions

File tree

package/boot/uboot-envtools/files/mediatek_filogic

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ touch /etc/config/ubootenv
1212
board=$(board_name)
1313

1414
case "$board" in
15-
bananapi,bpi-r3)
15+
bananapi,bpi-r3|\
16+
bananapi,bpi-r4|\
17+
bananapi,bpi-r4-poe)
1618
case "$(cmdline_get_var root)" in
1719
/dev/mmc*)
1820
local envdev=$(find_mmc_part "ubootenv" $rootdev)

target/linux/mediatek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ unielec,u7623-02)
99
[ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] &&
1010
fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
1111
;;
12-
bananapi,bpi-r3)
12+
bananapi,bpi-r3|\
13+
bananapi,bpi-r4|\
14+
bananapi,bpi-r4-poe)
1315
[ -z "$(fw_printenv -n ethaddr 2>/dev/null)" ] &&
1416
fw_setenv ethaddr "$(cat /sys/class/net/eth0/address)"
1517
[ -z "$(fw_printenv -n eth1addr 2>/dev/null)" ] &&
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
/*
3+
* Copyright (C) 2021 MediaTek Inc.
4+
* Author: Frank Wunderlich <frank-w@public-files.de>
5+
*/
6+
7+
/dts-v1/;
8+
/plugin/;
9+
10+
/ {
11+
compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
12+
13+
fragment@0 {
14+
target-path = "/soc/mmc@11230000";
15+
__overlay__ {
16+
pinctrl-names = "default", "state_uhs";
17+
pinctrl-0 = <&mmc0_pins_emmc_51>;
18+
pinctrl-1 = <&mmc0_pins_emmc_51>;
19+
bus-width = <8>;
20+
max-frequency = <200000000>;
21+
cap-mmc-highspeed;
22+
mmc-hs200-1_8v;
23+
mmc-hs400-1_8v;
24+
hs400-ds-delay = <0x12814>;
25+
vqmmc-supply = <&reg_1p8v>;
26+
vmmc-supply = <&reg_3p3v>;
27+
non-removable;
28+
no-sd;
29+
no-sdio;
30+
status = "okay";
31+
#address-cells = <1>;
32+
#size-cells = <0>;
33+
34+
card@0 {
35+
compatible = "mmc-card";
36+
reg = <0>;
37+
38+
block {
39+
compatible = "block-device";
40+
partitions {
41+
block-partition-env {
42+
partname = "ubootenv";
43+
nvmem-layout {
44+
compatible = "u-boot,env-layout";
45+
};
46+
};
47+
emmc_rootfs: block-partition-production {
48+
partname = "production";
49+
};
50+
};
51+
};
52+
};
53+
};
54+
};
55+
56+
fragment@2 {
57+
target-path = "/chosen";
58+
__overlay__ {
59+
rootdisk-emmc = <&emmc_rootfs>;
60+
};
61+
};
62+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
/*
3+
* Copyright (C) 2022 MediaTek Inc.
4+
* Author: Sam.Shih <sam.shih@mediatek.com>
5+
*/
6+
7+
#include "mt7988a-bananapi-bpi-r4.dts"
8+
9+
/ {
10+
model = "Bananapi BPI-R4 2.5GE PoE";
11+
compatible = "bananapi,bpi-r4-poe",
12+
"mediatek,mt7988a";
13+
};
14+
15+
&gmac1 {
16+
phy-mode = "internal";
17+
phy-connection-type = "internal";
18+
phy = <&int_2p5g_phy>;
19+
status = "okay";
20+
};
21+
22+
&int_2p5g_phy {
23+
pinctrl-names = "i2p5gbe-led";
24+
pinctrl-0 = <&i2p5gbe_led0_pins>;
25+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
/*
3+
* Copyright (C) 2023
4+
* Author: Daniel Golle <daniel@makrotopia.org>
5+
*/
6+
7+
/dts-v1/;
8+
/plugin/;
9+
10+
/ {
11+
compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
12+
13+
fragment@0 {
14+
target = <&pcf8563>;
15+
__overlay__ {
16+
status = "okay";
17+
};
18+
};
19+
};
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
/*
3+
* Copyright (C) 2023 MediaTek Inc.
4+
* Author: Frank Wunderlich <frank-w@public-files.de>
5+
*/
6+
7+
/dts-v1/;
8+
/plugin/;
9+
10+
#include <dt-bindings/gpio/gpio.h>
11+
12+
/ {
13+
compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
14+
15+
fragment@1 {
16+
target-path = "/soc/mmc@11230000";
17+
__overlay__ {
18+
pinctrl-names = "default", "state_uhs";
19+
pinctrl-0 = <&mmc0_pins_sdcard>;
20+
pinctrl-1 = <&mmc0_pins_sdcard>;
21+
cd-gpios = <&pio 12 GPIO_ACTIVE_LOW>;
22+
bus-width = <4>;
23+
max-frequency = <52000000>;
24+
cap-sd-highspeed;
25+
vmmc-supply = <&reg_3p3v>;
26+
vqmmc-supply = <&reg_3p3v>;
27+
no-mmc;
28+
status = "okay";
29+
#address-cells = <1>;
30+
#size-cells = <0>;
31+
32+
card@0 {
33+
compatible = "mmc-card";
34+
reg = <0>;
35+
36+
block {
37+
compatible = "block-device";
38+
partitions {
39+
block-partition-env {
40+
partname = "ubootenv";
41+
nvmem-layout {
42+
compatible = "u-boot,env-layout";
43+
};
44+
};
45+
sd_rootfs: block-partition-production {
46+
partname = "production";
47+
};
48+
};
49+
};
50+
};
51+
};
52+
};
53+
54+
fragment@2 {
55+
target-path = "/chosen";
56+
__overlay__ {
57+
rootdisk-sd = <&sd_rootfs>;
58+
};
59+
};
60+
};
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2+
/dts-v1/;
3+
/plugin/;
4+
5+
#include <dt-bindings/gpio/gpio.h>
6+
7+
/ {
8+
compatible = "bananapi,bpi-r4", "mediatek,mt7988a";
9+
10+
fragment@0 {
11+
target-path = "/";
12+
__overlay__ {
13+
wifi_12v: regulator-wifi-12v {
14+
compatible = "regulator-fixed";
15+
regulator-name = "wifi";
16+
regulator-min-microvolt = <12000000>;
17+
regulator-max-microvolt = <12000000>;
18+
gpio = <&pio 4 GPIO_ACTIVE_HIGH>;
19+
enable-active-high;
20+
regulator-always-on;
21+
};
22+
};
23+
};
24+
25+
fragment@1 {
26+
target = <&i2c_wifi>;
27+
__overlay__ {
28+
// 5G WIFI MAC Address EEPROM
29+
wifi_eeprom@51 {
30+
compatible = "atmel,24c02";
31+
reg = <0x51>;
32+
address-bits = <8>;
33+
page-size = <8>;
34+
size = <256>;
35+
36+
nvmem-layout {
37+
compatible = "fixed-layout";
38+
#address-cells = <1>;
39+
#size-cells = <1>;
40+
41+
macaddr_5g: macaddr@0 {
42+
reg = <0x0 0x6>;
43+
};
44+
};
45+
};
46+
47+
// 6G WIFI MAC Address EEPROM
48+
wifi_eeprom@52 {
49+
compatible = "atmel,24c02";
50+
reg = <0x52>;
51+
address-bits = <8>;
52+
page-size = <8>;
53+
size = <256>;
54+
55+
nvmem-layout {
56+
compatible = "fixed-layout";
57+
#address-cells = <1>;
58+
#size-cells = <1>;
59+
60+
macaddr_6g: macaddr@0 {
61+
reg = <0x0 0x6>;
62+
};
63+
};
64+
};
65+
};
66+
};
67+
68+
fragment@2 {
69+
target = <&pcie0>;
70+
__overlay__ {
71+
pcie@0,0 {
72+
reg = <0x0000 0 0 0 0>;
73+
74+
wifi@0,0 {
75+
compatible = "mediatek,mt76";
76+
reg = <0x0000 0 0 0 0>;
77+
nvmem-cell-names = "mac-address";
78+
nvmem-cells = <&macaddr_5g>;
79+
};
80+
};
81+
};
82+
};
83+
84+
fragment@3 {
85+
target = <&pcie1>;
86+
__overlay__ {
87+
pcie@0,0 {
88+
reg = <0x0000 0 0 0 0>;
89+
90+
wifi@0,0 {
91+
compatible = "mediatek,mt76";
92+
reg = <0x0000 0 0 0 0>;
93+
nvmem-cell-names = "mac-address";
94+
nvmem-cells = <&macaddr_6g>;
95+
};
96+
};
97+
};
98+
};
99+
};

0 commit comments

Comments
 (0)