19 static const char *avm_revision =
"$Revision: 2.15.2.4 $";
21 #define AVM_A1_STAT_ISAC 0x01
22 #define AVM_A1_STAT_HSCX 0x02
23 #define AVM_A1_STAT_TIMER 0x04
25 #define byteout(addr, val) outb(val, addr)
26 #define bytein(addr) inb(addr)
31 return (
bytein(adr + off));
44 insb(adr, data, size);
50 outsb(adr, data, size);
58 return (
readreg(cs->hw.avm.isac, offset));
64 writereg(cs->hw.avm.isac, offset, value);
70 read_fifo(cs->hw.avm.isacfifo, data, size);
76 write_fifo(cs->hw.avm.isacfifo, data, size);
82 return (
readreg(cs->hw.avm.hscx[hscx], offset));
88 writereg(cs->hw.avm.hscx[hscx], offset, value);
95 #define READHSCX(cs, nr, reg) readreg(cs->hw.avm.hscx[nr], reg)
96 #define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.avm.hscx[nr], reg, data)
97 #define READHSCXFIFO(cs, nr, ptr, cnt) read_fifo(cs->hw.avm.hscxfifo[nr], ptr, cnt)
98 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) write_fifo(cs->hw.avm.hscxfifo[nr], ptr, cnt)
103 avm_a1_interrupt(
int intno,
void *
dev_id)
105 struct IsdnCardState *cs =
dev_id;
110 while (((sval =
bytein(cs->hw.avm.cfg_reg)) & 0xf) != 0x7) {
112 byteout(cs->hw.avm.cfg_reg, 0x1E);
113 sval =
bytein(cs->hw.avm.cfg_reg);
114 }
else if (cs->debug & L1_DEB_INTSTAT)
115 debugl1(cs,
"avm IntStatus %x", sval);
119 hscx_int_main(cs, val);
133 spin_unlock_irqrestore(&cs->lock, flags);
138 release_ioregs(
struct IsdnCardState *cs,
int mask)
156 AVM_card_msg(
struct IsdnCardState *cs,
int mt,
void *
arg)
164 release_ioregs(cs, 0x3f);
169 byteout(cs->hw.avm.cfg_reg, 0x16);
170 byteout(cs->hw.avm.cfg_reg, 0x1E);
172 spin_unlock_irqrestore(&cs->lock, flags);
184 struct IsdnCardState *cs = card->
cs;
187 strcpy(tmp, avm_revision);
192 cs->hw.avm.cfg_reg = card->
para[1] + 0x1800;
193 cs->hw.avm.isac = card->
para[1] + 0x1400 - 0x20;
194 cs->hw.avm.hscx[0] = card->
para[1] + 0x400 - 0x20;
195 cs->hw.avm.hscx[1] = card->
para[1] + 0xc00 - 0x20;
196 cs->hw.avm.isacfifo = card->
para[1] + 0x1000;
197 cs->hw.avm.hscxfifo[0] = card->
para[1];
198 cs->hw.avm.hscxfifo[1] = card->
para[1] + 0x800;
199 cs->irq = card->
para[0];
202 "HiSax: AVM A1 config port %x-%x already in use\n",
204 cs->hw.avm.cfg_reg + 8);
209 "HiSax: AVM A1 isac ports %x-%x already in use\n",
210 cs->hw.avm.isac + 32,
211 cs->hw.avm.isac + 64);
212 release_ioregs(cs, 0);
217 "HiSax: AVM A1 isac fifo port %x already in use\n",
218 cs->hw.avm.isacfifo);
219 release_ioregs(cs, 1);
222 if (!
request_region(cs->hw.avm.hscx[0] + 32, 32,
"HiSax hscx A")) {
224 "HiSax: AVM A1 hscx A ports %x-%x already in use\n",
225 cs->hw.avm.hscx[0] + 32,
226 cs->hw.avm.hscx[0] + 64);
227 release_ioregs(cs, 3);
230 if (!
request_region(cs->hw.avm.hscxfifo[0], 1,
"HiSax hscx A fifo")) {
232 "HiSax: AVM A1 hscx A fifo port %x already in use\n",
233 cs->hw.avm.hscxfifo[0]);
234 release_ioregs(cs, 7);
237 if (!
request_region(cs->hw.avm.hscx[1] + 32, 32,
"HiSax hscx B")) {
239 "HiSax: AVM A1 hscx B ports %x-%x already in use\n",
240 cs->hw.avm.hscx[1] + 32,
241 cs->hw.avm.hscx[1] + 64);
242 release_ioregs(cs, 0xf);
245 if (!
request_region(cs->hw.avm.hscxfifo[1], 1,
"HiSax hscx B fifo")) {
247 "HiSax: AVM A1 hscx B fifo port %x already in use\n",
248 cs->hw.avm.hscxfifo[1]);
249 release_ioregs(cs, 0x1f);
252 byteout(cs->hw.avm.cfg_reg, 0x0);
254 byteout(cs->hw.avm.cfg_reg, 0x1);
256 byteout(cs->hw.avm.cfg_reg, 0x0);
261 byteout(cs->hw.avm.cfg_reg + 1, val);
263 byteout(cs->hw.avm.cfg_reg, 0x0);
266 val =
bytein(cs->hw.avm.cfg_reg);
268 cs->hw.avm.cfg_reg, val);
269 val =
bytein(cs->hw.avm.cfg_reg + 3);
271 cs->hw.avm.cfg_reg + 3, val);
272 val =
bytein(cs->hw.avm.cfg_reg + 2);
274 cs->hw.avm.cfg_reg + 2, val);
275 val =
bytein(cs->hw.avm.cfg_reg);
277 cs->hw.avm.cfg_reg, val);
283 "HiSax: isac:0x%X/0x%X\n",
284 cs->hw.avm.isac + 32, cs->hw.avm.isacfifo);
286 "HiSax: hscx A:0x%X/0x%X hscx B:0x%X/0x%X\n",
287 cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscxfifo[0],
288 cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscxfifo[1]);
292 cs->readisacfifo = &ReadISACfifo;
293 cs->writeisacfifo = &WriteISACfifo;
296 cs->BC_Send_Data = &hscx_fill_fifo;
298 cs->cardmsg = &AVM_card_msg;
299 cs->irq_func = &avm_a1_interrupt;
303 "AVM A1: wrong HSCX versions check IO address\n");
304 release_ioregs(cs, 0x3f);