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>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/193
diff --git a/writeprotect.c b/writeprotect.c
index 302451b..acc8714 100644
--- a/writeprotect.c
+++ b/writeprotect.c
@@ -169,7 +169,7 @@
value = (value & ~write_masks[reg]) | expected;
- if (spi_write_register(flash, reg, value, WRSR_EITHER))
+ if (spi_write_register(flash, reg, value, default_wrsr_target(flash)))
return FLASHPROG_WP_ERR_WRITE_FAILED;
}