patch-2.2.12 linux/drivers/isdn/hisax/hfc_pci.c
Next file: linux/drivers/isdn/hisax/hfc_pci.h
Previous file: linux/drivers/isdn/hisax/gazel.c
Back to the patch index
Back to the overall index
- Lines: 230
- Date:
Wed Aug 25 17:29:47 1999
- Orig file:
v2.2.11/linux/drivers/isdn/hisax/hfc_pci.c
- Orig date:
Mon Aug 9 16:05:55 1999
diff -u --recursive --new-file v2.2.11/linux/drivers/isdn/hisax/hfc_pci.c linux/drivers/isdn/hisax/hfc_pci.c
@@ -1,4 +1,4 @@
-/* $Id: hfc_pci.c,v 1.7 1999/07/14 21:24:20 werner Exp $
+/* $Id: hfc_pci.c,v 1.13 1999/08/11 21:01:28 keil Exp $
* hfc_pci.c low level driver for CCD´s hfc-pci based cards
*
@@ -23,6 +23,25 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: hfc_pci.c,v $
+ * Revision 1.13 1999/08/11 21:01:28 keil
+ * new PCI codefix
+ *
+ * Revision 1.12 1999/08/10 16:01:58 calle
+ * struct pci_dev changed in 2.3.13. Made the necessary changes.
+ *
+ * Revision 1.11 1999/08/09 19:13:32 werner
+ * moved constant pci ids to pci id table
+ *
+ * Revision 1.10 1999/08/08 10:17:34 werner
+ * added new PCI vendor and card ids for Manufacturer 0x1043
+ *
+ * Revision 1.9 1999/08/07 21:09:10 werner
+ * Fixed another memcpy problem in fifo handling.
+ * Thanks for debugging aid by Olaf Kordwittenborg.
+ *
+ * Revision 1.8 1999/07/23 14:25:15 werner
+ * Some smaller bug fixes and prepared support for GCI/IOM bus
+ *
* Revision 1.7 1999/07/14 21:24:20 werner
* fixed memcpy problem when using E-channel feature
*
@@ -60,7 +79,22 @@
extern const char *CardType[];
-static const char *hfcpci_revision = "$Revision: 1.7 $";
+static const char *hfcpci_revision = "$Revision: 1.13 $";
+
+static const int CCD_VENDOR_IDS[] = {
+ 0x1043, /* Asuscom */
+ 0x1051, /* Motorola MC145575 */
+ 0x1397, /* CCD and Billion */
+ 0,
+};
+
+static const int CCD_DEVICE_IDS[] = {
+ 0x675, /* Asuscom */
+ 0x100, /* Motorola MC145575 */
+ 0x2BD0, /* CCD and Billion */
+ 0,
+};
+
#if CONFIG_PCI
/*****************************/
@@ -151,6 +185,20 @@
Write_hfc(cs, HFCPCI_SCTRL, cs->hw.hfcpci.sctrl);
cs->hw.hfcpci.sctrl_r = 0;
Write_hfc(cs, HFCPCI_SCTRL_R, cs->hw.hfcpci.sctrl_r);
+
+ /* Init GCI/IOM2 in master mode */
+ /* Slots 0 and 1 are set for B-chan 1 and 2 */
+ /* D- and monitor/CI channel are not enabled */
+ /* STIO1 is used as output for data, B1+B2 from ST->IOM+HFC */
+ /* STIO2 is used as data input, B1+B2 from IOM->ST */
+ /* ST B-channel send disabled -> continous 1s */
+ /* The IOM slots are always enabled */
+ cs->hw.hfcpci.conn = 0x36; /* set data flow directions */
+ Write_hfc(cs, HFCPCI_CONNECT, cs->hw.hfcpci.conn);
+ Write_hfc(cs, HFCPCI_B1_SSL, 0x80); /* B1-Slot 0 STIO1 out enabled */
+ Write_hfc(cs, HFCPCI_B2_SSL, 0x81); /* B2-Slot 1 STIO1 out enabled */
+ Write_hfc(cs, HFCPCI_B1_RSL, 0x80); /* B1-Slot 0 STIO2 in enabled */
+ Write_hfc(cs, HFCPCI_B2_RSL, 0x81); /* B2-Slot 1 STIO2 in enabled */
restore_flags(flags);
}
@@ -242,7 +290,7 @@
count -= 3;
ptr = skb_put(skb, count);
- if (zp->z1 >= zp->z2)
+ if (zp->z2 + count <= B_FIFO_SIZE + B_SUB_VAL)
maxlen = count; /* complete transfer */
else
maxlen = B_FIFO_SIZE + B_SUB_VAL - zp->z2; /* maximum */
@@ -306,7 +354,7 @@
rcnt -= 3;
ptr = skb_put(skb, rcnt);
- if (zp->z1 >= zp->z2)
+ if (zp->z2 + rcnt <= D_FIFO_SIZE)
maxlen = rcnt; /* complete transfer */
else
maxlen = D_FIFO_SIZE - zp->z2; /* maximum */
@@ -570,9 +618,13 @@
/* set/reset echo mode */
/***********************/
int hfcpci_set_echo(struct IsdnCardState *cs, int i)
-{
+{ int flags;
+
if (cs->chanlimit > 1)
return(-EINVAL);
+
+ save_flags(flags);
+ cli();
if (i) {
cs->logecho = 1;
cs->hw.hfcpci.trm |= 0x20; /* enable echo chan */
@@ -587,7 +639,7 @@
}
cs->hw.hfcpci.sctrl_r &= ~SCTRL_B2_ENA;
cs->hw.hfcpci.sctrl &= ~SCTRL_B2_ENA;
- cs->hw.hfcpci.conn &= ~0x18;
+ cs->hw.hfcpci.conn |= 0x10; /* B2-IOM -> B2-ST */
cs->hw.hfcpci.ctmt &= ~2;
Write_hfc(cs, HFCPCI_CTMT, cs->hw.hfcpci.ctmt);
Write_hfc(cs, HFCPCI_SCTRL_R, cs->hw.hfcpci.sctrl_r);
@@ -596,6 +648,7 @@
Write_hfc(cs, HFCPCI_TRM, cs->hw.hfcpci.trm);
Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1);
+ restore_flags(flags);
return(0);
} /* hfcpci_set_echo */
@@ -654,7 +707,7 @@
rcnt -= 3;
ptr = e_buffer;
- if (zp->z1 >= zp->z2)
+ if (zp->z2 <= B_FIFO_SIZE + B_SUB_VAL)
maxlen = rcnt; /* complete transfer */
else
maxlen = B_FIFO_SIZE + B_SUB_VAL - zp->z2; /* maximum */
@@ -1091,7 +1144,7 @@
cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B2TRANS+HFCPCI_INTS_B2REC);
} else {
cs->hw.hfcpci.ctmt |= 1;
- cs->hw.hfcpci.conn &= ~0x3;
+ cs->hw.hfcpci.conn &= ~0x03;
cs->hw.hfcpci.sctrl |= SCTRL_B1_ENA;
cs->hw.hfcpci.sctrl_r |= SCTRL_B1_ENA;
cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B1;
@@ -1115,6 +1168,21 @@
cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B1TRANS+HFCPCI_INTS_B1REC);
}
break;
+ case (L1_MODE_EXTRN):
+ if (bc) {
+ cs->hw.hfcpci.conn |= 0x10;
+ cs->hw.hfcpci.sctrl |= SCTRL_B2_ENA;
+ cs->hw.hfcpci.sctrl_r |= SCTRL_B2_ENA;
+ cs->hw.hfcpci.fifo_en &= ~HFCPCI_FIFOEN_B2;
+ cs->hw.hfcpci.int_m1 &= ~(HFCPCI_INTS_B2TRANS+HFCPCI_INTS_B2REC);
+ } else {
+ cs->hw.hfcpci.conn |= 0x02;
+ cs->hw.hfcpci.sctrl |= SCTRL_B1_ENA;
+ cs->hw.hfcpci.sctrl_r |= SCTRL_B1_ENA;
+ cs->hw.hfcpci.fifo_en &= ~HFCPCI_FIFOEN_B1;
+ cs->hw.hfcpci.int_m1 &= ~(HFCPCI_INTS_B1TRANS+HFCPCI_INTS_B1REC);
+ }
+ break;
}
Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1);
restore_flags(flags);
@@ -1384,6 +1452,10 @@
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
+ int i;
+#ifdef COMPAT_HAS_NEW_PCI
+ struct pci_dev *tmp_hfcpci = NULL;
+#endif
strcpy(tmp, hfcpci_revision);
printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
@@ -1402,8 +1474,17 @@
printk(KERN_ERR "HFC-PCI: no PCI bus present\n");
return (0);
}
- if ((dev_hfcpci = pci_find_device(PCI_VENDOR_CCD,
- PCI_CCD_PCI_ID, dev_hfcpci))) {
+ i = 0;
+ while (CCD_VENDOR_IDS[i]) {
+ tmp_hfcpci = pci_find_device(CCD_VENDOR_IDS[i],
+ CCD_DEVICE_IDS[i],
+ dev_hfcpci);
+ if (tmp_hfcpci) break;
+ i++;
+ }
+
+ if (tmp_hfcpci) {
+ dev_hfcpci = tmp_hfcpci; /* old device */
cs->hw.hfcpci.pci_bus = dev_hfcpci->bus->number;
cs->hw.hfcpci.pci_device_fn = dev_hfcpci->devfn;
cs->irq = dev_hfcpci->irq;
@@ -1411,8 +1492,7 @@
printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
return (0);
}
- cs->hw.hfcpci.pci_io = (char *)
- dev_hfcpci->base_address[1];
+ cs->hw.hfcpci.pci_io = (char *) get_pcibase(dev_hfcpci, 1);
} else {
printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
return (0);
@@ -1421,11 +1501,17 @@
for (; pci_index < 255; pci_index++) {
unsigned char irq;
- if (pcibios_find_device(PCI_VENDOR_CCD,
- PCI_CCD_PCI_ID, pci_index,
- &cs->hw.hfcpci.pci_bus, &cs->hw.hfcpci.pci_device_fn) != 0) {
- continue;
+ i = 0;
+ while (CCD_VENDOR_IDS[i]) {
+ if (pcibios_find_device(CCD_VENDOR_IDS[i],
+ CCD_DEVICE_IDS[i], pci_index,
+ &cs->hw.hfcpci.pci_bus, &cs->hw.hfcpci.pci_device_fn) == 0)
+ break;
+ i++;
}
+ if (!CCD_VENDOR_IDS[i])
+ continue;
+
pcibios_read_config_byte(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn,
PCI_INTERRUPT_LINE, &irq);
cs->irq = irq;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)