More ISDN hotplug/probe conversions (kill pci_find_device)
cover More ISDN hotplug/probe conversions (kill pci_find_device)
The following three patches continue the development work found on the 'isdn-pci' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
which currently contains the following changes:
[ISDN] HiSax: modularize card setup
[ISDN] Ready HiSax driver for modularization
[ISDN] HiSax bkm_a4t: convert to PCI hotplug API [ISDN] HiSax enternow: convert to PCI hotplug API [ISDN] HiSax hfc_pci, w6692: convert to PCI hotplug API [ISDN] HiSax nj_s, nj_u: convert to PCI hotplug API [ISDN] HiSax telespci: convert to PCI hotplug API
P [ISDN] HiSax: additional export to make things proper
1 --> [ISDN] HiSax avm_pci: split setup into three smaller functions 2 --> [ISDN] HiSax avm_pci: convert to modern probing
2 --> [ISDN] HiSax acm_pci: fix module unload
3 --> [ISDN] HiSax gazel: convert to ISA/PCI new probing
The three patches' contents are the final four changesets listed.
These new patches begin to convert drivers that are not exclusively PCI-only, complicating things a bit.
Jeff
PATCH 1/3 HiSax avm_pci: split setup into smaller functions
commit 56069967cb9da3d3853955d78602b47bce78b585
Author: Jeff Garzik <[email protected]> Date: Tue Jul 24 01:24:46 2007 -0400
[ISDN] HiSax avm_pci: split setup into three smaller functions
Prepare for new ISA/PNP/PCI APIs.
drivers/isdn/hisax/avm_pci.c | 224 ++++++++++++++++++++++++++----------------- 1 file changed, 136 insertions(+), 88 deletions(-)
56069967cb9da3d3853955d78602b47bce78b585
drivers/isdn/hisax/avm_pci.c +136 -88
@@ -20,7 +20,6 @@#include <linux/isapnp.h> #include <linux/interrupt.h> -extern const char *CardType[];static const char *avm_pci_rev ="$Revision: 1.29.2.4 $" ;#define AVM_FRITZ_PCI 1
@@ -726,100 +725,15 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)return (0 ); } -#ifdef CONFIG_PCI -static struct pci_dev *dev_avm__devinitdata =NULL ; -#endif -#ifdef __ISAPNP__ -static struct pnp_card *pnp_avm_c__devinitdata =NULL ; -#endif - -int __devinit -setup_avm_pcipnp (struct IsdnCard *card) +static int __devinit avm_setup_rest (struct IsdnCardState *cs) {u_int val, ver; -struct IsdnCardState *cs = card->cs; -char tmp[64 ]; -strcpy (tmp, avm_pci_rev); -printk (KERN_INFO "HiSax: AVM PCI driver Rev. %s\n" ,HiSax_getrev (tmp)); -if (cs->typ !=ISDN_CTYPE_FRITZPCI ) -return (0 ); -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; - } -#ifdef __ISAPNP__ -if (isapnp_present ()) { -struct pnp_dev *pnp_avm_d =NULL ; -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; - -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 ; - goto ready; - } - } - }else { -printk (KERN_INFO "FritzPnP: no ISA PnP present\n" ); - } -#endif -#ifdef CONFIG_PCI -if ((dev_avm =pci_find_device (PCI_VENDOR_ID_AVM , -PCI_DEVICE_ID_AVM_A1 , dev_avm))) { -if (pci_enable_device (dev_avm)) -return (0 ); - 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 ; - }else { -printk (KERN_WARNING "FritzPCI: No PCI card found\n" ); -return (0 ); - } - cs->irq_flags |=IRQF_SHARED ; -#else -printk (KERN_WARNING "FritzPCI: NO_PCI_BIOS\n" ); -return (0 ); -#endif /* CONFIG_PCI */ -ready: cs->hw.avm.isac = cs->hw.avm.cfg_reg +0x10 ;if (!request_region (cs->hw.avm.cfg_reg,32 , (cs->subtyp ==AVM_FRITZ_PCI ) ?"avm PCI" :"avm PnP" )) {printk (KERN_WARNING -"HiSax: %s config port %x-%x already in use\n" , - CardType[card->typ], +"HiSax: Fritz!PCI/PNP config port %x-%x already in use\n" , cs->hw.avm.cfg_reg, cs->hw.avm.cfg_reg +31 );return (0 );
@@ -860,3 +774,137 @@ ready:ISACVersion (cs, (cs->subtyp ==AVM_FRITZ_PCI ) ?"AVM PCI:" :"AVM PnP:" );return (1 ); } + +#ifndef __ISAPNP__ + +static int __devinit avm_pnp_setup (struct IsdnCardState *cs) +{ +return (1 );/* no-op: success */ +} + +#else + +static struct pnp_card *pnp_avm_c__devinitdata =NULL ; + +static int __devinit avm_pnp_setup (struct IsdnCardState *cs) +{ +struct pnp_dev *pnp_avm_d =NULL ; + +if (!isapnp_present ()) +return (1 );/* no-op: success */ + +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; + +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 ; + +return (2 );/* goto 'ready' label */ + } + } + +return (1 ); +} + +#endif /* __ISAPNP__ */ + +#ifndef CONFIG_PCI + +static int __devinit avm_pci_setup (struct IsdnCardState *cs) +{ +return (1 );/* no-op: success */ +} + +#else + +static struct pci_dev *dev_avm__devinitdata =NULL ; + +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))) { + +if (pci_enable_device (dev_avm)) +return (0 ); + + 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 ; + }else { +printk (KERN_WARNING "FritzPCI: No PCI card found\n" ); +return (0 ); + } + + cs->irq_flags |=IRQF_SHARED ; + +return (1 ); +} + +#endif /* CONFIG_PCI */ + +int __devinit +setup_avm_pcipnp (struct IsdnCard *card) +{ +struct IsdnCardState *cs = card->cs; +char tmp[64 ]; +int rc; + +strcpy (tmp, avm_pci_rev); +printk (KERN_INFO "HiSax: AVM PCI driver Rev. %s\n" ,HiSax_getrev (tmp)); + +if (cs->typ !=ISDN_CTYPE_FRITZPCI ) +return (0 ); + +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; + } + + rc =avm_pnp_setup (cs); +if (rc <1 ) +return (0 ); +if (rc ==2 ) + goto ready; + + rc =avm_pci_setup (cs); +if (rc <1 ) +return (0 ); + +ready: +return avm_setup_rest (cs); +}
PATCH 2/3 HiSax avm_pci: convert to new ISA/PNP/PCI probing APIs
In reply to Jeff Garzikcommit a6c558ebae334a915fe81fb2f6163330f6150fc9
Author: Jeff Garzik <[email protected]> Date: Tue Jul 24 01:27:47 2007 -0400
[ISDN] HiSax avm_pci: convert to modern probing
drivers/isdn/hisax/Kconfig | 4 drivers/isdn/hisax/Makefile | 2 drivers/isdn/hisax/avm_pci.c | 309 ++++++++++++++++++++++++++++++------------- drivers/isdn/hisax/config.c | 22 --- 4 files changed, 223 insertions(+), 114 deletions(-)
a6c558ebae334a915fe81fb2f6163330f6150fc9
drivers/isdn/hisax/Kconfig +2 -2
@@ -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.
drivers/isdn/hisax/Makefile +1 -1
@@ -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-objs := bkm_a4t.o jade.o enternow-objs := 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
drivers/isdn/hisax/avm_pci.c +218 -91
367 lines not on this page · raw message
drivers/isdn/hisax/config.c +2 -20
@@ -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
@@ -421,10 +414,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
@@ -793,11 +782,6 @@ static int 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 :
@@ -890,6 +874,7 @@ static int 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]);
@@ -1333,7 +1318,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 :
@@ -1357,6 +1341,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 :
@@ -1830,9 +1815,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},
9d0a6cba6a6632c24dd23397bfb7b99409756669
drivers/isdn/hisax/avm_pci.c +11 -0
@@ -1015,7 +1015,18 @@ err_out_isa: 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);
PATCH 3/3 HiSax gazel: convert to new ISA/PCI probing APIs
In reply to Jeff Garzikcommit c28fbf8ef9f64daf3f19701bee8bfc349989c87e
Author: Jeff Garzik <[email protected]> Date: Tue Jul 24 03:38:44 2007 -0400
[ISDN] HiSax gazel: convert to ISA/PCI new probing
drivers/isdn/hisax/Kconfig | 3 drivers/isdn/hisax/Makefile | 2 drivers/isdn/hisax/config.c | 25 ---- drivers/isdn/hisax/gazel.c | 244 +++++++++++++++++++++++++++++++++----------- 4 files changed, 189 insertions(+), 85 deletions(-)
c28fbf8ef9f64daf3f19701bee8bfc349989c87e
drivers/isdn/hisax/Kconfig +2 -1
@@ -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.
drivers/isdn/hisax/Makefile +1 -1
@@ -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-objs := bkm_a4t.o jade.o enternow-objs := 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
drivers/isdn/hisax/config.c +2 -23
@@ -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}
@@ -470,10 +463,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 */
@@ -858,11 +847,6 @@ static int 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 ;
@@ -875,6 +859,7 @@ static int 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]);
@@ -1319,7 +1304,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];
@@ -1342,6 +1326,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 :
@@ -1827,12 +1812,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
drivers/isdn/hisax/gazel.c +184 -60
300 lines not on this page · raw message
PATCH 1/4 HiSax niccy: convert to ISA/PNP/PCI new style probing
In reply to Jeff GarzikThis patch was committed to the 'isdn-pci' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
commit c0a1375fab3207dfe9f7889fae54dd05af3dd950
Author: Jeff Garzik <[email protected]> Date: Tue Jul 24 08:26:59 2007 -0400
[ISDN] HiSax niccy: convert to ISA/PNP/PCI new style probing
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, 333 insertions(+), 158 deletions(-)
c0a1375fab3207dfe9f7889fae54dd05af3dd950
drivers/isdn/hisax/Kconfig +2 -1
@@ -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.
drivers/isdn/hisax/Makefile +1 -1
@@ -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-objs := bkm_a4t.o jade.o enternow-objs := 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
drivers/isdn/hisax/config.c +2 -24
@@ -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 , };
@@ -447,10 +436,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
@@ -827,11 +812,6 @@ static int 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);
@@ -860,6 +840,7 @@ static int 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]);
@@ -1270,7 +1251,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];
@@ -1327,6 +1307,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 :
@@ -1815,9 +1796,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
drivers/isdn/hisax/niccy.c +328 -132
487 lines not on this page · raw message
PATCH 2/4 diva: split setup into three smaller functions
This patch was committed to the 'isdn-pci' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
commit 5bc15a177ea173e02b8f43f67d524c781eb8f758
Author: Jeff Garzik <[email protected]> Date: Thu Aug 2 05:45:30 2007 -0400
[ISDN] HiSax diva: split setup into three smaller functions
drivers/isdn/hisax/diva.c | 512 ++++++++++++++++++++++++++-------------------- 1 file changed, 293 insertions(+), 219 deletions(-)
5bc15a177ea173e02b8f43f67d524c781eb8f758
drivers/isdn/hisax/diva.c +293 -219
@@ -25,8 +25,6 @@#include <linux/pci.h> #include <linux/isapnp.h> -extern const char *CardType[]; -static const char *Diva_revision ="$Revision: 1.33.2.6 $" ;#define byteout (addr,val) outb(val,addr)
@@ -906,225 +904,15 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)return (0 ); } -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 ; - -#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 isapnp_device_id *ipid__devinitdata = &diva_ids[0 ]; -static struct pnp_card *pnp_c__devinitdata =NULL ; -#endif - - -int __devinit -setup_diva (struct IsdnCard *card) +static int __devinit setup_diva_common (struct IsdnCardState *cs) { -int bytecnt =8 ; +int bytecnt;u_char val; -struct IsdnCardState *cs = card->cs; -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 (card->para[1 ]) { - cs->hw.diva.ctrl_reg =0 ; - cs->hw.diva.cfg_reg = card->para[1 ]; - val =readreg (cs->hw.diva.cfg_reg +DIVA_IPAC_ADR , - cs->hw.diva.cfg_reg +DIVA_IPAC_DATA ,IPAC_ID ); -printk (KERN_INFO "Diva: IPAC version %x\n" , val); -if ((val ==1 ) || (val==2 )) { - 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 ; - } - cs->irq = card->para[0 ]; - }else { -#ifdef __ISAPNP__ -if (isapnp_present ()) { -struct pnp_dev *pnp_d; -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 ; - } - goto ready; - }else { -printk (KERN_ERR "Diva PnP: PnP error card found, no device\n" ); -return (0 ); - } - } - ipid++; - pnp_c=NULL ; - } -if (!ipid->card_vendor) { -printk (KERN_INFO "Diva PnP: no ISAPnP card found\n" ); - } - } -#endif -#ifdef CONFIG_PCI - 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->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 ); - 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->subtyp =DIVA_IPAC_PCI ; - cs->irq = dev_diva201->irq; - cs->hw.diva.pci_cfg = - (ulong )ioremap (pci_resource_start (dev_diva201,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 ); - cs->subtyp =DIVA_IPACX_PCI ; - cs->irq = dev_diva202->irq; - cs->hw.diva.pci_cfg = - (ulong )ioremap (pci_resource_start (dev_diva202,0 ),4096 ); - cs->hw.diva.cfg_reg = - (ulong )ioremap (pci_resource_start (dev_diva202,1 ),4096 ); - }else { -printk (KERN_WARNING "Diva: No PCI card found\n" ); -return (0 ); - } - -if (!cs->irq) { -printk (KERN_WARNING "Diva: No IRQ for PCI card found\n" ); -iounmap_diva (cs); -return (0 ); - } - -if (!cs->hw.diva.cfg_reg) { -printk (KERN_WARNING "Diva: No IO-Adr for PCI card found\n" ); -iounmap_diva (cs); -return (0 ); - } - cs->irq_flags |=IRQF_SHARED ; -#else -printk (KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n" ); -printk (KERN_WARNING "Diva: unable to config DIVA PCI\n" ); -return (0 ); -#endif /* CONFIG_PCI */ -if ((cs->subtyp ==DIVA_IPAC_PCI ) || - (cs->subtyp ==DIVA_IPACX_PCI ) ) { - cs->hw.diva.ctrl =0 ; - cs->hw.diva.isac =0 ; - cs->hw.diva.hscx =0 ; - cs->hw.diva.isac_adr =0 ; - cs->hw.diva.hscx_adr =0 ; -test_and_set_bit (HW_IPAC , &cs->HW_Flags); - bytecnt =0 ; - }else { - cs->hw.diva.ctrl = cs->hw.diva.cfg_reg +DIVA_PCI_CTRL ; - cs->hw.diva.isac = cs->hw.diva.cfg_reg +DIVA_PCI_ISAC_DATA ; - cs->hw.diva.hscx = cs->hw.diva.cfg_reg +DIVA_HSCX_DATA ; - cs->hw.diva.isac_adr = cs->hw.diva.cfg_reg +DIVA_PCI_ISAC_ADR ; - cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg +DIVA_HSCX_ADR ; - bytecnt =32 ; - } - } - -#ifdef __ISAPNP__ -ready: -#endif +if ((cs->subtyp ==DIVA_ISA ) || (cs->subtyp ==DIVA_IPAC_ISA )) + bytecnt =8 ; +else + bytecnt =32 ; printk(KERN_INFO "Diva: %s card configured at %#lx IRQ %d\n",
@@ -1145,7 +933,7 @@ ready:if (!request_region (cs->hw.diva.cfg_reg, bytecnt,"diva isdn" )) {printk (KERN_WARNING "HiSax: %s config port %lx-%lx already in use\n" , - CardType[card->typ], +"diva" , cs->hw.diva.cfg_reg, cs->hw.diva.cfg_reg + bytecnt);iounmap_diva (cs);
@@ -1206,3 +994,289 @@ ready: }return (1 ); } + +#ifdef CONFIG_ISA + +static int __devinit setup_diva_isa (struct IsdnCard *card) +{ +struct IsdnCardState *cs = card->cs; + +if (!card->para[1 ]) +return (-1 );/* card not found; continue search */ + + cs->hw.diva.ctrl_reg =0 ; + cs->hw.diva.cfg_reg = card->para[1 ]; + val =readreg (cs->hw.diva.cfg_reg +DIVA_IPAC_ADR , + cs->hw.diva.cfg_reg +DIVA_IPAC_DATA ,IPAC_ID ); +printk (KERN_INFO "Diva: IPAC version %x\n" , val); +if ((val ==1 ) || (val==2 )) { + 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 ; + } + cs->irq = card->para[0 ]; + +return (1 );/* card found */ +} + +#else /* if !CONFIG_ISA */ + +static int __devinit setup_diva_isa (struct IsdnCard *card) +{ +return (-1 );/* card not found; continue search */ +} + +#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 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) +{ +struct IsdnCardState *cs = card->cs; +struct pnp_dev *pnp_d; + +if (!isapnp_present ()) +return (-1 );/* card not found; continue search */ + +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 ; + } + +return (-1 );/* card not found; continue search */ +} + +#else /* if !ISAPNP */ + +static int __devinit setup_diva_isapnp (struct IsdnCard *card) +{ +return (-1 );/* card not found; continue search */ +} + +#endif /* ISAPNP */ + +#ifdef CONFIG_PCI +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 ; + +static int __devinit setup_diva_pci (struct IsdnCard *card) +{ +struct IsdnCardState *cs = card->cs; + + 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->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 ); + 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->subtyp =DIVA_IPAC_PCI ; + cs->irq = dev_diva201->irq; + cs->hw.diva.pci_cfg = + (ulong )ioremap (pci_resource_start (dev_diva201,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 ); + cs->subtyp =DIVA_IPACX_PCI ; + cs->irq = dev_diva202->irq; + cs->hw.diva.pci_cfg = + (ulong )ioremap (pci_resource_start (dev_diva202,0 ),4096 ); + cs->hw.diva.cfg_reg = + (ulong )ioremap (pci_resource_start (dev_diva202,1 ),4096 ); + }else { +return (-1 );/* card not found; continue search */ + } + +if (!cs->irq) { +printk (KERN_WARNING "Diva: No IRQ for PCI card found\n" ); +iounmap_diva (cs); +return (0 ); + } + +if (!cs->hw.diva.cfg_reg) { +printk (KERN_WARNING "Diva: No IO-Adr for PCI card found\n" ); +iounmap_diva (cs); +return (0 ); + } + cs->irq_flags |=IRQF_SHARED ; + +if ((cs->subtyp ==DIVA_IPAC_PCI ) || + (cs->subtyp ==DIVA_IPACX_PCI ) ) { + cs->hw.diva.ctrl =0 ; + cs->hw.diva.isac =0 ; + cs->hw.diva.hscx =0 ; + cs->hw.diva.isac_adr =0 ; + cs->hw.diva.hscx_adr =0 ; +test_and_set_bit (HW_IPAC , &cs->HW_Flags); + }else { + cs->hw.diva.ctrl = cs->hw.diva.cfg_reg +DIVA_PCI_CTRL ; + cs->hw.diva.isac = cs->hw.diva.cfg_reg +DIVA_PCI_ISAC_DATA ; + cs->hw.diva.hscx = cs->hw.diva.cfg_reg +DIVA_HSCX_DATA ; + cs->hw.diva.isac_adr = cs->hw.diva.cfg_reg +DIVA_PCI_ISAC_ADR ; + cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg +DIVA_HSCX_ADR ; + } + +return (1 );/* card found */ +} + +#else /* if !CONFIG_PCI */ + +static int __devinit setup_diva_pci (struct IsdnCard *card) +{ +return (-1 );/* card not found; continue search */ +} + +#endif /* CONFIG_PCI */ + +int __devinit +setup_diva (struct IsdnCard *card) +{ +int rc, have_card =0 ; +struct IsdnCardState *cs = card->cs; +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 ; + + rc =setup_diva_isa (card); +if (!rc) +return rc; +if (rc >0 ) { + have_card =1 ; + goto ready; + } + + rc =setup_diva_isapnp (card); +if (!rc) +return rc; +if (rc >0 ) { + have_card =1 ; + goto ready; + } + + rc =setup_diva_pci (card); +if (!rc) +return rc; +if (rc >0 ) + have_card =1 ; + +ready: +if (!have_card) { +printk (KERN_WARNING "Diva: No ISA, ISAPNP or PCI card found\n" ); +return (0 ); + } + +return setup_diva_common (card->cs); +}
PATCH 3/4 diva: convert to new-style probing
In reply to Jeff GarzikThis patch was committed to the 'isdn-pci' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
commit b7372544f124885348bc6a1207ff4fcd7998a545
Author: Jeff Garzik <[email protected]> Date: Thu Aug 2 06:22:20 2007 -0400
[ISDN] HiSax diva: convert to PCI/PNP/ISA new-style APIs
drivers/isdn/hisax/Kconfig | 3 drivers/isdn/hisax/Makefile | 3 drivers/isdn/hisax/avm_pci.c | 9 drivers/isdn/hisax/config.c | 27 -- drivers/isdn/hisax/diva.c | 452 ++++++++++++++++++++++++++----------------- drivers/isdn/hisax/niccy.c | 2 6 files changed, 288 insertions(+), 208 deletions(-)
b7372544f124885348bc6a1207ff4fcd7998a545
drivers/isdn/hisax/Kconfig +2 -1
@@ -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.
drivers/isdn/hisax/Makefile +2 -1
@@ -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-objs := bkm_a4t.o jade.o enternow-objs := enternow_pci.o amd7930_fn.o netjet_s-objs := nj_s.o netjet_u-objs := nj_u.o icc.o +hisaxdiva-objs := diva.o ipacx.o libhisax-objs := 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
drivers/isdn/hisax/avm_pci.c +6 -3
@@ -789,8 +789,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);
@@ -801,7 +801,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
@@ -897,6 +898,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,
drivers/isdn/hisax/config.c +2 -25
@@ -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
@@ -404,10 +397,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
@@ -769,11 +758,6 @@ static int 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);
@@ -841,6 +825,7 @@ static int 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]);
@@ -1272,7 +1257,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 :
@@ -1308,6 +1292,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 :
@@ -1781,14 +1766,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},
drivers/isdn/hisax/diva.c +274 -178
535 lines not on this page · raw message
drivers/isdn/hisax/niccy.c +2 -0
@@ -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,
commit bbf983c1ad6dd15580e004bb02ad4071381e8e13
Author: Jeff Garzik <[email protected]> Date: Thu Aug 2 07:46:53 2007 -0400
[ISDN] HiSax diva: ia32 build fixes
drivers/isdn/hisax/diva.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
bbf983c1ad6dd15580e004bb02ad4071381e8e13
drivers/isdn/hisax/diva.c +12 -10
@@ -24,7 +24,8 @@#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 */
@@ -1085,10 +1086,10 @@ static int __devinit diva_pnp_setup(struct IsdnCard *card) {struct IsdnCardState *cs = card->cs;struct pnp_dev *pnp_d = (void *) card->para[0 ]; +int ipid_function = card->para[1 ];int err; -printk (KERN_INFO "HiSax: %s detected\n" , - (char *)ipid->driver_data); +printk (KERN_INFO "HiSax: DIVA PNP detected\n" );pnp_disable_dev (pnp_d); err =pnp_activate_dev (pnp_d);if (err<0 ) {
@@ -1106,7 +1107,7 @@ static int __devinit diva_pnp_setup(struct IsdnCard *card) } cs->hw.diva.cfg_reg = card->para[1 ]; cs->irq = card->para[0 ]; -if (ipid->function ==ISAPNP_FUNCTION (0xA1 )) { +if (ipid_function ==0xA1 ) { cs->subtyp =DIVA_IPAC_ISA ; cs->hw.diva.ctrl =0 ; cs->hw.diva.isac =
@@ -1142,6 +1143,7 @@ static int __devinit diva_pnp_init_one(struct pnp_dev *pdev,int cardnr; icard.para[0 ] = (unsigned long ) pdev; + icard.para[1 ] = dev_id->driver_data;if (!diva_protocol) icard.protocol =DEFAULT_PROTO ;else
@@ -1163,12 +1165,12 @@ static void __devexit diva_pnp_remove_one(struct pnp_dev *pdev) }static struct pnp_device_id diva_pnp_table[] = { - { .id ="GDI0051" , }, - { .id ="GDI0071" , }, - { .id ="GDI00A1" , }, - { .id ="EIC0051" , }, - { .id ="EIC0071" , }, - { .id ="EIC00A1" , }, + { .id ="GDI0051" ,0 }, + { .id ="GDI0071" ,0 }, + { .id ="GDI00A1" ,0xA1 }, + { .id ="EIC0051" ,0 }, + { .id ="EIC0071" ,0 }, + { .id ="EIC00A1" ,0xA1 }, { .id ="" }/* terminate list */ };
PATCH 4/4 HiSax bkm_a8: convert to new-style PCI probing
In reply to Jeff GarzikThis patch was committed to the 'isdn-pci' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
commit 8b007a8381e15f7e931123e76cff10f50e841964
Author: Jeff Garzik <[email protected]> Date: Thu Aug 2 08:37:15 2007 -0400
[ISDN] HiSax bkm_a8: convert to PCI hotplug API
drivers/isdn/hisax/Kconfig | 2 drivers/isdn/hisax/Makefile | 2 drivers/isdn/hisax/bkm_a8.c | 206 ++++++++++++++++++++++++++++---------------- drivers/isdn/hisax/config.c | 48 ---------- 4 files changed, 137 insertions(+), 121 deletions(-)
8b007a8381e15f7e931123e76cff10f50e841964
drivers/isdn/hisax/Kconfig +1 -1
@@ -298,7 +298,7 @@ config HISAX_BKM_A4T settings. config HISAX_SCT_QUADRO - bool "Scitel Quadro card" + tristate "Scitel Quadro card" depends on PCI help This enables HiSax support for the Scitel Quadro card.
drivers/isdn/hisax/Makefile +1 -1
@@ -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-objs := bkm_a4t.o jade.o enternow-objs := 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
drivers/isdn/hisax/bkm_a8.c +133 -73
273 lines not on this page · raw message
drivers/isdn/hisax/config.c +2 -46
89 lines not on this page · raw message
PATCH 1/2 hysdn: convert to PCI hotplug API
In reply to Jeff GarzikThis patch has been committed to the 'hysdn' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
commit b025c86cba3bb9fd7218ce6e8a60f0c65b414d0c
Author: Jeff Garzik <[email protected]> Date: Thu Aug 2 18:51:14 2007 -0400
[ISDN] hysdn: convert to PCI hotplug API
drivers/isdn/hysdn/hysdn_init.c | 274 ++++++++++++++++++---------------------- 1 file changed, 130 insertions(+), 144 deletions(-)
b025c86cba3bb9fd7218ce6e8a60f0c65b414d0c
drivers/isdn/hysdn/hysdn_init.c +130 -144
@@ -20,10 +20,15 @@#include "hysdn_defs.h" static struct pci_device_id hysdn_pci_tbl[] = { - {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_METRO }, - {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 }, - {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_ERGO }, - {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX ,PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO }, + {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX , +PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_METRO ,0 ,0 ,BD_METRO }, + {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX , +PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 ,0 ,0 ,BD_CHAMP2 }, + {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX , +PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_ERGO ,0 ,0 ,BD_ERGO }, + {PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX , +PCI_ANY_ID ,PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO ,0 ,0 ,BD_ERGO }, + { }/* Terminating entry */ };MODULE_DEVICE_TABLE (pci, hysdn_pci_tbl);
@@ -34,128 +39,7 @@ MODULE_LICENSE("GPL");static char *hysdn_init_revision ="$Revision: 1.6.6.6 $" ;static int cardmax;/* number of found cards */ hysdn_card *card_root =NULL ;/* pointer to first card */ - -/**********************************************/ -/* table assigning PCI-sub ids to board types */ -/* the last entry contains all 0 */ -/**********************************************/ -static struct { -unsigned short subid;/* PCI sub id */ -unsigned char cardtyp;/* card type assigned */ -} pci_subid_map[] = { - - { -PCI_SUBDEVICE_ID_HYPERCOPE_METRO ,BD_METRO - }, - { -PCI_SUBDEVICE_ID_HYPERCOPE_CHAMP2 ,BD_CHAMP2 - }, - { -PCI_SUBDEVICE_ID_HYPERCOPE_ERGO ,BD_ERGO - }, - { -PCI_SUBDEVICE_ID_HYPERCOPE_OLD_ERGO ,BD_ERGO - }, - { -0 ,0 - }/* terminating entry */ -}; - - -/*********************************************************************/ -/* search_cards searches for available cards in the pci config data. */ -/* If a card is found, the card structure is allocated and the cards */ -/* ressources are reserved. cardmax is incremented. */ -/*********************************************************************/ -static void -search_cards (void ) -{ -struct pci_dev *akt_pcidev =NULL ; -hysdn_card *card, *card_last; -int i; - - card_root =NULL ; - card_last =NULL ; -while ((akt_pcidev =pci_find_device (PCI_VENDOR_ID_HYPERCOPE ,PCI_DEVICE_ID_HYPERCOPE_PLX , - akt_pcidev)) !=NULL ) { -if (pci_enable_device (akt_pcidev)) -continue ; - -if (!(card =kzalloc (sizeof (hysdn_card),GFP_KERNEL ))) { -printk (KERN_ERR "HYSDN: unable to alloc device mem \n" ); -return ; - } - card->myid = cardmax;/* set own id */ - card->bus = akt_pcidev->bus->number; - card->devfn = akt_pcidev->devfn;/* slot + function */ - card->subsysid = akt_pcidev->subsystem_device; - card->irq = akt_pcidev->irq; - card->iobase =pci_resource_start (akt_pcidev,PCI_REG_PLX_IO_BASE ); - card->plxbase =pci_resource_start (akt_pcidev,PCI_REG_PLX_MEM_BASE ); - card->membase =pci_resource_start (akt_pcidev,PCI_REG_MEMORY_BASE ); - card->brdtype =BD_NONE ;/* unknown */ - card->debug_flags =DEF_DEB_FLAGS ;/* set default debug */ - card->faxchans =0 ;/* default no fax channels */ - card->bchans =2 ;/* and 2 b-channels */ -for (i =0 ; pci_subid_map[i].subid; i++) -if (pci_subid_map[i].subid == card->subsysid) { - card->brdtype = pci_subid_map[i].cardtyp; -break ; - } -if (card->brdtype !=BD_NONE ) { -if (ergo_inithardware (card)) { -printk (KERN_WARNING "HYSDN: card at io 0x%04x already in use\n" , card->iobase); -kfree (card); -continue ; - } - }else { -printk (KERN_WARNING "HYSDN: unknown card id 0x%04x\n" , card->subsysid); -kfree (card);/* release mem */ -continue ; - } - cardmax++; - card->next =NULL ;/*end of chain */ -if (card_last) - card_last->next = card;/* pointer to next card */ -else - card_root = card; - card_last = card;/* new chain end */ - }/* device found */ -}/* search_cards */ - -/************************************************************************************/ -/* free_resources frees the acquired PCI resources and returns the allocated memory */ -/************************************************************************************/ -static void -free_resources (void ) -{ -hysdn_card *card; - -while (card_root) { - card = card_root; -if (card->releasehardware) - card->releasehardware (card);/* free all hardware resources */ - card_root = card_root->next;/* remove card from chain */ -kfree (card);/* return mem */ - - }/* while card_root */ -}/* free_resources */ - -/**************************************************************************/ -/* stop_cards disables (hardware resets) all cards and disables interrupt */ -/**************************************************************************/ -static void -stop_cards (void ) -{ -hysdn_card *card; - - card = card_root;/* first in chain */ -while (card) { -if (card->stopcard) - card->stopcard (card); - card = card->next;/* remove card from chain */ - }/* while card */ -}/* stop_cards */ +static hysdn_card *card_last =NULL ;/* pointer to first card */ /****************************************************************************/
@@ -191,31 +75,138 @@ hysdn_getrev(const char *revision)/* and the module is added to the list in /proc/modules, otherwise an error */ /* is assumed and the module will not be kept in memory. */ /****************************************************************************/ + +static int __devinit hysdn_pci_init_one (struct pci_dev *akt_pcidev, +const struct pci_device_id *ent) +{ +hysdn_card *card; +int rc; + + rc =pci_enable_device (akt_pcidev); +if (rc) +return rc; + +if (!(card =kzalloc (sizeof (hysdn_card),GFP_KERNEL ))) { +printk (KERN_ERR "HYSDN: unable to alloc device mem \n" ); + rc = -ENOMEM ; + goto err_out; + } + card->myid = cardmax;/* set own id */ + card->bus = akt_pcidev->bus->number; + card->devfn = akt_pcidev->devfn;/* slot + function */ + card->subsysid = akt_pcidev->subsystem_device; + card->irq = akt_pcidev->irq; + card->iobase =pci_resource_start (akt_pcidev,PCI_REG_PLX_IO_BASE ); + card->plxbase =pci_resource_start (akt_pcidev,PCI_REG_PLX_MEM_BASE ); + card->membase =pci_resource_start (akt_pcidev,PCI_REG_MEMORY_BASE ); + card->brdtype =BD_NONE ;/* unknown */ + card->debug_flags =DEF_DEB_FLAGS ;/* set default debug */ + card->faxchans =0 ;/* default no fax channels */ + card->bchans =2 ;/* and 2 b-channels */ + card->brdtype = ent->driver_data; + +if (ergo_inithardware (card)) { +printk (KERN_WARNING "HYSDN: card at io 0x%04x already in use\n" , card->iobase); + rc = -EBUSY ; + goto err_out_card; + } + + cardmax++; + card->next =NULL ;/*end of chain */ +if (card_last) + card_last->next = card;/* pointer to next card */ +else + card_root = card; + card_last = card;/* new chain end */ + +pci_set_drvdata (akt_pcidev, card); +return 0 ; + +err_out_card: +kfree (card); +err_out: +pci_disable_device (akt_pcidev); +return rc; +} + +static void __devexit hysdn_pci_remove_one(struct pci_dev *akt_pcidev) +{ +hysdn_card *card =pci_get_drvdata (akt_pcidev); + +pci_set_drvdata (akt_pcidev,NULL ); + +if (card->stopcard) + card->stopcard (card); + +#ifdef CONFIG_HYSDN_CAPI +hycapi_capi_release (card); +#endif + +if (card->releasehardware) + card->releasehardware (card);/* free all hardware resources */ + +if (card == card_root) { + card_root = card_root->next; +if (!card_root) + card_last =NULL ; + }else { +hysdn_card *tmp = card_root; +while (tmp) { +if (tmp->next == card) + tmp->next = card->next; + card_last = tmp; + tmp = tmp->next; + } + } + +kfree (card); +pci_disable_device (akt_pcidev); +} + +static struct pci_driver hysdn_pci_driver = { + .name ="hysdn" , + .id_table = hysdn_pci_tbl, + .probe = hysdn_pci_init_one, + .remove =__devexit_p (hysdn_pci_remove_one), +}; + +static int hysdn_have_procfs; +static int __init hysdn_init (void ) {char tmp[50 ]; +int rc;strcpy (tmp, hysdn_init_revision);printk (KERN_NOTICE "HYSDN: module Rev: %s loaded\n" ,hysdn_getrev (tmp));strcpy (tmp, hysdn_net_revision);printk (KERN_NOTICE "HYSDN: network interface Rev: %s \n" ,hysdn_getrev (tmp)); -search_cards (); + + rc =pci_register_driver (&hysdn_pci_driver); +if (rc) +return rc; +printk (KERN_INFO "HYSDN: %d card(s) found.\n" , cardmax); -if (hysdn_procconf_init ()) { -free_resources ();/* proc file_sys not created */ -return (-1 ); - } +if (!hysdn_procconf_init ()) + hysdn_have_procfs =1 ; +#ifdef CONFIG_HYSDN_CAPI if (cardmax >0 ) {if (hycapi_init ()) {printk (KERN_ERR "HYCAPI: init failed\n" ); -return (-1 ); + +if (hysdn_have_procfs) +hysdn_procconf_release (); + +pci_unregister_driver (&hysdn_pci_driver); +return -ESPIPE ; } }#endif /* CONFIG_HYSDN_CAPI */ -return (0 );/* no error */ + +return 0 ;/* no error */ }/* init_module */
@@ -230,20 +221,15 @@ hysdn_init(void) static void __exithysdn_exit (void ) { +if (hysdn_have_procfs) +hysdn_procconf_release (); + +pci_unregister_driver (&hysdn_pci_driver); +#ifdef CONFIG_HYSDN_CAPI -hysdn_card *card; -#endif /* CONFIG_HYSDN_CAPI */ -stop_cards (); -#ifdef CONFIG_HYSDN_CAPI - card = card_root;/* first in chain */ -while (card) { -hycapi_capi_release (card); - card = card->next;/* remove card from chain */ - }/* while card */ hycapi_cleanup ();#endif /* CONFIG_HYSDN_CAPI */ -hysdn_procconf_release (); -free_resources (); +printk (KERN_NOTICE "HYSDN: module unloaded\n" ); }/* cleanup_module */
PATCH 2/2 hysdn: fix SMP brokenness
This patch has been committed to the 'hysdn' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git
commit 4ef2632c0fdf4598cf6a417f39514257ecbb2ba2
Author: Jeff Garzik <[email protected]> Date: Thu Aug 2 19:08:10 2007 -0400
[ISDN] hysdn: fix SMP brokenness
drivers/isdn/hysdn/Kconfig | 2 +- drivers/isdn/hysdn/boardergo.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-)
4ef2632c0fdf4598cf6a417f39514257ecbb2ba2
drivers/isdn/hysdn/Kconfig +1 -1
@@ -3,7 +3,7 @@ # config HYSDN tristate "Hypercope HYSDN cards (Champ, Ergo, Metro) support (module only)" - depends on m && PROC_FS && PCI && BROKEN_ON_SMP + depends on m && PROC_FS && PCI help Say Y here if you have one of Hypercope's active PCI ISDN cards Champ, Ergo and Metro. You will then get a module called hysdn.
drivers/isdn/hysdn/boardergo.c +8 -6
@@ -90,7 +90,12 @@ ergo_irq_bh(struct work_struct *ugli_api) card->hw_lock =1 ;/* we now lock the hardware */ do { - sti(); /* reenable other ints */ + spin_unlock_irqrestore(&card->hysdn_lock, flags); + + cond_resched(); + + spin_lock_irqsave(&card->hysdn_lock, flags); + again = 0; /* assume loop not to be repeated */ if (!dpr->ToHyFlag) {
@@ -110,7 +115,7 @@ ergo_irq_bh(struct work_struct *ugli_api) again =1 ;/* restart loop */ } }/* a message has arrived for us */ -cli ();/* no further ints */ +if (again) { dpr->ToHyInt =1 ; dpr->ToPcInt =1 ;/* interrupt to E1 for all cards */
@@ -240,9 +245,7 @@ ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf,while (!dpram->ToHyNoDpramErrLog);/* reread volatile register to flush PCI */ byteout (card->iobase +PCI9050_USER_IO ,PCI9050_E1_RUN );/* start E1 processor */ -/* the interrupts are still masked */ -sti ();msleep_interruptible (20 );/* Timeout 20ms */ if (((tDpramBootSpooler *) card->dpram)->Len !=DPRAM_SPOOLER_DATA_SIZE ) {
@@ -276,7 +279,6 @@ ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len) dst = sp->Data;/* point to data in spool structure */ buflen = sp->Len;/* maximum len of spooled data */ wr_mirror = sp->WrPtr;/* only once read */ -sti ();/* try until all bytes written or error */ i =0x1000 ;/* timeout value */
@@ -380,7 +382,7 @@ ergo_waitpofready(struct HYSDN_CARD *card)#endif /* CONFIG_HYSDN_CAPI */ return (0 );/* success */ }/* data has arrived */ -sti (); +msleep_interruptible (50 );/* Timeout 50ms */ }/* wait until timeout */