aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMikael Pettersson <mikpe@it.uu.se>2007-02-11 17:19:53 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-15 18:04:00 -0500
commit5387373bfe78b7795b96378250f6848f39d78b80 (patch)
tree259886aaf852d609c044673ca00eb9395aa23653 /drivers
parent2fb8b49fb2eac583f0e8dd0ece06f9ad6d8fd792 (diff)
sata_promise: new EH conversion for 20619 chips, take 2
This patch updates the sata_promise driver to use new-style libata error handling for 20619 (TX4000) chips. sata_promise already uses new EH for the other chips it supports, so the patch is quite simple: * remove ->phy_reset and ->eng_timeout ops from pdc_pata_ops, and instead bind ->freeze, ->thaw, ->error_handler, and ->post_internal_cmd to existing new EH functions * drop ATA_FLAG_SRST from board_20619's flags * remove now unused pdc_pata_phy_reset() and pdc_eng_timeout() Tested on a TX4000 with both modern working disks and old/quirky disks. Also used a CD-RW drive to test reading and writing CDs. Signed-off-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/sata_promise.c55
1 files changed, 4 insertions, 51 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index da8c362c3eb0..cf9ed8c39301 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -119,9 +119,7 @@ static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg);
119static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val); 119static void pdc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);
120static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent); 120static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
121static irqreturn_t pdc_interrupt (int irq, void *dev_instance); 121static irqreturn_t pdc_interrupt (int irq, void *dev_instance);
122static void pdc_eng_timeout(struct ata_port *ap);
123static int pdc_port_start(struct ata_port *ap); 122static int pdc_port_start(struct ata_port *ap);
124static void pdc_pata_phy_reset(struct ata_port *ap);
125static void pdc_qc_prep(struct ata_queued_cmd *qc); 123static void pdc_qc_prep(struct ata_queued_cmd *qc);
126static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 124static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
127static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf); 125static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf);
@@ -215,12 +213,12 @@ static const struct ata_port_operations pdc_pata_ops = {
215 .dev_select = ata_std_dev_select, 213 .dev_select = ata_std_dev_select,
216 .check_atapi_dma = pdc_check_atapi_dma, 214 .check_atapi_dma = pdc_check_atapi_dma,
217 215
218 .phy_reset = pdc_pata_phy_reset,
219
220 .qc_prep = pdc_qc_prep, 216 .qc_prep = pdc_qc_prep,
221 .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,
222 .data_xfer = ata_data_xfer, 221 .data_xfer = ata_data_xfer,
223 .eng_timeout = pdc_eng_timeout,
224 .irq_handler = pdc_interrupt, 222 .irq_handler = pdc_interrupt,
225 .irq_clear = pdc_irq_clear, 223 .irq_clear = pdc_irq_clear,
226 .irq_on = ata_irq_on, 224 .irq_on = ata_irq_on,
@@ -253,7 +251,7 @@ static const struct ata_port_info pdc_port_info[] = {
253 /* board_20619 */ 251 /* board_20619 */
254 { 252 {
255 .sht = &pdc_ata_sht, 253 .sht = &pdc_ata_sht,
256 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SRST | ATA_FLAG_SLAVE_POSS, 254 .flags = PDC_COMMON_FLAGS | ATA_FLAG_SLAVE_POSS,
257 .pio_mask = 0x1f, /* pio0-4 */ 255 .pio_mask = 0x1f, /* pio0-4 */
258 .mwdma_mask = 0x07, /* mwdma0-2 */ 256 .mwdma_mask = 0x07, /* mwdma0-2 */
259 .udma_mask = 0x7f, /* udma0-6 ; FIXME */ 257 .udma_mask = 0x7f, /* udma0-6 ; FIXME */
@@ -389,14 +387,6 @@ static void pdc_pata_cbl_detect(struct ata_port *ap)
389 ap->cbl = ATA_CBL_PATA80; 387 ap->cbl = ATA_CBL_PATA80;
390} 388}
391 389
392static void pdc_pata_phy_reset(struct ata_port *ap)
393{
394 pdc_pata_cbl_detect(ap);
395 pdc_reset_port(ap);
396 ata_port_probe(ap);
397 ata_bus_reset(ap);
398}
399
400static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) 390static u32 pdc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
401{ 391{
402 if (sc_reg > SCR_CONTROL || ap->cbl != ATA_CBL_SATA) 392 if (sc_reg > SCR_CONTROL || ap->cbl != ATA_CBL_SATA)
@@ -599,43 +589,6 @@ static void pdc_post_internal_cmd(struct ata_queued_cmd *qc)
599 pdc_reset_port(ap); 589 pdc_reset_port(ap);
600} 590}
601 591
602static void pdc_eng_timeout(struct ata_port *ap)
603{
604 struct ata_host *host = ap->host;
605 u8 drv_stat;
606 struct ata_queued_cmd *qc;
607 unsigned long flags;
608
609 DPRINTK("ENTER\n");
610
611 spin_lock_irqsave(&host->lock, flags);
612
613 qc = ata_qc_from_tag(ap, ap->active_tag);
614
615 switch (qc->tf.protocol) {
616 case ATA_PROT_DMA:
617 case ATA_PROT_NODATA:
618 ata_port_printk(ap, KERN_ERR, "command timeout\n");
619 drv_stat = ata_wait_idle(ap);
620 qc->err_mask |= __ac_err_mask(drv_stat);
621 break;
622
623 default:
624 drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
625
626 ata_port_printk(ap, KERN_ERR,
627 "unknown timeout, cmd 0x%x stat 0x%x\n",
628 qc->tf.command, drv_stat);
629
630 qc->err_mask |= ac_err_mask(drv_stat);
631 break;
632 }
633
634 spin_unlock_irqrestore(&host->lock, flags);
635 ata_eh_qc_complete(qc);
636 DPRINTK("EXIT\n");
637}
638
639static inline unsigned int pdc_host_intr( struct ata_port *ap, 592static inline unsigned int pdc_host_intr( struct ata_port *ap,
640 struct ata_queued_cmd *qc) 593 struct ata_queued_cmd *qc)
641{ 594{