Skip to contentSkip to conversation

OMAP clock & IO mapping fixes for 2.6.33-rc2

PATCH New Paul Walmsley 1 participant 9 messages Dec 18, 2009

Subsystems (4)
lore
Share & tools
lore

Paul Walmsley

author maintainer
#0 lore raw

cover OMAP clock & IO mapping fixes for 2.6.33-rc2

Hello,

Here are some relatively minor OMAP fixes for 2.6.33-rc2. The most significant one is:

OMAP2420 IO mapping: move IVA mapping virtual address out of vmalloc space

Without it, OMAP2420 systems with lots of vmalloc() usage could crash or memory could be corrupted.

- Paul

---

Abhijit Pagare (1):
ARM: OMAP3: PM: Fix the Invalid CM_CLKSTCTRL reg access.

Huang Weiyi (1):
OMAP2: remove duplicated #include

Kevin Hilman (1):
OMAP3: clock: add clockdomains for UART1 & 2

Paul Walmsley (4):
OMAP2xxx IO mapping: mark DSP mappings as being 2420-only
OMAP2420 IO mapping: move IVA mapping virtual address out of vmalloc space OMAP3 clock: McBSP 2, 3, 4 functional clock parent is PER_96M_FCLK, not CORE_96M_FCLK OMAP clock: remove incorrect EXPORT_SYMBOL()s

Tuukka Toivonen (1):
OMAP3 clock: Add capability to change rate of dpll4_m5_ck

 arch/arm/mach-omap2/clock34xx.c      |    1 -
 arch/arm/mach-omap2/clock34xx_data.c |    6 +++++-
 arch/arm/mach-omap2/clockdomain.c    |    4 ++--
 arch/arm/mach-omap2/io.c             |   19 +++++++++---------
 arch/arm/plat-omap/clock.c           |    6 ------
 arch/arm/plat-omap/include/plat/io.h |   36 +++++++++++++++-------------------
 arch/arm/plat-omap/io.c              |   12 ++++++-----
 7 files changed, 38 insertions(+), 46 deletions(-)

text data bss dec hex filename
3628182 197984 102920 3929086 3bf3fe vmlinux.beagle.orig
3628135 197984 102920 3929039 3bf3cf vmlinux.beagle

author maintainer
#1 lore raw

PATCH 1/8 OMAP2: remove duplicated #include

From: Huang Weiyi <[email protected]>

Remove duplicated #include('s) in
arch/arm/mach-omap2/clock34xx.c
arch/arm/mach-omap2/io.c

---
 arch/arm/mach-omap2/clock34xx.c |    1 -
 arch/arm/mach-omap2/io.c        |    1 -
 2 files changed, 0 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clock34xx.c +0 -1
index ded3236..d4217b9 100644
@@ -34,7 +34,6 @@
 #include <asm/div64.h>
 #include <asm/clkdev.h>
 
-#include <plat/sdrc.h>
 #include "clock.h"
 #include "clock34xx.h"
 #include "sdrc.h"
arch/arm/mach-omap2/io.c +0 -1
index a8749e8..ac9ea60 100644
@@ -33,7 +33,6 @@
 #include <plat/sdrc.h>
 #include <plat/gpmc.h>
 #include <plat/serial.h>
-#include <plat/mux.h>
 #include <plat/vram.h>
 
 #include "clock.h"
author maintainer
#2 lore raw

PATCH 2/8 ARM: OMAP3: PM: Fix the Invalid CM_CLKSTCTRL reg access.

In reply to Paul Walmsley

From: Abhijit Pagare <[email protected]>

In OMAP2/3 some of the clock-domains which did not have control facility were being falsely written to and read using the CM_CLKSTCTRL register though it did not exist for them. One check is added to remove this flaw.

---
 arch/arm/mach-omap2/clockdomain.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/clockdomain.c +2 -2
index 1a45ed1..dd285f0 100644
@@ -559,7 +559,7 @@ int omap2_clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
 	 * downstream clocks for debugging purposes?
 	 */
 
-	if (!clkdm || !clk)
+	if (!clkdm || !clk || !clkdm->clktrctrl_mask)
 		return -EINVAL;
 
 	if (atomic_inc_return(&clkdm->usecount) > 1)
@@ -610,7 +610,7 @@ int omap2_clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
 	 * downstream clocks for debugging purposes?
 	 */
 
-	if (!clkdm || !clk)
+	if (!clkdm || !clk || !clkdm->clktrctrl_mask)
 		return -EINVAL;
 
 #ifdef DEBUG
author maintainer
#3 lore raw

PATCH 3/8 OMAP2xxx IO mapping: mark DSP mappings as being 2420-only

In reply to Paul Walmsley

Out of the three major OMAP2 chip types, OMAP2420, OMAP2430, and OMAP3430, we only map the IVA on OMAP2420. The memory mapping is not shared between OMAP2420 and OMAP2430, so it is inappropriate to label those macros as '24XX'; this patch changes them to '2420'.

---
 arch/arm/mach-omap2/io.c             |   18 +++++++++---------
 arch/arm/plat-omap/include/plat/io.h |   33 +++++++++++++--------------------
 arch/arm/plat-omap/io.c              |   12 ++++++------
 3 files changed, 28 insertions(+), 35 deletions(-)
arch/arm/mach-omap2/io.c +9 -9
index ac9ea60..5a79964 100644
@@ -72,21 +72,21 @@ static struct map_desc omap24xx_io_desc[] __initdata = {
 #ifdef CONFIG_ARCH_OMAP2420
 static struct map_desc omap242x_io_desc[] __initdata = {
 	{
-		.virtual	= DSP_MEM_24XX_VIRT,
-		.pfn		= __phys_to_pfn(DSP_MEM_24XX_PHYS),
-		.length		= DSP_MEM_24XX_SIZE,
+		.virtual	= DSP_MEM_2420_VIRT,
+		.pfn		= __phys_to_pfn(DSP_MEM_2420_PHYS),
+		.length		= DSP_MEM_2420_SIZE,
 		.type		= MT_DEVICE
 	},
 	{
-		.virtual	= DSP_IPI_24XX_VIRT,
-		.pfn		= __phys_to_pfn(DSP_IPI_24XX_PHYS),
-		.length		= DSP_IPI_24XX_SIZE,
+		.virtual	= DSP_IPI_2420_VIRT,
+		.pfn		= __phys_to_pfn(DSP_IPI_2420_PHYS),
+		.length		= DSP_IPI_2420_SIZE,
 		.type		= MT_DEVICE
 	},
 	{
-		.virtual	= DSP_MMU_24XX_VIRT,
-		.pfn		= __phys_to_pfn(DSP_MMU_24XX_PHYS),
-		.length		= DSP_MMU_24XX_SIZE,
+		.virtual	= DSP_MMU_2420_VIRT,
+		.pfn		= __phys_to_pfn(DSP_MMU_2420_PHYS),
+		.length		= DSP_MMU_2420_SIZE,
 		.type		= MT_DEVICE
 	},
 };
arch/arm/plat-omap/include/plat/io.h +13 -20
index 7e5319f..7d6f45f 100644
@@ -122,16 +122,18 @@
 #define OMAP243X_SMS_VIRT	(OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET)
 #define OMAP243X_SMS_SIZE	SZ_1M
 
-/* DSP */
-#define DSP_MEM_24XX_PHYS	OMAP2420_DSP_MEM_BASE	/* 0x58000000 */
-#define DSP_MEM_24XX_VIRT	0xe0000000
-#define DSP_MEM_24XX_SIZE	0x28000
-#define DSP_IPI_24XX_PHYS	OMAP2420_DSP_IPI_BASE	/* 0x59000000 */
-#define DSP_IPI_24XX_VIRT	0xe1000000
-#define DSP_IPI_24XX_SIZE	SZ_4K
-#define DSP_MMU_24XX_PHYS	OMAP2420_DSP_MMU_BASE	/* 0x5a000000 */
-#define DSP_MMU_24XX_VIRT	0xe2000000
-#define DSP_MMU_24XX_SIZE	SZ_4K
+/* 2420 IVA */
+#define DSP_MEM_2420_PHYS	OMAP2420_DSP_MEM_BASE	/* 0x58000000 */
+#define DSP_MEM_2420_VIRT	0xe0000000
+#define DSP_MEM_2420_SIZE	0x28000
+#define DSP_IPI_2420_PHYS	OMAP2420_DSP_IPI_BASE	/* 0x59000000 */
+#define DSP_IPI_2420_VIRT	0xe1000000
+#define DSP_IPI_2420_SIZE	SZ_4K
+#define DSP_MMU_2420_PHYS	OMAP2420_DSP_MMU_BASE	/* 0x5a000000 */
+#define DSP_MMU_2420_VIRT	0xe2000000
+#define DSP_MMU_2420_SIZE	SZ_4K
+
+/* 2430 IVA2.1 - currently unmapped */
 
 /*
  * ----------------------------------------------------------------------------
@@ -182,16 +184,7 @@
 #define OMAP343X_SDRC_VIRT	(OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET)
 #define OMAP343X_SDRC_SIZE	SZ_1M
 
-/* DSP */
-#define DSP_MEM_34XX_PHYS	OMAP34XX_DSP_MEM_BASE	/* 0x58000000 */
-#define DSP_MEM_34XX_VIRT	0xe0000000
-#define DSP_MEM_34XX_SIZE	0x28000
-#define DSP_IPI_34XX_PHYS	OMAP34XX_DSP_IPI_BASE	/* 0x59000000 */
-#define DSP_IPI_34XX_VIRT	0xe1000000
-#define DSP_IPI_34XX_SIZE	SZ_4K
-#define DSP_MMU_34XX_PHYS	OMAP34XX_DSP_MMU_BASE	/* 0x5a000000 */
-#define DSP_MMU_34XX_VIRT	0xe2000000
-#define DSP_MMU_34XX_SIZE	SZ_4K
+/* 3430 IVA - currently unmapped */
 
 /*
  * ----------------------------------------------------------------------------
arch/arm/plat-omap/io.c +6 -6
index 11f5d79..0cfd54f 100644
@@ -66,12 +66,12 @@ void __iomem *omap_ioremap(unsigned long p, size_t size, unsigned int type)
 			return XLATE(p, L4_24XX_PHYS, L4_24XX_VIRT);
 	}
 	if (cpu_is_omap2420()) {
-		if (BETWEEN(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_SIZE))
-			return XLATE(p, DSP_MEM_24XX_PHYS, DSP_MEM_24XX_VIRT);
-		if (BETWEEN(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE))
-			return XLATE(p, DSP_IPI_24XX_PHYS, DSP_IPI_24XX_SIZE);
-		if (BETWEEN(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_SIZE))
-			return XLATE(p, DSP_MMU_24XX_PHYS, DSP_MMU_24XX_VIRT);
+		if (BETWEEN(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_SIZE))
+			return XLATE(p, DSP_MEM_2420_PHYS, DSP_MEM_2420_VIRT);
+		if (BETWEEN(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE))
+			return XLATE(p, DSP_IPI_2420_PHYS, DSP_IPI_2420_SIZE);
+		if (BETWEEN(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_SIZE))
+			return XLATE(p, DSP_MMU_2420_PHYS, DSP_MMU_2420_VIRT);
 	}
 	if (cpu_is_omap2430()) {
 		if (BETWEEN(p, L4_WK_243X_PHYS, L4_WK_243X_SIZE))
author maintainer
#4 lore raw

PATCH 4/8 OMAP2420 IO mapping: move IVA mapping virtual address out of vmalloc space

In reply to Paul Walmsley

Commit 10db25fea4c11661070b97832b8cc3d2af495092 causes the following kernel messages during N800 boot (and presumably all other 2420 boards):

[    0.000000] BUG: mapping for 0x58000000 at 0xe0000000 overlaps vmalloc space
[    0.000000] BUG: mapping for 0x59000000 at 0xe1000000 overlaps vmalloc space
[    0.000000] BUG: mapping for 0x5a000000 at 0xe2000000 overlaps vmalloc space

Fix by remapping the IVA memory areas somewhere outside vmalloc space.

Cc Santosh Shilimkar <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/plat-omap/include/plat/io.h |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
arch/arm/plat-omap/include/plat/io.h +9 -6
index 7d6f45f..a3e7b47 100644
@@ -123,14 +123,17 @@
 #define OMAP243X_SMS_SIZE	SZ_1M
 
 /* 2420 IVA */
-#define DSP_MEM_2420_PHYS	OMAP2420_DSP_MEM_BASE	/* 0x58000000 */
-#define DSP_MEM_2420_VIRT	0xe0000000
+#define DSP_MEM_2420_PHYS	OMAP2420_DSP_MEM_BASE
+						/* 0x58000000 --> 0xfc100000 */
+#define DSP_MEM_2420_VIRT	0xfc100000
 #define DSP_MEM_2420_SIZE	0x28000
-#define DSP_IPI_2420_PHYS	OMAP2420_DSP_IPI_BASE	/* 0x59000000 */
-#define DSP_IPI_2420_VIRT	0xe1000000
+#define DSP_IPI_2420_PHYS	OMAP2420_DSP_IPI_BASE
+						/* 0x59000000 --> 0xfc128000 */
+#define DSP_IPI_2420_VIRT	0xfc128000
 #define DSP_IPI_2420_SIZE	SZ_4K
-#define DSP_MMU_2420_PHYS	OMAP2420_DSP_MMU_BASE	/* 0x5a000000 */
-#define DSP_MMU_2420_VIRT	0xe2000000
+#define DSP_MMU_2420_PHYS	OMAP2420_DSP_MMU_BASE
+						/* 0x5a000000 --> 0xfc129000 */
+#define DSP_MMU_2420_VIRT	0xfc129000
 #define DSP_MMU_2420_SIZE	SZ_4K
 
 /* 2430 IVA2.1 - currently unmapped */
author maintainer
#5 lore raw

PATCH 5/8 OMAP3: clock: add clockdomains for UART1 & 2

In reply to Paul Walmsley

From: Kevin Hilman <[email protected]>

UART1 & 2 were missing clockdomains resulting in broken omap_hwmod init for these devices.

---
 arch/arm/mach-omap2/clock34xx_data.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx_data.c +2 -0
index 8bdcc9c..c60b19a 100644
@@ -1500,6 +1500,7 @@ static struct clk uart2_fck = {
 	.parent		= &core_48m_fck,
 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
 	.enable_bit	= OMAP3430_EN_UART2_SHIFT,
+	.clkdm_name	= "core_l4_clkdm",
 	.recalc		= &followparent_recalc,
 };
 
@@ -1509,6 +1510,7 @@ static struct clk uart1_fck = {
 	.parent		= &core_48m_fck,
 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
 	.enable_bit	= OMAP3430_EN_UART1_SHIFT,
+	.clkdm_name	= "core_l4_clkdm",
 	.recalc		= &followparent_recalc,
 };
 
author maintainer
#6 lore raw

PATCH 6/8 OMAP3 clock: McBSP 2, 3, 4 functional clock parent is PER_96M_FCLK, not CORE_96M_FCLK

In reply to Paul Walmsley

The correct parent of the McBSP 2, 3, and 4 functional clocks is PER_96M_FCLK, not CORE_96M_FCLK. Fix this in the OMAP clock tree. Reported by Nicole Chalhoub <[email protected]>.

Cc Nicole Chalhoub <[email protected]>
---
 arch/arm/mach-omap2/clock34xx_data.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/clock34xx_data.c +1 -1
index c60b19a..7eea9fb 100644
@@ -2747,7 +2747,7 @@ static struct clk mcbsp4_ick = {
 };
 
 static const struct clksel mcbsp_234_clksel[] = {
-	{ .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
+	{ .parent = &per_96m_fck,  .rates = common_mcbsp_96m_rates },
 	{ .parent = &mcbsp_clks,   .rates = common_mcbsp_mcbsp_rates },
 	{ .parent = NULL }
 };
author maintainer
#7 lore raw

PATCH 7/8 OMAP3 clock: Add capability to change rate of dpll4_m5_ck

In reply to Paul Walmsley

From: Tuukka Toivonen <[email protected]>

Add necessary definitions to clock framework to allow changing dpll4_m5_ck rate. This is used by the camera code.

---
 arch/arm/mach-omap2/clock34xx_data.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx_data.c +2 -0
index 7eea9fb..c6031d7 100644
@@ -776,6 +776,8 @@ static struct clk dpll4_m5_ck = {
 	.clksel_mask	= OMAP3430_CLKSEL_CAM_MASK,
 	.clksel		= div16_dpll4_clksel,
 	.clkdm_name	= "dpll4_clkdm",
+	.set_rate	= &omap2_clksel_set_rate,
+	.round_rate	= &omap2_clksel_round_rate,
 	.recalc		= &omap2_clksel_recalc,
 };
 
author maintainer
#8 lore raw

PATCH 8/8 OMAP clock: remove incorrect EXPORT_SYMBOL()s

In reply to Paul Walmsley

The only symbols that should be exported are symbols that are to be called from loadable kernel modules, e.g., device drivers. In the context of plat-omap/clock.c, these should only be the Linux clock interface symbols as defined by include/linux/clk.h. Core code doesn't need these symbols to be exported. Also, clean up an old comment while here.

---
 arch/arm/plat-omap/clock.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
arch/arm/plat-omap/clock.c +0 -6
index 89cafc9..a64d84c 100644
@@ -36,10 +36,6 @@ static struct clk_functions *arch_clock;
  * Standard clock functions defined in include/linux/clk.h
  *-------------------------------------------------------------------------*/
 
-/* This functions is moved to arch/arm/common/clkdev.c. For OMAP4 since
- * clock framework is not up , it is defined here to avoid rework in
- * every driver. Also dummy prcm reset function is added */
-
 int clk_enable(struct clk *clk)
 {
 	unsigned long flags;
@@ -305,7 +301,6 @@ void clk_enable_init_clocks(void)
 			clk_enable(clkp);
 	}
 }
-EXPORT_SYMBOL(clk_enable_init_clocks);
 
 /*
  * Low level helpers
@@ -334,7 +329,6 @@ void clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
 		arch_clock->clk_init_cpufreq_table(table);
 	spin_unlock_irqrestore(&clockfw_lock, flags);
 }
-EXPORT_SYMBOL(clk_init_cpufreq_table);
 #endif
 
 /*-------------------------------------------------------------------------*/