aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/xilinx_hwicap
diff options
context:
space:
mode:
authorStephen Neuendorffer <stephen.neuendorffer@xilinx.com>2008-03-17 13:36:31 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2008-03-26 08:27:21 -0400
commit4c58f8fe2e84ba76a4bef01cbd987b5ce62771c3 (patch)
tree6cad4a17085b51e29e757fdd0b39cca3775beb34 /drivers/char/xilinx_hwicap
parent6b06fdbaf9eb9f208a83540265a6a82bf1049a41 (diff)
[POWERPC] Xilinx: hwicap: Verify sync before reading idcode.
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> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/xilinx_hwicap')
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c18
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 304727deaf3b..5b8d6463e11e 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,
250 * Create the data to be written to the ICAP. 250 * Create the data to be written to the ICAP.
251 */ 251 */
252 buffer[index++] = XHI_DUMMY_PACKET; 252 buffer[index++] = XHI_DUMMY_PACKET;
253 buffer[index++] = XHI_NOOP_PACKET;
253 buffer[index++] = XHI_SYNC_PACKET; 254 buffer[index++] = XHI_SYNC_PACKET;
254 buffer[index++] = XHI_NOOP_PACKET; 255 buffer[index++] = XHI_NOOP_PACKET;
256 buffer[index++] = XHI_NOOP_PACKET;
257
258 /*
259 * Write the data to the FIFO and initiate the transfer of data present
260 * in the FIFO to the ICAP device.
261 */
262 status = drvdata->config->set_configuration(drvdata,
263 &buffer[0], index);
264 if (status)
265 return status;
266
267 /* If the syncword was not found, then we need to start over. */
268 status = drvdata->config->get_status(drvdata);
269 if ((status & XHI_SR_DALIGN_MASK) != XHI_SR_DALIGN_MASK)
270 return -EIO;
271
272 index = 0;
255 buffer[index++] = hwicap_type_1_read(reg) | 1; 273 buffer[index++] = hwicap_type_1_read(reg) | 1;
256 buffer[index++] = XHI_NOOP_PACKET; 274 buffer[index++] = XHI_NOOP_PACKET;
257 buffer[index++] = XHI_NOOP_PACKET; 275 buffer[index++] = XHI_NOOP_PACKET;