linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Linux IDE <linux-ide@vger.kernel.org>
Subject: Re: [PATCH] libata: Add MMIO support to pata_sil680
Date: Thu, 24 May 2007 20:29:55 -0400	[thread overview]
Message-ID: <46562E03.3020503@garzik.org> (raw)
In-Reply-To: <20070524120915.40b594a8@the-village.bc.nu>

Alan Cox wrote:
> On Thu, 24 May 2007 06:52:13 -0400
> Jeff Garzik <jgarzik@pobox.com> wrote:
> 
>> Alan Cox wrote:
>>>> Currently libata does the 400ns thingy in the inline ata_pause() which
>>>> unconditionally does ata_altstatus(); ndelay(400); (and thus does it on
>>>> PIO, MMIO, anything ...).
>>> It might actually improve performance for PATA if we did as we'll get rid
>>> of an excess (expensive) PCI read access for non MMIO cases.
>> The spec says you should read AltStatus.  I am definitely not inclined 
>> to change that part.
> 
> Which spec says that and where ?

Found it!  It was in the spec I consider more authoritative than any 
official ATA spec:  Hale Landis' ATADRVR (http://www.ata-atapi.com/):


// This macro provides a small delay that is used in several
// places in the ATA command protocols:
// 1) It is recommended that the host delay 400ns after
//    writing the command register.
// 2) ATA-4 has added a new requirement that the host delay
//    400ns if the DEV bit in the Device/Head register is
//    changed.  This was not recommended or required in ATA-1,
//    ATA-2 or ATA-3.  This is the easy way to do that since it
//    works in all PIO modes.
// 3) ATA-4 has added another new requirement that the host delay
//    after the last word of a data transfer before checking the
//    status register.  This was not recommended or required in
//    ATA-1, ATA-2 or ATA-3.  This is the easy to do that since it
//    works in all PIO modes.

#define DELAY400NS  { pio_inbyte( CB_ASTAT ); pio_inbyte( CB_ASTAT );  \
                       pio_inbyte( CB_ASTAT ); pio_inbyte( CB_ASTAT ); }


libata was originally written by following ATADRVR IO-for-IO.  You can 
still see some of the mostly-unmodified bitbang sequences in 
libata-core.c in places like dev-select or dev-chk.  Sometimes you have 
to look pretty hard, since hooks make the bitbang sequences much harder 
to follow.

Obviously libata's "pause" differs from Hale's version a bit, but the 
basic version is sound and works for everybody from ancient PATA PIO to 
modern SATA MMIO.

	Jeff



  parent reply	other threads:[~2007-05-25  0:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-15  6:12 [PATCH] libata: Add MMIO support to pata_sil680 Benjamin Herrenschmidt
2007-05-15  6:14 ` Benjamin Herrenschmidt
2007-05-23 13:42   ` Alan Cox
2007-05-23 22:48     ` Benjamin Herrenschmidt
2007-05-23 23:31       ` Alan Cox
2007-05-23 23:43         ` Benjamin Herrenschmidt
2007-05-24  0:13           ` Alan Cox
2007-05-24  3:42             ` Benjamin Herrenschmidt
2007-05-24  9:54               ` Alan Cox
2007-05-24 10:52                 ` Jeff Garzik
2007-05-24 11:09                   ` Alan Cox
2007-05-24 11:09                     ` Jeff Garzik
2007-05-25  0:29                     ` Jeff Garzik [this message]
2007-05-25  0:40                       ` Alan Cox
2007-05-25  0:51                         ` Jeff Garzik
2007-05-25 14:20                           ` Alan Cox
2007-05-28  2:21                             ` Jeff Garzik
2007-05-24  6:02         ` Jeff Garzik
2007-05-24  9:33           ` Alan Cox
2007-05-24  9:55             ` Jeff Garzik
2007-05-24 10:08               ` Benjamin Herrenschmidt
2007-05-24 20:56                 ` Mark Lord
2007-05-24 22:52                   ` Benjamin Herrenschmidt
2007-05-25 11:32                     ` Mark Lord
2007-05-24 10:06           ` Benjamin Herrenschmidt
  -- strict thread matches above, loose matches on Subject: below --
2007-05-16  0:21 Benjamin Herrenschmidt
2007-05-16 12:05 ` Alan Cox
2007-05-16 12:12   ` Benjamin Herrenschmidt
2007-05-18  1:00 ` Jeff Garzik
2007-05-15  6:11 Benjamin Herrenschmidt
2007-05-15  6:14 ` Benjamin Herrenschmidt
2007-05-15 11:08 ` Alan Cox
2007-05-15 20:32   ` Benjamin Herrenschmidt

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=46562E03.3020503@garzik.org \
    --to=jeff@garzik.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=benh@kernel.crashing.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).