mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-13 11:25:14 +00:00
mec1322: i2c: Print port name on failure
Referring to i2c ports as i2c0 thru i2c4 is confusing, due to the special naming of controller 0 ports, so use their actual names from the datasheet. BUG=None TEST=Trigger failure on i2c0_1, verify that "i2c0_1 bad status .." is seen on console. BRANCH=glados, strago Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ibd0d638e5af1c0a64e6f4b1a709b790b6b10d5e6 Reviewed-on: https://chromium-review.googlesource.com/325822 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
9c053ea898
commit
0251aacd43
@@ -58,7 +58,7 @@ enum i2c_transaction_state {
|
||||
};
|
||||
|
||||
/* I2C controller state data */
|
||||
struct {
|
||||
static struct {
|
||||
/* Transaction timeout, or 0 to use default. */
|
||||
uint32_t timeout_us;
|
||||
/* Task waiting on port, or TASK_ID_INVALID if none. */
|
||||
@@ -66,6 +66,15 @@ struct {
|
||||
enum i2c_transaction_state transaction_state;
|
||||
} cdata[I2C_CONTROLLER_COUNT];
|
||||
|
||||
/* Map port number to port name in datasheet, for debug prints. */
|
||||
static const char *i2c_port_names[MEC1322_I2C_PORT_COUNT] = {
|
||||
[MEC1322_I2C0_0] = "0_0",
|
||||
[MEC1322_I2C0_1] = "0_1",
|
||||
[MEC1322_I2C1] = "1",
|
||||
[MEC1322_I2C2] = "2",
|
||||
[MEC1322_I2C3] = "3",
|
||||
};
|
||||
|
||||
static void configure_controller_speed(int controller, int kbps)
|
||||
{
|
||||
int t_low, t_high;
|
||||
@@ -254,7 +263,8 @@ int chip_i2c_xfer(int port, int slave_addr, const uint8_t *out, int out_size,
|
||||
(((reg & (STS_BER | STS_LAB)) || !(reg & STS_NBB)) ||
|
||||
(get_line_level(controller)
|
||||
!= I2C_LINE_IDLE))) {
|
||||
CPRINTS("I2C%d bad status 0x%02x, SCL=%d, SDA=%d", port, reg,
|
||||
CPRINTS("i2c%s bad status 0x%02x, SCL=%d, SDA=%d",
|
||||
i2c_port_names[port], reg,
|
||||
get_line_level(controller) & I2C_LINE_SCL_HIGH,
|
||||
get_line_level(controller) & I2C_LINE_SDA_HIGH);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user