From nobody Tue Feb 10 01:34:50 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (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 BD70036B060 for ; Fri, 9 Jan 2026 17:18:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767979126; cv=none; b=pahsRaV/60InxeZ1kAZRE+iNx2gqz/dlc2CiDt5rYRVm86yJ2QsCJpsfR4ejqAUU+HRg18PsaLnW/qJ2tuIuSOYXtiJ6cK0nuTB0Nz133YnVZvoXj8QQCesxg1s64dZvLX6kRPKn7yjrNozy7mlrPA8q9BEd9g49v87T/akh1Yg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767979126; c=relaxed/simple; bh=s5DqMiIYKdUfxWUAhN4RGGYA4fqft2YfnmGn93p+UVQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ITN9VOyUUbGQurb83AWbCJH5RVq4nVsGQfuqxnxGdgjCUIqIXI3p5ElgP5MYb/J/vMJw7CDv3nBzafho5f94tDLbNxY2hqEARUb6+j6XrPelC+baN8EV+hKJ3e+C8Bc5+5LJ9MzfNo2IwkQKZppwW1Necb9DdPno+H4eX/wSVzg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VsVf09XI; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VsVf09XI" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id E3BABC1F6E5; Fri, 9 Jan 2026 17:18:16 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 38D1E606C6; Fri, 9 Jan 2026 17:18:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 99992103C89BE; Fri, 9 Jan 2026 18:18:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1767979122; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=MJtnWz64Xe2CigN2SsqL9dz4pY2jKcHax/iVWEjwuVE=; b=VsVf09XIYY2kdVeC7p8aVeJhhXqg3JjokyNXGBN/qHn+C8TZq/tt9kVF8GKjfzrTja2L49 ObuMZwLg6icAY8fW1jwM8TCNfKPkvcWs4PqikhCyUD+7fqYCE/mjiTLzwBfYEQGICfoQb7 LHVUj0tVRQ0O9Y3pZypA10d2LigK45IrsM87PfSQj9Lr2H/chB6Ct017Vm/mDMM/tHHAzI OmF7aL5DFTrSBB1621r+FS+UtY4TCk869vywmaiZB/zZc629UUxlIn1LxHE21ThmJa4SYC M0XEXdCHeuIgfp7NjC8xu/6zHpYF2N9bWBYd0E8O8oe/MY+vEVJGz2kvP619Dw== From: Miquel Raynal Date: Fri, 09 Jan 2026 18:18:18 +0100 Subject: [PATCH v2 20/27] mtd: spinand: winbond: Configure the IO mode after the dummy cycles Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260109-winbond-v6-17-rc1-oddr-v2-20-1fff6a2ddb80@bootlin.com> References: <20260109-winbond-v6-17-rc1-oddr-v2-0-1fff6a2ddb80@bootlin.com> In-Reply-To: <20260109-winbond-v6-17-rc1-oddr-v2-0-1fff6a2ddb80@bootlin.com> To: Mark Brown , Richard Weinberger , Vignesh Raghavendra Cc: Tudor Ambarus , Pratyush Yadav , Thomas Petazzoni , Steam Lin , Santhosh Kumar K , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Miquel Raynal X-Mailer: b4 0.14.3 X-Last-TLS-Session-Version: TLSv1.3 When we will change the bus interface, the action that actually performs the transition is the IO mode register write. This means after the IO mode register write, we should use the new bus interface. But the ->configure_chip() hook itself is not responsible of making this change official, it is the caller that must act according to the return value. Reorganize this helper to first configure the dummy cycles before possibly switching to another bus interface. Signed-off-by: Miquel Raynal --- drivers/mtd/nand/spi/winbond.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c index b16963637683..1d79a8ae7920 100644 --- a/drivers/mtd/nand/spi/winbond.c +++ b/drivers/mtd/nand/spi/winbond.c @@ -381,21 +381,6 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spi= nand) =20 op =3D spinand->op_templates->read_cache; =20 - single =3D (op->cmd.buswidth =3D=3D 1 && op->addr.buswidth =3D=3D 1 && op= ->data.buswidth =3D=3D 1); - dtr =3D (op->cmd.dtr || op->addr.dtr || op->data.dtr); - if (single && !dtr) - io_mode =3D W35N01JW_VCR_IO_MODE_SINGLE_SDR; - else if (!single && !dtr) - io_mode =3D W35N01JW_VCR_IO_MODE_OCTAL_SDR; - else if (!single && dtr) - io_mode =3D W35N01JW_VCR_IO_MODE_OCTAL_DDR; - else - return -EINVAL; - - ret =3D w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode); - if (ret) - return ret; - dummy_cycles =3D ((op->dummy.nbytes * 8) / op->dummy.buswidth) / (op->dum= my.dtr ? 2 : 1); switch (dummy_cycles) { case 8: @@ -413,6 +398,21 @@ static int w35n0xjw_vcr_cfg(struct spinand_device *spi= nand) if (ret) return ret; =20 + single =3D (op->cmd.buswidth =3D=3D 1 && op->addr.buswidth =3D=3D 1 && op= ->data.buswidth =3D=3D 1); + dtr =3D (op->cmd.dtr && op->addr.dtr && op->data.dtr); + if (single && !dtr) + io_mode =3D W35N01JW_VCR_IO_MODE_SINGLE_SDR; + else if (!single && !dtr) + io_mode =3D W35N01JW_VCR_IO_MODE_OCTAL_SDR; + else if (!single && dtr) + io_mode =3D W35N01JW_VCR_IO_MODE_OCTAL_DDR; + else + return -EINVAL; + + ret =3D w35n0xjw_write_vcr(spinand, W35N01JW_VCR_IO_MODE_REG, io_mode); + if (ret) + return ret; + return 0; } =20 --=20 2.51.1