mcbsp.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. /*
  2. * arch/arm/plat-omap/include/mach/mcbsp.h
  3. *
  4. * Defines for Multi-Channel Buffered Serial Port
  5. *
  6. * Copyright (C) 2002 RidgeRun, Inc.
  7. * Author: Steve Johnson
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. */
  24. #ifndef __ASM_ARCH_OMAP_MCBSP_H
  25. #define __ASM_ARCH_OMAP_MCBSP_H
  26. #include <linux/completion.h>
  27. #include <linux/spinlock.h>
  28. #include <mach/hardware.h>
  29. #include <plat/clock.h>
  30. /* macro for building platform_device for McBSP ports */
  31. #define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \
  32. static struct platform_device omap_mcbsp##port_nr = { \
  33. .name = "omap-mcbsp-dai", \
  34. .id = OMAP_MCBSP##port_nr, \
  35. }
  36. #define MCBSP_CONFIG_TYPE2 0x2
  37. #define MCBSP_CONFIG_TYPE3 0x3
  38. #define MCBSP_CONFIG_TYPE4 0x4
  39. #define OMAP7XX_MCBSP1_BASE 0xfffb1000
  40. #define OMAP7XX_MCBSP2_BASE 0xfffb1800
  41. #define OMAP1510_MCBSP1_BASE 0xe1011800
  42. #define OMAP1510_MCBSP2_BASE 0xfffb1000
  43. #define OMAP1510_MCBSP3_BASE 0xe1017000
  44. #define OMAP1610_MCBSP1_BASE 0xe1011800
  45. #define OMAP1610_MCBSP2_BASE 0xfffb1000
  46. #define OMAP1610_MCBSP3_BASE 0xe1017000
  47. #ifdef CONFIG_ARCH_OMAP1
  48. #define OMAP_MCBSP_REG_DRR2 0x00
  49. #define OMAP_MCBSP_REG_DRR1 0x02
  50. #define OMAP_MCBSP_REG_DXR2 0x04
  51. #define OMAP_MCBSP_REG_DXR1 0x06
  52. #define OMAP_MCBSP_REG_DRR 0x02
  53. #define OMAP_MCBSP_REG_DXR 0x06
  54. #define OMAP_MCBSP_REG_SPCR2 0x08
  55. #define OMAP_MCBSP_REG_SPCR1 0x0a
  56. #define OMAP_MCBSP_REG_RCR2 0x0c
  57. #define OMAP_MCBSP_REG_RCR1 0x0e
  58. #define OMAP_MCBSP_REG_XCR2 0x10
  59. #define OMAP_MCBSP_REG_XCR1 0x12
  60. #define OMAP_MCBSP_REG_SRGR2 0x14
  61. #define OMAP_MCBSP_REG_SRGR1 0x16
  62. #define OMAP_MCBSP_REG_MCR2 0x18
  63. #define OMAP_MCBSP_REG_MCR1 0x1a
  64. #define OMAP_MCBSP_REG_RCERA 0x1c
  65. #define OMAP_MCBSP_REG_RCERB 0x1e
  66. #define OMAP_MCBSP_REG_XCERA 0x20
  67. #define OMAP_MCBSP_REG_XCERB 0x22
  68. #define OMAP_MCBSP_REG_PCR0 0x24
  69. #define OMAP_MCBSP_REG_RCERC 0x26
  70. #define OMAP_MCBSP_REG_RCERD 0x28
  71. #define OMAP_MCBSP_REG_XCERC 0x2A
  72. #define OMAP_MCBSP_REG_XCERD 0x2C
  73. #define OMAP_MCBSP_REG_RCERE 0x2E
  74. #define OMAP_MCBSP_REG_RCERF 0x30
  75. #define OMAP_MCBSP_REG_XCERE 0x32
  76. #define OMAP_MCBSP_REG_XCERF 0x34
  77. #define OMAP_MCBSP_REG_RCERG 0x36
  78. #define OMAP_MCBSP_REG_RCERH 0x38
  79. #define OMAP_MCBSP_REG_XCERG 0x3A
  80. #define OMAP_MCBSP_REG_XCERH 0x3C
  81. /* Dummy defines, these are not available on omap1 */
  82. #define OMAP_MCBSP_REG_XCCR 0x00
  83. #define OMAP_MCBSP_REG_RCCR 0x00
  84. #else
  85. #define OMAP_MCBSP_REG_DRR2 0x00
  86. #define OMAP_MCBSP_REG_DRR1 0x04
  87. #define OMAP_MCBSP_REG_DXR2 0x08
  88. #define OMAP_MCBSP_REG_DXR1 0x0C
  89. #define OMAP_MCBSP_REG_DRR 0x00
  90. #define OMAP_MCBSP_REG_DXR 0x08
  91. #define OMAP_MCBSP_REG_SPCR2 0x10
  92. #define OMAP_MCBSP_REG_SPCR1 0x14
  93. #define OMAP_MCBSP_REG_RCR2 0x18
  94. #define OMAP_MCBSP_REG_RCR1 0x1C
  95. #define OMAP_MCBSP_REG_XCR2 0x20
  96. #define OMAP_MCBSP_REG_XCR1 0x24
  97. #define OMAP_MCBSP_REG_SRGR2 0x28
  98. #define OMAP_MCBSP_REG_SRGR1 0x2C
  99. #define OMAP_MCBSP_REG_MCR2 0x30
  100. #define OMAP_MCBSP_REG_MCR1 0x34
  101. #define OMAP_MCBSP_REG_RCERA 0x38
  102. #define OMAP_MCBSP_REG_RCERB 0x3C
  103. #define OMAP_MCBSP_REG_XCERA 0x40
  104. #define OMAP_MCBSP_REG_XCERB 0x44
  105. #define OMAP_MCBSP_REG_PCR0 0x48
  106. #define OMAP_MCBSP_REG_RCERC 0x4C
  107. #define OMAP_MCBSP_REG_RCERD 0x50
  108. #define OMAP_MCBSP_REG_XCERC 0x54
  109. #define OMAP_MCBSP_REG_XCERD 0x58
  110. #define OMAP_MCBSP_REG_RCERE 0x5C
  111. #define OMAP_MCBSP_REG_RCERF 0x60
  112. #define OMAP_MCBSP_REG_XCERE 0x64
  113. #define OMAP_MCBSP_REG_XCERF 0x68
  114. #define OMAP_MCBSP_REG_RCERG 0x6C
  115. #define OMAP_MCBSP_REG_RCERH 0x70
  116. #define OMAP_MCBSP_REG_XCERG 0x74
  117. #define OMAP_MCBSP_REG_XCERH 0x78
  118. #define OMAP_MCBSP_REG_SYSCON 0x8C
  119. #define OMAP_MCBSP_REG_THRSH2 0x90
  120. #define OMAP_MCBSP_REG_THRSH1 0x94
  121. #define OMAP_MCBSP_REG_IRQST 0xA0
  122. #define OMAP_MCBSP_REG_IRQEN 0xA4
  123. #define OMAP_MCBSP_REG_WAKEUPEN 0xA8
  124. #define OMAP_MCBSP_REG_XCCR 0xAC
  125. #define OMAP_MCBSP_REG_RCCR 0xB0
  126. #define OMAP_MCBSP_REG_XBUFFSTAT 0xB4
  127. #define OMAP_MCBSP_REG_RBUFFSTAT 0xB8
  128. #define OMAP_MCBSP_REG_SSELCR 0xBC
  129. #define OMAP_ST_REG_REV 0x00
  130. #define OMAP_ST_REG_SYSCONFIG 0x10
  131. #define OMAP_ST_REG_IRQSTATUS 0x18
  132. #define OMAP_ST_REG_IRQENABLE 0x1C
  133. #define OMAP_ST_REG_SGAINCR 0x24
  134. #define OMAP_ST_REG_SFIRCR 0x28
  135. #define OMAP_ST_REG_SSELCR 0x2C
  136. #endif
  137. /************************** McBSP SPCR1 bit definitions ***********************/
  138. #define RRST 0x0001
  139. #define RRDY 0x0002
  140. #define RFULL 0x0004
  141. #define RSYNC_ERR 0x0008
  142. #define RINTM(value) ((value)<<4) /* bits 4:5 */
  143. #define ABIS 0x0040
  144. #define DXENA 0x0080
  145. #define CLKSTP(value) ((value)<<11) /* bits 11:12 */
  146. #define RJUST(value) ((value)<<13) /* bits 13:14 */
  147. #define ALB 0x8000
  148. #define DLB 0x8000
  149. /************************** McBSP SPCR2 bit definitions ***********************/
  150. #define XRST 0x0001
  151. #define XRDY 0x0002
  152. #define XEMPTY 0x0004
  153. #define XSYNC_ERR 0x0008
  154. #define XINTM(value) ((value)<<4) /* bits 4:5 */
  155. #define GRST 0x0040
  156. #define FRST 0x0080
  157. #define SOFT 0x0100
  158. #define FREE 0x0200
  159. /************************** McBSP PCR bit definitions *************************/
  160. #define CLKRP 0x0001
  161. #define CLKXP 0x0002
  162. #define FSRP 0x0004
  163. #define FSXP 0x0008
  164. #define DR_STAT 0x0010
  165. #define DX_STAT 0x0020
  166. #define CLKS_STAT 0x0040
  167. #define SCLKME 0x0080
  168. #define CLKRM 0x0100
  169. #define CLKXM 0x0200
  170. #define FSRM 0x0400
  171. #define FSXM 0x0800
  172. #define RIOEN 0x1000
  173. #define XIOEN 0x2000
  174. #define IDLE_EN 0x4000
  175. /************************** McBSP RCR1 bit definitions ************************/
  176. #define RWDLEN1(value) ((value)<<5) /* Bits 5:7 */
  177. #define RFRLEN1(value) ((value)<<8) /* Bits 8:14 */
  178. /************************** McBSP XCR1 bit definitions ************************/
  179. #define XWDLEN1(value) ((value)<<5) /* Bits 5:7 */
  180. #define XFRLEN1(value) ((value)<<8) /* Bits 8:14 */
  181. /*************************** McBSP RCR2 bit definitions ***********************/
  182. #define RDATDLY(value) (value) /* Bits 0:1 */
  183. #define RFIG 0x0004
  184. #define RCOMPAND(value) ((value)<<3) /* Bits 3:4 */
  185. #define RWDLEN2(value) ((value)<<5) /* Bits 5:7 */
  186. #define RFRLEN2(value) ((value)<<8) /* Bits 8:14 */
  187. #define RPHASE 0x8000
  188. /*************************** McBSP XCR2 bit definitions ***********************/
  189. #define XDATDLY(value) (value) /* Bits 0:1 */
  190. #define XFIG 0x0004
  191. #define XCOMPAND(value) ((value)<<3) /* Bits 3:4 */
  192. #define XWDLEN2(value) ((value)<<5) /* Bits 5:7 */
  193. #define XFRLEN2(value) ((value)<<8) /* Bits 8:14 */
  194. #define XPHASE 0x8000
  195. /************************* McBSP SRGR1 bit definitions ************************/
  196. #define CLKGDV(value) (value) /* Bits 0:7 */
  197. #define FWID(value) ((value)<<8) /* Bits 8:15 */
  198. /************************* McBSP SRGR2 bit definitions ************************/
  199. #define FPER(value) (value) /* Bits 0:11 */
  200. #define FSGM 0x1000
  201. #define CLKSM 0x2000
  202. #define CLKSP 0x4000
  203. #define GSYNC 0x8000
  204. /************************* McBSP MCR1 bit definitions *************************/
  205. #define RMCM 0x0001
  206. #define RCBLK(value) ((value)<<2) /* Bits 2:4 */
  207. #define RPABLK(value) ((value)<<5) /* Bits 5:6 */
  208. #define RPBBLK(value) ((value)<<7) /* Bits 7:8 */
  209. /************************* McBSP MCR2 bit definitions *************************/
  210. #define XMCM(value) (value) /* Bits 0:1 */
  211. #define XCBLK(value) ((value)<<2) /* Bits 2:4 */
  212. #define XPABLK(value) ((value)<<5) /* Bits 5:6 */
  213. #define XPBBLK(value) ((value)<<7) /* Bits 7:8 */
  214. /*********************** McBSP XCCR bit definitions *************************/
  215. #define EXTCLKGATE 0x8000
  216. #define PPCONNECT 0x4000
  217. #define DXENDLY(value) ((value)<<12) /* Bits 12:13 */
  218. #define XFULL_CYCLE 0x0800
  219. #define DILB 0x0020
  220. #define XDMAEN 0x0008
  221. #define XDISABLE 0x0001
  222. /********************** McBSP RCCR bit definitions *************************/
  223. #define RFULL_CYCLE 0x0800
  224. #define RDMAEN 0x0008
  225. #define RDISABLE 0x0001
  226. /********************** McBSP SYSCONFIG bit definitions ********************/
  227. #define CLOCKACTIVITY(value) ((value)<<8)
  228. #define SIDLEMODE(value) ((value)<<3)
  229. #define ENAWAKEUP 0x0004
  230. #define SOFTRST 0x0002
  231. /********************** McBSP SSELCR bit definitions ***********************/
  232. #define SIDETONEEN 0x0400
  233. /********************** McBSP Sidetone SYSCONFIG bit definitions ***********/
  234. #define ST_AUTOIDLE 0x0001
  235. /********************** McBSP Sidetone SGAINCR bit definitions *************/
  236. #define ST_CH1GAIN(value) ((value<<16)) /* Bits 16:31 */
  237. #define ST_CH0GAIN(value) (value) /* Bits 0:15 */
  238. /********************** McBSP Sidetone SFIRCR bit definitions **************/
  239. #define ST_FIRCOEFF(value) (value) /* Bits 0:15 */
  240. /********************** McBSP Sidetone SSELCR bit definitions **************/
  241. #define ST_COEFFWRDONE 0x0004
  242. #define ST_COEFFWREN 0x0002
  243. #define ST_SIDETONEEN 0x0001
  244. /********************** McBSP DMA operating modes **************************/
  245. #define MCBSP_DMA_MODE_ELEMENT 0
  246. #define MCBSP_DMA_MODE_THRESHOLD 1
  247. #define MCBSP_DMA_MODE_FRAME 2
  248. /********************** McBSP WAKEUPEN bit definitions *********************/
  249. #define XEMPTYEOFEN 0x4000
  250. #define XRDYEN 0x0400
  251. #define XEOFEN 0x0200
  252. #define XFSXEN 0x0100
  253. #define XSYNCERREN 0x0080
  254. #define RRDYEN 0x0008
  255. #define REOFEN 0x0004
  256. #define RFSREN 0x0002
  257. #define RSYNCERREN 0x0001
  258. /* CLKR signal muxing options */
  259. #define CLKR_SRC_CLKR 0
  260. #define CLKR_SRC_CLKX 1
  261. /* FSR signal muxing options */
  262. #define FSR_SRC_FSR 0
  263. #define FSR_SRC_FSX 1
  264. /* McBSP functional clock sources */
  265. #define MCBSP_CLKS_PRCM_SRC 0
  266. #define MCBSP_CLKS_PAD_SRC 1
  267. /* we don't do multichannel for now */
  268. struct omap_mcbsp_reg_cfg {
  269. u16 spcr2;
  270. u16 spcr1;
  271. u16 rcr2;
  272. u16 rcr1;
  273. u16 xcr2;
  274. u16 xcr1;
  275. u16 srgr2;
  276. u16 srgr1;
  277. u16 mcr2;
  278. u16 mcr1;
  279. u16 pcr0;
  280. u16 rcerc;
  281. u16 rcerd;
  282. u16 xcerc;
  283. u16 xcerd;
  284. u16 rcere;
  285. u16 rcerf;
  286. u16 xcere;
  287. u16 xcerf;
  288. u16 rcerg;
  289. u16 rcerh;
  290. u16 xcerg;
  291. u16 xcerh;
  292. u16 xccr;
  293. u16 rccr;
  294. };
  295. typedef enum {
  296. OMAP_MCBSP1 = 0,
  297. OMAP_MCBSP2,
  298. OMAP_MCBSP3,
  299. OMAP_MCBSP4,
  300. OMAP_MCBSP5
  301. } omap_mcbsp_id;
  302. typedef int __bitwise omap_mcbsp_io_type_t;
  303. #define OMAP_MCBSP_IRQ_IO ((__force omap_mcbsp_io_type_t) 1)
  304. #define OMAP_MCBSP_POLL_IO ((__force omap_mcbsp_io_type_t) 2)
  305. typedef enum {
  306. OMAP_MCBSP_WORD_8 = 0,
  307. OMAP_MCBSP_WORD_12,
  308. OMAP_MCBSP_WORD_16,
  309. OMAP_MCBSP_WORD_20,
  310. OMAP_MCBSP_WORD_24,
  311. OMAP_MCBSP_WORD_32,
  312. } omap_mcbsp_word_length;
  313. typedef enum {
  314. OMAP_MCBSP_CLK_RISING = 0,
  315. OMAP_MCBSP_CLK_FALLING,
  316. } omap_mcbsp_clk_polarity;
  317. typedef enum {
  318. OMAP_MCBSP_FS_ACTIVE_HIGH = 0,
  319. OMAP_MCBSP_FS_ACTIVE_LOW,
  320. } omap_mcbsp_fs_polarity;
  321. typedef enum {
  322. OMAP_MCBSP_CLK_STP_MODE_NO_DELAY = 0,
  323. OMAP_MCBSP_CLK_STP_MODE_DELAY,
  324. } omap_mcbsp_clk_stp_mode;
  325. /******* SPI specific mode **********/
  326. typedef enum {
  327. OMAP_MCBSP_SPI_MASTER = 0,
  328. OMAP_MCBSP_SPI_SLAVE,
  329. } omap_mcbsp_spi_mode;
  330. struct omap_mcbsp_spi_cfg {
  331. omap_mcbsp_spi_mode spi_mode;
  332. omap_mcbsp_clk_polarity rx_clock_polarity;
  333. omap_mcbsp_clk_polarity tx_clock_polarity;
  334. omap_mcbsp_fs_polarity fsx_polarity;
  335. u8 clk_div;
  336. omap_mcbsp_clk_stp_mode clk_stp_mode;
  337. omap_mcbsp_word_length word_length;
  338. };
  339. /* Platform specific configuration */
  340. struct omap_mcbsp_ops {
  341. void (*request)(unsigned int);
  342. void (*free)(unsigned int);
  343. int (*set_clks_src)(u8, u8);
  344. };
  345. struct omap_mcbsp_platform_data {
  346. unsigned long phys_base;
  347. u8 dma_rx_sync, dma_tx_sync;
  348. u16 rx_irq, tx_irq;
  349. struct omap_mcbsp_ops *ops;
  350. #ifdef CONFIG_ARCH_OMAP3
  351. /* Sidetone block for McBSP 2 and 3 */
  352. unsigned long phys_base_st;
  353. #endif
  354. u16 buffer_size;
  355. unsigned int mcbsp_config_type;
  356. };
  357. struct omap_mcbsp_st_data {
  358. void __iomem *io_base_st;
  359. bool running;
  360. bool enabled;
  361. s16 taps[128]; /* Sidetone filter coefficients */
  362. int nr_taps; /* Number of filter coefficients in use */
  363. s16 ch0gain;
  364. s16 ch1gain;
  365. };
  366. struct omap_mcbsp {
  367. struct device *dev;
  368. unsigned long phys_base;
  369. unsigned long phys_dma_base;
  370. void __iomem *io_base;
  371. u8 id;
  372. u8 free;
  373. omap_mcbsp_word_length rx_word_length;
  374. omap_mcbsp_word_length tx_word_length;
  375. omap_mcbsp_io_type_t io_type; /* IRQ or poll */
  376. /* IRQ based TX/RX */
  377. int rx_irq;
  378. int tx_irq;
  379. /* DMA stuff */
  380. u8 dma_rx_sync;
  381. short dma_rx_lch;
  382. u8 dma_tx_sync;
  383. short dma_tx_lch;
  384. /* Completion queues */
  385. struct completion tx_irq_completion;
  386. struct completion rx_irq_completion;
  387. struct completion tx_dma_completion;
  388. struct completion rx_dma_completion;
  389. /* Protect the field .free, while checking if the mcbsp is in use */
  390. spinlock_t lock;
  391. struct omap_mcbsp_platform_data *pdata;
  392. struct clk *fclk;
  393. #ifdef CONFIG_ARCH_OMAP3
  394. struct omap_mcbsp_st_data *st_data;
  395. int dma_op_mode;
  396. u16 max_tx_thres;
  397. u16 max_rx_thres;
  398. #endif
  399. void *reg_cache;
  400. unsigned int mcbsp_config_type;
  401. };
  402. /**
  403. * omap_mcbsp_dev_attr - OMAP McBSP device attributes for omap_hwmod
  404. * @sidetone: name of the sidetone device
  405. */
  406. struct omap_mcbsp_dev_attr {
  407. const char *sidetone;
  408. };
  409. extern struct omap_mcbsp **mcbsp_ptr;
  410. extern int omap_mcbsp_count, omap_mcbsp_cache_size;
  411. #define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
  412. #define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
  413. int omap_mcbsp_init(void);
  414. void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
  415. struct omap_mcbsp_platform_data *config, int size);
  416. void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
  417. #ifdef CONFIG_ARCH_OMAP3
  418. void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
  419. void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
  420. u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
  421. u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
  422. u16 omap_mcbsp_get_fifo_size(unsigned int id);
  423. u16 omap_mcbsp_get_tx_delay(unsigned int id);
  424. u16 omap_mcbsp_get_rx_delay(unsigned int id);
  425. int omap_mcbsp_get_dma_op_mode(unsigned int id);
  426. #else
  427. static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
  428. { }
  429. static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
  430. { }
  431. static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
  432. static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
  433. static inline u16 omap_mcbsp_get_fifo_size(unsigned int id) { return 0; }
  434. static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; }
  435. static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; }
  436. static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
  437. #endif
  438. int omap_mcbsp_request(unsigned int id);
  439. void omap_mcbsp_free(unsigned int id);
  440. void omap_mcbsp_start(unsigned int id, int tx, int rx);
  441. void omap_mcbsp_stop(unsigned int id, int tx, int rx);
  442. void omap_mcbsp_xmit_word(unsigned int id, u32 word);
  443. u32 omap_mcbsp_recv_word(unsigned int id);
  444. int omap_mcbsp_xmit_buffer(unsigned int id, dma_addr_t buffer, unsigned int length);
  445. int omap_mcbsp_recv_buffer(unsigned int id, dma_addr_t buffer, unsigned int length);
  446. int omap_mcbsp_spi_master_xmit_word_poll(unsigned int id, u32 word);
  447. int omap_mcbsp_spi_master_recv_word_poll(unsigned int id, u32 * word);
  448. /* McBSP functional clock source changing function */
  449. extern int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id);
  450. /* SPI specific API */
  451. void omap_mcbsp_set_spi_mode(unsigned int id, const struct omap_mcbsp_spi_cfg * spi_cfg);
  452. /* Polled read/write functions */
  453. int omap_mcbsp_pollread(unsigned int id, u16 * buf);
  454. int omap_mcbsp_pollwrite(unsigned int id, u16 buf);
  455. int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type);
  456. /* McBSP signal muxing API */
  457. void omap2_mcbsp1_mux_clkr_src(u8 mux);
  458. void omap2_mcbsp1_mux_fsr_src(u8 mux);
  459. int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream);
  460. int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream);
  461. #ifdef CONFIG_ARCH_OMAP3
  462. /* Sidetone specific API */
  463. int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
  464. int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain);
  465. int omap_st_enable(unsigned int id);
  466. int omap_st_disable(unsigned int id);
  467. int omap_st_is_enabled(unsigned int id);
  468. #else
  469. static inline int omap_st_set_chgain(unsigned int id, int channel,
  470. s16 chgain) { return 0; }
  471. static inline int omap_st_get_chgain(unsigned int id, int channel,
  472. s16 *chgain) { return 0; }
  473. static inline int omap_st_enable(unsigned int id) { return 0; }
  474. static inline int omap_st_disable(unsigned int id) { return 0; }
  475. static inline int omap_st_is_enabled(unsigned int id) { return 0; }
  476. #endif
  477. #endif