aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/sis5513.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/sis5513.c')
-rw-r--r--drivers/ide/pci/sis5513.c44
1 files changed, 9 insertions, 35 deletions
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 2ba0669f36a1..2bde1b92784a 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -191,7 +191,7 @@ static char* chipset_capability[] = {
191 "ATA 133 (1st gen)", "ATA 133 (2nd gen)" 191 "ATA 133 (1st gen)", "ATA 133 (2nd gen)"
192}; 192};
193 193
194#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) 194#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_IDE_PROC_FS)
195#include <linux/stat.h> 195#include <linux/stat.h>
196#include <linux/proc_fs.h> 196#include <linux/proc_fs.h>
197 197
@@ -426,17 +426,7 @@ static int sis_get_info (char *buffer, char **addr, off_t offset, int count)
426 426
427 return len > count ? count : len; 427 return len > count ? count : len;
428} 428}
429#endif /* defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) */ 429#endif /* defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_IDE_PROC_FS) */
430
431static u8 sis5513_ratemask (ide_drive_t *drive)
432{
433 u8 rates[] = { 0, 0, 1, 2, 3, 3, 4, 4 };
434 u8 mode = rates[chipset_family];
435
436 if (!eighty_ninty_three(drive))
437 mode = min(mode, (u8)1);
438 return mode;
439}
440 430
441/* 431/*
442 * Configuration functions 432 * Configuration functions
@@ -563,7 +553,7 @@ static int sis5513_tune_chipset (ide_drive_t *drive, u8 xferspeed)
563 u8 drive_pci, reg, speed; 553 u8 drive_pci, reg, speed;
564 u32 regdw; 554 u32 regdw;
565 555
566 speed = ide_rate_filter(sis5513_ratemask(drive), xferspeed); 556 speed = ide_rate_filter(drive, xferspeed);
567 557
568 /* See config_art_rwp_pio for drive pci config registers */ 558 /* See config_art_rwp_pio for drive pci config registers */
569 drive_pci = 0x40; 559 drive_pci = 0x40;
@@ -648,32 +638,13 @@ static void sis5513_tune_drive (ide_drive_t *drive, u8 pio)
648 (void) config_chipset_for_pio(drive, pio); 638 (void) config_chipset_for_pio(drive, pio);
649} 639}
650 640
651/*
652 * ((id->hw_config & 0x4000|0x2000) && (HWIF(drive)->udma_four))
653 */
654static int config_chipset_for_dma (ide_drive_t *drive)
655{
656 u8 speed = ide_dma_speed(drive, sis5513_ratemask(drive));
657
658#ifdef DEBUG
659 printk("SIS5513: config_chipset_for_dma, drive %d, ultra %x\n",
660 drive->dn, drive->id->dma_ultra);
661#endif
662
663 if (!(speed))
664 return 0;
665
666 sis5513_tune_chipset(drive, speed);
667 return ide_dma_enable(drive);
668}
669
670static int sis5513_config_xfer_rate(ide_drive_t *drive) 641static int sis5513_config_xfer_rate(ide_drive_t *drive)
671{ 642{
672 config_art_rwp_pio(drive, 5); 643 config_art_rwp_pio(drive, 5);
673 644
674 drive->init_speed = 0; 645 drive->init_speed = 0;
675 646
676 if (ide_use_dma(drive) && config_chipset_for_dma(drive)) 647 if (ide_tune_dma(drive))
677 return 0; 648 return 0;
678 649
679 if (ide_use_fast_pio(drive)) 650 if (ide_use_fast_pio(drive))
@@ -826,7 +797,7 @@ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const c
826 break; 797 break;
827 } 798 }
828 799
829#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_PROC_FS) 800#if defined(DISPLAY_SIS_TIMINGS) && defined(CONFIG_IDE_PROC_FS)
830 if (!sis_proc) { 801 if (!sis_proc) {
831 sis_proc = 1; 802 sis_proc = 1;
832 bmide_dev = dev; 803 bmide_dev = dev;
@@ -858,6 +829,8 @@ static unsigned int __devinit ata66_sis5513 (ide_hwif_t *hwif)
858 829
859static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) 830static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
860{ 831{
832 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
833
861 hwif->autodma = 0; 834 hwif->autodma = 0;
862 835
863 if (!hwif->irq) 836 if (!hwif->irq)
@@ -873,7 +846,8 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
873 } 846 }
874 847
875 hwif->atapi_dma = 1; 848 hwif->atapi_dma = 1;
876 hwif->ultra_mask = 0x7f; 849
850 hwif->ultra_mask = udma_rates[chipset_family];
877 hwif->mwdma_mask = 0x07; 851 hwif->mwdma_mask = 0x07;
878 hwif->swdma_mask = 0x07; 852 hwif->swdma_mask = 0x07;
879 853