aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap1/Makefile3
-rw-r--r--arch/arm/mach-omap1/sram-init.c76
-rw-r--r--arch/arm/plat-omap/sram.c49
3 files changed, 81 insertions, 47 deletions
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index cd169c386161..f0e69cbc5baa 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,8 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o sram.o time.o irq.o mux.o flash.o serial.o devices.o dma.o 6obj-y := io.o id.o sram-init.o sram.o time.o irq.o mux.o flash.o \
7 serial.o devices.o dma.o
7obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o 8obj-y += clock.o clock_data.o opp_data.o reset.o pm_bus.o timer.o
8 9
9ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 10ifneq ($(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 000000000000..6431b0f862ce
--- /dev/null
+++ b/arch/arm/mach-omap1/sram-init.c
@@ -0,0 +1,76 @@
1/*
2 * OMAP SRAM detection and management
3 *
4 * Copyright (C) 2005 Nokia Corporation
5 * Written by Tony Lindgren <tony@atomide.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/io.h>
16
17#include <asm/fncpy.h>
18#include <asm/tlb.h>
19#include <asm/cacheflush.h>
20
21#include <asm/mach/map.h>
22
23#include "soc.h"
24#include "sram.h"
25
26#define OMAP1_SRAM_PA 0x20000000
27#define SRAM_BOOTLOADER_SZ 0x80
28
29/*
30 * The amount of SRAM depends on the core type.
31 * Note that we cannot try to test for SRAM here because writes
32 * to secure SRAM will hang the system. Also the SRAM is not
33 * yet mapped at this point.
34 */
35static void __init omap_detect_and_map_sram(void)
36{
37 unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ;
38 unsigned long omap_sram_start = OMAP1_SRAM_PA;
39 unsigned long omap_sram_size;
40
41 if (cpu_is_omap7xx())
42 omap_sram_size = 0x32000; /* 200K */
43 else if (cpu_is_omap15xx())
44 omap_sram_size = 0x30000; /* 192K */
45 else if (cpu_is_omap1610() || cpu_is_omap1611() ||
46 cpu_is_omap1621() || cpu_is_omap1710())
47 omap_sram_size = 0x4000; /* 16K */
48 else {
49 pr_err("Could not detect SRAM size\n");
50 omap_sram_size = 0x4000;
51 }
52
53 omap_map_sram(omap_sram_start, omap_sram_size,
54 omap_sram_skip, 1);
55}
56
57static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
58
59void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
60{
61 BUG_ON(!_omap_sram_reprogram_clock);
62 /* On 730, bit 13 must always be 1 */
63 if (cpu_is_omap7xx())
64 ckctl |= 0x2000;
65 _omap_sram_reprogram_clock(dpllctl, ckctl);
66}
67
68int __init omap_sram_init(void)
69{
70 omap_detect_and_map_sram();
71 _omap_sram_reprogram_clock =
72 omap_sram_push(omap1_sram_reprogram_clock,
73 omap1_sram_reprogram_clock_sz);
74
75 return 0;
76}
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index aa2644a1ca83..6fd32162964f 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -26,8 +26,6 @@
26 26
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include "../mach-omap1/soc.h"
30#include "../mach-omap1/sram.h"
31#include "../mach-omap2/soc.h" 29#include "../mach-omap2/soc.h"
32#include "../mach-omap2/sram.h" 30#include "../mach-omap2/sram.h"
33 31
@@ -36,7 +34,6 @@
36#include "../mach-omap2/prm2xxx_3xxx.h" 34#include "../mach-omap2/prm2xxx_3xxx.h"
37#include "../mach-omap2/sdrc.h" 35#include "../mach-omap2/sdrc.h"
38 36
39#define OMAP1_SRAM_PA 0x20000000
40#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800) 37#define OMAP2_SRAM_PUB_PA (OMAP2_SRAM_PA + 0xf800)
41#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000) 38#define OMAP3_SRAM_PUB_PA (OMAP3_SRAM_PA + 0x8000)
42#ifdef CONFIG_OMAP4_ERRATA_I688 39#ifdef CONFIG_OMAP4_ERRATA_I688
@@ -150,20 +147,6 @@ static void __init omap_detect_sram(void)
150 omap_sram_size = 0x10000; /* 64K */ 147 omap_sram_size = 0x10000; /* 64K */
151 } 148 }
152 } 149 }
153 } else {
154 omap_sram_start = OMAP1_SRAM_PA;
155
156 if (cpu_is_omap7xx())
157 omap_sram_size = 0x32000; /* 200K */
158 else if (cpu_is_omap15xx())
159 omap_sram_size = 0x30000; /* 192K */
160 else if (cpu_is_omap1610() || cpu_is_omap1611() ||
161 cpu_is_omap1621() || cpu_is_omap1710())
162 omap_sram_size = 0x4000; /* 16K */
163 else {
164 pr_err("Could not detect SRAM size\n");
165 omap_sram_size = 0x4000;
166 }
167 } 150 }
168} 151}
169 152
@@ -257,32 +240,6 @@ void __init omap_map_sram(unsigned long start, unsigned long size,
257 omap_sram_size - omap_sram_skip); 240 omap_sram_size - omap_sram_skip);
258} 241}
259 242
260#ifdef CONFIG_ARCH_OMAP1
261
262static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
263
264void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
265{
266 BUG_ON(!_omap_sram_reprogram_clock);
267 /* On 730, bit 13 must always be 1 */
268 if (cpu_is_omap7xx())
269 ckctl |= 0x2000;
270 _omap_sram_reprogram_clock(dpllctl, ckctl);
271}
272
273static int __init omap1_sram_init(void)
274{
275 _omap_sram_reprogram_clock =
276 omap_sram_push(omap1_sram_reprogram_clock,
277 omap1_sram_reprogram_clock_sz);
278
279 return 0;
280}
281
282#else
283#define omap1_sram_init() do {} while (0)
284#endif
285
286#if defined(CONFIG_ARCH_OMAP2) 243#if defined(CONFIG_ARCH_OMAP2)
287 244
288static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, 245static void (*_omap2_sram_ddr_init)(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
@@ -407,14 +364,13 @@ static inline int am33xx_sram_init(void)
407 return 0; 364 return 0;
408} 365}
409 366
367#ifdef CONFIG_ARCH_OMAP2PLUS
410int __init omap_sram_init(void) 368int __init omap_sram_init(void)
411{ 369{
412 omap_detect_sram(); 370 omap_detect_sram();
413 omap_fix_and_map_sram(); 371 omap_fix_and_map_sram();
414 372
415 if (!(cpu_class_is_omap2())) 373 if (cpu_is_omap242x())
416 omap1_sram_init();
417 else if (cpu_is_omap242x())
418 omap242x_sram_init(); 374 omap242x_sram_init();
419 else if (cpu_is_omap2430()) 375 else if (cpu_is_omap2430())
420 omap243x_sram_init(); 376 omap243x_sram_init();
@@ -425,3 +381,4 @@ int __init omap_sram_init(void)
425 381
426 return 0; 382 return 0;
427} 383}
384#endif