linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Martynov <andrei.martynov@web.de>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-ide@vger.kernel.org
Subject: Re[2]: libata: waiting for the drives to settle
Date: Fri, 21 Aug 2009 09:56:33 +0200	[thread overview]
Message-ID: <969415927.20090821095633@web.de> (raw)
In-Reply-To: <4A8D7203.50006@garzik.org>

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@web.de


  reply	other threads:[~2009-08-21  7:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20  9:40 libata: waiting for the drives to settle Andrei Martynov
2009-08-20 15:55 ` Jeff Garzik
2009-08-21  7:56   ` Andrei Martynov [this message]
2009-08-22 16:13     ` Jeff Garzik
2009-09-02  8:51       ` Re[2]: " Andrei Martynov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=969415927.20090821095633@web.de \
    --to=andrei.martynov@web.de \
    --cc=jeff@garzik.org \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).