blob: 17f7b6b0f13f4cc8362fc9cd2469a5253f8361bb [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +02002
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +02003#include <device/device.h>
4#include <device/path.h>
5#include <device/smbus.h>
6#include <device/pci.h>
Elyes HAOUASa4dd33c2020-08-11 09:39:43 +02007#include <device/pci_def.h>
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +02008#include <device/pci_ids.h>
9#include <device/pci_ops.h>
Kyösti Mälkki1cae4542020-01-06 12:31:34 +020010#include <device/smbus_host.h>
Angel Pons79b2a152020-12-05 20:43:00 +010011#include <southbridge/intel/common/smbus_ops.h>
Arthur Heymans16fe7902017-04-12 17:01:31 +020012#include "i82801ix.h"
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020013
Elyes HAOUAS8aa50732018-05-13 13:34:58 +020014static void pch_smbus_init(struct device *dev)
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020015{
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020016 /* Enable clock gating */
Angel Pons67406472020-06-08 11:13:42 +020017 pci_and_config16(dev, 0x80, ~((1 << 8) | (1 << 10) | (1 << 12) | (1 << 14)));
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020018}
19
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020020static 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älkkid0e212c2015-02-26 20:47:47 +020024 .scan_bus = scan_smbus,
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020025 .init = pch_smbus_init,
26 .ops_smbus_bus = &lops_smbus_bus,
Angel Pons1fc0edd2020-05-31 00:03:28 +020027 .ops_pci = &pci_dev_ops_pci,
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020028};
29
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020030static const struct pci_driver pch_smbus __pci_driver = {
31 .ops = &smbus_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010032 .vendor = PCI_VID_INTEL,
33 .device = PCI_DID_INTEL_82801IB_SMB,
Vladimir Serbinenkocaf1df02014-08-01 02:49:27 +020034};