summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/i2s-pp.c95
-rw-r--r--firmware/target/arm/wmcodec-pp.c54
2 files changed, 96 insertions, 53 deletions
diff --git a/firmware/target/arm/i2s-pp.c b/firmware/target/arm/i2s-pp.c
new file mode 100644
index 0000000000..1485147de8
--- /dev/null
+++ b/firmware/target/arm/i2s-pp.c
@@ -0,0 +1,95 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Portalplayer specific code for I2S
11 *
12 * Based on code from the ipodlinux project - http://ipodlinux.org/
13 * Adapted for Rockbox in December 2005
14 *
15 * Original file: linux/arch/armnommu/mach-ipod/audio.c
16 *
17 * Copyright (c) 2003-2005 Bernard Leach (leachbj@bouncycastle.org)
18 *
19 * All files in this archive are subject to the GNU General Public License.
20 * See the file COPYING in the source tree root for full license agreement.
21 *
22 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
23 * KIND, either express or implied.
24 *
25 ****************************************************************************/
26
27#include "system.h"
28
29/* TODO: Add in PP5002 defs */
30#if CONFIG_CPU == PP5002
31void i2s_reset(void)
32{
33 /* I2S device reset */
34 DEV_RS |= 0x80;
35 DEV_RS &= ~0x80;
36
37 /* I2S controller enable */
38 IISCONFIG |= 1;
39
40 /* BIT.FORMAT [11:10] = I2S (default) */
41 /* BIT.SIZE [9:8] = 24bit */
42 /* FIFO.FORMAT = 24 bit LSB */
43
44 /* reset DAC and ADC fifo */
45 IISFIFO_CFG |= 0x30000;
46}
47#else /* PP502X */
48
49/* Data format on the I2S bus */
50#define FORMAT_MASK (0x3 << 10)
51#define FORMAT_I2S (0x00 << 10)
52/* Other formats not yet known */
53
54/* Data size on I2S bus */
55#define SIZE_MASK (0x3 << 8)
56#define SIZE_16BIT (0x00 << 10)
57/* Other sizes not yet known */
58
59/* Data size/format on I2S FIFO */
60#define FIFO_FORMAT_MASK (0x7 << 4)
61#define FIFO_FORMAT_32LSB (0x03 << 4)
62/* Other formats not yet known */
63
64/* Are we I2S Master or slave? */
65#define I2S_MASTER (0x25)
66
67#define I2S_RESET (0x1 << 31)
68
69/*
70 * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
71 */
72void i2s_reset(void)
73{
74 /* I2S soft reset */
75 IISCONFIG |= I2S_RESET;
76 IISCONFIG &= ~I2S_RESET;
77
78 /* BIT.FORMAT */
79 IISCONFIG = ((IISCONFIG & ~FORMAT_MASK) | FORMAT_I2S);
80
81 /* BIT.SIZE */
82 IISCONFIG = ((IISCONFIG & ~SIZE_MASK) | SIZE_16BIT);
83
84 /* FIFO.FORMAT */
85 /* If BIT.SIZE < FIFO.FORMAT low bits will be 0 */
86 IISCONFIG = ((IISCONFIG & ~FIFO_FORMAT_MASK) | FIFO_FORMAT_32LSB);
87
88 /* RX_ATN_LVL=1 == when 12 slots full */
89 /* TX_ATN_LVL=1 == when 12 slots empty */
90 IISFIFO_CFG |= 0x33;
91
92 /* Rx.CLR = 1, TX.CLR = 1 */
93 IISFIFO_CFG |= 0x1100;
94}
95#endif
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index 8aa862c187..471cd8f4a5 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -23,19 +23,8 @@
23 * KIND, either express or implied. 23 * KIND, either express or implied.
24 * 24 *
25 ****************************************************************************/ 25 ****************************************************************************/
26#include "lcd.h" 26
27#include "cpu.h"
28#include "kernel.h"
29#include "thread.h"
30#include "power.h"
31#include "debug.h"
32#include "system.h" 27#include "system.h"
33#include "sprintf.h"
34#include "button.h"
35#include "string.h"
36#include "file.h"
37#include "buffer.h"
38#include "audio.h"
39 28
40#if CONFIG_CPU == PP5020 29#if CONFIG_CPU == PP5020
41#include "i2c-pp5020.h" 30#include "i2c-pp5020.h"
@@ -51,47 +40,6 @@
51#define I2C_AUDIO_ADDRESS 0x1a 40#define I2C_AUDIO_ADDRESS 0x1a
52#endif 41#endif
53 42
54/*
55 * Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
56 */
57void i2s_reset(void)
58{
59#if CONFIG_CPU == PP5020
60 /* I2S soft reset */
61 outl(inl(0x70002800) | 0x80000000, 0x70002800);
62 outl(inl(0x70002800) & ~0x80000000, 0x70002800);
63
64 /* BIT.FORMAT [11:10] = I2S (default) */
65 outl(inl(0x70002800) & ~0xc00, 0x70002800);
66 /* BIT.SIZE [9:8] = 16bit (default) */
67 outl(inl(0x70002800) & ~0x300, 0x70002800);
68
69 /* FIFO.FORMAT [6:4] = 32 bit LSB */
70 /* since BIT.SIZ < FIFO.FORMAT low 16 bits will be 0 */
71 outl(inl(0x70002800) | 0x30, 0x70002800);
72
73 /* RX_ATN_LVL=1 == when 12 slots full */
74 /* TX_ATN_LVL=1 == when 12 slots empty */
75 outl(inl(0x7000280c) | 0x33, 0x7000280c);
76
77 /* Rx.CLR = 1, TX.CLR = 1 */
78 outl(inl(0x7000280c) | 0x1100, 0x7000280c);
79#elif CONFIG_CPU == PP5002
80 /* I2S device reset */
81 outl(inl(0xcf005030) | 0x80, 0xcf005030);
82 outl(inl(0xcf005030) & ~0x80, 0xcf005030);
83
84 /* I2S controller enable */
85 outl(inl(0xc0002500) | 0x1, 0xc0002500);
86
87 /* BIT.FORMAT [11:10] = I2S (default) */
88 /* BIT.SIZE [9:8] = 24bit */
89 /* FIFO.FORMAT = 24 bit LSB */
90
91 /* reset DAC and ADC fifo */
92 outl(inl(0xc000251c) | 0x30000, 0xc000251c);
93#endif
94}
95 43
96/* 44/*
97 * Initialise the WM8975 for playback via headphone and line out. 45 * Initialise the WM8975 for playback via headphone and line out.