Commit Graph

1835 Commits

Author SHA1 Message Date
Mark Brown ebd805cc14 spi/s3c64xx: Factor transfer start out of enable/disable_cs()
The hardware level /CS handling is tied to the start of the data path so
is rolled into the same function as we use to manipulate GPIO /CS. In
order to support factoring out the /CS handling into the core separate the
two and explicitly start transfers separately to the /CS handling.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 20:04:01 +01:00
Mark Brown 56ec1978ff spi: Provide trace points for message processing
Provide tracepoints for the lifecycle of a message from submission to
completion and for the active time for masters to help with performance
analysis of SPI I/O.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 20:02:01 +01:00
Mark Brown fb30a1819a spi/tegra20-slink: Remove unused is_single_xfer check
Currently transfer_one_message() checks to see if the message consists of
a single spi_transfer and tells _start_transfer_one() but it just ignores
this. Don't bother.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-10-07 19:45:19 +01:00
Mark Brown ac9fdc8864 Merge remote-tracking branch 'spi/fix/s3c64xx' into spi-linus 2013-10-07 14:51:59 +01:00
Mark Brown 896182ad31 Merge remote-tracking branch 'spi/fix/pxa' into spi-linus 2013-10-07 14:51:59 +01:00
Mark Brown b242954b3c Merge remote-tracking branch 'spi/fix/mpc512x' into spi-linus 2013-10-07 14:51:58 +01:00
Mark Brown 78e9fa521e Merge remote-tracking branch 'spi/fix/hspi' into spi-linus 2013-10-07 14:51:58 +01:00
Mark Brown 5acb8bb441 Merge remote-tracking branch 'spi/fix/dspi' into spi-linus 2013-10-07 14:51:57 +01:00
Mark Brown a19be58c9c Merge remote-tracking branch 'spi/fix/clps711x' into spi-linus 2013-10-07 14:51:56 +01:00
Uwe Kleine-König e6f7563b73 spi: efm32: add spi_bitbang_stop to device remove callback
This call is needed to cleanup the resources requested by
spi_bitbang_start in the probe callback.

Noticed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 14:51:24 +01:00
Mark Brown 77445a14d6 Merge remote-tracking branch 'spi/topic/bitbang' into HEAD 2013-10-07 14:51:17 +01:00
Axel Lin 702a4879ec spi: bitbang: Let spi_bitbang_start() take a reference to master
Many drivers that use bitbang library have a leak on probe error paths.
This is because once a spi_master_get() call succeeds, we need an additional
spi_master_put() call to free the memory.

Fix this issue by moving the code taking a reference to master to
spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
success. With this change, the caller is responsible for calling
spi_bitbang_stop() to decrement the reference and spi_master_put() as
counterpart of spi_alloc_master() to prevent a memory leak.

So now we have below patten for drivers using bitbang library:

probe:
spi_alloc_master        -> Init reference count to 1
spi_bitbang_start       -> Increment reference count
remove:
spi_bitbang_stop        -> Decrement reference count
spi_master_put          -> Decrement reference count (reference count reaches 0)

Fixup all users accordingly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 14:50:43 +01:00
Sachin Kamat de8cc234a5 spi: atmel: Fix incorrect error path
'irq' was not released when clk_prepare_enable failed.
Fix it.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 12:36:01 +01:00
Mark Brown dabefd56c6 Merge remote-tracking branch 'spi/topic/devm' into spi-qspi
Conflicts:
	drivers/spi/spi-ti-qspi.c
2013-10-07 12:02:26 +01:00
Sebastian Andrzej Siewior 3b3a80019f spi: ti-qspi: one only one interrupt handler
The here used irq and threaded irq handler is a complete non-sense. After
the status register is read and the source disabled it schedules a thread
(the irq thread) to read the status from the variable, invoke complete()
and then renable the interrupt. Again: schedule a thread which invokes
_only_ complete().
This patch removes this non-sense and we remain with one handler which
invokes complete() if needed.
The device remove path should now disable the interupts.
This has been compile time tested.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Tested-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-07 11:29:22 +01:00
Mark Brown 2b2322d662 Merge remote-tracking branch 'spi/fix/clps711x' into spi-clps711x
Conflicts:
	drivers/spi/spi-clps711x.c
2013-10-03 17:25:40 +01:00
Sachin Kamat c70837908d spi: clps711x: Remove redundant label
Remove empty label.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-03 17:01:59 +01:00
Kuninori Morimoto 268d76430d spi/hspi: fixup Runtime PM enable timing
3e00a09d2f
(spi/hspi: Convert to core runtime PM)
enabled master->auto_runtime_pm.
Then, pm_runtime_enable() is required *before*
spi_register_master() calling.
This patch fixed it up.
Kernel will hang up with "spi_master spi0: Failed to power device: -13"
message without this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-03 14:08:06 +01:00
Mark Brown 0f5a751ace spi/s3c64xx: Enable GPIO /CS prior to starting hardware
To help with bisection of future refactoring to share more of the code for
handling a spi_message pull the enabling of GPIO based /CS prior to all
the hardware setup for starting a transfer.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 12:53:39 +01:00
Mark Brown 8c09daa1c9 spi/s3c64xx: Factor transfer start out of enable/disable_cs()
The hardware level /CS handling is tied to the start of the data path so
is rolled into the same function as we use to manipulate GPIO /CS. In
order to support factoring out the /CS handling into the core separate the
two and explicitly start transfers separately to the /CS handling.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 12:53:38 +01:00
Mark Brown dd97e26849 spi/s3c64xx: Use core cs_gpio field
Rather than using the driver custom platform data to store the chip select
GPIO use the cs_gpio field provided by the SPI core, supporting future
refectoring.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 12:53:37 +01:00
Mark Brown 64d930ac11 spi/s3c64xx: Remove unused gpios field from driver data
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 12:53:37 +01:00
Mark Brown 8b06d5b857 spi/s3c64xx: Check that clock enables succeed on runtime resume
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 12:53:36 +01:00
Mark Brown 67651b29ef spi/s3c64xx: Flush FIFOs prior to cleaning up transfer
Ensure that the FIFOs are fully drained before we deassert /CS or do any
delays that have been requested in order to ensure that the behaviour
visible on the bus matches that which was requested by the caller.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-30 12:53:35 +01:00
Trent Piepho 89da4293a7 spi: Use of_property_read_u32
Instead of getting the raw property, checking the length, and doing
endian conversion each time, use the OF function
of_property_read_u32() that does all that.

Error messages are slightly improved with error codes from
of_property_read_u32() for different ways the property may be invalid
(missing, too short, etc.)

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-27 14:53:59 +01:00
Mathias Krause 70fac17cec spi: simplify call to request_module()
request_module() can handle format strings on its own, no need to create
the full module name ourself.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-27 14:53:52 +01:00
Mark Brown 0cab71e701 Merge remote-tracking branch 'spi/fix/s3c64xx' into spi-s3c64xx
Conflicts:
	drivers/spi/spi-s3c64xx.c
2013-09-27 14:27:56 +01:00
Mark Brown 3e2bd64d24 spi/s3c64xx: Ensure runtime PM is enabled prior to registration
Otherwise we may try to start transfers immediately and then fail to
runtime resume the device causing us not to have clocks enabled.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

Conflicts:
	drivers/spi/spi-s3c64xx.c
2013-09-27 14:26:04 +01:00
Rhyland Klein f4fade12d5 spi/tegra114: Correct support for cs_change
The tegra114 driver wasn't currently handling the cs_change
functionality. cs_change is meant to invert the decisions of whether
or not to deactivate CS after each transfer. Without cs_change, after
every transfer (other than the last in the message) the normal behavior
is to leave CS active. For the last transfer, normally CS is
deactivated when the transfer is complete.

With cs_change set on a transfer (other than last one) CS would be
deactivated and the next transfer would need to activate it again. If
cs_change was set on the last tranfer in a message, then CS would be
left active when the message compeleted.

Also, this builds in logic so that if a different device tries to start
a transfer while CS is active from a different device, it will abort the
previous transfer and start a new one for the new device.

This splits tegra_spi_start_transfer_one into 2 functions, the new one
being tegra_spi_setup_transfer_one. The setup function is safe to call
on all transfers, sets up for the transfer, and handles the special case
of the first transfer in a message. In this special case, it needs to
know whether or not it needs to activate CS.

This work was based on the spi-atmel driver.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-27 14:22:21 +01:00
Wei Yongjun 0158026ccc spi/clps711x: drop clk_put for devm_clk_get in spi_clps711x_probe()
devm_clk_get() is used so there is no reason to explicitly
call clk_put() in probe or remove functions.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-27 10:49:09 +01:00
Sourav Poddar 633795b992 spi/qspi: Add dual/quad read mode bit.
Add dual/quad read mode bit flag for the master controller.
These check will be used in the spi framework to determine
whether the master controller can do dual/quad read respectively.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 12:12:04 +01:00
Mateusz Krawczuk 7d5f880b46 spi: s3c64xx: Allow build on all Samsung platforms
Replace all symbols by simple dependency PLAT_SAMSUNG.

Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 12:08:46 +01:00
Jingoo Han 2fe7e4add3 spi: txx9: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove a duplicate put.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:43:10 +01:00
Jingoo Han 7388c03bac spi: ti-qspi: 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>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:43:09 +01:00
Jingoo Han 716db5d64f spi: tegra20-slink: 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-09-26 11:43:08 +01:00
Jingoo Han f12f7318c4 spi: tegra20-sflash: 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-09-26 11:43:07 +01:00
Jingoo Han 5c80964396 spi: tegra114: 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-09-26 11:43:07 +01:00
Jingoo Han 1c43f2ae1e spi: sh-hspi: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:42:53 +01:00
Jingoo Han a807fcd090 spi: pxa2xx: 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-09-26 11:42:52 +01:00
Jingoo Han 35794a7716 spi: pl022: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:42:44 +01:00
Jingoo Han 4bd3d8e36b spi: orion: use devm_spi_register_master()
Use devm_spi_register_master() 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-09-26 11:42:37 +01:00
Jingoo Han b95e02b748 spi: omap2-mcspi: 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-09-26 11:42:36 +01:00
Jingoo Han 5c4c5c7be1 spi: omap-100k: 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-09-26 11:42:35 +01:00
Jingoo Han 22ad2d8df7 spi: octeon: 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-09-26 11:42:34 +01:00
Jingoo Han 33e195acf2 spi: mxs: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove a duplicate put.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:42:34 +01:00
Jingoo Han eaa2429784 spi: mpc512x: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove a duplicate put.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:42:33 +01:00
Jingoo Han 434eaf3b23 spi: ep93xx: 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-09-26 11:42:32 +01:00
Jingoo Han c493fc4bbd spi: clps711x: 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-09-26 11:42:31 +01:00
Jingoo Han 6221df6d88 spi: bfin-v3: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:42:23 +01:00
Jingoo Han bca76931b9 spi: bcm63xx: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove a duplicate put.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:41:18 +01:00
Jingoo Han 247263dba2 spi: bcm2835: use devm_spi_register_master()
Use devm_spi_register_master() to make cleanup paths simpler,
and remove a duplicate put.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-26 11:41:18 +01:00
Mark Brown 5afd077d70 Merge remote-tracking branch 'spi/topic/pl022' into spi-devm 2013-09-26 11:41:15 +01:00
Mark Brown 13e92b5b1e Merge remote-tracking branch 'spi/fix/clps711x' into spi-devm 2013-09-26 11:40:56 +01:00
Dan Carpenter 9553821ead spi: spi-topcliff-pch: fix a pci_iomap() check
If pci_iomap() returns NULL, adding "PCH_ADDRESS_SIZE * plat_dev->id"
can make it non-NULL which breaks the error handling.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-24 11:02:34 +01:00
Axel Lin 57841439b6 spi: efm32: Don't call kfree() after spi_master_put()
Calling kfree() to clean up the memory obtained from spi_alloc_master() is
wrong as this is done in spi_master_release() when spi_master->dev's refcount
reaches zero.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-23 14:53:10 +01:00
Mateusz Krawczuk a3b924df8f spi: s3c64xx: Add missing compatibles
Add compatibles for s3c6410, s5pc100 and s5pc110/s5pv210 boards.

Signed-off-by: Mateusz Krawczuk <m.krawczuk@partner.samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-23 14:51:08 +01:00
Mark Brown 91800f0e90 spi/s3c64xx: Use managed registration
Also improve the error reporting on failure and remove a duplicate put.
This provides a small code saving.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-18 11:02:47 +01:00
Uwe Kleine-König 9191546f69 spi: efm32: add spi_bitbang_stop to device remove callback
This call is needed to cleanup the resources requested by
spi_bitbang_start in the probe callback.

Noticed-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 12:56:20 +01:00
Axel Lin 94c69f765f spi: bitbang: Let spi_bitbang_start() take a reference to master
Many drivers that use bitbang library have a leak on probe error paths.
This is because once a spi_master_get() call succeeds, we need an additional
spi_master_put() call to free the memory.

Fix this issue by moving the code taking a reference to master to
spi_bitbang_start(), so spi_bitbang_start() will take a reference to master on
success. With this change, the caller is responsible for calling
spi_bitbang_stop() to decrement the reference and spi_master_put() as
counterpart of spi_alloc_master() to prevent a memory leak.

So now we have below patten for drivers using bitbang library:

probe:
spi_alloc_master        -> Init reference count to 1
spi_bitbang_start       -> Increment reference count
remove:
spi_bitbang_stop        -> Decrement reference count
spi_master_put          -> Decrement reference count (reference count reaches 0)

Fixup all users accordingly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Suggested-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Acked-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 12:56:14 +01:00
Mark Brown fbce71cae7 Merge remote-tracking branch 'spi/topic/devm' into spi-s3c64xx 2013-09-17 00:59:54 +01:00
Mark Brown 666d5b4c74 spi: core: Add devm_spi_register_master()
Help simplify the cleanup code for SPI master drivers by providing a
managed master registration function, ensuring that the master is
automatically unregistered whenever the device is unbound.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:59:36 +01:00
Axel Lin e91d2352bb spi: tegra: Use DIV_ROUND_UP instead of open coded
This also makes the intention more clear.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:24:56 +01:00
Lukasz Czerwinski 50c959fc33 spi: spi-s3c64xx: Use module_platform_driver()
subsys_init_call() initializes driver too early.
It's preventing to move DMA channel allocation at the begining
(driver probe).

This patch reduces and simplifies initalization code by
using module_platform_driver() macro.
It's also efficiently delaying driver startup.

Signed-off-by: Lukasz Czerwinski <l.czerwinski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:24:09 +01:00
Sachin Kamat cfeb33127b spi: spi-s3c24xx: Staticize s3c24xx_spi_tryfiq
's3c24xx_spi_tryfiq' is used only in this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:23:41 +01:00
Hiep Cao Minh 5ce0ba8865 spi: rcar: add Renesas QSPI support on RSPI
The R8A7790 has QSPI module which is very similar to RSPI.
This patch adds into RSPI module together to supports QSPI module.

Signed-off-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:22:50 +01:00
Jingoo Han 4ebfee9118 spi: pl022: remove unnecessary amba_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:21:32 +01:00
Sachin Kamat 6e99897ba0 spi: pl022: Remove redundant break
'break' immediately after return has no effect.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:21:32 +01:00
Uwe Kleine-König b444d1dfe2 spi: fsl-dspi: several minor improvements and fixes
- improve dependencies using COMPILE_TEST
 - fix a typo
 - drop platform_set_drvdata(pdev, NULL) in error path of probe
 - make MODULE_LICENSE match the header

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:21:03 +01:00
Jingoo Han 2ef3599d81 spi: fsl-dspi: add missing __iomem annotation
Added missing __iomem annotation in order to fix the following
sparse warnings:

drivers/spi/spi-fsl-dspi.c:140:16: warning: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-fsl-dspi.c:140:16:    expected void const volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:140:16:    got void *
drivers/spi/spi-fsl-dspi.c:143:9: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:143:9:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:143:9:    got void *
drivers/spi/spi-fsl-dspi.c:132:18: warning: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-fsl-dspi.c:132:18:    expected void const volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:132:18:    got void *
drivers/spi/spi-fsl-dspi.c:241:17: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:241:17:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:241:17:    got void *
drivers/spi/spi-fsl-dspi.c:132:18: warning: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-fsl-dspi.c:132:18:    expected void const volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:132:18:    got void *
drivers/spi/spi-fsl-dspi.c:259:29: warning: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-fsl-dspi.c:259:29:    expected void const volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:259:29:    got void *
drivers/spi/spi-fsl-dspi.c:266:29: warning: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-fsl-dspi.c:266:29:    expected void const volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:266:29:    got void *
drivers/spi/spi-fsl-dspi.c:298:9: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:298:9:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:298:9:    got void *
drivers/spi/spi-fsl-dspi.c:299:9: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:299:9:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:299:9:    got void *
drivers/spi/spi-fsl-dspi.c:300:9: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:300:9:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:300:9:    got void *
drivers/spi/spi-fsl-dspi.c:303:17: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:303:17:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:303:17:    got void *
drivers/spi/spi-fsl-dspi.c:318:21: warning: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-fsl-dspi.c:318:21:    expected void const volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:318:21:    got void *
drivers/spi/spi-fsl-dspi.c:327:9: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:327:9:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:327:9:    got void *
drivers/spi/spi-fsl-dspi.c:386:9: warning: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-fsl-dspi.c:386:9:    expected void volatile [noderef] <asn:2>*addr
drivers/spi/spi-fsl-dspi.c:386:9:    got void *
drivers/spi/spi-fsl-dspi.c:485:20: warning: incorrect type in assignment (different address spaces)
drivers/spi/spi-fsl-dspi.c:485:20:    expected void *base
drivers/spi/spi-fsl-dspi.c:485:20:    got void [noderef] <asn:2>*

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:21:03 +01:00
Jingoo Han 91a92e12ba spi: spidev: remove unnecessary spi_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:19:50 +01:00
Jingoo Han 7cce62f3aa spi: dw-pci: remove unnecessary pci_set_drvdata()
The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:19:14 +01:00
Julia Lawall 1e0d191f62 spi: designware: delete premature free_irq
Free_irq is not needed if there has been no request_irq.  Free_irq is
removed from both the probe and remove functions.  The correct request_irq
and free_irq appear to be in the add_host and remove_host functions in
spi-dw.c.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e;
@@

*e = platform_get_irq(...);
... when != request_irq(e,...)
*free_irq(e,...)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:19:14 +01:00
Sachin Kamat 32ea394443 spi: spi-davinci: Fix variable type
'prescale' contains the return value of davinci_spi_get_prescale()
which is a signed integer. Convert 'prescale' to integer to silence
the following warning:
drivers/spi/spi-davinci.c:318 davinci_spi_setup_transfer() warn:
unsigned 'prescale' is never less than zero.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:18:34 +01:00
Jingoo Han 673d6e1767 spi: bfin-sport: convert from legacy pm ops to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer
dev_pm_ops structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:15:56 +01:00
Jingoo Han fbbfd68bc0 spi: bfin5xx: convert from legacy pm ops to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer
dev_pm_ops structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:15:56 +01:00
Sachin Kamat a536d76543 spi: atmel: Silence checkpatch errors
Fixes the following types of checkpatch errors and warning:
ERROR: space required after that ',' (ctx:VxV)
WARNING: sizeof *as should be sizeof(*as)

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:13:58 +01:00
Jingoo Han ec60dd37e1 spi: atmel: convert from legacy pm ops to dev_pm_ops
Instead of using legacy suspend/resume methods, using newer
dev_pm_ops structure allows better control over power management.
Also, duplicated 'return' is removed from atmel_spi_resume().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:13:57 +01:00
Martin Schwidefsky 0244ad004a Remove GENERIC_HARDIRQ config option
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-09-13 15:09:52 +02:00
Wei Yongjun 272bfbd54f spi: fix return value check in dspi_probe()
In case of error, the function devm_ioremap_resource() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-12 10:53:16 +01:00
Wei Yongjun eadf69cf5e spi: mpc512x: fix error return code in mpc512x_psc_spi_do_probe()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-12 10:48:57 +01:00
Axel Lin 9b4003a687 spi: clps711x: Don't call kfree() after spi_master_put/spi_unregister_master
Calling kfree() to clean up the memory obtained from spi_alloc_master() is
wrong as this is done in spi_master_release() when spi_master->dev's refcount
reaches zero.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-10 11:28:22 +01:00
Linus Torvalds dccfd1e439 ARM: SoC DT updates for 3.12
Device tree and bindings updates for 3.12.
 
 General additions of various on-chip and on-board peripherals on various
 platforms as support gets added. Some of the bigger changes are:
 
 - Addition of (new) PCI-e support on Tegra.
 - More Tegra4 support, including PMC configuration for Dalmore.
 - Addition of a new board for Exynos4 (trats2) and more bindings for 4x12 IP.
 - Addition of Allwinner A20 and A31 SoC and board files.
 - Move of the ST Ericsson device tree files to now use ste-* prefix.
 - More move of hardware description of shmobile platforms to DT.
 - Two new board dts files for Freescale MXs.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSKhJrAAoJEIwa5zzehBx3O6YP/AzskDtXdgdaopgZXVQxCIhE
 svby8xG2pcFvuAYEv7KNwgk02oC+B5JrUj7ZG42IOPeVo4HN7k80ehxmP5MZwnqs
 LpvBRXqUGAzEoJRhCD/lF4tuw+J5R/XgVWkIVz4nQ8tLdsSWJ3QY5LSS6ePTP6Qi
 2B3AbeW/7DSada7lHJE9CqIX5xienLo4YgfCWXHNT8ouFGfqKjBxqIbCFyvzrGfs
 jSsIsqy1IO0hnk61yHtbPCRl9FJg2rbVwqHBZvKHMW0ls19Q42chlK/dPO5JCb4w
 VWMqbdOr8fnbqzicVqUPbShYZjgEd5I6PUgZMXJqEacgX9dj3SfOOtcR9kfrntHE
 of7Wi3FzVzWTzclRnub9nHrBIwvThAr+WX+mvbZrD+tuQte8qkFZXO9mw5/hRA7M
 K1O1HgaH1R1Xcdo69EWx9o94NYJ9Vs9F6wmS2+nb1B8u83Ee2Uq0GES5oyYqhU56
 qg8FOMYUBDwXlHpjt1qiSwAYrabdCyxMx8lt351bxmiyKRFx0hmyGsv6HvlHJ7Oz
 hn6xHcNyIoCIuOvWxiLmKKU2ameDn16uSd71MSwomnQ+U4V+QzoqQ4QDgYD6Sgd5
 5fln3OYV3JniWeYFw9DkSLKQTYBodz06wA+XOurcNWs3Ls0E9GilKFixKC6GoEVC
 uIywadgelMfDux8GGD3x
 =1GuI
 -----END PGP SIGNATURE-----

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

Pull ARM SoC DT updates from Olof Johansson:
 "Device tree and bindings updates for 3.12.

  General additions of various on-chip and on-board peripherals on
  various platforms as support gets added.  Some of the bigger changes
  are:

   - Addition of (new) PCI-e support on Tegra.
   - More Tegra4 support, including PMC configuration for Dalmore.
   - Addition of a new board for Exynos4 (trats2) and more bindings for
     4x12 IP.
   - Addition of Allwinner A20 and A31 SoC and board files.
   - Move of the ST Ericsson device tree files to now use ste-* prefix.
   - More move of hardware description of shmobile platforms to DT.
   - Two new board dts files for Freescale MXs"

* tag 'dt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (177 commits)
  dts: Rename DW APB timer compatible strings
  dts: Deprecate ALTR as a vendor prefix
  of: add vendor prefix for Altera Corp.
  ARM: at91/dt: sam9x5ek: add sound configuration
  ARM: at91/dt: sam9x5ek: enable SSC
  ARM: at91/dt: sam9x5ek: add WM8731 codec
  ARM: at91/dt: sam9x5: add SSC DMA parameters
  ARM: at91/dt: add at91rm9200 PQFP package version
  ARM: at91: at91rm9200: set default mmc0 pinctrl-names
  ARM: at91: at91sam9n12: correct pin number of gpio-key
  ARM: at91: at91sam9n12: add qt1070 support
  ARM: at91: at91sam9n12: add pinctrl of TWI
  ARM: at91: Add PMU support for sama5d3
  ARM: at91: at91sam9260: add missing pinctrl-names on mmc
  ARM: tegra: configure power off for Dalmore
  ARM: DT: binding fixup to align with vendor-prefixes.txt (DT)
  ARM: dts: add sdio blocks to bcm28155-ap board
  ARM: dts: align sdio numbers to HW definition
  ARM: sun7i: Add Olimex A20-Olinuxino-Micro support
  ARM: sun7i: Add Allwinner A20 DTSI
  ...
2013-09-06 13:26:27 -07:00
Linus Torvalds 2e515bf096 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree from Jiri Kosina:
 "The usual trivial updates all over the tree -- mostly typo fixes and
  documentation updates"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (52 commits)
  doc: Documentation/cputopology.txt fix typo
  treewide: Convert retrun typos to return
  Fix comment typo for init_cma_reserved_pageblock
  Documentation/trace: Correcting and extending tracepoint documentation
  mm/hotplug: fix a typo in Documentation/memory-hotplug.txt
  power: Documentation: Update s2ram link
  doc: fix a typo in Documentation/00-INDEX
  Documentation/printk-formats.txt: No casts needed for u64/s64
  doc: Fix typo "is is" in Documentations
  treewide: Fix printks with 0x%#
  zram: doc fixes
  Documentation/kmemcheck: update kmemcheck documentation
  doc: documentation/hwspinlock.txt fix typo
  PM / Hibernate: add section for resume options
  doc: filesystems : Fix typo in Documentations/filesystems
  scsi/megaraid fixed several typos in comments
  ppc: init_32: Fix error typo "CONFIG_START_KERNEL"
  treewide: Add __GFP_NOWARN to k.alloc calls with v.alloc fallbacks
  page_isolation: Fix a comment typo in test_pages_isolated()
  doc: fix a typo about irq affinity
  ...
2013-09-06 09:36:28 -07:00
Linus Torvalds 27703bb4a6 PTR_RET() is a weird name, and led to some confusing usage. We ended
up with PTR_ERR_OR_ZERO(), and replacing or fixing all the usages.
 
 This has been sitting in linux-next for a whole cycle.
 
 Thanks,
 Rusty.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJSJo+1AAoJENkgDmzRrbjxIC4QALJK95o8AUXuwUkl+2fmFkUt
 hh2/PJ1vDYgk4Xt0J6hyoK7XMa0H1RkbBrROuDdsBnorMFpEsGcgdkUZte9ufoAS
 97Bg+7N0KPbTB/S8vOwtW1vbERTJIVPN2uf6h1Wqm9Xc2puCh3HbMMr1AWMGu0WQ
 NqY5+Zz8zecy1UOrMhEP6H1CjeQcL1w1DO6YM5ydeqlKNzAz+JMfDXriLPDwiE7+
 XFPDF/O3Vtd2ckA7L70Lio7hfHwxV5U4WwFVfiwls98XB4jcZqDKIoh1r8z4SRgR
 +0Rae2DN3BaOabGMr//5XdrzQVpwJTh5m2w8BAOHJvCJ9HR7Sq29UIN4u+TowZBy
 L2xYo4dvFxkympwu5zEd3c7vHYWKIaqmSq5PIjr4gF/uIo2OeOTrpPIK782ZEYb7
 e+qUgOEM05V9AmQZCrSZeP9u474Sj8ow3sCtWxfdRtwNfoEIcUXsNNJd/zDHlVtW
 cEtXqc2xXIpcuUJQWlSaGp8fmRQjVZPzrLKYLM2m39ZcOOJbf5rzQAYS7hHPosIa
 SK+YVux/+Zzi+Xo/vXq1OlM/SruCr5S7JOgCxLowoQ88vupgXME6uPyC8EO+QQ50
 GsrHes5ZNLbk0uVsfcexIyojkUnyvDmmnDpv+1zdC6RgZLJQn8OXp5yNhHhnhrFT
 BiHX6YFWtDDqRlVv8Q0F
 =LeaW
 -----END PGP SIGNATURE-----

Merge tag 'PTR_RET-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull PTR_RET() removal patches from Rusty Russell:
 "PTR_RET() is a weird name, and led to some confusing usage.  We ended
  up with PTR_ERR_OR_ZERO(), and replacing or fixing all the usages.

  This has been sitting in linux-next for a whole cycle"

[ There are still some PTR_RET users scattered about, with some of them
  possibly being new, but most of them existing in Rusty's tree too.  We
  have that

      #define PTR_RET(p) PTR_ERR_OR_ZERO(p)

  thing in <linux/err.h>, so they continue to work for now  - Linus ]

* tag 'PTR_RET-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
  GFS2: Replace PTR_RET with PTR_ERR_OR_ZERO
  Btrfs: volume: Replace PTR_RET with PTR_ERR_OR_ZERO
  drm/cma: Replace PTR_RET with PTR_ERR_OR_ZERO
  sh_veu: Replace PTR_RET with PTR_ERR_OR_ZERO
  dma-buf: Replace PTR_RET with PTR_ERR_OR_ZERO
  drivers/rtc: Replace PTR_RET with PTR_ERR_OR_ZERO
  mm/oom_kill: remove weird use of ERR_PTR()/PTR_ERR().
  staging/zcache: don't use PTR_RET().
  remoteproc: don't use PTR_RET().
  pinctrl: don't use PTR_RET().
  acpi: Replace weird use of PTR_RET.
  s390: Replace weird use of PTR_RET.
  PTR_RET is now PTR_ERR_OR_ZERO(): Replace most.
  PTR_RET is now PTR_ERR_OR_ZERO
2013-09-04 17:31:11 -07:00
Mika Westerberg 269e4a4122 spi/pxa2xx: check status register as well to determine if the device is off
The current interrupt handler calls pm_runtime_suspended() to check if the
device is suspended or not. However, runtime PM status of the device is
only set to suspended once all PM runtime suspend hooks have executed.

In case of Intel Lynxpoint we have the device bound to the ACPI power
domain and its runtime suspend hook will put the device to D3hot (or D3cold
if possible). This means that the device is powered off before its state is
set to runtime suspended. While in this state the device might get an
interrupt that is meant for another device (as the interrupt line is
shared), and because the device is powered off accessing its registers will
return 0xffffffff that the driver misinterprets as an invalid state.

When this happens user will see messages like below on the console:

  pxa2xx-spi INT33C0:00: bad message state in interrupt handler

Fix this by checking the status register for ~0 and returning IRQ_NONE in
that case.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-04 20:14:29 +01:00
Olof Johansson 56e9e0f3a3 Merge branch 'socfpga/dt' into next/dt
SoCFPGA DT changes from Dinh Nguyen.

* socfpga/dt:
  dts: Rename DW APB timer compatible strings
  dts: Deprecate ALTR as a vendor prefix
  of: add vendor prefix for Altera Corp.

Signed-off-by: Olof Johansson <olof@lixom.net>
2013-09-03 10:20:06 -07:00
Mark Brown 5787392598 Merge remote-tracking branch 'spi/topic/txx9' into spi-next 2013-09-01 13:49:18 +01:00
Mark Brown 961722f57c Merge remote-tracking branch 'spi/topic/topcliff' into spi-next 2013-09-01 13:49:17 +01:00
Mark Brown 58737f127a Merge remote-tracking branch 'spi/topic/tel62x0' into spi-next 2013-09-01 13:49:14 +01:00
Mark Brown e7c57cc124 Merge remote-tracking branch 'spi/topic/tegra' into spi-next 2013-09-01 13:49:13 +01:00
Mark Brown a3e412dcf5 Merge remote-tracking branch 'spi/topic/sirf' into spi-next 2013-09-01 13:49:12 +01:00
Mark Brown 368ce0bca4 Merge remote-tracking branch 'spi/topic/sh-msiof' into spi-next 2013-09-01 13:49:11 +01:00
Mark Brown 874915ed4b Merge remote-tracking branch 'spi/topic/sh-hspi' into spi-next 2013-09-01 13:49:10 +01:00
Mark Brown 2dc745b6ef Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-next 2013-09-01 13:49:09 +01:00
Mark Brown 121a39661b Merge remote-tracking branch 'spi/topic/rspi' into spi-next 2013-09-01 13:49:08 +01:00
Mark Brown 278ac33bbd Merge remote-tracking branch 'spi/topic/quad' into spi-next 2013-09-01 13:49:07 +01:00
Mark Brown 85cac43132 Merge remote-tracking branch 'spi/topic/qspi' into spi-next 2013-09-01 13:49:06 +01:00
Mark Brown 793b3cb6ac Merge remote-tracking branch 'spi/topic/pxa' into spi-next 2013-09-01 13:49:05 +01:00
Mark Brown 720ed2d130 Merge remote-tracking branch 'spi/topic/pl022' into spi-next 2013-09-01 13:49:04 +01:00
Mark Brown 68aa4cb337 Merge remote-tracking branch 'spi/topic/pdata' into spi-next 2013-09-01 13:49:03 +01:00
Mark Brown 11c28cfc1e Merge remote-tracking branch 'spi/topic/orion' into spi-next 2013-09-01 13:49:02 +01:00
Mark Brown 4374f332d9 Merge remote-tracking branch 'spi/topic/omap-100k' into spi-next 2013-09-01 13:49:01 +01:00
Mark Brown 45bb5065e1 Merge remote-tracking branch 'spi/topic/octeon' into spi-next 2013-09-01 13:49:00 +01:00
Mark Brown 455765f02e Merge remote-tracking branch 'spi/topic/nuc900' into spi-next 2013-09-01 13:48:59 +01:00
Mark Brown 7c2fde9b1a Merge remote-tracking branch 'spi/topic/mxs' into spi-next 2013-09-01 13:48:59 +01:00
Mark Brown 9020b75467 Merge remote-tracking branch 'spi/topic/msglen' into spi-next 2013-09-01 13:48:58 +01:00
Mark Brown 84c86edab3 Merge remote-tracking branch 'spi/topic/mpc512x' into spi-next 2013-09-01 13:48:57 +01:00
Mark Brown 4faad26c27 Merge remote-tracking branch 'spi/topic/ioremap' into spi-next 2013-09-01 13:48:56 +01:00
Mark Brown 8e37befc5c Merge remote-tracking branch 'spi/topic/imx' into spi-next 2013-09-01 13:48:55 +01:00
Mark Brown 497cb4473a Merge remote-tracking branch 'spi/topic/ep93xx' into spi-next 2013-09-01 13:48:54 +01:00
Mark Brown afa8f0cd6c Merge remote-tracking branch 'spi/topic/efm32' into spi-next 2013-09-01 13:48:53 +01:00
Mark Brown 2f2613b028 Merge remote-tracking branch 'spi/topic/dspi' into spi-next 2013-09-01 13:48:52 +01:00
Mark Brown b49247907d Merge remote-tracking branch 'spi/topic/davinci' into spi-next 2013-09-01 13:48:51 +01:00
Mark Brown 7e718b4bd2 Merge remote-tracking branch 'spi/topic/core' into spi-next 2013-09-01 13:48:50 +01:00
Mark Brown 1f54f94284 Merge remote-tracking branch 'spi/topic/clps711x' into spi-next 2013-09-01 13:48:49 +01:00
Mark Brown db04e17055 Merge remote-tracking branch 'spi/topic/checks' into spi-next 2013-09-01 13:48:48 +01:00
Mark Brown 788a739676 Merge remote-tracking branch 'spi/topic/build' into spi-next 2013-09-01 13:48:47 +01:00
Mark Brown f1632c3278 Merge remote-tracking branch 'spi/topic/blackfin-v3' into spi-next 2013-09-01 13:48:45 +01:00
Mark Brown b29bc3df37 Merge remote-tracking branch 'spi/topic/bitbang' into spi-next 2013-09-01 13:48:44 +01:00
Mark Brown c3dbe2b76a Merge remote-tracking branch 'spi/topic/bcm2835' into spi-next 2013-09-01 13:48:44 +01:00
Mark Brown 5264af0ca6 Merge remote-tracking branch 'spi/topic/atmel' into spi-next 2013-09-01 13:48:43 +01:00
Wei Yongjun b6460366fb spi/qspi: fix missing unlock on error in ti_qspi_start_transfer_one()
Add the missing unlock before return from function ti_qspi_start_transfer_one()
in the error handling case.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-01 13:47:55 +01:00
wangyuhang a110f93d8b spi: quad: fix the name of DT property
spi: quad: fix the name of DT property in patch

The previous property name spi-tx-nbits and spi-rx-nbits looks not
human-readable. To make it consistent with other devices, using property
name spi-tx-bus-width and spi-rx-bus-width instead of the previous one
specify the number of data wires that spi controller will work in.
Add the specification in spi-bus.txt.

Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-01 13:45:14 +01:00
Axel Lin e93b07244d spi: core: Fix spi_register_master error handling
In the case spi_master_initialize_queue() fails, current code calls
device_unregister() before return error from spi_register_master().
However, all the drivers call spi_master_put() in the error path if
spi_register_master() fails. Thus we should call device_del() rather than
device_unregister() before return error from spi_register_master().

This also makes all the spi_register_master() error handling consistent,
because all other error paths of spi_register_master() expect drivers to
call spi_master_put() if spi_register_master() fails.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 17:51:06 +01:00
Axel Lin d8851a0d4f spi: efm32: Fix build error
Obviously the of_device_id table name is wrong.

Fix below build error:

  CC [M]  drivers/spi/spi-efm32.o
drivers/spi/spi-efm32.c:499:1: error: '__mod_of_device_table' aliased to undefined symbol 'efm32_uart_dt_ids'
make[2]: *** [drivers/spi/spi-efm32.o] Error 1
make[1]: *** [drivers/spi] Error 2
make: *** [drivers] Error 2

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 16:29:14 +01:00
Axel Lin f073d37de0 spi: altera: Use DIV_ROUND_UP to calculate hw->bytes_per_word
The Altera SPI hardware can be configured to support data width from 1 to 32
since Quartus II 8.1. To avoid truncation by integer division, use DIV_ROUND_UP
to calculate hw->bytes_per_word.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 14:10:41 +01:00
Axel Lin 9d3405dbbb spi: rspi: Add spi_master_get() call to prevent use after free
In rspi_remove(), current code dereferences rspi after spi_unregister_master(),
thus add an extra spi_master_get() call is necessary to prevent use after free.

Current code already has an extra spi_master_put() call in rspi_remove(), so
this patch just adds a spi_master_get() call rather than a spi_master_get() with
spi_master_put() calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-31 12:58:53 +01:00
Mark Brown a822e99c70 spi: quad: Make DT properties optional
The addition SPI quad support made the DT properties mandatory, breaking
compatibility with existing systems. Fix that by making them optional,
also improving the error messages while we're at it.

Signed-off-by: Mark Brown <broonie@linaro.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
2013-08-31 01:31:40 +01:00
wangyuhang d5ee722ab9 spi: quad: Fix missing return
Delete a "return" when commit the patch to a new kernel version
 by mistake. So recover it.

Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-30 22:55:32 +01:00
Dinh Nguyen 13960b47dc dts: Deprecate ALTR as a vendor prefix
Because most of the vendor prefixes are lower case, deprecate
the vendor prefix "ALTR" in place of "altr" for Altera Corp..

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Olof Johansson <olof@lixom.net>
2013-08-29 12:58:55 -07:00
Mark Brown b5f9a9d511 Merge remote-tracking branch 'spi/topic/rspi' into spi-pdata
Conflicts:
	drivers/spi/spi-rspi.c
2013-08-29 13:59:05 +01:00
Axel Lin a1216394e6 spi: Use dev_get_drvdata at appropriate places
Use dev_get_drvdata() instead of platform_get_drvdata(to_platform_device(dev)).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-29 13:57:14 +01:00
Jingoo Han 8074cf063e spi: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-29 13:56:23 +01:00
Mark Brown a4f2ca3e62 Merge remote-tracking branch 'spi/topic/xilinx' into spi-pdata 2013-08-29 13:56:18 +01:00
Axel Lin 044d0bb620 spi: nuc900: Fix mode_bits setting
The code in nuc900_slave_select() supports handling SPI_CS_HIGH.
Thus set SPI_CS_HIGH bit in master->mode_bits to make it work.
Otherwise, spi_setup() will return unsupported mode bits error message if
SPI_CS_HIGH is set in the mode field of struct spi_device.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-29 13:40:48 +01:00
Julia Lawall b3136f8f7c spi: simplify devm_request_mem_region/devm_ioremap
Convert the composition of devm_request_mem_region and devm_ioremap to a
single call to devm_ioremap_resource.  The associated call to
platform_get_resource is also simplified and moved next to the new call to
devm_ioremap_resource.

This was done using a combination of the semantic patches
devm_ioremap_resource.cocci and devm_request_and_ioremap.cocci, found in
the scripts/coccinelle/api directory.

This patch also removes the label exit_busy, to use the error code returned
by the failing operation, rather than always -EBUSY.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-29 13:39:35 +01:00
Axel Lin 72be0ee42e spi: altera: Simplify altera_spi_txrx implementation for noirq case
This patch simplifies the code and makes it better in readability.
Now the logic in the while loop is simply
"write to ALTERA_SPI_TXDATA then read from ALTERA_SPI_TXDATA".

There is a slightly logic change because now we avoid a read-write cycle when
hw->len is 0. Since the code in bitbang library will call bitbang->txrx_bufs()
only when t->len is not 0, this is not a problem.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-28 14:18:45 +01:00
Shimoda, Yoshihiro 8d4d08ce83 spi: spi-rspi: fix inconsistent spin_lock_irqsave
This patch fixes the following Smatch warning:

  CHECK   drivers/spi/spi-rspi.c
drivers/spi/spi-rspi.c:606 rspi_work() warn: inconsistent returns spin_lock:&rspi->lock: locked (602) unlocked (606)
drivers/spi/spi-rspi.c:606 rspi_work() warn: inconsistent returns irqsave🎏 locked (602) unlocked (606)

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-27 15:55:41 +01:00
Sourav Poddar 09222fc33f spi/qspi: Add compatible string for am4372.
Add a compatible string for am4372.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-27 15:44:10 +01:00
Sourav Poddar e1432d30cb spi/qspi: Fix device table entry
Fix module device table entry. Without this, there will
be a build failure while trying to build qspi as a module.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-27 14:30:20 +01:00
Qipan Li 692fb0fe5a spi/sirf: fix the misunderstanding about len of spi_transfer
the unit of len of spi_transfer is in bytes, not in spi words. the
old codes misunderstood that and thought the len is the amount of
spi words. but it is actually how many bytes existing in the spi
buffer.

this patch fixes that and also rename left_tx_cnt and left_rx_cnt
to left_tx_word and left_rx_word to highlight they are in words.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-26 13:00:14 +01:00
Sourav Poddar 70e2e9761a spi/qspi: Add dual/quad spi read support
Support for multiple lines in SPI framework has been picked[1].
[1]: http://comments.gmane.org/gmane.linux.kernel.spi.devel/14420

Hence, adapting ti qspi driver to support multiple data lines for read.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-23 12:00:32 +01:00
Mark Brown 21e34a3306 Merge remote-tracking branch 'spi/topic/quad' into spi-qspi 2013-08-23 12:00:15 +01:00
Wei Yongjun 6cca9e2dd0 spi: sirf: fix error return code in spi_sirfsoc_probe()
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-23 10:36:58 +01:00
Axel Lin 7bc003100b spi: bcm2835: Add spi_master_get() call to prevent use after free
The call to spi_unregister_master results in device memory being freed, it must
no longer be accessed afterwards. Thus call spi_master_get() to get an extra
reference to the device and call spi_master_put() only after the last access to
device data.

Note, current code has an extra spi_master_put() call in bcm2835_spi_remove().
Thus this patch just adds an spi_master_get() to balance the reference count.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 19:07:51 +01:00
Axel Lin 96b3eace39 spi: Remove a redundant test for master->running in spi_queued_transfer
We have tested master->running immediately after grab the master->queue_lock.
The status of master->running won't be changed until we release the lock.
Thus remove a redundant test for master->running.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 19:07:09 +01:00
Sourav Poddar db90a44177 spi: conditional checking of mode and transfer bits.
There is a bug in the following patch:
http://comments.gmane.org/gmane.linux.kernel.spi.devel/14420

spi: DUAL and QUAD support

    fix the previous patch some mistake below:
    1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using
       "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the
       previous way to get the property in @of_register_spi_devices().
    2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL
       SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires.
    3. Add the following check
       (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the
          single, dual and quad.
       (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode
          example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set
                   to QUAD(SPI_NBITS_QUAD)
       (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in
          single(SPI_NBITS_SINGLE)

Checking of the tx/rx transfer bits and mode bits should be done conditionally
based on type of buffer filled else EINVAL condition will
always get hit either for rx or tx.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 19:05:39 +01:00
wangyuhang f477b7fb13 spi: DUAL and QUAD support
fix the previous patch some mistake below:
1. DT in slave node, use "spi-tx-nbits = <1/2/4>" in place of using
   "spi-tx-dual, spi-tx-quad" directly, same to rx. So correct the
   previous way to get the property in @of_register_spi_devices().
2. Change the value of transfer bit macro(SPI_NBITS_SINGLE, SPI_NBITS_DUAL
   SPI_NBITS_QUAD) to 0x01, 0x02 and 0x04 to match the actual wires.
3. Add the following check
   (1)keep the tx_nbits and rx_nbits in spi_transfer is not beyond the
      single, dual and quad.
   (2)keep tx_nbits and rx_nbits are contained by @spi_device->mode
      example: if @spi_device->mode = DUAL, then tx/rx_nbits can not be set
               to QUAD(SPI_NBITS_QUAD)
   (3)if "@spi_device->mode & SPI_3WIRE", then tx/rx_nbits should be in
      single(SPI_NBITS_SINGLE)

Signed-off-by: wangyuhang <wangyuhang2014@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 13:47:29 +01:00
Sourav Poddar 505a14954e spi/qspi: Add qspi flash controller
The patch add basic support for the quad spi controller.

QSPI is a kind of spi module that allows single,
dual and quad read access to external spi devices. The module
has a memory mapped interface which provide direct interface
for accessing data form external spi devices.

The patch will configure controller clocks, device control
register and for defining low level transfer apis which
will be used by the spi framework to transfer data to
the slave spi device(flash in this case).

Test details:
-------------
Tested this on dra7 board.
Test1: Ran mtd_stesstest for 40000 iterations.
   - All iterations went through without failure.
Test2: Use mtd utilities:
  - flash_erase to erase the flash device
  - mtd_debug read to read data back.
  - mtd_debug write to write to the data flash.
 diff between the write and read data shows zero.

Acked-by: Felipe Balbi<balbi@ti.com>
Reviewed-by: Felipe Balbi<balbi@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 13:08:06 +01:00
Wei Yongjun 1f6301593d spi: spi-efm32: remove redundant dev_err call in efm32_spi_probe()
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 11:39:04 +01:00