- 19 3月, 2021 1 次提交
-
-
由 Alain Volmat 提交于
stm32_spi_remove() accesses the driver's private data after calling spi_unregister_master() even though that function releases the last reference on the spi_master and thereby frees the private data. Fix by switching over to the new devm_spi_alloc_master() helper which keeps the private data accessible until the driver has unbound. Fixes: 8d559a64 ("spi: stm32: drop devres version of spi_register_master") Reported-by: NLukas Wunner <lukas@wunner.de> Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1616052290-10887-1-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 12 3月, 2021 2 次提交
-
-
由 Alain Volmat 提交于
Avoid CONFIG_PM preprocessor check for pm suspend/resume callbacks and identify the functions with __maybe_unused. Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1615545329-5496-1-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Antonio Borneo 提交于
A call to spi_unregister_master() triggers calling remove() for all the spi devices binded to the spi master. Some spi device driver requires to "talk" with the spi device during the remove(), e.g.: - a LCD panel like drivers/gpu/drm/panel/panel-lg-lg4573.c will turn off the backlighting sending a command over spi. This implies that the spi master must be fully functional when spi_unregister_master() is called, either if it is called explicitly in the master's remove() code or implicitly by the devres framework. Devres calls devres_release_all() to release all the resources "after" the remove() of the spi master driver (check code of __device_release_driver() in drivers/base/dd.c). If the spi master driver has an empty remove() then there would be no issue; the devres_release_all() will release everything in reverse order w.r.t. probe(). But if code in spi master driver remove() disables the spi or makes it not functional (like in this spi-stm32), then devres cannot be used safely for unregistering the spi master and the binded spi devices. Replace devm_spi_register_master() with spi_register_master() and add spi_unregister_master() as first action in remove(). Fixes: dcbe0d84 ("spi: add driver for STM32 SPI controller") Signed-off-by: NAntonio Borneo <antonio.borneo@foss.st.com> Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1615545286-5395-1-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 06 2月, 2021 8 次提交
-
-
由 Alain Volmat 提交于
We do not expect to receive spurious interrupts so rise a warning if it happens. RX overrun is an error condition that signals a corrupted RX stream both in dma and in irq modes. Report the error and abort the transfer in either cases. Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-9-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Amelie Delaunay 提交于
Replace SPI_1HZ_NS private constant with NSEC_PER_SEC, which is easier to read and understand. Signed-off-by: NAmelie Delaunay <amelie.delaunay@foss.st.com> Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-8-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Alain Volmat 提交于
Defer the probe operation when a reset controller device is expected but have not yet been probed. This change replaces use of devm_reset_control_get_exclusive() with devm_reset_control_get_optional_exclusive() as reset controller is optional which is now explicitly stated. Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-7-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Etienne Carriere 提交于
Remove reset controller device reference from the device private structure since it is used only at probe time and can be discarded once used to reset the SPI device. Signed-off-by: NEtienne Carriere <etienne.carriere@st.com> Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-6-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Alain Volmat 提交于
Ensure that messages given to transfer_one handler can actually be handled by it. For that purpose rely on the SPI framework spi_split_transfers_maxsize function to split messages whenever necessary. Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-5-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Amelie Delaunay 提交于
To avoid defining shift and mask separately and hand-coding the bit manipulation, use the bitfield macros. Signed-off-by: NAmelie Delaunay <amelie.delaunay@foss.st.com> Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-4-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Alain Volmat 提交于
CS gpios is not mandatory, the driver should allow working even when CS are not given. Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-3-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Alain Volmat 提交于
On 0 byte transfer request, return straight from the xfer function after finalizing the transfer. Fixes: dcbe0d84 ("spi: add driver for STM32 SPI controller") Signed-off-by: NAlain Volmat <alain.volmat@foss.st.com> Link: https://lore.kernel.org/r/1612551572-495-2-git-send-email-alain.volmat@foss.st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 13 1月, 2021 1 次提交
-
-
由 Marek Vasut 提交于
Simplify stm32h7_spi_prepare_fthlv() function implementation, no functional change intended. Signed-off-by: NMarek Vasut <marex@denx.de> Cc: Alain Volmat <alain.volmat@st.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: Amelie Delaunay <amelie.delaunay@st.com> Cc: Antonio Borneo <antonio.borneo@st.com> Cc: Mark Brown <broonie@kernel.org> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Roman Guskov <rguskov@dh-electronics.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com To: linux-spi@vger.kernel.org Link: https://lore.kernel.org/r/20210104123114.261596-1-marex@denx.deSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 05 1月, 2021 1 次提交
-
-
由 Alexandru Ardelean 提交于
With the introduction of the 'include/uapi/linux/spi/spi.h' header, the type of the macros are enforced to 'unsigned long int' via the _BITUL() macro. This causes some -Wformat warnings in the spi-stm32 driver. This patch adds a double-negation operator to the bit-masks. Essentially, the important values for debugging are 0 or 1, while masking them directly would show 0 or BIT(x) values. This way, the type of the arguments are automatically re-cast. Fixes: f7005142 ("spi: uapi: unify SPI modes into a single spi.h header") Reported-by: Nkernel test robot <lkp@intel.com> Reported-by: NStephen Rothwell <sfr@canb.auug.org.au> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: NAlexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: NAndy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210104143103.56510-1-alexandru.ardelean@analog.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 22 12月, 2020 1 次提交
-
-
由 Roman Guskov 提交于
if cur_bpw <= 8 and xfer_len < 4 then the value of fthlv will be 1 and SPI registers content may have been lost. * If SPI data register is accessed as a 16-bit register and DSIZE <= 8bit, better to select FTHLV = 2, 4, 6 etc * If SPI data register is accessed as a 32-bit register and DSIZE > 8bit, better to select FTHLV = 2, 4, 6 etc, while if DSIZE <= 8bit, better to select FTHLV = 4, 8, 12 etc Signed-off-by: NRoman Guskov <rguskov@dh-electronics.com> Fixes: dcbe0d84 ("spi: add driver for STM32 SPI controller") Reviewed-by: NMarek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20201221123532.27272-1-rguskov@dh-electronics.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 06 11月, 2020 1 次提交
-
-
由 Zhang Qilong 提交于
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in stm32_spi_resume, so we should fix it. Fixes: db96bf97 ("spi: stm32: fixes suspend/resume management") Signed-off-by: NZhang Qilong <zhangqilong3@huawei.com> Reviewed-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/20201106015217.140476-1-zhangqilong3@huawei.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 02 10月, 2020 1 次提交
-
-
由 Barry Song 提交于
Running in hardIRQ, disabling IRQ is redundant. Signed-off-by: NBarry Song <song.bao.hua@hisilicon.com> Link: https://lore.kernel.org/r/20200926001616.21292-2-song.bao.hua@hisilicon.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 09 9月, 2020 2 次提交
-
-
由 Dan Carpenter 提交于
The pm_runtime_get_sync() can return either 0 or 1 on success but this code treats 1 as a failure. Fixes: db96bf97 ("spi: stm32: fixes suspend/resume management") Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Reviewed-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/20200909094304.GA420136@mwandaSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Krzysztof Kozlowski 提交于
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: NKrzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20200901152713.18629-8-krzk@kernel.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 07 9月, 2020 1 次提交
-
-
由 Marek Vasut 提交于
The 'spi_stm32 44004000.spi: Communication suspended' message means that when using PIO, the kernel did not read the FIFO fast enough and so the SPI controller paused the transfer. Currently, this is printed on every single such event, so if the kernel is busy and the controller is pausing the transfers often, the kernel will be all the more busy scrolling this message into the log buffer every few milliseconds. That is not helpful. Instead, rate-limit the message and print it every once in a while. It is not possible to use the default dev_warn_ratelimited(), because that is still too verbose, as it prints 10 lines (DEFAULT_RATELIMIT_BURST) every 5 seconds (DEFAULT_RATELIMIT_INTERVAL). The policy here is to print 1 line every 50 seconds (DEFAULT_RATELIMIT_INTERVAL * 10), because 1 line is more than enough and the cycles saved on printing are better left to the CPU to handle the SPI. However, dev_warn_once() is also not useful, as the user should be aware that this condition is possibly recurring or ongoing. Thus the custom rate-limit policy. Finally, turn the message from dev_warn() to dev_dbg(), since the system does not suffer any sort of malfunction if this message appears, it is just slowing down. This further reduces the printing into the log buffer and frees the CPU to do useful work. Fixes: dcbe0d84 ("spi: add driver for STM32 SPI controller") Signed-off-by: NMarek Vasut <marex@denx.de> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: Amelie Delaunay <amelie.delaunay@st.com> Cc: Antonio Borneo <borneo.antonio@gmail.com> Cc: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20200905151913.117775-1-marex@denx.deSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 11 8月, 2020 5 次提交
-
-
由 Alain Volmat 提交于
SPI registers content may have been lost upon suspend/resume sequence. So, always compute and apply the necessary configuration in stm32_spi_transfer_one_setup routine. Signed-off-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/1597043558-29668-6-git-send-email-alain.volmat@st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Amelie Delaunay 提交于
This patch adds pinctrl power management, and reconfigure spi controller in case of resume. Fixes: 038ac869 ("spi: stm32: add runtime PM support") Signed-off-by: NAmelie Delaunay <amelie.delaunay@st.com> Signed-off-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/1597043558-29668-5-git-send-email-alain.volmat@st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Amelie Delaunay 提交于
Fix spi->clk_rate when it is odd to the nearest lowest even value because minimum SPI divider is 2. Signed-off-by: NAmelie Delaunay <amelie.delaunay@st.com> Signed-off-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/1597043558-29668-4-git-send-email-alain.volmat@st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Amelie Delaunay 提交于
When transfer is shorter than half of the fifo, set the data packet size up to transfer size instead of up to half of the fifo. Check also that threshold is set at least to 1 data frame. Signed-off-by: NAmelie Delaunay <amelie.delaunay@st.com> Signed-off-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/1597043558-29668-3-git-send-email-alain.volmat@st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
由 Antonio Borneo 提交于
The caller of stm32_spi_transfer_one(), spi_transfer_one_message(), is waiting for us to call spi_finalize_current_transfer() and will eventually schedule a new transfer, if available. We should guarantee that the spi controller is really available before calling spi_finalize_current_transfer(). Move the call to spi_finalize_current_transfer() _after_ the call to stm32_spi_disable(). Signed-off-by: NAntonio Borneo <antonio.borneo@st.com> Signed-off-by: NAlain Volmat <alain.volmat@st.com> Link: https://lore.kernel.org/r/1597043558-29668-2-git-send-email-alain.volmat@st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 05 8月, 2020 1 次提交
-
-
由 Tobias Schramm 提交于
Previously the stm32h7 interrupt thread cleared all non-masked interrupts. If an interrupt was to occur during the handling of another interrupt its flag would be unset, resulting in a lost interrupt. This patches fixes the issue by clearing only the currently set interrupt flags. Signed-off-by: NTobias Schramm <t.schramm@manjaro.org> Link: https://lore.kernel.org/r/20200804195136.1485392-1-t.schramm@manjaro.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 25 5月, 2020 1 次提交
-
-
由 dillon min 提交于
in l3gd20 driver startup, there is a setup failed error return from stm32 spi driver " [ 2.687630] st-gyro-spi spi0.0: supply vdd not found, using dummy regulator [ 2.696869] st-gyro-spi spi0.0: supply vddio not found, using dummy regulator [ 2.706707] spi_stm32 40015000.spi: SPI transfer setup failed [ 2.713741] st-gyro-spi spi0.0: SPI transfer failed: -22 [ 2.721096] spi_master spi0: failed to transfer one message from queue [ 2.729268] iio iio:device0: failed to read Who-Am-I register. [ 2.737504] st-gyro-spi: probe of spi0.0 failed with error -22 " after debug into spi-stm32 driver, st-gyro-spi split two steps to read l3gd20 id first: send command to l3gd20 with read id command in tx_buf, rx_buf is null. second: read id with tx_buf is null, rx_buf not null. so, for second step, stm32 driver recongise this process as 'SPI_SIMPLE_RX' from stm32_spi_communication_type(), but there is no related process for this type in stm32f4_spi_set_mode(), then we get error from stm32_spi_transfer_one_setup(). we can use two method to fix this bug. 1, use stm32 spi's "In unidirectional receive-only mode (BIDIMODE=0 and RXONLY=1)". but as our code running in sdram, the read latency is too large to get so many receive overrun error in interrupts handler. 2, use stm32 spi's "In full-duplex (BIDIMODE=0 and RXONLY=0)", as tx_buf is null, so add flag 'SPI_MASTER_MUST_TX' to spi master. Change since V4: 1 remove dummy data sent out by stm32 spi driver 2 add flag 'SPI_MASTER_MUST_TX' to spi master Signed-off-by: Ndillon min <dillon.minfei@gmail.com> Link: https://lore.kernel.org/r/1590378348-8115-8-git-send-email-dillon.minfei@gmail.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 21 3月, 2020 1 次提交
-
-
由 Alain Volmat 提交于
Fix all functions and structure descriptions to have the driver warning free when built with W=1. Signed-off-by: NAlain Volmat <alain.volmat@st.com> Reviewed-by: NAmelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/1584711857-9162-1-git-send-email-alain.volmat@st.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 16 12月, 2019 1 次提交
-
-
由 Peter Ujfalusi 提交于
dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code. By using dma_request_chan() directly the driver can support deferred probing against DMA. Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20191212135550.4634-10-peter.ujfalusi@ti.comSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 10 12月, 2019 1 次提交
-
-
由 Linus Walleij 提交于
This switches the STM32 SPI driver over to using GPIO descriptors for chip select. Instead of the callbacks for picking the GPIO lines using the legacy API we just let the core handle it all using descriptors. Cc: Fabien Dessenne <fabien.dessenne@st.com> Cc: Amelie Delaunay <amelie.delaunay@st.com> Cc: Cezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20191205083401.27077-1-linus.walleij@linaro.orgSigned-off-by: NMark Brown <broonie@kernel.org>
-
- 02 5月, 2019 1 次提交
-
-
由 Fabien Dessenne 提交于
During probe, return the "get_irq" error value instead of -ENOENT. This allows the driver to be defer probed if needed. Signed-off-by: NFabien Dessenne <fabien.dessenne@st.com> Acked-by: NAmelie Delaunay <amelie.delaunay@st.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 08 1月, 2019 10 次提交
-
-
由 Cezary Gapinski 提交于
Add routines, registers & bitfield definition. Also baud rate divisor definitions for STM32F4 SPI. This version supports full-duplex, simplex TX and half-duplex TX communication with 8 or 16-bit per word. DMA capability is optionally supported for transfer longer than 16 bytes. For transfer less than 16 bytes frames can be send in discontinuous mode. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Prepare support for STM32F4 spi variant by introducing compatible configuration data. Move STM32H7 specific stuff to compatible data structure: - registers & bit fields - routines to control driver - baud rate divisor definitions - fifo availability - split IRQ functions to parts to be called when the IRQ occurs and for threaded interrupt what helps to provide less discontinuous mode for drivers without FIFO. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Add transfer_one_dma_start function to be more generic for other stm32 SPI family drivers. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Split stm32_spi_transfer_one_setup function into smaller chunks to be more generic for other stm32 SPI family drivers. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Interrupt function is used as a thread so rename it to express meaning directly by more clear function name. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Rename STM32 SPI registers to be related to STM32H7 SPI driver and not STM32 generally. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
This driver does not support SPI LOOP mode by configuration in registers. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Driver supports SPI mode 0 to 3 not only the mode 3. Use SPI_CPOL and SPI_CPHA indicates that these bits can be changed to obtain modes 0 - 3. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
When SPI driver is configured to work only with TX or RX DMA channel then dmaengine functions can dereferene NULL pointer. Running full-duplex mode when when only RX or TX DMA channel is available can cause overrun condition or incorrect writing to transmit buffer so disable this types of DMA configuration and go back to interrupt mode. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Cezary Gapinski 提交于
Patch fixes sparse warning: Using plain integer as NULL pointer. Replaces second argument of function devm_clk_get from 0 to NULL. Signed-off-by: NCezary Gapinski <cezary.gapinski@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-