aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarko Kohtala <marko.kohtala@gmail.com>2006-01-06 03:19:44 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:33:56 -0500
commit742ec650e9b63ea61891455bb6f76bac37025c78 (patch)
tree993a734fc7c412c0a0c37e107bff761e0071cfcf
parentc660629059abbbd0eb56e12f9bb4494f01800bbc (diff)
[PATCH] parport: phase fixes
Did not move the parport interface properly into IEEE1284_PH_REV_IDLE phase at end of data due to comparing bytes with nibbles. Internal phase IEEE1284_PH_HBUSY_DNA became unused, so remove it. Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/media/video/cpia_pp.c30
-rw-r--r--drivers/parport/ieee1284_ops.c62
-rw-r--r--include/linux/parport.h1
3 files changed, 42 insertions, 51 deletions
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c
index ddf184f95d80..6861d408f1b3 100644
--- a/drivers/media/video/cpia_pp.c
+++ b/drivers/media/video/cpia_pp.c
@@ -170,16 +170,9 @@ static size_t cpia_read_nibble (struct parport *port,
170 /* Does the error line indicate end of data? */ 170 /* Does the error line indicate end of data? */
171 if (((i /*& 1*/) == 0) && 171 if (((i /*& 1*/) == 0) &&
172 (parport_read_status(port) & PARPORT_STATUS_ERROR)) { 172 (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
173 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 173 DBG("%s: No more nibble data (%d bytes)\n",
174 DBG("%s: No more nibble data (%d bytes)\n", 174 port->name, i/2);
175 port->name, i/2); 175 goto end_of_data;
176
177 /* Go to reverse idle phase. */
178 parport_frob_control (port,
179 PARPORT_CONTROL_AUTOFD,
180 PARPORT_CONTROL_AUTOFD);
181 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
182 break;
183 } 176 }
184 177
185 /* Event 7: Set nAutoFd low. */ 178 /* Event 7: Set nAutoFd low. */
@@ -227,18 +220,21 @@ static size_t cpia_read_nibble (struct parport *port,
227 byte = nibble; 220 byte = nibble;
228 } 221 }
229 222
230 i /= 2; /* i is now in bytes */
231
232 if (i == len) { 223 if (i == len) {
233 /* Read the last nibble without checking data avail. */ 224 /* Read the last nibble without checking data avail. */
234 port = port->physport; 225 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
235 if (parport_read_status (port) & PARPORT_STATUS_ERROR) 226 end_of_data:
236 port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 227 /* Go to reverse idle phase. */
228 parport_frob_control (port,
229 PARPORT_CONTROL_AUTOFD,
230 PARPORT_CONTROL_AUTOFD);
231 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
232 }
237 else 233 else
238 port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; 234 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
239 } 235 }
240 236
241 return i; 237 return i/2;
242} 238}
243 239
244/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) 240/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1)
diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c
index ce1e2aad8b10..d6c77658231e 100644
--- a/drivers/parport/ieee1284_ops.c
+++ b/drivers/parport/ieee1284_ops.c
@@ -165,17 +165,7 @@ size_t parport_ieee1284_read_nibble (struct parport *port,
165 /* Does the error line indicate end of data? */ 165 /* Does the error line indicate end of data? */
166 if (((i & 1) == 0) && 166 if (((i & 1) == 0) &&
167 (parport_read_status(port) & PARPORT_STATUS_ERROR)) { 167 (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
168 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 168 goto end_of_data;
169 DPRINTK (KERN_DEBUG
170 "%s: No more nibble data (%d bytes)\n",
171 port->name, i/2);
172
173 /* Go to reverse idle phase. */
174 parport_frob_control (port,
175 PARPORT_CONTROL_AUTOFD,
176 PARPORT_CONTROL_AUTOFD);
177 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
178 break;
179 } 169 }
180 170
181 /* Event 7: Set nAutoFd low. */ 171 /* Event 7: Set nAutoFd low. */
@@ -225,18 +215,25 @@ size_t parport_ieee1284_read_nibble (struct parport *port,
225 byte = nibble; 215 byte = nibble;
226 } 216 }
227 217
228 i /= 2; /* i is now in bytes */
229
230 if (i == len) { 218 if (i == len) {
231 /* Read the last nibble without checking data avail. */ 219 /* Read the last nibble without checking data avail. */
232 port = port->physport; 220 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
233 if (parport_read_status (port) & PARPORT_STATUS_ERROR) 221 end_of_data:
234 port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 222 DPRINTK (KERN_DEBUG
223 "%s: No more nibble data (%d bytes)\n",
224 port->name, i/2);
225
226 /* Go to reverse idle phase. */
227 parport_frob_control (port,
228 PARPORT_CONTROL_AUTOFD,
229 PARPORT_CONTROL_AUTOFD);
230 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
231 }
235 else 232 else
236 port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; 233 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
237 } 234 }
238 235
239 return i; 236 return i/2;
240#endif /* IEEE1284 support */ 237#endif /* IEEE1284 support */
241} 238}
242 239
@@ -256,17 +253,7 @@ size_t parport_ieee1284_read_byte (struct parport *port,
256 253
257 /* Data available? */ 254 /* Data available? */
258 if (parport_read_status (port) & PARPORT_STATUS_ERROR) { 255 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
259 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 256 goto end_of_data;
260 DPRINTK (KERN_DEBUG
261 "%s: No more byte data (%Zd bytes)\n",
262 port->name, count);
263
264 /* Go to reverse idle phase. */
265 parport_frob_control (port,
266 PARPORT_CONTROL_AUTOFD,
267 PARPORT_CONTROL_AUTOFD);
268 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
269 break;
270 } 257 }
271 258
272 /* Event 14: Place data bus in high impedance state. */ 259 /* Event 14: Place data bus in high impedance state. */
@@ -318,11 +305,20 @@ size_t parport_ieee1284_read_byte (struct parport *port,
318 305
319 if (count == len) { 306 if (count == len) {
320 /* Read the last byte without checking data avail. */ 307 /* Read the last byte without checking data avail. */
321 port = port->physport; 308 if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
322 if (parport_read_status (port) & PARPORT_STATUS_ERROR) 309 end_of_data:
323 port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; 310 DPRINTK (KERN_DEBUG
311 "%s: No more byte data (%Zd bytes)\n",
312 port->name, count);
313
314 /* Go to reverse idle phase. */
315 parport_frob_control (port,
316 PARPORT_CONTROL_AUTOFD,
317 PARPORT_CONTROL_AUTOFD);
318 port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
319 }
324 else 320 else
325 port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; 321 port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
326 } 322 }
327 323
328 return count; 324 return count;
diff --git a/include/linux/parport.h b/include/linux/parport.h
index d2a4d9e1e6d1..f7ff0b0c4031 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -242,7 +242,6 @@ enum ieee1284_phase {
242 IEEE1284_PH_FWD_IDLE, 242 IEEE1284_PH_FWD_IDLE,
243 IEEE1284_PH_TERMINATE, 243 IEEE1284_PH_TERMINATE,
244 IEEE1284_PH_NEGOTIATION, 244 IEEE1284_PH_NEGOTIATION,
245 IEEE1284_PH_HBUSY_DNA,
246 IEEE1284_PH_REV_IDLE, 245 IEEE1284_PH_REV_IDLE,
247 IEEE1284_PH_HBUSY_DAVAIL, 246 IEEE1284_PH_HBUSY_DAVAIL,
248 IEEE1284_PH_REV_DATA, 247 IEEE1284_PH_REV_DATA,