summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cx18/cx18-i2c.c
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2008-11-02 08:59:04 -0500
committerAndy Walls <awalls@radix.net>2008-11-02 08:59:04 -0500
commit8d3c3456efe683debd81b7a17171bbb41019ec61 (patch)
tree760e0483a6f776ea0575ef449a465f749510e7d7 /linux/drivers/media/video/cx18/cx18-i2c.c
parent20294c5bcf01a436fbdb78a6548ec74dad1afd77 (diff)
downloadmediapointer-dvb-s2-8d3c3456efe683debd81b7a17171bbb41019ec61.tar.gz
mediapointer-dvb-s2-8d3c3456efe683debd81b7a17171bbb41019ec61.tar.bz2
cx18: Fix write retries for registers that always change - part 3.
From: Andy Walls <awalls@radix.net> cx18: Fix write retries for registers that always change - part 3. Fix the io for the rest of the registers that will often not read back the value just written. Modified register readback checks to make sure the intended effect was achieved without constantly rewriting the registers. The one outstanding register remaining is 0xc72014 CX18_AUDIO_ENABLE, whose behavior on writes I have yet to determine. Priority: normal Signed-off-by: Andy Walls <awalls@radix.net>
Diffstat (limited to 'linux/drivers/media/video/cx18/cx18-i2c.c')
-rw-r--r--linux/drivers/media/video/cx18/cx18-i2c.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-i2c.c b/linux/drivers/media/video/cx18/cx18-i2c.c
index f28a1ff2e..1af9ea149 100644
--- a/linux/drivers/media/video/cx18/cx18-i2c.c
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c
@@ -27,6 +27,7 @@
#include "cx18-gpio.h"
#include "cx18-av-core.h"
#include "cx18-i2c.h"
+#include "cx18-irq.h"
#define CX18_REG_I2C_1_WR 0xf15000
#define CX18_REG_I2C_1_RD 0xf15008
@@ -424,22 +425,31 @@ int init_cx18_i2c(struct cx18 *cx)
if (cx18_read_reg(cx, CX18_REG_I2C_2_WR) != 0x0003c02f) {
/* Reset/Unreset I2C hardware block */
/* Clock select 220MHz */
- cx18_write_reg(cx, 0x10000000, 0xc71004);
+ cx18_write_reg_expect(cx, 0x10000000, 0xc71004,
+ 0x00000000, 0x10001000);
/* Clock Enable */
- cx18_write_reg_sync(cx, 0x10001000, 0xc71024);
+ cx18_write_reg_expect(cx, 0x10001000, 0xc71024,
+ 0x00001000, 0x10001000);
}
/* courtesy of Steven Toth <stoth@hauppauge.com> */
- cx18_write_reg_sync(cx, 0x00c00000, 0xc7001c);
+ cx18_write_reg_expect(cx, 0x00c00000, 0xc7001c, 0x00000000, 0x00c000c0);
+ if (!cx18_retry_mmio)
+ (void) cx18_read_reg(cx, 0xc7001c); /* sync */
mdelay(10);
- cx18_write_reg_sync(cx, 0x00c000c0, 0xc7001c);
+ cx18_write_reg_expect(cx, 0x00c000c0, 0xc7001c, 0x000000c0, 0x00c000c0);
+ if (!cx18_retry_mmio)
+ (void) cx18_read_reg(cx, 0xc7001c); /* sync */
mdelay(10);
- cx18_write_reg_sync(cx, 0x00c00000, 0xc7001c);
+ cx18_write_reg_expect(cx, 0x00c00000, 0xc7001c, 0x00000000, 0x00c000c0);
+ if (!cx18_retry_mmio)
+ (void) cx18_read_reg(cx, 0xc7001c); /* sync */
mdelay(10);
/* Set to edge-triggered intrs. */
- cx18_write_reg_sync(cx, 0x00c00000, 0xc730c8);
+ cx18_write_reg(cx, 0x00c00000, 0xc730c8);
/* Clear any stale intrs */
- cx18_write_reg_sync(cx, 0x00c00000, 0xc730c4);
+ cx18_write_reg_expect(cx, HW2_I2C1_INT|HW2_I2C2_INT, HW2_INT_CLR_STATUS,
+ ~(HW2_I2C1_INT|HW2_I2C2_INT), HW2_I2C1_INT|HW2_I2C2_INT);
/* Hw I2C1 Clock Freq ~100kHz */
cx18_write_reg_sync(cx, 0x00021c0f & ~4, CX18_REG_I2C_1_WR);