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 == CONFIG_SYS_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 * CONFIG_SYS_CLK) >> 4);
  44. #ifdef CONFIG_SYS_SDRAM_BASE0
  45. MCFSDRAMC_DACR0 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE0)
  46. | MCFSDRAMC_DACR_CASL (1)
  47. | MCFSDRAMC_DACR_CBM (3)
  48. | MCFSDRAMC_DACR_PS_16;
  49. MCFSDRAMC_DMR0 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
  50. MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_IP;
  51. *(unsigned short *) (CONFIG_SYS_SDRAM_BASE0) = 0xA5A5;
  52. MCFSDRAMC_DACR0 |= MCFSDRAMC_DACR_RE;
  53. for (i = 0; i < 2000; i++)
  54. asm (" nop");
  55. mbar_writeLong (MCFSDRAMC_DACR0,
  56. mbar_readLong (MCFSDRAMC_DACR0) | MCFSDRAMC_DACR_IMRS);
  57. *(unsigned int *) (CONFIG_SYS_SDRAM_BASE0 + 0x220) = 0xA5A5;
  58. size += CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
  59. #endif
  60. #ifdef CONFIG_SYS_SDRAM_BASE1
  61. MCFSDRAMC_DACR1 = MCFSDRAMC_DACR_BASE (CONFIG_SYS_SDRAM_BASE1)
  62. | MCFSDRAMC_DACR_CASL (1)
  63. | MCFSDRAMC_DACR_CBM (3)
  64. | MCFSDRAMC_DACR_PS_16;
  65. MCFSDRAMC_DMR1 = MCFSDRAMC_DMR_BAM_16M | MCFSDRAMC_DMR_V;
  66. MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IP;
  67. *(unsigned short *) (CONFIG_SYS_SDRAM_BASE1) = 0xA5A5;
  68. MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_RE;
  69. for (i = 0; i < 2000; i++)
  70. asm (" nop");
  71. MCFSDRAMC_DACR1 |= MCFSDRAMC_DACR_IMRS;
  72. *(unsigned int *) (CONFIG_SYS_SDRAM_BASE1 + 0x220) = 0xA5A5;
  73. size += CONFIG_SYS_SDRAM_SIZE1 * 1024 * 1024;
  74. #endif
  75. return size;
  76. }
  77. #if defined(CONFIG_SYS_DRAM_TEST)
  78. int testdram (void)
  79. {
  80. uint *pstart = (uint *) CONFIG_SYS_MEMTEST_START;
  81. uint *pend = (uint *) CONFIG_SYS_MEMTEST_END;
  82. uint *p;
  83. printf("SDRAM test phase 1:\n");
  84. for (p = pstart; p < pend; p++)
  85. *p = 0xaaaaaaaa;
  86. for (p = pstart; p < pend; p++) {
  87. if (*p != 0xaaaaaaaa) {
  88. printf ("SDRAM test fails at: %08x\n", (uint) p);
  89. return 1;
  90. }
  91. }
  92. printf("SDRAM test phase 2:\n");
  93. for (p = pstart; p < pend; p++)
  94. *p = 0x55555555;
  95. for (p = pstart; p < pend; p++) {
  96. if (*p != 0x55555555) {
  97. printf ("SDRAM test fails at: %08x\n", (uint) p);
  98. return 1;
  99. }
  100. }
  101. printf("SDRAM test passed.\n");
  102. return 0;
  103. }
  104. #endif
  105. int misc_init_r(void)
  106. {
  107. init_vcxk();
  108. return 1;
  109. }
  110. /*---------------------------------------------------------------------------*/
  111. int do_vcimage (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  112. {
  113. int rcode = 0;
  114. ulong source;
  115. switch (argc) {
  116. case 2:
  117. source = simple_strtoul(argv[1],NULL,16);
  118. vcxk_loadimage(source);
  119. rcode = 0;
  120. break;
  121. default:
  122. printf ("Usage:\n%s\n", cmdtp->usage);
  123. rcode = 1;
  124. break;
  125. }
  126. return rcode;
  127. }
  128. /***************************************************/
  129. U_BOOT_CMD(
  130. vcimage, 2, 0, do_vcimage,
  131. "vcimage - loads an image to Display\n",
  132. "vcimage addr\n"
  133. );
  134. /* EOF EB+MCF-EV123c */