600-0006-rt2x00-rt2800lib-init-additional-beacon-offset-regis.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 1bfa43ca8f30be53ce4fa79cfc3e219642a812b6 Mon Sep 17 00:00:00 2001
  2. From: Gabor Juhos <juhosg@openwrt.org>
  3. Date: Mon, 2 Sep 2013 10:58:32 +0200
  4. Subject: [PATCH] rt2x00: rt2800lib: init additional beacon offset registers
  5. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  6. ---
  7. drivers/net/wireless/ralink/rt2x00/rt2800.h | 14 ++++++++++++++
  8. drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 24 ++++++++++++++++++++++++
  9. 2 files changed, 38 insertions(+)
  10. --- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  11. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  12. @@ -629,6 +629,20 @@
  13. */
  14. #define PBF_DBG 0x043c
  15. +/* BCN_OFFSET2 */
  16. +#define BCN_OFFSET2 0x0444
  17. +#define BCN_OFFSET2_BCN8 FIELD32(0x000000ff)
  18. +#define BCN_OFFSET2_BCN9 FIELD32(0x0000ff00)
  19. +#define BCN_OFFSET2_BCN10 FIELD32(0x00ff0000)
  20. +#define BCN_OFFSET2_BCN11 FIELD32(0xff000000)
  21. +
  22. +/* BCN_OFFSET3 */
  23. +#define BCN_OFFSET3 0x0448
  24. +#define BCN_OFFSET3_BCN12 FIELD32(0x000000ff)
  25. +#define BCN_OFFSET3_BCN13 FIELD32(0x0000ff00)
  26. +#define BCN_OFFSET3_BCN14 FIELD32(0x00ff0000)
  27. +#define BCN_OFFSET3_BCN15 FIELD32(0xff000000)
  28. +
  29. /*
  30. * RF registers
  31. */
  32. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  33. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  34. @@ -4627,6 +4627,30 @@ static int rt2800_init_registers(struct
  35. if (ret)
  36. return ret;
  37. + if (drv_data->hw_beacon_count == 16) {
  38. + rt2800_register_read(rt2x00dev, BCN_OFFSET2, &reg);
  39. + rt2x00_set_field32(&reg, BCN_OFFSET2_BCN8,
  40. + rt2800_get_beacon_offset(rt2x00dev, 8));
  41. + rt2x00_set_field32(&reg, BCN_OFFSET2_BCN9,
  42. + rt2800_get_beacon_offset(rt2x00dev, 9));
  43. + rt2x00_set_field32(&reg, BCN_OFFSET2_BCN10,
  44. + rt2800_get_beacon_offset(rt2x00dev, 10));
  45. + rt2x00_set_field32(&reg, BCN_OFFSET2_BCN11,
  46. + rt2800_get_beacon_offset(rt2x00dev, 11));
  47. + rt2800_register_write(rt2x00dev, BCN_OFFSET2, reg);
  48. +
  49. + rt2800_register_read(rt2x00dev, BCN_OFFSET3, &reg);
  50. + rt2x00_set_field32(&reg, BCN_OFFSET3_BCN12,
  51. + rt2800_get_beacon_offset(rt2x00dev, 12));
  52. + rt2x00_set_field32(&reg, BCN_OFFSET3_BCN13,
  53. + rt2800_get_beacon_offset(rt2x00dev, 13));
  54. + rt2x00_set_field32(&reg, BCN_OFFSET3_BCN14,
  55. + rt2800_get_beacon_offset(rt2x00dev, 14));
  56. + rt2x00_set_field32(&reg, BCN_OFFSET3_BCN15,
  57. + rt2800_get_beacon_offset(rt2x00dev, 15));
  58. + rt2800_register_write(rt2x00dev, BCN_OFFSET3, reg);
  59. + }
  60. +
  61. rt2800_register_write(rt2x00dev, LEGACY_BASIC_RATE, 0x0000013f);
  62. rt2800_register_write(rt2x00dev, HT_BASIC_RATE, 0x00008003);