Commit graph

1449 commits

Author SHA1 Message Date
Mark Brown 592cd34d94 Merge remote-tracking branch 'spi/topic/txx9' into spi-next 2013-06-26 16:21:05 +01:00
Mark Brown cf7315b214 Merge remote-tracking branch 'spi/topic/topcliff' into spi-next 2013-06-26 16:21:05 +01:00
Mark Brown adb25d5328 Merge remote-tracking branch 'spi/topic/sirf' into spi-next 2013-06-26 16:21:04 +01:00
Mark Brown f4e975814e Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-next 2013-06-26 16:21:04 +01:00
Mark Brown c87e5d97c9 Merge remote-tracking branch 'spi/topic/s3c24xx' into spi-next 2013-06-26 16:21:03 +01:00
Mark Brown 7e016d146f Merge remote-tracking branch 'spi/topic/pxa' into spi-next 2013-06-26 16:21:03 +01:00
Mark Brown 37553b9236 Merge remote-tracking branch 'spi/topic/pl022' into spi-next 2013-06-26 16:21:02 +01:00
Mark Brown 3d09da11b5 Merge remote-tracking branch 'spi/topic/pdata' into spi-next 2013-06-26 16:21:02 +01:00
Mark Brown 1728ddb2ca Merge remote-tracking branch 'spi/topic/omap' into spi-next 2013-06-26 16:21:01 +01:00
Mark Brown 13a621693e Merge remote-tracking branch 'spi/topic/nuc900' into spi-next 2013-06-26 16:21:01 +01:00
Mark Brown 5bd30ed95b Merge remote-tracking branch 'spi/topic/mxs' into spi-next 2013-06-26 16:21:00 +01:00
Mark Brown 95e40cc528 Merge remote-tracking branch 'spi/topic/mpc512x' into spi-next 2013-06-26 16:21:00 +01:00
Mark Brown 11e9168919 Merge remote-tracking branch 'spi/topic/imx' into spi-next 2013-06-26 16:20:59 +01:00
Mark Brown 2a5c37cab3 Merge remote-tracking branch 'spi/topic/fsl' into spi-next 2013-06-26 16:20:59 +01:00
Mark Brown 385daaf0a8 Merge remote-tracking branch 'spi/topic/ep93xx' into spi-next 2013-06-26 16:20:58 +01:00
Mark Brown 6140b05ca3 Merge remote-tracking branch 'spi/topic/core' into spi-next 2013-06-26 16:20:58 +01:00
Mark Brown 2924f096a8 Merge remote-tracking branch 'spi/topic/coldfire-qspi' into spi-next 2013-06-26 16:20:57 +01:00
Mark Brown 4581949d52 Merge remote-tracking branch 'spi/topic/bpw' into spi-next 2013-06-26 16:20:57 +01:00
Mark Brown 8bce7eb7de Merge remote-tracking branch 'spi/topic/bcm2835' into spi-next 2013-06-26 16:20:56 +01:00
Mark Brown 0470f68ec1 Merge remote-tracking branch 'spi/topic/atmel' into spi-next 2013-06-26 16:20:56 +01:00
Mark Brown 77ba61454a Merge remote-tracking branch 'spi/fix/xilinx' into spi-linus 2013-06-26 16:20:55 +01:00
Mark Brown 89b77c4b44 Merge remote-tracking branch 'spi/fix/s3c64xx' into spi-linus 2013-06-26 16:20:54 +01:00
Mark Brown cd469106c3 spi/s3c64xx: Rely on the compiler eliminating the OF ID table
This should work with modern compilers, isn't that much of an issue if
it goes wrong and it ensures that the DT-only hardware variants don't
leave unreferenced parameters structures lying around.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-26 16:20:38 +01:00
Girish K S bff82038ca spi: s3c64xx: Added support for exynos5440 spi
This patch adds support for the exynos5440 spi controller.
The integration of the spi IP in exynos5440 is different from
other SoC's. The I/O pins are no more configured via gpio, they
have dedicated pins.

Signed-off-by: Girish K S <ks.giri@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-25 11:15:33 +01:00
Girish K S 3146beec21 spi: s3c64xx: Added provision for dedicated cs pin
The existing driver supports gpio based /cs signal.
For controller's that have one device per controller,
the slave device's /cs signal might be internally controlled
by the chip select bit of slave select register. They are not
externally asserted/deasserted using gpio pin.

This patch adds support for controllers with dedicated /cs pin.
if "cs-gpio" property doesnt exist in a spi dts node, the controller
would treat the /cs pin as dedicated.

Signed-off-by: Girish K S <ks.giri@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-25 11:15:33 +01:00
Matt Porter 74f3aaad21 spi: omap2-mcspi: convert to dma_request_slave_channel_compat()
Convert dmaengine channel requests to use
dma_request_slave_channel_compat(). This supports the DT case of
platforms requiring channel selection from either the OMAP DMA or
the EDMA engine. AM33xx only boots from DT and is the only user
implementing EDMA so in the !DT case we can default to the OMAP DMA
filter.

Signed-off-by: Matt Porter <mporter@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-24 10:18:40 +01:00
Mika Westerberg cc0ee9873c spi/pxa2xx: fix memory corruption due to wrong size used in devm_kzalloc()
ACPI part of the driver accidentally used sizeof(*ssp) instead of the
correct sizeof(*pdata). This leads to nasty memory corruptions like the one
below:

    BUG: unable to handle kernel paging request at 0000000749fd30b8
    IP: [<ffffffff813fe8a1>] __list_del_entry+0x31/0xd0
    PGD 0
    Oops: 0000 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 0 PID: 30 Comm: kworker/0:1 Not tainted 3.10.0-rc6v3.10-rc6_sdhci_modprobe+ #443
    task: ffff8801483a0940 ti: ffff88014839e000 task.ti: ffff88014839e000
    RIP: 0010:[<ffffffff813fe8a1>]  [<ffffffff813fe8a1>] __list_del_entry+0x31/0xd0
    RSP: 0000:ffff88014839fde8  EFLAGS: 00010046
    RAX: ffff880149fd30b0 RBX: ffff880149fd3040 RCX: dead000000200200
    RDX: 0000000749fd30b0 RSI: ffff880149fd3058 RDI: ffff88014834d640
    RBP: ffff88014839fde8 R08: ffff88014834d640 R09: 0000000000000001
    R10: ffff8801483a0940 R11: 0000000000000001 R12: ffff880149fd3040
    R13: ffffffff810e0b30 R14: ffff8801483a0940 R15: ffff88014834d640
    FS:  0000000000000000(0000) GS:ffff880149e00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000168 CR3: 0000000001e0b000 CR4: 00000000001407f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Stack:
     ffff88014839fe48 ffffffff810e0baf ffffffff81120abd ffff88014839fe20
     ffff8801483a0940 ffff8801483a0940 ffff8801483a0940 ffff8801486b1c90
     ffff88014834d640 ffffffff810e0b30 0000000000000000 0000000000000000
    Call Trace:
     [<ffffffff810e0baf>] worker_thread+0x7f/0x390
     [<ffffffff81120abd>] ? trace_hardirqs_on+0xd/0x10
     [<ffffffff810e0b30>] ? manage_workers.isra.22+0x2b0/0x2b0
     [<ffffffff810e6c09>] kthread+0xd9/0xe0
     [<ffffffff810f93df>] ? local_clock+0x3f/0x50
     [<ffffffff810e6b30>] ? kthread_create_on_node+0x110/0x110
     [<ffffffff818c5dec>] ret_from_fork+0x7c/0xb0
     [<ffffffff810e6b30>] ? kthread_create_on_node+0x110/0x110

Fix this by using the right structure size in devm_kzalloc().

Reported-by: Jerome Blin <jerome.blin@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org # 3.9+
2013-06-21 10:53:37 +01:00
Mark Brown 796170733e spi/s3c64xx: Make wait_for_timeout() function name less generic
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-19 19:12:39 +01:00
Girish K S 7e9955567e spi: s3c64xx: added support for polling mode
The 64xx spi driver supports partial polling mode.
Only the last chunk of the transfer length is transferred
or recieved in polling mode.

Some SoC's that adopt this controller might not have have dma
interface. This patch adds support for complete polling mode
and gives flexibity for the user to select poll/dma mode.

Signed-off-by: Girish K S <ks.giri@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-19 19:07:42 +01:00
Mika Westerberg 5548f98c46 spi/pxa2xx: use GFP_ATOMIC in sg table allocation
pxa2xx_spi_map_dma_buffer() gets called in tasklet context so we can't
sleep when we allocate a new sg table. Use GFP_ATOMIC here instead.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2013-06-18 19:11:04 +01:00
Illia Smyrnov d33f473dcd spi: omap2-mcspi: Add FIFO buffer support
The MCSPI controller has a built-in FIFO buffer to unload the DMA or interrupt
handler and improve data throughput. This patch adds FIFO buffer support for SPI
transfers in DMA mode.

For SPI transfers in DMA mode, the largest possible FIFO buffer size will be
calculated and set up. The FIFO won't be used for the SPI transfers in DMA mode
if: calculated FIFO buffer size is less then 2 bytes or the FIFO buffer size
isn't multiple of the SPI word length.

Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-17 17:17:23 +01:00
Illia Smyrnov 56cd5c1578 spi: omap2-mcspi: Move bytes per word calculation to the function
Introduce mcspi_bytes_per_word function as replacement for the next code
fragment:

int c = (word_len <= 8)  ? 1 :
	(word_len <= 16) ? 2 :
	/* word_len <= 32 */ 4;

This code used 2 times in current driver code and will be used 2 times in
the next FIFO buffer support patch. Replace it with inline function with clear
name to improve code legibility.

Signed-off-by: Illia Smyrnov <illia.smyrnov@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-17 10:13:29 +01:00
Sylwester Nawrocki 6c6cf64b16 spi: s3c64xx: Fix pm_runtime_get_sync() return value check
If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.

Without this patch there are seen errors like:

[    8.540000] s3c64xx-spi 13930000.spi: Failed to enable device: 1
[    8.545000] spi_master spi1: failed to prepare transfer hardware

Likely because the driver uses synchronous API to runtime enable
the device and asynchronous one to disable it.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonielinaro.org>
Cc: stable@vger.kernel.org
2013-06-10 18:04:00 +01:00
dan.carpenter@oracle.com e33d085d11 spi: spi-xilinx: cleanup a check in xilinx_spi_txrx_bufs()
'!' has higher precedence than comparisons so the original condition
is equivalent to "if (xspi->remaining_bytes == 0)".  This makes the
static checkers complain.

xspi->remaining_bytes is signed and from looking at the code
briefly, I think it might be able to go negative.  I suspect that
going negative may cause a bug, but I don't have the hardware and
can't test.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-10 10:28:04 +01:00
Sachin Kamat 26cb3bb149 spi: spi-nuc900: Remove redundant platform_set_drvdata()
Setting platform data to NULL is not necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-06 11:58:11 +01:00
Mark Brown c1d926a5d2 Merge remote-tracking branch 'spi/fix/xilinx' into spi-linus 2013-06-04 18:52:05 +01:00
Mark Brown ae6c138353 Merge remote-tracking branch 'spi/fix/topcliff' into spi-linus 2013-06-04 18:52:05 +01:00
Mark Brown 2570ce2a92 Merge remote-tracking branch 'spi/fix/hspi' into spi-linus 2013-06-04 18:52:04 +01:00
Kuninori Morimoto bc2bfffc38 spi: hspi: fixup long delay time
Current HSPI driver is using msleep(20) on hspi_status_check_timeout(),
but it was too long delay for SPI device.
Bock-W board SPI access was too slow without this patch.
This patch uses udelay(10) for it.

Tested-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-06-04 18:51:40 +01:00
Sachin Kamat d086432373 spi: spi-fsl-lib: Make mpc8xxx_spi_work static
'mpc8xxx_spi_work' is used only in this file.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-04 18:40:51 +01:00
Sachin Kamat f5d8ee3f15 spi: spi-topcliff-pch: Fix sparse warnings
Fixes the following type of warnings:
drivers/spi/spi-topcliff-pch.c:370:52: warning:
Using plain integer as NULL pointer

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-04 18:39:19 +01:00
Peter Crosthwaite 68c315bb95 spi: spi-xilinx: Remove ISR race condition
The ISR currently consumes the rx buffer data and re-enables transmission
from within interrupt context. This is bad because if the interrupt
occurs again before the ISR exits, the new interrupt will be erroneously
cleared by the still completing ISR.

Simplified the ISR by just setting the completion variable and exiting with
no action. Then just looped the transmit functionality in
xilinx_spi_txrx_bufs().

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-04 18:32:19 +01:00
Gerhard Sittig 85085898ab spi: mpc512x: use the SPI subsystem's message queue
the SPI subsystem recently grew support to queue messages before handing
them to the SPI master, and erroneously emitted deprecation warnings
when the SPI master's driver did not use the common logic (in fact the
master might queue messages, but implement the queue in the master
driver's source)

  [    0.823015] mpc512x-psc-spi 80011400.psc: master is unqueued, this is deprecated
  [    0.854913] mpc512x-psc-spi 80011500.psc: master is unqueued, this is deprecated

this change makes the MPC512x PSC SPI driver use the SPI subsystem's
support to queue SPI messages and removes the master driver's private
code for the queue support

Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-04 18:22:48 +01:00
Gerhard Sittig 5df24ea63d spi: mpc512x: improve throughput in the RX/TX func
change the MPC512x SPI controller's transmission routine to increase
throughput: allow the RX byte counter to "lag behind" the TX byte
counter while iterating over the transfer's data, only wait for the
remaining RX bytes at the very end of the transfer

this approach eliminates delays in the milliseconds range, transfer
times for e.g. 16MB of SPI flash data dropped from 31s to 9s, correct
operation was tested by continuously transferring and comparing data
from an SPI flash (more than 200GB in some 45 hours)

background information on the motivation:

one might assume that all the RX data should have been received when the
TX data was sent, given the fact that we are the SPI master and provide
all of the clock, but in practise there's a difference

the ISR is triggered when the TX FIFO became empty, while transmission
of the last item still occurs (from the TX hold and shift registers),
sampling RX data on the opposite clock edge compared to the TX data adds
another delay (half a bit period), and RX data needs to propagate from
the reception buffer to the RX FIFO depending on the specific SoC
implementation

to cut it short: a difference between TX and RX byte counters during
transmission is not just acceptable but should be considered the regular
case, only the very end of the transfer needs to make sure that all of
the RX data was received before deasserting the chip select and telling
the caller that transmission has completed

Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-04 18:22:47 +01:00
Gerhard Sittig c36e93a0bd spi: mpc512x: minor prep before feature change
mechanical edits before changing functionality, to reduce diffs
- rename variables to later tell remaining TX and RX apart
- use size_t for the current TX and RX length
  (for better compatibility with the min() macro)
- remove unused members from the master data (sysclk, eofbyte)
- silence a checkpatch warning (braces around single statement)

Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-04 18:22:47 +01:00
Richard Genoud 2f767a9f6b spi: atmel: convert to dma_request_slave_channel_compat()
Use generic DMA DT helper.
Platforms booting with or without DT populated are both supported.

Based on Ludovic Desroches <ludovic.desroches@atmel.com> patchset
"ARM: at91: move to generic DMA device tree binding"

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-03 16:22:50 +01:00
Arnd Bergmann 804ae4380d spi: sirf: avoid uninitialized-use warning
24778be20 "spi: convert drivers to use bits_per_word_mask"
removed the "default" statement in the spi_sirfsoc_setup_transfer
switch, causing a new warning:

drivers/spi/spi-sirf.c: In function 'spi_sirfsoc_setup_transfer':
arch/arm/include/asm/io.h:90:2: warning: 'rxfifo_ctrl' may be used uninitialized in this function [-Wmaybe-uninitialized]
  asm volatile("str %1, %0"
  ^
drivers/spi/spi-sirf.c:364:19: note: 'rxfifo_ctrl' was declared here
  u32 txfifo_ctrl, rxfifo_ctrl;
                   ^

The compiler has correctly identified that this case may happen,
but since we know that things are horribly broken if bits_per_word
is ever something other than the values we tested, calling BUG()
is an appropriate action and tells the compiler that execution
will not continue afterwards.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-03 15:28:34 +01:00
Sachin Kamat 69a0171901 spi: spi-txx9: Remove redundant platform_set_drvdata()
Setting platform data to NULL is not necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-01 20:18:57 +01:00
Sachin Kamat 8471090479 spi: spi-s3c24xx: Remove redundant platform_set_drvdata()
Setting platform data to NULL is not necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-01 20:17:36 +01:00
Stephen Warren 51faed692b spi: fix build break in spi-fsl-espi.c
Fix a build error introduced by 24778be "spi: convert drivers to use
bits_per_word_mask":

drivers/spi/spi-fsl-espi.c:162:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-01 19:46:16 +01:00