Skip to content
Snippets Groups Projects
Commit 2ad3aba0 authored by Jeffrey Mann's avatar Jeffrey Mann Committed by Stefan Roese
Browse files

ppc4xx: Fix i2c divisor calcularion for PPC4xx


This patch fixes changes the i2c_init(...) function to use the function
get_OPB_freq() rather than calculating the OPB speed by
sysInfo.freqPLB/sysInfo.pllOpbDiv. The get_OPB_freq() function is
specific per processor. The prior method was not and so was calculating
the wrong speed for some PPC4xx processors.

Signed-off-by: default avatarJeffrey Mann <mannj@embeddedplanet.com>
Signed-off-by: default avatarStefan Roese <sr@denx.de>
parent e8aac8e7
Branches
Tags
No related merge requests found
...@@ -91,7 +91,6 @@ static void _i2c_bus_reset(void) ...@@ -91,7 +91,6 @@ static void _i2c_bus_reset(void)
void i2c_init(int speed, int slaveadd) void i2c_init(int speed, int slaveadd)
{ {
sys_info_t sysInfo;
unsigned long freqOPB; unsigned long freqOPB;
int val, divisor; int val, divisor;
int bus; int bus;
...@@ -124,8 +123,7 @@ void i2c_init(int speed, int slaveadd) ...@@ -124,8 +123,7 @@ void i2c_init(int speed, int slaveadd)
/* Clock divide Register */ /* Clock divide Register */
/* get OPB frequency */ /* get OPB frequency */
get_sys_info(&sysInfo); freqOPB = get_OPB_freq();
freqOPB = sysInfo.freqPLB / sysInfo.pllOpbDiv;
/* set divisor according to freqOPB */ /* set divisor according to freqOPB */
divisor = (freqOPB - 1) / 10000000; divisor = (freqOPB - 1) / 10000000;
if (divisor == 0) if (divisor == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment