}
#if CONFIG_IS_ENABLED(OF_CONTROL)
+static const struct udevice_id ti_musb_host_periph_ids[] = {
+ { .compatible = "ti,musb-am33xx" },
+ { }
+};
+
+static int ti_musb_host_bind(struct udevice *dev)
+{
+ enum usb_dr_mode dr_mode = usb_get_dr_mode(dev_ofnode(dev));
+
+ if (dr_mode != USB_DR_MODE_HOST && dr_mode != USB_DR_MODE_OTG)
+ return -ENODEV;
+
+ return 0;
+}
+
static int ti_musb_host_of_to_plat(struct udevice *dev)
{
struct ti_musb_plat *plat = dev_get_plat(dev);
.name = "ti-musb-host",
.id = UCLASS_USB,
#if CONFIG_IS_ENABLED(OF_CONTROL)
+ .of_match = ti_musb_host_periph_ids,
+ .bind = ti_musb_host_bind,
.of_to_plat = ti_musb_host_of_to_plat,
#endif
.probe = ti_musb_host_probe,
};
#if CONFIG_IS_ENABLED(OF_CONTROL)
+static int ti_musb_peripheral_bind(struct udevice *dev)
+{
+ enum usb_dr_mode dr_mode = usb_get_dr_mode(dev_ofnode(dev));
+
+ if (dr_mode != USB_DR_MODE_PERIPHERAL)
+ return -ENODEV;
+
+ return 0;
+}
+
static int ti_musb_peripheral_of_to_plat(struct udevice *dev)
{
struct ti_musb_plat *plat = dev_get_plat(dev);
.name = "ti-musb-peripheral",
.id = UCLASS_USB_GADGET_GENERIC,
#if CONFIG_IS_ENABLED(OF_CONTROL)
+ .of_match = ti_musb_host_periph_ids,
+ .bind = ti_musb_peripheral_bind,
.of_to_plat = ti_musb_peripheral_of_to_plat,
#endif
.ops = &ti_musb_gadget_ops,