0496-bcm2835-sdhost-Don-t-exit-cmd-wait-loop-on-error.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. From e14a11520223fbb5d011a83f3de60cd56f3afad5 Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <phil@raspberrypi.org>
  3. Date: Fri, 2 Sep 2016 17:21:42 +0100
  4. Subject: [PATCH] bcm2835-sdhost: Don't exit cmd wait loop on error
  5. The FAIL flag can be set in the CMD register before command processing
  6. is complete, leading to spurious "failed to complete" errors. This has
  7. the effect of promoting harmless CRC7 errors during CMD1 processing
  8. into errors that can delay and even prevent booting.
  9. Also:
  10. 1) Convert the last KERN_ERROR message in the register dumping to
  11. KERN_INFO.
  12. 2) Remove an unnecessary reset call from bcm2835_sdhost_add_host.
  13. See: https://github.com/raspberrypi/linux/pull/1492
  14. Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  15. ---
  16. drivers/mmc/host/bcm2835-sdhost.c | 10 +++-------
  17. 1 file changed, 3 insertions(+), 7 deletions(-)
  18. --- a/drivers/mmc/host/bcm2835-sdhost.c
  19. +++ b/drivers/mmc/host/bcm2835-sdhost.c
  20. @@ -373,7 +373,7 @@ static void bcm2835_sdhost_dumpregs(stru
  21. pr_info("%s: SDRSP2 0x%08x\n",
  22. mmc_hostname(host->mmc),
  23. bcm2835_sdhost_read(host, SDRSP2));
  24. - pr_err("%s: SDRSP3 0x%08x\n",
  25. + pr_info("%s: SDRSP3 0x%08x\n",
  26. mmc_hostname(host->mmc),
  27. bcm2835_sdhost_read(host, SDRSP3));
  28. pr_info("%s: SDHSTS 0x%08x\n",
  29. @@ -1183,9 +1183,8 @@ static void bcm2835_sdhost_finish_comman
  30. retries = 1; // We've already waited long enough this time
  31. }
  32. - retries = host->cmd_quick_poll_retries;
  33. for (sdcmd = bcm2835_sdhost_read(host, SDCMD);
  34. - (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries;
  35. + (sdcmd & SDCMD_NEW_FLAG) && retries;
  36. retries--) {
  37. cpu_relax();
  38. sdcmd = bcm2835_sdhost_read(host, SDCMD);
  39. @@ -1208,8 +1207,7 @@ static void bcm2835_sdhost_finish_comman
  40. usleep_range(1, 10);
  41. spin_lock_irqsave(&host->lock, *irq_flags);
  42. sdcmd = bcm2835_sdhost_read(host, SDCMD);
  43. - if (!(sdcmd & SDCMD_NEW_FLAG) ||
  44. - (sdcmd & SDCMD_FAIL_FLAG))
  45. + if (!(sdcmd & SDCMD_NEW_FLAG))
  46. break;
  47. }
  48. }
  49. @@ -1892,8 +1890,6 @@ int bcm2835_sdhost_add_host(struct bcm28
  50. mmc = host->mmc;
  51. - bcm2835_sdhost_reset_internal(host);
  52. -
  53. mmc->f_max = host->max_clk;
  54. mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV;