public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
To: grant.likely@secretlab.ca, git-dev@xilinx.com,
	linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Cc: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Subject: [PATCH 2/3] Xilinx: hwicap: Verify sync before reading idcode.
Date: Mon, 17 Mar 2008 10:36:31 -0700	[thread overview]
Message-ID: <20080317173645.7A21D9A8069@mail131-sin.bigfish.com> (raw)
In-Reply-To: <1205775392-32222-2-git-send-email-stephen.neuendorffer@xilinx.com>

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@xilinx.com>
---
 drivers/char/xilinx_hwicap/xilinx_hwicap.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 304727d..5b8d646 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -250,8 +250,26 @@ static int hwicap_get_configuration_register(struct hwicap_drvdata *drvdata,
 	 * 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;
-- 
1.5.3.4-dirty




  parent reply	other threads:[~2008-03-17 17:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1205775392-32222-1-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-17 17:36 ` [PATCH 1/3] Xilinx: hwicap: Refactor status handling code Stephen Neuendorffer
2008-03-17 20:23   ` Grant Likely
     [not found] ` <1205775392-32222-2-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-17 17:36   ` Stephen Neuendorffer [this message]
2008-03-17 20:18     ` [PATCH 2/3] Xilinx: hwicap: Verify sync before reading idcode Grant Likely
     [not found]   ` <1205775392-32222-3-git-send-email-stephen.neuendorffer@xilinx.com>
2008-03-17 17:36     ` [PATCH 3/3] Xilinx: hwicap: Use fixed device major Stephen Neuendorffer
2008-03-17 20:20       ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080317173645.7A21D9A8069@mail131-sin.bigfish.com \
    --to=stephen.neuendorffer@xilinx.com \
    --cc=git-dev@xilinx.com \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox