ppp: fix BUG on non-linear SKB (multilink receive)
[safe/jmp/linux-2.6] / drivers / ata / sata_fsl.c
index 5edd654..d344db4 100644 (file)
@@ -205,6 +205,7 @@ struct cmdhdr_tbl_entry {
  * Description information bitdefs
  */
 enum {
+       CMD_DESC_RES = (1 << 11),
        VENDOR_SPECIFIC_BIST = (1 << 10),
        CMD_DESC_SNOOP_ENABLE = (1 << 9),
        FPDMA_QUEUED_CMD = (1 << 8),
@@ -388,7 +389,7 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
        void __iomem *hcr_base = host_priv->hcr_base;
        unsigned int tag = sata_fsl_tag(qc->tag, hcr_base);
        struct command_desc *cd;
-       u32 desc_info = CMD_DESC_SNOOP_ENABLE;
+       u32 desc_info = CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE;
        u32 num_prde = 0;
        u32 ttl_dwords = 0;
        dma_addr_t cd_paddr;
@@ -841,7 +842,7 @@ issue_srst:
 
        /* device reset/SRST is a control register update FIS, uses tag0 */
        sata_fsl_setup_cmd_hdr_entry(pp, 0,
-                                    SRST_CMD | CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
+               SRST_CMD | CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
 
        tf.ctl |= ATA_SRST;     /* setup SRST bit in taskfile control reg */
        ata_tf_to_fis(&tf, pmp, 0, cfis);
@@ -887,7 +888,8 @@ issue_srst:
         * using ATA signature D2H register FIS to the host controller.
         */
 
-       sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_SNOOP_ENABLE, 0, 0, 5);
+       sata_fsl_setup_cmd_hdr_entry(pp, 0, CMD_DESC_RES | CMD_DESC_SNOOP_ENABLE,
+                                     0, 0, 5);
 
        tf.ctl &= ~ATA_SRST;    /* 2nd H2D Ctl. register FIS */
        ata_tf_to_fis(&tf, pmp, 0, cfis);
@@ -1255,6 +1257,7 @@ static struct scsi_host_template sata_fsl_sht = {
 static struct ata_port_operations sata_fsl_ops = {
        .inherits               = &sata_pmp_port_ops,
 
+       .qc_defer = ata_std_qc_defer,
        .qc_prep = sata_fsl_qc_prep,
        .qc_issue = sata_fsl_qc_issue,
        .qc_fill_rtf = sata_fsl_qc_fill_rtf,
@@ -1376,6 +1379,37 @@ static int sata_fsl_remove(struct of_device *ofdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int sata_fsl_suspend(struct of_device *op, pm_message_t state)
+{
+       struct ata_host *host = dev_get_drvdata(&op->dev);
+       return ata_host_suspend(host, state);
+}
+
+static int sata_fsl_resume(struct of_device *op)
+{
+       struct ata_host *host = dev_get_drvdata(&op->dev);
+       struct sata_fsl_host_priv *host_priv = host->private_data;
+       int ret;
+       void __iomem *hcr_base = host_priv->hcr_base;
+       struct ata_port *ap = host->ports[0];
+       struct sata_fsl_port_priv *pp = ap->private_data;
+
+       ret = sata_fsl_init_controller(host);
+       if (ret) {
+               dev_printk(KERN_ERR, &op->dev,
+                       "Error initialize hardware\n");
+               return ret;
+       }
+
+       /* Recovery the CHBA register in host controller cmd register set */
+       iowrite32(pp->cmdslot_paddr & 0xffffffff, hcr_base + CHBA);
+
+       ata_host_resume(host);
+       return 0;
+}
+#endif
+
 static struct of_device_id fsl_sata_match[] = {
        {
                .compatible = "fsl,pq-sata",
@@ -1390,6 +1424,10 @@ static struct of_platform_driver fsl_sata_driver = {
        .match_table    = fsl_sata_match,
        .probe          = sata_fsl_probe,
        .remove         = sata_fsl_remove,
+#ifdef CONFIG_PM
+       .suspend        = sata_fsl_suspend,
+       .resume         = sata_fsl_resume,
+#endif
 };
 
 static int __init sata_fsl_init(void)