Sumit Garg | 89a8ec9 | 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 | 23de64e | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 14 | #include <asm/gpio.h> |
Sumit Garg | 89a8ec9 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 15 | #include <asm/global_data.h> |
| 16 | #include <fdt_support.h> |
| 17 | #include <asm/arch/dram.h> |
| 18 | |
| 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
| 21 | int dram_init(void) |
| 22 | { |
| 23 | return fdtdec_setup_mem_size_base(); |
| 24 | } |
| 25 | |
| 26 | int board_init(void) |
| 27 | { |
Sumit Garg | 23de64e | 2022-08-04 19:57:20 +0530 | [diff] [blame] | 28 | struct udevice *pmic_gpio; |
| 29 | struct gpio_desc usb_vbus_boost_pin; |
| 30 | int ret, node; |
| 31 | |
| 32 | ret = uclass_get_device_by_name(UCLASS_GPIO, |
| 33 | "pms405_gpios@c000", |
| 34 | &pmic_gpio); |
| 35 | if (ret < 0) { |
| 36 | printf("Failed to find pms405_gpios@c000 node.\n"); |
| 37 | return ret; |
| 38 | } |
| 39 | |
| 40 | node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pmic_gpio), |
| 41 | "usb_vbus_boost_pin"); |
| 42 | if (node < 0) { |
| 43 | printf("Failed to find usb_hub_reset_pm dt node.\n"); |
| 44 | return node; |
| 45 | } |
| 46 | ret = gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0, |
| 47 | &usb_vbus_boost_pin, 0); |
| 48 | if (ret < 0) { |
| 49 | printf("Failed to request usb_hub_reset_pm gpio.\n"); |
| 50 | return ret; |
| 51 | } |
| 52 | |
| 53 | dm_gpio_set_dir_flags(&usb_vbus_boost_pin, |
| 54 | GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); |
| 55 | |
Sumit Garg | 89a8ec9 | 2022-07-12 12:42:12 +0530 | [diff] [blame] | 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | void reset_cpu(void) |
| 60 | { |
| 61 | psci_system_reset(); |
| 62 | } |