All of lore.kernel.org
 help / color / mirror / Atom feed
From: "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com>
To: Keerthy <j-keerthy@ti.com>,
	linus.walleij@linaro.org, grygorii.strashko@ti.com,
	tony@atomide.com
Cc: t-kristo@ti.com, Russ.Dill@ti.com, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, ssantosh@kernel.org,
	haojian.zhuang@linaro.org, linux-arm-kernel@lists.infradead.org,
	d-gerlach@ti.com
Subject: Re: [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code
Date: Thu, 12 Apr 2018 10:44:10 -0600	[thread overview]
Message-ID: <31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com> (raw)
In-Reply-To: <1523505239-16229-2-git-send-email-j-keerthy@ti.com>

On 4/11/18 9:53 PM, Keerthy wrote:
> From: Dave Gerlach <d-gerlach@ti.com>
> 
> After an RTC+DDR cycle we lose sram context so emif pm functions present
> in sram are lost. We can check if the first byte of the original
> code in DDR contains the same first byte as the code in sram, and if
> they do not match we know we have lost context and must recopy the
> functions to the previous address to maintain PM functionality.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>   drivers/memory/ti-emif-pm.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
> index 632651f..ec4a62c 100644
> --- a/drivers/memory/ti-emif-pm.c
> +++ b/drivers/memory/ti-emif-pm.c
> @@ -249,6 +249,25 @@ int ti_emif_get_mem_type(void)
>   };
>   MODULE_DEVICE_TABLE(of, ti_emif_of_match);
>   
> +#ifdef CONFIG_PM_SLEEP
> +static int ti_emif_resume(struct device *dev)
> +{
> +	unsigned long tmp =
> +			__raw_readl((void *)emif_instance->ti_emif_sram_virt);
> +
> +	/*
> +	 * Check to see if what we are copying is already present in the
> +	 * first byte at the destination, only copy if it is not which
> +	 * indicates we have lost context and sram no longer contains
> +	 * the PM code
> +	 */

> +	if (tmp != ti_emif_sram)
> +		ti_emif_push_sram(dev, emif_instance);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_PM_SLEEP */
Instead of this indirect method , why can't just check the previous
deep sleep mode and based on that do copy or not. EMIF power status
register should have something like that ?

Another minor point is even though there is nothing to do in suspend,
might be good to have a callback with comment that nothing to do with
some explanation why not. Don't have strong preference but may for
better readability.

Regards,
Santosh

WARNING: multiple messages have this Message-ID (diff)
From: "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com>
To: Keerthy <j-keerthy@ti.com>,
	linus.walleij@linaro.org, grygorii.strashko@ti.com,
	tony@atomide.com
Cc: d-gerlach@ti.com, linux-kernel@vger.kernel.org, t-kristo@ti.com,
	Russ.Dill@ti.com, haojian.zhuang@linaro.org, ssantosh@kernel.org,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code
Date: Thu, 12 Apr 2018 10:44:10 -0600	[thread overview]
Message-ID: <31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com> (raw)
In-Reply-To: <1523505239-16229-2-git-send-email-j-keerthy@ti.com>

On 4/11/18 9:53 PM, Keerthy wrote:
> From: Dave Gerlach <d-gerlach@ti.com>
> 
> After an RTC+DDR cycle we lose sram context so emif pm functions present
> in sram are lost. We can check if the first byte of the original
> code in DDR contains the same first byte as the code in sram, and if
> they do not match we know we have lost context and must recopy the
> functions to the previous address to maintain PM functionality.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>   drivers/memory/ti-emif-pm.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
> index 632651f..ec4a62c 100644
> --- a/drivers/memory/ti-emif-pm.c
> +++ b/drivers/memory/ti-emif-pm.c
> @@ -249,6 +249,25 @@ int ti_emif_get_mem_type(void)
>   };
>   MODULE_DEVICE_TABLE(of, ti_emif_of_match);
>   
> +#ifdef CONFIG_PM_SLEEP
> +static int ti_emif_resume(struct device *dev)
> +{
> +	unsigned long tmp =
> +			__raw_readl((void *)emif_instance->ti_emif_sram_virt);
> +
> +	/*
> +	 * Check to see if what we are copying is already present in the
> +	 * first byte at the destination, only copy if it is not which
> +	 * indicates we have lost context and sram no longer contains
> +	 * the PM code
> +	 */

> +	if (tmp != ti_emif_sram)
> +		ti_emif_push_sram(dev, emif_instance);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_PM_SLEEP */
Instead of this indirect method , why can't just check the previous
deep sleep mode and based on that do copy or not. EMIF power status
register should have something like that ?

Another minor point is even though there is nothing to do in suspend,
might be good to have a callback with comment that nothing to do with
some explanation why not. Don't have strong preference but may for
better readability.

Regards,
Santosh

WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@oracle.com (santosh.shilimkar at oracle.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code
Date: Thu, 12 Apr 2018 10:44:10 -0600	[thread overview]
Message-ID: <31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com> (raw)
In-Reply-To: <1523505239-16229-2-git-send-email-j-keerthy@ti.com>

On 4/11/18 9:53 PM, Keerthy wrote:
> From: Dave Gerlach <d-gerlach@ti.com>
> 
> After an RTC+DDR cycle we lose sram context so emif pm functions present
> in sram are lost. We can check if the first byte of the original
> code in DDR contains the same first byte as the code in sram, and if
> they do not match we know we have lost context and must recopy the
> functions to the previous address to maintain PM functionality.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> ---
>   drivers/memory/ti-emif-pm.c | 24 ++++++++++++++++++++++++
>   1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/memory/ti-emif-pm.c b/drivers/memory/ti-emif-pm.c
> index 632651f..ec4a62c 100644
> --- a/drivers/memory/ti-emif-pm.c
> +++ b/drivers/memory/ti-emif-pm.c
> @@ -249,6 +249,25 @@ int ti_emif_get_mem_type(void)
>   };
>   MODULE_DEVICE_TABLE(of, ti_emif_of_match);
>   
> +#ifdef CONFIG_PM_SLEEP
> +static int ti_emif_resume(struct device *dev)
> +{
> +	unsigned long tmp =
> +			__raw_readl((void *)emif_instance->ti_emif_sram_virt);
> +
> +	/*
> +	 * Check to see if what we are copying is already present in the
> +	 * first byte at the destination, only copy if it is not which
> +	 * indicates we have lost context and sram no longer contains
> +	 * the PM code
> +	 */

> +	if (tmp != ti_emif_sram)
> +		ti_emif_push_sram(dev, emif_instance);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_PM_SLEEP */
Instead of this indirect method , why can't just check the previous
deep sleep mode and based on that do copy or not. EMIF power status
register should have something like that ?

Another minor point is even though there is nothing to do in suspend,
might be good to have a callback with comment that nothing to do with
some explanation why not. Don't have strong preference but may for
better readability.

Regards,
Santosh

  reply	other threads:[~2018-04-12 16:44 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  3:53 [PATCH 00/14] arm: OMAP: AM437X: Save restores patches for rtc mode with DDR In self-refresh Keerthy
2018-04-12  3:53 ` Keerthy
2018-04-12  3:53 ` Keerthy
2018-04-12  3:53 ` [PATCH 01/14] memory: ti-emif-sram: Add resume function to recopy sram code Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 16:44   ` santosh.shilimkar [this message]
2018-04-12 16:44     ` santosh.shilimkar at oracle.com
2018-04-12 16:44     ` santosh.shilimkar
2018-04-16 10:20     ` Keerthy
2018-04-16 10:20       ` Keerthy
2018-04-16 10:20       ` Keerthy
2018-04-16 10:29     ` Keerthy
2018-04-16 10:29       ` Keerthy
2018-04-16 10:29       ` Keerthy
2018-05-23  8:47       ` Keerthy
2018-05-23  8:47         ` Keerthy
2018-05-23  8:47         ` Keerthy
2018-05-23 16:42         ` Santosh Shilimkar
2018-05-23 16:42           ` Santosh Shilimkar
2018-04-12  3:53 ` [PATCH 02/14] ARM: OMAP2: Add functions to save and restore clockdomain context en-masse Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53 ` [PATCH 03/14] ARM: OMAP2+: omap_hwmod: Introduce HWMOD_NEEDS_REIDLE Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 14:34   ` Tony Lindgren
2018-04-12 14:34     ` Tony Lindgren
2018-04-12  3:53 ` [PATCH 04/14] ARM: OMAP2: Add functions to save and restore omap hwmod context en-masse Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53 ` [PATCH 05/14] ARM: OMAP2: Add functions to save and restore powerdomain context Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 14:37   ` Tony Lindgren
2018-04-12 14:37     ` Tony Lindgren
2018-04-12  3:53 ` [PATCH 06/14] ARM: AM33XX: Add functions to save/restore am33xx control registers Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53 ` [PATCH 07/14] ARM: AM43XX: Add functions to save/restore am43xx " Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53 ` [PATCH 08/14] ARM: OMAP2: Add functions to save and restore pinctrl context Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 14:16   ` Tony Lindgren
2018-04-12 14:16     ` Tony Lindgren
2018-04-13  6:16     ` Keerthy
2018-04-13  6:16       ` Keerthy
2018-04-13  6:16       ` Keerthy
2018-04-12  3:53 ` [PATCH 09/14] ARM: OMAP2: Drop the concept of certain power domains not being able to lose context Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53 ` [PATCH 10/14] gpio: omap: Drop the concept of gpio banks " Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 14:22   ` Tony Lindgren
2018-04-12 14:22     ` Tony Lindgren
2018-04-12 20:10     ` Grygorii Strashko
2018-04-12 20:10       ` Grygorii Strashko
2018-04-12 20:10       ` Grygorii Strashko
2018-04-12  3:53 ` [PATCH 11/14] gpio: omap: Restore power_mode configuration at resume time Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 14:39   ` Tony Lindgren
2018-04-12 14:39     ` Tony Lindgren
2018-04-12 20:02     ` Grygorii Strashko
2018-04-12 20:02       ` Grygorii Strashko
2018-04-12 20:02       ` Grygorii Strashko
2018-04-12  3:53 ` [PATCH 12/14] OMAP: CLK: CLKSRC: Add suspend resume hooks Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12 14:27   ` Tony Lindgren
2018-04-12 14:27     ` Tony Lindgren
2018-05-22  7:57     ` Keerthy
2018-05-22  7:57       ` Keerthy
2018-05-22  7:57       ` Keerthy
2018-05-22 13:39       ` Tony Lindgren
2018-05-22 13:39         ` Tony Lindgren
2018-04-12  3:53 ` [PATCH 13/14] ARM: hwmod: RTC: Don't assume lock/unlock will be called with irq enabled Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53 ` [PATCH 14/14] ARM: OMAP2+: prm44xx: Introduce context save/restore for am43 PRCM IO Keerthy
2018-04-12  3:53   ` Keerthy
2018-04-12  3:53   ` Keerthy

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=31688cf4-b6ca-e7ce-3407-46262006b38f@oracle.com \
    --to=santosh.shilimkar@oracle.com \
    --cc=Russ.Dill@ti.com \
    --cc=d-gerlach@ti.com \
    --cc=grygorii.strashko@ti.com \
    --cc=haojian.zhuang@linaro.org \
    --cc=j-keerthy@ti.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ssantosh@kernel.org \
    --cc=t-kristo@ti.com \
    --cc=tony@atomide.com \
    /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.