patch-2.3.27 linux/drivers/pcmcia/i82365.c

Next file: linux/drivers/pcmcia/i82365.h
Previous file: linux/drivers/pcmcia/ds.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/drivers/pcmcia/i82365.c linux/drivers/pcmcia/i82365.c
@@ -3,7 +3,7 @@
     Device driver for Intel 82365 and compatible PC Card controllers,
     and Yenta-compatible PCI-to-CardBus controllers.
 
-    i82365.c 1.260 1999/10/21 00:56:07
+    i82365.c 1.265 1999/11/10 18:36:21
 
     The contents of this file are subject to the Mozilla Public
     License Version 1.1 (the "License"); you may not use this file
@@ -16,7 +16,7 @@
     rights and limitations under the License.
 
     The initial developer of the original code is David A. Hinds
-    <dhinds@hyper.stanford.edu>.  Portions created by David A. Hinds
+    <dhinds@pcmcia.sourceforge.org>.  Portions created by David A. Hinds
     are Copyright (C) 1999 David A. Hinds.  All Rights Reserved.
 
     Alternatively, the contents of this file may be used under the
@@ -76,7 +76,7 @@
 MODULE_PARM(pc_debug, "i");
 #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
 static const char *version =
-"i82365.c 1.260 1999/10/21 00:56:07 (David Hinds)";
+"i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)";
 #else
 #define DEBUG(n, args...) do { } while (0)
 #endif
@@ -189,7 +189,7 @@
 #ifdef CONFIG_ISA
 #ifdef CONFIG_PCI
 /* PCI card status change interrupts? */
-static int pci_csc = 1;
+static int pci_csc = 0;
 /* PCI IO card functional interrupts? */
 static int pci_int = 0;
 MODULE_PARM(pci_csc, "i");
@@ -903,7 +903,8 @@
 {
     socket_info_t *t = &socket[s];
     o2micro_state_t *p = &socket[s].state.o2micro;
-    if ((t->revision == 0x34) || (t->revision == 0x62)) {
+    if ((t->revision == 0x34) || (t->revision == 0x62) ||
+	(t->type == IS_OZ6812)) {
 	p->mode_a = i365_get(s, O2_MODE_A_2);
 	p->mode_b = i365_get(s, O2_MODE_B_2);
     } else {
@@ -923,7 +924,8 @@
 {
     socket_info_t *t = &socket[s];
     o2micro_state_t *p = &socket[s].state.o2micro;
-    if ((t->revision == 0x34) || (t->revision == 0x62)) {
+    if ((t->revision == 0x34) || (t->revision == 0x62) ||
+	(t->type == IS_OZ6812)) {
 	i365_set(s, O2_MODE_A_2, p->mode_a);
 	i365_set(s, O2_MODE_B_2, p->mode_b);
     } else {
@@ -1007,6 +1009,7 @@
 	flip(p->ccr, TOPIC97_ICR_IRQSEL, pcsc);
 	return 0;
     } else {
+	/* no ISA card status change irq */
 	return !pcsc;
     }
 }
@@ -1541,7 +1544,8 @@
 #ifdef CONFIG_ISA
     /* Poll if only two interrupts available */
     if (!use_pci && !poll_interval) {
-	u_int tmp = (mask & (mask-1));
+	u_int tmp = (mask & 0xff20);
+	tmp = tmp & (tmp-1);
 	if ((tmp & (tmp-1)) == 0)
 	    poll_interval = HZ;
     }
@@ -1627,7 +1631,7 @@
 				 u_short v, u_short d0)
 {
     socket_info_t *s = &socket[sockets];
-    u_short d, ns;
+    u_short d, ns, i;
     u_char a, b, r, max;
     
     /* PCI bus enumeration is broken on some systems */
@@ -1666,7 +1670,6 @@
 	pci_writel(bus, devfn, CB_LEGACY_MODE_BASE, 0);
 	pci_readl(bus, devfn, PCI_BASE_ADDRESS_0, &s->cb_phys);
 	if (s->cb_phys == 0) {
-	    int i;
 	    pci_writew(bus, devfn, PCI_COMMAND, CMD_DFLT);
 	    for (i = 0; i < sizeof(cb_mem_base)/sizeof(u_int); i++) {
 		s->cb_phys = cb_mem_base[i];
@@ -1710,10 +1713,21 @@
     }
     add_pcic(ns, type);
 
-    /* Re-do card type & voltage detection */
-    cb_writel(sockets-ns, CB_SOCKET_FORCE, CB_SF_CVSTEST);
-    __set_current_state(TASK_UNINTERRUPTIBLE);
-    schedule_timeout(HZ/5);
+    /* Re-do card voltage detection, if needed: this checks for
+       card presence with no voltage detect bits set */
+    for (a = sockets-ns; a < sockets; a++)
+	if (!(cb_readl(a, CB_SOCKET_STATE) & 0x3c86))
+	    cb_writel(a, CB_SOCKET_FORCE, CB_SF_CVSTEST);
+    for (i = 0; i < 200; i++) {
+	for (a = sockets-ns; a < sockets; a++)
+	    if (!(cb_readl(a, CB_SOCKET_STATE) & 0x3c86)) break;
+	if (a == sockets) break;
+	__set_current_state(TASK_UNINTERRUPTIBLE);
+	schedule_timeout(HZ/20);
+    }
+    if (i == 200)
+	printk(KERN_NOTICE "i82365: card voltage interrogation"
+	       " timed out!\n");
 
     /* Set up PCI bus bridge structures if needed */
     for (a = 0; a < ns; a++) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)