UPSTREAM: soc/intel/common: allow lpss i2c time-based data hold time
When using rise_time_ns and fall_time_ns there's currently not
a way to specify a target data hold time. The internal 300ns
value is used. However, that isn't always sufficient depending on
bus topology. Therefore, provide the ability to specify data
hold time in ns from devicetree, defaulting to default value if
none are specified.
BUG=b:36469182
Change-Id: I91bf2e75061f7513d4e2a969a4f18e66c7b1b99e
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: c5f10f9d85
Original-Change-Id: I86de095186ee396099709cc8a97240bd2f9722c9
Original-Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-on: https://review.coreboot.org/19064
Original-Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Original-Tested-by: build bot (Jenkins)
Original-Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/471451
This commit is contained in:
parent
5eb692b1d9
commit
859f061939
2 changed files with 9 additions and 1 deletions
|
|
@ -527,6 +527,7 @@ static int lpss_i2c_gen_config_rise_fall_time(struct lpss_i2c_regs *regs,
|
|||
const struct soc_clock *soc;
|
||||
int fall_cnt, rise_cnt, min_tlow_cnt, min_thigh_cnt, spk_cnt;
|
||||
int hcnt, lcnt, period_cnt, diff, tot;
|
||||
int data_hold_time_ns;
|
||||
|
||||
bus = get_bus_descriptor(speed);
|
||||
soc = get_soc_descriptor(ic_clk);
|
||||
|
|
@ -591,7 +592,13 @@ static int lpss_i2c_gen_config_rise_fall_time(struct lpss_i2c_regs *regs,
|
|||
config->speed = speed;
|
||||
config->scl_lcnt = lcnt;
|
||||
config->scl_hcnt = hcnt;
|
||||
config->sda_hold = counts_from_time(&soc->freq, DEFAULT_SDA_HOLD_TIME);
|
||||
|
||||
/* Use internal default unless other value is specified. */
|
||||
data_hold_time_ns = DEFAULT_SDA_HOLD_TIME;
|
||||
if (bcfg->data_hold_time_ns)
|
||||
data_hold_time_ns = bcfg->data_hold_time_ns;
|
||||
|
||||
config->sda_hold = counts_from_time(&soc->freq, data_hold_time_ns);
|
||||
|
||||
printk(LPSS_DEBUG, "lpss_i2c: hcnt = %d lcnt = %d sda hold = %d\n",
|
||||
hcnt, lcnt, config->sda_hold);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ struct lpss_i2c_bus_config {
|
|||
* precedence. */
|
||||
int rise_time_ns;
|
||||
int fall_time_ns;
|
||||
int data_hold_time_ns;
|
||||
/* Specific bus speed configuration */
|
||||
struct lpss_i2c_speed_config speed_config[LPSS_I2C_SPEED_CONFIG_COUNT];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue