Commit 398d9da8 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Mauro Carvalho Chehab

[media] media: rc: nuvoton: fix rx fifo overrun handling

To detect a rx fifo overrun it's checked whether the number of elements
in the chip fifo exceeds the fifo size. This check can never return true
and is wrong.
Instead we should generate an interrupt if the fifo overruns.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 678fdb68
...@@ -527,7 +527,7 @@ static void nvt_set_cir_iren(struct nvt_dev *nvt) ...@@ -527,7 +527,7 @@ static void nvt_set_cir_iren(struct nvt_dev *nvt)
{ {
u8 iren; u8 iren;
iren = CIR_IREN_RTR | CIR_IREN_PE; iren = CIR_IREN_RTR | CIR_IREN_PE | CIR_IREN_RFO;
nvt_cir_reg_write(nvt, iren, CIR_IREN); nvt_cir_reg_write(nvt, iren, CIR_IREN);
} }
...@@ -835,7 +835,6 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt) ...@@ -835,7 +835,6 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt)
{ {
u8 fifocount, val; u8 fifocount, val;
unsigned int b_idx; unsigned int b_idx;
bool overrun = false;
int i; int i;
/* Get count of how many bytes to read from RX FIFO */ /* Get count of how many bytes to read from RX FIFO */
...@@ -843,11 +842,6 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt) ...@@ -843,11 +842,6 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt)
/* if we get 0xff, probably means the logical dev is disabled */ /* if we get 0xff, probably means the logical dev is disabled */
if (fifocount == 0xff) if (fifocount == 0xff)
return; return;
/* watch out for a fifo overrun condition */
else if (fifocount > RX_BUF_LEN) {
overrun = true;
fifocount = RX_BUF_LEN;
}
nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount); nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount);
...@@ -869,9 +863,6 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt) ...@@ -869,9 +863,6 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt)
nvt_dbg("%s: pkts now %d", __func__, nvt->pkts); nvt_dbg("%s: pkts now %d", __func__, nvt->pkts);
nvt_process_rx_ir_data(nvt); nvt_process_rx_ir_data(nvt);
if (overrun)
nvt_handle_rx_fifo_overrun(nvt);
} }
static void nvt_cir_log_irqs(u8 status, u8 iren) static void nvt_cir_log_irqs(u8 status, u8 iren)
...@@ -945,6 +936,9 @@ static irqreturn_t nvt_cir_isr(int irq, void *data) ...@@ -945,6 +936,9 @@ static irqreturn_t nvt_cir_isr(int irq, void *data)
nvt_cir_log_irqs(status, iren); nvt_cir_log_irqs(status, iren);
if (status & CIR_IRSTS_RFO)
nvt_handle_rx_fifo_overrun(nvt);
if (status & CIR_IRSTS_RTR) { if (status & CIR_IRSTS_RTR) {
/* FIXME: add code for study/learn mode */ /* FIXME: add code for study/learn mode */
/* We only do rx if not tx'ing */ /* We only do rx if not tx'ing */
......
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