summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2009-05-14 09:36:56 +0000
committerRafaël Carré <rafael.carre@gmail.com>2009-05-14 09:36:56 +0000
commit49c25816f0b76fe71f5efcc38523900bf1429b7b (patch)
treef290e95db4d437425fda17b5cd3e21461afc5019 /firmware
parent11231155591526ad78e9cfc8c77c0ea0be6738a3 (diff)
Sansa AMS i2c : fix 2 problems identified by Jack Halpin & Bertrik Sikken
i2c clock frequency uses pclk as reference, not plla i2c clock divider is only 10 bits, not 16 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20929 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/ascodec-as3525.c4
-rw-r--r--firmware/target/arm/as3525/clock-target.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c
index 4f13dd6300..43a982f454 100644
--- a/firmware/target/arm/as3525/ascodec-as3525.c
+++ b/firmware/target/arm/as3525/ascodec-as3525.c
@@ -72,8 +72,8 @@ void ascodec_init(void)
/* prescaler for i2c clock */
prescaler = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
- I2C2_CPSR0 = prescaler & 0xFF;
- I2C2_CPSR1 = (prescaler >> 8) & 0xFF;
+ I2C2_CPSR0 = prescaler & 0xFF; /* 8 lsb */
+ I2C2_CPSR1 = (prescaler >> 8) & 0x3; /* 2 msb */
/* set i2c slave address of codec part */
I2C2_SLAD0 = AS3514_I2C_ADDR << 1;
diff --git a/firmware/target/arm/as3525/clock-target.h b/firmware/target/arm/as3525/clock-target.h
index f4b223cdff..49308ce9ea 100644
--- a/firmware/target/arm/as3525/clock-target.h
+++ b/firmware/target/arm/as3525/clock-target.h
@@ -53,7 +53,7 @@
#endif
#define AS3525_I2C_FREQ 400000
-#if (CLK_DIV(AS3525_PLLA_FREQ, AS3525_I2C_FREQ)) >= (1<<16) /* 2*8 bits */
+#if (CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ)) >= (1<<10) /* 2+8 bits */
#error I2C frequency is too low : clock divider will not fit !
#endif