• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <device/smbus.h>
5 #include <device/pci.h>
6 #include <device/pci_ids.h>
7 #include <device/pci_ops.h>
8 #include <device/smbus_host.h>
9 #include <southbridge/intel/common/smbus_ops.h>
10 #include "pch.h"
11 
pch_smbus_init(struct device * dev)12 static void pch_smbus_init(struct device *dev)
13 {
14 	struct resource *res;
15 
16 	/* Enable clock gating */
17 	pci_and_config16(dev, 0x80, ~((1 << 8) | (1 << 10) | (1 << 12) | (1 << 14)));
18 
19 	/* Set Receive Slave Address */
20 	res = probe_resource(dev, PCI_BASE_ADDRESS_4);
21 	if (res)
22 		smbus_set_slave_addr(res->base, SMBUS_SLAVE_ADDR);
23 }
24 
smbus_acpi_name(const struct device * dev)25 static const char *smbus_acpi_name(const struct device *dev)
26 {
27 	return "SBUS";
28 }
29 
30 struct device_operations bd82x6x_smbus_ops = {
31 	.read_resources		= smbus_read_resources,
32 	.set_resources		= pci_dev_set_resources,
33 	.enable_resources	= pci_dev_enable_resources,
34 	.scan_bus		= scan_smbus,
35 	.init			= pch_smbus_init,
36 	.ops_smbus_bus		= &lops_smbus_bus,
37 	.ops_pci		= &pci_dev_ops_pci,
38 	.acpi_name		= smbus_acpi_name,
39 };
40