diff options
author | Peng Fan <Peng.Fan@freescale.com> | 2015-01-06 09:12:51 +0300 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2015-01-08 19:00:45 +0300 |
commit | c36ecf3abfbc20719bbc7229c9a112e2e137a400 (patch) | |
tree | 2332c2a56c6a61b2cb69b6522dfcfae7832fb711 /drivers/i2c | |
parent | 5ea019616483bb5103ee57e576e9bc559ea537b5 (diff) | |
download | u-boot-c36ecf3abfbc20719bbc7229c9a112e2e137a400.tar.xz |
i2c:mxc fix array size of i2c_data
We should not hardcode array size of i2c_data to 3. To CONFIG_FSL_LSCH3,
there are 4 i2c interface, but not 3. So the size of i2c_data array should
be calculated using "ARRAY_SIZE(i2c_bases)".
To avoid compile error, move i2c_bases before sram_data structure which
contains i2c_data array.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 021b2fe511..fc5ee35a1a 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -402,17 +402,6 @@ int bus_i2c_write(void *base, uchar chip, uint addr, int alen, return ret; } -struct i2c_parms { - void *base; - void *idle_bus_data; - int (*idle_bus_fn)(void *p); -}; - -struct sram_data { - unsigned curr_i2c_bus; - struct i2c_parms i2c_data[3]; -}; - static void * const i2c_bases[] = { #if defined(CONFIG_MX25) (void *)IMX_I2C_BASE, @@ -439,6 +428,17 @@ static void * const i2c_bases[] = { #endif }; +struct i2c_parms { + void *base; + void *idle_bus_data; + int (*idle_bus_fn)(void *p); +}; + +struct sram_data { + unsigned curr_i2c_bus; + struct i2c_parms i2c_data[ARRAY_SIZE(i2c_bases)]; +}; + void *i2c_get_base(struct i2c_adapter *adap) { return i2c_bases[adap->hwadapnr]; |