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.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index eafb984313f6..e6bf4fd51794 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -100,13 +100,11 @@ enum {
100 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ 100 PIIX_IOCFG = 0x54, /* IDE I/O configuration register */
101 ICH5_PMR = 0x90, /* port mapping register */ 101 ICH5_PMR = 0x90, /* port mapping register */
102 ICH5_PCS = 0x92, /* port control and status */ 102 ICH5_PCS = 0x92, /* port control and status */
103 PIIX_SCC = 0x0A, /* sub-class code register */
104 PIIX_SIDPR_BAR = 5, 103 PIIX_SIDPR_BAR = 5,
105 PIIX_SIDPR_LEN = 16, 104 PIIX_SIDPR_LEN = 16,
106 PIIX_SIDPR_IDX = 0, 105 PIIX_SIDPR_IDX = 0,
107 PIIX_SIDPR_DATA = 4, 106 PIIX_SIDPR_DATA = 4,
108 107
109 PIIX_FLAG_AHCI = (1 << 27), /* AHCI possible */
110 PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */ 108 PIIX_FLAG_CHECKINTR = (1 << 28), /* make sure PCI INTx enabled */
111 PIIX_FLAG_SIDPR = (1 << 29), /* SATA idx/data pair regs */ 109 PIIX_FLAG_SIDPR = (1 << 29), /* SATA idx/data pair regs */
112 110
@@ -238,8 +236,10 @@ static const struct pci_device_id piix_pci_tbl[] = {
238 { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata }, 236 { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata },
239 /* 82801FR/FRW (ICH6R/ICH6RW) */ 237 /* 82801FR/FRW (ICH6R/ICH6RW) */
240 { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, 238 { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
241 /* 82801FBM ICH6M (ICH6R with only port 0 and 2 implemented) */ 239 /* 82801FBM ICH6M (ICH6R with only port 0 and 2 implemented).
242 { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6m_sata_ahci }, 240 * Attach iff the controller is in IDE mode. */
241 { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID,
242 PCI_CLASS_STORAGE_IDE << 8, 0xffff00, ich6m_sata_ahci },
243 /* 82801GB/GR/GH (ICH7, identical to ICH6) */ 243 /* 82801GB/GR/GH (ICH7, identical to ICH6) */
244 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, 244 { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci },
245 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */ 245 /* 2801GBM/GHM (ICH7M, identical to ICH6M) */
@@ -494,7 +494,7 @@ static struct ata_port_info piix_port_info[] = {
494 494
495 [ich6_sata_ahci] = 495 [ich6_sata_ahci] =
496 { 496 {
497 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_AHCI, 497 .flags = PIIX_SATA_FLAGS,
498 .pio_mask = 0x1f, /* pio0-4 */ 498 .pio_mask = 0x1f, /* pio0-4 */
499 .mwdma_mask = 0x07, /* mwdma0-2 */ 499 .mwdma_mask = 0x07, /* mwdma0-2 */
500 .udma_mask = ATA_UDMA6, 500 .udma_mask = ATA_UDMA6,
@@ -503,7 +503,7 @@ static struct ata_port_info piix_port_info[] = {
503 503
504 [ich6m_sata_ahci] = 504 [ich6m_sata_ahci] =
505 { 505 {
506 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_AHCI, 506 .flags = PIIX_SATA_FLAGS,
507 .pio_mask = 0x1f, /* pio0-4 */ 507 .pio_mask = 0x1f, /* pio0-4 */
508 .mwdma_mask = 0x07, /* mwdma0-2 */ 508 .mwdma_mask = 0x07, /* mwdma0-2 */
509 .udma_mask = ATA_UDMA6, 509 .udma_mask = ATA_UDMA6,
@@ -512,8 +512,7 @@ static struct ata_port_info piix_port_info[] = {
512 512
513 [ich8_sata_ahci] = 513 [ich8_sata_ahci] =
514 { 514 {
515 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_AHCI | 515 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR,
516 PIIX_FLAG_SIDPR,
517 .pio_mask = 0x1f, /* pio0-4 */ 516 .pio_mask = 0x1f, /* pio0-4 */
518 .mwdma_mask = 0x07, /* mwdma0-2 */ 517 .mwdma_mask = 0x07, /* mwdma0-2 */
519 .udma_mask = ATA_UDMA6, 518 .udma_mask = ATA_UDMA6,
@@ -522,8 +521,7 @@ static struct ata_port_info piix_port_info[] = {
522 521
523 [ich8_2port_sata] = 522 [ich8_2port_sata] =
524 { 523 {
525 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_AHCI | 524 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR,
526 PIIX_FLAG_SIDPR,
527 .pio_mask = 0x1f, /* pio0-4 */ 525 .pio_mask = 0x1f, /* pio0-4 */
528 .mwdma_mask = 0x07, /* mwdma0-2 */ 526 .mwdma_mask = 0x07, /* mwdma0-2 */
529 .udma_mask = ATA_UDMA6, 527 .udma_mask = ATA_UDMA6,
@@ -532,7 +530,7 @@ static struct ata_port_info piix_port_info[] = {
532 530
533 [tolapai_sata_ahci] = 531 [tolapai_sata_ahci] =
534 { 532 {
535 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_AHCI, 533 .flags = PIIX_SATA_FLAGS,
536 .pio_mask = 0x1f, /* pio0-4 */ 534 .pio_mask = 0x1f, /* pio0-4 */
537 .mwdma_mask = 0x07, /* mwdma0-2 */ 535 .mwdma_mask = 0x07, /* mwdma0-2 */
538 .udma_mask = ATA_UDMA6, 536 .udma_mask = ATA_UDMA6,
@@ -541,8 +539,7 @@ static struct ata_port_info piix_port_info[] = {
541 539
542 [ich8m_apple_sata_ahci] = 540 [ich8m_apple_sata_ahci] =
543 { 541 {
544 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_AHCI | 542 .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SIDPR,
545 PIIX_FLAG_SIDPR,
546 .pio_mask = 0x1f, /* pio0-4 */ 543 .pio_mask = 0x1f, /* pio0-4 */
547 .mwdma_mask = 0x07, /* mwdma0-2 */ 544 .mwdma_mask = 0x07, /* mwdma0-2 */
548 .udma_mask = ATA_UDMA6, 545 .udma_mask = ATA_UDMA6,
@@ -1488,6 +1485,16 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1488 if (rc) 1485 if (rc)
1489 return rc; 1486 return rc;
1490 1487
1488 /* ICH6R may be driven by either ata_piix or ahci driver
1489 * regardless of BIOS configuration. Make sure AHCI mode is
1490 * off.
1491 */
1492 if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x2652) {
1493 int rc = piix_disable_ahci(pdev);
1494 if (rc)
1495 return rc;
1496 }
1497
1491 /* SATA map init can change port_info, do it before prepping host */ 1498 /* SATA map init can change port_info, do it before prepping host */
1492 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL); 1499 hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
1493 if (!hpriv) 1500 if (!hpriv)
@@ -1503,16 +1510,6 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
1503 host->private_data = hpriv; 1510 host->private_data = hpriv;
1504 1511
1505 /* initialize controller */ 1512 /* initialize controller */
1506 if (port_flags & PIIX_FLAG_AHCI) {
1507 u8 tmp;
1508 pci_read_config_byte(pdev, PIIX_SCC, &tmp);
1509 if (tmp == PIIX_AHCI_DEVICE) {
1510 rc = piix_disable_ahci(pdev);
1511 if (rc)
1512 return rc;
1513 }
1514 }
1515
1516 if (port_flags & ATA_FLAG_SATA) { 1513 if (port_flags & ATA_FLAG_SATA) {
1517 piix_init_pcs(host, piix_map_db_table[ent->driver_data]); 1514 piix_init_pcs(host, piix_map_db_table[ent->driver_data]);
1518 piix_init_sidpr(host); 1515 piix_init_sidpr(host);