]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
i.MX31: Start the I2C clock on driver initialisation
authorGuennadi Liakhovetski <lg@denx.de>
Fri, 13 Feb 2009 08:23:36 +0000 (09:23 +0100)
committerHeiko Schocher <hs@denx.de>
Sat, 14 Feb 2009 09:00:51 +0000 (10:00 +0100)
i.MX31 powers on with most clocks running, so, after a power on this explicit
clock start up is not required. However, as Linux boots it disables most clocks
to save power. This includes the I2C clock. If we then soft reboot from Linux
the I2C clock stays off. This breaks the phycore, which has its environment in
I2C EEPROM. Fix the problem by explicitly starting the clock in I2C driver
initialisation routine.

Signed-off-by: Guennadi Liakhovetski <lg@denx.de>
Ack-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
drivers/i2c/mxc_i2c.c

index eedad065fed7b997b9af2668f4086fcaed2e59d5..8e10fbb21ca96b207dce0b3660a0e415b2e85a38 100644 (file)
 
 #ifdef CONFIG_SYS_I2C_MX31_PORT1
 #define I2C_BASE       0x43f80000
+#define I2C_CLK_OFFSET 26
 #elif defined (CONFIG_SYS_I2C_MX31_PORT2)
 #define I2C_BASE       0x43f98000
+#define I2C_CLK_OFFSET 28
 #elif defined (CONFIG_SYS_I2C_MX31_PORT3)
 #define I2C_BASE       0x43f84000
+#define I2C_CLK_OFFSET 30
 #else
 #error "define CONFIG_SYS_I2C_MX31_PORTx to use the mx31 I2C driver"
 #endif
@@ -72,6 +75,9 @@ void i2c_init(int speed, int unused)
        int freq = mx31_get_ipg_clk();
        int i;
 
+       /* start the required I2C clock */
+       __REG(CCM_CGR0) = __REG(CCM_CGR0) | (3 << I2C_CLK_OFFSET);
+
        for (i = 0; i < 0x1f; i++)
                if (freq / div[i] <= speed)
                        break;