2009-12-04 16:04:18 +08:00
|
|
|
/*
|
|
|
|
Mantis PCI bridge driver
|
|
|
|
|
|
|
|
Copyright (C) 2005, 2006 Manu Abraham (abraham.manu@gmail.com)
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mantis_common.h"
|
|
|
|
#include "mantis_link.h"
|
2009-12-04 16:05:19 +08:00
|
|
|
#include "mantis_hif.h"
|
|
|
|
|
|
|
|
void mantis_hifevm_tasklet(unsigned long data)
|
|
|
|
{
|
|
|
|
struct mantis_ca *ca = (struct mantis_ca *) data;
|
|
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
|
2009-12-04 16:08:25 +08:00
|
|
|
u32 gpif_stat, gpif_mask;
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
gpif_stat = mmread(MANTIS_GPIF_STATUS);
|
2009-12-04 16:08:25 +08:00
|
|
|
gpif_mask = mmread(MANTIS_GPIF_IRQCFG);
|
|
|
|
if (!((gpif_stat & 0xff) & (gpif_mask & 0xff)))
|
|
|
|
return;
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_GPIF_DETSTAT) {
|
|
|
|
if (gpif_stat & MANTIS_CARD_PLUGIN) {
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Plugin", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
mmwrite(0xdada0000, MANTIS_CARD_RESET);
|
|
|
|
// Plugin call here
|
|
|
|
gpif_stat = 0; // crude !
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (gpif_stat & MANTIS_CARD_PLUGOUT) {
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): CAM Unplug", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
mmwrite(0xdada0000, MANTIS_CARD_RESET);
|
|
|
|
// Unplug call here
|
|
|
|
gpif_stat = 0; // crude !
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_GPIF_EXTIRQ)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Ext IRQ", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_SBUF_WSTO)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Timeout", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_GPIF_OTHERR)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Alignment Error", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_SBUF_OVFLW)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Overflow", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_GPIF_BRRDY) {
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Read Ready", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
ca->sbuf_status = MANTIS_SBUF_DATA_AVAIL;
|
|
|
|
if (ca->hif_job_queue & MANTIS_HIF_MEMRD)
|
|
|
|
wake_up(&ca->hif_brrdyw_wq);
|
|
|
|
}
|
|
|
|
if (gpif_stat & MANTIS_GPIF_WRACK)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Slave Write ACK", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_GPIF_INTSTAT)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): GPIF IRQ", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_SBUF_EMPTY)
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer Empty", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
|
|
|
|
if (gpif_stat & MANTIS_SBUF_OPDONE) {
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Event Mgr: Adapter(%d) Slot(0): Smart Buffer operation complete", mantis->num);
|
2009-12-04 16:05:19 +08:00
|
|
|
if (ca->hif_job_queue) {
|
|
|
|
wake_up(&ca->hif_opdone_wq);
|
|
|
|
ca->hif_event = MANTIS_SBUF_OPDONE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-12-04 16:04:18 +08:00
|
|
|
|
|
|
|
int mantis_evmgr_init(struct mantis_ca *ca)
|
|
|
|
{
|
|
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Initializing Mantis Host I/F Event manager");
|
2009-12-04 16:05:19 +08:00
|
|
|
tasklet_init(&ca->hif_evm_tasklet, mantis_hifevm_tasklet, (unsigned long) ca);
|
|
|
|
|
2009-12-04 16:06:38 +08:00
|
|
|
mantis_pcmcia_init(ca);
|
|
|
|
|
2009-12-04 16:04:18 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mantis_evmgr_exit(struct mantis_ca *ca)
|
|
|
|
{
|
|
|
|
struct mantis_pci *mantis = ca->ca_priv;
|
|
|
|
|
2009-12-04 16:07:41 +08:00
|
|
|
dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Host I/F Event manager exiting");
|
2009-12-04 16:05:19 +08:00
|
|
|
tasklet_kill(&ca->hif_evm_tasklet);
|
2009-12-04 16:06:38 +08:00
|
|
|
|
|
|
|
mantis_pcmcia_exit(ca);
|
2009-12-04 16:04:18 +08:00
|
|
|
}
|