Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1717827 > unrolled thread

[PATCH v8 0/2] Add spi-nor flash device pm support

Started byKamal Dasu <kdasu.kdev@gmail.com>
First post2017-08-22 22:50 +0200
Last post2017-08-23 09:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v8 0/2]  Add spi-nor flash device pm support Kamal Dasu <kdasu.kdev@gmail.com> - 2017-08-22 22:50 +0200
    [PATCH v8 2/2] mtd: spi-nor: Add spi-nor mtd resume handler Kamal Dasu <kdasu.kdev@gmail.com> - 2017-08-22 22:50 +0200
      Re: [PATCH v8 2/2] mtd: spi-nor: Add spi-nor mtd resume handler Cyrille Pitchen <cyrille.pitchen@wedev4u.fr> - 2017-08-23 09:10 +0200

#1717827 — [PATCH v8 0/2] Add spi-nor flash device pm support

FromKamal Dasu <kdasu.kdev@gmail.com>
Date2017-08-22 22:50 +0200
Subject[PATCH v8 0/2] Add spi-nor flash device pm support
Message-ID<uhohz-7x1-15@gated-at.bofh.it>
Changes since v7 

spi-nor.h
- Fix comment style

spi-nor.c
- Fix condition check to set_4byte() when nor->addr_width == 4 in spi_nor_init()
- Bring back quad_enable logic to spi_nor_setup() and remove it from spi_nor_scan()
- Remove duplicate comment section in spi_nor_scan()
- Leave dev_info() string as before in spi_nor_scan()

The V8 changes below implements power management support using the mtd
handlers for resume in the spi-nor driver. spi-nor mtd pm resume() calls
newly implemented spi_nor_init() function that sets up the spi-nor flash
to its pre-suspend/power-on probed state. This is needed S2/S3 PM 
on platfroms that turn off power to the spi-nor flash on pm suspend.

Kamal Dasu (2):
  mtd: spi-nor: add spi_nor_init() function
  mtd: spi-nor: Add spi-nor mtd resume handler

 drivers/mtd/spi-nor/spi-nor.c | 68 +++++++++++++++++++++++++++++++------------
 include/linux/mtd/spi-nor.h   | 10 +++++++
 2 files changed, 60 insertions(+), 18 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1717829 — [PATCH v8 2/2] mtd: spi-nor: Add spi-nor mtd resume handler

FromKamal Dasu <kdasu.kdev@gmail.com>
Date2017-08-22 22:50 +0200
Subject[PATCH v8 2/2] mtd: spi-nor: Add spi-nor mtd resume handler
Message-ID<uhohA-7x1-29@gated-at.bofh.it>
In reply to#1717827
Implemented and populated spi-nor mtd PM handlers for resume ops.
spi-nor resume op re-initializes spi-nor flash to its probed
state by calling the newly implemented spi_nor_init() function.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index ab98ecff..69164bc 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1871,6 +1871,19 @@ static int spi_nor_init(struct spi_nor *nor)
 	return 0;
 }
 
+/* mtd resume handler */
+static void spi_nor_resume(struct mtd_info *mtd)
+{
+	struct spi_nor *nor = mtd_to_spi_nor(mtd);
+	struct device *dev = nor->dev;
+	int ret;
+
+	/* re-initialize the nor chip */
+	ret = spi_nor_init(nor);
+	if (ret)
+		dev_err(dev, "resume() failed\n");
+}
+
 int spi_nor_scan(struct spi_nor *nor, const char *name,
 		 const struct spi_nor_hwcaps *hwcaps)
 {
@@ -1947,6 +1960,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
 	mtd->size = params.size;
 	mtd->_erase = spi_nor_erase;
 	mtd->_read = spi_nor_read;
+	mtd->_resume = spi_nor_resume;
 
 	/* NOR protection support for STmicro/Micron chips and similar */
 	if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1718091 — Re: [PATCH v8 2/2] mtd: spi-nor: Add spi-nor mtd resume handler

FromCyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Date2017-08-23 09:10 +0200
SubjectRe: [PATCH v8 2/2] mtd: spi-nor: Add spi-nor mtd resume handler
Message-ID<uhxXz-5Su-3@gated-at.bofh.it>
In reply to#1717829
Hi Kamal,

Le 22/08/2017 à 22:45, Kamal Dasu a écrit :
> Implemented and populated spi-nor mtd PM handlers for resume ops.
> spi-nor resume op re-initializes spi-nor flash to its probed
> state by calling the newly implemented spi_nor_init() function.
> 
> Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
> ---
>  drivers/mtd/spi-nor/spi-nor.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> index ab98ecff..69164bc 100644
> --- a/drivers/mtd/spi-nor/spi-nor.c
> +++ b/drivers/mtd/spi-nor/spi-nor.c
> @@ -1871,6 +1871,19 @@ static int spi_nor_init(struct spi_nor *nor)
>  	return 0;
>  }
>  
> +/* mtd resume handler */
> +static void spi_nor_resume(struct mtd_info *mtd)
> +{
> +	struct spi_nor *nor = mtd_to_spi_nor(mtd);
> +	struct device *dev = nor->dev;
> +	int ret;
> +
> +	/* re-initialize the nor chip */
> +	ret = spi_nor_init(nor);
> +	if (ret)
> +		dev_err(dev, "resume() failed\n");
> +}
> +
>  int spi_nor_scan(struct spi_nor *nor, const char *name,
>  		 const struct spi_nor_hwcaps *hwcaps)
>  {
> @@ -1947,6 +1960,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
>  	mtd->size = params.size;
>  	mtd->_erase = spi_nor_erase;
>  	mtd->_read = spi_nor_read;
> +	mtd->_resume = spi_nor_resume;
>

The series now looks good to me. Just waiting for Marek's
acked-by/reviewed-by to double-check.

Marek: I can't test with the Cadence QSPI controller but based on the
line "mtd->dev.parent = nor->dev;" in spi_nor_scan(), I think this patch
won't conflit with the already PM code in the cadence-quadspi.c driver.

As far as I understand, cqspi_resume() will be called before
mtd_resume() / spi_nor_resume().

Best regards,

Cyrille

>  	/* NOR protection support for STmicro/Micron chips and similar */
>  	if (JEDEC_MFR(info) == SNOR_MFR_MICRON ||
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web