| From 1511e50716794cefe67e43635e5c27ad6329311d Mon Sep 17 00:00:00 2001 |
| From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
| Date: Tue, 28 May 2013 02:45:08 +0400 |
| Subject: sata_rcar: correct 'sata_rcar_sht' |
| |
| Using ATA_BMDMA_SHT() to intialize 'sata_rcar_sht' was suboptimal as |
| the R-Car descriptor table transfer counter is 28 bits wide (bit 1 to |
| bit 28), so that the 'dma_boundary' field of 0xFFFF is just too small, |
| as well as the 'sg_tablesize' field of 128. Use ATA_BASE_SHT() to |
| initialize 'sata_rcar_sht' instead and give proper values to the |
| 'dma_boundary' and 'sg_tablesize' fields explicitly. |
| |
| Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
| Signed-off-by: Tejun Heo <tj@kernel.org> |
| (cherry picked from commit 8bfbeed58665dbbf63813017712bd0c8e978379e) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/ata/sata_rcar.c | 11 ++++++++++- |
| 1 file changed, 10 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c |
| index d39330f6..6626a5bc 100644 |
| --- a/drivers/ata/sata_rcar.c |
| +++ b/drivers/ata/sata_rcar.c |
| @@ -121,6 +121,8 @@ |
| /* Descriptor table word 0 bit (when DTA32M = 1) */ |
| #define SATA_RCAR_DTEND BIT(0) |
| |
| +#define SATA_RCAR_DMA_BOUNDARY 0x1FFFFFFEUL |
| + |
| struct sata_rcar_priv { |
| void __iomem *base; |
| struct clk *clk; |
| @@ -576,7 +578,14 @@ static u8 sata_rcar_bmdma_status(struct ata_port *ap) |
| } |
| |
| static struct scsi_host_template sata_rcar_sht = { |
| - ATA_BMDMA_SHT(DRV_NAME), |
| + ATA_BASE_SHT(DRV_NAME), |
| + /* |
| + * This controller allows transfer chunks up to 512MB which cross 64KB |
| + * boundaries, therefore the DMA limits are more relaxed than standard |
| + * ATA SFF. |
| + */ |
| + .sg_tablesize = ATA_MAX_PRD, |
| + .dma_boundary = SATA_RCAR_DMA_BOUNDARY, |
| }; |
| |
| static struct ata_port_operations sata_rcar_port_ops = { |
| -- |
| 1.8.4.3.gca3854a |
| |