blob: b31970377c203bc3711f1de0ae0d31603c8312d8 [file] [log] [blame]
Markus Mayer257b49e2013-06-24 15:39:33 -07001/*
Markus Mayer8b1c3422014-02-25 14:17:43 -08002 * Copyright (C) 2012-2014 Broadcom Corporation
Markus Mayer257b49e2013-06-24 15:39:33 -07003 *
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
Alex Elderd5c627b2014-04-21 16:53:08 -050014
15#include <linux/init.h>
16#include <linux/printk.h>
Markus Mayer8b1c3422014-02-25 14:17:43 -080017#include <asm/hardware/cache-l2x0.h>
Markus Mayer257b49e2013-06-24 15:39:33 -070018
Markus Mayer8b1c3422014-02-25 14:17:43 -080019#include "bcm_kona_smc.h"
Markus Mayer257b49e2013-06-24 15:39:33 -070020
Markus Mayer8b1c3422014-02-25 14:17:43 -080021void __init kona_l2_cache_init(void)
22{
Alex Elder6c90f102014-04-21 16:53:05 -050023 unsigned int result;
Markus Mayer8b1c3422014-02-25 14:17:43 -080024 int ret;
25
Markus Mayer8b1c3422014-02-25 14:17:43 -080026 ret = bcm_kona_smc_init();
27 if (ret) {
28 pr_info("Secure API not available (%d). Skipping L2 init.\n",
29 ret);
30 return;
31 }
32
Alex Elder6c90f102014-04-21 16:53:05 -050033 result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
34 if (result != SEC_ROM_RET_OK) {
35 pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
36 result);
37 return;
38 }
Markus Mayer8b1c3422014-02-25 14:17:43 -080039
40 /*
41 * The aux_val and aux_mask have no effect since L2 cache is already
42 * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
43 */
44 ret = l2x0_of_init(0, ~0);
45 if (ret)
46 pr_err("Couldn't enable L2 cache: %d\n", ret);
47}