diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:22:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:22:33 -0500 |
commit | 1542dec1c9109fdcd1c53460f064096f24fc49d2 (patch) | |
tree | 6b100234ff75d462817b948772f5f62aebcf0503 /drivers/ata/pata_hpt37x.c | |
parent | facc7a96d443d84060a8679c3fcc51d20d4981c3 (diff) | |
parent | 2ad2c320a107aceeba984f97ab2a60064101f5d5 (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
pata_platform: Remove CONFIG_HAVE_PATA_PLATFORM's dependencies.
pata_hpt37x: actually limit HPT370 to UltraDMA/66
pata_hpt3x2n: coding style cleanup
pata_hpt37x: coding style cleanup
pata_hpt366: coding style cleanup
pata_hpt3x2n: calculate average f_CNT
pata_hpt3x2n: clarify about HPT371N support
pata_hpt{37x|3x2n}: SATA mode filtering
[libata] avoid needlessly passing around ptr to SCSI completion func
[libata] new driver acard_ahci, for ATP8620 host controller
Diffstat (limited to 'drivers/ata/pata_hpt37x.c')
-rw-r--r-- | drivers/ata/pata_hpt37x.c | 236 |
1 files changed, 145 insertions, 91 deletions
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 9ae4c0830577..efdd18bc8663 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> | 8 | * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> |
9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. | 9 | * Portions Copyright (C) 2001 Sun Microsystems, Inc. |
10 | * Portions Copyright (C) 2003 Red Hat Inc | 10 | * Portions Copyright (C) 2003 Red Hat Inc |
11 | * Portions Copyright (C) 2005-2009 MontaVista Software, Inc. | 11 | * Portions Copyright (C) 2005-2010 MontaVista Software, Inc. |
12 | * | 12 | * |
13 | * TODO | 13 | * TODO |
14 | * Look into engine reset on timeout errors. Should not be required. | 14 | * Look into engine reset on timeout errors. Should not be required. |
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/libata.h> | 24 | #include <linux/libata.h> |
25 | 25 | ||
26 | #define DRV_NAME "pata_hpt37x" | 26 | #define DRV_NAME "pata_hpt37x" |
27 | #define DRV_VERSION "0.6.15" | 27 | #define DRV_VERSION "0.6.18" |
28 | 28 | ||
29 | struct hpt_clock { | 29 | struct hpt_clock { |
30 | u8 xfer_speed; | 30 | u8 xfer_speed; |
@@ -210,7 +210,7 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed) | |||
210 | { | 210 | { |
211 | struct hpt_clock *clocks = ap->host->private_data; | 211 | struct hpt_clock *clocks = ap->host->private_data; |
212 | 212 | ||
213 | while(clocks->xfer_speed) { | 213 | while (clocks->xfer_speed) { |
214 | if (clocks->xfer_speed == speed) | 214 | if (clocks->xfer_speed == speed) |
215 | return clocks->timing; | 215 | return clocks->timing; |
216 | clocks++; | 216 | clocks++; |
@@ -219,7 +219,8 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed) | |||
219 | return 0xffffffffU; /* silence compiler warning */ | 219 | return 0xffffffffU; /* silence compiler warning */ |
220 | } | 220 | } |
221 | 221 | ||
222 | static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[]) | 222 | static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, |
223 | const char * const list[]) | ||
223 | { | 224 | { |
224 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; | 225 | unsigned char model_num[ATA_ID_PROD_LEN + 1]; |
225 | int i = 0; | 226 | int i = 0; |
@@ -237,18 +238,23 @@ static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, cons | |||
237 | return 0; | 238 | return 0; |
238 | } | 239 | } |
239 | 240 | ||
240 | static const char *bad_ata33[] = { | 241 | static const char * const bad_ata33[] = { |
241 | "Maxtor 92720U8", "Maxtor 92040U6", "Maxtor 91360U4", "Maxtor 91020U3", "Maxtor 90845U3", "Maxtor 90650U2", | 242 | "Maxtor 92720U8", "Maxtor 92040U6", "Maxtor 91360U4", "Maxtor 91020U3", |
242 | "Maxtor 91360D8", "Maxtor 91190D7", "Maxtor 91020D6", "Maxtor 90845D5", "Maxtor 90680D4", "Maxtor 90510D3", "Maxtor 90340D2", | 243 | "Maxtor 90845U3", "Maxtor 90650U2", |
243 | "Maxtor 91152D8", "Maxtor 91008D7", "Maxtor 90845D6", "Maxtor 90840D6", "Maxtor 90720D5", "Maxtor 90648D5", "Maxtor 90576D4", | 244 | "Maxtor 91360D8", "Maxtor 91190D7", "Maxtor 91020D6", "Maxtor 90845D5", |
245 | "Maxtor 90680D4", "Maxtor 90510D3", "Maxtor 90340D2", | ||
246 | "Maxtor 91152D8", "Maxtor 91008D7", "Maxtor 90845D6", "Maxtor 90840D6", | ||
247 | "Maxtor 90720D5", "Maxtor 90648D5", "Maxtor 90576D4", | ||
244 | "Maxtor 90510D4", | 248 | "Maxtor 90510D4", |
245 | "Maxtor 90432D3", "Maxtor 90288D2", "Maxtor 90256D2", | 249 | "Maxtor 90432D3", "Maxtor 90288D2", "Maxtor 90256D2", |
246 | "Maxtor 91000D8", "Maxtor 90910D8", "Maxtor 90875D7", "Maxtor 90840D7", "Maxtor 90750D6", "Maxtor 90625D5", "Maxtor 90500D4", | 250 | "Maxtor 91000D8", "Maxtor 90910D8", "Maxtor 90875D7", "Maxtor 90840D7", |
247 | "Maxtor 91728D8", "Maxtor 91512D7", "Maxtor 91303D6", "Maxtor 91080D5", "Maxtor 90845D4", "Maxtor 90680D4", "Maxtor 90648D3", "Maxtor 90432D2", | 251 | "Maxtor 90750D6", "Maxtor 90625D5", "Maxtor 90500D4", |
252 | "Maxtor 91728D8", "Maxtor 91512D7", "Maxtor 91303D6", "Maxtor 91080D5", | ||
253 | "Maxtor 90845D4", "Maxtor 90680D4", "Maxtor 90648D3", "Maxtor 90432D2", | ||
248 | NULL | 254 | NULL |
249 | }; | 255 | }; |
250 | 256 | ||
251 | static const char *bad_ata100_5[] = { | 257 | static const char * const bad_ata100_5[] = { |
252 | "IBM-DTLA-307075", | 258 | "IBM-DTLA-307075", |
253 | "IBM-DTLA-307060", | 259 | "IBM-DTLA-307060", |
254 | "IBM-DTLA-307045", | 260 | "IBM-DTLA-307045", |
@@ -302,6 +308,22 @@ static unsigned long hpt370a_filter(struct ata_device *adev, unsigned long mask) | |||
302 | } | 308 | } |
303 | 309 | ||
304 | /** | 310 | /** |
311 | * hpt372_filter - mode selection filter | ||
312 | * @adev: ATA device | ||
313 | * @mask: mode mask | ||
314 | * | ||
315 | * The Marvell bridge chips used on the HighPoint SATA cards do not seem | ||
316 | * to support the UltraDMA modes 1, 2, and 3 as well as any MWDMA modes... | ||
317 | */ | ||
318 | static unsigned long hpt372_filter(struct ata_device *adev, unsigned long mask) | ||
319 | { | ||
320 | if (ata_id_is_sata(adev->id)) | ||
321 | mask &= ~((0xE << ATA_SHIFT_UDMA) | ATA_MASK_MWDMA); | ||
322 | |||
323 | return mask; | ||
324 | } | ||
325 | |||
326 | /** | ||
305 | * hpt37x_cable_detect - Detect the cable type | 327 | * hpt37x_cable_detect - Detect the cable type |
306 | * @ap: ATA port to detect on | 328 | * @ap: ATA port to detect on |
307 | * | 329 | * |
@@ -373,6 +395,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline) | |||
373 | { 0x50, 1, 0x04, 0x04 }, | 395 | { 0x50, 1, 0x04, 0x04 }, |
374 | { 0x54, 1, 0x04, 0x04 } | 396 | { 0x54, 1, 0x04, 0x04 } |
375 | }; | 397 | }; |
398 | |||
376 | if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) | 399 | if (!pci_test_config_bits(pdev, &hpt37x_enable_bits[ap->port_no])) |
377 | return -ENOENT; | 400 | return -ENOENT; |
378 | 401 | ||
@@ -586,11 +609,11 @@ static struct ata_port_operations hpt370a_port_ops = { | |||
586 | }; | 609 | }; |
587 | 610 | ||
588 | /* | 611 | /* |
589 | * Configuration for HPT372, HPT371, HPT302. Slightly different PIO | 612 | * Configuration for HPT371 and HPT302. Slightly different PIO and DMA |
590 | * and DMA mode setting functionality. | 613 | * mode setting functionality. |
591 | */ | 614 | */ |
592 | 615 | ||
593 | static struct ata_port_operations hpt372_port_ops = { | 616 | static struct ata_port_operations hpt302_port_ops = { |
594 | .inherits = &ata_bmdma_port_ops, | 617 | .inherits = &ata_bmdma_port_ops, |
595 | 618 | ||
596 | .bmdma_stop = hpt37x_bmdma_stop, | 619 | .bmdma_stop = hpt37x_bmdma_stop, |
@@ -602,7 +625,17 @@ static struct ata_port_operations hpt372_port_ops = { | |||
602 | }; | 625 | }; |
603 | 626 | ||
604 | /* | 627 | /* |
605 | * Configuration for HPT374. Mode setting works like 372 and friends | 628 | * Configuration for HPT372. Mode setting works like 371 and 302 |
629 | * but we have a mode filter. | ||
630 | */ | ||
631 | |||
632 | static struct ata_port_operations hpt372_port_ops = { | ||
633 | .inherits = &hpt302_port_ops, | ||
634 | .mode_filter = hpt372_filter, | ||
635 | }; | ||
636 | |||
637 | /* | ||
638 | * Configuration for HPT374. Mode setting and filtering works like 372 | ||
606 | * but we have a different cable detection procedure for function 1. | 639 | * but we have a different cable detection procedure for function 1. |
607 | */ | 640 | */ |
608 | 641 | ||
@@ -647,12 +680,12 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) | |||
647 | u32 reg5c; | 680 | u32 reg5c; |
648 | int tries; | 681 | int tries; |
649 | 682 | ||
650 | for(tries = 0; tries < 0x5000; tries++) { | 683 | for (tries = 0; tries < 0x5000; tries++) { |
651 | udelay(50); | 684 | udelay(50); |
652 | pci_read_config_byte(dev, 0x5b, ®5b); | 685 | pci_read_config_byte(dev, 0x5b, ®5b); |
653 | if (reg5b & 0x80) { | 686 | if (reg5b & 0x80) { |
654 | /* See if it stays set */ | 687 | /* See if it stays set */ |
655 | for(tries = 0; tries < 0x1000; tries ++) { | 688 | for (tries = 0; tries < 0x1000; tries++) { |
656 | pci_read_config_byte(dev, 0x5b, ®5b); | 689 | pci_read_config_byte(dev, 0x5b, ®5b); |
657 | /* Failed ? */ | 690 | /* Failed ? */ |
658 | if ((reg5b & 0x80) == 0) | 691 | if ((reg5b & 0x80) == 0) |
@@ -660,7 +693,7 @@ static int hpt37x_calibrate_dpll(struct pci_dev *dev) | |||
660 | } | 693 | } |
661 | /* Turn off tuning, we have the DPLL set */ | 694 | /* Turn off tuning, we have the DPLL set */ |
662 | pci_read_config_dword(dev, 0x5c, ®5c); | 695 | pci_read_config_dword(dev, 0x5c, ®5c); |
663 | pci_write_config_dword(dev, 0x5c, reg5c & ~ 0x100); | 696 | pci_write_config_dword(dev, 0x5c, reg5c & ~0x100); |
664 | return 1; | 697 | return 1; |
665 | } | 698 | } |
666 | } | 699 | } |
@@ -672,6 +705,7 @@ static u32 hpt374_read_freq(struct pci_dev *pdev) | |||
672 | { | 705 | { |
673 | u32 freq; | 706 | u32 freq; |
674 | unsigned long io_base = pci_resource_start(pdev, 4); | 707 | unsigned long io_base = pci_resource_start(pdev, 4); |
708 | |||
675 | if (PCI_FUNC(pdev->devfn) & 1) { | 709 | if (PCI_FUNC(pdev->devfn) & 1) { |
676 | struct pci_dev *pdev_0; | 710 | struct pci_dev *pdev_0; |
677 | 711 | ||
@@ -737,23 +771,23 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
737 | .udma_mask = ATA_UDMA5, | 771 | .udma_mask = ATA_UDMA5, |
738 | .port_ops = &hpt370a_port_ops | 772 | .port_ops = &hpt370a_port_ops |
739 | }; | 773 | }; |
740 | /* HPT370 - UDMA100 */ | 774 | /* HPT370 - UDMA66 */ |
741 | static const struct ata_port_info info_hpt370_33 = { | 775 | static const struct ata_port_info info_hpt370_33 = { |
742 | .flags = ATA_FLAG_SLAVE_POSS, | 776 | .flags = ATA_FLAG_SLAVE_POSS, |
743 | .pio_mask = ATA_PIO4, | 777 | .pio_mask = ATA_PIO4, |
744 | .mwdma_mask = ATA_MWDMA2, | 778 | .mwdma_mask = ATA_MWDMA2, |
745 | .udma_mask = ATA_UDMA5, | 779 | .udma_mask = ATA_UDMA4, |
746 | .port_ops = &hpt370_port_ops | 780 | .port_ops = &hpt370_port_ops |
747 | }; | 781 | }; |
748 | /* HPT370A - UDMA100 */ | 782 | /* HPT370A - UDMA66 */ |
749 | static const struct ata_port_info info_hpt370a_33 = { | 783 | static const struct ata_port_info info_hpt370a_33 = { |
750 | .flags = ATA_FLAG_SLAVE_POSS, | 784 | .flags = ATA_FLAG_SLAVE_POSS, |
751 | .pio_mask = ATA_PIO4, | 785 | .pio_mask = ATA_PIO4, |
752 | .mwdma_mask = ATA_MWDMA2, | 786 | .mwdma_mask = ATA_MWDMA2, |
753 | .udma_mask = ATA_UDMA5, | 787 | .udma_mask = ATA_UDMA4, |
754 | .port_ops = &hpt370a_port_ops | 788 | .port_ops = &hpt370a_port_ops |
755 | }; | 789 | }; |
756 | /* HPT371, 372 and friends - UDMA133 */ | 790 | /* HPT372 - UDMA133 */ |
757 | static const struct ata_port_info info_hpt372 = { | 791 | static const struct ata_port_info info_hpt372 = { |
758 | .flags = ATA_FLAG_SLAVE_POSS, | 792 | .flags = ATA_FLAG_SLAVE_POSS, |
759 | .pio_mask = ATA_PIO4, | 793 | .pio_mask = ATA_PIO4, |
@@ -761,6 +795,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
761 | .udma_mask = ATA_UDMA6, | 795 | .udma_mask = ATA_UDMA6, |
762 | .port_ops = &hpt372_port_ops | 796 | .port_ops = &hpt372_port_ops |
763 | }; | 797 | }; |
798 | /* HPT371, 302 - UDMA133 */ | ||
799 | static const struct ata_port_info info_hpt302 = { | ||
800 | .flags = ATA_FLAG_SLAVE_POSS, | ||
801 | .pio_mask = ATA_PIO4, | ||
802 | .mwdma_mask = ATA_MWDMA2, | ||
803 | .udma_mask = ATA_UDMA6, | ||
804 | .port_ops = &hpt302_port_ops | ||
805 | }; | ||
764 | /* HPT374 - UDMA100, function 1 uses different prereset method */ | 806 | /* HPT374 - UDMA100, function 1 uses different prereset method */ |
765 | static const struct ata_port_info info_hpt374_fn0 = { | 807 | static const struct ata_port_info info_hpt374_fn0 = { |
766 | .flags = ATA_FLAG_SLAVE_POSS, | 808 | .flags = ATA_FLAG_SLAVE_POSS, |
@@ -805,64 +847,68 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
805 | if (rev == 6) | 847 | if (rev == 6) |
806 | return -ENODEV; | 848 | return -ENODEV; |
807 | 849 | ||
808 | switch(rev) { | 850 | switch (rev) { |
809 | case 3: | 851 | case 3: |
810 | ppi[0] = &info_hpt370; | 852 | ppi[0] = &info_hpt370; |
811 | chip_table = &hpt370; | 853 | chip_table = &hpt370; |
812 | prefer_dpll = 0; | 854 | prefer_dpll = 0; |
813 | break; | 855 | break; |
814 | case 4: | 856 | case 4: |
815 | ppi[0] = &info_hpt370a; | 857 | ppi[0] = &info_hpt370a; |
816 | chip_table = &hpt370a; | 858 | chip_table = &hpt370a; |
817 | prefer_dpll = 0; | 859 | prefer_dpll = 0; |
818 | break; | 860 | break; |
819 | case 5: | 861 | case 5: |
820 | ppi[0] = &info_hpt372; | 862 | ppi[0] = &info_hpt372; |
821 | chip_table = &hpt372; | 863 | chip_table = &hpt372; |
822 | break; | 864 | break; |
823 | default: | 865 | default: |
824 | printk(KERN_ERR "pata_hpt37x: Unknown HPT366 " | 866 | printk(KERN_ERR "pata_hpt37x: Unknown HPT366 subtype, " |
825 | "subtype, please report (%d).\n", rev); | 867 | "please report (%d).\n", rev); |
826 | return -ENODEV; | 868 | return -ENODEV; |
827 | } | 869 | } |
828 | } else { | 870 | } else { |
829 | switch(dev->device) { | 871 | switch (dev->device) { |
830 | case PCI_DEVICE_ID_TTI_HPT372: | 872 | case PCI_DEVICE_ID_TTI_HPT372: |
831 | /* 372N if rev >= 2*/ | 873 | /* 372N if rev >= 2 */ |
832 | if (rev >= 2) | 874 | if (rev >= 2) |
833 | return -ENODEV; | 875 | return -ENODEV; |
834 | ppi[0] = &info_hpt372; | 876 | ppi[0] = &info_hpt372; |
835 | chip_table = &hpt372a; | 877 | chip_table = &hpt372a; |
836 | break; | 878 | break; |
837 | case PCI_DEVICE_ID_TTI_HPT302: | 879 | case PCI_DEVICE_ID_TTI_HPT302: |
838 | /* 302N if rev > 1 */ | 880 | /* 302N if rev > 1 */ |
839 | if (rev > 1) | 881 | if (rev > 1) |
840 | return -ENODEV; | 882 | return -ENODEV; |
841 | ppi[0] = &info_hpt372; | 883 | ppi[0] = &info_hpt302; |
842 | /* Check this */ | 884 | /* Check this */ |
843 | chip_table = &hpt302; | 885 | chip_table = &hpt302; |
844 | break; | 886 | break; |
845 | case PCI_DEVICE_ID_TTI_HPT371: | 887 | case PCI_DEVICE_ID_TTI_HPT371: |
846 | if (rev > 1) | 888 | if (rev > 1) |
847 | return -ENODEV; | 889 | return -ENODEV; |
848 | ppi[0] = &info_hpt372; | 890 | ppi[0] = &info_hpt302; |
849 | chip_table = &hpt371; | 891 | chip_table = &hpt371; |
850 | /* Single channel device, master is not present | 892 | /* |
851 | but the BIOS (or us for non x86) must mark it | 893 | * Single channel device, master is not present |
852 | absent */ | 894 | * but the BIOS (or us for non x86) must mark it |
853 | pci_read_config_byte(dev, 0x50, &mcr1); | 895 | * absent |
854 | mcr1 &= ~0x04; | 896 | */ |
855 | pci_write_config_byte(dev, 0x50, mcr1); | 897 | pci_read_config_byte(dev, 0x50, &mcr1); |
856 | break; | 898 | mcr1 &= ~0x04; |
857 | case PCI_DEVICE_ID_TTI_HPT374: | 899 | pci_write_config_byte(dev, 0x50, mcr1); |
858 | chip_table = &hpt374; | 900 | break; |
859 | if (!(PCI_FUNC(dev->devfn) & 1)) | 901 | case PCI_DEVICE_ID_TTI_HPT374: |
860 | *ppi = &info_hpt374_fn0; | 902 | chip_table = &hpt374; |
861 | else | 903 | if (!(PCI_FUNC(dev->devfn) & 1)) |
862 | *ppi = &info_hpt374_fn1; | 904 | *ppi = &info_hpt374_fn0; |
863 | break; | 905 | else |
864 | default: | 906 | *ppi = &info_hpt374_fn1; |
865 | printk(KERN_ERR "pata_hpt37x: PCI table is bogus please report (%d).\n", dev->device); | 907 | break; |
908 | default: | ||
909 | printk(KERN_ERR | ||
910 | "pata_hpt37x: PCI table is bogus, please report (%d).\n", | ||
911 | dev->device); | ||
866 | return -ENODEV; | 912 | return -ENODEV; |
867 | } | 913 | } |
868 | } | 914 | } |
@@ -893,9 +939,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
893 | if (chip_table == &hpt372a) | 939 | if (chip_table == &hpt372a) |
894 | outb(0x0e, iobase + 0x9c); | 940 | outb(0x0e, iobase + 0x9c); |
895 | 941 | ||
896 | /* Some devices do not let this value be accessed via PCI space | 942 | /* |
897 | according to the old driver. In addition we must use the value | 943 | * Some devices do not let this value be accessed via PCI space |
898 | from FN 0 on the HPT374 */ | 944 | * according to the old driver. In addition we must use the value |
945 | * from FN 0 on the HPT374. | ||
946 | */ | ||
899 | 947 | ||
900 | if (chip_table == &hpt374) { | 948 | if (chip_table == &hpt374) { |
901 | freq = hpt374_read_freq(dev); | 949 | freq = hpt374_read_freq(dev); |
@@ -909,10 +957,11 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
909 | u8 sr; | 957 | u8 sr; |
910 | u32 total = 0; | 958 | u32 total = 0; |
911 | 959 | ||
912 | printk(KERN_WARNING "pata_hpt37x: BIOS has not set timing clocks.\n"); | 960 | printk(KERN_WARNING |
961 | "pata_hpt37x: BIOS has not set timing clocks.\n"); | ||
913 | 962 | ||
914 | /* This is the process the HPT371 BIOS is reported to use */ | 963 | /* This is the process the HPT371 BIOS is reported to use */ |
915 | for(i = 0; i < 128; i++) { | 964 | for (i = 0; i < 128; i++) { |
916 | pci_read_config_byte(dev, 0x78, &sr); | 965 | pci_read_config_byte(dev, 0x78, &sr); |
917 | total += sr & 0x1FF; | 966 | total += sr & 0x1FF; |
918 | udelay(15); | 967 | udelay(15); |
@@ -947,17 +996,22 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
947 | 996 | ||
948 | /* Select the DPLL clock. */ | 997 | /* Select the DPLL clock. */ |
949 | pci_write_config_byte(dev, 0x5b, 0x21); | 998 | pci_write_config_byte(dev, 0x5b, 0x21); |
950 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); | 999 | pci_write_config_dword(dev, 0x5C, |
1000 | (f_high << 16) | f_low | 0x100); | ||
951 | 1001 | ||
952 | for(adjust = 0; adjust < 8; adjust++) { | 1002 | for (adjust = 0; adjust < 8; adjust++) { |
953 | if (hpt37x_calibrate_dpll(dev)) | 1003 | if (hpt37x_calibrate_dpll(dev)) |
954 | break; | 1004 | break; |
955 | /* See if it'll settle at a fractionally different clock */ | 1005 | /* |
1006 | * See if it'll settle at a fractionally | ||
1007 | * different clock | ||
1008 | */ | ||
956 | if (adjust & 1) | 1009 | if (adjust & 1) |
957 | f_low -= adjust >> 1; | 1010 | f_low -= adjust >> 1; |
958 | else | 1011 | else |
959 | f_high += adjust >> 1; | 1012 | f_high += adjust >> 1; |
960 | pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low | 0x100); | 1013 | pci_write_config_dword(dev, 0x5C, |
1014 | (f_high << 16) | f_low | 0x100); | ||
961 | } | 1015 | } |
962 | if (adjust == 8) { | 1016 | if (adjust == 8) { |
963 | printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n"); | 1017 | printk(KERN_ERR "pata_hpt37x: DPLL did not stabilize!\n"); |
@@ -976,7 +1030,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
976 | * Perform a final fixup. Note that we will have used the | 1030 | * Perform a final fixup. Note that we will have used the |
977 | * DPLL on the HPT372 which means we don't have to worry | 1031 | * DPLL on the HPT372 which means we don't have to worry |
978 | * about lack of UDMA133 support on lower clocks | 1032 | * about lack of UDMA133 support on lower clocks |
979 | */ | 1033 | */ |
980 | 1034 | ||
981 | if (clock_slot < 2 && ppi[0] == &info_hpt370) | 1035 | if (clock_slot < 2 && ppi[0] == &info_hpt370) |
982 | ppi[0] = &info_hpt370_33; | 1036 | ppi[0] = &info_hpt370_33; |
@@ -1001,9 +1055,9 @@ static const struct pci_device_id hpt37x[] = { | |||
1001 | }; | 1055 | }; |
1002 | 1056 | ||
1003 | static struct pci_driver hpt37x_pci_driver = { | 1057 | static struct pci_driver hpt37x_pci_driver = { |
1004 | .name = DRV_NAME, | 1058 | .name = DRV_NAME, |
1005 | .id_table = hpt37x, | 1059 | .id_table = hpt37x, |
1006 | .probe = hpt37x_init_one, | 1060 | .probe = hpt37x_init_one, |
1007 | .remove = ata_pci_remove_one | 1061 | .remove = ata_pci_remove_one |
1008 | }; | 1062 | }; |
1009 | 1063 | ||