sdramc.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Register definitions for the AT32AP SDRAM Controller
  3. *
  4. * Copyright (C) 2008 Atmel Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * version 2 as published by the Free Software Foundation.
  9. */
  10. /* Register offsets */
  11. #define SDRAMC_MR 0x0000
  12. #define SDRAMC_TR 0x0004
  13. #define SDRAMC_CR 0x0008
  14. #define SDRAMC_HSR 0x000c
  15. #define SDRAMC_LPR 0x0010
  16. #define SDRAMC_IER 0x0014
  17. #define SDRAMC_IDR 0x0018
  18. #define SDRAMC_IMR 0x001c
  19. #define SDRAMC_ISR 0x0020
  20. #define SDRAMC_MDR 0x0024
  21. /* MR - Mode Register */
  22. #define SDRAMC_MR_MODE_NORMAL ( 0 << 0)
  23. #define SDRAMC_MR_MODE_NOP ( 1 << 0)
  24. #define SDRAMC_MR_MODE_BANKS_PRECHARGE ( 2 << 0)
  25. #define SDRAMC_MR_MODE_LOAD_MODE ( 3 << 0)
  26. #define SDRAMC_MR_MODE_AUTO_REFRESH ( 4 << 0)
  27. #define SDRAMC_MR_MODE_EXT_LOAD_MODE ( 5 << 0)
  28. #define SDRAMC_MR_MODE_POWER_DOWN ( 6 << 0)
  29. /* CR - Configuration Register */
  30. #define SDRAMC_CR_NC_8_BITS ( 0 << 0)
  31. #define SDRAMC_CR_NC_9_BITS ( 1 << 0)
  32. #define SDRAMC_CR_NC_10_BITS ( 2 << 0)
  33. #define SDRAMC_CR_NC_11_BITS ( 3 << 0)
  34. #define SDRAMC_CR_NR_11_BITS ( 0 << 2)
  35. #define SDRAMC_CR_NR_12_BITS ( 1 << 2)
  36. #define SDRAMC_CR_NR_13_BITS ( 2 << 2)
  37. #define SDRAMC_CR_NB_2_BANKS ( 0 << 4)
  38. #define SDRAMC_CR_NB_4_BANKS ( 1 << 4)
  39. #define SDRAMC_CR_CAS(x) ((x) << 5)
  40. #define SDRAMC_CR_DBW_32_BITS ( 0 << 7)
  41. #define SDRAMC_CR_DBW_16_BITS ( 1 << 7)
  42. #define SDRAMC_CR_TWR(x) ((x) << 8)
  43. #define SDRAMC_CR_TRC(x) ((x) << 12)
  44. #define SDRAMC_CR_TRP(x) ((x) << 16)
  45. #define SDRAMC_CR_TRCD(x) ((x) << 20)
  46. #define SDRAMC_CR_TRAS(x) ((x) << 24)
  47. #define SDRAMC_CR_TXSR(x) ((x) << 28)
  48. /* HSR - High Speed Register */
  49. #define SDRAMC_HSR_DA ( 1 << 0)
  50. /* LPR - Low Power Register */
  51. #define SDRAMC_LPR_LPCB_INHIBIT ( 0 << 0)
  52. #define SDRAMC_LPR_LPCB_SELF_RFR ( 1 << 0)
  53. #define SDRAMC_LPR_LPCB_PDOWN ( 2 << 0)
  54. #define SDRAMC_LPR_LPCB_DEEP_PDOWN ( 3 << 0)
  55. #define SDRAMC_LPR_PASR(x) ((x) << 4)
  56. #define SDRAMC_LPR_TCSR(x) ((x) << 8)
  57. #define SDRAMC_LPR_DS(x) ((x) << 10)
  58. #define SDRAMC_LPR_TIMEOUT(x) ((x) << 12)
  59. /* IER/IDR/IMR/ISR - Interrupt Enable/Disable/Mask/Status Register */
  60. #define SDRAMC_ISR_RES ( 1 << 0)
  61. /* MDR - Memory Device Register */
  62. #define SDRAMC_MDR_MD_SDRAM ( 0 << 0)
  63. #define SDRAMC_MDR_MD_LOW_PWR_SDRAM ( 1 << 0)
  64. /* Register access macros */
  65. #define sdramc_readl(reg) \
  66. __raw_readl((void __iomem __force *)SDRAMC_BASE + SDRAMC_##reg)
  67. #define sdramc_writel(reg, value) \
  68. __raw_writel(value, (void __iomem __force *)SDRAMC_BASE + SDRAMC_##reg)