summaryrefslogtreecommitdiff
path: root/src/mainboard/google/guybrush/variants/baseboard/helpers.c
blob: cde31c22d963c687cab3f7026b35a7065c49cc53 (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
/* SPDX-License-Identifier: GPL-2.0-or-later */

#include <baseboard/variants.h>
#include <device/device.h>
#include <fw_config.h>
#include <soc/iomap.h>
#include <soc/pci_devs.h>

static bool variant_has_device_enabled(const struct device_path *device_path, size_t path_length)
{
	const struct device *dev =
		find_dev_nested_path(all_devices->link_list, device_path, path_length);

	return is_dev_enabled(dev);
}

__weak bool variant_has_fpmcu(void)
{
	static const struct device_path fpmcu_path[] = {
		{
			.type = DEVICE_PATH_MMIO,
			.mmio.addr = APU_UART1_BASE
		},
		{
			.type = DEVICE_PATH_GENERIC,
			.generic.id = 0,
			.generic.subid = 0
		},
	};

	return variant_has_device_enabled(fpmcu_path, ARRAY_SIZE(fpmcu_path));
}

__weak bool variant_has_pcie_wwan(void)
{
	static const struct device_path pcie_wwan_path[] = {
	{
		.type = DEVICE_PATH_DOMAIN,
		.domain.domain = 0x0,
	},
	{
		.type = DEVICE_PATH_PCI,
		.pci.devfn = WWAN_DEVFN
	},
};

	return variant_has_device_enabled(pcie_wwan_path, ARRAY_SIZE(pcie_wwan_path));
}