aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/cmd64x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/pci/cmd64x.c')
-rw-r--r--drivers/ide/pci/cmd64x.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 519080ff4665..95ca3b6fd352 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -551,27 +551,9 @@ static void __devinit init_hwif_cmd64x(ide_hwif_t *hwif)
551 } 551 }
552} 552}
553 553
554static int __devinit init_setup_cmd64x(struct pci_dev *dev, ide_pci_device_t *d)
555{
556 return ide_setup_pci_device(dev, d);
557}
558
559static int __devinit init_setup_cmd646(struct pci_dev *dev, ide_pci_device_t *d)
560{
561 /*
562 * The original PCI0646 didn't have the primary channel enable bit,
563 * it appeared starting with PCI0646U (i.e. revision ID 3).
564 */
565 if (dev->revision < 3)
566 d->enablebits[0].reg = 0;
567
568 return ide_setup_pci_device(dev, d);
569}
570
571static ide_pci_device_t cmd64x_chipsets[] __devinitdata = { 554static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
572 { /* 0 */ 555 { /* 0 */
573 .name = "CMD643", 556 .name = "CMD643",
574 .init_setup = init_setup_cmd64x,
575 .init_chipset = init_chipset_cmd64x, 557 .init_chipset = init_chipset_cmd64x,
576 .init_hwif = init_hwif_cmd64x, 558 .init_hwif = init_hwif_cmd64x,
577 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 559 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}},
@@ -581,7 +563,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
581 .udma_mask = 0x00, /* no udma */ 563 .udma_mask = 0x00, /* no udma */
582 },{ /* 1 */ 564 },{ /* 1 */
583 .name = "CMD646", 565 .name = "CMD646",
584 .init_setup = init_setup_cmd646,
585 .init_chipset = init_chipset_cmd64x, 566 .init_chipset = init_chipset_cmd64x,
586 .init_hwif = init_hwif_cmd64x, 567 .init_hwif = init_hwif_cmd64x,
587 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 568 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
@@ -591,7 +572,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
591 .udma_mask = ATA_UDMA2, 572 .udma_mask = ATA_UDMA2,
592 },{ /* 2 */ 573 },{ /* 2 */
593 .name = "CMD648", 574 .name = "CMD648",
594 .init_setup = init_setup_cmd64x,
595 .init_chipset = init_chipset_cmd64x, 575 .init_chipset = init_chipset_cmd64x,
596 .init_hwif = init_hwif_cmd64x, 576 .init_hwif = init_hwif_cmd64x,
597 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 577 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
@@ -601,7 +581,6 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
601 .udma_mask = ATA_UDMA4, 581 .udma_mask = ATA_UDMA4,
602 },{ /* 3 */ 582 },{ /* 3 */
603 .name = "CMD649", 583 .name = "CMD649",
604 .init_setup = init_setup_cmd64x,
605 .init_chipset = init_chipset_cmd64x, 584 .init_chipset = init_chipset_cmd64x,
606 .init_hwif = init_hwif_cmd64x, 585 .init_hwif = init_hwif_cmd64x,
607 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 586 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}},
@@ -612,15 +591,21 @@ static ide_pci_device_t cmd64x_chipsets[] __devinitdata = {
612 } 591 }
613}; 592};
614 593
615/*
616 * We may have to modify enablebits for PCI0646, so we'd better pass
617 * a local copy of the ide_pci_device_t structure down the call chain...
618 */
619static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id) 594static int __devinit cmd64x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
620{ 595{
621 ide_pci_device_t d = cmd64x_chipsets[id->driver_data]; 596 ide_pci_device_t d;
597 u8 idx = id->driver_data;
598
599 d = cmd64x_chipsets[idx];
600
601 /*
602 * The original PCI0646 didn't have the primary channel enable bit,
603 * it appeared starting with PCI0646U (i.e. revision ID 3).
604 */
605 if (idx == 1 && dev->revision < 3)
606 d.enablebits[0].reg = 0;
622 607
623 return d.init_setup(dev, &d); 608 return ide_setup_pci_device(dev, &d);
624} 609}
625 610
626static const struct pci_device_id cmd64x_pci_tbl[] = { 611static const struct pci_device_id cmd64x_pci_tbl[] = {