Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[sfrench/cifs-2.6.git] / drivers / ata / sata_fsl.c
index e3bf9546fd08c60631772e79f23edfd1129e03cf..d015b4adcfe098402fd9e8b307a829f580e36636 100644 (file)
@@ -269,7 +269,7 @@ struct sata_fsl_host_priv {
 };
 
 static inline unsigned int sata_fsl_tag(unsigned int tag,
-                                       void __iomem * hcr_base)
+                                       void __iomem *hcr_base)
 {
        /* We let libATA core do actual (queue) tag allocation */
 
@@ -308,7 +308,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
        pp->cmdslot[tag].prde_fis_len =
            cpu_to_le32((num_prde << 16) | (fis_len << 2));
        pp->cmdslot[tag].ttl = cpu_to_le32(data_xfer_len & ~0x03);
-       pp->cmdslot[tag].desc_info = cpu_to_le32((desc_info | (tag & 0x1F)));
+       pp->cmdslot[tag].desc_info = cpu_to_le32(desc_info | (tag & 0x1F));
 
        VPRINTK("cda=0x%x, prde_fis_len=0x%x, ttl=0x%x, di=0x%x\n",
                pp->cmdslot[tag].cda,
@@ -318,7 +318,7 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
 }
 
 static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
-                                    u32 * ttl, dma_addr_t cmd_desc_paddr)
+                                    u32 *ttl, dma_addr_t cmd_desc_paddr)
 {
        struct scatterlist *sg;
        unsigned int num_prde = 0;
@@ -406,7 +406,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
        cd = (struct command_desc *)pp->cmdentry + tag;
        cd_paddr = pp->cmdentry_paddr + tag * SATA_FSL_CMD_DESC_SIZE;
 
-       ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) & cd->cfis);
+       ata_tf_to_fis(&qc->tf, 0, 1, (u8 *) &cd->cfis);
 
        VPRINTK("Dumping cfis : 0x%x, 0x%x, 0x%x\n",
                cd->cfis[0], cd->cfis[1], cd->cfis[2]);
@@ -561,7 +561,6 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
                                                        struct ata_port *ap)
 {
        struct sata_fsl_port_priv *pp = ap->private_data;
-       u8 fis[6 * 4];
        struct sata_fsl_host_priv *host_priv = ap->host->private_data;
        void __iomem *hcr_base = host_priv->hcr_base;
        unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
@@ -569,8 +568,7 @@ static inline void sata_fsl_cache_taskfile_from_d2h_fis(struct ata_queued_cmd
 
        cd = pp->cmdentry + tag;
 
-       memcpy(fis, &cd->sfis, 6 * 4);  /* should we use memcpy_from_io() */
-       ata_tf_from_fis(fis, &pp->tf);
+       ata_tf_from_fis(cd->sfis, &pp->tf);
 }
 
 static u8 sata_fsl_check_status(struct ata_port *ap)
@@ -654,6 +652,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
        VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
        VPRINTK("CHBA  = 0x%x\n", ioread32(hcr_base + CHBA));
 
+#ifdef CONFIG_MPC8315_DS
        /*
         * Workaround for 8315DS board 3gbps link-up issue,
         * currently limit SATA port to GEN1 speed
@@ -666,6 +665,7 @@ static int sata_fsl_port_start(struct ata_port *ap)
        sata_fsl_scr_read(ap, SCR_CONTROL, &temp);
        dev_printk(KERN_WARNING, dev, "scr_control, speed limited to %x\n",
                        temp);
+#endif
 
        return 0;
 }
@@ -730,10 +730,6 @@ static int sata_fsl_softreset(struct ata_link *link, unsigned int *class,
        u8 *cfis;
        u32 Serror;
        int i = 0;
-       struct ata_queued_cmd qc;
-       u8 *buf;
-       dma_addr_t dma_address;
-       struct scatterlist *sg;
        unsigned long start_jiffies;
 
        DPRINTK("in xx_softreset\n");
@@ -833,13 +829,10 @@ try_offline_again:
         * reached here, we can send a command to the target device
         */
 
-       if (link->sactive)
-               goto skip_srst_do_ncq_error_handling;
-
        DPRINTK("Sending SRST/device reset\n");
 
        ata_tf_init(link->device, &tf);
-       cfis = (u8 *) & pp->cmdentry->cfis;
+       cfis = (u8 *) &pp->cmdentry->cfis;
 
        /* device reset/SRST is a control register update FIS, uses tag0 */
        sata_fsl_setup_cmd_hdr_entry(pp, 0,
@@ -903,69 +896,6 @@ try_offline_again:
         * command bit of the CCreg
         */
        iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
-       goto check_device_signature;
-
-skip_srst_do_ncq_error_handling:
-
-       VPRINTK("Sending read log ext(10h) command\n");
-
-       memset(&qc, 0, sizeof(struct ata_queued_cmd));
-       ata_tf_init(link->device, &tf);
-
-       tf.command = ATA_CMD_READ_LOG_EXT;
-       tf.lbal = ATA_LOG_SATA_NCQ;
-       tf.nsect = 1;
-       tf.hob_nsect = 0;
-       tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_LBA48 | ATA_TFLAG_DEVICE;
-       tf.protocol = ATA_PROT_PIO;
-
-       qc.tag = ATA_TAG_INTERNAL;
-       qc.scsicmd = NULL;
-       qc.ap = ap;
-       qc.dev = link->device;
-
-       qc.tf = tf;
-       qc.flags |= ATA_QCFLAG_RESULT_TF;
-       qc.dma_dir = DMA_FROM_DEVICE;
-
-       buf = ap->sector_buf;
-       ata_sg_init_one(&qc, buf, 1 * ATA_SECT_SIZE);
-
-       /*
-        * Need to DMA-map the memory buffer associated with the command
-        */
-
-       sg = qc.__sg;
-       dma_address = dma_map_single(ap->dev, qc.buf_virt,
-                                    sg->length, DMA_FROM_DEVICE);
-
-       sg_dma_address(sg) = dma_address;
-       sg_dma_len(sg) = sg->length;
-
-       VPRINTK("EH, addr = 0x%x, len = 0x%x\n", dma_address, sg->length);
-
-       sata_fsl_qc_prep(&qc);
-       sata_fsl_qc_issue(&qc);
-
-       temp = ata_wait_register(CQ + hcr_base, 0x1, 0x1, 1, 5000);
-       if (temp & 0x1) {
-               VPRINTK("READ_LOG_EXT_10H issue failed\n");
-
-               VPRINTK("READ_LOG@5000,CQ=0x%x,CA=0x%x,CC=0x%x\n",
-                       ioread32(CQ + hcr_base),
-                       ioread32(CA + hcr_base), ioread32(CC + hcr_base));
-
-               sata_fsl_scr_read(ap, SCR_ERROR, &Serror);
-
-               VPRINTK("HStatus = 0x%x\n", ioread32(hcr_base + HSTATUS));
-               VPRINTK("HControl = 0x%x\n", ioread32(hcr_base + HCONTROL));
-               VPRINTK("Serror = 0x%x\n", Serror);
-               goto err;
-       }
-
-       iowrite32(0x01, CC + hcr_base); /* We know it will be cmd#0 always */
-
-      check_device_signature:
 
        DPRINTK("SATA FSL : Now checking device signature\n");
 
@@ -993,25 +923,13 @@ err:
        return -EIO;
 }
 
-static int sata_fsl_hardreset(struct ata_port *ap, unsigned int *class,
-                             unsigned long deadline)
-{
-       int retval;
-
-       retval = sata_std_hardreset(ap, class, deadline);
-
-       DPRINTK("SATA FSL : in xx_hardreset, retval = 0x%d\n", retval);
-
-       return retval;
-}
-
 static void sata_fsl_error_handler(struct ata_port *ap)
 {
 
        DPRINTK("in xx_error_handler\n");
 
        /* perform recovery */
-       ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_fsl_hardreset,
+       ata_do_eh(ap, ata_std_prereset, sata_fsl_softreset, sata_std_hardreset,
                  ata_std_postreset);
 }
 
@@ -1305,10 +1223,6 @@ static struct scsi_host_template sata_fsl_sht = {
        .slave_configure = ata_scsi_slave_config,
        .slave_destroy = ata_scsi_slave_destroy,
        .bios_param = ata_std_bios_param,
-#ifdef CONFIG_PM
-       .suspend = ata_scsi_device_suspend,
-       .resume = ata_scsi_device_resume,
-#endif
 };
 
 static const struct ata_port_operations sata_fsl_ops = {