aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/pdc202xx_new.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/pdc202xx_new.c')
-rw-r--r--drivers/ide/pci/pdc202xx_new.c40
1 files changed, 11 insertions, 29 deletions
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 2cdd629c653d..65b1e124edf7 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -37,8 +37,6 @@
37#include <asm/pci-bridge.h> 37#include <asm/pci-bridge.h>
38#endif 38#endif
39 39
40#define PDC202_DEBUG_CABLE 0
41
42#undef DEBUG 40#undef DEBUG
43 41
44#ifdef DEBUG 42#ifdef DEBUG
@@ -82,16 +80,6 @@ static u8 max_dma_rate(struct pci_dev *pdev)
82 return mode; 80 return mode;
83} 81}
84 82
85static u8 pdcnew_ratemask(ide_drive_t *drive)
86{
87 u8 mode = max_dma_rate(HWIF(drive)->pci_dev);
88
89 if (!eighty_ninty_three(drive))
90 mode = min_t(u8, mode, 1);
91
92 return mode;
93}
94
95/** 83/**
96 * get_indexed_reg - Get indexed register 84 * get_indexed_reg - Get indexed register
97 * @hwif: for the port address 85 * @hwif: for the port address
@@ -164,7 +152,7 @@ static int pdcnew_tune_chipset(ide_drive_t *drive, u8 speed)
164 u8 adj = (drive->dn & 1) ? 0x08 : 0x00; 152 u8 adj = (drive->dn & 1) ? 0x08 : 0x00;
165 int err; 153 int err;
166 154
167 speed = ide_rate_filter(pdcnew_ratemask(drive), speed); 155 speed = ide_rate_filter(drive, speed);
168 156
169 /* 157 /*
170 * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will 158 * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will
@@ -244,17 +232,8 @@ static int config_chipset_for_dma(ide_drive_t *drive)
244{ 232{
245 struct hd_driveid *id = drive->id; 233 struct hd_driveid *id = drive->id;
246 ide_hwif_t *hwif = HWIF(drive); 234 ide_hwif_t *hwif = HWIF(drive);
247 u8 ultra_66 = (id->dma_ultra & 0x0078) ? 1 : 0;
248 u8 cable = pdcnew_cable_detect(hwif);
249 u8 speed; 235 u8 speed;
250 236
251 if (ultra_66 && cable) {
252 printk(KERN_WARNING "Warning: %s channel "
253 "requires an 80-pin cable for operation.\n",
254 hwif->channel ? "Secondary" : "Primary");
255 printk(KERN_WARNING "%s reduced to Ultra33 mode.\n", drive->name);
256 }
257
258 if (id->capability & 4) { 237 if (id->capability & 4) {
259 /* 238 /*
260 * Set IORDY_EN & PREFETCH_EN (this seems to have 239 * Set IORDY_EN & PREFETCH_EN (this seems to have
@@ -267,7 +246,7 @@ static int config_chipset_for_dma(ide_drive_t *drive)
267 set_indexed_reg(hwif, 0x13 + adj, tmp | 0x03); 246 set_indexed_reg(hwif, 0x13 + adj, tmp | 0x03);
268 } 247 }
269 248
270 speed = ide_dma_speed(drive, pdcnew_ratemask(drive)); 249 speed = ide_max_dma_mode(drive);
271 250
272 if (!speed) 251 if (!speed)
273 return 0; 252 return 0;
@@ -543,7 +522,8 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
543 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 522 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
544 523
545 hwif->atapi_dma = 1; 524 hwif->atapi_dma = 1;
546 hwif->ultra_mask = 0x7f; 525
526 hwif->ultra_mask = hwif->cds->udma_mask;
547 hwif->mwdma_mask = 0x07; 527 hwif->mwdma_mask = 0x07;
548 528
549 hwif->err_stops_fifo = 1; 529 hwif->err_stops_fifo = 1;
@@ -556,11 +536,6 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
556 if (!noautodma) 536 if (!noautodma)
557 hwif->autodma = 1; 537 hwif->autodma = 1;
558 hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma; 538 hwif->drives[0].autodma = hwif->drives[1].autodma = hwif->autodma;
559
560#if PDC202_DEBUG_CABLE
561 printk(KERN_DEBUG "%s: %s-pin cable\n",
562 hwif->name, hwif->udma_four ? "80" : "40");
563#endif /* PDC202_DEBUG_CABLE */
564} 539}
565 540
566static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d) 541static int __devinit init_setup_pdcnew(struct pci_dev *dev, ide_pci_device_t *d)
@@ -619,6 +594,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
619 .channels = 2, 594 .channels = 2,
620 .autodma = AUTODMA, 595 .autodma = AUTODMA,
621 .bootable = OFF_BOARD, 596 .bootable = OFF_BOARD,
597 .udma_mask = 0x3f, /* udma0-5 */
622 },{ /* 1 */ 598 },{ /* 1 */
623 .name = "PDC20269", 599 .name = "PDC20269",
624 .init_setup = init_setup_pdcnew, 600 .init_setup = init_setup_pdcnew,
@@ -627,6 +603,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
627 .channels = 2, 603 .channels = 2,
628 .autodma = AUTODMA, 604 .autodma = AUTODMA,
629 .bootable = OFF_BOARD, 605 .bootable = OFF_BOARD,
606 .udma_mask = 0x7f, /* udma0-6*/
630 },{ /* 2 */ 607 },{ /* 2 */
631 .name = "PDC20270", 608 .name = "PDC20270",
632 .init_setup = init_setup_pdc20270, 609 .init_setup = init_setup_pdc20270,
@@ -635,6 +612,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
635 .channels = 2, 612 .channels = 2,
636 .autodma = AUTODMA, 613 .autodma = AUTODMA,
637 .bootable = OFF_BOARD, 614 .bootable = OFF_BOARD,
615 .udma_mask = 0x3f, /* udma0-5 */
638 },{ /* 3 */ 616 },{ /* 3 */
639 .name = "PDC20271", 617 .name = "PDC20271",
640 .init_setup = init_setup_pdcnew, 618 .init_setup = init_setup_pdcnew,
@@ -643,6 +621,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
643 .channels = 2, 621 .channels = 2,
644 .autodma = AUTODMA, 622 .autodma = AUTODMA,
645 .bootable = OFF_BOARD, 623 .bootable = OFF_BOARD,
624 .udma_mask = 0x7f, /* udma0-6*/
646 },{ /* 4 */ 625 },{ /* 4 */
647 .name = "PDC20275", 626 .name = "PDC20275",
648 .init_setup = init_setup_pdcnew, 627 .init_setup = init_setup_pdcnew,
@@ -651,6 +630,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
651 .channels = 2, 630 .channels = 2,
652 .autodma = AUTODMA, 631 .autodma = AUTODMA,
653 .bootable = OFF_BOARD, 632 .bootable = OFF_BOARD,
633 .udma_mask = 0x7f, /* udma0-6*/
654 },{ /* 5 */ 634 },{ /* 5 */
655 .name = "PDC20276", 635 .name = "PDC20276",
656 .init_setup = init_setup_pdc20276, 636 .init_setup = init_setup_pdc20276,
@@ -659,6 +639,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
659 .channels = 2, 639 .channels = 2,
660 .autodma = AUTODMA, 640 .autodma = AUTODMA,
661 .bootable = OFF_BOARD, 641 .bootable = OFF_BOARD,
642 .udma_mask = 0x7f, /* udma0-6*/
662 },{ /* 6 */ 643 },{ /* 6 */
663 .name = "PDC20277", 644 .name = "PDC20277",
664 .init_setup = init_setup_pdcnew, 645 .init_setup = init_setup_pdcnew,
@@ -667,6 +648,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
667 .channels = 2, 648 .channels = 2,
668 .autodma = AUTODMA, 649 .autodma = AUTODMA,
669 .bootable = OFF_BOARD, 650 .bootable = OFF_BOARD,
651 .udma_mask = 0x7f, /* udma0-6*/
670 } 652 }
671}; 653};
672 654