Introduce FLASHPROG_FLAG_NON_VOLATILE_WRSR

Add a new flag to our flash context that tells us if we should use
volatile or non-volatile status-register writes by default. Use it
in the write-protection API. The logic to disable block protection
automatically stays as is for now, until we have established tools
to manually control the protection.

Change-Id: Ie9a41b6404991075e2bf76bcffbd4e9887c62c79
Signed-off-by: Nico Huber <nico.h@gmx.de>
diff --git a/include/chipdrivers.h b/include/chipdrivers.h
index b38ac55..56644a0 100644
--- a/include/chipdrivers.h
+++ b/include/chipdrivers.h
@@ -71,6 +71,10 @@
 	WRSR_NON_VOLATILE_BITS	= 2,
 	WRSR_EITHER		= 3,
 };
+static inline enum wrsr_target default_wrsr_target(const struct flashctx *flash)
+{
+	return flash->flags.non_volatile_wrsr ? WRSR_NON_VOLATILE_BITS : WRSR_VOLATILE_BITS;
+}
 int spi_read_register(const struct flashctx *flash, enum flash_reg reg, uint8_t *value);
 int spi_write_register(const struct flashctx *flash, enum flash_reg reg, uint8_t value, enum wrsr_target);
 void spi_prettyprint_status_register_bit(uint8_t status, int bit);