xref: /linux/arch/arm/mach-bcm/kona_l2_cache.c (revision 6c8c1406)
1 // SPDX-License-Identifier: GPL-2.0-only
2 // Copyright (C) 2012-2014 Broadcom Corporation
3 
4 
5 #include <linux/init.h>
6 #include <linux/printk.h>
7 #include <asm/hardware/cache-l2x0.h>
8 
9 #include "bcm_kona_smc.h"
10 #include "kona_l2_cache.h"
11 
12 void __init kona_l2_cache_init(void)
13 {
14 	unsigned int result;
15 	int ret;
16 
17 	ret = bcm_kona_smc_init();
18 	if (ret) {
19 		pr_info("Secure API not available (%d). Skipping L2 init.\n",
20 			ret);
21 		return;
22 	}
23 
24 	result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
25 	if (result != SEC_ROM_RET_OK) {
26 		pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
27 			result);
28 		return;
29 	}
30 
31 	/*
32 	 * The aux_val and aux_mask have no effect since L2 cache is already
33 	 * enabled.  Pass 0s for aux_val and 1s for aux_mask for default value.
34 	 */
35 	ret = l2x0_of_init(0, ~0);
36 	if (ret)
37 		pr_err("Couldn't enable L2 cache: %d\n", ret);
38 }
39