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
  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/m5329.h>
  30. #include <asm/immap_5329.h>
  31. /*
  32. * Breath some life into the CPU...
  33. *
  34. * Set up the memory map,
  35. * initialize a bunch of registers,
  36. * initialize the UPM's
  37. */
  38. void cpu_init_f(void)
  39. {
  40. volatile scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
  41. volatile scm2_t *scm2 = (scm2_t *) MMAP_SCM2;
  42. volatile gpio_t *gpio = (gpio_t *) MMAP_GPIO;
  43. volatile fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
  44. volatile wdog_t *wdog = (wdog_t *) MMAP_WDOG;
  45. /* watchdog is enabled by default - disable the watchdog */
  46. #ifndef CONFIG_WATCHDOG
  47. wdog->cr = 0;
  48. #endif
  49. scm1->mpr0 = 0x77777777;
  50. scm2->pacra = 0;
  51. scm2->pacrb = 0;
  52. scm2->pacrc = 0;
  53. scm2->pacrd = 0;
  54. scm2->pacre = 0;
  55. scm2->pacrf = 0;
  56. scm2->pacrg = 0;
  57. scm1->pacrh = 0;
  58. /* Setup Ports: */
  59. switch (CFG_UART_PORT) {
  60. case 0:
  61. gpio->par_uart = (GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
  62. break;
  63. case 1:
  64. gpio->par_uart =
  65. (GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
  66. break;
  67. case 2:
  68. gpio->par_uart = (GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2);
  69. break;
  70. }
  71. /* Port configuration */
  72. gpio->par_cs = 0x3E;
  73. #if (defined(CFG_CS0_BASE) && defined(CFG_CS0_MASK) && defined(CFG_CS0_CTRL))
  74. fbcs->csar0 = CFG_CS0_BASE;
  75. fbcs->cscr0 = CFG_CS0_CTRL;
  76. fbcs->csmr0 = CFG_CS0_MASK;
  77. #endif
  78. #if (defined(CFG_CS1_BASE) && defined(CFG_CS1_MASK) && defined(CFG_CS1_CTRL))
  79. /* Latch chipselect */
  80. fbcs->csar1 = CFG_CS1_BASE;
  81. fbcs->cscr1 = CFG_CS1_CTRL;
  82. fbcs->csmr1 = CFG_CS1_MASK;
  83. #endif
  84. #if (defined(CFG_CS2_BASE) && defined(CFG_CS2_MASK) && defined(CFG_CS2_CTRL))
  85. fbcs->csar2 = CFG_CS2_BASE;
  86. fbcs->cscr2 = CFG_CS2_CTRL;
  87. fbcs->csmr2 = CFG_CS2_MASK;
  88. #endif
  89. #if (defined(CFG_CS3_BASE) && defined(CFG_CS3_MASK) && defined(CFG_CS3_CTRL))
  90. fbcs->csar3 = CFG_CS3_BASE;
  91. fbcs->cscr3 = CFG_CS3_CTRL;
  92. fbcs->csmr3 = CFG_CS3_MASK;
  93. #endif
  94. #if (defined(CFG_CS4_BASE) && defined(CFG_CS4_MASK) && defined(CFG_CS4_CTRL))
  95. fbcs->csar4 = CFG_CS4_BASE;
  96. fbcs->cscr4 = CFG_CS4_CTRL;
  97. fbcs->csmr4 = CFG_CS4_MASK;
  98. #endif
  99. #if (defined(CFG_CS5_BASE) && defined(CFG_CS5_MASK) && defined(CFG_CS5_CTRL))
  100. fbcs->csar5 = CFG_CS5_BASE;
  101. fbcs->cscr5 = CFG_CS5_CTRL;
  102. fbcs->csmr5 = CFG_CS5_MASK;
  103. #endif
  104. }
  105. /*
  106. * initialize higher level parts of CPU like timers
  107. */
  108. int cpu_init_r(void)
  109. {
  110. /*icache_enable(); */
  111. return (0);
  112. }