Angel Pons | 182dbde | 2020-04-02 23:49:05 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 2 | |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/path.h> |
| 5 | #include <device/smbus.h> |
| 6 | #include <device/pci.h> |
Elyes HAOUAS | a4dd33c | 2020-08-11 09:39:43 +0200 | [diff] [blame] | 7 | #include <device/pci_def.h> |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 8 | #include <device/pci_ids.h> |
| 9 | #include <device/pci_ops.h> |
Kyösti Mälkki | 1cae454 | 2020-01-06 12:31:34 +0200 | [diff] [blame] | 10 | #include <device/smbus_host.h> |
Angel Pons | 79b2a15 | 2020-12-05 20:43:00 +0100 | [diff] [blame] | 11 | #include <southbridge/intel/common/smbus_ops.h> |
Arthur Heymans | 16fe790 | 2017-04-12 17:01:31 +0200 | [diff] [blame] | 12 | #include "i82801ix.h" |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 13 | |
Elyes HAOUAS | 8aa5073 | 2018-05-13 13:34:58 +0200 | [diff] [blame] | 14 | static void pch_smbus_init(struct device *dev) |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 15 | { |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 16 | /* Enable clock gating */ |
Angel Pons | 6740647 | 2020-06-08 11:13:42 +0200 | [diff] [blame] | 17 | pci_and_config16(dev, 0x80, ~((1 << 8) | (1 << 10) | (1 << 12) | (1 << 14))); |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 18 | } |
| 19 | |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 20 | static struct device_operations smbus_ops = { |
| 21 | .read_resources = smbus_read_resources, |
| 22 | .set_resources = pci_dev_set_resources, |
| 23 | .enable_resources = pci_dev_enable_resources, |
Kyösti Mälkki | d0e212c | 2015-02-26 20:47:47 +0200 | [diff] [blame] | 24 | .scan_bus = scan_smbus, |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 25 | .init = pch_smbus_init, |
| 26 | .ops_smbus_bus = &lops_smbus_bus, |
Angel Pons | 1fc0edd | 2020-05-31 00:03:28 +0200 | [diff] [blame] | 27 | .ops_pci = &pci_dev_ops_pci, |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 28 | }; |
| 29 | |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 30 | static const struct pci_driver pch_smbus __pci_driver = { |
| 31 | .ops = &smbus_ops, |
| 32 | .vendor = PCI_VENDOR_ID_INTEL, |
Felix Singer | 7f8b0cd8 | 2019-11-10 11:04:08 +0100 | [diff] [blame] | 33 | .device = PCI_DEVICE_ID_INTEL_82801IB_SMB, |
Vladimir Serbinenko | caf1df0 | 2014-08-01 02:49:27 +0200 | [diff] [blame] | 34 | }; |