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>
17 #include <asm/fncpy.h>
19 #include <asm/cacheflush.h>
21 #include <asm/mach/map.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;
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 */
49 pr_err("Could not detect SRAM size\n");
50 omap_sram_size = 0x4000;
53 omap_map_sram(omap_sram_start, omap_sram_size,
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 */
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);