1 // SPDX-License-Identifier: GPL-2.0-only
3 * OMAP SRAM detection and management
5 * Copyright (C) 2005 Nokia Corporation
6 * Written by Tony Lindgren <tony@atomide.com>
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
14 #include <asm/fncpy.h>
16 #include <asm/cacheflush.h>
18 #include <asm/mach/map.h>
23 #define OMAP1_SRAM_PA 0x20000000
24 #define SRAM_BOOTLOADER_SZ 0x80
27 * The amount of SRAM depends on the core type.
28 * Note that we cannot try to test for SRAM here because writes
29 * to secure SRAM will hang the system. Also the SRAM is not
30 * yet mapped at this point.
32 static void __init
omap_detect_and_map_sram(void)
34 unsigned long omap_sram_skip
= SRAM_BOOTLOADER_SZ
;
35 unsigned long omap_sram_start
= OMAP1_SRAM_PA
;
36 unsigned long omap_sram_size
;
39 omap_sram_size
= 0x32000; /* 200K */
40 else if (cpu_is_omap15xx())
41 omap_sram_size
= 0x30000; /* 192K */
42 else if (cpu_is_omap1610() || cpu_is_omap1611() ||
43 cpu_is_omap1621() || cpu_is_omap1710())
44 omap_sram_size
= 0x4000; /* 16K */
46 pr_err("Could not detect SRAM size\n");
47 omap_sram_size
= 0x4000;
50 omap_map_sram(omap_sram_start
, omap_sram_size
,
54 static void (*_omap_sram_reprogram_clock
)(u32 dpllctl
, u32 ckctl
);
56 void omap_sram_reprogram_clock(u32 dpllctl
, u32 ckctl
)
58 BUG_ON(!_omap_sram_reprogram_clock
);
59 /* On 730, bit 13 must always be 1 */
62 _omap_sram_reprogram_clock(dpllctl
, ckctl
);
65 int __init
omap_sram_init(void)
67 omap_detect_and_map_sram();
68 _omap_sram_reprogram_clock
=
69 omap_sram_push(omap1_sram_reprogram_clock
,
70 omap1_sram_reprogram_clock_sz
);