Пример #1
0
/**
 * e100_diag_config_loopback - setup/clear loopback before/after lpbk test
 * @bdp: atapter's private data struct
 * @set_loopback: true if the function is called to set lb
 * @loopback_mode: the loopback mode(MAC or PHY)
 * @tcb_extended: true if need to set extended tcb mode after clean loopback
 * @dynamic_tbd: true if needed to set dynamic tbd mode after clean loopback
 *
 */
void
e100_diag_config_loopback(struct e100_private* bdp,
			  u8 set_loopback,
			  u8 loopback_mode,
			  u8* tcb_extended,
			  u8* dynamic_tbd)
{
	/* if set_loopback == true - we want to clear tcb_extended/dynamic_tbd.
	 * the previous values are saved in the params tcb_extended/dynamic_tbd
	 * if set_loopback == false - we want to restore previous value.
	 */
	if (set_loopback || (*tcb_extended))
		  *tcb_extended = e100_config_tcb_ext_enable(bdp,*tcb_extended);

	if (set_loopback || (*dynamic_tbd))
		 *dynamic_tbd = e100_config_dynamic_tbd(bdp,*dynamic_tbd);

	if (set_loopback) {
		/* ICH PHY loopback is broken */
		if (bdp->flags & IS_ICH && loopback_mode == PHY_LOOPBACK)
			loopback_mode = MAC_LOOPBACK;
		/* Configure loopback on MAC */
		e100_config_loopback_mode(bdp,loopback_mode);
	} else {
		e100_config_loopback_mode(bdp,NO_LOOPBACK);
	}

	e100_config(bdp);

	if (loopback_mode == PHY_LOOPBACK) {
		if (set_loopback)
                        /* Set PHY loopback mode */
                        e100_phy_set_loopback(bdp);
		else
			/* Reset PHY loopback mode */
			e100_phy_reset(bdp);	
		/* Wait for PHY state change */
		set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(HZ);
	} else { /* For MAC loopback wait 500 msec to take effect */
		set_current_state(TASK_UNINTERRUPTIBLE);
		schedule_timeout(HZ / 2);
	}
}
Пример #2
0
unsigned char
e100_phy_init(struct e100_private *bdp)
{
	e100_phy_reset(bdp);
	e100_phy_address_detect(bdp);
	e100_phy_isolate(bdp);
	e100_phy_id_detect(bdp);

	if (!e100_phy_specific_setup(bdp))
		return false;

	bdp->PhyState = 0;
	bdp->PhyDelay = 0;
	bdp->zlock_state = ZLOCK_INITIAL;

	e100_phy_set_speed_duplex(bdp, false);
	e100_fix_polarity(bdp);

	return true;
}