summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
Commit message (Collapse)AuthorAgeFilesLines
* spi: fix possible deadlock between internal bus locks and bus_lock_flagHeiko Stübner2016-03-181-2/+2
| | | | | | | | | | | | | 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: 49023d2e4ead ("spi: core: Fix deadlock when sending messages") Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
*---. Merge remote-tracking branches 'spi/topic/lp8841', 'spi/topic/msg', ↵Mark Brown2016-03-111-0/+336
|\ \ \ | | | | | | | | | | | | 'spi/topic/pl022' and 'spi/topic/pxa2xx' into spi-next
| | * | spi: Add gfp parameter to kernel-doc to fix build warningJavier Martinez Canillas2016-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: make xmldocs warning caused by spi.cMasanari Iida2016-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: docbook: add missing parameter documentationMartin Sperl2016-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing docbook documentation for the gfp parameter in function spi_replace_transfers. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: core: Use min_t(size_t,..)Fabio Estevam2016-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: core: Use %zu for printing 'size_t' typeFabio Estevam2016-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: core: Staticize __spi_split_transfer_maxsize()Fabio Estevam2016-02-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __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: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: checking for NULL instead of IS_ERRDan Carpenter2016-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | spi_replace_transfers() returns error pointers on error, it never returns NULL. Fixes: d9f121227281 ('spi: core: add spi_split_transfers_maxsize') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: core: add spi_split_transfers_maxsizeMartin Sperl2016-02-091-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: core: add spi_replace_transfers methodMartin Sperl2016-02-091-0/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: core: added spi_resource managementMartin Sperl2016-02-091-0/+91
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | |
| \ \
*-. \ \ Merge remote-tracking branches 'spi/topic/doc', 'spi/topic/dw' and ↵Mark Brown2016-03-111-12/+17
|\ \ \ \ | | |/ / | |/| | | | | | 'spi/topic/flash' into spi-next
| | * | spi: core: Fix deadlock when sending messagesJon Hunter2016-03-091-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 556351f14e74 ("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: 556351f14e74 ("spi: introduce accelerated read support for spi flash devices") Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | |
| \ \ \
*-. \ \ \ Merge remote-tracking branches 'spi/topic/acpi', 'spi/topic/axi-engine', ↵Mark Brown2016-03-111-1/+18
|\ \ \ \ \ | | |/ / / | | | | / | | |_|/ | |/| | 'spi/topic/bcm2835' and 'spi/topic/bcm2835aux' into spi-next
| * | | spi: Let drivers translate ACPI DeviceSelection to suitable Linux chip selectMika Westerberg2016-02-091-1/+18
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | Merge remote-tracking branch 'spi/topic/dma' into spi-nextMark Brown2016-03-111-3/+3
|\ \ \ | |_|/ |/| |
| * | spi: respect the maximum segment size of DMA deviceAndy Shevchenko2016-03-091-3/+3
| |/ | | | | | | | | | | | | | | 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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: Add cond_resched() in main message processing loopMark Brown2016-02-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | 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: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: introduce accelerated read support for spi flash devicesVignesh R2016-02-091-0/+45
|/ | | | | | | | | | | | | | | | | | | | 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: Vignesh R <vigneshr@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'spi-v4.5' of ↵Linus Torvalds2016-01-131-2/+30
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi updates from Mark Brown: "A quiet release for SPI, not even many driver updates: - Add a dummy loopback driver for use in exercising framework features during development. - Move the test utilities to tools/ and add support for transferring data to and from a file instead of stdin and stdout to spidev_test. - Support for Mediatek MT2701 and Renesas AG5 deices" * tag 'spi-v4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (69 commits) spi: loopback: fix typo in MODULE_PARM_DESC spi: sun4i: Prevent chip-select from being activated twice before a transfer spi: loopback-test: spi_check_rx_ranges can get always done spi: loopback-test: rename method spi_test_fill_tx to spi_test_fill_pattern spi: loopback-test: write rx pattern also when running without tx_buf spi: fsl-espi: expose maximum transfer size limit spi: expose master transfer size limitation. spi: zynq: use to_platform_device() spi: cadence: use to_platform_device() spi: mediatek: Add spi support for mt2701 IC spi: mediatek: merge all identical compat to mtk_common_compat spi: mtk: Add bindings for mediatek MT2701 soc platform spi: mediatek: Prevent overflows in FIFO transfers spi: s3c64xx: Remove unused platform_device_id entries spi: use to_spi_device spi: dw: Use SPI_TMOD_TR rather than magic const 0 to set tmode spi: imx: defer spi initialization, if DMA engine is spi: imx: return error from dma channel request spi: imx: enable loopback only for ECSPI controller family spi: imx: fix loopback mode setup after controller reset ...
| *-. Merge remote-tracking branches 'spi/topic/overlay', 'spi/topic/pxa2xx', ↵Mark Brown2016-01-111-0/+29
| |\ \ | | | | | | | | | | | | 'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/spidev' into spi-next
| | * | spi: Mark instantiated device nodes with OF_POPULATEGeert Uytterhoeven2015-12-011-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 4f001fd30145a6a8 ("i2c: Mark instantiated device nodes with OF_POPULATE"). Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | spi: Uninline spi_unregister_device()Geert Uytterhoeven2015-12-011-0/+14
| | |/ | | | | | | | | | | | | | | | | | | | | | Uninline spi_unregister_device() in preparation of adding more code to it. Add kerneldoc documentation while we're at it. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown2016-01-111-2/+1
| |\ \
| | * | spi: use to_spi_deviceGeliang Tang2015-12-231-2/+1
| | |/ | | | | | | | | | | | | | | | | | | Use to_spi_device() instead of open-coding it. Signed-off-by: Geliang Tang <geliangtang@163.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | ACPI / spi: attach GPIO IRQ from ACPI description to SPI deviceChristophe RICARD2016-01-011-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | 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: Mark Brown <broonie@kernel.org> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
* | Merge remote-tracking branch 'spi/fix/core' into spi-linusMark Brown2015-12-161-1/+1
|\ \
| * | spi: fix parent-device reference leakJohan Hovold2015-12-161-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 49dce689ad4e ("spi doesn't need class_device") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
| |
| \
*-. \ Merge remote-tracking branches 'spi/fix/bcm63xx', 'spi/fix/doc', ↵Mark Brown2015-11-301-0/+1
|\ \ \ | | |/ | |/| | | | 'spi/fix/mediatek' and 'spi/fix/pl022' into spi-linus
| | * spi: Add missing kerneldoc description for parameterThierry Reding2015-11-101-0/+1
| |/ | | | | | | | | | | | | | | | | | | Commit ca5d24854210 ("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: Thierry Reding <treding@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | spi: bugfix: spi_message.transfer_length does not get resetMartin Sperl2015-11-271-0/+1
|/ | | | | | | | | | 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: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'spi/topic/omap-100k', ↵Mark Brown2015-11-041-3/+4
|\ \ | | | | | | | | | 'spi/topic/omap-uwire', 'spi/topic/owner', 'spi/topic/pxa' and 'spi/topic/pxa2xx' into spi-next
| | * spi: Add THIS_MODULE to spi_driver in SPI coreAndrew F. Davis2015-10-281-3/+4
| |/ | | | | | | | | | | | | | | | | 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: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge remote-tracking branch 'spi/topic/doc' into spi-nextMark Brown2015-11-041-9/+93
|\ \
| * | spi: fix kernel-doc warnings about missing return desc in spi.cJavier Martinez Canillas2015-10-241-9/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | |
| | \
| *-. \ Merge branches 'topic/core' and 'topic/stats' of ↵Mark Brown2015-10-241-8/+76
| |\ \ \ | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-doc
| | | * | spi: add transfer histogram statistics via sysfsMartin Sperl2015-09-191-0/+61
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | | Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown2015-11-041-8/+15
|\ \ \ \ | | |/ / | |/| |
| * | | spi: core: use gpio_is_valid() helperAndy Shevchenko2015-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Check if GPIO pin is valid by API helper function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: core: propagate return code of __spi_validate_bits_per_word()Andy Shevchenko2015-10-161-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Propagate the actual return code of __spi_validate_bits_per_word() in spi_setup(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | spi: Map SPI OF client IRQ at probe timeJon Hunter2015-10-121-4/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | Merge remote-tracking branch 'spi/fix/core' into spi-linusMark Brown2015-11-041-2/+2
|\ \ \ | |_|/ |/| |
| * | spi: Setup the master controller driver before setting the chipselectFranklin S Cooper Jr2015-10-281-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Franklin S Cooper Jr <fcooper@ti.com> Tested-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge tag 'v4.3-rc1' into spi-fix-docMark Brown2015-09-161-18/+217
|\ \ | |/ | | | | Linux 4.3-rc1
| *---. Merge remote-tracking branches 'spi/topic/s3c64xx', 'spi/topic/sg', ↵Mark Brown2015-08-311-6/+178
| |\ \ \ | | | | | | | | | | | | | | | 'spi/topic/sh-msiof', 'spi/topic/spidev' and 'spi/topic/stats' into spi-next
| | | | * spi: expose spi_master and spi_device statistics via sysfsMartin Sperl2015-07-071-3/+165
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | * spi: Fix per-page mapping of unaligned vmalloc-ed bufferAndrew Gabbasov2015-07-071-3/+13
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | Merge remote-tracking branch 'spi/topic/dma' into spi-nextMark Brown2015-08-311-4/+18
| |\ \
| | * | spi: support spi without dma channel to use can_dma()Leilk Liu2015-07-241-4/+18
| | |/ | | | | | | | | | | | | | | | | | | | | | For spi without dma channel and use can_dma(), it can use master->dev for struct device. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
OpenPOWER on IntegriCloud