summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2016-04-14 20:13:47 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-05-19 18:18:05 -0700
commit5219d2f86b151ca942673e88ad58d2bbacae1c46 (patch)
treeefe9ccaee1443af599b27d30af29f6e6657a4b8d
parent828d5c19f679e714a3ab3ec0f14fa478fa8eec50 (diff)
downloadchrome-ec-stabilize-8350.21.B.tar.gz
spi_flash: Add protect_range table for W25Q40stabilize-8350.21.B
BUG=chrome-os-partner:53035 BRANCH=none TEST=needs testing Change-Id: I4b2bc758a22c2c19ddf0438a2af26f8c76093081 Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/339291 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--common/spi_flash_reg.c46
-rw-r--r--include/config.h3
2 files changed, 49 insertions, 0 deletions
diff --git a/common/spi_flash_reg.c b/common/spi_flash_reg.c
index 00041fb099..143103c075 100644
--- a/common/spi_flash_reg.c
+++ b/common/spi_flash_reg.c
@@ -49,6 +49,52 @@ static const struct protect_range spi_flash_protect_ranges[] = {
{ X, X, 0, { 0, 1, 1 }, 0x40000, 0x40000 }, /* Upper 1/2*/
};
+#elif defined(CONFIG_SPI_FLASH_W25Q40)
+/* Verified for W25Q40BV and W25Q40EW */
+static const struct protect_range spi_flash_protect_ranges[] = {
+ /* CMP = 0 */
+ { 0, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
+ { 0, 0, 0, { 0, 0, 1 }, 0x70000, 0x7ffff }, /* Upper 1/8 */
+ { 0, 0, 0, { 0, 1, 0 }, 0x60000, 0x7ffff }, /* Upper 1/4 */
+ { 0, 0, 0, { 0, 1, 1 }, 0x40000, 0x7ffff }, /* Upper 1/2 */
+ { 0, 0, 1, { 0, 0, 1 }, 0, 0x0ffff }, /* Lower 1/8 */
+ { 0, 0, 1, { 0, 1, 0 }, 0, 0x1ffff }, /* Lower 1/4 */
+ { 0, 0, 1, { 0, 1, 1 }, 0, 0x3ffff }, /* Lower 1/2 */
+ { 0, 0, X, { 1, X, X }, 0, 0x7ffff }, /* All */
+ { 0, 1, 0, { 0, 0, 1 }, 0x7f000, 0x7ffff }, /* Upper 1/128 */
+ { 0, 1, 0, { 0, 1, 0 }, 0x7e000, 0x7ffff }, /* Upper 1/64 */
+ { 0, 1, 0, { 0, 1, 1 }, 0x7c000, 0x7ffff }, /* Upper 1/32 */
+ { 0, 1, 0, { 1, 0, X }, 0x78000, 0x7ffff }, /* Upper 1/16 */
+ { 0, 1, 0, { 1, 1, 0 }, 0x78000, 0x7ffff }, /* Upper 1/16 */
+ { 0, 1, 1, { 0, 0, 1 }, 0, 0x00fff }, /* Lower 1/128 */
+ { 0, 1, 1, { 0, 1, 0 }, 0, 0x01fff }, /* Lower 1/64 */
+ { 0, 1, 1, { 0, 1, 1 }, 0, 0x03fff }, /* Lower 1/32 */
+ { 0, 1, 1, { 1, 0, X }, 0, 0x07fff }, /* Lower 1/16 */
+ { 0, 1, 1, { 1, 1, 0 }, 0, 0x07fff }, /* Lower 1/16 */
+ { 0, 1, X, { 1, 1, 1 }, 0, 0x7ffff }, /* All */
+ /* CMP = 1 */
+ { 1, X, X, { 0, 0, 0 }, 0, 0x7ffff }, /* All */
+ { 1, 0, 0, { 0, 0, 1 }, 0, 0x6ffff }, /* Lower 7/8 */
+ { 1, 0, 0, { 0, 1, 0 }, 0, 0x5ffff }, /* Lower 3/4 */
+ { 1, 0, 0, { 0, 1, 1 }, 0, 0x3ffff }, /* Lower 1/2 */
+ { 1, 0, 1, { 0, 0, 1 }, 0x10000, 0x7ffff }, /* Upper 7/8 */
+ { 1, 0, 1, { 0, 1, 0 }, 0x20000, 0x7ffff }, /* Upper 3/4 */
+ { 1, 0, 1, { 0, 1, 1 }, 0x40000, 0x7ffff }, /* Upper 1/2 */
+ { 1, 0, X, { 1, X, X }, 0, 0 }, /* None (W25Q40EW only) */
+ { 1, 1, 0, { 0, 0, 1 }, 0, 0x7efff }, /* Lower 127/128 */
+ { 1, 1, 0, { 0, 1, 0 }, 0, 0x7dfff }, /* Lower 63/64 */
+ { 1, 1, 0, { 0, 1, 1 }, 0, 0x7bfff }, /* Lower 31/32 */
+ { 1, 1, 0, { 1, 0, X }, 0, 0x77fff }, /* Lower 15/16 */
+ { 1, 1, 0, { 1, 1, 0 }, 0, 0x77fff }, /* Lower 15/16 */
+ { 1, 1, 1, { 0, 0, 1 }, 0x01000, 0x7ffff }, /* Upper 127/128 */
+ { 1, 1, 1, { 0, 1, 0 }, 0x02000, 0x7ffff }, /* Upper 63/64 */
+ { 1, 1, 1, { 0, 1, 1 }, 0x04000, 0x7ffff }, /* Upper 31/32 */
+ { 1, 1, 1, { 1, 0, X }, 0x08000, 0x7ffff }, /* Upper 15/16 */
+ { 1, 1, 1, { 1, 1, 0 }, 0x08000, 0x7ffff }, /* Upper 15/16 */
+ { 1, 1, X, { 1, 1, 1 }, 0, 0x7ffff }, /* All */
+
+};
+
#elif defined(CONFIG_SPI_FLASH_W25Q64)
static const struct protect_range spi_flash_protect_ranges[] = {
{ 0, X, X, { 0, 0, 0 }, 0, 0 }, /* No protection */
diff --git a/include/config.h b/include/config.h
index 5b0cc0ca71..c55a234769 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1581,6 +1581,9 @@
/* Define the SPI port to use to access the flash */
#undef CONFIG_SPI_FLASH_PORT
+/* Support W25Q40 SPI flash */
+#undef CONFIG_SPI_FLASH_W25Q40
+
/* Support W25Q64 SPI flash */
#undef CONFIG_SPI_FLASH_W25Q64