Sumit Garg | bf95d17 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 1 | // 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 Garg | 106822d | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 14 | #include <asm/gpio.h> |
Sumit Garg | bf95d17 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 15 | #include <asm/global_data.h> |
| 16 | #include <fdt_support.h> |
Sumit Garg | bf95d17 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 17 | |
| 18 | DECLARE_GLOBAL_DATA_PTR; |
| 19 | |
Caleb Connolly | e6c284b | 2023-11-20 20:48:00 +0000 | [diff] [blame^] | 20 | void qcom_board_init(void) |
Sumit Garg | bf95d17 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 21 | { |
Sumit Garg | 106822d | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 22 | 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 Connolly | e6c284b | 2023-11-20 20:48:00 +0000 | [diff] [blame^] | 31 | return; |
Sumit Garg | 106822d | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 32 | } |
| 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 Connolly | e6c284b | 2023-11-20 20:48:00 +0000 | [diff] [blame^] | 38 | return; |
Sumit Garg | 106822d | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 39 | } |
| 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 Connolly | e6c284b | 2023-11-20 20:48:00 +0000 | [diff] [blame^] | 44 | return; |
Sumit Garg | 106822d | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | dm_gpio_set_dir_flags(&usb_vbus_boost_pin, |
| 48 | GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); |
Sumit Garg | bf95d17 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 49 | } |