On 12/31/23 9:38 PM, Aren Moynihan wrote:
Add support for building the sunxi-musb driver with DM_USB_GADGET
including adding a separate IRQ handling function and registering the
driver with the musb system differently.
The implementation of usb_gadget_register_driver from
musb-new/musb_uboot.c only works when the gadget driver for the device
has already been probed and has called musb_register. On the pinephone
(using a allwinner a64 processor) this causes issues when trying to use
usb gadget mode (such as from the ums command) and CONFIG_USB_ETHER is
disabled.
The implementation of usb_gadget_register_driver provided when
DM_USB_GADGET is enabled will probe the necessary drivers when it's
called.
Without the patch, this is what the error condition looks like:
=> ums 0 mmc 1
UMS: LUN 0, dev mmc 1, hwpart 0, sector 0x0, count 0x3a3e000
Controller uninitialized
g_dnl_register: failed!, error: -6
g_dnl_register failed
based on:
commit 2e4865bc6486 ("musb-new: omap2430: fix compiling in DM_USB_GADGET
config")
Signed-off-by: Aren Moynihan <a...@peacevolution.org>
---
I don't fully understand what's going on here. Some gadget mode drivers,
such as usb ether (in usb_ether_init) will initialize the usb gadget
driver, but others (ums, fastboot) don't seem to do this, or don't do it
early enough, so they don't work.
drivers/usb/musb-new/sunxi.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 91f082fe05e..9b06f49ce47 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -429,6 +429,17 @@ static struct musb_hdrc_config musb_config_h3 = {
.ram_bits = SUNXI_MUSB_RAM_BITS,
};
+#ifdef CONFIG_DM_USB_GADGET
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+ int n = 0;
Is this used for anything?
+CC Mattijs