[PATCH v2 0/2] usb: dwc3: Fix build without driver model

Hi everyone,
Platform with DWC3 that need USB support in the SPL might not be able to use the driver model there while the main u-boot is using driver model. This series allow building with such a configuration, it first fix 2 warnings when the core is built without driver model and then fix the SPL linking when one of the glue driver is enabled for the main u-boot.
Changelog:
v2: Use __maybe_unused instead of an #ifdef
Alban Bedel (2): usb: dwc3: core: fix warnings when building without driver model usb: dwc3: Don't build DM drivers in SPL unless DM USB is available
drivers/usb/dwc3/Makefile | 9 ++++++--- drivers/usb/dwc3/core.c | 5 ++--- 2 files changed, 8 insertions(+), 6 deletions(-)

Commit f150b8d28b4e (usb: dwc3: Enable undefined length INCR burst type) introduced code that assign the content of dwc->dev to a variable. But in u-boot the type of this field changes if building with driver model enabled or not. As this variable is then only used once just remove it and use the struct field directly.
Another issued was also introduced in fb146fbc1ae5 (usb: dwc3: core: stop the core when it's removed) which define a static function which is only used when the driver model is enabled. Mark this function with __maybe_unused to supress the warning when building without driver model.
Signed-off-by: Alban Bedel alban.bedel@aerq.com --- v2: Use __maybe_unused instead of an #ifdef --- drivers/usb/dwc3/core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b592a487e001..2107a2993309 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -465,7 +465,6 @@ static void dwc3_phy_setup(struct dwc3 *dwc) /* set global incr burst type configuration registers */ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) { - struct udevice *dev = dwc->dev; u32 cfg;
if (!dwc->incrx_size) @@ -502,7 +501,7 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) case 1: break; default: - dev_err(dev, "Invalid property\n"); + dev_err(dwc->dev, "Invalid property\n"); break; }
@@ -706,7 +705,7 @@ static void dwc3_gadget_run(struct dwc3 *dwc) mdelay(100); }
-static void dwc3_core_stop(struct dwc3 *dwc) +static void __maybe_unused dwc3_core_stop(struct dwc3 *dwc) { u32 reg;

Most platform glue drivers need DM USB, if one of these driver is enabled along with SPL without DM the build break. As the SPL might still want to use the core DWC3 put the DM glue drivers under ifdef CONFIG_$(SPL_)DM_USB.
Signed-off-by: Alban Bedel alban.bedel@aerq.com --- drivers/usb/dwc3/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile index 0dd1ba87cd94..34355048b7af 100644 --- a/drivers/usb/dwc3/Makefile +++ b/drivers/usb/dwc3/Makefile @@ -7,10 +7,13 @@ dwc3-y := core.o obj-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o
obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o +obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o +obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o +obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o + +ifdef CONFIG_$(SPL_)DM_USB obj-$(CONFIG_USB_DWC3_MESON_G12A) += dwc3-meson-g12a.o obj-$(CONFIG_USB_DWC3_MESON_GXL) += dwc3-meson-gxl.o obj-$(CONFIG_USB_DWC3_GENERIC) += dwc3-generic.o -obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o obj-$(CONFIG_USB_DWC3_LAYERSCAPE) += dwc3-layerscape.o -obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o -obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o +endif

On Wed, 2022-04-20 at 11:26 +0200, Alban Bedel wrote:
Hi everyone,
Platform with DWC3 that need USB support in the SPL might not be able to use the driver model there while the main u-boot is using driver model. This series allow building with such a configuration, it first fix 2 warnings when the core is built without driver model and then fix the SPL linking when one of the glue driver is enabled for the main u-boot.
Any chance this series get considered?
Alban
participants (2)
-
Alban Bedel
-
Bedel, Alban