jz4740.h 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. /*
  2. * head file for Ingenic Semiconductor's JZ4740 CPU.
  3. */
  4. #ifndef __JZ4740_H__
  5. #define __JZ4740_H__
  6. #include <asm/addrspace.h>
  7. #include <asm/cacheops.h>
  8. /* Boot ROM Specification */
  9. /* NOR Boot config */
  10. #define JZ4740_NORBOOT_8BIT 0x00000000 /* 8-bit data bus flash */
  11. #define JZ4740_NORBOOT_16BIT 0x10101010 /* 16-bit data bus flash */
  12. #define JZ4740_NORBOOT_32BIT 0x20202020 /* 32-bit data bus flash */
  13. /* NAND Boot config */
  14. #define JZ4740_NANDBOOT_B8R3 0xffffffff /* 8-bit bus & 3 row cycles */
  15. #define JZ4740_NANDBOOT_B8R2 0xf0f0f0f0 /* 8-bit bus & 2 row cycles */
  16. #define JZ4740_NANDBOOT_B16R3 0x0f0f0f0f /* 16-bit bus & 3 row cycles */
  17. #define JZ4740_NANDBOOT_B16R2 0x00000000 /* 16-bit bus & 2 row cycles */
  18. /* 1st-level interrupts */
  19. #define JZ4740_IRQ_I2C 1
  20. #define JZ4740_IRQ_UHC 3
  21. #define JZ4740_IRQ_UART0 9
  22. #define JZ4740_IRQ_SADC 12
  23. #define JZ4740_IRQ_MSC 14
  24. #define JZ4740_IRQ_RTC 15
  25. #define JZ4740_IRQ_SSI 16
  26. #define JZ4740_IRQ_CIM 17
  27. #define JZ4740_IRQ_AIC 18
  28. #define JZ4740_IRQ_ETH 19
  29. #define JZ4740_IRQ_DMAC 20
  30. #define JZ4740_IRQ_TCU2 21
  31. #define JZ4740_IRQ_TCU1 22
  32. #define JZ4740_IRQ_TCU0 23
  33. #define JZ4740_IRQ_UDC 24
  34. #define JZ4740_IRQ_GPIO3 25
  35. #define JZ4740_IRQ_GPIO2 26
  36. #define JZ4740_IRQ_GPIO1 27
  37. #define JZ4740_IRQ_GPIO0 28
  38. #define JZ4740_IRQ_IPU 29
  39. #define JZ4740_IRQ_LCD 30
  40. /* 2nd-level interrupts */
  41. #define JZ4740_IRQ_DMA_0 32 /* 32 to 37 for DMAC channel 0 to 5 */
  42. #define JZ4740_IRQ_GPIO_0 48 /* 48 to 175 for GPIO pin 0 to 127 */
  43. /* Register Definitions */
  44. #define JZ4740_CPM_BASE 0x10000000
  45. #define JZ4740_INTC_BASE 0x10001000
  46. #define JZ4740_TCU_BASE 0x10002000
  47. #define JZ4740_WDT_BASE 0x10002000
  48. #define JZ4740_RTC_BASE 0x10003000
  49. #define JZ4740_GPIO_BASE 0x10010000
  50. #define JZ4740_AIC_BASE 0x10020000
  51. #define JZ4740_ICDC_BASE 0x10020000
  52. #define JZ4740_MSC_BASE 0x10021000
  53. #define JZ4740_UART0_BASE 0x10030000
  54. #define JZ4740_I2C_BASE 0x10042000
  55. #define JZ4740_SSI_BASE 0x10043000
  56. #define JZ4740_SADC_BASE 0x10070000
  57. #define JZ4740_EMC_BASE 0x13010000
  58. #define JZ4740_DMAC_BASE 0x13020000
  59. #define JZ4740_UHC_BASE 0x13030000
  60. #define JZ4740_UDC_BASE 0x13040000
  61. #define JZ4740_LCD_BASE 0x13050000
  62. #define JZ4740_SLCD_BASE 0x13050000
  63. #define JZ4740_CIM_BASE 0x13060000
  64. #define JZ4740_ETH_BASE 0x13100000
  65. /* 8bit Mode Register of SDRAM bank 0 */
  66. #define JZ4740_EMC_SDMR0 (JZ4740_EMC_BASE + 0xa000)
  67. /* GPIO (General-Purpose I/O Ports) */
  68. /* = 0,1,2,3 */
  69. #define GPIO_PXPIN(n) \
  70. (JZ4740_GPIO_BASE + (0x00 + (n)*0x100)) /* PIN Level Register */
  71. #define GPIO_PXDAT(n) \
  72. (JZ4740_GPIO_BASE + (0x10 + (n)*0x100)) /* Port Data Register */
  73. #define GPIO_PXDATS(n) \
  74. (JZ4740_GPIO_BASE + (0x14 + (n)*0x100)) /* Port Data Set Register */
  75. #define GPIO_PXDATC(n) \
  76. (JZ4740_GPIO_BASE + (0x18 + (n)*0x100)) /* Port Data Clear Register */
  77. #define GPIO_PXIM(n) \
  78. (JZ4740_GPIO_BASE + (0x20 + (n)*0x100)) /* Interrupt Mask Register */
  79. #define GPIO_PXIMS(n) \
  80. (JZ4740_GPIO_BASE + (0x24 + (n)*0x100)) /* Interrupt Mask Set Reg */
  81. #define GPIO_PXIMC(n) \
  82. (JZ4740_GPIO_BASE + (0x28 + (n)*0x100)) /* Interrupt Mask Clear Reg */
  83. #define GPIO_PXPE(n) \
  84. (JZ4740_GPIO_BASE + (0x30 + (n)*0x100)) /* Pull Enable Register */
  85. #define GPIO_PXPES(n) \
  86. (JZ4740_GPIO_BASE + (0x34 + (n)*0x100)) /* Pull Enable Set Reg. */
  87. #define GPIO_PXPEC(n) \
  88. (JZ4740_GPIO_BASE + (0x38 + (n)*0x100)) /* Pull Enable Clear Reg. */
  89. #define GPIO_PXFUN(n) \
  90. (JZ4740_GPIO_BASE + (0x40 + (n)*0x100)) /* Function Register */
  91. #define GPIO_PXFUNS(n) \
  92. (JZ4740_GPIO_BASE + (0x44 + (n)*0x100)) /* Function Set Register */
  93. #define GPIO_PXFUNC(n) \
  94. (JZ4740_GPIO_BASE + (0x48 + (n)*0x100)) /* Function Clear Register */
  95. #define GPIO_PXSEL(n) \
  96. (JZ4740_GPIO_BASE + (0x50 + (n)*0x100)) /* Select Register */
  97. #define GPIO_PXSELS(n) \
  98. (JZ4740_GPIO_BASE + (0x54 + (n)*0x100)) /* Select Set Register */
  99. #define GPIO_PXSELC(n) \
  100. (JZ4740_GPIO_BASE + (0x58 + (n)*0x100)) /* Select Clear Register */
  101. #define GPIO_PXDIR(n) \
  102. (JZ4740_GPIO_BASE + (0x60 + (n)*0x100)) /* Direction Register */
  103. #define GPIO_PXDIRS(n) \
  104. (JZ4740_GPIO_BASE + (0x64 + (n)*0x100)) /* Direction Set Register */
  105. #define GPIO_PXDIRC(n) \
  106. (JZ4740_GPIO_BASE + (0x68 + (n)*0x100)) /* Direction Clear Register */
  107. #define GPIO_PXTRG(n) \
  108. (JZ4740_GPIO_BASE + (0x70 + (n)*0x100)) /* Trigger Register */
  109. #define GPIO_PXTRGS(n) \
  110. (JZ4740_GPIO_BASE + (0x74 + (n)*0x100)) /* Trigger Set Register */
  111. #define GPIO_PXTRGC(n) \
  112. (JZ4740_GPIO_BASE + (0x78 + (n)*0x100)) /* Trigger Set Register */
  113. /* Static Memory Control Register */
  114. #define EMC_SMCR_STRV_BIT 24
  115. #define EMC_SMCR_STRV_MASK (0x0f << EMC_SMCR_STRV_BIT)
  116. #define EMC_SMCR_TAW_BIT 20
  117. #define EMC_SMCR_TAW_MASK (0x0f << EMC_SMCR_TAW_BIT)
  118. #define EMC_SMCR_TBP_BIT 16
  119. #define EMC_SMCR_TBP_MASK (0x0f << EMC_SMCR_TBP_BIT)
  120. #define EMC_SMCR_TAH_BIT 12
  121. #define EMC_SMCR_TAH_MASK (0x07 << EMC_SMCR_TAH_BIT)
  122. #define EMC_SMCR_TAS_BIT 8
  123. #define EMC_SMCR_TAS_MASK (0x07 << EMC_SMCR_TAS_BIT)
  124. #define EMC_SMCR_BW_BIT 6
  125. #define EMC_SMCR_BW_MASK (0x03 << EMC_SMCR_BW_BIT)
  126. #define EMC_SMCR_BW_8BIT (0 << EMC_SMCR_BW_BIT)
  127. #define EMC_SMCR_BW_16BIT (1 << EMC_SMCR_BW_BIT)
  128. #define EMC_SMCR_BW_32BIT (2 << EMC_SMCR_BW_BIT)
  129. #define EMC_SMCR_BCM (1 << 3)
  130. #define EMC_SMCR_BL_BIT 1
  131. #define EMC_SMCR_BL_MASK (0x03 << EMC_SMCR_BL_BIT)
  132. #define EMC_SMCR_BL_4 (0 << EMC_SMCR_BL_BIT)
  133. #define EMC_SMCR_BL_8 (1 << EMC_SMCR_BL_BIT)
  134. #define EMC_SMCR_BL_16 (2 << EMC_SMCR_BL_BIT)
  135. #define EMC_SMCR_BL_32 (3 << EMC_SMCR_BL_BIT)
  136. #define EMC_SMCR_SMT (1 << 0)
  137. /* Static Memory Bank Addr Config Reg */
  138. #define EMC_SACR_BASE_BIT 8
  139. #define EMC_SACR_BASE_MASK (0xff << EMC_SACR_BASE_BIT)
  140. #define EMC_SACR_MASK_BIT 0
  141. #define EMC_SACR_MASK_MASK (0xff << EMC_SACR_MASK_BIT)
  142. /* NAND Flash Control/Status Register */
  143. #define EMC_NFCSR_NFCE4 (1 << 7) /* NAND Flash Enable */
  144. #define EMC_NFCSR_NFE4 (1 << 6) /* NAND Flash FCE# Assertion Enable */
  145. #define EMC_NFCSR_NFCE3 (1 << 5)
  146. #define EMC_NFCSR_NFE3 (1 << 4)
  147. #define EMC_NFCSR_NFCE2 (1 << 3)
  148. #define EMC_NFCSR_NFE2 (1 << 2)
  149. #define EMC_NFCSR_NFCE1 (1 << 1)
  150. #define EMC_NFCSR_NFE1 (1 << 0)
  151. /* NAND Flash ECC Control Register */
  152. #define EMC_NFECR_PRDY (1 << 4) /* Parity Ready */
  153. #define EMC_NFECR_RS_DECODING (0 << 3) /* RS is in decoding phase */
  154. #define EMC_NFECR_RS_ENCODING (1 << 3) /* RS is in encoding phase */
  155. #define EMC_NFECR_HAMMING (0 << 2) /* Use HAMMING Correction Algorithm */
  156. #define EMC_NFECR_RS (1 << 2) /* Select RS Correction Algorithm */
  157. #define EMC_NFECR_ERST (1 << 1) /* ECC Reset */
  158. #define EMC_NFECR_ECCE (1 << 0) /* ECC Enable */
  159. /* NAND Flash ECC Data Register */
  160. #define EMC_NFECC_ECC2_BIT 16
  161. #define EMC_NFECC_ECC2_MASK (0xff << EMC_NFECC_ECC2_BIT)
  162. #define EMC_NFECC_ECC1_BIT 8
  163. #define EMC_NFECC_ECC1_MASK (0xff << EMC_NFECC_ECC1_BIT)
  164. #define EMC_NFECC_ECC0_BIT 0
  165. #define EMC_NFECC_ECC0_MASK (0xff << EMC_NFECC_ECC0_BIT)
  166. /* NAND Flash Interrupt Status Register */
  167. #define EMC_NFINTS_ERRCNT_BIT 29 /* Error Count */
  168. #define EMC_NFINTS_ERRCNT_MASK (0x7 << EMC_NFINTS_ERRCNT_BIT)
  169. #define EMC_NFINTS_PADF (1 << 4) /* Padding Finished */
  170. #define EMC_NFINTS_DECF (1 << 3) /* Decoding Finished */
  171. #define EMC_NFINTS_ENCF (1 << 2) /* Encoding Finished */
  172. #define EMC_NFINTS_UNCOR (1 << 1) /* Uncorrectable Error Occurred */
  173. #define EMC_NFINTS_ERR (1 << 0) /* Error Occurred */
  174. /* NAND Flash Interrupt Enable Register */
  175. #define EMC_NFINTE_PADFE (1 << 4) /* Padding Finished Interrupt */
  176. #define EMC_NFINTE_DECFE (1 << 3) /* Decoding Finished Interrupt */
  177. #define EMC_NFINTE_ENCFE (1 << 2) /* Encoding Finished Interrupt */
  178. #define EMC_NFINTE_UNCORE (1 << 1) /* Uncorrectable Error Occurred Intr */
  179. #define EMC_NFINTE_ERRE (1 << 0) /* Error Occurred Interrupt */
  180. /* NAND Flash RS Error Report Register */
  181. #define EMC_NFERR_INDEX_BIT 16 /* Error Symbol Index */
  182. #define EMC_NFERR_INDEX_MASK (0x1ff << EMC_NFERR_INDEX_BIT)
  183. #define EMC_NFERR_MASK_BIT 0 /* Error Symbol Value */
  184. #define EMC_NFERR_MASK_MASK (0x1ff << EMC_NFERR_MASK_BIT)
  185. /* DRAM Control Register */
  186. #define EMC_DMCR_BW_BIT 31
  187. #define EMC_DMCR_BW (1 << EMC_DMCR_BW_BIT)
  188. #define EMC_DMCR_CA_BIT 26
  189. #define EMC_DMCR_CA_MASK (0x07 << EMC_DMCR_CA_BIT)
  190. #define EMC_DMCR_CA_8 (0 << EMC_DMCR_CA_BIT)
  191. #define EMC_DMCR_CA_9 (1 << EMC_DMCR_CA_BIT)
  192. #define EMC_DMCR_CA_10 (2 << EMC_DMCR_CA_BIT)
  193. #define EMC_DMCR_CA_11 (3 << EMC_DMCR_CA_BIT)
  194. #define EMC_DMCR_CA_12 (4 << EMC_DMCR_CA_BIT)
  195. #define EMC_DMCR_RMODE (1 << 25)
  196. #define EMC_DMCR_RFSH (1 << 24)
  197. #define EMC_DMCR_MRSET (1 << 23)
  198. #define EMC_DMCR_RA_BIT 20
  199. #define EMC_DMCR_RA_MASK (0x03 << EMC_DMCR_RA_BIT)
  200. #define EMC_DMCR_RA_11 (0 << EMC_DMCR_RA_BIT)
  201. #define EMC_DMCR_RA_12 (1 << EMC_DMCR_RA_BIT)
  202. #define EMC_DMCR_RA_13 (2 << EMC_DMCR_RA_BIT)
  203. #define EMC_DMCR_BA_BIT 19
  204. #define EMC_DMCR_BA (1 << EMC_DMCR_BA_BIT)
  205. #define EMC_DMCR_PDM (1 << 18)
  206. #define EMC_DMCR_EPIN (1 << 17)
  207. #define EMC_DMCR_TRAS_BIT 13
  208. #define EMC_DMCR_TRAS_MASK (0x07 << EMC_DMCR_TRAS_BIT)
  209. #define EMC_DMCR_RCD_BIT 11
  210. #define EMC_DMCR_RCD_MASK (0x03 << EMC_DMCR_RCD_BIT)
  211. #define EMC_DMCR_TPC_BIT 8
  212. #define EMC_DMCR_TPC_MASK (0x07 << EMC_DMCR_TPC_BIT)
  213. #define EMC_DMCR_TRWL_BIT 5
  214. #define EMC_DMCR_TRWL_MASK (0x03 << EMC_DMCR_TRWL_BIT)
  215. #define EMC_DMCR_TRC_BIT 2
  216. #define EMC_DMCR_TRC_MASK (0x07 << EMC_DMCR_TRC_BIT)
  217. #define EMC_DMCR_TCL_BIT 0
  218. #define EMC_DMCR_TCL_MASK (0x03 << EMC_DMCR_TCL_BIT)
  219. /* Refresh Time Control/Status Register */
  220. #define EMC_RTCSR_CMF (1 << 7)
  221. #define EMC_RTCSR_CKS_BIT 0
  222. #define EMC_RTCSR_CKS_MASK (0x07 << EMC_RTCSR_CKS_BIT)
  223. #define EMC_RTCSR_CKS_DISABLE (0 << EMC_RTCSR_CKS_BIT)
  224. #define EMC_RTCSR_CKS_4 (1 << EMC_RTCSR_CKS_BIT)
  225. #define EMC_RTCSR_CKS_16 (2 << EMC_RTCSR_CKS_BIT)
  226. #define EMC_RTCSR_CKS_64 (3 << EMC_RTCSR_CKS_BIT)
  227. #define EMC_RTCSR_CKS_256 (4 << EMC_RTCSR_CKS_BIT)
  228. #define EMC_RTCSR_CKS_1024 (5 << EMC_RTCSR_CKS_BIT)
  229. #define EMC_RTCSR_CKS_2048 (6 << EMC_RTCSR_CKS_BIT)
  230. #define EMC_RTCSR_CKS_4096 (7 << EMC_RTCSR_CKS_BIT)
  231. /* SDRAM Bank Address Configuration Register */
  232. #define EMC_DMAR_BASE_BIT 8
  233. #define EMC_DMAR_BASE_MASK (0xff << EMC_DMAR_BASE_BIT)
  234. #define EMC_DMAR_MASK_BIT 0
  235. #define EMC_DMAR_MASK_MASK (0xff << EMC_DMAR_MASK_BIT)
  236. /* Mode Register of SDRAM bank 0 */
  237. #define EMC_SDMR_BM (1 << 9) /* Write Burst Mode */
  238. #define EMC_SDMR_OM_BIT 7 /* Operating Mode */
  239. #define EMC_SDMR_OM_MASK (3 << EMC_SDMR_OM_BIT)
  240. #define EMC_SDMR_OM_NORMAL (0 << EMC_SDMR_OM_BIT)
  241. #define EMC_SDMR_CAS_BIT 4 /* CAS Latency */
  242. #define EMC_SDMR_CAS_MASK (7 << EMC_SDMR_CAS_BIT)
  243. #define EMC_SDMR_CAS_1 (1 << EMC_SDMR_CAS_BIT)
  244. #define EMC_SDMR_CAS_2 (2 << EMC_SDMR_CAS_BIT)
  245. #define EMC_SDMR_CAS_3 (3 << EMC_SDMR_CAS_BIT)
  246. #define EMC_SDMR_BT_BIT 3 /* Burst Type */
  247. #define EMC_SDMR_BT_MASK (1 << EMC_SDMR_BT_BIT)
  248. #define EMC_SDMR_BT_SEQ (0 << EMC_SDMR_BT_BIT) /* Sequential */
  249. #define EMC_SDMR_BT_INT (1 << EMC_SDMR_BT_BIT) /* Interleave */
  250. #define EMC_SDMR_BL_BIT 0 /* Burst Length */
  251. #define EMC_SDMR_BL_MASK (7 << EMC_SDMR_BL_BIT)
  252. #define EMC_SDMR_BL_1 (0 << EMC_SDMR_BL_BIT)
  253. #define EMC_SDMR_BL_2 (1 << EMC_SDMR_BL_BIT)
  254. #define EMC_SDMR_BL_4 (2 << EMC_SDMR_BL_BIT)
  255. #define EMC_SDMR_BL_8 (3 << EMC_SDMR_BL_BIT)
  256. #define EMC_SDMR_CAS2_16BIT \
  257. (EMC_SDMR_CAS_2 | EMC_SDMR_BT_SEQ | EMC_SDMR_BL_2)
  258. #define EMC_SDMR_CAS2_32BIT \
  259. (EMC_SDMR_CAS_2 | EMC_SDMR_BT_SEQ | EMC_SDMR_BL_4)
  260. #define EMC_SDMR_CAS3_16BIT \
  261. (EMC_SDMR_CAS_3 | EMC_SDMR_BT_SEQ | EMC_SDMR_BL_2)
  262. #define EMC_SDMR_CAS3_32BIT \
  263. (EMC_SDMR_CAS_3 | EMC_SDMR_BT_SEQ | EMC_SDMR_BL_4)
  264. /* RTC Control Register */
  265. #define RTC_RCR_WRDY (1 << 7) /* Write Ready Flag */
  266. #define RTC_RCR_HZ (1 << 6) /* 1Hz Flag */
  267. #define RTC_RCR_HZIE (1 << 5) /* 1Hz Interrupt Enable */
  268. #define RTC_RCR_AF (1 << 4) /* Alarm Flag */
  269. #define RTC_RCR_AIE (1 << 3) /* Alarm Interrupt Enable */
  270. #define RTC_RCR_AE (1 << 2) /* Alarm Enable */
  271. #define RTC_RCR_RTCE (1 << 0) /* RTC Enable */
  272. /* RTC Regulator Register */
  273. #define RTC_RGR_LOCK (1 << 31) /* Lock Bit */
  274. #define RTC_RGR_ADJC_BIT 16
  275. #define RTC_RGR_ADJC_MASK (0x3ff << RTC_RGR_ADJC_BIT)
  276. #define RTC_RGR_NC1HZ_BIT 0
  277. #define RTC_RGR_NC1HZ_MASK (0xffff << RTC_RGR_NC1HZ_BIT)
  278. /* Hibernate Control Register */
  279. #define RTC_HCR_PD (1 << 0) /* Power Down */
  280. /* Hibernate Wakeup Filter Counter Register */
  281. #define RTC_HWFCR_BIT 5
  282. #define RTC_HWFCR_MASK (0x7ff << RTC_HWFCR_BIT)
  283. /* Hibernate Reset Counter Register */
  284. #define RTC_HRCR_BIT 5
  285. #define RTC_HRCR_MASK (0x7f << RTC_HRCR_BIT)
  286. /* Hibernate Wakeup Control Register */
  287. #define RTC_HWCR_EALM (1 << 0) /* RTC alarm wakeup enable */
  288. /* Hibernate Wakeup Status Register */
  289. #define RTC_HWRSR_HR (1 << 5) /* Hibernate reset */
  290. #define RTC_HWRSR_PPR (1 << 4) /* PPR reset */
  291. #define RTC_HWRSR_PIN (1 << 1) /* Wakeup pin status bit */
  292. #define RTC_HWRSR_ALM (1 << 0) /* RTC alarm status bit */
  293. /* Clock Control Register */
  294. #define CPM_CPCCR_I2CS (1 << 31)
  295. #define CPM_CPCCR_CLKOEN (1 << 30)
  296. #define CPM_CPCCR_UCS (1 << 29)
  297. #define CPM_CPCCR_UDIV_BIT 23
  298. #define CPM_CPCCR_UDIV_MASK (0x3f << CPM_CPCCR_UDIV_BIT)
  299. #define CPM_CPCCR_CE (1 << 22)
  300. #define CPM_CPCCR_PCS (1 << 21)
  301. #define CPM_CPCCR_LDIV_BIT 16
  302. #define CPM_CPCCR_LDIV_MASK (0x1f << CPM_CPCCR_LDIV_BIT)
  303. #define CPM_CPCCR_MDIV_BIT 12
  304. #define CPM_CPCCR_MDIV_MASK (0x0f << CPM_CPCCR_MDIV_BIT)
  305. #define CPM_CPCCR_PDIV_BIT 8
  306. #define CPM_CPCCR_PDIV_MASK (0x0f << CPM_CPCCR_PDIV_BIT)
  307. #define CPM_CPCCR_HDIV_BIT 4
  308. #define CPM_CPCCR_HDIV_MASK (0x0f << CPM_CPCCR_HDIV_BIT)
  309. #define CPM_CPCCR_CDIV_BIT 0
  310. #define CPM_CPCCR_CDIV_MASK (0x0f << CPM_CPCCR_CDIV_BIT)
  311. /* I2S Clock Divider Register */
  312. #define CPM_I2SCDR_I2SDIV_BIT 0
  313. #define CPM_I2SCDR_I2SDIV_MASK (0x1ff << CPM_I2SCDR_I2SDIV_BIT)
  314. /* LCD Pixel Clock Divider Register */
  315. #define CPM_LPCDR_PIXDIV_BIT 0
  316. #define CPM_LPCDR_PIXDIV_MASK (0x1ff << CPM_LPCDR_PIXDIV_BIT)
  317. /* MSC Clock Divider Register */
  318. #define CPM_MSCCDR_MSCDIV_BIT 0
  319. #define CPM_MSCCDR_MSCDIV_MASK (0x1f << CPM_MSCCDR_MSCDIV_BIT)
  320. /* PLL Control Register */
  321. #define CPM_CPPCR_PLLM_BIT 23
  322. #define CPM_CPPCR_PLLM_MASK (0x1ff << CPM_CPPCR_PLLM_BIT)
  323. #define CPM_CPPCR_PLLN_BIT 18
  324. #define CPM_CPPCR_PLLN_MASK (0x1f << CPM_CPPCR_PLLN_BIT)
  325. #define CPM_CPPCR_PLLOD_BIT 16
  326. #define CPM_CPPCR_PLLOD_MASK (0x03 << CPM_CPPCR_PLLOD_BIT)
  327. #define CPM_CPPCR_PLLS (1 << 10)
  328. #define CPM_CPPCR_PLLBP (1 << 9)
  329. #define CPM_CPPCR_PLLEN (1 << 8)
  330. #define CPM_CPPCR_PLLST_BIT 0
  331. #define CPM_CPPCR_PLLST_MASK (0xff << CPM_CPPCR_PLLST_BIT)
  332. /* Low Power Control Register */
  333. #define CPM_LCR_DOZE_DUTY_BIT 3
  334. #define CPM_LCR_DOZE_DUTY_MASK (0x1f << CPM_LCR_DOZE_DUTY_BIT)
  335. #define CPM_LCR_DOZE_ON (1 << 2)
  336. #define CPM_LCR_LPM_BIT 0
  337. #define CPM_LCR_LPM_MASK (0x3 << CPM_LCR_LPM_BIT)
  338. #define CPM_LCR_LPM_IDLE (0x0 << CPM_LCR_LPM_BIT)
  339. #define CPM_LCR_LPM_SLEEP (0x1 << CPM_LCR_LPM_BIT)
  340. /* Clock Gate Register */
  341. #define CPM_CLKGR_UART1 (1 << 15)
  342. #define CPM_CLKGR_UHC (1 << 14)
  343. #define CPM_CLKGR_IPU (1 << 13)
  344. #define CPM_CLKGR_DMAC (1 << 12)
  345. #define CPM_CLKGR_UDC (1 << 11)
  346. #define CPM_CLKGR_LCD (1 << 10)
  347. #define CPM_CLKGR_CIM (1 << 9)
  348. #define CPM_CLKGR_SADC (1 << 8)
  349. #define CPM_CLKGR_MSC (1 << 7)
  350. #define CPM_CLKGR_AIC1 (1 << 6)
  351. #define CPM_CLKGR_AIC2 (1 << 5)
  352. #define CPM_CLKGR_SSI (1 << 4)
  353. #define CPM_CLKGR_I2C (1 << 3)
  354. #define CPM_CLKGR_RTC (1 << 2)
  355. #define CPM_CLKGR_TCU (1 << 1)
  356. #define CPM_CLKGR_UART0 (1 << 0)
  357. /* Sleep Control Register */
  358. #define CPM_SCR_O1ST_BIT 8
  359. #define CPM_SCR_O1ST_MASK (0xff << CPM_SCR_O1ST_BIT)
  360. #define CPM_SCR_UDCPHY_ENABLE (1 << 6)
  361. #define CPM_SCR_USBPHY_DISABLE (1 << 7)
  362. #define CPM_SCR_OSC_ENABLE (1 << 4)
  363. /* Hibernate Control Register */
  364. #define CPM_HCR_PD (1 << 0)
  365. /* Wakeup Filter Counter Register in Hibernate Mode */
  366. #define CPM_HWFCR_TIME_BIT 0
  367. #define CPM_HWFCR_TIME_MASK (0x3ff << CPM_HWFCR_TIME_BIT)
  368. /* Reset Counter Register in Hibernate Mode */
  369. #define CPM_HRCR_TIME_BIT 0
  370. #define CPM_HRCR_TIME_MASK (0x7f << CPM_HRCR_TIME_BIT)
  371. /* Wakeup Control Register in Hibernate Mode */
  372. #define CPM_HWCR_WLE_LOW (0 << 2)
  373. #define CPM_HWCR_WLE_HIGH (1 << 2)
  374. #define CPM_HWCR_PIN_WAKEUP (1 << 1)
  375. #define CPM_HWCR_RTC_WAKEUP (1 << 0)
  376. /* Wakeup Status Register in Hibernate Mode */
  377. #define CPM_HWSR_WSR_PIN (1 << 1)
  378. #define CPM_HWSR_WSR_RTC (1 << 0)
  379. /* Reset Status Register */
  380. #define CPM_RSR_HR (1 << 2)
  381. #define CPM_RSR_WR (1 << 1)
  382. #define CPM_RSR_PR (1 << 0)
  383. /* Register definitions */
  384. #define TCU_TCSR_PWM_SD (1 << 9)
  385. #define TCU_TCSR_PWM_INITL_HIGH (1 << 8)
  386. #define TCU_TCSR_PWM_EN (1 << 7)
  387. #define TCU_TCSR_PRESCALE_BIT 3
  388. #define TCU_TCSR_PRESCALE_MASK (0x7 << TCU_TCSR_PRESCALE_BIT)
  389. #define TCU_TCSR_PRESCALE1 (0x0 << TCU_TCSR_PRESCALE_BIT)
  390. #define TCU_TCSR_PRESCALE4 (0x1 << TCU_TCSR_PRESCALE_BIT)
  391. #define TCU_TCSR_PRESCALE16 (0x2 << TCU_TCSR_PRESCALE_BIT)
  392. #define TCU_TCSR_PRESCALE64 (0x3 << TCU_TCSR_PRESCALE_BIT)
  393. #define TCU_TCSR_PRESCALE256 (0x4 << TCU_TCSR_PRESCALE_BIT)
  394. #define TCU_TCSR_PRESCALE1024 (0x5 << TCU_TCSR_PRESCALE_BIT)
  395. #define TCU_TCSR_EXT_EN (1 << 2)
  396. #define TCU_TCSR_RTC_EN (1 << 1)
  397. #define TCU_TCSR_PCK_EN (1 << 0)
  398. #define TCU_TER_TCEN5 (1 << 5)
  399. #define TCU_TER_TCEN4 (1 << 4)
  400. #define TCU_TER_TCEN3 (1 << 3)
  401. #define TCU_TER_TCEN2 (1 << 2)
  402. #define TCU_TER_TCEN1 (1 << 1)
  403. #define TCU_TER_TCEN0 (1 << 0)
  404. #define TCU_TESR_TCST5 (1 << 5)
  405. #define TCU_TESR_TCST4 (1 << 4)
  406. #define TCU_TESR_TCST3 (1 << 3)
  407. #define TCU_TESR_TCST2 (1 << 2)
  408. #define TCU_TESR_TCST1 (1 << 1)
  409. #define TCU_TESR_TCST0 (1 << 0)
  410. #define TCU_TECR_TCCL5 (1 << 5)
  411. #define TCU_TECR_TCCL4 (1 << 4)
  412. #define TCU_TECR_TCCL3 (1 << 3)
  413. #define TCU_TECR_TCCL2 (1 << 2)
  414. #define TCU_TECR_TCCL1 (1 << 1)
  415. #define TCU_TECR_TCCL0 (1 << 0)
  416. #define TCU_TFR_HFLAG5 (1 << 21)
  417. #define TCU_TFR_HFLAG4 (1 << 20)
  418. #define TCU_TFR_HFLAG3 (1 << 19)
  419. #define TCU_TFR_HFLAG2 (1 << 18)
  420. #define TCU_TFR_HFLAG1 (1 << 17)
  421. #define TCU_TFR_HFLAG0 (1 << 16)
  422. #define TCU_TFR_FFLAG5 (1 << 5)
  423. #define TCU_TFR_FFLAG4 (1 << 4)
  424. #define TCU_TFR_FFLAG3 (1 << 3)
  425. #define TCU_TFR_FFLAG2 (1 << 2)
  426. #define TCU_TFR_FFLAG1 (1 << 1)
  427. #define TCU_TFR_FFLAG0 (1 << 0)
  428. #define TCU_TFSR_HFLAG5 (1 << 21)
  429. #define TCU_TFSR_HFLAG4 (1 << 20)
  430. #define TCU_TFSR_HFLAG3 (1 << 19)
  431. #define TCU_TFSR_HFLAG2 (1 << 18)
  432. #define TCU_TFSR_HFLAG1 (1 << 17)
  433. #define TCU_TFSR_HFLAG0 (1 << 16)
  434. #define TCU_TFSR_FFLAG5 (1 << 5)
  435. #define TCU_TFSR_FFLAG4 (1 << 4)
  436. #define TCU_TFSR_FFLAG3 (1 << 3)
  437. #define TCU_TFSR_FFLAG2 (1 << 2)
  438. #define TCU_TFSR_FFLAG1 (1 << 1)
  439. #define TCU_TFSR_FFLAG0 (1 << 0)
  440. #define TCU_TFCR_HFLAG5 (1 << 21)
  441. #define TCU_TFCR_HFLAG4 (1 << 20)
  442. #define TCU_TFCR_HFLAG3 (1 << 19)
  443. #define TCU_TFCR_HFLAG2 (1 << 18)
  444. #define TCU_TFCR_HFLAG1 (1 << 17)
  445. #define TCU_TFCR_HFLAG0 (1 << 16)
  446. #define TCU_TFCR_FFLAG5 (1 << 5)
  447. #define TCU_TFCR_FFLAG4 (1 << 4)
  448. #define TCU_TFCR_FFLAG3 (1 << 3)
  449. #define TCU_TFCR_FFLAG2 (1 << 2)
  450. #define TCU_TFCR_FFLAG1 (1 << 1)
  451. #define TCU_TFCR_FFLAG0 (1 << 0)
  452. #define TCU_TMR_HMASK5 (1 << 21)
  453. #define TCU_TMR_HMASK4 (1 << 20)
  454. #define TCU_TMR_HMASK3 (1 << 19)
  455. #define TCU_TMR_HMASK2 (1 << 18)
  456. #define TCU_TMR_HMASK1 (1 << 17)
  457. #define TCU_TMR_HMASK0 (1 << 16)
  458. #define TCU_TMR_FMASK5 (1 << 5)
  459. #define TCU_TMR_FMASK4 (1 << 4)
  460. #define TCU_TMR_FMASK3 (1 << 3)
  461. #define TCU_TMR_FMASK2 (1 << 2)
  462. #define TCU_TMR_FMASK1 (1 << 1)
  463. #define TCU_TMR_FMASK0 (1 << 0)
  464. #define TCU_TMSR_HMST5 (1 << 21)
  465. #define TCU_TMSR_HMST4 (1 << 20)
  466. #define TCU_TMSR_HMST3 (1 << 19)
  467. #define TCU_TMSR_HMST2 (1 << 18)
  468. #define TCU_TMSR_HMST1 (1 << 17)
  469. #define TCU_TMSR_HMST0 (1 << 16)
  470. #define TCU_TMSR_FMST5 (1 << 5)
  471. #define TCU_TMSR_FMST4 (1 << 4)
  472. #define TCU_TMSR_FMST3 (1 << 3)
  473. #define TCU_TMSR_FMST2 (1 << 2)
  474. #define TCU_TMSR_FMST1 (1 << 1)
  475. #define TCU_TMSR_FMST0 (1 << 0)
  476. #define TCU_TMCR_HMCL5 (1 << 21)
  477. #define TCU_TMCR_HMCL4 (1 << 20)
  478. #define TCU_TMCR_HMCL3 (1 << 19)
  479. #define TCU_TMCR_HMCL2 (1 << 18)
  480. #define TCU_TMCR_HMCL1 (1 << 17)
  481. #define TCU_TMCR_HMCL0 (1 << 16)
  482. #define TCU_TMCR_FMCL5 (1 << 5)
  483. #define TCU_TMCR_FMCL4 (1 << 4)
  484. #define TCU_TMCR_FMCL3 (1 << 3)
  485. #define TCU_TMCR_FMCL2 (1 << 2)
  486. #define TCU_TMCR_FMCL1 (1 << 1)
  487. #define TCU_TMCR_FMCL0 (1 << 0)
  488. #define TCU_TSR_WDTS (1 << 16)
  489. #define TCU_TSR_STOP5 (1 << 5)
  490. #define TCU_TSR_STOP4 (1 << 4)
  491. #define TCU_TSR_STOP3 (1 << 3)
  492. #define TCU_TSR_STOP2 (1 << 2)
  493. #define TCU_TSR_STOP1 (1 << 1)
  494. #define TCU_TSR_STOP0 (1 << 0)
  495. #define TCU_TSSR_WDTSS (1 << 16)
  496. #define TCU_TSSR_STPS5 (1 << 5)
  497. #define TCU_TSSR_STPS4 (1 << 4)
  498. #define TCU_TSSR_STPS3 (1 << 3)
  499. #define TCU_TSSR_STPS2 (1 << 2)
  500. #define TCU_TSSR_STPS1 (1 << 1)
  501. #define TCU_TSSR_STPS0 (1 << 0)
  502. #define TCU_TSSR_WDTSC (1 << 16)
  503. #define TCU_TSSR_STPC5 (1 << 5)
  504. #define TCU_TSSR_STPC4 (1 << 4)
  505. #define TCU_TSSR_STPC3 (1 << 3)
  506. #define TCU_TSSR_STPC2 (1 << 2)
  507. #define TCU_TSSR_STPC1 (1 << 1)
  508. #define TCU_TSSR_STPC0 (1 << 0)
  509. /* Register definition */
  510. #define WDT_TCSR_PRESCALE_BIT 3
  511. #define WDT_TCSR_PRESCALE_MASK (0x7 << WDT_TCSR_PRESCALE_BIT)
  512. #define WDT_TCSR_PRESCALE1 (0x0 << WDT_TCSR_PRESCALE_BIT)
  513. #define WDT_TCSR_PRESCALE4 (0x1 << WDT_TCSR_PRESCALE_BIT)
  514. #define WDT_TCSR_PRESCALE16 (0x2 << WDT_TCSR_PRESCALE_BIT)
  515. #define WDT_TCSR_PRESCALE64 (0x3 << WDT_TCSR_PRESCALE_BIT)
  516. #define WDT_TCSR_PRESCALE256 (0x4 << WDT_TCSR_PRESCALE_BIT)
  517. #define WDT_TCSR_PRESCALE1024 (0x5 << WDT_TCSR_PRESCALE_BIT)
  518. #define WDT_TCSR_EXT_EN (1 << 2)
  519. #define WDT_TCSR_RTC_EN (1 << 1)
  520. #define WDT_TCSR_PCK_EN (1 << 0)
  521. #define WDT_TCER_TCEN (1 << 0)
  522. /*
  523. * Define macros for UART_IER
  524. * UART Interrupt Enable Register
  525. */
  526. #define UART_IER_RIE (1 << 0) /* 0: receive fifo full interrupt disable */
  527. #define UART_IER_TIE (1 << 1) /* 0: transmit fifo empty interrupt disable */
  528. #define UART_IER_RLIE (1 << 2) /* 0: receive line status interrupt disable */
  529. #define UART_IER_MIE (1 << 3) /* 0: modem status interrupt disable */
  530. #define UART_IER_RTIE (1 << 4) /* 0: receive timeout interrupt disable */
  531. /*
  532. * Define macros for UART_ISR
  533. * UART Interrupt Status Register
  534. */
  535. #define UART_ISR_IP (1 << 0) /* 0: interrupt is pending 1: no interrupt */
  536. #define UART_ISR_IID (7 << 1) /* Source of Interrupt */
  537. #define UART_ISR_IID_MSI (0 << 1) /* Modem status interrupt */
  538. #define UART_ISR_IID_THRI (1 << 1) /* Transmitter holding register empty */
  539. #define UART_ISR_IID_RDI (2 << 1) /* Receiver data interrupt */
  540. #define UART_ISR_IID_RLSI (3 << 1) /* Receiver line status interrupt */
  541. /* FIFO mode select, set when UART_FCR.FE is set to 1 */
  542. #define UART_ISR_FFMS (3 << 6)
  543. #define UART_ISR_FFMS_NO_FIFO (0 << 6)
  544. #define UART_ISR_FFMS_FIFO_MODE (3 << 6)
  545. /*
  546. * Define macros for UART_FCR
  547. * UART FIFO Control Register
  548. */
  549. #define UART_FCR_FE (1 << 0) /* 0: non-FIFO mode 1: FIFO mode */
  550. #define UART_FCR_RFLS (1 << 1) /* write 1 to flush receive FIFO */
  551. #define UART_FCR_TFLS (1 << 2) /* write 1 to flush transmit FIFO */
  552. #define UART_FCR_DMS (1 << 3) /* 0: disable DMA mode */
  553. #define UART_FCR_UUE (1 << 4) /* 0: disable UART */
  554. #define UART_FCR_RTRG (3 << 6) /* Receive FIFO Data Trigger */
  555. #define UART_FCR_RTRG_1 (0 << 6)
  556. #define UART_FCR_RTRG_4 (1 << 6)
  557. #define UART_FCR_RTRG_8 (2 << 6)
  558. #define UART_FCR_RTRG_15 (3 << 6)
  559. /*
  560. * Define macros for UART_LCR
  561. * UART Line Control Register
  562. */
  563. #define UART_LCR_WLEN (3 << 0) /* word length */
  564. #define UART_LCR_WLEN_5 (0 << 0)
  565. #define UART_LCR_WLEN_6 (1 << 0)
  566. #define UART_LCR_WLEN_7 (2 << 0)
  567. #define UART_LCR_WLEN_8 (3 << 0)
  568. #define UART_LCR_STOP (1 << 2)
  569. /* 0: 1 stop bit when word length is 5,6,7,8
  570. 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */
  571. #define UART_LCR_STOP_1 (0 << 2)
  572. /* 0: 1 stop bit when word length is 5,6,7,8
  573. 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */
  574. #define UART_LCR_STOP_2 (1 << 2)
  575. /* 0: 1 stop bit when word length is 5,6,7,8
  576. 1: 1.5 stop bits when 5; 2 stop bits when 6,7,8 */
  577. #define UART_LCR_PE (1 << 3) /* 0: parity disable */
  578. #define UART_LCR_PROE (1 << 4) /* 0: even parity 1: odd parity */
  579. #define UART_LCR_SPAR (1 << 5) /* 0: sticky parity disable */
  580. #define UART_LCR_SBRK (1 << 6) /* write 0 normal, write 1 send break */
  581. /* 0: access UART_RDR/TDR/IER 1: access UART_DLLR/DLHR */
  582. #define UART_LCR_DLAB (1 << 7)
  583. /*
  584. * Define macros for UART_LSR
  585. * UART Line Status Register
  586. */
  587. /* 0: receive FIFO is empty 1: receive data is ready */
  588. #define UART_LSR_DR (1 << 0)
  589. /* 0: no overrun error */
  590. #define UART_LSR_ORER (1 << 1)
  591. /* 0: no parity error */
  592. #define UART_LSR_PER (1 << 2)
  593. /* 0; no framing error */
  594. #define UART_LSR_FER (1 << 3)
  595. /* 0: no break detected 1: receive a break signal */
  596. #define UART_LSR_BRK (1 << 4)
  597. /* 1: transmit FIFO half "empty" */
  598. #define UART_LSR_TDRQ (1 << 5)
  599. /* 1: transmit FIFO and shift registers empty */
  600. #define UART_LSR_TEMT (1 << 6)
  601. /* 0: no receive error 1: receive error in FIFO mode */
  602. #define UART_LSR_RFER (1 << 7)
  603. /*
  604. * Define macros for UART_MCR
  605. * UART Modem Control Register
  606. */
  607. #define UART_MCR_DTR (1 << 0) /* 0: DTR_ ouput high */
  608. #define UART_MCR_RTS (1 << 1) /* 0: RTS_ output high */
  609. /* 0: UART_MSR.RI is set to 0 and RI_ input high */
  610. #define UART_MCR_OUT1 (1 << 2)
  611. /* 0: UART_MSR.DCD is set to 0 and DCD_ input high */
  612. #define UART_MCR_OUT2 (1 << 3)
  613. #define UART_MCR_LOOP (1 << 4) /* 0: normal 1: loopback mode */
  614. #define UART_MCR_MCE (1 << 7) /* 0: modem function is disable */
  615. /*
  616. * Define macros for UART_MSR
  617. * UART Modem Status Register
  618. */
  619. #define UART_MSR_DCTS (1 << 0) /* 0: no change on CTS_ since last read */
  620. #define UART_MSR_DDSR (1 << 1) /* 0: no change on DSR_ since last read */
  621. #define UART_MSR_DRI (1 << 2) /* 0: no change on RI_ since last read */
  622. #define UART_MSR_DDCD (1 << 3) /* 0: no change on DCD_ since last read */
  623. #define UART_MSR_CTS (1 << 4) /* 0: CTS_ pin is high */
  624. #define UART_MSR_DSR (1 << 5) /* 0: DSR_ pin is high */
  625. #define UART_MSR_RI (1 << 6) /* 0: RI_ pin is high */
  626. #define UART_MSR_DCD (1 << 7) /* 0: DCD_ pin is high */
  627. /*
  628. * Define macros for SIRCR
  629. * Slow IrDA Control Register
  630. */
  631. #define SIRCR_TSIRE (1 << 0) /* 0: TX is in UART mode 1: IrDA mode */
  632. #define SIRCR_RSIRE (1 << 1) /* 0: RX is in UART mode 1: IrDA mode */
  633. #define SIRCR_TPWS (1 << 2) /* 0: transmit 0 pulse width is 3/16 of bit length
  634. 1: 0 pulse width is 1.6us for 115.2Kbps */
  635. #define SIRCR_TXPL (1 << 3) /* 0: encoder generates a positive pulse for 0 */
  636. #define SIRCR_RXPL (1 << 4) /* 0: decoder interprets positive pulse as 0 */
  637. /* MSC Clock and Control Register (MSC_STRPCL) */
  638. #define MSC_STRPCL_EXIT_MULTIPLE (1 << 7)
  639. #define MSC_STRPCL_EXIT_TRANSFER (1 << 6)
  640. #define MSC_STRPCL_START_READWAIT (1 << 5)
  641. #define MSC_STRPCL_STOP_READWAIT (1 << 4)
  642. #define MSC_STRPCL_RESET (1 << 3)
  643. #define MSC_STRPCL_START_OP (1 << 2)
  644. #define MSC_STRPCL_CLOCK_CONTROL_BIT 0
  645. #define MSC_STRPCL_CLOCK_CONTROL_MASK (0x3 << MSC_STRPCL_CLOCK_CONTROL_BIT)
  646. #define MSC_STRPCL_CLOCK_CONTROL_STOP (0x1 << MSC_STRPCL_CLOCK_CONTROL_BIT)
  647. #define MSC_STRPCL_CLOCK_CONTROL_START (0x2 << MSC_STRPCL_CLOCK_CONTROL_BIT)
  648. /* MSC Status Register (MSC_STAT) */
  649. #define MSC_STAT_IS_RESETTING (1 << 15)
  650. #define MSC_STAT_SDIO_INT_ACTIVE (1 << 14)
  651. #define MSC_STAT_PRG_DONE (1 << 13)
  652. #define MSC_STAT_DATA_TRAN_DONE (1 << 12)
  653. #define MSC_STAT_END_CMD_RES (1 << 11)
  654. #define MSC_STAT_DATA_FIFO_AFULL (1 << 10)
  655. #define MSC_STAT_IS_READWAIT (1 << 9)
  656. #define MSC_STAT_CLK_EN (1 << 8)
  657. #define MSC_STAT_DATA_FIFO_FULL (1 << 7)
  658. #define MSC_STAT_DATA_FIFO_EMPTY (1 << 6)
  659. #define MSC_STAT_CRC_RES_ERR (1 << 5)
  660. #define MSC_STAT_CRC_READ_ERROR (1 << 4)
  661. #define MSC_STAT_CRC_WRITE_ERROR_BIT 2
  662. #define MSC_STAT_CRC_WRITE_ERROR_MASK (0x3 << MSC_STAT_CRC_WRITE_ERROR_BIT)
  663. /* No error on transmission of data */
  664. #define MSC_STAT_CRC_WRITE_ERROR_NO (0 << MSC_STAT_CRC_WRITE_ERROR_BIT)
  665. /* Card observed erroneous transmission of data */
  666. #define MSC_STAT_CRC_WRITE_ERROR (1 << MSC_STAT_CRC_WRITE_ERROR_BIT)
  667. /* No CRC status is sent back */
  668. #define MSC_STAT_CRC_WRITE_ERROR_NOSTS (2 << MSC_STAT_CRC_WRITE_ERROR_BIT)
  669. #define MSC_STAT_TIME_OUT_RES (1 << 1)
  670. #define MSC_STAT_TIME_OUT_READ (1 << 0)
  671. /* MSC Bus Clock Control Register (MSC_CLKRT) */
  672. #define MSC_CLKRT_CLK_RATE_BIT 0
  673. #define MSC_CLKRT_CLK_RATE_MASK (0x7 << MSC_CLKRT_CLK_RATE_BIT)
  674. #define MSC_CLKRT_CLK_RATE_DIV_1 (0x0 << MSC_CLKRT_CLK_RATE_BIT)
  675. #define MSC_CLKRT_CLK_RATE_DIV_2 (0x1 << MSC_CLKRT_CLK_RATE_BIT)
  676. #define MSC_CLKRT_CLK_RATE_DIV_4 (0x2 << MSC_CLKRT_CLK_RATE_BIT)
  677. #define MSC_CLKRT_CLK_RATE_DIV_8 (0x3 << MSC_CLKRT_CLK_RATE_BIT)
  678. #define MSC_CLKRT_CLK_RATE_DIV_16 (0x4 << MSC_CLKRT_CLK_RATE_BIT)
  679. #define MSC_CLKRT_CLK_RATE_DIV_32 (0x5 << MSC_CLKRT_CLK_RATE_BIT)
  680. #define MSC_CLKRT_CLK_RATE_DIV_64 (0x6 << MSC_CLKRT_CLK_RATE_BIT)
  681. #define MSC_CLKRT_CLK_RATE_DIV_128 (0x7 << MSC_CLKRT_CLK_RATE_BIT)
  682. /* MSC Command Sequence Control Register (MSC_CMDAT) */
  683. #define MSC_CMDAT_IO_ABORT (1 << 11)
  684. #define MSC_CMDAT_BUS_WIDTH_BIT 9
  685. #define MSC_CMDAT_BUS_WIDTH_MASK (0x3 << MSC_CMDAT_BUS_WIDTH_BIT)
  686. #define MSC_CMDAT_BUS_WIDTH_1BIT (0x0 << MSC_CMDAT_BUS_WIDTH_BIT)
  687. #define MSC_CMDAT_BUS_WIDTH_4BIT (0x2 << MSC_CMDAT_BUS_WIDTH_BIT)
  688. #define MSC_CMDAT_DMA_EN (1 << 8)
  689. #define MSC_CMDAT_INIT (1 << 7)
  690. #define MSC_CMDAT_BUSY (1 << 6)
  691. #define MSC_CMDAT_STREAM_BLOCK (1 << 5)
  692. #define MSC_CMDAT_WRITE (1 << 4)
  693. #define MSC_CMDAT_READ (0 << 4)
  694. #define MSC_CMDAT_DATA_EN (1 << 3)
  695. #define MSC_CMDAT_RESPONSE_BIT 0
  696. #define MSC_CMDAT_RESPONSE_MASK (0x7 << MSC_CMDAT_RESPONSE_BIT)
  697. #define MSC_CMDAT_RESPONSE_NONE (0x0 << MSC_CMDAT_RESPONSE_BIT)
  698. #define MSC_CMDAT_RESPONSE_R1 (0x1 << MSC_CMDAT_RESPONSE_BIT)
  699. #define MSC_CMDAT_RESPONSE_R2 (0x2 << MSC_CMDAT_RESPONSE_BIT)
  700. #define MSC_CMDAT_RESPONSE_R3 (0x3 << MSC_CMDAT_RESPONSE_BIT)
  701. #define MSC_CMDAT_RESPONSE_R4 (0x4 << MSC_CMDAT_RESPONSE_BIT)
  702. #define MSC_CMDAT_RESPONSE_R5 (0x5 << MSC_CMDAT_RESPONSE_BIT)
  703. #define MSC_CMDAT_RESPONSE_R6 (0x6 << MSC_CMDAT_RESPONSE_BIT)
  704. /* MSC Interrupts Mask Register (MSC_IMASK) */
  705. #define MSC_IMASK_SDIO (1 << 7)
  706. #define MSC_IMASK_TXFIFO_WR_REQ (1 << 6)
  707. #define MSC_IMASK_RXFIFO_RD_REQ (1 << 5)
  708. #define MSC_IMASK_END_CMD_RES (1 << 2)
  709. #define MSC_IMASK_PRG_DONE (1 << 1)
  710. #define MSC_IMASK_DATA_TRAN_DONE (1 << 0)
  711. #ifndef __ASSEMBLY__
  712. /* INTC (Interrupt Controller) */
  713. struct jz4740_intc {
  714. uint32_t isr; /* interrupt source register */
  715. uint32_t imr; /* interrupt mask register */
  716. uint32_t imsr; /* interrupt mask set register */
  717. uint32_t imcr; /* interrupt mask clear register */
  718. uint32_t ipr; /* interrupt pending register */
  719. };
  720. /* RTC */
  721. struct jz4740_rtc {
  722. uint32_t rcr; /* rtc control register */
  723. uint32_t rsr; /* rtc second register */
  724. uint32_t rsar; /* rtc second alarm register */
  725. uint32_t rgr; /* rtc regulator register */
  726. uint32_t hcr; /* hibernate control register */
  727. uint32_t hwfcr; /* hibernate wakeup filter counter reg */
  728. uint32_t hrcr; /* hibernate reset counter reg */
  729. uint32_t hwcr; /* hibernate wakeup control register */
  730. uint32_t hwrsr; /* hibernate wakeup status reg */
  731. uint32_t hspr; /* scratch pattern register */
  732. };
  733. /* CPM (Clock reset and Power control Management) */
  734. struct jz4740_cpm {
  735. uint32_t cpccr; /* 0x00 clock control reg */
  736. uint32_t lcr; /* 0x04 low power control reg */
  737. uint32_t rsr; /* 0x08 reset status reg */
  738. uint32_t pad00;
  739. uint32_t cppcr; /* 0x10 pll control reg */
  740. uint32_t pad01[3];
  741. uint32_t clkgr; /* 0x20 clock gate reg */
  742. uint32_t scr; /* 0x24 sleep control reg */
  743. uint32_t pad02[14];
  744. uint32_t i2scd; /* 0x60 I2S device clock divider reg */
  745. uint32_t lpcdr; /* 0x64 LCD pix clock divider reg */
  746. uint32_t msccdr; /* 0x68 MSC device clock divider reg */
  747. uint32_t uhccdr; /* 0x6C UHC 48M clock divider reg */
  748. uint32_t uhcts; /* 0x70 UHC PHY test point reg */
  749. uint32_t ssicd; /* 0x74 SSI clock divider reg */
  750. };
  751. /* TCU (Timer Counter Unit) */
  752. struct jz4740_tcu {
  753. uint32_t pad00[4];
  754. uint32_t ter; /* 0x10 Timer Counter Enable Register */
  755. uint32_t tesr; /* 0x14 Timer Counter Enable Set Register */
  756. uint32_t tecr; /* 0x18 Timer Counter Enable Clear Register */
  757. uint32_t tsr; /* 0x1C Timer Stop Register */
  758. uint32_t tfr; /* 0x20 Timer Flag Register */
  759. uint32_t tfsr; /* 0x24 Timer Flag Set Register */
  760. uint32_t tfcr; /* 0x28 Timer Flag Clear Register */
  761. uint32_t tssr; /* 0x2C Timer Stop Set Register */
  762. uint32_t tmr; /* 0x30 Timer Mask Register */
  763. uint32_t tmsr; /* 0x34 Timer Mask Set Register */
  764. uint32_t tmcr; /* 0x38 Timer Mask Clear Register */
  765. uint32_t tscr; /* 0x3C Timer Stop Clear Register */
  766. uint32_t tdfr0; /* 0x40 Timer Data Full Register */
  767. uint32_t tdhr0; /* 0x44 Timer Data Half Register */
  768. uint32_t tcnt0; /* 0x48 Timer Counter Register */
  769. uint32_t tcsr0; /* 0x4C Timer Control Register */
  770. uint32_t tdfr1; /* 0x50 */
  771. uint32_t tdhr1; /* 0x54 */
  772. uint32_t tcnt1; /* 0x58 */
  773. uint32_t tcsr1; /* 0x5C */
  774. uint32_t tdfr2; /* 0x60 */
  775. uint32_t tdhr2; /* 0x64 */
  776. uint32_t tcnt2; /* 0x68 */
  777. uint32_t tcsr2; /* 0x6C */
  778. uint32_t tdfr3; /* 0x70 */
  779. uint32_t tdhr3; /* 0x74 */
  780. uint32_t tcnt3; /* 0x78 */
  781. uint32_t tcsr3; /* 0x7C */
  782. uint32_t tdfr4; /* 0x80 */
  783. uint32_t tdhr4; /* 0x84 */
  784. uint32_t tcnt4; /* 0x88 */
  785. uint32_t tcsr4; /* 0x8C */
  786. uint32_t tdfr5; /* 0x90 */
  787. uint32_t tdhr5; /* 0x94 */
  788. uint32_t tcnt5; /* 0x98 */
  789. uint32_t tcsr5; /* 0x9C */
  790. };
  791. /* WDT (WatchDog Timer) */
  792. struct jz4740_wdt {
  793. uint16_t tdr; /* 0x00 watchdog timer data reg*/
  794. uint16_t pad00;
  795. uint8_t tcer; /* 0x04 watchdog counter enable reg*/
  796. uint8_t pad01[3];
  797. uint16_t tcnt; /* 0x08 watchdog timer counter*/
  798. uint16_t pad02;
  799. uint16_t tcsr; /* 0x0C watchdog timer control reg*/
  800. uint16_t pad03;
  801. };
  802. struct jz4740_uart {
  803. uint8_t rbr_thr_dllr;
  804. /* 0x00 R 8b receive buffer reg */
  805. /* 0x00 W 8b transmit hold reg */
  806. /* 0x00 RW 8b divisor latch low reg */
  807. uint8_t pad00[3];
  808. uint8_t dlhr_ier;
  809. /* 0x04 RW 8b divisor latch high reg */
  810. /* 0x04 RW 8b interrupt enable reg */
  811. uint8_t pad01[3];
  812. uint8_t iir_fcr;
  813. /* 0x08 R 8b interrupt identification reg */
  814. /* 0x08 W 8b FIFO control reg */
  815. uint8_t pad02[3];
  816. uint8_t lcr; /* 0x0C RW 8b Line control reg */
  817. uint8_t pad03[3];
  818. uint8_t mcr; /* 0x10 RW 8b modem control reg */
  819. uint8_t pad04[3];
  820. uint8_t lsr; /* 0x14 R 8b line status reg */
  821. uint8_t pad05[3];
  822. uint8_t msr; /* 0x18 R 8b modem status reg */
  823. uint8_t pad06[3];
  824. uint8_t spr; /* 0x1C RW 8b scratch pad reg */
  825. uint8_t pad07[3];
  826. uint8_t isr; /* 0x20 RW 8b infrared selection reg */
  827. uint8_t pad08[3];
  828. uint8_t umr; /* 0x24 RW 8b */
  829. };
  830. /* MSC */
  831. struct jz4740_msc {
  832. uint16_t strpcl;/* 0x00 */
  833. uint32_t stat; /* 0x04 */
  834. uint16_t clkrt; /* 0x08 */
  835. uint32_t cmdat; /* 0x0C */
  836. uint16_t resto; /* 0x10 */
  837. uint16_t rdto; /* 0x14 */
  838. uint16_t blklen;/* 0x18 */
  839. uint16_t nob; /* 0x1C */
  840. uint16_t snob; /* 0x20 */
  841. uint16_t imask; /* 0x24 */
  842. uint16_t ireg; /* 0x28 */
  843. uint8_t cmd; /* 0x2C */
  844. uint32_t arg; /* 0x30 */
  845. uint16_t res; /* 0x34 */
  846. uint32_t rxfifo;/* 0x38 */
  847. uint32_t txfifo;/* 0x3C */
  848. };
  849. /* External Memory Controller */
  850. struct jz4740_emc {
  851. uint32_t bcr; /* 0x00 BCR */
  852. uint32_t pad00[3];
  853. uint32_t smcr[5];
  854. /* x10 Static Memory Control Register 0 */
  855. /* x14 Static Memory Control Register 1 */
  856. /* x18 Static Memory Control Register 2 */
  857. /* x1c Static Memory Control Register 3 */
  858. /* x20 Static Memory Control Register 4 */
  859. uint32_t pad01[3];
  860. uint32_t sacr[5];
  861. /* x30 Static Memory Bank 0 Addr Config Reg */
  862. /* x34 Static Memory Bank 1 Addr Config Reg */
  863. /* x38 Static Memory Bank 2 Addr Config Reg */
  864. /* x3c Static Memory Bank 3 Addr Config Reg */
  865. /* x40 Static Memory Bank 4 Addr Config Reg */
  866. uint32_t pad02[3];
  867. uint32_t nfcsr; /* x050 NAND Flash Control/Status Register */
  868. uint32_t pad03[11];
  869. uint32_t dmcr; /* x80 DRAM Control Register */
  870. uint16_t rtcsr; /* x84 Refresh Time Control/Status Register */
  871. uint16_t pad04;
  872. uint16_t rtcnt; /* x88 Refresh Timer Counter */
  873. uint16_t pad05;
  874. uint16_t rtcor; /* x8c Refresh Time Constant Register */
  875. uint16_t pad06;
  876. uint32_t dmar0; /* x90 SDRAM Bank 0 Addr Config Register */
  877. uint32_t pad07[27];
  878. uint32_t nfecr; /* x100 NAND Flash ECC Control Register */
  879. uint32_t nfecc; /* x104 NAND Flash ECC Data Register */
  880. uint8_t nfpar[12];
  881. /* x108 NAND Flash RS Parity 0 Register */
  882. /* x10c NAND Flash RS Parity 1 Register */
  883. /* x110 NAND Flash RS Parity 2 Register */
  884. uint32_t nfints; /* x114 NAND Flash Interrupt Status Register */
  885. uint32_t nfinte; /* x118 NAND Flash Interrupt Enable Register */
  886. uint32_t nferr[4];
  887. /* x11c NAND Flash RS Error Report 0 Register */
  888. /* x120 NAND Flash RS Error Report 1 Register */
  889. /* x124 NAND Flash RS Error Report 2 Register */
  890. /* x128 NAND Flash RS Error Report 3 Register */
  891. };
  892. #define __gpio_as_nand() \
  893. do { \
  894. writel(0x02018000, GPIO_PXFUNS(1)); \
  895. writel(0x02018000, GPIO_PXSELC(1)); \
  896. writel(0x02018000, GPIO_PXPES(1)); \
  897. writel(0x30000000, GPIO_PXFUNS(2)); \
  898. writel(0x30000000, GPIO_PXSELC(2)); \
  899. writel(0x30000000, GPIO_PXPES(2)); \
  900. writel(0x40000000, GPIO_PXFUNC(2)); \
  901. writel(0x40000000, GPIO_PXSELC(2)); \
  902. writel(0x40000000, GPIO_PXDIRC(2)); \
  903. writel(0x40000000, GPIO_PXPES(2)); \
  904. writel(0x00400000, GPIO_PXFUNS(1)); \
  905. writel(0x00400000, GPIO_PXSELC(1)); \
  906. } while (0)
  907. #define __gpio_as_sdram_16bit_4720() \
  908. do { \
  909. writel(0x5442bfaa, GPIO_PXFUNS(0)); \
  910. writel(0x5442bfaa, GPIO_PXSELC(0)); \
  911. writel(0x5442bfaa, GPIO_PXPES(0)); \
  912. writel(0x81f9ffff, GPIO_PXFUNS(1)); \
  913. writel(0x81f9ffff, GPIO_PXSELC(1)); \
  914. writel(0x81f9ffff, GPIO_PXPES(1)); \
  915. writel(0x01000000, GPIO_PXFUNS(2)); \
  916. writel(0x01000000, GPIO_PXSELC(2)); \
  917. writel(0x01000000, GPIO_PXPES(2)); \
  918. } while (0)
  919. #define __gpio_as_lcd_18bit() \
  920. do { \
  921. writel(0x003fffff, GPIO_PXFUNS(2)); \
  922. writel(0x003fffff, GPIO_PXSELC(2)); \
  923. writel(0x003fffff, GPIO_PXPES(2)); \
  924. } while (0)
  925. /* MSC_CMD, MSC_CLK, MSC_D0 ~ MSC_D3 */
  926. #define __gpio_as_msc() \
  927. do { \
  928. writel(0x00003f00, GPIO_PXFUNS(3)); \
  929. writel(0x00003f00, GPIO_PXSELC(3)); \
  930. writel(0x00003f00, GPIO_PXPES(3)); \
  931. } while (0)
  932. #define __gpio_get_port(p) (readl(GPIO_PXPIN(p)))
  933. #define __gpio_disable_pull(n) \
  934. do { \
  935. unsigned int p, o; \
  936. p = (n) / 32; \
  937. o = (n) % 32; \
  938. writel((1 << o), GPIO_PXPES(p)); \
  939. } while (0)
  940. #define __gpio_enable_pull(n) \
  941. do { \
  942. unsigned int p, o; \
  943. p = (n) / 32; \
  944. o = (n) % 32; \
  945. writel(1 << (o), GPIO_PXPEC(p)); \
  946. } while (0)
  947. #define __gpio_port_as_output(p, o) \
  948. do { \
  949. writel(1 << (o), GPIO_PXFUNC(p)); \
  950. writel(1 << (o), GPIO_PXSELC(p)); \
  951. writel(1 << (o), GPIO_PXDIRS(p)); \
  952. } while (0)
  953. #define __gpio_port_as_input(p, o) \
  954. do { \
  955. writel(1 << (o), GPIO_PXFUNC(p)); \
  956. writel(1 << (o), GPIO_PXSELC(p)); \
  957. writel(1 << (o), GPIO_PXDIRC(p)); \
  958. } while (0)
  959. #define __gpio_as_output(n) \
  960. do { \
  961. unsigned int p, o; \
  962. p = (n) / 32; \
  963. o = (n) % 32; \
  964. __gpio_port_as_output(p, o); \
  965. } while (0)
  966. #define __gpio_as_input(n) \
  967. do { \
  968. unsigned int p, o; \
  969. p = (n) / 32; \
  970. o = (n) % 32; \
  971. __gpio_port_as_input(p, o); \
  972. } while (0)
  973. #define __gpio_set_pin(n) \
  974. do { \
  975. unsigned int p, o; \
  976. p = (n) / 32; \
  977. o = (n) % 32; \
  978. writel((1 << o), GPIO_PXDATS(p)); \
  979. } while (0)
  980. #define __gpio_clear_pin(n) \
  981. do { \
  982. unsigned int p, o; \
  983. p = (n) / 32; \
  984. o = (n) % 32; \
  985. writel((1 << o), GPIO_PXDATC(p)); \
  986. } while (0)
  987. #define __gpio_get_pin(n) \
  988. ({ \
  989. unsigned int p, o, v; \
  990. p = (n) / 32; \
  991. o = (n) % 32; \
  992. if (__gpio_get_port(p) & (1 << o)) \
  993. v = 1; \
  994. else \
  995. v = 0; \
  996. v; \
  997. })
  998. #define __gpio_as_uart0() \
  999. do { \
  1000. writel(0x06000000, GPIO_PXFUNS(3)); \
  1001. writel(0x06000000, GPIO_PXSELS(3)); \
  1002. writel(0x06000000, GPIO_PXPES(3)); \
  1003. } while (0)
  1004. #define __gpio_jtag_to_uart0() \
  1005. do { \
  1006. writel(0x80000000, GPIO_PXSELS(2)); \
  1007. } while (0)
  1008. /* Clock Control Register */
  1009. #define __cpm_get_pllm() \
  1010. ((readl(JZ4740_CPM_BASE + 0x10) & CPM_CPPCR_PLLM_MASK) \
  1011. >> CPM_CPPCR_PLLM_BIT)
  1012. #define __cpm_get_plln() \
  1013. ((readl(JZ4740_CPM_BASE + 0x10) & CPM_CPPCR_PLLN_MASK) \
  1014. >> CPM_CPPCR_PLLN_BIT)
  1015. #define __cpm_get_pllod() \
  1016. ((readl(JZ4740_CPM_BASE + 0x10) & CPM_CPPCR_PLLOD_MASK) \
  1017. >> CPM_CPPCR_PLLOD_BIT)
  1018. #define __cpm_get_hdiv() \
  1019. ((readl(JZ4740_CPM_BASE + 0x00) & CPM_CPCCR_HDIV_MASK) \
  1020. >> CPM_CPCCR_HDIV_BIT)
  1021. #define __cpm_get_pdiv() \
  1022. ((readl(JZ4740_CPM_BASE + 0x00) & CPM_CPCCR_PDIV_MASK) \
  1023. >> CPM_CPCCR_PDIV_BIT)
  1024. #define __cpm_get_cdiv() \
  1025. ((readl(JZ4740_CPM_BASE + 0x00) & CPM_CPCCR_CDIV_MASK) \
  1026. >> CPM_CPCCR_CDIV_BIT)
  1027. #define __cpm_get_mdiv() \
  1028. ((readl(JZ4740_CPM_BASE + 0x00) & CPM_CPCCR_MDIV_MASK) \
  1029. >> CPM_CPCCR_MDIV_BIT)
  1030. static inline unsigned int __cpm_get_pllout(void)
  1031. {
  1032. uint32_t m, n, no, pllout;
  1033. uint32_t od[4] = {1, 2, 2, 4};
  1034. struct jz4740_cpm *cpm = (struct jz4740_cpm *)JZ4740_CPM_BASE;
  1035. uint32_t cppcr = readl(&cpm->cppcr);
  1036. if ((cppcr & CPM_CPPCR_PLLEN) && !(cppcr & CPM_CPPCR_PLLBP)) {
  1037. m = __cpm_get_pllm() + 2;
  1038. n = __cpm_get_plln() + 2;
  1039. no = od[__cpm_get_pllod()];
  1040. pllout = (CONFIG_SYS_EXTAL / (n * no)) * m;
  1041. } else
  1042. pllout = CONFIG_SYS_EXTAL;
  1043. return pllout;
  1044. }
  1045. extern void pll_init(void);
  1046. extern void sdram_init(void);
  1047. extern void calc_clocks(void);
  1048. extern void rtc_init(void);
  1049. #endif /* !__ASSEMBLY__ */
  1050. #endif /* __JZ4740_H__ */