diff options
author | Tom Rini <trini@konsulko.com> | 2017-10-18 09:32:35 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-10-18 09:32:35 -0400 |
commit | 6b0fea33424dcce82b6df0c6b3774601eb1ff36a (patch) | |
tree | dbd8c86248fecd5dbea138581c5fe73dc34d8d56 /drivers | |
parent | 002e91087c817f8281fccee327e0d8e98c691a2f (diff) | |
parent | d10bd6cfd85c2a9f27c950e22e83d27ff978e7e8 (diff) | |
download | u-boot-6b0fea33424dcce82b6df0c6b3774601eb1ff36a.tar.gz |
Merge git://git.denx.de/u-boot-i2c
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-uclass.c | 2 | ||||
-rw-r--r-- | drivers/i2c/stm32f7_i2c.c | 17 |
2 files changed, 6 insertions, 13 deletions
diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c index 1397f34dda..920811a075 100644 --- a/drivers/i2c/i2c-uclass.c +++ b/drivers/i2c/i2c-uclass.c @@ -12,8 +12,6 @@ #include <dm/device-internal.h> #include <dm/lists.h> -DECLARE_GLOBAL_DATA_PTR; - #define I2C_MAX_OFFSET_LEN 4 /* Useful debugging function */ diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 196f2365ea..86624878e2 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -571,6 +571,7 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup, u32 dnf_delay; u32 tsync; u16 l, h; + bool sol_found = false; int ret = 0; af_delay_min = setup->analog_filter ? @@ -619,14 +620,15 @@ static int stm32_i2c_choose_solution(struct stm32_i2c_setup *setup, clk_error_prev = clk_error; v->scll = l; v->sclh = h; - s = v; + sol_found = true; + memcpy(s, v, sizeof(*s)); } } } } } - if (!s) { + if (!sol_found) { pr_err("%s: no solution at all\n", __func__); ret = -EPERM; } @@ -638,7 +640,7 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv, struct stm32_i2c_setup *setup, struct stm32_i2c_timings *output) { - struct stm32_i2c_timings *v, *_v, *s; + struct stm32_i2c_timings *v, *_v; struct list_head solutions; int ret; @@ -669,22 +671,15 @@ static int stm32_i2c_compute_timing(struct stm32_i2c_priv *i2c_priv, return -EINVAL; } - s = NULL; INIT_LIST_HEAD(&solutions); ret = stm32_i2c_compute_solutions(setup, &solutions); if (ret) goto exit; - ret = stm32_i2c_choose_solution(setup, &solutions, s); + ret = stm32_i2c_choose_solution(setup, &solutions, output); if (ret) goto exit; - output->presc = s->presc; - output->scldel = s->scldel; - output->sdadel = s->sdadel; - output->scll = s->scll; - output->sclh = s->sclh; - debug("%s: Presc: %i, scldel: %i, sdadel: %i, scll: %i, sclh: %i\n", __func__, output->presc, output->scldel, output->sdadel, |