X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fide%2Fpci%2Fsis5513.c;h=8e9d87701ce245f4eb15ed4a370c4e2f4ba22111;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=6c56f5670202b3093589ec8555602aab09549878;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 6c56f5670..8e9d87701 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -63,7 +63,8 @@ #include #include "ide-timing.h" -#include "sis5513.h" + +#define DISPLAY_SIS_TIMINGS /* registers layout and init values are chipset family dependant */ @@ -86,6 +87,7 @@ static const struct { u8 chipset_family; u8 flags; } SiSHostChipInfo[] = { + { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, @@ -110,6 +112,7 @@ static const struct { { "SiS5596", PCI_DEVICE_ID_SI_5596, ATA_16 }, { "SiS5571", PCI_DEVICE_ID_SI_5571, ATA_16 }, + { "SiS5517", PCI_DEVICE_ID_SI_5517, ATA_16 }, { "SiS551x", PCI_DEVICE_ID_SI_5511, ATA_16 }, }; @@ -522,6 +525,7 @@ static void config_art_rwp_pio (ide_drive_t *drive, u8 pio) case 3: test1 = 0x30|0x03; break; case 2: test1 = 0x40|0x04; break; case 1: test1 = 0x60|0x07; break; + case 0: test1 = 0x00; break; default: break; } pci_write_config_byte(dev, drive_pci, test1); @@ -670,36 +674,16 @@ static int sis5513_config_drive_xfer_rate (ide_drive_t *drive) drive->init_speed = 0; if (id && (id->capability & 1) && drive->autodma) { - /* Consult the list of known "bad" drives */ - if (__ide_dma_bad_drive(drive)) - goto fast_ata_pio; - if (id->field_valid & 4) { - if (id->dma_ultra & hwif->ultra_mask) { - /* Force if Capable UltraDMA */ - int dma = config_chipset_for_dma(drive); - if ((id->field_valid & 2) && !dma) - goto try_dma_modes; - } - } else if (id->field_valid & 2) { -try_dma_modes: - if ((id->dma_mword & hwif->mwdma_mask) || - (id->dma_1word & hwif->swdma_mask)) { - /* Force if Capable regular DMA modes */ - if (!config_chipset_for_dma(drive)) - goto no_dma_set; - } - } else if (__ide_dma_good_drive(drive) && - (id->eide_dma_time < 150)) { - /* Consult the list of known "good" drives */ - if (!config_chipset_for_dma(drive)) - goto no_dma_set; - } else { - goto fast_ata_pio; + + if (ide_use_dma(drive)) { + if (config_chipset_for_dma(drive)) + return hwif->ide_dma_on(drive); } - return hwif->ide_dma_on(drive); + + goto fast_ata_pio; + } else if ((id->capability & 8) || (id->field_valid & 2)) { fast_ata_pio: -no_dma_set: sis5513_tune_drive(drive, 5); return hwif->ide_dma_off_quietly(drive); } @@ -745,7 +729,7 @@ static int sis5513_config_xfer_rate (ide_drive_t *drive) */ /* Chip detection and general config */ -static unsigned int __init init_chipset_sis5513 (struct pci_dev *dev, const char *name) +static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev, const char *name) { struct pci_dev *host; int i = 0; @@ -787,6 +771,15 @@ static unsigned int __init init_chipset_sis5513 (struct pci_dev *dev, const char if (trueid == 0x5518) { printk(KERN_INFO "SIS5513: SiS 962/963 MuTIOL IDE UDMA133 controller\n"); chipset_family = ATA_133; + + /* Check for 5513 compability mapping + * We must use this, else the port enabled code will fail, + * as it expects the enablebits at 0x4a. + */ + if ((idemisc & 0x40000000) == 0) { + pci_write_config_dword(dev, 0x54, idemisc | 0x40000000); + printk(KERN_INFO "SIS5513: Switching to 5513 register mapping\n"); + } } } @@ -889,7 +882,7 @@ static unsigned int __init init_chipset_sis5513 (struct pci_dev *dev, const char return 0; } -static unsigned int __init ata66_sis5513 (ide_hwif_t *hwif) +static unsigned int __devinit ata66_sis5513 (ide_hwif_t *hwif) { u8 ata66 = 0; @@ -907,7 +900,7 @@ static unsigned int __init ata66_sis5513 (ide_hwif_t *hwif) return ata66; } -static void __init init_hwif_sis5513 (ide_hwif_t *hwif) +static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) { hwif->autodma = 0; @@ -944,23 +937,30 @@ static void __init init_hwif_sis5513 (ide_hwif_t *hwif) return; } +static ide_pci_device_t sis5513_chipset __devinitdata = { + .name = "SIS5513", + .init_chipset = init_chipset_sis5513, + .init_hwif = init_hwif_sis5513, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, + .bootable = ON_BOARD, +}; + static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - ide_pci_device_t *d = &sis5513_chipsets[id->driver_data]; - if (dev->device != d->device) - BUG(); - ide_setup_pci_device(dev, d); - return 0; + return ide_setup_pci_device(dev, &sis5513_chipset); } static struct pci_device_id sis5513_pci_tbl[] = { { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5513, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + { PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5518, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { 0, }, }; MODULE_DEVICE_TABLE(pci, sis5513_pci_tbl); static struct pci_driver driver = { - .name = "SIS IDE", + .name = "SIS_IDE", .id_table = sis5513_pci_tbl, .probe = sis5513_init_one, };