summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-stm32.c
AgeCommit message (Collapse)AuthorFilesLines
2017-06-28spi: stm32: fix potential dereference null return valueAmelie Delaunay1-8/+8
This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers returned by dmaengine_prep_slave_sg, which can be null. Detected by CoverityScan, CID#1446587 ("Dereference null return value") Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-28spi: stm32: enhance DMA error managementAmelie Delaunay1-6/+17
This patch reworks DMA error management. In case the DMA callback is called while EOT (End Of Transfer) flag is not set, that means that DMA encountered an error. This error will result in an auto-suspend of SPI flow, which could also result in an overrun. So, in DMA mode, SUSP and OVR flags are a condition to stop the current transfer. Moreover, stm32_spi_can_dma doesn't care about the state of dma channels. During driver probe, master->can_dma is initialised if dma channel request is successful. That's why we must use master->can_dma to know if dma use is possible (dma channel are successfully requested and the transfer size is greater than fifo size). Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-28spi: stm32: add runtime PM supportAmelie Delaunay1-7/+36
This patch reworks suspend and resume callbacks and add runtime_suspend and runtime_resume callbacks. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-28spi: stm32: use normal conditional statements instead of ternary operatorAmelie Delaunay1-14/+30
This patch replace ternary operator use by normal condition statements to ease code reading. It also removes redundant !!. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-28spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindingsAmelie Delaunay1-1/+1
This patch fixes the optional dt property used to set master inter-data idleness. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-28spi: stm32: fix compatible to fit with new bindingsAmelie Delaunay1-1/+1
This patch updates of_device_id compatible string to fit with new bindings. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-23spi: stm32: fix error check on mbr being -veColin Ian King1-2/+2
The error check of mbr < 0 is always false because mbr is a u32. Make mbt an int so that a -ve error return from stm32_spi_prepare_mbr can be detected. Detected by CoverityScan, CID#1446586 ("Unsigned compared against 0") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-21spi: add driver for STM32 SPI controllerAmelie Delaunay1-0/+1266
The STM32 Serial Peripheral Interface (SPI) can be used to communicate with external devices while using the specific synchronous protocol. It supports a half-duplex, full-duplex and simplex synchronous, serial communication with external devices with 4-bit to 16/32-bit per word. It has two 8x/16x 8-bit embedded Rx and TxFIFOs with DMA capability. It can operate in master or slave mode. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>