Skip to contentSkip to conversation

Voipac PXA270: UDC and UHC support

PATCH New Marek Vasut 3 participants 11 messages Mar 10, 2010 – Mar 22, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Hi,
this patch adds UDC and UHC support (and formating fix, I hope you dont mind Eric).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Voipac-PXA270-UDC-and-UHC-support.patch
Type: text/x-patch
Size: 3741 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100310/c93850bd/attachment.bin>

#1 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Dne St 10. b?ezna 2010 05:43:00 Marek Vasut napsal(a):

Quoted 6 lines

Hi,
this patch adds UDC and UHC support (and formating fix, I hope you dont
mind Eric).

revised patch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Voipac-PXA270-UDC-and-UHC-support.patch
Type: text/x-patch
Size: 3192 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100310/8990412b/attachment.bin>

#2 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Quoted 8 lines · Marek Vasut

Dne St 10. b?ezna 2010 05:43:00 Marek Vasut napsal(a):

Quoted 6 lines

Hi,
this patch adds UDC and UHC support (and formating fix, I hope you dont
mind Eric).

revised patch

snip

Review

Quoted 7 lines
(quoted diff) +7 -0
+/******************************************************************************
+ * USB Gadget
+ ******************************************************************************/
+#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
+static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
+	.gpio_vbus		= GPIO41_VPAC270_UDC_DETECT,
+};

That won't work I think. gpio_vbus is not dealt with by pxa27x_udc. The way to go would rather be something like :

#include <linux/usb/gpio_vbus.h>
static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
.gpio_pullup = <to be filled in>,
};

struct gpio_vbus_mach_info gpio_vbus_data = {
        .gpio_vbus = GPIO41_VPAC270_UDC_DETECT,
        .gpio_vbus_inverted = 0,
        .gpio_pullup = -1,
};

Add add a "gpio_vbus" device, with platform_data set to gpio_vbus_data.

As a matter of fact, there are not a lot of cases where an UDC can work without :
- a GPIO for pullup
- or the udc_command() callback implemented
The only working case I see is a hardwired D+ pin to the Vdd, but that seems an exterme in board design I've never met before. This lets me think you should find and the add the correct GPIO for pullup.

Cheers.

--
Robert

#3 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Dne P? 12. b?ezna 2010 18:49:54 Robert Jarzmik napsal(a):

Quoted 36 lines
Quoted 8 lines · Marek Vasut

Dne St 10. b?ezna 2010 05:43:00 Marek Vasut napsal(a):

Quoted 5 lines

Hi,
this patch adds UDC and UHC support (and formating fix, I hope you dont
mind Eric).

revised patch

snip

Review

Quoted 9 lines

+/*********************************************************************** ******* + * USB Gadget
+
*************************************************************************
*****/ +#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODUL
E) +static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {

(quoted diff) +2 -0
+	.gpio_vbus		= GPIO41_VPAC270_UDC_DETECT,
+};

That won't work I think. gpio_vbus is not dealt with by pxa27x_udc. The way to go would rather be something like :

#include <linux/usb/gpio_vbus.h>
static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
.gpio_pullup = <to be filled in>,
};

struct gpio_vbus_mach_info gpio_vbus_data = {
        .gpio_vbus = GPIO41_VPAC270_UDC_DETECT,
        .gpio_vbus_inverted = 0,
        .gpio_pullup = -1,
};
Quoted 8 lines

Add add a "gpio_vbus" device, with platform_data set to gpio_vbus_data.

As a matter of fact, there are not a lot of cases where an UDC can work
without : - a GPIO for pullup
- or the udc_command() callback implemented
The only working case I see is a hardwired D+ pin to the Vdd, but that
seems an exterme in board design I've never met before. This lets me think you should find and the add the correct GPIO for pullup.

Could you tell me which one pullup gpio is ? Here's the schematic:
http://www.voipac.com/downloads/pxa/270/baseboard/doc/bb270v22sch.pdf

Thanks

Quoted 6 lines

Cheers.

--
Robert

#4 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

In reply to Robert Jarzmik

Dne P? 12. b?ezna 2010 18:49:54 Robert Jarzmik napsal(a):

Quoted 45 lines
Quoted 8 lines · Marek Vasut

Dne St 10. b?ezna 2010 05:43:00 Marek Vasut napsal(a):

Quoted 5 lines

Hi,
this patch adds UDC and UHC support (and formating fix, I hope you dont
mind Eric).

revised patch

snip

Review

Quoted 9 lines

+/*********************************************************************** ******* + * USB Gadget
+
*************************************************************************
*****/ +#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODUL
E) +static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {

(quoted diff) +2 -0
+	.gpio_vbus		= GPIO41_VPAC270_UDC_DETECT,
+};

That won't work I think. gpio_vbus is not dealt with by pxa27x_udc. The way to go would rather be something like :

#include <linux/usb/gpio_vbus.h>
static struct pxa2xx_udc_mach_info vpac270_udc_info __initdata = {
.gpio_pullup = <to be filled in>,
};

struct gpio_vbus_mach_info gpio_vbus_data = {
        .gpio_vbus = GPIO41_VPAC270_UDC_DETECT,
        .gpio_vbus_inverted = 0,
        .gpio_pullup = -1,
};

Add add a "gpio_vbus" device, with platform_data set to gpio_vbus_data.

As a matter of fact, there are not a lot of cases where an UDC can work
without : - a GPIO for pullup
- or the udc_command() callback implemented
The only working case I see is a hardwired D+ pin to the Vdd, but that
seems an exterme in board design I've never met before. This lets me think you should find and the add the correct GPIO for pullup.

Quoted 5 lines

Cheers.

--
Robert

Updated patch attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Voipac-PXA270-UDC-and-UHC-support.patch
Type: text/x-patch
Size: 4188 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100313/3ecfd342/attachment.bin>

#5 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Quoted 10 lines · Marek Vasut

Dne P? 12. b?ezna 2010 18:49:54 Robert Jarzmik napsal(a):

Quoted 9 lines
Quoted 8 lines · Marek Vasut

Dne St 10. b?ezna 2010 05:43:00 Marek Vasut napsal(a):

Quoted 5 lines

Hi,
this patch adds UDC and UHC support (and formating fix, I hope you dont
mind Eric).

revised patch

Yes, I feel that one much better.

One minor comments remain for me.

Quoted 13 lines
(quoted diff) +13 -0
+/******************************************************************************
+ * USB Gadget
+ ******************************************************************************/
+#if defined(CONFIG_USB_GADGET_PXA27X)||defined(CONFIG_USB_GADGET_PXA27X_MODULE)
+static struct gpio_vbus_mach_info vpac270_gpio_vbus_info = {
+	.gpio_vbus		= GPIO41_VPAC270_UDC_DETECT,
+	.gpio_pullup		= -1,
+};
+
+static struct platform_device vpac270_gpio_vbus = {
+	.name	= "gpio-vbus",
+	.id	= -1,
+	.dev	= {

Review

Quoted 10 lines
(quoted diff) +10 -0
+		.platform_data	= &vpac270_gpio_vbus_info,
+	},
+};
+
+static void vpac270_udc_command(int cmd) 
+{
+	if (cmd == PXA2XX_UDC_CMD_CONNECT)
+		UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+	else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+		UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);

In the "DISCONNECT" case, you reset UP2OCR_HXOE, meaning the usb port isn't a USB Device anymore (neither a USB host). If that's on purpose, then all good, in the other case, don't reset that one.

Otherwise, you can add for the UDC part :

Signature · 1 line
Robert
#6 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Quoted 11 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+static void vpac270_udc_command(int cmd)
+{
+ ? ? if (cmd == PXA2XX_UDC_CMD_CONNECT)
+ ? ? ? ? ? ? UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+ ? ? else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+ ? ? ? ? ? ? UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);

In the "DISCONNECT" case, you reset UP2OCR_HXOE, meaning the usb port isn't a USB Device anymore (neither a USB host). If that's on purpose, then all good, in the other case, don't reset that one.

Marek??

Quoted 6 lines

Otherwise, you can add for the UDC part :

--
Robert

#7 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Dne Po 22. b?ezna 2010 02:57:33 Eric Miao napsal(a):

Quoted 11 lines
Quoted 10 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+static void vpac270_udc_command(int cmd)
+{
+     if (cmd == PXA2XX_UDC_CMD_CONNECT)
+             UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+     else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+             UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);

In the "DISCONNECT" case, you reset UP2OCR_HXOE, meaning the usb port isn't a USB Device anymore (neither a USB host). If that's on purpose, then all good, in the other case, don't reset that one.

Quoted 1 line

Marek??

I wasn't able to get it running without reseting the HXOE (so it's there based on my tests with the hardware). I'll have to investigate it properly when I have more time.

So Eric, could you push this in? I'll send a fix if I figure out something's wrong here.

Thanks

Quoted 7 lines
Quoted 6 lines

Otherwise, you can add for the UDC part :

--
Robert

#8 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Quoted 12 lines · Marek Vasut

Dne Po 22. b?ezna 2010 02:57:33 Eric Miao napsal(a):

Quoted 11 lines
Quoted 10 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+static void vpac270_udc_command(int cmd)
+{
+ ? ? if (cmd == PXA2XX_UDC_CMD_CONNECT)
+ ? ? ? ? ? ? UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+ ? ? else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+ ? ? ? ? ? ? UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE);

In the "DISCONNECT" case, you reset UP2OCR_HXOE, meaning the usb port isn't a USB Device anymore (neither a USB host). If that's on purpose, then all good, in the other case, don't reset that one.

Quoted 9 lines
Quoted 1 line

Marek??

I wasn't able to get it running without reseting the HXOE (so it's there based on my tests with the hardware). I'll have to investigate it properly when I have more time.

So Eric, could you push this in? I'll send a fix if I figure out something's wrong here.

Could you modify the patch a bit to leave a NOTE there in the commit message so we can track? As well as Robert's reviewed-by. Thanks.

#9 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Dne Po 22. b?ezna 2010 05:04:28 Eric Miao napsal(a):

Quoted 20 lines · Marek Vasut
Quoted 19 lines

Dne Po 22. b?ezna 2010 02:57:33 Eric Miao napsal(a):

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
(quoted diff) +6 -0
+static void vpac270_udc_command(int cmd)
+{
+     if (cmd == PXA2XX_UDC_CMD_CONNECT)
+             UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+     else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+             UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE |

UP2OCR_DPPUBE);

In the "DISCONNECT" case, you reset UP2OCR_HXOE, meaning the usb port isn't a USB Device anymore (neither a USB host). If that's on purpose, then all good, in the other case, don't reset that one.

Quoted 1 line

Marek??

I wasn't able to get it running without reseting the HXOE (so it's there based on my tests with the hardware). I'll have to investigate it properly when I have more time.

Quoted 7 lines
Quoted 2 lines

So Eric, could you push this in? I'll send a fix if I figure out something's wrong here.

Could you modify the patch a bit to leave a NOTE there in the commit message so we can track? As well as Robert's reviewed-by. Thanks.

Updated patch included
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Voipac-PXA270-UDC-and-UHC-support.patch
Type: text/x-patch
Size: 4421 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100322/f9f50e9e/attachment.bin>

Applied
#10 lore raw

PATCH 1/1 Voipac PXA270: UDC and UHC support

Quoted 21 lines · Marek Vasut

Dne Po 22. b?ezna 2010 05:04:28 Eric Miao napsal(a):

Quoted 20 lines · Marek Vasut
Quoted 19 lines

Dne Po 22. b?ezna 2010 02:57:33 Eric Miao napsal(a):

Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
(quoted diff) +6 -0
+static void vpac270_udc_command(int cmd)
+{
+ ? ? if (cmd == PXA2XX_UDC_CMD_CONNECT)
+ ? ? ? ? ? ? UP2OCR |= UP2OCR_HXOE | UP2OCR_DPPUE | UP2OCR_DPPUBE;
+ ? ? else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
+ ? ? ? ? ? ? UP2OCR &= ~(UP2OCR_HXOE | UP2OCR_DPPUE |

UP2OCR_DPPUBE);

In the "DISCONNECT" case, you reset UP2OCR_HXOE, meaning the usb port isn't a USB Device anymore (neither a USB host). If that's on purpose, then all good, in the other case, don't reset that one.

Quoted 1 line

Marek??

I wasn't able to get it running without reseting the HXOE (so it's there based on my tests with the hardware). I'll have to investigate it properly when I have more time.

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

So Eric, could you push this in? I'll send a fix if I figure out something's wrong here.

Could you modify the patch a bit to leave a NOTE there in the commit message so we can track? As well as Robert's reviewed-by. Thanks.

Updated patch included

Applied to 'devel'.