/* Configure the ASX registers needed to use the RGMII ports */
asx_tx.u64 = 0;
asx_tx.s.prt_en = cvmx_build_mask(num_ports);
cvmx_write_csr(CVMX_ASXX_TX_PRT_EN(interface), asx_tx.u64);
/* Configure the GMX registers needed to use the RGMII ports */ for (port = 0; port < num_ports; port++) { /* Setting of CVMX_GMXX_TXX_THRESH has been moved to
__cvmx_helper_setup_gmx() */
if (cvmx_octeon_is_pass1())
__cvmx_helper_errata_asx_pass1(interface, port,
sys_info_ptr->
cpu_clock_hz); else { /* *ConfiguremoreflexibleRGMIIpreamble *checking.Pass1doesn'tsupportthis *feature.
*/ union cvmx_gmxx_rxx_frm_ctl frm_ctl;
frm_ctl.u64 =
cvmx_read_csr(CVMX_GMXX_RXX_FRM_CTL
(port, interface)); /* New field, so must be compile time */
frm_ctl.s.pre_free = 1;
cvmx_write_csr(CVMX_GMXX_RXX_FRM_CTL(port, interface),
frm_ctl.u64);
}
/* *ReturnthelinkstateofanIPD/PKOportasreturnedby *autonegotiation.Theresultofthisfunctionmaynotmatch *Octeon'slinkconfigifautonegotiationhaschangedsince *thelastcalltocvmx_helper_link_set(). * *@ipd_port:IPD/PKOporttoquery * *ReturnsLinkstate
*/ union cvmx_helper_link_info __cvmx_helper_rgmii_link_get(int ipd_port)
{ int interface = cvmx_helper_get_interface_num(ipd_port); int index = cvmx_helper_get_interface_index_num(ipd_port); union cvmx_asxx_prt_loop asxx_prt_loop;
asxx_prt_loop.u64 = cvmx_read_csr(CVMX_ASXX_PRT_LOOP(interface)); if (asxx_prt_loop.s.int_loop & (1 << index)) { /* Force 1Gbps full duplex on internal loopback */ union cvmx_helper_link_info result;
result.u64 = 0;
result.s.full_duplex = 1;
result.s.link_up = 1;
result.s.speed = 1000; return result;
} else return __cvmx_helper_board_link_get(ipd_port);
}
/* *ConfigureanIPD/PKOportforthespecifiedlinkstate.This *functiondoesnotinfluenceautonegotiationatthePHYlevel. *Thepassedlinkstatemustalwaysmatchthelinkstatereturned *bycvmx_helper_link_get(). * *@ipd_port:IPD/PKOporttoconfigure *@link_info:Thenewlinkstate * *ReturnsZeroonsuccess,negativeonfailure
*/ int __cvmx_helper_rgmii_link_set(int ipd_port, union cvmx_helper_link_info link_info)
{ int result = 0; int interface = cvmx_helper_get_interface_num(ipd_port); int index = cvmx_helper_get_interface_index_num(ipd_port); union cvmx_gmxx_prtx_cfg original_gmx_cfg; union cvmx_gmxx_prtx_cfg new_gmx_cfg; union cvmx_pko_mem_queue_qos pko_mem_queue_qos; union cvmx_pko_mem_queue_qos pko_mem_queue_qos_save[16]; union cvmx_gmxx_tx_ovr_bp gmx_tx_ovr_bp; union cvmx_gmxx_tx_ovr_bp gmx_tx_ovr_bp_save; int i;
/* Ignore speed sets in the simulator */ if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_SIM) return0;
/* Read the current settings so we know the current enable state */
original_gmx_cfg.u64 =
cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
new_gmx_cfg = original_gmx_cfg;
/* *PolltheGMXstatemachinewaitingforittobecome *idle.Preferablyweshouldonlychangespeedwhenitis *idle.Ifitdoesn'tbecomeidlewewillstilldothespeed *change,butthereisaslightchancethatGMXwill *lockup.
*/
cvmx_write_csr(CVMX_NPI_DBG_SELECT,
interface * 0x800 + index * 0x100 + 0x880);
CVMX_WAIT_FOR_FIELD64(CVMX_DBG_DATA, union cvmx_dbg_data, data & 7,
==, 0, 10000);
CVMX_WAIT_FOR_FIELD64(CVMX_DBG_DATA, union cvmx_dbg_data, data & 0xf,
==, 0, 10000);
/* Disable the port before we make any changes */
new_gmx_cfg.s.en = 0;
cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), new_gmx_cfg.u64);
cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
/* Set full/half duplex */ if (cvmx_octeon_is_pass1()) /* Half duplex is broken for 38XX Pass 1 */
new_gmx_cfg.s.duplex = 1; elseif (!link_info.s.link_up) /* Force full duplex on down links */
new_gmx_cfg.s.duplex = 1; else
new_gmx_cfg.s.duplex = link_info.s.full_duplex;
/* Set the link speed. Anything unknown is set to 1Gbps */ if (link_info.s.speed == 10) {
new_gmx_cfg.s.slottime = 0;
new_gmx_cfg.s.speed = 0;
} elseif (link_info.s.speed == 100) {
new_gmx_cfg.s.slottime = 0;
new_gmx_cfg.s.speed = 0;
} else {
new_gmx_cfg.s.slottime = 1;
new_gmx_cfg.s.speed = 1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.