summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2017-08-20 21:36:08 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2017-09-09 12:59:45 +0000
commitb5d998b9e0988bcd22512b026972373511097974 (patch)
tree750f3405714d766a8409d2f8fd841c4ffcc6216f
parent1e39236f965427cbfc92d3938af4c0acc41a1ce7 (diff)
sb/intel/common: Add HAVE_DEBUG_SMBUS
Change-Id: Ifb1a1eff71968f31af9004ff00717f202d3ec29e Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/21117 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--src/southbridge/intel/common/Kconfig4
-rw-r--r--src/southbridge/intel/common/smbus.c16
2 files changed, 20 insertions, 0 deletions
diff --git a/src/southbridge/intel/common/Kconfig b/src/southbridge/intel/common/Kconfig
index 669569e18c..304ecbfba3 100644
--- a/src/southbridge/intel/common/Kconfig
+++ b/src/southbridge/intel/common/Kconfig
@@ -1,9 +1,13 @@
config SOUTHBRIDGE_INTEL_COMMON
def_bool n
+
config SOUTHBRIDGE_INTEL_COMMON_GPIO
def_bool n
+
config SOUTHBRIDGE_INTEL_COMMON_SMBUS
def_bool n
+ select HAVE_DEBUG_SMBUS
+
config HAVE_INTEL_CHIPSET_LOCKDOWN
def_bool n
diff --git a/src/southbridge/intel/common/smbus.c b/src/southbridge/intel/common/smbus.c
index 90ef03ee12..2067baa8b2 100644
--- a/src/southbridge/intel/common/smbus.c
+++ b/src/southbridge/intel/common/smbus.c
@@ -16,11 +16,18 @@
*/
#include <arch/io.h>
+#include <console/console.h>
#include <device/smbus_def.h>
#include <stdlib.h>
#include "smbus.h"
+#if IS_ENABLED(CONFIG_DEBUG_SMBUS)
+#define dprintk(args...) printk(BIOS_DEBUG, ##args)
+#else
+#define dprintk(args...) do {} while (0)
+#endif
+
/* I801 command constants */
#define I801_QUICK (0 << 2)
#define I801_BYTE (1 << 2)
@@ -256,6 +263,9 @@ int do_smbus_block_read(unsigned int smbus_base, u8 device, u8 cmd,
}
} while ((status & SMBHSTSTS_HOST_BUSY) && loops);
+ dprintk("%s: status = %02x, len = %d / %d, loops = %d\n",
+ __func__, status, bytes_read, slave_bytes, loops);
+
/* Post-check we received complete message. */
slave_bytes = inb(smbus_base + SMBHSTDAT0);
if (bytes_read < slave_bytes)
@@ -329,6 +339,9 @@ int do_smbus_block_write(unsigned int smbus_base, u8 device, u8 cmd,
}
} while ((status & SMBHSTSTS_HOST_BUSY) && loops);
+ dprintk("%s: status = %02x, len = %d / %d, loops = %d\n",
+ __func__, status, bytes_sent, bytes, loops);
+
if (bytes_sent < bytes)
return SMBUS_ERROR;
@@ -396,6 +409,9 @@ int do_i2c_block_read(unsigned int smbus_base, u8 device,
}
} while ((status & SMBHSTSTS_HOST_BUSY) && loops);
+ dprintk("%s: status = %02x, len = %d / %d, loops = %d\n",
+ __func__, status, bytes_read, bytes, loops);
+
if (bytes_read < bytes)
return SMBUS_ERROR;