aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2007-10-11 17:53:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:53:58 -0400
commitb4e44369a380c1836d0983c2a5011099b7b26eb1 (patch)
treec7be9a68f98d908c7822d65dcec4b3c21d9d7955
parent7cfa7168f7a7730abf1aa2af4a7596d24edd4c21 (diff)
hpt366: MWDMA filter for SATA cards (take 2)
The Marvell bridge chips used on HighPoint SATA cards do not seem to support the MWDMA modes (at least that could 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 Zolnierkiewicz with his consent; - install the method for all chips to only return empty mask if a SATA drive is detected on HPT372{AN]/374 chips... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-dma.c9
-rw-r--r--drivers/ide/ide.c1
-rw-r--r--drivers/ide/pci/hpt366.c23
-rw-r--r--include/linux/ide.h1
4 files changed, 30 insertions, 4 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index ff644a5e12cd..097d6e9865bc 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -673,8 +673,13 @@ static unsigned int ide_get_mode_mask(ide_drive_t *drive, u8 base)
673 mask &= 0x07; 673 mask &= 0x07;
674 break; 674 break;
675 case XFER_MW_DMA_0: 675 case XFER_MW_DMA_0:
676 if (id->field_valid & 2) 676 if ((id->field_valid & 2) == 0)
677 mask = id->dma_mword & hwif->mwdma_mask; 677 break;
678 if (hwif->mdma_filter)
679 mask = hwif->mdma_filter(drive);
680 else
681 mask = hwif->mwdma_mask;
682 mask &= id->dma_mword;
678 break; 683 break;
679 case XFER_SW_DMA_0: 684 case XFER_SW_DMA_0:
680 if (id->field_valid & 2) { 685 if (id->field_valid & 2) {
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 5e88a060df06..de54306789a1 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -398,6 +398,7 @@ static void ide_hwif_restore(ide_hwif_t *hwif, ide_hwif_t *tmp_hwif)
398 398
399 hwif->tuneproc = tmp_hwif->tuneproc; 399 hwif->tuneproc = tmp_hwif->tuneproc;
400 hwif->speedproc = tmp_hwif->speedproc; 400 hwif->speedproc = tmp_hwif->speedproc;
401 hwif->mdma_filter = tmp_hwif->mdma_filter;
401 hwif->udma_filter = tmp_hwif->udma_filter; 402 hwif->udma_filter = tmp_hwif->udma_filter;
402 hwif->selectproc = tmp_hwif->selectproc; 403 hwif->selectproc = tmp_hwif->selectproc;
403 hwif->reset_poll = tmp_hwif->reset_poll; 404 hwif->reset_poll = tmp_hwif->reset_poll;
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 39f1c89f7c86..3d8d6b2ee41a 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/hpt366.c Version 1.12 Aug 19, 2007 2 * linux/drivers/ide/pci/hpt366.c Version 1.13 Sep 29, 2007
3 * 3 *
4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org>
5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc.
@@ -114,7 +114,7 @@
114 * unify HPT36x/37x timing setup code and the speedproc handlers by joining 114 * unify HPT36x/37x timing setup code and the speedproc handlers by joining
115 * the register setting lists into the table indexed by the clock selected 115 * the register setting lists into the table indexed by the clock selected
116 * - set the correct hwif->ultra_mask for each individual chip 116 * - set the correct hwif->ultra_mask for each individual chip
117 * - add UltraDMA mode filtering for the HPT37[24] based SATA cards 117 * - add Ultra and MW DMA mode filtering for the HPT37[24] based SATA cards
118 * Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com> 118 * Sergei Shtylyov, <sshtylyov@ru.mvista.com> or <source@mvista.com>
119 */ 119 */
120 120
@@ -562,6 +562,24 @@ static u8 hpt3xx_udma_filter(ide_drive_t *drive)
562 return check_in_drive_list(drive, bad_ata33) ? 0x00 : mask; 562 return check_in_drive_list(drive, bad_ata33) ? 0x00 : mask;
563} 563}
564 564
565static u8 hpt3xx_mdma_filter(ide_drive_t *drive)
566{
567 ide_hwif_t *hwif = HWIF(drive);
568 struct hpt_info *info = pci_get_drvdata(hwif->pci_dev);
569
570 switch (info->chip_type) {
571 case HPT372 :
572 case HPT372A:
573 case HPT372N:
574 case HPT374 :
575 if (ide_dev_is_sata(drive->id))
576 return 0x00;
577 /* Fall thru */
578 default:
579 return 0x07;
580 }
581}
582
565static u32 get_speed_setting(u8 speed, struct hpt_info *info) 583static u32 get_speed_setting(u8 speed, struct hpt_info *info)
566{ 584{
567 int i; 585 int i;
@@ -1257,6 +1275,7 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
1257 hwif->busproc = &hpt3xx_busproc; 1275 hwif->busproc = &hpt3xx_busproc;
1258 1276
1259 hwif->udma_filter = &hpt3xx_udma_filter; 1277 hwif->udma_filter = &hpt3xx_udma_filter;
1278 hwif->mdma_filter = &hpt3xx_mdma_filter;
1260 1279
1261 /* 1280 /*
1262 * HPT3xxN chips have some complications: 1281 * HPT3xxN chips have some complications:
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b9f66c10caa0..0665428356d3 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -723,6 +723,7 @@ typedef struct hwif_s {
723 /* driver soft-power interface */ 723 /* driver soft-power interface */
724 int (*busproc)(ide_drive_t *, int); 724 int (*busproc)(ide_drive_t *, int);
725#endif 725#endif
726 u8 (*mdma_filter)(ide_drive_t *);
726 u8 (*udma_filter)(ide_drive_t *); 727 u8 (*udma_filter)(ide_drive_t *);
727 728
728 void (*ata_input_data)(ide_drive_t *, void *, u32); 729 void (*ata_input_data)(ide_drive_t *, void *, u32);