609-rt2x00-allow_disabling_bands_through_dts.patch 929 B

123456789101112131415161718192021222324252627
  1. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  2. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  3. @@ -26,6 +26,7 @@
  4. #include <linux/module.h>
  5. #include <linux/slab.h>
  6. #include <linux/log2.h>
  7. +#include <linux/of.h>
  8. #include "rt2x00.h"
  9. #include "rt2x00lib.h"
  10. @@ -951,6 +952,16 @@ static int rt2x00lib_probe_hw_modes(stru
  11. struct ieee80211_rate *rates;
  12. unsigned int num_rates;
  13. unsigned int i;
  14. +#ifdef CONFIG_OF
  15. + struct device_node *np = rt2x00dev->dev->of_node;
  16. + unsigned int enabled;
  17. + if (!of_property_read_u32(np, "ralink,2ghz",
  18. + &enabled) && !enabled)
  19. + spec->supported_bands &= ~SUPPORT_BAND_2GHZ;
  20. + if (!of_property_read_u32(np, "ralink,5ghz",
  21. + &enabled) && !enabled)
  22. + spec->supported_bands &= ~SUPPORT_BAND_5GHZ;
  23. +#endif /* CONFIG_OF */
  24. if (rt2x00dev->dev->platform_data) {
  25. struct rt2x00_platform_data *pdata;