MC68EZ328.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254
  1. /* include/asm-m68knommu/MC68EZ328.h: 'EZ328 control registers
  2. *
  3. * Copyright (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>
  4. * Bear & Hare Software, Inc.
  5. *
  6. * Based on include/asm-m68knommu/MC68332.h
  7. * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>,
  8. * The Silver Hammer Group, Ltd.
  9. *
  10. */
  11. #ifndef _MC68EZ328_H_
  12. #define _MC68EZ328_H_
  13. #define BYTE_REF(addr) (*((volatile unsigned char*)addr))
  14. #define WORD_REF(addr) (*((volatile unsigned short*)addr))
  15. #define LONG_REF(addr) (*((volatile unsigned long*)addr))
  16. #define PUT_FIELD(field, val) (((val) << field##_SHIFT) & field##_MASK)
  17. #define GET_FIELD(reg, field) (((reg) & field##_MASK) >> field##_SHIFT)
  18. /**********
  19. *
  20. * 0xFFFFF0xx -- System Control
  21. *
  22. **********/
  23. /*
  24. * System Control Register (SCR)
  25. */
  26. #define SCR_ADDR 0xfffff000
  27. #define SCR BYTE_REF(SCR_ADDR)
  28. #define SCR_WDTH8 0x01 /* 8-Bit Width Select */
  29. #define SCR_DMAP 0x04 /* Double Map */
  30. #define SCR_SO 0x08 /* Supervisor Only */
  31. #define SCR_BETEN 0x10 /* Bus-Error Time-Out Enable */
  32. #define SCR_PRV 0x20 /* Privilege Violation */
  33. #define SCR_WPV 0x40 /* Write Protect Violation */
  34. #define SCR_BETO 0x80 /* Bus-Error TimeOut */
  35. /*
  36. * Silicon ID Register (Mask Revision Register (MRR) for '328 Compatibility)
  37. */
  38. #define MRR_ADDR 0xfffff004
  39. #define MRR LONG_REF(MRR_ADDR)
  40. /**********
  41. *
  42. * 0xFFFFF1xx -- Chip-Select logic
  43. *
  44. **********/
  45. /*
  46. * Chip Select Group Base Registers
  47. */
  48. #define CSGBA_ADDR 0xfffff100
  49. #define CSGBB_ADDR 0xfffff102
  50. #define CSGBC_ADDR 0xfffff104
  51. #define CSGBD_ADDR 0xfffff106
  52. #define CSGBA WORD_REF(CSGBA_ADDR)
  53. #define CSGBB WORD_REF(CSGBB_ADDR)
  54. #define CSGBC WORD_REF(CSGBC_ADDR)
  55. #define CSGBD WORD_REF(CSGBD_ADDR)
  56. /*
  57. * Chip Select Registers
  58. */
  59. #define CSA_ADDR 0xfffff110
  60. #define CSB_ADDR 0xfffff112
  61. #define CSC_ADDR 0xfffff114
  62. #define CSD_ADDR 0xfffff116
  63. #define CSA WORD_REF(CSA_ADDR)
  64. #define CSB WORD_REF(CSB_ADDR)
  65. #define CSC WORD_REF(CSC_ADDR)
  66. #define CSD WORD_REF(CSD_ADDR)
  67. #define CSA_EN 0x0001 /* Chip-Select Enable */
  68. #define CSA_SIZ_MASK 0x000e /* Chip-Select Size */
  69. #define CSA_SIZ_SHIFT 1
  70. #define CSA_WS_MASK 0x0070 /* Wait State */
  71. #define CSA_WS_SHIFT 4
  72. #define CSA_BSW 0x0080 /* Data Bus Width */
  73. #define CSA_FLASH 0x0100 /* FLASH Memory Support */
  74. #define CSA_RO 0x8000 /* Read-Only */
  75. #define CSB_EN 0x0001 /* Chip-Select Enable */
  76. #define CSB_SIZ_MASK 0x000e /* Chip-Select Size */
  77. #define CSB_SIZ_SHIFT 1
  78. #define CSB_WS_MASK 0x0070 /* Wait State */
  79. #define CSB_WS_SHIFT 4
  80. #define CSB_BSW 0x0080 /* Data Bus Width */
  81. #define CSB_FLASH 0x0100 /* FLASH Memory Support */
  82. #define CSB_UPSIZ_MASK 0x1800 /* Unprotected memory block size */
  83. #define CSB_UPSIZ_SHIFT 11
  84. #define CSB_ROP 0x2000 /* Readonly if protected */
  85. #define CSB_SOP 0x4000 /* Supervisor only if protected */
  86. #define CSB_RO 0x8000 /* Read-Only */
  87. #define CSC_EN 0x0001 /* Chip-Select Enable */
  88. #define CSC_SIZ_MASK 0x000e /* Chip-Select Size */
  89. #define CSC_SIZ_SHIFT 1
  90. #define CSC_WS_MASK 0x0070 /* Wait State */
  91. #define CSC_WS_SHIFT 4
  92. #define CSC_BSW 0x0080 /* Data Bus Width */
  93. #define CSC_FLASH 0x0100 /* FLASH Memory Support */
  94. #define CSC_UPSIZ_MASK 0x1800 /* Unprotected memory block size */
  95. #define CSC_UPSIZ_SHIFT 11
  96. #define CSC_ROP 0x2000 /* Readonly if protected */
  97. #define CSC_SOP 0x4000 /* Supervisor only if protected */
  98. #define CSC_RO 0x8000 /* Read-Only */
  99. #define CSD_EN 0x0001 /* Chip-Select Enable */
  100. #define CSD_SIZ_MASK 0x000e /* Chip-Select Size */
  101. #define CSD_SIZ_SHIFT 1
  102. #define CSD_WS_MASK 0x0070 /* Wait State */
  103. #define CSD_WS_SHIFT 4
  104. #define CSD_BSW 0x0080 /* Data Bus Width */
  105. #define CSD_FLASH 0x0100 /* FLASH Memory Support */
  106. #define CSD_DRAM 0x0200 /* Dram Selection */
  107. #define CSD_COMB 0x0400 /* Combining */
  108. #define CSD_UPSIZ_MASK 0x1800 /* Unprotected memory block size */
  109. #define CSD_UPSIZ_SHIFT 11
  110. #define CSD_ROP 0x2000 /* Readonly if protected */
  111. #define CSD_SOP 0x4000 /* Supervisor only if protected */
  112. #define CSD_RO 0x8000 /* Read-Only */
  113. /*
  114. * Emulation Chip-Select Register
  115. */
  116. #define EMUCS_ADDR 0xfffff118
  117. #define EMUCS WORD_REF(EMUCS_ADDR)
  118. #define EMUCS_WS_MASK 0x0070
  119. #define EMUCS_WS_SHIFT 4
  120. /**********
  121. *
  122. * 0xFFFFF2xx -- Phase Locked Loop (PLL) & Power Control
  123. *
  124. **********/
  125. /*
  126. * PLL Control Register
  127. */
  128. #define PLLCR_ADDR 0xfffff200
  129. #define PLLCR WORD_REF(PLLCR_ADDR)
  130. #define PLLCR_DISPLL 0x0008 /* Disable PLL */
  131. #define PLLCR_CLKEN 0x0010 /* Clock (CLKO pin) enable */
  132. #define PLLCR_PRESC 0x0020 /* VCO prescaler */
  133. #define PLLCR_SYSCLK_SEL_MASK 0x0700 /* System Clock Selection */
  134. #define PLLCR_SYSCLK_SEL_SHIFT 8
  135. #define PLLCR_LCDCLK_SEL_MASK 0x3800 /* LCD Clock Selection */
  136. #define PLLCR_LCDCLK_SEL_SHIFT 11
  137. /* '328-compatible definitions */
  138. #define PLLCR_PIXCLK_SEL_MASK PLLCR_LCDCLK_SEL_MASK
  139. #define PLLCR_PIXCLK_SEL_SHIFT PLLCR_LCDCLK_SEL_SHIFT
  140. /*
  141. * PLL Frequency Select Register
  142. */
  143. #define PLLFSR_ADDR 0xfffff202
  144. #define PLLFSR WORD_REF(PLLFSR_ADDR)
  145. #define PLLFSR_PC_MASK 0x00ff /* P Count */
  146. #define PLLFSR_PC_SHIFT 0
  147. #define PLLFSR_QC_MASK 0x0f00 /* Q Count */
  148. #define PLLFSR_QC_SHIFT 8
  149. #define PLLFSR_PROT 0x4000 /* Protect P & Q */
  150. #define PLLFSR_CLK32 0x8000 /* Clock 32 (kHz) */
  151. /*
  152. * Power Control Register
  153. */
  154. #define PCTRL_ADDR 0xfffff207
  155. #define PCTRL BYTE_REF(PCTRL_ADDR)
  156. #define PCTRL_WIDTH_MASK 0x1f /* CPU Clock bursts width */
  157. #define PCTRL_WIDTH_SHIFT 0
  158. #define PCTRL_PCEN 0x80 /* Power Control Enable */
  159. /**********
  160. *
  161. * 0xFFFFF3xx -- Interrupt Controller
  162. *
  163. **********/
  164. /*
  165. * Interrupt Vector Register
  166. */
  167. #define IVR_ADDR 0xfffff300
  168. #define IVR BYTE_REF(IVR_ADDR)
  169. #define IVR_VECTOR_MASK 0xF8
  170. /*
  171. * Interrupt control Register
  172. */
  173. #define ICR_ADDR 0xfffff302
  174. #define ICR WORD_REF(ICR_ADDR)
  175. #define ICR_POL5 0x0080 /* Polarity Control for IRQ5 */
  176. #define ICR_ET6 0x0100 /* Edge Trigger Select for IRQ6 */
  177. #define ICR_ET3 0x0200 /* Edge Trigger Select for IRQ3 */
  178. #define ICR_ET2 0x0400 /* Edge Trigger Select for IRQ2 */
  179. #define ICR_ET1 0x0800 /* Edge Trigger Select for IRQ1 */
  180. #define ICR_POL6 0x1000 /* Polarity Control for IRQ6 */
  181. #define ICR_POL3 0x2000 /* Polarity Control for IRQ3 */
  182. #define ICR_POL2 0x4000 /* Polarity Control for IRQ2 */
  183. #define ICR_POL1 0x8000 /* Polarity Control for IRQ1 */
  184. /*
  185. * Interrupt Mask Register
  186. */
  187. #define IMR_ADDR 0xfffff304
  188. #define IMR LONG_REF(IMR_ADDR)
  189. /*
  190. * Define the names for bit positions first. This is useful for
  191. * request_irq
  192. */
  193. #define SPI_IRQ_NUM 0 /* SPI interrupt */
  194. #define TMR_IRQ_NUM 1 /* Timer interrupt */
  195. #define UART_IRQ_NUM 2 /* UART interrupt */
  196. #define WDT_IRQ_NUM 3 /* Watchdog Timer interrupt */
  197. #define RTC_IRQ_NUM 4 /* RTC interrupt */
  198. #define KB_IRQ_NUM 6 /* Keyboard Interrupt */
  199. #define PWM_IRQ_NUM 7 /* Pulse-Width Modulator int. */
  200. #define INT0_IRQ_NUM 8 /* External INT0 */
  201. #define INT1_IRQ_NUM 9 /* External INT1 */
  202. #define INT2_IRQ_NUM 10 /* External INT2 */
  203. #define INT3_IRQ_NUM 11 /* External INT3 */
  204. #define IRQ1_IRQ_NUM 16 /* IRQ1 */
  205. #define IRQ2_IRQ_NUM 17 /* IRQ2 */
  206. #define IRQ3_IRQ_NUM 18 /* IRQ3 */
  207. #define IRQ6_IRQ_NUM 19 /* IRQ6 */
  208. #define IRQ5_IRQ_NUM 20 /* IRQ5 */
  209. #define SAM_IRQ_NUM 22 /* Sampling Timer for RTC */
  210. #define EMIQ_IRQ_NUM 23 /* Emulator Interrupt */
  211. /* '328-compatible definitions */
  212. #define SPIM_IRQ_NUM SPI_IRQ_NUM
  213. #define TMR1_IRQ_NUM TMR_IRQ_NUM
  214. /*
  215. * Here go the bitmasks themselves
  216. */
  217. #define IMR_MSPI (1 << SPI_IRQ_NUM) /* Mask SPI interrupt */
  218. #define IMR_MTMR (1 << TMR_IRQ_NUM) /* Mask Timer interrupt */
  219. #define IMR_MUART (1 << UART_IRQ_NUM) /* Mask UART interrupt */
  220. #define IMR_MWDT (1 << WDT_IRQ_NUM) /* Mask Watchdog Timer interrupt */
  221. #define IMR_MRTC (1 << RTC_IRQ_NUM) /* Mask RTC interrupt */
  222. #define IMR_MKB (1 << KB_IRQ_NUM) /* Mask Keyboard Interrupt */
  223. #define IMR_MPWM (1 << PWM_IRQ_NUM) /* Mask Pulse-Width Modulator int. */
  224. #define IMR_MINT0 (1 << INT0_IRQ_NUM) /* Mask External INT0 */
  225. #define IMR_MINT1 (1 << INT1_IRQ_NUM) /* Mask External INT1 */
  226. #define IMR_MINT2 (1 << INT2_IRQ_NUM) /* Mask External INT2 */
  227. #define IMR_MINT3 (1 << INT3_IRQ_NUM) /* Mask External INT3 */
  228. #define IMR_MIRQ1 (1 << IRQ1_IRQ_NUM) /* Mask IRQ1 */
  229. #define IMR_MIRQ2 (1 << IRQ2_IRQ_NUM) /* Mask IRQ2 */
  230. #define IMR_MIRQ3 (1 << IRQ3_IRQ_NUM) /* Mask IRQ3 */
  231. #define IMR_MIRQ6 (1 << IRQ6_IRQ_NUM) /* Mask IRQ6 */
  232. #define IMR_MIRQ5 (1 << IRQ5_IRQ_NUM) /* Mask IRQ5 */
  233. #define IMR_MSAM (1 << SAM_IRQ_NUM) /* Mask Sampling Timer for RTC */
  234. #define IMR_MEMIQ (1 << EMIQ_IRQ_NUM) /* Mask Emulator Interrupt */
  235. /* '328-compatible definitions */
  236. #define IMR_MSPIM IMR_MSPI
  237. #define IMR_MTMR1 IMR_MTMR
  238. /*
  239. * Interrupt Status Register
  240. */
  241. #define ISR_ADDR 0xfffff30c
  242. #define ISR LONG_REF(ISR_ADDR)
  243. #define ISR_SPI (1 << SPI_IRQ_NUM) /* SPI interrupt */
  244. #define ISR_TMR (1 << TMR_IRQ_NUM) /* Timer interrupt */
  245. #define ISR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
  246. #define ISR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
  247. #define ISR_RTC (1 << RTC_IRQ_NUM) /* RTC interrupt */
  248. #define ISR_KB (1 << KB_IRQ_NUM) /* Keyboard Interrupt */
  249. #define ISR_PWM (1 << PWM_IRQ_NUM) /* Pulse-Width Modulator interrupt */
  250. #define ISR_INT0 (1 << INT0_IRQ_NUM) /* External INT0 */
  251. #define ISR_INT1 (1 << INT1_IRQ_NUM) /* External INT1 */
  252. #define ISR_INT2 (1 << INT2_IRQ_NUM) /* External INT2 */
  253. #define ISR_INT3 (1 << INT3_IRQ_NUM) /* External INT3 */
  254. #define ISR_IRQ1 (1 << IRQ1_IRQ_NUM) /* IRQ1 */
  255. #define ISR_IRQ2 (1 << IRQ2_IRQ_NUM) /* IRQ2 */
  256. #define ISR_IRQ3 (1 << IRQ3_IRQ_NUM) /* IRQ3 */
  257. #define ISR_IRQ6 (1 << IRQ6_IRQ_NUM) /* IRQ6 */
  258. #define ISR_IRQ5 (1 << IRQ5_IRQ_NUM) /* IRQ5 */
  259. #define ISR_SAM (1 << SAM_IRQ_NUM) /* Sampling Timer for RTC */
  260. #define ISR_EMIQ (1 << EMIQ_IRQ_NUM) /* Emulator Interrupt */
  261. /* '328-compatible definitions */
  262. #define ISR_SPIM ISR_SPI
  263. #define ISR_TMR1 ISR_TMR
  264. /*
  265. * Interrupt Pending Register
  266. */
  267. #define IPR_ADDR 0xfffff30c
  268. #define IPR LONG_REF(IPR_ADDR)
  269. #define IPR_SPI (1 << SPI_IRQ_NUM) /* SPI interrupt */
  270. #define IPR_TMR (1 << TMR_IRQ_NUM) /* Timer interrupt */
  271. #define IPR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
  272. #define IPR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
  273. #define IPR_RTC (1 << RTC_IRQ_NUM) /* RTC interrupt */
  274. #define IPR_KB (1 << KB_IRQ_NUM) /* Keyboard Interrupt */
  275. #define IPR_PWM (1 << PWM_IRQ_NUM) /* Pulse-Width Modulator interrupt */
  276. #define IPR_INT0 (1 << INT0_IRQ_NUM) /* External INT0 */
  277. #define IPR_INT1 (1 << INT1_IRQ_NUM) /* External INT1 */
  278. #define IPR_INT2 (1 << INT2_IRQ_NUM) /* External INT2 */
  279. #define IPR_INT3 (1 << INT3_IRQ_NUM) /* External INT3 */
  280. #define IPR_IRQ1 (1 << IRQ1_IRQ_NUM) /* IRQ1 */
  281. #define IPR_IRQ2 (1 << IRQ2_IRQ_NUM) /* IRQ2 */
  282. #define IPR_IRQ3 (1 << IRQ3_IRQ_NUM) /* IRQ3 */
  283. #define IPR_IRQ6 (1 << IRQ6_IRQ_NUM) /* IRQ6 */
  284. #define IPR_IRQ5 (1 << IRQ5_IRQ_NUM) /* IRQ5 */
  285. #define IPR_SAM (1 << SAM_IRQ_NUM) /* Sampling Timer for RTC */
  286. #define IPR_EMIQ (1 << EMIQ_IRQ_NUM) /* Emulator Interrupt */
  287. /* '328-compatible definitions */
  288. #define IPR_SPIM IPR_SPI
  289. #define IPR_TMR1 IPR_TMR
  290. /**********
  291. *
  292. * 0xFFFFF4xx -- Parallel Ports
  293. *
  294. **********/
  295. /*
  296. * Port A
  297. */
  298. #define PADIR_ADDR 0xfffff400 /* Port A direction reg */
  299. #define PADATA_ADDR 0xfffff401 /* Port A data register */
  300. #define PAPUEN_ADDR 0xfffff402 /* Port A Pull-Up enable reg */
  301. #define PADIR BYTE_REF(PADIR_ADDR)
  302. #define PADATA BYTE_REF(PADATA_ADDR)
  303. #define PAPUEN BYTE_REF(PAPUEN_ADDR)
  304. #define PA(x) (1 << (x))
  305. /*
  306. * Port B
  307. */
  308. #define PBDIR_ADDR 0xfffff408 /* Port B direction reg */
  309. #define PBDATA_ADDR 0xfffff409 /* Port B data register */
  310. #define PBPUEN_ADDR 0xfffff40a /* Port B Pull-Up enable reg */
  311. #define PBSEL_ADDR 0xfffff40b /* Port B Select Register */
  312. #define PBDIR BYTE_REF(PBDIR_ADDR)
  313. #define PBDATA BYTE_REF(PBDATA_ADDR)
  314. #define PBPUEN BYTE_REF(PBPUEN_ADDR)
  315. #define PBSEL BYTE_REF(PBSEL_ADDR)
  316. #define PB(x) (1 << (x))
  317. #define PB_CSB0 0x01 /* Use CSB0 as PB[0] */
  318. #define PB_CSB1 0x02 /* Use CSB1 as PB[1] */
  319. #define PB_CSC0_RAS0 0x04 /* Use CSC0/RAS0 as PB[2] */
  320. #define PB_CSC1_RAS1 0x08 /* Use CSC1/RAS1 as PB[3] */
  321. #define PB_CSD0_CAS0 0x10 /* Use CSD0/CAS0 as PB[4] */
  322. #define PB_CSD1_CAS1 0x20 /* Use CSD1/CAS1 as PB[5] */
  323. #define PB_TIN_TOUT 0x40 /* Use TIN/TOUT as PB[6] */
  324. #define PB_PWMO 0x80 /* Use PWMO as PB[7] */
  325. /*
  326. * Port C
  327. */
  328. #define PCDIR_ADDR 0xfffff410 /* Port C direction reg */
  329. #define PCDATA_ADDR 0xfffff411 /* Port C data register */
  330. #define PCPDEN_ADDR 0xfffff412 /* Port C Pull-Down enb. reg */
  331. #define PCSEL_ADDR 0xfffff413 /* Port C Select Register */
  332. #define PCDIR BYTE_REF(PCDIR_ADDR)
  333. #define PCDATA BYTE_REF(PCDATA_ADDR)
  334. #define PCPDEN BYTE_REF(PCPDEN_ADDR)
  335. #define PCSEL BYTE_REF(PCSEL_ADDR)
  336. #define PC(x) (1 << (x))
  337. #define PC_LD0 0x01 /* Use LD0 as PC[0] */
  338. #define PC_LD1 0x02 /* Use LD1 as PC[1] */
  339. #define PC_LD2 0x04 /* Use LD2 as PC[2] */
  340. #define PC_LD3 0x08 /* Use LD3 as PC[3] */
  341. #define PC_LFLM 0x10 /* Use LFLM as PC[4] */
  342. #define PC_LLP 0x20 /* Use LLP as PC[5] */
  343. #define PC_LCLK 0x40 /* Use LCLK as PC[6] */
  344. #define PC_LACD 0x80 /* Use LACD as PC[7] */
  345. /*
  346. * Port D
  347. */
  348. #define PDDIR_ADDR 0xfffff418 /* Port D direction reg */
  349. #define PDDATA_ADDR 0xfffff419 /* Port D data register */
  350. #define PDPUEN_ADDR 0xfffff41a /* Port D Pull-Up enable reg */
  351. #define PDSEL_ADDR 0xfffff41b /* Port D Select Register */
  352. #define PDPOL_ADDR 0xfffff41c /* Port D Polarity Register */
  353. #define PDIRQEN_ADDR 0xfffff41d /* Port D IRQ enable register */
  354. #define PDKBEN_ADDR 0xfffff41e /* Port D Keyboard Enable reg */
  355. #define PDIQEG_ADDR 0xfffff41f /* Port D IRQ Edge Register */
  356. #define PDDIR BYTE_REF(PDDIR_ADDR)
  357. #define PDDATA BYTE_REF(PDDATA_ADDR)
  358. #define PDPUEN BYTE_REF(PDPUEN_ADDR)
  359. #define PDSEL BYTE_REF(PDSEL_ADDR)
  360. #define PDPOL BYTE_REF(PDPOL_ADDR)
  361. #define PDIRQEN BYTE_REF(PDIRQEN_ADDR)
  362. #define PDKBEN BYTE_REF(PDKBEN_ADDR)
  363. #define PDIQEG BYTE_REF(PDIQEG_ADDR)
  364. #define PD(x) (1 << (x))
  365. #define PD_INT0 0x01 /* Use INT0 as PD[0] */
  366. #define PD_INT1 0x02 /* Use INT1 as PD[1] */
  367. #define PD_INT2 0x04 /* Use INT2 as PD[2] */
  368. #define PD_INT3 0x08 /* Use INT3 as PD[3] */
  369. #define PD_IRQ1 0x10 /* Use IRQ1 as PD[4] */
  370. #define PD_IRQ2 0x20 /* Use IRQ2 as PD[5] */
  371. #define PD_IRQ3 0x40 /* Use IRQ3 as PD[6] */
  372. #define PD_IRQ6 0x80 /* Use IRQ6 as PD[7] */
  373. /*
  374. * Port E
  375. */
  376. #define PEDIR_ADDR 0xfffff420 /* Port E direction reg */
  377. #define PEDATA_ADDR 0xfffff421 /* Port E data register */
  378. #define PEPUEN_ADDR 0xfffff422 /* Port E Pull-Up enable reg */
  379. #define PESEL_ADDR 0xfffff423 /* Port E Select Register */
  380. #define PEDIR BYTE_REF(PEDIR_ADDR)
  381. #define PEDATA BYTE_REF(PEDATA_ADDR)
  382. #define PEPUEN BYTE_REF(PEPUEN_ADDR)
  383. #define PESEL BYTE_REF(PESEL_ADDR)
  384. #define PE(x) (1 << (x))
  385. #define PE_SPMTXD 0x01 /* Use SPMTXD as PE[0] */
  386. #define PE_SPMRXD 0x02 /* Use SPMRXD as PE[1] */
  387. #define PE_SPMCLK 0x04 /* Use SPMCLK as PE[2] */
  388. #define PE_DWE 0x08 /* Use DWE as PE[3] */
  389. #define PE_RXD 0x10 /* Use RXD as PE[4] */
  390. #define PE_TXD 0x20 /* Use TXD as PE[5] */
  391. #define PE_RTS 0x40 /* Use RTS as PE[6] */
  392. #define PE_CTS 0x80 /* Use CTS as PE[7] */
  393. /*
  394. * Port F
  395. */
  396. #define PFDIR_ADDR 0xfffff428 /* Port F direction reg */
  397. #define PFDATA_ADDR 0xfffff429 /* Port F data register */
  398. #define PFPUEN_ADDR 0xfffff42a /* Port F Pull-Up enable reg */
  399. #define PFSEL_ADDR 0xfffff42b /* Port F Select Register */
  400. #define PFDIR BYTE_REF(PFDIR_ADDR)
  401. #define PFDATA BYTE_REF(PFDATA_ADDR)
  402. #define PFPUEN BYTE_REF(PFPUEN_ADDR)
  403. #define PFSEL BYTE_REF(PFSEL_ADDR)
  404. #define PF(x) (1 << (x))
  405. #define PF_LCONTRAST 0x01 /* Use LCONTRAST as PF[0] */
  406. #define PF_IRQ5 0x02 /* Use IRQ5 as PF[1] */
  407. #define PF_CLKO 0x04 /* Use CLKO as PF[2] */
  408. #define PF_A20 0x08 /* Use A20 as PF[3] */
  409. #define PF_A21 0x10 /* Use A21 as PF[4] */
  410. #define PF_A22 0x20 /* Use A22 as PF[5] */
  411. #define PF_A23 0x40 /* Use A23 as PF[6] */
  412. #define PF_CSA1 0x80 /* Use CSA1 as PF[7] */
  413. /*
  414. * Port G
  415. */
  416. #define PGDIR_ADDR 0xfffff430 /* Port G direction reg */
  417. #define PGDATA_ADDR 0xfffff431 /* Port G data register */
  418. #define PGPUEN_ADDR 0xfffff432 /* Port G Pull-Up enable reg */
  419. #define PGSEL_ADDR 0xfffff433 /* Port G Select Register */
  420. #define PGDIR BYTE_REF(PGDIR_ADDR)
  421. #define PGDATA BYTE_REF(PGDATA_ADDR)
  422. #define PGPUEN BYTE_REF(PGPUEN_ADDR)
  423. #define PGSEL BYTE_REF(PGSEL_ADDR)
  424. #define PG(x) (1 << (x))
  425. #define PG_BUSW_DTACK 0x01 /* Use BUSW/DTACK as PG[0] */
  426. #define PG_A0 0x02 /* Use A0 as PG[1] */
  427. #define PG_EMUIRQ 0x04 /* Use EMUIRQ as PG[2] */
  428. #define PG_HIZ_P_D 0x08 /* Use HIZ/P/D as PG[3] */
  429. #define PG_EMUCS 0x10 /* Use EMUCS as PG[4] */
  430. #define PG_EMUBRK 0x20 /* Use EMUBRK as PG[5] */
  431. /**********
  432. *
  433. * 0xFFFFF5xx -- Pulse-Width Modulator (PWM)
  434. *
  435. **********/
  436. /*
  437. * PWM Control Register
  438. */
  439. #define PWMC_ADDR 0xfffff500
  440. #define PWMC WORD_REF(PWMC_ADDR)
  441. #define PWMC_CLKSEL_MASK 0x0003 /* Clock Selection */
  442. #define PWMC_CLKSEL_SHIFT 0
  443. #define PWMC_REPEAT_MASK 0x000c /* Sample Repeats */
  444. #define PWMC_REPEAT_SHIFT 2
  445. #define PWMC_EN 0x0010 /* Enable PWM */
  446. #define PMNC_FIFOAV 0x0020 /* FIFO Available */
  447. #define PWMC_IRQEN 0x0040 /* Interrupt Request Enable */
  448. #define PWMC_IRQ 0x0080 /* Interrupt Request (FIFO empty) */
  449. #define PWMC_PRESCALER_MASK 0x7f00 /* Incoming Clock prescaler */
  450. #define PWMC_PRESCALER_SHIFT 8
  451. #define PWMC_CLKSRC 0x8000 /* Clock Source Select */
  452. /* '328-compatible definitions */
  453. #define PWMC_PWMEN PWMC_EN
  454. /*
  455. * PWM Sample Register
  456. */
  457. #define PWMS_ADDR 0xfffff502
  458. #define PWMS WORD_REF(PWMS_ADDR)
  459. /*
  460. * PWM Period Register
  461. */
  462. #define PWMP_ADDR 0xfffff504
  463. #define PWMP BYTE_REF(PWMP_ADDR)
  464. /*
  465. * PWM Counter Register
  466. */
  467. #define PWMCNT_ADDR 0xfffff505
  468. #define PWMCNT BYTE_REF(PWMCNT_ADDR)
  469. /**********
  470. *
  471. * 0xFFFFF6xx -- General-Purpose Timer
  472. *
  473. **********/
  474. /*
  475. * Timer Control register
  476. */
  477. #define TCTL_ADDR 0xfffff600
  478. #define TCTL WORD_REF(TCTL_ADDR)
  479. #define TCTL_TEN 0x0001 /* Timer Enable */
  480. #define TCTL_CLKSOURCE_MASK 0x000e /* Clock Source: */
  481. #define TCTL_CLKSOURCE_STOP 0x0000 /* Stop count (disabled) */
  482. #define TCTL_CLKSOURCE_SYSCLK 0x0002 /* SYSCLK to prescaler */
  483. #define TCTL_CLKSOURCE_SYSCLK_16 0x0004 /* SYSCLK/16 to prescaler */
  484. #define TCTL_CLKSOURCE_TIN 0x0006 /* TIN to prescaler */
  485. #define TCTL_CLKSOURCE_32KHZ 0x0008 /* 32kHz clock to prescaler */
  486. #define TCTL_IRQEN 0x0010 /* IRQ Enable */
  487. #define TCTL_OM 0x0020 /* Output Mode */
  488. #define TCTL_CAP_MASK 0x00c0 /* Capture Edge: */
  489. #define TCTL_CAP_RE 0x0040 /* Capture on rizing edge */
  490. #define TCTL_CAP_FE 0x0080 /* Capture on falling edge */
  491. #define TCTL_FRR 0x0010 /* Free-Run Mode */
  492. /* '328-compatible definitions */
  493. #define TCTL1_ADDR TCTL_ADDR
  494. #define TCTL1 TCTL
  495. /*
  496. * Timer Prescaler Register
  497. */
  498. #define TPRER_ADDR 0xfffff602
  499. #define TPRER WORD_REF(TPRER_ADDR)
  500. /* '328-compatible definitions */
  501. #define TPRER1_ADDR TPRER_ADDR
  502. #define TPRER1 TPRER
  503. /*
  504. * Timer Compare Register
  505. */
  506. #define TCMP_ADDR 0xfffff604
  507. #define TCMP WORD_REF(TCMP_ADDR)
  508. /* '328-compatible definitions */
  509. #define TCMP1_ADDR TCMP_ADDR
  510. #define TCMP1 TCMP
  511. /*
  512. * Timer Capture register
  513. */
  514. #define TCR_ADDR 0xfffff606
  515. #define TCR WORD_REF(TCR_ADDR)
  516. /* '328-compatible definitions */
  517. #define TCR1_ADDR TCR_ADDR
  518. #define TCR1 TCR
  519. /*
  520. * Timer Counter Register
  521. */
  522. #define TCN_ADDR 0xfffff608
  523. #define TCN WORD_REF(TCN_ADDR)
  524. /* '328-compatible definitions */
  525. #define TCN1_ADDR TCN_ADDR
  526. #define TCN1 TCN
  527. /*
  528. * Timer Status Register
  529. */
  530. #define TSTAT_ADDR 0xfffff60a
  531. #define TSTAT WORD_REF(TSTAT_ADDR)
  532. #define TSTAT_COMP 0x0001 /* Compare Event occurred */
  533. #define TSTAT_CAPT 0x0001 /* Capture Event occurred */
  534. /* '328-compatible definitions */
  535. #define TSTAT1_ADDR TSTAT_ADDR
  536. #define TSTAT1 TSTAT
  537. /**********
  538. *
  539. * 0xFFFFF8xx -- Serial Periferial Interface Master (SPIM)
  540. *
  541. **********/
  542. /*
  543. * SPIM Data Register
  544. */
  545. #define SPIMDATA_ADDR 0xfffff800
  546. #define SPIMDATA WORD_REF(SPIMDATA_ADDR)
  547. /*
  548. * SPIM Control/Status Register
  549. */
  550. #define SPIMCONT_ADDR 0xfffff802
  551. #define SPIMCONT WORD_REF(SPIMCONT_ADDR)
  552. #define SPIMCONT_BIT_COUNT_MASK 0x000f /* Transfer Length in Bytes */
  553. #define SPIMCONT_BIT_COUNT_SHIFT 0
  554. #define SPIMCONT_POL 0x0010 /* SPMCLK Signel Polarity */
  555. #define SPIMCONT_PHA 0x0020 /* Clock/Data phase relationship */
  556. #define SPIMCONT_IRQEN 0x0040 /* IRQ Enable */
  557. #define SPIMCONT_IRQ 0x0080 /* Interrupt Request */
  558. #define SPIMCONT_XCH 0x0100 /* Exchange */
  559. #define SPIMCONT_ENABLE 0x0200 /* Enable SPIM */
  560. #define SPIMCONT_DATA_RATE_MASK 0xe000 /* SPIM Data Rate */
  561. #define SPIMCONT_DATA_RATE_SHIFT 13
  562. /* '328-compatible definitions */
  563. #define SPIMCONT_SPIMIRQ SPIMCONT_IRQ
  564. #define SPIMCONT_SPIMEN SPIMCONT_ENABLE
  565. /**********
  566. *
  567. * 0xFFFFF9xx -- UART
  568. *
  569. **********/
  570. /*
  571. * UART Status/Control Register
  572. */
  573. #define USTCNT_ADDR 0xfffff900
  574. #define USTCNT WORD_REF(USTCNT_ADDR)
  575. #define USTCNT_TXAE 0x0001 /* Transmitter Available Interrupt Enable */
  576. #define USTCNT_TXHE 0x0002 /* Transmitter Half Empty Enable */
  577. #define USTCNT_TXEE 0x0004 /* Transmitter Empty Interrupt Enable */
  578. #define USTCNT_RXRE 0x0008 /* Receiver Ready Interrupt Enable */
  579. #define USTCNT_RXHE 0x0010 /* Receiver Half-Full Interrupt Enable */
  580. #define USTCNT_RXFE 0x0020 /* Receiver Full Interrupt Enable */
  581. #define USTCNT_CTSD 0x0040 /* CTS Delta Interrupt Enable */
  582. #define USTCNT_ODEN 0x0080 /* Old Data Interrupt Enable */
  583. #define USTCNT_8_7 0x0100 /* Eight or seven-bit transmission */
  584. #define USTCNT_STOP 0x0200 /* Stop bit transmission */
  585. #define USTCNT_ODD 0x0400 /* Odd Parity */
  586. #define USTCNT_PEN 0x0800 /* Parity Enable */
  587. #define USTCNT_CLKM 0x1000 /* Clock Mode Select */
  588. #define USTCNT_TXEN 0x2000 /* Transmitter Enable */
  589. #define USTCNT_RXEN 0x4000 /* Receiver Enable */
  590. #define USTCNT_UEN 0x8000 /* UART Enable */
  591. /* '328-compatible definitions */
  592. #define USTCNT_TXAVAILEN USTCNT_TXAE
  593. #define USTCNT_TXHALFEN USTCNT_TXHE
  594. #define USTCNT_TXEMPTYEN USTCNT_TXEE
  595. #define USTCNT_RXREADYEN USTCNT_RXRE
  596. #define USTCNT_RXHALFEN USTCNT_RXHE
  597. #define USTCNT_RXFULLEN USTCNT_RXFE
  598. #define USTCNT_CTSDELTAEN USTCNT_CTSD
  599. #define USTCNT_ODD_EVEN USTCNT_ODD
  600. #define USTCNT_PARITYEN USTCNT_PEN
  601. #define USTCNT_CLKMODE USTCNT_CLKM
  602. #define USTCNT_UARTEN USTCNT_UEN
  603. /*
  604. * UART Baud Control Register
  605. */
  606. #define UBAUD_ADDR 0xfffff902
  607. #define UBAUD WORD_REF(UBAUD_ADDR)
  608. #define UBAUD_PRESCALER_MASK 0x003f /* Actual divisor is 65 - PRESCALER */
  609. #define UBAUD_PRESCALER_SHIFT 0
  610. #define UBAUD_DIVIDE_MASK 0x0700 /* Baud Rate freq. divizor */
  611. #define UBAUD_DIVIDE_SHIFT 8
  612. #define UBAUD_BAUD_SRC 0x0800 /* Baud Rate Source */
  613. #define UBAUD_UCLKDIR 0x2000 /* UCLK Direction */
  614. /*
  615. * UART Receiver Register
  616. */
  617. #define URX_ADDR 0xfffff904
  618. #define URX WORD_REF(URX_ADDR)
  619. #define URX_RXDATA_ADDR 0xfffff905
  620. #define URX_RXDATA BYTE_REF(URX_RXDATA_ADDR)
  621. #define URX_RXDATA_MASK 0x00ff /* Received data */
  622. #define URX_RXDATA_SHIFT 0
  623. #define URX_PARITY_ERROR 0x0100 /* Parity Error */
  624. #define URX_BREAK 0x0200 /* Break Detected */
  625. #define URX_FRAME_ERROR 0x0400 /* Framing Error */
  626. #define URX_OVRUN 0x0800 /* Serial Overrun */
  627. #define URX_OLD_DATA 0x1000 /* Old data in FIFO */
  628. #define URX_DATA_READY 0x2000 /* Data Ready (FIFO not empty) */
  629. #define URX_FIFO_HALF 0x4000 /* FIFO is Half-Full */
  630. #define URX_FIFO_FULL 0x8000 /* FIFO is Full */
  631. /*
  632. * UART Transmitter Register
  633. */
  634. #define UTX_ADDR 0xfffff906
  635. #define UTX WORD_REF(UTX_ADDR)
  636. #define UTX_TXDATA_ADDR 0xfffff907
  637. #define UTX_TXDATA BYTE_REF(UTX_TXDATA_ADDR)
  638. #define UTX_TXDATA_MASK 0x00ff /* Data to be transmitted */
  639. #define UTX_TXDATA_SHIFT 0
  640. #define UTX_CTS_DELTA 0x0100 /* CTS changed */
  641. #define UTX_CTS_STAT 0x0200 /* CTS State */
  642. #define UTX_BUSY 0x0400 /* FIFO is busy, sending a character */
  643. #define UTX_NOCTS 0x0800 /* Ignore CTS */
  644. #define UTX_SEND_BREAK 0x1000 /* Send a BREAK */
  645. #define UTX_TX_AVAIL 0x2000 /* Transmit FIFO has a slot available */
  646. #define UTX_FIFO_HALF 0x4000 /* Transmit FIFO is half empty */
  647. #define UTX_FIFO_EMPTY 0x8000 /* Transmit FIFO is empty */
  648. /* '328-compatible definitions */
  649. #define UTX_CTS_STATUS UTX_CTS_STAT
  650. #define UTX_IGNORE_CTS UTX_NOCTS
  651. /*
  652. * UART Miscellaneous Register
  653. */
  654. #define UMISC_ADDR 0xfffff908
  655. #define UMISC WORD_REF(UMISC_ADDR)
  656. #define UMISC_TX_POL 0x0004 /* Transmit Polarity */
  657. #define UMISC_RX_POL 0x0008 /* Receive Polarity */
  658. #define UMISC_IRDA_LOOP 0x0010 /* IrDA Loopback Enable */
  659. #define UMISC_IRDA_EN 0x0020 /* Infra-Red Enable */
  660. #define UMISC_RTS 0x0040 /* Set RTS status */
  661. #define UMISC_RTSCONT 0x0080 /* Choose RTS control */
  662. #define UMISC_IR_TEST 0x0400 /* IRDA Test Enable */
  663. #define UMISC_BAUD_RESET 0x0800 /* Reset Baud Rate Generation Counters */
  664. #define UMISC_LOOP 0x1000 /* Serial Loopback Enable */
  665. #define UMISC_FORCE_PERR 0x2000 /* Force Parity Error */
  666. #define UMISC_CLKSRC 0x4000 /* Clock Source */
  667. #define UMISC_BAUD_TEST 0x8000 /* Enable Baud Test Mode */
  668. /*
  669. * UART Non-integer Prescaler Register
  670. */
  671. #define NIPR_ADDR 0xfffff90a
  672. #define NIPR WORD_REF(NIPR_ADDR)
  673. #define NIPR_STEP_VALUE_MASK 0x00ff /* NI prescaler step value */
  674. #define NIPR_STEP_VALUE_SHIFT 0
  675. #define NIPR_SELECT_MASK 0x0700 /* Tap Selection */
  676. #define NIPR_SELECT_SHIFT 8
  677. #define NIPR_PRE_SEL 0x8000 /* Non-integer prescaler select */
  678. /* generalization of uart control registers to support multiple ports: */
  679. typedef volatile struct {
  680. volatile unsigned short int ustcnt;
  681. volatile unsigned short int ubaud;
  682. union {
  683. volatile unsigned short int w;
  684. struct {
  685. volatile unsigned char status;
  686. volatile unsigned char rxdata;
  687. } b;
  688. } urx;
  689. union {
  690. volatile unsigned short int w;
  691. struct {
  692. volatile unsigned char status;
  693. volatile unsigned char txdata;
  694. } b;
  695. } utx;
  696. volatile unsigned short int umisc;
  697. volatile unsigned short int nipr;
  698. volatile unsigned short int pad1;
  699. volatile unsigned short int pad2;
  700. } __attribute__((packed)) m68328_uart;
  701. /**********
  702. *
  703. * 0xFFFFFAxx -- LCD Controller
  704. *
  705. **********/
  706. /*
  707. * LCD Screen Starting Address Register
  708. */
  709. #define LSSA_ADDR 0xfffffa00
  710. #define LSSA LONG_REF(LSSA_ADDR)
  711. #define LSSA_SSA_MASK 0x1ffffffe /* Bits 0 and 29-31 are reserved */
  712. /*
  713. * LCD Virtual Page Width Register
  714. */
  715. #define LVPW_ADDR 0xfffffa05
  716. #define LVPW BYTE_REF(LVPW_ADDR)
  717. /*
  718. * LCD Screen Width Register (not compatible with '328 !!!)
  719. */
  720. #define LXMAX_ADDR 0xfffffa08
  721. #define LXMAX WORD_REF(LXMAX_ADDR)
  722. #define LXMAX_XM_MASK 0x02f0 /* Bits 0-3 and 10-15 are reserved */
  723. /*
  724. * LCD Screen Height Register
  725. */
  726. #define LYMAX_ADDR 0xfffffa0a
  727. #define LYMAX WORD_REF(LYMAX_ADDR)
  728. #define LYMAX_YM_MASK 0x01ff /* Bits 9-15 are reserved */
  729. /*
  730. * LCD Cursor X Position Register
  731. */
  732. #define LCXP_ADDR 0xfffffa18
  733. #define LCXP WORD_REF(LCXP_ADDR)
  734. #define LCXP_CC_MASK 0xc000 /* Cursor Control */
  735. #define LCXP_CC_TRAMSPARENT 0x0000
  736. #define LCXP_CC_BLACK 0x4000
  737. #define LCXP_CC_REVERSED 0x8000
  738. #define LCXP_CC_WHITE 0xc000
  739. #define LCXP_CXP_MASK 0x02ff /* Cursor X position */
  740. /*
  741. * LCD Cursor Y Position Register
  742. */
  743. #define LCYP_ADDR 0xfffffa1a
  744. #define LCYP WORD_REF(LCYP_ADDR)
  745. #define LCYP_CYP_MASK 0x01ff /* Cursor Y Position */
  746. /*
  747. * LCD Cursor Width and Heigth Register
  748. */
  749. #define LCWCH_ADDR 0xfffffa1c
  750. #define LCWCH WORD_REF(LCWCH_ADDR)
  751. #define LCWCH_CH_MASK 0x001f /* Cursor Height */
  752. #define LCWCH_CH_SHIFT 0
  753. #define LCWCH_CW_MASK 0x1f00 /* Cursor Width */
  754. #define LCWCH_CW_SHIFT 8
  755. /*
  756. * LCD Blink Control Register
  757. */
  758. #define LBLKC_ADDR 0xfffffa1f
  759. #define LBLKC BYTE_REF(LBLKC_ADDR)
  760. #define LBLKC_BD_MASK 0x7f /* Blink Divisor */
  761. #define LBLKC_BD_SHIFT 0
  762. #define LBLKC_BKEN 0x80 /* Blink Enabled */
  763. /*
  764. * LCD Panel Interface Configuration Register
  765. */
  766. #define LPICF_ADDR 0xfffffa20
  767. #define LPICF BYTE_REF(LPICF_ADDR)
  768. #define LPICF_GS_MASK 0x03 /* Gray-Scale Mode */
  769. #define LPICF_GS_BW 0x00
  770. #define LPICF_GS_GRAY_4 0x01
  771. #define LPICF_GS_GRAY_16 0x02
  772. #define LPICF_PBSIZ_MASK 0x0c /* Panel Bus Width */
  773. #define LPICF_PBSIZ_1 0x00
  774. #define LPICF_PBSIZ_2 0x04
  775. #define LPICF_PBSIZ_4 0x08
  776. /*
  777. * LCD Polarity Configuration Register
  778. */
  779. #define LPOLCF_ADDR 0xfffffa21
  780. #define LPOLCF BYTE_REF(LPOLCF_ADDR)
  781. #define LPOLCF_PIXPOL 0x01 /* Pixel Polarity */
  782. #define LPOLCF_LPPOL 0x02 /* Line Pulse Polarity */
  783. #define LPOLCF_FLMPOL 0x04 /* Frame Marker Polarity */
  784. #define LPOLCF_LCKPOL 0x08 /* LCD Shift Lock Polarity */
  785. /*
  786. * LACD (LCD Alternate Crystal Direction) Rate Control Register
  787. */
  788. #define LACDRC_ADDR 0xfffffa23
  789. #define LACDRC BYTE_REF(LACDRC_ADDR)
  790. #define LACDRC_ACDSLT 0x80 /* Signal Source Select */
  791. #define LACDRC_ACD_MASK 0x0f /* Alternate Crystal Direction Control */
  792. #define LACDRC_ACD_SHIFT 0
  793. /*
  794. * LCD Pixel Clock Divider Register
  795. */
  796. #define LPXCD_ADDR 0xfffffa25
  797. #define LPXCD BYTE_REF(LPXCD_ADDR)
  798. #define LPXCD_PCD_MASK 0x3f /* Pixel Clock Divider */
  799. #define LPXCD_PCD_SHIFT 0
  800. /*
  801. * LCD Clocking Control Register
  802. */
  803. #define LCKCON_ADDR 0xfffffa27
  804. #define LCKCON BYTE_REF(LCKCON_ADDR)
  805. #define LCKCON_DWS_MASK 0x0f /* Display Wait-State */
  806. #define LCKCON_DWS_SHIFT 0
  807. #define LCKCON_DWIDTH 0x40 /* Display Memory Width */
  808. #define LCKCON_LCDON 0x80 /* Enable LCD Controller */
  809. /* '328-compatible definitions */
  810. #define LCKCON_DW_MASK LCKCON_DWS_MASK
  811. #define LCKCON_DW_SHIFT LCKCON_DWS_SHIFT
  812. /*
  813. * LCD Refresh Rate Adjustment Register
  814. */
  815. #define LRRA_ADDR 0xfffffa29
  816. #define LRRA BYTE_REF(LRRA_ADDR)
  817. /*
  818. * LCD Panning Offset Register
  819. */
  820. #define LPOSR_ADDR 0xfffffa2d
  821. #define LPOSR BYTE_REF(LPOSR_ADDR)
  822. #define LPOSR_POS_MASK 0x0f /* Pixel Offset Code */
  823. #define LPOSR_POS_SHIFT 0
  824. /*
  825. * LCD Frame Rate Control Modulation Register
  826. */
  827. #define LFRCM_ADDR 0xfffffa31
  828. #define LFRCM BYTE_REF(LFRCM_ADDR)
  829. #define LFRCM_YMOD_MASK 0x0f /* Vertical Modulation */
  830. #define LFRCM_YMOD_SHIFT 0
  831. #define LFRCM_XMOD_MASK 0xf0 /* Horizontal Modulation */
  832. #define LFRCM_XMOD_SHIFT 4
  833. /*
  834. * LCD Gray Palette Mapping Register
  835. */
  836. #define LGPMR_ADDR 0xfffffa33
  837. #define LGPMR BYTE_REF(LGPMR_ADDR)
  838. #define LGPMR_G1_MASK 0x0f
  839. #define LGPMR_G1_SHIFT 0
  840. #define LGPMR_G2_MASK 0xf0
  841. #define LGPMR_G2_SHIFT 4
  842. /*
  843. * PWM Contrast Control Register
  844. */
  845. #define PWMR_ADDR 0xfffffa36
  846. #define PWMR WORD_REF(PWMR_ADDR)
  847. #define PWMR_PW_MASK 0x00ff /* Pulse Width */
  848. #define PWMR_PW_SHIFT 0
  849. #define PWMR_CCPEN 0x0100 /* Contrast Control Enable */
  850. #define PWMR_SRC_MASK 0x0600 /* Input Clock Source */
  851. #define PWMR_SRC_LINE 0x0000 /* Line Pulse */
  852. #define PWMR_SRC_PIXEL 0x0200 /* Pixel Clock */
  853. #define PWMR_SRC_LCD 0x4000 /* LCD clock */
  854. /**********
  855. *
  856. * 0xFFFFFBxx -- Real-Time Clock (RTC)
  857. *
  858. **********/
  859. /*
  860. * RTC Hours Minutes and Seconds Register
  861. */
  862. #define RTCTIME_ADDR 0xfffffb00
  863. #define RTCTIME LONG_REF(RTCTIME_ADDR)
  864. #define RTCTIME_SECONDS_MASK 0x0000003f /* Seconds */
  865. #define RTCTIME_SECONDS_SHIFT 0
  866. #define RTCTIME_MINUTES_MASK 0x003f0000 /* Minutes */
  867. #define RTCTIME_MINUTES_SHIFT 16
  868. #define RTCTIME_HOURS_MASK 0x1f000000 /* Hours */
  869. #define RTCTIME_HOURS_SHIFT 24
  870. /*
  871. * RTC Alarm Register
  872. */
  873. #define RTCALRM_ADDR 0xfffffb04
  874. #define RTCALRM LONG_REF(RTCALRM_ADDR)
  875. #define RTCALRM_SECONDS_MASK 0x0000003f /* Seconds */
  876. #define RTCALRM_SECONDS_SHIFT 0
  877. #define RTCALRM_MINUTES_MASK 0x003f0000 /* Minutes */
  878. #define RTCALRM_MINUTES_SHIFT 16
  879. #define RTCALRM_HOURS_MASK 0x1f000000 /* Hours */
  880. #define RTCALRM_HOURS_SHIFT 24
  881. /*
  882. * Watchdog Timer Register
  883. */
  884. #define WATCHDOG_ADDR 0xfffffb0a
  885. #define WATCHDOG WORD_REF(WATCHDOG_ADDR)
  886. #define WATCHDOG_EN 0x0001 /* Watchdog Enabled */
  887. #define WATCHDOG_ISEL 0x0002 /* Select the watchdog interrupt */
  888. #define WATCHDOG_INTF 0x0080 /* Watchdog interrupt occurred */
  889. #define WATCHDOG_CNT_MASK 0x0300 /* Watchdog Counter */
  890. #define WATCHDOG_CNT_SHIFT 8
  891. /*
  892. * RTC Control Register
  893. */
  894. #define RTCCTL_ADDR 0xfffffb0c
  895. #define RTCCTL WORD_REF(RTCCTL_ADDR)
  896. #define RTCCTL_XTL 0x0020 /* Crystal Selection */
  897. #define RTCCTL_EN 0x0080 /* RTC Enable */
  898. /* '328-compatible definitions */
  899. #define RTCCTL_384 RTCCTL_XTL
  900. #define RTCCTL_ENABLE RTCCTL_EN
  901. /*
  902. * RTC Interrupt Status Register
  903. */
  904. #define RTCISR_ADDR 0xfffffb0e
  905. #define RTCISR WORD_REF(RTCISR_ADDR)
  906. #define RTCISR_SW 0x0001 /* Stopwatch timed out */
  907. #define RTCISR_MIN 0x0002 /* 1-minute interrupt has occurred */
  908. #define RTCISR_ALM 0x0004 /* Alarm interrupt has occurred */
  909. #define RTCISR_DAY 0x0008 /* 24-hour rollover interrupt has occurred */
  910. #define RTCISR_1HZ 0x0010 /* 1Hz interrupt has occurred */
  911. #define RTCISR_HR 0x0020 /* 1-hour interrupt has occurred */
  912. #define RTCISR_SAM0 0x0100 /* 4Hz / 4.6875Hz interrupt has occurred */
  913. #define RTCISR_SAM1 0x0200 /* 8Hz / 9.3750Hz interrupt has occurred */
  914. #define RTCISR_SAM2 0x0400 /* 16Hz / 18.7500Hz interrupt has occurred */
  915. #define RTCISR_SAM3 0x0800 /* 32Hz / 37.5000Hz interrupt has occurred */
  916. #define RTCISR_SAM4 0x1000 /* 64Hz / 75.0000Hz interrupt has occurred */
  917. #define RTCISR_SAM5 0x2000 /* 128Hz / 150.0000Hz interrupt has occurred */
  918. #define RTCISR_SAM6 0x4000 /* 256Hz / 300.0000Hz interrupt has occurred */
  919. #define RTCISR_SAM7 0x8000 /* 512Hz / 600.0000Hz interrupt has occurred */
  920. /*
  921. * RTC Interrupt Enable Register
  922. */
  923. #define RTCIENR_ADDR 0xfffffb10
  924. #define RTCIENR WORD_REF(RTCIENR_ADDR)
  925. #define RTCIENR_SW 0x0001 /* Stopwatch interrupt enable */
  926. #define RTCIENR_MIN 0x0002 /* 1-minute interrupt enable */
  927. #define RTCIENR_ALM 0x0004 /* Alarm interrupt enable */
  928. #define RTCIENR_DAY 0x0008 /* 24-hour rollover interrupt enable */
  929. #define RTCIENR_1HZ 0x0010 /* 1Hz interrupt enable */
  930. #define RTCIENR_HR 0x0020 /* 1-hour interrupt enable */
  931. #define RTCIENR_SAM0 0x0100 /* 4Hz / 4.6875Hz interrupt enable */
  932. #define RTCIENR_SAM1 0x0200 /* 8Hz / 9.3750Hz interrupt enable */
  933. #define RTCIENR_SAM2 0x0400 /* 16Hz / 18.7500Hz interrupt enable */
  934. #define RTCIENR_SAM3 0x0800 /* 32Hz / 37.5000Hz interrupt enable */
  935. #define RTCIENR_SAM4 0x1000 /* 64Hz / 75.0000Hz interrupt enable */
  936. #define RTCIENR_SAM5 0x2000 /* 128Hz / 150.0000Hz interrupt enable */
  937. #define RTCIENR_SAM6 0x4000 /* 256Hz / 300.0000Hz interrupt enable */
  938. #define RTCIENR_SAM7 0x8000 /* 512Hz / 600.0000Hz interrupt enable */
  939. /*
  940. * Stopwatch Minutes Register
  941. */
  942. #define STPWCH_ADDR 0xfffffb12
  943. #define STPWCH WORD_REF(STPWCH)
  944. #define STPWCH_CNT_MASK 0x003f /* Stopwatch countdown value */
  945. #define SPTWCH_CNT_SHIFT 0
  946. /*
  947. * RTC Day Count Register
  948. */
  949. #define DAYR_ADDR 0xfffffb1a
  950. #define DAYR WORD_REF(DAYR_ADDR)
  951. #define DAYR_DAYS_MASK 0x1ff /* Day Setting */
  952. #define DAYR_DAYS_SHIFT 0
  953. /*
  954. * RTC Day Alarm Register
  955. */
  956. #define DAYALARM_ADDR 0xfffffb1c
  957. #define DAYALARM WORD_REF(DAYALARM_ADDR)
  958. #define DAYALARM_DAYSAL_MASK 0x01ff /* Day Setting of the Alarm */
  959. #define DAYALARM_DAYSAL_SHIFT 0
  960. /**********
  961. *
  962. * 0xFFFFFCxx -- DRAM Controller
  963. *
  964. **********/
  965. /*
  966. * DRAM Memory Configuration Register
  967. */
  968. #define DRAMMC_ADDR 0xfffffc00
  969. #define DRAMMC WORD_REF(DRAMMC_ADDR)
  970. #define DRAMMC_ROW12_MASK 0xc000 /* Row address bit for MD12 */
  971. #define DRAMMC_ROW12_PA10 0x0000
  972. #define DRAMMC_ROW12_PA21 0x4000
  973. #define DRAMMC_ROW12_PA23 0x8000
  974. #define DRAMMC_ROW0_MASK 0x3000 /* Row address bit for MD0 */
  975. #define DRAMMC_ROW0_PA11 0x0000
  976. #define DRAMMC_ROW0_PA22 0x1000
  977. #define DRAMMC_ROW0_PA23 0x2000
  978. #define DRAMMC_ROW11 0x0800 /* Row address bit for MD11 PA20/PA22 */
  979. #define DRAMMC_ROW10 0x0400 /* Row address bit for MD10 PA19/PA21 */
  980. #define DRAMMC_ROW9 0x0200 /* Row address bit for MD9 PA9/PA19 */
  981. #define DRAMMC_ROW8 0x0100 /* Row address bit for MD8 PA10/PA20 */
  982. #define DRAMMC_COL10 0x0080 /* Col address bit for MD10 PA11/PA0 */
  983. #define DRAMMC_COL9 0x0040 /* Col address bit for MD9 PA10/PA0 */
  984. #define DRAMMC_COL8 0x0020 /* Col address bit for MD8 PA9/PA0 */
  985. #define DRAMMC_REF_MASK 0x001f /* Reresh Cycle */
  986. #define DRAMMC_REF_SHIFT 0
  987. /*
  988. * DRAM Control Register
  989. */
  990. #define DRAMC_ADDR 0xfffffc02
  991. #define DRAMC WORD_REF(DRAMC_ADDR)
  992. #define DRAMC_DWE 0x0001 /* DRAM Write Enable */
  993. #define DRAMC_RST 0x0002 /* Reset Burst Refresh Enable */
  994. #define DRAMC_LPR 0x0004 /* Low-Power Refresh Enable */
  995. #define DRAMC_SLW 0x0008 /* Slow RAM */
  996. #define DRAMC_LSP 0x0010 /* Light Sleep */
  997. #define DRAMC_MSW 0x0020 /* Slow Multiplexing */
  998. #define DRAMC_WS_MASK 0x00c0 /* Wait-states */
  999. #define DRAMC_WS_SHIFT 6
  1000. #define DRAMC_PGSZ_MASK 0x0300 /* Page Size for fast page mode */
  1001. #define DRAMC_PGSZ_SHIFT 8
  1002. #define DRAMC_PGSZ_256K 0x0000
  1003. #define DRAMC_PGSZ_512K 0x0100
  1004. #define DRAMC_PGSZ_1024K 0x0200
  1005. #define DRAMC_PGSZ_2048K 0x0300
  1006. #define DRAMC_EDO 0x0400 /* EDO DRAM */
  1007. #define DRAMC_CLK 0x0800 /* Refresh Timer Clock source select */
  1008. #define DRAMC_BC_MASK 0x3000 /* Page Access Clock Cycle (FP mode) */
  1009. #define DRAMC_BC_SHIFT 12
  1010. #define DRAMC_RM 0x4000 /* Refresh Mode */
  1011. #define DRAMC_EN 0x8000 /* DRAM Controller enable */
  1012. /**********
  1013. *
  1014. * 0xFFFFFDxx -- In-Circuit Emulation (ICE)
  1015. *
  1016. **********/
  1017. /*
  1018. * ICE Module Address Compare Register
  1019. */
  1020. #define ICEMACR_ADDR 0xfffffd00
  1021. #define ICEMACR LONG_REF(ICEMACR_ADDR)
  1022. /*
  1023. * ICE Module Address Mask Register
  1024. */
  1025. #define ICEMAMR_ADDR 0xfffffd04
  1026. #define ICEMAMR LONG_REF(ICEMAMR_ADDR)
  1027. /*
  1028. * ICE Module Control Compare Register
  1029. */
  1030. #define ICEMCCR_ADDR 0xfffffd08
  1031. #define ICEMCCR WORD_REF(ICEMCCR_ADDR)
  1032. #define ICEMCCR_PD 0x0001 /* Program/Data Cycle Selection */
  1033. #define ICEMCCR_RW 0x0002 /* Read/Write Cycle Selection */
  1034. /*
  1035. * ICE Module Control Mask Register
  1036. */
  1037. #define ICEMCMR_ADDR 0xfffffd0a
  1038. #define ICEMCMR WORD_REF(ICEMCMR_ADDR)
  1039. #define ICEMCMR_PDM 0x0001 /* Program/Data Cycle Mask */
  1040. #define ICEMCMR_RWM 0x0002 /* Read/Write Cycle Mask */
  1041. /*
  1042. * ICE Module Control Register
  1043. */
  1044. #define ICEMCR_ADDR 0xfffffd0c
  1045. #define ICEMCR WORD_REF(ICEMCR_ADDR)
  1046. #define ICEMCR_CEN 0x0001 /* Compare Enable */
  1047. #define ICEMCR_PBEN 0x0002 /* Program Break Enable */
  1048. #define ICEMCR_SB 0x0004 /* Single Breakpoint */
  1049. #define ICEMCR_HMDIS 0x0008 /* HardMap disable */
  1050. #define ICEMCR_BBIEN 0x0010 /* Bus Break Interrupt Enable */
  1051. /*
  1052. * ICE Module Status Register
  1053. */
  1054. #define ICEMSR_ADDR 0xfffffd0e
  1055. #define ICEMSR WORD_REF(ICEMSR_ADDR)
  1056. #define ICEMSR_EMUEN 0x0001 /* Emulation Enable */
  1057. #define ICEMSR_BRKIRQ 0x0002 /* A-Line Vector Fetch Detected */
  1058. #define ICEMSR_BBIRQ 0x0004 /* Bus Break Interrupt Detected */
  1059. #define ICEMSR_EMIRQ 0x0008 /* EMUIRQ Falling Edge Detected */
  1060. #endif /* _MC68EZ328_H_ */