Changeset 37202


Ignore:
Timestamp:
2013-07-08T11:01:57+02:00 (5 years ago)
Author:
blogic
Message:

ralink: unbreak ralink i2c support

Signed-off-by: John Crispin <blogic@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ramips/patches-3.9/0153-i2c-MIPS-adds-ralink-I2C-driver.patch

    r37103 r37202  
    1414 create mode 100644 drivers/i2c/busses/i2c-ralink.c 
    1515 
    16 --- /dev/null 
    17 +++ b/Documentation/devicetree/bindings/i2c/i2c-ralink.txt 
     16Index: linux-3.9.8/Documentation/devicetree/bindings/i2c/i2c-ralink.txt 
     17=================================================================== 
     18--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     19+++ linux-3.9.8/Documentation/devicetree/bindings/i2c/i2c-ralink.txt    2013-07-02 11:36:42.944155612 +0200 
    1820@@ -0,0 +1,27 @@ 
    1921+I2C for Ralink platforms 
     
    4446+       }; 
    4547+}; 
    46 --- a/drivers/i2c/busses/Kconfig 
    47 +++ b/drivers/i2c/busses/Kconfig 
    48 @@ -628,6 +628,10 @@ config I2C_PXA_SLAVE 
     48Index: linux-3.9.8/drivers/i2c/busses/Kconfig 
     49=================================================================== 
     50--- linux-3.9.8.orig/drivers/i2c/busses/Kconfig 2013-06-27 19:41:32.000000000 +0200 
     51+++ linux-3.9.8/drivers/i2c/busses/Kconfig      2013-07-02 11:36:42.944155612 +0200 
     52@@ -628,6 +628,10 @@ 
    4953          is necessary for systems where the PXA may be a target on the 
    5054          I2C bus. 
     
    5761        bool 
    5862        help 
    59 --- a/drivers/i2c/busses/Makefile 
    60 +++ b/drivers/i2c/busses/Makefile 
    61 @@ -62,6 +62,7 @@ obj-$(CONFIG_I2C_PNX)         += i2c-pnx.o 
     63Index: linux-3.9.8/drivers/i2c/busses/Makefile 
     64=================================================================== 
     65--- linux-3.9.8.orig/drivers/i2c/busses/Makefile        2013-06-27 19:41:32.000000000 +0200 
     66+++ linux-3.9.8/drivers/i2c/busses/Makefile     2013-07-02 11:36:42.944155612 +0200 
     67@@ -62,6 +62,7 @@ 
    6268 obj-$(CONFIG_I2C_PUV3)         += i2c-puv3.o 
    6369 obj-$(CONFIG_I2C_PXA)          += i2c-pxa.o 
     
    6773 obj-$(CONFIG_I2C_S6000)                += i2c-s6000.o 
    6874 obj-$(CONFIG_I2C_SH7760)       += i2c-sh7760.o 
    69 --- /dev/null 
    70 +++ b/drivers/i2c/busses/i2c-ralink.c 
     75Index: linux-3.9.8/drivers/i2c/busses/i2c-ralink.c 
     76=================================================================== 
     77--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
     78+++ linux-3.9.8/drivers/i2c/busses/i2c-ralink.c 2013-07-08 10:56:00.068287905 +0200 
    7179@@ -0,0 +1,274 @@ 
    7280+/* 
     
    123131+#define I2C_RETRY              0x400 
    124132+ 
    125 +#define CLKDIV_VALUE           600 
     133+#define CLKDIV_VALUE           200 // clock rate is 40M, 40M / (200*2) = 100k (standard i2c bus rate). 
     134+//#define CLKDIV_VALUE         50 // clock rate is 40M, 40M / (50*2) = 400k (fast i2c bus rate). 
    126135+ 
    127136+#define READ_CMD               0x01 
     
    212221+               rt_i2c_wait_idle(); 
    213222+               rt_i2c_w32(msg->len - 1, REG_BYTECNT_REG); 
    214 +               rt_i2c_w32(msg->buf[0], REG_DATAOUT_REG); 
    215 +               rt_i2c_w32(WRITE_CMD, REG_STARTXFR_REG); 
    216 +               for (i = 1; i < msg->len; i++) { 
     223+               for (i = 0; i < msg->len; i++) { 
    217224+                       rt_i2c_w32(msg->buf[i], REG_DATAOUT_REG); 
     225+                       rt_i2c_w32(WRITE_CMD, REG_STARTXFR_REG); 
    218226+                       if (rt_i2c_wait_tx_done()) 
    219227+                               return -1; 
     
    221229+       } 
    222230+ 
    223 +       return msg->len; 
     231+       return 0; 
    224232+} 
    225233+ 
Note: See TracChangeset for help on using the changeset viewer.