hsmc.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Register definitions for Atmel Static Memory Controller (SMC)
  3. *
  4. * Copyright (C) 2006 Atmel Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_AVR32_HSMC_H__
  11. #define __ASM_AVR32_HSMC_H__
  12. /* HSMC register offsets */
  13. #define HSMC_SETUP0 0x0000
  14. #define HSMC_PULSE0 0x0004
  15. #define HSMC_CYCLE0 0x0008
  16. #define HSMC_MODE0 0x000c
  17. #define HSMC_SETUP1 0x0010
  18. #define HSMC_PULSE1 0x0014
  19. #define HSMC_CYCLE1 0x0018
  20. #define HSMC_MODE1 0x001c
  21. #define HSMC_SETUP2 0x0020
  22. #define HSMC_PULSE2 0x0024
  23. #define HSMC_CYCLE2 0x0028
  24. #define HSMC_MODE2 0x002c
  25. #define HSMC_SETUP3 0x0030
  26. #define HSMC_PULSE3 0x0034
  27. #define HSMC_CYCLE3 0x0038
  28. #define HSMC_MODE3 0x003c
  29. #define HSMC_SETUP4 0x0040
  30. #define HSMC_PULSE4 0x0044
  31. #define HSMC_CYCLE4 0x0048
  32. #define HSMC_MODE4 0x004c
  33. #define HSMC_SETUP5 0x0050
  34. #define HSMC_PULSE5 0x0054
  35. #define HSMC_CYCLE5 0x0058
  36. #define HSMC_MODE5 0x005c
  37. /* Bitfields in SETUP0 */
  38. #define HSMC_NWE_SETUP_OFFSET 0
  39. #define HSMC_NWE_SETUP_SIZE 6
  40. #define HSMC_NCS_WR_SETUP_OFFSET 8
  41. #define HSMC_NCS_WR_SETUP_SIZE 6
  42. #define HSMC_NRD_SETUP_OFFSET 16
  43. #define HSMC_NRD_SETUP_SIZE 6
  44. #define HSMC_NCS_RD_SETUP_OFFSET 24
  45. #define HSMC_NCS_RD_SETUP_SIZE 6
  46. /* Bitfields in PULSE0 */
  47. #define HSMC_NWE_PULSE_OFFSET 0
  48. #define HSMC_NWE_PULSE_SIZE 7
  49. #define HSMC_NCS_WR_PULSE_OFFSET 8
  50. #define HSMC_NCS_WR_PULSE_SIZE 7
  51. #define HSMC_NRD_PULSE_OFFSET 16
  52. #define HSMC_NRD_PULSE_SIZE 7
  53. #define HSMC_NCS_RD_PULSE_OFFSET 24
  54. #define HSMC_NCS_RD_PULSE_SIZE 7
  55. /* Bitfields in CYCLE0 */
  56. #define HSMC_NWE_CYCLE_OFFSET 0
  57. #define HSMC_NWE_CYCLE_SIZE 9
  58. #define HSMC_NRD_CYCLE_OFFSET 16
  59. #define HSMC_NRD_CYCLE_SIZE 9
  60. /* Bitfields in MODE0 */
  61. #define HSMC_READ_MODE_OFFSET 0
  62. #define HSMC_READ_MODE_SIZE 1
  63. #define HSMC_WRITE_MODE_OFFSET 1
  64. #define HSMC_WRITE_MODE_SIZE 1
  65. #define HSMC_EXNW_MODE_OFFSET 4
  66. #define HSMC_EXNW_MODE_SIZE 2
  67. #define HSMC_BAT_OFFSET 8
  68. #define HSMC_BAT_SIZE 1
  69. #define HSMC_DBW_OFFSET 12
  70. #define HSMC_DBW_SIZE 2
  71. #define HSMC_TDF_CYCLES_OFFSET 16
  72. #define HSMC_TDF_CYCLES_SIZE 4
  73. #define HSMC_TDF_MODE_OFFSET 20
  74. #define HSMC_TDF_MODE_SIZE 1
  75. #define HSMC_PMEN_OFFSET 24
  76. #define HSMC_PMEN_SIZE 1
  77. #define HSMC_PS_OFFSET 28
  78. #define HSMC_PS_SIZE 2
  79. /* Constants for READ_MODE */
  80. #define HSMC_READ_MODE_NCS_CONTROLLED 0
  81. #define HSMC_READ_MODE_NRD_CONTROLLED 1
  82. /* Constants for WRITE_MODE */
  83. #define HSMC_WRITE_MODE_NCS_CONTROLLED 0
  84. #define HSMC_WRITE_MODE_NWE_CONTROLLED 1
  85. /* Constants for EXNW_MODE */
  86. #define HSMC_EXNW_MODE_DISABLED 0
  87. #define HSMC_EXNW_MODE_RESERVED 1
  88. #define HSMC_EXNW_MODE_FROZEN 2
  89. #define HSMC_EXNW_MODE_READY 3
  90. /* Constants for BAT */
  91. #define HSMC_BAT_BYTE_SELECT 0
  92. #define HSMC_BAT_BYTE_WRITE 1
  93. /* Constants for DBW */
  94. #define HSMC_DBW_8_BITS 0
  95. #define HSMC_DBW_16_BITS 1
  96. #define HSMC_DBW_32_BITS 2
  97. /* Bit manipulation macros */
  98. #define HSMC_BIT(name) \
  99. (1 << HSMC_##name##_OFFSET)
  100. #define HSMC_BF(name,value) \
  101. (((value) & ((1 << HSMC_##name##_SIZE) - 1)) \
  102. << HSMC_##name##_OFFSET)
  103. #define HSMC_BFEXT(name,value) \
  104. (((value) >> HSMC_##name##_OFFSET) \
  105. & ((1 << HSMC_##name##_SIZE) - 1))
  106. #define HSMC_BFINS(name,value,old) \
  107. (((old) & ~(((1 << HSMC_##name##_SIZE) - 1) \
  108. << HSMC_##name##_OFFSET)) | HSMC_BF(name,value))
  109. /* Register access macros */
  110. #define hsmc_readl(port,reg) \
  111. __raw_readl((port)->regs + HSMC_##reg)
  112. #define hsmc_writel(port,reg,value) \
  113. __raw_writel((value), (port)->regs + HSMC_##reg)
  114. #endif /* __ASM_AVR32_HSMC_H__ */