blob: 9db8d7a91ba3d547d5a25b30efc20bc3180e78ae [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Stefan Reinauer8e073822012-04-04 00:07:22 +02002
Stefan Reinauer8e073822012-04-04 00:07:22 +02003#include <device/device.h>
Stefan Reinauer8e073822012-04-04 00:07:22 +02004#include <device/smbus.h>
5#include <device/pci.h>
6#include <device/pci_ids.h>
7#include <device/pci_ops.h>
Kyösti Mälkki1cae4542020-01-06 12:31:34 +02008#include <device/smbus_host.h>
Angel Pons79b2a152020-12-05 20:43:00 +01009#include <southbridge/intel/common/smbus_ops.h>
Stefan Reinauer8e073822012-04-04 00:07:22 +020010#include "pch.h"
Stefan Reinauer8e073822012-04-04 00:07:22 +020011
Elyes HAOUAS4aec3402018-05-25 08:29:27 +020012static void pch_smbus_init(struct device *dev)
Stefan Reinauer8e073822012-04-04 00:07:22 +020013{
14 struct resource *res;
Stefan Reinauer8e073822012-04-04 00:07:22 +020015
16 /* Enable clock gating */
Angel Pons527b6822021-03-30 21:18:30 +020017 pci_and_config16(dev, 0x80, ~((1 << 8) | (1 << 10) | (1 << 12) | (1 << 14)));
Stefan Reinauer8e073822012-04-04 00:07:22 +020018
19 /* Set Receive Slave Address */
Angel Ponsf32ae102021-11-03 13:07:14 +010020 res = probe_resource(dev, PCI_BASE_ADDRESS_4);
Stefan Reinauer8e073822012-04-04 00:07:22 +020021 if (res)
Kyösti Mälkki73451fd2020-01-06 19:00:31 +020022 smbus_set_slave_addr(res->base, SMBUS_SLAVE_ADDR);
Stefan Reinauer8e073822012-04-04 00:07:22 +020023}
24
Aaron Durbinaa090cb2017-09-13 16:01:52 -060025static const char *smbus_acpi_name(const struct device *dev)
Patrick Rudolph604f6982017-06-07 09:46:52 +020026{
27 return "SBUS";
28}
29
Felix Held1bb327f2023-11-18 17:48:40 +010030struct device_operations bd82x6x_smbus_ops = {
Stefan Reinauer8e073822012-04-04 00:07:22 +020031 .read_resources = smbus_read_resources,
32 .set_resources = pci_dev_set_resources,
33 .enable_resources = pci_dev_enable_resources,
Kyösti Mälkkid0e212c2015-02-26 20:47:47 +020034 .scan_bus = scan_smbus,
Stefan Reinauer8e073822012-04-04 00:07:22 +020035 .init = pch_smbus_init,
36 .ops_smbus_bus = &lops_smbus_bus,
Angel Pons1fc0edd2020-05-31 00:03:28 +020037 .ops_pci = &pci_dev_ops_pci,
Patrick Rudolph604f6982017-06-07 09:46:52 +020038 .acpi_name = smbus_acpi_name,
Stefan Reinauer8e073822012-04-04 00:07:22 +020039};