Commit b3750b62 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: sh_mobile: require setup callback

Require the setup callback and move the frequency calculation into it.
This is in preparation for supporting multiple formulas.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 12742b6a
...@@ -771,15 +771,17 @@ static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd) ...@@ -771,15 +771,17 @@ static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
iic_wr(pd, ICCR, ICCR_TRS); iic_wr(pd, ICCR, ICCR_TRS);
udelay(10); udelay(10);
return 0; return sh_mobile_i2c_init(pd);
} }
static const struct sh_mobile_dt_config default_dt_config = { static const struct sh_mobile_dt_config default_dt_config = {
.clks_per_count = 1, .clks_per_count = 1,
.setup = sh_mobile_i2c_init,
}; };
static const struct sh_mobile_dt_config fast_clock_dt_config = { static const struct sh_mobile_dt_config fast_clock_dt_config = {
.clks_per_count = 2, .clks_per_count = 2,
.setup = sh_mobile_i2c_init,
}; };
static const struct sh_mobile_dt_config r8a7740_dt_config = { static const struct sh_mobile_dt_config r8a7740_dt_config = {
...@@ -882,15 +884,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev) ...@@ -882,15 +884,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
config = of_device_get_match_data(&dev->dev); config = of_device_get_match_data(&dev->dev);
if (config) { if (config) {
pd->clks_per_count = config->clks_per_count; pd->clks_per_count = config->clks_per_count;
ret = config->setup(pd);
if (config->setup) { } else {
ret = config->setup(pd); ret = sh_mobile_i2c_init(pd);
if (ret)
return ret;
}
} }
ret = sh_mobile_i2c_init(pd);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment