[PATCH 1/2] usb: dwc3-meson-gxl: force mode on child add/removal

Marek Vasut marex at denx.de
Tue Jan 17 11:06:58 CET 2023


On 1/17/23 10:43, Mattijs Korpershoek wrote:
> On Tue, Jan 17, 2023 at 10:11, Neil Armstrong <neil.armstrong at linaro.org> wrote:
> 
>> arch/mach-meson has some custom usb logic, in particular:
>> * on board_usb_init(), we force USB_DR_MODE_PERIPHERAL
>> * on board_usb_cleanup(), we force USB_DR_MODE_HOST
>>
>> With DM_USB_GADGET=y, board_usb_init/cleanup() are no
>> longer used when we call usb_gadget_initialize().
>> Instead, the generic (from udc-uclass) initialization/release is
>> called, which itself calls the controller driver's probe()/remove().
>>
>> Therefore, enabling DM_USB_GADGET=y will mean that this mode
>> switching will break.
>>
>> To prepare for enabling DM_USB_GADGET, perform the mode switching
>> when the "amlogic,meson-g12a-usb" (dwc2) driver is
>> probed()/removed() instead.
>>
>> This is achieved via the glue driver, which gets notified each time one
>> of its children is probed()/removed.
>>
>> Note: this change should be harmless without DM_USB_GADGET=y
>> because the amlogic-g12a-usb driver is not probed via driver model.
>>
>> Thanks for Mattijs for the original work at [1].
>>
>> [1] https://lore.kernel.org/all/20221024-meson-dm-usb-v1-1-2ab077a503b9@baylibre.com/
>>
>> Signed-off-by: Neil Armstrong <neil.armstrong at linaro.org>
> 
> Thank you for mentioning me, I appreciate it.
> 
> Reviewed-by: Mattijs Korpershoek <mkorpershoek at baylibre.com>

Reviewed-by: Marek Vasut <marex at denx.de>

Feel free to pull via amlogic tree, so it goes together with the config 
change.


More information about the U-Boot mailing list