1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2015 - 2016 Xilinx, Inc.
5 * Michal Simek <michal.simek@xilinx.com>
9 #include <debug_uart.h>
15 #include <asm/arch/hardware.h>
16 #include <asm/arch/sys_proto.h>
18 void board_init_f(ulong dummy)
23 #ifdef CONFIG_DEBUG_UART
24 /* Uart debug for sure */
26 puts("Debug uart enabled\n"); /* or printch() */
28 /* Delay is required for clocks to be propagated */
32 static void ps_mode_reset(ulong mode)
34 writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
35 &crlapb_base->boot_pin_ctrl);
37 writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT |
38 mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
39 &crlapb_base->boot_pin_ctrl);
43 * Set default PS_MODE1 which is used for USB ULPI phy reset
44 * Also other resets can be connected to this certain pin
47 # define MODE_RESET PS_MODE1
50 #ifdef CONFIG_SPL_BOARD_INIT
51 void spl_board_init(void)
53 preloader_console_init();
54 ps_mode_reset(MODE_RESET);
59 u32 spl_boot_device(void)
64 #if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
65 /* Change default boot mode at run-time */
66 writel(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT,
67 &crlapb_base->boot_mode);
70 reg = readl(&crlapb_base->boot_mode);
71 if (reg >> BOOT_MODE_ALT_SHIFT)
72 reg >>= BOOT_MODE_ALT_SHIFT;
74 bootmode = reg & BOOT_MODES_MASK;
78 return BOOT_DEVICE_RAM;
79 #ifdef CONFIG_SPL_MMC_SUPPORT
81 case SD1_LSHFT_MODE: /* not working on silicon v1 */
82 /* if both controllers enabled, then these two are the second controller */
83 #ifdef CONFIG_SPL_ZYNQMP_TWO_SDHCI
84 return BOOT_DEVICE_MMC2;
85 /* else, fall through, the one SDHCI controller that is enabled is number 1 */
89 return BOOT_DEVICE_MMC1;
93 return BOOT_DEVICE_DFU;
95 #ifdef CONFIG_SPL_SATA_SUPPORT
97 return BOOT_DEVICE_SATA;
99 #ifdef CONFIG_SPL_SPI_SUPPORT
100 case QSPI_MODE_24BIT:
101 case QSPI_MODE_32BIT:
102 return BOOT_DEVICE_SPI;
105 printf("Invalid Boot Mode:0x%x\n", bootmode);
112 #ifdef CONFIG_SPL_OS_BOOT
113 int spl_start_uboot(void)
121 #ifdef CONFIG_SPL_LOAD_FIT
122 int board_fit_config_name_match(const char *name)
124 /* Just empty function now - can't decide what to choose */
125 debug("%s: %s\n", __func__, name);