board.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 <asm/arch/sys_proto.h>
  26. #include <asm/arch/tegra2.h>
  27. #include <asm/arch/pmc.h>
  28. DECLARE_GLOBAL_DATA_PTR;
  29. /*
  30. * Boot ROM initializes the odmdata in APBDEV_PMC_SCRATCH20_0,
  31. * so we are using this value to identify memory size.
  32. */
  33. unsigned int query_sdram_size(void)
  34. {
  35. struct pmc_ctlr *const pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
  36. u32 reg;
  37. reg = readl(&pmc->pmc_scratch20);
  38. debug("pmc->pmc_scratch20 (ODMData) = 0x%08x\n", reg);
  39. /* bits 31:28 in OdmData are used for RAM size */
  40. switch ((reg) >> 28) {
  41. case 1:
  42. return 0x10000000; /* 256 MB */
  43. case 2:
  44. return 0x20000000; /* 512 MB */
  45. case 3:
  46. default:
  47. return 0x40000000; /* 1GB */
  48. }
  49. }
  50. void s_init(void)
  51. {
  52. #ifndef CONFIG_ICACHE_OFF
  53. icache_enable();
  54. #endif
  55. invalidate_dcache();
  56. }
  57. int dram_init(void)
  58. {
  59. unsigned long rs;
  60. /* We do not initialise DRAM here. We just query the size */
  61. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  62. gd->bd->bi_dram[0].size = gd->ram_size = query_sdram_size();
  63. /* Now check it dynamically */
  64. rs = get_ram_size(CONFIG_SYS_SDRAM_BASE, gd->ram_size);
  65. if (rs) {
  66. printf("dynamic ram_size = %lu\n", rs);
  67. gd->bd->bi_dram[0].size = gd->ram_size = rs;
  68. }
  69. return 0;
  70. }
  71. #ifdef CONFIG_DISPLAY_BOARDINFO
  72. int checkboard(void)
  73. {
  74. printf("Board: %s\n", sysinfo.board_string);
  75. return 0;
  76. }
  77. #endif /* CONFIG_DISPLAY_BOARDINFO */