dptx: Added retry when checking if a connection exists.

It was observed that in MST mode, some of the sideband message were failing
due to the first check not showing a connected device.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2014-09-22 20:18:20 -07:00 committed by Suneel Garapati
parent 37d4046df4
commit 3974e30158
2 changed files with 35 additions and 20 deletions

View file

@ -72,6 +72,8 @@
#define XDPTX_AUX_MAX_DEFER_COUNT 50
/* Error out if an AUX request times out more than 50 times awaiting a reply. */
#define XDPTX_AUX_MAX_TIMEOUT_COUNT 50
/* Error out if checking for a connected device times out more than 50 times. */
#define XDPTX_IS_CONNECTED_MAX_TIMEOUT_COUNT 50
/****************************** Type Definitions ******************************/
@ -660,6 +662,38 @@ void XDptx_CfgTxPeLevel(XDptx *InstancePtr, u8 Level, u8 TxLevel)
InstancePtr->BoardChar.TxPeLevels[Level] = TxLevel;
}
/******************************************************************************/
/**
* This function checks if there is a connected RX device.
*
* @param InstancePtr is a pointer to the XDptx instance.
*
* @return
* - TRUE if there is a connection.
* - FALSE if there is no connection.
*
*******************************************************************************/
u32 XDptx_IsConnected(XDptx *InstancePtr)
{
u32 Status;
u8 Retries = 0;
do {
Status = XDptx_ReadReg(InstancePtr->Config.BaseAddr,
XDPTX_INTERRUPT_SIG_STATE) &
XDPTX_INTERRUPT_SIG_STATE_HPD_STATE_MASK;
if (Retries > XDPTX_IS_CONNECTED_MAX_TIMEOUT_COUNT) {
return 0;
}
Retries++;
XDptx_WaitUs(InstancePtr, 1000);
} while (Status == 0);
return 1;
}
/******************************************************************************/
/**
* This function issues a read request over the AUX channel.

View file

@ -214,26 +214,6 @@
#include "xil_assert.h"
#include "xil_types.h"
/******************* Macros (Inline Functions) Definitions ********************/
/******************************************************************************/
/**
* This macro checks if there is a connected RX device.
*
* @param InstancePtr is a pointer to the XDptx instance.
*
* @return
* - TRUE if there is a connection.
* - FALSE if there is no connection.
*
* @note C-style signature:
* void XDptx_IsConnected(XDptx *InstancePtr)
*
*******************************************************************************/
#define XDptx_IsConnected(InstancePtr) \
(XDptx_ReadReg(InstancePtr->Config.BaseAddr, \
XDPTX_INTERRUPT_SIG_STATE) & XDPTX_INTERRUPT_SIG_STATE_HPD_STATE_MASK)
/****************************** Type Definitions ******************************/
/**
@ -797,6 +777,7 @@ u32 XDptx_SetLinkRate(XDptx *InstancePtr, u8 LinkRate);
u32 XDptx_SetScrambler(XDptx *InstancePtr, u8 Enable);
/* xdptx.c: General usage functions. */
u32 XDptx_IsConnected(XDptx *InstancePtr);
void XDptx_EnableMainLink(XDptx *InstancePtr);
void XDptx_DisableMainLink(XDptx *InstancePtr);
void XDptx_ResetPhy(XDptx *InstancePtr, u32 Reset);