summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2026-03-06 08:13:47 -0600
committerTom Rini <[email protected]>2026-03-06 08:15:44 -0600
commit47dabe3b96ea8f79edf574a0e141a156b227455c (patch)
treee3d8f405971c458c76909749acd929da791152cb /drivers
parentb1f56667065a9e49743e74c04d3d3fc3c86f1035 (diff)
parent4cf2275ee741d318c46c2ccef4c5db905f186d79 (diff)
Merge branch 'master' of git://source.denx.de/u-boot-usb into next
- Change the address parsing for MUSB and another patch to add compatibles for ti,musb-am33xx and bind functions that check the dr_mode.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/musb-new/ti-musb.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index bcd31adba52..cc6c3b94a65 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -83,17 +83,17 @@ static int ti_musb_of_to_plat(struct udevice *dev)
struct ti_musb_plat *plat = dev_get_plat(dev);
const void *fdt = gd->fdt_blob;
int node = dev_of_offset(dev);
- int phys;
- int ctrl_mod;
+ ofnode phys_node;
+ ofnode ctrl_mod_node;
int usb_index;
int ret;
struct musb_hdrc_config *musb_config;
plat->base = devfdt_get_addr_index_ptr(dev, 1);
- phys = fdtdec_lookup_phandle(fdt, node, "phys");
- ctrl_mod = fdtdec_lookup_phandle(fdt, phys, "ti,ctrl_mod");
- plat->ctrl_mod_base = (void *)fdtdec_get_addr(fdt, ctrl_mod, "reg");
+ phys_node = ofnode_get_by_phandle(dev_read_u32_default(dev, "phys", 0));
+ ctrl_mod_node = ofnode_get_by_phandle(ofnode_read_u32_default(phys_node, "ti,ctrl_mod", 0));
+ plat->ctrl_mod_base = (void *)ofnode_get_addr(ctrl_mod_node);
usb_index = ti_musb_get_usb_index(node);
switch (usb_index) {
case 1:
@@ -183,6 +183,21 @@ static int ti_musb_host_remove(struct udevice *dev)
}
#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);
@@ -206,6 +221,8 @@ U_BOOT_DRIVER(ti_musb_host) = {
.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,
@@ -221,6 +238,16 @@ struct ti_musb_peripheral {
};
#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);
@@ -283,6 +310,8 @@ U_BOOT_DRIVER(ti_musb_peripheral) = {
.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,