blob: bb94d342fcc8f1b9a84bdec259d264504379f4df [file] [log] [blame]
Harald Welte72914972009-08-10 23:36:53 +02001This experimental patch splits one E1 card into three virtual cards,
2
3TS 1,2,3,4,5 is card 0
4TS 6,7,8,9,10 is card 1
5TS 11,12,13,14 is card 2
6
7This allows you to run one L2 TEI handler on each of the virtual cards,
8which is required if you want to run multiple BTS on a single E1 link.
9
10Thanks to Andreas Eversberg for this patch.
11
12diff --git a/drivers/isdn/hardware/mISDN/hfc_multi.h b/drivers/isdn/hardware/mISDN/hfc_multi.h
13index 0c77386..02dd4a1 100644
14--- a/drivers/isdn/hardware/mISDN/hfc_multi.h
15+++ b/drivers/isdn/hardware/mISDN/hfc_multi.h
16@@ -209,14 +209,17 @@ struct hfc_multi {
17 u_long ledstate; /* save last state of leds */
18 int opticalsupport; /* has the e1 board */
19 /* an optical Interface */
20- int dslot; /* channel # of d-channel (E1) default 16 */
21+
22+ u_int bmask[32]; /* bitmask of bchannels for port */
23+ u_char dnum[32]; /* array of used dchannel numbers for port */
24+ u_char created[32]; /* what port is created */
25+ u_int activity[32]; /* if there is any action on this */
26+ /* port (will be cleared after */
27+ /* showing led-states) */
28
29 u_long wdcount; /* every 500 ms we need to */
30 /* send the watchdog a signal */
31 u_char wdbyte; /* watchdog toggle byte */
32- u_int activity[8]; /* if there is any action on this */
33- /* port (will be cleared after */
34- /* showing led-states) */
35 int e1_state; /* keep track of last state */
36 int e1_getclock; /* if sync is retrieved from interface */
37 int syncronized; /* keep track of existing sync interface */
38@@ -233,7 +236,6 @@ struct hfc_multi {
39 * the bch->channel is equvalent to the hfc-channel
40 */
41 struct hfc_chan chan[32];
42- u_char created[8]; /* what port is created */
43 signed char slot_owner[256]; /* owner channel of slot */
44 };
45
46diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
47index e1dab30..4fe2d27 100644
48--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
49+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
50@@ -1619,8 +1619,8 @@ hfcmulti_leds(struct hfc_multi *hc)
51 * left red: frame sync, but no L1
52 * right green: L2 active
53 */
54- if (hc->chan[hc->dslot].sync != 2) { /* no frame sync */
55- if (hc->chan[hc->dslot].dch->dev.D.protocol
56+ if (hc->chan[hc->dnum[0]].sync != 2) { /* no frame sync */
57+ if (hc->chan[hc->dnum[0]].dch->dev.D.protocol
58 != ISDN_P_NT_E1) {
59 led[0] = 1;
60 led[1] = 1;
61@@ -2428,55 +2428,56 @@ handle_timer_irq(struct hfc_multi *hc)
62 }
63 }
64 if (hc->ctype == HFC_TYPE_E1 && hc->created[0]) {
65- dch = hc->chan[hc->dslot].dch;
66- if (test_bit(HFC_CFG_REPORT_LOS, &hc->chan[hc->dslot].cfg)) {
67+#warning todo: put interface parameters to hc
68+ dch = hc->chan[hc->dnum[0]].dch;
69+ if (test_bit(HFC_CFG_REPORT_LOS, &hc->chan[hc->dnum[0]].cfg)) {
70 /* LOS */
71 temp = HFC_inb_nodebug(hc, R_SYNC_STA) & V_SIG_LOS;
72- if (!temp && hc->chan[hc->dslot].los)
73+ if (!temp && hc->chan[hc->dnum[0]].los)
74 signal_state_up(dch, L1_SIGNAL_LOS_ON,
75 "LOS detected");
76- if (temp && !hc->chan[hc->dslot].los)
77+ if (temp && !hc->chan[hc->dnum[0]].los)
78 signal_state_up(dch, L1_SIGNAL_LOS_OFF,
79 "LOS gone");
80- hc->chan[hc->dslot].los = temp;
81+ hc->chan[hc->dnum[0]].los = temp;
82 }
83- if (test_bit(HFC_CFG_REPORT_AIS, &hc->chan[hc->dslot].cfg)) {
84+ if (test_bit(HFC_CFG_REPORT_AIS, &hc->chan[hc->dnum[0]].cfg)) {
85 /* AIS */
86 temp = HFC_inb_nodebug(hc, R_SYNC_STA) & V_AIS;
87- if (!temp && hc->chan[hc->dslot].ais)
88+ if (!temp && hc->chan[hc->dnum[0]].ais)
89 signal_state_up(dch, L1_SIGNAL_AIS_ON,
90 "AIS detected");
91- if (temp && !hc->chan[hc->dslot].ais)
92+ if (temp && !hc->chan[hc->dnum[0]].ais)
93 signal_state_up(dch, L1_SIGNAL_AIS_OFF,
94 "AIS gone");
95- hc->chan[hc->dslot].ais = temp;
96+ hc->chan[hc->dnum[0]].ais = temp;
97 }
98- if (test_bit(HFC_CFG_REPORT_SLIP, &hc->chan[hc->dslot].cfg)) {
99+ if (test_bit(HFC_CFG_REPORT_SLIP, &hc->chan[hc->dnum[0]].cfg)) {
100 /* SLIP */
101 temp = HFC_inb_nodebug(hc, R_SLIP) & V_FOSLIP_RX;
102- if (!temp && hc->chan[hc->dslot].slip_rx)
103+ if (!temp && hc->chan[hc->dnum[0]].slip_rx)
104 signal_state_up(dch, L1_SIGNAL_SLIP_RX,
105 " bit SLIP detected RX");
106- hc->chan[hc->dslot].slip_rx = temp;
107+ hc->chan[hc->dnum[0]].slip_rx = temp;
108 temp = HFC_inb_nodebug(hc, R_SLIP) & V_FOSLIP_TX;
109- if (!temp && hc->chan[hc->dslot].slip_tx)
110+ if (!temp && hc->chan[hc->dnum[0]].slip_tx)
111 signal_state_up(dch, L1_SIGNAL_SLIP_TX,
112 " bit SLIP detected TX");
113- hc->chan[hc->dslot].slip_tx = temp;
114+ hc->chan[hc->dnum[0]].slip_tx = temp;
115 }
116- if (test_bit(HFC_CFG_REPORT_RDI, &hc->chan[hc->dslot].cfg)) {
117+ if (test_bit(HFC_CFG_REPORT_RDI, &hc->chan[hc->dnum[0]].cfg)) {
118 /* RDI */
119 temp = HFC_inb_nodebug(hc, R_RX_SL0_0) & V_A;
120- if (!temp && hc->chan[hc->dslot].rdi)
121+ if (!temp && hc->chan[hc->dnum[0]].rdi)
122 signal_state_up(dch, L1_SIGNAL_RDI_ON,
123 "RDI detected");
124- if (temp && !hc->chan[hc->dslot].rdi)
125+ if (temp && !hc->chan[hc->dnum[0]].rdi)
126 signal_state_up(dch, L1_SIGNAL_RDI_OFF,
127 "RDI gone");
128- hc->chan[hc->dslot].rdi = temp;
129+ hc->chan[hc->dnum[0]].rdi = temp;
130 }
131 temp = HFC_inb_nodebug(hc, R_JATT_DIR);
132- switch (hc->chan[hc->dslot].sync) {
133+ switch (hc->chan[hc->dnum[0]].sync) {
134 case 0:
135 if ((temp & 0x60) == 0x60) {
136 if (debug & DEBUG_HFCMULTI_SYNC)
137@@ -2485,10 +2486,10 @@ handle_timer_irq(struct hfc_multi *hc)
138 "in clock sync\n",
139 __func__, hc->id);
140 HFC_outb(hc, R_RX_OFF,
141- hc->chan[hc->dslot].jitter | V_RX_INIT);
142+ hc->chan[hc->dnum[0]].jitter | V_RX_INIT);
143 HFC_outb(hc, R_TX_OFF,
144- hc->chan[hc->dslot].jitter | V_RX_INIT);
145- hc->chan[hc->dslot].sync = 1;
146+ hc->chan[hc->dnum[0]].jitter | V_RX_INIT);
147+ hc->chan[hc->dnum[0]].sync = 1;
148 goto check_framesync;
149 }
150 break;
151@@ -2499,7 +2500,7 @@ handle_timer_irq(struct hfc_multi *hc)
152 "%s: (id=%d) E1 "
153 "lost clock sync\n",
154 __func__, hc->id);
155- hc->chan[hc->dslot].sync = 0;
156+ hc->chan[hc->dnum[0]].sync = 0;
157 break;
158 }
159 check_framesync:
160@@ -2510,7 +2511,7 @@ check_framesync:
161 "%s: (id=%d) E1 "
162 "now in frame sync\n",
163 __func__, hc->id);
164- hc->chan[hc->dslot].sync = 2;
165+ hc->chan[hc->dnum[0]].sync = 2;
166 }
167 break;
168 case 2:
169@@ -2520,7 +2521,7 @@ check_framesync:
170 "%s: (id=%d) E1 lost "
171 "clock & frame sync\n",
172 __func__, hc->id);
173- hc->chan[hc->dslot].sync = 0;
174+ hc->chan[hc->dnum[0]].sync = 0;
175 break;
176 }
177 temp = HFC_inb_nodebug(hc, R_SYNC_STA);
178@@ -2530,7 +2531,7 @@ check_framesync:
179 "%s: (id=%d) E1 "
180 "lost frame sync\n",
181 __func__, hc->id);
182- hc->chan[hc->dslot].sync = 1;
183+ hc->chan[hc->dnum[0]].sync = 1;
184 }
185 break;
186 }
187@@ -2746,7 +2747,8 @@ hfcmulti_interrupt(int intno, void *dev_id)
188 if (r_irq_misc & V_STA_IRQ) {
189 if (hc->ctype == HFC_TYPE_E1) {
190 /* state machine */
191- dch = hc->chan[hc->dslot].dch;
192+#warning todo
193+ dch = hc->chan[hc->dnum[0]].dch;
194 e1_syncsta = HFC_inb_nodebug(hc, R_SYNC_STA);
195 if (test_bit(HFC_CHIP_PLXSD, &hc->chip)
196 && hc->e1_getclock) {
197@@ -2768,7 +2770,15 @@ hfcmulti_interrupt(int intno, void *dev_id)
198 }
199 dch->state = HFC_inb_nodebug(hc, R_E1_RD_STA)
200 & 0x7;
201+#warning todo hack!!! broadcast state change!!!
202+ dch = hc->chan[hc->dnum[0]].dch;
203 schedule_event(dch, FLG_PHCHANGE);
204+ dch = hc->chan[hc->dnum[1]].dch;
205+ dch->state = HFC_inb_nodebug(hc, R_E1_RD_STA)
206+ & 0x7;
207+ schedule_event(dch, FLG_PHCHANGE);
208+
209+
210 if (debug & DEBUG_HFCMULTI_STATE)
211 printk(KERN_DEBUG
212 "%s: E1 (id=%d) newstate %x\n",
213@@ -3851,31 +3861,35 @@ hfcmulti_initmode(struct dchannel *dch)
214 if (debug & DEBUG_HFCMULTI_INIT)
215 printk(KERN_DEBUG "%s: entered\n", __func__);
216
217+ i = dch->slot;
218+ pt = hc->chan[i].port;
219 if (hc->ctype == HFC_TYPE_E1) {
220- hc->chan[hc->dslot].slot_tx = -1;
221- hc->chan[hc->dslot].slot_rx = -1;
222- hc->chan[hc->dslot].conf = -1;
223- if (hc->dslot) {
224- mode_hfcmulti(hc, hc->dslot, dch->dev.D.protocol,
225+ /* E1 */
226+#warning todo: don''t do it if dnum == 0
227+ hc->chan[hc->dnum[pt]].slot_tx = -1;
228+ hc->chan[hc->dnum[pt]].slot_rx = -1;
229+ hc->chan[hc->dnum[pt]].conf = -1;
230+ if (hc->dnum[pt]) {
231+ mode_hfcmulti(hc, dch->slot, dch->dev.D.protocol,
232 -1, 0, -1, 0);
233 dch->timer.function = (void *) hfcmulti_dbusy_timer;
234 dch->timer.data = (long) dch;
235 init_timer(&dch->timer);
236 }
237 for (i = 1; i <= 31; i++) {
238- if (i == hc->dslot)
239+ if (!((1 << i) & hc->bmask[pt])) /* skip unused channel */
240 continue;
241 hc->chan[i].slot_tx = -1;
242 hc->chan[i].slot_rx = -1;
243 hc->chan[i].conf = -1;
244 mode_hfcmulti(hc, i, ISDN_P_NONE, -1, 0, -1, 0);
245 }
246- /* E1 */
247- if (test_bit(HFC_CFG_REPORT_LOS, &hc->chan[hc->dslot].cfg)) {
248+#warning todo (global)
249+ if (test_bit(HFC_CFG_REPORT_LOS, &hc->chan[hc->dnum[pt]].cfg)) {
250 HFC_outb(hc, R_LOS0, 255); /* 2 ms */
251 HFC_outb(hc, R_LOS1, 255); /* 512 ms */
252 }
253- if (test_bit(HFC_CFG_OPTICAL, &hc->chan[hc->dslot].cfg)) {
254+ if (test_bit(HFC_CFG_OPTICAL, &hc->chan[hc->dnum[pt]].cfg)) {
255 HFC_outb(hc, R_RX0, 0);
256 hc->hw.r_tx0 = 0 | V_OUT_EN;
257 } else {
258@@ -3888,12 +3902,12 @@ hfcmulti_initmode(struct dchannel *dch)
259 HFC_outb(hc, R_TX_FR0, 0x00);
260 HFC_outb(hc, R_TX_FR1, 0xf8);
261
262- if (test_bit(HFC_CFG_CRC4, &hc->chan[hc->dslot].cfg))
263+ if (test_bit(HFC_CFG_CRC4, &hc->chan[hc->dnum[pt]].cfg))
264 HFC_outb(hc, R_TX_FR2, V_TX_MF | V_TX_E | V_NEG_E);
265
266 HFC_outb(hc, R_RX_FR0, V_AUTO_RESYNC | V_AUTO_RECO | 0);
267
268- if (test_bit(HFC_CFG_CRC4, &hc->chan[hc->dslot].cfg))
269+ if (test_bit(HFC_CFG_CRC4, &hc->chan[hc->dnum[pt]].cfg))
270 HFC_outb(hc, R_RX_FR1, V_RX_MF | V_RX_MF_SYNC);
271
272 if (dch->dev.D.protocol == ISDN_P_NT_E1) {
273@@ -3957,7 +3971,7 @@ hfcmulti_initmode(struct dchannel *dch)
274 plxsd_checksync(hc, 0);
275 }
276 } else {
277- i = dch->slot;
278+ /* ST */
279 hc->chan[i].slot_tx = -1;
280 hc->chan[i].slot_rx = -1;
281 hc->chan[i].conf = -1;
282@@ -3973,8 +3987,6 @@ hfcmulti_initmode(struct dchannel *dch)
283 hc->chan[i - 1].slot_rx = -1;
284 hc->chan[i - 1].conf = -1;
285 mode_hfcmulti(hc, i - 1, ISDN_P_NONE, -1, 0, -1, 0);
286- /* ST */
287- pt = hc->chan[i].port;
288 /* select interface */
289 HFC_outb(hc, R_ST_SEL, pt);
290 /* undocumented: delay after R_ST_SEL */
291@@ -4557,6 +4569,8 @@ release_port(struct hfc_multi *hc, struct dchannel *dch)
292 }
293 /* free channels */
294 for (i = 0; i <= 31; i++) {
295+ if (!((1 << i) & hc->bmask[pt])) /* skip unused channel */
296+ continue;
297 if (hc->chan[i].bch) {
298 if (debug & DEBUG_HFCMULTI_INIT)
299 printk(KERN_DEBUG
300@@ -4680,12 +4694,13 @@ release_card(struct hfc_multi *hc)
301 }
302
303 static int
304-init_e1_port(struct hfc_multi *hc, struct hm_map *m)
305+init_e1_port(struct hfc_multi *hc, struct hm_map *m, int pt)
306 {
307 struct dchannel *dch;
308 struct bchannel *bch;
309 int ch, ret = 0;
310 char name[MISDN_MAX_IDLEN];
311+ int bcount = 0;
312
313 dch = kzalloc(sizeof(struct dchannel), GFP_KERNEL);
314 if (!dch)
315@@ -4698,13 +4713,12 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
316 (1 << (ISDN_P_B_HDLC & ISDN_P_B_MASK));
317 dch->dev.D.send = handle_dmsg;
318 dch->dev.D.ctrl = hfcm_dctrl;
319- dch->dev.nrbchan = (hc->dslot) ? 30 : 31;
320- dch->slot = hc->dslot;
321- hc->chan[hc->dslot].dch = dch;
322- hc->chan[hc->dslot].port = 0;
323- hc->chan[hc->dslot].nt_timer = -1;
324+ dch->slot = hc->dnum[pt];
325+ hc->chan[hc->dnum[pt]].dch = dch;
326+ hc->chan[hc->dnum[pt]].port = pt;
327+ hc->chan[hc->dnum[pt]].nt_timer = -1;
328 for (ch = 1; ch <= 31; ch++) {
329- if (ch == hc->dslot) /* skip dchannel */
330+ if (!((1 << ch) & hc->bmask[pt])) /* skip unused channel */
331 continue;
332 bch = kzalloc(sizeof(struct bchannel), GFP_KERNEL);
333 if (!bch) {
334@@ -4733,7 +4747,10 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
335 hc->chan[ch].bch = bch;
336 hc->chan[ch].port = 0;
337 set_channelmap(bch->nr, dch->dev.channelmap);
338+ bcount++;
339 }
340+ dch->dev.nrbchan = bcount;
341+#warning todo: must be set globally, and must be a seperate function
342 /* set optical line type */
343 if (port[Port_cnt] & 0x001) {
344 if (!m->opticalsupport) {
345@@ -4749,7 +4766,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
346 __func__,
347 HFC_cnt + 1, 1);
348 test_and_set_bit(HFC_CFG_OPTICAL,
349- &hc->chan[hc->dslot].cfg);
350+ &hc->chan[hc->dnum[pt]].cfg);
351 }
352 }
353 /* set LOS report */
354@@ -4759,7 +4776,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
355 "LOS report: card(%d) port(%d)\n",
356 __func__, HFC_cnt + 1, 1);
357 test_and_set_bit(HFC_CFG_REPORT_LOS,
358- &hc->chan[hc->dslot].cfg);
359+ &hc->chan[hc->dnum[pt]].cfg);
360 }
361 /* set AIS report */
362 if (port[Port_cnt] & 0x008) {
363@@ -4768,7 +4785,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
364 "AIS report: card(%d) port(%d)\n",
365 __func__, HFC_cnt + 1, 1);
366 test_and_set_bit(HFC_CFG_REPORT_AIS,
367- &hc->chan[hc->dslot].cfg);
368+ &hc->chan[hc->dnum[pt]].cfg);
369 }
370 /* set SLIP report */
371 if (port[Port_cnt] & 0x010) {
372@@ -4778,7 +4795,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
373 "card(%d) port(%d)\n",
374 __func__, HFC_cnt + 1, 1);
375 test_and_set_bit(HFC_CFG_REPORT_SLIP,
376- &hc->chan[hc->dslot].cfg);
377+ &hc->chan[hc->dnum[pt]].cfg);
378 }
379 /* set RDI report */
380 if (port[Port_cnt] & 0x020) {
381@@ -4788,7 +4805,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
382 "card(%d) port(%d)\n",
383 __func__, HFC_cnt + 1, 1);
384 test_and_set_bit(HFC_CFG_REPORT_RDI,
385- &hc->chan[hc->dslot].cfg);
386+ &hc->chan[hc->dnum[pt]].cfg);
387 }
388 /* set CRC-4 Mode */
389 if (!(port[Port_cnt] & 0x100)) {
390@@ -4797,7 +4814,7 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
391 " card(%d) port(%d)\n",
392 __func__, HFC_cnt + 1, 1);
393 test_and_set_bit(HFC_CFG_CRC4,
394- &hc->chan[hc->dslot].cfg);
395+ &hc->chan[hc->dnum[pt]].cfg);
396 } else {
397 if (debug & DEBUG_HFCMULTI_INIT)
398 printk(KERN_DEBUG "%s: PORT turn off CRC4"
399@@ -4829,20 +4846,23 @@ init_e1_port(struct hfc_multi *hc, struct hm_map *m)
400 }
401 /* set elastic jitter buffer */
402 if (port[Port_cnt] & 0x3000) {
403- hc->chan[hc->dslot].jitter = (port[Port_cnt]>>12) & 0x3;
404+ hc->chan[hc->dnum[pt]].jitter = (port[Port_cnt]>>12) & 0x3;
405 if (debug & DEBUG_HFCMULTI_INIT)
406 printk(KERN_DEBUG
407 "%s: PORT set elastic "
408 "buffer to %d: card(%d) port(%d)\n",
409- __func__, hc->chan[hc->dslot].jitter,
410+ __func__, hc->chan[hc->dnum[pt]].jitter,
411 HFC_cnt + 1, 1);
412 } else
413- hc->chan[hc->dslot].jitter = 2; /* default */
414- snprintf(name, MISDN_MAX_IDLEN - 1, "hfc-e1.%d", HFC_cnt + 1);
415+ hc->chan[hc->dnum[pt]].jitter = 2; /* default */
416+ if (hc->ports > 1)
417+ snprintf(name, MISDN_MAX_IDLEN - 1, "hfc-e1.%d-%d", HFC_cnt + 1, pt+1);
418+ else
419+ snprintf(name, MISDN_MAX_IDLEN - 1, "hfc-e1.%d", HFC_cnt + 1);
420 ret = mISDN_register_device(&dch->dev, &hc->pci_dev->dev, name);
421 if (ret)
422 goto free_chan;
423- hc->created[0] = 1;
424+ hc->created[pt] = 1;
425 return ret;
426 free_chan:
427 release_port(hc, dch);
428@@ -5009,18 +5029,30 @@ hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
429 hc->id = HFC_cnt;
430 hc->pcm = pcm[HFC_cnt];
431 hc->io_mode = iomode[HFC_cnt];
432+#warning todo: rework module parameters for customizing e1 fragments.... yea, let''s call it: fragments
433 if (dslot[HFC_cnt] < 0 && hc->ctype == HFC_TYPE_E1) {
434- hc->dslot = 0;
435+ hc->dnum[0] = 0;
436 printk(KERN_INFO "HFC-E1 card has disabled D-channel, but "
437 "31 B-channels\n");
438 }
439 if (dslot[HFC_cnt] > 0 && dslot[HFC_cnt] < 32
440 && hc->ctype == HFC_TYPE_E1) {
441- hc->dslot = dslot[HFC_cnt];
442+ hc->dnum[0] = dslot[HFC_cnt];
443 printk(KERN_INFO "HFC-E1 card has alternating D-channel on "
444 "time slot %d\n", dslot[HFC_cnt]);
445 } else
446- hc->dslot = 16;
447+ hc->dnum[0] = 16;
448+
449+#warning todo HACK!!! just a small map of two "fragments"
450+ if (hc->ctype == HFC_TYPE_E1) {
451+ hc->dnum[0] = 1;
452+ hc->bmask[0] = 0x0000003c;
453+ hc->dnum[1] = 6;
454+ hc->bmask[1] = 0x00000780;
455+ hc->dnum[2] = 11;
456+ hc->bmask[2] = 0x00007800;
457+ hc->ports = 3;
458+ }
459
460 /* set chip specific features */
461 hc->masterclk = -1;
462@@ -5103,7 +5135,7 @@ hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
463 goto free_card;
464 }
465 if (hc->ctype == HFC_TYPE_E1)
466- ret_err = init_e1_port(hc, m);
467+ ret_err = init_e1_port(hc, m, pt);
468 else
469 ret_err = init_multi_port(hc, pt);
470 if (debug & DEBUG_HFCMULTI_INIT)
471@@ -5115,10 +5147,14 @@ hfcmulti_init(struct hm_map *m, struct pci_dev *pdev,
472 if (ret_err) {
473 while (pt) { /* release already registered ports */
474 pt--;
475- release_port(hc, hc->chan[(pt << 2) + 2].dch);
476+ if (hc->ctype == HFC_TYPE_E1)
477+ release_port(hc, hc->chan[hc->dnum[pt]].dch);
478+ else
479+ release_port(hc, hc->chan[(pt << 2) + 2].dch);
480 }
481 goto free_card;
482 }
483+#warning todo: count it right, add additional "fragment" counter...
484 Port_cnt++;
485 }
486