Daniel Gröber (dxld) would like Daniel Gröber to review this change.

View Change

spi: Add struct spi_flash_bpbits, a common rep. for block protection

Change-Id: I02828b1f764aea29374e794001e74cdc86a94c92
Signed-off-by: Daniel Gröber <dxld@darkboxed.org>
---
M src/include/spi_flash.h
1 file changed, 33 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/42112/1
diff --git a/src/include/spi_flash.h b/src/include/spi_flash.h
index 35b02db..7dce216 100644
--- a/src/include/spi_flash.h
+++ b/src/include/spi_flash.h
@@ -49,6 +49,39 @@
int (*status)(const struct spi_flash *flash, u8 *reg);
};

+struct spi_flash_bpbits {
+ unsigned int bp; /*< block protection select bits */
+ bool cmp; /*< complement protect */
+ bool tb; /*< top=0 / bottom=1 select */
+ union {
+ struct {
+ union { bool srp1, srl; };
+ union { bool srp0, srp; };
+ /*
+ * For W25Q*{,F}* parts:
+ * srp1 srp0
+ * 0 0 | writable if WEL==1
+ * 0 1 | writable if WEL==1 && #WP==Vcc
+ * 1 0 | not writable until next power-down
+ * 1 1 | not writable, permanently
+ *
+ * checked datasheets: W25Q128FV, (W25Q80, W25Q16,
+ * W25Q32)
+ *
+ * For W25Q*{J,D}* parts:
+ *
+ * srl srp
+ * 0 0 | writable if WEL==1
+ * 0 1 | writable if WEL==1 && #WP==Vcc
+ * 1 x | not writable until next power-down
+ *
+ * checked datasheets: W25Q132JW, W25Q128JW, W25Q256JV.
+ * W25Q16DW
+ */
+ } winbond;
+ };
+};
+
/* Current code assumes all callbacks are supplied in this object. */
struct spi_flash_protection_ops {
/*

To view, visit change 42112. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I02828b1f764aea29374e794001e74cdc86a94c92
Gerrit-Change-Number: 42112
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Gröber (dxld)
Gerrit-Reviewer: Daniel Gröber <dxld@darkboxed.org>
Gerrit-MessageType: newchange