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>
14 #include <asm/arch/hardware.h>
15 #include <asm/arch/sys_proto.h>
17 void board_init_f(ulong dummy
)
22 #ifdef CONFIG_DEBUG_UART
23 /* Uart debug for sure */
25 puts("Debug uart enabled\n"); /* or printch() */
27 /* Delay is required for clocks to be propagated */
31 memset(__bss_start
, 0, __bss_end
- __bss_start
);
33 /* No need to call timer init - it is empty for ZynqMP */
34 board_init_r(NULL
, 0);
37 static void ps_mode_reset(ulong mode
)
39 writel(mode
<< ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT
,
40 &crlapb_base
->boot_pin_ctrl
);
42 writel(mode
<< ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_VAL_SHIFT
|
43 mode
<< ZYNQMP_CRL_APB_BOOT_PIN_CTRL_OUT_EN_SHIFT
,
44 &crlapb_base
->boot_pin_ctrl
);
48 * Set default PS_MODE1 which is used for USB ULPI phy reset
49 * Also other resets can be connected to this certain pin
52 # define MODE_RESET PS_MODE1
55 #ifdef CONFIG_SPL_BOARD_INIT
56 void spl_board_init(void)
58 preloader_console_init();
59 ps_mode_reset(MODE_RESET
);
64 u32
spl_boot_device(void)
69 #if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
70 /* Change default boot mode at run-time */
71 writel(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE
<< BOOT_MODE_ALT_SHIFT
,
72 &crlapb_base
->boot_mode
);
75 reg
= readl(&crlapb_base
->boot_mode
);
76 if (reg
>> BOOT_MODE_ALT_SHIFT
)
77 reg
>>= BOOT_MODE_ALT_SHIFT
;
79 bootmode
= reg
& BOOT_MODES_MASK
;
83 return BOOT_DEVICE_RAM
;
84 #ifdef CONFIG_SPL_MMC_SUPPORT
86 case SD1_LSHFT_MODE
: /* not working on silicon v1 */
87 /* if both controllers enabled, then these two are the second controller */
88 #if defined(SPL_ZYNQMP_TWO_SDHCI)
89 return BOOT_DEVICE_MMC2
;
90 /* else, fall through, the one SDHCI controller that is enabled is number 1 */
94 return BOOT_DEVICE_MMC1
;
98 return BOOT_DEVICE_DFU
;
100 #ifdef CONFIG_SPL_SATA_SUPPORT
102 return BOOT_DEVICE_SATA
;
104 #ifdef CONFIG_SPL_SPI_SUPPORT
105 case QSPI_MODE_24BIT
:
106 case QSPI_MODE_32BIT
:
107 return BOOT_DEVICE_SPI
;
110 printf("Invalid Boot Mode:0x%x\n", bootmode
);
117 #ifdef CONFIG_SPL_OS_BOOT
118 int spl_start_uboot(void)
126 #ifdef CONFIG_SPL_LOAD_FIT
127 int board_fit_config_name_match(const char *name
)
129 /* Just empty function now - can't decide what to choose */
130 debug("%s: %s\n", __func__
, name
);