Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / arm / mach-omap1 / sram-init.c
blob6431b0f862ce1afe190573a859b7f91204183422
1 /*
2 * OMAP SRAM detection and management
4 * Copyright (C) 2005 Nokia Corporation
5 * Written by Tony Lindgren <tony@atomide.com>
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.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/io.h>
17 #include <asm/fncpy.h>
18 #include <asm/tlb.h>
19 #include <asm/cacheflush.h>
21 #include <asm/mach/map.h>
23 #include "soc.h"
24 #include "sram.h"
26 #define OMAP1_SRAM_PA 0x20000000
27 #define SRAM_BOOTLOADER_SZ 0x80
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.
35 static void __init omap_detect_and_map_sram(void)
37 unsigned long omap_sram_skip = SRAM_BOOTLOADER_SZ;
38 unsigned long omap_sram_start = OMAP1_SRAM_PA;
39 unsigned long omap_sram_size;
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;
53 omap_map_sram(omap_sram_start, omap_sram_size,
54 omap_sram_skip, 1);
57 static void (*_omap_sram_reprogram_clock)(u32 dpllctl, u32 ckctl);
59 void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl)
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);
68 int __init omap_sram_init(void)
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);
75 return 0;