blob: 9882c657b2d4f80b3e85cb36f64082311612d3e0 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
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
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <linux/spinlock.h>
28
29#include <mach/hardware.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070030#include <plat/clock.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010031
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000032/* macro for building platform_device for McBSP ports */
33#define OMAP_MCBSP_PLATFORM_DEVICE(port_nr) \
34static struct platform_device omap_mcbsp##port_nr = { \
35 .name = "omap-mcbsp-dai", \
Jarkko Nikulafd1ee392011-07-01 08:52:27 +000036 .id = port_nr - 1, \
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000037}
38
Charulatha V37801b32011-02-24 12:51:46 -080039#define MCBSP_CONFIG_TYPE2 0x2
Charulatha Vdc48e5f2011-02-24 15:16:49 +053040#define MCBSP_CONFIG_TYPE3 0x3
Kishon Vijay Abraham Icb7e9de2011-02-24 15:16:50 +053041#define MCBSP_CONFIG_TYPE4 0x4
Charulatha V37801b32011-02-24 12:51:46 -080042
Alistair Buxton7c006922009-09-22 10:02:58 +010043#define OMAP7XX_MCBSP1_BASE 0xfffb1000
44#define OMAP7XX_MCBSP2_BASE 0xfffb1800
Russell Kinga09e64f2008-08-05 16:14:15 +010045
46#define OMAP1510_MCBSP1_BASE 0xe1011800
47#define OMAP1510_MCBSP2_BASE 0xfffb1000
48#define OMAP1510_MCBSP3_BASE 0xe1017000
49
50#define OMAP1610_MCBSP1_BASE 0xe1011800
51#define OMAP1610_MCBSP2_BASE 0xfffb1000
52#define OMAP1610_MCBSP3_BASE 0xe1017000
53
Kishon Vijay Abraham Ib1766542011-02-24 15:16:57 +053054#ifdef CONFIG_ARCH_OMAP1
Russell Kinga09e64f2008-08-05 16:14:15 +010055
56#define OMAP_MCBSP_REG_DRR2 0x00
57#define OMAP_MCBSP_REG_DRR1 0x02
58#define OMAP_MCBSP_REG_DXR2 0x04
59#define OMAP_MCBSP_REG_DXR1 0x06
Kishon Vijay Abraham I9504ba62011-02-24 15:16:55 +053060#define OMAP_MCBSP_REG_DRR 0x02
61#define OMAP_MCBSP_REG_DXR 0x06
Russell Kinga09e64f2008-08-05 16:14:15 +010062#define OMAP_MCBSP_REG_SPCR2 0x08
63#define OMAP_MCBSP_REG_SPCR1 0x0a
64#define OMAP_MCBSP_REG_RCR2 0x0c
65#define OMAP_MCBSP_REG_RCR1 0x0e
66#define OMAP_MCBSP_REG_XCR2 0x10
67#define OMAP_MCBSP_REG_XCR1 0x12
68#define OMAP_MCBSP_REG_SRGR2 0x14
69#define OMAP_MCBSP_REG_SRGR1 0x16
70#define OMAP_MCBSP_REG_MCR2 0x18
71#define OMAP_MCBSP_REG_MCR1 0x1a
72#define OMAP_MCBSP_REG_RCERA 0x1c
73#define OMAP_MCBSP_REG_RCERB 0x1e
74#define OMAP_MCBSP_REG_XCERA 0x20
75#define OMAP_MCBSP_REG_XCERB 0x22
76#define OMAP_MCBSP_REG_PCR0 0x24
77#define OMAP_MCBSP_REG_RCERC 0x26
78#define OMAP_MCBSP_REG_RCERD 0x28
79#define OMAP_MCBSP_REG_XCERC 0x2A
80#define OMAP_MCBSP_REG_XCERD 0x2C
81#define OMAP_MCBSP_REG_RCERE 0x2E
82#define OMAP_MCBSP_REG_RCERF 0x30
83#define OMAP_MCBSP_REG_XCERE 0x32
84#define OMAP_MCBSP_REG_XCERF 0x34
85#define OMAP_MCBSP_REG_RCERG 0x36
86#define OMAP_MCBSP_REG_RCERH 0x38
87#define OMAP_MCBSP_REG_XCERG 0x3A
88#define OMAP_MCBSP_REG_XCERH 0x3C
89
Tony Lindgren3127f8f2009-01-15 13:09:54 +020090/* Dummy defines, these are not available on omap1 */
91#define OMAP_MCBSP_REG_XCCR 0x00
92#define OMAP_MCBSP_REG_RCCR 0x00
93
Tony Lindgren140455f2010-02-12 12:26:48 -080094#else
Russell Kinga09e64f2008-08-05 16:14:15 +010095
96#define OMAP_MCBSP_REG_DRR2 0x00
97#define OMAP_MCBSP_REG_DRR1 0x04
98#define OMAP_MCBSP_REG_DXR2 0x08
99#define OMAP_MCBSP_REG_DXR1 0x0C
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300100#define OMAP_MCBSP_REG_DRR 0x00
101#define OMAP_MCBSP_REG_DXR 0x08
Russell Kinga09e64f2008-08-05 16:14:15 +0100102#define OMAP_MCBSP_REG_SPCR2 0x10
103#define OMAP_MCBSP_REG_SPCR1 0x14
104#define OMAP_MCBSP_REG_RCR2 0x18
105#define OMAP_MCBSP_REG_RCR1 0x1C
106#define OMAP_MCBSP_REG_XCR2 0x20
107#define OMAP_MCBSP_REG_XCR1 0x24
108#define OMAP_MCBSP_REG_SRGR2 0x28
109#define OMAP_MCBSP_REG_SRGR1 0x2C
110#define OMAP_MCBSP_REG_MCR2 0x30
111#define OMAP_MCBSP_REG_MCR1 0x34
112#define OMAP_MCBSP_REG_RCERA 0x38
113#define OMAP_MCBSP_REG_RCERB 0x3C
114#define OMAP_MCBSP_REG_XCERA 0x40
115#define OMAP_MCBSP_REG_XCERB 0x44
116#define OMAP_MCBSP_REG_PCR0 0x48
117#define OMAP_MCBSP_REG_RCERC 0x4C
118#define OMAP_MCBSP_REG_RCERD 0x50
119#define OMAP_MCBSP_REG_XCERC 0x54
120#define OMAP_MCBSP_REG_XCERD 0x58
121#define OMAP_MCBSP_REG_RCERE 0x5C
122#define OMAP_MCBSP_REG_RCERF 0x60
123#define OMAP_MCBSP_REG_XCERE 0x64
124#define OMAP_MCBSP_REG_XCERF 0x68
125#define OMAP_MCBSP_REG_RCERG 0x6C
126#define OMAP_MCBSP_REG_RCERH 0x70
127#define OMAP_MCBSP_REG_XCERG 0x74
128#define OMAP_MCBSP_REG_XCERH 0x78
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300129#define OMAP_MCBSP_REG_SYSCON 0x8C
Eduardo Valentin946a49a2009-08-20 16:18:08 +0300130#define OMAP_MCBSP_REG_THRSH2 0x90
131#define OMAP_MCBSP_REG_THRSH1 0x94
132#define OMAP_MCBSP_REG_IRQST 0xA0
133#define OMAP_MCBSP_REG_IRQEN 0xA4
Eero Nurkkala2122fdc2009-08-20 16:18:15 +0300134#define OMAP_MCBSP_REG_WAKEUPEN 0xA8
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300135#define OMAP_MCBSP_REG_XCCR 0xAC
136#define OMAP_MCBSP_REG_RCCR 0xB0
Peter Ujfalusi7dc976e2010-03-03 15:08:08 +0200137#define OMAP_MCBSP_REG_XBUFFSTAT 0xB4
138#define OMAP_MCBSP_REG_RBUFFSTAT 0xB8
Eero Nurkkalad912fa92010-02-22 12:21:11 +0000139#define OMAP_MCBSP_REG_SSELCR 0xBC
140
141#define OMAP_ST_REG_REV 0x00
142#define OMAP_ST_REG_SYSCONFIG 0x10
143#define OMAP_ST_REG_IRQSTATUS 0x18
144#define OMAP_ST_REG_IRQENABLE 0x1C
145#define OMAP_ST_REG_SGAINCR 0x24
146#define OMAP_ST_REG_SFIRCR 0x28
147#define OMAP_ST_REG_SSELCR 0x2C
Russell Kinga09e64f2008-08-05 16:14:15 +0100148
Russell Kinga09e64f2008-08-05 16:14:15 +0100149#endif
150
Russell Kinga09e64f2008-08-05 16:14:15 +0100151/************************** McBSP SPCR1 bit definitions ***********************/
152#define RRST 0x0001
153#define RRDY 0x0002
154#define RFULL 0x0004
155#define RSYNC_ERR 0x0008
156#define RINTM(value) ((value)<<4) /* bits 4:5 */
157#define ABIS 0x0040
158#define DXENA 0x0080
159#define CLKSTP(value) ((value)<<11) /* bits 11:12 */
160#define RJUST(value) ((value)<<13) /* bits 13:14 */
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300161#define ALB 0x8000
Russell Kinga09e64f2008-08-05 16:14:15 +0100162#define DLB 0x8000
163
164/************************** McBSP SPCR2 bit definitions ***********************/
165#define XRST 0x0001
166#define XRDY 0x0002
167#define XEMPTY 0x0004
168#define XSYNC_ERR 0x0008
169#define XINTM(value) ((value)<<4) /* bits 4:5 */
170#define GRST 0x0040
171#define FRST 0x0080
172#define SOFT 0x0100
173#define FREE 0x0200
174
175/************************** McBSP PCR bit definitions *************************/
176#define CLKRP 0x0001
177#define CLKXP 0x0002
178#define FSRP 0x0004
179#define FSXP 0x0008
180#define DR_STAT 0x0010
181#define DX_STAT 0x0020
182#define CLKS_STAT 0x0040
183#define SCLKME 0x0080
184#define CLKRM 0x0100
185#define CLKXM 0x0200
186#define FSRM 0x0400
187#define FSXM 0x0800
188#define RIOEN 0x1000
189#define XIOEN 0x2000
190#define IDLE_EN 0x4000
191
192/************************** McBSP RCR1 bit definitions ************************/
193#define RWDLEN1(value) ((value)<<5) /* Bits 5:7 */
194#define RFRLEN1(value) ((value)<<8) /* Bits 8:14 */
195
196/************************** McBSP XCR1 bit definitions ************************/
197#define XWDLEN1(value) ((value)<<5) /* Bits 5:7 */
198#define XFRLEN1(value) ((value)<<8) /* Bits 8:14 */
199
200/*************************** McBSP RCR2 bit definitions ***********************/
201#define RDATDLY(value) (value) /* Bits 0:1 */
202#define RFIG 0x0004
203#define RCOMPAND(value) ((value)<<3) /* Bits 3:4 */
204#define RWDLEN2(value) ((value)<<5) /* Bits 5:7 */
205#define RFRLEN2(value) ((value)<<8) /* Bits 8:14 */
206#define RPHASE 0x8000
207
208/*************************** McBSP XCR2 bit definitions ***********************/
209#define XDATDLY(value) (value) /* Bits 0:1 */
210#define XFIG 0x0004
211#define XCOMPAND(value) ((value)<<3) /* Bits 3:4 */
212#define XWDLEN2(value) ((value)<<5) /* Bits 5:7 */
213#define XFRLEN2(value) ((value)<<8) /* Bits 8:14 */
214#define XPHASE 0x8000
215
216/************************* McBSP SRGR1 bit definitions ************************/
217#define CLKGDV(value) (value) /* Bits 0:7 */
218#define FWID(value) ((value)<<8) /* Bits 8:15 */
219
220/************************* McBSP SRGR2 bit definitions ************************/
221#define FPER(value) (value) /* Bits 0:11 */
222#define FSGM 0x1000
223#define CLKSM 0x2000
224#define CLKSP 0x4000
225#define GSYNC 0x8000
226
227/************************* McBSP MCR1 bit definitions *************************/
228#define RMCM 0x0001
229#define RCBLK(value) ((value)<<2) /* Bits 2:4 */
230#define RPABLK(value) ((value)<<5) /* Bits 5:6 */
231#define RPBBLK(value) ((value)<<7) /* Bits 7:8 */
232
233/************************* McBSP MCR2 bit definitions *************************/
234#define XMCM(value) (value) /* Bits 0:1 */
235#define XCBLK(value) ((value)<<2) /* Bits 2:4 */
236#define XPABLK(value) ((value)<<5) /* Bits 5:6 */
237#define XPBBLK(value) ((value)<<7) /* Bits 7:8 */
238
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300239/*********************** McBSP XCCR bit definitions *************************/
Tony Lindgren3127f8f2009-01-15 13:09:54 +0200240#define EXTCLKGATE 0x8000
241#define PPCONNECT 0x4000
242#define DXENDLY(value) ((value)<<12) /* Bits 12:13 */
243#define XFULL_CYCLE 0x0800
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300244#define DILB 0x0020
245#define XDMAEN 0x0008
246#define XDISABLE 0x0001
247
248/********************** McBSP RCCR bit definitions *************************/
Tony Lindgren3127f8f2009-01-15 13:09:54 +0200249#define RFULL_CYCLE 0x0800
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300250#define RDMAEN 0x0008
251#define RDISABLE 0x0001
252
253/********************** McBSP SYSCONFIG bit definitions ********************/
Eero Nurkkala2ba93f82009-08-20 16:18:17 +0300254#define CLOCKACTIVITY(value) ((value)<<8)
Eero Nurkkala2122fdc2009-08-20 16:18:15 +0300255#define SIDLEMODE(value) ((value)<<3)
256#define ENAWAKEUP 0x0004
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300257#define SOFTRST 0x0002
Russell Kinga09e64f2008-08-05 16:14:15 +0100258
Eero Nurkkalad912fa92010-02-22 12:21:11 +0000259/********************** McBSP SSELCR bit definitions ***********************/
260#define SIDETONEEN 0x0400
261
262/********************** McBSP Sidetone SYSCONFIG bit definitions ***********/
263#define ST_AUTOIDLE 0x0001
264
265/********************** McBSP Sidetone SGAINCR bit definitions *************/
266#define ST_CH1GAIN(value) ((value<<16)) /* Bits 16:31 */
267#define ST_CH0GAIN(value) (value) /* Bits 0:15 */
268
269/********************** McBSP Sidetone SFIRCR bit definitions **************/
270#define ST_FIRCOEFF(value) (value) /* Bits 0:15 */
271
272/********************** McBSP Sidetone SSELCR bit definitions **************/
273#define ST_COEFFWRDONE 0x0004
274#define ST_COEFFWREN 0x0002
275#define ST_SIDETONEEN 0x0001
276
Peter Ujfalusi98cb20e2009-08-20 16:18:14 +0300277/********************** McBSP DMA operating modes **************************/
278#define MCBSP_DMA_MODE_ELEMENT 0
279#define MCBSP_DMA_MODE_THRESHOLD 1
280#define MCBSP_DMA_MODE_FRAME 2
281
Eero Nurkkala2122fdc2009-08-20 16:18:15 +0300282/********************** McBSP WAKEUPEN bit definitions *********************/
283#define XEMPTYEOFEN 0x4000
284#define XRDYEN 0x0400
285#define XEOFEN 0x0200
286#define XFSXEN 0x0100
287#define XSYNCERREN 0x0080
288#define RRDYEN 0x0008
289#define REOFEN 0x0004
290#define RFSREN 0x0002
291#define RSYNCERREN 0x0001
Eero Nurkkala2122fdc2009-08-20 16:18:15 +0300292
Paul Walmsleycf4c87a2010-10-08 11:40:19 -0600293/* CLKR signal muxing options */
294#define CLKR_SRC_CLKR 0
295#define CLKR_SRC_CLKX 1
296
297/* FSR signal muxing options */
298#define FSR_SRC_FSR 0
299#define FSR_SRC_FSX 1
300
Paul Walmsleyd1358652010-10-08 11:40:19 -0600301/* McBSP functional clock sources */
Jarkko Nikulae4cc41d2010-10-08 11:40:21 -0600302#define MCBSP_CLKS_PRCM_SRC 0
303#define MCBSP_CLKS_PAD_SRC 1
Paul Walmsleyd1358652010-10-08 11:40:19 -0600304
Russell Kinga09e64f2008-08-05 16:14:15 +0100305/* we don't do multichannel for now */
306struct omap_mcbsp_reg_cfg {
307 u16 spcr2;
308 u16 spcr1;
309 u16 rcr2;
310 u16 rcr1;
311 u16 xcr2;
312 u16 xcr1;
313 u16 srgr2;
314 u16 srgr1;
315 u16 mcr2;
316 u16 mcr1;
317 u16 pcr0;
318 u16 rcerc;
319 u16 rcerd;
320 u16 xcerc;
321 u16 xcerd;
322 u16 rcere;
323 u16 rcerf;
324 u16 xcere;
325 u16 xcerf;
326 u16 rcerg;
327 u16 rcerh;
328 u16 xcerg;
329 u16 xcerh;
Tony Lindgren3127f8f2009-01-15 13:09:54 +0200330 u16 xccr;
331 u16 rccr;
Russell Kinga09e64f2008-08-05 16:14:15 +0100332};
333
334typedef enum {
Russell Kinga09e64f2008-08-05 16:14:15 +0100335 OMAP_MCBSP_WORD_8 = 0,
336 OMAP_MCBSP_WORD_12,
337 OMAP_MCBSP_WORD_16,
338 OMAP_MCBSP_WORD_20,
339 OMAP_MCBSP_WORD_24,
340 OMAP_MCBSP_WORD_32,
341} omap_mcbsp_word_length;
342
Russell Kinga09e64f2008-08-05 16:14:15 +0100343/* Platform specific configuration */
344struct omap_mcbsp_ops {
345 void (*request)(unsigned int);
346 void (*free)(unsigned int);
Paul Walmsleyd1358652010-10-08 11:40:19 -0600347 int (*set_clks_src)(u8, u8);
Russell Kinga09e64f2008-08-05 16:14:15 +0100348};
349
350struct omap_mcbsp_platform_data {
Russell King65846902008-09-03 23:46:18 +0100351 unsigned long phys_base;
Russell Kinga09e64f2008-08-05 16:14:15 +0100352 u8 dma_rx_sync, dma_tx_sync;
353 u16 rx_irq, tx_irq;
354 struct omap_mcbsp_ops *ops;
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800355#ifdef CONFIG_ARCH_OMAP3
Eero Nurkkalad912fa92010-02-22 12:21:11 +0000356 /* Sidetone block for McBSP 2 and 3 */
357 unsigned long phys_base_st;
Eduardo Valentina1a56f5f2009-08-20 16:18:11 +0300358#endif
Kishon Vijay Abraham I64bcbd32011-02-24 15:16:52 +0530359 u16 buffer_size;
Kishon Vijay Abraham I9504ba62011-02-24 15:16:55 +0530360 unsigned int mcbsp_config_type;
Russell Kinga09e64f2008-08-05 16:14:15 +0100361};
362
Eero Nurkkalad912fa92010-02-22 12:21:11 +0000363struct omap_mcbsp_st_data {
364 void __iomem *io_base_st;
365 bool running;
366 bool enabled;
367 s16 taps[128]; /* Sidetone filter coefficients */
368 int nr_taps; /* Number of filter coefficients in use */
369 s16 ch0gain;
370 s16 ch1gain;
371};
372
Russell Kinga09e64f2008-08-05 16:14:15 +0100373struct omap_mcbsp {
374 struct device *dev;
Russell King65846902008-09-03 23:46:18 +0100375 unsigned long phys_base;
Kishon Vijay Abraham I3cf32bb2011-02-24 12:51:45 -0800376 unsigned long phys_dma_base;
Russell Kingd592dd12008-09-04 14:25:42 +0100377 void __iomem *io_base;
Russell Kinga09e64f2008-08-05 16:14:15 +0100378 u8 id;
379 u8 free;
Russell Kinga09e64f2008-08-05 16:14:15 +0100380
Russell Kinga09e64f2008-08-05 16:14:15 +0100381 int rx_irq;
382 int tx_irq;
383
384 /* DMA stuff */
385 u8 dma_rx_sync;
Russell Kinga09e64f2008-08-05 16:14:15 +0100386 u8 dma_tx_sync;
Russell Kinga09e64f2008-08-05 16:14:15 +0100387
388 /* Protect the field .free, while checking if the mcbsp is in use */
389 spinlock_t lock;
390 struct omap_mcbsp_platform_data *pdata;
Russell Kingb820ce42009-01-23 10:26:46 +0000391 struct clk *fclk;
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800392#ifdef CONFIG_ARCH_OMAP3
Eero Nurkkalad912fa92010-02-22 12:21:11 +0000393 struct omap_mcbsp_st_data *st_data;
Peter Ujfalusi98cb20e2009-08-20 16:18:14 +0300394 int dma_op_mode;
Eduardo Valentina1a56f5f2009-08-20 16:18:11 +0300395 u16 max_tx_thres;
396 u16 max_rx_thres;
397#endif
Janusz Krzysztofikc8c99692010-02-15 10:03:33 -0800398 void *reg_cache;
Kishon Vijay Abraham I9504ba62011-02-24 15:16:55 +0530399 unsigned int mcbsp_config_type;
Russell Kinga09e64f2008-08-05 16:14:15 +0100400};
Kishon Vijay Abraham I8b1906f2011-02-24 15:16:51 +0530401
402/**
403 * omap_mcbsp_dev_attr - OMAP McBSP device attributes for omap_hwmod
404 * @sidetone: name of the sidetone device
405 */
406struct omap_mcbsp_dev_attr {
407 const char *sidetone;
408};
409
Chandra Shekharb4b58f52008-10-08 10:01:39 +0300410extern struct omap_mcbsp **mcbsp_ptr;
Janusz Krzysztofikc8c99692010-02-15 10:03:33 -0800411extern int omap_mcbsp_count, omap_mcbsp_cache_size;
Russell Kinga09e64f2008-08-05 16:14:15 +0100412
Paul Walmsleyd1358652010-10-08 11:40:19 -0600413#define omap_mcbsp_check_valid_id(id) (id < omap_mcbsp_count)
414#define id_to_mcbsp_ptr(id) mcbsp_ptr[id];
415
Russell Kinga09e64f2008-08-05 16:14:15 +0100416int omap_mcbsp_init(void);
Kishon Vijay Abraham I3cf32bb2011-02-24 12:51:45 -0800417void omap_mcbsp_register_board_cfg(struct resource *res, int res_count,
418 struct omap_mcbsp_platform_data *config, int size);
Russell Kinga09e64f2008-08-05 16:14:15 +0100419void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config);
Tony Lindgrena8eb7ca2010-02-12 12:26:48 -0800420#ifdef CONFIG_ARCH_OMAP3
Eduardo Valentin7aa9ff52009-08-20 16:18:10 +0300421void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
422void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
Eduardo Valentina1a56f5f2009-08-20 16:18:11 +0300423u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
424u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
Peter Ujfalusi0acce822010-06-03 07:39:32 +0300425u16 omap_mcbsp_get_fifo_size(unsigned int id);
Peter Ujfalusi7dc976e2010-03-03 15:08:08 +0200426u16 omap_mcbsp_get_tx_delay(unsigned int id);
427u16 omap_mcbsp_get_rx_delay(unsigned int id);
Peter Ujfalusi98cb20e2009-08-20 16:18:14 +0300428int omap_mcbsp_get_dma_op_mode(unsigned int id);
Eduardo Valentin7aa9ff52009-08-20 16:18:10 +0300429#else
430static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
431{ }
432static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
433{ }
Eduardo Valentina1a56f5f2009-08-20 16:18:11 +0300434static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
435static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
Peter Ujfalusi0acce822010-06-03 07:39:32 +0300436static inline u16 omap_mcbsp_get_fifo_size(unsigned int id) { return 0; }
Peter Ujfalusi7dc976e2010-03-03 15:08:08 +0200437static inline u16 omap_mcbsp_get_tx_delay(unsigned int id) { return 0; }
438static inline u16 omap_mcbsp_get_rx_delay(unsigned int id) { return 0; }
Peter Ujfalusi98cb20e2009-08-20 16:18:14 +0300439static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
Eduardo Valentin7aa9ff52009-08-20 16:18:10 +0300440#endif
Russell Kinga09e64f2008-08-05 16:14:15 +0100441int omap_mcbsp_request(unsigned int id);
442void omap_mcbsp_free(unsigned int id);
Jarkko Nikulac12abc02009-08-07 09:59:47 +0300443void omap_mcbsp_start(unsigned int id, int tx, int rx);
444void omap_mcbsp_stop(unsigned int id, int tx, int rx);
Russell Kinga09e64f2008-08-05 16:14:15 +0100445
Paul Walmsleyd1358652010-10-08 11:40:19 -0600446/* McBSP functional clock source changing function */
447extern int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id);
Russell Kinga09e64f2008-08-05 16:14:15 +0100448
Paul Walmsleycf4c87a2010-10-08 11:40:19 -0600449/* McBSP signal muxing API */
450void omap2_mcbsp1_mux_clkr_src(u8 mux);
451void omap2_mcbsp1_mux_fsr_src(u8 mux);
452
Kishon Vijay Abraham I9504ba62011-02-24 15:16:55 +0530453int omap_mcbsp_dma_ch_params(unsigned int id, unsigned int stream);
454int omap_mcbsp_dma_reg_params(unsigned int id, unsigned int stream);
455
Eero Nurkkalad912fa92010-02-22 12:21:11 +0000456#ifdef CONFIG_ARCH_OMAP3
457/* Sidetone specific API */
458int omap_st_set_chgain(unsigned int id, int channel, s16 chgain);
459int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain);
460int omap_st_enable(unsigned int id);
461int omap_st_disable(unsigned int id);
462int omap_st_is_enabled(unsigned int id);
463#else
464static inline int omap_st_set_chgain(unsigned int id, int channel,
465 s16 chgain) { return 0; }
466static inline int omap_st_get_chgain(unsigned int id, int channel,
467 s16 *chgain) { return 0; }
468static inline int omap_st_enable(unsigned int id) { return 0; }
469static inline int omap_st_disable(unsigned int id) { return 0; }
470static inline int omap_st_is_enabled(unsigned int id) { return 0; }
471#endif
472
Russell Kinga09e64f2008-08-05 16:14:15 +0100473#endif