diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 667acd2..4c81433 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1478,7 +1478,8 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class, } tf.protocol = ATA_PROT_PIO; - tf.flags |= ATA_TFLAG_POLLING; /* for polling presence detection */ + /* POLLING for polling detection, ISADDR|DEVICE to clear TF */ + tf.flags |= ATA_TFLAG_POLLING | ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; err_mask = ata_exec_internal(dev, &tf, NULL, DMA_FROM_DEVICE, id, sizeof(id[0]) * ATA_ID_WORDS); @@ -4477,6 +4478,18 @@ fsm_start: goto fsm_start; } else { + unsigned long timeout = jiffies + msecs_to_jiffies(50); + + while (time_before(jiffies, timeout)) { + if (status & ATA_DRQ) + break; + ata_dev_printk(qc->dev, KERN_INFO, + "XXX: waiting for DRQ, status=0x%x\n", + status); + msleep(10); + status = ata_chk_status(ap); + } + /* ATA PIO protocol */ if (unlikely((status & ATA_DRQ) == 0)) { /* handle BSY=0, DRQ=0 as error */