* [PATCH] spi: dw: fix wrong BAUDR setting after resume
@ 2026-06-12 0:28 Jisheng Zhang
2026-06-16 17:31 ` Mark Brown
2026-06-16 20:43 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Jisheng Zhang @ 2026-06-12 0:28 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-spi, linux-kernel
After resuming from suspend to ram, spi transfer stops working. Further
debugging shows that the BAUDR register isn't correctly set, this is
due to dws->current_freq doesn't match the HW BAUDR setting,
specifically, the dws->current_freq equals to speed_hz, but BAUDR is 0.
so the dw_spi_set_clk() in below code won't be called:
if (dws->current_freq != speed_hz) {
dw_spi_set_clk(dws, clk_div);
dws->current_freq = speed_hz;
}
The mismatch comes from dw_spi_shutdown_chip() when suspending.
Fix this mismatch by setting dws->current_freq to 0 as well when
clearing BAUDR reg in dw_spi_shutdown_chip().
Fixes: e24c74527207 ("spi: controller driver for Designware SPI core")
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
drivers/spi/spi-dw.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index 9cc79c566a70..2f2debc64e73 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -282,6 +282,7 @@ static inline void dw_spi_shutdown_chip(struct dw_spi *dws)
{
dw_spi_enable_chip(dws, 0);
dw_spi_set_clk(dws, 0);
+ dws->current_freq = 0;
}
extern void dw_spi_set_cs(struct spi_device *spi, bool enable);
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: dw: fix wrong BAUDR setting after resume
2026-06-12 0:28 [PATCH] spi: dw: fix wrong BAUDR setting after resume Jisheng Zhang
@ 2026-06-16 17:31 ` Mark Brown
2026-06-16 20:43 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-06-16 17:31 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 824 bytes --]
On Fri, Jun 12, 2026 at 08:28:35AM +0800, Jisheng Zhang wrote:
> After resuming from suspend to ram, spi transfer stops working. Further
> debugging shows that the BAUDR register isn't correctly set, this is
> due to dws->current_freq doesn't match the HW BAUDR setting,
> specifically, the dws->current_freq equals to speed_hz, but BAUDR is 0.
> so the dw_spi_set_clk() in below code won't be called:
> if (dws->current_freq != speed_hz) {
> dw_spi_set_clk(dws, clk_div);
> dws->current_freq = speed_hz;
> }
> The mismatch comes from dw_spi_shutdown_chip() when suspending.
> Fix this mismatch by setting dws->current_freq to 0 as well when
> clearing BAUDR reg in dw_spi_shutdown_chip().
Looks like the same bug exists for rx_sample_dly, that's a separate
issue though.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: dw: fix wrong BAUDR setting after resume
2026-06-12 0:28 [PATCH] spi: dw: fix wrong BAUDR setting after resume Jisheng Zhang
2026-06-16 17:31 ` Mark Brown
@ 2026-06-16 20:43 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-06-16 20:43 UTC (permalink / raw)
To: Jisheng Zhang; +Cc: linux-spi, linux-kernel
On Fri, 12 Jun 2026 08:28:35 +0800, Jisheng Zhang wrote:
> spi: dw: fix wrong BAUDR setting after resume
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.2
Thanks!
[1/1] spi: dw: fix wrong BAUDR setting after resume
https://git.kernel.org/broonie/spi/c/66b6605bcea7
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-17 13:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12 0:28 [PATCH] spi: dw: fix wrong BAUDR setting after resume Jisheng Zhang
2026-06-16 17:31 ` Mark Brown
2026-06-16 20:43 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox