1
0
Fork 0
Commit Graph

3071 Commits (38ce2c6f3ae8dda0ee42dc8474759ff949994bea)

Author SHA1 Message Date
Mark Brown 4dd638f8ac Merge remote-tracking branches 'spi/fix/atmel', 'spi/fix/bcm2835aux', 'spi/fix/fsl-espi', 'spi/fix/imx', 'spi/fix/loopback' and 'spi/fix/omap2-mcspi' into spi-linus 2016-02-12 23:04:41 +00:00
Tony Lindgren 0e6f357a5d spi: omap2-mcspi: Fix PM regression with deferred probe for pm_runtime_reinit
Commit 5de85b9d57 ("PM / runtime: Re-init runtime PM states at probe
error and driver unbind") introduced pm_runtime_reinit() that is used
to reinitialize PM runtime after -EPROBE_DEFER. This allows shutting
down the device after a failed probe.

However, for drivers using pm_runtime_use_autosuspend() this can cause
a state where suspend callback is never called after -EPROBE_DEFER.
On the following device driver probe, hardware state is different from
the PM runtime state causing omap_device to produce the following
error:

omap_device_enable() called from invalid state 1

And with omap_device and omap hardware being picky for PM, this will
block any deeper idle states in hardware.

The solution is to fix the drivers to follow the PM runtime documentation:

1. For sections of code that needs the device disabled, use
   pm_runtime_put_sync_suspend() if pm_runtime_set_autosuspend() has
   been set.

2. For driver exit code, use pm_runtime_dont_use_autosuspend() before
   pm_runtime_put_sync() if pm_runtime_use_autosuspend() has been
   set.

Fixes: 5de85b9d57 ("PM / runtime: Re-init runtime PM states at probe
error and driver unbind")
Cc: linux-spi@vger.kernel.org
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: Rafael J. Wysocki <rafael@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-12 22:33:09 +00:00
Stephan Olbrich fe0e2304f5 spi: bcm2835aux: fix bitmask defines
The bitmasks for txempty and idle interrupts were interchanged.

Signed-off-by: Stephan Olbrich <stephanolbrich@gmx.de>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-10 08:02:27 +00:00
Cyrille Pitchen 70f340df24 spi: atmel: fix gpio chip-select in case of non-DT platform
The non-DT platform that uses this driver (actually the AVR32) was taking a bad
branch for determining if the IP would use gpio for CS.
Adding the presence of DT as a condition fixes this issue.

Fixes: 4820303480 ("spi: atmel: add support for the internal chip-select of the spi controller")
Reported-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
[nicolas.ferre@atmel.com: extract from ml discussion]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Mans Rullgard <mans@mansr.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2016-01-28 23:25:54 +01:00
Hou Zhiqiang 5cfa1e4e0d spi/fsl-espi: Correct the maximum transaction length
The maximum length during one transcation is 64KiB.

Signed-off-by: Hou Zhiqiang <B48286@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-22 17:03:26 +00:00
Gao Pan f8efca2f17 spi: imx: fix spi resource leak with dma transfer
In spi_imx_dma_transfer(), when desc_rx = dmaengine_prep_slave_sg()
fails, the context goes to label no_dma and then return. However,
the memory allocated for desc_tx has not been freed yet, which leads
to resource leak.

Signed-off-by: Gao Pan <pandy.gao@nxp.com>
Reviewed-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-22 16:46:58 +00:00
Linus Torvalds f689b742f2 powerpc updates for 4.5
- Ground work for the new Power9 MMU from Aneesh Kumar K.V
  - Optimise FP/VMX/VSX context switching from Anton Blanchard
 
  - Various cleanups from Krzysztof Kozlowski, John Ogness, Rashmica Gupta,
    Russell Currey, Gavin Shan, Daniel Axtens, Michael Neuling, Andrew Donnellan
  - Allow wrapper to work on non-english system from Laurent Vivier
  - Add rN aliases to the pt_regs_offset table from Rashmica Gupta
  - Fix module autoload for rackmeter & axonram drivers from Luis de Bethencourt
  - Include KVM guest test in all interrupt vectors from Paul Mackerras
  - Fix DSCR inheritance over fork() from Anton Blanchard
  - Make value-returning atomics & {cmp}xchg* & their atomic_ versions fully ordered from Boqun Feng
  - Print MSR TM bits in oops messages from Michael Neuling
  - Add TM signal return & invalid stack selftests from Michael Neuling
  - Limit EPOW reset event warnings from Vipin K Parashar
  - Remove the Cell QPACE code from Rashmica Gupta
  - Append linux_banner to exception information in xmon from Rashmica Gupta
  - Add selftest to check if VSRs are corrupted from Rashmica Gupta
  - Remove broken GregorianDay() from Daniel Axtens
  - Import Anton's context_switch2 benchmark into selftests from Michael Ellerman
  - Add selftest script to test HMI functionality from Daniel Axtens
  - Remove obsolete OPAL v2 support from Stewart Smith
  - Make enter_rtas() private from Michael Ellerman
  - PPR exception cleanups from Michael Ellerman
  - Add page soft dirty tracking from Laurent Dufour
  - Add support for Nvlink NPUs from Alistair Popple
  - Add support for kexec on 476fpe from Alistair Popple
  - Enable kernel CPU dlpar from sysfs from Nathan Fontenot
  - Copy only required pieces of the mm_context_t to the paca from Michael Neuling
  - Add a kmsg_dumper that flushes OPAL console output on panic from Russell Currey
  - Implement save_stack_trace_regs() to enable kprobe stack tracing from Steven Rostedt
  - Add HWCAP bits for Power9 from Michael Ellerman
  - Fix _PAGE_PTE breaking swapoff from Aneesh Kumar K.V
  - Fix _PAGE_SWP_SOFT_DIRTY breaking swapoff from Hugh Dickins
  - scripts/recordmcount.pl: support data in text section on powerpc from Ulrich Weigand
  - Handle R_PPC64_ENTRY relocations in modules from Ulrich Weigand
 
  - cxl: Fix possible idr warning when contexts are released from Vaibhav Jain
  - cxl: use correct operator when writing pcie config space values from Andrew Donnellan
  - cxl: Fix DSI misses when the context owning task exits from Vaibhav Jain
  - cxl: fix build for GCC 4.6.x from Brian Norris
  - cxl: use -Werror only with CONFIG_PPC_WERROR from Brian Norris
  - cxl: Enable PCI device ID for future IBM CXL adapter from Uma Krishnan
 
  - Freescale updates from Scott: Highlights include moving QE code out of
    arch/powerpc (to be shared with arm), device tree updates, and minor fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWmIxeAAoJEFHr6jzI4aWAA+cQAIXAw4WfVWJ2V4ZK+1eKfB57
 fdXG71PuXG+WYIWy71ly8keLHdzzD1NQ2OUB64bUVRq202nRgVc15ZYKRJ/FE/sP
 SkxaQ2AG/2kI2EflWshOi0Lu9qaZ+LMHJnszIqE/9lnGSB2kUI/cwsSXgziiMKXR
 XNci9v14SdDd40YV/6BSZXoxApwyq9cUbZ7rnzFLmz4hrFuKmB/L3LABDF8QcpH7
 sGt/YaHGOtqP0UX7h5KQTFLGe1OPvK6NWixSXeZKQ71ED6cho1iKUEOtBA9EZeIN
 QM5JdHFWgX8MMRA0OHAgidkSiqO38BXjmjkVYWoIbYz7Zax3ThmrDHB4IpFwWnk3
 l7WBykEXY7KEqpZzbh0GFGehZWzVZvLnNgDdvpmpk/GkPzeYKomBj7ZZfm3H1yGD
 BTHPwuWCTX+/K75yEVNO8aJO12wBg7DRl4IEwBgqhwU8ga4FvUOCJkm+SCxA1Dnn
 qlpS7qPwTXNIEfKMJcxp5X0KiwDY1EoOotd4glTN0jbeY5GEYcxe+7RQ302GrYxP
 zcc8EGLn8h6BtQvV3ypNHF5l6QeTW/0ZlO9c236tIuUQ5gQU39SQci7jQKsYjSzv
 BB1XdLHkbtIvYDkmbnr1elbeJCDbrWL9rAXRUTRyfuCzaFWTfZmfVNe8c8qwDMLk
 TUxMR/38aI7bLcIQjwj9
 =R5bX
 -----END PGP SIGNATURE-----

Merge tag 'powerpc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux

Pull powerpc updates from Michael Ellerman:
 "Core:
   - Ground work for the new Power9 MMU from Aneesh Kumar K.V
   - Optimise FP/VMX/VSX context switching from Anton Blanchard

  Misc:
   - Various cleanups from Krzysztof Kozlowski, John Ogness, Rashmica
     Gupta, Russell Currey, Gavin Shan, Daniel Axtens, Michael Neuling,
     Andrew Donnellan
   - Allow wrapper to work on non-english system from Laurent Vivier
   - Add rN aliases to the pt_regs_offset table from Rashmica Gupta
   - Fix module autoload for rackmeter & axonram drivers from Luis de
     Bethencourt
   - Include KVM guest test in all interrupt vectors from Paul Mackerras
   - Fix DSCR inheritance over fork() from Anton Blanchard
   - Make value-returning atomics & {cmp}xchg* & their atomic_ versions
     fully ordered from Boqun Feng
   - Print MSR TM bits in oops messages from Michael Neuling
   - Add TM signal return & invalid stack selftests from Michael Neuling
   - Limit EPOW reset event warnings from Vipin K Parashar
   - Remove the Cell QPACE code from Rashmica Gupta
   - Append linux_banner to exception information in xmon from Rashmica
     Gupta
   - Add selftest to check if VSRs are corrupted from Rashmica Gupta
   - Remove broken GregorianDay() from Daniel Axtens
   - Import Anton's context_switch2 benchmark into selftests from
     Michael Ellerman
   - Add selftest script to test HMI functionality from Daniel Axtens
   - Remove obsolete OPAL v2 support from Stewart Smith
   - Make enter_rtas() private from Michael Ellerman
   - PPR exception cleanups from Michael Ellerman
   - Add page soft dirty tracking from Laurent Dufour
   - Add support for Nvlink NPUs from Alistair Popple
   - Add support for kexec on 476fpe from Alistair Popple
   - Enable kernel CPU dlpar from sysfs from Nathan Fontenot
   - Copy only required pieces of the mm_context_t to the paca from
     Michael Neuling
   - Add a kmsg_dumper that flushes OPAL console output on panic from
     Russell Currey
   - Implement save_stack_trace_regs() to enable kprobe stack tracing
     from Steven Rostedt
   - Add HWCAP bits for Power9 from Michael Ellerman
   - Fix _PAGE_PTE breaking swapoff from Aneesh Kumar K.V
   - Fix _PAGE_SWP_SOFT_DIRTY breaking swapoff from Hugh Dickins
   - scripts/recordmcount.pl: support data in text section on powerpc
     from Ulrich Weigand
   - Handle R_PPC64_ENTRY relocations in modules from Ulrich Weigand

  cxl:
   - cxl: Fix possible idr warning when contexts are released from
     Vaibhav Jain
   - cxl: use correct operator when writing pcie config space values
     from Andrew Donnellan
   - cxl: Fix DSI misses when the context owning task exits from Vaibhav
     Jain
   - cxl: fix build for GCC 4.6.x from Brian Norris
   - cxl: use -Werror only with CONFIG_PPC_WERROR from Brian Norris
   - cxl: Enable PCI device ID for future IBM CXL adapter from Uma
     Krishnan

  Freescale:
   - Freescale updates from Scott: Highlights include moving QE code out
     of arch/powerpc (to be shared with arm), device tree updates, and
     minor fixes"

* tag 'powerpc-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (149 commits)
  powerpc/module: Handle R_PPC64_ENTRY relocations
  scripts/recordmcount.pl: support data in text section on powerpc
  powerpc/powernv: Fix OPAL_CONSOLE_FLUSH prototype and usages
  powerpc/mm: fix _PAGE_SWP_SOFT_DIRTY breaking swapoff
  powerpc/mm: Fix _PAGE_PTE breaking swapoff
  cxl: Enable PCI device ID for future IBM CXL adapter
  cxl: use -Werror only with CONFIG_PPC_WERROR
  cxl: fix build for GCC 4.6.x
  powerpc: Add HWCAP bits for Power9
  powerpc/powernv: Reserve PE#0 on NPU
  powerpc/powernv: Change NPU PE# assignment
  powerpc/powernv: Fix update of NVLink DMA mask
  powerpc/powernv: Remove misleading comment in pci.c
  powerpc: Implement save_stack_trace_regs() to enable kprobe stack tracing
  powerpc: Fix build break due to paca mm_context_t changes
  cxl: Fix DSI misses when the context owning task exits
  MAINTAINERS: Update Scott Wood's e-mail address
  powerpc/powernv: Fix minor off-by-one error in opal_mce_check_early_recovery()
  powerpc: Fix style of self-test config prompts
  powerpc/powernv: Only delay opal_rtc_read() retry when necessary
  ...
2016-01-15 13:18:47 -08:00
Arnd Bergmann ebea7c0545 spi: fix counting in spi-loopback-test code
These variables are always used uninitialized:

drivers/spi/spi-loopback-test.c: In function 'spi_test_run_iter':
drivers/spi/spi-loopback-test.c:768:17: warning: 'rx_count' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/spi/spi-loopback-test.c:762:17: warning: 'tx_count' may be used uninitialized in this function [-Wmaybe-uninitialized]

Adding an explicit initialization seems to be the only
workable solution here, to make the code behave correctly
and build without warning.

Fixes: 84e0c4e5e2 ("spi: add loopback test driver to allow for spi_master regression tests")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-15 18:13:53 +00:00
Linus Torvalds 50ae833e47 spi: Updates for v4.5
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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJWlNpkAAoJECTWi3JdVIfQ2rkH/j8fhCJVAGIkFs49+jk/+ZBR
 NsvUEnPae9+e7vx/UBFNFJrM/1cpqy5VhDSbl/UnJLnOwiOOGeOR5H7S6YgDcW8m
 gwgeCUJU5eqXx1tAuLJrD/qLya8uQQC6XaSlT2Du2Zr15EZ7tUvlRTva9M2nRQCC
 OBo6f0FY+ptv/aNL7ME1WY5T4uQJC1FqRfvj0Cle1ZC8A1gONPoI7WLPasMckBEX
 g9q76OUxLZ/I9CASUGbJYMtq/eBca5kq+dPcFLPfNTKKJk98TgRcJHzT+NW9igo2
 D5r/pcsv8pt6H0Q2df8nkRzfvM/EPk/5VAYVJAxCogelKnqVaI8wlc6P7Rq5Mz0=
 =0Z1l
 -----END PGP SIGNATURE-----

Merge tag 'spi-v4.5' of 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
  ...
2016-01-13 11:38:27 -08:00
Mark Brown cabeea9808 Merge remote-tracking branches 'spi/topic/sun4i', 'spi/topic/topcliff-pch' and 'spi/topic/zynq' into spi-next 2016-01-11 16:48:38 +00:00
Mark Brown 4f9530705b Merge remote-tracking branches 'spi/topic/overlay', 'spi/topic/pxa2xx', 'spi/topic/s3c64xx', 'spi/topic/sh-msiof' and 'spi/topic/spidev' into spi-next 2016-01-11 16:48:35 +00:00
Mark Brown 41d5a70051 Merge remote-tracking branches 'spi/topic/lm70llp', 'spi/topic/loopback', 'spi/topic/mtk' and 'spi/topic/omap2-mcspi' into spi-next 2016-01-11 16:48:33 +00:00
Mark Brown 635b9b2e6e Merge remote-tracking branches 'spi/topic/dw', 'spi/topic/dw-mid', 'spi/topic/fsl-espi' and 'spi/topic/imx' into spi-next 2016-01-11 16:48:31 +00:00
Mark Brown 3c2789239a Merge remote-tracking branches 'spi/topic/bcm63xx', 'spi/topic/butterfly', 'spi/topic/cadence' and 'spi/topic/davinci' into spi-next 2016-01-11 16:48:30 +00:00
Mark Brown 9b17e80150 Merge remote-tracking branch 'spi/topic/sunxi' into spi-next 2016-01-11 16:48:29 +00:00
Mark Brown 174c21163d Merge remote-tracking branch 'spi/topic/core' into spi-next 2016-01-11 16:48:29 +00:00
Mark Brown f30f072a5f Merge remote-tracking branch 'spi/fix/mtk' into spi-linus 2016-01-11 16:48:27 +00:00
Dan Carpenter 8caad1da22 spi: loopback: fix typo in MODULE_PARM_DESC
There should be an 's' on "dump_message" so it matches the module_param.

Fixes: 84e0c4e5e2 ('spi: add loopback test driver to allow for spi_master regression tests')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-08 12:53:35 +00:00
Marcus Weseloh 218e0b575f spi: sun4i: Prevent chip-select from being activated twice before a transfer
The SPI core calls set_cs before a transfer, but the SUN4I_CTL_CS_MANUAL
flag is only set in transfer_one. This leads to the following pattern on
the chip-select line (with runtime power-management on every transfer,
without it only on the first one):

activate, deactivate, activate, transfer, deactivate

Moving the configuration of the SUN4I_CTL_CS_MANUAL flag from transfer_one
to set_cs removes the double activation.

Signed-off-by: Marcus Weseloh <mweseloh42@gmail.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-07 15:41:25 +00:00
Martin Sperl 1e8db97f0e spi: loopback-test: spi_check_rx_ranges can get always done
The spi_check_rx_ranges can always get executed independent of
if we have a real loopback situation.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 19:12:47 +00:00
Martin Sperl 339ec3ce54 spi: loopback-test: rename method spi_test_fill_tx to spi_test_fill_pattern
Rename method spi_test_fill_tx to spi_test_fill_pattern
to better describe what it does.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 19:05:23 +00:00
Martin Sperl e6520a3c88 spi: loopback-test: write rx pattern also when running without tx_buf
Currently the rx_buf does not get set with the
SPI_TEST_PATTERN_UNWRITTEN when tx_buf == NULL in the transfer.

Reorder code so that it gets done also under this specific condition.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 19:05:23 +00:00
Michal Suchanek b541eef125 spi: fsl-espi: expose maximum transfer size limit
The fsl-espi hardware can trasfer at most 64K data so report teh
limitation.

Based on patch by Heiner Kallweit <hkallweit1@gmail.com>

CC: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Michal Suchanek <hramrach@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 16:33:54 +00:00
Geliang Tang 9d0c1c3332 spi: zynq: use to_platform_device()
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 11:34:37 +00:00
Geliang Tang 9033a5f9ac spi: cadence: use to_platform_device()
Use to_platform_device() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-01-05 11:34:23 +00:00
Christophe RICARD 33ada67da3 ACPI / spi: attach GPIO IRQ from ACPI description to SPI device
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>
2016-01-01 03:20:25 +01:00
Leilk Liu 15bcdefdc7 spi: mediatek: Add spi support for mt2701 IC
This patch adds spi support for mt2701 IC.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-31 22:10:02 +00:00
Leilk Liu 4eaf6f7303 spi: mediatek: merge all identical compat to mtk_common_compat
This patch merge all identical compat into on mtk_common_compat
and used for all compatible soc.

Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-31 22:09:59 +00:00
Nicolas Boichat de327e4966 spi: mediatek: Prevent overflows in FIFO transfers
In the case where transfer length is not a multiple of 4, KASAN
reports 2 out-of-bounds memory accesses:
 - mtk_spi_interrupt: ioread32_rep writes past the end of
   trans->rx_buf.
 - mtk_spi_fifo_transfer: iowrite32_rep reads past the end of
   xfer->tx_buf.

Fix this by using memcpy on the remainder of the bytes.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-30 17:26:40 +00:00
Sylwester Nawrocki cc023478dc spi: s3c64xx: Remove unused platform_device_id entries
s5pv210 and exynos4 are now DT only platforms hence these
entries can now be safely removed from the match table.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-30 16:48:58 +00:00
Geliang Tang d1eba93bd0 spi: use to_spi_device
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>
2015-12-23 12:15:41 +00:00
Jisheng Zhang 6096828e68 spi: dw: Use SPI_TMOD_TR rather than magic const 0 to set tmode
The TMODE available value is well defined and documented in the header
file. Use it and remove the comment.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23 12:12:09 +00:00
Zhao Qiang 7aa1aa6ece QE: Move QE from arch/powerpc to drivers/soc
ls1 has qe and ls1 has arm cpu.
move qe from arch/powerpc to drivers/soc/fsl
to adapt to powerpc and arm

Signed-off-by: Zhao Qiang <qiang.zhao@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
2015-12-22 17:12:56 -06:00
Mark Brown c1f4a14940 Merge remote-tracking branches 'spi/fix/dspi' and 'spi/fix/spidev' into spi-linus 2015-12-16 13:28:32 +00:00
Mark Brown 9ce5db27f4 Merge remote-tracking branch 'spi/fix/core' into spi-linus 2015-12-16 13:28:31 +00:00
Johan Hovold 157f38f993 spi: fix parent-device reference leak
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: 49dce689ad ("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
2015-12-16 12:28:25 +00:00
Mark Brown 56ea1075e7 spi: spidev: Hold spi_lock over all defererences of spi in release()
We use the spi_lock spinlock to protect against races between the device
being removed and file operations on the spidev.  This means that in the
removal path all references to the device need to be done under lock as
in removal we dropping references to the device.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-16 12:09:35 +00:00
Anton Bondarenko bf9af08cd5 spi: imx: defer spi initialization, if DMA engine is
If SPI device supports DMA mode, but DMA controller is not yet
available due to e.g. a delay in the corresponding kernel module
initialization, retry to initialize SPI driver later on instead of
falling back into PIO only mode.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15 22:40:35 +00:00
Anton Bondarenko 3760047a7d spi: imx: return error from dma channel request
On SDMA initialization return exactly the same error, which is
reported by dma_request_slave_channel_reason(), it is a preceding
change to defer SPI DMA initialization, if SDMA module is not yet
available.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15 22:40:35 +00:00
Anton Bondarenko 4686d1c3d1 spi: imx: enable loopback only for ECSPI controller family
Limit SPI_LOOP mode to ECSPI controller (iMX.51, iMX53 and i.MX6) only since
there is no support in other families specific code for now.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15 22:40:35 +00:00
Anton Bondarenko f677f17cce spi: imx: fix loopback mode setup after controller reset
If controller hold in reset it's not possible to write any
register except CTRL. So all other registers must be updated
only after controller bring out from reset.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-15 22:40:35 +00:00
Martin Sperl 739f3e9291 spi: loopback: added additional non-power of 2 transfer lengthes
Added additional transfer length to test that are not a power of 2.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-13 20:10:15 +00:00
Martin Sperl fc8773e195 spi: loopback: match configuration of test to description
The test "two tx+rx transfers - alter second" actually modifies
the first not the second transfer, which - in conjunction with
testing the read data - results also in overwriting data read
earlier.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-13 20:10:14 +00:00
Martin Sperl d58b9fda12 spi: loopback: fix printk format issues with size_t
Fixes the reported printk format issues reported by kbuild-test-robot.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-13 20:10:14 +00:00
Martin Sperl 97896195b3 spi: add spi-loopback-test to build framework
adding the spi-loopback-test module to Kconfig and Makefile

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 23:05:18 +00:00
Martin Sperl 84e0c4e5e2 spi: add loopback test driver to allow for spi_master regression tests
This driver is submitting lots of distinct spi-messages messages
with all kinds of alignments and length pattern.
Also distinct kinds of transfer pattern tests are implemented
(rx, tx, rx/tx, tx+tx, tx+rx,...)

Right now on a raspberry pi 752 distinct spi_messages are executed
in 13 different scenarios.

Configuration of additional test-pattern is easy, so that when
new bugs in drivers get detected the relevant transfer pattern can
also get added to the test framework, so that such situations are
detected in other drivers as well.

The idea behind this driver is to make it possible to also detect
regressions in spi_master implementations when changes occur.
Potentially these tests could get executed automatically in a
test-server-farm.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 23:05:18 +00:00
Sekhar Nori 21c015b776 spi: davinci: use dev_err() for error reporting
Use dev_err() for reporting errors rather than
dev_dbg().

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 22:57:44 +00:00
Sekhar Nori 7f3ac71ac3 spi: davinci: fix spurious i/o error
davinci_spi_bufs() uses wait_for_completion_interruptible()
without bothering to handle -ERESTARTSYS. Due to this,
sometime, it returns prematurely when a signal is received.
Since the return value is never checked, userspace eventually
receives a spurious -EIO.

To fix this, use un-interruptible wait_for_completion_timeout().

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 22:57:44 +00:00
Bhuvanchandra DV ef22d1604c spi-fsl-dspi: Fix CTAR Register access
DSPI instances in Vybrid have a different amount of chip selects
and CTARs (Clock and transfer Attributes Register). In case of
DSPI1 we only have 2 CTAR registers and 4 CS. In present driver
implementation CTAR offset is derived from CS instance which will
lead to out of bound access if chip select instance is greater than
CTAR register instance, hence use single CTAR0 register for all CS
instances. Since we write the CTAR register anyway before each access,
there is no value in using the additional CTAR registers. Also one
should not program a value in CTAS for a CTAR register that is not
present, hence configure CTAS to use CTAR0.

Signed-off-by: Bhuvanchandra DV <bhuvanchandra.dv@toradex.com>
Acked-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-12 22:33:09 +00:00
Sudip Mukherjee 22de54a9b9 spi: lm70llp: remove printk
Using pr_* macros are more prefferable than using printk. Start using
pr_* family of macros and define pr_fmt to be used with it.
While at it remove DRVNAME from an existing pr_info() as the name is now
being printed by pr_fmt.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-07 20:09:09 +00:00