Merge commit 'v3.15' into next
[sfrench/cifs-2.6.git] / arch / arm / mach-bcm / kona.c
1 /*
2  * Copyright (C) 2012-2014 Broadcom Corporation
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation version 2.
7  *
8  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9  * kind, whether express or implied; without even the implied warranty
10  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13
14 #include <linux/of_platform.h>
15 #include <asm/hardware/cache-l2x0.h>
16
17 #include "bcm_kona_smc.h"
18 #include "kona.h"
19
20 void __init kona_l2_cache_init(void)
21 {
22         int ret;
23
24         if (!IS_ENABLED(CONFIG_CACHE_L2X0))
25                 return;
26
27         ret = bcm_kona_smc_init();
28         if (ret) {
29                 pr_info("Secure API not available (%d). Skipping L2 init.\n",
30                         ret);
31                 return;
32         }
33
34         bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
35
36         /*
37          * The aux_val and aux_mask have no effect since L2 cache is already
38          * enabled.  Pass 0s for aux_val and 1s for aux_mask for default value.
39          */
40         ret = l2x0_of_init(0, ~0);
41         if (ret)
42                 pr_err("Couldn't enable L2 cache: %d\n", ret);
43 }