blob: ad367c806a3f309a3668002ea1db0532c04e67f1 [file] [log] [blame]
Lee Leahya6de5472016-02-21 16:04:53 -08001/*
2 * This file is part of the coreboot project.
3 *
Lee Leahya6de5472016-02-21 16:04:53 -08004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <device/pci.h>
16#include <device/pci_ids.h>
17#include <soc/iomap.h>
18#include <soc/pci_devs.h>
19#include <soc/pm.h>
20#include <soc/ramstage.h>
21
Elyes HAOUAS696545d2018-05-25 13:11:37 +020022static void pmc_read_resources(struct device *dev)
Lee Leahya6de5472016-02-21 16:04:53 -080023{
Lee Leahy94b971a2017-03-06 08:59:23 -080024 unsigned int index = 0;
Lee Leahya6de5472016-02-21 16:04:53 -080025 struct resource *res;
26
27 /* Get the normal PCI resources of this device. */
28 pci_dev_read_resources(dev);
29
Lee Leahy7f4b0532016-05-22 11:52:28 -070030 /* GPE0 */
Lee Leahya6de5472016-02-21 16:04:53 -080031 res = new_resource(dev, index++);
Lee Leahy7f4b0532016-05-22 11:52:28 -070032 res->base = GPE0_BASE_ADDRESS;
33 res->size = GPE0_SIZE;
34 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
35
36 /* PM1BLK */
37 res = new_resource(dev, index++);
38 res->base = PM1BLK_BASE_ADDRESS;
39 res->size = PM1BLK_SIZE;
40 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
41
42 /* Legacy GPIO */
43 res = new_resource(dev, index++);
44 res->base = LEGACY_GPIO_BASE_ADDRESS;
45 res->size = LEGACY_GPIO_SIZE;
Lee Leahya6de5472016-02-21 16:04:53 -080046 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
47}
48
49static struct device_operations device_ops = {
Elyes HAOUAS1d191272018-11-27 12:23:48 +010050 .read_resources = pmc_read_resources,
51 .set_resources = pci_dev_set_resources,
52 .enable_resources = pci_dev_enable_resources,
Nico Huber51b75ae2019-03-14 16:02:05 +010053 .scan_bus = scan_static_bus,
Lee Leahya6de5472016-02-21 16:04:53 -080054};
55
56static const struct pci_driver pmc __pci_driver = {
57 .ops = &device_ops,
58 .vendor = PCI_VENDOR_ID_INTEL,
59 .device = QUARK_V_LPC_DEVICE_ID_0,
60};