summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-05-16 14:02:54 -0700
committerKatie Roberts-Hoffman <katierh@chromium.org>2013-05-22 16:22:01 -0700
commit7ad32623a753b36e370488f4a9c37106efa0dc06 (patch)
tree7d87d39a88dfb739ab266608bf4e071ab7d22e4b
parent645f8119b920d76dfa1923477de827cdfb36cfbd (diff)
downloadchrome-ec-7ad32623a753b36e370488f4a9c37106efa0dc06.tar.gz
Support write protect GPIO on pit
Daisy doesn't have a write protect signal, so emulate it as a fake signal which is always low; this maintains the current behavior on daisy. BUG=chrome-os-partner:15613 BRANCH=none TEST=flashinfo shows gpio not asserted then short across the WP screw and flashinfo shows it asserted Change-Id: I329424efe1c3b065976e17395e2bf9588cdce88c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/51500 Reviewed-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit 7d207c98e2a99accbd1ab1353d0a802f9a8be3de) Reviewed-on: https://gerrit.chromium.org/gerrit/56321 Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org> Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org> Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
-rw-r--r--board/daisy/board.c3
-rw-r--r--board/daisy/board.h2
-rw-r--r--chip/stm32/flash-stm32l15x.c12
3 files changed, 9 insertions, 8 deletions
diff --git a/board/daisy/board.c b/board/daisy/board.c
index 72f601abb1..777073cb77 100644
--- a/board/daisy/board.c
+++ b/board/daisy/board.c
@@ -94,6 +94,9 @@ const struct gpio_info gpio_list[GPIO_COUNT] = {
{"KB_OUT10", GPIO_C, (1<<5), GPIO_KB_OUTPUT, NULL},
{"KB_OUT11", GPIO_C, (1<<6), GPIO_KB_OUTPUT, NULL},
{"KB_OUT12", GPIO_C, (1<<7), GPIO_KB_OUTPUT, NULL},
+
+ /* Unimplemented signals which we need to emulate for now */
+ GPIO_SIGNAL_NOT_IMPLEMENTED("WP_L"),
};
/* I2C ports */
diff --git a/board/daisy/board.h b/board/daisy/board.h
index d5826f4265..5f15cc4ef4 100644
--- a/board/daisy/board.h
+++ b/board/daisy/board.h
@@ -112,6 +112,8 @@ enum gpio_signal {
GPIO_KB_OUT10,
GPIO_KB_OUT11,
GPIO_KB_OUT12,
+ /* Unimplemented signals we emulate */
+ GPIO_WP_L,
/* Number of GPIOs; not an actual GPIO */
GPIO_COUNT
};
diff --git a/chip/stm32/flash-stm32l15x.c b/chip/stm32/flash-stm32l15x.c
index 811ee3a125..eb97c16da7 100644
--- a/chip/stm32/flash-stm32l15x.c
+++ b/chip/stm32/flash-stm32l15x.c
@@ -7,6 +7,7 @@
#include "console.h"
#include "flash.h"
+#include "gpio.h"
#include "registers.h"
#include "task.h"
#include "timer.h"
@@ -309,14 +310,9 @@ uint32_t flash_get_protect(void)
int not_protected[2] = {0};
int i;
- /*
- * TODO: (crosbug.com/p/15613) write protect scheme
- *
- * Always enable write protect until we have WP pin. For developer to
- * unlock WP, please use stm32mon -u and immediately re-program the
- * pstate sector.
- */
- flags |= EC_FLASH_PROTECT_GPIO_ASSERTED;
+ /* Check write protect GPIO */
+ if (gpio_get_level(GPIO_WP_L) == 0)
+ flags |= EC_FLASH_PROTECT_GPIO_ASSERTED;
/* Scan flash protection */
for (i = 0; i < PHYSICAL_BANKS; i++) {