Tronlong_C6748.gel 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736
  1. /****************************************************************************/
  2. /* */
  3. /* General Extension Language */
  4. /* 通用扩展语言文件 */
  5. /* */
  6. /* 2014年08月26日 */
  7. /* */
  8. /****************************************************************************/
  9. // 2014/12/24 删除管脚复用配置
  10. #define PLL0_BASE 0x01C11000 /*SYSTEM PLL BASE ADDRESS*/
  11. #define PLL0_PID *(unsigned int*) (PLL0_BASE + 0x00) /*PID*/
  12. #define PLL0_RSTYPE *(unsigned int*) (PLL0_BASE + 0xE4) /*Reset Type status Reg*/
  13. #define PLL0_PLLCTL *(unsigned int*) (PLL0_BASE + 0x100) /*PLL Control Register*/
  14. #define PLL0_OCSEL *(unsigned int*) (PLL0_BASE + 0x104) /*OBSCLK Select Register*/
  15. #define PLL0_SECCTL *(unsigned int*) (PLL0_BASE + 0x108) /*PLL Secondary Control Register*/
  16. #define PLL0_PLLM *(unsigned int*) (PLL0_BASE + 0x110) /*PLL Multiplier*/
  17. #define PLL0_PREDIV *(unsigned int*) (PLL0_BASE + 0x114) /*Pre divider*/
  18. #define PLL0_PLLDIV1 *(unsigned int*) (PLL0_BASE + 0x118) /*Divider-1*/
  19. #define PLL0_PLLDIV2 *(unsigned int*) (PLL0_BASE + 0x11C) /*Divider-2*/
  20. #define PLL0_PLLDIV3 *(unsigned int*) (PLL0_BASE + 0x120) /*Divider-3*/
  21. #define PLL0_OSCDIV1 *(unsigned int*) (PLL0_BASE + 0x124) /*Oscilator Divider*/
  22. #define PLL0_POSTDIV *(unsigned int*) (PLL0_BASE + 0x128) /*Post Divider*/
  23. #define PLL0_BPDIV *(unsigned int*) (PLL0_BASE + 0x12C) /*Bypass Divider*/
  24. #define PLL0_WAKEUP *(unsigned int*) (PLL0_BASE + 0x130) /*Wakeup Reg*/
  25. #define PLL0_PLLCMD *(unsigned int*) (PLL0_BASE + 0x138) /*Command Reg*/
  26. #define PLL0_PLLSTAT *(unsigned int*) (PLL0_BASE + 0x13C) /*Status Reg*/
  27. #define PLL0_ALNCTL *(unsigned int*) (PLL0_BASE + 0x140) /*Clock Align Control Reg*/
  28. #define PLL0_DCHANGE *(unsigned int*) (PLL0_BASE + 0x144) /*PLLDIV Ratio Chnage status*/
  29. #define PLL0_CKEN *(unsigned int*) (PLL0_BASE + 0x148) /*Clock Enable Reg*/
  30. #define PLL0_CKSTAT *(unsigned int*) (PLL0_BASE + 0x14C) /*Clock Status Reg*/
  31. #define PLL0_SYSTAT *(unsigned int*) (PLL0_BASE + 0x150) /*Sysclk status reg*/
  32. #define PLL0_PLLDIV4 *(unsigned int*) (PLL0_BASE + 0x160) /*Divider 4*/
  33. #define PLL0_PLLDIV5 *(unsigned int*) (PLL0_BASE + 0x164) /*Divider 5*/
  34. #define PLL0_PLLDIV6 *(unsigned int*) (PLL0_BASE + 0x168) /*Divider 6*/
  35. #define PLL0_PLLDIV7 *(unsigned int*) (PLL0_BASE + 0x16C) /*Divider 7*/
  36. #define PLL0_PLLDIV8 *(unsigned int*) (PLL0_BASE + 0x170) /*Divider 8*/
  37. #define PLL0_PLLDIV9 *(unsigned int*) (PLL0_BASE + 0x174) /*Divider 9*/
  38. #define PLL0_PLLDIV10 *(unsigned int*) (PLL0_BASE + 0x178) /*Divider 10*/
  39. #define PLL0_PLLDIV11 *(unsigned int*) (PLL0_BASE + 0x17C) /*Divider 11*/
  40. #define PLL0_PLLDIV12 *(unsigned int*) (PLL0_BASE + 0x180) /*Divider 12*/
  41. #define PLL0_PLLDIV13 *(unsigned int*) (PLL0_BASE + 0x184) /*Divider 13*/
  42. #define PLL0_PLLDIV14 *(unsigned int*) (PLL0_BASE + 0x188) /*Divider 14*/
  43. #define PLL0_PLLDIV15 *(unsigned int*) (PLL0_BASE + 0x18C) /*Divider 15*/
  44. #define PLL0_PLLDIV16 *(unsigned int*) (PLL0_BASE + 0x190) /*Divider 16*/
  45. #define PLL1_BASE 0x01E1A000 /*SYSTEM PLL1 BASE ADDRESS*/
  46. #define PLL1_PID *(unsigned int*) (PLL1_BASE + 0x00) /*PID*/
  47. #define PLL1_RSTYPE *(unsigned int*) (PLL1_BASE + 0xE4) /*Reset Type status Reg*/
  48. #define PLL1_PLLCTL *(unsigned int*) (PLL1_BASE + 0x100) /*PLL Control Register*/
  49. #define PLL1_OCSEL *(unsigned int*) (PLL1_BASE + 0x104) /*OBSCLK Select Register*/
  50. #define PLL1_SECCTL *(unsigned int*) (PLL1_BASE + 0x108) /*PLL Secondary Control Register*/
  51. #define PLL1_PLLM *(unsigned int*) (PLL1_BASE + 0x110) /*PLL Multiplier*/
  52. #define PLL1_PREDIV *(unsigned int*) (PLL1_BASE + 0x114) /*Pre divider*/
  53. #define PLL1_PLLDIV1 *(unsigned int*) (PLL1_BASE + 0x118) /*Divider-1*/
  54. #define PLL1_PLLDIV2 *(unsigned int*) (PLL1_BASE + 0x11C) /*Divider-2*/
  55. #define PLL1_PLLDIV3 *(unsigned int*) (PLL1_BASE + 0x120) /*Divider-3*/
  56. #define PLL1_OSCDIV1 *(unsigned int*) (PLL1_BASE + 0x124) /*Oscilator Divider*/
  57. #define PLL1_POSTDIV *(unsigned int*) (PLL1_BASE + 0x128) /*Post Divider*/
  58. #define PLL1_BPDIV *(unsigned int*) (PLL1_BASE + 0x12C) /*Bypass Divider*/
  59. #define PLL1_WAKEUP *(unsigned int*) (PLL1_BASE + 0x130) /*Wakeup Reg*/
  60. #define PLL1_PLLCMD *(unsigned int*) (PLL1_BASE + 0x138) /*Command Reg*/
  61. #define PLL1_PLLSTAT *(unsigned int*) (PLL1_BASE + 0x13C) /*Status Reg*/
  62. #define PLL1_ALNCTL *(unsigned int*) (PLL1_BASE + 0x140) /*Clock Align Control Reg*/
  63. #define PLL1_DCHANGE *(unsigned int*) (PLL1_BASE + 0x144) /*PLLDIV Ratio Chnage status*/
  64. #define PLL1_CKEN *(unsigned int*) (PLL1_BASE + 0x148) /*Clock Enable Reg*/
  65. #define PLL1_CKSTAT *(unsigned int*) (PLL1_BASE + 0x14C) /*Clock Status Reg*/
  66. #define PLL1_SYSTAT *(unsigned int*) (PLL1_BASE + 0x150) /*Sysclk status reg*/
  67. #define PLL1_PLLDIV4 *(unsigned int*) (PLL1_BASE + 0x160) /*Divider 4*/
  68. #define PLL1_PLLDIV5 *(unsigned int*) (PLL1_BASE + 0x164) /*Divider 5*/
  69. #define PLL1_PLLDIV6 *(unsigned int*) (PLL1_BASE + 0x168) /*Divider 6*/
  70. #define PLL1_PLLDIV7 *(unsigned int*) (PLL1_BASE + 0x16C) /*Divider 7*/
  71. #define PLL1_PLLDIV8 *(unsigned int*) (PLL1_BASE + 0x170) /*Divider 8*/
  72. #define PLL1_PLLDIV9 *(unsigned int*) (PLL1_BASE + 0x174) /*Divider 9*/
  73. #define PLL1_PLLDIV10 *(unsigned int*) (PLL1_BASE + 0x178) /*Divider 10*/
  74. #define PLL1_PLLDIV11 *(unsigned int*) (PLL1_BASE + 0x17C) /*Divider 11*/
  75. #define PLL1_PLLDIV12 *(unsigned int*) (PLL1_BASE + 0x180) /*Divider 12*/
  76. #define PLL1_PLLDIV13 *(unsigned int*) (PLL1_BASE + 0x184) /*Divider 13*/
  77. #define PLL1_PLLDIV14 *(unsigned int*) (PLL1_BASE + 0x188) /*Divider 14*/
  78. #define PLL1_PLLDIV15 *(unsigned int*) (PLL1_BASE + 0x18C) /*Divider 15*/
  79. #define PLL1_PLLDIV16 *(unsigned int*) (PLL1_BASE + 0x190) /*Divider 16*/
  80. /*PSC Module Related Registers*/
  81. #define PSC0_BASE 0x01C10000
  82. #define PSC1_BASE 0x01E27000
  83. #define PSC0_MDCTL (PSC0_BASE+0xA00)
  84. #define PSC0_MDSTAT (PSC0_BASE+0x800)
  85. #define PSC0_PTCMD *(unsigned int*) (PSC0_BASE + 0x120)
  86. #define PSC0_PTSTAT *(unsigned int*) (PSC0_BASE + 0x128)
  87. #define PSC1_MDCTL (PSC1_BASE+0xA00)
  88. #define PSC1_MDSTAT (PSC1_BASE+0x800)
  89. #define PSC1_PTCMD *(unsigned int*) (PSC1_BASE + 0x120)
  90. #define PSC1_PTSTAT *(unsigned int*) (PSC1_BASE + 0x128)
  91. #define PSC_TIMEOUT 200 // This value can be optimized by the user
  92. #define LPSC_EDMA_CC0 0
  93. #define LPSC_EDMA_TC0 1
  94. #define LPSC_EDMA_TC1 2
  95. #define LPSC_EMIFA 3 /*PSC0*/
  96. #define LPSC_SPI0 4 /*PSC0*/
  97. #define LPSC_MMCSD0 5 /*PSC0*/
  98. #define LPSC_ARM_AINTC 6
  99. #define LPSC_ARM_RAMROM 7 /*PSC0*/
  100. // LPSC #8 not used
  101. #define LPSC_UART0 9 /*PSC0*/
  102. #define LPSC_SCR0 10
  103. #define LPSC_SCR1 11
  104. #define LPSC_SCR2 12
  105. #define LPSC_PRU 13 /*PSC0*/
  106. #define LPSC_ARM 14 /*PSC0*/
  107. #define LPSC_DSP 15 /*PSC0*/
  108. #define LPSC_EDMA_CC1 0
  109. #define LPSC_USB20 1 /*PSC1*/
  110. #define LPSC_USB11 2 /*PSC1*/
  111. #define LPSC_GPIO 3 /*PSC1*/
  112. #define LPSC_UHPI 4 /*PSC1*/
  113. #define LPSC_EMAC 5 /*PSC1*/
  114. #define LPSC_DDR 6 /*PSC1*/
  115. #define LPSC_MCASP0 7 /*PSC1*/
  116. #define LPSC_SATA 8 /*PSC1*/
  117. #define LPSC_VPIF 9 /*PSC1*/
  118. #define LPSC_SPI1 10 /*PSC1*/
  119. #define LPSC_I2C1 11 /*PSC1*/
  120. #define LPSC_UART1 12 /*PSC1*/
  121. #define LPSC_UART2 13 /*PSC1*/
  122. #define LPSC_MCBSP0 14 /*PSC1*/
  123. #define LPSC_MCBSP1 15 /*PSC1*/
  124. #define LPSC_LCDC 16 /*PSC1*/
  125. #define LPSC_EPWM 17 /*PSC1*/
  126. #define LPSC_MMCSD1 18
  127. #define LPSC_UPP 19
  128. #define LPSC_ECAP 20
  129. #define LPSC_EDMA_TC2 21
  130. // LPSC #22-23 not used
  131. #define LPSC_SCR_F0 24
  132. #define LPSC_SCR_F1 25
  133. #define LPSC_SCR_F2 26
  134. #define LPSC_SCR_F6 27
  135. #define LPSC_SCR_F7 28
  136. #define LPSC_SCR_F8 29
  137. #define LPSC_BR_F7 30
  138. #define LPSC_SHARED_RAM 31
  139. /*DDR MMR Declaration*/
  140. #define VTPIO_CTL *(unsigned int*)(0x01E2C000) // VTPIO_CTL Register
  141. #define EMIFDDR_SDRAM_CFG 0xB0000000
  142. #define EMIFDDR_REVID *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x00) //EMIF Module ID and Revision Register
  143. #define EMIFDDR_SDRSTAT *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x04) //SDRAM Status Register
  144. #define EMIFDDR_SDCR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x08) //SDRAM Bank Config Register
  145. #define EMIFDDR_SDRCR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x0C) //SDRAM Refresh Control Register
  146. #define EMIFDDR_SDTIMR1 *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x10) //SDRAM Timing Register1
  147. #define EMIFDDR_SDTIMR2 *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x14) //SDRAM Timing Register2
  148. #define EMIFDDR_SDCR2 *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x1C) //SDRAM Config Register2
  149. #define EMIFDDR_PBBPR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x20) //VBUSM Burst Priority Register
  150. #define EMIFDDR_VBUSMCFG1 *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x28) //VBUSM config Value1 Register
  151. #define EMIFDDR_VBUSMCFG2 *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0x2C) //VBUSM config Value2 Register
  152. #define EMIFDDR_IRR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0xC0) //Interrupt Raw Register
  153. #define EMIFDDR_IMR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0xC4) //Interrupt Masked Register
  154. #define EMIFDDR_IMSR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0xC8) //Interrupt Mask Set Register
  155. #define EMIFDDR_IMCR *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0xCC) //Interrupt Mask Clear Register
  156. #define DDRPHYREV *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0xE0) //DDR PHY ID and Revision Register
  157. #define DRPYC1R *(unsigned int*)(EMIFDDR_SDRAM_CFG + 0xE4) //DDR PHY Control 1 Register
  158. #define DDR2 0 // Do not change this value
  159. #define MDDR 1 // Do not change this value
  160. #define VTP_TIMEOUT 200 // This value can be optimized by the user
  161. #define DDR_DEBUG 0 // Set this to "1" to program DDR with more timing slack
  162. #define EMIFDDR_BASE_ADDR 0xC0000000
  163. #define EMIFA_BASE_ADDR 0x40000000
  164. #define EMIFA_CS2_BASE_ADDR 0x60000000
  165. #define EMIFA_CS3_BASE_ADDR 0x62000000
  166. #define EMIFA_CS4_BASE_ADDR 0x64000000
  167. #define EMIFA_CS5_BASE_ADDR 0x66000000
  168. /*EMIF2.5 MMR Declaration*/
  169. #define EMIFA 0x68000000
  170. #define EMIFA_AWAITCFG *(unsigned int*)(EMIFA + 0x04)
  171. #define EMIFA_SDCFG *(unsigned int*)(EMIFA + 0x08)
  172. #define EMIFA_SDREF *(unsigned int*)(EMIFA + 0x0C)
  173. #define EMIFA_ACFG2 *(unsigned int*)(EMIFA + 0x10) //Async Bank1 Config Register
  174. #define EMIFA_ACFG3 *(unsigned int*)(EMIFA + 0x14) //Async Bank2 Config Register
  175. #define EMIFA_ACFG4 *(unsigned int*)(EMIFA + 0x18) //Async Bank3 Config Register
  176. #define EMIFA_ACFG5 *(unsigned int*)(EMIFA + 0x1C) //Async Bank4 Config Register
  177. #define EMIFA_SDTIM *(unsigned int*)(EMIFA + 0x20) //SDRAM Timing Register
  178. #define EMIFA_SRPD *(unsigned int*)(EMIFA + 0x3C)
  179. #define EMIFA_NANDFCR *(unsigned int*)(EMIFA + 0x60)
  180. /*GPIO MMR*/
  181. #define GPIO_REG_BASE (0x01E26000)
  182. #define GPIO_BANK_OFFSET (0x28)
  183. #define GPIO_DAT_OFFSET (0x04)
  184. #define GPIO_SET_OFFSET (0x08)
  185. #define GPIO_CLR_OFFSET (0x0C)
  186. #define GPIO_BINTEN *(unsigned int*)(GPIO_REG_BASE + 0x08)
  187. #define GPIO_BANK01_BASE (GPIO_REG_BASE + 0x10)
  188. #define GPIO_BANK23_BASE (GPIO_BANK01_BASE + GPIO_BANK_OFFSET)
  189. #define GPIO_BANK45_BASE (GPIO_BANK23_BASE + GPIO_BANK_OFFSET)
  190. #define GPIO_BANK67_BASE (GPIO_BANK45_BASE + GPIO_BANK_OFFSET)
  191. #define GPIO_BANK8_BASE (GPIO_BANK67_BASE + GPIO_BANK_OFFSET)
  192. #define GPIO_BANK23_DIR *(unsigned int*)(GPIO_BANK23_BASE)
  193. #define GPIO_BANK23_DAT *(unsigned int*)(GPIO_BANK23_BASE + GPIO_DAT_OFFSET)
  194. #define GPIO_BANK23_SET *(unsigned int*)(GPIO_BANK23_BASE + GPIO_SET_OFFSET)
  195. #define GPIO_BANK23_CLR *(unsigned int*)(GPIO_BANK23_BASE + GPIO_CLR_OFFSET)
  196. /*System MMR Declaration*/
  197. #define SYS_BASE 0x01C14000
  198. #define HOST0CFG *(unsigned int*)(SYS_BASE + 0x040) //ARM HOST0CFG
  199. #define KICK0R *(unsigned int*)(SYS_BASE + 0x038)
  200. #define KICK1R *(unsigned int*)(SYS_BASE + 0x03c)
  201. #define PINMUX0 *(unsigned int*)(SYS_BASE + 0x120) //PINMUX0
  202. #define PINMUX1 *(unsigned int*)(SYS_BASE + 0x124) //PINMUX1
  203. #define PINMUX2 *(unsigned int*)(SYS_BASE + 0x128) //PINMUX2
  204. #define PINMUX3 *(unsigned int*)(SYS_BASE + 0x12C) //PINMUX3
  205. #define PINMUX4 *(unsigned int*)(SYS_BASE + 0x130) //PINMUX4
  206. #define PINMUX5 *(unsigned int*)(SYS_BASE + 0x134) //PINMUX5
  207. #define PINMUX6 *(unsigned int*)(SYS_BASE + 0x138) //PINMUX6
  208. #define PINMUX7 *(unsigned int*)(SYS_BASE + 0x13C) //PINMUX7
  209. #define PINMUX8 *(unsigned int*)(SYS_BASE + 0x140) //PINMUX8
  210. #define PINMUX9 *(unsigned int*)(SYS_BASE + 0x144) //PINMUX9
  211. #define PINMUX10 *(unsigned int*)(SYS_BASE + 0x148) //PINMUX10
  212. #define PINMUX11 *(unsigned int*)(SYS_BASE + 0x14C) //PINMUX11
  213. #define PINMUX12 *(unsigned int*)(SYS_BASE + 0x150) //PINMUX12
  214. #define PINMUX13 *(unsigned int*)(SYS_BASE + 0x154) //PINMUX13
  215. #define PINMUX14 *(unsigned int*)(SYS_BASE + 0x158) //PINMUX14
  216. #define PINMUX15 *(unsigned int*)(SYS_BASE + 0x15C) //PINMUX15
  217. #define PINMUX16 *(unsigned int*)(SYS_BASE + 0x160) //PINMUX16
  218. #define PINMUX17 *(unsigned int*)(SYS_BASE + 0x164) //PINMUX17
  219. #define PINMUX18 *(unsigned int*)(SYS_BASE + 0x168) //PINMUX18
  220. #define PINMUX19 *(unsigned int*)(SYS_BASE + 0x16C) //PINMUX19
  221. #define CFGCHIP0 *(unsigned int*)(SYS_BASE + 0x17C)
  222. #define CFGCHIP2 *(unsigned int*)(SYS_BASE + 0x184)
  223. #define CFGCHIP3 *(unsigned int*)(SYS_BASE + 0x188)
  224. #define PD0 0 /*Power Domain-0*/
  225. #define PD1 1 /*Power Domain-1*/
  226. #define PLLEN_MUX_SWITCH 4
  227. #define PLL_LOCK_TIME_CNT 2400
  228. #define PLL_STABILIZATION_TIME 2000
  229. #define PLL_RESET_TIME_CNT 200
  230. OnTargetConnect( )
  231. {
  232. GEL_TextOut("\tTarget Connected.\n","Output",1,1,1);
  233. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  234. CPU_PLL_PSC_DDR_Init();
  235. }
  236. menuitem "Initiation"
  237. hotmenu CPU_PLL_PSC_DDR_Init()
  238. {
  239. Clear_Memory_Map();
  240. Setup_Memory_Map();
  241. PSC_All_On();
  242. Core_456MHz_DDR2_156MHz();
  243. Wake_DSP();
  244. Wake_PRU();
  245. }
  246. Wake_DSP()
  247. {
  248. PSC0_LPSC_enableCore(1, LPSC_DSP);
  249. GEL_TextOut("\tDSP Wake Complete.(Only For OMAPL138)\n","Output",1,1,1);
  250. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  251. }
  252. Wake_PRU()
  253. {
  254. PSC0_LPSC_enableCore(0, LPSC_PRU);
  255. GEL_TextOut("\tPRU Wake Complete.\n","Output",1,1,1);
  256. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  257. }
  258. Clear_Memory_Map()
  259. {
  260. GEL_MapOff( );
  261. GEL_MapReset( );
  262. GEL_TextOut("\tMemory Map Cleared.\n","Output",1,1,1);
  263. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  264. }
  265. Setup_Memory_Map()
  266. {
  267. GEL_MapOn( );
  268. GEL_MapReset( );
  269. /* PRU */
  270. GEL_MapAddStr( 0x00000000, 0, 0x00000FFF, "R|W|AS4", 0 ); // PRUSS Local Address Space
  271. GEL_MapAddStr( 0x01C30000, 0, 0x01C301FF, "R|W|AS4", 0 ); // Data RAM 0
  272. GEL_MapAddStr( 0x01C32000, 0, 0x01C321FF, "R|W|AS4", 0 ); // Data RAM 1
  273. GEL_MapAddStr( 0x01C34000, 0, 0x01C36FFF, "R|W|AS4", 0 ); // INTC Registers
  274. GEL_MapAddStr( 0x01C37000, 0, 0x01C377FF, "R|W|AS4", 0 ); // PRU0 Registers
  275. GEL_MapAddStr( 0x01C37800, 0, 0x01C37FFF, "R|W|AS4", 0 ); // PRU1 Registers
  276. GEL_MapAddStr( 0x01C38000, 0, 0x01C38FFF, "R|W|AS4", 0 ); // PRU0 Instruction RAM
  277. GEL_MapAddStr( 0x01C3C000, 0, 0x01C3CFFF, "R|W|AS4", 0 ); // PRU1 Instruction RAM
  278. /* ARM */
  279. GEL_MapAddStr( 0xFFFD0000, 0, 0x00010000, "R|W|AS4", 0 ); // ARM Local ROM
  280. GEL_MapAddStr( 0xFFFEE000, 0, 0x00001000, "R|W|AS4", 0 ); // ARM INTC
  281. GEL_MapAddStr( 0xFFFF0000, 0, 0x00002000, "R|W|AS4", 0 ); // ARM Local RAM
  282. GEL_MapAddStr( 0x01BC0000, 0, 0x00001000, "R|W|AS4", 0 ); // ARM ETB Memory
  283. GEL_MapAddStr( 0x01BC1000, 0, 0x00000800, "R|W|AS4", 0 ); // ARM ETB Regs
  284. GEL_MapAddStr( 0x01BC1800, 0, 0x00000100, "R|W|AS4", 0 ); // ARM Ice Crusher
  285. /* DSP */
  286. GEL_MapAddStr( 0x00700000, 0, 0x00100000, "R|W|AS4", 0 ); // DSP L2 ROM
  287. GEL_MapAddStr( 0x00800000, 0, 0x00040000, "R|W|AS4", 0 ); // DSP l2 RAM
  288. GEL_MapAddStr( 0x00E00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1P RAM
  289. GEL_MapAddStr( 0x00F00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1D RAM
  290. GEL_MapAddStr( 0x01800000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP Interrupt Controller
  291. GEL_MapAddStr( 0x01810000, 0, 0x00001000, "R|W|AS4", 0 ); // DSP Powerdown Controller
  292. GEL_MapAddStr( 0x01811000, 0, 0x00001000, "R|W|AS4", 0 ); // DSP Security ID
  293. GEL_MapAddStr( 0x01812000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP Revision ID
  294. GEL_MapAddStr( 0x01820000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP EMC
  295. GEL_MapAddStr( 0x01830000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP Internal Reserved
  296. GEL_MapAddStr( 0x01840000, 0, 0x00010000, "R|W|AS4", 0 ); // DSP Memory System
  297. GEL_MapAddStr( 0x11700000, 0, 0x00100000, "R|W|AS4", 0 ); // DSP L2 ROM (mirror)
  298. GEL_MapAddStr( 0x11800000, 0, 0x00040000, "R|W|AS4", 0 ); // DSP l2 RAM (mirror)
  299. GEL_MapAddStr( 0x11E00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1P RAM (mirror)
  300. GEL_MapAddStr( 0x11F00000, 0, 0x00008000, "R|W|AS4", 0 ); // DSP L1D RAM (mirror)
  301. /* Shared RAM */
  302. GEL_MapAddStr( 0x80000000, 0, 0x00020000, "R|W|AS4", 0 ); // Shared RAM
  303. /* EMIFA */
  304. GEL_MapAddStr( 0x40000000, 0, 0x20000000, "R|W|AS4", 0 ); // EMIFA SDRAM Data
  305. GEL_MapAddStr( 0x60000000, 0, 0x02000000, "R|W|AS4", 0 ); // EMIFA CS2
  306. GEL_MapAddStr( 0x62000000, 0, 0x02000000, "R|W|AS4", 0 ); // EMIFA CS3
  307. GEL_MapAddStr( 0x64000000, 0, 0x02000000, "R|W|AS4", 0 ); // EMIFA CS4
  308. GEL_MapAddStr( 0x66000000, 0, 0x02000000, "R|W|AS4", 0 ); // EMIFA CS5
  309. GEL_MapAddStr( 0x68000000, 0, 0x00008000, "R|W|AS4", 0 ); // EMIFA Control
  310. /* DDR */
  311. GEL_MapAddStr( 0xB0000000, 0, 0x00008000, "R|W|AS4", 0 ); // DDR Control
  312. GEL_MapAddStr( 0xC0000000, 0, 0x20000000, "R|W|AS4", 0 ); // DDR Data
  313. /* Peripherals */
  314. GEL_MapAddStr( 0x01C00000, 0, 0x00008000, "R|W|AS4", 0 ); // TPCC0
  315. GEL_MapAddStr( 0x01C08000, 0, 0x00000400, "R|W|AS4", 0 ); // TPTC0
  316. GEL_MapAddStr( 0x01C08400, 0, 0x00000400, "R|W|AS4", 0 ); // TPTC1
  317. GEL_MapAddStr( 0x01C10000, 0, 0x00001000, "R|W|AS4", 0 ); // PSC 0
  318. GEL_MapAddStr( 0x01C11000, 0, 0x00001000, "R|W|AS4", 0 ); // PLL Controller 0
  319. GEL_MapAddStr( 0x01C12000, 0, 0x00001000, "R|W|AS4", 0 ); // Key Manager
  320. GEL_MapAddStr( 0x01C13000, 0, 0x00001000, "R|W|AS4", 0 ); // SecCo
  321. GEL_MapAddStr( 0x01C14000, 0, 0x00001000, "R|W|AS4", 0 ); // SysConfig
  322. GEL_MapAddStr( 0x01C16000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 0
  323. GEL_MapAddStr( 0x01C17000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 2
  324. GEL_MapAddStr( 0x01C20000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer64P 0
  325. GEL_MapAddStr( 0x01C21000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer64P 1
  326. GEL_MapAddStr( 0x01C22000, 0, 0x00001000, "R|W|AS4", 0 ); // I2C 0
  327. GEL_MapAddStr( 0x01C23000, 0, 0x00001000, "R|W|AS4", 0 ); // RTC
  328. GEL_MapAddStr( 0x01C24000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 1
  329. GEL_MapAddStr( 0x01C30000, 0, 0x00000200, "R|W|AS4", 0 ); // PRU Data RAM 0
  330. GEL_MapAddStr( 0x01C32000, 0, 0x00000200, "R|W|AS4", 0 ); // PRU Data RAM 1
  331. GEL_MapAddStr( 0x01C34000, 0, 0x00004000, "R|W|AS4", 0 ); // PRU Control Registers
  332. GEL_MapAddStr( 0x01C38000, 0, 0x00001000, "R|W|AS4", 0 ); // PRU 0 Config Memory
  333. GEL_MapAddStr( 0x01C3C000, 0, 0x00001000, "R|W|AS4", 0 ); // PRU 1 Config Memory
  334. GEL_MapAddStr( 0x01C40000, 0, 0x00001000, "R|W|AS4", 0 ); // MMC/SD 0
  335. GEL_MapAddStr( 0x01C41000, 0, 0x00001000, "R|W|AS4", 0 ); // SPI 0
  336. GEL_MapAddStr( 0x01C42000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 0
  337. GEL_MapAddStr( 0x01C43000, 0, 0x00001000, "R|W|AS4", 0 ); // MPU 0
  338. GEL_MapAddStr( 0x01D00000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 0 Control
  339. GEL_MapAddStr( 0x01D01000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 0 FIFO Ctrl
  340. GEL_MapAddStr( 0x01D02000, 0, 0x00001000, "R|W|AS4", 0 ); // McASP 0 Data
  341. GEL_MapAddStr( 0x01D0C000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 1
  342. GEL_MapAddStr( 0x01D0D000, 0, 0x00001000, "R|W|AS4", 0 ); // UART 2
  343. GEL_MapAddStr( 0x01D0E000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 4
  344. GEL_MapAddStr( 0x01D10000, 0, 0x00000800, "R|W|AS4", 0 ); // McBSP 0 Control
  345. GEL_MapAddStr( 0x01D10800, 0, 0x00000200, "R|W|AS4", 0 ); // McBSP 0 FIFO Ctrl
  346. GEL_MapAddStr( 0x01D11000, 0, 0x00000800, "R|W|AS4", 0 ); // McBSP 1 Control
  347. GEL_MapAddStr( 0x01D11800, 0, 0x00000200, "R|W|AS4", 0 ); // McBSP 1 FIFO Ctrl
  348. GEL_MapAddStr( 0x01E00000, 0, 0x00010000, "R|W|AS4", 0 ); // USB0 (USB HS) Cfg
  349. GEL_MapAddStr( 0x01E10000, 0, 0x00001000, "R|W|AS4", 0 ); // UHPI Cfg
  350. GEL_MapAddStr( 0x01E11000, 0, 0x00001000, "R|W|AS4", 0 ); // UHPI (IODFT)
  351. GEL_MapAddStr( 0x01E13000, 0, 0x00001000, "R|W|AS4", 0 ); // LCD Controller
  352. GEL_MapAddStr( 0x01E14000, 0, 0x00001000, "R|W|AS4", 0 ); // MPU 1
  353. GEL_MapAddStr( 0x01E15000, 0, 0x00001000, "R|W|AS4", 0 ); // MPU 2
  354. GEL_MapAddStr( 0x01E16000, 0, 0x00001000, "R|W|AS4", 0 ); // UPP
  355. GEL_MapAddStr( 0x01E17000, 0, 0x00001000, "R|W|AS4", 0 ); // VPIF
  356. GEL_MapAddStr( 0x01E18000, 0, 0x00002000, "R|W|AS4", 0 ); // SATA
  357. GEL_MapAddStr( 0x01E1A000, 0, 0x00001000, "R|W|AS4", 0 ); // PLL Controller 1
  358. GEL_MapAddStr( 0x01E1B000, 0, 0x00001000, "R|W|AS4", 0 ); // MMC/SD 1
  359. GEL_MapAddStr( 0x01E20000, 0, 0x00002000, "R|W|AS4", 0 ); // EMAC CPPI
  360. GEL_MapAddStr( 0x01E22000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC CONTROL registers
  361. GEL_MapAddStr( 0x01E23000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC registers
  362. GEL_MapAddStr( 0x01E24000, 0, 0x00001000, "R|W|AS4", 0 ); // EMAC MDIO port
  363. GEL_MapAddStr( 0x01E25000, 0, 0x00001000, "R|W|AS4", 0 ); // USB1 (USB FS)
  364. GEL_MapAddStr( 0x01E26000, 0, 0x00001000, "R|W|AS4", 0 ); // GPIO
  365. GEL_MapAddStr( 0x01E27000, 0, 0x00001000, "R|W|AS4", 0 ); // PSC 1
  366. GEL_MapAddStr( 0x01E28000, 0, 0x00001000, "R|W|AS4", 0 ); // I2C 1
  367. GEL_MapAddStr( 0x01E29000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 3
  368. GEL_MapAddStr( 0x01E2A000, 0, 0x00001000, "R|W|AS4", 0 ); // PBIST Controller
  369. GEL_MapAddStr( 0x01E2B000, 0, 0x00001000, "R|W|AS4", 0 ); // PBIST Combiner
  370. GEL_MapAddStr( 0x01E2C000, 0, 0x00001000, "R|W|AS4", 0 ); // System Config
  371. GEL_MapAddStr( 0x01E30000, 0, 0x00008000, "R|W|AS4", 0 ); // TPCC1
  372. GEL_MapAddStr( 0x01E38000, 0, 0x00000400, "R|W|AS4", 0 ); // TPTC2
  373. GEL_MapAddStr( 0x01F00000, 0, 0x00001000, "R|W|AS4", 0 ); // EPWM 0
  374. GEL_MapAddStr( 0x01F01000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 0
  375. GEL_MapAddStr( 0x01F02000, 0, 0x00001000, "R|W|AS4", 0 ); // EPWM 1
  376. GEL_MapAddStr( 0x01F03000, 0, 0x00001000, "R|W|AS4", 0 ); // HRPWM 1
  377. GEL_MapAddStr( 0x01F06000, 0, 0x00001000, "R|W|AS4", 0 ); // ECAP 0
  378. GEL_MapAddStr( 0x01F07000, 0, 0x00001000, "R|W|AS4", 0 ); // ECAP 1
  379. GEL_MapAddStr( 0x01F08000, 0, 0x00001000, "R|W|AS4", 0 ); // ECAP 2
  380. GEL_MapAddStr( 0x01F0B000, 0, 0x00001000, "R|W|AS4", 0 ); // IOPU 5
  381. GEL_MapAddStr( 0x01F0C000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer64P 2
  382. GEL_MapAddStr( 0x01F0D000, 0, 0x00001000, "R|W|AS4", 0 ); // Timer64P 3
  383. GEL_MapAddStr( 0x01F0E000, 0, 0x00001000, "R|W|AS4", 0 ); // SPI1
  384. GEL_MapAddStr( 0x01F10000, 0, 0x00001000, "R|W|AS4", 0 ); // McBSP 0 FIFO Data
  385. GEL_MapAddStr( 0x01F11000, 0, 0x00001000, "R|W|AS4", 0 ); // McBSP 1 FIFO Data
  386. GEL_TextOut("\tMemory Map Setup Complete.\n","Output",1,1,1);
  387. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  388. }
  389. Set_Core_456MHz() {
  390. device_PLL0(0,18,0,0,1,3,9);
  391. GEL_TextOut("\tPLL0 init done for Core:456MHz, EMIFA:114MHz\n","Output",1,1,1);
  392. }
  393. Set_DDRPLL_156MHz() {
  394. device_PLL1(12,0,0,1,2);
  395. GEL_TextOut("\tPLL1 init done for DDR:156MHz\n","Output",1,1,1);
  396. }
  397. Set_DDR2_156MHz() {
  398. GEL_TextOut("\tDDR initialization is in progress....\n","Output",1,1,1);
  399. Set_DDRPLL_156MHz();
  400. DEVICE_DDRConfig();
  401. GEL_TextOut("\tDDR2 init for 156 MHz is done\n","Output",1,1,1);
  402. }
  403. Core_456MHz_DDR2_156MHz() {
  404. Set_Core_456MHz();
  405. Set_DDR2_156MHz();
  406. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  407. }
  408. PSC_All_On() {
  409. // PSC0
  410. PSC0_LPSC_enable(0, LPSC_EDMA_CC0);
  411. PSC0_LPSC_enable(0, LPSC_EDMA_TC0);
  412. PSC0_LPSC_enable(0, LPSC_EDMA_TC1);
  413. PSC0_LPSC_enable(0, LPSC_EMIFA);
  414. PSC0_LPSC_enable(0, LPSC_SPI0);
  415. PSC0_LPSC_enable(0, LPSC_MMCSD0);
  416. PSC0_LPSC_enable(0, LPSC_ARM_AINTC);
  417. PSC0_LPSC_enable(0, LPSC_ARM_RAMROM);
  418. PSC0_LPSC_enable(0, LPSC_UART0);
  419. PSC0_LPSC_enable(0, LPSC_SCR0);
  420. PSC0_LPSC_enable(0, LPSC_SCR1);
  421. PSC0_LPSC_enable(0, LPSC_SCR2);
  422. // PSC1
  423. PSC1_LPSC_enable(0, LPSC_EDMA_CC1);
  424. PSC1_LPSC_enable(0, LPSC_USB20);
  425. PSC1_LPSC_enable(0, LPSC_USB11);
  426. CFGCHIP2 = 0x09F2; //Enable USB clock, PHY_PLLON, glue logic mux(USB2 ref clk input)
  427. PSC1_LPSC_enable(0, LPSC_GPIO);
  428. PSC1_LPSC_enable(0, LPSC_UHPI);
  429. PSC1_LPSC_enable(0, LPSC_EMAC);
  430. PSC1_LPSC_enable(0, LPSC_MCASP0);
  431. PSC1_LPSC_force(LPSC_SATA);
  432. PSC1_LPSC_enable(0, LPSC_SATA);
  433. PSC1_LPSC_enable(0, LPSC_VPIF);
  434. PSC1_LPSC_enable(0, LPSC_SPI1);
  435. PSC1_LPSC_enable(0, LPSC_I2C1);
  436. PSC1_LPSC_enable(0, LPSC_UART1);
  437. PSC1_LPSC_enable(0, LPSC_UART2);
  438. PSC1_LPSC_enable(0, LPSC_MCBSP0);
  439. PSC1_LPSC_enable(0, LPSC_MCBSP1);
  440. PSC1_LPSC_enable(0, LPSC_LCDC);
  441. PSC1_LPSC_enable(0, LPSC_EPWM);
  442. PSC1_LPSC_enable(0, LPSC_MMCSD1);
  443. PSC1_LPSC_enable(0, LPSC_UPP);
  444. PSC1_LPSC_enable(0, LPSC_ECAP);
  445. PSC1_LPSC_enable(0, LPSC_EDMA_TC2);
  446. PSC1_LPSC_enable(0, LPSC_SCR_F0);
  447. PSC1_LPSC_enable(0, LPSC_SCR_F1);
  448. PSC1_LPSC_enable(0, LPSC_SCR_F2);
  449. PSC1_LPSC_enable(0, LPSC_SCR_F6);
  450. PSC1_LPSC_enable(0, LPSC_SCR_F7);
  451. PSC1_LPSC_enable(0, LPSC_SCR_F8);
  452. PSC1_LPSC_enable(0, LPSC_BR_F7);
  453. PSC1_LPSC_enable(0, LPSC_SHARED_RAM);
  454. GEL_TextOut("\tPSC Enable Complete.\n","Output",1,1,1);
  455. GEL_TextOut("\t---------------------------------------------\n","Output",1,1,1);
  456. }
  457. /**************************************************************************************************************************************************
  458. Device_PLL0 init:
  459. CLKMODE - 0---->On Chip Oscilator 1---->External Oscilator
  460. PLL0_SYSCLK1 - Fixed ratio /1
  461. PLL0_SYSCLK2 - Fixed ratio /2
  462. PLL0_SYSCLK3 - Variable Divider (EMIFA)
  463. PLL0_SYSCLK4 - Fixed ratio /4
  464. PLL0_SYSCLK5 - Not used -- do nothing
  465. PLL0_SYSCLK6 - Fixed ratio /1
  466. PLL0_SYSCLK7 - Variable Divider (RMII)
  467. ******************************************************************************************************************************************************/
  468. device_PLL0(unsigned int CLKMODE, unsigned int PLLM, unsigned int POSTDIV,unsigned int PLLDIV1, unsigned int PLLDIV2, unsigned int PLLDIV3, unsigned int PLLDIV7 ) {
  469. unsigned int i=0;
  470. /* Clear PLL lock bit */
  471. CFGCHIP0 &= ~(0x00000010);
  472. /* Set PLLENSRC '0',bit 5, PLL Enable(PLLEN) selection is controlled through MMR */
  473. PLL0_PLLCTL &= ~(0x00000020);
  474. /* PLLCTL.EXTCLKSRC bit 9 should be left at 0 for Freon */
  475. PLL0_PLLCTL &= ~(0x00000200);
  476. /* Set PLLEN=0 to put in bypass mode*/
  477. PLL0_PLLCTL &= ~(0x00000001);
  478. /*wait for 4 cycles to allow PLLEN mux switches properly to bypass clock*/
  479. for(i=0; i<PLLEN_MUX_SWITCH; i++) {;}
  480. /* Select the Clock Mode bit 8 as External Clock or On Chip Oscilator*/
  481. PLL0_PLLCTL &= 0xFFFFFEFF;
  482. PLL0_PLLCTL |= (CLKMODE << 8);
  483. /*Clear PLLRST bit to reset the PLL */
  484. PLL0_PLLCTL &= ~(0x00000008);
  485. /* Disable the PLL output*/
  486. PLL0_PLLCTL |= (0x00000010);
  487. /* PLL initialization sequence
  488. Power up the PLL by setting PWRDN bit set to 0 */
  489. PLL0_PLLCTL &= ~(0x00000002);
  490. /* Enable the PLL output*/
  491. PLL0_PLLCTL &= ~(0x00000010);
  492. /*PLL stabilisation time- take out this step , not required here when PLL in bypassmode*/
  493. for(i=0; i<PLL_STABILIZATION_TIME; i++) {;}
  494. /*Program the required multiplier value in PLLM*/
  495. PLL0_PLLM = PLLM;
  496. /*If desired to scale all the SYSCLK frequencies of a given PLLC, program the POSTDIV ratio*/
  497. PLL0_POSTDIV = 0x8000 | POSTDIV;
  498. /*Check for the GOSTAT bit in PLLSTAT to clear to 0 to indicate that no GO operation is currently in progress*/
  499. while(PLL0_PLLSTAT & 0x1==1){}
  500. /*Program the RATIO field in PLLDIVx with the desired divide factors. In addition, make sure in this step you leave the PLLDIVx.DxEN bits set so clocks are still enabled (default).*/
  501. PLL0_PLLDIV1 = 0x8000 | PLLDIV1; // Fixed Ratio /1
  502. PLL0_PLLDIV2 = 0x8000 | PLLDIV2; // Fixed Ratio /2
  503. PLL0_PLLDIV4 = 0x8000 | (((PLLDIV1+1)*4)-1); // Fixed Ratio /4
  504. PLL0_PLLDIV6 = 0x8000 | PLLDIV1; // Fixed Ratio /1
  505. PLL0_PLLDIV3 = 0x8000 | PLLDIV3; // Variable Ratio (EMIF)
  506. PLL0_PLLDIV7 = 0x8000 | PLLDIV7; // Variable Ratio (RMII)
  507. /*Set the GOSET bit in PLLCMD to 1 to initiate a new divider transition.*/
  508. PLL0_PLLCMD |= 0x1;
  509. /*Wait for the GOSTAT bit in PLLSTAT to clear to 0 (completion of phase alignment).*/
  510. while(PLL0_PLLSTAT & 0x1==1) { }
  511. /*Wait for PLL to reset properly.*/
  512. for(i=0; i<PLL_RESET_TIME_CNT; i++) {;}
  513. /*Set the PLLRST bit in PLLCTL to 1 to bring the PLL out of reset*/
  514. PLL0_PLLCTL |= 0x8;
  515. /*Wait for PLL to lock.*/
  516. for(i=0; i<PLL_LOCK_TIME_CNT; i++) {;}
  517. /*Set the PLLEN bit in PLLCTL to 1 to remove the PLL from bypass mode*/
  518. PLL0_PLLCTL |= 0x1;
  519. }
  520. /**********************************************************************************
  521. DDR PLL1 init:
  522. ***********************************************************************************/
  523. device_PLL1(unsigned int PLLM,unsigned int POSTDIV,unsigned int PLLDIV1, unsigned int PLLDIV2, unsigned int PLLDIV3 ) {
  524. unsigned int i=0;
  525. /* Clear PLL lock bit */
  526. CFGCHIP3 &= ~(0x00000020);
  527. /* Set PLLENSRC '0',bit 5, PLL Enable(PLLEN) selection is controlled through MMR */
  528. PLL1_PLLCTL &= ~(0x00000020);
  529. /* PLLCTL.EXTCLKSRC bit 9 should be left at 0 for Freon */
  530. PLL1_PLLCTL &= ~(0x00000200);
  531. /* Set PLLEN=0 to put in bypass mode*/
  532. PLL1_PLLCTL &= ~(0x00000001);
  533. /*wait for 4 cycles to allow PLLEN mux switches properly to bypass clock*/
  534. for(i=0; i<PLLEN_MUX_SWITCH; i++) {;}
  535. /*Clear PLLRST bit to reset the PLL */
  536. PLL1_PLLCTL &= ~(0x00000008);
  537. /* Disable the PLL output*/
  538. PLL1_PLLCTL |= (0x00000010);
  539. /* PLL initialization sequence
  540. Power up the PLL by setting PWRDN bit set to 0 */
  541. PLL1_PLLCTL &= ~(0x00000002);
  542. /* Enable the PLL output*/
  543. PLL1_PLLCTL &= ~(0x00000010);
  544. /*PLL stabilisation time- take out this step , not required here when PLL in bypassmode*/
  545. for(i=0; i<PLL_STABILIZATION_TIME; i++) {;}
  546. /*Program the required multiplier value in PLLM*/
  547. PLL1_PLLM = PLLM;
  548. /*If desired to scale all the SYSCLK frequencies of a given PLLC, program the POSTDIV ratio*/
  549. PLL1_POSTDIV = 0x8000 | POSTDIV;
  550. /*Check for the GOSTAT bit in PLLSTAT to clear to 0 to indicate that no GO operation is currently in progress*/
  551. while(PLL1_PLLSTAT & 0x1==1){}
  552. /*Program the RATIO field in PLLDIVx with the desired divide factors. In addition, make sure in this step you leave the PLLDIVx.DxEN bits set so clocks are still enabled (default).*/
  553. PLL1_PLLDIV1 = 0x8000 | PLLDIV1; // DDR frequency (aka 2X_CLK)
  554. PLL1_PLLDIV2 = 0x8000 | PLLDIV2; // Optional CFGCHIP3[ASYNC3_CLKSRC] clock source
  555. PLL1_PLLDIV3 = 0x8000 | PLLDIV3; // Optional PLL0 clock source
  556. /*Set the GOSET bit in PLLCMD to 1 to initiate a new divider transition.*/
  557. PLL1_PLLCMD |= 0x1;
  558. /*Wait for the GOSTAT bit in PLLSTAT to clear to 0 (completion of phase alignment).*/
  559. while(PLL1_PLLSTAT & 0x1==1) { }
  560. /*Wait for PLL to reset properly */
  561. for(i=0; i<PLL_RESET_TIME_CNT; i++) {;}
  562. /*Set the PLLRST bit in PLLCTL to 1 to bring the PLL out of reset*/
  563. PLL1_PLLCTL |= 0x8;
  564. /*Wait for PLL to lock. See PLL spec for PLL lock time*/
  565. for(i=0; i<PLL_LOCK_TIME_CNT; i++) {;}
  566. /*Set the PLLEN bit in PLLCTL to 1 to remove the PLL from bypass mode*/
  567. PLL1_PLLCTL |= 0x1;
  568. }
  569. /**********************************************************************************
  570. PSC Common functions :
  571. ***********************************************************************************/
  572. /*Force module state without handshaking */
  573. PSC1_LPSC_force(unsigned int LPSC_num) {
  574. *(unsigned int*) (PSC1_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC1_MDCTL+4*LPSC_num) | 0x80000000);
  575. }
  576. /*SyncReset Function for PSC1*/
  577. PSC1_LPSC_SyncReset(unsigned int PD, unsigned int LPSC_num) {
  578. unsigned int j;
  579. if( (*(unsigned int*)(PSC1_MDSTAT+4 * LPSC_num) & 0x1F) != 0x1 ) {
  580. *(unsigned int*) (PSC1_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC1_MDCTL+4*LPSC_num) & 0xFFFFFFE0) | 0x0001;
  581. PSC1_PTCMD = 0x1<<PD;
  582. j = 0;
  583. /*Wait for power state transition to finish*/
  584. while( (PSC1_PTSTAT & (0x1<<PD) ) !=0) {
  585. if( j++ > PSC_TIMEOUT ) {
  586. GEL_TextOut("\tPSC1 Sync Reset Transition Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  587. break;
  588. }
  589. }
  590. j = 0;
  591. while( (*(unsigned int*)(PSC1_MDSTAT+4 * LPSC_num) & 0x1F) !=0x1) {
  592. if( j++ > PSC_TIMEOUT ) {
  593. GEL_TextOut("\tPSC1 Sync Reset Verify Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  594. break;
  595. }
  596. }
  597. }
  598. }
  599. /*Enable Function for PSC1*/
  600. PSC1_LPSC_enable(unsigned int PD, unsigned int LPSC_num) {
  601. unsigned int j;
  602. if( (*(unsigned int*)(PSC1_MDSTAT+4 * LPSC_num) & 0x1F) != 0x3 ) {
  603. *(unsigned int*) (PSC1_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC1_MDCTL+4*LPSC_num) & 0xFFFFFFE0) | 0x0003;
  604. PSC1_PTCMD = 0x1<<PD;
  605. j = 0;
  606. /*Wait for power state transition to finish*/
  607. while( (PSC1_PTSTAT & (0x1<<PD) ) !=0) {
  608. if( j++ > PSC_TIMEOUT ) {
  609. GEL_TextOut("\tPSC1 Enable Transition Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  610. break;
  611. }
  612. }
  613. j = 0;
  614. while( (*(unsigned int*)(PSC1_MDSTAT+4 * LPSC_num) & 0x1F) !=0x3) {
  615. if( j++ > PSC_TIMEOUT ) {
  616. GEL_TextOut("\tPSC1 Enable Verify Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  617. break;
  618. }
  619. }
  620. }
  621. }
  622. /*LPSC Enable Function for ARM or DSP*/
  623. PSC0_LPSC_enableCore(unsigned int PD, unsigned int LPSC_num) {
  624. unsigned int j;
  625. if( (*(unsigned int*)(PSC0_MDSTAT+4 * LPSC_num) & 0x11F) != 0x103 ) {
  626. *(unsigned int*) (PSC0_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC0_MDCTL+4*LPSC_num) & 0xFFFFFEE0) | 0x0103;
  627. PSC0_PTCMD = 0x1<<PD;
  628. j = 0;
  629. /*Wait for power state transition to finish*/
  630. while( (PSC0_PTSTAT & (0x1<<PD) ) !=0) {
  631. if( j++ > PSC_TIMEOUT ) {
  632. GEL_TextOut("\tPSC0 Enable Core Transition Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  633. break;
  634. }
  635. }
  636. j = 0;
  637. while( (*(unsigned int*)(PSC0_MDSTAT+4 * LPSC_num) & 0x11F) !=0x103) {
  638. if( j++ > PSC_TIMEOUT ) {
  639. GEL_TextOut("\tPSC0 Enable Core Verify Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  640. break;
  641. }
  642. }
  643. }
  644. }
  645. /*SyncReset Function for PSC0*/
  646. PSC0_LPSC_SyncReset(unsigned int PD, unsigned int LPSC_num) {
  647. unsigned int j;
  648. if( (*(unsigned int*)(PSC0_MDSTAT+4 * LPSC_num) & 0x1F) != 0x1 ) {
  649. *(unsigned int*) (PSC0_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC0_MDCTL+4*LPSC_num) & 0xFFFFFFE0) | 0x0001;
  650. PSC0_PTCMD = 0x1<<PD;
  651. j = 0;
  652. /*Wait for power state transition to finish*/
  653. while( (PSC0_PTSTAT & (0x1<<PD) ) !=0) {
  654. if( j++ > PSC_TIMEOUT ) {
  655. GEL_TextOut("\tPSC0 Sync Reset Transition Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  656. break;
  657. }
  658. }
  659. j = 0;
  660. while( (*(unsigned int*)(PSC0_MDSTAT+4 * LPSC_num) & 0x1F) !=0x1) {
  661. if( j++ > PSC_TIMEOUT ) {
  662. GEL_TextOut("\tPSC0 Sync Reset Verify Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  663. break;
  664. }
  665. }
  666. }
  667. }
  668. /*Enable Function for PSC0*/
  669. PSC0_LPSC_enable(unsigned int PD, unsigned int LPSC_num) {
  670. unsigned int j;
  671. if( (*(unsigned int*)(PSC0_MDSTAT+4 * LPSC_num) & 0x1F) != 0x3 ) {
  672. *(unsigned int*) (PSC0_MDCTL+4*LPSC_num) = (*(unsigned int*) (PSC0_MDCTL+4*LPSC_num) & 0xFFFFFFE0) | 0x0003;
  673. PSC0_PTCMD = 0x1<<PD;
  674. j = 0;
  675. /*Wait for power state transition to finish*/
  676. while( (PSC0_PTSTAT & (0x1<<PD) ) !=0) {
  677. if( j++ > PSC_TIMEOUT ) {
  678. GEL_TextOut("\tPSC0 Enable Transition Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  679. break;
  680. }
  681. }
  682. j = 0;
  683. while( (*(unsigned int*)(PSC0_MDSTAT+4 * LPSC_num) & 0x1F) !=0x3) {
  684. if( j++ > PSC_TIMEOUT ) {
  685. GEL_TextOut("\tPSC0 Enable Verify Timeout on Domain %d, LPSC %d\n","Output",1,1,1,PD,LPSC_num);
  686. break;
  687. }
  688. }
  689. }
  690. }
  691. /**********************************************************************************
  692. DDR Configuration routine:
  693. 1. DDR Enable
  694. 2. VTP calibration
  695. 3. Configure DDR
  696. 4. Set to self-refresh, enable mclkstop and DDR Sync Reset
  697. 5. Enable DDR and disable self-refresh
  698. int freq is MHz
  699. DDR2 = 0
  700. MDDR = 1
  701. A DDR configuration spreadsheet tool is located here:
  702. http://processors.wiki.ti.com/index.php/Programming_mDDR/DDR2_EMIF_on_OMAP-L1x/C674x
  703. ***********************************************************************************/
  704. // 0xB000 0008 SDCR 0x00134632
  705. // 0xB000 000C SDRCR 0xC0000260
  706. // 0xB000 0010 SDTIMR1 0x264A2A09
  707. // 0xB000 0014 SDTIMR2 0x4412C722
  708. // 0xB000 001C SDCR2 0x00000000
  709. // 0xB000 00E4 DRPYC1R 0x000000C3
  710. DEVICE_DDRConfig()
  711. {
  712. unsigned int j;
  713. unsigned int tmp_SDCR;
  714. // Enable the Clock to EMIFDDR SDRAM
  715. PSC1_LPSC_enable(PD0, LPSC_DDR);
  716. // Begin VTP Calibration
  717. VTPIO_CTL &= ~0x00000040; // Clear POWERDN
  718. VTPIO_CTL &= ~0x00000080; // Clear LOCK
  719. VTPIO_CTL |= 0x00002000; // Set CLKRZ in case it was cleared before (VTP looks for CLKRZ edge transition)
  720. VTPIO_CTL &= ~0x00002000; // Clear CLKRZ (Use read-modify-write to ensure 1 VTP cycle wait for previous instruction)
  721. VTPIO_CTL |= 0x00002000; // Set CLKRZ (Use read-modify-write to ensure 1 VTP cycle wait for previous instruction)
  722. j = 0;
  723. // Polling READY bit to see when VTP calibration is done
  724. while((VTPIO_CTL & 0x00008000) == 0) {
  725. if( j++ > VTP_TIMEOUT ) {
  726. GEL_TextOut("\tVTP Ready timeout\n","Output",1,1,1);
  727. break;
  728. }
  729. }
  730. VTPIO_CTL |= 0x00000080; // Set LOCK bit for static calibration mode
  731. VTPIO_CTL |= 0x00000040; // Set POWERDN bit to power down VTP module
  732. // End VTP Calibration
  733. VTPIO_CTL |= 0x00004000; // Set IOPWRDN to allow powerdown of input receivers when PWRDNEN is set
  734. // **********************************************************************************************
  735. // Setting based 1Gb DDR2 Samsung K4T1G164QF-BCF8
  736. // Config DDR timings
  737. DRPYC1R = (0x0 << 8) | // Reserved
  738. (0x1 << 7) | // EXT_STRBEN
  739. (0x1 << 6) | // PWRDNEN
  740. (0x0 << 3) | // Reserved
  741. (0x3 << 0); // RL
  742. // DRPYC1R Value = 0x000000C3
  743. if( DDR_DEBUG ) {
  744. // Configure EMIF with max timings for more slack
  745. // Try this if memory is not stable
  746. DRPYC1R |= 0x7; // RL
  747. }
  748. EMIFDDR_SDCR |= 0x00800000; // Set BOOTUNLOCK
  749. // Settings depending on DDR2
  750. tmp_SDCR = (0x0 << 25) | // MSDRAMEN
  751. (0x1 << 20); // DDR2EN
  752. GEL_TextOut("\tUsing DDR2 settings\n","Output",1,1,1);
  753. EMIFDDR_SDCR = tmp_SDCR | // Settings that change depending on DDR2 or MDDR
  754. (EMIFDDR_SDCR & 0xF0000000) | // Reserved
  755. (0x0 << 27) | // DDR2TERM1
  756. (0x0 << 26) | // IBANK_POS
  757. (0x0 << 24) | // DDRDRIVE1
  758. (0x0 << 23) | // BOOTUNLOCK
  759. (0x0 << 22) | // DDR2DDQS
  760. (0x0 << 21) | // DDR2TERM0
  761. (0x0 << 19) | // DDRDLL_DIS
  762. (0x0 << 18) | // DDRDRIVE0
  763. (0x1 << 17) | // DDREN
  764. (0x1 << 16) | // SDRAMEN
  765. (0x1 << 15) | // TIMUNLOCK
  766. (0x1 << 14) | // NM
  767. (0x0 << 12) | // Reserved
  768. (0x3 << 9) | // CL
  769. (0x0 << 7) | // Reserved
  770. (0x3 << 4) | // IBANK
  771. (0x0 << 3) | // Reserved
  772. (0x2 << 0); // PAGESIZE
  773. EMIFDDR_SDCR2 = 0x00000000; // IBANK_POS set to 0 so this register does not apply
  774. if( DDR_DEBUG ) {
  775. // Configure EMIF with max timings for more slack
  776. // Try this if memory is not stable
  777. EMIFDDR_SDTIMR1 = (0x7F << 25) | // tRFC
  778. (0x07 << 22) | // tRP
  779. (0x07 << 19) | // tRCD
  780. (0x07 << 16) | // tWR
  781. (0x1F << 11) | // tRAS
  782. (0x1F << 6) | // tRC
  783. (0x07 << 3) | // tRRD
  784. (EMIFDDR_SDTIMR1 & 0x4) | // Reserved
  785. (0x03 << 0); // tWTR
  786. EMIFDDR_SDTIMR2 = (EMIFDDR_SDTIMR2 & 0x80000000) | // Reserved
  787. (((unsigned int) ((70000 / 3400) - 0.5)) << 27) | // tRASMAX (original 7812.5)
  788. (0x3 << 25) | // tXP
  789. (0x0 << 23) | // tODT (Not supported)
  790. (0x7F << 16) | // tXSNR
  791. (0xFF << 8) | // tXSRD
  792. (0x07 << 5) | // tRTP (1 Cycle)
  793. (0x1F << 0); // tCKE
  794. GEL_TextOut("\tDDR Timings Configured for Debug\n","Output",1,1,1);
  795. }
  796. else {
  797. // Let float -> integer truncate handle minus 1; Safer to round up for timings
  798. EMIFDDR_SDTIMR1 = (19 << 25) | // tRFC
  799. (1 << 22) | // tRP
  800. (1 << 19) | // tRCD
  801. (2 << 16) | // tWR
  802. (5 << 11) | // tRAS
  803. (8 << 6) | // tRC
  804. (1 << 3) | // tRRD
  805. (0 << 2) | // Reserved
  806. (1 << 0); // tWTR
  807. EMIFDDR_SDTIMR2 = (EMIFDDR_SDTIMR2 & 0x80000000) | // Reserved
  808. (8 << 27) | // tRASMAX
  809. (2 << 25) | // tXP
  810. (0 << 23) | // tODT (Not supported)
  811. (18 << 16) | // tXSNR (tXSR for mDDR)
  812. (199 << 8) | // tXSRD (tXSR for mDDR)
  813. (1 << 5) | // tRTP
  814. (2 << 0); // tCKE
  815. }
  816. EMIFDDR_SDCR &= ~0x00008000; // Clear TIMUNLOCK
  817. // Let float -> integer truncate handle RR round-down; Safer to round down for refresh rate
  818. EMIFDDR_SDRCR = (0x1 << 31) | // LPMODEN (Required for LPSC SyncReset/Enable)
  819. (0x1 << 30) | // MCLKSTOPEN (Required for LPSC SyncReset/Enable)
  820. (0x0 << 24) | // Reserved
  821. (0x0 << 23) | // SR_PD
  822. (0x0 << 16) | // Reserved
  823. (0x260 << 0); // RR
  824. // SyncReset the Clock to EMIFDDR SDRAM
  825. PSC1_LPSC_SyncReset(PD0, LPSC_DDR);
  826. // Enable the Clock to EMIFDDR SDRAM
  827. PSC1_LPSC_enable(PD0, LPSC_DDR);
  828. // Disable self-refresh
  829. EMIFDDR_SDRCR &= ~0xC0000000;
  830. EMIFDDR_PBBPR = 0x10;
  831. }
  832. // Input clock to device in MHz
  833. #define OSCIN_FREQ 24
  834. #define ARM_ROM_ID *(unsigned int*) 0xFFFD000c
  835. #define DSP_ROM_ID *(unsigned int*) 0x1170000c
  836. #define ARM_BLCfgStruct *(unsigned int*)0xFFFF0700
  837. #define DSP_BLCfgStruct *(unsigned int*)0x11F00700
  838. #define SYS_BASE 0x01C14000
  839. #define DEV_INFO_24 *(unsigned int*)(SYS_BASE + 0x008)
  840. #define DEV_INFO_25 *(unsigned int*)(SYS_BASE + 0x00C)
  841. #define DEV_INFO_06 *(unsigned int*)(SYS_BASE + 0x010)
  842. #define DEV_INFO_26 *(unsigned int*)(SYS_BASE + 0x014)
  843. #define DEV_INFO_00 *(unsigned int*)(SYS_BASE + 0x018)
  844. #define DEV_INFO_01 *(unsigned int*)(SYS_BASE + 0x01C)
  845. #define DEV_INFO_02 *(unsigned int*)(SYS_BASE + 0x020)
  846. #define DEV_INFO_03 *(unsigned int*)(SYS_BASE + 0x024)
  847. #define DEV_INFO_04 *(unsigned int*)(SYS_BASE + 0x028)
  848. #define DEV_INFO_05 *(unsigned int*)(SYS_BASE + 0x02C)
  849. #define DEV_INFO_11 ((DEV_INFO_24>>0) & 0xFFF)
  850. #define DEV_INFO_12 ((DEV_INFO_24>>12) & 0xFFF)
  851. #define DEV_INFO_10 ((DEV_INFO_24>>24) & 0x3F)
  852. #define DEV_INFO_09 ((DEV_INFO_25>>0) & 0xFFFFFF)
  853. #define DEV_INFO_07 ((DEV_INFO_25>>24) & 0x1F)
  854. #define DEV_INFO_08 ((DEV_INFO_25>>29) & 0x7)
  855. #define DEV_INFO_13 ((DEV_INFO_26>>0) & 0x1F)
  856. #define DEV_INFO_14 ((DEV_INFO_26>>5) & 0x1)
  857. #define DEV_INFO_15 ((DEV_INFO_26>>6) & 0x7FF)
  858. #define DEV_INFO_16 ((DEV_INFO_26>>17) & 0x3FFF)
  859. #define KEY_BASE 0x01C12000
  860. #define DEV_INFO_17 *(unsigned int*)(KEY_BASE + 0x004)
  861. #define DEV_INFO_18 *(unsigned int*)(KEY_BASE + 0x008)
  862. #define DEV_INFO_19 ((DEV_INFO_17>>8) & 0x1F)
  863. #define DEV_INFO_20 *(unsigned int*)(0x11700008)
  864. #define DEV_INFO_21 *(unsigned int*)(0x1170000C)
  865. #define DEV_INFO_22 *(unsigned int*)(0xFFFD0008)
  866. #define DEV_INFO_23 *(unsigned int*)(0xFFFD000C)
  867. #define BOOTCFG *(unsigned int*)(SYS_BASE + 0x020) //BOOTCFG
  868. #define PLLC0_BASE_ADDRESS 0x01C11000
  869. #define PLLC1_BASE_ADDRESS 0x01E1A000
  870. #define PLLCTL_OFFSET 0x100
  871. #define OCSEL_OFFSET 0x104
  872. #define PLLM_OFFSET 0x110
  873. #define PREDIV_OFFSET 0x114
  874. #define PLLDIV1_OFFSET 0x118
  875. #define PLLDIV2_OFFSET 0x11C
  876. #define PLLDIV3_OFFSET 0x120
  877. #define OSCDIV_OFFSET 0x124
  878. #define POSTDIV_OFFSET 0x128
  879. #define PLLDIV4_OFFSET 0x160
  880. #define PLLDIV5_OFFSET 0x164
  881. #define PLLDIV6_OFFSET 0x168
  882. #define PLLDIV7_OFFSET 0x16C
  883. #define CFGCHIP3 *(unsigned int*)(0x01C14188)
  884. menuitem "Diagnostics"
  885. hotmenu Run_All()
  886. {
  887. GEL_MapOff( );
  888. Print_Device_Info();
  889. Print_ROM_Info();
  890. Print_PLL_Configuration();
  891. Print_PSC_Status();
  892. }
  893. menuitem "Diagnostics"
  894. hotmenu Print_ROM_Info()
  895. {
  896. int errorCode;
  897. int boot_config;
  898. int revision2, revision1, revision0;
  899. int arm_dsp;
  900. int rom_id;
  901. unsigned int BLCfgStruct;
  902. GEL_TextOut("---------------------------------------------\n",,,,);
  903. GEL_TextOut("| BOOTROM Info |\n",,,,);
  904. GEL_TextOut("---------------------------------------------\n",,,,);
  905. arm_dsp = ((ARM_ROM_ID & 0xFF) == 0x6B) ? 1 : 0;
  906. rom_id = (arm_dsp) ? ARM_ROM_ID : DSP_ROM_ID;
  907. revision0 = ((rom_id & 0xFF000000) >>24) - 48;
  908. revision1 = ((rom_id & 0xFF0000) >>16) - 48;
  909. revision2 = ((rom_id & 0xFF00) >>8) - 48;
  910. GEL_TextOut("ROM ID: d800k%d%d%d \n",,,,, revision2, revision1, revision0);
  911. if(revision0 == 1) GEL_TextOut("Silicon Revision 1.0\n",,,,);
  912. else if(revision0 == 2) GEL_TextOut("Silicon Revision 1.0\n",,,,);
  913. else if(revision0 == 3) GEL_TextOut("Silicon Revision 2.0\n",,,,);
  914. else if(revision0 == 4) GEL_TextOut("Silicon Revision 1.1\n",,,,);
  915. else if(revision0 == 5) GEL_TextOut("Silicon Revision 2.1\n",,,,);
  916. else if(revision0 == 6) GEL_TextOut("Silicon Revision 2.0\n",,,,);
  917. else if(revision0 == 8) GEL_TextOut("Silicon Revision 2.1\n",,,,);
  918. else GEL_TextOut("Silicon Revision UNKNOWN\n",,,,);
  919. boot_config = BOOTCFG;
  920. GEL_TextOut("Boot pins: %d\n",,,,, boot_config);
  921. if((revision0 % 2) == 1) {
  922. if((boot_config & 0x87) == 0x01) GEL_TextOut("Boot Mode: NOR (%x)\n",,,,,boot_config);
  923. else if((boot_config & 0x87) == 0x02) GEL_TextOut("Boot Mode: HPI (%x)\n",,,,,boot_config);
  924. else if((boot_config & 0x87) == 0x05) GEL_TextOut("Boot Mode: SPI0 Flash (%x)\n",,,,,boot_config);
  925. else if((boot_config & 0x87) == 0x06) GEL_TextOut("Boot Mode: SPI1 Flash (%x)\n",,,,,boot_config);
  926. else if((boot_config & 0x87) == 0x07) GEL_TextOut("Boot Mode: NAND 8 (%x)\n",,,,,boot_config);
  927. else if((boot_config & 0x8F) == 0x80) GEL_TextOut("Boot Mode: NAND 16 (%x)\n",,,,,boot_config);
  928. else if((boot_config & 0x8F) == 0x00) GEL_TextOut("Boot Mode: I2C0 Master (%x)\n",,,,,boot_config);
  929. else if((boot_config & 0x8F) == 0x08) GEL_TextOut("Boot Mode: I2C0 Slave (%x)\n",,,,,boot_config);
  930. else if((boot_config & 0x8F) == 0x03) GEL_TextOut("Boot Mode: I2C1 Master (%x)\n",,,,,boot_config);
  931. else if((boot_config & 0x8F) == 0x0B) GEL_TextOut("Boot Mode: I2C1 Slave (%x)\n",,,,,boot_config);
  932. else if((boot_config & 0x8F) == 0x04) GEL_TextOut("Boot Mode: SPI0 EEPROM (%x)\n",,,,,boot_config);
  933. else if((boot_config & 0x8F) == 0x0C) GEL_TextOut("Boot Mode: SPI1 EEPROM (%x)\n",,,,,boot_config);
  934. else if((boot_config & 0x8F) == 0x81) GEL_TextOut("Boot Mode: SPI0 Slave (%x)\n",,,,,boot_config);
  935. else if((boot_config & 0x8F) == 0x89) GEL_TextOut("Boot Mode: SPI1 Slave (%x)\n",,,,,boot_config);
  936. else if((boot_config & 0x8F) == 0x83) GEL_TextOut("Boot Mode: UART0 (%x)\n",,,,,boot_config);
  937. else if((boot_config & 0x8F) == 0x8B) GEL_TextOut("Boot Mode: UART1 (%x)\n",,,,,boot_config);
  938. else if((boot_config & 0x8F) == 0x82) GEL_TextOut("Boot Mode: UART2 (%x)\n",,,,,boot_config);
  939. else if((boot_config & 0x8F) == 0x87) GEL_TextOut("Boot Mode: Emulation Debug (%x)\n",,,,,boot_config);
  940. else GEL_TextOut("Boot Mode: INVALID (%x)\n",,,,,boot_config);
  941. }
  942. else{
  943. if(boot_config == 0x02) GEL_TextOut("Boot Mode: NOR\n",,,,);
  944. else if(boot_config == 0x0E) GEL_TextOut("Boot Mode: NAND 8\n",,,,);
  945. else if(boot_config == 0x10) GEL_TextOut("Boot Mode: NAND 16\n",,,,);
  946. else if(boot_config == 0x00) GEL_TextOut("Boot Mode: I2C0 EEPROM\n",,,,);
  947. else if(boot_config == 0x06) GEL_TextOut("Boot Mode: I2C1 EEPROM\n",,,,);
  948. else if(boot_config == 0x01) GEL_TextOut("Boot Mode: I2C0 Slave\n",,,,);
  949. else if(boot_config == 0x07) GEL_TextOut("Boot Mode: I2C1 Slave\n",,,,);
  950. else if(boot_config == 0x08) GEL_TextOut("Boot Mode: SPI0 EEPROM\n",,,,);
  951. else if(boot_config == 0x09) GEL_TextOut("Boot Mode: SPI1 EEPROM\n",,,,);
  952. else if(boot_config == 0x0A) GEL_TextOut("Boot Mode: SPI0 Flash\n",,,,);
  953. else if(boot_config == 0x0C) GEL_TextOut("Boot Mode: SPI1 Flash\n",,,,);
  954. else if(boot_config == 0x12) GEL_TextOut("Boot Mode: SPI0 Slave\n",,,,);
  955. else if(boot_config == 0x13) GEL_TextOut("Boot Mode: SPI1 Slave\n",,,,);
  956. else if((boot_config & 0x3F) == 0x1C) GEL_TextOut("Boot Mode: SDMMC0\n",,,,);
  957. else if((boot_config & 0x3F) == 0x3C) GEL_TextOut("Boot Mode: SDMMC0, MMC mode\n",,,,);
  958. else if((boot_config & 0x1F) == 0x16) GEL_TextOut("Boot Mode: UART0\n",,,,);
  959. else if((boot_config & 0x1F) == 0x17) GEL_TextOut("Boot Mode: UART1\n",,,,);
  960. else if((boot_config & 0x1F) == 0x14) GEL_TextOut("Boot Mode: UART2\n",,,,);
  961. else if(boot_config == 0x04) GEL_TextOut("Boot Mode: HPI\n",,,,);
  962. else if(boot_config == 0x1E) GEL_TextOut("Boot Mode: Emulation Debug\n",,,,);
  963. else if(boot_config == 0x1C && revision0 > 6) GEL_TextOut("Boot Mode: MMCSD0\n",,,,);
  964. else GEL_TextOut("Boot Mode: INVALID (%x)\n",,,,,boot_config);
  965. if((boot_config & 0x1F) == 0x16 || (boot_config & 0x1F) == 0x17 || (boot_config & 0x1F) == 0x14) {
  966. if(((boot_config & 0xE0) >> 5) == 0) GEL_TextOut("24 MHz or 12 MHz input clock\n",,,,);
  967. if(((boot_config & 0xE0) >> 5) == 1) GEL_TextOut("27 MHz or 13.5 MHz input clock\n",,,,);
  968. if(((boot_config & 0xE0) >> 5) == 2) GEL_TextOut("30 MHz or 15 MHz input clock\n",,,,);
  969. if(((boot_config & 0xE0) >> 5) == 3) GEL_TextOut("16.8 MHz input clock\n",,,,);
  970. if(((boot_config & 0xE0) >> 5) == 4) GEL_TextOut("19.2 MHz input clock\n",,,,);
  971. if(((boot_config & 0xE0) >> 5) == 5) GEL_TextOut("24.576 MHz or 12.288 MHz input clock\n",,,,);
  972. if(((boot_config & 0xE0) >> 5) == 6) GEL_TextOut("25 MHz input clock\n",,,,);
  973. if(((boot_config & 0xE0) >> 5) == 7) GEL_TextOut("26 MHz or 13 MHz input clock\n",,,,);
  974. }
  975. }
  976. if((revision0 % 2) == 1) {
  977. BLCfgStruct = arm_dsp ? ARM_BLCfgStruct : DSP_BLCfgStruct;
  978. }
  979. else {
  980. BLCfgStruct = arm_dsp ? ARM_BLCfgStruct : DSP_BLCfgStruct;
  981. }
  982. errorCode = (BLCfgStruct >> 8) & 0xFF;
  983. GEL_TextOut("ROM Status Code: %x\n",,,,, errorCode);
  984. if(revision0 == 1) {
  985. if(errorCode == 0) GEL_TextOut("No error\n",,,,);
  986. else if(errorCode == 1) GEL_TextOut("Unknown error\n",,,,);
  987. else if(errorCode == 2) GEL_TextOut("Invalid (or no action) boot mode\n",,,,);
  988. else if(errorCode == 3) GEL_TextOut("Function not allowed\n",,,,);
  989. else if(errorCode == 4) GEL_TextOut("This code should not execute\n",,,,);
  990. else if(errorCode == 5) GEL_TextOut("Waiting to get reset\n",,,,);
  991. else if(errorCode == 6) GEL_TextOut("Invalid bits for device\n",,,,);
  992. else if(errorCode == 7) GEL_TextOut("Invalid device type\n",,,,);
  993. else if(errorCode == 8) GEL_TextOut("Invalid device number\n",,,,);
  994. else if(errorCode == 9) GEL_TextOut("Invalid address range\n",,,,,);
  995. else if(errorCode == 10) GEL_TextOut("Not supported for non-secure device\n",,,,);
  996. else if(errorCode == 11) GEL_TextOut("Invalid password\n",,,,);
  997. else if(errorCode == 12) GEL_TextOut("Not supported for secure device\n",,,,);
  998. else if(errorCode == 13) GEL_TextOut("Secure ROM checksum failed\n",,,,);
  999. else if(errorCode == 14) GEL_TextOut("Invalid RPK\n",,,,);
  1000. else if(errorCode == 15) GEL_TextOut("Invalid signature\n",,,,);
  1001. else if(errorCode == 16) GEL_TextOut("Buffer overflow\n",,,,);
  1002. else if(errorCode == 17) GEL_TextOut("Invalid AIS keyword\n",,,,);
  1003. else if(errorCode == 18) GEL_TextOut("Invalid AIS sync opcode\n",,,,);
  1004. else if(errorCode == 19) GEL_TextOut("Error parsing AIS opcode\n",,,,);
  1005. else if(errorCode == 20) GEL_TextOut("Invalid AIS format\n",,,,);
  1006. else if(errorCode == 21) GEL_TextOut("Invalid AIS state\n",,,,);
  1007. else if(errorCode == 22) GEL_TextOut("Invalid type in AIS boot table command\n",,,,);
  1008. else if(errorCode == 23) GEL_TextOut("Invalid type in AIS section fill command\n",,,,);
  1009. else if(errorCode == 24) GEL_TextOut("Invalid function index\n",,,,);
  1010. else if(errorCode == 25) GEL_TextOut("Invalid argument count\n",,,,);
  1011. else if(errorCode == 26) GEL_TextOut("Too many CRC errors\n",,,,);
  1012. else if(errorCode == 27) GEL_TextOut("Invalid NOR configuration word\n",,,,);
  1013. else if(errorCode == 28) GEL_TextOut("SPI bit error\n",,,,);
  1014. else if(errorCode == 29) GEL_TextOut("Invalid character received by UART\n",,,,);
  1015. else if(errorCode == 30) GEL_TextOut("UART Overrun Error\n",,,,);
  1016. else if(errorCode == 31) GEL_TextOut("UART Parity Error\n",,,,);
  1017. else if(errorCode == 32) GEL_TextOut("UART Frame Error\n",,,,);
  1018. else if(errorCode == 33) GEL_TextOut("UART Break Indicator\n",,,,);
  1019. else GEL_TextOut("Error code not recognized\n",,,,);
  1020. }
  1021. else {
  1022. if(errorCode == 0) GEL_TextOut("No error\n",,,,);
  1023. else if(errorCode == 1) GEL_TextOut("DSP was put to sleep\n",,,,);
  1024. else if(errorCode == 2) GEL_TextOut("Unknown error\n",,,,);
  1025. else if(errorCode == 3) GEL_TextOut("One-time Device Init failed\n",,,,);
  1026. else if(errorCode == 4) GEL_TextOut("One-time Device finalize failed\n",,,,);
  1027. else if(errorCode == 5) GEL_TextOut("Peripheral Open Failed\n",,,,);
  1028. else if(errorCode == 6) GEL_TextOut("Peripheral Close Failed\n",,,,);
  1029. else if(errorCode == 7) GEL_TextOut("Invalid (or no action) boot mode\n",,,,);
  1030. else if(errorCode == 8) GEL_TextOut("Invalid peripheral number\n",,,,);
  1031. else if(errorCode == 9) GEL_TextOut("Invalid AIS keyword\n",,,,,);
  1032. else if(errorCode == 10) GEL_TextOut("Invalid AIS sync opcode\n",,,,);
  1033. else if(errorCode == 11) GEL_TextOut("Error parsing AIS opcode\n",,,,);
  1034. else if(errorCode == 12) GEL_TextOut("Invalid AIS state\n",,,,);
  1035. else if(errorCode == 13) GEL_TextOut("Invalid type in AIS boot table command\n",,,,);
  1036. else if(errorCode == 14) GEL_TextOut("Invalid type in AIS section fill command\n",,,,);
  1037. else if(errorCode == 15) GEL_TextOut("Invalid function index\n",,,,);
  1038. else if(errorCode == 16) GEL_TextOut("Invalid argument count\n",,,,);
  1039. else if(errorCode == 17) GEL_TextOut("Function execute command failed\n",,,,);
  1040. else if(errorCode == 18) GEL_TextOut("Too many CRC errors\n",,,,);
  1041. else if(errorCode == 19) GEL_TextOut("Invalid NOR configuration word\n",,,,);
  1042. else if(errorCode == 20) GEL_TextOut("SPI bit error\n",,,,);
  1043. else if(errorCode == 21) GEL_TextOut("Invalid character received by UART\n",,,,);
  1044. else if(errorCode == 22) GEL_TextOut("UART Overrun Error\n",,,,);
  1045. else if(errorCode == 23) GEL_TextOut("UART Parity Error\n",,,,);
  1046. else if(errorCode == 24) GEL_TextOut("UART Frame Error\n",,,,);
  1047. else if(errorCode == 25) GEL_TextOut("UART Break Indicator\n",,,,);
  1048. else if(errorCode == 26) GEL_TextOut("NAND read page failed\n",,,,);
  1049. else if(errorCode == 27) GEL_TextOut("SDMMC read error\n",,,,);
  1050. else if(errorCode == 128+1) GEL_TextOut("Secure key has not been installed\n",,,,);
  1051. else if(errorCode == 128+2) GEL_TextOut("Invalid Boot exit type\n",,,,);
  1052. else if(errorCode == 128+3) GEL_TextOut("Waiting to get reset\n",,,,);
  1053. else if(errorCode == 128+4) GEL_TextOut("Invalid type of device\n",,,,);
  1054. else if(errorCode == 128+5) GEL_TextOut("Invalid address range\n",,,,);
  1055. else if(errorCode == 128+6) GEL_TextOut("Not supported for non-secure device\n",,,,);
  1056. else if(errorCode == 128+7) GEL_TextOut("Invalid password\n",,,,);
  1057. else if(errorCode == 128+8) GEL_TextOut("Not supported for secure device\n",,,,);
  1058. else if(errorCode == 128+9) GEL_TextOut("Secure ROM checksum failed\n",,,,);
  1059. else if(errorCode == 128+10) GEL_TextOut("Invalid RPK\n",,,,);
  1060. else if(errorCode == 128+11) GEL_TextOut("Invalid signature\n",,,,);
  1061. else if(errorCode == 128+12) GEL_TextOut("AIS command not allowed for this device type\n",,,,);
  1062. else if(errorCode == 128+13) GEL_TextOut("Secure Loading failure\n",,,,);
  1063. else if(errorCode == 128+14) GEL_TextOut("Function not allowed\n",,,,);
  1064. else if(errorCode == 128+15) GEL_TextOut("JTAG Read failed\n",,,,);
  1065. else GEL_TextOut("Error code not recognized\n",,,,);
  1066. }
  1067. GEL_TextOut("Program Counter (PC) = %x\n",,,,,PC);
  1068. }
  1069. menuitem "Diagnostics"
  1070. hotmenu Print_Device_Info()
  1071. {
  1072. int j;
  1073. char k = 65;
  1074. GEL_TextOut("---------------------------------------------\n",,,,);
  1075. GEL_TextOut("| Device Information |\n",,,,);
  1076. GEL_TextOut("---------------------------------------------\n",,,,);
  1077. GEL_TextOut("DEV_INFO_00 = %x\n",,,,,DEV_INFO_00);
  1078. GEL_TextOut("DEV_INFO_01 = %x\n",,,,,DEV_INFO_01);
  1079. GEL_TextOut("DEV_INFO_02 = %x\n",,,,,DEV_INFO_02);
  1080. GEL_TextOut("DEV_INFO_03 = %x\n",,,,,DEV_INFO_03);
  1081. GEL_TextOut("DEV_INFO_04 = %x\n",,,,,DEV_INFO_04);
  1082. GEL_TextOut("DEV_INFO_05 = %x\n",,,,,DEV_INFO_05);
  1083. GEL_TextOut("DEV_INFO_06 = %x\n",,,,,DEV_INFO_06);
  1084. GEL_TextOut("DEV_INFO_07-DEV_INFO_08-DEV_INFO_09-DEV_INFO_10-DEV_INFO_11-DEV_INFO_12 = %d-%d-%d-%d-%d-%d\n",,,,,DEV_INFO_07,DEV_INFO_08,DEV_INFO_09,DEV_INFO_10,DEV_INFO_11,DEV_INFO_12);
  1085. GEL_TextOut("DEV_INFO_13,DEV_INFO_14,DEV_INFO_15,DEV_INFO_16 = %d,%d,%d,%d\n",,,,,DEV_INFO_13,DEV_INFO_14,DEV_INFO_15,DEV_INFO_16);
  1086. GEL_TextOut("-----\n",,,,);
  1087. GEL_TextOut("DEV_INFO_17 = %x\n",,,,,DEV_INFO_17);
  1088. GEL_TextOut("DEV_INFO_18 = %x\n",,,,,DEV_INFO_18);
  1089. GEL_TextOut("DEV_INFO_19 = %x\n",,,,,DEV_INFO_19);
  1090. GEL_TextOut("-----\n",,,,);
  1091. GEL_TextOut("DEV_INFO_20 = %x\n",,,,,DEV_INFO_20);
  1092. GEL_TextOut("DEV_INFO_21 = %x\n",,,,,DEV_INFO_21);
  1093. GEL_TextOut("DEV_INFO_22 = %x\n",,,,,DEV_INFO_22);
  1094. GEL_TextOut("DEV_INFO_23 = %x\n",,,,,DEV_INFO_23);
  1095. GEL_TextOut("-----\n",,,,);
  1096. GEL_TextOut("DEV_INFO_24 = %x\n",,,,,DEV_INFO_24);
  1097. GEL_TextOut("DEV_INFO_25 = %x\n",,,,,DEV_INFO_25);
  1098. GEL_TextOut("DEV_INFO_06 = %x\n",,,,,DEV_INFO_06);
  1099. GEL_TextOut("DEV_INFO_26 = %x\n",,,,,DEV_INFO_26);
  1100. GEL_TextOut("\n\n",,,,);
  1101. }
  1102. menuitem "Diagnostics"
  1103. hotmenu Print_PLL_Configuration()
  1104. {
  1105. // PLL0 registers
  1106. unsigned int pll0_ocsel, pll0_pllm, pll0_prediv, pll0_postdiv;
  1107. unsigned int pll0_plldiv1, pll0_plldiv2, pll0_plldiv3, pll0_plldiv4;
  1108. unsigned int pll0_plldiv5, pll0_plldiv6, pll0_plldiv7, pll0_pllctl;
  1109. // PLL0 clocks
  1110. unsigned int pll0clk_prediv, pll0clk_pllen;
  1111. unsigned int pll0clk_pllout, pll0clk_pllout_postdiv, pll0clk_sysclk1;
  1112. unsigned int pll0clk_sysclk2, pll0clk_sysclk3, pll0clk_sysclk4, pll0clk_sysclk5;
  1113. unsigned int pll0clk_sysclk6, pll0clk_sysclk7;
  1114. // PLL1 registers
  1115. unsigned int pll1_pllctl, pll1_ocsel, pll1_pllm, pll1_postdiv;
  1116. unsigned int pll1_plldiv1, pll1_plldiv2, pll1_plldiv3;
  1117. // PLL1 clocks
  1118. unsigned int pll1clk_pllout, pll1clk_pllout_postdiv, pll1clk_pllen;
  1119. unsigned int pll1clk_sysclk1, pll1clk_sysclk2, pll1clk_sysclk3;
  1120. // Device in use
  1121. unsigned int arm_dsp, rom_id, revision0;
  1122. arm_dsp = ((ARM_ROM_ID & 0xFF) == 0x6B) ? 1 : 0;
  1123. rom_id = (arm_dsp) ? ARM_ROM_ID : DSP_ROM_ID;
  1124. revision0 = ((rom_id & 0xFF000000) >>24) - 48;
  1125. /***** Calculate PLL1 clock values first since PLL1 can be input to PLL0 */
  1126. if ((revision0%2) == 0) //PLL1 exists only on OMAP-L138 and pin-for-pin compatible
  1127. {
  1128. pll1_pllctl = *(unsigned int*)(PLLC1_BASE_ADDRESS + PLLCTL_OFFSET);
  1129. pll1_pllm = *(unsigned int*)(PLLC1_BASE_ADDRESS + PLLM_OFFSET);
  1130. pll1_postdiv = *(unsigned int*)(PLLC1_BASE_ADDRESS + POSTDIV_OFFSET);
  1131. pll1_plldiv1 = *(unsigned int*)(PLLC1_BASE_ADDRESS + PLLDIV1_OFFSET);
  1132. pll1_plldiv2 = *(unsigned int*)(PLLC1_BASE_ADDRESS + PLLDIV2_OFFSET);
  1133. pll1_plldiv3 = *(unsigned int*)(PLLC1_BASE_ADDRESS + PLLDIV3_OFFSET);
  1134. pll1clk_pllout = OSCIN_FREQ * ((pll1_pllm & 0x1F) + 1);
  1135. if ((pll1_postdiv & 0x8000) == 0x8000)
  1136. {
  1137. pll1clk_pllout_postdiv = pll1clk_pllout / ((pll1_postdiv & 0x1F) + 1);
  1138. }
  1139. else
  1140. {
  1141. pll1clk_pllout_postdiv = pll1clk_pllout;
  1142. }
  1143. if ((pll1_pllctl & 1) == 1)
  1144. {
  1145. pll1clk_pllen = pll1clk_pllout_postdiv;
  1146. }
  1147. else
  1148. {
  1149. pll1clk_pllen = OSCIN_FREQ;
  1150. }
  1151. if ((pll1_plldiv1 & 0x8000) == 0x8000)
  1152. {
  1153. pll1clk_sysclk1 = pll1clk_pllen / ((pll1_plldiv1 & 0x1F) + 1);
  1154. }
  1155. else
  1156. {
  1157. pll1clk_sysclk1 = pll1clk_pllen;
  1158. }
  1159. if ((pll1_plldiv2 & 0x8000) == 0x8000)
  1160. {
  1161. pll1clk_sysclk2 = pll1clk_pllen / ((pll1_plldiv2 & 0x1F) + 1);
  1162. }
  1163. else
  1164. {
  1165. pll1clk_sysclk2 = pll1clk_pllen;
  1166. }
  1167. if ((pll1_plldiv3 & 0x8000) == 0x8000)
  1168. {
  1169. pll1clk_sysclk3 = pll1clk_pllen / ((pll1_plldiv3 & 0x1F) + 1);
  1170. }
  1171. else
  1172. {
  1173. pll1clk_sysclk3 = pll1clk_pllen;
  1174. }
  1175. }
  1176. /***** Calculate PLL0 clock values *****/
  1177. pll0_pllctl = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLCTL_OFFSET);
  1178. pll0_prediv = *(unsigned int*)(PLLC0_BASE_ADDRESS + PREDIV_OFFSET);
  1179. pll0_pllm = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLM_OFFSET);
  1180. pll0_postdiv = *(unsigned int*)(PLLC0_BASE_ADDRESS + POSTDIV_OFFSET);
  1181. pll0_plldiv1 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV1_OFFSET);
  1182. pll0_plldiv2 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV2_OFFSET);
  1183. pll0_plldiv3 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV3_OFFSET);
  1184. pll0_plldiv4 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV4_OFFSET);
  1185. pll0_plldiv5 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV5_OFFSET);
  1186. pll0_plldiv6 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV6_OFFSET);
  1187. pll0_plldiv7 = *(unsigned int*)(PLLC0_BASE_ADDRESS + PLLDIV7_OFFSET);
  1188. if ((pll0_prediv & 0x8000) == 0x8000)
  1189. {
  1190. pll0clk_prediv = OSCIN_FREQ / ((pll0_prediv & 0x1F) + 1);
  1191. }
  1192. else
  1193. {
  1194. pll0clk_prediv = OSCIN_FREQ;
  1195. }
  1196. pll0clk_pllout = pll0clk_prediv * ((pll0_pllm & 0x1F) + 1);
  1197. if ((pll0_postdiv & 0x8000) == 0x8000)
  1198. {
  1199. pll0clk_pllout_postdiv = pll0clk_pllout / ((pll0_postdiv & 0x1F) + 1);
  1200. }
  1201. else
  1202. {
  1203. pll0clk_pllout_postdiv = pll0clk_pllout;
  1204. }
  1205. // Check PLLCTL[PLLEN]
  1206. if ((pll0_pllctl & 1) == 1)
  1207. {
  1208. pll0clk_pllen = pll0clk_pllout_postdiv;
  1209. }
  1210. else
  1211. {
  1212. // Check PLLCTL[EXTCLKSRC]
  1213. if ( (pll0_pllctl & (1<<9)) == (1<<9) )
  1214. {
  1215. pll0clk_pllen = pll1clk_sysclk3;
  1216. }
  1217. else
  1218. {
  1219. pll0clk_pllen = OSCIN_FREQ;
  1220. }
  1221. }
  1222. if ((pll0_plldiv1 & 0x8000) == 0x8000)
  1223. {
  1224. pll0clk_sysclk1 = pll0clk_pllen / ((pll0_plldiv1 & 0x1F) + 1);
  1225. }
  1226. else
  1227. {
  1228. pll0clk_sysclk1 = pll0clk_pllen;
  1229. }
  1230. if ((pll0_plldiv2 & 0x8000) == 0x8000)
  1231. {
  1232. pll0clk_sysclk2 = pll0clk_pllen / ((pll0_plldiv2 & 0x1F) + 1);
  1233. }
  1234. else
  1235. {
  1236. pll0clk_sysclk2 = pll0clk_pllen;
  1237. }
  1238. if ((pll0_plldiv3 & 0x8000) == 0x8000)
  1239. {
  1240. pll0clk_sysclk3 = pll0clk_pllen / ((pll0_plldiv3 & 0x1F) + 1);
  1241. }
  1242. else
  1243. {
  1244. pll0clk_sysclk3 = pll0clk_pllen;
  1245. }
  1246. if ((pll0_plldiv4 & 0x8000) == 0x8000)
  1247. {
  1248. pll0clk_sysclk4 = pll0clk_pllen / ((pll0_plldiv4 & 0x1F) + 1);
  1249. }
  1250. else
  1251. {
  1252. pll0clk_sysclk4 = pll0clk_pllen;
  1253. }
  1254. if ((pll0_plldiv5 & 0x8000) == 0x8000)
  1255. {
  1256. pll0clk_sysclk5 = pll0clk_pllen / ((pll0_plldiv5 & 0x1F) + 1);
  1257. }
  1258. else
  1259. {
  1260. pll0clk_sysclk5 = pll0clk_pllen;
  1261. }
  1262. if ((pll0_plldiv6 & 0x8000) == 0x8000)
  1263. {
  1264. pll0clk_sysclk6 = pll0clk_pllen / ((pll0_plldiv6 & 0x1F) + 1);
  1265. }
  1266. else
  1267. {
  1268. pll0clk_sysclk6 = pll0clk_pllen;
  1269. }
  1270. if ((pll0_plldiv7 & 0x8000) == 0x8000)
  1271. {
  1272. pll0clk_sysclk7 = pll0clk_pllen / ((pll0_plldiv7 & 0x1F) + 1);
  1273. }
  1274. else
  1275. {
  1276. pll0clk_sysclk7 = pll0clk_pllen;
  1277. }
  1278. GEL_TextOut("\n");
  1279. GEL_TextOut("---------------------------------------------\n");
  1280. GEL_TextOut("| Clock Information |\n");
  1281. GEL_TextOut("---------------------------------------------\n");
  1282. GEL_TextOut("\n");
  1283. // if PLLCTL[CLKMODE] == 1
  1284. if ( (pll0_pllctl & (1<<8)) == (1<<8) )
  1285. {
  1286. GEL_TextOut("PLLs configured to utilize 1.2V square wave input.\n");
  1287. }
  1288. else
  1289. {
  1290. GEL_TextOut("PLLs configured to utilize crystal.\n");
  1291. }
  1292. // if CFGCHIP3[ASYNC3_CLKSRC] == 1
  1293. if ( (CFGCHIP3 & (1<<4)) == 0 )
  1294. {
  1295. GEL_TextOut("ASYNC3 = PLL0_SYSCLK2\n");
  1296. }
  1297. else
  1298. {
  1299. GEL_TextOut("ASYNC3 = PLL1_SYSCLK2\n");
  1300. }
  1301. GEL_TextOut("\n");
  1302. GEL_TextOut("NOTE: All clock frequencies in following PLL sections are based\n");
  1303. GEL_TextOut("off OSCIN = %d MHz. If that value does not match your hardware\n",,,,, OSCIN_FREQ);
  1304. GEL_TextOut("you should change the #define in the top of the gel file, save it,\n");
  1305. GEL_TextOut("and then reload.\n");
  1306. GEL_TextOut("\n");
  1307. GEL_TextOut("---------------------------------------------\n");
  1308. GEL_TextOut("| PLL0 Information |\n");
  1309. GEL_TextOut("---------------------------------------------\n");
  1310. GEL_TextOut("\n");
  1311. // Uncomment to see intermediate clock calculations
  1312. //GEL_TextOut("PLL0_PREDIV = %d MHz\n",,,,, pll0clk_prediv);
  1313. //GEL_TextOut("PLL0_PLLOUT = %d MHz\n",,,,, pll0clk_pllout);
  1314. //GEL_TextOut("PLL0_PLLOUT_POSTDIV = %d MHz\n",,,,, pll0clk_pllout_postdiv);
  1315. //GEL_TextOut("PLL0_PLLEN = %d MHz\n",,,,, pll0clk_pllen);
  1316. GEL_TextOut("PLL0_SYSCLK1 DSP = %d MHz\n",,,,, pll0clk_sysclk1);
  1317. GEL_TextOut("PLL0_SYSCLK2 ASYNC3 = %d MHz\n",,,,, pll0clk_sysclk2);
  1318. GEL_TextOut("PLL0_SYSCLK3 EMIFA = %d MHz\n",,,,, pll0clk_sysclk3);
  1319. GEL_TextOut("PLL0_SYSCLK4 = %d MHz\n",,,,, pll0clk_sysclk4);
  1320. GEL_TextOut("PLL0_SYSCLK5 Not used = %d MHz\n",,,,, pll0clk_sysclk5);
  1321. GEL_TextOut("PLL0_SYSCLK6 ARM(OMAPL138) = %d MHz\n",,,,, pll0clk_sysclk6);
  1322. GEL_TextOut("PLL0_SYSCLK7 EMAC = %d MHz\n",,,,, pll0clk_sysclk7);
  1323. if ( (pll0clk_sysclk1 / pll0clk_sysclk2) != 2 )
  1324. {
  1325. GEL_TextOut("Error: PLL0_SYSCLK2 must equal PLL0_SYSCLK1 / 2\n");
  1326. }
  1327. if ( (pll0clk_sysclk1 / pll0clk_sysclk4) != 4 )
  1328. {
  1329. GEL_TextOut("Error: PLL0_SYSCLK4 must equal PLL0_SYSCLK1 / 4\n");
  1330. }
  1331. if ( (pll0clk_sysclk1 / pll0clk_sysclk6) != 1 )
  1332. {
  1333. GEL_TextOut("Error: PLL0_SYSCLK6 must equal PLL0_SYSCLK1 / 1\n");
  1334. }
  1335. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1336. {
  1337. GEL_TextOut("\n");
  1338. GEL_TextOut("---------------------------------------------\n");
  1339. GEL_TextOut("| PLL1 Information |\n");
  1340. GEL_TextOut("---------------------------------------------\n");
  1341. GEL_TextOut("\n");
  1342. // Uncomment to see intermediate clock calculations
  1343. //GEL_TextOut("PLL1_PLLOUT = %d MHz\n",,,,, pll1clk_pllout);
  1344. //GEL_TextOut("PLL1_PLLOUT_POSTDIV = %d MHz\n",,,,, pll1clk_pllout_postdiv);
  1345. //GEL_TextOut("PLL1_PLLEN = %d MHz\n",,,,, pll1clk_pllen);
  1346. GEL_TextOut("PLL1_SYSCLK1 DDR2 = %d MHz\n",,,,, pll1clk_sysclk1);
  1347. GEL_TextOut("PLL1_SYSCLK2 ASYNC3 = %d MHz\n",,,,, pll1clk_sysclk2);
  1348. GEL_TextOut("PLL1_SYSCLK3 = %d MHz\n",,,,, pll1clk_sysclk3);
  1349. }
  1350. }
  1351. menuitem "Diagnostics"
  1352. hotmenu Print_PSC_Status()
  1353. {
  1354. unsigned int *pPSC0_MDSTAT = (unsigned int*)0x01C10800;
  1355. unsigned int *pPSC1_MDSTAT = (unsigned int*)0x01E27800;
  1356. // Device in use
  1357. unsigned int arm_dsp, rom_id, revision0;
  1358. arm_dsp = ((ARM_ROM_ID & 0xFF) == 0x6B) ? 1 : 0;
  1359. rom_id = (arm_dsp) ? ARM_ROM_ID : DSP_ROM_ID;
  1360. revision0 = ((rom_id & 0xFF000000) >>24) - 48;
  1361. GEL_TextOut("\n");
  1362. GEL_TextOut("---------------------------------------------\n");
  1363. GEL_TextOut("| PSC0 Information |\n");
  1364. GEL_TextOut("---------------------------------------------\n");
  1365. GEL_TextOut("\n");
  1366. GEL_TextOut("State Decoder:\n");
  1367. GEL_TextOut(" 0 = SwRstDisable (reset asserted, clock off)\n");
  1368. GEL_TextOut(" 1 = SyncReset (reset assered, clock on)\n");
  1369. GEL_TextOut(" 2 = Disable (reset de-asserted, clock off)\n");
  1370. GEL_TextOut(" 3 = Enable (reset de-asserted, clock on)\n");
  1371. GEL_TextOut(">3 = Transition in progress\n");
  1372. GEL_TextOut("\n");
  1373. GEL_TextOut("Module 0: EDMA3CC (0) STATE = %d\n",,,,, (pPSC0_MDSTAT[0] & 0x3F));
  1374. GEL_TextOut("Module 1: EDMA3 TC0 STATE = %d\n",,,,, (pPSC0_MDSTAT[1] & 0x3F));
  1375. GEL_TextOut("Module 2: EDMA3 TC1 STATE = %d\n",,,,, (pPSC0_MDSTAT[2] & 0x3F));
  1376. GEL_TextOut("Module 3: EMIFA (BR7) STATE = %d\n",,,,, (pPSC0_MDSTAT[3] & 0x3F));
  1377. GEL_TextOut("Module 4: SPI 0 STATE = %d\n",,,,, (pPSC0_MDSTAT[4] & 0x3F));
  1378. GEL_TextOut("Module 5: MMC/SD 0 STATE = %d\n",,,,, (pPSC0_MDSTAT[5] & 0x3F));
  1379. GEL_TextOut("Module 6: AINTC STATE = %d\n",,,,, (pPSC0_MDSTAT[6] & 0x3F));
  1380. GEL_TextOut("Module 7: ARM RAM/ROM STATE = %d\n",,,,, (pPSC0_MDSTAT[7] & 0x3F));
  1381. GEL_TextOut("Module 9: UART 0 STATE = %d\n",,,,, (pPSC0_MDSTAT[9] & 0x3F));
  1382. GEL_TextOut("Module 10: SCR 0 (BR0/1/2/8) STATE = %d\n",,,,, (pPSC0_MDSTAT[10] & 0x3F));
  1383. GEL_TextOut("Module 11: SCR 1 (BR4) STATE = %d\n",,,,, (pPSC0_MDSTAT[11] & 0x3F));
  1384. GEL_TextOut("Module 12: SCR 2 (BR3/5/6) STATE = %d\n",,,,, (pPSC0_MDSTAT[12] & 0x3F));
  1385. GEL_TextOut("Module 13: PRUSS STATE = %d\n",,,,, (pPSC0_MDSTAT[13] & 0x3F));
  1386. GEL_TextOut("Module 14: ARM(OMAPL138) STATE = %d\n",,,,, (pPSC0_MDSTAT[14] & 0x3F));
  1387. GEL_TextOut("Module 15: DSP STATE = %d\n",,,,, (pPSC0_MDSTAT[15] & 0x3F));
  1388. GEL_TextOut("\n");
  1389. GEL_TextOut("---------------------------------------------\n");
  1390. GEL_TextOut("| PSC1 Information |\n");
  1391. GEL_TextOut("---------------------------------------------\n");
  1392. GEL_TextOut("\n");
  1393. GEL_TextOut("State Decoder:\n");
  1394. GEL_TextOut(" 0 = SwRstDisable (reset asserted, clock off)\n");
  1395. GEL_TextOut(" 1 = SyncReset (reset assered, clock on)\n");
  1396. GEL_TextOut(" 2 = Disable (reset de-asserted, clock off)\n");
  1397. GEL_TextOut(" 3 = Enable (reset de-asserted, clock on)\n");
  1398. GEL_TextOut(">3 = Transition in progress\n");
  1399. GEL_TextOut("\n");
  1400. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1401. {
  1402. GEL_TextOut("Module 0: EDMA3CC (1) STATE = %d\n",,,,, (pPSC1_MDSTAT[0] & 0x3F));
  1403. }
  1404. GEL_TextOut("Module 1: USB0 (2.0) STATE = %d\n",,,,, (pPSC1_MDSTAT[1] & 0x3F));
  1405. GEL_TextOut("Module 2: USB1 (1.1) STATE = %d\n",,,,, (pPSC1_MDSTAT[2] & 0x3F));
  1406. GEL_TextOut("Module 3: GPIO STATE = %d\n",,,,, (pPSC1_MDSTAT[3] & 0x3F));
  1407. GEL_TextOut("Module 4: UHPI STATE = %d\n",,,,, (pPSC1_MDSTAT[4] & 0x3F));
  1408. GEL_TextOut("Module 5: EMAC STATE = %d\n",,,,, (pPSC1_MDSTAT[5] & 0x3F));
  1409. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1410. {
  1411. GEL_TextOut("Module 6: DDR2 and SCR F3 STATE = %d\n",,,,, (pPSC1_MDSTAT[6] & 0x3F));
  1412. }
  1413. else
  1414. { // OMAP-L137 and variants
  1415. GEL_TextOut("Module 6: EMIFB (BR20) STATE = %d\n",,,,, (pPSC1_MDSTAT[6] & 0x3F));
  1416. }
  1417. GEL_TextOut("Module 7: MCASP0 + FIFO STATE = %d\n",,,,, (pPSC1_MDSTAT[7] & 0x3F));
  1418. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1419. {
  1420. GEL_TextOut("Module 8: SATA STATE = %d\n",,,,, (pPSC1_MDSTAT[8] & 0x3F));
  1421. }
  1422. else
  1423. { // OMAP-L137 and variants
  1424. GEL_TextOut("Module 8: MCASP1 + FIFO STATE = %d\n",,,,, (pPSC1_MDSTAT[8] & 0x3F));
  1425. }
  1426. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1427. {
  1428. GEL_TextOut("Module 9: VPIF STATE = %d\n",,,,, (pPSC1_MDSTAT[9] & 0x3F));
  1429. }
  1430. else
  1431. { // OMAP-L137 and variants
  1432. GEL_TextOut("Module 9: MCASP2 + FIFO STATE = %d\n",,,,, (pPSC1_MDSTAT[9] & 0x3F));
  1433. }
  1434. GEL_TextOut("Module 10: SPI 1 STATE = %d\n",,,,, (pPSC1_MDSTAT[10] & 0x3F));
  1435. GEL_TextOut("Module 11: I2C 1 STATE = %d\n",,,,, (pPSC1_MDSTAT[11] & 0x3F));
  1436. GEL_TextOut("Module 12: UART 1 STATE = %d\n",,,,, (pPSC1_MDSTAT[12] & 0x3F));
  1437. GEL_TextOut("Module 13: UART 2 STATE = %d\n",,,,, (pPSC1_MDSTAT[13] & 0x3F));
  1438. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1439. {
  1440. GEL_TextOut("Module 14: MCBSP0 + FIFO STATE = %d\n",,,,, (pPSC1_MDSTAT[14] & 0x3F));
  1441. }
  1442. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1443. {
  1444. GEL_TextOut("Module 15: MCBSP1 + FIFO STATE = %d\n",,,,, (pPSC1_MDSTAT[15] & 0x3F));
  1445. }
  1446. GEL_TextOut("Module 16: LCDC STATE = %d\n",,,,, (pPSC1_MDSTAT[16] & 0x3F));
  1447. GEL_TextOut("Module 17: eHRPWM (all) STATE = %d\n",,,,, (pPSC1_MDSTAT[17] & 0x3F));
  1448. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1449. {
  1450. GEL_TextOut("Module 18: MMC/SD 1 STATE = %d\n",,,,, (pPSC1_MDSTAT[18] & 0x3F));
  1451. }
  1452. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1453. {
  1454. GEL_TextOut("Module 19: UPP STATE = %d\n",,,,, (pPSC1_MDSTAT[19] & 0x3F));
  1455. }
  1456. GEL_TextOut("Module 20: eCAP (all) STATE = %d\n",,,,, (pPSC1_MDSTAT[20] & 0x3F));
  1457. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1458. {
  1459. GEL_TextOut("Module 21: EDMA3 TC2 STATE = %d\n",,,,, (pPSC1_MDSTAT[21] & 0x3F));
  1460. }
  1461. else
  1462. { // OMAP-L137 and variants
  1463. GEL_TextOut("Module 21: eQEP 0/1 STATE = %d\n",,,,, (pPSC1_MDSTAT[21] & 0x3F));
  1464. }
  1465. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1466. {
  1467. GEL_TextOut("Module 24: SCR-F0 Br-F0 STATE = %d\n",,,,, (pPSC1_MDSTAT[24] & 0x3F));
  1468. }
  1469. else
  1470. { // OMAP-L137 and variants
  1471. GEL_TextOut("Module 24: SCR8 (Br15) STATE = %d\n",,,,, (pPSC1_MDSTAT[24] & 0x3F));
  1472. }
  1473. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1474. {
  1475. GEL_TextOut("Module 25: SCR-F1 Br-F1 STATE = %d\n",,,,, (pPSC1_MDSTAT[25] & 0x3F));
  1476. }
  1477. else
  1478. { // OMAP-L137 and variants
  1479. GEL_TextOut("Module 25: SCR7 (Br12) STATE = %d\n",,,,, (pPSC1_MDSTAT[25] & 0x3F));
  1480. }
  1481. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1482. {
  1483. GEL_TextOut("Module 26: SCR-F2 Br-F2 STATE = %d\n",,,,, (pPSC1_MDSTAT[26] & 0x3F));
  1484. }
  1485. else
  1486. { // OMAP-L137 and variants
  1487. GEL_TextOut("Module 26: SCR12 (Br18) STATE = %d\n",,,,, (pPSC1_MDSTAT[26] & 0x3F));
  1488. }
  1489. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1490. {
  1491. GEL_TextOut("Module 27: SCR-F6 Br-F3 STATE = %d\n",,,,, (pPSC1_MDSTAT[27] & 0x3F));
  1492. GEL_TextOut("Module 28: SCR-F7 Br-F4 STATE = %d\n",,,,, (pPSC1_MDSTAT[28] & 0x3F));
  1493. GEL_TextOut("Module 29: SCR-F8 Br-F5 STATE = %d\n",,,,, (pPSC1_MDSTAT[29] & 0x3F));
  1494. GEL_TextOut("Module 30: Br-F7 (DDR Contr) STATE = %d\n",,,,, (pPSC1_MDSTAT[30] & 0x3F));
  1495. }
  1496. if ((revision0 % 2) == 0) // OMAP-L138 and pin-for-pin variants only
  1497. {
  1498. GEL_TextOut("Module 31: L3 RAM, SCR-F4, Br-F6 STATE = %d\n",,,,, (pPSC1_MDSTAT[31] & 0x3F));
  1499. }
  1500. else
  1501. { // OMAP-L137 and variants
  1502. GEL_TextOut("Module 31: L3 RAM (Br13) STATE = %d\n",,,,, (pPSC1_MDSTAT[31] & 0x3F));
  1503. }
  1504. }