Commit df0cca17 authored by Manu Abraham's avatar Manu Abraham Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (13706): [MB86A16] Overhaul



 * better ISR handling
 * I2C fixes
 * better handling of configurations

Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bd1fcac0
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -65,10 +65,19 @@
#define mmaor(dat, addr)	mmwrite((dat) | ((mask) & mmread(addr)), addr)


struct mantis_hwconfig {
	char			*model_name;
	char			*dev_type;
};


struct mantis_pci {
	/*	PCI stuff		*/
	u16			vendor_id;
	u16			device_id;
	u16			subsystem_vendor;
	u16			subsystem_device;

	u8			latency;

	struct			pci_dev *pdev;
@@ -110,7 +119,7 @@ struct mantis_pci {

	u8			feeds;

	struct mantis_config	*config;
	struct mantis_hwconfig	*hwconfig;

	u32 			mantis_int_stat;
	u32 			mantis_int_mask;
@@ -121,7 +130,8 @@ struct mantis_pci {
	u32			sub_device_id;

	 /*	A12 A13 A14		*/
	int			gpio_status;};
	int			gpio_status;
};

extern unsigned int verbose;
extern unsigned int devs;
+47 −48
Original line number Diff line number Diff line
@@ -20,7 +20,10 @@

#include "mantis_common.h"
#include "mantis_core.h"

#include "mantis_vp1033.h"
#include "mantis_vp1034.h"
#include "mantis_vp2033.h"
#include "mantis_vp3030.h"

static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
{
@@ -45,7 +48,7 @@ static int read_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)

		return err;
	}
	msleep_interruptible(2);
//	msleep_interruptible(2);

	return 0;
}
@@ -72,41 +75,6 @@ static int write_eeprom_byte(struct mantis_pci *mantis, u8 *data, u8 length)
	return 0;
}

static int get_subdevice_id(struct mantis_pci *mantis)
{
	int err;
	static u8 sub_device_id[2];

	mantis->sub_device_id = 0;
	sub_device_id[0] = 0xfc;
	if ((err = read_eeprom_byte(mantis, &sub_device_id[0], 2)) < 0) {
		dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
		return err;
	}
	mantis->sub_device_id = (sub_device_id[0] << 8) | sub_device_id[1];
	dprintk(verbose, MANTIS_ERROR, 1, "Sub Device ID=[0x%04x]",
		mantis->sub_device_id);

	return 0;
}

static int get_subvendor_id(struct mantis_pci *mantis)
{
	int err;
	static u8 sub_vendor_id[2];

	mantis->sub_vendor_id = 0;
	sub_vendor_id[0] = 0xfe;
	if ((err = read_eeprom_byte(mantis, &sub_vendor_id[0], 2)) < 0) {
		dprintk(verbose, MANTIS_ERROR, 1, "Mantis EEPROM read error");
		return err;
	}
	mantis->sub_vendor_id = (sub_vendor_id[0] << 8) | sub_vendor_id[1];
	dprintk(verbose, MANTIS_ERROR, 1, "Sub Vendor ID=[0x%04x]",
		mantis->sub_vendor_id);

	return 0;
}

static int get_mac_address(struct mantis_pci *mantis)
{
@@ -118,8 +86,8 @@ static int get_mac_address(struct mantis_pci *mantis)

		return err;
	}
	dprintk(verbose, MANTIS_ERROR, 1,
		"MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]",
	dprintk(verbose, MANTIS_ERROR, 0,
		"    MAC Address=[%02x:%02x:%02x:%02x:%02x:%02x]\n",
		mantis->mac_address[0], mantis->mac_address[1],
		mantis->mac_address[2],	mantis->mac_address[3],
		mantis->mac_address[4], mantis->mac_address[5]);
@@ -127,11 +95,51 @@ static int get_mac_address(struct mantis_pci *mantis)
	return 0;
}

#define MANTIS_MODEL_UNKNOWN	"UNKNOWN"
#define MANTIS_DEV_UNKNOWN	"UNKNOWN"

struct mantis_hwconfig unknown_device = {
	.model_name	= MANTIS_MODEL_UNKNOWN,
	.dev_type	= MANTIS_DEV_UNKNOWN,
};

static void mantis_load_config(struct mantis_pci *mantis)
{
	switch (mantis->subsystem_device) {
	case MANTIS_VP_1033_DVB_S:	// VP-1033
		mantis->hwconfig = &vp1033_mantis_config;
		break;
	case MANTIS_VP_1034_DVB_S:	// VP-1034
		mantis->hwconfig = &vp1034_mantis_config;
		break;
	case MANTIS_VP_2033_DVB_C:	// VP-2033
		mantis->hwconfig = &vp2033_mantis_config;
		break;
	case MANTIS_VP_3030_DVB_T:	// VP-3030
		mantis->hwconfig = &vp3030_mantis_config;
		break;
	default:
		mantis->hwconfig = &unknown_device;
		break;
	}
}

int mantis_core_init(struct mantis_pci *mantis)
{
	int err = 0;

	mantis_load_config(mantis);
	dprintk(verbose, MANTIS_ERROR, 0, "found a %s PCI %s device on (%02x:%02x.%x),\n",
		mantis->hwconfig->model_name, mantis->hwconfig->dev_type,
		mantis->pdev->bus->number, PCI_SLOT(mantis->pdev->devfn), PCI_FUNC(mantis->pdev->devfn));
	dprintk(verbose, MANTIS_ERROR, 0, "    Mantis Rev %d [%04x:%04x], ",
		mantis->revision,
		mantis->subsystem_vendor, mantis->subsystem_device);
	dprintk(verbose, MANTIS_ERROR, 0,
		"irq: %d, latency: %d\n    memory: 0x%lx, mmio: 0x%p\n",
		mantis->pdev->irq, mantis->latency,
		mantis->mantis_addr, mantis->mantis_mmio);

	if ((err = mantis_i2c_init(mantis)) < 0) {
		dprintk(verbose, MANTIS_ERROR, 1, "Mantis I2C init failed");
		return err;
@@ -140,14 +148,6 @@ int mantis_core_init(struct mantis_pci *mantis)
		dprintk(verbose, MANTIS_ERROR, 1, "get MAC address failed");
		return err;
	}
	if ((err = get_subvendor_id(mantis)) < 0) {
		dprintk(verbose, MANTIS_ERROR, 1, "get Sub vendor ID failed");
		return err;
	}
	if ((err = get_subdevice_id(mantis)) < 0) {
		dprintk(verbose, MANTIS_ERROR, 1, "get Sub device ID failed");
		return err;
	}
	if ((err = mantis_dma_init(mantis)) < 0) {
		dprintk(verbose, MANTIS_ERROR, 1, "Mantis DMA init failed");
		return err;
@@ -162,7 +162,6 @@ int mantis_core_init(struct mantis_pci *mantis)

int mantis_core_exit(struct mantis_pci *mantis)
{

	mantis_dma_stop(mantis);
	dprintk(verbose, MANTIS_ERROR, 1, "DMA engine stopping");
	if (mantis_dma_exit(mantis) < 0)
+2 −11
Original line number Diff line number Diff line
@@ -206,22 +206,13 @@ int __devinit mantis_dvb_init(struct mantis_pci *mantis)
	return result;
}

#define MANTIS_VP_1027_DVB_S	0x0013
#define MANTIS_VP_1033_DVB_S	0x0016
#define MANTIS_VP_1034_DVB_S	0x0014
#define MANTIS_VP_1040_DVB_S2
#define MANTIS_VP_1041_DVB_S2
#define MANTIS_VP_2033_DVB_C	0x0008
#define MANTIS_VP_3024_DVB_T	0x0009
#define MANTIS_VP_3030_DVB_T	0x0024

int __devinit mantis_frontend_init(struct mantis_pci *mantis)
{
	dprintk(verbose, MANTIS_DEBUG, 1, "Mantis frontend Init");
	mantis_fe_powerup(mantis);
	mantis_frontend_reset(mantis);
	dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->sub_device_id);
	switch (mantis->sub_device_id) {
	dprintk(verbose, MANTIS_DEBUG, 1, "Device ID=%02x", mantis->subsystem_device);
	switch (mantis->subsystem_device) {
	case MANTIS_VP_1033_DVB_S:	// VP-1033
		dprintk(verbose, MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)");
		mantis->fe = stv0299_attach(&lgtdqcs001f_config,
+30 −38
Original line number Diff line number Diff line
@@ -33,32 +33,27 @@
static int mantis_ack_wait(struct mantis_pci *mantis)
{
	int rc = 0;
	u32 timeout = 0;

	if (wait_event_interruptible_timeout(mantis->i2c_wq,
					     mantis->mantis_int_stat & MANTIS_INT_I2CRACK,
					     msecs_to_jiffies(50)) == -ERESTARTSYS)
					     mantis->mantis_int_stat & MANTIS_INT_I2CDONE,
					     msecs_to_jiffies(50)) == -ERESTARTSYS) {

		dprintk(verbose, MANTIS_DEBUG, 1, "I2C Transfer failed, Master !I2CDONE");
		rc = -EREMOTEIO;
/*
	// Wait till we are done
	while (mantis->mantis_int_stat & MANTIS_INT_I2CRACK){
		if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) {
			mantis->mantis_int_stat &= ~MANTIS_INT_I2CRACK;
//			dprintk(verbose, MANTIS_DEBUG, 1, "SLAVE RACK 'ed .. Waiting for I2CDONE");
			break;
	}
	while (!(mantis->mantis_int_stat & MANTIS_INT_I2CRACK)) {
		dprintk(verbose, MANTIS_DEBUG, 1, "Waiting for Slave RACK");
		mantis->mantis_int_stat = mmread(MANTIS_INT_STAT);
		msleep(5);
		timeout++;
		if (timeout > 500) {
			dprintk(verbose, MANTIS_ERROR, 1, "Slave RACK Fail !");
			rc = -EREMOTEIO;
			break;
		}

	if (mantis->mantis_int_stat & MANTIS_INT_I2CDONE) {
//		dprintk(verbose, MANTIS_DEBUG, 1, "Mantis Int I2CDONE");
		rc = 1;
	}

	mantis->mantis_int_stat &= ~MANTIS_INT_I2CDONE;
*/
	// ..
	if (mantis->mantis_int_stat & MANTIS_INT_I2CRACK)
		msleep_interruptible(10);
	udelay(350);

	return rc;
}
@@ -67,7 +62,7 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
{
	u32 rxd, i;

	dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr);
	dprintk(verbose, MANTIS_INFO, 0, "        %s:  Address=[0x%02x] <R>[ ", __func__, msg->addr);
	for (i = 0; i < msg->len; i++) {
		rxd = (msg->addr << 25) | (1 << 24)
					| MANTIS_I2C_RATE_3
@@ -77,18 +72,17 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg)
		if (i == (msg->len - 1))
			rxd &= ~MANTIS_I2C_STOP;

		mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
		mmwrite(rxd, MANTIS_I2CDATA_CTL);
		if (mantis_ack_wait(mantis) < 0) {
		if (mantis_ack_wait(mantis) != 0) {
			dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<R>");
			return -EIO;
			return -EREMOTEIO;
		}
		rxd = mmread(MANTIS_I2CDATA_CTL);
		msg->buf[i] = (u8)((rxd >> 8) & 0xFF);
		dprintk(verbose, MANTIS_DEBUG, 1,
			"Data<R[%d]>=[0x%02x]", i, msg->buf[i]);

		msleep_interruptible(2);
		dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
	}
	dprintk(verbose, MANTIS_INFO, 0, "]\n");

	return 0;
}
@@ -98,9 +92,9 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
	int i;
	u32 txd = 0;

	dprintk(verbose, MANTIS_DEBUG, 1, "Address=[0x%02x]", msg->addr);
	dprintk(verbose, MANTIS_INFO, 0, "        %s: Address=[0x%02x] <W>[ ", __func__, msg->addr);
	for (i = 0; i < msg->len; i++) {
		dprintk(verbose, MANTIS_DEBUG, 1, "Data<W[%d]>=[0x%02x]", i, msg->buf[i]);
		dprintk(verbose, MANTIS_INFO, 0, "%02x ", msg->buf[i]);
		txd = (msg->addr << 25) | (msg->buf[i] << 8)
					| MANTIS_I2C_RATE_3
					| MANTIS_I2C_STOP
@@ -109,13 +103,14 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg
		if (i == (msg->len - 1))
			txd &= ~MANTIS_I2C_STOP;

		mmwrite(MANTIS_INT_I2CDONE, MANTIS_INT_STAT);
		mmwrite(txd, MANTIS_I2CDATA_CTL);
		if (mantis_ack_wait(mantis) < 0) {
		if (mantis_ack_wait(mantis) != 0) {
			dprintk(verbose, MANTIS_DEBUG, 1, "ACK failed<W>");
			return -1;
			return -EREMOTEIO;
		}
		udelay(500);
	}
	dprintk(verbose, MANTIS_INFO, 0, "]\n");

	return 0;
}
@@ -159,7 +154,7 @@ static struct i2c_adapter mantis_i2c_adapter = {

int __devinit mantis_i2c_init(struct mantis_pci *mantis)
{
	u32 intstat;
	u32 intstat, intmask;

	memcpy(&mantis->adapter, &mantis_i2c_adapter, sizeof (mantis_i2c_adapter));
	i2c_set_adapdata(&mantis->adapter, mantis);
@@ -169,15 +164,12 @@ int __devinit mantis_i2c_init(struct mantis_pci *mantis)

	dprintk(verbose, MANTIS_DEBUG, 1, "Initializing I2C ..");

	// Clear all interrupts
	intstat = mmread(MANTIS_INT_STAT);
	intmask = mmread(MANTIS_INT_MASK);
	mmwrite(intstat, MANTIS_INT_STAT);
	mmwrite(intmask | MANTIS_INT_I2CDONE, MANTIS_INT_MASK);

	mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_I2CDONE,
					  MANTIS_INT_MASK);

	dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]",
		mmread(MANTIS_INT_STAT), mmread(MANTIS_INT_MASK));
	dprintk(verbose, MANTIS_DEBUG, 1, "[0x%08x/%08x]", intstat, intmask);

	return 0;
}
+63 −107
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ MODULE_DEVICE_TABLE(pci, mantis_pci_table);

static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
{
	int i = 0, interrupts = 0;
	u32 stat = 0, mask = 0, lstat = 0, mstat = 0;
	struct mantis_pci *mantis;

@@ -64,109 +63,67 @@ static irqreturn_t mantis_pci_irq(int irq, void *dev_id)
	stat = mmread(MANTIS_INT_STAT);
	mask = mmread(MANTIS_INT_MASK);
	mstat = lstat = stat & ~MANTIS_INT_RISCSTAT;

	if (!(stat & mask)) {
		dprintk(verbose, MANTIS_DEBUG, 1, "Not ours !");
	if (!(stat & mask))
		return IRQ_NONE;
	}
	mmwrite(lstat, MANTIS_INT_STAT);
	interrupts = hweight32(stat);
	dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]=%d [", stat, mask, interrupts);

	while (lstat) {
		if (lstat & MANTIS_INT_RISCEN) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
			lstat &= ~MANTIS_INT_RISCEN;

		} else if (lstat & MANTIS_INT_I2CRACK) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
	mantis->mantis_int_stat = stat;
	mantis->mantis_int_mask = mask;
			wake_up(&mantis->i2c_wq);
			lstat &= ~MANTIS_INT_I2CRACK;

		} else if (lstat & MANTIS_INT_PCMCIA7) {
	dprintk(verbose, MANTIS_DEBUG, 0, "=== Interrupts[%04x/%04x]= [", stat, mask);
	if (stat & MANTIS_INT_RISCEN) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* DMA enabl *");
	}
	if (stat & MANTIS_INT_I2CRACK) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* I2C R-ACK *");
//		wake_up(&mantis->i2c_wq);
	}
	if (stat & MANTIS_INT_PCMCIA7) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-07 *");
			lstat &= ~MANTIS_INT_PCMCIA7;

		} else if (lstat & MANTIS_INT_PCMCIA6) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-06 *");
			lstat &= ~MANTIS_INT_PCMCIA6;

		} else if (lstat & MANTIS_INT_PCMCIA5) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-05 *");
			lstat &= ~MANTIS_INT_PCMCIA5;

		} else if (lstat & MANTIS_INT_PCMCIA4) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-04 *");
			lstat &= ~MANTIS_INT_PCMCIA4;

		} else if (lstat & MANTIS_INT_PCMCIA3) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-03 *");
			lstat &= ~MANTIS_INT_PCMCIA3;

		} else if (lstat & MANTIS_INT_PCMCIA2) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-02 *");
			lstat &= ~MANTIS_INT_PCMCIA2;

		} else if (lstat & MANTIS_INT_PCMCIA1) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-01 *");
			lstat &= ~MANTIS_INT_PCMCIA1;

		} else if (lstat & MANTIS_INT_PCMCIA0) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* PCMCIA-00 *");
			lstat &= ~MANTIS_INT_PCMCIA0;

		} else if (lstat & MANTIS_INT_IRQ0) {
	}
	if (stat & MANTIS_INT_IRQ0) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-0 *");
			lstat &= ~MANTIS_INT_IRQ0;

		} else if (lstat & MANTIS_INT_IRQ1) {
	}
	if (stat & MANTIS_INT_IRQ1) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT IRQ-1 *");
			lstat &= ~MANTIS_INT_IRQ1;

		} else if (lstat & MANTIS_INT_OCERR) {
	}
	if (stat & MANTIS_INT_OCERR) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT OCERR *");
			lstat &= ~MANTIS_INT_OCERR;

		} else if (lstat & MANTIS_INT_PABORT) {
	}
	if (stat & MANTIS_INT_PABORT) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT PABRT *");
			lstat &= ~MANTIS_INT_PABORT;

		} else if (lstat & MANTIS_INT_RIPERR) {
	}
	if (stat & MANTIS_INT_RIPERR) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT RIPRR *");
			lstat &= ~MANTIS_INT_RIPERR;

		} else if (lstat & MANTIS_INT_PPERR) {
	}
	if (stat & MANTIS_INT_PPERR) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT PPERR *");
			lstat &= ~MANTIS_INT_PPERR;

		} else if (lstat & MANTIS_INT_FTRGT) {
	}
	if (stat & MANTIS_INT_FTRGT) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT FTRGT *");
			lstat &= ~MANTIS_INT_FTRGT;

		} else if (lstat & MANTIS_INT_RISCI) {
	}
	if (stat & MANTIS_INT_RISCI) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* INT RISCI *");
		mantis->finished_block = (stat & MANTIS_INT_RISCSTAT) >> 28;
		tasklet_schedule(&mantis->tasklet);
			lstat &= ~MANTIS_INT_RISCI;

		} else if (lstat & MANTIS_INT_I2CDONE) {
			dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE  *");
			mantis->mantis_int_stat = stat;
			mantis->mantis_int_mask = mask;
			lstat &= ~MANTIS_INT_I2CDONE;
		} else {
			dprintk(verbose, MANTIS_DEBUG, 0,
				"* Unknown [%04x/%04x] *", stat, mask);
			break;
		}
		i++;
		if (i > interrupts) {
			dprintk(verbose, MANTIS_ERROR, 1, "going Loopy ! -- BREAK --");
			break;
	}
	if (stat & MANTIS_INT_I2CDONE) {
		dprintk(verbose, MANTIS_DEBUG, 0, "* I2C DONE  *");
		wake_up(&mantis->i2c_wq);
	}
	mmwrite(stat, MANTIS_INT_STAT);
	stat &= ~(MANTIS_INT_RISCEN   | MANTIS_INT_I2CDONE |
		  MANTIS_INT_I2CRACK  | MANTIS_INT_PCMCIA7 |
		  MANTIS_INT_PCMCIA6  | MANTIS_INT_PCMCIA5 |
		  MANTIS_INT_PCMCIA4  | MANTIS_INT_PCMCIA3 |
		  MANTIS_INT_PCMCIA2  | MANTIS_INT_PCMCIA1 |
		  MANTIS_INT_PCMCIA0  | MANTIS_INT_IRQ1	   |
		  MANTIS_INT_IRQ0     | MANTIS_INT_OCERR   |
		  MANTIS_INT_PABORT   | MANTIS_INT_RIPERR  |
		  MANTIS_INT_PPERR    | MANTIS_INT_FTRGT   |
		  MANTIS_INT_RISCI);

	if (stat)
		dprintk(verbose, MANTIS_DEBUG, 0, "* Unknown [%04x] *", stat);

	dprintk(verbose, MANTIS_DEBUG, 0, "] ===\n");

	return IRQ_HANDLED;
@@ -180,8 +137,6 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
	struct mantis_pci *mantis;
	int ret = 0;

	devs++;

	mantis = kmalloc(sizeof (struct mantis_pci), GFP_KERNEL);
	if (mantis == NULL) {
		printk("%s: Out of memory\n", __func__);
@@ -190,6 +145,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
	}
	memset(mantis, 0, sizeof (struct mantis_pci));
	mantis->num = devs;
	devs++;

	if (pci_enable_device(pdev)) {
		dprintk(verbose, MANTIS_ERROR, 1, "Mantis PCI enable failed");
		ret = -ENODEV;
@@ -225,11 +182,13 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
	mantis->latency = latency;
	mantis->revision = revision;
	mantis->pdev = pdev;
	mantis->subsystem_vendor = pdev->subsystem_vendor;
	mantis->subsystem_device = pdev->subsystem_device;
	init_waitqueue_head(&mantis->i2c_wq);

	// CAM bypass
	//mmwrite(mmread(MANTIS_INT_MASK) | MANTIS_INT_IRQ1, MANTIS_INT_MASK);
	dprintk(verbose, MANTIS_INFO, 1, "gpif status: %04x  irqcfg: %04x", mmread(0x9c), mmread(0x98));
	dprintk(verbose, MANTIS_INFO, 0, "\ngpif status: %04x  irqcfg: %04x\n", mmread(0x9c), mmread(0x98));
	if ((mmread(0x9c) & 0x200) != 0) { //CAM inserted
		msleep_interruptible(1);
		if ((mmread(0x9c) & 0x200) != 0)
@@ -242,11 +201,8 @@ static int __devinit mantis_pci_probe(struct pci_dev *pdev,
	}
	mantis_set_direction(mantis, 0);

	// default latency if none specified
	if (!latency)
		pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 32);
	dprintk(verbose, MANTIS_ERROR, 0, "Mantis Rev %d, ",
		mantis->revision);

	dprintk(verbose, MANTIS_ERROR, 0,
		"irq: %d, latency: %d\n memory: 0x%lx, mmio: 0x%p\n",
Loading