cpu_init.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. *
  3. * (C) Copyright 2000-2003
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. *
  6. * (C) Copyright 2007 Freescale Semiconductor, Inc.
  7. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  8. *
  9. * See file CREDITS for list of people who contributed to this
  10. * project.
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License as
  14. * published by the Free Software Foundation; either version 2 of
  15. * the License, or (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. * MA 02111-1307 USA
  26. */
  27. #include <common.h>
  28. #include <watchdog.h>
  29. #include <asm/immap.h>
  30. /*
  31. * Breath some life into the CPU...
  32. *
  33. * Set up the memory map,
  34. * initialize a bunch of registers,
  35. * initialize the UPM's
  36. */
  37. void cpu_init_f(void)
  38. {
  39. volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
  40. volatile scm2_t *scm2 = (scm2_t *) MMAP_SCM2;
  41. volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
  42. volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
  43. volatile wdog_t *wdog = (wdog_t *) MMAP_WDOG;
  44. /* watchdog is enabled by default - disable the watchdog */
  45. #ifndef CONFIG_WATCHDOG
  46. wdog->cr = 0;
  47. #endif
  48. scm1->mpr0 = 0x77777777;
  49. scm2->pacra = 0;
  50. scm2->pacrb = 0;
  51. scm2->pacrc = 0;
  52. scm2->pacrd = 0;
  53. scm2->pacre = 0;
  54. scm2->pacrf = 0;
  55. scm2->pacrg = 0;
  56. scm1->pacrh = 0;
  57. /* Setup Ports: */
  58. switch (CFG_UART_PORT) {
  59. case 0:
  60. gpio->par_uart = (GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
  61. break;
  62. case 1:
  63. gpio->par_uart =
  64. (GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
  65. break;
  66. case 2:
  67. gpio->par_uart = (GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2);
  68. break;
  69. }
  70. /* Port configuration */
  71. gpio->par_cs = 0x3E;
  72. #if (defined(CFG_CS0_BASE) && defined(CFG_CS0_MASK) && defined(CFG_CS0_CTRL))
  73. fbcs->csar0 = CFG_CS0_BASE;
  74. fbcs->cscr0 = CFG_CS0_CTRL;
  75. fbcs->csmr0 = CFG_CS0_MASK;
  76. #endif
  77. #if (defined(CFG_CS1_BASE) && defined(CFG_CS1_MASK) && defined(CFG_CS1_CTRL))
  78. /* Latch chipselect */
  79. fbcs->csar1 = CFG_CS1_BASE;
  80. fbcs->cscr1 = CFG_CS1_CTRL;
  81. fbcs->csmr1 = CFG_CS1_MASK;
  82. #endif
  83. #if (defined(CFG_CS2_BASE) && defined(CFG_CS2_MASK) && defined(CFG_CS2_CTRL))
  84. fbcs->csar2 = CFG_CS2_BASE;
  85. fbcs->cscr2 = CFG_CS2_CTRL;
  86. fbcs->csmr2 = CFG_CS2_MASK;
  87. #endif
  88. #if (defined(CFG_CS3_BASE) && defined(CFG_CS3_MASK) && defined(CFG_CS3_CTRL))
  89. fbcs->csar3 = CFG_CS3_BASE;
  90. fbcs->cscr3 = CFG_CS3_CTRL;
  91. fbcs->csmr3 = CFG_CS3_MASK;
  92. #endif
  93. #if (defined(CFG_CS4_BASE) && defined(CFG_CS4_MASK) && defined(CFG_CS4_CTRL))
  94. fbcs->csar4 = CFG_CS4_BASE;
  95. fbcs->cscr4 = CFG_CS4_CTRL;
  96. fbcs->csmr4 = CFG_CS4_MASK;
  97. #endif
  98. #if (defined(CFG_CS5_BASE) && defined(CFG_CS5_MASK) && defined(CFG_CS5_CTRL))
  99. fbcs->csar5 = CFG_CS5_BASE;
  100. fbcs->cscr5 = CFG_CS5_CTRL;
  101. fbcs->csmr5 = CFG_CS5_MASK;
  102. #endif
  103. icache_enable();
  104. }
  105. /*
  106. * initialize higher level parts of CPU like timers
  107. */
  108. int cpu_init_r(void)
  109. {
  110. return (0);
  111. }