All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Subject: [PATCH 03/11] ARM: OMAP: Move omap1 specific code to local sram.c
Date: Tue, 30 Oct 2012 16:52:47 -0700	[thread overview]
Message-ID: <20121030235247.25936.53373.stgit@muffinssi.local> (raw)
In-Reply-To: <20121030234852.25936.12482.stgit@muffinssi.local>

Let's make the omap1 specific parts private to mach-omap1.
These should not be in the shared code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/Makefile    |    3 +-
 arch/arm/mach-omap1/sram-init.c |   76 +++++++++++++++++++++++++++++++++++++++
 arch/arm/plat-omap/sram.c       |   49 ++-----------------------
 3 files changed, 81 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-omap1/sram-init.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index cd169c3..f0e69cb 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
+obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
+	 serial.o devices.o dma.o
 obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
 
 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
diff --git a/arch/arm/mach-omap1/sram-init.c b/arch/arm/mach-omap1/sram-init.c
new file mode 100644
index 0000000..6431b0f
--- /dev/null
+++ b/arch/arm/mach-omap1/sram-init.c
@@ -0,0 +1,76 @@
+/*
+ * OMAP SRAM detection and management
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Written by Tony Lindgren <tony@atomide.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/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/fncpy.h>
+#include <asm/tlb.h>
+#include <asm/cacheflush.h>
+
+#include <asm/mach/map.h>
+
+#include "soc.h"
+#include "sram.h"
+
+#define OMAP1_SRAM_PA		0x20000000
+#define SRAM_BOOTLOADER_SZ	0x80
+
+/*
+ * The amount of SRAM depends on the core type.
+ * Note that we cannot try to test for SRAM here because writes
+ * to secure SRAM will hang the system. Also the SRAM is not
+ * yet mapped at this point.
+ */
+static void __init omap_detect_and_map_sram(void)
+{
+	unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ;
+	unsigned long omap_sram_start = OMAP1_SRAM_PA;
+	unsigned long omap_sram_size;
+
+	if (cpu_is_omap7xx())
+		omap_sram_size = 0x32000;	/* 200K */
+	else if (cpu_is_omap15xx())
+		omap_sram_size = 0x30000;	/* 192K */
+	else if (cpu_is_omap1610() || cpu_is_omap1611() ||
+			cpu_is_omap1621() || cpu_is_omap1710())
+		omap_sram_size = 0x4000;	/* 16K */
+	else {
+		pr_err("Could not detect SRAM size\n");
+		omap_sram_size = 0x4000;
+	}
+
+	omap_map_sram(omap_sram_start, omap_sram_size,
+		omap_sram_skip, 1);
+}
+
+static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
+
+void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
+{
+	BUG_ON(!_omap_sram_reprogram_clock);
+	/* On 730, bit 13 must always be 1 */
+	if (cpu_is_omap7xx())
+		ckctl |= 0x2000;
+	_omap_sram_reprogram_clock(dpllctl, ckctl);
+}
+
+int __init omap_sram_init(void)
+{
+	omap_detect_and_map_sram();
+	_omap_sram_reprogram_clock =
+			omap_sram_push(omap1_sram_reprogram_clock,
+					omap1_sram_reprogram_clock_sz);
+
+	return 0;
+}
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index aa2644a..6fd3216 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -26,8 +26,6 @@
 
 #include <asm/mach/map.h>
 
-#include "../mach-omap1/soc.h"
-#include "../mach-omap1/sram.h"
 #include "../mach-omap2/soc.h"
 #include "../mach-omap2/sram.h"
 
@@ -36,7 +34,6 @@
 #include "../mach-omap2/prm2xxx_3xxx.h"
 #include "../mach-omap2/sdrc.h"
 
-#define OMAP1_SRAM_PA		0x20000000
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
 #ifdef CONFIG_OMAP4_ERRATA_I688
@@ -150,20 +147,6 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x10000; /* 64K */
 			}
 		}
-	} else {
-		omap_sram_start = OMAP1_SRAM_PA;
-
-		if (cpu_is_omap7xx())
-			omap_sram_size = 0x32000;	/* 200K */
-		else if (cpu_is_omap15xx())
-			omap_sram_size = 0x30000;	/* 192K */
-		else if (cpu_is_omap1610() || cpu_is_omap1611() ||
-				cpu_is_omap1621() || cpu_is_omap1710())
-			omap_sram_size = 0x4000;	/* 16K */
-		else {
-			pr_err("Could not detect SRAM size\n");
-			omap_sram_size = 0x4000;
-		}
 	}
 }
 
@@ -257,32 +240,6 @@ void __init omap_map_sram(unsigned long start, unsigned long size,
 		  omap_sram_size - omap_sram_skip);
 }
 
-#ifdef CONFIG_ARCH_OMAP1
-
-static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
-
-void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
-{
-	BUG_ON(!_omap_sram_reprogram_clock);
-	/* On 730, bit 13 must always be 1 */
-	if (cpu_is_omap7xx())
-		ckctl |= 0x2000;
-	_omap_sram_reprogram_clock(dpllctl, ckctl);
-}
-
-static int __init omap1_sram_init(void)
-{
-	_omap_sram_reprogram_clock =
-			omap_sram_push(omap1_sram_reprogram_clock,
-					omap1_sram_reprogram_clock_sz);
-
-	return 0;
-}
-
-#else
-#define omap1_sram_init()	do {} while (0)
-#endif
-
 #if defined(CONFIG_ARCH_OMAP2)
 
 static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
@@ -407,14 +364,13 @@ static inline int am33xx_sram_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_ARCH_OMAP2PLUS
 int __init omap_sram_init(void)
 {
 	omap_detect_sram();
 	omap_fix_and_map_sram();
 
-	if (!(cpu_class_is_omap2()))
-		omap1_sram_init();
-	else if (cpu_is_omap242x())
+	if (cpu_is_omap242x())
 		omap242x_sram_init();
 	else if (cpu_is_omap2430())
 		omap243x_sram_init();
@@ -425,3 +381,4 @@ int __init omap_sram_init(void)
 
 	return 0;
 }
+#endif


WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/11] ARM: OMAP: Move omap1 specific code to local sram.c
Date: Tue, 30 Oct 2012 16:52:47 -0700	[thread overview]
Message-ID: <20121030235247.25936.53373.stgit@muffinssi.local> (raw)
In-Reply-To: <20121030234852.25936.12482.stgit@muffinssi.local>

Let's make the omap1 specific parts private to mach-omap1.
These should not be in the shared code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/Makefile    |    3 +-
 arch/arm/mach-omap1/sram-init.c |   76 +++++++++++++++++++++++++++++++++++++++
 arch/arm/plat-omap/sram.c       |   49 ++-----------------------
 3 files changed, 81 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/mach-omap1/sram-init.c

diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index cd169c3..f0e69cb 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,8 @@
 #
 
 # Common support
-obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o
+obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
+	 serial.o devices.o dma.o
 obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
 
 ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
diff --git a/arch/arm/mach-omap1/sram-init.c b/arch/arm/mach-omap1/sram-init.c
new file mode 100644
index 0000000..6431b0f
--- /dev/null
+++ b/arch/arm/mach-omap1/sram-init.c
@@ -0,0 +1,76 @@
+/*
+ * OMAP SRAM detection and management
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Written by Tony Lindgren <tony@atomide.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/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/fncpy.h>
+#include <asm/tlb.h>
+#include <asm/cacheflush.h>
+
+#include <asm/mach/map.h>
+
+#include "soc.h"
+#include "sram.h"
+
+#define OMAP1_SRAM_PA		0x20000000
+#define SRAM_BOOTLOADER_SZ	0x80
+
+/*
+ * The amount of SRAM depends on the core type.
+ * Note that we cannot try to test for SRAM here because writes
+ * to secure SRAM will hang the system. Also the SRAM is not
+ * yet mapped at this point.
+ */
+static void __init omap_detect_and_map_sram(void)
+{
+	unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ;
+	unsigned long omap_sram_start = OMAP1_SRAM_PA;
+	unsigned long omap_sram_size;
+
+	if (cpu_is_omap7xx())
+		omap_sram_size = 0x32000;	/* 200K */
+	else if (cpu_is_omap15xx())
+		omap_sram_size = 0x30000;	/* 192K */
+	else if (cpu_is_omap1610() || cpu_is_omap1611() ||
+			cpu_is_omap1621() || cpu_is_omap1710())
+		omap_sram_size = 0x4000;	/* 16K */
+	else {
+		pr_err("Could not detect SRAM size\n");
+		omap_sram_size = 0x4000;
+	}
+
+	omap_map_sram(omap_sram_start, omap_sram_size,
+		omap_sram_skip, 1);
+}
+
+static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
+
+void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
+{
+	BUG_ON(!_omap_sram_reprogram_clock);
+	/* On 730, bit 13 must always be 1 */
+	if (cpu_is_omap7xx())
+		ckctl |= 0x2000;
+	_omap_sram_reprogram_clock(dpllctl, ckctl);
+}
+
+int __init omap_sram_init(void)
+{
+	omap_detect_and_map_sram();
+	_omap_sram_reprogram_clock =
+			omap_sram_push(omap1_sram_reprogram_clock,
+					omap1_sram_reprogram_clock_sz);
+
+	return 0;
+}
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index aa2644a..6fd3216 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -26,8 +26,6 @@
 
 #include <asm/mach/map.h>
 
-#include "../mach-omap1/soc.h"
-#include "../mach-omap1/sram.h"
 #include "../mach-omap2/soc.h"
 #include "../mach-omap2/sram.h"
 
@@ -36,7 +34,6 @@
 #include "../mach-omap2/prm2xxx_3xxx.h"
 #include "../mach-omap2/sdrc.h"
 
-#define OMAP1_SRAM_PA		0x20000000
 #define OMAP2_SRAM_PUB_PA	(OMAP2_SRAM_PA + 0xf800)
 #define OMAP3_SRAM_PUB_PA       (OMAP3_SRAM_PA + 0x8000)
 #ifdef CONFIG_OMAP4_ERRATA_I688
@@ -150,20 +147,6 @@ static void __init omap_detect_sram(void)
 					omap_sram_size = 0x10000; /* 64K */
 			}
 		}
-	} else {
-		omap_sram_start = OMAP1_SRAM_PA;
-
-		if (cpu_is_omap7xx())
-			omap_sram_size = 0x32000;	/* 200K */
-		else if (cpu_is_omap15xx())
-			omap_sram_size = 0x30000;	/* 192K */
-		else if (cpu_is_omap1610() || cpu_is_omap1611() ||
-				cpu_is_omap1621() || cpu_is_omap1710())
-			omap_sram_size = 0x4000;	/* 16K */
-		else {
-			pr_err("Could not detect SRAM size\n");
-			omap_sram_size = 0x4000;
-		}
 	}
 }
 
@@ -257,32 +240,6 @@ void __init omap_map_sram(unsigned long start, unsigned long size,
 		  omap_sram_size - omap_sram_skip);
 }
 
-#ifdef CONFIG_ARCH_OMAP1
-
-static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
-
-void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
-{
-	BUG_ON(!_omap_sram_reprogram_clock);
-	/* On 730, bit 13 must always be 1 */
-	if (cpu_is_omap7xx())
-		ckctl |= 0x2000;
-	_omap_sram_reprogram_clock(dpllctl, ckctl);
-}
-
-static int __init omap1_sram_init(void)
-{
-	_omap_sram_reprogram_clock =
-			omap_sram_push(omap1_sram_reprogram_clock,
-					omap1_sram_reprogram_clock_sz);
-
-	return 0;
-}
-
-#else
-#define omap1_sram_init()	do {} while (0)
-#endif
-
 #if defined(CONFIG_ARCH_OMAP2)
 
 static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
@@ -407,14 +364,13 @@ static inline int am33xx_sram_init(void)
 	return 0;
 }
 
+#ifdef CONFIG_ARCH_OMAP2PLUS
 int __init omap_sram_init(void)
 {
 	omap_detect_sram();
 	omap_fix_and_map_sram();
 
-	if (!(cpu_class_is_omap2()))
-		omap1_sram_init();
-	else if (cpu_is_omap242x())
+	if (cpu_is_omap242x())
 		omap242x_sram_init();
 	else if (cpu_is_omap2430())
 		omap243x_sram_init();
@@ -425,3 +381,4 @@ int __init omap_sram_init(void)
 
 	return 0;
 }
+#endif

  parent reply	other threads:[~2012-10-30 23:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 23:52 [PATCH 00/11] Fix relative includes for omaps introduced by recent clean-up Tony Lindgren
2012-10-30 23:52 ` Tony Lindgren
2012-10-30 23:52 ` [PATCH 01/11] ARM: OMAP: Split sram.h to local headers and minimal shared header Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-30 23:52 ` [PATCH 02/11] ARM: OMAP: Introduce common omap_map_sram() and omap_sram_reset() Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-30 23:52 ` Tony Lindgren [this message]
2012-10-30 23:52   ` [PATCH 03/11] ARM: OMAP: Move omap1 specific code to local sram.c Tony Lindgren
2012-10-30 23:52 ` [PATCH 04/11] ARM: OMAP: Move omap2+ specific parts of sram.c to mach-omap2 Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-31 22:40   ` Tony Lindgren
2012-10-31 22:40     ` Tony Lindgren
2012-10-30 23:52 ` [PATCH 05/11] ARM: OMAP: Make plat-omap/i2c.c port checks local Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-30 23:52 ` [PATCH 06/11] ARM: OMAP: Fix relative includes for shared i2c.h file Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-30 23:52 ` [PATCH 07/11] ARM: OMAP: Move omap-pm-noop.c local to mach-omap2 Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-31 20:58   ` Tony Lindgren
2012-10-31 20:58     ` Tony Lindgren
2012-10-31 23:02     ` Laurent Pinchart
2012-10-31 23:02       ` Laurent Pinchart
2012-10-31 23:11       ` Tony Lindgren
2012-10-31 23:11         ` Tony Lindgren
2012-11-07 22:04         ` Jon Hunter
2012-11-07 22:04           ` Jon Hunter
2012-11-07 22:18           ` Tony Lindgren
2012-11-07 22:18             ` Tony Lindgren
2012-10-30 23:52 ` [PATCH 08/11] ARM: OMAP: Remove plat-omap/common.h Tony Lindgren
2012-10-30 23:52   ` Tony Lindgren
2012-10-30 23:53 ` [PATCH 09/11] ARM: OMAP: Fix relative includes for debug-devices.h Tony Lindgren
2012-10-30 23:53   ` Tony Lindgren
2012-10-31  0:05   ` Paul Walmsley
2012-10-31  0:05     ` Paul Walmsley
2012-10-30 23:53 ` [PATCH 10/11] ARM: OMAP: Remove cpu_is_omap usage from plat-omap/dma.c Tony Lindgren
2012-10-30 23:53   ` Tony Lindgren
2012-10-30 23:53 ` [PATCH 11/11] ARM: OMAP1: Remove relative includes Tony Lindgren
2012-10-30 23:53   ` Tony Lindgren
2012-10-31 21:11   ` Tony Lindgren
2012-10-31 21:11     ` Tony Lindgren
2012-10-31 21:52 ` [PATCH 12/11] ARM: OMAP: Fix relative includes for fpga.h Tony Lindgren
2012-10-31 21:52   ` Tony Lindgren
2012-11-12 10:47   ` Benoit Cousson
2012-11-12 10:47     ` Benoit Cousson
2012-11-12 21:34     ` Tony Lindgren
2012-11-12 21:34       ` Tony Lindgren
2012-10-31 22:08 ` [PATCH 13/11] ARM: OMAP2+: Fix relative includes for serial.h Tony Lindgren
2012-10-31 22:08   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121030235247.25936.53373.stgit@muffinssi.local \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.