Fix the problem with accessing certain FLASH devices. The problem

was that accessing the status reg could occour too fast, confusing
the logic in the flash part. Could not have been located without:

HW donated by: Jonas Bülow <jonas@servicefactory.se>
This commit is contained in:
sos 2003-10-01 09:58:19 +00:00
parent 346aa00460
commit c8f8c81f54

View File

@ -644,11 +644,13 @@ ata_reset(struct ata_channel *ch)
static int
ata_wait(struct ata_device *atadev, u_int8_t mask)
{
int timeout = 0;
u_int8_t status;
int timeout = 0;
DELAY(1);
while (timeout < 5000000) { /* timeout 5 secs */
/* wait 5 seconds for device to get !BUSY */
while (timeout < 5000000) {
status = ATA_IDX_INB(atadev->channel, ATA_STATUS);
/* if drive fails status, reselect the drive just to be sure */
@ -678,8 +680,10 @@ ata_wait(struct ata_device *atadev, u_int8_t mask)
return -1;
if (!mask)
return (status & ATA_S_ERROR);
DELAY(1);
/* wait 50 msec for bits wanted. */
/* wait 50 msec for bits wanted */
timeout = 5000;
while (timeout--) {
status = ATA_IDX_INB(atadev->channel, ATA_STATUS);