|
|
|
@ -140,23 +140,34 @@ int enable_usdhc_clk(unsigned char enable, unsigned bus_num) |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_SYS_I2C_MXC |
|
|
|
|
/* i2c_num can be from 0 - 2 */ |
|
|
|
|
/* i2c_num can be from 0 - 3 */ |
|
|
|
|
int enable_i2c_clk(unsigned char enable, unsigned i2c_num) |
|
|
|
|
{ |
|
|
|
|
u32 reg; |
|
|
|
|
u32 mask; |
|
|
|
|
|
|
|
|
|
if (i2c_num > 2) |
|
|
|
|
if (i2c_num > 3) |
|
|
|
|
return -EINVAL; |
|
|
|
|
|
|
|
|
|
mask = MXC_CCM_CCGR_CG_MASK |
|
|
|
|
<< (MXC_CCM_CCGR2_I2C1_SERIAL_OFFSET + (i2c_num << 1)); |
|
|
|
|
reg = __raw_readl(&imx_ccm->CCGR2); |
|
|
|
|
if (enable) |
|
|
|
|
reg |= mask; |
|
|
|
|
else |
|
|
|
|
reg &= ~mask; |
|
|
|
|
__raw_writel(reg, &imx_ccm->CCGR2); |
|
|
|
|
if (i2c_num < 3) { |
|
|
|
|
mask = MXC_CCM_CCGR_CG_MASK |
|
|
|
|
<< (MXC_CCM_CCGR2_I2C1_SERIAL_OFFSET |
|
|
|
|
+ (i2c_num << 1)); |
|
|
|
|
reg = __raw_readl(&imx_ccm->CCGR2); |
|
|
|
|
if (enable) |
|
|
|
|
reg |= mask; |
|
|
|
|
else |
|
|
|
|
reg &= ~mask; |
|
|
|
|
__raw_writel(reg, &imx_ccm->CCGR2); |
|
|
|
|
} else { |
|
|
|
|
mask = MXC_CCM_CCGR_CG_MASK |
|
|
|
|
<< (MXC_CCM_CCGR1_I2C4_SERIAL_OFFSET); |
|
|
|
|
reg = __raw_readl(&imx_ccm->CCGR1); |
|
|
|
|
if (enable) |
|
|
|
|
reg |= mask; |
|
|
|
|
else |
|
|
|
|
reg &= ~mask; |
|
|
|
|
__raw_writel(reg, &imx_ccm->CCGR1); |
|
|
|
|
} |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|