mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
[ARM] omap: i2c: remove conditional ick clocks
By providing a dummy ick for OMAP1510 and OMAP310, we avoid having SoC conditional clock information in i2c-omap.c. Also, fix the error handling by making sure we propagate the error returned via clk_get(). Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
0e9ae109e4
commit
5fe2338040
@ -132,6 +132,7 @@ static struct omap_clk omap_clks[] = {
|
|||||||
CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
|
CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
|
||||||
CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
|
CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
|
||||||
CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
|
CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
|
||||||
|
CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310),
|
||||||
CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
|
CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
|
||||||
CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
|
CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
|
||||||
CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
|
CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
|
||||||
|
@ -193,22 +193,24 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
|
|||||||
|
|
||||||
static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
|
static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
|
||||||
{
|
{
|
||||||
if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
|
int ret;
|
||||||
dev->iclk = clk_get(dev->dev, "ick");
|
|
||||||
if (IS_ERR(dev->iclk)) {
|
dev->iclk = clk_get(dev->dev, "ick");
|
||||||
dev->iclk = NULL;
|
if (IS_ERR(dev->iclk)) {
|
||||||
return -ENODEV;
|
ret = PTR_ERR(dev->iclk);
|
||||||
}
|
dev->iclk = NULL;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->fclk = clk_get(dev->dev, "fck");
|
dev->fclk = clk_get(dev->dev, "fck");
|
||||||
if (IS_ERR(dev->fclk)) {
|
if (IS_ERR(dev->fclk)) {
|
||||||
|
ret = PTR_ERR(dev->fclk);
|
||||||
if (dev->iclk != NULL) {
|
if (dev->iclk != NULL) {
|
||||||
clk_put(dev->iclk);
|
clk_put(dev->iclk);
|
||||||
dev->iclk = NULL;
|
dev->iclk = NULL;
|
||||||
}
|
}
|
||||||
dev->fclk = NULL;
|
dev->fclk = NULL;
|
||||||
return -ENODEV;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -218,18 +220,15 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev)
|
|||||||
{
|
{
|
||||||
clk_put(dev->fclk);
|
clk_put(dev->fclk);
|
||||||
dev->fclk = NULL;
|
dev->fclk = NULL;
|
||||||
if (dev->iclk != NULL) {
|
clk_put(dev->iclk);
|
||||||
clk_put(dev->iclk);
|
dev->iclk = NULL;
|
||||||
dev->iclk = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void omap_i2c_unidle(struct omap_i2c_dev *dev)
|
static void omap_i2c_unidle(struct omap_i2c_dev *dev)
|
||||||
{
|
{
|
||||||
WARN_ON(!dev->idle);
|
WARN_ON(!dev->idle);
|
||||||
|
|
||||||
if (dev->iclk != NULL)
|
clk_enable(dev->iclk);
|
||||||
clk_enable(dev->iclk);
|
|
||||||
clk_enable(dev->fclk);
|
clk_enable(dev->fclk);
|
||||||
dev->idle = 0;
|
dev->idle = 0;
|
||||||
if (dev->iestate)
|
if (dev->iestate)
|
||||||
@ -254,8 +253,7 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
|
|||||||
}
|
}
|
||||||
dev->idle = 1;
|
dev->idle = 1;
|
||||||
clk_disable(dev->fclk);
|
clk_disable(dev->fclk);
|
||||||
if (dev->iclk != NULL)
|
clk_disable(dev->iclk);
|
||||||
clk_disable(dev->iclk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omap_i2c_init(struct omap_i2c_dev *dev)
|
static int omap_i2c_init(struct omap_i2c_dev *dev)
|
||||||
|
Loading…
Reference in New Issue
Block a user