aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWolfram Sang <w.sang@pengutronix.de>2009-04-06 10:27:45 -0400
committerBen Dooks <ben-linux@fluff.org>2009-04-07 05:23:34 -0400
commit65de394df21f8ccc61525f77b0e4ee6940a0932e (patch)
treebb8254b4ff87882ad2fafaf9d6ffcd6d679eed23 /drivers
parentb486ddbc0fb8127ccf2c820cfbf0b98e6f8a4e97 (diff)
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')
-rw-r--r--drivers/i2c/busses/i2c-imx.c7
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 @@
86/** Variables ****************************************************************** 86/** Variables ******************************************************************
87*******************************************************************************/ 87*******************************************************************************/
88 88
89static unsigned int disable_delay; /* Dummy delay */
90
91/* 89/*
92 * sorted list of clock divider, register value pairs 90 * sorted list of clock divider, register value pairs
93 * taken from table 26-5, p.26-9, Freescale i.MX 91 * taken from table 26-5, p.26-9, Freescale i.MX
@@ -121,6 +119,7 @@ struct imx_i2c_struct {
121 int irq; 119 int irq;
122 wait_queue_head_t queue; 120 wait_queue_head_t queue;
123 unsigned long i2csr; 121 unsigned long i2csr;
122 unsigned int disable_delay;
124}; 123};
125 124
126/** Functions for IMX I2C adapter driver *************************************** 125/** Functions for IMX I2C adapter driver ***************************************
@@ -212,7 +211,7 @@ static void i2c_imx_stop(struct imx_i2c_struct *i2c_imx)
212 * This delay caused by an i.MXL hardware bug. 211 * This delay caused by an i.MXL hardware bug.
213 * If no (or too short) delay, no "STOP" bit will be generated. 212 * If no (or too short) delay, no "STOP" bit will be generated.
214 */ 213 */
215 udelay(disable_delay); 214 udelay(i2c_imx->disable_delay);
216 /* Disable I2C controller */ 215 /* Disable I2C controller */
217 writeb(0, i2c_imx->base + IMX_I2C_I2CR); 216 writeb(0, i2c_imx->base + IMX_I2C_I2CR);
218} 217}
@@ -243,7 +242,7 @@ static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
243 * This delay is used in I2C bus disable function 242 * This delay is used in I2C bus disable function
244 * to fix chip hardware bug. 243 * to fix chip hardware bug.
245 */ 244 */
246 disable_delay = (500000U * i2c_clk_div[i][0] 245 i2c_imx->disable_delay = (500000U * i2c_clk_div[i][0]
247 + (i2c_clk_rate / 2) - 1) / (i2c_clk_rate / 2); 246 + (i2c_clk_rate / 2) - 1) / (i2c_clk_rate / 2);
248 247
249 /* dev_dbg() can't be used, because adapter is not yet registered */ 248 /* dev_dbg() can't be used, because adapter is not yet registered */