cache.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. /* Tegra cache routines */
  17. #include <common.h>
  18. #include <asm/io.h>
  19. #include <asm/arch-tegra/ap.h>
  20. #include <asm/arch/gp_padctrl.h>
  21. void config_cache(void)
  22. {
  23. struct apb_misc_gp_ctlr *gp =
  24. (struct apb_misc_gp_ctlr *)NV_PA_APB_MISC_GP_BASE;
  25. u32 reg = 0;
  26. /* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */
  27. asm volatile(
  28. "mrc p15, 0, r0, c1, c0, 1\n"
  29. "orr r0, r0, #0x41\n"
  30. "mcr p15, 0, r0, c1, c0, 1\n");
  31. /* Currently, only T114 needs this L2 cache change to boot Linux */
  32. reg = (readl(&gp->hidrev) & HIDREV_CHIPID_MASK);
  33. if (reg != (CHIPID_TEGRA114 << HIDREV_CHIPID_SHIFT))
  34. return;
  35. /*
  36. * Systems with an architectural L2 cache must not use the PL310.
  37. * Config L2CTLR here for a data RAM latency of 3 cycles.
  38. */
  39. asm("mrc p15, 1, %0, c9, c0, 2" : : "r" (reg));
  40. reg &= ~7;
  41. reg |= 2;
  42. asm("mcr p15, 1, %0, c9, c0, 2" : : "r" (reg));
  43. }