diff options
Diffstat (limited to 'drivers/ide/pci/hpt366.c')
-rw-r--r-- | drivers/ide/pci/hpt366.c | 194 |
1 files changed, 82 insertions, 112 deletions
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c index 9fce25bdec8a..3777fb8c8043 100644 --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/hpt366.c Version 1.22 Dec 4, 2007 | 2 | * linux/drivers/ide/pci/hpt366.c Version 1.30 Dec 12, 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 5 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
@@ -88,7 +88,7 @@ | |||
88 | * - rename all the register related variables consistently | 88 | * - rename all the register related variables consistently |
89 | * - move all the interrupt twiddling code from the speedproc handlers into | 89 | * - move all the interrupt twiddling code from the speedproc handlers into |
90 | * init_hwif_hpt366(), also grouping all the DMA related code together there | 90 | * init_hwif_hpt366(), also grouping all the DMA related code together there |
91 | * - merge two HPT37x speedproc handlers, fix the PIO timing register mask and | 91 | * - merge HPT36x/HPT37x speedproc handlers, fix PIO timing register mask and |
92 | * separate the UltraDMA and MWDMA masks there to avoid changing PIO timings | 92 | * separate the UltraDMA and MWDMA masks there to avoid changing PIO timings |
93 | * when setting an UltraDMA mode | 93 | * when setting an UltraDMA mode |
94 | * - fix hpt3xx_tune_drive() to set the PIO mode requested, not always select | 94 | * - fix hpt3xx_tune_drive() to set the PIO mode requested, not always select |
@@ -458,6 +458,13 @@ enum ata_clock { | |||
458 | NUM_ATA_CLOCKS | 458 | NUM_ATA_CLOCKS |
459 | }; | 459 | }; |
460 | 460 | ||
461 | struct hpt_timings { | ||
462 | u32 pio_mask; | ||
463 | u32 dma_mask; | ||
464 | u32 ultra_mask; | ||
465 | u32 *clock_table[NUM_ATA_CLOCKS]; | ||
466 | }; | ||
467 | |||
461 | /* | 468 | /* |
462 | * Hold all the HighPoint chip information in one place. | 469 | * Hold all the HighPoint chip information in one place. |
463 | */ | 470 | */ |
@@ -468,7 +475,8 @@ struct hpt_info { | |||
468 | u8 udma_mask; /* Allowed UltraDMA modes mask. */ | 475 | u8 udma_mask; /* Allowed UltraDMA modes mask. */ |
469 | u8 dpll_clk; /* DPLL clock in MHz */ | 476 | u8 dpll_clk; /* DPLL clock in MHz */ |
470 | u8 pci_clk; /* PCI clock in MHz */ | 477 | u8 pci_clk; /* PCI clock in MHz */ |
471 | u32 **settings; /* Chipset settings table */ | 478 | struct hpt_timings *timings; /* Chipset timing data */ |
479 | u8 clock; /* ATA clock selected */ | ||
472 | }; | 480 | }; |
473 | 481 | ||
474 | /* Supported HighPoint chips */ | 482 | /* Supported HighPoint chips */ |
@@ -486,20 +494,30 @@ enum { | |||
486 | HPT371N | 494 | HPT371N |
487 | }; | 495 | }; |
488 | 496 | ||
489 | static u32 *hpt36x_settings[NUM_ATA_CLOCKS] = { | 497 | static struct hpt_timings hpt36x_timings = { |
490 | twenty_five_base_hpt36x, | 498 | .pio_mask = 0xc1f8ffff, |
491 | thirty_three_base_hpt36x, | 499 | .dma_mask = 0x303800ff, |
492 | forty_base_hpt36x, | 500 | .ultra_mask = 0x30070000, |
493 | NULL, | 501 | .clock_table = { |
494 | NULL | 502 | [ATA_CLOCK_25MHZ] = twenty_five_base_hpt36x, |
503 | [ATA_CLOCK_33MHZ] = thirty_three_base_hpt36x, | ||
504 | [ATA_CLOCK_40MHZ] = forty_base_hpt36x, | ||
505 | [ATA_CLOCK_50MHZ] = NULL, | ||
506 | [ATA_CLOCK_66MHZ] = NULL | ||
507 | } | ||
495 | }; | 508 | }; |
496 | 509 | ||
497 | static u32 *hpt37x_settings[NUM_ATA_CLOCKS] = { | 510 | static struct hpt_timings hpt37x_timings = { |
498 | NULL, | 511 | .pio_mask = 0xcfc3ffff, |
499 | thirty_three_base_hpt37x, | 512 | .dma_mask = 0x31c001ff, |
500 | NULL, | 513 | .ultra_mask = 0x303c0000, |
501 | fifty_base_hpt37x, | 514 | .clock_table = { |
502 | sixty_six_base_hpt37x | 515 | [ATA_CLOCK_25MHZ] = NULL, |
516 | [ATA_CLOCK_33MHZ] = thirty_three_base_hpt37x, | ||
517 | [ATA_CLOCK_40MHZ] = NULL, | ||
518 | [ATA_CLOCK_50MHZ] = fifty_base_hpt37x, | ||
519 | [ATA_CLOCK_66MHZ] = sixty_six_base_hpt37x | ||
520 | } | ||
503 | }; | 521 | }; |
504 | 522 | ||
505 | static const struct hpt_info hpt36x __devinitdata = { | 523 | static const struct hpt_info hpt36x __devinitdata = { |
@@ -507,7 +525,7 @@ static const struct hpt_info hpt36x __devinitdata = { | |||
507 | .chip_type = HPT36x, | 525 | .chip_type = HPT36x, |
508 | .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, | 526 | .udma_mask = HPT366_ALLOW_ATA66_3 ? (HPT366_ALLOW_ATA66_4 ? ATA_UDMA4 : ATA_UDMA3) : ATA_UDMA2, |
509 | .dpll_clk = 0, /* no DPLL */ | 527 | .dpll_clk = 0, /* no DPLL */ |
510 | .settings = hpt36x_settings | 528 | .timings = &hpt36x_timings |
511 | }; | 529 | }; |
512 | 530 | ||
513 | static const struct hpt_info hpt370 __devinitdata = { | 531 | static const struct hpt_info hpt370 __devinitdata = { |
@@ -515,7 +533,7 @@ static const struct hpt_info hpt370 __devinitdata = { | |||
515 | .chip_type = HPT370, | 533 | .chip_type = HPT370, |
516 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, | 534 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, |
517 | .dpll_clk = 48, | 535 | .dpll_clk = 48, |
518 | .settings = hpt37x_settings | 536 | .timings = &hpt37x_timings |
519 | }; | 537 | }; |
520 | 538 | ||
521 | static const struct hpt_info hpt370a __devinitdata = { | 539 | static const struct hpt_info hpt370a __devinitdata = { |
@@ -523,7 +541,7 @@ static const struct hpt_info hpt370a __devinitdata = { | |||
523 | .chip_type = HPT370A, | 541 | .chip_type = HPT370A, |
524 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, | 542 | .udma_mask = HPT370_ALLOW_ATA100_5 ? ATA_UDMA5 : ATA_UDMA4, |
525 | .dpll_clk = 48, | 543 | .dpll_clk = 48, |
526 | .settings = hpt37x_settings | 544 | .timings = &hpt37x_timings |
527 | }; | 545 | }; |
528 | 546 | ||
529 | static const struct hpt_info hpt374 __devinitdata = { | 547 | static const struct hpt_info hpt374 __devinitdata = { |
@@ -531,7 +549,7 @@ static const struct hpt_info hpt374 __devinitdata = { | |||
531 | .chip_type = HPT374, | 549 | .chip_type = HPT374, |
532 | .udma_mask = ATA_UDMA5, | 550 | .udma_mask = ATA_UDMA5, |
533 | .dpll_clk = 48, | 551 | .dpll_clk = 48, |
534 | .settings = hpt37x_settings | 552 | .timings = &hpt37x_timings |
535 | }; | 553 | }; |
536 | 554 | ||
537 | static const struct hpt_info hpt372 __devinitdata = { | 555 | static const struct hpt_info hpt372 __devinitdata = { |
@@ -539,7 +557,7 @@ static const struct hpt_info hpt372 __devinitdata = { | |||
539 | .chip_type = HPT372, | 557 | .chip_type = HPT372, |
540 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 558 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
541 | .dpll_clk = 55, | 559 | .dpll_clk = 55, |
542 | .settings = hpt37x_settings | 560 | .timings = &hpt37x_timings |
543 | }; | 561 | }; |
544 | 562 | ||
545 | static const struct hpt_info hpt372a __devinitdata = { | 563 | static const struct hpt_info hpt372a __devinitdata = { |
@@ -547,7 +565,7 @@ static const struct hpt_info hpt372a __devinitdata = { | |||
547 | .chip_type = HPT372A, | 565 | .chip_type = HPT372A, |
548 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 566 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
549 | .dpll_clk = 66, | 567 | .dpll_clk = 66, |
550 | .settings = hpt37x_settings | 568 | .timings = &hpt37x_timings |
551 | }; | 569 | }; |
552 | 570 | ||
553 | static const struct hpt_info hpt302 __devinitdata = { | 571 | static const struct hpt_info hpt302 __devinitdata = { |
@@ -555,7 +573,7 @@ static const struct hpt_info hpt302 __devinitdata = { | |||
555 | .chip_type = HPT302, | 573 | .chip_type = HPT302, |
556 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 574 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
557 | .dpll_clk = 66, | 575 | .dpll_clk = 66, |
558 | .settings = hpt37x_settings | 576 | .timings = &hpt37x_timings |
559 | }; | 577 | }; |
560 | 578 | ||
561 | static const struct hpt_info hpt371 __devinitdata = { | 579 | static const struct hpt_info hpt371 __devinitdata = { |
@@ -563,7 +581,7 @@ static const struct hpt_info hpt371 __devinitdata = { | |||
563 | .chip_type = HPT371, | 581 | .chip_type = HPT371, |
564 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 582 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
565 | .dpll_clk = 66, | 583 | .dpll_clk = 66, |
566 | .settings = hpt37x_settings | 584 | .timings = &hpt37x_timings |
567 | }; | 585 | }; |
568 | 586 | ||
569 | static const struct hpt_info hpt372n __devinitdata = { | 587 | static const struct hpt_info hpt372n __devinitdata = { |
@@ -571,7 +589,7 @@ static const struct hpt_info hpt372n __devinitdata = { | |||
571 | .chip_type = HPT372N, | 589 | .chip_type = HPT372N, |
572 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 590 | .udma_mask = HPT372_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
573 | .dpll_clk = 77, | 591 | .dpll_clk = 77, |
574 | .settings = hpt37x_settings | 592 | .timings = &hpt37x_timings |
575 | }; | 593 | }; |
576 | 594 | ||
577 | static const struct hpt_info hpt302n __devinitdata = { | 595 | static const struct hpt_info hpt302n __devinitdata = { |
@@ -579,7 +597,7 @@ static const struct hpt_info hpt302n __devinitdata = { | |||
579 | .chip_type = HPT302N, | 597 | .chip_type = HPT302N, |
580 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 598 | .udma_mask = HPT302_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
581 | .dpll_clk = 77, | 599 | .dpll_clk = 77, |
582 | .settings = hpt37x_settings | 600 | .timings = &hpt37x_timings |
583 | }; | 601 | }; |
584 | 602 | ||
585 | static const struct hpt_info hpt371n __devinitdata = { | 603 | static const struct hpt_info hpt371n __devinitdata = { |
@@ -587,7 +605,7 @@ static const struct hpt_info hpt371n __devinitdata = { | |||
587 | .chip_type = HPT371N, | 605 | .chip_type = HPT371N, |
588 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, | 606 | .udma_mask = HPT371_ALLOW_ATA133_6 ? ATA_UDMA6 : ATA_UDMA5, |
589 | .dpll_clk = 77, | 607 | .dpll_clk = 77, |
590 | .settings = hpt37x_settings | 608 | .timings = &hpt37x_timings |
591 | }; | 609 | }; |
592 | 610 | ||
593 | static int check_in_drive_list(ide_drive_t *drive, const char **list) | 611 | static int check_in_drive_list(ide_drive_t *drive, const char **list) |
@@ -675,71 +693,33 @@ static u32 get_speed_setting(u8 speed, struct hpt_info *info) | |||
675 | for (i = 0; i < ARRAY_SIZE(xfer_speeds) - 1; i++) | 693 | for (i = 0; i < ARRAY_SIZE(xfer_speeds) - 1; i++) |
676 | if (xfer_speeds[i] == speed) | 694 | if (xfer_speeds[i] == speed) |
677 | break; | 695 | break; |
678 | /* | 696 | |
679 | * NOTE: info->settings only points to the pointer | 697 | return info->timings->clock_table[info->clock][i]; |
680 | * to the list of the actual register values | ||
681 | */ | ||
682 | return (*info->settings)[i]; | ||
683 | } | 698 | } |
684 | 699 | ||
685 | static void hpt36x_set_mode(ide_drive_t *drive, const u8 speed) | 700 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) |
686 | { | 701 | { |
687 | ide_hwif_t *hwif = HWIF(drive); | 702 | struct pci_dev *dev = HWIF(drive)->pci_dev; |
688 | struct pci_dev *dev = hwif->pci_dev; | ||
689 | struct hpt_info *info = pci_get_drvdata(dev); | 703 | struct hpt_info *info = pci_get_drvdata(dev); |
690 | u8 itr_addr = drive->dn ? 0x44 : 0x40; | 704 | struct hpt_timings *t = info->timings; |
705 | u8 itr_addr = 0x40 + (drive->dn * 4); | ||
691 | u32 old_itr = 0; | 706 | u32 old_itr = 0; |
692 | u32 itr_mask, new_itr; | 707 | u32 new_itr = get_speed_setting(speed, info); |
693 | 708 | u32 itr_mask = speed < XFER_MW_DMA_0 ? t->pio_mask : | |
694 | itr_mask = speed < XFER_MW_DMA_0 ? 0x30070000 : | 709 | (speed < XFER_UDMA_0 ? t->dma_mask : |
695 | (speed < XFER_UDMA_0 ? 0xc0070000 : 0xc03800ff); | 710 | t->ultra_mask); |
696 | |||
697 | new_itr = get_speed_setting(speed, info); | ||
698 | 711 | ||
712 | pci_read_config_dword(dev, itr_addr, &old_itr); | ||
713 | new_itr = (old_itr & ~itr_mask) | (new_itr & itr_mask); | ||
699 | /* | 714 | /* |
700 | * Disable on-chip PIO FIFO/buffer (and PIO MST mode as well) | 715 | * Disable on-chip PIO FIFO/buffer (and PIO MST mode as well) |
701 | * to avoid problems handling I/O errors later | 716 | * to avoid problems handling I/O errors later |
702 | */ | 717 | */ |
703 | pci_read_config_dword(dev, itr_addr, &old_itr); | ||
704 | new_itr = (new_itr & ~itr_mask) | (old_itr & itr_mask); | ||
705 | new_itr &= ~0xc0000000; | 718 | new_itr &= ~0xc0000000; |
706 | 719 | ||
707 | pci_write_config_dword(dev, itr_addr, new_itr); | 720 | pci_write_config_dword(dev, itr_addr, new_itr); |
708 | } | 721 | } |
709 | 722 | ||
710 | static void hpt37x_set_mode(ide_drive_t *drive, const u8 speed) | ||
711 | { | ||
712 | ide_hwif_t *hwif = HWIF(drive); | ||
713 | struct pci_dev *dev = hwif->pci_dev; | ||
714 | struct hpt_info *info = pci_get_drvdata(dev); | ||
715 | u8 itr_addr = 0x40 + (drive->dn * 4); | ||
716 | u32 old_itr = 0; | ||
717 | u32 itr_mask, new_itr; | ||
718 | |||
719 | itr_mask = speed < XFER_MW_DMA_0 ? 0x303c0000 : | ||
720 | (speed < XFER_UDMA_0 ? 0xc03c0000 : 0xc1c001ff); | ||
721 | |||
722 | new_itr = get_speed_setting(speed, info); | ||
723 | |||
724 | pci_read_config_dword(dev, itr_addr, &old_itr); | ||
725 | new_itr = (new_itr & ~itr_mask) | (old_itr & itr_mask); | ||
726 | |||
727 | if (speed < XFER_MW_DMA_0) | ||
728 | new_itr &= ~0x80000000; /* Disable on-chip PIO FIFO/buffer */ | ||
729 | pci_write_config_dword(dev, itr_addr, new_itr); | ||
730 | } | ||
731 | |||
732 | static void hpt3xx_set_mode(ide_drive_t *drive, const u8 speed) | ||
733 | { | ||
734 | ide_hwif_t *hwif = HWIF(drive); | ||
735 | struct hpt_info *info = pci_get_drvdata(hwif->pci_dev); | ||
736 | |||
737 | if (info->chip_type >= HPT370) | ||
738 | hpt37x_set_mode(drive, speed); | ||
739 | else /* hpt368: hpt_minimum_revision(dev, 2) */ | ||
740 | hpt36x_set_mode(drive, speed); | ||
741 | } | ||
742 | |||
743 | static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio) | 723 | static void hpt3xx_set_pio_mode(ide_drive_t *drive, const u8 pio) |
744 | { | 724 | { |
745 | hpt3xx_set_mode(drive, XFER_PIO_0 + pio); | 725 | hpt3xx_set_mode(drive, XFER_PIO_0 + pio); |
@@ -756,15 +736,6 @@ static int hpt3xx_quirkproc(ide_drive_t *drive) | |||
756 | return 0; | 736 | return 0; |
757 | } | 737 | } |
758 | 738 | ||
759 | static void hpt3xx_intrproc(ide_drive_t *drive) | ||
760 | { | ||
761 | if (drive->quirk_list) | ||
762 | return; | ||
763 | |||
764 | /* drives in the quirk_list may not like intr setups/cleanups */ | ||
765 | outb(drive->ctl | 2, IDE_CONTROL_REG); | ||
766 | } | ||
767 | |||
768 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) | 739 | static void hpt3xx_maskproc(ide_drive_t *drive, int mask) |
769 | { | 740 | { |
770 | ide_hwif_t *hwif = HWIF(drive); | 741 | ide_hwif_t *hwif = HWIF(drive); |
@@ -914,32 +885,33 @@ static int hpt374_ide_dma_end(ide_drive_t *drive) | |||
914 | 885 | ||
915 | static void hpt3xxn_set_clock(ide_hwif_t *hwif, u8 mode) | 886 | static void hpt3xxn_set_clock(ide_hwif_t *hwif, u8 mode) |
916 | { | 887 | { |
917 | u8 scr2 = inb(hwif->dma_master + 0x7b); | 888 | unsigned long base = hwif->extra_base; |
889 | u8 scr2 = inb(base + 0x6b); | ||
918 | 890 | ||
919 | if ((scr2 & 0x7f) == mode) | 891 | if ((scr2 & 0x7f) == mode) |
920 | return; | 892 | return; |
921 | 893 | ||
922 | /* Tristate the bus */ | 894 | /* Tristate the bus */ |
923 | outb(0x80, hwif->dma_master + 0x73); | 895 | outb(0x80, base + 0x63); |
924 | outb(0x80, hwif->dma_master + 0x77); | 896 | outb(0x80, base + 0x67); |
925 | 897 | ||
926 | /* Switch clock and reset channels */ | 898 | /* Switch clock and reset channels */ |
927 | outb(mode, hwif->dma_master + 0x7b); | 899 | outb(mode, base + 0x6b); |
928 | outb(0xc0, hwif->dma_master + 0x79); | 900 | outb(0xc0, base + 0x69); |
929 | 901 | ||
930 | /* | 902 | /* |
931 | * Reset the state machines. | 903 | * Reset the state machines. |
932 | * NOTE: avoid accidentally enabling the disabled channels. | 904 | * NOTE: avoid accidentally enabling the disabled channels. |
933 | */ | 905 | */ |
934 | outb(inb(hwif->dma_master + 0x70) | 0x32, hwif->dma_master + 0x70); | 906 | outb(inb(base + 0x60) | 0x32, base + 0x60); |
935 | outb(inb(hwif->dma_master + 0x74) | 0x32, hwif->dma_master + 0x74); | 907 | outb(inb(base + 0x64) | 0x32, base + 0x64); |
936 | 908 | ||
937 | /* Complete reset */ | 909 | /* Complete reset */ |
938 | outb(0x00, hwif->dma_master + 0x79); | 910 | outb(0x00, base + 0x69); |
939 | 911 | ||
940 | /* Reconnect channels to bus */ | 912 | /* Reconnect channels to bus */ |
941 | outb(0x00, hwif->dma_master + 0x73); | 913 | outb(0x00, base + 0x63); |
942 | outb(0x00, hwif->dma_master + 0x77); | 914 | outb(0x00, base + 0x67); |
943 | } | 915 | } |
944 | 916 | ||
945 | /** | 917 | /** |
@@ -1210,7 +1182,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1210 | * We also don't like using the DPLL because this causes glitches | 1182 | * We also don't like using the DPLL because this causes glitches |
1211 | * on PRST-/SRST- when the state engine gets reset... | 1183 | * on PRST-/SRST- when the state engine gets reset... |
1212 | */ | 1184 | */ |
1213 | if (chip_type >= HPT374 || info->settings[clock] == NULL) { | 1185 | if (chip_type >= HPT374 || info->timings->clock_table[clock] == NULL) { |
1214 | u16 f_low, delta = pci_clk < 50 ? 2 : 4; | 1186 | u16 f_low, delta = pci_clk < 50 ? 2 : 4; |
1215 | int adjust; | 1187 | int adjust; |
1216 | 1188 | ||
@@ -1226,7 +1198,7 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1226 | clock = ATA_CLOCK_50MHZ; | 1198 | clock = ATA_CLOCK_50MHZ; |
1227 | } | 1199 | } |
1228 | 1200 | ||
1229 | if (info->settings[clock] == NULL) { | 1201 | if (info->timings->clock_table[clock] == NULL) { |
1230 | printk(KERN_ERR "%s: unknown bus timing!\n", name); | 1202 | printk(KERN_ERR "%s: unknown bus timing!\n", name); |
1231 | kfree(info); | 1203 | kfree(info); |
1232 | return -EIO; | 1204 | return -EIO; |
@@ -1267,15 +1239,10 @@ static unsigned int __devinit init_chipset_hpt366(struct pci_dev *dev, const cha | |||
1267 | printk("%s: using %d MHz PCI clock\n", name, pci_clk); | 1239 | printk("%s: using %d MHz PCI clock\n", name, pci_clk); |
1268 | } | 1240 | } |
1269 | 1241 | ||
1270 | /* | ||
1271 | * Advance the table pointer to a slot which points to the list | ||
1272 | * of the register values settings matching the clock being used. | ||
1273 | */ | ||
1274 | info->settings += clock; | ||
1275 | |||
1276 | /* Store the clock frequencies. */ | 1242 | /* Store the clock frequencies. */ |
1277 | info->dpll_clk = dpll_clk; | 1243 | info->dpll_clk = dpll_clk; |
1278 | info->pci_clk = pci_clk; | 1244 | info->pci_clk = pci_clk; |
1245 | info->clock = clock; | ||
1279 | 1246 | ||
1280 | /* Point to this chip's own instance of the hpt_info structure. */ | 1247 | /* Point to this chip's own instance of the hpt_info structure. */ |
1281 | pci_set_drvdata(dev, info); | 1248 | pci_set_drvdata(dev, info); |
@@ -1320,8 +1287,8 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) | |||
1320 | 1287 | ||
1321 | hwif->set_pio_mode = &hpt3xx_set_pio_mode; | 1288 | hwif->set_pio_mode = &hpt3xx_set_pio_mode; |
1322 | hwif->set_dma_mode = &hpt3xx_set_mode; | 1289 | hwif->set_dma_mode = &hpt3xx_set_mode; |
1290 | |||
1323 | hwif->quirkproc = &hpt3xx_quirkproc; | 1291 | hwif->quirkproc = &hpt3xx_quirkproc; |
1324 | hwif->intrproc = &hpt3xx_intrproc; | ||
1325 | hwif->maskproc = &hpt3xx_maskproc; | 1292 | hwif->maskproc = &hpt3xx_maskproc; |
1326 | hwif->busproc = &hpt3xx_busproc; | 1293 | hwif->busproc = &hpt3xx_busproc; |
1327 | 1294 | ||
@@ -1494,6 +1461,11 @@ static int __devinit hpt36x_init(struct pci_dev *dev, struct pci_dev *dev2) | |||
1494 | return 0; | 1461 | return 0; |
1495 | } | 1462 | } |
1496 | 1463 | ||
1464 | #define IDE_HFLAGS_HPT3XX \ | ||
1465 | (IDE_HFLAG_NO_ATAPI_DMA | \ | ||
1466 | IDE_HFLAG_ABUSE_SET_DMA_MODE | \ | ||
1467 | IDE_HFLAG_OFF_BOARD) | ||
1468 | |||
1497 | static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | 1469 | static const struct ide_port_info hpt366_chipsets[] __devinitdata = { |
1498 | { /* 0 */ | 1470 | { /* 0 */ |
1499 | .name = "HPT36x", | 1471 | .name = "HPT36x", |
@@ -1508,9 +1480,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1508 | */ | 1480 | */ |
1509 | .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}}, | 1481 | .enablebits = {{0x50,0x10,0x10}, {0x54,0x04,0x04}}, |
1510 | .extra = 240, | 1482 | .extra = 240, |
1511 | .host_flags = IDE_HFLAG_SINGLE | | 1483 | .host_flags = IDE_HFLAGS_HPT3XX | IDE_HFLAG_SINGLE, |
1512 | IDE_HFLAG_NO_ATAPI_DMA | | ||
1513 | IDE_HFLAG_OFF_BOARD, | ||
1514 | .pio_mask = ATA_PIO4, | 1484 | .pio_mask = ATA_PIO4, |
1515 | .mwdma_mask = ATA_MWDMA2, | 1485 | .mwdma_mask = ATA_MWDMA2, |
1516 | },{ /* 1 */ | 1486 | },{ /* 1 */ |
@@ -1520,7 +1490,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1520 | .init_dma = init_dma_hpt366, | 1490 | .init_dma = init_dma_hpt366, |
1521 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, | 1491 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, |
1522 | .extra = 240, | 1492 | .extra = 240, |
1523 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, | 1493 | .host_flags = IDE_HFLAGS_HPT3XX, |
1524 | .pio_mask = ATA_PIO4, | 1494 | .pio_mask = ATA_PIO4, |
1525 | .mwdma_mask = ATA_MWDMA2, | 1495 | .mwdma_mask = ATA_MWDMA2, |
1526 | },{ /* 2 */ | 1496 | },{ /* 2 */ |
@@ -1530,7 +1500,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1530 | .init_dma = init_dma_hpt366, | 1500 | .init_dma = init_dma_hpt366, |
1531 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, | 1501 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, |
1532 | .extra = 240, | 1502 | .extra = 240, |
1533 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, | 1503 | .host_flags = IDE_HFLAGS_HPT3XX, |
1534 | .pio_mask = ATA_PIO4, | 1504 | .pio_mask = ATA_PIO4, |
1535 | .mwdma_mask = ATA_MWDMA2, | 1505 | .mwdma_mask = ATA_MWDMA2, |
1536 | },{ /* 3 */ | 1506 | },{ /* 3 */ |
@@ -1540,7 +1510,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1540 | .init_dma = init_dma_hpt366, | 1510 | .init_dma = init_dma_hpt366, |
1541 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, | 1511 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, |
1542 | .extra = 240, | 1512 | .extra = 240, |
1543 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, | 1513 | .host_flags = IDE_HFLAGS_HPT3XX, |
1544 | .pio_mask = ATA_PIO4, | 1514 | .pio_mask = ATA_PIO4, |
1545 | .mwdma_mask = ATA_MWDMA2, | 1515 | .mwdma_mask = ATA_MWDMA2, |
1546 | },{ /* 4 */ | 1516 | },{ /* 4 */ |
@@ -1551,7 +1521,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1551 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, | 1521 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, |
1552 | .udma_mask = ATA_UDMA5, | 1522 | .udma_mask = ATA_UDMA5, |
1553 | .extra = 240, | 1523 | .extra = 240, |
1554 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, | 1524 | .host_flags = IDE_HFLAGS_HPT3XX, |
1555 | .pio_mask = ATA_PIO4, | 1525 | .pio_mask = ATA_PIO4, |
1556 | .mwdma_mask = ATA_MWDMA2, | 1526 | .mwdma_mask = ATA_MWDMA2, |
1557 | },{ /* 5 */ | 1527 | },{ /* 5 */ |
@@ -1561,7 +1531,7 @@ static const struct ide_port_info hpt366_chipsets[] __devinitdata = { | |||
1561 | .init_dma = init_dma_hpt366, | 1531 | .init_dma = init_dma_hpt366, |
1562 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, | 1532 | .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, |
1563 | .extra = 240, | 1533 | .extra = 240, |
1564 | .host_flags = IDE_HFLAG_NO_ATAPI_DMA | IDE_HFLAG_OFF_BOARD, | 1534 | .host_flags = IDE_HFLAGS_HPT3XX, |
1565 | .pio_mask = ATA_PIO4, | 1535 | .pio_mask = ATA_PIO4, |
1566 | .mwdma_mask = ATA_MWDMA2, | 1536 | .mwdma_mask = ATA_MWDMA2, |
1567 | } | 1537 | } |