Nico Huber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82762?usp=email )
Change subject: console/i2c_smbus: Allow to send data w/o register offset ......................................................................
console/i2c_smbus: Allow to send data w/o register offset
Not every I2C target requires a register address. Not sending one for every console char saves us a lot of overhead.
Change-Id: I1c714768fdd4aea4885e40a85d21fa42414ce32c Signed-off-by: Nico Huber nico.h@gmx.de --- M src/console/Kconfig M src/drivers/smbus/i2c_smbus_console.c 2 files changed, 16 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/62/82762/1
diff --git a/src/console/Kconfig b/src/console/Kconfig index 30b2862..db71204 100644 --- a/src/console/Kconfig +++ b/src/console/Kconfig @@ -318,8 +318,16 @@ help I2C address of the device which logs the data.
+config CONSOLE_I2C_SMBUS_HAVE_DATA_REGISTER + bool "Write to a specific data register" + default y if SC16IS7XX_INIT + help + Select this to provide a register address that will + be sent before every data byte. + config CONSOLE_I2C_SMBUS_SLAVE_DATA_REGISTER hex "Data register address of the I2C logging device" + depends on CONSOLE_I2C_SMBUS_HAVE_DATA_REGISTER default 0x00 if SC16IS7XX_INIT help This an 8-bit data register. diff --git a/src/drivers/smbus/i2c_smbus_console.c b/src/drivers/smbus/i2c_smbus_console.c index d651790..00b5393 100644 --- a/src/drivers/smbus/i2c_smbus_console.c +++ b/src/drivers/smbus/i2c_smbus_console.c @@ -13,7 +13,12 @@
void i2c_smbus_console_tx_byte(unsigned char c) { - do_smbus_write_byte(CONFIG_FIXED_SMBUS_IO_BASE, - CONFIG_CONSOLE_I2C_SMBUS_SLAVE_ADDRESS, - CONFIG_CONSOLE_I2C_SMBUS_SLAVE_DATA_REGISTER, c); + if (CONFIG(CONSOLE_I2C_SMBUS_HAVE_DATA_REGISTER)) { + do_smbus_write_byte(CONFIG_FIXED_SMBUS_IO_BASE, + CONFIG_CONSOLE_I2C_SMBUS_SLAVE_ADDRESS, + CONFIG_CONSOLE_I2C_SMBUS_SLAVE_DATA_REGISTER, c); + } else { + do_smbus_send_byte(CONFIG_FIXED_SMBUS_IO_BASE, + CONFIG_CONSOLE_I2C_SMBUS_SLAVE_ADDRESS, c); + } }