611-rt2x00-rf_vals-rt3352-xtal20.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  2. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  3. @@ -8186,6 +8186,27 @@ static const struct rf_channel rf_vals_5
  4. {196, 83, 0, 12, 1},
  5. };
  6. +/*
  7. + * RF value list for rt3xxx with Xtal20MHz
  8. + * Supports: 2.4 GHz (all) (RF3322)
  9. + */
  10. +static const struct rf_channel rf_vals_xtal20mhz_3x[] = {
  11. + {1, 0xE2, 2, 0x14},
  12. + {2, 0xE3, 2, 0x14},
  13. + {3, 0xE4, 2, 0x14},
  14. + {4, 0xE5, 2, 0x14},
  15. + {5, 0xE6, 2, 0x14},
  16. + {6, 0xE7, 2, 0x14},
  17. + {7, 0xE8, 2, 0x14},
  18. + {8, 0xE9, 2, 0x14},
  19. + {9, 0xEA, 2, 0x14},
  20. + {10, 0xEB, 2, 0x14},
  21. + {11, 0xEC, 2, 0x14},
  22. + {12, 0xED, 2, 0x14},
  23. + {13, 0xEE, 2, 0x14},
  24. + {14, 0xF0, 2, 0x18},
  25. +};
  26. +
  27. static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
  28. {
  29. struct hw_mode_spec *spec = &rt2x00dev->spec;
  30. @@ -8276,7 +8297,10 @@ static int rt2800_probe_hw_mode(struct r
  31. case RF5390:
  32. case RF5392:
  33. spec->num_channels = 14;
  34. - spec->channels = rf_vals_3x;
  35. + if (spec->clk_is_20mhz)
  36. + spec->channels = rf_vals_xtal20mhz_3x;
  37. + else
  38. + spec->channels = rf_vals_3x;
  39. break;
  40. case RF3052:
  41. @@ -8460,6 +8484,19 @@ static int rt2800_probe_rt(struct rt2x00
  42. return 0;
  43. }
  44. +int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
  45. +{
  46. + struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
  47. + struct hw_mode_spec *spec = &rt2x00dev->spec;
  48. +
  49. + if (!pdata)
  50. + return -EINVAL;
  51. +
  52. + spec->clk_is_20mhz = pdata->clk_is_20mhz;
  53. +
  54. + return 0;
  55. +}
  56. +
  57. int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
  58. {
  59. struct rt2800_drv_data *drv_data = rt2x00dev->drv_data;
  60. @@ -8502,6 +8539,15 @@ int rt2800_probe_hw(struct rt2x00_dev *r
  61. rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
  62. /*
  63. + * Probe SoC clock.
  64. + */
  65. + if (rt2x00_is_soc(rt2x00dev)) {
  66. + retval = rt2800_probe_clk(rt2x00dev);
  67. + if (retval)
  68. + return retval;
  69. + }
  70. +
  71. + /*
  72. * Initialize hw specifications.
  73. */
  74. retval = rt2800_probe_hw_mode(rt2x00dev);
  75. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  76. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  77. @@ -401,6 +401,7 @@ static inline struct rt2x00_intf* vif_to
  78. * @channels: Device/chipset specific channel values (See &struct rf_channel).
  79. * @channels_info: Additional information for channels (See &struct channel_info).
  80. * @ht: Driver HT Capabilities (See &ieee80211_sta_ht_cap).
  81. + * @clk_is_20mhz: External crystal of WiSoC is 20MHz instead of 40MHz
  82. */
  83. struct hw_mode_spec {
  84. unsigned int supported_bands;
  85. @@ -417,6 +418,7 @@ struct hw_mode_spec {
  86. const struct channel_info *channels_info;
  87. struct ieee80211_sta_ht_cap ht;
  88. + int clk_is_20mhz;
  89. };
  90. /*
  91. --- a/include/linux/rt2x00_platform.h
  92. +++ b/include/linux/rt2x00_platform.h
  93. @@ -18,6 +18,7 @@ struct rt2x00_platform_data {
  94. int disable_2ghz;
  95. int disable_5ghz;
  96. + int clk_is_20mhz;
  97. };
  98. #endif /* _RT2X00_PLATFORM_H */