board.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. void s_init(void)
  52. {
  53. #ifndef CONFIG_ICACHE_OFF
  54. icache_enable();
  55. #endif
  56. invalidate_dcache();
  57. }
  58. int dram_init(void)
  59. {
  60. unsigned long rs;
  61. /* We do not initialise DRAM here. We just query the size */
  62. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  63. gd->bd->bi_dram[0].size = gd->ram_size = query_sdram_size();
  64. /* Now check it dynamically */
  65. rs = get_ram_size(CONFIG_SYS_SDRAM_BASE, gd->ram_size);
  66. if (rs) {
  67. printf("dynamic ram_size = %lu\n", rs);
  68. gd->bd->bi_dram[0].size = gd->ram_size = rs;
  69. }
  70. return 0;
  71. }
  72. #ifdef CONFIG_DISPLAY_BOARDINFO
  73. int checkboard(void)
  74. {
  75. printf("Board: %s\n", sysinfo.board_string);
  76. return 0;
  77. }
  78. #endif /* CONFIG_DISPLAY_BOARDINFO */
  79. #ifdef CONFIG_ARCH_CPU_INIT
  80. /*
  81. * Note this function is executed by the ARM7TDMI AVP. It does not return
  82. * in this case. It is also called once the A9 starts up, but does nothing in
  83. * that case.
  84. */
  85. int arch_cpu_init(void)
  86. {
  87. /* Fire up the Cortex A9 */
  88. tegra2_start();
  89. return 0;
  90. }
  91. #endif