Re[2]: libata: waiting for the drives to settle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thursday, August 20, 2009, 5:55:47 PM, Jeff Garzik wrote:

> Have you verified this is needed, under libata?  We already have several
> waits...

Unfortunately it is needed. It is embedded system, where bootloader
always tries to boot from the first device (dvd-rom). Second device
(hard disk) is not yet ready when kernel is loaded from flash and does
probe.

I placed the code into dev_select callback

void jasper_dev_select(struct ata_port *ap, unsigned int device)
{
        u8 tmp;
        if (device == 0)
                tmp = ATA_DEVICE_OBS;
        else
                tmp = ATA_DEVICE_OBS | ATA_DEV1;
        iowrite8(tmp, ap->ioaddr.device_addr);
        ata_pause(ap);          /* needed; also flushes, for mmio */
        if (device && firstSlaveAccess) {
                firstSlaveAccess = 0;
                printk("waiting for drive to settle...\n");
                if (ioread8(ap->ioaddr.device_addr) != tmp) {
                        int rc;
                        for (rc = 0; rc < 150; rc++) {
                                iowrite8(tmp, ap->ioaddr.device_addr);
                                mdelay(50); //ata_pause(ap);
                                if (ioread8(ap->ioaddr.device_addr) == tmp)
                                        break;
                        }
                }
        }
}

It takes about 30 cycles (1.5s) to select slave for the first time.


-- 
Best regards,
 Andrei                            mailto:andrei.martynov@xxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux