LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 04/14] [ISDN] HiSax bkm_a4t: convert to PCI hotplug API
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
@ 2007-07-18  3:46   ` Jeff Garzik
  2007-07-18  3:49   ` [PATCH 05/14] [ISDN] HiSax enternow: " Jeff Garzik
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-07-18  3:46 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig   |    4 +-
 drivers/isdn/hisax/Makefile  |    3 +-
 drivers/isdn/hisax/bkm_a4t.c |  115 ++++++++++++++++++++++++++++--------------
 drivers/isdn/hisax/config.c  |   27 ++++------
 4 files changed, 92 insertions(+), 57 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 7832d8b..e7808f5 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -286,8 +286,8 @@ config HISAX_HSTSAPHIR
 	  settings.
 
 config HISAX_BKM_A4T
-	bool "Telekom A4T card"
-	depends on PCI && PCI_LEGACY
+	tristate "Telekom A4T card"
+	depends on PCI
 	help
 	  This enables HiSax support for the Telekom A4T card.
 
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 0b73795..5176e9d 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -15,7 +15,9 @@ obj-$(CONFIG_HISAX_ST5481)		+= hisax_st5481.o
 obj-$(CONFIG_HISAX_HFCUSB)		+= hfc_usb.o
 obj-$(CONFIG_HISAX_HFC4S8S)		+= hfc4s8s_l1.o
 obj-$(CONFIG_HISAX_FRITZ_PCIPNP)        += hisax_isac.o hisax_fcpcipnp.o
+obj-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t_pci.o libhisax.o
 
+bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 libhisax-y				:= netjet.o isac.o arcofi.o hscx.o
 
 ifdef CONFIG_HISAX_HDLC
@@ -56,7 +58,6 @@ hisax-$(CONFIG_HISAX_HFC_SX)		+= hfc_sx.o
 hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o
 hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isar.o
 hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
-hisax-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t.o jade.o
 hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
 hisax-$(CONFIG_HISAX_GAZEL)		+= gazel.o
 hisax-$(CONFIG_HISAX_W6692)		+= w6692.o
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index 9ca2ee5..71450b3 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -13,6 +13,7 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "hscx.h"
 #include "jade.h"
@@ -20,6 +21,8 @@
 #include <linux/pci.h>
 #include "bkm_ax.h"
 
+static int a4t_protocol;		/* 0 == use DEFAULT_PROTO */
+
 static const char *bkm_a4t_revision = "$Revision: 1.22.2.4 $";
 
 
@@ -255,24 +258,21 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
 
 static int __devinit a4t_pci_probe(struct pci_dev *dev_a4t,
 				   struct IsdnCardState *cs,
-				   u_int *found,
 				   u_int *pci_memaddr)
 {
-	u16 sub_sys;
-	u16 sub_vendor;
-
-	sub_vendor = dev_a4t->subsystem_vendor;
-	sub_sys = dev_a4t->subsystem_device;
-	if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
-		if (pci_enable_device(dev_a4t))
-			return (0);	/* end loop & function */
-		*found = 1;
-		*pci_memaddr = pci_resource_start(dev_a4t, 0);
-		cs->irq = dev_a4t->irq;
-		return (1);		/* end loop */
+	if (pci_enable_device(dev_a4t))
+		return (0);	/* error */
+
+	*pci_memaddr = pci_resource_start(dev_a4t, 0);
+	if (!(*pci_memaddr)) {
+		printk(KERN_WARNING "HiSax bkm_a4t: No Memory base address\n");
+		return (0);
 	}
 
-	return (-1);			/* continue looping */
+	cs->irq = dev_a4t->irq;
+
+	cs->hw.ax.dev = dev_a4t;
+	return (1);		/* success */
 }
 
 static int __devinit a4t_cs_init(struct IsdnCard *card,
@@ -323,40 +323,79 @@ static int __devinit a4t_cs_init(struct IsdnCard *card,
 	return (1);
 }
 
-static struct pci_dev *dev_a4t __devinitdata = NULL;
-
-int __devinit
+static int __devinit
 setup_bkm_a4t(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
-	u_int pci_memaddr = 0, found = 0;
+	u_int pci_memaddr = 0;
 	int ret;
+	struct pci_dev *dev_a4t = (void *) card->para[0];
 
 	strcpy(tmp, bkm_a4t_revision);
 	printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ == ISDN_CTYPE_BKM_A4T) {
-		cs->subtyp = BKM_A4T;
-	} else
-		return (0);
 
-	while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN,
-		PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) {
-		ret = a4t_pci_probe(dev_a4t, cs, &found, &pci_memaddr);
-		if (!ret)
-			return (0);
-		if (ret > 0)
-			break;
-	}
-	if (!found) {
-		printk(KERN_WARNING "HiSax: Telekom A4T: Card not found\n");
-		return (0);
-	}
-	if (!pci_memaddr) {
-		printk(KERN_WARNING "HiSax: Telekom A4T: "
-		       "No Memory base address\n");
+	WARN_ON(cs->typ != ISDN_CTYPE_BKM_A4T);
+
+	cs->subtyp = BKM_A4T;
+
+	ret = a4t_pci_probe(dev_a4t, cs, &pci_memaddr);
+	if (!ret)
 		return (0);
-	}
 
 	return a4t_cs_init(card, cs, pci_memaddr);
 }
+
+static int __devinit a4t_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_BKM_A4T, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!a4t_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = a4t_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_bkm_a4t);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id a4t_pci_table[] = {
+	{ PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120,
+	  PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_A4T, },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver a4t_pci_driver = {
+	.name		= "bkm_a4t",
+	.id_table	= a4t_pci_table,
+	.probe		= a4t_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init a4t_mod_init(void)
+{
+	return pci_register_driver(&a4t_pci_driver);
+}
+
+static void __exit a4t_mod_exit(void)
+{
+	pci_unregister_driver(&a4t_pci_driver);
+}
+
+module_init(a4t_mod_init);
+module_exit(a4t_mod_exit);
+
+module_param_named(protocol, a4t_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, a4t_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax BKM A4T PCI driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 3259639..edbad13 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -250,13 +250,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {5,0x250,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_BKM_A4T
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_BKM_A4T
-#define DEFAULT_CFG {0,0x0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_SCT_QUADRO
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -532,10 +525,6 @@ extern int setup_isurf(struct IsdnCard *card);
 extern int setup_saphir(struct IsdnCard *card);
 #endif
 
-#if CARD_BKM_A4T
-extern int setup_bkm_a4t(struct IsdnCard *card);
-#endif
-
 #if CARD_SCT_QUADRO
 extern int setup_sct_quadro(struct IsdnCard *card);
 #endif
@@ -956,11 +945,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_saphir(card);
 		break;
 #endif
-#if	CARD_BKM_A4T
-	case ISDN_CTYPE_BKM_A4T:
-		ret = setup_bkm_a4t(card);
-		break;
-#endif
 #if	CARD_SCT_QUADRO
 	case ISDN_CTYPE_SCT_QUADRO:
 		ret = setup_sct_quadro(card);
@@ -989,6 +973,14 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_DYNAMIC:
 		ret = 2;
 		break;
+
+	case ISDN_CTYPE_BKM_A4T:
+		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
+		       "to separate PCI driver module\n",
+		       CardType[card->typ]);
+		ret = 0;
+		break;
+
 	default:
 		printk(KERN_WARNING
 		       "HiSax: Support for %s Card not selected\n",
@@ -1450,8 +1442,11 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_W6692:
 		case ISDN_CTYPE_NETJET_U:
 			break;
+
+		/* the following block are excluded from std HiSax init */
 		case ISDN_CTYPE_BKM_A4T:
 			break;
+
 		case ISDN_CTYPE_SCT_QUADRO:
 			if (irq[i]) {
 				cards[j].para[0] = irq[i];
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 05/14] [ISDN] HiSax enternow: convert to PCI hotplug API
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
  2007-07-18  3:46   ` [PATCH 04/14] [ISDN] HiSax bkm_a4t: convert to PCI hotplug API Jeff Garzik
@ 2007-07-18  3:49   ` Jeff Garzik
  2007-07-18  3:54   ` [PATCH 06/14] [ISDN] HiSax hfc_pci, w6692: " Jeff Garzik
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-07-18  3:49 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig        |    4 +-
 drivers/isdn/hisax/Makefile       |    3 +-
 drivers/isdn/hisax/config.c       |   11 +----
 drivers/isdn/hisax/enternow_pci.c |   93 ++++++++++++++++++++++++++-----------
 4 files changed, 72 insertions(+), 39 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index e7808f5..2a69acc 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -340,8 +340,8 @@ config HISAX_HFC_SX
 	  cards. This code is not finished yet.
 
 config HISAX_ENTERNOW_PCI
-	bool "Formula-n enter:now PCI card"
-	depends on HISAX_NETJET && PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+	tristate "Formula-n enter:now PCI card"
+	depends on HISAX_NETJET && PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
 	help
 	  This enables HiSax support for the Formula-n enter:now PCI
 	  ISDN card.
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 5176e9d..19b4825 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -16,8 +16,10 @@ obj-$(CONFIG_HISAX_HFCUSB)		+= hfc_usb.o
 obj-$(CONFIG_HISAX_HFC4S8S)		+= hfc4s8s_l1.o
 obj-$(CONFIG_HISAX_FRITZ_PCIPNP)        += hisax_isac.o hisax_fcpcipnp.o
 obj-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t_pci.o libhisax.o
+obj-$(CONFIG_HISAX_ENTERNOW_PCI)	+= enternow.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
+enternow-y				:= enternow_pci.o amd7930_fn.o
 libhisax-y				:= netjet.o isac.o arcofi.o hscx.o
 
 ifdef CONFIG_HISAX_HDLC
@@ -61,5 +63,4 @@ hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
 hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
 hisax-$(CONFIG_HISAX_GAZEL)		+= gazel.o
 hisax-$(CONFIG_HISAX_W6692)		+= w6692.o
-hisax-$(CONFIG_HISAX_ENTERNOW_PCI)	+= enternow_pci.o amd7930_fn.o
 
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index edbad13..f259f8c 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -541,10 +541,6 @@ extern int setup_w6692(struct IsdnCard *card);
 extern int setup_netjet_u(struct IsdnCard *card);
 #endif
 
-#if CARD_FN_ENTERNOW_PCI
-extern int setup_enternow_pci(struct IsdnCard *card);
-#endif
-
 /*
  * Find card with given driverId
  */
@@ -965,16 +961,12 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_netjet_u(card);
 		break;
 #endif
-#if CARD_FN_ENTERNOW_PCI
-	case ISDN_CTYPE_ENTERNOW:
-		ret = setup_enternow_pci(card);
-		break;
-#endif
 	case ISDN_CTYPE_DYNAMIC:
 		ret = 2;
 		break;
 
 	case ISDN_CTYPE_BKM_A4T:
+	case ISDN_CTYPE_ENTERNOW:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1445,6 +1437,7 @@ static int __init HiSax_init(void)
 
 		/* the following block are excluded from std HiSax init */
 		case ISDN_CTYPE_BKM_A4T:
+		case ISDN_CTYPE_ENTERNOW:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
diff --git a/drivers/isdn/hisax/enternow_pci.c b/drivers/isdn/hisax/enternow_pci.c
index 39f421e..b37a483 100644
--- a/drivers/isdn/hisax/enternow_pci.c
+++ b/drivers/isdn/hisax/enternow_pci.c
@@ -61,6 +61,7 @@
 
 
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "isdnl1.h"
 #include "amd7930_fn.h"
@@ -70,7 +71,7 @@
 #include <linux/init.h>
 #include "netjet.h"
 
-
+static int en_protocol;		/* 0 == use DEFAULT_PROTO */
 
 static const char *enternow_pci_rev = "$Revision: 1.1.4.5 $";
 
@@ -305,6 +306,8 @@ static int __devinit en_pci_probe(struct pci_dev *dev_netjet,
 {
 	if (pci_enable_device(dev_netjet))
 		return(0);
+
+	cs->hw.njet.dev = dev_netjet;
 	cs->irq = dev_netjet->irq;
 	if (!cs->irq) {
 		printk(KERN_WARNING "enter:now PCI: No IRQ for PCI card found\n");
@@ -315,13 +318,6 @@ static int __devinit en_pci_probe(struct pci_dev *dev_netjet,
 		printk(KERN_WARNING "enter:now PCI: No IO-Adr for PCI card found\n");
 		return(0);
 	}
-	/* checks Sub-Vendor ID because system crashes with Traverse-Card */
-	if ((dev_netjet->subsystem_vendor != 0x55) ||
-	    (dev_netjet->subsystem_device != 0x02)) {
-		printk(KERN_WARNING "enter:now: You tried to load this driver with an incompatible TigerJet-card\n");
-		printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n");
-		return(0);
-	}
 
 	return(1);
 }
@@ -384,15 +380,14 @@ static int __devinit en_cs_init_rest(struct IsdnCard *card,
 	return (1);
 }
 
-static struct pci_dev *dev_netjet __devinitdata = NULL;
-
 /* called by config.c */
-int __devinit
+static int __devinit
 setup_enternow_pci(struct IsdnCard *card)
 {
 	int ret;
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
+	struct pci_dev *dev_netjet = (void *) card->para[0];
 
 #ifdef __BIG_ENDIAN
 #error "not running on big endian machines now"
@@ -400,25 +395,69 @@ setup_enternow_pci(struct IsdnCard *card)
 
         strcpy(tmp, enternow_pci_rev);
 	printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_ENTERNOW)
-		return(0);
+
+	WARN_ON(cs->typ != ISDN_CTYPE_ENTERNOW);
+
 	test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
 
-	for ( ;; )
-	{
-		if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
-			PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
-			ret = en_pci_probe(dev_netjet, cs);
-			if (!ret)
-				return(0);
-		} else {
-                        printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
-			return(0);
-		}
+	ret = en_pci_probe(dev_netjet, cs);
+	if (!ret)
+		return(0);
 
-		en_cs_init(card, cs);
-		break;
-	}
+	en_cs_init(card, cs);
 
         return en_cs_init_rest(card, cs);
 }
+
+static int __devinit en_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_ENTERNOW, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!en_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = en_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_enternow_pci);
+	if (cardnr < 0)
+		return -ENODEV;
+	
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id en_pci_table[] = {
+	{ PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, 0x55, 0x02, },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver en_pci_driver = {
+	.name		= "enternow_pci",
+	.id_table	= en_pci_table,
+	.probe		= en_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init en_mod_init(void)
+{
+	return pci_register_driver(&en_pci_driver);
+}
+
+static void __exit en_mod_exit(void)
+{
+	pci_unregister_driver(&en_pci_driver);
+}
+
+module_init(en_mod_init);
+module_exit(en_mod_exit);
+
+module_param_named(protocol, en_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, en_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax enter:now PCI driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 06/14] [ISDN] HiSax hfc_pci, w6692: convert to PCI hotplug API
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
  2007-07-18  3:46   ` [PATCH 04/14] [ISDN] HiSax bkm_a4t: convert to PCI hotplug API Jeff Garzik
  2007-07-18  3:49   ` [PATCH 05/14] [ISDN] HiSax enternow: " Jeff Garzik
@ 2007-07-18  3:54   ` Jeff Garzik
  2007-07-18  3:59   ` [PATCH 07/14] [ISDN] HiSax nj_s, nj_u: " Jeff Garzik
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-07-18  3:54 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig   |    8 +-
 drivers/isdn/hisax/Makefile  |    4 +-
 drivers/isdn/hisax/config.c  |   66 +------------------
 drivers/isdn/hisax/hfc_pci.c |  142 ++++++++++++++++++++++++++++++++----------
 drivers/isdn/hisax/w6692.c   |  111 ++++++++++++++++++++++-----------
 5 files changed, 194 insertions(+), 137 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 2a69acc..a37a616 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -315,8 +315,8 @@ config HISAX_GAZEL
 	  settings.
 
 config HISAX_HFC_PCI
-	bool "HFC PCI-Bus cards"
-	depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+	tristate "HFC PCI-Bus cards"
+	depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
 	help
 	  This enables HiSax support for the HFC-S PCI 2BDS0 based cards.
 
@@ -324,8 +324,8 @@ config HISAX_HFC_PCI
 	  <file:Documentation/isdn/README.hfc-pci>.
 
 config HISAX_W6692
-	bool "Winbond W6692 based cards"
-	depends on PCI && PCI_LEGACY
+	tristate "Winbond W6692 based cards"
+	depends on PCI
 	help
 	  This enables HiSax support for Winbond W6692 based PCI ISDN cards.
 
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 19b4825..4cfcaba 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -17,6 +17,8 @@ obj-$(CONFIG_HISAX_HFC4S8S)		+= hfc4s8s_l1.o
 obj-$(CONFIG_HISAX_FRITZ_PCIPNP)        += hisax_isac.o hisax_fcpcipnp.o
 obj-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t_pci.o libhisax.o
 obj-$(CONFIG_HISAX_ENTERNOW_PCI)	+= enternow.o libhisax.o
+obj-$(CONFIG_HISAX_HFC_PCI)		+= hfc_pci.o libhisax.o
+obj-$(CONFIG_HISAX_W6692)		+= w6692.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
@@ -55,12 +57,10 @@ hisax-$(CONFIG_HISAX_MIC)		+= mic.o
 hisax-$(CONFIG_HISAX_NETJET)		+= nj_s.o
 hisax-$(CONFIG_HISAX_NETJET_U)		+= nj_u.o icc.o
 hisax-$(CONFIG_HISAX_HFCS)		+= hfcscard.o hfc_2bds0.o
-hisax-$(CONFIG_HISAX_HFC_PCI)		+= hfc_pci.o
 hisax-$(CONFIG_HISAX_HFC_SX)		+= hfc_sx.o
 hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o
 hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isar.o
 hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
 hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
 hisax-$(CONFIG_HISAX_GAZEL)		+= gazel.o
-hisax-$(CONFIG_HISAX_W6692)		+= w6692.o
 
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index f259f8c..a70e916 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -215,13 +215,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {5,0x500,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_HFC_PCI
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_HFC_PCI
-#define DEFAULT_CFG {0,0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_HFC_SX
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -264,13 +257,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {15,0x180,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_W6692
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_W6692
-#define DEFAULT_CFG {0,0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_NETJET_U
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -505,10 +491,6 @@ extern int setup_netjet_s(struct IsdnCard *card);
 extern int setup_hfcs(struct IsdnCard *card);
 #endif
 
-#if CARD_HFC_PCI
-extern int setup_hfcpci(struct IsdnCard *card);
-#endif
-
 #if CARD_HFC_SX
 extern int setup_hfcsx(struct IsdnCard *card);
 #endif
@@ -533,10 +515,6 @@ extern int setup_sct_quadro(struct IsdnCard *card);
 extern int setup_gazel(struct IsdnCard *card);
 #endif
 
-#if CARD_W6692
-extern int setup_w6692(struct IsdnCard *card);
-#endif
-
 #if CARD_NETJET_U
 extern int setup_netjet_u(struct IsdnCard *card);
 #endif
@@ -916,11 +894,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_hfcs(card);
 		break;
 #endif
-#if CARD_HFC_PCI
-	case ISDN_CTYPE_HFC_PCI:
-		ret = setup_hfcpci(card);
-		break;
-#endif
 #if CARD_HFC_SX
 	case ISDN_CTYPE_HFC_SX:
 		ret = setup_hfcsx(card);
@@ -951,11 +924,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_gazel(card);
 		break;
 #endif
-#if CARD_W6692
-	case ISDN_CTYPE_W6692:
-		ret = setup_w6692(card);
-		break;
-#endif
 #if CARD_NETJET_U
 	case ISDN_CTYPE_NETJET_U:
 		ret = setup_netjet_u(card);
@@ -967,6 +935,8 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 
 	case ISDN_CTYPE_BKM_A4T:
 	case ISDN_CTYPE_ENTERNOW:
+	case ISDN_CTYPE_HFC_PCI:
+	case ISDN_CTYPE_W6692:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1394,7 +1364,6 @@ static int __init HiSax_init(void)
 			break;
 #endif
 		case ISDN_CTYPE_ELSA:
-		case ISDN_CTYPE_HFC_PCI:
 			cards[j].para[0] = io[i];
 			break;
 		case ISDN_CTYPE_16_3:
@@ -1431,13 +1400,14 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_ELSA_PCI:
 		case ISDN_CTYPE_NETJET_S:
 		case ISDN_CTYPE_TELESPCI:
-		case ISDN_CTYPE_W6692:
 		case ISDN_CTYPE_NETJET_U:
 			break;
 
 		/* the following block are excluded from std HiSax init */
 		case ISDN_CTYPE_BKM_A4T:
 		case ISDN_CTYPE_ENTERNOW:
+		case ISDN_CTYPE_HFC_PCI:
+		case ISDN_CTYPE_W6692:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1942,34 +1912,6 @@ static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 #if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO)
 	{PCI_VENDOR_ID_ZORAN,    PCI_DEVICE_ID_ZORAN_36120,      PCI_ANY_ID,PCI_ANY_ID},
 #endif
-#ifdef CONFIG_HISAX_W6692
-	{PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH,  PCI_ANY_ID,PCI_ANY_ID},
-	{PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692,    PCI_ANY_ID,PCI_ANY_ID},
-#endif
-#ifdef CONFIG_HISAX_HFC_PCI
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_2BD0,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B000,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B006,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B007,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B008,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B009,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00A,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00B,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00C,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B100,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B700,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B701,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_ABOCOM,   PCI_DEVICE_ID_ABOCOM_2BD1,      PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_ASUSTEK,  PCI_DEVICE_ID_ASUSTEK_0675,     PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_BERKOM,   PCI_DEVICE_ID_BERKOM_T_CONCEPT, PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_BERKOM,   PCI_DEVICE_ID_BERKOM_A1T,       PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_ANIGMA,   PCI_DEVICE_ID_ANIGMA_MC145575,  PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_ZOLTRIX,  PCI_DEVICE_ID_ZOLTRIX_2BD0,     PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_IOM2_E, PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_E,      PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_IOM2_A, PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_A,      PCI_ANY_ID, PCI_ANY_ID},
-#endif
 	{ }				/* Terminating entry */
 };
 
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index f126566..977866b 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -17,11 +17,14 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "hfc_pci.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 
+static int hfc_protocol;		/* 0 == use DEFAULT_PROTO */
+
 static const char *hfcpci_revision = "$Revision: 1.48.2.4 $";
 
 /* table entry in the PCI devices list */
@@ -1630,18 +1633,14 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
 	return (0);
 }
 
-
-/* this variable is used as card index when more than one cards are present */
-static struct pci_dev *dev_hfcpci __devinitdata = NULL;
-
-int __devinit
+static int __devinit
 setup_hfcpci(struct IsdnCard *card)
 {
 	u_long flags;
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
-	int i;
-	struct pci_dev *tmp_hfcpci = NULL;
+	struct pci_dev *dev_hfcpci = (void *) card->para[0];
+	unsigned int idx = card->para[1];
 
 #ifdef __BIG_ENDIAN
 #error "not running on big endian machines now"
@@ -1653,33 +1652,12 @@ setup_hfcpci(struct IsdnCard *card)
 	cs->hw.hfcpci.int_s1 = 0;
 	cs->dc.hfcpci.ph_state = 0;
 	cs->hw.hfcpci.fifo = 255;
-	if (cs->typ != ISDN_CTYPE_HFC_PCI)
-		return(0);
-
-	i = 0;
-	while (id_list[i].vendor_id) {
-		tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
-					     id_list[i].device_id,
-					     dev_hfcpci);
-		i++;
-		if (tmp_hfcpci) {
-			if (pci_enable_device(tmp_hfcpci))
-				continue;
-			pci_set_master(tmp_hfcpci);
-			if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
-				continue;
-			else
-				break;
-		}
-	}
+	WARN_ON(cs->typ != ISDN_CTYPE_HFC_PCI);
 
-	if (!tmp_hfcpci) {
-		printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
+	if (pci_enable_device(dev_hfcpci))
 		return (0);
-	}
+	pci_set_master(dev_hfcpci);
 
-	i--;
-	dev_hfcpci = tmp_hfcpci;	/* old device */
 	cs->hw.hfcpci.dev = dev_hfcpci;
 	cs->irq = dev_hfcpci->irq;
 	if (!cs->irq) {
@@ -1687,7 +1665,8 @@ setup_hfcpci(struct IsdnCard *card)
 		return (0);
 	}
 	cs->hw.hfcpci.pci_io = (char *)(unsigned long)dev_hfcpci->resource[1].start;
-	printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
+	printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n",
+	       id_list[idx].vendor_name, id_list[idx].card_name);
 
 	if (!cs->hw.hfcpci.pci_io) {
 		printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
@@ -1742,3 +1721,102 @@ setup_hfcpci(struct IsdnCard *card)
 
 	return (1);
 }
+
+static int __devinit hfc_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_HFC_PCI, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	icard.para[1] = ent->driver_data;
+	if (!hfc_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = hfc_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_hfcpci);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id hfc_pci_table[] = {
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_2BD0,
+	  PCI_ANY_ID, PCI_ANY_ID, 0 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B000,
+	  PCI_ANY_ID, PCI_ANY_ID, 1 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B006,
+	  PCI_ANY_ID, PCI_ANY_ID, 2 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B007,
+	  PCI_ANY_ID, PCI_ANY_ID, 3 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B008,
+	  PCI_ANY_ID, PCI_ANY_ID, 4 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B009,
+	  PCI_ANY_ID, PCI_ANY_ID, 5 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00A,
+	  PCI_ANY_ID, PCI_ANY_ID, 6 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00B,
+	  PCI_ANY_ID, PCI_ANY_ID, 7 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B00C,
+	  PCI_ANY_ID, PCI_ANY_ID, 8 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B100,
+	  PCI_ANY_ID, PCI_ANY_ID, 9 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B700,
+	  PCI_ANY_ID, PCI_ANY_ID, 10 },
+	{ PCI_VENDOR_ID_CCD,      PCI_DEVICE_ID_CCD_B701,
+	  PCI_ANY_ID, PCI_ANY_ID, 11 },
+	{ PCI_VENDOR_ID_ABOCOM,   PCI_DEVICE_ID_ABOCOM_2BD1,
+	  PCI_ANY_ID, PCI_ANY_ID, 12 },
+	{ PCI_VENDOR_ID_ASUSTEK,  PCI_DEVICE_ID_ASUSTEK_0675,
+	  PCI_ANY_ID, PCI_ANY_ID, 13 },
+	{ PCI_VENDOR_ID_BERKOM,   PCI_DEVICE_ID_BERKOM_T_CONCEPT,
+	  PCI_ANY_ID, PCI_ANY_ID, 14 },
+	{ PCI_VENDOR_ID_BERKOM,   PCI_DEVICE_ID_BERKOM_A1T,
+	  PCI_ANY_ID, PCI_ANY_ID, 15 },
+	{ PCI_VENDOR_ID_ANIGMA,   PCI_DEVICE_ID_ANIGMA_MC145575,
+	  PCI_ANY_ID, PCI_ANY_ID, 16 },
+	{ PCI_VENDOR_ID_ZOLTRIX,  PCI_DEVICE_ID_ZOLTRIX_2BD0,
+	  PCI_ANY_ID, PCI_ANY_ID, 17 },
+	{ PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_IOM2_E,
+	  PCI_ANY_ID, PCI_ANY_ID, 18 },
+	{ PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_E,
+	  PCI_ANY_ID, PCI_ANY_ID, 19 },
+	{ PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_IOM2_A,
+	  PCI_ANY_ID, PCI_ANY_ID, 20 },
+	{ PCI_VENDOR_ID_DIGI,     PCI_DEVICE_ID_DIGI_DF_M_A,
+	  PCI_ANY_ID, PCI_ANY_ID, 21 },
+	{ PCI_VENDOR_ID_SITECOM, PCI_DEVICE_ID_SITECOM_DC105V2,
+	  PCI_ANY_ID, PCI_ANY_ID, 22 },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver hfc_pci_driver = {
+	.name		= "hfc_pci",
+	.id_table	= hfc_pci_table,
+	.probe		= hfc_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init hfc_mod_init(void)
+{
+	return pci_register_driver(&hfc_pci_driver);
+}
+
+static void __exit hfc_mod_exit(void)
+{
+	pci_unregister_driver(&hfc_pci_driver);
+}
+
+module_init(hfc_mod_init);
+module_exit(hfc_mod_exit);
+
+module_param_named(protocol, hfc_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, hfc_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax HFC PCI driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c
index bb1c8dd..b3cef62 100644
--- a/drivers/isdn/hisax/w6692.c
+++ b/drivers/isdn/hisax/w6692.c
@@ -12,11 +12,14 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "w6692.h"
 #include "isdnl1.h"
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 
+static int w6692_protocol;		/* 0 == use DEFAULT_PROTO */
+
 /* table entry in the PCI devices list */
 typedef struct {
 	int vendor_id;
@@ -990,54 +993,29 @@ w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg)
 	return (0);
 }
 
-static int id_idx ;
-
-static struct pci_dev *dev_w6692 __devinitdata = NULL;
-
-int __devinit
+static int __devinit
 setup_w6692(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
-	u_char found = 0;
 	u_char pci_irq = 0;
 	u_int pci_ioaddr = 0;
+	struct pci_dev *dev_w6692 = (void *) card->para[0];
 
 	strcpy(tmp, w6692_revision);
 	printk(KERN_INFO "HiSax: W6692 driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_W6692)
-		return (0);
+	WARN_ON(cs->typ != ISDN_CTYPE_W6692);
 
-	while (id_list[id_idx].vendor_id) {
-		dev_w6692 = pci_find_device(id_list[id_idx].vendor_id,
-					    id_list[id_idx].device_id,
-					    dev_w6692);
-		if (dev_w6692) {
-			if (pci_enable_device(dev_w6692))
-				continue;
-			cs->subtyp = id_idx;
-			break;
-		}
-		id_idx++;
-	}
-	if (dev_w6692) {
-		found = 1;
-		pci_irq = dev_w6692->irq;
-		/* I think address 0 is allways the configuration area */
-		/* and address 1 is the real IO space KKe 03.09.99 */
-		pci_ioaddr = pci_resource_start(dev_w6692, 1);
-		/* USR ISDN PCI card TA need some special handling */
-		if (cs->subtyp == W6692_WINBOND) {
-			if ((W6692_SV_USR == dev_w6692->subsystem_vendor) &&
-			    (W6692_SD_USR == dev_w6692->subsystem_device)) {
-				cs->subtyp = W6692_USR;
-			}
-		}
-	}
-	if (!found) {
-		printk(KERN_WARNING "W6692: No PCI card found\n");
+	if (pci_enable_device(dev_w6692))
 		return (0);
-	}
+
+	cs->subtyp = card->para[1];
+
+	pci_irq = dev_w6692->irq;
+	/* I think address 0 is allways the configuration area */
+	/* and address 1 is the real IO space KKe 03.09.99 */
+	pci_ioaddr = pci_resource_start(dev_w6692, 1);
+
 	cs->irq = pci_irq;
 	if (!cs->irq) {
 		printk(KERN_WARNING "W6692: No IRQ for PCI card found\n");
@@ -1084,3 +1062,62 @@ setup_w6692(struct IsdnCard *card)
 	printk(KERN_INFO "W6692 D_RSTA=0x%X\n", ReadW6692(cs, W_D_RSTA));
 	return (1);
 }
+
+static int __devinit w6692_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_W6692, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	icard.para[1] = ent->driver_data;
+	if (!w6692_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = w6692_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_w6692);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id w6692_pci_table[] = {
+	{ PCI_VENDOR_ID_DYNALINK, PCI_DEVICE_ID_DYNALINK_IS64PH,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, W6692_DYNALINK },
+	{ PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692,
+	  W6692_SV_USR, W6692_SD_USR, 0, 0, W6692_USR },
+	{ PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_6692,
+	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, W6692_WINBOND },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver w6692_pci_driver = {
+	.name		= "w6692",
+	.id_table	= w6692_pci_table,
+	.probe		= w6692_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init w6692_mod_init(void)
+{
+	return pci_register_driver(&w6692_pci_driver);
+}
+
+static void __exit w6692_mod_exit(void)
+{
+	pci_unregister_driver(&w6692_pci_driver);
+}
+
+module_init(w6692_mod_init);
+module_exit(w6692_mod_exit);
+
+module_param_named(protocol, w6692_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, w6692_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax W6692 PCI driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 07/14] [ISDN] HiSax nj_s, nj_u: convert to PCI hotplug API
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (2 preceding siblings ...)
  2007-07-18  3:54   ` [PATCH 06/14] [ISDN] HiSax hfc_pci, w6692: " Jeff Garzik
@ 2007-07-18  3:59   ` Jeff Garzik
  2007-07-18  4:02   ` [PATCH 08/14] [ISDN] HiSax telespci: " Jeff Garzik
                     ` (8 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-07-18  3:59 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig  |    8 ++--
 drivers/isdn/hisax/Makefile |    6 ++-
 drivers/isdn/hisax/config.c |   41 ++----------------
 drivers/isdn/hisax/nj_s.c   |  100 +++++++++++++++++++++++++++++++------------
 drivers/isdn/hisax/nj_u.c   |   99 +++++++++++++++++++++++++++++++-----------
 5 files changed, 158 insertions(+), 96 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index a37a616..508bc2b 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -236,8 +236,8 @@ config HISAX_MIC
 	  settings.
 
 config HISAX_NETJET
-	bool "NETjet card"
-	depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+	tristate "NETjet card"
+	depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
 	help
 	  This enables HiSax support for the NetJet from Traverse
 	  Technologies.
@@ -247,8 +247,8 @@ config HISAX_NETJET
 	  settings.
 
 config HISAX_NETJET_U
-	bool "NETspider U card"
-	depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+	tristate "NETspider U card"
+	depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
 	help
 	  This enables HiSax support for the Netspider U interface ISDN card
 	  from Traverse Technologies.
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 4cfcaba..07aaba5 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -19,9 +19,13 @@ obj-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t_pci.o libhisax.o
 obj-$(CONFIG_HISAX_ENTERNOW_PCI)	+= enternow.o libhisax.o
 obj-$(CONFIG_HISAX_HFC_PCI)		+= hfc_pci.o libhisax.o
 obj-$(CONFIG_HISAX_W6692)		+= w6692.o libhisax.o
+obj-$(CONFIG_HISAX_NETJET)		+= netjet_s.o libhisax.o
+obj-$(CONFIG_HISAX_NETJET_U)		+= netjet_u.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
+netjet_s-y				:= nj_s.o
+netjet_u-y				:= nj_u.o icc.o
 libhisax-y				:= netjet.o isac.o arcofi.o hscx.o
 
 ifdef CONFIG_HISAX_HDLC
@@ -54,8 +58,6 @@ hisax-$(CONFIG_HISAX_TELEINT)		+= teleint.o hfc_2bs0.o
 hisax-$(CONFIG_HISAX_SEDLBAUER)		+= sedlbauer.o isar.o
 hisax-$(CONFIG_HISAX_SPORTSTER)		+= sportster.o
 hisax-$(CONFIG_HISAX_MIC)		+= mic.o
-hisax-$(CONFIG_HISAX_NETJET)		+= nj_s.o
-hisax-$(CONFIG_HISAX_NETJET_U)		+= nj_u.o icc.o
 hisax-$(CONFIG_HISAX_HFCS)		+= hfcscard.o hfc_2bds0.o
 hisax-$(CONFIG_HISAX_HFC_SX)		+= hfc_sx.o
 hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index a70e916..f35ceea 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -201,13 +201,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {12,0x3e0,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_NETJET
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_NETJET_S
-#define DEFAULT_CFG {0,0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_HFCS
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -257,13 +250,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {15,0x180,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_NETJET_U
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_NETJET_U
-#define DEFAULT_CFG {0,0,0,0}
-#endif
-
 #ifndef DEFAULT_CARD
 #define DEFAULT_CARD 0
 #define DEFAULT_CFG {0,0,0,0}
@@ -483,10 +469,6 @@ extern int setup_sportster(struct IsdnCard *card);
 extern int setup_mic(struct IsdnCard *card);
 #endif
 
-#if CARD_NETJET_S
-extern int setup_netjet_s(struct IsdnCard *card);
-#endif
-
 #if CARD_HFCS
 extern int setup_hfcs(struct IsdnCard *card);
 #endif
@@ -515,10 +497,6 @@ extern int setup_sct_quadro(struct IsdnCard *card);
 extern int setup_gazel(struct IsdnCard *card);
 #endif
 
-#if CARD_NETJET_U
-extern int setup_netjet_u(struct IsdnCard *card);
-#endif
-
 /*
  * Find card with given driverId
  */
@@ -883,11 +861,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_mic(card);
 		break;
 #endif
-#if CARD_NETJET_S
-	case ISDN_CTYPE_NETJET_S:
-		ret = setup_netjet_s(card);
-		break;
-#endif
 #if CARD_HFCS
 	case ISDN_CTYPE_TELES3C:
 	case ISDN_CTYPE_ACERP10:
@@ -924,11 +897,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_gazel(card);
 		break;
 #endif
-#if CARD_NETJET_U
-	case ISDN_CTYPE_NETJET_U:
-		ret = setup_netjet_u(card);
-		break;
-#endif
 	case ISDN_CTYPE_DYNAMIC:
 		ret = 2;
 		break;
@@ -937,6 +905,8 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_ENTERNOW:
 	case ISDN_CTYPE_HFC_PCI:
 	case ISDN_CTYPE_W6692:
+	case ISDN_CTYPE_NETJET_S:
+	case ISDN_CTYPE_NETJET_U:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1398,9 +1368,7 @@ static int __init HiSax_init(void)
 			cards[j].para[2] = mem[i];
 			break;
 		case ISDN_CTYPE_ELSA_PCI:
-		case ISDN_CTYPE_NETJET_S:
 		case ISDN_CTYPE_TELESPCI:
-		case ISDN_CTYPE_NETJET_U:
 			break;
 
 		/* the following block are excluded from std HiSax init */
@@ -1408,6 +1376,8 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_ENTERNOW:
 		case ISDN_CTYPE_HFC_PCI:
 		case ISDN_CTYPE_W6692:
+		case ISDN_CTYPE_NETJET_S:
+		case ISDN_CTYPE_NETJET_U:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1906,9 +1876,6 @@ static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 #ifdef CONFIG_HISAX_SEDLBAUER
 	{PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100,     PCI_ANY_ID,PCI_ANY_ID},
 #endif
-#if defined(CONFIG_HISAX_NETJET) || defined(CONFIG_HISAX_NETJET_U)
-	{PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300,     PCI_ANY_ID,PCI_ANY_ID},
-#endif
 #if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO)
 	{PCI_VENDOR_ID_ZORAN,    PCI_DEVICE_ID_ZORAN_36120,      PCI_ANY_ID,PCI_ANY_ID},
 #endif
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index 8d36ccc..248ade2 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -7,6 +7,7 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
@@ -14,6 +15,8 @@
 #include <linux/ppp_defs.h>
 #include "netjet.h"
 
+static int njs_protocol;		/* 0 == use DEFAULT_PROTO */
+
 static const char *NETjet_S_revision = "$Revision: 2.13.2.4 $";
 
 static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
@@ -156,6 +159,8 @@ static int __devinit njs_pci_probe(struct pci_dev *dev_netjet,
 	if (pci_enable_device(dev_netjet))
 		return(0);
 	pci_set_master(dev_netjet);
+
+	cs->hw.njet.dev = dev_netjet;
 	cs->irq = dev_netjet->irq;
 	if (!cs->irq) {
 		printk(KERN_WARNING "NETjet-S: No IRQ for PCI card found\n");
@@ -212,17 +217,17 @@ static int __devinit njs_cs_init(struct IsdnCard *card,
 	switch ( ( ( NETjet_ReadIC( cs, ISAC_RBCH ) >> 5 ) & 3 ) )
 	{
 		case 0 :
-			return 1;	/* end loop */
+			return 1;	/* found card */
 
 		case 3 :
 			printk( KERN_WARNING "NETjet-S: NETspider-U PCI card found\n" );
-			return -1;	/* continue looping */
+			return 0;	/* no NETjet-S found */
 
 		default :
 			printk( KERN_WARNING "NETjet-S: No PCI card found\n" );
-			return 0;	/* end loop & function */
+			return 0;	/* no NETjet-S found */
 	}
-	return 1;			/* end loop */
+	return 1;			/* found card */
 }
 
 static int __devinit njs_cs_init_rest(struct IsdnCard *card,
@@ -256,43 +261,84 @@ static int __devinit njs_cs_init_rest(struct IsdnCard *card,
 	return (1);
 }
 
-static struct pci_dev *dev_netjet __devinitdata = NULL;
-
-int __devinit
+static int __devinit
 setup_netjet_s(struct IsdnCard *card)
 {
 	int ret;
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
+	struct pci_dev *dev_netjet = (void *) card->para[0];
 
 #ifdef __BIG_ENDIAN
 #error "not running on big endian machines now"
 #endif
 	strcpy(tmp, NETjet_S_revision);
 	printk(KERN_INFO "HiSax: Traverse Tech. NETjet-S driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_NETJET_S)
-		return(0);
+
+	WARN_ON(cs->typ != ISDN_CTYPE_NETJET_S);
+
 	test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
 
-	for ( ;; )
-	{
-		if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
-			PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
-			ret = njs_pci_probe(dev_netjet, cs);
-			if (!ret)
-				return(0);
-		} else {
-			printk(KERN_WARNING "NETjet-S: No PCI card found\n");
-			return(0);
-		}
+	ret = njs_pci_probe(dev_netjet, cs);
+	if (!ret)
+		return(0);
 
-		ret = njs_cs_init(card, cs);
-		if (!ret)
-			return(0);
-		if (ret > 0)
-			break;
-		/* otherwise, ret < 0, continue looping */
-	}
+	ret = njs_cs_init(card, cs);
+	if (ret <= 0)
+		return(0);
 
 	return njs_cs_init_rest(card, cs);
 }
+
+static int __devinit njs_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_NETJET_S, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!njs_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = njs_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_netjet_s);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id njs_pci_table[] = {
+	{ PCI_VDEVICE(TIGERJET, PCI_DEVICE_ID_TIGERJET_300) },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver njs_pci_driver = {
+	.name		= "nj_s",
+	.id_table	= njs_pci_table,
+	.probe		= njs_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init njs_mod_init(void)
+{
+	return pci_register_driver(&njs_pci_driver);
+}
+
+static void __exit njs_mod_exit(void)
+{
+	pci_unregister_driver(&njs_pci_driver);
+}
+
+module_init(njs_mod_init);
+module_exit(njs_mod_exit);
+
+module_param_named(protocol, njs_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, njs_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax NETjet-S PCI driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c
index d306c94..b1917d2 100644
--- a/drivers/isdn/hisax/nj_u.c
+++ b/drivers/isdn/hisax/nj_u.c
@@ -7,6 +7,7 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "icc.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
@@ -14,6 +15,8 @@
 #include <linux/ppp_defs.h>
 #include "netjet.h"
 
+static int nju_protocol;	/* 0 == use DEFAULT_PROTO */
+
 static const char *NETjet_U_revision = "$Revision: 2.14.2.3 $";
 
 static u_char dummyrr(struct IsdnCardState *cs, int chan, u_char off)
@@ -133,7 +136,10 @@ static int __devinit nju_pci_probe(struct pci_dev *dev_netjet,
 {
 	if (pci_enable_device(dev_netjet))
 		return(0);
+
 	pci_set_master(dev_netjet);
+
+	cs->hw.njet.dev = dev_netjet;
 	cs->irq = dev_netjet->irq;
 	if (!cs->irq) {
 		printk(KERN_WARNING "NETspider-U: No IRQ for PCI card found\n");
@@ -174,17 +180,17 @@ static int __devinit nju_cs_init(struct IsdnCard *card,
 	switch ( ( ( NETjet_ReadIC( cs, ICC_RBCH ) >> 5 ) & 3 ) )
 	{
 		case 3 :
-			return 1;	/* end loop */
+			return 1;	/* found card */
 
 		case 0 :
 			printk( KERN_WARNING "NETspider-U: NETjet-S PCI card found\n" );
-			return -1;	/* continue looping */
+			return 0;	/* no NETjet-U found */
 
 		default :
 			printk( KERN_WARNING "NETspider-U: No PCI card found\n" );
-			return 0;	/* end loop & function */
+			return 0;	/* no NETjet-U found */
 	}
-	return 1;			/* end loop */
+	return 1;			/* found card */
 }
 
 static int __devinit nju_cs_init_rest(struct IsdnCard *card,
@@ -219,14 +225,14 @@ static int __devinit nju_cs_init_rest(struct IsdnCard *card,
 	return (1);
 }
 
-static struct pci_dev *dev_netjet __devinitdata = NULL;
 
-int __devinit
+static int __devinit
 setup_netjet_u(struct IsdnCard *card)
 {
 	int ret;
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
+	struct pci_dev *dev_netjet = (void *) card->para[0];
 
 #ifdef __BIG_ENDIAN
 #error "not running on big endian machines now"
@@ -234,29 +240,70 @@ setup_netjet_u(struct IsdnCard *card)
 
 	strcpy(tmp, NETjet_U_revision);
 	printk(KERN_INFO "HiSax: Traverse Tech. NETspider-U driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_NETJET_U)
-		return(0);
+
+	WARN_ON(cs->typ != ISDN_CTYPE_NETJET_U);
+
 	test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
 
-	for ( ;; )
-	{
-		if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
-			PCI_DEVICE_ID_TIGERJET_300,  dev_netjet))) {
-			ret = nju_pci_probe(dev_netjet, cs);
-			if (!ret)
-				return(0);
-		} else {
-			printk(KERN_WARNING "NETspider-U: No PCI card found\n");
-			return(0);
-		}
+	ret = nju_pci_probe(dev_netjet, cs);
+	if (!ret)
 
-		ret = nju_cs_init(card, cs);
-		if (!ret)
-			return (0);
-		if (ret > 0)
-			break;
-		/* ret < 0 == continue looping */
-	}
+	ret = nju_cs_init(card, cs);
+	if (!ret)
+		return (0);
 
 	return nju_cs_init_rest(card, cs);
 }
+
+static int __devinit nju_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_NETJET_U, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!nju_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = nju_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_netjet_u);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id nju_pci_table[] = {
+	{ PCI_VDEVICE(TIGERJET, PCI_DEVICE_ID_TIGERJET_300) },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver nju_pci_driver = {
+	.name		= "nj_u",
+	.id_table	= nju_pci_table,
+	.probe		= nju_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init nju_mod_init(void)
+{
+	return pci_register_driver(&nju_pci_driver);
+}
+
+static void __exit nju_mod_exit(void)
+{
+	pci_unregister_driver(&nju_pci_driver);
+}
+
+module_init(nju_mod_init);
+module_exit(nju_mod_exit);
+
+module_param_named(protocol, nju_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, nju_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax NETjet-U PCI driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 08/14] [ISDN] HiSax telespci: convert to PCI hotplug API
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (3 preceding siblings ...)
  2007-07-18  3:59   ` [PATCH 07/14] [ISDN] HiSax nj_s, nj_u: " Jeff Garzik
@ 2007-07-18  4:02   ` Jeff Garzik
  2007-07-24 12:26   ` [PATCH 11/14] [ISDN] HiSax niccy: convert to modern ISA/PNP/PCI probing Jeff Garzik
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-07-18  4:02 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig    |    4 +-
 drivers/isdn/hisax/Makefile   |    2 +-
 drivers/isdn/hisax/config.c   |   21 +--------
 drivers/isdn/hisax/telespci.c |   95 ++++++++++++++++++++++++++++++++---------
 4 files changed, 81 insertions(+), 41 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 508bc2b..4f98afb 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -108,8 +108,8 @@ config HISAX_16_3
 	  non-standard IRQ/port settings.
 
 config HISAX_TELESPCI
-	bool "Teles PCI"
-	depends on PCI && PCI_LEGACY && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
+	tristate "Teles PCI"
+	depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K || (MIPS && !CPU_LITTLE_ENDIAN) || FRV))
 	help
 	  This enables HiSax support for the Teles PCI.
 	  See <file:Documentation/isdn/README.HiSax> on how to configure it.
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 07aaba5..beb2c24 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_HISAX_HFC_PCI)		+= hfc_pci.o libhisax.o
 obj-$(CONFIG_HISAX_W6692)		+= w6692.o libhisax.o
 obj-$(CONFIG_HISAX_NETJET)		+= netjet_s.o libhisax.o
 obj-$(CONFIG_HISAX_NETJET_U)		+= netjet_u.o libhisax.o
+obj-$(CONFIG_HISAX_TELESPCI)		+= telespci.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
@@ -45,7 +46,6 @@ hisax-$(CONFIG_HISAX_1TR6)		+= l3_1tr6.o
 
 hisax-$(CONFIG_HISAX_16_0)		+= teles0.o
 hisax-$(CONFIG_HISAX_16_3)		+= teles3.o
-hisax-$(CONFIG_HISAX_TELESPCI)		+= telespci.o
 hisax-$(CONFIG_HISAX_S0BOX)		+= s0box.o
 hisax-$(CONFIG_HISAX_AVM_A1)		+= avm_a1.o
 hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA)	+= avm_a1p.o
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index f35ceea..1df8c08 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -145,13 +145,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {15,0xd0000,0xd80,0}
 #endif
 
-#ifdef CONFIG_HISAX_TELESPCI
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_TELESPCI
-#define DEFAULT_CFG {0,0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_IX1MICROR2
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -421,10 +414,6 @@ extern int setup_teles3(struct IsdnCard *card);
 extern int setup_s0box(struct IsdnCard *card);
 #endif
 
-#if CARD_TELESPCI
-extern int setup_telespci(struct IsdnCard *card);
-#endif
-
 #if CARD_AVM_A1
 extern int setup_avm_a1(struct IsdnCard *card);
 #endif
@@ -796,11 +785,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_s0box(card);
 		break;
 #endif
-#if CARD_TELESPCI
-	case ISDN_CTYPE_TELESPCI:
-		ret = setup_telespci(card);
-		break;
-#endif
 #if CARD_AVM_A1
 	case ISDN_CTYPE_A1:
 		ret = setup_avm_a1(card);
@@ -907,6 +891,7 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_W6692:
 	case ISDN_CTYPE_NETJET_S:
 	case ISDN_CTYPE_NETJET_U:
+	case ISDN_CTYPE_TELESPCI:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1368,7 +1353,6 @@ static int __init HiSax_init(void)
 			cards[j].para[2] = mem[i];
 			break;
 		case ISDN_CTYPE_ELSA_PCI:
-		case ISDN_CTYPE_TELESPCI:
 			break;
 
 		/* the following block are excluded from std HiSax init */
@@ -1378,6 +1362,7 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_W6692:
 		case ISDN_CTYPE_NETJET_S:
 		case ISDN_CTYPE_NETJET_U:
+		case ISDN_CTYPE_TELESPCI:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1876,7 +1861,7 @@ static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 #ifdef CONFIG_HISAX_SEDLBAUER
 	{PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100,     PCI_ANY_ID,PCI_ANY_ID},
 #endif
-#if defined(CONFIG_HISAX_TELESPCI) || defined(CONFIG_HISAX_SCT_QUADRO)
+#if defined(CONFIG_HISAX_SCT_QUADRO)
 	{PCI_VENDOR_ID_ZORAN,    PCI_DEVICE_ID_ZORAN_36120,      PCI_ANY_ID,PCI_ANY_ID},
 #endif
 	{ }				/* Terminating entry */
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c
index 28b08de..fba6c78 100644
--- a/drivers/isdn/hisax/telespci.c
+++ b/drivers/isdn/hisax/telespci.c
@@ -14,11 +14,14 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "hscx.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
 
+static int teles_protocol;		/* 0 == use DEFAULT_PROTO */
+
 static const char *telespci_revision = "$Revision: 2.23.2.3 $";
 
 #define ZORAN_PO_RQ_PEN	0x02000000
@@ -283,12 +286,11 @@ TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg)
 	return(0);
 }
 
-static struct pci_dev *dev_tel __devinitdata = NULL;
-
-int __devinit
+static int __devinit
 setup_telespci(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
+	struct pci_dev *dev_tel = (void *) card->para[0];
 	char tmp[64];
 
 #ifdef __BIG_ENDIAN
@@ -297,26 +299,24 @@ setup_telespci(struct IsdnCard *card)
 
 	strcpy(tmp, telespci_revision);
 	printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_TELESPCI)
-		return (0);
+	WARN_ON(cs->typ != ISDN_CTYPE_TELESPCI);
 
-	if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
-		if (pci_enable_device(dev_tel))
-			return(0);
-		cs->irq = dev_tel->irq;
-		if (!cs->irq) {
-			printk(KERN_WARNING "Teles: No IRQ for PCI card found\n");
-			return(0);
-		}
-		cs->hw.teles0.membase = ioremap(pci_resource_start(dev_tel, 0),
-			PAGE_SIZE);
-		printk(KERN_INFO "Found: Zoran, base-address: 0x%llx, irq: 0x%x\n",
-			(unsigned long long)pci_resource_start(dev_tel, 0),
-			dev_tel->irq);
-	} else {
-		printk(KERN_WARNING "TelesPCI: No PCI card found\n");
+	if (pci_enable_device(dev_tel))
+		return(0);
+	cs->irq = dev_tel->irq;
+	if (!cs->irq) {
+		printk(KERN_WARNING "Teles: No IRQ for PCI card found\n");
 		return(0);
 	}
+	cs->hw.teles0.membase = ioremap(pci_resource_start(dev_tel, 0),
+		PAGE_SIZE);
+	if (!cs->hw.teles0.membase) {
+		printk(KERN_WARNING "Teles: ioremap failed\n");
+		return(0);
+	}
+	printk(KERN_INFO "Found: Zoran, base-address: 0x%llx, irq: 0x%x\n",
+		(unsigned long long)pci_resource_start(dev_tel, 0),
+		dev_tel->irq);
 
 	/* Initialize Zoran PCI controller */
 	writel(0x00000000, cs->hw.teles0.membase + 0x28);
@@ -352,3 +352,58 @@ setup_telespci(struct IsdnCard *card)
 	}
 	return (1);
 }
+
+static int __devinit teles_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_TELESPCI, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	icard.para[1] = ent->driver_data;
+	if (!teles_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = teles_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, setup_telespci);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id teles_pci_table[] = {
+	{ PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120,
+	  PCI_ANY_ID, PCI_ANY_ID, },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver teles_pci_driver = {
+	.name		= "telespci",
+	.id_table	= teles_pci_table,
+	.probe		= teles_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+static int __init teles_mod_init(void)
+{
+	return pci_register_driver(&teles_pci_driver);
+}
+
+static void __exit teles_mod_exit(void)
+{
+	pci_unregister_driver(&teles_pci_driver);
+}
+
+module_init(teles_mod_init);
+module_exit(teles_mod_exit);
+
+module_param_named(protocol, teles_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, teles_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax Teles PCI driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 11/14] [ISDN] HiSax niccy: convert to modern ISA/PNP/PCI probing
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (4 preceding siblings ...)
  2007-07-18  4:02   ` [PATCH 08/14] [ISDN] HiSax telespci: " Jeff Garzik
@ 2007-07-24 12:26   ` Jeff Garzik
  2007-08-02 12:37   ` [PATCH 14/14] [ISDN] HiSax bkm_a8: convert to PCI hotplug API Jeff Garzik
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-07-24 12:26 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig  |    3 +-
 drivers/isdn/hisax/Makefile |    2 +-
 drivers/isdn/hisax/config.c |   26 +---
 drivers/isdn/hisax/niccy.c  |  460 +++++++++++++++++++++++++++++++------------
 4 files changed, 334 insertions(+), 157 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index dbc296e..02cdc57 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -257,7 +257,8 @@ config HISAX_NETJET_U
 	  settings.
 
 config HISAX_NICCY
-	bool "Niccy PnP/PCI card"
+	tristate "Niccy PnP/PCI card"
+	depends on (ISA || PCI)
 	help
 	  This enables HiSax support for the Dr. Neuhaus Niccy PnP or PCI.
 
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 10ab294..9efd189 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_HISAX_NETJET_U)		+= netjet_u.o libhisax.o
 obj-$(CONFIG_HISAX_TELESPCI)		+= telespci.o libhisax.o
 obj-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o libhisax.o
 obj-$(CONFIG_HISAX_GAZEL)		+= gazel.o libhisax.o
+obj-$(CONFIG_HISAX_NICCY)		+= niccy.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
@@ -61,7 +62,6 @@ hisax-$(CONFIG_HISAX_SPORTSTER)		+= sportster.o
 hisax-$(CONFIG_HISAX_MIC)		+= mic.o
 hisax-$(CONFIG_HISAX_HFCS)		+= hfcscard.o hfc_2bds0.o
 hisax-$(CONFIG_HISAX_HFC_SX)		+= hfc_sx.o
-hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o
 hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isar.o
 hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
 hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 63dba42..243c7c9 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -201,13 +201,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {5,0x2E0,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_NICCY
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_NICCY
-#define DEFAULT_CFG {0,0x0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_ISURF
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -258,10 +251,6 @@ static int io[HISAX_MAX_CARDS] = { 0, };
 #ifdef CONFIG_HISAX_16_3
 #define IO0_IO1
 #endif
-#ifdef CONFIG_HISAX_NICCY
-#undef IO0_IO1
-#define IO0_IO1
-#endif
 #ifdef IO0_IO1
 static int io0[HISAX_MAX_CARDS] __devinitdata = { 0, };
 static int io1[HISAX_MAX_CARDS] __devinitdata = { 0, };
@@ -448,10 +437,6 @@ extern int setup_hfcs(struct IsdnCard *card);
 extern int setup_hfcsx(struct IsdnCard *card);
 #endif
 
-#if CARD_NICCY
-extern int setup_niccy(struct IsdnCard *card);
-#endif
-
 #if CARD_ISURF
 extern int setup_isurf(struct IsdnCard *card);
 #endif
@@ -829,11 +814,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_hfcsx(card);
 		break;
 #endif
-#if CARD_NICCY
-	case ISDN_CTYPE_NICCY:
-		ret = setup_niccy(card);
-		break;
-#endif
 #if CARD_ISURF
 	case ISDN_CTYPE_ISURF:
 		ret = setup_isurf(card);
@@ -862,6 +842,7 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_TELESPCI:
 	case ISDN_CTYPE_FRITZPCI:
 	case ISDN_CTYPE_GAZEL:
+	case ISDN_CTYPE_NICCY:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1276,7 +1257,6 @@ static int __init HiSax_init(void)
 
 #ifdef IO0_IO1
 		case ISDN_CTYPE_PNP:
-		case ISDN_CTYPE_NICCY:
 			cards[j].para[0] = irq[i];
 			cards[j].para[1] = io0[i];
 			cards[j].para[2] = io1[i];
@@ -1333,6 +1313,7 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_TELESPCI:
 		case ISDN_CTYPE_FRITZPCI:
 		case ISDN_CTYPE_GAZEL:
+		case ISDN_CTYPE_NICCY:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1816,9 +1797,6 @@ static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 #ifdef CONFIG_HISAX_SCT_QUADRO
 	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_9050,         PCI_ANY_ID, PCI_ANY_ID},
 #endif
-#ifdef CONFIG_HISAX_NICCY
-	{PCI_VENDOR_ID_SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY,   PCI_ANY_ID,PCI_ANY_ID},
-#endif
 #ifdef CONFIG_HISAX_SEDLBAUER
 	{PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100,     PCI_ANY_ID,PCI_ANY_ID},
 #endif
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index 421b8e6..ef48515 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -15,11 +15,21 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "hscx.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
-#include <linux/isapnp.h>
+#include <linux/pnp.h>
+#include <linux/isa.h>
+
+static int niccy_protocol;		/* 0 == use DEFAULT_PROTO */
+
+#ifdef CONFIG_ISA
+static int niccy_base0;
+static int niccy_base1;
+static int niccy_irq;
+#endif /* CONFIG_ISA */
 
 static const char *niccy_revision = "$Revision: 1.21.2.4 $";
 
@@ -222,142 +232,18 @@ static int niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
 	return 0;
 }
 
-#ifdef __ISAPNP__
-static struct pnp_card *pnp_c __devinitdata = NULL;
-#endif
-
-int __devinit setup_niccy(struct IsdnCard *card)
+static int __devinit setup_niccy(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
 
 	strcpy(tmp, niccy_revision);
 	printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_NICCY)
-		return 0;
-#ifdef __ISAPNP__
-	if (!card->para[1] && isapnp_present()) {
-		struct pnp_dev *pnp_d = NULL;
-		int err;
-
-		pnp_c = pnp_find_card(ISAPNP_VENDOR('S', 'D', 'A'),
-				ISAPNP_FUNCTION(0x0150), pnp_c);
-		if (pnp_c) {
-			pnp_d = pnp_find_dev(pnp_c,
-					ISAPNP_VENDOR('S', 'D', 'A'),
-					ISAPNP_FUNCTION(0x0150), pnp_d);
-			if (!pnp_d) {
-				printk(KERN_ERR "NiccyPnP: PnP error card "
-					"found, no device\n");
-				return 0;
-			}
-			pnp_disable_dev(pnp_d);
-			err = pnp_activate_dev(pnp_d);
-			if (err < 0) {
-				printk(KERN_WARNING "%s: pnp_activate_dev "
-					"ret(%d)\n", __FUNCTION__, err);
-				return 0;
-			}
-			card->para[1] = pnp_port_start(pnp_d, 0);
-			card->para[2] = pnp_port_start(pnp_d, 1);
-			card->para[0] = pnp_irq(pnp_d, 0);
-			if (!card->para[0] || !card->para[1] ||
-					!card->para[2]) {
-				printk(KERN_ERR "NiccyPnP:some resources are "
-					"missing %ld/%lx/%lx\n",
-					card->para[0], card->para[1],
-					card->para[2]);
-				pnp_disable_dev(pnp_d);
-				return 0;
-			}
-		} else
-			printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
-	}
-#endif
-	if (card->para[1]) {
-		cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
-		cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
-		cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP;
-		cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP;
-		cs->hw.niccy.cfg_reg = 0;
-		cs->subtyp = NICCY_PNP;
-		cs->irq = card->para[0];
-		if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
-			printk(KERN_WARNING "HiSax: NICCY data port %x-%x "
-				"already in use\n",
-				cs->hw.niccy.isac, cs->hw.niccy.isac + 1);
-			return 0;
-		}
-		if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
-			printk(KERN_WARNING "HiSax: NICCY address port %x-%x "
-				"already in use\n",
-				cs->hw.niccy.isac_ale,
-				cs->hw.niccy.isac_ale + 1);
-			release_region(cs->hw.niccy.isac, 2);
-			return 0;
-		}
-	} else {
-#ifdef CONFIG_PCI_LEGACY
-		static struct pci_dev *niccy_dev __devinitdata;
-
-		u_int pci_ioaddr;
-		cs->subtyp = 0;
-		if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
-						 PCI_DEVICE_ID_SATSAGEM_NICCY,
-						 niccy_dev))) {
-			if (pci_enable_device(niccy_dev))
-				return 0;
-			/* get IRQ */
-			if (!niccy_dev->irq) {
-				printk(KERN_WARNING
-				       "Niccy: No IRQ for PCI card found\n");
-				return 0;
-			}
-			cs->irq = niccy_dev->irq;
-			cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
-			if (!cs->hw.niccy.cfg_reg) {
-				printk(KERN_WARNING
-				       "Niccy: No IO-Adr for PCI cfg found\n");
-				return 0;
-			}
-			pci_ioaddr = pci_resource_start(niccy_dev, 1);
-			if (!pci_ioaddr) {
-				printk(KERN_WARNING
-				       "Niccy: No IO-Adr for PCI card found\n");
-				return 0;
-			}
-			cs->subtyp = NICCY_PCI;
-		} else {
-			printk(KERN_WARNING "Niccy: No PCI card found\n");
-			return 0;
-		}
-		cs->irq_flags |= IRQF_SHARED;
-		cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA;
-		cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
-		cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
-		cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
-		if (!request_region(cs->hw.niccy.isac, 4, "niccy")) {
-			printk(KERN_WARNING
-			       "HiSax: NICCY data port %x-%x already in use\n",
-			       cs->hw.niccy.isac, cs->hw.niccy.isac + 4);
-			return 0;
-		}
-		if (!request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci")) {
-			printk(KERN_WARNING
-			       "HiSax: NICCY pci port %x-%x already in use\n",
-			       cs->hw.niccy.cfg_reg,
-			       cs->hw.niccy.cfg_reg + 0x40);
-			release_region(cs->hw.niccy.isac, 4);
-			return 0;
-		}
-#else
-		printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
-		printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
-		return 0;
-#endif				/* CONFIG_PCI_LEGACY */
-	}
-	printk(KERN_INFO "HiSax: NICCY %s config irq:%d data:0x%X ale:0x%X\n",
-		(cs->subtyp == 1) ? "PnP" : "PCI",
+
+	WARN_ON(cs->typ != ISDN_CTYPE_NICCY);
+
+	printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
+		"niccy", (cs->subtyp == 1) ? "PnP" : "PCI",
 		cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
 	setup_isac(cs);
 	cs->readisac = &ReadISAC;
@@ -378,3 +264,315 @@ int __devinit setup_niccy(struct IsdnCard *card)
 	}
 	return 1;
 }
+
+#ifdef CONFIG_ISA
+
+static int __devinit niccy_isa_setup(struct IsdnCard *card)
+{
+	struct IsdnCardState *cs = card->cs;
+
+	cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
+	cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
+	cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP;
+	cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP;
+	cs->hw.niccy.cfg_reg = 0;
+	cs->subtyp = NICCY_PNP;
+	cs->irq = card->para[0];
+	if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
+		printk(KERN_WARNING "HiSax: %s data port %x-%x "
+			"already in use\n", "niccy",
+			cs->hw.niccy.isac, cs->hw.niccy.isac + 1);
+		return 0;
+	}
+	if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
+		printk(KERN_WARNING "HiSax: %s address port %x-%x "
+			"already in use\n", "niccy",
+			cs->hw.niccy.isac_ale,
+			cs->hw.niccy.isac_ale + 1);
+		release_region(cs->hw.niccy.isac, 2);
+		return 0;
+	}
+
+	return setup_niccy(card);
+}
+
+static int __devinit niccy_isa_init_one(struct device *dev, unsigned int id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_NICCY, };
+	int cardnr;
+
+	icard.para[0] = niccy_irq;
+	icard.para[1] = niccy_base0;
+	icard.para[2] = niccy_base1;
+	if (!niccy_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = niccy_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, niccy_isa_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	dev_set_drvdata(dev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static int __devexit niccy_isa_remove_one(struct device *dev, unsigned int id)
+{
+	int cardnr = (unsigned long) dev_get_drvdata(dev);
+
+	HiSax_closecard(cardnr);
+	return 0;
+}
+
+static struct isa_driver niccy_isa_driver = {
+	.probe		= niccy_isa_init_one,
+	.remove		= __devexit_p(niccy_isa_remove_one),
+	.driver = {
+		.owner	= THIS_MODULE,
+		.name	= "niccy_pci",
+	},
+};
+
+#ifdef CONFIG_PNP
+
+static int __devinit niccy_pnp_setup(struct IsdnCard *card)
+{
+	struct pnp_dev *pnp_d = (void *) card->para[0];
+	int err;
+
+	pnp_disable_dev(pnp_d);
+	err = pnp_activate_dev(pnp_d);
+	if (err < 0) {
+		printk(KERN_WARNING "%s: pnp_activate_dev "
+			"ret(%d)\n", __func__, err);
+		return 0;
+	}
+	card->para[1] = pnp_port_start(pnp_d, 0);
+	card->para[2] = pnp_port_start(pnp_d, 1);
+	card->para[0] = pnp_irq(pnp_d, 0);
+	if (!card->para[0] || !card->para[1] ||
+			!card->para[2]) {
+		printk(KERN_ERR "NiccyPnP:some resources are "
+			"missing %ld/%lx/%lx\n",
+			card->para[0], card->para[1],
+			card->para[2]);
+		pnp_disable_dev(pnp_d);
+		return 0;
+	}
+
+	return niccy_isa_setup(card);
+}
+
+static int __devinit niccy_pnp_init_one(struct pnp_dev *pdev,
+				       const struct pnp_device_id *dev_id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_NICCY, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!niccy_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = niccy_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, niccy_pnp_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pnp_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static void __devexit niccy_pnp_remove_one(struct pnp_dev *pdev)
+{
+	int cardnr = (unsigned long) pnp_get_drvdata(pdev);
+
+	HiSax_closecard(cardnr);
+}
+
+static struct pnp_device_id niccy_pnp_table[] = {
+	{ .id = "SDA0150", },
+
+	{ .id = "" }		/* terminate list */
+};
+
+static struct pnp_driver niccy_pnp_driver = {
+	.name		= "niccy",
+	.id_table	= niccy_pnp_table,
+	.probe		= niccy_pnp_init_one,
+	.remove		= __devexit_p(niccy_pnp_remove_one),
+};
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+
+#ifdef CONFIG_PCI
+
+static int __devinit niccy_pci_setup(struct IsdnCard *card)
+{
+	u_int pci_ioaddr;
+	struct pci_dev *niccy_dev = (void *) card->para[0];
+	struct IsdnCardState *cs = card->cs;
+
+	cs->subtyp = 0;
+	if (pci_enable_device(niccy_dev))
+		return 0;
+	/* get IRQ */
+	if (!niccy_dev->irq) {
+		printk(KERN_WARNING
+		       "Niccy: No IRQ for PCI card found\n");
+		return 0;
+	}
+	cs->irq = niccy_dev->irq;
+	cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
+	if (!cs->hw.niccy.cfg_reg) {
+		printk(KERN_WARNING
+		       "Niccy: No IO-Adr for PCI cfg found\n");
+		return 0;
+	}
+	pci_ioaddr = pci_resource_start(niccy_dev, 1);
+	if (!pci_ioaddr) {
+		printk(KERN_WARNING
+		       "Niccy: No IO-Adr for PCI card found\n");
+		return 0;
+	}
+	cs->subtyp = NICCY_PCI;
+	cs->irq_flags |= IRQF_SHARED;
+	cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA;
+	cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
+	cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
+	cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
+	if (!request_region(cs->hw.niccy.isac, 4, "niccy")) {
+		printk(KERN_WARNING
+		       "HiSax: %s data port %x-%x already in use\n",
+		       "niccy",
+		       cs->hw.niccy.isac, cs->hw.niccy.isac + 4);
+		return 0;
+	}
+	if (!request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci")) {
+		printk(KERN_WARNING
+		       "HiSax: %s pci port %x-%x already in use\n",
+		       "niccy",
+		       cs->hw.niccy.cfg_reg,
+		       cs->hw.niccy.cfg_reg + 0x40);
+		release_region(cs->hw.niccy.isac, 4);
+		return 0;
+	}
+
+	return setup_niccy(card);
+}
+
+static int __devinit niccy_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_NICCY, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!niccy_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = niccy_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, niccy_pci_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id niccy_pci_table[] = {
+	{ PCI_VDEVICE(SATSAGEM, PCI_DEVICE_ID_SATSAGEM_NICCY) },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver niccy_pci_driver = {
+	.name		= "niccy",
+	.id_table	= niccy_pci_table,
+	.probe		= niccy_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+#endif /* CONFIG_PCI */
+
+static int __init niccy_mod_init(void)
+{
+	int rc = 0;
+
+#ifdef CONFIG_ISA
+	if (niccy_irq && niccy_base0 && niccy_base1) {
+		rc = isa_register_driver(&niccy_isa_driver, 1);
+		if (rc)
+			return rc;
+	}
+#ifdef CONFIG_PNP
+	else {
+		rc = pnp_register_driver(&niccy_pnp_driver);
+		if (rc)
+			return rc;
+	}
+#endif
+#endif /* CONFIG_ISA */
+
+#ifdef CONFIG_PCI
+	rc = pci_register_driver(&niccy_pci_driver);
+	if (rc)
+		goto err_out_isa;
+#endif /* CONFIG_PCI */
+
+	return 0;
+
+#ifdef CONFIG_PCI
+err_out_isa:
+
+#ifdef CONFIG_ISA
+	if (niccy_irq && niccy_base0 && niccy_base1)
+		isa_unregister_driver(&niccy_isa_driver);
+#ifdef CONFIG_PNP
+	else
+		pnp_unregister_driver(&niccy_pnp_driver);
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+
+	return rc;
+#endif /* CONFIG_PCI */
+}
+
+static void __exit niccy_mod_exit(void)
+{
+#ifdef CONFIG_PCI
+	pci_unregister_driver(&niccy_pci_driver);
+#endif /* CONFIG_PCI */
+
+#ifdef CONFIG_ISA
+	if (niccy_irq && niccy_base0 && niccy_base1)
+		isa_unregister_driver(&niccy_isa_driver);
+#ifdef CONFIG_PNP
+	else
+		pnp_unregister_driver(&niccy_pnp_driver);
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+}
+
+module_init(niccy_mod_init);
+module_exit(niccy_mod_exit);
+
+#ifdef CONFIG_ISA
+module_param_named(irq, niccy_irq, int, 0444);
+MODULE_PARM_DESC(irq, "ISA IRQ.  Zero disables ISA support (default).");
+
+module_param_named(base0, niccy_base0, int, 0444);
+MODULE_PARM_DESC(base0, "ISA I/O base #0.  Zero disables ISA support (default).");
+
+module_param_named(base1, niccy_base1, int, 0444);
+MODULE_PARM_DESC(base1, "ISA I/O base #1.  Zero disables ISA support (default).");
+#endif /* CONFIG_ISA */
+
+module_param_named(protocol, niccy_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, niccy_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax Niccy PCI/PNP driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 14/14] [ISDN] HiSax bkm_a8: convert to PCI hotplug API
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (5 preceding siblings ...)
  2007-07-24 12:26   ` [PATCH 11/14] [ISDN] HiSax niccy: convert to modern ISA/PNP/PCI probing Jeff Garzik
@ 2007-08-02 12:37   ` Jeff Garzik
  2007-10-31  5:10   ` [PATCH 03/14] [ISDN] Ready HiSax driver for modularization Jeff Garzik
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-08-02 12:37 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig  |    4 +-
 drivers/isdn/hisax/Makefile |    2 +-
 drivers/isdn/hisax/bkm_a8.c |  186 +++++++++++++++++++++++++++++-------------
 drivers/isdn/hisax/config.c |   48 +-----------
 4 files changed, 133 insertions(+), 107 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 36af79f..8e18f7c 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -298,8 +298,8 @@ config HISAX_BKM_A4T
 	  settings.
 
 config HISAX_SCT_QUADRO
-	bool "Scitel Quadro card"
-	depends on PCI && PCI_LEGACY
+	tristate "Scitel Quadro card"
+	depends on PCI
 	help
 	  This enables HiSax support for the Scitel Quadro card.
 
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index bef1e0e..c63dba8 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o libhisax.o
 obj-$(CONFIG_HISAX_GAZEL)		+= gazel.o libhisax.o
 obj-$(CONFIG_HISAX_NICCY)		+= niccy.o libhisax.o
 obj-$(CONFIG_HISAX_DIEHLDIVA)		+= hisaxdiva.o libhisax.o
+obj-$(CONFIG_HISAX_SCT_QUADRO)		+= bkm_a8.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
@@ -65,5 +66,4 @@ hisax-$(CONFIG_HISAX_HFCS)		+= hfcscard.o hfc_2bds0.o
 hisax-$(CONFIG_HISAX_HFC_SX)		+= hfc_sx.o
 hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isar.o
 hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
-hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
 
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index e1ff471..575506c 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -13,6 +13,7 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "ipac.h"
 #include "hscx.h"
@@ -20,6 +21,8 @@
 #include <linux/pci.h>
 #include "bkm_ax.h"
 
+static int a8_protocol;		/* 0 == use DEFAULT_PROTO */
+
 #define	ATTEMPT_PCI_REMAPPING	/* Required for PLX rev 1 */
 
 static const char sct_quadro_revision[] = "$Revision: 1.22.2.4 $";
@@ -267,63 +270,23 @@ sct_alloc_io(u_int adr, u_int len)
 	return(0);
 }
 
-static struct pci_dev *dev_a8 __devinitdata = NULL;
-static u16  sub_vendor_id __devinitdata = 0;
-static u16  sub_sys_id __devinitdata = 0;
-static u_char pci_bus __devinitdata = 0;
-static u_char pci_device_fn __devinitdata = 0;
-static u_char pci_irq __devinitdata = 0;
-
-int __devinit
+static int __devinit
 setup_sct_quadro(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
+	u_int pci_ioaddr2, pci_ioaddr3, pci_ioaddr4, pci_ioaddr5;
 	char tmp[64];
-	u_int found = 0;
-	u_int pci_ioaddr1, pci_ioaddr2, pci_ioaddr3, pci_ioaddr4, pci_ioaddr5;
+	struct pci_dev *dev_a8 = (void *) card->para[1];
+	u_int pci_ioaddr1 = pci_resource_start(dev_a8, 1);
+	u_char pci_irq = dev_a8->irq;
 
 	strcpy(tmp, sct_quadro_revision);
 	printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ == ISDN_CTYPE_SCT_QUADRO) {
-		cs->subtyp = SCT_1;	/* Preset */
-	} else
-		return (0);
 
-	/* Identify subtype by para[0] */
-	if (card->para[0] >= SCT_1 && card->para[0] <= SCT_4)
-		cs->subtyp = card->para[0];
-	else {
-		printk(KERN_WARNING "HiSax: Scitel Quadro: Invalid "
-		       "subcontroller in configuration, default to 1\n");
-		return (0);
-	}
-	if ((cs->subtyp != SCT_1) && ((sub_sys_id != PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) ||
-		(sub_vendor_id != PCI_VENDOR_ID_BERKOM)))
-		return (0);
+	cs->subtyp = card->para[0];
+
 	if (cs->subtyp == SCT_1) {
-		while ((dev_a8 = pci_find_device(PCI_VENDOR_ID_PLX,
-			PCI_DEVICE_ID_PLX_9050, dev_a8))) {
-			
-			sub_vendor_id = dev_a8->subsystem_vendor;
-			sub_sys_id = dev_a8->subsystem_device;
-			if ((sub_sys_id == PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) &&
-				(sub_vendor_id == PCI_VENDOR_ID_BERKOM)) {
-				if (pci_enable_device(dev_a8))
-					return(0);
-				pci_ioaddr1 = pci_resource_start(dev_a8, 1);
-				pci_irq = dev_a8->irq;
-				pci_bus = dev_a8->bus->number;
-				pci_device_fn = dev_a8->devfn;
-				found = 1;
-				break;
-			}
-		}
-		if (!found) {
-			printk(KERN_WARNING "HiSax: Scitel Quadro (%s): "
-				"Card not found\n",
-				sct_quadro_subtypes[cs->subtyp]);
-			return (0);
-		}
+
 #ifdef ATTEMPT_PCI_REMAPPING
 /* HACK: PLX revision 1 bug: PLX address bit 7 must not be set */
 		if ((pci_ioaddr1 & 0x80) && (dev_a8->revision == 1)) {
@@ -345,22 +308,19 @@ setup_sct_quadro(struct IsdnCard *card)
 		       sct_quadro_subtypes[cs->subtyp]);
 		return (0);
 	}
-	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_1, &pci_ioaddr1);
-	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_2, &pci_ioaddr2);
-	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_3, &pci_ioaddr3);
-	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_4, &pci_ioaddr4);
-	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_5, &pci_ioaddr5);
+
+	pci_ioaddr2 = pci_resource_start(dev_a8, 2);
+	pci_ioaddr3 = pci_resource_start(dev_a8, 3);
+	pci_ioaddr4 = pci_resource_start(dev_a8, 4);
+	pci_ioaddr5 = pci_resource_start(dev_a8, 5);
+
 	if (!pci_ioaddr1 || !pci_ioaddr2 || !pci_ioaddr3 || !pci_ioaddr4 || !pci_ioaddr5) {
 		printk(KERN_WARNING "HiSax: Scitel Quadro (%s): "
 		       "No IO base address(es)\n",
 		       sct_quadro_subtypes[cs->subtyp]);
 		return (0);
 	}
-	pci_ioaddr1 &= PCI_BASE_ADDRESS_IO_MASK;
-	pci_ioaddr2 &= PCI_BASE_ADDRESS_IO_MASK;
-	pci_ioaddr3 &= PCI_BASE_ADDRESS_IO_MASK;
-	pci_ioaddr4 &= PCI_BASE_ADDRESS_IO_MASK;
-	pci_ioaddr5 &= PCI_BASE_ADDRESS_IO_MASK;
+
 	/* Take over */
 	cs->irq = pci_irq;
 	cs->irq_flags |= IRQF_SHARED;
@@ -433,3 +393,113 @@ setup_sct_quadro(struct IsdnCard *card)
 		readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID));
 	return (1);
 }
+
+enum {
+	a8_bri_count	= 4,
+};
+
+struct a8_pci_bri {
+	int		cardnr;
+};
+
+struct a8_pci_info {
+	struct a8_pci_bri	bri[a8_bri_count];
+};
+
+static int __devinit a8_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_SCT_QUADRO, };
+	int rc, i, found = 0;
+	struct a8_pci_info *api;
+
+	rc = pci_enable_device(pdev);
+	if (rc)
+		return rc;
+
+	api = kzalloc(sizeof(*api), GFP_KERNEL);
+	if (!api) {
+		rc = -ENOMEM;
+		goto err_out;
+	}
+
+	icard.para[1] = (unsigned long) pdev;
+	if (!a8_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = a8_protocol;
+
+	for (i = 0; i < a8_bri_count; i++) {
+		icard.para[0] = SCT_1 + i;
+		api->bri[i].cardnr =
+			hisax_init_hotplug(&icard, setup_sct_quadro);
+		if (api->bri[i].cardnr >= 0)
+			found = 1;
+	}
+
+	if (!found) {
+		rc = -ENODEV;
+		goto err_out_api;
+	}
+
+	pci_set_drvdata(pdev, api);
+	return 0;
+
+err_out_api:
+	kfree(api);
+err_out:
+	pci_disable_device(pdev);
+	return rc;
+}
+
+static void __devexit a8_pci_remove_one(struct pci_dev *pdev)
+{
+	struct a8_pci_info *api = pci_get_drvdata(pdev);
+	int i;
+
+	pci_set_drvdata(pdev, NULL);
+
+	for (i = 0; i < a8_bri_count; i++) {
+		struct a8_pci_bri *bri = &api->bri[i];
+
+		if (bri->cardnr >= 0)
+			HiSax_closecard(bri->cardnr);
+	}
+
+	kfree(api);
+	pci_disable_device(pdev);
+}
+
+static struct pci_device_id a8_pci_table[] = {
+	{ PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
+	  PCI_VENDOR_ID_BERKOM, PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO, },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver a8_pci_driver = {
+	.name		= "bkm_a8",
+	.id_table	= a8_pci_table,
+	.probe		= a8_pci_init_one,
+	.remove		= __devexit_p(a8_pci_remove_one),
+};
+
+static int __init a8_mod_init(void)
+{
+	return pci_register_driver(&a8_pci_driver);
+}
+
+static void __exit a8_mod_exit(void)
+{
+	pci_unregister_driver(&a8_pci_driver);
+}
+
+module_init(a8_mod_init);
+module_exit(a8_mod_exit);
+
+module_param_named(protocol, a8_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, a8_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax BKM SCT QUADRO (A8) PCI driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index f7d0818..2aa435b 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -208,13 +208,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {5,0x250,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_SCT_QUADRO
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_SCT_QUADRO
-#define DEFAULT_CFG {1,0x0,0,0}
-#endif
-
 #ifndef DEFAULT_CARD
 #define DEFAULT_CARD 0
 #define DEFAULT_CFG {0,0,0,0}
@@ -434,10 +427,6 @@ extern int setup_isurf(struct IsdnCard *card);
 extern int setup_saphir(struct IsdnCard *card);
 #endif
 
-#if CARD_SCT_QUADRO
-extern int setup_sct_quadro(struct IsdnCard *card);
-#endif
-
 /*
  * Find card with given driverId
  */
@@ -808,11 +797,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_saphir(card);
 		break;
 #endif
-#if	CARD_SCT_QUADRO
-	case ISDN_CTYPE_SCT_QUADRO:
-		ret = setup_sct_quadro(card);
-		break;
-#endif
 	case ISDN_CTYPE_DYNAMIC:
 		ret = 2;
 		break;
@@ -828,6 +812,7 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_GAZEL:
 	case ISDN_CTYPE_NICCY:
 	case ISDN_CTYPE_DIEHLDIVA:
+	case ISDN_CTYPE_SCT_QUADRO:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1299,32 +1284,9 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_GAZEL:
 		case ISDN_CTYPE_NICCY:
 		case ISDN_CTYPE_DIEHLDIVA:
-			break;
-
 		case ISDN_CTYPE_SCT_QUADRO:
-			if (irq[i]) {
-				cards[j].para[0] = irq[i];
-			} else {
-				/* QUADRO is a 4 BRI card */
-				cards[j++].para[0] = 1;
-				/* we need to check if further cards can be added */
-				if (j < HISAX_MAX_CARDS) {
-					cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
-					cards[j].protocol = protocol[i];
-					cards[j++].para[0] = 2;
-				}
-				if (j < HISAX_MAX_CARDS) {
-					cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
-					cards[j].protocol = protocol[i];
-					cards[j++].para[0] = 3;
-				}
-				if (j < HISAX_MAX_CARDS) {
-					cards[j].typ = ISDN_CTYPE_SCT_QUADRO;
-					cards[j].protocol = protocol[i];
-					cards[j].para[0] = 4;
-				}
-			}
 			break;
+
 		}
 		j++;
 	}
@@ -1771,15 +1733,9 @@ static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 	{PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_MICROLINK,   PCI_ANY_ID, PCI_ANY_ID},
 	{PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_QS3000,      PCI_ANY_ID, PCI_ANY_ID},
 #endif
-#ifdef CONFIG_HISAX_SCT_QUADRO
-	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_9050,         PCI_ANY_ID, PCI_ANY_ID},
-#endif
 #ifdef CONFIG_HISAX_SEDLBAUER
 	{PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_100,     PCI_ANY_ID,PCI_ANY_ID},
 #endif
-#if defined(CONFIG_HISAX_SCT_QUADRO)
-	{PCI_VENDOR_ID_ZORAN,    PCI_DEVICE_ID_ZORAN_36120,      PCI_ANY_ID,PCI_ANY_ID},
-#endif
 	{ }				/* Terminating entry */
 };
 
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 03/14] [ISDN] Ready HiSax driver for modularization
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (6 preceding siblings ...)
  2007-08-02 12:37   ` [PATCH 14/14] [ISDN] HiSax bkm_a8: convert to PCI hotplug API Jeff Garzik
@ 2007-10-31  5:10   ` Jeff Garzik
  2007-10-31  5:11   ` [PATCH 09/14] [ISDN] HiSax avm_pci: convert to modern PCI/ISA/PNP probing Jeff Garzik
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-10-31  5:10 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

* move netjet, isac, arcofi, hscx common sub-modules to new libhisax.ko
* export several symbols that are used by external drivers
* move DEFAULT_PROTO* deterination to shareable header file
* add hotplug and PCI-remove APIs

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Makefile      |   51 ++++++++++++++++----------------
 drivers/isdn/hisax/arcofi.c      |    3 ++
 drivers/isdn/hisax/config.c      |   59 +++++++++++++++++++++++--------------
 drivers/isdn/hisax/hisax_cfg.h   |    2 +
 drivers/isdn/hisax/hisax_proto.h |   25 ++++++++++++++++
 drivers/isdn/hisax/hscx.c        |    7 ++++
 drivers/isdn/hisax/isac.c        |    9 ++++-
 drivers/isdn/hisax/isdnl1.c      |    9 +++++-
 drivers/isdn/hisax/lmgr.c        |    1 +
 drivers/isdn/hisax/netjet.c      |   10 ++++++-
 drivers/isdn/hisax/q931.c        |    3 ++
 11 files changed, 128 insertions(+), 51 deletions(-)
 create mode 100644 drivers/isdn/hisax/hisax_proto.h

diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index c7a3794..0b73795 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -6,7 +6,7 @@
 
 EXTRA_CFLAGS      += -DHISAX_MAX_CARDS=$(CONFIG_HISAX_MAX_CARDS)
 
-obj-$(CONFIG_ISDN_DRV_HISAX)		+= hisax.o
+obj-$(CONFIG_ISDN_DRV_HISAX)		+= hisax.o libhisax.o
 obj-$(CONFIG_HISAX_SEDLBAUER_CS)	+= sedlbauer_cs.o
 obj-$(CONFIG_HISAX_ELSA_CS)		+= elsa_cs.o
 obj-$(CONFIG_HISAX_AVM_A1_CS)		+= avma1_cs.o
@@ -16,6 +16,8 @@ obj-$(CONFIG_HISAX_HFCUSB)		+= hfc_usb.o
 obj-$(CONFIG_HISAX_HFC4S8S)		+= hfc4s8s_l1.o
 obj-$(CONFIG_HISAX_FRITZ_PCIPNP)        += hisax_isac.o hisax_fcpcipnp.o
 
+libhisax-y				:= netjet.o isac.o arcofi.o hscx.o
+
 ifdef CONFIG_HISAX_HDLC
 obj-$(CONFIG_ISDN_DRV_HISAX)		+= isdnhdlc.o
 endif
@@ -31,33 +33,32 @@ hisax-$(CONFIG_HISAX_EURO)		+= l3dss1.o
 hisax-$(CONFIG_HISAX_NI1)		+= l3ni1.o
 hisax-$(CONFIG_HISAX_1TR6)		+= l3_1tr6.o
 
-hisax-$(CONFIG_HISAX_16_0)		+= teles0.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_16_3)		+= teles3.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_TELESPCI)		+= telespci.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_S0BOX)		+= s0box.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_AVM_A1)		+= avm_a1.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA)	+= avm_a1p.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o isac.o arcofi.o
-hisax-$(CONFIG_HISAX_ELSA)		+= elsa.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_IX1MICROR2)	+= ix1_micro.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_DIEHLDIVA)		+= diva.o isac.o arcofi.o hscx.o ipacx.o 
-hisax-$(CONFIG_HISAX_ASUSCOM)		+= asuscom.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_TELEINT)		+= teleint.o isac.o arcofi.o hfc_2bs0.o
-hisax-$(CONFIG_HISAX_SEDLBAUER)		+= sedlbauer.o isac.o arcofi.o hscx.o \
-					   isar.o
-hisax-$(CONFIG_HISAX_SPORTSTER)		+= sportster.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_MIC)		+= mic.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_NETJET)		+= nj_s.o netjet.o isac.o arcofi.o
-hisax-$(CONFIG_HISAX_NETJET_U)		+= nj_u.o netjet.o icc.o
+hisax-$(CONFIG_HISAX_16_0)		+= teles0.o
+hisax-$(CONFIG_HISAX_16_3)		+= teles3.o
+hisax-$(CONFIG_HISAX_TELESPCI)		+= telespci.o
+hisax-$(CONFIG_HISAX_S0BOX)		+= s0box.o
+hisax-$(CONFIG_HISAX_AVM_A1)		+= avm_a1.o
+hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA)	+= avm_a1p.o
+hisax-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o
+hisax-$(CONFIG_HISAX_ELSA)		+= elsa.o
+hisax-$(CONFIG_HISAX_IX1MICROR2)	+= ix1_micro.o
+hisax-$(CONFIG_HISAX_DIEHLDIVA)		+= diva.o ipacx.o 
+hisax-$(CONFIG_HISAX_ASUSCOM)		+= asuscom.o
+hisax-$(CONFIG_HISAX_TELEINT)		+= teleint.o hfc_2bs0.o
+hisax-$(CONFIG_HISAX_SEDLBAUER)		+= sedlbauer.o isar.o
+hisax-$(CONFIG_HISAX_SPORTSTER)		+= sportster.o
+hisax-$(CONFIG_HISAX_MIC)		+= mic.o
+hisax-$(CONFIG_HISAX_NETJET)		+= nj_s.o
+hisax-$(CONFIG_HISAX_NETJET_U)		+= nj_u.o icc.o
 hisax-$(CONFIG_HISAX_HFCS)		+= hfcscard.o hfc_2bds0.o
 hisax-$(CONFIG_HISAX_HFC_PCI)		+= hfc_pci.o
 hisax-$(CONFIG_HISAX_HFC_SX)		+= hfc_sx.o
-hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isac.o arcofi.o isar.o
-hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t.o isac.o arcofi.o jade.o
-hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o isac.o arcofi.o hscx.o
-hisax-$(CONFIG_HISAX_GAZEL)		+= gazel.o isac.o arcofi.o hscx.o
+hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o
+hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isar.o
+hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
+hisax-$(CONFIG_HISAX_BKM_A4T)		+= bkm_a4t.o jade.o
+hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
+hisax-$(CONFIG_HISAX_GAZEL)		+= gazel.o
 hisax-$(CONFIG_HISAX_W6692)		+= w6692.o
 hisax-$(CONFIG_HISAX_ENTERNOW_PCI)	+= enternow_pci.o amd7930_fn.o
 
diff --git a/drivers/isdn/hisax/arcofi.c b/drivers/isdn/hisax/arcofi.c
index d30ce5b..5597f15 100644
--- a/drivers/isdn/hisax/arcofi.c
+++ b/drivers/isdn/hisax/arcofi.c
@@ -111,6 +111,7 @@ arcofi_fsm(struct IsdnCardState *cs, int event, void *data) {
 	}
 	return(0);
 }
+EXPORT_SYMBOL(arcofi_fsm);
 
 static void
 arcofi_timer(struct IsdnCardState *cs) {
@@ -123,6 +124,7 @@ clear_arcofi(struct IsdnCardState *cs) {
 		del_timer(&cs->dc.isac.arcofitimer);
 	}
 }
+EXPORT_SYMBOL(clear_arcofi);
 
 void
 init_arcofi(struct IsdnCardState *cs) {
@@ -132,3 +134,4 @@ init_arcofi(struct IsdnCardState *cs) {
 	init_waitqueue_head(&cs->dc.isac.arcofi_wait);
 	test_and_set_bit(HW_ARCOFI, &cs->HW_Flags);
 }
+EXPORT_SYMBOL(init_arcofi);
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 84d75a3..3259639 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -23,6 +23,8 @@
 #include <linux/kernel_stat.h>
 #include <linux/workqueue.h>
 #include <linux/interrupt.h>
+#include <linux/pci.h>
+#include "hisax_proto.h"
 #define HISAX_STATUS_BUFSIZE 4096
 
 /*
@@ -283,26 +285,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {0,0,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_1TR6
-#define DEFAULT_PROTO ISDN_PTYPE_1TR6
-#define DEFAULT_PROTO_NAME "1TR6"
-#endif
-#ifdef CONFIG_HISAX_NI1
-#undef DEFAULT_PROTO
-#define DEFAULT_PROTO ISDN_PTYPE_NI1
-#undef DEFAULT_PROTO_NAME
-#define DEFAULT_PROTO_NAME "NI1"
-#endif
-#ifdef CONFIG_HISAX_EURO
-#undef DEFAULT_PROTO
-#define DEFAULT_PROTO ISDN_PTYPE_EURO
-#undef DEFAULT_PROTO_NAME
-#define DEFAULT_PROTO_NAME "EURO"
-#endif
-#ifndef DEFAULT_PROTO
-#define DEFAULT_PROTO ISDN_PTYPE_UNKNOWN
-#define DEFAULT_PROTO_NAME "UNKNOWN"
-#endif
 #ifndef DEFAULT_CARD
 #define DEFAULT_CARD 0
 #define DEFAULT_CFG {0,0,0,0}
@@ -380,6 +362,7 @@ char *HiSax_getrev(const char *revision)
 		rev = "???";
 	return rev;
 }
+EXPORT_SYMBOL(HiSax_getrev);
 
 static void __init HiSaxVersion(void)
 {
@@ -742,6 +725,7 @@ void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...)
 	VHiSax_putstatus(cs, head, fmt, args);
 	va_end(args);
 }
+EXPORT_SYMBOL(HiSax_putstatus);
 
 int ll_run(struct IsdnCardState *cs, int addfeatures)
 {
@@ -1285,6 +1269,7 @@ void HiSax_closecard(int cardnr)
 	}
 	nrcards--;
 }
+EXPORT_SYMBOL(HiSax_closecard);
 
 void HiSax_reportcard(int cardnr, int sel)
 {
@@ -1542,6 +1527,38 @@ static void __exit HiSax_exit(void)
 	printk(KERN_INFO "HiSax module removed\n");
 }
 
+#ifdef CONFIG_PCI
+void hisax_pci_remove_one(struct pci_dev *pdev)
+{
+	int cardnr = (unsigned long) pci_get_drvdata(pdev);
+
+	HiSax_closecard(cardnr);
+	pci_disable_device(pdev);
+	pci_set_drvdata(pdev, NULL);
+}
+EXPORT_SYMBOL(hisax_pci_remove_one);
+#endif /* CONFIG_PCI */
+
+int hisax_init_hotplug(struct IsdnCard *card, hisax_setup_func_t card_setup)
+{
+	u_char ids[16];
+	int ret = -1;
+
+	cards[nrcards] = *card;
+	if (nrcards)
+		sprintf(ids, "HiSax%d", nrcards);
+	else
+		sprintf(ids, "HiSax");
+	if (!checkcard(nrcards, ids, NULL, THIS_MODULE, card_setup))
+		goto error;
+
+	ret = nrcards;
+	nrcards++;
+error:
+	return ret;
+}
+EXPORT_SYMBOL(hisax_init_hotplug);
+
 int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
 {
 	u_char ids[16];
@@ -1561,9 +1578,7 @@ int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
 error:
 	return ret;
 }
-
 EXPORT_SYMBOL(hisax_init_pcmcia);
-EXPORT_SYMBOL(HiSax_closecard);
 
 #include "hisax_if.h"
 
diff --git a/drivers/isdn/hisax/hisax_cfg.h b/drivers/isdn/hisax/hisax_cfg.h
index 17a2fea..0625756 100644
--- a/drivers/isdn/hisax/hisax_cfg.h
+++ b/drivers/isdn/hisax/hisax_cfg.h
@@ -64,3 +64,5 @@ typedef int (*hisax_setup_func_t)(struct IsdnCard *card);
 
 extern void	HiSax_closecard(int);
 extern int	hisax_init_pcmcia(void *, int *, IsdnCard_t *);
+extern int	hisax_init_hotplug(IsdnCard_t *, hisax_setup_func_t card_setup);
+extern void	hisax_pci_remove_one(struct pci_dev *pdev);
diff --git a/drivers/isdn/hisax/hisax_proto.h b/drivers/isdn/hisax/hisax_proto.h
new file mode 100644
index 0000000..7eea361
--- /dev/null
+++ b/drivers/isdn/hisax/hisax_proto.h
@@ -0,0 +1,25 @@
+#ifndef __ISDN_HISAX_HISAX_PROTO_H__
+#define __ISDN_HISAX_HISAX_PROTO_H__
+
+#ifdef CONFIG_HISAX_1TR6
+#define DEFAULT_PROTO ISDN_PTYPE_1TR6
+#define DEFAULT_PROTO_NAME "1TR6"
+#endif
+#ifdef CONFIG_HISAX_NI1
+#undef DEFAULT_PROTO
+#define DEFAULT_PROTO ISDN_PTYPE_NI1
+#undef DEFAULT_PROTO_NAME
+#define DEFAULT_PROTO_NAME "NI1"
+#endif
+#ifdef CONFIG_HISAX_EURO
+#undef DEFAULT_PROTO
+#define DEFAULT_PROTO ISDN_PTYPE_EURO
+#undef DEFAULT_PROTO_NAME
+#define DEFAULT_PROTO_NAME "EURO"
+#endif
+#ifndef DEFAULT_PROTO
+#define DEFAULT_PROTO ISDN_PTYPE_UNKNOWN
+#define DEFAULT_PROTO_NAME "UNKNOWN"
+#endif
+
+#endif /* __ISDN_HISAX_HISAX_PROTO_H__ */
diff --git a/drivers/isdn/hisax/hscx.c b/drivers/isdn/hisax/hscx.c
index c8f9951..0c044ae 100644
--- a/drivers/isdn/hisax/hscx.c
+++ b/drivers/isdn/hisax/hscx.c
@@ -35,6 +35,7 @@ HscxVersion(struct IsdnCardState *cs, char *s)
 	else
 		return (0);
 }
+EXPORT_SYMBOL(HscxVersion);
 
 void
 modehscx(struct BCState *bcs, int mode, int bc)
@@ -90,6 +91,7 @@ modehscx(struct BCState *bcs, int mode, int bc)
 		cs->BC_Write_Reg(cs, hscx, HSCX_CMDR, 0x41);
 	cs->BC_Write_Reg(cs, hscx, HSCX_ISTA, 0x00);
 }
+EXPORT_SYMBOL(modehscx);
 
 void
 hscx_l2l1(struct PStack *st, int pr, void *arg)
@@ -150,6 +152,7 @@ hscx_l2l1(struct PStack *st, int pr, void *arg)
 			break;
 	}
 }
+EXPORT_SYMBOL(hscx_l2l1);
 
 static void
 close_hscxstate(struct BCState *bcs)
@@ -198,6 +201,7 @@ open_hscxstate(struct IsdnCardState *cs, struct BCState *bcs)
 	bcs->tx_cnt = 0;
 	return (0);
 }
+EXPORT_SYMBOL(open_hscxstate);
 
 static int
 setstack_hscx(struct PStack *st, struct BCState *bcs)
@@ -238,6 +242,7 @@ clear_pending_hscx_ints(struct IsdnCardState *cs)
 	cs->BC_Write_Reg(cs, 0, HSCX_MASK, 0xFF);
 	cs->BC_Write_Reg(cs, 1, HSCX_MASK, 0xFF);
 }
+EXPORT_SYMBOL(clear_pending_hscx_ints);
 
 void
 inithscx(struct IsdnCardState *cs)
@@ -255,6 +260,7 @@ inithscx(struct IsdnCardState *cs)
 	modehscx(cs->bcs, 0, 0);
 	modehscx(cs->bcs + 1, 0, 0);
 }
+EXPORT_SYMBOL(inithscx);
 
 void
 inithscxisac(struct IsdnCardState *cs, int part)
@@ -274,3 +280,4 @@ inithscxisac(struct IsdnCardState *cs, int part)
 		cs->writeisac(cs, ISAC_CMDR, 0x41);
 	}
 }
+EXPORT_SYMBOL(inithscxisac);
diff --git a/drivers/isdn/hisax/isac.c b/drivers/isdn/hisax/isac.c
index 07b1673..9a69fc0 100644
--- a/drivers/isdn/hisax/isac.c
+++ b/drivers/isdn/hisax/isac.c
@@ -27,13 +27,14 @@ static char *ISACVer[] __devinitdata =
 {"2086/2186 V1.1", "2085 B1", "2085 B2",
  "2085 V2.3"};
 
-void __devinit ISACVersion(struct IsdnCardState *cs, char *s)
+void ISACVersion(struct IsdnCardState *cs, char *s)
 {
 	int val;
 
 	val = cs->readisac(cs, ISAC_RBCH);
 	printk(KERN_INFO "%s ISAC version (%x): %s\n", s, val, ISACVer[(val >> 5) & 3]);
 }
+EXPORT_SYMBOL(ISACVersion);
 
 static void
 ph_command(struct IsdnCardState *cs, unsigned int command)
@@ -434,6 +435,7 @@ isac_interrupt(struct IsdnCardState *cs, u_char val)
 		}
 	}
 }
+EXPORT_SYMBOL(isac_interrupt);
 
 static void
 ISAC_l1hw(struct PStack *st, int pr, void *arg)
@@ -645,6 +647,7 @@ void initisac(struct IsdnCardState *cs)
 	ph_command(cs, ISAC_CMD_RS);
 	cs->writeisac(cs, ISAC_MASK, 0x0);
 }
+EXPORT_SYMBOL(initisac);
 
 void clear_pending_isac_ints(struct IsdnCardState *cs)
 {
@@ -669,8 +672,9 @@ void clear_pending_isac_ints(struct IsdnCardState *cs)
 	/* Disable all IRQ */
 	cs->writeisac(cs, ISAC_MASK, 0xFF);
 }
+EXPORT_SYMBOL(clear_pending_isac_ints);
 
-void __devinit
+void
 setup_isac(struct IsdnCardState *cs)
 {
 	INIT_WORK(&cs->tqueue, isac_bh);
@@ -678,3 +682,4 @@ setup_isac(struct IsdnCardState *cs)
 	cs->dbusytimer.data = (long) cs;
 	init_timer(&cs->dbusytimer);
 }
+EXPORT_SYMBOL(setup_isac);
diff --git a/drivers/isdn/hisax/isdnl1.c b/drivers/isdn/hisax/isdnl1.c
index a14204e..93b54a7 100644
--- a/drivers/isdn/hisax/isdnl1.c
+++ b/drivers/isdn/hisax/isdnl1.c
@@ -136,6 +136,7 @@ debugl1(struct IsdnCardState *cs, char *fmt, ...)
 	VHiSax_putstatus(cs, tmp, fmt, args);
 	va_end(args);
 }
+EXPORT_SYMBOL(debugl1);
 
 static void
 l1m_debug(struct FsmInst *fi, char *fmt, ...)
@@ -198,6 +199,7 @@ DChannel_proc_xmt(struct IsdnCardState *cs)
 			stptr = stptr->next;
 	}
 }
+EXPORT_SYMBOL(DChannel_proc_xmt);
 
 void
 DChannel_proc_rcv(struct IsdnCardState *cs)
@@ -265,6 +267,7 @@ DChannel_proc_rcv(struct IsdnCardState *cs)
 			dev_kfree_skb(skb);
 	}
 }
+EXPORT_SYMBOL(DChannel_proc_rcv);
 
 static void
 BChannel_proc_xmt(struct BCState *bcs)
@@ -451,7 +454,8 @@ Logl2Frame(struct IsdnCardState *cs, struct sk_buff *skb, char *buf, int dir)
 			(dir ? "<-" : "->"), buf, l2frames(ptr),
 			((ptr[0] & 2) >> 1) == dir ? 'C' : 'R', ptr[0] >> 2, ptr[1] >> 1);
 }
-#endif
+EXPORT_SYMBOL(Logl2Frame);
+#endif /* L2FRAME_DEBUG */
 
 static void
 l1_reset(struct FsmInst *fi, int event, void *arg)
@@ -878,6 +882,7 @@ l1_msg(struct IsdnCardState *cs, int pr, void *arg) {
 		st = st->next;
 	}
 }
+EXPORT_SYMBOL(l1_msg);
 
 void
 l1_msg_b(struct PStack *st, int pr, void *arg) {
@@ -890,6 +895,7 @@ l1_msg_b(struct PStack *st, int pr, void *arg) {
 			break;
 	}
 }
+EXPORT_SYMBOL(l1_msg_b);
 
 void
 setstack_HiSax(struct PStack *st, struct IsdnCardState *cs)
@@ -933,3 +939,4 @@ setstack_l1_B(struct PStack *st)
 	st->l1.Flags = 0;
 	FsmInitTimer(&st->l1.l1m, &st->l1.timer);
 }
+EXPORT_SYMBOL(setstack_l1_B);
diff --git a/drivers/isdn/hisax/lmgr.c b/drivers/isdn/hisax/lmgr.c
index d4f86d6..7122093 100644
--- a/drivers/isdn/hisax/lmgr.c
+++ b/drivers/isdn/hisax/lmgr.c
@@ -48,3 +48,4 @@ setstack_manager(struct PStack *st)
 {
 	st->ma.layer = hisax_manager;
 }
+EXPORT_SYMBOL(setstack_manager);
diff --git a/drivers/isdn/hisax/netjet.c b/drivers/isdn/hisax/netjet.c
index 02c6fba..3b09d8e 100644
--- a/drivers/isdn/hisax/netjet.c
+++ b/drivers/isdn/hisax/netjet.c
@@ -37,6 +37,7 @@ NETjet_ReadIC(struct IsdnCardState *cs, u_char offset)
 	ret = bytein(cs->hw.njet.isac + ((offset & 0xf)<<2));
 	return(ret);
 }
+EXPORT_SYMBOL(NETjet_ReadIC);
 
 void
 NETjet_WriteIC(struct IsdnCardState *cs, u_char offset, u_char value)
@@ -46,6 +47,7 @@ NETjet_WriteIC(struct IsdnCardState *cs, u_char offset, u_char value)
 	byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
 	byteout(cs->hw.njet.isac + ((offset & 0xf)<<2), value);
 }
+EXPORT_SYMBOL(NETjet_WriteIC);
 
 void
 NETjet_ReadICfifo(struct IsdnCardState *cs, u_char *data, int size)
@@ -54,6 +56,7 @@ NETjet_ReadICfifo(struct IsdnCardState *cs, u_char *data, int size)
 	byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
 	insb(cs->hw.njet.isac, data, size);
 }
+EXPORT_SYMBOL(NETjet_ReadICfifo);
 
 void 
 NETjet_WriteICfifo(struct IsdnCardState *cs, u_char *data, int size)
@@ -62,6 +65,7 @@ NETjet_WriteICfifo(struct IsdnCardState *cs, u_char *data, int size)
 	byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
 	outsb(cs->hw.njet.isac, data, size);
 }
+EXPORT_SYMBOL(NETjet_WriteICfifo);
 
 static void fill_mem(struct BCState *bcs, u_int *pos, u_int cnt, int chan, u_char fill)
 {
@@ -600,6 +604,7 @@ void read_tiger(struct IsdnCardState *cs) {
 		read_raw(cs->bcs + 1, p, cnt);
 	cs->hw.njet.irqstat0 &= ~NETJET_IRQM0_READ;
 }
+EXPORT_SYMBOL(read_tiger);
 
 static void write_raw(struct BCState *bcs, u_int *buf, int cnt);
 
@@ -669,6 +674,7 @@ void netjet_fill_dma(struct BCState *bcs)
 		debugl1(bcs->cs,"tiger fill_dma3: c%d %4x", bcs->channel,
 			bcs->Flag);
 }
+EXPORT_SYMBOL(netjet_fill_dma);
 
 static void write_raw(struct BCState *bcs, u_int *buf, int cnt) {
 	u_int mask, val, *p=buf;
@@ -787,6 +793,7 @@ void write_tiger(struct IsdnCardState *cs) {
 		write_raw(cs->bcs + 1, p, cnt);
 	cs->hw.njet.irqstat0 &= ~NETJET_IRQM0_WRITE;
 }
+EXPORT_SYMBOL(write_tiger);
 
 static void
 tiger_l2l1(struct PStack *st, int pr, void *arg)
@@ -958,6 +965,7 @@ inittiger(struct IsdnCardState *cs)
 	cs->bcs[0].BC_Close = close_tigerstate;
 	cs->bcs[1].BC_Close = close_tigerstate;
 }
+EXPORT_SYMBOL(inittiger);
 
 static void
 releasetiger(struct IsdnCardState *cs)
@@ -978,4 +986,4 @@ release_io_netjet(struct IsdnCardState *cs)
 	releasetiger(cs);
 	release_region(cs->hw.njet.base, 256);
 }
-
+EXPORT_SYMBOL(release_io_netjet);
diff --git a/drivers/isdn/hisax/q931.c b/drivers/isdn/hisax/q931.c
index aacbf0d..7225a6d 100644
--- a/drivers/isdn/hisax/q931.c
+++ b/drivers/isdn/hisax/q931.c
@@ -1170,6 +1170,7 @@ QuickHex(char *txt, u_char * p, int cnt)
 	*t++ = 0;
 	return (t - txt);
 }
+EXPORT_SYMBOL(QuickHex);
 
 void
 LogFrame(struct IsdnCardState *cs, u_char * buf, int size)
@@ -1192,6 +1193,7 @@ LogFrame(struct IsdnCardState *cs, u_char * buf, int size)
 	} else
 		HiSax_putstatus(cs, "LogFrame: ", "warning Frame too big (%d)", size);
 }
+EXPORT_SYMBOL(LogFrame);
 
 void
 dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir)
@@ -1520,3 +1522,4 @@ dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir)
 	*dp = 0;
 	HiSax_putstatus(cs, NULL, cs->dlog);
 }
+EXPORT_SYMBOL(dlogframe);
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 09/14] [ISDN] HiSax avm_pci: convert to modern PCI/ISA/PNP probing
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (7 preceding siblings ...)
  2007-10-31  5:10   ` [PATCH 03/14] [ISDN] Ready HiSax driver for modularization Jeff Garzik
@ 2007-10-31  5:11   ` Jeff Garzik
  2007-10-31  5:12   ` [PATCH 10/14] [ISDN] HiSax gazel: convert to modern ISA/PCI probing Jeff Garzik
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-10-31  5:11 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig   |    4 +-
 drivers/isdn/hisax/Makefile  |    2 +-
 drivers/isdn/hisax/avm_pci.c |  322 ++++++++++++++++++++++++++++++------------
 drivers/isdn/hisax/config.c  |   22 +---
 4 files changed, 235 insertions(+), 115 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 4f98afb..14951c0 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -132,8 +132,8 @@ config HISAX_AVM_A1
 	  non-standard IRQ/port settings.
 
 config HISAX_FRITZPCI
-	bool "AVM PnP/PCI (Fritz!PnP/PCI)"
-	depends on BROKEN || !PPC64
+	tristate "AVM PnP/PCI (Fritz!PnP/PCI)"
+	depends on (ISA || PNP || PCI) && (BROKEN || !PPC64)
 	help
 	  This enables HiSax support for the AVM "Fritz!PnP" and "Fritz!PCI".
 	  See <file:Documentation/isdn/README.HiSax> on how to configure it.
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index beb2c24..e5bd497 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -22,6 +22,7 @@ obj-$(CONFIG_HISAX_W6692)		+= w6692.o libhisax.o
 obj-$(CONFIG_HISAX_NETJET)		+= netjet_s.o libhisax.o
 obj-$(CONFIG_HISAX_NETJET_U)		+= netjet_u.o libhisax.o
 obj-$(CONFIG_HISAX_TELESPCI)		+= telespci.o libhisax.o
+obj-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
@@ -49,7 +50,6 @@ hisax-$(CONFIG_HISAX_16_3)		+= teles3.o
 hisax-$(CONFIG_HISAX_S0BOX)		+= s0box.o
 hisax-$(CONFIG_HISAX_AVM_A1)		+= avm_a1.o
 hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA)	+= avm_a1p.o
-hisax-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o
 hisax-$(CONFIG_HISAX_ELSA)		+= elsa.o
 hisax-$(CONFIG_HISAX_IX1MICROR2)	+= ix1_micro.o
 hisax-$(CONFIG_HISAX_DIEHLDIVA)		+= diva.o ipacx.o 
diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index 0f1db1f..69f8389 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -14,13 +14,20 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
+#include <linux/isa.h>
 #include <linux/isapnp.h>
 #include <linux/interrupt.h>
 
-static const char *avm_pci_rev = "$Revision: 1.29.2.4 $";
+static int avm_protocol;		/* 0 == use DEFAULT_PROTO */
+
+#ifdef CONFIG_ISA
+static int avm_irq;			/* 0 == disable ISA probing */
+static int avm_io_base;			/* 0 == disable ISA probing */
+#endif
 
 #define  AVM_FRITZ_PCI		1
 #define  AVM_FRITZ_PNP		2
@@ -767,136 +774,267 @@ static int __devinit avm_setup_rest(struct IsdnCardState *cs)
 	return (1);
 }
 
-#ifndef __ISAPNP__
+#ifdef CONFIG_ISA
 
-static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
+static int __devinit avm_isa_setup(struct IsdnCard *card)
 {
-	return(1);	/* no-op: success */
+	struct IsdnCardState *cs = card->cs;
+
+	/* old manual method */
+	cs->hw.avm.cfg_reg = avm_io_base;
+	cs->irq = avm_irq;
+	cs->subtyp = AVM_FRITZ_PNP;
+
+	return avm_setup_rest(cs);
 }
 
-#else
+static int __devinit avm_isa_init_one(struct device *dev, unsigned int id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_FRITZPCI, };
+	int cardnr;
 
-static struct pnp_card *pnp_avm_c __devinitdata = NULL;
+	icard.para[0] = (unsigned long) dev;
+	if (!avm_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = avm_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, avm_isa_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+	
+	dev_set_drvdata(dev, (void *)(unsigned long) cardnr);
+	return 0;
+}
 
-static int __devinit avm_pnp_setup(struct IsdnCardState *cs)
+static int __devexit avm_isa_remove_one(struct device *dev, unsigned int id)
 {
-	struct pnp_dev *pnp_avm_d = NULL;
+	int cardnr = (unsigned long) dev_get_drvdata(dev);
 
-	if (!isapnp_present())
-		return(1);	/* no-op: success */
+	HiSax_closecard(cardnr);
+	return 0;
+}
 
-	if ((pnp_avm_c = pnp_find_card(
-		ISAPNP_VENDOR('A', 'V', 'M'),
-		ISAPNP_FUNCTION(0x0900), pnp_avm_c))) {
-		if ((pnp_avm_d = pnp_find_dev(pnp_avm_c,
-			ISAPNP_VENDOR('A', 'V', 'M'),
-			ISAPNP_FUNCTION(0x0900), pnp_avm_d))) {
-			int err;
+static struct isa_driver avm_isa_driver = {
+	.probe		= avm_isa_init_one,
+	.remove		= __devexit_p(avm_isa_remove_one),
+	.driver = {
+		.owner	= THIS_MODULE,
+		.name	= "avm_pci",
+	},
+};
+
+#ifdef CONFIG_PNP
+static int __devinit avm_pnp_setup(struct IsdnCard *card)
+{
+	struct IsdnCardState *cs = card->cs;
+	struct pnp_dev *pnp_avm_d = (void *) card->para[0];
+	int err;
 
-			pnp_disable_dev(pnp_avm_d);
-			err = pnp_activate_dev(pnp_avm_d);
-			if (err<0) {
-				printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
-					__FUNCTION__, err);
-				return(0);
-			}
-			cs->hw.avm.cfg_reg =
-				pnp_port_start(pnp_avm_d, 0);
-			cs->irq = pnp_irq(pnp_avm_d, 0);
-			if (!cs->irq) {
-				printk(KERN_ERR "FritzPnP:No IRQ\n");
-				return(0);
-			}
-			if (!cs->hw.avm.cfg_reg) {
-				printk(KERN_ERR "FritzPnP:No IO address\n");
-				return(0);
-			}
-			cs->subtyp = AVM_FRITZ_PNP;
+	pnp_disable_dev(pnp_avm_d);
 
-			return (2);	/* goto 'ready' label */
-		}
+	err = pnp_activate_dev(pnp_avm_d);
+	if (err<0) {
+		printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
+			__FUNCTION__, err);
+		return(0);
 	}
 
-	return (1);
+	cs->irq = pnp_irq(pnp_avm_d, 0);
+	if (!cs->irq) {
+		printk(KERN_ERR "FritzPnP:No IRQ\n");
+		return(0);
+	}
+
+	cs->hw.avm.cfg_reg = pnp_port_start(pnp_avm_d, 0);
+	if (!cs->hw.avm.cfg_reg) {
+		printk(KERN_ERR "FritzPnP:No IO address\n");
+		return(0);
+	}
+	cs->subtyp = AVM_FRITZ_PNP;
+
+	return avm_setup_rest(cs);
 }
 
-#endif /* __ISAPNP__ */
+static int __devinit avm_pnp_init_one(struct pnp_dev *pdev,
+				       const struct pnp_device_id *dev_id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_FRITZPCI, };
+	int cardnr;
 
-#ifndef CONFIG_PCI_LEGACY
+	icard.para[0] = (unsigned long) pdev;
+	if (!avm_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = avm_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, avm_pnp_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+	
+	pnp_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
 
-static int __devinit avm_pci_setup(struct IsdnCardState *cs)
+static void __devexit avm_pnp_remove_one(struct pnp_dev *pdev)
 {
-	return(1);	/* no-op: success */
+	int cardnr = (unsigned long) pnp_get_drvdata(pdev);
+
+	HiSax_closecard(cardnr);
 }
 
-#else
+static struct pnp_device_id avm_pnp_table[] = {
+	{ .id = "AVM0900", },
 
-static struct pci_dev *dev_avm __devinitdata = NULL;
+	{ .id = "" }		/* terminate list */
+};
 
-static int __devinit avm_pci_setup(struct IsdnCardState *cs)
-{
-	if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
-		PCI_DEVICE_ID_AVM_A1, dev_avm))) {
+static struct pnp_driver avm_pnp_driver = {
+	.name		= "avm_pci",
+	.id_table	= avm_pnp_table,
+	.probe		= avm_pnp_init_one,
+	.remove		= __devexit_p(avm_pnp_remove_one),
+};
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
 
-		if (pci_enable_device(dev_avm))
-			return(0);
+#ifdef CONFIG_PCI
 
-		cs->irq = dev_avm->irq;
-		if (!cs->irq) {
-			printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n");
-			return(0);
-		}
+static int __devinit avm_pci_setup(struct IsdnCard *card)
+{
+	struct IsdnCardState *cs = card->cs;
+	struct pci_dev *dev_avm = (void *) card->para[0];
 
-		cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
-		if (!cs->hw.avm.cfg_reg) {
-			printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
-			return(0);
-		}
+	if (pci_enable_device(dev_avm))
+		return(0);
 
-		cs->subtyp = AVM_FRITZ_PCI;
-	} else {
-		printk(KERN_WARNING "FritzPCI: No PCI card found\n");
+	cs->irq = dev_avm->irq;
+	if (!cs->irq) {
+		printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n");
 		return(0);
 	}
 
+	cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
+	if (!cs->hw.avm.cfg_reg) {
+		printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
+		return(0);
+	}
+
+	cs->subtyp = AVM_FRITZ_PCI;
+
 	cs->irq_flags |= IRQF_SHARED;
 
-	return (1);
+	return avm_setup_rest(cs);
 }
 
-#endif /* CONFIG_PCI_LEGACY */
-
-int __devinit
-setup_avm_pcipnp(struct IsdnCard *card)
+static int __devinit avm_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
 {
-	struct IsdnCardState *cs = card->cs;
-	char tmp[64];
-	int rc;
+	struct IsdnCard icard = { ISDN_CTYPE_FRITZPCI, };
+	int cardnr;
 
-	strcpy(tmp, avm_pci_rev);
-	printk(KERN_INFO "HiSax: AVM PCI driver Rev. %s\n", HiSax_getrev(tmp));
+	icard.para[0] = (unsigned long) pdev;
+	if (!avm_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = avm_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, avm_pci_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+	
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
 
-	if (cs->typ != ISDN_CTYPE_FRITZPCI)
-		return (0);
+static struct pci_device_id avm_pci_table[] = {
+	{ PCI_VDEVICE(AVM, PCI_DEVICE_ID_AVM_A1) },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver avm_pci_driver = {
+	.name		= "avm_pci",
+	.id_table	= avm_pci_table,
+	.probe		= avm_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+#endif /* CONFIG_PCI */
 
-	if (card->para[1]) {
-		/* old manual method */
-		cs->hw.avm.cfg_reg = card->para[1];
-		cs->irq = card->para[0];
-		cs->subtyp = AVM_FRITZ_PNP;
-		goto ready;
+static int __init avm_mod_init(void)
+{
+	int rc = 0;
+
+#ifdef CONFIG_ISA
+	if (avm_irq && avm_io_base) {
+		rc = isa_register_driver(&avm_isa_driver, 1);
+		if (rc)
+			return rc;
+	}
+#ifdef CONFIG_PNP
+	else {
+		rc = pnp_register_driver(&avm_pnp_driver);
+		if (rc)
+			return rc;
 	}
+#endif
+#endif /* CONFIG_ISA */
 
-	rc = avm_pnp_setup(cs);
-	if (rc < 1)
-		return (0);
-	if (rc == 2)
-		goto ready;
+#ifdef CONFIG_PCI
+	rc = pci_register_driver(&avm_pci_driver);
+	if (rc)
+		goto err_out_isa;
+#endif /* CONFIG_PCI */
 
-	rc = avm_pci_setup(cs);
-	if (rc < 1)
-		return (0);
+	return 0;
 
-ready:
-	return avm_setup_rest(cs);
+#ifdef CONFIG_PCI
+err_out_isa:
+
+#ifdef CONFIG_ISA
+	if (avm_irq && avm_io_base)
+		isa_unregister_driver(&avm_isa_driver);
+#ifdef CONFIG_PNP
+	else
+		pnp_unregister_driver(&avm_pnp_driver);
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+
+	return rc;
+#endif /* CONFIG_PCI */
 }
+
+static void __exit avm_mod_exit(void)
+{
+#ifdef CONFIG_PCI
+	pci_unregister_driver(&avm_pci_driver);
+#endif /* CONFIG_PCI */
+
+#ifdef CONFIG_ISA
+	if (avm_irq && avm_io_base)
+		isa_unregister_driver(&avm_isa_driver);
+#ifdef CONFIG_PNP
+	else
+		pnp_unregister_driver(&avm_pnp_driver);
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+}
+
+module_init(avm_mod_init);
+module_exit(avm_mod_exit);
+
+#ifdef CONFIG_ISA
+module_param_named(irq, avm_irq, int, 0444);
+MODULE_PARM_DESC(irq, "ISA IRQ.  Zero disables ISA support (default).");
+
+module_param_named(io, avm_io_base, int, 0444);
+MODULE_PARM_DESC(io, "ISA I/O base.  Zero disables ISA support (default).");
+#endif /* CONFIG_ISA */
+
+module_param_named(protocol, avm_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, avm_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax Fritz!PCI/PNP driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 1df8c08..e6738a6 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -117,13 +117,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {11,0x170,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_FRITZPCI
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_FRITZPCI
-#define DEFAULT_CFG {0,0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_16_3
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -422,10 +415,6 @@ extern int setup_avm_a1(struct IsdnCard *card);
 extern int setup_avm_a1_pcmcia(struct IsdnCard *card);
 #endif
 
-#if CARD_FRITZPCI
-extern int setup_avm_pcipnp(struct IsdnCard *card);
-#endif
-
 #if CARD_ELSA
 extern int setup_elsa(struct IsdnCard *card);
 #endif
@@ -795,11 +784,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_avm_a1_pcmcia(card);
 		break;
 #endif
-#if CARD_FRITZPCI
-	case ISDN_CTYPE_FRITZPCI:
-		ret = setup_avm_pcipnp(card);
-		break;
-#endif
 #if CARD_ELSA
 	case ISDN_CTYPE_ELSA:
 	case ISDN_CTYPE_ELSA_PNP:
@@ -892,6 +876,7 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_NETJET_S:
 	case ISDN_CTYPE_NETJET_U:
 	case ISDN_CTYPE_TELESPCI:
+	case ISDN_CTYPE_FRITZPCI:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1339,7 +1324,6 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_TELES3C:
 		case ISDN_CTYPE_ACERP10:
 		case ISDN_CTYPE_S0BOX:
-		case ISDN_CTYPE_FRITZPCI:
 		case ISDN_CTYPE_HSTSAPHIR:
 		case ISDN_CTYPE_GAZEL:
 		case ISDN_CTYPE_HFC_SX:
@@ -1363,6 +1347,7 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_NETJET_S:
 		case ISDN_CTYPE_NETJET_U:
 		case ISDN_CTYPE_TELESPCI:
+		case ISDN_CTYPE_FRITZPCI:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1831,9 +1816,6 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
 #include <linux/pci.h>
 
 static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
-#ifdef CONFIG_HISAX_FRITZPCI
-	{PCI_VENDOR_ID_AVM,      PCI_DEVICE_ID_AVM_A1,           PCI_ANY_ID, PCI_ANY_ID},
-#endif
 #ifdef CONFIG_HISAX_DIEHLDIVA
 	{PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA20,     PCI_ANY_ID, PCI_ANY_ID},
 	{PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA20_U,   PCI_ANY_ID, PCI_ANY_ID},
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 10/14] [ISDN] HiSax gazel: convert to modern ISA/PCI probing
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (8 preceding siblings ...)
  2007-10-31  5:11   ` [PATCH 09/14] [ISDN] HiSax avm_pci: convert to modern PCI/ISA/PNP probing Jeff Garzik
@ 2007-10-31  5:12   ` Jeff Garzik
  2007-10-31  5:13   ` [PATCH 13/14] [ISDN] HiSax diva: convert to modern ISA/PNP/PCI probing Jeff Garzik
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-10-31  5:12 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig  |    3 +-
 drivers/isdn/hisax/Makefile |    2 +-
 drivers/isdn/hisax/config.c |   25 +----
 drivers/isdn/hisax/gazel.c  |  248 ++++++++++++++++++++++++++++++++----------
 4 files changed, 194 insertions(+), 84 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 14951c0..dbc296e 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -306,7 +306,8 @@ config HISAX_SCT_QUADRO
 	  settings.
 
 config HISAX_GAZEL
-	bool "Gazel cards"
+	tristate "Gazel cards"
+	depends on (ISA || PCI)
 	help
 	  This enables HiSax support for the Gazel cards.
 
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index e5bd497..10ab294 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_HISAX_NETJET)		+= netjet_s.o libhisax.o
 obj-$(CONFIG_HISAX_NETJET_U)		+= netjet_u.o libhisax.o
 obj-$(CONFIG_HISAX_TELESPCI)		+= telespci.o libhisax.o
 obj-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o libhisax.o
+obj-$(CONFIG_HISAX_GAZEL)		+= gazel.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
@@ -64,5 +65,4 @@ hisax-$(CONFIG_HISAX_NICCY)		+= niccy.o
 hisax-$(CONFIG_HISAX_ISURF)		+= isurf.o isar.o
 hisax-$(CONFIG_HISAX_HSTSAPHIR)		+= saphir.o
 hisax-$(CONFIG_HISAX_SCT_QUADRO)	+= bkm_a8.o
-hisax-$(CONFIG_HISAX_GAZEL)		+= gazel.o
 
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index e6738a6..63dba42 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -229,13 +229,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {1,0x0,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_GAZEL
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_GAZEL
-#define DEFAULT_CFG {15,0x180,0,0}
-#endif
-
 #ifndef DEFAULT_CARD
 #define DEFAULT_CARD 0
 #define DEFAULT_CFG {0,0,0,0}
@@ -471,10 +464,6 @@ extern int setup_saphir(struct IsdnCard *card);
 extern int setup_sct_quadro(struct IsdnCard *card);
 #endif
 
-#if CARD_GAZEL
-extern int setup_gazel(struct IsdnCard *card);
-#endif
-
 /*
  * Find card with given driverId
  */
@@ -860,11 +849,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_sct_quadro(card);
 		break;
 #endif
-#if CARD_GAZEL
-	case ISDN_CTYPE_GAZEL:
-		ret = setup_gazel(card);
-		break;
-#endif
 	case ISDN_CTYPE_DYNAMIC:
 		ret = 2;
 		break;
@@ -877,6 +861,7 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_NETJET_U:
 	case ISDN_CTYPE_TELESPCI:
 	case ISDN_CTYPE_FRITZPCI:
+	case ISDN_CTYPE_GAZEL:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1325,7 +1310,6 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_ACERP10:
 		case ISDN_CTYPE_S0BOX:
 		case ISDN_CTYPE_HSTSAPHIR:
-		case ISDN_CTYPE_GAZEL:
 		case ISDN_CTYPE_HFC_SX:
 		case ISDN_CTYPE_HFC_SP_PCMCIA:
 			cards[j].para[0] = irq[i];
@@ -1348,6 +1332,7 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_NETJET_U:
 		case ISDN_CTYPE_TELESPCI:
 		case ISDN_CTYPE_FRITZPCI:
+		case ISDN_CTYPE_GAZEL:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1828,12 +1813,6 @@ static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
 	{PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_MICROLINK,   PCI_ANY_ID, PCI_ANY_ID},
 	{PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_QS3000,      PCI_ANY_ID, PCI_ANY_ID},
 #endif
-#ifdef CONFIG_HISAX_GAZEL
-	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_R685,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_R753,         PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_DJINN_ITOO,   PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_OLITEC,       PCI_ANY_ID, PCI_ANY_ID},
-#endif
 #ifdef CONFIG_HISAX_SCT_QUADRO
 	{PCI_VENDOR_ID_PLX,      PCI_DEVICE_ID_PLX_9050,         PCI_ANY_ID, PCI_ANY_ID},
 #endif
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index 0ea3b46..db4cec7 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -13,12 +13,21 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "hscx.h"
 #include "isdnl1.h"
 #include "ipac.h"
+#include <linux/isa.h>
 #include <linux/pci.h>
 
+static int gazel_protocol;		/* 0 == use DEFAULT_PROTO */
+
+#ifdef CONFIG_ISA
+static int gazel_irq;			/* 0 == no ISA probing */
+static int gazel_io_base;		/* 0 == no ISA probing */
+#endif /* CONFIG_ISA */
+
 static const char *gazel_revision = "$Revision: 2.19.2.4 $";
 
 #define R647      1
@@ -483,7 +492,8 @@ reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs)
 	return 1;
 }
 
-static int __devinit
+#ifdef CONFIG_ISA
+static void __devinit
 setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
 {
 	printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n");
@@ -527,58 +537,35 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
 			       cs->irq, cs->hw.gazel.ipac);
 			break;
 	}
-
-	return (0);
 }
+#endif /* CONFIG_ISA */
 
-#ifdef CONFIG_PCI_LEGACY
-static struct pci_dev *dev_tel __devinitdata = NULL;
-
+#ifdef CONFIG_PCI
 static int __devinit
-setup_gazelpci(struct IsdnCardState *cs)
+setup_gazelpci(struct IsdnCard *card)
 {
 	u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0;
 	u_char pci_irq = 0, found;
-	u_int nbseek, seekcard;
+	u_int seekcard;
+	struct IsdnCardState *cs = card->cs;
+	struct pci_dev *dev_tel = (void *) card->para[0];
 
 	printk(KERN_WARNING "Gazel: PCI card automatic recognition\n");
 
 	found = 0;
-	seekcard = PCI_DEVICE_ID_PLX_R685;
-	for (nbseek = 0; nbseek < 4; nbseek++) {
-		if ((dev_tel = pci_find_device(PCI_VENDOR_ID_PLX,
-					seekcard, dev_tel))) {
-			if (pci_enable_device(dev_tel))
-				return 1;
-			pci_irq = dev_tel->irq;
-			pci_ioaddr0 = pci_resource_start(dev_tel, 1);
-			pci_ioaddr1 = pci_resource_start(dev_tel, 2);
-			found = 1;
-		}
-		if (found)
-			break;
-		else {
-			switch (seekcard) {
-				case PCI_DEVICE_ID_PLX_R685:
-					seekcard = PCI_DEVICE_ID_PLX_R753;
-					break;
-				case PCI_DEVICE_ID_PLX_R753:
-					seekcard = PCI_DEVICE_ID_PLX_DJINN_ITOO;
-					break;
-				case PCI_DEVICE_ID_PLX_DJINN_ITOO:
-					seekcard = PCI_DEVICE_ID_PLX_OLITEC;
-					break;
-			}
-		}
-	}
-	if (!found) {
-		printk(KERN_WARNING "Gazel: No PCI card found\n");
-		return (1);
-	}
+	seekcard = dev_tel->device;
+
+	if (pci_enable_device(dev_tel))
+		return 1;
+	pci_irq = dev_tel->irq;
+	pci_ioaddr0 = pci_resource_start(dev_tel, 1);
+	pci_ioaddr1 = pci_resource_start(dev_tel, 2);
+
 	if (!pci_irq) {
 		printk(KERN_WARNING "Gazel: No IRQ for PCI card found\n");
 		return 1;
 	}
+
 	cs->hw.gazel.pciaddr[0] = pci_ioaddr0;
 	cs->hw.gazel.pciaddr[1] = pci_ioaddr1;
 	setup_isac(cs);
@@ -620,10 +607,10 @@ setup_gazelpci(struct IsdnCardState *cs)
 
 	return (0);
 }
-#endif /* CONFIG_PCI_LEGACY */
+#endif /* CONFIG_PCI */
 
-int __devinit
-setup_gazel(struct IsdnCard *card)
+static int __devinit
+setup_gazel_rest(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
@@ -632,23 +619,6 @@ setup_gazel(struct IsdnCard *card)
 	strcpy(tmp, gazel_revision);
 	printk(KERN_INFO "Gazel: Driver Revision %s\n", HiSax_getrev(tmp));
 
-	if (cs->typ != ISDN_CTYPE_GAZEL)
-		return (0);
-
-	if (card->para[0]) {
-		if (setup_gazelisa(card, cs))
-			return (0);
-	} else {
-
-#ifdef CONFIG_PCI_LEGACY
-		if (setup_gazelpci(cs))
-			return (0);
-#else
-		printk(KERN_WARNING "Gazel: Card PCI requested and NO_PCI_BIOS, unable to config\n");
-		return (0);
-#endif				/* CONFIG_PCI */
-	}
-
 	if (reserve_regions(card, cs)) {
 		return (0);
 	}
@@ -688,3 +658,163 @@ setup_gazel(struct IsdnCard *card)
 
 	return (1);
 }
+
+#ifdef CONFIG_ISA
+
+static int __devinit gazel_isa_setup(struct IsdnCard *card)
+{
+	struct IsdnCardState *cs = card->cs;
+
+	setup_gazelisa(card, cs);
+
+	return setup_gazel_rest(card);
+}
+
+static int __devinit gazel_isa_init_one(struct device *dev, unsigned int id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_GAZEL, };
+	int cardnr;
+
+	icard.para[0] = gazel_irq;
+	icard.para[1] = gazel_io_base;
+	if (!gazel_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = gazel_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, gazel_isa_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	dev_set_drvdata(dev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static int __devexit gazel_isa_remove_one(struct device *dev, unsigned int id)
+{
+	int cardnr = (unsigned long) dev_get_drvdata(dev);
+
+	HiSax_closecard(cardnr);
+	return 0;
+}
+
+static struct isa_driver gazel_isa_driver = {
+	.probe		= gazel_isa_init_one,
+	.remove		= __devexit_p(gazel_isa_remove_one),
+	.driver = {
+		.owner	= THIS_MODULE,
+		.name	= "gazel_pci",
+	},
+};
+
+#endif /* CONFIG_ISA */
+
+#ifdef CONFIG_PCI
+
+static int __devinit gazel_pci_setup(struct IsdnCard *card)
+{
+	if (setup_gazelpci(card))
+		return 1;	/* error */
+
+	return setup_gazel_rest(card);
+}
+
+static int __devinit gazel_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_GAZEL, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	if (!gazel_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = gazel_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, gazel_pci_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static struct pci_device_id gazel_pci_table[] = {
+	{ PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_R685) },
+	{ PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_R753) },
+	{ PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_DJINN_ITOO) },
+	{ PCI_VDEVICE(PLX, PCI_DEVICE_ID_PLX_OLITEC) },
+
+	{ }		/* terminate list */
+};
+
+static struct pci_driver gazel_pci_driver = {
+	.name		= "gazel_pci",
+	.id_table	= gazel_pci_table,
+	.probe		= gazel_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
+
+#endif /* CONFIG_PCI */
+
+static int __init gazel_mod_init(void)
+{
+	int rc = 0;
+
+#ifdef CONFIG_ISA
+	if (gazel_irq && gazel_io_base) {
+		rc = isa_register_driver(&gazel_isa_driver, 1);
+		if (rc)
+			return rc;
+	}
+#endif /* CONFIG_ISA */
+
+#ifdef CONFIG_PCI
+	rc = pci_register_driver(&gazel_pci_driver);
+	if (rc)
+		goto err_out_isa;
+#endif /* CONFIG_PCI */
+
+	return 0;
+
+#ifdef CONFIG_PCI
+err_out_isa:
+
+#ifdef CONFIG_ISA
+	if (gazel_irq && gazel_io_base)
+		isa_unregister_driver(&gazel_isa_driver);
+#endif /* CONFIG_ISA */
+
+	return rc;
+#endif /* CONFIG_PCI */
+}
+
+static void __exit gazel_mod_exit(void)
+{
+#ifdef CONFIG_PCI
+	pci_unregister_driver(&gazel_pci_driver);
+#endif /* CONFIG_PCI */
+
+#ifdef CONFIG_ISA
+	if (gazel_irq && gazel_io_base)
+		isa_unregister_driver(&gazel_isa_driver);
+#endif /* CONFIG_ISA */
+}
+
+module_init(gazel_mod_init);
+module_exit(gazel_mod_exit);
+
+#ifdef CONFIG_ISA
+module_param_named(irq, gazel_irq, int, 0444);
+MODULE_PARM_DESC(irq, "ISA IRQ.  Zero disables ISA support (default).");
+
+module_param_named(io, gazel_io_base, int, 0444);
+MODULE_PARM_DESC(io, "ISA I/O base.  Zero disables ISA support (default).");
+#endif /* CONFIG_ISA */
+
+module_param_named(protocol, gazel_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, gazel_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax Gazel PCI/ISA driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 13/14] [ISDN] HiSax diva: convert to modern ISA/PNP/PCI probing
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (9 preceding siblings ...)
  2007-10-31  5:12   ` [PATCH 10/14] [ISDN] HiSax gazel: convert to modern ISA/PCI probing Jeff Garzik
@ 2007-10-31  5:13   ` Jeff Garzik
  2007-10-31  7:42   ` [PATCH 02/14] [ISDN] Hisax: eliminate many unnecessary references to CardType[] Jeff Garzik
  2008-02-16 19:17   ` [PATCH 12/14] [ISDN] HiSax avm_pci, niccy: minor PNP fixes and cleanups Jeff Garzik
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-10-31  5:13 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/Kconfig  |    3 +-
 drivers/isdn/hisax/Makefile |    3 +-
 drivers/isdn/hisax/config.c |   27 +---
 drivers/isdn/hisax/diva.c   |  453 ++++++++++++++++++++++++++-----------------
 4 files changed, 283 insertions(+), 203 deletions(-)

diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig
index 02cdc57..36af79f 100644
--- a/drivers/isdn/hisax/Kconfig
+++ b/drivers/isdn/hisax/Kconfig
@@ -165,7 +165,8 @@ config HISAX_IX1MICROR2
 	  non-standard IRQ/port settings.
 
 config HISAX_DIEHLDIVA
-	bool "Eicon.Diehl Diva cards"
+	tristate "Eicon.Diehl Diva cards"
+	depends on (ISA || PCI)
 	help
 	  This enables HiSax support for the Eicon.Diehl Diva none PRO
 	  versions passive ISDN cards.
diff --git a/drivers/isdn/hisax/Makefile b/drivers/isdn/hisax/Makefile
index 9efd189..bef1e0e 100644
--- a/drivers/isdn/hisax/Makefile
+++ b/drivers/isdn/hisax/Makefile
@@ -25,11 +25,13 @@ obj-$(CONFIG_HISAX_TELESPCI)		+= telespci.o libhisax.o
 obj-$(CONFIG_HISAX_FRITZPCI)		+= avm_pci.o libhisax.o
 obj-$(CONFIG_HISAX_GAZEL)		+= gazel.o libhisax.o
 obj-$(CONFIG_HISAX_NICCY)		+= niccy.o libhisax.o
+obj-$(CONFIG_HISAX_DIEHLDIVA)		+= hisaxdiva.o libhisax.o
 
 bkm_a4t_pci-y				:= bkm_a4t.o jade.o
 enternow-y				:= enternow_pci.o amd7930_fn.o
 netjet_s-y				:= nj_s.o
 netjet_u-y				:= nj_u.o icc.o
+hisaxdiva-y				:= diva.o ipacx.o 
 libhisax-y				:= netjet.o isac.o arcofi.o hscx.o
 
 ifdef CONFIG_HISAX_HDLC
@@ -54,7 +56,6 @@ hisax-$(CONFIG_HISAX_AVM_A1)		+= avm_a1.o
 hisax-$(CONFIG_HISAX_AVM_A1_PCMCIA)	+= avm_a1p.o
 hisax-$(CONFIG_HISAX_ELSA)		+= elsa.o
 hisax-$(CONFIG_HISAX_IX1MICROR2)	+= ix1_micro.o
-hisax-$(CONFIG_HISAX_DIEHLDIVA)		+= diva.o ipacx.o 
 hisax-$(CONFIG_HISAX_ASUSCOM)		+= asuscom.o
 hisax-$(CONFIG_HISAX_TELEINT)		+= teleint.o hfc_2bs0.o
 hisax-$(CONFIG_HISAX_SEDLBAUER)		+= sedlbauer.o isar.o
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index 243c7c9..f7d0818 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -145,13 +145,6 @@ const char *CardType[] = {
 #define DEFAULT_CFG {5,0x390,0,0}
 #endif
 
-#ifdef CONFIG_HISAX_DIEHLDIVA
-#undef DEFAULT_CARD
-#undef DEFAULT_CFG
-#define DEFAULT_CARD ISDN_CTYPE_DIEHLDIVA
-#define DEFAULT_CFG {0,0x0,0,0}
-#endif
-
 #ifdef CONFIG_HISAX_ASUSCOM
 #undef DEFAULT_CARD
 #undef DEFAULT_CFG
@@ -405,10 +398,6 @@ extern int setup_elsa(struct IsdnCard *card);
 extern int setup_ix1micro(struct IsdnCard *card);
 #endif
 
-#if CARD_DIEHLDIVA
-extern int setup_diva(struct IsdnCard *card);
-#endif
-
 #if CARD_ASUSCOM
 extern int setup_asuscom(struct IsdnCard *card);
 #endif
@@ -771,11 +760,6 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 		ret = setup_ix1micro(card);
 		break;
 #endif
-#if CARD_DIEHLDIVA
-	case ISDN_CTYPE_DIEHLDIVA:
-		ret = setup_diva(card);
-		break;
-#endif
 #if CARD_ASUSCOM
 	case ISDN_CTYPE_ASUSCOM:
 		ret = setup_asuscom(card);
@@ -843,6 +827,7 @@ static int __devinit hisax_cs_setup_card(struct IsdnCard *card)
 	case ISDN_CTYPE_FRITZPCI:
 	case ISDN_CTYPE_GAZEL:
 	case ISDN_CTYPE_NICCY:
+	case ISDN_CTYPE_DIEHLDIVA:
 		printk(KERN_WARNING "HiSax: Support for %s Card has moved "
 		       "to separate PCI driver module\n",
 		       CardType[card->typ]);
@@ -1278,7 +1263,6 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_ELSA_PNP:
 		case ISDN_CTYPE_ELSA_PCMCIA:
 		case ISDN_CTYPE_IX1MICROR2:
-		case ISDN_CTYPE_DIEHLDIVA:
 		case ISDN_CTYPE_ASUSCOM:
 		case ISDN_CTYPE_TELEINT:
 		case ISDN_CTYPE_SEDLBAUER:
@@ -1314,6 +1298,7 @@ static int __init HiSax_init(void)
 		case ISDN_CTYPE_FRITZPCI:
 		case ISDN_CTYPE_GAZEL:
 		case ISDN_CTYPE_NICCY:
+		case ISDN_CTYPE_DIEHLDIVA:
 			break;
 
 		case ISDN_CTYPE_SCT_QUADRO:
@@ -1782,14 +1767,6 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
 #include <linux/pci.h>
 
 static struct pci_device_id hisax_pci_tbl[] __devinitdata = {
-#ifdef CONFIG_HISAX_DIEHLDIVA
-	{PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA20,     PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA20_U,   PCI_ANY_ID, PCI_ANY_ID},
-	{PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA201,    PCI_ANY_ID, PCI_ANY_ID},
-//#########################################################################################	
-	{PCI_VENDOR_ID_EICON,    PCI_DEVICE_ID_EICON_DIVA202,    PCI_ANY_ID, PCI_ANY_ID},
-//#########################################################################################	
-#endif
 #ifdef CONFIG_HISAX_ELSA
 	{PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_MICROLINK,   PCI_ANY_ID, PCI_ANY_ID},
 	{PCI_VENDOR_ID_ELSA,     PCI_DEVICE_ID_ELSA_QS3000,      PCI_ANY_ID, PCI_ANY_ID},
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 2d67085..bcaddd9 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -17,13 +17,22 @@
 
 #include <linux/init.h>
 #include "hisax.h"
+#include "hisax_proto.h"
 #include "isac.h"
 #include "hscx.h"
 #include "ipac.h"
 #include "ipacx.h"
 #include "isdnl1.h"
 #include <linux/pci.h>
-#include <linux/isapnp.h>
+#include <linux/isa.h>
+#include <linux/pnp.h>
+
+static int diva_protocol;		/* 0 == use DEFAULT_PROTO */
+
+#ifdef CONFIG_ISA
+static int diva_irq;			/* 0 == disable ISA */
+static int diva_io_base;		/* 0 == disable ISA */
+#endif
 
 static const char *Diva_revision = "$Revision: 1.33.2.6 $";
 
@@ -908,6 +917,14 @@ static int __devinit setup_diva_common(struct IsdnCardState *cs)
 {
 	int bytecnt;
 	u_char val;
+	char tmp[64];
+
+	strcpy(tmp, Diva_revision);
+	printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n",
+	       HiSax_getrev(tmp));
+	if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
+		return(0);
+	cs->hw.diva.status = 0;
 
 	if ((cs->subtyp == DIVA_ISA) || (cs->subtyp == DIVA_IPAC_ISA))
 		bytecnt = 8;
@@ -997,7 +1014,7 @@ static int __devinit setup_diva_common(struct IsdnCardState *cs)
 
 #ifdef CONFIG_ISA
 
-static int __devinit setup_diva_isa(struct IsdnCard *card)
+static int __devinit diva_isa_setup(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
 	u_char val;
@@ -1028,173 +1045,192 @@ static int __devinit setup_diva_isa(struct IsdnCard *card)
 	}
 	cs->irq = card->para[0];
 
-	return (1);		/* card found */
+	return setup_diva_common(cs);
 }
 
-#else	/* if !CONFIG_ISA */
+static int __devinit diva_isa_init_one(struct device *dev, unsigned int id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_DIEHLDIVA, };
+	int cardnr;
+
+	icard.para[0] = diva_irq;
+	icard.para[1] = diva_io_base;
+	if (!diva_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = diva_protocol;
 
-static int __devinit setup_diva_isa(struct IsdnCard *card)
+	cardnr = hisax_init_hotplug(&icard, diva_isa_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	dev_set_drvdata(dev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static int __devexit diva_isa_remove_one(struct device *dev, unsigned int id)
 {
-	return (-1);	/* card not found; continue search */
+	int cardnr = (unsigned long) dev_get_drvdata(dev);
+
+	HiSax_closecard(cardnr);
+	return 0;
 }
 
-#endif	/* CONFIG_ISA */
-
-#ifdef __ISAPNP__
-static struct isapnp_device_id diva_ids[] __devinitdata = {
-	{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
-	  ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), 
-	  (unsigned long) "Diva picola" },
-	{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51),
-	  ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x51), 
-	  (unsigned long) "Diva picola" },
-	{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
-	  ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71), 
-	  (unsigned long) "Diva 2.0" },
-	{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x71),
-	  ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0x71), 
-	  (unsigned long) "Diva 2.0" },
-	{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
-	  ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1), 
-	  (unsigned long) "Diva 2.01" },
-	{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0xA1),
-	  ISAPNP_VENDOR('E', 'I', 'C'), ISAPNP_FUNCTION(0xA1), 
-	  (unsigned long) "Diva 2.01" },
-	{ 0, }
+static struct isa_driver diva_isa_driver = {
+	.probe		= diva_isa_init_one,
+	.remove		= __devexit_p(diva_isa_remove_one),
+	.driver = {
+		.owner	= THIS_MODULE,
+		.name	= "diva_isa",
+	},
 };
 
-static struct isapnp_device_id *ipid __devinitdata = &diva_ids[0];
-static struct pnp_card *pnp_c __devinitdata = NULL;
-
-static int __devinit setup_diva_isapnp(struct IsdnCard *card)
+#ifdef CONFIG_PNP
+static int __devinit diva_pnp_setup(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
-	struct pnp_dev *pnp_d;
+	struct pnp_dev *pnp_d = (void *) card->para[0];
+	int ipid_function = card->para[1];
+	int err;
+
+	printk(KERN_INFO "HiSax: DIVA PNP detected\n");
+	pnp_disable_dev(pnp_d);
+	err = pnp_activate_dev(pnp_d);
+	if (err < 0) {
+		printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
+			__func__, err);
+		return(0);
+	}
+	card->para[1] = pnp_port_start(pnp_d, 0);
+	card->para[0] = pnp_irq(pnp_d, 0);
+	if (!card->para[0] || !card->para[1]) {
+		printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
+			card->para[0], card->para[1]);
+		pnp_disable_dev(pnp_d);
+		return(0);
+	}
+	cs->hw.diva.cfg_reg  = card->para[1];
+	cs->irq = card->para[0];
+	if (ipid_function == 0xA1) {
+		cs->subtyp = DIVA_IPAC_ISA;
+		cs->hw.diva.ctrl = 0;
+		cs->hw.diva.isac =
+			card->para[1] + DIVA_IPAC_DATA;
+		cs->hw.diva.hscx =
+			card->para[1] + DIVA_IPAC_DATA;
+		cs->hw.diva.isac_adr =
+			card->para[1] + DIVA_IPAC_ADR;
+		cs->hw.diva.hscx_adr =
+			card->para[1] + DIVA_IPAC_ADR;
+		test_and_set_bit(HW_IPAC, &cs->HW_Flags);
+	} else {
+		cs->subtyp = DIVA_ISA;
+		cs->hw.diva.ctrl =
+			card->para[1] + DIVA_ISA_CTRL;
+		cs->hw.diva.isac =
+			card->para[1] + DIVA_ISA_ISAC_DATA;
+		cs->hw.diva.hscx =
+			card->para[1] + DIVA_HSCX_DATA;
+		cs->hw.diva.isac_adr =
+			card->para[1] + DIVA_ISA_ISAC_ADR;
+		cs->hw.diva.hscx_adr =
+			card->para[1] + DIVA_HSCX_ADR;
+	}
 
-	if (!isapnp_present())
-		return (-1);	/* card not found; continue search */
+	return setup_diva_common(cs);
+}
 
-	while(ipid->card_vendor) {
-		if ((pnp_c = pnp_find_card(ipid->card_vendor,
-			ipid->card_device, pnp_c))) {
-			pnp_d = NULL;
-			if ((pnp_d = pnp_find_dev(pnp_c,
-				ipid->vendor, ipid->function, pnp_d))) {
-				int err;
-
-				printk(KERN_INFO "HiSax: %s detected\n",
-					(char *)ipid->driver_data);
-				pnp_disable_dev(pnp_d);
-				err = pnp_activate_dev(pnp_d);
-				if (err<0) {
-					printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
-						__FUNCTION__, err);
-					return(0);
-				}
-				card->para[1] = pnp_port_start(pnp_d, 0);
-				card->para[0] = pnp_irq(pnp_d, 0);
-				if (!card->para[0] || !card->para[1]) {
-					printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
-						card->para[0], card->para[1]);
-					pnp_disable_dev(pnp_d); 
-					return(0);
-				}
-				cs->hw.diva.cfg_reg  = card->para[1];
-				cs->irq = card->para[0];
-				if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
-					cs->subtyp = DIVA_IPAC_ISA;
-					cs->hw.diva.ctrl = 0;
-					cs->hw.diva.isac =
-						card->para[1] + DIVA_IPAC_DATA;
-					cs->hw.diva.hscx =
-						card->para[1] + DIVA_IPAC_DATA;
-					cs->hw.diva.isac_adr =
-						card->para[1] + DIVA_IPAC_ADR;
-					cs->hw.diva.hscx_adr =
-						card->para[1] + DIVA_IPAC_ADR;
-					test_and_set_bit(HW_IPAC, &cs->HW_Flags);
-				} else {
-					cs->subtyp = DIVA_ISA;
-					cs->hw.diva.ctrl =
-						card->para[1] + DIVA_ISA_CTRL;
-					cs->hw.diva.isac =
-						card->para[1] + DIVA_ISA_ISAC_DATA;
-					cs->hw.diva.hscx =
-						card->para[1] + DIVA_HSCX_DATA;
-					cs->hw.diva.isac_adr =
-						card->para[1] + DIVA_ISA_ISAC_ADR;
-					cs->hw.diva.hscx_adr =
-						card->para[1] + DIVA_HSCX_ADR;
-				}
-				return (1);		/* card found */
-			} else {
-				printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
-				return(0);
-			}
-		}
-		ipid++;
-		pnp_c=NULL;
-	} 
+static int __devinit diva_pnp_init_one(struct pnp_dev *pdev,
+				       const struct pnp_device_id *dev_id)
+{
+	struct IsdnCard icard = { ISDN_CTYPE_DIEHLDIVA, };
+	int cardnr;
 
-	return (-1);	/* card not found; continue search */
-}
+	icard.para[0] = (unsigned long) pdev;
+	icard.para[1] = dev_id->driver_data;
+	if (!diva_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = diva_protocol;
 
-#else	/* if !ISAPNP */
+	cardnr = hisax_init_hotplug(&icard, diva_pnp_setup);
+	if (cardnr < 0)
+		return -ENODEV;
 
-static int __devinit setup_diva_isapnp(struct IsdnCard *card)
+	pnp_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
+}
+
+static void __devexit diva_pnp_remove_one(struct pnp_dev *pdev)
 {
-	return (-1);	/* card not found; continue search */
+	int cardnr = (unsigned long) pnp_get_drvdata(pdev);
+
+	HiSax_closecard(cardnr);
 }
 
-#endif	/* ISAPNP */
+static struct pnp_device_id diva_pnp_table[] = {
+	{ .id = "GDI0051", 0 },
+	{ .id = "GDI0071", 0 },
+	{ .id = "GDI00A1", 0xA1 },
+	{ .id = "EIC0051", 0 },
+	{ .id = "EIC0071", 0 },
+	{ .id = "EIC00A1", 0xA1 },
+
+	{ .id = "" }		/* terminate list */
+};
+
+MODULE_DEVICE_TABLE(pnp, diva_pnp_table);
+
+static struct pnp_driver diva_pnp_driver = {
+	.name		= "diva_pnp",
+	.id_table	= diva_pnp_table,
+	.probe		= diva_pnp_init_one,
+	.remove		= __devexit_p(diva_pnp_remove_one),
+};
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+
+#ifdef CONFIG_PCI
 
-#ifdef CONFIG_PCI_LEGACY
-static struct pci_dev *dev_diva __devinitdata = NULL;
-static struct pci_dev *dev_diva_u __devinitdata = NULL;
-static struct pci_dev *dev_diva201 __devinitdata = NULL;
-static struct pci_dev *dev_diva202 __devinitdata = NULL;
+enum diva_board_type {
+	diva20,
+	diva20_u,
+	diva201,
+	diva202,
+};
 
-static int __devinit setup_diva_pci(struct IsdnCard *card)
+static int __devinit diva_pci_setup(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
+	struct pci_dev *dev_diva = (void *) card->para[0];
+	enum diva_board_type btype = card->para[1];
 
 	cs->subtyp = 0;
-	if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON,
-		PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) {
-		if (pci_enable_device(dev_diva))
-			return(0);
+	cs->irq = dev_diva->irq;
+
+	if (pci_enable_device(dev_diva))
+		return(0);
+
+	if (btype == diva20) {
 		cs->subtyp = DIVA_PCI;
-		cs->irq = dev_diva->irq;
 		cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
-	} else if ((dev_diva_u = pci_find_device(PCI_VENDOR_ID_EICON,
-		PCI_DEVICE_ID_EICON_DIVA20_U, dev_diva_u))) {
-		if (pci_enable_device(dev_diva_u))
-			return(0);
+	} else if (btype == diva20_u) {
 		cs->subtyp = DIVA_PCI;
-		cs->irq = dev_diva_u->irq;
-		cs->hw.diva.cfg_reg = pci_resource_start(dev_diva_u, 2);
-	} else if ((dev_diva201 = pci_find_device(PCI_VENDOR_ID_EICON,
-		PCI_DEVICE_ID_EICON_DIVA201, dev_diva201))) {
-		if (pci_enable_device(dev_diva201))
-			return(0);
+		cs->hw.diva.cfg_reg = pci_resource_start(dev_diva, 2);
+	} else if (btype == diva201) {
 		cs->subtyp = DIVA_IPAC_PCI;
-		cs->irq = dev_diva201->irq;
 		cs->hw.diva.pci_cfg =
-			(ulong) ioremap(pci_resource_start(dev_diva201, 0), 4096);
+			(ulong) ioremap(pci_resource_start(dev_diva, 0), 4096);
 		cs->hw.diva.cfg_reg =
-			(ulong) ioremap(pci_resource_start(dev_diva201, 1), 4096);
-	} else if ((dev_diva202 = pci_find_device(PCI_VENDOR_ID_EICON,
-		PCI_DEVICE_ID_EICON_DIVA202, dev_diva202))) {
-		if (pci_enable_device(dev_diva202))
-			return(0);
+			(ulong) ioremap(pci_resource_start(dev_diva, 1), 4096);
+	} else if (btype == diva202) {
 		cs->subtyp = DIVA_IPACX_PCI;
-		cs->irq = dev_diva202->irq;
 		cs->hw.diva.pci_cfg =
-			(ulong) ioremap(pci_resource_start(dev_diva202, 0), 4096);
+			(ulong) ioremap(pci_resource_start(dev_diva, 0), 4096);
 		cs->hw.diva.cfg_reg =
-			(ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
+			(ulong) ioremap(pci_resource_start(dev_diva, 1), 4096);
 	} else {
-		return (-1);	/* card not found; continue search */
+		BUG();
 	}
 
 	if (!cs->irq) {
@@ -1226,58 +1262,123 @@ static int __devinit setup_diva_pci(struct IsdnCard *card)
 		cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg + DIVA_HSCX_ADR;
 	}
 
-	return (1);		/* card found */
+	return setup_diva_common(cs);
 }
 
-#else	/* if !CONFIG_PCI_LEGACY */
-
-static int __devinit setup_diva_pci(struct IsdnCard *card)
+static int __devinit diva_pci_init_one(struct pci_dev *pdev,
+				      const struct pci_device_id *ent)
 {
-	return (-1);	/* card not found; continue search */
+	struct IsdnCard icard = { ISDN_CTYPE_DIEHLDIVA, };
+	int cardnr;
+
+	icard.para[0] = (unsigned long) pdev;
+	icard.para[1] = ent->driver_data;
+	if (!diva_protocol)
+		icard.protocol = DEFAULT_PROTO;
+	else
+		icard.protocol = diva_protocol;
+
+	cardnr = hisax_init_hotplug(&icard, diva_pci_setup);
+	if (cardnr < 0)
+		return -ENODEV;
+
+	pci_set_drvdata(pdev, (void *)(unsigned long) cardnr);
+	return 0;
 }
 
-#endif	/* CONFIG_PCI_LEGACY */
+static struct pci_device_id diva_pci_table[] = {
+	{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20),	diva20 },
+	{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA20_U),	diva20_u },
+	{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA201),	diva201 },
+//###########################################################################
+	{ PCI_VDEVICE(EICON, PCI_DEVICE_ID_EICON_DIVA202),	diva202 },
+//###########################################################################
 
-int __devinit
-setup_diva(struct IsdnCard *card)
-{
-	int rc, have_card = 0;
-	struct IsdnCardState *cs = card->cs;
-	char tmp[64];
+	{ }		/* terminate list */
+};
 
-	strcpy(tmp, Diva_revision);
-	printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
-	if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
-		return(0);
-	cs->hw.diva.status = 0;
+static struct pci_driver diva_pci_driver = {
+	.name		= "diva",
+	.id_table	= diva_pci_table,
+	.probe		= diva_pci_init_one,
+	.remove		= hisax_pci_remove_one,
+};
 
-	rc = setup_diva_isa(card);
-	if (!rc)
-		return rc;
-	if (rc > 0) {
-		have_card = 1;
-		goto ready;
-	}
+#endif /* CONFIG_PCI */
 
-	rc = setup_diva_isapnp(card);
-	if (!rc)
-		return rc;
-	if (rc > 0) {
-		have_card = 1;
-		goto ready;
+static int __init diva_mod_init(void)
+{
+	int rc = 0;
+
+#ifdef CONFIG_ISA
+	if (diva_irq && diva_io_base) {
+		rc = isa_register_driver(&diva_isa_driver, 1);
+		if (rc)
+			return rc;
 	}
+#ifdef CONFIG_PNP
+	else {
+		rc = pnp_register_driver(&diva_pnp_driver);
+		if (rc)
+			return rc;
+	}
+#endif
+#endif /* CONFIG_ISA */
 
-	rc = setup_diva_pci(card);
-	if (!rc)
-		return rc;
-	if (rc > 0)
-		have_card = 1;
+#ifdef CONFIG_PCI
+	rc = pci_register_driver(&diva_pci_driver);
+	if (rc)
+		goto err_out_isa;
+#endif /* CONFIG_PCI */
 
-ready:
-	if (!have_card) {
-		printk(KERN_WARNING "Diva: No ISA, ISAPNP or PCI card found\n");
-		return(0);
-	}
+	return 0;
+
+#ifdef CONFIG_PCI
+err_out_isa:
+
+#ifdef CONFIG_ISA
+	if (diva_irq && diva_io_base)
+		isa_unregister_driver(&diva_isa_driver);
+#ifdef CONFIG_PNP
+	else
+		pnp_unregister_driver(&diva_pnp_driver);
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
 
-	return setup_diva_common(card->cs);
+	return rc;
+#endif /* CONFIG_PCI */
 }
+
+static void __exit diva_mod_exit(void)
+{
+#ifdef CONFIG_PCI
+	pci_unregister_driver(&diva_pci_driver);
+#endif /* CONFIG_PCI */
+
+#ifdef CONFIG_ISA
+	if (diva_irq && diva_io_base)
+		isa_unregister_driver(&diva_isa_driver);
+#ifdef CONFIG_PNP
+	else
+		pnp_unregister_driver(&diva_pnp_driver);
+#endif /* CONFIG_PNP */
+#endif /* CONFIG_ISA */
+}
+
+module_init(diva_mod_init);
+module_exit(diva_mod_exit);
+
+#ifdef CONFIG_ISA
+module_param_named(irq, diva_irq, int, 0444);
+MODULE_PARM_DESC(irq, "ISA IRQ.  Zero disables ISA support (default).");
+
+module_param_named(io, diva_io_base, int, 0444);
+MODULE_PARM_DESC(io, "ISA I/O base.  Zero disables ISA support (default).");
+#endif /* CONFIG_ISA */
+
+module_param_named(protocol, diva_protocol, int, 0444);
+MODULE_PARM_DESC(protocol, "Values 0 (default) through 4. See ISDN_PTYPE_xxx in linux/isdnif.h");
+
+MODULE_DEVICE_TABLE(pci, diva_pci_table);
+MODULE_DESCRIPTION("ISDN HiSax Diehldiva PCI/PNP/ISA driver");
+MODULE_LICENSE("GPL");
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 02/14] [ISDN] Hisax: eliminate many unnecessary references to CardType[]
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (10 preceding siblings ...)
  2007-10-31  5:13   ` [PATCH 13/14] [ISDN] HiSax diva: convert to modern ISA/PNP/PCI probing Jeff Garzik
@ 2007-10-31  7:42   ` Jeff Garzik
  2008-02-16 19:17   ` [PATCH 12/14] [ISDN] HiSax avm_pci, niccy: minor PNP fixes and cleanups Jeff Garzik
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2007-10-31  7:42 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

For the vast majority of CardType[card->typ] uses (but not all!),
the string is constant for each driver.  Therefore, we may replace
CardType[card->typ] with the actual string describing the driver, making
each printk() a bit more simple.

This also has the nice, intended side effect of greatly reducing
external references to hisax global CardType[].  This will be of value
once the ISDN drivers are converted to the ISA/PCI/PNP hotplug APIs.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/asuscom.c   |    5 +----
 drivers/isdn/hisax/avm_a1.c    |   27 +++++++++------------------
 drivers/isdn/hisax/bkm_a4t.c   |   19 ++++++++++---------
 drivers/isdn/hisax/bkm_a8.c    |   31 +++++++++++++------------------
 drivers/isdn/hisax/gazel.c     |    5 ++---
 drivers/isdn/hisax/hfc_pci.c   |    2 --
 drivers/isdn/hisax/hfc_sx.c    |    2 --
 drivers/isdn/hisax/isurf.c     |   13 ++++---------
 drivers/isdn/hisax/ix1_micro.c |    9 ++++-----
 drivers/isdn/hisax/mic.c       |    5 +----
 drivers/isdn/hisax/netjet.h    |    2 --
 drivers/isdn/hisax/niccy.c     |   19 ++++++++-----------
 drivers/isdn/hisax/nj_s.c      |    3 +--
 drivers/isdn/hisax/nj_u.c      |    4 ++--
 drivers/isdn/hisax/s0box.c     |   13 ++++---------
 drivers/isdn/hisax/saphir.c    |    8 +++-----
 drivers/isdn/hisax/sportster.c |   11 +++++------
 drivers/isdn/hisax/teleint.c   |    5 +----
 drivers/isdn/hisax/telespci.c  |    5 ++---
 drivers/isdn/hisax/w6692.c     |    2 --
 20 files changed, 70 insertions(+), 120 deletions(-)

diff --git a/drivers/isdn/hisax/asuscom.c b/drivers/isdn/hisax/asuscom.c
index 61e69e9..b96f318 100644
--- a/drivers/isdn/hisax/asuscom.c
+++ b/drivers/isdn/hisax/asuscom.c
@@ -20,8 +20,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
-
 static const char *Asuscom_revision = "$Revision: 1.14.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -376,8 +374,7 @@ setup_asuscom(struct IsdnCard *card)
 	cs->irq = card->para[0];
 	if (!request_region(cs->hw.asus.cfg_reg, bytecnt, "asuscom isdn")) {
 		printk(KERN_WARNING
-		       "HiSax: %s config port %x-%x already in use\n",
-		       CardType[card->typ],
+		       "HiSax: ISDNLink config port %x-%x already in use\n",
 		       cs->hw.asus.cfg_reg,
 		       cs->hw.asus.cfg_reg + bytecnt);
 		return (0);
diff --git a/drivers/isdn/hisax/avm_a1.c b/drivers/isdn/hisax/avm_a1.c
index d9028e9..eb6b432 100644
--- a/drivers/isdn/hisax/avm_a1.c
+++ b/drivers/isdn/hisax/avm_a1.c
@@ -16,7 +16,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
 static const char *avm_revision = "$Revision: 2.15.2.4 $";
 
 #define	 AVM_A1_STAT_ISAC	0x01
@@ -200,16 +199,14 @@ setup_avm_a1(struct IsdnCard *card)
 	cs->irq = card->para[0];
 	if (!request_region(cs->hw.avm.cfg_reg, 8, "avm cfg")) {
 		printk(KERN_WARNING
-		       "HiSax: %s config port %x-%x already in use\n",
-		       CardType[card->typ],
+		       "HiSax: AVM A1 config port %x-%x already in use\n",
 		       cs->hw.avm.cfg_reg,
 		       cs->hw.avm.cfg_reg + 8);
 		return (0);
 	}
 	if (!request_region(cs->hw.avm.isac + 32, 32, "HiSax isac")) {
 		printk(KERN_WARNING
-		       "HiSax: %s isac ports %x-%x already in use\n",
-		       CardType[cs->typ],
+		       "HiSax: AVM A1 isac ports %x-%x already in use\n",
 		       cs->hw.avm.isac + 32,
 		       cs->hw.avm.isac + 64);
 		release_ioregs(cs, 0);
@@ -217,16 +214,14 @@ setup_avm_a1(struct IsdnCard *card)
 	}
 	if (!request_region(cs->hw.avm.isacfifo, 1, "HiSax isac fifo")) {
 		printk(KERN_WARNING
-		       "HiSax: %s isac fifo port %x already in use\n",
-		       CardType[cs->typ],
+		       "HiSax: AVM A1 isac fifo port %x already in use\n",
 		       cs->hw.avm.isacfifo);
 		release_ioregs(cs, 1);
 		return (0);
 	}
 	if (!request_region(cs->hw.avm.hscx[0] + 32, 32, "HiSax hscx A")) {
 		printk(KERN_WARNING
-		       "HiSax: %s hscx A ports %x-%x already in use\n",
-		       CardType[cs->typ],
+		       "HiSax: AVM A1 hscx A ports %x-%x already in use\n",
 		       cs->hw.avm.hscx[0] + 32,
 		       cs->hw.avm.hscx[0] + 64);
 		release_ioregs(cs, 3);
@@ -234,16 +229,14 @@ setup_avm_a1(struct IsdnCard *card)
 	}
 	if (!request_region(cs->hw.avm.hscxfifo[0], 1, "HiSax hscx A fifo")) {
 		printk(KERN_WARNING
-		       "HiSax: %s hscx A fifo port %x already in use\n",
-		       CardType[cs->typ],
+		       "HiSax: AVM A1 hscx A fifo port %x already in use\n",
 		       cs->hw.avm.hscxfifo[0]);
 		release_ioregs(cs, 7);
 		return (0);
 	}
 	if (!request_region(cs->hw.avm.hscx[1] + 32, 32, "HiSax hscx B")) {
 		printk(KERN_WARNING
-		       "HiSax: %s hscx B ports %x-%x already in use\n",
-		       CardType[cs->typ],
+		       "HiSax: AVM A1 hscx B ports %x-%x already in use\n",
 		       cs->hw.avm.hscx[1] + 32,
 		       cs->hw.avm.hscx[1] + 64);
 		release_ioregs(cs, 0xf);
@@ -251,8 +244,7 @@ setup_avm_a1(struct IsdnCard *card)
 	}
 	if (!request_region(cs->hw.avm.hscxfifo[1], 1, "HiSax hscx B fifo")) {
 		printk(KERN_WARNING
-		       "HiSax: %s hscx B fifo port %x already in use\n",
-		       CardType[cs->typ],
+		       "HiSax: AVM A1 hscx B fifo port %x already in use\n",
 		       cs->hw.avm.hscxfifo[1]);
 		release_ioregs(cs, 0x1f);
 		return (0);
@@ -284,9 +276,8 @@ setup_avm_a1(struct IsdnCard *card)
 	printk(KERN_INFO "AVM A1: Byte at %x is %x\n",
 	       cs->hw.avm.cfg_reg, val);
 
-	printk(KERN_INFO
-	       "HiSax: %s config irq:%d cfg:0x%X\n",
-	       CardType[cs->typ], cs->irq,
+	printk(KERN_INFO "HiSax: AVM A1 config irq:%d cfg:0x%X\n",
+	       cs->irq,
 	       cs->hw.avm.cfg_reg);
 	printk(KERN_INFO
 	       "HiSax: isac:0x%X/0x%X\n",
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index 3d1bdc8..9ca2ee5 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -20,8 +20,6 @@
 #include <linux/pci.h>
 #include "bkm_ax.h"
 
-extern const char *CardType[];
-
 static const char *bkm_a4t_revision = "$Revision: 1.22.2.4 $";
 
 
@@ -284,15 +282,16 @@ static int __devinit a4t_cs_init(struct IsdnCard *card,
 	I20_REGISTER_FILE *pI20_Regs;
 
 	if (!cs->irq) {		/* IRQ range check ?? */
-		printk(KERN_WARNING "HiSax: %s: No IRQ\n", CardType[card->typ]);
+		printk(KERN_WARNING "HiSax: Telekom A4T: No IRQ\n");
 		return (0);
 	}
 	cs->hw.ax.base = (long) ioremap(pci_memaddr, 4096);
 	/* Check suspecious address */
 	pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base);
 	if ((pI20_Regs->i20IntStatus & 0x8EFFFFFF) != 0) {
-		printk(KERN_WARNING "HiSax: %s address %lx-%lx suspecious\n",
-		       CardType[card->typ], cs->hw.ax.base, cs->hw.ax.base + 4096);
+		printk(KERN_WARNING "HiSax: Telekom A4T address "
+		       "%lx-%lx suspicious\n",
+		       cs->hw.ax.base, cs->hw.ax.base + 4096);
 		iounmap((void *) cs->hw.ax.base);
 		cs->hw.ax.base = 0;
 		return (0);
@@ -302,8 +301,9 @@ static int __devinit a4t_cs_init(struct IsdnCard *card,
 	cs->hw.ax.isac_ale = GCS_1;
 	cs->hw.ax.jade_ale = GCS_3;
 
-	printk(KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n",
-	       CardType[card->typ], cs->hw.ax.base, cs->irq);
+	printk(KERN_INFO "HiSax: Telekom A4T: Card configured at "
+	       "0x%lX IRQ %d\n",
+	       cs->hw.ax.base, cs->irq);
 
 	setup_isac(cs);
 	cs->readisac = &ReadISAC;
@@ -349,11 +349,12 @@ setup_bkm_a4t(struct IsdnCard *card)
 			break;
 	}
 	if (!found) {
-		printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]);
+		printk(KERN_WARNING "HiSax: Telekom A4T: Card not found\n");
 		return (0);
 	}
 	if (!pci_memaddr) {
-		printk(KERN_WARNING "HiSax: %s: No Memory base address\n", CardType[card->typ]);
+		printk(KERN_WARNING "HiSax: Telekom A4T: "
+		       "No Memory base address\n");
 		return (0);
 	}
 
diff --git a/drivers/isdn/hisax/bkm_a8.c b/drivers/isdn/hisax/bkm_a8.c
index 99ef3b4..e1ff471 100644
--- a/drivers/isdn/hisax/bkm_a8.c
+++ b/drivers/isdn/hisax/bkm_a8.c
@@ -22,8 +22,6 @@
 
 #define	ATTEMPT_PCI_REMAPPING	/* Required for PLX rev 1 */
 
-extern const char *CardType[];
-
 static const char sct_quadro_revision[] = "$Revision: 1.22.2.4 $";
 
 static const char *sct_quadro_subtypes[] =
@@ -181,8 +179,7 @@ bkm_interrupt_ipac(int intno, void *dev_id)
 		goto Start_IPAC;
 	}
 	if (!icnt)
-		printk(KERN_WARNING "HiSax: %s (%s) IRQ LOOP\n",
-		       CardType[cs->typ],
+		printk(KERN_WARNING "HiSax: Scitel Quadro (%s) IRQ LOOP\n",
 		       sct_quadro_subtypes[cs->subtyp]);
 	writereg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_MASK, 0xFF);
 	writereg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_MASK, 0xC0);
@@ -296,8 +293,8 @@ setup_sct_quadro(struct IsdnCard *card)
 	if (card->para[0] >= SCT_1 && card->para[0] <= SCT_4)
 		cs->subtyp = card->para[0];
 	else {
-		printk(KERN_WARNING "HiSax: %s: Invalid subcontroller in configuration, default to 1\n",
-			CardType[card->typ]);
+		printk(KERN_WARNING "HiSax: Scitel Quadro: Invalid "
+		       "subcontroller in configuration, default to 1\n");
 		return (0);
 	}
 	if ((cs->subtyp != SCT_1) && ((sub_sys_id != PCI_DEVICE_ID_BERKOM_SCITEL_QUADRO) ||
@@ -322,16 +319,16 @@ setup_sct_quadro(struct IsdnCard *card)
 			}
 		}
 		if (!found) {
-			printk(KERN_WARNING "HiSax: %s (%s): Card not found\n",
-				CardType[card->typ],
+			printk(KERN_WARNING "HiSax: Scitel Quadro (%s): "
+				"Card not found\n",
 				sct_quadro_subtypes[cs->subtyp]);
 			return (0);
 		}
 #ifdef ATTEMPT_PCI_REMAPPING
 /* HACK: PLX revision 1 bug: PLX address bit 7 must not be set */
 		if ((pci_ioaddr1 & 0x80) && (dev_a8->revision == 1)) {
-			printk(KERN_WARNING "HiSax: %s (%s): PLX rev 1, remapping required!\n",
-				CardType[card->typ],
+			printk(KERN_WARNING "HiSax: Scitel Quadro (%s): "
+				"PLX rev 1, remapping required!\n",
 				sct_quadro_subtypes[cs->subtyp]);
 			/* Restart PCI negotiation */
 			pci_write_config_dword(dev_a8, PCI_BASE_ADDRESS_1, (u_int) - 1);
@@ -344,8 +341,7 @@ setup_sct_quadro(struct IsdnCard *card)
 #endif /* End HACK */
 	}
 	if (!pci_irq) {		/* IRQ range check ?? */
-		printk(KERN_WARNING "HiSax: %s (%s): No IRQ\n",
-		       CardType[card->typ],
+		printk(KERN_WARNING "HiSax: Scitel Quadro (%s): No IRQ\n",
 		       sct_quadro_subtypes[cs->subtyp]);
 		return (0);
 	}
@@ -355,8 +351,8 @@ setup_sct_quadro(struct IsdnCard *card)
 	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_4, &pci_ioaddr4);
 	pci_read_config_dword(dev_a8, PCI_BASE_ADDRESS_5, &pci_ioaddr5);
 	if (!pci_ioaddr1 || !pci_ioaddr2 || !pci_ioaddr3 || !pci_ioaddr4 || !pci_ioaddr5) {
-		printk(KERN_WARNING "HiSax: %s (%s): No IO base address(es)\n",
-		       CardType[card->typ],
+		printk(KERN_WARNING "HiSax: Scitel Quadro (%s): "
+		       "No IO base address(es)\n",
 		       sct_quadro_subtypes[cs->subtyp]);
 		return (0);
 	}
@@ -411,8 +407,8 @@ setup_sct_quadro(struct IsdnCard *card)
 	/* For isac and hscx data path */
 	cs->hw.ax.data_adr = cs->hw.ax.base + 4;
 
-	printk(KERN_INFO "HiSax: %s (%s) configured at 0x%.4lX, 0x%.4lX, 0x%.4lX and IRQ %d\n",
-	       CardType[card->typ],
+	printk(KERN_INFO "HiSax: Scitel Quadro (%s) configured at "
+	       "0x%.4lX, 0x%.4lX, 0x%.4lX and IRQ %d\n",
 	       sct_quadro_subtypes[cs->subtyp],
 	       cs->hw.ax.plx_adr,
 	       cs->hw.ax.base,
@@ -432,8 +428,7 @@ setup_sct_quadro(struct IsdnCard *card)
 	cs->cardmsg = &BKM_card_msg;
 	cs->irq_func = &bkm_interrupt_ipac;
 
-	printk(KERN_INFO "HiSax: %s (%s): IPAC Version %d\n",
-		CardType[card->typ],
+	printk(KERN_INFO "HiSax: Scitel Quadro (%s): IPAC Version %d\n",
 		sct_quadro_subtypes[cs->subtyp],
 		readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID));
 	return (1);
diff --git a/drivers/isdn/hisax/gazel.c b/drivers/isdn/hisax/gazel.c
index f66620a..0ea3b46 100644
--- a/drivers/isdn/hisax/gazel.c
+++ b/drivers/isdn/hisax/gazel.c
@@ -19,7 +19,6 @@
 #include "ipac.h"
 #include <linux/pci.h>
 
-extern const char *CardType[];
 static const char *gazel_revision = "$Revision: 2.19.2.4 $";
 
 #define R647      1
@@ -479,8 +478,8 @@ reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs)
 	return 0;
 
       error:
-	printk(KERN_WARNING "Gazel: %s io ports 0x%x-0x%x already in use\n",
-	       CardType[cs->typ], adr, adr + len);
+	printk(KERN_WARNING "Gazel: io ports 0x%x-0x%x already in use\n",
+	       adr, adr + len);
 	return 1;
 }
 
diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
index fba8b62..f126566 100644
--- a/drivers/isdn/hisax/hfc_pci.c
+++ b/drivers/isdn/hisax/hfc_pci.c
@@ -22,8 +22,6 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 
-extern const char *CardType[];
-
 static const char *hfcpci_revision = "$Revision: 1.48.2.4 $";
 
 /* table entry in the PCI devices list */
diff --git a/drivers/isdn/hisax/hfc_sx.c b/drivers/isdn/hisax/hfc_sx.c
index 05482d2..f4a2138 100644
--- a/drivers/isdn/hisax/hfc_sx.c
+++ b/drivers/isdn/hisax/hfc_sx.c
@@ -18,8 +18,6 @@
 #include <linux/interrupt.h>
 #include <linux/isapnp.h>
 
-extern const char *CardType[];
-
 static const char *hfcsx_revision = "$Revision: 1.12.2.5 $";
 
 /***************************************/
diff --git a/drivers/isdn/hisax/isurf.c b/drivers/isdn/hisax/isurf.c
index 55de069..ca41617 100644
--- a/drivers/isdn/hisax/isurf.c
+++ b/drivers/isdn/hisax/isurf.c
@@ -17,8 +17,6 @@
 #include "isdnl1.h"
 #include <linux/isapnp.h>
 
-extern const char *CardType[];
-
 static const char *ISurf_revision = "$Revision: 1.12.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -251,22 +249,19 @@ setup_isurf(struct IsdnCard *card)
 			return(0);
 		}
 #else
-		printk(KERN_WARNING "HiSax: %s port/mem not set\n",
-			CardType[card->typ]);
+		printk(KERN_WARNING "HiSax: Siemens I-Surf port/mem not set\n");
 		return (0);
 #endif
 	}
 	if (!request_region(cs->hw.isurf.reset, 1, "isurf isdn")) {
 		printk(KERN_WARNING
-			"HiSax: %s config port %x already in use\n",
-			CardType[card->typ],
+			"HiSax: Siemens I-Surf config port %x already in use\n",
 			cs->hw.isurf.reset);
 			return (0);
 	}
 	if (!request_region(cs->hw.isurf.phymem, ISURF_IOMEM_SIZE, "isurf iomem")) {
-		printk(KERN_WARNING
-			"HiSax: %s memory region %lx-%lx already in use\n",
-			CardType[card->typ],
+		printk(KERN_WARNING "HiSax: Siemens I-Surf memory region "
+			"%lx-%lx already in use\n",
 			cs->hw.isurf.phymem,
 			cs->hw.isurf.phymem + ISURF_IOMEM_SIZE);
 		release_region(cs->hw.isurf.reset, 1);
diff --git a/drivers/isdn/hisax/ix1_micro.c b/drivers/isdn/hisax/ix1_micro.c
index 252d79d..2d18d4f 100644
--- a/drivers/isdn/hisax/ix1_micro.c
+++ b/drivers/isdn/hisax/ix1_micro.c
@@ -24,7 +24,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
 static const char *ix1_revision = "$Revision: 2.12.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -288,15 +287,15 @@ setup_ix1micro(struct IsdnCard *card)
 	if (cs->hw.ix1.cfg_reg) {
 		if (!request_region(cs->hw.ix1.cfg_reg, 4, "ix1micro cfg")) {
 			printk(KERN_WARNING
-			  "HiSax: %s config port %x-%x already in use\n",
-			       CardType[card->typ],
+			  "HiSax: ITK ix1-micro Rev.2 config port "
+			  "%x-%x already in use\n",
 			       cs->hw.ix1.cfg_reg,
 			       cs->hw.ix1.cfg_reg + 4);
 			return (0);
 		}
 	}
-	printk(KERN_INFO "HiSax: %s config irq:%d io:0x%X\n",
-		CardType[cs->typ], cs->irq, cs->hw.ix1.cfg_reg);
+	printk(KERN_INFO "HiSax: ITK ix1-micro Rev.2 config irq:%d io:0x%X\n",
+		cs->irq, cs->hw.ix1.cfg_reg);
 	setup_isac(cs);
 	cs->readisac = &ReadISAC;
 	cs->writeisac = &WriteISAC;
diff --git a/drivers/isdn/hisax/mic.c b/drivers/isdn/hisax/mic.c
index a81d175..2539430 100644
--- a/drivers/isdn/hisax/mic.c
+++ b/drivers/isdn/hisax/mic.c
@@ -16,8 +16,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
-
 static const char *mic_revision = "$Revision: 1.12.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -210,8 +208,7 @@ setup_mic(struct IsdnCard *card)
 
 	if (!request_region(cs->hw.mic.cfg_reg, bytecnt, "mic isdn")) {
 		printk(KERN_WARNING
-		       "HiSax: %s config port %x-%x already in use\n",
-		       CardType[card->typ],
+		       "HiSax: ith mic config port %x-%x already in use\n",
 		       cs->hw.mic.cfg_reg,
 		       cs->hw.mic.cfg_reg + bytecnt);
 		return (0);
diff --git a/drivers/isdn/hisax/netjet.h b/drivers/isdn/hisax/netjet.h
index 4d89d3e..68e504d 100644
--- a/drivers/isdn/hisax/netjet.h
+++ b/drivers/isdn/hisax/netjet.h
@@ -12,8 +12,6 @@
  *
  */
 
-extern const char *CardType[];
-
 #define byteout(addr,val) outb(val,addr)
 #define bytein(addr) inb(addr)
 
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index bd99211..421b8e6 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -21,7 +21,6 @@
 #include <linux/pci.h>
 #include <linux/isapnp.h>
 
-extern const char *CardType[];
 static const char *niccy_revision = "$Revision: 1.21.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -284,14 +283,14 @@ int __devinit setup_niccy(struct IsdnCard *card)
 		cs->subtyp = NICCY_PNP;
 		cs->irq = card->para[0];
 		if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
-			printk(KERN_WARNING "HiSax: %s data port %x-%x "
-				"already in use\n", CardType[card->typ],
+			printk(KERN_WARNING "HiSax: NICCY data port %x-%x "
+				"already in use\n",
 				cs->hw.niccy.isac, cs->hw.niccy.isac + 1);
 			return 0;
 		}
 		if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
-			printk(KERN_WARNING "HiSax: %s address port %x-%x "
-				"already in use\n", CardType[card->typ],
+			printk(KERN_WARNING "HiSax: NICCY address port %x-%x "
+				"already in use\n",
 				cs->hw.niccy.isac_ale,
 				cs->hw.niccy.isac_ale + 1);
 			release_region(cs->hw.niccy.isac, 2);
@@ -339,15 +338,13 @@ int __devinit setup_niccy(struct IsdnCard *card)
 		cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
 		if (!request_region(cs->hw.niccy.isac, 4, "niccy")) {
 			printk(KERN_WARNING
-			       "HiSax: %s data port %x-%x already in use\n",
-			       CardType[card->typ],
+			       "HiSax: NICCY data port %x-%x already in use\n",
 			       cs->hw.niccy.isac, cs->hw.niccy.isac + 4);
 			return 0;
 		}
 		if (!request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci")) {
 			printk(KERN_WARNING
-			       "HiSax: %s pci port %x-%x already in use\n",
-			       CardType[card->typ],
+			       "HiSax: NICCY pci port %x-%x already in use\n",
 			       cs->hw.niccy.cfg_reg,
 			       cs->hw.niccy.cfg_reg + 0x40);
 			release_region(cs->hw.niccy.isac, 4);
@@ -359,8 +356,8 @@ int __devinit setup_niccy(struct IsdnCard *card)
 		return 0;
 #endif				/* CONFIG_PCI_LEGACY */
 	}
-	printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
-		CardType[cs->typ], (cs->subtyp == 1) ? "PnP" : "PCI",
+	printk(KERN_INFO "HiSax: NICCY %s config irq:%d data:0x%X ale:0x%X\n",
+		(cs->subtyp == 1) ? "PnP" : "PCI",
 		cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
 	setup_isac(cs);
 	cs->readisac = &ReadISAC;
diff --git a/drivers/isdn/hisax/nj_s.c b/drivers/isdn/hisax/nj_s.c
index a895dfe..8d36ccc 100644
--- a/drivers/isdn/hisax/nj_s.c
+++ b/drivers/isdn/hisax/nj_s.c
@@ -235,8 +235,7 @@ static int __devinit njs_cs_init_rest(struct IsdnCard *card,
 		cs->subtyp ? "TJ320" : "TJ300", cs->hw.njet.base, cs->irq);
 	if (!request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn")) {
 		printk(KERN_WARNING
-		       "HiSax: %s config port %#lx-%#lx already in use\n",
-		       CardType[card->typ],
+		       "HiSax: NETjet-S config port %#lx-%#lx already in use\n",
 		       cs->hw.njet.base,
 		       cs->hw.njet.base + bytecnt);
 		return (0);
diff --git a/drivers/isdn/hisax/nj_u.c b/drivers/isdn/hisax/nj_u.c
index f017d38..d306c94 100644
--- a/drivers/isdn/hisax/nj_u.c
+++ b/drivers/isdn/hisax/nj_u.c
@@ -197,8 +197,8 @@ static int __devinit nju_cs_init_rest(struct IsdnCard *card,
 		cs->hw.njet.base, cs->irq);
 	if (!request_region(cs->hw.njet.base, bytecnt, "netspider-u isdn")) {
 		printk(KERN_WARNING
-		       "HiSax: %s config port %#lx-%#lx already in use\n",
-		       CardType[card->typ],
+		       "HiSax: NETspider-U config port %#lx-%#lx "
+		       "already in use\n",
 		       cs->hw.njet.base,
 		       cs->hw.njet.base + bytecnt);
 		return (0);
diff --git a/drivers/isdn/hisax/s0box.c b/drivers/isdn/hisax/s0box.c
index 150ef68..16d00b5 100644
--- a/drivers/isdn/hisax/s0box.c
+++ b/drivers/isdn/hisax/s0box.c
@@ -16,7 +16,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
 static const char *s0box_revision = "$Revision: 2.6.2.4 $";
 
 static inline void
@@ -231,19 +230,15 @@ setup_s0box(struct IsdnCard *card)
 	cs->hw.teles3.hscxfifo[1] = cs->hw.teles3.hscx[1] + 0x3e;
 	cs->irq = card->para[0];
 	if (!request_region(cs->hw.teles3.cfg_reg,8, "S0Box parallel I/O")) {
-		printk(KERN_WARNING
-		       "HiSax: %s ports %x-%x already in use\n",
-		       CardType[cs->typ],
+		printk(KERN_WARNING "HiSax: S0Box ports %x-%x already in use\n",
                        cs->hw.teles3.cfg_reg,
                        cs->hw.teles3.cfg_reg + 7);
 		return 0;
 	}
-	printk(KERN_INFO
-		"HiSax: %s config irq:%d isac:0x%x  cfg:0x%x\n",
-		CardType[cs->typ], cs->irq,
+	printk(KERN_INFO "HiSax: S0Box config irq:%d isac:0x%x  cfg:0x%x\n",
+		cs->irq,
 		cs->hw.teles3.isac, cs->hw.teles3.cfg_reg);
-	printk(KERN_INFO
-		"HiSax: hscx A:0x%x  hscx B:0x%x\n",
+	printk(KERN_INFO "HiSax: hscx A:0x%x  hscx B:0x%x\n",
 		cs->hw.teles3.hscx[0], cs->hw.teles3.hscx[1]);
 	setup_isac(cs);
 	cs->readisac = &ReadISAC;
diff --git a/drivers/isdn/hisax/saphir.c b/drivers/isdn/hisax/saphir.c
index c99b166..b34a81d 100644
--- a/drivers/isdn/hisax/saphir.c
+++ b/drivers/isdn/hisax/saphir.c
@@ -18,7 +18,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
 static char *saphir_rev = "$Revision: 1.10.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -260,15 +259,14 @@ setup_saphir(struct IsdnCard *card)
 	cs->irq = card->para[0];
 	if (!request_region(cs->hw.saphir.cfg_reg, 6, "saphir")) {
 		printk(KERN_WARNING
-			"HiSax: %s config port %x-%x already in use\n",
-			CardType[card->typ],
+			"HiSax: HST Saphir config port %x-%x already in use\n",
 			cs->hw.saphir.cfg_reg,
 			cs->hw.saphir.cfg_reg + 5);
 		return (0);
 	}
 
-	printk(KERN_INFO "HiSax: %s config irq:%d io:0x%X\n",
-		CardType[cs->typ], cs->irq, cs->hw.saphir.cfg_reg);
+	printk(KERN_INFO "HiSax: HST Saphir config irq:%d io:0x%X\n",
+	       cs->irq, cs->hw.saphir.cfg_reg);
 
 	setup_isac(cs);
 	cs->hw.saphir.timer.function = (void *) SaphirWatchDog;
diff --git a/drivers/isdn/hisax/sportster.c b/drivers/isdn/hisax/sportster.c
index 0220950..0a53759 100644
--- a/drivers/isdn/hisax/sportster.c
+++ b/drivers/isdn/hisax/sportster.c
@@ -18,7 +18,6 @@
 #include "hscx.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
 static const char *sportster_revision = "$Revision: 1.16.2.4 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -192,9 +191,9 @@ get_io_range(struct IsdnCardState *cs)
 	for (i=0;i<64;i++) {
 		adr = cs->hw.spt.cfg_reg + i *1024;
 		if (!request_region(adr, 8, "sportster")) {
-			printk(KERN_WARNING
-				"HiSax: %s config port %x-%x already in use\n",
-				CardType[cs->typ], adr, adr + 8);
+			printk(KERN_WARNING "HiSax: USR Sportster config port "
+				"%x-%x already in use\n",
+				adr, adr + 8);
 			break;
 		} 
 	}
@@ -247,8 +246,8 @@ setup_sportster(struct IsdnCard *card)
 			printk(KERN_WARNING "Sportster: wrong IRQ\n");
 			return(0);
 	}
-	printk(KERN_INFO "HiSax: %s config irq:%d cfg:0x%X\n",
-		CardType[cs->typ], cs->irq, cs->hw.spt.cfg_reg);
+	printk(KERN_INFO "HiSax: USR Sportster config irq:%d cfg:0x%X\n",
+		cs->irq, cs->hw.spt.cfg_reg);
 	setup_isac(cs);
 	cs->readisac = &ReadISAC;
 	cs->writeisac = &WriteISAC;
diff --git a/drivers/isdn/hisax/teleint.c b/drivers/isdn/hisax/teleint.c
index 0909662..b0ce4ae 100644
--- a/drivers/isdn/hisax/teleint.c
+++ b/drivers/isdn/hisax/teleint.c
@@ -16,8 +16,6 @@
 #include "hfc_2bs0.h"
 #include "isdnl1.h"
 
-extern const char *CardType[];
-
 static const char *TeleInt_revision = "$Revision: 1.16.2.5 $";
 
 #define byteout(addr,val) outb(val,addr)
@@ -286,8 +284,7 @@ setup_TeleInt(struct IsdnCard *card)
 	init_timer(&cs->hw.hfc.timer);
 	if (!request_region(cs->hw.hfc.addr, 2, "TeleInt isdn")) {
 		printk(KERN_WARNING
-		       "HiSax: %s config port %x-%x already in use\n",
-		       CardType[card->typ],
+		       "HiSax: TeleInt config port %x-%x already in use\n",
 		       cs->hw.hfc.addr,
 		       cs->hw.hfc.addr + 2);
 		return (0);
diff --git a/drivers/isdn/hisax/telespci.c b/drivers/isdn/hisax/telespci.c
index 4393003..28b08de 100644
--- a/drivers/isdn/hisax/telespci.c
+++ b/drivers/isdn/hisax/telespci.c
@@ -19,7 +19,6 @@
 #include "isdnl1.h"
 #include <linux/pci.h>
 
-extern const char *CardType[];
 static const char *telespci_revision = "$Revision: 2.23.2.3 $";
 
 #define ZORAN_PO_RQ_PEN	0x02000000
@@ -329,8 +328,8 @@ setup_telespci(struct IsdnCard *card)
 	/* writel(0x00800000, cs->hw.teles0.membase + 0x200); */
 
 	printk(KERN_INFO
-	       "HiSax: %s config irq:%d mem:%p\n",
-	       CardType[cs->typ], cs->irq,
+	       "HiSax: Teles PCI config irq:%d mem:%p\n",
+	       cs->irq,
 	       cs->hw.teles0.membase);
 
 	setup_isac(cs);
diff --git a/drivers/isdn/hisax/w6692.c b/drivers/isdn/hisax/w6692.c
index 39129b9..bb1c8dd 100644
--- a/drivers/isdn/hisax/w6692.c
+++ b/drivers/isdn/hisax/w6692.c
@@ -38,8 +38,6 @@ static const PCI_ENTRY id_list[] =
 #define W6692_DYNALINK 1
 #define W6692_USR      2
 
-extern const char *CardType[];
-
 static const char *w6692_revision = "$Revision: 1.18.2.4 $";
 
 #define DBUSY_TIMER_VALUE 80
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 01/14] [ISDN] HiSax: modularization prep
  2008-02-16  4:41 [PATCH 00/14] [ISDN] convert HiSax to hotplug APIs Jeff Garzik
@ 2008-02-16  4:41 ` Jeff Garzik
  2007-07-18  3:46   ` [PATCH 04/14] [ISDN] HiSax bkm_a4t: convert to PCI hotplug API Jeff Garzik
                     ` (12 more replies)
  2008-02-17 19:52 ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Sam Ravnborg
  1 sibling, 13 replies; 48+ messages in thread
From: Jeff Garzik @ 2008-02-16  4:41 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Pass a function pointer into the core HiSax probe function checkcard(),
in order to facilitate modular drivers passing in their own setup
routines.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/config.c    |   14 +++++++++-----
 drivers/isdn/hisax/hisax_cfg.h |    2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index a0ee43c..84d75a3 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -1169,7 +1169,9 @@ outf_cs:
 /* Used from an exported function but calls __devinit functions.
  * Tell modpost not to warn (__ref)
  */
-static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *lockowner)
+static int __ref checkcard(int cardnr, char *id, int *busy_flag,
+			   struct module *lockowner,
+			   hisax_setup_func_t card_setup)
 {
 	int ret;
 	struct IsdnCard *card = cards + cardnr;
@@ -1187,7 +1189,7 @@ static int __ref checkcard(int cardnr, char *id, int *busy_flag, struct module *
 	       (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
 	       "NONE", cs->iif.id, cs->myid);
 
-	ret = hisax_cs_setup_card(card);
+	ret = card_setup(card);
 	if (!ret) {
 		ll_unload(cs);
 		goto outf_cs;
@@ -1241,7 +1243,8 @@ static int HiSax_inithardware(int *busy_flag)
 			else
 				sprintf(ids, "%s%d", id, i);
 		}
-		if (checkcard(i, ids, busy_flag, THIS_MODULE)) {
+		if (checkcard(i, ids, busy_flag, THIS_MODULE,
+			      hisax_cs_setup_card)) {
 			foundcards++;
 			i++;
 		} else {
@@ -1549,7 +1552,8 @@ int hisax_init_pcmcia(void *pcm_iob, int *busy_flag, struct IsdnCard *card)
 		sprintf(ids, "HiSax%d", nrcards);
 	else
 		sprintf(ids, "HiSax");
-	if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE))
+	if (!checkcard(nrcards, ids, busy_flag, THIS_MODULE,
+		       hisax_cs_setup_card))
 		goto error;
 
 	ret = nrcards;
@@ -1595,7 +1599,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
 	cards[i].protocol = protocol;
 	sprintf(id, "%s%d", name, i);
 	nrcards++;
-	retval = checkcard(i, id, NULL, hisax_d_if->owner);
+	retval = checkcard(i, id, NULL, hisax_d_if->owner, hisax_cs_setup_card);
 	if (retval == 0) { // yuck
 		cards[i].typ = 0;
 		nrcards--;
diff --git a/drivers/isdn/hisax/hisax_cfg.h b/drivers/isdn/hisax/hisax_cfg.h
index ca3fe62..17a2fea 100644
--- a/drivers/isdn/hisax/hisax_cfg.h
+++ b/drivers/isdn/hisax/hisax_cfg.h
@@ -60,5 +60,7 @@ struct IsdnCard {
 	IsdnCardState_t	*cs;
 };
 
+typedef int (*hisax_setup_func_t)(struct IsdnCard *card);
+
 extern void	HiSax_closecard(int);
 extern int	hisax_init_pcmcia(void *, int *, IsdnCard_t *);
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH 00/14] [ISDN] convert HiSax to hotplug APIs
@ 2008-02-16  4:41 Jeff Garzik
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
  2008-02-17 19:52 ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Sam Ravnborg
  0 siblings, 2 replies; 48+ messages in thread
From: Jeff Garzik @ 2008-02-16  4:41 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

This is the next revision of the ISDN hotplug conversion patches.

Changes since last version:
- handled ml comments
- checkpatch fixes
- moved proto.h addition into correct changeset
- separated some bug fixes out from the diva changeset, into
  their own changeset.

Work remaining:

- convert elsa
- convert sedlbauer
- test
- address akpm's problem report?



^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH 12/14] [ISDN] HiSax avm_pci, niccy: minor PNP fixes and cleanups
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
                     ` (11 preceding siblings ...)
  2007-10-31  7:42   ` [PATCH 02/14] [ISDN] Hisax: eliminate many unnecessary references to CardType[] Jeff Garzik
@ 2008-02-16 19:17   ` Jeff Garzik
  12 siblings, 0 replies; 48+ messages in thread
From: Jeff Garzik @ 2008-02-16 19:17 UTC (permalink / raw)
  To: kkeil, isdn4linux, linux-kernel

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
---
 drivers/isdn/hisax/avm_pci.c |    9 ++++++---
 drivers/isdn/hisax/niccy.c   |    2 ++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/hisax/avm_pci.c b/drivers/isdn/hisax/avm_pci.c
index 69f8389..0b420aa 100644
--- a/drivers/isdn/hisax/avm_pci.c
+++ b/drivers/isdn/hisax/avm_pci.c
@@ -781,8 +781,8 @@ static int __devinit avm_isa_setup(struct IsdnCard *card)
 	struct IsdnCardState *cs = card->cs;
 
 	/* old manual method */
-	cs->hw.avm.cfg_reg = avm_io_base;
-	cs->irq = avm_irq;
+	cs->hw.avm.cfg_reg = card->para[1];
+	cs->irq = card->para[0];
 	cs->subtyp = AVM_FRITZ_PNP;
 
 	return avm_setup_rest(cs);
@@ -793,7 +793,8 @@ static int __devinit avm_isa_init_one(struct device *dev, unsigned int id)
 	struct IsdnCard icard = { ISDN_CTYPE_FRITZPCI, };
 	int cardnr;
 
-	icard.para[0] = (unsigned long) dev;
+	icard.para[0] = avm_irq;
+	icard.para[1] = avm_io_base;
 	if (!avm_protocol)
 		icard.protocol = DEFAULT_PROTO;
 	else
@@ -889,6 +890,8 @@ static struct pnp_device_id avm_pnp_table[] = {
 	{ .id = "" }		/* terminate list */
 };
 
+MODULE_DEVICE_TABLE(pnp, avm_pnp_table);
+
 static struct pnp_driver avm_pnp_driver = {
 	.name		= "avm_pci",
 	.id_table	= avm_pnp_table,
diff --git a/drivers/isdn/hisax/niccy.c b/drivers/isdn/hisax/niccy.c
index ef48515..cbe1432 100644
--- a/drivers/isdn/hisax/niccy.c
+++ b/drivers/isdn/hisax/niccy.c
@@ -397,6 +397,8 @@ static struct pnp_device_id niccy_pnp_table[] = {
 	{ .id = "" }		/* terminate list */
 };
 
+MODULE_DEVICE_TABLE(pnp, niccy_pnp_table);
+
 static struct pnp_driver niccy_pnp_driver = {
 	.name		= "niccy",
 	.id_table	= niccy_pnp_table,
-- 
1.5.3.8


^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-16  4:41 [PATCH 00/14] [ISDN] convert HiSax to hotplug APIs Jeff Garzik
  2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
@ 2008-02-17 19:52 ` Sam Ravnborg
  2008-02-18  4:52   ` Greg KH
  1 sibling, 1 reply; 48+ messages in thread
From: Sam Ravnborg @ 2008-02-17 19:52 UTC (permalink / raw)
  To: kkeil, isdn4linux; +Cc: linux-kernel, Jeff Garzik

Hi Karsten et al.

Seeing the work Jeff puts into ISDN I was wondering what are the
state of mISDN. Will we soon see mISDN hit the tree or has
development stalled?

I was wondering if Jeff should go for the much simpler patch:

diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index 66f946a..e904e9e 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -4,6 +4,7 @@

 menuconfig ISDN
        tristate "ISDN support"
+       depends on BROKEN
        depends on NET
        depends on !S390
        ---help---

Especially considering the minimal feedback from the isdn
community and the existence of a total? replacement.

	Sam

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-17 19:52 ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Sam Ravnborg
@ 2008-02-18  4:52   ` Greg KH
  2008-02-18 12:08     ` Andi Kleen
  0 siblings, 1 reply; 48+ messages in thread
From: Greg KH @ 2008-02-18  4:52 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Sun, Feb 17, 2008 at 08:52:35PM +0100, Sam Ravnborg wrote:
> Hi Karsten et al.
> 
> Seeing the work Jeff puts into ISDN I was wondering what are the
> state of mISDN. Will we soon see mISDN hit the tree or has
> development stalled?
> 
> I was wondering if Jeff should go for the much simpler patch:

If Jeff does that, I still can't drop those PCI functions from the PCI
core, which I desperatly want to do as they do not play nice with modern
systems (meaning hotplug...).

So either way, I think his patches should go in.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-18 12:08     ` Andi Kleen
@ 2008-02-18 12:04       ` Alan Cox
  2008-02-18 12:36       ` Jeff Garzik
  2008-02-19  8:50       ` Sam Ravnborg
  2 siblings, 0 replies; 48+ messages in thread
From: Alan Cox @ 2008-02-18 12:04 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Greg KH, Sam Ravnborg, kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Mon, 18 Feb 2008 13:08:33 +0100
Andi Kleen <andi@firstfloor.org> wrote:

> Greg KH <greg@kroah.com> writes:
> >
> > If Jeff does that, I still can't drop those PCI functions from the PCI
> > core, which I desperatly want to do as they do not play nice with modern
> > systems (meaning hotplug...).
> >
> > So either way, I think his patches should go in.
> 
> Merging essentially untested patches does not seem like a good strategy.
> And there is definitely still a large ISDN user base too.
> 
> My personal guess is that there are far more ISDN users than (non cardbus)
> PCI/PCI-e hotplug users.

pci_find_ breaks Cardbus too in some cases. It should die. So either we
apply the patches or mark the offenders as BROKEN. Clearly they are not
maintained as they've been left broken this way for ages and are not
going to get fixed unless persuasion is applied.

Alan

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-18  4:52   ` Greg KH
@ 2008-02-18 12:08     ` Andi Kleen
  2008-02-18 12:04       ` Alan Cox
                         ` (2 more replies)
  0 siblings, 3 replies; 48+ messages in thread
From: Andi Kleen @ 2008-02-18 12:08 UTC (permalink / raw)
  To: Greg KH; +Cc: Sam Ravnborg, kkeil, isdn4linux, linux-kernel, Jeff Garzik

Greg KH <greg@kroah.com> writes:
>
> If Jeff does that, I still can't drop those PCI functions from the PCI
> core, which I desperatly want to do as they do not play nice with modern
> systems (meaning hotplug...).
>
> So either way, I think his patches should go in.

Merging essentially untested patches does not seem like a good strategy.
And there is definitely still a large ISDN user base too.

My personal guess is that there are far more ISDN users than (non cardbus)
PCI/PCI-e hotplug users.

-Andi

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-18 12:08     ` Andi Kleen
  2008-02-18 12:04       ` Alan Cox
@ 2008-02-18 12:36       ` Jeff Garzik
  2008-02-18 13:29         ` Andi Kleen
  2008-02-19  8:50       ` Sam Ravnborg
  2 siblings, 1 reply; 48+ messages in thread
From: Jeff Garzik @ 2008-02-18 12:36 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Greg KH, Sam Ravnborg, kkeil, isdn4linux, linux-kernel

Andi Kleen wrote:
> Merging essentially untested patches does not seem like a good strategy.

Agreed.  I don't want my stuff going in without knowing it works.


> And there is definitely still a large ISDN user base too.

This is what I'm curious about.  My personal guess is that there is a 
lot of ISDN hardware available, but not necessarily the telco ISDN 
availability.  But I have no way to gauge the Linux ISDN userbase size 
(beyond responses from isdn maintainers and list users), so I'm a poor 
judge.

	Jeff




^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-18 12:36       ` Jeff Garzik
@ 2008-02-18 13:29         ` Andi Kleen
  0 siblings, 0 replies; 48+ messages in thread
From: Andi Kleen @ 2008-02-18 13:29 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Andi Kleen, Greg KH, Sam Ravnborg, kkeil, isdn4linux, linux-kernel

Jeff Garzik <jeff@garzik.org> writes:

>> And there is definitely still a large ISDN user base too.
>
> This is what I'm curious about.  My personal guess is that there is a
> lot of ISDN hardware available, but not necessarily the telco ISDN
> availability.  

At least Germany has about 100% ISDN telco availability. I don't know
the exact numbers of how many people use ISDN, but it is likely
into the double digit millions. The big ex monopoly telco has been pushing
ISDN aggressively for quite some time.

-Andi

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-18 12:08     ` Andi Kleen
  2008-02-18 12:04       ` Alan Cox
  2008-02-18 12:36       ` Jeff Garzik
@ 2008-02-19  8:50       ` Sam Ravnborg
  2008-02-19  9:25         ` Gregory Nietsky
  2008-02-19  9:40         ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Andi Kleen
  2 siblings, 2 replies; 48+ messages in thread
From: Sam Ravnborg @ 2008-02-19  8:50 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Mon, Feb 18, 2008 at 01:08:33PM +0100, Andi Kleen wrote:
> Greg KH <greg@kroah.com> writes:
> >
> > If Jeff does that, I still can't drop those PCI functions from the PCI
> > core, which I desperatly want to do as they do not play nice with modern
> > systems (meaning hotplug...).
> >
> > So either way, I think his patches should go in.
> 
> Merging essentially untested patches does not seem like a good strategy.
> And there is definitely still a large ISDN user base too.
Only issue seems that this large ISDN user base is not very active
in respect to Linux driver development.
Or at least not judging from the missing responses to their
mailing list and the limited traffic on said mailing list.

Reading the isdn4linux it is obvious that the way forward are the
mISDN code base so maybe that explains why noone steps up and 
test the patches of Jeff's.

If noone in the isdn community step up and take some responsibility
for the current isdn drivers in Linux then we should just delete them.
If anyone cares they can always be forwardported or even better we can 
integrate the much more flexible mISDN solution.

> My personal guess is that there are far more ISDN users than (non cardbus)
> PCI/PCI-e hotplug users.

My guess is that very very few uses ISDN in combination with a recent kernel.
Hmm, wonder if it is more fun hacking isdn drivers than kbuild
stuff and section mismatches ;-)

	Sam

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  8:50       ` Sam Ravnborg
@ 2008-02-19  9:25         ` Gregory Nietsky
  2008-02-19  9:54           ` Sam Ravnborg
  2008-02-20 14:19           ` Tilman Schmidt
  2008-02-19  9:40         ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Andi Kleen
  1 sibling, 2 replies; 48+ messages in thread
From: Gregory Nietsky @ 2008-02-19  9:25 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Andi Kleen, Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

ive been hackin away at mISDN for a while and use it with recent kernels 
  2.6.2X and have a patch for 2.6.24 (move from semaphore to complition) 
the distro we built is heavily reliant on mISDN (voip) i dont use the 
isdn kernel drivers at all any longer.

im all for mISDN been mainlined into the kernel and the old stuff been 
removed there could be users still it is marked as depricated and the 
plan was with 2.6 to use mISDN from the start.


Greg

Sam Ravnborg wrote:
> On Mon, Feb 18, 2008 at 01:08:33PM +0100, Andi Kleen wrote:
>> Greg KH <greg@kroah.com> writes:
>>> If Jeff does that, I still can't drop those PCI functions from the PCI
>>> core, which I desperatly want to do as they do not play nice with modern
>>> systems (meaning hotplug...).
>>>
>>> So either way, I think his patches should go in.
>> Merging essentially untested patches does not seem like a good strategy.
>> And there is definitely still a large ISDN user base too.
> Only issue seems that this large ISDN user base is not very active
> in respect to Linux driver development.
> Or at least not judging from the missing responses to their
> mailing list and the limited traffic on said mailing list.
> 
> Reading the isdn4linux it is obvious that the way forward are the
> mISDN code base so maybe that explains why noone steps up and 
> test the patches of Jeff's.
> 
> If noone in the isdn community step up and take some responsibility
> for the current isdn drivers in Linux then we should just delete them.
> If anyone cares they can always be forwardported or even better we can 
> integrate the much more flexible mISDN solution.
> 
>> My personal guess is that there are far more ISDN users than (non cardbus)
>> PCI/PCI-e hotplug users.
> 
> My guess is that very very few uses ISDN in combination with a recent kernel.
> Hmm, wonder if it is more fun hacking isdn drivers than kbuild
> stuff and section mismatches ;-)
> 
> 	Sam
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


--

This message has been scanned for viruses and

dangerous content by Superset Technology, and 

is believed to be clean.

http://www.superset.co.za



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  8:50       ` Sam Ravnborg
  2008-02-19  9:25         ` Gregory Nietsky
@ 2008-02-19  9:40         ` Andi Kleen
  2008-02-19  9:56           ` Sam Ravnborg
  1 sibling, 1 reply; 48+ messages in thread
From: Andi Kleen @ 2008-02-19  9:40 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Andi Kleen, Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Tue, Feb 19, 2008 at 09:50:33AM +0100, Sam Ravnborg wrote:
> Only issue seems that this large ISDN user base is not very active
> in respect to Linux driver development.

They don't need to because this stuff basically works and there isn't
much new hardware anymore and no new standards and it also doesn't really
need much tuning.

Or rather the new hardware development (like Asterisk support etc.) 
seemed to be mostly done on out of tree mISDN.

> If noone in the isdn community step up and take some responsibility
> for the current isdn drivers in Linux then we should just delete them.

So you're saying anything that has no active maintainer should 
be immediately deleted?

I suspect after you would be done with that a lot of (working) code in Linux
would be gone. 

-Andi


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:25         ` Gregory Nietsky
@ 2008-02-19  9:54           ` Sam Ravnborg
  2008-02-20 14:19           ` Tilman Schmidt
  1 sibling, 0 replies; 48+ messages in thread
From: Sam Ravnborg @ 2008-02-19  9:54 UTC (permalink / raw)
  To: Gregory Nietsky
  Cc: Andi Kleen, Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Tue, Feb 19, 2008 at 11:25:06AM +0200, Gregory Nietsky wrote:
> ive been hackin away at mISDN for a while and use it with recent kernels 
>  2.6.2X and have a patch for 2.6.24 (move from semaphore to complition) 
> the distro we built is heavily reliant on mISDN (voip) i dont use the 
> isdn kernel drivers at all any longer.
> 
> im all for mISDN been mainlined into the kernel and the old stuff been 
> removed there could be users still it is marked as depricated and the 
> plan was with 2.6 to use mISDN from the start.

Great!

First step would be to send a properly splitted up patchset for review
if is is ready.
Release early - relase often is the best way.

I will do my best to review the bits I can help with.

	Sam

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:40         ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Andi Kleen
@ 2008-02-19  9:56           ` Sam Ravnborg
  2008-02-19  9:58             ` Andi Kleen
  0 siblings, 1 reply; 48+ messages in thread
From: Sam Ravnborg @ 2008-02-19  9:56 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

> 
> > If noone in the isdn community step up and take some responsibility
> > for the current isdn drivers in Linux then we should just delete them.
> 
> So you're saying anything that has no active maintainer should 
> be immediately deleted?

You do not recognize a provocation when you see it?
I wanted a reaction from the isdn community - and I got so.
So lets look forward.

	Sam

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:56           ` Sam Ravnborg
@ 2008-02-19  9:58             ` Andi Kleen
  2008-02-19 10:51               ` Armin Schindler
                                 ` (2 more replies)
  0 siblings, 3 replies; 48+ messages in thread
From: Andi Kleen @ 2008-02-19  9:58 UTC (permalink / raw)
  To: Sam Ravnborg
  Cc: Andi Kleen, Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Tue, Feb 19, 2008 at 10:56:22AM +0100, Sam Ravnborg wrote:
> > 
> > > If noone in the isdn community step up and take some responsibility
> > > for the current isdn drivers in Linux then we should just delete them.
> > 
> > So you're saying anything that has no active maintainer should 
> > be immediately deleted?
> 
> You do not recognize a provocation when you see it?
> I wanted a reaction from the isdn community - and I got so.
> So lets look forward.

Well it was more a lie because you couldn't possibly make up to your
threat anyways.

I'm not sure either it's a good idea to try to merge mISDN if the
maintainers don't think it is ready yet.

-Andi

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:58             ` Andi Kleen
@ 2008-02-19 10:51               ` Armin Schindler
  2008-02-19 11:55               ` Sam Ravnborg
  2008-02-19 16:14               ` Marcel Holtmann
  2 siblings, 0 replies; 48+ messages in thread
From: Armin Schindler @ 2008-02-19 10:51 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Sam Ravnborg, Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

On Tue, 19 Feb 2008, Andi Kleen wrote:
> On Tue, Feb 19, 2008 at 10:56:22AM +0100, Sam Ravnborg wrote:
>>>
>>>> If noone in the isdn community step up and take some responsibility
>>>> for the current isdn drivers in Linux then we should just delete them.
>>>
>>> So you're saying anything that has no active maintainer should
>>> be immediately deleted?
>>
>> You do not recognize a provocation when you see it?
>> I wanted a reaction from the isdn community - and I got so.
>> So lets look forward.
>
> Well it was more a lie because you couldn't possibly make up to your
> threat anyways.
>
> I'm not sure either it's a good idea to try to merge mISDN if the
> maintainers don't think it is ready yet.

Without having any opinion here or understanding what the problem is, I just
want to remind everyone that ISDN in the linux kernel (isdn4linux) is not
just mISDN.
There are drivers for common devices/interfaces, the CAPI interface and of
course hardware drivers for other ISDN cards like the active ones as well.

Armin


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:58             ` Andi Kleen
  2008-02-19 10:51               ` Armin Schindler
@ 2008-02-19 11:55               ` Sam Ravnborg
  2008-02-19 16:12                 ` Gregory Nietsky
  2008-02-19 16:14               ` Marcel Holtmann
  2 siblings, 1 reply; 48+ messages in thread
From: Sam Ravnborg @ 2008-02-19 11:55 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

> 
> I'm not sure either it's a good idea to try to merge mISDN if the
> maintainers don't think it is ready yet.

In the spirit of relase early - relase often we should at
least see what is going on.

And Gregory wrote:
> ive been hackin away at mISDN for a while and use it with recent kernels
>  2.6.2X and have a patch for 2.6.24 (move from semaphore to complition)
> the distro we built is heavily reliant on mISDN (voip) i dont use the
> isdn kernel drivers at all any longer.
So not useless and having it in the kernel may cause more people
to contribute.
I for one do prefer to hack on something in the kernel and
not hidden in some repository far away.

But until we see patches lets wait and see.

	Sam

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19 11:55               ` Sam Ravnborg
@ 2008-02-19 16:12                 ` Gregory Nietsky
  0 siblings, 0 replies; 48+ messages in thread
From: Gregory Nietsky @ 2008-02-19 16:12 UTC (permalink / raw)
  To: Sam Ravnborg, isdn4linux, linux-kernel

Sam Ravnborg wrote:
>> I'm not sure either it's a good idea to try to merge mISDN if the
>> maintainers don't think it is ready yet.
> 
> In the spirit of relase early - relase often we should at
> least see what is going on.
> 
well to add mISDN to the kernel tree is straight forward

./std2kern

and the out of tree set becomes in tree a bit of git magic and you have 
a patch.

im advocating it for now alongside isdn4linux prehaps marked as 
"EXPERIMENTAL" im not involved in the mISDN team im a contributor/hacker.

need the buy in from Cristian R/Karsten K.

FYI here in south africa ISDN BRI is widely available with the high 
costs of ISDN PRI this is the best/most practical solution for VOIP.with 
ADSL only now becoming availble on mass the "fastest" connection is 
still 64/128k ISDN in many areas.the hardware is easily available from 
all outlets.my device of choice is a cheap USB modem that comes in @ 30$ 
US per port (can use upto 8) the 4 port digium card comes in @ 650$.


Greg

--

This message has been scanned for viruses and

dangerous content by Superset Technology, and 

is believed to be clean.

http://www.superset.co.za



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:58             ` Andi Kleen
  2008-02-19 10:51               ` Armin Schindler
  2008-02-19 11:55               ` Sam Ravnborg
@ 2008-02-19 16:14               ` Marcel Holtmann
  2008-02-20 14:24                 ` Tilman Schmidt
  2 siblings, 1 reply; 48+ messages in thread
From: Marcel Holtmann @ 2008-02-19 16:14 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Sam Ravnborg, Greg KH, kkeil, isdn4linux, linux-kernel, Jeff Garzik

Hi Andi,

>>>> If noone in the isdn community step up and take some responsibility
>>>> for the current isdn drivers in Linux then we should just delete  
>>>> them.
>>>
>>> So you're saying anything that has no active maintainer should
>>> be immediately deleted?
>>
>> You do not recognize a provocation when you see it?
>> I wanted a reaction from the isdn community - and I got so.
>> So lets look forward.
>
> Well it was more a lie because you couldn't possibly make up to your
> threat anyways.
>
> I'm not sure either it's a good idea to try to merge mISDN if the
> maintainers don't think it is ready yet.

you can't wait until it is perfect. Then it never gets merged. The out- 
of-tree ISDN stuff has always been painful. And that was already in  
the ISDN4Linux days which were Linux 2.2 days or even earlier.

My proposal is to merge mISDN and then see what falls out. My guess it  
won't be that bad as everybody thinks and then we go from there. Next  
step is to remove ISDN4Linux since that should not be used at all  
anymore.

Regards

Marcel


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19  9:25         ` Gregory Nietsky
  2008-02-19  9:54           ` Sam Ravnborg
@ 2008-02-20 14:19           ` Tilman Schmidt
  2008-02-20 14:23             ` Alan Cox
                               ` (2 more replies)
  1 sibling, 3 replies; 48+ messages in thread
From: Tilman Schmidt @ 2008-02-20 14:19 UTC (permalink / raw)
  To: Gregory Nietsky
  Cc: Sam Ravnborg, Andi Kleen, Greg KH, kkeil, isdn4linux,
	linux-kernel, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

Gregory Nietsky schrieb:
> ive been hackin away at mISDN for a while and use it with recent kernels 
>   2.6.2X and have a patch for 2.6.24 (move from semaphore to complition) 
> the distro we built is heavily reliant on mISDN (voip) i dont use the 
> isdn kernel drivers at all any longer.
> 
> im all for mISDN been mainlined into the kernel and the old stuff been 
> removed there could be users still it is marked as depricated and the 
> plan was with 2.6 to use mISDN from the start.

mISDN has two problems, which are of course interrelated:

a) complete lack of documentation for the in-kernel driver interface
    (equivalent of Documentation/isdn/INTERFACE)

b) still doesn't support all the hardware isdn4linux supports.

As long as those problems aren't solved, the old stuff cannot be removed.
Perhaps merging the current state of mISDN into the -mm tree would help
with this. Perhaps not.

Regards,
Tilman
(maintainer of an isdn4linux driver, waiting desperately for
documentation on how to convert to the new CAPI/mISDN world
but tired of asking for it in vain)

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-20 14:19           ` Tilman Schmidt
@ 2008-02-20 14:23             ` Alan Cox
  2008-02-20 16:54             ` Andi Kleen
  2008-02-21 10:33             ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Simon Richter
  2 siblings, 0 replies; 48+ messages in thread
From: Alan Cox @ 2008-02-20 14:23 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Gregory Nietsky, Sam Ravnborg, Andi Kleen, Greg KH, kkeil,
	isdn4linux, linux-kernel, Jeff Garzik

> mISDN has two problems, which are of course interrelated:
> 
> a) complete lack of documentation for the in-kernel driver interface
>     (equivalent of Documentation/isdn/INTERFACE)
> 
> b) still doesn't support all the hardware isdn4linux supports.
> 
> As long as those problems aren't solved, the old stuff cannot be removed.
> Perhaps merging the current state of mISDN into the -mm tree would help
> with this. Perhaps not.

It should get put into the -mm tree so it can be worked on, and if they
won't do that it should probably get binned and people them know what is
going on and can fix the existing isdn code.

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-19 16:14               ` Marcel Holtmann
@ 2008-02-20 14:24                 ` Tilman Schmidt
  0 siblings, 0 replies; 48+ messages in thread
From: Tilman Schmidt @ 2008-02-20 14:24 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Andi Kleen, Sam Ravnborg, Greg KH, kkeil, isdn4linux,
	linux-kernel, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 636 bytes --]

Marcel Holtmann schrieb:
> My proposal is to merge mISDN and then see what falls out. My guess it  
> won't be that bad as everybody thinks and then we go from there. Next  
> step is to remove ISDN4Linux since that should not be used at all  
> anymore.

No. Next step is to create the missing documentation.
The step after that is to convert the remaining isdn4linux
drivers to mISDN. Then you can remove isdn4linux.

HTH
T.

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-20 14:19           ` Tilman Schmidt
  2008-02-20 14:23             ` Alan Cox
@ 2008-02-20 16:54             ` Andi Kleen
  2008-02-20 18:23               ` Plans for mISDN? Tilman Schmidt
  2008-02-20 19:04               ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Gregory Nietsky
  2008-02-21 10:33             ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Simon Richter
  2 siblings, 2 replies; 48+ messages in thread
From: Andi Kleen @ 2008-02-20 16:54 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Gregory Nietsky, Sam Ravnborg, Greg KH, kkeil, isdn4linux,
	linux-kernel, Jeff Garzik


> mISDN has two problems, which are of course interrelated:
> 
> a) complete lack of documentation for the in-kernel driver interface
>    (equivalent of Documentation/isdn/INTERFACE)

Most subsystems in the kernel would disqualify under that rule

Did you ever look for full documentation on how to write Ethernet
drivers for example? Some bits are documented, but far from all

I'm not defending that, but it's how it is.

> 
> b) still doesn't support all the hardware isdn4linux supports.

That's a show stopper of course.


> (maintainer of an isdn4linux driver, waiting desperately for
> documentation on how to convert to the new CAPI/mISDN world
> but tired of asking for it in vain)

My advice is that you just read the source of some existing drivers
for examples and copy them and of the subsystem itself if anything is
unclear. That is how Linux drivers are usually written.

-Andi


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN?
  2008-02-20 16:54             ` Andi Kleen
@ 2008-02-20 18:23               ` Tilman Schmidt
  2008-02-20 19:04               ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Gregory Nietsky
  1 sibling, 0 replies; 48+ messages in thread
From: Tilman Schmidt @ 2008-02-20 18:23 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Gregory Nietsky, Sam Ravnborg, Greg KH, kkeil, isdn4linux,
	linux-kernel, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]

Am 20.02.2008 17:54 schrieb Andi Kleen:
>> mISDN has two problems, which are of course interrelated:
>>
>> a) complete lack of documentation for the in-kernel driver interface
>>    (equivalent of Documentation/isdn/INTERFACE)
> 
> Most subsystems in the kernel would disqualify under that rule

I beg to differ. Most subsystems do have at least rudimentary
documentation. (I'm spoiled by the USB subsystem, of course. :-)

> Did you ever look for full documentation on how to write Ethernet
> drivers for example? Some bits are documented, but far from all

I am not asking for "full documentation". "Some bits" would amply
suffice. Documentation/isdn/INTERFACE, the interface description
for the "old" isdn4linux subsystem, is far from complete, either.
But it contains enough hints so that I knew where to start.

>> (maintainer of an isdn4linux driver, waiting desperately for
>> documentation on how to convert to the new CAPI/mISDN world
>> but tired of asking for it in vain)
> 
> My advice is that you just read the source of some existing drivers
> for examples and copy them and of the subsystem itself if anything is
> unclear. That is how Linux drivers are usually written.

Usually, yes. But I find it unusually hard in this particular case.
In fact I have been trying to do that for two years now, without
getting anywhere. Reading code without a hint of what the authors
are trying to do is terribly time-consuming, to put it mildly.

Thanks,
T.

-- 
Tilman Schmidt                          E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 253 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-20 16:54             ` Andi Kleen
  2008-02-20 18:23               ` Plans for mISDN? Tilman Schmidt
@ 2008-02-20 19:04               ` Gregory Nietsky
  2008-02-20 22:47                 ` Plans for mISDN? Tilman Schmidt
  1 sibling, 1 reply; 48+ messages in thread
From: Gregory Nietsky @ 2008-02-20 19:04 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Tilman Schmidt, Sam Ravnborg, Greg KH, kkeil, isdn4linux,
	linux-kernel, Jeff Garzik


did someone say interface/API documentation ooops ... <DUCK> seriously
this is lacking and im sure as time goes on some volenteer (sucker) will
get it up and running.this is not a show stoper but a nice to have.ill 
perhaps even help out a bit with things, i have some comments on useage 
and module parameters that could be usefull to the would be 
users.remember mISDN is just the kernel bits there is a user lib that 
takes care of userland bits.

 >
 >> b) still doesn't support all the hardware isdn4linux supports.
 >
 > That's a show stopper of course.

of course not all hardware is supported and in some cases more hardware 
is supported ... there is a precident for this OSS/ALSA where the one is 
  marked as DEPRICATED and the other promoted initialy as EXPERMENTAL ...

over all the most common devices are better supported under mISDN than 
isdn4linux.

and as with OSS/ALSA both can coexist on the system as modules (only one 
can be loaded at a time or else they dont play nice).

i really think this is a storm in a tea cup been blown into a hurricane
after all if it were mainlined (in -mm even) the result would be better 
support and more choice there are far worse supported drivers than the 
mISDN stack.the reality is that isdn4linux is dead idealy unsuported 
drivers need to be ported to mISDN or kept on life support.

--

This message has been scanned for viruses and

dangerous content by Superset Technology, and 

is believed to be clean.

http://www.superset.co.za



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN?
  2008-02-20 19:04               ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Gregory Nietsky
@ 2008-02-20 22:47                 ` Tilman Schmidt
  0 siblings, 0 replies; 48+ messages in thread
From: Tilman Schmidt @ 2008-02-20 22:47 UTC (permalink / raw)
  To: Gregory Nietsky
  Cc: Andi Kleen, Tilman Schmidt, Sam Ravnborg, Greg KH, kkeil,
	isdn4linux, linux-kernel, Jeff Garzik

[-- Attachment #1: Type: text/plain, Size: 3188 bytes --]

Am 20.02.2008 20:04 schrieb Gregory Nietsky:
> did someone say interface/API documentation ooops ... <DUCK> seriously
> this is lacking and im sure as time goes on some volenteer (sucker) will
> get it up and running.this is not a show stoper but a nice to have.

It's an enabler for getting a move forward towards replacing the old
isdn4linux subsystem, which has really outlived its time by now.

> ill 
> perhaps even help out a bit with things, i have some comments on useage 
> and module parameters that could be usefull to the would be 
> users.

Great. I'm looking forward to that.

> remember mISDN is just the kernel bits there is a user lib that 
> takes care of userland bits.

But it's the kernel bits which are essential for porting existing
isdn4linux hardware drivers to CAPI/mISDN!

Btw, could you perhaps clear up the terminology while you're at it?
Last time I looked, mISDN was advertised as a framework for writing
CAPI drivers for passive ISDN adapters, in turn using CAPI4Linux,
the Linux CAPI subsystem. Nowadays the picture is rather less
clearcut.

>  >> b) still doesn't support all the hardware isdn4linux supports.
>  >
>  > That's a show stopper of course.
> 
> of course not all hardware is supported and in some cases more hardware 
> is supported ... there is a precident for this OSS/ALSA where the one is 
>   marked as DEPRICATED and the other promoted initialy as EXPERMENTAL ...

I'm all for following that precedent: support both frameworks in
parallel, mark the old one as deprecated, give help in porting
hardware support to the new one, and when all the hardware that's
actually still in use in the field is supported by the new one,
remove the old one.

> after all if it were mainlined (in -mm even) the result would be better 
> support and more choice there are far worse supported drivers than the 
> mISDN stack.

Absolutely. It's high time mISDN found it's way into the main tree,
otherwise it's in danger of degenerating into a niche solution.

> the reality is that isdn4linux is dead

Reality check, please. Have a look in the field how many systems
still use isdn4linux. Or do a simple experiment: Take a distribution
which has been known for good ISDN support in the past (I think you
know the one) and set it up for Internet access via a typical cheap
ISDN card. Then look which ISDN subsystem you end up with. You may
be surprised.

> idealy unsuported 
> drivers need to be ported to mISDN or kept on life support.

Exactly. But there are two preconditions for porting an in-tree
isdn4linux driver to mISDN: First, mISDN must also be in-tree,
otherwise an in-tree driver cannot rely on it. And second, someone
must understand both the old driver and the mISDN framework in
order to be able to actually do the porting. The maintainer of the
old driver can provide the first part, but knowledge about mISDN
will need to come from the mISDN collective.

HTH
T.

-- 
Tilman Schmidt                          E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 253 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-20 14:19           ` Tilman Schmidt
  2008-02-20 14:23             ` Alan Cox
  2008-02-20 16:54             ` Andi Kleen
@ 2008-02-21 10:33             ` Simon Richter
  2008-02-21 19:38               ` Gregory Nietsky
                                 ` (2 more replies)
  2 siblings, 3 replies; 48+ messages in thread
From: Simon Richter @ 2008-02-21 10:33 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: Gregory Nietsky, Jeff Garzik, kkeil, Greg KH, linux-kernel,
	Andi Kleen, isdn4linux, Sam Ravnborg

Hi,

Tilman Schmidt wrote:

> mISDN has two problems, which are of course interrelated:

mISDN has one problem that is even bigger than these: the kernel oopses 
if modules aren't loaded in the right order. misdn-init works around 
that, but if it doesn't work for some reason (and I can think of 
multiple here), the user is left with a kernel that oopses during 
hardware discovery and never gets to a stage where this can be 
rectified, as almost all distributions now have hardware discovery 
before the first opportunity to get a shell. At least these were my 
experiences the last time I tried it on my test box.

This is the reason I've kept mISDN out of the last two Debian stable 
releases, despite users' requests.

When a hardware driver module is loaded, it should only do basic 
hardware initialisation; it is certainly not necessary to set up the 
entire stack (or even decide on a protocol, which currently needs to be 
handed in via module parameter -- before userland code is there that 
wants to talk to the hardware, there is no reason to have the hardware 
active).

    Simon

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-21 10:33             ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Simon Richter
@ 2008-02-21 19:38               ` Gregory Nietsky
  2008-02-21 19:46               ` Marcel Holtmann
  2008-02-22 12:04               ` Karsten Keil
  2 siblings, 0 replies; 48+ messages in thread
From: Gregory Nietsky @ 2008-02-21 19:38 UTC (permalink / raw)
  To: Simon Richter
  Cc: Tilman Schmidt, Jeff Garzik, kkeil, Greg KH, linux-kernel,
	Andi Kleen, isdn4linux, Sam Ravnborg

Simon Richter wrote:
> Hi,
> 
> Tilman Schmidt wrote:
> 
>> mISDN has two problems, which are of course interrelated:
> 
> mISDN has one problem that is even bigger than these: the kernel oopses 
> if modules aren't loaded in the right order. misdn-init works around 
> that, but if it doesn't work for some reason (and I can think of 
> multiple here), the user is left with a kernel that oopses during 
> hardware discovery and never gets to a stage where this can be 
> rectified, as almost all distributions now have hardware discovery 
> before the first opportunity to get a shell. At least these were my 
> experiences the last time I tried it on my test box.
> 
> This is the reason I've kept mISDN out of the last two Debian stable 
> releases, despite users' requests.
> 
> When a hardware driver module is loaded, it should only do basic 
> hardware initialisation; it is certainly not necessary to set up the 
> entire stack (or even decide on a protocol, which currently needs to be 
> handed in via module parameter -- before userland code is there that 
> wants to talk to the hardware, there is no reason to have the hardware 
> active).
> 
>    Simon
> -- 

hi there simon ive not bothered with isdn-init i use some modprobe magic 
to sort out the mess here it is ... edit the flags as required.i agree 
this is not ideal and most drivers should have a default ill take this 
under advisement and when there is some time ill look at setting it as 
default.this recipe plays nicely with hotplug and friends.

#
#Protocol Flags
#
#0x001 1TR6 (Not Available)
#0x002 DSS1
#0x010 NT Mode
#0x020 PTP Mode
#0x040 PCM Slave Mode
#0x080 Negative Frame Pulse
#0x100 Use Setting From Previous Driver And Add To Previous Stack
#0x200 Switch DU/DD Interface

#
#Typical Usage
#
#0x02  TE Mode
#0x12  NT Mode

#
#Layer Mask To Select Layers In D Channel Stack Layer 0 (HW) is always 
included
#
#0x1 Layer 1
#0x2 Layer 2 (Only Layers 1 and 2 are needed for NT Mode)
#0x4 Layer 3
#0x8 Layer 4

#
#Typical Usage
#
#0x0f  TE Mode
#0x03  NT Mode

#
#Debug Mask
#
#0x01 IRQ Status
#0x02 D-Channel Events
#0x04 D-Channel FIFO Data
#0x08 B-Channel Events
#0x10 B-Channel FIFO Data

#
#DSP Options
#
#0x01 ULAW (Instead Of ALAW)
#0x10 Software Bridging (Instead Of Hardware)


options avmfritz protocol=0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2
options avmfritz layermask=0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf
options avmfritz debug=0x0

options hfcpci   protocol=0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2
options hfcpci   layermask=0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf
options hfcpci   debug=0x0

options hfcmulti type=8
options hfcmulti protocol=0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2
options hfcmulti layermask=0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf
options hfcmulti debug=0x0

options w6692pci protocol=0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2
options w6692pci layermask=0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf
options w6692pci debug=0x0

options sedlfax  protocol=0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2
options sedlfax  layermask=0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf
options sedlfax  debug=0x0

options hfcsusb  protocol=0x2,0x2,0x2,0x2,0x2,0x2,0x2,0x2
options hfcsusb  layermask=0xf,0xf,0xf,0xf,0xf,0xf,0xf,0xf
options hfcsusb  poll=128
options hfcsusb  debug=0x0

options mISDN_dsp options=0x10
options mISDN_dsp debug=0x0
options mISDN_dsp poll=128

install avmfritz   /usr/sbin/mkisdnnod avmfritz
install hfcpci     /usr/sbin/mkisdnnod hfcpci
install hfcmulti   /usr/sbin/mkisdnnod hfcmulti
install w6692pci   /usr/sbin/mkisdnnod w6692pci
install sedlfax    /usr/sbin/mkisdnnod sedlfax
install hfcsusb    /usr/sbin/mkisdnnod hfcsusb

------------
/usr/sbin/mkisdnnod
------------

#!/bin/bash


if [ -e /var/run/isdnprobe.pid ];then
   CURPID=`cat /var/run/isdnprobe.pid`
   if [ "$CURPID" != "$$" ] && [ -d /proc/$CURPID ] && [ "$CURPID" ];then
     exit;
    else
     echo $$ > /var/run/isdnprobe.pid
   fi;
  else
   echo $$ > /var/run/isdnprobe.pid
fi;

if [ ! -e /dev/mISDN ];then
   /bin/mknod /dev/mISDN c 46 0;
   /sbin/modprobe mISDN_l1;
   /sbin/modprobe mISDN_l2;
   /sbin/modprobe l3udss1;
   /sbin/modprobe mISDN_isac;
   /sbin/modprobe mISDN_x25dte;
   /sbin/modprobe mISDN_dtmf;
   /sbin/modprobe mISDN_dsp;
   /sbin/modprobe mISDN_debugtool
   if [ "$1" ];then
     /sbin/modprobe -s -q --ignore-install $1;
   fi;
   rm /var/run/isdnprobe.pid
  else
   /sbin/modprobe -s -q --ignore-install $1;
fi;

--

This message has been scanned for viruses and

dangerous content by Superset Technology, and 

is believed to be clean.

http://www.superset.co.za



^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-21 10:33             ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Simon Richter
  2008-02-21 19:38               ` Gregory Nietsky
@ 2008-02-21 19:46               ` Marcel Holtmann
  2008-02-21 23:19                 ` Andi Kleen
  2008-02-22 12:04               ` Karsten Keil
  2 siblings, 1 reply; 48+ messages in thread
From: Marcel Holtmann @ 2008-02-21 19:46 UTC (permalink / raw)
  To: Simon Richter
  Cc: Tilman Schmidt, Gregory Nietsky, Jeff Garzik, kkeil, Greg KH,
	linux-kernel, Andi Kleen, isdn4linux, Sam Ravnborg

Hi Simon,

>> mISDN has two problems, which are of course interrelated:
>
> mISDN has one problem that is even bigger than these: the kernel  
> oopses if modules aren't loaded in the right order. misdn-init works  
> around that, but if it doesn't work for some reason (and I can think  
> of multiple here), the user is left with a kernel that oopses during  
> hardware discovery and never gets to a stage where this can be  
> rectified, as almost all distributions now have hardware discovery  
> before the first opportunity to get a shell. At least these were my  
> experiences the last time I tried it on my test box.

that is not a big problem at all. If you have to enforce a specific  
module load order then create some dummy exports like misdn_load() and  
use them from the module that depends on it. It is not beautiful, but  
sometimes you have to do it this way. So if that is stopping mainline  
inclusion it is a lame excuse.

Regards

Marcel


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-21 19:46               ` Marcel Holtmann
@ 2008-02-21 23:19                 ` Andi Kleen
  2008-02-21 23:30                   ` Marcel Holtmann
  0 siblings, 1 reply; 48+ messages in thread
From: Andi Kleen @ 2008-02-21 23:19 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Simon Richter, Tilman Schmidt, Gregory Nietsky, Jeff Garzik,
	kkeil, Greg KH, linux-kernel, isdn4linux, Sam Ravnborg


> that is not a big problem at all. If you have to enforce a specific
> module load order then create some dummy exports like misdn_load() and
> use them from the module that depends on it.

That's not necessarily enough. There are races during module load
when the next module is loaded already before the module it depends
on has finished initializing.

I regularly run into such a problem on my workstation with one
of the USB serial drivers for example. It errors out when autoloaded
during boot, but loads fine on retry later.

-Andi

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-21 23:19                 ` Andi Kleen
@ 2008-02-21 23:30                   ` Marcel Holtmann
  2008-02-21 23:40                     ` Andi Kleen
  0 siblings, 1 reply; 48+ messages in thread
From: Marcel Holtmann @ 2008-02-21 23:30 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Simon Richter, Tilman Schmidt, Gregory Nietsky, Jeff Garzik,
	kkeil, Greg KH, linux-kernel, isdn4linux, Sam Ravnborg

Hi Andi,

>> that is not a big problem at all. If you have to enforce a specific
>> module load order then create some dummy exports like misdn_load()  
>> and
>> use them from the module that depends on it.
>
> That's not necessarily enough. There are races during module load
> when the next module is loaded already before the module it depends
> on has finished initializing.

we were talking about the load order. This will solve the load order,  
but if we have races like the kind you described, then the whole mISDN  
design is broken. So if that is the fact, then my understanding is  
that we have too many modules. Simple combine the modules and use  
proper locking. More modules is not always better.

> I regularly run into such a problem on my workstation with one
> of the USB serial drivers for example. It errors out when autoloaded
> during boot, but loads fine on retry later.

Report this to the USB mailing list.

Regards

Marcel


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-21 23:30                   ` Marcel Holtmann
@ 2008-02-21 23:40                     ` Andi Kleen
  0 siblings, 0 replies; 48+ messages in thread
From: Andi Kleen @ 2008-02-21 23:40 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Simon Richter, Tilman Schmidt, Gregory Nietsky, Jeff Garzik,
	kkeil, Greg KH, linux-kernel, isdn4linux, Sam Ravnborg


> we were talking about the load order. This will solve the load order,
> but if we have races like the kind you described, then the whole mISDN
> design is broken. 

It's more a generic problem of the module code.

-Andi

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-21 10:33             ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Simon Richter
  2008-02-21 19:38               ` Gregory Nietsky
  2008-02-21 19:46               ` Marcel Holtmann
@ 2008-02-22 12:04               ` Karsten Keil
  2008-02-23 19:39                 ` Sam Ravnborg
  2008-02-25 14:39                 ` Plans for mISDN? Tilman Schmidt
  2 siblings, 2 replies; 48+ messages in thread
From: Karsten Keil @ 2008-02-22 12:04 UTC (permalink / raw)
  To: Simon Richter
  Cc: Tilman Schmidt, Jeff Garzik, kkeil, Greg KH, Gregory Nietsky,
	linux-kernel, Andi Kleen, isdn4linux, Sam Ravnborg

Hi,

sorry that I step in so late, procmail sorted this thread in the wrong
box.
Normally I reserved the complete last week for working on mISDN to get it
ready to submit it to -mm, but reality did hit me and I had to do some
other importent stuff :-(

On Thu, Feb 21, 2008 at 11:33:04AM +0100, Simon Richter wrote:
> Hi,
> 
> Tilman Schmidt wrote:
> 
> > mISDN has two problems, which are of course interrelated:
> 
> mISDN has one problem that is even bigger than these: the kernel oopses 
> if modules aren't loaded in the right order. misdn-init works around 
> that, but if it doesn't work for some reason (and I can think of 
> multiple here), the user is left with a kernel that oopses during 
> hardware discovery and never gets to a stage where this can be 
> rectified, as almost all distributions now have hardware discovery 
> before the first opportunity to get a shell. At least these were my 
> experiences the last time I tried it on my test box.
> 
> This is the reason I've kept mISDN out of the last two Debian stable 
> releases, despite users' requests.
> 
> When a hardware driver module is loaded, it should only do basic 
> hardware initialisation; it is certainly not necessary to set up the 
> entire stack (or even decide on a protocol, which currently needs to be 
> handed in via module parameter -- before userland code is there that 
> wants to talk to the hardware, there is no reason to have the hardware 
> active).
> 

These design issues are fixed in the new mISDN socket branch.
The old mISDN design was too complicated because it allow access to
every layer and build the ISDN stack dynamically, both feature were never
needed in practice and contain many race conditions.
The new design only has one core module and hardware specific modules
with a very simple interface.
The interface to the userspace are sockets (one per channel).

-- 
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN? Was: [PATCH 00/14] [ISDN] ...
  2008-02-22 12:04               ` Karsten Keil
@ 2008-02-23 19:39                 ` Sam Ravnborg
  2008-02-25 14:39                 ` Plans for mISDN? Tilman Schmidt
  1 sibling, 0 replies; 48+ messages in thread
From: Sam Ravnborg @ 2008-02-23 19:39 UTC (permalink / raw)
  To: Simon Richter, Tilman Schmidt, Jeff Garzik, kkeil, Greg KH,
	Gregory Nietsky, linux-kernel, Andi Kleen, isdn4linux

Hi Karsten.

> Normally I reserved the complete last week for working on mISDN to get it
> ready to submit it to -mm, but reality did hit me and I had to do some
> other importent stuff :-(

When you do your first submission can you please submit the minimal
possible configuration.
I tried enabling the AVM!Fritz and I could see that with this
driver alone the following files got build:

avm_fritz.c layer3.c l3_udss1.c capi.c contr.c listen.c appl.c
plci.c app_plci.c ncci.c
asn1.c asn1_aoc.c asn1_comp.c asn1_generic.c asn1_diversion.c asn1_basic_service.c asn1_address.c asn1_enc.c
capi_enc.c supp_serv.c core.c stack.c udevice.c helper.c debug.c fsm.c channel.c l3helper.c sysfs_obj.c
sysfs_inst.c sysfs_st.c dtmf.c isac.c arcofi.c
layer1.c layer2.c tei.c
x25_dte.c x25_l3.c

And that a *lot* to review in one go.
So if you could squeze that down to less files it would be nice.

And only one simple HW drivers (I randomly selected avm_fritz above).
When we get this in shape you can follow up with more HW drivers.

Thanks,
	Sam


^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN?
  2008-02-22 12:04               ` Karsten Keil
  2008-02-23 19:39                 ` Sam Ravnborg
@ 2008-02-25 14:39                 ` Tilman Schmidt
  2008-03-03 17:32                   ` Karsten Keil
  1 sibling, 1 reply; 48+ messages in thread
From: Tilman Schmidt @ 2008-02-25 14:39 UTC (permalink / raw)
  To: kkeil
  Cc: Simon Richter, Jeff Garzik, Greg KH, Gregory Nietsky,
	linux-kernel, Andi Kleen, isdn4linux, Sam Ravnborg

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

On 22.02.2008 13:04, Karsten Keil wrote:
> These design issues are fixed in the new mISDN socket branch.
> The old mISDN design was too complicated because it allow access to
> every layer and build the ISDN stack dynamically, both feature were never
> needed in practice and contain many race conditions.
> The new design only has one core module and hardware specific modules
> with a very simple interface.

Great news. I pulled your socket branch and am currently trying to
find my way through one of the two hardware drivers available there
and abstract away from the PCI card specific parts.
Is there a design document available? Or will there be some non-PCI
driver soon, perhaps even one for a USB device? That would be
immensely helpful.

Thanks,
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: Plans for mISDN?
  2008-02-25 14:39                 ` Plans for mISDN? Tilman Schmidt
@ 2008-03-03 17:32                   ` Karsten Keil
  0 siblings, 0 replies; 48+ messages in thread
From: Karsten Keil @ 2008-03-03 17:32 UTC (permalink / raw)
  To: Tilman Schmidt
  Cc: kkeil, Jeff Garzik, Greg KH, Gregory Nietsky, linux-kernel,
	Andi Kleen, Simon Richter, isdn4linux, Sam Ravnborg

On Mon, Feb 25, 2008 at 03:39:14PM +0100, Tilman Schmidt wrote:
> On 22.02.2008 13:04, Karsten Keil wrote:
> >These design issues are fixed in the new mISDN socket branch.
> >The old mISDN design was too complicated because it allow access to
> >every layer and build the ISDN stack dynamically, both feature were never
> >needed in practice and contain many race conditions.
> >The new design only has one core module and hardware specific modules
> >with a very simple interface.
> 
> Great news. I pulled your socket branch and am currently trying to
> find my way through one of the two hardware drivers available there
> and abstract away from the PCI card specific parts.
> Is there a design document available? Or will there be some non-PCI
> driver soon, perhaps even one for a USB device? That would be
> immensely helpful.
> 

It will, Martin will work on it soon.

-- 
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2008-03-03 17:39 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-16  4:41 [PATCH 00/14] [ISDN] convert HiSax to hotplug APIs Jeff Garzik
2008-02-16  4:41 ` [PATCH 01/14] [ISDN] HiSax: modularization prep Jeff Garzik
2007-07-18  3:46   ` [PATCH 04/14] [ISDN] HiSax bkm_a4t: convert to PCI hotplug API Jeff Garzik
2007-07-18  3:49   ` [PATCH 05/14] [ISDN] HiSax enternow: " Jeff Garzik
2007-07-18  3:54   ` [PATCH 06/14] [ISDN] HiSax hfc_pci, w6692: " Jeff Garzik
2007-07-18  3:59   ` [PATCH 07/14] [ISDN] HiSax nj_s, nj_u: " Jeff Garzik
2007-07-18  4:02   ` [PATCH 08/14] [ISDN] HiSax telespci: " Jeff Garzik
2007-07-24 12:26   ` [PATCH 11/14] [ISDN] HiSax niccy: convert to modern ISA/PNP/PCI probing Jeff Garzik
2007-08-02 12:37   ` [PATCH 14/14] [ISDN] HiSax bkm_a8: convert to PCI hotplug API Jeff Garzik
2007-10-31  5:10   ` [PATCH 03/14] [ISDN] Ready HiSax driver for modularization Jeff Garzik
2007-10-31  5:11   ` [PATCH 09/14] [ISDN] HiSax avm_pci: convert to modern PCI/ISA/PNP probing Jeff Garzik
2007-10-31  5:12   ` [PATCH 10/14] [ISDN] HiSax gazel: convert to modern ISA/PCI probing Jeff Garzik
2007-10-31  5:13   ` [PATCH 13/14] [ISDN] HiSax diva: convert to modern ISA/PNP/PCI probing Jeff Garzik
2007-10-31  7:42   ` [PATCH 02/14] [ISDN] Hisax: eliminate many unnecessary references to CardType[] Jeff Garzik
2008-02-16 19:17   ` [PATCH 12/14] [ISDN] HiSax avm_pci, niccy: minor PNP fixes and cleanups Jeff Garzik
2008-02-17 19:52 ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Sam Ravnborg
2008-02-18  4:52   ` Greg KH
2008-02-18 12:08     ` Andi Kleen
2008-02-18 12:04       ` Alan Cox
2008-02-18 12:36       ` Jeff Garzik
2008-02-18 13:29         ` Andi Kleen
2008-02-19  8:50       ` Sam Ravnborg
2008-02-19  9:25         ` Gregory Nietsky
2008-02-19  9:54           ` Sam Ravnborg
2008-02-20 14:19           ` Tilman Schmidt
2008-02-20 14:23             ` Alan Cox
2008-02-20 16:54             ` Andi Kleen
2008-02-20 18:23               ` Plans for mISDN? Tilman Schmidt
2008-02-20 19:04               ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Gregory Nietsky
2008-02-20 22:47                 ` Plans for mISDN? Tilman Schmidt
2008-02-21 10:33             ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Simon Richter
2008-02-21 19:38               ` Gregory Nietsky
2008-02-21 19:46               ` Marcel Holtmann
2008-02-21 23:19                 ` Andi Kleen
2008-02-21 23:30                   ` Marcel Holtmann
2008-02-21 23:40                     ` Andi Kleen
2008-02-22 12:04               ` Karsten Keil
2008-02-23 19:39                 ` Sam Ravnborg
2008-02-25 14:39                 ` Plans for mISDN? Tilman Schmidt
2008-03-03 17:32                   ` Karsten Keil
2008-02-19  9:40         ` Plans for mISDN? Was: [PATCH 00/14] [ISDN] Andi Kleen
2008-02-19  9:56           ` Sam Ravnborg
2008-02-19  9:58             ` Andi Kleen
2008-02-19 10:51               ` Armin Schindler
2008-02-19 11:55               ` Sam Ravnborg
2008-02-19 16:12                 ` Gregory Nietsky
2008-02-19 16:14               ` Marcel Holtmann
2008-02-20 14:24                 ` Tilman Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).