606-rt2x00-allow_disabling_bands_through_platform_data.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --- a/include/linux/rt2x00_platform.h
  2. +++ b/include/linux/rt2x00_platform.h
  3. @@ -14,6 +14,9 @@
  4. struct rt2x00_platform_data {
  5. char *eeprom_file_name;
  6. +
  7. + int disable_2ghz;
  8. + int disable_5ghz;
  9. };
  10. #endif /* _RT2X00_PLATFORM_H */
  11. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  12. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13. @@ -951,6 +951,22 @@ static int rt2x00lib_probe_hw_modes(stru
  14. unsigned int num_rates;
  15. unsigned int i;
  16. + if (rt2x00dev->dev->platform_data) {
  17. + struct rt2x00_platform_data *pdata;
  18. +
  19. + pdata = rt2x00dev->dev->platform_data;
  20. + if (pdata->disable_2ghz)
  21. + spec->supported_bands &= ~SUPPORT_BAND_2GHZ;
  22. + if (pdata->disable_5ghz)
  23. + spec->supported_bands &= ~SUPPORT_BAND_5GHZ;
  24. + }
  25. +
  26. + if ((spec->supported_bands & SUPPORT_BAND_BOTH) == 0) {
  27. + rt2x00_err(rt2x00dev, "No supported bands\n");
  28. + return -EINVAL;
  29. + }
  30. +
  31. +
  32. num_rates = 0;
  33. if (spec->supported_rates & SUPPORT_RATE_CCK)
  34. num_rates += 4;
  35. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  36. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  37. @@ -408,6 +408,7 @@ struct hw_mode_spec {
  38. unsigned int supported_bands;
  39. #define SUPPORT_BAND_2GHZ 0x00000001
  40. #define SUPPORT_BAND_5GHZ 0x00000002
  41. +#define SUPPORT_BAND_BOTH (SUPPORT_BAND_2GHZ | SUPPORT_BAND_5GHZ)
  42. unsigned int supported_rates;
  43. #define SUPPORT_RATE_CCK 0x00000001