aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spi
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-09-01 08:49:06 -0400
committerMark Brown <broonie@linaro.org>2013-09-01 08:49:06 -0400
commit85cac431329bd09f7d30d489591d7af0d658b008 (patch)
tree8e81e687c9104c297b9d985e2c5f37f05a6e4b83 /include/linux/spi
parent793b3cb6acc081e557dabcf11ce781d64dafb4d4 (diff)
parentb6460366fbadc160604f50047d0394c7fc39ceab (diff)
Merge remote-tracking branch 'spi/topic/qspi' into spi-next
Diffstat (limited to 'include/linux/spi')
-rw-r--r--include/linux/spi/spi.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index e1b3e69aeddc..887116dbce2c 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -74,7 +74,7 @@ struct spi_device {
74 struct spi_master *master; 74 struct spi_master *master;
75 u32 max_speed_hz; 75 u32 max_speed_hz;
76 u8 chip_select; 76 u8 chip_select;
77 u8 mode; 77 u16 mode;
78#define SPI_CPHA 0x01 /* clock phase */ 78#define SPI_CPHA 0x01 /* clock phase */
79#define SPI_CPOL 0x02 /* clock polarity */ 79#define SPI_CPOL 0x02 /* clock polarity */
80#define SPI_MODE_0 (0|0) /* (original MicroWire) */ 80#define SPI_MODE_0 (0|0) /* (original MicroWire) */
@@ -87,6 +87,10 @@ struct spi_device {
87#define SPI_LOOP 0x20 /* loopback mode */ 87#define SPI_LOOP 0x20 /* loopback mode */
88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */ 88#define SPI_NO_CS 0x40 /* 1 dev/bus, no chipselect */
89#define SPI_READY 0x80 /* slave pulls low to pause */ 89#define SPI_READY 0x80 /* slave pulls low to pause */
90#define SPI_TX_DUAL 0x100 /* transmit with 2 wires */
91#define SPI_TX_QUAD 0x200 /* transmit with 4 wires */
92#define SPI_RX_DUAL 0x400 /* receive with 2 wires */
93#define SPI_RX_QUAD 0x800 /* receive with 4 wires */
90 u8 bits_per_word; 94 u8 bits_per_word;
91 int irq; 95 int irq;
92 void *controller_state; 96 void *controller_state;
@@ -256,6 +260,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
256 * @busy: message pump is busy 260 * @busy: message pump is busy
257 * @running: message pump is running 261 * @running: message pump is running
258 * @rt: whether this queue is set to run as a realtime task 262 * @rt: whether this queue is set to run as a realtime task
263 * @auto_runtime_pm: the core should ensure a runtime PM reference is held
264 * while the hardware is prepared, using the parent
265 * device for the spidev
259 * @prepare_transfer_hardware: a message will soon arrive from the queue 266 * @prepare_transfer_hardware: a message will soon arrive from the queue
260 * so the subsystem requests the driver to prepare the transfer hardware 267 * so the subsystem requests the driver to prepare the transfer hardware
261 * by issuing this call 268 * by issuing this call
@@ -380,11 +387,13 @@ struct spi_master {
380 bool busy; 387 bool busy;
381 bool running; 388 bool running;
382 bool rt; 389 bool rt;
390 bool auto_runtime_pm;
383 391
384 int (*prepare_transfer_hardware)(struct spi_master *master); 392 int (*prepare_transfer_hardware)(struct spi_master *master);
385 int (*transfer_one_message)(struct spi_master *master, 393 int (*transfer_one_message)(struct spi_master *master,
386 struct spi_message *mesg); 394 struct spi_message *mesg);
387 int (*unprepare_transfer_hardware)(struct spi_master *master); 395 int (*unprepare_transfer_hardware)(struct spi_master *master);
396
388 /* gpio chip select */ 397 /* gpio chip select */
389 int *cs_gpios; 398 int *cs_gpios;
390}; 399};
@@ -454,6 +463,10 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
454 * @rx_buf: data to be read (dma-safe memory), or NULL 463 * @rx_buf: data to be read (dma-safe memory), or NULL
455 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped 464 * @tx_dma: DMA address of tx_buf, if @spi_message.is_dma_mapped
456 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped 465 * @rx_dma: DMA address of rx_buf, if @spi_message.is_dma_mapped
466 * @tx_nbits: number of bits used for writting. If 0 the default
467 * (SPI_NBITS_SINGLE) is used.
468 * @rx_nbits: number of bits used for reading. If 0 the default
469 * (SPI_NBITS_SINGLE) is used.
457 * @len: size of rx and tx buffers (in bytes) 470 * @len: size of rx and tx buffers (in bytes)
458 * @speed_hz: Select a speed other than the device default for this 471 * @speed_hz: Select a speed other than the device default for this
459 * transfer. If 0 the default (from @spi_device) is used. 472 * transfer. If 0 the default (from @spi_device) is used.
@@ -508,6 +521,11 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum);
508 * by the results of previous messages and where the whole transaction 521 * by the results of previous messages and where the whole transaction
509 * ends when the chipselect goes intactive. 522 * ends when the chipselect goes intactive.
510 * 523 *
524 * When SPI can transfer in 1x,2x or 4x. It can get this tranfer information
525 * from device through @tx_nbits and @rx_nbits. In Bi-direction, these
526 * two should both be set. User can set transfer mode with SPI_NBITS_SINGLE(1x)
527 * SPI_NBITS_DUAL(2x) and SPI_NBITS_QUAD(4x) to support these three transfer.
528 *
511 * The code that submits an spi_message (and its spi_transfers) 529 * The code that submits an spi_message (and its spi_transfers)
512 * to the lower layers is responsible for managing its memory. 530 * to the lower layers is responsible for managing its memory.
513 * Zero-initialize every field you don't set up explicitly, to 531 * Zero-initialize every field you don't set up explicitly, to
@@ -528,6 +546,11 @@ struct spi_transfer {
528 dma_addr_t rx_dma; 546 dma_addr_t rx_dma;
529 547
530 unsigned cs_change:1; 548 unsigned cs_change:1;
549 u8 tx_nbits;
550 u8 rx_nbits;
551#define SPI_NBITS_SINGLE 0x01 /* 1bit transfer */
552#define SPI_NBITS_DUAL 0x02 /* 2bits transfer */
553#define SPI_NBITS_QUAD 0x04 /* 4bits transfer */
531 u8 bits_per_word; 554 u8 bits_per_word;
532 u16 delay_usecs; 555 u16 delay_usecs;
533 u32 speed_hz; 556 u32 speed_hz;
@@ -876,7 +899,7 @@ struct spi_board_info {
876 /* mode becomes spi_device.mode, and is essential for chips 899 /* mode becomes spi_device.mode, and is essential for chips
877 * where the default of SPI_CS_HIGH = 0 is wrong. 900 * where the default of SPI_CS_HIGH = 0 is wrong.
878 */ 901 */
879 u8 mode; 902 u16 mode;
880 903
881 /* ... may need additional spi_device chip config data here. 904 /* ... may need additional spi_device chip config data here.
882 * avoid stuff protocol drivers can set; but include stuff 905 * avoid stuff protocol drivers can set; but include stuff