cpu.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2010-2012, NVIDIA CORPORATION. All rights reserved.
  4. */
  5. #include <common.h>
  6. #include <asm/io.h>
  7. #include <asm/arch/tegra.h>
  8. #include <asm/arch-tegra/pmc.h>
  9. #include "../cpu.h"
  10. static void enable_cpu_power_rail(void)
  11. {
  12. struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
  13. u32 reg;
  14. reg = readl(&pmc->pmc_cntrl);
  15. reg |= CPUPWRREQ_OE;
  16. writel(reg, &pmc->pmc_cntrl);
  17. /*
  18. * The TI PMU65861C needs a 3.75ms delay between enabling
  19. * the power rail and enabling the CPU clock. This delay
  20. * between SM1EN and SM1 is for switching time + the ramp
  21. * up of the voltage to the CPU (VDD_CPU from PMU).
  22. */
  23. udelay(3750);
  24. }
  25. void start_cpu(u32 reset_vector)
  26. {
  27. /* Enable VDD_CPU */
  28. enable_cpu_power_rail();
  29. /* Hold the CPUs in reset */
  30. reset_A9_cpu(1);
  31. /* Disable the CPU clock */
  32. enable_cpu_clock(0);
  33. /* Enable CoreSight */
  34. clock_enable_coresight(1);
  35. /*
  36. * Set the entry point for CPU execution from reset,
  37. * if it's a non-zero value.
  38. */
  39. if (reset_vector)
  40. writel(reset_vector, EXCEP_VECTOR_CPU_RESET_VECTOR);
  41. /* Enable the CPU clock */
  42. enable_cpu_clock(1);
  43. /* If the CPU doesn't already have power, power it up */
  44. powerup_cpu();
  45. /* Take the CPU out of reset */
  46. reset_A9_cpu(0);
  47. }