sdram_cfg.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2009 Matthias Kaehlcke <matthias@kaehlcke.net>
  3. *
  4. * Copyright (C) 2006 Dominic Rath <Dominic.Rath@gmx.de>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <config.h>
  25. #include <asm/arch/ep93xx.h>
  26. #define SDRAM_BASE_ADDR PHYS_SDRAM_1
  27. #ifdef CONFIG_EDB93XX_SDCS0
  28. #define SDRAM_DEVCFG_REG devcfg0
  29. #elif defined(CONFIG_EDB93XX_SDCS3)
  30. #define SDRAM_DEVCFG_REG devcfg3
  31. #else
  32. #error "SDRAM bank configuration"
  33. #endif
  34. #if defined(CONFIG_EDB9301) || defined(CONFIG_EDB9302) || \
  35. defined(CONFIG_EDB9302A)
  36. /*
  37. * 1x Samsung K4S561632C-TC/L75 4M x 16bit x 4 banks SDRAM
  38. *
  39. * CLK cycle time min:
  40. * @ CAS latency = 3: 7.5ns
  41. * @ CAS latency = 2: 10ns
  42. * We're running at 66MHz (15ns cycle time) external bus speed (HCLK),
  43. * so it's safe to use CAS latency = 2
  44. *
  45. * RAS-to-CAS delay min:
  46. * 20ns
  47. * At 15ns cycle time, we use RAS-to-CAS delay = 2
  48. *
  49. * SROMLL = 1: Swap BA[1:0] with A[13:12], making the SDRAM appear
  50. * as four blocks of 8MB size, instead of eight blocks of 4MB size:
  51. *
  52. * EDB9301/EDB9302:
  53. *
  54. * 0x00000000 - 0x007fffff
  55. * 0x01000000 - 0x017fffff
  56. * 0x04000000 - 0x047fffff
  57. * 0x05000000 - 0x057fffff
  58. *
  59. *
  60. * EDB9302a:
  61. *
  62. * 0xc0000000 - 0xc07fffff
  63. * 0xc1000000 - 0xc17fffff
  64. * 0xc4000000 - 0xc47fffff
  65. * 0xc5000000 - 0xc57fffff
  66. *
  67. * BANKCOUNT = 1: This is a device with four banks
  68. */
  69. #define SDRAM_DEVCFG_VAL (SDRAM_DEVCFG_BANKCOUNT | \
  70. SDRAM_DEVCFG_SROMLL | \
  71. SDRAM_DEVCFG_CASLAT_2 | \
  72. SDRAM_DEVCFG_RASTOCAS_2 | \
  73. SDRAM_DEVCFG_EXTBUSWIDTH)
  74. /*
  75. * 16 bit ext. bus
  76. *
  77. * A[22:09] is output as SYA[13:0]
  78. * CAS latency: 2
  79. * Burst type: sequential
  80. * Burst length: 8 (required for 16 bit ext. bus)
  81. * SYA[13:0] = 0x0023
  82. */
  83. #define SDRAM_MODE_REG_VAL 0x4600
  84. #define SDRAM_BANK_SEL_0 0x00000000 /* A[22:21] = b00 */
  85. #define SDRAM_BANK_SEL_1 0x00200000 /* A[22:21] = b01 */
  86. #define SDRAM_BANK_SEL_2 0x00400000 /* A[22:21] = b10 */
  87. #define SDRAM_BANK_SEL_3 0x00600000 /* A[22:21] = b11 */
  88. #elif defined(CONFIG_EDB9307) || defined(CONFIG_EDB9307A) || \
  89. defined CONFIG_EDB9312 || defined(CONFIG_EDB9315) || \
  90. defined(CONFIG_EDB9315A)
  91. /*
  92. * 2x Samsung K4S561632C-TC/L75 4M x 16bit x 4 banks SDRAM
  93. *
  94. * CLK cycle time min:
  95. * @ CAS latency = 3: 7.5ns
  96. * @ CAS latency = 2: 10ns
  97. * We're running at 100MHz (10ns cycle time) external bus speed (HCLK),
  98. * so it's safe to use CAS latency = 2
  99. *
  100. * RAS-to-CAS delay min:
  101. * 20ns
  102. * At 10ns cycle time, we use RAS-to-CAS delay = 2
  103. *
  104. * EDB9307, EDB9312, EDB9315:
  105. *
  106. * 0x00000000 - 0x01ffffff
  107. * 0x04000000 - 0x05ffffff
  108. *
  109. *
  110. * EDB9307a, EDB9315a:
  111. *
  112. * 0xc0000000 - 0xc1ffffff
  113. * 0xc4000000 - 0xc5ffffff
  114. */
  115. #define SDRAM_DEVCFG_VAL (SDRAM_DEVCFG_BANKCOUNT | \
  116. SDRAM_DEVCFG_SROMLL | \
  117. SDRAM_DEVCFG_CASLAT_2 | \
  118. SDRAM_DEVCFG_RASTOCAS_2)
  119. /*
  120. * 32 bit ext. bus
  121. *
  122. * A[23:10] is output as SYA[13:0]
  123. * CAS latency: 2
  124. * Burst type: sequential
  125. * Burst length: 4
  126. * SYA[13:0] = 0x0022
  127. */
  128. #define SDRAM_MODE_REG_VAL 0x8800
  129. #define SDRAM_BANK_SEL_0 0x00000000 /* A[23:22] = b00 */
  130. #define SDRAM_BANK_SEL_1 0x00400000 /* A[23:22] = b01 */
  131. #define SDRAM_BANK_SEL_2 0x00800000 /* A[23:22] = b10 */
  132. #define SDRAM_BANK_SEL_3 0x00c00000 /* A[23:22] = b11 */
  133. #endif