[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 <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Richard Purdie and committed by Russell King ece5f7b3 6b090a25

+10
+10
drivers/i2c/busses/i2c-pxa.c
··· 899 struct pxa_i2c *i2c = adap->algo_data; 900 int ret, i; 901 902 for (i = adap->retries; i >= 0; i--) { 903 ret = i2c_pxa_do_xfer(i2c, msgs, num); 904 if (ret != I2C_RETRY) ··· 945 static int i2c_pxa_probe(struct platform_device *dev) 946 { 947 struct pxa_i2c *i2c = &i2c_pxa; 948 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 949 int ret; 950 951 #ifdef CONFIG_PXA27x ··· 1031 { 1032 return platform_driver_unregister(&i2c_pxa_driver); 1033 } 1034 1035 module_init(i2c_adap_pxa_init); 1036 module_exit(i2c_adap_pxa_exit);
··· 899 struct pxa_i2c *i2c = adap->algo_data; 900 int ret, i; 901 902 + /* If the I2C controller is disabled we need to reset it (probably due 903 + to a suspend/resume destroying state). We do this here as we can then 904 + avoid worrying about resuming the controller before its users. */ 905 + if (!(ICR & ICR_IUE)) 906 + i2c_pxa_reset(i2c); 907 + 908 for (i = adap->retries; i >= 0; i--) { 909 ret = i2c_pxa_do_xfer(i2c, msgs, num); 910 if (ret != I2C_RETRY) ··· 939 static int i2c_pxa_probe(struct platform_device *dev) 940 { 941 struct pxa_i2c *i2c = &i2c_pxa; 942 + #ifdef CONFIG_I2C_PXA_SLAVE 943 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 944 + #endif 945 int ret; 946 947 #ifdef CONFIG_PXA27x ··· 1023 { 1024 return platform_driver_unregister(&i2c_pxa_driver); 1025 } 1026 + 1027 + MODULE_LICENSE("GPL"); 1028 1029 module_init(i2c_adap_pxa_init); 1030 module_exit(i2c_adap_pxa_exit);