From patchwork Tue Oct 24 19:51:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Francisco Iglesias X-Patchwork-Id: 10025419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 45D3560375 for ; Tue, 24 Oct 2017 19:53:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 399A7289CB for ; Tue, 24 Oct 2017 19:53:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E8EB28A21; Tue, 24 Oct 2017 19:53:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7E9E289CB for ; Tue, 24 Oct 2017 19:53:12 +0000 (UTC) Received: from localhost ([::1]:45278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e75GC-0002qS-4r for patchwork-qemu-devel@patchwork.kernel.org; Tue, 24 Oct 2017 15:53:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e75Er-0002ol-Jm for qemu-devel@nongnu.org; Tue, 24 Oct 2017 15:51:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e75Eo-0003O2-IV for qemu-devel@nongnu.org; Tue, 24 Oct 2017 15:51:49 -0400 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]:49006) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e75Eo-0003NP-B1 for qemu-devel@nongnu.org; Tue, 24 Oct 2017 15:51:46 -0400 Received: by mail-lf0-x244.google.com with SMTP id a69so25331538lfe.5 for ; Tue, 24 Oct 2017 12:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=x4e2JC7xht124iXc/bYBi+HsZWoNJwlGN8FC6y+Z318=; b=J23NaRVBsmTuGFO+2DwMvQPZqouwWyswzQ1iAsL0YNfO0DgBKCbmVVQeAofz2t6ag1 BSvmvYdvX4j+dm/tAAxnz3JOV8ozhTZAEaBpaPnoANNuv8N6rOvxvxA0kQ5N5fA88W5e 7Q5FJYMv9Pgtm4biu/AeF83ABceYwukBq58FtXQZtabp/y++Zm5/QpbVYz1QJ4NZFZn5 To6vhyvBpABijmiVj6k5BuR98wlnaZ45uZGlviWH6qRhFhXYWLtbkZ+yTLOzruZr8z8j 0+NskxmYntnBiVqFrm4h6IT0nAJgVgC26uC8JPfnwHaJujrFnMtFh3lu97lGMF4Aqsp0 twrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=x4e2JC7xht124iXc/bYBi+HsZWoNJwlGN8FC6y+Z318=; b=Y5jSKrfPQeALwv+JQnTYEXbBLhaJGPu8U5L9n8/73MG2r8x6Qo4q5VAU8XG8uxa3B7 mlOXsqWSWMNFa8+gt1+tLpF6UP7Rjd3FjnLZoBRCQRYjLEWjeP1UIef20KcDafiIxaSa R9waPzJAU1j1GQ+kEPUKRg6E2RC0m0aYhqQsuqkKHf9gcfNMuStPzekmxBcQFz0ZHL4y gbRxYgOBZaufz/MyGGdzZss4UIJNQLFCHCMZDadhJJpypdxPmb0Rp4GS19T1Juk1C3f6 GVxxrJ6g+O8Mi2a83rNzwIqV9inbJFQ3tQrf9fGvBSVR9qfWMqVnZX0NVX2oMpnvUyd5 ytZA== X-Gm-Message-State: AMCzsaXtaGR/zaDX69dMN4BsBk7YBRwndnoIAKwPyNHQGePqqZPDKpBb agu1Pv3Alj6V+fxma3JyOPLa0G0S X-Google-Smtp-Source: ABhQp+Qp3KdaQMqUIeOmC6gHyPEnFfiG55S3aJi8Ip8C9e5397pUH6YlKhXcEHAzv2N3ut+fFTfGtA== X-Received: by 10.46.80.88 with SMTP id v24mr7298978ljd.93.1508874704707; Tue, 24 Oct 2017 12:51:44 -0700 (PDT) Received: from localhost.localdomain (c83-254-152-225.bredband.comhem.se. [83.254.152.225]) by smtp.gmail.com with ESMTPSA id a78sm184390lfa.86.2017.10.24.12.51.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 12:51:43 -0700 (PDT) From: Francisco Iglesias To: qemu-devel@nongnu.org Date: Tue, 24 Oct 2017 21:51:27 +0200 Message-Id: <20171024195139.28179-2-frasse.iglesias@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171024195139.28179-1-frasse.iglesias@gmail.com> References: <20171024195139.28179-1-frasse.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 Subject: [Qemu-devel] [PATCH v3 01/13] m25p80: Add support for continuous read out of RDSR and READ_FSR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgari@xilinx.com, alistai@xilinx.com, francisco.iglesias@feimtech.se Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add support for continuous read out of the RDSR and READ_FSR status registers until the chip select is deasserted. This feature is supported by amongst others 1 or more flashtypes manufactured by Numonyx (Micron), Windbond, SST, Gigadevice, Eon and Macronix. Signed-off-by: Francisco Iglesias Acked-by: Marcin KrzemiƄski --- hw/block/m25p80.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index a2438b9..2971519 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -423,6 +423,7 @@ typedef struct Flash { uint8_t data[M25P80_INTERNAL_DATA_BUFFER_SZ]; uint32_t len; uint32_t pos; + bool data_read_loop; uint8_t needed_bytes; uint8_t cmd_in_progress; uint32_t cur_addr; @@ -983,6 +984,7 @@ static void decode_new_cmd(Flash *s, uint32_t value) } s->pos = 0; s->len = 1; + s->data_read_loop = true; s->state = STATE_READING_DATA; break; @@ -993,6 +995,7 @@ static void decode_new_cmd(Flash *s, uint32_t value) } s->pos = 0; s->len = 1; + s->data_read_loop = true; s->state = STATE_READING_DATA; break; @@ -1133,6 +1136,7 @@ static int m25p80_cs(SSISlave *ss, bool select) s->pos = 0; s->state = STATE_IDLE; flash_sync_dirty(s, -1); + s->data_read_loop = false; } DB_PRINT_L(0, "%sselect\n", select ? "de" : ""); @@ -1198,7 +1202,9 @@ static uint32_t m25p80_transfer8(SSISlave *ss, uint32_t tx) s->pos++; if (s->pos == s->len) { s->pos = 0; - s->state = STATE_IDLE; + if (!s->data_read_loop) { + s->state = STATE_IDLE; + } } break;