From ece5f7b3c4fde70a1ae4add7372ebca5c90bc34d Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 12 Jan 2006 16:30:23 +0000 Subject: [ARM] 3237/1: PXA I2C driver updates Patch from Richard Purdie This patch adds a check to see if the pxa i2c interface is enabled before allowing it to be used and resets it if found to be disabled. This automatically restores the interface if the device has been suspended and resumed without causing any suspend/resume call ordering issues. The patch also fixes a build warning and adds an appropriate module licence (the module is gpl according to the header). Signed-off-by: Richard Purdie Signed-off-by: Russell King --- drivers/i2c/busses/i2c-pxa.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/i2c/busses/i2c-pxa.c') diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 70f7ab829d36..86e2234faf80 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -899,6 +899,12 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num struct pxa_i2c *i2c = adap->algo_data; int ret, i; + /* If the I2C controller is disabled we need to reset it (probably due + to a suspend/resume destroying state). We do this here as we can then + avoid worrying about resuming the controller before its users. */ + if (!(ICR & ICR_IUE)) + i2c_pxa_reset(i2c); + for (i = adap->retries; i >= 0; i--) { ret = i2c_pxa_do_xfer(i2c, msgs, num); if (ret != I2C_RETRY) @@ -939,7 +945,9 @@ static struct pxa_i2c i2c_pxa = { static int i2c_pxa_probe(struct platform_device *dev) { struct pxa_i2c *i2c = &i2c_pxa; +#ifdef CONFIG_I2C_PXA_SLAVE struct i2c_pxa_platform_data *plat = dev->dev.platform_data; +#endif int ret; #ifdef CONFIG_PXA27x @@ -1024,5 +1032,7 @@ static void i2c_adap_pxa_exit(void) return platform_driver_unregister(&i2c_pxa_driver); } +MODULE_LICENSE("GPL"); + module_init(i2c_adap_pxa_init); module_exit(i2c_adap_pxa_exit); -- cgit v1.2.2