blob: 9aa240909a2cf4f9dac7bc1afc560712d9020ba2 [file] [log] [blame]
David Brownellf492ec92009-05-14 13:01:59 -07001/*
2 * <mach/asp.h> - DaVinci Audio Serial Port support
3 */
4#ifndef __ASM_ARCH_DAVINCI_ASP_H
5#define __ASM_ARCH_DAVINCI_ASP_H
6
7#include <mach/irqs.h>
Chaithrika U S25acf552009-06-05 06:28:08 -04008#include <mach/edma.h>
David Brownellf492ec92009-05-14 13:01:59 -07009
Chaithrika U S25acf552009-06-05 06:28:08 -040010/* Bases of dm644x and dm355 register banks */
David Brownellf492ec92009-05-14 13:01:59 -070011#define DAVINCI_ASP0_BASE 0x01E02000
12#define DAVINCI_ASP1_BASE 0x01E04000
13
Miguel Aguilare9ab3212009-09-02 15:33:29 -060014/* Bases of dm365 register banks */
15#define DAVINCI_DM365_ASP0_BASE 0x01D02000
16
Chaithrika U S25acf552009-06-05 06:28:08 -040017/* Bases of dm646x register banks */
18#define DAVINCI_DM646X_MCASP0_REG_BASE 0x01D01000
19#define DAVINCI_DM646X_MCASP1_REG_BASE 0x01D01800
20
Chaithrika U S491214e2009-08-11 17:03:25 -040021/* Bases of da850/da830 McASP0 register banks */
22#define DAVINCI_DA8XX_MCASP0_REG_BASE 0x01D00000
23
Chaithrika U Se33ef5e2009-08-11 17:01:59 -040024/* Bases of da830 McASP1 register banks */
25#define DAVINCI_DA830_MCASP1_REG_BASE 0x01D04000
26
Chaithrika U S25acf552009-06-05 06:28:08 -040027/* EDMA channels of dm644x and dm355 */
David Brownellf492ec92009-05-14 13:01:59 -070028#define DAVINCI_DMA_ASP0_TX 2
29#define DAVINCI_DMA_ASP0_RX 3
30#define DAVINCI_DMA_ASP1_TX 8
31#define DAVINCI_DMA_ASP1_RX 9
32
Chaithrika U S25acf552009-06-05 06:28:08 -040033/* EDMA channels of dm646x */
34#define DAVINCI_DM646X_DMA_MCASP0_AXEVT0 6
35#define DAVINCI_DM646X_DMA_MCASP0_AREVT0 9
36#define DAVINCI_DM646X_DMA_MCASP1_AXEVT1 12
37
Chaithrika U S491214e2009-08-11 17:03:25 -040038/* EDMA channels of da850/da830 McASP0 */
39#define DAVINCI_DA8XX_DMA_MCASP0_AREVT 0
40#define DAVINCI_DA8XX_DMA_MCASP0_AXEVT 1
41
Chaithrika U Se33ef5e2009-08-11 17:01:59 -040042/* EDMA channels of da830 McASP1 */
43#define DAVINCI_DA830_DMA_MCASP1_AREVT 2
44#define DAVINCI_DA830_DMA_MCASP1_AXEVT 3
45
David Brownellf492ec92009-05-14 13:01:59 -070046/* Interrupts */
47#define DAVINCI_ASP0_RX_INT IRQ_MBRINT
48#define DAVINCI_ASP0_TX_INT IRQ_MBXINT
49#define DAVINCI_ASP1_RX_INT IRQ_MBRINT
50#define DAVINCI_ASP1_TX_INT IRQ_MBXINT
51
Chaithrika U S25acf552009-06-05 06:28:08 -040052struct snd_platform_data {
Chaithrika U S25acf552009-06-05 06:28:08 -040053 u32 tx_dma_offset;
54 u32 rx_dma_offset;
Sekhar Nori48519f02010-07-19 12:31:16 +053055 enum dma_event_q asp_chan_q; /* event queue number for ASP channel */
56 enum dma_event_q ram_chan_q; /* event queue number for RAM channel */
Chaithrika U S25acf552009-06-05 06:28:08 -040057 unsigned int codec_fmt;
Troy Kisky0d6c9772009-11-18 17:49:51 -070058 /*
59 * Allowing this is more efficient and eliminates left and right swaps
60 * caused by underruns, but will swap the left and right channels
61 * when compared to previous behavior.
62 */
63 unsigned enable_channel_combine:1;
Troy Kisky1e224f32009-11-18 17:49:53 -070064 unsigned sram_size_playback;
65 unsigned sram_size_capture;
Chaithrika U S25acf552009-06-05 06:28:08 -040066
Raffaele Recalcatiec637552010-07-06 10:39:03 +020067 /*
68 * If McBSP peripheral gets the clock from an external pin,
69 * there are three chooses, that are MCBSP_CLKX, MCBSP_CLKR
70 * and MCBSP_CLKS.
71 * Depending on different hardware connections it is possible
72 * to use this setting to change the behaviour of McBSP
73 * driver. The dm365_clk_input_pin enum is available for dm365
74 */
75 int clk_input_pin;
76
Raffaele Recalcatid9823ed92010-07-06 10:39:04 +020077 /*
78 * This flag works when both clock and FS are outputs for the cpu
79 * and makes clock more accurate (FS is not symmetrical and the
80 * clock is very fast.
81 * The clock becoming faster is named
82 * i2s continuous serial clock (I2S_SCK) and it is an externally
83 * visible bit clock.
84 *
85 * first line : WordSelect
86 * second line : ContinuousSerialClock
87 * third line: SerialData
88 *
89 * SYMMETRICAL APPROACH:
90 * _______________________ LEFT
91 * _| RIGHT |______________________|
92 * _ _ _ _ _ _ _ _
93 * _| |_| |_ x16 _| |_| |_| |_| |_ x16 _| |_| |_
94 * _ _ _ _ _ _ _ _
95 * _/ \_/ \_ ... _/ \_/ \_/ \_/ \_ ... _/ \_/ \_
96 * \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
97 *
98 * ACCURATE CLOCK APPROACH:
99 * ______________ LEFT
100 * _| RIGHT |_______________________________|
101 * _ _ _ _ _ _ _ _ _
102 * _| |_ x16 _| |_| |_ x16 _| |_| |_| |_| |_| |_| |
103 * _ _ _ _ dummy cycles
104 * _/ \_ ... _/ \_/ \_ ... _/ \__________________
105 * \_/ \_/ \_/ \_/
106 *
107 */
108 bool i2s_accurate_sck;
109
Chaithrika U S25acf552009-06-05 06:28:08 -0400110 /* McASP specific fields */
111 int tdm_slots;
112 u8 op_mode;
113 u8 num_serializer;
114 u8 *serial_dir;
Chaithrika U Se33ef5e2009-08-11 17:01:59 -0400115 u8 version;
116 u8 txnumevt;
117 u8 rxnumevt;
118};
119
120enum {
121 MCASP_VERSION_1 = 0, /* DM646x */
122 MCASP_VERSION_2, /* DA8xx/OMAPL1x */
Chaithrika U S25acf552009-06-05 06:28:08 -0400123};
124
Raffaele Recalcatiec637552010-07-06 10:39:03 +0200125enum dm365_clk_input_pin {
126 MCBSP_CLKR = 0, /* DM365 */
127 MCBSP_CLKS,
128};
129
Chaithrika U S25acf552009-06-05 06:28:08 -0400130#define INACTIVE_MODE 0
131#define TX_MODE 1
132#define RX_MODE 2
133
134#define DAVINCI_MCASP_IIS_MODE 0
135#define DAVINCI_MCASP_DIT_MODE 1
136
David Brownellf492ec92009-05-14 13:01:59 -0700137#endif /* __ASM_ARCH_DAVINCI_ASP_H */