linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] at91/USB: at91sam9g45 series USB host integration
       [not found]     ` <200906190226.56278.david-b@pacbell.net>
@ 2009-09-16 16:17       ` Nicolas Ferre
  2009-09-16 17:29         ` [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45 Nicolas Ferre
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Ferre @ 2009-09-16 16:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

I come back on this topic as at91sam9g45 is now in mainline. I need this
integration code to have the USB EHCI work on the evaluation kit.

David Brownell :
> On Friday 19 June 2009, Haavard Skinnemoen wrote:
>> David Brownell wrote:
>>>> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> +	/* Enable VBus control for UHP ports */
>>>> +	for (i = 0; i < data->ports; i++) {
>>>> +		if (data->vbus_pin[i])
>>>> +			at91_set_gpio_output(data->vbus_pin[i], 0);  
>>> This should gpio_request() and gpio_direction_output().
>> Hmm...I thought the driver was supposed to call gpio_request(), not the
>> platform code?
> 
> In some cases.  This isn't a good case for that.  Especially
> if it's going to call gpio_direction_output() ... which needs
> gpio_request() to have been done first.

Ok, I am building a patch on top of this one that uses these calls. This
way I can change both vbus pin configuration: OCHI and EHCI.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45
  2009-09-16 16:17       ` [PATCH 2/2] at91/USB: at91sam9g45 series USB host integration Nicolas Ferre
@ 2009-09-16 17:29         ` Nicolas Ferre
  2009-09-16 21:53           ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Ferre @ 2009-09-16 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

Change pin configuration for USB vbus on at91sam9g45: use the generic gpiolib
call instead of the at91 specific one.
Use gpio_request() function with same identifier for OHCI and EHCI hosts as
they are sharing the same pin.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
This patch is on top of at91sam9g45 USB integration one:
"[PATCH 2/2] at91/USB: at91sam9g45 series USB host integration"
http://lkml.org/lkml/2009/6/9/221

 arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 5be8cf2..7d939c0 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -118,8 +118,10 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
 
 	/* Enable VBus control for UHP ports */
 	for (i = 0; i < data->ports; i++) {
-		if (data->vbus_pin[i])
-			at91_set_gpio_output(data->vbus_pin[i], 0);
+		if (data->vbus_pin[i]) {
+			gpio_request(data->vbus_pin[i], "usb host vbus");
+			gpio_direction_output(data->vbus_pin[i], 0);
+		}
 	}
 
 	usbh_ohci_data = *data;
@@ -173,8 +175,10 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
 
 	/* Enable VBus control for UHP ports */
 	for (i = 0; i < data->ports; i++) {
-		if (data->vbus_pin[i])
-			at91_set_gpio_output(data->vbus_pin[i], 0);
+		if (data->vbus_pin[i]) {
+			gpio_request(data->vbus_pin[i], "usb host vbus");
+			gpio_direction_output(data->vbus_pin[i], 0);
+		}
 	}
 
 	usbh_ehci_data = *data;
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45
  2009-09-16 17:29         ` [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45 Nicolas Ferre
@ 2009-09-16 21:53           ` Jean-Christophe PLAGNIOL-VILLARD
  2009-09-17  8:13             ` Nicolas Ferre
  0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-09-16 21:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 19:29 Wed 16 Sep     , Nicolas Ferre wrote:
> Change pin configuration for USB vbus on at91sam9g45: use the generic gpiolib
> call instead of the at91 specific one.
> Use gpio_request() function with same identifier for OHCI and EHCI hosts as
> they are sharing the same pin.
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> This patch is on top of at91sam9g45 USB integration one:
> "[PATCH 2/2] at91/USB: at91sam9g45 series USB host integration"
> http://lkml.org/lkml/2009/6/9/221
> 
>  arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index 5be8cf2..7d939c0 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -118,8 +118,10 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
>  
>  	/* Enable VBus control for UHP ports */
>  	for (i = 0; i < data->ports; i++) {
> -		if (data->vbus_pin[i])
> -			at91_set_gpio_output(data->vbus_pin[i], 0);
> +		if (data->vbus_pin[i]) {
> +			gpio_request(data->vbus_pin[i], "usb host vbus");
> +			gpio_direction_output(data->vbus_pin[i], 0);
> +		}
>  	}
>  
>  	usbh_ohci_data = *data;
> @@ -173,8 +175,10 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
>  
>  	/* Enable VBus control for UHP ports */
>  	for (i = 0; i < data->ports; i++) {
> -		if (data->vbus_pin[i])
> -			at91_set_gpio_output(data->vbus_pin[i], 0);
> +		if (data->vbus_pin[i]) {
> +			gpio_request(data->vbus_pin[i], "usb host vbus");
> +			gpio_direction_output(data->vbus_pin[i], 0);
> +		}
>  	}
as you do the same think for ehci & ohci why not factorize it?

Best Regards,
J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45
  2009-09-16 21:53           ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-09-17  8:13             ` Nicolas Ferre
  2009-09-17  9:00               ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Ferre @ 2009-09-17  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

Jean-Christophe PLAGNIOL-VILLARD :
> On 19:29 Wed 16 Sep     , Nicolas Ferre wrote:
>> Change pin configuration for USB vbus on at91sam9g45: use the generic gpiolib
>> call instead of the at91 specific one.
>> Use gpio_request() function with same identifier for OHCI and EHCI hosts as
>> they are sharing the same pin.
>>
>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> ---
>> This patch is on top of at91sam9g45 USB integration one:
>> "[PATCH 2/2] at91/USB: at91sam9g45 series USB host integration"
>> http://lkml.org/lkml/2009/6/9/221
>>
>>  arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++----
>>  1 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
>> index 5be8cf2..7d939c0 100644
>> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
>> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
>> @@ -118,8 +118,10 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
>>  
>>  	/* Enable VBus control for UHP ports */
>>  	for (i = 0; i < data->ports; i++) {
>> -		if (data->vbus_pin[i])
>> -			at91_set_gpio_output(data->vbus_pin[i], 0);
>> +		if (data->vbus_pin[i]) {
>> +			gpio_request(data->vbus_pin[i], "usb host vbus");
>> +			gpio_direction_output(data->vbus_pin[i], 0);
>> +		}
>>  	}
>>  
>>  	usbh_ohci_data = *data;
>> @@ -173,8 +175,10 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
>>  
>>  	/* Enable VBus control for UHP ports */
>>  	for (i = 0; i < data->ports; i++) {
>> -		if (data->vbus_pin[i])
>> -			at91_set_gpio_output(data->vbus_pin[i], 0);
>> +		if (data->vbus_pin[i]) {
>> +			gpio_request(data->vbus_pin[i], "usb host vbus");
>> +			gpio_direction_output(data->vbus_pin[i], 0);
>> +		}
>>  	}
> as you do the same think for ehci & ohci why not factorize it?

Just because you may choose only one or the other controller.
For instance, if you only want ohci, you can disable ehci selection and
always have its configuration done.

Best regards,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45
  2009-09-17  8:13             ` Nicolas Ferre
@ 2009-09-17  9:00               ` Jean-Christophe PLAGNIOL-VILLARD
  2009-09-18  8:40                 ` Nicolas Ferre
  0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-09-17  9:00 UTC (permalink / raw)
  To: linux-arm-kernel

On 10:13 Thu 17 Sep     , Nicolas Ferre wrote:
> Jean-Christophe PLAGNIOL-VILLARD :
> > On 19:29 Wed 16 Sep     , Nicolas Ferre wrote:
> >> Change pin configuration for USB vbus on at91sam9g45: use the generic gpiolib
> >> call instead of the at91 specific one.
> >> Use gpio_request() function with same identifier for OHCI and EHCI hosts as
> >> they are sharing the same pin.
> >>
> >> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> >> ---
> >> This patch is on top of at91sam9g45 USB integration one:
> >> "[PATCH 2/2] at91/USB: at91sam9g45 series USB host integration"
> >> http://lkml.org/lkml/2009/6/9/221
> >>
> >>  arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++----
> >>  1 files changed, 8 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> >> index 5be8cf2..7d939c0 100644
> >> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> >> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> >> @@ -118,8 +118,10 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
> >>  
> >>  	/* Enable VBus control for UHP ports */
> >>  	for (i = 0; i < data->ports; i++) {
> >> -		if (data->vbus_pin[i])
> >> -			at91_set_gpio_output(data->vbus_pin[i], 0);
> >> +		if (data->vbus_pin[i]) {
> >> +			gpio_request(data->vbus_pin[i], "usb host vbus");
> >> +			gpio_direction_output(data->vbus_pin[i], 0);
> >> +		}
> >>  	}
> >>  
> >>  	usbh_ohci_data = *data;
> >> @@ -173,8 +175,10 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
> >>  
> >>  	/* Enable VBus control for UHP ports */
> >>  	for (i = 0; i < data->ports; i++) {
> >> -		if (data->vbus_pin[i])
> >> -			at91_set_gpio_output(data->vbus_pin[i], 0);
> >> +		if (data->vbus_pin[i]) {
> >> +			gpio_request(data->vbus_pin[i], "usb host vbus");
> >> +			gpio_direction_output(data->vbus_pin[i], 0);
> >> +		}
> >>  	}
> > as you do the same think for ehci & ohci why not factorize it?
> 
> Just because you may choose only one or the other controller.
> For instance, if you only want ohci, you can disable ehci selection and
> always have its configuration done.
I agree but both configuration function share some code which could be
factorize, is it not?

Best Regards,
J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45
  2009-09-17  9:00               ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-09-18  8:40                 ` Nicolas Ferre
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Ferre @ 2009-09-18  8:40 UTC (permalink / raw)
  To: linux-arm-kernel

Jean-Christophe PLAGNIOL-VILLARD :
> On 10:13 Thu 17 Sep     , Nicolas Ferre wrote:
>> Jean-Christophe PLAGNIOL-VILLARD :
>>> On 19:29 Wed 16 Sep     , Nicolas Ferre wrote:
>>>> Change pin configuration for USB vbus on at91sam9g45: use the generic gpiolib
>>>> call instead of the at91 specific one.
>>>> Use gpio_request() function with same identifier for OHCI and EHCI hosts as
>>>> they are sharing the same pin.
>>>>
>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>>>> ---
>>>> This patch is on top of at91sam9g45 USB integration one:
>>>> "[PATCH 2/2] at91/USB: at91sam9g45 series USB host integration"
>>>> http://lkml.org/lkml/2009/6/9/221
>>>>
>>>>  arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++----
>>>>  1 files changed, 8 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> index 5be8cf2..7d939c0 100644
>>>> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
>>>> @@ -118,8 +118,10 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
>>>>  
>>>>  	/* Enable VBus control for UHP ports */
>>>>  	for (i = 0; i < data->ports; i++) {
>>>> -		if (data->vbus_pin[i])
>>>> -			at91_set_gpio_output(data->vbus_pin[i], 0);
>>>> +		if (data->vbus_pin[i]) {
>>>> +			gpio_request(data->vbus_pin[i], "usb host vbus");
>>>> +			gpio_direction_output(data->vbus_pin[i], 0);
>>>> +		}
>>>>  	}
>>>>  
>>>>  	usbh_ohci_data = *data;
>>>> @@ -173,8 +175,10 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
>>>>  
>>>>  	/* Enable VBus control for UHP ports */
>>>>  	for (i = 0; i < data->ports; i++) {
>>>> -		if (data->vbus_pin[i])
>>>> -			at91_set_gpio_output(data->vbus_pin[i], 0);
>>>> +		if (data->vbus_pin[i]) {
>>>> +			gpio_request(data->vbus_pin[i], "usb host vbus");
>>>> +			gpio_direction_output(data->vbus_pin[i], 0);
>>>> +		}
>>>>  	}
>>> as you do the same think for ehci & ohci why not factorize it?
>> Just because you may choose only one or the other controller.
>> For instance, if you only want ohci, you can disable ehci selection and
>> always have its configuration done.
> I agree but both configuration function share some code which could be
> factorize, is it not?

Well it is true that it is duplication *but* we are talking about only a
very few lines with very linear configuration instructions.
I do not think it is even worth doing.

Bye,
-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-09-18  8:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1244547493-19654-1-git-send-email-nicolas.ferre@atmel.com>
     [not found] ` <200906190043.00428.david-b@pacbell.net>
     [not found]   ` <20090619095148.67a74ed9@hskinnemoen-d830>
     [not found]     ` <200906190226.56278.david-b@pacbell.net>
2009-09-16 16:17       ` [PATCH 2/2] at91/USB: at91sam9g45 series USB host integration Nicolas Ferre
2009-09-16 17:29         ` [PATCH] at91: use gpiolib calls for USB vbus pin on at91sam9g45 Nicolas Ferre
2009-09-16 21:53           ` Jean-Christophe PLAGNIOL-VILLARD
2009-09-17  8:13             ` Nicolas Ferre
2009-09-17  9:00               ` Jean-Christophe PLAGNIOL-VILLARD
2009-09-18  8:40                 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).