flagadm.c 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * (C) Copyright 2001
  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. #define _NOT_USED_ 0xFFFFFFFF
  26. /*Orginal table, GPL4 disabled*/
  27. const uint sdram_table[] =
  28. {
  29. /* single read (offset 0x00 in upm ram) */
  30. 0x1f07cc04, 0xeeaeec04, 0x11adcc04, 0xefbbac00,
  31. 0x1ff74c47,
  32. /* Precharge */
  33. 0x1FF74C05,
  34. _NOT_USED_,
  35. _NOT_USED_,
  36. /* burst read (offset 0x08 in upm ram) */
  37. 0x1f07cc04, 0xeeaeec04, 0x00adcc04, 0x00afcc00,
  38. 0x00afcc00, 0x01afcc00, 0x0fbb8c00, 0x1ff74c47,
  39. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  40. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  41. /* single write (offset 0x18 in upm ram) */
  42. 0x1f27cc04, 0xeeaeac00, 0x01b90c04, 0x1ff74c47,
  43. /* Load moderegister */
  44. 0x1FF74C34, /*Precharge*/
  45. 0xEFEA8C34, /*NOP*/
  46. 0x1FB54C35, /*Load moderegister*/
  47. _NOT_USED_,
  48. /* burst write (offset 0x20 in upm ram) */
  49. 0x1f07cc04, 0xeeaeac00, 0x00ad4c00, 0x00afcc00,
  50. 0x00afcc00, 0x01bb8c04, 0x1ff74c47, _NOT_USED_,
  51. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  52. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  53. /* refresh (offset 0x30 in upm ram) */
  54. 0x1ff5cc84, 0xffffec04, 0xffffec04, 0xffffec04,
  55. 0xffffec84, 0xffffec07, _NOT_USED_, _NOT_USED_,
  56. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  57. /* exception (offset 0x3C in upm ram) */
  58. 0x7fffec07, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  59. };
  60. /* GPL5 driven every cycle */
  61. /* the display and the DSP */
  62. const uint dsp_disp_table[] =
  63. {
  64. /* single read (offset 0x00 in upm ram) */
  65. 0xffffc80c, 0xffffc004, 0x0fffc004, 0x0fffd004,
  66. 0x0fffc000, 0x0fffc004, 0x3fffc004, 0xffffcc05,
  67. /* burst read (offset 0x08 in upm ram) */
  68. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  69. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  70. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  71. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  72. /* single write (offset 0x18 in upm ram) */
  73. 0xffffcc0c, 0xffffc004, 0x0fffc004, 0x0fffd004,
  74. 0x0fffc000, 0x0fffc004, 0x7fffc004, 0xfffffc05,
  75. /* burst write (offset 0x20 in upm ram) */
  76. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  77. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  78. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  79. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  80. /* refresh (offset 0x30 in upm ram) */
  81. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  82. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  83. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  84. /* exception (offset 0x3C in upm ram) */
  85. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  86. };
  87. int checkboard (void)
  88. {
  89. puts ("Board: FlagaDM V3.0\n");
  90. return 0;
  91. }
  92. phys_size_t 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;
  97. memctl->memc_or2 = CFG_OR2;
  98. memctl->memc_br2 = CFG_BR2;
  99. udelay(100);
  100. upmconfig(UPMA, (uint *)sdram_table, sizeof(sdram_table)/sizeof(uint));
  101. memctl->memc_mptpr = MPTPR_PTP_DIV16;
  102. memctl->memc_mamr = CFG_MAMR_48_SDR | MAMR_TLFA_1X;
  103. /*Do the initialization of the SDRAM*/
  104. /*Start with the precharge cycle*/
  105. memctl->memc_mcr = (MCR_OP_RUN | MCR_UPM_A | MCR_MB_CS2 | \
  106. MCR_MLCF(1) | MCR_MAD(0x5));
  107. /*Then we need two refresh cycles*/
  108. memctl->memc_mamr = CFG_MAMR_48_SDR | MAMR_TLFA_2X;
  109. memctl->memc_mcr = (MCR_OP_RUN | MCR_UPM_A | MCR_MB_CS2 | \
  110. MCR_MLCF(2) | MCR_MAD(0x30));
  111. /*Mode register programming*/
  112. memctl->memc_mar = 0x00000088; /*CAS Latency = 2 and burst length = 4*/
  113. memctl->memc_mcr = (MCR_OP_RUN | MCR_UPM_A | MCR_MB_CS2 | \
  114. MCR_MLCF(1) | MCR_MAD(0x1C));
  115. /* That should do it, just enable the periodic refresh in burst of 4*/
  116. memctl->memc_mamr = CFG_MAMR_48_SDR | MAMR_TLFA_4X;
  117. memctl->memc_mamr |= (MAMR_PTAE | MAMR_GPL_A4DIS);
  118. size_b0 = 16*1024*1024;
  119. /*
  120. * No bank 1 or 3
  121. * invalidate bank
  122. */
  123. memctl->memc_br1 = 0;
  124. memctl->memc_br3 = 0;
  125. upmconfig(UPMB, (uint *)dsp_disp_table, sizeof(dsp_disp_table)/sizeof(uint));
  126. memctl->memc_mbmr = MBMR_GPL_B4DIS;
  127. memctl->memc_or4 = CFG_OR4;
  128. memctl->memc_br4 = CFG_BR4;
  129. return (size_b0);
  130. }