]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (9513): cx18: Reduce number of mmio read retries
authorAndy Walls <awalls@radix.net>
Sun, 2 Nov 2008 21:15:28 +0000 (18:15 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 30 Dec 2008 11:38:00 +0000 (09:38 -0200)
cx18: Reduce number of mmio read retries to improve performance.  Experiments
have shown 2 things: read retries never improve the result of a suspect mmio
read from the CX23418 (the result stays all 0xff's), and that most of the
suspected read failures are actually proper reads of values that should be
all 0xff's.  This change reduces the number of read retries and keeps the
count separate from write retries.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-av-firmware.c
drivers/media/video/cx18/cx18-driver.h
drivers/media/video/cx18/cx18-io.c
drivers/media/video/cx18/cx18-io.h

index caa748a1add19259e395c1b8d533145a801d13e7..924691dcaeb733522c69aacfc897e84bf6515e1e 100644 (file)
@@ -63,7 +63,7 @@ int cx18_av_loadfw(struct cx18 *cx)
                        int retries2;
                        int unrec_err = 0;
 
-                       for (retries2 = 0; retries2 < CX18_MAX_MMIO_RETRIES;
+                       for (retries2 = 0; retries2 < CX18_MAX_MMIO_WR_RETRIES;
                             retries2++) {
                                cx18_av_write4_noretry(cx, CXADEC_DL_CTL,
                                                       dl_control);
@@ -82,7 +82,7 @@ int cx18_av_loadfw(struct cx18 *cx)
                        }
                        cx18_log_write_retries(cx, retries2,
                                        cx->reg_mem + 0xc40000 + CXADEC_DL_CTL);
-                       if (unrec_err || retries2 >= CX18_MAX_MMIO_RETRIES)
+                       if (unrec_err || retries2 >= CX18_MAX_MMIO_WR_RETRIES)
                                break;
                }
                if (i == size)
index bbdd5f25041df9348e1c6a3ba264b30400141705..fe9e5bb979e074b4f6d3512f6c5b2c86cf2f09aa 100644 (file)
@@ -353,11 +353,12 @@ struct cx18_i2c_algo_callback_data {
        int bus_index;   /* 0 or 1 for the cx23418's 1st or 2nd I2C bus */
 };
 
-#define CX18_MAX_MMIO_RETRIES 10
+#define CX18_MAX_MMIO_WR_RETRIES 10
+#define CX18_MAX_MMIO_RD_RETRIES  2
 
 struct cx18_mmio_stats {
-       atomic_t retried_write[CX18_MAX_MMIO_RETRIES+1];
-       atomic_t retried_read[CX18_MAX_MMIO_RETRIES+1];
+       atomic_t retried_write[CX18_MAX_MMIO_WR_RETRIES+1];
+       atomic_t retried_read[CX18_MAX_MMIO_RD_RETRIES+1];
 };
 
 /* Struct to hold info about cx18 cards */
index 220fae8d4ad757a766fc08e6de3a5bf9e892bd03..0ad8dea3e600346d8500b3a03baae7ed8b925d6e 100644 (file)
@@ -31,10 +31,10 @@ void cx18_log_statistics(struct cx18 *cx)
        if (!(cx18_debug & CX18_DBGFLG_INFO))
                return;
 
-       for (i = 0; i <= CX18_MAX_MMIO_RETRIES; i++)
+       for (i = 0; i <= CX18_MAX_MMIO_WR_RETRIES; i++)
                CX18_DEBUG_INFO("retried_write[%d] = %d\n", i,
                                atomic_read(&cx->mmio_stats.retried_write[i]));
-       for (i = 0; i <= CX18_MAX_MMIO_RETRIES; i++)
+       for (i = 0; i <= CX18_MAX_MMIO_RD_RETRIES; i++)
                CX18_DEBUG_INFO("retried_read[%d] = %d\n", i,
                                atomic_read(&cx->mmio_stats.retried_read[i]));
        return;
@@ -43,7 +43,7 @@ void cx18_log_statistics(struct cx18 *cx)
 void cx18_raw_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr)
 {
        int i;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
                cx18_raw_writel_noretry(cx, val, addr);
                if (val == cx18_raw_readl_noretry(cx, addr))
                        break;
@@ -55,7 +55,7 @@ u32 cx18_raw_readl_retry(struct cx18 *cx, const void __iomem *addr)
 {
        int i;
        u32 val;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
                val = cx18_raw_readl_noretry(cx, addr);
                if (val != 0xffffffff) /* PCI bus read error */
                        break;
@@ -68,7 +68,7 @@ u16 cx18_raw_readw_retry(struct cx18 *cx, const void __iomem *addr)
 {
        int i;
        u16 val;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
                val = cx18_raw_readw_noretry(cx, addr);
                if (val != 0xffff) /* PCI bus read error */
                        break;
@@ -80,7 +80,7 @@ u16 cx18_raw_readw_retry(struct cx18 *cx, const void __iomem *addr)
 void cx18_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr)
 {
        int i;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
                cx18_writel_noretry(cx, val, addr);
                if (val == cx18_readl_noretry(cx, addr))
                        break;
@@ -93,7 +93,7 @@ void _cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr,
 {
        int i;
        eval &= mask;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
                cx18_writel_noretry(cx, val, addr);
                if (eval == (cx18_readl_noretry(cx, addr) & mask))
                        break;
@@ -104,7 +104,7 @@ void _cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr,
 void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr)
 {
        int i;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
                cx18_writew_noretry(cx, val, addr);
                if (val == cx18_readw_noretry(cx, addr))
                        break;
@@ -115,7 +115,7 @@ void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr)
 void cx18_writeb_retry(struct cx18 *cx, u8 val, void __iomem *addr)
 {
        int i;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
                cx18_writeb_noretry(cx, val, addr);
                if (val == cx18_readb_noretry(cx, addr))
                        break;
@@ -127,7 +127,7 @@ u32 cx18_readl_retry(struct cx18 *cx, const void __iomem *addr)
 {
        int i;
        u32 val;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
                val = cx18_readl_noretry(cx, addr);
                if (val != 0xffffffff) /* PCI bus read error */
                        break;
@@ -140,7 +140,7 @@ u16 cx18_readw_retry(struct cx18 *cx, const void __iomem *addr)
 {
        int i;
        u16 val;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
                val = cx18_readw_noretry(cx, addr);
                if (val != 0xffff) /* PCI bus read error */
                        break;
@@ -153,7 +153,7 @@ u8 cx18_readb_retry(struct cx18 *cx, const void __iomem *addr)
 {
        int i;
        u8 val;
-       for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) {
+       for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
                val = cx18_readb_noretry(cx, addr);
                if (val != 0xff) /* PCI bus read error */
                        break;
index 425244453ea7d2ca349644200ef2f2e05e40422a..cb695a59670d491d6a728f31730e2a41ca652853 100644 (file)
@@ -41,8 +41,8 @@ static inline void cx18_io_delay(struct cx18 *cx)
 static inline
 void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr)
 {
-       if (i > CX18_MAX_MMIO_RETRIES)
-               i = CX18_MAX_MMIO_RETRIES;
+       if (i > CX18_MAX_MMIO_WR_RETRIES)
+               i = CX18_MAX_MMIO_WR_RETRIES;
        atomic_inc(&cx->mmio_stats.retried_write[i]);
        return;
 }
@@ -50,8 +50,8 @@ void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr)
 static inline
 void cx18_log_read_retries(struct cx18 *cx, int i, const void __iomem *addr)
 {
-       if (i > CX18_MAX_MMIO_RETRIES)
-               i = CX18_MAX_MMIO_RETRIES;
+       if (i > CX18_MAX_MMIO_RD_RETRIES)
+               i = CX18_MAX_MMIO_RD_RETRIES;
        atomic_inc(&cx->mmio_stats.retried_read[i]);
        return;
 }