summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/bt8xx/bt878.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/bt8xx/bt878.c')
-rw-r--r--linux/drivers/media/dvb/bt8xx/bt878.c77
1 files changed, 48 insertions, 29 deletions
diff --git a/linux/drivers/media/dvb/bt8xx/bt878.c b/linux/drivers/media/dvb/bt8xx/bt878.c
index 09c5dd38f..6d8939782 100644
--- a/linux/drivers/media/dvb/bt8xx/bt878.c
+++ b/linux/drivers/media/dvb/bt8xx/bt878.c
@@ -60,23 +60,13 @@ MODULE_LICENSE("GPL");
int bt878_num;
struct bt878 bt878[BT878_MAX];
-EXPORT_SYMBOL(bt878_num);
-EXPORT_SYMBOL(bt878);
+EXPORT_SYMBOL_GPL(bt878_debug);
+EXPORT_SYMBOL_GPL(bt878_verbose);
+EXPORT_SYMBOL_GPL(bt878_num);
+EXPORT_SYMBOL_GPL(bt878);
-#if defined(__powerpc__) /* big-endian */
-extern __inline__ void io_st_le32(volatile unsigned *addr, unsigned val)
-{
- __asm__ __volatile__("stwbrx %1,0,%2":"=m"(*addr):"r"(val),
- "r"(addr));
- __asm__ __volatile__("eieio":::"memory");
-}
-
-#define btwrite(dat,adr) io_st_le32((unsigned *)(bt->bt878_mem+(adr)),(dat))
-#define btread(adr) ld_le32((unsigned *)(bt->bt878_mem+(adr)))
-#else
-#define btwrite(dat,adr) writel((dat), (char *) (bt->bt878_mem+(adr)))
-#define btread(adr) readl(bt->bt878_mem+(adr))
-#endif
+#define btwrite(dat,adr) bmtwrite((dat), (bt->bt878_mem+(adr)))
+#define btread(adr) bmtread(bt->bt878_mem+(adr))
#define btand(dat,adr) btwrite((dat) & btread(adr), adr)
#define btor(dat,adr) btwrite((dat) | btread(adr), adr)
@@ -153,9 +143,6 @@ static int bt878_mem_alloc(struct bt878 *bt)
static int bt878_make_risc(struct bt878 *bt)
{
- u32 buf_pos = 0;
- u32 line;
-
bt->block_bytes = bt->buf_size >> 4;
bt->block_count = 1 << 4;
bt->line_bytes = bt->block_bytes;
@@ -170,11 +157,21 @@ static int bt878_make_risc(struct bt878 *bt)
printk("bt878: buffer size error!\n");
return -EINVAL;
}
+ return 0;
+}
+
+
+static void bt878_risc_program(struct bt878 *bt, u32 op_sync_orin)
+{
+ u32 buf_pos = 0;
+ u32 line;
RISC_FLUSH();
- RISC_INSTR(RISC_SYNC | RISC_SYNC_FM1);
+ RISC_INSTR(RISC_SYNC | RISC_SYNC_FM1 | op_sync_orin);
RISC_INSTR(0);
+ dprintk("bt878: risc len lines %u, bytes per line %u\n",
+ bt->line_count, bt->line_bytes);
for (line = 0; line < bt->line_count; line++) {
// At the beginning of every block we issue an IRQ with previous (finished) block number set
if (!(buf_pos % bt->block_bytes))
@@ -193,30 +190,50 @@ static int bt878_make_risc(struct bt878 *bt)
buf_pos += bt->line_bytes;
}
- RISC_INSTR(RISC_SYNC | RISC_SYNC_VRO);
+ RISC_INSTR(RISC_SYNC | op_sync_orin | RISC_SYNC_VRO);
RISC_INSTR(0);
RISC_INSTR(RISC_JUMP);
RISC_INSTR(bt->risc_dma);
btwrite((bt->line_count << 16) | bt->line_bytes, BT878_APACK_LEN);
- return 0;
}
/*****************************/
/* Start/Stop grabbing funcs */
/*****************************/
-void bt878_start(struct bt878 *bt, u32 controlreg)
+void bt878_start(struct bt878 *bt, u32 controlreg, u32 op_sync_orin,
+ u32 irq_err_ignore)
{
dprintk("bt878 debug: bt878_start (ctl=%8.8x)\n", controlreg);
+ u32 int_mask;
- controlreg &= ~0x1F;
+ /* complete the writing of the risc dma program now we have
+ * the card specifics
+ */
+ bt878_risc_program(bt, op_sync_orin);
+ controlreg &= ~0x13;
controlreg |= 0x1B;
btwrite(cpu_to_le32(bt->risc_dma), BT878_ARISC_START);
- btwrite(0x000ff800, BT878_AINT_MASK);
+ /* original int mask had :
+ * 6 2 8 4 0
+ * 1111 1111 1000 0000 0000
+ * SCERR|OCERR|PABORT|RIPERR|FDSR|FTRGT|FBUS|RISCI
+ * Hacked for DST to:
+ * SCERR | OCERR | FDSR | FTRGT | FBUS | RISCI
+ */
+ int_mask = BT878_ASCERR | BT878_AOCERR | BT878_APABORT |
+ BT878_ARIPERR | BT878_APPERR | BT878_AFDSR | BT878_AFTRGT |
+ BT878_AFBUS | BT878_ARISCI;
+
+
+ /* ignore pesky bits */
+ int_mask &= ~irq_err_ignore;
+
+ btwrite(int_mask, BT878_AINT_MASK);
btwrite(controlreg, BT878_AGPIO_DMA_CTL);
}
@@ -228,7 +245,7 @@ void bt878_stop(struct bt878 *bt)
dprintk("bt878 debug: bt878_stop\n");
btwrite(0, BT878_AINT_MASK);
- btand(~0x1F, BT878_AGPIO_DMA_CTL);
+ btand(~0x13, BT878_AGPIO_DMA_CTL);
do {
stat = btread(BT878_AINT_STAT);
@@ -241,8 +258,8 @@ void bt878_stop(struct bt878 *bt)
bt->nr, i, stat);
}
-EXPORT_SYMBOL(bt878_start);
-EXPORT_SYMBOL(bt878_stop);
+EXPORT_SYMBOL_GPL(bt878_start);
+EXPORT_SYMBOL_GPL(bt878_stop);
/*****************************/
/* Interrupt service routine */
@@ -430,7 +447,7 @@ static void __devexit bt878_remove(struct pci_dev *pci_dev)
printk("bt878(%d): unloading\n", bt->nr);
/* turn off all capturing, DMA and IRQs */
- btand(~15, BT878_AGPIO_DMA_CTL);
+ btand(~13, BT878_AGPIO_DMA_CTL);
/* first disable interrupts before unmapping the memory! */
btwrite(0, BT878_AINT_MASK);
@@ -499,6 +516,8 @@ void bt878_cleanup_module(void)
return;
}
+EXPORT_SYMBOL_GPL(bt878_init_module);
+EXPORT_SYMBOL_GPL(bt878_cleanup_module);
module_init(bt878_init_module);
module_exit(bt878_cleanup_module);