From nobody Tue Feb 10 07:22:22 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 9C1EB354AEB for ; Fri, 31 Oct 2025 17:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761931722; cv=none; b=NM1jRpg94NyomUX0f8Vug4ZXeziW5jV5+eScqJAjdlKjAqxxWGCdWSBvInzdc75nVv+Uel3oAVmXFBrafTMCXHhptxegaB+qwa1qsXAyAdNv6JT0yMsPxDI7X5J1YTlIMWzReedzLPFneqxI3PfnSuTZLoa34HaajJBDI8LQ6aA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761931722; c=relaxed/simple; bh=R0YmQeghSKw5PoxKOG0myWRRdHkSep5Ke0+SMyuX6Bk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WeD91X/K60QyJjg4Df1TKilX42dTOCq1AmqnDNhtNOfTkEhYje/Ygy47UQcrz6LDCnrUUvqtRggmsAcQz2ScIhBulZtQ2iiOcnoevE51toaysl7H2ksnEMEmHSC0r8Ztcxb/moeuTpk/sXQhb2Xgt3K7JHwrFJ6UqRlBf9JR2Cw= 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=Lqri9Bfp; arc=none smtp.client-ip=185.246.84.56 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="Lqri9Bfp" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 31AE71A17C6; Fri, 31 Oct 2025 17:28:39 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 08ED260704; Fri, 31 Oct 2025 17:28:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 34D801181800A; Fri, 31 Oct 2025 18:28:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1761931718; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=ex2SptpuBK+4RMrw2hKUubiMGuwo3pULUp58RhXWy8w=; b=Lqri9Bfp6SGJi9VpPmHo/57DgqJdOMKyMulKxVXHIi3QC4AAF79B6F+8ZLKit4C8ASo7UO K1n8kNY/vTq2dvQjXPSHjfVGANKoIHExxrMZ6qlLB2sJE8pjMiAFgIGs8ETRUxPVdfEAcy ql3ge0KV8xxAE+YpANVrKMS4b0D/ufEWgHk9XR3mArK78+2j210ME00om8M3PTL9lVkg3M 3gGRPJitvJpAmjRlajBIVaVMRSp1zOWz+odGXPbCr4ws8J4uZOH4/b8/yxbasn9gQLZHdS oNYFsTk4PSMxPiF/FuiCGpPyGn8+nYI1taPrBekYVqcI+TaYGsWkPAWkvjpkJQ== From: Miquel Raynal Date: Fri, 31 Oct 2025 18:27:05 +0100 Subject: [PATCH 21/28] 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: <20251031-winbond-v6-17-rc1-oddr-v1-21-be42de23ebf1@bootlin.com> References: <20251031-winbond-v6-17-rc1-oddr-v1-0-be42de23ebf1@bootlin.com> In-Reply-To: <20251031-winbond-v6-17-rc1-oddr-v1-0-be42de23ebf1@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.2 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 b169636376835157c64bce17a4f32549e1c1eb9f..1d79a8ae79206af7d823018c460= 3b3bd36a0dd88 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.0