581738642f
Do not use the global platform_i2c_transfer() function that can only be implemented by a single driver. Instead, make a `struct device` aware transfer() function the only interface function for I2C controller dri- vers to implement. To not force the slave device drivers to be implemented either above generic I2C or specialized SMBus operations, we support SMBus control- lers in the slave device interface too. We start with four simple slave functions: i2c_readb(), i2c_writeb(), i2c_readb_at() and i2c_writeb_at(). They are all compatible to respec- tive SMBus functions. But we keep aliases because it would be weird to force e.g. an I2C EEPROM driver to call smbus_read_byte(). Change-Id: I98386f91bf4799ba3df84ec8bc0f64edd4142818 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/20846 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
12 lines
347 B
C
12 lines
347 B
C
#ifndef DEVICE_SMBUS_DEF_H
|
|
#define DEVICE_SMBUS_DEF_H
|
|
|
|
#include <types.h>
|
|
|
|
/* Error results are negative success is >= 0 */
|
|
#define SMBUS_ERROR CB_ERR
|
|
#define SMBUS_WAIT_UNTIL_READY_TIMEOUT CB_I2C_BUSY
|
|
#define SMBUS_WAIT_UNTIL_DONE_TIMEOUT CB_I2C_TIMEOUT
|
|
#define SMBUS_WAIT_UNTIL_ACTIVE_TIMEOUT CB_I2C_NO_DEVICE
|
|
|
|
#endif /* DEVICE_SMBUS_DEF_H */
|