diff options
author | Furquan Shaikh <furquan@google.com> | 2016-06-17 15:50:24 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2016-06-21 20:04:33 +0200 |
commit | bae6383607ecf2415206e98c58da47cb10b66f7d (patch) | |
tree | 23389296a9962906e3efa901eec3bad1ff7b6362 /src/soc/intel/apollolake/romstage.c | |
parent | cad9b631365c0aa3f917455c3dd44edc3e0d21d4 (diff) |
intel/apollolake/spi: Add support for reading status reg
spi_read_status reads the status register using hardware sequencing and
returns 0 on success and -1 on error. Use spi_read_status to return
appropriate value for get_sw_write_protect.
BUG=chrome-os-partner:54283
Change-Id: I7650b5c0ab05a8429c2b291f00d4672446d86e03
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/15266
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/intel/apollolake/romstage.c')
-rw-r--r-- | src/soc/intel/apollolake/romstage.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/soc/intel/apollolake/romstage.c b/src/soc/intel/apollolake/romstage.c index 756e27534a..0c8f1c2de7 100644 --- a/src/soc/intel/apollolake/romstage.c +++ b/src/soc/intel/apollolake/romstage.c @@ -21,6 +21,7 @@ #include <arch/io.h> #include <arch/symbols.h> #include <assert.h> +#include <bootmode.h> #include <cbfs.h> #include <cbmem.h> #include <console/console.h> @@ -37,6 +38,7 @@ #include <soc/pci_devs.h> #include <soc/pm.h> #include <soc/romstage.h> +#include <soc/spi.h> #include <soc/uart.h> #include <string.h> #include <timestamp.h> @@ -260,3 +262,11 @@ void mainboard_memory_init_params(struct FSPM_UPD *mupd) { printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__); } + +int get_sw_write_protect_state(void) +{ + uint8_t status; + + /* Return unprotected status if status read fails. */ + return spi_read_status(&status) ? 0 : !!(status & 0x80); +} |