Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 // Copyright (C) 2012-2014 Broadcom Corporation
0003 
0004 
0005 #include <linux/init.h>
0006 #include <linux/printk.h>
0007 #include <asm/hardware/cache-l2x0.h>
0008 
0009 #include "bcm_kona_smc.h"
0010 #include "kona_l2_cache.h"
0011 
0012 void __init kona_l2_cache_init(void)
0013 {
0014     unsigned int result;
0015     int ret;
0016 
0017     ret = bcm_kona_smc_init();
0018     if (ret) {
0019         pr_info("Secure API not available (%d). Skipping L2 init.\n",
0020             ret);
0021         return;
0022     }
0023 
0024     result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
0025     if (result != SEC_ROM_RET_OK) {
0026         pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
0027             result);
0028         return;
0029     }
0030 
0031     /*
0032      * The aux_val and aux_mask have no effect since L2 cache is already
0033      * enabled.  Pass 0s for aux_val and 1s for aux_mask for default value.
0034      */
0035     ret = l2x0_of_init(0, ~0);
0036     if (ret)
0037         pr_err("Couldn't enable L2 cache: %d\n", ret);
0038 }