Commit 6cc9cb58 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Introduce methods for reset/test/release/

This mostly finishes splitting up the multiplexing ->cardmsg.
parent 02f7568c
...@@ -257,52 +257,45 @@ asuscom_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -257,52 +257,45 @@ asuscom_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
writereg(cs, cs->hw.asus.isac, IPAC_MASK, 0xC0); writereg(cs, cs->hw.asus.isac, IPAC_MASK, 0xC0);
} }
void static void
release_io_asuscom(struct IsdnCardState *cs) asuscom_release(struct IsdnCardState *cs)
{ {
int bytecnt = 8;
if (cs->hw.asus.cfg_reg) if (cs->hw.asus.cfg_reg)
release_region(cs->hw.asus.cfg_reg, bytecnt); release_region(cs->hw.asus.cfg_reg, 8);
} }
static void static int
reset_asuscom(struct IsdnCardState *cs) asuscom_reset(struct IsdnCardState *cs)
{ {
if (cs->subtyp == ASUS_IPAC) byteout(cs->hw.asus.adr, ASUS_RESET); /* Reset On */
writereg(cs, cs->hw.asus.isac, IPAC_POTA2, 0x20);
else
byteout(cs->hw.asus.adr, ASUS_RESET); /* Reset On */
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); schedule_timeout((10*HZ)/1000);
if (cs->subtyp == ASUS_IPAC) byteout(cs->hw.asus.adr, 0); /* Reset Off */
writereg(cs, cs->hw.asus.isac, IPAC_POTA2, 0x0);
else
byteout(cs->hw.asus.adr, 0); /* Reset Off */
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); schedule_timeout((10*HZ)/1000);
if (cs->subtyp == ASUS_IPAC) { return 0;
writereg(cs, cs->hw.asus.isac, IPAC_CONF, 0x0); }
writereg(cs, cs->hw.asus.isac, IPAC_ACFG, 0xff);
writereg(cs, cs->hw.asus.isac, IPAC_AOE, 0x0); static int
writereg(cs, cs->hw.asus.isac, IPAC_MASK, 0xc0); asuscom_ipac_reset(struct IsdnCardState *cs)
writereg(cs, cs->hw.asus.isac, IPAC_PCFG, 0x12); {
} writereg(cs, cs->hw.asus.isac, IPAC_POTA2, 0x20);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writereg(cs, cs->hw.asus.isac, IPAC_POTA2, 0x0);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writereg(cs, cs->hw.asus.isac, IPAC_CONF, 0x0);
writereg(cs, cs->hw.asus.isac, IPAC_ACFG, 0xff);
writereg(cs, cs->hw.asus.isac, IPAC_AOE, 0x0);
writereg(cs, cs->hw.asus.isac, IPAC_MASK, 0xc0);
writereg(cs, cs->hw.asus.isac, IPAC_PCFG, 0x12);
return 0;
} }
static int static int
Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg) Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_asuscom(cs);
return(0);
case CARD_RELEASE:
release_io_asuscom(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -315,11 +308,15 @@ asuscom_init(struct IsdnCardState *cs) ...@@ -315,11 +308,15 @@ asuscom_init(struct IsdnCardState *cs)
static struct card_ops asuscom_ops = { static struct card_ops asuscom_ops = {
.init = asuscom_init, .init = asuscom_init,
.reset = asuscom_reset,
.release = asuscom_release,
.irq_func = asuscom_interrupt, .irq_func = asuscom_interrupt,
}; };
static struct card_ops asuscom_ipac_ops = { static struct card_ops asuscom_ipac_ops = {
.init = asuscom_init, .init = asuscom_init,
.reset = asuscom_ipac_reset,
.release = asuscom_release,
.irq_func = asuscom_ipac_interrupt, .irq_func = asuscom_ipac_interrupt,
}; };
...@@ -434,11 +431,11 @@ setup_asuscom(struct IsdnCard *card) ...@@ -434,11 +431,11 @@ setup_asuscom(struct IsdnCard *card)
if (HscxVersion(cs, "ISDNLink:")) { if (HscxVersion(cs, "ISDNLink:")) {
printk(KERN_WARNING printk(KERN_WARNING
"ISDNLink: wrong HSCX versions check IO address\n"); "ISDNLink: wrong HSCX versions check IO address\n");
release_io_asuscom(cs); asuscom_release(cs);
return (0); return (0);
} }
} }
printk(KERN_INFO "ISDNLink: resetting card\n"); printk(KERN_INFO "ISDNLink: resetting card\n");
reset_asuscom(cs); cs->card_ops->reset(cs);
return (1); return (1);
} }
...@@ -167,15 +167,6 @@ release_ioregs(struct IsdnCardState *cs, int mask) ...@@ -167,15 +167,6 @@ release_ioregs(struct IsdnCardState *cs, int mask)
static int static int
AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
return(0);
case CARD_RELEASE:
release_ioregs(cs, 0x3f);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -187,8 +178,15 @@ avm_a1_init(struct IsdnCardState *cs) ...@@ -187,8 +178,15 @@ avm_a1_init(struct IsdnCardState *cs)
inithscxisac(cs); inithscxisac(cs);
} }
static void
avm_a1_release(struct IsdnCardState *cs)
{
release_ioregs(cs, 0x3f);
}
static struct card_ops avm_a1_ops = { static struct card_ops avm_a1_ops = {
.init = avm_a1_init, .init = avm_a1_init,
.release = avm_a1_release,
.irq_func = avm_a1_interrupt, .irq_func = avm_a1_interrupt,
}; };
......
...@@ -192,28 +192,6 @@ avm_a1p_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -192,28 +192,6 @@ avm_a1p_interrupt(int intno, void *dev_id, struct pt_regs *regs)
static int static int
AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg) AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_RESET);
HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
return 0;
case CARD_RELEASE:
/* free_irq is done in HiSax_closecard(). */
/* free_irq(cs->irq, cs); */
return 0;
case CARD_TEST:
/* we really don't need it for the PCMCIA Version */
return 0;
default:
/* all card drivers ignore others, so we do the same */
return 0;
}
return 0; return 0;
} }
...@@ -225,8 +203,21 @@ avm_a1p_init(struct IsdnCardState *cs) ...@@ -225,8 +203,21 @@ avm_a1p_init(struct IsdnCardState *cs)
inithscxisac(cs); inithscxisac(cs);
} }
static int
avm_a1p_reset(struct IsdnCardState *cs)
{
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,ASL0_W_RESET);
HZDELAY(HZ / 5 + 1);
byteout(cs->hw.avm.cfg_reg+ASL0_OFFSET,0x00);
return 0;
}
static struct card_ops avm_a1p_ops = { static struct card_ops avm_a1p_ops = {
.init = avm_a1p_init, .init = avm_a1p_init,
.reset = avm_a1p_reset,
.irq_func = avm_a1p_interrupt, .irq_func = avm_a1p_interrupt,
}; };
......
...@@ -556,8 +556,14 @@ avm_pcipnp_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -556,8 +556,14 @@ avm_pcipnp_interrupt(int intno, void *dev_id, struct pt_regs *regs)
WriteISAC(cs, ISAC_MASK, 0x0); WriteISAC(cs, ISAC_MASK, 0x0);
} }
static void static int
reset_avmpcipnp(struct IsdnCardState *cs) AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
return(0);
}
static int
avm_pcipnp_reset(struct IsdnCardState *cs)
{ {
printk(KERN_INFO "AVM PCI/PnP: reset\n"); printk(KERN_INFO "AVM PCI/PnP: reset\n");
outb(AVM_STATUS0_RESET | AVM_STATUS0_DIS_TIMER, cs->hw.avm.cfg_reg + 2); outb(AVM_STATUS0_RESET | AVM_STATUS0_DIS_TIMER, cs->hw.avm.cfg_reg + 2);
...@@ -568,27 +574,11 @@ reset_avmpcipnp(struct IsdnCardState *cs) ...@@ -568,27 +574,11 @@ reset_avmpcipnp(struct IsdnCardState *cs)
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
printk(KERN_INFO "AVM PCI/PnP: S1 %x\n", inb(cs->hw.avm.cfg_reg + 3)); printk(KERN_INFO "AVM PCI/PnP: S1 %x\n", inb(cs->hw.avm.cfg_reg + 3));
} return 0;
static int
AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
switch (mt) {
case CARD_RESET:
reset_avmpcipnp(cs);
return(0);
case CARD_RELEASE:
outb(0, cs->hw.avm.cfg_reg + 2);
release_region(cs->hw.avm.cfg_reg, 32);
return(0);
case CARD_TEST:
return(0);
}
return(0);
} }
static void static void
avm_pci_init(struct IsdnCardState *cs) avm_pcipnp_init(struct IsdnCardState *cs)
{ {
initisac(cs); initisac(cs);
inithdlc(cs); inithdlc(cs);
...@@ -598,8 +588,17 @@ avm_pci_init(struct IsdnCardState *cs) ...@@ -598,8 +588,17 @@ avm_pci_init(struct IsdnCardState *cs)
AVM_STATUS0_ENA_IRQ, cs->hw.avm.cfg_reg + 2); AVM_STATUS0_ENA_IRQ, cs->hw.avm.cfg_reg + 2);
} }
static void
avm_pcipnp_release(struct IsdnCardState *cs)
{
outb(0, cs->hw.avm.cfg_reg + 2);
release_region(cs->hw.avm.cfg_reg, 32);
}
static struct card_ops avm_pci_ops = { static struct card_ops avm_pci_ops = {
.init = avm_pci_init, .init = avm_pcipnp_init,
.reset = avm_pcipnp_reset,
.release = avm_pcipnp_release,
.irq_func = avm_pcipnp_interrupt, .irq_func = avm_pcipnp_interrupt,
}; };
...@@ -714,7 +713,7 @@ setup_avm_pcipnp(struct IsdnCard *card) ...@@ -714,7 +713,7 @@ setup_avm_pcipnp(struct IsdnCard *card)
val = inb(cs->hw.avm.cfg_reg); val = inb(cs->hw.avm.cfg_reg);
ver = inb(cs->hw.avm.cfg_reg + 1); ver = inb(cs->hw.avm.cfg_reg + 1);
printk(KERN_INFO "AVM PnP: Class %X Rev %d\n", val, ver); printk(KERN_INFO "AVM PnP: Class %X Rev %d\n", val, ver);
reset_avmpcipnp(cs); avm_pcipnp_reset(cs);
break; break;
} }
printk(KERN_INFO "HiSax: %s config irq:%d base:0x%X\n", printk(KERN_INFO "HiSax: %s config irq:%d base:0x%X\n",
......
...@@ -233,21 +233,6 @@ reset_bkm(struct IsdnCardState *cs) ...@@ -233,21 +233,6 @@ reset_bkm(struct IsdnCardState *cs)
static int static int
BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
/* Disable ints */
enable_bkm_int(cs, 0);
reset_bkm(cs);
return (0);
case CARD_RELEASE:
/* Sanity */
enable_bkm_int(cs, 0);
reset_bkm(cs);
release_io_bkm(cs);
return (0);
case CARD_TEST:
return (0);
}
return (0); return (0);
} }
...@@ -260,8 +245,27 @@ bkm_a4t_init(struct IsdnCardState *cs) ...@@ -260,8 +245,27 @@ bkm_a4t_init(struct IsdnCardState *cs)
enable_bkm_int(cs, 1); enable_bkm_int(cs, 1);
} }
static int
bkm_a4t_reset(struct IsdnCardState *cs)
{
/* Disable ints */
enable_bkm_int(cs, 0);
reset_bkm(cs);
return 0;
}
static void
bkm_a4t_release(struct IsdnCardState *cs)
{
enable_bkm_int(cs, 0);
reset_bkm(cs);
release_io_bkm(cs);
}
static struct card_ops bkm_a4t_ops = { static struct card_ops bkm_a4t_ops = {
.init = bkm_a4t_init, .init = bkm_a4t_init,
.reset = bkm_a4t_reset,
.release = bkm_a4t_release,
.irq_func = bkm_interrupt, .irq_func = bkm_interrupt,
}; };
......
...@@ -241,22 +241,6 @@ reset_bkm(struct IsdnCardState *cs) ...@@ -241,22 +241,6 @@ reset_bkm(struct IsdnCardState *cs)
static int static int
BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg) BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
/* Disable ints */
set_ipac_active(cs, 0);
enable_bkm_int(cs, 0);
reset_bkm(cs);
return (0);
case CARD_RELEASE:
/* Sanity */
set_ipac_active(cs, 0);
enable_bkm_int(cs, 0);
release_io_sct_quadro(cs);
return (0);
case CARD_TEST:
return (0);
}
return (0); return (0);
} }
...@@ -270,8 +254,28 @@ bkm_a8_init(struct IsdnCardState *cs) ...@@ -270,8 +254,28 @@ bkm_a8_init(struct IsdnCardState *cs)
enable_bkm_int(cs, 1); enable_bkm_int(cs, 1);
} }
static int
bkm_a8_reset(struct IsdnCardState *cs)
{
/* Disable ints */
set_ipac_active(cs, 0);
enable_bkm_int(cs, 0);
reset_bkm(cs);
return 0;
}
static void
bkm_a8_release(struct IsdnCardState *cs)
{
set_ipac_active(cs, 0);
enable_bkm_int(cs, 0);
release_io_sct_quadro(cs);
}
static struct card_ops bkm_a8_ops = { static struct card_ops bkm_a8_ops = {
.init = bkm_a8_init, .init = bkm_a8_init,
.reset = bkm_a8_reset,
.release = bkm_a8_release,
.irq_func = bkm_a8_interrupt, .irq_func = bkm_a8_interrupt,
}; };
......
...@@ -1458,12 +1458,8 @@ lli_got_fac_req(struct Channel *chanp, capi_msg *cm) { ...@@ -1458,12 +1458,8 @@ lli_got_fac_req(struct Channel *chanp, capi_msg *cm) {
void void
lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *cm) { lli_got_manufacturer(struct Channel *chanp, struct IsdnCardState *cs, capi_msg *cm) {
if ((cs->typ == ISDN_CTYPE_ELSA) || (cs->typ == ISDN_CTYPE_ELSA_PNP) || if (cs->card_ops->aux_ind)
(cs->typ == ISDN_CTYPE_ELSA_PCI)) { cs->card_ops->aux_ind(cs, cm->para);
if (cs->hw.elsa.MFlag) {
cs->cardmsg(cs, CARD_AUX_IND, cm->para);
}
}
} }
......
...@@ -843,8 +843,8 @@ static void closecard(int cardnr) ...@@ -843,8 +843,8 @@ static void closecard(int cardnr)
if (csta->DC_Close != NULL) { if (csta->DC_Close != NULL) {
csta->DC_Close(csta); csta->DC_Close(csta);
} }
if (csta->cardmsg) if (csta->card_ops->release)
csta->cardmsg(csta, CARD_RELEASE, NULL); csta->card_ops->release(csta);
if (csta->dbusytimer.function != NULL) // FIXME? if (csta->dbusytimer.function != NULL) // FIXME?
del_timer(&csta->dbusytimer); del_timer(&csta->dbusytimer);
ll_unload(csta); ll_unload(csta);
...@@ -879,11 +879,13 @@ static int __devinit init_card(struct IsdnCardState *cs) ...@@ -879,11 +879,13 @@ static int __devinit init_card(struct IsdnCardState *cs)
free_irq(cs->irq, cs); free_irq(cs->irq, cs);
return 2; return 2;
} else { } else {
cs->cardmsg(cs, CARD_RESET, NULL); if (cs->card_ops->reset)
cs->card_ops->reset(cs);
cnt--; cnt--;
} }
} else { } else {
cs->cardmsg(cs, CARD_TEST, NULL); if (cs->card_ops->test)
cs->card_ops->test(cs);
return 0; return 0;
} }
} }
......
...@@ -506,83 +506,103 @@ diva_ipacx_pci_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -506,83 +506,103 @@ diva_ipacx_pci_irq(int intno, void *dev_id, struct pt_regs *regs)
*cfg = PITA_INT0_STATUS; // Reset PLX interrupt *cfg = PITA_INT0_STATUS; // Reset PLX interrupt
} }
void static void
release_io_diva(struct IsdnCardState *cs) diva_release(struct IsdnCardState *cs)
{ {
int bytecnt; int bytecnt;
if ((cs->subtyp == DIVA_IPAC_PCI) || del_timer(&cs->hw.diva.tl);
(cs->subtyp == DIVA_IPACX_PCI) ) { if (cs->hw.diva.cfg_reg)
u_int *cfg = (unsigned int *)cs->hw.diva.pci_cfg; byteout(cs->hw.diva.ctrl, 0); /* LED off, Reset */
*cfg = 0; /* disable INT0/1 */ if (cs->subtyp == DIVA_ISA)
*cfg = 2; /* reset pending INT0 */
iounmap((void *)cs->hw.diva.cfg_reg);
iounmap((void *)cs->hw.diva.pci_cfg);
return;
} else if (cs->subtyp != DIVA_IPAC_ISA) {
del_timer(&cs->hw.diva.tl);
if (cs->hw.diva.cfg_reg)
byteout(cs->hw.diva.ctrl, 0); /* LED off, Reset */
}
if ((cs->subtyp == DIVA_ISA) || (cs->subtyp == DIVA_IPAC_ISA))
bytecnt = 8; bytecnt = 8;
else else
bytecnt = 32; bytecnt = 32;
if (cs->hw.diva.cfg_reg) { if (cs->hw.diva.cfg_reg)
release_region(cs->hw.diva.cfg_reg, bytecnt); release_region(cs->hw.diva.cfg_reg, bytecnt);
}
} }
static void static void
reset_diva(struct IsdnCardState *cs) diva_ipac_isa_release(struct IsdnCardState *cs)
{ {
if (cs->subtyp == DIVA_IPAC_ISA) { if (cs->hw.diva.cfg_reg)
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_POTA2, 0x20); release_region(cs->hw.diva.cfg_reg, 8);
set_current_state(TASK_UNINTERRUPTIBLE); }
schedule_timeout((10*HZ)/1000);
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_POTA2, 0x00); static void
set_current_state(TASK_UNINTERRUPTIBLE); diva_ipac_pci_release(struct IsdnCardState *cs)
schedule_timeout((10*HZ)/1000); {
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xc0); writel(0, cs->hw.diva.pci_cfg); /* disable INT0/1 */
} else if (cs->subtyp == DIVA_IPAC_PCI) { writel(2, cs->hw.diva.pci_cfg); /* reset pending INT0 */
unsigned int *ireg = (unsigned int *)(cs->hw.diva.pci_cfg + iounmap((void *)cs->hw.diva.cfg_reg);
PITA_MISC_REG); iounmap((void *)cs->hw.diva.pci_cfg);
*ireg = PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE; }
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); static int
*ireg = PITA_PARA_MPX_MODE; diva_ipac_isa_reset(struct IsdnCardState *cs)
set_current_state(TASK_UNINTERRUPTIBLE); {
schedule_timeout((10*HZ)/1000); writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_POTA2, 0x20);
memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xc0); set_current_state(TASK_UNINTERRUPTIBLE);
} else if (cs->subtyp == DIVA_IPACX_PCI) { schedule_timeout((10*HZ)/1000);
unsigned int *ireg = (unsigned int *)(cs->hw.diva.pci_cfg + writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_POTA2, 0x00);
PITA_MISC_REG); set_current_state(TASK_UNINTERRUPTIBLE);
*ireg = PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE; schedule_timeout((10*HZ)/1000);
set_current_state(TASK_UNINTERRUPTIBLE); writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xc0);
schedule_timeout((10*HZ)/1000); return 0;
*ireg = PITA_PARA_MPX_MODE | PITA_SER_SOFTRESET; }
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); static int
ipacx_dc_write(cs, IPACX_MASK, 0xff); // Interrupts off diva_ipac_pci_reset(struct IsdnCardState *cs)
} else { /* DIVA 2.0 */ {
cs->hw.diva.ctrl_reg = 0; /* Reset On */ unsigned long misc_reg = cs->hw.diva.pci_cfg + PITA_MISC_REG;
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE); writel(PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE, misc_reg);
schedule_timeout((10*HZ)/1000); set_current_state(TASK_UNINTERRUPTIBLE);
cs->hw.diva.ctrl_reg |= DIVA_RESET; /* Reset Off */ schedule_timeout((10*HZ)/1000);
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg); writel(PITA_PARA_MPX_MODE, misc_reg);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); schedule_timeout((10*HZ)/1000);
if (cs->subtyp == DIVA_ISA) memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xc0);
cs->hw.diva.ctrl_reg |= DIVA_ISA_LED_A; return 0;
else { }
/* Workaround PCI9060 */
byteout(cs->hw.diva.pci_cfg + 0x69, 9); static int
cs->hw.diva.ctrl_reg |= DIVA_PCI_LED_A; diva_ipacx_pci_reset(struct IsdnCardState *cs)
} {
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg); unsigned long misc_reg = cs->hw.diva.pci_cfg + PITA_MISC_REG;
writel(PITA_PARA_SOFTRESET | PITA_PARA_MPX_MODE, misc_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writel(PITA_PARA_MPX_MODE | PITA_SER_SOFTRESET, misc_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
ipacx_dc_write(cs, IPACX_MASK, 0xff); // Interrupts off
return 0;
}
static int
diva_reset(struct IsdnCardState *cs)
{
/* DIVA 2.0 */
cs->hw.diva.ctrl_reg = 0; /* Reset On */
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
cs->hw.diva.ctrl_reg |= DIVA_RESET; /* Reset Off */
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
if (cs->subtyp == DIVA_ISA) {
cs->hw.diva.ctrl_reg |= DIVA_ISA_LED_A;
} else {
/* Workaround PCI9060 */
byteout(cs->hw.diva.pci_cfg + 0x69, 9);
cs->hw.diva.ctrl_reg |= DIVA_PCI_LED_A;
} }
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
return 0;
} }
#define DIVA_ASSIGN 1 #define DIVA_ASSIGN 1
...@@ -629,14 +649,6 @@ static int ...@@ -629,14 +649,6 @@ static int
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg) Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) { switch (mt) {
case CARD_RESET:
reset_diva(cs);
return(0);
case CARD_RELEASE:
release_io_diva(cs);
return(0);
case CARD_TEST:
return(0);
case (MDL_REMOVE | REQUEST): case (MDL_REMOVE | REQUEST):
cs->hw.diva.status = 0; cs->hw.diva.status = 0;
break; break;
...@@ -688,21 +700,29 @@ diva_ipac_pci_init(struct IsdnCardState *cs) ...@@ -688,21 +700,29 @@ diva_ipac_pci_init(struct IsdnCardState *cs)
static struct card_ops diva_ops = { static struct card_ops diva_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = diva_reset,
.release = diva_release,
.irq_func = diva_interrupt, .irq_func = diva_interrupt,
}; };
static struct card_ops diva_ipac_isa_ops = { static struct card_ops diva_ipac_isa_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = diva_ipac_isa_reset,
.release = diva_ipac_isa_release,
.irq_func = diva_ipac_isa_irq, .irq_func = diva_ipac_isa_irq,
}; };
static struct card_ops diva_ipac_pci_ops = { static struct card_ops diva_ipac_pci_ops = {
.init = diva_ipac_pci_init, .init = diva_ipac_pci_init,
.reset = diva_ipac_pci_reset,
.release = diva_ipac_pci_release,
.irq_func = diva_ipac_pci_irq, .irq_func = diva_ipac_pci_irq,
}; };
static struct card_ops diva_ipacx_pci_ops = { static struct card_ops diva_ipacx_pci_ops = {
.init = diva_ipacx_pci_init, .init = diva_ipacx_pci_init,
.reset = diva_ipacx_pci_reset,
.release = diva_ipac_pci_release,
.irq_func = diva_ipacx_pci_irq, .irq_func = diva_ipacx_pci_irq,
}; };
...@@ -939,27 +959,30 @@ setup_diva(struct IsdnCard *card) ...@@ -939,27 +959,30 @@ setup_diva(struct IsdnCard *card)
request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn"); request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn");
} }
} }
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;
if (cs->subtyp == DIVA_IPAC_ISA) { if (cs->subtyp == DIVA_IPAC_ISA) {
diva_ipac_isa_reset(cs);
cs->dc_hw_ops = &ipac_dc_ops; cs->dc_hw_ops = &ipac_dc_ops;
cs->card_ops = &diva_ipac_isa_ops; cs->card_ops = &diva_ipac_isa_ops;
val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID); val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val); printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPAC_PCI) { } else if (cs->subtyp == DIVA_IPAC_PCI) {
diva_ipac_pci_reset(cs);
cs->dc_hw_ops = &mem_ipac_dc_ops; cs->dc_hw_ops = &mem_ipac_dc_ops;
cs->bc_hw_ops = &mem_hscx_ops; cs->bc_hw_ops = &mem_hscx_ops;
cs->card_ops = &diva_ipac_pci_ops; cs->card_ops = &diva_ipac_pci_ops;
val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID); val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val); printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPACX_PCI) { } else if (cs->subtyp == DIVA_IPACX_PCI) {
diva_ipacx_pci_reset(cs);
cs->dc_hw_ops = &ipacx_dc_ops; cs->dc_hw_ops = &ipacx_dc_ops;
cs->bc_hw_ops = &ipacx_bc_ops; cs->bc_hw_ops = &ipacx_bc_ops;
cs->card_ops = &diva_ipacx_pci_ops; cs->card_ops = &diva_ipacx_pci_ops;
printk(KERN_INFO "Diva: IPACX Design Id: %x\n", printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
ipacx_dc_read(cs, IPACX_ID) &0x3F); ipacx_dc_read(cs, IPACX_ID) &0x3F);
} else { /* DIVA 2.0 */ } else { /* DIVA 2.0 */
diva_reset(cs);
cs->hw.diva.tl.function = (void *) diva_led_handler; cs->hw.diva.tl.function = (void *) diva_led_handler;
cs->hw.diva.tl.data = (long) cs; cs->hw.diva.tl.data = (long) cs;
init_timer(&cs->hw.diva.tl); init_timer(&cs->hw.diva.tl);
...@@ -969,7 +992,7 @@ setup_diva(struct IsdnCard *card) ...@@ -969,7 +992,7 @@ setup_diva(struct IsdnCard *card)
if (HscxVersion(cs, "Diva:")) { if (HscxVersion(cs, "Diva:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Diva: wrong HSCX versions check IO address\n"); "Diva: wrong HSCX versions check IO address\n");
release_io_diva(cs); diva_release(cs);
return (0); return (0);
} }
} }
......
...@@ -450,8 +450,8 @@ elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs) ...@@ -450,8 +450,8 @@ elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
writereg(cs, cs->hw.elsa.isac, IPAC_MASK, 0xC0); writereg(cs, cs->hw.elsa.isac, IPAC_MASK, 0xC0);
} }
void static void
release_io_elsa(struct IsdnCardState *cs) elsa_release(struct IsdnCardState *cs)
{ {
int bytecnt = 8; int bytecnt = 8;
...@@ -488,8 +488,8 @@ release_io_elsa(struct IsdnCardState *cs) ...@@ -488,8 +488,8 @@ release_io_elsa(struct IsdnCardState *cs)
release_region(cs->hw.elsa.base, bytecnt); release_region(cs->hw.elsa.base, bytecnt);
} }
static void static int
reset_elsa(struct IsdnCardState *cs) elsa_reset(struct IsdnCardState *cs)
{ {
if (cs->hw.elsa.timer) { if (cs->hw.elsa.timer) {
/* Wait 1 Timer */ /* Wait 1 Timer */
...@@ -531,6 +531,7 @@ reset_elsa(struct IsdnCardState *cs) ...@@ -531,6 +531,7 @@ reset_elsa(struct IsdnCardState *cs)
else if (cs->subtyp == ELSA_QS3000PCI) else if (cs->subtyp == ELSA_QS3000PCI)
byteout(cs->hw.elsa.cfg + 0x4c, 0x43); /* enable ELSA PCI IRQ */ byteout(cs->hw.elsa.cfg + 0x4c, 0x43); /* enable ELSA PCI IRQ */
} }
return 0;
} }
#if ARCOFI_USE #if ARCOFI_USE
...@@ -679,50 +680,6 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -679,50 +680,6 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
int ret = 0; int ret = 0;
switch (mt) { switch (mt) {
case CARD_RESET:
reset_elsa(cs);
return(0);
case CARD_RELEASE:
release_io_elsa(cs);
return(0);
case CARD_TEST:
if ((cs->subtyp == ELSA_PCMCIA) ||
(cs->subtyp == ELSA_PCMCIA_IPAC) ||
(cs->subtyp == ELSA_QS1000PCI)) {
return(0);
} else if (cs->subtyp == ELSA_QS3000PCI) {
ret = 0;
} else {
cs->hw.elsa.counter = 0;
cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT;
cs->hw.elsa.status |= ELSA_TIMER_AKTIV;
byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
byteout(cs->hw.elsa.timer, 0);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((110*HZ)/1000);
cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT;
byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV;
printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n",
cs->hw.elsa.counter);
if ((cs->hw.elsa.counter > 10) &&
(cs->hw.elsa.counter < 16)) {
printk(KERN_INFO "Elsa: timer and irq OK\n");
ret = 0;
} else {
printk(KERN_WARNING
"Elsa: timer tic problem (%d/12) maybe an IRQ(%d) conflict\n",
cs->hw.elsa.counter, cs->irq);
ret = 1;
}
}
#if ARCOFI_USE
if (check_arcofi(cs)) {
init_modem(cs);
}
#endif
elsa_led_handler(cs);
return(ret);
case (MDL_REMOVE | REQUEST): case (MDL_REMOVE | REQUEST):
cs->hw.elsa.status &= 0; cs->hw.elsa.status &= 0;
break; break;
...@@ -750,21 +707,6 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -750,21 +707,6 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
cs->hw.elsa.status &= ~0x0100; cs->hw.elsa.status &= ~0x0100;
} }
break; break;
#if ARCOFI_USE
case CARD_AUX_IND:
if (cs->hw.elsa.MFlag) {
int len;
u8 *msg;
if (!arg)
return(0);
msg = arg;
len = *msg;
msg++;
modem_write_cmd(cs, msg, len);
}
break;
#endif
} }
if (cs->typ == ISDN_CTYPE_ELSA) { if (cs->typ == ISDN_CTYPE_ELSA) {
int pwr = bytein(cs->hw.elsa.ale); int pwr = bytein(cs->hw.elsa.ale);
...@@ -777,6 +719,26 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -777,6 +719,26 @@ Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(ret); return(ret);
} }
#if ARCOFI_USE
static void
elsa_aux_ind(struct IsdnCardState *cs, void *arg)
{
if (cs->hw.elsa.MFlag) {
int len;
u8 *msg;
if (!arg)
return;
msg = arg;
len = *msg;
msg++;
modem_write_cmd(cs, msg, len);
}
}
#else
#define elsa_aux_ind NULL
#endif
static void static void
elsa_init(struct IsdnCardState *cs) elsa_init(struct IsdnCardState *cs)
{ {
...@@ -790,13 +752,59 @@ elsa_init(struct IsdnCardState *cs) ...@@ -790,13 +752,59 @@ elsa_init(struct IsdnCardState *cs)
inithscxisac(cs); inithscxisac(cs);
} }
static void
elsa_test(struct IsdnCardState *cs)
{
if ((cs->subtyp == ELSA_PCMCIA) ||
(cs->subtyp == ELSA_PCMCIA_IPAC) ||
(cs->subtyp == ELSA_QS1000PCI)) {
return;
}
if (cs->subtyp != ELSA_QS3000PCI) {
cs->hw.elsa.counter = 0;
cs->hw.elsa.ctrl_reg |= ELSA_ENA_TIMER_INT;
cs->hw.elsa.status |= ELSA_TIMER_AKTIV;
byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
byteout(cs->hw.elsa.timer, 0);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((110*HZ)/1000);
cs->hw.elsa.ctrl_reg &= ~ELSA_ENA_TIMER_INT;
byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
cs->hw.elsa.status &= ~ELSA_TIMER_AKTIV;
printk(KERN_INFO "Elsa: %d timer tics in 110 msek\n",
cs->hw.elsa.counter);
if ((cs->hw.elsa.counter > 10) &&
(cs->hw.elsa.counter < 16)) {
printk(KERN_INFO "Elsa: timer and irq OK\n");
} else {
printk(KERN_WARNING
"Elsa: timer tic problem (%d/12) maybe an IRQ(%d) conflict\n",
cs->hw.elsa.counter, cs->irq);
}
}
#if ARCOFI_USE
if (check_arcofi(cs)) {
init_modem(cs);
}
#endif
elsa_led_handler(cs);
}
static struct card_ops elsa_ops = { static struct card_ops elsa_ops = {
.init = elsa_init, .init = elsa_init,
.test = elsa_test,
.reset = elsa_reset,
.release = elsa_release,
.aux_ind = elsa_aux_ind,
.irq_func = elsa_interrupt, .irq_func = elsa_interrupt,
}; };
static struct card_ops elsa_ipac_ops = { static struct card_ops elsa_ipac_ops = {
.init = elsa_init, .init = elsa_init,
.test = elsa_test,
.reset = elsa_reset,
.release = elsa_release,
.aux_ind = elsa_aux_ind,
.irq_func = elsa_interrupt_ipac, .irq_func = elsa_interrupt_ipac,
}; };
...@@ -1168,21 +1176,21 @@ setup_elsa(struct IsdnCard *card) ...@@ -1168,21 +1176,21 @@ setup_elsa(struct IsdnCard *card)
if (!TimerRun(cs)) { if (!TimerRun(cs)) {
printk(KERN_WARNING printk(KERN_WARNING
"Elsa: timer do not start\n"); "Elsa: timer do not start\n");
release_io_elsa(cs); elsa_release(cs);
return (0); return (0);
} }
} }
HZDELAY(1); /* wait >=10 ms */ HZDELAY(1); /* wait >=10 ms */
if (TimerRun(cs)) { if (TimerRun(cs)) {
printk(KERN_WARNING "Elsa: timer do not run down\n"); printk(KERN_WARNING "Elsa: timer do not run down\n");
release_io_elsa(cs); elsa_release(cs);
return (0); return (0);
} }
printk(KERN_INFO "Elsa: timer OK; resetting card\n"); printk(KERN_INFO "Elsa: timer OK; resetting card\n");
} }
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Elsa_card_msg; cs->cardmsg = &Elsa_card_msg;
reset_elsa(cs); elsa_reset(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;
cs->card_ops = &elsa_ipac_ops; cs->card_ops = &elsa_ipac_ops;
...@@ -1195,7 +1203,7 @@ setup_elsa(struct IsdnCard *card) ...@@ -1195,7 +1203,7 @@ setup_elsa(struct IsdnCard *card)
if (HscxVersion(cs, "Elsa:")) { if (HscxVersion(cs, "Elsa:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Elsa: wrong HSCX versions check IO address\n"); "Elsa: wrong HSCX versions check IO address\n");
release_io_elsa(cs); elsa_release(cs);
return (0); return (0);
} }
} }
......
...@@ -162,15 +162,6 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -162,15 +162,6 @@ enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt); debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt);
switch (mt) { switch (mt) {
case CARD_RESET:
reset_enpci(cs);
Amd7930_init(cs);
break;
case CARD_RELEASE:
release_io_netjet(cs);
break;
case CARD_TEST:
break;
case MDL_ASSIGN: case MDL_ASSIGN:
/* TEI assigned, LED1 on */ /* TEI assigned, LED1 on */
cs->hw.njet.auxd = TJ_AMD_IRQ << 1; cs->hw.njet.auxd = TJ_AMD_IRQ << 1;
...@@ -221,6 +212,14 @@ enpci_init(struct IsdnCardState *cs) ...@@ -221,6 +212,14 @@ enpci_init(struct IsdnCardState *cs)
Amd7930_init(cs); Amd7930_init(cs);
} }
static int
enpci_reset(struct IsdnCardState *cs)
{
reset_enpci(cs);
Amd7930_init(cs);
return 0;
}
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)
{ {
...@@ -270,6 +269,8 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -270,6 +269,8 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
static struct card_ops enpci_ops = { static struct card_ops enpci_ops = {
.init = enpci_init, .init = enpci_init,
.reset = enpci_reset,
.release = netjet_release,
.irq_func = enpci_interrupt, .irq_func = enpci_interrupt,
}; };
......
...@@ -324,104 +324,109 @@ gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -324,104 +324,109 @@ gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
writereg_ipac(cs, IPAC_MASK, 0xFF); writereg_ipac(cs, IPAC_MASK, 0xFF);
writereg_ipac(cs, IPAC_MASK, 0xC0); writereg_ipac(cs, IPAC_MASK, 0xC0);
} }
void
release_io_gazel(struct IsdnCardState *cs) static void
gazel_release(struct IsdnCardState *cs)
{ {
unsigned int i; unsigned int i;
switch (cs->subtyp) { switch (cs->subtyp) {
case R647: case R647:
for (i = 0x0000; i < 0xC000; i += 0x1000) for (i = 0x0000; i < 0xC000; i += 0x1000)
release_region(i + cs->hw.gazel.hscx[0], 16); release_region(i + cs->hw.gazel.hscx[0], 16);
release_region(0xC000 + cs->hw.gazel.hscx[0], 1); release_region(0xC000 + cs->hw.gazel.hscx[0], 1);
break; break;
case R685:
release_region(cs->hw.gazel.hscx[0], 0x100);
release_region(cs->hw.gazel.cfg_reg, 0x80);
break;
}
}
case R685: static void
release_region(cs->hw.gazel.hscx[0], 0x100); gazel_ipac_release(struct IsdnCardState *cs)
release_region(cs->hw.gazel.cfg_reg, 0x80); {
break; switch (cs->subtyp) {
case R753:
release_region(cs->hw.gazel.ipac, 0x8);
release_region(cs->hw.gazel.cfg_reg, 0x80);
break;
case R742:
release_region(cs->hw.gazel.ipac, 8);
break;
}
}
case R753: static int
release_region(cs->hw.gazel.ipac, 0x8); gazel_reset(struct IsdnCardState *cs)
release_region(cs->hw.gazel.cfg_reg, 0x80); {
break; unsigned long plxcntrl, addr = cs->hw.gazel.cfg_reg;
case R742: switch (cs->subtyp) {
release_region(cs->hw.gazel.ipac, 8); case R647:
break; writereg(addr, 0, 0);
HZDELAY(10);
writereg(addr, 0, 1);
HZDELAY(2);
break;
case R685:
plxcntrl = inl(addr + PLX_CNTRL);
plxcntrl |= (RESET_9050 + RESET_GAZEL);
outl(plxcntrl, addr + PLX_CNTRL);
plxcntrl &= ~(RESET_9050 + RESET_GAZEL);
HZDELAY(4);
outl(plxcntrl, addr + PLX_CNTRL);
HZDELAY(10);
outb(INT_ISAC_EN + INT_HSCX_EN + INT_PCI_EN, addr + PLX_INCSR);
break;
} }
return 0;
} }
static int static int
reset_gazel(struct IsdnCardState *cs) gazel_ipac_reset(struct IsdnCardState *cs)
{ {
unsigned long plxcntrl, addr = cs->hw.gazel.cfg_reg; unsigned long plxcntrl, addr = cs->hw.gazel.cfg_reg;
switch (cs->subtyp) { switch (cs->subtyp) {
case R647: case R753:
writereg(addr, 0, 0); if (test_bit(FLG_BUGGY_PLX9050, &cs->HW_Flags))
HZDELAY(10); /* we can't read, assume the default */
writereg(addr, 0, 1); plxcntrl = 0x18784db6;
HZDELAY(2); else
break;
case R685:
plxcntrl = inl(addr + PLX_CNTRL); plxcntrl = inl(addr + PLX_CNTRL);
plxcntrl |= (RESET_9050 + RESET_GAZEL); plxcntrl |= (RESET_9050 + RESET_GAZEL);
outl(plxcntrl, addr + PLX_CNTRL); outl(plxcntrl, addr + PLX_CNTRL);
plxcntrl &= ~(RESET_9050 + RESET_GAZEL); writereg_ipac(cs, IPAC_POTA2, 0x20);
HZDELAY(4); HZDELAY(4);
outl(plxcntrl, addr + PLX_CNTRL); plxcntrl &= ~(RESET_9050 + RESET_GAZEL);
HZDELAY(10); outl(plxcntrl, addr + PLX_CNTRL);
outb(INT_ISAC_EN + INT_HSCX_EN + INT_PCI_EN, addr + PLX_INCSR); HZDELAY(10);
break; writereg_ipac(cs, IPAC_POTA2, 0x00);
case R753: writereg_ipac(cs, IPAC_ACFG, 0xff);
if (test_bit(FLG_BUGGY_PLX9050, &cs->HW_Flags)) writereg_ipac(cs, IPAC_AOE, 0x0);
/* we can't read, assume the default */ writereg_ipac(cs, IPAC_MASK, 0xff);
plxcntrl = 0x18784db6; writereg_ipac(cs, IPAC_CONF, 0x1);
else outb(INT_IPAC_EN + INT_PCI_EN, addr + PLX_INCSR);
plxcntrl = inl(addr + PLX_CNTRL); writereg_ipac(cs, IPAC_MASK, 0xc0);
plxcntrl |= (RESET_9050 + RESET_GAZEL); break;
outl(plxcntrl, addr + PLX_CNTRL); case R742:
writereg_ipac(cs, IPAC_POTA2, 0x20); writereg_ipac(cs, IPAC_POTA2, 0x20);
HZDELAY(4); HZDELAY(4);
plxcntrl &= ~(RESET_9050 + RESET_GAZEL); writereg_ipac(cs, IPAC_POTA2, 0x00);
outl(plxcntrl, addr + PLX_CNTRL); writereg_ipac(cs, IPAC_ACFG, 0xff);
HZDELAY(10); writereg_ipac(cs, IPAC_AOE, 0x0);
writereg_ipac(cs, IPAC_POTA2, 0x00); writereg_ipac(cs, IPAC_MASK, 0xff);
writereg_ipac(cs, IPAC_ACFG, 0xff); writereg_ipac(cs, IPAC_CONF, 0x1);
writereg_ipac(cs, IPAC_AOE, 0x0); writereg_ipac(cs, IPAC_MASK, 0xc0);
writereg_ipac(cs, IPAC_MASK, 0xff); break;
writereg_ipac(cs, IPAC_CONF, 0x1);
outb(INT_IPAC_EN + INT_PCI_EN, addr + PLX_INCSR);
writereg_ipac(cs, IPAC_MASK, 0xc0);
break;
case R742:
writereg_ipac(cs, IPAC_POTA2, 0x20);
HZDELAY(4);
writereg_ipac(cs, IPAC_POTA2, 0x00);
writereg_ipac(cs, IPAC_ACFG, 0xff);
writereg_ipac(cs, IPAC_AOE, 0x0);
writereg_ipac(cs, IPAC_MASK, 0xff);
writereg_ipac(cs, IPAC_CONF, 0x1);
writereg_ipac(cs, IPAC_MASK, 0xc0);
break;
} }
return (0); return 0;
} }
static int static int
Gazel_card_msg(struct IsdnCardState *cs, int mt, void *arg) Gazel_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_gazel(cs);
return (0);
case CARD_RELEASE:
release_io_gazel(cs);
return (0);
case CARD_TEST:
return (0);
}
return (0); return (0);
} }
...@@ -438,11 +443,15 @@ gazel_init(struct IsdnCardState *cs) ...@@ -438,11 +443,15 @@ gazel_init(struct IsdnCardState *cs)
static struct card_ops gazel_ops = { static struct card_ops gazel_ops = {
.init = gazel_init, .init = gazel_init,
.reset = gazel_reset,
.release = gazel_release,
.irq_func = gazel_interrupt, .irq_func = gazel_interrupt,
}; };
static struct card_ops gazel_ipac_ops = { static struct card_ops gazel_ipac_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = gazel_ipac_reset,
.release = gazel_ipac_release,
.irq_func = gazel_ipac_interrupt, .irq_func = gazel_ipac_interrupt,
}; };
...@@ -683,11 +692,6 @@ setup_gazel(struct IsdnCard *card) ...@@ -683,11 +692,6 @@ setup_gazel(struct IsdnCard *card)
if (reserve_regions(card, cs)) { if (reserve_regions(card, cs)) {
return (0); return (0);
} }
if (reset_gazel(cs)) {
printk(KERN_WARNING "Gazel: wrong IRQ\n");
release_io_gazel(cs);
return (0);
}
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;
...@@ -695,17 +699,19 @@ setup_gazel(struct IsdnCard *card) ...@@ -695,17 +699,19 @@ setup_gazel(struct IsdnCard *card)
switch (cs->subtyp) { switch (cs->subtyp) {
case R647: case R647:
case R685: case R685:
gazel_reset(cs);
cs->card_ops = &gazel_ops; cs->card_ops = &gazel_ops;
ISACVersion(cs, "Gazel:"); ISACVersion(cs, "Gazel:");
if (HscxVersion(cs, "Gazel:")) { if (HscxVersion(cs, "Gazel:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Gazel: wrong HSCX versions check IO address\n"); "Gazel: wrong HSCX versions check IO address\n");
release_io_gazel(cs); gazel_release(cs);
return (0); return (0);
} }
break; break;
case R742: case R742:
case R753: case R753:
gazel_ipac_reset(cs);
cs->card_ops = &gazel_ipac_ops; cs->card_ops = &gazel_ipac_ops;
val = readreg_ipac(cs, IPAC_ID); val = readreg_ipac(cs, IPAC_ID);
printk(KERN_INFO "Gazel: IPAC version %x\n", val); printk(KERN_INFO "Gazel: IPAC version %x\n", val);
......
...@@ -70,8 +70,8 @@ static const PCI_ENTRY id_list[] = ...@@ -70,8 +70,8 @@ static const PCI_ENTRY id_list[] =
/******************************************/ /******************************************/
/* free hardware resources used by driver */ /* free hardware resources used by driver */
/******************************************/ /******************************************/
void static void
release_io_hfcpci(struct IsdnCardState *cs) hfcpci_release(struct IsdnCardState *cs)
{ {
printk(KERN_INFO "HiSax: release hfcpci at %p\n", printk(KERN_INFO "HiSax: release hfcpci at %p\n",
cs->hw.hfcpci.pci_io); cs->hw.hfcpci.pci_io);
...@@ -91,8 +91,8 @@ release_io_hfcpci(struct IsdnCardState *cs) ...@@ -91,8 +91,8 @@ release_io_hfcpci(struct IsdnCardState *cs)
/* function called to reset the HFC PCI chip. A complete software reset of chip */ /* function called to reset the HFC PCI chip. A complete software reset of chip */
/* and fifos is done. */ /* and fifos is done. */
/********************************************************************************/ /********************************************************************************/
static void static int
reset_hfcpci(struct IsdnCardState *cs) hfcpci_reset(struct IsdnCardState *cs)
{ {
pci_disable_device(cs->hw.hfcpci.pdev); pci_disable_device(cs->hw.hfcpci.pdev);
cs->hw.hfcpci.int_m2 = 0; /* interrupt output off ! */ cs->hw.hfcpci.int_m2 = 0; /* interrupt output off ! */
...@@ -159,6 +159,8 @@ reset_hfcpci(struct IsdnCardState *cs) ...@@ -159,6 +159,8 @@ reset_hfcpci(struct IsdnCardState *cs)
cs->hw.hfcpci.int_m2 = HFCPCI_IRQ_ENABLE; cs->hw.hfcpci.int_m2 = HFCPCI_IRQ_ENABLE;
Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2); Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
if (Read_hfc(cs, HFCPCI_INT_S2)); if (Read_hfc(cs, HFCPCI_INT_S2));
return 0;
} }
/***************************************************/ /***************************************************/
...@@ -1366,18 +1368,6 @@ inithfcpci(struct IsdnCardState *cs) ...@@ -1366,18 +1368,6 @@ inithfcpci(struct IsdnCardState *cs)
static int static int
hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) hfcpci_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "HFCPCI: card_msg %x", mt);
switch (mt) {
case CARD_RESET:
reset_hfcpci(cs);
return (0);
case CARD_RELEASE:
release_io_hfcpci(cs);
return (0);
case CARD_TEST:
return (0);
}
return (0); return (0);
} }
...@@ -1396,6 +1386,8 @@ hfcpci_init(struct IsdnCardState *cs) ...@@ -1396,6 +1386,8 @@ hfcpci_init(struct IsdnCardState *cs)
static struct card_ops hfcpci_ops = { static struct card_ops hfcpci_ops = {
.init = hfcpci_init, .init = hfcpci_init,
.reset = hfcpci_reset,
.release = hfcpci_release,
.irq_func = hfcpci_interrupt, .irq_func = hfcpci_interrupt,
}; };
...@@ -1488,7 +1480,7 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1488,7 +1480,7 @@ setup_hfcpci(struct IsdnCard *card)
cs->hw.hfcpci.timer.data = (long) cs; cs->hw.hfcpci.timer.data = (long) cs;
init_timer(&cs->hw.hfcpci.timer); init_timer(&cs->hw.hfcpci.timer);
reset_hfcpci(cs); hfcpci_reset(cs);
cs->cardmsg = &hfcpci_card_msg; cs->cardmsg = &hfcpci_card_msg;
cs->auxcmd = &hfcpci_auxcmd; cs->auxcmd = &hfcpci_auxcmd;
cs->card_ops = &hfcpci_ops; cs->card_ops = &hfcpci_ops;
......
...@@ -308,8 +308,8 @@ read_fifo(struct IsdnCardState *cs, u8 fifo, int trans_max) ...@@ -308,8 +308,8 @@ read_fifo(struct IsdnCardState *cs, u8 fifo, int trans_max)
/******************************************/ /******************************************/
/* free hardware resources used by driver */ /* free hardware resources used by driver */
/******************************************/ /******************************************/
void static void
release_io_hfcsx(struct IsdnCardState *cs) hfcsx_release(struct IsdnCardState *cs)
{ {
cs->hw.hfcsx.int_m2 = 0; /* interrupt output off ! */ cs->hw.hfcsx.int_m2 = 0; /* interrupt output off ! */
Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2); Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2);
...@@ -347,8 +347,8 @@ static int set_fifo_size(struct IsdnCardState *cs) ...@@ -347,8 +347,8 @@ static int set_fifo_size(struct IsdnCardState *cs)
/* function called to reset the HFC SX chip. A complete software reset of chip */ /* function called to reset the HFC SX chip. A complete software reset of chip */
/* and fifos is done. */ /* and fifos is done. */
/********************************************************************************/ /********************************************************************************/
static void static int
reset_hfcsx(struct IsdnCardState *cs) hfcsx_reset(struct IsdnCardState *cs)
{ {
cs->hw.hfcsx.int_m2 = 0; /* interrupt output off ! */ cs->hw.hfcsx.int_m2 = 0; /* interrupt output off ! */
Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2); Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2);
...@@ -415,6 +415,7 @@ reset_hfcsx(struct IsdnCardState *cs) ...@@ -415,6 +415,7 @@ reset_hfcsx(struct IsdnCardState *cs)
cs->hw.hfcsx.int_m2 = HFCSX_IRQ_ENABLE; cs->hw.hfcsx.int_m2 = HFCSX_IRQ_ENABLE;
Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2); Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2);
if (Read_hfc(cs, HFCSX_INT_S2)); if (Read_hfc(cs, HFCSX_INT_S2));
return 0;
} }
/***************************************************/ /***************************************************/
...@@ -1143,18 +1144,6 @@ inithfcsx(struct IsdnCardState *cs) ...@@ -1143,18 +1144,6 @@ inithfcsx(struct IsdnCardState *cs)
static int static int
hfcsx_card_msg(struct IsdnCardState *cs, int mt, void *arg) hfcsx_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "HFCSX: card_msg %x", mt);
switch (mt) {
case CARD_RESET:
reset_hfcsx(cs);
return (0);
case CARD_RELEASE:
release_io_hfcsx(cs);
return (0);
case CARD_TEST:
return (0);
}
return (0); return (0);
} }
...@@ -1173,6 +1162,8 @@ hfcsx_init(struct IsdnCardState *cs) ...@@ -1173,6 +1162,8 @@ hfcsx_init(struct IsdnCardState *cs)
static struct card_ops hfcsx_ops = { static struct card_ops hfcsx_ops = {
.init = hfcsx_init, .init = hfcsx_init,
.reset = hfcsx_reset,
.release = hfcsx_release,
.irq_func = hfcsx_interrupt, .irq_func = hfcsx_interrupt,
}; };
...@@ -1300,7 +1291,7 @@ setup_hfcsx(struct IsdnCard *card) ...@@ -1300,7 +1291,7 @@ setup_hfcsx(struct IsdnCard *card)
cs->hw.hfcsx.cirm = ccd_sp_irqtab[cs->irq & 0xF]; /* RAM not evaluated */ cs->hw.hfcsx.cirm = ccd_sp_irqtab[cs->irq & 0xF]; /* RAM not evaluated */
init_timer(&cs->hw.hfcsx.timer); init_timer(&cs->hw.hfcsx.timer);
reset_hfcsx(cs); hfcsx_reset(cs);
cs->cardmsg = &hfcsx_card_msg; cs->cardmsg = &hfcsx_card_msg;
cs->auxcmd = &hfcsx_auxcmd; cs->auxcmd = &hfcsx_auxcmd;
cs->card_ops = &hfcsx_ops; cs->card_ops = &hfcsx_ops;
......
...@@ -64,8 +64,8 @@ hfcs_Timer(struct IsdnCardState *cs) ...@@ -64,8 +64,8 @@ hfcs_Timer(struct IsdnCardState *cs)
*/ */
} }
void static void
release_io_hfcs(struct IsdnCardState *cs) hfcs_release(struct IsdnCardState *cs)
{ {
release2bds0(cs); release2bds0(cs);
del_timer(&cs->hw.hfcD.timer); del_timer(&cs->hw.hfcD.timer);
...@@ -73,8 +73,8 @@ release_io_hfcs(struct IsdnCardState *cs) ...@@ -73,8 +73,8 @@ release_io_hfcs(struct IsdnCardState *cs)
release_region(cs->hw.hfcD.addr, 2); release_region(cs->hw.hfcD.addr, 2);
} }
static void static int
reset_hfcs(struct IsdnCardState *cs) hfcs_reset(struct IsdnCardState *cs)
{ {
printk(KERN_INFO "HFCS: resetting card\n"); printk(KERN_INFO "HFCS: resetting card\n");
cs->hw.hfcD.cirm = HFCD_RESET; cs->hw.hfcD.cirm = HFCD_RESET;
...@@ -111,23 +111,12 @@ reset_hfcs(struct IsdnCardState *cs) ...@@ -111,23 +111,12 @@ reset_hfcs(struct IsdnCardState *cs)
hfcs_write_reg(cs, HFCD_DATA, HFCD_MST_MODE, cs->hw.hfcD.mst_m); /* HFC Master */ hfcs_write_reg(cs, HFCD_DATA, HFCD_MST_MODE, cs->hw.hfcD.mst_m); /* HFC Master */
cs->hw.hfcD.sctrl = 0; cs->hw.hfcD.sctrl = 0;
hfcs_write_reg(cs, HFCD_DATA, HFCD_SCTRL, cs->hw.hfcD.sctrl); hfcs_write_reg(cs, HFCD_DATA, HFCD_SCTRL, cs->hw.hfcD.sctrl);
return 0;
} }
static int static int
hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg) hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "HFCS: card_msg %x", mt);
switch (mt) {
case CARD_RESET:
reset_hfcs(cs);
return(0);
case CARD_RELEASE:
release_io_hfcs(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -146,6 +135,8 @@ hfcs_init(struct IsdnCardState *cs) ...@@ -146,6 +135,8 @@ hfcs_init(struct IsdnCardState *cs)
static struct card_ops hfcs_ops = { static struct card_ops hfcs_ops = {
.init = hfcs_init, .init = hfcs_init,
.reset = hfcs_reset,
.release = hfcs_release,
.irq_func = hfcs_interrupt, .irq_func = hfcs_interrupt,
}; };
...@@ -270,7 +261,7 @@ setup_hfcs(struct IsdnCard *card) ...@@ -270,7 +261,7 @@ setup_hfcs(struct IsdnCard *card)
cs->hw.hfcD.timer.function = (void *) hfcs_Timer; cs->hw.hfcD.timer.function = (void *) hfcs_Timer;
cs->hw.hfcD.timer.data = (long) cs; cs->hw.hfcD.timer.data = (long) cs;
init_timer(&cs->hw.hfcD.timer); init_timer(&cs->hw.hfcD.timer);
reset_hfcs(cs); hfcs_reset(cs);
cs->cardmsg = &hfcs_card_msg; cs->cardmsg = &hfcs_card_msg;
cs->card_ops = &hfcs_ops; cs->card_ops = &hfcs_ops;
return (1); return (1);
......
...@@ -46,10 +46,6 @@ ...@@ -46,10 +46,6 @@
#define HW_INFO4_P10 0x0048 #define HW_INFO4_P10 0x0048
#define HW_RSYNC 0x0060 #define HW_RSYNC 0x0060
#define HW_TESTLOOP 0x0070 #define HW_TESTLOOP 0x0070
#define CARD_RESET 0x00F0
#define CARD_RELEASE 0x00F3
#define CARD_TEST 0x00F4
#define CARD_AUX_IND 0x00F5
#define PH_ACTIVATE 0x0100 #define PH_ACTIVATE 0x0100
#define PH_DEACTIVATE 0x0110 #define PH_DEACTIVATE 0x0110
...@@ -858,6 +854,10 @@ struct IsdnCardState; ...@@ -858,6 +854,10 @@ struct IsdnCardState;
struct card_ops { struct card_ops {
void (*init) (struct IsdnCardState *); void (*init) (struct IsdnCardState *);
void (*test) (struct IsdnCardState *);
int (*reset) (struct IsdnCardState *);
void (*release) (struct IsdnCardState *);
void (*aux_ind) (struct IsdnCardState *, void *arg);
void (*irq_func) (int, void *, struct pt_regs *); void (*irq_func) (int, void *, struct pt_regs *);
}; };
......
...@@ -174,7 +174,7 @@ ISARVersion(struct IsdnCardState *cs, char *s) ...@@ -174,7 +174,7 @@ ISARVersion(struct IsdnCardState *cs, char *s)
u8 len; u8 len;
int debug; int debug;
cs->cardmsg(cs, CARD_RESET, NULL); cs->card_ops->reset(cs);
/* disable ISAR IRQ */ /* disable ISAR IRQ */
isar_write_reg(cs, 0, ISAR_IRQBIT, 0); isar_write_reg(cs, 0, ISAR_IRQBIT, 0);
debug = cs->debug; debug = cs->debug;
......
...@@ -132,8 +132,8 @@ isurf_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -132,8 +132,8 @@ isurf_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
void static void
release_io_isurf(struct IsdnCardState *cs) isurf_release(struct IsdnCardState *cs)
{ {
release_region(cs->hw.isurf.reset, 1); release_region(cs->hw.isurf.reset, 1);
iounmap((unsigned char *)cs->hw.isurf.isar); iounmap((unsigned char *)cs->hw.isurf.isar);
...@@ -156,16 +156,6 @@ reset_isurf(struct IsdnCardState *cs, u8 chips) ...@@ -156,16 +156,6 @@ reset_isurf(struct IsdnCardState *cs, u8 chips)
static int static int
ISurf_card_msg(struct IsdnCardState *cs, int mt, void *arg) ISurf_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_isurf(cs, ISURF_RESET);
return(0);
case CARD_RELEASE:
release_io_isurf(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -188,13 +178,22 @@ isurf_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) { ...@@ -188,13 +178,22 @@ isurf_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) {
static void static void
isurf_init(struct IsdnCardState *cs) isurf_init(struct IsdnCardState *cs)
{ {
writeb(0, cs->hw.isurf.isar+ISAR_IRQBIT);mb(); writeb(0, cs->hw.isurf.isar + ISAR_IRQBIT);
initisac(cs); initisac(cs);
initisar(cs); initisar(cs);
} }
static int
isurf_reset(struct IsdnCardState *cs)
{
reset_isurf(cs, ISURF_RESET);
return 0;
}
static struct card_ops isurf_ops = { static struct card_ops isurf_ops = {
.init = isurf_init, .init = isurf_init,
.reset = isurf_reset,
.release = isurf_release,
.irq_func = isurf_interrupt, .irq_func = isurf_interrupt,
}; };
...@@ -304,7 +303,7 @@ setup_isurf(struct IsdnCard *card) ...@@ -304,7 +303,7 @@ setup_isurf(struct IsdnCard *card)
if (ver < 0) { if (ver < 0) {
printk(KERN_WARNING printk(KERN_WARNING
"ISurf: wrong ISAR version (ret = %d)\n", ver); "ISurf: wrong ISAR version (ret = %d)\n", ver);
release_io_isurf(cs); isurf_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -141,7 +141,7 @@ static struct bc_hw_ops hscx_ops = { ...@@ -141,7 +141,7 @@ static struct bc_hw_ops hscx_ops = {
}; };
static void static void
ix1micro_interrupt(int intno, void *dev_id, struct pt_regs *regs) ix1_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 val; u8 val;
...@@ -176,14 +176,14 @@ ix1micro_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -176,14 +176,14 @@ ix1micro_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
void static void
release_io_ix1micro(struct IsdnCardState *cs) ix1_release(struct IsdnCardState *cs)
{ {
if (cs->hw.ix1.cfg_reg) if (cs->hw.ix1.cfg_reg)
release_region(cs->hw.ix1.cfg_reg, 4); release_region(cs->hw.ix1.cfg_reg, 4);
} }
static void static int
ix1_reset(struct IsdnCardState *cs) ix1_reset(struct IsdnCardState *cs)
{ {
int cnt; int cnt;
...@@ -195,27 +195,20 @@ ix1_reset(struct IsdnCardState *cs) ...@@ -195,27 +195,20 @@ ix1_reset(struct IsdnCardState *cs)
HZDELAY(1); /* wait >=10 ms */ HZDELAY(1); /* wait >=10 ms */
} }
byteout(cs->hw.ix1.cfg_reg + SPECIAL_PORT_OFFSET, 0); byteout(cs->hw.ix1.cfg_reg + SPECIAL_PORT_OFFSET, 0);
return 0;
} }
static int static int
ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg) ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
ix1_reset(cs);
return(0);
case CARD_RELEASE:
release_io_ix1micro(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops ix1_ops = { static struct card_ops ix1_ops = {
.init = inithscxisac, .init = inithscxisac,
.irq_func = ix1micro_interrupt, .reset = ix1_reset,
.release = ix1_release,
.irq_func = ix1_interrupt,
}; };
#ifdef __ISAPNP__ #ifdef __ISAPNP__
...@@ -314,7 +307,7 @@ setup_ix1micro(struct IsdnCard *card) ...@@ -314,7 +307,7 @@ setup_ix1micro(struct IsdnCard *card)
if (HscxVersion(cs, "ix1-Micro:")) { if (HscxVersion(cs, "ix1-Micro:")) {
printk(KERN_WARNING printk(KERN_WARNING
"ix1-Micro: wrong HSCX versions check IO address\n"); "ix1-Micro: wrong HSCX versions check IO address\n");
release_io_ix1micro(cs); ix1_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -168,32 +168,22 @@ mic_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -168,32 +168,22 @@ mic_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
void static void
release_io_mic(struct IsdnCardState *cs) mic_release(struct IsdnCardState *cs)
{ {
int bytecnt = 8;
if (cs->hw.mic.cfg_reg) if (cs->hw.mic.cfg_reg)
release_region(cs->hw.mic.cfg_reg, bytecnt); release_region(cs->hw.mic.cfg_reg, 8);
} }
static int static int
mic_card_msg(struct IsdnCardState *cs, int mt, void *arg) mic_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
return(0);
case CARD_RELEASE:
release_io_mic(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops mic_ops = { static struct card_ops mic_ops = {
.init = inithscxisac, .init = inithscxisac,
.release = mic_release,
.irq_func = mic_interrupt, .irq_func = mic_interrupt,
}; };
...@@ -237,7 +227,7 @@ setup_mic(struct IsdnCard *card) ...@@ -237,7 +227,7 @@ setup_mic(struct IsdnCard *card)
if (HscxVersion(cs, "mic:")) { if (HscxVersion(cs, "mic:")) {
printk(KERN_WARNING printk(KERN_WARNING
"mic: wrong HSCX versions check IO address\n"); "mic: wrong HSCX versions check IO address\n");
release_io_mic(cs); mic_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -998,7 +998,7 @@ inittiger(struct IsdnCardState *cs) ...@@ -998,7 +998,7 @@ inittiger(struct IsdnCardState *cs)
cs->hw.njet.last_is0 = 0; cs->hw.njet.last_is0 = 0;
} }
void static void
releasetiger(struct IsdnCardState *cs) releasetiger(struct IsdnCardState *cs)
{ {
if (cs->bcs[0].hw.tiger.send) { if (cs->bcs[0].hw.tiger.send) {
...@@ -1024,7 +1024,7 @@ releasetiger(struct IsdnCardState *cs) ...@@ -1024,7 +1024,7 @@ releasetiger(struct IsdnCardState *cs)
} }
void void
release_io_netjet(struct IsdnCardState *cs) netjet_release(struct IsdnCardState *cs)
{ {
byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0); byteout(cs->hw.njet.base + NETJET_IRQMASK0, 0);
byteout(cs->hw.njet.base + NETJET_IRQMASK1, 0); byteout(cs->hw.njet.base + NETJET_IRQMASK1, 0);
......
...@@ -70,5 +70,5 @@ void write_tiger(struct IsdnCardState *cs); ...@@ -70,5 +70,5 @@ void write_tiger(struct IsdnCardState *cs);
void netjet_fill_dma(struct BCState *bcs); void netjet_fill_dma(struct BCState *bcs);
void netjet_interrupt(int intno, void *dev_id, struct pt_regs *regs); void netjet_interrupt(int intno, void *dev_id, struct pt_regs *regs);
void inittiger(struct IsdnCardState *cs); void inittiger(struct IsdnCardState *cs);
void release_io_netjet(struct IsdnCardState *cs); void netjet_release(struct IsdnCardState *cs);
...@@ -195,7 +195,7 @@ niccy_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -195,7 +195,7 @@ niccy_interrupt(int intno, void *dev_id, struct pt_regs *regs)
} }
void void
release_io_niccy(struct IsdnCardState *cs) niccy_release(struct IsdnCardState *cs)
{ {
if (cs->subtyp == NICCY_PCI) { if (cs->subtyp == NICCY_PCI) {
int val; int val;
...@@ -211,7 +211,7 @@ release_io_niccy(struct IsdnCardState *cs) ...@@ -211,7 +211,7 @@ release_io_niccy(struct IsdnCardState *cs)
} }
} }
static void static int
niccy_reset(struct IsdnCardState *cs) niccy_reset(struct IsdnCardState *cs)
{ {
if (cs->subtyp == NICCY_PCI) { if (cs->subtyp == NICCY_PCI) {
...@@ -221,27 +221,19 @@ niccy_reset(struct IsdnCardState *cs) ...@@ -221,27 +221,19 @@ niccy_reset(struct IsdnCardState *cs)
val |= PCI_IRQ_ENABLE; val |= PCI_IRQ_ENABLE;
outl(val, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG); outl(val, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
} }
inithscxisac(cs); return 0;
} }
static int static int
niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg) niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
niccy_reset(cs);
return(0);
case CARD_RELEASE:
release_io_niccy(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops niccy_ops = { static struct card_ops niccy_ops = {
.init = niccy_reset, .init = inithscxisac,
.reset = niccy_reset,
.release = niccy_release,
.irq_func = niccy_interrupt, .irq_func = niccy_interrupt,
}; };
...@@ -391,7 +383,7 @@ setup_niccy(struct IsdnCard *card) ...@@ -391,7 +383,7 @@ setup_niccy(struct IsdnCard *card)
if (HscxVersion(cs, "Niccy:")) { if (HscxVersion(cs, "Niccy:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Niccy: wrong HSCX versions check IO address\n"); "Niccy: wrong HSCX versions check IO address\n");
release_io_niccy(cs); niccy_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -72,8 +72,8 @@ nj_s_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -72,8 +72,8 @@ nj_s_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
static void static int
reset_netjet_s(struct IsdnCardState *cs) nj_s_reset(struct IsdnCardState *cs)
{ {
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
...@@ -89,21 +89,12 @@ reset_netjet_s(struct IsdnCardState *cs) ...@@ -89,21 +89,12 @@ reset_netjet_s(struct IsdnCardState *cs)
byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ);
byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ);
byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
return 0;
} }
static int static int
NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg) NETjet_S_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_netjet_s(cs);
return(0);
case CARD_RELEASE:
release_io_netjet(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -116,6 +107,8 @@ nj_s_init(struct IsdnCardState *cs) ...@@ -116,6 +107,8 @@ nj_s_init(struct IsdnCardState *cs)
static struct card_ops nj_s_ops = { static struct card_ops nj_s_ops = {
.init = nj_s_init, .init = nj_s_init,
.reset = nj_s_reset,
.release = netjet_release,
.irq_func = nj_s_interrupt, .irq_func = nj_s_interrupt,
}; };
...@@ -233,7 +226,7 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -233,7 +226,7 @@ setup_netjet_s(struct IsdnCard *card)
} else { } else {
request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn"); request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn");
} }
reset_netjet_s(cs); nj_s_reset(cs);
cs->dc_hw_ops = &netjet_dc_ops; cs->dc_hw_ops = &netjet_dc_ops;
cs->cardmsg = &NETjet_S_card_msg; cs->cardmsg = &NETjet_S_card_msg;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
......
...@@ -72,8 +72,8 @@ nj_u_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -72,8 +72,8 @@ nj_u_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
static void static int
reset_netjet_u(struct IsdnCardState *cs) nj_u_reset(struct IsdnCardState *cs)
{ {
cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ cs->hw.njet.ctrl_reg = 0xff; /* Reset On */
byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
...@@ -91,21 +91,12 @@ reset_netjet_u(struct IsdnCardState *cs) ...@@ -91,21 +91,12 @@ reset_netjet_u(struct IsdnCardState *cs)
byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ);
byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ);
byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
return 0;
} }
static int static int
NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg) NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_netjet_u(cs);
return(0);
case CARD_RELEASE:
release_io_netjet(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -120,6 +111,8 @@ nj_u_init(struct IsdnCardState *cs) ...@@ -120,6 +111,8 @@ nj_u_init(struct IsdnCardState *cs)
static struct card_ops nj_u_ops = { static struct card_ops nj_u_ops = {
.init = nj_u_init, .init = nj_u_init,
.reset = nj_u_reset,
.release = netjet_release,
.irq_func = nj_u_interrupt, .irq_func = nj_u_interrupt,
}; };
...@@ -229,7 +222,7 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -229,7 +222,7 @@ setup_netjet_u(struct IsdnCard *card)
cs->hw.njet.base + bytecnt); cs->hw.njet.base + bytecnt);
return (0); return (0);
} }
reset_netjet_u(cs); nj_u_reset(cs);
cs->dc_hw_ops = &netjet_dc_ops; cs->dc_hw_ops = &netjet_dc_ops;
cs->cardmsg = &NETjet_U_card_msg; cs->cardmsg = &NETjet_U_card_msg;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
......
...@@ -208,7 +208,7 @@ s0box_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -208,7 +208,7 @@ s0box_interrupt(int intno, void *dev_id, struct pt_regs *regs)
} }
void void
release_io_s0box(struct IsdnCardState *cs) s0box_release(struct IsdnCardState *cs)
{ {
release_region(cs->hw.teles3.cfg_reg, 8); release_region(cs->hw.teles3.cfg_reg, 8);
} }
...@@ -216,20 +216,12 @@ release_io_s0box(struct IsdnCardState *cs) ...@@ -216,20 +216,12 @@ release_io_s0box(struct IsdnCardState *cs)
static int static int
S0Box_card_msg(struct IsdnCardState *cs, int mt, void *arg) S0Box_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
break;
case CARD_RELEASE:
release_io_s0box(cs);
break;
case CARD_TEST:
break;
}
return(0); return(0);
} }
static struct card_ops s0box_ops = { static struct card_ops s0box_ops = {
.init = inithscxisac, .init = inithscxisac,
.release = s0box_release,
.irq_func = s0box_interrupt, .irq_func = s0box_interrupt,
}; };
...@@ -275,7 +267,7 @@ setup_s0box(struct IsdnCard *card) ...@@ -275,7 +267,7 @@ setup_s0box(struct IsdnCard *card)
if (HscxVersion(cs, "S0Box:")) { if (HscxVersion(cs, "S0Box:")) {
printk(KERN_WARNING printk(KERN_WARNING
"S0Box: wrong HSCX versions check IO address\n"); "S0Box: wrong HSCX versions check IO address\n");
release_io_s0box(cs); s0box_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -182,8 +182,8 @@ SaphirWatchDog(struct IsdnCardState *cs) ...@@ -182,8 +182,8 @@ SaphirWatchDog(struct IsdnCardState *cs)
mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ); mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ);
} }
void static void
release_io_saphir(struct IsdnCardState *cs) saphir_release(struct IsdnCardState *cs)
{ {
byteout(cs->hw.saphir.cfg_reg + IRQ_REG, 0xff); byteout(cs->hw.saphir.cfg_reg + IRQ_REG, 0xff);
del_timer_sync(&cs->hw.saphir.timer); del_timer_sync(&cs->hw.saphir.timer);
...@@ -231,21 +231,13 @@ saphir_reset(struct IsdnCardState *cs) ...@@ -231,21 +231,13 @@ saphir_reset(struct IsdnCardState *cs)
static int static int
saphir_card_msg(struct IsdnCardState *cs, int mt, void *arg) saphir_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
saphir_reset(cs);
return(0);
case CARD_RELEASE:
release_io_saphir(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops saphir_ops = { static struct card_ops saphir_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = saphir_reset,
.release = saphir_release,
.irq_func = saphir_interrupt, .irq_func = saphir_interrupt,
}; };
...@@ -286,7 +278,7 @@ setup_saphir(struct IsdnCard *card) ...@@ -286,7 +278,7 @@ setup_saphir(struct IsdnCard *card)
cs->hw.saphir.timer.expires = jiffies + 4*HZ; cs->hw.saphir.timer.expires = jiffies + 4*HZ;
add_timer(&cs->hw.saphir.timer); add_timer(&cs->hw.saphir.timer);
if (saphir_reset(cs)) { if (saphir_reset(cs)) {
release_io_saphir(cs); saphir_release(cs);
return (0); return (0);
} }
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
...@@ -297,7 +289,7 @@ setup_saphir(struct IsdnCard *card) ...@@ -297,7 +289,7 @@ setup_saphir(struct IsdnCard *card)
if (HscxVersion(cs, "saphir:")) { if (HscxVersion(cs, "saphir:")) {
printk(KERN_WARNING printk(KERN_WARNING
"saphir: wrong HSCX versions check IO address\n"); "saphir: wrong HSCX versions check IO address\n");
release_io_saphir(cs); saphir_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -417,8 +417,61 @@ sedlbauer_isar_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -417,8 +417,61 @@ sedlbauer_isar_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
void static int
release_io_sedlbauer(struct IsdnCardState *cs) sedlbauer_ipac_reset(struct IsdnCardState *cs)
{
writereg(cs, cs->hw.sedl.isac, IPAC_POTA2, 0x20);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writereg(cs, cs->hw.sedl.isac, IPAC_POTA2, 0x0);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writereg(cs, cs->hw.sedl.isac, IPAC_CONF, 0x0);
writereg(cs, cs->hw.sedl.isac, IPAC_ACFG, 0xff);
writereg(cs, cs->hw.sedl.isac, IPAC_AOE, 0x0);
writereg(cs, cs->hw.sedl.isac, IPAC_MASK, 0xc0);
writereg(cs, cs->hw.sedl.isac, IPAC_PCFG, 0x12);
return 0;
}
static int
sedlbauer_isar_pci_reset(struct IsdnCardState *cs)
{
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout((20*HZ)/1000);
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout((20*HZ)/1000);
return 0;
}
static int
sedlbauer_reset(struct IsdnCardState *cs)
{
printk(KERN_INFO "Sedlbauer: resetting card\n");
if (cs->hw.sedl.bus == SEDL_BUS_PCMCIA &&
cs->hw.sedl.chip == SEDL_CHIP_ISAC_HSCX)
return 0;
if (cs->hw.sedl.chip == SEDL_CHIP_IPAC) {
return sedlbauer_ipac_reset(cs);
} else if ((cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) &&
(cs->hw.sedl.bus == SEDL_BUS_PCI)) {
return sedlbauer_isar_pci_reset(cs);
} else {
byteout(cs->hw.sedl.reset_on, SEDL_RESET); /* Reset On */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
byteout(cs->hw.sedl.reset_off, 0); /* Reset Off */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
}
return 0;
}
static void
sedlbauer_release(struct IsdnCardState *cs)
{ {
int bytecnt = 8; int bytecnt = 8;
...@@ -432,62 +485,20 @@ release_io_sedlbauer(struct IsdnCardState *cs) ...@@ -432,62 +485,20 @@ release_io_sedlbauer(struct IsdnCardState *cs)
} }
static void static void
reset_sedlbauer(struct IsdnCardState *cs) sedlbauer_isar_release(struct IsdnCardState *cs)
{ {
printk(KERN_INFO "Sedlbauer: resetting card\n"); isar_write(cs, 0, ISAR_IRQBIT, 0);
isac_write(cs, ISAC_MASK, 0xFF);
if (!((cs->hw.sedl.bus == SEDL_BUS_PCMCIA) && sedlbauer_reset(cs);
(cs->hw.sedl.chip == SEDL_CHIP_ISAC_HSCX))) { isar_write(cs, 0, ISAR_IRQBIT, 0);
if (cs->hw.sedl.chip == SEDL_CHIP_IPAC) { isac_write(cs, ISAC_MASK, 0xFF);
writereg(cs, cs->hw.sedl.isac, IPAC_POTA2, 0x20); sedlbauer_release(cs);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writereg(cs, cs->hw.sedl.isac, IPAC_POTA2, 0x0);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
writereg(cs, cs->hw.sedl.isac, IPAC_CONF, 0x0);
writereg(cs, cs->hw.sedl.isac, IPAC_ACFG, 0xff);
writereg(cs, cs->hw.sedl.isac, IPAC_AOE, 0x0);
writereg(cs, cs->hw.sedl.isac, IPAC_MASK, 0xc0);
writereg(cs, cs->hw.sedl.isac, IPAC_PCFG, 0x12);
} else if ((cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) &&
(cs->hw.sedl.bus == SEDL_BUS_PCI)) {
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout((20*HZ)/1000);
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
current->state = TASK_UNINTERRUPTIBLE;
schedule_timeout((20*HZ)/1000);
} else {
byteout(cs->hw.sedl.reset_on, SEDL_RESET); /* Reset On */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
byteout(cs->hw.sedl.reset_off, 0); /* Reset Off */
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
}
}
} }
static int static int
Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg) Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) { switch (mt) {
case CARD_RESET:
reset_sedlbauer(cs);
return(0);
case CARD_RELEASE:
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
isar_write(cs, 0, ISAR_IRQBIT, 0);
isac_write(cs, ISAC_MASK, 0xFF);
reset_sedlbauer(cs);
isar_write(cs, 0, ISAR_IRQBIT, 0);
isac_write(cs, ISAC_MASK, 0xFF);
}
release_io_sedlbauer(cs);
return(0);
case CARD_TEST:
return(0);
case MDL_INFO_CONN: case MDL_INFO_CONN:
if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID) if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
return(0); return(0);
...@@ -520,16 +531,22 @@ sedlbauer_isar_init(struct IsdnCardState *cs) ...@@ -520,16 +531,22 @@ sedlbauer_isar_init(struct IsdnCardState *cs)
static struct card_ops sedlbauer_ops = { static struct card_ops sedlbauer_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = sedlbauer_reset,
.release = sedlbauer_release,
.irq_func = sedlbauer_interrupt, .irq_func = sedlbauer_interrupt,
}; };
static struct card_ops sedlbauer_ipac_ops = { static struct card_ops sedlbauer_ipac_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = sedlbauer_reset,
.release = sedlbauer_release,
.irq_func = sedlbauer_ipac_interrupt, .irq_func = sedlbauer_ipac_interrupt,
}; };
static struct card_ops sedlbauer_isar_ops = { static struct card_ops sedlbauer_isar_ops = {
.init = sedlbauer_isar_init, .init = sedlbauer_isar_init,
.reset = sedlbauer_reset,
.release = sedlbauer_isar_release,
.irq_func = sedlbauer_isar_interrupt, .irq_func = sedlbauer_isar_interrupt,
}; };
...@@ -769,7 +786,7 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -769,7 +786,7 @@ setup_sedlbauer(struct IsdnCard *card)
val = readreg(cs, cs->hw.sedl.isac, IPAC_ID); val = readreg(cs, cs->hw.sedl.isac, IPAC_ID);
printk(KERN_INFO "Sedlbauer: IPAC version %x\n", val); printk(KERN_INFO "Sedlbauer: IPAC version %x\n", val);
reset_sedlbauer(cs); sedlbauer_reset(cs);
} else { } else {
/* ISAC_HSCX oder ISAC_ISAR */ /* ISAC_HSCX oder ISAC_ISAR */
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
...@@ -804,7 +821,7 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -804,7 +821,7 @@ setup_sedlbauer(struct IsdnCard *card)
if (ver < 0) { if (ver < 0) {
printk(KERN_WARNING printk(KERN_WARNING
"Sedlbauer: wrong ISAR version (ret = %d)\n", ver); "Sedlbauer: wrong ISAR version (ret = %d)\n", ver);
release_io_sedlbauer(cs); sedlbauer_release(cs);
return (0); return (0);
} }
} else { } else {
...@@ -827,10 +844,10 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -827,10 +844,10 @@ setup_sedlbauer(struct IsdnCard *card)
if (HscxVersion(cs, "Sedlbauer:")) { if (HscxVersion(cs, "Sedlbauer:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Sedlbauer: wrong HSCX versions check IO address\n"); "Sedlbauer: wrong HSCX versions check IO address\n");
release_io_sedlbauer(cs); sedlbauer_release(cs);
return (0); return (0);
} }
reset_sedlbauer(cs); sedlbauer_reset(cs);
} }
} }
return (1); return (1);
......
...@@ -143,8 +143,8 @@ sportster_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -143,8 +143,8 @@ sportster_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
void static void
release_io_sportster(struct IsdnCardState *cs) sportster_release(struct IsdnCardState *cs)
{ {
int i, adr; int i, adr;
...@@ -155,8 +155,8 @@ release_io_sportster(struct IsdnCardState *cs) ...@@ -155,8 +155,8 @@ release_io_sportster(struct IsdnCardState *cs)
} }
} }
void static int
reset_sportster(struct IsdnCardState *cs) sportster_reset(struct IsdnCardState *cs)
{ {
cs->hw.spt.res_irq |= SPORTSTER_RESET; /* Reset On */ cs->hw.spt.res_irq |= SPORTSTER_RESET; /* Reset On */
byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq); byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq);
...@@ -166,21 +166,12 @@ reset_sportster(struct IsdnCardState *cs) ...@@ -166,21 +166,12 @@ reset_sportster(struct IsdnCardState *cs)
byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq); byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq);
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); schedule_timeout((10*HZ)/1000);
return 0;
} }
static int static int
Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg) Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_sportster(cs);
return(0);
case CARD_RELEASE:
release_io_sportster(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -194,6 +185,8 @@ sportster_init(struct IsdnCardState *cs) ...@@ -194,6 +185,8 @@ sportster_init(struct IsdnCardState *cs)
static struct card_ops sportster_ops = { static struct card_ops sportster_ops = {
.init = sportster_init, .init = sportster_init,
.reset = sportster_reset,
.release = sportster_release,
.irq_func = sportster_interrupt, .irq_func = sportster_interrupt,
}; };
...@@ -256,11 +249,11 @@ setup_sportster(struct IsdnCard *card) ...@@ -256,11 +249,11 @@ setup_sportster(struct IsdnCard *card)
break; break;
case 15:cs->hw.spt.res_irq = 7; case 15:cs->hw.spt.res_irq = 7;
break; break;
default:release_io_sportster(cs); default:sportster_release(cs);
printk(KERN_WARNING "Sportster: wrong IRQ\n"); printk(KERN_WARNING "Sportster: wrong IRQ\n");
return(0); return(0);
} }
reset_sportster(cs); sportster_reset(cs);
printk(KERN_INFO printk(KERN_INFO
"HiSax: %s config irq:%d cfg:0x%X\n", "HiSax: %s config irq:%d cfg:0x%X\n",
CardType[cs->typ], cs->irq, CardType[cs->typ], cs->irq,
...@@ -274,7 +267,7 @@ setup_sportster(struct IsdnCard *card) ...@@ -274,7 +267,7 @@ setup_sportster(struct IsdnCard *card)
if (HscxVersion(cs, "Sportster:")) { if (HscxVersion(cs, "Sportster:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Sportster: wrong HSCX versions check IO address\n"); "Sportster: wrong HSCX versions check IO address\n");
release_io_sportster(cs); sportster_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -217,8 +217,8 @@ TeleInt_Timer(struct IsdnCardState *cs) ...@@ -217,8 +217,8 @@ TeleInt_Timer(struct IsdnCardState *cs)
add_timer(&cs->hw.hfc.timer); add_timer(&cs->hw.hfc.timer);
} }
void static void
release_io_TeleInt(struct IsdnCardState *cs) teleint_release(struct IsdnCardState *cs)
{ {
del_timer(&cs->hw.hfc.timer); del_timer(&cs->hw.hfc.timer);
releasehfc(cs); releasehfc(cs);
...@@ -226,8 +226,8 @@ release_io_TeleInt(struct IsdnCardState *cs) ...@@ -226,8 +226,8 @@ release_io_TeleInt(struct IsdnCardState *cs)
release_region(cs->hw.hfc.addr, 2); release_region(cs->hw.hfc.addr, 2);
} }
static void static int
reset_TeleInt(struct IsdnCardState *cs) teleint_reset(struct IsdnCardState *cs)
{ {
printk(KERN_INFO "TeleInt: resetting card\n"); printk(KERN_INFO "TeleInt: resetting card\n");
cs->hw.hfc.cirm |= HFC_RESET; cs->hw.hfc.cirm |= HFC_RESET;
...@@ -238,21 +238,12 @@ reset_TeleInt(struct IsdnCardState *cs) ...@@ -238,21 +238,12 @@ reset_TeleInt(struct IsdnCardState *cs)
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm); /* Reset Off */ byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm); /* Reset Off */
set_current_state(TASK_UNINTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); schedule_timeout((10*HZ)/1000);
return 0;
} }
static int static int
TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg) TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_TeleInt(cs);
return(0);
case CARD_RELEASE:
release_io_TeleInt(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
...@@ -267,6 +258,8 @@ teleint_init(struct IsdnCardState *cs) ...@@ -267,6 +258,8 @@ teleint_init(struct IsdnCardState *cs)
static struct card_ops teleint_ops = { static struct card_ops teleint_ops = {
.init = teleint_init, .init = teleint_init,
.reset = teleint_reset,
.release = teleint_release,
.irq_func = teleint_interrupt, .irq_func = teleint_interrupt,
}; };
...@@ -327,7 +320,7 @@ setup_TeleInt(struct IsdnCard *card) ...@@ -327,7 +320,7 @@ setup_TeleInt(struct IsdnCard *card)
break; break;
default: default:
printk(KERN_WARNING "TeleInt: wrong IRQ\n"); printk(KERN_WARNING "TeleInt: wrong IRQ\n");
release_io_TeleInt(cs); teleint_release(cs);
return (0); return (0);
} }
byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm); byteout(cs->hw.hfc.addr | 1, cs->hw.hfc.cirm);
...@@ -338,7 +331,7 @@ setup_TeleInt(struct IsdnCard *card) ...@@ -338,7 +331,7 @@ setup_TeleInt(struct IsdnCard *card)
cs->hw.hfc.addr, cs->hw.hfc.addr,
cs->irq); cs->irq);
reset_TeleInt(cs); teleint_reset(cs);
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hfc_ops; cs->bc_hw_ops = &hfc_ops;
cs->cardmsg = &TeleInt_card_msg; cs->cardmsg = &TeleInt_card_msg;
......
...@@ -148,8 +148,8 @@ teles0_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -148,8 +148,8 @@ teles0_interrupt(int intno, void *dev_id, struct pt_regs *regs)
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
void static void
release_io_teles0(struct IsdnCardState *cs) teles0_release(struct IsdnCardState *cs)
{ {
if (cs->hw.teles0.cfg_reg) if (cs->hw.teles0.cfg_reg)
release_region(cs->hw.teles0.cfg_reg, 8); release_region(cs->hw.teles0.cfg_reg, 8);
...@@ -158,7 +158,7 @@ release_io_teles0(struct IsdnCardState *cs) ...@@ -158,7 +158,7 @@ release_io_teles0(struct IsdnCardState *cs)
} }
static int static int
reset_teles0(struct IsdnCardState *cs) teles0_reset(struct IsdnCardState *cs)
{ {
u8 cfval; u8 cfval;
...@@ -208,21 +208,13 @@ reset_teles0(struct IsdnCardState *cs) ...@@ -208,21 +208,13 @@ reset_teles0(struct IsdnCardState *cs)
static int static int
Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg) Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_teles0(cs);
return(0);
case CARD_RELEASE:
release_io_teles0(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops teles0_ops = { static struct card_ops teles0_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = teles0_reset,
.release = teles0_release,
.irq_func = teles0_interrupt, .irq_func = teles0_interrupt,
}; };
...@@ -306,9 +298,9 @@ setup_teles0(struct IsdnCard *card) ...@@ -306,9 +298,9 @@ setup_teles0(struct IsdnCard *card)
"HiSax: %s config irq:%d mem:0x%lX cfg:0x%X\n", "HiSax: %s config irq:%d mem:0x%lX cfg:0x%X\n",
CardType[cs->typ], cs->irq, CardType[cs->typ], cs->irq,
cs->hw.teles0.membase, cs->hw.teles0.cfg_reg); cs->hw.teles0.membase, cs->hw.teles0.cfg_reg);
if (reset_teles0(cs)) { if (teles0_reset(cs)) {
printk(KERN_WARNING "Teles0: wrong IRQ\n"); printk(KERN_WARNING "Teles0: wrong IRQ\n");
release_io_teles0(cs); teles0_release(cs);
return (0); return (0);
} }
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
...@@ -319,7 +311,7 @@ setup_teles0(struct IsdnCard *card) ...@@ -319,7 +311,7 @@ setup_teles0(struct IsdnCard *card)
if (HscxVersion(cs, "Teles0:")) { if (HscxVersion(cs, "Teles0:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Teles0: wrong HSCX versions check IO/MEM addresses\n"); "Teles0: wrong HSCX versions check IO/MEM addresses\n");
release_io_teles0(cs); teles0_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -165,8 +165,8 @@ release_ioregs(struct IsdnCardState *cs, int mask) ...@@ -165,8 +165,8 @@ release_ioregs(struct IsdnCardState *cs, int mask)
release_region(cs->hw.teles3.hscx[1] + 32, 32); release_region(cs->hw.teles3.hscx[1] + 32, 32);
} }
void static void
release_io_teles3(struct IsdnCardState *cs) teles3_release(struct IsdnCardState *cs)
{ {
if (cs->typ == ISDN_CTYPE_TELESPCMCIA) { if (cs->typ == ISDN_CTYPE_TELESPCMCIA) {
release_region(cs->hw.teles3.hscx[1], 96); release_region(cs->hw.teles3.hscx[1], 96);
...@@ -183,7 +183,7 @@ release_io_teles3(struct IsdnCardState *cs) ...@@ -183,7 +183,7 @@ release_io_teles3(struct IsdnCardState *cs)
} }
static int static int
reset_teles3(struct IsdnCardState *cs) teles3_reset(struct IsdnCardState *cs)
{ {
u8 irqcfg; u8 irqcfg;
...@@ -241,21 +241,13 @@ reset_teles3(struct IsdnCardState *cs) ...@@ -241,21 +241,13 @@ reset_teles3(struct IsdnCardState *cs)
static int static int
Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg) Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
reset_teles3(cs);
return(0);
case CARD_RELEASE:
release_io_teles3(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops teles3_ops = { static struct card_ops teles3_ops = {
.init = inithscxisac, .init = inithscxisac,
.reset = teles3_reset,
.release = teles3_release,
.irq_func = teles3_interrupt, .irq_func = teles3_interrupt,
}; };
...@@ -445,13 +437,13 @@ setup_teles3(struct IsdnCard *card) ...@@ -445,13 +437,13 @@ setup_teles3(struct IsdnCard *card)
if ((val = bytein(cs->hw.teles3.cfg_reg + 0)) != 0x51) { if ((val = bytein(cs->hw.teles3.cfg_reg + 0)) != 0x51) {
printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n", printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
cs->hw.teles3.cfg_reg + 0, val); cs->hw.teles3.cfg_reg + 0, val);
release_io_teles3(cs); teles3_release(cs);
return (0); return (0);
} }
if ((val = bytein(cs->hw.teles3.cfg_reg + 1)) != 0x93) { if ((val = bytein(cs->hw.teles3.cfg_reg + 1)) != 0x93) {
printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n", printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
cs->hw.teles3.cfg_reg + 1, val); cs->hw.teles3.cfg_reg + 1, val);
release_io_teles3(cs); teles3_release(cs);
return (0); return (0);
} }
val = bytein(cs->hw.teles3.cfg_reg + 2);/* 0x1e=without AB val = bytein(cs->hw.teles3.cfg_reg + 2);/* 0x1e=without AB
...@@ -464,7 +456,7 @@ setup_teles3(struct IsdnCard *card) ...@@ -464,7 +456,7 @@ setup_teles3(struct IsdnCard *card)
if (val != 0x46 && val != 0x39 && val != 0x38 && val != 0x1c && val != 0x1e && val != 0x1f) { if (val != 0x46 && val != 0x39 && val != 0x38 && val != 0x1c && val != 0x1e && val != 0x1f) {
printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n", printk(KERN_WARNING "Teles: 16.3 Byte at %x is %x\n",
cs->hw.teles3.cfg_reg + 2, val); cs->hw.teles3.cfg_reg + 2, val);
release_io_teles3(cs); teles3_release(cs);
return (0); return (0);
} }
} }
...@@ -476,9 +468,9 @@ setup_teles3(struct IsdnCard *card) ...@@ -476,9 +468,9 @@ setup_teles3(struct IsdnCard *card)
"HiSax: hscx A:0x%X hscx B:0x%X\n", "HiSax: hscx A:0x%X hscx B:0x%X\n",
cs->hw.teles3.hscx[0] + 32, cs->hw.teles3.hscx[1] + 32); cs->hw.teles3.hscx[0] + 32, cs->hw.teles3.hscx[1] + 32);
if (reset_teles3(cs)) { if (teles3_reset(cs)) {
printk(KERN_WARNING "Teles3: wrong IRQ\n"); printk(KERN_WARNING "Teles3: wrong IRQ\n");
release_io_teles3(cs); teles3_release(cs);
return (0); return (0);
} }
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
...@@ -489,7 +481,7 @@ setup_teles3(struct IsdnCard *card) ...@@ -489,7 +481,7 @@ setup_teles3(struct IsdnCard *card)
if (HscxVersion(cs, "Teles3:")) { if (HscxVersion(cs, "Teles3:")) {
printk(KERN_WARNING printk(KERN_WARNING
"Teles3: wrong HSCX versions check IO address\n"); "Teles3: wrong HSCX versions check IO address\n");
release_io_teles3(cs); teles3_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -226,7 +226,7 @@ telespci_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -226,7 +226,7 @@ telespci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
} }
void void
release_io_telespci(struct IsdnCardState *cs) telespci_release(struct IsdnCardState *cs)
{ {
iounmap((void *)cs->hw.teles0.membase); iounmap((void *)cs->hw.teles0.membase);
} }
...@@ -234,20 +234,12 @@ release_io_telespci(struct IsdnCardState *cs) ...@@ -234,20 +234,12 @@ release_io_telespci(struct IsdnCardState *cs)
static int static int
TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg) TelesPCI_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
return(0);
case CARD_RELEASE:
release_io_telespci(cs);
return(0);
case CARD_TEST:
return(0);
}
return(0); return(0);
} }
static struct card_ops telespci_ops = { static struct card_ops telespci_ops = {
.init = inithscxisac, .init = inithscxisac,
.release = telespci_release,
.irq_func = telespci_interrupt, .irq_func = telespci_interrupt,
}; };
...@@ -316,7 +308,7 @@ setup_telespci(struct IsdnCard *card) ...@@ -316,7 +308,7 @@ setup_telespci(struct IsdnCard *card)
if (HscxVersion(cs, "TelesPCI:")) { if (HscxVersion(cs, "TelesPCI:")) {
printk(KERN_WARNING printk(KERN_WARNING
"TelesPCI: wrong HSCX versions check IO/MEM addresses\n"); "TelesPCI: wrong HSCX versions check IO/MEM addresses\n");
release_io_telespci(cs); telespci_release(cs);
return (0); return (0);
} }
return (1); return (1);
......
...@@ -593,7 +593,8 @@ setstack_w6692(struct PStack *st, struct BCState *bcs) ...@@ -593,7 +593,8 @@ setstack_w6692(struct PStack *st, struct BCState *bcs)
return (0); return (0);
} }
void resetW6692(struct IsdnCardState *cs) static int
w6692_reset(struct IsdnCardState *cs)
{ {
w6692_write_reg(cs, W_D_CTL, W_D_CTL_SRST); w6692_write_reg(cs, W_D_CTL, W_D_CTL_SRST);
schedule_timeout((10*HZ)/1000); schedule_timeout((10*HZ)/1000);
...@@ -613,9 +614,10 @@ void resetW6692(struct IsdnCardState *cs) ...@@ -613,9 +614,10 @@ void resetW6692(struct IsdnCardState *cs)
w6692_write_reg(cs, W_PCTL, 0x80); w6692_write_reg(cs, W_PCTL, 0x80);
w6692_write_reg(cs, W_XDATA, 0x00); w6692_write_reg(cs, W_XDATA, 0x00);
} }
return 0;
} }
void __init static void
w6692_init(struct IsdnCardState *cs) w6692_init(struct IsdnCardState *cs)
{ {
INIT_WORK(&cs->work, W6692_bh, cs); INIT_WORK(&cs->work, W6692_bh, cs);
...@@ -624,7 +626,7 @@ w6692_init(struct IsdnCardState *cs) ...@@ -624,7 +626,7 @@ w6692_init(struct IsdnCardState *cs)
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); w6692_reset(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);
...@@ -642,28 +644,26 @@ w6692_init(struct IsdnCardState *cs) ...@@ -642,28 +644,26 @@ w6692_init(struct IsdnCardState *cs)
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 void
w6692_release(struct IsdnCardState *cs)
{
w6692_write_reg(cs, W_IMASK, 0xff);
release_region(cs->hw.w6692.iobase, 256);
if (cs->subtyp == W6692_USR)
w6692_write_reg(cs, W_XDATA, 0x04);
}
static int static int
w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg) w6692_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{ {
switch (mt) {
case CARD_RESET:
resetW6692(cs);
return (0);
case CARD_RELEASE:
w6692_write_reg(cs, W_IMASK, 0xff);
release_region(cs->hw.w6692.iobase, 256);
if (cs->subtyp == W6692_USR) {
w6692_write_reg(cs, W_XDATA, 0x04);
}
return (0);
case CARD_TEST:
return (0);
}
return (0); return (0);
} }
static struct card_ops w6692_ops = { static struct card_ops w6692_ops = {
.init = w6692_init, .init = w6692_init,
.reset = w6692_reset,
.release = w6692_release,
.irq_func = w6692_interrupt, .irq_func = w6692_interrupt,
}; };
......
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