[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 899 struct pxa_i2c *i2c = adap->algo_data; 900 900 int ret, i; 901 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 + 902 908 for (i = adap->retries; i >= 0; i--) { 903 909 ret = i2c_pxa_do_xfer(i2c, msgs, num); 904 910 if (ret != I2C_RETRY) ··· 945 939 static int i2c_pxa_probe(struct platform_device *dev) 946 940 { 947 941 struct pxa_i2c *i2c = &i2c_pxa; 942 + #ifdef CONFIG_I2C_PXA_SLAVE 948 943 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 944 + #endif 949 945 int ret; 950 946 951 947 #ifdef CONFIG_PXA27x ··· 1031 1023 { 1032 1024 return platform_driver_unregister(&i2c_pxa_driver); 1033 1025 } 1026 + 1027 + MODULE_LICENSE("GPL"); 1034 1028 1035 1029 module_init(i2c_adap_pxa_init); 1036 1030 module_exit(i2c_adap_pxa_exit);