xref: /openbmc/u-boot/board/xilinx/zynqmp/zynqmp.c (revision 74ba69db35954e473a27711de89dae9572913478)
184c7204bSMichal Simek /*
284c7204bSMichal Simek  * (C) Copyright 2014 - 2015 Xilinx, Inc.
384c7204bSMichal Simek  * Michal Simek <michal.simek@xilinx.com>
484c7204bSMichal Simek  *
584c7204bSMichal Simek  * SPDX-License-Identifier:	GPL-2.0+
684c7204bSMichal Simek  */
784c7204bSMichal Simek 
884c7204bSMichal Simek #include <common.h>
9679b994aSMichal Simek #include <sata.h>
106fe6f135SMichal Simek #include <ahci.h>
116fe6f135SMichal Simek #include <scsi.h>
12b72894f1SMichal Simek #include <malloc.h>
130785dfd8SMichal Simek #include <asm/arch/clk.h>
1484c7204bSMichal Simek #include <asm/arch/hardware.h>
1584c7204bSMichal Simek #include <asm/arch/sys_proto.h>
1684c7204bSMichal Simek #include <asm/io.h>
1716fa00a7SSiva Durga Prasad Paladugu #include <usb.h>
1816fa00a7SSiva Durga Prasad Paladugu #include <dwc3-uboot.h>
1947e60cbdSMichal Simek #include <zynqmppl.h>
206919b4bfSMichal Simek #include <i2c.h>
219feff385SMichal Simek #include <g_dnl.h>
2284c7204bSMichal Simek 
2384c7204bSMichal Simek DECLARE_GLOBAL_DATA_PTR;
2484c7204bSMichal Simek 
2547e60cbdSMichal Simek #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
2647e60cbdSMichal Simek     !defined(CONFIG_SPL_BUILD)
2747e60cbdSMichal Simek static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC;
2847e60cbdSMichal Simek 
2947e60cbdSMichal Simek static const struct {
3047e60cbdSMichal Simek 	uint32_t id;
3147e60cbdSMichal Simek 	char *name;
3247e60cbdSMichal Simek } zynqmp_devices[] = {
3347e60cbdSMichal Simek 	{
3447e60cbdSMichal Simek 		.id = 0x10,
3547e60cbdSMichal Simek 		.name = "3eg",
3647e60cbdSMichal Simek 	},
3747e60cbdSMichal Simek 	{
3847e60cbdSMichal Simek 		.id = 0x11,
3947e60cbdSMichal Simek 		.name = "2eg",
4047e60cbdSMichal Simek 	},
4147e60cbdSMichal Simek 	{
4247e60cbdSMichal Simek 		.id = 0x20,
4347e60cbdSMichal Simek 		.name = "5ev",
4447e60cbdSMichal Simek 	},
4547e60cbdSMichal Simek 	{
4647e60cbdSMichal Simek 		.id = 0x21,
4747e60cbdSMichal Simek 		.name = "4ev",
4847e60cbdSMichal Simek 	},
4947e60cbdSMichal Simek 	{
5047e60cbdSMichal Simek 		.id = 0x30,
5147e60cbdSMichal Simek 		.name = "7ev",
5247e60cbdSMichal Simek 	},
5347e60cbdSMichal Simek 	{
5447e60cbdSMichal Simek 		.id = 0x38,
5547e60cbdSMichal Simek 		.name = "9eg",
5647e60cbdSMichal Simek 	},
5747e60cbdSMichal Simek 	{
5847e60cbdSMichal Simek 		.id = 0x39,
5947e60cbdSMichal Simek 		.name = "6eg",
6047e60cbdSMichal Simek 	},
6147e60cbdSMichal Simek 	{
6247e60cbdSMichal Simek 		.id = 0x40,
6347e60cbdSMichal Simek 		.name = "11eg",
6447e60cbdSMichal Simek 	},
6547e60cbdSMichal Simek 	{
6647e60cbdSMichal Simek 		.id = 0x50,
6747e60cbdSMichal Simek 		.name = "15eg",
6847e60cbdSMichal Simek 	},
6947e60cbdSMichal Simek 	{
7047e60cbdSMichal Simek 		.id = 0x58,
7147e60cbdSMichal Simek 		.name = "19eg",
7247e60cbdSMichal Simek 	},
7347e60cbdSMichal Simek 	{
7447e60cbdSMichal Simek 		.id = 0x59,
7547e60cbdSMichal Simek 		.name = "17eg",
7647e60cbdSMichal Simek 	},
7747e60cbdSMichal Simek };
78*74ba69dbSSiva Durga Prasad Paladugu #endif
7947e60cbdSMichal Simek 
80f52bf5a3SSiva Durga Prasad Paladugu int chip_id(unsigned char id)
8147e60cbdSMichal Simek {
8247e60cbdSMichal Simek 	struct pt_regs regs;
83*74ba69dbSSiva Durga Prasad Paladugu 	int val = -EINVAL;
84*74ba69dbSSiva Durga Prasad Paladugu 
85*74ba69dbSSiva Durga Prasad Paladugu 	if (current_el() != 3) {
8647e60cbdSMichal Simek 		regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID;
8747e60cbdSMichal Simek 		regs.regs[1] = 0;
8847e60cbdSMichal Simek 		regs.regs[2] = 0;
8947e60cbdSMichal Simek 		regs.regs[3] = 0;
9047e60cbdSMichal Simek 
9147e60cbdSMichal Simek 		smc_call(&regs);
9247e60cbdSMichal Simek 
930cba6abbSSoren Brinkmann 		/*
940cba6abbSSoren Brinkmann 		 * SMC returns:
950cba6abbSSoren Brinkmann 		 * regs[0][31:0]  = status of the operation
960cba6abbSSoren Brinkmann 		 * regs[0][63:32] = CSU.IDCODE register
970cba6abbSSoren Brinkmann 		 * regs[1][31:0]  = CSU.version register
980cba6abbSSoren Brinkmann 		 */
99db3123b4SSiva Durga Prasad Paladugu 		switch (id) {
100db3123b4SSiva Durga Prasad Paladugu 		case IDCODE:
1010cba6abbSSoren Brinkmann 			regs.regs[0] = upper_32_bits(regs.regs[0]);
1020cba6abbSSoren Brinkmann 			regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK |
1030cba6abbSSoren Brinkmann 					ZYNQMP_CSU_IDCODE_SVD_MASK;
1040cba6abbSSoren Brinkmann 			regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
105db3123b4SSiva Durga Prasad Paladugu 			val = regs.regs[0];
106db3123b4SSiva Durga Prasad Paladugu 			break;
107db3123b4SSiva Durga Prasad Paladugu 		case VERSION:
108db3123b4SSiva Durga Prasad Paladugu 			regs.regs[1] = lower_32_bits(regs.regs[1]);
109db3123b4SSiva Durga Prasad Paladugu 			regs.regs[1] &= ZYNQMP_CSU_SILICON_VER_MASK;
110db3123b4SSiva Durga Prasad Paladugu 			val = regs.regs[1];
111db3123b4SSiva Durga Prasad Paladugu 			break;
112db3123b4SSiva Durga Prasad Paladugu 		default:
113db3123b4SSiva Durga Prasad Paladugu 			printf("%s, Invalid Req:0x%x\n", __func__, id);
114db3123b4SSiva Durga Prasad Paladugu 		}
115*74ba69dbSSiva Durga Prasad Paladugu 	} else {
116*74ba69dbSSiva Durga Prasad Paladugu 		switch (id) {
117*74ba69dbSSiva Durga Prasad Paladugu 		case IDCODE:
118*74ba69dbSSiva Durga Prasad Paladugu 			val = readl(ZYNQMP_CSU_IDCODE_ADDR);
119*74ba69dbSSiva Durga Prasad Paladugu 			val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK |
120*74ba69dbSSiva Durga Prasad Paladugu 			       ZYNQMP_CSU_IDCODE_SVD_MASK;
121*74ba69dbSSiva Durga Prasad Paladugu 			val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
122*74ba69dbSSiva Durga Prasad Paladugu 			break;
123*74ba69dbSSiva Durga Prasad Paladugu 		case VERSION:
124*74ba69dbSSiva Durga Prasad Paladugu 			val = readl(ZYNQMP_CSU_VER_ADDR);
125*74ba69dbSSiva Durga Prasad Paladugu 			val &= ZYNQMP_CSU_SILICON_VER_MASK;
126*74ba69dbSSiva Durga Prasad Paladugu 			break;
127*74ba69dbSSiva Durga Prasad Paladugu 		default:
128*74ba69dbSSiva Durga Prasad Paladugu 			printf("%s, Invalid Req:0x%x\n", __func__, id);
129*74ba69dbSSiva Durga Prasad Paladugu 		}
130*74ba69dbSSiva Durga Prasad Paladugu 	}
1310cba6abbSSoren Brinkmann 
132db3123b4SSiva Durga Prasad Paladugu 	return val;
13347e60cbdSMichal Simek }
13447e60cbdSMichal Simek 
135*74ba69dbSSiva Durga Prasad Paladugu #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
136*74ba69dbSSiva Durga Prasad Paladugu 	!defined(CONFIG_SPL_BUILD)
13747e60cbdSMichal Simek static char *zynqmp_get_silicon_idcode_name(void)
13847e60cbdSMichal Simek {
13947e60cbdSMichal Simek 	uint32_t i, id;
14047e60cbdSMichal Simek 
141db3123b4SSiva Durga Prasad Paladugu 	id = chip_id(IDCODE);
14247e60cbdSMichal Simek 	for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) {
14347e60cbdSMichal Simek 		if (zynqmp_devices[i].id == id)
14447e60cbdSMichal Simek 			return zynqmp_devices[i].name;
14547e60cbdSMichal Simek 	}
14647e60cbdSMichal Simek 	return "unknown";
14747e60cbdSMichal Simek }
14847e60cbdSMichal Simek #endif
14947e60cbdSMichal Simek 
150fb4000e8SMichal Simek int board_early_init_f(void)
151fb4000e8SMichal Simek {
152fb4000e8SMichal Simek #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP)
153fb4000e8SMichal Simek 	zynqmp_pmufw_version();
154fb4000e8SMichal Simek #endif
15555de0929SMichal Simek 
156fd1b635cSMichal Simek #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED)
15755de0929SMichal Simek 	psu_init();
15855de0929SMichal Simek #endif
15955de0929SMichal Simek 
160fb4000e8SMichal Simek 	return 0;
161fb4000e8SMichal Simek }
162fb4000e8SMichal Simek 
16347e60cbdSMichal Simek #define ZYNQMP_VERSION_SIZE	9
16447e60cbdSMichal Simek 
16584c7204bSMichal Simek int board_init(void)
16684c7204bSMichal Simek {
167a0736efbSMichal Simek 	printf("EL Level:\tEL%d\n", current_el());
168a0736efbSMichal Simek 
16947e60cbdSMichal Simek #if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
17047e60cbdSMichal Simek     !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \
17147e60cbdSMichal Simek     defined(CONFIG_SPL_BUILD))
17247e60cbdSMichal Simek 	if (current_el() != 3) {
17347e60cbdSMichal Simek 		static char version[ZYNQMP_VERSION_SIZE];
17447e60cbdSMichal Simek 
17547e60cbdSMichal Simek 		strncat(version, "xczu", ZYNQMP_VERSION_SIZE);
17647e60cbdSMichal Simek 		zynqmppl.name = strncat(version,
17747e60cbdSMichal Simek 					zynqmp_get_silicon_idcode_name(),
17847e60cbdSMichal Simek 					ZYNQMP_VERSION_SIZE);
17947e60cbdSMichal Simek 		printf("Chip ID:\t%s\n", zynqmppl.name);
18047e60cbdSMichal Simek 		fpga_init();
18147e60cbdSMichal Simek 		fpga_add(fpga_xilinx, &zynqmppl);
18247e60cbdSMichal Simek 	}
18347e60cbdSMichal Simek #endif
18447e60cbdSMichal Simek 
18584c7204bSMichal Simek 	return 0;
18684c7204bSMichal Simek }
18784c7204bSMichal Simek 
18884c7204bSMichal Simek int board_early_init_r(void)
18984c7204bSMichal Simek {
19084c7204bSMichal Simek 	u32 val;
19184c7204bSMichal Simek 
19290a35db4SMichal Simek 	val = readl(&crlapb_base->timestamp_ref_ctrl);
19390a35db4SMichal Simek 	val &= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT;
19490a35db4SMichal Simek 
19590a35db4SMichal Simek 	if (current_el() == 3 && !val) {
19684c7204bSMichal Simek 		val = readl(&crlapb_base->timestamp_ref_ctrl);
19784c7204bSMichal Simek 		val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT;
19884c7204bSMichal Simek 		writel(val, &crlapb_base->timestamp_ref_ctrl);
19984c7204bSMichal Simek 
2000785dfd8SMichal Simek 		/* Program freq register in System counter */
2010785dfd8SMichal Simek 		writel(zynqmp_get_system_timer_freq(),
2020785dfd8SMichal Simek 		       &iou_scntr_secure->base_frequency_id_register);
2030785dfd8SMichal Simek 		/* And enable system counter */
2040785dfd8SMichal Simek 		writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN,
2050785dfd8SMichal Simek 		       &iou_scntr_secure->counter_control_register);
2060785dfd8SMichal Simek 	}
20784c7204bSMichal Simek 	return 0;
20884c7204bSMichal Simek }
20984c7204bSMichal Simek 
2106919b4bfSMichal Simek int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
2116919b4bfSMichal Simek {
2126919b4bfSMichal Simek #if defined(CONFIG_ZYNQ_GEM_EEPROM_ADDR) && \
2136919b4bfSMichal Simek     defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) && \
2146919b4bfSMichal Simek     defined(CONFIG_ZYNQ_EEPROM_BUS)
2156919b4bfSMichal Simek 	i2c_set_bus_num(CONFIG_ZYNQ_EEPROM_BUS);
2166919b4bfSMichal Simek 
2176919b4bfSMichal Simek 	if (eeprom_read(CONFIG_ZYNQ_GEM_EEPROM_ADDR,
2186919b4bfSMichal Simek 			CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET,
2196919b4bfSMichal Simek 			ethaddr, 6))
2206919b4bfSMichal Simek 		printf("I2C EEPROM MAC address read failed\n");
2216919b4bfSMichal Simek #endif
2226919b4bfSMichal Simek 
2236919b4bfSMichal Simek 	return 0;
2246919b4bfSMichal Simek }
2256919b4bfSMichal Simek 
2268d59d7f6SMichal Simek #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
22776b00acaSSimon Glass int dram_init_banksize(void)
228361a8799STom Rini {
229950f86caSNathan Rossi 	fdtdec_setup_memory_banksize();
23076b00acaSSimon Glass 
23176b00acaSSimon Glass 	return 0;
2328d59d7f6SMichal Simek }
2338d59d7f6SMichal Simek 
2348d59d7f6SMichal Simek int dram_init(void)
2358d59d7f6SMichal Simek {
236950f86caSNathan Rossi 	if (fdtdec_setup_memory_size() != 0)
237950f86caSNathan Rossi 		return -EINVAL;
2388d59d7f6SMichal Simek 
2398d59d7f6SMichal Simek 	return 0;
2408d59d7f6SMichal Simek }
2418d59d7f6SMichal Simek #else
24284c7204bSMichal Simek int dram_init(void)
24384c7204bSMichal Simek {
24484c7204bSMichal Simek 	gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
24584c7204bSMichal Simek 
24684c7204bSMichal Simek 	return 0;
24784c7204bSMichal Simek }
2488d59d7f6SMichal Simek #endif
24984c7204bSMichal Simek 
25084c7204bSMichal Simek void reset_cpu(ulong addr)
25184c7204bSMichal Simek {
25284c7204bSMichal Simek }
25384c7204bSMichal Simek 
25484c7204bSMichal Simek int board_late_init(void)
25584c7204bSMichal Simek {
25684c7204bSMichal Simek 	u32 reg = 0;
25784c7204bSMichal Simek 	u8 bootmode;
258b72894f1SMichal Simek 	const char *mode;
259b72894f1SMichal Simek 	char *new_targets;
260b72894f1SMichal Simek 
261b72894f1SMichal Simek 	if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
262b72894f1SMichal Simek 		debug("Saved variables - Skipping\n");
263b72894f1SMichal Simek 		return 0;
264b72894f1SMichal Simek 	}
26584c7204bSMichal Simek 
26684c7204bSMichal Simek 	reg = readl(&crlapb_base->boot_mode);
26747359a03SMichal Simek 	if (reg >> BOOT_MODE_ALT_SHIFT)
26847359a03SMichal Simek 		reg >>= BOOT_MODE_ALT_SHIFT;
26947359a03SMichal Simek 
27084c7204bSMichal Simek 	bootmode = reg & BOOT_MODES_MASK;
27184c7204bSMichal Simek 
272fb90917cSMichal Simek 	puts("Bootmode: ");
27384c7204bSMichal Simek 	switch (bootmode) {
274d58fc12eSMichal Simek 	case USB_MODE:
275d58fc12eSMichal Simek 		puts("USB_MODE\n");
276d58fc12eSMichal Simek 		mode = "usb";
277d58fc12eSMichal Simek 		break;
2780a5bcc8cSSiva Durga Prasad Paladugu 	case JTAG_MODE:
279fb90917cSMichal Simek 		puts("JTAG_MODE\n");
280b72894f1SMichal Simek 		mode = "pxe dhcp";
2810a5bcc8cSSiva Durga Prasad Paladugu 		break;
2820a5bcc8cSSiva Durga Prasad Paladugu 	case QSPI_MODE_24BIT:
2830a5bcc8cSSiva Durga Prasad Paladugu 	case QSPI_MODE_32BIT:
284b72894f1SMichal Simek 		mode = "qspi0";
285fb90917cSMichal Simek 		puts("QSPI_MODE\n");
2860a5bcc8cSSiva Durga Prasad Paladugu 		break;
28739c56f55SMichal Simek 	case EMMC_MODE:
28878678feeSMichal Simek 		puts("EMMC_MODE\n");
289b72894f1SMichal Simek 		mode = "mmc0";
29078678feeSMichal Simek 		break;
29178678feeSMichal Simek 	case SD_MODE:
292fb90917cSMichal Simek 		puts("SD_MODE\n");
293b72894f1SMichal Simek 		mode = "mmc0";
29484c7204bSMichal Simek 		break;
295e1992276SSiva Durga Prasad Paladugu 	case SD1_LSHFT_MODE:
296e1992276SSiva Durga Prasad Paladugu 		puts("LVL_SHFT_");
297e1992276SSiva Durga Prasad Paladugu 		/* fall through */
298af813acdSMichal Simek 	case SD_MODE1:
299fb90917cSMichal Simek 		puts("SD_MODE1\n");
3002d9925bcSMichal Simek #if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
301b72894f1SMichal Simek 		mode = "mmc1";
302b72894f1SMichal Simek #else
303b72894f1SMichal Simek 		mode = "mmc0";
3042d9925bcSMichal Simek #endif
305af813acdSMichal Simek 		break;
306af813acdSMichal Simek 	case NAND_MODE:
307fb90917cSMichal Simek 		puts("NAND_MODE\n");
308b72894f1SMichal Simek 		mode = "nand0";
309af813acdSMichal Simek 		break;
31084c7204bSMichal Simek 	default:
311b72894f1SMichal Simek 		mode = "";
31284c7204bSMichal Simek 		printf("Invalid Boot Mode:0x%x\n", bootmode);
31384c7204bSMichal Simek 		break;
31484c7204bSMichal Simek 	}
31584c7204bSMichal Simek 
316b72894f1SMichal Simek 	/*
317b72894f1SMichal Simek 	 * One terminating char + one byte for space between mode
318b72894f1SMichal Simek 	 * and default boot_targets
319b72894f1SMichal Simek 	 */
320b72894f1SMichal Simek 	new_targets = calloc(1, strlen(mode) +
321b72894f1SMichal Simek 				strlen(getenv("boot_targets")) + 2);
322b72894f1SMichal Simek 
323b72894f1SMichal Simek 	sprintf(new_targets, "%s %s", mode, getenv("boot_targets"));
324b72894f1SMichal Simek 	setenv("boot_targets", new_targets);
325b72894f1SMichal Simek 
32684c7204bSMichal Simek 	return 0;
32784c7204bSMichal Simek }
32884696ff5SSiva Durga Prasad Paladugu 
32984696ff5SSiva Durga Prasad Paladugu int checkboard(void)
33084696ff5SSiva Durga Prasad Paladugu {
3315af08556SMichal Simek 	puts("Board: Xilinx ZynqMP\n");
33284696ff5SSiva Durga Prasad Paladugu 	return 0;
33384696ff5SSiva Durga Prasad Paladugu }
33416fa00a7SSiva Durga Prasad Paladugu 
33516fa00a7SSiva Durga Prasad Paladugu #ifdef CONFIG_USB_DWC3
336275bd6d1SMichal Simek static struct dwc3_device dwc3_device_data0 = {
33716fa00a7SSiva Durga Prasad Paladugu 	.maximum_speed = USB_SPEED_HIGH,
33816fa00a7SSiva Durga Prasad Paladugu 	.base = ZYNQMP_USB0_XHCI_BASEADDR,
33916fa00a7SSiva Durga Prasad Paladugu 	.dr_mode = USB_DR_MODE_PERIPHERAL,
34016fa00a7SSiva Durga Prasad Paladugu 	.index = 0,
34116fa00a7SSiva Durga Prasad Paladugu };
34216fa00a7SSiva Durga Prasad Paladugu 
343275bd6d1SMichal Simek static struct dwc3_device dwc3_device_data1 = {
344275bd6d1SMichal Simek 	.maximum_speed = USB_SPEED_HIGH,
345275bd6d1SMichal Simek 	.base = ZYNQMP_USB1_XHCI_BASEADDR,
346275bd6d1SMichal Simek 	.dr_mode = USB_DR_MODE_PERIPHERAL,
347275bd6d1SMichal Simek 	.index = 1,
348275bd6d1SMichal Simek };
349275bd6d1SMichal Simek 
3509feff385SMichal Simek int usb_gadget_handle_interrupts(int index)
35116fa00a7SSiva Durga Prasad Paladugu {
3529feff385SMichal Simek 	dwc3_uboot_handle_interrupt(index);
35316fa00a7SSiva Durga Prasad Paladugu 	return 0;
35416fa00a7SSiva Durga Prasad Paladugu }
35516fa00a7SSiva Durga Prasad Paladugu 
35616fa00a7SSiva Durga Prasad Paladugu int board_usb_init(int index, enum usb_init_type init)
35716fa00a7SSiva Durga Prasad Paladugu {
358275bd6d1SMichal Simek 	debug("%s: index %x\n", __func__, index);
359275bd6d1SMichal Simek 
3608ecd50c8SMichal Simek #if defined(CONFIG_USB_GADGET_DOWNLOAD)
3618ecd50c8SMichal Simek 	g_dnl_set_serialnumber(CONFIG_SYS_CONFIG_NAME);
3628ecd50c8SMichal Simek #endif
3638ecd50c8SMichal Simek 
364275bd6d1SMichal Simek 	switch (index) {
365275bd6d1SMichal Simek 	case 0:
366275bd6d1SMichal Simek 		return dwc3_uboot_init(&dwc3_device_data0);
367275bd6d1SMichal Simek 	case 1:
368275bd6d1SMichal Simek 		return dwc3_uboot_init(&dwc3_device_data1);
369275bd6d1SMichal Simek 	};
370275bd6d1SMichal Simek 
371275bd6d1SMichal Simek 	return -1;
37216fa00a7SSiva Durga Prasad Paladugu }
37316fa00a7SSiva Durga Prasad Paladugu 
37416fa00a7SSiva Durga Prasad Paladugu int board_usb_cleanup(int index, enum usb_init_type init)
37516fa00a7SSiva Durga Prasad Paladugu {
37616fa00a7SSiva Durga Prasad Paladugu 	dwc3_uboot_exit(index);
37716fa00a7SSiva Durga Prasad Paladugu 	return 0;
37816fa00a7SSiva Durga Prasad Paladugu }
37916fa00a7SSiva Durga Prasad Paladugu #endif
380