AT91CAP9.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. /*
  2. * (C) Copyright 2008
  3. * AT91CAP9 definitions
  4. * Author : ATMEL AT91 application group
  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. #ifndef AT91CAP9_H
  25. #define AT91CAP9_H
  26. typedef volatile unsigned int AT91_REG;
  27. /* Static Memory Controller */
  28. typedef struct _AT91S_SMC {
  29. AT91_REG SMC_SETUP0; /* Setup Register for CS 0 */
  30. AT91_REG SMC_PULSE0; /* Pulse Register for CS 0 */
  31. AT91_REG SMC_CYCLE0; /* Cycle Register for CS 0 */
  32. AT91_REG SMC_CTRL0; /* Control Register for CS 0 */
  33. AT91_REG SMC_SETUP1; /* Setup Register for CS 1 */
  34. AT91_REG SMC_PULSE1; /* Pulse Register for CS 1 */
  35. AT91_REG SMC_CYCLE1; /* Cycle Register for CS 1 */
  36. AT91_REG SMC_CTRL1; /* Control Register for CS 1 */
  37. AT91_REG SMC_SETUP2; /* Setup Register for CS 2 */
  38. AT91_REG SMC_PULSE2; /* Pulse Register for CS 2 */
  39. AT91_REG SMC_CYCLE2; /* Cycle Register for CS 2 */
  40. AT91_REG SMC_CTRL2; /* Control Register for CS 2 */
  41. AT91_REG SMC_SETUP3; /* Setup Register for CS 3 */
  42. AT91_REG SMC_PULSE3; /* Pulse Register for CS 3 */
  43. AT91_REG SMC_CYCLE3; /* Cycle Register for CS 3 */
  44. AT91_REG SMC_CTRL3; /* Control Register for CS 3 */
  45. AT91_REG SMC_SETUP4; /* Setup Register for CS 4 */
  46. AT91_REG SMC_PULSE4; /* Pulse Register for CS 4 */
  47. AT91_REG SMC_CYCLE4; /* Cycle Register for CS 4 */
  48. AT91_REG SMC_CTRL4; /* Control Register for CS 4 */
  49. AT91_REG SMC_SETUP5; /* Setup Register for CS 5 */
  50. AT91_REG SMC_PULSE5; /* Pulse Register for CS 5 */
  51. AT91_REG SMC_CYCLE5; /* Cycle Register for CS 5 */
  52. AT91_REG SMC_CTRL5; /* Control Register for CS 5 */
  53. AT91_REG SMC_SETUP6; /* Setup Register for CS 6 */
  54. AT91_REG SMC_PULSE6; /* Pulse Register for CS 6 */
  55. AT91_REG SMC_CYCLE6; /* Cycle Register for CS 6 */
  56. AT91_REG SMC_CTRL6; /* Control Register for CS 6 */
  57. AT91_REG SMC_SETUP7; /* Setup Register for CS 7 */
  58. AT91_REG SMC_PULSE7; /* Pulse Register for CS 7 */
  59. AT91_REG SMC_CYCLE7; /* Cycle Register for CS 7 */
  60. AT91_REG SMC_CTRL7; /* Control Register for CS 7 */
  61. } AT91S_SMC, *AT91PS_SMC;
  62. /* SMC_SETUP : (SMC Offset: 0x0) Setup Register for CS x */
  63. #define AT91C_SMC_NWESETUP (0x3F << 0) /* NWE Setup Length */
  64. #define AT91C_SMC_NCSSETUPWR (0x3F << 8) /* NCS Setup Length for WRite */
  65. #define AT91C_SMC_NRDSETUP (0x3F << 16) /* NRD Setup Length */
  66. #define AT91C_SMC_NCSSETUPRD (0x3F << 24) /* NCS Setup Length for ReaD */
  67. /* SMC_PULSE : (SMC Offset: 0x4) Pulse Register for CS x */
  68. #define AT91C_SMC_NWEPULSE (0x7F << 0) /* NWE Pulse Length */
  69. #define AT91C_SMC_NCSPULSEWR (0x7F << 8) /* NCS Pulse Length for WRite */
  70. #define AT91C_SMC_NRDPULSE (0x7F << 16) /* NRD Pulse Length */
  71. #define AT91C_SMC_NCSPULSERD (0x7F << 24) /* NCS Pulse Length for ReaD */
  72. /* SMC_CYC : (SMC Offset: 0x8) Cycle Register for CS x */
  73. #define AT91C_SMC_NWECYCLE (0x1FF << 0) /* Total Write Cycle Length */
  74. #define AT91C_SMC_NRDCYCLE (0x1FF << 16) /* Total Read Cycle Length */
  75. /* SMC_CTRL : (SMC Offset: 0xc) Control Register for CS x */
  76. #define AT91C_SMC_READMODE (0x1 << 0) /* Read Mode */
  77. #define AT91C_SMC_WRITEMODE (0x1 << 1) /* Write Mode */
  78. #define AT91C_SMC_NWAITM (0x3 << 5) /* NWAIT Mode */
  79. /* External NWAIT disabled */
  80. #define AT91C_SMC_NWAITM_NWAIT_DISABLE (0x0 << 5)
  81. /* External NWAIT enabled in frozen mode */
  82. #define AT91C_SMC_NWAITM_NWAIT_ENABLE_FROZEN (0x2 << 5)
  83. /* External NWAIT enabled in ready mode */
  84. #define AT91C_SMC_NWAITM_NWAIT_ENABLE_READY (0x3 << 5)
  85. #define AT91C_SMC_BAT (0x1 << 8) /* Byte Access Type */
  86. /*
  87. * Write controled by ncs, nbs0, nbs1, nbs2, nbs3.
  88. * Read controled by ncs, nrd, nbs0, nbs1, nbs2, nbs3.
  89. */
  90. #define AT91C_SMC_BAT_BYTE_SELECT (0x0 << 8)
  91. /*
  92. * Write controled by ncs, nwe0, nwe1, nwe2, nwe3.
  93. * Read controled by ncs and nrd.
  94. */
  95. #define AT91C_SMC_BAT_BYTE_WRITE (0x1 << 8)
  96. #define AT91C_SMC_DBW (0x3 << 12) /* Data Bus Width */
  97. #define AT91C_SMC_DBW_WIDTH_EIGTH_BITS (0x0 << 12)
  98. #define AT91C_SMC_DBW_WIDTH_SIXTEEN_BITS (0x1 << 12)
  99. #define AT91C_SMC_DBW_WIDTH_THIRTY_TWO_BITS (0x2 << 12)
  100. #define AT91C_SMC_TDF (0xF << 16) /* Data Float Time */
  101. #define AT91C_SMC_TDFEN (0x1 << 20) /* TDF Enabled */
  102. #define AT91C_SMC_PMEN (0x1 << 24) /* Page Mode Enabled */
  103. #define AT91C_SMC_PS (0x3 << 28) /* Page Size */
  104. #define AT91C_SMC_PS_SIZE_FOUR_BYTES (0x0 << 28)
  105. #define AT91C_SMC_PS_SIZE_EIGHT_BYTES (0x1 << 28)
  106. #define AT91C_SMC_PS_SIZE_SIXTEEN_BYTES (0x2 << 28)
  107. #define AT91C_SMC_PS_SIZE_THIRTY_TWO_BYTES (0x3 << 28)
  108. /* SMC_SETUP : (SMC Offset: 0x10) Setup Register for CS x */
  109. /* SMC_PULSE : (SMC Offset: 0x14) Pulse Register for CS x */
  110. /* SMC_CYC : (SMC Offset: 0x18) Cycle Register for CS x */
  111. /* SMC_CTRL : (SMC Offset: 0x1c) Control Register for CS x */
  112. /* SMC_SETUP : (SMC Offset: 0x20) Setup Register for CS x */
  113. /* SMC_PULSE : (SMC Offset: 0x24) Pulse Register for CS x */
  114. /* SMC_CYC : (SMC Offset: 0x28) Cycle Register for CS x */
  115. /* SMC_CTRL : (SMC Offset: 0x2c) Control Register for CS x */
  116. /* SMC_SETUP : (SMC Offset: 0x30) Setup Register for CS x */
  117. /* SMC_PULSE : (SMC Offset: 0x34) Pulse Register for CS x */
  118. /* SMC_CYC : (SMC Offset: 0x38) Cycle Register for CS x */
  119. /* SMC_CTRL : (SMC Offset: 0x3c) Control Register for CS x */
  120. /* SMC_SETUP : (SMC Offset: 0x40) Setup Register for CS x */
  121. /* SMC_PULSE : (SMC Offset: 0x44) Pulse Register for CS x */
  122. /* SMC_CYC : (SMC Offset: 0x48) Cycle Register for CS x */
  123. /* SMC_CTRL : (SMC Offset: 0x4c) Control Register for CS x */
  124. /* SMC_SETUP : (SMC Offset: 0x50) Setup Register for CS x */
  125. /* SMC_PULSE : (SMC Offset: 0x54) Pulse Register for CS x */
  126. /* SMC_CYC : (SMC Offset: 0x58) Cycle Register for CS x */
  127. /* SMC_CTRL : (SMC Offset: 0x5c) Control Register for CS x */
  128. /* SMC_SETUP : (SMC Offset: 0x60) Setup Register for CS x */
  129. /* SMC_PULSE : (SMC Offset: 0x64) Pulse Register for CS x */
  130. /* SMC_CYC : (SMC Offset: 0x68) Cycle Register for CS x */
  131. /* SMC_CTRL : (SMC Offset: 0x6c) Control Register for CS x */
  132. /* SMC_SETUP : (SMC Offset: 0x70) Setup Register for CS x */
  133. /* SMC_PULSE : (SMC Offset: 0x74) Pulse Register for CS x */
  134. /* SMC_CYC : (SMC Offset: 0x78) Cycle Register for CS x */
  135. /* SMC_CTRL : (SMC Offset: 0x7c) Control Register for CS x */
  136. /* AHB CCFG */
  137. typedef struct _AT91S_CCFG {
  138. AT91_REG Reserved0[1];
  139. AT91_REG CCFG_MPBS0; /* MPB Slave 0 */
  140. AT91_REG CCFG_UDPHS; /* AHB Periphs */
  141. AT91_REG CCFG_MPBS1; /* MPB Slave 1 */
  142. AT91_REG CCFG_EBICSA; /* EBI Chip Select Assignement */
  143. AT91_REG Reserved1[2];
  144. AT91_REG CCFG_MPBS2; /* MPB Slave 2 */
  145. AT91_REG CCFG_MPBS3; /* MPB Slave 3 */
  146. AT91_REG CCFG_BRIDGE; /* APB Bridge */
  147. AT91_REG Reserved2[49];
  148. AT91_REG CCFG_MATRIXVERSION;/* Version */
  149. } AT91S_CCFG, *AT91PS_CCFG;
  150. /* CCFG_UDPHS : (CCFG Offset: 0x8) UDPHS Configuration */
  151. #define AT91C_CCFG_UDPHS_UDP_SELECT (0x1 << 31) /* UDPHS or UDP */
  152. #define AT91C_CCFG_UDPHS_UDP_SELECT_UDPHS (0x0 << 31)
  153. #define AT91C_CCFG_UDPHS_UDP_SELECT_UDP (0x1 << 31)
  154. /* CCFG_EBICSA : (CCFG Offset: 0x10) EBI Chip Select Assignement Register */
  155. #define AT91C_EBI_CS1A (0x1 << 1) /* CS1 Assignment */
  156. #define AT91C_EBI_CS1A_SMC (0x0 << 1)
  157. #define AT91C_EBI_CS1A_BCRAMC (0x1 << 1)
  158. #define AT91C_EBI_CS3A (0x1 << 3) /* CS 3 Assignment */
  159. #define AT91C_EBI_CS3A_SMC (0x0 << 3)
  160. #define AT91C_EBI_CS3A_SM (0x1 << 3)
  161. #define AT91C_EBI_CS4A (0x1 << 4) /* CS4 Assignment */
  162. #define AT91C_EBI_CS4A_SMC (0x0 << 4)
  163. #define AT91C_EBI_CS4A_CF (0x1 << 4)
  164. #define AT91C_EBI_CS5A (0x1 << 5) /* CS 5 Assignment */
  165. #define AT91C_EBI_CS5A_SMC (0x0 << 5)
  166. #define AT91C_EBI_CS5A_CF (0x1 << 5)
  167. #define AT91C_EBI_DBPUC (0x1 << 8) /* Data Bus Pull-up */
  168. #define AT91C_EBI_DDRPUC (0x1 << 9) /* DDDR DQS Pull-up */
  169. #define AT91C_EBI_SUP (0x1 << 16) /* EBI Supply */
  170. #define AT91C_EBI_SUP_1V8 (0x0 << 16)
  171. #define AT91C_EBI_SUP_3V3 (0x1 << 16)
  172. #define AT91C_EBI_LP (0x1 << 17) /* EBI Low Power */
  173. #define AT91C_EBI_LP_LOW_DRIVE (0x0 << 17)
  174. #define AT91C_EBI_LP_STD_DRIVE (0x1 << 17)
  175. #define AT91C_CCFG_DDR_SDR_SELECT (0x1 << 31) /* DDR or SDR */
  176. #define AT91C_CCFG_DDR_SDR_SELECT_DDR (0x0 << 31)
  177. #define AT91C_CCFG_DDR_SDR_SELECT_SDR (0x1 << 31)
  178. /* CCFG_BRIDGE : (CCFG Offset: 0x24) BRIDGE Configuration */
  179. #define AT91C_CCFG_AES_TDES_SELECT (0x1 << 31) /* AES or TDES */
  180. #define AT91C_CCFG_AES_TDES_SELECT_AES (0x0 << 31)
  181. #define AT91C_CCFG_AES_TDES_SELECT_TDES (0x1 << 31)
  182. /* PIO controller */
  183. typedef struct _AT91S_PIO {
  184. AT91_REG PIO_PER; /* PIO Enable Register */
  185. AT91_REG PIO_PDR; /* PIO Disable Register */
  186. AT91_REG PIO_PSR; /* PIO Status Register */
  187. AT91_REG Reserved0[1];
  188. AT91_REG PIO_OER; /* Output Enable Register */
  189. AT91_REG PIO_ODR; /* Output Disable Register */
  190. AT91_REG PIO_OSR; /* Output Status Register */
  191. AT91_REG Reserved1[1];
  192. AT91_REG PIO_IFER; /* Input Filter Enable Register */
  193. AT91_REG PIO_IFDR; /* Input Filter Disable Register */
  194. AT91_REG PIO_IFSR; /* Input Filter Status Register */
  195. AT91_REG Reserved2[1];
  196. AT91_REG PIO_SODR; /* Set Output Data Register */
  197. AT91_REG PIO_CODR; /* Clear Output Data Register */
  198. AT91_REG PIO_ODSR; /* Output Data Status Register */
  199. AT91_REG PIO_PDSR; /* Pin Data Status Register */
  200. AT91_REG PIO_IER; /* Interrupt Enable Register */
  201. AT91_REG PIO_IDR; /* Interrupt Disable Register */
  202. AT91_REG PIO_IMR; /* Interrupt Mask Register */
  203. AT91_REG PIO_ISR; /* Interrupt Status Register */
  204. AT91_REG PIO_MDER; /* Multi-driver Enable Register */
  205. AT91_REG PIO_MDDR; /* Multi-driver Disable Register */
  206. AT91_REG PIO_MDSR; /* Multi-driver Status Register */
  207. AT91_REG Reserved3[1];
  208. AT91_REG PIO_PPUDR; /* Pull-up Disable Register */
  209. AT91_REG PIO_PPUER; /* Pull-up Enable Register */
  210. AT91_REG PIO_PPUSR; /* Pull-up Status Register */
  211. AT91_REG Reserved4[1];
  212. AT91_REG PIO_ASR; /* Select A Register */
  213. AT91_REG PIO_BSR; /* Select B Register */
  214. AT91_REG PIO_ABSR; /* AB Select Status Register */
  215. AT91_REG Reserved5[9];
  216. AT91_REG PIO_OWER; /* Output Write Enable Register */
  217. AT91_REG PIO_OWDR; /* Output Write Disable Register */
  218. AT91_REG PIO_OWSR; /* Output Write Status Register */
  219. } AT91S_PIO, *AT91PS_PIO;
  220. /* Power Management Controller */
  221. typedef struct _AT91S_PMC {
  222. AT91_REG PMC_SCER; /* System Clock Enable Register */
  223. AT91_REG PMC_SCDR; /* System Clock Disable Register */
  224. AT91_REG PMC_SCSR; /* System Clock Status Register */
  225. AT91_REG Reserved0[1];
  226. AT91_REG PMC_PCER; /* Peripheral Clock Enable Register */
  227. AT91_REG PMC_PCDR; /* Peripheral Clock Disable Register */
  228. AT91_REG PMC_PCSR; /* Peripheral Clock Status Register */
  229. AT91_REG PMC_UCKR; /* UTMI Clock Configuration Register */
  230. AT91_REG PMC_MOR; /* Main Oscillator Register */
  231. AT91_REG PMC_MCFR; /* Main Clock Frequency Register */
  232. AT91_REG PMC_PLLAR; /* PLL A Register */
  233. AT91_REG PMC_PLLBR; /* PLL B Register */
  234. AT91_REG PMC_MCKR; /* Master Clock Register */
  235. AT91_REG Reserved1[3];
  236. AT91_REG PMC_PCKR[8]; /* Programmable Clock Register */
  237. AT91_REG PMC_IER; /* Interrupt Enable Register */
  238. AT91_REG PMC_IDR; /* Interrupt Disable Register */
  239. AT91_REG PMC_SR; /* Status Register */
  240. AT91_REG PMC_IMR; /* Interrupt Mask Register */
  241. } AT91S_PMC, *AT91PS_PMC;
  242. /* PMC_SCER : (PMC Offset: 0x0) System Clock Enable Register */
  243. #define AT91C_PMC_PCK (0x1 << 0) /* Processor Clock */
  244. #define AT91C_PMC_OTG (0x1 << 5) /* USB OTG Clock */
  245. #define AT91C_PMC_UHP (0x1 << 6) /* USB Host Port Clock */
  246. #define AT91C_PMC_UDP (0x1 << 7) /* USB Device Port Clock */
  247. #define AT91C_PMC_PCK0 (0x1 << 8) /* Programmable Clock Output */
  248. #define AT91C_PMC_PCK1 (0x1 << 9) /* Programmable Clock Output */
  249. #define AT91C_PMC_PCK2 (0x1 << 10) /* Programmable Clock Output */
  250. #define AT91C_PMC_PCK3 (0x1 << 11) /* Programmable Clock Output */
  251. /* PMC_SCDR : (PMC Offset: 0x4) System Clock Disable Register */
  252. /* PMC_SCSR : (PMC Offset: 0x8) System Clock Status Register */
  253. /* CKGR_UCKR : (PMC Offset: 0x1c) UTMI Clock Configuration Register */
  254. /* CKGR_MOR : (PMC Offset: 0x20) Main Oscillator Register */
  255. /* CKGR_MCFR : (PMC Offset: 0x24) Main Clock Frequency Register */
  256. /* CKGR_PLLAR : (PMC Offset: 0x28) PLL A Register */
  257. /* CKGR_PLLBR : (PMC Offset: 0x2c) PLL B Register */
  258. /* PMC_MCKR : (PMC Offset: 0x30) Master Clock Register */
  259. #define AT91C_PMC_CSS (0x3 << 0) /* Clock Selection */
  260. #define AT91C_PMC_CSS_SLOW_CLK (0x0 << 0) /* Slow Clk */
  261. #define AT91C_PMC_CSS_MAIN_CLK (0x1 << 0) /* Main Clk */
  262. #define AT91C_PMC_CSS_PLLA_CLK (0x2 << 0) /* PLL A Clk */
  263. #define AT91C_PMC_CSS_PLLB_CLK (0x3 << 0) /* PLL B Clk */
  264. #define AT91C_PMC_PRES (0x7 << 2) /* Clock Prescaler */
  265. #define AT91C_PMC_PRES_CLK (0x0 << 2)
  266. #define AT91C_PMC_PRES_CLK_2 (0x1 << 2)
  267. #define AT91C_PMC_PRES_CLK_4 (0x2 << 2)
  268. #define AT91C_PMC_PRES_CLK_8 (0x3 << 2)
  269. #define AT91C_PMC_PRES_CLK_16 (0x4 << 2)
  270. #define AT91C_PMC_PRES_CLK_32 (0x5 << 2)
  271. #define AT91C_PMC_PRES_CLK_64 (0x6 << 2)
  272. #define AT91C_PMC_MDIV (0x3 << 8) /* Master Clock Division */
  273. #define AT91C_PMC_MDIV_1 (0x0 << 8)
  274. #define AT91C_PMC_MDIV_2 (0x1 << 8)
  275. #define AT91C_PMC_MDIV_4 (0x2 << 8)
  276. /* PMC_PCKR : (PMC Offset: 0x40) Programmable Clock Register */
  277. /* PMC_IER : (PMC Offset: 0x60) PMC Interrupt Enable Register */
  278. #define AT91C_PMC_MOSCS (0x1 << 0) /* MOSC mask */
  279. #define AT91C_PMC_LOCKA (0x1 << 1) /* PLL A mask */
  280. #define AT91C_PMC_LOCKB (0x1 << 2) /* PLL B mask */
  281. #define AT91C_PMC_MCKRDY (0x1 << 3) /* Master mask */
  282. #define AT91C_PMC_LOCKU (0x1 << 6) /* PLL UTMI mask */
  283. #define AT91C_PMC_PCK0RDY (0x1 << 8) /* PCK0_RDY mask */
  284. #define AT91C_PMC_PCK1RDY (0x1 << 9) /* PCK1_RDY mask */
  285. #define AT91C_PMC_PCK2RDY (0x1 << 10) /* PCK2_RDY mask */
  286. #define AT91C_PMC_PCK3RDY (0x1 << 11) /* PCK3_RDY mask */
  287. /* PMC_IDR : (PMC Offset: 0x64) PMC Interrupt Disable Register */
  288. /* PMC_SR : (PMC Offset: 0x68) PMC Status Register */
  289. /* PMC_IMR : (PMC Offset: 0x6c) PMC Interrupt Mask Register */
  290. /* Reset controller */
  291. typedef struct _AT91S_RSTC {
  292. AT91_REG RSTC_RCR; /* Reset Control Register */
  293. AT91_REG RSTC_RSR; /* Reset Status Register */
  294. AT91_REG RSTC_RMR; /* Reset Mode Register */
  295. } AT91S_RSTC, *AT91PS_RSTC;
  296. /* RSTC_RCR : (RSTC Offset: 0x0) Reset Control Register */
  297. #define AT91C_RSTC_PROCRST (0x1 << 0) /* Processor Reset */
  298. #define AT91C_RSTC_ICERST (0x1 << 1) /* ICE Interface Reset */
  299. #define AT91C_RSTC_PERRST (0x1 << 2) /* Peripheral Reset */
  300. #define AT91C_RSTC_EXTRST (0x1 << 3) /* External Reset */
  301. #define AT91C_RSTC_KEY (0xFF << 24) /* Password */
  302. /* RSTC_RSR : (RSTC Offset: 0x4) Reset Status Register */
  303. #define AT91C_RSTC_URSTS (0x1 << 0) /* User Reset Status */
  304. #define AT91C_RSTC_RSTTYP (0x7 << 8) /* Reset Type */
  305. #define AT91C_RSTC_RSTTYP_GENERAL (0x0 << 8)
  306. #define AT91C_RSTC_RSTTYP_WAKEUP (0x1 << 8)
  307. #define AT91C_RSTC_RSTTYP_WATCHDOG (0x2 << 8)
  308. #define AT91C_RSTC_RSTTYP_SOFTWARE (0x3 << 8)
  309. #define AT91C_RSTC_RSTTYP_USER (0x4 << 8)
  310. #define AT91C_RSTC_NRSTL (0x1 << 16) /* NRST pin level */
  311. #define AT91C_RSTC_SRCMP (0x1 << 17) /* Software Rst in Progress. */
  312. /* RSTC_RMR : (RSTC Offset: 0x8) Reset Mode Register */
  313. #define AT91C_RSTC_URSTEN (0x1 << 0) /* User Reset Enable */
  314. #define AT91C_RSTC_URSTIEN (0x1 << 4) /* User Reset Int. Enable */
  315. #define AT91C_RSTC_ERSTL (0xF << 8) /* User Reset Enable */
  316. /* Periodic Timer Controller */
  317. typedef struct _AT91S_PITC {
  318. AT91_REG PITC_PIMR; /* Period Interval Mode Register */
  319. AT91_REG PITC_PISR; /* Period Interval Status Register */
  320. AT91_REG PITC_PIVR; /* Period Interval Value Register */
  321. AT91_REG PITC_PIIR; /* Period Interval Image Register */
  322. } AT91S_PITC, *AT91PS_PITC;
  323. /* PITC_PIMR : (PITC Offset: 0x0) Periodic Interval Mode Register */
  324. #define AT91C_PITC_PIV (0xFFFFF << 0) /* Periodic Interval Value */
  325. #define AT91C_PITC_PITEN (0x1 << 24) /* PIT Enable */
  326. #define AT91C_PITC_PITIEN (0x1 << 25) /* PIT Interrupt Enable */
  327. /* PITC_PISR : (PITC Offset: 0x4) Periodic Interval Status Register */
  328. #define AT91C_PITC_PITS (0x1 << 0) /* PIT Status */
  329. /* PITC_PIVR : (PITC Offset: 0x8) Periodic Interval Value Register */
  330. #define AT91C_PITC_CPIV (0xFFFFF << 0) /* Current Value */
  331. #define AT91C_PITC_PICNT (0xFFF << 20) /* Periodic Interval Counter */
  332. /* PITC_PIIR : (PITC Offset: 0xc) Periodic Interval Image Register */
  333. /* Serial Paraller Interface */
  334. typedef struct _AT91S_SPI {
  335. AT91_REG SPI_CR; /* Control Register */
  336. AT91_REG SPI_MR; /* Mode Register */
  337. AT91_REG SPI_RDR; /* Receive Data Register */
  338. AT91_REG SPI_TDR; /* Transmit Data Register */
  339. AT91_REG SPI_SR; /* Status Register */
  340. AT91_REG SPI_IER; /* Interrupt Enable Register */
  341. AT91_REG SPI_IDR; /* Interrupt Disable Register */
  342. AT91_REG SPI_IMR; /* Interrupt Mask Register */
  343. AT91_REG Reserved0[4];
  344. AT91_REG SPI_CSR[4]; /* Chip Select Register */
  345. AT91_REG Reserved1[48];
  346. AT91_REG SPI_RPR; /* Receive Pointer Register */
  347. AT91_REG SPI_RCR; /* Receive Counter Register */
  348. AT91_REG SPI_TPR; /* Transmit Pointer Register */
  349. AT91_REG SPI_TCR; /* Transmit Counter Register */
  350. AT91_REG SPI_RNPR; /* Receive Next Pointer Register */
  351. AT91_REG SPI_RNCR; /* Receive Next Counter Register */
  352. AT91_REG SPI_TNPR; /* Transmit Next Pointer Register */
  353. AT91_REG SPI_TNCR; /* Transmit Next Counter Register */
  354. AT91_REG SPI_PTCR; /* PDC Transfer Control Register */
  355. AT91_REG SPI_PTSR; /* PDC Transfer Status Register */
  356. } AT91S_SPI, *AT91PS_SPI;
  357. /* SPI_CR : (SPI Offset: 0x0) SPI Control Register */
  358. #define AT91C_SPI_SPIEN (0x1 << 0) /* SPI Enable */
  359. #define AT91C_SPI_SPIDIS (0x1 << 1) /* SPI Disable */
  360. #define AT91C_SPI_SWRST (0x1 << 7) /* SPI Software reset */
  361. #define AT91C_SPI_LASTXFER (0x1 << 24) /* SPI Last Transfer */
  362. /* SPI_MR : (SPI Offset: 0x4) SPI Mode Register */
  363. #define AT91C_SPI_MSTR (0x1 << 0) /* Master/Slave Mode */
  364. #define AT91C_SPI_PS (0x1 << 1) /* Peripheral Select */
  365. #define AT91C_SPI_PS_FIXED (0x0 << 1)
  366. #define AT91C_SPI_PS_VARIABLE (0x1 << 1)
  367. #define AT91C_SPI_PCSDEC (0x1 << 2) /* Chip Select Decode */
  368. #define AT91C_SPI_FDIV (0x1 << 3) /* Clock Selection */
  369. #define AT91C_SPI_MODFDIS (0x1 << 4) /* Mode Fault Detection */
  370. #define AT91C_SPI_LLB (0x1 << 7) /* Clock Selection */
  371. #define AT91C_SPI_PCS (0xF << 16) /* Peripheral Chip Select */
  372. #define AT91C_SPI_DLYBCS (0xFF << 24) /* Delay Between Chip Selects */
  373. /* SPI_RDR : (SPI Offset: 0x8) Receive Data Register */
  374. #define AT91C_SPI_RD (0xFFFF << 0) /* Receive Data */
  375. #define AT91C_SPI_RPCS (0xF << 16) /* Peripheral CS Status */
  376. /* SPI_TDR : (SPI Offset: 0xc) Transmit Data Register */
  377. #define AT91C_SPI_TD (0xFFFF << 0) /* Transmit Data */
  378. #define AT91C_SPI_TPCS (0xF << 16) /* Peripheral CS Status */
  379. /* SPI_SR : (SPI Offset: 0x10) Status Register */
  380. #define AT91C_SPI_RDRF (0x1 << 0) /* Receive Data Register Full */
  381. #define AT91C_SPI_TDRE (0x1 << 1) /* Trans. Data Register Empty */
  382. #define AT91C_SPI_MODF (0x1 << 2) /* Mode Fault Error */
  383. #define AT91C_SPI_OVRES (0x1 << 3) /* Overrun Error Status */
  384. #define AT91C_SPI_ENDRX (0x1 << 4) /* End of Receiver Transfer */
  385. #define AT91C_SPI_ENDTX (0x1 << 5) /* End of Receiver Transfer */
  386. #define AT91C_SPI_RXBUFF (0x1 << 6) /* RXBUFF Interrupt */
  387. #define AT91C_SPI_TXBUFE (0x1 << 7) /* TXBUFE Interrupt */
  388. #define AT91C_SPI_NSSR (0x1 << 8) /* NSSR Interrupt */
  389. #define AT91C_SPI_TXEMPTY (0x1 << 9) /* TXEMPTY Interrupt */
  390. #define AT91C_SPI_SPIENS (0x1 << 16) /* Enable Status */
  391. /* SPI_IER : (SPI Offset: 0x14) Interrupt Enable Register */
  392. /* SPI_IDR : (SPI Offset: 0x18) Interrupt Disable Register */
  393. /* SPI_IMR : (SPI Offset: 0x1c) Interrupt Mask Register */
  394. /* SPI_CSR : (SPI Offset: 0x30) Chip Select Register */
  395. #define AT91C_SPI_CPOL (0x1 << 0) /* Clock Polarity */
  396. #define AT91C_SPI_NCPHA (0x1 << 1) /* Clock Phase */
  397. #define AT91C_SPI_CSAAT (0x1 << 3) /* CS Active After Transfer */
  398. #define AT91C_SPI_BITS (0xF << 4) /* Bits Per Transfer */
  399. #define AT91C_SPI_BITS_8 (0x0 << 4) /* 8 Bits */
  400. #define AT91C_SPI_BITS_9 (0x1 << 4) /* 9 Bits */
  401. #define AT91C_SPI_BITS_10 (0x2 << 4) /* 10 Bits */
  402. #define AT91C_SPI_BITS_11 (0x3 << 4) /* 11 Bits */
  403. #define AT91C_SPI_BITS_12 (0x4 << 4) /* 12 Bits */
  404. #define AT91C_SPI_BITS_13 (0x5 << 4) /* 13 Bits */
  405. #define AT91C_SPI_BITS_14 (0x6 << 4) /* 14 Bits */
  406. #define AT91C_SPI_BITS_15 (0x7 << 4) /* 15 Bits */
  407. #define AT91C_SPI_BITS_16 (0x8 << 4) /* 16 Bits */
  408. #define AT91C_SPI_SCBR (0xFF << 8) /* Serial Clock Baud Rate */
  409. #define AT91C_SPI_DLYBS (0xFF << 16) /* Delay Before SPCK */
  410. #define AT91C_SPI_DLYBCT (0xFF << 24) /* Delay Between Transfers */
  411. /* SPI_PTCR : PDC Transfer Control Register */
  412. #define AT91C_PDC_RXTEN (0x1 << 0) /* Receiver Transfer Enable */
  413. #define AT91C_PDC_RXTDIS (0x1 << 1) /* Receiver Transfer Disable */
  414. #define AT91C_PDC_TXTEN (0x1 << 8) /* Transm. Transfer Enable */
  415. #define AT91C_PDC_TXTDIS (0x1 << 9) /* Transm. Transfer Disable */
  416. /* PIO definitions */
  417. #define AT91C_PIO_PA0 (1 << 0) /* Pin Controlled by PA0 */
  418. #define AT91C_PA0_SPI0_MISO AT91C_PIO_PA0
  419. #define AT91C_PIO_PA1 (1 << 1) /* Pin Controlled by PA1 */
  420. #define AT91C_PA1_SPI0_MOSI AT91C_PIO_PA1
  421. #define AT91C_PIO_PA2 (1 << 2) /* Pin Controlled by PA2 */
  422. #define AT91C_PA2_SPI0_SPCK AT91C_PIO_PA2
  423. #define AT91C_PIO_PA3 (1 << 3) /* Pin Controlled by PA3 */
  424. #define AT91C_PA3_SPI0_NPCS1 AT91C_PIO_PA3
  425. #define AT91C_PIO_PA4 (1 << 4) /* Pin Controlled by PA4 */
  426. #define AT91C_PA4_SPI0_NPCS2A AT91C_PIO_PA4
  427. #define AT91C_PIO_PA5 (1 << 5) /* Pin Controlled by PA5 */
  428. #define AT91C_PA5_SPI0_NPCS0 AT91C_PIO_PA5
  429. #define AT91C_PIO_PA10 (1 << 10) /* Pin Controlled by PA10 */
  430. #define AT91C_PIO_PA11 (1 << 11) /* Pin Controlled by PA11 */
  431. #define AT91C_PIO_PA22 (1 << 22) /* Pin Controlled by PA22 */
  432. #define AT91C_PA22_TXD0 AT91C_PIO_PA22
  433. #define AT91C_PIO_PA23 (1 << 23) /* Pin Controlled by PA23 */
  434. #define AT91C_PA23_RXD0 AT91C_PIO_PA23
  435. #define AT91C_PIO_PA28 (1 << 28) /* Pin Controlled by PA28 */
  436. #define AT91C_PA28_SPI0_NPCS3A AT91C_PIO_PA28
  437. #define AT91C_PIO_PB21 (1 << 21) /* Pin Controlled by PB21 */
  438. #define AT91C_PB21_E_TXCK AT91C_PIO_PB21
  439. #define AT91C_PIO_PB22 (1 << 22) /* Pin Controlled by PB22 */
  440. #define AT91C_PB22_E_RXDV AT91C_PIO_PB22
  441. #define AT91C_PIO_PB23 (1 << 23) /* Pin Controlled by PB23 */
  442. #define AT91C_PB23_E_TX0 AT91C_PIO_PB23
  443. #define AT91C_PIO_PB24 (1 << 24) /* Pin Controlled by PB24 */
  444. #define AT91C_PB24_E_TX1 AT91C_PIO_PB24
  445. #define AT91C_PIO_PB25 (1 << 25) /* Pin Controlled by PB25 */
  446. #define AT91C_PB25_E_RX0 AT91C_PIO_PB25
  447. #define AT91C_PIO_PB26 (1 << 26) /* Pin Controlled by PB26 */
  448. #define AT91C_PB26_E_RX1 AT91C_PIO_PB26
  449. #define AT91C_PIO_PB27 (1 << 27) /* Pin Controlled by PB27 */
  450. #define AT91C_PB27_E_RXER AT91C_PIO_PB27
  451. #define AT91C_PIO_PB28 (1 << 28) /* Pin Controlled by PB28 */
  452. #define AT91C_PB28_E_TXEN AT91C_PIO_PB28
  453. #define AT91C_PIO_PB29 (1 << 29) /* Pin Controlled by PB29 */
  454. #define AT91C_PB29_E_MDC AT91C_PIO_PB29
  455. #define AT91C_PIO_PB30 (1 << 30) /* Pin Controlled by PB30 */
  456. #define AT91C_PB30_E_MDIO AT91C_PIO_PB30
  457. #define AT91C_PIO_PB31 (1 << 31) /* Pin Controlled by PB31 */
  458. #define AT91C_PIO_PC29 (1 << 29) /* Pin Controlled by PC29 */
  459. #define AT91C_PIO_PC30 (1 << 30) /* Pin Controlled by PC30 */
  460. #define AT91C_PC30_DRXD AT91C_PIO_PC30
  461. #define AT91C_PIO_PC31 (1 << 31) /* Pin Controlled by PC31 */
  462. #define AT91C_PC31_DTXD AT91C_PIO_PC31
  463. #define AT91C_PIO_PD0 (1 << 0) /* Pin Controlled by PD0 */
  464. #define AT91C_PD0_TXD1 AT91C_PIO_PD0
  465. #define AT91C_PD0_SPI0_NPCS2D AT91C_PIO_PD0
  466. #define AT91C_PIO_PD1 (1 << 1) /* Pin Controlled by PD1 */
  467. #define AT91C_PD1_RXD1 AT91C_PIO_PD1
  468. #define AT91C_PD1_SPI0_NPCS3D AT91C_PIO_PD1
  469. #define AT91C_PIO_PD2 (1 << 2) /* Pin Controlled by PD2 */
  470. #define AT91C_PD2_TXD2 AT91C_PIO_PD2
  471. #define AT91C_PIO_PD3 (1 << 3) /* Pin Controlled by PD3 */
  472. #define AT91C_PD3_RXD2 AT91C_PIO_PD3
  473. #define AT91C_PIO_PD15 (1 << 15) /* Pin Controlled by PD15 */
  474. /* Peripheral ID */
  475. #define AT91C_ID_SYS 1 /* System Controller */
  476. #define AT91C_ID_PIOABCD 2 /* Parallel IO Controller A, B, C, D */
  477. #define AT91C_ID_US0 8 /* USART 0 */
  478. #define AT91C_ID_US1 9 /* USART 1 */
  479. #define AT91C_ID_US2 10 /* USART 2 */
  480. #define AT91C_ID_SPI0 15 /* Serial Peripheral Interface 0 */
  481. #define AT91C_ID_EMAC 22 /* Ethernet Mac */
  482. #define AT91C_ID_UHP 29 /* USB Host Port */
  483. /* Base addresses */
  484. #define AT91C_BASE_SMC ((AT91PS_SMC) 0xFFFFE800) /* SMC */
  485. #define AT91C_BASE_CCFG ((AT91PS_CCFG) 0xFFFFEB10) /* CCFG */
  486. #define AT91C_BASE_DBGU ((unsigned long)0xFFFFEE00) /* DBGU */
  487. #define AT91C_BASE_PIOA ((AT91PS_PIO) 0xFFFFF200) /* PIOA */
  488. #define AT91C_BASE_PIOB ((AT91PS_PIO) 0xFFFFF400) /* PIOB */
  489. #define AT91C_BASE_PIOC ((AT91PS_PIO) 0xFFFFF600) /* PIOC */
  490. #define AT91C_BASE_PIOD ((AT91PS_PIO) 0xFFFFF800) /* PIOD */
  491. #define AT91C_BASE_PMC ((AT91PS_PMC) 0xFFFFFC00) /* PMC */
  492. #define AT91C_BASE_RSTC ((AT91PS_RSTC) 0xFFFFFD00) /* RSTC */
  493. #define AT91C_BASE_PITC ((AT91PS_PITC) 0xFFFFFD30) /* PITC */
  494. #define AT91C_BASE_US0 ((unsigned long)0xFFF8C000) /* US0 */
  495. #define AT91C_BASE_US1 ((unsigned long)0xFFF90000) /* US1 */
  496. #define AT91C_BASE_US2 ((unsigned long)0xFFF94000) /* US2 */
  497. #define AT91C_BASE_SPI0 ((AT91PS_SPI) 0xFFFA4000) /* SPI0 */
  498. #define AT91C_BASE_MACB ((unsigned long)0xFFFBC000) /* MACB */
  499. #endif