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/psu_init_gpl.h>
17 #include <asm/arch/sys_proto.h>
19 void board_init_f(ulong dummy)
24 #ifdef CONFIG_DEBUG_UART
25 /* Uart debug for sure */
27 puts("Debug uart enabled\n"); /* or printch() */
29 /* Delay is required for clocks to be propagated */
33 static void ps_mode_reset(ulong mode)
35 writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
36 &crlapb_base->boot_pin_ctrl);
38 writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT |
39 mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
40 &crlapb_base->boot_pin_ctrl);
44 * Set default PS_MODE1 which is used for USB ULPI phy reset
45 * Also other resets can be connected to this certain pin
48 # define MODE_RESET PS_MODE1
51 #ifdef CONFIG_SPL_BOARD_INIT
52 void spl_board_init(void)
54 preloader_console_init();
55 ps_mode_reset(MODE_RESET);
57 psu_post_config_data();
61 void board_boot_order(u32 *spl_boot_list)
63 spl_boot_list[0] = spl_boot_device();
65 if (spl_boot_list[0] == BOOT_DEVICE_MMC1)
66 spl_boot_list[1] = BOOT_DEVICE_MMC2;
67 if (spl_boot_list[0] == BOOT_DEVICE_MMC2)
68 spl_boot_list[1] = BOOT_DEVICE_MMC1;
71 u32 spl_boot_device(void)
76 #if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
77 /* Change default boot mode at run-time */
78 writel(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT,
79 &crlapb_base->boot_mode);
82 reg = readl(&crlapb_base->boot_mode);
83 if (reg >> BOOT_MODE_ALT_SHIFT)
84 reg >>= BOOT_MODE_ALT_SHIFT;
86 bootmode = reg & BOOT_MODES_MASK;
90 return BOOT_DEVICE_RAM;
91 #ifdef CONFIG_SPL_MMC_SUPPORT
93 case SD1_LSHFT_MODE: /* not working on silicon v1 */
94 return BOOT_DEVICE_MMC2;
97 return BOOT_DEVICE_MMC1;
101 return BOOT_DEVICE_DFU;
103 #ifdef CONFIG_SPL_SATA_SUPPORT
105 return BOOT_DEVICE_SATA;
107 #ifdef CONFIG_SPL_SPI_SUPPORT
108 case QSPI_MODE_24BIT:
109 case QSPI_MODE_32BIT:
110 return BOOT_DEVICE_SPI;
113 printf("Invalid Boot Mode:0x%x\n", bootmode);
120 #ifdef CONFIG_SPL_OS_BOOT
121 int spl_start_uboot(void)
129 #ifdef CONFIG_SPL_LOAD_FIT
130 int board_fit_config_name_match(const char *name)
132 /* Just empty function now - can't decide what to choose */
133 debug("%s: %s\n", __func__, name);