[U-Boot] [PATCH 3/3] board: popmetal: enable the usb host port power in board init

Kever Yang kever.yang at rock-chips.com
Wed Nov 9 08:30:21 CET 2016


Enable the usb host port 5V power by enable the fix regulator.
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 at the same time.

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

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

diff --git a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
index aad74ef..6f5d3a8c 100644
--- a/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
+++ b/board/chipspark/popmetal_rk3288/popmetal-rk3288.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <spl.h>
+#include <asm/gpio.h>
+#include <power/regulator.h>
 
 void board_boot_order(u32 *spl_boot_list)
 {
@@ -13,3 +15,32 @@ 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;
+	struct udevice *regulator;
+
+	ret = regulator_get_by_platname("vcc5v0_host", &regulator);
+	if (ret) {
+		printf("%s vcc5v0_host init fail! ret %d\n", __func__, ret);
+		goto out;
+	}
+
+	ret = regulator_set_enable(regulator, true);
+	if (ret) {
+		printf("%s vcc5v0-host enable fail!\n", __func__);
+		goto out;
+	}
+
+	gpio_request(GPIO7A3_HUB_RST, "hub_rst");
+	gpio_direction_output(GPIO7A3_HUB_RST, 1);
+
+	return 0;
+out:
+	printf("%s init error %x\n", __func__, ret);
+
+	return ret;
+}
-- 
1.9.1



More information about the U-Boot mailing list