aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Keil <isdn@linux-pingi.de>2012-05-04 00:15:33 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-04 11:55:05 -0400
commitc626c127279b265ab293348763e043864d58d42c (patch)
tree476fa67d42bff3a1a27d97818fa66d16bf501a88
parent8423e6b212a19d5f02232855dec73196297b5ee9 (diff)
mISDN: Make layer1 timer 3 value configurable
For certification test it is very useful to change the layer1 timer3 value on runtime. Signed-off-by: Karsten Keil <kkeil@linux-pingi.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/isdn/hardware/mISDN/avmfritz.c5
-rw-r--r--drivers/isdn/hardware/mISDN/hfcmulti.c5
-rw-r--r--drivers/isdn/hardware/mISDN/hfcpci.c5
-rw-r--r--drivers/isdn/hardware/mISDN/mISDNipac.c17
-rw-r--r--drivers/isdn/hardware/mISDN/netjet.c5
-rw-r--r--drivers/isdn/hardware/mISDN/speedfax.c5
-rw-r--r--drivers/isdn/hardware/mISDN/w6692.c5
-rw-r--r--drivers/isdn/mISDN/layer1.c16
-rw-r--r--include/linux/mISDNhw.h3
-rw-r--r--include/linux/mISDNif.h3
10 files changed, 55 insertions, 14 deletions
diff --git a/drivers/isdn/hardware/mISDN/avmfritz.c b/drivers/isdn/hardware/mISDN/avmfritz.c
index c0b8c960ee3f..6bf2c58795a3 100644
--- a/drivers/isdn/hardware/mISDN/avmfritz.c
+++ b/drivers/isdn/hardware/mISDN/avmfritz.c
@@ -868,7 +868,7 @@ channel_ctrl(struct fritzcard *fc, struct mISDN_ctrl_req *cq)
868 868
869 switch (cq->op) { 869 switch (cq->op) {
870 case MISDN_CTRL_GETOP: 870 case MISDN_CTRL_GETOP:
871 cq->op = MISDN_CTRL_LOOP; 871 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_L1_TIMER3;
872 break; 872 break;
873 case MISDN_CTRL_LOOP: 873 case MISDN_CTRL_LOOP:
874 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */ 874 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */
@@ -878,6 +878,9 @@ channel_ctrl(struct fritzcard *fc, struct mISDN_ctrl_req *cq)
878 } 878 }
879 ret = fc->isac.ctrl(&fc->isac, HW_TESTLOOP, cq->channel); 879 ret = fc->isac.ctrl(&fc->isac, HW_TESTLOOP, cq->channel);
880 break; 880 break;
881 case MISDN_CTRL_L1_TIMER3:
882 ret = fc->isac.ctrl(&fc->isac, HW_TIMER3_VALUE, cq->p1);
883 break;
881 default: 884 default:
882 pr_info("%s: %s unknown Op %x\n", fc->name, __func__, cq->op); 885 pr_info("%s: %s unknown Op %x\n", fc->name, __func__, cq->op);
883 ret = -EINVAL; 886 ret = -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c
index 43013316b9b0..4c128e4bb5cf 100644
--- a/drivers/isdn/hardware/mISDN/hfcmulti.c
+++ b/drivers/isdn/hardware/mISDN/hfcmulti.c
@@ -4161,7 +4161,7 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)
4161 4161
4162 switch (cq->op) { 4162 switch (cq->op) {
4163 case MISDN_CTRL_GETOP: 4163 case MISDN_CTRL_GETOP:
4164 cq->op = MISDN_CTRL_HFC_OP; 4164 cq->op = MISDN_CTRL_HFC_OP | MISDN_CTRL_L1_TIMER3;
4165 break; 4165 break;
4166 case MISDN_CTRL_HFC_WD_INIT: /* init the watchdog */ 4166 case MISDN_CTRL_HFC_WD_INIT: /* init the watchdog */
4167 wd_cnt = cq->p1 & 0xf; 4167 wd_cnt = cq->p1 & 0xf;
@@ -4191,6 +4191,9 @@ channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq)
4191 __func__); 4191 __func__);
4192 HFC_outb(hc, R_BERT_WD_MD, hc->hw.r_bert_wd_md | V_WD_RES); 4192 HFC_outb(hc, R_BERT_WD_MD, hc->hw.r_bert_wd_md | V_WD_RES);
4193 break; 4193 break;
4194 case MISDN_CTRL_L1_TIMER3:
4195 ret = l1_event(dch->l1, HW_TIMER3_VALUE | (cq->p1 & 0xff));
4196 break;
4194 default: 4197 default:
4195 printk(KERN_WARNING "%s: unknown Op %x\n", 4198 printk(KERN_WARNING "%s: unknown Op %x\n",
4196 __func__, cq->op); 4199 __func__, cq->op);
diff --git a/drivers/isdn/hardware/mISDN/hfcpci.c b/drivers/isdn/hardware/mISDN/hfcpci.c
index e2c83a2d7691..5fe993e2dee9 100644
--- a/drivers/isdn/hardware/mISDN/hfcpci.c
+++ b/drivers/isdn/hardware/mISDN/hfcpci.c
@@ -1819,7 +1819,7 @@ channel_ctrl(struct hfc_pci *hc, struct mISDN_ctrl_req *cq)
1819 switch (cq->op) { 1819 switch (cq->op) {
1820 case MISDN_CTRL_GETOP: 1820 case MISDN_CTRL_GETOP:
1821 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_CONNECT | 1821 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_CONNECT |
1822 MISDN_CTRL_DISCONNECT; 1822 MISDN_CTRL_DISCONNECT | MISDN_CTRL_L1_TIMER3;
1823 break; 1823 break;
1824 case MISDN_CTRL_LOOP: 1824 case MISDN_CTRL_LOOP:
1825 /* channel 0 disabled loop */ 1825 /* channel 0 disabled loop */
@@ -1896,6 +1896,9 @@ channel_ctrl(struct hfc_pci *hc, struct mISDN_ctrl_req *cq)
1896 Write_hfc(hc, HFCPCI_CONNECT, hc->hw.conn); 1896 Write_hfc(hc, HFCPCI_CONNECT, hc->hw.conn);
1897 hc->hw.trm &= 0x7f; /* disable IOM-loop */ 1897 hc->hw.trm &= 0x7f; /* disable IOM-loop */
1898 break; 1898 break;
1899 case MISDN_CTRL_L1_TIMER3:
1900 ret = l1_event(hc->dch.l1, HW_TIMER3_VALUE | (cq->p1 & 0xff));
1901 break;
1899 default: 1902 default:
1900 printk(KERN_WARNING "%s: unknown Op %x\n", 1903 printk(KERN_WARNING "%s: unknown Op %x\n",
1901 __func__, cq->op); 1904 __func__, cq->op);
diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index 884369f09cad..92d4a78bc0a5 100644
--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -603,10 +603,11 @@ isac_l1hw(struct mISDNchannel *ch, struct sk_buff *skb)
603} 603}
604 604
605static int 605static int
606isac_ctrl(struct isac_hw *isac, u32 cmd, u_long para) 606isac_ctrl(struct isac_hw *isac, u32 cmd, unsigned long para)
607{ 607{
608 u8 tl = 0; 608 u8 tl = 0;
609 u_long flags; 609 unsigned long flags;
610 int ret = 0;
610 611
611 switch (cmd) { 612 switch (cmd) {
612 case HW_TESTLOOP: 613 case HW_TESTLOOP:
@@ -626,12 +627,15 @@ isac_ctrl(struct isac_hw *isac, u32 cmd, u_long para)
626 } 627 }
627 spin_unlock_irqrestore(isac->hwlock, flags); 628 spin_unlock_irqrestore(isac->hwlock, flags);
628 break; 629 break;
630 case HW_TIMER3_VALUE:
631 ret = l1_event(isac->dch.l1, HW_TIMER3_VALUE | (para & 0xff));
632 break;
629 default: 633 default:
630 pr_debug("%s: %s unknown command %x %lx\n", isac->name, 634 pr_debug("%s: %s unknown command %x %lx\n", isac->name,
631 __func__, cmd, para); 635 __func__, cmd, para);
632 return -1; 636 ret = -1;
633 } 637 }
634 return 0; 638 return ret;
635} 639}
636 640
637static int 641static int
@@ -1526,7 +1530,7 @@ channel_ctrl(struct ipac_hw *ipac, struct mISDN_ctrl_req *cq)
1526 1530
1527 switch (cq->op) { 1531 switch (cq->op) {
1528 case MISDN_CTRL_GETOP: 1532 case MISDN_CTRL_GETOP:
1529 cq->op = MISDN_CTRL_LOOP; 1533 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_L1_TIMER3;
1530 break; 1534 break;
1531 case MISDN_CTRL_LOOP: 1535 case MISDN_CTRL_LOOP:
1532 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */ 1536 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */
@@ -1536,6 +1540,9 @@ channel_ctrl(struct ipac_hw *ipac, struct mISDN_ctrl_req *cq)
1536 } 1540 }
1537 ret = ipac->ctrl(ipac, HW_TESTLOOP, cq->channel); 1541 ret = ipac->ctrl(ipac, HW_TESTLOOP, cq->channel);
1538 break; 1542 break;
1543 case MISDN_CTRL_L1_TIMER3:
1544 ret = ipac->isac.ctrl(&ipac->isac, HW_TIMER3_VALUE, cq->p1);
1545 break;
1539 default: 1546 default:
1540 pr_info("%s: unknown CTRL OP %x\n", ipac->name, cq->op); 1547 pr_info("%s: unknown CTRL OP %x\n", ipac->name, cq->op);
1541 ret = -EINVAL; 1548 ret = -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/netjet.c b/drivers/isdn/hardware/mISDN/netjet.c
index c726e09d0981..27998d7188a5 100644
--- a/drivers/isdn/hardware/mISDN/netjet.c
+++ b/drivers/isdn/hardware/mISDN/netjet.c
@@ -837,7 +837,7 @@ channel_ctrl(struct tiger_hw *card, struct mISDN_ctrl_req *cq)
837 837
838 switch (cq->op) { 838 switch (cq->op) {
839 case MISDN_CTRL_GETOP: 839 case MISDN_CTRL_GETOP:
840 cq->op = MISDN_CTRL_LOOP; 840 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_L1_TIMER3;
841 break; 841 break;
842 case MISDN_CTRL_LOOP: 842 case MISDN_CTRL_LOOP:
843 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */ 843 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */
@@ -847,6 +847,9 @@ channel_ctrl(struct tiger_hw *card, struct mISDN_ctrl_req *cq)
847 } 847 }
848 ret = card->isac.ctrl(&card->isac, HW_TESTLOOP, cq->channel); 848 ret = card->isac.ctrl(&card->isac, HW_TESTLOOP, cq->channel);
849 break; 849 break;
850 case MISDN_CTRL_L1_TIMER3:
851 ret = card->isac.ctrl(&card->isac, HW_TIMER3_VALUE, cq->p1);
852 break;
850 default: 853 default:
851 pr_info("%s: %s unknown Op %x\n", card->name, __func__, cq->op); 854 pr_info("%s: %s unknown Op %x\n", card->name, __func__, cq->op);
852 ret = -EINVAL; 855 ret = -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/speedfax.c b/drivers/isdn/hardware/mISDN/speedfax.c
index 04689935148b..93f344d74e54 100644
--- a/drivers/isdn/hardware/mISDN/speedfax.c
+++ b/drivers/isdn/hardware/mISDN/speedfax.c
@@ -224,7 +224,7 @@ channel_ctrl(struct sfax_hw *sf, struct mISDN_ctrl_req *cq)
224 224
225 switch (cq->op) { 225 switch (cq->op) {
226 case MISDN_CTRL_GETOP: 226 case MISDN_CTRL_GETOP:
227 cq->op = MISDN_CTRL_LOOP; 227 cq->op = MISDN_CTRL_LOOP | MISDN_CTRL_L1_TIMER3;
228 break; 228 break;
229 case MISDN_CTRL_LOOP: 229 case MISDN_CTRL_LOOP:
230 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */ 230 /* cq->channel: 0 disable, 1 B1 loop 2 B2 loop, 3 both */
@@ -234,6 +234,9 @@ channel_ctrl(struct sfax_hw *sf, struct mISDN_ctrl_req *cq)
234 } 234 }
235 ret = sf->isac.ctrl(&sf->isac, HW_TESTLOOP, cq->channel); 235 ret = sf->isac.ctrl(&sf->isac, HW_TESTLOOP, cq->channel);
236 break; 236 break;
237 case MISDN_CTRL_L1_TIMER3:
238 ret = sf->isac.ctrl(&sf->isac, HW_TIMER3_VALUE, cq->p1);
239 break;
237 default: 240 default:
238 pr_info("%s: unknown Op %x\n", sf->name, cq->op); 241 pr_info("%s: unknown Op %x\n", sf->name, cq->op);
239 ret = -EINVAL; 242 ret = -EINVAL;
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index 2183357f0799..1d044670ff66 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1035,7 +1035,10 @@ channel_ctrl(struct w6692_hw *card, struct mISDN_ctrl_req *cq)
1035 1035
1036 switch (cq->op) { 1036 switch (cq->op) {
1037 case MISDN_CTRL_GETOP: 1037 case MISDN_CTRL_GETOP:
1038 cq->op = 0; 1038 cq->op = MISDN_CTRL_L1_TIMER3;
1039 break;
1040 case MISDN_CTRL_L1_TIMER3:
1041 ret = l1_event(card->dch.l1, HW_TIMER3_VALUE | (cq->p1 & 0xff));
1039 break; 1042 break;
1040 default: 1043 default:
1041 pr_info("%s: unknown CTRL OP %x\n", card->name, cq->op); 1044 pr_info("%s: unknown CTRL OP %x\n", card->name, cq->op);
diff --git a/drivers/isdn/mISDN/layer1.c b/drivers/isdn/mISDN/layer1.c
index 0fc49b375514..ff0515323c86 100644
--- a/drivers/isdn/mISDN/layer1.c
+++ b/drivers/isdn/mISDN/layer1.c
@@ -30,11 +30,12 @@ struct layer1 {
30 struct FsmInst l1m; 30 struct FsmInst l1m;
31 struct FsmTimer timer; 31 struct FsmTimer timer;
32 int delay; 32 int delay;
33 int t3_value;
33 struct dchannel *dch; 34 struct dchannel *dch;
34 dchannel_l1callback *dcb; 35 dchannel_l1callback *dcb;
35}; 36};
36 37
37#define TIMER3_VALUE 7000 38#define TIMER3_DEFAULT_VALUE 7000
38 39
39static 40static
40struct Fsm l1fsm_s = {NULL, 0, 0, NULL, NULL}; 41struct Fsm l1fsm_s = {NULL, 0, 0, NULL, NULL};
@@ -233,7 +234,7 @@ l1_activate_s(struct FsmInst *fi, int event, void *arg)
233{ 234{
234 struct layer1 *l1 = fi->userdata; 235 struct layer1 *l1 = fi->userdata;
235 236
236 mISDN_FsmRestartTimer(&l1->timer, TIMER3_VALUE, EV_TIMER3, NULL, 2); 237 mISDN_FsmRestartTimer(&l1->timer, l1->t3_value, EV_TIMER3, NULL, 2);
237 test_and_set_bit(FLG_L1_T3RUN, &l1->Flags); 238 test_and_set_bit(FLG_L1_T3RUN, &l1->Flags);
238 l1->dcb(l1->dch, HW_RESET_REQ); 239 l1->dcb(l1->dch, HW_RESET_REQ);
239} 240}
@@ -356,6 +357,16 @@ l1_event(struct layer1 *l1, u_int event)
356 release_l1(l1); 357 release_l1(l1);
357 break; 358 break;
358 default: 359 default:
360 if ((event & ~HW_TIMER3_VMASK) == HW_TIMER3_VALUE) {
361 int val = event & HW_TIMER3_VMASK;
362
363 if (val < 5)
364 val = 5;
365 if (val > 30)
366 val = 30;
367 l1->t3_value = val;
368 break;
369 }
359 if (*debug & DEBUG_L1) 370 if (*debug & DEBUG_L1)
360 printk(KERN_DEBUG "%s %x unhandled\n", 371 printk(KERN_DEBUG "%s %x unhandled\n",
361 __func__, event); 372 __func__, event);
@@ -377,6 +388,7 @@ create_l1(struct dchannel *dch, dchannel_l1callback *dcb) {
377 nl1->l1m.fsm = &l1fsm_s; 388 nl1->l1m.fsm = &l1fsm_s;
378 nl1->l1m.state = ST_L1_F3; 389 nl1->l1m.state = ST_L1_F3;
379 nl1->Flags = 0; 390 nl1->Flags = 0;
391 nl1->t3_value = TIMER3_DEFAULT_VALUE;
380 nl1->l1m.debug = *debug & DEBUG_L1_FSM; 392 nl1->l1m.debug = *debug & DEBUG_L1_FSM;
381 nl1->l1m.userdata = nl1; 393 nl1->l1m.userdata = nl1;
382 nl1->l1m.userint = 0; 394 nl1->l1m.userint = 0;
diff --git a/include/linux/mISDNhw.h b/include/linux/mISDNhw.h
index 4af841408fb5..de165b54237b 100644
--- a/include/linux/mISDNhw.h
+++ b/include/linux/mISDNhw.h
@@ -135,6 +135,9 @@ extern int create_l1(struct dchannel *, dchannel_l1callback *);
135#define HW_TESTRX_RAW 0x9602 135#define HW_TESTRX_RAW 0x9602
136#define HW_TESTRX_HDLC 0x9702 136#define HW_TESTRX_HDLC 0x9702
137#define HW_TESTRX_OFF 0x9802 137#define HW_TESTRX_OFF 0x9802
138#define HW_TIMER3_IND 0x9902
139#define HW_TIMER3_VALUE 0x9a00
140#define HW_TIMER3_VMASK 0x00FF
138 141
139struct layer1; 142struct layer1;
140extern int l1_event(struct layer1 *, u_int); 143extern int l1_event(struct layer1 *, u_int);
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h
index b80f7648562a..9cc8ce57d259 100644
--- a/include/linux/mISDNif.h
+++ b/include/linux/mISDNif.h
@@ -37,7 +37,7 @@
37 */ 37 */
38#define MISDN_MAJOR_VERSION 1 38#define MISDN_MAJOR_VERSION 1
39#define MISDN_MINOR_VERSION 1 39#define MISDN_MINOR_VERSION 1
40#define MISDN_RELEASE 26 40#define MISDN_RELEASE 27
41 41
42/* primitives for information exchange 42/* primitives for information exchange
43 * generell format 43 * generell format
@@ -372,6 +372,7 @@ clear_channelmap(u_int nr, u_char *map)
372#define MISDN_CTRL_RX_OFF 0x0100 372#define MISDN_CTRL_RX_OFF 0x0100
373#define MISDN_CTRL_FILL_EMPTY 0x0200 373#define MISDN_CTRL_FILL_EMPTY 0x0200
374#define MISDN_CTRL_GETPEER 0x0400 374#define MISDN_CTRL_GETPEER 0x0400
375#define MISDN_CTRL_L1_TIMER3 0x0800
375#define MISDN_CTRL_HW_FEATURES_OP 0x2000 376#define MISDN_CTRL_HW_FEATURES_OP 0x2000
376#define MISDN_CTRL_HW_FEATURES 0x2001 377#define MISDN_CTRL_HW_FEATURES 0x2001
377#define MISDN_CTRL_HFC_OP 0x4000 378#define MISDN_CTRL_HFC_OP 0x4000