aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-09 18:01:07 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-05-09 18:01:07 -0400
commit18137207236285989dfc0ee7f929b954199228f3 (patch)
treed55f1287ae64318190e18cb7a64ca514c76c3414 /drivers/ide
parentde372ecd80a42c4fb485c7232475301a18d05184 (diff)
ide: fix UDMA/MWDMA/SWDMA masks (v3)
* use 0x00 instead of 0x80 to disable ->{ultra,mwdma,swdma}_mask * add udma_mask field to ide_pci_device_t and use it to initialize ->ultra_mask in aec62xx, cmd64x, pdc202xx_{new,old} and piix drivers * fix UDMA masks to match with chipset specific *_ratemask() (alim15x3, hpt366, serverworks and siimage drivers need UDMA mask filtering method - done in the next patch) v2: * piix: fix cable detection for 82801AA_1 and 82372FB_1 [ Noticed by Sergei Shtylyov <sshtylyov@ru.mvista.com>. ] * cmd64x: use hwif->cds->udma_mask [ Suggested by Sergei Shtylyov <sshtylyov@ru.mvista.com>. ] * aec62xx: fix newly introduced bug - check DMA status not command register [ Noticed by Sergei Shtylyov <sshtylyov@ru.mvista.com>. ] v3: * piix: use hwif->cds->udma_mask [ Suggested by Sergei Shtylyov <sshtylyov@ru.mvista.com>. ] Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide.c3
-rw-r--r--drivers/ide/pci/aec62xx.c19
-rw-r--r--drivers/ide/pci/alim15x3.c13
-rw-r--r--drivers/ide/pci/cmd64x.c17
-rw-r--r--drivers/ide/pci/pdc202xx_new.c10
-rw-r--r--drivers/ide/pci/pdc202xx_old.c7
-rw-r--r--drivers/ide/pci/piix.c73
-rw-r--r--drivers/ide/pci/sis5513.c5
8 files changed, 87 insertions, 60 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index ae5bf2be6f52..c06424fe647b 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -216,9 +216,6 @@ static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
216 hwif->bus_state = BUSSTATE_ON; 216 hwif->bus_state = BUSSTATE_ON;
217 217
218 hwif->atapi_dma = 0; /* disable all atapi dma */ 218 hwif->atapi_dma = 0; /* disable all atapi dma */
219 hwif->ultra_mask = 0x80; /* disable all ultra */
220 hwif->mwdma_mask = 0x80; /* disable all mwdma */
221 hwif->swdma_mask = 0x80; /* disable all swdma */
222 219
223 init_completion(&hwif->gendev_rel_comp); 220 init_completion(&hwif->gendev_rel_comp);
224 221
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
index 73bdf64dbbfc..abe0b1bb55ff 100644
--- a/drivers/ide/pci/aec62xx.c
+++ b/drivers/ide/pci/aec62xx.c
@@ -261,11 +261,13 @@ static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const ch
261 261
262static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif) 262static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
263{ 263{
264 struct pci_dev *dev = hwif->pci_dev;
265
264 hwif->autodma = 0; 266 hwif->autodma = 0;
265 hwif->tuneproc = &aec62xx_tune_drive; 267 hwif->tuneproc = &aec62xx_tune_drive;
266 hwif->speedproc = &aec62xx_tune_chipset; 268 hwif->speedproc = &aec62xx_tune_chipset;
267 269
268 if (hwif->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) 270 if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF)
269 hwif->serialized = hwif->channel; 271 hwif->serialized = hwif->channel;
270 272
271 if (hwif->mate) 273 if (hwif->mate)
@@ -277,7 +279,15 @@ static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
277 return; 279 return;
278 } 280 }
279 281
280 hwif->ultra_mask = 0x7f; 282 hwif->ultra_mask = hwif->cds->udma_mask;
283
284 /* atp865 and atp865r */
285 if (hwif->ultra_mask == 0x3f) {
286 /* check bit 0x10 of DMA status register */
287 if (inb(pci_resource_start(dev, 4) + 2) & 0x10)
288 hwif->ultra_mask = 0x7f; /* udma0-6 */
289 }
290
281 hwif->mwdma_mask = 0x07; 291 hwif->mwdma_mask = 0x07;
282 292
283 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate; 293 hwif->ide_dma_check = &aec62xx_config_drive_xfer_rate;
@@ -344,6 +354,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
344 .autodma = AUTODMA, 354 .autodma = AUTODMA,
345 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 355 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
346 .bootable = OFF_BOARD, 356 .bootable = OFF_BOARD,
357 .udma_mask = 0x07, /* udma0-2 */
347 },{ /* 1 */ 358 },{ /* 1 */
348 .name = "AEC6260", 359 .name = "AEC6260",
349 .init_setup = init_setup_aec62xx, 360 .init_setup = init_setup_aec62xx,
@@ -353,6 +364,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
353 .channels = 2, 364 .channels = 2,
354 .autodma = NOAUTODMA, 365 .autodma = NOAUTODMA,
355 .bootable = OFF_BOARD, 366 .bootable = OFF_BOARD,
367 .udma_mask = 0x1f, /* udma0-4 */
356 },{ /* 2 */ 368 },{ /* 2 */
357 .name = "AEC6260R", 369 .name = "AEC6260R",
358 .init_setup = init_setup_aec62xx, 370 .init_setup = init_setup_aec62xx,
@@ -363,6 +375,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
363 .autodma = AUTODMA, 375 .autodma = AUTODMA,
364 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 376 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
365 .bootable = NEVER_BOARD, 377 .bootable = NEVER_BOARD,
378 .udma_mask = 0x1f, /* udma0-4 */
366 },{ /* 3 */ 379 },{ /* 3 */
367 .name = "AEC6X80", 380 .name = "AEC6X80",
368 .init_setup = init_setup_aec6x80, 381 .init_setup = init_setup_aec6x80,
@@ -372,6 +385,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
372 .channels = 2, 385 .channels = 2,
373 .autodma = AUTODMA, 386 .autodma = AUTODMA,
374 .bootable = OFF_BOARD, 387 .bootable = OFF_BOARD,
388 .udma_mask = 0x3f, /* udma0-5 */
375 },{ /* 4 */ 389 },{ /* 4 */
376 .name = "AEC6X80R", 390 .name = "AEC6X80R",
377 .init_setup = init_setup_aec6x80, 391 .init_setup = init_setup_aec6x80,
@@ -382,6 +396,7 @@ static ide_pci_device_t aec62xx_chipsets[] __devinitdata = {
382 .autodma = AUTODMA, 396 .autodma = AUTODMA,
383 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 397 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
384 .bootable = OFF_BOARD, 398 .bootable = OFF_BOARD,
399 .udma_mask = 0x3f, /* udma0-5 */
385 } 400 }
386}; 401};
387 402
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 946a12746cb5..26c27d946c67 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -783,8 +783,17 @@ static void __devinit init_hwif_common_ali15x3 (ide_hwif_t *hwif)
783 783
784 hwif->atapi_dma = 1; 784 hwif->atapi_dma = 1;
785 785
786 if (m5229_revision > 0x20) 786 if (m5229_revision <= 0x20)
787 hwif->ultra_mask = 0x7f; 787 hwif->ultra_mask = 0x00; /* no udma */
788 else if (m5229_revision < 0xC2)
789 hwif->ultra_mask = 0x07; /* udma0-2 */
790 else if (m5229_revision == 0xC2 || m5229_revision == 0xC3)
791 hwif->ultra_mask = 0x1f; /* udma0-4 */
792 else if (m5229_revision == 0xC4)
793 hwif->ultra_mask = 0x3f; /* udma0-5 */
794 else
795 hwif->ultra_mask = 0x7f; /* udma0-6 */
796
788 hwif->mwdma_mask = 0x07; 797 hwif->mwdma_mask = 0x07;
789 hwif->swdma_mask = 0x07; 798 hwif->swdma_mask = 0x07;
790 799
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 77f51ab6d439..610c45f7b4e2 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -644,15 +644,12 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
644 644
645 hwif->atapi_dma = 1; 645 hwif->atapi_dma = 1;
646 646
647 hwif->ultra_mask = 0x3f; 647 hwif->ultra_mask = hwif->cds->udma_mask;
648 hwif->mwdma_mask = 0x07; 648
649 if (dev->device == PCI_DEVICE_ID_CMD_646 && class_rev < 5)
650 hwif->ultra_mask = 0x00;
649 651
650 if (dev->device == PCI_DEVICE_ID_CMD_643) 652 hwif->mwdma_mask = 0x07;
651 hwif->ultra_mask = 0x80;
652 if (dev->device == PCI_DEVICE_ID_CMD_646)
653 hwif->ultra_mask = (class_rev > 0x04) ? 0x07 : 0x80;
654 if (dev->device == PCI_DEVICE_ID_CMD_648)
655 hwif->ultra_mask = 0x1f;
656 653
657 hwif->ide_dma_check = &cmd64x_config_drive_for_dma; 654 hwif->ide_dma_check = &cmd64x_config_drive_for_dma;
658 if (!(hwif->udma_four)) 655 if (!(hwif->udma_four))
@@ -716,6 +713,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
716 .autodma = AUTODMA, 713 .autodma = AUTODMA,
717 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 714 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
718 .bootable = ON_BOARD, 715 .bootable = ON_BOARD,
716 .udma_mask = 0x00, /* no udma */
719 },{ /* 1 */ 717 },{ /* 1 */
720 .name = "CMD646", 718 .name = "CMD646",
721 .init_setup = init_setup_cmd646, 719 .init_setup = init_setup_cmd646,
@@ -725,6 +723,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
725 .autodma = AUTODMA, 723 .autodma = AUTODMA,
726 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 724 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
727 .bootable = ON_BOARD, 725 .bootable = ON_BOARD,
726 .udma_mask = 0x07, /* udma0-2 */
728 },{ /* 2 */ 727 },{ /* 2 */
729 .name = "CMD648", 728 .name = "CMD648",
730 .init_setup = init_setup_cmd64x, 729 .init_setup = init_setup_cmd64x,
@@ -734,6 +733,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
734 .autodma = AUTODMA, 733 .autodma = AUTODMA,
735 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 734 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
736 .bootable = ON_BOARD, 735 .bootable = ON_BOARD,
736 .udma_mask = 0x1f, /* udma0-4 */
737 },{ /* 3 */ 737 },{ /* 3 */
738 .name = "CMD649", 738 .name = "CMD649",
739 .init_setup = init_setup_cmd64x, 739 .init_setup = init_setup_cmd64x,
@@ -743,6 +743,7 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
743 .autodma = AUTODMA, 743 .autodma = AUTODMA,
744 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 744 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
745 .bootable = ON_BOARD, 745 .bootable = ON_BOARD,
746 .udma_mask = 0x3f, /* udma0-5 */
746 } 747 }
747}; 748};
748 749
diff --git a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
index 2cdd629c653d..a23853445af9 100644
--- a/drivers/ide/pci/pdc202xx_new.c
+++ b/drivers/ide/pci/pdc202xx_new.c
@@ -543,7 +543,8 @@ static void __devinit init_hwif_pdc202new(ide_hwif_t *hwif)
543 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 543 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
544 544
545 hwif->atapi_dma = 1; 545 hwif->atapi_dma = 1;
546 hwif->ultra_mask = 0x7f; 546
547 hwif->ultra_mask = hwif->cds->udma_mask;
547 hwif->mwdma_mask = 0x07; 548 hwif->mwdma_mask = 0x07;
548 549
549 hwif->err_stops_fifo = 1; 550 hwif->err_stops_fifo = 1;
@@ -619,6 +620,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
619 .channels = 2, 620 .channels = 2,
620 .autodma = AUTODMA, 621 .autodma = AUTODMA,
621 .bootable = OFF_BOARD, 622 .bootable = OFF_BOARD,
623 .udma_mask = 0x3f, /* udma0-5 */
622 },{ /* 1 */ 624 },{ /* 1 */
623 .name = "PDC20269", 625 .name = "PDC20269",
624 .init_setup = init_setup_pdcnew, 626 .init_setup = init_setup_pdcnew,
@@ -627,6 +629,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
627 .channels = 2, 629 .channels = 2,
628 .autodma = AUTODMA, 630 .autodma = AUTODMA,
629 .bootable = OFF_BOARD, 631 .bootable = OFF_BOARD,
632 .udma_mask = 0x7f, /* udma0-6*/
630 },{ /* 2 */ 633 },{ /* 2 */
631 .name = "PDC20270", 634 .name = "PDC20270",
632 .init_setup = init_setup_pdc20270, 635 .init_setup = init_setup_pdc20270,
@@ -635,6 +638,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
635 .channels = 2, 638 .channels = 2,
636 .autodma = AUTODMA, 639 .autodma = AUTODMA,
637 .bootable = OFF_BOARD, 640 .bootable = OFF_BOARD,
641 .udma_mask = 0x3f, /* udma0-5 */
638 },{ /* 3 */ 642 },{ /* 3 */
639 .name = "PDC20271", 643 .name = "PDC20271",
640 .init_setup = init_setup_pdcnew, 644 .init_setup = init_setup_pdcnew,
@@ -643,6 +647,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
643 .channels = 2, 647 .channels = 2,
644 .autodma = AUTODMA, 648 .autodma = AUTODMA,
645 .bootable = OFF_BOARD, 649 .bootable = OFF_BOARD,
650 .udma_mask = 0x7f, /* udma0-6*/
646 },{ /* 4 */ 651 },{ /* 4 */
647 .name = "PDC20275", 652 .name = "PDC20275",
648 .init_setup = init_setup_pdcnew, 653 .init_setup = init_setup_pdcnew,
@@ -651,6 +656,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
651 .channels = 2, 656 .channels = 2,
652 .autodma = AUTODMA, 657 .autodma = AUTODMA,
653 .bootable = OFF_BOARD, 658 .bootable = OFF_BOARD,
659 .udma_mask = 0x7f, /* udma0-6*/
654 },{ /* 5 */ 660 },{ /* 5 */
655 .name = "PDC20276", 661 .name = "PDC20276",
656 .init_setup = init_setup_pdc20276, 662 .init_setup = init_setup_pdc20276,
@@ -659,6 +665,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
659 .channels = 2, 665 .channels = 2,
660 .autodma = AUTODMA, 666 .autodma = AUTODMA,
661 .bootable = OFF_BOARD, 667 .bootable = OFF_BOARD,
668 .udma_mask = 0x7f, /* udma0-6*/
662 },{ /* 6 */ 669 },{ /* 6 */
663 .name = "PDC20277", 670 .name = "PDC20277",
664 .init_setup = init_setup_pdcnew, 671 .init_setup = init_setup_pdcnew,
@@ -667,6 +674,7 @@ static ide_pci_device_t pdcnew_chipsets[] __devinitdata = {
667 .channels = 2, 674 .channels = 2,
668 .autodma = AUTODMA, 675 .autodma = AUTODMA,
669 .bootable = OFF_BOARD, 676 .bootable = OFF_BOARD,
677 .udma_mask = 0x7f, /* udma0-6*/
670 } 678 }
671}; 679};
672 680
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index a7a639fe1eaf..d7a38067fb34 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -478,7 +478,7 @@ static void __devinit init_hwif_pdc202xx(ide_hwif_t *hwif)
478 478
479 hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 479 hwif->drives[0].autotune = hwif->drives[1].autotune = 1;
480 480
481 hwif->ultra_mask = 0x3f; 481 hwif->ultra_mask = hwif->cds->udma_mask;
482 hwif->mwdma_mask = 0x07; 482 hwif->mwdma_mask = 0x07;
483 hwif->swdma_mask = 0x07; 483 hwif->swdma_mask = 0x07;
484 hwif->atapi_dma = 1; 484 hwif->atapi_dma = 1;
@@ -587,6 +587,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
587 .autodma = AUTODMA, 587 .autodma = AUTODMA,
588 .bootable = OFF_BOARD, 588 .bootable = OFF_BOARD,
589 .extra = 16, 589 .extra = 16,
590 .udma_mask = 0x07, /* udma0-2 */
590 },{ /* 1 */ 591 },{ /* 1 */
591 .name = "PDC20262", 592 .name = "PDC20262",
592 .init_setup = init_setup_pdc202ata4, 593 .init_setup = init_setup_pdc202ata4,
@@ -597,6 +598,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
597 .autodma = AUTODMA, 598 .autodma = AUTODMA,
598 .bootable = OFF_BOARD, 599 .bootable = OFF_BOARD,
599 .extra = 48, 600 .extra = 48,
601 .udma_mask = 0x1f, /* udma0-4 */
600 },{ /* 2 */ 602 },{ /* 2 */
601 .name = "PDC20263", 603 .name = "PDC20263",
602 .init_setup = init_setup_pdc202ata4, 604 .init_setup = init_setup_pdc202ata4,
@@ -607,6 +609,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
607 .autodma = AUTODMA, 609 .autodma = AUTODMA,
608 .bootable = OFF_BOARD, 610 .bootable = OFF_BOARD,
609 .extra = 48, 611 .extra = 48,
612 .udma_mask = 0x1f, /* udma0-4 */
610 },{ /* 3 */ 613 },{ /* 3 */
611 .name = "PDC20265", 614 .name = "PDC20265",
612 .init_setup = init_setup_pdc20265, 615 .init_setup = init_setup_pdc20265,
@@ -617,6 +620,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
617 .autodma = AUTODMA, 620 .autodma = AUTODMA,
618 .bootable = OFF_BOARD, 621 .bootable = OFF_BOARD,
619 .extra = 48, 622 .extra = 48,
623 .udma_mask = 0x3f, /* udma0-5 */
620 },{ /* 4 */ 624 },{ /* 4 */
621 .name = "PDC20267", 625 .name = "PDC20267",
622 .init_setup = init_setup_pdc202xx, 626 .init_setup = init_setup_pdc202xx,
@@ -627,6 +631,7 @@ static ide_pci_device_t pdc202xx_chipsets[] __devinitdata = {
627 .autodma = AUTODMA, 631 .autodma = AUTODMA,
628 .bootable = OFF_BOARD, 632 .bootable = OFF_BOARD,
629 .extra = 48, 633 .extra = 48,
634 .udma_mask = 0x3f, /* udma0-5 */
630 } 635 }
631}; 636};
632 637
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 061d300ab8be..17ea44edb4eb 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -524,26 +524,14 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
524 hwif->ide_dma_clear_irq = &piix_dma_clear_irq; 524 hwif->ide_dma_clear_irq = &piix_dma_clear_irq;
525 525
526 hwif->atapi_dma = 1; 526 hwif->atapi_dma = 1;
527 hwif->ultra_mask = 0x3f; 527
528 hwif->ultra_mask = hwif->cds->udma_mask;
528 hwif->mwdma_mask = 0x06; 529 hwif->mwdma_mask = 0x06;
529 hwif->swdma_mask = 0x04; 530 hwif->swdma_mask = 0x04;
530 531
531 switch(hwif->pci_dev->device) { 532 if (hwif->ultra_mask & 0x78) {
532 case PCI_DEVICE_ID_INTEL_82371FB_0: 533 if (!hwif->udma_four)
533 case PCI_DEVICE_ID_INTEL_82371FB_1: 534 hwif->udma_four = piix_cable_detect(hwif);
534 case PCI_DEVICE_ID_INTEL_82371SB_1:
535 hwif->ultra_mask = 0x80;
536 break;
537 case PCI_DEVICE_ID_INTEL_82371AB:
538 case PCI_DEVICE_ID_INTEL_82443MX_1:
539 case PCI_DEVICE_ID_INTEL_82451NX:
540 case PCI_DEVICE_ID_INTEL_82801AB_1:
541 hwif->ultra_mask = 0x07;
542 break;
543 default:
544 if (!hwif->udma_four)
545 hwif->udma_four = piix_cable_detect(hwif);
546 break;
547 } 535 }
548 536
549 if (no_piix_dma) 537 if (no_piix_dma)
@@ -557,7 +545,7 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
557 hwif->drives[0].autodma = hwif->autodma; 545 hwif->drives[0].autodma = hwif->autodma;
558} 546}
559 547
560#define DECLARE_PIIX_DEV(name_str) \ 548#define DECLARE_PIIX_DEV(name_str, udma) \
561 { \ 549 { \
562 .name = name_str, \ 550 .name = name_str, \
563 .init_chipset = init_chipset_piix, \ 551 .init_chipset = init_chipset_piix, \
@@ -566,11 +554,12 @@ static void __devinit init_hwif_piix(ide_hwif_t *hwif)
566 .autodma = AUTODMA, \ 554 .autodma = AUTODMA, \
567 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 555 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \
568 .bootable = ON_BOARD, \ 556 .bootable = ON_BOARD, \
557 .udma_mask = udma, \
569 } 558 }
570 559
571static ide_pci_device_t piix_pci_info[] __devinitdata = { 560static ide_pci_device_t piix_pci_info[] __devinitdata = {
572 /* 0 */ DECLARE_PIIX_DEV("PIIXa"), 561 /* 0 */ DECLARE_PIIX_DEV("PIIXa", 0x00), /* no udma */
573 /* 1 */ DECLARE_PIIX_DEV("PIIXb"), 562 /* 1 */ DECLARE_PIIX_DEV("PIIXb", 0x00), /* no udma */
574 563
575 /* 2 */ 564 /* 2 */
576 { /* 565 { /*
@@ -587,28 +576,28 @@ static ide_pci_device_t piix_pci_info[] __devinitdata = {
587 .flags = IDEPCI_FLAG_ISA_PORTS 576 .flags = IDEPCI_FLAG_ISA_PORTS
588 }, 577 },
589 578
590 /* 3 */ DECLARE_PIIX_DEV("PIIX3"), 579 /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */
591 /* 4 */ DECLARE_PIIX_DEV("PIIX4"), 580 /* 4 */ DECLARE_PIIX_DEV("PIIX4", 0x07), /* udma0-2 */
592 /* 5 */ DECLARE_PIIX_DEV("ICH0"), 581 /* 5 */ DECLARE_PIIX_DEV("ICH0", 0x07), /* udma0-2 */
593 /* 6 */ DECLARE_PIIX_DEV("PIIX4"), 582 /* 6 */ DECLARE_PIIX_DEV("PIIX4", 0x07), /* udma0-2 */
594 /* 7 */ DECLARE_PIIX_DEV("ICH"), 583 /* 7 */ DECLARE_PIIX_DEV("ICH", 0x1f), /* udma0-4 */
595 /* 8 */ DECLARE_PIIX_DEV("PIIX4"), 584 /* 8 */ DECLARE_PIIX_DEV("PIIX4", 0x1f), /* udma0-4 */
596 /* 9 */ DECLARE_PIIX_DEV("PIIX4"), 585 /* 9 */ DECLARE_PIIX_DEV("PIIX4", 0x07), /* udma0-2 */
597 /* 10 */ DECLARE_PIIX_DEV("ICH2"), 586 /* 10 */ DECLARE_PIIX_DEV("ICH2", 0x3f), /* udma0-5 */
598 /* 11 */ DECLARE_PIIX_DEV("ICH2M"), 587 /* 11 */ DECLARE_PIIX_DEV("ICH2M", 0x3f), /* udma0-5 */
599 /* 12 */ DECLARE_PIIX_DEV("ICH3M"), 588 /* 12 */ DECLARE_PIIX_DEV("ICH3M", 0x3f), /* udma0-5 */
600 /* 13 */ DECLARE_PIIX_DEV("ICH3"), 589 /* 13 */ DECLARE_PIIX_DEV("ICH3", 0x3f), /* udma0-5 */
601 /* 14 */ DECLARE_PIIX_DEV("ICH4"), 590 /* 14 */ DECLARE_PIIX_DEV("ICH4", 0x3f), /* udma0-5 */
602 /* 15 */ DECLARE_PIIX_DEV("ICH5"), 591 /* 15 */ DECLARE_PIIX_DEV("ICH5", 0x3f), /* udma0-5 */
603 /* 16 */ DECLARE_PIIX_DEV("C-ICH"), 592 /* 16 */ DECLARE_PIIX_DEV("C-ICH", 0x3f), /* udma0-5 */
604 /* 17 */ DECLARE_PIIX_DEV("ICH4"), 593 /* 17 */ DECLARE_PIIX_DEV("ICH4", 0x3f), /* udma0-5 */
605 /* 18 */ DECLARE_PIIX_DEV("ICH5-SATA"), 594 /* 18 */ DECLARE_PIIX_DEV("ICH5-SATA", 0x3f), /* udma0-5 */
606 /* 19 */ DECLARE_PIIX_DEV("ICH5"), 595 /* 19 */ DECLARE_PIIX_DEV("ICH5", 0x3f), /* udma0-5 */
607 /* 20 */ DECLARE_PIIX_DEV("ICH6"), 596 /* 20 */ DECLARE_PIIX_DEV("ICH6", 0x3f), /* udma0-5 */
608 /* 21 */ DECLARE_PIIX_DEV("ICH7"), 597 /* 21 */ DECLARE_PIIX_DEV("ICH7", 0x3f), /* udma0-5 */
609 /* 22 */ DECLARE_PIIX_DEV("ICH4"), 598 /* 22 */ DECLARE_PIIX_DEV("ICH4", 0x3f), /* udma0-5 */
610 /* 23 */ DECLARE_PIIX_DEV("ESB2"), 599 /* 23 */ DECLARE_PIIX_DEV("ESB2", 0x3f), /* udma0-5 */
611 /* 24 */ DECLARE_PIIX_DEV("ICH8M"), 600 /* 24 */ DECLARE_PIIX_DEV("ICH8M", 0x3f), /* udma0-5 */
612}; 601};
613 602
614/** 603/**
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 2ba0669f36a1..6fe4ecb6c06c 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -858,6 +858,8 @@ static unsigned int __devinit ata66_sis5513 (ide_hwif_t *hwif)
858 858
859static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif) 859static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
860{ 860{
861 u8 udma_rates[] = { 0x00, 0x00, 0x07, 0x1f, 0x3f, 0x3f, 0x7f, 0x7f };
862
861 hwif->autodma = 0; 863 hwif->autodma = 0;
862 864
863 if (!hwif->irq) 865 if (!hwif->irq)
@@ -873,7 +875,8 @@ static void __devinit init_hwif_sis5513 (ide_hwif_t *hwif)
873 } 875 }
874 876
875 hwif->atapi_dma = 1; 877 hwif->atapi_dma = 1;
876 hwif->ultra_mask = 0x7f; 878
879 hwif->ultra_mask = udma_rates[chipset_family];
877 hwif->mwdma_mask = 0x07; 880 hwif->mwdma_mask = 0x07;
878 hwif->swdma_mask = 0x07; 881 hwif->swdma_mask = 0x07;
879 882