Merge tag 'regmap-fix-v4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git...
[cascardo/linux.git] / drivers / i2c / busses / i2c-rk3x.c
index 5c5b7ca..df22066 100644 (file)
@@ -58,7 +58,7 @@ enum {
 #define REG_CON_LASTACK   BIT(5) /* 1: send NACK after last received byte */
 #define REG_CON_ACTACK    BIT(6) /* 1: stop if NACK is received */
 
-#define REG_CON_TUNING_MASK GENMASK(15, 8)
+#define REG_CON_TUNING_MASK GENMASK_ULL(15, 8)
 
 #define REG_CON_SDA_CFG(cfg) ((cfg) << 8)
 #define REG_CON_STA_CFG(cfg) ((cfg) << 12)
@@ -694,6 +694,8 @@ static int rk3x_i2c_v0_calc_timings(unsigned long clk_rate,
        t_calc->div_low--;
        t_calc->div_high--;
 
+       /* Give the tuning value 0, that would not update con register */
+       t_calc->tuning = 0;
        /* Maximum divider supported by hw is 0xffff */
        if (t_calc->div_low > 0xffff) {
                t_calc->div_low = 0xffff;
@@ -742,7 +744,7 @@ static int rk3x_i2c_v1_calc_timings(unsigned long clk_rate,
                                    struct i2c_timings *t,
                                    struct rk3x_i2c_calced_timings *t_calc)
 {
-       unsigned long min_low_ns, min_high_ns, min_total_ns;
+       unsigned long min_low_ns, min_high_ns;
        unsigned long min_setup_start_ns, min_setup_data_ns;
        unsigned long min_setup_stop_ns, max_hold_data_ns;
 
@@ -793,7 +795,6 @@ static int rk3x_i2c_v1_calc_timings(unsigned long clk_rate,
 
        /* These are the min dividers needed for min hold times. */
        min_div_for_hold = (min_low_div + min_high_div);
-       min_total_ns = min_low_ns + min_high_ns;
 
        /*
         * This is the maximum divider so we don't go over the maximum.
@@ -1312,10 +1313,8 @@ static int rk3x_i2c_probe(struct platform_device *pdev)
        rk3x_i2c_adapt_div(i2c, clk_rate);
 
        ret = i2c_add_adapter(&i2c->adap);
-       if (ret < 0) {
-               dev_err(&pdev->dev, "Could not register adapter\n");
+       if (ret < 0)
                goto err_clk_notifier;
-       }
 
        dev_info(&pdev->dev, "Initialized RK3xxx I2C bus at %p\n", i2c->regs);