kona_l2_cache.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2012-2014 Broadcom Corporation
  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. #include <linux/init.h>
  14. #include <linux/printk.h>
  15. #include <asm/hardware/cache-l2x0.h>
  16. #include "bcm_kona_smc.h"
  17. #include "kona_l2_cache.h"
  18. void __init kona_l2_cache_init(void)
  19. {
  20. unsigned int result;
  21. int ret;
  22. ret = bcm_kona_smc_init();
  23. if (ret) {
  24. pr_info("Secure API not available (%d). Skipping L2 init.\n",
  25. ret);
  26. return;
  27. }
  28. result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
  29. if (result != SEC_ROM_RET_OK) {
  30. pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
  31. result);
  32. return;
  33. }
  34. /*
  35. * The aux_val and aux_mask have no effect since L2 cache is already
  36. * enabled. Pass 0s for aux_val and 1s for aux_mask for default value.
  37. */
  38. ret = l2x0_of_init(0, ~0);
  39. if (ret)
  40. pr_err("Couldn't enable L2 cache: %d\n", ret);
  41. }