cpu_init.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * (C) Copyright 2003
  3. * Josef Baumgartner <josef.baumgartner@telex.de>
  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 <watchdog.h>
  25. #ifdef CONFIG_M5272
  26. #include <asm/m5272.h>
  27. #include <asm/immap_5272.h>
  28. #endif
  29. #ifdef CONFIG_M5282
  30. #include <asm/m5282.h>
  31. #include <asm/immap_5282.h>
  32. #endif
  33. #ifdef CONFIG_M5272
  34. /*
  35. * Breath some life into the CPU...
  36. *
  37. * Set up the memory map,
  38. * initialize a bunch of registers,
  39. * initialize the UPM's
  40. */
  41. void cpu_init_f (void)
  42. {
  43. /* if we come from RAM we assume the CPU is
  44. * already initialized.
  45. */
  46. #ifndef CONFIG_MONITOR_IS_IN_RAM
  47. volatile immap_t *regp = (immap_t *)CFG_MBAR;
  48. volatile unsigned char *mbar;
  49. mbar = (volatile unsigned char *) CFG_MBAR;
  50. regp->sysctrl_reg.sc_scr = CFG_SCR;
  51. regp->sysctrl_reg.sc_spr = CFG_SPR;
  52. /* Setup Ports: */
  53. regp->gpio_reg.gpio_pacnt = CFG_PACNT;
  54. regp->gpio_reg.gpio_paddr = CFG_PADDR;
  55. regp->gpio_reg.gpio_padat = CFG_PADAT;
  56. regp->gpio_reg.gpio_pbcnt = CFG_PBCNT;
  57. regp->gpio_reg.gpio_pbddr = CFG_PBDDR;
  58. regp->gpio_reg.gpio_pbdat = CFG_PBDAT;
  59. regp->gpio_reg.gpio_pdcnt = CFG_PDCNT;
  60. /* Memory Controller: */
  61. regp->csctrl_reg.cs_br0 = CFG_BR0_PRELIM;
  62. regp->csctrl_reg.cs_or0 = CFG_OR0_PRELIM;
  63. #if (defined(CFG_OR1_PRELIM) && defined(CFG_BR1_PRELIM))
  64. regp->csctrl_reg.cs_br1 = CFG_BR1_PRELIM;
  65. regp->csctrl_reg.cs_or1 = CFG_OR1_PRELIM;
  66. #endif
  67. #if defined(CFG_OR2_PRELIM) && defined(CFG_BR2_PRELIM)
  68. regp->csctrl_reg.cs_br2 = CFG_BR2_PRELIM;
  69. regp->csctrl_reg.cs_or2 = CFG_OR2_PRELIM;
  70. #endif
  71. #if defined(CFG_OR3_PRELIM) && defined(CFG_BR3_PRELIM)
  72. regp->csctrl_reg.cs_br3 = CFG_BR3_PRELIM;
  73. regp->csctrl_reg.cs_or3 = CFG_OR3_PRELIM;
  74. #endif
  75. #if defined(CFG_OR4_PRELIM) && defined(CFG_BR4_PRELIM)
  76. regp->csctrl_reg.cs_br4 = CFG_BR4_PRELIM;
  77. regp->csctrl_reg.cs_or4 = CFG_OR4_PRELIM;
  78. #endif
  79. #if defined(CFG_OR5_PRELIM) && defined(CFG_BR5_PRELIM)
  80. regp->csctrl_reg.cs_br5 = CFG_BR5_PRELIM;
  81. regp->csctrl_reg.cs_or5 = CFG_OR5_PRELIM;
  82. #endif
  83. #if defined(CFG_OR6_PRELIM) && defined(CFG_BR6_PRELIM)
  84. regp->csctrl_reg.cs_br6 = CFG_BR6_PRELIM;
  85. regp->csctrl_reg.cs_or6 = CFG_OR6_PRELIM;
  86. #endif
  87. #if defined(CFG_OR7_PRELIM) && defined(CFG_BR7_PRELIM)
  88. regp->csctrl_reg.cs_br7 = CFG_BR7_PRELIM;
  89. regp->csctrl_reg.cs_or7 = CFG_OR7_PRELIM;
  90. #endif
  91. #endif /* #ifndef CONFIG_MONITOR_IS_IN_RAM */
  92. /* enable instruction cache now */
  93. icache_enable();
  94. }
  95. /*
  96. * initialize higher level parts of CPU like timers
  97. */
  98. int cpu_init_r (void)
  99. {
  100. return (0);
  101. }
  102. #endif /* #ifdef CONFIG_M5272 */
  103. #ifdef CONFIG_M5282
  104. /*
  105. * Breath some life into the CPU...
  106. *
  107. * Set up the memory map,
  108. * initialize a bunch of registers,
  109. * initialize the UPM's
  110. */
  111. void cpu_init_f (void)
  112. {
  113. }
  114. /*
  115. * initialize higher level parts of CPU like timers
  116. */
  117. int cpu_init_r (void)
  118. {
  119. return (0);
  120. }
  121. #endif