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