Commit graph

2198 commits

Author SHA1 Message Date
Axel Lin 08850fa948 spi: s3c24xx: Convert to let spi core validate bits_per_word
Set bits_per_word_mask so spi core will reject transfers that attempt to use
an unsupported bits_per_word value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-14 18:08:07 +00:00
Jean Delvare aec35f4ee6 spi: Clean up probe and remove functions
While backporting 33cf00e5 ("spi: attach/detach SPI device to the ACPI
power domain"), I noticed that the code changes were suboptimal:

* Why use &spi->dev when we have dev at hand?

* After fixing the above, spi is used only once, so we don't really
  need a local variable for it.

This results in the following clean-up.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-14 14:59:45 +00:00
Mark Brown 513273538a spi: Make max_tx and max_rx the same type
Prevents spurious compiler warnings.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-12 20:38:20 +00:00
Axel Lin 354312f16e spi: Remove duplicate code to check chip_select
In spi_add_device(), we have the code to validate spi->chip_select.
So remove the duplicate code in various drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-12 16:25:32 +00:00
Axel Lin 0fd7376335 spi: octeon: Remove unused bits_per_word from struct octeon_spi_setup
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 18:53:00 +00:00
Axel Lin 495b335885 spi: orion: Convert to let spi core validate xfer->bits_per_word
Set bits_per_word_mask so spi core will reject transfers that attempt to use
an unsupported bits_per_word value.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 17:06:48 +00:00
Axel Lin c5c67e31bc spi: sc18is602: Move checking chip_select for SC18IS602 to sc18is602_setup
So it will be checked when spi device is added onto the spi bus.
spi_add_device() calls spi_setup() which then calls spi->master->setup().
No need to check it every time sc18is602_transfer_one() is called.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 17:02:31 +00:00
Mark Brown cf20662db4 Merge remote-tracking branches 'spi/fix/doc', 'spi/fix/nuc900' and 'spi/fix/rspi' into spi-linus 2014-02-11 12:08:27 +00:00
Mark Brown 797d0dec8a Merge remote-tracking branch 'spi/fix/core' into spi-linus 2014-02-11 12:08:26 +00:00
Axel Lin 3c604de496 spi: tegra20-slink: Convert to use master->max_speed_hz
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.

In additional, since commit 052eb2d490 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove the duplicate code in tegra_slink_setup.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 12:07:53 +00:00
Axel Lin 44830b4c2f spi: tegra20-sflash: Convert to use master->max_speed_hz
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.

In additional, since commit 052eb2d490 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove tegra_sflash_setup().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 12:07:50 +00:00
Axel Lin 383840d92f spi: tegra114: Convert to use master->max_speed_hz
Use master->max_speed_hz instead of tspi->spi_max_frequency, so spi core will
handle checking transfer speed.

In additional, since commit 052eb2d490 'spi: core: Set max_speed_hz of
spi_device default to max_speed_hz of controller',
spi core will also set default spi->max_speed_hz if it is not set.
So remove the duplicate code in tegra_spi_setup.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11 12:07:34 +00:00
Axel Lin 425f96d2f6 spi: txx9: Convert to let spi core handle checking transfer speed
By setting master->max_speed_hz and master->min_speed_hz, spi core will handle
checking transfer speed. Then we can remove the same checking in this driver.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 14:14:48 +00:00
Axel Lin 052eb2d490 spi: core: Set max_speed_hz of spi_device default to max_speed_hz of controller
In __spi_validate(), xfer->speed_hz is set to be spi->max_speed_hz if it is not
set for this transfer. However, if spi->max_speed_hz is also not set,
xfer->speed_hz is 0. Some drivers (e.g. au1550, tegra114, tegra20-sflash,
tegra20-slink, etc.) then use below code to avoid setting xfer->speed_hz to 0.

        /* Set speed to the spi max fequency if spi device has not set */
        spi->max_speed_hz = spi->max_speed_hz ? : tspi->spi_max_frequency;

Let's handle it in spi core.
If spi->max_speed_hz is not set, make it default to spi->master->max_speed_hz.
So In __spi_validate() if both xfer->speed_hz and spi->max_speed_hz are not set,
xfer->speed_hz will be set to spi->master->max_speed_hz.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 12:51:54 +00:00
Paul Bolle f6ab395bfe spi: omap2: use SUPERH, not SH
Commit 0079aae0f1 ("spi: omap2: Add build dependencies for
writel_relaxed()") added an optional Kconfig dependency on SH. That
Kconfig symbol doesn't exist. Apparently SUPERH was intended. Use that.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 12:34:32 +00:00
Axel Lin aa0fe82629 spi: Use reinit_completion at appropriate places
Calling init_completion() once is enough.
For the rest of the iterations, call reinit_completion() instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 12:32:16 +00:00
Axel Lin 79c2f49a2d spi: omap-100k: Remove unused fields from struct omap1_spi100k
Both *master and state are not really used, remove them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 12:16:17 +00:00
Christian Engelmayer 77c398f58c spi: omap-100k: Remove unused pointer in omap1_spi100k_txrx_pio()
Remove unused devdata pointer 'spi100k' in function omap1_spi100k_txrx_pio().

Detected by Coverity: CID 1077869.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 12:16:17 +00:00
Axel Lin d655bbbd5b spi: omap-100k: Remove unused MOD_REG_BIT macro
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-10 12:16:17 +00:00
Mark Brown 1b5e1b6949 spi/s3c64xx: Remove code no longer needed as a result of S3C_DMA removal
Remove functions that only had an effect when using S3C_DMA and inline
dmaengine_terminate_all() since it's pointless to have a function which
expands to a single function call.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 13:27:58 +00:00
Mark Brown 90e73973d3 spi/s3c64xx: Remove S3C_DMA support
All the platforms which use the old S3C_DMA API have now been converted to
dmaengine so we can remove the legacy code from the driver, simplifying
maintenance.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 13:27:57 +00:00
Mark Brown 3f29588795 spi/s3c64xx: Use core DMA mapping code with dmaengine
When using dmaengine allow the core to do the DMA mapping. We still need
local mapping code for the non-dmaengine case so this doesn't save us
anything for now.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 13:27:44 +00:00
Axel Lin aa188f90ff spi: Use SPI_BPW_MASK macro at appropriate places
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 12:21:28 +00:00
Axel Lin 9a7da6cc1d spi: mxs: Use list_for_each_entry to iterate over transfer list
We don't modify the list entry while iterating the transfer list.
So use list_for_each_entry instead of list_for_each_entry_safe.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 12:20:37 +00:00
Axel Lin b52a37f517 spi: orion: Let spi core handle checking transfer speed
Since commit a2fd4f9fa3 'spi: Support transfer speed checking in the core',
the SPI core validates the desired speed of a given transfer against the
minimum and maximum speeds supported by the controller.
So we can remove the same code in this driver and let spi core handle checking
the desired speed of a given transfer.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-07 12:20:00 +00:00
Mark Brown 7961656a6f spi/sunxi: Add missing dependency on RESET_CONTROLLER
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-06 19:55:03 +00:00
Christian Engelmayer 1647138df6 spi: orion: Remove unused pointer in orion_spi_write_read()
Remove unused devdata pointer 'orion_spi' in function orion_spi_write_read().

Detected by Coverity: CID 1077860.

Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-06 14:35:49 +00:00
Axel Lin b53b34f042 spi: davinci: Use of_match_ptr at appropriate place
It's pointless to use of_match_ptr within CONFIG_OF guard.
Use of_match_ptr around davinci_spi_of_match when setting .of_match_table.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-06 12:52:59 +00:00
Axel Lin 91cfe7e73b spi: davinci: Remove unneeded NULL checking for dspi and dspi->bitbang.master
spi_master_get_devdata() never returns NULL when spi_alloc_master() success,
so remove NULL test for dspi.
We have ensured master is not NULL before assigning it to dspi->bitbang.master.
So also remove NULL test for dspi->bitbang.master.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-06 12:52:58 +00:00
Maxime Ripard 3558fe900e spi: sunxi: Add Allwinner A31 SPI controller driver
The Allwinner A31 has a new SPI controller IP compared to the older Allwinner
SoCs.

It supports DMA, but the driver only does PIO for now, and DMA will be
supported eventually.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-05 14:58:36 +00:00
Axel Lin f7db1588d6 spi: nuc900: Set SPI_LSB_FIRST for master->mode_bits if hw->pdata->lsb is true
Otherwise, spi_setup() fails with unsupported mode bits message.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2014-02-04 20:32:58 +00:00
Mark Brown 6ad45a27cb spi: Make core DMA mapping functions generate scatterlists
We cannot unconditionally use dma_map_single() to map data for use with
SPI since transfers may exceed a page and virtual addresses may not be
provided with physically contiguous pages. Further, addresses allocated
using vmalloc() need to be mapped differently to other addresses.

Currently only the MXS driver handles all this, a few drivers do handle
the possibility that buffers may not be physically contiguous which is
the main potential problem but many don't even do that. Factoring this
out into the core will make it easier for drivers to do a good job so if
the driver is using the core DMA code then generate a scatterlist
instead of mapping to a single address so do that.

This code is mainly based on a combination of the existing code in the MXS
and PXA2xx drivers. In future we should be able to extend it to allow the
core to concatenate adjacent transfers if they are compatible, improving
performance.

Currently for simplicity clients are not allowed to use the scatterlist
when they do DMA mapping, in the future the existing single address
mappings will be replaced with use of the scatterlist most likely as
part of pre-verifying transfers.

This change makes it mandatory to use scatterlists when using the core DMA
mapping so update the s3c64xx driver to do this when used with dmaengine.
Doing so makes the code more ugly but it is expected that the old s3c-dma
code can be removed very soon.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 20:31:49 +00:00
Mark Brown 3a2eba9bd0 spi: Provide core support for full duplex devices
It is fairly common for SPI devices to require that one or both transfer
directions is always active. Currently drivers open code this in various
ways with varying degrees of efficiency. Start factoring this out by
providing flags SPI_MASTER_MUST_TX and SPI_MASTER_MUST_RX. These will cause
the core to provide buffers for the requested direction if none are
specified in the underlying transfer.

Currently this is fairly inefficient since we actually allocate a data
buffer which may get large, support for mapping transfers using a
scatterlist will allow us to avoid this for DMA based transfers.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 20:31:33 +00:00
Geert Uytterhoeven e290c3434b spi: rspi: Document support for Renesas QSPI in Kconfig
As of commit 5ce0ba8865 ("spi: rcar: add
Renesas QSPI support on RSPI") the rspi driver handles Renesas QSPI, too,
but this was not reflected in the Kconfig help text.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 19:22:30 +00:00
Ulf Hansson 8535736c27 spi: pl022: Remove redundant pinctrl to default state in probe
The driver core is now taking care of putting our pins into default
state at probe. Thus we can remove the redundant call for it in probe.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 19:17:59 +00:00
Ulf Hansson 6cac167b82 spi: pl022: Simplify clock handling
Make use of clk_prepare_enable and clk_disable_unprepare to simplify
code. No functional change.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 19:17:56 +00:00
Mark Brown 3700c6eb1e spi/s3c64xx: Split wait_for_xfer() into PIO and DMA versions
There is no meaningful code sharing between the PIO and DMA variants
(just the timeout calculation) so in order to make the code easier to
work with split the two cases.

Looking at the code it is not clear how the PIO version works for large
transmits, greater than FIFO size is only handled for RX.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 12:49:10 +00:00
Mark Brown 4ddc86005b spi/s3c64xx: Remove unused /CS GPIO management
The GPIO enable and disable is done in the core so does not need to be
replicated in the driver, delete the unneeded code. enable_cs() was not
referenced at all.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 12:49:10 +00:00
Stefan Roese 4302a59629 spi: fsl: Fix problem with multi message transfers
When used via spidev with more than one messages to tranfer via
SPI_IOC_MESSAGE the current implementation would return with
-EINVAL, since bits_per_word and speed_hz are set in all
transfer structs. And in the 2nd loop status will stay at
-EINVAL as its not overwritten again via fsl_spi_setup_transfer().

This patch changes this behavious by first checking if one of
the messages uses different settings. If this is the case
the function will return with -EINVAL. If not, the messages
are transferred correctly.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 11:33:39 +00:00
SeongJae Park e1bde3b11f spi: fix pointer-integer size mismatch warning
Fix the pointer-integer size mismatch warning below:
	drivers/spi/spi-gpio.c: In function ‘spi_gpio_setup’:
	drivers/spi/spi-gpio.c:252:8: warning: cast from pointer to integer of
			different size [-Wpointer-to-int-cast]
	   cs = (unsigned int) spi->controller_data;
	        ^

Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 11:17:30 +00:00
Geert Uytterhoeven 5dd1ad23af spi: rspi: Only enable interrupts when there's a need to wait
rspi_wait_for_interrupt() unconditionally enables interrupts, even when the
wait condition is already satisfied. This causes a high interrupt load (2
interrupts/byte for full-duplex Single SPI transfers, 1 interrupt/byte for
RSPI with TX Only mode, or QSPI in unidirectional Dual or Quad Transfer
mode).

Change this to return immediately when the wait condition is satisfied.
This dramatically reduces the interrupt load, especially in high-speed
Quad Transfer mode, and increases transfer speed, as no interrupts need to
be handled when there's space available in the output FIFO, or data
available in the input FIFO.

Benchmark results for QSPI on r8a7791 while reading 1 MiB from 30 MHz SPI
FLASH on the Koelsch development board:

Before:
                        Single SPI      Dual SPI        Quad SPI
    Interrupts:         2096856         1048592         1048594
    Mbps:               0.9             1.6             1.6

After:

                        Single SPI      Dual SPI        Quad SPI
    Interrupts:         1048569         21295           8
    Mbps:               0.7             10.8            12.9

I don't know why Single SPI slowed down a bit.

I've also verified functionality for RSPI-RZ on r7s72100, but don't have
benchmark results as there's no SPI FLASH connected to RSPI on the Genmai
development board. Unlike RSPI and QSPI, RSPI-RZ has separate interrupts
for RX and TX, which shows that Single SPI transfers now generate (mostly)
RX interrupts, as expected.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-04 11:11:46 +00:00
Stefan Sørensen faee9b05f6 spi: omap2-mcspi: Support divide-by-n clock dividers
Currently a divide-by-2^n clock is used, causing a very coarse
clock selection, i.e. a 10MHz device will need to use a 6MHz
clock. The McSPI can also use a divide-by-n clock, this patch
adds support for selecting that when possible.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 18:25:48 +00:00
Stefan Sørensen 2bd16e3e23 spi: omap2-mcspi: Do not configure the controller on each transfer unless needed
spi_transfer->speed_hz and spi_transfer->bits_per_word used to only be set when
not using the default settings but are not set on every transfer, causing
omap2_mcspi_setup_transfer to be called on each transfer. This patch changes
the check to only call omap2_mcspi_setup_transfer if the settings needs to be
changed.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 18:25:48 +00:00
Alexander Shiyan 3e9ea4b4d5 spi: clps711x: Use SPI-core "cs_gpios" property for storing GPIOs
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 18:24:45 +00:00
Alexander Shiyan 8dda9d9a48 spi: clps711x: Add support for 1-8 BPW transfers
This patch adds support for 1 to 8 BPW to driver and removes
excess BPW validation since this is already checked by SPI core.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 18:24:45 +00:00
Alexander Shiyan c7a26f121d spi: clps711x: Simplify handling of RX & TX buffers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 18:24:45 +00:00
Shimoda, Yoshihiro 64b67defe4 spi: rspi: fix build error when CONFIG_OF is not set
This patch fixes an issue that the following build error happens when
the CONFIG_OF is not set:

drivers/spi/spi-rspi.c: In function 'rspi_probe':
drivers/spi/spi-rspi.c:1203:26: error: 'rspi_of_match' undeclared (first use in this function)

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 13:14:06 +00:00
Mark Brown 99adef310f spi: Provide core support for DMA mapping transfers
The process of DMA mapping buffers for SPI transfers does not vary between
devices so in order to save duplication of code in drivers this can be
factored out into the core, allowing it to be integrated with the work that
is being done on factoring out the common elements from the data path
including more sharing of dmaengine code.

In order to use this masters need to provide a can_dma() operation and while
the hardware is prepared they should ensure that DMA channels are provided
in tx_dma and rx_dma. The core will then ensure that the buffers are mapped
for DMA prior to calling transfer_one_message().

Currently the cleanup on error is not complete, this needs to be improved.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 13:05:21 +00:00
Mark Brown 16a0ce4e10 spi: Add a timeout when waiting for transfers
Don't wait indefinitely for transfers to complete but time out after 10ms
more than we expect the transfer to take on the wire.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 13:04:45 +00:00
Axel Lin 971e9084be spi: tegra114: Use list_is_last() instead of open-coded
For better readability, and then we can remove the comment for last transfer.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:25:39 +00:00
Axel Lin 8c328a262f spi: sirf: Avoid duplicate code in various bits_per_word cases
Trivial cleanup to avoid duplicate code in various bits_per_word cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:25:12 +00:00
Axel Lin 589f6a90e6 spi: sc18is602: Remove sc18is602_setup() because it is done by spi core
The checking for spi->mode is done in the implementation of spi_setup().
Calling sc18is602_check_transfer(spi, NULL, 0) is pointless because
the code is equivent to checking if spi->max_speed_hz is 0.
Note, sc18is602_check_transfer actually allows spi->max_speed_hz is 0
if t->speed_hz is set. So return error in sc18is602_setup() when
spi->max_speed_hz is 0 does not make sense.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:24:31 +00:00
Mark Brown 3e7dde425d spi/pl022: Unprepare clocks while suspended
When the driver was converted to clk_prepare() the suspend path didn't
have any changes made so the clock remains prepared throughout the runtime
of the driver. Unprepare it when suspended so that any savings that can be
made as a result are made.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-03 12:22:55 +00:00
Axel Lin 0a4e210e99 spi: octeon: Use list_is_last() instead of open-coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:22:18 +00:00
Paul Gortmaker 3a44623d5e spi: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:20:35 +00:00
Baruch Siach 794f61a30e spi: dw-mmio: remove HAVE_CLK build dependecy
Since 93abe8e4 (clk: add non CONFIG_HAVE_CLK routines) code using clk.h
like this platform driver needs not depend on HAVE_CLK.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:19:59 +00:00
Baruch Siach 2418991efb spi: dw-mmio: allow multiple instances
Use the platform_device id to uniquely identify each SPI master instance.

Cc: Jean-Hugues Deschenes <jean-hugues.deschenes@octasic.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:19:59 +00:00
Geert Uytterhoeven 880c6d114f spi: rspi: Add support for Quad and Dual SPI Transfers on QSPI
Add support for Quad and Dual SPI Transfers on the Renesas Quad Serial
Peripheral Interface, as found in R-Car Gen2 SoCs like R-Car H2 (r8a7790)
and R-Car M2 (r8a7791):
  - Add unidirectional transfer methods for Quad/Dual SPI Transfers.
  - Program the sequencer to handle SPI messages with multiple transfer
    modes when Quad or Dual transfers are enabled for an SPI slave.
    Up to 4 transfer modes per SPI message are supported by the hardware.
  - Advertise the availability of Quad and Dual SPI modes on QSPI.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-30 16:51:21 +00:00
Geert Uytterhoeven 426ef76dd8 spi: rspi: Add DT support
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-29 17:56:57 +00:00
Benjamin Herrenschmidt e9a371100d Merge remote-tracking branch 'agust/next' into next
<<
Switch mpc512x to the common clock framework and adapt mpc512x
drivers to use the new clock driver. Old PPC_CLOCK code is
removed entirely since there are no users any more.
>>
2014-01-29 16:53:55 +11:00
Geert Uytterhoeven 1f802f8249 spi: Fix crash with double message finalisation on error handling
This reverts commit e120cc0dcf.

It causes a NULL pointer dereference with drivers using the generic
spi_transfer_one_message(), which always calls
spi_finalize_current_message(), which zeroes master->cur_msg.

Drivers implementing transfer_one_message() theirselves must always call
spi_finalize_current_message(), even if the transfer failed:

 * @transfer_one_message: the subsystem calls the driver to transfer a single
 *      message while queuing transfers that arrive in the meantime. When the
 *      driver is finished with this message, it must call
 *      spi_finalize_current_message() so the subsystem can issue the next
 *      transfer

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-28 17:48:40 +00:00
Geert Uytterhoeven 29f397b739 spi: rspi: Use NULL as the clock ID
There's only one RSPI/QSPI clock, so we can use NULL as the clock ID

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:07:38 +00:00
Geert Uytterhoeven 17fe0d9a28 spi: rspi: Convert to clk_prepare_enable/disable_unprepare
Get the driver ready for the migration to the common clock framework by
calling clk_prepare_enable() and clk_disable_unprepare().

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:07:38 +00:00
Geert Uytterhoeven 06a7a3cff0 spi: rspi: Add support for loopback mode
Add support for specifying loopback mode.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:07:38 +00:00
Geert Uytterhoeven 862d357f84 spi: rspi: Add support for RSPI on RZ/A1H
Add support for the RSPI variant in the RZ/A1H (r7s72100) SoC.

Main differences with RSPI on SH are:
  - Lack of TX only mode, hence we always have to use full duplex
    transfers,
  - The Data Register must be accessed used 8-bit operations.

RSPI on RZ is matched using the new "rspi-rz" platform device name.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:07:07 +00:00
Geert Uytterhoeven 9372220678 spi: rspi: Add support for more than one interrupt
Add support for multiple interrupts, based on the SDK reference code.
This is needed for RZ/A1H, which supports 3 interrupts.

When using multiple interrupts, they must be called "rx" (SPRI) and "tx"
(SPTI). The error interrupt (SPEI) is not used, as it matters for slave
mode only.

When using a single interrupt, it may be called "mux". If it cannot be
found, the first interrupt in the device's resources will be used.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:05:34 +00:00
Geert Uytterhoeven 340a15e6f0 spi: rspi: Merge qspi_send_pio() and qspi_receive_pio()
qspi_send_pio() and qspi_receive_pio() are very similar: they both send
and receive full duplex data to/from the hardware, but ignore the data
stream in the unused direction.
Merge them into qspi_transfer_out_in(), now supporting real full duplex.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:10 +00:00
Geert Uytterhoeven 8449fd76de spi: rspi: Merge rspi_send_pio() and rspi_receive_pio()
rspi_send_pio() and rspi_receive_pio() are very similar:
  - the former only sends data, using TX Only Mode,
  - the latter sends and receives full duplex data to/from the hardware,
    but uses dummy transmit data.
Merge them into rspi_transfer_out_in(), now supporting full duplex if
needed.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:10 +00:00
Geert Uytterhoeven eb557f7526 spi: rspi: Abstract transfer_one() for RSPI and QSPI
Split off qspi_transfer_one() (which doesn't support DMA yet) from
rspi_transfer_one().
Replace the abstraction of send_pio()/receive_pio() by the abstracrion of
transfer_one().

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:09 +00:00
Geert Uytterhoeven 35301c9960 spi: rspi: Add rspi_data_{out,in,out_in}() helpers
Add helpers rspi_data_{out,in,out_in}() to write, read, or write and
read data to/from the Data Register, taking care of waiting until data
or space is available in the buffers.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:09 +00:00
Geert Uytterhoeven 74da76865d spi: rspi: Abstract 8/16-bit Data Register access
Add rspi_{write,read}_data(), to abstract 8-bit (QSPI, and RSPI on RZ/A1H)
versus 16-bit (RSPI) Data Register access.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:09 +00:00
Geert Uytterhoeven 79d2349542 spi: rspi: Use core message handling
Let the generic SPI core handle SPI messages, calling into our
rspi_transfer_one() method.

rspi_assert_ssl() and rspi_negate_ssl() are absorbed into
rspi_prepare_message() and rspi_unprepare_message(), as they actually
enable/disable the whole SPI function, instead of just (de)asserting the
chip select line.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:09 +00:00
Geert Uytterhoeven 91949a2d4a spi: rspi: Remove unused mesg parameter from {send,receive}_pio()
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-27 20:02:09 +00:00
Linus Torvalds 2d2e7d195b spi: Updates for v3.14
A respun version of the merges for the pull request previously sent with
 a few additional fixes.  The last two merges were fixed up by hand since
 the branches have moved on and currently have the prior merge in them.
 
 Quite a busy release for the SPI subsystem, mostly in cleanups big and
 small scattered through the stack rather than anything else:
 
  - New driver for the Broadcom BC63xx HSSPI controller.
  - Fix duplicate device registration for ACPI.
  - Conversion of s3c64xx to DMAEngine (this pulls in platform and DMA
    changes upon which the transiton depends).
  - Some small optimisations to reduce the amount of time we hold locks
    in the datapath, eliminate some redundant checks and the size of a
    spi_transfer.
  - Lots of fixes, cleanups and general enhancements to drivers,
    especially the rspi and Atmel drivers.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJS4RZvAAoJELSic+t+oim9XKAP/00WcCARVzqWmzZYhW2nCqVw
 zRu/DEC+RFlvUSOrwx5SojZNCJekKrsbJuzvapXKIj+SL5+wDm2gUo188s+J8e5V
 mXA9CGb2+tQUgzuQzKZ82kf5WT1a/VpgdVqxZ2EGBHqdJwMV6cG20YneTd9/A0ar
 QbD9Ikon07cE6j8sp/HKxzSnER+3ii4OTJPJCXkNPHiDE9xkA/FR4qy/DksC2hpy
 y6IHCNGA3yHB/8bC7hxUKabOBwPpvQlGELTLHKTVy4umoAE0/aYSjwMdE67SbqXg
 mxDLcDjacNb4ga9hfWiYdZOKRdYiljt1zXksKHldp+R654YFTSVGmYipMoc0l52b
 jyycLM9ZjQ8Q74ySY+BIdZ4RDKFg4QajDhd/sIJtI354HLdoJCQa82j3luj6/Ewu
 JSlI4EGZUjOWPZb72kkrwj0LFBT5k639fMmLPDCLLlg5sUvx2afFl96s9Z25mFGj
 JzgwhjBIcF8AmllLTEpS6cP8MOBeThJ79gTxmbH60tsWxil2yCS4etg+h6GFo7g9
 GBXL9UF63Q6t9Mg8/0oACDs/YyMMbFImi6p20B+Pr0QZiltiTSSc4Z7eo4gG4UYh
 m4svqZcMG8w6csMAMb6I6a9+EojERPt53bZayasnnX/e5HsXJah4qop9Pjrma4ed
 PQHMx8ivWztwyqqjoYTz
 =CbUw
 -----END PGP SIGNATURE-----

Merge tag 'spi-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi updates from Mark Brown:
 "A respun version of the merges for the pull request previously sent
  with a few additional fixes.  The last two merges were fixed up by
  hand since the branches have moved on and currently have the prior
  merge in them.

  Quite a busy release for the SPI subsystem, mostly in cleanups big and
  small scattered through the stack rather than anything else:

   - New driver for the Broadcom BC63xx HSSPI controller
   - Fix duplicate device registration for ACPI
   - Conversion of s3c64xx to DMAEngine (this pulls in platform and DMA
     changes upon which the transiton depends)
   - Some small optimisations to reduce the amount of time we hold locks
     in the datapath, eliminate some redundant checks and the size of a
     spi_transfer
   - Lots of fixes, cleanups and general enhancements to drivers,
     especially the rspi and Atmel drivers"

* tag 'spi-v3.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (112 commits)
  spi: core: Fix transfer failure when master->transfer_one returns positive value
  spi: Correct set_cs() documentation
  spi: Clarify transfer_one() w.r.t. spi_finalize_current_transfer()
  spi: Spelling s/finised/finished/
  spi: sc18is602: Convert to use bits_per_word_mask
  spi: Remove duplicate code to set default bits_per_word setting
  spi/pxa2xx: fix compilation warning when !CONFIG_PM_SLEEP
  spi: clps711x: Add MODULE_ALIAS to support module auto-loading
  spi: rspi: Add missing clk_disable() calls in error and cleanup paths
  spi: rspi: Spelling s/transmition/transmission/
  spi: rspi: Add support for specifying CPHA/CPOL
  spi/pxa2xx: initialize DMA channels to -1 to prevent inadvertent match
  spi: rspi: Add more QSPI register documentation
  spi: rspi: Add more RSPI register documentation
  spi: rspi: Remove dependency on DMAE for SHMOBILE
  spi/s3c64xx: Correct indentation
  spi: sh: Use spi_sh_clear_bit() instead of open-coded
  spi: bitbang: Grammar s/make to make/to make/
  spi: sh-hspi: Spelling s/recive/receive/
  spi: core: Improve tx/rx_nbits check comments
  ...
2014-01-25 13:20:36 -08:00
Linus Torvalds 09da8dfa98 ACPI and power management updates for 3.14-rc1
- ACPI core changes to make it create a struct acpi_device object for every
    device represented in the ACPI tables during all namespace scans regardless
    of the current status of that device.  In accordance with this, ACPI hotplug
    operations will not delete those objects, unless the underlying ACPI tables
    go away.
 
  - On top of the above, new sysfs attribute for ACPI device objects allowing
    user space to check device status by triggering the execution of _STA for
    its ACPI object.  From Srinivas Pandruvada.
 
  - ACPI core hotplug changes reducing code duplication, integrating the
    PCI root hotplug with the core and reworking container hotplug.
 
  - ACPI core simplifications making it use ACPI_COMPANION() in the code
    "glueing" ACPI device objects to "physical" devices.
 
  - ACPICA update to upstream version 20131218.  This adds support for the
    DBG2 and PCCT tables to ACPICA, fixes some bugs and improves debug
    facilities.  From Bob Moore, Lv Zheng and Betty Dall.
 
  - Init code change to carry out the early ACPI initialization earlier.
    That should allow us to use ACPI during the timekeeping initialization
    and possibly to simplify the EFI initialization too.  From Chun-Yi Lee.
 
  - Clenups of the inclusions of ACPI headers in many places all over from
    Lv Zheng and Rashika Kheria (work in progress).
 
  - New helper for ACPI _DSM execution and rework of the code in drivers
    that uses _DSM to execute it via the new helper.  From Jiang Liu.
 
  - New Win8 OSI blacklist entries from Takashi Iwai.
 
  - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun Guo,
    Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava, Rashika Kheria,
    Tang Chen, Zhang Rui.
 
  - intel_pstate driver updates, including proper Baytrail support, from
    Dirk Brandewie and intel_pstate documentation from Ramkumar Ramachandra.
 
  - Generic CPU boost ("turbo") support for cpufreq from Lukasz Majewski.
 
  - powernow-k6 cpufreq driver fixes from Mikulas Patocka.
 
  - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark Brown.
 
  - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John Tobias,
    Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh Kumar.
 
  - cpuidle cleanups from Bartlomiej Zolnierkiewicz.
 
  - Support for hibernation APM events from Bin Shi.
 
  - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC disabled
    during thaw transitions from Bjørn Mork.
 
  - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf Hansson.
 
  - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente Kurusa,
    Rashika Kheria.
 
  - New tool for profiling system suspend from Todd E Brandt and a cpupower
    tool cleanup from One Thousand Gnomes.
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJS3a1eAAoJEILEb/54YlRxnTgP/iGawvgjKWm6Qqp7WSIvd5gQ
 zZ6q75C6Pc/W2fq1+OzVGnpCF8WYFy+nFDAXOvUHjIXuoxSwFcuW5l4aMckgl/0a
 TXEWe9MJrCHHRfDApfFacCJ44U02bjJAD5vTyL/hKA+IHeinq4WCSojryYC+8jU0
 cBrUIV0aNH8r5JR2WJNAyv/U29rXsDUOu0I4qTqZ4YaZT6AignMjtLXn1e9AH1Pn
 DPZphTIo/HMnb+kgBOjt4snMk+ahVO9eCOxh/hH8ecnWExw9WynXoU5Nsna0tSZs
 ssyHC7BYexD3oYsG8D52cFUpp4FCsJ0nFQNa2kw0LY+0FBNay43LySisKYHZPXEs
 2WpESDv+/t7yhtnrvM+TtA7aBheKm2XMWGFSu/aERLE17jIidOkXKH5Y7ryYLNf/
 uyRKxNS0NcZWZ0G+/wuY02jQYNkfYz3k/nTr8BAUItRBjdporGIRNEnR9gPzgCUC
 uQhjXWMPulqubr8xbyefPWHTEzU2nvbXwTUWGjrBxSy8zkyy5arfqizUj+VG6afT
 NsboANoMHa9b+xdzigSFdA3nbVK6xBjtU6Ywntk9TIpODKF5NgfARx0H+oSH+Zrj
 32bMzgZtHw/lAbYsnQ9OnTY6AEWQYt6NMuVbTiLXrMHhM3nWwfg/XoN4nZqs6jPo
 IYvE6WhQZU6L6fptGHFC
 =dRf6
 -----END PGP SIGNATURE-----

Merge tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI and power management updates from Rafael Wysocki:
 "As far as the number of commits goes, the top spot belongs to ACPI
  this time with cpufreq in the second position and a handful of PM
  core, PNP and cpuidle updates.  They are fixes and cleanups mostly, as
  usual, with a couple of new features in the mix.

  The most visible change is probably that we will create struct
  acpi_device objects (visible in sysfs) for all devices represented in
  the ACPI tables regardless of their status and there will be a new
  sysfs attribute under those objects allowing user space to check that
  status via _STA.

  Consequently, ACPI device eject or generally hot-removal will not
  delete those objects, unless the table containing the corresponding
  namespace nodes is unloaded, which is extremely rare.  Also ACPI
  container hotplug will be handled quite a bit differently and cpufreq
  will support CPU boost ("turbo") generically and not only in the
  acpi-cpufreq driver.

  Specifics:

   - ACPI core changes to make it create a struct acpi_device object for
     every device represented in the ACPI tables during all namespace
     scans regardless of the current status of that device.  In
     accordance with this, ACPI hotplug operations will not delete those
     objects, unless the underlying ACPI tables go away.

   - On top of the above, new sysfs attribute for ACPI device objects
     allowing user space to check device status by triggering the
     execution of _STA for its ACPI object.  From Srinivas Pandruvada.

   - ACPI core hotplug changes reducing code duplication, integrating
     the PCI root hotplug with the core and reworking container hotplug.

   - ACPI core simplifications making it use ACPI_COMPANION() in the
     code "glueing" ACPI device objects to "physical" devices.

   - ACPICA update to upstream version 20131218.  This adds support for
     the DBG2 and PCCT tables to ACPICA, fixes some bugs and improves
     debug facilities.  From Bob Moore, Lv Zheng and Betty Dall.

   - Init code change to carry out the early ACPI initialization
     earlier.  That should allow us to use ACPI during the timekeeping
     initialization and possibly to simplify the EFI initialization too.
     From Chun-Yi Lee.

   - Clenups of the inclusions of ACPI headers in many places all over
     from Lv Zheng and Rashika Kheria (work in progress).

   - New helper for ACPI _DSM execution and rework of the code in
     drivers that uses _DSM to execute it via the new helper.  From
     Jiang Liu.

   - New Win8 OSI blacklist entries from Takashi Iwai.

   - Assorted ACPI fixes and cleanups from Al Stone, Emil Goode, Hanjun
     Guo, Lan Tianyu, Masanari Iida, Oliver Neukum, Prarit Bhargava,
     Rashika Kheria, Tang Chen, Zhang Rui.

   - intel_pstate driver updates, including proper Baytrail support,
     from Dirk Brandewie and intel_pstate documentation from Ramkumar
     Ramachandra.

   - Generic CPU boost ("turbo") support for cpufreq from Lukasz
     Majewski.

   - powernow-k6 cpufreq driver fixes from Mikulas Patocka.

   - cpufreq core fixes and cleanups from Viresh Kumar, Jane Li, Mark
     Brown.

   - Assorted cpufreq drivers fixes and cleanups from Anson Huang, John
     Tobias, Paul Bolle, Paul Walmsley, Sachin Kamat, Shawn Guo, Viresh
     Kumar.

   - cpuidle cleanups from Bartlomiej Zolnierkiewicz.

   - Support for hibernation APM events from Bin Shi.

   - Hibernation fix to avoid bringing up nonboot CPUs with ACPI EC
     disabled during thaw transitions from Bjørn Mork.

   - PM core fixes and cleanups from Ben Dooks, Leonardo Potenza, Ulf
     Hansson.

   - PNP subsystem fixes and cleanups from Dmitry Torokhov, Levente
     Kurusa, Rashika Kheria.

   - New tool for profiling system suspend from Todd E Brandt and a
     cpupower tool cleanup from One Thousand Gnomes"

* tag 'pm+acpi-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (153 commits)
  thermal: exynos: boost: Automatic enable/disable of BOOST feature (at Exynos4412)
  cpufreq: exynos4x12: Change L0 driver data to CPUFREQ_BOOST_FREQ
  Documentation: cpufreq / boost: Update BOOST documentation
  cpufreq: exynos: Extend Exynos cpufreq driver to support boost
  cpufreq / boost: Kconfig: Support for software-managed BOOST
  acpi-cpufreq: Adjust the code to use the common boost attribute
  cpufreq: Add boost frequency support in core
  intel_pstate: Add trace point to report internal state.
  cpufreq: introduce cpufreq_generic_get() routine
  ARM: SA1100: Create dummy clk_get_rate() to avoid build failures
  cpufreq: stats: create sysfs entries when cpufreq_stats is a module
  cpufreq: stats: free table and remove sysfs entry in a single routine
  cpufreq: stats: remove hotplug notifiers
  cpufreq: stats: handle cpufreq_unregister_driver() and suspend/resume properly
  cpufreq: speedstep: remove unused speedstep_get_state
  platform: introduce OF style 'modalias' support for platform bus
  PM / tools: new tool for suspend/resume performance optimization
  ACPI: fix module autoloading for ACPI enumerated devices
  ACPI: add module autoloading support for ACPI enumerated devices
  ACPI: fix create_modalias() return value handling
  ...
2014-01-24 15:51:02 -08:00
Linus Torvalds f2c73464d7 ARM: SoC cleanups for 3.14
This is the branch where we usually queue up cleanup efforts, moving
 drivers out of the architecture directory, header file restructuring,
 etc. Sometimes they tangle with new development so it's hard to keep it
 strictly to cleanups.
 
 Some of the things included in this branch are:
 
 * Atmel SAMA5 conversion to common clock
 * Reset framework conversion for tegra platforms
  - Some of this depends on tegra clock driver reworks that are shared with Mike
    Turquette's clk tree.
 * Tegra DMA refactoring, which are shared branches with the DMA tree.
 * Removal of some header files on exynos to prepare for multiplatform
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJS4Vf7AAoJEIwa5zzehBx3f9UP/jwMlbfbSZHfNQ/QG0SqZ9RD
 zvddyDMHY/qXnzgF3Dax+JR9BDDVy8AlQe713FCoiHJZggWRAbbavkx8gxITDrZQ
 6NYaEkkuVxqyM8APl3PwMqYm8UZ8MUf4lCltlOA4jkesY9vue91AFnfyKh2CvHrn
 Leg4XT6mFzf/vYDL6RbvTz/Qr253uv3KvYBxkeiRNa0Y7OXRemEXSOfgxh0YGxUl
 LZ2IWQFOh/DH4kaeQI8V4G67X3ceHiFyhCnl0CPwfxaZaNBVaxvIFgIUTdetS6Sb
 zcXa029tE/Dfsr55vZAv9LUHEipCSOeE5rn2EJWehTWyM7vJ42Eozqgh+zfCjXS7
 Ib6g2npsvIluQit/RdITu44h5yZlrQsLgKTGJ8jjXqbT4HQ/746W8b/TP0YLtbw7
 N8oqr7k4vsZyF0dAYZQtfQUZeGISz67UbFcdzl9tmYOR7HFuAYkAQYst77zkVJf8
 om59BAYYTG5FNjQ4I9AKUfJzxXYveI6AKpXSCCZiahpFM2D1CJIzp9Wi0GwK1HRR
 sFVWhS0dajvz63pVVC2tw5Sq4J7onRRNGIXFPoE5fkmlelm0/q0zzGjw3Z0nTqbZ
 8zxuwuy2FfPJK11GbUAIhAgn1sCLYyAhl6IE+FsanGeMOSGIMrH0v5/HphAxoCXt
 BvqMDogyLoGPce1Gm3pJ
 =3CcT
 -----END PGP SIGNATURE-----

Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC cleanups from Olof Johansson:
 "This is the branch where we usually queue up cleanup efforts, moving
  drivers out of the architecture directory, header file restructuring,
  etc.  Sometimes they tangle with new development so it's hard to keep
  it strictly to cleanups.

  Some of the things included in this branch are:

   * Atmel SAMA5 conversion to common clock
   * Reset framework conversion for tegra platforms
    - Some of this depends on tegra clock driver reworks that are shared
      with Mike Turquette's clk tree.
   * Tegra DMA refactoring, which are shared branches with the DMA tree.
   * Removal of some header files on exynos to prepare for
     multiplatform"

* tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits)
  ARM: mvebu: move Armada 370/XP specific definitions to armada-370-xp.h
  ARM: mvebu: remove prototypes of non-existing functions from common.h
  ARM: mvebu: move ARMADA_XP_MAX_CPUS to armada-370-xp.h
  serial: sh-sci: Rework baud rate calculation
  serial: sh-sci: Compute overrun_bit without using baud rate algo
  serial: sh-sci: Remove unused GPIO request code
  serial: sh-sci: Move overrun_bit and error_mask fields out of pdata
  serial: sh-sci: Support resources passed through platform resources
  serial: sh-sci: Don't check IRQ in verify port operation
  serial: sh-sci: Set the UPF_FIXED_PORT flag
  serial: sh-sci: Remove duplicate interrupt check in verify port op
  serial: sh-sci: Simplify baud rate calculation algorithms
  serial: sh-sci: Remove baud rate calculation algorithm 5
  serial: sh-sci: Sort headers alphabetically
  ARM: EXYNOS: Kill exynos_pm_late_initcall()
  ARM: EXYNOS: Consolidate selection of PM_GENERIC_DOMAINS for Exynos4
  ARM: at91: switch Calao QIL-A9260 board to DT
  clk: at91: fix pmc_clk_ids data type attriubte
  PM / devfreq: use inclusion <mach/map.h> instead of <plat/map-s5p.h>
  ARM: EXYNOS: remove <mach/regs-clock.h> for exynos
  ...
2014-01-23 18:36:55 -08:00
Mark Brown 8b8b773e6b Merge commit 'spi/topic/sc18is602' into spi-linus 2014-01-23 13:14:15 +00:00
Mark Brown 341e6df6c8 Merge commit 'spi/fix/rcar' into spi-linus 2014-01-23 13:13:30 +00:00
Mark Brown 8aeab58e56 Merge remote-tracking branches 'spi/topic/pxa2xx', 'spi/topic/qspi', 'spi/topic/s3c24xx', 'spi/topic/s3c64xx', 'spi/topic/sh', 'spi/topic/tegra114', 'spi/topic/tegra20-sflash', 'spi/topic/tegra20-slink', 'spi/topic/txx9' and 'spi/topic/xcomm' into spi-linus 2014-01-23 13:07:14 +00:00
Mark Brown 907e26b6f5 Merge remote-tracking branches 'spi/topic/fsl-espi', 'spi/topic/gpio', 'spi/topic/hspi', 'spi/topic/mpc512x', 'spi/topic/msiof', 'spi/topic/nuc900', 'spi/topic/oc-tiny', 'spi/topic/omap', 'spi/topic/orion' and 'spi/topic/pci' into spi-linus 2014-01-23 13:07:09 +00:00
Mark Brown 36e66bf84f Merge remote-tracking branches 'spi/topic/bcm2835', 'spi/topic/bcm63xx', 'spi/topic/bcm63xx-hsspi', 'spi/topic/bitbang', 'spi/topic/bpw', 'spi/topic/clps711x', 'spi/topic/coldfire', 'spi/topic/davinci', 'spi/topic/dw' and 'spi/topic/falcon' into spi-linus 2014-01-23 13:07:05 +00:00
Mark Brown 1504d226f7 Merge remote-tracking branches 'spi/fix/bcm63xx', 'spi/fix/dspi', 'spi/fix/hspi', 'spi/fix/imx', 'spi/fix/msiof', 'spi/fix/pxa2xx', 'spi/fix/qspi', 'spi/topic/altera', 'spi/topic/ath79' and 'spi/topic/atmel' into spi-linus 2014-01-23 13:07:01 +00:00
Mark Brown 3c1039745e Merge remote-tracking branch 'spi/topic/core' into spi-linus 2014-01-23 13:07:01 +00:00
Mark Brown 7e2c225d58 Merge remote-tracking branch 'spi/fix/core' into spi-linus 2014-01-23 13:07:00 +00:00
Axel Lin 13a4279880 spi: core: Fix transfer failure when master->transfer_one returns positive value
master->transfer_one returns positive value is not a error.
So set ret to 0 when master->transfer_one returns positive value.
Otherwise, I hit "spi_master spi0: failed to transfer one message from queue"
error when my transfer_one callback returns 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-21 18:45:34 +00:00
Geert Uytterhoeven 9e8f4882cc spi: Spelling s/finised/finished/
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-21 18:11:45 +00:00
Axel Lin 463654cec2 spi: sc18is602: Convert to use bits_per_word_mask
Since commit 543bb25 "spi: add ability to validate xfer->bits_per_word in SPI
core", the driver can set bits_per_word_mask for the master then the SPI core
will reject transfers that attempt to use an unsupported bits_per_word value.
So we can remove the bits_per_word checking in sc18is602_check_transfer() and
let SPI core handle the checking.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-17 15:55:54 +00:00
Axel Lin 23061f1eb8 spi: Remove duplicate code to set default bits_per_word setting
The implementation in spi_setup() already set spi->bits_per_word = 8 when
spi->bits_per_word is 0 before calling spi->master->setup.
So we don't need to do it again in setup() callback.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-17 15:54:22 +00:00
Mark Brown 81e53d0470 Merge branches 'topic/sc18is602' and 'topic/rspi' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-bpw 2014-01-17 15:52:17 +00:00
Zhang Rui 8c4ff6d009 ACPI: fix module autoloading for ACPI enumerated devices
ACPI enumerated devices has ACPI style _HID and _CID strings,
all of these strings can be used for both driver loading and matching.

Currently, in Platform, I2C and SPI bus, the ACPI style driver matching
is supported by invoking acpi_driver_match_device() in bus .match() callback.
But, the module autoloading is still broken.

For example, there is any ACPI device with _HID "INTABCD" that is
enumerated to platform bus, and we have a driver that can probe it.

The driver exports its module_alias as "acpi:INTABCD" use the following code
static const struct acpi_device_id xxx_acpi_match[] = {
        { "INTABCD", 0 },
        { }
};
MODULE_DEVICE_TABLE(acpi, xxx_acpi_match);

But, unfortunately, the device' modalias is shown as "platform:INTABCD:00",
please refer to modalias_show() and platform_uevent() in
drivers/base/platform.c.
This results in that the driver will not be loaded automatically when the
device node is created, because their modalias do not match.

This also applies to I2C and SPI bus.

With this patch, the device' modalias will be shown as "acpi:INTABCD" as well.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-01-16 23:13:10 +01:00
Mika Westerberg 382cebb02a spi/pxa2xx: fix compilation warning when !CONFIG_PM_SLEEP
CONFIG_PM will be set if either or both CONFIG_PM_SLEEP and
CONFIG_PM_RUNTIME is set. Compiling the driver with !CONFIG_PM_SLEEP causes
following compilation warning:

drivers/spi/spi-pxa2xx.c:1270:12: warning: ‘pxa2xx_spi_suspend’ defined but not used [-Wunused-function]

Fix this by using CONFIG_PM_SLEEP instead.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-16 14:07:48 +00:00
Axel Lin 350a9b3304 spi: clps711x: Add MODULE_ALIAS to support module auto-loading
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14 14:21:43 +00:00
Geert Uytterhoeven fcb4ed749c spi: rspi: Add missing clk_disable() calls in error and cleanup paths
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14 14:14:54 +00:00
Mark Brown 13ea330010 Merge branch 'topic/rcar' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-rspi 2014-01-14 14:14:47 +00:00
Geert Uytterhoeven b7ed6b88b2 spi: rspi: Spelling s/transmition/transmission/
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-14 14:02:11 +00:00
Geert Uytterhoeven 348e5153bc spi: rspi: Add support for specifying CPHA/CPOL
Add support for specifying the SPI clock phase and polarity, based on the
SDK reference code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 17:24:04 +00:00
Mika Westerberg 483c319188 spi/pxa2xx: initialize DMA channels to -1 to prevent inadvertent match
Commit cddb339bad (spi/pxa2xx: convert to dma_request_slave_channel_compat())
converted the driver to use ACPI provided DMA helpers but it forgot to
initialize the platform data for the channels to -1. Failing to do so will
result inadvertent match in the filter function because 0 is a valid
channel number.

Prevent this from happening by initializing both platform data channels
correctly to -1.

Fixes: cddb339bad (spi/pxa2xx: convert to dma_request_slave_channel_compat())
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2014-01-13 12:39:19 +00:00
Geert Uytterhoeven fbe5072bbe spi: rspi: Add more QSPI register documentation
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 12:10:01 +00:00
Geert Uytterhoeven 6ab4865b7e spi: rspi: Add more RSPI register documentation
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 12:10:01 +00:00
Geert Uytterhoeven e2e5ed79fe spi: rspi: Remove dependency on DMAE for SHMOBILE
On ARM-based SHMOBILE, the rspi driver builds and works fine without the
DMA controller driver, hence relax the dependencies.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:53:44 +00:00
Geert Uytterhoeven 3e83c19497 spi/s3c64xx: Correct indentation
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:30:41 +00:00
Axel Lin 909e709c77 spi: sh: Use spi_sh_clear_bit() instead of open-coded
We have a spi_sh_clear_bit() function, there's no reason not to use it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:26:28 +00:00
Geert Uytterhoeven f21524f5bc spi: bitbang: Grammar s/make to make/to make/
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:24:21 +00:00
Geert Uytterhoeven c6c07b4f6d spi: sh-hspi: Spelling s/recive/receive/
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:21:45 +00:00
Geert Uytterhoeven 1afd9989a6 spi: core: Improve tx/rx_nbits check comments
- Rephrase the comments about tx/rx_nbits validity checks,
  - Remove the stale comment about SPI_3WIRE (the code it refers to was
    removed in commit 368ca4e0c7 ("spi:
    Eliminate 3WIRE spi_transfer check")).

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:20:46 +00:00
Axel Lin 5a33d30ff1 spi: ti-qspi: Fixup driver name
The driver name in current code looks like a compatible string which is not
the naming convention for platform drivers.
Fix it and also add modalias since this driver can be built as a module.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 10:16:16 +00:00
Axel Lin 3ab5462054 spi: ti-qspi: Simplify qspi_write_msg and qspi_read_msg implementation
Make the unit of wlen to be byte, and simplify the code to avoid duplicate
code for different wlen cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 10:15:13 +00:00
Axel Lin 646d79b2d7 spi: altera: Remove unneeded NULL checking for hw->bitbang.master
We already has NULL test for master after calling spi_alloc_master().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 10:12:45 +00:00
Gerhard Sittig dff148ad7b spi: mpc512x: adjust to OF based clock lookup
after device tree based clock lookup became available, the peripheral
driver need no longer construct clock names which include the PSC index,
remove the "psc%d_mclk" template and unconditionally use 'mclk'

acquire and release the 'ipg' clock item for register access as well

Cc: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
Signed-off-by: Gerhard Sittig <gsi@denx.de>
Acked-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2014-01-12 18:53:04 +01:00
Alexander Shiyan 989847967c spi: clps711x: Use devm_gpio_request()
This patch replaces gpio_request() with devm_ API.
As a result this simplifies error path and eliminates "remove"
function.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-10 13:27:24 +00:00
Axel Lin e826a7ff69 spi: oc-tiny: Simplify tiny_spi_txrx_bufs implementation when irq is not used
Currently we have similar code for (txp && rxp), (txp && !rxp), (!rxp & txp),
and (!txp && !rxp) cases. This patch refactors the code a bit to avoid
duplicate similar code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 17:58:28 +00:00
Wenyou Yang 8090d6d1a4 spi: atmel: Refactor spi-atmel to use SPI framework queue
Replace the deprecated master->transfer with transfer_one_message()
and allow the SPI subsystem handle all the queuing of messages.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Tested-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 17:41:23 +00:00
Axel Lin e07725be73 spi: fsl-dspi: Add missing breaks for switch cases
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 17:29:26 +00:00
Sekhar Nori dd5c1f936a spi/davinci: Don't select EDMA
There is no need to force selection of TI EDMA DMA engine
driver when DaVinci SPI driver is selected. The driver
builds just fine even with CONFIG_TI_EDMA disabled.

Forcing this selection causes warnings of the sort:

warning: (ARCH_KEYSTONE && SPI_DAVINCI) selects TI_EDMA which has unmet direct dependencies (DMADEVICES && (ARCH_DAVINCI || ARCH_OMAP || ARCH_KEYSTONE))

This reverts commit b5f1433059.

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 14:07:53 +00:00
Mika Westerberg b6fb8d3a1f spi: Check conflicting CS based on spi->chip_select instead of device name
Commit e13ac47bec (spi: Use stable dev_name for ACPI enumerated SPI
slaves) changed the SPI device naming to be based on ACPI device name
instead of carrying bus number and chip select for devices enumerated
from ACPI namespace.

In case of a buggy BIOS that lists multiple SPI devices sharing the same
chip select (even though they should use different) the current code fails
to detect that and allows the devices to be added to the bus.

Fix this by walking through the bus and comparing spi->chip_select instead
of device name. This should work regardless what the device name will be in
future.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 14:07:08 +00:00
Axel Lin a89e2d2754 spi: core: Use list_first_entry to extract head of queue
For slightly better readability.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-09 13:54:07 +00:00
Sachin Kamat 85a9012446 spi: s3c24xx: Remove reference to plat/fiq.h
fiq.h contains only a function declaration and is not used by anyone
else. Move the declaration to the driver header file and remove the
unnecessary platform dependency from the driver.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08 13:06:21 +00:00
Richard Genoud d3b72c7e6b spi: atmel: add support for changing message transfer speed
The only speed available was max_speed (the maximum speed declared for a
device).
This patch adds the support for spi_tranfer->speed_hz parameter.
We can now set a different speed for each spi message.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08 13:00:24 +00:00
Axel Lin caedb997a4 spi: sh-hspi: Fix modalias for sh-hspi
Make the modalias matches the driver name.
Seems the MODULE_ALIAS is copied from drivers/spi/spi-sh-spi.c.
So both spi-sh.ko and spi-sh-hspi.ko have the same alias. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-08 12:14:22 +00:00
Wei Yongjun 136c8bf374 spi: dw-pci: remove free for resources allocated with devm_*
It's not necessary to free resources allocated with devm_*
and free them may lead to double free.

Fixes: 04f421e7b0 ('spi: dw: use managed resources')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 15:47:18 +00:00
Axel Lin e3d8bee385 spi: ti-qspi: Fix getting correct address for qspi
Now platform_get_drvdata() returns the address of qspi rather than master.
Also drop unneeded spi_unregister_master() call in ti_qspi_remove() because
we use devm_spi_register_master() in probe.

commit cbcabb7a30 "spi/qspi: Fix qspi remove path" assumes
platform_get_drvdata() returns address of master. However,
commit 160a061301 "spi/qspi: set correct platform drvdata in ti_qspi_probe()"
pass qspi to platform_set_drvdata().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-07 11:38:00 +00:00
Daniel Santos e120cc0dcf spidev: fix hang when transfer_one_message fails
This corrects a problem in spi_pump_messages() that leads to an spi
message hanging forever when a call to transfer_one_message() fails.
This failure occurs in my MCP2210 driver when the cs_change bit is set
on the last transfer in a message, an operation which the hardware does
not support.

Rationale
Since the transfer_one_message() returns an int, we must presume that it
may fail.  If transfer_one_message() should never fail, it should return
void.  Thus, calls to transfer_one_message() should properly manage a
failure.

Fixes: ffbbdd2132 (spi: create a message queueing infrastructure)
Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2014-01-06 12:54:39 +00:00
Baruch Siach fa4934a02a spi: dw-pci: fix typo
Commit 04f421e7b0 (spi: dw: use managed resources) introduced a typo in
struct field reference. Fix it.

Fixes build failure:

drivers/spi/spi-dw-pci.c: In function 'spi_pci_probe':
drivers/spi/spi-dw-pci.c:50:29: error: 'dev' undeclared (first use in this function)
  dwpci = devm_kzalloc(&pdev-dev, sizeof(struct dw_spi_pci), GFP_KERNEL);
                             ^

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-06 12:11:28 +00:00
Mark Brown 2cde51fbd0 Merge remote-tracking branches 'asoc/topic/ad1836', 'asoc/topic/ad193x', 'asoc/topic/adav80x', 'asoc/topic/adsp', 'asoc/topic/ak4641', 'asoc/topic/ak4642', 'asoc/topic/arizona', 'asoc/topic/atmel', 'asoc/topic/au1x', 'asoc/topic/axi', 'asoc/topic/bcm2835', 'asoc/topic/blackfin', 'asoc/topic/cs4271', 'asoc/topic/cs42l52', 'asoc/topic/da7210', 'asoc/topic/davinci', 'asoc/topic/ep93xx', 'asoc/topic/fsl', 'asoc/topic/fsl-mxs', 'asoc/topic/generic', 'asoc/topic/hdmi', 'asoc/topic/jack', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/mxs', 'asoc/topic/omap', 'asoc/topic/pxa', 'asoc/topic/rcar', 'asoc/topic/s6000', 'asoc/topic/sai', 'asoc/topic/samsung', 'asoc/topic/sgtl5000', 'asoc/topic/spear', 'asoc/topic/ssm2518', 'asoc/topic/ssm2602', 'asoc/topic/tegra', 'asoc/topic/tlv320aic3x', 'asoc/topic/twl6040', 'asoc/topic/txx9', 'asoc/topic/uda1380', 'asoc/topic/width', 'asoc/topic/wm8510', 'asoc/topic/wm8523', 'asoc/topic/wm8580', 'asoc/topic/wm8711', 'asoc/topic/wm8728', 'asoc/topic/wm8731', 'asoc/topic/wm8741', 'asoc/topic/wm8750', 'asoc/topic/wm8753', 'asoc/topic/wm8776', 'asoc/topic/wm8804', 'asoc/topic/wm8900', 'asoc/topic/wm8901', 'asoc/topic/wm8940', 'asoc/topic/wm8962', 'asoc/topic/wm8974', 'asoc/topic/wm8985', 'asoc/topic/wm8988', 'asoc/topic/wm8990', 'asoc/topic/wm8991', 'asoc/topic/wm8994', 'asoc/topic/wm8995', 'asoc/topic/wm9081' and 'asoc/topic/x86' into asoc-next 2014-01-02 13:01:55 +00:00
Axel Lin 0abd3e37e6 spi: s3c64xx: Remove duplicate code to clear S3C64XX_SPI_SLAVE_SEL register
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-02 12:23:37 +00:00
Axel Lin 1cfd97f93e spi: core: Use list_first_entry_or_null() instead of open-coded
Use list_first_entry_or_null() to save a few lines.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-02 11:57:26 +00:00
Mark Brown 68066bb378 Linux 3.13-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJSwLfoAAoJEHm+PkMAQRiGi6QH/1U1B7lmHChDTw3jj1lfm9gA
 189Si4QJlnxFWCKHvKEL+pcaVuACU+aMGI8+KyMYK4/JfuWVjjj5fr/SvyHH2/8m
 LdSK8aHMhJ46uBS4WJ/l6v46qQa5e2vn8RKSBAyKm/h4vpt+hd6zJdoFrFai4th7
 k/TAwOAEHI5uzexUChwLlUBRTvbq4U8QUvDu+DeifC8cT63CGaaJ4qVzjOZrx1an
 eP6UXZrKDASZs7RU950i7xnFVDQu4PsjlZi25udsbeiKcZJgPqGgXz5ULf8ZH8RQ
 YCi1JOnTJRGGjyIOyLj7pyB01h7XiSM2+eMQ0S7g54F2s7gCJ58c2UwQX45vRWU=
 =/4/R
 -----END PGP SIGNATURE-----

Merge tag 'v3.13-rc6' into spi-dw

To resolve trivial overlaps with fixes.

Linux 3.13-rc6
2013-12-31 12:59:55 +00:00
Sourav Poddar f17414c4fc spi/qspi: Fix runtime resume path
Due to the following commit
commit 160a061301
Author: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Date:   Mon Nov 11 14:13:41 2013 +0800

    spi/qspi: set correct platform drvdata in ti_qspi_probe()

    The ti_qspi_remove() use the platform drvdata as a type of
    struct ti_qspi, we should pass correct platform drvdata to
    platform_set_drvdata() in ti_qspi_probe().

    Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
    Signed-off-by: Mark Brown <broonie@linaro.org>

platform_set_drvdata was changed in  the probe, so we need to
correspondingly change deferencing of qspi in runtime resume
path. Else, this will lead to a NULL dereference pointer.

Based on v3.13-rc3

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:55:59 +00:00
Baruch Siach 43f627ac9d spi: dw: fix memory leak on error path
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:30:25 +00:00
Baruch Siach 020fe3fe11 spi: dw-mmio: prepare the clock before enabling
This is required for common clock support.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:30:22 +00:00
Baruch Siach 04f421e7b0 spi: dw: use managed resources
Migrate mmio code and core driver to managed resources to reduce boilerplate
error handling code. Also, handle clk_enable() failure while at it, and drop
unused dw_spi iolen field.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-31 12:30:18 +00:00
Mark Brown 68e67d97e1 Linux 3.13-rc6
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJSwLfoAAoJEHm+PkMAQRiGi6QH/1U1B7lmHChDTw3jj1lfm9gA
 189Si4QJlnxFWCKHvKEL+pcaVuACU+aMGI8+KyMYK4/JfuWVjjj5fr/SvyHH2/8m
 LdSK8aHMhJ46uBS4WJ/l6v46qQa5e2vn8RKSBAyKm/h4vpt+hd6zJdoFrFai4th7
 k/TAwOAEHI5uzexUChwLlUBRTvbq4U8QUvDu+DeifC8cT63CGaaJ4qVzjOZrx1an
 eP6UXZrKDASZs7RU950i7xnFVDQu4PsjlZi25udsbeiKcZJgPqGgXz5ULf8ZH8RQ
 YCi1JOnTJRGGjyIOyLj7pyB01h7XiSM2+eMQ0S7g54F2s7gCJ58c2UwQX45vRWU=
 =/4/R
 -----END PGP SIGNATURE-----

Merge tag 'v3.13-rc6' into spi-rcar

To resolve spurious merge conflicts with fixes.

Linux 3.13-rc6
2013-12-30 13:45:00 +00:00
Baruch Siach 0a47d3c404 spi: dw: drop unused struct dw_spi field
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-30 13:18:09 +00:00
Trent Piepho 368ca4e0c7 spi: Eliminate 3WIRE spi_transfer check
Checking for SPI_3WIRE isn't needed.  spi_setup() already prevents 3WIRE
mode from being combined with DUAL or QUAD mode support.  So there is no
need to differentiate between a single bit device with SPI_3WIRE set and
one with without.  It doesn't change the allowed bit widths.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-30 12:44:18 +00:00
Geert Uytterhoeven 97b95c1170 spi: rspi: Use u8 for 8-bit register values
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:19:55 +00:00
Geert Uytterhoeven 2aae80b27d spi: rspi: Use DUMMY_DATA macro instead of hardcoded value
Make it more obvious that this value is dummy data.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:19:55 +00:00
Geert Uytterhoeven baf588f428 spi: rspi: Make more pointers const
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:19:55 +00:00
Geert Uytterhoeven c132f0949a spi: rspi: Remove casts
Remove useless casts, and do not cast away const.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:19:55 +00:00
Geert Uytterhoeven fc671a900b spi: rspi: Use dev_get_platdata() instead of raw dev.platform_data access
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:19:55 +00:00
Geert Uytterhoeven df900e6783 spi: rspi: Fix typo when clearing SPSR_OVRF
The overrun flag should be cleared in the SPI Status Register, not in the
SPI Control Register, based on the SDK sample code.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:12:07 +00:00
Geert Uytterhoeven efd85acb4f spi: rspi: Fix NULL pointer dereference on SH7757
SH7757 doesn't pass platform data, in which case spi-rspi uses default
parameters.

However, commit 5ce0ba8865 ("spi: rcar: add
Renesas QSPI support on RSPI") added a new user of the platform data, but
forgot to check for its validity first, causing a NULL pointer dereference
on SH7757.

Add the missing check to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-24 13:12:04 +00:00
Wei Yongjun fe2ece4a93 spi: nuc900: remove redundant return value check of platform_get_resource()
Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-20 12:34:44 +00:00
Wei Yongjun bdf0290ac7 spi: txx9: drop clk_put for devm_clk_get in txx9spi_probe()
devm_clk_get() is used so there is no reason to explicitly
call clk_put() in txx9spi_probe() functions.

Fixes: 18e34d568e ('spi: txx9: Use devm_clk_get()')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.og>
2013-12-20 12:34:07 +00:00
Wei Yongjun 8f51c81082 spi: spi-s3c24xx: remove redundant return value check of platform_get_resource()
Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-20 11:56:30 +00:00
Marek Vasut 6fd8b8503a spi: spi-imx: Fix out-of-order CS/SCLK operation at low speeds
Problem:
--------
 The problem this patch addresses has the following assumptions about the
 SPI bus setup:
 - The hardware used to find this is Freescale i.MX537 @ 1200MHz
 - The SPI SCLK operate at very low speed, less than 200 kHz
 - There are two SPI devices attached to the bus
   - Each device uses different GPIO for chipselect
   - Each device requires different SCLK signal polarity

 The observation of the SCLK and GPIO chipselect lines with a logic analyzer
 shows, that the SCLK polarity change does sometimes happen after the GPIO
 chipselect is asserted. The SPI slave device reacts on that by counting the
 SCLK polarity change as a clock pulse, which disrupts the communication with
 the SPI slave device.

Explanation:
------------
 We found an interesting correlation, that the maximum delay between the write
 into the ECSPIx_CONFIGREG register and the change of SCLK polarity at each
 SCLK frequency of 10 kHz, 20 kHz, 50 kHz and 100 kHz is 100 uS, 50 uS, 20 uS
 and 10 uS respectively. This lead us to a theory, that at SCLK frequency of
 1 Hz, the delay would be 1 S. Therefore, the time it takes for the write to
 ECSPIx_CONFIGREG to take effect in the hardware is up to the duration of 1
 tick of the SCLK clock.

 During this delay period, if the SCLK frequency is too low, the execution of
 the spi-imx.c driver can advance so much, that the GPIO chipselect will be
 asserted. The GPIO chipselect is asserted almost immediatelly.

Solution:
---------
 The solution this patch presents is simple. We calculate the resulting SCLK
 clock first by dividing the ECSPI block clock by both dividers that are to be
 programmed into the configuration register. Based on the resulting SCLK clock,
 we derive the delay it will take for the changes to get really applied. We are
 extra careful here so we delay twice as long as we should. Note that the patch
 does not create additional overhead at high speeds as the delay will likely be
 close to zero there.

Signed-off-by: Marek Vasut <marex@denx.de>
To: linux-spi@vger.kernel.org
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Huang Shijie <b32955@freescale.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-20 11:53:57 +00:00
Sourav Poddar 6b3938aed0 spi/qspi: parse register by name.
Modify the qspi driver to parse reg information by name.
If "reg names" is not found, then revert back to normal
get resource.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-19 13:33:43 +00:00
Jingoo Han e1d0cd473b spi: mpc512x: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-18 11:28:53 +00:00
Jingoo Han 08bc0544a5 spi: bcm2835: Use devm_request_irq()
Use devm_request_irq() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:58:18 +00:00
Jingoo Han 18e34d568e spi: txx9: Use devm_clk_get()
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:56:24 +00:00
Jingoo Han c9f722e879 spi: s3c24xx: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:54:51 +00:00
Jingoo Han a6f4c8e06b spi: ath79: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:53:36 +00:00
Jingoo Han 5b3bb5963f spi: davinci: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:51:09 +00:00
Jingoo Han 7519459da2 spi: nuc900: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:43:30 +00:00
Wei Yongjun 9637b86fd1 spi: bcm63xx: fix reference leak to master in bcm63xx_spi_remove()
Once a spi_master_get() call succeeds, we need an additional
spi_master_put() call to free the memory, otherwise we will
leak a reference to master. Fix by removing the unnecessary
spi_master_get() call.

Fixes: 247263dba2 ('spi: bcm63xx: use devm_spi_register_master()')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:41:50 +00:00
Jonas Gorski 1bae20285b spi/bcm63xx: fix pm sleep support
Use the correct symbol to guard the callbacks and use appropriate defines
for setting up the ops struct.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:40:19 +00:00
Jonas Gorski ea01e8a4cd spi/bcm63xx: check return value of clk_prepare_enable
Ensure we notice if the clock cannot be enabled for any reason and pass
the error down.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:40:19 +00:00
Jonas Gorski 20e9e78f8b spi/bcm63xx: don't reject reads >= 256 bytes
The rx_tail register is only 8 bit wide, so it will wrap around
after 256 read bytes. This makes it rather meaningless, so drop any
usage of it to not treat reads over 256 as failed.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:40:19 +00:00
Jingoo Han acf4fc6ffa spi: bcm63xx: Use devm_clk_get()
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:35:50 +00:00
Jonas Gorski 86b3bde003 spi/bcm63xx: don't substract prepend length from total length
The spi command must include the full message length including any
prepended writes, else transfers larger than 256 bytes will be
incomplete.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2013-12-17 22:34:55 +00:00
Jonas Gorski 937ebf9cd3 spi/bcm63xx-hsspi: fix pm sleep support
Use the right CONFIG symbol to guard, properly (un)preprare clocks on
suspend/resume, and check the result of it.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:32:17 +00:00
Jonas Gorski 7d25569580 spi/bcm63xx-hsspi: use devm_register_master()
Simplifies the remove call.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:32:17 +00:00
Jonas Gorski dea5de1b37 spi/bcm63xx-hsspi: check result of clk_prepare_enable
Ensure we notice if the clock cannot be enabled for any reason and pass
the error down.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:32:17 +00:00
Jingoo Han b1bdd4f883 spi: bcm63xx-hsspi: Use devm_clk_get()
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-17 22:31:39 +00:00
Dan Carpenter 8a0a1af30c spi: tegra: checking for ERR_PTR instead of NULL
dma_request_slave_channel() returns NULL on error and not ERR_PTRs.
I've fixed this by using dma_request_slave_channel_reason() which does
return ERR_PTRs.

Fixes: a915d150f6 ('spi: tegra: convert to standard DMA DT bindings')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2013-12-16 09:51:58 -07:00
Hou Zhiqiang 714bb654e9 spi/fsl-espi: Add Power Management support for eSPI controller
Add PM support for eSPI controller using callback function suspend
and resume in .driver.pm of platform_driver.

Signed-off-by: Hou Zhiqiang <b48286@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-12 11:50:02 +00:00
Stephen Warren a915d150f6 spi: tegra: convert to standard DMA DT bindings
By using dma_request_slave_channel_or_err(), the DMA slave ID can be
looked up from standard DT properties, and squirrelled away during
channel allocation. Hence, there's no need to use a custom DT property
to store the slave ID.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Mark Brown <broonie@linaro.org>
2013-12-11 16:44:23 -07:00
Stephen Warren ff2251e3de spi: tegra: use reset framework
Tegra's clock driver now provides an implementation of the common
reset API (include/linux/reset.h). Use this instead of the old Tegra-
specific API; that will soon be removed.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Thierry Reding <treding@nvidia.com>
2013-12-11 16:44:17 -07:00
Hou Zhiqiang 7227cd1893 spi/fsl-espi: fix the return value judgment of irq_of_parse_and_map.
Signed-off-by: Hou Zhiqiang <b48286@freescale.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-11 11:06:53 +00:00
Michal Nazarewicz a553a31d9f spi: tegra20-sflash: use u32 for 32-bit register values
Previously used “unsigned long” may lead to confusion should the code
be compiled for 64-bit machine.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 18:14:03 +00:00
Michal Nazarewicz 5fd38677a4 spi: tegra20-slink: use u32 for 32-bit register values
Previously used “unsigned long” may lead to confusion should the code
be compiled for 64-bit machine.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 18:13:28 +00:00
Michal Nazarewicz 48c3fc9380 spi: tegra114: use u32 for 32-bit register values
Previously used “unsigned long” may lead to confusion should the code
be compiled for 64-bit machine.

This commit also removes some unused fields of the tegra_spi_data
structure as well as removes duplicated #defines.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 18:12:54 +00:00
Jingoo Han 9e03d05eee spi: rcar: Use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 17:59:58 +00:00
Jingoo Han bb489841b1 spi: orion: Use devm_clk_get()
Use devm_clk_get() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 17:31:38 +00:00
Dan Carpenter 87917528cc spi: bcm63xx-hsspi: checking for ERR_PTR instead of NULL
devm_request_and_ioremap() returns NULL on error, it doesn't return an
ERR_PTR().  This patch fixes it by switching to devm_ioremap_resource()
which is the prefered function anyway.

Fixes: 142168eba9 ('spi: bcm63xx-hsspi: add bcm63xx HSSPI driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 17:24:21 +00:00
Wei Yongjun f885135ab6 spi: coldfire-qspi: remove redundant return value check of platform_get_resource()
Remove unneeded error handling on the result of a call
to platform_get_resource() when the value is passed to
devm_ioremap_resource().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-09 17:04:56 +00:00
Jonas Gorski 142168eba9 spi: bcm63xx-hsspi: add bcm63xx HSSPI driver
Add a driver for the High Speed SPI controller found on newer BCM63XX SoCs.

It does feature some new modes like 3-wire or dual spi, but neither of it
is currently implemented.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 13:29:13 +00:00
Jingoo Han 999b6e932b spi: falcon: Use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by:  Thomas Langer <thomas.langer@lantiq.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 12:54:52 +00:00
Jingoo Han 15e0964dc2 spi: sc18is602: Use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 12:53:40 +00:00
Jingoo Han 4cc16085c8 spi: xcomm: Use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove unnecessary remove().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 12:52:30 +00:00
Jingoo Han 9a3ced19d8 spi: coldfire-qspi: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 11:59:56 +00:00
Jingoo Han 9f87d6f26b spi: atmel: Use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-04 11:58:41 +00:00
Jingoo Han 9a21e4770a spi: remove DEFINE_PCI_DEVICE_TABLE macro
Don't use DEFINE_PCI_DEVICE_TABLE macro, because this macro
is not preferred.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-03 18:03:26 +00:00
Michal Nazarewicz 84acfd4340 spi: omap-100k: remove pointless _remove function
Commit [8074cf06: use devm_spi_register_master()] removed the last
bit of omap1_spi100k_remove function that had side effects.  After
call to spi_unregister_master was removed, the function consisted
of:

2. call to platform_get_drvdata whose return value was only used in:
2. call to spi_master_get_devdata whose return value was not used,
3. an if statement checking if zero was not zero, and
4. call to platform_get_resource whose return value was not used.

Ah, yes, and of course, final return 0. ;)

Since omap1_spi100k_remove no longer does anything, it can be
safely removed.

Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-02 17:35:54 +00:00
Takashi Yoshii 50a7799829 spi: spi-sh-msiof: set hi/low Active for HW CS
Set hardware CS(CS control function on MSIOF <-> GPIO CS) polarity
according to SPI_CS_HIGH flag on spi->mode.

Signed-off-by: Takashi Yoshii <takasi-y@ops.dti.ne.jp>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-02 12:54:25 +00:00
Takashi Yoshii e4d313ff79 spi: spi-sh-msiof: round up div to fix freq calculation
Truncation on integer division in sh_msiof_spi_set_clk_regs()
results in insufficient transfer frequency (> max_speed_freq).

For example, source 52MHz, required max 6MHz
 52/6 = 8.6 --> 8, then 1/8 table selected,
and result in 52/8 = 6.5 MHz (>6MHz)

Rounding it up is a simple solution.
 52/6 = 8.6 --> 9, then 1/16 table selected,
and result in 52/16 = 3.25 MHz

Signed-off-by: Takashi Yoshii <takasi-y@ops.dti.ne.jp>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-02 12:48:05 +00:00
Mark Brown c18158f1fd Merge remote-tracking branches 'spi/fix/bcm2835', 'spi/fix/bcm63xx', 'spi/fix/mpc512x-psc', 'spi/fix/mxs', 'spi/fix/pxa2xx', 'spi/fix/qspi', 'spi/fix/rspi' and 'spi/fix/txx9' into spi-linus 2013-11-28 11:31:35 +00:00
Mark Brown b8aba7611b Merge remote-tracking branch 'spi/fix/core' into spi-linus 2013-11-28 11:31:35 +00:00
Chew, Chiau Ee c50325f7bc spi/pxa2xx: Restore private register bits.
The Intel LPSS SPI private register bits have to be restored
when system resume from S3 suspend.

Signed-off-by: Chew, Chiau Ee <chiau.ee.chew@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-28 11:23:37 +00:00
Laurent Pinchart 5c32d29f13 spi: sh-msiof: Convert to clk_prepare/unprepare
Get the driver ready for the migration to the common clock framework by
calling clk_prepare() and clk_unprepare(). The calls are added in the
probe and remove handlers as the clk_enable() and clk_disable() calls
are located in atomic context and there's no callback function in
non-atomic context that can be used to prepare/unprepare the clock.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-28 10:26:58 +00:00
Laurent Pinchart b4dd05de3d spi: sh-msiof: Use devm_* managed allocators
This simplifies error and cleanup code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-28 10:26:56 +00:00
Laurent Pinchart 7ad35442fc spi: sh-msiof: Enable driver compilation with COMPILE_TEST
This helps increasing build testing coverage.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 16:34:55 +00:00
Laurent Pinchart 5d79e9ac89 spi: rcar: Use devm_* managed allocators
This simplies error and cleanup code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 16:31:38 +00:00
Laurent Pinchart 5ffbe2d90d spi: rcar: Fix pointer cast in the remove function
The platform driver data is set to point to the rspi_data structure at
probe time. Calling spi_master_get() on the pointer is just plain wrong
and only works by chance. Fix it by using the platform driver data
directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 16:31:34 +00:00
Laurent Pinchart 8e1c8096fa spi: rcar: Fix uninitialized variable warning
The transfer data length variable is set based on the desired access
size, without a default case. This results in a compiler warning, even
though the access size is always set to a supported value. Create a
default case to silence the warning.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 16:31:31 +00:00
Laurent Pinchart 3e6006e4ae spi: sh-msiof: Fix warnings due to improper casts
Cast pointers to uintptr_t instead of unsigned int. This fixes warnings
on platforms where pointers have a different size than int.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27 15:49:07 +00:00
Tomasz Figa 3faecea70b spi: s3c64xx: Always select S3C64XX_PL080 when ARCH_S3C64XX is enabled
The legacy S3C64xx DMA driver has been removed, DMA support on
S3C64xx is provided only by the generic PL08x driver.

This patch modifies the Kconfig entry of spi-s3c64xx driver, which
relies on availability of DMA, to always select the S3C64XX_PL080
symbol.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 14:38:25 +00:00
Tomasz Figa 1b49f10c69 spi: s3c64xx: Do not require legacy DMA API in case of S3C64XX
With support for amba-pl08x driver, on S3C64xx the generic DMA engine
API can be used instead of the private s3c-dma interface.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 14:38:23 +00:00
Mark Brown 0079aae0f1 spi: omap2: Add build dependencies for writel_relaxed()
It's not reliably available.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 14:29:25 +00:00
Sourav Poddar cbcabb7a30 spi/qspi: Fix qspi remove path.
There is a bug in qspi removal path, as a result of which
qspi cannot be removed when used as a module. The patch
solves the bug and qspi can be removed cleanly.

The bugs fixed are:
-pm_runtime used around register access.
- pm_runtime_disable need to be done before removal.
- spi_unregister_master need to be called to unregister
   the spi device.
Tested on DRA7 board.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 14:15:11 +00:00
Sourav Poddar 05b96675db spi/qspi: cleanup pm_runtime error check.
clean up pm_runtime error check in accordance with rest of the check in
the driver.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-24 14:15:10 +00:00