Commit 4bffaa97 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Introduce per-card init function

Linux normally uses separate callbacks instead of a multiplexing
function like "cardmsg". So start to break that into pieces.
parent 62a758c5
...@@ -300,16 +300,23 @@ Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -300,16 +300,23 @@ Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_asuscom(cs); release_io_asuscom(cs);
return(0); return(0);
case CARD_INIT:
cs->debug |= L1_DEB_IPAC;
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
asuscom_init(struct IsdnCardState *cs)
{
cs->debug |= L1_DEB_IPAC;
inithscxisac(cs);
}
static struct card_ops asuscom_ops = {
.init = asuscom_init,
};
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id asus_ids[] __initdata = { static struct isapnp_device_id asus_ids[] __initdata = {
{ ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
...@@ -398,6 +405,7 @@ setup_asuscom(struct IsdnCard *card) ...@@ -398,6 +405,7 @@ setup_asuscom(struct IsdnCard *card)
cs->hw.asus.cfg_reg, cs->irq); cs->hw.asus.cfg_reg, cs->irq);
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Asus_card_msg; cs->cardmsg = &Asus_card_msg;
cs->card_ops = &asuscom_ops;
cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_IPAC_ALE; cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_IPAC_ALE;
val = readreg(cs, cs->hw.asus.cfg_reg + ASUS_IPAC_DATA, IPAC_ID); val = readreg(cs, cs->hw.asus.cfg_reg + ASUS_IPAC_DATA, IPAC_ID);
if ((val == 1) || (val == 2)) { if ((val == 1) || (val == 2)) {
......
...@@ -173,17 +173,24 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -173,17 +173,24 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_ioregs(cs, 0x3f); release_ioregs(cs, 0x3f);
return(0); return(0);
case CARD_INIT:
byteout(cs->hw.avm.cfg_reg, 0x16);
byteout(cs->hw.avm.cfg_reg, 0x1E);
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
avm_a1_init(struct IsdnCardState *cs)
{
byteout(cs->hw.avm.cfg_reg, 0x16);
byteout(cs->hw.avm.cfg_reg, 0x1E);
inithscxisac(cs);
}
static struct card_ops avm_a1_ops = {
.init = avm_a1_init,
};
int __init int __init
setup_avm_a1(struct IsdnCard *card) setup_avm_a1(struct IsdnCard *card)
{ {
...@@ -306,6 +313,7 @@ setup_avm_a1(struct IsdnCard *card) ...@@ -306,6 +313,7 @@ setup_avm_a1(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
cs->irq_func = &avm_a1_interrupt; cs->irq_func = &avm_a1_interrupt;
cs->card_ops = &avm_a1_ops;
ISACVersion(cs, "AVM A1:"); ISACVersion(cs, "AVM A1:");
if (HscxVersion(cs, "AVM A1:")) { if (HscxVersion(cs, "AVM A1:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -206,11 +206,6 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -206,11 +206,6 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
/* free_irq(cs->irq, cs); */ /* free_irq(cs->irq, cs); */
return 0; return 0;
case CARD_INIT:
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_TDISABLE|ASL0_W_TRESET|ASL0_W_IRQENABLE);
inithscxisac(cs);
return 0;
case CARD_TEST: case CARD_TEST:
/* we really don't need it for the PCMCIA Version */ /* we really don't need it for the PCMCIA Version */
return 0; return 0;
...@@ -222,6 +217,18 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -222,6 +217,18 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return 0; return 0;
} }
static void
avm_a1p_init(struct IsdnCardState *cs)
{
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,
ASL0_W_TDISABLE|ASL0_W_TRESET|ASL0_W_IRQENABLE);
inithscxisac(cs);
}
static struct card_ops avm_a1p_ops = {
.init = avm_a1p_init,
};
int __devinit int __devinit
setup_avm_a1_pcmcia(struct IsdnCard *card) setup_avm_a1_pcmcia(struct IsdnCard *card)
{ {
...@@ -260,6 +267,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card) ...@@ -260,6 +267,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
cs->irq_func = &avm_a1p_interrupt; cs->irq_func = &avm_a1p_interrupt;
cs->card_ops = &avm_a1p_ops;
ISACVersion(cs, "AVM A1 PCMCIA:"); ISACVersion(cs, "AVM A1 PCMCIA:");
if (HscxVersion(cs, "AVM A1 PCMCIA:")) { if (HscxVersion(cs, "AVM A1 PCMCIA:")) {
......
...@@ -581,20 +581,27 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -581,20 +581,27 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
outb(0, cs->hw.avm.cfg_reg + 2); outb(0, cs->hw.avm.cfg_reg + 2);
release_region(cs->hw.avm.cfg_reg, 32); release_region(cs->hw.avm.cfg_reg, 32);
return(0); return(0);
case CARD_INIT:
initisac(cs);
inithdlc(cs);
outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER,
cs->hw.avm.cfg_reg + 2);
outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER |
AVM_STATUS0_ENA_IRQ, cs->hw.avm.cfg_reg + 2);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
avm_a1_pci_init(struct IsdnCardState *cs)
{
initisac(cs);
inithdlc(cs);
outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER,
cs->hw.avm.cfg_reg + 2);
outb(AVM_STATUS0_DIS_TIMER | AVM_STATUS0_RES_TIMER |
AVM_STATUS0_ENA_IRQ, cs->hw.avm.cfg_reg + 2);
}
static struct card_ops avm_a1_pci_ops = {
.init = avm_a1_pci_init,
};
static struct pci_dev *dev_avm __initdata = NULL; static struct pci_dev *dev_avm __initdata = NULL;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct pci_bus *bus_avm __initdata = NULL; static struct pci_bus *bus_avm __initdata = NULL;
...@@ -718,6 +725,7 @@ setup_avm_pcipnp(struct IsdnCard *card) ...@@ -718,6 +725,7 @@ setup_avm_pcipnp(struct IsdnCard *card)
cs->bc_l1_ops = &hdlc_l1_ops; cs->bc_l1_ops = &hdlc_l1_ops;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
cs->irq_func = &avm_pcipnp_interrupt; cs->irq_func = &avm_pcipnp_interrupt;
cs->card_ops = &avm_a1_pci_ops;
ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:"); ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:");
return (1); return (1);
} }
...@@ -245,18 +245,25 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -245,18 +245,25 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
reset_bkm(cs); reset_bkm(cs);
release_io_bkm(cs); release_io_bkm(cs);
return (0); return (0);
case CARD_INIT:
initisac(cs);
initjade(cs);
/* Enable ints */
enable_bkm_int(cs, 1);
return (0);
case CARD_TEST: case CARD_TEST:
return (0); return (0);
} }
return (0); return (0);
} }
static void
bkm_a4t_init(struct IsdnCardState *cs)
{
initisac(cs);
initjade(cs);
/* Enable ints */
enable_bkm_int(cs, 1);
}
static struct card_ops bkm_a4t_ops = {
.init = bkm_a4t_init,
};
static struct pci_dev *dev_a4t __initdata = NULL; static struct pci_dev *dev_a4t __initdata = NULL;
int __init int __init
...@@ -337,6 +344,7 @@ setup_bkm_a4t(struct IsdnCard *card) ...@@ -337,6 +344,7 @@ setup_bkm_a4t(struct IsdnCard *card)
cs->cardmsg = &BKM_card_msg; cs->cardmsg = &BKM_card_msg;
cs->irq_func = &bkm_interrupt; cs->irq_func = &bkm_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &bkm_a4t_ops;
ISACVersion(cs, "Telekom A4T:"); ISACVersion(cs, "Telekom A4T:");
/* Jade version */ /* Jade version */
JadeVersion(cs, "Telekom A4T:"); JadeVersion(cs, "Telekom A4T:");
......
...@@ -254,19 +254,26 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -254,19 +254,26 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
enable_bkm_int(cs, 0); enable_bkm_int(cs, 0);
release_io_sct_quadro(cs); release_io_sct_quadro(cs);
return (0); return (0);
case CARD_INIT:
cs->debug |= L1_DEB_IPAC;
set_ipac_active(cs, 1);
inithscxisac(cs);
/* Enable ints */
enable_bkm_int(cs, 1);
return (0);
case CARD_TEST: case CARD_TEST:
return (0); return (0);
} }
return (0); return (0);
} }
static void
bkm_a8_init(struct IsdnCardState *cs)
{
cs->debug |= L1_DEB_IPAC;
set_ipac_active(cs, 1);
inithscxisac(cs);
/* Enable ints */
enable_bkm_int(cs, 1);
}
static struct card_ops bkm_a8_ops = {
.init = bkm_a8_init,
};
int __init int __init
sct_alloc_io(u_int adr, u_int len) sct_alloc_io(u_int adr, u_int len)
{ {
...@@ -430,6 +437,7 @@ setup_sct_quadro(struct IsdnCard *card) ...@@ -430,6 +437,7 @@ setup_sct_quadro(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &BKM_card_msg; cs->cardmsg = &BKM_card_msg;
cs->irq_func = &bkm_interrupt_ipac; cs->irq_func = &bkm_interrupt_ipac;
cs->card_ops = &bkm_a8_ops;
printk(KERN_INFO "HiSax: %s (%s): IPAC Version %d\n", printk(KERN_INFO "HiSax: %s (%s): IPAC Version %d\n",
CardType[card->typ], CardType[card->typ],
......
...@@ -854,8 +854,7 @@ static int __devinit init_card(struct IsdnCardState *cs) ...@@ -854,8 +854,7 @@ static int __devinit init_card(struct IsdnCardState *cs)
{ {
int irq_cnt, cnt = 3; int irq_cnt, cnt = 3;
if (!cs->irq) cs->card_ops->init(cs);
return cs->cardmsg(cs, CARD_INIT, NULL);
irq_cnt = kstat_irqs(cs->irq); irq_cnt = kstat_irqs(cs->irq);
printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ], printk(KERN_INFO "%s: IRQ %d count %d\n", CardType[cs->typ],
...@@ -866,7 +865,7 @@ static int __devinit init_card(struct IsdnCardState *cs) ...@@ -866,7 +865,7 @@ static int __devinit init_card(struct IsdnCardState *cs)
return 1; return 1;
} }
while (cnt) { while (cnt) {
cs->cardmsg(cs, CARD_INIT, NULL); cs->card_ops->init(cs);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
/* Timeout 10ms */ /* Timeout 10ms */
schedule_timeout((10 * HZ) / 1000); schedule_timeout((10 * HZ) / 1000);
......
...@@ -628,8 +628,6 @@ diva_led_handler(struct IsdnCardState *cs) ...@@ -628,8 +628,6 @@ diva_led_handler(struct IsdnCardState *cs)
static int static int
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
u_int *ireg;
switch (mt) { switch (mt) {
case CARD_RESET: case CARD_RESET:
reset_diva(cs); reset_diva(cs);
...@@ -637,19 +635,6 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -637,19 +635,6 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_diva(cs); release_io_diva(cs);
return(0); return(0);
case CARD_INIT:
if (cs->subtyp == DIVA_IPACX_PCI) {
ireg = (unsigned int *)cs->hw.diva.pci_cfg;
*ireg = PITA_INT0_ENABLE;
init_ipacx(cs, 3); // init chip and enable interrupts
return (0);
}
if (cs->subtyp == DIVA_IPAC_PCI) {
ireg = (unsigned int *)cs->hw.diva.pci_cfg;
*ireg = PITA_INT0_ENABLE;
}
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
case (MDL_REMOVE | REQUEST): case (MDL_REMOVE | REQUEST):
...@@ -687,6 +672,28 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -687,6 +672,28 @@ Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0); return(0);
} }
static void
diva_init(struct IsdnCardState *cs)
{
unsigned int *ireg;
if (cs->subtyp == DIVA_IPACX_PCI) {
ireg = (unsigned int *)cs->hw.diva.pci_cfg;
*ireg = PITA_INT0_ENABLE;
init_ipacx(cs, 3); // init chip and enable interrupts
return;
}
if (cs->subtyp == DIVA_IPAC_PCI) {
ireg = (unsigned int *)cs->hw.diva.pci_cfg;
*ireg = PITA_INT0_ENABLE;
}
inithscxisac(cs);
}
static struct card_ops diva_ops = {
.init = diva_init,
};
static struct pci_dev *dev_diva __initdata = NULL; static struct pci_dev *dev_diva __initdata = NULL;
static struct pci_dev *dev_diva_u __initdata = NULL; static struct pci_dev *dev_diva_u __initdata = NULL;
static struct pci_dev *dev_diva201 __initdata = NULL; static struct pci_dev *dev_diva201 __initdata = NULL;
...@@ -923,6 +930,7 @@ setup_diva(struct IsdnCard *card) ...@@ -923,6 +930,7 @@ setup_diva(struct IsdnCard *card)
reset_diva(cs); reset_diva(cs);
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Diva_card_msg; cs->cardmsg = &Diva_card_msg;
cs->card_ops = &diva_ops;
if (cs->subtyp == DIVA_IPAC_ISA) { if (cs->subtyp == DIVA_IPAC_ISA) {
cs->dc_hw_ops = &ipac_dc_ops; cs->dc_hw_ops = &ipac_dc_ops;
cs->irq_func = &diva_irq_ipac_isa; cs->irq_func = &diva_irq_ipac_isa;
......
...@@ -685,17 +685,6 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -685,17 +685,6 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_elsa(cs); release_io_elsa(cs);
return(0); return(0);
case CARD_INIT:
cs->debug |= L1_DEB_IPAC;
if ((cs->subtyp == ELSA_QS1000) ||
(cs->subtyp == ELSA_QS3000))
{
byteout(cs->hw.elsa.timer, 0);
}
if (cs->hw.elsa.trig)
byteout(cs->hw.elsa.trig, 0xff);
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
if ((cs->subtyp == ELSA_PCMCIA) || if ((cs->subtyp == ELSA_PCMCIA) ||
(cs->subtyp == ELSA_PCMCIA_IPAC) || (cs->subtyp == ELSA_PCMCIA_IPAC) ||
...@@ -788,6 +777,23 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -788,6 +777,23 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(ret); return(ret);
} }
static void
elsa_init(struct IsdnCardState *cs)
{
cs->debug |= L1_DEB_IPAC;
if (cs->subtyp == ELSA_QS1000 || cs->subtyp == ELSA_QS3000)
byteout(cs->hw.elsa.timer, 0);
if (cs->hw.elsa.trig)
byteout(cs->hw.elsa.trig, 0xff);
inithscxisac(cs);
}
static struct card_ops elsa_ops = {
.init = elsa_init,
};
static unsigned char static unsigned char
probe_elsa_adr(unsigned int adr, int typ) probe_elsa_adr(unsigned int adr, int typ)
{ {
...@@ -1170,6 +1176,7 @@ setup_elsa(struct IsdnCard *card) ...@@ -1170,6 +1176,7 @@ setup_elsa(struct IsdnCard *card)
} }
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Elsa_card_msg; cs->cardmsg = &Elsa_card_msg;
cs->card_ops = &elsa_ops;
reset_elsa(cs); reset_elsa(cs);
if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI) || (cs->subtyp == ELSA_PCMCIA_IPAC)) { if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI) || (cs->subtyp == ELSA_PCMCIA_IPAC)) {
cs->dc_hw_ops = &ipac_dc_ops; cs->dc_hw_ops = &ipac_dc_ops;
......
...@@ -169,10 +169,6 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -169,10 +169,6 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_netjet(cs); release_io_netjet(cs);
break; break;
case CARD_INIT:
inittiger(cs);
Amd7930_init(cs);
break;
case CARD_TEST: case CARD_TEST:
break; break;
case MDL_ASSIGN: case MDL_ASSIGN:
...@@ -218,6 +214,16 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -218,6 +214,16 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0); return(0);
} }
static void
enpci_init(struct IsdnCardState *cs)
{
inittiger(cs);
Amd7930_init(cs);
}
static struct card_ops enpci_ops = {
.init = enpci_init,
};
static void static void
enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs) enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
...@@ -373,6 +379,7 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -373,6 +379,7 @@ setup_enternow_pci(struct IsdnCard *card)
cs->cardmsg = &enpci_card_msg; cs->cardmsg = &enpci_card_msg;
cs->irq_func = &enpci_interrupt; cs->irq_func = &enpci_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &enpci_ops;
return (1); return (1);
} }
......
...@@ -419,22 +419,30 @@ Gazel_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -419,22 +419,30 @@ Gazel_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_gazel(cs); release_io_gazel(cs);
return (0); return (0);
case CARD_INIT:
inithscxisac(cs);
if ((cs->subtyp==R647)||(cs->subtyp==R685)) {
int i;
for (i=0;i<(2+MAX_WAITING_CALLS);i++) {
cs->bcs[i].hw.hscx.tsaxr0 = 0x1f;
cs->bcs[i].hw.hscx.tsaxr1 = 0x23;
}
}
return (0);
case CARD_TEST: case CARD_TEST:
return (0); return (0);
} }
return (0); return (0);
} }
static void
gazel_init(struct IsdnCardState *cs)
{
int i;
inithscxisac(cs);
if (cs->subtyp == R647 || cs->subtyp == R685) {
for (i = 0; i < 2; i++) {
cs->bcs[i].hw.hscx.tsaxr0 = 0x1f;
cs->bcs[i].hw.hscx.tsaxr1 = 0x23;
}
}
}
static struct card_ops gazel_ops = {
.init = gazel_init,
};
static int static int
reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs) reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs)
{ {
...@@ -680,6 +688,7 @@ setup_gazel(struct IsdnCard *card) ...@@ -680,6 +688,7 @@ setup_gazel(struct IsdnCard *card)
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Gazel_card_msg; cs->cardmsg = &Gazel_card_msg;
cs->card_ops = &gazel_ops;
switch (cs->subtyp) { switch (cs->subtyp) {
case R647: case R647:
......
...@@ -1375,22 +1375,29 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -1375,22 +1375,29 @@ hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_hfcpci(cs); release_io_hfcpci(cs);
return (0); return (0);
case CARD_INIT:
inithfcpci(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80 * HZ) / 1000); /* Timeout 80ms */
/* now switch timer interrupt off */
cs->hw.hfcpci.int_m1 &= ~HFCPCI_INTS_TIMER;
Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1);
/* reinit mode reg */
Write_hfc(cs, HFCPCI_MST_MODE, cs->hw.hfcpci.mst_m);
return (0);
case CARD_TEST: case CARD_TEST:
return (0); return (0);
} }
return (0); return (0);
} }
static void
hfcpci_init(struct IsdnCardState *cs)
{
inithfcpci(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80 * HZ) / 1000); /* Timeout 80ms */
/* now switch timer interrupt off */
cs->hw.hfcpci.int_m1 &= ~HFCPCI_INTS_TIMER;
Write_hfc(cs, HFCPCI_INT_M1, cs->hw.hfcpci.int_m1);
/* reinit mode reg */
Write_hfc(cs, HFCPCI_MST_MODE, cs->hw.hfcpci.mst_m);
}
static struct card_ops hfcpci_ops = {
.init = hfcpci_init,
};
/* this variable is used as card index when more than one cards are present */ /* this variable is used as card index when more than one cards are present */
static struct pci_dev *dev_hfcpci __initdata = NULL; static struct pci_dev *dev_hfcpci __initdata = NULL;
...@@ -1484,6 +1491,7 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1484,6 +1491,7 @@ setup_hfcpci(struct IsdnCard *card)
reset_hfcpci(cs); reset_hfcpci(cs);
cs->cardmsg = &hfcpci_card_msg; cs->cardmsg = &hfcpci_card_msg;
cs->auxcmd = &hfcpci_auxcmd; cs->auxcmd = &hfcpci_auxcmd;
cs->card_ops = &hfcpci_ops;
return (1); return (1);
#else #else
printk(KERN_WARNING "HFC-PCI: NO_PCI_BIOS\n"); printk(KERN_WARNING "HFC-PCI: NO_PCI_BIOS\n");
......
...@@ -1152,22 +1152,29 @@ hfcsx_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -1152,22 +1152,29 @@ hfcsx_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_hfcsx(cs); release_io_hfcsx(cs);
return (0); return (0);
case CARD_INIT:
inithfcsx(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80 * HZ) / 1000); /* Timeout 80ms */
/* now switch timer interrupt off */
cs->hw.hfcsx.int_m1 &= ~HFCSX_INTS_TIMER;
Write_hfc(cs, HFCSX_INT_M1, cs->hw.hfcsx.int_m1);
/* reinit mode reg */
Write_hfc(cs, HFCSX_MST_MODE, cs->hw.hfcsx.mst_m);
return (0);
case CARD_TEST: case CARD_TEST:
return (0); return (0);
} }
return (0); return (0);
} }
static void
hfcsx_init(struct IsdnCardState *cs)
{
inithfcsx(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80 * HZ) / 1000); /* Timeout 80ms */
/* now switch timer interrupt off */
cs->hw.hfcsx.int_m1 &= ~HFCSX_INTS_TIMER;
Write_hfc(cs, HFCSX_INT_M1, cs->hw.hfcsx.int_m1);
/* reinit mode reg */
Write_hfc(cs, HFCSX_MST_MODE, cs->hw.hfcsx.mst_m);
}
static struct card_ops hfcsx_ops = {
.init = hfcsx_init,
};
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id hfc_ids[] __initdata = { static struct isapnp_device_id hfc_ids[] __initdata = {
{ ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
...@@ -1297,5 +1304,6 @@ setup_hfcsx(struct IsdnCard *card) ...@@ -1297,5 +1304,6 @@ setup_hfcsx(struct IsdnCard *card)
reset_hfcsx(cs); reset_hfcsx(cs);
cs->cardmsg = &hfcsx_card_msg; cs->cardmsg = &hfcsx_card_msg;
cs->auxcmd = &hfcsx_auxcmd; cs->auxcmd = &hfcsx_auxcmd;
cs->card_ops = &hfcsx_ops;
return (1); return (1);
} }
...@@ -125,22 +125,29 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -125,22 +125,29 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_hfcs(cs); release_io_hfcs(cs);
return(0); return(0);
case CARD_INIT:
cs->hw.hfcD.timer.expires = jiffies + 75;
add_timer(&cs->hw.hfcD.timer);
init2bds0(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80*HZ)/1000);
cs->hw.hfcD.ctmt |= HFCD_TIM800;
hfcs_write_reg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcD.ctmt);
hfcs_write_reg(cs, HFCD_DATA, HFCD_MST_MODE, cs->hw.hfcD.mst_m);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
hfcs_init(struct IsdnCardState *cs)
{
cs->hw.hfcD.timer.expires = jiffies + 75;
add_timer(&cs->hw.hfcD.timer);
init2bds0(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((80*HZ)/1000);
cs->hw.hfcD.ctmt |= HFCD_TIM800;
hfcs_write_reg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcD.ctmt);
hfcs_write_reg(cs, HFCD_DATA, HFCD_MST_MODE, cs->hw.hfcD.mst_m);
}
static struct card_ops hfcs_ops = {
.init = hfcs_init,
};
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id hfc_ids[] __initdata = { static struct isapnp_device_id hfc_ids[] __initdata = {
{ ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
...@@ -265,5 +272,6 @@ setup_hfcs(struct IsdnCard *card) ...@@ -265,5 +272,6 @@ setup_hfcs(struct IsdnCard *card)
reset_hfcs(cs); reset_hfcs(cs);
cs->cardmsg = &hfcs_card_msg; cs->cardmsg = &hfcs_card_msg;
cs->irq_func = &hfcs_interrupt; cs->irq_func = &hfcs_interrupt;
cs->card_ops = &hfcs_ops;
return (1); return (1);
} }
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#define HW_RSYNC 0x0060 #define HW_RSYNC 0x0060
#define HW_TESTLOOP 0x0070 #define HW_TESTLOOP 0x0070
#define CARD_RESET 0x00F0 #define CARD_RESET 0x00F0
#define CARD_INIT 0x00F2
#define CARD_RELEASE 0x00F3 #define CARD_RELEASE 0x00F3
#define CARD_TEST 0x00F4 #define CARD_TEST 0x00F4
#define CARD_AUX_IND 0x00F5 #define CARD_AUX_IND 0x00F5
...@@ -855,6 +854,12 @@ struct icc_chip { ...@@ -855,6 +854,12 @@ struct icc_chip {
struct IsdnCardState; struct IsdnCardState;
/* Methods provided by driver for a specific card */
struct card_ops {
void (*init) (struct IsdnCardState *);
};
/* Card specific drivers provide methods to access the /* Card specific drivers provide methods to access the
* chips to the chip drivers */ * chips to the chip drivers */
...@@ -896,6 +901,7 @@ struct IsdnCardState { ...@@ -896,6 +901,7 @@ struct IsdnCardState {
unsigned char typ; unsigned char typ;
unsigned char subtyp; unsigned char subtyp;
spinlock_t lock; spinlock_t lock;
struct card_ops *card_ops;
int protocol; int protocol;
unsigned int irq; unsigned int irq;
unsigned long irq_flags; unsigned long irq_flags;
......
...@@ -163,11 +163,6 @@ ISurf_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -163,11 +163,6 @@ ISurf_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_isurf(cs); release_io_isurf(cs);
return(0); return(0);
case CARD_INIT:
writeb(0, cs->hw.isurf.isar+ISAR_IRQBIT);mb();
initisac(cs);
initisar(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
...@@ -190,6 +185,18 @@ isurf_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) { ...@@ -190,6 +185,18 @@ isurf_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) {
return(isar_auxcmd(cs, ic)); return(isar_auxcmd(cs, ic));
} }
static void
isurf_init(struct IsdnCardState *cs)
{
writeb(0, cs->hw.isurf.isar+ISAR_IRQBIT);mb();
initisac(cs);
initisar(cs);
}
static struct card_ops isurf_ops = {
.init = isurf_init,
};
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct pci_bus *pnp_surf __devinitdata = NULL; static struct pci_bus *pnp_surf __devinitdata = NULL;
#endif #endif
...@@ -285,6 +292,7 @@ setup_isurf(struct IsdnCard *card) ...@@ -285,6 +292,7 @@ setup_isurf(struct IsdnCard *card)
cs->cardmsg = &ISurf_card_msg; cs->cardmsg = &ISurf_card_msg;
cs->irq_func = &isurf_interrupt; cs->irq_func = &isurf_interrupt;
cs->auxcmd = &isurf_auxcmd; cs->auxcmd = &isurf_auxcmd;
cs->card_ops = &isurf_ops;
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r; cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r;
cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r; cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r;
......
...@@ -207,15 +207,16 @@ ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -207,15 +207,16 @@ ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_ix1micro(cs); release_io_ix1micro(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops ix1_ops = {
.init = inithscxisac,
};
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id itk_ids[] __initdata = { static struct isapnp_device_id itk_ids[] __initdata = {
{ ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25), { ISAPNP_VENDOR('I', 'T', 'K'), ISAPNP_FUNCTION(0x25),
...@@ -308,6 +309,7 @@ setup_ix1micro(struct IsdnCard *card) ...@@ -308,6 +309,7 @@ setup_ix1micro(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &ix1_card_msg; cs->cardmsg = &ix1_card_msg;
cs->irq_func = &ix1micro_interrupt; cs->irq_func = &ix1micro_interrupt;
cs->card_ops = &ix1_ops;
ISACVersion(cs, "ix1-Micro:"); ISACVersion(cs, "ix1-Micro:");
if (HscxVersion(cs, "ix1-Micro:")) { if (HscxVersion(cs, "ix1-Micro:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -186,15 +186,16 @@ mic_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -186,15 +186,16 @@ mic_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_mic(cs); release_io_mic(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops mic_ops = {
.init = inithscxisac,
};
int __init int __init
setup_mic(struct IsdnCard *card) setup_mic(struct IsdnCard *card)
{ {
...@@ -231,6 +232,7 @@ setup_mic(struct IsdnCard *card) ...@@ -231,6 +232,7 @@ setup_mic(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &mic_card_msg; cs->cardmsg = &mic_card_msg;
cs->irq_func = &mic_interrupt; cs->irq_func = &mic_interrupt;
cs->card_ops = &mic_ops;
ISACVersion(cs, "mic:"); ISACVersion(cs, "mic:");
if (HscxVersion(cs, "mic:")) { if (HscxVersion(cs, "mic:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -234,15 +234,16 @@ niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -234,15 +234,16 @@ niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_niccy(cs); release_io_niccy(cs);
return(0); return(0);
case CARD_INIT:
niccy_reset(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops niccy_ops = {
.init = niccy_reset,
};
static struct pci_dev *niccy_dev __initdata = NULL; static struct pci_dev *niccy_dev __initdata = NULL;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct pci_bus *pnp_c __devinitdata = NULL; static struct pci_bus *pnp_c __devinitdata = NULL;
...@@ -385,6 +386,7 @@ setup_niccy(struct IsdnCard *card) ...@@ -385,6 +386,7 @@ setup_niccy(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &niccy_card_msg; cs->cardmsg = &niccy_card_msg;
cs->irq_func = &niccy_interrupt; cs->irq_func = &niccy_interrupt;
cs->card_ops = &niccy_ops;
ISACVersion(cs, "Niccy:"); ISACVersion(cs, "Niccy:");
if (HscxVersion(cs, "Niccy:")) { if (HscxVersion(cs, "Niccy:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -101,16 +101,23 @@ NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -101,16 +101,23 @@ NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_netjet(cs); release_io_netjet(cs);
return(0); return(0);
case CARD_INIT:
inittiger(cs);
initisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
nj_s_init(struct IsdnCardState *cs)
{
inittiger(cs);
initisac(cs);
}
static struct card_ops nj_s_ops = {
.init = nj_s_init,
};
static struct pci_dev *dev_netjet __initdata = NULL; static struct pci_dev *dev_netjet __initdata = NULL;
int __init int __init
...@@ -230,6 +237,7 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -230,6 +237,7 @@ setup_netjet_s(struct IsdnCard *card)
cs->cardmsg = &NETjet_S_card_msg; cs->cardmsg = &NETjet_S_card_msg;
cs->irq_func = &netjet_s_interrupt; cs->irq_func = &netjet_s_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &nj_s_ops;
ISACVersion(cs, "NETjet-S:"); ISACVersion(cs, "NETjet-S:");
return (1); return (1);
} }
...@@ -103,18 +103,25 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -103,18 +103,25 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_netjet(cs); release_io_netjet(cs);
return(0); return(0);
case CARD_INIT:
inittiger(cs);
initicc(cs);
/* Reenable all IRQ */
NETjet_WriteIC(cs, ICC_MASK, 0);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
nj_u_init(struct IsdnCardState *cs)
{
inittiger(cs);
initicc(cs);
/* Reenable all IRQ */
NETjet_WriteIC(cs, ICC_MASK, 0);
}
static struct card_ops nj_u_ops = {
.init = nj_u_init,
};
static struct pci_dev *dev_netjet __initdata = NULL; static struct pci_dev *dev_netjet __initdata = NULL;
int __init int __init
...@@ -226,6 +233,7 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -226,6 +233,7 @@ setup_netjet_u(struct IsdnCard *card)
cs->cardmsg = &NETjet_U_card_msg; cs->cardmsg = &NETjet_U_card_msg;
cs->irq_func = &netjet_u_interrupt; cs->irq_func = &netjet_u_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &nj_u_ops;
ICCVersion(cs, "NETspider-U:"); ICCVersion(cs, "NETspider-U:");
return (1); return (1);
} }
...@@ -222,15 +222,16 @@ S0Box_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -222,15 +222,16 @@ S0Box_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_s0box(cs); release_io_s0box(cs);
break; break;
case CARD_INIT:
inithscxisac(cs);
break;
case CARD_TEST: case CARD_TEST:
break; break;
} }
return(0); return(0);
} }
static struct card_ops s0box_ops = {
.init = inithscxisac,
};
int __init int __init
setup_s0box(struct IsdnCard *card) setup_s0box(struct IsdnCard *card)
{ {
...@@ -269,6 +270,7 @@ setup_s0box(struct IsdnCard *card) ...@@ -269,6 +270,7 @@ setup_s0box(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &S0Box_card_msg; cs->cardmsg = &S0Box_card_msg;
cs->irq_func = &s0box_interrupt; cs->irq_func = &s0box_interrupt;
cs->card_ops = &s0box_ops;
ISACVersion(cs, "S0Box:"); ISACVersion(cs, "S0Box:");
if (HscxVersion(cs, "S0Box:")) { if (HscxVersion(cs, "S0Box:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -238,15 +238,15 @@ saphir_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -238,15 +238,15 @@ saphir_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_saphir(cs); release_io_saphir(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops saphir_ops = {
.init = inithscxisac,
};
int __init int __init
setup_saphir(struct IsdnCard *card) setup_saphir(struct IsdnCard *card)
...@@ -292,6 +292,7 @@ setup_saphir(struct IsdnCard *card) ...@@ -292,6 +292,7 @@ setup_saphir(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &saphir_card_msg; cs->cardmsg = &saphir_card_msg;
cs->irq_func = &saphir_interrupt; cs->irq_func = &saphir_interrupt;
cs->card_ops = &saphir_ops;
ISACVersion(cs, "saphir:"); ISACVersion(cs, "saphir:");
if (HscxVersion(cs, "saphir:")) { if (HscxVersion(cs, "saphir:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -486,15 +486,6 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -486,15 +486,6 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
} }
release_io_sedlbauer(cs); release_io_sedlbauer(cs);
return(0); return(0);
case CARD_INIT:
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
isar_write(cs, 0, ISAR_IRQBIT, 0);
initisac(cs);
initisar(cs);
} else {
inithscxisac(cs);
}
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
case MDL_INFO_CONN: case MDL_INFO_CONN:
...@@ -519,6 +510,22 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -519,6 +510,22 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0); return(0);
} }
static void
sedlbauer_init(struct IsdnCardState *cs)
{
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
isar_write(cs, 0, ISAR_IRQBIT, 0);
initisac(cs);
initisar(cs);
} else {
inithscxisac(cs);
}
}
static struct card_ops sedlbauer_ops = {
.init = sedlbauer_init,
};
static struct pci_dev *dev_sedl __devinitdata = NULL; static struct pci_dev *dev_sedl __devinitdata = NULL;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
...@@ -706,6 +713,7 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -706,6 +713,7 @@ setup_sedlbauer(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Sedl_card_msg; cs->cardmsg = &Sedl_card_msg;
cs->card_ops = &sedlbauer_ops;
/* /*
* testing ISA and PCMCIA Cards for IPAC, default is ISAC * testing ISA and PCMCIA Cards for IPAC, default is ISAC
......
...@@ -178,17 +178,24 @@ Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -178,17 +178,24 @@ Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_sportster(cs); release_io_sportster(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
cs->hw.spt.res_irq |= SPORTSTER_INTE; /* IRQ On */
byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
sportster_init(struct IsdnCardState *cs)
{
inithscxisac(cs);
cs->hw.spt.res_irq |= SPORTSTER_INTE; /* IRQ On */
byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq);
}
static struct card_ops sportster_ops = {
.init = sportster_init,
};
static int __init static int __init
get_io_range(struct IsdnCardState *cs) get_io_range(struct IsdnCardState *cs)
{ {
...@@ -262,6 +269,7 @@ setup_sportster(struct IsdnCard *card) ...@@ -262,6 +269,7 @@ setup_sportster(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Sportster_card_msg; cs->cardmsg = &Sportster_card_msg;
cs->irq_func = &sportster_interrupt; cs->irq_func = &sportster_interrupt;
cs->card_ops = &sportster_ops;
ISACVersion(cs, "Sportster:"); ISACVersion(cs, "Sportster:");
if (HscxVersion(cs, "Sportster:")) { if (HscxVersion(cs, "Sportster:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -250,18 +250,25 @@ TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -250,18 +250,25 @@ TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_TeleInt(cs); release_io_TeleInt(cs);
return(0); return(0);
case CARD_INIT:
inithfc(cs);
initisac(cs);
cs->hw.hfc.timer.expires = jiffies + 1;
add_timer(&cs->hw.hfc.timer);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static void
teleint_init(struct IsdnCardState *cs)
{
inithfc(cs);
initisac(cs);
cs->hw.hfc.timer.expires = jiffies + 1;
add_timer(&cs->hw.hfc.timer);
}
static struct card_ops teleint_ops = {
.init = teleint_init,
};
int __init int __init
setup_TeleInt(struct IsdnCard *card) setup_TeleInt(struct IsdnCard *card)
{ {
...@@ -335,6 +342,7 @@ setup_TeleInt(struct IsdnCard *card) ...@@ -335,6 +342,7 @@ setup_TeleInt(struct IsdnCard *card)
cs->bc_hw_ops = &hfc_ops; cs->bc_hw_ops = &hfc_ops;
cs->cardmsg = &TeleInt_card_msg; cs->cardmsg = &TeleInt_card_msg;
cs->irq_func = &TeleInt_interrupt; cs->irq_func = &TeleInt_interrupt;
cs->card_ops = &teleint_ops;
ISACVersion(cs, "TeleInt:"); ISACVersion(cs, "TeleInt:");
return (1); return (1);
} }
...@@ -215,15 +215,16 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -215,15 +215,16 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_teles0(cs); release_io_teles0(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops teles0_ops = {
.init = inithscxisac,
};
int __init int __init
setup_teles0(struct IsdnCard *card) setup_teles0(struct IsdnCard *card)
{ {
...@@ -313,6 +314,7 @@ setup_teles0(struct IsdnCard *card) ...@@ -313,6 +314,7 @@ setup_teles0(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Teles_card_msg; cs->cardmsg = &Teles_card_msg;
cs->irq_func = &teles0_interrupt; cs->irq_func = &teles0_interrupt;
cs->card_ops = &teles0_ops;
ISACVersion(cs, "Teles0:"); ISACVersion(cs, "Teles0:");
if (HscxVersion(cs, "Teles0:")) { if (HscxVersion(cs, "Teles0:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -248,15 +248,16 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -248,15 +248,16 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_teles3(cs); release_io_teles3(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops teles3_ops = {
.init = inithscxisac,
};
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id teles_ids[] __initdata = { static struct isapnp_device_id teles_ids[] __initdata = {
{ ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110), { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2110),
...@@ -483,6 +484,7 @@ setup_teles3(struct IsdnCard *card) ...@@ -483,6 +484,7 @@ setup_teles3(struct IsdnCard *card)
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Teles_card_msg; cs->cardmsg = &Teles_card_msg;
cs->irq_func = &teles3_interrupt; cs->irq_func = &teles3_interrupt;
cs->card_ops = &teles3_ops;
ISACVersion(cs, "Teles3:"); ISACVersion(cs, "Teles3:");
if (HscxVersion(cs, "Teles3:")) { if (HscxVersion(cs, "Teles3:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -240,15 +240,16 @@ TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -240,15 +240,16 @@ TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg)
case CARD_RELEASE: case CARD_RELEASE:
release_io_telespci(cs); release_io_telespci(cs);
return(0); return(0);
case CARD_INIT:
inithscxisac(cs);
return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
} }
return(0); return(0);
} }
static struct card_ops telespci_ops = {
.init = inithscxisac,
};
static struct pci_dev *dev_tel __initdata = NULL; static struct pci_dev *dev_tel __initdata = NULL;
int __init int __init
...@@ -310,6 +311,7 @@ setup_telespci(struct IsdnCard *card) ...@@ -310,6 +311,7 @@ setup_telespci(struct IsdnCard *card)
cs->cardmsg = &TelesPCI_card_msg; cs->cardmsg = &TelesPCI_card_msg;
cs->irq_func = &telespci_interrupt; cs->irq_func = &telespci_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &telespci_ops;
ISACVersion(cs, "TelesPCI:"); ISACVersion(cs, "TelesPCI:");
if (HscxVersion(cs, "TelesPCI:")) { if (HscxVersion(cs, "TelesPCI:")) {
printk(KERN_WARNING printk(KERN_WARNING
......
...@@ -615,33 +615,31 @@ void resetW6692(struct IsdnCardState *cs) ...@@ -615,33 +615,31 @@ void resetW6692(struct IsdnCardState *cs)
} }
} }
void __init initW6692(struct IsdnCardState *cs, int part) void __init
{ w6692_init(struct IsdnCardState *cs)
if (part & 1) { {
INIT_WORK(&cs->work, W6692_bh, cs); INIT_WORK(&cs->work, W6692_bh, cs);
cs->setstack_d = setstack_W6692; cs->setstack_d = setstack_W6692;
cs->DC_Close = DC_Close_W6692; cs->DC_Close = DC_Close_W6692;
cs->dbusytimer.function = (void *) dbusy_timer_handler; cs->dbusytimer.function = (void *) dbusy_timer_handler;
cs->dbusytimer.data = (long) cs; cs->dbusytimer.data = (long) cs;
init_timer(&cs->dbusytimer); init_timer(&cs->dbusytimer);
resetW6692(cs); resetW6692(cs);
ph_command(cs, W_L1CMD_RST); ph_command(cs, W_L1CMD_RST);
cs->dc.w6692.ph_state = W_L1CMD_RST; cs->dc.w6692.ph_state = W_L1CMD_RST;
W6692_new_ph(cs); W6692_new_ph(cs);
ph_command(cs, W_L1CMD_ECK); ph_command(cs, W_L1CMD_ECK);
W6692Bmode(cs->bcs, 0, 0); W6692Bmode(cs->bcs, 0, 0);
W6692Bmode(cs->bcs + 1, 0, 0); W6692Bmode(cs->bcs + 1, 0, 0);
}
if (part & 2) { /* Reenable all IRQ */
/* Reenable all IRQ */ w6692_write_reg(cs, W_IMASK, 0x18);
w6692_write_reg(cs, W_IMASK, 0x18); w6692_write_reg(cs, W_D_EXIM, 0x00);
w6692_write_reg(cs, W_D_EXIM, 0x00); w6692_bc_write_reg(cs, 0, W_B_EXIM, 0x00);
w6692_bc_write_reg(cs, 0, W_B_EXIM, 0x00); w6692_bc_write_reg(cs, 1, W_B_EXIM, 0x00);
w6692_bc_write_reg(cs, 1, W_B_EXIM, 0x00); /* Reset D-chan receiver and transmitter */
/* Reset D-chan receiver and transmitter */ w6692_write_reg(cs, W_D_CMDR, W_D_CMDR_RRST | W_D_CMDR_XRST);
w6692_write_reg(cs, W_D_CMDR, W_D_CMDR_RRST | W_D_CMDR_XRST);
}
} }
static int static int
...@@ -658,15 +656,16 @@ w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -658,15 +656,16 @@ w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg)
w6692_write_reg(cs, W_XDATA, 0x04); w6692_write_reg(cs, W_XDATA, 0x04);
} }
return (0); return (0);
case CARD_INIT:
initW6692(cs, 3);
return (0);
case CARD_TEST: case CARD_TEST:
return (0); return (0);
} }
return (0); return (0);
} }
static struct card_ops w6692_ops = {
.init = w6692_init,
};
static struct bc_l1_ops w6692_bc_l1_ops = { static struct bc_l1_ops w6692_bc_l1_ops = {
.fill_fifo = W6692B_fill_fifo, .fill_fifo = W6692B_fill_fifo,
.open = setstack_w6692, .open = setstack_w6692,
...@@ -768,6 +767,7 @@ setup_w6692(struct IsdnCard *card) ...@@ -768,6 +767,7 @@ setup_w6692(struct IsdnCard *card)
cs->cardmsg = &w6692_card_msg; cs->cardmsg = &w6692_card_msg;
cs->irq_func = &W6692_interrupt; cs->irq_func = &W6692_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &w6692_ops;
W6692Version(cs, "W6692:"); W6692Version(cs, "W6692:");
printk(KERN_INFO "W6692 ISTA=0x%X\n", w6692_read_reg(cs, W_ISTA)); printk(KERN_INFO "W6692 ISTA=0x%X\n", w6692_read_reg(cs, W_ISTA));
printk(KERN_INFO "W6692 IMASK=0x%X\n", w6692_read_reg(cs, W_IMASK)); printk(KERN_INFO "W6692 IMASK=0x%X\n", w6692_read_reg(cs, W_IMASK));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment