intelfb: add preliminary i2c support
[safe/jmp/linux-2.6] / drivers / scsi / sata_mv.c
index bfe817f..4a71578 100644 (file)
@@ -93,7 +93,7 @@ enum {
        MV_FLAG_IRQ_COALESCE    = (1 << 29),  /* IRQ coalescing capability */
        MV_COMMON_FLAGS         = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                   ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO |
-                                  ATA_FLAG_PIO_POLLING),
+                                  ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING),
        MV_6XXX_FLAGS           = MV_FLAG_IRQ_COALESCE,
 
        CRQB_FLAG_READ          = (1 << 0),
@@ -272,33 +272,33 @@ enum chip_type {
 
 /* Command ReQuest Block: 32B */
 struct mv_crqb {
-       u32                     sg_addr;
-       u32                     sg_addr_hi;
-       u16                     ctrl_flags;
-       u16                     ata_cmd[11];
+       __le32                  sg_addr;
+       __le32                  sg_addr_hi;
+       __le16                  ctrl_flags;
+       __le16                  ata_cmd[11];
 };
 
 struct mv_crqb_iie {
-       u32                     addr;
-       u32                     addr_hi;
-       u32                     flags;
-       u32                     len;
-       u32                     ata_cmd[4];
+       __le32                  addr;
+       __le32                  addr_hi;
+       __le32                  flags;
+       __le32                  len;
+       __le32                  ata_cmd[4];
 };
 
 /* Command ResPonse Block: 8B */
 struct mv_crpb {
-       u16                     id;
-       u16                     flags;
-       u32                     tmstmp;
+       __le16                  id;
+       __le16                  flags;
+       __le32                  tmstmp;
 };
 
 /* EDMA Physical Region Descriptor (ePRD); A.K.A. SG */
 struct mv_sg {
-       u32                     addr;
-       u32                     flags_size;
-       u32                     addr_hi;
-       u32                     reserved;
+       __le32                  addr;
+       __le32                  flags_size;
+       __le32                  addr_hi;
+       __le32                  reserved;
 };
 
 struct mv_port_priv {
@@ -390,6 +390,7 @@ static struct scsi_host_template mv_sht = {
        .proc_name              = DRV_NAME,
        .dma_boundary           = MV_DMA_BOUNDARY,
        .slave_configure        = ata_scsi_slave_config,
+       .slave_destroy          = ata_scsi_slave_destroy,
        .bios_param             = ata_std_bios_param,
 };
 
@@ -406,6 +407,7 @@ static const struct ata_port_operations mv5_ops = {
 
        .qc_prep                = mv_qc_prep,
        .qc_issue               = mv_qc_issue,
+       .data_xfer              = ata_mmio_data_xfer,
 
        .eng_timeout            = mv_eng_timeout,
 
@@ -433,6 +435,7 @@ static const struct ata_port_operations mv6_ops = {
 
        .qc_prep                = mv_qc_prep,
        .qc_issue               = mv_qc_issue,
+       .data_xfer              = ata_mmio_data_xfer,
 
        .eng_timeout            = mv_eng_timeout,
 
@@ -1028,7 +1031,7 @@ static inline unsigned mv_inc_q_index(unsigned index)
        return (index + 1) & MV_MAX_Q_DEPTH_MASK;
 }
 
-static inline void mv_crqb_pack_cmd(u16 *cmdw, u8 data, u8 addr, unsigned last)
+static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
 {
        u16 tmp = data | (addr << CRQB_CMD_ADDR_SHIFT) | CRQB_CMD_CS |
                (last ? CRQB_CMD_LAST : 0);
@@ -1051,7 +1054,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
        struct mv_port_priv *pp = ap->private_data;
-       u16 *cw;
+       __le16 *cw;
        struct ata_taskfile *tf;
        u16 flags = 0;
        unsigned in_index;
@@ -1377,7 +1380,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant,
                /* Note that DEV_IRQ might happen spuriously during EDMA,
                 * and should be ignored in such cases.
                 * The cause of this is still under investigation.
-                */ 
+                */
                if (pp->pp_flags & MV_PP_FLAG_EDMA_EN) {
                        /* EDMA: check for response queue interrupt */
                        if ((CRPB_DMA_DONE << hard_port) & hc_irq_cause) {
@@ -2037,6 +2040,7 @@ static void mv_phy_reset(struct ata_port *ap)
 static void mv_eng_timeout(struct ata_port *ap)
 {
        struct ata_queued_cmd *qc;
+       unsigned long flags;
 
        ata_port_printk(ap, KERN_ERR, "Entering mv_eng_timeout\n");
        DPRINTK("All regs @ start of eng_timeout\n");
@@ -2048,8 +2052,10 @@ static void mv_eng_timeout(struct ata_port *ap)
               ap->host_set->mmio_base, ap, qc, qc->scsicmd,
               &qc->scsicmd->cmnd);
 
+       spin_lock_irqsave(&ap->host_set->lock, flags);
        mv_err_intr(ap, 0);
        mv_stop_and_reset(ap);
+       spin_unlock_irqrestore(&ap->host_set->lock, flags);
 
        WARN_ON(!(qc->flags & ATA_QCFLAG_ACTIVE));
        if (qc->flags & ATA_QCFLAG_ACTIVE) {