diff options
Diffstat (limited to 'arch/arm/plat-omap/include/plat/mcbsp.h')
-rw-r--r-- | arch/arm/plat-omap/include/plat/mcbsp.h | 72 |
1 files changed, 66 insertions, 6 deletions
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h index 4f22e5bb7ff7..39748354ce45 100644 --- a/arch/arm/plat-omap/include/plat/mcbsp.h +++ b/arch/arm/plat-omap/include/plat/mcbsp.h | |||
@@ -49,6 +49,9 @@ | |||
49 | 49 | ||
50 | #define OMAP34XX_MCBSP1_BASE 0x48074000 | 50 | #define OMAP34XX_MCBSP1_BASE 0x48074000 |
51 | #define OMAP34XX_MCBSP2_BASE 0x49022000 | 51 | #define OMAP34XX_MCBSP2_BASE 0x49022000 |
52 | #define OMAP34XX_MCBSP2_ST_BASE 0x49028000 | ||
53 | #define OMAP34XX_MCBSP3_BASE 0x49024000 | ||
54 | #define OMAP34XX_MCBSP3_ST_BASE 0x4902A000 | ||
52 | #define OMAP34XX_MCBSP3_BASE 0x49024000 | 55 | #define OMAP34XX_MCBSP3_BASE 0x49024000 |
53 | #define OMAP34XX_MCBSP4_BASE 0x49026000 | 56 | #define OMAP34XX_MCBSP4_BASE 0x49026000 |
54 | #define OMAP34XX_MCBSP5_BASE 0x48096000 | 57 | #define OMAP34XX_MCBSP5_BASE 0x48096000 |
@@ -103,8 +106,7 @@ | |||
103 | #define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX | 106 | #define AUDIO_DMA_TX OMAP_DMA_MCBSP1_TX |
104 | #define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX | 107 | #define AUDIO_DMA_RX OMAP_DMA_MCBSP1_RX |
105 | 108 | ||
106 | #elif defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \ | 109 | #else |
107 | defined(CONFIG_ARCH_OMAP4) | ||
108 | 110 | ||
109 | #define OMAP_MCBSP_REG_DRR2 0x00 | 111 | #define OMAP_MCBSP_REG_DRR2 0x00 |
110 | #define OMAP_MCBSP_REG_DRR1 0x04 | 112 | #define OMAP_MCBSP_REG_DRR1 0x04 |
@@ -147,6 +149,15 @@ | |||
147 | #define OMAP_MCBSP_REG_WAKEUPEN 0xA8 | 149 | #define OMAP_MCBSP_REG_WAKEUPEN 0xA8 |
148 | #define OMAP_MCBSP_REG_XCCR 0xAC | 150 | #define OMAP_MCBSP_REG_XCCR 0xAC |
149 | #define OMAP_MCBSP_REG_RCCR 0xB0 | 151 | #define OMAP_MCBSP_REG_RCCR 0xB0 |
152 | #define OMAP_MCBSP_REG_SSELCR 0xBC | ||
153 | |||
154 | #define OMAP_ST_REG_REV 0x00 | ||
155 | #define OMAP_ST_REG_SYSCONFIG 0x10 | ||
156 | #define OMAP_ST_REG_IRQSTATUS 0x18 | ||
157 | #define OMAP_ST_REG_IRQENABLE 0x1C | ||
158 | #define OMAP_ST_REG_SGAINCR 0x24 | ||
159 | #define OMAP_ST_REG_SFIRCR 0x28 | ||
160 | #define OMAP_ST_REG_SSELCR 0x2C | ||
150 | 161 | ||
151 | #define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) | 162 | #define AUDIO_MCBSP_DATAWRITE (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1) |
152 | #define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) | 163 | #define AUDIO_MCBSP_DATAREAD (OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1) |
@@ -265,6 +276,24 @@ | |||
265 | #define ENAWAKEUP 0x0004 | 276 | #define ENAWAKEUP 0x0004 |
266 | #define SOFTRST 0x0002 | 277 | #define SOFTRST 0x0002 |
267 | 278 | ||
279 | /********************** McBSP SSELCR bit definitions ***********************/ | ||
280 | #define SIDETONEEN 0x0400 | ||
281 | |||
282 | /********************** McBSP Sidetone SYSCONFIG bit definitions ***********/ | ||
283 | #define ST_AUTOIDLE 0x0001 | ||
284 | |||
285 | /********************** McBSP Sidetone SGAINCR bit definitions *************/ | ||
286 | #define ST_CH1GAIN(value) ((value<<16)) /* Bits 16:31 */ | ||
287 | #define ST_CH0GAIN(value) (value) /* Bits 0:15 */ | ||
288 | |||
289 | /********************** McBSP Sidetone SFIRCR bit definitions **************/ | ||
290 | #define ST_FIRCOEFF(value) (value) /* Bits 0:15 */ | ||
291 | |||
292 | /********************** McBSP Sidetone SSELCR bit definitions **************/ | ||
293 | #define ST_COEFFWRDONE 0x0004 | ||
294 | #define ST_COEFFWREN 0x0002 | ||
295 | #define ST_SIDETONEEN 0x0001 | ||
296 | |||
268 | /********************** McBSP DMA operating modes **************************/ | 297 | /********************** McBSP DMA operating modes **************************/ |
269 | #define MCBSP_DMA_MODE_ELEMENT 0 | 298 | #define MCBSP_DMA_MODE_ELEMENT 0 |
270 | #define MCBSP_DMA_MODE_THRESHOLD 1 | 299 | #define MCBSP_DMA_MODE_THRESHOLD 1 |
@@ -374,11 +403,23 @@ struct omap_mcbsp_platform_data { | |||
374 | u8 dma_rx_sync, dma_tx_sync; | 403 | u8 dma_rx_sync, dma_tx_sync; |
375 | u16 rx_irq, tx_irq; | 404 | u16 rx_irq, tx_irq; |
376 | struct omap_mcbsp_ops *ops; | 405 | struct omap_mcbsp_ops *ops; |
377 | #ifdef CONFIG_ARCH_OMAP34XX | 406 | #ifdef CONFIG_ARCH_OMAP3 |
407 | /* Sidetone block for McBSP 2 and 3 */ | ||
408 | unsigned long phys_base_st; | ||
378 | u16 buffer_size; | 409 | u16 buffer_size; |
379 | #endif | 410 | #endif |
380 | }; | 411 | }; |
381 | 412 | ||
413 | struct omap_mcbsp_st_data { | ||
414 | void __iomem *io_base_st; | ||
415 | bool running; | ||
416 | bool enabled; | ||
417 | s16 taps[128]; /* Sidetone filter coefficients */ | ||
418 | int nr_taps; /* Number of filter coefficients in use */ | ||
419 | s16 ch0gain; | ||
420 | s16 ch1gain; | ||
421 | }; | ||
422 | |||
382 | struct omap_mcbsp { | 423 | struct omap_mcbsp { |
383 | struct device *dev; | 424 | struct device *dev; |
384 | unsigned long phys_base; | 425 | unsigned long phys_base; |
@@ -410,20 +451,22 @@ struct omap_mcbsp { | |||
410 | struct omap_mcbsp_platform_data *pdata; | 451 | struct omap_mcbsp_platform_data *pdata; |
411 | struct clk *iclk; | 452 | struct clk *iclk; |
412 | struct clk *fclk; | 453 | struct clk *fclk; |
413 | #ifdef CONFIG_ARCH_OMAP34XX | 454 | #ifdef CONFIG_ARCH_OMAP3 |
455 | struct omap_mcbsp_st_data *st_data; | ||
414 | int dma_op_mode; | 456 | int dma_op_mode; |
415 | u16 max_tx_thres; | 457 | u16 max_tx_thres; |
416 | u16 max_rx_thres; | 458 | u16 max_rx_thres; |
417 | #endif | 459 | #endif |
460 | void *reg_cache; | ||
418 | }; | 461 | }; |
419 | extern struct omap_mcbsp **mcbsp_ptr; | 462 | extern struct omap_mcbsp **mcbsp_ptr; |
420 | extern int omap_mcbsp_count; | 463 | extern int omap_mcbsp_count, omap_mcbsp_cache_size; |
421 | 464 | ||
422 | int omap_mcbsp_init(void); | 465 | int omap_mcbsp_init(void); |
423 | void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, | 466 | void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config, |
424 | int size); | 467 | int size); |
425 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); | 468 | void omap_mcbsp_config(unsigned int id, const struct omap_mcbsp_reg_cfg * config); |
426 | #ifdef CONFIG_ARCH_OMAP34XX | 469 | #ifdef CONFIG_ARCH_OMAP3 |
427 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); | 470 | void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold); |
428 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); | 471 | void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold); |
429 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); | 472 | u16 omap_mcbsp_get_max_tx_threshold(unsigned int id); |
@@ -459,4 +502,21 @@ int omap_mcbsp_pollread(unsigned int id, u16 * buf); | |||
459 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf); | 502 | int omap_mcbsp_pollwrite(unsigned int id, u16 buf); |
460 | int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); | 503 | int omap_mcbsp_set_io_type(unsigned int id, omap_mcbsp_io_type_t io_type); |
461 | 504 | ||
505 | #ifdef CONFIG_ARCH_OMAP3 | ||
506 | /* Sidetone specific API */ | ||
507 | int omap_st_set_chgain(unsigned int id, int channel, s16 chgain); | ||
508 | int omap_st_get_chgain(unsigned int id, int channel, s16 *chgain); | ||
509 | int omap_st_enable(unsigned int id); | ||
510 | int omap_st_disable(unsigned int id); | ||
511 | int omap_st_is_enabled(unsigned int id); | ||
512 | #else | ||
513 | static inline int omap_st_set_chgain(unsigned int id, int channel, | ||
514 | s16 chgain) { return 0; } | ||
515 | static inline int omap_st_get_chgain(unsigned int id, int channel, | ||
516 | s16 *chgain) { return 0; } | ||
517 | static inline int omap_st_enable(unsigned int id) { return 0; } | ||
518 | static inline int omap_st_disable(unsigned int id) { return 0; } | ||
519 | static inline int omap_st_is_enabled(unsigned int id) { return 0; } | ||
520 | #endif | ||
521 | |||
462 | #endif | 522 | #endif |