linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/4] hpt366: MWDMA filter for SATA cards
@ 2007-09-02 20:19 Sergei Shtylyov
  2007-09-02 20:25 ` Sergei Shtylyov
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2007-09-02 20:19 UTC (permalink / raw)
  To: bzolnier; +Cc: linux-ide, linux-kernel

The Marvell bridge chips used on HighPoint SATA cards do not seem to support
the MWDMA modes (at least that caould be seen in their so-called drivers :-),
so the driver needs to account for this -- to achieve this:

- add mdma_filter() method from the original patch by Bartlomiej Zolnierkewicz
  with his consent, also adding the method callout to ide_rate_filter();

- installed the method for all chips to only return empty mask if a SATA drive
  is detected onHPT372{AN]/374 chips...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
This patch against the current Linus' tree and unfortunately I was able to only
compile test it since that tree gives MODPOST warning and dies early on bootup.
Will hopefully try to test if/when I have time... :-)

 drivers/ide/ide-dma.c    |    9 +++++++--
 drivers/ide/ide-lib.c    |    4 +++-
 drivers/ide/ide.c        |    1 +
 drivers/ide/pci/hpt366.c |   23 +++++++++++++++++++++--
 include/linux/ide.h      |    1 +
 5 files changed, 33 insertions(+), 5 deletions(-)

Index: linux-2.6/drivers/ide/ide-dma.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide-dma.c
+++ linux-2.6/drivers/ide/ide-dma.c
@@ -674,8 +674,13 @@ static unsigned int ide_get_mode_mask(id
 			mask &= 0x07;
 		break;
 	case XFER_MW_DMA_0:
-		if (id->field_valid & 2)
-			mask = id->dma_mword & hwif->mwdma_mask;
+		if ((id->field_valid & 2) == 0)
+			break;
+		if (hwif->mdma_filter)
+			mask = hwif->mdma_filter(drive);
+		else
+			mask = hwif->mwdma_mask;
+		mask &= id->dma_mword;
 		break;
 	case XFER_SW_DMA_0:
 		if (id->field_valid & 2) {
Index: linux-2.6/drivers/ide/ide-lib.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide-lib.c
+++ linux-2.6/drivers/ide/ide-lib.c
@@ -103,7 +103,9 @@ u8 ide_rate_filter(ide_drive_t *drive, u
 		base = XFER_MW_DMA_0;
 		/* Fall thru */
 	case XFER_MW_DMA_0:
-		if (hwif->mwdma_mask & bit)
+		mask = hwif->mdma_filter ? hwif->mdma_filter(drive) :
+					   hwif->mwdma_mask;
+		if (mask & bit)
 			break;
 		base = XFER_SW_DMA_0;
 		/* Fall thru */
Index: linux-2.6/drivers/ide/ide.c
===================================================================
--- linux-2.6.orig/drivers/ide/ide.c
+++ linux-2.6/drivers/ide/ide.c
@@ -398,6 +398,7 @@ static void ide_hwif_restore(ide_hwif_t 
 
 	hwif->tuneproc			= tmp_hwif->tuneproc;
 	hwif->speedproc			= tmp_hwif->speedproc;
+	hwif->mdma_filter		= tmp_hwif->mdma_filter;
 	hwif->udma_filter		= tmp_hwif->udma_filter;
 	hwif->selectproc		= tmp_hwif->selectproc;
 	hwif->reset_poll		= tmp_hwif->reset_poll;
Index: linux-2.6/drivers/ide/pci/hpt366.c
===================================================================
--- linux-2.6.orig/drivers/ide/pci/hpt366.c
+++ linux-2.6/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/ide/pci/hpt366.c		Version 1.12	Aug 25, 2007
+ * linux/drivers/ide/pci/hpt366.c		Version 1.13	Aug 22, 2007
  *
  * Copyright (C) 1999-2003		Andre Hedrick <andre@linux-ide.org>
  * Portions Copyright (C) 2001	        Sun Microsystems, Inc.
@@ -114,7 +114,7 @@
  *   unify HPT36x/37x timing setup code and the speedproc handlers by joining
  *   the register setting lists into the table indexed by the clock selected
  * - set the correct hwif->ultra_mask for each individual chip
- * - add UltraDMA mode filtering for the HPT37[24] based SATA cards
+ * - add Ultra and MW DMA mode filtering for the HPT37[24] based SATA cards
  *	Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com>
  */
 
@@ -562,6 +562,24 @@ static u8 hpt3xx_udma_filter(ide_drive_t
 	return check_in_drive_list(drive, bad_ata33) ? 0x00 : mask;
 }
 
+static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
+{
+	ide_hwif_t *hwif	= HWIF(drive);
+	struct hpt_info *info	= pci_get_drvdata(hwif->pci_dev);
+
+	switch (info->chip_type) {
+	case HPT372 :
+	case HPT372A:
+	case HPT372N:
+	case HPT374 :
+		if (ide_dev_is_sata(drive->id))
+			return 0x00;
+		/* Fall thru */
+	default:
+		return 0x07;
+	}
+}
+
 static u32 get_speed_setting(u8 speed, struct hpt_info *info)
 {
 	int i;
@@ -1257,6 +1275,7 @@ static void __devinit init_hwif_hpt366(i
 	hwif->busproc		= &hpt3xx_busproc;
 
 	hwif->udma_filter	= &hpt3xx_udma_filter;
+	hwif->mdma_filter	= &hpt3xx_mdma_filter;
 
 	/*
 	 * HPT3xxN chips have some complications:
Index: linux-2.6/include/linux/ide.h
===================================================================
--- linux-2.6.orig/include/linux/ide.h
+++ linux-2.6/include/linux/ide.h
@@ -723,6 +723,7 @@ typedef struct hwif_s {
 	/* driver soft-power interface */
 	int	(*busproc)(ide_drive_t *, int);
 #endif
+	u8 (*mdma_filter)(ide_drive_t *);
 	u8 (*udma_filter)(ide_drive_t *);
 
 	void (*ata_input_data)(ide_drive_t *, void *, u32);


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

* Re: [PATCH 2/4] hpt366: MWDMA filter for SATA cards
  2007-09-02 20:19 [PATCH 2/4] hpt366: MWDMA filter for SATA cards Sergei Shtylyov
@ 2007-09-02 20:25 ` Sergei Shtylyov
  2007-09-03 18:50   ` Bartlomiej Zolnierkiewicz
  2007-09-08 12:01   ` Sergei Shtylyov
  0 siblings, 2 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2007-09-02 20:25 UTC (permalink / raw)
  To: bzolnier; +Cc: linux-ide, linux-kernel

Hello, I wrote:

    The patch was 4/4 of course. :-<
     Probably I was too esctatic about the code. ;-)

> The Marvell bridge chips used on HighPoint SATA cards do not seem to support
> the MWDMA modes (at least that caould be seen in their so-called drivers :-),
> so the driver needs to account for this -- to achieve this:

> - add mdma_filter() method from the original patch by Bartlomiej Zolnierkewicz
>   with his consent, also adding the method callout to ide_rate_filter();

> - installed the method for all chips to only return empty mask if a SATA drive
>   is detected onHPT372{AN]/374 chips...

> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

> ---
> This patch against the current Linus' tree and unfortunately I was able to only
> compile test it since that tree gives MODPOST warning and dies early on bootup.
> Will hopefully try to test if/when I have time... :-)

> Index: linux-2.6/drivers/ide/pci/hpt366.c
> ===================================================================
> --- linux-2.6.orig/drivers/ide/pci/hpt366.c
> +++ linux-2.6/drivers/ide/pci/hpt366.c
> @@ -1,5 +1,5 @@
>  /*
> - * linux/drivers/ide/pci/hpt366.c		Version 1.12	Aug 25, 2007
> + * linux/drivers/ide/pci/hpt366.c		Version 1.13	Aug 22, 2007

    Errr... and version shuold Aug 02 -- thought I've fixed that. :-/

MBR, Sergei

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

* Re: [PATCH 2/4] hpt366: MWDMA filter for SATA cards
  2007-09-02 20:25 ` Sergei Shtylyov
@ 2007-09-03 18:50   ` Bartlomiej Zolnierkiewicz
  2007-09-08 12:01   ` Sergei Shtylyov
  1 sibling, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-09-03 18:50 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-ide, linux-kernel

On Sunday 02 September 2007, Sergei Shtylyov wrote:
> Hello, I wrote:
> 
>     The patch was 4/4 of course. :-<
>      Probably I was too esctatic about the code. ;-)
> 
> > The Marvell bridge chips used on HighPoint SATA cards do not seem to support
> > the MWDMA modes (at least that caould be seen in their so-called drivers :-),
> > so the driver needs to account for this -- to achieve this:
> 
> > - add mdma_filter() method from the original patch by Bartlomiej Zolnierkewicz
> >   with his consent, also adding the method callout to ide_rate_filter();
> 
> > - installed the method for all chips to only return empty mask if a SATA drive
> >   is detected onHPT372{AN]/374 chips...
> 
> > Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> > ---
> > This patch against the current Linus' tree and unfortunately I was able to only
> > compile test it since that tree gives MODPOST warning and dies early on bootup.
> > Will hopefully try to test if/when I have time... :-)
> 
> > Index: linux-2.6/drivers/ide/pci/hpt366.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/ide/pci/hpt366.c
> > +++ linux-2.6/drivers/ide/pci/hpt366.c
> > @@ -1,5 +1,5 @@
> >  /*
> > - * linux/drivers/ide/pci/hpt366.c		Version 1.12	Aug 25, 2007
> > + * linux/drivers/ide/pci/hpt366.c		Version 1.13	Aug 22, 2007
> 
>     Errr... and version shuold Aug 02 -- thought I've fixed that. :-/

and we have ATA_MWDMA2 define in _vanilla_ kernel now :)

Bart

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

* Re: [PATCH 2/4] hpt366: MWDMA filter for SATA cards
  2007-09-02 20:25 ` Sergei Shtylyov
  2007-09-03 18:50   ` Bartlomiej Zolnierkiewicz
@ 2007-09-08 12:01   ` Sergei Shtylyov
  2007-09-11 21:08     ` Bartlomiej Zolnierkiewicz
  1 sibling, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2007-09-08 12:01 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: bzolnier, linux-ide, linux-kernel

Hello, I wrote:
Sergei Shtylyov wrote:

>    The patch was 4/4 of course. :-<
>     Probably I was too esctatic about the code. ;-)

    Or rarher me. :-)

>> The Marvell bridge chips used on HighPoint SATA cards do not seem to 
>> support
>> the MWDMA modes (at least that caould be seen in their so-called 
>> drivers :-),
>> so the driver needs to account for this -- to achieve this:

>> - add mdma_filter() method from the original patch by Bartlomiej 
>> Zolnierkewicz
>>   with his consent, also adding the method callout to ide_rate_filter();

>> - installed the method for all chips to only return empty mask if a 
>> SATA drive
>>   is detected onHPT372{AN]/374 chips...

>> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

>> ---
>> This patch against the current Linus' tree and unfortunately I was 
>> able to only
>> compile test it since that tree gives MODPOST warning and dies early 
>> on bootup.
>> Will hopefully try to test if/when I have time... :-)

    And it was still the same -- I'd bisected if I had time...

>> Index: linux-2.6/drivers/ide/pci/hpt366.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/ide/pci/hpt366.c
>> +++ linux-2.6/drivers/ide/pci/hpt366.c
>> @@ -1,5 +1,5 @@
>>  /*
>> - * linux/drivers/ide/pci/hpt366.c        Version 1.12    Aug 25, 2007
>> + * linux/drivers/ide/pci/hpt366.c        Version 1.13    Aug 22, 2007

>    Errr... and version shuold Aug 02 -- thought I've fixed that. :-/

    Hehe, thanks.  Those versions turned to be quite PITA a to keep.

MBR, Sergei

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

* Re: [PATCH 2/4] hpt366: MWDMA filter for SATA cards
  2007-09-08 12:01   ` Sergei Shtylyov
@ 2007-09-11 21:08     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 5+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-09-11 21:08 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-ide, linux-kernel

On Saturday 08 September 2007, Sergei Shtylyov wrote:
> Hello, I wrote:
> Sergei Shtylyov wrote:
> 
> >    The patch was 4/4 of course. :-<
> >     Probably I was too esctatic about the code. ;-)
> 
>     Or rarher me. :-)
> 
> >> The Marvell bridge chips used on HighPoint SATA cards do not seem to 
> >> support
> >> the MWDMA modes (at least that caould be seen in their so-called 
> >> drivers :-),
> >> so the driver needs to account for this -- to achieve this:
> 
> >> - add mdma_filter() method from the original patch by Bartlomiej 
> >> Zolnierkewicz
> >>   with his consent, also adding the method callout to ide_rate_filter();
> 
> >> - installed the method for all chips to only return empty mask if a 
> >> SATA drive
> >>   is detected onHPT372{AN]/374 chips...
> 
> >> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

I pushed all your bugfix patches that were in IDE tree to Linus so
(after "the pull") please resync and resend the outstanding patches.

> >> ---
> >> This patch against the current Linus' tree and unfortunately I was 
> >> able to only
> >> compile test it since that tree gives MODPOST warning and dies early 
> >> on bootup.
> >> Will hopefully try to test if/when I have time... :-)
> 
>     And it was still the same -- I'd bisected if I had time...

:(

> >> Index: linux-2.6/drivers/ide/pci/hpt366.c
> >> ===================================================================
> >> --- linux-2.6.orig/drivers/ide/pci/hpt366.c
> >> +++ linux-2.6/drivers/ide/pci/hpt366.c
> >> @@ -1,5 +1,5 @@
> >>  /*
> >> - * linux/drivers/ide/pci/hpt366.c        Version 1.12    Aug 25, 2007
> >> + * linux/drivers/ide/pci/hpt366.c        Version 1.13    Aug 22, 2007
> 
> >    Errr... and version shuold Aug 02 -- thought I've fixed that. :-/
> 
>     Hehe, thanks.  Those versions turned to be quite PITA a to keep.

I think we should get rid of these "old-style" versions and convert
all IDE host drivers to use "new-style" versions (DRV_VERSION define
+ MODULE_VERSION(DRV_VERSION)).  Any volunteers? :)

Thanks,
Bart

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

end of thread, other threads:[~2007-09-11 21:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-02 20:19 [PATCH 2/4] hpt366: MWDMA filter for SATA cards Sergei Shtylyov
2007-09-02 20:25 ` Sergei Shtylyov
2007-09-03 18:50   ` Bartlomiej Zolnierkiewicz
2007-09-08 12:01   ` Sergei Shtylyov
2007-09-11 21:08     ` Bartlomiej Zolnierkiewicz

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