Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177563508
D61539.1794739671.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
6 KB
Referenced Files
None
Subscribers
None
D61539.1794739671.diff
View Options
Index: sysutils/Makefile
===================================================================
--- sysutils/Makefile
+++ sysutils/Makefile
@@ -1541,6 +1541,7 @@
SUBDIR += u-boot-a64-olinuxino
SUBDIR += u-boot-bananapi
SUBDIR += u-boot-bananapi-r2-pro
+ SUBDIR += u-boot-bananapi-r3
SUBDIR += u-boot-bananapim2
SUBDIR += u-boot-beaglebone
SUBDIR += u-boot-bhyve-arm64
Index: sysutils/u-boot-bananapi-r3/Makefile
===================================================================
--- /dev/null
+++ sysutils/u-boot-bananapi-r3/Makefile
@@ -0,0 +1,12 @@
+MASTERDIR= ${.CURDIR}/../u-boot-master
+
+EXTRA_PATCHES= ${.CURDIR}/../u-boot-bananapi-r3/files/
+
+MODEL?= bananapi-r3
+BOARD_CONFIG?= mt7986a_bpir3_sd_defconfig
+FAMILY= mt7986
+
+CONFIG_FRAGMENT= ${.CURDIR}/../u-boot-bananapi-r3/files/bpir3_fragment
+FRAGMENT_NAME= bpir3_fragment
+
+.include "${MASTERDIR}/Makefile"
Index: sysutils/u-boot-bananapi-r3/files/bpir3_fragment
===================================================================
--- /dev/null
+++ sysutils/u-boot-bananapi-r3/files/bpir3_fragment
@@ -0,0 +1,6 @@
+CONFIG_EFI_LOADER=y
+CONFIG_AUTOBOOT=y
+CONFIG_BOOTSTD_DEFAULTS=y
+CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-bananapi-bpi-r3.dtb"
+CONFIG_ENV_MMC_USE_SW_PARTITION=y
+CONFIG_ENV_MMC_SW_PARTITION="ubootenv"
Index: sysutils/u-boot-bananapi-r3/files/patch-drivers_clk_mediatek_clk-mtk.c
===================================================================
--- /dev/null
+++ sysutils/u-boot-bananapi-r3/files/patch-drivers_clk_mediatek_clk-mtk.c
@@ -0,0 +1,112 @@
+Fix using MediaTek clocks before relocation; without it the MT7986 UART
+has no clock and U-Boot resets in a loop. Upstream, in 2027.01:
+https://git.u-boot-project.org/u-boot/u-boot/-/commit/3ffad26f17cbe32df9b37f407b8984adecd97c0c
+
+--- drivers/clk/mediatek/clk-mtk.c.orig 2026-10-05 21:35:33 UTC
++++ drivers/clk/mediatek/clk-mtk.c
+@@ -35,8 +35,6 @@
+ #define SCP_AXICK_DCM_DIS_EN BIT(0)
+ #define SCP_AXICK_26M_SEL_EN BIT(4)
+
+-static struct udevice *mtk_clk_providers[MTK_CLK_TREE_NUM_TYPES];
+-
+ static bool mtk_clk_tree_type_is_provider(enum mtk_clk_tree_type type)
+ {
+ return type != MTK_CLK_TREE_NONE && type < MTK_CLK_TREE_NUM_TYPES;
+@@ -58,44 +56,40 @@ static struct udevice *mtk_clk_tree_get_provider(enum
+
+ static struct udevice *mtk_clk_tree_get_provider(enum mtk_clk_tree_type type)
+ {
++ struct udevice *dev;
++ struct uclass *uc;
++ int ret;
++
+ if (!mtk_clk_tree_type_is_provider(type))
+ return NULL;
+
+- if (!mtk_clk_providers[type]) {
+- struct udevice *dev;
+- struct uclass *uc;
+- int ret;
++ ret = uclass_get(UCLASS_CLK, &uc);
++ if (ret)
++ return ERR_PTR(ret);
+
+- /* Lazily probe and register the requested provider. */
+- ret = uclass_get(UCLASS_CLK, &uc);
+- if (ret)
+- return ERR_PTR(ret);
++ uclass_foreach_dev(dev, uc) {
++ const struct mtk_clk_tree *tree;
++ const void *ops;
+
+- uclass_foreach_dev(dev, uc) {
+- const struct mtk_clk_tree *tree;
+- const void *ops;
++ ops = dev_get_driver_ops(dev);
++ if (ops != &mtk_clk_apmixedsys_ops &&
++ ops != &mtk_clk_fixed_pll_ops &&
++ ops != &mtk_clk_topckgen_ops &&
++ ops != &mtk_clk_infrasys_ops)
++ continue;
+
+- ops = dev_get_driver_ops(dev);
+- if (ops != &mtk_clk_apmixedsys_ops &&
+- ops != &mtk_clk_fixed_pll_ops &&
+- ops != &mtk_clk_topckgen_ops &&
+- ops != &mtk_clk_infrasys_ops)
+- continue;
++ tree = (const void *)dev_get_driver_data(dev);
++ if (tree->type != type)
++ continue;
+
+- tree = (const void *)dev_get_driver_data(dev);
+- if (tree->type != type)
+- continue;
++ ret = device_probe(dev);
++ if (ret)
++ return ERR_PTR(ret);
+
+- /* Probe will add it to mtk_clk_providers[type]. */
+- ret = device_probe(dev);
+- if (ret)
+- return ERR_PTR(ret);
+-
+- break;
+- }
++ return dev;
+ }
+
+- return mtk_clk_providers[type] ?: ERR_PTR(-ENOENT);
++ return ERR_PTR(-ENOENT);
+ }
+
+ static struct udevice *mtk_clk_parent_get_provider(u16 flags)
+@@ -103,20 +97,6 @@ static struct udevice *mtk_clk_parent_get_provider(u16
+ return mtk_clk_tree_get_provider(mtk_clk_tree_type_from_parent_flags(flags));
+ }
+
+-static int mtk_clk_tree_register_provider(struct udevice *dev,
+- const struct mtk_clk_tree *tree)
+-{
+- if (!mtk_clk_tree_type_is_provider(tree->type))
+- return 0;
+-
+- if (mtk_clk_providers[tree->type])
+- return -EEXIST;
+-
+- mtk_clk_providers[tree->type] = dev;
+-
+- return 0;
+-}
+-
+ /* shared functions */
+
+ static const int mtk_common_clk_of_xlate(struct clk *clk,
+@@ -1128,5 +1108,5 @@ int mtk_clk_probe(struct udevice *dev)
+
+ priv->tree = tree;
+
+- return mtk_clk_tree_register_provider(dev, tree);
++ return 0;
+ }
Index: sysutils/u-boot-bananapi-r3/pkg-descr
===================================================================
--- /dev/null
+++ sysutils/u-boot-bananapi-r3/pkg-descr
@@ -0,0 +1,14 @@
+U-Boot loader and related files for the Banana Pi BPI-R3, for booting
+from the SD card (SW1 set to SD boot).
+
+The boot ROM loads bl2.img from the GPT partition marked as legacy BIOS
+bootable. BL2 then loads u-boot.fip, which holds BL31 and U-Boot, from
+the GPT partition named "fip". U-Boot keeps its environment in the GPT
+partition named "ubootenv".
+
+To install this bootloader on an SD card where these partitions are
+named "bl2" and "fip" just do:
+
+cd /usr/local/share/u-boot/u-boot-bananapi-r3
+dd if=bl2.img of=/dev/gpt/bl2 bs=512 conv=sync
+dd if=u-boot.fip of=/dev/gpt/fip bs=512 conv=sync
Index: sysutils/u-boot-master/Makefile
===================================================================
--- sysutils/u-boot-master/Makefile
+++ sysutils/u-boot-master/Makefile
@@ -129,6 +129,11 @@
# Override for QEMU family
UBOOT_PLIST_QEMU= u-boot.bin
+# Override for MT7986 family
+UBOOT_PLIST_MT7986= bl2.img u-boot.fip
+UBOOT_ARCH_MT7986= aarch64
+UBOOT_MOVE_MT7986= ${MT7986_ATF}/bl2.img
+
# Uboot variables
.if !defined(UBOOT_VERSION) && defined(UBOOT_VERSION_${FAMILY:tu})
UBOOT_VERSION=${UBOOT_VERSION_${FAMILY:tu}}
@@ -225,6 +230,13 @@
ROCKCHIP_TPL=${LOCALBASE}/share/rkbin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2400MHz_v1.24.bin
.endif
+.if defined(FAMILY) && ${FAMILY} == mt7986
+MT7986_BOOT_DEVICE?= sdmmc
+MT7986_ATF= ${LOCALBASE}/share/atf-mt7986/${MT7986_BOOT_DEVICE}-ddr4
+BUILD_DEPENDS+= ${MT7986_ATF}/bl31.bin:sysutils/atf-mt7986 \
+ fiptool:sysutils/fiptool
+.endif
+
# Each u-boot family has different files to include, bring them in.
.for i in ${UBOOT_PLIST}
PLIST_FILES+= ${UBOOT_DIR}/${i}
@@ -287,6 +299,10 @@
(cd ${WRKSRC}; ${SETENV} ${CONFIGURE_ENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${i})
.endfor
.endif
+.if defined(FAMILY) && ${FAMILY} == mt7986
+ ${LOCALBASE}/bin/fiptool create --soc-fw ${MT7986_ATF}/bl31.bin \
+ --nt-fw ${WRKSRC}/u-boot.bin ${WRKSRC}/u-boot.fip
+.endif
# If we need to put anything into WRKSRC, do so now so we can build the PLIST
# in do-install
.if defined(UBOOT_MOVE)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 10:47 AM (23 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41741832
Default Alt Text
D61539.1794739671.diff (6 KB)
Attached To
Mode
D61539: sysutils/u-boot-bananapi-r3: Add new port
Attached
Detach File
Event Timeline