Patchwork [01/64] libata: fix CFA handling in ide_timing_compute()

login
register
mail settings
Submitter Bartlomiej Zolnierkiewicz
Date Jan. 18, 2010, 5:13 p.m.
Message ID <20100118171357.14623.36435.sendpatchset@localhost>
Download mbox | patch
Permalink /patch/43085/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Bartlomiej Zolnierkiewicz - Jan. 18, 2010, 5:13 p.m.
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: [PATCH] libata: fix CFA handling in ide_timing_compute()

Use standard cycle timing for CFA PIO5 and PIO6 modes.

Based on commit 74638c8 for IDE subsystem.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ata/libata-core.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov - Jan. 18, 2010, 6:23 p.m.
Hello.

Bartlomiej Zolnierkiewicz wrote:

> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] libata: fix CFA handling in ide_timing_compute()
>
> Use standard cycle timing for CFA PIO5 and PIO6 modes.
>
> Based on commit 74638c8 for IDE subsystem.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
>  drivers/ata/libata-core.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> Index: b/drivers/ata/libata-core.c
> ===================================================================
> --- a/drivers/ata/libata-core.c
> +++ b/drivers/ata/libata-core.c
> @@ -3211,6 +3211,7 @@ const struct ata_timing *ata_timing_find
>  int ata_timing_compute(struct ata_device *adev, unsigned short speed,
>  		       struct ata_timing *t, int T, int UT)
>  {
> +	const u16 *id = adev->id;
>  	const struct ata_timing *s;
>  	struct ata_timing p;
>  
> @@ -3228,14 +3229,18 @@ int ata_timing_compute(struct ata_device
>  	 * PIO/MW_DMA cycle timing.
>  	 */
>  
> -	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
> +	if (id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
>  		memset(&p, 0, sizeof(p));
> +
>  		if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
>   

   BTW, shouldn't this actually be 'speed < XFER_SW_DMA_0'?

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartlomiej Zolnierkiewicz - Jan. 18, 2010, 6:29 p.m.
On Monday 18 January 2010 07:23:32 pm Sergei Shtylyov wrote:
> Hello.

Hi!

> Bartlomiej Zolnierkiewicz wrote:
> 
> > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > Subject: [PATCH] libata: fix CFA handling in ide_timing_compute()
> >
> > Use standard cycle timing for CFA PIO5 and PIO6 modes.
> >
> > Based on commit 74638c8 for IDE subsystem.
> >
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > ---
> >  drivers/ata/libata-core.c |   17 +++++++++++------
> >  1 file changed, 11 insertions(+), 6 deletions(-)
> >
> > Index: b/drivers/ata/libata-core.c
> > ===================================================================
> > --- a/drivers/ata/libata-core.c
> > +++ b/drivers/ata/libata-core.c
> > @@ -3211,6 +3211,7 @@ const struct ata_timing *ata_timing_find
> >  int ata_timing_compute(struct ata_device *adev, unsigned short speed,
> >  		       struct ata_timing *t, int T, int UT)
> >  {
> > +	const u16 *id = adev->id;
> >  	const struct ata_timing *s;
> >  	struct ata_timing p;
> >  
> > @@ -3228,14 +3229,18 @@ int ata_timing_compute(struct ata_device
> >  	 * PIO/MW_DMA cycle timing.
> >  	 */
> >  
> > -	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
> > +	if (id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
> >  		memset(&p, 0, sizeof(p));
> > +
> >  		if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
> >   
> 
>    BTW, shouldn't this actually be 'speed < XFER_SW_DMA_0'?

Good catch, I'll fix the patch later (would you be willing to fix
ide-timings.c side of things?).

--
Bartlomiej Zolnierkiewicz
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov - Jan. 18, 2010, 6:57 p.m.
Bartlomiej Zolnierkiewicz wrote:

>>> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>> Subject: [PATCH] libata: fix CFA handling in ide_timing_compute()
>>>
>>> Use standard cycle timing for CFA PIO5 and PIO6 modes.
>>>
>>> Based on commit 74638c8 for IDE subsystem.
>>>
>>> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>>> ---
>>>  drivers/ata/libata-core.c |   17 +++++++++++------
>>>  1 file changed, 11 insertions(+), 6 deletions(-)
>>>
>>> Index: b/drivers/ata/libata-core.c
>>> ===================================================================
>>> --- a/drivers/ata/libata-core.c
>>> +++ b/drivers/ata/libata-core.c
>>> @@ -3211,6 +3211,7 @@ const struct ata_timing *ata_timing_find
>>>  int ata_timing_compute(struct ata_device *adev, unsigned short speed,
>>>  		       struct ata_timing *t, int T, int UT)
>>>  {
>>> +	const u16 *id = adev->id;
>>>  	const struct ata_timing *s;
>>>  	struct ata_timing p;
>>>  
>>> @@ -3228,14 +3229,18 @@ int ata_timing_compute(struct ata_device
>>>  	 * PIO/MW_DMA cycle timing.
>>>  	 */
>>>  
>>> -	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
>>> +	if (id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
>>>  		memset(&p, 0, sizeof(p));
>>> +
>>>  		if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
>>>   
>>>       
>>    BTW, shouldn't this actually be 'speed < XFER_SW_DMA_0'?
>>     
>
> Good catch, I'll fix the patch later (would you be willing to fix
> ide-timings.c side of things?).
>   

   I don't see what to fix there?..

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bartlomiej Zolnierkiewicz - Jan. 18, 2010, 7:04 p.m.
On Monday 18 January 2010 07:57:10 pm Sergei Shtylyov wrote:
> Bartlomiej Zolnierkiewicz wrote:
> 
> >>> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >>> Subject: [PATCH] libata: fix CFA handling in ide_timing_compute()
> >>>
> >>> Use standard cycle timing for CFA PIO5 and PIO6 modes.
> >>>
> >>> Based on commit 74638c8 for IDE subsystem.
> >>>
> >>> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> >>> ---
> >>>  drivers/ata/libata-core.c |   17 +++++++++++------
> >>>  1 file changed, 11 insertions(+), 6 deletions(-)
> >>>
> >>> Index: b/drivers/ata/libata-core.c
> >>> ===================================================================
> >>> --- a/drivers/ata/libata-core.c
> >>> +++ b/drivers/ata/libata-core.c
> >>> @@ -3211,6 +3211,7 @@ const struct ata_timing *ata_timing_find
> >>>  int ata_timing_compute(struct ata_device *adev, unsigned short speed,
> >>>  		       struct ata_timing *t, int T, int UT)
> >>>  {
> >>> +	const u16 *id = adev->id;
> >>>  	const struct ata_timing *s;
> >>>  	struct ata_timing p;
> >>>  
> >>> @@ -3228,14 +3229,18 @@ int ata_timing_compute(struct ata_device
> >>>  	 * PIO/MW_DMA cycle timing.
> >>>  	 */
> >>>  
> >>> -	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
> >>> +	if (id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
> >>>  		memset(&p, 0, sizeof(p));
> >>> +
> >>>  		if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
> >>>   
> >>>       
> >>    BTW, shouldn't this actually be 'speed < XFER_SW_DMA_0'?
> >>     
> >
> > Good catch, I'll fix the patch later (would you be willing to fix
> > ide-timings.c side of things?).
> >   
> 
>    I don't see what to fix there?..

Ah, sorry, ide-timings.c change is also not upstream yet..
--
Bartlomiej Zolnierkiewicz
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Garzik - Jan. 21, 2010, 4:06 a.m.
On 01/18/2010 12:13 PM, Bartlomiej Zolnierkiewicz wrote:
> From: Bartlomiej Zolnierkiewicz<bzolnier@gmail.com>
> Subject: [PATCH] libata: fix CFA handling in ide_timing_compute()
>
> Use standard cycle timing for CFA PIO5 and PIO6 modes.
>
> Based on commit 74638c8 for IDE subsystem.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz<bzolnier@gmail.com>
> ---
>   drivers/ata/libata-core.c |   17 +++++++++++------
>   1 file changed, 11 insertions(+), 6 deletions(-)

applied


--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: b/drivers/ata/libata-core.c
===================================================================
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3211,6 +3211,7 @@  const struct ata_timing *ata_timing_find
 int ata_timing_compute(struct ata_device *adev, unsigned short speed,
 		       struct ata_timing *t, int T, int UT)
 {
+	const u16 *id = adev->id;
 	const struct ata_timing *s;
 	struct ata_timing p;
 
@@ -3228,14 +3229,18 @@  int ata_timing_compute(struct ata_device
 	 * PIO/MW_DMA cycle timing.
 	 */
 
-	if (adev->id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
+	if (id[ATA_ID_FIELD_VALID] & 2) {	/* EIDE drive */
 		memset(&p, 0, sizeof(p));
+
 		if (speed >= XFER_PIO_0 && speed <= XFER_SW_DMA_0) {
-			if (speed <= XFER_PIO_2) p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO];
-					    else p.cycle = p.cyc8b = adev->id[ATA_ID_EIDE_PIO_IORDY];
-		} else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) {
-			p.cycle = adev->id[ATA_ID_EIDE_DMA_MIN];
-		}
+			if (speed <= XFER_PIO_2)
+				p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO];
+			else if ((speed <= XFER_PIO_4) ||
+				 (speed == XFER_PIO_5 && !ata_id_is_cfa(id)))
+				p.cycle = p.cyc8b = id[ATA_ID_EIDE_PIO_IORDY];
+		} else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
+			p.cycle = id[ATA_ID_EIDE_DMA_MIN];
+
 		ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B);
 	}