]> git.dujemihanovic.xyz Git - u-boot.git/commit
usb: dwc3-meson-g12a: force mode on child add/removal
authorMattijs Korpershoek <mkorpershoek@baylibre.com>
Wed, 23 Nov 2022 15:42:49 +0000 (16:42 +0100)
committerNeil Armstrong <neil.armstrong@linaro.org>
Tue, 17 Jan 2023 08:27:17 +0000 (09:27 +0100)
commitfd083842d719cf13d64b0ec061d3c7be98be91a2
treedab413b83353eab0bf3594b32ddba18147c93e50
parent8d9a0e6a05e31beab7e86c3ccef78f7279383a7f
usb: dwc3-meson-g12a: force mode on child add/removal

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.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20221024-meson-dm-usb-v1-1-2ab077a503b9@baylibre.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
drivers/usb/dwc3/dwc3-meson-g12a.c