aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorXulei <B33228@freescale.com>2011-01-19 04:07:29 -0500
committerKumar Gala <galak@kernel.crashing.org>2011-03-15 11:39:16 -0400
commit2f957fc9595b5baaae7b5a3dc8c83b3a9950a39e (patch)
treea965a81eee26d6e0dee55fd0805b3b1dbd0910bf /drivers/ata
parentd1dcfbbb9f57a1f380e824caddc2c77b48a3a96b (diff)
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: Lei Xu <B33228@freescale.com> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/sata_fsl.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index b0214d00d50b..01a5400bd7c5 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -6,7 +6,7 @@
6 * Author: Ashish Kalra <ashish.kalra@freescale.com> 6 * Author: Ashish Kalra <ashish.kalra@freescale.com>
7 * Li Yang <leoli@freescale.com> 7 * Li Yang <leoli@freescale.com>
8 * 8 *
9 * Copyright (c) 2006-2007 Freescale Semiconductor, Inc. 9 * Copyright (c) 2006-2007, 2011 Freescale Semiconductor, Inc.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify it 11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the 12 * under the terms of the GNU General Public License as published by the
@@ -158,7 +158,8 @@ enum {
158 IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE, 158 IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE,
159 159
160 EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31), 160 EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31),
161 DATA_SNOOP_ENABLE = (1 << 22), 161 DATA_SNOOP_ENABLE_V1 = (1 << 22),
162 DATA_SNOOP_ENABLE_V2 = (1 << 28),
162}; 163};
163 164
164/* 165/*
@@ -256,6 +257,7 @@ struct sata_fsl_host_priv {
256 void __iomem *ssr_base; 257 void __iomem *ssr_base;
257 void __iomem *csr_base; 258 void __iomem *csr_base;
258 int irq; 259 int irq;
260 int data_snoop;
259}; 261};
260 262
261static inline unsigned int sata_fsl_tag(unsigned int tag, 263static 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} 310}
309 311
310static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, 312static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
311 u32 *ttl, dma_addr_t cmd_desc_paddr) 313 u32 *ttl, dma_addr_t cmd_desc_paddr,
314 int data_snoop)
312{ 315{
313 struct scatterlist *sg; 316 struct scatterlist *sg;
314 unsigned int num_prde = 0; 317 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 361
359 ttl_dwords += sg_len; 362 ttl_dwords += sg_len;
360 prd->dba = cpu_to_le32(sg_addr); 363 prd->dba = cpu_to_le32(sg_addr);
361 prd->ddc_and_ext = 364 prd->ddc_and_ext = cpu_to_le32(data_snoop | (sg_len & ~0x03));
362 cpu_to_le32(DATA_SNOOP_ENABLE | (sg_len & ~0x03));
363 365
364 VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n", 366 VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n",
365 ttl_dwords, prd->dba, prd->ddc_and_ext); 367 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 /* set indirect extension flag along with indirect ext. size */ 376 /* set indirect extension flag along with indirect ext. size */
375 prd_ptr_to_indirect_ext->ddc_and_ext = 377 prd_ptr_to_indirect_ext->ddc_and_ext =
376 cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG | 378 cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG |
377 DATA_SNOOP_ENABLE | 379 data_snoop |
378 (indirect_ext_segment_sz & ~0x03))); 380 (indirect_ext_segment_sz & ~0x03)));
379 } 381 }
380 382
@@ -417,7 +419,8 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
417 419
418 if (qc->flags & ATA_QCFLAG_DMAMAP) 420 if (qc->flags & ATA_QCFLAG_DMAMAP)
419 num_prde = sata_fsl_fill_sg(qc, (void *)cd, 421 num_prde = sata_fsl_fill_sg(qc, (void *)cd,
420 &ttl_dwords, cd_paddr); 422 &ttl_dwords, cd_paddr,
423 host_priv->data_snoop);
421 424
422 if (qc->tf.protocol == ATA_PROT_NCQ) 425 if (qc->tf.protocol == ATA_PROT_NCQ)
423 desc_info |= FPDMA_QUEUED_CMD; 426 desc_info |= FPDMA_QUEUED_CMD;
@@ -1336,6 +1339,11 @@ static int sata_fsl_probe(struct platform_device *ofdev,
1336 } 1339 }
1337 host_priv->irq = irq; 1340 host_priv->irq = irq;
1338 1341
1342 if (of_device_is_compatible(ofdev->dev.of_node, "fsl,pq-sata-v2"))
1343 host_priv->data_snoop = DATA_SNOOP_ENABLE_V2;
1344 else
1345 host_priv->data_snoop = DATA_SNOOP_ENABLE_V1;
1346
1339 /* allocate host structure */ 1347 /* allocate host structure */
1340 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); 1348 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
1341 1349
@@ -1418,6 +1426,9 @@ static struct of_device_id fsl_sata_match[] = {
1418 { 1426 {
1419 .compatible = "fsl,pq-sata", 1427 .compatible = "fsl,pq-sata",
1420 }, 1428 },
1429 {
1430 .compatible = "fsl,pq-sata-v2",
1431 },
1421 {}, 1432 {},
1422}; 1433};
1423 1434