Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752959AbcDNEQa (ORCPT ); Thu, 14 Apr 2016 00:16:30 -0400 Received: from mail-by2on0119.outbound.protection.outlook.com ([207.46.100.119]:9280 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752030AbcDNEQZ (ORCPT ); Thu, 14 Apr 2016 00:16:25 -0400 Authentication-Results: spf=neutral (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=freescale.com; From: Yunhui Cui To: , , CC: , , , , Yunhui Cui Subject: [PATCH 8/9] mtd: fsl-quadspi: disable AHB buffer prefetch Date: Thu, 14 Apr 2016 11:50:54 +0800 Message-ID: <1460605855-6689-9-git-send-email-B56489@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 In-Reply-To: <1460605855-6689-1-git-send-email-B56489@freescale.com> References: <1460605855-6689-1-git-send-email-B56489@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(199003)(189002)(50944005)(50466002)(48376002)(76176999)(575784001)(19580405001)(2201001)(77096005)(19580395003)(2950100001)(36756003)(50986999)(87936001)(106466001)(86362001)(105586002)(81166005)(50226001)(92566002)(2906002)(1096002)(1220700001)(104016004)(4326007)(229853001)(5008740100001)(586003)(11100500001)(189998001)(4001450100002)(47776003)(5003940100001)(5001770100001)(6806005)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB074;H:tx30smr01.am.freescale.net;FPR:;SPF:Neutral;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD011;1:PwTSPqG97FpK57WyqdUwvhBQ7kJyxKxq0pxzRG87dhXtTQ9wO2vxABeJjHSjWYSm6w4VJBugjQtt1WQixURF9DJEE9eZiQwT7sQ2ev35rKFq+y89+3mmvlAFXN1w4XrotJMdPNFZ+UvxL2roCbvD6ZgvXYgKYPKRl8Btbu6wU5bWvqySH2yBcgzScj76fbP+zVMq8LUev1HIgdR8IDqAQpAny/+iYugmTmbmczZecycRRjkXyKYfXk3mjG1KQVbJYFxgol9vaKpyRX+bZlZSkSSZxW+0gsUbuI7gxhl1kHHIyMem+N6t1zSPQb/ND7A/S21gvv8TET6T5zdnwu57KdsMcesDRUxsWHrafeOHeV8eksywvZCjLVk4bzdtOS5rfNQTTufoLWTsOvUn89b7Mj3gVCVvP+2xYEpcldvtpxmIHJjbMPGYawtqVrMedmEhcn4EZH+2D0F55jAknSHHq1a0BVD0YVAyVyDm58iMMFnJ9Thip+ToDkbsUrEeER5KcEXifGTvkamwf4TQAViHInddKUzjIp7hJtGq9ZqOSIeXPNfWzMeG1jiZKy1smJny4DqsIEPevyk52tU0j9Uyuw== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: cb3a09d2-be49-4fa9-754e-08d364195457 X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB074;2:QZy/hM3w0/a2LRE7bpFgoE5/CuayaPFPRf7fhqQ2C5DxDLVCImUl3O37sZzL7QxaNmQWam5+0FZteFFV3Sw+DKQOQav/FEg51bmz8AG+BAoWkwXn8ypukk8fR7fXvzSU45PpfTso84Rs2+iGZ5M/+MamMmNPOm2SI9W9jD1AubhLPjkW0gI7ISPhY71Ht3Na;3:1b2gLHgX2r+q/SNFGxerEdWApc8yCGkqyTGa4L3VgsNAKYVlOKHfyEprqajC4G8HHudWY84YW0JOejgyEX5bKK5Uv7Urz79Con5PxOQoCplEkyR6QGgveO9mO1NQXHjOpR0z08qPWvkj1hNXxG9UI5VXmky+okREdDFwxVCpttSfh0EU7lcJ63IIYgm9/vf6K1akpleKK6PXopq4PzNB2KQEcI+jmu37K0hG1BzrX8I= X-Microsoft-Antispam: UriScan:;BCL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306dqfVzMP/+12e0RMmza9VhSn4TQ0U7SFQ+8m9sbMe0GxH35TUkJq+H8kihc/p0z30JjC3ZieSejKPOzQK+1HjlBIercjMEEHiFzSLsWynSaY4N00ZjcUpO5t7cZC9QbMtS8ayiO3NwhwAsCazmrQw8FRsQF68U3msms;4:uk3WMVA/7/M9yMi6v/W0F0B/XmB1LCKmIKNIzq4LUIl7OkRg3g3HiCyY2reObltmjvP52eKVuldgGA3zQevDYECC83t++mBjfWWdnTFY8/YW+lLd7g5r5EcC1Aapl/cztu0Ly57oUUGywvykRktBbYwYAPf19IgDDRZp/ShVHrak0aARwNDL845AYcnHvt1PC8yhgsmKZACsudARWYyz4ilucwd+mlkEMwLFq2UIJsIkkvTbIWkZCFqnlqPaUfewGNrelrWtEB9MIxKtQTbSI34gJmsLrmg4NqCCdmW0CqvzNcDDU35DWLDtd7Tdfe9fK1LbZyEcDeQr+lUYADBntOKBtraQheebZI9HOGQIobcFYFMnBNDtr48noFf3wXnqP4ebEZAsqeYpH3yAvBZe4XqzLi+KJLx7zLKXOuCG85yeZOajmOaFAmsBJJrPwOxGeg7FBOA8SAM7mb3vYeRzYDhB1mUtR5UU5tQ6/ZJejlM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13023025)(8121501046)(5005006)(13024025)(13018025)(13017025)(13015025)(3002001)(10201501046)(6055026);SRVR:BY2PR03MB074;BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB074; X-Forefront-PRVS: 0912297777 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB074;23:DV90BYenB6SoL/gRHiw0nLdCh1H3j2/tSAYD96+fPR?= =?us-ascii?Q?Yx08N9zd9vnIYqqTgyz845xxdSwclJt2SAp/DmZRv2aw1fG+BHBz0z3a2zEO?= =?us-ascii?Q?u/JwQPXC//CZrmcy1ie6O6PwmLr5eqoSLEp+x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NyQD2ZdDx3NSQAbuiXzOwARLpQZRGshV2HHk8hzFsPgFHCiUHz6n2hwhU?= =?us-ascii?Q?TSsso=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB074;5:IRTyWLBr0257520DZFVZiRWWQqQHYnTLIvPFkUzVstDkoVJEjR4WaZ8UVjkHRtX2qkMPS3ip/RSZdRU6EQs1IxeDhexE95CWmbBXYGTaZunArxlMyZUebkGnc7XGAxaPGciPQsDO+XPrCZ23QsYA7w==;24:vy67/FiypvpGy/syE1Dwr95QEuP+Gr4+YJGSt7M1kj8z3QY4rbDr2IaJckyKlq0jZqCX1h1I/FV2GEipPaviBijU8MGs4X0aiGSLC+Uwe5c= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2016 04:00:33.9477 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB074 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2464 Lines: 68 From: Yunhui Cui A-009282: QuadSPI: QuadSPI data pre-fetch can result in incorrect data Affects: QuadSPI Description: With AHB buffer prefetch enabled, the QuadSPI may return incorrect data on the AHB interface. The buffer pre-fetch is enabled if the fetch size as configured either in the LUT or in the BUFxCR register is greater than 8 bytes. Impact: Only 64 bit read allowed. Workaround: Keep the read data size to 64 bits (8 Bytes), which disables the prefetch on the AHB buffer, and prevents this issue from occurring. Signed-off-by: Yunhui Cui --- drivers/mtd/spi-nor/fsl-quadspi.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index fea18b6..d9f3e50 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -752,19 +752,36 @@ static void fsl_qspi_init_abh_read(struct fsl_qspi *q) { void __iomem *base = q->iobase; int seqid; + const struct fsl_qspi_devtype_data *devtype_data = q->devtype_data; /* AHB configuration for access buffer 0/1/2 .*/ qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF0CR); qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF1CR); qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF2CR); + /* - * Set ADATSZ with the maximum AHB buffer size to improve the - * read performance. + * Errata: A-009282: QuadSPI data prefetch may result in incorrect data + * Workaround: Keep the read data size to 64 bits (8 bytes). + * This disables the prefetch on the AHB buffer and + * prevents this issue from occurring. */ - qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK | - ((q->devtype_data->ahb_buf_size / 8) - << QUADSPI_BUF3CR_ADATSZ_SHIFT), - base + QUADSPI_BUF3CR); + if (devtype_data->devtype == FSL_QUADSPI_LS2080A || + devtype_data->devtype == FSL_QUADSPI_LS1021A) { + + qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK | + (1 << QUADSPI_BUF3CR_ADATSZ_SHIFT), + base + QUADSPI_BUF3CR); + + } else { + /* + * Set ADATSZ with the maximum AHB buffer size to improve the + * read performance. + */ + qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK | + ((q->devtype_data->ahb_buf_size / 8) + << QUADSPI_BUF3CR_ADATSZ_SHIFT), + base + QUADSPI_BUF3CR); + } /* We only use the buffer3 */ qspi_writel(q, 0, base + QUADSPI_BUF0IND); -- 2.1.0.27.g96db324