From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1FCBD47CC9B; Sat, 28 Feb 2026 17:35:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300156; cv=none; b=S4OLXm8LKT4zntLCfC1t3xmsSzpwPTAooZoWpHDN2AYT7jk02XfAIXfkYCYnp3QxSsONH7nGN7AKhE1AlYnvLyGgU3sjo3RJjlLHI/Chc1kBxLdUOlWD4nU/I3vmaI6plbyvqa2gtD41l4nH0b8Z/bXuUqJUcf47feT3b3JN/oA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300156; c=relaxed/simple; bh=PnUWV+2waipA/3l6Zw0FE24BqUwqTNTQo97COvz2/04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kxQ/faBJ9Doxj+QNZVLfRpUae1MvY28xOpD6W30ZqYsoQc7CppISH5e6BG5W6p4ZzTr0KkjyHxiwuO/Wzd+TNx0R/wDZPjJeC7bxqDyIaddjKSkcqEshV26GXa7lGKitrCcfQBNwu8hfzeZ/6MLfUsRSS5suLkoLKy7AoVC/boM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=i5bK7Zvm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="i5bK7Zvm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 460C2C19425; Sat, 28 Feb 2026 17:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300155; bh=PnUWV+2waipA/3l6Zw0FE24BqUwqTNTQo97COvz2/04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5bK7Zvmh73xxX27WKRUAz/2lH97AYrjwA17hPRusO8deg3v07p1thM/lAwkABwig Cb35WAEAqBu689RTpj/YD9qj5K1tH8WWg7+72A0AC5UKBd9GCTpnAltqoP4yrZr+4E RrIMPoOn3pgq7aBQDidEEKH5TS3qRWbyfv81/+DWRSAWU8UktpuT7yaJS5jeYXAhtr ovMbEpImpvJFfG9iTdNKoOO09FBxR812IYUjP9W9ZOd/tkZte+GPqIFfjWR0ZBjVlM 5WuPQTHTLroN9Gt1S1yGZxccUhI0b393+OS/ZwjDNcNdY4MVkR+N2LDntGNpris58o Fj+KV477GAZQg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Miquel Raynal , Tudor Ambarus , Mark Brown , Sasha Levin Subject: [PATCH 6.19 174/844] spi: spi-mem: Limit octal DTR constraints to octal DTR situations Date: Sat, 28 Feb 2026 12:21:27 -0500 Message-ID: <20260228173244.1509663-175-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Miquel Raynal [ Upstream commit 8618271887ca10ac5108fe7e1d82ba8f1b152cf9 ] 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 Link: https://patch.msgid.link/20260109-winbond-v6-17-rc1-oddr-v2-3-1fff6a2ddb80@bootlin.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- 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 c8b2add2640e5..6c7921469b90b 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; - if (op->cmd.nbytes != 2) - return false; + /* Extra 8D-8D-8D limitations */ + if (op->cmd.dtr && op->cmd.buswidth == 8) { + if (op->cmd.nbytes != 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 != 1) return false; -- 2.51.0