1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2015 - 2016 Xilinx, Inc.
5 * Michal Simek <michal.simek@xilinx.com>
13 #include <linux/delay.h>
17 #include <asm/arch/hardware.h>
18 #include <asm/arch/psu_init_gpl.h>
19 #include <asm/arch/sys_proto.h>
21 void board_init_f(ulong dummy)
27 static void ps_mode_reset(ulong mode)
29 writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
30 &crlapb_base->boot_pin_ctrl);
32 writel(mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT |
33 mode << ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT,
34 &crlapb_base->boot_pin_ctrl);
38 * Set default PS_MODE1 which is used for USB ULPI phy reset
39 * Also other resets can be connected to this certain pin
42 # define MODE_RESET PS_MODE1
45 #ifdef CONFIG_SPL_BOARD_INIT
46 void spl_board_init(void)
48 preloader_console_init();
49 ps_mode_reset(MODE_RESET);
51 psu_post_config_data();
55 void board_boot_order(u32 *spl_boot_list)
57 spl_boot_list[0] = spl_boot_device();
59 if (spl_boot_list[0] == BOOT_DEVICE_MMC1)
60 spl_boot_list[1] = BOOT_DEVICE_MMC2;
61 if (spl_boot_list[0] == BOOT_DEVICE_MMC2)
62 spl_boot_list[1] = BOOT_DEVICE_MMC1;
64 spl_boot_list[2] = BOOT_DEVICE_RAM;
67 u32 spl_boot_device(void)
72 #if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
73 /* Change default boot mode at run-time */
74 writel(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT,
75 &crlapb_base->boot_mode);
78 reg = readl(&crlapb_base->boot_mode);
79 if (reg >> BOOT_MODE_ALT_SHIFT)
80 reg >>= BOOT_MODE_ALT_SHIFT;
82 bootmode = reg & BOOT_MODES_MASK;
86 return BOOT_DEVICE_RAM;
87 #ifdef CONFIG_SPL_MMC_SUPPORT
89 case SD1_LSHFT_MODE: /* not working on silicon v1 */
90 return BOOT_DEVICE_MMC2;
93 return BOOT_DEVICE_MMC1;
97 return BOOT_DEVICE_DFU;
99 #ifdef CONFIG_SPL_SATA_SUPPORT
101 return BOOT_DEVICE_SATA;
103 #ifdef CONFIG_SPL_SPI_SUPPORT
104 case QSPI_MODE_24BIT:
105 case QSPI_MODE_32BIT:
106 return BOOT_DEVICE_SPI;
109 printf("Invalid Boot Mode:0x%x\n", bootmode);
116 #ifdef CONFIG_SPL_OS_BOOT
117 int spl_start_uboot(void)
123 #ifdef CONFIG_SPL_LOAD_FIT
124 int board_fit_config_name_match(const char *name)
126 /* Just empty function now - can't decide what to choose */
127 debug("%s: %s\n", __func__, name);