board.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. *
  3. * Common functions for OMAP4 based boards
  4. *
  5. * (C) Copyright 2010
  6. * Texas Instruments, <www.ti.com>
  7. *
  8. * Author :
  9. * Aneesh V <aneesh@ti.com>
  10. * Steve Sakoman <steve@sakoman.com>
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28. * MA 02111-1307 USA
  29. */
  30. #include <common.h>
  31. #include <asm/arch/cpu.h>
  32. #include <asm/arch/sys_proto.h>
  33. /*
  34. * Routine: s_init
  35. * Description: Does early system init of muxing and clocks.
  36. * - Called path is with SRAM stack.
  37. */
  38. void s_init(void)
  39. {
  40. watchdog_init();
  41. }
  42. /*
  43. * Routine: wait_for_command_complete
  44. * Description: Wait for posting to finish on watchdog
  45. */
  46. void wait_for_command_complete(struct watchdog *wd_base)
  47. {
  48. int pending = 1;
  49. do {
  50. pending = readl(&wd_base->wwps);
  51. } while (pending);
  52. }
  53. /*
  54. * Routine: watchdog_init
  55. * Description: Shut down watch dogs
  56. */
  57. void watchdog_init(void)
  58. {
  59. struct watchdog *wd2_base = (struct watchdog *)WDT2_BASE;
  60. writel(WD_UNLOCK1, &wd2_base->wspr);
  61. wait_for_command_complete(wd2_base);
  62. writel(WD_UNLOCK2, &wd2_base->wspr);
  63. }
  64. /*
  65. * Routine: dram_init
  66. * Description: sets uboots idea of sdram size
  67. */
  68. int dram_init(void)
  69. {
  70. DECLARE_GLOBAL_DATA_PTR;
  71. gd->bd->bi_dram[0].start = 0x80000000;
  72. gd->bd->bi_dram[0].size = 512 << 20;
  73. return 0;
  74. }
  75. /*
  76. * Print board information
  77. */
  78. int checkboard(void)
  79. {
  80. puts(sysinfo.board_string);
  81. return 0;
  82. }
  83. /*
  84. * This function is called by start_armboot. You can reliably use static
  85. * data. Any boot-time function that require static data should be
  86. * called from here
  87. */
  88. int arch_cpu_init(void)
  89. {
  90. set_muxconf_regs();
  91. return 0;
  92. }