600-0002-rt2x00-rt2800lib-introduce-RT2800_HAS_HIGH_SHARED_ME.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. From a7f268af31dddf763fe3dbe9cbf96ea77e0540e0 Mon Sep 17 00:00:00 2001
  2. From: Gabor Juhos <juhosg@openwrt.org>
  3. Date: Sat, 17 Aug 2013 19:31:41 +0200
  4. Subject: [PATCH] rt2x00: rt2800lib: introduce RT2800_HAS_HIGH_SHARED_MEM flag
  5. Some chipsets have more than 16KB of shared memory.
  6. Introduce a new rt2800 specific flag to indicate that
  7. and add a helper function which helps to check the
  8. presence of the new flag.
  9. Also enable the new flag for the RT3593 chipset which
  10. has 24KB of shared memory. The flag can also be used
  11. for other chipsets, but none of those has been tested
  12. yet.
  13. Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
  14. ---
  15. Changes since v1:
  16. - don't enable the new flag for RT3071 and RT5592
  17. ---
  18. drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 4 ++++
  19. drivers/net/wireless/ralink/rt2x00/rt2800lib.h | 13 +++++++++++++
  20. 2 files changed, 17 insertions(+)
  21. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  22. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  23. @@ -7726,6 +7726,7 @@ static int rt2800_probe_rt(struct rt2x00
  24. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  25. {
  26. + struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  27. int retval;
  28. u32 reg;
  29. @@ -7733,6 +7734,9 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  30. if (retval)
  31. return retval;
  32. + if (rt2x00_rt(rt2x00dev, RT3593))
  33. + __set_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  34. +
  35. /*
  36. * Allocate eeprom data.
  37. */
  38. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  39. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
  40. @@ -22,6 +22,10 @@
  41. #include "rt2800.h"
  42. +enum rt2800_flag {
  43. + RT2800_HAS_HIGH_SHARED_MEM,
  44. +};
  45. +
  46. /* RT2800 driver data structure */
  47. struct rt2800_drv_data {
  48. u8 calibration_bw20;
  49. @@ -32,6 +36,8 @@ struct rt2800_drv_data {
  50. u8 txmixer_gain_5g;
  51. unsigned int tbtt_tick;
  52. DECLARE_BITMAP(sta_ids, STA_IDS_SIZE);
  53. +
  54. + unsigned long rt2800_flags;
  55. };
  56. struct rt2800_ops {
  57. @@ -64,6 +70,13 @@ struct rt2800_ops {
  58. __le32 *(*drv_get_txwi)(struct queue_entry *entry);
  59. };
  60. +static inline bool rt2800_has_high_shared_mem(struct rt2x00_dev *rt2x00dev)
  61. +{
  62. + struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  63. +
  64. + return test_bit(RT2800_HAS_HIGH_SHARED_MEM, &drv_data->rt2800_flags);
  65. +}
  66. +
  67. static inline void rt2800_register_read(struct rt2x00_dev *rt2x00dev,
  68. const unsigned int offset,
  69. u32 *value)