All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Tejun Heo <htejun@gmail.com>
Cc: ahaas@airmail.net, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata_piix: fix pio/mwdma programming (for testing, don't apply)
Date: Fri, 02 Feb 2007 18:34:20 +0300	[thread overview]
Message-ID: <45C359FC.2000601@ru.mvista.com> (raw)
In-Reply-To: <20070202151856.GD1625@htj.dyndns.org>

Hello.

Tejun Heo wrote:

> Okay, here's another try at fixing the detection bug.  I went through
> intel ich docs and compared with the ide piix driver.  This patch
> fixes the following problems.

> diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
> index c6bf1a3..51f55a0 100644
> --- a/drivers/ata/ata_piix.c
> +++ b/drivers/ata/ata_piix.c
> @@ -728,8 +728,14 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
>  	if (adev->class == ATA_DEV_ATA)
>  		control |= 4;	/* PPE enable */
>  
> +	/* PIO configuration clears DTE unconditionally.  It will be
> +	 * programmed in set_dmamode which is guaranteed to be called
> +	 * after set_piomode if any DMA mode is available.
> +	 */

    Actually, I think ata_timing_merge() should just be performed when setting 
MWDMA mode... This should be the right thing to do in most cases (however, 
this hardware has some complications in the form of only 2-bit wide 
active/recovery counts and 2 fast timing bank select bits)...

>  	pci_read_config_word(dev, master_port, &master_data);
>  	if (is_slave) {
> +		/* clear TIME1|IE1|PPE1|DTE1 */
> +		master_data &= 0xff0f;

    Yeah, I've fixed this oversight in piix.c...

>  		/* Enable SITRE (seperate slave timing register) */
>  		master_data |= 0x4000;
>  		/* enable PPE1, IE1 and TIME1 as needed */
> @@ -737,12 +743,14 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
>  		pci_read_config_byte(dev, slave_port, &slave_data);
>  		slave_data &= (ap->port_no ? 0x0f : 0xf0);
>  		/* Load the timing nibble for this slave */
> -		slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
> +		slave_data |= ((timings[pio][0] << 2) | timings[pio][1])
> +						<< (ap->port_no ? 4 : 0);
>  	} else {
> -		/* Master keeps the bits in a different format */
> -		master_data &= 0xccf8;
> +		/* clear ISP|RCT|TIME0|IE0|PPE0|DTE0 */
> +		master_data &= 0xccf0;
>  		/* Enable PPE, IE and TIME as appropriate */
>  		master_data |= control;
> +		/* load ISP and RCT */
>  		master_data |=
>  			(timings[pio][0] << 12) |
>  			(timings[pio][1] << 8);
> @@ -859,7 +867,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
>  			master_data &= 0xFF4F;  /* Mask out IORDY|TIME1|DMAONLY */
>  			master_data |= control << 4;
>  			pci_read_config_byte(dev, 0x44, &slave_data);
> -			slave_data &= (0x0F + 0xE1 * ap->port_no);
> +			slave_data &= (ap->port_no ? 0x0f : 0xf0);
>  			/* Load the matching timing */
>  			slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
>  			pci_write_config_byte(dev, 0x44, slave_data);
> @@ -871,8 +879,11 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
>  				(timings[pio][0] << 12) |
>  				(timings[pio][1] << 8);
>  		}
> -		udma_enable &= ~(1 << devid);
> -		pci_write_config_word(dev, master_port, master_data);
> +
> +		if (ap->udma_mask) {
> +			udma_enable &= ~(1 << devid);
> +			pci_write_config_word(dev, master_port, master_data);
> +		}

    I've also noticed that this is done at the end of piix_set_piomode() and I 
see no reason why.  Isn't it just a leftover from the piix.c brokenness?  This 
driver coupled PIO and UDMA timing updates for no conceivable reason?

MBR, Sergei

  reply	other threads:[~2007-02-02 15:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-02 15:18 [PATCH] ata_piix: fix pio/mwdma programming (for testing, don't apply) Tejun Heo
2007-02-02 15:34 ` Sergei Shtylyov [this message]
2007-02-02 16:38   ` Jeff Garzik
2007-02-02 16:57     ` Mark Lord
2007-02-02 18:34       ` Sergei Shtylyov
2007-02-02 16:41   ` Tejun Heo
2007-02-02 18:49     ` Alan
2007-02-02 19:04       ` Sergei Shtylyov
2007-02-02 17:42 ` Alan
2007-02-03  1:40   ` Tejun Heo
2007-02-03 20:04     ` Alan
2007-02-04  2:47       ` Tejun Heo
2007-02-02 21:14 ` Art Haas
2007-02-03  2:09   ` Tejun Heo
2007-02-03 14:35     ` Art Haas
2007-02-03 19:47     ` Mark Lord
2007-02-06  9:11       ` Tejun Heo
2007-02-06 16:33         ` Art Haas
2007-02-07  2:53           ` Tejun Heo
2007-02-07 19:35             ` Art Haas
2007-02-07 19:51               ` Mark Lord
2007-02-07 20:37                 ` [PATCH] libata: clear TF before IDENTIFYing Tejun Heo
2007-02-08 14:56                   ` Mark Lord
2007-02-13 19:38                   ` Art Haas
2007-02-15 23:08                   ` Jeff Garzik
2007-04-30 18:29 ` [PATCH] Fix pio/mwdma programming on ata_piix.c Art Haas
2007-05-01  3:02   ` Tejun Heo
2007-05-24 19:59     ` Art Haas
2007-05-24 20:55       ` Jeff Garzik
2007-05-24 21:03         ` Tejun Heo
2007-05-25 17:16           ` [PATCH] ata_piix: fix pio/mwdma programming Tejun Heo
2007-05-25 18:05             ` Alan Cox
2007-05-28 13:02             ` Jeff Garzik

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=45C359FC.2000601@ru.mvista.com \
    --to=sshtylyov@ru.mvista.com \
    --cc=ahaas@airmail.net \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=htejun@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.