On 1/11/24 08:42, Michal Simek wrote:
First of all I think this should be more RFC.

On 1/11/24 08:10, Venkatesh Yadav Abbarapu wrote:
Usb5744 & usb2244 are Microchip based usbhub and usb-2.0 based SD
controller devices. Integrate these devices into dwc3 driver to bind and
probe the respective drivers to get detected by usb controller.

Signed-off-by: T Karthik Reddy <[email protected]>
Signed-off-by: Venkatesh Yadav Abbarapu <[email protected]>
---
  drivers/usb/dwc3/dwc3-generic.c | 67 ++++++++++++++++++++++++---------
  1 file changed, 49 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 6fb2de8a5a..a2eb2c8e24 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -430,29 +430,49 @@ static int dwc3_glue_bind_common(struct udevice *parent, ofnode node)
      debug("%s: subnode name: %s\n", __func__, name);
+    if (!ofnode_device_is_compatible(node, "snps,dwc3")) {
+        if (ofnode_device_is_compatible(node,
+                        "microchip,usb5744"))
+                driver = "usb5744";
+        else if (ofnode_device_is_compatible
+            (node, "microchip,usb2244"))
+                driver = "usb2244";
+
+            ret = device_bind_driver_to_node(parent, driver, name,
+                             node, &dev);
+            if (ret) {
+                printf("Failed to bind: %s, err: %d\n",
+                       driver, ret);
+                return ret;
+            }
+    }

I don't think this is going to be accepted by Marek to have device specific code in generic code. I did some grepping and I see that there is new CONFIG_USB_ONBOARD_HUB entry. Don't understand why it is in common folder if this is pretty much device specific. But there is a new UCLASS_USB_HUB class.

Venkatesh: it should be investigated more how it works.

Marek: IIRC you mentioned any support for companion/peer hubs.
How do you think it should be integrated to u-boot?

See common/usb_onboard_hub.c .

Reply via email to