Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1324335ybh; Thu, 23 Jul 2020 06:15:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPQK4hQeflyDnnA+BOpU78rDQ0kR+rLHDkbnStiYNxn7pDYovdjPl9QivVJXXlw/evuf1D X-Received: by 2002:a50:d908:: with SMTP id t8mr3957763edj.373.1595510108127; Thu, 23 Jul 2020 06:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595510108; cv=none; d=google.com; s=arc-20160816; b=E7G7qQy9wCSfEcpoWn7wyVcq0G1uJSxnr+3N49ZebJUVBhRYfD+ueKLsnClPB1FII5 cN8NWRJpI7tN8kq3FULXzZjZiQSc2yitm/7ohV2reivy6D4N1VrhjcdgJgi/ipKmFuBm 2ZeBDWtck+QouYBrCO0B17aEFl8fO0LiO33pwO+dyQJ0Q0zaxFqeDDSySYQViQFbbtsu 4y5wyQvty0jrdpq79hR5PFP37L9f1G7lxK8q+aMzu6DIbVxwRr19ix+j9vkdb6QdoLrT UCopBbXMoKnrJ0lNFMQ3/wKlhFKnMBuTuwI4sGpCjLQ/dbLWYb6bhRvstPK2DUaksoKi LHTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cjHlYyO9Ce+hP+ga9In/M/FVxNgw1uaASE8ivWBwuO0=; b=Sr1FS4aMeOl/dR27aSoQ9CKM7nVDvFNMyVmbhiwkNIDZmdzXqqTmAnW/SfXcKFVm7E sAzf7WPvkqY4tkAZa92cnh/sSm24PcogQyAlQ5qk0gnVi3xoZoKDEM6Kaoje6yTu3wiC velUJYgCWHAWf1ROe/8UqbYp9Hfp/ayccf6ztcpEDdsPW5CPerQAmWwiDCwF/VETBwwa E4shkKgG1oEutZd9GyxuNkmgL/CnVr9oEWi3Mcgb/4w/tg506svpnmL2Ak3oArLci0AQ wg5mbw6toqzP6TNUy7Wk2zF0bV8Q76WnKhUZtR2KIzCI5c89+EuiwPJ3dYL1XTe0rGeY JkoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si2006514edx.94.2020.07.23.06.14.45; Thu, 23 Jul 2020 06:15:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729230AbgGWNNM (ORCPT + 99 others); Thu, 23 Jul 2020 09:13:12 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:56535 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgGWNNL (ORCPT ); Thu, 23 Jul 2020 09:13:11 -0400 X-Originating-IP: 42.109.196.68 Received: from localhost.localdomain (unknown [42.109.196.68]) (Authenticated sender: me@yadavpratyush.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id E00E31C0007; Thu, 23 Jul 2020 13:13:06 +0000 (UTC) From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sekhar Nori , Boris Brezillon , Pratyush Yadav , Pratyush Yadav Subject: [PATCH v11 11/14] mtd: spi-nor: core: disable Octal DTR mode on suspend. Date: Thu, 23 Jul 2020 18:42:00 +0530 Message-Id: <20200723131203.40916-12-me@yadavpratyush.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200723131203.40916-1-me@yadavpratyush.com> References: <20200723131203.40916-1-me@yadavpratyush.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pratyush Yadav 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 f55c062a7bd5..a263196d970f 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3193,6 +3193,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) { @@ -3387,6 +3404,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) { -- 2.27.0