]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - board/freescale/imx8mn_evk/spl.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2018-2019, 2021 NXP
15 #include <asm/global_data.h>
17 #include <asm/mach-imx/iomux-v3.h>
18 #include <asm/arch/clock.h>
19 #include <asm/arch/imx8mn_pins.h>
20 #include <asm/arch/sys_proto.h>
21 #include <asm/mach-imx/boot_mode.h>
22 #include <asm/arch/ddr.h>
24 #include <dm/uclass.h>
25 #include <dm/device.h>
26 #include <dm/uclass-internal.h>
27 #include <dm/device-internal.h>
28 #include <power/pmic.h>
29 #include <power/pca9450.h>
30 #include <asm/mach-imx/gpio.h>
31 #include <asm/mach-imx/mxc_i2c.h>
32 #include <fsl_esdhc_imx.h>
35 DECLARE_GLOBAL_DATA_PTR
;
37 int spl_board_boot_device(enum boot_device boot_dev_spl
)
39 return BOOT_DEVICE_BOOTROM
;
42 void spl_dram_init(void)
44 ddr_init(&dram_timing
);
47 void spl_board_init(void)
52 if (IS_ENABLED(CONFIG_FSL_CAAM
)) {
53 ret
= uclass_get_device_by_driver(UCLASS_MISC
, DM_DRIVER_GET(caam_jr
), &dev
);
55 printf("Failed to initialize caam_jr: %d\n", ret
);
57 puts("Normal Boot\n");
59 ret
= uclass_get_device_by_name(UCLASS_CLK
,
60 "clock-controller@30380000",
63 printf("Failed to find clock node. Check device tree\n");
66 #if CONFIG_IS_ENABLED(DM_PMIC_PCA9450)
67 int power_init_board(void)
72 ret
= pmic_get("pca9450@25", &dev
);
74 puts("No pca9450@25\n");
80 /* BUCKxOUT_DVS0/1 control BUCK123 output */
81 pmic_reg_write(dev
, PCA9450_BUCK123_DVS
, 0x29);
83 #ifdef CONFIG_IMX8MN_LOW_DRIVE_MODE
84 /* Set VDD_SOC/VDD_DRAM to 0.8v for low drive mode */
85 pmic_reg_write(dev
, PCA9450_BUCK1OUT_DVS0
, 0x10);
87 /* increase VDD_SOC/VDD_DRAM to typical value 0.95V before first DRAM access */
88 pmic_reg_write(dev
, PCA9450_BUCK1OUT_DVS0
, 0x1C);
90 /* Set DVS1 to 0.85v for suspend */
91 /* Enable DVS control through PMIC_STBY_REQ and set B1_ENMODE=1 (ON by PMIC_ON_REQ=H) */
92 pmic_reg_write(dev
, PCA9450_BUCK1OUT_DVS1
, 0x14);
93 pmic_reg_write(dev
, PCA9450_BUCK1CTRL
, 0x59);
95 /* set VDD_SNVS_0V8 from default 0.85V */
96 pmic_reg_write(dev
, PCA9450_LDO2CTRL
, 0xC0);
98 /* enable LDO4 to 1.2v */
99 pmic_reg_write(dev
, PCA9450_LDO4CTRL
, 0x44);
101 /* set WDOG_B_CFG to cold reset */
102 pmic_reg_write(dev
, PCA9450_RESET_CTRL
, 0xA1);
108 #ifdef CONFIG_SPL_LOAD_FIT
109 int board_fit_config_name_match(const char *name
)
111 /* Just empty function now - can't decide what to choose */
112 debug("%s: %s\n", __func__
, name
);
118 void board_init_f(ulong dummy
)
129 memset(__bss_start
, 0, __bss_end
- __bss_start
);
133 debug("spl_init() failed: %d\n", ret
);
137 preloader_console_init();
141 /* DDR initialization */
144 board_init_r(NULL
, 0);