summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-sh_mobile.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2017-12-18 22:57:58 +0100
committerWolfram Sang <wsa@the-dreams.de>2018-01-15 17:58:50 +0100
commitb3750b6278b2f37618931352df8de6e7ddbecd1e (patch)
treed7d093446b74ea43e1d7d5648c81ddd32fa0ed21 /drivers/i2c/busses/i2c-sh_mobile.c
parent12742b6ac1215496a60fcf33d1d8397af7512840 (diff)
downloadop-kernel-dev-b3750b6278b2f37618931352df8de6e7ddbecd1e.zip
op-kernel-dev-b3750b6278b2f37618931352df8de6e7ddbecd1e.tar.gz
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: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-sh_mobile.c')
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index a3a377a..88af452 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -771,15 +771,17 @@ static int sh_mobile_i2c_r8a7740_workaround(struct sh_mobile_i2c_data *pd)
iic_wr(pd, ICCR, ICCR_TRS);
udelay(10);
- return 0;
+ return sh_mobile_i2c_init(pd);
}
static const struct sh_mobile_dt_config default_dt_config = {
.clks_per_count = 1,
+ .setup = sh_mobile_i2c_init,
};
static const struct sh_mobile_dt_config fast_clock_dt_config = {
.clks_per_count = 2,
+ .setup = sh_mobile_i2c_init,
};
static const struct sh_mobile_dt_config r8a7740_dt_config = {
@@ -882,15 +884,10 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
config = of_device_get_match_data(&dev->dev);
if (config) {
pd->clks_per_count = config->clks_per_count;
-
- if (config->setup) {
- ret = config->setup(pd);
- if (ret)
- return ret;
- }
+ ret = config->setup(pd);
+ } else {
+ ret = sh_mobile_i2c_init(pd);
}
-
- ret = sh_mobile_i2c_init(pd);
if (ret)
return ret;
OpenPOWER on IntegriCloud