From: Dave Gerlach <d-gerlach@ti.com> To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Cc: Paul Walmsley <paul@pwsan.com>, Kevin Hilman <khilman@linaro.org>, Tony Lindgren <tony@atomide.com>, Tero Kristo <t-kristo@ti.com>, Nishanth Menon <nm@ti.com>, Russ Dill <russ.dill@ti.com>, Santosh Shilimkar <santosh.shilimkar@ti.com>, Daniel Mack <daniel@zonque.org>, Suman Anna <s-anna@ti.com>, Benoit Cousson <bcousson@baylibre.com>, Vaibhav Bedia <vaibhav.bedia@ti.com>, Dave Gerlach <d-gerlach@ti.com> Subject: [PATCH v4 08/11] ARM: OMAP2+: AM33XX: Reserve memory to comply with EMIF spec Date: Thu, 10 Jul 2014 21:55:46 -0500 [thread overview] Message-ID: <1405047349-15101-9-git-send-email-d-gerlach@ti.com> (raw) In-Reply-To: <1405047349-15101-1-git-send-email-d-gerlach@ti.com> From: Vaibhav Bedia <vaibhav.bedia@ti.com> SDRAM controller on AM33XX requires that a modification of certain bit-fields in PWR_MGMT_CTRL register (ref. section 7.3.5.13 in AM335x-Rev H) is followed by a dummy read access to SDRAM. This scenario arises when entering a low power state like DeepSleep. To ensure that the read is not from a cached region we reserve some memory during bootup using the arm_memblock_steal() API. The original call to omap_reserve is removed as it is not used in any way on am335x. A subsequent patch will pass along the location of the reserved memory location to the AM335x suspend handler which modifies the PWR_MGMT_CTRL register in the EMIF. Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Signed-off-by: Dave Gerlach <d-gerlach@ti.com> --- v3->v4: Left as is because of use in sram code when EMIF is off to avoid copying additional code. Also uses hardcoded virtual address now to avoid problems with himem arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/common.c | 32 ++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/common.h | 4 ++++ arch/arm/mach-omap2/io.c | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 9480997..d2c435e 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -163,7 +163,7 @@ static const char *am33xx_boards_compat[] __initconst = { }; DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)") - .reserve = omap_reserve, + .reserve = am33xx_reserve, .map_io = am33xx_map_io, .init_early = am33xx_init_early, .init_irq = omap_intc_of_init, diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c index 2dabb9e..df6394e 100644 --- a/arch/arm/mach-omap2/common.c +++ b/arch/arm/mach-omap2/common.c @@ -15,10 +15,14 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_data/dsp-omap.h> +#include <asm/memblock.h> +#include <asm/mach/map.h> #include "common.h" #include "omap-secure.h" +#define AM33XX_DRAM_SYNC_VA 0xfe600000 + /* * Stub function for OMAP2 so that common files * continue to build when custom builds are used @@ -34,3 +38,31 @@ void __init omap_reserve(void) omap_secure_ram_reserve_memblock(); omap_barrier_reserve_memblock(); } + +static phys_addr_t am33xx_paddr; +static u32 am33xx_size; + +/* Steal one page physical memory for uncached read DeepSleep */ +void __init am33xx_reserve(void) +{ + am33xx_size = ALIGN(PAGE_SIZE, SZ_1M); + am33xx_paddr = arm_memblock_steal(am33xx_size, SZ_1M); + + omap_reserve(); +} + +void __iomem *am33xx_dram_sync; + +void __init am33xx_dram_sync_init(void) +{ + struct map_desc dram_io_desc[1]; + + dram_io_desc[0].virtual = AM33XX_DRAM_SYNC_VA; + dram_io_desc[0].pfn = __phys_to_pfn(am33xx_paddr); + dram_io_desc[0].length = am33xx_size; + dram_io_desc[0].type = MT_MEMORY_RW_SO; + + iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); + + am33xx_dram_sync = (void __iomem *) dram_io_desc[0].virtual; +} diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index b2d252b..1536338 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -316,6 +316,10 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, struct omap2_hsmmc_info; extern void omap_reserve(void); +extern void am33xx_reserve(void); +extern void am33xx_dram_sync_init(void); +extern void __iomem *am33xx_dram_sync; + struct omap_hwmod; extern int omap_dss_reset(struct omap_hwmod *); diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 8f55945..4d4d150 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -313,6 +313,7 @@ void __init ti81xx_map_io(void) void __init am33xx_map_io(void) { iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); + am33xx_dram_sync_init(); } #endif -- 1.9.0
WARNING: multiple messages have this Message-ID (diff)
From: d-gerlach@ti.com (Dave Gerlach) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 08/11] ARM: OMAP2+: AM33XX: Reserve memory to comply with EMIF spec Date: Thu, 10 Jul 2014 21:55:46 -0500 [thread overview] Message-ID: <1405047349-15101-9-git-send-email-d-gerlach@ti.com> (raw) In-Reply-To: <1405047349-15101-1-git-send-email-d-gerlach@ti.com> From: Vaibhav Bedia <vaibhav.bedia@ti.com> SDRAM controller on AM33XX requires that a modification of certain bit-fields in PWR_MGMT_CTRL register (ref. section 7.3.5.13 in AM335x-Rev H) is followed by a dummy read access to SDRAM. This scenario arises when entering a low power state like DeepSleep. To ensure that the read is not from a cached region we reserve some memory during bootup using the arm_memblock_steal() API. The original call to omap_reserve is removed as it is not used in any way on am335x. A subsequent patch will pass along the location of the reserved memory location to the AM335x suspend handler which modifies the PWR_MGMT_CTRL register in the EMIF. Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com> Signed-off-by: Dave Gerlach <d-gerlach@ti.com> --- v3->v4: Left as is because of use in sram code when EMIF is off to avoid copying additional code. Also uses hardcoded virtual address now to avoid problems with himem arch/arm/mach-omap2/board-generic.c | 2 +- arch/arm/mach-omap2/common.c | 32 ++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/common.h | 4 ++++ arch/arm/mach-omap2/io.c | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index 9480997..d2c435e 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -163,7 +163,7 @@ static const char *am33xx_boards_compat[] __initconst = { }; DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)") - .reserve = omap_reserve, + .reserve = am33xx_reserve, .map_io = am33xx_map_io, .init_early = am33xx_init_early, .init_irq = omap_intc_of_init, diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c index 2dabb9e..df6394e 100644 --- a/arch/arm/mach-omap2/common.c +++ b/arch/arm/mach-omap2/common.c @@ -15,10 +15,14 @@ #include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_data/dsp-omap.h> +#include <asm/memblock.h> +#include <asm/mach/map.h> #include "common.h" #include "omap-secure.h" +#define AM33XX_DRAM_SYNC_VA 0xfe600000 + /* * Stub function for OMAP2 so that common files * continue to build when custom builds are used @@ -34,3 +38,31 @@ void __init omap_reserve(void) omap_secure_ram_reserve_memblock(); omap_barrier_reserve_memblock(); } + +static phys_addr_t am33xx_paddr; +static u32 am33xx_size; + +/* Steal one page physical memory for uncached read DeepSleep */ +void __init am33xx_reserve(void) +{ + am33xx_size = ALIGN(PAGE_SIZE, SZ_1M); + am33xx_paddr = arm_memblock_steal(am33xx_size, SZ_1M); + + omap_reserve(); +} + +void __iomem *am33xx_dram_sync; + +void __init am33xx_dram_sync_init(void) +{ + struct map_desc dram_io_desc[1]; + + dram_io_desc[0].virtual = AM33XX_DRAM_SYNC_VA; + dram_io_desc[0].pfn = __phys_to_pfn(am33xx_paddr); + dram_io_desc[0].length = am33xx_size; + dram_io_desc[0].type = MT_MEMORY_RW_SO; + + iotable_init(dram_io_desc, ARRAY_SIZE(dram_io_desc)); + + am33xx_dram_sync = (void __iomem *) dram_io_desc[0].virtual; +} diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index b2d252b..1536338 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -316,6 +316,10 @@ extern void omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0, struct omap2_hsmmc_info; extern void omap_reserve(void); +extern void am33xx_reserve(void); +extern void am33xx_dram_sync_init(void); +extern void __iomem *am33xx_dram_sync; + struct omap_hwmod; extern int omap_dss_reset(struct omap_hwmod *); diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 8f55945..4d4d150 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c @@ -313,6 +313,7 @@ void __init ti81xx_map_io(void) void __init am33xx_map_io(void) { iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); + am33xx_dram_sync_init(); } #endif -- 1.9.0
next prev parent reply other threads:[~2014-07-11 2:57 UTC|newest] Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-11 2:55 [PATCH v4 00/11] ARM: OMAP2+: AM33XX: Add suspend-resume support Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 01/11] ARM: omap: edma: add suspend suspend/resume hooks Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 11:05 ` Tony Lindgren 2014-07-14 11:05 ` Tony Lindgren 2014-07-14 17:47 ` Dave Gerlach 2014-07-14 17:47 ` Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 02/11] memory: emif: Move EMIF register defines to include/linux/ Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 11:12 ` Tony Lindgren 2014-07-14 11:12 ` Tony Lindgren 2014-07-14 17:42 ` Dave Gerlach 2014-07-14 17:42 ` Dave Gerlach 2014-07-15 6:38 ` Tony Lindgren 2014-07-15 6:38 ` Tony Lindgren 2014-07-16 2:44 ` Dave Gerlach 2014-07-16 2:44 ` Dave Gerlach 2014-07-16 8:33 ` Tony Lindgren 2014-07-16 8:33 ` Tony Lindgren 2014-07-11 2:55 ` [PATCH v4 03/11] ARM: OMAP2+: timer: Add suspend-resume callbacks for clkevent device Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 11:15 ` Tony Lindgren 2014-07-14 11:15 ` Tony Lindgren 2014-07-14 14:37 ` Santosh Shilimkar 2014-07-14 14:37 ` Santosh Shilimkar 2014-07-14 17:42 ` Dave Gerlach 2014-07-14 17:42 ` Dave Gerlach 2014-07-15 6:48 ` Tony Lindgren 2014-07-15 6:48 ` Tony Lindgren 2014-07-15 19:10 ` Dave Gerlach 2014-07-15 19:10 ` Dave Gerlach 2014-07-16 20:17 ` Dave Gerlach 2014-07-16 20:17 ` Dave Gerlach 2014-07-17 8:16 ` Tony Lindgren 2014-07-17 8:16 ` Tony Lindgren 2014-07-11 2:55 ` [PATCH v4 04/11] ARM: OMAP2+: Use pdata-quirks for wkup_m3 deassert_hardreset Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 18:48 ` Suman Anna 2014-07-14 18:48 ` Suman Anna 2014-07-11 2:55 ` [PATCH v4 05/11] Documentation: dt: add ti,am3353_wkup_m3 bindings Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 14:41 ` Santosh Shilimkar 2014-07-14 14:41 ` [PATCH v4 05/11] Documentation: dt: add ti, am3353_wkup_m3 bindings Santosh Shilimkar 2014-07-14 16:33 ` [PATCH v4 05/11] Documentation: dt: add ti,am3353_wkup_m3 bindings Suman Anna 2014-07-14 16:33 ` [PATCH v4 05/11] Documentation: dt: add ti, am3353_wkup_m3 bindings Suman Anna 2014-07-14 17:45 ` [PATCH v4 05/11] Documentation: dt: add ti,am3353_wkup_m3 bindings Dave Gerlach 2014-07-14 17:45 ` [PATCH v4 05/11] Documentation: dt: add ti, am3353_wkup_m3 bindings Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 06/11] remoteproc: wkup_m3: Add wkup_m3 remote proc driver Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 14:54 ` Santosh Shilimkar 2014-07-14 14:54 ` Santosh Shilimkar 2014-07-14 17:43 ` Dave Gerlach 2014-07-14 17:43 ` Dave Gerlach 2014-07-14 19:07 ` Suman Anna 2014-07-14 19:07 ` Suman Anna 2014-07-14 21:09 ` Dave Gerlach 2014-07-14 21:09 ` Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 07/11] ARM: dts: am33xx: Update wkup_m3 node Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach [this message] 2014-07-11 2:55 ` [PATCH v4 08/11] ARM: OMAP2+: AM33XX: Reserve memory to comply with EMIF spec Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 09/11] ARM: OMAP2+: AM33XX: Add assembly code for PM operations Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 10/11] ARM: OMAP2+: AM33XX: Basic suspend resume support Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-09-08 22:30 ` Kevin Hilman 2014-09-08 22:30 ` Kevin Hilman 2014-09-09 10:31 ` Ohad Ben-Cohen 2014-09-09 10:31 ` Ohad Ben-Cohen 2014-09-09 19:59 ` Suman Anna 2014-09-09 19:59 ` Suman Anna 2014-09-09 20:28 ` Dave Gerlach 2014-09-09 20:28 ` Dave Gerlach 2014-09-09 21:10 ` Kevin Hilman 2014-09-09 21:10 ` Kevin Hilman 2014-09-10 21:19 ` Dave Gerlach 2014-09-10 21:19 ` Dave Gerlach 2014-09-16 15:08 ` Ohad Ben-Cohen 2014-09-16 15:08 ` Ohad Ben-Cohen 2014-09-16 16:14 ` Suman Anna 2014-09-16 16:14 ` Suman Anna 2014-09-17 13:37 ` Ohad Ben-Cohen 2014-09-17 13:37 ` Ohad Ben-Cohen 2014-09-25 19:42 ` Dave Gerlach 2014-09-25 19:42 ` Dave Gerlach 2014-07-11 2:55 ` [PATCH v4 11/11] ARM: OMAP2+: AM33XX: Hookup AM33XX PM code into OMAP builds Dave Gerlach 2014-07-11 2:55 ` Dave Gerlach 2014-07-14 11:21 ` Tony Lindgren 2014-07-14 11:21 ` Tony Lindgren 2014-07-14 17:46 ` Dave Gerlach 2014-07-14 17:46 ` Dave Gerlach 2014-07-11 7:59 ` [PATCH v4 00/11] ARM: OMAP2+: AM33XX: Add suspend-resume support Daniel Mack 2014-07-11 7:59 ` Daniel Mack 2014-07-11 17:24 ` Dave Gerlach 2014-07-11 17:24 ` Dave Gerlach 2014-07-11 15:30 ` Andre Heider 2014-07-11 15:30 ` Andre Heider 2014-07-11 17:31 ` Dave Gerlach 2014-07-11 17:31 ` Dave Gerlach 2014-07-14 9:37 ` Andre Heider 2014-07-14 9:37 ` Andre Heider 2014-07-14 11:24 ` Tony Lindgren 2014-07-14 11:24 ` Tony Lindgren 2014-07-14 17:47 ` Dave Gerlach 2014-07-14 17:47 ` 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=1405047349-15101-9-git-send-email-d-gerlach@ti.com \ --to=d-gerlach@ti.com \ --cc=bcousson@baylibre.com \ --cc=daniel@zonque.org \ --cc=khilman@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=nm@ti.com \ --cc=paul@pwsan.com \ --cc=russ.dill@ti.com \ --cc=s-anna@ti.com \ --cc=santosh.shilimkar@ti.com \ --cc=t-kristo@ti.com \ --cc=tony@atomide.com \ --cc=vaibhav.bedia@ti.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: linkBe 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.