diff mbox

[U-Boot,v2,2/4] board: popmetal: de-assert the host rst pin in board init

Message ID 1479972592-32761-3-git-send-email-kever.yang@rock-chips.com
State Accepted
Commit da20981269d890cb85ef9336a3f488d61fbd73b7
Delegated to: Simon Glass
Headers show

Commit Message

Kever Yang Nov. 24, 2016, 7:29 a.m. UTC
The PopMetal board have a on board FE1.1 usb 2.0 hub which connect to
the usb host port, we need to de-assert its reset pin to enable it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

Changes in v2:
- move the vbus power enable into dwc2 driver

 board/chipspark/popmetal_rk3288/popmetal-rk3288.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Simon Glass Nov. 25, 2016, 7:39 p.m. UTC | #1
Hi Kever,

On 24 November 2016 at 00:29, Kever Yang <kever.yang@rock-chips.com> wrote:
> The PopMetal board have a on board FE1.1 usb 2.0 hub which connect to
> the usb host port, we need to de-assert its reset pin to enable it.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
> Changes in v2:
> - move the vbus power enable into dwc2 driver
>
>  board/chipspark/popmetal_rk3288/popmetal-rk3288.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
> index aad74ef..ed82b2b 100644
> --- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
> +++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
> @@ -6,6 +6,7 @@
>
>  #include <common.h>
>  #include <spl.h>
> +#include <asm/gpio.h>
>
>  void board_boot_order(u32 *spl_boot_list)
>  {
> @@ -13,3 +14,19 @@ void board_boot_order(u32 *spl_boot_list)
>         spl_boot_list[0] = BOOT_DEVICE_MMC2;
>         spl_boot_list[1] = BOOT_DEVICE_MMC1;
>  }
> +
> +#define GPIO7A3_HUB_RST        227
> +
> +int rk_board_late_init(void)
> +{
> +       int ret;
> +
> +       ret = gpio_request(GPIO7A3_HUB_RST, "hub_rst");
> +       if (ret)
> +               return ret;
> +       ret = gpio_direction_output(GPIO7A3_HUB_RST, 1);
> +       if (ret)

Can we get this from the device tree instead of hard-coding it? Then
it can go in generic code.

> +               return ret;
> +
> +       return 0;
> +}
> --
> 1.9.1
>

Regards,
Simon
Kever Yang Nov. 29, 2016, 8:49 a.m. UTC | #2
Hi Simon,

On 11/26/2016 03:39 AM, Simon Glass wrote:
> Hi Kever,
>
> On 24 November 2016 at 00:29, Kever Yang <kever.yang@rock-chips.com> wrote:
>> The PopMetal board have a on board FE1.1 usb 2.0 hub which connect to
>> the usb host port, we need to de-assert its reset pin to enable it.
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>> Changes in v2:
>> - move the vbus power enable into dwc2 driver
>>
>>   board/chipspark/popmetal_rk3288/popmetal-rk3288.c | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>>
>> diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>> index aad74ef..ed82b2b 100644
>> --- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>> +++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>> @@ -6,6 +6,7 @@
>>
>>   #include <common.h>
>>   #include <spl.h>
>> +#include <asm/gpio.h>
>>
>>   void board_boot_order(u32 *spl_boot_list)
>>   {
>> @@ -13,3 +14,19 @@ void board_boot_order(u32 *spl_boot_list)
>>          spl_boot_list[0] = BOOT_DEVICE_MMC2;
>>          spl_boot_list[1] = BOOT_DEVICE_MMC1;
>>   }
>> +
>> +#define GPIO7A3_HUB_RST        227
>> +
>> +int rk_board_late_init(void)
>> +{
>> +       int ret;
>> +
>> +       ret = gpio_request(GPIO7A3_HUB_RST, "hub_rst");
>> +       if (ret)
>> +               return ret;
>> +       ret = gpio_direction_output(GPIO7A3_HUB_RST, 1);
>> +       if (ret)
> Can we get this from the device tree instead of hard-coding it? Then
> it can go in generic code.

I don't understand how to get this from device tree, this board is the
only one based on rk3288 with a USB hub on board and need the de-assert
its reset pin. I think it is reasonable to hard coding it in its board file.

Thanks,
- Kever
>
>> +               return ret;
>> +
>> +       return 0;
>> +}
>> --
>> 1.9.1
>>
> Regards,
> Simon
>
>
>
Simon Glass Nov. 30, 2016, 12:34 a.m. UTC | #3
On 29 November 2016 at 01:49, Kever Yang <kever.yang@rock-chips.com> wrote:
> Hi Simon,
>
>
> On 11/26/2016 03:39 AM, Simon Glass wrote:
>>
>> Hi Kever,
>>
>> On 24 November 2016 at 00:29, Kever Yang <kever.yang@rock-chips.com>
>> wrote:
>>>
>>> The PopMetal board have a on board FE1.1 usb 2.0 hub which connect to
>>> the usb host port, we need to de-assert its reset pin to enable it.
>>>
>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>>> ---
>>>
>>> Changes in v2:
>>> - move the vbus power enable into dwc2 driver
>>>
>>>   board/chipspark/popmetal_rk3288/popmetal-rk3288.c | 17
>>> +++++++++++++++++
>>>   1 file changed, 17 insertions(+)
>>>
>>> diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>> b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>> index aad74ef..ed82b2b 100644
>>> --- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>> +++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>> @@ -6,6 +6,7 @@
>>>
>>>   #include <common.h>
>>>   #include <spl.h>
>>> +#include <asm/gpio.h>
>>>
>>>   void board_boot_order(u32 *spl_boot_list)
>>>   {
>>> @@ -13,3 +14,19 @@ void board_boot_order(u32 *spl_boot_list)
>>>          spl_boot_list[0] = BOOT_DEVICE_MMC2;
>>>          spl_boot_list[1] = BOOT_DEVICE_MMC1;
>>>   }
>>> +
>>> +#define GPIO7A3_HUB_RST        227
>>> +
>>> +int rk_board_late_init(void)
>>> +{
>>> +       int ret;
>>> +
>>> +       ret = gpio_request(GPIO7A3_HUB_RST, "hub_rst");
>>> +       if (ret)
>>> +               return ret;
>>> +       ret = gpio_direction_output(GPIO7A3_HUB_RST, 1);
>>> +       if (ret)
>>
>> Can we get this from the device tree instead of hard-coding it? Then
>> it can go in generic code.
>
>
> I don't understand how to get this from device tree, this board is the
> only one based on rk3288 with a USB hub on board and need the de-assert
> its reset pin. I think it is reasonable to hard coding it in its board file.

OK, since it's just one board.

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

In general we can support this sort of thing by adding a driver for
UCLASS_USB_HUB, but I suspect it would need refactoring of
common/usb.c.

Regards,
Simon
Simon Glass Dec. 3, 2016, 4:50 a.m. UTC | #4
On 29 November 2016 at 17:34, Simon Glass <sjg@chromium.org> wrote:
> On 29 November 2016 at 01:49, Kever Yang <kever.yang@rock-chips.com> wrote:
>> Hi Simon,
>>
>>
>> On 11/26/2016 03:39 AM, Simon Glass wrote:
>>>
>>> Hi Kever,
>>>
>>> On 24 November 2016 at 00:29, Kever Yang <kever.yang@rock-chips.com>
>>> wrote:
>>>>
>>>> The PopMetal board have a on board FE1.1 usb 2.0 hub which connect to
>>>> the usb host port, we need to de-assert its reset pin to enable it.
>>>>
>>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>>>> ---
>>>>
>>>> Changes in v2:
>>>> - move the vbus power enable into dwc2 driver
>>>>
>>>>   board/chipspark/popmetal_rk3288/popmetal-rk3288.c | 17
>>>> +++++++++++++++++
>>>>   1 file changed, 17 insertions(+)
>>>>
>>>> diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>>> b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>>> index aad74ef..ed82b2b 100644
>>>> --- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>>> +++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
>>>> @@ -6,6 +6,7 @@
>>>>
>>>>   #include <common.h>
>>>>   #include <spl.h>
>>>> +#include <asm/gpio.h>
>>>>
>>>>   void board_boot_order(u32 *spl_boot_list)
>>>>   {
>>>> @@ -13,3 +14,19 @@ void board_boot_order(u32 *spl_boot_list)
>>>>          spl_boot_list[0] = BOOT_DEVICE_MMC2;
>>>>          spl_boot_list[1] = BOOT_DEVICE_MMC1;
>>>>   }
>>>> +
>>>> +#define GPIO7A3_HUB_RST        227
>>>> +
>>>> +int rk_board_late_init(void)
>>>> +{
>>>> +       int ret;
>>>> +
>>>> +       ret = gpio_request(GPIO7A3_HUB_RST, "hub_rst");
>>>> +       if (ret)
>>>> +               return ret;
>>>> +       ret = gpio_direction_output(GPIO7A3_HUB_RST, 1);
>>>> +       if (ret)
>>>
>>> Can we get this from the device tree instead of hard-coding it? Then
>>> it can go in generic code.
>>
>>
>> I don't understand how to get this from device tree, this board is the
>> only one based on rk3288 with a USB hub on board and need the de-assert
>> its reset pin. I think it is reasonable to hard coding it in its board file.
>
> OK, since it's just one board.
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
> In general we can support this sort of thing by adding a driver for
> UCLASS_USB_HUB, but I suspect it would need refactoring of
> common/usb.c.

Added 'rockchip' tag,

Applied to u-boot-rockchip, thanks.
diff mbox

Patch

diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
index aad74ef..ed82b2b 100644
--- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
+++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
@@ -6,6 +6,7 @@ 
 
 #include <common.h>
 #include <spl.h>
+#include <asm/gpio.h>
 
 void board_boot_order(u32 *spl_boot_list)
 {
@@ -13,3 +14,19 @@  void board_boot_order(u32 *spl_boot_list)
 	spl_boot_list[0] = BOOT_DEVICE_MMC2;
 	spl_boot_list[1] = BOOT_DEVICE_MMC1;
 }
+
+#define GPIO7A3_HUB_RST	227
+
+int rk_board_late_init(void)
+{
+	int ret;
+
+	ret = gpio_request(GPIO7A3_HUB_RST, "hub_rst");
+	if (ret)
+		return ret;
+	ret = gpio_direction_output(GPIO7A3_HUB_RST, 1);
+	if (ret)
+		return ret;
+
+	return 0;
+}