aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
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 ef3ce26bb1f0..0f91e583892e 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
@@ -157,7 +157,8 @@ enum {
157 IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE, 157 IE_ON_SINGL_DEVICE_ERR | IE_ON_CMD_COMPLETE,
158 158
159 EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31), 159 EXT_INDIRECT_SEG_PRD_FLAG = (1 << 31),
160 DATA_SNOOP_ENABLE = (1 << 22), 160 DATA_SNOOP_ENABLE_V1 = (1 << 22),
161 DATA_SNOOP_ENABLE_V2 = (1 << 28),
161}; 162};
162 163
163/* 164/*
@@ -260,6 +261,7 @@ struct sata_fsl_host_priv {
260 void __iomem *ssr_base; 261 void __iomem *ssr_base;
261 void __iomem *csr_base; 262 void __iomem *csr_base;
262 int irq; 263 int irq;
264 int data_snoop;
263}; 265};
264 266
265static inline unsigned int sata_fsl_tag(unsigned int tag, 267static inline unsigned int sata_fsl_tag(unsigned int tag,
@@ -312,7 +314,8 @@ static void sata_fsl_setup_cmd_hdr_entry(struct sata_fsl_port_priv *pp,
312} 314}
313 315
314static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc, 316static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
315 u32 *ttl, dma_addr_t cmd_desc_paddr) 317 u32 *ttl, dma_addr_t cmd_desc_paddr,
318 int data_snoop)
316{ 319{
317 struct scatterlist *sg; 320 struct scatterlist *sg;
318 unsigned int num_prde = 0; 321 unsigned int num_prde = 0;
@@ -362,8 +365,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
362 365
363 ttl_dwords += sg_len; 366 ttl_dwords += sg_len;
364 prd->dba = cpu_to_le32(sg_addr); 367 prd->dba = cpu_to_le32(sg_addr);
365 prd->ddc_and_ext = 368 prd->ddc_and_ext = cpu_to_le32(data_snoop | (sg_len & ~0x03));
366 cpu_to_le32(DATA_SNOOP_ENABLE | (sg_len & ~0x03));
367 369
368 VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n", 370 VPRINTK("sg_fill, ttl=%d, dba=0x%x, ddc=0x%x\n",
369 ttl_dwords, prd->dba, prd->ddc_and_ext); 371 ttl_dwords, prd->dba, prd->ddc_and_ext);
@@ -378,7 +380,7 @@ static unsigned int sata_fsl_fill_sg(struct ata_queued_cmd *qc, void *cmd_desc,
378 /* set indirect extension flag along with indirect ext. size */ 380 /* set indirect extension flag along with indirect ext. size */
379 prd_ptr_to_indirect_ext->ddc_and_ext = 381 prd_ptr_to_indirect_ext->ddc_and_ext =
380 cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG | 382 cpu_to_le32((EXT_INDIRECT_SEG_PRD_FLAG |
381 DATA_SNOOP_ENABLE | 383 data_snoop |
382 (indirect_ext_segment_sz & ~0x03))); 384 (indirect_ext_segment_sz & ~0x03)));
383 } 385 }
384 386
@@ -421,7 +423,8 @@ static void sata_fsl_qc_prep(struct ata_queued_cmd *qc)
421 423
422 if (qc->flags & ATA_QCFLAG_DMAMAP) 424 if (qc->flags & ATA_QCFLAG_DMAMAP)
423 num_prde = sata_fsl_fill_sg(qc, (void *)cd, 425 num_prde = sata_fsl_fill_sg(qc, (void *)cd,
424 &ttl_dwords, cd_paddr); 426 &ttl_dwords, cd_paddr,
427 host_priv->data_snoop);
425 428
426 if (qc->tf.protocol == ATA_PROT_NCQ) 429 if (qc->tf.protocol == ATA_PROT_NCQ)
427 desc_info |= FPDMA_QUEUED_CMD; 430 desc_info |= FPDMA_QUEUED_CMD;
@@ -1349,6 +1352,11 @@ static int sata_fsl_probe(struct platform_device *ofdev)
1349 } 1352 }
1350 host_priv->irq = irq; 1353 host_priv->irq = irq;
1351 1354
1355 if (of_device_is_compatible(ofdev->dev.of_node, "fsl,pq-sata-v2"))
1356 host_priv->data_snoop = DATA_SNOOP_ENABLE_V2;
1357 else
1358 host_priv->data_snoop = DATA_SNOOP_ENABLE_V1;
1359
1352 /* allocate host structure */ 1360 /* allocate host structure */
1353 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS); 1361 host = ata_host_alloc_pinfo(&ofdev->dev, ppi, SATA_FSL_MAX_PORTS);
1354 1362
@@ -1431,6 +1439,9 @@ static struct of_device_id fsl_sata_match[] = {
1431 { 1439 {
1432 .compatible = "fsl,pq-sata", 1440 .compatible = "fsl,pq-sata",
1433 }, 1441 },
1442 {
1443 .compatible = "fsl,pq-sata-v2",
1444 },
1434 {}, 1445 {},
1435}; 1446};
1436 1447