22 #include <linux/pci.h>
23 #include <linux/sched.h>
26 static const char *hfcpci_revision =
"$Revision: 1.48.2.4 $";
36 #define NT_T1_COUNT 20
37 #define CLKDEL_TE 0x0e
38 #define CLKDEL_NT 0x6c
73 release_io_hfcpci(
struct IsdnCardState *
cs)
76 cs->hw.hfcpci.pci_io);
77 cs->hw.hfcpci.int_m2 = 0;
84 pci_write_config_word(cs->hw.hfcpci.dev,
PCI_COMMAND, 0);
87 cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
88 cs->hw.hfcpci.fifos =
NULL;
89 iounmap((
void *)cs->hw.hfcpci.pci_io);
97 reset_hfcpci(
struct IsdnCardState *cs)
100 cs->hw.hfcpci.int_m2 = 0;
112 cs->hw.hfcpci.fifo_en = 0x30;
121 cs->hw.hfcpci.bswapped = 0;
122 cs->hw.hfcpci.nt_mode = 0;
139 cs->hw.hfcpci.sctrl = 0x40;
141 cs->hw.hfcpci.sctrl_r = 0;
151 cs->hw.hfcpci.conn = 0x36;
168 hfcpci_Timer(
struct IsdnCardState *cs)
170 cs->hw.hfcpci.timer.expires =
jiffies + 75;
182 sched_event_D_pci(
struct IsdnCardState *cs,
int event)
192 hfcpci_sched_event(
struct BCState *bcs,
int event)
203 Sel_BCS(
struct IsdnCardState *cs,
int channel)
205 if (cs->bcs[0].mode && (cs->bcs[0].channel == channel))
206 return (&cs->bcs[0]);
207 else if (cs->bcs[1].mode && (cs->bcs[1].channel == channel))
208 return (&cs->bcs[1]);
216 static void hfcpci_clear_fifo_rx(
struct IsdnCardState *cs,
int fifo)
221 bzr = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b2;
224 bzr = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b1;
228 cs->hw.hfcpci.fifo_en ^= fifo_state;
230 cs->hw.hfcpci.last_bfifo_cnt[fifo] = 0;
236 cs->hw.hfcpci.fifo_en |= fifo_state;
243 static void hfcpci_clear_fifo_tx(
struct IsdnCardState *cs,
int fifo)
248 bzt = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b2;
251 bzt = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b1;
255 cs->hw.hfcpci.fifo_en ^= fifo_state;
262 cs->hw.hfcpci.fifo_en |= fifo_state;
275 struct IsdnCardState *cs = bcs->cs;
276 int total, maxlen, new_z2;
279 if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO))
280 debugl1(cs,
"hfcpci_empty_fifo");
281 zp = &bz->
za[bz->
f2];
287 (*(bdata + (zp->
z1 - B_SUB_VAL)))) {
288 if (cs->debug & L1_DEB_WARN)
289 debugl1(cs,
"hfcpci_empty_fifo: incoming packet invalid length %d or crc", count);
290 #ifdef ERROR_STATISTIC
293 bz->
za[new_f2].
z2 = new_z2;
296 }
else if (!(skb = dev_alloc_skb(count - 3)))
309 memcpy(ptr, ptr1, maxlen);
317 bz->
za[new_f2].
z2 = new_z2;
329 receive_dmsg(
struct IsdnCardState *cs)
339 df = &((
fifo_area *) (cs->hw.hfcpci.fifos))->d_chan.d_rx;
341 debugl1(cs,
"rec_dmsg blocked");
346 rcnt = zp->
z1 - zp->
z2;
350 if (cs->debug & L1_DEB_ISAC)
351 debugl1(cs,
"hfcpci recd f1(%d) f2(%d) z1(%x) z2(%x) cnt(%d)",
352 df->
f1, df->
f2, zp->
z1, zp->
z2, rcnt);
356 if (cs->debug & L1_DEB_WARN)
357 debugl1(cs,
"empty_fifo hfcpci paket inv. len %d or crc %d", rcnt, df->
data[zp->
z1]);
358 #ifdef ERROR_STATISTIC
363 }
else if ((skb = dev_alloc_skb(rcnt - 3))) {
374 memcpy(ptr, ptr1, maxlen);
400 unsigned short *z1r, *z2r;
401 int new_z2, fcnt, maxlen;
408 if (!(fcnt = *z1r - *z2r))
416 new_z2 = *z2r + fcnt;
420 if (!(skb = dev_alloc_skb(fcnt)))
430 memcpy(ptr, ptr1, maxlen);
450 main_rec_hfcpci(
struct BCState *bcs)
452 struct IsdnCardState *cs = bcs->cs;
454 int receive, count = 5;
461 if ((bcs->channel) && (!cs->hw.hfcpci.bswapped)) {
462 bz = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b2;
463 bdata = ((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxdat_b2;
466 bz = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b1;
467 bdata = ((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxdat_b1;
473 debugl1(cs,
"rec_data %d blocked", bcs->channel);
476 if (bz->
f1 != bz->
f2) {
477 if (cs->debug & L1_DEB_HSCX)
478 debugl1(cs,
"hfcpci rec %d f1(%d) f2(%d)",
479 bcs->channel, bz->
f1, bz->
f2);
480 zp = &bz->
za[bz->
f2];
482 rcnt = zp->
z1 - zp->
z2;
486 if (cs->debug & L1_DEB_HSCX)
487 debugl1(cs,
"hfcpci rec %d z1(%x) z2(%x) cnt(%d)",
488 bcs->channel, zp->
z1, zp->
z2, rcnt);
489 if ((skb = hfcpci_empty_fifo(bcs, bz, bdata, rcnt))) {
493 rcnt = bz->
f1 - bz->
f2;
496 if (cs->hw.hfcpci.last_bfifo_cnt[real_fifo] > rcnt + 1) {
498 hfcpci_clear_fifo_rx(cs, real_fifo);
500 cs->hw.hfcpci.last_bfifo_cnt[real_fifo] = rcnt;
506 receive = hfcpci_empty_fifo_trans(bcs, bz, bdata);
510 if (count && receive)
518 hfcpci_fill_dfifo(
struct IsdnCardState *cs)
521 int count, new_z1, maxlen;
527 if (cs->tx_skb->len <= 0)
530 df = &((
fifo_area *) (cs->hw.hfcpci.fifos))->d_chan.d_tx;
532 if (cs->debug & L1_DEB_ISAC)
533 debugl1(cs,
"hfcpci_fill_Dfifo f1(%d) f2(%d) z1(f1)(%x)",
536 fcnt = df->
f1 - df->
f2;
540 if (cs->debug & L1_DEB_ISAC)
541 debugl1(cs,
"hfcpci_fill_Dfifo more as 14 frames");
542 #ifdef ERROR_STATISTIC
552 if (cs->debug & L1_DEB_ISAC)
553 debugl1(cs,
"hfcpci_fill_Dfifo count(%u/%d)",
554 cs->tx_skb->len, count);
555 if (count < cs->tx_skb->len) {
556 if (cs->debug & L1_DEB_ISAC)
557 debugl1(cs,
"hfcpci_fill_Dfifo no fifo mem");
560 count = cs->tx_skb->len;
563 src = cs->tx_skb->data;
588 hfcpci_fill_fifo(
struct BCState *bcs)
590 struct IsdnCardState *cs = bcs->cs;
596 unsigned short *z1t, *z2t;
600 if (bcs->tx_skb->len <= 0)
603 if ((bcs->channel) && (!cs->hw.hfcpci.bswapped)) {
604 bz = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b2;
605 bdata = ((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txdat_b2;
607 bz = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b1;
608 bdata = ((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txdat_b1;
614 if (cs->debug & L1_DEB_HSCX)
615 debugl1(cs,
"hfcpci_fill_fifo_trans %d z1(%x) z2(%x)",
616 bcs->channel, *z1t, *z2t);
625 count = bcs->tx_skb->len;
627 new_z1 = *z1t +
count;
630 src = bcs->tx_skb->data;
643 bcs->tx_cnt -= bcs->tx_skb->len;
644 fcnt += bcs->tx_skb->len;
646 }
else if (cs->debug & L1_DEB_HSCX)
647 debugl1(cs,
"hfcpci_fill_fifo_trans %d frame length %d discarded",
648 bcs->channel, bcs->tx_skb->len);
650 if (
test_bit(FLG_LLI_L1WAKEUP, &bcs->st->lli.flag) &&
651 (PACKET_NOACK != bcs->tx_skb->pkt_type)) {
654 bcs->ackcnt += bcs->tx_skb->len;
655 spin_unlock_irqrestore(&bcs->aclock, flags);
665 if (cs->debug & L1_DEB_HSCX)
666 debugl1(cs,
"hfcpci_fill_fifo_hdlc %d f1(%d) f2(%d) z1(f1)(%x)",
667 bcs->channel, bz->
f1, bz->
f2,
670 fcnt = bz->
f1 - bz->
f2;
674 if (cs->debug & L1_DEB_HSCX)
675 debugl1(cs,
"hfcpci_fill_Bfifo more as 14 frames");
683 if (cs->debug & L1_DEB_HSCX)
684 debugl1(cs,
"hfcpci_fill_fifo %d count(%u/%d),%lx",
685 bcs->channel, bcs->tx_skb->len,
688 if (count < bcs->tx_skb->len) {
689 if (cs->debug & L1_DEB_HSCX)
690 debugl1(cs,
"hfcpci_fill_fifo no fifo mem");
693 count = bcs->tx_skb->len;
699 src = bcs->tx_skb->data;
712 bcs->tx_cnt -= bcs->tx_skb->len;
713 if (
test_bit(FLG_LLI_L1WAKEUP, &bcs->st->lli.flag) &&
714 (PACKET_NOACK != bcs->tx_skb->pkt_type)) {
717 bcs->ackcnt += bcs->tx_skb->len;
718 spin_unlock_irqrestore(&bcs->aclock, flags);
722 bz->
za[new_f1].
z1 = new_z1;
734 dch_nt_l2l1(
struct PStack *
st,
int pr,
void *
arg)
736 struct IsdnCardState *cs = (
struct IsdnCardState *) st->l1.hardware;
742 st->l1.l1hw(st, pr, arg);
749 debugl1(cs,
"PH_TEST_LOOP B1");
751 debugl1(cs,
"PH_TEST_LOOP B2");
752 if (!(3 & (
long) arg))
753 debugl1(cs,
"PH_TEST_LOOP DISABLED");
758 debugl1(cs,
"dch_nt_l2l1 msg %04X unhandled", pr);
769 hfcpci_auxcmd(
struct IsdnCardState *cs,
isdn_ctrl *ic)
772 int i = *(
unsigned int *) ic->
parm.
num;
774 if ((ic->
arg == 98) &&
786 cs->dc.hfcpci.ph_state = 1;
787 cs->hw.hfcpci.nt_mode = 1;
788 cs->hw.hfcpci.nt_timer = 0;
789 cs->stlist->l2.l2l1 = dch_nt_l2l1;
790 spin_unlock_irqrestore(&cs->lock, flags);
791 debugl1(cs,
"NT mode activated");
794 if ((cs->chanlimit > 1) || (cs->hw.hfcpci.bswapped) ||
795 (cs->hw.hfcpci.nt_mode) || (ic->
arg != 12))
801 cs->hw.hfcpci.trm |= 0x20;
806 cs->hw.hfcpci.trm &= ~0x20;
812 cs->hw.hfcpci.conn |= 0x10;
813 cs->hw.hfcpci.ctmt &= ~2;
821 spin_unlock_irqrestore(&cs->lock, flags);
829 receive_emsg(
struct IsdnCardState *cs)
832 int receive, count = 5;
837 int total, maxlen, new_z2;
840 bz = &((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b2;
841 bdata = ((
fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxdat_b2;
845 debugl1(cs,
"echo_rec_data blocked");
848 if (bz->
f1 != bz->
f2) {
849 if (cs->debug & L1_DEB_ISAC)
850 debugl1(cs,
"hfcpci e_rec f1(%d) f2(%d)",
852 zp = &bz->
za[bz->
f2];
854 rcnt = zp->
z1 - zp->
z2;
858 if (cs->debug & L1_DEB_ISAC)
859 debugl1(cs,
"hfcpci e_rec z1(%x) z2(%x) cnt(%d)",
860 zp->
z1, zp->
z2, rcnt);
861 new_z2 = zp->
z2 + rcnt;
865 if ((rcnt > 256 + 3) || (count < 4) ||
866 (*(bdata + (zp->
z1 - B_SUB_VAL)))) {
867 if (cs->debug & L1_DEB_WARN)
868 debugl1(cs,
"hfcpci_empty_echan: incoming packet invalid length %d or crc", rcnt);
869 bz->
za[new_f2].
z2 = new_z2;
882 memcpy(ptr, ptr1, maxlen);
890 bz->
za[new_f2].
z2 = new_z2;
892 if (cs->debug & DEB_DLOG_HEX) {
894 if ((total - 3) < MAX_DLOG_SPACE / 3 - 10) {
900 ptr +=
QuickHex(ptr, e_buffer, total - 3);
906 HiSax_putstatus(cs,
"LogEcho: ",
"warning Frame too big (%d)", total - 3);
910 rcnt = bz->
f1 - bz->
f2;
920 if (count && receive)
928 hfcpci_interrupt(
int intno,
void *
dev_id)
931 struct IsdnCardState *cs =
dev_id;
937 if (!(cs->hw.hfcpci.int_m2 & 0x08)) {
938 debugl1(cs,
"HFC-PCI: int_m2 %x not initialised", cs->hw.hfcpci.int_m2);
944 if (cs->debug & L1_DEB_ISAC)
945 debugl1(cs,
"HFC-PCI: stat(%02x) s1(%02x)", stat, val);
947 spin_unlock_irqrestore(&cs->lock, flags);
950 if (cs->debug & L1_DEB_ISAC)
951 debugl1(cs,
"HFC-PCI irq %x %s", val,
952 test_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags) ?
953 "locked" :
"unlocked");
954 val &= cs->hw.hfcpci.int_m1;
957 if (cs->debug & L1_DEB_ISAC)
958 debugl1(cs,
"ph_state chg %d->%d", cs->dc.hfcpci.ph_state,
960 cs->dc.hfcpci.ph_state = exval;
965 if (cs->hw.hfcpci.nt_mode) {
966 if ((--cs->hw.hfcpci.nt_timer) < 0)
973 if (
test_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags)) {
974 cs->hw.hfcpci.int_s1 |=
val;
975 spin_unlock_irqrestore(&cs->lock, flags);
978 if (cs->hw.hfcpci.int_s1 & 0x18) {
980 val = cs->hw.hfcpci.int_s1;
981 cs->hw.hfcpci.int_s1 = exval;
984 if (!(bcs = Sel_BCS(cs, cs->hw.hfcpci.bswapped ? 1 : 0))) {
986 debugl1(cs,
"hfcpci spurious 0x08 IRQ");
988 main_rec_hfcpci(bcs);
993 else if (!(bcs = Sel_BCS(cs, 1))) {
995 debugl1(cs,
"hfcpci spurious 0x10 IRQ");
997 main_rec_hfcpci(bcs);
1000 if (!(bcs = Sel_BCS(cs, cs->hw.hfcpci.bswapped ? 1 : 0))) {
1002 debugl1(cs,
"hfcpci spurious 0x01 IRQ");
1006 hfcpci_fill_fifo(bcs);
1009 debugl1(cs,
"fill_data %d blocked", bcs->channel);
1013 hfcpci_fill_fifo(bcs);
1016 debugl1(cs,
"fill_data %d blocked", bcs->channel);
1024 if (!(bcs = Sel_BCS(cs, 1))) {
1026 debugl1(cs,
"hfcpci spurious 0x02 IRQ");
1030 hfcpci_fill_fifo(bcs);
1033 debugl1(cs,
"fill_data %d blocked", bcs->channel);
1037 hfcpci_fill_fifo(bcs);
1040 debugl1(cs,
"fill_data %d blocked", bcs->channel);
1056 if (cs->tx_skb->len) {
1058 hfcpci_fill_dfifo(cs);
1061 debugl1(cs,
"hfcpci_fill_dfifo irq blocked");
1073 hfcpci_fill_dfifo(cs);
1076 debugl1(cs,
"hfcpci_fill_dfifo irq blocked");
1082 if (cs->hw.hfcpci.int_s1 && count--) {
1083 val = cs->hw.hfcpci.int_s1;
1084 cs->hw.hfcpci.int_s1 = 0;
1085 if (cs->debug & L1_DEB_ISAC)
1086 debugl1(cs,
"HFC-PCI irq %x loop %d", val, 15 - count);
1090 spin_unlock_irqrestore(&cs->lock, flags);
1098 hfcpci_dbusy_timer(
struct IsdnCardState *cs)
1106 HFCPCI_l1hw(
struct PStack *st,
int pr,
void *arg)
1109 struct IsdnCardState *cs = (
struct IsdnCardState *) st->l1.hardware;
1114 if (cs->debug & DEB_DLOG_HEX)
1116 if (cs->debug & DEB_DLOG_VERBOSE)
1121 #ifdef L2FRAME_DEBUG
1122 if (cs->debug & L1_DEB_LAPD)
1128 #ifdef L2FRAME_DEBUG
1129 if (cs->debug & L1_DEB_LAPD)
1133 hfcpci_fill_dfifo(cs);
1136 debugl1(cs,
"hfcpci_fill_dfifo blocked");
1139 spin_unlock_irqrestore(&cs->lock, flags);
1144 if (cs->debug & L1_DEB_WARN)
1145 debugl1(cs,
" l2l1 tx_skb exist this shouldn't happen");
1147 spin_unlock_irqrestore(&cs->lock, flags);
1150 if (cs->debug & DEB_DLOG_HEX)
1152 if (cs->debug & DEB_DLOG_VERBOSE)
1156 #ifdef L2FRAME_DEBUG
1157 if (cs->debug & L1_DEB_LAPD)
1161 hfcpci_fill_dfifo(cs);
1164 debugl1(cs,
"hfcpci_fill_dfifo blocked");
1165 spin_unlock_irqrestore(&cs->lock, flags);
1168 #ifdef L2FRAME_DEBUG
1169 if (cs->debug & L1_DEB_LAPD)
1170 debugl1(cs,
"-> PH_REQUEST_PULL");
1186 spin_unlock_irqrestore(&cs->lock, flags);
1192 spin_unlock_irqrestore(&cs->lock, flags);
1198 spin_unlock_irqrestore(&cs->lock, flags);
1204 spin_unlock_irqrestore(&cs->lock, flags);
1208 switch ((
long) arg) {
1212 cs->hw.hfcpci.conn = (cs->hw.hfcpci.conn & ~7) | 1;
1219 cs->hw.hfcpci.conn = (cs->hw.hfcpci.conn & ~0x38) | 0x08;
1224 spin_unlock_irqrestore(&cs->lock, flags);
1225 if (cs->debug & L1_DEB_WARN)
1226 debugl1(cs,
"hfcpci_l1hw loop invalid %4lx", (
long) arg);
1229 cs->hw.hfcpci.trm |= 0x80;
1231 spin_unlock_irqrestore(&cs->lock, flags);
1234 if (cs->debug & L1_DEB_WARN)
1235 debugl1(cs,
"hfcpci_l1hw unknown pr %4x", pr);
1244 setstack_hfcpci(
struct PStack *st,
struct IsdnCardState *cs)
1246 st->l1.l1hw = HFCPCI_l1hw;
1253 hfcpci_send_data(
struct BCState *bcs)
1255 struct IsdnCardState *cs = bcs->cs;
1258 hfcpci_fill_fifo(bcs);
1261 debugl1(cs,
"send_data %d blocked", bcs->channel);
1268 mode_hfcpci(
struct BCState *bcs,
int mode,
int bc)
1270 struct IsdnCardState *cs = bcs->cs;
1273 if (cs->debug & L1_DEB_HSCX)
1274 debugl1(cs,
"HFCPCI bchannel mode %d bchan %d/%d",
1275 mode, bc, bcs->channel);
1279 if (cs->chanlimit > 1) {
1280 cs->hw.hfcpci.bswapped = 0;
1281 cs->hw.hfcpci.sctrl_e &= ~0x80;
1285 cs->hw.hfcpci.bswapped = 1;
1286 cs->hw.hfcpci.sctrl_e |= 0x80;
1288 cs->hw.hfcpci.bswapped = 0;
1289 cs->hw.hfcpci.sctrl_e &= ~0x80;
1293 cs->hw.hfcpci.bswapped = 0;
1294 cs->hw.hfcpci.sctrl_e &= ~0x80;
1315 hfcpci_clear_fifo_rx(cs, fifo2);
1316 hfcpci_clear_fifo_tx(cs, fifo2);
1327 cs->hw.hfcpci.ctmt |= 2;
1328 cs->hw.hfcpci.conn &= ~0x18;
1332 cs->hw.hfcpci.ctmt |= 1;
1333 cs->hw.hfcpci.conn &= ~0x03;
1337 hfcpci_clear_fifo_rx(cs, fifo2);
1338 hfcpci_clear_fifo_tx(cs, fifo2);
1347 cs->hw.hfcpci.last_bfifo_cnt[1] = 0;
1350 cs->hw.hfcpci.ctmt &= ~2;
1351 cs->hw.hfcpci.conn &= ~0x18;
1353 cs->hw.hfcpci.last_bfifo_cnt[0] = 0;
1356 cs->hw.hfcpci.ctmt &= ~1;
1357 cs->hw.hfcpci.conn &= ~0x03;
1362 cs->hw.hfcpci.conn |= 0x10;
1368 cs->hw.hfcpci.conn |= 0x02;
1389 hfcpci_l2l1(
struct PStack *st,
int pr,
void *arg)
1391 struct BCState *bcs = st->l1.bcs;
1403 bcs->cs->BC_Send_Data(bcs);
1405 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1410 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1416 bcs->cs->BC_Send_Data(bcs);
1417 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1429 mode_hfcpci(bcs, st->l1.mode, st->l1.bc);
1430 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1440 mode_hfcpci(bcs, 0, st->l1.bc);
1441 spin_unlock_irqrestore(&bcs->cs->lock, flags);
1451 close_hfcpci(
struct BCState *bcs)
1453 mode_hfcpci(bcs, 0, bcs->channel);
1469 open_hfcpcistate(
struct IsdnCardState *cs,
struct BCState *bcs)
1472 skb_queue_head_init(&bcs->rqueue);
1473 skb_queue_head_init(&bcs->squeue);
1486 setstack_2b(
struct PStack *st,
struct BCState *bcs)
1488 bcs->channel = st->l1.bc;
1489 if (open_hfcpcistate(st->l1.hardware, bcs))
1492 st->l2.l2l1 = hfcpci_l2l1;
1505 struct IsdnCardState *cs =
1511 if (!cs->hw.hfcpci.nt_mode)
1512 switch (cs->dc.hfcpci.ph_state) {
1532 switch (cs->dc.hfcpci.ph_state) {
1534 if (cs->hw.hfcpci.nt_timer < 0) {
1535 cs->hw.hfcpci.nt_timer = 0;
1543 cs->dc.hfcpci.ph_state = 4;
1558 cs->hw.hfcpci.nt_timer = 0;
1565 spin_unlock_irqrestore(&cs->lock, flags);
1579 inithfcpci(
struct IsdnCardState *cs)
1581 cs->bcs[0].BC_SetStack = setstack_2b;
1582 cs->bcs[1].BC_SetStack = setstack_2b;
1583 cs->bcs[0].BC_Close = close_hfcpci;
1584 cs->bcs[1].BC_Close = close_hfcpci;
1585 cs->dbusytimer.function = (
void *) hfcpci_dbusy_timer;
1586 cs->dbusytimer.data = (
long) cs;
1588 mode_hfcpci(cs->bcs, 0, 0);
1589 mode_hfcpci(cs->bcs + 1, 0, 1);
1598 hfcpci_card_msg(
struct IsdnCardState *cs,
int mt,
void *arg)
1602 if (cs->debug & L1_DEB_ISAC)
1603 debugl1(cs,
"HFCPCI: card_msg %x", mt);
1608 spin_unlock_irqrestore(&cs->lock, flags);
1611 release_io_hfcpci(cs);
1617 spin_unlock_irqrestore(&cs->lock, flags);
1625 spin_unlock_irqrestore(&cs->lock, flags);
1641 struct IsdnCardState *cs = card->
cs;
1647 #error "not running on big endian machines now"
1650 strcpy(tmp, hfcpci_revision);
1653 cs->hw.hfcpci.int_s1 = 0;
1654 cs->dc.hfcpci.ph_state = 0;
1655 cs->hw.hfcpci.fifo = 255;
1661 tmp_hfcpci = hisax_find_pci_device(id_list[i].vendor_id,
1669 if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
1671 "HiSax hfc_pci: No suitable DMA available.\n");
1674 if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
1676 "HiSax hfc_pci: No suitable consistent DMA available.\n");
1693 dev_hfcpci = tmp_hfcpci;
1694 cs->hw.hfcpci.
dev = dev_hfcpci;
1695 cs->irq = dev_hfcpci->irq;
1700 cs->hw.hfcpci.pci_io = (
char *)(
unsigned long)dev_hfcpci->resource[1].start;
1701 printk(
KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
1703 if (!cs->hw.hfcpci.pci_io) {
1710 0x8000, &cs->hw.hfcpci.dma);
1711 if (!cs->hw.hfcpci.fifos) {
1715 if (cs->hw.hfcpci.dma & 0x7fff) {
1717 "HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
1718 (
u_long)cs->hw.hfcpci.dma);
1720 cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
1723 pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (
u32)cs->hw.hfcpci.dma);
1724 cs->hw.hfcpci.pci_io =
ioremap((
ulong) cs->hw.hfcpci.pci_io, 256);
1726 "HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
1727 cs->hw.hfcpci.pci_io,
1728 cs->hw.hfcpci.fifos,
1729 (
u_long)cs->hw.hfcpci.dma,
1735 cs->hw.hfcpci.int_m2 = 0;
1736 cs->hw.hfcpci.int_m1 = 0;
1743 cs->setstack_d = setstack_hfcpci;
1744 cs->BC_Send_Data = &hfcpci_send_data;
1745 cs->readisac =
NULL;
1746 cs->writeisac =
NULL;
1747 cs->readisacfifo =
NULL;
1748 cs->writeisacfifo =
NULL;
1749 cs->BC_Read_Reg =
NULL;
1750 cs->BC_Write_Reg =
NULL;
1751 cs->irq_func = &hfcpci_interrupt;
1753 cs->hw.hfcpci.timer.function = (
void *) hfcpci_Timer;
1754 cs->hw.hfcpci.timer.data = (
long) cs;
1756 cs->cardmsg = &hfcpci_card_msg;
1757 cs->auxcmd = &hfcpci_auxcmd;
1759 spin_unlock_irqrestore(&cs->lock, flags);