diff options
Diffstat (limited to 'drivers/ata/pata_ali.c')
-rw-r--r-- | drivers/ata/pata_ali.c | 34 |
1 files changed, 15 insertions, 19 deletions
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 | ||
456 | static void ali_init_chipset(struct pci_dev *pdev) | 456 | static 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) |