The patch titled xilinx: hwicap: verify sync before reading idcode has been added to the -mm tree. Its filename is xilinx-hwicap-verify-sync-before-reading-idcode.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: xilinx: hwicap: verify sync before reading idcode From: Stephen Neuendorffer <stephen.neuendorffer@xxxxxxxxxx> It appears that in some cases, the sync word might not be recognized by the hardware correctly. If this happens, then attempting to read from the port results in an unrecoverable error because of the design of the FPGA core. This patch updates the code to check the status of the device before reading the IDCODE, in order to avoid entering this unrecoverable state. This patch also adds additional NOOP commands into the sychronization sequence, which appears to be necessary to avoid the condition on some hardware. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xxxxxxxxxx> Cc: Josh Boyer <jwboyer@xxxxxxxxxxxxxxxxxx> Acked-by: Grant Likely <grant.likely@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff -puN drivers/char/xilinx_hwicap/xilinx_hwicap.c~xilinx-hwicap-verify-sync-before-reading-idcode drivers/char/xilinx_hwicap/xilinx_hwicap.c --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c~xilinx-hwicap-verify-sync-before-reading-idcode +++ a/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -250,8 +250,26 @@ static int hwicap_get_configuration_regi * Create the data to be written to the ICAP. */ buffer[index++] = XHI_DUMMY_PACKET; + buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_SYNC_PACKET; buffer[index++] = XHI_NOOP_PACKET; + buffer[index++] = XHI_NOOP_PACKET; + + /* + * Write the data to the FIFO and initiate the transfer of data present + * in the FIFO to the ICAP device. + */ + status = drvdata->config->set_configuration(drvdata, + &buffer[0], index); + if (status) + return status; + + /* If the syncword was not found, then we need to start over. */ + status = drvdata->config->get_status(drvdata); + if ((status & XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK) + return -EIO; + + index = 0; buffer[index++] = hwicap_type_1_read(reg) | 1; buffer[index++] = XHI_NOOP_PACKET; buffer[index++] = XHI_NOOP_PACKET; _ Patches currently in -mm which might be from stephen.neuendorffer@xxxxxxxxxx are xilinx-hwicap-refactor-status-handling-code.patch xilinx-hwicap-verify-sync-before-reading-idcode.patch xilinx-hwicap-use-fixed-device-major.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html