summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/console/Kconfig8
-rw-r--r--src/drivers/smbus/i2c_smbus_console.c11
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);
+ }
}