aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/cx18/cx18-av-firmware.c4
-rw-r--r--drivers/media/video/cx18/cx18-driver.h7
-rw-r--r--drivers/media/video/cx18/cx18-io.c24
-rw-r--r--drivers/media/video/cx18/cx18-io.h8
4 files changed, 22 insertions, 21 deletions
diff --git a/drivers/media/video/cx18/cx18-av-firmware.c b/drivers/media/video/cx18/cx18-av-firmware.c
index caa748a1add1..924691dcaeb7 100644
--- a/drivers/media/video/cx18/cx18-av-firmware.c
+++ b/drivers/media/video/cx18/cx18-av-firmware.c
@@ -63,7 +63,7 @@ int cx18_av_loadfw(struct cx18 *cx)
63 int retries2; 63 int retries2;
64 int unrec_err = 0; 64 int unrec_err = 0;
65 65
66 for (retries2 = 0; retries2 < CX18_MAX_MMIO_RETRIES; 66 for (retries2 = 0; retries2 < CX18_MAX_MMIO_WR_RETRIES;
67 retries2++) { 67 retries2++) {
68 cx18_av_write4_noretry(cx, CXADEC_DL_CTL, 68 cx18_av_write4_noretry(cx, CXADEC_DL_CTL,
69 dl_control); 69 dl_control);
@@ -82,7 +82,7 @@ int cx18_av_loadfw(struct cx18 *cx)
82 } 82 }
83 cx18_log_write_retries(cx, retries2, 83 cx18_log_write_retries(cx, retries2,
84 cx->reg_mem + 0xc40000 + CXADEC_DL_CTL); 84 cx->reg_mem + 0xc40000 + CXADEC_DL_CTL);
85 if (unrec_err || retries2 >= CX18_MAX_MMIO_RETRIES) 85 if (unrec_err || retries2 >= CX18_MAX_MMIO_WR_RETRIES)
86 break; 86 break;
87 } 87 }
88 if (i == size) 88 if (i == size)
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index bbdd5f25041d..fe9e5bb979e0 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -353,11 +353,12 @@ struct cx18_i2c_algo_callback_data {
353 int bus_index; /* 0 or 1 for the cx23418's 1st or 2nd I2C bus */ 353 int bus_index; /* 0 or 1 for the cx23418's 1st or 2nd I2C bus */
354}; 354};
355 355
356#define CX18_MAX_MMIO_RETRIES 10 356#define CX18_MAX_MMIO_WR_RETRIES 10
357#define CX18_MAX_MMIO_RD_RETRIES 2
357 358
358struct cx18_mmio_stats { 359struct cx18_mmio_stats {
359 atomic_t retried_write[CX18_MAX_MMIO_RETRIES+1]; 360 atomic_t retried_write[CX18_MAX_MMIO_WR_RETRIES+1];
360 atomic_t retried_read[CX18_MAX_MMIO_RETRIES+1]; 361 atomic_t retried_read[CX18_MAX_MMIO_RD_RETRIES+1];
361}; 362};
362 363
363/* Struct to hold info about cx18 cards */ 364/* Struct to hold info about cx18 cards */
diff --git a/drivers/media/video/cx18/cx18-io.c b/drivers/media/video/cx18/cx18-io.c
index 220fae8d4ad7..0ad8dea3e600 100644
--- a/drivers/media/video/cx18/cx18-io.c
+++ b/drivers/media/video/cx18/cx18-io.c
@@ -31,10 +31,10 @@ void cx18_log_statistics(struct cx18 *cx)
31 if (!(cx18_debug & CX18_DBGFLG_INFO)) 31 if (!(cx18_debug & CX18_DBGFLG_INFO))
32 return; 32 return;
33 33
34 for (i = 0; i <= CX18_MAX_MMIO_RETRIES; i++) 34 for (i = 0; i <= CX18_MAX_MMIO_WR_RETRIES; i++)
35 CX18_DEBUG_INFO("retried_write[%d] = %d\n", i, 35 CX18_DEBUG_INFO("retried_write[%d] = %d\n", i,
36 atomic_read(&cx->mmio_stats.retried_write[i])); 36 atomic_read(&cx->mmio_stats.retried_write[i]));
37 for (i = 0; i <= CX18_MAX_MMIO_RETRIES; i++) 37 for (i = 0; i <= CX18_MAX_MMIO_RD_RETRIES; i++)
38 CX18_DEBUG_INFO("retried_read[%d] = %d\n", i, 38 CX18_DEBUG_INFO("retried_read[%d] = %d\n", i,
39 atomic_read(&cx->mmio_stats.retried_read[i])); 39 atomic_read(&cx->mmio_stats.retried_read[i]));
40 return; 40 return;
@@ -43,7 +43,7 @@ void cx18_log_statistics(struct cx18 *cx)
43void cx18_raw_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr) 43void cx18_raw_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr)
44{ 44{
45 int i; 45 int i;
46 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 46 for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
47 cx18_raw_writel_noretry(cx, val, addr); 47 cx18_raw_writel_noretry(cx, val, addr);
48 if (val == cx18_raw_readl_noretry(cx, addr)) 48 if (val == cx18_raw_readl_noretry(cx, addr))
49 break; 49 break;
@@ -55,7 +55,7 @@ u32 cx18_raw_readl_retry(struct cx18 *cx, const void __iomem *addr)
55{ 55{
56 int i; 56 int i;
57 u32 val; 57 u32 val;
58 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 58 for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
59 val = cx18_raw_readl_noretry(cx, addr); 59 val = cx18_raw_readl_noretry(cx, addr);
60 if (val != 0xffffffff) /* PCI bus read error */ 60 if (val != 0xffffffff) /* PCI bus read error */
61 break; 61 break;
@@ -68,7 +68,7 @@ u16 cx18_raw_readw_retry(struct cx18 *cx, const void __iomem *addr)
68{ 68{
69 int i; 69 int i;
70 u16 val; 70 u16 val;
71 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 71 for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
72 val = cx18_raw_readw_noretry(cx, addr); 72 val = cx18_raw_readw_noretry(cx, addr);
73 if (val != 0xffff) /* PCI bus read error */ 73 if (val != 0xffff) /* PCI bus read error */
74 break; 74 break;
@@ -80,7 +80,7 @@ u16 cx18_raw_readw_retry(struct cx18 *cx, const void __iomem *addr)
80void cx18_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr) 80void cx18_writel_retry(struct cx18 *cx, u32 val, void __iomem *addr)
81{ 81{
82 int i; 82 int i;
83 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 83 for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
84 cx18_writel_noretry(cx, val, addr); 84 cx18_writel_noretry(cx, val, addr);
85 if (val == cx18_readl_noretry(cx, addr)) 85 if (val == cx18_readl_noretry(cx, addr))
86 break; 86 break;
@@ -93,7 +93,7 @@ void _cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr,
93{ 93{
94 int i; 94 int i;
95 eval &= mask; 95 eval &= mask;
96 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 96 for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
97 cx18_writel_noretry(cx, val, addr); 97 cx18_writel_noretry(cx, val, addr);
98 if (eval == (cx18_readl_noretry(cx, addr) & mask)) 98 if (eval == (cx18_readl_noretry(cx, addr) & mask))
99 break; 99 break;
@@ -104,7 +104,7 @@ void _cx18_writel_expect(struct cx18 *cx, u32 val, void __iomem *addr,
104void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr) 104void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr)
105{ 105{
106 int i; 106 int i;
107 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 107 for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
108 cx18_writew_noretry(cx, val, addr); 108 cx18_writew_noretry(cx, val, addr);
109 if (val == cx18_readw_noretry(cx, addr)) 109 if (val == cx18_readw_noretry(cx, addr))
110 break; 110 break;
@@ -115,7 +115,7 @@ void cx18_writew_retry(struct cx18 *cx, u16 val, void __iomem *addr)
115void cx18_writeb_retry(struct cx18 *cx, u8 val, void __iomem *addr) 115void cx18_writeb_retry(struct cx18 *cx, u8 val, void __iomem *addr)
116{ 116{
117 int i; 117 int i;
118 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 118 for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) {
119 cx18_writeb_noretry(cx, val, addr); 119 cx18_writeb_noretry(cx, val, addr);
120 if (val == cx18_readb_noretry(cx, addr)) 120 if (val == cx18_readb_noretry(cx, addr))
121 break; 121 break;
@@ -127,7 +127,7 @@ u32 cx18_readl_retry(struct cx18 *cx, const void __iomem *addr)
127{ 127{
128 int i; 128 int i;
129 u32 val; 129 u32 val;
130 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 130 for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
131 val = cx18_readl_noretry(cx, addr); 131 val = cx18_readl_noretry(cx, addr);
132 if (val != 0xffffffff) /* PCI bus read error */ 132 if (val != 0xffffffff) /* PCI bus read error */
133 break; 133 break;
@@ -140,7 +140,7 @@ u16 cx18_readw_retry(struct cx18 *cx, const void __iomem *addr)
140{ 140{
141 int i; 141 int i;
142 u16 val; 142 u16 val;
143 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 143 for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
144 val = cx18_readw_noretry(cx, addr); 144 val = cx18_readw_noretry(cx, addr);
145 if (val != 0xffff) /* PCI bus read error */ 145 if (val != 0xffff) /* PCI bus read error */
146 break; 146 break;
@@ -153,7 +153,7 @@ u8 cx18_readb_retry(struct cx18 *cx, const void __iomem *addr)
153{ 153{
154 int i; 154 int i;
155 u8 val; 155 u8 val;
156 for (i = 0; i < CX18_MAX_MMIO_RETRIES; i++) { 156 for (i = 0; i < CX18_MAX_MMIO_RD_RETRIES; i++) {
157 val = cx18_readb_noretry(cx, addr); 157 val = cx18_readb_noretry(cx, addr);
158 if (val != 0xff) /* PCI bus read error */ 158 if (val != 0xff) /* PCI bus read error */
159 break; 159 break;
diff --git a/drivers/media/video/cx18/cx18-io.h b/drivers/media/video/cx18/cx18-io.h
index 425244453ea7..cb695a59670d 100644
--- a/drivers/media/video/cx18/cx18-io.h
+++ b/drivers/media/video/cx18/cx18-io.h
@@ -41,8 +41,8 @@ static inline void cx18_io_delay(struct cx18 *cx)
41static inline 41static inline
42void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr) 42void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr)
43{ 43{
44 if (i > CX18_MAX_MMIO_RETRIES) 44 if (i > CX18_MAX_MMIO_WR_RETRIES)
45 i = CX18_MAX_MMIO_RETRIES; 45 i = CX18_MAX_MMIO_WR_RETRIES;
46 atomic_inc(&cx->mmio_stats.retried_write[i]); 46 atomic_inc(&cx->mmio_stats.retried_write[i]);
47 return; 47 return;
48} 48}
@@ -50,8 +50,8 @@ void cx18_log_write_retries(struct cx18 *cx, int i, const void __iomem *addr)
50static inline 50static inline
51void cx18_log_read_retries(struct cx18 *cx, int i, const void __iomem *addr) 51void cx18_log_read_retries(struct cx18 *cx, int i, const void __iomem *addr)
52{ 52{
53 if (i > CX18_MAX_MMIO_RETRIES) 53 if (i > CX18_MAX_MMIO_RD_RETRIES)
54 i = CX18_MAX_MMIO_RETRIES; 54 i = CX18_MAX_MMIO_RD_RETRIES;
55 atomic_inc(&cx->mmio_stats.retried_read[i]); 55 atomic_inc(&cx->mmio_stats.retried_read[i]);
56 return; 56 return;
57} 57}