From patchwork Mon May 25 09:15:41 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 11568341
Return-Path:
Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
[172.30.200.123])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0637D739
for ;
Mon, 25 May 2020 09:17:36 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by mail.kernel.org (Postfix) with ESMTP id E24D220823
for ;
Mon, 25 May 2020 09:17:35 +0000 (UTC)
Authentication-Results: mail.kernel.org;
dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="LAWJb20G"
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S2389515AbgEYJRe (ORCPT
);
Mon, 25 May 2020 05:17:34 -0400
Received: from fllv0015.ext.ti.com ([198.47.19.141]:53206 "EHLO
fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S2389509AbgEYJRd (ORCPT
); Mon, 25 May 2020 05:17:33 -0400
Received: from lelv0266.itg.ti.com ([10.180.67.225])
by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04P9HJx9095700;
Mon, 25 May 2020 04:17:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1590398239;
bh=70FeLQTtJkyVxVIkf8YVfc8xOxYWAvnHPgHRRqee0UU=;
h=From:To:CC:Subject:Date:In-Reply-To:References;
b=LAWJb20GGZ7G3eV6rHuacTeRM2xdOR6k0zCnNvCmiuEmqGSk5Osyd5lHiyRCN2GZY
/eaU27Yt7RBF2LzVu+XnmuG8S/xAu9dR83I0rKadrioBq3bmqabdVmj+Z9nWJVgdCD
7Tf9or/8sOpr79kW7EqvefpVlUXlImeJfl5qIILg=
Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33])
by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04P9HJg2014159
(version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL);
Mon, 25 May 2020 04:17:19 -0500
Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE112.ent.ti.com
(10.64.6.33) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 25
May 2020 04:17:19 -0500
Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE109.ent.ti.com
(10.64.6.30) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via
Frontend Transport; Mon, 25 May 2020 04:17:19 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04P9FjAG034800;
Mon, 25 May 2020 04:17:14 -0500
From: Pratyush Yadav
To: Tudor Ambarus ,
Miquel Raynal ,
Richard Weinberger ,
Vignesh Raghavendra ,
Mark Brown ,
Nicolas Ferre ,
Alexandre Belloni ,
Ludovic Desroches ,
Matthias Brugger ,
Michal Simek ,
, ,
,
,
CC: Pratyush Yadav , Sekhar Nori ,
Boris Brezillon ,
Mason Yang
Subject: [PATCH v9 16/19] mtd: spi-nor: core: disable Octal DTR mode on
suspend.
Date: Mon, 25 May 2020 14:45:41 +0530
Message-ID: <20200525091544.17270-17-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
In-Reply-To: <20200525091544.17270-1-p.yadav@ti.com>
References: <20200525091544.17270-1-p.yadav@ti.com>
MIME-Version: 1.0
X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180
Sender: linux-spi-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: linux-spi@vger.kernel.org
On resume, the init procedure will be run that will re-enable it.
Signed-off-by: Pratyush Yadav
---
drivers/mtd/spi-nor/core.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 68559386f6f8..63ab588299f4 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3239,6 +3239,23 @@ static void spi_nor_soft_reset(struct spi_nor *nor)
usleep_range(SPI_NOR_SRST_SLEEP_MIN, SPI_NOR_SRST_SLEEP_MAX);
}
+/* mtd suspend handler */
+static int spi_nor_suspend(struct mtd_info *mtd)
+{
+ struct spi_nor *nor = mtd_to_spi_nor(mtd);
+ struct device *dev = nor->dev;
+ int ret;
+
+ /* Disable octal DTR mode if we enabled it. */
+ ret = spi_nor_octal_dtr_enable(nor, false);
+ if (ret) {
+ dev_err(dev, "suspend() failed\n");
+ return ret;
+ }
+
+ return 0;
+}
+
/* mtd resume handler */
static void spi_nor_resume(struct mtd_info *mtd)
{
@@ -3432,6 +3449,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
mtd->size = nor->params->size;
mtd->_erase = spi_nor_erase;
mtd->_read = spi_nor_read;
+ mtd->_suspend = spi_nor_suspend;
mtd->_resume = spi_nor_resume;
if (nor->params->locking_ops) {