From: Rostislav Lisovy Date: Thu, 25 Nov 2010 15:48:43 +0000 (+0100) Subject: Added basic IRQ handler X-Git-Url: http://rtime.felk.cvut.cz/gitweb/mf6xx.git/commitdiff_plain/15376f4b616f3dbfc69b809dc07631545ca59e90 Added basic IRQ handler --- diff --git a/mf614.c b/mf614.c index 37db77b..abdbb5b 100644 --- a/mf614.c +++ b/mf614.c @@ -7,8 +7,29 @@ #define PCI_SUBVENDOR_ID_HUMUSOFT 0x186c #define PCI_SUBDEVICE_DEVICE 0x0000 +#define STATUS_OFFSET 0x10 +#define STATUS_T5INTE (u32) (1 << 19) +#define STATUS_T5 (u32) (1 << 18) +#define STATUS_CCINTE (u32) (1 << 3) +#define STATUS_CC (u32) (1 << 2) + static irqreturn_t mf614_irq_handler(int irq, struct uio_info *dev_info) +{ + void __iomem *status_reg = dev_info->priv + STATUS_OFFSET; + + if ((status_reg & STATUS_T5INTE) && (status_reg & STATUS_T5)) { + iowrite8(ioread8(status_reg) & ~STATUS_T5, status_reg); + return IRQ_HANDLED; + } + + if ((status_reg & STATUS_CCINTE) && (status_reg & STATUS_CC)) { + iowrite8(ioread8(status_reg) & ~STATUS_CC, status_reg); + return IRQ_HANDLED; + } + + return IRQ_NONE; +} static int __devinit mf614_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) @@ -34,6 +55,16 @@ static int __devinit mf614_pci_probe(struct pci_dev *dev, goto out_release; info->port[0].size = pci_resource_len(dev, 0); + info->port[1].porttype = UIO_PORT_X86; + info->port[1].start = pci_resource_start(dev, 2); + if (!info->port[1].start) + goto out_release; + info->port[1].size = pci_resource_len(dev, 2); + + info->priv = pci_iomap(dev, 2, 0); + if (!info->priv) + goto out_release; + info->mem[1].addr = pci_resource_start(dev, 4); if (!info->mem[1].addr) goto out_release; @@ -101,4 +132,4 @@ module_init(mf614_init_module); module_exit(mf614_exit_module); MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Rostislav Lisovy"); +MODULE_AUTHOR("Rostislav Lisovy ");