From nobody Fri Nov 20 20:38:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.tenstorrent.com ARC-Seal: i=1; a=rsa-sha256; t=1794334389; cv=none; d=zohomail.com; s=zohoarc; b=LQLUf/h+kOQXq6lSC7rFLw7iqSdIc15SWEeXyoWyIfIzaHZyUsbgo9bzX5F+uCjYtNYQfw2LDmQ1xnhf62OMtNFn4CiOtTPKfEksDRWHlY8l1SywryV8vNZHktWUGNEPPR9Y1KRdywAMzNoGRAeUYZEae4riMk8UGHz/KGWg1J0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794334389; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2lz6ftAxs01+ACSsm7X1ZjSLeJAPTBgkfGH2sQxS7JU=; b=l/YIQtEcIngXLgCEY+rpkkfqxI/sCAU0mD23qqsKeOnnOvGyBdqjHIw0v/5x3p8iB4NJTRCjqp8cNtFtUzlbEk1ADRvk6VYf+xfr+2eitYpLkhyY7248NyZt9JZk8l3YJTYXHSDD4/Fe1wzZWmKkiz/O10KZQRwMfoW4EjdllKU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794334389763972.7826387974652; Tue, 10 Nov 2026 10:13:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xQqKe-0004OU-Qa; Tue, 10 Nov 2026 13:12:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQqKO-0004Km-VD for qemu-devel@nongnu.org; Tue, 10 Nov 2026 13:12:21 -0500 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xQqKI-0001BX-LR for qemu-devel@nongnu.org; Tue, 10 Nov 2026 13:12:12 -0500 Received: by mail-oo1-xc34.google.com with SMTP id 006d021491bc7-702dedeb70dso1209694eaf.1 for ; Tue, 10 Nov 2026 10:12:10 -0800 (PST) Received: from [10.200.24.109] ([12.55.13.134]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-718aa034ad2sm2063514eaf.13.2026.11.10.10.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 10:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1794334329; x=1794939129; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2lz6ftAxs01+ACSsm7X1ZjSLeJAPTBgkfGH2sQxS7JU=; b=MTNPgQHuW+AoPs2+N7wi6yAb6ttgMX0+GDulCCMGeAomaP7OrRyWw2gLhIVD2Gn0l3 oDiS4XAerDZ8NhJFRkR4SAqa+5ufwkYOthP2zCxSYBhTu8vwNP/RcGLFrNFqV1pYN/nC zpEIx/uEmW/bUKA3iXD1T9gdcjgUBFY51FS4TGJkqaAXZecGXgjpMurOiqAH3q7fO15x wuHigiT/vUo0/wPUzV1HtMysMczZFBlOs+KZhgg0pxWCJBO/HexJb+MbnvbVBuE3Vaxl Z+MHvMOpSOUBOVd4g3hnveNJ7EFf1FJ6HqR80bN7pnnM7KZVki5TeyUbGtQSAIZlxtYz WJxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794334329; x=1794939129; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2lz6ftAxs01+ACSsm7X1ZjSLeJAPTBgkfGH2sQxS7JU=; b=sBRR73WPVzxvYDYzxNAWQsYgV1Uk6k8jTblRqnlNz8mvN8MQLBr9PMndSwXj4F325G X+m2UpFCyHeJEu0oQljT+WXXde5W1Fnf22pFz6L6xlsx5Pg/sLeySaucTnTtVYdYbgY+ FQl8/iN8yZCfnbbUel03sK62i8niXlLSZfll5je0m5FnUJKKihUT8GLDizQcf6oUDvdW Ae3LCcpZs3GHX/fckLwL+kReA1UXOf//ajgjPVEDmySMq8JU5aEbI16dPh3PJyKpujg0 mK4tPk2e0lQelQn+pPIPYLcDXR8444z8Do0fQzqiBRZNjHOVZkhl8EOrTcw3121HrgBk /loQ== X-Gm-Message-State: APuU4Z+2vuY0DTY6/IDLp1MVl9urIQIuExIuXJzcdhmqT04ZFJQLYdgf hGJpvbYVbrCEA/p5GGeQs3hNWFiP4NNS59073QsPvzuF99W8dUe6iYXqzVo/j/H91Mg= X-Gm-Gg: AYBFou39WdgY4skupwLrpopWbhPEbWENtvWVkgOkCwpJWpZaI4tsKmMU0StPQA3G3U8 /5R7ye4p+qBab6AyGHZGgBN9wuCllGM1ZbHVnXl3LxiSyLhIU/3eSXmRDRIu2a8U5v+Qk/PzHFy ccrUOmhIiNzb8lD800xqlSEmrvTi+nKLiCen1sw0z0u6q7Tg6BuWmCFzDdtQsaRABSVTp/xRd/W NrDLgC0HVNi1JdTXTF5gLOa3VtFj3PIQ9eRoCLzn58htWNjLM17ZLawWOeKevyQb5tr//RmWsIs LgLjzTj7LrIN+wkn94zvODkiaqEhbdKQzcF0JXRzxhLUTYLYdOJRvZoBlVzDwPTAtZ58fCO78Lh YbbD6A5OnGKXB0k8/LteKS4jzDroyOJR8raAEgS6U3wtXPrcyxs5xGnRSkcOcWl1uh+KKLKm7rD PU+6O8pOS/xHTNjaSl+DFllbdS8YExo6awATJ1fBBb/6oQJks26jVeMXW6etSqIMI103m+D7S9G n+A6lYE9N3yvKtUA73Fr5PoeQC0dBFCPTIcXGSKyf5g/NfMeGo2aQWVRTK/E6jZ29VMSv1G495T 6z1iQ+6F+yNGMo/t8cb8ludawgN9pJJkINQrjU5X1U9qPCgyaOXDiVI6456Lr6wjkHb+Y2jlAXR yq1k= X-Received: by 2002:a05:6820:628:b0:715:1e5a:dc95 with SMTP id 006d021491bc7-7189e63d743mr1693528eaf.0.1794334329314; Tue, 10 Nov 2026 10:12:09 -0800 (PST) From: Anirudh Srinivasan Date: Tue, 10 Nov 2026 12:11:48 -0600 Subject: [PATCH 1/2] test/qtest/aspeed_smc-test: Send write enable before each page program command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261110-m25p80_write_enable_fix-v1-1-3a2abc0072b0@oss.tenstorrent.com> References: <20261110-m25p80_write_enable_fix-v1-0-3a2abc0072b0@oss.tenstorrent.com> In-Reply-To: <20261110-m25p80_write_enable_fix-v1-0-3a2abc0072b0@oss.tenstorrent.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Jamin Lin , Kane Chen , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-arm@nongnu.org, Alistair Francis , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, Anirudh Srinivasan X-Mailer: b4 0.15.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=asrinivasan@tenstorrent.com; helo=mail-oo1-xc34.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @tenstorrent.com) X-ZM-MESSAGEID: 1794334393111158500 The M25P80 specification [1] dictates that a write enable (WREN) must be sent before a page program (PP), and that the write enable latch (WEL) is reset at some point before the PP command has finished. The current tests that make use of page program send WREN only once at the beginning, before issuing multiple PP commands. The m25p80 implementation in QEMU doesn't deassert WEL at the end of each PP operation (so this isn't an issue currently), but real hardware would unset WEL at the end of the first PP command the second PP command would fail. Update the tests to send WREN before each PP command. The current m25p80 model does not reset the WEL at the end of each PP command. This is a bug, and a subsequent commit will fix this. [1] https://www.alldatasheet.com/datasheet-pdf/download/22807/STMICROELECTR= ONICS/M25P80.html Signed-off-by: Anirudh Srinivasan --- tests/qtest/aspeed-smc-utils.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/tests/qtest/aspeed-smc-utils.c b/tests/qtest/aspeed-smc-utils.c index 146332240d..85e883d0b8 100644 --- a/tests/qtest/aspeed-smc-utils.c +++ b/tests/qtest/aspeed-smc-utils.c @@ -218,12 +218,23 @@ static void read_page_mem(const AspeedSMCTestData *da= ta, uint32_t addr, typedef void (*read_page_mem_fn)(const AspeedSMCTestData *data, uint32_t addr, uint32_t *page); =20 +static void flash_write_enable(const AspeedSMCTestData *data) +{ + spi_ctrl_start_user(data); + flash_writeb(data, 0, WREN); + spi_ctrl_stop_user(data); +} + static void write_page_mem(const AspeedSMCTestData *data, uint32_t addr, uint32_t write_value) { - spi_ctrl_setmode(data, CTRL_WRITEMODE, PP); - for (int i =3D 0; i < FLASH_PAGE_SIZE / 4; i++) { + /* Send write enable before each Page Program */ + flash_write_enable(data); + + /* move out USER mode to use direct writes to the AHB bus */ + spi_ctrl_setmode(data, CTRL_WRITEMODE, PP); + flash_writel(data, addr + i * 4, write_value); } } @@ -468,10 +479,13 @@ void aspeed_smc_test_write_page_mem(const void *data) flash_writeb(test_data, 0, WREN); spi_ctrl_stop_user(test_data); =20 - /* move out USER mode to use direct writes to the AHB bus */ - spi_ctrl_setmode(test_data, CTRL_WRITEMODE, PP); - for (i =3D 0; i < FLASH_PAGE_SIZE / 4; i++) { + /* Send write enable before each Page Program */ + flash_write_enable(test_data); + + /* move out USER mode to use direct writes to the AHB bus */ + spi_ctrl_setmode(test_data, CTRL_WRITEMODE, PP); + flash_writel(test_data, my_page_addr + i * 4, make_be32(my_page_addr + i * 4)); } --=20 2.43.0 From nobody Fri Nov 20 20:38:00 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.tenstorrent.com ARC-Seal: i=1; a=rsa-sha256; t=1794334396; cv=none; d=zohomail.com; s=zohoarc; b=FnP+etnjHOlpdWGslEcrx0emVHP0Pq3+RBMwoeGOax+t9aR/87VuBRQ+JC4LjudwgJZws70GyWOpCh5cHAa9W8WUsEl4AsXiHwSUgJqdOyHfHmSnZP/y0fWdUMMOnJDWKlghSRbeMlhjhR7G+t5ZbWJo65R0UnkNK9uFEBSaeN0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794334396; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=82yY37z4xR89rS78RrvGdWkJgveQfhnXEPscnEIBwQ8=; b=VWfH9pBWRrU+yzYGssqP4KCQiHChacpoEd26oUJ+o+o1b2lK0nlI3etgKRt8IFQfcRfsiA82EXXeCs1vNbq/PXeUs0OC90Udli2cH5IwO6gocEFGvfzjO6mmczMFJyAhPExN5RYxEbv4wCnhNtYtTXL84Bw9jZnvPgIhqOAi+3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1794334396431461.13867625320313; Tue, 10 Nov 2026 10:13:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xQqKg-0004P9-0O; Tue, 10 Nov 2026 13:12:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xQqKS-0004L4-6T for qemu-devel@nongnu.org; Tue, 10 Nov 2026 13:12:24 -0500 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1xQqKJ-0001Bk-Fr for qemu-devel@nongnu.org; Tue, 10 Nov 2026 13:12:17 -0500 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-70bf1671c21so1364506eaf.1 for ; Tue, 10 Nov 2026 10:12:10 -0800 (PST) Received: from [10.200.24.109] ([12.55.13.134]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-718aa034ad2sm2063514eaf.13.2026.11.10.10.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 10:12:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenstorrent.com; s=google; t=1794334330; x=1794939130; darn=nongnu.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=82yY37z4xR89rS78RrvGdWkJgveQfhnXEPscnEIBwQ8=; b=UuY4iDgZxagvc0bmpeemqx3hEh5XmHRsaU8GqO9x6gtI29kTpeLo9OCy5cdX63Bapg 8AuTWpuH/whgaXOjo4FXXDwrufNkPkmuh7QYiMkfp0FxpesdpkM0mrrfdGqhsSVkQ7pC FO2C44dsaNE6+p5FsfBOyHb50cF17niPY1cKa/o/kKNFspl0fCqKAQzt/dNWzdjzIsgL C1DedUh/idOt03xGG7aHkKQQNBJ/aygZyI90N1vtMntepV1TK+HWufUs5tRCKx2ZgwI3 pKQEMhD5nuwHM1J1P9uVkuH1j8+4+v0wXSU9ceCefG1MTwzdNI9hSptaBqnBuV9i0O47 si9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794334330; x=1794939130; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=82yY37z4xR89rS78RrvGdWkJgveQfhnXEPscnEIBwQ8=; b=Xp1ZfqvOOUhsqyOYoI1l3C1D+BMGrx1eFFAvokq19p4iXhYe2idj3Qg8eX6p6kbRoP uefwbEnNY0iSTueORG2mrotEBc42/qCqpEMfLpZWN6Jx9s3HcuhV20dtvNB8/lWP1ArO yiop/Xeky0xEAwdi32Iu3K3UEkRQl7U6erC2x9yk+0hR7GIYJHOjj05azh6+aCt5MAal w9LSksAyDiPAnzeLURiXUB+RHm57viRP7UN6BuN1vDmRU4hjVJhMIAPSgCZCVTurw6aF qqrEy+pYQoDWyg7I2OzJWAP7moNjdmDLlhzX7MNsu9Egtm7xM8aHlZU6o4EQIW+Ovu2c M0kA== X-Gm-Message-State: APuU4Z+GcjL5mGwWiZiMSFETEv75foekgWxi+Z6ox7JEK0QFVv20bMtn x0dElYnqhdE2pFP4aDaD9cTkC8VSq89SKzP/43jb2ATmrccmzAOs+VHDkHX8PhXf+wA= X-Gm-Gg: AYBFou2bVU1E24VbGqAZfpxAlrA2C6vnE4uDl6kZf6skUj8WrcmiWrDoPkiTAC7Lpnk SJlrqMky/akiOzmfu54IEjceKgOPh8pSUsTP3TLhfuKOYtRl/Lh+RnXoKCLOimJlGtiemsptCoq HMJVMvayGhzdp2G7JwYY+t1zSszAWt4vZ69dIKeZXT810qfSTILIJogBiJVPrcguLxe7qRG1gjy ueoO7ErGSg3/Xcj9H66IMDxsnJ+6T3Vm0gwELIS/r1XdaAIM4/hKxaHKBY245GyocDUKyrFkuBX iucpeZmnl1/S83iMDu1K77gpIzsiH0jYRvTvDLEIMGlkceG3sWyPhoB4BD/7TX62ykU7PGUXaIO 1zWoQKLgR0/rbNrCbD0vis5sRDD5h7ZywF8kDnHXJJNwt/rM1T7lHdPOp570Re21Q8TdB6DsZli q3VaeulfVs8H/JcI9XD3pSfmsBk1Vzbr+F5Zj0RzUxnrwApcexVy4Veqob1XOlJXf4GwPDNtdwq yAFIXUBfvmNjFEcguRvXhu331wp86l3pFrXq+gTAZrCln+H6Zqd/UIpxI1jHw1LRd5FfY7TJgW0 JcsOQ0BIJyi9aa/LWFmyHO6d5zRVrnQbxYwKCO2kYZcvjnxLgkInL+lrdYFoa6jT3YhLq+iQ0PW daYE= X-Received: by 2002:a05:6820:c2c7:20b0:713:da3b:8b07 with SMTP id 006d021491bc7-718a683de44mr1418242eaf.54.1794334330213; Tue, 10 Nov 2026 10:12:10 -0800 (PST) From: Anirudh Srinivasan Date: Tue, 10 Nov 2026 12:11:49 -0600 Subject: [PATCH 2/2] m25p80: Clear write_enable after page program and flash erase operation MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261110-m25p80_write_enable_fix-v1-2-3a2abc0072b0@oss.tenstorrent.com> References: <20261110-m25p80_write_enable_fix-v1-0-3a2abc0072b0@oss.tenstorrent.com> In-Reply-To: <20261110-m25p80_write_enable_fix-v1-0-3a2abc0072b0@oss.tenstorrent.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Maydell , Jamin Lin , Kane Chen , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , qemu-arm@nongnu.org, Alistair Francis , Kevin Wolf , Hanna Reitz , qemu-block@nongnu.org, Anirudh Srinivasan X-Mailer: b4 0.15.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::c2a; envelope-from=asrinivasan@tenstorrent.com; helo=mail-oo1-xc2a.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @tenstorrent.com) X-ZM-MESSAGEID: 1794334399257158500 NOR flash drivers in EDK2[1] and its forks[2] poll for write enable (WEL) to be deasserted at the end of a SPI operation to indicate that the operation has been completed. The m25p80 spec[3] indicates that real hardware would desassert WEL at the end of page program and erase operations. The m25p80 model does not deassert WEL at the end of these operations. Update the model to do so to match hardware behaviour. [1] https://github.com/tianocore/edk2/blob/3c890c11dfdb5908dcbc84f977dddc6c= 6d43789f/MdeModulePkg/Bus/Spi/SpiNorFlashJedecSfdp/SpiNorFlash.c#L987 [2] https://github.com/spacemit-com/edk2-platforms/blob/0b8b7182d8a20a771b9= 7a487d0e6f4ab89fb3492/Silicon/Spacemit/Drivers/Spi/SpiNorFlashDxe/SpiNorFla= shDxe.c#L532 [3] https://www.alldatasheet.com/datasheet-pdf/download/22807/STMICROELECTR= ONICS/M25P80.html Signed-off-by: Anirudh Srinivasan --- hw/block/m25p80.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 545e0b5728..cedfec67a2 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -650,6 +650,8 @@ static void flash_erase(Flash *s, int offset, FlashCMD = cmd) } memset(s->storage + offset, 0xff, len); flash_sync_area(s, offset, len); + + s->write_enable =3D false; } =20 static inline void flash_sync_dirty(Flash *s, int64_t newpage) @@ -1599,6 +1601,10 @@ static int m25p80_cs(SSIPeripheral *ss, bool select) if (s->state =3D=3D STATE_COLLECTING_VAR_LEN_DATA) { complete_collecting_data(s); } + /* Deassert WEL at the end of a non-AAI page program */ + if (s->state =3D=3D STATE_PAGE_PROGRAM && !s->aai_enable) { + s->write_enable =3D false; + } s->len =3D 0; s->pos =3D 0; s->state =3D STATE_IDLE; --=20 2.43.0