- 18 3月, 2016 1 次提交
-
-
由 Heiko Stübner 提交于
External users may use spi_bus_lock to get exclusive access. This will also grab the bus_lock_mutex and may therefore result in a deadlock if __spi_pump_messages also tries to get the mutex. Therefore adapt spi_pump_messages as well as spi_sync to preset the bus_locked parameter according to the master->bus_lock_flag. Fixes: 49023d2e ("spi: core: Fix deadlock when sending messages") Signed-off-by: NHeiko Stuebner <heiko@sntech.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 11 3月, 2016 1 次提交
-
-
由 Javier Martinez Canillas 提交于
The spi_split_transfers_maxsize() gfp parameter is missing in the function kernel-doc so building gives the following warning: .//drivers/spi/spi.c:2359: warning: No description found for parameter 'gfp' Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 09 3月, 2016 2 次提交
-
-
由 Andy Shevchenko 提交于
The device which is actually does DMA may have a limitation of the maximum segment size. Respect this setting when preparing scatter-gather list. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Jon Hunter 提交于
The function __spi_pump_messages() is called by spi_pump_messages() and __spi_sync(). The function __spi_sync() has an argument 'bus_locked' that indicates if it is called with the SPI bus mutex held or not. If 'bus_locked' is false then __spi_sync() will acquire the mutex itself. Commit 556351f1 ("spi: introduce accelerated read support for spi flash devices") made a change to acquire the SPI bus mutex within __spi_pump_messages(). However, this change did not check to see if the mutex is already held. If __spi_sync() is called with the mutex held (ie. 'bus_locked' is true), then a deadlock occurs when __spi_pump_messages() is called. Fix this deadlock by passing the 'bus_locked' state from __spi_sync() to __spi_pump_messages() and only acquire the mutex if not already held. In the case where __spi_pump_messages() is called from spi_pump_messages() it is assumed that the mutex is not held and so call __spi_pump_messages() with 'bus_locked' set to false. Finally, move the unlocking of the mutex to the end of the __spi_pump_messages() function to simplify the code and only call cond_resched() if there are no errors. Fixes: 556351f1 ("spi: introduce accelerated read support for spi flash devices") Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 22 2月, 2016 1 次提交
-
-
由 Masanari Iida 提交于
This patch fix following warnings while make xmldocs. .//drivers/spi/spi.c:2354: warning: Excess function parameter 'message' description in 'spi_split_transfers_maxsize' .//drivers/spi/spi.c:2354: warning: Excess function parameter 'max_size' description in 'spi_split_transfers_maxsize' Signed-off-by: NMasanari Iida <standby24x7@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 19 2月, 2016 2 次提交
-
-
由 Mark Brown 提交于
When a controller has only PIO support it is very likely that we will run into use cases where we spend a very large amount of time consuming CPU. Code that does this should call cond_resched() every once in a while to give other tasks more of a chance to run so do that in the main SPI loop, the overhead is negligable if it's not needed. Suggested-by: NArnd Bergmann <arnd@arndb.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Martin Sperl 提交于
Add missing docbook documentation for the gfp parameter in function spi_replace_transfers. Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 18 2月, 2016 2 次提交
-
-
由 Fabio Estevam 提交于
Use min_t(size_t,..) in order to avoid the following build warning on ARM64: include/linux/kernel.h:754:17: warning: comparison of distinct pointer types lacks a cast (void) (&_min1 == &_min2); \ ^ drivers/spi/spi.c:2304:17: note: in expansion of macro 'min' xfers[0].len = min(maxsize, xfer[0].len); Suggested-by: NGeert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: NFabio Estevam <fabio.estevam@nxp.com> Acked-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Fabio Estevam 提交于
Use %zu for printing 'size_t' type in order to fix the following build warning on ARM64: drivers/spi/spi.c: In function '__spi_split_transfer_maxsize': drivers/spi/spi.c:2278:2: warning: format '%i' expects argument of type 'int', but argument 4 has type 'size_t' [-Wformat=] Signed-off-by: NFabio Estevam <fabio.estevam@nxp.com> Acked-by: NGeert Uytterhoeven <geert+renesas@glider.be> Acked-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 16 2月, 2016 1 次提交
-
-
由 Fabio Estevam 提交于
__spi_split_transfer_maxsize() can be made static as it is only used in this file. This fixes the following sparse warning: drivers/spi/spi.c:2266:5: warning: symbol '__spi_split_transfer_maxsize' was not declared. Should it be static? Signed-off-by: NFabio Estevam <fabio.estevam@nxp.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 13 2月, 2016 1 次提交
-
-
由 Dan Carpenter 提交于
spi_replace_transfers() returns error pointers on error, it never returns NULL. Fixes: d9f12122 ('spi: core: add spi_split_transfers_maxsize') Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 10 2月, 2016 5 次提交
-
-
由 Vignesh R 提交于
In addition to providing direct access to SPI bus, some spi controller hardwares (like ti-qspi) provide special port (like memory mapped port) that are optimized to improve SPI flash read performance. This means the controller can automatically send the SPI signals required to read data from the SPI flash device. For this, SPI controller needs to know flash specific information like read command to use, dummy bytes and address width. Introduce spi_flash_read() interface to support accelerated read over SPI flash devices. SPI master drivers can implement this callback to support interfaces such as memory mapped read etc. m25p80 flash driver and other flash drivers can call this make use of such interfaces. The interface should only be used with SPI flashes and cannot be used with other SPI devices. Signed-off-by: NVignesh R <vigneshr@ti.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Martin Sperl 提交于
Add spi_split_transfers_maxsize method that splits spi_transfers transparently into multiple transfers that are below the given max-size. This makes use of the spi_res framework via spi_replace_transfers to allocate/free the extra transfers as well as reverting back the changes applied while processing the spi_message. Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Martin Sperl 提交于
Add the spi_replace_transfers method that can get used to replace some spi_transfers from a spi_message with other transfers. Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Martin Sperl 提交于
SPI resource management framework used while processing a spi_message via the spi-core. The basic idea is taken from devres, but as the allocation may happen fairly frequently, some provisioning (in the form of an unused spi_device pointer argument to spi_res_alloc) has been made so that at a later stage we may implement reuse objects allocated earlier avoiding the repeated allocation by keeping a cache of objects that we can reuse. This framework can get used for: * rewriting spi_messages * to fullfill alignment requirements of the spi_master HW * to fullfill transfer length requirements (e.g: transfers need to be less than 64k) * consolidate spi_messages with multiple transfers into a single transfer when the total transfer length is below a threshold. * reimplement spi_unmap_buf without explicitly needing to check if it has been mapped Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Mika Westerberg 提交于
In Windows it is up to the SPI host controller driver to handle the ACPI DeviceSelection as it likes. The SPI core does not take any part in it. This is different in Linux because we always expect to have chip select in range of 0 .. master->num_chipselect - 1. In order to support this in Linux we need a way to allow the driver to translate between ACPI DeviceSelection field and Linux chip select number so provide a new optional hook ->fw_translate_cs() that can be used by a driver to handle translation and call this hook if set during SPI slave ACPI enumeration. Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: NJarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 01 1月, 2016 1 次提交
-
-
由 Christophe RICARD 提交于
spi->irq was ignoring GpioInt property setting it to -1. acpi_dev_gpio_irq_get returns and configure the slave IRQ according to the ACPI slave node description. It is now inline with devicetree behavior. Acked-by: NMark Brown <broonie@kernel.org> Signed-off-by: NChristophe Ricard <christophe-h.ricard@st.com> Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
-
- 23 12月, 2015 1 次提交
-
-
由 Geliang Tang 提交于
Use to_spi_device() instead of open-coding it. Signed-off-by: NGeliang Tang <geliangtang@163.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 16 12月, 2015 1 次提交
-
-
由 Johan Hovold 提交于
Fix parent-device reference leak due to SPI-core taking an unnecessary reference to the parent when allocating the master structure, a reference that was never released. Note that driver core takes its own reference to the parent when the master device is registered. Fixes: 49dce689 ("spi doesn't need class_device") Signed-off-by: NJohan Hovold <johan@kernel.org> Signed-off-by: NMark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-
- 02 12月, 2015 2 次提交
-
-
由 Geert Uytterhoeven 提交于
Mark (and unmark) device nodes with the POPULATE flag as appropriate. This is required to avoid multi probing when enabling and populating SPI buses in DT overlays. Based on commit 4f001fd3 ("i2c: Mark instantiated device nodes with OF_POPULATE"). Suggested-by: NMark Brown <broonie@kernel.org> Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Geert Uytterhoeven 提交于
Uninline spi_unregister_device() in preparation of adding more code to it. Add kerneldoc documentation while we're at it. Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 27 11月, 2015 1 次提交
-
-
由 Martin Sperl 提交于
When submitting an identical spi_message multiple times via spi_sync the spi_message.frame_length does not get reset to 0 in __spi_validate before adding up all spi_transfer.len resulting in frame_length > actual_length on all but the first spi_sync call. Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 11 11月, 2015 1 次提交
-
-
由 Thierry Reding 提交于
Commit ca5d2485 ("spi: Add THIS_MODULE to spi_driver in SPI core") adds the new __spi_register_driver() function, but keeps the kerneldoc for the spi_register_driver() function in place and forgets to add the description for the new owner parameter. Signed-off-by: NThierry Reding <treding@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 28 10月, 2015 2 次提交
-
-
由 Andrew F. Davis 提交于
Add spi_register_driver helper macro that adds THIS_MODULE to spi_driver for the registering driver. We rename and modify the existing spi_register_driver to enable this. Signed-off-by: NAndrew F. Davis <afd@ti.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Franklin S Cooper Jr 提交于
SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select. This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion. Signed-off-by: NFranklin S Cooper Jr <fcooper@ti.com> Tested-by: NGrygorii Strashko <grygorii.strashko@ti.com> Tested-by: NIvan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 24 10月, 2015 1 次提交
-
-
由 Javier Martinez Canillas 提交于
When building docs with make htmldocs, warnings about not having a description for the return value are reported, i.e: warning: No description found for return value of 'spi_register_driver' Fix these by following the kernel-doc conventions explained in Documentation/kernel-doc-nano-HOWTO.txt. Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 21 10月, 2015 1 次提交
-
-
由 Andy Shevchenko 提交于
Check if GPIO pin is valid by API helper function. Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 16 10月, 2015 1 次提交
-
-
由 Andy Shevchenko 提交于
Propagate the actual return code of __spi_validate_bits_per_word() in spi_setup(). Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 13 10月, 2015 1 次提交
-
-
由 Jon Hunter 提交于
Currently the IRQs for SPI client devices, registered via device-tree, are mapped when the client devices are registered. If the corresponding irq-chip has not been probed yet, then the probing of the client device will fail and will not be retried. Resolve this by mapping the IRQ at probe time and allow the probe to be deferred if the IRQ is not yet available. If of_irq_get() returns an error that is not -EPROBE_DEFER, then assume that the SPI client does not have an IRQ and set the IRQ number to zero (which is equivalent to irq_of_parse_and_map()). This is based on some inputs from Thierry Reding <treding@nvidia.com>. Cc: Thierry Reding <treding@nvidia.com> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 20 9月, 2015 1 次提交
-
-
由 Martin Sperl 提交于
report transfer sizes as a histogram via the following files: /sys/class/spi_master/spi*/statistics/transfer_bytes_histo_* /sys/class/spi_master/spi*/spi*.*/statistics/transfer_bytes_histo_* Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 06 9月, 2015 1 次提交
-
-
由 Guenter Roeck 提交于
Actually, spi_master_put() after spi_alloc_master() must _not_ be followed by kfree(). The memory is already freed with the call to spi_master_put() through spi_master_class, which registers a release function. Calling both spi_master_put() and kfree() results in often nasty (and delayed) crashes elsewhere in the kernel, often in the networking stack. This reverts commit eb4af0f5. Link to patch and concerns: https://lkml.org/lkml/2012/9/3/269 or http://lkml.iu.edu/hypermail/linux/kernel/1209.0/00790.html Alexey Klimov: This revert becomes valid after 94c69f76 when spi-imx.c has been fixed and there is no need to call kfree() so comment for spi_alloc_master() should be fixed. Signed-off-by: NGuenter Roeck <linux@roeck-us.net> Signed-off-by: NAlexey Klimov <alexey.klimov@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-
- 27 8月, 2015 1 次提交
-
-
由 Stefan Brüns 提交于
This allows drivers for devices connected via SPI to check if the controller supports a given bits_per_word value during setup. Currently any BPW value is accepted durings setup, and transfers are rejected later. Signed-off-by: NStefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 22 8月, 2015 1 次提交
-
-
由 Mark Brown 提交于
If a slave appears with no maximum transfer speed specified fall back to using the maximum for the master instead. It's questionable if we should let slaves do this but let's be defensive. Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 25 7月, 2015 1 次提交
-
-
由 Leilk Liu 提交于
For spi without dma channel and use can_dma(), it can use master->dev for struct device. Signed-off-by: NLeilk Liu <leilk.liu@mediatek.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 07 7月, 2015 2 次提交
-
-
由 Martin Sperl 提交于
per spi-master statistics accessible as: /sys/class/spi_master/spi*/statistics/* per spi-device statistics accessible via: /sys/class/spi_master/spi*/spi*.*/statistics/* The following statistics are exposed as separate "files" inside these directories: * messages number of spi_messages * transfers number of spi_transfers * bytes number of bytes transferred * bytes_rx number of bytes transmitted * bytes_tx number of bytes received * errors number of errors encounterd * timedout number of messages that have timed out * spi_async number of spi_messages submitted using spi_async * spi_sync number of spi_messages submitted using spi_sync * spi_sync_immediate number of spi_messages submitted using spi_sync, that are handled immediately without a context switch to the spi_pump worker-thread Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Andrew Gabbasov 提交于
spi_map_buf() processes mapping of vmalloc-ed buffers in a special way, making mapping of every page separately. However, if the buffer is not aligned to page boundary (e.g. sub-array in a vmalloc-ed array), it fills the scatter table with page-size unaligned pieces, that cross page boundaries. This is incorrect and can, for example, cause memory corruption and various crashes when working with ubifs on spi-nor chips (though those drivers are themselves buggy in that they should be providing DMAable memory to the SPI framework). Fix this by using proper scatter table size and intra-page buffer lengths, so that the whole buffer splits into separate scatter table entries on page boundaries. Signed-off-by: NAndrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 03 6月, 2015 1 次提交
-
-
由 Martin Sperl 提交于
The case where spi_master sets the flags SPI_MASTER_MUST_RX/TX while CONFIG_HAS_DMA is unset (which is unlikley) together with a driver that reuses spi_messages with rx/tx_buff set to NULL, can result in: * data disclosure over the SPI (for tx_buf == NULL) * memory corruption (for rx_buf == NULL) This happenes when dummy_rx/dummy_tx are changing address due to krealloc or free and an allocation of the memory by a different part of the kernel. Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 12 5月, 2015 1 次提交
-
-
由 Martin Sperl 提交于
Fix a race (with some kernel configurations) where a queued master->pump_messages runs and frees dummy_tx/rx before spi_unmap_msg is running (or is finished). This results in the following messages: BUG: Bad page state in process page:db7ba030 count:0 mapcount:0 mapping: (null) index:0x0 flags: 0x200(arch_1) page dumped because: PAGE_FLAGS_CHECK_AT_PREP flag set ... Reported-by: NNoralf Trønnes <noralf@tronnes.org> Suggested-by: NNoralf Trønnes <noralf@tronnes.org> Tested-by: NNoralf Trønnes <noralf@tronnes.org> Signed-off-by: NMartin Sperl <kernel@martin.sperl.org> Signed-off-by: NMark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-
- 17 4月, 2015 1 次提交
-
-
由 Robin Gong 提交于
Some spi device drivers use the same tx_buf and rx_buf repeatly for better performance such as driver/input/touchsreen/ads7846.c, but spi core grab tx_buf /rx_buf of transfer and set them as dummy_tx/dummy_rx once they are NULL. Thus, in the second time the tx_buf/rx_buf will be replaced by dummy_tx/dummy_rx and the data which produced by the last tx or rx may be wrongly sent to the device or handled by the upper level protocol. This patch just keep the orignal value of tx_buf/rx_buf if they are NULL after this transfer processed. Signed-off-by: NRobin Gong <b38343@freescale.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 08 4月, 2015 1 次提交
-
-
由 Geert Uytterhoeven 提交于
If a driver doesn't implement the master->handle_err() callback and an SPI transfer fails, the kernel will crash with a NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0003000 [00000000] *pgd=80000040004003, *pmd=00000000 Internal error: Oops: 80000206 [#1] SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc7-koelsch-05861-g1fc9fdd4add4f783 #1046 Hardware name: Generic R8A7791 (Flattened Device Tree) task: eec359c0 ti: eec54000 task.ti: eec54000 PC is at 0x0 LR is at spi_transfer_one_message+0x1cc/0x1f0 Make the master->handle_err() callback optional to avoid the crash. Also fix a spelling mistake in the callback documentation while we're at it. Fixes: b716c4ff ("spi: introduce master->handle_err() callback") Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: NMark Brown <broonie@kernel.org>
-