21 static const char *sportster_revision =
"$Revision: 1.16.2.4 $";
23 #define byteout(addr, val) outb(val, addr)
24 #define bytein(addr) inb(addr)
26 #define SPORTSTER_ISAC 0xC000
27 #define SPORTSTER_HSCXA 0x0000
28 #define SPORTSTER_HSCXB 0x4000
29 #define SPORTSTER_RES_IRQ 0x8000
30 #define SPORTSTER_RESET 0x80
31 #define SPORTSTER_INTE 0x40
34 calc_off(
unsigned int base,
unsigned int off)
36 return (base + ((off & 0xfc) << 8) + ((off & 3) << 1));
42 insb(adr, data, size);
48 outsb(adr, data, size);
56 return (
bytein(calc_off(cs->hw.spt.isac, offset)));
62 byteout(calc_off(cs->hw.spt.isac, offset), value);
68 read_fifo(cs->hw.spt.isac, data, size);
74 write_fifo(cs->hw.spt.isac, data, size);
80 return (
bytein(calc_off(cs->hw.spt.hscx[hscx], offset)));
86 byteout(calc_off(cs->hw.spt.hscx[hscx], offset), value);
93 #define READHSCX(cs, nr, reg) bytein(calc_off(cs->hw.spt.hscx[nr], reg))
94 #define WRITEHSCX(cs, nr, reg, data) byteout(calc_off(cs->hw.spt.hscx[nr], reg), data)
95 #define READHSCXFIFO(cs, nr, ptr, cnt) read_fifo(cs->hw.spt.hscx[nr], ptr, cnt)
96 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) write_fifo(cs->hw.spt.hscx[nr], ptr, cnt)
101 sportster_interrupt(
int intno,
void *
dev_id)
103 struct IsdnCardState *cs =
dev_id;
111 hscx_int_main(cs, val);
118 if (cs->debug & L1_DEB_HSCX)
119 debugl1(cs,
"HSCX IntStat after IntRoutine");
124 if (cs->debug & L1_DEB_ISAC)
125 debugl1(cs,
"ISAC IntStat after IntRoutine");
130 spin_unlock_irqrestore(&cs->lock, flags);
135 release_io_sportster(
struct IsdnCardState *cs)
140 for (i = 0; i < 64; i++) {
141 adr = cs->hw.spt.cfg_reg + i * 1024;
147 reset_sportster(
struct IsdnCardState *cs)
158 Sportster_card_msg(
struct IsdnCardState *cs,
int mt,
void *
arg)
166 spin_unlock_irqrestore(&cs->lock, flags);
169 release_io_sportster(cs);
178 spin_unlock_irqrestore(&cs->lock, flags);
187 get_io_range(
struct IsdnCardState *cs)
191 for (i = 0; i < 64; i++) {
192 adr = cs->hw.spt.cfg_reg + i * 1024;
195 "%x-%x already in use\n",
203 for (j = 0; j <
i; j++) {
204 adr = cs->hw.spt.cfg_reg + j * 1024;
214 struct IsdnCardState *cs = card->
cs;
217 strcpy(tmp, sportster_revision);
222 cs->hw.spt.cfg_reg = card->
para[1];
223 cs->irq = card->
para[0];
224 if (!get_io_range(cs))
231 case 5: cs->hw.spt.res_irq = 1;
233 case 7: cs->hw.spt.res_irq = 2;
235 case 10:cs->hw.spt.res_irq = 3;
237 case 11:cs->hw.spt.res_irq = 4;
239 case 12:cs->hw.spt.res_irq = 5;
241 case 14:cs->hw.spt.res_irq = 6;
243 case 15:cs->hw.spt.res_irq = 7;
245 default:release_io_sportster(cs);
250 cs->irq, cs->hw.spt.cfg_reg);
254 cs->readisacfifo = &ReadISACfifo;
255 cs->writeisacfifo = &WriteISACfifo;
258 cs->BC_Send_Data = &hscx_fill_fifo;
259 cs->cardmsg = &Sportster_card_msg;
260 cs->irq_func = &sportster_interrupt;
264 "Sportster: wrong HSCX versions check IO address\n");
265 release_io_sportster(cs);