Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Georgi | e72a8a3 | 2012-11-06 11:05:09 +0100 | [diff] [blame] | 2 | |
| 3 | #include <device/device.h> |
| 4 | #include <device/pci.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 5 | #include <device/pci_ops.h> |
Patrick Georgi | e72a8a3 | 2012-11-06 11:05:09 +0100 | [diff] [blame] | 6 | #include <device/pci_ids.h> |
| 7 | #include "i82801ix.h" |
| 8 | |
| 9 | static void pci_init(struct device *dev) |
| 10 | { |
| 11 | u16 reg16; |
| 12 | u8 reg8; |
| 13 | |
| 14 | /* This device has no interrupt */ |
| 15 | pci_write_config8(dev, PCI_INTERRUPT_LINE, 0xff); |
| 16 | |
| 17 | /* Master Latency Count must be set to 0x04! */ |
| 18 | reg8 = pci_read_config8(dev, D30F0_SMLT); |
| 19 | reg8 &= 0x07; |
| 20 | reg8 |= (0x04 << 3); |
| 21 | pci_write_config8(dev, D30F0_SMLT, reg8); |
| 22 | |
| 23 | /* Clear errors in status registers */ |
| 24 | reg16 = pci_read_config16(dev, PCI_STATUS); |
| 25 | //reg16 |= 0xf900; |
| 26 | pci_write_config16(dev, PCI_STATUS, reg16); |
| 27 | |
| 28 | reg16 = pci_read_config16(dev, PCI_SEC_STATUS); |
| 29 | // reg16 |= 0xf900; |
| 30 | pci_write_config16(dev, PCI_SEC_STATUS, reg16); |
| 31 | } |
| 32 | |
Patrick Georgi | e72a8a3 | 2012-11-06 11:05:09 +0100 | [diff] [blame] | 33 | static struct pci_operations pci_ops = { |
Kyösti Mälkki | dbd3132 | 2019-03-20 17:55:27 +0200 | [diff] [blame] | 34 | .set_subsystem = pci_dev_set_subsystem, |
Patrick Georgi | e72a8a3 | 2012-11-06 11:05:09 +0100 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | static struct device_operations device_ops = { |
| 38 | .read_resources = pci_bus_read_resources, |
| 39 | .set_resources = pci_dev_set_resources, |
| 40 | .enable_resources = pci_bus_enable_resources, |
| 41 | .init = pci_init, |
| 42 | .scan_bus = pci_scan_bridge, |
| 43 | .reset_bus = pci_bus_reset, |
| 44 | .ops_pci = &pci_ops, |
| 45 | }; |
| 46 | |
| 47 | static const unsigned short pci_device_ids[] = { |
| 48 | 0x244e, /* Desktop */ |
| 49 | 0x2448, /* Mobile */ |
| 50 | 0 |
| 51 | }; |
| 52 | |
| 53 | static const struct pci_driver ich9_pci __pci_driver = { |
| 54 | .ops = &device_ops, |
| 55 | .vendor = PCI_VENDOR_ID_INTEL, |
| 56 | .devices = pci_device_ids, |
| 57 | }; |