blob: 1a4b1f97a3ae3564b2ba57a6c2e2a9a06568bd4c [file] [log] [blame]
Sumit Gargbf95d172022-07-12 12:42:12 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Board init file for QCS404-EVB
4 *
5 * (C) Copyright 2022 Sumit Garg <sumit.garg@linaro.org>
6 */
7
8#include <common.h>
9#include <cpu_func.h>
10#include <dm.h>
11#include <env.h>
12#include <init.h>
13#include <asm/cache.h>
Sumit Garg106822d2022-08-04 19:57:20 +053014#include <asm/gpio.h>
Sumit Gargbf95d172022-07-12 12:42:12 +053015#include <asm/global_data.h>
16#include <fdt_support.h>
Sumit Gargbf95d172022-07-12 12:42:12 +053017
18DECLARE_GLOBAL_DATA_PTR;
19
Caleb Connollye6c284b2023-11-20 20:48:00 +000020void qcom_board_init(void)
Sumit Gargbf95d172022-07-12 12:42:12 +053021{
Sumit Garg106822d2022-08-04 19:57:20 +053022 struct udevice *pmic_gpio;
23 struct gpio_desc usb_vbus_boost_pin;
24 int ret, node;
25
26 ret = uclass_get_device_by_name(UCLASS_GPIO,
27 "pms405_gpios@c000",
28 &pmic_gpio);
29 if (ret < 0) {
30 printf("Failed to find pms405_gpios@c000 node.\n");
Caleb Connollye6c284b2023-11-20 20:48:00 +000031 return;
Sumit Garg106822d2022-08-04 19:57:20 +053032 }
33
34 node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pmic_gpio),
35 "usb_vbus_boost_pin");
36 if (node < 0) {
37 printf("Failed to find usb_hub_reset_pm dt node.\n");
Caleb Connollye6c284b2023-11-20 20:48:00 +000038 return;
Sumit Garg106822d2022-08-04 19:57:20 +053039 }
40 ret = gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0,
41 &usb_vbus_boost_pin, 0);
42 if (ret < 0) {
43 printf("Failed to request usb_hub_reset_pm gpio.\n");
Caleb Connollye6c284b2023-11-20 20:48:00 +000044 return;
Sumit Garg106822d2022-08-04 19:57:20 +053045 }
46
47 dm_gpio_set_dir_flags(&usb_vbus_boost_pin,
48 GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
Sumit Gargbf95d172022-07-12 12:42:12 +053049}