ARM: bcm: have bcm_kona_smc() return request result
[deliverable/linux.git] / arch / arm / mach-bcm / kona.c
CommitLineData
257b49e3 1/*
8b1c3426 2 * Copyright (C) 2012-2014 Broadcom Corporation
257b49e3
MM
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
8b1c3426
MM
14#include <linux/of_platform.h>
15#include <asm/hardware/cache-l2x0.h>
257b49e3 16
8b1c3426 17#include "bcm_kona_smc.h"
257b49e3
MM
18#include "kona.h"
19
8b1c3426
MM
20void __init kona_l2_cache_init(void)
21{
6c90f108 22 unsigned int result;
8b1c3426
MM
23 int ret;
24
25 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
26 return;
27
28 ret = bcm_kona_smc_init();
29 if (ret) {
30 pr_info("Secure API not available (%d). Skipping L2 init.\n",
31 ret);
32 return;
33 }
34
6c90f108
AE
35 result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
36 if (result != SEC_ROM_RET_OK) {
37 pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
38 result);
39 return;
40 }
8b1c3426
MM
41
42 /*
43 * The aux_val and aux_mask have no effect since L2 cache is already
44 * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
45 */
46 ret = l2x0_of_init(0, ~0);
47 if (ret)
48 pr_err("Couldn't enable L2 cache: %d\n", ret);
49}
This page took 0.055082 seconds and 5 git commands to generate.