aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ata_piix.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/ata_piix.c')
-rw-r--r--drivers/ata/ata_piix.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 9c07b88631be..6a3bfef58e13 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -200,6 +200,8 @@ static const struct pci_device_id piix_pci_tbl[] = {
200 /* ICH7/7-R (i945, i975) UDMA 100*/ 200 /* ICH7/7-R (i945, i975) UDMA 100*/
201 { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_133 }, 201 { 0x8086, 0x27DF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_133 },
202 { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 }, 202 { 0x8086, 0x269E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
203 /* ICH8 Mobile PATA Controller */
204 { 0x8086, 0x2850, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich_pata_100 },
203 205
204 /* NOTE: The following PCI ids must be kept in sync with the 206 /* NOTE: The following PCI ids must be kept in sync with the
205 * list in drivers/pci/quirks.c. 207 * list in drivers/pci/quirks.c.
@@ -495,7 +497,7 @@ static struct ata_port_info piix_port_info[] = {
495 .flags = PIIX_SATA_FLAGS, 497 .flags = PIIX_SATA_FLAGS,
496 .pio_mask = 0x1f, /* pio0-4 */ 498 .pio_mask = 0x1f, /* pio0-4 */
497 .mwdma_mask = 0x07, /* mwdma0-2 */ 499 .mwdma_mask = 0x07, /* mwdma0-2 */
498 .udma_mask = 0x7f, /* udma0-6 */ 500 .udma_mask = ATA_UDMA6,
499 .port_ops = &piix_sata_ops, 501 .port_ops = &piix_sata_ops,
500 }, 502 },
501 503
@@ -505,7 +507,7 @@ static struct ata_port_info piix_port_info[] = {
505 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR, 507 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR,
506 .pio_mask = 0x1f, /* pio0-4 */ 508 .pio_mask = 0x1f, /* pio0-4 */
507 .mwdma_mask = 0x07, /* mwdma0-2 */ 509 .mwdma_mask = 0x07, /* mwdma0-2 */
508 .udma_mask = 0x7f, /* udma0-6 */ 510 .udma_mask = ATA_UDMA6,
509 .port_ops = &piix_sata_ops, 511 .port_ops = &piix_sata_ops,
510 }, 512 },
511 513
@@ -516,7 +518,7 @@ static struct ata_port_info piix_port_info[] = {
516 PIIX_FLAG_AHCI, 518 PIIX_FLAG_AHCI,
517 .pio_mask = 0x1f, /* pio0-4 */ 519 .pio_mask = 0x1f, /* pio0-4 */
518 .mwdma_mask = 0x07, /* mwdma0-2 */ 520 .mwdma_mask = 0x07, /* mwdma0-2 */
519 .udma_mask = 0x7f, /* udma0-6 */ 521 .udma_mask = ATA_UDMA6,
520 .port_ops = &piix_sata_ops, 522 .port_ops = &piix_sata_ops,
521 }, 523 },
522 524
@@ -527,7 +529,7 @@ static struct ata_port_info piix_port_info[] = {
527 PIIX_FLAG_AHCI, 529 PIIX_FLAG_AHCI,
528 .pio_mask = 0x1f, /* pio0-4 */ 530 .pio_mask = 0x1f, /* pio0-4 */
529 .mwdma_mask = 0x07, /* mwdma0-2 */ 531 .mwdma_mask = 0x07, /* mwdma0-2 */
530 .udma_mask = 0x7f, /* udma0-6 */ 532 .udma_mask = ATA_UDMA6,
531 .port_ops = &piix_sata_ops, 533 .port_ops = &piix_sata_ops,
532 }, 534 },
533 535
@@ -538,7 +540,7 @@ static struct ata_port_info piix_port_info[] = {
538 PIIX_FLAG_AHCI, 540 PIIX_FLAG_AHCI,
539 .pio_mask = 0x1f, /* pio0-4 */ 541 .pio_mask = 0x1f, /* pio0-4 */
540 .mwdma_mask = 0x07, /* mwdma0-2 */ 542 .mwdma_mask = 0x07, /* mwdma0-2 */
541 .udma_mask = 0x7f, /* udma0-6 */ 543 .udma_mask = ATA_UDMA6,
542 .port_ops = &piix_sata_ops, 544 .port_ops = &piix_sata_ops,
543 }, 545 },
544 546
@@ -685,8 +687,14 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
685 if (adev->class == ATA_DEV_ATA) 687 if (adev->class == ATA_DEV_ATA)
686 control |= 4; /* PPE enable */ 688 control |= 4; /* PPE enable */
687 689
690 /* PIO configuration clears DTE unconditionally. It will be
691 * programmed in set_dmamode which is guaranteed to be called
692 * after set_piomode if any DMA mode is available.
693 */
688 pci_read_config_word(dev, master_port, &master_data); 694 pci_read_config_word(dev, master_port, &master_data);
689 if (is_slave) { 695 if (is_slave) {
696 /* clear TIME1|IE1|PPE1|DTE1 */
697 master_data &= 0xff0f;
690 /* Enable SITRE (seperate slave timing register) */ 698 /* Enable SITRE (seperate slave timing register) */
691 master_data |= 0x4000; 699 master_data |= 0x4000;
692 /* enable PPE1, IE1 and TIME1 as needed */ 700 /* enable PPE1, IE1 and TIME1 as needed */
@@ -694,12 +702,14 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev)
694 pci_read_config_byte(dev, slave_port, &slave_data); 702 pci_read_config_byte(dev, slave_port, &slave_data);
695 slave_data &= (ap->port_no ? 0x0f : 0xf0); 703 slave_data &= (ap->port_no ? 0x0f : 0xf0);
696 /* Load the timing nibble for this slave */ 704 /* Load the timing nibble for this slave */
697 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0); 705 slave_data |= ((timings[pio][0] << 2) | timings[pio][1])
706 << (ap->port_no ? 4 : 0);
698 } else { 707 } else {
699 /* Master keeps the bits in a different format */ 708 /* clear ISP|RCT|TIME0|IE0|PPE0|DTE0 */
700 master_data &= 0xccf8; 709 master_data &= 0xccf0;
701 /* Enable PPE, IE and TIME as appropriate */ 710 /* Enable PPE, IE and TIME as appropriate */
702 master_data |= control; 711 master_data |= control;
712 /* load ISP and RCT */
703 master_data |= 713 master_data |=
704 (timings[pio][0] << 12) | 714 (timings[pio][0] << 12) |
705 (timings[pio][1] << 8); 715 (timings[pio][1] << 8);
@@ -816,7 +826,7 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
816 master_data &= 0xFF4F; /* Mask out IORDY|TIME1|DMAONLY */ 826 master_data &= 0xFF4F; /* Mask out IORDY|TIME1|DMAONLY */
817 master_data |= control << 4; 827 master_data |= control << 4;
818 pci_read_config_byte(dev, 0x44, &slave_data); 828 pci_read_config_byte(dev, 0x44, &slave_data);
819 slave_data &= (0x0F + 0xE1 * ap->port_no); 829 slave_data &= (ap->port_no ? 0x0f : 0xf0);
820 /* Load the matching timing */ 830 /* Load the matching timing */
821 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0); 831 slave_data |= ((timings[pio][0] << 2) | timings[pio][1]) << (ap->port_no ? 4 : 0);
822 pci_write_config_byte(dev, 0x44, slave_data); 832 pci_write_config_byte(dev, 0x44, slave_data);
@@ -828,8 +838,11 @@ static void do_pata_set_dmamode (struct ata_port *ap, struct ata_device *adev, i
828 (timings[pio][0] << 12) | 838 (timings[pio][0] << 12) |
829 (timings[pio][1] << 8); 839 (timings[pio][1] << 8);
830 } 840 }
831 udma_enable &= ~(1 << devid); 841
832 pci_write_config_word(dev, master_port, master_data); 842 if (ap->udma_mask) {
843 udma_enable &= ~(1 << devid);
844 pci_write_config_word(dev, master_port, master_data);
845 }
833 } 846 }
834 /* Don't scribble on 0x48 if the controller does not support UDMA */ 847 /* Don't scribble on 0x48 if the controller does not support UDMA */
835 if (ap->udma_mask) 848 if (ap->udma_mask)