Commit 2f957fc9 authored by Xulei's avatar Xulei Committed by Kumar Gala

ATA: Add FSL sata v2 controller support

In FSL sata v2 block, the snoop bit of PRDT Word3 description
information is at bit28 instead of bit22.

This patch adds FSL sata v2 probe and resolve this difference.
Signed-off-by: default avatarLei Xu <B33228@freescale.com>
Signed-off-by: default avatarRoy Zang <tie-fei.zang@freescale.com>
Acked-by: default avatarJeff Garzik <jgarzik@redhat.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent d1dcfbbb
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Author: Ashish Kalra <ashish.kalra@freescale.com> * Author: Ashish Kalra <ashish.kalra@freescale.com>
* Li Yang <leoli@freescale.com> * Li Yang <leoli@freescale.com>
* *
* Copyright (c) 2006-2007 Freescale Semiconductor, Inc. * Copyright (c) 2006-2007, 2011 Freescale Semiconductor, Inc.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -158,7 +158,8 @@ enum { ...@@ -158,7 +158,8 @@ enum {
IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE, IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE,
EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31), EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31),
DATA_SNOOP_ENABLE = (1 << 22), DATA_SNOOP_ENABLE_V1 = (1 << 22),
DATA_SNOOP_ENABLE_V2 = (1 << 28),
}; };
/* /*
...@@ -256,6 +257,7 @@ struct sata_fsl_host_priv { ...@@ -256,6 +257,7 @@ struct sata_fsl_host_priv {
void __iomem *ssr_base; void __iomem *ssr_base;
void __iomem *csr_base; void __iomem *csr_base;
int irq; int irq;
int data_snoop;
}; };
static inline unsigned int sata_fsl_tag(unsigned int tag, static inline unsigned int sata_fsl_tag(unsigned int tag,
...@@ -308,7 +310,8 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp, ...@@ -308,7 +310,8 @@ 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, 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,
int data_snoop)
{ {
struct scatterlist *sg; struct scatterlist *sg;
unsigned int num_prde = 0; unsigned int num_prde = 0;
...@@ -358,8 +361,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, ...@@ -358,8 +361,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
ttl_dwords += sg_len; ttl_dwords += sg_len;
prd->dba = cpu_to_le32(sg_addr); prd->dba = cpu_to_le32(sg_addr);
prd->ddc_and_ext = prd->ddc_and_ext = cpu_to_le32(data_snoop | (sg_len & ~0x03));
cpu_to_le32(DATA_SNOOP_ENABLE | (sg_len & ~0x03));
VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n", VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n",
ttl_dwords, prd->dba, prd->ddc_and_ext); ttl_dwords, prd->dba, prd->ddc_and_ext);
...@@ -374,7 +376,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, ...@@ -374,7 +376,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
/* set indirect extension flag along with indirect ext. size */ /* set indirect extension flag along with indirect ext. size */
prd_ptr_to_indirect_ext->ddc_and_ext = prd_ptr_to_indirect_ext->ddc_and_ext =
cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG | cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG |
DATA_SNOOP_ENABLE | data_snoop |
(indirect_ext_segment_sz & ~0x03))); (indirect_ext_segment_sz & ~0x03)));
} }
...@@ -417,7 +419,8 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc) ...@@ -417,7 +419,8 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
if (qc->flags & ATA_QCFLAG_DMAMAP) if (qc->flags & ATA_QCFLAG_DMAMAP)
num_prde = sata_fsl_fill_sg(qc, (void *)cd, num_prde = sata_fsl_fill_sg(qc, (void *)cd,
&ttl_dwords, cd_paddr); &ttl_dwords, cd_paddr,
host_priv->data_snoop);
if (qc->tf.protocol == ATA_PROT_NCQ) if (qc->tf.protocol == ATA_PROT_NCQ)
desc_info |= FPDMA_QUEUED_CMD; desc_info |= FPDMA_QUEUED_CMD;
...@@ -1336,6 +1339,11 @@ static int sata_fsl_probe(struct platform_device *ofdev, ...@@ -1336,6 +1339,11 @@ static int sata_fsl_probe(struct platform_device *ofdev,
} }
host_priv->irq = irq; host_priv->irq = irq;
if (of_device_is_compatible(ofdev->dev.of_node, "fsl,pq-sata-v2"))
host_priv->data_snoop = DATA_SNOOP_ENABLE_V2;
else
host_priv->data_snoop = DATA_SNOOP_ENABLE_V1;
/* allocate host structure */ /* allocate host structure */
host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
...@@ -1418,6 +1426,9 @@ static struct of_device_id fsl_sata_match[] = { ...@@ -1418,6 +1426,9 @@ static struct of_device_id fsl_sata_match[] = {
{ {
.compatible = "fsl,pq-sata", .compatible = "fsl,pq-sata",
}, },
{
.compatible = "fsl,pq-sata-v2",
},
{}, {},
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment