~funderscore blog cgit wiki get in touch
aboutsummaryrefslogtreecommitdiff
blob: 249dca7e72f11a237f333d461beb13f5f1422159 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: GPL-2.0+
/*
 * Board init file for QCS404-EVB
 *
 * (C) Copyright 2022 Sumit Garg <sumit.garg@linaro.org>
 */

#include <common.h>
#include <cpu_func.h>
#include <dm.h>
#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>

DECLARE_GLOBAL_DATA_PTR;

int dram_init(void)
{
	return fdtdec_setup_mem_size_base();
}

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;
}

void reset_cpu(void)
{
	psci_system_reset();
}