diff options
-rw-r--r-- | firmware/target/arm/rk27xx/i2c-rk27xx.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/firmware/target/arm/rk27xx/i2c-rk27xx.c b/firmware/target/arm/rk27xx/i2c-rk27xx.c index 093fe702f2..f9f20930cc 100644 --- a/firmware/target/arm/rk27xx/i2c-rk27xx.c +++ b/firmware/target/arm/rk27xx/i2c-rk27xx.c | |||
@@ -131,13 +131,14 @@ void i2c_init(void) | |||
131 | 131 | ||
132 | /* set I2C divider to stay within allowed SCL freq limit | 132 | /* set I2C divider to stay within allowed SCL freq limit |
133 | * APBfreq = 50Mhz | 133 | * APBfreq = 50Mhz |
134 | * SCLfreq = (APBfreq/5*(I2CCDVR[5:3] + 1) * 2^((I2CCDVR[2:0] + 1)) | 134 | * I2C_div = (I2CCDVR[5:3] + 1) * 2^((I2CCDVR[2:0] + 1)) |
135 | */ | 135 | * SCLfreq = APBfreq/(5*I2C_div) |
136 | 136 | * | |
137 | /* we are driving this slightly above specs | 137 | * (5<<3) | (1<<0) 416.7 KHz (above spec) |
138 | * (6<<3) | (1<<0) 416kHz | 138 | * (6<<3) | (1<<0) 357.1 kHz |
139 | * (7<<3) | (1<<0) 357kHz | 139 | * (7<<3) | (1<<0) 312.4 kHz |
140 | * (6<<3) | (2<<0) 208kHz | 140 | * (6<<3) | (2<<0) 178.6 kHz |
141 | * (7<<3) | (2<<0) 156.3 kHz | ||
141 | */ | 142 | */ |
142 | I2C_OPR = (I2C_OPR & ~(0x3F)) | (6<<3) | (1<<0); | 143 | I2C_OPR = (I2C_OPR & ~(0x3F)) | (6<<3) | (1<<0); |
143 | 144 | ||