X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fscsi%2Fsata_promise.c;fp=drivers%2Fscsi%2Fsata_promise.c;h=b1d865e5276099524367ee12e48c8f9eed8d4904;hb=16c70f8c1b54b61c3b951b6fb220df250fe09b32;hp=df5776210e664457fb9be6e0cfc4094857e5907c;hpb=4e76c8a9fa413ccc09d3f7f664183dcce3555d57;p=linux-2.6.git diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index df5776210..b1d865e52 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -76,7 +76,8 @@ enum { PDC_RESET = (1 << 11), /* HDMA reset */ PDC_COMMON_FLAGS = ATA_FLAG_NO_LEGACY | ATA_FLAG_SRST | - ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI, + ATA_FLAG_MMIO | ATA_FLAG_NO_ATAPI | + ATA_FLAG_PIO_POLLING, }; @@ -120,6 +121,7 @@ static struct scsi_host_template pdc_ata_sht = { .proc_name = DRV_NAME, .dma_boundary = ATA_DMA_BOUNDARY, .slave_configure = ata_scsi_slave_config, + .slave_destroy = ata_scsi_slave_destroy, .bios_param = ata_std_bios_param, }; @@ -136,6 +138,7 @@ static const struct ata_port_operations pdc_sata_ops = { .qc_prep = pdc_qc_prep, .qc_issue = pdc_qc_issue_prot, .eng_timeout = pdc_eng_timeout, + .data_xfer = ata_mmio_data_xfer, .irq_handler = pdc_interrupt, .irq_clear = pdc_irq_clear, @@ -158,6 +161,7 @@ static const struct ata_port_operations pdc_pata_ops = { .qc_prep = pdc_qc_prep, .qc_issue = pdc_qc_issue_prot, + .data_xfer = ata_mmio_data_xfer, .eng_timeout = pdc_eng_timeout, .irq_handler = pdc_interrupt, .irq_clear = pdc_irq_clear, @@ -265,8 +269,15 @@ static const struct pci_device_id pdc_ata_pci_tbl[] = { { PCI_VENDOR_ID_PROMISE, 0x6629, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_20619 }, +/* TODO: remove all associated board_20771 code, as it completely + * duplicates board_2037x code, unless reason for separation can be + * divined. + */ +#if 0 { PCI_VENDOR_ID_PROMISE, 0x3570, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_20771 }, +#endif + { } /* terminate list */ }; @@ -359,35 +370,41 @@ static void pdc_reset_port(struct ata_port *ap) static void pdc_sata_phy_reset(struct ata_port *ap) { -/* pdc_reset_port(ap); */ /* pata fix */ -/* sata_phy_reset(ap); */ /* pata fix */ - /* if no sata flag, test for pata drive */ /* pata fix */ - if (ap->flags & ATA_FLAG_SATA) /* pata fix */ - { /* pata fix */ - pdc_reset_port(ap); /* pata fix */ - sata_phy_reset(ap); /* pata fix */ - } /* pata fix */ - else /* pata fix */ - pdc_pata_phy_reset(ap); /* pata fix */ + /* pdc_reset_port(ap); */ /* pata fix */ + /* sata_phy_reset(ap); */ /* pata fix */ + /* if no sata flag, test for pata drive */ /* pata fix */ + if (ap->flags & ATA_FLAG_SATA) /* pata fix */ + { /* pata fix */ + pdc_reset_port(ap); /* pata fix */ + sata_phy_reset(ap); /* pata fix */ + } /* pata fix */ + else /* pata fix */ + pdc_pata_phy_reset(ap); /* pata fix */ +} + +static void pdc_pata_cbl_detect(struct ata_port *ap) +{ + u8 tmp; + void __iomem *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; + + tmp = readb(mmio); + + if (tmp & 0x01) { + ap->cbl = ATA_CBL_PATA40; + ap->udma_mask &= ATA_UDMA_MASK_40C; + } else + ap->cbl = ATA_CBL_PATA80; } static void pdc_pata_phy_reset(struct ata_port *ap) { - /* FIXME: add cable detect. Don't assume 40-pin cable */ -/* ap->cbl = ATA_CBL_PATA40; */ /* pata fix */ -/* ap->udma_mask &= ATA_UDMA_MASK_40C; */ /* pata fix */ - /* add cable detection code for pata drives */ /* pata fix */ - u8 tmp; /* pata fix */ - void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; /* pata fix */ - tmp = readb(mmio); /* pata fix */ - if (tmp & 0x01) /* pata fix */ - { /* pata fix */ - ap->cbl = ATA_CBL_PATA40; /* pata fix */ - ap->udma_mask &= ATA_UDMA_MASK_40C; /* pata fix */ - } /* pata fix */ - else /* pata fix */ - ap->cbl = ATA_CBL_PATA80; /* pata fix */ + u8 tmp; /* pata fix */ + void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT + 0x03; /* pata fix */ + tmp = readb(mmio); /* pata fix */ + if (tmp & 0x01) /* pata fix */ + ap->udma_mask &= ATA_UDMA_MASK_40C; /* pata fix */ + pdc_pata_cbl_detect(ap); pdc_reset_port(ap); ata_port_probe(ap); ata_bus_reset(ap); @@ -454,7 +471,7 @@ static void pdc_eng_timeout(struct ata_port *ap) switch (qc->tf.protocol) { case ATA_PROT_DMA: case ATA_PROT_NODATA: - printk(KERN_ERR "ata%u: command timeout\n", ap->id); + ata_port_printk(ap, KERN_ERR, "command timeout\n"); drv_stat = ata_wait_idle(ap); qc->err_mask |= __ac_err_mask(drv_stat); break; @@ -462,8 +479,9 @@ static void pdc_eng_timeout(struct ata_port *ap) default: drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); - printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", - ap->id, qc->tf.command, drv_stat); + ata_port_printk(ap, KERN_ERR, + "unknown timeout, cmd 0x%x stat 0x%x\n", + qc->tf.command, drv_stat); qc->err_mask |= ac_err_mask(drv_stat); break; @@ -552,11 +570,11 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r ap = host_set->ports[i]; tmp = mask & (1 << (i + 1)); if (tmp && ap && - !(ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) { + !(ap->flags & ATA_FLAG_DISABLED)) { struct ata_queued_cmd *qc; qc = ata_qc_from_tag(ap, ap->active_tag); - if (qc && (!(qc->tf.ctl & ATA_NIEN))) + if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) handled += pdc_host_intr(ap, qc); } } @@ -696,10 +714,6 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e if (!printed_version++) dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); - /* - * If this driver happens to only be useful on Apple's K2, then - * we should check that here as it has a normal Serverworks ID - */ rc = pci_enable_device(pdev); if (rc) return rc; @@ -751,7 +765,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e probe_ent->port_ops = pdc_port_info[board_idx].port_ops; probe_ent->irq = pdev->irq; - probe_ent->irq_flags = SA_SHIRQ; + probe_ent->irq_flags = IRQF_SHARED; probe_ent->mmio_base = mmio_base; pdc_ata_setup_port(&probe_ent->port[0], base + 0x200);