diff options
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/pci/siimage.c | 79 |
1 files changed, 39 insertions, 40 deletions
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 689786df1ede..463bfda84265 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/siimage.c Version 1.17 Oct 18 2007 | 2 | * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> |
@@ -57,8 +57,8 @@ | |||
57 | 57 | ||
58 | static int pdev_is_sata(struct pci_dev *pdev) | 58 | static int pdev_is_sata(struct pci_dev *pdev) |
59 | { | 59 | { |
60 | switch(pdev->device) | 60 | #ifdef CONFIG_BLK_DEV_IDE_SATA |
61 | { | 61 | switch(pdev->device) { |
62 | case PCI_DEVICE_ID_SII_3112: | 62 | case PCI_DEVICE_ID_SII_3112: |
63 | case PCI_DEVICE_ID_SII_1210SA: | 63 | case PCI_DEVICE_ID_SII_1210SA: |
64 | return 1; | 64 | return 1; |
@@ -66,9 +66,10 @@ static int pdev_is_sata(struct pci_dev *pdev) | |||
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | BUG(); | 68 | BUG(); |
69 | #endif | ||
69 | return 0; | 70 | return 0; |
70 | } | 71 | } |
71 | 72 | ||
72 | /** | 73 | /** |
73 | * is_sata - check if hwif is SATA | 74 | * is_sata - check if hwif is SATA |
74 | * @hwif: interface to check | 75 | * @hwif: interface to check |
@@ -136,7 +137,7 @@ static inline unsigned long siimage_seldev(ide_drive_t *drive, int r) | |||
136 | * SI3112 SATA controller life is a bit simpler. | 137 | * SI3112 SATA controller life is a bit simpler. |
137 | */ | 138 | */ |
138 | 139 | ||
139 | static u8 sil_udma_filter(ide_drive_t *drive) | 140 | static u8 sil_pata_udma_filter(ide_drive_t *drive) |
140 | { | 141 | { |
141 | ide_hwif_t *hwif = drive->hwif; | 142 | ide_hwif_t *hwif = drive->hwif; |
142 | unsigned long base = (unsigned long) hwif->hwif_data; | 143 | unsigned long base = (unsigned long) hwif->hwif_data; |
@@ -147,23 +148,23 @@ static u8 sil_udma_filter(ide_drive_t *drive) | |||
147 | else | 148 | else |
148 | pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); | 149 | pci_read_config_byte(hwif->pci_dev, 0x8A, &scsc); |
149 | 150 | ||
150 | if (is_sata(hwif)) { | ||
151 | mask = strstr(drive->id->model, "Maxtor") ? 0x3f : 0x7f; | ||
152 | goto out; | ||
153 | } | ||
154 | |||
155 | if ((scsc & 0x30) == 0x10) /* 133 */ | 151 | if ((scsc & 0x30) == 0x10) /* 133 */ |
156 | mask = 0x7f; | 152 | mask = ATA_UDMA6; |
157 | else if ((scsc & 0x30) == 0x20) /* 2xPCI */ | 153 | else if ((scsc & 0x30) == 0x20) /* 2xPCI */ |
158 | mask = 0x7f; | 154 | mask = ATA_UDMA6; |
159 | else if ((scsc & 0x30) == 0x00) /* 100 */ | 155 | else if ((scsc & 0x30) == 0x00) /* 100 */ |
160 | mask = 0x3f; | 156 | mask = ATA_UDMA5; |
161 | else /* Disabled ? */ | 157 | else /* Disabled ? */ |
162 | BUG(); | 158 | BUG(); |
163 | out: | 159 | |
164 | return mask; | 160 | return mask; |
165 | } | 161 | } |
166 | 162 | ||
163 | static u8 sil_sata_udma_filter(ide_drive_t *drive) | ||
164 | { | ||
165 | return strstr(drive->id->model, "Maxtor") ? ATA_UDMA5 : ATA_UDMA6; | ||
166 | } | ||
167 | |||
167 | /** | 168 | /** |
168 | * sil_set_pio_mode - set host controller for PIO mode | 169 | * sil_set_pio_mode - set host controller for PIO mode |
169 | * @drive: drive | 170 | * @drive: drive |
@@ -340,10 +341,11 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive) | |||
340 | static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | 341 | static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) |
341 | { | 342 | { |
342 | ide_hwif_t *hwif = HWIF(drive); | 343 | ide_hwif_t *hwif = HWIF(drive); |
343 | unsigned long base = (unsigned long)hwif->hwif_data; | ||
344 | unsigned long addr = siimage_selreg(hwif, 0x1); | 344 | unsigned long addr = siimage_selreg(hwif, 0x1); |
345 | 345 | ||
346 | if (SATA_ERROR_REG) { | 346 | if (SATA_ERROR_REG) { |
347 | unsigned long base = (unsigned long)hwif->hwif_data; | ||
348 | |||
347 | u32 ext_stat = readl((void __iomem *)(base + 0x10)); | 349 | u32 ext_stat = readl((void __iomem *)(base + 0x10)); |
348 | u8 watchdog = 0; | 350 | u8 watchdog = 0; |
349 | if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { | 351 | if (ext_stat & ((hwif->channel) ? 0x40 : 0x10)) { |
@@ -376,7 +378,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
376 | } | 378 | } |
377 | 379 | ||
378 | /** | 380 | /** |
379 | * siimage_busproc - bus isolation ioctl | 381 | * sil_sata_busproc - bus isolation IOCTL |
380 | * @drive: drive to isolate/restore | 382 | * @drive: drive to isolate/restore |
381 | * @state: bus state to set | 383 | * @state: bus state to set |
382 | * | 384 | * |
@@ -384,8 +386,8 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive) | |||
384 | * SATA controller the work required is quite limited, we | 386 | * SATA controller the work required is quite limited, we |
385 | * just have to clean up the statistics | 387 | * just have to clean up the statistics |
386 | */ | 388 | */ |
387 | 389 | ||
388 | static int siimage_busproc (ide_drive_t * drive, int state) | 390 | static int sil_sata_busproc(ide_drive_t * drive, int state) |
389 | { | 391 | { |
390 | ide_hwif_t *hwif = HWIF(drive); | 392 | ide_hwif_t *hwif = HWIF(drive); |
391 | u32 stat_config = 0; | 393 | u32 stat_config = 0; |
@@ -417,14 +419,14 @@ static int siimage_busproc (ide_drive_t * drive, int state) | |||
417 | } | 419 | } |
418 | 420 | ||
419 | /** | 421 | /** |
420 | * siimage_reset_poll - wait for sata reset | 422 | * sil_sata_reset_poll - wait for SATA reset |
421 | * @drive: drive we are resetting | 423 | * @drive: drive we are resetting |
422 | * | 424 | * |
423 | * Poll the SATA phy and see whether it has come back from the dead | 425 | * Poll the SATA phy and see whether it has come back from the dead |
424 | * yet. | 426 | * yet. |
425 | */ | 427 | */ |
426 | 428 | ||
427 | static int siimage_reset_poll (ide_drive_t *drive) | 429 | static int sil_sata_reset_poll(ide_drive_t *drive) |
428 | { | 430 | { |
429 | if (SATA_STATUS_REG) { | 431 | if (SATA_STATUS_REG) { |
430 | ide_hwif_t *hwif = HWIF(drive); | 432 | ide_hwif_t *hwif = HWIF(drive); |
@@ -436,27 +438,22 @@ static int siimage_reset_poll (ide_drive_t *drive) | |||
436 | HWGROUP(drive)->polling = 0; | 438 | HWGROUP(drive)->polling = 0; |
437 | return ide_started; | 439 | return ide_started; |
438 | } | 440 | } |
439 | return 0; | ||
440 | } else { | ||
441 | return 0; | ||
442 | } | 441 | } |
442 | |||
443 | return 0; | ||
443 | } | 444 | } |
444 | 445 | ||
445 | /** | 446 | /** |
446 | * siimage_pre_reset - reset hook | 447 | * sil_sata_pre_reset - reset hook |
447 | * @drive: IDE device being reset | 448 | * @drive: IDE device being reset |
448 | * | 449 | * |
449 | * For the SATA devices we need to handle recalibration/geometry | 450 | * For the SATA devices we need to handle recalibration/geometry |
450 | * differently | 451 | * differently |
451 | */ | 452 | */ |
452 | |||
453 | static void siimage_pre_reset (ide_drive_t *drive) | ||
454 | { | ||
455 | if (drive->media != ide_disk) | ||
456 | return; | ||
457 | 453 | ||
458 | if (is_sata(HWIF(drive))) | 454 | static void sil_sata_pre_reset(ide_drive_t *drive) |
459 | { | 455 | { |
456 | if (drive->media == ide_disk) { | ||
460 | drive->special.b.set_geometry = 0; | 457 | drive->special.b.set_geometry = 0; |
461 | drive->special.b.recalibrate = 0; | 458 | drive->special.b.recalibrate = 0; |
462 | } | 459 | } |
@@ -502,7 +499,6 @@ static void siimage_reset (ide_drive_t *drive) | |||
502 | drive->failures++; | 499 | drive->failures++; |
503 | } | 500 | } |
504 | } | 501 | } |
505 | |||
506 | } | 502 | } |
507 | 503 | ||
508 | /** | 504 | /** |
@@ -864,28 +860,31 @@ static u8 __devinit ata66_siimage(ide_hwif_t *hwif) | |||
864 | 860 | ||
865 | static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | 861 | static void __devinit init_hwif_siimage(ide_hwif_t *hwif) |
866 | { | 862 | { |
863 | u8 sata = is_sata(hwif); | ||
864 | |||
867 | hwif->resetproc = &siimage_reset; | 865 | hwif->resetproc = &siimage_reset; |
868 | hwif->set_pio_mode = &sil_set_pio_mode; | 866 | hwif->set_pio_mode = &sil_set_pio_mode; |
869 | hwif->set_dma_mode = &sil_set_dma_mode; | 867 | hwif->set_dma_mode = &sil_set_dma_mode; |
870 | hwif->reset_poll = &siimage_reset_poll; | ||
871 | hwif->pre_reset = &siimage_pre_reset; | ||
872 | hwif->udma_filter = &sil_udma_filter; | ||
873 | 868 | ||
874 | if(is_sata(hwif)) { | 869 | if (sata) { |
875 | static int first = 1; | 870 | static int first = 1; |
876 | 871 | ||
877 | hwif->busproc = &siimage_busproc; | 872 | hwif->busproc = &sil_sata_busproc; |
873 | hwif->reset_poll = &sil_sata_reset_poll; | ||
874 | hwif->pre_reset = &sil_sata_pre_reset; | ||
875 | hwif->udma_filter = &sil_sata_udma_filter; | ||
878 | 876 | ||
879 | if (first) { | 877 | if (first) { |
880 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); | 878 | printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n"); |
881 | first = 0; | 879 | first = 0; |
882 | } | 880 | } |
883 | } | 881 | } else |
882 | hwif->udma_filter = &sil_pata_udma_filter; | ||
884 | 883 | ||
885 | if (hwif->dma_base == 0) | 884 | if (hwif->dma_base == 0) |
886 | return; | 885 | return; |
887 | 886 | ||
888 | if (is_sata(hwif)) | 887 | if (sata) |
889 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; | 888 | hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA; |
890 | 889 | ||
891 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 890 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) |