kona_l2_cache.c 856 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. // Copyright (C) 2012-2014 Broadcom Corporation
  3. #include <linux/init.h>
  4. #include <linux/printk.h>
  5. #include <asm/hardware/cache-l2x0.h>
  6. #include "bcm_kona_smc.h"
  7. #include "kona_l2_cache.h"
  8. void __init kona_l2_cache_init(void)
  9. {
  10. unsigned int result;
  11. int ret;
  12. ret = bcm_kona_smc_init();
  13. if (ret) {
  14. pr_info("Secure API not available (%d). Skipping L2 init.\n",
  15. ret);
  16. return;
  17. }
  18. result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
  19. if (result != SEC_ROM_RET_OK) {
  20. pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
  21. result);
  22. return;
  23. }
  24. /*
  25. * The aux_val and aux_mask have no effect since L2 cache is already
  26. * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
  27. */
  28. ret = l2x0_of_init(0, ~0);
  29. if (ret)
  30. pr_err("Couldn't enable L2 cache: %d\n", ret);
  31. }