From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CF4335E955; Tue, 13 Oct 2026 12:45:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895550; cv=none; b=QTzSKFiSpcySPTvrvKLCp+RidMDcxsHnxKjKzf3FF5Q7QFeFtNcxcbkG+cNvtJoE2DrlTd8t++3Bz6OGmjJCG0XM1jBCdCQV7p8oQ9GbN7/ApJgEo/YSVRaiEkEsjQ/JdIS8Pd2m8J+V/+tYGJePWErHodGfVhg57DiOnWkaLhQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895550; c=relaxed/simple; bh=Hv6rjqsAq440197gw0J36rjCwiRrB4u+/p5e4ZVSW4U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N8t/zzgxZq8nrYSsYZY+fXWwFxe7joJ/DH9bROekqpYyjbzoLb6CLnp+8i/sqG9wANtTBMxk86rs1lxkrSyyy65t6Fk1+YJAR8Vc3SE/d9O4I2SCsruqfxm3GZyHkozMXYRCv8G/RsqaRLLQSJGg173fVofDYhKVTeIj8tpU0IU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Yj5c3+SJ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Yj5c3+SJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E88D41F00893; Tue, 13 Oct 2026 12:45:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791895549; bh=8Uavqtpuw78fkX5JyOMNPtpp+rc5KKpcR8oTUcXtJy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Yj5c3+SJoU+hvACA9IGVxVI4Jy5bvssc/JRPWq9m2p3EG81qT9kzRPZi4YHqOIVAb v1gPyxHkujIZH3x3ulqayClmpGNuAeG695JPkqzpNDvox1+DXTYJqeWV4HqrWfamiu PVta8J6ZaIoX7AOcaMwA38wl8Adq1U0zVfUsOzYk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Han Xu , Miquel Raynal , Sasha Levin Subject: [PATCH 6.12 311/497] mtd: spinand: Enable QE on all dies Date: Tue, 13 Oct 2026 13:37:58 +0200 Message-ID: <20261013112915.283664203@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Han Xu [ Upstream commit 63d6cace2c4a7f36c1cb44f1bb5e0f3ef19e5c7f ] The QUAD ENABLE (QE) bit is stored in a per-die configuration register on some SPI-NAND devices. When a device contains multiple dies, updating the QE bit only on the currently selected die can leave the remaining dies operating in non-quad mode.   Iterate over all targets and update the QE setting on each die during initialization to ensure consistent quad I/O operation across the entire device. Tested on ISSI IS38SMW04G8B. Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs") Cc: stable@vger.kernel.org Signed-off-by: Han Xu Signed-off-by: Miquel Raynal [ sashal: Retained spinand_init_quad_enable()’s internal QE decision instead of using the upstream enable parameter. ] Signed-off-by: Sasha Levin --- drivers/mtd/nand/spi/core.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index cb10cc573d9ae..797efd865ba96 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -179,7 +179,10 @@ static int spinand_init_cfg_cache(struct spinand_device *spinand) static int spinand_init_quad_enable(struct spinand_device *spinand) { + struct nand_device *nand = spinand_to_nand(spinand); + unsigned int target; bool enable = false; + int ret; if (!(spinand->flags & SPINAND_HAS_QE_BIT)) return 0; @@ -189,8 +192,22 @@ static int spinand_init_quad_enable(struct spinand_device *spinand) spinand->op_templates.update_cache->data.buswidth == 4) enable = true; - return spinand_upd_cfg(spinand, CFG_QUAD_ENABLE, - enable ? CFG_QUAD_ENABLE : 0); + /* + * QE is a per-die setting on some devices. Program each target + * individually when enabling or disabling quad I/O mode. + */ + for (target = 0; target < nand->memorg.ntargets; target++) { + ret = spinand_select_target(spinand, target); + if (ret) + return ret; + + ret = spinand_upd_cfg(spinand, CFG_QUAD_ENABLE, + enable ? CFG_QUAD_ENABLE : 0); + if (ret) + return ret; + } + + return 0; } static int spinand_ecc_enable(struct spinand_device *spinand, -- 2.53.0