EB+MCF-EV123.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * (C) Copyright 2005
  3. * BuS Elektronik GmbH & Co.KG <esw@bus-elektonik.de>
  4. *
  5. * (C) Copyright 2000-2003
  6. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <command.h>
  28. #include "asm/m5282.h"
  29. #include "VCxK.h"
  30. int checkboard (void)
  31. {
  32. puts ("Board: MCF-EV1 + MCF-EV23 (BuS Elektronik GmbH & Co. KG)\n");
  33. #if (TEXT_BASE == CFG_INT_FLASH_BASE)
  34. puts (" Boot from Internal FLASH\n");
  35. #endif
  36. return 0;
  37. }
  38. phys_size_t initdram (int board_type)
  39. {
  40. int size,i;
  41. size = 0;
  42. MCFSDRAMC_DCR = MCFSDRAMC_DCR_RTIM_6
  43. | MCFSDRAMC_DCR_RC((15 * CFG_CLK)>>4);
  44. #ifdef CFG_SDRAM_BASE0
  45. MCFSDRAMC_DACR0 = MCFSDRAMC_DACR_BASE(CFG_SDRAM_BASE0)
  46. | MCFSDRAMC_DACR_CASL(1)
  47. | MCFSDRAMC_DACR_CBM(3)
  48. | MCFSDRAMC_DACR_PS_16);
  49. MCFSDRAMC_DMR0 = MCFSDRAMC_DMR_BAM_16M
  50. | MCFSDRAMC_DMR_V;
  51. MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
  52. *(unsigned short *)(CFG_SDRAM_BASE0) = 0xA5A5;
  53. MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
  54. for (i=0; i < 2000; i++)
  55. asm(" nop");
  56. mbar_writeLong(MCFSDRAMC_DACR0, mbar_readLong(MCFSDRAMC_DACR0)
  57. | MCFSDRAMC_DACR_IMRS);
  58. *(unsigned int *)(CFG_SDRAM_BASE0 + 0x220) = 0xA5A5;
  59. size += CFG_SDRAM_SIZE * 1024 * 1024;
  60. #endif
  61. #ifdef CFG_SDRAM_BASE1
  62. MCFSDRAMC_DACR1 = MCFSDRAMC_DACR_BASE(CFG_SDRAM_BASE1)
  63. | MCFSDRAMC_DACR_CASL(1)
  64. | MCFSDRAMC_DACR_CBM(3)
  65. | MCFSDRAMC_DACR_PS_16;
  66. MCFSDRAMC_DMR1 = MCFSDRAMC_DMR_BAM_16M
  67. | MCFSDRAMC_DMR_V;
  68. MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IP;
  69. *(unsigned short *)(CFG_SDRAM_BASE1) = 0xA5A5;
  70. MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_RE;
  71. for (i=0; i < 2000; i++)
  72. asm(" nop");
  73. MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IMRS;
  74. *(unsigned int *)(CFG_SDRAM_BASE1 + 0x220) = 0xA5A5;
  75. size += CFG_SDRAM_SIZE1 * 1024 * 1024;
  76. #endif
  77. return size;
  78. }
  79. #if defined(CFG_DRAM_TEST)
  80. int testdram (void)
  81. {
  82. uint *pstart = (uint *) CFG_MEMTEST_START;
  83. uint *pend = (uint *) CFG_MEMTEST_END;
  84. uint *p;
  85. printf("SDRAM test phase 1:\n");
  86. for (p = pstart; p < pend; p++)
  87. *p = 0xaaaaaaaa;
  88. for (p = pstart; p < pend; p++) {
  89. if (*p != 0xaaaaaaaa) {
  90. printf ("SDRAM test fails at: %08x\n", (uint) p);
  91. return 1;
  92. }
  93. }
  94. printf("SDRAM test phase 2:\n");
  95. for (p = pstart; p < pend; p++)
  96. *p = 0x55555555;
  97. for (p = pstart; p < pend; p++) {
  98. if (*p != 0x55555555) {
  99. printf ("SDRAM test fails at: %08x\n", (uint) p);
  100. return 1;
  101. }
  102. }
  103. printf("SDRAM test passed.\n");
  104. return 0;
  105. }
  106. #endif
  107. int misc_init_r(void)
  108. {
  109. init_vcxk();
  110. return 1;
  111. }
  112. /*---------------------------------------------------------------------------*/
  113. int do_vcimage (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  114. {
  115. int rcode = 0;
  116. ulong source;
  117. switch (argc) {
  118. case 2:
  119. source = simple_strtoul(argv[1],NULL,16);
  120. vcxk_loadimage(source);
  121. rcode = 0;
  122. break;
  123. default:
  124. printf ("Usage:\n%s\n", cmdtp->usage);
  125. rcode = 1;
  126. break;
  127. }
  128. return rcode;
  129. }
  130. /***************************************************/
  131. U_BOOT_CMD(
  132. vcimage, 2, 0, do_vcimage,
  133. "vcimage - loads an image to Display\n",
  134. "vcimage addr\n"
  135. );
  136. /* EOF EB+MCF-EV123c */