From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9BeP-0001U1-PN for qemu-devel@nongnu.org; Wed, 16 Dec 2015 07:57:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9BeL-0007Lw-4B for qemu-devel@nongnu.org; Wed, 16 Dec 2015 07:57:49 -0500 Received: from demumfd002.nsn-inter.net ([93.183.12.31]:55913) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9BeK-0007Lb-PR for qemu-devel@nongnu.org; Wed, 16 Dec 2015 07:57:45 -0500 From: marcin.krzeminski@nokia.com Date: Wed, 16 Dec 2015 13:57:06 +0100 Message-Id: <1450270635-27080-4-git-send-email-marcin.krzeminski@nokia.com> In-Reply-To: <1450270635-27080-1-git-send-email-marcin.krzeminski@nokia.com> References: <1450270635-27080-1-git-send-email-marcin.krzeminski@nokia.com> Subject: [Qemu-devel] [PATCH 03/12] Reset enable and reset memory commands support. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pawel.lenkow@nokia.com, peter.crosthwaite@xilinx.com, marcin.krzeminski@nokia.com From: Marcin Krzeminski Signed-off-by: Marcin Krzeminski --- hw/block/m25p80.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index bcb66a5..5e07b57 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -231,6 +231,10 @@ typedef enum { ERASE_4K = 0x20, ERASE_32K = 0x52, ERASE_SECTOR = 0xd8, + + RESET_ENABLE = 0x66, + RESET_MEMORY = 0x99, + } FlashCMD; typedef enum { @@ -258,6 +262,7 @@ typedef struct Flash { uint8_t cmd_in_progress; uint64_t cur_addr; bool write_enable; + bool reset_enable; bool initialized; uint8_t reset_pin; @@ -441,6 +446,7 @@ static void reset_memory(Flash *s) s->pos = 0; s->state = STATE_IDLE; s->write_enable = false; + s->reset_enable = false; DB_PRINT_L(0, "Reset done.\n"); } @@ -554,6 +560,14 @@ static void decode_new_cmd(Flash *s, uint32_t value) break; case NOP: break; + case RESET_ENABLE: + s->reset_enable = true; + break; + case RESET_MEMORY: + if (s->reset_enable) { + reset_memory(s); + } + break; default: qemu_log_mask(LOG_GUEST_ERROR, "M25P80: Unknown cmd %x\n", value); break; @@ -696,6 +710,7 @@ static const VMStateDescription vmstate_m25p80 = { VMSTATE_UINT8(cmd_in_progress, Flash), VMSTATE_UINT64(cur_addr, Flash), VMSTATE_BOOL(write_enable, Flash), + VMSTATE_BOOL(reset_enable, Flash), VMSTATE_BOOL(initialized, Flash), VMSTATE_UINT8(reset_pin, Flash), VMSTATE_END_OF_LIST() -- 2.5.0