blob: aefbaf6ea43c0691eb6e75d76f5461d2593a7b57 [file] [log] [blame]
Lee Leahya6de5472016-02-21 16:04:53 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 * Copyright (C) 2014 Google Inc.
Lee Leahy94b971a2017-03-06 08:59:23 -08006 * Copyright (C) 2015-2017 Intel Corporation.
Lee Leahya6de5472016-02-21 16:04:53 -08007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <device/pci.h>
19#include <device/pci_ids.h>
20#include <soc/iomap.h>
21#include <soc/pci_devs.h>
22#include <soc/pm.h>
23#include <soc/ramstage.h>
24
25static void pmc_read_resources(device_t dev)
26{
Lee Leahy94b971a2017-03-06 08:59:23 -080027 unsigned int index = 0;
Lee Leahya6de5472016-02-21 16:04:53 -080028 struct resource *res;
29
30 /* Get the normal PCI resources of this device. */
31 pci_dev_read_resources(dev);
32
Lee Leahy7f4b0532016-05-22 11:52:28 -070033 /* GPE0 */
Lee Leahya6de5472016-02-21 16:04:53 -080034 res = new_resource(dev, index++);
Lee Leahy7f4b0532016-05-22 11:52:28 -070035 res->base = GPE0_BASE_ADDRESS;
36 res->size = GPE0_SIZE;
37 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
38
39 /* PM1BLK */
40 res = new_resource(dev, index++);
41 res->base = PM1BLK_BASE_ADDRESS;
42 res->size = PM1BLK_SIZE;
43 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
44
45 /* Legacy GPIO */
46 res = new_resource(dev, index++);
47 res->base = LEGACY_GPIO_BASE_ADDRESS;
48 res->size = LEGACY_GPIO_SIZE;
Lee Leahya6de5472016-02-21 16:04:53 -080049 res->flags = IORESOURCE_IO | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
50}
51
52static struct device_operations device_ops = {
53 .read_resources = &pmc_read_resources,
54 .set_resources = &pci_dev_set_resources,
55 .enable_resources = &pci_dev_enable_resources,
56 .scan_bus = &scan_lpc_bus,
57};
58
59static const struct pci_driver pmc __pci_driver = {
60 .ops = &device_ops,
61 .vendor = PCI_VENDOR_ID_INTEL,
62 .device = QUARK_V_LPC_DEVICE_ID_0,
63};