This patch creates set_cs_timing SPI master optional method for SPI masters to implement configuring CS timing if applicable. This patch also creates spi_cs_timing accessory for SPI clients to use for requesting SPI master controllers to configure device requested CS setup time, hold time and inactive delay.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -330,6 +330,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 329 unmodified lines | |||
| 330 | * must fail if an unrecognized or unsupported mode is requested. | 330 | * must fail if an unrecognized or unsupported mode is requested. |
| 331 | * It's always safe to call this unless transfers are pending on | 331 | * It's always safe to call this unless transfers are pending on |
| 332 | * the device whose settings are being modified. | 332 | * the device whose settings are being modified. |
| 333 | * @set_cs_timing: optional hook for SPI devices to request SPI master | ||
| 334 | * controller for configuring specific CS setup time, hold time and inactive | ||
| 335 | * delay interms of clock counts | ||
| 333 | * @transfer: adds a message to the controller's transfer queue. | 336 | * @transfer: adds a message to the controller's transfer queue. |
| 334 | * @cleanup: frees controller-specific state | 337 | * @cleanup: frees controller-specific state |
| 335 | * @can_dma: determine whether this controller supports DMA | 338 | * @can_dma: determine whether this controller supports DMA |
| @@ -363,6 +366,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) · 27 unmodified lines | |||
| 363 | * @unprepare_transfer_hardware: there are currently no more messages on the | 366 | * @unprepare_transfer_hardware: there are currently no more messages on the |
| 364 | * queue so the subsystem notifies the driver that it may relax the | 367 | * queue so the subsystem notifies the driver that it may relax the |
| 365 | * hardware by issuing this call | 368 | * hardware by issuing this call |
| 369 | * | ||
| 366 | * @set_cs: set the logic level of the chip select line. May be called | 370 | * @set_cs: set the logic level of the chip select line. May be called |
| 367 | * from interrupt context. | 371 | * from interrupt context. |
| 368 | * @prepare_message: set up the controller to transfer a single message, | 372 | * @prepare_message: set up the controller to transfer a single message, |
| @@ -488,6 +492,17 @@ struct spi_controller { · 119 unmodified lines | |||
| 488 | */ | 492 | */ |
| 489 | int (*setup)(struct spi_device *spi); | 493 | int (*setup)(struct spi_device *spi); |
| 490 | 494 | ||
| 495 | /* | ||
| 496 | * set_cs_timing() method is for SPI controllers that supports | ||
| 497 | * configuring CS timing. | ||
| 498 | * | ||
| 499 | * This hook allows SPI client drivers to request SPI controllers | ||
| 500 | * to configure specific CS timing through spi_set_cs_timing() after | ||
| 501 | * spi_setup(). | ||
| 502 | */ | ||
| 503 | void (*set_cs_timing)(struct spi_device *spi, u8 setup_clk_cycles, | ||
| 504 | u8 hold_clk_cycles, u8 inactive_clk_cycles); | ||
| 505 | |||
| 491 | /* bidirectional bulk transfers | 506 | /* bidirectional bulk transfers |
| 492 | * | 507 | * |
| 493 | * + The transfer() method may not sleep; its main role is | 508 | * + The transfer() method may not sleep; its main role is |