aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Krzeminski <marcin.krzeminski@nokia.com>2016-06-27 15:37:33 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-06-27 15:37:33 +0100
commit9964674e5016741f453f322e2b0c422c32cb2220 (patch)
treed8868f4d0b0e9aaaa4f040af45a1c9d24541c8f9
parente02b3bf263f81abb99164230e98043c60333d6e1 (diff)
m25p80: Introduce COLLECTING_VAR_LEN_DATA state.
Some flash allows to stop read at any time. Allow framework to support this. Signed-off-by: Marcin Krzeminski <marcin.krzeminski@nokia.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Message-id: 1466755631-25201-5-git-send-email-marcin.krzeminski@nokia.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/block/m25p80.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 187899c402..0af2ee4dc6 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -330,6 +330,7 @@ typedef enum {
STATE_PAGE_PROGRAM,
STATE_READ,
STATE_COLLECTING_DATA,
+ STATE_COLLECTING_VAR_LEN_DATA,
STATE_READING_DATA,
} CMDState;
@@ -872,6 +873,9 @@ static int m25p80_cs(SSISlave *ss, bool select)
Flash *s = M25P80(ss);
if (select) {
+ if (s->state == STATE_COLLECTING_VAR_LEN_DATA) {
+ complete_collecting_data(s);
+ }
s->len = 0;
s->pos = 0;
s->state = STATE_IDLE;
@@ -905,6 +909,7 @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx)
break;
case STATE_COLLECTING_DATA:
+ case STATE_COLLECTING_VAR_LEN_DATA:
s->data[s->len] = (uint8_t)tx;
s->len++;