dp: tx: Ensure that for AUX transactions, the received bytes matches.

Verify that the AUX transaction replied with the expected number of bytes.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2015-02-09 14:53:36 -07:00 committed by Nava kishore Manne
parent 11f81b0d62
commit 2cb307c7d5

View file

@ -2963,6 +2963,7 @@ static u32 XDp_TxAuxRequest(XDp *InstancePtr, XDp_AuxTransaction *Request)
*******************************************************************************/
static u32 XDp_TxAuxRequestSend(XDp *InstancePtr, XDp_AuxTransaction *Request)
{
u32 TimeoutCount;
u32 Status;
u8 Index;
@ -3012,6 +3013,20 @@ static u32 XDp_TxAuxRequestSend(XDp *InstancePtr, XDp_AuxTransaction *Request)
if ((Request->CmdCode == XDP_TX_AUX_CMD_READ) ||
(Request->CmdCode == XDP_TX_AUX_CMD_I2C_READ) ||
(Request->CmdCode == XDP_TX_AUX_CMD_I2C_READ_MOT)) {
/* Wait until all data has been received. */
TimeoutCount = 0;
do {
Status = XDp_ReadReg(InstancePtr->Config.BaseAddr,
XDP_TX_REPLY_DATA_COUNT);
XDp_WaitUs(InstancePtr, 100);
TimeoutCount++;
if (TimeoutCount >= XDP_AUX_MAX_TIMEOUT_COUNT) {
return XST_ERROR_COUNT_MAX;
}
} while (Status != Request->NumBytes);
/* Obtain the read data from the reply FIFO. */
for (Index = 0; Index < Request->NumBytes; Index++) {
Request->Data[Index] = XDp_ReadReg(