orbit_boot_1066.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. // void inline orbit_writel(volatile void __iomem *addr, uint32_t data);
  2. // void inline orbit_readl_poll(volatile void __iomem *addr, uint32_t expected, uint32_t strobe);
  3. // void orbit_nsleep(int ns); // Sleep ns nano-seconds
  4. // void udelay(int us); // Sleep us micro-seconds
  5. //cdns_phy_initialize(1);
  6. #include <regconfig.h.sim_PI.h>
  7. #include <regconfig.h.sim_PHY.h>
  8. #include <sys.h>
  9. #include <clkgen_ctrl_macro.h>
  10. #include <comdef.h>
  11. #include <timer.h>
  12. void orbit_boot(uint32_t OMC_APB_BASE_ADDR, uint32_t OMC_SECURE_APB_BASE_ADDR, uint32_t PHY_APB_BASE_ADDR, u32 ddr_num)
  13. {
  14. u32 tmp = 0;
  15. int count = 0;
  16. int i = 0;
  17. //apb_write(OMC_APB_BASE_ADDR + 0x0, 0x00000401);
  18. apb_write(OMC_APB_BASE_ADDR + 0x0, 0x00000001);
  19. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf00, 0x40001030);
  20. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf04, 0x00000001);
  21. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf10, 0x00800000);
  22. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf14, 0x027fffff);
  23. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf18, 0x00000001);
  24. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf30, 0x0f000031);
  25. apb_write(OMC_SECURE_APB_BASE_ADDR + 0xf34, 0x0f000031);
  26. apb_write(OMC_SECURE_APB_BASE_ADDR + 0x110, 0xc0000001);
  27. apb_write(OMC_SECURE_APB_BASE_ADDR + 0x114, 0xffffffff);
  28. apb_write(OMC_APB_BASE_ADDR + 0x10c, 0x00000505);
  29. apb_write(OMC_APB_BASE_ADDR + 0x11c, 0x00000000);
  30. apb_write(OMC_APB_BASE_ADDR + 0x500, 0x00000201);
  31. apb_write(OMC_APB_BASE_ADDR + 0x514, 0x00000100);
  32. apb_write(OMC_APB_BASE_ADDR + 0x6a8, 0x00040000);
  33. apb_write(OMC_APB_BASE_ADDR + 0xea8, 0x00040000);
  34. // Memory frequency should be changed below 50MHz somewhere before here
  35. apb_write(OMC_APB_BASE_ADDR + 0x504, 0x40000000);
  36. udelay(300);
  37. //cdns_dll_rst_deassert()
  38. tmp = apb_read(OMC_APB_BASE_ADDR + 0x504);
  39. while((tmp & 0x80000000) != 0x80000000) {
  40. udelay(1);
  41. tmp = apb_read(OMC_APB_BASE_ADDR + 0x504);
  42. }
  43. apb_write(OMC_APB_BASE_ADDR + 0x504, 0x00000000);
  44. // tINIT0 is controlled by System
  45. apb_write(OMC_APB_BASE_ADDR + 0x50c, 0x00000000);
  46. // Waits tINIT1 (200 us): Minimum RESET_n LOW time after completion of voltage ramp
  47. udelay(300);
  48. apb_write(OMC_APB_BASE_ADDR + 0x50c, 0x00000001);
  49. // Waits tINIT3 (2 ms): Minimum CKE low time after RESET_n high
  50. udelay(3000);
  51. // Drive CKE high
  52. apb_write(OMC_APB_BASE_ADDR + 0x10, 0x0000003c);
  53. apb_write(OMC_APB_BASE_ADDR + 0x14, 0x00000001);
  54. // Waits tINIT5 (2 us): Minimum idle time before first MRW/MRR command
  55. udelay(4);
  56. apb_write(OMC_APB_BASE_ADDR + 0x310, 0x00020000);
  57. apb_write(OMC_APB_BASE_ADDR + 0x310, 0x00020001);
  58. // Write down RCLK-related CRs
  59. apb_write(OMC_APB_BASE_ADDR + 0x600, 0x002e0176);
  60. apb_write(OMC_APB_BASE_ADDR + 0x604, 0x002e0176);
  61. apb_write(OMC_APB_BASE_ADDR + 0x608, 0x001700bb);
  62. apb_write(OMC_APB_BASE_ADDR + 0x60c, 0x000b005d);
  63. apb_write(OMC_APB_BASE_ADDR + 0x610, 0x0005002e);
  64. apb_write(OMC_APB_BASE_ADDR + 0x614, 0x00020017);
  65. apb_write(OMC_APB_BASE_ADDR + 0x618, 0x00020017);
  66. apb_write(OMC_APB_BASE_ADDR + 0x61c, 0x00020017);
  67. apb_write(OMC_APB_BASE_ADDR + 0x678, 0x00000019);
  68. apb_write(OMC_APB_BASE_ADDR + 0x100, 0x000000f8);
  69. apb_write(OMC_APB_BASE_ADDR + 0x620, 0x03030404);
  70. apb_write(OMC_APB_BASE_ADDR + 0x624, 0x04030505);
  71. apb_write(OMC_APB_BASE_ADDR + 0x628, 0x07030884);
  72. apb_write(OMC_APB_BASE_ADDR + 0x62c, 0x13150401);
  73. apb_write(OMC_APB_BASE_ADDR + 0x630, 0x17150604);
  74. apb_write(OMC_APB_BASE_ADDR + 0x634, 0x00110000);
  75. apb_write(OMC_APB_BASE_ADDR + 0x638, 0x200a0a08);
  76. apb_write(OMC_APB_BASE_ADDR + 0x63c, 0x1730f803);
  77. apb_write(OMC_APB_BASE_ADDR + 0x640, 0x00080c00);
  78. apb_write(OMC_APB_BASE_ADDR + 0x644, 0xa0040007);
  79. apb_write(OMC_APB_BASE_ADDR + 0x648, 0x00000000);
  80. apb_write(OMC_APB_BASE_ADDR + 0x64c, 0x00081306);
  81. apb_write(OMC_APB_BASE_ADDR + 0x650, 0x04070304);
  82. apb_write(OMC_APB_BASE_ADDR + 0x654, 0x00000404);
  83. apb_write(OMC_APB_BASE_ADDR + 0x658, 0x00000060);
  84. apb_write(OMC_APB_BASE_ADDR + 0x65c, 0x00030008);
  85. apb_write(OMC_APB_BASE_ADDR + 0x660, 0x00000000);
  86. apb_write(OMC_APB_BASE_ADDR + 0x680, 0x00000603);
  87. apb_write(OMC_APB_BASE_ADDR + 0x684, 0x01000202);
  88. apb_write(OMC_APB_BASE_ADDR + 0x688, 0x0413040d);
  89. apb_write(OMC_APB_BASE_ADDR + 0x68c, 0x20002420);
  90. apb_write(OMC_APB_BASE_ADDR + 0x690, 0x00140000);
  91. apb_write(OMC_APB_BASE_ADDR + 0x69c, 0x01240074);
  92. apb_write(OMC_APB_BASE_ADDR + 0x6a0, 0x00000000);
  93. apb_write(OMC_APB_BASE_ADDR + 0x6a4, 0x20240c00);
  94. apb_write(OMC_APB_BASE_ADDR + 0x6a8, 0x00040000);
  95. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x30010006);
  96. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  97. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x30020000);
  98. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  99. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x30030031);
  100. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  101. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x300b0000);
  102. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  103. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x30160000);
  104. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  105. apb_write(OMC_APB_BASE_ADDR + 0x10, 0x00000010);
  106. apb_write(OMC_APB_BASE_ADDR + 0x14, 0x00000001);
  107. // Waits tZQCAL (1 us)
  108. udelay(4);
  109. apb_write(OMC_APB_BASE_ADDR + 0x10, 0x00000011);
  110. apb_write(OMC_APB_BASE_ADDR + 0x14, 0x00000001);
  111. apb_write(OMC_APB_BASE_ADDR + 0x10, 0x00000020);
  112. apb_write(OMC_APB_BASE_ADDR + 0x14, 0x00000001);
  113. // Waits tZQCAL (1 us)
  114. udelay(4);
  115. apb_write(OMC_APB_BASE_ADDR + 0x10, 0x00000021);
  116. apb_write(OMC_APB_BASE_ADDR + 0x14, 0x00000001);
  117. apb_write(OMC_APB_BASE_ADDR + 0x514, 0x00000000);
  118. tmp = apb_read(OMC_APB_BASE_ADDR + 0x518);
  119. while((tmp & 0x00000002) != 0x00000002) {
  120. udelay(1);
  121. tmp = apb_read(OMC_APB_BASE_ADDR + 0x518);
  122. }
  123. //------ training start ------
  124. tmp = apb_read(OMC_APB_BASE_ADDR + 0x518);
  125. while((tmp & 0x00000002) != 0x00000000) {
  126. tmp = apb_read(PHY_APB_BASE_ADDR + (0 +1 << 2)); //read freq_change_req_type
  127. if((tmp & 0x00000020) == 0x00000020) { //judge freq_change_req
  128. switch(tmp & 0x0000001f) { //judge freq_change_req_type
  129. case 0:
  130. if(ddr_num == 0) //ddrc_clock=12.5M
  131. {
  132. _SWITCH_CLOCK_clk_ddrc0_SOURCE_clk_ddrosc_div2_;
  133. udelay(100);
  134. }
  135. else
  136. {
  137. _SWITCH_CLOCK_clk_ddrc1_SOURCE_clk_ddrosc_div2_;
  138. udelay(100);
  139. }
  140. break;
  141. case 1:
  142. if(ddr_num == 0) //ddrc_clock=200M
  143. {
  144. _SWITCH_CLOCK_clk_ddrc0_SOURCE_clk_ddrpll_div4_;
  145. //_SWITCH_CLOCK_clk_ddrc0_SOURCE_clk_ddrosc_div2_;
  146. udelay(100);
  147. }
  148. else
  149. {
  150. _SWITCH_CLOCK_clk_ddrc1_SOURCE_clk_ddrpll_div4_;
  151. //_SWITCH_CLOCK_clk_ddrc1_SOURCE_clk_ddrosc_div2_;
  152. udelay(100);
  153. }
  154. break;
  155. case 2:
  156. if(ddr_num == 0) //ddrc_clock=400M
  157. {
  158. _SWITCH_CLOCK_clk_ddrc0_SOURCE_clk_ddrpll_div2_;
  159. //_SWITCH_CLOCK_clk_ddrc0_SOURCE_clk_ddrosc_div2_;
  160. udelay(100);
  161. }
  162. else
  163. {
  164. _SWITCH_CLOCK_clk_ddrc1_SOURCE_clk_ddrpll_div2_;
  165. //_SWITCH_CLOCK_clk_ddrc1_SOURCE_clk_ddrosc_div2_;
  166. udelay(100);
  167. }
  168. break;
  169. default:
  170. break;
  171. }
  172. apb_write(PHY_APB_BASE_ADDR + (0 +2 << 2), 0x01); //set freq_change_ack
  173. tmp = apb_read(PHY_APB_BASE_ADDR + (0 +2 << 2)); //read freq_change_ack
  174. count++;
  175. //printf("count = 0x%x\r\n", count);
  176. while((tmp & 0x00000001) != 0x00000000) {
  177. tmp = apb_read(PHY_APB_BASE_ADDR + (0 +2 << 2)); //read freq_change_ack
  178. }
  179. }
  180. udelay(1);
  181. tmp = apb_read(OMC_APB_BASE_ADDR + 0x518);
  182. }
  183. //------ training end --------
  184. //cdns_pi_end( 3);
  185. //apb_read(PHY_APB_BASE_ADDR + (16'd2048 +16'd11 <<2), tmp);//`DENALI_PI_11_DATA
  186. //apb_write(PHY_APB_BASE_ADDR + (16'd2048 +16'd11 <<2), tmp & ~4'hF | 4'h3);//set PI_CS_MAP=3
  187. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +83 <<2));//`DENALI_PI_83_DATA //read PI_INT_STATUS
  188. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +84 <<2));//`DENALI_PI_84_DATA
  189. apb_write(PHY_APB_BASE_ADDR + (2048 +84 <<2), tmp & 0xF8000000);
  190. //cdns_rdlvl_gate_tr_init( 3,0,0,0,0);
  191. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +46 <<2));//`DENALI_PI_46_DATA
  192. apb_write(PHY_APB_BASE_ADDR + (2048 +46 <<2), tmp & ~(0xF <<24) | (0x3 <<24));
  193. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +33 <<2));//`DENALI_PI_33_DATA
  194. apb_write(PHY_APB_BASE_ADDR + (2048 +33 <<2), tmp & ~(0x1<<24));
  195. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +44 <<2));//`DENALI_PI_44_DATA
  196. apb_write(PHY_APB_BASE_ADDR + (2048 +44 <<2), tmp & ~(0x1<<16));
  197. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +44 <<2));//`DENALI_PI_44_DATA
  198. apb_write(PHY_APB_BASE_ADDR + (2048 +44 <<2), tmp & ~(0x1<<24));
  199. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +45 <<2));//`DENALI_PI_45_DATA
  200. apb_write(PHY_APB_BASE_ADDR + (2048 +45 <<2), tmp | 0x1);
  201. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +146 <<2));//`DENALI_PI_146_DATA
  202. apb_write(PHY_APB_BASE_ADDR + (2048 +146 <<2), tmp | (0x3 <<24));
  203. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +147 <<2));//`DENALI_PI_147_DATA
  204. apb_write(PHY_APB_BASE_ADDR + (2048 +147 <<2), tmp | (0x3 <<8));
  205. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +147 <<2));//`DENALI_PI_147_DATA
  206. apb_write(PHY_APB_BASE_ADDR + (2048 +147 <<2), tmp | (0x3 <<24));
  207. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +44 <<2));//`DENALI_PI_44_DATA
  208. apb_write(PHY_APB_BASE_ADDR + (2048 +44 <<2), tmp | (0x1 <<8));
  209. //cdns_rdlvl_tr_init( 3,0,0,0,0);
  210. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +46 <<2));//`DENALI_PI_46_DATA
  211. apb_write(PHY_APB_BASE_ADDR + (2048 +46 <<2), tmp & ~(0xF <<16) | (0x3 <<16));
  212. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +33 <<2));//`DENALI_PI_33_DATA
  213. apb_write(PHY_APB_BASE_ADDR + (2048 +33 <<2), tmp & ~(0x1<<16));
  214. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +43 <<2));//`DENALI_PI_43_DATA
  215. apb_write(PHY_APB_BASE_ADDR + (2048 +43 <<2), tmp & ~(0x1<<16));
  216. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +43 <<2));//`DENALI_PI_43_DATA
  217. apb_write(PHY_APB_BASE_ADDR + (2048 +43 <<2), tmp & ~(0x1<<24));
  218. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +44 <<2));//`DENALI_PI_44_DATA
  219. apb_write(PHY_APB_BASE_ADDR + (2048 +44 <<2), tmp | 0x1);
  220. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +146 <<2));//`DENALI_PI_146_DATA
  221. apb_write(PHY_APB_BASE_ADDR + (2048 +146 <<2), tmp | (0x3 <<16));
  222. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +147 <<2));//`DENALI_PI_147_DATA
  223. apb_write(PHY_APB_BASE_ADDR + (2048 +147 <<2), tmp | 0x3);
  224. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +147 <<2));//`DENALI_PI_147_DATA
  225. apb_write(PHY_APB_BASE_ADDR + (2048 +147 <<2), tmp | (0x3 <<16));
  226. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +148 <<2));//`DENALI_PI_148_DATA
  227. apb_write(PHY_APB_BASE_ADDR + (2048 +148 <<2), tmp | (0x3 <<24));
  228. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +149 <<2));//`DENALI_PI_149_DATA
  229. apb_write(PHY_APB_BASE_ADDR + (2048 +149 <<2), tmp | (0x3 <<24));
  230. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +150 <<2));//`DENALI_PI_150_DATA
  231. apb_write(PHY_APB_BASE_ADDR + (2048 +150 <<2), tmp | (0x3 <<24));
  232. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +43 <<2));//`DENALI_PI_43_DATA
  233. apb_write(PHY_APB_BASE_ADDR + (2048 +43 <<2), tmp | (0x1 <<8));
  234. //cdns_wdqlvl_tr_init( 3,0,0,0,0);
  235. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +67 <<2));//`DENALI_PI_67_DATA
  236. apb_write(PHY_APB_BASE_ADDR + (2048 +67 <<2), tmp & ~(0xF <<8) | (0x3 <<8));
  237. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +68 <<2));//`DENALI_PI_68_DATA
  238. apb_write(PHY_APB_BASE_ADDR + (2048 +68 <<2), tmp & ~(0x1<<8));
  239. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +71 <<2));//`DENALI_PI_71_DATA
  240. apb_write(PHY_APB_BASE_ADDR + (2048 +71 <<2), tmp & ~(0x1<<16));
  241. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +71 <<2));//`DENALI_PI_71_DATA
  242. apb_write(PHY_APB_BASE_ADDR + (2048 +71 <<2), tmp & ~(0x1<<24));
  243. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +72 <<2));//`DENALI_PI_72_DATA
  244. apb_write(PHY_APB_BASE_ADDR + (2048 +72 <<2), tmp | (0x1 <<8));
  245. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +180 <<2));//`DENALI_PI_180_DATA
  246. apb_write(PHY_APB_BASE_ADDR + (2048 +180 <<2), tmp | (0x3 <<8));
  247. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +183 <<2));//`DENALI_PI_183_DATA
  248. apb_write(PHY_APB_BASE_ADDR + (2048 +183 <<2), tmp | (0x3 <<8));
  249. tmp = apb_read(PHY_APB_BASE_ADDR + (2048 +186 <<2));//`DENALI_PI_186_DATA
  250. apb_write(PHY_APB_BASE_ADDR + (2048 +186 <<2), tmp | (0x3 <<8));
  251. apb_write(OMC_APB_BASE_ADDR + 0x100, 0x000000e0);
  252. apb_write(OMC_APB_BASE_ADDR + 0x620, 0x03031417);
  253. apb_write(OMC_APB_BASE_ADDR + 0x624, 0x08100608);
  254. apb_write(OMC_APB_BASE_ADDR + 0x628, 0x402d0894);
  255. apb_write(OMC_APB_BASE_ADDR + 0x62c, 0x271e0b2b);
  256. apb_write(OMC_APB_BASE_ADDR + 0x630, 0x281b140a);
  257. apb_write(OMC_APB_BASE_ADDR + 0x634, 0x001c0000);
  258. apb_write(OMC_APB_BASE_ADDR + 0x638, 0x200f0f08);
  259. apb_write(OMC_APB_BASE_ADDR + 0x63c, 0x28410a06);//twrcsgap[11:8]>=a(2*5), trdcsgap[3:0]>=6(2*3)
  260. apb_write(OMC_APB_BASE_ADDR + 0x640, 0x01331f8b);
  261. apb_write(OMC_APB_BASE_ADDR + 0x644, 0x1096012b);
  262. apb_write(OMC_APB_BASE_ADDR + 0x648, 0x00000000);
  263. apb_write(OMC_APB_BASE_ADDR + 0x64c, 0x00082714);
  264. apb_write(OMC_APB_BASE_ADDR + 0x650, 0x16442f0d);
  265. apb_write(OMC_APB_BASE_ADDR + 0x654, 0x00001916);
  266. apb_write(OMC_APB_BASE_ADDR + 0x658, 0x00000060);
  267. apb_write(OMC_APB_BASE_ADDR + 0x65c, 0x00600020);
  268. apb_write(OMC_APB_BASE_ADDR + 0x660, 0x00000000);
  269. apb_write(OMC_APB_BASE_ADDR + 0x680, 0x0c00040f);//trdcslat=0xe->0xc;trddata_en=0xe->0xf
  270. apb_write(OMC_APB_BASE_ADDR + 0x684, 0x03000604);//twrcslat=0x4->0x3;twrlat=0x6;twrdata=0x4
  271. apb_write(OMC_APB_BASE_ADDR + 0x688, 0x0415040d);
  272. apb_write(OMC_APB_BASE_ADDR + 0x68c, 0x20002c20);
  273. apb_write(OMC_APB_BASE_ADDR + 0x690, 0x00140000);
  274. apb_write(OMC_APB_BASE_ADDR + 0x69c, 0x01240074);
  275. apb_write(OMC_APB_BASE_ADDR + 0x6a0, 0x00000000);
  276. apb_write(OMC_APB_BASE_ADDR + 0x6a4, 0x202c0c00);
  277. apb_write(OMC_APB_BASE_ADDR + 0x6a8, 0x00040000);
  278. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x30010036);
  279. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  280. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x3002001b);
  281. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  282. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x30030031);
  283. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  284. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x300b0036); //0x06->0x66
  285. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  286. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x3016001e); //0x06->0x1e
  287. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  288. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x300c0030); //vref(ca)
  289. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  290. apb_write(OMC_APB_BASE_ADDR + 0x4, 0x300e0020); //vref(dq)
  291. apb_write(OMC_APB_BASE_ADDR + 0xc, 0x00000002);
  292. apb_write(OMC_APB_BASE_ADDR + 0x410, 0x00101010);
  293. apb_write(OMC_APB_BASE_ADDR + 0x420, 0x0c181006);
  294. apb_write(OMC_APB_BASE_ADDR + 0x424, 0x20200820);
  295. apb_write(OMC_APB_BASE_ADDR + 0x428, 0x80000020);
  296. apb_write(OMC_APB_BASE_ADDR + 0x0, 0x00000001);
  297. apb_write(OMC_APB_BASE_ADDR + 0x108, 0x00003000);
  298. apb_write(OMC_SECURE_APB_BASE_ADDR + 0x704, 0x00000007);
  299. apb_write(OMC_APB_BASE_ADDR + 0x330, 0x09313fff);
  300. apb_write(OMC_APB_BASE_ADDR + 0x508, 0x00000013);
  301. apb_write(OMC_APB_BASE_ADDR + 0x324, 0x00002000);
  302. apb_write(OMC_APB_BASE_ADDR + 0x104, 0x90000000);
  303. apb_write(OMC_APB_BASE_ADDR + 0x510, 0x00000100);
  304. apb_write(OMC_APB_BASE_ADDR + 0x514, 0x00000000);
  305. apb_write(OMC_SECURE_APB_BASE_ADDR + 0x700, 0x00000003);
  306. apb_write(OMC_APB_BASE_ADDR + 0x514, 0x00000600);
  307. apb_write(OMC_APB_BASE_ADDR + 0x20, 0x00000001);
  308. }
  309. //cdns_per_tr_longcnt_set( 16);
  310. // Initialization done