diff options
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/i2c-jz4760.c')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/i2c-jz4760.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/i2c-jz4760.c b/firmware/target/mips/ingenic_jz47xx/i2c-jz4760.c index e35fe7a091..cf67b9d1f6 100644 --- a/firmware/target/mips/ingenic_jz47xx/i2c-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/i2c-jz4760.c | |||
@@ -57,6 +57,7 @@ void I2C1(void) | |||
57 | cmd_flag = -1; | 57 | cmd_flag = -1; |
58 | __i2c_clear_interrupts(ret,I2C_CHN); | 58 | __i2c_clear_interrupts(ret,I2C_CHN); |
59 | REG_I2C_INTM(I2C_CHN) = 0x0; | 59 | REG_I2C_INTM(I2C_CHN) = 0x0; |
60 | (void)ret; | ||
60 | return; | 61 | return; |
61 | } | 62 | } |
62 | 63 | ||
@@ -83,7 +84,7 @@ void I2C1(void) | |||
83 | } | 84 | } |
84 | 85 | ||
85 | cmd_cnt--; | 86 | cmd_cnt--; |
86 | 87 | ||
87 | if (!(cmd_cnt)) { | 88 | if (!(cmd_cnt)) { |
88 | REG_I2C_INTM(I2C_CHN) = 0x0; | 89 | REG_I2C_INTM(I2C_CHN) = 0x0; |
89 | cmd_flag = 2; | 90 | cmd_flag = 2; |
@@ -198,9 +199,9 @@ int xfer_read_subaddr(unsigned char subaddr, unsigned char device, unsigned char | |||
198 | i2c_rwflags = I2C_M_RD; | 199 | i2c_rwflags = I2C_M_RD; |
199 | i2c_ctrl_rest = I2C_CTRL_REST; | 200 | i2c_ctrl_rest = I2C_CTRL_REST; |
200 | i2c_init_as_master(device); | 201 | i2c_init_as_master(device); |
201 | 202 | ||
202 | REG_I2C_DC(I2C_CHN) = (I2C_WRITE << 8) | subaddr; | 203 | REG_I2C_DC(I2C_CHN) = (I2C_WRITE << 8) | subaddr; |
203 | 204 | ||
204 | cmd_flag = 0; | 205 | cmd_flag = 0; |
205 | REG_I2C_INTM(I2C_CHN) = 0x10; | 206 | REG_I2C_INTM(I2C_CHN) = 0x10; |
206 | timeout = TIMEOUT; | 207 | timeout = TIMEOUT; |
@@ -224,6 +225,7 @@ int xfer_read_subaddr(unsigned char subaddr, unsigned char device, unsigned char | |||
224 | int ret; | 225 | int ret; |
225 | r_i = 2; | 226 | r_i = 2; |
226 | __i2c_clear_interrupts(ret,I2C_CHN); | 227 | __i2c_clear_interrupts(ret,I2C_CHN); |
228 | (void)ret; | ||
227 | goto R_dev_err; | 229 | goto R_dev_err; |
228 | } | 230 | } |
229 | } | 231 | } |
@@ -269,14 +271,14 @@ int xfer_write_subaddr(unsigned char subaddr, unsigned char device, const unsign | |||
269 | i2c_rwflags = I2C_M_WR; | 271 | i2c_rwflags = I2C_M_WR; |
270 | i2c_ctrl_rest = I2C_CTRL_REST; | 272 | i2c_ctrl_rest = I2C_CTRL_REST; |
271 | i2c_init_as_master(device); | 273 | i2c_init_as_master(device); |
272 | 274 | ||
273 | REG_I2C_DC(I2C_CHN) = (I2C_WRITE << 8) | subaddr; | 275 | REG_I2C_DC(I2C_CHN) = (I2C_WRITE << 8) | subaddr; |
274 | 276 | ||
275 | cmd_flag = 0; | 277 | cmd_flag = 0; |
276 | REG_I2C_INTM(I2C_CHN) = 0x10; | 278 | REG_I2C_INTM(I2C_CHN) = 0x10; |
277 | 279 | ||
278 | timeout = TIMEOUT; | 280 | timeout = TIMEOUT; |
279 | while ((cmd_flag != 2) && (--timeout)) | 281 | while ((cmd_flag != 2) && (--timeout)) |
280 | { | 282 | { |
281 | if (cmd_flag == -1){ | 283 | if (cmd_flag == -1){ |
282 | w_i = 1; | 284 | w_i = 1; |
@@ -308,6 +310,7 @@ int xfer_write_subaddr(unsigned char subaddr, unsigned char device, const unsign | |||
308 | int ret; | 310 | int ret; |
309 | w_i = 5; | 311 | w_i = 5; |
310 | __i2c_clear_interrupts(ret,I2C_CHN); | 312 | __i2c_clear_interrupts(ret,I2C_CHN); |
313 | (void)ret; | ||
311 | goto W_dev_err; | 314 | goto W_dev_err; |
312 | } | 315 | } |
313 | 316 | ||