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>
This commit is contained in:
Kyösti Mälkki 2017-08-20 21:36:08 +03:00
parent 1e39236f96
commit b5d998b9e0
2 changed files with 20 additions and 0 deletions

View File

@ -1,9 +1,13 @@
config SOUTHBRIDGE_INTEL_COMMON config SOUTHBRIDGE_INTEL_COMMON
def_bool n def_bool n
config SOUTHBRIDGE_INTEL_COMMON_GPIO config SOUTHBRIDGE_INTEL_COMMON_GPIO
def_bool n def_bool n
config SOUTHBRIDGE_INTEL_COMMON_SMBUS config SOUTHBRIDGE_INTEL_COMMON_SMBUS
def_bool n def_bool n
select HAVE_DEBUG_SMBUS
config HAVE_INTEL_CHIPSET_LOCKDOWN config HAVE_INTEL_CHIPSET_LOCKDOWN
def_bool n def_bool n

View File

@ -16,11 +16,18 @@
*/ */
#include <arch/io.h> #include <arch/io.h>
#include <console/console.h>
#include <device/smbus_def.h> #include <device/smbus_def.h>
#include <stdlib.h> #include <stdlib.h>
#include "smbus.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 */ /* I801 command constants */
#define I801_QUICK (0 << 2) #define I801_QUICK (0 << 2)
#define I801_BYTE (1 << 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); } 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. */ /* Post-check we received complete message. */
slave_bytes = inb(smbus_base + SMBHSTDAT0); slave_bytes = inb(smbus_base + SMBHSTDAT0);
if (bytes_read < slave_bytes) 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); } 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) if (bytes_sent < bytes)
return SMBUS_ERROR; return SMBUS_ERROR;
@ -396,6 +409,9 @@ int do_i2c_block_read(unsigned int smbus_base, u8 device,
} }
} while ((status & SMBHSTSTS_HOST_BUSY) && loops); } 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) if (bytes_read < bytes)
return SMBUS_ERROR; return SMBUS_ERROR;