* [PATCH 0/2] board: sifive: unmatched: reset multiple devices in SPL
@ 2021-07-08 1:08 Vincent Chen
2021-07-08 1:08 ` [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function " Vincent Chen
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Vincent Chen @ 2021-07-08 1:08 UTC (permalink / raw)
To: green.wan, rick, bmeng.cn, ycliang, u-boot; +Cc: vincent.chen
In SiFive unmatched board, the reset of the USB hub, PCIe-USB bridge, and
ULPI rely on the power-cycling. However, sometimes the rebooting is without
power-cycling. To ensure these devices will be reset in each rebooting,
here always reset these devices in the spl_board_init_f().
In addition, because the reset pint of these four devices incluing GEMGXL
connects to the GPIO, the 1st patch creates a new wrapper,
spl_reset_device_by_gpio(), to address the GPIO operation during the reset.
Vincent Chen (2):
board: sifive: unmatched: refine GEMGXL initialized function in SPL
board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI
device in SPL
board/sifive/unmatched/spl.c | 90 +++++++++++++++++++++++++++++++++++---------
1 file changed, 73 insertions(+), 17 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function in SPL
2021-07-08 1:08 [PATCH 0/2] board: sifive: unmatched: reset multiple devices in SPL Vincent Chen
@ 2021-07-08 1:08 ` Vincent Chen
2021-07-21 14:23 ` Leo Liang
2021-07-08 1:08 ` [PATCH 2/2] board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device " Vincent Chen
2021-07-20 7:57 ` [PATCH 0/2] board: sifive: unmatched: reset multiple devices " Vincent Chen
2 siblings, 1 reply; 6+ messages in thread
From: Vincent Chen @ 2021-07-08 1:08 UTC (permalink / raw)
To: green.wan, rick, bmeng.cn, ycliang, u-boot; +Cc: vincent.chen
Create a new function spl_reset_device_by_gpio to reset the device
whose reset pin is connected to the GPIO. Then, using this function
to initialize GEMGXL.
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
---
board/sifive/unmatched/spl.c | 58 +++++++++++++++++++++++++++++---------------
1 file changed, 39 insertions(+), 19 deletions(-)
diff --git a/board/sifive/unmatched/spl.c b/board/sifive/unmatched/spl.c
index 5e1333b..b598f9f 100644
--- a/board/sifive/unmatched/spl.c
+++ b/board/sifive/unmatched/spl.c
@@ -22,43 +22,63 @@
#define MODE_SELECT_SD 0xb
#define MODE_SELECT_MASK GENMASK(3, 0)
-int spl_board_init_f(void)
+static inline int spl_reset_device_by_gpio(const char *label, int pin, int low_width)
{
int ret;
- ret = spl_soc_init();
+ ret = gpio_request(pin, label);
if (ret) {
- debug("HiFive Unmatched FU740 SPL init failed: %d\n", ret);
+ debug("%s gpio request failed: %d\n", label, ret);
+ return ret;
+ }
+
+ ret = gpio_direction_output(pin, 1);
+ if (ret) {
+ debug("%s gpio direction set failed: %d\n", label, ret);
return ret;
}
+ udelay(1);
+
+ gpio_set_value(pin, 0);
+ udelay(low_width);
+ gpio_set_value(pin, 1);
+
+ return ret;
+}
+
+static inline int spl_gemgxl_init(void)
+{
+ int ret;
/*
* GEMGXL init VSC8541 PHY reset sequence;
* leave pull-down active for 2ms
*/
udelay(2000);
- ret = gpio_request(GEM_PHY_RESET, "gem_phy_reset");
+ ret = spl_reset_device_by_gpio("gem_phy_reset", GEM_PHY_RESET, 1);
+ mdelay(15);
+
+ return ret;
+}
+
+int spl_board_init_f(void)
+{
+ int ret;
+
+ ret = spl_soc_init();
if (ret) {
- debug("gem_phy_reset gpio request failed: %d\n", ret);
- return ret;
+ debug("HiFive Unmatched FU740 SPL init failed: %d\n", ret);
+ goto end;
}
- /* Set GPIO 12 (PHY NRESET) */
- ret = gpio_direction_output(GEM_PHY_RESET, 1);
+ ret = spl_gemgxl_init();
if (ret) {
- debug("gem_phy_reset gpio direction set failed: %d\n", ret);
- return ret;
+ debug("Gigabit ethernet PHY (VSC8541) init failed: %d\n", ret);
+ goto end;
}
- udelay(1);
-
- /* Reset PHY again to enter unmanaged mode */
- gpio_set_value(GEM_PHY_RESET, 0);
- udelay(1);
- gpio_set_value(GEM_PHY_RESET, 1);
- mdelay(15);
-
- return 0;
+end:
+ return ret;
}
u32 spl_boot_device(void)
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device in SPL
2021-07-08 1:08 [PATCH 0/2] board: sifive: unmatched: reset multiple devices in SPL Vincent Chen
2021-07-08 1:08 ` [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function " Vincent Chen
@ 2021-07-08 1:08 ` Vincent Chen
2021-07-21 14:24 ` Leo Liang
2021-07-20 7:57 ` [PATCH 0/2] board: sifive: unmatched: reset multiple devices " Vincent Chen
2 siblings, 1 reply; 6+ messages in thread
From: Vincent Chen @ 2021-07-08 1:08 UTC (permalink / raw)
To: green.wan, rick, bmeng.cn, ycliang, u-boot; +Cc: vincent.chen
Ensure USB hub, PCIe-USB bridge, and ULPI device to be reset
even if the rebooting is without power-cycling.
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
---
board/sifive/unmatched/spl.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/board/sifive/unmatched/spl.c b/board/sifive/unmatched/spl.c
index b598f9f..d566327 100644
--- a/board/sifive/unmatched/spl.c
+++ b/board/sifive/unmatched/spl.c
@@ -16,6 +16,9 @@
#include <asm/arch/gpio.h>
#include <asm/arch/spl.h>
+#define UBRDG_RESET SIFIVE_GENERIC_GPIO_NR(0, 7)
+#define ULPI_RESET SIFIVE_GENERIC_GPIO_NR(0, 9)
+#define UHUB_RESET SIFIVE_GENERIC_GPIO_NR(0, 11)
#define GEM_PHY_RESET SIFIVE_GENERIC_GPIO_NR(0, 12)
#define MODE_SELECT_REG 0x1000
@@ -61,6 +64,21 @@ static inline int spl_gemgxl_init(void)
return ret;
}
+static inline int spl_usb_pcie_bridge_init(void)
+{
+ return spl_reset_device_by_gpio("usb_pcie_bridge_reset", UBRDG_RESET, 3000);
+}
+
+static inline int spl_usb_hub_init(void)
+{
+ return spl_reset_device_by_gpio("usb_hub_reset", UHUB_RESET, 100);
+}
+
+static inline int spl_ulpi_init(void)
+{
+ return spl_reset_device_by_gpio("ulpi_reset", ULPI_RESET, 1);
+}
+
int spl_board_init_f(void)
{
int ret;
@@ -77,6 +95,24 @@ int spl_board_init_f(void)
goto end;
}
+ ret = spl_usb_pcie_bridge_init();
+ if (ret) {
+ debug("USB Bridge (ASM1042A) init failed: %d\n", ret);
+ goto end;
+ }
+
+ ret = spl_usb_hub_init();
+ if (ret) {
+ debug("USB Hub (ASM1074) init failed: %d\n", ret);
+ goto end;
+ }
+
+ ret = spl_ulpi_init();
+ if (ret) {
+ debug("USB 2.0 PHY (USB3320C) init failed: %d\n", ret);
+ goto end;
+ }
+
end:
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] board: sifive: unmatched: reset multiple devices in SPL
2021-07-08 1:08 [PATCH 0/2] board: sifive: unmatched: reset multiple devices in SPL Vincent Chen
2021-07-08 1:08 ` [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function " Vincent Chen
2021-07-08 1:08 ` [PATCH 2/2] board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device " Vincent Chen
@ 2021-07-20 7:57 ` Vincent Chen
2 siblings, 0 replies; 6+ messages in thread
From: Vincent Chen @ 2021-07-20 7:57 UTC (permalink / raw)
To: Green Wan, Rick Jian-Zhi Chen(陳建志),
Bin Meng, Leo Liang, u-boot
Just a gentle ping.
If this patchset has any problems, please let me know. I am willing to
modify it. Thank you.
On Thu, Jul 8, 2021 at 9:08 AM Vincent Chen <vincent.chen@sifive.com> wrote:
>
> In SiFive unmatched board, the reset of the USB hub, PCIe-USB bridge, and
> ULPI rely on the power-cycling. However, sometimes the rebooting is without
> power-cycling. To ensure these devices will be reset in each rebooting,
> here always reset these devices in the spl_board_init_f().
>
> In addition, because the reset pint of these four devices incluing GEMGXL
> connects to the GPIO, the 1st patch creates a new wrapper,
> spl_reset_device_by_gpio(), to address the GPIO operation during the reset.
>
> Vincent Chen (2):
> board: sifive: unmatched: refine GEMGXL initialized function in SPL
> board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI
> device in SPL
>
> board/sifive/unmatched/spl.c | 90 +++++++++++++++++++++++++++++++++++---------
> 1 file changed, 73 insertions(+), 17 deletions(-)
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function in SPL
2021-07-08 1:08 ` [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function " Vincent Chen
@ 2021-07-21 14:23 ` Leo Liang
0 siblings, 0 replies; 6+ messages in thread
From: Leo Liang @ 2021-07-21 14:23 UTC (permalink / raw)
To: Vincent Chen; +Cc: u-boot
On Thu, Jul 08, 2021 at 09:08:20AM +0800, Vincent Chen wrote:
> Create a new function spl_reset_device_by_gpio to reset the device
> whose reset pin is connected to the GPIO. Then, using this function
> to initialize GEMGXL.
>
> Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> ---
> board/sifive/unmatched/spl.c | 58 +++++++++++++++++++++++++++++---------------
> 1 file changed, 39 insertions(+), 19 deletions(-)
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device in SPL
2021-07-08 1:08 ` [PATCH 2/2] board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device " Vincent Chen
@ 2021-07-21 14:24 ` Leo Liang
0 siblings, 0 replies; 6+ messages in thread
From: Leo Liang @ 2021-07-21 14:24 UTC (permalink / raw)
To: Vincent Chen; +Cc: u-boot
On Thu, Jul 08, 2021 at 09:08:21AM +0800, Vincent Chen wrote:
> Ensure USB hub, PCIe-USB bridge, and ULPI device to be reset
> even if the rebooting is without power-cycling.
>
> Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
> ---
> board/sifive/unmatched/spl.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-07-21 14:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 1:08 [PATCH 0/2] board: sifive: unmatched: reset multiple devices in SPL Vincent Chen
2021-07-08 1:08 ` [PATCH 1/2] board: sifive: unmatched: refine GEMGXL initialized function " Vincent Chen
2021-07-21 14:23 ` Leo Liang
2021-07-08 1:08 ` [PATCH 2/2] board: sifive: unmatched: reset USB hub, PCIe-USB bridge, and ULPI device " Vincent Chen
2021-07-21 14:24 ` Leo Liang
2021-07-20 7:57 ` [PATCH 0/2] board: sifive: unmatched: reset multiple devices " Vincent Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.