2 Mantis PCI bridge driver
4 Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "mantis_common.h"
22 #include "mantis_link.h"
23 #include "mantis_hif.h"
25 void mantis_hifevm_tasklet(unsigned long data)
27 struct mantis_ca *ca = (struct mantis_ca *) data;
28 struct mantis_pci *mantis = ca->ca_priv;
32 gpif_stat = mmread(MANTIS_GPIF_STATUS);
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);
39 gpif_stat = 0; // crude !
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);
46 gpif_stat = 0; // crude !
50 if (gpif_stat & MANTIS_GPIF_EXTIRQ)
51 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
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);
56 if (gpif_stat & MANTIS_GPIF_OTHERR)
57 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
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);
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);
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);
71 if (gpif_stat & MANTIS_GPIF_INTSTAT)
72 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
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);
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;
86 int mantis_evmgr_init(struct mantis_ca *ca)
88 struct mantis_pci *mantis = ca->ca_priv;
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);
93 mantis_pcmcia_init(ca);
98 void mantis_evmgr_exit(struct mantis_ca *ca)
100 struct mantis_pci *mantis = ca->ca_priv;
102 dprintk(mantis->verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
103 tasklet_kill(&ca->hif_evm_tasklet);
105 mantis_pcmcia_exit(ca);