cpu.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (c) 2010-2012, 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. #include <common.h>
  17. #include <asm/io.h>
  18. #include <asm/arch/tegra.h>
  19. #include <asm/arch-tegra/pmc.h>
  20. #include "../tegra-common/cpu.h"
  21. static void enable_cpu_power_rail(void)
  22. {
  23. struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
  24. u32 reg;
  25. reg = readl(&pmc->pmc_cntrl);
  26. reg |= CPUPWRREQ_OE;
  27. writel(reg, &pmc->pmc_cntrl);
  28. /*
  29. * The TI PMU65861C needs a 3.75ms delay between enabling
  30. * the power rail and enabling the CPU clock. This delay
  31. * between SM1EN and SM1 is for switching time + the ramp
  32. * up of the voltage to the CPU (VDD_CPU from PMU).
  33. */
  34. udelay(3750);
  35. }
  36. void start_cpu(u32 reset_vector)
  37. {
  38. /* Enable VDD_CPU */
  39. enable_cpu_power_rail();
  40. /* Hold the CPUs in reset */
  41. reset_A9_cpu(1);
  42. /* Disable the CPU clock */
  43. enable_cpu_clock(0);
  44. /* Enable CoreSight */
  45. clock_enable_coresight(1);
  46. /*
  47. * Set the entry point for CPU execution from reset,
  48. * if it's a non-zero value.
  49. */
  50. if (reset_vector)
  51. writel(reset_vector, EXCEP_VECTOR_CPU_RESET_VECTOR);
  52. /* Enable the CPU clock */
  53. enable_cpu_clock(1);
  54. /* If the CPU doesn't already have power, power it up */
  55. powerup_cpu();
  56. /* Take the CPU out of reset */
  57. reset_A9_cpu(0);
  58. }