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>
This commit is contained in:
Kyösti Mälkki
2020-01-06 19:41:42 +02:00
committed by Patrick Georgi
parent 542fa6de38
commit f555a58abc
27 changed files with 111 additions and 85 deletions

View File

@@ -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