aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:53:59 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-10-11 17:53:59 -0400
commit3160d5416f39da9d9221fec7cb9d64399b706bbc (patch)
treeb722e5610224bae3647453a0043e40c98932190c /drivers/ide
parent7670df73fba373d19471a2ebedb3302ea0607be0 (diff)
sis5513: add ->udma_filter method for chipset_family >= ATA_133
* Add sis5513_ata133_udma_filter() for chipset_family >= ATA_133, use it to filter UDMA6 mode if ATA133 bit is disabled. * Remove no longer needed UDMA6 limiting logic from sis5513_tune_chipset(). * Bump driver version. There should be no functionality changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/sis5513.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 26f24802d3e8..1da037f1394e 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/sis5513.c Version 0.25 Jun 10, 2007 2 * linux/drivers/ide/pci/sis5513.c Version 0.26 Jul 7, 2007
3 * 3 *
4 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2002 Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer 5 * Copyright (C) 2002 Lionel Bouton <Lionel.Bouton@inet6.fr>, Maintainer
@@ -582,9 +582,6 @@ static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed)
582 regdw |= (unsigned long)cycle_time_value[ATA_133][speed-XFER_UDMA_0] << 4; 582 regdw |= (unsigned long)cycle_time_value[ATA_133][speed-XFER_UDMA_0] << 4;
583 regdw |= (unsigned long)cvs_time_value[ATA_133][speed-XFER_UDMA_0] << 8; 583 regdw |= (unsigned long)cvs_time_value[ATA_133][speed-XFER_UDMA_0] << 8;
584 } else { 584 } else {
585 /* if ATA133 disable, we should not set speed above UDMA5 */
586 if (speed > XFER_UDMA_5)
587 speed = XFER_UDMA_5;
588 regdw |= (unsigned long)cycle_time_value[ATA_100][speed-XFER_UDMA_0] << 4; 585 regdw |= (unsigned long)cycle_time_value[ATA_100][speed-XFER_UDMA_0] << 4;
589 regdw |= (unsigned long)cvs_time_value[ATA_100][speed-XFER_UDMA_0] << 8; 586 regdw |= (unsigned long)cvs_time_value[ATA_100][speed-XFER_UDMA_0] << 8;
590 } 587 }
@@ -640,6 +637,20 @@ static int sis5513_config_xfer_rate(ide_drive_t *drive)
640 return -1; 637 return -1;
641} 638}
642 639
640static u8 sis5513_ata133_udma_filter(ide_drive_t *drive)
641{
642 struct pci_dev *dev = drive->hwif->pci_dev;
643 int drive_pci;
644 u32 reg54 = 0, regdw = 0;
645
646 pci_read_config_dword(dev, 0x54, &reg54);
647 drive_pci = ((reg54 & 0x40000000) ? 0x70 : 0x40) + drive->dn * 4;
648 pci_read_config_dword(dev, drive_pci, &regdw);
649
650 /* if ATA133 disable, we should not set speed above UDMA5 */
651 return (regdw & 0x08) ? ATA_UDMA6 : ATA_UDMA5;
652}
653
643/* Chip detection and general config */ 654/* Chip detection and general config */
644static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const char *name) 655static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const char *name)
645{ 656{
@@ -847,6 +858,9 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
847 hwif->tuneproc = &sis5513_tuneproc; 858 hwif->tuneproc = &sis5513_tuneproc;
848 hwif->speedproc = &sis5513_tune_chipset; 859 hwif->speedproc = &sis5513_tune_chipset;
849 860
861 if (chipset_family >= ATA_133)
862 hwif->udma_filter = sis5513_ata133_udma_filter;
863
850 if (!(hwif->dma_base)) { 864 if (!(hwif->dma_base)) {
851 hwif->drives[0].autotune = 1; 865 hwif->drives[0].autotune = 1;
852 hwif->drives[1].autotune = 1; 866 hwif->drives[1].autotune = 1;