]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
e7d80d697b8e91eb87f90c3d91be3931064f4527
[thirdparty/kernel/stable-queue.git] /
1 From 89e7353f522f5cf70cb48c01ce2dcdcb275b8022 Mon Sep 17 00:00:00 2001
2 From: Conor Dooley <conor.dooley@microchip.com>
3 Date: Mon, 25 Aug 2025 12:53:28 +0100
4 Subject: spi: microchip-core-qspi: stop checking viability of op->max_freq in supports_op callback
5
6 From: Conor Dooley <conor.dooley@microchip.com>
7
8 commit 89e7353f522f5cf70cb48c01ce2dcdcb275b8022 upstream.
9
10 In commit 13529647743d9 ("spi: microchip-core-qspi: Support per spi-mem
11 operation frequency switches") the logic for checking the viability of
12 op->max_freq in mchp_coreqspi_setup_clock() was copied into
13 mchp_coreqspi_supports_op(). Unfortunately, op->max_freq is not valid
14 when this function is called during probe but is instead zero.
15 Accordingly, baud_rate_val is calculated to be INT_MAX due to division
16 by zero, causing probe of the attached memory device to fail.
17
18 Seemingly spi-microchip-core-qspi was the only driver that had such a
19 modification made to its supports_op callback when the per_op_freq
20 capability was added, so just remove it to restore prior functionality.
21
22 CC: stable@vger.kernel.org
23 Reported-by: Valentina Fernandez <valentina.fernandezalanis@microchip.com>
24 Fixes: 13529647743d9 ("spi: microchip-core-qspi: Support per spi-mem operation frequency switches")
25 Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
26 Message-ID: <20250825-during-ploy-939bdd068593@spud>
27 Signed-off-by: Mark Brown <broonie@kernel.org>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 ---
30 drivers/spi/spi-microchip-core-qspi.c | 12 ------------
31 1 file changed, 12 deletions(-)
32
33 --- a/drivers/spi/spi-microchip-core-qspi.c
34 +++ b/drivers/spi/spi-microchip-core-qspi.c
35 @@ -458,10 +458,6 @@ error:
36
37 static bool mchp_coreqspi_supports_op(struct spi_mem *mem, const struct spi_mem_op *op)
38 {
39 - struct mchp_coreqspi *qspi = spi_controller_get_devdata(mem->spi->controller);
40 - unsigned long clk_hz;
41 - u32 baud_rate_val;
42 -
43 if (!spi_mem_default_supports_op(mem, op))
44 return false;
45
46 @@ -484,14 +480,6 @@ static bool mchp_coreqspi_supports_op(st
47 return false;
48 }
49
50 - clk_hz = clk_get_rate(qspi->clk);
51 - if (!clk_hz)
52 - return false;
53 -
54 - baud_rate_val = DIV_ROUND_UP(clk_hz, 2 * op->max_freq);
55 - if (baud_rate_val > MAX_DIVIDER || baud_rate_val < MIN_DIVIDER)
56 - return false;
57 -
58 return true;
59 }
60