From d052f1bc2db749cf7a40e4e99bfcb71d49f10576 Mon Sep 17 00:00:00 2001 From: Michal Koziel Date: Thu, 9 Jun 2016 11:35:09 +0200 Subject: [PATCH] spi: dw-mmio, SPI module clock disabled before accessing registers during remove causing system freeze Calling clk_disable_unprepare before dw_spi_remove_host makes the system freeze on Cyclone V. clk_disable_unprepare disables the clock, but dw_spi_remove_host wants to access the SPI registers, which is not possible with the clock disabled. Note that clk_disable_unprepare disables the clock to the SPI module, while dw_spi_remove_host is only disabled the SPI master output clock. This is valid when CONFIG_HAVE_CLK (and probably when CONFIG_HAVE_CLK_PREPARE )is enabled. --- drivers/spi/spi-dw-mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c index a6d7029a85ac8..581df3ebfc88d 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -120,8 +120,8 @@ static int dw_spi_mmio_remove(struct platform_device *pdev) { struct dw_spi_mmio *dwsmmio = platform_get_drvdata(pdev); - clk_disable_unprepare(dwsmmio->clk); dw_spi_remove_host(&dwsmmio->dws); + clk_disable_unprepare(dwsmmio->clk); return 0; }