Commit e0e099a7 authored by Manu Abraham's avatar Manu Abraham Committed by Mauro Carvalho Chehab

V4L/DVB (13777): [Mantis] Use a Write wait queue for Write events

Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ac8f04d2
...@@ -57,6 +57,35 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca) ...@@ -57,6 +57,35 @@ static int mantis_hif_sbuf_opdone_wait(struct mantis_ca *ca)
return rc; 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) 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) ...@@ -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(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT); 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); dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -147,7 +176,7 @@ int mantis_hif_write_iom(struct mantis_ca *ca, u32 addr, u8 data) ...@@ -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(hif_addr | MANTIS_HIF_STATUS, MANTIS_GPIF_ADDR);
mmwrite(data, MANTIS_GPIF_DOUT); 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); dprintk(verbose, MANTIS_ERROR, 1, "Adapter(%d) Slot(0): HIF Smart Buffer operation failed", mantis->num);
return -EREMOTEIO; return -EREMOTEIO;
} }
...@@ -167,6 +196,7 @@ int mantis_hif_init(struct mantis_ca *ca) ...@@ -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); 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_data_wq);
init_waitqueue_head(&ca->hif_opdone_wq); init_waitqueue_head(&ca->hif_opdone_wq);
init_waitqueue_head(&ca->hif_write_wq);
irqcfg = mmread(MANTIS_GPIF_IRQCFG); irqcfg = mmread(MANTIS_GPIF_IRQCFG);
irqcfg = MANTIS_MASK_BRRDY | irqcfg = MANTIS_MASK_BRRDY |
......
...@@ -51,6 +51,7 @@ struct mantis_ca { ...@@ -51,6 +51,7 @@ struct mantis_ca {
wait_queue_head_t hif_opdone_wq; wait_queue_head_t hif_opdone_wq;
wait_queue_head_t hif_brrdyw_wq; wait_queue_head_t hif_brrdyw_wq;
wait_queue_head_t hif_data_wq; wait_queue_head_t hif_data_wq;
wait_queue_head_t hif_write_wq; /* HIF Write op */
enum mantis_sbuf_status sbuf_status; enum mantis_sbuf_status sbuf_status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment