diff options
author | Manu Abraham <abraham.manu@gmail.com> | 2009-12-04 03:29:48 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-01-17 08:55:40 -0500 |
commit | e0e099a708043a2341d8987014ce4ba98a4dbd30 (patch) | |
tree | fb751880cf7765e099d0f2d1c21f28f66de8e494 | |
parent | ac8f04d2723b3de7c36430d67401ce89c858e117 (diff) |
V4L/DVB (13777): [Mantis] Use a Write wait queue for Write events
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/dvb/mantis/mantis_hif.c | 34 | ||||
-rw-r--r-- | drivers/media/dvb/mantis/mantis_link.h | 1 |
2 files changed, 33 insertions, 2 deletions
diff --git a/drivers/media/dvb/mantis/mantis_hif.c b/drivers/media/dvb/mantis/mantis_hif.c index a2359f7e1465..dc50fac0d155 100644 --- a/drivers/media/dvb/mantis/mantis_hif.c +++ b/drivers/media/dvb/mantis/mantis_hif.c | |||
@@ -57,6 +57,35 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca) | |||
57 | return rc; | 57 | return rc; |
58 | } | 58 | } |
59 | 59 | ||
60 | static int mantis_hif_write_wait(struct mantis_ca *ca) | ||
61 | { | ||
62 | struct mantis_pci *mantis = ca->ca_priv; | ||
63 | u32 opdone = 0, timeout = 0; | ||
64 | int rc = 0; | ||
65 | |||
66 | if (wait_event_timeout(ca->hif_write_wq, | ||
67 | mantis->gpif_status & MANTIS_GPIF_WRACK, | ||
68 | msecs_to_jiffies(500)) == -ERESTARTSYS) { | ||
69 | |||
70 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Write ACK timed out !", mantis->num); | ||
71 | rc = -EREMOTEIO; | ||
72 | } | ||
73 | dprintk(verbose, MANTIS_DEBUG, 1, "Write Acknowledged"); | ||
74 | mantis->gpif_status &= ~MANTIS_GPIF_WRACK; | ||
75 | while (!opdone) { | ||
76 | opdone = (mmread(MANTIS_GPIF_STATUS) & MANTIS_SBUF_OPDONE); | ||
77 | udelay(500); | ||
78 | timeout++; | ||
79 | if (timeout > 100) { | ||
80 | dprintk(verbose, MANTIS_ERROR, 1, "Adater(%d) Slot(0): Write operation timed out!", mantis->num); | ||
81 | rc = -ETIMEDOUT; | ||
82 | break; | ||
83 | } | ||
84 | } | ||
85 | dprintk(verbose, MANTIS_DEBUG, 1, "HIF Write success"); | ||
86 | return rc; | ||
87 | } | ||
88 | |||
60 | 89 | ||
61 | int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr) | 90 | int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr) |
62 | { | 91 | { |
@@ -100,7 +129,7 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data) | |||
100 | mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR); | 129 | mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR); |
101 | mmwrite(data, MANTIS_GPIF_DOUT); | 130 | mmwrite(data, MANTIS_GPIF_DOUT); |
102 | 131 | ||
103 | if (mantis_hif_sbuf_opdone_wait(ca) != 0) { | 132 | if (mantis_hif_write_wait(ca) != 0) { |
104 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); | 133 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); |
105 | return -EREMOTEIO; | 134 | return -EREMOTEIO; |
106 | } | 135 | } |
@@ -147,7 +176,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data) | |||
147 | mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR); | 176 | mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR); |
148 | mmwrite(data, MANTIS_GPIF_DOUT); | 177 | mmwrite(data, MANTIS_GPIF_DOUT); |
149 | 178 | ||
150 | if (mantis_hif_sbuf_opdone_wait(ca) != 0) { | 179 | if (mantis_hif_write_wait(ca) != 0) { |
151 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); | 180 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num); |
152 | return -EREMOTEIO; | 181 | return -EREMOTEIO; |
153 | } | 182 | } |
@@ -167,6 +196,7 @@ int mantis_hif_init(struct mantis_ca *ca) | |||
167 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num); | 196 | dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num); |
168 | init_waitqueue_head(&ca->hif_data_wq); | 197 | init_waitqueue_head(&ca->hif_data_wq); |
169 | init_waitqueue_head(&ca->hif_opdone_wq); | 198 | init_waitqueue_head(&ca->hif_opdone_wq); |
199 | init_waitqueue_head(&ca->hif_write_wq); | ||
170 | 200 | ||
171 | irqcfg = mmread(MANTIS_GPIF_IRQCFG); | 201 | irqcfg = mmread(MANTIS_GPIF_IRQCFG); |
172 | irqcfg = MANTIS_MASK_BRRDY | | 202 | irqcfg = MANTIS_MASK_BRRDY | |
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h index a85f50215266..599ff1b57e48 100644 --- a/drivers/media/dvb/mantis/mantis_link.h +++ b/drivers/media/dvb/mantis/mantis_link.h | |||
@@ -51,6 +51,7 @@ struct mantis_ca { | |||
51 | wait_queue_head_t hif_opdone_wq; | 51 | wait_queue_head_t hif_opdone_wq; |
52 | wait_queue_head_t hif_brrdyw_wq; | 52 | wait_queue_head_t hif_brrdyw_wq; |
53 | wait_queue_head_t hif_data_wq; | 53 | wait_queue_head_t hif_data_wq; |
54 | wait_queue_head_t hif_write_wq; /* HIF Write op */ | ||
54 | 55 | ||
55 | enum mantis_sbuf_status sbuf_status; | 56 | enum mantis_sbuf_status sbuf_status; |
56 | 57 | ||