Signed-off-by: Stefan Tauner <stefan.tauner(a)alumni.tuwien.ac.at>
---
82802ab.c | 13 +++++++++++--
chipdrivers.h | 3 ++-
flash.h | 3 +--
flashchips.c | 54 ++++++++++++++++++++++++++----------------------------
4 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/82802ab.c b/82802ab.c
index 9e39852..cbc775b 100644
--- a/82802ab.c
+++ b/82802ab.c
@@ -40,11 +40,10 @@ void print_status_82802ab(uint8_t status)
msg_cdbg("%s", status & 0x2 ? "WP|TBL#|WP#,ABORT:" : "UNLOCK:");
}
-int probe_82802ab(struct flashctx *flash)
+static int probe_82802ab(struct flashctx *flash, bool shifted)
{
chipaddr bios = flash->virtual_memory;
uint8_t id1, id2, flashcontent1, flashcontent2;
- int shifted = (flash->chip->feature_bits & FEATURE_ADDR_SHIFTED) != 0;
/* Reset to get a clean state */
chip_writeb(flash, 0xFF, bios);
@@ -89,6 +88,16 @@ int probe_82802ab(struct flashctx *flash)
return 1;
}
+int probe_82802ab_shifted(struct flashctx *flash)
+{
+ return probe_82802ab(flash, true);
+}
+
+int probe_82802ab_unshifted(struct flashctx *flash)
+{
+ return probe_82802ab(flash, false);
+}
+
/* FIXME: needs timeout */
uint8_t wait_82802ab(struct flashctx *flash)
{
diff --git a/chipdrivers.h b/chipdrivers.h
index 03d922d..11a7191 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -127,7 +127,8 @@ int spi_erase_at45cs_sector(struct flashctx *flash, unsigned int addr, unsigned
/* 82802ab.c */
uint8_t wait_82802ab(struct flashctx *flash);
-int probe_82802ab(struct flashctx *flash);
+int probe_82802ab_shifted(struct flashctx *flash);
+int probe_82802ab_unshifted(struct flashctx *flash);
int erase_block_82802ab(struct flashctx *flash, unsigned int page, unsigned int pagesize);
int write_82802ab(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
void print_status_82802ab(uint8_t status);
diff --git a/flash.h b/flash.h
index d1bc6a3..9f75bbc 100644
--- a/flash.h
+++ b/flash.h
@@ -112,8 +112,7 @@ enum write_granularity {
#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_ADDR_SHIFTED (1 << 5)
-#define FEATURE_SLOW_ERASE_CMDS (1 << 6)
+#define FEATURE_SLOW_ERASE_CMDS (1 << 5)
/* Feature bits used for SPI only */
#define FEATURE_WRSR_EWSR (1 << 8)
#define FEATURE_WRSR_WREN (1 << 9)
diff --git a/flashchips.c b/flashchips.c
index d6b3a9f..6e6b3a8 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -2962,7 +2962,7 @@ const struct flashchip flashchips[] = {
.page_size = 0, /* unused */
.feature_bits = FEATURE_REGISTERMAP, /* TODO: LPC OK too? */
.tested = TEST_UNTESTED,
- .probe = probe_82802ab, /* TODO: 0xff cmd not documented? */
+ .probe = probe_82802ab_unshifted, /* TODO: 0xff cmd not documented? */
.block_erasers =
{
{
@@ -5647,7 +5647,7 @@ const struct flashchip flashchips[] = {
.total_size = 256,
.page_size = 256 * 1024,
.tested = TEST_OK_PRE,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -5673,7 +5673,7 @@ const struct flashchip flashchips[] = {
.total_size = 512,
.page_size = 256,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -5695,7 +5695,7 @@ const struct flashchip flashchips[] = {
.total_size = 512,
.page_size = 128 * 1024, /* maximal block size */
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -5721,7 +5721,7 @@ const struct flashchip flashchips[] = {
.total_size = 512,
.page_size = 128 * 1024, /* maximal block size */
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -5746,9 +5746,8 @@ const struct flashchip flashchips[] = {
.model_id = INTEL_28F400B,
.total_size = 512,
.page_size = 128 * 1024, /* maximal block size */
- .feature_bits = FEATURE_ADDR_SHIFTED,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_shifted,
.block_erasers =
{
{
@@ -5773,9 +5772,8 @@ const struct flashchip flashchips[] = {
.model_id = INTEL_28F400T,
.total_size = 512,
.page_size = 128 * 1024, /* maximal block size */
- .feature_bits = FEATURE_ADDR_SHIFTED,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_shifted,
.block_erasers =
{
{
@@ -5802,7 +5800,7 @@ const struct flashchip flashchips[] = {
.page_size = 64 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PREW,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -5826,7 +5824,7 @@ const struct flashchip flashchips[] = {
.page_size = 64 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PR,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -9127,7 +9125,7 @@ const struct flashchip flashchips[] = {
.total_size = 1024,
.page_size = 64 * 1024,
.tested = TEST_OK_PREW,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -9157,7 +9155,7 @@ const struct flashchip flashchips[] = {
.page_size = 64 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -10199,7 +10197,7 @@ const struct flashchip flashchips[] = {
.page_size = 256,
.feature_bits = 0,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -10651,7 +10649,7 @@ const struct flashchip flashchips[] = {
.page_size = 4 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -10714,7 +10712,7 @@ const struct flashchip flashchips[] = {
.page_size = 4 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -10746,7 +10744,7 @@ const struct flashchip flashchips[] = {
.page_size = 4 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PREW,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -10924,7 +10922,7 @@ const struct flashchip flashchips[] = {
.page_size = 4 * 1024,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PRE,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11180,7 +11178,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11212,7 +11210,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11244,7 +11242,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PRE,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11276,7 +11274,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11308,7 +11306,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11337,7 +11335,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11361,7 +11359,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PR,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11385,7 +11383,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_OK_PREW,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11409,7 +11407,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
@@ -11433,7 +11431,7 @@ const struct flashchip flashchips[] = {
.page_size = 0,
.feature_bits = FEATURE_REGISTERMAP,
.tested = TEST_UNTESTED,
- .probe = probe_82802ab,
+ .probe = probe_82802ab_unshifted,
.block_erasers =
{
{
--
Kind regards, Stefan Tauner