mcap: linux: Add check for bitstream completion

This patch fixes the issue
Done pin doesn't go high after programming
the 2nd stage bit stream.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Reviewed-by: Srikanth Vemula <svemula@xilinx.com>
This commit is contained in:
Kedareswara rao Appana 2015-05-27 18:49:40 +05:30 committed by Nava kishore Manne
parent 554c3f5dd2
commit e1557c765f
2 changed files with 33 additions and 0 deletions

View file

@ -200,6 +200,30 @@ static int MCapClearRequestByConfigure(struct mcap_dev *mdev, u32 *restore)
return 0;
}
static int Checkforcompletion(struct mcap_dev *mdev)
{
unsigned long retry_count = 0;
u32 delay;
int sr, i;
sr = MCapRegRead(mdev, MCAP_STATUS);
while (!(sr & MCAP_STS_EOS_MASK)) {
usleep(2);
for (i=0 ; i < EMCAP_EOS_LOOP_COUNT; i++) {
MCapRegWrite(mdev, MCAP_DATA, EMCAP_NOOP_VAL);
}
sr = MCapRegRead(mdev, MCAP_STATUS);
retry_count++;
if (retry_count > EMCAP_EOS_RETRY_COUNT) {
pr_err("Error: The MCAP EOS bit did not assert after");
pr_err(" programming the specified programming file\n");
return -EMCAPREQ;
}
}
return 0;
}
static int MCapWriteBitStream(struct mcap_dev *mdev, u32 *data,
int len, u8 bswap)
{
@ -242,6 +266,11 @@ static int MCapWriteBitStream(struct mcap_dev *mdev, u32 *data,
MCapRegWrite(mdev, MCAP_DATA, __bswap_32(data[count]));
}
/* Check for Completion */
err = Checkforcompletion(mdev);
if (err)
return -EMCAPCFG;
if (IsErrSet(mdev) || IsFifoOverflow(mdev)) {
pr_err("Failed to Write Bitstream\n");
MCapRegWrite(mdev, MCAP_CONTROL, restore);

View file

@ -92,6 +92,10 @@
#define EMCAPBUSWALK 127
#define EMCAPCFGACC 128
#define EMCAP_EOS_RETRY_COUNT 10
#define EMCAP_EOS_LOOP_COUNT 100
#define EMCAP_NOOP_VAL 0x2000000
#undef DEBUG
#ifndef DEBUG