summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2013-07-27 15:10:04 -0700
committerChromeBot <chrome-bot@google.com>2013-07-29 10:06:38 -0700
commite42e81e7eb0474b89198277c59e704ded24b99d4 (patch)
treeda4e927025802a8e397779af48b0a0da5f522df4
parent268e4790984d6607f4b244183a46e883f7214c18 (diff)
downloadchrome-ec-e42e81e7eb0474b89198277c59e704ded24b99d4.tar.gz
spring: support pull-down and pull-up on ENTERING_RW
Depending on the version of the board, the Silego GreenPakII has an internal pull-down (older boards) or an internal pull-up on the pin connected to the ENTERING_RW net, and the active edge is inverted (from raising edge to falling edge). Ensure we support both versions by probing the default level on the ENTERING_RW GPIO and doing a pulse in the right direction. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:21396 TEST=On both hardware versions of Spring, use the RO EC then the RW EC, and ensure we are reading back the right level on the EC_IN_RW GPIO on the AP side (GPD1_7) : echo 96 > /sys/class/gpio/export cat /sys/class/gpio/gpio96/value <get 0> ectool reboot_ec RW cat /sys/class/gpio/gpio96/value <get 1> Change-Id: I5bf45edd5bf7d0ed65f3ae25a8abe204bbed3989 Reviewed-on: https://gerrit.chromium.org/gerrit/63554 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/board.c2
-rw-r--r--common/system_common.c19
2 files changed, 20 insertions, 1 deletions
diff --git a/board/spring/board.c b/board/spring/board.c
index ac5643ec7a..be25f59d86 100644
--- a/board/spring/board.c
+++ b/board/spring/board.c
@@ -105,7 +105,7 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"EN_PP3300", GPIO_A, (1<<8), GPIO_OUT_LOW, NULL},
{"PMIC_PWRON_L",GPIO_A, (1<<12), GPIO_OUT_HIGH, NULL},
{"PMIC_RESET", GPIO_A, (1<<15), GPIO_OUT_LOW, NULL},
- {"ENTERING_RW", GPIO_D, (1<<0), GPIO_OUT_LOW, NULL},
+ {"ENTERING_RW", GPIO_D, (1<<0), GPIO_INPUT, NULL},
{"CHARGER_EN", GPIO_B, (1<<2), GPIO_OUT_LOW, NULL},
{"EC_INT", GPIO_B, (1<<9), GPIO_HI_Z, NULL},
{"ID_MUX", GPIO_D, (1<<1), GPIO_OUT_LOW, NULL},
diff --git a/common/system_common.c b/common/system_common.c
index d77d82070e..003bde2c29 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -16,6 +16,7 @@
#include "panic.h"
#include "system.h"
#include "task.h"
+#include "timer.h"
#include "uart.h"
#include "util.h"
#include "version.h"
@@ -302,7 +303,25 @@ static void jump_to_image(uint32_t init_addr)
* EC is not in read-only firmware. (This is not technically true if
* jumping from RO -> RO, but that's not a meaningful use case...)
*/
+#ifdef BOARD_spring
+ int value;
+
+ /* find whether we have a pull-up or a pull-down on the Silego side */
+ value = gpio_get_level(GPIO_ENTERING_RW);
+ /* drive ENTERING_RW and ensure we are doing the proper edge */
+ gpio_set_flags(GPIO_ENTERING_RW, GPIO_OUTPUT);
+ gpio_set_level(GPIO_ENTERING_RW, !value);
+ usleep(MSEC);
+ gpio_set_level(GPIO_ENTERING_RW, value);
+ usleep(MSEC);
+ /*
+ * the Silego chip has latched the edge,
+ * we are back in Hi-Z to save power.
+ */
+ gpio_set_flags(GPIO_ENTERING_RW, GPIO_INPUT);
+#else
gpio_set_level(GPIO_ENTERING_RW, 1);
+#endif
/* Flush UART output unless the UART hasn't been initialized yet */
if (uart_init_done())