blob: 96f47b45809c9457295dd13cf6c93c1cf05668ab [file] [log] [blame]
Angel Pons230e4f9d2020-04-05 15:47:14 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Lee Leahya6de5472016-02-21 16:04:53 -08003
4#include <device/pci.h>
5#include <device/pci_ids.h>
6#include <soc/iomap.h>
7#include <soc/pci_devs.h>
8#include <soc/pm.h>
9#include <soc/ramstage.h>
10
Elyes HAOUAS696545d2018-05-25 13:11:37 +020011static void pmc_read_resources(struct device *dev)
Lee Leahya6de5472016-02-21 16:04:53 -080012{
Lee Leahy94b971a2017-03-06 08:59:23 -080013 unsigned int index = 0;
Lee Leahya6de5472016-02-21 16:04:53 -080014 struct resource *res;
15
16 /* Get the normal PCI resources of this device. */
17 pci_dev_read_resources(dev);
18
Lee Leahy7f4b0532016-05-22 11:52:28 -070019 /* GPE0 */
Lee Leahya6de5472016-02-21 16:04:53 -080020 res = new_resource(dev, index++);
Lee Leahy7f4b0532016-05-22 11:52:28 -070021 res->base = GPE0_BASE_ADDRESS;
22 res->size = GPE0_SIZE;
23 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
24
25 /* PM1BLK */
26 res = new_resource(dev, index++);
27 res->base = PM1BLK_BASE_ADDRESS;
28 res->size = PM1BLK_SIZE;
29 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
30
31 /* Legacy GPIO */
32 res = new_resource(dev, index++);
33 res->base = LEGACY_GPIO_BASE_ADDRESS;
34 res->size = LEGACY_GPIO_SIZE;
Lee Leahya6de5472016-02-21 16:04:53 -080035 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
36}
37
38static struct device_operations device_ops = {
Elyes HAOUAS1d191272018-11-27 12:23:48 +010039 .read_resources = pmc_read_resources,
40 .set_resources = pci_dev_set_resources,
41 .enable_resources = pci_dev_enable_resources,
Nico Huber51b75ae2019-03-14 16:02:05 +010042 .scan_bus = scan_static_bus,
Lee Leahya6de5472016-02-21 16:04:53 -080043};
44
45static const struct pci_driver pmc __pci_driver = {
46 .ops = &device_ops,
47 .vendor = PCI_VENDOR_ID_INTEL,
48 .device = QUARK_V_LPC_DEVICE_ID_0,
49};