[PATCH 1/1] board: mt5824: Add initial support for Metanoia MT5824 EVB

Jun Chang jun.chang at metanoia-comm.com
Wed Dec 31 07:32:45 CET 2025


On 12/30/2025 11:31 PM, Tom Rini wrote:
> On Tue, Dec 30, 2025 at 11:03:28AM +0800, Jun Chang wrote:
> 
>> - Add RISC-V target for MT5824
>> - Add board defconfig and DTS for MT5824 EVB
>> - Add SPL and U-Boot board support for MT5824 EVB
>> - Add DDR init for MT5824 EVB
>>
>> Signed-off-by: Jun Chang <jun.chang at metanoia-comm.com>
>> ---
>>  arch/riscv/Kconfig                    |   4 +
>>  arch/riscv/dts/mt5824-evb.dts         | 232 +++++++++++++++++
> 
> What is the status on upstreaming this device tree?

The device tree is able to boot to U-Boot with shell prompt by the JTAG.

> 
> [snip]
>> diff --git a/board/metanoia/mt5824/lpddr4.h b/board/metanoia/mt5824/lpddr4.h
>> new file mode 100644
>> index 00000000000..5de70c536ca
>> --- /dev/null
>> +++ b/board/metanoia/mt5824/lpddr4.h
>> @@ -0,0 +1,91 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright (C) 2025 Metanoia Communications Inc.,
>> + * Jun Chang, Metanoia Communications Inc. <jun.chang at metanoia-comm.com>
>> + */
>> +
>> +#ifndef __COBRA_DDR_H
>> +#define __COBRA_DDR_H
>> +
>> +#include <asm/io.h>
>> +
>> +#define UMCTL2_REGS_BASE_ADDR 0x10060000
>> +
>> +#define reg8_write(addr, data) \
>> +	writeb((uint8_t)(data), (volatile void __iomem *)(addr))
>> +#define reg16_write(addr, data) \
>> +	writew((uint16_t)(data), (volatile void __iomem *)(addr))
>> +#define reg32_write(addr, data) \
>> +	writel((uint32_t)(data), (volatile void __iomem *)(addr))
> 
> We really don't already have an appropriate macro here to use?

I'll change the macro to the static inline function like arch/arm/include/asm/arch-imx8m/ddr.h does.

> 
> [snip]
>> +#endif /* __COBRA_DDR_H */
>> \ No newline at end of file
> 
> Please fix that globally.

Got it.

> 
>> diff --git a/board/metanoia/mt5824/lpddr4_helper.c b/board/metanoia/mt5824/lpddr4_helper.c
>> new file mode 100644
>> index 00000000000..3bc447038dc
>> --- /dev/null
>> +++ b/board/metanoia/mt5824/lpddr4_helper.c
> [snip]
>> +#if 0 /* Enable for debugging */
>> +		if (i < 10) {
>> +			printf("  [%02d] 0x%08x = 0x%08x\n", i, reg_addr, reg_value);
>> +		}
>> +#endif
> 
> Just use debug() here? And remove other "if 0" or commented out code
> globally.

I'll remove them.

> 
> [snip]
>> diff --git a/board/metanoia/mt5824/mt5824.c b/board/metanoia/mt5824/mt5824.c
>> new file mode 100644
>> index 00000000000..f385de1d897
>> --- /dev/null
>> +++ b/board/metanoia/mt5824/mt5824.c
>> @@ -0,0 +1,188 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright (C) 2025 Metanoia Communications Inc.,
>> + * Jun Chang, Metanoia Communications Inc. <jun.chang at metanoia-comm.com>
>> + */
>> +
>> +#include <log.h>
>> +#include <asm/csr.h>
>> +#include <asm/sbi.h>
>> +#include <config.h>
>> +#include <cpu_func.h>
>> +#include <image.h>
>> +#include <init.h>
>> +#include <net.h>
>> +#include <asm/global_data.h>
>> +#include <linux/io.h>
>> +#include <fdtdec.h>
>> +#include <dm.h>
>> +#include <hang.h>
>> +#include <misc.h>
>> +#include <hexdump.h>
>> +#include <env_internal.h>
>> +#include <linux/delay.h>
>> +#include <asm/io.h>
> 
> Globally, please audit your include list.

I'll remove the unnecessary inlcudes for my patch.

> 
> [snip]
>> diff --git a/configs/mt5824_evb_defconfig b/configs/mt5824_evb_defconfig
>> new file mode 100644
>> index 00000000000..74f6ceb2284
>> --- /dev/null
>> +++ b/configs/mt5824_evb_defconfig
>> @@ -0,0 +1,61 @@
>> +CONFIG_RISCV=y
>> +CONFIG_RISCV_ANDES=y
>> +CONFIG_ARCH_RV64I=y
>> +CONFIG_RISCV_SMODE=y
>> +
> 
> Please re-generate this with "make savedefconfig".

Thanks for the command. I'll re-generate the defconfig.

> 
> [snip]
>> diff --git a/include/configs/mt5824.h b/include/configs/mt5824.h
>> new file mode 100644
>> index 00000000000..9809080b805
>> --- /dev/null
>> +++ b/include/configs/mt5824.h
> [snip]
>> +/* environments */
>> +
>> +/* SPI FLASH */
>> +
>> +/*
>> + * For booting Linux, the board info and command line data
>> + * have to be in the first 16 MB of memory, since this is
>> + * the maximum mapped by the Linux kernel during initialization.
>> + */
>> +
>> +/* Initial Memory map for Linux*/
>> +#define CFG_SYS_BOOTMAPSZ	(64 << 20)
>> +/* Increase max gunzip size */
>> +
>> +/* Support autoboot from RAM (kernel image is loaded via debug port) */
>> +#define BOOTENV_DEV_NAME_RAM(devtypeu, devtypel, instance) \
>> +	"ram "
>> +
>> +#define BOOTENV_DEV_RAM(devtypeu, devtypel, instance) \
>> +	"bootcmd_ram=" \
>> +	"bootm ${fit_addr}\0"
>> +
>> +#define BOOTENV_DEV_LEGACY_MMC(devtypeu, devtypel, instance) \
>> +	"bootcmd_" #devtypel #instance "=" \
>> +	"setenv mmcdev " #instance"; "\
>> +	"setenv bootpart " #instance":2 ; "\
>> +	"run mmcboot\0"
>> +
>> +#define BOOTENV_DEV_NAME_LEGACY_MMC(devtypeu, devtypel, instance) \
>> +	#devtypel #instance " "
>> +
>> +#define BOOTENV_DEV_NAME_TFTP(devtypeu, devtypel, instance) \
>> +	#devtypel " "
>> +
>> +#define BOOTENV_DEV_TFTP(devtypeu, devtypel, instance) \
>> +	"bootcmd_" #devtypel "=" \
>> +	"tftpboot ${fit_addr} $serverip:fitImage-dev-image-initramfs; " \
>> +	"bootm ${fit_addr}\0"
>> +
>> +/* Enable distro boot */
>> +#define BOOT_TARGET_DEVICES(func) \
>> +	func(TFTP, tftp, na) \
>> +	func(RAM, ram, na)
>> +
>> +#include <config_distro_bootcmd.h>
>> +
>> +#define CFG_EXTRA_ENV_SETTINGS	\
>> +	"bootcmd=bootm 90000000\0" \
>> +	"kernel_addr_r=82000000\0" \
>> +	"pxefile_addr_r=0x83f00000\0" \
>> +	"scriptaddr=0x83f00000\0" \
>> +	"fdt_addr_r=0x68010000\0" \
>> +	"ramdisk_addr_r=0x83000000\0" \
>> +	"fit_addr=0x83000000\0" \
>> +	"initrd_high=0x100000000\0" \
>> +	BOOTENV
> 
> Please switch to plain text environment and consider standard boot,
> thanks.
> 

I'll clean up the config include to remove env settings and support the NOR flash boot.



More information about the U-Boot mailing list