Skip to content

Commit f8900df

Browse files
bastien-curutchetgregkh
authored andcommitted
spi: davinci: Unset POWERDOWN bit when releasing resources
[ Upstream commit 1762dc0 ] On the OMAPL138, the SPI reference clock is provided by the Power and Sleep Controller (PSC). The PSC's datasheet says that 'some peripherals have special programming requirements and additional recommended steps you must take before you can invoke the PSC module state transition'. I didn't find more details in documentation but it appears that PSC needs the SPI to clear the POWERDOWN bit before disabling the clock. Indeed, when this bit is set, the PSC gets stuck in transitions from enable to disable state. Clear the POWERDOWN bit when releasing driver's resources Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com> Link: https://patch.msgid.link/20240624071745.17409-1-bastien.curutchet@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d3d7848 commit f8900df

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/spi/spi-davinci.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,9 @@ static int davinci_spi_probe(struct platform_device *pdev)
984984
return ret;
985985

986986
free_dma:
987+
/* This bit needs to be cleared to disable dpsi->clk */
988+
clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
989+
987990
if (dspi->dma_rx) {
988991
dma_release_channel(dspi->dma_rx);
989992
dma_release_channel(dspi->dma_tx);
@@ -1013,6 +1016,9 @@ static void davinci_spi_remove(struct platform_device *pdev)
10131016

10141017
spi_bitbang_stop(&dspi->bitbang);
10151018

1019+
/* This bit needs to be cleared to disable dpsi->clk */
1020+
clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
1021+
10161022
if (dspi->dma_rx) {
10171023
dma_release_channel(dspi->dma_rx);
10181024
dma_release_channel(dspi->dma_tx);

0 commit comments

Comments
 (0)