diff options
author | Mark Brown <broonie@linaro.org> | 2013-08-23 07:00:15 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-23 07:00:15 -0400 |
commit | 21e34a3306e7f0399cc0e10c24cb0e7790dfbcac (patch) | |
tree | 79c88e282eb2ae19ed911545191ef1480bd2a71b /include | |
parent | 505a14954e2d7f2321a73f7a650bb6591d2fc1d3 (diff) | |
parent | db90a44177ac39fc22b2da5235b231fccdd4c673 (diff) |
Merge remote-tracking branch 'spi/topic/quad' into spi-qspi
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/spi/spi.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index bf0204c00053..d4a16a68b9cf 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; |
@@ -233,6 +237,8 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
233 | * suported. If set, the SPI core will reject any transfer with an | 237 | * suported. If set, the SPI core will reject any transfer with an |
234 | * unsupported bits_per_word. If not set, this value is simply ignored, | 238 | * unsupported bits_per_word. If not set, this value is simply ignored, |
235 | * and it's up to the individual driver to perform any validation. | 239 | * and it's up to the individual driver to perform any validation. |
240 | * @min_speed_hz: Lowest supported transfer speed | ||
241 | * @max_speed_hz: Highest supported transfer speed | ||
236 | * @flags: other constraints relevant to this driver | 242 | * @flags: other constraints relevant to this driver |
237 | * @bus_lock_spinlock: spinlock for SPI bus locking | 243 | * @bus_lock_spinlock: spinlock for SPI bus locking |
238 | * @bus_lock_mutex: mutex for SPI bus locking | 244 | * @bus_lock_mutex: mutex for SPI bus locking |
@@ -315,6 +321,10 @@ struct spi_master { | |||
315 | #define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1)) | 321 | #define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0UL : (BIT(bits) - 1)) |
316 | #define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) | 322 | #define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1)) |
317 | 323 | ||
324 | /* limits on transfer speed */ | ||
325 | u32 min_speed_hz; | ||
326 | u32 max_speed_hz; | ||
327 | |||
318 | /* other constraints relevant to this driver */ | 328 | /* other constraints relevant to this driver */ |
319 | u16 flags; | 329 | u16 flags; |
320 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ | 330 | #define SPI_MASTER_HALF_DUPLEX BIT(0) /* can't do full duplex */ |
@@ -453,6 +463,10 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
453 | * @rx_buf: data to be read (dma-safe memory), or NULL | 463 | * @rx_buf: data to be read (dma-safe memory), or NULL |
454 | * @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 |
455 | * @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. | ||
456 | * @len: size of rx and tx buffers (in bytes) | 470 | * @len: size of rx and tx buffers (in bytes) |
457 | * @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 |
458 | * transfer. If 0 the default (from @spi_device) is used. | 472 | * transfer. If 0 the default (from @spi_device) is used. |
@@ -507,6 +521,11 @@ extern struct spi_master *spi_busnum_to_master(u16 busnum); | |||
507 | * by the results of previous messages and where the whole transaction | 521 | * by the results of previous messages and where the whole transaction |
508 | * ends when the chipselect goes intactive. | 522 | * ends when the chipselect goes intactive. |
509 | * | 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 | * | ||
510 | * The code that submits an spi_message (and its spi_transfers) | 529 | * The code that submits an spi_message (and its spi_transfers) |
511 | * to the lower layers is responsible for managing its memory. | 530 | * to the lower layers is responsible for managing its memory. |
512 | * Zero-initialize every field you don't set up explicitly, to | 531 | * Zero-initialize every field you don't set up explicitly, to |
@@ -527,6 +546,11 @@ struct spi_transfer { | |||
527 | dma_addr_t rx_dma; | 546 | dma_addr_t rx_dma; |
528 | 547 | ||
529 | 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 */ | ||
530 | u8 bits_per_word; | 554 | u8 bits_per_word; |
531 | u16 delay_usecs; | 555 | u16 delay_usecs; |
532 | u32 speed_hz; | 556 | u32 speed_hz; |
@@ -874,7 +898,7 @@ struct spi_board_info { | |||
874 | /* mode becomes spi_device.mode, and is essential for chips | 898 | /* mode becomes spi_device.mode, and is essential for chips |
875 | * where the default of SPI_CS_HIGH = 0 is wrong. | 899 | * where the default of SPI_CS_HIGH = 0 is wrong. |
876 | */ | 900 | */ |
877 | u8 mode; | 901 | u16 mode; |
878 | 902 | ||
879 | /* ... may need additional spi_device chip config data here. | 903 | /* ... may need additional spi_device chip config data here. |
880 | * avoid stuff protocol drivers can set; but include stuff | 904 | * avoid stuff protocol drivers can set; but include stuff |