diff options
author | Peng Fan <Peng.Fan@freescale.com> | 2015-01-06 10:07:05 +0800 |
---|---|---|
committer | Frank Li <Frank.Li@freescale.com> | 2015-02-04 21:53:31 +0800 |
commit | 6fbf76c2332744aa1340bd05c87c7cdfa19c38da (patch) | |
tree | 127ac957d5a9a74eb64bf549754764981f400eb0 /drivers | |
parent | b52cb9d40e71305b7a11b0bbc68fddd8e84e3b17 (diff) | |
download | u-boot-imx-6fbf76c2332744aa1340bd05c87c7cdfa19c38da.zip u-boot-imx-6fbf76c2332744aa1340bd05c87c7cdfa19c38da.tar.gz u-boot-imx-6fbf76c2332744aa1340bd05c87c7cdfa19c38da.tar.bz2 |
MLK-10178-4 i2c:mxc fix i2c_data size in sram_data
We should not hardcode size of i2c_data to 3 ints in sram_data.
Since there are 4 i2c bus for 7d. Use ARRAY_SIZE(i2c_bases) instead
of hardcoded number. Also move related struct after i2c_bases to
avoid compile error.
Since i2c_data sram_data struct would better stay together, move them
together after i2c_bases struct array.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 71fbc46..4f73bdf 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -406,23 +406,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]; -}; - -/* - * For SPL boot some boards need i2c before SDRAM is initialized so force - * variables to live in SRAM - */ -static struct sram_data __attribute__((section(".data"))) srdata; - static void * const i2c_bases[] = { #if defined(CONFIG_MX25) (void *)IMX_I2C_BASE, @@ -449,6 +432,23 @@ 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)]; +}; + +/* + * For SPL boot some boards need i2c before SDRAM is initialized so force + * variables to live in SRAM + */ +static struct sram_data __attribute__((section(".data"))) srdata; + void *i2c_get_base(struct i2c_adapter *adap) { return i2c_bases[adap->hwadapnr]; |