aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManu Abraham <abraham.manu@gmail.com>2009-12-04 03:05:19 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-01-17 08:55:33 -0500
commitfadfa070d30434dd228362c933827eb6ce137f2d (patch)
treed80f50e487196758fe0e8bc3dce6876ed8d5ce82
parentd575571e8eda92c2cfd727ef050d17e30878fee6 (diff)
V4L/DVB (13735): [Mantis] Implement the Event Manager tasklet
Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb/mantis/mantis_evm.c65
-rw-r--r--drivers/media/dvb/mantis/mantis_reg.h58
2 files changed, 122 insertions, 1 deletions
diff --git a/drivers/media/dvb/mantis/mantis_evm.c b/drivers/media/dvb/mantis/mantis_evm.c
index c9359d6ddc23..9f1740ea389c 100644
--- a/drivers/media/dvb/mantis/mantis_evm.c
+++ b/drivers/media/dvb/mantis/mantis_evm.c
@@ -20,12 +20,76 @@
20 20
21#include "mantis_common.h" 21#include "mantis_common.h"
22#include "mantis_link.h" 22#include "mantis_link.h"
23#include "mantis_hif.h"
24
25void mantis_hifevm_tasklet(unsigned long data)
26{
27 struct mantis_ca *ca = (struct mantis_ca *) data;
28 struct mantis_pci *mantis = ca->ca_priv;
29
30 u32 gpif_stat;
31
32 gpif_stat = mmread(MANTIS_GPIF_STATUS);
33
34 if (gpif_stat & MANTIS_GPIF_DETSTAT) {
35 if (gpif_stat & MANTIS_CARD_PLUGIN) {
36 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
37 mmwrite(0xdada0000, MANTIS_CARD_RESET);
38 // Plugin call here
39 gpif_stat = 0; // crude !
40 }
41 } else {
42 if (gpif_stat & MANTIS_CARD_PLUGOUT) {
43 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
44 mmwrite(0xdada0000, MANTIS_CARD_RESET);
45 // Unplug call here
46 gpif_stat = 0; // crude !
47 }
48 }
49
50 if (gpif_stat & MANTIS_GPIF_EXTIRQ)
51 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
52
53 if (gpif_stat & MANTIS_SBUF_WSTO)
54 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
55
56 if (gpif_stat & MANTIS_GPIF_OTHERR)
57 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
58
59 if (gpif_stat & MANTIS_SBUF_OVFLW)
60 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
61
62 if (gpif_stat & MANTIS_GPIF_BRRDY) {
63 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
64 ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
65 if (ca->hif_job_queue & MANTIS_HIF_MEMRD)
66 wake_up(&ca->hif_brrdyw_wq);
67 }
68 if (gpif_stat & MANTIS_GPIF_WRACK)
69 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
70
71 if (gpif_stat & MANTIS_GPIF_INTSTAT)
72 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
73
74 if (gpif_stat & MANTIS_SBUF_EMPTY)
75 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
76
77 if (gpif_stat & MANTIS_SBUF_OPDONE) {
78 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
79 if (ca->hif_job_queue) {
80 wake_up(&ca->hif_opdone_wq);
81 ca->hif_event = MANTIS_SBUF_OPDONE;
82 }
83 }
84}
23 85
24int mantis_evmgr_init(struct mantis_ca *ca) 86int mantis_evmgr_init(struct mantis_ca *ca)
25{ 87{
26 struct mantis_pci *mantis = ca->ca_priv; 88 struct mantis_pci *mantis = ca->ca_priv;
27 89
28 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager"); 90 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
91 tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
92
29 return 0; 93 return 0;
30} 94}
31 95
@@ -34,4 +98,5 @@ void mantis_evmgr_exit(struct mantis_ca *ca)
34 struct mantis_pci *mantis = ca->ca_priv; 98 struct mantis_pci *mantis = ca->ca_priv;
35 99
36 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting"); 100 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
101 tasklet_kill(&ca->hif_evm_tasklet);
37} 102}
diff --git a/drivers/media/dvb/mantis/mantis_reg.h b/drivers/media/dvb/mantis/mantis_reg.h
index 1b54e09fd862..d9862b7dbf03 100644
--- a/drivers/media/dvb/mantis/mantis_reg.h
+++ b/drivers/media/dvb/mantis/mantis_reg.h
@@ -73,6 +73,40 @@
73#define MANTIS_I2C_STOP (0x01 << 5) 73#define MANTIS_I2C_STOP (0x01 << 5)
74#define MANTIS_I2C_PGMODE (0x01 << 3) 74#define MANTIS_I2C_PGMODE (0x01 << 3)
75 75
76#define MANTIS_GPIF_CFGSLA 0x84
77#define MANTIS_GPIF_WAITSMPL (0x07 << 28)
78#define MANTIS_GPIF_BYTEADDRSUB (0x01 << 25)
79#define MANTIS_GPIF_WAITPOL (0x01 << 24)
80#define MANTIS_GPIF_NCDELAY (0x07 << 20)
81#define MANTIS_GPIF_RW2CSDELAY (0x07 << 16)
82#define MANTIS_GPIF_SLFTIMEDMODE (0x01 << 15)
83#define MANTIS_GPIF_SLFTIMEDDELY (0x7f << 8)
84#define MANTIS_GPIF_DEVTYPE (0x07 << 4)
85#define MANTIS_GPIF_BIGENDIAN (0x01 << 3)
86#define MANTIS_GPIF_FETCHCMD (0x03 << 1)
87#define MANTIS_GPIF_HWORDDEV (0x01 << 0)
88
89#define MANTIS_GPIF_WSTOPER 0x90
90#define MANTIS_GPIF_WSTOPERWREN3 (0x01 << 31)
91#define MANTIS_GPIF_PARBOOTN (0x01 << 29)
92#define MANTIS_GPIF_WSTOPERSLID3 (0x1f << 24)
93#define MANTIS_GPIF_WSTOPERWREN2 (0x01 << 23)
94#define MANTIS_GPIF_WSTOPERSLID2 (0x1f << 16)
95#define MANTIS_GPIF_WSTOPERWREN1 (0x01 << 15)
96#define MANTIS_GPIF_WSTOPERSLID1 (0x1f << 8)
97#define MANTIS_GPIF_WSTOPERWREN0 (0x01 << 7)
98#define MANTIS_GPIF_WSTOPERSLID0 (0x1f << 0)
99
100#define MANTIS_GPIF_CS2RW 0x94
101#define MANTIS_GPIF_CS2RWWREN3 (0x01 << 31)
102#define MANTIS_GPIF_CS2RWDELY3 (0x3f << 24)
103#define MANTIS_GPIF_CS2RWWREN2 (0x01 << 23)
104#define MANTIS_GPIF_CS2RWDELY2 (0x3f << 16)
105#define MANTIS_GPIF_CS2RWWREN1 (0x01 << 15)
106#define MANTIS_GPIF_CS2RWDELY1 (0x3f << 8)
107#define MANTIS_GPIF_CS2RWWREN0 (0x01 << 7)
108#define MANTIS_GPIF_CS2RWDELY0 (0x3f << 0)
109
76#define MANTIS_GPIF_IRQCFG 0x98 110#define MANTIS_GPIF_IRQCFG 0x98
77#define MANTIS_GPIF_IRQPOL (0x01 << 8) 111#define MANTIS_GPIF_IRQPOL (0x01 << 8)
78#define MANTIS_MASK_WRACK (0x01 << 7) 112#define MANTIS_MASK_WRACK (0x01 << 7)
@@ -99,11 +133,33 @@
99#define MANTIS_CARD_PLUGIN (0x01 << 1) 133#define MANTIS_CARD_PLUGIN (0x01 << 1)
100#define MANTIS_CARD_PLUGOUT (0x01 << 0) 134#define MANTIS_CARD_PLUGOUT (0x01 << 0)
101 135
136#define MANTIS_GPIF_BRADDR 0xa0
137#define MANTIS_GPIF_PCMCIAREG (0x01 << 27)
138#define MANTIS_GPIF_PCMCIAIOM (0x01 << 26)
139#define MANTIS_GPIF_BR_ADDR (0xfffffff << 0)
140
141#define MANTIS_GPIF_BRBYTES 0xa4
142#define MANTIS_GPIF_BRCNT (0xfff << 0)
143
144#define MANTIS_PCMCIA_RESET 0xa8
145#define MANTIS_PCMCIA_RSTVAL (0xff << 0)
146
147#define MANTIS_CARD_RESET 0xac
148
102#define MANTIS_GPIF_ADDR 0xb0 149#define MANTIS_GPIF_ADDR 0xb0
103#define MANTIS_GPIF_RDWRN (0x01 << 31) 150#define MANTIS_GPIF_RDWRN (0x01 << 31)
151#define MANTIS_GPIF_PCMCIAREG (0x01 << 27)
152#define MANTIS_GPIF_PCMCIAIOM (0x01 << 26)
153#define MANTIS_GPIF_HIF_ADDR (0xfffffff << 0)
104 154
105#define MANTIS_GPIF_DOUT 0xb4 155#define MANTIS_GPIF_DOUT 0xb4
156#define MANTIS_GPIF_HIF_DOUT (0xfffffff << 0)
157
106#define MANTIS_GPIF_DIN 0xb8 158#define MANTIS_GPIF_DIN 0xb8
159#define MANTIS_GPIF_HIF_DIN (0xfffffff << 0)
107 160
161#define MANTIS_GPIF_SPARE 0xbc
162#define MANTIS_GPIF_LOGICRD (0xffff << 16)
163#define MANTIS_GPIF_LOGICRW (0xffff << 0)
108 164
109#endif //__MANTIS_REG_H 165#endif //__MANTIS_REG_H