Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750948AbcDNEAh (ORCPT ); Thu, 14 Apr 2016 00:00:37 -0400 Received: from mail-bl2on0133.outbound.protection.outlook.com ([65.55.169.133]:27961 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750738AbcDNEAf (ORCPT ); Thu, 14 Apr 2016 00:00:35 -0400 Authentication-Results: spf=fail (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 7/9] mtd: fsl-quadspi: Solve Micron Spansion flash command conflict Date: Thu, 14 Apr 2016 11:50:53 +0800 Message-ID: <1460605855-6689-8-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)(1109001)(1110001)(339900001)(199003)(189002)(2201001)(50986999)(36756003)(76176999)(85426001)(5001770100001)(2906002)(5008740100001)(4326007)(81166005)(19580405001)(86362001)(19580395003)(1096002)(586003)(1220700001)(106466001)(105606002)(87936001)(92566002)(50226001)(77096005)(2950100001)(5003940100001)(6806005)(47776003)(189998001)(11100500001)(4001450100002)(229853001)(104016004)(50466002)(48376002)(7059030);DIR:OUT;SFP:1102;SCL:1;SRVR:SN2PR03MB080;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD007;1:sdHk9j2zUF6667+i25uxDhI9Mcqmlt+oFC5uF7Rr6IhD99E1YBz/Uf71meduCfiIZNtOq0hcJ7r1+zhZAIBgDwZQH92w8cHf1c9EJf3ENtgqmi13KCZW7nVrtm3TRMaCc45Msrpr2bYhFabIN9Rp6JwS1KbqNezhtLDI0uCOkwa8JFiPzMwp8lgUlW/YsazxHX64tYQ00+XZKdNiSI0cXnm1+Ad91xiDxNOhJjxfZ5OTTgj1Pa09WBtCexNc/zVnGvz0Xm0TsbOLRlkaHcfpalBbdtdcxVUAVgdYNU73MMstFWHFuOp7Ja2uoEsYaRsEhBMq0QercUcKHQ+1fQ3ZOGS/kqvxtx8riy65MgOpoCOrv4/ML6FOilAmh+ZCSgetG5LrgkLzbX/YAKrDbzGMPlb97/H/Sfu+Tb7ZMKViB4iXMVOX/EVCmmBlyK/V/f5S8zq7xstr4l68m+MR1JEY1hMgBary+NjU5P+YLKb+V9bItLra6fv16P2deOMUPIg6GUBg57SoazHSGeAvSX7xrcczQ7UX0640RP3dwGzJPaX03XXpCVR5t2RraogKX2q8DmyX9jC2pPtHw1p0rQKPSA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 27d916ae-fa78-4df6-7c29-08d36419529b X-Microsoft-Exchange-Diagnostics: 1;SN2PR03MB080;2:rfaKsLeyedngfxU+cuSpp0MyPIZ+LVjco/oAgnyyIPWsXlKC0NKpO7Rp1sRvWVqKzj6cgv593hKwREVkcD0zChSwmw4q/zPlJMcS7uAKKzs0TCBMOCYGEZ0zINjzRgnRr6c1x/svs4ch6+bvfMLK5Lrbs+ktAxmsFHk3//nDzbhBBdPQX4IxU9YHKzYTqvUM;3:FwDMNIeaHExRTKCfgjyfOlTSCXvwUSTlw8GzmnyT87fK22bhOSv8BTFS6dox6iQhAR3yJ4zWITCvE7nzthzFfjt0Rk34FEDIIwBvtmghyfLD+OnnDTv7egKsh82wm+mE5LybOwiqLPGEBBB9ySNGp7zQ+Oy4Vao0aeTZvUGVF6GLiwpTziQfImal3V/WLB3KwrFYcdtKm/lTxWNhBs3xY/x/mFiX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MH9NcZGcO4300TvJdY0cBw5KZoIP3yVJXodQ0prGU6E9IxuEJN1AGwo60KbPWeEt7EuvzSyhDQNcpj4QSdqagsW4cpWQ5pODWwopVl2FjkOE+M1HTXj1KdQ1kdjOfV+30RPW2lnmq/qSxcVoT/EWUSAYObzSbVCtD2aYg51X6/JJV80eTGm1L7bxfbosOG8uvDRFvOm3cSS6J6mWKE2d4xxa9uNFyFZ7nuhF20JNfVhSjglxeWGKMlZqEXoAmiJKH9hwLC3TNvT2QGbqs3xMZLZLJadlR70t2z2GqfRrR6rjXzJL+nv+NcKI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13023025)(13017025)(13018025)(13024025)(8121501046)(5005006)(13015025)(10201501046)(3002001)(6055026);SRVR:SN2PR03MB080;BCL:0;PCL:0;RULEID:;SRVR:SN2PR03MB080; X-Forefront-PRVS: 0912297777 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR03MB080;23:bSeo3L815J/AfRZgM9dTnv4sJBHxJEugPMHSKp8mzI?= =?us-ascii?Q?MqBgSvyDJ50dtMkiWUkc6pG5K5/hjXtmXZXERGI11F7IHtg3ANRjZXzZj17E?= =?us-ascii?Q?opiTetXn80JAJolH+iuiDbQGMWcZVTr9m9uhIT7HJtCFME0o9x8c3n3PHW2p?= =?us-ascii?Q?g+qJt3OL12jOtDRq7WZuw1Jz2C2jVM5DvPXN4KwAk7MEahzWDgySOufA5bZG?= =?us-ascii?Q?RutApV3+8XAw1QDayUZoF3LSrcs1OaoRQ7mof6uYdVfoiNpV4roBgfJNO4tM?= =?us-ascii?Q?e2T7UI7XLWLl5M8KHpyn9AcBSJSFLRFnBHR/PcyrY+B+SVzvell0IPW3kNXQ?= =?us-ascii?Q?Y4HL3uCheTb+OyAKXfssDU/ewNlQ78yHiCvQ9nLVh2YPqeMCxEbLubX/esUz?= =?us-ascii?Q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j6xGueLX4gbifgUWSKqvanvx2e0dDr6q8V7b5nHOsHaTkO6l9FRZar18uY0Y1k= X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2016 04:00:31.0381 (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: SN2PR03MB080 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3655 Lines: 113 From: Yunhui Cui Add some lut_tables to support quad mode for flash n25q128 on the board ls1021a-twr and solve flash Spansion and Micron command conflict. In switch {}, The value of command SPINOR_OP_RD_EVCR and SPINOR_OP_SPANSION_RDAR is the same. They have to share the same seq_id: SEQID_RDAR_OR_RD_EVCR. Signed-off-by: Yunhui Cui --- drivers/mtd/spi-nor/fsl-quadspi.c | 47 ++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 5d9d192..fea18b6 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -207,9 +207,9 @@ #define SEQID_RDCR 9 #define SEQID_EN4B 10 #define SEQID_BRWR 11 -#define SEQID_RDAR 12 +#define SEQID_RDAR_OR_RD_EVCR 12 #define SEQID_WRAR 13 - +#define SEQID_WD_EVCR 14 #define QUADSPI_MIN_IOMAP SZ_4M @@ -393,6 +393,7 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) int rxfifo = q->devtype_data->rxfifo; u32 lut_base; int i; + const struct fsl_qspi_devtype_data *devtype_data = q->devtype_data; struct spi_nor *nor = &q->nor[0]; u8 addrlen = (nor->addr_width == 3) ? ADDR24BIT : ADDR32BIT; @@ -489,16 +490,26 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_BRWR), base + QUADSPI_LUT(lut_base)); + /* - * Read any device register. - * Used for Spansion S25FS-S family flash only. + * Flash Micron and Spansion command confilict + * use the same value 0x65. But it indicates different meaning. */ - lut_base = SEQID_RDAR * 4; - qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_SPANSION_RDAR) | - LUT1(ADDR, PAD1, ADDR24BIT), - base + QUADSPI_LUT(lut_base)); - qspi_writel(q, LUT0(DUMMY, PAD1, 8) | LUT1(FSL_READ, PAD1, 1), - base + QUADSPI_LUT(lut_base + 1)); + lut_base = SEQID_RDAR_OR_RD_EVCR * 4; + if (devtype_data->devtype == FSL_QUADSPI_LS2080A) { + /* + * Read any device register. + * Used for Spansion S25FS-S family flash only. + */ + qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_SPANSION_RDAR) | + LUT1(ADDR, PAD1, ADDR24BIT), + base + QUADSPI_LUT(lut_base)); + qspi_writel(q, LUT0(DUMMY, PAD1, 8) | LUT1(FSL_READ, PAD1, 1), + base + QUADSPI_LUT(lut_base + 1)); + } else { + qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_RD_EVCR), + base + QUADSPI_LUT(lut_base)); + } /* * Write any device register. @@ -511,6 +522,11 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) qspi_writel(q, LUT0(FSL_WRITE, PAD1, 1), base + QUADSPI_LUT(lut_base + 1)); + /* Write EVCR register */ + lut_base = SEQID_WD_EVCR * 4; + qspi_writel(q, LUT0(CMD, PAD1, SPINOR_OP_WD_EVCR), + base + QUADSPI_LUT(lut_base)); + fsl_qspi_lock_lut(q); } @@ -523,8 +539,15 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd) case SPINOR_OP_READ_FAST: case SPINOR_OP_READ4_FAST: return SEQID_READ; + /* + * Spansion & Micron use the same command value 0x65 + * Spansion: SPINOR_OP_SPANSION_RDAR, read any register. + * Micron: SPINOR_OP_RD_EVCR, + * read enhanced volatile configuration register. + * case SPINOR_OP_RD_EVCR: + */ case SPINOR_OP_SPANSION_RDAR: - return SEQID_RDAR; + return SEQID_RDAR_OR_RD_EVCR; case SPINOR_OP_SPANSION_WRAR: return SEQID_WRAR; case SPINOR_OP_WREN: @@ -550,6 +573,8 @@ static int fsl_qspi_get_seqid(struct fsl_qspi *q, u8 cmd) return SEQID_EN4B; case SPINOR_OP_BRWR: return SEQID_BRWR; + case SPINOR_OP_WD_EVCR: + return SEQID_WD_EVCR; default: if (cmd == q->nor[0].erase_opcode) return SEQID_SE; -- 2.1.0.27.g96db324