diff options
author | Nico Huber <nico.h@gmx.de> | 2024-06-01 04:00:56 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-07-11 00:06:22 +0000 |
commit | ae77d8afacb37f4ee1a0ee9942d9a0249c57ed8a (patch) | |
tree | 90b3179f2ad6dadd1a88a7d4cfc6e1ef216e35d2 | |
parent | 77ae8f0f249d54b992796e42dfc82392ca926266 (diff) |
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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82762
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/console/Kconfig | 8 | ||||
-rw-r--r-- | src/drivers/smbus/i2c_smbus_console.c | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/console/Kconfig b/src/console/Kconfig index 30b286205d..db71204a3b 100644 --- a/src/console/Kconfig +++ b/src/console/Kconfig @@ -318,8 +318,16 @@ config CONSOLE_I2C_SMBUS_SLAVE_ADDRESS 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 d651790694..00b53931e7 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_init(void) 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); + } } |