7195-increment-MC_CMD_COMPLETION_TIMEOUT_MS.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From 71d19cd1107fa435d056e08e7d7ef7d8f714cf35 Mon Sep 17 00:00:00 2001
  2. From: Lijun Pan <Lijun.Pan@freescale.com>
  3. Date: Fri, 31 Jul 2015 15:07:32 -0500
  4. Subject: [PATCH 195/226] increment MC_CMD_COMPLETION_TIMEOUT_MS
  5. 5000ms is barely enough for dpsw/dpdmux creation.
  6. If MC firmware could run faster, we would decrement the value later on.
  7. Signed-off-by: Lijun Pan <Lijun.Pan@freescale.com>
  8. (Stuart: resolved merge conflict)
  9. Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
  10. ---
  11. drivers/staging/fsl-mc/bus/mc-sys.c | 38 +++++++++++++++--------------------
  12. 1 file changed, 16 insertions(+), 22 deletions(-)
  13. --- a/drivers/staging/fsl-mc/bus/mc-sys.c
  14. +++ b/drivers/staging/fsl-mc/bus/mc-sys.c
  15. @@ -43,8 +43,10 @@
  16. /**
  17. * Timeout in milliseconds to wait for the completion of an MC command
  18. + * 5000 ms is barely enough for dpsw/dpdmux creation
  19. + * TODO: if MC firmware could response faster, we should decrease this value
  20. */
  21. -#define MC_CMD_COMPLETION_TIMEOUT_MS 500
  22. +#define MC_CMD_COMPLETION_TIMEOUT_MS 5000
  23. /*
  24. * usleep_range() min and max values used to throttle down polling
  25. @@ -327,17 +329,8 @@ static int mc_polling_wait_preemptible(s
  26. usleep_range(MC_CMD_COMPLETION_POLLING_MIN_SLEEP_USECS,
  27. MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS);
  28. - if (time_after_eq(jiffies, jiffies_until_timeout)) {
  29. - dev_dbg(mc_io->dev,
  30. - "MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n",
  31. - mc_io->portal_phys_addr,
  32. - (unsigned int)
  33. - MC_CMD_HDR_READ_TOKEN(cmd->header),
  34. - (unsigned int)
  35. - MC_CMD_HDR_READ_CMDID(cmd->header));
  36. -
  37. + if (time_after_eq(jiffies, jiffies_until_timeout))
  38. return -ETIMEDOUT;
  39. - }
  40. }
  41. *mc_status = status;
  42. @@ -369,17 +362,8 @@ static int mc_polling_wait_atomic(struct
  43. udelay(MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS);
  44. timeout_usecs -= MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS;
  45. - if (timeout_usecs == 0) {
  46. - dev_dbg(mc_io->dev,
  47. - "MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n",
  48. - mc_io->portal_phys_addr,
  49. - (unsigned int)
  50. - MC_CMD_HDR_READ_TOKEN(cmd->header),
  51. - (unsigned int)
  52. - MC_CMD_HDR_READ_CMDID(cmd->header));
  53. -
  54. + if (timeout_usecs == 0)
  55. return -ETIMEDOUT;
  56. - }
  57. }
  58. *mc_status = status;
  59. @@ -422,9 +406,19 @@ int mc_send_command(struct fsl_mc_io *mc
  60. else
  61. error = mc_polling_wait_atomic(mc_io, cmd, &status);
  62. - if (error < 0)
  63. + if (error < 0) {
  64. + if (error == -ETIMEDOUT) {
  65. + pr_debug("MC command timed out (portal: %#llx, obj handle: %#x, command: %#x)\n",
  66. + mc_io->portal_phys_addr,
  67. + (unsigned int)
  68. + MC_CMD_HDR_READ_TOKEN(cmd->header),
  69. + (unsigned int)
  70. + MC_CMD_HDR_READ_CMDID(cmd->header));
  71. + }
  72. goto common_exit;
  73. + }
  74. +
  75. if (status != MC_CMD_STATUS_OK) {
  76. dev_dbg(mc_io->dev,
  77. "MC command failed: portal: %#llx, obj handle: %#x, command: %#x, status: %s (%#x)\n",