Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / mach-omap1 / sram-init.c
blob3bd60708c34509de56128cbf0143f681011fc426
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * OMAP SRAM detection and management
5 * Copyright (C) 2005 Nokia Corporation
6 * Written by Tony Lindgren <tony@atomide.com>
7 */
9 #include <linux/module.h>
10 #include <linux/kernel.h>
11 #include <linux/init.h>
12 #include <linux/io.h>
14 #include <asm/fncpy.h>
15 #include <asm/tlb.h>
16 #include <asm/cacheflush.h>
18 #include <asm/mach/map.h>
20 #include "soc.h"
21 #include "sram.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;
38 if (cpu_is_omap7xx())
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 */
45 else {
46 pr_err("Could not detect SRAM size\n");
47 omap_sram_size = 0x4000;
50 omap_map_sram(omap_sram_start, omap_sram_size,
51 omap_sram_skip, 1);
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 */
60 if (cpu_is_omap7xx())
61 ckctl |= 0x2000;
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);
72 return 0;