summaryrefslogtreecommitdiffstats
path: root/src/include/device/smbus_host.h
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2020-01-07 22:34:33 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-06-22 11:53:31 +0000
commit1a1b04ea51686226e9dddbd9dd74550b340578a1 (patch)
treebe754ae1643ee323df8ef78a7b028820cd0456e4 /src/include/device/smbus_host.h
parentfc57d6c4c2848726be1361f6dee3c33e7551b857 (diff)
downloadcoreboot-1a1b04ea51686226e9dddbd9dd74550b340578a1.tar.gz
coreboot-1a1b04ea51686226e9dddbd9dd74550b340578a1.tar.bz2
coreboot-1a1b04ea51686226e9dddbd9dd74550b340578a1.zip
device/smbus_host: Declare common early SMBus prototypes
Change-Id: I1157cf391178a27db437d1d08ef5cb9333e976d0 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/38233 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/include/device/smbus_host.h')
-rw-r--r--src/include/device/smbus_host.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/include/device/smbus_host.h b/src/include/device/smbus_host.h
index d9390eaf2d5c..4bc80092b55d 100644
--- a/src/include/device/smbus_host.h
+++ b/src/include/device/smbus_host.h
@@ -41,4 +41,42 @@ static inline void enable_smbus(void)
printk(BIOS_DEBUG, "SMBus controller enabled\n");
}
+#if DEVTREE_EARLY
+static inline int smbus_read_byte(u8 device, u8 address)
+{
+ uintptr_t base = smbus_base();
+ return do_smbus_read_byte(base, device, address);
+}
+
+static inline int smbus_read_word(u8 device, u8 address)
+{
+ uintptr_t base = smbus_base();
+ return do_smbus_read_word(base, device, address);
+}
+
+static inline int smbus_write_byte(u8 device, u8 address, u8 data)
+{
+ uintptr_t base = smbus_base();
+ return do_smbus_write_byte(base, device, address, data);
+}
+
+static inline int smbus_block_read(u8 device, u8 cmd, size_t max_bytes, u8 *buf)
+{
+ uintptr_t base = smbus_base();
+ return do_smbus_block_read(base, device, cmd, max_bytes, buf);
+}
+
+static inline int smbus_block_write(u8 device, u8 cmd, size_t bytes, const u8 *buf)
+{
+ uintptr_t base = smbus_base();
+ return do_smbus_block_write(base, device, cmd, bytes, buf);
+}
+
+static inline int i2c_eeprom_read(u8 device, u8 offset, size_t bytes, u8 *buf)
+{
+ uintptr_t base = smbus_base();
+ return do_i2c_eeprom_read(base, device, offset, bytes, buf);
+}
+#endif
+
#endif