diff options
Diffstat (limited to 'drivers/scsi/sata_promise.c')
-rw-r--r-- | drivers/scsi/sata_promise.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 7eb67a6bdc64..b2b6ed5216e0 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -76,7 +76,8 @@ enum { | |||
76 | PDC_RESET = (1 << 11), /* HDMA reset */ | 76 | PDC_RESET = (1 << 11), /* HDMA reset */ |
77 | 77 | ||
78 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | | 78 | PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | |
79 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI, | 79 | ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | |
80 | ATA_FLAG_PIO_POLLING, | ||
80 | }; | 81 | }; |
81 | 82 | ||
82 | 83 | ||
@@ -120,6 +121,7 @@ static struct scsi_host_template pdc_ata_sht = { | |||
120 | .proc_name = DRV_NAME, | 121 | .proc_name = DRV_NAME, |
121 | .dma_boundary = ATA_DMA_BOUNDARY, | 122 | .dma_boundary = ATA_DMA_BOUNDARY, |
122 | .slave_configure = ata_scsi_slave_config, | 123 | .slave_configure = ata_scsi_slave_config, |
124 | .slave_destroy = ata_scsi_slave_destroy, | ||
123 | .bios_param = ata_std_bios_param, | 125 | .bios_param = ata_std_bios_param, |
124 | }; | 126 | }; |
125 | 127 | ||
@@ -136,6 +138,7 @@ static const struct ata_port_operations pdc_sata_ops = { | |||
136 | .qc_prep = pdc_qc_prep, | 138 | .qc_prep = pdc_qc_prep, |
137 | .qc_issue = pdc_qc_issue_prot, | 139 | .qc_issue = pdc_qc_issue_prot, |
138 | .eng_timeout = pdc_eng_timeout, | 140 | .eng_timeout = pdc_eng_timeout, |
141 | .data_xfer = ata_mmio_data_xfer, | ||
139 | .irq_handler = pdc_interrupt, | 142 | .irq_handler = pdc_interrupt, |
140 | .irq_clear = pdc_irq_clear, | 143 | .irq_clear = pdc_irq_clear, |
141 | 144 | ||
@@ -158,6 +161,7 @@ static const struct ata_port_operations pdc_pata_ops = { | |||
158 | 161 | ||
159 | .qc_prep = pdc_qc_prep, | 162 | .qc_prep = pdc_qc_prep, |
160 | .qc_issue = pdc_qc_issue_prot, | 163 | .qc_issue = pdc_qc_issue_prot, |
164 | .data_xfer = ata_mmio_data_xfer, | ||
161 | .eng_timeout = pdc_eng_timeout, | 165 | .eng_timeout = pdc_eng_timeout, |
162 | .irq_handler = pdc_interrupt, | 166 | .irq_handler = pdc_interrupt, |
163 | .irq_clear = pdc_irq_clear, | 167 | .irq_clear = pdc_irq_clear, |
@@ -363,12 +367,23 @@ static void pdc_sata_phy_reset(struct ata_port *ap) | |||
363 | sata_phy_reset(ap); | 367 | sata_phy_reset(ap); |
364 | } | 368 | } |
365 | 369 | ||
366 | static void pdc_pata_phy_reset(struct ata_port *ap) | 370 | static void pdc_pata_cbl_detect(struct ata_port *ap) |
367 | { | 371 | { |
368 | /* FIXME: add cable detect. Don't assume 40-pin cable */ | 372 | u8 tmp; |
369 | ap->cbl = ATA_CBL_PATA40; | 373 | void __iomem *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; |
370 | ap->udma_mask &= ATA_UDMA_MASK_40C; | 374 | |
375 | tmp = readb(mmio); | ||
376 | |||
377 | if (tmp & 0x01) { | ||
378 | ap->cbl = ATA_CBL_PATA40; | ||
379 | ap->udma_mask &= ATA_UDMA_MASK_40C; | ||
380 | } else | ||
381 | ap->cbl = ATA_CBL_PATA80; | ||
382 | } | ||
371 | 383 | ||
384 | static void pdc_pata_phy_reset(struct ata_port *ap) | ||
385 | { | ||
386 | pdc_pata_cbl_detect(ap); | ||
372 | pdc_reset_port(ap); | 387 | pdc_reset_port(ap); |
373 | ata_port_probe(ap); | 388 | ata_port_probe(ap); |
374 | ata_bus_reset(ap); | 389 | ata_bus_reset(ap); |
@@ -435,7 +450,7 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
435 | switch (qc->tf.protocol) { | 450 | switch (qc->tf.protocol) { |
436 | case ATA_PROT_DMA: | 451 | case ATA_PROT_DMA: |
437 | case ATA_PROT_NODATA: | 452 | case ATA_PROT_NODATA: |
438 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 453 | ata_port_printk(ap, KERN_ERR, "command timeout\n"); |
439 | drv_stat = ata_wait_idle(ap); | 454 | drv_stat = ata_wait_idle(ap); |
440 | qc->err_mask |= __ac_err_mask(drv_stat); | 455 | qc->err_mask |= __ac_err_mask(drv_stat); |
441 | break; | 456 | break; |
@@ -443,8 +458,9 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
443 | default: | 458 | default: |
444 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 459 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
445 | 460 | ||
446 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 461 | ata_port_printk(ap, KERN_ERR, |
447 | ap->id, qc->tf.command, drv_stat); | 462 | "unknown timeout, cmd 0x%x stat 0x%x\n", |
463 | qc->tf.command, drv_stat); | ||
448 | 464 | ||
449 | qc->err_mask |= ac_err_mask(drv_stat); | 465 | qc->err_mask |= ac_err_mask(drv_stat); |
450 | break; | 466 | break; |
@@ -533,11 +549,11 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r | |||
533 | ap = host_set->ports[i]; | 549 | ap = host_set->ports[i]; |
534 | tmp = mask & (1 << (i + 1)); | 550 | tmp = mask & (1 << (i + 1)); |
535 | if (tmp && ap && | 551 | if (tmp && ap && |
536 | !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { | 552 | !(ap->flags & ATA_FLAG_DISABLED)) { |
537 | struct ata_queued_cmd *qc; | 553 | struct ata_queued_cmd *qc; |
538 | 554 | ||
539 | qc = ata_qc_from_tag(ap, ap->active_tag); | 555 | qc = ata_qc_from_tag(ap, ap->active_tag); |
540 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) | 556 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) |
541 | handled += pdc_host_intr(ap, qc); | 557 | handled += pdc_host_intr(ap, qc); |
542 | } | 558 | } |
543 | } | 559 | } |
@@ -676,10 +692,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
676 | if (!printed_version++) | 692 | if (!printed_version++) |
677 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 693 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
678 | 694 | ||
679 | /* | ||
680 | * If this driver happens to only be useful on Apple's K2, then | ||
681 | * we should check that here as it has a normal Serverworks ID | ||
682 | */ | ||
683 | rc = pci_enable_device(pdev); | 695 | rc = pci_enable_device(pdev); |
684 | if (rc) | 696 | if (rc) |
685 | return rc; | 697 | return rc; |