summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/quark/lpc.c
blob: ad974565791d06d2ce169076db289be64c3e08c9 (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-only */

#include <device/pci.h>
#include <device/pci_ids.h>
#include <soc/iomap.h>
#include <soc/pci_devs.h>
#include <soc/pm.h>
#include <soc/ramstage.h>

static void pmc_read_resources(struct device *dev)
{
	unsigned int index = 0;
	struct resource *res;

	/* Get the normal PCI resources of this device. */
	pci_dev_read_resources(dev);

	/* GPE0 */
	res = new_resource(dev, index++);
	res->base = GPE0_BASE_ADDRESS;
	res->size = GPE0_SIZE;
	res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;

	/* PM1BLK */
	res = new_resource(dev, index++);
	res->base = PM1BLK_BASE_ADDRESS;
	res->size = PM1BLK_SIZE;
	res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;

	/* Legacy GPIO */
	res = new_resource(dev, index++);
	res->base = LEGACY_GPIO_BASE_ADDRESS;
	res->size = LEGACY_GPIO_SIZE;
	res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
}

static struct device_operations device_ops = {
	.read_resources		= pmc_read_resources,
	.set_resources		= pci_dev_set_resources,
	.enable_resources	= pci_dev_enable_resources,
	.scan_bus		= scan_static_bus,
};

static const struct pci_driver pmc __pci_driver = {
	.ops	= &device_ops,
	.vendor	= PCI_VENDOR_ID_INTEL,
	.device	= QUARK_V_LPC_DEVICE_ID_0,
};