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 rv1108_otg_data = {
20 int board_usb_init(int index, enum usb_init_type init)
22 const void *blob = gd->fdt_blob;
28 /* find the usb_otg node */
29 node = fdt_node_offset_by_compatible(blob, -1, "rockchip,rk3066-usb");
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,
38 "rockchip,rk3066-usb");
42 debug("usb_otg device not found\n");
46 rv1108_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg");
48 node = fdtdec_lookup_phandle(blob, node, "phys");
50 debug("phys node not found\n");
54 phy_node = fdt_parent_offset(blob, node);
56 debug("usb phy node not found\n");
60 rv1108_otg_data.phy_of_node = phy_node;
61 grf_phy_offset = fdtdec_get_addr(blob, node, "reg");
63 /* find the grf node */
64 node = fdt_node_offset_by_compatible(blob, -1,
65 "rockchip,rv1108-grf");
67 debug("grf node not found\n");
71 rv1108_otg_data.regs_phy = grf_phy_offset + fdtdec_get_addr(blob, node,
74 return dwc2_udc_probe(&rv1108_otg_data);
77 int board_usb_cleanup(int index, enum usb_init_type init)