ppc4xx: Fix i2c divisor calcularion for PPC4xx
authorJeffrey Mann <mannj@embeddedplanet.com>
Thu, 12 Apr 2007 12:15:59 +0000 (14:15 +0200)
committerStefan Roese <sr@denx.de>
Thu, 12 Apr 2007 12:15:59 +0000 (14:15 +0200)
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: Jeffrey Mann <mannj@embeddedplanet.com>
Signed-off-by: Stefan Roese <sr@denx.de>
cpu/ppc4xx/i2c.c

index 8f4da8621dde85bd2b3f75cac6659407e66ecc27..47c264e222c4aa4ea01f5703c727f6e7165ecada 100644 (file)
@@ -91,7 +91,6 @@ static void _i2c_bus_reset(void)
 
 void i2c_init(int speed, int slaveadd)
 {
-       sys_info_t sysInfo;
        unsigned long freqOPB;
        int val, divisor;
        int bus;
@@ -124,8 +123,7 @@ void i2c_init(int speed, int slaveadd)
 
                /* Clock divide Register */
                /* get OPB frequency */
-               get_sys_info(&sysInfo);
-               freqOPB = sysInfo.freqPLB / sysInfo.pllOpbDiv;
+               freqOPB = get_OPB_freq();
                /* set divisor according to freqOPB */
                divisor = (freqOPB - 1) / 10000000;
                if (divisor == 0)