2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com>
5 * SPDX-License-Identifier: GPL-2.0+
12 #include <asm/arch/clk.h>
13 #include <asm/arch/hardware.h>
14 #include <asm/arch/sys_proto.h>
17 #include <dwc3-uboot.h>
19 DECLARE_GLOBAL_DATA_PTR;
23 printf("EL Level:\tEL%d\n", current_el());
28 int board_early_init_r(void)
32 if (current_el() == 3) {
33 val = readl(&crlapb_base->timestamp_ref_ctrl);
34 val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT;
35 writel(val, &crlapb_base->timestamp_ref_ctrl);
37 /* Program freq register in System counter */
38 writel(zynqmp_get_system_timer_freq(),
39 &iou_scntr_secure->base_frequency_id_register);
40 /* And enable system counter */
41 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN,
42 &iou_scntr_secure->counter_control_register);
44 /* Program freq register in System counter and enable system counter */
45 writel(gd->cpu_clk, &iou_scntr->base_frequency_id_register);
46 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG |
47 ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN,
48 &iou_scntr->counter_control_register);
55 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
60 void reset_cpu(ulong addr)
64 #ifdef CONFIG_SCSI_AHCI_PLAT
67 ahci_init((void __iomem *)ZYNQMP_SATA_BASEADDR);
72 int board_late_init(void)
77 reg = readl(&crlapb_base->boot_mode);
78 bootmode = reg & BOOT_MODES_MASK;
84 setenv("modeboot", "jtagboot");
88 setenv("modeboot", "qspiboot");
93 setenv("modeboot", "sdboot");
97 setenv("modeboot", "sdboot");
101 #if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
102 setenv("sdbootdev", "1");
104 setenv("modeboot", "sdboot");
108 setenv("modeboot", "nandboot");
111 printf("Invalid Boot Mode:0x%x\n", bootmode);
120 puts("Board: Xilinx ZynqMP\n");
124 #ifdef CONFIG_USB_DWC3
125 static struct dwc3_device dwc3_device_data = {
126 .maximum_speed = USB_SPEED_HIGH,
127 .base = ZYNQMP_USB0_XHCI_BASEADDR,
128 .dr_mode = USB_DR_MODE_PERIPHERAL,
132 int usb_gadget_handle_interrupts(void)
134 dwc3_uboot_handle_interrupt(0);
138 int board_usb_init(int index, enum usb_init_type init)
140 return dwc3_uboot_init(&dwc3_device_data);
143 int board_usb_cleanup(int index, enum usb_init_type init)
145 dwc3_uboot_exit(index);