V4L/DVB (13771): [Mantis] Reset Flags at the earliest possible
authorManu Abraham <abraham.manu@gmail.com>
Fri, 4 Dec 2009 08:26:46 +0000 (05:26 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 17 Jan 2010 13:55:39 +0000 (11:55 -0200)
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/mantis/mantis_common.h
drivers/media/dvb/mantis/mantis_evm.c
drivers/media/dvb/mantis/mantis_pci.c

index ac3eefe..27ecfdb 100644 (file)
@@ -139,6 +139,8 @@ struct mantis_pci {
         /*     A12 A13 A14             */
        u32                     gpio_status;
 
+       u32                     gpif_status;
+
        struct mantis_ca        *mantis_ca;
 };
 
index d603601..4c4c144 100644 (file)
@@ -27,19 +27,11 @@ static void mantis_hifevm_work(struct work_struct *work)
        struct mantis_ca *ca = container_of(work, struct mantis_ca, hif_evm_work);
        struct mantis_pci *mantis = ca->ca_priv;
 
-       u32 gpif_stat, gpif_mask, rst_mask, rst_stat;
-
-       rst_mask  = MANTIS_GPIF_WRACK  |
-                   MANTIS_GPIF_OTHERR |
-                   MANTIS_SBUF_WSTO   |
-                   MANTIS_GPIF_EXTIRQ;
+       u32 gpif_stat, gpif_mask;
 
        gpif_stat = mmread(MANTIS_GPIF_STATUS);
        gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
 
-       rst_stat = gpif_stat & rst_mask;
-       mmwrite(rst_stat, MANTIS_GPIF_STATUS);
-
        if (gpif_stat & MANTIS_GPIF_DETSTAT) {
                if (gpif_stat & MANTIS_CARD_PLUGIN) {
                        dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
@@ -60,13 +52,13 @@ static void mantis_hifevm_work(struct work_struct *work)
                }
        }
 
-       if (gpif_stat & MANTIS_GPIF_EXTIRQ)
+       if (mantis->gpif_status & MANTIS_GPIF_EXTIRQ)
                dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
 
-       if (gpif_stat & MANTIS_SBUF_WSTO)
+       if (mantis->gpif_status & MANTIS_SBUF_WSTO)
                dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
 
-       if (gpif_stat & MANTIS_GPIF_OTHERR)
+       if (mantis->gpif_status & MANTIS_GPIF_OTHERR)
                dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
 
        if (gpif_stat & MANTIS_SBUF_OVFLW)
@@ -75,7 +67,7 @@ static void mantis_hifevm_work(struct work_struct *work)
        if (gpif_stat & MANTIS_GPIF_BRRDY)
                dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
 
-       if (gpif_stat & MANTIS_GPIF_WRACK)
+       if (mantis->gpif_status & MANTIS_GPIF_WRACK)
                dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
 
        if (gpif_stat & MANTIS_GPIF_INTSTAT)
index 4873fa9..f57e2a4 100644 (file)
@@ -53,6 +53,8 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table);
 static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
 {
        u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
+       u32 rst_stat = 0, rst_mask = 0;
+
        struct mantis_pci *mantis;
        struct mantis_ca *ca;
 
@@ -69,6 +71,15 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
        if (!(stat & mask))
                return IRQ_NONE;
 
+       rst_mask  = MANTIS_GPIF_WRACK  |
+                   MANTIS_GPIF_OTHERR |
+                   MANTIS_SBUF_WSTO   |
+                   MANTIS_GPIF_EXTIRQ;
+
+       rst_stat  = mmread(MANTIS_GPIF_STATUS);
+       rst_stat &= rst_mask;
+       mmwrite(rst_stat, MANTIS_GPIF_STATUS);
+
        mantis->mantis_int_stat = stat;
        mantis->mantis_int_mask = mask;
        dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
@@ -77,6 +88,7 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
        }
        if (stat & MANTIS_INT_IRQ0) {
                dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
+               mantis->gpif_status = rst_stat;
                schedule_work(&ca->hif_evm_work);
        }
        if (stat & MANTIS_INT_IRQ1) {