i2c: rk3x: support fast-mode plus for rk3399
Implement fast mode plus that allows bus speeds of up to 1MHz. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Caesar Wang <wxt@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
parent
7e086c3fc2
commit
a02f3d081a
1 changed files with 17 additions and 4 deletions
|
@ -126,6 +126,17 @@ static const struct i2c_spec_values fast_mode_spec = {
|
||||||
.min_hold_buffer_ns = 1300,
|
.min_hold_buffer_ns = 1300,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct i2c_spec_values fast_mode_plus_spec = {
|
||||||
|
.min_hold_start_ns = 260,
|
||||||
|
.min_low_ns = 500,
|
||||||
|
.min_high_ns = 260,
|
||||||
|
.min_setup_start_ns = 260,
|
||||||
|
.max_data_hold_ns = 400,
|
||||||
|
.min_data_setup_ns = 50,
|
||||||
|
.min_setup_stop_ns = 260,
|
||||||
|
.min_hold_buffer_ns = 500,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct rk3x_i2c_calced_timings:
|
* struct rk3x_i2c_calced_timings:
|
||||||
* @div_low: Divider output for low
|
* @div_low: Divider output for low
|
||||||
|
@ -532,8 +543,10 @@ static const struct i2c_spec_values *rk3x_i2c_get_spec(unsigned int speed)
|
||||||
{
|
{
|
||||||
if (speed <= 100000)
|
if (speed <= 100000)
|
||||||
return &standard_mode_spec;
|
return &standard_mode_spec;
|
||||||
else
|
else if (speed <= 400000)
|
||||||
return &fast_mode_spec;
|
return &fast_mode_spec;
|
||||||
|
else
|
||||||
|
return &fast_mode_plus_spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -744,9 +757,9 @@ static int rk3x_i2c_v1_calc_timings(unsigned long clk_rate,
|
||||||
const struct i2c_spec_values *spec;
|
const struct i2c_spec_values *spec;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Support standard-mode and fast-mode */
|
/* Support standard-mode, fast-mode and fast-mode plus */
|
||||||
if (WARN_ON(t->bus_freq_hz > 400000))
|
if (WARN_ON(t->bus_freq_hz > 1000000))
|
||||||
t->bus_freq_hz = 400000;
|
t->bus_freq_hz = 1000000;
|
||||||
|
|
||||||
/* prevent scl_rate_khz from becoming 0 */
|
/* prevent scl_rate_khz from becoming 0 */
|
||||||
if (WARN_ON(t->bus_freq_hz < 1000))
|
if (WARN_ON(t->bus_freq_hz < 1000))
|
||||||
|
|
Loading…
Reference in a new issue