Esempio n. 1
0
/*****************************************************************************
*
* FwCheckLinkMode - Check the firmware link state and link mode
*
* Description:
*
* Returns:
*   Nothing
*/
void FwCheckLinkMode(
SK_AC  *pAC,	/* Pointer to adapter context */
SK_IOC IoC,		/* IO context handle */
int    Port)
{
	SK_U16 PhyStat;
	SK_U32 PhyCtrl;

	PhyStat = 0x0;
	PhyCtrl = 0x0;

	pAC->GIni.GIDontInitPhy = SK_FALSE;

	if (pAC->UseLinkMaintenance == SK_TRUE) {

		/* Check if link is up */
		SK_IN32(pAC->IoBase, MR_ADDR(Port, GPHY_CTRL), &PhyCtrl);

		if ((PhyCtrl & GPC_PHY_LINK_UP) == 0) {
#ifdef MV_FW_SDK_LINK_MAINTENANCE_DEBUG
			printk("FwCheckLinkMode: No link on port %d\n", Port);
#endif
			return;
		}
		else {
#ifdef MV_FW_SDK_LINK_MAINTENANCE_DEBUG
			printk("FwCheckLinkMode: Link up on port %d\n", Port);
#endif
			/* Check link state */
			GM_IN16(IoC, Port, GM_GP_CTRL, &PhyStat);
#ifdef MV_FW_SDK_LINK_MAINTENANCE_DEBUG
			printk("FwCheckLinkMode: GM_GP_CTRL:  0x%x\n",
				PhyStat);
#endif
			if (pAC->DriverLinkStat != PhyStat) {
#ifdef MV_FW_SDK_LINK_MAINTENANCE_DEBUG
				printk("FwCheckLinkMode: Link status changed\n");
				printk("FwCheckLinkMode: pAC->DriverLinkStat:     0x%x\n",
					pAC->DriverLinkStat);
#endif
				return;
			}

			/* Store link state */
			pAC->DriverLinkStat = PhyStat;
			
			/* Enable link maintenance */
			pAC->GIni.GIDontInitPhy = SK_TRUE;
#ifdef MV_FW_SDK_LINK_MAINTENANCE_DEBUG
			printk("FwCheckLinkMode: Link match, GIDontInitPhy: %d\n",
				pAC->GIni.GIDontInitPhy);
#endif
		}
	}
	else {
#ifdef MV_FW_SDK_LINK_MAINTENANCE_DEBUG
		printk("FwCheckLinkMode: UseLinkMaintenance not set!\n");
#endif
	}

	return;

} /* FwCheckLinkMode */
Esempio n. 2
0
/*****************************************************************************
 *
 * 	toggleLeds - Changes the LED state of an adapter
 *
 * Description:
 *	This function changes the current state of all LEDs of an adapter so
 *	that it can be located by a user. If the requested time interval for
 *	this test has elapsed, this function cleans up everything that was 
 *	temporarily setup during the locate NIC test. This involves of course
 *	also closing or opening any adapter so that the initial board state 
 *	is recovered.
 *
 * Returns:	N/A
 *
 */
static void toggleLeds(
unsigned long ptr)  /* holds the pointer to adapter control context */
{
	DEV_NET              *pNet      = (DEV_NET*) ptr;
	SK_AC                *pAC       = pNet->pAC;
	int                   port      = pNet->PortNr;
	SK_IOC                IoC       = pAC->IoBase;
	struct SK_NET_DEVICE *pDev      = pAC->dev[port];
	int                   OtherPort = (port) ? 0 : 1;
	struct SK_NET_DEVICE *pOtherDev = pAC->dev[OtherPort];
	SK_U16                PageSelect;
	SK_BOOL               YukLedState;

	SK_U16  YukLedOn = (PHY_M_LED_MO_DUP(MO_LED_ON)  |
			    PHY_M_LED_MO_10(MO_LED_ON)   |
			    PHY_M_LED_MO_100(MO_LED_ON)  |
			    PHY_M_LED_MO_1000(MO_LED_ON) | 
			    PHY_M_LED_MO_RX(MO_LED_ON));
	SK_U16  YukLedOff = (PHY_M_LED_MO_DUP(MO_LED_OFF)  |
			     PHY_M_LED_MO_10(MO_LED_OFF)   |
			     PHY_M_LED_MO_100(MO_LED_OFF)  |
			     PHY_M_LED_MO_1000(MO_LED_OFF) | 
			     PHY_M_LED_MO_RX(MO_LED_OFF) | 
			     PHY_M_LED_MO_TX(MO_LED_OFF));

	nbrBlinkQuarterSeconds--;
	if (nbrBlinkQuarterSeconds <= 0) {
	  /*
	   * We have to stop the device again in case the device has no
	   * been up.
	   */

	  if (!boardWasDown[0]) {
	    /*
	     * The board is already up as we bring it up in case it is not.
	     */
	  } else {
	    (*pDev->netdev_ops->ndo_stop)(pDev);
	  }
	  if (isDualNetCard) {
	    if (!boardWasDown[1]) {
	      /*
	       * The board is already up as we bring it up in case it is not.
	       */
	    } else {
	      (*pOtherDev->netdev_ops->ndo_stop)(pOtherDev);
	    }
	    
	  }

	  isDualNetCard      = SK_FALSE;
	  isLocateNICrunning = SK_FALSE;
	  return;
	}
	doSwitchLEDsOn = (doSwitchLEDsOn) ? SK_FALSE : SK_TRUE;

	if ( (doSwitchLEDsOn) && (nbrBlinkQuarterSeconds > 2) ){
		if (pAC->GIni.GIGenesis) {
			SK_OUT8(IoC,MR_ADDR(port,LNK_LED_REG),(SK_U8)SK_LNK_ON);
			SkGeYellowLED(pAC,IoC,LED_ON >> 1);
			SkGeXmitLED(pAC,IoC,MR_ADDR(port,RX_LED_INI),SK_LED_TST);
			if (pAC->GIni.GP[port].PhyType == SK_PHY_BCOM) {
				SkXmPhyWrite(pAC,IoC,port,PHY_BCOM_P_EXT_CTRL,PHY_B_PEC_LED_ON);
			} else if (pAC->GIni.GP[port].PhyType == SK_PHY_LONE) {
				SkXmPhyWrite(pAC,IoC,port,PHY_LONE_LED_CFG,0x0800);
			} else {
				SkGeXmitLED(pAC,IoC,MR_ADDR(port,TX_LED_INI),SK_LED_TST);
			}
		} else {
		  if ( (pAC->GIni.GIChipId == CHIP_ID_YUKON_XL) ||