From patchwork Thu Aug 18 07:37:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunhui Cui X-Patchwork-Id: 9286965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5721360574 for ; Thu, 18 Aug 2016 07:51:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4250028FFC for ; Thu, 18 Aug 2016 07:51:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36F0528FFE; Thu, 18 Aug 2016 07:51:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 06A0628FFC for ; Thu, 18 Aug 2016 07:51:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1baI5d-0004XZ-TB; Thu, 18 Aug 2016 07:50:13 +0000 Received: from mail-dm3nam03on072c.outbound.protection.outlook.com ([2a01:111:f400:fe49::72c] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1baI5P-0003vd-Vb; Thu, 18 Aug 2016 07:50:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freescale.onmicrosoft.com; s=selector1-freescale-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=eyfYEUlalbXzBSWqo6UPv/2fPji0DDqXUtRhcJiyVJs=; b=cvqsNCy5DcIOmN56hvBYY/xlTNqS+zCXSzZUoZy3Zp8iOuBm8cX8ZdEHli+jHh97miU1JV0mUEU42Q3Uhj3HU0/Ky/T12/gmblOw2up++Xx0nwFwl8TSymcxqXu0ULH5IY0gKcdWR+Ug+h+dCaltWni3jCkmhLua/gUcK48xu6c= Received: from BN6PR03CA0032.namprd03.prod.outlook.com (10.175.124.18) by CY1PR0301MB1980.namprd03.prod.outlook.com (10.164.1.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Thu, 18 Aug 2016 07:49:36 +0000 Received: from BN1BFFO11FD022.protection.gbl (2a01:111:f400:7c10::1:142) by BN6PR03CA0032.outlook.office365.com (2603:10b6:404:10c::18) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21 via Frontend Transport; Thu, 18 Aug 2016 07:49:35 +0000 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;nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Neutral (protection.outlook.com: 192.88.168.50 is neither permitted nor denied by domain of freescale.com) Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD022.mail.protection.outlook.com (10.58.144.85) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.567.7 via Frontend Transport; Thu, 18 Aug 2016 07:49:36 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u7I7nW4W012341; Thu, 18 Aug 2016 00:49:33 -0700 From: Yunhui Cui To: , , , Subject: [PATCH v3 1/9] mtd:fsl-quadspi:use the property fields of SPI-NOR Date: Thu, 18 Aug 2016 15:37:56 +0800 Message-ID: <1471505884-33996-1-git-send-email-B56489@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(7916002)(2980300002)(199003)(189002)(229853001)(48376002)(305945005)(5001770100001)(19580395003)(8936002)(356003)(77096005)(106466001)(7846002)(2201001)(47776003)(189998001)(68736007)(50466002)(105606002)(81166006)(81156014)(50986999)(36756003)(97736004)(19580405001)(92566002)(626004)(104016004)(8666005)(50226002)(586003)(87936001)(8676002)(4326007)(5003940100001)(2906002)(7059030); DIR:OUT; SFP:1102; SCL:1; SRVR:CY1PR0301MB1980; H:tx30smr01.am.freescale.net; FPR:; SPF:Neutral; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD022; 1:IsVURykIejYTOOkIFMlPQc2h8aVBD1JYMnBGWtx6TfWVJm4k5Isqb9rY/jtDug3mRA+RtAHkvFG/7mxXG5aUy+wV4LorVpdxY4zKxgoX5FzIiuLGFVlPSlDZA0o1dbjd5crP1qKIRnsvDMEw2b1n9UnBCTGX3MNz77aO/2lc3tf6qa9JyT7SD/zNJp5C+5QAmKSWcfhfobEC04SPHnHHa+pRAZVtnkRtkJf50//PDrm0XU5AKCQmDdzqbbGhmp7dvCVZP+D05Gy1O6Lr7XVZR4hiBohLVGcEW4HQIVtdSKUf+0Q8+PcO1D4I0zT6q3qJIFhGa1rDLNHoj1z7OcfZ+zUNHubMZThV0EpgJTuROmWwiC+jQhvon4wQQ/zkeW0GpqCOdWO4e0MrXftHf3udkVqc3YOo+hWdX7py2v67w6q6TDcMMXYa07HnsW1+zGjsaMjayhsrFk2XS3Lq4Ukx4foebHRewFORNTSoC7N9fFg85AMXfo67bI8w0ZyKBZ3N/XT/U7l8c9EbiVHgFEc0U8JJbrpRvDVnay2sVxqn/fQ+me5RzspVtXRPWtfJ+lec MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 164238ac-f5ab-41ea-15a1-08d3c73c338d X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1980; 2:4BeRG/Rw4LKSRri5/SwPS1D576QuKlEDaVbYCFrqOWaZw1nPSeaBrhWD4s/CZIS21InmNn6/pHPG0OouRKBoPXKdGwHw+GVlT3A9zOhMNlTlxWbCa3hWfv2BtwfVjB0CLL7d45EgJrHR9pDY2TaEsGAe8fRv0eLEYArLCIVrOTadUdI65osYVQXWeTac2uf7; 3:UJL97+0bMwCtsz4JLv3knPRHYMtL/uSS52LVsEWsC+50I0odDSc/2k3LV17JH4+TLynEuIimpNpMbSVMvF5nJjmFEZMzOtDyxZIAC8c49XbPdq0S2OgBGIP89Ro5OESRGthgfmK5itjt2XJFFaSYbkKppK5QAJzoM5/cq1xxpCg5KSKlNEqWvexnZXQ4tqRyZUOOf0NjJHfEIAkWFoYv8TtpWSmgA0dphSgkVLyDwMg= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1980; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1980; 25:dITx03JQA/39cQVTpV5Ik0izJjWdbCsnr77/czL0BqBekZGYR+JcvyIJID9hFHxX+kkbRMv6og+U+myhz43Hr74HuktLyaSRNs3Nfoa5RG1PgR9Ce5gfiB0IgvpdoEiT8K2Ro5DAfux2CDq+/kvmNZ8Ffj6vgq/DGq17ThDiJGuOIpGsvbNXejefYPvz4fjRVzL5WWb3G5G/wFPRiN3MVd63CXQCTyk8Q92Cg7M8fNbAL3XTsqVBWRGTJ3sLat19dfQLg0VOOTMfo+OHIH7tMNCX5Nqx3dx/IgqcU4LfwamkV+9BSK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JFDdMEdYoGh9jXfXW9XqRzkrFVxDmAaH/EZjV8eDNDHPn7+Q+PiaXUBl+EeLkGrgq4xMD2gRXVCCHZGgx40MgBlczIhLn1g7qYtRfnhW5FW7LoWleLV1LkX1M3YIU9+mRJX3Xc3v5dWspe0BoUfwGEujHMligwUPIL+zKX6JojorWPmq/klctKZXtZP5TEkNIQPp86Y+e/0xhLd9rqabOmXBcZVxfJ3aCZeD7tTztfWAG50vS39p1cc1npQjYsjZtuJG/RaOv+DSrlxg3Ihk+QwG61ZUbNf6SJvnjkvjLDw6goPG9veI9Nx9zwS9Qg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(101931422205132); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(13018025)(13015025)(13023025)(13017025)(13024025)(3002001)(10201501046)(6055026); SRVR:CY1PR0301MB1980; BCL:0; PCL:0; RULEID:; SRVR:CY1PR0301MB1980; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1980; 4:ooZa+OzW3ajopKwbAPDVCuV1u7h4U8mEfyEbfoHK5VrVS6TjGZM4i+vbluOE/g2mA7cvDnmiXX+jLokEnqjxuAQUPT9N8+gBYmb4R8auh0sLCP/iw5qLqXu+qdlLNPB95CrWjYiDti3CEGvUBT0lDa2yvcmFcNzRoQGTjQ+jrYhwQm06VnJ1QfWNxeYSPgDYOeF12x7JC4psBrKbuE5sdramqYAMlje2YBmGWoK152WgYEgShydwc3KS/QiFqzKFMHk0DoAtGyumXU8DwJtu9D8p+Brjd6ALElsmMd2o3On0w8Cp9R5uNE7v/1orr7k5xebcHAPUSyLBCml4KViu3oWLFdcoRP4SKUlRtfh5STeW22+HXrSZwjX7X4gdpk5efe0eTlrTkU9ly+WHUvHf4rELETEBXqRv3XFGm1INpbcFuonSQFrcMRDMIdTtfFNhcZlX6/DIam8PlFx7MbQp4+RlU4RWHMlKJ5tRdrz7Z58S4e5B7wuHfoEsuDfl8d+POIcHVMZN9O0GviSVM7gFW7xXjWbeOlmLPZ6EwWjBcPLNZSMB9PW3pKT2t30pbFio5T7vV7J+2I7Kc0K15emrAQ== X-Forefront-PRVS: 0038DE95A2 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1980; 23:gw7NmckbhjEdkuO51o40/k8yUO+4+8pFc3BDLJL?= =?us-ascii?Q?dbZJHOGHH5YUj6O6MX4Ss4G3y04/Bi7gxOOfySEN9LSSoTmgbplPYTkhlthU?= =?us-ascii?Q?cJk7uHwBl1ls3BGrXTKLm1z4lKtfBmYl90sLEJ95ZfmSwlneS2RPRuGg3AWO?= =?us-ascii?Q?ulH9bvLCqoR65yk5vVRElv2uOJqgELf/ouIwgjjv8RRxl4kKPqZNtukAFqUF?= =?us-ascii?Q?+uefZk1en4MfOSf6EgD1HjV9maItxK8JEVUemJj74U14v1IAk6ibiIUr6VxE?= =?us-ascii?Q?KbWyOBOw1eyBCMqmATiclym20ZI/sq15LzZnr9+4AQMorLPd6PorvOS2iFHG?= =?us-ascii?Q?U4u8zg+FEkMcFpWVIe35+YLu2h+arq5EiG4bnic+Sa99nnzZVc8DZDXwAIV5?= =?us-ascii?Q?W10aXYCSP7gjpa9zYuSJ/2/w4BNSmHxhRlfT275zdSiOb/sasfMucQcbPkRI?= =?us-ascii?Q?qL0m5w/PIf5JpGM/FMSLI61pSNwaUVFSyNWYr4VUamrwDgCnG9B5SlNSkWnm?= =?us-ascii?Q?eHiA3EGpV/mp9vrCmTbx1S48SO20UfEtix78USaFjrYT/kSs51sSWj13jJo2?= =?us-ascii?Q?Kgi4BjSWHoLM+Zl3xIH5okmT6MRwxZmT6bMclQgCsY+up+WQBBIxUU90MhuJ?= =?us-ascii?Q?kAyOYiE+PuVc87RMtvuEVlNh3lsyvl7sbwyJX4Yp3JSIo/2QM/bgX94ebZ1X?= =?us-ascii?Q?cKJD5NYyTZWnHbiMQJ0hmFeJ6LiD4fe94aKx1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VkPkCTg+elERtKLsg83Fx+jSsRwYZAOHA2+mRFw8k69Vj+FHikbke2aLOjWQqW0aYc28/R8tlrWWlxiSMbMhb+C3QPO0GMSQ1a0H9YvsrK1ed/zvTcqqd/bchnjTj+bEntCe8owr/JS4AHUk+6fgjn SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2016 07:49:36.4193 (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: CY1PR0301MB1980 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160818_005000_376267_5AFED87F X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yunhui Cui , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, yao.yuan@nxp.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP We can get the read/write/erase opcode from the spi nor framework directly. This patch uses the information stored in the SPI-NOR to remove the hardcode in the fsl_qspi_init_lut(). Signed-off-by: Yunhui Cui Signed-off-by: Yunhui Cui Acked-by: Han xu Reviewed-by: Cyrille Pitchen --- drivers/mtd/spi-nor/fsl-quadspi.c | 40 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 5c82e4e..5ad6402 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c @@ -373,9 +373,13 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) void __iomem *base = q->iobase; int rxfifo = q->devtype_data->rxfifo; u32 lut_base; - u8 cmd, addrlen, dummy; int i; + struct spi_nor *nor = &q->nor[0]; + u8 addrlen = (nor->addr_width == 3) ? ADDR24BIT : ADDR32BIT; + u8 read_op = nor->read_opcode; + u8 read_dm = nor->read_dummy; + fsl_qspi_unlock_lut(q); /* Clear all the LUT table */ @@ -385,20 +389,10 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) /* Quad Read */ lut_base = SEQID_QUAD_READ * 4; - if (q->nor_size <= SZ_16M) { - cmd = SPINOR_OP_READ_1_1_4; - addrlen = ADDR24BIT; - dummy = 8; - } else { - /* use the 4-byte address */ - cmd = SPINOR_OP_READ_1_1_4; - addrlen = ADDR32BIT; - dummy = 8; - } - - qspi_writel(q, LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen), + qspi_writel(q, LUT0(CMD, PAD1, read_op) | LUT1(ADDR, PAD1, addrlen), base + QUADSPI_LUT(lut_base)); - qspi_writel(q, LUT0(DUMMY, PAD1, dummy) | LUT1(FSL_READ, PAD4, rxfifo), + qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) | + LUT1(FSL_READ, PAD4, rxfifo), base + QUADSPI_LUT(lut_base + 1)); /* Write enable */ @@ -409,16 +403,8 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) /* Page Program */ lut_base = SEQID_PP * 4; - if (q->nor_size <= SZ_16M) { - cmd = SPINOR_OP_PP; - addrlen = ADDR24BIT; - } else { - /* use the 4-byte address */ - cmd = SPINOR_OP_PP; - addrlen = ADDR32BIT; - } - - qspi_writel(q, LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen), + qspi_writel(q, LUT0(CMD, PAD1, nor->program_opcode) | + LUT1(ADDR, PAD1, addrlen), base + QUADSPI_LUT(lut_base)); qspi_writel(q, LUT0(FSL_WRITE, PAD1, 0), base + QUADSPI_LUT(lut_base + 1)); @@ -432,10 +418,8 @@ static void fsl_qspi_init_lut(struct fsl_qspi *q) /* Erase a sector */ lut_base = SEQID_SE * 4; - cmd = q->nor[0].erase_opcode; - addrlen = q->nor_size <= SZ_16M ? ADDR24BIT : ADDR32BIT; - - qspi_writel(q, LUT0(CMD, PAD1, cmd) | LUT1(ADDR, PAD1, addrlen), + qspi_writel(q, LUT0(CMD, PAD1, nor->erase_opcode) | + LUT1(ADDR, PAD1, addrlen), base + QUADSPI_LUT(lut_base)); /* Erase the whole chip */