summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2020-06-26 12:44:37 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-22 22:37:56 +0000
commitb93f139e47f8ced7ebe2414737296f9a6ba49cbc (patch)
tree790b5e88fda7d40d72597bdfd9eb22ed342344cd /board
parente19d7f2b47cc62245114ba26da36d753d48714bd (diff)
downloadchrome-ec-b93f139e47f8ced7ebe2414737296f9a6ba49cbc.tar.gz
servo_v4p1: Handle ioexpanders irq in a deferred function call
Performing i2c transfers from interrupt context seems to reset the device. Handling the interrupt in a deferred function gets around the problem. BRANCH=none BUG=b:146793000 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I7d4609670f5d9826de12f87f5543f231de875df5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2270695 Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'board')
-rw-r--r--board/servo_v4p1/board.c31
-rw-r--r--board/servo_v4p1/ioexpanders.c42
-rw-r--r--board/servo_v4p1/ioexpanders.h6
3 files changed, 49 insertions, 30 deletions
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c
index 8ee4e6f158..3572285dfb 100644
--- a/board/servo_v4p1/board.c
+++ b/board/servo_v4p1/board.c
@@ -58,36 +58,7 @@ static void vbus1_evt(enum gpio_signal signal)
static void tca_evt(enum gpio_signal signal)
{
- uint8_t fault;
-
- fault = read_faults();
-
- if (!(fault & USERVO_FAULT_L))
- ccprintf("FAULT: Microservo USB A port load switch\n");
-
- if (!(fault & USB3_A0_FAULT_L))
- ccprintf("FAULT: USB3 A0 port load switch\n");
-
- if (!(fault & USB3_A1_FAULT_L))
- ccprintf("FAULT: USB3 A1 port load switch\n");
-
- if (!(fault & USB_DUTCHG_FLT_ODL))
- ccprintf("FAULT: Overcurrent on Charger or DUB CC/SBU lines\n");
-
- if (!(fault & PP3300_DP_FAULT_L))
- ccprintf("FAULT: Overcurrent on DisplayPort\n");
-
- if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
- ccprintf("FAULT: CC1 drive circuitry has exceeded thermal ");
- ccprintf("limits or exceeded current limits. Power ");
- ccprintf("off DAC0 to clear the fault\n");
- }
-
- if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
- ccprintf("FAULT: CC2 drive circuitry has exceeded thermal ");
- ccprintf("limits or exceeded current limits. Power ");
- ccprintf("off DAC1 to clear the fault\n");
- }
+ irq_ioexpanders();
}
static volatile uint64_t hpd_prev_ts;
diff --git a/board/servo_v4p1/ioexpanders.c b/board/servo_v4p1/ioexpanders.c
index ac0f616b8a..6617a8d30e 100644
--- a/board/servo_v4p1/ioexpanders.c
+++ b/board/servo_v4p1/ioexpanders.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include "hooks.h"
#include "i2c.h"
#include "ioexpanders.h"
#include "tca6416a.h"
@@ -126,6 +127,47 @@ int init_ioexpanders(void)
return EC_SUCCESS;
}
+static void ioexpanders_irq(void)
+{
+ int fault;
+
+ fault = read_faults();
+
+ if (!(fault & USERVO_FAULT_L))
+ ccprintf("FAULT: Microservo USB A port load switch\n");
+
+ if (!(fault & USB3_A0_FAULT_L))
+ ccprintf("FAULT: USB3 A0 port load switch\n");
+
+ if (!(fault & USB3_A1_FAULT_L))
+ ccprintf("FAULT: USB3 A1 port load switch\n");
+
+ if (!(fault & USB_DUTCHG_FLT_ODL))
+ ccprintf("FAULT: Overcurrent on Charger or DUB CC/SBU lines\n");
+
+ if (!(fault & PP3300_DP_FAULT_L))
+ ccprintf("FAULT: Overcurrent on DisplayPort\n");
+
+ if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
+ ccprintf("FAULT: CC1 drive circuitry has exceeded thermal ");
+ ccprintf("limits or exceeded current limits. Power ");
+ ccprintf("off DAC0 to clear the fault\n");
+ }
+
+ if (!(fault & DAC_BUF1_LATCH_FAULT_L)) {
+ ccprintf("FAULT: CC2 drive circuitry has exceeded thermal ");
+ ccprintf("limits or exceeded current limits. Power ");
+ ccprintf("off DAC1 to clear the fault\n");
+ }
+}
+DECLARE_DEFERRED(ioexpanders_irq);
+
+int irq_ioexpanders(void)
+{
+ hook_call_deferred(&ioexpanders_irq_data, 0);
+ return 0;
+}
+
inline int sbu_uart_sel(int en)
{
return tca6416a_write_bit(1, TCA6416A_OUT_PORT_0, 0, en);
diff --git a/board/servo_v4p1/ioexpanders.h b/board/servo_v4p1/ioexpanders.h
index 7d96448e2f..d444a6fca3 100644
--- a/board/servo_v4p1/ioexpanders.h
+++ b/board/servo_v4p1/ioexpanders.h
@@ -16,6 +16,12 @@ enum uservo_fastboot_mux_sel_t {
*/
int init_ioexpanders(void);
+/*
+ * Calls the Ioexpanders Deferred handler for interrupts
+ * Should be called from the ioexpanders IRQ handler
+ */
+int irq_ioexpanders(void);
+
/**
* SBU Crosspoint select
*