diff options
author | Troy Kisky <troy.kisky@boundarydevices.com> | 2012-07-19 08:18:25 +0000 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2012-07-31 08:00:57 +0200 |
commit | cc54a0f7cccf976d350801d39c406e75465ebdd1 (patch) | |
tree | c28139c6518e37fd16786cd011bbb5b5f0556a0b /arch/arm/cpu/armv7/mx6 | |
parent | df369dcdb05729304761748856a2513d9ddac272 (diff) |
imx-common: add i2c.c for bus recovery support
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Diffstat (limited to 'arch/arm/cpu/armv7/mx6')
-rw-r--r-- | arch/arm/cpu/armv7/mx6/clock.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c index 52d5dc4d90..fddb3733ae 100644 --- a/arch/arm/cpu/armv7/mx6/clock.c +++ b/arch/arm/cpu/armv7/mx6/clock.c @@ -50,6 +50,26 @@ void enable_usboh3_clk(unsigned char enable) } +#ifdef CONFIG_I2C_MXC +/* i2c_num can be from 0 - 2 */ +int enable_i2c_clk(unsigned char enable, unsigned i2c_num) +{ + u32 reg; + u32 mask; + + if (i2c_num > 2) + return -EINVAL; + mask = MXC_CCM_CCGR_CG_MASK << ((i2c_num + 3) << 1); + reg = __raw_readl(&imx_ccm->CCGR2); + if (enable) + reg |= mask; + else + reg &= ~mask; + __raw_writel(reg, &imx_ccm->CCGR2); + return 0; +} +#endif + static u32 decode_pll(enum pll_clocks pll, u32 infreq) { u32 div; |