[PATCH] usb: musb-new: sunxi: support usage with DM_USB_GADGET

Aren aren at peacevolution.org
Sat Apr 13 00:54:21 CEST 2024


On Thu, Apr 11, 2024 at 04:46:17PM +1000, John Watts wrote:
> On Sun, Dec 31, 2023 at 03:38:37PM -0500, 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.
> 
> Hi there,
> 
> Were you aware of this similar patch?
> 
> https://lore.kernel.org/u-boot/20230608195631.55364-1-CFSworks@gmail.com/
> 
> If not you might want to test it and compare it.
> 
> John.

I was not aware of that patch, it looks like it does the same thing as
this one, but without some of the bugs. When comparing with it I
realized that my dm_usb_gadget_handle_interrupts function is just plain
wrong.

I'll try to find time to test it soon.

Thanks for the link
 - Aren

> > 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 <aren at peacevolution.org>


More information about the U-Boot mailing list