Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: dw: introduce spi_shutdown_chip()

This helper disables SPI controller and sets clock to 0.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Andy Shevchenko and committed by
Mark Brown
1cc3f141 d53c0ef3

+12 -7
+6 -7
drivers/spi/spi-dw.c
··· 546 546 547 547 if (dws->dma_ops && dws->dma_ops->dma_exit) 548 548 dws->dma_ops->dma_exit(dws); 549 - spi_enable_chip(dws, 0); 550 - /* Disable clk */ 551 - spi_set_clk(dws, 0); 549 + 550 + spi_shutdown_chip(dws); 552 551 } 553 552 EXPORT_SYMBOL_GPL(dw_spi_remove_host); 554 553 555 554 int dw_spi_suspend_host(struct dw_spi *dws) 556 555 { 557 - int ret = 0; 556 + int ret; 558 557 559 558 ret = spi_master_suspend(dws->master); 560 559 if (ret) 561 560 return ret; 562 - spi_enable_chip(dws, 0); 563 - spi_set_clk(dws, 0); 564 - return ret; 561 + 562 + spi_shutdown_chip(dws); 563 + return 0; 565 564 } 566 565 EXPORT_SYMBOL_GPL(dw_spi_suspend_host); 567 566
+6
drivers/spi/spi-dw.h
··· 225 225 spi_enable_chip(dws, 1); 226 226 } 227 227 228 + static inline void spi_shutdown_chip(struct dw_spi *dws) 229 + { 230 + spi_enable_chip(dws, 0); 231 + spi_set_clk(dws, 0); 232 + } 233 + 228 234 /* 229 235 * Each SPI slave device to work with dw_api controller should 230 236 * has such a structure claiming its working mode (poll or PIO/DMA),