spi-davinci.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright 2009 Texas Instruments.
  4. */
  5. #ifndef __ARCH_ARM_DAVINCI_SPI_H
  6. #define __ARCH_ARM_DAVINCI_SPI_H
  7. #include <linux/platform_data/edma.h>
  8. #define SPI_INTERN_CS 0xFF
  9. enum {
  10. SPI_VERSION_1, /* For DM355/DM365/DM6467 */
  11. SPI_VERSION_2, /* For DA8xx */
  12. };
  13. /**
  14. * davinci_spi_platform_data - Platform data for SPI master device on DaVinci
  15. *
  16. * @version: version of the SPI IP. Different DaVinci devices have slightly
  17. * varying versions of the same IP.
  18. * @num_chipselect: number of chipselects supported by this SPI master
  19. * @intr_line: interrupt line used to connect the SPI IP to the ARM interrupt
  20. * controller withn the SoC. Possible values are 0 and 1.
  21. * @cshold_bug: set this to true if the SPI controller on your chip requires
  22. * a write to CSHOLD bit in between transfers (like in DM355).
  23. * @dma_event_q: DMA event queue to use if SPI_IO_TYPE_DMA is used for any
  24. * device on the bus.
  25. */
  26. struct davinci_spi_platform_data {
  27. u8 version;
  28. u8 num_chipselect;
  29. u8 intr_line;
  30. u8 prescaler_limit;
  31. bool cshold_bug;
  32. enum dma_event_q dma_event_q;
  33. };
  34. /**
  35. * davinci_spi_config - Per-chip-select configuration for SPI slave devices
  36. *
  37. * @wdelay: amount of delay between transmissions. Measured in number of
  38. * SPI module clocks.
  39. * @odd_parity: polarity of parity flag at the end of transmit data stream.
  40. * 0 - odd parity, 1 - even parity.
  41. * @parity_enable: enable transmission of parity at end of each transmit
  42. * data stream.
  43. * @io_type: type of IO transfer. Choose between polled, interrupt and DMA.
  44. * @timer_disable: disable chip-select timers (setup and hold)
  45. * @c2tdelay: chip-select setup time. Measured in number of SPI module clocks.
  46. * @t2cdelay: chip-select hold time. Measured in number of SPI module clocks.
  47. * @t2edelay: transmit data finished to SPI ENAn pin inactive time. Measured
  48. * in number of SPI clocks.
  49. * @c2edelay: chip-select active to SPI ENAn signal active time. Measured in
  50. * number of SPI clocks.
  51. */
  52. struct davinci_spi_config {
  53. u8 wdelay;
  54. u8 odd_parity;
  55. u8 parity_enable;
  56. #define SPI_IO_TYPE_INTR 0
  57. #define SPI_IO_TYPE_POLL 1
  58. #define SPI_IO_TYPE_DMA 2
  59. u8 io_type;
  60. u8 timer_disable;
  61. u8 c2tdelay;
  62. u8 t2cdelay;
  63. u8 t2edelay;
  64. u8 c2edelay;
  65. };
  66. #endif /* __ARCH_ARM_DAVINCI_SPI_H */