projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
i2c: Move PPC4xx I2C driver into drivers/i2c directory
[oweals/u-boot.git]
/
drivers
/
i2c
/
mxc_i2c.c
diff --git
a/drivers/i2c/mxc_i2c.c
b/drivers/i2c/mxc_i2c.c
index a21832944d2db14f01d383e19df3e239beeab175..8e10fbb21ca96b207dce0b3660a0e415b2e85a38 100644
(file)
--- a/
drivers/i2c/mxc_i2c.c
+++ b/
drivers/i2c/mxc_i2c.c
@@
-24,7
+24,7
@@
#include <common.h>
#include <common.h>
-#if defined(CONFIG_HARD_I2C)
&& defined (CONFIG_I2C_MXC)
+#if defined(CONFIG_HARD_I2C)
#include <asm/arch/mx31.h>
#include <asm/arch/mx31-regs.h>
#include <asm/arch/mx31.h>
#include <asm/arch/mx31-regs.h>
@@
-47,14
+47,17
@@
#define I2SR_IIF (1 << 1)
#define I2SR_RX_NO_AK (1 << 0)
#define I2SR_IIF (1 << 1)
#define I2SR_RX_NO_AK (1 << 0)
-#ifdef C
FG
_I2C_MX31_PORT1
+#ifdef C
ONFIG_SYS
_I2C_MX31_PORT1
#define I2C_BASE 0x43f80000
#define I2C_BASE 0x43f80000
-#elif defined (CFG_I2C_MX31_PORT2)
+#define I2C_CLK_OFFSET 26
+#elif defined (CONFIG_SYS_I2C_MX31_PORT2)
#define I2C_BASE 0x43f98000
#define I2C_BASE 0x43f98000
-#elif defined (CFG_I2C_MX31_PORT3)
+#define I2C_CLK_OFFSET 28
+#elif defined (CONFIG_SYS_I2C_MX31_PORT3)
#define I2C_BASE 0x43f84000
#define I2C_BASE 0x43f84000
+#define I2C_CLK_OFFSET 30
#else
#else
-#error "define C
FG
_I2C_MX31_PORTx to use the mx31 I2C driver"
+#error "define C
ONFIG_SYS
_I2C_MX31_PORTx to use the mx31 I2C driver"
#endif
#ifdef DEBUG
#endif
#ifdef DEBUG
@@
-72,6
+75,9
@@
void i2c_init(int speed, int unused)
int freq = mx31_get_ipg_clk();
int i;
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;
for (i = 0; i < 0x1f; i++)
if (freq / div[i] <= speed)
break;