200-MIPS-ath79-fix-ar933x-wmac-reset.patch 631 B

123456789101112131415161718192021222324252627282930
  1. --- a/arch/mips/ath79/dev-wmac.c
  2. +++ b/arch/mips/ath79/dev-wmac.c
  3. @@ -62,10 +62,26 @@ static void __init ar913x_wmac_setup(voi
  4. static int ar933x_wmac_reset(void)
  5. {
  6. + int retries = 20;
  7. +
  8. ath79_device_reset_set(AR933X_RESET_WMAC);
  9. ath79_device_reset_clear(AR933X_RESET_WMAC);
  10. - return 0;
  11. + while (1) {
  12. + u32 bootstrap;
  13. +
  14. + bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
  15. + if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0)
  16. + return 0;
  17. +
  18. + if (retries-- == 0)
  19. + break;
  20. +
  21. + udelay(10000);
  22. + }
  23. +
  24. + pr_err("ar933x: WMAC reset timed out");
  25. + return -ETIMEDOUT;
  26. }
  27. static int ar933x_r1_get_wmac_revision(void)