From 996dc617921ee253a847d1f7706ba78c07a7b5fa Mon Sep 17 00:00:00 2001 From: Michal Koziel Date: Tue, 28 Jun 2016 16:30:20 +0200 Subject: [PATCH] spi: dw-mmio, SPI module clock disabled before accessing registers 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 447497e9124c9..d25cc4037e239 100644 --- a/drivers/spi/spi-dw-mmio.c +++ b/drivers/spi/spi-dw-mmio.c @@ -115,8 +115,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; }