diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2009-04-06 16:27:45 +0200 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-04-07 11:23:34 +0200 |
commit | 65de394df21f8ccc61525f77b0e4ee6940a0932e (patch) | |
tree | bb8254b4ff87882ad2fafaf9d6ffcd6d679eed23 /drivers/i2c | |
parent | i2c: xtensa s6000 i2c driver (diff) | |
download | linux-65de394df21f8ccc61525f77b0e4ee6940a0932e.tar.xz linux-65de394df21f8ccc61525f77b0e4ee6940a0932e.zip |
i2c: imx: Make disable_delay a per-device variable
'disable_delay' was static which is wrong as it is calculated using the per-device
bus speed. This patch turns 'disable_delay' into a per-device variable.
Reported-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Darius Augulis <augulis.darius@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 433d3486de04..0b486a63460d 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -86,8 +86,6 @@ /** Variables ****************************************************************** *******************************************************************************/ -static unsigned int disable_delay; /* Dummy delay */ - /* * sorted list of clock divider, register value pairs * taken from table 26-5, p.26-9, Freescale i.MX @@ -121,6 +119,7 @@ struct imx_i2c_struct { int irq; wait_queue_head_t queue; unsigned long i2csr; + unsigned int disable_delay; }; /** Functions for IMX I2C adapter driver *************************************** @@ -212,7 +211,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx) * This delay caused by an i.MXL hardware bug. * If no (or too short) delay, no "STOP" bit will be generated. */ - udelay(disable_delay); + udelay(i2c_imx->disable_delay); /* Disable I2C controller */ writeb(0, i2c_imx->base + IMX_I2C_I2CR); } @@ -243,7 +242,7 @@ static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx, * This delay is used in I2C bus disable function * to fix chip hardware bug. */ - disable_delay = (500000U * i2c_clk_div[i][0] + i2c_imx->disable_delay = (500000U * i2c_clk_div[i][0] + (i2c_clk_rate / 2) - 1) / (i2c_clk_rate / 2); /* dev_dbg() can't be used, because adapter is not yet registered */ |