Commit bfb4d184 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Clean up the various IPAC IRQ handlers

Just renaming and introducing some helpers makes them look very similar
to each other..
parent 14dad372
...@@ -116,13 +116,13 @@ static struct dc_hw_ops isac_ops = { ...@@ -116,13 +116,13 @@ static struct dc_hw_ops isac_ops = {
static u8 static u8
ipac_dc_read(struct IsdnCardState *cs, u8 offset) ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{ {
return readreg(cs, cs->hw.asus.isac, offset|0x80); return readreg(cs, cs->hw.asus.isac, offset+0x80);
} }
static void static void
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value) ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{ {
writereg(cs, cs->hw.asus.isac, offset|0x80, value); writereg(cs, cs->hw.asus.isac, offset+0x80, value);
} }
static void static void
...@@ -175,17 +175,26 @@ static struct bc_hw_ops hscx_ops = { ...@@ -175,17 +175,26 @@ static struct bc_hw_ops hscx_ops = {
.write_fifo = hscx_write_fifo, .write_fifo = hscx_write_fifo,
}; };
static u8
ipac_read(struct IsdnCardState *cs, u8 offset)
{
return ipac_dc_read(cs, offset - 0x80);
}
static void
ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
ipac_dc_write(cs, offset - 0x80, value);
}
static void static void
asuscom_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) asuscom_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 ista, val, icnt = 5; u8 ista, val, icnt = 5;
if (!cs) { spin_lock(&cs->lock);
printk(KERN_WARNING "ISDNLink: Spurious interrupt!\n"); ista = ipac_read(cs, IPAC_ISTA);
return;
}
ista = readreg(cs, cs->hw.asus.isac, IPAC_ISTA);
Start_IPAC: Start_IPAC:
if (cs->debug & L1_DEB_IPAC) if (cs->debug & L1_DEB_IPAC)
debugl1(cs, "IPAC ISTA %02X", ista); debugl1(cs, "IPAC ISTA %02X", ista);
...@@ -210,15 +219,17 @@ asuscom_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -210,15 +219,17 @@ asuscom_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = readreg(cs, cs->hw.asus.isac, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
if ((ista & 0x3f) && icnt) { if ((ista & 0x3f) && icnt) {
icnt--; icnt--;
goto Start_IPAC; goto Start_IPAC;
} }
if (!icnt) if (!icnt)
printk(KERN_WARNING "ASUS IRQ LOOP\n"); printk(KERN_WARNING "ASUS IRQ LOOP\n");
writereg(cs, cs->hw.asus.isac, IPAC_MASK, 0xFF);
writereg(cs, cs->hw.asus.isac, IPAC_MASK, 0xC0); ipac_write(cs, IPAC_MASK, 0xFF);
ipac_write(cs, IPAC_MASK, 0xC0);
spin_unlock(&cs->lock);
} }
static void static void
......
...@@ -87,13 +87,13 @@ writefifo(struct IsdnCardState *cs, u8 off, u8 *data, int size) ...@@ -87,13 +87,13 @@ writefifo(struct IsdnCardState *cs, u8 off, u8 *data, int size)
static u8 static u8
ipac_dc_read(struct IsdnCardState *cs, u8 offset) ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{ {
return readreg(cs, offset | 0x80); return readreg(cs, offset + 0x80);
} }
static void static void
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value) ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{ {
writereg(cs, offset | 0x80, value); writereg(cs, offset + 0x80, value);
} }
static void static void
...@@ -146,6 +146,18 @@ static struct bc_hw_ops hscx_ops = { ...@@ -146,6 +146,18 @@ static struct bc_hw_ops hscx_ops = {
.write_fifo = hscx_write_fifo, .write_fifo = hscx_write_fifo,
}; };
static u8
ipac_read(struct IsdnCardState *cs, u8 offset)
{
return ipac_dc_read(cs, offset - 0x80);
}
static void
ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
ipac_dc_write(cs, offset - 0x80, value);
}
/* Set the specific ipac to active */ /* Set the specific ipac to active */
static void static void
set_ipac_active(struct IsdnCardState *cs, u_int active) set_ipac_active(struct IsdnCardState *cs, u_int active)
...@@ -161,7 +173,7 @@ bkm_a8_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -161,7 +173,7 @@ bkm_a8_interrupt(int intno, void *dev_id, struct pt_regs *regs)
u8 ista, val, icnt = 5; u8 ista, val, icnt = 5;
spin_lock(&cs->lock); spin_lock(&cs->lock);
ista = readreg(cs, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
if (!(ista & 0x3f)) /* not this IPAC */ if (!(ista & 0x3f)) /* not this IPAC */
goto unlock; goto unlock;
Start_IPAC: Start_IPAC:
...@@ -189,7 +201,7 @@ bkm_a8_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -189,7 +201,7 @@ bkm_a8_interrupt(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = readreg(cs, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
if ((ista & 0x3f) && icnt) { if ((ista & 0x3f) && icnt) {
icnt--; icnt--;
goto Start_IPAC; goto Start_IPAC;
...@@ -198,8 +210,8 @@ bkm_a8_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -198,8 +210,8 @@ bkm_a8_interrupt(int intno, void *dev_id, struct pt_regs *regs)
printk(KERN_WARNING "HiSax: %s (%s) IRQ LOOP\n", printk(KERN_WARNING "HiSax: %s (%s) IRQ LOOP\n",
CardType[cs->typ], CardType[cs->typ],
sct_quadro_subtypes[cs->subtyp]); sct_quadro_subtypes[cs->subtyp]);
writereg(cs, IPAC_MASK, 0xFF); ipac_write(cs, IPAC_MASK, 0xFF);
writereg(cs, IPAC_MASK, 0xC0); ipac_write(cs, IPAC_MASK, 0xC0);
unlock: unlock:
spin_unlock(&cs->lock); spin_unlock(&cs->lock);
} }
......
...@@ -172,7 +172,7 @@ ipac_dc_read(struct IsdnCardState *cs, u8 offset) ...@@ -172,7 +172,7 @@ ipac_dc_read(struct IsdnCardState *cs, u8 offset)
static void static void
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value) ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{ {
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset|0x80, value); writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset+0x80, value);
} }
static void static void
...@@ -364,28 +364,26 @@ static void ...@@ -364,28 +364,26 @@ static void
diva_interrupt(int intno, void *dev_id, struct pt_regs *regs) diva_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 val, sval; u8 sval;
int cnt=5; int cnt=5;
spin_lock(&cs->lock);
while (((sval = bytein(cs->hw.diva.ctrl)) & DIVA_IRQ_REQ) && cnt) { while (((sval = bytein(cs->hw.diva.ctrl)) & DIVA_IRQ_REQ) && cnt) {
val = readreg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_ISTA + 0x40); hscxisac_irq(intno, dev_id, regs);
if (val)
hscx_int_main(cs, val);
val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_ISTA);
if (val)
isac_interrupt(cs, val);
cnt--;
} }
if (!cnt) if (!cnt)
printk(KERN_WARNING "Diva: IRQ LOOP\n"); printk(KERN_WARNING "Diva: IRQ LOOP\n");
writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK, 0xFF); }
writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK + 0x40, 0xFF);
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_MASK, 0xFF); static u8
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_MASK, 0x0); ipac_read(struct IsdnCardState *cs, u8 offset)
writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK, 0x0); {
writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK + 0x40, 0x0); return ipac_dc_read(cs, offset - 0x80);
spin_unlock(&cs->lock); }
static void
ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
ipac_dc_write(cs, offset - 0x80, value);
} }
static void static void
...@@ -399,12 +397,12 @@ diva_ipac_isa_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -399,12 +397,12 @@ diva_ipac_isa_irq(int intno, void *dev_id, struct pt_regs *regs)
printk(KERN_WARNING "Diva: Spurious interrupt!\n"); printk(KERN_WARNING "Diva: Spurious interrupt!\n");
return; return;
} }
ista = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
Start_IPACISA: Start_IPACISA:
if (cs->debug & L1_DEB_IPAC) if (cs->debug & L1_DEB_IPAC)
debugl1(cs, "IPAC ISTA %02X", ista); debugl1(cs, "IPAC ISTA %02X", ista);
if (ista & 0x0f) { if (ista & 0x0f) {
val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, HSCX_ISTA + 0x40); val = hscx_read(cs, 1, HSCX_ISTA);
if (ista & 0x01) if (ista & 0x01)
val |= 0x01; val |= 0x01;
if (ista & 0x04) if (ista & 0x04)
...@@ -415,7 +413,7 @@ diva_ipac_isa_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -415,7 +413,7 @@ diva_ipac_isa_irq(int intno, void *dev_id, struct pt_regs *regs)
hscx_int_main(cs, val); hscx_int_main(cs, val);
} }
if (ista & 0x20) { if (ista & 0x20) {
val = 0xfe & readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_ISTA + 0x80); val = ipac_dc_read(cs, ISAC_ISTA) & 0xfe;
if (val) { if (val) {
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
...@@ -424,15 +422,28 @@ diva_ipac_isa_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -424,15 +422,28 @@ diva_ipac_isa_irq(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
if ((ista & 0x3f) && icnt) { if ((ista & 0x3f) && icnt) {
icnt--; icnt--;
goto Start_IPACISA; goto Start_IPACISA;
} }
if (!icnt) if (!icnt)
printk(KERN_WARNING "DIVA IPAC IRQ LOOP\n"); printk(KERN_WARNING "DIVA IPAC IRQ LOOP\n");
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xFF);
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xC0); ipac_write(cs, IPAC_MASK, 0xFF);
ipac_write(cs, IPAC_MASK, 0xC0);
}
static u8
mem_ipac_read(struct IsdnCardState *cs, u8 offset)
{
return mem_ipac_dc_read(cs, offset - 0x80);
}
static void
mem_ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
mem_ipac_dc_write(cs, offset - 0x80, value);
} }
static void static void
...@@ -441,23 +452,17 @@ diva_ipac_pci_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -441,23 +452,17 @@ diva_ipac_pci_irq(int intno, void *dev_id, struct pt_regs *regs)
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 ista,val; u8 ista,val;
int icnt=5; int icnt=5;
u8 *cfg;
if (!cs) { val = readb(cs->hw.diva.pci_cfg);
printk(KERN_WARNING "Diva: Spurious interrupt!\n");
return;
}
cfg = (u8 *) cs->hw.diva.pci_cfg;
val = *cfg;
if (!(val & PITA_INT0_STATUS)) if (!(val & PITA_INT0_STATUS))
return; /* other shared IRQ */ return; /* other shared IRQ */
*cfg = PITA_INT0_STATUS; /* Reset pending INT0 */ writeb(PITA_INT0_STATUS, cs->hw.diva.pci_cfg); /* Reset pending INT0 */
ista = memreadreg(cs->hw.diva.cfg_reg, IPAC_ISTA); ista = mem_ipac_read(cs, IPAC_ISTA);
Start_IPACPCI: Start_IPACPCI:
if (cs->debug & L1_DEB_IPAC) if (cs->debug & L1_DEB_IPAC)
debugl1(cs, "IPAC ISTA %02X", ista); debugl1(cs, "IPAC ISTA %02X", ista);
if (ista & 0x0f) { if (ista & 0x0f) {
val = memreadreg(cs->hw.diva.cfg_reg, HSCX_ISTA + 0x40); val = mem_hscx_read(cs, 1, HSCX_ISTA);
if (ista & 0x01) if (ista & 0x01)
val |= 0x01; val |= 0x01;
if (ista & 0x04) if (ista & 0x04)
...@@ -468,7 +473,7 @@ diva_ipac_pci_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -468,7 +473,7 @@ diva_ipac_pci_irq(int intno, void *dev_id, struct pt_regs *regs)
hscx_int_main(cs, val); hscx_int_main(cs, val);
} }
if (ista & 0x20) { if (ista & 0x20) {
val = 0xfe & memreadreg(cs->hw.diva.cfg_reg, ISAC_ISTA + 0x80); val = mem_ipac_dc_read(cs, ISAC_ISTA) & 0xfe;
if (val) { if (val) {
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
...@@ -477,15 +482,15 @@ diva_ipac_pci_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -477,15 +482,15 @@ diva_ipac_pci_irq(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = memreadreg(cs->hw.diva.cfg_reg, IPAC_ISTA); ista = mem_ipac_read(cs, IPAC_ISTA);
if ((ista & 0x3f) && icnt) { if ((ista & 0x3f) && icnt) {
icnt--; icnt--;
goto Start_IPACPCI; goto Start_IPACPCI;
} }
if (!icnt) if (!icnt)
printk(KERN_WARNING "DIVA IPAC PCI IRQ LOOP\n"); printk(KERN_WARNING "DIVA IPAC PCI IRQ LOOP\n");
memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xFF); mem_ipac_write(cs, IPAC_MASK, 0xFF);
memwritereg(cs->hw.diva.cfg_reg, IPAC_MASK, 0xC0); mem_ipac_write(cs, IPAC_MASK, 0xC0);
} }
static void static void
...@@ -493,17 +498,11 @@ diva_ipacx_pci_irq(int intno, void *dev_id, struct pt_regs *regs) ...@@ -493,17 +498,11 @@ diva_ipacx_pci_irq(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 val; u8 val;
u8 *cfg;
if (!cs) { val = readb(cs->hw.diva.pci_cfg);
printk(KERN_WARNING "Diva: Spurious interrupt!\n");
return;
}
cfg = (u8 *) cs->hw.diva.pci_cfg;
val = *cfg;
if (!(val &PITA_INT0_STATUS)) return; // other shared IRQ if (!(val &PITA_INT0_STATUS)) return; // other shared IRQ
interrupt_ipacx(cs); // handler for chip interrupt_ipacx(cs); // handler for chip
*cfg = PITA_INT0_STATUS; // Reset PLX interrupt writeb(PITA_INT0_STATUS, cs->hw.diva.pci_cfg); // Reset PLX interrupt
} }
static void static void
...@@ -959,11 +958,11 @@ setup_diva(struct IsdnCard *card) ...@@ -959,11 +958,11 @@ 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");
} }
} }
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); diva_ipac_isa_reset(cs);
cs->dc_hw_ops = &ipac_dc_ops; cs->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &hscx_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);
...@@ -987,6 +986,7 @@ setup_diva(struct IsdnCard *card) ...@@ -987,6 +986,7 @@ setup_diva(struct IsdnCard *card)
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);
cs->dc_hw_ops = &isac_ops; cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &diva_ops; cs->card_ops = &diva_ops;
ISACVersion(cs, "Diva:"); ISACVersion(cs, "Diva:");
if (HscxVersion(cs, "Diva:")) { if (HscxVersion(cs, "Diva:")) {
......
...@@ -220,7 +220,7 @@ ipac_dc_read(struct IsdnCardState *cs, u8 offset) ...@@ -220,7 +220,7 @@ ipac_dc_read(struct IsdnCardState *cs, u8 offset)
static void static void
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value) ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{ {
writereg(cs, cs->hw.elsa.isac, offset|0x80, value); writereg(cs, cs->hw.elsa.isac, offset+0x80, value);
} }
static void static void
...@@ -356,6 +356,18 @@ elsa_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -356,6 +356,18 @@ elsa_interrupt(int intno, void *dev_id, struct pt_regs *regs)
byteout(cs->hw.elsa.trig, 0x00); byteout(cs->hw.elsa.trig, 0x00);
} }
static u8
ipac_read(struct IsdnCardState *cs, u8 offset)
{
return ipac_dc_read(cs, offset - 0x80);
}
static void
ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
ipac_dc_write(cs, offset - 0x80, value);
}
static void static void
elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs) elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
{ {
...@@ -382,7 +394,7 @@ elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs) ...@@ -382,7 +394,7 @@ elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
} }
} }
#endif #endif
ista = readreg(cs, cs->hw.elsa.isac, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
Start_IPAC: Start_IPAC:
if (cs->debug & L1_DEB_IPAC) if (cs->debug & L1_DEB_IPAC)
debugl1(cs, "IPAC ISTA %02X", ista); debugl1(cs, "IPAC ISTA %02X", ista);
...@@ -407,15 +419,15 @@ elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs) ...@@ -407,15 +419,15 @@ elsa_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = readreg(cs, cs->hw.elsa.isac, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
if ((ista & 0x3f) && icnt) { if ((ista & 0x3f) && icnt) {
icnt--; icnt--;
goto Start_IPAC; goto Start_IPAC;
} }
if (!icnt) if (!icnt)
printk(KERN_WARNING "ELSA IRQ LOOP\n"); printk(KERN_WARNING "ELSA IRQ LOOP\n");
writereg(cs, cs->hw.elsa.isac, IPAC_MASK, 0xFF); ipac_write(cs, IPAC_MASK, 0xFF);
writereg(cs, cs->hw.elsa.isac, IPAC_MASK, 0xC0); ipac_write(cs, IPAC_MASK, 0xC0);
} }
static void static void
......
...@@ -252,35 +252,20 @@ static struct bc_hw_ops hscx_ops = { ...@@ -252,35 +252,20 @@ static struct bc_hw_ops hscx_ops = {
.write_fifo = hscx_write_fifo, .write_fifo = hscx_write_fifo,
}; };
static void static u8
gazel_interrupt(int intno, void *dev_id, struct pt_regs *regs) ipac_read(struct IsdnCardState *cs, u8 offset)
{ {
#define MAXCOUNT 5 return isac_read(cs, offset - 0x80);
struct IsdnCardState *cs = dev_id;
u8 valisac, valhscx;
int count = 0;
spin_lock(&cs->lock);
do {
valhscx = hscx_read(cs, 1, HSCX_ISTA);
if (valhscx)
hscx_int_main(cs, valhscx);
valisac = isac_read(cs, ISAC_ISTA);
if (valisac)
isac_interrupt(cs, valisac);
count++;
} while ((valhscx || valisac) && (count < MAXCOUNT));
hscx_write(cs, 0, HSCX_MASK, 0xFF);
hscx_write(cs, 1, HSCX_MASK, 0xFF);
isac_write(cs, ISAC_MASK, 0xFF);
isac_write(cs, ISAC_MASK, 0x0);
hscx_write(cs, 0, HSCX_MASK, 0x0);
hscx_write(cs, 1, HSCX_MASK, 0x0);
spin_unlock(&cs->lock);
} }
static void
ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
isac_write(cs, offset - 0x80, value);
}
#define MAXCOUNT 5
static void static void
gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
...@@ -292,7 +277,7 @@ gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -292,7 +277,7 @@ gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
printk(KERN_WARNING "Gazel: Spurious interrupt!\n"); printk(KERN_WARNING "Gazel: Spurious interrupt!\n");
return; return;
} }
ista = readreg_ipac(cs, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
do { do {
if (ista & 0x0f) { if (ista & 0x0f) {
val = hscx_read(cs, 1, HSCX_ISTA); val = hscx_read(cs, 1, HSCX_ISTA);
...@@ -316,13 +301,13 @@ gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -316,13 +301,13 @@ gazel_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = readreg_ipac(cs, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
count++; count++;
} }
while ((ista & 0x3f) && (count < MAXCOUNT)); while ((ista & 0x3f) && (count < MAXCOUNT));
writereg_ipac(cs, IPAC_MASK, 0xFF); ipac_write(cs, IPAC_MASK, 0xFF);
writereg_ipac(cs, IPAC_MASK, 0xC0); ipac_write(cs, IPAC_MASK, 0xC0);
} }
static void static void
...@@ -445,7 +430,7 @@ static struct card_ops gazel_ops = { ...@@ -445,7 +430,7 @@ static struct card_ops gazel_ops = {
.init = gazel_init, .init = gazel_init,
.reset = gazel_reset, .reset = gazel_reset,
.release = gazel_release, .release = gazel_release,
.irq_func = gazel_interrupt, .irq_func = hscxisac_irq,
}; };
static struct card_ops gazel_ipac_ops = { static struct card_ops gazel_ipac_ops = {
......
...@@ -191,13 +191,13 @@ static struct dc_hw_ops isac_ops = { ...@@ -191,13 +191,13 @@ static struct dc_hw_ops isac_ops = {
static u8 static u8
ipac_dc_read(struct IsdnCardState *cs, u8 offset) ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{ {
return readreg(cs, cs->hw.sedl.isac, offset|0x80); return readreg(cs, cs->hw.sedl.isac, offset+0x80);
} }
static void static void
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value) ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{ {
writereg(cs, cs->hw.sedl.isac, offset|0x80, value); writereg(cs, cs->hw.sedl.isac, offset+0x80, value);
} }
static void static void
...@@ -299,17 +299,26 @@ sedlbauer_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -299,17 +299,26 @@ sedlbauer_interrupt(int intno, void *dev_id, struct pt_regs *regs)
hscxisac_irq(intno, dev_id, regs); hscxisac_irq(intno, dev_id, regs);
} }
static u8
ipac_read(struct IsdnCardState *cs, u8 offset)
{
return ipac_dc_read(cs, offset - 0x80);
}
static void
ipac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
ipac_dc_write(cs, offset - 0x80, value);
}
static void static void
sedlbauer_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) sedlbauer_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
{ {
struct IsdnCardState *cs = dev_id; struct IsdnCardState *cs = dev_id;
u8 ista, val, icnt = 5; u8 ista, val, icnt = 5;
if (!cs) { spin_lock(&cs->lock);
printk(KERN_WARNING "Sedlbauer: Spurious interrupt!\n"); ista = ipac_read(cs, IPAC_ISTA);
return;
}
ista = readreg(cs, cs->hw.sedl.isac, IPAC_ISTA);
Start_IPAC: Start_IPAC:
if (cs->debug & L1_DEB_IPAC) if (cs->debug & L1_DEB_IPAC)
debugl1(cs, "IPAC ISTA %02X", ista); debugl1(cs, "IPAC ISTA %02X", ista);
...@@ -334,7 +343,7 @@ sedlbauer_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -334,7 +343,7 @@ sedlbauer_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01; val = 0x01;
isac_interrupt(cs, val); isac_interrupt(cs, val);
} }
ista = readreg(cs, cs->hw.sedl.isac, IPAC_ISTA); ista = ipac_read(cs, IPAC_ISTA);
if ((ista & 0x3f) && icnt) { if ((ista & 0x3f) && icnt) {
icnt--; icnt--;
goto Start_IPAC; goto Start_IPAC;
...@@ -342,8 +351,9 @@ sedlbauer_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs) ...@@ -342,8 +351,9 @@ sedlbauer_ipac_interrupt(int intno, void *dev_id, struct pt_regs *regs)
if (!icnt) if (!icnt)
if (cs->debug & L1_DEB_ISAC) if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "Sedlbauer IRQ LOOP"); debugl1(cs, "Sedlbauer IRQ LOOP");
writereg(cs, cs->hw.sedl.isac, IPAC_MASK, 0xFF); ipac_write(cs, IPAC_MASK, 0xFF);
writereg(cs, cs->hw.sedl.isac, IPAC_MASK, 0xC0); ipac_write(cs, IPAC_MASK, 0xC0);
spin_unlock(&cs->lock);
} }
static void static void
......
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