summaryrefslogtreecommitdiff
path: root/driver/ppc
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2018-05-15 10:22:26 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-16 12:41:39 -0700
commite07cad44fd4808eabc836e616b73900a60fcf6d4 (patch)
tree79abe7840f4fa0e65d75e4c008800f9229156600 /driver/ppc
parent607865dca4965720feec5cb0d3a9148e4ab69b29 (diff)
downloadchrome-ec-e07cad44fd4808eabc836e616b73900a60fcf6d4.tar.gz
ppc: sn5s330: Add port number to error messages
This CL adds the port number to the error messages for the TI sn5330 PPC driver. It also adds 'ppc' so that its clear where the messages are coming from. BRANCH=none BUG=b:79640678 TEST=Tested on Bip MLB and verfied that PPC EC console log errors display the port number. Change-Id: I7988e5e4008c005bb1ef9a78331d4a2597fdcb62 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1060105 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
Diffstat (limited to 'driver/ppc')
-rw-r--r--driver/ppc/sn5s330.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index e0abf3aacf..37c559ce67 100644
--- a/driver/ppc/sn5s330.c
+++ b/driver/ppc/sn5s330.c
@@ -113,7 +113,7 @@ static int get_func_set3(uint8_t port, int *regval)
status = read_reg(port, SN5S330_FUNC_SET3, regval);
if (status)
- CPRINTS("Failed to read FUNC_SET3!");
+ CPRINTS("ppc p%d: Failed to read FUNC_SET3!", port);
return status;
}
@@ -166,7 +166,7 @@ static int sn5s330_pp_fet_enable(uint8_t port, enum sn5s330_pp_idx pp,
status = write_reg(port, SN5S330_FUNC_SET3, regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET3!");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET3!", port);
return status;
}
@@ -210,7 +210,8 @@ static int sn5s330_init(int port)
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET1,
regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET1! Retrying...");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET1! Retrying..",
+ port);
retries++;
msleep(1);
} else {
@@ -222,21 +223,21 @@ static int sn5s330_init(int port)
regval = 0x37;
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET5, regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET5!");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET5!", port);
return status;
}
/* Set Vbus UVP threshold to ~2.75V. */
status = i2c_read8(i2c_port, i2c_addr, SN5S330_FUNC_SET6, &regval);
if (status) {
- CPRINTS("Failed to read FUNC_SET6!");
+ CPRINTS("ppc p%d: Failed to read FUNC_SET6!", port);
return status;
}
regval &= ~0x3F;
regval |= 1;
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET6, regval);
if (status) {
- CPRINTS("Failed to write FUNC_SET6!");
+ CPRINTS("ppc p%d: Failed to write FUNC_SET6!", port);
return status;
}
@@ -244,7 +245,7 @@ static int sn5s330_init(int port)
regval = SN5S330_SBU_EN | 0xf;
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET2, regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET2!");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET2!", port);
return status;
}
@@ -257,7 +258,7 @@ static int sn5s330_init(int port)
regval = SN5S330_OVP_EN_CC | SN5S330_PP2_CONFIG;
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET9, regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET9!");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET9!", port);
return status;
}
@@ -266,40 +267,40 @@ static int sn5s330_init(int port)
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET11,
regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET11");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET11", port);
return status;
}
/* Turn off dead battery resistors and turn on CC FETs. */
status = i2c_read8(i2c_port, i2c_addr, SN5S330_FUNC_SET4, &regval);
if (status) {
- CPRINTS("Failed to read FUNC_SET4!");
+ CPRINTS("ppc p%d: Failed to read FUNC_SET4!", port);
return status;
}
regval |= SN5S330_CC_EN;
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET4, regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET4!");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET4!", port);
return status;
}
/* Set ideal diode mode for both PP1 and PP2. */
status = i2c_read8(i2c_port, i2c_addr, SN5S330_FUNC_SET3, &regval);
if (status) {
- CPRINTS("Failed to read FUNC_SET3!");
+ CPRINTS("ppc p%d: Failed to read FUNC_SET3!", port);
return status;
}
regval |= SN5S330_SET_RCP_MODE_PP1 | SN5S330_SET_RCP_MODE_PP2;
status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET3, regval);
if (status) {
- CPRINTS("Failed to set FUNC_SET3!");
+ CPRINTS("ppc p%d: Failed to set FUNC_SET3!", port);
return status;
}
/* Turn off PP1 FET. */
status = sn5s330_pp_fet_enable(port, SN5S330_PP1, 0);
if (status) {
- CPRINTS("Failed to turn off PP1 FET!");
+ CPRINTS("ppc p%d: Failed to turn off PP1 FET!", port);
}
/*
@@ -318,7 +319,7 @@ static int sn5s330_init(int port)
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_STATUS_REG4,
regval);
if (status) {
- CPRINTS("Failed to write INT_STATUS_REG4!");
+ CPRINTS("ppc p%d: Failed to write INT_STATUS_REG4!", port);
return status;
}
@@ -336,14 +337,14 @@ static int sn5s330_init(int port)
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_MASK_RISE_REG1,
regval);
if (status) {
- CPRINTS("Failed to write INT_MASK_RISE1!");
+ CPRINTS("ppc p%d: Failed to write INT_MASK_RISE1!", port);
return status;
}
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_MASK_FALL_REG1,
regval);
if (status) {
- CPRINTS("Failed to write INT_MASK_FALL1!");
+ CPRINTS("ppc p%d: Failed to write INT_MASK_FALL1!", port);
return status;
}
@@ -351,14 +352,14 @@ static int sn5s330_init(int port)
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_MASK_RISE_REG2,
0xFF);
if (status) {
- CPRINTS("Failed to write INT_MASK_RISE2!");
+ CPRINTS("ppc p%d: Failed to write INT_MASK_RISE2!", port);
return status;
}
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_MASK_FALL_REG2,
0xFF);
if (status) {
- CPRINTS("Failed to write INT_MASK_FALL2!");
+ CPRINTS("ppc p%d: Failed to write INT_MASK_FALL2!", port);
return status;
}
@@ -372,14 +373,14 @@ static int sn5s330_init(int port)
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_MASK_RISE_REG3,
regval);
if (status) {
- CPRINTS("Failed to write INT_MASK_RISE3!");
+ CPRINTS("ppc p%d: Failed to write INT_MASK_RISE3!", port);
return status;
}
status = i2c_write8(i2c_port, i2c_addr, SN5S330_INT_MASK_FALL_REG3,
regval);
if (status) {
- CPRINTS("Failed to write INT_MASK_FALL3!");
+ CPRINTS("ppc p%d: Failed to write INT_MASK_FALL3!", port);
return status;
}
@@ -389,7 +390,7 @@ static int sn5s330_init(int port)
reg++) {
status = i2c_write8(i2c_port, i2c_addr, reg, 0xFF);
if (status) {
- CPRINTS("Failed to write reg 0x%2x!");
+ CPRINTS("ppc p%d: Failed to write reg 0x%2x!", port);
return status;
}
}
@@ -402,7 +403,7 @@ static int sn5s330_init(int port)
status = i2c_read8(i2c_port, i2c_addr, SN5S330_INT_STATUS_REG4,
&regval);
if (status) {
- CPRINTS("Failed to read INT_STATUS_REG4!");
+ CPRINTS("ppc p%d: Failed to read INT_STATUS_REG4!", port);
return status;
}
@@ -417,7 +418,7 @@ static int sn5s330_init(int port)
/* Turn on PP2 FET. */
status = sn5s330_pp_fet_enable(port, SN5S330_PP2, 1);
if (status) {
- CPRINTS("Failed to turn on PP2 FET!");
+ CPRINTS("ppc p%d: Failed to turn on PP2 FET!", port);
return status;
}
}
@@ -433,7 +434,7 @@ static int sn5s330_is_vbus_present(int port)
rv = read_reg(port, SN5S330_INT_STATUS_REG3, &regval);
if (rv) {
- CPRINTS("p%d: VBUS present error (%d)", port, rv);
+ CPRINTS("ppc p%d: VBUS present error (%d)", port, rv);
return 0;
}
@@ -448,7 +449,7 @@ static int sn5s330_is_sourcing_vbus(int port)
rv = sn5s330_is_pp_fet_enabled(port, SN5S330_PP1, &is_sourcing_vbus);
if (rv) {
- CPRINTS("p%d: Failed to determine source FET status! (%d)",
+ CPRINTS("ppc p%d: Failed to determine source FET status! (%d)",
port, rv);
return 0;
}
@@ -527,8 +528,8 @@ static int sn5s330_discharge_vbus(int port, int enable)
status = write_reg(port, SN5S330_FUNC_SET3, regval);
if (status) {
- CPRINTS("Failed to %s vbus discharge",
- enable ? "enable" : "disable");
+ CPRINTS("ppc p%d: Failed to %s vbus discharge",
+ port, enable ? "enable" : "disable");
return status;
}