mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination
@ 2026-09-17 15:56 Arnd Bergmann
  2026-09-17 22:31 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-09-17 15:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Daniel Mack, Haojian Zhuang, Robert Jarzmik
  Cc: Arnd Bergmann, Linus Walleij, Johan Hovold, linux-usb,
	linux-kernel, linux-arm-kernel

From: Arnd Bergmann <arnd@arndb.de>

The USB gadget driver is one of the holdouts of Arm single-platform
support that conflicts with a multiplatform kernel. Trying to
build this for both Intel PXA and IXP fails with:

drivers/usb/gadget/udc/pxa25x_udc.c:144:9: error: 'UDCCS_IO_ROF' redefined [-Werror]
  144 | #define UDCCS_IO_ROF    (1 << 2)        /* Receive overflow */
      |         ^~~~~~~~~~~~
drivers/usb/gadget/udc/pxa25x_udc.c:141:9: note: this is the location of the previous definition
  141 | #define UDCCS_IO_ROF    (1 << 3)        /* Receive overflow */
      |         ^~~~~~~~~~~~
drivers/usb/gadget/udc/pxa25x_udc.c:232:2: error: #error "Can't configure both IXP and PXA"
  232 | #error "Can't configure both IXP and PXA"

Until recently this was not a problem, as ixp4xx was only big-endian
and pxa is only little-endian, so these could never be in the same
kernel image.

As this has changed recently, an allmodconfig kernel for ARMv5 runs
into the above failure. I don't think this is an important scenario
in practice, especially as pxa25x support is already rather broken,
so prevent this configuration using a Kconfig dependency, and
rework the driver to allow a combined ixp4xx/pxa3xx kernel that
only uses this driver on ixp.

Cc: Linus Walleij <linusw@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/usb/gadget/udc/Kconfig      | 1 +
 drivers/usb/gadget/udc/pxa25x_udc.c | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig
index 7ddbc2606686..5142f70b6f3a 100644
--- a/drivers/usb/gadget/udc/Kconfig
+++ b/drivers/usb/gadget/udc/Kconfig
@@ -126,6 +126,7 @@ config USB_OMAP
 config USB_PXA25X
 	tristate "PXA 25x or IXP 4xx"
 	depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX
+	depends on !(PXA25x && ARCH_IXP4XX)
 	depends on HAS_IOMEM
 	help
 	   Intel's PXA 25x series XScale ARM-5TE processors include
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index 594d67193763..7e158ca73fa1 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -140,7 +140,7 @@
 #ifdef CONFIG_ARCH_IXP4XX /* FIXME: is this right?, datasheed says '2' */
 #define UDCCS_IO_ROF	(1 << 3)	/* Receive overflow */
 #endif
-#ifdef CONFIG_ARCH_PXA
+#ifdef CONFIG_PXA25x
 #define UDCCS_IO_ROF	(1 << 2)	/* Receive overflow */
 #endif
 #define UDCCS_IO_DME	(1 << 3)	/* DMA enable */
@@ -228,7 +228,7 @@ static const char ep0name [] = "ep0";
 #ifdef CONFIG_ARCH_IXP4XX
 
 /* cpu-specific register addresses are compiled in to this code */
-#ifdef CONFIG_ARCH_PXA
+#ifdef CONFIG_PXA25x
 #error "Can't configure both IXP and PXA"
 #endif
 
@@ -2230,7 +2230,7 @@ static struct pxa25x_udc memory = {
 
 #define CP15R0_VENDOR_MASK	0xffffe000
 
-#if	defined(CONFIG_ARCH_PXA)
+#if	defined(CONFIG_PXA25x)
 #define CP15R0_XSCALE_VALUE	0x69052000	/* intel/arm/xscale */
 
 #elif	defined(CONFIG_ARCH_IXP4XX)
@@ -2282,7 +2282,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
 
 	/* trigger chiprev-specific logic */
 	switch (chiprev & CP15R0_PRODREV_MASK) {
-#if	defined(CONFIG_ARCH_PXA)
+#if	defined(CONFIG_PXA25x)
 	case PXA255_A0:
 		dev->has_cfr = 1;
 		break;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination
  2026-09-17 15:56 [PATCH] usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination Arnd Bergmann
@ 2026-09-17 22:31 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2026-09-17 22:31 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Kroah-Hartman, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Arnd Bergmann, Johan Hovold, linux-usb, linux-kernel,
	linux-arm-kernel

On Thu, Sep 17, 2026 at 5:57 PM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> The USB gadget driver is one of the holdouts of Arm single-platform
> support that conflicts with a multiplatform kernel. Trying to
> build this for both Intel PXA and IXP fails with:
>
> drivers/usb/gadget/udc/pxa25x_udc.c:144:9: error: 'UDCCS_IO_ROF' redefined [-Werror]
>   144 | #define UDCCS_IO_ROF    (1 << 2)        /* Receive overflow */
>       |         ^~~~~~~~~~~~
> drivers/usb/gadget/udc/pxa25x_udc.c:141:9: note: this is the location of the previous definition
>   141 | #define UDCCS_IO_ROF    (1 << 3)        /* Receive overflow */
>       |         ^~~~~~~~~~~~
> drivers/usb/gadget/udc/pxa25x_udc.c:232:2: error: #error "Can't configure both IXP and PXA"
>   232 | #error "Can't configure both IXP and PXA"
>
> Until recently this was not a problem, as ixp4xx was only big-endian
> and pxa is only little-endian, so these could never be in the same
> kernel image.
>
> As this has changed recently, an allmodconfig kernel for ARMv5 runs
> into the above failure. I don't think this is an important scenario
> in practice, especially as pxa25x support is already rather broken,
> so prevent this configuration using a Kconfig dependency, and
> rework the driver to allow a combined ixp4xx/pxa3xx kernel that
> only uses this driver on ixp.
>
> Cc: Linus Walleij <linusw@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

That's a reasonable fix. It's not like we would want an actual multi_*
kernel on these devices anyway.
Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-17 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 15:56 [PATCH] usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination Arnd Bergmann
2026-09-17 22:31 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®