diff mbox

[U-Boot,7/8] smdk5420: Correct the vbus gpio configuration for USB controller

Message ID 1389000583-20758-8-git-send-email-gautam.vivek@samsung.com
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Commit Message

Vivek Gautam Jan. 6, 2014, 9:29 a.m. UTC
On smdk5420 two availbale XHCI controllers require VBUS GPIO
to be configured, the EHCI however doesn't have any such VBUS
GPIO. So correcting the available board_usb_vbus_init() function
to the needs.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
---
 board/samsung/smdk5420/smdk5420.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Marek Vasut Jan. 6, 2014, 3:52 p.m. UTC | #1
On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
> On smdk5420 two availbale XHCI controllers require VBUS GPIO
> to be configured, the EHCI however doesn't have any such VBUS
> GPIO. So correcting the available board_usb_vbus_init() function
> to the needs.
> 
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> ---
>  board/samsung/smdk5420/smdk5420.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/board/samsung/smdk5420/smdk5420.c
> b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
> --- a/board/samsung/smdk5420/smdk5420.c
> +++ b/board/samsung/smdk5420/smdk5420.c
> @@ -18,14 +18,15 @@
> 
>  DECLARE_GLOBAL_DATA_PTR;
> 
> -#ifdef CONFIG_USB_EHCI_EXYNOS
> +#ifdef CONFIG_USB_XHCI_EXYNOS
>  static int board_usb_vbus_init(void)
>  {
> -	struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> -						samsung_get_base_gpio_part1();
> +	struct exynos5420_gpio_part4 *gpio4 = (struct exynos5420_gpio_part4 *)
> +						samsung_get_base_gpio_part4();
> 
>  	/* Enable VBUS power switch */
> -	s5p_gpio_direction_output(&gpio1->x2, 6, 1);
> +	s5p_gpio_direction_output(&gpio4->g0, 5, 1);
> +	s5p_gpio_direction_output(&gpio4->g1, 4, 1);

This VBUS toggling should happen on per-port basis, right ?

Best regards,
Marek Vasut
Vivek Gautam Jan. 7, 2014, 6:37 a.m. UTC | #2
Hi Marek,


On Mon, Jan 6, 2014 at 9:22 PM, Marek Vasut <marex@denx.de> wrote:
> On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
>> On smdk5420 two availbale XHCI controllers require VBUS GPIO
>> to be configured, the EHCI however doesn't have any such VBUS
>> GPIO. So correcting the available board_usb_vbus_init() function
>> to the needs.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> ---
>>  board/samsung/smdk5420/smdk5420.c |   11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/board/samsung/smdk5420/smdk5420.c
>> b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
>> --- a/board/samsung/smdk5420/smdk5420.c
>> +++ b/board/samsung/smdk5420/smdk5420.c
>> @@ -18,14 +18,15 @@
>>
>>  DECLARE_GLOBAL_DATA_PTR;
>>
>> -#ifdef CONFIG_USB_EHCI_EXYNOS
>> +#ifdef CONFIG_USB_XHCI_EXYNOS
>>  static int board_usb_vbus_init(void)
>>  {
>> -     struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
>> -                                             samsung_get_base_gpio_part1();
>> +     struct exynos5420_gpio_part4 *gpio4 = (struct exynos5420_gpio_part4 *)
>> +                                             samsung_get_base_gpio_part4();
>>
>>       /* Enable VBUS power switch */
>> -     s5p_gpio_direction_output(&gpio1->x2, 6, 1);
>> +     s5p_gpio_direction_output(&gpio4->g0, 5, 1);
>> +     s5p_gpio_direction_output(&gpio4->g1, 4, 1);
>
> This VBUS toggling should happen on per-port basis, right ?

No this VBUS gpio toggling is actually enabling the VBUS line of the controller.
And since we have 2 controllers on exynos5420, so added the required 2
gpios for the purpose
(GPG0[5], and GPG1[4]).

>
> Best regards,
> Marek Vasut
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Marek Vasut Jan. 7, 2014, 7:49 a.m. UTC | #3
On Tuesday, January 07, 2014 at 07:37:46 AM, Vivek Gautam wrote:
> Hi Marek,
> 
> On Mon, Jan 6, 2014 at 9:22 PM, Marek Vasut <marex@denx.de> wrote:
> > On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
> >> On smdk5420 two availbale XHCI controllers require VBUS GPIO
> >> to be configured, the EHCI however doesn't have any such VBUS
> >> GPIO. So correcting the available board_usb_vbus_init() function
> >> to the needs.
> >> 
> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> >> ---
> >> 
> >>  board/samsung/smdk5420/smdk5420.c |   11 ++++++-----
> >>  1 file changed, 6 insertions(+), 5 deletions(-)
> >> 
> >> diff --git a/board/samsung/smdk5420/smdk5420.c
> >> b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
> >> --- a/board/samsung/smdk5420/smdk5420.c
> >> +++ b/board/samsung/smdk5420/smdk5420.c
> >> @@ -18,14 +18,15 @@
> >> 
> >>  DECLARE_GLOBAL_DATA_PTR;
> >> 
> >> -#ifdef CONFIG_USB_EHCI_EXYNOS
> >> +#ifdef CONFIG_USB_XHCI_EXYNOS
> >> 
> >>  static int board_usb_vbus_init(void)
> >>  {
> >> 
> >> -     struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> >> -                                            
> >> samsung_get_base_gpio_part1(); +     struct exynos5420_gpio_part4
> >> *gpio4 = (struct exynos5420_gpio_part4 *) +                            
> >>                 samsung_get_base_gpio_part4();
> >> 
> >>       /* Enable VBUS power switch */
> >> 
> >> -     s5p_gpio_direction_output(&gpio1->x2, 6, 1);
> >> +     s5p_gpio_direction_output(&gpio4->g0, 5, 1);
> >> +     s5p_gpio_direction_output(&gpio4->g1, 4, 1);
> > 
> > This VBUS toggling should happen on per-port basis, right ?
> 
> No this VBUS gpio toggling is actually enabling the VBUS line of the
> controller. And since we have 2 controllers on exynos5420, so added the
> required 2 gpios for the purpose
> (GPG0[5], and GPG1[4]).

So if I understand this correctly, it should happen on per-controller basis 
then?

Best regards,
Marek Vasut
Vivek Gautam Jan. 7, 2014, 9:03 a.m. UTC | #4
On Tue, Jan 7, 2014 at 1:19 PM, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, January 07, 2014 at 07:37:46 AM, Vivek Gautam wrote:
>> Hi Marek,
>>
>> On Mon, Jan 6, 2014 at 9:22 PM, Marek Vasut <marex@denx.de> wrote:
>> > On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
>> >> On smdk5420 two availbale XHCI controllers require VBUS GPIO
>> >> to be configured, the EHCI however doesn't have any such VBUS
>> >> GPIO. So correcting the available board_usb_vbus_init() function
>> >> to the needs.
>> >>
>> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> >> ---
>> >>
>> >>  board/samsung/smdk5420/smdk5420.c |   11 ++++++-----
>> >>  1 file changed, 6 insertions(+), 5 deletions(-)
>> >>
>> >> diff --git a/board/samsung/smdk5420/smdk5420.c
>> >> b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
>> >> --- a/board/samsung/smdk5420/smdk5420.c
>> >> +++ b/board/samsung/smdk5420/smdk5420.c
>> >> @@ -18,14 +18,15 @@
>> >>
>> >>  DECLARE_GLOBAL_DATA_PTR;
>> >>
>> >> -#ifdef CONFIG_USB_EHCI_EXYNOS
>> >> +#ifdef CONFIG_USB_XHCI_EXYNOS
>> >>
>> >>  static int board_usb_vbus_init(void)
>> >>  {
>> >>
>> >> -     struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
>> >> -
>> >> samsung_get_base_gpio_part1(); +     struct exynos5420_gpio_part4
>> >> *gpio4 = (struct exynos5420_gpio_part4 *) +
>> >>                 samsung_get_base_gpio_part4();
>> >>
>> >>       /* Enable VBUS power switch */
>> >>
>> >> -     s5p_gpio_direction_output(&gpio1->x2, 6, 1);
>> >> +     s5p_gpio_direction_output(&gpio4->g0, 5, 1);
>> >> +     s5p_gpio_direction_output(&gpio4->g1, 4, 1);
>> >
>> > This VBUS toggling should happen on per-port basis, right ?
>>
>> No this VBUS gpio toggling is actually enabling the VBUS line of the
>> controller. And since we have 2 controllers on exynos5420, so added the
>> required 2 gpios for the purpose
>> (GPG0[5], and GPG1[4]).
>
> So if I understand this correctly, it should happen on per-controller basis
> then?

True, i thought of putting this in DT actually, similar to what we do
for exynos5250 as also available in the patch :
[PATCH 1/2] exynos5250: usb: Fix VBus gpio numbers for ehci and xhci
controllers  (http://patchwork.ozlabs.org/patch/306553/)

But then the mathematics involved in gpio_direction_output() api
doesn't yield me the correct gpio pin (which actually gave in case of
Exynos5250).
So i thought of putting it in the board file only. I should have put
proper comment here although :-(

>
> Best regards,
> Marek Vasut
Marek Vasut Jan. 7, 2014, 9:15 a.m. UTC | #5
On Tuesday, January 07, 2014 at 10:03:01 AM, Vivek Gautam wrote:
> On Tue, Jan 7, 2014 at 1:19 PM, Marek Vasut <marex@denx.de> wrote:
> > On Tuesday, January 07, 2014 at 07:37:46 AM, Vivek Gautam wrote:
> >> Hi Marek,
> >> 
> >> On Mon, Jan 6, 2014 at 9:22 PM, Marek Vasut <marex@denx.de> wrote:
> >> > On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
> >> >> On smdk5420 two availbale XHCI controllers require VBUS GPIO
> >> >> to be configured, the EHCI however doesn't have any such VBUS
> >> >> GPIO. So correcting the available board_usb_vbus_init() function
> >> >> to the needs.
> >> >> 
> >> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> >> >> ---
> >> >> 
> >> >>  board/samsung/smdk5420/smdk5420.c |   11 ++++++-----
> >> >>  1 file changed, 6 insertions(+), 5 deletions(-)
> >> >> 
> >> >> diff --git a/board/samsung/smdk5420/smdk5420.c
> >> >> b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
> >> >> --- a/board/samsung/smdk5420/smdk5420.c
> >> >> +++ b/board/samsung/smdk5420/smdk5420.c
> >> >> @@ -18,14 +18,15 @@
> >> >> 
> >> >>  DECLARE_GLOBAL_DATA_PTR;
> >> >> 
> >> >> -#ifdef CONFIG_USB_EHCI_EXYNOS
> >> >> +#ifdef CONFIG_USB_XHCI_EXYNOS
> >> >> 
> >> >>  static int board_usb_vbus_init(void)
> >> >>  {
> >> >> 
> >> >> -     struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1
> >> >> *) -
> >> >> samsung_get_base_gpio_part1(); +     struct exynos5420_gpio_part4
> >> >> *gpio4 = (struct exynos5420_gpio_part4 *) +
> >> >> 
> >> >>                 samsung_get_base_gpio_part4();
> >> >>       
> >> >>       /* Enable VBUS power switch */
> >> >> 
> >> >> -     s5p_gpio_direction_output(&gpio1->x2, 6, 1);
> >> >> +     s5p_gpio_direction_output(&gpio4->g0, 5, 1);
> >> >> +     s5p_gpio_direction_output(&gpio4->g1, 4, 1);
> >> > 
> >> > This VBUS toggling should happen on per-port basis, right ?
> >> 
> >> No this VBUS gpio toggling is actually enabling the VBUS line of the
> >> controller. And since we have 2 controllers on exynos5420, so added the
> >> required 2 gpios for the purpose
> >> (GPG0[5], and GPG1[4]).
> > 
> > So if I understand this correctly, it should happen on per-controller
> > basis then?
> 
> True, i thought of putting this in DT actually, similar to what we do
> for exynos5250 as also available in the patch :
> [PATCH 1/2] exynos5250: usb: Fix VBus gpio numbers for ehci and xhci
> controllers  (http://patchwork.ozlabs.org/patch/306553/)
> 
> But then the mathematics involved in gpio_direction_output() api
> doesn't yield me the correct gpio pin (which actually gave in case of
> Exynos5250).

Ugh, does that mean we have a breakage in the GPIO or DT stuff ?
[...]

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/board/samsung/smdk5420/smdk5420.c b/board/samsung/smdk5420/smdk5420.c
index 3ad2ad0..4f23000 100644
--- a/board/samsung/smdk5420/smdk5420.c
+++ b/board/samsung/smdk5420/smdk5420.c
@@ -18,14 +18,15 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_USB_EHCI_EXYNOS
+#ifdef CONFIG_USB_XHCI_EXYNOS
 static int board_usb_vbus_init(void)
 {
-	struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
-						samsung_get_base_gpio_part1();
+	struct exynos5420_gpio_part4 *gpio4 = (struct exynos5420_gpio_part4 *)
+						samsung_get_base_gpio_part4();
 
 	/* Enable VBUS power switch */
-	s5p_gpio_direction_output(&gpio1->x2, 6, 1);
+	s5p_gpio_direction_output(&gpio4->g0, 5, 1);
+	s5p_gpio_direction_output(&gpio4->g1, 4, 1);
 
 	/* VBUS turn ON time */
 	mdelay(3);
@@ -36,7 +37,7 @@  static int board_usb_vbus_init(void)
 
 int exynos_init(void)
 {
-#ifdef CONFIG_USB_EHCI_EXYNOS
+#ifdef CONFIG_USB_XHCI_EXYNOS
 	board_usb_vbus_init();
 #endif
 	return 0;