提交 42f04b6d 编写于 作者: L Linus Torvalds

Merge branch 'isdn-cleanups' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6

* 'isdn-cleanups' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6:
  [ISDN] HiSax diva: split setup into three smaller functions
  [ISDN] HiSax sedlbauer: move ISAPNP and PCI code into functions of their own
  [ISDN] HiSax elsa: split huge setup function into four smaller functions
  [ISDN] HiSax avm_pci: split setup into three smaller functions
  [ISDN] Remove CONFIG_PCI ifdefs from 100% PCI source code
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include <linux/isapnp.h> #include <linux/isapnp.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
extern const char *CardType[];
static const char *avm_pci_rev = "$Revision: 1.29.2.4 $"; static const char *avm_pci_rev = "$Revision: 1.29.2.4 $";
#define AVM_FRITZ_PCI 1 #define AVM_FRITZ_PCI 1
...@@ -726,34 +725,74 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -726,34 +725,74 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0); return(0);
} }
#ifdef CONFIG_PCI static int __devinit avm_setup_rest(struct IsdnCardState *cs)
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)
{ {
u_int val, ver; u_int val, ver;
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, avm_pci_rev); cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
printk(KERN_INFO "HiSax: AVM PCI driver Rev. %s\n", HiSax_getrev(tmp)); if (!request_region(cs->hw.avm.cfg_reg, 32,
if (cs->typ != ISDN_CTYPE_FRITZPCI) (cs->subtyp == AVM_FRITZ_PCI) ? "avm PCI" : "avm PnP")) {
printk(KERN_WARNING
"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); 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__ switch (cs->subtyp) {
if (isapnp_present()) { case AVM_FRITZ_PCI:
val = inl(cs->hw.avm.cfg_reg);
printk(KERN_INFO "AVM PCI: stat %#x\n", val);
printk(KERN_INFO "AVM PCI: Class %X Rev %d\n",
val & 0xff, (val>>8) & 0xff);
cs->BC_Read_Reg = &ReadHDLC_s;
cs->BC_Write_Reg = &WriteHDLC_s;
break;
case AVM_FRITZ_PNP:
val = inb(cs->hw.avm.cfg_reg);
ver = inb(cs->hw.avm.cfg_reg + 1);
printk(KERN_INFO "AVM PnP: Class %X Rev %d\n", val, ver);
cs->BC_Read_Reg = &ReadHDLCPnP;
cs->BC_Write_Reg = &WriteHDLCPnP;
break;
default:
printk(KERN_WARNING "AVM unknown subtype %d\n", cs->subtyp);
return(0);
}
printk(KERN_INFO "HiSax: %s config irq:%d base:0x%X\n",
(cs->subtyp == AVM_FRITZ_PCI) ? "AVM Fritz!PCI" : "AVM Fritz!PnP",
cs->irq, cs->hw.avm.cfg_reg);
setup_isac(cs);
cs->readisac = &ReadISAC;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->BC_Send_Data = &hdlc_fill_fifo;
cs->cardmsg = &AVM_card_msg;
cs->irq_func = &avm_pcipnp_interrupt;
cs->writeisac(cs, ISAC_MASK, 0xFF);
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; struct pnp_dev *pnp_avm_d = NULL;
if (!isapnp_present())
return(1); /* no-op: success */
if ((pnp_avm_c = pnp_find_card( if ((pnp_avm_c = pnp_find_card(
ISAPNP_VENDOR('A', 'V', 'M'), ISAPNP_VENDOR('A', 'V', 'M'),
ISAPNP_FUNCTION(0x0900), pnp_avm_c))) { ISAPNP_FUNCTION(0x0900), pnp_avm_c))) {
...@@ -781,82 +820,91 @@ setup_avm_pcipnp(struct IsdnCard *card) ...@@ -781,82 +820,91 @@ setup_avm_pcipnp(struct IsdnCard *card)
return(0); return(0);
} }
cs->subtyp = AVM_FRITZ_PNP; cs->subtyp = AVM_FRITZ_PNP;
goto ready;
} return (2); /* goto 'ready' label */
} }
} else {
printk(KERN_INFO "FritzPnP: no ISA PnP present\n");
} }
#endif
#ifdef CONFIG_PCI 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, if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
PCI_DEVICE_ID_AVM_A1, dev_avm))) { PCI_DEVICE_ID_AVM_A1, dev_avm))) {
if (pci_enable_device(dev_avm)) if (pci_enable_device(dev_avm))
return(0); return(0);
cs->irq = dev_avm->irq; cs->irq = dev_avm->irq;
if (!cs->irq) { if (!cs->irq) {
printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n"); printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n");
return(0); return(0);
} }
cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1); cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
if (!cs->hw.avm.cfg_reg) { if (!cs->hw.avm.cfg_reg) {
printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n"); printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
return(0); return(0);
} }
cs->subtyp = AVM_FRITZ_PCI; cs->subtyp = AVM_FRITZ_PCI;
} else { } else {
printk(KERN_WARNING "FritzPCI: No PCI card found\n"); printk(KERN_WARNING "FritzPCI: No PCI card found\n");
return(0); return(0);
} }
cs->irq_flags |= IRQF_SHARED; cs->irq_flags |= IRQF_SHARED;
#else
printk(KERN_WARNING "FritzPCI: NO_PCI_BIOS\n"); return (1);
return (0); }
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
ready:
cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10; int __devinit
if (!request_region(cs->hw.avm.cfg_reg, 32, setup_avm_pcipnp(struct IsdnCard *card)
(cs->subtyp == AVM_FRITZ_PCI) ? "avm PCI" : "avm PnP")) { {
printk(KERN_WARNING struct IsdnCardState *cs = card->cs;
"HiSax: %s config port %x-%x already in use\n", char tmp[64];
CardType[card->typ], int rc;
cs->hw.avm.cfg_reg,
cs->hw.avm.cfg_reg + 31); 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); 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;
} }
switch (cs->subtyp) {
case AVM_FRITZ_PCI:
val = inl(cs->hw.avm.cfg_reg);
printk(KERN_INFO "AVM PCI: stat %#x\n", val);
printk(KERN_INFO "AVM PCI: Class %X Rev %d\n",
val & 0xff, (val>>8) & 0xff);
cs->BC_Read_Reg = &ReadHDLC_s;
cs->BC_Write_Reg = &WriteHDLC_s;
break;
case AVM_FRITZ_PNP:
val = inb(cs->hw.avm.cfg_reg);
ver = inb(cs->hw.avm.cfg_reg + 1);
printk(KERN_INFO "AVM PnP: Class %X Rev %d\n", val, ver);
cs->BC_Read_Reg = &ReadHDLCPnP;
cs->BC_Write_Reg = &WriteHDLCPnP;
break;
default:
printk(KERN_WARNING "AVM unknown subtype %d\n", cs->subtyp);
return(0);
}
printk(KERN_INFO "HiSax: %s config irq:%d base:0x%X\n",
(cs->subtyp == AVM_FRITZ_PCI) ? "AVM Fritz!PCI" : "AVM Fritz!PnP",
cs->irq, cs->hw.avm.cfg_reg);
setup_isac(cs); rc = avm_pnp_setup(cs);
cs->readisac = &ReadISAC; if (rc < 1)
cs->writeisac = &WriteISAC; return (0);
cs->readisacfifo = &ReadISACfifo; if (rc == 2)
cs->writeisacfifo = &WriteISACfifo; goto ready;
cs->BC_Send_Data = &hdlc_fill_fifo;
cs->cardmsg = &AVM_card_msg; rc = avm_pci_setup(cs);
cs->irq_func = &avm_pcipnp_interrupt; if (rc < 1)
cs->writeisac(cs, ISAC_MASK, 0xFF); return (0);
ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:");
return (1); ready:
return avm_setup_rest(cs);
} }
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include "bkm_ax.h" #include "bkm_ax.h"
#ifdef CONFIG_PCI
#define ATTEMPT_PCI_REMAPPING /* Required for PLX rev 1 */ #define ATTEMPT_PCI_REMAPPING /* Required for PLX rev 1 */
extern const char *CardType[]; extern const char *CardType[];
...@@ -279,12 +277,9 @@ static u_char pci_bus __devinitdata = 0; ...@@ -279,12 +277,9 @@ static u_char pci_bus __devinitdata = 0;
static u_char pci_device_fn __devinitdata = 0; static u_char pci_device_fn __devinitdata = 0;
static u_char pci_irq __devinitdata = 0; static u_char pci_irq __devinitdata = 0;
#endif /* CONFIG_PCI */
int __devinit int __devinit
setup_sct_quadro(struct IsdnCard *card) setup_sct_quadro(struct IsdnCard *card)
{ {
#ifdef CONFIG_PCI
struct IsdnCardState *cs = card->cs; struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
u_int found = 0; u_int found = 0;
...@@ -442,7 +437,4 @@ setup_sct_quadro(struct IsdnCard *card) ...@@ -442,7 +437,4 @@ setup_sct_quadro(struct IsdnCard *card)
sct_quadro_subtypes[cs->subtyp], sct_quadro_subtypes[cs->subtyp],
readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID)); readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID));
return (1); return (1);
#else
printk(KERN_ERR "HiSax: bkm_a8 only supported on PCI Systems\n");
#endif /* CONFIG_PCI */
} }
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/isapnp.h> #include <linux/isapnp.h>
extern const char *CardType[];
static const char *Diva_revision = "$Revision: 1.33.2.6 $"; static const char *Diva_revision = "$Revision: 1.33.2.6 $";
#define byteout(addr,val) outb(val,addr) #define byteout(addr,val) outb(val,addr)
...@@ -906,53 +904,107 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -906,53 +904,107 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0); return(0);
} }
static struct pci_dev *dev_diva __devinitdata = NULL; static int __devinit setup_diva_common(struct IsdnCardState *cs)
static struct pci_dev *dev_diva_u __devinitdata = NULL; {
static struct pci_dev *dev_diva201 __devinitdata = NULL; int bytecnt;
static struct pci_dev *dev_diva202 __devinitdata = NULL; u_char val;
#ifdef __ISAPNP__ if ((cs->subtyp == DIVA_ISA) || (cs->subtyp == DIVA_IPAC_ISA))
static struct isapnp_device_id diva_ids[] __devinitdata = { bytecnt = 8;
{ ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), else
ISAPNP_VENDOR('G', 'D', 'I'), ISAPNP_FUNCTION(0x51), bytecnt = 32;
(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]; printk(KERN_INFO
static struct pnp_card *pnp_c __devinitdata = NULL; "Diva: %s card configured at %#lx IRQ %d\n",
#endif (cs->subtyp == DIVA_PCI) ? "PCI" :
(cs->subtyp == DIVA_ISA) ? "ISA" :
(cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" :
(cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
cs->hw.diva.cfg_reg, cs->irq);
if ((cs->subtyp == DIVA_IPAC_PCI) ||
(cs->subtyp == DIVA_IPACX_PCI) ||
(cs->subtyp == DIVA_PCI) )
printk(KERN_INFO "Diva: %s space at %#lx\n",
(cs->subtyp == DIVA_PCI) ? "PCI" :
(cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI",
cs->hw.diva.pci_cfg);
if ((cs->subtyp != DIVA_IPAC_PCI) &&
(cs->subtyp != DIVA_IPACX_PCI) ) {
if (!request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn")) {
printk(KERN_WARNING
"HiSax: %s config port %lx-%lx already in use\n",
"diva",
cs->hw.diva.cfg_reg,
cs->hw.diva.cfg_reg + bytecnt);
iounmap_diva(cs);
return (0);
}
}
cs->BC_Read_Reg = &ReadHSCX;
cs->BC_Write_Reg = &WriteHSCX;
cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &Diva_card_msg;
setup_isac(cs);
if (cs->subtyp == DIVA_IPAC_ISA) {
cs->readisac = &ReadISAC_IPAC;
cs->writeisac = &WriteISAC_IPAC;
cs->readisacfifo = &ReadISACfifo_IPAC;
cs->writeisacfifo = &WriteISACfifo_IPAC;
cs->irq_func = &diva_irq_ipac_isa;
val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPAC_PCI) {
cs->readisac = &MemReadISAC_IPAC;
cs->writeisac = &MemWriteISAC_IPAC;
cs->readisacfifo = &MemReadISACfifo_IPAC;
cs->writeisacfifo = &MemWriteISACfifo_IPAC;
cs->BC_Read_Reg = &MemReadHSCX;
cs->BC_Write_Reg = &MemWriteHSCX;
cs->BC_Send_Data = &Memhscx_fill_fifo;
cs->irq_func = &diva_irq_ipac_pci;
val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPACX_PCI) {
cs->readisac = &MemReadISAC_IPACX;
cs->writeisac = &MemWriteISAC_IPACX;
cs->readisacfifo = &MemReadISACfifo_IPACX;
cs->writeisacfifo = &MemWriteISACfifo_IPACX;
cs->BC_Read_Reg = &MemReadHSCX_IPACX;
cs->BC_Write_Reg = &MemWriteHSCX_IPACX;
cs->BC_Send_Data = NULL; // function located in ipacx module
cs->irq_func = &diva_irq_ipacx_pci;
printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
} else { /* DIVA 2.0 */
cs->hw.diva.tl.function = (void *) diva_led_handler;
cs->hw.diva.tl.data = (long) cs;
init_timer(&cs->hw.diva.tl);
cs->readisac = &ReadISAC;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->irq_func = &diva_interrupt;
ISACVersion(cs, "Diva:");
if (HscxVersion(cs, "Diva:")) {
printk(KERN_WARNING
"Diva: wrong HSCX versions check IO address\n");
release_io_diva(cs);
return (0);
}
}
return (1);
}
#ifdef CONFIG_ISA
int __devinit static int __devinit setup_diva_isa(struct IsdnCard *card)
setup_diva(struct IsdnCard *card)
{ {
int bytecnt = 8;
u_char val;
struct IsdnCardState *cs = card->cs; struct IsdnCardState *cs = card->cs;
char tmp[64]; u_char val;
if (!card->para[1])
return (-1); /* card not found; continue search */
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.ctrl_reg = 0;
cs->hw.diva.cfg_reg = card->para[1]; cs->hw.diva.cfg_reg = card->para[1];
val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR, val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR,
...@@ -975,10 +1027,53 @@ setup_diva(struct IsdnCard *card) ...@@ -975,10 +1027,53 @@ setup_diva(struct IsdnCard *card)
cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR; cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
} }
cs->irq = card->para[0]; cs->irq = card->para[0];
} else {
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__ #ifdef __ISAPNP__
if (isapnp_present()) { 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; struct pnp_dev *pnp_d;
if (!isapnp_present())
return (-1); /* card not found; continue search */
while(ipid->card_vendor) { while(ipid->card_vendor) {
if ((pnp_c = pnp_find_card(ipid->card_vendor, if ((pnp_c = pnp_find_card(ipid->card_vendor,
ipid->card_device, pnp_c))) { ipid->card_device, pnp_c))) {
...@@ -1031,7 +1126,7 @@ setup_diva(struct IsdnCard *card) ...@@ -1031,7 +1126,7 @@ setup_diva(struct IsdnCard *card)
cs->hw.diva.hscx_adr = cs->hw.diva.hscx_adr =
card->para[1] + DIVA_HSCX_ADR; card->para[1] + DIVA_HSCX_ADR;
} }
goto ready; return (1); /* card found */
} else { } else {
printk(KERN_ERR "Diva PnP: PnP error card found, no device\n"); printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
return(0); return(0);
...@@ -1040,12 +1135,29 @@ setup_diva(struct IsdnCard *card) ...@@ -1040,12 +1135,29 @@ setup_diva(struct IsdnCard *card)
ipid++; ipid++;
pnp_c=NULL; pnp_c=NULL;
} }
if (!ipid->card_vendor) {
printk(KERN_INFO "Diva PnP: no ISAPnP card found\n"); return (-1); /* card not found; continue search */
} }
}
#endif #else /* if !ISAPNP */
static int __devinit setup_diva_isapnp(struct IsdnCard *card)
{
return (-1); /* card not found; continue search */
}
#endif /* ISAPNP */
#ifdef CONFIG_PCI #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; cs->subtyp = 0;
if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON, if ((dev_diva = pci_find_device(PCI_VENDOR_ID_EICON,
PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) { PCI_DEVICE_ID_EICON_DIVA20, dev_diva))) {
...@@ -1082,8 +1194,7 @@ setup_diva(struct IsdnCard *card) ...@@ -1082,8 +1194,7 @@ setup_diva(struct IsdnCard *card)
cs->hw.diva.cfg_reg = cs->hw.diva.cfg_reg =
(ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096); (ulong) ioremap(pci_resource_start(dev_diva202, 1), 4096);
} else { } else {
printk(KERN_WARNING "Diva: No PCI card found\n"); return (-1); /* card not found; continue search */
return(0);
} }
if (!cs->irq) { if (!cs->irq) {
...@@ -1098,11 +1209,7 @@ setup_diva(struct IsdnCard *card) ...@@ -1098,11 +1209,7 @@ setup_diva(struct IsdnCard *card)
return(0); return(0);
} }
cs->irq_flags |= IRQF_SHARED; 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) || if ((cs->subtyp == DIVA_IPAC_PCI) ||
(cs->subtyp == DIVA_IPACX_PCI) ) { (cs->subtyp == DIVA_IPACX_PCI) ) {
cs->hw.diva.ctrl = 0; cs->hw.diva.ctrl = 0;
...@@ -1111,98 +1218,66 @@ setup_diva(struct IsdnCard *card) ...@@ -1111,98 +1218,66 @@ setup_diva(struct IsdnCard *card)
cs->hw.diva.isac_adr = 0; cs->hw.diva.isac_adr = 0;
cs->hw.diva.hscx_adr = 0; cs->hw.diva.hscx_adr = 0;
test_and_set_bit(HW_IPAC, &cs->HW_Flags); test_and_set_bit(HW_IPAC, &cs->HW_Flags);
bytecnt = 0;
} else { } else {
cs->hw.diva.ctrl = cs->hw.diva.cfg_reg + DIVA_PCI_CTRL; 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.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.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.isac_adr = cs->hw.diva.cfg_reg + DIVA_PCI_ISAC_ADR;
cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg + DIVA_HSCX_ADR; cs->hw.diva.hscx_adr = cs->hw.diva.cfg_reg + DIVA_HSCX_ADR;
bytecnt = 32;
}
} }
#ifdef __ISAPNP__ return (1); /* card found */
ready: }
#endif
printk(KERN_INFO #else /* if !CONFIG_PCI */
"Diva: %s card configured at %#lx IRQ %d\n",
(cs->subtyp == DIVA_PCI) ? "PCI" : static int __devinit setup_diva_pci(struct IsdnCard *card)
(cs->subtyp == DIVA_ISA) ? "ISA" : {
(cs->subtyp == DIVA_IPAC_ISA) ? "IPAC ISA" : return (-1); /* card not found; continue search */
(cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI", }
cs->hw.diva.cfg_reg, cs->irq);
if ((cs->subtyp == DIVA_IPAC_PCI) || #endif /* CONFIG_PCI */
(cs->subtyp == DIVA_IPACX_PCI) ||
(cs->subtyp == DIVA_PCI) ) int __devinit
printk(KERN_INFO "Diva: %s space at %#lx\n", setup_diva(struct IsdnCard *card)
(cs->subtyp == DIVA_PCI) ? "PCI" : {
(cs->subtyp == DIVA_IPAC_PCI) ? "IPAC PCI" : "IPACX PCI", int rc, have_card = 0;
cs->hw.diva.pci_cfg); struct IsdnCardState *cs = card->cs;
if ((cs->subtyp != DIVA_IPAC_PCI) && char tmp[64];
(cs->subtyp != DIVA_IPACX_PCI) ) {
if (!request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn")) { strcpy(tmp, Diva_revision);
printk(KERN_WARNING printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
"HiSax: %s config port %lx-%lx already in use\n", if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
CardType[card->typ], return(0);
cs->hw.diva.cfg_reg, cs->hw.diva.status = 0;
cs->hw.diva.cfg_reg + bytecnt);
iounmap_diva(cs); rc = setup_diva_isa(card);
return (0); if (!rc)
} return rc;
if (rc > 0) {
have_card = 1;
goto ready;
} }
cs->BC_Read_Reg = &ReadHSCX;
cs->BC_Write_Reg = &WriteHSCX; rc = setup_diva_isapnp(card);
cs->BC_Send_Data = &hscx_fill_fifo; if (!rc)
cs->cardmsg = &Diva_card_msg; return rc;
setup_isac(cs); if (rc > 0) {
if (cs->subtyp == DIVA_IPAC_ISA) { have_card = 1;
cs->readisac = &ReadISAC_IPAC; goto ready;
cs->writeisac = &WriteISAC_IPAC;
cs->readisacfifo = &ReadISACfifo_IPAC;
cs->writeisacfifo = &WriteISACfifo_IPAC;
cs->irq_func = &diva_irq_ipac_isa;
val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPAC_PCI) {
cs->readisac = &MemReadISAC_IPAC;
cs->writeisac = &MemWriteISAC_IPAC;
cs->readisacfifo = &MemReadISACfifo_IPAC;
cs->writeisacfifo = &MemWriteISACfifo_IPAC;
cs->BC_Read_Reg = &MemReadHSCX;
cs->BC_Write_Reg = &MemWriteHSCX;
cs->BC_Send_Data = &Memhscx_fill_fifo;
cs->irq_func = &diva_irq_ipac_pci;
val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPACX_PCI) {
cs->readisac = &MemReadISAC_IPACX;
cs->writeisac = &MemWriteISAC_IPACX;
cs->readisacfifo = &MemReadISACfifo_IPACX;
cs->writeisacfifo = &MemWriteISACfifo_IPACX;
cs->BC_Read_Reg = &MemReadHSCX_IPACX;
cs->BC_Write_Reg = &MemWriteHSCX_IPACX;
cs->BC_Send_Data = NULL; // function located in ipacx module
cs->irq_func = &diva_irq_ipacx_pci;
printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
} else { /* DIVA 2.0 */
cs->hw.diva.tl.function = (void *) diva_led_handler;
cs->hw.diva.tl.data = (long) cs;
init_timer(&cs->hw.diva.tl);
cs->readisac = &ReadISAC;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->irq_func = &diva_interrupt;
ISACVersion(cs, "Diva:");
if (HscxVersion(cs, "Diva:")) {
printk(KERN_WARNING
"Diva: wrong HSCX versions check IO address\n");
release_io_diva(cs);
return (0);
} }
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 (1);
return setup_diva_common(card->cs);
} }
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
extern const char *CardType[];
static const char *Elsa_revision = "$Revision: 2.32.2.4 $"; static const char *Elsa_revision = "$Revision: 2.32.2.4 $";
static const char *Elsa_Types[] = static const char *Elsa_Types[] =
{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro", {"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
...@@ -832,39 +830,12 @@ probe_elsa(struct IsdnCardState *cs) ...@@ -832,39 +830,12 @@ probe_elsa(struct IsdnCardState *cs)
return (CARD_portlist[i]); return (CARD_portlist[i]);
} }
static struct pci_dev *dev_qs1000 __devinitdata = NULL; static int __devinit
static struct pci_dev *dev_qs3000 __devinitdata = NULL; setup_elsa_isa(struct IsdnCard *card)
#ifdef __ISAPNP__
static struct isapnp_device_id elsa_ids[] __devinitdata = {
{ ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
(unsigned long) "Elsa QS1000" },
{ ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
(unsigned long) "Elsa QS3000" },
{ 0, }
};
static struct isapnp_device_id *ipid __devinitdata = &elsa_ids[0];
static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __devinit
setup_elsa(struct IsdnCard *card)
{ {
int bytecnt;
u_char val;
struct IsdnCardState *cs = card->cs; struct IsdnCardState *cs = card->cs;
char tmp[64]; u_char val;
strcpy(tmp, Elsa_revision);
printk(KERN_INFO "HiSax: Elsa driver Rev. %s\n", HiSax_getrev(tmp));
cs->hw.elsa.ctrl_reg = 0;
cs->hw.elsa.status = 0;
cs->hw.elsa.MFlag = 0;
cs->subtyp = 0;
if (cs->typ == ISDN_CTYPE_ELSA) {
cs->hw.elsa.base = card->para[0]; cs->hw.elsa.base = card->para[0];
printk(KERN_INFO "Elsa: Microlink IO probing\n"); printk(KERN_INFO "Elsa: Microlink IO probing\n");
if (cs->hw.elsa.base) { if (cs->hw.elsa.base) {
...@@ -877,7 +848,13 @@ setup_elsa(struct IsdnCard *card) ...@@ -877,7 +848,13 @@ setup_elsa(struct IsdnCard *card)
} }
} else } else
cs->hw.elsa.base = probe_elsa(cs); cs->hw.elsa.base = probe_elsa(cs);
if (cs->hw.elsa.base) {
if (!cs->hw.elsa.base) {
printk(KERN_WARNING
"No Elsa Microlink found\n");
return (0);
}
cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG; cs->hw.elsa.cfg = cs->hw.elsa.base + ELSA_CONFIG;
cs->hw.elsa.ctrl = cs->hw.elsa.base + ELSA_CONTROL; cs->hw.elsa.ctrl = cs->hw.elsa.base + ELSA_CONTROL;
cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE; cs->hw.elsa.ale = cs->hw.elsa.base + ELSA_ALE;
...@@ -919,12 +896,30 @@ setup_elsa(struct IsdnCard *card) ...@@ -919,12 +896,30 @@ setup_elsa(struct IsdnCard *card)
"Elsa: Microlink S0 bus power bad\n"); "Elsa: Microlink S0 bus power bad\n");
cs->hw.elsa.status |= ELSA_BAD_PWR; cs->hw.elsa.status |= ELSA_BAD_PWR;
} }
} else {
printk(KERN_WARNING return (1);
"No Elsa Microlink found\n"); }
return (0);
} #ifdef __ISAPNP__
} else if (cs->typ == ISDN_CTYPE_ELSA_PNP) { static struct isapnp_device_id elsa_ids[] __devinitdata = {
{ ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0133),
(unsigned long) "Elsa QS1000" },
{ ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
ISAPNP_VENDOR('E', 'L', 'S'), ISAPNP_FUNCTION(0x0134),
(unsigned long) "Elsa QS3000" },
{ 0, }
};
static struct isapnp_device_id *ipid __devinitdata = &elsa_ids[0];
static struct pnp_card *pnp_c __devinitdata = NULL;
#endif /* __ISAPNP__ */
static int __devinit
setup_elsa_isapnp(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
if (!card->para[1] && isapnp_present()) { if (!card->para[1] && isapnp_present()) {
struct pnp_dev *pnp_d; struct pnp_dev *pnp_d;
...@@ -972,7 +967,8 @@ setup_elsa(struct IsdnCard *card) ...@@ -972,7 +967,8 @@ setup_elsa(struct IsdnCard *card)
return(0); return(0);
} }
} }
#endif #endif /* __ISAPNP__ */
if (card->para[1] && card->para[0]) { if (card->para[1] && card->para[0]) {
cs->hw.elsa.base = card->para[1]; cs->hw.elsa.base = card->para[1];
cs->irq = card->para[0]; cs->irq = card->para[0];
...@@ -993,7 +989,16 @@ setup_elsa(struct IsdnCard *card) ...@@ -993,7 +989,16 @@ setup_elsa(struct IsdnCard *card)
Elsa_Types[cs->subtyp], Elsa_Types[cs->subtyp],
cs->hw.elsa.base, cs->hw.elsa.base,
cs->irq); cs->irq);
} else if (cs->typ == ISDN_CTYPE_ELSA_PCMCIA) {
return (1);
}
static void __devinit
setup_elsa_pcmcia(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
u_char val;
cs->hw.elsa.base = card->para[1]; cs->hw.elsa.base = card->para[1];
cs->irq = card->para[0]; cs->irq = card->para[0];
val = readreg(cs->hw.elsa.base + 0, cs->hw.elsa.base + 2, IPAC_ID); val = readreg(cs->hw.elsa.base + 0, cs->hw.elsa.base + 2, IPAC_ID);
...@@ -1018,8 +1023,17 @@ setup_elsa(struct IsdnCard *card) ...@@ -1018,8 +1023,17 @@ setup_elsa(struct IsdnCard *card)
Elsa_Types[cs->subtyp], Elsa_Types[cs->subtyp],
cs->hw.elsa.base, cs->hw.elsa.base,
cs->irq); cs->irq);
} else if (cs->typ == ISDN_CTYPE_ELSA_PCI) { }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static struct pci_dev *dev_qs1000 __devinitdata = NULL;
static struct pci_dev *dev_qs3000 __devinitdata = NULL;
static int __devinit
setup_elsa_pci(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
cs->subtyp = 0; cs->subtyp = 0;
if ((dev_qs1000 = pci_find_device(PCI_VENDOR_ID_ELSA, if ((dev_qs1000 = pci_find_device(PCI_VENDOR_ID_ELSA,
PCI_DEVICE_ID_ELSA_MICROLINK, dev_qs1000))) { PCI_DEVICE_ID_ELSA_MICROLINK, dev_qs1000))) {
...@@ -1068,13 +1082,25 @@ setup_elsa(struct IsdnCard *card) ...@@ -1068,13 +1082,25 @@ setup_elsa(struct IsdnCard *card)
cs->hw.elsa.base, cs->hw.elsa.base,
cs->hw.elsa.cfg, cs->hw.elsa.cfg,
cs->irq); cs->irq);
return (1);
}
#else #else
printk(KERN_WARNING "Elsa: Elsa PCI and NO_PCI_BIOS\n");
printk(KERN_WARNING "Elsa: unable to config Elsa PCI\n"); static void __devinit
return (0); setup_elsa_pci(struct IsdnCard *card)
{
return (1);
}
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
} else
return (0); static int __devinit
setup_elsa_common(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
u_char val;
int bytecnt;
switch (cs->subtyp) { switch (cs->subtyp) {
case ELSA_PC: case ELSA_PC:
...@@ -1104,8 +1130,7 @@ setup_elsa(struct IsdnCard *card) ...@@ -1104,8 +1130,7 @@ setup_elsa(struct IsdnCard *card)
here, it would fail. */ here, it would fail. */
if (cs->typ != ISDN_CTYPE_ELSA_PCMCIA && !request_region(cs->hw.elsa.base, bytecnt, "elsa isdn")) { if (cs->typ != ISDN_CTYPE_ELSA_PCMCIA && !request_region(cs->hw.elsa.base, bytecnt, "elsa isdn")) {
printk(KERN_WARNING printk(KERN_WARNING
"HiSax: %s config port %#lx-%#lx already in use\n", "HiSax: ELSA config port %#lx-%#lx already in use\n",
CardType[card->typ],
cs->hw.elsa.base, cs->hw.elsa.base,
cs->hw.elsa.base + bytecnt); cs->hw.elsa.base + bytecnt);
return (0); return (0);
...@@ -1113,8 +1138,7 @@ setup_elsa(struct IsdnCard *card) ...@@ -1113,8 +1138,7 @@ setup_elsa(struct IsdnCard *card)
if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI)) { if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI)) {
if (!request_region(cs->hw.elsa.cfg, 0x80, "elsa isdn pci")) { if (!request_region(cs->hw.elsa.cfg, 0x80, "elsa isdn pci")) {
printk(KERN_WARNING printk(KERN_WARNING
"HiSax: %s pci port %x-%x already in use\n", "HiSax: ELSA pci port %x-%x already in use\n",
CardType[card->typ],
cs->hw.elsa.cfg, cs->hw.elsa.cfg,
cs->hw.elsa.cfg + 0x80); cs->hw.elsa.cfg + 0x80);
release_region(cs->hw.elsa.base, bytecnt); release_region(cs->hw.elsa.base, bytecnt);
...@@ -1186,3 +1210,41 @@ setup_elsa(struct IsdnCard *card) ...@@ -1186,3 +1210,41 @@ setup_elsa(struct IsdnCard *card)
} }
return (1); return (1);
} }
int __devinit
setup_elsa(struct IsdnCard *card)
{
int rc;
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, Elsa_revision);
printk(KERN_INFO "HiSax: Elsa driver Rev. %s\n", HiSax_getrev(tmp));
cs->hw.elsa.ctrl_reg = 0;
cs->hw.elsa.status = 0;
cs->hw.elsa.MFlag = 0;
cs->subtyp = 0;
if (cs->typ == ISDN_CTYPE_ELSA) {
rc = setup_elsa_isa(card);
if (!rc)
return (0);
} else if (cs->typ == ISDN_CTYPE_ELSA_PNP) {
rc = setup_elsa_isapnp(card);
if (!rc)
return (0);
} else if (cs->typ == ISDN_CTYPE_ELSA_PCMCIA)
setup_elsa_pcmcia(card);
else if (cs->typ == ISDN_CTYPE_ELSA_PCI) {
rc = setup_elsa_pci(card);
if (!rc)
return (0);
} else
return (0);
return setup_elsa_common(card);
}
...@@ -518,8 +518,6 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -518,8 +518,6 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0); return(0);
} }
static struct pci_dev *dev_sedl __devinitdata = NULL;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id sedl_ids[] __devinitdata = { static struct isapnp_device_id sedl_ids[] __devinitdata = {
{ ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01), { ISAPNP_VENDOR('S', 'A', 'G'), ISAPNP_FUNCTION(0x01),
...@@ -533,45 +531,16 @@ static struct isapnp_device_id sedl_ids[] __devinitdata = { ...@@ -533,45 +531,16 @@ static struct isapnp_device_id sedl_ids[] __devinitdata = {
static struct isapnp_device_id *ipid __devinitdata = &sedl_ids[0]; static struct isapnp_device_id *ipid __devinitdata = &sedl_ids[0];
static struct pnp_card *pnp_c __devinitdata = NULL; static struct pnp_card *pnp_c __devinitdata = NULL;
#endif
int __devinit static int __devinit
setup_sedlbauer(struct IsdnCard *card) setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
{ {
int bytecnt, ver, val;
struct IsdnCardState *cs = card->cs; struct IsdnCardState *cs = card->cs;
char tmp[64]; struct pnp_dev *pnp_d;
u16 sub_vendor_id, sub_id;
strcpy(tmp, Sedlbauer_revision); if (!isapnp_present())
printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp)); return -1;
if (cs->typ == ISDN_CTYPE_SEDLBAUER) {
cs->subtyp = SEDL_SPEED_CARD_WIN;
cs->hw.sedl.bus = SEDL_BUS_ISA;
cs->hw.sedl.chip = SEDL_CHIP_TEST;
} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_PCMCIA) {
cs->subtyp = SEDL_SPEED_STAR;
cs->hw.sedl.bus = SEDL_BUS_PCMCIA;
cs->hw.sedl.chip = SEDL_CHIP_TEST;
} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_FAX) {
cs->subtyp = SEDL_SPEED_FAX;
cs->hw.sedl.bus = SEDL_BUS_ISA;
cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
} else
return (0);
bytecnt = 8;
if (card->para[1]) {
cs->hw.sedl.cfg_reg = card->para[1];
cs->irq = card->para[0];
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
bytecnt = 16;
}
} else {
#ifdef __ISAPNP__
if (isapnp_present()) {
struct pnp_dev *pnp_d;
while(ipid->card_vendor) { while(ipid->card_vendor) {
if ((pnp_c = pnp_find_card(ipid->card_vendor, if ((pnp_c = pnp_find_card(ipid->card_vendor,
ipid->card_device, pnp_c))) { ipid->card_device, pnp_c))) {
...@@ -603,12 +572,13 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -603,12 +572,13 @@ setup_sedlbauer(struct IsdnCard *card)
if (ipid->function == ISAPNP_FUNCTION(0x2)) { if (ipid->function == ISAPNP_FUNCTION(0x2)) {
cs->subtyp = SEDL_SPEED_FAX; cs->subtyp = SEDL_SPEED_FAX;
cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR; cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
bytecnt = 16; *bytecnt = 16;
} else { } else {
cs->subtyp = SEDL_SPEED_CARD_WIN; cs->subtyp = SEDL_SPEED_CARD_WIN;
cs->hw.sedl.chip = SEDL_CHIP_TEST; cs->hw.sedl.chip = SEDL_CHIP_TEST;
} }
goto ready;
return (1);
} else { } else {
printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n"); printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
return(0); return(0);
...@@ -617,13 +587,28 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -617,13 +587,28 @@ setup_sedlbauer(struct IsdnCard *card)
ipid++; ipid++;
pnp_c = NULL; pnp_c = NULL;
} }
if (!ipid->card_vendor) {
printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n"); printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
} return -1;
} }
#endif #else
/* Probe for Sedlbauer speed pci */
static int __devinit
setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
{
return -1;
}
#endif /* __ISAPNP__ */
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
static struct pci_dev *dev_sedl __devinitdata = NULL;
static int __devinit
setup_sedlbauer_pci(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
u16 sub_vendor_id, sub_id;
if ((dev_sedl = pci_find_device(PCI_VENDOR_ID_TIGERJET, if ((dev_sedl = pci_find_device(PCI_VENDOR_ID_TIGERJET,
PCI_DEVICE_ID_TIGERJET_100, dev_sedl))) { PCI_DEVICE_ID_TIGERJET_100, dev_sedl))) {
if (pci_enable_device(dev_sedl)) if (pci_enable_device(dev_sedl))
...@@ -667,7 +652,7 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -667,7 +652,7 @@ setup_sedlbauer(struct IsdnCard *card)
sub_vendor_id); sub_vendor_id);
return(0); return(0);
} }
bytecnt = 256;
cs->hw.sedl.reset_on = SEDL_ISAR_PCI_ISAR_RESET_ON; cs->hw.sedl.reset_on = SEDL_ISAR_PCI_ISAR_RESET_ON;
cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF; cs->hw.sedl.reset_off = SEDL_ISAR_PCI_ISAR_RESET_OFF;
byteout(cs->hw.sedl.cfg_reg, 0xff); byteout(cs->hw.sedl.cfg_reg, 0xff);
...@@ -678,15 +663,68 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -678,15 +663,68 @@ setup_sedlbauer(struct IsdnCard *card)
mdelay(2); mdelay(2);
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off); byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
mdelay(10); mdelay(10);
return (1);
}
#else #else
printk(KERN_WARNING "Sedlbauer: NO_PCI_BIOS\n");
return (0); static int __devinit
setup_sedlbauer_pci(struct IsdnCard *card)
{
return (1);
}
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
int __devinit
setup_sedlbauer(struct IsdnCard *card)
{
int bytecnt = 8, ver, val, rc;
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, Sedlbauer_revision);
printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ == ISDN_CTYPE_SEDLBAUER) {
cs->subtyp = SEDL_SPEED_CARD_WIN;
cs->hw.sedl.bus = SEDL_BUS_ISA;
cs->hw.sedl.chip = SEDL_CHIP_TEST;
} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_PCMCIA) {
cs->subtyp = SEDL_SPEED_STAR;
cs->hw.sedl.bus = SEDL_BUS_PCMCIA;
cs->hw.sedl.chip = SEDL_CHIP_TEST;
} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_FAX) {
cs->subtyp = SEDL_SPEED_FAX;
cs->hw.sedl.bus = SEDL_BUS_ISA;
cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
} else
return (0);
bytecnt = 8;
if (card->para[1]) {
cs->hw.sedl.cfg_reg = card->para[1];
cs->irq = card->para[0];
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
bytecnt = 16;
}
} else {
rc = setup_sedlbauer_isapnp(card, &bytecnt);
if (!rc)
return (0);
if (rc > 0)
goto ready;
/* Probe for Sedlbauer speed pci */
rc = setup_sedlbauer_pci(card);
if (!rc)
return (0);
bytecnt = 256;
} }
#ifdef __ISAPNP__
ready: ready:
#endif
/* In case of the sedlbauer pcmcia card, this region is in use, /* In case of the sedlbauer pcmcia card, this region is in use,
* reserved for us by the card manager. So we do not check it * reserved for us by the card manager. So we do not check it
......
...@@ -295,11 +295,12 @@ setup_telespci(struct IsdnCard *card) ...@@ -295,11 +295,12 @@ setup_telespci(struct IsdnCard *card)
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
#error "not running on big endian machines now" #error "not running on big endian machines now"
#endif #endif
strcpy(tmp, telespci_revision); strcpy(tmp, telespci_revision);
printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_TELESPCI) if (cs->typ != ISDN_CTYPE_TELESPCI)
return (0); return (0);
#ifdef CONFIG_PCI
if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) { if ((dev_tel = pci_find_device (PCI_VENDOR_ID_ZORAN, PCI_DEVICE_ID_ZORAN_36120, dev_tel))) {
if (pci_enable_device(dev_tel)) if (pci_enable_device(dev_tel))
return(0); return(0);
...@@ -317,11 +318,6 @@ setup_telespci(struct IsdnCard *card) ...@@ -317,11 +318,6 @@ setup_telespci(struct IsdnCard *card)
printk(KERN_WARNING "TelesPCI: No PCI card found\n"); printk(KERN_WARNING "TelesPCI: No PCI card found\n");
return(0); return(0);
} }
#else
printk(KERN_WARNING "HiSax: Teles/PCI and NO_PCI_BIOS\n");
printk(KERN_WARNING "HiSax: Teles/PCI unable to config\n");
return (0);
#endif /* CONFIG_PCI */
/* Initialize Zoran PCI controller */ /* Initialize Zoran PCI controller */
writel(0x00000000, cs->hw.teles0.membase + 0x28); writel(0x00000000, cs->hw.teles0.membase + 0x28);
......
...@@ -1009,7 +1009,7 @@ setup_w6692(struct IsdnCard *card) ...@@ -1009,7 +1009,7 @@ setup_w6692(struct IsdnCard *card)
printk(KERN_INFO "HiSax: W6692 driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: W6692 driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_W6692) if (cs->typ != ISDN_CTYPE_W6692)
return (0); return (0);
#ifdef CONFIG_PCI
while (id_list[id_idx].vendor_id) { while (id_list[id_idx].vendor_id) {
dev_w6692 = pci_find_device(id_list[id_idx].vendor_id, dev_w6692 = pci_find_device(id_list[id_idx].vendor_id,
id_list[id_idx].device_id, id_list[id_idx].device_id,
...@@ -1061,11 +1061,6 @@ setup_w6692(struct IsdnCard *card) ...@@ -1061,11 +1061,6 @@ setup_w6692(struct IsdnCard *card)
cs->hw.w6692.iobase + 255); cs->hw.w6692.iobase + 255);
return (0); return (0);
} }
#else
printk(KERN_WARNING "HiSax: W6692 and NO_PCI_BIOS\n");
printk(KERN_WARNING "HiSax: W6692 unable to config\n");
return (0);
#endif /* CONFIG_PCI */
printk(KERN_INFO printk(KERN_INFO
"HiSax: %s config irq:%d I/O:%x\n", "HiSax: %s config irq:%d I/O:%x\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册