mb/system76/cml-u/dt: Make use of chipset devicetree
[coreboot.git] / src / soc / intel / common / block / smbus / smbus_early.c
blob273d29e66b906fb484bd687e9ca95da0e057c176
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/io.h>
4 #include <device/pci_def.h>
5 #include <device/pci_ops.h>
6 #include <device/smbus_host.h>
7 #include <device/pci_type.h>
8 #include <intelblocks/smbus.h>
9 #include <soc/pci_devs.h>
10 #include <stdint.h>
12 #include "smbuslib.h"
14 void smbus_common_init(void)
16 const pci_devfn_t dev = PCH_DEV_SMBUS;
18 /* Set SMBus I/O base address */
19 pci_write_config32(dev, PCI_BASE_ADDRESS_4, SMBUS_IO_BASE);
20 /* Set SMBus enable */
21 pci_write_config8(dev, HOSTC, HST_EN);
22 /* Enable I/O access */
23 pci_write_config16(dev, PCI_COMMAND, PCI_COMMAND_IO);
24 /* Disable interrupts */
25 outb(0, SMBUS_IO_BASE + SMBHSTCTL);
26 /* Clear errors */
27 outb(0xff, SMBUS_IO_BASE + SMBHSTSTAT);
30 uintptr_t smbus_base(void)
32 return SMBUS_IO_BASE;