summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2009-05-06 17:33:56 +0000
committerBertrik Sikken <bertrik@sikken.nl>2009-05-06 17:33:56 +0000
commitb5886beb816b15b3ca99c862897a8c8b11b087f6 (patch)
tree62aeccbc05279eea1352adeb102fb4a8e4b4b22a
parent330f9359e2b7ef081ef66e4605fb2ca0f0b52932 (diff)
downloadrockbox-b5886beb816b15b3ca99c862897a8c8b11b087f6.tar.gz
rockbox-b5886beb816b15b3ca99c862897a8c8b11b087f6.zip
Allow a clock divider larger than 255 for the internal i2c bus to the as3525 ascodec.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20861 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/ascodec-as3525.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c
index 9d13994cbc..4f13dd6300 100644
--- a/firmware/target/arm/as3525/ascodec-as3525.c
+++ b/firmware/target/arm/as3525/ascodec-as3525.c
@@ -65,12 +65,15 @@ void i2c_init(void)
65/* initialises the internal i2c bus and prepares for transfers to the codec */ 65/* initialises the internal i2c bus and prepares for transfers to the codec */
66void ascodec_init(void) 66void ascodec_init(void)
67{ 67{
68 int prescaler;
69
68 /* enable clock */ 70 /* enable clock */
69 CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE; 71 CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
70 72
71 /* prescaler for i2c clock */ 73 /* prescaler for i2c clock */
72 I2C2_CPSR0 = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ); 74 prescaler = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
73 I2C2_CPSR1 = 0; /* MSB */ 75 I2C2_CPSR0 = prescaler & 0xFF;
76 I2C2_CPSR1 = (prescaler >> 8) & 0xFF;
74 77
75 /* set i2c slave address of codec part */ 78 /* set i2c slave address of codec part */
76 I2C2_SLAD0 = AS3514_I2C_ADDR << 1; 79 I2C2_SLAD0 = AS3514_I2C_ADDR << 1;