Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754905AbdLLNTi (ORCPT ); Tue, 12 Dec 2017 08:19:38 -0500 Received: from smtp3-g21.free.fr ([212.27.42.3]:8834 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754817AbdLLNTf (ORCPT ); Tue, 12 Dec 2017 08:19:35 -0500 Subject: Re: [PATCHv3 2/2] mtd: m25p80: restore the status of SPI flash when exiting To: Zhiqiang Hou , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, boris.brezillon@free-electrons.com, marek.vasut@gmail.com, richard@nod.at References: <20171206025342.7266-1-Zhiqiang.Hou@nxp.com> <20171206025342.7266-3-Zhiqiang.Hou@nxp.com> From: Cyrille Pitchen Message-ID: Date: Tue, 12 Dec 2017 14:19:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171206025342.7266-3-Zhiqiang.Hou@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1882 Lines: 61 Le 06/12/2017 à 03:53, Zhiqiang Hou a écrit : > From: Hou Zhiqiang > > Restore the status to be compatible with legacy devices. > Take Freescale eSPI boot for example, it copies (in 3 Byte > addressing mode) the RCW and bootloader images from SPI flash > without firing a reset signal previously, so the reboot command > will fail without reseting the addressing mode of SPI flash. resetting > This patch implement .shutdown function to restore the status implements > in reboot process, and add the same operation to the .remove > function. > > Signed-off-by: Hou Zhiqiang Applied to the spi-nor/next branch of l2-mtd Thanks! (corrected few mistakes in the commit message) > --- > V3: > - Modified the commit to make this patch specific. > > drivers/mtd/devices/m25p80.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index dbe6a1de2bb8..a4e18f6aaa33 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -307,10 +307,18 @@ static int m25p_remove(struct spi_device *spi) > { > struct m25p *flash = spi_get_drvdata(spi); > > + spi_nor_restore(&flash->spi_nor); > + > /* Clean up MTD stuff. */ > return mtd_device_unregister(&flash->spi_nor.mtd); > } > > +static void m25p_shutdown(struct spi_device *spi) > +{ > + struct m25p *flash = spi_get_drvdata(spi); > + > + spi_nor_restore(&flash->spi_nor); > +} > /* > * Do NOT add to this array without reading the following: > * > @@ -386,6 +394,7 @@ static struct spi_driver m25p80_driver = { > .id_table = m25p_ids, > .probe = m25p_probe, > .remove = m25p_remove, > + .shutdown = m25p_shutdown, > > /* REVISIT: many of these chips have deep power-down modes, which > * should clearly be entered on suspend() to minimize power use. >