1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2015 Google, Inc
8 DECLARE_GLOBAL_DATA_PTR;
10 #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
12 #include <usb/dwc2_udc.h>
14 static struct dwc2_plat_otg_data otg_data = {
20 int board_usb_init(int index, enum usb_init_type init)
25 const void *blob = gd->fdt_blob;
27 /* find the usb_otg node */
28 node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc2");
31 mode = fdt_getprop(blob, node, "dr_mode", NULL);
32 if (mode && strcmp(mode, "otg") == 0) {
37 node = fdt_node_offset_by_compatible(blob, node, "snps,dwc2");
40 debug("Not found usb_otg device\n");
43 otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
45 return dwc2_udc_probe(&otg_data);
48 int board_usb_cleanup(int index, enum usb_init_type init)