Skip to content

Commit cb4f93b

Browse files
xhackerustcgregkh
authored andcommitted
spi: dw: fix wrong BAUDR setting after resume
[ Upstream commit 66b6605 ] 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: e24c745 ("spi: controller driver for Designware SPI core") Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Link: https://patch.msgid.link/20260612002835.5240-1-jszhang@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 6564da2 commit cb4f93b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/spi/spi-dw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static inline void dw_spi_shutdown_chip(struct dw_spi *dws)
282282
{
283283
dw_spi_enable_chip(dws, 0);
284284
dw_spi_set_clk(dws, 0);
285+
dws->current_freq = 0;
285286
}
286287

287288
extern void dw_spi_set_cs(struct spi_device *spi, bool enable);

0 commit comments

Comments
 (0)