blob: 7a30b82118c39a3246c9e020197f2cd8520e94ac [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Arthur Heymans7b9c1392017-04-09 20:40:39 +02003
4#include <device/device.h>
5#include <device/pci.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02006#include <device/pci_ops.h>
Arthur Heymans7b9c1392017-04-09 20:40:39 +02007#include <device/pci_ids.h>
Arthur Heymans349e0852017-04-09 20:48:37 +02008#include "i82801jx.h"
Arthur Heymans7b9c1392017-04-09 20:40:39 +02009
10static void pci_init(struct device *dev)
11{
12 u16 reg16;
13 u8 reg8;
14
15 /* This device has no interrupt */
16 pci_write_config8(dev, PCI_INTERRUPT_LINE, 0xff);
17
18 /* Master Latency Count must be set to 0x04! */
19 reg8 = pci_read_config8(dev, D30F0_SMLT);
20 reg8 &= 0x07;
21 reg8 |= (0x04 << 3);
22 pci_write_config8(dev, D30F0_SMLT, reg8);
23
24 /* Clear errors in status registers */
25 reg16 = pci_read_config16(dev, PCI_STATUS);
26 //reg16 |= 0xf900;
27 pci_write_config16(dev, PCI_STATUS, reg16);
28
29 reg16 = pci_read_config16(dev, PCI_SEC_STATUS);
30 // reg16 |= 0xf900;
31 pci_write_config16(dev, PCI_SEC_STATUS, reg16);
32}
33
Arthur Heymans7b9c1392017-04-09 20:40:39 +020034static struct pci_operations pci_ops = {
Kyösti Mälkkidbd31322019-03-20 17:55:27 +020035 .set_subsystem = pci_dev_set_subsystem,
Arthur Heymans7b9c1392017-04-09 20:40:39 +020036};
37
38static struct device_operations device_ops = {
39 .read_resources = pci_bus_read_resources,
40 .set_resources = pci_dev_set_resources,
41 .enable_resources = pci_bus_enable_resources,
42 .init = pci_init,
43 .scan_bus = pci_scan_bridge,
44 .reset_bus = pci_bus_reset,
45 .ops_pci = &pci_ops,
46};
47
48static const unsigned short pci_device_ids[] = {
Arthur Heymans349e0852017-04-09 20:48:37 +020049 0x244e,
Arthur Heymans7b9c1392017-04-09 20:40:39 +020050 0
51};
52
Arthur Heymans349e0852017-04-09 20:48:37 +020053static const struct pci_driver ich10_pci __pci_driver = {
Arthur Heymans7b9c1392017-04-09 20:40:39 +020054 .ops = &device_ops,
55 .vendor = PCI_VENDOR_ID_INTEL,
56 .devices = pci_device_ids,
57};