memory.c 2.0 KB

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