summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Lo <Kenneth_Lo@asus.com>2014-04-10 14:08:16 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-04-30 03:21:51 +0000
commit0e1f0e7a355344568e810db1ec0ffd597ad68557 (patch)
treecc59f18ff34efb5b3bf9926dac6369ec49388798
parentd95fcdc457a51dff8003b8cb29b32319f4fdd8ca (diff)
downloadchrome-ec-0e1f0e7a355344568e810db1ec0ffd597ad68557.tar.gz
Quawks: Add pure hardware shutdown mechanism.
Quawks boards need a pure hardware protection mechanism to shutdown/reset system even if EC is hanged. This is done using the ALERT# pin of TMP432 thermal IC. So EC programs TMP432 with specified temperature limit value every time when system is booted, to make sure this mechanism works as expected. BUG=chrome-os-partner:28184 BRANCH=rambi TEST=Run "make -j buildall" and "make -j BOARD=quawks tests". Tested by thermal engineers that system will shutdown when specified temperature is reached. Change-Id: I485852409153c036488eac2ae9c0a8fe4e2c5b61 Signed-off-by: Kenneth Lo <Kenneth_Lo@asus.com> Reviewed-on: https://chromium-review.googlesource.com/195120 Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--board/quawks/build.mk2
-rw-r--r--board/quawks/thermal_shutdown.c47
2 files changed, 48 insertions, 1 deletions
diff --git a/board/quawks/build.mk b/board/quawks/build.mk
index d3bca1d912..94cb6192a2 100644
--- a/board/quawks/build.mk
+++ b/board/quawks/build.mk
@@ -9,4 +9,4 @@
# the IC is TI Stellaris LM4
CHIP:=lm4
-board-y=battery.o board.o led.o
+board-y=battery.o board.o led.o thermal_shutdown.o
diff --git a/board/quawks/thermal_shutdown.c b/board/quawks/thermal_shutdown.c
new file mode 100644
index 0000000000..9730363d9e
--- /dev/null
+++ b/board/quawks/thermal_shutdown.c
@@ -0,0 +1,47 @@
+/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Pure hardware thermal shutdown via TMP432 for Quawks.
+ */
+
+#include "board.h"
+#include "console.h"
+#include "hooks.h"
+#include "tmp432.h"
+#include "i2c.h"
+
+#define CPRINTF(format, args...) cprintf(CC_THERMAL, format, ## args)
+
+#define THERMAL_SHUTDOWN_TEMP 76
+
+/**
+ * Set pure hardware thermal shutdown temperature via TMP432.
+ *
+ * The target temperature value is set in board.h.
+ */
+static void set_pure_hardware_thermal_shutdown_temp(void)
+{
+ int value;
+
+ if ( i2c_write8(
+ I2C_PORT_THERMAL,
+ TMP432_I2C_ADDR,
+ TMP432_LOCAL_THERM_LIMIT, THERMAL_SHUTDOWN_TEMP) >= 0 &&
+ i2c_read8(
+ I2C_PORT_THERMAL,
+ TMP432_I2C_ADDR,
+ TMP432_LOCAL_THERM_LIMIT, &value) >= 0)
+ {
+ CPRINTF("[%T TMP432_LOCAL_THERM_LIMIT now = %dC]\n", value);
+ }
+ else
+ {
+ CPRINTF("[%T Failed to set shutdown temp!!]\n");
+ }
+}
+DECLARE_HOOK( HOOK_CHIPSET_STARTUP,
+ set_pure_hardware_thermal_shutdown_temp,
+ HOOK_PRIO_DEFAULT);