aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-10-10 08:56:53 +0000
committerJohn Crispin <blogic@openwrt.org>2014-10-10 08:56:53 +0000
commit789decc87edc186476a5f134d288c2fea4843249 (patch)
treecb72cb0a940dd6bed93b022aec1e4dcbca174a80
parent784895b84e8b7dc7904882241b3ec382b36bdea2 (diff)
downloadupstream-789decc87edc186476a5f134d288c2fea4843249.tar.gz
upstream-789decc87edc186476a5f134d288c2fea4843249.tar.bz2
upstream-789decc87edc186476a5f134d288c2fea4843249.zip
ralink: various i2c related fixes
Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42868 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ramips/patches-3.14/0052-i2c-MIPS-adds-ralink-I2C-driver.patch41
1 files changed, 21 insertions, 20 deletions
diff --git a/target/linux/ramips/patches-3.14/0052-i2c-MIPS-adds-ralink-I2C-driver.patch b/target/linux/ramips/patches-3.14/0052-i2c-MIPS-adds-ralink-I2C-driver.patch
index a3b03116e2..29cb52a776 100644
--- a/target/linux/ramips/patches-3.14/0052-i2c-MIPS-adds-ralink-I2C-driver.patch
+++ b/target/linux/ramips/patches-3.14/0052-i2c-MIPS-adds-ralink-I2C-driver.patch
@@ -75,8 +75,8 @@ Index: linux-3.14.18/drivers/i2c/busses/Makefile
Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-3.14.18/drivers/i2c/busses/i2c-ralink.c 2014-10-06 15:53:32.416500362 +0200
-@@ -0,0 +1,298 @@
++++ linux-3.14.18/drivers/i2c/busses/i2c-ralink.c 2014-10-09 19:38:29.242416182 +0200
+@@ -0,0 +1,299 @@
+/*
+ * drivers/i2c/busses/i2c-ralink.c
+ *
@@ -107,7 +107,6 @@ Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/io.h>
-+#include <linux/of_i2c.h>
+#include <linux/err.h>
+
+#include <asm/mach-ralink/ralink_regs.h>
@@ -200,7 +199,7 @@ Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
+ int nblock = msg->len / READ_BLOCK;
+ int rem = msg->len % READ_BLOCK;
+ int ret = 0;
-+ /*printk("i2c handle msg len:%d\n",msg->len);*/
++
+ if (msg->flags & I2C_M_TEN) {
+ printk("10 bits addr not supported\n");
+ return -EINVAL;
@@ -209,14 +208,16 @@ Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
+ if (msg->flags & I2C_M_RD) {
+ for (i = 0; i < nblock; i++) {
+ if (rt_i2c_wait_idle()) {
-+ printk("i2c-read line busy\n");
-+ return -ETIMEDOUT;
-+ }
++ printk("i2c-read line busy\n");
++ return -ETIMEDOUT;
++ }
+ rt_i2c_w32(READ_BLOCK - 1, REG_BYTECNT_REG);
+ rt_i2c_w32(READ_CMD, REG_STARTXFR_REG);
+ for (j = 0; j < READ_BLOCK; j++) {
-+ if (rt_i2c_wait_rx_done()<0) ret = rt_i2c_wait_rx_done();
-+ if (rt_i2c_get_ack()<0) ret = rt_i2c_get_ack();
++ if (rt_i2c_wait_rx_done() < 0)
++ ret = rt_i2c_wait_rx_done();
++ if (rt_i2c_get_ack() < 0)
++ ret = rt_i2c_get_ack();
+ msg->buf[pos++] = rt_i2c_r32(REG_DATAIN_REG);
+ }
+ }
@@ -225,13 +226,15 @@ Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
+ printk("i2c-read line busy\n");
+ return -ETIMEDOUT;
+ }
-+ if (rem){
-+ rt_i2c_w32(rem - 1, REG_BYTECNT_REG);
-+ rt_i2c_w32(READ_CMD, REG_STARTXFR_REG);
++ if (rem) {
++ rt_i2c_w32(rem - 1, REG_BYTECNT_REG);
++ rt_i2c_w32(READ_CMD, REG_STARTXFR_REG);
+ }
+ for (i = 0; i < rem; i++) {
-+ if (rt_i2c_wait_rx_done()<0) ret = rt_i2c_wait_rx_done();
-+ if (rt_i2c_get_ack() <0) ret = rt_i2c_get_ack();
++ if (rt_i2c_wait_rx_done() < 0)
++ ret = rt_i2c_wait_rx_done();
++ if (rt_i2c_get_ack() < 0)
++ ret = rt_i2c_get_ack();
+
+ msg->buf[pos++] = rt_i2c_r32(REG_DATAIN_REG);
+ }
@@ -245,10 +248,10 @@ Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
+ rt_i2c_w32(msg->buf[i], REG_DATAOUT_REG);
+ rt_i2c_w32(WRITE_CMD, REG_STARTXFR_REG);
+
-+ if (rt_i2c_wait_tx_done()<0) ret = rt_i2c_wait_tx_done();
-+ if (rt_i2c_get_ack()<0) ret = rt_i2c_get_ack();
-+
-+
++ if (rt_i2c_wait_tx_done() < 0)
++ ret = rt_i2c_wait_tx_done();
++ if (rt_i2c_get_ack() < 0)
++ ret = rt_i2c_get_ack();
+ }
+ }
+
@@ -325,8 +328,6 @@ Index: linux-3.14.18/drivers/i2c/busses/i2c-ralink.c
+ if (ret)
+ return ret;
+
-+ of_i2c_register_devices(adapter);
-+
+ platform_set_drvdata(pdev, adapter);
+
+ dev_info(&pdev->dev, "loaded\n");