mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Daniel Mack <daniel@zonque.org>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Arnd Bergmann <arnd@arndb.de>, Linus Walleij <linusw@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination
Date: Thu, 17 Sep 2026 17:56:27 +0200	[thread overview]
Message-ID: <20260917155657.2200191-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2026-09-17 15:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 15:56 Arnd Bergmann [this message]
2026-09-17 22:31 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260917155657.2200191-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=daniel@zonque.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=johan@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robert.jarzmik@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®