board.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * (C) Copyright 2010,2011
  3. * NVIDIA Corporation <www.nvidia.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <asm/io.h>
  25. #include "ap20.h"
  26. #include <asm/arch/sys_proto.h>
  27. #include <asm/arch/tegra2.h>
  28. #include <asm/arch/pmc.h>
  29. DECLARE_GLOBAL_DATA_PTR;
  30. /*
  31. * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0,
  32. * so we are using this value to identify memory size.
  33. */
  34. unsigned int query_sdram_size(void)
  35. {
  36. struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
  37. u32 reg;
  38. reg = readl(&pmc->pmc_scratch20);
  39. debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg);
  40. /* bits 31:28 in OdmData are used for RAM size */
  41. switch ((reg) >> 28) {
  42. case 1:
  43. return 0x10000000; /* 256 MB */
  44. case 2:
  45. return 0x20000000; /* 512 MB */
  46. case 3:
  47. default:
  48. return 0x40000000; /* 1GB */
  49. }
  50. }
  51. int dram_init(void)
  52. {
  53. /* We do not initialise DRAM here. We just query the size */
  54. gd->ram_size = query_sdram_size();
  55. return 0;
  56. }
  57. #ifdef CONFIG_DISPLAY_BOARDINFO
  58. int checkboard(void)
  59. {
  60. printf("Board: %s\n", sysinfo.board_string);
  61. return 0;
  62. }
  63. #endif /* CONFIG_DISPLAY_BOARDINFO */
  64. #ifdef CONFIG_ARCH_CPU_INIT
  65. /*
  66. * Note this function is executed by the ARM7TDMI AVP. It does not return
  67. * in this case. It is also called once the A9 starts up, but does nothing in
  68. * that case.
  69. */
  70. int arch_cpu_init(void)
  71. {
  72. /* Fire up the Cortex A9 */
  73. tegra2_start();
  74. /* We didn't do this init in start.S, so do it now */
  75. cpu_init_cp15();
  76. /* Initialize essential common plls */
  77. clock_early_init();
  78. return 0;
  79. }
  80. #endif