Commit 79fd58c5 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Move chipset init code into *_setup() functions

This is just again moving some common code into shared places,
let the chip-specific driver check the versions instead of having
every card-specific driver do so.
parent 7d2012ed
......@@ -804,3 +804,12 @@ Amd7930_init(struct IsdnCardState *cs)
}
}
}
int
amd7930_setup(struct IsdnCardState *cs, struct dc_hw_ops *amd7930_ops,
void (*set_irq_mask)(struct IsdnCardState *, u8 val))
{
cs->dc_hw_ops = amd7930_ops;
cs->dc.amd7930.setIrqMask = set_irq_mask;
return 0;
}
......@@ -18,5 +18,7 @@
#define DBUSY_TIMER_VALUE 80
extern void Amd7930_interrupt(struct IsdnCardState *cs, unsigned char irflags);
extern void Amd7930_init(struct IsdnCardState *cs);
void Amd7930_interrupt(struct IsdnCardState *cs, unsigned char irflags);
void Amd7930_init(struct IsdnCardState *cs);
int amd7930_setup(struct IsdnCardState *cs, struct dc_hw_ops *amd7930_ops,
void (*set_irq_mask)(struct IsdnCardState *, u8 val));
......@@ -314,10 +314,8 @@ setup_asuscom(struct IsdnCard *card)
cs->subtyp = ASUS_IPAC;
cs->card_ops = &asuscom_ipac_ops;
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->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &ipac_bc_ops;
printk(KERN_INFO "Asus: IPAC version %x\n", val);
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
} else {
cs->subtyp = ASUS_ISACHSCX;
cs->card_ops = &asuscom_ops;
......@@ -326,14 +324,8 @@ setup_asuscom(struct IsdnCard *card)
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.pots = cs->hw.asus.cfg_reg + ASUS_CTRL_POTS;
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
ISACVersion(cs, "ISDNLink:");
if (HscxVersion(cs, "ISDNLink:")) {
printk(KERN_WARNING
"ISDNLink: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
}
printk(KERN_INFO "ISDNLink: resetting card\n");
cs->card_ops->reset(cs);
......
......@@ -228,15 +228,9 @@ setup_avm_a1(struct IsdnCard *card)
cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscxfifo[0],
cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscxfifo[1]);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &avm_a1_ops;
ISACVersion(cs, "AVM A1:");
if (HscxVersion(cs, "AVM A1:")) {
printk(KERN_WARNING
"AVM A1: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return 1;
err:
hisax_release_resources(cs);
......
......@@ -225,7 +225,7 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
strcpy(tmp, avm_revision);
printk(KERN_INFO "HiSax: AVM A1 PCMCIA driver Rev. %s\n",
HiSax_getrev(tmp));
HiSax_getrev(tmp));
cs->hw.avm.cfg_reg = card->para[1];
cs->irq = card->para[0];
......@@ -246,15 +246,9 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
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->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &avm_a1p_ops;
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
return 0;
ISACVersion(cs, "AVM A1 PCMCIA:");
if (HscxVersion(cs, "AVM A1 PCMCIA:")) {
printk(KERN_WARNING
"AVM A1 PCMCIA: wrong HSCX versions check IO address\n");
return (0);
}
return (1);
return 1;
}
......@@ -700,11 +700,10 @@ setup_avm_pcipnp(struct IsdnCard *card)
(cs->subtyp == AVM_FRITZ_PCI) ? "AVM Fritz!PCI" : "AVM Fritz!PnP",
cs->irq, cs->hw.avm.cfg_reg);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hdlc_hw_ops;
cs->bc_l1_ops = &hdlc_l1_ops;
cs->card_ops = &avm_pci_ops;
ISACVersion(cs, (cs->subtyp == AVM_FRITZ_PCI) ? "AVM PCI:" : "AVM PnP:");
isac_setup(cs, &isac_ops);
return 1;
err:
hisax_release_resources(cs);
......
......@@ -308,12 +308,9 @@ setup_bkm_a4t(struct IsdnCard *card)
CardType[card->typ], cs->hw.ax.base, cs->irq);
reset_bkm(cs);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &jade_ops;
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &bkm_a4t_ops;
ISACVersion(cs, "Telekom A4T:");
/* Jade version */
JadeVersion(cs, "Telekom A4T:");
return (1);
isac_setup(cs, &isac_ops);
jade_setup(cs, &jade_ops);
return 1;
}
......@@ -287,14 +287,10 @@ setup_sct_quadro(struct IsdnCard *card)
cs->hw.ax.data_adr,
cs->irq);
cs->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &ipac_bc_ops;
cs->card_ops = &bkm_a8_ops;
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
printk(KERN_INFO "HiSax: %s (%s): IPAC Version %d\n",
CardType[card->typ],
sct_quadro_subtypes[cs->subtyp],
ipac_read(cs, IPAC_ID));
return 1;
err:
hisax_release_resources(cs);
......
......@@ -725,39 +725,27 @@ setup_diva(struct IsdnCard *card)
}
if (cs->subtyp == DIVA_IPAC_ISA) {
diva_ipac_isa_reset(cs);
cs->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &ipac_bc_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);
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
} 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_ipac_bc_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);
if (ipac_setup(cs, &mem_ipac_dc_ops, &mem_ipac_bc_ops))
goto err;
} 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);
if (ipacx_setup(cs, &ipacx_dc_ops, &ipacx_bc_ops))
goto err;
} 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);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &diva_ops;
ISACVersion(cs, "Diva:");
if (HscxVersion(cs, "Diva:")) {
printk(KERN_WARNING
"Diva: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
}
return 1;
err:
......
......@@ -1048,21 +1048,13 @@ setup_elsa(struct IsdnCard *card)
}
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->bc_hw_ops = &ipac_bc_ops;
cs->card_ops = &elsa_ipac_ops;
val = readreg(cs, cs->hw.elsa.isac, IPAC_ID);
printk(KERN_INFO "Elsa: IPAC version %x\n", val);
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
} else {
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &elsa_ops;
ISACVersion(cs, "Elsa:");
if (HscxVersion(cs, "Elsa:")) {
printk(KERN_WARNING
"Elsa: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
}
if (cs->subtyp == ELSA_PC) {
val = readitac(cs, ITAC_SYS);
......
......@@ -110,13 +110,14 @@ WriteByteAmd7930(struct IsdnCardState *cs, BYTE offset, BYTE value)
}
static struct dc_hw_ops enternow_ops = {
static struct dc_hw_ops amd7930_ops = {
.read_reg = ReadByteAmd7930,
.write_reg = WriteByteAmd7930,
};
void
enpci_setIrqMask(struct IsdnCardState *cs, BYTE val) {
static void
enpci_setIrqMask(struct IsdnCardState *cs, BYTE val)
{
if (!val)
OutByte(cs->hw.njet.base+NETJET_IRQMASK1, 0x00);
else
......@@ -339,8 +340,7 @@ setup_enternow_pci(struct IsdnCard *card)
cs->hw.njet.last_is0 = 0;
cs->hw.njet.bc_activate = enpci_bc_activate;
cs->hw.njet.bc_deactivate = enpci_bc_deactivate;
cs->dc_hw_ops = &enternow_ops;
cs->dc.amd7930.setIrqMask = &enpci_setIrqMask;
amd7930_setup(cs, &amd7930_ops, &enpci_setIrqMask);
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &enpci_ops;
......
......@@ -525,7 +525,6 @@ setup_gazel(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
u8 val;
strcpy(tmp, gazel_revision);
printk(KERN_INFO "Gazel: Driver Revision %s\n", HiSax_getrev(tmp));
......@@ -542,22 +541,15 @@ setup_gazel(struct IsdnCard *card)
case R647:
case R685:
if (cs->subtyp == R647) {
cs->dc_hw_ops = &r647_isac_ops;
cs->bc_hw_ops = &r647_hscx_ops;
cs->card_ops = &r647_ops;
if (hscxisac_setup(cs, &r647_isac_ops, &r647_hscx_ops))
goto err;
} else {
cs->dc_hw_ops = &r685_isac_ops;
cs->bc_hw_ops = &r685_hscx_ops;
cs->card_ops = &r685_ops;
if (hscxisac_setup(cs, &r685_isac_ops, &r685_hscx_ops))
goto err;
}
cs->card_ops->reset(cs);
ISACVersion(cs, "Gazel:");
if (HscxVersion(cs, "Gazel:")) {
printk(KERN_WARNING
"Gazel: wrong HSCX versions check IO address\n");
cs->card_ops->release(cs);
return (0);
}
break;
case R742:
case R753:
......@@ -566,13 +558,13 @@ setup_gazel(struct IsdnCard *card)
} else {
cs->card_ops = &r753_ops;
}
cs->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &ipac_bc_ops;
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
cs->card_ops->reset(cs);
val = ipac_read(cs, IPAC_ID);
printk(KERN_INFO "Gazel: IPAC version %x\n", val);
break;
}
return 1;
err:
hisax_release_resources(cs);
return 0;
}
......@@ -572,3 +572,10 @@ releasehfc(struct IsdnCardState *cs)
cs->bcs[1].hw.hfc.send = NULL;
}
}
int
hfc_setup(struct IsdnCardState *cs, struct bc_hw_ops *hfc_ops)
{
cs->bc_hw_ops = hfc_ops;
return 0;
}
......@@ -58,3 +58,4 @@
extern void main_irq_hfc(struct BCState *bcs);
extern void inithfc(struct IsdnCardState *cs);
extern void releasehfc(struct IsdnCardState *cs);
extern int hfc_setup(struct IsdnCardState *cs, struct bc_hw_ops *hfc_ops);
......@@ -45,7 +45,7 @@ hscx_write_fifo(struct BCState *bcs, u8 *p, int len)
cs->bc_hw_ops->write_fifo(cs, bcs->unit, p, len);
}
int __init
static int
HscxVersion(struct IsdnCardState *cs, char *s)
{
int verA, verB;
......@@ -230,11 +230,24 @@ inithscx(struct IsdnCardState *cs)
hscx_write(&cs->bcs[1], HSCX_MASK, 0x0);
}
void __init
void
inithscxisac(struct IsdnCardState *cs)
{
initisac(cs);
inithscx(cs);
}
int
hscxisac_setup(struct IsdnCardState *cs, struct dc_hw_ops *isac_ops,
struct bc_hw_ops *hscx_ops)
{
isac_setup(cs, isac_ops);
cs->bc_hw_ops = hscx_ops;
if (HscxVersion(cs, "HiSax:")) {
printk(KERN_WARNING "HiSax: invalid HSCX version\n");
return -ENODEV;
}
return 0;
}
#include "hscx_irq.c"
......@@ -34,8 +34,10 @@
#define HSCX_RLCR 0x2e
#define HSCX_MASK 0x20
extern int HscxVersion(struct IsdnCardState *cs, char *s);
extern void modehscx(struct BCState *bcs, int mode, int bc);
extern void inithscxisac(struct IsdnCardState *cs);
extern void hscx_int_main(struct IsdnCardState *cs, u8 val);
extern void hscxisac_irq(int intno, void *dev_id, struct pt_regs *regs);
extern int hscxisac_setup(struct IsdnCardState *cs,
struct dc_hw_ops *isac_ops,
struct bc_hw_ops *hscx_ops);
......@@ -51,7 +51,7 @@ icc_write_fifo(struct IsdnCardState *cs, u8 *p, int len)
static char *ICCVer[] __initdata =
{"2070 A1/A3", "2070 B1", "2070 B2/B3", "2070 V2.4"};
void
static void
ICCVersion(struct IsdnCardState *cs, char *s)
{
int val;
......@@ -558,3 +558,11 @@ initicc(struct IsdnCardState *cs)
icc_write_reg(cs, ICC_MASK, 0x0);
ph_command(cs, ICC_CMD_DI);
}
int
icc_setup(struct IsdnCardState *cs, struct dc_hw_ops *icc_ops)
{
cs->dc_hw_ops = icc_ops;
ICCVersion(cs, "HiSax:");
return 0;
}
......@@ -65,6 +65,6 @@
#define ICC_IND_AIL 0xE
#define ICC_IND_DC 0xF
extern void ICCVersion(struct IsdnCardState *cs, char *s);
extern int icc_setup(struct IsdnCardState *cs, struct dc_hw_ops *icc_ops);
extern void initicc(struct IsdnCardState *cs);
extern void icc_interrupt(struct IsdnCardState *cs, u8 val);
......@@ -91,3 +91,15 @@ ipac_irq(int intno, void *dev_id, struct pt_regs *regs)
ipac_write(cs, IPAC_MASK, 0xC0);
spin_unlock(&cs->lock);
}
int
ipac_setup(struct IsdnCardState *cs, struct dc_hw_ops *ipac_dc_ops,
struct bc_hw_ops *ipac_bc_ops)
{
u8 val;
cs->dc_hw_ops = ipac_dc_ops;
cs->bc_hw_ops = ipac_bc_ops;
val = ipac_read(cs, IPAC_ID);
printk(KERN_INFO "HiSax: IPAC version %#x\n", val);
}
......@@ -30,6 +30,8 @@
void ipac_init(struct IsdnCardState *cs);
void ipac_irq(int intno, void *dev_id, struct pt_regs *regs);
int ipac_setup(struct IsdnCardState *cs, struct dc_hw_ops *ipac_dc_ops,
struct bc_hw_ops *ipac_bc_ops);
/* Macro to build the needed D- and B-Channel access routines given
* access functions for the IPAC */
......
......@@ -726,5 +726,15 @@ init_ipacx(struct IsdnCardState *cs, int part)
}
}
//----------------- end of file -----------------------
int
ipacx_setup(struct IsdnCardState *cs, struct dc_hw_ops *ipacx_dc_ops,
struct bc_hw_ops *ipacx_bc_ops)
{
u8 val;
cs->dc_hw_ops = ipacx_dc_ops;
cs->bc_hw_ops = ipacx_bc_ops;
val = ipacx_read_reg(cs, IPACX_ID) & 0x3f;
printk(KERN_INFO "HiSax: IPACX Design Id: %#x\n", val);
}
......@@ -157,5 +157,8 @@
extern void init_ipacx(struct IsdnCardState *cs, int part);
extern void interrupt_ipacx(struct IsdnCardState *cs);
extern int ipacx_setup(struct IsdnCardState *cs,
struct dc_hw_ops *ipacx_dc_ops,
struct bc_hw_ops *ipacx_bc_ops);
#endif
......@@ -45,7 +45,7 @@ isac_write_fifo(struct IsdnCardState *cs, u8 *p, int len)
return cs->dc_hw_ops->write_fifo(cs, p, len);
}
void
static void
ISACVersion(struct IsdnCardState *cs, char *s)
{
int val;
......@@ -559,3 +559,11 @@ initisac(struct IsdnCardState *cs)
/* RESET Receiver and Transmitter */
isac_write(cs, ISAC_CMDR, 0x41);
}
int
isac_setup(struct IsdnCardState *cs, struct dc_hw_ops *isac_ops)
{
cs->dc_hw_ops = isac_ops;
ISACVersion(cs, "HiSax:");
return 0;
}
......@@ -63,6 +63,6 @@
#define ISAC_IND_AI10 0xD
#define ISAC_IND_DID 0xF
extern void ISACVersion(struct IsdnCardState *cs, char *s);
extern void initisac(struct IsdnCardState *cs);
extern void isac_interrupt(struct IsdnCardState *cs, u8 val);
extern int isac_setup(struct IsdnCardState *cs, struct dc_hw_ops *isac_ops);
......@@ -25,7 +25,7 @@ const u8 faxmodulation_s[] = "3,24,48,72,73,74,96,97,98,121,122,145,146";
const u8 faxmodulation[] = {3,24,48,72,73,74,96,97,98,121,122,145,146};
#define FAXMODCNT 13
void isar_setup(struct IsdnCardState *cs);
static void __isar_setup(struct IsdnCardState *cs);
static void isar_pump_cmd(struct BCState *bcs, u8 cmd, u8 para);
static inline void ll_deliver_faxstat(struct BCState *bcs, u8 status);
static spinlock_t isar_lock = SPIN_LOCK_UNLOCKED;
......@@ -165,7 +165,7 @@ waitrecmsg(struct IsdnCardState *cs, u8 *len,
return(1);
}
int
static int
ISARVersion(struct IsdnCardState *cs, char *s)
{
int ver;
......@@ -420,7 +420,7 @@ isar_load_firmware(struct IsdnCardState *cs, u8 *buf)
}
}
cs->debug = debug;
isar_setup(cs);
__isar_setup(cs);
ret = 0;
reterror:
cs->debug = debug;
......@@ -1531,7 +1531,7 @@ isar_pump_cmd(struct BCState *bcs, u8 cmd, u8 para)
}
void
isar_setup(struct IsdnCardState *cs)
__isar_setup(struct IsdnCardState *cs)
{
u8 msg;
int i;
......@@ -1754,3 +1754,10 @@ initisar(struct IsdnCardState *cs)
{
cs->bc_l1_ops = &isar_l1_ops;
}
int
isar_setup(struct IsdnCardState *cs, struct bc_hw_ops *isar_ops)
{
cs->bc_hw_ops = isar_ops;
return ISARVersion(cs, "HiSax:");
}
......@@ -207,8 +207,8 @@
#define STFAX_ESCAPE 5
#define STFAX_SILDET 6
extern int ISARVersion(struct IsdnCardState *cs, char *s);
extern void isar_int_main(struct IsdnCardState *cs);
extern void initisar(struct IsdnCardState *cs);
extern void isar_fill_fifo(struct BCState *bcs);
extern int isar_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic);
extern int isar_setup(struct IsdnCardState *cs, struct bc_hw_ops *isar_ops);
......@@ -259,19 +259,13 @@ setup_isurf(struct IsdnCard *card)
cs->auxcmd = &isurf_auxcmd;
cs->card_ops = &isurf_ops;
cs->dc_hw_ops = &isac_ops;
cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r;
cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r;
reset_isurf(cs, ISURF_RESET);
test_and_set_bit(HW_ISAR, &cs->HW_Flags);
ISACVersion(cs, "ISurf:");
cs->bc_hw_ops = &isar_ops;
ver = ISARVersion(cs, "ISurf:");
if (ver < 0) {
printk(KERN_WARNING
"ISurf: wrong ISAR version (ret = %d)\n", ver);
isac_setup(cs, &isac_ops);
if (isar_setup(cs, &isar_ops))
goto err;
}
return 1;
err:
hisax_release_resources(cs);
......
......@@ -235,20 +235,12 @@ setup_ix1micro(struct IsdnCard *card)
if (!request_io(&cs->rs, cs->hw.ix1.cfg_reg, 4, "ix1micro cfg"))
goto err;
printk(KERN_INFO
"HiSax: %s config irq:%d io:0x%X\n",
CardType[cs->typ], cs->irq,
cs->hw.ix1.cfg_reg);
printk(KERN_INFO "HiSax: %s config irq:%d io:0x%X\n",
CardType[cs->typ], cs->irq, cs->hw.ix1.cfg_reg);
ix1_reset(cs);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &ix1_ops;
ISACVersion(cs, "ix1-Micro:");
if (HscxVersion(cs, "ix1-Micro:")) {
printk(KERN_WARNING
"ix1-Micro: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return 1;
err:
hisax_release_resources(cs);
......
......@@ -40,7 +40,7 @@ jade_write_fifo(struct BCState *bcs, u8 *p, int len)
cs->bc_hw_ops->write_fifo(cs, bcs->unit, p, len);
}
int __init
static int
JadeVersion(struct IsdnCardState *cs, char *s)
{
int ver,i;
......@@ -270,4 +270,11 @@ initjade(struct IsdnCardState *cs)
modejade(cs->bcs + 1, 0, 0);
}
int
jade_setup(struct IsdnCardState *cs, struct bc_hw_ops *jade_ops)
{
cs->bc_hw_ops = jade_ops;
return JadeVersion(cs, "HiSax:");
}
#include "jade_irq.c"
......@@ -131,6 +131,7 @@ extern int JadeVersion(struct IsdnCardState *cs, char *s);
extern void jade_sched_event(struct BCState *bcs, int event);
extern void modejade(struct BCState *bcs, int mode, int bc);
extern void initjade(struct IsdnCardState *cs);
extern void jade_int_main(struct IsdnCardState *cs, u_char val, int jade);
extern void jade_int_main(struct IsdnCardState *cs, u8 val, int jade);
extern int jade_setup(struct IsdnCardState *cs, struct bc_hw_ops *jade_ops);
#endif /* __JADE_H__ */
......@@ -156,19 +156,11 @@ setup_mic(struct IsdnCard *card)
if (!request_io(&cs->rs, cs->hw.mic.cfg_reg, 8, "mic isdn"))
goto err;
printk(KERN_INFO
"mic: defined at 0x%x IRQ %d\n",
cs->hw.mic.cfg_reg,
cs->irq);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
printk(KERN_INFO "mic: defined at 0x%x IRQ %d\n",
cs->hw.mic.cfg_reg, cs->irq);
cs->card_ops = &mic_ops;
ISACVersion(cs, "mic:");
if (HscxVersion(cs, "mic:")) {
printk(KERN_WARNING
"mic: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return 1;
err:
hisax_release_resources(cs);
......
......@@ -298,18 +298,12 @@ setup_niccy(struct IsdnCard *card)
goto err;
#endif /* CONFIG_PCI */
}
printk(KERN_INFO
"HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
printk(KERN_INFO "HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
CardType[cs->typ], (cs->subtyp==1) ? "PnP":"PCI",
cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &niccy_ops;
ISACVersion(cs, "Niccy:");
if (HscxVersion(cs, "Niccy:")) {
printk(KERN_WARNING
"Niccy: wrong HSCX versions check IO address\n");
}
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
return 1;
err:
niccy_release(cs);
......
......@@ -194,9 +194,8 @@ setup_netjet_s(struct IsdnCard *card)
return 0;
nj_s_reset(cs);
cs->dc_hw_ops = &netjet_dc_ops;
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &nj_s_ops;
ISACVersion(cs, "NETjet-S:");
isac_setup(cs, &netjet_dc_ops);
return 1;
}
......@@ -190,9 +190,8 @@ setup_netjet_u(struct IsdnCard *card)
return 0;
nj_u_reset(cs);
cs->dc_hw_ops = &netjet_dc_ops;
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &nj_u_ops;
ICCVersion(cs, "NETspider-U:");
icc_setup(cs, &netjet_dc_ops);
return 1;
}
......@@ -197,15 +197,9 @@ setup_s0box(struct IsdnCard *card)
printk(KERN_INFO
"HiSax: hscx A:0x%x hscx B:0x%x\n",
cs->hw.teles3.hscx[0], cs->hw.teles3.hscx[1]);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &s0box_ops;
ISACVersion(cs, "S0Box:");
if (HscxVersion(cs, "S0Box:")) {
printk(KERN_WARNING
"S0Box: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return 1;
err:
hisax_release_resources(cs);
......
......@@ -231,18 +231,13 @@ setup_saphir(struct IsdnCard *card)
cs->hw.saphir.timer.data = (long) cs;
cs->hw.saphir.timer.expires = jiffies + 4*HZ;
add_timer(&cs->hw.saphir.timer);
if (saphir_reset(cs)) {
if (saphir_reset(cs))
goto err;
}
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &saphir_ops;
ISACVersion(cs, "saphir:");
if (HscxVersion(cs, "saphir:")) {
printk(KERN_WARNING
"saphir: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return 1;
err:
saphir_release(cs);
......
......@@ -472,7 +472,7 @@ static struct pci_bus *pnp_c __devinitdata = NULL;
int __devinit
setup_sedlbauer(struct IsdnCard *card)
{
int bytecnt, ver, val;
int bytecnt, val;
struct IsdnCardState *cs = card->cs;
char tmp[64];
u16 sub_vendor_id, sub_id;
......@@ -667,16 +667,12 @@ setup_sedlbauer(struct IsdnCard *card)
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
}
cs->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &ipac_bc_ops;
cs->card_ops = &sedlbauer_ipac_ops;
val = readreg(cs, cs->hw.sedl.isac, IPAC_ID);
printk(KERN_INFO "Sedlbauer: IPAC version %x\n", val);
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
sedlbauer_reset(cs);
} else {
/* ISAC_HSCX oder ISAC_ISAR */
cs->dc_hw_ops = &isac_ops;
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg +
......@@ -702,14 +698,9 @@ setup_sedlbauer(struct IsdnCard *card)
test_and_set_bit(HW_ISAR, &cs->HW_Flags);
cs->card_ops = &sedlbauer_isar_ops;
cs->auxcmd = &isar_auxcmd;
ISACVersion(cs, "Sedlbauer:");
cs->bc_hw_ops = &isar_ops;
ver = ISARVersion(cs, "Sedlbauer:");
if (ver < 0) {
printk(KERN_WARNING
"Sedlbauer: wrong ISAR version (ret = %d)\n", ver);
isac_setup(cs, &isac_ops);
if (isar_setup(cs, &isar_ops))
goto err;
}
} else {
if (cs->hw.sedl.bus == SEDL_BUS_PCMCIA) {
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_ADR;
......@@ -725,14 +716,9 @@ setup_sedlbauer(struct IsdnCard *card)
cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_RESET_OFF;
}
cs->card_ops = &sedlbauer_ops;
cs->bc_hw_ops = &hscx_ops;
ISACVersion(cs, "Sedlbauer:");
if (HscxVersion(cs, "Sedlbauer:")) {
printk(KERN_WARNING
"Sedlbauer: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
sedlbauer_reset(cs);
}
}
......
......@@ -227,21 +227,15 @@ setup_sportster(struct IsdnCard *card)
return(0);
}
sportster_reset(cs);
printk(KERN_INFO
"HiSax: %s config irq:%d cfg:0x%X\n",
CardType[cs->typ], cs->irq,
cs->hw.spt.cfg_reg);
printk(KERN_INFO "HiSax: %s config irq:%d cfg:0x%X\n",
CardType[cs->typ], cs->irq, cs->hw.spt.cfg_reg);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->cardmsg = &Sportster_card_msg;
cs->card_ops = &sportster_ops;
ISACVersion(cs, "Sportster:");
if (HscxVersion(cs, "Sportster:")) {
printk(KERN_WARNING
"Sportster: wrong HSCX versions check IO address\n");
sportster_release(cs);
return (0);
}
return (1);
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
return 1;
err:
hisax_release_resources(cs);
return 0;
}
......@@ -314,11 +314,10 @@ setup_TeleInt(struct IsdnCard *card)
cs->hw.hfc.addr,
cs->irq);
teleint_reset(cs);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hfc_ops;
cs->card_ops = &teleint_ops;
ISACVersion(cs, "TeleInt:");
teleint_reset(cs);
isac_setup(cs, &isac_ops);
hfc_setup(cs, &hfc_ops);
return 1;
err:
teleint_release(cs);
......
......@@ -225,16 +225,10 @@ setup_teles0(struct IsdnCard *card)
printk(KERN_WARNING "Teles0: wrong IRQ\n");
goto err;
}
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &teles0_ops;
ISACVersion(cs, "Teles0:");
if (HscxVersion(cs, "Teles0:")) {
printk(KERN_WARNING
"Teles0: wrong HSCX versions check IO/MEM addresses\n");
goto err;
}
return (1);
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
return 1;
err:
hisax_release_resources(cs);
......
......@@ -336,18 +336,12 @@ setup_teles3(struct IsdnCard *card)
printk(KERN_WARNING "Teles3: wrong IRQ\n");
goto err;
}
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->card_ops = &teles3_ops;
ISACVersion(cs, "Teles3:");
if (HscxVersion(cs, "Teles3:")) {
printk(KERN_WARNING
"Teles3: wrong HSCX versions check IO address\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return (1);
return 1;
err:
hisax_release_resources(cs);
return (0);
return 0;
}
......@@ -275,16 +275,10 @@ setup_telespci(struct IsdnCard *card)
CardType[cs->typ], cs->irq,
cs->hw.teles0.membase);
cs->dc_hw_ops = &isac_ops;
cs->bc_hw_ops = &hscx_ops;
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &telespci_ops;
ISACVersion(cs, "TelesPCI:");
if (HscxVersion(cs, "TelesPCI:")) {
printk(KERN_WARNING
"TelesPCI: wrong HSCX versions check IO/MEM addresses\n");
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
return 1;
err:
hisax_release_resources(cs);
......
......@@ -668,6 +668,23 @@ static int id_idx ;
static struct pci_dev *dev_w6692 __initdata = NULL;
static int
w6692_setup(struct IsdnCardState *cs, struct dc_hw_ops *dc_ops,
struct bc_hw_ops *bc_ops)
{
cs->dc_hw_ops = dc_ops;
cs->bc_hw_ops = bc_ops;
dc_l1_init(cs, &w6692_dc_l1_ops);
cs->bc_l1_ops = &w6692_bc_l1_ops;
W6692Version(cs, "W6692:");
printk(KERN_INFO "W6692 ISTA=0x%X\n", w6692_read_reg(cs, W_ISTA));
printk(KERN_INFO "W6692 IMASK=0x%X\n", w6692_read_reg(cs, W_IMASK));
printk(KERN_INFO "W6692 D_EXIR=0x%X\n", w6692_read_reg(cs, W_D_EXIR));
printk(KERN_INFO "W6692 D_EXIM=0x%X\n", w6692_read_reg(cs, W_D_EXIM));
printk(KERN_INFO "W6692 D_RSTA=0x%X\n", w6692_read_reg(cs, W_D_RSTA));
return 0;
}
int __init
setup_w6692(struct IsdnCard *card)
{
......@@ -733,17 +750,8 @@ setup_w6692(struct IsdnCard *card)
id_list[cs->subtyp].card_name, cs->irq,
cs->hw.w6692.iobase);
cs->dc_hw_ops = &w6692_dc_hw_ops;
cs->bc_hw_ops = &w6692_bc_hw_ops;
dc_l1_init(cs, &w6692_dc_l1_ops);
cs->bc_l1_ops = &w6692_bc_l1_ops;
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &w6692_ops;
W6692Version(cs, "W6692:");
printk(KERN_INFO "W6692 ISTA=0x%X\n", w6692_read_reg(cs, W_ISTA));
printk(KERN_INFO "W6692 IMASK=0x%X\n", w6692_read_reg(cs, W_IMASK));
printk(KERN_INFO "W6692 D_EXIR=0x%X\n", w6692_read_reg(cs, W_D_EXIR));
printk(KERN_INFO "W6692 D_EXIM=0x%X\n", w6692_read_reg(cs, W_D_EXIM));
printk(KERN_INFO "W6692 D_RSTA=0x%X\n", w6692_read_reg(cs, W_D_RSTA));
w6692_setup(cs, &w6692_dc_hw_ops, &w6692_bc_hw_ops);
cs->irq_flags |= SA_SHIRQ;
return (1);
}
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