Received: by 10.223.164.202 with SMTP id h10csp1858620wrb; Fri, 24 Nov 2017 02:28:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMa+9jWG6RvakZoSqaQwGzlx3DswTcrFp+R10ZW/akgybS1LV1Z48k9pJkek77vKIJUil8Es X-Received: by 10.101.76.3 with SMTP id u3mr15813651pgq.136.1511519311512; Fri, 24 Nov 2017 02:28:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511519311; cv=none; d=google.com; s=arc-20160816; b=ofW7nFhtV3qX3e8yP49oGWItpgzgET60x8Hl9xbu2Pxpwc+ma69HVnk18Fmck9M4oQ eCDVt5Y2jSpQKEHKsFQd+5aApxgcJ52iaBRMiQGdvysqrzK/jdKrki19iduvJxepHbtm HmMjbnuOeynfPYgQ3ElzCaB6YwxzgctDkWmHYiAQF7T1Mzu0g90Y5aXOE5llzrtjvhdC TxKRb9elH2K5oD36Jwd5GpiNXIGW7TViZgBOed63fog/3Z9t65O0FmD1Pul/dLssW5uz rjLH9yJbJosJtngrYM7Brge4eeKGhvA9j3JSrkUAF5xovZtZejybsHCCicrVOMJBXS3C uT9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:arc-authentication-results; bh=m2zqYGQv1hYPcvFhAPvNManEfroy2RryMAVAQz04s5I=; b=kyyzlckUx0f1R+LRkoyh27QYXPck8F6gEujnsFBHL09JrqpktBWilz3W76xMXxCFUL E5Q5qS+yNObdNXANXNJtabkgJzNSWOAFeuhK+UpqIv744dKleYD6hdApMHy+Wshm2g26 BQreRX24ycKU9kOtv9eugiJbQwRVq0n6RSV72k9NHDQXxUm3aMPMnpqNi5jXW/tTT1QG ov4S9CBI2cxck8comC/bRYmLHpQ2tHfFcLJRW+9/JObEcEuN1jEO8gEYd1eTrPrwhfWj OvQrQKirrdEjJ2pzvKdkuUmz88rJD9yjvktvsEL6cymIddbSINLSKV7SOZlS2PIsXqo3 W4SA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p66si17610397pga.782.2017.11.24.02.28.19; Fri, 24 Nov 2017 02:28:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbdKXK1b (ORCPT + 77 others); Fri, 24 Nov 2017 05:27:31 -0500 Received: from mail-sn1nam01on0056.outbound.protection.outlook.com ([104.47.32.56]:62912 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753416AbdKXK11 (ORCPT ); Fri, 24 Nov 2017 05:27:27 -0500 Received: from BN3PR03CA0062.namprd03.prod.outlook.com (10.167.1.150) by DM5PR03MB2697.namprd03.prod.outlook.com (10.168.197.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Fri, 24 Nov 2017 10:27:26 +0000 Received: from BL2FFO11OLC015.protection.gbl (2a01:111:f400:7c09::140) by BN3PR03CA0062.outlook.office365.com (2a01:111:e400:7a4d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Fri, 24 Nov 2017 10:27:25 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11OLC015.mail.protection.outlook.com (10.173.160.81) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Fri, 24 Nov 2017 10:27:26 +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 vAOARInN009453; Fri, 24 Nov 2017 03:27:22 -0700 From: Zhiqiang Hou To: , , , , , , , CC: Hou Zhiqiang Subject: [PATCH 1/2] mtd: spi-nor: add a API to restore the addressing mode Date: Fri, 24 Nov 2017 18:08:47 +0800 Message-ID: <20171124100848.1828-2-Zhiqiang.Hou@nxp.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171124100848.1828-1-Zhiqiang.Hou@nxp.com> References: <20171124100848.1828-1-Zhiqiang.Hou@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131559928461781049;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(336005)(39380400002)(346002)(39860400002)(376002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(85426001)(4326008)(575784001)(86362001)(6666003)(105606002)(106466001)(50466002)(498600001)(8936002)(316002)(189998001)(39060400002)(48376002)(8656006)(53936002)(16586007)(72206003)(36756003)(110136005)(2201001)(2906002)(47776003)(356003)(50226002)(104016004)(50986999)(76176999)(5660300001)(2950100002)(77096006)(51416003)(305945005)(97736004)(8676002)(81156014)(81166006)(1076002)(68736007)(2101003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR03MB2697;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11OLC015;1:XTR6N+OzGyFaSE7dEO3JOjQG+HUptb0xVc3dtPLTHLCKL3TzFXfRh5+J4TIz5+cZ/ga7LrC7oVXkBPXlbBCLi6/W8N7ZUwXGLXX4AqV9QSb8F9Sfy90dbJhgg7FFgLl1 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4628075)(201703131517081)(2017052603199);SRVR:DM5PR03MB2697; X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;3:TX2ibsV47NZ0KOnd7wLcXzofGTE3b73brlfkt24itjl24pWQSSpT9WNudt6pMHR4gN43t3/wQ5vKiMc2lrF1GIyRVCzE/OrVjY9xTwJTIzmb2AirG02VCP7sCI6IRjiGV5IRbQlyapjb7C7Hw2/mwqZ/z4gfPHd+8h2mjR9VmZt80ApJb+0MzD3YLm1WjgjJyNy0e8hWxMZQ+4ODAGwhK9wj9bQY30dOynww7OVAw1CjzsBW4v1F0IIf4I7NMuWsHFfQ8pkG+UUGDQM+O6xSpDmpf9yFaYsXQKWjlnmfvkrz1xB9atzUsfY6qZYZoulbsDBtYNPJJR9T/6cruKOmOUarhdk+XQA8QVq9aPhuTeo=;25:mPOVyxowYbMNXx3uLib7moWTVeSLIZ6UghRYyAfcrwTnbU2hisSKpj0FyzO9goT9OWcTPS1LvqlBmpghlEKGsBq9YGnPaI4YRMWclRhNrXswtFK9OuJAJyS+gaGgLOTuxy3rb9HFeeLOpoC2JRTg0h1V4CbRQevFiTweFY4xXIH2Nqg90r+iphjGwNSCLhF6EphHABxlYqwjV9s3zVLir+LnGm6vGqaL9+nudf/tehXa0e7E7GwiToWtEWWihs7W0wKOhJV8wkaV6AyDmicITDewnxUbEXZMKIiHvgQ0aBzKgfU116KQucotly42WGRH8YOXfiKsrrxTC28OuNhOWmv4A9KtWWHo6ElqsOAZ/bo= X-MS-TrafficTypeDiagnostic: DM5PR03MB2697: X-MS-Office365-Filtering-Correlation-Id: 14142295-2ad0-438d-86dc-08d53325f518 X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2697;31:/FQx5OthG6ilsoOQpF6TTFS+mV5e/fAofaHKpU/nF+7Z3zDxs0/rxFE7zSM5Qe9X6BYdW1FFyl0VcixLZA5uFqZfLkuYHf74tVu8SbZZ7dmCcM24ThP7JU+upSnl04UbmsoGCHmXJtUeYqZWzriq8OSc40YicN0iZE9Crm3ltoHLJyT9MB7q42YDDhXSTLb/6f182OT9NXEn8jU1IzJGFplLOFwMWKBoD1BhFecxYZs=;4:nv+5903vmX2GYmDnIrbOax4y7j5707WARc1cHyJQno0G0Vva7pAFsdczMYrhTL8hQkvuEEvhaKVQT3Jv9R/WH4+lOD/OnKbuYiQLXAvqWKjuo023FGKyHV5FJvocuG9k5B5KCxHo2MMK+lr3mqnkL0w8t2xhS9hEHMAldHhz+fcJtSFqK899+XISxHNfwzmSXnjGKzc/qVu7Nr7656lfzGOrLevKBEa6cgBuONQBd2kOxojqSdF8W7hlpMJxs5h8cZhbMj3daAYsUxWbJVb+0DKayy3Uz86wAyWM9phYAAyjrVUlejtZEB80DvpuCczm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231022)(3002001)(6055026)(6096035)(20161123561025)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025)(20161123556025)(20161123563025)(201708071742011);SRVR:DM5PR03MB2697;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:DM5PR03MB2697; X-Forefront-PRVS: 05015EB482 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR03MB2697;23:J1oPrrw9HLryvS+Scd4tl+tnkvxe+BChL0Dg4Dqo7?= =?us-ascii?Q?bWeXX5583sQOfsUXB7bkSAtrTWW6E59nm3TAhQ1F+VS32RG4LcAGbekMWjWF?= =?us-ascii?Q?RS4xPgkF8w9Yis406rCqYC1MW3hXVwzRGjgGWaoosTlcJbT8ok93FYlB7NzV?= =?us-ascii?Q?ZUdlf9qKaTXefnTQ0bmtk47zvGd7JKDGY11lvgYDw2+YL8N6vrOgNG40moNE?= =?us-ascii?Q?L4nXvwAh8FgxLs8yW3iN/2wLyJ6SLXMQf8XamJeTx+6oWXH+STJ18OpkxzyB?= =?us-ascii?Q?BhvTj2Aj+3evBSN5HiBBROwjKISJOYjg/+KnXYXfFErZILsLNBUZ8j4DWHrp?= =?us-ascii?Q?QLd6O0vxseQat/1byZ7mcYCqPYm/JqZwPY0zoR2B7nTocJ6kRSMNWY1Epl9/?= =?us-ascii?Q?bDMJLre0SxPYcfPiUKIfbA7sjCZpdHzRFF/c9Hk5q3P815AcXQp7xqnaUI/T?= =?us-ascii?Q?DD5t89GfQRYUWVDvJC5wam0U19csQ0inBT8YAqid1AdwyQOI2cAZg3d6J54i?= =?us-ascii?Q?Isxgdzn0mBv9o4atEAguPkvXRNgH0Tuzs2BpAbDx1tI2PgmwWpZ7IsvpDAUI?= =?us-ascii?Q?X9nBIFz8D6HgGvkDZ26H2DCvPphoSHyOWPra8H0OEvJCjROJY0mLCPKGmE7n?= =?us-ascii?Q?J2MC1tYeg4BjWPTPEormusf9DrLWONMn4qv1jDrMM8/ujk9/r2cLb54qIi1U?= =?us-ascii?Q?ehPPWQJhfRN6dvyA0W3LkJC+MEPm4GG9Qldzt0Bkv3X/ayG3gIjBjyaH0gGG?= =?us-ascii?Q?BNPGayFwU93nmJXRs4fHZlxt+CCGoAipDtY03+4V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/tYjx2DYgQslZxtY3thI9Jar1SdrCqiTEfvSmQ4F18Fj/vWOQvk0=;24:74WreGGaHNkX7JfNpTRdD35vymeefY1aw5AxNV0R+Z0jfhRKNfyZdmF48Qw2Wjb+M3fNIsxz8mFYx4Z7XcBTNmayWF74l0iIQ49OKKMSGCs=;7:ThomsNr4ek4W+ifmiIMEBC9BTRwxG2v0XV9LlMSKm1tBqtyAOwlPMrcwFveOiizGSLIc592G94ls/9pPU/sJkDhOjKKuwRkU2a/NqnMLCIVh1wv1WGggWbWWeCYHcvHwObb8AA6gKoFzNVwkGp3bjQ/ycWBRZVH/O7wzfrYVsHeuBu69UCVgVgOdmCvZWUt9sGSinpJFiJCSIqOA/WxEX2vmKDP/6ghzR8WfLrtEjqsbHymzNHEKPjNo6sFiXJRg SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2017 10:27:26.0065 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14142295-2ad0-438d-86dc-08d53325f518 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2697 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hou Zhiqiang It's better to restore the addressing mode of the SPI flash whenever remove the driver or reboot the system. Signed-off-by: Hou Zhiqiang --- drivers/mtd/spi-nor/spi-nor.c | 8 ++++++++ include/linux/mtd/spi-nor.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index bc266f70a15b..801cbe99b059 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -2713,6 +2713,14 @@ static void spi_nor_resume(struct mtd_info *mtd) dev_err(dev, "resume() failed\n"); } +void spi_nor_restore_addr_mode(struct spi_nor *nor) +{ + if ((nor->addr_width == 4) && + (JEDEC_MFR(nor->info) != SNOR_MFR_SPANSION) && + !(nor->info->flags & SPI_NOR_4B_OPCODES)) + set_4byte(nor, nor->info, 0); +} + int spi_nor_scan(struct spi_nor *nor, const char *name, const struct spi_nor_hwcaps *hwcaps) { diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index d0c66a0975cf..fe9357da2049 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -398,5 +398,6 @@ struct spi_nor_hwcaps { */ int spi_nor_scan(struct spi_nor *nor, const char *name, const struct spi_nor_hwcaps *hwcaps); +void spi_nor_restore_addr_mode(struct spi_nor *nor); #endif -- 2.14.1 From 1586045679778992165@xxx Wed Dec 06 14:37:09 +0000 2017 X-GM-THRID: 1585791835955900730 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread