summaryrefslogtreecommitdiff
path: root/firmware/target/arm/rk27xx/pcm-rk27xx.c
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2011-10-13 07:09:44 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2011-10-13 07:09:44 +0000
commit0dc76136ca3fcf46b9a9993b75e7e7ed1e76816c (patch)
tree3f9eff1c6a052489b46e7cab5f0651dd3cf14970 /firmware/target/arm/rk27xx/pcm-rk27xx.c
parente8e06f81f986de8dc73d64e16524be1f8a42a3ba (diff)
downloadrockbox-0dc76136ca3fcf46b9a9993b75e7e7ed1e76816c.tar.gz
rockbox-0dc76136ca3fcf46b9a9993b75e7e7ed1e76816c.zip
rk27xx - add support for i2s in master mode. Based on patch by Andrew Ryabinin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30746 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/rk27xx/pcm-rk27xx.c')
-rw-r--r--firmware/target/arm/rk27xx/pcm-rk27xx.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/firmware/target/arm/rk27xx/pcm-rk27xx.c b/firmware/target/arm/rk27xx/pcm-rk27xx.c
index 87830f47b4..b8ae56adaf 100644
--- a/firmware/target/arm/rk27xx/pcm-rk27xx.c
+++ b/firmware/target/arm/rk27xx/pcm-rk27xx.c
@@ -130,7 +130,7 @@ static void i2s_init(void)
130{ 130{
131#if defined(HAVE_RK27XX_CODEC) 131#if defined(HAVE_RK27XX_CODEC)
132 /* iomux I2S internal */ 132 /* iomux I2S internal */
133 SCU_IOMUXA_CON &= ~(1<<18); /* i2s external bit */ 133 SCU_IOMUXA_CON &= ~(1<<19); /* i2s external bit */
134 SCU_IOMUXB_CON &= ~((1<<4) | /* i2s_mclk */ 134 SCU_IOMUXB_CON &= ~((1<<4) | /* i2s_mclk */
135 (1<<3) | /* i2s_sdo */ 135 (1<<3) | /* i2s_sdo */
136 (1<<2) | /* i2s_sdi */ 136 (1<<2) | /* i2s_sdi */
@@ -138,7 +138,7 @@ static void i2s_init(void)
138 (1<<0)); /* i2s_bck */ 138 (1<<0)); /* i2s_bck */
139#else 139#else
140 /* iomux I2S external */ 140 /* iomux I2S external */
141 SCU_IOMUXA_CON |= (1<<18); /* i2s external bit */ 141 SCU_IOMUXA_CON |= (1<<19); /* i2s external bit */
142 SCU_IOMUXB_CON |= ((1<<4) | /* i2s_mclk */ 142 SCU_IOMUXB_CON |= ((1<<4) | /* i2s_mclk */
143 (1<<3) | /* i2s_sdo */ 143 (1<<3) | /* i2s_sdo */
144 (1<<2) | /* i2s_sdi */ 144 (1<<2) | /* i2s_sdi */
@@ -152,14 +152,18 @@ static void i2s_init(void)
152 152
153 /* configure I2S module */ 153 /* configure I2S module */
154 I2S_IER = 0; /* disable all i2s interrupts */ 154 I2S_IER = 0; /* disable all i2s interrupts */
155 155
156 I2S_TXCTL = (1<<16) | /* LRCK/SCLK = 64 */ 156 I2S_TXCTL = (1<<16) | /* LRCK/SCLK = 64 */
157 (4<<8) | /* MCLK/SCLK = 4 */ 157 (4<<8) | /* MCLK/SCLK = 4 */
158 (1<<4) | /* 16bit samples */ 158 (1<<4) | /* 16bit samples */
159 (0<<3) | /* stereo */ 159 (0<<3) | /* stereo */
160 (0<<1) | /* I2S IF */ 160 (0<<1) | /* I2S IF */
161#ifdef CODEC_SLAVE
162 (1<<0); /* master mode */
163#else
161 (0<<0); /* slave mode */ 164 (0<<0); /* slave mode */
162 165#endif
166
163 /* the fifo is 16x32bits according to my tests 167 /* the fifo is 16x32bits according to my tests
164 * while the docs state 32x32bits 168 * while the docs state 32x32bits
165 */ 169 */
@@ -173,8 +177,13 @@ static void i2s_init(void)
173 (0<<4) | /* Req1 for Tx fifo */ 177 (0<<4) | /* Req1 for Tx fifo */
174 (1<<3) | /* Req2 for Rx fifo */ 178 (1<<3) | /* Req2 for Rx fifo */
175 (0<<2) | /* normal operation */ 179 (0<<2) | /* normal operation */
176 (0<<1) | /* start Tx (in master mode) */ 180#ifdef CODEC_SLAVE
177 (0<<0); /* start Rx (in master mode) */ 181 (1<<1) | /* start Tx (master mode) */
182 (1<<0); /* start Rx (master mode) */
183#else
184 (0<<1) | /* not used in slave mode */
185 (0<<0); /* not used in slave mode */
186#endif
178} 187}
179 188
180void pcm_play_dma_init(void) 189void pcm_play_dma_init(void)