OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [drivers/] [isdn/] [hisax/] [diva.c] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1626 jcastillo
/* $Id: diva.c,v 1.1 2005-12-20 10:17:01 jcastillo Exp $
2
 
3
 * diva.c     low level stuff for Eicon.Diehl Diva Family ISDN cards
4
 *
5
 * Author     Karsten Keil (keil@isdn4linux.de)
6
 *
7
 * Thanks to Eicon Technology Diehl GmbH & Co. oHG for documents and informations
8
 *
9
 *
10
 * $Log: not supported by cvs2svn $
11
 * Revision 1.1.1.1  2001/09/10 07:44:18  simons
12
 * Initial import
13
 *
14
 * Revision 1.1.1.1  2001/07/02 17:58:32  simons
15
 * Initial revision
16
 *
17
 * Revision 1.1.2.11  1998/11/05 21:13:51  keil
18
 * minor fixes
19
 *
20
 * Revision 1.1.2.10  1998/11/03 00:06:10  keil
21
 * certification related changes
22
 * fixed logging for smaller stack use
23
 *
24
 * Revision 1.1.2.9  1998/06/27 21:58:34  keil
25
 * fix release of diva 2.01
26
 *
27
 * Revision 1.1.2.8  1998/05/27 18:05:11  keil
28
 * HiSax 3.0
29
 *
30
 * Revision 1.1.2.7  1998/04/24 13:37:13  keil
31
 * Support for DIVA 2.01 IPAC
32
 *
33
 * Revision 1.1.2.6  1998/04/08 22:05:21  keil
34
 * Forgot PCI fix
35
 *
36
 * Revision 1.1.2.5  1998/04/08 21:49:27  keil
37
 * New init; fix PCI for more as one card
38
 *
39
 * Revision 1.1.2.4  1998/03/07 23:15:14  tsbogend
40
 * made HiSax working on Linux/Alpha
41
 *
42
 * Revision 1.1.2.3  1998/01/27 22:37:35  keil
43
 * fast io
44
 *
45
 * Revision 1.1.2.2  1997/11/15 18:50:44  keil
46
 * new common init function
47
 *
48
 * Revision 1.1.2.1  1997/10/17 22:10:36  keil
49
 * new files on 2.0
50
 *
51
 * Revision 1.1  1997/09/18 17:11:20  keil
52
 * first version
53
 *
54
 *
55
 */
56
 
57
#define __NO_VERSION__
58
#include <linux/config.h>
59
#include "hisax.h"
60
#include "isac.h"
61
#include "hscx.h"
62
#include "ipac.h"
63
#include "isdnl1.h"
64
#include <linux/pci.h>
65
#include <linux/bios32.h>
66
 
67
extern const char *CardType[];
68
 
69
const char *Diva_revision = "$Revision: 1.1 $";
70
 
71
#define byteout(addr,val) outb(val,addr)
72
#define bytein(addr) inb(addr)
73
 
74
#define DIVA_HSCX_DATA          0
75
#define DIVA_HSCX_ADR           4
76
#define DIVA_ISA_ISAC_DATA      2
77
#define DIVA_ISA_ISAC_ADR       6
78
#define DIVA_ISA_CTRL           7
79
#define DIVA_IPAC_ADR           0
80
#define DIVA_IPAC_DATA          1
81
 
82
#define DIVA_PCI_ISAC_DATA      8
83
#define DIVA_PCI_ISAC_ADR       0xc
84
#define DIVA_PCI_CTRL           0x10
85
 
86
/* SUB Types */
87
#define DIVA_ISA        1
88
#define DIVA_PCI        2
89
#define DIVA_IPAC_ISA   3
90
 
91
/* PCI stuff */
92
#define PCI_VENDOR_EICON_DIEHL  0x1133
93
#define PCI_DIVA20PRO_ID        0xe001
94
#define PCI_DIVA20_ID           0xe002
95
#define PCI_DIVA20PRO_U_ID      0xe003
96
#define PCI_DIVA20_U_ID         0xe004
97
 
98
/* CTRL (Read) */
99
#define DIVA_IRQ_STAT   0x01
100
#define DIVA_EEPROM_SDA 0x02
101
/* CTRL (Write) */
102
#define DIVA_IRQ_REQ    0x01
103
#define DIVA_RESET      0x08
104
#define DIVA_EEPROM_CLK 0x40
105
#define DIVA_PCI_LED_A  0x10
106
#define DIVA_PCI_LED_B  0x20
107
#define DIVA_ISA_LED_A  0x20
108
#define DIVA_ISA_LED_B  0x40
109
#define DIVA_IRQ_CLR    0x80
110
 
111
static inline u_char
112
readreg(unsigned int ale, unsigned int adr, u_char off)
113
{
114
        register u_char ret;
115
        long flags;
116
 
117
        save_flags(flags);
118
        cli();
119
        byteout(ale, off);
120
        ret = bytein(adr);
121
        restore_flags(flags);
122
        return (ret);
123
}
124
 
125
static inline void
126
readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size)
127
{
128
        /* fifo read without cli because it's allready done  */
129
 
130
        byteout(ale, off);
131
        insb(adr, data, size);
132
}
133
 
134
 
135
static inline void
136
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
137
{
138
        long flags;
139
 
140
        save_flags(flags);
141
        cli();
142
        byteout(ale, off);
143
        byteout(adr, data);
144
        restore_flags(flags);
145
}
146
 
147
static inline void
148
writefifo(unsigned int ale, unsigned int adr, u_char off, u_char *data, int size)
149
{
150
        /* fifo write without cli because it's allready done  */
151
        byteout(ale, off);
152
        outsb(adr, data, size);
153
}
154
 
155
/* Interface functions */
156
 
157
static u_char
158
ReadISAC(struct IsdnCardState *cs, u_char offset)
159
{
160
        return(readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset));
161
}
162
 
163
static void
164
WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
165
{
166
        writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset, value);
167
}
168
 
169
static void
170
ReadISACfifo(struct IsdnCardState *cs, u_char *data, int size)
171
{
172
        readfifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0, data, size);
173
}
174
 
175
static void
176
WriteISACfifo(struct IsdnCardState *cs, u_char *data, int size)
177
{
178
        writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0, data, size);
179
}
180
 
181
static u_char
182
ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset)
183
{
184
        return (readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset+0x80));
185
}
186
 
187
static void
188
WriteISAC_IPAC(struct IsdnCardState *cs, u_char offset, u_char value)
189
{
190
        writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset|0x80, value);
191
}
192
 
193
static void
194
ReadISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
195
{
196
        readfifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size);
197
}
198
 
199
static void
200
WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
201
{
202
        writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size);
203
}
204
 
205
static u_char
206
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
207
{
208
        return(readreg(cs->hw.diva.hscx_adr,
209
                cs->hw.diva.hscx, offset + (hscx ? 0x40 : 0)));
210
}
211
 
212
static void
213
WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
214
{
215
        writereg(cs->hw.diva.hscx_adr,
216
                cs->hw.diva.hscx, offset + (hscx ? 0x40 : 0), value);
217
}
218
 
219
/*
220
 * fast interrupt HSCX stuff goes here
221
 */
222
 
223
#define READHSCX(cs, nr, reg) readreg(cs->hw.diva.hscx_adr, \
224
                cs->hw.diva.hscx, reg + (nr ? 0x40 : 0))
225
#define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.diva.hscx_adr, \
226
                cs->hw.diva.hscx, reg + (nr ? 0x40 : 0), data)
227
 
228
#define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.diva.hscx_adr, \
229
                cs->hw.diva.hscx, (nr ? 0x40 : 0), ptr, cnt)
230
 
231
#define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.diva.hscx_adr, \
232
                cs->hw.diva.hscx, (nr ? 0x40 : 0), ptr, cnt)
233
 
234
#include "hscx_irq.c"
235
 
236
static void
237
diva_interrupt(int intno, void *dev_id, struct pt_regs *regs)
238
{
239
        struct IsdnCardState *cs = dev_id;
240
        u_char val, sval, stat = 0;
241
        int cnt=8;
242
 
243
        if (!cs) {
244
                printk(KERN_WARNING "Diva: Spurious interrupt!\n");
245
                return;
246
        }
247
        while (((sval = bytein(cs->hw.diva.ctrl)) & DIVA_IRQ_REQ) && cnt) {
248
                val = readreg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_ISTA + 0x40);
249
                if (val) {
250
                        hscx_int_main(cs, val);
251
                        stat |= 1;
252
                }
253
                val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_ISTA);
254
                if (val) {
255
                        isac_interrupt(cs, val);
256
                        stat |= 2;
257
                }
258
                cnt--;
259
        }
260
        if (!cnt)
261
                printk(KERN_WARNING "Diva: IRQ LOOP\n");
262
        if (stat & 1) {
263
                writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK, 0xFF);
264
                writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK + 0x40, 0xFF);
265
                writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK, 0x0);
266
                writereg(cs->hw.diva.hscx_adr, cs->hw.diva.hscx, HSCX_MASK + 0x40, 0x0);
267
        }
268
        if (stat & 2) {
269
                writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_MASK, 0xFF);
270
                writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_MASK, 0x0);
271
        }
272
}
273
 
274
static void
275
diva_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
276
{
277
        struct IsdnCardState *cs = dev_id;
278
        u_char ista,val;
279
        int icnt=20;
280
 
281
        if (!cs) {
282
                printk(KERN_WARNING "Diva: Spurious interrupt!\n");
283
                return;
284
        }
285
        ista = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ISTA);
286
Start_IPAC:
287
        if (cs->debug & L1_DEB_IPAC)
288
                debugl1(cs, "IPAC ISTA %02X", ista);
289
        if (ista & 0x0f) {
290
                val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, HSCX_ISTA + 0x40);
291
                if (ista & 0x01)
292
                        val |= 0x01;
293
                if (ista & 0x04)
294
                        val |= 0x02;
295
                if (ista & 0x08)
296
                        val |= 0x04;
297
                if (val)
298
                        hscx_int_main(cs, val);
299
        }
300
        if (ista & 0x20) {
301
                val = 0xfe & readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, ISAC_ISTA + 0x80);
302
                if (val) {
303
                        isac_interrupt(cs, val);
304
                }
305
        }
306
        if (ista & 0x10) {
307
                val = 0x01;
308
                isac_interrupt(cs, val);
309
        }
310
        ista  = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ISTA);
311
        if ((ista & 0x3f) && icnt) {
312
                icnt--;
313
                goto Start_IPAC;
314
        }
315
        if (!icnt)
316
                printk(KERN_WARNING "DIVA IPAC IRQ LOOP\n");
317
        writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xFF);
318
        writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xC0);
319
}
320
 
321
 
322
void
323
release_io_diva(struct IsdnCardState *cs)
324
{
325
        int bytecnt;
326
 
327
        if (cs->subtyp != DIVA_IPAC_ISA) {
328
                del_timer(&cs->hw.diva.tl);
329
                if (cs->hw.diva.cfg_reg)
330
                        byteout(cs->hw.diva.ctrl, 0); /* LED off, Reset */
331
        }
332
        if ((cs->subtyp == DIVA_ISA) || (cs->subtyp == DIVA_IPAC_ISA))
333
                bytecnt = 8;
334
        else
335
                bytecnt = 32;
336
        if (cs->hw.diva.cfg_reg) {
337
                release_region(cs->hw.diva.cfg_reg, bytecnt);
338
        }
339
}
340
 
341
static void
342
reset_diva(struct IsdnCardState *cs)
343
{
344
        long flags;
345
 
346
        save_flags(flags);
347
        sti();
348
        if (cs->subtyp == DIVA_IPAC_ISA) {
349
                writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_POTA2, 0x20);
350
                current->state = TASK_INTERRUPTIBLE;
351
                current->timeout = jiffies + (10 * HZ) / 1000;  /* Timeout 10ms */
352
                schedule();
353
                writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_POTA2, 0x00);
354
                current->state = TASK_INTERRUPTIBLE;
355
                current->timeout = jiffies + (10 * HZ) / 1000;  /* Timeout 10ms */
356
                schedule();
357
                writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_MASK, 0xc0);
358
                schedule();
359
        } else {
360
                cs->hw.diva.ctrl_reg = 0;        /* Reset On */
361
                byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
362
                current->state = TASK_INTERRUPTIBLE;
363
                current->timeout = jiffies + (10 * HZ) / 1000;  /* Timeout 10ms */
364
                schedule();
365
                cs->hw.diva.ctrl_reg |= DIVA_RESET;  /* Reset Off */
366
                byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
367
                current->state = TASK_INTERRUPTIBLE;
368
                current->timeout = jiffies + (10 * HZ) / 1000;  /* Timeout 10ms */
369
                schedule();
370
                if (cs->subtyp == DIVA_ISA)
371
                        cs->hw.diva.ctrl_reg |= DIVA_ISA_LED_A;
372
                else
373
                        cs->hw.diva.ctrl_reg |= DIVA_PCI_LED_A;
374
                byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
375
        }
376
        restore_flags(flags);
377
}
378
 
379
#define DIVA_ASSIGN 1
380
 
381
static void
382
diva_led_handler(struct IsdnCardState *cs)
383
{
384
        int blink = 0;
385
 
386
        if (cs->subtyp == DIVA_IPAC_ISA)
387
                return;
388
        del_timer(&cs->hw.diva.tl);
389
        if (cs->hw.diva.status & DIVA_ASSIGN)
390
                cs->hw.diva.ctrl_reg |= (DIVA_ISA == cs->subtyp) ?
391
                        DIVA_ISA_LED_A : DIVA_PCI_LED_A;
392
        else {
393
                cs->hw.diva.ctrl_reg ^= (DIVA_ISA == cs->subtyp) ?
394
                        DIVA_ISA_LED_A : DIVA_PCI_LED_A;
395
                blink = 250;
396
        }
397
        if (cs->hw.diva.status & 0xf000)
398
                cs->hw.diva.ctrl_reg |= (DIVA_ISA == cs->subtyp) ?
399
                        DIVA_ISA_LED_B : DIVA_PCI_LED_B;
400
        else if (cs->hw.diva.status & 0x0f00) {
401
                cs->hw.diva.ctrl_reg ^= (DIVA_ISA == cs->subtyp) ?
402
                        DIVA_ISA_LED_B : DIVA_PCI_LED_B;
403
                blink = 500;
404
        } else
405
                cs->hw.diva.ctrl_reg &= ~((DIVA_ISA == cs->subtyp) ?
406
                        DIVA_ISA_LED_B : DIVA_PCI_LED_B);
407
 
408
        byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
409
        if (blink) {
410
                init_timer(&cs->hw.diva.tl);
411
                cs->hw.diva.tl.expires = jiffies + ((blink * HZ) / 1000);
412
                add_timer(&cs->hw.diva.tl);
413
        }
414
}
415
 
416
static int
417
Diva_card_msg(struct IsdnCardState *cs, int mt, void *arg)
418
{
419
        u_int irq_flag = I4L_IRQ_FLAG;
420
 
421
        switch (mt) {
422
                case CARD_RESET:
423
                        reset_diva(cs);
424
                        return(0);
425
                case CARD_RELEASE:
426
                        release_io_diva(cs);
427
                        return(0);
428
                case CARD_SETIRQ:
429
                        if (cs->subtyp == DIVA_PCI)
430
                                irq_flag |= SA_SHIRQ;
431
                        if (cs->subtyp == DIVA_IPAC_ISA) {
432
                                return(request_irq(cs->irq, &diva_interrupt_ipac,
433
                                                irq_flag, "HiSax", cs));
434
                        } else {
435
                                return(request_irq(cs->irq, &diva_interrupt,
436
                                                irq_flag, "HiSax", cs));
437
                        }
438
                case CARD_INIT:
439
                        inithscxisac(cs, 3);
440
                        return(0);
441
                case CARD_TEST:
442
                        return(0);
443
                case (MDL_REMOVE | REQUEST):
444
                        cs->hw.diva.status = 0;
445
                        break;
446
                case (MDL_ASSIGN | REQUEST):
447
                        cs->hw.diva.status |= DIVA_ASSIGN;
448
                        break;
449
                case MDL_INFO_SETUP:
450
                        if ((long)arg)
451
                                cs->hw.diva.status |=  0x0200;
452
                        else
453
                                cs->hw.diva.status |=  0x0100;
454
                        break;
455
                case MDL_INFO_CONN:
456
                        if ((long)arg)
457
                                cs->hw.diva.status |=  0x2000;
458
                        else
459
                                cs->hw.diva.status |=  0x1000;
460
                        break;
461
                case MDL_INFO_REL:
462
                        if ((long)arg) {
463
                                cs->hw.diva.status &=  ~0x2000;
464
                                cs->hw.diva.status &=  ~0x0200;
465
                        } else {
466
                                cs->hw.diva.status &=  ~0x1000;
467
                                cs->hw.diva.status &=  ~0x0100;
468
                        }
469
                        break;
470
        }
471
        if (cs->subtyp != DIVA_IPAC_ISA)
472
                diva_led_handler(cs);
473
        return(0);
474
}
475
 
476
 
477
 
478
static  int pci_index __initdata = 0;
479
 
480
__initfunc(int
481
setup_diva(struct IsdnCard *card))
482
{
483
        int bytecnt;
484
        u_char val;
485
        struct IsdnCardState *cs = card->cs;
486
        char tmp[64];
487
 
488
        strcpy(tmp, Diva_revision);
489
        printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
490
        if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
491
                return(0);
492
        cs->hw.diva.status = 0;
493
        if (card->para[1]) {
494
                cs->hw.diva.ctrl_reg = 0;
495
                cs->hw.diva.cfg_reg = card->para[1];
496
                val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR,
497
                        cs->hw.diva.cfg_reg + DIVA_IPAC_DATA, IPAC_ID);
498
                printk(KERN_INFO "Diva: IPAC version %x\n", val);
499
                if (val == 1) {
500
                        cs->subtyp = DIVA_IPAC_ISA;
501
                        cs->hw.diva.ctrl = 0;
502
                        cs->hw.diva.isac = card->para[1] + DIVA_IPAC_DATA;
503
                        cs->hw.diva.hscx = card->para[1] + DIVA_IPAC_DATA;
504
                        cs->hw.diva.isac_adr = card->para[1] + DIVA_IPAC_ADR;
505
                        cs->hw.diva.hscx_adr = card->para[1] + DIVA_IPAC_ADR;
506
                        test_and_set_bit(HW_IPAC, &cs->HW_Flags);
507
                } else {
508
                        cs->subtyp = DIVA_ISA;
509
                        cs->hw.diva.ctrl = card->para[1] + DIVA_ISA_CTRL;
510
                        cs->hw.diva.isac = card->para[1] + DIVA_ISA_ISAC_DATA;
511
                        cs->hw.diva.hscx = card->para[1] + DIVA_HSCX_DATA;
512
                        cs->hw.diva.isac_adr = card->para[1] + DIVA_ISA_ISAC_ADR;
513
                        cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
514
                }
515
                cs->irq = card->para[0];
516
                bytecnt = 8;
517
        } else {
518
#if CONFIG_PCI
519
                u_char pci_bus, pci_device_fn, pci_irq;
520
                u_int pci_ioaddr;
521
 
522
                cs->subtyp = 0;
523
                for (; pci_index < 0xff; pci_index++) {
524
                        if (pcibios_find_device(PCI_VENDOR_EICON_DIEHL,
525
                           PCI_DIVA20_ID, pci_index, &pci_bus, &pci_device_fn)
526
                           == PCIBIOS_SUCCESSFUL)
527
                                cs->subtyp = DIVA_PCI;
528
                        else if (pcibios_find_device(PCI_VENDOR_EICON_DIEHL,
529
                           PCI_DIVA20_ID, pci_index, &pci_bus, &pci_device_fn)
530
                           == PCIBIOS_SUCCESSFUL)
531
                                cs->subtyp = DIVA_PCI;
532
                        else
533
                                break;
534
                        /* get IRQ */
535
                        pcibios_read_config_byte(pci_bus, pci_device_fn,
536
                                PCI_INTERRUPT_LINE, &pci_irq);
537
 
538
                        /* get IO address */
539
                        pcibios_read_config_dword(pci_bus, pci_device_fn,
540
                                PCI_BASE_ADDRESS_2, &pci_ioaddr);
541
                        if (cs->subtyp)
542
                                break;
543
                }
544
                if (!cs->subtyp) {
545
                        printk(KERN_WARNING "Diva: No PCI card found\n");
546
                        return(0);
547
                }
548
                pci_index++;
549
                if (!pci_irq) {
550
                        printk(KERN_WARNING "Diva: No IRQ for PCI card found\n");
551
                        return(0);
552
                }
553
 
554
                if (!pci_ioaddr) {
555
                        printk(KERN_WARNING "Diva: No IO-Adr for PCI card found\n");
556
                        return(0);
557
                }
558
                pci_ioaddr &= ~3; /* remove io/mem flag */
559
                cs->hw.diva.cfg_reg = pci_ioaddr;
560
                cs->hw.diva.ctrl = pci_ioaddr + DIVA_PCI_CTRL;
561
                cs->hw.diva.isac = pci_ioaddr + DIVA_PCI_ISAC_DATA;
562
                cs->hw.diva.hscx = pci_ioaddr + DIVA_HSCX_DATA;
563
                cs->hw.diva.isac_adr = pci_ioaddr + DIVA_PCI_ISAC_ADR;
564
                cs->hw.diva.hscx_adr = pci_ioaddr + DIVA_HSCX_ADR;
565
                cs->irq = pci_irq;
566
                bytecnt = 32;
567
#else
568
                printk(KERN_WARNING "Diva: cfgreg 0 and NO_PCI_BIOS\n");
569
                printk(KERN_WARNING "Diva: unable to config DIVA PCI\n");
570
                return (0);
571
#endif /* CONFIG_PCI */
572
        }
573
 
574
        printk(KERN_INFO
575
                "Diva: %s card configured at 0x%x IRQ %d\n",
576
                (cs->subtyp == DIVA_PCI) ? "PCI" :
577
                (cs->subtyp == DIVA_ISA) ? "ISA" : "IPAC",
578
                cs->hw.diva.cfg_reg, cs->irq);
579
        if (check_region(cs->hw.diva.cfg_reg, bytecnt)) {
580
                printk(KERN_WARNING
581
                       "HiSax: %s config port %x-%x already in use\n",
582
                       CardType[card->typ],
583
                       cs->hw.diva.cfg_reg,
584
                       cs->hw.diva.cfg_reg + bytecnt);
585
                return (0);
586
        } else {
587
                request_region(cs->hw.diva.cfg_reg, bytecnt, "diva isdn");
588
        }
589
 
590
        reset_diva(cs);
591
        cs->BC_Read_Reg  = &ReadHSCX;
592
        cs->BC_Write_Reg = &WriteHSCX;
593
        cs->BC_Send_Data = &hscx_fill_fifo;
594
        cs->cardmsg = &Diva_card_msg;
595
        if (cs->subtyp == DIVA_IPAC_ISA) {
596
                cs->readisac  = &ReadISAC_IPAC;
597
                cs->writeisac = &WriteISAC_IPAC;
598
                cs->readisacfifo  = &ReadISACfifo_IPAC;
599
                cs->writeisacfifo = &WriteISACfifo_IPAC;
600
                val = readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, IPAC_ID);
601
                printk(KERN_INFO "Diva: IPAC version %x\n", val);
602
        } else {
603
                cs->hw.diva.tl.function = (void *) diva_led_handler;
604
                cs->hw.diva.tl.data = (long) cs;
605
                init_timer(&cs->hw.diva.tl);
606
                cs->readisac  = &ReadISAC;
607
                cs->writeisac = &WriteISAC;
608
                cs->readisacfifo  = &ReadISACfifo;
609
                cs->writeisacfifo = &WriteISACfifo;
610
                ISACVersion(cs, "Diva:");
611
                if (HscxVersion(cs, "Diva:")) {
612
                        printk(KERN_WARNING
613
                       "Diva: wrong HSCX versions check IO address\n");
614
                        release_io_diva(cs);
615
                        return (0);
616
                }
617
        }
618
        return (1);
619
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.