diff options
author | Andreas Eversberg <andreas@eversberg.eu> | 2009-05-22 07:04:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-25 03:51:18 -0400 |
commit | 7df3bb8f59ca8e346bb834006c257cc367c6250a (patch) | |
tree | a23f31e3a3138e0b4f5b9d13f32d0a097a93960a | |
parent | 9bcb97cace615a9f57fca0b9d788e7d234d7fc95 (diff) |
mISDN: Add watchdog functionality to hfcmulti driver
This patch was made by Titus Moldovan and provides IOCTL functions for enabling
and disabling the controller's built in watchdog. The use is optional.
Signed-off-by: Andreas Eversberg <andreas@eversberg.eu>
Signed-off-by: Karsten Keil <keil@b1-systems.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfc_multi.h | 1 | ||||
-rw-r--r-- | drivers/isdn/hardware/mISDN/hfcmulti.c | 32 | ||||
-rw-r--r-- | include/linux/mISDNif.h | 3 |
3 files changed, 34 insertions, 2 deletions
diff --git a/drivers/isdn/hardware/mISDN/hfc_multi.h b/drivers/isdn/hardware/mISDN/hfc_multi.h index 663b77f578be..5765e1962911 100644 --- a/drivers/isdn/hardware/mISDN/hfc_multi.h +++ b/drivers/isdn/hardware/mISDN/hfc_multi.h | |||
@@ -62,6 +62,7 @@ struct hfcm_hw { | |||
62 | u_char r_sci_msk; | 62 | u_char r_sci_msk; |
63 | u_char r_tx0, r_tx1; | 63 | u_char r_tx0, r_tx1; |
64 | u_char a_st_ctrl0[8]; | 64 | u_char a_st_ctrl0[8]; |
65 | u_char r_bert_wd_md; | ||
65 | timer_t timer; | 66 | timer_t timer; |
66 | }; | 67 | }; |
67 | 68 | ||
diff --git a/drivers/isdn/hardware/mISDN/hfcmulti.c b/drivers/isdn/hardware/mISDN/hfcmulti.c index 0b28141e43bf..ca153de6954e 100644 --- a/drivers/isdn/hardware/mISDN/hfcmulti.c +++ b/drivers/isdn/hardware/mISDN/hfcmulti.c | |||
@@ -4013,11 +4013,41 @@ open_bchannel(struct hfc_multi *hc, struct dchannel *dch, | |||
4013 | static int | 4013 | static int |
4014 | channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq) | 4014 | channel_dctrl(struct dchannel *dch, struct mISDN_ctrl_req *cq) |
4015 | { | 4015 | { |
4016 | struct hfc_multi *hc = dch->hw; | ||
4016 | int ret = 0; | 4017 | int ret = 0; |
4018 | int wd_mode, wd_cnt; | ||
4017 | 4019 | ||
4018 | switch (cq->op) { | 4020 | switch (cq->op) { |
4019 | case MISDN_CTRL_GETOP: | 4021 | case MISDN_CTRL_GETOP: |
4020 | cq->op = 0; | 4022 | cq->op = MISDN_CTRL_HFC_OP; |
4023 | break; | ||
4024 | case MISDN_CTRL_HFC_WD_INIT: /* init the watchdog */ | ||
4025 | wd_cnt = cq->p1 & 0xf; | ||
4026 | wd_mode = !!(cq->p1 >> 4); | ||
4027 | if (debug & DEBUG_HFCMULTI_MSG) | ||
4028 | printk(KERN_DEBUG | ||
4029 | "%s: MISDN_CTRL_HFC_WD_INIT mode %s counter 0x%x\n", | ||
4030 | __func__, wd_mode ? "AUTO" : "MANUAL", wd_cnt); | ||
4031 | /* set the watchdog timer */ | ||
4032 | HFC_outb(hc, R_TI_WD, poll_timer | (wd_cnt << 4)); | ||
4033 | hc->hw.r_bert_wd_md = (wd_mode ? V_AUTO_WD_RES : 0); | ||
4034 | if (hc->ctype == HFC_TYPE_XHFC) | ||
4035 | hc->hw.r_bert_wd_md |= 0x40 /* V_WD_EN */; | ||
4036 | /* init the watchdog register and reset the counter */ | ||
4037 | HFC_outb(hc, R_BERT_WD_MD, hc->hw.r_bert_wd_md | V_WD_RES); | ||
4038 | if (test_bit(HFC_CHIP_PLXSD, &hc->chip)) { | ||
4039 | /* enable the watchdog output for Speech-Design */ | ||
4040 | HFC_outb(hc, R_GPIO_SEL, V_GPIO_SEL7); | ||
4041 | HFC_outb(hc, R_GPIO_EN1, V_GPIO_EN15); | ||
4042 | HFC_outb(hc, R_GPIO_OUT1, 0); | ||
4043 | HFC_outb(hc, R_GPIO_OUT1, V_GPIO_OUT15); | ||
4044 | } | ||
4045 | break; | ||
4046 | case MISDN_CTRL_HFC_WD_RESET: /* reset the watchdog counter */ | ||
4047 | if (debug & DEBUG_HFCMULTI_MSG) | ||
4048 | printk(KERN_DEBUG "%s: MISDN_CTRL_HFC_WD_RESET\n", | ||
4049 | __func__); | ||
4050 | HFC_outb(hc, R_BERT_WD_MD, hc->hw.r_bert_wd_md | V_WD_RES); | ||
4021 | break; | 4051 | break; |
4022 | default: | 4052 | default: |
4023 | printk(KERN_WARNING "%s: unknown Op %x\n", | 4053 | printk(KERN_WARNING "%s: unknown Op %x\n", |
diff --git a/include/linux/mISDNif.h b/include/linux/mISDNif.h index 5da3d95b27f1..cf974593a99e 100644 --- a/include/linux/mISDNif.h +++ b/include/linux/mISDNif.h | |||
@@ -362,7 +362,8 @@ clear_channelmap(u_int nr, u_char *map) | |||
362 | #define MISDN_CTRL_HFC_RECEIVE_ON 0x4006 | 362 | #define MISDN_CTRL_HFC_RECEIVE_ON 0x4006 |
363 | #define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007 | 363 | #define MISDN_CTRL_HFC_ECHOCAN_ON 0x4007 |
364 | #define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008 | 364 | #define MISDN_CTRL_HFC_ECHOCAN_OFF 0x4008 |
365 | 365 | #define MISDN_CTRL_HFC_WD_INIT 0x4009 | |
366 | #define MISDN_CTRL_HFC_WD_RESET 0x400A | ||
366 | 367 | ||
367 | /* socket options */ | 368 | /* socket options */ |
368 | #define MISDN_TIME_STAMP 0x0001 | 369 | #define MISDN_TIME_STAMP 0x0001 |