From: Peng Fan (OSS) Date: Mon, 12 Apr 2021 20:12:59 +0800 Subject: [PATCH 30/37] arm: imx8ulp: Probe the S400 MU device in arch init In-Reply-To: <20210412121306.11484-1-peng.fan@oss.nxp.com> References: <20210412121306.11484-1-peng.fan@oss.nxp.com> Message-ID: <20210412121306.11484-31-peng.fan@oss.nxp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Ye Li Need probe the S400 MU device in arch_cpu_init_dm, so we can use S400 API in u-boot Signed-off-by: Ye Li Signed-off-by: Peng Fan --- arch/arm/mach-imx/imx8ulp/soc.c | 35 ++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/imx8ulp/soc.c b/arch/arm/mach-imx/imx8ulp/soc.c index a8791f4612..527a4e17d8 100644 --- a/arch/arm/mach-imx/imx8ulp/soc.c +++ b/arch/arm/mach-imx/imx8ulp/soc.c @@ -15,6 +15,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -318,7 +324,18 @@ int dram_init(void) #ifdef CONFIG_SERIAL_TAG void get_board_serial(struct tag_serialnr *serialnr) { - /* TODO */ + u32 uid[4]; + u32 res; + int ret; + + ret = ahab_read_common_fuse(1, uid, 4, &res); + if (ret) + printf("ahab read fuse failed %d, 0x%x\n", ret, res); + else + printf("UID 0x%x,0x%x,0x%x,0x%x\n", uid[0], uid[1], uid[2], uid[3]); + + serialnr->low = uid[0]; + serialnr->high = uid[3]; } #endif @@ -543,6 +560,22 @@ int arch_cpu_init(void) return 0; } +int arch_cpu_init_dm(void) +{ + struct udevice *devp; + int node, ret; + + node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "fsl,imx8ulp-mu"); + + ret = uclass_get_device_by_of_offset(UCLASS_MISC, node, &devp); + if (ret) { + printf("could not get S400 mu %d\n", ret); + return ret; + } + + return 0; +} + #if defined(CONFIG_SPL_BUILD) __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) { -- 2.30.0