blob: 249dca7e72f11a237f333d461beb13f5f1422159 [file] [log] [blame]
Sumit Garg89a8ec92022-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 Garg23de64e2022-08-04 19:57:20 +053014#include <asm/gpio.h>
Sumit Garg89a8ec92022-07-12 12:42:12 +053015#include <asm/global_data.h>
16#include <fdt_support.h>
17#include <asm/arch/dram.h>
18
19DECLARE_GLOBAL_DATA_PTR;
20
21int dram_init(void)
22{
23 return fdtdec_setup_mem_size_base();
24}
25
26int board_init(void)
27{
Sumit Garg23de64e2022-08-04 19:57:20 +053028 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 Garg89a8ec92022-07-12 12:42:12 +053056 return 0;
57}
58
59void reset_cpu(void)
60{
61 psci_system_reset();
62}