sdram.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * (C) Copyright 2006
  3. * Stefan Roese, DENX Software Engineering, sr@denx.de.
  4. *
  5. * (C) Copyright 2006
  6. * DAVE Srl <www.dave-tech.it>
  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. #ifndef _SDRAM_H_
  27. #define _SDRAM_H_
  28. #include <config.h>
  29. #define mtsdram0(reg, data) mtdcr(memcfga,reg);mtdcr(memcfgd,data)
  30. #define ONE_BILLION 1000000000
  31. struct sdram_conf_s {
  32. unsigned long size;
  33. int rows;
  34. unsigned long reg;
  35. };
  36. typedef struct sdram_conf_s sdram_conf_t;
  37. /* Bitfields offsets */
  38. #define SDRAM0_TR_CASL (31 - 8)
  39. #define SDRAM0_TR_PTA (31 - 13)
  40. #define SDRAM0_TR_CTP (31 - 15)
  41. #define SDRAM0_TR_LDF (31 - 17)
  42. #define SDRAM0_TR_RFTA (31 - 29)
  43. #define SDRAM0_TR_RCD (31 - 31)
  44. #ifdef CFG_SDRAM_CL
  45. /* SDRAM timings [ns] according to AMCC/IBM names (see SDRAM_faq.doc) */
  46. #define CFG_SDRAM_CASL CFG_SDRAM_CL
  47. #define CFG_SDRAM_PTA CFG_SDRAM_tRP
  48. #define CFG_SDRAM_CTP (CFG_SDRAM_tRC - CFG_SDRAM_tRCD - CFG_SDRAM_tRP)
  49. #define CFG_SDRAM_LDF 0
  50. #ifdef CFG_SDRAM_tRFC
  51. #define CFG_SDRAM_RFTA CFG_SDRAM_tRFC
  52. #else
  53. #define CFG_SDRAM_RFTA CFG_SDRAM_tRC
  54. #endif
  55. #define CFG_SDRAM_RCD CFG_SDRAM_tRCD
  56. #endif /* #ifdef CFG_SDRAM_CL */
  57. /*
  58. * Some defines for the 440 DDR controller
  59. */
  60. #define SDRAM_CFG0_DC_EN 0x80000000 /* SDRAM Controller Enable */
  61. #define SDRAM_CFG0_MEMCHK 0x30000000 /* Memory data error checking mask*/
  62. #define SDRAM_CFG0_MEMCHK_NON 0x00000000 /* No ECC generation */
  63. #define SDRAM_CFG0_MEMCHK_GEN 0x20000000 /* ECC generation */
  64. #define SDRAM_CFG0_MEMCHK_CHK 0x30000000 /* ECC generation and checking */
  65. #define SDRAM_CFG0_DRAMWDTH 0x02000000 /* DRAM width mask */
  66. #define SDRAM_CFG0_DRAMWDTH_32 0x00000000 /* 32 bits */
  67. #define SDRAM_CFG0_DRAMWDTH_64 0x02000000 /* 64 bits */
  68. #endif