mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-25 10:15:11 +02:00
ixp4xx: fix the i2c pld driver for 2.6.37 - i2c uses a rt_mutex instead of a mutex now
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25725 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
28b7905f64
commit
c81ca95c1b
@ -51,7 +51,7 @@
|
|||||||
+/*
|
+/*
|
||||||
+ * The Gateworks I2C PLD chip does not properly send the acknowledge bit
|
+ * The Gateworks I2C PLD chip does not properly send the acknowledge bit
|
||||||
+ * thus we cannot use standard i2c_smbus functions. We have recreated
|
+ * thus we cannot use standard i2c_smbus functions. We have recreated
|
||||||
+ * our own here, but we still use the mutex_lock to lock the i2c_bus
|
+ * our own here, but we still use the rt_mutex_lock to lock the i2c_bus
|
||||||
+ * as the device still exists on the I2C bus.
|
+ * as the device still exists on the I2C bus.
|
||||||
+*/
|
+*/
|
||||||
+
|
+
|
||||||
@ -181,19 +181,19 @@
|
|||||||
+ struct i2c_adapter *adap = gpio->client->adapter;
|
+ struct i2c_adapter *adap = gpio->client->adapter;
|
||||||
+
|
+
|
||||||
+ if (in_atomic() || irqs_disabled()) {
|
+ if (in_atomic() || irqs_disabled()) {
|
||||||
+ ret = mutex_trylock(&adap->bus_lock);
|
+ ret = rt_mutex_trylock(&adap->bus_lock);
|
||||||
+ if (!ret)
|
+ if (!ret)
|
||||||
+ /* I2C activity is ongoing. */
|
+ /* I2C activity is ongoing. */
|
||||||
+ return -EAGAIN;
|
+ return -EAGAIN;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ mutex_lock_nested(&adap->bus_lock, adap->level);
|
+ rt_mutex_lock(&adap->bus_lock);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ gpio->out |= (1 << offset);
|
+ gpio->out |= (1 << offset);
|
||||||
+
|
+
|
||||||
+ ret = i2c_pld_write_byte(gpio->client->addr, gpio->out);
|
+ ret = i2c_pld_write_byte(gpio->client->addr, gpio->out);
|
||||||
+
|
+
|
||||||
+ mutex_unlock(&adap->bus_lock);
|
+ rt_mutex_unlock(&adap->bus_lock);
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
@ -206,17 +206,17 @@
|
|||||||
+ struct i2c_adapter *adap = gpio->client->adapter;
|
+ struct i2c_adapter *adap = gpio->client->adapter;
|
||||||
+
|
+
|
||||||
+ if (in_atomic() || irqs_disabled()) {
|
+ if (in_atomic() || irqs_disabled()) {
|
||||||
+ ret = mutex_trylock(&adap->bus_lock);
|
+ ret = rt_mutex_trylock(&adap->bus_lock);
|
||||||
+ if (!ret)
|
+ if (!ret)
|
||||||
+ /* I2C activity is ongoing. */
|
+ /* I2C activity is ongoing. */
|
||||||
+ return -EAGAIN;
|
+ return -EAGAIN;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ mutex_lock_nested(&adap->bus_lock, adap->level);
|
+ rt_mutex_lock(&adap->bus_lock);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ value = i2c_pld_read_byte(gpio->client->addr);
|
+ value = i2c_pld_read_byte(gpio->client->addr);
|
||||||
+
|
+
|
||||||
+ mutex_unlock(&adap->bus_lock);
|
+ rt_mutex_unlock(&adap->bus_lock);
|
||||||
+
|
+
|
||||||
+ return (value < 0) ? 0 : (value & (1 << offset));
|
+ return (value < 0) ? 0 : (value & (1 << offset));
|
||||||
+}
|
+}
|
||||||
@ -231,12 +231,12 @@
|
|||||||
+ unsigned bit = 1 << offset;
|
+ unsigned bit = 1 << offset;
|
||||||
+
|
+
|
||||||
+ if (in_atomic() || irqs_disabled()) {
|
+ if (in_atomic() || irqs_disabled()) {
|
||||||
+ ret = mutex_trylock(&adap->bus_lock);
|
+ ret = rt_mutex_trylock(&adap->bus_lock);
|
||||||
+ if (!ret)
|
+ if (!ret)
|
||||||
+ /* I2C activity is ongoing. */
|
+ /* I2C activity is ongoing. */
|
||||||
+ return -EAGAIN;
|
+ return -EAGAIN;
|
||||||
+ } else {
|
+ } else {
|
||||||
+ mutex_lock_nested(&adap->bus_lock, adap->level);
|
+ rt_mutex_lock(&adap->bus_lock);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
@ -247,7 +247,7 @@
|
|||||||
+
|
+
|
||||||
+ ret = i2c_pld_write_byte(gpio->client->addr, gpio->out);
|
+ ret = i2c_pld_write_byte(gpio->client->addr, gpio->out);
|
||||||
+
|
+
|
||||||
+ mutex_unlock(&adap->bus_lock);
|
+ rt_mutex_unlock(&adap->bus_lock);
|
||||||
+
|
+
|
||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
|
Loading…
Reference in New Issue
Block a user