aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/pdc202xx_old.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/pdc202xx_old.c')
-rw-r--r--drivers/ide/pci/pdc202xx_old.c54
1 files changed, 9 insertions, 45 deletions
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index a7a639fe1eaf..7146fe3f6ba7 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -46,7 +46,6 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48 48
49#define PDC202_DEBUG_CABLE 0
50#define PDC202XX_DEBUG_DRIVE_INFO 0 49#define PDC202XX_DEBUG_DRIVE_INFO 0
51 50
52static const char *pdc_quirk_drives[] = { 51static const char *pdc_quirk_drives[] = {
@@ -101,35 +100,12 @@ static const char *pdc_quirk_drives[] = {
101#define MC1 0x02 /* DMA"C" timing */ 100#define MC1 0x02 /* DMA"C" timing */
102#define MC0 0x01 /* DMA"C" timing */ 101#define MC0 0x01 /* DMA"C" timing */
103 102
104static u8 pdc202xx_ratemask (ide_drive_t *drive)
105{
106 u8 mode;
107
108 switch(HWIF(drive)->pci_dev->device) {
109 case PCI_DEVICE_ID_PROMISE_20267:
110 case PCI_DEVICE_ID_PROMISE_20265:
111 mode = 3;
112 break;
113 case PCI_DEVICE_ID_PROMISE_20263:
114 case PCI_DEVICE_ID_PROMISE_20262:
115 mode = 2;
116 break;
117 case PCI_DEVICE_ID_PROMISE_20246:
118 return 1;
119 default:
120 return 0;
121 }
122 if (!eighty_ninty_three(drive))
123 mode = min(mode, (u8)1);
124 return mode;
125}
126
127static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed) 103static int pdc202xx_tune_chipset (ide_drive_t *drive, u8 xferspeed)
128{ 104{
129 ide_hwif_t *hwif = HWIF(drive); 105 ide_hwif_t *hwif = HWIF(drive);
130 struct pci_dev *dev = hwif->pci_dev; 106 struct pci_dev *dev = hwif->pci_dev;
131 u8 drive_pci = 0x60 + (drive->dn << 2); 107 u8 drive_pci = 0x60 + (drive->dn << 2);
132 u8 speed = ide_rate_filter(pdc202xx_ratemask(drive), xferspeed); 108 u8 speed = ide_rate_filter(drive, xferspeed);
133 109
134 u32 drive_conf; 110 u32 drive_conf;
135 u8 AP, BP, CP, DP; 111 u8 AP, BP, CP, DP;
@@ -261,20 +237,7 @@ static int config_chipset_for_dma (ide_drive_t *drive)
261 u32 drive_conf = 0; 237 u32 drive_conf = 0;
262 u8 drive_pci = 0x60 + (drive->dn << 2); 238 u8 drive_pci = 0x60 + (drive->dn << 2);
263 u8 test1 = 0, test2 = 0, speed = -1; 239 u8 test1 = 0, test2 = 0, speed = -1;
264 u8 AP = 0, cable = 0; 240 u8 AP = 0;
265
266 u8 ultra_66 = ((id->dma_ultra & 0x0010) ||
267 (id->dma_ultra & 0x0008)) ? 1 : 0;
268
269 if (dev->device != PCI_DEVICE_ID_PROMISE_20246)
270 cable = pdc202xx_old_cable_detect(hwif);
271 else
272 ultra_66 = 0;
273
274 if (ultra_66 && cable) {
275 printk(KERN_WARNING "Warning: %s channel requires an 80-pin cable for operation.\n", hwif->channel ? "Secondary":"Primary");
276 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
277 }
278 241
279 if (dev->device != PCI_DEVICE_ID_PROMISE_20246) 242 if (dev->device != PCI_DEVICE_ID_PROMISE_20246)
280 pdc_old_disable_66MHz_clock(drive->hwif); 243 pdc_old_disable_66MHz_clock(drive->hwif);
@@ -308,7 +271,7 @@ chipset_is_set:
308 if (drive->media == ide_disk) /* PREFETCH_EN */ 271 if (drive->media == ide_disk) /* PREFETCH_EN */
309 pci_write_config_byte(dev, (drive_pci), AP|PREFETCH_EN); 272 pci_write_config_byte(dev, (drive_pci), AP|PREFETCH_EN);
310 273
311 speed = ide_dma_speed(drive, pdc202xx_ratemask(drive)); 274 speed = ide_max_dma_mode(drive);
312 275
313 if (!(speed)) { 276 if (!(speed)) {
314 /* restore original pci-config space */ 277 /* restore original pci-config space */
@@ -478,7 +441,7 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
478 441
479 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 442 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
480 443
481 hwif->ultra_mask = 0x3f; 444 hwif->ultra_mask = hwif->cds->udma_mask;
482 hwif->mwdma_mask = 0x07; 445 hwif->mwdma_mask = 0x07;
483 hwif->swdma_mask = 0x07; 446 hwif->swdma_mask = 0x07;
484 hwif->atapi_dma = 1; 447 hwif->atapi_dma = 1;
@@ -500,10 +463,6 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
500 if (!noautodma) 463 if (!noautodma)
501 hwif->autodma = 1; 464 hwif->autodma = 1;
502 hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma; 465 hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
503#if PDC202_DEBUG_CABLE
504 printk(KERN_DEBUG "%s: %s-pin cable\n",
505 hwif->name, hwif->udma_four ? "80" : "40");
506#endif /* PDC202_DEBUG_CABLE */
507} 466}
508 467
509static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase) 468static void __devinit init_dma_pdc202xx(ide_hwif_t *hwif, unsigned long dmabase)
@@ -587,6 +546,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
587 .autodma = AUTODMA, 546 .autodma = AUTODMA,
588 .bootable = OFF_BOARD, 547 .bootable = OFF_BOARD,
589 .extra = 16, 548 .extra = 16,
549 .udma_mask = 0x07, /* udma0-2 */
590 },{ /* 1 */ 550 },{ /* 1 */
591 .name = "PDC20262", 551 .name = "PDC20262",
592 .init_setup = init_setup_pdc202ata4, 552 .init_setup = init_setup_pdc202ata4,
@@ -597,6 +557,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
597 .autodma = AUTODMA, 557 .autodma = AUTODMA,
598 .bootable = OFF_BOARD, 558 .bootable = OFF_BOARD,
599 .extra = 48, 559 .extra = 48,
560 .udma_mask = 0x1f, /* udma0-4 */
600 },{ /* 2 */ 561 },{ /* 2 */
601 .name = "PDC20263", 562 .name = "PDC20263",
602 .init_setup = init_setup_pdc202ata4, 563 .init_setup = init_setup_pdc202ata4,
@@ -607,6 +568,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
607 .autodma = AUTODMA, 568 .autodma = AUTODMA,
608 .bootable = OFF_BOARD, 569 .bootable = OFF_BOARD,
609 .extra = 48, 570 .extra = 48,
571 .udma_mask = 0x1f, /* udma0-4 */
610 },{ /* 3 */ 572 },{ /* 3 */
611 .name = "PDC20265", 573 .name = "PDC20265",
612 .init_setup = init_setup_pdc20265, 574 .init_setup = init_setup_pdc20265,
@@ -617,6 +579,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
617 .autodma = AUTODMA, 579 .autodma = AUTODMA,
618 .bootable = OFF_BOARD, 580 .bootable = OFF_BOARD,
619 .extra = 48, 581 .extra = 48,
582 .udma_mask = 0x3f, /* udma0-5 */
620 },{ /* 4 */ 583 },{ /* 4 */
621 .name = "PDC20267", 584 .name = "PDC20267",
622 .init_setup = init_setup_pdc202xx, 585 .init_setup = init_setup_pdc202xx,
@@ -627,6 +590,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
627 .autodma = AUTODMA, 590 .autodma = AUTODMA,
628 .bootable = OFF_BOARD, 591 .bootable = OFF_BOARD,
629 .extra = 48, 592 .extra = 48,
593 .udma_mask = 0x3f, /* udma0-5 */
630 } 594 }
631}; 595};
632 596