All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Santosh Shilimkar
	<ssantosh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Keerthy J <j-keerthy-l0cyMroinI0@public.gmane.org>,
	Dave Gerlach <d-gerlach-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH 2/2] memory: ti-emif-sram: introduce relocatable suspend/resume handlers
Date: Tue, 4 Apr 2017 09:11:52 -0700	[thread overview]
Message-ID: <20170404161151.GS10760@atomide.com> (raw)
In-Reply-To: <20170328205511.21166-3-d-gerlach-l0cyMroinI0@public.gmane.org>

Russell,

* Dave Gerlach <d-gerlach-l0cyMroinI0@public.gmane.org> [170328 13:57]:
> Certain SoCs like Texas Instruments AM335x and AM437x require parts
> of the EMIF PM code to run late in the suspend sequence from SRAM,
> such as saving and restoring the EMIF context and placing the memory
> into self-refresh.
> 
> One requirement for these SoCs to suspend and enter its lowest power
> mode, called DeepSleep0, is that the PER power domain must be shut off.
> Because the EMIF (DDR Controller) resides within this power domain, it
> will lose context during a suspend operation, so we must save it so we
> can restore once we resume. However, we cannot execute this code from
> external memory, as it is not available at this point, so the code must
> be executed late in the suspend path from SRAM.
> 
> This patch introduces a ti-emif-sram driver that includes several
> functions written in ARM ASM that are relocatable so the PM SRAM
> code can use them. It also allocates a region of writable SRAM to
> be used by the code running in the executable region of SRAM to save
> and restore the EMIF context. It can export a table containing the
> absolute addresses of the available PM functions so that other SRAM
> code can branch to them. This code is required for suspend/resume on
> AM335x and AM437x to work.
> 
> In addition to this, to be able to share data structures between C and
> the ti-emif-sram-pm assembly code, we can automatically generate all of
> the C struct member offsets and sizes as macros by making use of the ARM
> asm-offsets file. In the same header that we define our data structures
> in we also define all the macros in an inline function and by adding a
> call to this in the asm_offsets file all macros are properly generated
> and available to the assembly code without cluttering up the asm-offsets
> file.
> 
> Signed-off-by: Dave Gerlach <d-gerlach-l0cyMroinI0@public.gmane.org>
> ---
>  arch/arm/kernel/asm-offsets.c    |   6 +
>  drivers/memory/Kconfig           |  10 ++
>  drivers/memory/Makefile          |   4 +
>  drivers/memory/emif.h            |  17 ++
>  drivers/memory/ti-emif-pm.c      | 295 ++++++++++++++++++++++++++++++++++
>  drivers/memory/ti-emif-sram-pm.S | 334 +++++++++++++++++++++++++++++++++++++++
>  include/linux/ti-emif-sram.h     | 143 +++++++++++++++++
>  7 files changed, 809 insertions(+)
>  create mode 100644 drivers/memory/ti-emif-pm.c
>  create mode 100644 drivers/memory/ti-emif-sram-pm.S
>  create mode 100644 include/linux/ti-emif-sram.h
> 
> diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
> index 608008229c7d..d728b5660e36 100644
> --- a/arch/arm/kernel/asm-offsets.c
> +++ b/arch/arm/kernel/asm-offsets.c
> @@ -28,6 +28,7 @@
>  #include <asm/vdso_datapage.h>
>  #include <asm/hardware/cache-l2x0.h>
>  #include <linux/kbuild.h>
> +#include <linux/ti-emif-sram.h>
>  
>  /*
>   * Make sure that the compiler and target are compatible.
> @@ -183,5 +184,10 @@ int main(void)
>  #ifdef CONFIG_VDSO
>    DEFINE(VDSO_DATA_SIZE,	sizeof(union vdso_data_store));
>  #endif
> +#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
> +  BLANK();
> +  ti_emif_offsets();
> +#endif
> +
>    return 0; 
>  }

Does the above look OK to you?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe devicetree" 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: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] memory: ti-emif-sram: introduce relocatable suspend/resume handlers
Date: Tue, 4 Apr 2017 09:11:52 -0700	[thread overview]
Message-ID: <20170404161151.GS10760@atomide.com> (raw)
In-Reply-To: <20170328205511.21166-3-d-gerlach@ti.com>

Russell,

* Dave Gerlach <d-gerlach@ti.com> [170328 13:57]:
> Certain SoCs like Texas Instruments AM335x and AM437x require parts
> of the EMIF PM code to run late in the suspend sequence from SRAM,
> such as saving and restoring the EMIF context and placing the memory
> into self-refresh.
> 
> One requirement for these SoCs to suspend and enter its lowest power
> mode, called DeepSleep0, is that the PER power domain must be shut off.
> Because the EMIF (DDR Controller) resides within this power domain, it
> will lose context during a suspend operation, so we must save it so we
> can restore once we resume. However, we cannot execute this code from
> external memory, as it is not available at this point, so the code must
> be executed late in the suspend path from SRAM.
> 
> This patch introduces a ti-emif-sram driver that includes several
> functions written in ARM ASM that are relocatable so the PM SRAM
> code can use them. It also allocates a region of writable SRAM to
> be used by the code running in the executable region of SRAM to save
> and restore the EMIF context. It can export a table containing the
> absolute addresses of the available PM functions so that other SRAM
> code can branch to them. This code is required for suspend/resume on
> AM335x and AM437x to work.
> 
> In addition to this, to be able to share data structures between C and
> the ti-emif-sram-pm assembly code, we can automatically generate all of
> the C struct member offsets and sizes as macros by making use of the ARM
> asm-offsets file. In the same header that we define our data structures
> in we also define all the macros in an inline function and by adding a
> call to this in the asm_offsets file all macros are properly generated
> and available to the assembly code without cluttering up the asm-offsets
> file.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> ---
>  arch/arm/kernel/asm-offsets.c    |   6 +
>  drivers/memory/Kconfig           |  10 ++
>  drivers/memory/Makefile          |   4 +
>  drivers/memory/emif.h            |  17 ++
>  drivers/memory/ti-emif-pm.c      | 295 ++++++++++++++++++++++++++++++++++
>  drivers/memory/ti-emif-sram-pm.S | 334 +++++++++++++++++++++++++++++++++++++++
>  include/linux/ti-emif-sram.h     | 143 +++++++++++++++++
>  7 files changed, 809 insertions(+)
>  create mode 100644 drivers/memory/ti-emif-pm.c
>  create mode 100644 drivers/memory/ti-emif-sram-pm.S
>  create mode 100644 include/linux/ti-emif-sram.h
> 
> diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
> index 608008229c7d..d728b5660e36 100644
> --- a/arch/arm/kernel/asm-offsets.c
> +++ b/arch/arm/kernel/asm-offsets.c
> @@ -28,6 +28,7 @@
>  #include <asm/vdso_datapage.h>
>  #include <asm/hardware/cache-l2x0.h>
>  #include <linux/kbuild.h>
> +#include <linux/ti-emif-sram.h>
>  
>  /*
>   * Make sure that the compiler and target are compatible.
> @@ -183,5 +184,10 @@ int main(void)
>  #ifdef CONFIG_VDSO
>    DEFINE(VDSO_DATA_SIZE,	sizeof(union vdso_data_store));
>  #endif
> +#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
> +  BLANK();
> +  ti_emif_offsets();
> +#endif
> +
>    return 0; 
>  }

Does the above look OK to you?

Regards,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Russell King <linux@armlinux.org.uk>
Cc: Rob Herring <robh+dt@kernel.org>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Keerthy J <j-keerthy@ti.com>, Dave Gerlach <d-gerlach@ti.com>
Subject: Re: [PATCH 2/2] memory: ti-emif-sram: introduce relocatable suspend/resume handlers
Date: Tue, 4 Apr 2017 09:11:52 -0700	[thread overview]
Message-ID: <20170404161151.GS10760@atomide.com> (raw)
In-Reply-To: <20170328205511.21166-3-d-gerlach@ti.com>

Russell,

* Dave Gerlach <d-gerlach@ti.com> [170328 13:57]:
> Certain SoCs like Texas Instruments AM335x and AM437x require parts
> of the EMIF PM code to run late in the suspend sequence from SRAM,
> such as saving and restoring the EMIF context and placing the memory
> into self-refresh.
> 
> One requirement for these SoCs to suspend and enter its lowest power
> mode, called DeepSleep0, is that the PER power domain must be shut off.
> Because the EMIF (DDR Controller) resides within this power domain, it
> will lose context during a suspend operation, so we must save it so we
> can restore once we resume. However, we cannot execute this code from
> external memory, as it is not available at this point, so the code must
> be executed late in the suspend path from SRAM.
> 
> This patch introduces a ti-emif-sram driver that includes several
> functions written in ARM ASM that are relocatable so the PM SRAM
> code can use them. It also allocates a region of writable SRAM to
> be used by the code running in the executable region of SRAM to save
> and restore the EMIF context. It can export a table containing the
> absolute addresses of the available PM functions so that other SRAM
> code can branch to them. This code is required for suspend/resume on
> AM335x and AM437x to work.
> 
> In addition to this, to be able to share data structures between C and
> the ti-emif-sram-pm assembly code, we can automatically generate all of
> the C struct member offsets and sizes as macros by making use of the ARM
> asm-offsets file. In the same header that we define our data structures
> in we also define all the macros in an inline function and by adding a
> call to this in the asm_offsets file all macros are properly generated
> and available to the assembly code without cluttering up the asm-offsets
> file.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> ---
>  arch/arm/kernel/asm-offsets.c    |   6 +
>  drivers/memory/Kconfig           |  10 ++
>  drivers/memory/Makefile          |   4 +
>  drivers/memory/emif.h            |  17 ++
>  drivers/memory/ti-emif-pm.c      | 295 ++++++++++++++++++++++++++++++++++
>  drivers/memory/ti-emif-sram-pm.S | 334 +++++++++++++++++++++++++++++++++++++++
>  include/linux/ti-emif-sram.h     | 143 +++++++++++++++++
>  7 files changed, 809 insertions(+)
>  create mode 100644 drivers/memory/ti-emif-pm.c
>  create mode 100644 drivers/memory/ti-emif-sram-pm.S
>  create mode 100644 include/linux/ti-emif-sram.h
> 
> diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
> index 608008229c7d..d728b5660e36 100644
> --- a/arch/arm/kernel/asm-offsets.c
> +++ b/arch/arm/kernel/asm-offsets.c
> @@ -28,6 +28,7 @@
>  #include <asm/vdso_datapage.h>
>  #include <asm/hardware/cache-l2x0.h>
>  #include <linux/kbuild.h>
> +#include <linux/ti-emif-sram.h>
>  
>  /*
>   * Make sure that the compiler and target are compatible.
> @@ -183,5 +184,10 @@ int main(void)
>  #ifdef CONFIG_VDSO
>    DEFINE(VDSO_DATA_SIZE,	sizeof(union vdso_data_store));
>  #endif
> +#if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
> +  BLANK();
> +  ti_emif_offsets();
> +#endif
> +
>    return 0; 
>  }

Does the above look OK to you?

Regards,

Tony

  parent reply	other threads:[~2017-04-04 16:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 20:55 [PATCH 0/2] memory: Introduce ti-emif-sram driver Dave Gerlach
2017-03-28 20:55 ` Dave Gerlach
2017-03-28 20:55 ` Dave Gerlach
     [not found] ` <20170328205511.21166-1-d-gerlach-l0cyMroinI0@public.gmane.org>
2017-03-28 20:55   ` [PATCH 1/2] Documentation: dt: Update ti,emif bindings Dave Gerlach
2017-03-28 20:55     ` Dave Gerlach
2017-03-28 20:55     ` Dave Gerlach
     [not found]     ` <20170328205511.21166-2-d-gerlach-l0cyMroinI0@public.gmane.org>
2017-04-03 14:34       ` Rob Herring
2017-04-03 14:34         ` Rob Herring
2017-04-03 14:34         ` Rob Herring
2017-03-28 20:55   ` [PATCH 2/2] memory: ti-emif-sram: introduce relocatable suspend/resume handlers Dave Gerlach
2017-03-28 20:55     ` Dave Gerlach
2017-03-28 20:55     ` Dave Gerlach
     [not found]     ` <20170328205511.21166-3-d-gerlach-l0cyMroinI0@public.gmane.org>
2017-04-04 16:11       ` Tony Lindgren [this message]
2017-04-04 16:11         ` Tony Lindgren
2017-04-04 16:11         ` Tony Lindgren
2017-04-05 13:59         ` Russell King - ARM Linux
2017-04-05 13:59           ` Russell King - ARM Linux
2017-04-05 14:33           ` Tony Lindgren
2017-04-05 14:33             ` Tony Lindgren
2017-04-05 14:33             ` Tony Lindgren
     [not found]             ` <20170405143318.GE13234-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2017-04-05 14:48               ` Dave Gerlach
2017-04-05 14:48                 ` Dave Gerlach
2017-04-05 14:48                 ` Dave Gerlach
     [not found]                 ` <5cd63e14-52df-6010-4193-c926cdd76839-l0cyMroinI0@public.gmane.org>
2017-04-06 19:00                   ` Russell King - ARM Linux
2017-04-06 19:00                     ` Russell King - ARM Linux
2017-04-06 19:00                     ` Russell King - ARM Linux
     [not found]                     ` <20170406190008.GO23750-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2017-04-06 19:09                       ` Dave Gerlach
2017-04-06 19:09                         ` Dave Gerlach
2017-04-06 19:09                         ` Dave Gerlach

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=20170404161151.GS10760@atomide.com \
    --to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \
    --cc=d-gerlach-l0cyMroinI0@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=j-keerthy-l0cyMroinI0@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ssantosh-DgEjT+Ai2ygdnm+yROfE0A@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.