[U-Boot] [PATCH 00/16] usb: convert dwc2 gadget to driver model, used in stm32mp1

Patrick DELAUNAY
2019-04-01T12:29:43Z

Hi,

> From: Jack Mitchell <ml@embed.me.uk>
> Sent: lundi 1 avril 2019 12:38
>
>
> On 01/04/2019 10:49, Patrick DELAUNAY wrote:
> >> From: Jack Mitchell <ml@embed.me.uk>
> >> Sent: samedi 30 mars 2019 12:42
> >>
> >> On 29/03/2019 14:42, Patrick Delaunay wrote:
> >>> This patch-set created after Marek remarks on patch
> >>> board: stm32mp1: Add tx_fifo_sz_array support
> >>> http://patchwork.ozlabs.org/patch/1056452/
> >>>
> >>> This serie convert the DWC2 to driver model and use it for the
> >>> stm32mp1 boards.
> >>>
> >>> USB device and cable connection tested on EV1 and DK2.
> >>>
> >>> This serie superseded the Patrice patches:
> >>> http://patchwork.ozlabs.org/project/uboot/list/?series=97121
> >>>
> >>> Warning: the serie need to be apply after
> >>> http://patchwork.ozlabs.org/project/uboot/list/?series=91422
> >>> http://patchwork.ozlabs.org/project/uboot/list/?series=91497
> >> Hi Patrice,
> >>
> >> The second patch series doesn't apply cleanly anymore, could you
> >> rebase and resend so I can test this series?
> > Hi,
> > Yes, I have many pending series for the next releases on stm32mp1 arch and
> for the 2 baord ev1 and dk2.
> > So many conflicts.
> >
> > I willl push a rebase this week,
> > but you can use my downstream branch (based on v2019.04) with all the
> > upstreamed patches, including the last one for USB; I have already
> > solve the issues:
> >
> > https://github.com/patrickdelaunay/u-boot/tree/v2019.04-stm32mp
>
> Thanks Patrick (and apologies for the previous wrong name),

:-)

> the reason I ask is
> I'm testing an rk3288 with the DM_USB_GADGET support enabled for it's dwc2
> OTG controller. The controller still works without DM_USB_GADGET enabled, but
> it fails to enumerate any USB devices when it is enabled. Is there anything
> specific required apart from enabling DM_USB_GADGET?
>
> => usb start
> starting USB...
> scan end
> No controllers found
> =>

I just add CONFIG_DM_USB_GADGET

But I also need to add a alias "usb0"

arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi

/ {
aliases {
gpio26 = &stmfx_pinctrl;
i2c1 = &i2c2;
i2c4 = &i2c5;
pinctrl2 = &stmfx_pinctrl;
spi0 = &qspi;
+ usb0 = &usbotg_hs;
};
};

The alias 'usb0" is needed to selecte the correct sed number

drivers/usb/gadget/udc/udc-uclass.c

int usb_gadget_initialize(int index)

udc-uclass.c: ret = uclass_get_device_by_seq(UCLASS_USB_GADGET_GENERIC, index, &dev);

I spent some time to found it.

PS: sequence number is defined by alias in UCLASS :

UCLASS_DRIVER(usb_gadget_generic) = {
.id = UCLASS_USB_GADGET_GENERIC,
.name = "usb",
.flags = DM_UC_FLAG_SEQ_ALIAS,
};

Regards
Patrick