Skip to contentSkip to conversation

Eurotech Zeus : Making USB port 2 work

PATCH New Amit Walambe 2 participants 4 messages Feb 10, 2010 – Feb 11, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Eurotech Zeus : Making USB port 2 work

Hi,
The attached patch adds support for the second USB port of Arcom/Eurotech Zeus SBC. Currently only port 1 works. The patch sets the power enabling GPIO for port 2 and corrects the port initialisation flags.
Please accept.
Thanks and regards,
- Amit

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eurotech_zeus_usb_port2.patch
Type: text/x-patch
Size: 1649 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100210/ea474a58/attachment-0001.bin>

#1 lore raw

PATCH 1/1 Eurotech Zeus : Making USB port 2 work

On Wed, February 10, 2010 06:35, Amit Walambe wrote:

Hi Amit,

Quoted 4 lines

The attached patch adds support for the second USB port of Arcom/Eurotech Zeus SBC. Currently only port 1 works. The patch sets the power enabling GPIO for port 2 and corrects the port initialisation flags.

Thanks for having a look at this. Comments below:

Quoted 13 lines

Index: linux-2.6.33-rc6/arch/arm/mach-pxa/zeus.c
===================================================================

arch/arm/mach-pxa/zeus.c +0 -1
@@ -482,7 +482,6 @@
 {
 	int err;
 
-	/* Switch on port 2. */
 	if ((err = gpio_request(ZEUS_USB2_PWREN_GPIO, "USB2_PWREN"))) {
 		dev_err(dev, "Can't request USB2_PWREN\n");
 		return err;

arch/arm/mach-pxa/zeus.c line 498

Quoted 6 lines
arch/arm/mach-pxa/zeus.c +3 -0
@@ -494,6 +493,9 @@
 		return err;
 	}
 
+	/* Switch on port 2. */
+	gpio_set_value(ZEUS_USB2_PWREN_GPIO, 1);
+

ZEUS_USB2_PWREN_GPIO is already set to one a few lines above (see call to gpio_direction_output).

arch/arm/mach-pxa/zeus.c line 509

Quoted 9 lines
arch/arm/mach-pxa/zeus.c +1 -0
 	/* Port 2 is shared between host and client interface. */
 	UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
 
@@ -503,13 +505,16 @@
 static void zeus_ohci_exit(struct device *dev)
 {
 	/* Power-off port 2 */
+	gpio_set_value(ZEUS_USB2_PWREN_GPIO, 0);
 	gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 0);

Same here.

arch/arm/mach-pxa/zeus.c line 517

Quoted 9 lines
arch/arm/mach-pxa/zeus.c +3 -1
 	gpio_free(ZEUS_USB2_PWREN_GPIO);
 }
 
 static struct pxaohci_platform_data zeus_ohci_platform_data = {
 	.port_mode	= PMM_NPS_MODE,
-	.flags		= ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
+	/* Clear Power Control Polarity Low and set Power Sense
+	 * Polarity Low. Supply power to USB ports. */
+	.flags		= ENABLE_PORT_ALL | ~(POWER_CONTROL_LOW) | POWER_SENSE_LOW,

I suppose that is actually what makes it work, though the change is rather suspect. You're basically setting *all* bits to 1, except for POWER_CONTROL_LOW, and I don't think that's the expected behaviour. Could you try the following instead:

.flags = ENABLE_PORT_ALL | POWER_SENSE_LOW,

Additionally, you can try adding NO_OC_PROTECTION or OC_MODE_PERPORT if the above doesn't work. This is a bit of a shot in the dark, as I'm currently far away from my Zeus board and can't directly test it.

arch/arm/mach-pxa/zeus.c line 845

Quoted 9 lines
arch/arm/mach-pxa/zeus.c +1 -1
 	.init		= zeus_ohci_init,
 	.exit		= zeus_ohci_exit,
 };
@@ -837,7 +842,7 @@
 	PCFR = PCFR_OPDE | PCFR_DC_EN | PCFR_FS | PCFR_FP;
 }
 
-MACHINE_START(ARCOM_ZEUS, "Arcom ZEUS")
+MACHINE_START(ARCOM_ZEUS, "Arcom/Eurotech ZEUS")

Please sent this as a separate patch, including a Signed-off-by: line.

Thanks,

        M.
Signature · 1 line
And if you don't know where you're going, any road will take you there...
#2 lore raw

PATCH 1/1 Eurotech Zeus : Making USB port 2 work

Hi!
Thanks for your comments Marc.

Quoted 11 lines · On Wed, 10 Feb 2010 09:38:38 -0000 (GMT) "Marc Zyngier" <[email protected]>…
Quoted 8 lines

static struct pxaohci_platform_data zeus_ohci_platform_data = {

(quoted diff) +0 -1
 	.port_mode	= PMM_NPS_MODE,
-	.flags		= ENABLE_PORT_ALL |

POWER_CONTROL_LOW | POWER_SENSE_LOW,

(quoted diff) +3 -0
+	/* Clear Power Control Polarity Low and set Power Sense
+	 * Polarity Low. Supply power to USB ports. */
+	.flags		= ENABLE_PORT_ALL |

~(POWER_CONTROL_LOW) | POWER_SENSE_LOW,

I suppose that is actually what makes it work, though the change is rather suspect. You're basically setting *all* bits to 1

My bad. Attaching a modified patch. I have tested it on a Zeus and it works ok.

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-MACHINE_START(ARCOM_ZEUS, "Arcom ZEUS")
+MACHINE_START(ARCOM_ZEUS, "Arcom/Eurotech ZEUS")

Please sent this as a separate patch, including a Signed-off-by: line.

Please see attached.

Quoted 3 lines

Thanks,

        M.

Thanks and regards,
- Amit

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arcom-to-eurotech.patch
Type: text/x-patch
Size: 667 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100211/e0396c8d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eurotech_zeus_usb_port2.patch
Type: text/x-patch
Size: 829 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100211/e0396c8d/attachment-0001.bin>

#3 lore raw

PATCH 1/1 Eurotech Zeus : Making USB port 2 work

Quoted 16 lines · Amit Walambe

Hi!
Thanks for your comments Marc.

Quoted 11 lines · On Wed, 10 Feb 2010 09:38:38 -0000 (GMT) "Marc Zyngier" <[email protected]>…
Quoted 8 lines

static struct pxaohci_platform_data zeus_ohci_platform_data = {

(quoted diff) +0 -1
 	.port_mode	= PMM_NPS_MODE,
-	.flags		= ENABLE_PORT_ALL |

POWER_CONTROL_LOW | POWER_SENSE_LOW,

(quoted diff) +3 -0
+	/* Clear Power Control Polarity Low and set Power Sense
+	 * Polarity Low. Supply power to USB ports. */
+	.flags		= ENABLE_PORT_ALL |

~(POWER_CONTROL_LOW) | POWER_SENSE_LOW,

I suppose that is actually what makes it work, though the change is rather suspect. You're basically setting *all* bits to 1

Quoted 2 lines

My bad. Attaching a modified patch. I have tested it on a Zeus and it works ok.

Thanks. Both patches queued for 2.6.34.

        M.
Signature · 1 line
And if you don't know where you're going, any road will take you there...