diff options
author | Tony Lindgren <tony@atomide.com> | 2012-10-29 17:46:30 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-10-31 13:14:14 -0400 |
commit | f205cfaf6c1287aca040c51c1789b46ed63a4d78 (patch) | |
tree | cad69f53dd0f2ccc2cf2aa1d74dbb113076a39d8 /arch/arm/mach-omap1/sram-init.c | |
parent | d8cfd6c8b4f58b0c09811eefa4b9e022c75099f7 (diff) |
ARM: OMAP: Move omap1 specific code to local sram.c
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>
Diffstat (limited to 'arch/arm/mach-omap1/sram-init.c')
-rw-r--r-- | arch/arm/mach-omap1/sram-init.c | 76 |
1 files changed, 76 insertions, 0 deletions
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 | */ | ||
35 | static 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 | |||
57 | static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl); | ||
58 | |||
59 | void 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 | |||
68 | int __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 | } | ||