blob: 11a3daa7994ed4b854c4689834295668a96bad5c [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
Arthur Heymans7b9c1392017-04-09 20:40:39 +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>
Arthur Heymans7b9c1392017-04-09 20:40:39 +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 "i82801jx.h"
Arthur Heymans7b9c1392017-04-09 20:40:39 +020013
Elyes HAOUAS1a8c1df2018-05-13 13:36:44 +020014static void pch_smbus_init(struct device *dev)
Arthur Heymans7b9c1392017-04-09 20:40:39 +020015{
Arthur Heymans7b9c1392017-04-09 20:40:39 +020016 /* Enable clock gating */
Angel Pons2048cb42020-06-08 02:09:33 +020017 pci_and_config16(dev, 0x80, ~((1 << 8) | (1 << 10) | (1 << 12) | (1 << 14)));
Arthur Heymans7b9c1392017-04-09 20:40:39 +020018}
19
Arthur Heymans7b9c1392017-04-09 20:40:39 +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,
24 .scan_bus = scan_smbus,
25 .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,
Arthur Heymans7b9c1392017-04-09 20:40:39 +020028};
29
Arthur Heymans349e0852017-04-09 20:48:37 +020030static const unsigned short pci_device_ids[] =
31{
32 0x3a30,
33 0x3a60,
34 0
35};
Arthur Heymans7b9c1392017-04-09 20:40:39 +020036
37static const struct pci_driver pch_smbus __pci_driver = {
38 .ops = &smbus_ops,
39 .vendor = PCI_VENDOR_ID_INTEL,
40 .devices = pci_device_ids,
41};