summaryrefslogtreecommitdiff
path: root/src/include/device
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2020-01-06 19:41:42 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-01-14 18:18:26 +0000
commitf555a58abc487270d4ba42527b1b43850bd718c0 (patch)
tree5285cf1bb4cc64cedf5c9defa78ea63803aca3e5 /src/include/device
parent542fa6de384d4b79d8964512b4088bcd90863bd2 (diff)
downloadcoreboot-f555a58abc487270d4ba42527b1b43850bd718c0.tar.xz
sb/intel/common: Declare common smbus_base() and enable_smbus()
This avoids including platform-specific headers with different filenames from common code. Change-Id: Idf9893e55949d63f3ceca2249e618d0f81320321 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38232 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/include/device')
-rw-r--r--src/include/device/smbus_host.h14
1 files changed, 14 insertions, 0 deletions
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 <stdint.h>
+#include <console/console.h>
/* 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