24 static const char *teles0_revision =
"$Revision: 2.15.2.4 $";
26 #define TELES_IOMEM_SIZE 0x400
27 #define byteout(addr, val) outb(val, addr)
28 #define bytein(addr) inb(addr)
33 return readb(adr + ((off & 1) ? 0x2ff : 0x100) + off);
39 writeb(data, adr + ((off & 1) ? 0x2ff : 0x100) + off);
mb();
46 return readb(adr + (hscx ? 0x1c0 : 0x180) +
47 ((off & 1) ? 0x1ff : 0) + off);
53 writeb(data, adr + (hscx ? 0x1c0 : 0x180) +
54 ((off & 1) ? 0x1ff : 0) + off);
mb();
62 for (i = 0; i <
size; i++)
71 for (i = 0; i <
size; i++) {
77 read_fifo_hscx(
void __iomem *adr,
int hscx,
u_char *data,
int size)
81 for (i = 0; i <
size; i++)
86 write_fifo_hscx(
void __iomem *adr,
int hscx,
u_char *data,
int size)
90 for (i = 0; i <
size; i++) {
100 return (readisac(cs->hw.teles0.membase, offset));
106 writeisac(cs->hw.teles0.membase, offset, value);
110 ReadISACfifo(
struct IsdnCardState *cs,
u_char *data,
int size)
112 read_fifo_isac(cs->hw.teles0.membase, data, size);
116 WriteISACfifo(
struct IsdnCardState *cs,
u_char *data,
int size)
118 write_fifo_isac(cs->hw.teles0.membase, data, size);
124 return (readhscx(cs->hw.teles0.membase, hscx, offset));
130 writehscx(cs->hw.teles0.membase, hscx, offset, value);
137 #define READHSCX(cs, nr, reg) readhscx(cs->hw.teles0.membase, nr, reg)
138 #define WRITEHSCX(cs, nr, reg, data) writehscx(cs->hw.teles0.membase, nr, reg, data)
139 #define READHSCXFIFO(cs, nr, ptr, cnt) read_fifo_hscx(cs->hw.teles0.membase, nr, ptr, cnt)
140 #define WRITEHSCXFIFO(cs, nr, ptr, cnt) write_fifo_hscx(cs->hw.teles0.membase, nr, ptr, cnt)
145 teles0_interrupt(
int intno,
void *
dev_id)
147 struct IsdnCardState *cs =
dev_id;
153 val = readhscx(cs->hw.teles0.membase, 1,
HSCX_ISTA);
156 hscx_int_main(cs, val);
157 val = readisac(cs->hw.teles0.membase,
ISAC_ISTA);
162 val = readhscx(cs->hw.teles0.membase, 1,
HSCX_ISTA);
163 if (val && count < 5) {
164 if (cs->debug & L1_DEB_HSCX)
165 debugl1(cs,
"HSCX IntStat after IntRoutine");
168 val = readisac(cs->hw.teles0.membase,
ISAC_ISTA);
169 if (val && count < 5) {
170 if (cs->debug & L1_DEB_ISAC)
171 debugl1(cs,
"ISAC IntStat after IntRoutine");
174 writehscx(cs->hw.teles0.membase, 0,
HSCX_MASK, 0xFF);
175 writehscx(cs->hw.teles0.membase, 1,
HSCX_MASK, 0xFF);
176 writeisac(cs->hw.teles0.membase,
ISAC_MASK, 0xFF);
177 writeisac(cs->hw.teles0.membase,
ISAC_MASK, 0x0);
178 writehscx(cs->hw.teles0.membase, 0,
HSCX_MASK, 0x0);
179 writehscx(cs->hw.teles0.membase, 1,
HSCX_MASK, 0x0);
180 spin_unlock_irqrestore(&cs->lock, flags);
185 release_io_teles0(
struct IsdnCardState *cs)
187 if (cs->hw.teles0.cfg_reg)
189 iounmap(cs->hw.teles0.membase);
194 reset_teles0(
struct IsdnCardState *cs)
198 if (cs->hw.teles0.cfg_reg) {
228 cfval |= ((cs->hw.teles0.phymem >> 9) & 0xF0);
229 byteout(cs->hw.teles0.cfg_reg + 4, cfval);
231 byteout(cs->hw.teles0.cfg_reg + 4, cfval | 1);
234 writeb(0, cs->hw.teles0.membase + 0x80);
mb();
236 writeb(1, cs->hw.teles0.membase + 0x80);
mb();
242 Teles_card_msg(
struct IsdnCardState *cs,
int mt,
void *
arg)
250 spin_unlock_irqrestore(&cs->lock, flags);
253 release_io_teles0(cs);
258 spin_unlock_irqrestore(&cs->lock, flags);
270 struct IsdnCardState *cs = card->
cs;
273 strcpy(tmp, teles0_revision);
279 cs->hw.teles0.cfg_reg = card->
para[2];
281 cs->hw.teles0.cfg_reg = 0;
283 if (card->
para[1] < 0x10000) {
286 "Teles0: membase configured DOSish, assuming 0x%lx\n",
287 (
unsigned long) card->
para[1]);
289 cs->irq = card->
para[0];
290 if (cs->hw.teles0.cfg_reg) {
293 "HiSax: %s config port %x-%x already in use\n",
295 cs->hw.teles0.cfg_reg,
296 cs->hw.teles0.cfg_reg + 8);
300 if (cs->hw.teles0.cfg_reg) {
301 if ((val =
bytein(cs->hw.teles0.cfg_reg + 0)) != 0x51) {
303 cs->hw.teles0.cfg_reg + 0, val);
307 if ((val =
bytein(cs->hw.teles0.cfg_reg + 1)) != 0x93) {
309 cs->hw.teles0.cfg_reg + 1, val);
313 val =
bytein(cs->hw.teles0.cfg_reg + 2);
317 if (val != 0x1e && val != 0x1f) {
319 cs->hw.teles0.cfg_reg + 2, val);
326 cs->hw.teles0.phymem = card->
para[1];
329 "HiSax: %s memory region %lx-%lx already in use\n",
331 cs->hw.teles0.phymem,
333 if (cs->hw.teles0.cfg_reg)
339 "HiSax: %s config irq:%d mem:%p cfg:0x%X\n",
341 cs->hw.teles0.membase, cs->hw.teles0.cfg_reg);
342 if (reset_teles0(cs)) {
344 release_io_teles0(cs);
350 cs->readisacfifo = &ReadISACfifo;
351 cs->writeisacfifo = &WriteISACfifo;
354 cs->BC_Send_Data = &hscx_fill_fifo;
355 cs->cardmsg = &Teles_card_msg;
356 cs->irq_func = &teles0_interrupt;
360 "Teles0: wrong HSCX versions check IO/MEM addresses\n");
361 release_io_teles0(cs);