svm_sc8xx.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * (C) Copyright 2000, 2001, 2002
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.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 <mpc8xx.h>
  25. /* ------------------------------------------------------------------------- */
  26. const uint sdram_table[] =
  27. {
  28. /*-----------------
  29. UPM A contents:
  30. ----------------- */
  31. /*---------------------------------------------------
  32. Read Single Beat Cycle. Offset 0 in the RAM array.
  33. ---------------------------------------------------- */
  34. 0x1f07fc04, 0xeeaefc04, 0x11adfc04, 0xefbbbc00 ,
  35. 0x1ff77c47, 0x1ff77c35, 0xefeabc34, 0x1fb57c35 ,
  36. /*------------------------------------------------
  37. Read Burst Cycle. Offset 0x8 in the RAM array.
  38. ------------------------------------------------ */
  39. 0x1f07fc04, 0xeeaefc04, 0x10adfc04, 0xf0affc00,
  40. 0xf0affc00, 0xf1affc00, 0xefbbbc00, 0x1ff77c47,
  41. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
  42. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
  43. /*-------------------------------------------------------
  44. Write Single Beat Cycle. Offset 0x18 in the RAM array
  45. ------------------------------------------------------- */
  46. 0x1f27fc04, 0xeeaebc00, 0x01b93c04, 0x1ff77c47 ,
  47. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff ,
  48. /*-------------------------------------------------
  49. Write Burst Cycle. Offset 0x20 in the RAM array
  50. ------------------------------------------------- */
  51. 0x1f07fc04, 0xeeaebc00, 0x10ad7c00, 0xf0affc00,
  52. 0xf0affc00, 0xe1bbbc04, 0x1ff77c47, 0xffffffff,
  53. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff ,
  54. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff ,
  55. /*------------------------------------------------------------------------
  56. Periodic Timer Expired. For DRAM refresh. Offset 0x30 in the RAM array
  57. ------------------------------------------------------------------------ */
  58. 0x1ff5fc84, 0xfffffc04, 0xfffffc04, 0xfffffc04,
  59. 0xfffffc84, 0xfffffc07, 0xffffffff, 0xffffffff,
  60. 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff ,
  61. /*-----------
  62. * Exception:
  63. * ----------- */
  64. 0x7ffefc07, 0xffffffff, 0xffffffff, 0xffffffff ,
  65. };
  66. /* ------------------------------------------------------------------------- */
  67. /*
  68. * Check Board Identity:
  69. *
  70. * Test ID string (SVM8...)
  71. *
  72. * Return 1 for "SC8xx" type, 0 else.
  73. */
  74. int checkboard (void)
  75. {
  76. char *s = getenv("serial#");
  77. int board_type;
  78. if (!s || strncmp(s, "SVM8", 4)) {
  79. printf ("### No HW ID - assuming SVM SC8xx\n");
  80. return (0);
  81. }
  82. board_type = 1;
  83. for (; *s; ++s) {
  84. if (*s == ' ')
  85. break;
  86. putc (*s);
  87. }
  88. putc ('\n');
  89. return (0);
  90. }
  91. /* ------------------------------------------------------------------------- */
  92. long int initdram (int board_type)
  93. {
  94. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  95. volatile memctl8xx_t *memctl = &immap->im_memctl;
  96. long int size_b0 = 0;
  97. upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
  98. memctl->memc_mptpr = CFG_MPTPR;
  99. #if defined (CONFIG_SDRAM_16M)
  100. memctl->memc_mamr = 0x00802114 | CFG_MxMR_PTx;
  101. memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
  102. udelay(1);
  103. memctl->memc_mcr = 0x80002830;
  104. udelay(1);
  105. memctl->memc_mar = 0x00000088;
  106. udelay(1);
  107. memctl->memc_mcr = 0x80002106;
  108. udelay(1);
  109. memctl->memc_or1 = 0xff000a00;
  110. size_b0 = 0x01000000;
  111. #elif defined (CONFIG_SDRAM_32M)
  112. memctl->memc_mamr = 0x00904114 | CFG_MxMR_PTx;
  113. memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
  114. udelay(1);
  115. memctl->memc_mcr = 0x80002830;
  116. udelay(1);
  117. memctl->memc_mar = 0x00000088;
  118. udelay(1);
  119. memctl->memc_mcr = 0x80002106;
  120. udelay(1);
  121. memctl->memc_or1 = 0xfe000a00;
  122. size_b0 = 0x02000000;
  123. #elif defined (CONFIG_SDRAM_64M)
  124. memctl->memc_mamr = 0x00a04114 | CFG_MxMR_PTx;
  125. memctl->memc_mcr = 0x80002105; /* SDRAM bank 0 */
  126. udelay(1);
  127. memctl->memc_mcr = 0x80002830;
  128. udelay(1);
  129. memctl->memc_mar = 0x00000088;
  130. udelay(1);
  131. memctl->memc_mcr = 0x80002106;
  132. udelay(1);
  133. memctl->memc_or1 = 0xfc000a00;
  134. size_b0 = 0x04000000;
  135. #else
  136. #error SDRAM size configuration missing.
  137. #endif
  138. memctl->memc_br1 = 0x00000081;
  139. udelay(200);
  140. return (size_b0 );
  141. }
  142. #if defined(CONFIG_CMD_DOC)
  143. extern void doc_probe (ulong physadr);
  144. void doc_init (void)
  145. {
  146. doc_probe (CFG_DOC_BASE);
  147. }
  148. #endif