Lines Matching +full:0 +full:xf004

40 static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff };
41 static const u8 extreginfo_ast2300[] = { 0x0f, 0x04, 0x1f, 0xff };
51 for (i = 0x81; i <= 0x9f; i++) in ast_set_def_ext_reg()
52 ast_set_index_reg(ast, AST_IO_VGACRI, i, 0x00); in ast_set_def_ext_reg()
59 index = 0xa0; in ast_set_def_ext_reg()
60 while (*ext_reg_info != 0xff) { in ast_set_def_ext_reg()
61 ast_set_index_reg_mask(ast, AST_IO_VGACRI, index, 0x00, *ext_reg_info); in ast_set_def_ext_reg()
67 /* ast_set_index_reg-mask(ast, AST_IO_VGACRI, 0xa1, 0xff, 0x3); */ in ast_set_def_ext_reg()
70 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0x8c, 0x00, 0x01); in ast_set_def_ext_reg()
71 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb7, 0x00, 0x00); in ast_set_def_ext_reg()
74 reg = 0x04; in ast_set_def_ext_reg()
76 reg |= 0x20; in ast_set_def_ext_reg()
77 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xb6, 0xff, reg); in ast_set_def_ext_reg()
84 __ast_write32(regs, 0xf004, r & 0xffff0000); in __ast_mindwm()
85 __ast_write32(regs, 0xf000, 0x1); in __ast_mindwm()
88 data = __ast_read32(regs, 0xf004) & 0xffff0000; in __ast_mindwm()
89 } while (data != (r & 0xffff0000)); in __ast_mindwm()
91 return __ast_read32(regs, 0x10000 + (r & 0x0000ffff)); in __ast_mindwm()
98 __ast_write32(regs, 0xf004, r & 0xffff0000); in __ast_moutdwm()
99 __ast_write32(regs, 0xf000, 0x1); in __ast_moutdwm()
102 data = __ast_read32(regs, 0xf004) & 0xffff0000; in __ast_moutdwm()
103 } while (data != (r & 0xffff0000)); in __ast_moutdwm()
105 __ast_write32(regs, 0x10000 + (r & 0x0000ffff), v); in __ast_moutdwm()
130 0xFF00FF00,
131 0xCC33CC33,
132 0xAA55AA55,
133 0xFFFE0001,
134 0x683501FE,
135 0x0F1929B0,
136 0x2D0B4346,
137 0x60767F02,
138 0x6FBE36A6,
139 0x3A253035,
140 0x3019686D,
141 0x41C6167E,
142 0x620152BF,
143 0x20F050E0
150 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmctestburst2_ast2150()
151 ast_moutdwm(ast, 0x1e6e0070, 0x00000001 | (datagen << 3)); in mmctestburst2_ast2150()
152 timeout = 0; in mmctestburst2_ast2150()
154 data = ast_mindwm(ast, 0x1e6e0070) & 0x40; in mmctestburst2_ast2150()
156 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmctestburst2_ast2150()
157 return 0xffffffff; in mmctestburst2_ast2150()
160 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmctestburst2_ast2150()
161 ast_moutdwm(ast, 0x1e6e0070, 0x00000003 | (datagen << 3)); in mmctestburst2_ast2150()
162 timeout = 0; in mmctestburst2_ast2150()
164 data = ast_mindwm(ast, 0x1e6e0070) & 0x40; in mmctestburst2_ast2150()
166 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmctestburst2_ast2150()
167 return 0xffffffff; in mmctestburst2_ast2150()
170 data = (ast_mindwm(ast, 0x1e6e0070) & 0x80) >> 7; in mmctestburst2_ast2150()
171 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmctestburst2_ast2150()
175 #if 0 /* unused in DDX driver - here for completeness */
180 ast_moutdwm(ast, 0x1e6e0070, 0x00000000);
181 ast_moutdwm(ast, 0x1e6e0070, 0x00000005 | (datagen << 3));
182 timeout = 0;
184 data = ast_mindwm(ast, 0x1e6e0070) & 0x40;
186 ast_moutdwm(ast, 0x1e6e0070, 0x00000000);
187 return 0xffffffff;
190 data = (ast_mindwm(ast, 0x1e6e0070) & 0x80) >> 7;
191 ast_moutdwm(ast, 0x1e6e0070, 0x00000000);
200 for (i = 0; i < 8; i++) in cbrtest_ast2150()
202 return 0; in cbrtest_ast2150()
210 for (patcnt = 0; patcnt < CBR_PATNUM_AST2150; patcnt++) { in cbrscan_ast2150()
211 ast_moutdwm(ast, 0x1e6e007c, pattern_AST2150[patcnt]); in cbrscan_ast2150()
212 for (loop = 0; loop < CBR_PASSNUM_AST2150; loop++) { in cbrscan_ast2150()
217 return 0; in cbrscan_ast2150()
228 dll_min[0] = dll_min[1] = dll_min[2] = dll_min[3] = 0xff; in cbrdlli_ast2150()
229 dll_max[0] = dll_max[1] = dll_max[2] = dll_max[3] = 0x0; in cbrdlli_ast2150()
230 passcnt = 0; in cbrdlli_ast2150()
232 for (dlli = 0; dlli < 100; dlli++) { in cbrdlli_ast2150()
233 ast_moutdwm(ast, 0x1e6e0068, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24)); in cbrdlli_ast2150()
235 if (data != 0) { in cbrdlli_ast2150()
236 if (data & 0x1) { in cbrdlli_ast2150()
237 if (dll_min[0] > dlli) in cbrdlli_ast2150()
238 dll_min[0] = dlli; in cbrdlli_ast2150()
239 if (dll_max[0] < dlli) in cbrdlli_ast2150()
240 dll_max[0] = dlli; in cbrdlli_ast2150()
246 if (dll_max[0] == 0 || (dll_max[0]-dll_min[0]) < CBR_THRESHOLD_AST2150) in cbrdlli_ast2150()
249 dlli = dll_min[0] + (((dll_max[0] - dll_min[0]) * 7) >> 4); in cbrdlli_ast2150()
250 ast_moutdwm(ast, 0x1e6e0068, dlli | (dlli << 8) | (dlli << 16) | (dlli << 24)); in cbrdlli_ast2150()
262 j = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff); in ast_init_dram_reg()
264 if ((j & 0x80) == 0) { /* VGA only */ in ast_init_dram_reg()
267 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_init_dram_reg()
268 ast_write32(ast, 0xf000, 0x1); in ast_init_dram_reg()
269 ast_write32(ast, 0x10100, 0xa8); in ast_init_dram_reg()
273 } while (ast_read32(ast, 0x10100) != 0xa8); in ast_init_dram_reg()
280 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_init_dram_reg()
281 ast_write32(ast, 0xf000, 0x1); in ast_init_dram_reg()
282 ast_write32(ast, 0x12000, 0x1688A8A8); in ast_init_dram_reg()
285 } while (ast_read32(ast, 0x12000) != 0x01); in ast_init_dram_reg()
287 ast_write32(ast, 0x10000, 0xfc600309); in ast_init_dram_reg()
290 } while (ast_read32(ast, 0x10000) != 0x01); in ast_init_dram_reg()
293 while (dram_reg_info->index != 0xffff) { in ast_init_dram_reg()
294 if (dram_reg_info->index == 0xff00) {/* delay fn */ in ast_init_dram_reg()
295 for (i = 0; i < 15; i++) in ast_init_dram_reg()
297 } else if (dram_reg_info->index == 0x4 && !IS_AST_GEN1(ast)) { in ast_init_dram_reg()
300 data = 0x00000d89; in ast_init_dram_reg()
302 data = 0x00000c8d; in ast_init_dram_reg()
304 temp = ast_read32(ast, 0x12070); in ast_init_dram_reg()
305 temp &= 0xc; in ast_init_dram_reg()
307 ast_write32(ast, 0x10000 + dram_reg_info->index, data | temp); in ast_init_dram_reg()
309 ast_write32(ast, 0x10000 + dram_reg_info->index, dram_reg_info->data); in ast_init_dram_reg()
314 data = ast_read32(ast, 0x10120); in ast_init_dram_reg()
315 if (data == 0x5061) { /* 266Mhz */ in ast_init_dram_reg()
316 data = ast_read32(ast, 0x10004); in ast_init_dram_reg()
317 if (data & 0x40) in ast_init_dram_reg()
325 temp = ast_read32(ast, 0x10140); in ast_init_dram_reg()
326 ast_write32(ast, 0x10140, temp | 0x40); in ast_init_dram_reg()
330 temp = ast_read32(ast, 0x1200c); in ast_init_dram_reg()
331 ast_write32(ast, 0x1200c, temp & 0xfffffffd); in ast_init_dram_reg()
332 temp = ast_read32(ast, 0x12040); in ast_init_dram_reg()
333 ast_write32(ast, 0x12040, temp | 0x40); in ast_init_dram_reg()
342 j = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff); in ast_init_dram_reg()
343 } while ((j & 0x40) == 0); in ast_init_dram_reg()
366 ast_set_index_reg_mask(ast, AST_IO_VGACRI, 0xa3, 0xcf, 0x80); /* Enable DVO */ in ast_post_gpu()
371 #define AST_DDR3 0
413 0xFF00FF00,
414 0xCC33CC33,
415 0xAA55AA55,
416 0x88778877,
417 0x92CC4D6E,
418 0x543D3CDE,
419 0xF1E843C7,
420 0x7C61D253
427 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmc_test()
428 ast_moutdwm(ast, 0x1e6e0070, (datagen << 3) | test_ctl); in mmc_test()
429 timeout = 0; in mmc_test()
431 data = ast_mindwm(ast, 0x1e6e0070) & 0x3000; in mmc_test()
432 if (data & 0x2000) in mmc_test()
435 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmc_test()
439 ast_moutdwm(ast, 0x1e6e0070, 0x0); in mmc_test()
447 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmc_test2()
448 ast_moutdwm(ast, 0x1e6e0070, (datagen << 3) | test_ctl); in mmc_test2()
449 timeout = 0; in mmc_test2()
451 data = ast_mindwm(ast, 0x1e6e0070) & 0x1000; in mmc_test2()
453 ast_moutdwm(ast, 0x1e6e0070, 0x0); in mmc_test2()
454 return 0xffffffff; in mmc_test2()
457 data = ast_mindwm(ast, 0x1e6e0078); in mmc_test2()
458 data = (data | (data >> 16)) & 0xffff; in mmc_test2()
459 ast_moutdwm(ast, 0x1e6e0070, 0x00000000); in mmc_test2()
466 return mmc_test(ast, datagen, 0xc1); in mmc_test_burst()
471 return mmc_test2(ast, datagen, 0x41); in mmc_test_burst2()
476 return mmc_test(ast, datagen, 0xc5); in mmc_test_single()
481 return mmc_test2(ast, datagen, 0x05); in mmc_test_single2()
486 return mmc_test(ast, datagen, 0x85); in mmc_test_single_2500()
493 data = mmc_test_single2(ast, 0); in cbr_test()
494 if ((data & 0xff) && (data & 0xff00)) in cbr_test()
495 return 0; in cbr_test()
496 for (i = 0; i < 8; i++) { in cbr_test()
498 if ((data & 0xff) && (data & 0xff00)) in cbr_test()
499 return 0; in cbr_test()
503 else if (data & 0xff) in cbr_test()
513 for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) { in cbr_scan()
514 ast_moutdwm(ast, 0x1e6e007c, pattern[patcnt]); in cbr_scan()
515 for (loop = 0; loop < CBR_PASSNUM2; loop++) { in cbr_scan()
516 if ((data = cbr_test(ast)) != 0) { in cbr_scan()
519 return 0; in cbr_scan()
524 return 0; in cbr_scan()
533 data = mmc_test_burst2(ast, 0); in cbr_test2()
534 if (data == 0xffff) in cbr_test2()
535 return 0; in cbr_test2()
536 data |= mmc_test_single2(ast, 0); in cbr_test2()
537 if (data == 0xffff) in cbr_test2()
538 return 0; in cbr_test2()
540 return ~data & 0xffff; in cbr_test2()
547 data2 = 0xffff; in cbr_scan2()
548 for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) { in cbr_scan2()
549 ast_moutdwm(ast, 0x1e6e007c, pattern[patcnt]); in cbr_scan2()
550 for (loop = 0; loop < CBR_PASSNUM2; loop++) { in cbr_scan2()
551 if ((data = cbr_test2(ast)) != 0) { in cbr_scan2()
554 return 0; in cbr_scan2()
559 return 0; in cbr_scan2()
566 if (!mmc_test_burst(ast, 0)) in cbr_test3()
568 if (!mmc_test_single(ast, 0)) in cbr_test3()
577 for (patcnt = 0; patcnt < CBR_PATNUM; patcnt++) { in cbr_scan3()
578 ast_moutdwm(ast, 0x1e6e007c, pattern[patcnt]); in cbr_scan3()
579 for (loop = 0; loop < 2; loop++) { in cbr_scan3()
591 u32 gold_sadj[2], dllmin[16], dllmax[16], dlli, data, cnt, mask, passcnt, retry = 0; in finetuneDQI_L()
594 for (cnt = 0; cnt < 16; cnt++) { in finetuneDQI_L()
595 dllmin[cnt] = 0xff; in finetuneDQI_L()
596 dllmax[cnt] = 0x0; in finetuneDQI_L()
598 passcnt = 0; in finetuneDQI_L()
599 for (dlli = 0; dlli < 76; dlli++) { in finetuneDQI_L()
600 ast_moutdwm(ast, 0x1E6E0068, 0x00001400 | (dlli << 16) | (dlli << 24)); in finetuneDQI_L()
601 ast_moutdwm(ast, 0x1E6E0074, CBR_SIZE1); in finetuneDQI_L()
603 if (data != 0) { in finetuneDQI_L()
604 mask = 0x00010001; in finetuneDQI_L()
605 for (cnt = 0; cnt < 16; cnt++) { in finetuneDQI_L()
621 gold_sadj[0] = 0x0; in finetuneDQI_L()
622 passcnt = 0; in finetuneDQI_L()
623 for (cnt = 0; cnt < 16; cnt++) { in finetuneDQI_L()
625 gold_sadj[0] += dllmin[cnt]; in finetuneDQI_L()
636 gold_sadj[0] = gold_sadj[0] >> 4; in finetuneDQI_L()
637 gold_sadj[1] = gold_sadj[0]; in finetuneDQI_L()
639 data = 0; in finetuneDQI_L()
640 for (cnt = 0; cnt < 8; cnt++) { in finetuneDQI_L()
644 if (gold_sadj[0] >= dlli) { in finetuneDQI_L()
645 dlli = ((gold_sadj[0] - dlli) * 19) >> 5; in finetuneDQI_L()
650 dlli = ((dlli - gold_sadj[0]) * 19) >> 5; in finetuneDQI_L()
654 dlli = (8 - dlli) & 0x7; in finetuneDQI_L()
659 ast_moutdwm(ast, 0x1E6E0080, data); in finetuneDQI_L()
661 data = 0; in finetuneDQI_L()
671 dlli = (dlli - 1) & 0x7; in finetuneDQI_L()
679 dlli = (8 - dlli) & 0x7; in finetuneDQI_L()
684 ast_moutdwm(ast, 0x1E6E0084, data); in finetuneDQI_L()
697 reg_mcr0c = ast_mindwm(ast, 0x1E6E000C); in finetuneDQSI()
698 reg_mcr18 = ast_mindwm(ast, 0x1E6E0018); in finetuneDQSI()
699 reg_mcr18 &= 0x0000ffff; in finetuneDQSI()
700 ast_moutdwm(ast, 0x1E6E0018, reg_mcr18); in finetuneDQSI()
702 for (dlli = 0; dlli < 76; dlli++) { in finetuneDQSI()
703 tag[0][dlli] = 0x0; in finetuneDQSI()
704 tag[1][dlli] = 0x0; in finetuneDQSI()
706 for (dqidly = 0; dqidly < 32; dqidly++) { in finetuneDQSI()
707 pass[dqidly][0][0] = 0xff; in finetuneDQSI()
708 pass[dqidly][0][1] = 0x0; in finetuneDQSI()
709 pass[dqidly][1][0] = 0xff; in finetuneDQSI()
710 pass[dqidly][1][1] = 0x0; in finetuneDQSI()
712 for (dqidly = 0; dqidly < 32; dqidly++) { in finetuneDQSI()
713 passcnt[0] = passcnt[1] = 0; in finetuneDQSI()
714 for (dqsip = 0; dqsip < 2; dqsip++) { in finetuneDQSI()
715 ast_moutdwm(ast, 0x1E6E000C, 0); in finetuneDQSI()
716 ast_moutdwm(ast, 0x1E6E0018, reg_mcr18 | (dqidly << 16) | (dqsip << 23)); in finetuneDQSI()
717 ast_moutdwm(ast, 0x1E6E000C, reg_mcr0c); in finetuneDQSI()
718 for (dlli = 0; dlli < 76; dlli++) { in finetuneDQSI()
719 ast_moutdwm(ast, 0x1E6E0068, 0x00001300 | (dlli << 16) | (dlli << 24)); in finetuneDQSI()
720 ast_moutdwm(ast, 0x1E6E0070, 0); in finetuneDQSI()
721 ast_moutdwm(ast, 0x1E6E0074, CBR_SIZE0); in finetuneDQSI()
723 if (dlli == 0) in finetuneDQSI()
727 if (dlli < pass[dqidly][dqsip][0]) in finetuneDQSI()
728 pass[dqidly][dqsip][0] = (u16) dlli; in finetuneDQSI()
734 pass[dqidly][dqsip][0] = 0xff; in finetuneDQSI()
735 pass[dqidly][dqsip][1] = 0x0; in finetuneDQSI()
739 if (passcnt[0] == 0 && passcnt[1] == 0) in finetuneDQSI()
743 g_dqidly = g_dqsip = g_margin = g_side = 0; in finetuneDQSI()
745 for (dqidly = 0; dqidly < 32; dqidly++) { in finetuneDQSI()
746 for (dqsip = 0; dqsip < 2; dqsip++) { in finetuneDQSI()
747 if (pass[dqidly][dqsip][0] > pass[dqidly][dqsip][1]) in finetuneDQSI()
749 diff = pass[dqidly][dqsip][1] - pass[dqidly][dqsip][0]; in finetuneDQSI()
752 passcnt[0] = passcnt[1] = 0; in finetuneDQSI()
753 for (dlli = pass[dqidly][dqsip][0]; dlli > 0 && tag[dqsip][dlli] != 0; dlli--, passcnt[0]++); in finetuneDQSI()
754 for (dlli = pass[dqidly][dqsip][1]; dlli < 76 && tag[dqsip][dlli] != 0; dlli++, passcnt[1]++); in finetuneDQSI()
755 if (passcnt[0] > passcnt[1]) in finetuneDQSI()
756 passcnt[0] = passcnt[1]; in finetuneDQSI()
757 passcnt[1] = 0; in finetuneDQSI()
758 if (passcnt[0] > g_side) in finetuneDQSI()
759 passcnt[1] = passcnt[0] - g_side; in finetuneDQSI()
760 if (diff > (g_margin+1) && (passcnt[1] > 0 || passcnt[0] > 8)) { in finetuneDQSI()
764 g_side = passcnt[0]; in finetuneDQSI()
770 g_side = passcnt[0]; in finetuneDQSI()
775 ast_moutdwm(ast, 0x1E6E0018, reg_mcr18); in finetuneDQSI()
780 u32 dllmin[2], dllmax[2], dlli, data, passcnt, retry = 0; in cbr_dll2()
788 dllmin[0] = dllmin[1] = 0xff; in cbr_dll2()
789 dllmax[0] = dllmax[1] = 0x0; in cbr_dll2()
790 passcnt = 0; in cbr_dll2()
791 for (dlli = 0; dlli < 76; dlli++) { in cbr_dll2()
792 ast_moutdwm(ast, 0x1E6E0068, 0x00001300 | (dlli << 16) | (dlli << 24)); in cbr_dll2()
793 ast_moutdwm(ast, 0x1E6E0074, CBR_SIZE2); in cbr_dll2()
795 if (data != 0) { in cbr_dll2()
796 if (data & 0x1) { in cbr_dll2()
797 if (dllmin[0] > dlli) { in cbr_dll2()
798 dllmin[0] = dlli; in cbr_dll2()
800 if (dllmax[0] < dlli) { in cbr_dll2()
801 dllmax[0] = dlli; in cbr_dll2()
804 if (data & 0x2) { in cbr_dll2()
819 if (dllmax[0] == 0 || (dllmax[0]-dllmin[0]) < CBR_THRESHOLD) { in cbr_dll2()
822 if (dllmax[1] == 0 || (dllmax[1]-dllmin[1]) < CBR_THRESHOLD) { in cbr_dll2()
829 dlli += (dllmin[0] + dllmax[0]) >> 1; in cbr_dll2()
830 ast_moutdwm(ast, 0x1E6E0068, ast_mindwm(ast, 0x1E720058) | (dlli << 16)); in cbr_dll2()
838 ast_moutdwm(ast, 0x1E6E2000, 0x1688A8A8); in get_ddr3_info()
841 trap = (ast_mindwm(ast, 0x1E6E2070) >> 25) & 0x3; in get_ddr3_info()
842 trap_AC2 = 0x00020000 + (trap << 16); in get_ddr3_info()
843 trap_AC2 |= 0x00300000 + ((trap & 0x2) << 19); in get_ddr3_info()
844 trap_MRS = 0x00000010 + (trap << 4); in get_ddr3_info()
845 trap_MRS |= ((trap & 0x2) << 18); in get_ddr3_info()
847 param->reg_MADJ = 0x00034C4C; in get_ddr3_info()
848 param->reg_SADJ = 0x00001800; in get_ddr3_info()
849 param->reg_DRV = 0x000000F0; in get_ddr3_info()
851 param->rodt = 0; in get_ddr3_info()
855 ast_moutdwm(ast, 0x1E6E2020, 0x0190); in get_ddr3_info()
856 param->wodt = 0; in get_ddr3_info()
857 param->reg_AC1 = 0x22202725; in get_ddr3_info()
858 param->reg_AC2 = 0xAA007613 | trap_AC2; in get_ddr3_info()
859 param->reg_DQSIC = 0x000000BA; in get_ddr3_info()
860 param->reg_MRS = 0x04001400 | trap_MRS; in get_ddr3_info()
861 param->reg_EMRS = 0x00000000; in get_ddr3_info()
862 param->reg_IOZ = 0x00000023; in get_ddr3_info()
863 param->reg_DQIDLY = 0x00000074; in get_ddr3_info()
864 param->reg_FREQ = 0x00004DC0; in get_ddr3_info()
871 param->reg_AC2 = 0xAA007613 | trap_AC2; in get_ddr3_info()
874 param->reg_AC2 = 0xAA00761C | trap_AC2; in get_ddr3_info()
877 param->reg_AC2 = 0xAA007636 | trap_AC2; in get_ddr3_info()
883 ast_moutdwm(ast, 0x1E6E2020, 0x03F1); in get_ddr3_info()
885 param->reg_AC1 = 0x33302825; in get_ddr3_info()
886 param->reg_AC2 = 0xCC009617 | trap_AC2; in get_ddr3_info()
887 param->reg_DQSIC = 0x000000E2; in get_ddr3_info()
888 param->reg_MRS = 0x04001600 | trap_MRS; in get_ddr3_info()
889 param->reg_EMRS = 0x00000000; in get_ddr3_info()
890 param->reg_IOZ = 0x00000034; in get_ddr3_info()
891 param->reg_DRV = 0x000000FA; in get_ddr3_info()
892 param->reg_DQIDLY = 0x00000089; in get_ddr3_info()
893 param->reg_FREQ = 0x00005040; in get_ddr3_info()
901 param->reg_AC2 = 0xCC009617 | trap_AC2; in get_ddr3_info()
904 param->reg_AC2 = 0xCC009622 | trap_AC2; in get_ddr3_info()
907 param->reg_AC2 = 0xCC00963F | trap_AC2; in get_ddr3_info()
913 ast_moutdwm(ast, 0x1E6E2020, 0x01F0); in get_ddr3_info()
915 param->reg_AC1 = 0x33302825; in get_ddr3_info()
916 param->reg_AC2 = 0xCC009617 | trap_AC2; in get_ddr3_info()
917 param->reg_DQSIC = 0x000000E2; in get_ddr3_info()
918 param->reg_MRS = 0x04001600 | trap_MRS; in get_ddr3_info()
919 param->reg_EMRS = 0x00000000; in get_ddr3_info()
920 param->reg_IOZ = 0x00000023; in get_ddr3_info()
921 param->reg_DRV = 0x000000FA; in get_ddr3_info()
922 param->reg_DQIDLY = 0x00000089; in get_ddr3_info()
923 param->reg_FREQ = 0x000050C0; in get_ddr3_info()
931 param->reg_AC2 = 0xCC009617 | trap_AC2; in get_ddr3_info()
934 param->reg_AC2 = 0xCC009622 | trap_AC2; in get_ddr3_info()
937 param->reg_AC2 = 0xCC00963F | trap_AC2; in get_ddr3_info()
943 ast_moutdwm(ast, 0x1E6E2020, 0x0230); in get_ddr3_info()
944 param->wodt = 0; in get_ddr3_info()
945 param->reg_AC1 = 0x33302926; in get_ddr3_info()
946 param->reg_AC2 = 0xCD44961A; in get_ddr3_info()
947 param->reg_DQSIC = 0x000000FC; in get_ddr3_info()
948 param->reg_MRS = 0x00081830; in get_ddr3_info()
949 param->reg_EMRS = 0x00000000; in get_ddr3_info()
950 param->reg_IOZ = 0x00000045; in get_ddr3_info()
951 param->reg_DQIDLY = 0x00000097; in get_ddr3_info()
952 param->reg_FREQ = 0x000052C0; in get_ddr3_info()
957 ast_moutdwm(ast, 0x1E6E2020, 0x0270); in get_ddr3_info()
959 param->reg_AC1 = 0x33302926; in get_ddr3_info()
960 param->reg_AC2 = 0xDE44A61D; in get_ddr3_info()
961 param->reg_DQSIC = 0x00000117; in get_ddr3_info()
962 param->reg_MRS = 0x00081A30; in get_ddr3_info()
963 param->reg_EMRS = 0x00000000; in get_ddr3_info()
964 param->reg_IOZ = 0x070000BB; in get_ddr3_info()
965 param->reg_DQIDLY = 0x000000A0; in get_ddr3_info()
966 param->reg_FREQ = 0x000054C0; in get_ddr3_info()
971 ast_moutdwm(ast, 0x1E6E2020, 0x0290); in get_ddr3_info()
974 param->reg_AC1 = 0x33302926; in get_ddr3_info()
975 param->reg_AC2 = 0xEF44B61E; in get_ddr3_info()
976 param->reg_DQSIC = 0x00000125; in get_ddr3_info()
977 param->reg_MRS = 0x00081A30; in get_ddr3_info()
978 param->reg_EMRS = 0x00000040; in get_ddr3_info()
979 param->reg_DRV = 0x000000F5; in get_ddr3_info()
980 param->reg_IOZ = 0x00000023; in get_ddr3_info()
981 param->reg_DQIDLY = 0x00000088; in get_ddr3_info()
982 param->reg_FREQ = 0x000055C0; in get_ddr3_info()
987 ast_moutdwm(ast, 0x1E6E2020, 0x0140); in get_ddr3_info()
988 param->reg_MADJ = 0x00136868; in get_ddr3_info()
989 param->reg_SADJ = 0x00004534; in get_ddr3_info()
992 param->reg_AC1 = 0x33302A37; in get_ddr3_info()
993 param->reg_AC2 = 0xEF56B61E; in get_ddr3_info()
994 param->reg_DQSIC = 0x0000013F; in get_ddr3_info()
995 param->reg_MRS = 0x00101A50; in get_ddr3_info()
996 param->reg_EMRS = 0x00000040; in get_ddr3_info()
997 param->reg_DRV = 0x000000FA; in get_ddr3_info()
998 param->reg_IOZ = 0x00000023; in get_ddr3_info()
999 param->reg_DQIDLY = 0x00000078; in get_ddr3_info()
1000 param->reg_FREQ = 0x000057C0; in get_ddr3_info()
1005 ast_moutdwm(ast, 0x1E6E2020, 0x02E1); in get_ddr3_info()
1006 param->reg_MADJ = 0x00136868; in get_ddr3_info()
1007 param->reg_SADJ = 0x00004534; in get_ddr3_info()
1010 param->reg_AC1 = 0x32302A37; in get_ddr3_info()
1011 param->reg_AC2 = 0xDF56B61F; in get_ddr3_info()
1012 param->reg_DQSIC = 0x0000014D; in get_ddr3_info()
1013 param->reg_MRS = 0x00101A50; in get_ddr3_info()
1014 param->reg_EMRS = 0x00000004; in get_ddr3_info()
1015 param->reg_DRV = 0x000000F5; in get_ddr3_info()
1016 param->reg_IOZ = 0x00000023; in get_ddr3_info()
1017 param->reg_DQIDLY = 0x00000078; in get_ddr3_info()
1018 param->reg_FREQ = 0x000058C0; in get_ddr3_info()
1023 ast_moutdwm(ast, 0x1E6E2020, 0x0160); in get_ddr3_info()
1024 param->reg_MADJ = 0x00136868; in get_ddr3_info()
1025 param->reg_SADJ = 0x00004534; in get_ddr3_info()
1028 param->reg_AC1 = 0x32302A37; in get_ddr3_info()
1029 param->reg_AC2 = 0xEF56B621; in get_ddr3_info()
1030 param->reg_DQSIC = 0x0000015A; in get_ddr3_info()
1031 param->reg_MRS = 0x02101A50; in get_ddr3_info()
1032 param->reg_EMRS = 0x00000004; in get_ddr3_info()
1033 param->reg_DRV = 0x000000F5; in get_ddr3_info()
1034 param->reg_IOZ = 0x00000034; in get_ddr3_info()
1035 param->reg_DQIDLY = 0x00000078; in get_ddr3_info()
1036 param->reg_FREQ = 0x000059C0; in get_ddr3_info()
1044 param->dram_config = 0x130; in get_ddr3_info()
1048 param->dram_config = 0x131; in get_ddr3_info()
1051 param->dram_config = 0x132; in get_ddr3_info()
1054 param->dram_config = 0x133; in get_ddr3_info()
1061 param->dram_config |= 0x00; in get_ddr3_info()
1064 param->dram_config |= 0x04; in get_ddr3_info()
1067 param->dram_config |= 0x08; in get_ddr3_info()
1070 param->dram_config |= 0x0c; in get_ddr3_info()
1078 u32 data, data2, retry = 0; in ddr3_init()
1081 ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); in ddr3_init()
1082 ast_moutdwm(ast, 0x1E6E0018, 0x00000100); in ddr3_init()
1083 ast_moutdwm(ast, 0x1E6E0024, 0x00000000); in ddr3_init()
1084 ast_moutdwm(ast, 0x1E6E0034, 0x00000000); in ddr3_init()
1086 ast_moutdwm(ast, 0x1E6E0064, param->reg_MADJ); in ddr3_init()
1087 ast_moutdwm(ast, 0x1E6E0068, param->reg_SADJ); in ddr3_init()
1089 ast_moutdwm(ast, 0x1E6E0064, param->reg_MADJ | 0xC0000); in ddr3_init()
1092 ast_moutdwm(ast, 0x1E6E0004, param->dram_config); in ddr3_init()
1093 ast_moutdwm(ast, 0x1E6E0008, 0x90040f); in ddr3_init()
1094 ast_moutdwm(ast, 0x1E6E0010, param->reg_AC1); in ddr3_init()
1095 ast_moutdwm(ast, 0x1E6E0014, param->reg_AC2); in ddr3_init()
1096 ast_moutdwm(ast, 0x1E6E0020, param->reg_DQSIC); in ddr3_init()
1097 ast_moutdwm(ast, 0x1E6E0080, 0x00000000); in ddr3_init()
1098 ast_moutdwm(ast, 0x1E6E0084, 0x00000000); in ddr3_init()
1099 ast_moutdwm(ast, 0x1E6E0088, param->reg_DQIDLY); in ddr3_init()
1100 ast_moutdwm(ast, 0x1E6E0018, 0x4000A170); in ddr3_init()
1101 ast_moutdwm(ast, 0x1E6E0018, 0x00002370); in ddr3_init()
1102 ast_moutdwm(ast, 0x1E6E0038, 0x00000000); in ddr3_init()
1103 ast_moutdwm(ast, 0x1E6E0040, 0xFF444444); in ddr3_init()
1104 ast_moutdwm(ast, 0x1E6E0044, 0x22222222); in ddr3_init()
1105 ast_moutdwm(ast, 0x1E6E0048, 0x22222222); in ddr3_init()
1106 ast_moutdwm(ast, 0x1E6E004C, 0x00000002); in ddr3_init()
1107 ast_moutdwm(ast, 0x1E6E0050, 0x80000000); in ddr3_init()
1108 ast_moutdwm(ast, 0x1E6E0050, 0x00000000); in ddr3_init()
1109 ast_moutdwm(ast, 0x1E6E0054, 0); in ddr3_init()
1110 ast_moutdwm(ast, 0x1E6E0060, param->reg_DRV); in ddr3_init()
1111 ast_moutdwm(ast, 0x1E6E006C, param->reg_IOZ); in ddr3_init()
1112 ast_moutdwm(ast, 0x1E6E0070, 0x00000000); in ddr3_init()
1113 ast_moutdwm(ast, 0x1E6E0074, 0x00000000); in ddr3_init()
1114 ast_moutdwm(ast, 0x1E6E0078, 0x00000000); in ddr3_init()
1115 ast_moutdwm(ast, 0x1E6E007C, 0x00000000); in ddr3_init()
1118 data = ast_mindwm(ast, 0x1E6E001C); in ddr3_init()
1119 } while (!(data & 0x08000000)); in ddr3_init()
1120 data = ast_mindwm(ast, 0x1E6E001C); in ddr3_init()
1121 data = (data >> 8) & 0xff; in ddr3_init()
1122 while ((data & 0x08) || ((data & 0x7) < 2) || (data < 4)) { in ddr3_init()
1123 data2 = (ast_mindwm(ast, 0x1E6E0064) & 0xfff3ffff) + 4; in ddr3_init()
1124 if ((data2 & 0xff) > param->madj_max) { in ddr3_init()
1127 ast_moutdwm(ast, 0x1E6E0064, data2); in ddr3_init()
1128 if (data2 & 0x00100000) { in ddr3_init()
1129 data2 = ((data2 & 0xff) >> 3) + 3; in ddr3_init()
1131 data2 = ((data2 & 0xff) >> 2) + 5; in ddr3_init()
1133 data = ast_mindwm(ast, 0x1E6E0068) & 0xffff00ff; in ddr3_init()
1134 data2 += data & 0xff; in ddr3_init()
1136 ast_moutdwm(ast, 0x1E6E0068, data); in ddr3_init()
1138 ast_moutdwm(ast, 0x1E6E0064, ast_mindwm(ast, 0x1E6E0064) | 0xC0000); in ddr3_init()
1140 data = ast_mindwm(ast, 0x1E6E0018) & 0xfffff1ff; in ddr3_init()
1141 ast_moutdwm(ast, 0x1E6E0018, data); in ddr3_init()
1142 data = data | 0x200; in ddr3_init()
1143 ast_moutdwm(ast, 0x1E6E0018, data); in ddr3_init()
1145 data = ast_mindwm(ast, 0x1E6E001C); in ddr3_init()
1146 } while (!(data & 0x08000000)); in ddr3_init()
1148 data = ast_mindwm(ast, 0x1E6E001C); in ddr3_init()
1149 data = (data >> 8) & 0xff; in ddr3_init()
1151 ast_moutdwm(ast, 0x1E720058, ast_mindwm(ast, 0x1E6E0068) & 0xffff); in ddr3_init()
1152 data = ast_mindwm(ast, 0x1E6E0018) | 0xC00; in ddr3_init()
1153 ast_moutdwm(ast, 0x1E6E0018, data); in ddr3_init()
1155 ast_moutdwm(ast, 0x1E6E0034, 0x00000001); in ddr3_init()
1156 ast_moutdwm(ast, 0x1E6E000C, 0x00000040); in ddr3_init()
1159 ast_moutdwm(ast, 0x1E6E002C, param->reg_MRS | 0x100); in ddr3_init()
1160 ast_moutdwm(ast, 0x1E6E0030, param->reg_EMRS); in ddr3_init()
1161 ast_moutdwm(ast, 0x1E6E0028, 0x00000005); in ddr3_init()
1162 ast_moutdwm(ast, 0x1E6E0028, 0x00000007); in ddr3_init()
1163 ast_moutdwm(ast, 0x1E6E0028, 0x00000003); in ddr3_init()
1164 ast_moutdwm(ast, 0x1E6E0028, 0x00000001); in ddr3_init()
1165 ast_moutdwm(ast, 0x1E6E002C, param->reg_MRS); in ddr3_init()
1166 ast_moutdwm(ast, 0x1E6E000C, 0x00005C08); in ddr3_init()
1167 ast_moutdwm(ast, 0x1E6E0028, 0x00000001); in ddr3_init()
1169 ast_moutdwm(ast, 0x1E6E000C, 0x00005C01); in ddr3_init()
1170 data = 0; in ddr3_init()
1172 data = 0x300; in ddr3_init()
1175 data = data | 0x3000 | ((param->reg_AC2 & 0x60000) >> 3); in ddr3_init()
1177 ast_moutdwm(ast, 0x1E6E0034, data | 0x3); in ddr3_init()
1183 ast_moutdwm(ast, 0x1E6E0120, param->reg_FREQ); in ddr3_init()
1186 ast_moutdwm(ast, 0x1E6E007C, 0x00000000); in ddr3_init()
1187 ast_moutdwm(ast, 0x1E6E0070, 0x221); in ddr3_init()
1189 data = ast_mindwm(ast, 0x1E6E0070); in ddr3_init()
1190 } while (!(data & 0x00001000)); in ddr3_init()
1191 ast_moutdwm(ast, 0x1E6E0070, 0x00000000); in ddr3_init()
1192 ast_moutdwm(ast, 0x1E6E0050, 0x80000000); in ddr3_init()
1193 ast_moutdwm(ast, 0x1E6E0050, 0x00000000); in ddr3_init()
1203 ast_moutdwm(ast, 0x1E6E2000, 0x1688A8A8); in get_ddr2_info()
1206 trap = (ast_mindwm(ast, 0x1E6E2070) >> 25) & 0x3; in get_ddr2_info()
1208 trap_AC2 += 0x00110000; in get_ddr2_info()
1209 trap_MRS = 0x00000040 | (trap << 4); in get_ddr2_info()
1212 param->reg_MADJ = 0x00034C4C; in get_ddr2_info()
1213 param->reg_SADJ = 0x00001800; in get_ddr2_info()
1214 param->reg_DRV = 0x000000F0; in get_ddr2_info()
1216 param->rodt = 0; in get_ddr2_info()
1220 ast_moutdwm(ast, 0x1E6E2020, 0x0130); in get_ddr2_info()
1221 param->wodt = 0; in get_ddr2_info()
1222 param->reg_AC1 = 0x11101513; in get_ddr2_info()
1223 param->reg_AC2 = 0x78117011; in get_ddr2_info()
1224 param->reg_DQSIC = 0x00000092; in get_ddr2_info()
1225 param->reg_MRS = 0x00000842; in get_ddr2_info()
1226 param->reg_EMRS = 0x00000000; in get_ddr2_info()
1227 param->reg_DRV = 0x000000F0; in get_ddr2_info()
1228 param->reg_IOZ = 0x00000034; in get_ddr2_info()
1229 param->reg_DQIDLY = 0x0000005A; in get_ddr2_info()
1230 param->reg_FREQ = 0x00004AC0; in get_ddr2_info()
1235 ast_moutdwm(ast, 0x1E6E2020, 0x0190); in get_ddr2_info()
1237 param->reg_AC1 = 0x22202613; in get_ddr2_info()
1238 param->reg_AC2 = 0xAA009016 | trap_AC2; in get_ddr2_info()
1239 param->reg_DQSIC = 0x000000BA; in get_ddr2_info()
1240 param->reg_MRS = 0x00000A02 | trap_MRS; in get_ddr2_info()
1241 param->reg_EMRS = 0x00000040; in get_ddr2_info()
1242 param->reg_DRV = 0x000000FA; in get_ddr2_info()
1243 param->reg_IOZ = 0x00000034; in get_ddr2_info()
1244 param->reg_DQIDLY = 0x00000074; in get_ddr2_info()
1245 param->reg_FREQ = 0x00004DC0; in get_ddr2_info()
1251 param->reg_AC2 = 0xAA009012 | trap_AC2; in get_ddr2_info()
1254 param->reg_AC2 = 0xAA009016 | trap_AC2; in get_ddr2_info()
1257 param->reg_AC2 = 0xAA009023 | trap_AC2; in get_ddr2_info()
1260 param->reg_AC2 = 0xAA00903B | trap_AC2; in get_ddr2_info()
1266 ast_moutdwm(ast, 0x1E6E2020, 0x03F1); in get_ddr2_info()
1268 param->rodt = 0; in get_ddr2_info()
1269 param->reg_AC1 = 0x33302714; in get_ddr2_info()
1270 param->reg_AC2 = 0xCC00B01B | trap_AC2; in get_ddr2_info()
1271 param->reg_DQSIC = 0x000000E2; in get_ddr2_info()
1272 param->reg_MRS = 0x00000C02 | trap_MRS; in get_ddr2_info()
1273 param->reg_EMRS = 0x00000040; in get_ddr2_info()
1274 param->reg_DRV = 0x000000FA; in get_ddr2_info()
1275 param->reg_IOZ = 0x00000034; in get_ddr2_info()
1276 param->reg_DQIDLY = 0x00000089; in get_ddr2_info()
1277 param->reg_FREQ = 0x00005040; in get_ddr2_info()
1283 param->reg_AC2 = 0xCC00B016 | trap_AC2; in get_ddr2_info()
1287 param->reg_AC2 = 0xCC00B01B | trap_AC2; in get_ddr2_info()
1290 param->reg_AC2 = 0xCC00B02B | trap_AC2; in get_ddr2_info()
1293 param->reg_AC2 = 0xCC00B03F | trap_AC2; in get_ddr2_info()
1300 ast_moutdwm(ast, 0x1E6E2020, 0x01F0); in get_ddr2_info()
1302 param->rodt = 0; in get_ddr2_info()
1303 param->reg_AC1 = 0x33302714; in get_ddr2_info()
1304 param->reg_AC2 = 0xCC00B01B | trap_AC2; in get_ddr2_info()
1305 param->reg_DQSIC = 0x000000E2; in get_ddr2_info()
1306 param->reg_MRS = 0x00000C02 | trap_MRS; in get_ddr2_info()
1307 param->reg_EMRS = 0x00000040; in get_ddr2_info()
1308 param->reg_DRV = 0x000000FA; in get_ddr2_info()
1309 param->reg_IOZ = 0x00000034; in get_ddr2_info()
1310 param->reg_DQIDLY = 0x00000089; in get_ddr2_info()
1311 param->reg_FREQ = 0x000050C0; in get_ddr2_info()
1317 param->reg_AC2 = 0xCC00B016 | trap_AC2; in get_ddr2_info()
1321 param->reg_AC2 = 0xCC00B01B | trap_AC2; in get_ddr2_info()
1324 param->reg_AC2 = 0xCC00B02B | trap_AC2; in get_ddr2_info()
1327 param->reg_AC2 = 0xCC00B03F | trap_AC2; in get_ddr2_info()
1333 ast_moutdwm(ast, 0x1E6E2020, 0x0230); in get_ddr2_info()
1334 param->wodt = 0; in get_ddr2_info()
1335 param->reg_AC1 = 0x33302815; in get_ddr2_info()
1336 param->reg_AC2 = 0xCD44B01E; in get_ddr2_info()
1337 param->reg_DQSIC = 0x000000FC; in get_ddr2_info()
1338 param->reg_MRS = 0x00000E72; in get_ddr2_info()
1339 param->reg_EMRS = 0x00000000; in get_ddr2_info()
1340 param->reg_DRV = 0x00000000; in get_ddr2_info()
1341 param->reg_IOZ = 0x00000034; in get_ddr2_info()
1342 param->reg_DQIDLY = 0x00000097; in get_ddr2_info()
1343 param->reg_FREQ = 0x000052C0; in get_ddr2_info()
1348 ast_moutdwm(ast, 0x1E6E2020, 0x0261); in get_ddr2_info()
1351 param->reg_AC1 = 0x33302815; in get_ddr2_info()
1352 param->reg_AC2 = 0xDE44C022; in get_ddr2_info()
1353 param->reg_DQSIC = 0x00000117; in get_ddr2_info()
1354 param->reg_MRS = 0x00000E72; in get_ddr2_info()
1355 param->reg_EMRS = 0x00000040; in get_ddr2_info()
1356 param->reg_DRV = 0x0000000A; in get_ddr2_info()
1357 param->reg_IOZ = 0x00000045; in get_ddr2_info()
1358 param->reg_DQIDLY = 0x000000A0; in get_ddr2_info()
1359 param->reg_FREQ = 0x000054C0; in get_ddr2_info()
1364 ast_moutdwm(ast, 0x1E6E2020, 0x0120); in get_ddr2_info()
1367 param->reg_AC1 = 0x33302815; in get_ddr2_info()
1368 param->reg_AC2 = 0xEF44D024; in get_ddr2_info()
1369 param->reg_DQSIC = 0x00000125; in get_ddr2_info()
1370 param->reg_MRS = 0x00000E72; in get_ddr2_info()
1371 param->reg_EMRS = 0x00000004; in get_ddr2_info()
1372 param->reg_DRV = 0x000000F9; in get_ddr2_info()
1373 param->reg_IOZ = 0x00000045; in get_ddr2_info()
1374 param->reg_DQIDLY = 0x000000A7; in get_ddr2_info()
1375 param->reg_FREQ = 0x000055C0; in get_ddr2_info()
1380 ast_moutdwm(ast, 0x1E6E2020, 0x02A1); in get_ddr2_info()
1383 param->reg_AC1 = 0x43402915; in get_ddr2_info()
1384 param->reg_AC2 = 0xFF44E025; in get_ddr2_info()
1385 param->reg_DQSIC = 0x00000132; in get_ddr2_info()
1386 param->reg_MRS = 0x00000E72; in get_ddr2_info()
1387 param->reg_EMRS = 0x00000040; in get_ddr2_info()
1388 param->reg_DRV = 0x0000000A; in get_ddr2_info()
1389 param->reg_IOZ = 0x00000045; in get_ddr2_info()
1390 param->reg_DQIDLY = 0x000000AD; in get_ddr2_info()
1391 param->reg_FREQ = 0x000056C0; in get_ddr2_info()
1396 ast_moutdwm(ast, 0x1E6E2020, 0x0140); in get_ddr2_info()
1399 param->reg_AC1 = 0x43402915; in get_ddr2_info()
1400 param->reg_AC2 = 0xFF44E027; in get_ddr2_info()
1401 param->reg_DQSIC = 0x0000013F; in get_ddr2_info()
1402 param->reg_MRS = 0x00000E72; in get_ddr2_info()
1403 param->reg_EMRS = 0x00000004; in get_ddr2_info()
1404 param->reg_DRV = 0x000000F5; in get_ddr2_info()
1405 param->reg_IOZ = 0x00000045; in get_ddr2_info()
1406 param->reg_DQIDLY = 0x000000B3; in get_ddr2_info()
1407 param->reg_FREQ = 0x000057C0; in get_ddr2_info()
1415 param->dram_config = 0x100; in get_ddr2_info()
1419 param->dram_config = 0x121; in get_ddr2_info()
1422 param->dram_config = 0x122; in get_ddr2_info()
1425 param->dram_config = 0x123; in get_ddr2_info()
1432 param->dram_config |= 0x00; in get_ddr2_info()
1435 param->dram_config |= 0x04; in get_ddr2_info()
1438 param->dram_config |= 0x08; in get_ddr2_info()
1441 param->dram_config |= 0x0c; in get_ddr2_info()
1448 u32 data, data2, retry = 0; in ddr2_init()
1451 ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); in ddr2_init()
1452 ast_moutdwm(ast, 0x1E6E0018, 0x00000100); in ddr2_init()
1453 ast_moutdwm(ast, 0x1E6E0024, 0x00000000); in ddr2_init()
1454 ast_moutdwm(ast, 0x1E6E0064, param->reg_MADJ); in ddr2_init()
1455 ast_moutdwm(ast, 0x1E6E0068, param->reg_SADJ); in ddr2_init()
1457 ast_moutdwm(ast, 0x1E6E0064, param->reg_MADJ | 0xC0000); in ddr2_init()
1460 ast_moutdwm(ast, 0x1E6E0004, param->dram_config); in ddr2_init()
1461 ast_moutdwm(ast, 0x1E6E0008, 0x90040f); in ddr2_init()
1462 ast_moutdwm(ast, 0x1E6E0010, param->reg_AC1); in ddr2_init()
1463 ast_moutdwm(ast, 0x1E6E0014, param->reg_AC2); in ddr2_init()
1464 ast_moutdwm(ast, 0x1E6E0020, param->reg_DQSIC); in ddr2_init()
1465 ast_moutdwm(ast, 0x1E6E0080, 0x00000000); in ddr2_init()
1466 ast_moutdwm(ast, 0x1E6E0084, 0x00000000); in ddr2_init()
1467 ast_moutdwm(ast, 0x1E6E0088, param->reg_DQIDLY); in ddr2_init()
1468 ast_moutdwm(ast, 0x1E6E0018, 0x4000A130); in ddr2_init()
1469 ast_moutdwm(ast, 0x1E6E0018, 0x00002330); in ddr2_init()
1470 ast_moutdwm(ast, 0x1E6E0038, 0x00000000); in ddr2_init()
1471 ast_moutdwm(ast, 0x1E6E0040, 0xFF808000); in ddr2_init()
1472 ast_moutdwm(ast, 0x1E6E0044, 0x88848466); in ddr2_init()
1473 ast_moutdwm(ast, 0x1E6E0048, 0x44440008); in ddr2_init()
1474 ast_moutdwm(ast, 0x1E6E004C, 0x00000000); in ddr2_init()
1475 ast_moutdwm(ast, 0x1E6E0050, 0x80000000); in ddr2_init()
1476 ast_moutdwm(ast, 0x1E6E0050, 0x00000000); in ddr2_init()
1477 ast_moutdwm(ast, 0x1E6E0054, 0); in ddr2_init()
1478 ast_moutdwm(ast, 0x1E6E0060, param->reg_DRV); in ddr2_init()
1479 ast_moutdwm(ast, 0x1E6E006C, param->reg_IOZ); in ddr2_init()
1480 ast_moutdwm(ast, 0x1E6E0070, 0x00000000); in ddr2_init()
1481 ast_moutdwm(ast, 0x1E6E0074, 0x00000000); in ddr2_init()
1482 ast_moutdwm(ast, 0x1E6E0078, 0x00000000); in ddr2_init()
1483 ast_moutdwm(ast, 0x1E6E007C, 0x00000000); in ddr2_init()
1487 data = ast_mindwm(ast, 0x1E6E001C); in ddr2_init()
1488 } while (!(data & 0x08000000)); in ddr2_init()
1489 data = ast_mindwm(ast, 0x1E6E001C); in ddr2_init()
1490 data = (data >> 8) & 0xff; in ddr2_init()
1491 while ((data & 0x08) || ((data & 0x7) < 2) || (data < 4)) { in ddr2_init()
1492 data2 = (ast_mindwm(ast, 0x1E6E0064) & 0xfff3ffff) + 4; in ddr2_init()
1493 if ((data2 & 0xff) > param->madj_max) { in ddr2_init()
1496 ast_moutdwm(ast, 0x1E6E0064, data2); in ddr2_init()
1497 if (data2 & 0x00100000) { in ddr2_init()
1498 data2 = ((data2 & 0xff) >> 3) + 3; in ddr2_init()
1500 data2 = ((data2 & 0xff) >> 2) + 5; in ddr2_init()
1502 data = ast_mindwm(ast, 0x1E6E0068) & 0xffff00ff; in ddr2_init()
1503 data2 += data & 0xff; in ddr2_init()
1505 ast_moutdwm(ast, 0x1E6E0068, data); in ddr2_init()
1507 ast_moutdwm(ast, 0x1E6E0064, ast_mindwm(ast, 0x1E6E0064) | 0xC0000); in ddr2_init()
1509 data = ast_mindwm(ast, 0x1E6E0018) & 0xfffff1ff; in ddr2_init()
1510 ast_moutdwm(ast, 0x1E6E0018, data); in ddr2_init()
1511 data = data | 0x200; in ddr2_init()
1512 ast_moutdwm(ast, 0x1E6E0018, data); in ddr2_init()
1514 data = ast_mindwm(ast, 0x1E6E001C); in ddr2_init()
1515 } while (!(data & 0x08000000)); in ddr2_init()
1517 data = ast_mindwm(ast, 0x1E6E001C); in ddr2_init()
1518 data = (data >> 8) & 0xff; in ddr2_init()
1520 ast_moutdwm(ast, 0x1E720058, ast_mindwm(ast, 0x1E6E0008) & 0xffff); in ddr2_init()
1521 data = ast_mindwm(ast, 0x1E6E0018) | 0xC00; in ddr2_init()
1522 ast_moutdwm(ast, 0x1E6E0018, data); in ddr2_init()
1524 ast_moutdwm(ast, 0x1E6E0034, 0x00000001); in ddr2_init()
1525 ast_moutdwm(ast, 0x1E6E000C, 0x00000000); in ddr2_init()
1528 ast_moutdwm(ast, 0x1E6E002C, param->reg_MRS | 0x100); in ddr2_init()
1529 ast_moutdwm(ast, 0x1E6E0030, param->reg_EMRS); in ddr2_init()
1530 ast_moutdwm(ast, 0x1E6E0028, 0x00000005); in ddr2_init()
1531 ast_moutdwm(ast, 0x1E6E0028, 0x00000007); in ddr2_init()
1532 ast_moutdwm(ast, 0x1E6E0028, 0x00000003); in ddr2_init()
1533 ast_moutdwm(ast, 0x1E6E0028, 0x00000001); in ddr2_init()
1535 ast_moutdwm(ast, 0x1E6E000C, 0x00005C08); in ddr2_init()
1536 ast_moutdwm(ast, 0x1E6E002C, param->reg_MRS); in ddr2_init()
1537 ast_moutdwm(ast, 0x1E6E0028, 0x00000001); in ddr2_init()
1538 ast_moutdwm(ast, 0x1E6E0030, param->reg_EMRS | 0x380); in ddr2_init()
1539 ast_moutdwm(ast, 0x1E6E0028, 0x00000003); in ddr2_init()
1540 ast_moutdwm(ast, 0x1E6E0030, param->reg_EMRS); in ddr2_init()
1541 ast_moutdwm(ast, 0x1E6E0028, 0x00000003); in ddr2_init()
1543 ast_moutdwm(ast, 0x1E6E000C, 0x7FFF5C01); in ddr2_init()
1544 data = 0; in ddr2_init()
1546 data = 0x500; in ddr2_init()
1549 data = data | 0x3000 | ((param->reg_AC2 & 0x60000) >> 3); in ddr2_init()
1551 ast_moutdwm(ast, 0x1E6E0034, data | 0x3); in ddr2_init()
1552 ast_moutdwm(ast, 0x1E6E0120, param->reg_FREQ); in ddr2_init()
1560 ast_moutdwm(ast, 0x1E6E007C, 0x00000000); in ddr2_init()
1561 ast_moutdwm(ast, 0x1E6E0070, 0x221); in ddr2_init()
1563 data = ast_mindwm(ast, 0x1E6E0070); in ddr2_init()
1564 } while (!(data & 0x00001000)); in ddr2_init()
1565 ast_moutdwm(ast, 0x1E6E0070, 0x00000000); in ddr2_init()
1566 ast_moutdwm(ast, 0x1E6E0050, 0x80000000); in ddr2_init()
1567 ast_moutdwm(ast, 0x1E6E0050, 0x00000000); in ddr2_init()
1579 reg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff); in ast_post_chip_2300()
1580 if ((reg & 0x80) == 0) {/* vga only */ in ast_post_chip_2300()
1581 ast_write32(ast, 0xf004, 0x1e6e0000); in ast_post_chip_2300()
1582 ast_write32(ast, 0xf000, 0x1); in ast_post_chip_2300()
1583 ast_write32(ast, 0x12000, 0x1688a8a8); in ast_post_chip_2300()
1586 } while (ast_read32(ast, 0x12000) != 0x1); in ast_post_chip_2300()
1588 ast_write32(ast, 0x10000, 0xfc600309); in ast_post_chip_2300()
1591 } while (ast_read32(ast, 0x10000) != 0x1); in ast_post_chip_2300()
1594 temp = ast_read32(ast, 0x12008); in ast_post_chip_2300()
1595 temp |= 0x73; in ast_post_chip_2300()
1596 ast_write32(ast, 0x12008, temp); in ast_post_chip_2300()
1600 temp = ast_mindwm(ast, 0x1e6e2070); in ast_post_chip_2300()
1601 if (temp & 0x01000000) in ast_post_chip_2300()
1603 switch (temp & 0x18000000) { in ast_post_chip_2300()
1604 case 0: in ast_post_chip_2300()
1608 case 0x08000000: in ast_post_chip_2300()
1611 case 0x10000000: in ast_post_chip_2300()
1614 case 0x18000000: in ast_post_chip_2300()
1618 switch (temp & 0x0c) { in ast_post_chip_2300()
1620 case 0x00: in ast_post_chip_2300()
1624 case 0x04: in ast_post_chip_2300()
1628 case 0x08: in ast_post_chip_2300()
1632 case 0x0c: in ast_post_chip_2300()
1645 temp = ast_mindwm(ast, 0x1e6e2040); in ast_post_chip_2300()
1646 ast_moutdwm(ast, 0x1e6e2040, temp | 0x40); in ast_post_chip_2300()
1651 reg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff); in ast_post_chip_2300()
1652 } while ((reg & 0x40) == 0); in ast_post_chip_2300()
1657 ast_moutdwm(ast, 0x1E6E0074, 0x0000FFFF); in cbr_test_2500()
1658 ast_moutdwm(ast, 0x1E6E007C, 0xFF00FF00); in cbr_test_2500()
1659 if (!mmc_test_burst(ast, 0)) in cbr_test_2500()
1661 if (!mmc_test_single_2500(ast, 0)) in cbr_test_2500()
1668 ast_moutdwm(ast, 0x1E6E0074, 0x0000FFFF); in ddr_test_2500()
1669 ast_moutdwm(ast, 0x1E6E007C, 0xFF00FF00); in ddr_test_2500()
1670 if (!mmc_test_burst(ast, 0)) in ddr_test_2500()
1678 if (!mmc_test_single_2500(ast, 0)) in ddr_test_2500()
1685 ast_moutdwm(ast, 0x1E6E0034, 0x00020080); in ddr_init_common_2500()
1686 ast_moutdwm(ast, 0x1E6E0008, 0x2003000F); in ddr_init_common_2500()
1687 ast_moutdwm(ast, 0x1E6E0038, 0x00000FFF); in ddr_init_common_2500()
1688 ast_moutdwm(ast, 0x1E6E0040, 0x88448844); in ddr_init_common_2500()
1689 ast_moutdwm(ast, 0x1E6E0044, 0x24422288); in ddr_init_common_2500()
1690 ast_moutdwm(ast, 0x1E6E0048, 0x22222222); in ddr_init_common_2500()
1691 ast_moutdwm(ast, 0x1E6E004C, 0x22222222); in ddr_init_common_2500()
1692 ast_moutdwm(ast, 0x1E6E0050, 0x80000000); in ddr_init_common_2500()
1693 ast_moutdwm(ast, 0x1E6E0208, 0x00000000); in ddr_init_common_2500()
1694 ast_moutdwm(ast, 0x1E6E0218, 0x00000000); in ddr_init_common_2500()
1695 ast_moutdwm(ast, 0x1E6E0220, 0x00000000); in ddr_init_common_2500()
1696 ast_moutdwm(ast, 0x1E6E0228, 0x00000000); in ddr_init_common_2500()
1697 ast_moutdwm(ast, 0x1E6E0230, 0x00000000); in ddr_init_common_2500()
1698 ast_moutdwm(ast, 0x1E6E02A8, 0x00000000); in ddr_init_common_2500()
1699 ast_moutdwm(ast, 0x1E6E02B0, 0x00000000); in ddr_init_common_2500()
1700 ast_moutdwm(ast, 0x1E6E0240, 0x86000000); in ddr_init_common_2500()
1701 ast_moutdwm(ast, 0x1E6E0244, 0x00008600); in ddr_init_common_2500()
1702 ast_moutdwm(ast, 0x1E6E0248, 0x80000000); in ddr_init_common_2500()
1703 ast_moutdwm(ast, 0x1E6E024C, 0x80808080); in ddr_init_common_2500()
1710 pass = 0; in ddr_phy_init_2500()
1711 ast_moutdwm(ast, 0x1E6E0060, 0x00000005); in ddr_phy_init_2500()
1713 for (timecnt = 0; timecnt < TIMEOUT; timecnt++) { in ddr_phy_init_2500()
1714 data = ast_mindwm(ast, 0x1E6E0060) & 0x1; in ddr_phy_init_2500()
1719 data = ast_mindwm(ast, 0x1E6E0300) & 0x000A0000; in ddr_phy_init_2500()
1724 ast_moutdwm(ast, 0x1E6E0060, 0x00000000); in ddr_phy_init_2500()
1726 ast_moutdwm(ast, 0x1E6E0060, 0x00000005); in ddr_phy_init_2500()
1730 ast_moutdwm(ast, 0x1E6E0060, 0x00000006); in ddr_phy_init_2500()
1735 * 1Gb : 0x80000000 ~ 0x87FFFFFF
1736 * 2Gb : 0x80000000 ~ 0x8FFFFFFF
1737 * 4Gb : 0x80000000 ~ 0x9FFFFFFF
1738 * 8Gb : 0x80000000 ~ 0xBFFFFFFF
1744 reg_04 = ast_mindwm(ast, 0x1E6E0004) & 0xfffffffc; in check_dram_size_2500()
1745 reg_14 = ast_mindwm(ast, 0x1E6E0014) & 0xffffff00; in check_dram_size_2500()
1747 ast_moutdwm(ast, 0xA0100000, 0x41424344); in check_dram_size_2500()
1748 ast_moutdwm(ast, 0x90100000, 0x35363738); in check_dram_size_2500()
1749 ast_moutdwm(ast, 0x88100000, 0x292A2B2C); in check_dram_size_2500()
1750 ast_moutdwm(ast, 0x80100000, 0x1D1E1F10); in check_dram_size_2500()
1753 if (ast_mindwm(ast, 0xA0100000) == 0x41424344) { in check_dram_size_2500()
1754 reg_04 |= 0x03; in check_dram_size_2500()
1755 reg_14 |= (tRFC >> 24) & 0xFF; in check_dram_size_2500()
1757 } else if (ast_mindwm(ast, 0x90100000) == 0x35363738) { in check_dram_size_2500()
1758 reg_04 |= 0x02; in check_dram_size_2500()
1759 reg_14 |= (tRFC >> 16) & 0xFF; in check_dram_size_2500()
1761 } else if (ast_mindwm(ast, 0x88100000) == 0x292A2B2C) { in check_dram_size_2500()
1762 reg_04 |= 0x01; in check_dram_size_2500()
1763 reg_14 |= (tRFC >> 8) & 0xFF; in check_dram_size_2500()
1765 reg_14 |= tRFC & 0xFF; in check_dram_size_2500()
1767 ast_moutdwm(ast, 0x1E6E0004, reg_04); in check_dram_size_2500()
1768 ast_moutdwm(ast, 0x1E6E0014, reg_14); in check_dram_size_2500()
1775 reg_04 = ast_mindwm(ast, 0x1E6E0004); in enable_cache_2500()
1776 ast_moutdwm(ast, 0x1E6E0004, reg_04 | 0x1000); in enable_cache_2500()
1779 data = ast_mindwm(ast, 0x1E6E0004); in enable_cache_2500()
1780 while (!(data & 0x80000)); in enable_cache_2500()
1781 ast_moutdwm(ast, 0x1E6E0004, reg_04 | 0x400); in enable_cache_2500()
1789 ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); in set_mpll_2500()
1790 ast_moutdwm(ast, 0x1E6E0034, 0x00020080); in set_mpll_2500()
1791 for (addr = 0x1e6e0004; addr < 0x1e6e0090;) { in set_mpll_2500()
1792 ast_moutdwm(ast, addr, 0x0); in set_mpll_2500()
1795 ast_moutdwm(ast, 0x1E6E0034, 0x00020000); in set_mpll_2500()
1797 ast_moutdwm(ast, 0x1E6E2000, 0x1688A8A8); in set_mpll_2500()
1798 data = ast_mindwm(ast, 0x1E6E2070) & 0x00800000; in set_mpll_2500()
1801 param = 0x930023E0; in set_mpll_2500()
1802 ast_moutdwm(ast, 0x1E6E2160, 0x00011320); in set_mpll_2500()
1805 param = 0x93002400; in set_mpll_2500()
1807 ast_moutdwm(ast, 0x1E6E2020, param); in set_mpll_2500()
1813 ast_moutdwm(ast, 0x1E78505C, 0x00000004); in reset_mmc_2500()
1814 ast_moutdwm(ast, 0x1E785044, 0x00000001); in reset_mmc_2500()
1815 ast_moutdwm(ast, 0x1E785048, 0x00004755); in reset_mmc_2500()
1816 ast_moutdwm(ast, 0x1E78504C, 0x00000013); in reset_mmc_2500()
1818 ast_moutdwm(ast, 0x1E785054, 0x00000077); in reset_mmc_2500()
1819 ast_moutdwm(ast, 0x1E6E0000, 0xFC600309); in reset_mmc_2500()
1825 ast_moutdwm(ast, 0x1E6E0004, 0x00000303); in ddr3_init_2500()
1826 ast_moutdwm(ast, 0x1E6E0010, ddr_table[REGIDX_010]); in ddr3_init_2500()
1827 ast_moutdwm(ast, 0x1E6E0014, ddr_table[REGIDX_014]); in ddr3_init_2500()
1828 ast_moutdwm(ast, 0x1E6E0018, ddr_table[REGIDX_018]); in ddr3_init_2500()
1829 ast_moutdwm(ast, 0x1E6E0020, ddr_table[REGIDX_020]); /* MODEREG4/6 */ in ddr3_init_2500()
1830 ast_moutdwm(ast, 0x1E6E0024, ddr_table[REGIDX_024]); /* MODEREG5 */ in ddr3_init_2500()
1831 ast_moutdwm(ast, 0x1E6E002C, ddr_table[REGIDX_02C] | 0x100); /* MODEREG0/2 */ in ddr3_init_2500()
1832 ast_moutdwm(ast, 0x1E6E0030, ddr_table[REGIDX_030]); /* MODEREG1/3 */ in ddr3_init_2500()
1835 ast_moutdwm(ast, 0x1E6E0200, 0x02492AAE); in ddr3_init_2500()
1836 ast_moutdwm(ast, 0x1E6E0204, 0x00001001); in ddr3_init_2500()
1837 ast_moutdwm(ast, 0x1E6E020C, 0x55E00B0B); in ddr3_init_2500()
1838 ast_moutdwm(ast, 0x1E6E0210, 0x20000000); in ddr3_init_2500()
1839 ast_moutdwm(ast, 0x1E6E0214, ddr_table[REGIDX_214]); in ddr3_init_2500()
1840 ast_moutdwm(ast, 0x1E6E02E0, ddr_table[REGIDX_2E0]); in ddr3_init_2500()
1841 ast_moutdwm(ast, 0x1E6E02E4, ddr_table[REGIDX_2E4]); in ddr3_init_2500()
1842 ast_moutdwm(ast, 0x1E6E02E8, ddr_table[REGIDX_2E8]); in ddr3_init_2500()
1843 ast_moutdwm(ast, 0x1E6E02EC, ddr_table[REGIDX_2EC]); in ddr3_init_2500()
1844 ast_moutdwm(ast, 0x1E6E02F0, ddr_table[REGIDX_2F0]); in ddr3_init_2500()
1845 ast_moutdwm(ast, 0x1E6E02F4, ddr_table[REGIDX_2F4]); in ddr3_init_2500()
1846 ast_moutdwm(ast, 0x1E6E02F8, ddr_table[REGIDX_2F8]); in ddr3_init_2500()
1847 ast_moutdwm(ast, 0x1E6E0290, 0x00100008); in ddr3_init_2500()
1848 ast_moutdwm(ast, 0x1E6E02C0, 0x00000006); in ddr3_init_2500()
1851 ast_moutdwm(ast, 0x1E6E0034, 0x00020091); in ddr3_init_2500()
1856 ast_moutdwm(ast, 0x1E6E0120, ddr_table[REGIDX_PLL]); in ddr3_init_2500()
1857 ast_moutdwm(ast, 0x1E6E000C, 0x42AA5C81); in ddr3_init_2500()
1858 ast_moutdwm(ast, 0x1E6E0034, 0x0001AF93); in ddr3_init_2500()
1862 ast_moutdwm(ast, 0x1E6E001C, 0x00000008); in ddr3_init_2500()
1863 ast_moutdwm(ast, 0x1E6E0038, 0xFFFFFF00); in ddr3_init_2500()
1870 u32 min_ddr_vref = 0, min_phy_vref = 0; in ddr4_init_2500()
1871 u32 max_ddr_vref = 0, max_phy_vref = 0; in ddr4_init_2500()
1873 ast_moutdwm(ast, 0x1E6E0004, 0x00000313); in ddr4_init_2500()
1874 ast_moutdwm(ast, 0x1E6E0010, ddr_table[REGIDX_010]); in ddr4_init_2500()
1875 ast_moutdwm(ast, 0x1E6E0014, ddr_table[REGIDX_014]); in ddr4_init_2500()
1876 ast_moutdwm(ast, 0x1E6E0018, ddr_table[REGIDX_018]); in ddr4_init_2500()
1877 ast_moutdwm(ast, 0x1E6E0020, ddr_table[REGIDX_020]); /* MODEREG4/6 */ in ddr4_init_2500()
1878 ast_moutdwm(ast, 0x1E6E0024, ddr_table[REGIDX_024]); /* MODEREG5 */ in ddr4_init_2500()
1879 ast_moutdwm(ast, 0x1E6E002C, ddr_table[REGIDX_02C] | 0x100); /* MODEREG0/2 */ in ddr4_init_2500()
1880 ast_moutdwm(ast, 0x1E6E0030, ddr_table[REGIDX_030]); /* MODEREG1/3 */ in ddr4_init_2500()
1883 ast_moutdwm(ast, 0x1E6E0200, 0x42492AAE); in ddr4_init_2500()
1884 ast_moutdwm(ast, 0x1E6E0204, 0x09002000); in ddr4_init_2500()
1885 ast_moutdwm(ast, 0x1E6E020C, 0x55E00B0B); in ddr4_init_2500()
1886 ast_moutdwm(ast, 0x1E6E0210, 0x20000000); in ddr4_init_2500()
1887 ast_moutdwm(ast, 0x1E6E0214, ddr_table[REGIDX_214]); in ddr4_init_2500()
1888 ast_moutdwm(ast, 0x1E6E02E0, ddr_table[REGIDX_2E0]); in ddr4_init_2500()
1889 ast_moutdwm(ast, 0x1E6E02E4, ddr_table[REGIDX_2E4]); in ddr4_init_2500()
1890 ast_moutdwm(ast, 0x1E6E02E8, ddr_table[REGIDX_2E8]); in ddr4_init_2500()
1891 ast_moutdwm(ast, 0x1E6E02EC, ddr_table[REGIDX_2EC]); in ddr4_init_2500()
1892 ast_moutdwm(ast, 0x1E6E02F0, ddr_table[REGIDX_2F0]); in ddr4_init_2500()
1893 ast_moutdwm(ast, 0x1E6E02F4, ddr_table[REGIDX_2F4]); in ddr4_init_2500()
1894 ast_moutdwm(ast, 0x1E6E02F8, ddr_table[REGIDX_2F8]); in ddr4_init_2500()
1895 ast_moutdwm(ast, 0x1E6E0290, 0x00100008); in ddr4_init_2500()
1896 ast_moutdwm(ast, 0x1E6E02C4, 0x3C183C3C); in ddr4_init_2500()
1897 ast_moutdwm(ast, 0x1E6E02C8, 0x00631E0E); in ddr4_init_2500()
1900 ast_moutdwm(ast, 0x1E6E0034, 0x0001A991); in ddr4_init_2500()
1903 pass = 0; in ddr4_init_2500()
1905 for (retrycnt = 0; retrycnt < 4 && pass == 0; retrycnt++) { in ddr4_init_2500()
1906 max_phy_vref = 0x0; in ddr4_init_2500()
1907 pass = 0; in ddr4_init_2500()
1908 ast_moutdwm(ast, 0x1E6E02C0, 0x00001C06); in ddr4_init_2500()
1909 for (phy_vref = 0x40; phy_vref < 0x80; phy_vref++) { in ddr4_init_2500()
1910 ast_moutdwm(ast, 0x1E6E000C, 0x00000000); in ddr4_init_2500()
1911 ast_moutdwm(ast, 0x1E6E0060, 0x00000000); in ddr4_init_2500()
1912 ast_moutdwm(ast, 0x1E6E02CC, phy_vref | (phy_vref << 8)); in ddr4_init_2500()
1915 ast_moutdwm(ast, 0x1E6E000C, 0x00005C01); in ddr4_init_2500()
1918 data = ast_mindwm(ast, 0x1E6E03D0); in ddr4_init_2500()
1920 data = data & 0xff; in ddr4_init_2500()
1927 } else if (pass > 0) in ddr4_init_2500()
1931 ast_moutdwm(ast, 0x1E6E02CC, min_phy_vref | (min_phy_vref << 8)); in ddr4_init_2500()
1934 pass = 0; in ddr4_init_2500()
1936 for (retrycnt = 0; retrycnt < 4 && pass == 0; retrycnt++) { in ddr4_init_2500()
1937 min_ddr_vref = 0xFF; in ddr4_init_2500()
1938 max_ddr_vref = 0x0; in ddr4_init_2500()
1939 pass = 0; in ddr4_init_2500()
1940 for (ddr_vref = 0x00; ddr_vref < 0x40; ddr_vref++) { in ddr4_init_2500()
1941 ast_moutdwm(ast, 0x1E6E000C, 0x00000000); in ddr4_init_2500()
1942 ast_moutdwm(ast, 0x1E6E0060, 0x00000000); in ddr4_init_2500()
1943 ast_moutdwm(ast, 0x1E6E02C0, 0x00000006 | (ddr_vref << 8)); in ddr4_init_2500()
1946 ast_moutdwm(ast, 0x1E6E000C, 0x00005C01); in ddr4_init_2500()
1953 } else if (pass != 0) in ddr4_init_2500()
1958 ast_moutdwm(ast, 0x1E6E000C, 0x00000000); in ddr4_init_2500()
1959 ast_moutdwm(ast, 0x1E6E0060, 0x00000000); in ddr4_init_2500()
1961 ast_moutdwm(ast, 0x1E6E02C0, 0x00000006 | (ddr_vref << 8)); in ddr4_init_2500()
1966 ast_moutdwm(ast, 0x1E6E0120, ddr_table[REGIDX_PLL]); in ddr4_init_2500()
1967 ast_moutdwm(ast, 0x1E6E000C, 0x42AA5C81); in ddr4_init_2500()
1968 ast_moutdwm(ast, 0x1E6E0034, 0x0001AF93); in ddr4_init_2500()
1972 ast_moutdwm(ast, 0x1E6E001C, 0x00000008); in ddr4_init_2500()
1973 ast_moutdwm(ast, 0x1E6E0038, 0xFFFFFF00); in ddr4_init_2500()
1982 if (max_tries-- == 0) in ast_dram_init_2500()
1988 data = ast_mindwm(ast, 0x1E6E2070); in ast_dram_init_2500()
1989 if (data & 0x01000000) in ast_dram_init_2500()
1995 ast_moutdwm(ast, 0x1E6E2040, ast_mindwm(ast, 0x1E6E2040) | 0x41); in ast_dram_init_2500()
1998 data = ast_mindwm(ast, 0x1E6E200C) & 0xF9FFFFFF; in ast_dram_init_2500()
1999 ast_moutdwm(ast, 0x1E6E200C, data | 0x10000000); in ast_dram_init_2500()
2009 __ast_moutdwm(regs, 0x1e600000, 0xAEED1A03); in ast_patch_ahb_2500()
2010 __ast_moutdwm(regs, 0x1e600084, 0x00010000); in ast_patch_ahb_2500()
2011 __ast_moutdwm(regs, 0x1e600088, 0x00000000); in ast_patch_ahb_2500()
2012 __ast_moutdwm(regs, 0x1e6e2000, 0x1688A8A8); in ast_patch_ahb_2500()
2014 data = __ast_mindwm(regs, 0x1e6e2070); in ast_patch_ahb_2500()
2015 if (data & 0x08000000) { /* check fast reset */ in ast_patch_ahb_2500()
2025 * [0]:= 1:WDT enable in ast_patch_ahb_2500()
2027 __ast_moutdwm(regs, 0x1E785004, 0x00000010); in ast_patch_ahb_2500()
2028 __ast_moutdwm(regs, 0x1E785008, 0x00004755); in ast_patch_ahb_2500()
2029 __ast_moutdwm(regs, 0x1E78500c, 0x00000033); in ast_patch_ahb_2500()
2034 __ast_moutdwm(regs, 0x1e6e2000, 0x1688A8A8); in ast_patch_ahb_2500()
2035 data = __ast_mindwm(regs, 0x1e6e2000); in ast_patch_ahb_2500()
2038 __ast_moutdwm(regs, 0x1e6e207c, 0x08000000); /* clear fast reset */ in ast_patch_ahb_2500()
2047 reg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff); in ast_post_chip_2500()
2048 if ((reg & AST_VRAM_INIT_STATUS_MASK) == 0) {/* vga only */ in ast_post_chip_2500()
2053 ast_moutdwm(ast, 0x1E78502C, 0x00000000); in ast_post_chip_2500()
2054 ast_moutdwm(ast, 0x1E78504C, 0x00000000); in ast_post_chip_2500()
2059 * [29]:= 1:Enable USB2.0 Host port#1 (that the mutually shared USB2.0 Hub in ast_post_chip_2500()
2062 * [14:13]:= 1x:USB2.0 Host2 controller in ast_post_chip_2500()
2065 * [18]: 0(24)/1(48) MHz) in ast_post_chip_2500()
2067 * [23]:= write 1 and then SCU70[23] will be clear as 0b. in ast_post_chip_2500()
2069 ast_moutdwm(ast, 0x1E6E2090, 0x20000000); in ast_post_chip_2500()
2070 ast_moutdwm(ast, 0x1E6E2094, 0x00004000); in ast_post_chip_2500()
2071 if (ast_mindwm(ast, 0x1E6E2070) & 0x00800000) { in ast_post_chip_2500()
2072 ast_moutdwm(ast, 0x1E6E207C, 0x00800000); in ast_post_chip_2500()
2074 ast_moutdwm(ast, 0x1E6E2070, 0x00800000); in ast_post_chip_2500()
2077 temp = ast_mindwm(ast, 0x1E6E2070); in ast_post_chip_2500()
2078 if (temp & 0x02000000) in ast_post_chip_2500()
2079 ast_moutdwm(ast, 0x1E6E207C, 0x00004000); in ast_post_chip_2500()
2082 temp = ast_read32(ast, 0x12008); in ast_post_chip_2500()
2083 temp |= 0x73; in ast_post_chip_2500()
2084 ast_write32(ast, 0x12008, temp); in ast_post_chip_2500()
2089 temp = ast_mindwm(ast, 0x1e6e2040); in ast_post_chip_2500()
2090 ast_moutdwm(ast, 0x1e6e2040, temp | 0x40); in ast_post_chip_2500()
2095 reg = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xd0, 0xff); in ast_post_chip_2500()
2096 } while ((reg & 0x40) == 0); in ast_post_chip_2500()