Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Please help with the OMAP static mapping mess
From: Tony Lindgren @ 2011-10-05  0:42 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.02.1110041900590.9106@xanadu.home>

* Nicolas Pitre <nico@fluxnic.net> [111004 15:47]:
> On Tue, 4 Oct 2011, Russell King - ARM Linux wrote:
> 
> > On Tue, Oct 04, 2011 at 05:10:36PM -0400, Nicolas Pitre wrote:
> > > Which makes me think... with all those architectures intercepting 
> > > ioremap calls in order to provide an equivalent static mapping address, 
> > > they already get an unexpected domain given that static mappings are 
> > > mostly DOMAIN_IO and not DOMAIN_KERNEL as would result from an non 
> > > intercepted ioremap call.
> > 
> > That's a necessary evil - otherwise we have to separate out the
> > ioremap from vmalloc.
> > 
> > Incidentally, how are you dealing with the problem of a static mapping
> > setting up a L1 page table entry for DOMAIN_IO, and then a vmalloc
> > request coming in, overlapping that L1 page table?
> > 
> > If this memory then gets accessed with get_user() with set_fs(get_ds()),
> > the kernel will oops as we don't switch DOMAIN_IO memory on set_fs().
> > (I don't know if this happens in practice, but there's nothing to say
> > that it's illegal to do this.)
> 
> I suppose that didn't happen so far.  Granted, moving the ioremap 
> optimization into core code for all machines will increase the 
> possibility for this to happen, even if still small.
> 
> With CPU_USE_DOMAINS not set, set_fs() is a no-op anyway, besides 
> addr_limit that is.
> 
> Is there a strong benefit in having static mappings being DOMAIN_IO 
> instead of DOMAIN_KERNEL?

In any case, I suggest we add the following __arm_ioremap_exec patch
and then sort out issues with it as they show up.

This allows further work on the common SRAM genalloc patches and generic
map_io patches.

Nico, I already have a series converting omap2+ to use the the patch
below, and it seems to be working just fine for SRAM. I'll post that
series separately shortly. Maybe take a look and see if that allows
you to do the generic map_io changes?

I still also need to convert omap1 too, but will do that a bit later.

Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Tue, 4 Oct 2011 17:22:16 -0700
Subject: [PATCH] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY

This allows mapping external memory such as SRAM for use.

This is needed for some small chunks of code, such as reprogramming
SDRAM memory source clocks that can't be executed in SDRAM. Other
use cases include some PM related code.

Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
 
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
+extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
 extern void __iounmap(volatile void __iomem *addr);
 
 /*
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space as memory. Needed when the kernel wants to execute
+ * code in external memory. This is needed for reprogramming source
+ * clocks that would affect normal memory for example. Please see
+ * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
+ */
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
+{
+	unsigned int mtype;
+
+	if (cached)
+		mtype = MT_MEMORY;
+	else
+		mtype = MT_MEMORY_NONCACHED;
+
+	return __arm_ioremap_caller(phys_addr, size, mtype,
+			__builtin_return_address(0));
+}
+EXPORT_SYMBOL(__arm_ioremap_exec);
+
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);

^ permalink raw reply

* [PATCH 0/4] initialize omap SRAM later on with __arm_ioremap_exec()
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

Related to the omap static mapping, here's a first take on moving the
SRAM init to happen later so we can do generic map_io.

Still working on a similar patch for omap1, will send it a bit later.

Regards,

Tony

---

Tony Lindgren (4):
      ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
      ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
      ARM: OMAP: Remove calls to SRAM allocations for framebuffer
      ARM: OMAP: Map SRAM later on with ioremap_exec()


 arch/arm/include/asm/io.h                |    1 
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |  108 ++++++++++++++----------------
 arch/arm/mm/ioremap.c                    |   22 ++++++
 arch/arm/plat-omap/include/plat/common.h |    1 
 arch/arm/plat-omap/sram.c                |   85 ++++++------------------
 6 files changed, 94 insertions(+), 130 deletions(-)

-- 
Signature

^ permalink raw reply

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004339.26980.31149.stgit@kaulin.local>

This allows mapping external memory such as SRAM for use.

This is needed for some small chunks of code, such as reprogramming
SDRAM memory source clocks that can't be executed in SDRAM. Other
use cases include some PM related code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/include/asm/io.h |    1 +
 arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605d..4ff152e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
 
 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
 extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
+extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
 extern void __iounmap(volatile void __iomem *addr);
 
 /*
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab50627..a813658 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
 }
 EXPORT_SYMBOL(__arm_ioremap);
 
+/*
+ * Remap an arbitrary physical address space into the kernel virtual
+ * address space as memory. Needed when the kernel wants to execute
+ * code in external memory. This is needed for reprogramming source
+ * clocks that would affect normal memory for example. Please see
+ * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
+ */
+void __iomem *
+__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
+{
+	unsigned int mtype;
+
+	if (cached)
+		mtype = MT_MEMORY;
+	else
+		mtype = MT_MEMORY_NONCACHED;
+
+	return __arm_ioremap_caller(phys_addr, size, mtype,
+			__builtin_return_address(0));
+}
+EXPORT_SYMBOL(__arm_ioremap_exec);
+
 void __iounmap(volatile void __iomem *io_addr)
 {
 	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);

^ permalink raw reply related

* [PATCH 2/4] ARM: OMAP: Avoid cpu_is_omapxxxx usage until map_io is done
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004339.26980.31149.stgit@kaulin.local>

This way we don't need to initialize SoC detection early
and can start using generic map_io.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c  |    7 --
 arch/arm/mach-omap2/io.c                 |   91 ++++++++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h |    1 
 3 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index e085371..4e5605d 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -444,11 +444,6 @@ static struct platform_device keys_gpio = {
 	},
 };
 
-static void __init omap3_beagle_init_early(void)
-{
-	omap2_init_common_infrastructure();
-}
-
 static struct platform_device *omap3_beagle_devices[] __initdata = {
 	&leds_gpio,
 	&keys_gpio,
@@ -555,7 +550,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
 	.boot_params	= 0x80000100,
 	.reserve	= omap_reserve,
 	.map_io		= omap3_map_io,
-	.init_early	= omap3_beagle_init_early,
+	.init_early	= omap3_init_early,
 	.init_irq	= omap3_init_irq,
 	.init_machine	= omap3_beagle_init,
 	.timer		= &omap3_secure_timer,
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 1a13b79..82230e1 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -247,9 +247,6 @@ static void __init _omap2_map_common_io(void)
 	 */
 	local_flush_tlb_all();
 	flush_cache_all();
-
-	omap2_check_revision();
-	omap_sram_init();
 }
 
 #ifdef CONFIG_SOC_OMAP2420
@@ -336,29 +333,15 @@ static int _set_hwmod_postsetup_state(struct omap_hwmod *oh, void *data)
 /* See irq.c, omap4-common.c and entry-macro.S */
 void __iomem *omap_irq_base;
 
-void __init omap2_init_common_infrastructure(void)
+static void __init omap_common_init_early(void)
 {
-	u8 postsetup_state;
+	omap2_check_revision();
+	omap_sram_init();
+}
 
-	if (cpu_is_omap242x()) {
-		omap242x_powerdomains_init();
-		omap242x_clockdomains_init();
-		omap2420_hwmod_init();
-	} else if (cpu_is_omap243x()) {
-		omap243x_powerdomains_init();
-		omap243x_clockdomains_init();
-		omap2430_hwmod_init();
-	} else if (cpu_is_omap34xx()) {
-		omap3xxx_powerdomains_init();
-		omap3xxx_clockdomains_init();
-		omap3xxx_hwmod_init();
-	} else if (cpu_is_omap44xx()) {
-		omap44xx_powerdomains_init();
-		omap44xx_clockdomains_init();
-		omap44xx_hwmod_init();
-	} else {
-		pr_err("Could not init hwmod data - unknown SoC\n");
-        }
+static void __init omap_hwmod_init_postsetup(void)
+{
+	u8 postsetup_state;
 
 	/* Set the default postsetup state for all hwmods */
 #ifdef CONFIG_PM_RUNTIME
@@ -387,57 +370,79 @@ void __init omap2_init_common_infrastructure(void)
 				     &postsetup_state);
 
 	omap_pm_if_early_init();
-
-	if (cpu_is_omap2420())
-		omap2420_clk_init();
-	else if (cpu_is_omap2430())
-		omap2430_clk_init();
-	else if (cpu_is_omap34xx())
-		omap3xxx_clk_init();
-	else if (cpu_is_omap44xx())
-		omap4xxx_clk_init();
-	else
-		pr_err("Could not init clock framework - unknown SoC\n");
 }
 
 void __init omap2420_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap2xxx_voltagedomains_init();
+	omap242x_powerdomains_init();
+	omap242x_clockdomains_init();
+	omap2420_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap2420_clk_init();
 }
 
 void __init omap2430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap2xxx_voltagedomains_init();
+	omap243x_powerdomains_init();
+	omap243x_clockdomains_init();
+	omap2430_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap2430_clk_init();
+}
+
+/*
+ * Currently only board-omap3beagle.c should call this because of the
+ * same machine_id for 34xx and 36xx beagle.. Will get fixed with DT.
+ */
+void __init omap3_init_early(void)
+{
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap3430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap35xx_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap3630_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init am35xx_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init ti816x_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap3_init_early();
 }
 
 void __init omap4430_init_early(void)
 {
-	omap2_init_common_infrastructure();
+	omap_common_init_early();
+	omap44xx_voltagedomains_init();
+	omap44xx_powerdomains_init();
+	omap44xx_clockdomains_init();
+	omap44xx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap4xxx_clk_init();
 }
 
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index abda2c7..5eac355 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -50,6 +50,7 @@ void omap2430_init_early(void);
 void omap3430_init_early(void);
 void omap35xx_init_early(void);
 void omap3630_init_early(void);
+void omap3_init_early(void);	/* Do not use this one */
 void am35xx_init_early(void);
 void ti816x_init_early(void);
 void omap4430_init_early(void);

^ permalink raw reply related

* [PATCH 3/4] ARM: OMAP: Remove calls to SRAM allocations for framebuffer
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004339.26980.31149.stgit@kaulin.local>

This assumes fixed mappings which will not work once we move
to use ioremap_exec(). It seems that these are currently
not in use, or in use for some out of tree corner cases.

If SRAM support for framebuffer is wanted, it should be done
with ioremap in the driver.

Note that further removal of the code can now be done,
but that can be done seprately by the driver maintainers.

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/sram.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 363c91e..3c8aa44 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -19,7 +19,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/omapfb.h>
 
 #include <asm/tlb.h>
 #include <asm/cacheflush.h>
@@ -29,10 +28,8 @@
 #include <plat/sram.h>
 #include <plat/board.h>
 #include <plat/cpu.h>
-#include <plat/vram.h>
 
 #include "sram.h"
-#include "fb.h"
 
 /* XXX These "sideways" includes are a sign that something is wrong */
 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
@@ -112,8 +109,6 @@ static int is_sram_locked(void)
  */
 static void __init omap_detect_sram(void)
 {
-	unsigned long reserved;
-
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
@@ -170,17 +165,6 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-	reserved = omapfb_reserve_sram(omap_sram_start, omap_sram_base,
-				       omap_sram_size,
-				       omap_sram_start + SRAM_BOOTLOADER_SZ,
-				       omap_sram_size - SRAM_BOOTLOADER_SZ);
-	omap_sram_size -= reserved;
-
-	reserved = omap_vram_reserve_sram(omap_sram_start, omap_sram_base,
-			omap_sram_size,
-			omap_sram_start + SRAM_BOOTLOADER_SZ,
-			omap_sram_size - SRAM_BOOTLOADER_SZ);
-	omap_sram_size -= reserved;
 
 	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }

^ permalink raw reply related

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
From: Tony Lindgren @ 2011-10-05  0:45 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004339.26980.31149.stgit@kaulin.local>

This allows us to remove omap hacks for map_io.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap2/io.c  |   19 +-----------
 arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
 2 files changed, 22 insertions(+), 66 deletions(-)

diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 82230e1..8069ca8 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -239,22 +239,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
 };
 #endif
 
-static void __init _omap2_map_common_io(void)
-{
-	/* Normally devicemaps_init() would flush caches and tlb after
-	 * mdesc->map_io(), but we must also do it here because of the CPU
-	 * revision check below.
-	 */
-	local_flush_tlb_all();
-	flush_cache_all();
-}
-
 #ifdef CONFIG_SOC_OMAP2420
 void __init omap242x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -263,7 +252,6 @@ void __init omap243x_map_common_io(void)
 {
 	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
 	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -271,7 +259,6 @@ void __init omap243x_map_common_io(void)
 void __init omap34xx_map_common_io(void)
 {
 	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -279,7 +266,6 @@ void __init omap34xx_map_common_io(void)
 void __init omapti816x_map_common_io(void)
 {
 	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -287,7 +273,6 @@ void __init omapti816x_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 {
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
-	_omap2_map_common_io();
 }
 #endif
 
@@ -336,7 +321,6 @@ void __iomem *omap_irq_base;
 static void __init omap_common_init_early(void)
 {
 	omap2_check_revision();
-	omap_sram_init();
 }
 
 static void __init omap_hwmod_init_postsetup(void)
@@ -448,11 +432,12 @@ void __init omap4430_init_early(void)
 void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
 				      struct omap_sdrc_params *sdrc_cs1)
 {
+	omap_sram_init();
+
 	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
 		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
 		_omap2_init_reprogram_sdrc();
 	}
-
 }
 
 /*
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 3c8aa44..8b28664 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -38,16 +38,9 @@
 #endif
 
 #define OMAP1_SRAM_PA		0x20000000
-#define OMAP1_SRAM_VA		VMALLOC_END
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
-#define OMAP2_SRAM_VA		0xfe400000
-#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
-#define OMAP3_SRAM_VA           0xfe400000
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
-#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
-#define OMAP4_SRAM_VA		0xfe400000
 #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
-#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
 
 #if defined(CONFIG_ARCH_OMAP2PLUS)
 #define SRAM_BOOTLOADER_SZ	0x00
@@ -70,9 +63,9 @@
 #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
 
 static unsigned long omap_sram_start;
-static unsigned long omap_sram_base;
+static void __iomem *omap_sram_base;
 static unsigned long omap_sram_size;
-static unsigned long omap_sram_ceil;
+static void __iomem *omap_sram_ceil;
 
 /*
  * Depending on the target RAMFS firewall setup, the public usable amount of
@@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
 	if (cpu_class_is_omap2()) {
 		if (is_sram_locked()) {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_PUB_VA;
 				omap_sram_start = OMAP3_SRAM_PUB_PA;
 				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
 				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
@@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x8000; /* 32K */
 				}
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_PUB_VA;
 				omap_sram_start = OMAP4_SRAM_PUB_PA;
 				omap_sram_size = 0xa000; /* 40K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_PUB_VA;
 				omap_sram_start = OMAP2_SRAM_PUB_PA;
 				omap_sram_size = 0x800; /* 2K */
 			}
 		} else {
 			if (cpu_is_omap34xx()) {
-				omap_sram_base = OMAP3_SRAM_VA;
 				omap_sram_start = OMAP3_SRAM_PA;
 				omap_sram_size = 0x10000; /* 64K */
 			} else if (cpu_is_omap44xx()) {
-				omap_sram_base = OMAP4_SRAM_VA;
 				omap_sram_start = OMAP4_SRAM_PA;
 				omap_sram_size = 0xe000; /* 56K */
 			} else {
-				omap_sram_base = OMAP2_SRAM_VA;
 				omap_sram_start = OMAP2_SRAM_PA;
 				if (cpu_is_omap242x())
 					omap_sram_size = 0xa0000; /* 640K */
@@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
 			}
 		}
 	} else {
-		omap_sram_base = OMAP1_SRAM_VA;
 		omap_sram_start = OMAP1_SRAM_PA;
 
 		if (cpu_is_omap7xx())
@@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
 			omap_sram_size = 0x4000;
 		}
 	}
-
-	omap_sram_ceil = omap_sram_base + omap_sram_size;
 }
 
-static struct map_desc omap_sram_io_desc[] __initdata = {
-	{	/* .length gets filled in at runtime */
-		.virtual	= OMAP1_SRAM_VA,
-		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
-		.type		= MT_MEMORY
-	}
-};
-
 /*
  * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
  */
 static void __init omap_map_sram(void)
 {
-	unsigned long base;
+	int cached = 1;
 
 	if (omap_sram_size == 0)
 		return;
@@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
 		 * the ARM may attempt to write cache lines back to SDRAM
 		 * which will cause the system to hang.
 		 */
-		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
+		cached = 0;
 	}
 
-	omap_sram_io_desc[0].virtual = omap_sram_base;
-	base = omap_sram_start;
-	base = ROUND_DOWN(base, PAGE_SIZE);
-	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
-	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
-	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
-
-	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
-		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
-		omap_sram_io_desc[0].virtual,
-		omap_sram_io_desc[0].length);
+	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
+	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
+						cached);
+	if (!omap_sram_base) {
+		pr_err("SRAM: Could not map\n");
+		return;
+	}
 
-	/*
-	 * Normally devicemaps_init() would flush caches and tlb after
-	 * mdesc->map_io(), but since we're called from map_io(), we
-	 * must do it here.
-	 */
-	local_flush_tlb_all();
-	flush_cache_all();
+	omap_sram_ceil = omap_sram_base + omap_sram_size;
 
 	/*
 	 * Looks like we need to preserve some bootloader code at the
@@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
  */
 void *omap_sram_push_address(unsigned long size)
 {
-	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
+	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
+
+	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
+
+	if (size > available) {
 		pr_err("Not enough space in SRAM\n");
 		return NULL;
 	}
 
-	omap_sram_ceil -= size;
-	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
+	new_ceil -= size;
+	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
+	omap_sram_ceil = IOMEM(new_ceil);
 
 	return (void *)omap_sram_ceil;
 }

^ permalink raw reply related

* Please help with the OMAP static mapping mess
From: Nicolas Pitre @ 2011-10-05  0:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004208.GW6324@atomide.com>

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> In any case, I suggest we add the following __arm_ioremap_exec patch
> and then sort out issues with it as they show up.
> 
> This allows further work on the common SRAM genalloc patches and generic
> map_io patches.
> 
> Nico, I already have a series converting omap2+ to use the the patch
> below, and it seems to be working just fine for SRAM. I'll post that
> series separately shortly. Maybe take a look and see if that allows
> you to do the generic map_io changes?

Yes, that looks fine.  Maybe you could avoid exporting the symbol until 
it is actually needed though.

The other thing I need is for the code using ioremap() such as in 
omap2_set_globals_control() to be called only after the corresponding 
static mappings are already installed.  Then everything should go 
smoothly.


Nicolas

^ permalink raw reply

* [PATCH 1/4] ARM: Add __arm_ioremap_exec for mapping external memory as MT_MEMORY
From: Nicolas Pitre @ 2011-10-05  1:00 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004539.26980.52409.stgit@kaulin.local>

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> This allows mapping external memory such as SRAM for use.
> 
> This is needed for some small chunks of code, such as reprogramming
> SDRAM memory source clocks that can't be executed in SDRAM. Other
> use cases include some PM related code.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

As mentioned, you might consider dropping the export until needed.


> ---
>  arch/arm/include/asm/io.h |    1 +
>  arch/arm/mm/ioremap.c     |   22 ++++++++++++++++++++++
>  2 files changed, 23 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
> index d66605d..4ff152e 100644
> --- a/arch/arm/include/asm/io.h
> +++ b/arch/arm/include/asm/io.h
> @@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
>  
>  extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
>  extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
> +extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, int cached);
>  extern void __iounmap(volatile void __iomem *addr);
>  
>  /*
> diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
> index ab50627..a813658 100644
> --- a/arch/arm/mm/ioremap.c
> +++ b/arch/arm/mm/ioremap.c
> @@ -289,6 +289,28 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
>  }
>  EXPORT_SYMBOL(__arm_ioremap);
>  
> +/*
> + * Remap an arbitrary physical address space into the kernel virtual
> + * address space as memory. Needed when the kernel wants to execute
> + * code in external memory. This is needed for reprogramming source
> + * clocks that would affect normal memory for example. Please see
> + * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
> + */
> +void __iomem *
> +__arm_ioremap_exec(unsigned long phys_addr, size_t size, int cached)
> +{
> +	unsigned int mtype;
> +
> +	if (cached)
> +		mtype = MT_MEMORY;
> +	else
> +		mtype = MT_MEMORY_NONCACHED;
> +
> +	return __arm_ioremap_caller(phys_addr, size, mtype,
> +			__builtin_return_address(0));
> +}
> +EXPORT_SYMBOL(__arm_ioremap_exec);
> +
>  void __iounmap(volatile void __iomem *io_addr)
>  {
>  	void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply

* [GIT PULL] initial omap DT support for v3.2 merge window (Re: [PATCH 26/30] ARM: omap: add board autoselection)
From: Tony Lindgren @ 2011-10-05  1:05 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <2340307.S2RzXdHlIz@wuerfel>

* Arnd Bergmann <arnd@arndb.de> [111004 11:55]:
> On Tuesday 04 October 2011 08:57:52 Tony Lindgren wrote:
> > * Arnd Bergmann <arnd@arndb.de> [111004 00:10]:
> > > On Monday 03 October 2011, Tony Lindgren wrote:
> > >
> > > > Yes please leave out the list so we don't need to constantly update it.
> > > > Let's just always build in MACH_OMAP_GENERIC.
> > > 
> > > That's what I had initially, but now that board file has become
> > > omap2-specific and no longer works on omap3-only or omap4-only
> > > configurations.
> > 
> > Will send a pull request for basic DT bootstrap support from Benoit
> > that fixes that. So maybe let's sort that out first, then always
> > select it?
> 
> Yes, sounds good. That is certainly the better solution in the long run.

Here you are. We had to rebase it earlier today because of the
SOB update in fixes branch for the musb related fix that's needed
here to avoid a merge conflict.

This series pretty much depends and conflicts with all the ealier
branches, so I created a new dt-base branch to deal with the merge
conflicts. If you prefer some other base, please let me know.

If you prefer to build some other merge base yourself, see the
attached patch that's needed to avoid two build warnings after
merging the various base branches together.

The dt-base I did is a merge of cleanup-part3, voltage, dmtimer
and l3 into fixes. You may not yet have l3 and fixes pulled in,
I sent pull requests for those yesterday. The others you have
already pulled I believe.

Despite using the merge base this will cause a minor merge conflict
in board-generic.c with Nicolas Pitre's earlier patch titled
"ARM: mach-omap2: convert boot_params to atag_offset". The 
atag_offset can be just left out, as the default will work.

Regards,

Tony


The following changes since commit c541c15fb5ab48c47bc9b90121538fd30d152f23:
  Tony Lindgren (1):
        Merge branches 'cleanup-part3', 'voltage', 'dmtimer' and 'l3' into dt-base

are available in the git repository at:

  git://github.com/tmlind/linux.git dt

Benoit Cousson (18):
      ARM: OMAP3: beagle-board: Use the omap_hwmod_name_get_dev API
      ARM: OMAP2+: pm: Use hwmod name instead of dev pointer
      ARM: OMAP2+: pm: Remove static devices variable for mpu, dsp, iva and l3 PM
      ARM: OMAP: omap_device: Create a default omap_device_pm_latency
      ARM: OMAP2+: devices: Remove all omap_device_pm_latency structures
      of: Add helpers to get one string in multiple strings property
      ARM: OMAP: omap_device: Add omap_device_[alloc|delete] for DT integration
      ARM: OMAP: omap_device: Add a method to build an omap_device from a DT node
      arm/dts: Add initial device tree support for OMAP4 SoC
      arm/dts: Add support for OMAP4 PandaBoard
      arm/dts: Add support for OMAP4 SDP board
      arm/dts: Add initial device tree support for OMAP3 SoC
      arm/dts: Add support for OMAP3 Beagle board
      ARM: OMAP2+: board-generic: Add DT support to generic board
      ARM: OMAP2+: board-generic: Add i2c static init
      ARM: OMAP2+: l3-noc: Add support for device-tree
      arm/dts: OMAP4: Add a main ocp entry bound to l3-noc driver
      arm/dts: OMAP3+: Add mpu, dsp and iva nodes

Nishanth Menon (1):
      ARM: OMAP: omap_device: Add omap_device_get_by_hwmod_name

Tony Lindgren (1):
      Merge branch 'for_3.2/3_omap_devicetree' of git://gitorious.org/omap-pm/linux into dt

 Documentation/devicetree/bindings/arm/omap/dsp.txt |   14 +
 Documentation/devicetree/bindings/arm/omap/iva.txt |   19 ++
 .../devicetree/bindings/arm/omap/l3-noc.txt        |   19 ++
 Documentation/devicetree/bindings/arm/omap/mpu.txt |   27 ++
 .../devicetree/bindings/arm/omap/omap.txt          |   43 +++
 arch/arm/boot/dts/omap3-beagle.dts                 |   29 ++
 arch/arm/boot/dts/omap3.dtsi                       |   63 ++++
 arch/arm/boot/dts/omap4-panda.dts                  |   29 ++
 arch/arm/boot/dts/omap4-sdp.dts                    |   29 ++
 arch/arm/boot/dts/omap4.dtsi                       |  103 +++++++
 arch/arm/mach-omap2/Kconfig                        |    8 +-
 arch/arm/mach-omap2/board-generic.c                |  156 ++++++++---
 arch/arm/mach-omap2/board-omap3beagle.c            |    4 +-
 arch/arm/mach-omap2/devices.c                      |   51 +---
 arch/arm/mach-omap2/display.c                      |   11 +-
 arch/arm/mach-omap2/dma.c                          |   11 +-
 arch/arm/mach-omap2/gpio.c                         |   12 +-
 arch/arm/mach-omap2/hsmmc.c                        |   18 +-
 arch/arm/mach-omap2/hwspinlock.c                   |   12 +-
 arch/arm/mach-omap2/mcbsp.c                        |   11 +-
 arch/arm/mach-omap2/omap_l3_noc.c                  |   25 ++-
 arch/arm/mach-omap2/pm.c                           |   72 ++---
 arch/arm/mach-omap2/serial.c                       |   25 +--
 arch/arm/mach-omap2/sr_device.c                    |   11 +-
 arch/arm/mach-omap2/usb-musb.c                     |   11 +-
 arch/arm/plat-omap/i2c.c                           |   10 +-
 arch/arm/plat-omap/include/plat/omap_device.h      |    1 +
 arch/arm/plat-omap/omap_device.c                   |  313 +++++++++++++++++---
 drivers/of/base.c                                  |   84 ++++++
 include/linux/of.h                                 |   18 ++
 30 files changed, 929 insertions(+), 310 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/omap/dsp.txt
 create mode 100644 Documentation/devicetree/bindings/arm/omap/iva.txt
 create mode 100644 Documentation/devicetree/bindings/arm/omap/l3-noc.txt
 create mode 100644 Documentation/devicetree/bindings/arm/omap/mpu.txt
 create mode 100644 Documentation/devicetree/bindings/arm/omap/omap.txt
 create mode 100644 arch/arm/boot/dts/omap3-beagle.dts
 create mode 100644 arch/arm/boot/dts/omap3.dtsi
 create mode 100644 arch/arm/boot/dts/omap4-panda.dts
 create mode 100644 arch/arm/boot/dts/omap4-sdp.dts
 create mode 100644 arch/arm/boot/dts/omap4.dtsi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: merge.patch
Type: text/x-diff
Size: 2136 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20111004/30d6c319/attachment-0001.bin>

^ permalink raw reply

* [PATCH 4/4] ARM: OMAP: Map SRAM later on with ioremap_exec()
From: Nicolas Pitre @ 2011-10-05  1:07 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004546.26980.31836.stgit@kaulin.local>

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> This allows us to remove omap hacks for map_io.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Nice cleanup.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>


> ---
>  arch/arm/mach-omap2/io.c  |   19 +-----------
>  arch/arm/plat-omap/sram.c |   69 +++++++++++++--------------------------------
>  2 files changed, 22 insertions(+), 66 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
> index 82230e1..8069ca8 100644
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -239,22 +239,11 @@ static struct map_desc omap44xx_io_desc[] __initdata = {
>  };
>  #endif
>  
> -static void __init _omap2_map_common_io(void)
> -{
> -	/* Normally devicemaps_init() would flush caches and tlb after
> -	 * mdesc->map_io(), but we must also do it here because of the CPU
> -	 * revision check below.
> -	 */
> -	local_flush_tlb_all();
> -	flush_cache_all();
> -}
> -
>  #ifdef CONFIG_SOC_OMAP2420
>  void __init omap242x_map_common_io(void)
>  {
>  	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
>  	iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -263,7 +252,6 @@ void __init omap243x_map_common_io(void)
>  {
>  	iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
>  	iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -271,7 +259,6 @@ void __init omap243x_map_common_io(void)
>  void __init omap34xx_map_common_io(void)
>  {
>  	iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -279,7 +266,6 @@ void __init omap34xx_map_common_io(void)
>  void __init omapti816x_map_common_io(void)
>  {
>  	iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -287,7 +273,6 @@ void __init omapti816x_map_common_io(void)
>  void __init omap44xx_map_common_io(void)
>  {
>  	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
> -	_omap2_map_common_io();
>  }
>  #endif
>  
> @@ -336,7 +321,6 @@ void __iomem *omap_irq_base;
>  static void __init omap_common_init_early(void)
>  {
>  	omap2_check_revision();
> -	omap_sram_init();
>  }
>  
>  static void __init omap_hwmod_init_postsetup(void)
> @@ -448,11 +432,12 @@ void __init omap4430_init_early(void)
>  void __init omap_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
>  				      struct omap_sdrc_params *sdrc_cs1)
>  {
> +	omap_sram_init();
> +
>  	if (cpu_is_omap24xx() || omap3_has_sdrc()) {
>  		omap2_sdrc_init(sdrc_cs0, sdrc_cs1);
>  		_omap2_init_reprogram_sdrc();
>  	}
> -
>  }
>  
>  /*
> diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
> index 3c8aa44..8b28664 100644
> --- a/arch/arm/plat-omap/sram.c
> +++ b/arch/arm/plat-omap/sram.c
> @@ -38,16 +38,9 @@
>  #endif
>  
>  #define OMAP1_SRAM_PA		0x20000000
> -#define OMAP1_SRAM_VA		VMALLOC_END
>  #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
> -#define OMAP2_SRAM_VA		0xfe400000
> -#define OMAP2_SRAM_PUB_VA	(OMAP2_SRAM_VA + 0x800)
> -#define OMAP3_SRAM_VA           0xfe400000
>  #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
> -#define OMAP3_SRAM_PUB_VA       (OMAP3_SRAM_VA + 0x8000)
> -#define OMAP4_SRAM_VA		0xfe400000
>  #define OMAP4_SRAM_PUB_PA	(OMAP4_SRAM_PA + 0x4000)
> -#define OMAP4_SRAM_PUB_VA	(OMAP4_SRAM_VA + 0x4000)
>  
>  #if defined(CONFIG_ARCH_OMAP2PLUS)
>  #define SRAM_BOOTLOADER_SZ	0x00
> @@ -70,9 +63,9 @@
>  #define ROUND_DOWN(value,boundary)	((value) & (~((boundary)-1)))
>  
>  static unsigned long omap_sram_start;
> -static unsigned long omap_sram_base;
> +static void __iomem *omap_sram_base;
>  static unsigned long omap_sram_size;
> -static unsigned long omap_sram_ceil;
> +static void __iomem *omap_sram_ceil;
>  
>  /*
>   * Depending on the target RAMFS firewall setup, the public usable amount of
> @@ -112,7 +105,6 @@ static void __init omap_detect_sram(void)
>  	if (cpu_class_is_omap2()) {
>  		if (is_sram_locked()) {
>  			if (cpu_is_omap34xx()) {
> -				omap_sram_base = OMAP3_SRAM_PUB_VA;
>  				omap_sram_start = OMAP3_SRAM_PUB_PA;
>  				if ((omap_type() == OMAP2_DEVICE_TYPE_EMU) ||
>  				    (omap_type() == OMAP2_DEVICE_TYPE_SEC)) {
> @@ -121,25 +113,20 @@ static void __init omap_detect_sram(void)
>  					omap_sram_size = 0x8000; /* 32K */
>  				}
>  			} else if (cpu_is_omap44xx()) {
> -				omap_sram_base = OMAP4_SRAM_PUB_VA;
>  				omap_sram_start = OMAP4_SRAM_PUB_PA;
>  				omap_sram_size = 0xa000; /* 40K */
>  			} else {
> -				omap_sram_base = OMAP2_SRAM_PUB_VA;
>  				omap_sram_start = OMAP2_SRAM_PUB_PA;
>  				omap_sram_size = 0x800; /* 2K */
>  			}
>  		} else {
>  			if (cpu_is_omap34xx()) {
> -				omap_sram_base = OMAP3_SRAM_VA;
>  				omap_sram_start = OMAP3_SRAM_PA;
>  				omap_sram_size = 0x10000; /* 64K */
>  			} else if (cpu_is_omap44xx()) {
> -				omap_sram_base = OMAP4_SRAM_VA;
>  				omap_sram_start = OMAP4_SRAM_PA;
>  				omap_sram_size = 0xe000; /* 56K */
>  			} else {
> -				omap_sram_base = OMAP2_SRAM_VA;
>  				omap_sram_start = OMAP2_SRAM_PA;
>  				if (cpu_is_omap242x())
>  					omap_sram_size = 0xa0000; /* 640K */
> @@ -148,7 +135,6 @@ static void __init omap_detect_sram(void)
>  			}
>  		}
>  	} else {
> -		omap_sram_base = OMAP1_SRAM_VA;
>  		omap_sram_start = OMAP1_SRAM_PA;
>  
>  		if (cpu_is_omap7xx())
> @@ -165,24 +151,14 @@ static void __init omap_detect_sram(void)
>  			omap_sram_size = 0x4000;
>  		}
>  	}
> -
> -	omap_sram_ceil = omap_sram_base + omap_sram_size;
>  }
>  
> -static struct map_desc omap_sram_io_desc[] __initdata = {
> -	{	/* .length gets filled in at runtime */
> -		.virtual	= OMAP1_SRAM_VA,
> -		.pfn		= __phys_to_pfn(OMAP1_SRAM_PA),
> -		.type		= MT_MEMORY
> -	}
> -};
> -
>  /*
>   * Note that we cannot use ioremap for SRAM, as clock init needs SRAM early.
>   */
>  static void __init omap_map_sram(void)
>  {
> -	unsigned long base;
> +	int cached = 1;
>  
>  	if (omap_sram_size == 0)
>  		return;
> @@ -195,28 +171,18 @@ static void __init omap_map_sram(void)
>  		 * the ARM may attempt to write cache lines back to SDRAM
>  		 * which will cause the system to hang.
>  		 */
> -		omap_sram_io_desc[0].type = MT_MEMORY_NONCACHED;
> +		cached = 0;
>  	}
>  
> -	omap_sram_io_desc[0].virtual = omap_sram_base;
> -	base = omap_sram_start;
> -	base = ROUND_DOWN(base, PAGE_SIZE);
> -	omap_sram_io_desc[0].pfn = __phys_to_pfn(base);
> -	omap_sram_io_desc[0].length = ROUND_DOWN(omap_sram_size, PAGE_SIZE);
> -	iotable_init(omap_sram_io_desc, ARRAY_SIZE(omap_sram_io_desc));
> -
> -	pr_info("SRAM: Mapped pa 0x%08llx to va 0x%08lx size: 0x%lx\n",
> -		(long long) __pfn_to_phys(omap_sram_io_desc[0].pfn),
> -		omap_sram_io_desc[0].virtual,
> -		omap_sram_io_desc[0].length);
> +	omap_sram_start = ROUND_DOWN(omap_sram_start, PAGE_SIZE);
> +	omap_sram_base = __arm_ioremap_exec(omap_sram_start, omap_sram_size,
> +						cached);
> +	if (!omap_sram_base) {
> +		pr_err("SRAM: Could not map\n");
> +		return;
> +	}
>  
> -	/*
> -	 * Normally devicemaps_init() would flush caches and tlb after
> -	 * mdesc->map_io(), but since we're called from map_io(), we
> -	 * must do it here.
> -	 */
> -	local_flush_tlb_all();
> -	flush_cache_all();
> +	omap_sram_ceil = omap_sram_base + omap_sram_size;
>  
>  	/*
>  	 * Looks like we need to preserve some bootloader code at the
> @@ -235,13 +201,18 @@ static void __init omap_map_sram(void)
>   */
>  void *omap_sram_push_address(unsigned long size)
>  {
> -	if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
> +	unsigned long available, new_ceil = (unsigned long)omap_sram_ceil;
> +
> +	available = omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ);
> +
> +	if (size > available) {
>  		pr_err("Not enough space in SRAM\n");
>  		return NULL;
>  	}
>  
> -	omap_sram_ceil -= size;
> -	omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
> +	new_ceil -= size;
> +	new_ceil = ROUND_DOWN(new_ceil, FNCPY_ALIGN);
> +	omap_sram_ceil = IOMEM(new_ceil);
>  
>  	return (void *)omap_sram_ceil;
>  }
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply

* [PATCH] virtio: Add platform bus driver for memory mapped virtio device
From: Rusty Russell @ 2011-10-05  1:10 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1317745002.3158.340.camel@hornet.cambridge.arm.com>

On Tue, 04 Oct 2011 17:16:42 +0100, Pawel Moll <pawel.moll@arm.com> wrote:
> Greetings!
> 
> > > +/* The alignment to use between consumer and producer parts of vring.
> > > + * Currently hardcoded to page size. */
> > > +#define VIRTIO_MMIO_VRING_ALIGN		PAGE_SIZE
> > 
> > Really?  Shouldn't that just be 4k?  I haven't seen the qemu side of
> > this, but it seems weird to depend on the kernel's idea of page size...
> 
> Well, the Host doesn't really care now, as it's told what the alignment
> is:
> 
> > +       /* Activate the queue */
> > +       writel(VIRTIO_MMIO_VRING_ALIGN,
> > +                       vm_dev->base + VIRTIO_MMIO_QUEUE_ALIGN);
> > +       writel(virt_to_phys(info->queue) >> PAGE_SHIFT,
> > +                       vm_dev->base + VIRTIO_MMIO_QUEUE_PFN);
> 
> And I've just chosen the PAGE_SIZE instead of 4096 following the
> suggestion from your original paper ("Note that there is padding such as
> to place this structure on a page separate from the available ring and
> descriptor array:").

Sorry, I missed that.  OK!

> > Note that the seabios/coreboot hackers wanted a smaller ring alignment
> > so they didn't have to waste two precious pages per device.  You might
> > want to consider making this an option in the header (perhaps express
> > it as log2, eg. 12 rather than 4096).
> 
> I had an impression that you were planning to add some API for the
> devices to choose the alignment? If so this #define would simply
> disappear... Generally, the Client is in control now.

I'm not sure it makes sense to vary per-device, but per-OS perhaps.

> > > +	/* TODO: Write requested queue size to VIRTIO_MMIO_QUEUE_NUM */
> > > +
> > > +	/* Check if queue is either not available or already active. */
> > > +	num = readl(vm_dev->base + VIRTIO_MMIO_QUEUE_NUM);
> > > +	if (!num || readl(vm_dev->base + VIRTIO_MMIO_QUEUE_PFN)) {
> > 
> > Please fix this now, like so:
> > 
> >         /* Queue shouldn't already be set up. */        
> >         if (readl(vm_dev->base + VIRTIO_MMIO_QUEUE_PFN))
> >                 ...
> > 
> >         /* Try for a big queue, drop down to a two-page queue. */
> >         num = VIRTIO_MMIO_MAX_RING;
> 
> Ok, but how much would MAX_RING be? 1024? 513? 127? I really wouldn't
> like to be a judge here... I was hoping the device would tell me that
> (it knows what amounts of data are likely to be processed?)

I'm not sure who knows better, device or driver.  The device can suggest
a value, but you should always write it, otherwise that code will never
get tested until it's too late...

> >         for (;;) {
> >                 size = PAGE_ALIGN(vring_size(num, VIRTIO_MMIO_VRING_ALIGN));
> >                 info->queue = alloc_pages_exact(size, GFP_KERNEL | __GFP_ZERO);
> >                 if (info->queue)
> >                         break;
> > 
> >                 /* Already smallest possible allocation? */
> >                 if (size == VIRTIO_MMIO_VRING_ALIGN*2) {
> >                         err = -ENOMEM;
> >                         goto error_kmalloc;
> >                 }
> >                 num /= 2;
> >         }
> and then
> 	writel(num, vm_dev->base + VIRTIO_MMIO_QUEUE_NUM);
> 
> Can do. This, however, gets us back to this question: can the Host
> cowardly refuse the requested queue size? If you really think that it
> can't, I'm happy to accept that and change the spec accordingly. If it
> can, we'll have to read the size back and potentially re-alloc pages...

I'm not sure.  Perhaps the device gives the maximum it will accept, and
the driver should start from that or 1025, whatever is less (that's
still 28k for each ring).  That gives us flexibility.

The absolute maximum is a ring of 32k elements, which is about 850k.
That seems a little excessive, though.

Cheers,
Rusty.

^ permalink raw reply

* [PATCH V2 2/2] ARM: SAMSUNG: Cleanup resources by using macro
From: Kukjin Kim @ 2011-10-05  1:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <CAH9JG2UR+QY=Ni7BTThgUBf2iBUKX9cdkbq_XRia4aQXDwEeSg@mail.gmail.com>

Kyungmin Park wrote:
> 
> On Wed, Oct 5, 2011 at 12:26 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Tuesday 04 October 2011, Kukjin Kim wrote:
> >> > I think the string concatenation really just obfuscates the code, and
> >> > it does not actually save much at all. When you replace
> >> >
> >> > + ? ? ? [0] = SAMSUNG_RES_MEM(S3C, WDT, SZ_1K),
> >> > + ? ? ? [1] = SAMSUNG_RES_IRQ(WDT),
> >> >
> >> > with
> >> >
> >> > + ? ? ? [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
> >> > + ? ? ? [1] = DEFINE_RES_IRQ(IRQ_WDT),
> >> >
> >> > you need practically no extra space, but you gain the advantages that
> >> >
> >> > * Someone using grep for DEFINE_RES_MEM finds all memory resources
> without
> >> > ? having to look up what your macros do an where they are used.
> >> > * Someone using grep to look for S3C_PA_WDT finds the place where it
is
> >> used.
> >> > * Someone reading the resource definition immediately knows what the
> >> > ? macro does if familiar with other platforms using that macro.
> >>
> >> Yes, right. But I'm preparing to reduce the 'soc' part to consolidate
some
> >> duplicated resources and platform data after this and the new
SAMSUNG_RES
> >> macro will be used.
> There are tools for source browsing e.g., ctags, cscope, grep, git
> grep and so on.
> If you create new SAMSUNG_RES, these tools can't find macro and
> symbols properly.
> 
> Please use the existing macros for own purpose.
> 
OK, it makes sense to me.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> Thank you,
> Kyungmin Park
> >
> > Hmm, can't you instead change the names of these constants to be
> > always the same? That would let you use the regular DEFINE_RES_*
> > definitions without having to introduce your own.

^ permalink raw reply

* [PATCH V2 2/2] ARM: SAMSUNG: Cleanup resources by using macro
From: Kukjin Kim @ 2011-10-05  1:17 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <201110041726.03056.arnd@arndb.de>

Arnd Bergmann wrote:
> 
> On Tuesday 04 October 2011, Kukjin Kim wrote:
> > > I think the string concatenation really just obfuscates the code, and
> > > it does not actually save much at all. When you replace
> > >
> > > +       [0] = SAMSUNG_RES_MEM(S3C, WDT, SZ_1K),
> > > +       [1] = SAMSUNG_RES_IRQ(WDT),
> > >
> > > with
> > >
> > > +       [0] = DEFINE_RES_MEM(S3C_PA_WDT, SZ_1K),
> > > +       [1] = DEFINE_RES_IRQ(IRQ_WDT),
> > >
> > > you need practically no extra space, but you gain the advantages that
> > >
> > > * Someone using grep for DEFINE_RES_MEM finds all memory resources
> without
> > >   having to look up what your macros do an where they are used.
> > > * Someone using grep to look for S3C_PA_WDT finds the place where it
is
> > used.
> > > * Someone reading the resource definition immediately knows what the
> > >   macro does if familiar with other platforms using that macro.
> >
> > Yes, right. But I'm preparing to reduce the 'soc' part to consolidate
some
> > duplicated resources and platform data after this and the new
SAMSUNG_RES
> > macro will be used.
> 
> Hmm, can't you instead change the names of these constants to be
> always the same? That would let you use the regular DEFINE_RES_*
> definitions without having to introduce your own.
> 
OK, I agree with you. And if introducing Samsung own is required, will do it
later.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply

* [PATCH v4 06/10] ARM: SoC: convert Exynos4 to SoC descriptor
From: Kukjin Kim @ 2011-10-05  1:22 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <4E8B0E98.30306@arm.com>

Marc Zyngier wrote:
> 
> On 04/10/11 14:16, Kukjin Kim wrote:
> > Marc Zyngier wrote:
> >>
> >> Convert Exynos4 to use the SoC descriptor to provide its SMP
> >> and CPU hotplug operations.
> >>
> >> Cc: Kukjin Kim <kgene.kim@samsung.com>
> >> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> >> ---
> >>  arch/arm/mach-exynos4/core.h                |    9 +++++++++
> >>  arch/arm/mach-exynos4/cpu.c                 |    8 ++++++++
> >>  arch/arm/mach-exynos4/hotplug.c             |    8 +++++---
> >>  arch/arm/mach-exynos4/mach-armlex4210.c     |    3 +++
> >>  arch/arm/mach-exynos4/mach-nuri.c           |    3 +++
> >>  arch/arm/mach-exynos4/mach-origen.c         |    3 +++
> >>  arch/arm/mach-exynos4/mach-smdk4212.c       |    3 +++
> >>  arch/arm/mach-exynos4/mach-smdkv310.c       |    4 ++++
> >>  arch/arm/mach-exynos4/mach-universal_c210.c |    3 +++
> >>  arch/arm/mach-exynos4/platsmp.c             |   25
> >> +++++++++++++++++++++----
> >>  10 files changed, 62 insertions(+), 7 deletions(-)
> >>  create mode 100644 arch/arm/mach-exynos4/core.h
> >>
> >> diff --git a/arch/arm/mach-exynos4/core.h
b/arch/arm/mach-exynos4/core.h
> >> new file mode 100644
> >> index 0000000..ba9fcc8
> >> --- /dev/null
> >> +++ b/arch/arm/mach-exynos4/core.h
> >
> > Is there any reason to add core.h in mach-exynos4 not
> > mach-exynos4/include/mach?
> 
> No particular reason. If you prefer having that file in include/mach,
> I'll move it, though I don't think it makes much more sense.
> 
I was just wondering, and I'd like to keep same format with other platforms.

> >> +
> >> +struct arm_soc_desc exynos4_soc_desc __initdata = {
> >> +	.name		= "Samsung Exynos4",
> >
> > If you're ok, I preferred 'Samsung EXYNOS4'
> 
> No problem.
> 
Thanks.

> > And could you please re-work this based on latest my for-next because
there
> > are updated board file.
> 
> Where is your for-next branch located these days? When it gets picked up
> by linux-next, I'll update the board files. As of next-20111004, I seem
> to cover them all.
> 
Now it is 'git://github.com/kgene/linux-samsung.git' and it will be moved
'git.kernel.org' soon. And as you said since linux-next is maybe having all
-next trees, if you pick it up it is ok to me too :)

If this series get the acks from regarding maintainers, is it possible to
send this EXYNOS stuff via Samsung tree to avoid conflicts? And you know it
can be tested with others by linux-next even though separate merging.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply

* [PATCH 11/11] ARM: common/vic: use proper __iomem annotations
From: H Hartley Sweeten @ 2011-10-05  1:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1317496920-7764-12-git-send-email-arnd@arndb.de>

On Saturday, October 01, 2011 12:22 PM, Arnd Bergmann wrote:
> 
> In vic_init, we pass addr into readl, so it needs to be a
> pointer, not a u32 address.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/common/vic.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
> index 7aa4262..adccf6d 100644
> --- a/arch/arm/common/vic.c
> +++ b/arch/arm/common/vic.c
> @@ -347,7 +347,8 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
>  
>  	/* Identify which VIC cell this one is, by reading the ID */
>  	for (i = 0; i < 4; i++) {
> -		u32 addr = ((u32)base & PAGE_MASK) + 0xfe0 + (i * 4);
> +		void __iomem *addr;
> +		addr = (void __iomem *)((u32)base & PAGE_MASK) + 0xfe0 + (i * 4);
>  		cellid |= (readl(addr) & 0xff) << (8 * i);
>  	}
>  	vendor = (cellid >> 12) & 0xff;

Arnd,

This has already been fixed by Patch 7028/2 in Russell's patch tracking system.

Regards,
Hartley

^ permalink raw reply

* Please help with the OMAP static mapping mess
From: Tony Lindgren @ 2011-10-05  1:35 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.02.1110042048320.9106@xanadu.home>

* Nicolas Pitre <nico@fluxnic.net> [111004 17:23]:
> On Tue, 4 Oct 2011, Tony Lindgren wrote:
> 
> > In any case, I suggest we add the following __arm_ioremap_exec patch
> > and then sort out issues with it as they show up.
> > 
> > This allows further work on the common SRAM genalloc patches and generic
> > map_io patches.
> > 
> > Nico, I already have a series converting omap2+ to use the the patch
> > below, and it seems to be working just fine for SRAM. I'll post that
> > series separately shortly. Maybe take a look and see if that allows
> > you to do the generic map_io changes?
> 
> Yes, that looks fine.  Maybe you could avoid exporting the symbol until 
> it is actually needed though.

OK good, will drop the export.
 
> The other thing I need is for the code using ioremap() such as in 
> omap2_set_globals_control() to be called only after the corresponding 
> static mappings are already installed.  Then everything should go 
> smoothly.

Ah, set_globals inits can now move to init_early as well. That happens
after map_io so sounds like that should do for what you need.

Will reply with a patch for that to the series. BTW, these patches
depends on the various cleanup related branches that we have queued,
I think there may be few more patches missing from Arnd's tree still.
I also need to do a bit more testing on it tomorrow.

Regards,

Tony

^ permalink raw reply

* [PATCH 1/4] ARM: EXYNOS4: Support for generic I/O power domains on EXYNOS4210
From: Chanwoo Choi @ 2011-10-05  1:38 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <4E887B92.5090805@gmail.com>

Sylwester Nawrocki wrote:
> Hi Chanwoo,
> 
> a few minor comments below...
>  
> On 08/11/2011 06:55 AM, Chanwoo Choi wrote:
>> Use the generic power domains support to implement support for
>> power domain on EXYNOS4210.
>>
>> I refer to the following patch to implement what configure
>> the clock-gating control register for block to turn off/on:
>> http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/39a81876d034dcbdc2a4c4c4b847b3b49e38870c
>>
>> Signed-off-by: Chanwoo Choi<cw00.choi@samsung.com>
>> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
>> ---
>>   arch/arm/mach-exynos4/Kconfig                      |    1 +
>>   arch/arm/mach-exynos4/Makefile                     |    1 +
>>   arch/arm/mach-exynos4/include/mach/pm-exynos4210.h |   52 ++++++
>>   arch/arm/mach-exynos4/include/mach/regs-clock.h    |    8 +
>>   arch/arm/mach-exynos4/pm-exynos4210.c              |  189 ++++++++++++++++++++
>>   5 files changed, 251 insertions(+), 0 deletions(-)
>>   create mode 100644 arch/arm/mach-exynos4/include/mach/pm-exynos4210.h
>>   create mode 100644 arch/arm/mach-exynos4/pm-exynos4210.c
>>
>> diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
>> index 64baca7..8d5e876 100644
>> --- a/arch/arm/mach-exynos4/Kconfig
>> +++ b/arch/arm/mach-exynos4/Kconfig
>> @@ -12,6 +12,7 @@ if ARCH_EXYNOS4
>>   config CPU_EXYNOS4210
>>   	bool
>>   	select S3C_PL330_DMA
>> +	select PM_GENERIC_DOMAINS if PM
>>   	help
>>   	  Enable EXYNOS4210 CPU support
>>
>> diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile
>> index b7fe1d7..97c31ce 100644
>> --- a/arch/arm/mach-exynos4/Makefile
>> +++ b/arch/arm/mach-exynos4/Makefile
>> @@ -16,6 +16,7 @@ obj-$(CONFIG_CPU_EXYNOS4210)	+= cpu.o init.o clock.o irq-combiner.o
>>   obj-$(CONFIG_CPU_EXYNOS4210)	+= setup-i2c0.o irq-eint.o dma.o pmu.o
>>   obj-$(CONFIG_PM)		+= pm.o sleep.o
>>   obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
>> +obj-$(CONFIG_CPU_EXYNOS4210)	+= pm-exynos4210.o
>>
>>   obj-$(CONFIG_SMP)		+= platsmp.o headsmp.o
>>
>> diff --git a/arch/arm/mach-exynos4/include/mach/pm-exynos4210.h b/arch/arm/mach-exynos4/include/mach/pm-exynos4210.h
>> new file mode 100644
>> index 0000000..e36425a
>> --- /dev/null
>> +++ b/arch/arm/mach-exynos4/include/mach/pm-exynos4210.h
>> @@ -0,0 +1,52 @@
>> +/* linux/arch/arm/mach-exynos4/include/mach/pm-exynos4210.h
>> + *
>> + * Exynos4210 Power management support
>> + *
>> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>> + *		http://www.samsung.com
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#ifndef PM_EXYNOS4210_H
>> +#define PM_EXYNOS4210_H
>> +
>> +#include<linux/pm_domain.h>
>> +
>> +struct platform_device;
>> +
>> +struct exynos4210_pm_domain {
> 
> I wonder whether it isn't worth to start with 'struct exynos_pm_domain' as we're
> consolidating the code for various exynos variants.
> 
OK, I will modify it for supporting various exynos series.

>> +	struct generic_pm_domain genpd;
>> +
>> +	const char *name;
>> +	void __iomem *base;
>> +	u32 clkgate_mask;
>> +	int boot_on;
>> +};
>> +
>> +static inline struct exynos4210_pm_domain *to_exynos4210_pd(
>> +		struct generic_pm_domain *pd)
>> +{
>> +	return container_of(pd, struct exynos4210_pm_domain, genpd);
>> +}
>> +
>> +#ifdef CONFIG_PM
>> +extern struct exynos4210_pm_domain exynos4210_pd_mfc;
>> +extern struct exynos4210_pm_domain exynos4210_pd_g3d;
>> +extern struct exynos4210_pm_domain exynos4210_pd_lcd0;
>> +extern struct exynos4210_pm_domain exynos4210_pd_lcd1;
>> +extern struct exynos4210_pm_domain exynos4210_pd_tv;
>> +extern struct exynos4210_pm_domain exynos4210_pd_cam;
>> +extern struct exynos4210_pm_domain exynos4210_pd_gps;
>> +
>> +extern void exynos4210_init_pm_domain(struct exynos4210_pm_domain *exynos4210_pd);
> 
> exynos_pd_init() ?
OK, I will modity it.
> 
>> +extern void exynos4210_add_device_to_domain(struct exynos4210_pm_domain *exynos4210_pd,
> 
> exynos_pd_add_device() ?
OK, I will modity it.
> 
>> +				struct platform_device *pdev);
>> +#else
>> +#define exynos4210_init_pm_domain(pd) do { } while(0)
>> +#define exynos4210_add_device_to_domain(pd, pdev) do { } while(0)
>> +#endif /* CONFIG_PM */
>> +
>> +#endif /* PM_EXYNOS4210_H */
>> diff --git a/arch/arm/mach-exynos4/include/mach/regs-clock.h b/arch/arm/mach-exynos4/include/mach/regs-clock.h
>> index d493fdb..0d1c9ec 100644
>> --- a/arch/arm/mach-exynos4/include/mach/regs-clock.h
>> +++ b/arch/arm/mach-exynos4/include/mach/regs-clock.h
>> @@ -183,6 +183,14 @@
>>   #define S5P_CLKDIV_BUS_GPLR_SHIFT	(4)
> 
> nit: don't need braces
Ok, I will remove braces.
> 
>>   #define S5P_CLKDIV_BUS_GPLR_MASK	(0x7<<  S5P_CLKDIV_BUS_GPLR_SHIFT)
>>
>> +#define S5P_CLKGATE_BLOCK_CAM		(1<<  0)
>> +#define S5P_CLKGATE_BLOCK_TV		(1<<  1)
>> +#define S5P_CLKGATE_BLOCK_MFC		(1<<  2)
>> +#define S5P_CLKGATE_BLOCK_G3D		(1<<  3)
>> +#define S5P_CLKGATE_BLOCK_LCD0		(1<<  4)
>> +#define S5P_CLKGATE_BLOCK_LCD1		(1<<  5)
>> +#define S5P_CLKGATE_BLOCK_GPS		(1<<  7)
>> +
>>   /* Compatibility defines and inclusion */
>>
>>   #include<mach/regs-pmu.h>
>> diff --git a/arch/arm/mach-exynos4/pm-exynos4210.c b/arch/arm/mach-exynos4/pm-exynos4210.c
>> new file mode 100644
>> index 0000000..d43c37f
>> --- /dev/null
>> +++ b/arch/arm/mach-exynos4/pm-exynos4210.c
>> @@ -0,0 +1,189 @@
>> +/* linux/arch/arm/mach-exynos4/pm-exynos4210.c
>> + *
>> + * Exynos4210 Power management support
>> + *
>> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>> + *		http://www.samsung.com
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include<linux/pm.h>
>> +#include<linux/module.h>
>> +#include<linux/delay.h>
>> +#include<linux/err.h>
>> +#include<linux/slab.h>
>> +#include<linux/pm_runtime.h>
>> +#include<linux/platform_device.h>
>> +#include<linux/pm_domain.h>
>> +#include<linux/io.h>
>> +
>> +#include<mach/regs-clock.h>
>> +#include<mach/pm-exynos4210.h>
>> +
>> +#ifdef CONFIG_PM
>> +static DEFINE_SPINLOCK(clkgate_block_lock);
>> +
>> +static int pd_power_down(struct generic_pm_domain *genpd)
> 
> __exynos_pd_power_down() ?
OK, I will modity it.
> 
>> +{
>> +	struct exynos4210_pm_domain *exynos4210_pd = to_exynos4210_pd(genpd);
>> +	u32 timeout;
>> +
>> +	/* Disable the power of power-domain */
>> +	__raw_writel(0, exynos4210_pd->base);
>> +
>> +	/* Wait max 1ms */
>> +	timeout = 10;
>> +	while (__raw_readl(exynos4210_pd->base + 0x4)&  S5P_INT_LOCAL_PWR_EN) {
>> +		if (timeout == 0) {
>> +			printk(KERN_ERR "Power domain %s disable failed.\n",
>> +				exynos4210_pd->name);
>> +			return -ETIMEDOUT;
>> +		}
>> +		timeout--;
>> +		udelay(100);
>> +	}
>> +
>> +	/* Configure the clock-gating control register for block to turn off */
>> +	if (exynos4210_pd->clkgate_mask) {
>> +		unsigned long flags;
>> +		u32 reg;
>> +
>> +		spin_lock_irqsave(&clkgate_block_lock, flags);
>> +		reg = __raw_readl(S5P_CLKGATE_BLOCK);
>> +		reg&= ~exynos4210_pd->clkgate_mask;
>> +		__raw_writel(reg, S5P_CLKGATE_BLOCK);
>> +		spin_unlock_irqrestore(&clkgate_block_lock, flags);
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int pd_power_up(struct generic_pm_domain *genpd)
> 
> __exynos_pd_power_up() ?
OK, I will modity it.
> 
>> +{
>> +	struct exynos4210_pm_domain *exynos4210_pd = to_exynos4210_pd(genpd);
>> +	u32 timeout;
>> +
>> +	/* Enable power domain */
>> +	__raw_writel(S5P_INT_LOCAL_PWR_EN, exynos4210_pd->base);
>> +
>> +	/* Wait max 1ms */
>> +	timeout = 10;
>> +	while ((__raw_readl(exynos4210_pd->base + 0x4)&  S5P_INT_LOCAL_PWR_EN)
>> +		!= S5P_INT_LOCAL_PWR_EN) {
>> +		if (timeout == 0) {
>> +			printk(KERN_ERR "Power domain %s enable failed.\n",
>> +				exynos4210_pd->name);
>> +			return -ETIMEDOUT;
>> +		}
>> +		timeout--;
>> +		udelay(100);
>> +	}
>> +
>> +	/* Configure the clock-gating control register for block to turn on */
>> +	if (exynos4210_pd->clkgate_mask) {
>> +		unsigned long flags;
>> +		u32 reg;
>> +
>> +		spin_lock_irqsave(&clkgate_block_lock, flags);
>> +		reg = __raw_readl(S5P_CLKGATE_BLOCK);
>> +		reg |= exynos4210_pd->clkgate_mask;
>> +		__raw_writel(reg, S5P_CLKGATE_BLOCK);
>> +		spin_unlock_irqrestore(&clkgate_block_lock, flags);
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static bool pd_active_wakeup(struct device *dev)
> 
> __exynos_pd_active_wakeup() ?
OK, I will modity it.
> 
>> +{
>> +	return true;
>> +}
>> +
>> +void exynos4210_init_pm_domain(struct exynos4210_pm_domain *exynos4210_pd)
>> +{
>> +	struct generic_pm_domain *genpd;
>> +
>> +	if (!exynos4210_pd)
>> +		return;
>> +
>> +	genpd =&exynos4210_pd->genpd;
>> +
>> +	pm_genpd_init(genpd, NULL, false);
>> +	genpd->stop_device = pm_clk_suspend;
>> +	genpd->start_device = pm_clk_resume;
> 
> Perhaps each driver has to be inspected before we can do this.
> I guess it's better to leave these 2 ops uninitialized for now.
> 
OK, I will respect for your comment.

>> +	genpd->active_wakeup = pd_active_wakeup;
>> +	genpd->power_off = pd_power_down;
>> +	genpd->power_on = pd_power_up;
>> +
>> +	if (exynos4210_pd->boot_on)
>> +		pd_power_up(&exynos4210_pd->genpd);
>> +}
>> +
>> +void exynos4210_add_device_to_domain(struct exynos4210_pm_domain *exynos4210_pd,
>> +				struct platform_device *pdev)
>> +{
>> +	struct device *dev =&pdev->dev;
>> +
>> +	if (!exynos4210_pd || !pdev)
>> +		return;
>> +
>> +	if (!dev->power.subsys_data) {
>> +		pm_clk_init(dev);
>> +		pm_clk_add(dev, NULL);
> 
> Same here, this won't work for many devices, some have multiple clocks associated
> with them and non null con_id. It might be needed to separate the clocks addition 
> and to handle individually for each device.
OK. I will respect for your comment. 
Thank you for your comment.

Regards,
Chanwoo Choi

^ permalink raw reply

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
From: Tony Lindgren @ 2011-10-05  1:40 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005004339.26980.31149.stgit@kaulin.local>

Otherwise we can't do generic map_io as we currently rely on
static mappings that work only because of arch_ioremap.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index e26c79c..e6ee884 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
 
 static void __init ti8168_evm_map_io(void)
 {
-	omap2_set_globals_ti816x();
 	omapti816x_map_common_io();
 }
 
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index de61f15..f19a332 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
 
 void __init omap242x_map_io(void)
 {
-	omap2_set_globals_242x();
 	omap242x_map_common_io();
 }
 #endif
@@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
 
 void __init omap243x_map_io(void)
 {
-	omap2_set_globals_243x();
 	omap243x_map_common_io();
 }
 #endif
@@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
 
 void __init omap3_map_io(void)
 {
-	omap2_set_globals_3xxx();
 	omap34xx_map_common_io();
 }
 
@@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
 
 void __init omap4_map_io(void)
 {
-	omap2_set_globals_443x();
 	omap44xx_map_common_io();
 }
 #endif
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4957554..527abdd 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -44,6 +44,7 @@
 #include "clockdomain.h"
 #include <plat/omap_hwmod.h>
 #include <plat/multi.h>
+#include <plat/common.h>
 
 /*
  * The machine specific code may provide the extra mapping besides the
@@ -363,6 +364,7 @@ static void __init omap_hwmod_init_postsetup(void)
 
 void __init omap2420_init_early(void)
 {
+	omap2_set_globals_242x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap242x_powerdomains_init();
@@ -374,6 +376,7 @@ void __init omap2420_init_early(void)
 
 void __init omap2430_init_early(void)
 {
+	omap2_set_globals_243x();
 	omap_common_init_early();
 	omap2xxx_voltagedomains_init();
 	omap243x_powerdomains_init();
@@ -389,6 +392,7 @@ void __init omap2430_init_early(void)
  */
 void __init omap3_init_early(void)
 {
+	omap2_set_globals_3xxx();
 	omap_common_init_early();
 	omap3xxx_voltagedomains_init();
 	omap3xxx_powerdomains_init();
@@ -420,11 +424,19 @@ void __init am35xx_init_early(void)
 
 void __init ti816x_init_early(void)
 {
-	omap3_init_early();
+	omap2_set_globals_ti816x();
+	omap_common_init_early();
+	omap3xxx_voltagedomains_init();
+	omap3xxx_powerdomains_init();
+	omap3xxx_clockdomains_init();
+	omap3xxx_hwmod_init();
+	omap_hwmod_init_postsetup();
+	omap3xxx_clk_init();
 }
 
 void __init omap4430_init_early(void)
 {
+	omap2_set_globals_443x();
 	omap_common_init_early();
 	omap44xx_voltagedomains_init();
 	omap44xx_powerdomains_init();

^ permalink raw reply related

* [PATCH v2 4/7] clk: Add simple gated clock
From: Saravana Kannan @ 2011-10-05  1:41 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <4E810AFA.9040004@gmail.com>

On 09/26/2011 04:30 PM, Rob Herring wrote:
> On 09/26/2011 05:37 PM, Turquette, Mike wrote:
>> On Mon, Sep 26, 2011 at 12:37 PM, Jamie Iles<jamie@jamieiles.com>  wrote:
>>> On Mon, Sep 26, 2011 at 02:10:32PM -0500, Rob Herring wrote:
>>>> On 09/26/2011 01:40 PM, Jamie Iles wrote:
>>>>> On Mon, Sep 26, 2011 at 01:33:08PM -0500, Rob Herring wrote:
>>>>>>> +static void clk_gate_set_bit(struct clk_hw *clk)
>>>>>>> +{
>>>>>>> + struct clk_gate *gate = to_clk_gate(clk);
>>>>>>> + u32 reg;
>>>>>>> +
>>>>>>> + reg = __raw_readl(gate->reg);
>>>>>>> + reg |= BIT(gate->bit_idx);
>>>>>>> + __raw_writel(reg, gate->reg);
>>>>>>
>>>>>> Don't these read-mod-writes need a spinlock around it?
>>>>>>
>>>>>> It's possible to have an enable bits and dividers in the same register.
>>>>>> If you did a set_rate and while doing an enable/disable, there would be
>>>>>> a problem. Also, it may be 2 different clocks in the same register, so
>>>>>> the spinlock needs to be shared and not per clock.
>>>>>
>>>>> Well the prepare lock will be held here and I believe that would be
>>>>> sufficient.
>>>>
>>>> No, the enable spinlock is protecting enable/disable. But set_rate is
>>>> protected by the prepare mutex. So you clearly don't need locking if you
>>>> have a register of only 1 bit enables. If you have a register accessed
>>>> by both enable/disable and prepare/unprepare/set_rate, then you need
>>>> some protection.
>>>
>>> OK fair point, but I would guess that if you had a clock like this then
>>> you probably wouldn't use this simple gated clock would you?  (speaking
>>> from my world where we have quite simple clocks ;-))
>>
>> I think it is a safe assumption that if a register controls both
>> enable/disable and some programmable divider then,
>>
>> 1) those controls are probably for the same clock
>> 2) that clock won't be using the cookie-cutter gated-clock
>> implementation anyways
>
> By definition of simple gated clock, the other bits have to be for
> another clock. The restriction is that all the other bits can only be
> clock gate bits.
>
>>
>> Rob, do you feel these assumptions are OK and locking can remain the
>> same in this patch?
>
> Perhaps it is rare enough that it is not worth it use generic code in
> this case. If so, the documentation should be clear about this
> constraint. It is not something anyone will have hit before because
> everyone used a single global lock. Now with the api being split between
> 2 locks, this adds a new complexity.

I kinda agree with Rob on this. There are very few, if any, such simple 
clocks on MSM chips. It's very easy to a SoC clock developer to 
accidentally use these simple clocks without realizing the point that 
Rob brings up.

> I think the simple gated clock code should be usable for any clock
> controlled by a single bit in a 32-bit register independent of other
> things in that register.

To take care of the scenario Rob bring up, the prepare/unprepare and 
enable/disable code will have to grab a per-tree register-lock before 
accessing any registers. The prepare/unprepare code should obviously be 
written to hold this register-lock for as small of a duration as 
possible. For example, if the prepare code is doing voltage increase, 
the register-lock should be grabber _after_ the voltage is increased. At 
least, this is approximately how the MSM clock code can be mapped onto 
this generic framework.

I think we should just go ahead and implement the per-tree register lock 
so that the generic clock implementations are more useful. The lock will 
really be held only for a very short time and hence shouldn't matter 
that there is a single lock for all the clocks in a tree.

Thomas,

Did you get a chance to send out your patches with support for per-tree 
locking? I would really like to see that as part of the first patch 
series that gets pulled in.

Thanks,
Saravana

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply

* [PATCH 5/4] ARM: OMAP: Move set_globals initialization to happen in init_early
From: Nicolas Pitre @ 2011-10-05  1:51 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111005014044.GZ6324@atomide.com>

On Tue, 4 Oct 2011, Tony Lindgren wrote:

> Otherwise we can't do generic map_io as we currently rely on
> static mappings that work only because of arch_ioremap.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>

That's great.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

> diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
> index e26c79c..e6ee884 100644
> --- a/arch/arm/mach-omap2/board-ti8168evm.c
> +++ b/arch/arm/mach-omap2/board-ti8168evm.c
> @@ -37,7 +37,6 @@ static void __init ti8168_evm_init(void)
>  
>  static void __init ti8168_evm_map_io(void)
>  {
> -	omap2_set_globals_ti816x();
>  	omapti816x_map_common_io();
>  }
>  
> diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
> index de61f15..f19a332 100644
> --- a/arch/arm/mach-omap2/common.c
> +++ b/arch/arm/mach-omap2/common.c
> @@ -59,7 +59,6 @@ void __init omap2_set_globals_242x(void)
>  
>  void __init omap242x_map_io(void)
>  {
> -	omap2_set_globals_242x();
>  	omap242x_map_common_io();
>  }
>  #endif
> @@ -83,7 +82,6 @@ void __init omap2_set_globals_243x(void)
>  
>  void __init omap243x_map_io(void)
>  {
> -	omap2_set_globals_243x();
>  	omap243x_map_common_io();
>  }
>  #endif
> @@ -107,7 +105,6 @@ void __init omap2_set_globals_3xxx(void)
>  
>  void __init omap3_map_io(void)
>  {
> -	omap2_set_globals_3xxx();
>  	omap34xx_map_common_io();
>  }
>  
> @@ -153,7 +150,6 @@ void __init omap2_set_globals_443x(void)
>  
>  void __init omap4_map_io(void)
>  {
> -	omap2_set_globals_443x();
>  	omap44xx_map_common_io();
>  }
>  #endif
> diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
> index 4957554..527abdd 100644
> --- a/arch/arm/mach-omap2/io.c
> +++ b/arch/arm/mach-omap2/io.c
> @@ -44,6 +44,7 @@
>  #include "clockdomain.h"
>  #include <plat/omap_hwmod.h>
>  #include <plat/multi.h>
> +#include <plat/common.h>
>  
>  /*
>   * The machine specific code may provide the extra mapping besides the
> @@ -363,6 +364,7 @@ static void __init omap_hwmod_init_postsetup(void)
>  
>  void __init omap2420_init_early(void)
>  {
> +	omap2_set_globals_242x();
>  	omap_common_init_early();
>  	omap2xxx_voltagedomains_init();
>  	omap242x_powerdomains_init();
> @@ -374,6 +376,7 @@ void __init omap2420_init_early(void)
>  
>  void __init omap2430_init_early(void)
>  {
> +	omap2_set_globals_243x();
>  	omap_common_init_early();
>  	omap2xxx_voltagedomains_init();
>  	omap243x_powerdomains_init();
> @@ -389,6 +392,7 @@ void __init omap2430_init_early(void)
>   */
>  void __init omap3_init_early(void)
>  {
> +	omap2_set_globals_3xxx();
>  	omap_common_init_early();
>  	omap3xxx_voltagedomains_init();
>  	omap3xxx_powerdomains_init();
> @@ -420,11 +424,19 @@ void __init am35xx_init_early(void)
>  
>  void __init ti816x_init_early(void)
>  {
> -	omap3_init_early();
> +	omap2_set_globals_ti816x();
> +	omap_common_init_early();
> +	omap3xxx_voltagedomains_init();
> +	omap3xxx_powerdomains_init();
> +	omap3xxx_clockdomains_init();
> +	omap3xxx_hwmod_init();
> +	omap_hwmod_init_postsetup();
> +	omap3xxx_clk_init();
>  }
>  
>  void __init omap4430_init_early(void)
>  {
> +	omap2_set_globals_443x();
>  	omap_common_init_early();
>  	omap44xx_voltagedomains_init();
>  	omap44xx_powerdomains_init();
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply

* [PATCH 4/4] ARM: EXYNOS4: Add power domain to use generic Power domain Framework
From: Chanwoo Choi @ 2011-10-05  1:54 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <001901cc80d2$0da66d40$28f347c0$%kim@samsung.com>

Kukjin Kim wrote:
> Chanwoo Choi wrote:
>> This patch initializes the power domain of EXYNOS4210. The devices
>> which suppot runtime-PM have to be added in specific power domain.
>>
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  arch/arm/mach-exynos4/mach-nuri.c           |   18 ++++++++++++++++++
>>  arch/arm/mach-exynos4/mach-smdkc210.c       |   18
>> ++++++++++++++++++
>>  arch/arm/mach-exynos4/mach-smdkv310.c       |   15 +++++++++++++++
>>  arch/arm/mach-exynos4/mach-universal_c210.c |   18 ++++++++++++++++++
>>  4 files changed, 69 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-exynos4/mach-nuri.c b/arch/arm/mach-exynos4/mach-
>> nuri.c
>> index 4c358cb..5844c55 100644
>> --- a/arch/arm/mach-exynos4/mach-nuri.c
>> +++ b/arch/arm/mach-exynos4/mach-nuri.c
>> @@ -44,6 +44,7 @@
>>  #include <plat/mfc.h>
>>
>>  #include <mach/map.h>
>> +#include <mach/pm-exynos4210.h>
>>
>>  /* Following are default values for UCON, ULCON and UFCON UART registers */
>>  #define NURI_UCON_DEFAULT	(S3C2410_UCON_TXILEVEL |	\
>> @@ -1125,6 +1126,21 @@ static void __init nuri_reserve(void)
>>  	s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
>>  }
>>
>> +static void __init nuri_power_domain_init(void)
>> +{
>> +	/* Initialize Power domain */
>> +	exynos4210_init_pm_domain(&exynos4210_pd_mfc);
>> +	exynos4210_init_pm_domain(&exynos4210_pd_g3d);
>> +	exynos4210_init_pm_domain(&exynos4210_pd_lcd0);
>> +	exynos4210_init_pm_domain(&exynos4210_pd_lcd1);
>> +	exynos4210_init_pm_domain(&exynos4210_pd_tv);
>> +	exynos4210_init_pm_domain(&exynos4210_pd_cam);
>> +	exynos4210_init_pm_domain(&exynos4210_pd_gps);
> 
> As you know, the EXYNOS421 boards have same power domains so how about to make array of struct exynos4210_pm_domain and just one calling exynos4210_init_pm_domain()?
> 
OK, I will reimplement it to remove duplicate function call for initializing the generic power-domain of exynos4210.

>> +
>> +	/* Add device to MFC power domain */
>> +	exynos4210_add_device_to_domain(&exynos4210_pd_mfc,
>> &s5p_device_mfc);
>> +}
>> +
>>  static void __init nuri_machine_init(void)
>>  {
>>  	nuri_sdhci_init();
>> @@ -1145,6 +1161,8 @@ static void __init nuri_machine_init(void)
>>
>>  	/* Last */
>>  	platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
>> +
>> +	nuri_power_domain_init();
>>  }
>>
>>  MACHINE_START(NURI, "NURI")
>> diff --git a/arch/arm/mach-exynos4/mach-smdkc210.c b/arch/arm/mach-
>> exynos4/mach-smdkc210.c
>> index 4d1976c..0a3b2a9 100644
>> --- a/arch/arm/mach-exynos4/mach-smdkc210.c
>> +++ b/arch/arm/mach-exynos4/mach-smdkc210.c
> 
> The mach-smdkc210.c and mach-smdkv310.c are merged one mach-smdkv310.c file.
> 
OK, I will modify it according to merged state of mach-smdkv310.c.

Thanks & Regards,
Chanwoo Choi

^ permalink raw reply

* [PATCH 2/4] ARM: EXYNOS4: Support for generic Clock manipulation PM callbacks
From: Chanwoo Choi @ 2011-10-05  1:57 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <001801cc80d2$065939a0$130bace0$%kim@samsung.com>

Kukjin Kim wrote:
> Chanwoo Choi wrote:
>> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  arch/arm/mach-exynos4/Makefile     |    2 +-
>>  arch/arm/mach-exynos4/pm-runtime.c |   56 ++++++++++++++++++++++++++++++++++++
>>  2 files changed, 57 insertions(+), 1 deletions(-)
>>  create mode 100644 arch/arm/mach-exynos4/pm-runtime.c
>>
>> diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile
>> index 97c31ce..28cdb8b 100644
>> --- a/arch/arm/mach-exynos4/Makefile
>> +++ b/arch/arm/mach-exynos4/Makefile
>> @@ -5,7 +5,7 @@
>>  #
>>  # Licensed under GPLv2
>>
>> -obj-y				:=
>> +obj-y				:= pm-runtime.o
> 
> To move under depending CONFIG_ARCH_EXYNOS4 like others is better.
Ok, I will modify it.

> 
>>  obj-m				:=
>>  obj-n				:=
>>  obj-				:=
>> diff --git a/arch/arm/mach-exynos4/pm-runtime.c b/arch/arm/mach-exynos4/pm-runtime.c
>> new file mode 100644
>> index 0000000..4fe9f73
>> --- /dev/null
>> +++ b/arch/arm/mach-exynos4/pm-runtime.c
>> @@ -0,0 +1,56 @@
>> +/* linux/arch/arm/mach-exynos4/pm-runtime.c
>> +
>> + * Exynos4210 Power management support
>> + *
>> + * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>> + *		http://www.samsung.com
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> +*/
>> +
>> +#include <linux/init.h>
>> +#include <linux/kernel.h>
>> +#include <linux/io.h>
>> +#include <linux/pm_runtime.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/clk.h>
>> +#include <linux/bitmap.h>
>> +#include <linux/slab.h>
>> +
>> +#ifdef CONFIG_PM_RUNTIME
>> +
>> +static int default_platform_runtime_idle(struct device *dev)
>> +{
>> +	return pm_runtime_suspend(dev);
>> +}
>> +
>> +static struct dev_pm_domain default_pm_domain = {
>> +	.ops = {
>> +		.runtime_suspend = pm_clk_suspend,
>> +		.runtime_resume = pm_clk_resume,
>> +		.runtime_idle = default_platform_runtime_idle,
>> +		USE_PLATFORM_PM_SLEEP_OPS
>> +	},
>> +};
>> +
>> +#define DEFAULT_PM_DOMAIN_PTR	(&default_pm_domain)
>> +
>> +#else
>> +
>> +#define DEFAULT_PM_DOMAIN_PTR	NULL
>> +
>> +#endif /* CONFIG_PM_RUNTIME */
>> +
>> +static struct pm_clk_notifier_block platform_bus_notifier = {
>> +	.pm_domain = DEFAULT_PM_DOMAIN_PTR,
>> +	.con_ids = { NULL, },
>> +};
>> +
>> +static int __init exynos4_pm_runtime_init(void)
>> +{
>> +	pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
>> +	return 0;
>> +}
>> +core_initcall(exynos4_pm_runtime_init);
>> --
>> 1.7.0.4
> 
> How about to make common stuff in ARM instead of each platform has their own...
> 
> I think you can consolidate this pm_runtime with other ARM platform like omap, shmobile.
> 
> arch/arm/mach-omap1/pm_bus.c
> arch/arm/mach-shmobile/pm_runtime.c
> 
OK, I received the comment of consolidating geneirc power-domain of exynos series from Sylwester Nawrocki. 
I will reimplment for supporting various exynos series and resend it.

Thanks,

Best Regards,
Chanwoo Choi

^ permalink raw reply

* [RFC PATCH v2 0/6] TI81XX: Add clock and hwmod data
From: Pedanekar, Hemant @ 2011-10-05  1:58 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.DEB.2.00.1110040318260.4611@utopia.booyaka.com>

Hi Paul,

Paul Walmsley wrote on Tuesday, October 04, 2011 2:54 PM:

> Hi,
> 
> On Tue, 23 Aug 2011, Hemant Pedanekar wrote:
> 
>> This patch set is the v2 of TI816X clock and hwmods patches sent earlier.
>> 
>> The clock data is currently added only for TI816X, while minimal hwmod data
>> common for TI816X and TI814X is added.
>> 
>> This patch set depends on following patches:
>> 	TI81XX: Prepare for addition of TI814X support
>> 	TI814X: Add cpu type macros and detection support
>> 	TI814X: Create board support and enable build for TI8148 EVM
>> 
>> Please note that CHIP_IS_TI816X/CHIP_IS_TI814X are still being used and I
>> will send update once SoC list usage is available.
> 
> I've been spending some time with these patches.  A few aspects don't make
> much sense to me.  For example, looking at the TRMs, the 816x doesn't seem
> to have powerdomains for HDVICP0, 1, or 2, although they are listed in the
> patch.

Can you please check 18.2.1 in TRM from [1].

Above powerdomains are listed there as HDVICP2-0, 1, 2.

>  Also, the clockdomain layout is quite different between 814x and
> 816x, according to the TRMs.  Are the patches more accurate than the TRMs,
> or vice versa?
>
You are correct, 814x has differences in clock, clockdomain and powerdomain
data.

I would say the extent of differences level between 816x and 814x is 
something like (please also see reference links from Arago devl tree):

Clock data: ~90% data is different (main contributors: different
PLLs - FAPLL in 816x vs ADPLL 814x, different parent hierarchy)
[2] & [3]

Clockdomains data: ~60% [4]

Powerdomains data: ~90%  [5]
> Will send over the current reworked patches for TI81XX PRCM accessors,
> powerdomain code & data, and clockdomain code & data.  They are intended
> to apply over the TI814x patches that you sent recently.  I'd like to get
> your opinion(s) on these reworked patches.  Please note, so far they have
> only been compile-tested.
> 
> 
> - Paul

Thanks, I will try those and respond.

   Hemant

[1] http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=sprugx8
[2] http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/clock816x_data.c;h=32ea958afef915f93e0560f87d1bb2115e24ee2c;hb=HEAD
[3] http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/clock814x_data.c;h=282ffa93398db678843a35766219970655563b46;hb=HEAD
[4] http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/clockdomains81xx.h;h=217c9b4f85c59cc92e0f36ddd73044136c8e9fff;hb=HEAD
[5] http://arago-project.org/git/projects/?p=linux-omap3.git;a=blob;f=arch/arm/mach-omap2/powerdomains81xx.h;h=ef1299e00c216aea4d12bca2281540efb7eb77f0;hb=HEAD

^ permalink raw reply

* [PATCH 05/11] ARM: vfp: use -mfloat-abi=soft to build vfp
From: Khem Raj @ 2011-10-05  2:04 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20111003140411.GB2117@arm.com>

On 10/3/2011 7:04 AM, Dave Martin wrote:
> On Sat, Oct 01, 2011 at 09:21:54PM +0200, Arnd Bergmann wrote:
>> Distros are starting to ship with toolchains defaulting to
>> hardfloat. Using such a compiler to build the kernel fails
>> in the VFP directory with
>>
>> arch/arm/vfp/entry.S:1:0: sorry, unimplemented: -mfloat-abi=hard and VFP
>>
>> Adding -mfloat-abi=soft to the gcc command line fixes this.
>>
>> Signed-off-by: Arnd Bergmann<arnd@arndb.de>
>> ---
>>   arch/arm/vfp/Makefile |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/vfp/Makefile b/arch/arm/vfp/Makefile
>> index 6de73aa..a81404c 100644
>> --- a/arch/arm/vfp/Makefile
>> +++ b/arch/arm/vfp/Makefile
>> @@ -7,7 +7,7 @@
>>   # ccflags-y := -DDEBUG
>>   # asflags-y := -DDEBUG
>>
>> -KBUILD_AFLAGS	:=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp)
>> +KBUILD_AFLAGS	:=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp -mfloat-abi=soft)
>
> Although -mfpu=softvfp+vfp and -mfloat-abi=soft look mutually
> contradictory, this seems to have the correct effect, i.e. the
> assembler allows floating-point instructions but marks the resulting
> object as using the soft-float calling conventions.

I was wondering if this could also be achieved with -mfloat-abi=softfp 
this will also add Tag_FP_arch: VFPv2 into .attributes section and 
-Wa,-mfpu=softvfp+vfp may not be needed.

>
> The binutils documentation also seems to confirm that that's what
> should happen.
>
> I don't see another combination of options for getting this effect.
>
>
> So, if you like:
>
> Reviewed-by: Dave Martin<dave.martin@linaro.org>
>
> Cheers
> ---Dave
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply

* Please help with the OMAP static mapping mess
From: Rob Herring @ 2011-10-05  2:09 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.02.1110041458500.9106@xanadu.home>

On 10/04/2011 04:21 PM, Nicolas Pitre wrote:
> On Tue, 4 Oct 2011, Santosh Shilimkar wrote:
> 
>> On Tuesday 04 October 2011 04:08 AM, Tony Lindgren wrote:
>>> * Nicolas Pitre <nico@fluxnic.net> [111003 14:36]:
>>>> On Mon, 3 Oct 2011, Tony Lindgren wrote:
>>>>
>>>>> Having the SRAM base address move around with different sizes also
>>>>> requires the SoC detection.. Otherwise we can end up mapping wrong
>>>>> size and end up trying to access secure SRAM that will hang the system.
>>>>>
>>>>> The way to fix it is to move SRAM init happen much later so we don't
>>>>> have to map it early. I guess now we could use ioremap for SRAM,
>>>>> although we may not want device attributes for the executable code?
>>>>> Got any suggestions here on how we should map SRAM later on?
>>>>
>>>> You can use a variant of ioremap() such as __arm_ioremap() which let you 
>>>> specify the memory attribute.
>>>
>>> OK, I'll take a look at that.
>>>
>> I have tried __arm_ioremap_pfn() for some DDR mapping and it didn't
>> work as expected. The mapping was not getting created.
> 
> Did you investigate why it wasn't created?  Must have been a trivial 
> issue surely?  But you have to wait until memory management is fully 
> initialized to call the real ioremap() though, which happens later 
> during the boot.
> 

Isn't ioremap prevented from using main memory now?

Rob

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox