aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-04-10 18:39:52 -0400
committerMark Brown <broonie@linaro.org>2014-04-10 18:39:52 -0400
commit09c0998efcb4a23e27c297f48309e0b2abc76563 (patch)
treee2c1d589095af11d2a56239df9beb7ddad566f67 /include/linux
parent455c6fdbd219161bd09b1165f11699d6d73de11c (diff)
parent45b15d98a96ffdb3c608bdad952f51930c151420 (diff)
Merge tag 'spi-v3.15' into spi-linus
spi: Updates for v3.15 A busy release for both cleanups and new drivers this time along with further factoring out of replicated code into the core: - Provide support in the core for DMA mapping transfers - essentially all drivers weren't implementing this properly, now there's no excuse. - Dual and quad mode support for spidev. - Fix handling of cs_change in the generic implementation. - Remove the S3C_DMA code from the s3c64xx driver now that all the platforms using it have been converted to dmaengine. - Lots of improvements to the Renesas SPI controllers. - Drivers for Allwinner A10 and A31, Qualcomm QUP and Xylinx xtfpga. - Removal of the bitrotted ti-ssp driver. # gpg: Signature made Mon 31 Mar 2014 12:03:09 BST using RSA key ID 7EA229BD # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/platform_data/spi-s3c64xx.h9
-rw-r--r--include/linux/pm_runtime.h4
-rw-r--r--include/linux/spi/spi.h31
-rw-r--r--include/linux/spi/spi_bitbang.h2
4 files changed, 40 insertions, 6 deletions
diff --git a/include/linux/platform_data/spi-s3c64xx.h b/include/linux/platform_data/spi-s3c64xx.h
index 8447f634c7f5..d3889b98a1a1 100644
--- a/include/linux/platform_data/spi-s3c64xx.h
+++ b/include/linux/platform_data/spi-s3c64xx.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h 1/*
2 *
3 * Copyright (C) 2009 Samsung Electronics Ltd. 2 * Copyright (C) 2009 Samsung Electronics Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com> 3 * Jaswinder Singh <jassi.brar@samsung.com>
5 * 4 *
@@ -8,8 +7,8 @@
8 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
9 */ 8 */
10 9
11#ifndef __S3C64XX_PLAT_SPI_H 10#ifndef __SPI_S3C64XX_H
12#define __S3C64XX_PLAT_SPI_H 11#define __SPI_S3C64XX_H
13 12
14#include <linux/dmaengine.h> 13#include <linux/dmaengine.h>
15 14
@@ -68,4 +67,4 @@ extern int s3c64xx_spi2_cfg_gpio(void);
68extern struct s3c64xx_spi_info s3c64xx_spi0_pdata; 67extern struct s3c64xx_spi_info s3c64xx_spi0_pdata;
69extern struct s3c64xx_spi_info s3c64xx_spi1_pdata; 68extern struct s3c64xx_spi_info s3c64xx_spi1_pdata;
70extern struct s3c64xx_spi_info s3c64xx_spi2_pdata; 69extern struct s3c64xx_spi_info s3c64xx_spi2_pdata;
71#endif /* __S3C64XX_PLAT_SPI_H */ 70#endif /*__SPI_S3C64XX_H */
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 16c9a62fa1c0..2a5897a4afbc 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -26,9 +26,13 @@
26#ifdef CONFIG_PM 26#ifdef CONFIG_PM
27extern int pm_generic_runtime_suspend(struct device *dev); 27extern int pm_generic_runtime_suspend(struct device *dev);
28extern int pm_generic_runtime_resume(struct device *dev); 28extern int pm_generic_runtime_resume(struct device *dev);
29extern int pm_runtime_force_suspend(struct device *dev);
30extern int pm_runtime_force_resume(struct device *dev);
29#else 31#else
30static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; } 32static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
31static inline int pm_generic_runtime_resume(struct device *dev) { return 0; } 33static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
34static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
35static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
32#endif 36#endif
33 37
34#ifdef CONFIG_PM_RUNTIME 38#ifdef CONFIG_PM_RUNTIME
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 4203c66d8803..36c86ef51ff3 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -24,6 +24,9 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/scatterlist.h>
28
29struct dma_chan;
27 30
28/* 31/*
29 * INTERFACES between SPI master-side drivers and SPI infrastructure. 32 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -266,6 +269,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
266 * @auto_runtime_pm: the core should ensure a runtime PM reference is held 269 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
267 * while the hardware is prepared, using the parent 270 * while the hardware is prepared, using the parent
268 * device for the spidev 271 * device for the spidev
272 * @max_dma_len: Maximum length of a DMA transfer for the device.
269 * @prepare_transfer_hardware: a message will soon arrive from the queue 273 * @prepare_transfer_hardware: a message will soon arrive from the queue
270 * so the subsystem requests the driver to prepare the transfer hardware 274 * so the subsystem requests the driver to prepare the transfer hardware
271 * by issuing this call 275 * by issuing this call
@@ -348,6 +352,8 @@ struct spi_master {
348#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ 352#define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */
349#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */ 353#define SPI_MASTER_NO_RX BIT(1) /* can't do buffer read */
350#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */ 354#define SPI_MASTER_NO_TX BIT(2) /* can't do buffer write */
355#define SPI_MASTER_MUST_RX BIT(3) /* requires rx */
356#define SPI_MASTER_MUST_TX BIT(4) /* requires tx */
351 357
352 /* lock and mutex for SPI bus locking */ 358 /* lock and mutex for SPI bus locking */
353 spinlock_t bus_lock_spinlock; 359 spinlock_t bus_lock_spinlock;
@@ -390,6 +396,17 @@ struct spi_master {
390 void (*cleanup)(struct spi_device *spi); 396 void (*cleanup)(struct spi_device *spi);
391 397
392 /* 398 /*
399 * Used to enable core support for DMA handling, if can_dma()
400 * exists and returns true then the transfer will be mapped
401 * prior to transfer_one() being called. The driver should
402 * not modify or store xfer and dma_tx and dma_rx must be set
403 * while the device is prepared.
404 */
405 bool (*can_dma)(struct spi_master *master,
406 struct spi_device *spi,
407 struct spi_transfer *xfer);
408
409 /*
393 * These hooks are for drivers that want to use the generic 410 * These hooks are for drivers that want to use the generic
394 * master transfer queueing mechanism. If these are used, the 411 * master transfer queueing mechanism. If these are used, the
395 * transfer() function above must NOT be specified by the driver. 412 * transfer() function above must NOT be specified by the driver.
@@ -407,7 +424,9 @@ struct spi_master {
407 bool rt; 424 bool rt;
408 bool auto_runtime_pm; 425 bool auto_runtime_pm;
409 bool cur_msg_prepared; 426 bool cur_msg_prepared;
427 bool cur_msg_mapped;
410 struct completion xfer_completion; 428 struct completion xfer_completion;
429 size_t max_dma_len;
411 430
412 int (*prepare_transfer_hardware)(struct spi_master *master); 431 int (*prepare_transfer_hardware)(struct spi_master *master);
413 int (*transfer_one_message)(struct spi_master *master, 432 int (*transfer_one_message)(struct spi_master *master,
@@ -428,6 +447,14 @@ struct spi_master {
428 447
429 /* gpio chip select */ 448 /* gpio chip select */
430 int *cs_gpios; 449 int *cs_gpios;
450
451 /* DMA channels for use with core dmaengine helpers */
452 struct dma_chan *dma_tx;
453 struct dma_chan *dma_rx;
454
455 /* dummy data for full duplex devices */
456 void *dummy_rx;
457 void *dummy_tx;
431}; 458};
432 459
433static inline void *spi_master_get_devdata(struct spi_master *master) 460static inline void *spi_master_get_devdata(struct spi_master *master)
@@ -512,6 +539,8 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
512 * (optionally) changing the chipselect status, then starting 539 * (optionally) changing the chipselect status, then starting
513 * the next transfer or completing this @spi_message. 540 * the next transfer or completing this @spi_message.
514 * @transfer_list: transfers are sequenced through @spi_message.transfers 541 * @transfer_list: transfers are sequenced through @spi_message.transfers
542 * @tx_sg: Scatterlist for transmit, currently not for client use
543 * @rx_sg: Scatterlist for receive, currently not for client use
515 * 544 *
516 * SPI transfers always write the same number of bytes as they read. 545 * SPI transfers always write the same number of bytes as they read.
517 * Protocol drivers should always provide @rx_buf and/or @tx_buf. 546 * Protocol drivers should always provide @rx_buf and/or @tx_buf.
@@ -579,6 +608,8 @@ struct spi_transfer {
579 608
580 dma_addr_t tx_dma; 609 dma_addr_t tx_dma;
581 dma_addr_t rx_dma; 610 dma_addr_t rx_dma;
611 struct sg_table tx_sg;
612 struct sg_table rx_sg;
582 613
583 unsigned cs_change:1; 614 unsigned cs_change:1;
584 unsigned tx_nbits:3; 615 unsigned tx_nbits:3;
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index daebaba886aa..85578d4be034 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -42,6 +42,6 @@ extern int spi_bitbang_setup_transfer(struct spi_device *spi,
42 42
43/* start or stop queue processing */ 43/* start or stop queue processing */
44extern int spi_bitbang_start(struct spi_bitbang *spi); 44extern int spi_bitbang_start(struct spi_bitbang *spi);
45extern int spi_bitbang_stop(struct spi_bitbang *spi); 45extern void spi_bitbang_stop(struct spi_bitbang *spi);
46 46
47#endif /* __SPI_BITBANG_H */ 47#endif /* __SPI_BITBANG_H */