2 * Copyright 2018-2019 NXP
4 * SPDX-License-Identifier: GPL-2.0+
15 #include <asm/mach-imx/iomux-v3.h>
16 #include <asm/arch/clock.h>
17 #include <asm/arch/imx8mn_pins.h>
18 #include <asm/arch/sys_proto.h>
19 #include <asm/mach-imx/boot_mode.h>
20 #include <asm/arch/ddr.h>
22 #include <dm/uclass.h>
23 #include <dm/device.h>
24 #include <dm/uclass-internal.h>
25 #include <dm/device-internal.h>
27 DECLARE_GLOBAL_DATA_PTR;
29 int spl_board_boot_device(enum boot_device boot_dev_spl)
31 return BOOT_DEVICE_BOOTROM;
34 void spl_dram_init(void)
36 ddr_init(&dram_timing);
39 void spl_board_init(void)
44 puts("Normal Boot\n");
46 ret = uclass_get_device_by_name(UCLASS_CLK,
47 "clock-controller@30380000",
50 printf("Failed to find clock node. Check device tree\n");
53 #ifdef CONFIG_SPL_LOAD_FIT
54 int board_fit_config_name_match(const char *name)
56 /* Just empty function now - can't decide what to choose */
57 debug("%s: %s\n", __func__, name);
63 #define UART_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_FSEL1)
64 #define WDOG_PAD_CTRL (PAD_CTL_DSE6 | PAD_CTL_ODE | PAD_CTL_PUE | PAD_CTL_PE)
66 static iomux_v3_cfg_t const uart_pads[] = {
67 IMX8MN_PAD_UART2_RXD__UART2_DCE_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
68 IMX8MN_PAD_UART2_TXD__UART2_DCE_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
71 static iomux_v3_cfg_t const wdog_pads[] = {
72 IMX8MN_PAD_GPIO1_IO02__WDOG1_WDOG_B | MUX_PAD_CTRL(WDOG_PAD_CTRL),
75 int board_early_init_f(void)
77 struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
79 imx_iomux_v3_setup_multiple_pads(wdog_pads, ARRAY_SIZE(wdog_pads));
83 imx_iomux_v3_setup_multiple_pads(uart_pads, ARRAY_SIZE(uart_pads));
90 void board_init_f(ulong dummy)
102 preloader_console_init();
105 memset(__bss_start, 0, __bss_end - __bss_start);
109 debug("spl_init() failed: %d\n", ret);
115 /* DDR initialization */
118 board_init_r(NULL, 0);