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>
This commit is contained in:
parent
fc57d6c4c2
commit
1a1b04ea51
32 changed files with 71 additions and 157 deletions
|
|
@ -29,6 +29,7 @@ static inline const struct smbus_bus_operations *ops_smbus_bus(struct bus *bus)
|
|||
|
||||
struct bus *get_pbus_smbus(struct device *dev);
|
||||
|
||||
#if !DEVTREE_EARLY
|
||||
static inline int smbus_recv_byte(struct device *const dev)
|
||||
{
|
||||
return i2c_dev_readb(dev);
|
||||
|
|
@ -51,5 +52,6 @@ static inline int smbus_write_byte(struct device *const dev, u8 addr, u8 val)
|
|||
|
||||
int smbus_block_read(struct device *dev, u8 cmd, u8 bytes, u8 *buffer);
|
||||
int smbus_block_write(struct device *dev, u8 cmd, u8 bytes, const u8 *buffer);
|
||||
#endif
|
||||
|
||||
#endif /* DEVICE_SMBUS_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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue