linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libata-core: Drop in the final bit of IORDY handling
@ 2007-10-15 18:20 Alan Cox
  2007-10-15 19:42 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2007-10-15 18:20 UTC (permalink / raw)
  To: jeff, linux-ide

Signed-off-by: Alan Cox <alan@redhat.com>

diff -u --exclude-from /usr/src/exclude --new-file --recursive linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c linux-2.6.23-mm1/drivers/ata/libata-core.c
--- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:03:26.000000000 +0100
+++ linux-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:13:49.000000000 +0100
@@ -4203,8 +4219,12 @@
 	tf.command = ATA_CMD_SET_FEATURES;
 	tf.feature = SETFEATURES_XFER;
 	tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
 	tf.protocol = ATA_PROT_NODATA;
-	tf.nsect = dev->xfer_mode;
+ 	/* Ancient devices may need us to avoid IORDY */
+ 	if (ata_pio_need_iordy(dev))
+ 		tf.nsect = dev->xfer_mode;
+ 	else
+ 		tf.nsect = 0x01;
 
 	err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libata-core: Drop in the final bit of IORDY handling
  2007-10-15 18:20 [PATCH] libata-core: Drop in the final bit of IORDY handling Alan Cox
@ 2007-10-15 19:42 ` Sergei Shtylyov
  2007-10-15 20:25   ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2007-10-15 19:42 UTC (permalink / raw)
  To: Alan Cox; +Cc: jeff, linux-ide

Hello.

Alan Cox wrote:

> Signed-off-by: Alan Cox <alan@redhat.com>

> diff -u --exclude-from /usr/src/exclude --new-file --recursive linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c linux-2.6.23-mm1/drivers/ata/libata-core.c
> --- linux.vanilla-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:03:26.000000000 +0100
> +++ linux-2.6.23-mm1/drivers/ata/libata-core.c	2007-10-15 15:13:49.000000000 +0100
> @@ -4203,8 +4219,12 @@
>  	tf.command = ATA_CMD_SET_FEATURES;
>  	tf.feature = SETFEATURES_XFER;
>  	tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_POLLING;
>  	tf.protocol = ATA_PROT_NODATA;
> -	tf.nsect = dev->xfer_mode;
> + 	/* Ancient devices may need us to avoid IORDY */
> + 	if (ata_pio_need_iordy(dev))
> + 		tf.nsect = dev->xfer_mode;
> + 	else
> + 		tf.nsect = 0x01;

    This is wrong logic as I've alredy pointed out: according to the ATA-2 
setting *any* PIO mode via 0x08..0x0c commands assumes IORDY is enabled.
We should only set mode 0x01 (default w/IORDY disabled) if device supports 
IORDY and the host doesn't.

>  	err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libata-core: Drop in the final bit of IORDY handling
  2007-10-15 19:42 ` Sergei Shtylyov
@ 2007-10-15 20:25   ` Alan Cox
  2007-10-15 20:32     ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2007-10-15 20:25 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: jeff, linux-ide

> > + 	/* Ancient devices may need us to avoid IORDY */
> > + 	if (ata_pio_need_iordy(dev))
> > + 		tf.nsect = dev->xfer_mode;
> > + 	else
> > + 		tf.nsect = 0x01;
> 
>     This is wrong logic as I've alredy pointed out: according to the ATA-2 
> setting *any* PIO mode via 0x08..0x0c commands assumes IORDY is enabled.
> We should only set mode 0x01 (default w/IORDY disabled) if device supports 
> IORDY and the host doesn't.

ata_pio_need_iordy is false if

- the controller does not support iordy

or

- mode <= PIO 2 and the device does not support iordy

I can tighten that if to

	if (!ata_pio_need_iordy(dev) && ata_has_iordy(dev->id))
		tf.nsect = 0x01;

if you prefer ?

Alan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libata-core: Drop in the final bit of IORDY handling
  2007-10-15 20:25   ` Alan Cox
@ 2007-10-15 20:32     ` Sergei Shtylyov
  0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2007-10-15 20:32 UTC (permalink / raw)
  To: Alan Cox; +Cc: jeff, linux-ide

Alan Cox wrote:

>>>+ 	/* Ancient devices may need us to avoid IORDY */
>>>+ 	if (ata_pio_need_iordy(dev))
>>>+ 		tf.nsect = dev->xfer_mode;
>>>+ 	else
>>>+ 		tf.nsect = 0x01;

>>    This is wrong logic as I've alredy pointed out: according to the ATA-2 
>>setting *any* PIO mode via 0x08..0x0c commands assumes IORDY is enabled.
>>We should only set mode 0x01 (default w/IORDY disabled) if device supports 
>>IORDY and the host doesn't.

> ata_pio_need_iordy is false if

> - the controller does not support iordy

    Hm, I'm sorry -- it turned out that I was looking at 2.6.21...

> or

> - mode <= PIO 2 and the device does not support iordy

> I can tighten that if to
> 
> 	if (!ata_pio_need_iordy(dev) && ata_has_iordy(dev->id))
> 		tf.nsect = 0x01;
> if you prefer ?

    Yeah, that'd be better. :-)

> Alan

MBR, Sergei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-15 20:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 18:20 [PATCH] libata-core: Drop in the final bit of IORDY handling Alan Cox
2007-10-15 19:42 ` Sergei Shtylyov
2007-10-15 20:25   ` Alan Cox
2007-10-15 20:32     ` Sergei Shtylyov

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).