aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorIra W. Snyder <iws@ovro.caltech.edu>2012-07-18 18:33:17 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2012-07-20 11:49:05 -0400
commit30df5888e4a244093c1b403b55ef889c97824f7b (patch)
tree0a72a7baf1848b142cefb54ced268d600af655c8 /drivers/net/can
parent83702f69272e4591a91a27eb58eade1bcd361dae (diff)
can: janz-ican3: avoid firmware lockup caused by infinite bus error quota
If the bus error quota is set to infinite and the host CPU cannot keep up, the Janz VMOD-ICAN3 firmware will stop responding to control messages until the controller is reset. The firmware will automatically stop sending bus error messages when the quota is reached, and will only resume sending bus error messages when the quota is re-set to a positive value. This limitation is worked around by setting the bus error quota to one message, and then re-setting the quota to one message every time a bus error message is received. By doing this, the firmware never stops responding to control messages. The CAN bus can be reset without a hard-reset of the controller card. Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/janz-ican3.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index 47f8f6b4fef..e06ec403521 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -972,6 +972,16 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg)
972 stats->rx_errors++; 972 stats->rx_errors++;
973 } 973 }
974 974
975 /*
976 * The controller automatically disables bus-error interrupts
977 * and therefore we must re-enable them.
978 */
979 ret = ican3_set_buserror(mod, 1);
980 if (ret) {
981 dev_err(mod->dev, "unable to re-enable bus-error\n");
982 return ret;
983 }
984
975 /* bus error reporting is off, return immediately */ 985 /* bus error reporting is off, return immediately */
976 if (!(mod->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)) 986 if (!(mod->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING))
977 return 0; 987 return 0;
@@ -1451,7 +1461,7 @@ static int __devinit ican3_startup_module(struct ican3_dev *mod)
1451 } 1461 }
1452 1462
1453 /* default to "bus errors enabled" */ 1463 /* default to "bus errors enabled" */
1454 ret = ican3_set_buserror(mod, ICAN3_BUSERR_QUOTA_MAX); 1464 ret = ican3_set_buserror(mod, 1);
1455 if (ret) { 1465 if (ret) {
1456 dev_err(mod->dev, "unable to set bus-error\n"); 1466 dev_err(mod->dev, "unable to set bus-error\n");
1457 return ret; 1467 return ret;