blob: c198a4d9206349e4bfe8aba6108d0dc33868bac9 [file] [log] [blame]
Michal Simek04b7e622015-01-15 10:01:51 +01001/*
2 * (C) Copyright 2014 - 2015 Xilinx, Inc.
3 * Michal Simek <michal.simek@xilinx.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <common.h>
Michal Simekd54b1af2015-09-30 17:26:55 +02009#include <sata.h>
Michal Simekb216cc12015-07-23 13:27:40 +020010#include <ahci.h>
11#include <scsi.h>
Michal Simekecfb6dc2016-04-22 14:28:54 +020012#include <malloc.h>
Michal Simekc23d3f82015-11-05 08:34:35 +010013#include <asm/arch/clk.h>
Michal Simek04b7e622015-01-15 10:01:51 +010014#include <asm/arch/hardware.h>
15#include <asm/arch/sys_proto.h>
16#include <asm/io.h>
Siva Durga Prasad Paladuguba1f68e2015-08-04 13:03:26 +053017#include <usb.h>
18#include <dwc3-uboot.h>
Michal Simek8111aff2016-02-01 15:05:58 +010019#include <zynqmppl.h>
Michal Simekeec32f62016-04-22 11:48:49 +020020#include <i2c.h>
Michal Simek76d0a772016-09-01 11:16:40 +020021#include <g_dnl.h>
Michal Simek04b7e622015-01-15 10:01:51 +010022
23DECLARE_GLOBAL_DATA_PTR;
24
Michal Simek8111aff2016-02-01 15:05:58 +010025#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
26 !defined(CONFIG_SPL_BUILD)
27static xilinx_desc zynqmppl = XILINX_ZYNQMP_DESC;
28
29static const struct {
Michal Simek6908b862017-11-06 12:55:59 +010030 u32 id;
Michal Simek50d8cef2017-08-22 14:58:53 +020031 u32 ver;
Michal Simek8111aff2016-02-01 15:05:58 +010032 char *name;
33} zynqmp_devices[] = {
34 {
35 .id = 0x10,
36 .name = "3eg",
37 },
38 {
Michal Simek50d8cef2017-08-22 14:58:53 +020039 .id = 0x10,
40 .ver = 0x2c,
41 .name = "3cg",
42 },
43 {
Michal Simek8111aff2016-02-01 15:05:58 +010044 .id = 0x11,
45 .name = "2eg",
46 },
47 {
Michal Simek50d8cef2017-08-22 14:58:53 +020048 .id = 0x11,
49 .ver = 0x2c,
50 .name = "2cg",
51 },
52 {
Michal Simek8111aff2016-02-01 15:05:58 +010053 .id = 0x20,
54 .name = "5ev",
55 },
56 {
Michal Simek50d8cef2017-08-22 14:58:53 +020057 .id = 0x20,
58 .ver = 0x100,
59 .name = "5eg",
60 },
61 {
62 .id = 0x20,
63 .ver = 0x12c,
64 .name = "5cg",
65 },
66 {
Michal Simek8111aff2016-02-01 15:05:58 +010067 .id = 0x21,
68 .name = "4ev",
69 },
70 {
Michal Simek50d8cef2017-08-22 14:58:53 +020071 .id = 0x21,
72 .ver = 0x100,
73 .name = "4eg",
74 },
75 {
76 .id = 0x21,
77 .ver = 0x12c,
78 .name = "4cg",
79 },
80 {
Michal Simek8111aff2016-02-01 15:05:58 +010081 .id = 0x30,
82 .name = "7ev",
83 },
84 {
Michal Simek50d8cef2017-08-22 14:58:53 +020085 .id = 0x30,
86 .ver = 0x100,
87 .name = "7eg",
88 },
89 {
90 .id = 0x30,
91 .ver = 0x12c,
92 .name = "7cg",
93 },
94 {
Michal Simek8111aff2016-02-01 15:05:58 +010095 .id = 0x38,
96 .name = "9eg",
97 },
98 {
Michal Simek50d8cef2017-08-22 14:58:53 +020099 .id = 0x38,
100 .ver = 0x2c,
101 .name = "9cg",
102 },
103 {
Michal Simek8111aff2016-02-01 15:05:58 +0100104 .id = 0x39,
105 .name = "6eg",
106 },
107 {
Michal Simek50d8cef2017-08-22 14:58:53 +0200108 .id = 0x39,
109 .ver = 0x2c,
110 .name = "6cg",
111 },
112 {
Michal Simek8111aff2016-02-01 15:05:58 +0100113 .id = 0x40,
114 .name = "11eg",
115 },
Michal Simek50d8cef2017-08-22 14:58:53 +0200116 { /* For testing purpose only */
117 .id = 0x50,
118 .ver = 0x2c,
119 .name = "15cg",
120 },
Michal Simek8111aff2016-02-01 15:05:58 +0100121 {
122 .id = 0x50,
123 .name = "15eg",
124 },
125 {
126 .id = 0x58,
127 .name = "19eg",
128 },
129 {
130 .id = 0x59,
131 .name = "17eg",
132 },
Michal Simekb510e532017-06-02 08:08:59 +0200133 {
134 .id = 0x61,
135 .name = "21dr",
136 },
137 {
138 .id = 0x63,
139 .name = "23dr",
140 },
141 {
142 .id = 0x65,
143 .name = "25dr",
144 },
145 {
146 .id = 0x64,
147 .name = "27dr",
148 },
149 {
150 .id = 0x60,
151 .name = "28dr",
152 },
153 {
154 .id = 0x62,
155 .name = "29dr",
156 },
Michal Simek8111aff2016-02-01 15:05:58 +0100157};
Siva Durga Prasad Paladugu8d526532017-07-25 11:51:37 +0530158#endif
Michal Simek8111aff2016-02-01 15:05:58 +0100159
Siva Durga Prasad Paladugucd35d522017-07-25 11:51:38 +0530160int chip_id(unsigned char id)
Michal Simek8111aff2016-02-01 15:05:58 +0100161{
162 struct pt_regs regs;
Siva Durga Prasad Paladugu9f0a8e92017-07-25 11:51:36 +0530163 int val = -EINVAL;
Michal Simek8111aff2016-02-01 15:05:58 +0100164
Siva Durga Prasad Paladugu8d526532017-07-25 11:51:37 +0530165 if (current_el() != 3) {
166 regs.regs[0] = ZYNQMP_SIP_SVC_CSU_DMA_CHIPID;
167 regs.regs[1] = 0;
168 regs.regs[2] = 0;
169 regs.regs[3] = 0;
Michal Simek8111aff2016-02-01 15:05:58 +0100170
Siva Durga Prasad Paladugu8d526532017-07-25 11:51:37 +0530171 smc_call(&regs);
172
173 /*
174 * SMC returns:
175 * regs[0][31:0] = status of the operation
176 * regs[0][63:32] = CSU.IDCODE register
177 * regs[1][31:0] = CSU.version register
Michal Simek50d8cef2017-08-22 14:58:53 +0200178 * regs[1][63:32] = CSU.IDCODE2 register
Siva Durga Prasad Paladugu8d526532017-07-25 11:51:37 +0530179 */
180 switch (id) {
181 case IDCODE:
182 regs.regs[0] = upper_32_bits(regs.regs[0]);
183 regs.regs[0] &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK |
184 ZYNQMP_CSU_IDCODE_SVD_MASK;
185 regs.regs[0] >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
186 val = regs.regs[0];
187 break;
188 case VERSION:
189 regs.regs[1] = lower_32_bits(regs.regs[1]);
190 regs.regs[1] &= ZYNQMP_CSU_SILICON_VER_MASK;
191 val = regs.regs[1];
192 break;
Michal Simek50d8cef2017-08-22 14:58:53 +0200193 case IDCODE2:
194 regs.regs[1] = lower_32_bits(regs.regs[1]);
195 regs.regs[1] >>= ZYNQMP_CSU_VERSION_EMPTY_SHIFT;
196 val = regs.regs[1];
197 break;
Siva Durga Prasad Paladugu8d526532017-07-25 11:51:37 +0530198 default:
199 printf("%s, Invalid Req:0x%x\n", __func__, id);
200 }
201 } else {
202 switch (id) {
203 case IDCODE:
204 val = readl(ZYNQMP_CSU_IDCODE_ADDR);
205 val &= ZYNQMP_CSU_IDCODE_DEVICE_CODE_MASK |
206 ZYNQMP_CSU_IDCODE_SVD_MASK;
207 val >>= ZYNQMP_CSU_IDCODE_SVD_SHIFT;
208 break;
209 case VERSION:
210 val = readl(ZYNQMP_CSU_VER_ADDR);
211 val &= ZYNQMP_CSU_SILICON_VER_MASK;
212 break;
213 default:
214 printf("%s, Invalid Req:0x%x\n", __func__, id);
215 }
Siva Durga Prasad Paladugu9f0a8e92017-07-25 11:51:36 +0530216 }
Soren Brinkmannd7696a52016-09-29 11:44:41 -0700217
Siva Durga Prasad Paladugu9f0a8e92017-07-25 11:51:36 +0530218 return val;
Michal Simek8111aff2016-02-01 15:05:58 +0100219}
220
Siva Durga Prasad Paladugu8d526532017-07-25 11:51:37 +0530221#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
222 !defined(CONFIG_SPL_BUILD)
Michal Simek8111aff2016-02-01 15:05:58 +0100223static char *zynqmp_get_silicon_idcode_name(void)
224{
Michal Simek50d8cef2017-08-22 14:58:53 +0200225 u32 i, id, ver;
Michal Simek8111aff2016-02-01 15:05:58 +0100226
Siva Durga Prasad Paladugu9f0a8e92017-07-25 11:51:36 +0530227 id = chip_id(IDCODE);
Michal Simek50d8cef2017-08-22 14:58:53 +0200228 ver = chip_id(IDCODE2);
229
Michal Simek8111aff2016-02-01 15:05:58 +0100230 for (i = 0; i < ARRAY_SIZE(zynqmp_devices); i++) {
Michal Simek50d8cef2017-08-22 14:58:53 +0200231 if (zynqmp_devices[i].id == id && zynqmp_devices[i].ver == ver)
Michal Simek8111aff2016-02-01 15:05:58 +0100232 return zynqmp_devices[i].name;
233 }
234 return "unknown";
235}
236#endif
237
Michal Simek8b353302017-02-07 14:32:26 +0100238int board_early_init_f(void)
239{
240#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CLK_ZYNQMP)
241 zynqmp_pmufw_version();
242#endif
Michal Simeke0f36102017-07-12 13:08:41 +0200243
Michal Simekd8218792017-07-12 13:21:27 +0200244#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED)
Michal Simeke0f36102017-07-12 13:08:41 +0200245 psu_init();
246#endif
247
Michal Simek8b353302017-02-07 14:32:26 +0100248 return 0;
249}
250
Michal Simek8111aff2016-02-01 15:05:58 +0100251#define ZYNQMP_VERSION_SIZE 9
252
Michal Simek04b7e622015-01-15 10:01:51 +0100253int board_init(void)
254{
Michal Simekfb7242d2015-06-22 14:31:06 +0200255 printf("EL Level:\tEL%d\n", current_el());
256
Michal Simek8111aff2016-02-01 15:05:58 +0100257#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_ZYNQMPPL) && \
258 !defined(CONFIG_SPL_BUILD) || (defined(CONFIG_SPL_FPGA_SUPPORT) && \
259 defined(CONFIG_SPL_BUILD))
260 if (current_el() != 3) {
261 static char version[ZYNQMP_VERSION_SIZE];
262
Michal Simek54cae482017-12-06 08:33:50 +0100263 strncat(version, "zu", 2);
Michal Simek8111aff2016-02-01 15:05:58 +0100264 zynqmppl.name = strncat(version,
265 zynqmp_get_silicon_idcode_name(),
Michal Simek54cae482017-12-06 08:33:50 +0100266 ZYNQMP_VERSION_SIZE - 3);
Michal Simek8111aff2016-02-01 15:05:58 +0100267 printf("Chip ID:\t%s\n", zynqmppl.name);
268 fpga_init();
269 fpga_add(fpga_xilinx, &zynqmppl);
270 }
271#endif
272
Michal Simek04b7e622015-01-15 10:01:51 +0100273 return 0;
274}
275
276int board_early_init_r(void)
277{
278 u32 val;
279
Siva Durga Prasad Paladugu64d90002017-12-07 15:05:30 +0530280 if (current_el() != 3)
281 return 0;
282
Michal Simek245d5282017-07-12 10:32:18 +0200283 val = readl(&crlapb_base->timestamp_ref_ctrl);
284 val &= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT;
285
Siva Durga Prasad Paladugu64d90002017-12-07 15:05:30 +0530286 if (!val) {
Michal Simekc23d3f82015-11-05 08:34:35 +0100287 val = readl(&crlapb_base->timestamp_ref_ctrl);
288 val |= ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT;
289 writel(val, &crlapb_base->timestamp_ref_ctrl);
Michal Simek04b7e622015-01-15 10:01:51 +0100290
Michal Simekc23d3f82015-11-05 08:34:35 +0100291 /* Program freq register in System counter */
292 writel(zynqmp_get_system_timer_freq(),
293 &iou_scntr_secure->base_frequency_id_register);
294 /* And enable system counter */
295 writel(ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN,
296 &iou_scntr_secure->counter_control_register);
297 }
Michal Simek04b7e622015-01-15 10:01:51 +0100298 return 0;
299}
300
Michal Simekeec32f62016-04-22 11:48:49 +0200301int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
302{
303#if defined(CONFIG_ZYNQ_GEM_EEPROM_ADDR) && \
304 defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET) && \
305 defined(CONFIG_ZYNQ_EEPROM_BUS)
306 i2c_set_bus_num(CONFIG_ZYNQ_EEPROM_BUS);
307
308 if (eeprom_read(CONFIG_ZYNQ_GEM_EEPROM_ADDR,
309 CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET,
310 ethaddr, 6))
311 printf("I2C EEPROM MAC address read failed\n");
312#endif
313
314 return 0;
315}
316
Michal Simek8faa66a2016-02-08 09:34:53 +0100317#if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE)
Simon Glass2f949c32017-03-31 08:40:32 -0600318int dram_init_banksize(void)
Michal Simek8faa66a2016-02-08 09:34:53 +0100319{
Michal Simekd5b7de62017-11-03 15:25:51 +0100320 return fdtdec_setup_memory_banksize();
Tom Riniedcfdbd2016-12-09 07:56:54 -0500321}
Michal Simek8faa66a2016-02-08 09:34:53 +0100322
Tom Riniedcfdbd2016-12-09 07:56:54 -0500323int dram_init(void)
324{
Nathan Rossiac04bfa2016-12-19 00:03:34 +1000325 if (fdtdec_setup_memory_size() != 0)
326 return -EINVAL;
Tom Riniedcfdbd2016-12-09 07:56:54 -0500327
328 return 0;
Michal Simek8faa66a2016-02-08 09:34:53 +0100329}
330#else
Michal Simek04b7e622015-01-15 10:01:51 +0100331int dram_init(void)
332{
333 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
334
335 return 0;
336}
Michal Simek8faa66a2016-02-08 09:34:53 +0100337#endif
Michal Simek04b7e622015-01-15 10:01:51 +0100338
Michal Simek04b7e622015-01-15 10:01:51 +0100339void reset_cpu(ulong addr)
340{
341}
342
Michal Simek04b7e622015-01-15 10:01:51 +0100343int board_late_init(void)
344{
345 u32 reg = 0;
346 u8 bootmode;
Michal Simekecfb6dc2016-04-22 14:28:54 +0200347 const char *mode;
348 char *new_targets;
Siva Durga Prasad Paladugue6fd3bb2017-02-21 17:58:28 +0530349 int ret;
Michal Simekecfb6dc2016-04-22 14:28:54 +0200350
351 if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
352 debug("Saved variables - Skipping\n");
353 return 0;
354 }
Michal Simek04b7e622015-01-15 10:01:51 +0100355
Siva Durga Prasad Paladugue6fd3bb2017-02-21 17:58:28 +0530356 ret = zynqmp_mmio_read((ulong)&crlapb_base->boot_mode, &reg);
357 if (ret)
358 return -EINVAL;
359
Michal Simek833e0c42016-10-25 11:43:02 +0200360 if (reg >> BOOT_MODE_ALT_SHIFT)
361 reg >>= BOOT_MODE_ALT_SHIFT;
362
Michal Simek04b7e622015-01-15 10:01:51 +0100363 bootmode = reg & BOOT_MODES_MASK;
364
Michal Simekc5d95232015-09-20 17:20:42 +0200365 puts("Bootmode: ");
Michal Simek04b7e622015-01-15 10:01:51 +0100366 switch (bootmode) {
Michal Simek12398ea2016-08-19 14:14:52 +0200367 case USB_MODE:
368 puts("USB_MODE\n");
369 mode = "usb";
Michal Simek43380352017-12-01 15:18:24 +0100370 env_set("modeboot", "usb_dfu_spl");
Michal Simek12398ea2016-08-19 14:14:52 +0200371 break;
Siva Durga Prasad Paladugu30f0fc72015-03-13 11:10:26 +0530372 case JTAG_MODE:
Michal Simekc5d95232015-09-20 17:20:42 +0200373 puts("JTAG_MODE\n");
Michal Simekecfb6dc2016-04-22 14:28:54 +0200374 mode = "pxe dhcp";
Michal Simek43380352017-12-01 15:18:24 +0100375 env_set("modeboot", "jtagboot");
Siva Durga Prasad Paladugu30f0fc72015-03-13 11:10:26 +0530376 break;
377 case QSPI_MODE_24BIT:
378 case QSPI_MODE_32BIT:
Michal Simekecfb6dc2016-04-22 14:28:54 +0200379 mode = "qspi0";
Michal Simekc5d95232015-09-20 17:20:42 +0200380 puts("QSPI_MODE\n");
Michal Simek43380352017-12-01 15:18:24 +0100381 env_set("modeboot", "qspiboot");
Siva Durga Prasad Paladugu30f0fc72015-03-13 11:10:26 +0530382 break;
Michal Simek02d66cd2015-04-15 15:02:28 +0200383 case EMMC_MODE:
Michal Simekdf7ff0a2015-10-05 15:59:38 +0200384 puts("EMMC_MODE\n");
Michal Simekecfb6dc2016-04-22 14:28:54 +0200385 mode = "mmc0";
Michal Simek43380352017-12-01 15:18:24 +0100386 env_set("modeboot", "emmcboot");
Michal Simekdf7ff0a2015-10-05 15:59:38 +0200387 break;
388 case SD_MODE:
Michal Simekc5d95232015-09-20 17:20:42 +0200389 puts("SD_MODE\n");
Michal Simekecfb6dc2016-04-22 14:28:54 +0200390 mode = "mmc0";
Michal Simek43380352017-12-01 15:18:24 +0100391 env_set("modeboot", "sdboot");
Michal Simek04b7e622015-01-15 10:01:51 +0100392 break;
Siva Durga Prasad Paladugu29a77d22016-09-21 11:45:05 +0530393 case SD1_LSHFT_MODE:
394 puts("LVL_SHFT_");
395 /* fall through */
Michal Simek108e1842015-10-05 10:51:12 +0200396 case SD_MODE1:
Michal Simekc5d95232015-09-20 17:20:42 +0200397 puts("SD_MODE1\n");
Michal Simek6d902452015-11-06 10:22:37 +0100398#if defined(CONFIG_ZYNQ_SDHCI0) && defined(CONFIG_ZYNQ_SDHCI1)
Michal Simekecfb6dc2016-04-22 14:28:54 +0200399 mode = "mmc1";
Michal Simek43380352017-12-01 15:18:24 +0100400 env_set("sdbootdev", "1");
Michal Simekecfb6dc2016-04-22 14:28:54 +0200401#else
402 mode = "mmc0";
Michal Simek6d902452015-11-06 10:22:37 +0100403#endif
Michal Simek43380352017-12-01 15:18:24 +0100404 env_set("modeboot", "sdboot");
Michal Simek108e1842015-10-05 10:51:12 +0200405 break;
406 case NAND_MODE:
Michal Simekc5d95232015-09-20 17:20:42 +0200407 puts("NAND_MODE\n");
Michal Simekecfb6dc2016-04-22 14:28:54 +0200408 mode = "nand0";
Michal Simek43380352017-12-01 15:18:24 +0100409 env_set("modeboot", "nandboot");
Michal Simek108e1842015-10-05 10:51:12 +0200410 break;
Michal Simek04b7e622015-01-15 10:01:51 +0100411 default:
Michal Simekecfb6dc2016-04-22 14:28:54 +0200412 mode = "";
Michal Simek04b7e622015-01-15 10:01:51 +0100413 printf("Invalid Boot Mode:0x%x\n", bootmode);
414 break;
415 }
416
Michal Simekecfb6dc2016-04-22 14:28:54 +0200417 /*
418 * One terminating char + one byte for space between mode
419 * and default boot_targets
420 */
421 new_targets = calloc(1, strlen(mode) +
Simon Glass64b723f2017-08-03 12:22:12 -0600422 strlen(env_get("boot_targets")) + 2);
Michal Simekecfb6dc2016-04-22 14:28:54 +0200423
Simon Glass64b723f2017-08-03 12:22:12 -0600424 sprintf(new_targets, "%s %s", mode, env_get("boot_targets"));
Simon Glass6a38e412017-08-03 12:22:09 -0600425 env_set("boot_targets", new_targets);
Michal Simekecfb6dc2016-04-22 14:28:54 +0200426
Michal Simek04b7e622015-01-15 10:01:51 +0100427 return 0;
428}
Siva Durga Prasad Paladugu650e0a32015-08-04 13:01:05 +0530429
430int checkboard(void)
431{
Michal Simek47ce9362016-01-25 11:04:21 +0100432 puts("Board: Xilinx ZynqMP\n");
Siva Durga Prasad Paladugu650e0a32015-08-04 13:01:05 +0530433 return 0;
434}
Siva Durga Prasad Paladuguba1f68e2015-08-04 13:03:26 +0530435
436#ifdef CONFIG_USB_DWC3
Michal Simekea526be2016-08-08 10:11:26 +0200437static struct dwc3_device dwc3_device_data0 = {
Siva Durga Prasad Paladuguba1f68e2015-08-04 13:03:26 +0530438 .maximum_speed = USB_SPEED_HIGH,
439 .base = ZYNQMP_USB0_XHCI_BASEADDR,
440 .dr_mode = USB_DR_MODE_PERIPHERAL,
441 .index = 0,
442};
443
Michal Simekea526be2016-08-08 10:11:26 +0200444static struct dwc3_device dwc3_device_data1 = {
445 .maximum_speed = USB_SPEED_HIGH,
446 .base = ZYNQMP_USB1_XHCI_BASEADDR,
447 .dr_mode = USB_DR_MODE_PERIPHERAL,
448 .index = 1,
449};
450
Michal Simek76d0a772016-09-01 11:16:40 +0200451int usb_gadget_handle_interrupts(int index)
Siva Durga Prasad Paladuguba1f68e2015-08-04 13:03:26 +0530452{
Michal Simek76d0a772016-09-01 11:16:40 +0200453 dwc3_uboot_handle_interrupt(index);
Siva Durga Prasad Paladuguba1f68e2015-08-04 13:03:26 +0530454 return 0;
455}
456
457int board_usb_init(int index, enum usb_init_type init)
458{
Michal Simekea526be2016-08-08 10:11:26 +0200459 debug("%s: index %x\n", __func__, index);
460
Michal Simek7987d2a2016-09-01 11:27:32 +0200461#if defined(CONFIG_USB_GADGET_DOWNLOAD)
462 g_dnl_set_serialnumber(CONFIG_SYS_CONFIG_NAME);
463#endif
464
Michal Simekea526be2016-08-08 10:11:26 +0200465 switch (index) {
466 case 0:
467 return dwc3_uboot_init(&dwc3_device_data0);
468 case 1:
469 return dwc3_uboot_init(&dwc3_device_data1);
470 };
471
472 return -1;
Siva Durga Prasad Paladuguba1f68e2015-08-04 13:03:26 +0530473}
474
475int board_usb_cleanup(int index, enum usb_init_type init)
476{
477 dwc3_uboot_exit(index);
478 return 0;
479}
480#endif