Markus Mayer | 257b49e | 2013-06-24 15:39:33 -0700 | [diff] [blame] | 1 | /* |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 2 | * Copyright (C) 2012-2014 Broadcom Corporation |
Markus Mayer | 257b49e | 2013-06-24 15:39:33 -0700 | [diff] [blame] | 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 | |
Alex Elder | d5c627b | 2014-04-21 16:53:08 -0500 | [diff] [blame] | 14 | |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/printk.h> |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 17 | #include <asm/hardware/cache-l2x0.h> |
Markus Mayer | 257b49e | 2013-06-24 15:39:33 -0700 | [diff] [blame] | 18 | |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 19 | #include "bcm_kona_smc.h" |
Ben Dooks | 423779c | 2016-06-08 17:35:58 +0100 | [diff] [blame] | 20 | #include "kona_l2_cache.h" |
Markus Mayer | 257b49e | 2013-06-24 15:39:33 -0700 | [diff] [blame] | 21 | |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 22 | void __init kona_l2_cache_init(void) |
| 23 | { |
Alex Elder | 6c90f10 | 2014-04-21 16:53:05 -0500 | [diff] [blame] | 24 | unsigned int result; |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 25 | int ret; |
| 26 | |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 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 | |
Alex Elder | 6c90f10 | 2014-04-21 16:53:05 -0500 | [diff] [blame] | 34 | result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); |
| 35 | if (result != SEC_ROM_RET_OK) { |
| 36 | pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n", |
| 37 | result); |
| 38 | return; |
| 39 | } |
Markus Mayer | 8b1c342 | 2014-02-25 14:17:43 -0800 | [diff] [blame] | 40 | |
| 41 | /* |
| 42 | * The aux_val and aux_mask have no effect since L2 cache is already |
| 43 | * enabled. Pass 0s for aux_val and 1s for aux_mask for default value. |
| 44 | */ |
| 45 | ret = l2x0_of_init(0, ~0); |
| 46 | if (ret) |
| 47 | pr_err("Couldn't enable L2 cache: %d\n", ret); |
| 48 | } |