diff options
Diffstat (limited to 'drivers/ata/sata_promise.c')
-rw-r--r-- | drivers/ata/sata_promise.c | 65 |
1 files changed, 12 insertions, 53 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 3be4cc338d7b..cf9ed8c39301 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/blkdev.h> | 37 | #include <linux/blkdev.h> |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/sched.h> | ||
41 | #include <linux/device.h> | 40 | #include <linux/device.h> |
42 | #include <scsi/scsi.h> | 41 | #include <scsi/scsi.h> |
43 | #include <scsi/scsi_host.h> | 42 | #include <scsi/scsi_host.h> |
@@ -120,9 +119,7 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg); | |||
120 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); | 119 | static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); |
121 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); | 120 | static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); |
122 | static irqreturn_t pdc_interrupt (int irq, void *dev_instance); | 121 | static irqreturn_t pdc_interrupt (int irq, void *dev_instance); |
123 | static void pdc_eng_timeout(struct ata_port *ap); | ||
124 | static int pdc_port_start(struct ata_port *ap); | 122 | static int pdc_port_start(struct ata_port *ap); |
125 | static void pdc_pata_phy_reset(struct ata_port *ap); | ||
126 | static void pdc_qc_prep(struct ata_queued_cmd *qc); | 123 | static void pdc_qc_prep(struct ata_queued_cmd *qc); |
127 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 124 | static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
128 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); | 125 | static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); |
@@ -216,12 +213,12 @@ static const struct ata_port_operations pdc_pata_ops = { | |||
216 | .dev_select = ata_std_dev_select, | 213 | .dev_select = ata_std_dev_select, |
217 | .check_atapi_dma = pdc_check_atapi_dma, | 214 | .check_atapi_dma = pdc_check_atapi_dma, |
218 | 215 | ||
219 | .phy_reset = pdc_pata_phy_reset, | ||
220 | |||
221 | .qc_prep = pdc_qc_prep, | 216 | .qc_prep = pdc_qc_prep, |
222 | .qc_issue = pdc_qc_issue_prot, | 217 | .qc_issue = pdc_qc_issue_prot, |
218 | .freeze = pdc_freeze, | ||
219 | .thaw = pdc_thaw, | ||
220 | .error_handler = pdc_error_handler, | ||
223 | .data_xfer = ata_data_xfer, | 221 | .data_xfer = ata_data_xfer, |
224 | .eng_timeout = pdc_eng_timeout, | ||
225 | .irq_handler = pdc_interrupt, | 222 | .irq_handler = pdc_interrupt, |
226 | .irq_clear = pdc_irq_clear, | 223 | .irq_clear = pdc_irq_clear, |
227 | .irq_on = ata_irq_on, | 224 | .irq_on = ata_irq_on, |
@@ -254,7 +251,7 @@ static const struct ata_port_info pdc_port_info[] = { | |||
254 | /* board_20619 */ | 251 | /* board_20619 */ |
255 | { | 252 | { |
256 | .sht = &pdc_ata_sht, | 253 | .sht = &pdc_ata_sht, |
257 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SRST | ATA_FLAG_SLAVE_POSS, | 254 | .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS, |
258 | .pio_mask = 0x1f, /* pio0-4 */ | 255 | .pio_mask = 0x1f, /* pio0-4 */ |
259 | .mwdma_mask = 0x07, /* mwdma0-2 */ | 256 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
260 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ | 257 | .udma_mask = 0x7f, /* udma0-6 ; FIXME */ |
@@ -390,14 +387,6 @@ static void pdc_pata_cbl_detect(struct ata_port *ap) | |||
390 | ap->cbl = ATA_CBL_PATA80; | 387 | ap->cbl = ATA_CBL_PATA80; |
391 | } | 388 | } |
392 | 389 | ||
393 | static void pdc_pata_phy_reset(struct ata_port *ap) | ||
394 | { | ||
395 | pdc_pata_cbl_detect(ap); | ||
396 | pdc_reset_port(ap); | ||
397 | ata_port_probe(ap); | ||
398 | ata_bus_reset(ap); | ||
399 | } | ||
400 | |||
401 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | 390 | static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) |
402 | { | 391 | { |
403 | if (sc_reg > SCR_CONTROL || ap->cbl != ATA_CBL_SATA) | 392 | if (sc_reg > SCR_CONTROL || ap->cbl != ATA_CBL_SATA) |
@@ -565,6 +554,13 @@ static void pdc_thaw(struct ata_port *ap) | |||
565 | readl(mmio + PDC_CTLSTAT); /* flush */ | 554 | readl(mmio + PDC_CTLSTAT); /* flush */ |
566 | } | 555 | } |
567 | 556 | ||
557 | static int pdc_pre_reset(struct ata_port *ap) | ||
558 | { | ||
559 | if (!sata_scr_valid(ap)) | ||
560 | pdc_pata_cbl_detect(ap); | ||
561 | return ata_std_prereset(ap); | ||
562 | } | ||
563 | |||
568 | static void pdc_error_handler(struct ata_port *ap) | 564 | static void pdc_error_handler(struct ata_port *ap) |
569 | { | 565 | { |
570 | ata_reset_fn_t hardreset; | 566 | ata_reset_fn_t hardreset; |
@@ -577,7 +573,7 @@ static void pdc_error_handler(struct ata_port *ap) | |||
577 | hardreset = sata_std_hardreset; | 573 | hardreset = sata_std_hardreset; |
578 | 574 | ||
579 | /* perform recovery */ | 575 | /* perform recovery */ |
580 | ata_do_eh(ap, ata_std_prereset, ata_std_softreset, hardreset, | 576 | ata_do_eh(ap, pdc_pre_reset, ata_std_softreset, hardreset, |
581 | ata_std_postreset); | 577 | ata_std_postreset); |
582 | } | 578 | } |
583 | 579 | ||
@@ -593,43 +589,6 @@ static void pdc_post_internal_cmd(struct ata_queued_cmd *qc) | |||
593 | pdc_reset_port(ap); | 589 | pdc_reset_port(ap); |
594 | } | 590 | } |
595 | 591 | ||
596 | static void pdc_eng_timeout(struct ata_port *ap) | ||
597 | { | ||
598 | struct ata_host *host = ap->host; | ||
599 | u8 drv_stat; | ||
600 | struct ata_queued_cmd *qc; | ||
601 | unsigned long flags; | ||
602 | |||
603 | DPRINTK("ENTER\n"); | ||
604 | |||
605 | spin_lock_irqsave(&host->lock, flags); | ||
606 | |||
607 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
608 | |||
609 | switch (qc->tf.protocol) { | ||
610 | case ATA_PROT_DMA: | ||
611 | case ATA_PROT_NODATA: | ||
612 | ata_port_printk(ap, KERN_ERR, "command timeout\n"); | ||
613 | drv_stat = ata_wait_idle(ap); | ||
614 | qc->err_mask |= __ac_err_mask(drv_stat); | ||
615 | break; | ||
616 | |||
617 | default: | ||
618 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | ||
619 | |||
620 | ata_port_printk(ap, KERN_ERR, | ||
621 | "unknown timeout, cmd 0x%x stat 0x%x\n", | ||
622 | qc->tf.command, drv_stat); | ||
623 | |||
624 | qc->err_mask |= ac_err_mask(drv_stat); | ||
625 | break; | ||
626 | } | ||
627 | |||
628 | spin_unlock_irqrestore(&host->lock, flags); | ||
629 | ata_eh_qc_complete(qc); | ||
630 | DPRINTK("EXIT\n"); | ||
631 | } | ||
632 | |||
633 | static inline unsigned int pdc_host_intr( struct ata_port *ap, | 592 | static inline unsigned int pdc_host_intr( struct ata_port *ap, |
634 | struct ata_queued_cmd *qc) | 593 | struct ata_queued_cmd *qc) |
635 | { | 594 | { |