Lines Matching +full:rmii +full:- +full:refclk +full:- +full:in
1 // SPDX-License-Identifier: GPL-2.0+
100 if (p_eng->run.speed_sel[0]) { in Print_Header()
102 } else if (p_eng->run.speed_sel[1]) { in Print_Header()
108 switch (p_eng->arg.test_mode) { in Print_Header()
119 PRINTF(option, "TX frame - ARP\n"); in Print_Header()
122 PRINTF(option, "TX frame - random\n"); in Print_Header()
125 PRINTF(option, "TX frame - 0x%08x\n", p_eng->arg.user_def_val); in Print_Header()
134 if (p_eng->arg.run_mode == MODE_NCSI) { in print_arg_test_mode()
147 printf("%20s| 3: TX frame - ARP\n", ""); in print_arg_test_mode()
148 printf("%20s| 4: TX frame - random\n", ""); in print_arg_test_mode()
149 printf("%20s| 5: TX frame - user defined (default:0x%8x)\n", "", in print_arg_test_mode()
174 printf("%20s| check range = (orig - margin) ~ (orig + margin)\n", ""); in print_arg_delay_scan_range()
215 printf("%20s| bit8 : RMII 50MHz Output enable\n", ""); in print_arg_ctrl()
216 printf("%20s| bit9 : RMII REFCLK pin input enable\n", ""); in print_arg_ctrl()
231 printf("%20s| bit[0]->1G bit[1]->100M bit[2]->10M " in print_arg_speed()
240 printf("%20s| 0->MDIO1 1->MDIO2", item); in print_arg_mdio_idx()
242 if (p_eng->env.mac_num > 2) { in print_arg_mdio_idx()
243 printf(" 2->MDIO3 3->MDIO4"); in print_arg_mdio_idx()
252 printf("%20s| 0->MAC1 1->MAC2", item); in print_arg_mac_idx()
254 if (p_eng->env.mac_num > 2) { in print_arg_mac_idx()
255 printf(" 2->MAC3 3->MAC4"); in print_arg_mac_idx()
272 if (MODE_DEDICATED == p_eng->arg.run_mode) { in print_usage()
284 } else if (MODE_NCSI == p_eng->arg.run_mode) { in print_usage()
301 p_eng->io.mac12_1g_delay.value.w = readl(p_eng->io.mac12_1g_delay.addr); in push_reg()
302 p_eng->io.mac12_100m_delay.value.w = readl(p_eng->io.mac12_100m_delay.addr); in push_reg()
303 p_eng->io.mac12_10m_delay.value.w = readl(p_eng->io.mac12_10m_delay.addr); in push_reg()
306 p_eng->io.mac34_1g_delay.value.w = readl(p_eng->io.mac34_1g_delay.addr); in push_reg()
307 p_eng->io.mac34_100m_delay.value.w = readl(p_eng->io.mac34_100m_delay.addr); in push_reg()
308 p_eng->io.mac34_10m_delay.value.w = readl(p_eng->io.mac34_10m_delay.addr); in push_reg()
310 p_eng->io.mac34_drv_reg.value.w = readl(p_eng->io.mac34_drv_reg.addr); in push_reg()
312 p_eng->io.mac12_drv_reg.value.w = readl(p_eng->io.mac12_drv_reg.addr); in push_reg()
316 p_eng->reg.maccr.w = mac_reg_read(p_eng, 0x50); in push_reg()
318 p_eng->reg.mac_madr = mac_reg_read(p_eng, 0x08); in push_reg()
319 p_eng->reg.mac_ladr = mac_reg_read(p_eng, 0x0c); in push_reg()
320 p_eng->reg.mac_fear = mac_reg_read(p_eng, 0x40); in push_reg()
326 writel(p_eng->io.mac12_1g_delay.value.w, p_eng->io.mac12_1g_delay.addr); in pop_reg()
327 writel(p_eng->io.mac12_100m_delay.value.w, p_eng->io.mac12_100m_delay.addr); in pop_reg()
328 writel(p_eng->io.mac12_10m_delay.value.w, p_eng->io.mac12_10m_delay.addr); in pop_reg()
331 writel(p_eng->io.mac34_1g_delay.value.w, p_eng->io.mac34_1g_delay.addr); in pop_reg()
332 writel(p_eng->io.mac34_100m_delay.value.w, p_eng->io.mac34_100m_delay.addr); in pop_reg()
333 writel(p_eng->io.mac34_10m_delay.value.w, p_eng->io.mac34_10m_delay.addr); in pop_reg()
335 writel(p_eng->io.mac34_drv_reg.value.w, p_eng->io.mac34_drv_reg.addr); in pop_reg()
337 writel(p_eng->io.mac12_drv_reg.value.w, p_eng->io.mac12_drv_reg.addr); in pop_reg()
341 mac_reg_write(p_eng, 0x50, p_eng->reg.maccr.w); in pop_reg()
342 mac_reg_write(p_eng, 0x08, p_eng->reg.mac_madr); in pop_reg()
343 mac_reg_write(p_eng, 0x0c, p_eng->reg.mac_ladr); in pop_reg()
344 mac_reg_write(p_eng, 0x40, p_eng->reg.mac_fear); in pop_reg()
357 if (p_eng->arg.run_mode == MODE_DEDICATED) { in finish_check()
358 if (p_eng->dat.FRAME_LEN) in finish_check()
359 free(p_eng->dat.FRAME_LEN); in finish_check()
361 if (p_eng->dat.wp_lst) in finish_check()
362 free(p_eng->dat.wp_lst); in finish_check()
365 p_eng->flg.error = p_eng->flg.error | value; in finish_check()
368 printf("flags: error = %08x\n", p_eng->flg.error); in finish_check()
370 if (!p_eng->run.tm_tx_only) in finish_check()
373 if (p_eng->run.TM_IOTiming) in finish_check()
378 if (!p_eng->run.tm_tx_only) in finish_check()
381 if (p_eng->run.TM_IOTiming) in finish_check()
386 if (!p_eng->run.tm_tx_only) in finish_check()
388 if (p_eng->run.TM_IOTiming) in finish_check()
393 if (p_eng->flg.error) { in finish_check()
402 if (p_eng->arg.run_mode == MODE_NCSI ) { in check_test_mode()
403 switch (p_eng->arg.test_mode) { in check_test_mode()
407 p_eng->run.TM_IOTiming = 1; in check_test_mode()
410 p_eng->run.TM_IOTiming = 1; in check_test_mode()
411 p_eng->run.TM_IOStrength = 1; in check_test_mode()
414 p_eng->run.TM_NCSI_DiSChannel = 0; in check_test_mode()
422 switch (p_eng->arg.test_mode) { in check_test_mode()
426 p_eng->run.TM_IOTiming = 1; in check_test_mode()
429 p_eng->run.TM_IOTiming = 1; in check_test_mode()
430 p_eng->run.TM_IOStrength = 1; in check_test_mode()
434 p_eng->run.TM_RxDataEn = 0; in check_test_mode()
435 p_eng->run.tm_tx_only = 1; in check_test_mode()
436 p_eng->run.TM_IEEE = 0; in check_test_mode()
440 p_eng->run.TM_RxDataEn = 0; in check_test_mode()
441 p_eng->run.tm_tx_only = 1; in check_test_mode()
442 p_eng->run.TM_IEEE = 1; in check_test_mode()
451 if (0 == p_eng->run.TM_IOStrength) { in check_test_mode()
452 p_eng->io.drv_upper_bond = 0; in check_test_mode()
459 * @param[in] p_eng - MAC_ENGINE
463 * e.g. MAC#1: SCU04[11] = 1 --> MAC#1 reset assert
464 * = 0 --> MAC#1 reset de-assert
468 * e.g. MAC#1: SCU40[11] = 1 --> MAC#1 reset assert
469 * SCU44[11] = 1 --> MAC#1 reset de-assert
475 uint32_t mac_idx = p_eng->run.mac_idx; in scu_disable_mac()
480 mac_idx, p_mac->base_reset_assert, p_mac->bit_reset_assert, in scu_disable_mac()
481 p_mac->base_reset_deassert, p_mac->bit_reset_deassert); in scu_disable_mac()
483 p_mac->base_clk_stop, p_mac->bit_clk_stop, p_mac->base_clk_start, in scu_disable_mac()
484 p_mac->bit_clk_start); in scu_disable_mac()
486 reg = SCU_RD(p_mac->base_reset_assert); in scu_disable_mac()
488 reg |= p_mac->bit_reset_assert; in scu_disable_mac()
490 SCU_WR(reg, p_mac->base_reset_assert); in scu_disable_mac()
491 /* issue a dummy read to ensure command is in order */ in scu_disable_mac()
492 reg = SCU_RD(p_mac->base_reset_assert); in scu_disable_mac()
494 reg = SCU_RD(p_mac->base_clk_stop); in scu_disable_mac()
496 reg |= p_mac->bit_clk_stop; in scu_disable_mac()
498 SCU_WR(reg, p_mac->base_clk_stop); in scu_disable_mac()
499 /* issue a dummy read to ensure command is in order */ in scu_disable_mac()
500 reg = SCU_RD(p_mac->base_clk_stop); in scu_disable_mac()
505 uint32_t mac_idx = p_eng->run.mac_idx; in scu_enable_mac()
510 mac_idx, p_mac->base_reset_assert, p_mac->bit_reset_assert, in scu_enable_mac()
511 p_mac->base_reset_deassert, p_mac->bit_reset_deassert); in scu_enable_mac()
513 p_mac->base_clk_stop, p_mac->bit_clk_stop, p_mac->base_clk_start, in scu_enable_mac()
514 p_mac->bit_clk_start); in scu_enable_mac()
517 reg = SCU_RD(p_mac->base_reset_deassert); in scu_enable_mac()
519 reg |= p_mac->bit_reset_deassert; in scu_enable_mac()
521 SCU_WR(reg, p_mac->base_reset_deassert); in scu_enable_mac()
522 /* issue a dummy read to ensure command is in order */ in scu_enable_mac()
523 reg = SCU_RD(p_mac->base_reset_deassert); in scu_enable_mac()
525 reg = SCU_RD(p_mac->base_clk_start); in scu_enable_mac()
527 reg |= p_mac->bit_clk_start; in scu_enable_mac()
529 SCU_WR(reg, p_mac->base_clk_start); in scu_enable_mac()
530 /* issue a dummy read to ensure command is in order */ in scu_enable_mac()
531 reg = SCU_RD(p_mac->base_clk_start); in scu_enable_mac()
536 reg = SCU_RD(p_mac->base_reset_assert); in scu_enable_mac()
538 reg &= ~p_mac->bit_reset_assert; in scu_enable_mac()
540 SCU_WR(reg, p_mac->base_reset_assert); in scu_enable_mac()
542 reg = SCU_RD(p_mac->base_clk_stop); in scu_enable_mac()
544 reg &= ~p_mac->bit_clk_stop; in scu_enable_mac()
546 SCU_WR(reg, p_mac->base_clk_stop); in scu_enable_mac()
561 switch (p_eng->run.mdio_idx) { in scu_set_pinmux()
586 p_eng->run.mdio_idx); in scu_set_pinmux()
589 switch (p_eng->run.mac_idx) { in scu_set_pinmux()
627 if (p_eng->run.mdio_idx == 0) { in scu_set_pinmux()
634 setbits_le32(SCU_BASE + 80, BIT(p_eng->run.mac_idx)); in scu_set_pinmux()
641 if (p_eng->arg.mac_idx > p_eng->env.mac_num - 1) { in check_mac_idx()
642 printf("invalid run_idx = %d\n", p_eng->arg.mac_idx); in check_mac_idx()
653 if (p_eng->run.IO_MrgChk || in calc_loop_check_num()
654 (p_eng->arg.run_speed == SET_1G_100M_10MBPS) || in calc_loop_check_num()
655 (p_eng->arg.run_speed == SET_100M_10MBPS)) { in calc_loop_check_num()
656 p_eng->run.LOOP_CheckNum = p_eng->run.loop_max; in calc_loop_check_num()
658 switch (p_eng->arg.run_speed) { in calc_loop_check_num()
660 p_eng->run.CheckBuf_MBSize = MOVE_DATA_MB_SEC; in calc_loop_check_num()
663 p_eng->run.CheckBuf_MBSize = (MOVE_DATA_MB_SEC >> 3); in calc_loop_check_num()
666 p_eng->run.CheckBuf_MBSize = (MOVE_DATA_MB_SEC >> 6); in calc_loop_check_num()
669 p_eng->run.LOOP_CheckNum = in calc_loop_check_num()
670 (p_eng->run.CheckBuf_MBSize / in calc_loop_check_num()
671 (((p_eng->dat.Des_Num * DMA_PakSize) >> 20) + 1)); in calc_loop_check_num()
683 p_eng->run.mac_idx = p_eng->arg.mac_idx; in setup_running()
684 p_eng->run.mac_base = mac_base_lookup_tbl[p_eng->run.mac_idx]; in setup_running()
686 p_eng->run.mdio_idx = p_eng->arg.mdio_idx; in setup_running()
687 p_eng->run.mdio_base = mdio_base_lookup_tbl[p_eng->run.mdio_idx]; in setup_running()
689 p_eng->run.is_rgmii = p_eng->env.is_1g_valid[p_eng->run.mac_idx]; in setup_running()
691 if (p_eng->arg.run_mode == MODE_NCSI) { in setup_running()
697 if (p_eng->run.mac_idx < 2) { in setup_running()
702 if (p_eng->run.is_rgmii) { in setup_running()
705 printf("\nNCSI must be RMII interface, force the strap value:\n"); in setup_running()
708 if (p_eng->run.mac_idx == 2) { in setup_running()
710 } else if (p_eng->run.mac_idx == 3) { in setup_running()
718 p_eng->run.is_rgmii = p_eng->env.is_1g_valid[p_eng->run.mac_idx]; in setup_running()
721 if (p_eng->run.is_rgmii) { in setup_running()
722 printf("\nNCSI must be RMII interface\n"); in setup_running()
729 if (p_eng->arg.run_speed & (1 << i)) in setup_running()
730 p_eng->run.speed_cfg[i] = 1; in setup_running()
733 if (p_eng->arg.run_mode == MODE_NCSI) { in setup_running()
738 if ((p_eng->arg.GPackageTolNum < 1) || in setup_running()
739 (p_eng->arg.GPackageTolNum > 8)) { in setup_running()
743 if ((p_eng->arg.GChannelTolNum < 1) || in setup_running()
744 (p_eng->arg.GChannelTolNum > 32)) { in setup_running()
750 if (p_eng->arg.ctrl.w & 0xfffc0000) { in setup_running()
755 if (p_eng->arg.phy_addr > 31) { in setup_running()
761 if (0 == p_eng->arg.loop_max) { in setup_running()
762 switch (p_eng->arg.run_speed) { in setup_running()
764 p_eng->arg.loop_max = DEF_GLOOP_MAX * 20; in setup_running()
767 p_eng->arg.loop_max = DEF_GLOOP_MAX * 2; in setup_running()
770 p_eng->arg.loop_max = DEF_GLOOP_MAX; in setup_running()
773 p_eng->arg.loop_max = DEF_GLOOP_MAX * 20; in setup_running()
776 p_eng->arg.loop_max = DEF_GLOOP_MAX * 2; in setup_running()
786 if (p_eng->run.tm_tx_only) { in setup_running()
787 p_eng->run.ieee_sel = p_eng->arg.ieee_sel; in setup_running()
788 p_eng->run.delay_margin = 0; in setup_running()
790 p_eng->run.ieee_sel = 0; in setup_running()
791 p_eng->run.delay_margin = p_eng->arg.delay_scan_range; in setup_running()
793 if (p_eng->run.delay_margin == 0) { in setup_running()
801 if (!p_eng->env.is_1g_valid[p_eng->run.mac_idx]) in setup_running()
802 p_eng->run.speed_cfg[ 0 ] = 0; in setup_running()
804 p_eng->run.tdes_base = (uint32_t)(&tdes_buf[0]); in setup_running()
805 p_eng->run.rdes_base = (uint32_t)(&rdes_buf[0]); in setup_running()
807 if (p_eng->run.TM_IOTiming || p_eng->run.delay_margin) in setup_running()
808 p_eng->run.IO_MrgChk = 1; in setup_running()
810 p_eng->run.IO_MrgChk = 0; in setup_running()
812 p_eng->phy.Adr = p_eng->arg.phy_addr; in setup_running()
813 p_eng->phy.loopback = p_eng->arg.ctrl.b.phy_int_loopback; in setup_running()
814 p_eng->phy.default_phy = p_eng->run.TM_DefaultPHY; in setup_running()
816 p_eng->run.loop_max = p_eng->arg.loop_max; in setup_running()
819 //------------------------------------------------------------ in setup_running()
821 //------------------------------------------------------------ in setup_running()
822 //------------------------------ in setup_running()
826 //------------------------------ in setup_running()
827 if (p_eng->arg.run_mode == MODE_DEDICATED) { in setup_running()
828 n_desp_min = p_eng->run.TM_IOTiming; in setup_running()
830 if (p_eng->arg.ctrl.b.skip_phy_id_check && in setup_running()
831 (p_eng->arg.test_mode == 0)) in setup_running()
833 p_eng->dat.Des_Num = 114; in setup_running()
835 switch (p_eng->arg.run_speed) { in setup_running()
837 p_eng->dat.Des_Num = in setup_running()
838 p_eng->run.delay_margin in setup_running()
843 p_eng->dat.Des_Num = in setup_running()
844 p_eng->run.delay_margin in setup_running()
849 p_eng->dat.Des_Num = in setup_running()
850 p_eng->run.delay_margin in setup_running()
855 p_eng->dat.Des_Num = in setup_running()
856 p_eng->run.delay_margin in setup_running()
861 p_eng->dat.Des_Num = in setup_running()
862 p_eng->run.delay_margin in setup_running()
869 if (p_eng->arg.ctrl.b.single_packet) in setup_running()
870 p_eng->dat.Des_Num = 1; in setup_running()
872 /* keep in order: Des_Num -> DMABuf_Size -> DMABuf_Num */ in setup_running()
873 p_eng->dat.Des_Num_Org = p_eng->dat.Des_Num; in setup_running()
874 p_eng->dat.DMABuf_Size = DMA_BufSize; in setup_running()
875 p_eng->dat.DMABuf_Num = DMA_BufNum; in setup_running()
879 p_eng->run.CheckBuf_MBSize); in setup_running()
881 p_eng->run.LOOP_CheckNum); in setup_running()
882 printf("Des_Num : %d\n", p_eng->dat.Des_Num); in setup_running()
884 p_eng->dat.DMABuf_Size); in setup_running()
885 printf("DMA_BufNum : %d\n", p_eng->dat.DMABuf_Num); in setup_running()
889 if (2 > p_eng->dat.DMABuf_Num) in setup_running()
908 p_eng->env.is_1g_valid[0] = strap1.b.mac1_interface; in setup_interface()
909 p_eng->env.is_1g_valid[1] = strap1.b.mac2_interface; in setup_interface()
910 p_eng->env.is_1g_valid[2] = strap2.b.mac3_interface; in setup_interface()
911 p_eng->env.is_1g_valid[3] = strap2.b.mac4_interface; in setup_interface()
913 p_eng->env.at_least_1g_valid = in setup_interface()
914 p_eng->env.is_1g_valid[0] | p_eng->env.is_1g_valid[1] | in setup_interface()
915 p_eng->env.is_1g_valid[2] | p_eng->env.is_1g_valid[3]; in setup_interface()
919 p_eng->env.is_1g_valid[0] = strap1.b.mac1_interface; in setup_interface()
920 p_eng->env.is_1g_valid[1] = strap1.b.mac2_interface; in setup_interface()
922 p_eng->env.at_least_1g_valid = in setup_interface()
923 p_eng->env.is_1g_valid[0] | p_eng->env.is_1g_valid[1]; in setup_interface()
937 p_eng->env.ast2600 = 0; in setup_chip_compatibility()
938 p_eng->env.ast2500 = 0; in setup_chip_compatibility()
954 p_eng->env.ast2600 = 1; in setup_chip_compatibility()
955 p_eng->env.ast2500 = 1; in setup_chip_compatibility()
956 p_eng->env.mac_num = 4; in setup_chip_compatibility()
957 p_eng->env.is_new_mdio_reg[0] = 1; in setup_chip_compatibility()
958 p_eng->env.is_new_mdio_reg[1] = 1; in setup_chip_compatibility()
959 p_eng->env.is_new_mdio_reg[2] = 1; in setup_chip_compatibility()
960 p_eng->env.is_new_mdio_reg[3] = 1; in setup_chip_compatibility()
964 p_eng->env.ast2500 = 1; in setup_chip_compatibility()
965 p_eng->env.mac_num = 2; in setup_chip_compatibility()
966 p_eng->env.is_new_mdio_reg[0] = MAC1_RD(0x40) >> 31; in setup_chip_compatibility()
967 p_eng->env.is_new_mdio_reg[1] = MAC2_RD(0x40) >> 31; in setup_chip_compatibility()
1000 p_eng->arg.run_mode = mode; in init_mac_engine()
1001 p_eng->arg.delay_scan_range = DEF_GIOTIMINGBUND; in init_mac_engine()
1002 p_eng->arg.test_mode = DEF_GTESTMODE; in init_mac_engine()
1004 if (p_eng->arg.run_mode == MODE_NCSI ) { in init_mac_engine()
1005 p_eng->arg.GARPNumCnt = DEF_GARPNUMCNT; in init_mac_engine()
1006 p_eng->arg.GChannelTolNum = DEF_GCHANNEL2NUM; in init_mac_engine()
1007 p_eng->arg.GPackageTolNum = DEF_GPACKAGE2NUM; in init_mac_engine()
1008 p_eng->arg.ctrl.w = 0; in init_mac_engine()
1009 p_eng->arg.run_speed = SET_100MBPS; // In NCSI mode, we set to 100M bps in init_mac_engine()
1011 p_eng->arg.user_def_val = DEF_GUSER_DEF_PACKET_VAL; in init_mac_engine()
1012 p_eng->arg.phy_addr = DEF_GPHY_ADR; in init_mac_engine()
1013 p_eng->arg.loop_inf = 0; in init_mac_engine()
1014 p_eng->arg.loop_max = 0; in init_mac_engine()
1015 p_eng->arg.ctrl.w = DEF_GCTRL; in init_mac_engine()
1016 p_eng->arg.run_speed = DEF_GSPEED; in init_mac_engine()
1019 p_eng->flg.print_en = 1; in init_mac_engine()
1021 p_eng->run.TM_TxDataEn = 1; in init_mac_engine()
1022 p_eng->run.TM_RxDataEn = 1; in init_mac_engine()
1023 p_eng->run.TM_NCSI_DiSChannel = 1; in init_mac_engine()
1031 p_eng->io.mac12_1g_delay.addr = SCU_BASE + 0x340; in init_mac_engine()
1032 p_eng->io.mac12_1g_delay.tx_min = 0; in init_mac_engine()
1033 p_eng->io.mac12_1g_delay.tx_max = 63; in init_mac_engine()
1034 p_eng->io.mac12_1g_delay.rx_min = -63; in init_mac_engine()
1035 p_eng->io.mac12_1g_delay.rx_max = 63; in init_mac_engine()
1036 p_eng->io.mac12_1g_delay.rmii_tx_min = 0; in init_mac_engine()
1037 p_eng->io.mac12_1g_delay.rmii_tx_max = 1; in init_mac_engine()
1038 p_eng->io.mac12_1g_delay.rmii_rx_min = 0; in init_mac_engine()
1039 p_eng->io.mac12_1g_delay.rmii_rx_max = 63; in init_mac_engine()
1041 p_eng->io.mac12_100m_delay.addr = SCU_BASE + 0x348; in init_mac_engine()
1042 p_eng->io.mac12_100m_delay.tx_min = 0; in init_mac_engine()
1043 p_eng->io.mac12_100m_delay.tx_max = 63; in init_mac_engine()
1044 p_eng->io.mac12_100m_delay.rx_min = -63; in init_mac_engine()
1045 p_eng->io.mac12_100m_delay.rx_max = 63; in init_mac_engine()
1046 p_eng->io.mac12_10m_delay.addr = SCU_BASE + 0x34c; in init_mac_engine()
1047 p_eng->io.mac12_10m_delay.tx_min = 0; in init_mac_engine()
1048 p_eng->io.mac12_10m_delay.tx_max = 63; in init_mac_engine()
1049 p_eng->io.mac12_10m_delay.rx_min = -63; in init_mac_engine()
1050 p_eng->io.mac12_10m_delay.rx_max = 63; in init_mac_engine()
1052 p_eng->io.mac34_1g_delay.addr = SCU_BASE + 0x350; in init_mac_engine()
1053 p_eng->io.mac34_1g_delay.tx_min = 0; in init_mac_engine()
1054 p_eng->io.mac34_1g_delay.tx_max = 63; in init_mac_engine()
1055 p_eng->io.mac34_1g_delay.rx_min = -63; in init_mac_engine()
1056 p_eng->io.mac34_1g_delay.rx_max = 63; in init_mac_engine()
1057 p_eng->io.mac34_1g_delay.rmii_tx_min = 0; in init_mac_engine()
1058 p_eng->io.mac34_1g_delay.rmii_tx_max = 1; in init_mac_engine()
1059 p_eng->io.mac34_1g_delay.rmii_rx_min = 0; in init_mac_engine()
1060 p_eng->io.mac34_1g_delay.rmii_rx_max = 63; in init_mac_engine()
1061 p_eng->io.mac34_100m_delay.addr = SCU_BASE + 0x358; in init_mac_engine()
1062 p_eng->io.mac34_100m_delay.tx_min = 0; in init_mac_engine()
1063 p_eng->io.mac34_100m_delay.tx_max = 63; in init_mac_engine()
1064 p_eng->io.mac34_100m_delay.rx_min = -63; in init_mac_engine()
1065 p_eng->io.mac34_100m_delay.rx_max = 63; in init_mac_engine()
1066 p_eng->io.mac34_10m_delay.addr = SCU_BASE + 0x35c; in init_mac_engine()
1067 p_eng->io.mac34_10m_delay.tx_min = 0; in init_mac_engine()
1068 p_eng->io.mac34_10m_delay.tx_max = 63; in init_mac_engine()
1069 p_eng->io.mac34_10m_delay.rx_min = -63; in init_mac_engine()
1070 p_eng->io.mac34_10m_delay.rx_max = 63; in init_mac_engine()
1072 p_eng->io.mac34_drv_reg.addr = SCU_BASE + 0x458; in init_mac_engine()
1073 p_eng->io.mac34_drv_reg.drv_max = 0x3; in init_mac_engine()
1074 p_eng->io.drv_upper_bond = 0x3; in init_mac_engine()
1075 p_eng->io.drv_lower_bond = 0; in init_mac_engine()
1077 p_eng->io.mac12_1g_delay.addr = SCU_BASE + 0x48; in init_mac_engine()
1078 p_eng->io.mac12_1g_delay.tx_min = 0; in init_mac_engine()
1079 p_eng->io.mac12_1g_delay.tx_max = 63; in init_mac_engine()
1080 p_eng->io.mac12_1g_delay.rx_min = 0; in init_mac_engine()
1081 p_eng->io.mac12_1g_delay.rx_max = 63; in init_mac_engine()
1082 p_eng->io.mac12_1g_delay.rmii_tx_min = 0; in init_mac_engine()
1083 p_eng->io.mac12_1g_delay.rmii_tx_max = 1; in init_mac_engine()
1084 p_eng->io.mac12_1g_delay.rmii_rx_min = 0; in init_mac_engine()
1085 p_eng->io.mac12_1g_delay.rmii_rx_max = 63; in init_mac_engine()
1086 p_eng->io.mac12_100m_delay.addr = SCU_BASE + 0xb8; in init_mac_engine()
1087 p_eng->io.mac12_100m_delay.tx_min = 0; in init_mac_engine()
1088 p_eng->io.mac12_100m_delay.tx_max = 63; in init_mac_engine()
1089 p_eng->io.mac12_100m_delay.rx_min = 0; in init_mac_engine()
1090 p_eng->io.mac12_100m_delay.rx_max = 63; in init_mac_engine()
1091 p_eng->io.mac12_10m_delay.addr = SCU_BASE + 0xbc; in init_mac_engine()
1092 p_eng->io.mac12_10m_delay.tx_min = 0; in init_mac_engine()
1093 p_eng->io.mac12_10m_delay.tx_max = 63; in init_mac_engine()
1094 p_eng->io.mac12_10m_delay.rx_min = 0; in init_mac_engine()
1095 p_eng->io.mac12_10m_delay.rx_max = 63; in init_mac_engine()
1097 p_eng->io.mac34_1g_delay.addr = 0; in init_mac_engine()
1098 p_eng->io.mac34_100m_delay.addr = 0; in init_mac_engine()
1099 p_eng->io.mac34_10m_delay.addr = 0; in init_mac_engine()
1101 p_eng->io.mac12_drv_reg.addr = SCU_BASE + 0x90; in init_mac_engine()
1102 p_eng->io.mac12_drv_reg.drv_max = 0x1; in init_mac_engine()
1103 p_eng->io.drv_upper_bond = 0x1; in init_mac_engine()
1104 p_eng->io.drv_lower_bond = 0; in init_mac_engine()
1114 p_eng->arg.user_def_val = simple_strtol(argv[9], NULL, 16); in parse_arg_dedicated()
1116 p_eng->arg.delay_scan_range = simple_strtol(argv[8], NULL, 10); in parse_arg_dedicated()
1117 p_eng->arg.ieee_sel = p_eng->arg.delay_scan_range; in parse_arg_dedicated()
1119 p_eng->arg.phy_addr = simple_strtol(argv[7], NULL, 10); in parse_arg_dedicated()
1121 p_eng->arg.test_mode = simple_strtol(argv[6], NULL, 16); in parse_arg_dedicated()
1122 printf("test mode = %d\n", p_eng->arg.test_mode); in parse_arg_dedicated()
1124 p_eng->arg.loop_max = simple_strtol(argv[5], NULL, 10); in parse_arg_dedicated()
1125 if (p_eng->arg.loop_max == -1) { in parse_arg_dedicated()
1126 p_eng->arg.loop_inf = 1; in parse_arg_dedicated()
1128 printf("loop max=%d, loop_inf=%d\n", p_eng->arg.loop_max, p_eng->arg.loop_inf); in parse_arg_dedicated()
1130 p_eng->arg.ctrl.w = simple_strtol(argv[4], NULL, 16); in parse_arg_dedicated()
1131 printf("ctrl=0x%05x\n", p_eng->arg.ctrl.w); in parse_arg_dedicated()
1133 p_eng->arg.run_speed = simple_strtol(argv[3], NULL, 16); in parse_arg_dedicated()
1134 printf("speed=0x%1x\n", p_eng->arg.run_speed); in parse_arg_dedicated()
1136 p_eng->arg.mdio_idx = simple_strtol(argv[2], NULL, 10); in parse_arg_dedicated()
1137 printf("mdio_idx=%d\n", p_eng->arg.mdio_idx); in parse_arg_dedicated()
1147 p_eng->arg.GARPNumCnt = simple_strtol(argv[7], NULL, 10); in parse_arg_ncsi()
1149 p_eng->arg.ctrl.w = simple_strtol(argv[6], NULL, 16); in parse_arg_ncsi()
1151 p_eng->arg.delay_scan_range = simple_strtol(argv[5], NULL, 10); in parse_arg_ncsi()
1153 p_eng->arg.test_mode = simple_strtol(argv[4], NULL, 16); in parse_arg_ncsi()
1155 p_eng->arg.GChannelTolNum = simple_strtol(argv[3], NULL, 10); in parse_arg_ncsi()
1157 p_eng->arg.GPackageTolNum = simple_strtol(argv[2], NULL, 10); in parse_arg_ncsi()
1175 if (p_eng->arg.run_mode == MODE_DEDICATED) { in setup_data()
1176 if (p_eng->run.tm_tx_only) in setup_data()
1179 p_eng->dat.FRAME_LEN = in setup_data()
1180 (uint32_t *)malloc(p_eng->dat.Des_Num * sizeof(uint32_t)); in setup_data()
1181 p_eng->dat.wp_lst = in setup_data()
1182 (uint32_t *)malloc(p_eng->dat.Des_Num * sizeof(uint32_t)); in setup_data()
1184 if (!p_eng->dat.FRAME_LEN) in setup_data()
1186 if (!p_eng->dat.wp_lst) in setup_data()
1191 if (p_eng->arg.GARPNumCnt != 0) in setup_data()
1195 p_eng->run.speed_idx = 0; in setup_data()
1196 p_eng->io.drv_curr = mac_get_driving_strength(p_eng); in setup_data()
1207 time_out = timeout_th_tbl[p_eng->run.speed_idx]; in get_time_out_th()
1208 if (p_eng->run.TM_WaitStart) in get_time_out_th()
1224 memset(&p_eng->io.result_history[0][0], 0, in test_start()
1225 sizeof(p_eng->io.result_history)); in test_start()
1228 p_eng->flg.print_en = 1; in test_start()
1229 p_eng->run.speed_idx = speed; in test_start()
1231 if (0 == p_eng->run.speed_sel[speed]) { in test_start()
1235 p_eng->run.timeout_th = get_time_out_th(p_eng); in test_start()
1236 if (p_eng->arg.run_mode == MODE_DEDICATED) { in test_start()
1237 if ((p_eng->arg.run_speed == SET_1G_100M_10MBPS) || in test_start()
1238 (p_eng->arg.run_speed == SET_100M_10MBPS)) { in test_start()
1239 if (p_eng->run.speed_sel[0]) in test_start()
1240 p_eng->run.loop_max = in test_start()
1241 p_eng->arg.loop_max; in test_start()
1242 else if (p_eng->run.speed_sel[1]) in test_start()
1243 p_eng->run.loop_max = in test_start()
1244 p_eng->arg.loop_max / 100; in test_start()
1246 p_eng->run.loop_max = in test_start()
1247 p_eng->arg.loop_max / 1000; in test_start()
1249 if (0 == p_eng->run.loop_max) in test_start()
1250 p_eng->run.loop_max = 1; in test_start()
1254 //------------------------------ in test_start()
1256 //------------------------------ in test_start()
1257 if (p_phy_eng->fp_set) { in test_start()
1261 if (p_eng->flg.error) in test_start()
1265 //------------------------------ in test_start()
1267 //------------------------------ in test_start()
1269 p_eng->io.drv_lower_bond, p_eng->io.drv_upper_bond); in test_start()
1270 for (drv = p_eng->io.drv_lower_bond; in test_start()
1271 drv <= p_eng->io.drv_upper_bond; drv++) { in test_start()
1272 if (p_eng->run.IO_MrgChk) { in test_start()
1273 if (p_eng->run.TM_IOStrength) { in test_start()
1275 p_eng->io.drv_curr = mac_get_driving_strength(p_eng); in test_start()
1278 if (p_eng->run.delay_margin) in test_start()
1280 if (p_eng->run.TM_IOTiming) in test_start()
1284 if (p_eng->arg.run_mode == MODE_DEDICATED) { in test_start()
1287 } // End if (p_eng->run.IO_MrgChk) in test_start()
1289 //------------------------------ in test_start()
1291 //------------------------------ in test_start()
1292 tbegin = p_eng->io.tx_delay_scan.begin; in test_start()
1293 tend = p_eng->io.tx_delay_scan.end; in test_start()
1294 tstep = p_eng->io.tx_delay_scan.step; in test_start()
1296 rbegin = p_eng->io.rx_delay_scan.begin; in test_start()
1297 rend = p_eng->io.rx_delay_scan.end; in test_start()
1298 rstep = p_eng->io.rx_delay_scan.step; in test_start()
1301 p_eng->io.Dly_out = td; in test_start()
1302 p_eng->io.Dly_out_selval = td; in test_start()
1303 if (p_eng->run.IO_MrgChk) { in test_start()
1305 } // End if (p_eng->run.IO_MrgChk) in test_start()
1307 //------------------------------ in test_start()
1308 // [Start] The loop of different IO in in test_start()
1310 //------------------------------ in test_start()
1312 p_eng->io.Dly_in = rd; in test_start()
1313 if (p_eng->run.IO_MrgChk) { in test_start()
1314 p_eng->io.Dly_in_selval = rd; in test_start()
1319 //------------------------------ in test_start()
1321 //------------------------------ in test_start()
1323 if (p_eng->flg.error) in test_start()
1326 if (p_eng->arg.run_mode == MODE_NCSI) { in test_start()
1327 p_eng->io.result = in test_start()
1330 p_eng->io.result = TestingLoop( in test_start()
1332 p_eng->run.LOOP_CheckNum); in test_start()
1335 p_eng->io.result_history[rd + 64][td] |= in test_start()
1336 p_eng->io.result; in test_start()
1339 if (p_eng->run.IO_MrgChk) { in test_start()
1344 p_eng->flg.warn = 0; in test_start()
1345 p_eng->flg.error = 0; in test_start()
1346 p_eng->flg.desc = 0; in test_start()
1347 p_eng->flg.ncsi = 0; in test_start()
1351 if (p_eng->run.IO_MrgChk) { in test_start()
1352 if (p_eng->run.TM_IOTiming) { in test_start()
1359 if (!p_eng->run.tm_tx_only) in test_start()
1361 if (p_eng->run.TM_IOTiming) in test_start()
1366 wrn_flag_allspeed |= p_eng->flg.warn; in test_start()
1367 err_flag_allspeed |= p_eng->flg.error; in test_start()
1368 des_flag_allspeed |= p_eng->flg.error; in test_start()
1369 ncsi_flag_allspeed |= p_eng->flg.error; in test_start()
1370 p_eng->flg.warn = 0; in test_start()
1371 p_eng->flg.error = 0; in test_start()
1372 p_eng->flg.desc = 0; in test_start()
1373 p_eng->flg.ncsi = 0; in test_start()
1376 if (p_eng->arg.run_mode == MODE_DEDICATED) { in test_start()
1377 if (p_phy_eng->fp_clr != 0) in test_start()
1381 p_eng->run.speed_sel[speed] = 0; in test_start()
1382 p_eng->flg.print_en = 0; in test_start()
1385 p_eng->flg.warn = wrn_flag_allspeed; in test_start()
1386 p_eng->flg.error = err_flag_allspeed; in test_start()
1387 p_eng->flg.desc = des_flag_allspeed; in test_start()
1388 p_eng->flg.ncsi = ncsi_flag_allspeed; in test_start()
1411 printf("ast2600 compatible = %d\n", p_eng->env.ast2600); in dump_setting()
1412 printf("ast2500 compatible = %d\n", p_eng->env.ast2500); in dump_setting()
1413 printf("valid MAC number = %d\n", p_eng->env.mac_num); in dump_setting()
1415 p_eng->env.is_new_mdio_reg[0], in dump_setting()
1416 p_eng->env.is_new_mdio_reg[1], in dump_setting()
1417 p_eng->env.is_new_mdio_reg[2], in dump_setting()
1418 p_eng->env.is_new_mdio_reg[3]); in dump_setting()
1420 p_eng->env.is_1g_valid[0], in dump_setting()
1421 p_eng->env.is_1g_valid[1], in dump_setting()
1422 p_eng->env.is_1g_valid[2], in dump_setting()
1423 p_eng->env.is_1g_valid[3]); in dump_setting()
1503 //------------------------------ in mac_test()
1505 //------------------------------ in mac_test()