Skip to contentSkip to conversation

USB: gadget: pxa25x: support additional IXP425 steppings

PATCH New Steve Bennett 4 participants 8 messages Mar 23, 2010 – Apr 23, 2010 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Here is a trivial patch to add support pxa25x_udc for additional IXP steppings.

Please let me know if I should send this anywhere else/instead.

Cheers,
Steve
--
?Web: Embedded Web Framework - http://uweb.workware.net.au/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-USB-gadget-pxa25x-support-additional-IXP425-stepping.patch
Type: application/octet-stream
Size: 1167 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100323/4d800319/attachment.obj>

#1 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Zitat von Steve Bennett <[email protected]>:

Quoted 4 lines

Here is a trivial patch to add support pxa25x_udc for additional IXP steppings.

Please let me know if I should send this anywhere else/instead.

Your patch really is not the right approach.

I had a similar patch some time ago[1]. This driver part should actually be reworked to not use that ifdef and switch-case thing (and not read the cpu id register itself, either).

[1]: http://www.spinics.net/lists/arm-kernel/msg62009.html

I am not up-to-date how far Russell got with his proposed changes.

HS

#2 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Quoted 9 lines · Hendrik Sattler

Zitat von Steve Bennett <[email protected]>:

Quoted 4 lines

Here is a trivial patch to add support pxa25x_udc for additional IXP steppings.

Please let me know if I should send this anywhere else/instead.

Your patch really is not the right approach.

Quoted 7 lines

I had a similar patch some time ago[1]. This driver part should actually be reworked to not use that ifdef and switch-case thing (and not read the cpu id register itself, either).

[1]: http://www.spinics.net/lists/arm-kernel/msg62009.html

I am not up-to-date how far Russell got with his proposed changes.

HS

Thanks. I see Russell's proposed patch at http://www.spinics.net/lists/arm-kernel/msg63303.html

Doesn't look like this got any further. It's been a year now (which is why I missed this thread).

Russell, is there something stopping us going with your patch? Does it just need some updating/testing?

Cheers,
Steve
--
?Web: Embedded Web Framework - http://uweb.workware.net.au/

#3 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Quoted 1 line · Steve Bennett

Russell, is there something stopping us going with your patch?

Nothing really - only lack of motivation and sufficient reason to make the change.

Quoted 1 line

Does it just need some updating/testing?

After a year, it certainly will do.

#4 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Quoted 9 lines · Russell King - ARM Linux
Quoted 1 line · Steve Bennett

Russell, is there something stopping us going with your patch?

Nothing really - only lack of motivation and sufficient reason to make the change.

Quoted 1 line

Does it just need some updating/testing?

After a year, it certainly will do.

OK. Your patch and Hendrik's are largely independent. If I update Hendrik's patch will that do? Something like this:

drivers/usb/gadget/pxa25x_udc.c +14 -60
index be5fb34..b63b65c 100644
@@ -2096,39 +2096,11 @@ static struct pxa25x_udc memory = {
 #endif /* !CONFIG_USB_PXA25X_SMALL */
 };
 
-#define CP15R0_VENDOR_MASK	0xffffe000
-
-#if	defined(CONFIG_ARCH_PXA)
-#define CP15R0_XSCALE_VALUE	0x69052000	/* intel/arm/xscale */
-
-#elif	defined(CONFIG_ARCH_IXP4XX)
-#define CP15R0_XSCALE_VALUE	0x69054000	/* intel/arm/ixp4xx */
-
-#endif
-
 #define CP15R0_PROD_MASK	0x000003f0
-#define PXA25x			0x00000100	/* and PXA26x */
-#define PXA210			0x00000120
-
 #define CP15R0_REV_MASK		0x0000000f
-
 #define CP15R0_PRODREV_MASK	(CP15R0_PROD_MASK | CP15R0_REV_MASK)
 
 #define PXA255_A0		0x00000106	/* or PXA260_B1 */
-#define PXA250_C0		0x00000105	/* or PXA26x_B0 */
-#define PXA250_B2		0x00000104
-#define PXA250_B1		0x00000103	/* or PXA260_A0 */
-#define PXA250_B0		0x00000102
-#define PXA250_A1		0x00000101
-#define PXA250_A0		0x00000100
-
-#define PXA210_C0		0x00000125
-#define PXA210_B2		0x00000124
-#define PXA210_B1		0x00000123
-#define PXA210_B0		0x00000122
-#define IXP425_A0		0x000001c1
-#define IXP425_B0		0x000001f1
-#define IXP465_AD		0x00000200
 
 /*
  *	probe - binds to the platform device
@@ -2137,42 +2109,24 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
 {
 	struct pxa25x_udc *dev = &memory;
 	int retval, vbus_irq, irq;
-	u32 chiprev;
 
-	/* insist on Intel/ARM/XScale */
-	asm("mrc%? p15, 0, %0, c0, c0" : "=r" (chiprev));
-	if ((chiprev & CP15R0_VENDOR_MASK) != CP15R0_XSCALE_VALUE) {
-		pr_err("%s: not XScale!\n", driver_name);
-		return -ENODEV;
-	}
+#if defined(CONFIG_ARCH_PXA)
+	if (cpu_is_pxa210() || cpu_is_pxa25x()) {
+		if ((read_cpuid_id() & CP15R0_PRODREV_MASK) == PXA255_A0)
+			dev->has_cfr = 1;
+		/* PXA250_A0/A1 "not released"; ep 13, 15 unusable */
+		/* PXA21x/PXA25x with stepping < C0: OUT-DMA is broken ... */
+	} else {
 
-	/* trigger chiprev-specific logic */
-	switch (chiprev & CP15R0_PRODREV_MASK) {
-#if	defined(CONFIG_ARCH_PXA)
-	case PXA255_A0:
-		dev->has_cfr = 1;
-		break;
-	case PXA250_A0:
-	case PXA250_A1:
-		/* A0/A1 "not released"; ep 13, 15 unusable */
-		/* fall through */
-	case PXA250_B2: case PXA210_B2:
-	case PXA250_B1: case PXA210_B1:
-	case PXA250_B0: case PXA210_B0:
-		/* OUT-DMA is broken ... */
-		/* fall through */
-	case PXA250_C0: case PXA210_C0:
-		break;
-#elif	defined(CONFIG_ARCH_IXP4XX)
-	case IXP425_A0:
-	case IXP425_B0:
-	case IXP465_AD:
+#elif defined(CONFIG_ARCH_IXP4XX)
+	if (cpu_is_ixp42x() || cpu_is_ixp43x() || cpu_is_ixp46x())
 		dev->has_cfr = 1;
-		break;
+	else {
+
+#else
+	{
 #endif
-	default:
-		pr_err("%s: unrecognized processor: %08x\n",
-			driver_name, chiprev);
+		pr_err("%s: unrecognized processor\n", driver_name);
 		/* iop3xx, ixp4xx, ... */
 		return -ENODEV;
 	}

Steve
--
?Web: Embedded Web Framework - http://uweb.workware.net.au/

#5 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Use generic cpu_is_...
Modified version of patch by Hendrik Sattler

---
 drivers/usb/gadget/pxa25x_udc.c |   74 +++++++-------------------------------
 1 files changed, 14 insertions(+), 60 deletions(-)
drivers/usb/gadget/pxa25x_udc.c +14 -60
index be5fb34..b63b65c 100644
@@ -2096,39 +2096,11 @@ static struct pxa25x_udc memory = {
 #endif /* !CONFIG_USB_PXA25X_SMALL */
 };
 
-#define CP15R0_VENDOR_MASK	0xffffe000
-
-#if	defined(CONFIG_ARCH_PXA)
-#define CP15R0_XSCALE_VALUE	0x69052000	/* intel/arm/xscale */
-
-#elif	defined(CONFIG_ARCH_IXP4XX)
-#define CP15R0_XSCALE_VALUE	0x69054000	/* intel/arm/ixp4xx */
-
-#endif
-
 #define CP15R0_PROD_MASK	0x000003f0
-#define PXA25x			0x00000100	/* and PXA26x */
-#define PXA210			0x00000120
-
 #define CP15R0_REV_MASK		0x0000000f
-
 #define CP15R0_PRODREV_MASK	(CP15R0_PROD_MASK | CP15R0_REV_MASK)
 
 #define PXA255_A0		0x00000106	/* or PXA260_B1 */
-#define PXA250_C0		0x00000105	/* or PXA26x_B0 */
-#define PXA250_B2		0x00000104
-#define PXA250_B1		0x00000103	/* or PXA260_A0 */
-#define PXA250_B0		0x00000102
-#define PXA250_A1		0x00000101
-#define PXA250_A0		0x00000100
-
-#define PXA210_C0		0x00000125
-#define PXA210_B2		0x00000124
-#define PXA210_B1		0x00000123
-#define PXA210_B0		0x00000122
-#define IXP425_A0		0x000001c1
-#define IXP425_B0		0x000001f1
-#define IXP465_AD		0x00000200
 
 /*
  *	probe - binds to the platform device
@@ -2137,42 +2109,24 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
 {
 	struct pxa25x_udc *dev = &memory;
 	int retval, vbus_irq, irq;
-	u32 chiprev;
 
-	/* insist on Intel/ARM/XScale */
-	asm("mrc%? p15, 0, %0, c0, c0" : "=r" (chiprev));
-	if ((chiprev & CP15R0_VENDOR_MASK) != CP15R0_XSCALE_VALUE) {
-		pr_err("%s: not XScale!\n", driver_name);
-		return -ENODEV;
-	}
+#if defined(CONFIG_ARCH_PXA)
+	if (cpu_is_pxa210() || cpu_is_pxa25x()) {
+		if ((read_cpuid_id() & CP15R0_PRODREV_MASK) == PXA255_A0)
+			dev->has_cfr = 1;
+		/* PXA250_A0/A1 "not released"; ep 13, 15 unusable */
+		/* PXA21x/PXA25x with stepping < C0: OUT-DMA is broken ... */
+	} else {
 
-	/* trigger chiprev-specific logic */
-	switch (chiprev & CP15R0_PRODREV_MASK) {
-#if	defined(CONFIG_ARCH_PXA)
-	case PXA255_A0:
-		dev->has_cfr = 1;
-		break;
-	case PXA250_A0:
-	case PXA250_A1:
-		/* A0/A1 "not released"; ep 13, 15 unusable */
-		/* fall through */
-	case PXA250_B2: case PXA210_B2:
-	case PXA250_B1: case PXA210_B1:
-	case PXA250_B0: case PXA210_B0:
-		/* OUT-DMA is broken ... */
-		/* fall through */
-	case PXA250_C0: case PXA210_C0:
-		break;
-#elif	defined(CONFIG_ARCH_IXP4XX)
-	case IXP425_A0:
-	case IXP425_B0:
-	case IXP465_AD:
+#elif defined(CONFIG_ARCH_IXP4XX)
+	if (cpu_is_ixp42x() || cpu_is_ixp43x() || cpu_is_ixp46x())
 		dev->has_cfr = 1;
-		break;
+	else {
+
+#else
+	{
 #endif
-	default:
-		pr_err("%s: unrecognized processor: %08x\n",
-			driver_name, chiprev);
+		pr_err("%s: unrecognized processor\n", driver_name);
 		/* iop3xx, ixp4xx, ... */
 		return -ENODEV;
 	}
Signature · 1 line
1.7.0.3
#6 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

Am Freitag 23 April 2010 03:48:59 schrieb Steve Bennett:

Quoted 4 lines

Use generic cpu_is_...
Modified version of patch by Hendrik Sattler

I'd really like to see this go in.

Quoted 106 lines
---
 drivers/usb/gadget/pxa25x_udc.c |   74

+++++++------------------------------- 1 files changed, 14 insertions(+), 60 deletions(-)

(quoted diff) +0 -0

b/drivers/usb/gadget/pxa25x_udc.c index be5fb34..b63b65c 100644

drivers/usb/gadget/pxa25x_udc.c +14 -60
@@ -2096,39 +2096,11 @@ static struct pxa25x_udc memory = {
 #endif /* !CONFIG_USB_PXA25X_SMALL */
 };
 
-#define CP15R0_VENDOR_MASK	0xffffe000
-
-#if	defined(CONFIG_ARCH_PXA)
-#define CP15R0_XSCALE_VALUE	0x69052000	/* intel/arm/xscale */
-
-#elif	defined(CONFIG_ARCH_IXP4XX)
-#define CP15R0_XSCALE_VALUE	0x69054000	/* intel/arm/ixp4xx */
-
-#endif
-
 #define CP15R0_PROD_MASK	0x000003f0
-#define PXA25x			0x00000100	/* and PXA26x */
-#define PXA210			0x00000120
-
 #define CP15R0_REV_MASK		0x0000000f
-
 #define CP15R0_PRODREV_MASK	(CP15R0_PROD_MASK | CP15R0_REV_MASK)
 
 #define PXA255_A0		0x00000106	/* or PXA260_B1 */
-#define PXA250_C0		0x00000105	/* or PXA26x_B0 */
-#define PXA250_B2		0x00000104
-#define PXA250_B1		0x00000103	/* or PXA260_A0 */
-#define PXA250_B0		0x00000102
-#define PXA250_A1		0x00000101
-#define PXA250_A0		0x00000100
-
-#define PXA210_C0		0x00000125
-#define PXA210_B2		0x00000124
-#define PXA210_B1		0x00000123
-#define PXA210_B0		0x00000122
-#define IXP425_A0		0x000001c1
-#define IXP425_B0		0x000001f1
-#define IXP465_AD		0x00000200
 
 /*
  *	probe - binds to the platform device
@@ -2137,42 +2109,24 @@ static int __init pxa25x_udc_probe(struct
 platform_device *pdev) {
 	struct pxa25x_udc *dev = &memory;
 	int retval, vbus_irq, irq;
-	u32 chiprev;
 
-	/* insist on Intel/ARM/XScale */
-	asm("mrc%? p15, 0, %0, c0, c0" : "=r" (chiprev));
-	if ((chiprev & CP15R0_VENDOR_MASK) != CP15R0_XSCALE_VALUE) {
-		pr_err("%s: not XScale!\n", driver_name);
-		return -ENODEV;
-	}
+#if defined(CONFIG_ARCH_PXA)
+	if (cpu_is_pxa210() || cpu_is_pxa25x()) {
+		if ((read_cpuid_id() & CP15R0_PRODREV_MASK) == PXA255_A0)
+			dev->has_cfr = 1;
+		/* PXA250_A0/A1 "not released"; ep 13, 15 unusable */
+		/* PXA21x/PXA25x with stepping < C0: OUT-DMA is broken ... */
+	} else {
 
-	/* trigger chiprev-specific logic */
-	switch (chiprev & CP15R0_PRODREV_MASK) {
-#if	defined(CONFIG_ARCH_PXA)
-	case PXA255_A0:
-		dev->has_cfr = 1;
-		break;
-	case PXA250_A0:
-	case PXA250_A1:
-		/* A0/A1 "not released"; ep 13, 15 unusable */
-		/* fall through */
-	case PXA250_B2: case PXA210_B2:
-	case PXA250_B1: case PXA210_B1:
-	case PXA250_B0: case PXA210_B0:
-		/* OUT-DMA is broken ... */
-		/* fall through */
-	case PXA250_C0: case PXA210_C0:
-		break;
-#elif	defined(CONFIG_ARCH_IXP4XX)
-	case IXP425_A0:
-	case IXP425_B0:
-	case IXP465_AD:
+#elif defined(CONFIG_ARCH_IXP4XX)
+	if (cpu_is_ixp42x() || cpu_is_ixp43x() || cpu_is_ixp46x())
 		dev->has_cfr = 1;
-		break;
+	else {
+
+#else
+	{
 #endif
-	default:
-		pr_err("%s: unrecognized processor: %08x\n",
-			driver_name, chiprev);
+		pr_err("%s: unrecognized processor\n", driver_name);
 		/* iop3xx, ixp4xx, ... */
 		return -ENODEV;
 	}
#7 lore raw

PATCH 1/1 USB: gadget: pxa25x: support additional IXP425 steppings

In reply to Steve Bennett
Quoted 4 lines · Steve Bennett

Here is a trivial patch to add support pxa25x_udc for additional IXP steppings.

Please let me know if I should send this anywhere else/instead.

Looks good. You also need to provide the "Signed-off-by" line as per Documentation/SubmittingPatches.

Signature · 1 line
Krzysztof Halasa