summaryrefslogtreecommitdiffstats
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.tar.bz2
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)
/* initialises the internal i2c bus and prepares for transfers to the codec */
void ascodec_init(void)
{
+ int prescaler;
+
/* enable clock */
CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
/* prescaler for i2c clock */
- I2C2_CPSR0 = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
- I2C2_CPSR1 = 0; /* MSB */
+ prescaler = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
+ I2C2_CPSR0 = prescaler & 0xFF;
+ I2C2_CPSR1 = (prescaler >> 8) & 0xFF;
/* set i2c slave address of codec part */
I2C2_SLAD0 = AS3514_I2C_ADDR << 1;