Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp890142pxt; Fri, 6 Aug 2021 17:07:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhwLIcw7eeEbwsyJ05GGbK5i64XZ3EUTU5X8ohho3g6gdtuu4Y4DGXqRaF4+XIUjwyvT3j X-Received: by 2002:a05:6e02:1093:: with SMTP id r19mr30155ilj.246.1628294837027; Fri, 06 Aug 2021 17:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628294837; cv=none; d=google.com; s=arc-20160816; b=txBAO43Fxd5wHeOVHEw+kWH+8hAVzfSuLQwjq2byAfuicYYWBAIRjEphXggrnFFiQ5 hlGQvWQjhpy4Q1YhrYWLrDnJUXypxVJ0Nisrw+j2arHLuqE56F0qLbdmYUZEOwi2yR3W DhTQEFW6zeX47cFbMxoJOkzQ1O3XQW8DKJ8+MNFj4XoZbGziIpsnJb1gCNC+uamt4AFP kFTrjYeufJfE8fphFqq6ZfeU08fe+klB+ADVUSvWOkOt2NhIbcqxsyNzLoMsiFDv2LnV jjSQ6Nr52x5CzcujWwx3Kb/EbDL2tc1wwCypMtmJf2v36V3/dRJ9af+5MZKXzHUcMdpQ jLQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=uqGUbsWt5zr/hy7K+aPEMZLG/16VFMNSykQCHJWCDao=; b=Mmh7ahA9ulZ3T3nueo4gouPnAj+/LIOnuGwb4d8R3y1EcUJB/CISzmxYBO+MPSQmoa 2TJC45hayxHD6cQsZ8s4Sv7YWN5AorNt3UT4d0JiXHqeASShphINoXxX+gSI5g5KDU37 nw7VhKjnpKobH7u11DiBkYZo89dVs6tB6YVD8oZ3j1goFscNoBCw8ko/s9frBAJjXtFy vHALtUCQGYwKnII3twvLBberOJid0oqyvmuhSuPJQyXIKcj2xmKungRqvMOV7Ea1vlJd WdaB/c9LDlqBlhKUyVEA7EuQetgcxfhgJjmSgscLHJDaZ6aceG41vWNVnCUAu72nbPs9 ZOmw== 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 w4si9983759ioa.95.2021.08.06.17.07.05; Fri, 06 Aug 2021 17:07:17 -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 S243319AbhHFTMw convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Aug 2021 15:12:52 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:54441 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231887AbhHFTMw (ORCPT ); Fri, 6 Aug 2021 15:12:52 -0400 Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id BA6AF1C0005; Fri, 6 Aug 2021 19:12:32 +0000 (UTC) Date: Fri, 6 Aug 2021 21:12:31 +0200 From: Miquel Raynal To: Apurva Nandan Cc: Richard Weinberger , Vignesh Raghavendra , Mark Brown , Patrice Chotard , Boris Brezillon , , , , Pratyush Yadav Subject: Re: [PATCH 12/13] mtd: spinand: Perform Power-on-Reset when runtime_pm suspend is issued Message-ID: <20210806211231.5c569939@xps13> In-Reply-To: <20210713130538.646-13-a-nandan@ti.com> References: <20210713130538.646-1-a-nandan@ti.com> <20210713130538.646-13-a-nandan@ti.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Apurva, Apurva Nandan wrote on Tue, 13 Jul 2021 13:05:37 +0000: > A soft reset using FFh command doesn't erase the flash's configuration > and doesn't reset the SPI IO mode also. This can result in the flash > being in a different SPI IO mode, e.g. Octal DTR, when resuming from > sleep. This would render the flash in an unusable state. could put the falsh in? > Perform a Power-on-Reset (PoR), if available in the flash, when > suspending the device by runtime_pm. This would set the flash to clean I think runtime_pm is something else. > state for reinitialization during resume and would also ensure that it > is in standard SPI IO mode (1S-1S-1S) before the resume begins. Please add a comment about this to explain why we don't do this reset at resume time. > > Signed-off-by: Apurva Nandan > --- > drivers/mtd/nand/spi/core.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c > index 608f4eb85b0a..6fb3aa6af540 100644 > --- a/drivers/mtd/nand/spi/core.c > +++ b/drivers/mtd/nand/spi/core.c > @@ -1329,6 +1329,21 @@ static void spinand_mtd_resume(struct mtd_info *mtd) > spinand_ecc_enable(spinand, false); > } > > +static int spinand_mtd_suspend(struct mtd_info *mtd) > +{ > + struct spinand_device *spinand = mtd_to_spinand(mtd); > + int ret; > + > + if (!(spinand->flags & SPINAND_HAS_POR_CMD_BIT)) > + return 0; > + > + ret = spinand_power_on_rst_op(spinand); > + if (ret) > + dev_err(&spinand->spimem->spi->dev, "suspend() failed\n"); > + > + return ret; > +} > + > static int spinand_init(struct spinand_device *spinand) > { > struct device *dev = &spinand->spimem->spi->dev; > @@ -1401,6 +1416,7 @@ static int spinand_init(struct spinand_device *spinand) > mtd->_erase = spinand_mtd_erase; > mtd->_max_bad_blocks = nanddev_mtd_max_bad_blocks; > mtd->_resume = spinand_mtd_resume; > + mtd->_suspend = spinand_mtd_suspend; > > if (nand->ecc.engine) { > ret = mtd_ooblayout_count_freebytes(mtd); Thanks, Miquèl