1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Portalplayer specific code for I2S
12 * Based on code from the ipodlinux project - http://ipodlinux.org/
13 * Adapted for Rockbox in December 2005
15 * Original file: linux/arch/armnommu/mach-ipod/audio.c
17 * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version 2
22 * of the License, or (at your option) any later version.
24 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
25 * KIND, either express or implied.
27 ****************************************************************************/
32 #if CONFIG_CPU == PP5002
35 /* I2S device reset */
39 /* I2S controller enable */
40 IISCONFIG
|= IIS_ENABLE
;
42 /* reset DAC and ADC fifo */
43 IISFIFO_CFG
|= IIS_RXCLR
| IIS_TXCLR
;
48 * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
53 IISCONFIG
|= IIS_RESET
;
54 IISCONFIG
&= ~IIS_RESET
;
57 IISCONFIG
= ((IISCONFIG
& ~IIS_FORMAT_MASK
) | IIS_FORMAT_IIS
);
59 IISCONFIG
= ((IISCONFIG
& ~IIS_SIZE_MASK
) | IIS_SIZE_16BIT
);
62 /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
64 /* AS3514 can only operate as I2S Slave */
65 IISCONFIG
|= IIS_MASTER
;
67 /* Set I2S to 44.1kHz */
69 /* values taken from the SA9200 OF */
70 IISCLK
= (IISCLK
& ~0x1ff) | 31;
71 IISDIV
= (IISDIV
& ~0xc0000000) | (2 << 30);
72 IISDIV
= (IISDIV
& ~0x3f) | 16;
74 IISCLK
= (IISCLK
& ~0x1ff) | 33;
77 #endif /* HAVE_AS3514 */
79 IISCONFIG
= ((IISCONFIG
& ~IIS_FIFO_FORMAT_MASK
) | IIS_FIFO_FORMAT_LE16_2
);
81 /* RX_ATN_LVL = when 12 slots full */
82 /* TX_ATN_LVL = DMA request when 4 slots empty */
83 IISFIFO_CFG
|= IIS_RX_FULL_LVL_12
| IIS_TX_EMPTY_LVL_4
;
85 /* Rx.CLR = 1, TX.CLR = 1 */
86 IISFIFO_CFG
|= IIS_RXCLR
| IIS_TXCLR
;
89 #endif /* CONFIG_CPU == */