cache.c 881 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0
  5. */
  6. /* Tegra cache routines */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/arch-tegra/ap.h>
  10. #include <asm/arch/gp_padctrl.h>
  11. #ifndef CONFIG_ARM64
  12. void config_cache(void)
  13. {
  14. u32 reg = 0;
  15. /* enable SMP mode and FW for CPU0, by writing to Auxiliary Ctl reg */
  16. asm volatile(
  17. "mrc p15, 0, r0, c1, c0, 1\n"
  18. "orr r0, r0, #0x41\n"
  19. "mcr p15, 0, r0, c1, c0, 1\n");
  20. /* Currently, only Tegra114+ needs this L2 cache change to boot Linux */
  21. if (tegra_get_chip() < CHIPID_TEGRA114)
  22. return;
  23. /*
  24. * Systems with an architectural L2 cache must not use the PL310.
  25. * Config L2CTLR here for a data RAM latency of 3 cycles.
  26. */
  27. asm("mrc p15, 1, %0, c9, c0, 2" : : "r" (reg));
  28. reg &= ~7;
  29. reg |= 2;
  30. asm("mcr p15, 1, %0, c9, c0, 2" : : "r" (reg));
  31. }
  32. #endif