aboutsummaryrefslogtreecommitdiff
path: root/src/include/device/smbus_host.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/device/smbus_host.h')
-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