diff options
Diffstat (limited to 'include/asm-arm/arch-omap/mcbsp.h')
-rw-r--r-- | include/asm-arm/arch-omap/mcbsp.h | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/include/asm-arm/arch-omap/mcbsp.h b/include/asm-arm/arch-omap/mcbsp.h index c7a0cc1c4e93..26c78f67dc8e 100644 --- a/include/asm-arm/arch-omap/mcbsp.h +++ b/include/asm-arm/arch-omap/mcbsp.h | |||
@@ -24,7 +24,11 @@ | |||
24 | #ifndef __ASM_ARCH_OMAP_MCBSP_H | 24 | #ifndef __ASM_ARCH_OMAP_MCBSP_H |
25 | #define __ASM_ARCH_OMAP_MCBSP_H | 25 | #define __ASM_ARCH_OMAP_MCBSP_H |
26 | 26 | ||
27 | #include <linux/completion.h> | ||
28 | #include <linux/spinlock.h> | ||
29 | |||
27 | #include <asm/hardware.h> | 30 | #include <asm/hardware.h> |
31 | #include <asm/arch/clock.h> | ||
28 | 32 | ||
29 | #define OMAP730_MCBSP1_BASE 0xfffb1000 | 33 | #define OMAP730_MCBSP1_BASE 0xfffb1000 |
30 | #define OMAP730_MCBSP2_BASE 0xfffb1800 | 34 | #define OMAP730_MCBSP2_BASE 0xfffb1800 |
@@ -40,6 +44,9 @@ | |||
40 | #define OMAP24XX_MCBSP1_BASE 0x48074000 | 44 | #define OMAP24XX_MCBSP1_BASE 0x48074000 |
41 | #define OMAP24XX_MCBSP2_BASE 0x48076000 | 45 | #define OMAP24XX_MCBSP2_BASE 0x48076000 |
42 | 46 | ||
47 | #define OMAP34XX_MCBSP1_BASE 0x48074000 | ||
48 | #define OMAP34XX_MCBSP2_BASE 0x49022000 | ||
49 | |||
43 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) | 50 | #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) |
44 | 51 | ||
45 | #define OMAP_MCBSP_REG_DRR2 0x00 | 52 | #define OMAP_MCBSP_REG_DRR2 0x00 |
@@ -74,7 +81,8 @@ | |||
74 | #define OMAP_MCBSP_REG_XCERG 0x3A | 81 | #define OMAP_MCBSP_REG_XCERG 0x3A |
75 | #define OMAP_MCBSP_REG_XCERH 0x3C | 82 | #define OMAP_MCBSP_REG_XCERH 0x3C |
76 | 83 | ||
77 | #define OMAP_MAX_MCBSP_COUNT 3 | 84 | #define OMAP_MAX_MCBSP_COUNT 3 |
85 | #define MAX_MCBSP_CLOCKS 3 | ||
78 | 86 | ||
79 | #define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1) | 87 | #define AUDIO_MCBSP_DATAWRITE (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DXR1) |
80 | #define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1) | 88 | #define AUDIO_MCBSP_DATAREAD (OMAP1510_MCBSP1_BASE + OMAP_MCBSP_REG_DRR1) |
@@ -117,7 +125,8 @@ | |||
117 | #define OMAP_MCBSP_REG_XCERG 0x74 | 125 | #define OMAP_MCBSP_REG_XCERG 0x74 |
118 | #define OMAP_MCBSP_REG_XCERH 0x78 | 126 | #define OMAP_MCBSP_REG_XCERH 0x78 |
119 | 127 | ||
120 | #define OMAP_MAX_MCBSP_COUNT 2 | 128 | #define OMAP_MAX_MCBSP_COUNT 2 |
129 | #define MAX_MCBSP_CLOCKS 2 | ||
121 | 130 | ||
122 | #define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) | 131 | #define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) |
123 | #define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) | 132 | #define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) |
@@ -298,6 +307,55 @@ struct omap_mcbsp_spi_cfg { | |||
298 | omap_mcbsp_word_length word_length; | 307 | omap_mcbsp_word_length word_length; |
299 | }; | 308 | }; |
300 | 309 | ||
310 | /* Platform specific configuration */ | ||
311 | struct omap_mcbsp_ops { | ||
312 | void (*request)(unsigned int); | ||
313 | void (*free)(unsigned int); | ||
314 | int (*check)(unsigned int); | ||
315 | }; | ||
316 | |||
317 | struct omap_mcbsp_platform_data { | ||
318 | u32 virt_base; | ||
319 | u8 dma_rx_sync, dma_tx_sync; | ||
320 | u16 rx_irq, tx_irq; | ||
321 | struct omap_mcbsp_ops *ops; | ||
322 | char const *clk_name; | ||
323 | }; | ||
324 | |||
325 | struct omap_mcbsp { | ||
326 | struct device *dev; | ||
327 | u32 io_base; | ||
328 | u8 id; | ||
329 | u8 free; | ||
330 | omap_mcbsp_word_length rx_word_length; | ||
331 | omap_mcbsp_word_length tx_word_length; | ||
332 | |||
333 | omap_mcbsp_io_type_t io_type; /* IRQ or poll */ | ||
334 | /* IRQ based TX/RX */ | ||
335 | int rx_irq; | ||
336 | int tx_irq; | ||
337 | |||
338 | /* DMA stuff */ | ||
339 | u8 dma_rx_sync; | ||
340 | short dma_rx_lch; | ||
341 | u8 dma_tx_sync; | ||
342 | short dma_tx_lch; | ||
343 | |||
344 | /* Completion queues */ | ||
345 | struct completion tx_irq_completion; | ||
346 | struct completion rx_irq_completion; | ||
347 | struct completion tx_dma_completion; | ||
348 | struct completion rx_dma_completion; | ||
349 | |||
350 | /* Protect the field .free, while checking if the mcbsp is in use */ | ||
351 | spinlock_t lock; | ||
352 | struct omap_mcbsp_platform_data *pdata; | ||
353 | struct clk *clk; | ||
354 | }; | ||
355 | |||
356 | int omap_mcbsp_init(void); | ||
357 | void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, | ||
358 | int size); | ||
301 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); | 359 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); |
302 | int omap_mcbsp_request(unsigned int id); | 360 | int omap_mcbsp_request(unsigned int id); |
303 | void omap_mcbsp_free(unsigned int id); | 361 | void omap_mcbsp_free(unsigned int id); |