diff mbox series

[12/13] board: qcs404-evb: Enable USB3 specific PMIC GPIO

Message ID 20220804142721.536556-13-sumit.garg@linaro.org
State New
Headers show
Series USB support for QCS404 SoC | expand

Commit Message

Sumit Garg Aug. 4, 2022, 2:27 p.m. UTC
For USB3 host controller to detect devices on the bus it is required to
enable a PMIC GPIO: usb_vbus_boost_pin. So enable that during board
specific initialization.

And since this PMIC GPIO parsing is quite u-boot specific, so add a
DT override to qcs404-evb-uboot.dtsi to represent usb_vbus_boost_pin.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
---
 arch/arm/dts/qcs404-evb-uboot.dtsi     |  6 ++++++
 board/qualcomm/qcs404-evb/qcs404-evb.c | 29 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

Comments

Tom Rini Aug. 26, 2022, 6:51 p.m. UTC | #1
On Thu, Aug 04, 2022 at 07:57:20PM +0530, Sumit Garg wrote:

> For USB3 host controller to detect devices on the bus it is required to
> enable a PMIC GPIO: usb_vbus_boost_pin. So enable that during board
> specific initialization.
> 
> And since this PMIC GPIO parsing is quite u-boot specific, so add a
> DT override to qcs404-evb-uboot.dtsi to represent usb_vbus_boost_pin.
> 
> Signed-off-by: Sumit Garg <sumit.garg@linaro.org>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/arch/arm/dts/qcs404-evb-uboot.dtsi b/arch/arm/dts/qcs404-evb-uboot.dtsi
index c18080a483..c73d71e8c7 100644
--- a/arch/arm/dts/qcs404-evb-uboot.dtsi
+++ b/arch/arm/dts/qcs404-evb-uboot.dtsi
@@ -22,3 +22,9 @@ 
 		};
 	};
 };
+
+&pms405_gpios {
+	usb_vbus_boost_pin {
+		gpios = <&pms405_gpios 2 0>;
+	};
+};
diff --git a/board/qualcomm/qcs404-evb/qcs404-evb.c b/board/qualcomm/qcs404-evb/qcs404-evb.c
index f1e6e7f7eb..249dca7e72 100644
--- a/board/qualcomm/qcs404-evb/qcs404-evb.c
+++ b/board/qualcomm/qcs404-evb/qcs404-evb.c
@@ -11,6 +11,7 @@ 
 #include <env.h>
 #include <init.h>
 #include <asm/cache.h>
+#include <asm/gpio.h>
 #include <asm/global_data.h>
 #include <fdt_support.h>
 #include <asm/arch/dram.h>
@@ -24,6 +25,34 @@  int dram_init(void)
 
 int board_init(void)
 {
+	struct udevice *pmic_gpio;
+	struct gpio_desc usb_vbus_boost_pin;
+	int ret, node;
+
+	ret = uclass_get_device_by_name(UCLASS_GPIO,
+					"pms405_gpios@c000",
+					&pmic_gpio);
+	if (ret < 0) {
+		printf("Failed to find pms405_gpios@c000 node.\n");
+		return ret;
+	}
+
+	node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pmic_gpio),
+				  "usb_vbus_boost_pin");
+	if (node < 0) {
+		printf("Failed to find usb_hub_reset_pm dt node.\n");
+		return node;
+	}
+	ret = gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
+					 &usb_vbus_boost_pin, 0);
+	if (ret < 0) {
+		printf("Failed to request usb_hub_reset_pm gpio.\n");
+		return ret;
+	}
+
+	dm_gpio_set_dir_flags(&usb_vbus_boost_pin,
+			      GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+
 	return 0;
 }