Commit b362b375 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Unify LED handling

Share the code to display line status via LEDs and get rid of the
remaining ->cardmsg() users.
parent e4c8bb11
...@@ -205,24 +205,39 @@ lli_deliver_cause(struct Channel *chanp) ...@@ -205,24 +205,39 @@ lli_deliver_cause(struct Channel *chanp)
} }
static inline void static inline void
mdl_info_rel(struct Channel *chanp) mdl_info_setup(struct Channel *chanp)
{ {
if (chanp->cs->cardmsg) if (chanp->chan)
chanp->cs->cardmsg(chanp->cs, MDL_INFO_REL, (void *) (long)chanp->chan); chanp->cs->status |= 0x0200;
else
chanp->cs->status |= 0x0100;
if (chanp->cs->card_ops->led_handler)
chanp->cs->card_ops->led_handler(chanp->cs);
} }
static inline void static inline void
mdl_info_setup(struct Channel *chanp) mdl_info_connect(struct Channel *chanp)
{ {
if (chanp->cs->cardmsg) if (chanp->chan)
chanp->cs->cardmsg(chanp->cs, MDL_INFO_SETUP, (void *) (long)chanp->chan); chanp->cs->status |= 0x2000;
else
chanp->cs->status |= 0x1000;
if (chanp->cs->card_ops->led_handler)
chanp->cs->card_ops->led_handler(chanp->cs);
} }
static inline void static inline void
mdl_info_conn(struct Channel *chanp) mdl_info_release(struct Channel *chanp)
{ {
if (chanp->cs->cardmsg) if (chanp->chan)
chanp->cs->cardmsg(chanp->cs, MDL_INFO_CONN, (void *) (long)chanp->chan); chanp->cs->status &= ~0x2200;
else
chanp->cs->status &= ~0x1100;
if (chanp->cs->card_ops->led_handler)
chanp->cs->card_ops->led_handler(chanp->cs);
} }
static void static void
...@@ -232,7 +247,7 @@ lli_close(struct FsmInst *fi) ...@@ -232,7 +247,7 @@ lli_close(struct FsmInst *fi)
FsmChangeState(fi, ST_NULL); FsmChangeState(fi, ST_NULL);
chanp->Flags = 0; chanp->Flags = 0;
mdl_info_rel(chanp); mdl_info_release(chanp);
} }
static void static void
...@@ -262,7 +277,7 @@ lli_leased_in(struct FsmInst *fi, int event, void *arg) ...@@ -262,7 +277,7 @@ lli_leased_in(struct FsmInst *fi, int event, void *arg)
if (chanp->debug & 1) if (chanp->debug & 1)
link_debug(chanp, 1, "statcallb ret=%d", ret); link_debug(chanp, 1, "statcallb ret=%d", ret);
if (!ret) { if (!ret) {
mdl_info_rel(chanp); mdl_info_release(chanp);
FsmChangeState(fi, ST_NULL); FsmChangeState(fi, ST_NULL);
} }
} }
...@@ -338,7 +353,7 @@ lli_go_active(struct FsmInst *fi, int event, void *arg) ...@@ -338,7 +353,7 @@ lli_go_active(struct FsmInst *fi, int event, void *arg)
ic.command = ISDN_STAT_BCONN; ic.command = ISDN_STAT_BCONN;
ic.arg = chanp->chan; ic.arg = chanp->chan;
chanp->cs->iif.statcallb(&ic); chanp->cs->iif.statcallb(&ic);
mdl_info_conn(chanp); mdl_info_connect(chanp);
} }
...@@ -403,13 +418,13 @@ lli_deliver_call(struct FsmInst *fi, int event, void *arg) ...@@ -403,13 +418,13 @@ lli_deliver_call(struct FsmInst *fi, int event, void *arg)
case 0: /* OK, nobody likes this call */ case 0: /* OK, nobody likes this call */
default: /* statcallb problems */ default: /* statcallb problems */
L4L3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc); L4L3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc);
mdl_info_rel(chanp); mdl_info_release(chanp);
FsmChangeState(fi, ST_NULL); FsmChangeState(fi, ST_NULL);
break; break;
} }
} else { } else {
L4L3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc); L4L3(chanp->d_st, CC_IGNORE | REQUEST, chanp->proc);
mdl_info_rel(chanp); mdl_info_release(chanp);
} }
} }
...@@ -752,7 +767,7 @@ lli_failure_l(struct FsmInst *fi, int event, void *arg) ...@@ -752,7 +767,7 @@ lli_failure_l(struct FsmInst *fi, int event, void *arg)
chanp->cs->iif.statcallb(&ic); chanp->cs->iif.statcallb(&ic);
HL_LL(chanp, ISDN_STAT_DHUP); HL_LL(chanp, ISDN_STAT_DHUP);
chanp->Flags = 0; chanp->Flags = 0;
mdl_info_rel(chanp); mdl_info_release(chanp);
} }
static void static void
......
...@@ -443,20 +443,12 @@ diva_reset(struct IsdnCardState *cs) ...@@ -443,20 +443,12 @@ diva_reset(struct IsdnCardState *cs)
return 0; return 0;
} }
#define DIVA_ASSIGN 1
static void static void
diva_led_handler(struct IsdnCardState *cs) diva_led_handler(struct IsdnCardState *cs)
{ {
int blink = 0; int blink = 0;
// if ((cs->subtyp == DIVA_IPAC_ISA) || (cs->subtyp == DIVA_IPAC_PCI)) if (cs->status & 0x0001)
if ((cs->subtyp == DIVA_IPAC_ISA) ||
(cs->subtyp == DIVA_IPAC_PCI) ||
(cs->subtyp == DIVA_IPACX_PCI) )
return;
del_timer(&cs->hw.diva.tl);
if (cs->hw.diva.status & DIVA_ASSIGN)
cs->hw.diva.ctrl_reg |= (DIVA_ISA == cs->subtyp) ? cs->hw.diva.ctrl_reg |= (DIVA_ISA == cs->subtyp) ?
DIVA_ISA_LED_A : DIVA_PCI_LED_A; DIVA_ISA_LED_A : DIVA_PCI_LED_A;
else { else {
...@@ -464,10 +456,10 @@ diva_led_handler(struct IsdnCardState *cs) ...@@ -464,10 +456,10 @@ diva_led_handler(struct IsdnCardState *cs)
DIVA_ISA_LED_A : DIVA_PCI_LED_A; DIVA_ISA_LED_A : DIVA_PCI_LED_A;
blink = 250; blink = 250;
} }
if (cs->hw.diva.status & 0xf000) if (cs->status & 0xf000)
cs->hw.diva.ctrl_reg |= (DIVA_ISA == cs->subtyp) ? cs->hw.diva.ctrl_reg |= (DIVA_ISA == cs->subtyp) ?
DIVA_ISA_LED_B : DIVA_PCI_LED_B; DIVA_ISA_LED_B : DIVA_PCI_LED_B;
else if (cs->hw.diva.status & 0x0f00) { else if (cs->status & 0x0f00) {
cs->hw.diva.ctrl_reg ^= (DIVA_ISA == cs->subtyp) ? cs->hw.diva.ctrl_reg ^= (DIVA_ISA == cs->subtyp) ?
DIVA_ISA_LED_B : DIVA_PCI_LED_B; DIVA_ISA_LED_B : DIVA_PCI_LED_B;
blink = 500; blink = 500;
...@@ -476,50 +468,8 @@ diva_led_handler(struct IsdnCardState *cs) ...@@ -476,50 +468,8 @@ diva_led_handler(struct IsdnCardState *cs)
DIVA_ISA_LED_B : DIVA_PCI_LED_B); DIVA_ISA_LED_B : DIVA_PCI_LED_B);
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg); byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
if (blink) { if (blink)
init_timer(&cs->hw.diva.tl); mod_timer(&cs->hw.diva.tl, jiffies + (blink * HZ) / 1000);
cs->hw.diva.tl.expires = jiffies + ((blink * HZ) / 1000);
add_timer(&cs->hw.diva.tl);
}
}
static int
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
switch (mt) {
case (MDL_REMOVE | REQUEST):
cs->hw.diva.status = 0;
break;
case (MDL_ASSIGN | REQUEST):
cs->hw.diva.status |= DIVA_ASSIGN;
break;
case MDL_INFO_SETUP:
if ((long)arg)
cs->hw.diva.status |= 0x0200;
else
cs->hw.diva.status |= 0x0100;
break;
case MDL_INFO_CONN:
if ((long)arg)
cs->hw.diva.status |= 0x2000;
else
cs->hw.diva.status |= 0x1000;
break;
case MDL_INFO_REL:
if ((long)arg) {
cs->hw.diva.status &= ~0x2000;
cs->hw.diva.status &= ~0x0200;
} else {
cs->hw.diva.status &= ~0x1000;
cs->hw.diva.status &= ~0x0100;
}
break;
}
if ((cs->subtyp != DIVA_IPAC_ISA) &&
(cs->subtyp != DIVA_IPAC_PCI) &&
(cs->subtyp != DIVA_IPACX_PCI) )
diva_led_handler(cs);
return(0);
} }
static void static void
...@@ -537,31 +487,32 @@ diva_ipac_pci_init(struct IsdnCardState *cs) ...@@ -537,31 +487,32 @@ 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, .reset = diva_reset,
.release = diva_release, .release = diva_release,
.irq_func = diva_interrupt, .led_handler = diva_led_handler,
.irq_func = diva_interrupt,
}; };
static struct card_ops diva_ipac_isa_ops = { static struct card_ops diva_ipac_isa_ops = {
.init = ipac_init, .init = ipac_init,
.reset = diva_ipac_isa_reset, .reset = diva_ipac_isa_reset,
.release = hisax_release_resources, .release = hisax_release_resources,
.irq_func = ipac_irq, .irq_func = ipac_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, .reset = diva_ipac_pci_reset,
.release = diva_ipac_pci_release, .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, .reset = diva_ipacx_pci_reset,
.release = diva_ipac_pci_release, .release = diva_ipac_pci_release,
.irq_func = diva_ipacx_pci_irq, .irq_func = diva_ipacx_pci_irq,
}; };
static struct pci_dev *dev_diva __initdata = NULL; static struct pci_dev *dev_diva __initdata = NULL;
...@@ -607,7 +558,6 @@ setup_diva(struct IsdnCard *card) ...@@ -607,7 +558,6 @@ setup_diva(struct IsdnCard *card)
printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_DIEHLDIVA) if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
return(0); return(0);
cs->hw.diva.status = 0;
if (card->para[1]) { if (card->para[1]) {
cs->hw.diva.ctrl_reg = 0; cs->hw.diva.ctrl_reg = 0;
cs->hw.diva.cfg_reg = card->para[1]; cs->hw.diva.cfg_reg = card->para[1];
...@@ -775,7 +725,6 @@ setup_diva(struct IsdnCard *card) ...@@ -775,7 +725,6 @@ setup_diva(struct IsdnCard *card)
if (!request_io(&cs->rs, cs->hw.diva.cfg_reg, bytecnt, "diva isdn")) if (!request_io(&cs->rs, cs->hw.diva.cfg_reg, bytecnt, "diva isdn"))
return 0; return 0;
} }
cs->cardmsg = &Diva_card_msg;
if (cs->subtyp == DIVA_IPAC_ISA) { if (cs->subtyp == DIVA_IPAC_ISA) {
diva_ipac_isa_reset(cs); diva_ipac_isa_reset(cs);
cs->dc_hw_ops = &ipac_dc_ops; cs->dc_hw_ops = &ipac_dc_ops;
......
...@@ -106,7 +106,6 @@ const char *ITACVer[] = ...@@ -106,7 +106,6 @@ const char *ITACVer[] =
/* Status Flags */ /* Status Flags */
#define ELSA_TIMER_AKTIV 1 #define ELSA_TIMER_AKTIV 1
#define ELSA_BAD_PWR 2 #define ELSA_BAD_PWR 2
#define ELSA_ASSIGN 4
#define RS_ISR_PASS_LIMIT 256 #define RS_ISR_PASS_LIMIT 256
#define _INLINE_ inline #define _INLINE_ inline
...@@ -553,8 +552,15 @@ elsa_led_handler(struct IsdnCardState *cs) ...@@ -553,8 +552,15 @@ elsa_led_handler(struct IsdnCardState *cs)
if (cs->subtyp == ELSA_PCMCIA || cs->subtyp == ELSA_PCMCIA_IPAC) if (cs->subtyp == ELSA_PCMCIA || cs->subtyp == ELSA_PCMCIA_IPAC)
return; return;
del_timer(&cs->hw.elsa.tl);
if (cs->hw.elsa.status & ELSA_ASSIGN) if (cs->typ == ISDN_CTYPE_ELSA) {
int pwr = bytein(cs->hw.elsa.ale);
if (pwr & 0x08)
cs->hw.elsa.status |= ELSA_BAD_PWR;
else
cs->hw.elsa.status &= ~ELSA_BAD_PWR;
}
if (cs->status & 0x0001)
cs->hw.elsa.ctrl_reg |= ELSA_STAT_LED; cs->hw.elsa.ctrl_reg |= ELSA_STAT_LED;
else if (cs->hw.elsa.status & ELSA_BAD_PWR) else if (cs->hw.elsa.status & ELSA_BAD_PWR)
cs->hw.elsa.ctrl_reg &= ~ELSA_STAT_LED; cs->hw.elsa.ctrl_reg &= ~ELSA_STAT_LED;
...@@ -562,9 +568,9 @@ elsa_led_handler(struct IsdnCardState *cs) ...@@ -562,9 +568,9 @@ elsa_led_handler(struct IsdnCardState *cs)
cs->hw.elsa.ctrl_reg ^= ELSA_STAT_LED; cs->hw.elsa.ctrl_reg ^= ELSA_STAT_LED;
blink = 250; blink = 250;
} }
if (cs->hw.elsa.status & 0xf000) if (cs->status & 0xf000)
cs->hw.elsa.ctrl_reg |= ELSA_LINE_LED; cs->hw.elsa.ctrl_reg |= ELSA_LINE_LED;
else if (cs->hw.elsa.status & 0x0f00) { else if (cs->status & 0x0f00) {
cs->hw.elsa.ctrl_reg ^= ELSA_LINE_LED; cs->hw.elsa.ctrl_reg ^= ELSA_LINE_LED;
blink = 500; blink = 500;
} else } else
...@@ -580,56 +586,9 @@ elsa_led_handler(struct IsdnCardState *cs) ...@@ -580,56 +586,9 @@ elsa_led_handler(struct IsdnCardState *cs)
writereg(cs, cs->hw.elsa.isac, IPAC_ATX, led); writereg(cs, cs->hw.elsa.isac, IPAC_ATX, led);
} else } else
byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg); byteout(cs->hw.elsa.ctrl, cs->hw.elsa.ctrl_reg);
if (blink) {
init_timer(&cs->hw.elsa.tl);
cs->hw.elsa.tl.expires = jiffies + ((blink * HZ) / 1000);
add_timer(&cs->hw.elsa.tl);
}
}
static int if (blink)
Elsa_card_msg(struct IsdnCardState *cs, int mt, void *arg) mod_timer(&cs->hw.elsa.tl, jiffies + (blink * HZ) / 1000);
{
int ret = 0;
switch (mt) {
case (MDL_REMOVE | REQUEST):
cs->hw.elsa.status &= 0;
break;
case (MDL_ASSIGN | REQUEST):
cs->hw.elsa.status |= ELSA_ASSIGN;
break;
case MDL_INFO_SETUP:
if ((long) arg)
cs->hw.elsa.status |= 0x0200;
else
cs->hw.elsa.status |= 0x0100;
break;
case MDL_INFO_CONN:
if ((long) arg)
cs->hw.elsa.status |= 0x2000;
else
cs->hw.elsa.status |= 0x1000;
break;
case MDL_INFO_REL:
if ((long) arg) {
cs->hw.elsa.status &= ~0x2000;
cs->hw.elsa.status &= ~0x0200;
} else {
cs->hw.elsa.status &= ~0x1000;
cs->hw.elsa.status &= ~0x0100;
}
break;
}
if (cs->typ == ISDN_CTYPE_ELSA) {
int pwr = bytein(cs->hw.elsa.ale);
if (pwr & 0x08)
cs->hw.elsa.status |= ELSA_BAD_PWR;
else
cs->hw.elsa.status &= ~ELSA_BAD_PWR;
}
elsa_led_handler(cs);
return(ret);
} }
#if ARCOFI_USE #if ARCOFI_USE
...@@ -712,21 +671,23 @@ elsa_test(struct IsdnCardState *cs) ...@@ -712,21 +671,23 @@ elsa_test(struct IsdnCardState *cs)
} }
static struct card_ops elsa_ops = { static struct card_ops elsa_ops = {
.init = elsa_init, .init = elsa_init,
.test = elsa_test, .test = elsa_test,
.reset = elsa_reset, .reset = elsa_reset,
.release = elsa_release, .release = elsa_release,
.aux_ind = elsa_aux_ind, .aux_ind = elsa_aux_ind,
.irq_func = elsa_interrupt, .led_handler = elsa_led_handler,
.irq_func = elsa_interrupt,
}; };
static struct card_ops elsa_ipac_ops = { static struct card_ops elsa_ipac_ops = {
.init = elsa_ipac_init, .init = elsa_ipac_init,
.test = elsa_test, .test = elsa_test,
.reset = elsa_reset, .reset = elsa_reset,
.release = elsa_release, .release = elsa_release,
.aux_ind = elsa_aux_ind, .aux_ind = elsa_aux_ind,
.irq_func = elsa_interrupt_ipac, .led_handler = elsa_led_handler,
.irq_func = elsa_interrupt_ipac,
}; };
static unsigned char static unsigned char
...@@ -1085,7 +1046,6 @@ setup_elsa(struct IsdnCard *card) ...@@ -1085,7 +1046,6 @@ setup_elsa(struct IsdnCard *card)
} }
printk(KERN_INFO "Elsa: timer OK; resetting card\n"); printk(KERN_INFO "Elsa: timer OK; resetting card\n");
} }
cs->cardmsg = &Elsa_card_msg;
elsa_reset(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;
......
...@@ -178,25 +178,18 @@ enpci_bc_deactivate(struct IsdnCardState *cs, int chan) ...@@ -178,25 +178,18 @@ enpci_bc_deactivate(struct IsdnCardState *cs, int chan)
} }
} }
static int static void
enpci_card_msg(struct IsdnCardState *cs, int mt, void *arg) enpci_led_handler(struct IsdnCardState *cs)
{ {
if (cs->debug & L1_DEB_ISAC) if (cs->status & 0x0001) {
debugl1(cs, "enter:now PCI: card_msg: 0x%04X", mt); /* TEI assigned, LED1 on */
cs->hw.njet.auxd = TJ_AMD_IRQ << 1;
switch (mt) { OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd);
case MDL_ASSIGN: } else {
/* TEI assigned, LED1 on */ /* TEI removed, LEDs off */
cs->hw.njet.auxd = TJ_AMD_IRQ << 1; cs->hw.njet.auxd = 0;
OutByte(cs->hw.njet.base + NETJET_AUXDATA, cs->hw.njet.auxd); OutByte(cs->hw.njet.base + NETJET_AUXDATA, 0x00);
break;
case MDL_REMOVE:
/* TEI removed, LEDs off */
cs->hw.njet.auxd = 0;
OutByte(cs->hw.njet.base + NETJET_AUXDATA, 0x00);
break;
} }
return(0);
} }
static void static void
...@@ -262,10 +255,11 @@ enpci_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -262,10 +255,11 @@ 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, .reset = enpci_reset,
.release = netjet_release, .release = netjet_release,
.irq_func = enpci_interrupt, .led_handler = enpci_led_handler,
.irq_func = enpci_interrupt,
}; };
static struct pci_dev *dev_netjet __initdata = NULL; static struct pci_dev *dev_netjet __initdata = NULL;
...@@ -350,7 +344,6 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -350,7 +344,6 @@ setup_enternow_pci(struct IsdnCard *card)
cs->dc_hw_ops = &enternow_ops; cs->dc_hw_ops = &enternow_ops;
cs->dc.amd7930.setIrqMask = &enpci_setIrqMask; cs->dc.amd7930.setIrqMask = &enpci_setIrqMask;
cs->cardmsg = &enpci_card_msg;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &enpci_ops; cs->card_ops = &enpci_ops;
......
...@@ -70,9 +70,6 @@ ...@@ -70,9 +70,6 @@
#define MDL_ASSIGN 0x0280 #define MDL_ASSIGN 0x0280
#define MDL_REMOVE 0x0284 #define MDL_REMOVE 0x0284
#define MDL_ERROR 0x0288 #define MDL_ERROR 0x0288
#define MDL_INFO_SETUP 0x02E0
#define MDL_INFO_CONN 0x02E4
#define MDL_INFO_REL 0x02E8
#define CC_SETUP 0x0300 #define CC_SETUP 0x0300
#define CC_RESUME 0x0304 #define CC_RESUME 0x0304
...@@ -619,7 +616,6 @@ struct diva_hw { ...@@ -619,7 +616,6 @@ struct diva_hw {
unsigned int isac; unsigned int isac;
unsigned long hscx_adr; unsigned long hscx_adr;
unsigned int hscx; unsigned int hscx;
unsigned int status;
struct timer_list tl; struct timer_list tl;
u8 ctrl_reg; u8 ctrl_reg;
}; };
...@@ -885,12 +881,13 @@ struct IsdnCardState; ...@@ -885,12 +881,13 @@ struct IsdnCardState;
/* Methods provided by driver for a specific card */ /* Methods provided by driver for a specific card */
struct card_ops { struct card_ops {
void (*init) (struct IsdnCardState *); void (*init) (struct IsdnCardState *);
void (*test) (struct IsdnCardState *); void (*test) (struct IsdnCardState *);
int (*reset) (struct IsdnCardState *); int (*reset) (struct IsdnCardState *);
void (*release) (struct IsdnCardState *); void (*release) (struct IsdnCardState *);
void (*aux_ind) (struct IsdnCardState *, void *); void (*aux_ind) (struct IsdnCardState *, void *);
void (*irq_func) (int, void *, struct pt_regs *); void (*led_handler)(struct IsdnCardState *);
void (*irq_func) (int, void *, struct pt_regs *);
}; };
/* Card specific drivers provide methods to access the /* Card specific drivers provide methods to access the
...@@ -950,6 +947,7 @@ struct IsdnCardState { ...@@ -950,6 +947,7 @@ struct IsdnCardState {
struct resources rs; struct resources rs;
unsigned int irq; unsigned int irq;
unsigned long irq_flags; unsigned long irq_flags;
int status;
long HW_Flags; long HW_Flags;
int *busy_flag; int *busy_flag;
int chanlimit; /* limited number of B-chans to use */ int chanlimit; /* limited number of B-chans to use */
......
...@@ -401,30 +401,23 @@ sedlbauer_isar_release(struct IsdnCardState *cs) ...@@ -401,30 +401,23 @@ sedlbauer_isar_release(struct IsdnCardState *cs)
hisax_release_resources(cs); hisax_release_resources(cs);
} }
static int static void
Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg) sedlbauer_led_handler(struct IsdnCardState *cs)
{ {
switch (mt) { if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
case MDL_INFO_CONN: return;
if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID)
return(0); if (cs->status & 0x2000)
if ((long) arg) cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED2;
cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED2; else
else cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED2;
cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED1;
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off); if (cs->status & 0x1000)
break; cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED1;
case MDL_INFO_REL: else
if (cs->subtyp != SEDL_SPEEDFAX_PYRAMID) cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED1;
return(0);
if ((long) arg) byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED2;
else
cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED1;
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
break;
}
return(0);
} }
static void static void
...@@ -436,24 +429,27 @@ sedlbauer_isar_init(struct IsdnCardState *cs) ...@@ -436,24 +429,27 @@ 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, .reset = sedlbauer_reset,
.release = hisax_release_resources, .release = hisax_release_resources,
.irq_func = sedlbauer_interrupt, .led_handler = sedlbauer_led_handler,
.irq_func = sedlbauer_interrupt,
}; };
static struct card_ops sedlbauer_ipac_ops = { static struct card_ops sedlbauer_ipac_ops = {
.init = ipac_init, .init = ipac_init,
.reset = sedlbauer_reset, .reset = sedlbauer_reset,
.release = hisax_release_resources, .release = hisax_release_resources,
.irq_func = ipac_irq, .led_handler = sedlbauer_led_handler,
.irq_func = ipac_irq,
}; };
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, .reset = sedlbauer_reset,
.release = sedlbauer_isar_release, .release = sedlbauer_isar_release,
.irq_func = sedlbauer_isar_interrupt, .led_handler = sedlbauer_led_handler,
.irq_func = sedlbauer_isar_interrupt,
}; };
static struct pci_dev *dev_sedl __devinitdata = NULL; static struct pci_dev *dev_sedl __devinitdata = NULL;
...@@ -629,8 +625,6 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -629,8 +625,6 @@ setup_sedlbauer(struct IsdnCard *card)
cs->hw.sedl.cfg_reg + bytecnt, cs->hw.sedl.cfg_reg + bytecnt,
cs->irq); cs->irq);
cs->cardmsg = &Sedl_card_msg;
/* /*
* testing ISA and PCMCIA Cards for IPAC, default is ISAC * testing ISA and PCMCIA Cards for IPAC, default is ISAC
* do not test for PCI card, because ports are different * do not test for PCI card, because ports are different
......
...@@ -77,15 +77,17 @@ static char *strTeiEvent[] = ...@@ -77,15 +77,17 @@ static char *strTeiEvent[] =
static inline void static inline void
mdl_assign(struct IsdnCardState *cs) mdl_assign(struct IsdnCardState *cs)
{ {
if (cs->cardmsg) cs->status |= 0x0001;
cs->cardmsg(cs, MDL_ASSIGN | REQUEST, NULL); if (cs->card_ops->led_handler)
cs->card_ops->led_handler(cs);
} }
static inline void static inline void
mdl_remove(struct IsdnCardState *cs) mdl_remove(struct IsdnCardState *cs)
{ {
if (cs->cardmsg) cs->status = 0;
cs->cardmsg(cs, MDL_REMOVE | REQUEST, NULL); if (cs->card_ops->led_handler)
cs->card_ops->led_handler(cs);
} }
unsigned int unsigned int
......
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