memory.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * (C) Copyright 2007
  3. * Stefan Roese, DENX Software Engineering, sr@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 <asm/processor.h>
  25. #include <i2c.h>
  26. void sdram_init(void)
  27. {
  28. return;
  29. }
  30. long int initdram(int board_type)
  31. {
  32. return (CFG_MBYTES_SDRAM << 20);
  33. }
  34. #if defined(CFG_DRAM_TEST)
  35. int testdram (void)
  36. {
  37. printf ("testdram\n");
  38. #if defined (CONFIG_NAND_U_BOOT)
  39. return 0;
  40. #endif
  41. uint *pstart = (uint *) 0x00000000;
  42. uint *pend = (uint *) 0x00001000;
  43. uint *p;
  44. for (p = pstart; p < pend; p++) {
  45. *p = 0xaaaaaaaa;
  46. }
  47. for (p = pstart; p < pend; p++) {
  48. if (*p != 0xaaaaaaaa) {
  49. #if !defined (CONFIG_NAND_SPL)
  50. printf ("SDRAM test fails at: %08x\n", (uint) p);
  51. #endif
  52. return 1;
  53. }
  54. }
  55. for (p = pstart; p < pend; p++) {
  56. *p = 0x55555555;
  57. }
  58. for (p = pstart; p < pend; p++) {
  59. if (*p != 0x55555555) {
  60. #if !defined (CONFIG_NAND_SPL)
  61. printf ("SDRAM test fails at: %08x\n", (uint) p);
  62. #endif
  63. return 1;
  64. }
  65. }
  66. #if !defined (CONFIG_NAND_SPL)
  67. printf ("SDRAM test passed!!!\n");
  68. #endif
  69. return 0;
  70. }
  71. #endif