patch-2.3.29 linux/drivers/isdn/hisax/isurf.c

Next file: linux/drivers/isdn/hisax/sedlbauer.c
Previous file: linux/drivers/isdn/hisax/hisax.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.28/linux/drivers/isdn/hisax/isurf.c linux/drivers/isdn/hisax/isurf.c
@@ -1,10 +1,13 @@
-/* $Id: isurf.c,v 1.6 1999/09/04 06:20:06 keil Exp $
+/* $Id: isurf.c,v 1.7 1999/11/14 23:37:03 keil Exp $
 
  * isurf.c  low level stuff for Siemens I-Surf/I-Talk cards
  *
  * Author     Karsten Keil (keil@isdn4linux.de)
  *
  * $Log: isurf.c,v $
+ * Revision 1.7  1999/11/14 23:37:03  keil
+ * new ISA memory mapped IO
+ *
  * Revision 1.6  1999/09/04 06:20:06  keil
  * Changes from kernel set_current_state()
  *
@@ -37,7 +40,7 @@
 
 extern const char *CardType[];
 
-static const char *ISurf_revision = "$Revision: 1.6 $";
+static const char *ISurf_revision = "$Revision: 1.7 $";
 
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
@@ -50,7 +53,7 @@
 
 #define ISURF_ISAR_OFFSET	0
 #define ISURF_ISAC_OFFSET	0x100
-
+#define ISURF_IOMEM_SIZE	0x400
 /* Interface functions */
 
 static u_char
@@ -145,6 +148,8 @@
 release_io_isurf(struct IsdnCardState *cs)
 {
 	release_region(cs->hw.isurf.reset, 1);
+	iounmap((unsigned char *)cs->hw.isurf.isar);
+	release_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
 }
 
 static void
@@ -223,8 +228,7 @@
  		return(0);
 	if (card->para[1] && card->para[2]) {
 		cs->hw.isurf.reset = card->para[1];
-		cs->hw.isurf.isar = card->para[2] + ISURF_ISAR_OFFSET;
-		cs->hw.isurf.isac = card->para[2] + ISURF_ISAC_OFFSET;
+		cs->hw.isurf.phymem = card->para[2];
 		cs->irq = card->para[0];
 	} else {
 		printk(KERN_WARNING "HiSax: %s port/mem not set\n",
@@ -240,11 +244,25 @@
 	} else {
 		request_region(cs->hw.isurf.reset, 1, "isurf isdn");
 	}
-
+	if (check_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE)) {
+		printk(KERN_WARNING
+			"HiSax: %s memory region %lx-%lx already in use\n",
+			CardType[card->typ],
+			cs->hw.isurf.phymem,
+			cs->hw.isurf.phymem + ISURF_IOMEM_SIZE);
+		release_region(cs->hw.isurf.reset, 1);
+		return (0);
+	} else {
+		request_mem_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE,
+			"isurf iomem");
+	}
+	cs->hw.isurf.isar =
+		(unsigned long) ioremap(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE);
+	cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET;
 	printk(KERN_INFO
-	       "ISurf: defined at 0x%x 0x%x IRQ %d\n",
+	       "ISurf: defined at 0x%x 0x%lx IRQ %d\n",
 	       cs->hw.isurf.reset,
-	       cs->hw.isurf.isar,
+	       cs->hw.isurf.phymem,
 	       cs->irq);
 
 	cs->cardmsg = &ISurf_card_msg;

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