linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Andrew Hall <andrew.a.hall@gmail.com>
Cc: 'Alan Cox' <alan@lxorguk.ukuu.org.uk>,
	linux-ide@vger.kernel.org, 'Jeff Garzik' <jeff@garzik.org>
Subject: Re: CF flash IDE failure to attach with 2.6.20+
Date: Tue, 19 Jun 2007 14:00:54 +0900	[thread overview]
Message-ID: <46776306.5030300@gmail.com> (raw)
In-Reply-To: <46770edc.101d640a.4fdf.4eae@mx.google.com>

[-- Attachment #1: Type: text/plain, Size: 732 bytes --]

Andrew Hall wrote:
>>> For some reason, mwdma doesn't work in libata now.  I'm not sure why
>>> tho.  Alan, can you enlighten us?
>> No idea at all. All my hardware is still happy. 2.6.20 is an "old"
>> kernel
>> however so it does predate the fixes you did for ata_piix mode setup ?
> 
> Old - yes, but more stable in all other respects it seems to the .21 series.
> Are these patches available for me to try on .20 or are there dependencies
> on 21? 
> 

I suppose you were using ata_piix too in older kernel, right?  Can you
post the boot dmesg of 2.6.19?  We used to ignore mwdma mode before and
enabled it at some point after that.  That may be the cause here.

Also, please try the attached patch on top of 2.6.20.

-- 
tejun

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2514 bytes --]

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 9c07b88..924e447 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -685,8 +685,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.
+	 */
 	pci_read_config_word(dev, master_port, &master_data);
 	if (is_slave) {
+		/* clear TIME1|IE1|PPE1|DTE1 */
+		master_data &= 0xff0f;
 		/* Enable SITRE (seperate slave timing register) */
 		master_data |= 0x4000;
 		/* enable PPE1, IE1 and TIME1 as needed */
@@ -694,12 +700,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);
@@ -816,7 +824,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);
@@ -828,8 +836,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);
+		}
 	}
 	/* Don't scribble on 0x48 if the controller does not support UDMA */
 	if (ap->udma_mask)

  reply	other threads:[~2007-06-19  5:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-18 10:02 CF flash IDE failure to attach with 2.6.20+ Andrew_hall
2007-06-18 11:26 ` Tejun Heo
2007-06-18 11:57   ` Alan Cox
2007-06-18 23:01     ` Andrew Hall
2007-06-19  5:00       ` Tejun Heo [this message]
2007-06-21  1:05         ` Andrew Hall
2007-06-21  3:02           ` Tejun Heo
2007-06-21  7:19             ` Andrew Hall
2007-06-21 14:45               ` Mark Lord
2007-06-21 15:09                 ` Andrew Hall
2007-06-26  8:51                 ` CF flash PATA on libata failure to attach Andrew Hall
2007-06-26 18:50                   ` Mark Lord
2007-06-27  3:57                     ` Andrew Hall
2007-06-27 14:08                       ` Mark Lord
2007-06-27 23:49                         ` Andrew Hall
2007-06-28 17:37                           ` Mark Lord
2007-06-29  0:35                             ` Andrew Hall
2007-06-29  1:10                               ` Mark Lord
2007-06-29  1:36                                 ` Tejun Heo
2007-06-29  2:26                                   ` Mark Lord
2007-06-29  2:15                                 ` Andrew Hall
2007-06-29  2:28                                   ` Mark Lord
2007-06-29  3:24                                     ` Andrew Hall
2007-06-29  7:34                                     ` Andrew Hall
2007-06-29 10:17                                       ` Alan Cox
2007-07-02 10:58                                         ` Tejun Heo
2007-07-03  6:13                                         ` Albert Lee
2007-06-29 10:06                                 ` Alan Cox
2007-06-25  9:05             ` CF flash IDE failure to attach with 2.6.20+ Andrew Hall
2007-06-18 23:23   ` Andrew Hall

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=46776306.5030300@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=andrew.a.hall@gmail.com \
    --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).