patch-2.2.19 linux/drivers/isdn/hisax/hfc_pci.c
Next file: linux/drivers/isdn/hisax/hfc_pci.h
Previous file: linux/drivers/isdn/hisax/hfc_2bs0.h
Back to the patch index
Back to the overall index
- Lines: 346
- Date:
Sun Mar 25 11:37:32 2001
- Orig file:
v2.2.18/drivers/isdn/hisax/hfc_pci.c
- Orig date:
Sun Mar 25 11:28:24 2001
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.18/drivers/isdn/hisax/hfc_pci.c linux/drivers/isdn/hisax/hfc_pci.c
@@ -1,4 +1,4 @@
-/* $Id: hfc_pci.c,v 1.27 2000/02/26 00:35:12 keil Exp $
+/* $Id: hfc_pci.c,v 1.34.6.4 2001/02/13 10:33:58 kai Exp $
* hfc_pci.c low level driver for CCD´s hfc-pci based cards
*
@@ -22,114 +22,21 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Log: hfc_pci.c,v $
- * Revision 1.27 2000/02/26 00:35:12 keil
- * Fix skb freeing in interrupt context
- *
- * Revision 1.26 2000/02/09 20:22:55 werner
- *
- * Updated PCI-ID table
- *
- * Revision 1.25 1999/12/19 13:09:42 keil
- * changed TASK_INTERRUPTIBLE into TASK_UNINTERRUPTIBLE for
- * signal proof delays
- *
- * Revision 1.24 1999/11/17 23:59:55 werner
- *
- * removed unneeded data
- *
- * Revision 1.23 1999/11/07 17:01:55 keil
- * fix for 2.3 pci structs
- *
- * Revision 1.22 1999/10/10 20:14:27 werner
- *
- * Correct B2-chan usage in conjuntion with echo mode. First implementation of NT-leased line mode.
- *
- * Revision 1.21 1999/10/02 17:47:49 werner
- *
- * Changed init order, added correction for page alignment with shared mem
- *
- * Revision 1.20 1999/09/07 06:18:55 werner
- *
- * Added io parameter for HFC-PCI based cards. Needed only with multiple cards
- * when initialisation/selection order needs to be set.
- *
- * Revision 1.19 1999/09/04 06:20:06 keil
- * Changes from kernel set_current_state()
- *
- * Revision 1.18 1999/08/29 17:05:44 werner
- * corrected tx_lo line setup. Datasheet is not correct.
- *
- * Revision 1.17 1999/08/28 21:04:27 werner
- * Implemented full audio support (transparent mode)
- *
- * Revision 1.16 1999/08/25 17:01:27 keil
- * Use new LL->HL auxcmd call
- *
- * Revision 1.15 1999/08/22 20:27:05 calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- * define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.14 1999/08/12 18:59:45 werner
- * Added further manufacturer and device ids to PCI list
- *
- * 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
- *
- * Revision 1.6 1999/07/13 21:08:08 werner
- * added echo channel logging feature.
- *
- * Revision 1.5 1999/07/12 21:05:10 keil
- * fix race in IRQ handling
- * added watchdog for lost IRQs
- *
- * Revision 1.4 1999/07/04 21:51:39 werner
- * Changes to solve problems with irq sharing and smp machines
- * Thanks to Karsten Keil and Alex Holden for giving aid with
- * testing and debugging
- *
- * Revision 1.3 1999/07/01 09:43:19 keil
- * removed additional schedules in timeouts
- *
- * Revision 1.2 1999/07/01 08:07:51 keil
- * Initial version
- *
- *
- *
*/
+#include <linux/init.h>
#include <linux/config.h>
#define __NO_VERSION__
#include "hisax.h"
#include "hfc_pci.h"
#include "isdnl1.h"
#include <linux/pci.h>
+#include <linux/isdn_compat.h>
#include <linux/interrupt.h>
extern const char *CardType[];
-static const char *hfcpci_revision = "$Revision: 1.27 $";
+static const char *hfcpci_revision = "$Revision: 1.34.6.4 $";
/* table entry in the PCI devices list */
typedef struct {
@@ -139,26 +46,32 @@
char *card_name;
} PCI_ENTRY;
-#define NT_T1_COUNT 20 /* number of 3.125ms interrupts for G2 timeout */
+#define NT_T1_COUNT 20 /* number of 3.125ms interrupts for G2 timeout */
+#define CLKDEL_TE 0x0e /* CLKDEL in TE mode */
+#define CLKDEL_NT 0x6c /* CLKDEL in NT mode */
static const PCI_ENTRY id_list[] =
{
- {0x1397, 0x2BD0, "CCD/Billion/Asuscom", "2BD0"},
- {0x1397, 0xB000, "Billion", "B000"},
- {0x1397, 0xB006, "Billion", "B006"},
- {0x1397, 0xB007, "Billion", "B007"},
- {0x1397, 0xB008, "Billion", "B008"},
- {0x1397, 0xB009, "Billion", "B009"},
- {0x1397, 0xB00A, "Billion", "B00A"},
- {0x1397, 0xB00B, "Billion", "B00B"},
- {0x1397, 0xB00C, "Billion", "B00C"},
- {0x1043, 0x0675, "Asuscom/Askey", "675"},
- {0x0871, 0xFFA2, "German telekom", "T-Concept"},
- {0x0871, 0xFFA1, "German telekom", "A1T"},
- {0x1051, 0x0100, "Motorola MC145575", "MC145575"},
- {0x1397, 0xB100, "Seyeon", "B100"},
- {0x15B0, 0x2BD0, "Zoltrix", "2BD0"},
- {0x114f, 0x71, "Digi intl.","Digicom"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_2BD0, "CCD/Billion/Asuscom", "2BD0"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B000, "Billion", "B000"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B006, "Billion", "B006"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B007, "Billion", "B007"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B008, "Billion", "B008"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B009, "Billion", "B009"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00A, "Billion", "B00A"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00B, "Billion", "B00B"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B00C, "Billion", "B00C"},
+ {PCI_VENDOR_ID_CCD, PCI_DEVICE_ID_CCD_B100, "Seyeon", "B100"},
+ {PCI_VENDOR_ID_ABOCOM, PCI_DEVICE_ID_ABOCOM_2BD1, "Abocom/Magitek", "2BD1"},
+ {PCI_VENDOR_ID_ASUSTEK, PCI_DEVICE_ID_ASUSTEK_0675, "Asuscom/Askey", "675"},
+ {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_T_CONCEPT, "German telekom", "T-Concept"},
+ {PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A1T, "German telekom", "A1T"},
+ {PCI_VENDOR_ID_ANIGMA, PCI_DEVICE_ID_ANIGMA_MC145575, "Motorola MC145575", "MC145575"},
+ {PCI_VENDOR_ID_ZOLTRIX, PCI_DEVICE_ID_ZOLTRIX_2BD0, "Zoltrix", "2BD0"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_E,"Digi International", "Digi DataFire Micro V IOM2 (Europe)"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_E,"Digi International", "Digi DataFire Micro V (Europe)"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_IOM2_A,"Digi International", "Digi DataFire Micro V IOM2 (North America)"},
+ {PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_DF_M_A,"Digi International", "Digi DataFire Micro V (North America)"},
{0, 0, NULL, NULL},
};
@@ -180,7 +93,7 @@
restore_flags(flags);
Write_hfc(cs, HFCPCI_CIRM, HFCPCI_RESET); /* Reset On */
sti();
- current->state = TASK_UNINTERRUPTIBLE;
+ set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((30 * HZ) / 1000); /* Timeout 30ms */
Write_hfc(cs, HFCPCI_CIRM, 0); /* Reset Off */
#if CONFIG_PCI
@@ -211,10 +124,10 @@
pcibios_write_config_word(cs->hw.hfcpci.pci_bus, cs->hw.hfcpci.pci_device_fn, PCI_COMMAND, PCI_ENA_MEMIO + PCI_ENA_MASTER); /* enable memory ports + busmaster */
Write_hfc(cs, HFCPCI_CIRM, HFCPCI_RESET); /* Reset On */
sti();
- current->state = TASK_UNINTERRUPTIBLE;
+ set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((30 * HZ) / 1000); /* Timeout 30ms */
Write_hfc(cs, HFCPCI_CIRM, 0); /* Reset Off */
- current->state = TASK_UNINTERRUPTIBLE;
+ set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((20 * HZ) / 1000); /* Timeout 20ms */
if (Read_hfc(cs, HFCPCI_STATUS) & 2)
printk(KERN_WARNING "HFC-PCI init bit busy\n");
@@ -225,7 +138,7 @@
cs->hw.hfcpci.trm = 0 + HFCPCI_BTRANS_THRESMASK; /* no echo connect , threshold */
Write_hfc(cs, HFCPCI_TRM, cs->hw.hfcpci.trm);
- Write_hfc(cs, HFCPCI_CLKDEL, 0x0e); /* ST-Bit delay for TE-Mode */
+ Write_hfc(cs, HFCPCI_CLKDEL, CLKDEL_TE); /* ST-Bit delay for TE-Mode */
cs->hw.hfcpci.sctrl_e = HFCPCI_AUTO_AWAKE;
Write_hfc(cs, HFCPCI_SCTRL_E, cs->hw.hfcpci.sctrl_e); /* S/T Auto awake */
cs->hw.hfcpci.bswapped = 0; /* no exchange */
@@ -349,6 +262,9 @@
(*(bdata + (zp->z1 - B_SUB_VAL)))) {
if (cs->debug & L1_DEB_WARN)
debugl1(cs, "hfcpci_empty_fifo: incoming packet invalid length %d or crc", count);
+#ifdef ERROR_STATISTIC
+ bcs->err_inv++;
+#endif
bz->za[new_f2].z2 = new_z2;
bz->f2 = new_f2; /* next buffer */
skb = NULL;
@@ -415,6 +331,9 @@
(df->data[zp->z1])) {
if (cs->debug & L1_DEB_WARN)
debugl1(cs, "empty_fifo hfcpci paket inv. len %d or crc %d", rcnt, df->data[zp->z1]);
+#ifdef ERROR_STATISTIC
+ cs->err_rx++;
+#endif
df->f2 = ((df->f2 + 1) & MAX_D_FRAMES) | (MAX_D_FRAMES + 1); /* next buffer */
df->za[df->f2 & D_FREG_MASK].z2 = (zp->z2 + rcnt) & (D_FIFO_SIZE - 1);
} else if ((skb = dev_alloc_skb(rcnt - 3))) {
@@ -601,6 +520,9 @@
if (fcnt > (MAX_D_FRAMES - 1)) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "hfcpci_fill_Dfifo more as 14 frames");
+#ifdef ERROR_STATISTIC
+ cs->err_tx++;
+#endif
return;
}
/* now determine free bytes in FIFO buffer */
@@ -835,6 +757,7 @@
(!(cs->hw.hfcpci.int_m1 & (HFCPCI_INTS_B2TRANS + HFCPCI_INTS_B2REC + HFCPCI_INTS_B1TRANS + HFCPCI_INTS_B1REC)))) {
save_flags(flags);
cli();
+ Write_hfc(cs, HFCPCI_CLKDEL, CLKDEL_NT); /* ST-Bit delay for NT-Mode */
Write_hfc(cs, HFCPCI_STATES, HFCPCI_LOAD_STATE | 0); /* HFC ST G0 */
udelay(10);
cs->hw.hfcpci.sctrl |= SCTRL_MODE_NT;
@@ -1650,8 +1573,8 @@
/********************************/
/* called for card init message */
/********************************/
-__initfunc(void
- inithfcpci(struct IsdnCardState *cs))
+void __init
+inithfcpci(struct IsdnCardState *cs)
{
cs->setstack_d = setstack_hfcpci;
cs->dbusytimer.function = (void *) hfcpci_dbusy_timer;
@@ -1690,7 +1613,7 @@
inithfcpci(cs);
save_flags(flags);
sti();
- current->state = TASK_UNINTERRUPTIBLE;
+ set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80 * HZ) / 1000); /* Timeout 80ms */
/* now switch timer interrupt off */
cs->hw.hfcpci.int_m1 &= ~HFCPCI_INTS_TIMER;
@@ -1711,26 +1634,23 @@
#endif /* CONFIG_PCI */
-__initfunc(int
- setup_hfcpci(struct IsdnCard *card))
+int __init setup_hfcpci(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
- unsigned short cmd;
char tmp[64];
int i;
struct pci_dev *tmp_hfcpci = NULL;
+#ifdef __BIG_ENDIAN
+#error "not running on big endian machines now"
+#endif
strcpy(tmp, hfcpci_revision);
printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
-#if CONFIG_PCI
+#ifdef CONFIG_PCI
cs->hw.hfcpci.int_s1 = 0;
cs->dc.hfcpci.ph_state = 0;
cs->hw.hfcpci.fifo = 255;
if (cs->typ == ISDN_CTYPE_HFC_PCI) {
- if (!pci_present()) {
- printk(KERN_ERR "HFC-PCI: no PCI bus present\n");
- return (0);
- }
i = 0;
while (id_list[i].vendor_id) {
tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
@@ -1738,6 +1658,8 @@
dev_hfcpci);
i++;
if (tmp_hfcpci) {
+ if (pci_enable_device(tmp_hfcpci))
+ continue;
if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->base_address[ 0] & PCI_BASE_ADDRESS_IO_MASK)))
continue;
else
@@ -1761,41 +1683,6 @@
printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
return (0);
}
-#ifdef notdef
- if (((int) cs->hw.hfcpci.pci_io & (PAGE_SIZE - 1))) {
- printk(KERN_WARNING "HFC-PCI shared mem address will be corrected\n");
- pcibios_write_config_word(cs->hw.hfcpci.pci_bus,
- cs->hw.hfcpci.pci_device_fn,
- PCI_COMMAND,
- 0x0103); /* set SERR */
- pcibios_read_config_word(cs->hw.hfcpci.pci_bus,
- cs->hw.hfcpci.pci_device_fn,
- PCI_COMMAND,
- &cmd);
- pcibios_write_config_word(cs->hw.hfcpci.pci_bus,
- cs->hw.hfcpci.pci_device_fn,
- PCI_COMMAND,
- cmd & ~2);
- (int) cs->hw.hfcpci.pci_io &= ~(PAGE_SIZE - 1);
- pcibios_write_config_dword(cs->hw.hfcpci.pci_bus,
- cs->hw.hfcpci.pci_device_fn,
- PCI_BASE_ADDRESS_1,
- (int) cs->hw.hfcpci.pci_io);
- pcibios_write_config_word(cs->hw.hfcpci.pci_bus,
- cs->hw.hfcpci.pci_device_fn,
- PCI_COMMAND,
- cmd);
- pcibios_read_config_dword(cs->hw.hfcpci.pci_bus,
- cs->hw.hfcpci.pci_device_fn,
- PCI_BASE_ADDRESS_1,
- (void *) &cs->hw.hfcpci.pci_io);
- if (((int) cs->hw.hfcpci.pci_io & (PAGE_SIZE - 1))) {
- printk(KERN_WARNING "HFC-PCI unable to align address %x\n", (unsigned) cs->hw.hfcpci.pci_io);
- return (0);
- }
- dev_hfcpci->base_address[1] = (int) cs->hw.hfcpci.pci_io;
- }
-#endif
if (!cs->hw.hfcpci.pci_io) {
printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
return (0);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)