emc.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2011 by Vladimir Zapolskiy <vz@mleia.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #ifndef _LPC32XX_EMC_H
  20. #define _LPC32XX_EMC_H
  21. #include <asm/types.h>
  22. /* EMC Registers */
  23. struct emc_regs {
  24. u32 ctrl; /* Controls operation of the EMC */
  25. u32 status; /* Provides EMC status information */
  26. u32 config; /* Configures operation of the EMC */
  27. u32 reserved0[5];
  28. u32 control; /* Controls dyn memory operation */
  29. u32 refresh; /* Configures dyn memory refresh operation */
  30. u32 read_config; /* Configures the dyn memory read strategy */
  31. u32 reserved1;
  32. u32 t_rp; /* Precharge command period */
  33. u32 t_ras; /* Active to precharge command period */
  34. u32 t_srex; /* Self-refresh exit time */
  35. u32 reserved2[2];
  36. u32 t_wr; /* Write recovery time */
  37. u32 t_rc; /* Active to active command period */
  38. u32 t_rfc; /* Auto-refresh period */
  39. u32 t_xsr; /* Exit self-refresh to active command time */
  40. u32 t_rrd; /* Active bank A to active bank B latency */
  41. u32 t_mrd; /* Load mode register to active command time */
  42. u32 t_cdlr; /* Last data in to read command time */
  43. u32 reserved3[8];
  44. u32 extended_wait; /* time for static memory rd/wr transfers */
  45. u32 reserved4[31];
  46. u32 config0; /* Configuration information for the SDRAM */
  47. u32 rascas0; /* RAS and CAS latencies for the SDRAM */
  48. u32 reserved5[6];
  49. u32 config1; /* Configuration information for the SDRAM */
  50. u32 rascas1; /* RAS and CAS latencies for the SDRAM */
  51. u32 reserved6[54];
  52. struct emc_stat_t {
  53. u32 config; /* Static memory configuration */
  54. u32 waitwen; /* Delay from chip select to write enable */
  55. u32 waitoen; /* Delay to output enable */
  56. u32 waitrd; /* Delay to a read access */
  57. u32 waitpage; /* Delay for async page mode read */
  58. u32 waitwr; /* Delay to a write access */
  59. u32 waitturn; /* Number of bus turnaround cycles */
  60. u32 reserved;
  61. } stat[4];
  62. u32 reserved7[96];
  63. struct emc_ahb_t {
  64. u32 control; /* Control register for AHB */
  65. u32 status; /* Status register for AHB */
  66. u32 timeout; /* Timeout register for AHB */
  67. u32 reserved[5];
  68. } ahb[5];
  69. };
  70. /* Static Memory Configuration Register bits */
  71. #define EMC_STAT_CONFIG_WP (1 << 20)
  72. #define EMC_STAT_CONFIG_EW (1 << 8)
  73. #define EMC_STAT_CONFIG_PB (1 << 7)
  74. #define EMC_STAT_CONFIG_PC (1 << 6)
  75. #define EMC_STAT_CONFIG_PM (1 << 3)
  76. #define EMC_STAT_CONFIG_32BIT (2 << 0)
  77. #define EMC_STAT_CONFIG_16BIT (1 << 0)
  78. #define EMC_STAT_CONFIG_8BIT (0 << 0)
  79. /* Static Memory Delay Registers */
  80. #define EMC_STAT_WAITWEN(n) (((n) - 1) & 0x0F)
  81. #define EMC_STAT_WAITOEN(n) (((n) - 1) & 0x0F)
  82. #define EMC_STAT_WAITRD(n) (((n) - 1) & 0x1F)
  83. #define EMC_STAT_WAITPAGE(n) (((n) - 1) & 0x1F)
  84. #define EMC_STAT_WAITWR(n) (((n) - 2) & 0x1F)
  85. #define EMC_STAT_WAITTURN(n) (((n) - 1) & 0x0F)
  86. #endif /* _LPC32XX_EMC_H */