vphy: Added API to check the lock status of a PLL.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
Acked-by: Srikanth Vemula <svemula@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2015-10-20 23:52:49 -07:00 committed by Nava kishore Manne
parent 085aabda2c
commit 5f1cd29c7a
2 changed files with 35 additions and 14 deletions

View file

@ -986,10 +986,38 @@ u32 XVphy_WaitForResetDone(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId,
*
******************************************************************************/
u32 XVphy_WaitForPllLock(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId)
{
u32 Status = XST_FAILURE;
u8 Retry = 0;
do {
XVphy_WaitUs(InstancePtr, 1000);
Status = XVphy_IsPllLocked(InstancePtr, QuadId, ChId);
Retry++;
} while ((Status != XST_SUCCESS) && (Retry < 15));
return Status;
}
/*****************************************************************************/
/**
* This function will check the status of a PLL lock on the specified channel.
*
* @param InstancePtr is a pointer to the XVphy core instance.
* @param QuadId is the GT quad ID to operate on.
* @param ChId is the channel ID which to operate on.
*
* @return
* - XST_SUCCESS if the specified PLL is locked.
* - XST_FAILURE otherwise.
*
* @note None.
*
******************************************************************************/
u32 XVphy_IsPllLocked(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId)
{
u32 RegVal;
u32 MaskVal;
u8 Retry = 0;
if (ChId == XVPHY_CHANNEL_ID_CMN0) {
MaskVal = XVPHY_PLL_LOCK_STATUS_QPLL0_MASK;
@ -1007,22 +1035,14 @@ u32 XVphy_WaitForPllLock(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId)
else {
MaskVal = XVPHY_PLL_LOCK_STATUS_CPLL_MASK(ChId);
}
RegVal = XVphy_ReadReg(InstancePtr->Config.BaseAddr,
XVPHY_PLL_LOCK_STATUS_REG);
do {
RegVal = XVphy_ReadReg(InstancePtr->Config.BaseAddr,
XVPHY_PLL_LOCK_STATUS_REG);
if (!(RegVal & MaskVal)){
XVphy_WaitUs(InstancePtr, 1000);
Retry++;
}
} while ((!(RegVal & MaskVal)) && (Retry < 15));
if (Retry == 15){
return XST_FAILURE;
}
else {
if (RegVal & MaskVal) {
return XST_SUCCESS;
}
return XST_FAILURE;
}
/*****************************************************************************/

View file

@ -688,6 +688,7 @@ u32 XVphy_WaitForPmaResetDone(XVphy *InstancePtr, u8 QuadId,
u32 XVphy_WaitForResetDone(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId,
XVphy_DirectionType Dir);
u32 XVphy_WaitForPllLock(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId);
u32 XVphy_IsPllLocked(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId);
u32 XVphy_ResetGtPll(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId,
XVphy_DirectionType Dir, u8 Hold);
u32 XVphy_ResetGtTxRx(XVphy *InstancePtr, u8 QuadId, XVphy_ChannelId ChId,