From f555a58abc487270d4ba42527b1b43850bd718c0 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Mon, 6 Jan 2020 19:41:42 +0200 Subject: sb/intel/common: Declare common smbus_base() and enable_smbus() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids including platform-specific headers with different filenames from common code. Change-Id: Idf9893e55949d63f3ceca2249e618d0f81320321 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/38232 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/include/device/smbus_host.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/include/device/smbus_host.h') diff --git a/src/include/device/smbus_host.h b/src/include/device/smbus_host.h index cb31d02d33..c12718d195 100644 --- a/src/include/device/smbus_host.h +++ b/src/include/device/smbus_host.h @@ -15,6 +15,7 @@ #define __DEVICE_SMBUS_HOST_H__ #include +#include /* Low-level SMBUS host controller. */ @@ -34,7 +35,20 @@ int do_i2c_block_write(uintptr_t base, u8 device, size_t bytes, u8 *buf); /* Upstream API */ +uintptr_t smbus_base(void); +int smbus_enable_iobar(uintptr_t base); void smbus_host_reset(uintptr_t base); void smbus_set_slave_addr(uintptr_t base, u8 slave_address); +static inline void enable_smbus(void) +{ + uintptr_t base = smbus_base(); + + if (smbus_enable_iobar(base) < 0) + die("SMBus controller not found!"); + + smbus_host_reset(base); + printk(BIOS_DEBUG, "SMBus controller enabled\n"); +} + #endif -- cgit v1.2.3