From patchwork Mon Oct 15 12:14:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yogesh Narayan Gaur X-Patchwork-Id: 984160 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="No5mSIpt"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="BErEOgzM"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42Ycw91bHcz9s4s for ; Mon, 15 Oct 2018 23:20:25 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6N9OSClmo6HwmZ8GjPd4KLq2Vdu7iuctyFBXAjJZidg=; b=No5mSIptKyvFaa sWBrWefI58TP+5+SDFN5p6epnggmOTKF0vju8/ieufaLbUacuCkZNMX0NwgRjY5OmwcgxriBoiGUM iD7idVEZ+3JrLI0D8qTekj6o3Uhp1SZU7+Vxdx/BHt40Z1qEjEaFk2mT5i6hv5KS0yCw++VZBHMX3 qkEGzJAS/ih5f2gOXByUyLC85tgirAxcOmZZH4JAQFF473QY9/GUDuqXwzi1ENamN3v30xVOhmqEl WIt8s1Xp/kZIkWx191bX7RMAHlJyckBo1kOC106q1Rt3/cu630wwhmluvoDVcgJjnIlrFWdRz9g1U HZ0HwQm0hF7yDuA0n9JQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gC1r0-0003Qk-GX; Mon, 15 Oct 2018 12:20:10 +0000 Received: from mail-db5eur01on0048.outbound.protection.outlook.com ([104.47.2.48] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gC1mI-0008DK-Ea; Mon, 15 Oct 2018 12:17:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YJ0/JgVp/APCSXROLBC8g4dk/xsAJcWKzy3GjBlvnv8=; b=BErEOgzM1zQHmexrhvht52+ZV6wxka0G6aWJHzCO3Q0gZQS4LOYRh4jvx7qwgv3j7m/Y3u+JF1c8teQVw6xncU9b6Jv8PXHQGgkDbWg9yVYWL5dOYp5J7zyxX4BqRfW867W+xmAfBpuOFckBq/E3wJXTR+GdPZo3jruaytO4KDo= Received: from VI1PR04MB1038.eurprd04.prod.outlook.com (10.161.109.144) by VI1PR04MB4240.eurprd04.prod.outlook.com (52.134.31.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.24; Mon, 15 Oct 2018 12:14:15 +0000 Received: from VI1PR04MB1038.eurprd04.prod.outlook.com ([fe80::d887:3c96:479a:4123]) by VI1PR04MB1038.eurprd04.prod.outlook.com ([fe80::d887:3c96:479a:4123%3]) with mapi id 15.20.1228.027; Mon, 15 Oct 2018 12:14:15 +0000 From: Yogesh Narayan Gaur To: "linux-mtd@lists.infradead.org" , "boris.brezillon@bootlin.com" , "marek.vasut@gmail.com" , "vigneshr@ti.com" , "linux-spi@vger.kernel.org" , "devicetree@vger.kernel.org" Subject: [PATCH v2 3/7] mtd: spi-nor: add opcodes for octal Read/Write commands Thread-Topic: [PATCH v2 3/7] mtd: spi-nor: add opcodes for octal Read/Write commands Thread-Index: AQHUZICXAkTkZcvXNkqjh+fEDBQzWA== Date: Mon, 15 Oct 2018 12:14:15 +0000 Message-ID: <1539605534-22302-4-git-send-email-yogeshnarayan.gaur@nxp.com> References: <1539605534-22302-1-git-send-email-yogeshnarayan.gaur@nxp.com> In-Reply-To: <1539605534-22302-1-git-send-email-yogeshnarayan.gaur@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SG2PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:54::18) To VI1PR04MB1038.eurprd04.prod.outlook.com (2a01:111:e400:5092::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yogeshnarayan.gaur@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [14.143.30.134] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR04MB4240; 6:Ky8D4QDVVk4kVvHikpOjX7rqyJq//RKR57EOvhHL/KRoyNd/amaudJqHqH8U6NN5+mwEjXa0qHRmXvW37P6ZGpnZ44OBVHj4GbUemwI+zO7PID6l1dpcWlSCi/e5UNV9le/ziQRbhdHWnYHjMPaOCCLZZQPd+JKbTaLwW2HE36phm/+KwxMJfyn/D657bp6CZJRX1NFMvXktofwfWRKpwRZSyGPDiAp15TM+p9RBjrc0LviNaRpd5Ql/b6KTytm4z5ctfgyez0hSGx+8PbOB67J3qDk8XLB+71YVPj8A9a5kQETmahJLuOoPnz3YkIbmSTYeQBaVxQiIcF0T/TmKAYWOoVz5N5omlvkSYhML8h5TLDHIOcd6nKS5bwPydJTc+1rSu84iUaLBJkT+2vu3Ixo9gniM6EmjGBW1L4FblNE5GX/S0yHZAgaiJGKjTxXJujEmzCfyubKbuqJYiten0Q==; 5:+9I14c1bfqhmdwRvRaCg47G5jPfTBOqK14mIHoCEATR5ID4T1NfBHJYIvQISbzkfZCasTyMew4uGZ9m0pV0SfApYGJpgn8bgvULyylhVDrwlgCVE38bAOAQDFwhtiWEav/PlfTSfmgConGVyIURO1/78qLvK2omlPBSzdVgeKvI=; 7:ROdC3HiVNfmSQk3ihSBNS0HvHRanJgOuLf1qN5GKrG9bz6zuBcb34GcN2Ob2N1VmbbKgPiL7WwZY96qZ4x4aPxdHHLn3KdcL9CYhzkkaEufuaMlCijHtiDIWCtCJWDV2fYJP7wQUZX3autFhBc12Sc6xAvofDY5iF+sBGb6PtvQql788lXhGSfZ88CIZPC7bssVxGBPu+A7AvBT1TH3G64SGjjGBgYkGNKw08jqMVCzA1bypAmHeCJjBpyum9Spj x-ms-office365-filtering-correlation-id: 162a5fbb-bfe3-47bc-e064-08d63297b949 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR04MB4240; x-ms-traffictypediagnostic: VI1PR04MB4240: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(31051911155226)(185117386973197); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:VI1PR04MB4240; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB4240; x-forefront-prvs: 0826B2F01B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(366004)(396003)(346002)(199004)(189003)(86362001)(575784001)(102836004)(106356001)(99286004)(105586002)(6486002)(39060400002)(26005)(6436002)(476003)(446003)(71190400001)(71200400001)(2201001)(186003)(5660300001)(66066001)(486006)(11346002)(2616005)(14454004)(97736004)(305945005)(55236004)(52116002)(76176011)(478600001)(4326008)(5250100002)(36756003)(81156014)(81166006)(54906003)(7736002)(53936002)(6512007)(68736007)(2501003)(8676002)(8936002)(6506007)(386003)(256004)(2906002)(110136005)(7416002)(316002)(2900100001)(25786009)(6116002)(3846002)(21314002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB4240; H:VI1PR04MB1038.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Pn0xYYJzDcMOlUeGca5aSyE5L5/bRkxJ+JBv5VyXG8PXR1PNs0KFVzeU26XnyOJnU/cOt1DulAxfr0vCk3IQ8Omi7sTZ09CQX7zMHrn0yXCjqvNf2XbBV9rrcGZ4ezZR3WdhGUo5q4d/tFCYluKh34MILYwgUyElX6MEV3Gp168ymaCJzXZSJvFxKENojwt/3x2h2JqF1JBO2YvA/zzhIgXN5dYNKkcqFNF8OAKv6+3YN5M224bNzHcAiJhXJK5PgmG1qtQdkEdSx0CGxzYcyFcuZVjUosX+0/ktRwFfRO1+j2ja2b/vMZyJ8nL4zL18H4teUGOFlzjhDoLJ6B4+eVXeCGqjsdx/6nVyTImMKqk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 162a5fbb-bfe3-47bc-e064-08d63297b949 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Oct 2018 12:14:15.6126 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4240 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181015_051518_683251_B15F2D6B X-CRM114-Status: GOOD ( 13.81 ) X-Spam-Note: SpamAssassin invocation failed X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "mark.rutland@arm.com" , "robh@kernel.org" , Yogesh Narayan Gaur , "linux-kernel@vger.kernel.org" , "frieder.schrempf@exceet.de" , "computersforpeace@gmail.com" , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org - Add opcodes for octal I/O commands * Read : 1-1-8 and 1-8-8 protocol * Write : 1-1-8 and 1-8-8 protocol * opcodes for 4-byte address mode command - Entry of macros in _convert_3to4_xxx function - Add flag specifying flash support octal read commands. Signed-off-by: Vignesh R Signed-off-by: Yogesh Gaur --- Changes for v2: Incorporated review comments of Boris and Vignesh drivers/mtd/spi-nor/spi-nor.c | 12 ++++++++++++ include/linux/mtd/spi-nor.h | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index 0b8a6e0..7c64ff0 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -90,6 +90,7 @@ struct flash_info { #define NO_CHIP_ERASE BIT(12) /* Chip does not support chip erase */ #define SPI_NOR_SKIP_SFDP BIT(13) /* Skip parsing of SFDP tables */ #define USE_CLSR BIT(14) /* use CLSR command */ +#define SPI_NOR_OCTAL_READ BIT(15) /* Flash supports Octal Read */ int (*quad_enable)(struct spi_nor *nor); }; @@ -209,6 +210,8 @@ static inline u8 spi_nor_convert_3to4_read(u8 opcode) { SPINOR_OP_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B }, { SPINOR_OP_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B }, { SPINOR_OP_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B }, + { SPINOR_OP_READ_1_1_8, SPINOR_OP_READ_1_1_8_4B }, + { SPINOR_OP_READ_1_8_8, SPINOR_OP_READ_1_8_8_4B }, { SPINOR_OP_READ_1_1_1_DTR, SPINOR_OP_READ_1_1_1_DTR_4B }, { SPINOR_OP_READ_1_2_2_DTR, SPINOR_OP_READ_1_2_2_DTR_4B }, @@ -225,6 +228,8 @@ static inline u8 spi_nor_convert_3to4_program(u8 opcode) { SPINOR_OP_PP, SPINOR_OP_PP_4B }, { SPINOR_OP_PP_1_1_4, SPINOR_OP_PP_1_1_4_4B }, { SPINOR_OP_PP_1_4_4, SPINOR_OP_PP_1_4_4_4B }, + { SPINOR_OP_PP_1_1_8, SPINOR_OP_PP_1_1_8_4B }, + { SPINOR_OP_PP_1_8_8, SPINOR_OP_PP_1_8_8_4B }, }; return spi_nor_convert_opcode(opcode, spi_nor_3to4_program, @@ -3195,6 +3200,13 @@ static int spi_nor_init_params(struct spi_nor *nor, SNOR_PROTO_1_1_4); } + if (info->flags & SPI_NOR_OCTAL_READ) { + params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_8; + spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_1_1_8], + 0, 8, SPINOR_OP_READ_1_1_8, + SNOR_PROTO_1_1_8); + } + /* Page Program settings. */ params->hwcaps.mask |= SNOR_HWCAPS_PP; spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP], diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 8b1acf6..019f534 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -50,9 +50,13 @@ #define SPINOR_OP_READ_1_2_2 0xbb /* Read data bytes (Dual I/O SPI) */ #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad Output SPI) */ #define SPINOR_OP_READ_1_4_4 0xeb /* Read data bytes (Quad I/O SPI) */ +#define SPINOR_OP_READ_1_1_8 0x8b /* Read data bytes (Octal Output SPI) */ +#define SPINOR_OP_READ_1_8_8 0xcb /* Read data bytes (Octal I/O SPI) */ #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */ #define SPINOR_OP_PP_1_1_4 0x32 /* Quad page program */ #define SPINOR_OP_PP_1_4_4 0x38 /* Quad page program */ +#define SPINOR_OP_PP_1_1_8 0x82 /* Octal page program */ +#define SPINOR_OP_PP_1_8_8 0xc2 /* Octal page program */ #define SPINOR_OP_BE_4K 0x20 /* Erase 4KiB block */ #define SPINOR_OP_BE_4K_PMC 0xd7 /* Erase 4KiB block on PMC chips */ #define SPINOR_OP_BE_32K 0x52 /* Erase 32KiB block */ @@ -73,9 +77,13 @@ #define SPINOR_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */ #define SPINOR_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */ #define SPINOR_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */ +#define SPINOR_OP_READ_1_1_8_4B 0x7c /* Read data bytes (Octal Output SPI) */ +#define SPINOR_OP_READ_1_8_8_4B 0xcc /* Read data bytes (Octal I/O SPI) */ #define SPINOR_OP_PP_4B 0x12 /* Page program (up to 256 bytes) */ #define SPINOR_OP_PP_1_1_4_4B 0x34 /* Quad page program */ #define SPINOR_OP_PP_1_4_4_4B 0x3e /* Quad page program */ +#define SPINOR_OP_PP_1_1_8_4B 0x84 /* Octal page program */ +#define SPINOR_OP_PP_1_8_8_4B 0x8e /* Octal page program */ #define SPINOR_OP_BE_4K_4B 0x21 /* Erase 4KiB block */ #define SPINOR_OP_BE_32K_4B 0x5c /* Erase 32KiB block */ #define SPINOR_OP_SE_4B 0xdc /* Sector erase (usually 64KiB) */