2 * Copyright (c) 2010 Samsung Electronics.
3 * Minkyu Kang <mk7.kang@samsung.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <asm/system.h>
12 enum l2_cache_params {
13 CACHE_TAG_RAM_SETUP = (1 << 9),
14 CACHE_DATA_RAM_SETUP = (1 << 5),
15 CACHE_TAG_RAM_LATENCY = (2 << 6),
16 CACHE_DATA_RAM_LATENCY = (2 << 0),
17 CACHE_ENABLE_CLEAN_EVICT = (0 << 3),
18 CACHE_DISABLE_CLEAN_EVICT = (1 << 3)
21 void reset_cpu(ulong addr)
23 writel(0x1, samsung_get_base_swreset());
26 #ifndef CONFIG_SYS_DCACHE_OFF
27 void enable_caches(void)
29 /* Enable D-cache. I-cache is already enabled in start.S */
34 #ifndef CONFIG_SYS_L2CACHE_OFF
36 * Set L2 cache parameters
38 static void exynos5_set_l2cache_params(void)
42 /* Read L2CTLR value */
43 asm volatile("mrc p15, 1, %0, c9, c0, 2\n" : "=r"(val));
45 /* Set cache setup and latency cycles */
46 val |= CACHE_TAG_RAM_SETUP |
47 CACHE_DATA_RAM_SETUP |
48 CACHE_TAG_RAM_LATENCY |
49 CACHE_DATA_RAM_LATENCY;
51 /* Write new vlaue to L2CTLR */
52 asm volatile("mcr p15, 1, %0, c9, c0, 2\n" : : "r"(val));
54 if (proid_is_exynos5420() || proid_is_exynos5800()) {
55 /* Read L2ACTLR value */
56 asm volatile("mrc p15, 1, %0, c15, c0, 0" : "=r" (val));
58 /* Disable clean/evict push to external */
59 val |= CACHE_DISABLE_CLEAN_EVICT;
61 /* Write new vlaue to L2ACTLR */
62 asm volatile("mcr p15, 1, %0, c15, c0, 0" : : "r" (val));
67 * Sets L2 cache related parameters before enabling data cache
69 void v7_outer_cache_enable(void)
72 exynos5_set_l2cache_params();