100 lines
3.5 KiB
Diff
100 lines
3.5 KiB
Diff
From 836746e92296047dfc0fa5b66ef32d67893f48e4 Mon Sep 17 00:00:00 2001
|
|
From: Manu Abraham <abraham.manu@gmail.com>
|
|
Date: Fri, 4 Dec 2009 05:29:48 -0300
|
|
Subject: [PATCH 079/120] V4L/DVB (13777): [Mantis] Use a Write wait queue for Write events
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Manu Abraham <manu@linuxtv.org>
|
|
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
|
|
(cherry picked from commit e0e099a708043a2341d8987014ce4ba98a4dbd30)
|
|
|
|
Signed-off-by: Bjørn Mork <bjorn@mork.no>
|
|
---
|
|
drivers/media/dvb/mantis/mantis_hif.c | 34 ++++++++++++++++++++++++++++++-
|
|
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 a2359f7..dc50fac 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)
|
|
return rc;
|
|
}
|
|
|
|
+static int mantis_hif_write_wait(struct mantis_ca *ca)
|
|
+{
|
|
+ struct mantis_pci *mantis = ca->ca_priv;
|
|
+ u32 opdone = 0, timeout = 0;
|
|
+ int rc = 0;
|
|
+
|
|
+ if (wait_event_timeout(ca->hif_write_wq,
|
|
+ mantis->gpif_status & MANTIS_GPIF_WRACK,
|
|
+ msecs_to_jiffies(500)) == -ERESTARTSYS) {
|
|
+
|
|
+ dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): Write ACK timed out !", mantis->num);
|
|
+ rc = -EREMOTEIO;
|
|
+ }
|
|
+ dprintk(verbose, MANTIS_DEBUG, 1, "Write Acknowledged");
|
|
+ mantis->gpif_status &= ~MANTIS_GPIF_WRACK;
|
|
+ while (!opdone) {
|
|
+ opdone = (mmread(MANTIS_GPIF_STATUS) & MANTIS_SBUF_OPDONE);
|
|
+ udelay(500);
|
|
+ timeout++;
|
|
+ if (timeout > 100) {
|
|
+ dprintk(verbose, MANTIS_ERROR, 1, "Adater(%d) Slot(0): Write operation timed out!", mantis->num);
|
|
+ rc = -ETIMEDOUT;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ dprintk(verbose, MANTIS_DEBUG, 1, "HIF Write success");
|
|
+ return rc;
|
|
+}
|
|
+
|
|
|
|
int mantis_hif_read_mem(struct mantis_ca *ca, u32 addr)
|
|
{
|
|
@@ -100,7 +129,7 @@ int mantis_hif_write_mem(struct mantis_ca *ca, u32 addr, u8 data)
|
|
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
|
|
mmwrite(data, MANTIS_GPIF_DOUT);
|
|
|
|
- if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
|
|
+ if (mantis_hif_write_wait(ca) != 0) {
|
|
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
|
|
return -EREMOTEIO;
|
|
}
|
|
@@ -147,7 +176,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data)
|
|
mmwrite(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
|
|
mmwrite(data, MANTIS_GPIF_DOUT);
|
|
|
|
- if (mantis_hif_sbuf_opdone_wait(ca) != 0) {
|
|
+ if (mantis_hif_write_wait(ca) != 0) {
|
|
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
|
|
return -EREMOTEIO;
|
|
}
|
|
@@ -167,6 +196,7 @@ int mantis_hif_init(struct mantis_ca *ca)
|
|
dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Initializing Mantis Host Interface", mantis->num);
|
|
init_waitqueue_head(&ca->hif_data_wq);
|
|
init_waitqueue_head(&ca->hif_opdone_wq);
|
|
+ init_waitqueue_head(&ca->hif_write_wq);
|
|
|
|
irqcfg = mmread(MANTIS_GPIF_IRQCFG);
|
|
irqcfg = MANTIS_MASK_BRRDY |
|
|
diff --git a/drivers/media/dvb/mantis/mantis_link.h b/drivers/media/dvb/mantis/mantis_link.h
|
|
index a85f502..599ff1b 100644
|
|
--- a/drivers/media/dvb/mantis/mantis_link.h
|
|
+++ b/drivers/media/dvb/mantis/mantis_link.h
|
|
@@ -51,6 +51,7 @@ struct mantis_ca {
|
|
wait_queue_head_t hif_opdone_wq;
|
|
wait_queue_head_t hif_brrdyw_wq;
|
|
wait_queue_head_t hif_data_wq;
|
|
+ wait_queue_head_t hif_write_wq; /* HIF Write op */
|
|
|
|
enum mantis_sbuf_status sbuf_status;
|
|
|
|
--
|
|
1.7.1
|
|
|