[v3] SMDK5250: Enable VBus for USB 2.0 controller

Message ID 1357626649-24515-1-git-send-email-gautam.vivek@samsung.com
State New
Headers show

Commit Message

Vivek Gautam Jan. 8, 2013, 6:30 a.m.
This patch enables Vbus required for USB 2.0 controller.

Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---

Changes from v2:
	- Rebased on top of u-boot-usb/next
	- Enclosed the function definition for board_usb_vbus_init()
	  inside "CONFIG_USB_EHCI_EXYNOS"

Changes from v1:
	- Using the old school method of setting up gpio instead
	  of using the pinmux method, since the required gpio line
	  here is board specific.

 board/samsung/smdk5250/smdk5250.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

Comments

Simon Glass Jan. 10, 2013, 6:16 p.m. | #1
On Mon, Jan 7, 2013 at 10:30 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
> This patch enables Vbus required for USB 2.0 controller.
>
> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>

Acked-by: Simon Glass <sjg@chromium.org>

> ---
>
> Changes from v2:
>         - Rebased on top of u-boot-usb/next
>         - Enclosed the function definition for board_usb_vbus_init()
>           inside "CONFIG_USB_EHCI_EXYNOS"
>
> Changes from v1:
>         - Using the old school method of setting up gpio instead
>           of using the pinmux method, since the required gpio line
>           here is board specific.
>
>  board/samsung/smdk5250/smdk5250.c |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
> index a5816e4..cf7f801 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -60,9 +60,28 @@ static int smc9115_pre_init(void)
>  }
>  #endif
>
> +#ifdef CONFIG_USB_EHCI_EXYNOS
> +int board_usb_vbus_init(void)
> +{
> +       struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
> +                                               samsung_get_base_gpio_part1();
> +
> +       /* Enable VBUS power switch */
> +       s5p_gpio_direction_output(&gpio1->x2, 6, 1);
> +
> +       /* VBUS turn ON time */
> +       mdelay(3);
> +
> +       return 0;
> +}
> +#endif
> +
>  int board_init(void)
>  {
>         gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
> +#ifdef CONFIG_USB_EHCI_EXYNOS
> +       board_usb_vbus_init();
> +#endif
>         return 0;
>  }
>
> --
> 1.7.6.5
>
Simon Glass Jan. 10, 2013, 6:17 p.m. | #2
Hi Vivek,

On Thu, Jan 10, 2013 at 10:16 AM, Simon Glass <sjg@chromium.org> wrote:
> On Mon, Jan 7, 2013 at 10:30 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote:
>> This patch enables Vbus required for USB 2.0 controller.
>>
>> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
>> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
>
> Acked-by: Simon Glass <sjg@chromium.org>

Sorry, I can't resist one little comment - I wonder if this USB init
can be delayed until USB is actually used? Perhaps we need such an API
call in the USB subsystem?

Regards,
Simon

>
>> ---
>>
>> Changes from v2:
>>         - Rebased on top of u-boot-usb/next
>>         - Enclosed the function definition for board_usb_vbus_init()
>>           inside "CONFIG_USB_EHCI_EXYNOS"
>>
>> Changes from v1:
>>         - Using the old school method of setting up gpio instead
>>           of using the pinmux method, since the required gpio line
>>           here is board specific.
>>
>>  board/samsung/smdk5250/smdk5250.c |   19 +++++++++++++++++++
>>  1 files changed, 19 insertions(+), 0 deletions(-)
>>
>> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
>> index a5816e4..cf7f801 100644
>> --- a/board/samsung/smdk5250/smdk5250.c
>> +++ b/board/samsung/smdk5250/smdk5250.c
>> @@ -60,9 +60,28 @@ static int smc9115_pre_init(void)
>>  }
>>  #endif
>>
>> +#ifdef CONFIG_USB_EHCI_EXYNOS
>> +int board_usb_vbus_init(void)
>> +{
>> +       struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
>> +                                               samsung_get_base_gpio_part1();
>> +
>> +       /* Enable VBUS power switch */
>> +       s5p_gpio_direction_output(&gpio1->x2, 6, 1);
>> +
>> +       /* VBUS turn ON time */
>> +       mdelay(3);
>> +
>> +       return 0;
>> +}
>> +#endif
>> +
>>  int board_init(void)
>>  {
>>         gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
>> +#ifdef CONFIG_USB_EHCI_EXYNOS
>> +       board_usb_vbus_init();
>> +#endif
>>         return 0;
>>  }
>>
>> --
>> 1.7.6.5
>>

Patch

diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index a5816e4..cf7f801 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -60,9 +60,28 @@  static int smc9115_pre_init(void)
 }
 #endif
 
+#ifdef CONFIG_USB_EHCI_EXYNOS
+int board_usb_vbus_init(void)
+{
+	struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
+						samsung_get_base_gpio_part1();
+
+	/* Enable VBUS power switch */
+	s5p_gpio_direction_output(&gpio1->x2, 6, 1);
+
+	/* VBUS turn ON time */
+	mdelay(3);
+
+	return 0;
+}
+#endif
+
 int board_init(void)
 {
 	gd->bd->bi_boot_params = (PHYS_SDRAM_1 + 0x100UL);
+#ifdef CONFIG_USB_EHCI_EXYNOS
+	board_usb_vbus_init();
+#endif
 	return 0;
 }