usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination
Subsystems (2)
PATCH 1/1 usb: gadget: pxa25x: prevent ixp4xx + pxa25x combination
From: Arnd Bergmann <[email protected]>
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.
--- drivers/usb/gadget/udc/Kconfig | 1 + drivers/usb/gadget/udc/pxa25x_udc.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/usb/gadget/udc/Kconfig +1 -0
@@ -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
drivers/usb/gadget/udc/pxa25x_udc.c +4 -4
@@ -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 ;
Signature · 1 line
2.53.0
Quoted 26 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
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 | #defineUDCCS_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
Kconfigdependency, and rework the driver to allow a combined ixp4xx/pxa3xx kernel that only uses this driver on ixp.
Quoted 2 lines
Cc Linus Walleij <[email protected]>Signed-off-by Arnd Bergmann <[email protected]>
That's a reasonable fix. It's not like we would want an actual multi_* kernel on these devices anyway.
Yours,
Linus Walleij