Commit e54c19cf authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Move isac{read,write}{,fifo} into struct dc_hw_ops

Abstract the D-Channel access operations into a struct dc_hw_ops.
parent 4d0f04d4
...@@ -77,13 +77,13 @@ LOBYTE(u16 w) ...@@ -77,13 +77,13 @@ LOBYTE(u16 w)
static inline u8 static inline u8
rByteAMD(struct IsdnCardState *cs, u8 reg) rByteAMD(struct IsdnCardState *cs, u8 reg)
{ {
return cs->readisac(cs, reg); return cs->dc_hw_ops->read_reg(cs, reg);
} }
static inline void static inline void
wByteAMD(struct IsdnCardState *cs, u8 reg, u8 val) wByteAMD(struct IsdnCardState *cs, u8 reg, u8 val)
{ {
cs->writeisac(cs, reg, val); cs->dc_hw_ops->write_reg(cs, reg, val);
} }
static void static void
......
...@@ -111,6 +111,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -111,6 +111,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.asus.adr, cs->hw.asus.isac, 0, data, size); writefifo(cs->hw.asus.adr, cs->hw.asus.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset) ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset)
{ {
...@@ -135,6 +142,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) ...@@ -135,6 +142,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.asus.adr, cs->hw.asus.isac, 0x80, data, size); writefifo(cs->hw.asus.adr, cs->hw.asus.isac, 0x80, data, size);
} }
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -404,10 +418,7 @@ setup_asuscom(struct IsdnCard *card) ...@@ -404,10 +418,7 @@ setup_asuscom(struct IsdnCard *card)
cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA; cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA;
cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA; cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA;
test_and_set_bit(HW_IPAC, &cs->HW_Flags); test_and_set_bit(HW_IPAC, &cs->HW_Flags);
cs->readisac = &ReadISAC_IPAC; cs->dc_hw_ops = &ipac_dc_ops;
cs->writeisac = &WriteISAC_IPAC;
cs->readisacfifo = &ReadISACfifo_IPAC;
cs->writeisacfifo = &WriteISACfifo_IPAC;
cs->irq_func = &asuscom_interrupt_ipac; cs->irq_func = &asuscom_interrupt_ipac;
printk(KERN_INFO "Asus: IPAC version %x\n", val); printk(KERN_INFO "Asus: IPAC version %x\n", val);
} else { } else {
...@@ -417,10 +428,7 @@ setup_asuscom(struct IsdnCard *card) ...@@ -417,10 +428,7 @@ setup_asuscom(struct IsdnCard *card)
cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_HSCX; cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_HSCX;
cs->hw.asus.u7 = cs->hw.asus.cfg_reg + ASUS_CTRL_U7; cs->hw.asus.u7 = cs->hw.asus.cfg_reg + ASUS_CTRL_U7;
cs->hw.asus.pots = cs->hw.asus.cfg_reg + ASUS_CTRL_POTS; cs->hw.asus.pots = cs->hw.asus.cfg_reg + ASUS_CTRL_POTS;
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->irq_func = &asuscom_interrupt; cs->irq_func = &asuscom_interrupt;
ISACVersion(cs, "ISDNLink:"); ISACVersion(cs, "ISDNLink:");
if (HscxVersion(cs, "ISDNLink:")) { if (HscxVersion(cs, "ISDNLink:")) {
......
...@@ -77,6 +77,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -77,6 +77,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
write_fifo(cs->hw.avm.isacfifo, data, size); write_fifo(cs->hw.avm.isacfifo, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -294,10 +301,7 @@ setup_avm_a1(struct IsdnCard *card) ...@@ -294,10 +301,7 @@ setup_avm_a1(struct IsdnCard *card)
cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscxfifo[0], cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscxfifo[0],
cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscxfifo[1]); cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscxfifo[1]);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
......
...@@ -108,6 +108,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -108,6 +108,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
spin_unlock_irqrestore(&avm_a1p_lock, flags); spin_unlock_irqrestore(&avm_a1p_lock, flags);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static inline u_char static inline u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -275,10 +282,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card) ...@@ -275,10 +282,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
printk(KERN_INFO "AVM A1 PCMCIA: io 0x%x irq %d model %d version %d\n", printk(KERN_INFO "AVM A1 PCMCIA: io 0x%x irq %d model %d version %d\n",
cs->hw.avm.cfg_reg, cs->irq, model, vers); cs->hw.avm.cfg_reg, cs->irq, model, vers);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
......
...@@ -116,6 +116,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -116,6 +116,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
outsb(cs->hw.avm.isac, data, size); outsb(cs->hw.avm.isac, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static inline u_int static inline u_int
ReadHDLCPCI(struct IsdnCardState *cs, int chan, u_char offset) ReadHDLCPCI(struct IsdnCardState *cs, int chan, u_char offset)
{ {
...@@ -764,10 +771,7 @@ setup_avm_pcipnp(struct IsdnCard *card) ...@@ -764,10 +771,7 @@ setup_avm_pcipnp(struct IsdnCard *card)
(cs->subtyp == AVM_FRITZ_PCI) ? "AVM Fritz!PCI" : "AVM Fritz!PnP", (cs->subtyp == AVM_FRITZ_PCI) ? "AVM Fritz!PCI" : "AVM Fritz!PnP",
cs->irq, cs->hw.avm.cfg_reg); cs->irq, cs->hw.avm.cfg_reg);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->BC_Send_Data = &hdlc_fill_fifo; cs->BC_Send_Data = &hdlc_fill_fifo;
cs->cardmsg = &AVM_card_msg; cs->cardmsg = &AVM_card_msg;
cs->irq_func = &avm_pcipnp_interrupt; cs->irq_func = &avm_pcipnp_interrupt;
......
...@@ -104,6 +104,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -104,6 +104,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.ax.isac_ale, cs->hw.ax.isac_adr, 0, data, size); writefifo(cs->hw.ax.isac_ale, cs->hw.ax.isac_adr, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadJADE(struct IsdnCardState *cs, int jade, u_char offset) ReadJADE(struct IsdnCardState *cs, int jade, u_char offset)
{ {
...@@ -332,10 +339,7 @@ setup_bkm_a4t(struct IsdnCard *card) ...@@ -332,10 +339,7 @@ setup_bkm_a4t(struct IsdnCard *card)
CardType[card->typ], cs->hw.ax.base, cs->irq); CardType[card->typ], cs->hw.ax.base, cs->irq);
reset_bkm(cs); reset_bkm(cs);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &jade_ops; cs->bc_hw_ops = &jade_ops;
cs->BC_Send_Data = &jade_fill_fifo; cs->BC_Send_Data = &jade_fill_fifo;
cs->cardmsg = &BKM_card_msg; cs->cardmsg = &BKM_card_msg;
......
...@@ -110,6 +110,12 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -110,6 +110,12 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.ax.base, cs->hw.ax.data_adr, 0x80, data, size); writefifo(cs->hw.ax.base, cs->hw.ax.data_adr, 0x80, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
...@@ -435,11 +441,7 @@ setup_sct_quadro(struct IsdnCard *card) ...@@ -435,11 +441,7 @@ setup_sct_quadro(struct IsdnCard *card)
test_and_set_bit(HW_IPAC, &cs->HW_Flags); test_and_set_bit(HW_IPAC, &cs->HW_Flags);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &BKM_card_msg; cs->cardmsg = &BKM_card_msg;
......
...@@ -166,6 +166,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char *data, int size) ...@@ -166,6 +166,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char *data, int size)
writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0, data, size); writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset) ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset)
{ {
...@@ -190,6 +197,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) ...@@ -190,6 +197,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size); writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size);
} }
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -235,6 +249,13 @@ MemWriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) ...@@ -235,6 +249,13 @@ MemWriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
memwritereg(cs->hw.diva.cfg_reg, 0x80, *data++); memwritereg(cs->hw.diva.cfg_reg, 0x80, *data++);
} }
static struct dc_hw_ops mem_ipac_dc_ops = {
.read_reg = MemReadISAC_IPAC,
.write_reg = MemWriteISAC_IPAC,
.read_fifo = MemReadISACfifo_IPAC,
.write_fifo = MemWriteISACfifo_IPAC,
};
static u_char static u_char
MemReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) MemReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -279,6 +300,13 @@ MemWriteISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size) ...@@ -279,6 +300,13 @@ MemWriteISACfifo_IPACX(struct IsdnCardState *cs, u_char * data, int size)
memwritereg(cs->hw.diva.cfg_reg, 0, *data++); memwritereg(cs->hw.diva.cfg_reg, 0, *data++);
} }
static struct dc_hw_ops mem_ipacx_dc_ops = {
.read_reg = MemReadISAC_IPACX,
.write_reg = MemWriteISAC_IPACX,
.read_fifo = MemReadISACfifo_IPACX,
.write_fifo = MemWriteISACfifo_IPACX,
};
static u_char static u_char
MemReadHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset) MemReadHSCX_IPACX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -1083,28 +1111,19 @@ setup_diva(struct IsdnCard *card) ...@@ -1083,28 +1111,19 @@ setup_diva(struct IsdnCard *card)
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &Diva_card_msg; cs->cardmsg = &Diva_card_msg;
if (cs->subtyp == DIVA_IPAC_ISA) { if (cs->subtyp == DIVA_IPAC_ISA) {
cs->readisac = &ReadISAC_IPAC; cs->dc_hw_ops = &ipac_dc_ops;
cs->writeisac = &WriteISAC_IPAC;
cs->readisacfifo = &ReadISACfifo_IPAC;
cs->writeisacfifo = &WriteISACfifo_IPAC;
cs->irq_func = &diva_irq_ipac_isa; cs->irq_func = &diva_irq_ipac_isa;
val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID); val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val); printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPAC_PCI) { } else if (cs->subtyp == DIVA_IPAC_PCI) {
cs->readisac = &MemReadISAC_IPAC; cs->dc_hw_ops = &mem_ipac_dc_ops;
cs->writeisac = &MemWriteISAC_IPAC;
cs->readisacfifo = &MemReadISACfifo_IPAC;
cs->writeisacfifo = &MemWriteISACfifo_IPAC;
cs->bc_hw_ops = &mem_hscx_ops; cs->bc_hw_ops = &mem_hscx_ops;
cs->BC_Send_Data = &Memhscx_fill_fifo; cs->BC_Send_Data = &Memhscx_fill_fifo;
cs->irq_func = &diva_irq_ipac_pci; cs->irq_func = &diva_irq_ipac_pci;
val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID); val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val); printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPACX_PCI) { } else if (cs->subtyp == DIVA_IPACX_PCI) {
cs->readisac = &MemReadISAC_IPACX; cs->dc_hw_ops = &mem_ipacx_dc_ops;
cs->writeisac = &MemWriteISAC_IPACX;
cs->readisacfifo = &MemReadISACfifo_IPACX;
cs->writeisacfifo = &MemWriteISACfifo_IPACX;
cs->bc_hw_ops = &mem_ipacx_bc_ops; cs->bc_hw_ops = &mem_ipacx_bc_ops;
cs->BC_Send_Data = &ipacx_fill_fifo; cs->BC_Send_Data = &ipacx_fill_fifo;
cs->irq_func = &diva_irq_ipacx_pci; cs->irq_func = &diva_irq_ipacx_pci;
...@@ -1114,10 +1133,7 @@ setup_diva(struct IsdnCard *card) ...@@ -1114,10 +1133,7 @@ setup_diva(struct IsdnCard *card)
cs->hw.diva.tl.function = (void *) diva_led_handler; cs->hw.diva.tl.function = (void *) diva_led_handler;
cs->hw.diva.tl.data = (long) cs; cs->hw.diva.tl.data = (long) cs;
init_timer(&cs->hw.diva.tl); init_timer(&cs->hw.diva.tl);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->irq_func = &diva_interrupt; cs->irq_func = &diva_interrupt;
ISACVersion(cs, "Diva:"); ISACVersion(cs, "Diva:");
if (HscxVersion(cs, "Diva:")) { if (HscxVersion(cs, "Diva:")) {
......
...@@ -210,6 +210,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -210,6 +210,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.elsa.ale, cs->hw.elsa.isac, 0, data, size); writefifo(cs->hw.elsa.ale, cs->hw.elsa.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset) ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset)
{ {
...@@ -234,6 +241,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) ...@@ -234,6 +241,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.elsa.ale, cs->hw.elsa.isac, 0x80, data, size); writefifo(cs->hw.elsa.ale, cs->hw.elsa.isac, 0x80, data, size);
} }
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -1169,18 +1183,12 @@ setup_elsa(struct IsdnCard *card) ...@@ -1169,18 +1183,12 @@ setup_elsa(struct IsdnCard *card)
cs->cardmsg = &Elsa_card_msg; cs->cardmsg = &Elsa_card_msg;
reset_elsa(cs); reset_elsa(cs);
if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI) || (cs->subtyp == ELSA_PCMCIA_IPAC)) { if ((cs->subtyp == ELSA_QS1000PCI) || (cs->subtyp == ELSA_QS3000PCI) || (cs->subtyp == ELSA_PCMCIA_IPAC)) {
cs->readisac = &ReadISAC_IPAC; cs->dc_hw_ops = &ipac_dc_ops;
cs->writeisac = &WriteISAC_IPAC;
cs->readisacfifo = &ReadISACfifo_IPAC;
cs->writeisacfifo = &WriteISACfifo_IPAC;
cs->irq_func = &elsa_interrupt_ipac; cs->irq_func = &elsa_interrupt_ipac;
val = readreg(cs->hw.elsa.ale, cs->hw.elsa.isac, IPAC_ID); val = readreg(cs->hw.elsa.ale, cs->hw.elsa.isac, IPAC_ID);
printk(KERN_INFO "Elsa: IPAC version %x\n", val); printk(KERN_INFO "Elsa: IPAC version %x\n", val);
} else { } else {
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->irq_func = &elsa_interrupt; cs->irq_func = &elsa_interrupt;
ISACVersion(cs, "Elsa:"); ISACVersion(cs, "Elsa:");
if (HscxVersion(cs, "Elsa:")) { if (HscxVersion(cs, "Elsa:")) {
......
...@@ -40,12 +40,3 @@ ...@@ -40,12 +40,3 @@
* den TigerJet i/o-Raum gemappt * den TigerJet i/o-Raum gemappt
* -> 0x01 des AMD bei hw.njet.base + 0C4 */ * -> 0x01 des AMD bei hw.njet.base + 0C4 */
#define TJ_AMD_PORT 0xC0 #define TJ_AMD_PORT 0xC0
/* ***************************************************************************************** *
* *************************************** Prototypen ************************************** *
* ***************************************************************************************** */
BYTE ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset);
void WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value);
...@@ -80,7 +80,7 @@ const char *enternow_pci_rev = "$Revision: 1.1.2.1 $"; ...@@ -80,7 +80,7 @@ const char *enternow_pci_rev = "$Revision: 1.1.2.1 $";
/* cs->readisac, macro rByteAMD */ /* cs->readisac, macro rByteAMD */
BYTE static BYTE
ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset) ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset)
{ {
/* direktes Register */ /* direktes Register */
...@@ -95,7 +95,7 @@ ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset) ...@@ -95,7 +95,7 @@ ReadByteAmd7930(struct IsdnCardState *cs, BYTE offset)
} }
/* cs->writeisac, macro wByteAMD */ /* cs->writeisac, macro wByteAMD */
void static void
WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value) WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value)
{ {
/* direktes Register */ /* direktes Register */
...@@ -110,6 +110,11 @@ WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value) ...@@ -110,6 +110,11 @@ WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value)
} }
static struct dc_hw_ops enternow_ops = {
.read_reg = ReadByteAmd7930,
.write_reg = WriteByteAmd7930,
};
void void
enpci_setIrqMask(struct IsdnCardState *cs, BYTE val) { enpci_setIrqMask(struct IsdnCardState *cs, BYTE val) {
if (!val) if (!val)
...@@ -364,10 +369,7 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -364,10 +369,7 @@ setup_enternow_pci(struct IsdnCard *card)
} }
reset_enpci(cs); reset_enpci(cs);
cs->hw.njet.last_is0 = 0; cs->hw.njet.last_is0 = 0;
/* macro rByteAMD */ cs->dc_hw_ops = &enternow_ops;
cs->readisac = &ReadByteAmd7930;
/* macro wByteAMD */
cs->writeisac = &WriteByteAmd7930;
cs->dc.amd7930.setIrqMask = &enpci_setIrqMask; cs->dc.amd7930.setIrqMask = &enpci_setIrqMask;
cs->BC_Send_Data = &netjet_fill_dma; cs->BC_Send_Data = &netjet_fill_dma;
......
...@@ -175,6 +175,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -175,6 +175,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
} }
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static void static void
ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size) ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u_char * data, int size)
{ {
...@@ -681,10 +688,7 @@ setup_gazel(struct IsdnCard *card) ...@@ -681,10 +688,7 @@ setup_gazel(struct IsdnCard *card)
release_io_gazel(cs); release_io_gazel(cs);
return (0); return (0);
} }
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &Gazel_card_msg; cs->cardmsg = &Gazel_card_msg;
......
...@@ -448,7 +448,7 @@ mode_hfc(struct BCState *bcs, int mode, int bc) ...@@ -448,7 +448,7 @@ mode_hfc(struct BCState *bcs, int mode, int bc)
break; break;
} }
hfc_write_reg(cs, HFC_STATUS, cs->hw.hfc.ctmt, cs->hw.hfc.ctmt); hfc_write_reg(cs, HFC_STATUS, cs->hw.hfc.ctmt, cs->hw.hfc.ctmt);
cs->writeisac(cs, ISAC_SPCR, cs->hw.hfc.isac_spcr); cs->dc_hw_ops->write_reg(cs, ISAC_SPCR, cs->hw.hfc.isac_spcr);
if (mode == L1_MODE_HDLC) if (mode == L1_MODE_HDLC)
hfc_clear_fifo(bcs); hfc_clear_fifo(bcs);
} }
......
...@@ -1473,10 +1473,6 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1473,10 +1473,6 @@ setup_hfcpci(struct IsdnCard *card)
return (0); /* no valid card type */ return (0); /* no valid card type */
cs->readisac = NULL;
cs->writeisac = NULL;
cs->readisacfifo = NULL;
cs->writeisacfifo = NULL;
cs->irq_func = &hfcpci_interrupt; cs->irq_func = &hfcpci_interrupt;
cs->irq_flags |= SA_SHIRQ; cs->irq_flags |= SA_SHIRQ;
......
...@@ -1285,10 +1285,6 @@ setup_hfcsx(struct IsdnCard *card) ...@@ -1285,10 +1285,6 @@ setup_hfcsx(struct IsdnCard *card)
} else } else
return (0); /* no valid card type */ return (0); /* no valid card type */
cs->readisac = NULL;
cs->writeisac = NULL;
cs->readisacfifo = NULL;
cs->writeisacfifo = NULL;
cs->irq_func = &hfcsx_interrupt; cs->irq_func = &hfcsx_interrupt;
cs->hw.hfcsx.timer.function = (void *) hfcsx_Timer; cs->hw.hfcsx.timer.function = (void *) hfcsx_Timer;
......
...@@ -866,6 +866,13 @@ struct icc_chip { ...@@ -866,6 +866,13 @@ struct icc_chip {
u_char adf2; u_char adf2;
}; };
struct dc_hw_ops {
u8 (*read_reg) (struct IsdnCardState *, u8);
void (*write_reg) (struct IsdnCardState *, u8, u8);
void (*read_fifo) (struct IsdnCardState *, u8 *, int);
void (*write_fifo) (struct IsdnCardState *, u8 *, int);
};
#define HW_IOM1 0 #define HW_IOM1 0
#define HW_IPAC 1 #define HW_IPAC 1
#define HW_ISAR 2 #define HW_ISAR 2
...@@ -922,10 +929,7 @@ struct IsdnCardState { ...@@ -922,10 +929,7 @@ struct IsdnCardState {
u_char *status_read; u_char *status_read;
u_char *status_write; u_char *status_write;
u_char *status_end; u_char *status_end;
u_char (*readisac) (struct IsdnCardState *, u_char); struct dc_hw_ops *dc_hw_ops;
void (*writeisac) (struct IsdnCardState *, u_char, u_char);
void (*readisacfifo) (struct IsdnCardState *, u_char *, int);
void (*writeisacfifo) (struct IsdnCardState *, u_char *, int);
struct bc_hw_ops *bc_hw_ops; struct bc_hw_ops *bc_hw_ops;
void (*BC_Send_Data) (struct BCState *); void (*BC_Send_Data) (struct BCState *);
int (*cardmsg) (struct IsdnCardState *, int, void *); int (*cardmsg) (struct IsdnCardState *, int, void *);
......
...@@ -28,25 +28,25 @@ static spinlock_t icc_lock = SPIN_LOCK_UNLOCKED; ...@@ -28,25 +28,25 @@ static spinlock_t icc_lock = SPIN_LOCK_UNLOCKED;
static inline u8 static inline u8
icc_read_reg(struct IsdnCardState *cs, u8 addr) icc_read_reg(struct IsdnCardState *cs, u8 addr)
{ {
return cs->readisac(cs, addr); return cs->dc_hw_ops->read_reg(cs, addr);
} }
static inline void static inline void
icc_write_reg(struct IsdnCardState *cs, u8 addr, u8 val) icc_write_reg(struct IsdnCardState *cs, u8 addr, u8 val)
{ {
cs->writeisac(cs, addr, val); cs->dc_hw_ops->write_reg(cs, addr, val);
} }
static inline void static inline void
icc_read_fifo(struct IsdnCardState *cs, u8 *p, int len) icc_read_fifo(struct IsdnCardState *cs, u8 *p, int len)
{ {
return cs->readisacfifo(cs, p, len); return cs->dc_hw_ops->read_fifo(cs, p, len);
} }
static inline void static inline void
icc_write_fifo(struct IsdnCardState *cs, u8 *p, int len) icc_write_fifo(struct IsdnCardState *cs, u8 *p, int len)
{ {
return cs->writeisacfifo(cs, p, len); return cs->dc_hw_ops->write_fifo(cs, p, len);
} }
static char *ICCVer[] __initdata = static char *ICCVer[] __initdata =
......
...@@ -74,25 +74,25 @@ ipacx_bc_write_reg(struct BCState *bcs, u8 addr, u8 val) ...@@ -74,25 +74,25 @@ ipacx_bc_write_reg(struct BCState *bcs, u8 addr, u8 val)
static inline u8 static inline u8
ipacx_read_reg(struct IsdnCardState *cs, u8 addr) ipacx_read_reg(struct IsdnCardState *cs, u8 addr)
{ {
return cs->readisac(cs, addr); return cs->dc_hw_ops->read_reg(cs, addr);
} }
static inline void static inline void
ipacx_write_reg(struct IsdnCardState *cs, u8 addr, u8 val) ipacx_write_reg(struct IsdnCardState *cs, u8 addr, u8 val)
{ {
cs->writeisac(cs, addr, val); cs->dc_hw_ops->write_reg(cs, addr, val);
} }
static inline void static inline void
ipacx_read_fifo(struct IsdnCardState *cs, u8 *p, int len) ipacx_read_fifo(struct IsdnCardState *cs, u8 *p, int len)
{ {
return cs->readisacfifo(cs, p, len); return cs->dc_hw_ops->read_fifo(cs, p, len);
} }
static inline void static inline void
ipacx_write_fifo(struct IsdnCardState *cs, u8 *p, int len) ipacx_write_fifo(struct IsdnCardState *cs, u8 *p, int len)
{ {
return cs->writeisacfifo(cs, p, len); return cs->dc_hw_ops->write_fifo(cs, p, len);
} }
//---------------------------------------------------------- //----------------------------------------------------------
// Issue Layer 1 command to chip // Issue Layer 1 command to chip
......
...@@ -70,23 +70,23 @@ extern void isac_interrupt(struct IsdnCardState *cs, u_char val); ...@@ -70,23 +70,23 @@ extern void isac_interrupt(struct IsdnCardState *cs, u_char val);
static inline u8 static inline u8
isac_read_reg(struct IsdnCardState *cs, u8 addr) isac_read_reg(struct IsdnCardState *cs, u8 addr)
{ {
return cs->readisac(cs, addr); return cs->dc_hw_ops->read_reg(cs, addr);
} }
static inline void static inline void
isac_write_reg(struct IsdnCardState *cs, u8 addr, u8 val) isac_write_reg(struct IsdnCardState *cs, u8 addr, u8 val)
{ {
cs->writeisac(cs, addr, val); cs->dc_hw_ops->write_reg(cs, addr, val);
} }
static inline void static inline void
isac_read_fifo(struct IsdnCardState *cs, u8 *p, int len) isac_read_fifo(struct IsdnCardState *cs, u8 *p, int len)
{ {
return cs->readisacfifo(cs, p, len); return cs->dc_hw_ops->read_fifo(cs, p, len);
} }
static inline void static inline void
isac_write_fifo(struct IsdnCardState *cs, u8 *p, int len) isac_write_fifo(struct IsdnCardState *cs, u8 *p, int len)
{ {
return cs->writeisacfifo(cs, p, len); return cs->dc_hw_ops->write_fifo(cs, p, len);
} }
...@@ -64,6 +64,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -64,6 +64,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
} }
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
/* ISAR access routines /* ISAR access routines
* mode = 0 access with IRQ on * mode = 0 access with IRQ on
* mode = 1 access with IRQ off * mode = 1 access with IRQ off
...@@ -278,10 +285,7 @@ setup_isurf(struct IsdnCard *card) ...@@ -278,10 +285,7 @@ setup_isurf(struct IsdnCard *card)
cs->cardmsg = &ISurf_card_msg; cs->cardmsg = &ISurf_card_msg;
cs->irq_func = &isurf_interrupt; cs->irq_func = &isurf_interrupt;
cs->auxcmd = &isurf_auxcmd; cs->auxcmd = &isurf_auxcmd;
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r; cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r;
cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r; cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r;
reset_isurf(cs, ISURF_RESET); reset_isurf(cs, ISURF_RESET);
......
...@@ -108,6 +108,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -108,6 +108,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.ix1.isac_ale, cs->hw.ix1.isac, 0, data, size); writefifo(cs->hw.ix1.isac_ale, cs->hw.ix1.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -305,10 +312,7 @@ setup_ix1micro(struct IsdnCard *card) ...@@ -305,10 +312,7 @@ setup_ix1micro(struct IsdnCard *card)
CardType[cs->typ], cs->irq, CardType[cs->typ], cs->irq,
cs->hw.ix1.cfg_reg); cs->hw.ix1.cfg_reg);
ix1_reset(cs); ix1_reset(cs);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &ix1_card_msg; cs->cardmsg = &ix1_card_msg;
......
...@@ -100,6 +100,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -100,6 +100,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.mic.adr, cs->hw.mic.isac, 0, data, size); writefifo(cs->hw.mic.adr, cs->hw.mic.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -233,10 +240,7 @@ setup_mic(struct IsdnCard *card) ...@@ -233,10 +240,7 @@ setup_mic(struct IsdnCard *card)
"mic: defined at 0x%x IRQ %d\n", "mic: defined at 0x%x IRQ %d\n",
cs->hw.mic.cfg_reg, cs->hw.mic.cfg_reg,
cs->irq); cs->irq);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &mic_card_msg; cs->cardmsg = &mic_card_msg;
......
...@@ -66,7 +66,22 @@ NETjet_ReadICfifo(struct IsdnCardState *cs, u_char *data, int size) ...@@ -66,7 +66,22 @@ NETjet_ReadICfifo(struct IsdnCardState *cs, u_char *data, int size)
insb(cs->hw.njet.isac, data, size); insb(cs->hw.njet.isac, data, size);
} }
__u16 fcstab[256] = void
NETjet_WriteICfifo(struct IsdnCardState *cs, u_char *data, int size)
{
cs->hw.njet.auxd &= 0xfc;
byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
outsb(cs->hw.njet.isac, data, size);
}
struct dc_hw_ops netjet_dc_ops = {
.read_reg = NETjet_ReadIC,
.write_reg = NETjet_WriteIC,
.read_fifo = NETjet_ReadICfifo,
.write_fifo = NETjet_WriteICfifo,
};
static u16 fcstab[256] =
{ {
0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
...@@ -102,14 +117,6 @@ __u16 fcstab[256] = ...@@ -102,14 +117,6 @@ __u16 fcstab[256] =
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
}; };
void
NETjet_WriteICfifo(struct IsdnCardState *cs, u_char *data, int size)
{
cs->hw.njet.auxd &= 0xfc;
byteout(cs->hw.njet.auxa, cs->hw.njet.auxd);
outsb(cs->hw.njet.isac, data, size);
}
void fill_mem(struct BCState *bcs, u_int *pos, u_int cnt, int chan, u_char fill) void fill_mem(struct BCState *bcs, u_int *pos, u_int cnt, int chan, u_char fill)
{ {
u_int mask=0x000000ff, val = 0, *p=pos; u_int mask=0x000000ff, val = 0, *p=pos;
......
...@@ -57,6 +57,8 @@ extern const char *CardType[]; ...@@ -57,6 +57,8 @@ extern const char *CardType[];
#define HDLC_FLAG_VALUE 0x7e #define HDLC_FLAG_VALUE 0x7e
extern struct dc_hw_ops netjet_dc_ops;
u_char NETjet_ReadIC(struct IsdnCardState *cs, u_char offset); u_char NETjet_ReadIC(struct IsdnCardState *cs, u_char offset);
void NETjet_WriteIC(struct IsdnCardState *cs, u_char offset, u_char value); void NETjet_WriteIC(struct IsdnCardState *cs, u_char offset, u_char value);
void NETjet_ReadICfifo(struct IsdnCardState *cs, u_char *data, int size); void NETjet_ReadICfifo(struct IsdnCardState *cs, u_char *data, int size);
......
...@@ -115,6 +115,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -115,6 +115,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, 0, data, size); writefifo(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -377,10 +384,7 @@ setup_niccy(struct IsdnCard *card) ...@@ -377,10 +384,7 @@ setup_niccy(struct IsdnCard *card)
"HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n", "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
CardType[cs->typ], (cs->subtyp==1) ? "PnP":"PCI", CardType[cs->typ], (cs->subtyp==1) ? "PnP":"PCI",
cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale); cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &niccy_card_msg; cs->cardmsg = &niccy_card_msg;
......
...@@ -226,10 +226,7 @@ setup_netjet_s(struct IsdnCard *card) ...@@ -226,10 +226,7 @@ setup_netjet_s(struct IsdnCard *card)
request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn"); request_region(cs->hw.njet.base, bytecnt, "netjet-s isdn");
} }
reset_netjet_s(cs); reset_netjet_s(cs);
cs->readisac = &NETjet_ReadIC; cs->dc_hw_ops = &netjet_dc_ops;
cs->writeisac = &NETjet_WriteIC;
cs->readisacfifo = &NETjet_ReadICfifo;
cs->writeisacfifo = &NETjet_WriteICfifo;
cs->BC_Send_Data = &netjet_fill_dma; cs->BC_Send_Data = &netjet_fill_dma;
cs->cardmsg = &NETjet_S_card_msg; cs->cardmsg = &NETjet_S_card_msg;
cs->irq_func = &netjet_s_interrupt; cs->irq_func = &netjet_s_interrupt;
......
...@@ -107,7 +107,7 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg) ...@@ -107,7 +107,7 @@ NETjet_U_card_msg(struct IsdnCardState *cs, int mt, void *arg)
inittiger(cs); inittiger(cs);
initicc(cs); initicc(cs);
/* Reenable all IRQ */ /* Reenable all IRQ */
cs->writeisac(cs, ICC_MASK, 0); NETjet_WriteIC(cs, ICC_MASK, 0);
return(0); return(0);
case CARD_TEST: case CARD_TEST:
return(0); return(0);
...@@ -224,10 +224,7 @@ setup_netjet_u(struct IsdnCard *card) ...@@ -224,10 +224,7 @@ setup_netjet_u(struct IsdnCard *card)
request_region(cs->hw.njet.base, bytecnt, "netspider-u isdn"); request_region(cs->hw.njet.base, bytecnt, "netspider-u isdn");
} }
reset_netjet_u(cs); reset_netjet_u(cs);
cs->readisac = &NETjet_ReadIC; cs->dc_hw_ops = &netjet_dc_ops;
cs->writeisac = &NETjet_WriteIC;
cs->readisacfifo = &NETjet_ReadICfifo;
cs->writeisacfifo = &NETjet_WriteICfifo;
cs->BC_Send_Data = &netjet_fill_dma; cs->BC_Send_Data = &netjet_fill_dma;
cs->cardmsg = &NETjet_U_card_msg; cs->cardmsg = &NETjet_U_card_msg;
cs->irq_func = &netjet_u_interrupt; cs->irq_func = &netjet_u_interrupt;
......
...@@ -125,6 +125,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -125,6 +125,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
write_fifo(cs->hw.teles3.cfg_reg, cs->hw.teles3.isacfifo, data, size); write_fifo(cs->hw.teles3.cfg_reg, cs->hw.teles3.isacfifo, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -253,10 +260,7 @@ setup_s0box(struct IsdnCard *card) ...@@ -253,10 +260,7 @@ setup_s0box(struct IsdnCard *card)
printk(KERN_INFO printk(KERN_INFO
"HiSax: hscx A:0x%x hscx B:0x%x\n", "HiSax: hscx A:0x%x hscx B:0x%x\n",
cs->hw.teles3.hscx[0], cs->hw.teles3.hscx[1]); cs->hw.teles3.hscx[0], cs->hw.teles3.hscx[1]);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &S0Box_card_msg; cs->cardmsg = &S0Box_card_msg;
......
...@@ -100,6 +100,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -100,6 +100,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.saphir.ale, cs->hw.saphir.isac, 0, data, size); writefifo(cs->hw.saphir.ale, cs->hw.saphir.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -177,7 +184,7 @@ static void ...@@ -177,7 +184,7 @@ static void
SaphirWatchDog(struct IsdnCardState *cs) SaphirWatchDog(struct IsdnCardState *cs)
{ {
/* 5 sec WatchDog, so read at least every 4 sec */ /* 5 sec WatchDog, so read at least every 4 sec */
cs->readisac(cs, ISAC_RBCH); ReadISAC(cs, ISAC_RBCH);
mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ); mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ);
} }
...@@ -288,10 +295,7 @@ setup_saphir(struct IsdnCard *card) ...@@ -288,10 +295,7 @@ setup_saphir(struct IsdnCard *card)
release_io_saphir(cs); release_io_saphir(cs);
return (0); return (0);
} }
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &saphir_card_msg; cs->cardmsg = &saphir_card_msg;
......
...@@ -186,6 +186,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -186,6 +186,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0, data, size); writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset) ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset)
{ {
...@@ -210,6 +217,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size) ...@@ -210,6 +217,13 @@ WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size); writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size);
} }
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -751,10 +765,7 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -751,10 +765,7 @@ setup_sedlbauer(struct IsdnCard *card)
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC; cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
} }
test_and_set_bit(HW_IPAC, &cs->HW_Flags); test_and_set_bit(HW_IPAC, &cs->HW_Flags);
cs->readisac = &ReadISAC_IPAC; cs->dc_hw_ops = &ipac_dc_ops;
cs->writeisac = &WriteISAC_IPAC;
cs->readisacfifo = &ReadISACfifo_IPAC;
cs->writeisacfifo = &WriteISACfifo_IPAC;
cs->irq_func = &sedlbauer_interrupt_ipac; cs->irq_func = &sedlbauer_interrupt_ipac;
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ID); val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ID);
...@@ -762,10 +773,7 @@ setup_sedlbauer(struct IsdnCard *card) ...@@ -762,10 +773,7 @@ setup_sedlbauer(struct IsdnCard *card)
reset_sedlbauer(cs); reset_sedlbauer(cs);
} else { } else {
/* ISAC_HSCX oder ISAC_ISAR */ /* ISAC_HSCX oder ISAC_ISAR */
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) { if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
if (cs->hw.sedl.bus == SEDL_BUS_PCI) { if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + cs->hw.sedl.adr = cs->hw.sedl.cfg_reg +
......
...@@ -75,6 +75,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -75,6 +75,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
write_fifo(cs->hw.spt.isac, data, size); write_fifo(cs->hw.spt.isac, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -251,10 +258,7 @@ setup_sportster(struct IsdnCard *card) ...@@ -251,10 +258,7 @@ setup_sportster(struct IsdnCard *card)
CardType[cs->typ], cs->irq, CardType[cs->typ], cs->irq,
cs->hw.spt.cfg_reg); cs->hw.spt.cfg_reg);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &Sportster_card_msg; cs->cardmsg = &Sportster_card_msg;
......
...@@ -139,6 +139,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -139,6 +139,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
writefifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size); writefifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHFC(struct IsdnCardState *cs, int data, u_char reg) ReadHFC(struct IsdnCardState *cs, int data, u_char reg)
{ {
...@@ -324,10 +331,7 @@ setup_TeleInt(struct IsdnCard *card) ...@@ -324,10 +331,7 @@ setup_TeleInt(struct IsdnCard *card)
cs->irq); cs->irq);
reset_TeleInt(cs); reset_TeleInt(cs);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hfc_ops; cs->bc_hw_ops = &hfc_ops;
cs->cardmsg = &TeleInt_card_msg; cs->cardmsg = &TeleInt_card_msg;
cs->irq_func = &TeleInt_interrupt; cs->irq_func = &TeleInt_interrupt;
......
...@@ -120,6 +120,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -120,6 +120,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
write_fifo_isac(cs->hw.teles0.membase, data, size); write_fifo_isac(cs->hw.teles0.membase, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -349,10 +356,7 @@ setup_teles0(struct IsdnCard *card) ...@@ -349,10 +356,7 @@ setup_teles0(struct IsdnCard *card)
release_io_teles0(cs); release_io_teles0(cs);
return (0); return (0);
} }
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &Teles_card_msg; cs->cardmsg = &Teles_card_msg;
......
...@@ -77,6 +77,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -77,6 +77,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
write_fifo(cs->hw.teles3.isacfifo, data, size); write_fifo(cs->hw.teles3.isacfifo, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -471,10 +478,7 @@ setup_teles3(struct IsdnCard *card) ...@@ -471,10 +478,7 @@ setup_teles3(struct IsdnCard *card)
release_io_teles3(cs); release_io_teles3(cs);
return (0); return (0);
} }
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &Teles_card_msg; cs->cardmsg = &Teles_card_msg;
......
...@@ -203,6 +203,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size) ...@@ -203,6 +203,13 @@ WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
write_fifo_isac(cs->hw.teles0.membase, data, size); write_fifo_isac(cs->hw.teles0.membase, data, size);
} }
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u_char static u_char
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset) ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
{ {
...@@ -337,10 +344,7 @@ setup_telespci(struct IsdnCard *card) ...@@ -337,10 +344,7 @@ setup_telespci(struct IsdnCard *card)
CardType[cs->typ], cs->irq, CardType[cs->typ], cs->irq,
cs->hw.teles0.membase); cs->hw.teles0.membase);
cs->readisac = &ReadISAC; cs->dc_hw_ops = &isac_ops;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;
cs->writeisacfifo = &WriteISACfifo;
cs->bc_hw_ops = &hscx_ops; cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo; cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &TelesPCI_card_msg; cs->cardmsg = &TelesPCI_card_msg;
......
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