aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt37x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_hpt37x.c')
-rw-r--r--drivers/ata/pata_hpt37x.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 5a0a410654e2..6446735a46e0 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -26,7 +26,7 @@
26#include <linux/libata.h> 26#include <linux/libata.h>
27 27
28#define DRV_NAME "pata_hpt37x" 28#define DRV_NAME "pata_hpt37x"
29#define DRV_VERSION "0.6.5" 29#define DRV_VERSION "0.6.6"
30 30
31struct hpt_clock { 31struct hpt_clock {
32 u8 xfer_speed; 32 u8 xfer_speed;
@@ -931,15 +931,6 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
931 .udma_mask = 0x7f, 931 .udma_mask = 0x7f,
932 .port_ops = &hpt372_port_ops 932 .port_ops = &hpt372_port_ops
933 }; 933 };
934 /* HPT371, 372 and friends - UDMA100 at 50MHz clock */
935 static const struct ata_port_info info_hpt372_50 = {
936 .sht = &hpt37x_sht,
937 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
938 .pio_mask = 0x1f,
939 .mwdma_mask = 0x07,
940 .udma_mask = 0x3f,
941 .port_ops = &hpt372_port_ops
942 };
943 /* HPT374 - UDMA133 */ 934 /* HPT374 - UDMA133 */
944 static const struct ata_port_info info_hpt374 = { 935 static const struct ata_port_info info_hpt374 = {
945 .sht = &hpt37x_sht, 936 .sht = &hpt37x_sht,
@@ -961,7 +952,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
961 u8 mcr1; 952 u8 mcr1;
962 u32 freq; 953 u32 freq;
963 int prefer_dpll = 1; 954 int prefer_dpll = 1;
964 955
965 unsigned long iobase = pci_resource_start(dev, 4); 956 unsigned long iobase = pci_resource_start(dev, 4);
966 957
967 const struct hpt_chip *chip_table; 958 const struct hpt_chip *chip_table;
@@ -1055,7 +1046,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1055 */ 1046 */
1056 1047
1057 pci_write_config_byte(dev, 0x5b, 0x23); 1048 pci_write_config_byte(dev, 0x5b, 0x23);
1058 1049
1059 /* 1050 /*
1060 * HighPoint does this for HPT372A. 1051 * HighPoint does this for HPT372A.
1061 * NOTE: This register is only writeable via I/O space. 1052 * NOTE: This register is only writeable via I/O space.
@@ -1088,7 +1079,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1088 * Turn the frequency check into a band and then find a timing 1079 * Turn the frequency check into a band and then find a timing
1089 * table to match it. 1080 * table to match it.
1090 */ 1081 */
1091 1082
1092 clock_slot = hpt37x_clock_slot(freq, chip_table->base); 1083 clock_slot = hpt37x_clock_slot(freq, chip_table->base);
1093 if (chip_table->clocks[clock_slot] == NULL || prefer_dpll) { 1084 if (chip_table->clocks[clock_slot] == NULL || prefer_dpll) {
1094 /* 1085 /*
@@ -1098,17 +1089,21 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1098 * use a 50MHz DPLL by choice 1089 * use a 50MHz DPLL by choice
1099 */ 1090 */
1100 unsigned int f_low, f_high; 1091 unsigned int f_low, f_high;
1101 int adjust; 1092 int dpll, adjust;
1102 1093
1103 clock_slot = 2; 1094 /* Compute DPLL */
1095 dpll = 2;
1104 if (port->udma_mask & 0xE0) 1096 if (port->udma_mask & 0xE0)
1105 clock_slot = 3; 1097 dpll = 3;
1106 1098
1107 f_low = (MHz[clock_slot] * chip_table->base) / 192; 1099 f_low = (MHz[clock_slot] * 48) / MHz[dpll];
1108 f_high = f_low + 2; 1100 f_high = f_low + 2;
1101 if (clock_slot > 1)
1102 f_high += 2;
1109 1103
1110 /* Select the DPLL clock. */ 1104 /* Select the DPLL clock. */
1111 pci_write_config_byte(dev, 0x5b, 0x21); 1105 pci_write_config_byte(dev, 0x5b, 0x21);
1106 pci_write_config_dword(dev, 0x5C, (f_high << 16) | f_low);
1112 1107
1113 for(adjust = 0; adjust < 8; adjust++) { 1108 for(adjust = 0; adjust < 8; adjust++) {
1114 if (hpt37x_calibrate_dpll(dev)) 1109 if (hpt37x_calibrate_dpll(dev))
@@ -1124,12 +1119,12 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
1124 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n"); 1119 printk(KERN_WARNING "hpt37x: DPLL did not stabilize.\n");
1125 return -ENODEV; 1120 return -ENODEV;
1126 } 1121 }
1127 if (clock_slot == 3) 1122 if (dpll == 3)
1128 private_data = (void *)hpt37x_timings_66; 1123 private_data = (void *)hpt37x_timings_66;
1129 else 1124 else
1130 private_data = (void *)hpt37x_timings_50; 1125 private_data = (void *)hpt37x_timings_50;
1131 1126
1132 printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[clock_slot]); 1127 printk(KERN_INFO "hpt37x: Bus clock %dMHz, using DPLL.\n", MHz[dpll]);
1133 } else { 1128 } else {
1134 private_data = (void *)chip_table->clocks[clock_slot]; 1129 private_data = (void *)chip_table->clocks[clock_slot];
1135 /* 1130 /*