blob: 37b759c3e185437db1c306fd390ccf88fe16e010 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Arthur Heymans7b9c1392017-04-09 20:40:39 +02002
3#include <device/device.h>
4#include <device/pci.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02005#include <device/pci_ops.h>
Arthur Heymans7b9c1392017-04-09 20:40:39 +02006#include <device/pci_ids.h>
Arthur Heymans349e0852017-04-09 20:48:37 +02007#include "i82801jx.h"
Arthur Heymans7b9c1392017-04-09 20:40:39 +02008
9static void pci_init(struct device *dev)
10{
11 u16 reg16;
Arthur Heymans7b9c1392017-04-09 20:40:39 +020012
13 /* This device has no interrupt */
14 pci_write_config8(dev, PCI_INTERRUPT_LINE, 0xff);
15
16 /* Master Latency Count must be set to 0x04! */
Angel Pons2048cb42020-06-08 02:09:33 +020017 pci_update_config8(dev, D30F0_SMLT, 0x07, 0x04 << 3);
Arthur Heymans7b9c1392017-04-09 20:40:39 +020018
Angel Pons2048cb42020-06-08 02:09:33 +020019 /* Clear errors in status registers. FIXME: Do something? */
Arthur Heymans7b9c1392017-04-09 20:40:39 +020020 reg16 = pci_read_config16(dev, PCI_STATUS);
21 //reg16 |= 0xf900;
22 pci_write_config16(dev, PCI_STATUS, reg16);
23
24 reg16 = pci_read_config16(dev, PCI_SEC_STATUS);
25 // reg16 |= 0xf900;
26 pci_write_config16(dev, PCI_SEC_STATUS, reg16);
27}
28
Arthur Heymans7b9c1392017-04-09 20:40:39 +020029static struct device_operations device_ops = {
30 .read_resources = pci_bus_read_resources,
31 .set_resources = pci_dev_set_resources,
32 .enable_resources = pci_bus_enable_resources,
33 .init = pci_init,
34 .scan_bus = pci_scan_bridge,
35 .reset_bus = pci_bus_reset,
Angel Pons1fc0edd2020-05-31 00:03:28 +020036 .ops_pci = &pci_dev_ops_pci,
Arthur Heymans7b9c1392017-04-09 20:40:39 +020037};
38
39static const unsigned short pci_device_ids[] = {
Arthur Heymans349e0852017-04-09 20:48:37 +020040 0x244e,
Arthur Heymans7b9c1392017-04-09 20:40:39 +020041 0
42};
43
Arthur Heymans349e0852017-04-09 20:48:37 +020044static const struct pci_driver ich10_pci __pci_driver = {
Arthur Heymans7b9c1392017-04-09 20:40:39 +020045 .ops = &device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010046 .vendor = PCI_VID_INTEL,
Arthur Heymans7b9c1392017-04-09 20:40:39 +020047 .devices = pci_device_ids,
48};