From nobody Mon Feb 9 23:17:51 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 9A824363C7D for ; Fri, 9 Jan 2026 17:18:24 +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=1767979106; cv=none; b=uoosTQKwFBvDJOM7Oxlxr4w07po08VQ/4ShQ8fThmFzzVJf3Q6rUSw8KjAY81KBrWfeeeKrwsVsTx6/CJUD6bPbiztP0M1wJA6mdBYfEFNXBahMjWprsiVyB1ilQt2Zk4dHBZZXnwqt/xLHz4HanB837Kvh+TcraI1Einl6DgeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767979106; c=relaxed/simple; bh=Vcy/12KBDerD4lsZZ0OCPmONKW4YxSkzB+GIyt5FonY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sLuZlzqSwX2oLvcO8MIL49AWrqgvueHOCb3jBs46Wy3ueWG7vRj+BKRzf8Zf1NtSmRGnDEL4GOHuJP/4XiP0cojrUpzrSdolhzqY3iEb7Cq2L6wcSydQU9zzes57AZsXD6gMLmdGUhVZ8QMfRuB0Kkj2r6oaWMvFfjnKW+qw7aQ= 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=rt6j6ZvB; 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="rt6j6ZvB" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 95136C1F6E7; Fri, 9 Jan 2026 17:17:56 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DEDC8606C6; Fri, 9 Jan 2026 17:18:22 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 31395103C89AF; Fri, 9 Jan 2026 18:18:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1767979102; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=hpWiGp2IJhYFgxmfj56BPtbUVs0Zl/pSRbFJbsG8PAQ=; b=rt6j6ZvB+gVvtkjvT5b/qqqXMMtTMJ4no6KRPrg1z7A7g8TY9U3T9os07NoQaiH2IhQm5i lPKkvlAjD7ltT/lsLFyAUy3d1F9faa21ajqVuB0rNUr2AfvZjzfRGKu+CUoZqhqSyvcFUi ghhPFrH3emnkB39qO6dC2BqStYVXb2GYomhEu1UPQVkzxyAXyCV9KgLlNOhecjsCtoqqNJ gFAgodyruiT+Hiyy6lNvj04pXH/hP4SykA2w0Dk6U51N8gj1yawctATkcPIL3kMJQYVdD5 mtC8yG7L9zEUIIFKPSZ0wmY25+gvFIcolbtpLtsJ4siA7tRGyUSR1ivTjc8JaA== From: Miquel Raynal Date: Fri, 09 Jan 2026 18:18:01 +0100 Subject: [PATCH v2 03/27] spi: spi-mem: Limit octal DTR constraints to octal DTR situations 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-3-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 In this helper, any operation with a single DTR cycle (like 1S-1S-8D) is considered requiring a duplicated command opcode. This is wrong as this constraint only applies to octal DTR operations (8D-8D-8D). Narrow the application of this constraint to the concerned bus interface. Note: none of the possible XD-XD-XD pattern, with X being one of {1, 2, 4} would benefit from this check either as there is only in octal DTR mode that a single clock edge would be enough to transmit the full opcode. Make sure the constraint of expecting two bytes for the command is applied to the relevant bus interface. Reviewed-by: Tudor Ambarus Signed-off-by: Miquel Raynal --- drivers/spi/spi-mem.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index c8b2add2640e..6c7921469b90 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -178,8 +178,19 @@ bool spi_mem_default_supports_op(struct spi_mem *mem, if (op->data.swap16 && !spi_mem_controller_is_capable(ctlr, swap16)) return false; =20 - if (op->cmd.nbytes !=3D 2) - return false; + /* Extra 8D-8D-8D limitations */ + if (op->cmd.dtr && op->cmd.buswidth =3D=3D 8) { + if (op->cmd.nbytes !=3D 2) + return false; + + if ((op->addr.nbytes % 2) || + (op->dummy.nbytes % 2) || + (op->data.nbytes % 2)) { + dev_err(&ctlr->dev, + "Even byte numbers not allowed in octal DTR operations\n"); + return false; + } + } } else { if (op->cmd.nbytes !=3D 1) return false; --=20 2.51.1