All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Kamal Dasu <kamal.dasu-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Cyrille Pitchen
	<cyrille.pitchen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Cc: Kamal Dasu <kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Florian Fainelli
	<f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Brian Norris
	<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH v2, 1/1] mtd: devices: m25p80: Add PM suspend resume support
Date: Mon, 28 Nov 2016 17:35:02 -0800	[thread overview]
Message-ID: <ad1d08cf-4846-9b77-f8c0-149edb17b7e5@gmail.com> (raw)
In-Reply-To: <CAKekbeubczM5NpQy-Umqx-SmDM+deMcgYciyST2Sgrh2_dOsAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 10/24/2016 11:18 AM, Kamal Dasu wrote:
> 
> Cyrille,
> 
> On Mon, Oct 17, 2016 at 1:08 PM, Cyrille Pitchen
> <cyrille.pitchen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org <mailto:cyrille.pitchen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>> wrote:
> 
>     Hi Kamal,
> 
>     Le 12/09/2016 à 22:01, Kamal Dasu a écrit :
>     > Adding PM support so as to be able to probe spi-nor flash
>     > on resume. There are vendor specific commands to setup
>     > the transfer mode and enable read/write as part of
>     > spi_nor_scan(), done on initial probe and needed on resume().
>     > The spi-nor structure is private to the m25p driver and hence
>     > is the only place this can be done without having to duplicate
>     > code in controller driver.
> 
>     Just to be sure I've understood the purpose of this patch: here we
>     suppose
>     that the SPI NOR memory power supply was cut when the CPU entered
>     its suspend
>     mode. So when the CPU is resumed, the SPI NOR memory power supply is
>     enabled
>     again as well and the internal state of the memory is reset.
> 
> 
> Memory could be intact and in refresh state. But generally the spi nor
> part might be powered down. 
> 
> 
>     Depending on the manufacturer, we may need to send dedicated
>     commands so the
>     memory is ready again (for instance, a Global Unlock Block command
>     for SST
>     memories so we can perform Sector Erase and Page Program operations).
>     Those commands are sent from spi_nor_scan(). Hence you call
>     spi_nor_scan()
>     once again from the resume callback.
> 
> 
> Yes there are are chain of calls that setup the state of the part from
> spi_nor_scan that are vendor specific based on the jdec id. So yes some
> of the unlock commands need to be sent before we can start using the
> part again.
>  
> 
>     If so, your patch does make sense but I wonder whether some
>     operations done
>     inside spi_nor_scan() and not related to the memory itself but more
>     to other
>     layers like mtd (struct mtd_info) could always be safely performed a
>     second
>     time. I don't know if that issue already exists or would ever exist,
>     if so
>     it might be interesting to find a mean to tell spi_nor_scan()
>     whether it's
>     called for the first time on this memory (boot) or not (resume).
> 
> 
> I do see the mtd settings that could be done a second time but should
> not cause any issues IMHO.  I don't see a need to distinguish between a
> (re)boot or a resume  and complicate the code. Unless somebody can point

Cyrille, are you okay with Kamal's response? I just saw the 4.10 pull
request pass by and since this patch was still in flight, it did not get
included, can it be queued for 4.11 or is there something else to work on?
-- 
Florian
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Kamal Dasu <kamal.dasu@broadcom.com>,
	Cyrille Pitchen <cyrille.pitchen@atmel.com>
Cc: Kamal Dasu <kdasu.kdev@gmail.com>,
	linux-spi@vger.kernel.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH v2, 1/1] mtd: devices: m25p80: Add PM suspend resume support
Date: Mon, 28 Nov 2016 17:35:02 -0800	[thread overview]
Message-ID: <ad1d08cf-4846-9b77-f8c0-149edb17b7e5@gmail.com> (raw)
In-Reply-To: <CAKekbeubczM5NpQy-Umqx-SmDM+deMcgYciyST2Sgrh2_dOsAw@mail.gmail.com>

On 10/24/2016 11:18 AM, Kamal Dasu wrote:
> 
> Cyrille,
> 
> On Mon, Oct 17, 2016 at 1:08 PM, Cyrille Pitchen
> <cyrille.pitchen@atmel.com <mailto:cyrille.pitchen@atmel.com>> wrote:
> 
>     Hi Kamal,
> 
>     Le 12/09/2016 à 22:01, Kamal Dasu a écrit :
>     > Adding PM support so as to be able to probe spi-nor flash
>     > on resume. There are vendor specific commands to setup
>     > the transfer mode and enable read/write as part of
>     > spi_nor_scan(), done on initial probe and needed on resume().
>     > The spi-nor structure is private to the m25p driver and hence
>     > is the only place this can be done without having to duplicate
>     > code in controller driver.
> 
>     Just to be sure I've understood the purpose of this patch: here we
>     suppose
>     that the SPI NOR memory power supply was cut when the CPU entered
>     its suspend
>     mode. So when the CPU is resumed, the SPI NOR memory power supply is
>     enabled
>     again as well and the internal state of the memory is reset.
> 
> 
> Memory could be intact and in refresh state. But generally the spi nor
> part might be powered down. 
> 
> 
>     Depending on the manufacturer, we may need to send dedicated
>     commands so the
>     memory is ready again (for instance, a Global Unlock Block command
>     for SST
>     memories so we can perform Sector Erase and Page Program operations).
>     Those commands are sent from spi_nor_scan(). Hence you call
>     spi_nor_scan()
>     once again from the resume callback.
> 
> 
> Yes there are are chain of calls that setup the state of the part from
> spi_nor_scan that are vendor specific based on the jdec id. So yes some
> of the unlock commands need to be sent before we can start using the
> part again.
>  
> 
>     If so, your patch does make sense but I wonder whether some
>     operations done
>     inside spi_nor_scan() and not related to the memory itself but more
>     to other
>     layers like mtd (struct mtd_info) could always be safely performed a
>     second
>     time. I don't know if that issue already exists or would ever exist,
>     if so
>     it might be interesting to find a mean to tell spi_nor_scan()
>     whether it's
>     called for the first time on this memory (boot) or not (resume).
> 
> 
> I do see the mtd settings that could be done a second time but should
> not cause any issues IMHO.  I don't see a need to distinguish between a
> (re)boot or a resume  and complicate the code. Unless somebody can point

Cyrille, are you okay with Kamal's response? I just saw the 4.10 pull
request pass by and since this patch was still in flight, it did not get
included, can it be queued for 4.11 or is there something else to work on?
-- 
Florian

  parent reply	other threads:[~2016-11-29  1:35 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-12 20:01 [PATCH v2, 1/1] mtd: devices: m25p80: Add PM suspend resume support Kamal Dasu
2016-09-12 20:01 ` Kamal Dasu
     [not found] ` <1473710494-4084-1-git-send-email-kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-10-14 17:42   ` Kamal Dasu
2016-10-14 17:42     ` Kamal Dasu
2016-10-17 17:08   ` Cyrille Pitchen
2016-10-17 17:08     ` Cyrille Pitchen
     [not found]     ` <CAKekbeubczM5NpQy-Umqx-SmDM+deMcgYciyST2Sgrh2_dOsAw@mail.gmail.com>
     [not found]       ` <CAKekbeubczM5NpQy-Umqx-SmDM+deMcgYciyST2Sgrh2_dOsAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-29  1:35         ` Florian Fainelli [this message]
2016-11-29  1:35           ` Florian Fainelli
2016-11-29 13:11         ` Cyrille Pitchen
2016-11-29 13:11           ` Cyrille Pitchen
     [not found]           ` <c9198202-29d1-5e67-f675-5a53d926ede9-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2016-12-01 15:43             ` Marek Vasut
2016-12-01 15:43               ` Marek Vasut
2017-01-20 16:33               ` Kamal Dasu
2017-01-20 16:33                 ` Kamal Dasu
2017-01-20 17:22                 ` Marek Vasut
2017-01-20 17:22                   ` Marek Vasut
2017-01-20 18:50                   ` Kamal Dasu
2017-01-20 18:50                     ` Kamal Dasu
     [not found]                     ` <CAC=U0a3Q_dBefFayi4G2TueZNXYAhdakduSwYdKPxDDL5Uoi_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-20 19:36                       ` Michal Suchanek
2017-01-20 19:36                         ` Michal Suchanek
2017-01-20 20:02                       ` Marek Vasut
2017-01-20 20:02                         ` Marek Vasut
     [not found]                         ` <0b33765b-52b7-65f4-34d3-0a446a2df59e-ynQEQJNshbs@public.gmane.org>
2017-01-20 20:07                           ` Florian Fainelli
2017-01-20 20:07                             ` Florian Fainelli
     [not found]                             ` <fc4c2fc2-6779-6e42-8002-0d636156fe66-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-20 20:13                               ` Marek Vasut
2017-01-20 20:13                                 ` Marek Vasut
2017-01-20 20:23                                 ` Florian Fainelli
2017-01-20 20:23                                   ` Florian Fainelli
2017-01-20 20:42                                   ` Marek Vasut
2017-01-20 20:42                                     ` Marek Vasut
     [not found]                                     ` <36831150-8147-2d6f-f5e6-57c675f4c875-ynQEQJNshbs@public.gmane.org>
2017-01-20 21:15                                       ` Kamal Dasu
2017-01-20 21:15                                         ` Kamal Dasu
     [not found]                                         ` <CAC=U0a35M4_DqsJqyp0f-k7XzayvK7z5sQ+JTJ4qJAu=4P3dZw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-20 22:30                                           ` Marek Vasut
2017-01-20 22:30                                             ` Marek Vasut
2017-01-20 22:58                                       ` Florian Fainelli
2017-01-20 22:58                                         ` Florian Fainelli
     [not found]                                         ` <3bc8d8d3-936c-51c7-30c4-deac0b3bc7d8-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2017-01-21  0:13                                           ` Marek Vasut
2017-01-21  0:13                                             ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad1d08cf-4846-9b77-f8c0-149edb17b7e5@gmail.com \
    --to=f.fainelli-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=cyrille.pitchen-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
    --cc=kamal.dasu-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=kdasu.kdev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.