Make FEATURE_LONG_RESET a proper feature bit
This will make it possible to see at runtime if a chip
actually supports both reset methods.
Change-Id: Id5fb5af743215435dfc289105bdfcc5fd739eabb
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/435
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/include/flash.h b/include/flash.h
index 8aff7a1..b89df03 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -109,10 +109,9 @@
#define MAX_CHIP_RESTORE_FUNCTIONS 4
/* Feature bits used for non-SPI only */
-#define FEATURE_LONG_RESET (0 << 4)
-#define FEATURE_SHORT_RESET (1 << 4)
-#define FEATURE_EITHER_RESET FEATURE_LONG_RESET
-#define FEATURE_RESET_MASK (FEATURE_LONG_RESET | FEATURE_SHORT_RESET)
+#define FEATURE_LONG_RESET (1 << 0)
+#define FEATURE_SHORT_RESET (1 << 1)
+#define FEATURE_EITHER_RESET (FEATURE_LONG_RESET | FEATURE_SHORT_RESET)
#define FEATURE_ADDR_FULL (0 << 2)
#define FEATURE_ADDR_MASK (3 << 2)
#define FEATURE_ADDR_2AA (1 << 2)
diff --git a/jedec.c b/jedec.c
index d97736d..f3dfdd0 100644
--- a/jedec.c
+++ b/jedec.c
@@ -195,7 +195,7 @@
if (probe_timing_enter)
programmer_delay(probe_timing_enter);
/* Reset chip to a clean slate */
- if ((chip->feature_bits & FEATURE_RESET_MASK) == FEATURE_LONG_RESET)
+ if (chip->feature_bits & FEATURE_LONG_RESET)
{
chip_writeb(flash, 0xAA, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
if (probe_timing_exit)
@@ -238,7 +238,7 @@
}
/* Issue JEDEC Product ID Exit command */
- if ((chip->feature_bits & FEATURE_RESET_MASK) == FEATURE_LONG_RESET)
+ if (chip->feature_bits & FEATURE_LONG_RESET)
{
chip_writeb(flash, 0xAA, bios + ((shifted ? 0x2AAA : 0x5555) & mask));
if (probe_timing_exit)