1 // SPDX-License-Identifier: GPL-2.0+
9 #include <dm/device-internal.h>
11 #include <dm/uclass.h>
13 #include <asm/arch/sci/sci.h>
14 #include <asm/arch/sys_proto.h>
15 #include <asm/arch-imx/cpu.h>
16 #include <asm/armv8/cpu.h>
17 #include <asm/mach-imx/boot_mode.h>
19 DECLARE_GLOBAL_DATA_PTR;
26 ret = sc_misc_get_control(-1, SC_R_SYSTEM, SC_C_ID, &id);
30 rev = (id >> 5) & 0xf;
31 id = (id & 0x1f) + MXC_SOC_IMX8; /* Dummy ID for chip */
33 return (id << 12) | rev;
36 #ifdef CONFIG_DISPLAY_CPUINFO
37 const char *get_imx8_type(u32 imxtype)
47 const char *get_imx8_rev(u32 rev)
59 const char *get_core_name(void)
67 int print_cpuinfo(void)
73 ret = uclass_get_device(UCLASS_CPU, 0, &dev);
77 ret = clk_get_by_index(dev, 0, &cpu_clk);
79 dev_err(dev, "failed to clk\n");
85 cpurev = get_cpu_rev();
87 printf("CPU: Freescale i.MX%s rev%s %s at %ld MHz\n",
88 get_imx8_type((cpurev & 0xFF000) >> 12),
89 get_imx8_rev((cpurev & 0xFFF)),
91 clk_get_rate(&cpu_clk) / 1000000);
97 int print_bootinfo(void)
99 enum boot_device bt_dev = get_boot_device();
134 printf("Unknown device %u\n", bt_dev);
141 enum boot_device get_boot_device(void)
143 enum boot_device boot_dev = SD1_BOOT;
147 sc_misc_get_boot_dev(-1, &dev_rsrc);
151 boot_dev = MMC1_BOOT;
160 boot_dev = NAND_BOOT;
163 boot_dev = FLEXSPI_BOOT;
166 boot_dev = SATA_BOOT;
180 #ifdef CONFIG_ENV_IS_IN_MMC
181 __weak int board_mmc_get_env_dev(int devno)
183 return CONFIG_SYS_MMC_ENV_DEV;
186 int mmc_get_env_dev(void)
191 sc_misc_get_boot_dev(-1, &dev_rsrc);
204 /* If not boot from sd/mmc, use default value */
205 return CONFIG_SYS_MMC_ENV_DEV;
208 return board_mmc_get_env_dev(devno);