aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ata_piix.c6
-rw-r--r--drivers/ata/pata_ali.c34
-rw-r--r--drivers/ata/pata_amd.c4
-rw-r--r--drivers/ata/pata_it821x.c3
-rw-r--r--drivers/ata/pata_serverworks.c5
-rw-r--r--drivers/ata/pata_sis.c8
-rw-r--r--drivers/ata/pata_sl82c105.c5
-rw-r--r--drivers/ata/pata_via.c6
-rw-r--r--drivers/ata/sata_mv.c20
9 files changed, 31 insertions, 60 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 6a3bfef58e13..2610db75f984 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -928,20 +928,18 @@ static int __devinit piix_check_450nx_errata(struct pci_dev *ata_dev)
928{ 928{
929 struct pci_dev *pdev = NULL; 929 struct pci_dev *pdev = NULL;
930 u16 cfg; 930 u16 cfg;
931 u8 rev;
932 int no_piix_dma = 0; 931 int no_piix_dma = 0;
933 932
934 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL) 933 while((pdev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL)
935 { 934 {
936 /* Look for 450NX PXB. Check for problem configurations 935 /* Look for 450NX PXB. Check for problem configurations
937 A PCI quirk checks bit 6 already */ 936 A PCI quirk checks bit 6 already */
938 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
939 pci_read_config_word(pdev, 0x41, &cfg); 937 pci_read_config_word(pdev, 0x41, &cfg);
940 /* Only on the original revision: IDE DMA can hang */ 938 /* Only on the original revision: IDE DMA can hang */
941 if (rev == 0x00) 939 if (pdev->revision == 0x00)
942 no_piix_dma = 1; 940 no_piix_dma = 1;
943 /* On all revisions below 5 PXB bus lock must be disabled for IDE */ 941 /* On all revisions below 5 PXB bus lock must be disabled for IDE */
944 else if (cfg & (1<<14) && rev < 5) 942 else if (cfg & (1<<14) && pdev->revision < 5)
945 no_piix_dma = 2; 943 no_piix_dma = 2;
946 } 944 }
947 if (no_piix_dma) 945 if (no_piix_dma)
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 30c4276ec882..010436795d20 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -455,23 +455,21 @@ static struct ata_port_operations ali_c5_port_ops = {
455 455
456static void ali_init_chipset(struct pci_dev *pdev) 456static void ali_init_chipset(struct pci_dev *pdev)
457{ 457{
458 u8 rev, tmp; 458 u8 tmp;
459 struct pci_dev *north, *isa_bridge; 459 struct pci_dev *north, *isa_bridge;
460 460
461 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
462
463 /* 461 /*
464 * The chipset revision selects the driver operations and 462 * The chipset revision selects the driver operations and
465 * mode data. 463 * mode data.
466 */ 464 */
467 465
468 if (rev >= 0x20 && rev < 0xC2) { 466 if (pdev->revision >= 0x20 && pdev->revision < 0xC2) {
469 /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */ 467 /* 1543-E/F, 1543C-C, 1543C-D, 1543C-E */
470 pci_read_config_byte(pdev, 0x4B, &tmp); 468 pci_read_config_byte(pdev, 0x4B, &tmp);
471 /* Clear CD-ROM DMA write bit */ 469 /* Clear CD-ROM DMA write bit */
472 tmp &= 0x7F; 470 tmp &= 0x7F;
473 pci_write_config_byte(pdev, 0x4B, tmp); 471 pci_write_config_byte(pdev, 0x4B, tmp);
474 } else if (rev >= 0xC2) { 472 } else if (pdev->revision >= 0xC2) {
475 /* Enable cable detection logic */ 473 /* Enable cable detection logic */
476 pci_read_config_byte(pdev, 0x4B, &tmp); 474 pci_read_config_byte(pdev, 0x4B, &tmp);
477 pci_write_config_byte(pdev, 0x4B, tmp | 0x08); 475 pci_write_config_byte(pdev, 0x4B, tmp | 0x08);
@@ -483,21 +481,21 @@ static void ali_init_chipset(struct pci_dev *pdev)
483 /* Configure the ALi bridge logic. For non ALi rely on BIOS. 481 /* Configure the ALi bridge logic. For non ALi rely on BIOS.
484 Set the south bridge enable bit */ 482 Set the south bridge enable bit */
485 pci_read_config_byte(isa_bridge, 0x79, &tmp); 483 pci_read_config_byte(isa_bridge, 0x79, &tmp);
486 if (rev == 0xC2) 484 if (pdev->revision == 0xC2)
487 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04); 485 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04);
488 else if (rev > 0xC2 && rev < 0xC5) 486 else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
489 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02); 487 pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02);
490 } 488 }
491 if (rev >= 0x20) { 489 if (pdev->revision >= 0x20) {
492 /* 490 /*
493 * CD_ROM DMA on (0x53 bit 0). Enable this even if we want 491 * CD_ROM DMA on (0x53 bit 0). Enable this even if we want
494 * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control 492 * to use PIO. 0x53 bit 1 (rev 20 only) - enable FIFO control
495 * via 0x54/55. 493 * via 0x54/55.
496 */ 494 */
497 pci_read_config_byte(pdev, 0x53, &tmp); 495 pci_read_config_byte(pdev, 0x53, &tmp);
498 if (rev <= 0x20) 496 if (pdev->revision <= 0x20)
499 tmp &= ~0x02; 497 tmp &= ~0x02;
500 if (rev >= 0xc7) 498 if (pdev->revision >= 0xc7)
501 tmp |= 0x03; 499 tmp |= 0x03;
502 else 500 else
503 tmp |= 0x01; /* CD_ROM enable for DMA */ 501 tmp |= 0x01; /* CD_ROM enable for DMA */
@@ -579,25 +577,23 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
579 }; 577 };
580 578
581 const struct ata_port_info *ppi[] = { NULL, NULL }; 579 const struct ata_port_info *ppi[] = { NULL, NULL };
582 u8 rev, tmp; 580 u8 tmp;
583 struct pci_dev *isa_bridge; 581 struct pci_dev *isa_bridge;
584 582
585 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
586
587 /* 583 /*
588 * The chipset revision selects the driver operations and 584 * The chipset revision selects the driver operations and
589 * mode data. 585 * mode data.
590 */ 586 */
591 587
592 if (rev < 0x20) { 588 if (pdev->revision < 0x20) {
593 ppi[0] = &info_early; 589 ppi[0] = &info_early;
594 } else if (rev < 0xC2) { 590 } else if (pdev->revision < 0xC2) {
595 ppi[0] = &info_20; 591 ppi[0] = &info_20;
596 } else if (rev == 0xC2) { 592 } else if (pdev->revision == 0xC2) {
597 ppi[0] = &info_c2; 593 ppi[0] = &info_c2;
598 } else if (rev == 0xC3) { 594 } else if (pdev->revision == 0xC3) {
599 ppi[0] = &info_c3; 595 ppi[0] = &info_c3;
600 } else if (rev == 0xC4) { 596 } else if (pdev->revision == 0xC4) {
601 ppi[0] = &info_c4; 597 ppi[0] = &info_c4;
602 } else 598 } else
603 ppi[0] = &info_c5; 599 ppi[0] = &info_c5;
@@ -605,7 +601,7 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
605 ali_init_chipset(pdev); 601 ali_init_chipset(pdev);
606 602
607 isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); 603 isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
608 if (isa_bridge && rev >= 0x20 && rev < 0xC2) { 604 if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
609 /* Are we paired with a UDMA capable chip */ 605 /* Are we paired with a UDMA capable chip */
610 pci_read_config_byte(isa_bridge, 0x5E, &tmp); 606 pci_read_config_byte(isa_bridge, 0x5E, &tmp);
611 if ((tmp & 0x1E) == 0x12) 607 if ((tmp & 0x1E) == 0x12)
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c
index b9c44c575ce3..b09facad63e1 100644
--- a/drivers/ata/pata_amd.c
+++ b/drivers/ata/pata_amd.c
@@ -623,17 +623,15 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
623 const struct ata_port_info *ppi[] = { NULL, NULL }; 623 const struct ata_port_info *ppi[] = { NULL, NULL };
624 static int printed_version; 624 static int printed_version;
625 int type = id->driver_data; 625 int type = id->driver_data;
626 u8 rev;
627 u8 fifo; 626 u8 fifo;
628 627
629 if (!printed_version++) 628 if (!printed_version++)
630 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); 629 dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n");
631 630
632 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
633 pci_read_config_byte(pdev, 0x41, &fifo); 631 pci_read_config_byte(pdev, 0x41, &fifo);
634 632
635 /* Check for AMD7409 without swdma errata and if found adjust type */ 633 /* Check for AMD7409 without swdma errata and if found adjust type */
636 if (type == 1 && rev > 0x7) 634 if (type == 1 && pdev->revision > 0x7)
637 type = 2; 635 type = 2;
638 636
639 /* Check for AMD7411 */ 637 /* Check for AMD7411 */
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index b67bbf6516ba..430673be1df7 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -587,8 +587,7 @@ static int it821x_port_start(struct ata_port *ap)
587 itdev->want[1][1] = ATA_ANY; 587 itdev->want[1][1] = ATA_ANY;
588 itdev->last_device = -1; 588 itdev->last_device = -1;
589 589
590 pci_read_config_byte(pdev, PCI_REVISION_ID, &conf); 590 if (pdev->revision == 0x11) {
591 if (conf == 0x10) {
592 itdev->timing10 = 1; 591 itdev->timing10 = 1;
593 /* Need to disable ATAPI DMA for this case */ 592 /* Need to disable ATAPI DMA for this case */
594 if (!itdev->smart) 593 if (!itdev->smart)
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 0231aba51ca4..89691541fe59 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -410,11 +410,8 @@ static int serverworks_fixup_osb4(struct pci_dev *pdev)
410 410
411static int serverworks_fixup_csb(struct pci_dev *pdev) 411static int serverworks_fixup_csb(struct pci_dev *pdev)
412{ 412{
413 u8 rev;
414 u8 btr; 413 u8 btr;
415 414
416 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev);
417
418 /* Third Channel Test */ 415 /* Third Channel Test */
419 if (!(PCI_FUNC(pdev->devfn) & 1)) { 416 if (!(PCI_FUNC(pdev->devfn) & 1)) {
420 struct pci_dev * findev = NULL; 417 struct pci_dev * findev = NULL;
@@ -456,7 +453,7 @@ static int serverworks_fixup_csb(struct pci_dev *pdev)
456 if (!(PCI_FUNC(pdev->devfn) & 1)) 453 if (!(PCI_FUNC(pdev->devfn) & 1))
457 btr |= 0x2; 454 btr |= 0x2;
458 else 455 else
459 btr |= (rev >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2; 456 btr |= (pdev->revision >= SVWKS_CSB5_REVISION_NEW) ? 0x3 : 0x2;
460 pci_write_config_byte(pdev, 0x5A, btr); 457 pci_write_config_byte(pdev, 0x5A, btr);
461 458
462 return btr; 459 return btr;
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 2b4508206a6c..74a021124f3c 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -928,9 +928,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
928 if (host != NULL) { 928 if (host != NULL) {
929 chipset = sets; /* Match found */ 929 chipset = sets; /* Match found */
930 if (sets->device == 0x630) { /* SIS630 */ 930 if (sets->device == 0x630) { /* SIS630 */
931 u8 host_rev; 931 if (host->revision >= 0x30) /* 630 ET */
932 pci_read_config_byte(host, PCI_REVISION_ID, &host_rev);
933 if (host_rev >= 0x30) /* 630 ET */
934 chipset = &sis100_early; 932 chipset = &sis100_early;
935 } 933 }
936 break; 934 break;
@@ -974,7 +972,6 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
974 u16 trueid; 972 u16 trueid;
975 u8 prefctl; 973 u8 prefctl;
976 u8 idecfg; 974 u8 idecfg;
977 u8 sbrev;
978 975
979 /* Try the second unmasking technique */ 976 /* Try the second unmasking technique */
980 pci_read_config_byte(pdev, 0x4a, &idecfg); 977 pci_read_config_byte(pdev, 0x4a, &idecfg);
@@ -987,11 +984,10 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
987 lpc_bridge = pci_get_slot(pdev->bus, 0x10); /* Bus 0 Dev 2 Fn 0 */ 984 lpc_bridge = pci_get_slot(pdev->bus, 0x10); /* Bus 0 Dev 2 Fn 0 */
988 if (lpc_bridge == NULL) 985 if (lpc_bridge == NULL)
989 break; 986 break;
990 pci_read_config_byte(lpc_bridge, PCI_REVISION_ID, &sbrev);
991 pci_read_config_byte(pdev, 0x49, &prefctl); 987 pci_read_config_byte(pdev, 0x49, &prefctl);
992 pci_dev_put(lpc_bridge); 988 pci_dev_put(lpc_bridge);
993 989
994 if (sbrev == 0x10 && (prefctl & 0x80)) { 990 if (lpc_bridge->revision == 0x10 && (prefctl & 0x80)) {
995 chipset = &sis133_early; 991 chipset = &sis133_early;
996 break; 992 break;
997 } 993 }
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c
index bde734189623..8c2813aa6cdb 100644
--- a/drivers/ata/pata_sl82c105.c
+++ b/drivers/ata/pata_sl82c105.c
@@ -270,7 +270,6 @@ static struct ata_port_operations sl82c105_port_ops = {
270static int sl82c105_bridge_revision(struct pci_dev *pdev) 270static int sl82c105_bridge_revision(struct pci_dev *pdev)
271{ 271{
272 struct pci_dev *bridge; 272 struct pci_dev *bridge;
273 u8 rev;
274 273
275 /* 274 /*
276 * The bridge should be part of the same device, but function 0. 275 * The bridge should be part of the same device, but function 0.
@@ -292,10 +291,8 @@ static int sl82c105_bridge_revision(struct pci_dev *pdev)
292 /* 291 /*
293 * We need to find function 0's revision, not function 1 292 * We need to find function 0's revision, not function 1
294 */ 293 */
295 pci_read_config_byte(bridge, PCI_REVISION_ID, &rev);
296
297 pci_dev_put(bridge); 294 pci_dev_put(bridge);
298 return rev; 295 return bridge->revision;
299} 296}
300 297
301 298
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c
index f0cadbe6aa11..f645fe22cd1e 100644
--- a/drivers/ata/pata_via.c
+++ b/drivers/ata/pata_via.c
@@ -506,7 +506,6 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
506 struct pci_dev *isa = NULL; 506 struct pci_dev *isa = NULL;
507 const struct via_isa_bridge *config; 507 const struct via_isa_bridge *config;
508 static int printed_version; 508 static int printed_version;
509 u8 t;
510 u8 enable; 509 u8 enable;
511 u32 timing; 510 u32 timing;
512 511
@@ -520,9 +519,8 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
520 !!(config->flags & VIA_BAD_ID), 519 !!(config->flags & VIA_BAD_ID),
521 config->id, NULL))) { 520 config->id, NULL))) {
522 521
523 pci_read_config_byte(isa, PCI_REVISION_ID, &t); 522 if (isa->revision >= config->rev_min &&
524 if (t >= config->rev_min && 523 isa->revision <= config->rev_max)
525 t <= config->rev_max)
526 break; 524 break;
527 pci_dev_put(isa); 525 pci_dev_put(isa);
528 } 526 }
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 3873b29c80d6..6dcfc628aab1 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1573,12 +1573,9 @@ static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val)
1573 1573
1574static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) 1574static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio)
1575{ 1575{
1576 u8 rev_id;
1577 int early_5080; 1576 int early_5080;
1578 1577
1579 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); 1578 early_5080 = (pdev->device == 0x5080) && (pdev->revision == 0);
1580
1581 early_5080 = (pdev->device == 0x5080) && (rev_id == 0);
1582 1579
1583 if (!early_5080) { 1580 if (!early_5080) {
1584 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); 1581 u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL);
@@ -2139,17 +2136,14 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2139{ 2136{
2140 struct pci_dev *pdev = to_pci_dev(host->dev); 2137 struct pci_dev *pdev = to_pci_dev(host->dev);
2141 struct mv_host_priv *hpriv = host->private_data; 2138 struct mv_host_priv *hpriv = host->private_data;
2142 u8 rev_id;
2143 u32 hp_flags = hpriv->hp_flags; 2139 u32 hp_flags = hpriv->hp_flags;
2144 2140
2145 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
2146
2147 switch(board_idx) { 2141 switch(board_idx) {
2148 case chip_5080: 2142 case chip_5080:
2149 hpriv->ops = &mv5xxx_ops; 2143 hpriv->ops = &mv5xxx_ops;
2150 hp_flags |= MV_HP_50XX; 2144 hp_flags |= MV_HP_50XX;
2151 2145
2152 switch (rev_id) { 2146 switch (pdev->revision) {
2153 case 0x1: 2147 case 0x1:
2154 hp_flags |= MV_HP_ERRATA_50XXB0; 2148 hp_flags |= MV_HP_ERRATA_50XXB0;
2155 break; 2149 break;
@@ -2169,7 +2163,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2169 hpriv->ops = &mv5xxx_ops; 2163 hpriv->ops = &mv5xxx_ops;
2170 hp_flags |= MV_HP_50XX; 2164 hp_flags |= MV_HP_50XX;
2171 2165
2172 switch (rev_id) { 2166 switch (pdev->revision) {
2173 case 0x0: 2167 case 0x0:
2174 hp_flags |= MV_HP_ERRATA_50XXB0; 2168 hp_flags |= MV_HP_ERRATA_50XXB0;
2175 break; 2169 break;
@@ -2188,7 +2182,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2188 case chip_608x: 2182 case chip_608x:
2189 hpriv->ops = &mv6xxx_ops; 2183 hpriv->ops = &mv6xxx_ops;
2190 2184
2191 switch (rev_id) { 2185 switch (pdev->revision) {
2192 case 0x7: 2186 case 0x7:
2193 hp_flags |= MV_HP_ERRATA_60X1B2; 2187 hp_flags |= MV_HP_ERRATA_60X1B2;
2194 break; 2188 break;
@@ -2209,7 +2203,7 @@ static int mv_chip_id(struct ata_host *host, unsigned int board_idx)
2209 2203
2210 hp_flags |= MV_HP_GEN_IIE; 2204 hp_flags |= MV_HP_GEN_IIE;
2211 2205
2212 switch (rev_id) { 2206 switch (pdev->revision) {
2213 case 0x0: 2207 case 0x0:
2214 hp_flags |= MV_HP_ERRATA_XX42A0; 2208 hp_flags |= MV_HP_ERRATA_XX42A0;
2215 break; 2209 break;
@@ -2337,14 +2331,12 @@ static void mv_print_info(struct ata_host *host)
2337{ 2331{
2338 struct pci_dev *pdev = to_pci_dev(host->dev); 2332 struct pci_dev *pdev = to_pci_dev(host->dev);
2339 struct mv_host_priv *hpriv = host->private_data; 2333 struct mv_host_priv *hpriv = host->private_data;
2340 u8 rev_id, scc; 2334 u8 scc;
2341 const char *scc_s, *gen; 2335 const char *scc_s, *gen;
2342 2336
2343 /* Use this to determine the HW stepping of the chip so we know 2337 /* Use this to determine the HW stepping of the chip so we know
2344 * what errata to workaround 2338 * what errata to workaround
2345 */ 2339 */
2346 pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
2347
2348 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc); 2340 pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &scc);
2349 if (scc == 0) 2341 if (scc == 0)
2350 scc_s = "SCSI"; 2342 scc_s = "SCSI";