Exemplo n.º 1
0
/*********************************************************** 
* Init the PHY or Switch of the board 			   *
 ***********************************************************/
MV_VOID mvEgigaPhySwitchInit(void) 
{
	if (RD_88F6183_AP == mvBoardIdGet())
	{
		mvEthE6161SwitchBasicInit(0);
	}
	else if ((DB_88F5181_5281_DDR2 == mvBoardIdGet())||
	    (DB_88F5X81_DDR1 == mvBoardIdGet()) ||
	    (DB_88F5181_DDR1_PEXPCI == mvBoardIdGet()) ||
	    (RD_88F5181_POS_NAS == mvBoardIdGet()) ||
	    (DB_88F5182_DDR2 == mvBoardIdGet())||
	    (DB_88F5182_DDR2_A == mvBoardIdGet())||
	    (DB_88F5082_DDR2 == mvBoardIdGet())||
	    (RD_88F5182_2XSATA == mvBoardIdGet())||
	    (DB_88F5181L_DDR2_2XTDM == mvBoardIdGet()) ||
	    (DB_88F5180N_DDR1 == mvBoardIdGet()) ||
	    (DB_88F5180N_DDR2 == mvBoardIdGet()) ||
	    (DB_88W8660_DDR2 == mvBoardIdGet()) )
	{
		mvEthE1111PhyBasicInit(0);
	
	}else if ((RD_88F5182_2XSATA3 == mvBoardIdGet()) ||
			(RD_88F5182_2XSATA == mvBoardIdGet()) ||
			(RD_88F5082_2XSATA == mvBoardIdGet()) ||
			(RD_88F5082_2XSATA3 == mvBoardIdGet()) ||
	    		(DB_88F5X81_DDR2 == mvBoardIdGet()) ||
			(RD_88F6183_GP == mvBoardIdGet()) ||
			(DB_88F6183_BP == mvBoardIdGet()))
	{
		/* 1118 is identical to 1116 */
		mvEthE1116PhyBasicInit(0);

	}else if (DB_88F5181_5281_DDR1 == mvBoardIdGet())
	{
		mvEthE1011PhyBasicInit(0);

	}else if ((RD_88F5181_VOIP == mvBoardIdGet()) || (RD_88F5181L_VOIP_FE == mvBoardIdGet()) ||
			(RD_88F5181_GTW_FE == mvBoardIdGet()))
	{
		mvEthE6063SwitchBasicInit(0);

	}else if ((RD_88W8660_DDR1 == mvBoardIdGet()) || (RD_88W8660_AP82S_DDR1 == mvBoardIdGet()))
	{
		mvEthE6065_61SwitchBasicInit(0);
	
	}else if ( (RD_88F5181L_VOIP_GE == mvBoardIdGet()) || 
			(RD_88F5181_GTW_GE == mvBoardIdGet()) ||
			(RD_88F5181L_VOIP_FXO_GE == mvBoardIdGet()))
	{
		mvEthE6131SwitchBasicInit(0);

	}else if (RD_88F6082_MICRO_DAS_NAS == mvBoardIdGet())
	{
		mvEthE1112PhyBasicInit(0);
	}
	else if ((DB_88F6082_BP == mvBoardIdGet()) ||
		(DB_88F6082L_BP == mvBoardIdGet()))
	{
		mvEthE1112PhyBasicInit(0);
		mvEthE1112PhyBasicInit(1);
	}
	else if (RD_88F6082_DX243_24G == mvBoardIdGet())
	{
		mvEthE1112PhyBasicInit(0);
		mvEthE1111PhyBasicInit(1);
	}
	else if (RD_88F6082_NAS == mvBoardIdGet())
	{
		/* Power down phy in case we enter power down mode */
		mvEthE1112PhyPowerDown(0);
		mvEthE1112PhyPowerDown(1);
	}
	else if (RD_88F6183_AP == mvBoardIdGet())
	{
		mvEthE6161SwitchBasicInit(0);
	}
}
Exemplo n.º 2
0
/*******************************************************************************
* mvEthPhyInit -
*
* DESCRIPTION:
*       Initialize the ethernet phy unit.
*
* INPUT:
*       ethPortNum - The port number on which to initialize the PHY.
*	eeeEnable  - Whether to enable EEE or not.
*
* OUTPUT:
*       None.
*
* RETURN:
*       MV_OK on success, MV_ERROR otherwise.
*
*******************************************************************************/
MV_STATUS mvEthPhyInit(MV_U32 ethPortNum, MV_BOOL eeeEnable)
{
	MV_U32     phyAddr = 0;
	MV_U16     deviceId;
	MV_U16     id1, id2;

	if (ethPortNum != ((MV_U32) -1))
		phyAddr = ethphyHalData.phyAddr[ethPortNum];
	else
		phyAddr = ethphyHalData.quadPhyStartAddr;

	/* Set page as 0 */
	if (mvEthPhyRegWrite(phyAddr, 22, 0) != MV_OK)
		return MV_ERROR;

	/* Reads ID1 */
	if (mvEthPhyRegRead(phyAddr, 2, &id1) != MV_OK)
		return MV_ERROR;

	/* Reads ID2 */
	if (mvEthPhyRegRead(phyAddr, 3, &id2) != MV_OK)
		return MV_ERROR;

	if (!MV_IS_MARVELL_OUI(id1, id2)) {
		mvOsPrintf("Cannot find Marvell Device id1 %x id2 %x\n", id1, id2);
		return MV_ERROR;
	}

	deviceId = (id2 & 0x3F0) >> 4;
	switch (deviceId) {
	case MV_PHY_88E1116:
	case MV_PHY_88E1116R:
		mvEthE1116PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E3061:
		mvEthE3016PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E1111:
		mvEthE1111PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E1112:
		mvEthE1112PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E1011:
		mvEthE1011PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E1121:
		mvEth1121PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E114X:
		mvEth1145PhyBasicInit(phyAddr);
		break;
	case MV_PHY_88E154X:
	case MV_PHY_88E154X_Z1:
		/* case MV_PHY_KW2_INTERNAL_GE: */
		if (ethPortNum != ((MV_U32) -1))
			mvEthInternalGEPhyBasicInit(phyAddr);
		else
			mvEth1540PhyBasicInit(eeeEnable);
		break;
	case MV_PHY_88E1340S:
	case MV_PHY_88E1340:
	case MV_PHY_88E1340M:
		mvEth1340PhyBasicInit();
		break;
	case MV_PHY_88E104X:
	case MV_PHY_88E10X0:
	case MV_PHY_88E10X0S:
	case MV_PHY_88E3082:
	case MV_PHY_88E1149:
	case MV_PHY_88E1181:
	case MV_PHY_88E3016_88E3019:
	case MV_PHY_88E1240:
	case MV_PHY_88E1149R:
	case MV_PHY_88E1119R:
	case MV_PHY_88E1310:
	default:
			mvOsPrintf("Unknown Device(%#x). Initialization failed\n", deviceId);
			return MV_ERROR;
	}
	return MV_OK;
}