bfin5xx_spi.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /************************************************************
  2. *
  3. * Copyright (C) 2004, Analog Devices. All Rights Reserved
  4. *
  5. * FILE bfin5xx_spi.h
  6. * PROGRAMMER(S): Luke Yang (Analog Devices Inc.)
  7. *
  8. *
  9. * DATE OF CREATION: March. 10th 2006
  10. *
  11. * SYNOPSIS:
  12. *
  13. * DESCRIPTION: header file for SPI controller driver for Blackfin5xx.
  14. **************************************************************
  15. * MODIFICATION HISTORY:
  16. * March 10, 2006 bfin5xx_spi.h Created. (Luke Yang)
  17. ************************************************************/
  18. #ifndef _SPI_CHANNEL_H_
  19. #define _SPI_CHANNEL_H_
  20. #define SPI_READ 0
  21. #define SPI_WRITE 1
  22. #define SPI_CTRL_OFF 0x0
  23. #define SPI_FLAG_OFF 0x4
  24. #define SPI_STAT_OFF 0x8
  25. #define SPI_TXBUFF_OFF 0xc
  26. #define SPI_RXBUFF_OFF 0x10
  27. #define SPI_BAUD_OFF 0x14
  28. #define SPI_SHAW_OFF 0x18
  29. #define CMD_SPI_OUT_ENABLE 1
  30. #define CMD_SPI_SET_BAUDRATE 2
  31. #define CMD_SPI_SET_POLAR 3
  32. #define CMD_SPI_SET_PHASE 4
  33. #define CMD_SPI_SET_MASTER 5
  34. #define CMD_SPI_SET_SENDOPT 6
  35. #define CMD_SPI_SET_RECVOPT 7
  36. #define CMD_SPI_SET_ORDER 8
  37. #define CMD_SPI_SET_LENGTH16 9
  38. #define CMD_SPI_GET_STAT 11
  39. #define CMD_SPI_GET_CFG 12
  40. #define CMD_SPI_SET_CSAVAIL 13
  41. #define CMD_SPI_SET_CSHIGH 14 /* CS unavail */
  42. #define CMD_SPI_SET_CSLOW 15 /* CS avail */
  43. #define CMD_SPI_MISO_ENABLE 16
  44. #define CMD_SPI_SET_CSENABLE 17
  45. #define CMD_SPI_SET_CSDISABLE 18
  46. #define CMD_SPI_SET_TRIGGER_MODE 19
  47. #define CMD_SPI_SET_TRIGGER_SENSE 20
  48. #define CMD_SPI_SET_TRIGGER_EDGE 21
  49. #define CMD_SPI_SET_TRIGGER_LEVEL 22
  50. #define CMD_SPI_SET_TIME_SPS 23
  51. #define CMD_SPI_SET_TIME_SAMPLES 24
  52. #define CMD_SPI_GET_SYSTEMCLOCK 25
  53. #define CMD_SPI_SET_WRITECONTINUOUS 26
  54. #define CMD_SPI_SET_SKFS 27
  55. #define CMD_SPI_GET_ALLCONFIG 32 /* For debug */
  56. #define SPI_DEFAULT_BARD 0x0100
  57. #define SPI0_IRQ_NUM IRQ_SPI
  58. #define SPI_ERR_TRIG -1
  59. #define BIT_CTL_ENABLE 0x4000
  60. #define BIT_CTL_OPENDRAIN 0x2000
  61. #define BIT_CTL_MASTER 0x1000
  62. #define BIT_CTL_POLAR 0x0800
  63. #define BIT_CTL_PHASE 0x0400
  64. #define BIT_CTL_BITORDER 0x0200
  65. #define BIT_CTL_WORDSIZE 0x0100
  66. #define BIT_CTL_MISOENABLE 0x0020
  67. #define BIT_CTL_RXMOD 0x0000
  68. #define BIT_CTL_TXMOD 0x0001
  69. #define BIT_CTL_TIMOD_DMA_TX 0x0003
  70. #define BIT_CTL_TIMOD_DMA_RX 0x0002
  71. #define BIT_CTL_SENDOPT 0x0004
  72. #define BIT_CTL_TIMOD 0x0003
  73. #define BIT_STAT_SPIF 0x0001
  74. #define BIT_STAT_MODF 0x0002
  75. #define BIT_STAT_TXE 0x0004
  76. #define BIT_STAT_TXS 0x0008
  77. #define BIT_STAT_RBSY 0x0010
  78. #define BIT_STAT_RXS 0x0020
  79. #define BIT_STAT_TXCOL 0x0040
  80. #define BIT_STAT_CLR 0xFFFF
  81. #define BIT_STU_SENDOVER 0x0001
  82. #define BIT_STU_RECVFULL 0x0020
  83. #define CFG_SPI_ENABLE 1
  84. #define CFG_SPI_DISABLE 0
  85. #define CFG_SPI_OUTENABLE 1
  86. #define CFG_SPI_OUTDISABLE 0
  87. #define CFG_SPI_ACTLOW 1
  88. #define CFG_SPI_ACTHIGH 0
  89. #define CFG_SPI_PHASESTART 1
  90. #define CFG_SPI_PHASEMID 0
  91. #define CFG_SPI_MASTER 1
  92. #define CFG_SPI_SLAVE 0
  93. #define CFG_SPI_SENELAST 0
  94. #define CFG_SPI_SENDZERO 1
  95. #define CFG_SPI_RCVFLUSH 1
  96. #define CFG_SPI_RCVDISCARD 0
  97. #define CFG_SPI_LSBFIRST 1
  98. #define CFG_SPI_MSBFIRST 0
  99. #define CFG_SPI_WORDSIZE16 1
  100. #define CFG_SPI_WORDSIZE8 0
  101. #define CFG_SPI_MISOENABLE 1
  102. #define CFG_SPI_MISODISABLE 0
  103. #define CFG_SPI_READ 0x00
  104. #define CFG_SPI_WRITE 0x01
  105. #define CFG_SPI_DMAREAD 0x02
  106. #define CFG_SPI_DMAWRITE 0x03
  107. #define CFG_SPI_CSCLEARALL 0
  108. #define CFG_SPI_CHIPSEL1 1
  109. #define CFG_SPI_CHIPSEL2 2
  110. #define CFG_SPI_CHIPSEL3 3
  111. #define CFG_SPI_CHIPSEL4 4
  112. #define CFG_SPI_CHIPSEL5 5
  113. #define CFG_SPI_CHIPSEL6 6
  114. #define CFG_SPI_CHIPSEL7 7
  115. #define CFG_SPI_CS1VALUE 1
  116. #define CFG_SPI_CS2VALUE 2
  117. #define CFG_SPI_CS3VALUE 3
  118. #define CFG_SPI_CS4VALUE 4
  119. #define CFG_SPI_CS5VALUE 5
  120. #define CFG_SPI_CS6VALUE 6
  121. #define CFG_SPI_CS7VALUE 7
  122. /* device.platform_data for SSP controller devices */
  123. struct bfin5xx_spi_master {
  124. u16 num_chipselect;
  125. u8 enable_dma;
  126. u16 pin_req[4];
  127. };
  128. /* spi_board_info.controller_data for SPI slave devices,
  129. * copied to spi_device.platform_data ... mostly for dma tuning
  130. */
  131. struct bfin5xx_spi_chip {
  132. u16 ctl_reg;
  133. u8 enable_dma;
  134. u8 bits_per_word;
  135. u8 cs_change_per_word;
  136. u16 cs_chg_udelay; /* Some devices require 16-bit delays */
  137. };
  138. #endif /* _SPI_CHANNEL_H_ */