351-v5.4-0001-brcmfmac-add-160MHz-in-chandef_to_chanspec.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. From f491645f039420fb7e14283e21b90772571c807c Mon Sep 17 00:00:00 2001
  2. From: Arend van Spriel <arend.vanspriel@broadcom.com>
  3. Date: Thu, 11 Jul 2019 10:45:30 +0200
  4. Subject: [PATCH] brcmfmac: add 160MHz in chandef_to_chanspec()
  5. The function chandef_to_chanspec() was not handling 160MHz bandwidth
  6. resulting in wrong encoding of the channel. That resulting in firmware
  7. rejecting the provided channel specification.
  8. Reviewed-by: Hante Meuleman <hante.meuleman@broadcom.com>
  9. Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
  10. Reviewed-by: Franky Lin <franky.lin@broadcom.com>
  11. Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  12. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  13. ---
  14. .../broadcom/brcm80211/brcmfmac/cfg80211.c | 21 ++++++++++++++++++-
  15. 1 file changed, 20 insertions(+), 1 deletion(-)
  16. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18. @@ -287,8 +287,26 @@ static u16 chandef_to_chanspec(struct br
  19. else
  20. ch_inf.sb = BRCMU_CHAN_SB_UU;
  21. break;
  22. - case NL80211_CHAN_WIDTH_80P80:
  23. case NL80211_CHAN_WIDTH_160:
  24. + ch_inf.bw = BRCMU_CHAN_BW_160;
  25. + if (primary_offset == -70)
  26. + ch_inf.sb = BRCMU_CHAN_SB_LLL;
  27. + else if (primary_offset == -50)
  28. + ch_inf.sb = BRCMU_CHAN_SB_LLU;
  29. + else if (primary_offset == -30)
  30. + ch_inf.sb = BRCMU_CHAN_SB_LUL;
  31. + else if (primary_offset == -10)
  32. + ch_inf.sb = BRCMU_CHAN_SB_LUU;
  33. + else if (primary_offset == 10)
  34. + ch_inf.sb = BRCMU_CHAN_SB_ULL;
  35. + else if (primary_offset == 30)
  36. + ch_inf.sb = BRCMU_CHAN_SB_ULU;
  37. + else if (primary_offset == 50)
  38. + ch_inf.sb = BRCMU_CHAN_SB_UUL;
  39. + else
  40. + ch_inf.sb = BRCMU_CHAN_SB_UUU;
  41. + break;
  42. + case NL80211_CHAN_WIDTH_80P80:
  43. case NL80211_CHAN_WIDTH_5:
  44. case NL80211_CHAN_WIDTH_10:
  45. default:
  46. @@ -307,6 +325,7 @@ static u16 chandef_to_chanspec(struct br
  47. }
  48. d11inf->encchspec(&ch_inf);
  49. + brcmf_dbg(TRACE, "chanspec: 0x%x\n", ch_inf.chspec);
  50. return ch_inf.chspec;
  51. }