30 #include <linux/module.h>
31 #include <linux/kernel.h>
32 #include <linux/pci.h>
35 #include <asm/pgtable.h>
37 #include <linux/types.h>
53 static unsigned int bt878_verbose = 1;
54 static unsigned int bt878_debug;
58 "verbose startup messages, default is 1 (yes)");
68 #define btwrite(dat,adr) bmtwrite((dat), (bt->bt878_mem+(adr)))
69 #define btread(adr) bmtread(bt->bt878_mem+(adr))
71 #define btand(dat,adr) btwrite((dat) & btread(adr), adr)
72 #define btor(dat,adr) btwrite((dat) | btread(adr), adr)
73 #define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr)
78 #define dprintk(fmt, arg...) \
81 printk(KERN_DEBUG fmt, ##arg); \
84 static void bt878_mem_free(
struct bt878 *
bt)
99 static int bt878_mem_alloc(
struct bt878 *
bt)
132 #define RISC_WRITE (0x01 << 28)
133 #define RISC_JUMP (0x07 << 28)
134 #define RISC_SYNC (0x08 << 28)
137 #define RISC_WR_SOL (1 << 27)
138 #define RISC_WR_EOL (1 << 26)
139 #define RISC_IRQ (1 << 24)
140 #define RISC_STATUS(status) ((((~status) & 0x0F) << 20) | ((status & 0x0F) << 16))
141 #define RISC_SYNC_RESYNC (1 << 15)
142 #define RISC_SYNC_FM1 0x06
143 #define RISC_SYNC_VRO 0x0C
145 #define RISC_FLUSH() bt->risc_pos = 0
146 #define RISC_INSTR(instr) bt->risc_cpu[bt->risc_pos++] = cpu_to_le32(instr)
148 static int bt878_make_risc(
struct bt878 *bt)
168 static void bt878_risc_program(
struct bt878 *bt,
u32 op_sync_orin)
177 dprintk(
"bt878: risc len lines %u, bytes per line %u\n",
179 for (line = 0; line < bt->
line_count; line++) {
215 dprintk(
"bt878 debug: bt878_start (ctl=%8.8x)\n", controlreg);
219 bt878_risc_program(bt, op_sync_orin);
238 int_mask &= ~irq_err_ignore;
249 dprintk(
"bt878 debug: bt878_stop\n");
261 dprintk(
"bt878(%d) debug: bt878_stop, i=%d, stat=0x%8.8x\n",
278 bt = (
struct bt878 *) dev_id;
284 if (!(astat = (stat & mask)))
293 "bt878(%d): irq%s%s risc_pc=%08x\n",
304 "bt878(%d): irq%s%s%s risc_pc=%08x\n",
317 "bt878(%d): irq%s%s%s risc_pc=%08x\n",
328 tasklet_schedule(&bt->
tasklet);
335 "bt878(%d): IRQ lockup, cleared int mask\n",
386 #define BROOKTREE_878_DEVICE(vend, dev, name) \
388 .vendor = PCI_VENDOR_ID_BROOKTREE, \
389 .device = PCI_DEVICE_ID_BROOKTREE_878, \
390 .subvendor = (vend), .subdevice = (dev), \
391 .driver_data = (unsigned long) name \
401 "ChainTech digitop DST-1000 DVB-S"),
415 return id->driver_data ? (
const char *)id->
driver_data :
"Unknown";
428 #if defined(__powerpc__)
447 __func__, cardid, card_name(pci_id));
470 printk(
"irq: %d, latency: %d, memory: 0x%lx\n",
474 #if defined(__powerpc__)
499 if (result == -
EBUSY) {
501 "bt878(%d): IRQ %d busy, change your PnP config in BIOS\n",
509 pci_set_drvdata(dev, bt);
511 if ((result = bt878_mem_alloc(bt))) {
535 struct bt878 *bt = pci_get_drvdata(pci_dev);
567 pci_set_drvdata(pci_dev,
NULL);
574 .id_table = bt878_pci_tbl,
575 .probe = bt878_probe,
583 static int __init bt878_init_module(
void)
592 return pci_register_driver(&bt878_pci_driver);
595 static void __exit bt878_cleanup_module(
void)