Commit 742ec650 authored by Marko Kohtala's avatar Marko Kohtala Committed by Linus Torvalds

[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: default avatarMarko Kohtala <marko.kohtala@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent c6606290
...@@ -170,16 +170,9 @@ static size_t cpia_read_nibble (struct parport *port, ...@@ -170,16 +170,9 @@ static size_t cpia_read_nibble (struct parport *port,
/* Does the error line indicate end of data? */ /* Does the error line indicate end of data? */
if (((i /*& 1*/) == 0) && if (((i /*& 1*/) == 0) &&
(parport_read_status(port) & PARPORT_STATUS_ERROR)) { (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA;
DBG("%s: No more nibble data (%d bytes)\n", DBG("%s: No more nibble data (%d bytes)\n",
port->name, i/2); port->name, i/2);
goto end_of_data;
/* Go to reverse idle phase. */
parport_frob_control (port,
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD);
port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
break;
} }
/* Event 7: Set nAutoFd low. */ /* Event 7: Set nAutoFd low. */
...@@ -227,18 +220,21 @@ static size_t cpia_read_nibble (struct parport *port, ...@@ -227,18 +220,21 @@ static size_t cpia_read_nibble (struct parport *port,
byte = nibble; byte = nibble;
} }
i /= 2; /* i is now in bytes */
if (i == len) { if (i == len) {
/* Read the last nibble without checking data avail. */ /* Read the last nibble without checking data avail. */
port = port->physport; if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
if (parport_read_status (port) & PARPORT_STATUS_ERROR) end_of_data:
port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; /* Go to reverse idle phase. */
parport_frob_control (port,
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD);
port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
}
else else
port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
} }
return i; return i/2;
} }
/* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) /* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1)
......
...@@ -165,17 +165,7 @@ size_t parport_ieee1284_read_nibble (struct parport *port, ...@@ -165,17 +165,7 @@ size_t parport_ieee1284_read_nibble (struct parport *port,
/* Does the error line indicate end of data? */ /* Does the error line indicate end of data? */
if (((i & 1) == 0) && if (((i & 1) == 0) &&
(parport_read_status(port) & PARPORT_STATUS_ERROR)) { (parport_read_status(port) & PARPORT_STATUS_ERROR)) {
port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; goto end_of_data;
DPRINTK (KERN_DEBUG
"%s: No more nibble data (%d bytes)\n",
port->name, i/2);
/* Go to reverse idle phase. */
parport_frob_control (port,
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD);
port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
break;
} }
/* Event 7: Set nAutoFd low. */ /* Event 7: Set nAutoFd low. */
...@@ -225,18 +215,25 @@ size_t parport_ieee1284_read_nibble (struct parport *port, ...@@ -225,18 +215,25 @@ size_t parport_ieee1284_read_nibble (struct parport *port,
byte = nibble; byte = nibble;
} }
i /= 2; /* i is now in bytes */
if (i == len) { if (i == len) {
/* Read the last nibble without checking data avail. */ /* Read the last nibble without checking data avail. */
port = port->physport; if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
if (parport_read_status (port) & PARPORT_STATUS_ERROR) end_of_data:
port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; DPRINTK (KERN_DEBUG
"%s: No more nibble data (%d bytes)\n",
port->name, i/2);
/* Go to reverse idle phase. */
parport_frob_control (port,
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD);
port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
}
else else
port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
} }
return i; return i/2;
#endif /* IEEE1284 support */ #endif /* IEEE1284 support */
} }
...@@ -256,17 +253,7 @@ size_t parport_ieee1284_read_byte (struct parport *port, ...@@ -256,17 +253,7 @@ size_t parport_ieee1284_read_byte (struct parport *port,
/* Data available? */ /* Data available? */
if (parport_read_status (port) & PARPORT_STATUS_ERROR) { if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; goto end_of_data;
DPRINTK (KERN_DEBUG
"%s: No more byte data (%Zd bytes)\n",
port->name, count);
/* Go to reverse idle phase. */
parport_frob_control (port,
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD);
port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
break;
} }
/* Event 14: Place data bus in high impedance state. */ /* Event 14: Place data bus in high impedance state. */
...@@ -318,11 +305,20 @@ size_t parport_ieee1284_read_byte (struct parport *port, ...@@ -318,11 +305,20 @@ size_t parport_ieee1284_read_byte (struct parport *port,
if (count == len) { if (count == len) {
/* Read the last byte without checking data avail. */ /* Read the last byte without checking data avail. */
port = port->physport; if (parport_read_status (port) & PARPORT_STATUS_ERROR) {
if (parport_read_status (port) & PARPORT_STATUS_ERROR) end_of_data:
port->ieee1284.phase = IEEE1284_PH_HBUSY_DNA; DPRINTK (KERN_DEBUG
"%s: No more byte data (%Zd bytes)\n",
port->name, count);
/* Go to reverse idle phase. */
parport_frob_control (port,
PARPORT_CONTROL_AUTOFD,
PARPORT_CONTROL_AUTOFD);
port->physport->ieee1284.phase = IEEE1284_PH_REV_IDLE;
}
else else
port->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL; port->physport->ieee1284.phase = IEEE1284_PH_HBUSY_DAVAIL;
} }
return count; return count;
......
...@@ -242,7 +242,6 @@ enum ieee1284_phase { ...@@ -242,7 +242,6 @@ enum ieee1284_phase {
IEEE1284_PH_FWD_IDLE, IEEE1284_PH_FWD_IDLE,
IEEE1284_PH_TERMINATE, IEEE1284_PH_TERMINATE,
IEEE1284_PH_NEGOTIATION, IEEE1284_PH_NEGOTIATION,
IEEE1284_PH_HBUSY_DNA,
IEEE1284_PH_REV_IDLE, IEEE1284_PH_REV_IDLE,
IEEE1284_PH_HBUSY_DAVAIL, IEEE1284_PH_HBUSY_DAVAIL,
IEEE1284_PH_REV_DATA, IEEE1284_PH_REV_DATA,
......
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