aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/pata_hpt366.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/pata_hpt366.c')
-rw-r--r--drivers/ata/pata_hpt366.c59
1 files changed, 21 insertions, 38 deletions
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index d7f2da127d13..af49bfb57247 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -11,9 +11,7 @@
11 * 11 *
12 * 12 *
13 * TODO 13 * TODO
14 * Maybe PLL mode 14 * Look into engine reset on timeout errors. Should not be required.
15 * Look into engine reset on timeout errors. Should not be
16 * required.
17 */ 15 */
18 16
19 17
@@ -27,7 +25,7 @@
27#include <linux/libata.h> 25#include <linux/libata.h>
28 26
29#define DRV_NAME "pata_hpt366" 27#define DRV_NAME "pata_hpt366"
30#define DRV_VERSION "0.6.2" 28#define DRV_VERSION "0.6.8"
31 29
32struct hpt_clock { 30struct hpt_clock {
33 u8 xfer_mode; 31 u8 xfer_mode;
@@ -36,24 +34,22 @@ struct hpt_clock {
36 34
37/* key for bus clock timings 35/* key for bus clock timings
38 * bit 36 * bit
39 * 0:3 data_high_time. inactive time of DIOW_/DIOR_ for PIO and MW 37 * 0:3 data_high_time. Inactive time of DIOW_/DIOR_ for PIO and MW DMA.
40 * DMA. cycles = value + 1 38 * cycles = value + 1
41 * 4:8 data_low_time. active time of DIOW_/DIOR_ for PIO and MW 39 * 4:7 data_low_time. Active time of DIOW_/DIOR_ for PIO and MW DMA.
42 * DMA. cycles = value + 1 40 * cycles = value + 1
43 * 9:12 cmd_high_time. inactive time of DIOW_/DIOR_ during task file 41 * 8:11 cmd_high_time. Inactive time of DIOW_/DIOR_ during task file
44 * register access. 42 * register access.
45 * 13:17 cmd_low_time. active time of DIOW_/DIOR_ during task file 43 * 12:15 cmd_low_time. Active time of DIOW_/DIOR_ during task file
46 * register access. 44 * register access.
47 * 18:21 udma_cycle_time. clock freq and clock cycles for UDMA xfer. 45 * 16:18 udma_cycle_time. Clock cycles for UDMA xfer?
48 * during task file register access. 46 * 19:21 pre_high_time. Time to initialize 1st cycle for PIO and MW DMA xfer.
49 * 22:24 pre_high_time. time to initialize 1st cycle for PIO and MW DMA 47 * 22:24 cmd_pre_high_time. Time to initialize 1st PIO cycle for task file
50 * xfer.
51 * 25:27 cmd_pre_high_time. time to initialize 1st PIO cycle for task
52 * register access. 48 * register access.
53 * 28 UDMA enable 49 * 28 UDMA enable.
54 * 29 DMA enable 50 * 29 DMA enable.
55 * 30 PIO_MST enable. if set, the chip is in bus master mode during 51 * 30 PIO_MST enable. If set, the chip is in bus master mode during
56 * PIO. 52 * PIO xfer.
57 * 31 FIFO enable. 53 * 31 FIFO enable.
58 */ 54 */
59 55
@@ -209,17 +205,8 @@ static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev,
209{ 205{
210 struct hpt_clock *clocks = ap->host->private_data; 206 struct hpt_clock *clocks = ap->host->private_data;
211 struct pci_dev *pdev = to_pci_dev(ap->host->dev); 207 struct pci_dev *pdev = to_pci_dev(ap->host->dev);
212 u32 addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no); 208 u32 addr = 0x40 + 4 * adev->devno;
213 u32 addr2 = 0x51 + 4 * ap->port_no;
214 u32 mask, reg; 209 u32 mask, reg;
215 u8 fast;
216
217 /* Fast interrupt prediction disable, hold off interrupt disable */
218 pci_read_config_byte(pdev, addr2, &fast);
219 if (fast & 0x80) {
220 fast &= ~0x80;
221 pci_write_config_byte(pdev, addr2, fast);
222 }
223 210
224 /* determine timing mask and find matching clock entry */ 211 /* determine timing mask and find matching clock entry */
225 if (mode < XFER_MW_DMA_0) 212 if (mode < XFER_MW_DMA_0)
@@ -242,9 +229,9 @@ static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev,
242 * on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid 229 * on-chip PIO FIFO/buffer (and PIO MST mode as well) to avoid
243 * problems handling I/O errors later. 230 * problems handling I/O errors later.
244 */ 231 */
245 pci_read_config_dword(pdev, addr1, &reg); 232 pci_read_config_dword(pdev, addr, &reg);
246 reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000; 233 reg = ((reg & ~mask) | (clocks->timing & mask)) & ~0xc0000000;
247 pci_write_config_dword(pdev, addr1, reg); 234 pci_write_config_dword(pdev, addr, reg);
248} 235}
249 236
250/** 237/**
@@ -344,7 +331,6 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
344 const struct ata_port_info *ppi[] = { &info_hpt366, NULL }; 331 const struct ata_port_info *ppi[] = { &info_hpt366, NULL };
345 332
346 void *hpriv = NULL; 333 void *hpriv = NULL;
347 u32 class_rev;
348 u32 reg1; 334 u32 reg1;
349 int rc; 335 int rc;
350 336
@@ -352,13 +338,10 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
352 if (rc) 338 if (rc)
353 return rc; 339 return rc;
354 340
355 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
356 class_rev &= 0xFF;
357
358 /* May be a later chip in disguise. Check */ 341 /* May be a later chip in disguise. Check */
359 /* Newer chips are not in the HPT36x driver. Ignore them */ 342 /* Newer chips are not in the HPT36x driver. Ignore them */
360 if (class_rev > 2) 343 if (dev->revision > 2)
361 return -ENODEV; 344 return -ENODEV;
362 345
363 hpt36x_init_chipset(dev); 346 hpt36x_init_chipset(dev);
364 347
@@ -378,7 +361,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
378 break; 361 break;
379 } 362 }
380 /* Now kick off ATA set up */ 363 /* Now kick off ATA set up */
381 return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv); 364 return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv, 0);
382} 365}
383 366
384#ifdef CONFIG_PM 367#ifdef CONFIG_PM