Commit Graph

1835 Commits

Author SHA1 Message Date
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
Chao Fu 349ad66c0a spi:Add Freescale DSPI driver for Vybrid VF610 platform
The serial peripheral interface (SPI) module implemented on Freescale Vybrid
platform provides a synchronous serial bus for communication between Vybrid
and the external peripheral device.
The SPI supports full-duplex, three-wire synchronous transfer, has TX/RX FIFO
with depth of four entries.

This driver is the SPI master mode driver and has been tested on Vybrid
VF610TWR board.

Signed-off-by: Alison Wang <b18965@freescale.com>
Signed-off-by: Chao Fu  <b44548@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 11:33:13 +01:00
Gerhard Sittig a81a5094a3 spi: mpc512x: cleanup clock API use
cleanup the MPC512x SoC's SPI master's use of the clock API
- get, prepare, and enable the MCLK during probe; disable, unprepare and
  put the MCLK upon remove; hold a reference to the clock over the
  period of use
- fetch MCLK rate (reference) once during probe and slightly reword BCLK
  (bitrate) determination to reduce redundancy as well as to not exceed
  the maximum text line length
- stick with the PPC_CLOCK 'psc%d_mclk' name for clock lookup, only
  switch to a fixed string later after device tree based clock lookup
  will have become available

Signed-off-by: Gerhard Sittig <gsi@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 11:02:07 +01:00
Jingoo Han d9740f6aa6 spi: bfin-v3: remove unnecessary platform_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-08-22 10:58:42 +01:00
Fabio Estevam 7085f40351 spi: spi-pl022: Fix warning when CONFIG_ARM_LPAE=y
When CONFIG_ARM_LPAE=y the following build warning is generated:

drivers/spi/spi-pl022.c:2178:9: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'resource_size_t' [-Wformat]

According to Documentation/printk-formats.txt '%pa' can be used to properly
print 'resource_size_t'.

Reported-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-22 10:46:54 +01:00
Uwe Kleine-König 03ddcbc5d8 spi/bitbang: trivial: fix doubled word "use"
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-08-20 12:58:44 +02:00
Laurent Navet 5f7f54b5ca drivers/spi/spi-tegra114.c clean use of devm_ioremap_resource()
Check of 'r' and calls to dev_err are already done in devm_ioremap_resource,
so no need to do them twice.

Signed-off-by: Laurent Navet <laurent.navet@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-20 11:43:59 +01:00
Axel Lin f79cc88e4e spi: octeon: 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 octeon_spi_validate_bpw() and let SPI core handle the checking.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-20 11:34:08 +01:00
Axel Lin a35c6bea82 spi: octeon: Remove unused bits_per_word variable in octeon_spi_do_transfer
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-20 11:34:07 +01:00
Axel Lin fe81109b6d spi: octeon: Remove empty octeon_spi_nop_transfer_hardware function
Both prepare_transfer_hardware and unprepare_transfer_hardware callbacks are
optional, so we don't need to implement an empty function for them.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-20 11:34:07 +01:00
Axel Lin 2e29db400c spi: bitbang: Remove unused tmp variable
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-15 10:52:24 +01:00
Gabor Juhos 56ede94a00 spi: limit default transfer speed to controller's max speed
Since the 'spi: Support transfer speed checking in the core'
change, the SPI core validates the desired speed of a given
transfer against the minimum and maximum speeds supported by
the controller.

If the speed of a transfer is not specified, the core uses
the maximum speed of the actual SPI device. However if the
maximum speed of the actual device is greater than the
maximum speed of the controller, the core will reject the
transfer due to the aforementioned change.

Change the code to use the maximum speed of the controller
by default if that is below the device's maximum speed.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-14 19:12:31 +01:00
Julia Lawall 2479790b29 spi/sirf: simplify use of devm_ioremap_resource
Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.

Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more clear.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  ... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
  ... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-14 19:08:44 +01:00
Julia Lawall de0fa83c41 spi/spi-{bcm63xx.c,bfin-v3.c}: simplify use of devm_ioremap_resource
Remove unneeded error handling on the result of a call to
platform_get_resource when the value is passed to devm_ioremap_resource.

Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more clear.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression pdev,res,n,e,e1;
expression ret != 0;
identifier l;
@@

- res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  ... when != res
- if (res == NULL) { ... \(goto l;\|return ret;\) }
  ... when != res
+ res = platform_get_resource(pdev, IORESOURCE_MEM, n);
  e = devm_ioremap_resource(e1, res);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-14 17:47:58 +01:00
Mark Brown c12f964357 spi/s3c64xx: Take runtime PM reference even if DMA is not supported
We always need the device to be runtime PM enabled to use it so just skip
the DMA initialisation not the entire prepare when polling.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-14 11:22:14 +01:00
Mark Brown 3c729b4344 Linux 3.11-rc5
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQEcBAABAgAGBQJSCDSjAAoJEHm+PkMAQRiGDXMIAI7Loae0Oqb1eoeJkvjyZsBS
 OJDeeEcn+k58VbxVHyRdc7hGo4yI4tUZm172SpnOaM8sZ/ehPU7zBrwJK2lzX334
 /jAM3uvVPfxA2nu0I4paNpkED/NQ8NRRsYE1iTE8dzHXOH6dA3mgp5qfco50rQvx
 rvseXpME4KIAJEq4jnyFZF5+nuHiPueM9JftPmSSmJJ3/KY9kY1LESovyWd7ttg1
 jYSVPFal9J0E+tl2UQY5g9H16GqhhjYn+39Iei6Q5P4bL4ZubQgTRQTN9nyDc06Z
 ezQtGoqZ8kEz/2SyRlkda6PzjSEhgXlc8mCL5J7AW+dMhTHHx2IrosjiCA80kG8=
 =c0rK
 -----END PGP SIGNATURE-----

Merge tag 'v3.11-rc5' into spi-s3c64xx

Linux 3.11-rc5
2013-08-14 11:22:09 +01:00
Alexander Stein 2f1603c6fa spi-topcliff-pch: Add MODULE_DEVICE_TABLE
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-13 01:00:51 +01:00
Tomasz Figa 90438c4bf9 spi: s3c64xx: Use dmaengine_prep_slave_single() to prepare DMA transfers
Since the driver supports only contiguous buffers, there is no need to
manually construct a scatterlist with just a single entry, when there is
a dedicated helper for this purpose.

This patch modifies prepare_dma() function to use available helper instead
of manually creating a scatterlist.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-11 14:06:30 +01:00
Tomasz Figa 0149871c42 spi: s3c64xx: Do not request CS GPIO on subsequent calls to .setup()
Comments in linux/spi/spi.h and observed behavior show that .setup()
callback can be called multiple times without corresponding calls to
.cleanup(), what was incorrectly assumed by spi-s3c64xx driver, leading
to failures trying to request CS GPIO multiple times.

This patch modifies the behavior of spi-s3c64xx driver to request CS
GPIO only on first call to .setup() after last .cleanup().

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-11 14:06:30 +01:00
Tomasz Figa b1a8e78d17 spi: s3c64xx: Zero dma_slave_config struct in prepare_dma()
Not all fields of dma_slave_config struct are being initialized by
prepare_dma() function, leaving those which are not in undefined state,
which can confuse DMA drivers using them.

This patch adds call to memset() to zero the struct before initializing
a subset of its fields.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-11 14:06:30 +01:00
Uwe Kleine-König 86f8973c10 spi: new controller driver for efm32 SoCs
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-09 17:32:57 +01:00
Mark Brown 30af9b558a spi/bitbang: Drop empty setup() functions
Now that the bitbang core does not require a setup() function we can
drop the check in the altera, nuc900 and xilinx drivers.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-09 17:32:10 +01:00
Uwe Kleine-König 52ade73621 spi/bitbang: don't error out if there is no setup callback provided
It's perfectly valid not to have a setup callback when the probe routine
does all the needed things. So don't even check for this case and trust
the caller.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-09 17:32:10 +01:00
Mark Brown c7abc19ca6 Linux 3.11-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQEcBAABAgAGBQJR/r3EAAoJEHm+PkMAQRiG/AoH/jicCaXA4HSMK6lWpXFqzhmg
 DXq7RcTnfLkFI/gb5ivFTAxnfYDbXwRUNsz+x2bgSj/1vDp7OT/4J9zxu6hURq85
 E2hFXuUpGcP8sRLinvu2NwrKWFWNrZY/sne1NSbn4bN4Oez5B1MLRkWADfueHhYn
 Xfg5JOS989XVq5WLzMnf+wSXa11zIEM0yxNVwPjDnDHbaSE+nf3+WdRML/DGfS9v
 2FsFZ2ghWCd1qB3dxwJoo2kWIA63/D6A4FAe2yXxeuMzVAdMIeBZZY8A5dCPVhv2
 F8CURHCiG5QCAF45gFoEUdruh3uarx90MmMsgFhv/2czDjlyFcpRCBUTyiOEoa0=
 =WR/G
 -----END PGP SIGNATURE-----

Merge tag 'v3.11-rc4' into spi-bitbang

Linux 3.11-rc4
2013-08-09 17:26:31 +01:00
Axel Lin 29f0d48846 spi: spi-mxs: Remove unused bits_per_word variable
The bits_per_word variable is not used after commit 24778be20f
"spi: convert drivers to use bits_per_word_mask".

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-06 18:06:29 +01:00
Mark Brown 5a9e119ce5 spi/build: Remove SPI_SIRF from compile test
It now needs the architecture dependant DMA driver.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-06 11:43:37 +01:00
Mark Brown 7668c29407 spi/sirf: Depends on SIRF_DMA
Now that DMA support has been added to the driver it needs the
architecture DMA driver to be built in order to link.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-06 11:37:32 +01:00
Barry Song de39f5fa09 spi: sirf: use DMA if both buffer address and length are aligned
this patch enables DMA support for SiRFSoC SPI driver, if both
buffers and length are aligned with DMA controller's hardware
limitation, use generic SiRF generic dmaengine driver.

for PIO, SiRF SPI controller actually is using rx to trigger rx,
that means if we write any word to tx fifo, we will get a word
from rx fifo. for DMA, we use two different channel for tx and
rx, and issue them both for every transfer.

Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-06 11:10:01 +01:00
Axel Lin e1b18ea809 spi: octeon: Remove my_master pointer from struct octeon_spi
Pass master to platform_set_drvdata() then we can remove my_master pointer.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-05 15:55:50 +01:00
Axel Lin c2b6a3a82d spi: bcm2835: Use SPI_BPW_MASK macro for bits_per_word_mask setting
We have a SPI_BPW_MASK macro defined in spi.h, use it instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-05 15:55:09 +01:00
Guennadi Liakhovetski e2b0509908 spi: rspi: provide port addresses to dmaengine driver via slave configuration
Don't rely on shdma dhaengine driver getting DMA slave addresses from its
slave configuration. Instead provide those addresses, using a
dmaengine_slave_config() call.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-02 17:28:43 +01:00
Emil Goode 6a3fc31f35 spi/ep93xx: Fix format specifier warning
This patch fixes the following sparse warning by changing the
the format specifier for size_t to %zu.

drivers/spi/spi-ep93xx.c:512:3: warning:
	format ‘%d’ expects argument of	type ‘int’,
	but argument 3 has type ‘size_t’ [-Wformat]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-31 17:55:40 +01:00
Emil Goode 2de024b766 spi/atmel: Fix format specifier warnings
This patch fixes the following sparse warnings.
dma_addr_t can be either u32 or u64 so we should cast to the
largest type and use the format specifier %llx.

drivers/spi/spi-atmel.c: In function ‘atmel_spi_next_xfer_dma_submit’:
drivers/spi/spi-atmel.c:631:2: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 7 has type ‘dma_addr_t’ [-Wformat]
drivers/spi/spi-atmel.c:631:2: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 9 has type ‘dma_addr_t’ [-Wformat]
drivers/spi/spi-atmel.c: In function ‘atmel_spi_pdc_next_xfer’:
drivers/spi/spi-atmel.c:734:3: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 7 has type ‘dma_addr_t’ [-Wformat]
drivers/spi/spi-atmel.c:734:3: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 9 has type ‘dma_addr_t’ [-Wformat]
drivers/spi/spi-atmel.c:773:3: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 7 has type ‘dma_addr_t’ [-Wformat]
drivers/spi/spi-atmel.c:773:3: warning:
	format ‘%x’ expects argument of type ‘unsigned int’,
	but argument 9 has type ‘dma_addr_t’ [-Wformat]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-31 17:55:00 +01:00
Mark Brown e221fa40a4 spi/txx9: Use linux/gpio.h not asm/gpio.h
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-30 12:16:04 +01:00
Christian Eggers 89c66ee890 spi: spi-davinci: Fix direction in dma_map_single()
Commit 048177ce3b (spi: spi-davinci:
convert to DMA engine API) introduced a regression: dma_map_single()
is called with direction DMA_FROM_DEVICE for rx and for tx.

Signed-off-by: Christian Eggers <ceggers@gmx.de>
Acked-by: Matt Porter <mporter@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org # v3.7.x+
2013-07-29 20:27:54 +01:00
Mark Brown ce74ac80d2 spi/tegra20-slink: Use core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2013-07-29 18:00:30 +01:00
Mark Brown 38315fd48d spi/tegra20-sflash: Use core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2013-07-29 18:00:26 +01:00
Mark Brown 612aa5ced7 spi/tegra114: Use core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
2013-07-29 18:00:23 +01:00
Mark Brown fc0f81b76a spi/s3c64xx: Use core for runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 18:00:22 +01:00
Mark Brown 3e00a09d2f spi/hspi: Convert to core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 18:00:21 +01:00
Mark Brown 7dd6278733 spi/pxa2xx: Convert to core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 18:00:21 +01:00
Mark Brown 29b6e906a7 spi/pl022: Convert to core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
2013-07-29 18:00:20 +01:00
Mark Brown f0278a1a40 spi/omap2: Covert to core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2013-07-29 18:00:20 +01:00
Mark Brown 3f36e80ab9 spi/coldfire-qspi: Convert to core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 18:00:19 +01:00
Mark Brown 5355d96d6f spi/bcm63xx: Convert to core runtime PM
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 18:00:19 +01:00
Mark Brown 49834de234 spi: Provide core support for runtime PM during transfers
Most SPI drivers that implement runtime PM support use identical code to
do so: they acquire a runtime PM lock in prepare_transfer_hardware() and
then they release it in unprepare_transfer_hardware(). The variations in
this are mostly missing error checking and the choice to use autosuspend.

Since these runtime PM calls are normally the only thing in the prepare
and unprepare callbacks and the autosuspend API transparently does the
right thing on devices with autosuspend disabled factor all of this out
into the core with a flag to enable the behaviour.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
2013-07-29 17:59:20 +01:00
Mark Brown bafe886936 spi/tegra-slink: Factor runtime PM out into transfer prepare/unprepare
Currently the tegra slink driver acquires a runtime PM reference for the
duration of each transfer. This may result in the IP being powered down
between transfers which would be at best wasteful. Instead it is better
to do this in the callbacks that are generated before and after starting
a series of transfers, keeping the IP powered throughout.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-07-29 17:12:38 +01:00
Mark Brown 9f178c22fb spi/tegra-sflash: Factor runtime PM out into transfer prepare/unprepare
Currently the tegra sflash driver acquires a runtime PM reference for the
duration of each transfer. This may result in the IP being powered down
between transfers which would be at best wasteful. Instead it is better
to do this in the callbacks that are generated before and after starting
a series of transfers, keeping the IP powered throughout.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-07-29 17:12:36 +01:00
Mark Brown bb249aad82 spi/tegra114: Factor runtime PM out into transfer prepare/unprepare
Currently the tegra114 driver acquires a runtime PM reference for the
duration of each transfer. This may result in the IP being powered down
between transfers which would be at best wasteful. Instead it is better
to do this in the callbacks that are generated before and after starting
a series of transfers, keeping the IP powered throughout.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
2013-07-29 17:12:35 +01:00
Mark Brown 1729ce3441 spi/orion: Convert to devm_ioremap_resource()
Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Andrew Lunn <andrew@lunn.ch>
2013-07-29 12:41:01 +01:00
Niels de Vos 27743e0bfd spi/imx: expose module alias for loading from device-tree
Enable auto loading by udev when spi-imx is compiled as a module.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 12:40:08 +01:00
Mark Brown dd1053a93f spi/drivers: Enable build of drivers with COMPILE_TEST
Enable the build of drivers which don't have any real build time
dependency on their architecture or platform with COMPILE_TEST,
providing better build time coverage.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 05:21:30 +01:00
Mark Brown 895248f851 spi/orion: Directly include linux/size.h
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-29 05:21:29 +01:00
Mark Brown 6c07ef298a spi/atmel: Annotate lock/unlock functions
Let checkers like sparse know that the locking imbalances are intentional
in these functions.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-28 19:15:52 +01:00
Mark Brown 33bf2c0b7d spi/sh-msiof: Remove unneeded empty runtime PM callbacks
Previously the runtime PM API insisted on having callbacks for everything
but this requirement was removed a while ago so the empty callbacks can
also be removed.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-28 19:15:29 +01:00
Mark Brown 8e76fda3e1 spi/sh-hspi: Remove noisy print
This adds no meaningful value.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-28 19:14:59 +01:00
Santosh Shilimkar 788489145b spi: davinci: Update configs to make it selectable on Keystone
Keystone2 SOCs share the SPI IP block with DaVinci based SOCs. Update
the config bits so that its usable on Keystone2 based SOCs.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-25 10:19:57 +01:00
Jingoo Han b998aca8ad spi: s3c64xx: fix casting warning
sdd->ops->request is unsigned int, not unsigned long.
Also, sdd->rx_dma.ch is a 'struct dma_chan *'.
Thus, (void *) is converted to (struct dma_chan *)(unsigned long),
in order to fix possible sparse warnings.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24 15:32:36 +01:00
Jingoo Han c65bc4a8df spi: s3c64xx: fix printk warnings
Fix the following build warnings when LPAE is enabled:

drivers/spi/spi-s3c64xx.c:1466:2: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type
'resource_size_t' [-Wformat]
drivers/spi/spi-s3c64xx.c:1466:2: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type
'resource_size_t' [-Wformat]

Use vsprintf extension %pR to format resource.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24 15:32:35 +01:00
Jingoo Han db0606ecd6 spi: s3c64xx: fix checkpatch error and warnings
Fix the following checkpatch error and warnings:

  ERROR: "(foo*)" should be "(foo *)"
  WARNING: line over 80 characters
  WARNING: quoted string split across lines

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24 15:32:35 +01:00
Mark Brown 900bfe33b6 spi/s3c64xx: Remove unused message queue
Since the driver has been converted to use the core message pump code
the only use of the messsage queue in the driver is a check to see if
it is empty which will always succeed since nothing ever adds to the
queue. Just remove the queue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
2013-07-24 15:32:24 +01:00
Wolfram Sang e5d950f024 spi: bcm2835: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-24 15:23:15 +01:00
Fabio Estevam 796305a2e2 spi: spi-mxs: Remove unneeded check for platform_get_resource()
As devm_ioremap_resource() is used on probe, there is no need to explicitly
check the return value from platform_get_resource(), as this is something that
devm_ioremap_resource() takes care by itself.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-22 10:51:13 +01:00
Sourav Poddar 078726ce6d driver: spi: Modify core to compute the message length
Make spi core calculate the message length while
populating the other transfer parameters.

Usecase, driver can use it to populate framelength filed in their
controller.

Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-18 16:22:01 +01:00
Fabio Estevam d60990d597 spi: spi-bitbang: Fix conversion of spi_bitbang_transfer_one()
Since commit 2025172e3 (spi/bitbang: Use core message pump), the following
kernel crash is seen:

Unable to handle kernel NULL pointer dereference at virtual address 0000000d
pgd = 80004000
[0000000d] *pgd=00000000
Internal error: Oops: 5 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 48 Comm: spi32766 Not tainted 3.11.0-rc1+ #4
task: bfa3e580 ti: bfb90000 task.ti: bfb90000
PC is at spi_bitbang_transfer_one+0x50/0x248
LR is at spi_bitbang_transfer_one+0x20/0x248
...

,and also the following build warning:

drivers/spi/spi-bitbang.c: In function 'spi_bitbang_start':
drivers/spi/spi-bitbang.c:436:31: warning: assignment from incompatible pointer type [enabled by default]

In order to fix it, we need to change the first parameter of
spi_bitbang_transfer_one() to 'struct spi_master *master'.

Tested on a mx6qsabrelite by succesfully probing a SPI NOR flash.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-17 23:34:27 +01:00
Dan Carpenter 9ca1273bb9 spi/xilinx: signedness issue checking platform_get_irq()
In xilinx_spi_probe() we use xspi->irq to store negative error codes so
it has to be signed.  We weren't going to use the upper bit any way so
this is fine.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-17 18:19:44 +01:00
Mark Brown 2025172e32 spi/bitbang: Use core message pump
Convert drivers using bitbang to use the core mesasge pump infrastructure,
saving some code and meaning that these drivers get to take advantage of
work done on improving the core implementation.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-17 18:13:01 +01:00
H Hartley Sweeten 84ddb3c1df spi: spi-ep93xx: convert to the queued driver infrastructure
The SPI core provides infrastructure for standard message queueing. Use
that instead of handling it in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-17 11:10:59 +01:00
Boris BREZILLON dfec4a6e42 spi: atmel: prepare clk before calling enable
Replace clk_enable/disable with clk_prepare_enable/disable_unprepare to
avoid common clk framework warnings.

Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-17 09:10:24 +01:00
Mark Brown 70f092a585 Merge remote-tracking branch 'spi/fix/xilinx' into spi-linus 2013-07-15 11:46:16 +01:00
Mark Brown 52bc441ae7 Merge remote-tracking branch 'spi/fix/setup' into spi-linus 2013-07-15 11:46:15 +01:00
Mark Brown 069e1572d7 Merge remote-tracking branch 'spi/fix/s3c64xx' into spi-linus 2013-07-15 11:46:14 +01:00
Michal Simek 7b3b7432ae spi/xilinx: Simplify irq allocation
Use devm_request_irq() for irq allocation which
simplify driver code.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:53 +01:00
Michal Simek be3acdff94 spi/xilinx: Use of_property_read_u32 for reading value from node
It simplifies driver probing.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:53 +01:00
Michal Simek ad3fdbcaf9 spi/xilinx: Clean ioremap calling
devm_ioremap_resource() automatically checks that
struct resource is initialized.
Also group platform_get_resource() and devm_ioremap_resource()
together.
And remove mem resource from struct xilinx_spi.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:53 +01:00
Michal Simek 5586c09e19 spi/xilinx: Remove CONFIG_OF from the driver
dev.of_node is in struct device all the time.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:53 +01:00
Mark Brown 7cb2abd05f spi/xilinx: Refer to platform device as pdev in probe() and remove()
This is a more traditional name and makes things a bit clearer when
referring to actual struct devices as we do frequently during probe().

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Michal Simek <michal.simek@xilinx.com>
2013-07-15 11:45:52 +01:00
Mark Brown d81c0bbbf8 spi/xilinx: Remove remains of of_platform device registration
In the past there used to be a separate platform device type for device
tree systems so the probe and removal functions were split into generic
and bus sections. Since this is no longer the case simplify the code (and
remove some unprototyped exports) by factoring everything into the bus
probe() and remove().

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:52 +01:00
Mark Brown c40537d008 spi/xilinx: Convert to devm_ioremap_resource()
Saves code and reduces the possibility of error.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:52 +01:00
Andy Shevchenko cd4c424463 spi: tle62x0: dump small buffers using %*ph
We have nice specifier in kernel for that.

It changes separator from ',' (comma) to space, though it's not a big deal
since it's just a debug message.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:45:24 +01:00
Wei Yongjun 86562d04fc spi: tegra114: remove redundant dev_err call in tegra_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-07-15 11:44:21 +01:00
Qipan Li 94b1f0dfa6 spi: sirf: add missed spi mode_bits that SiRFSoC hardware supports
Missing this will cause some user cases fail when they want to change spi
transfer mode.

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-07-15 11:43:54 +01:00
Girish K S 9f4b323803 spi: s3c64xx: add missing check for polling mode
Due to changes in mainline prior to submission the spi device detection
in polling mode breaks. This revealed the missing check for polling
during dma prepare. This patch adds the missing check.

Signed-off-by: Girish K S <ks.giri@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:43:14 +01:00
Mika Westerberg 1de7061253 spi/pxa2xx: enable DMA on newer Intel LPSS silicon
There is an additional bit in the Intel LPSS SPI private registers that
needs to be set in order to be able to use DMA with the SPI controller.
Enable this as well.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:42:23 +01:00
Mark Brown 2d0c6148e3 spi/omap-100k: Convert to module_platform_driver()
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:31 +01:00
Mark Brown 13cd19e855 spi/omap-100k: Prepare and unprepare clocks
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:31 +01:00
Mark Brown 022a9412ec spi/omap-100k: Convert to devm_clk_get()
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:30 +01:00
Mark Brown da60b85506 spi/omap-100k: Convert to use core message queue implementation
Saves some code duplication and gets us the benefits of any improvements
in the core code.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:30 +01:00
Mark Brown e8153ab3d7 spi/omap-100k: Factor message transfer function out of work queue
In preparation for removing the custom workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:30 +01:00
Mark Brown 69ea672a13 spi/omap-100k: Use core functionality to check validity of transfers
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:30 +01:00
Mark Brown 407d600f1f spi/omap-100k: Remove empty reset function
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:39:29 +01:00
Fabio Estevam 8498bce934 spi: spi-mxs: Check the return value from stmp_reset_block()
stmp_reset_block() may fail, so let's check its return value and propagate it in
the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:38:42 +01:00
Fabio Estevam 9c4a39afaa spi: spi-mxs: Check the return value from clk_prepare_enable()
clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

While at it, rename 'out_free_dma' to 'out_disable_clk' so that it can properly
describe its purpose.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:38:42 +01:00
Fabio Estevam e11933f626 spi: spi-mxs: Fix the error path sequence
On mxs_spi_probe() the dma channels are requested prior to enabling the SSP
clock, so in the error path we should disable the SSP clock first and
release the DMA channels later.

Same logic applies in mxs_spi_remove().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:38:41 +01:00
Fabio Estevam 83174626cc spi: spi-imx: Check the return value from clk_prepare_enable()
clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

While at it, fix the order of clk_disable_unprepare calls: clk_ipg should be
disabled first, followed by clk_per.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:56 +01:00
Fabio Estevam 130b82c047 spi: spi-imx: Use devm functions
Using devm functions can make the code smaller and cleaner.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:56 +01:00
H Hartley Sweeten f7ef1da9e2 spi: spi-ep93xx: move the clock divider calcs into ep93xx_spi_chip_setup()
The divider values stored in the per chip data are only used to set the
registers in the hardware to generate the desired SPI clock. Since these
are calculated per transfer based on the t->speed_hz there is no reason
keep them in the per chip data.

Move the ep93xx_spi_calc_divisors() call into ep93xx_spi_chip_setup()
and return the dividers thru pointers. Remove the divider values from
the per chip data structure.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:14 +01:00
H Hartley Sweeten 22c1b69ea8 spi: spi-ep93xx: don't bother calculating the divisors in ep93xx_spi_setup()
The divisors needed to generate the SPI clock are calculated per
transfer based on the t->speed_hz. There is no reason to calculate
them in ep93xx_spi_setup().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:14 +01:00
H Hartley Sweeten e6eb8d9bb7 spi: spi-ep93xx: use devm_clk_get()
Use devm_clk_get() so that the clk_put() happens automatically when
the last reference to this driver is dropped.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:14 +01:00
H Hartley Sweeten d9b65dfd44 spi: spi-ep93xx: remove 'dss' from per chip private data
This value is only needed to set the bits per word for each transfer
of a message. There is no reason to set the value in ep93xx_spi_enable()
because ep93xx_spi_process_transfer() sets it again for each transfer.

Just pass the t->bits_per_word directly to ep93xx_spi_chip_setup() in
ep93xx_spi_process_transfer() and remove 'dss' from the per chip private
data.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:14 +01:00
H Hartley Sweeten b2d185edba spi: spi-ep93xx: remove dev_err() for kzalloc() failure
The kzalloc() failure will have already output a message.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:37:14 +01:00