1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Bertrik Sikken 2009-05-06 17:33:56 +00:00
parent 330f9359e2
commit b5886beb81

View file

@ -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;