616-rt2x00-support-rt5350.patch 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. --- a/drivers/net/wireless/ralink/rt2x00/rt2800.h
  2. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800.h
  3. @@ -74,6 +74,7 @@
  4. #define RF3070 0x3070
  5. #define RF3290 0x3290
  6. #define RF3853 0x3853
  7. +#define RF5350 0x5350
  8. #define RF5360 0x5360
  9. #define RF5362 0x5362
  10. #define RF5370 0x5370
  11. --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  12. +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
  13. @@ -3015,6 +3015,13 @@ static void rt2800_config_channel_rf53xx
  14. rt2800_rfcsr_write(rt2x00dev, 59,
  15. r59_non_bt[idx]);
  16. + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  17. + static const char r59_non_bt[] = {0x0b, 0x0b,
  18. + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a,
  19. + 0x0a, 0x09, 0x08, 0x07, 0x07, 0x06};
  20. +
  21. + rt2800_rfcsr_write(rt2x00dev, 59,
  22. + r59_non_bt[idx]);
  23. }
  24. }
  25. }
  26. @@ -3493,6 +3500,7 @@ static void rt2800_config_channel(struct
  27. rt2800_config_channel_rf3853(rt2x00dev, conf, rf, info);
  28. break;
  29. case RF3070:
  30. + case RF5350:
  31. case RF5360:
  32. case RF5362:
  33. case RF5370:
  34. @@ -3511,6 +3519,7 @@ static void rt2800_config_channel(struct
  35. if (rt2x00_rf(rt2x00dev, RF3070) ||
  36. rt2x00_rf(rt2x00dev, RF3290) ||
  37. rt2x00_rf(rt2x00dev, RF3322) ||
  38. + rt2x00_rf(rt2x00dev, RF5350) ||
  39. rt2x00_rf(rt2x00dev, RF5360) ||
  40. rt2x00_rf(rt2x00dev, RF5362) ||
  41. rt2x00_rf(rt2x00dev, RF5370) ||
  42. @@ -3789,7 +3798,8 @@ static void rt2800_config_channel(struct
  43. /*
  44. * Clear update flag
  45. */
  46. - if (rt2x00_rt(rt2x00dev, RT3352)) {
  47. + if (rt2x00_rt(rt2x00dev, RT3352) ||
  48. + rt2x00_rt(rt2x00dev, RT5350)) {
  49. rt2800_bbp_read(rt2x00dev, 49, &bbp);
  50. rt2x00_set_field8(&bbp, BBP49_UPDATE_FLAG, 0);
  51. rt2800_bbp_write(rt2x00dev, 49, bbp);
  52. @@ -4675,6 +4685,7 @@ void rt2800_vco_calibration(struct rt2x0
  53. case RF3070:
  54. case RF3290:
  55. case RF3853:
  56. + case RF5350:
  57. case RF5360:
  58. case RF5362:
  59. case RF5370:
  60. @@ -5088,6 +5099,8 @@ static int rt2800_init_registers(struct
  61. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  62. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  63. rt2800_register_write(rt2x00dev, TX_SW_CFG2, 0x00000000);
  64. + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  65. + rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000404);
  66. } else {
  67. rt2800_register_write(rt2x00dev, TX_SW_CFG0, 0x00000000);
  68. rt2800_register_write(rt2x00dev, TX_SW_CFG1, 0x00080606);
  69. @@ -5743,9 +5756,13 @@ static void rt2800_init_bbp_3352(struct
  70. rt2800_bbp_write(rt2x00dev, 82, 0x62);
  71. - rt2800_bbp_write(rt2x00dev, 83, 0x6a);
  72. -
  73. - rt2800_bbp_write(rt2x00dev, 84, 0x99);
  74. + if (rt2x00_rt(rt2x00dev, RT5350)) {
  75. + rt2800_bbp_write(rt2x00dev, 83, 0x7a);
  76. + rt2800_bbp_write(rt2x00dev, 84, 0x9a);
  77. + } else {
  78. + rt2800_bbp_write(rt2x00dev, 83, 0x6a);
  79. + rt2800_bbp_write(rt2x00dev, 84, 0x99);
  80. + }
  81. rt2800_bbp_write(rt2x00dev, 86, 0x38);
  82. @@ -5759,9 +5776,13 @@ static void rt2800_init_bbp_3352(struct
  83. rt2800_bbp_write(rt2x00dev, 104, 0x92);
  84. - rt2800_bbp_write(rt2x00dev, 105, 0x34);
  85. -
  86. - rt2800_bbp_write(rt2x00dev, 106, 0x05);
  87. + if (rt2x00_rt(rt2x00dev, RT5350)) {
  88. + rt2800_bbp_write(rt2x00dev, 105, 0x3c);
  89. + rt2800_bbp_write(rt2x00dev, 106, 0x03);
  90. + } else {
  91. + rt2800_bbp_write(rt2x00dev, 105, 0x34);
  92. + rt2800_bbp_write(rt2x00dev, 106, 0x05);
  93. + }
  94. rt2800_bbp_write(rt2x00dev, 120, 0x50);
  95. @@ -5786,6 +5807,13 @@ static void rt2800_init_bbp_3352(struct
  96. rt2800_bbp_write(rt2x00dev, 143, 0xa2);
  97. rt2800_bbp_write(rt2x00dev, 148, 0xc8);
  98. +
  99. + if (rt2x00_rt(rt2x00dev, RT5350)) {
  100. + rt2800_bbp_write(rt2x00dev, 150, 0x40); /* Antenna Software OFDM */
  101. + rt2800_bbp_write(rt2x00dev, 151, 0x30); /* Antenna Software CCK */
  102. + rt2800_bbp_write(rt2x00dev, 152, 0xa3);
  103. + rt2800_bbp_write(rt2x00dev, 154, 0); /* Clear previously selected antenna */
  104. + }
  105. }
  106. static void rt2800_init_bbp_3390(struct rt2x00_dev *rt2x00dev)
  107. @@ -6127,6 +6155,7 @@ static void rt2800_init_bbp(struct rt2x0
  108. rt2800_init_bbp_3290(rt2x00dev);
  109. break;
  110. case RT3352:
  111. + case RT5350:
  112. rt2800_init_bbp_3352(rt2x00dev);
  113. break;
  114. case RT3390:
  115. @@ -7078,6 +7107,76 @@ static void rt2800_init_rfcsr_3883(struc
  116. rt2800_rfcsr_write(rt2x00dev, 20, rfcsr);
  117. }
  118. +static void rt2800_init_rfcsr_5350(struct rt2x00_dev *rt2x00dev)
  119. +{
  120. + rt2800_rfcsr_write(rt2x00dev, 0, 0xf0);
  121. + rt2800_rfcsr_write(rt2x00dev, 1, 0x23);
  122. + rt2800_rfcsr_write(rt2x00dev, 2, 0x50);
  123. + rt2800_rfcsr_write(rt2x00dev, 3, 0x08);
  124. + rt2800_rfcsr_write(rt2x00dev, 4, 0x49);
  125. + rt2800_rfcsr_write(rt2x00dev, 5, 0x10);
  126. + rt2800_rfcsr_write(rt2x00dev, 6, 0xe0);
  127. + rt2800_rfcsr_write(rt2x00dev, 7, 0x00);
  128. + rt2800_rfcsr_write(rt2x00dev, 8, 0xf1);
  129. + rt2800_rfcsr_write(rt2x00dev, 9, 0x02);
  130. + rt2800_rfcsr_write(rt2x00dev, 10, 0x53);
  131. + rt2800_rfcsr_write(rt2x00dev, 11, 0x4a);
  132. + rt2800_rfcsr_write(rt2x00dev, 12, 0x46);
  133. + if(rt2x00dev->spec.clk_is_20mhz)
  134. + rt2800_rfcsr_write(rt2x00dev, 13, 0x1f);
  135. + else
  136. + rt2800_rfcsr_write(rt2x00dev, 13, 0x9f);
  137. + rt2800_rfcsr_write(rt2x00dev, 14, 0x00);
  138. + rt2800_rfcsr_write(rt2x00dev, 15, 0x00);
  139. + rt2800_rfcsr_write(rt2x00dev, 16, 0xc0);
  140. + rt2800_rfcsr_write(rt2x00dev, 18, 0x03);
  141. + rt2800_rfcsr_write(rt2x00dev, 19, 0x00);
  142. + rt2800_rfcsr_write(rt2x00dev, 20, 0x00);
  143. + rt2800_rfcsr_write(rt2x00dev, 21, 0x00);
  144. + rt2800_rfcsr_write(rt2x00dev, 22, 0x20);
  145. + rt2800_rfcsr_write(rt2x00dev, 23, 0x00);
  146. + rt2800_rfcsr_write(rt2x00dev, 24, 0x00);
  147. + rt2800_rfcsr_write(rt2x00dev, 25, 0x80);
  148. + rt2800_rfcsr_write(rt2x00dev, 26, 0x00);
  149. + rt2800_rfcsr_write(rt2x00dev, 27, 0x03);
  150. + rt2800_rfcsr_write(rt2x00dev, 28, 0x00);
  151. + rt2800_rfcsr_write(rt2x00dev, 29, 0xd0);
  152. + rt2800_rfcsr_write(rt2x00dev, 30, 0x10);
  153. + rt2800_rfcsr_write(rt2x00dev, 31, 0x80);
  154. + rt2800_rfcsr_write(rt2x00dev, 32, 0x80);
  155. + rt2800_rfcsr_write(rt2x00dev, 33, 0x00);
  156. + rt2800_rfcsr_write(rt2x00dev, 34, 0x07);
  157. + rt2800_rfcsr_write(rt2x00dev, 35, 0x12);
  158. + rt2800_rfcsr_write(rt2x00dev, 36, 0x00);
  159. + rt2800_rfcsr_write(rt2x00dev, 37, 0x08);
  160. + rt2800_rfcsr_write(rt2x00dev, 38, 0x85);
  161. + rt2800_rfcsr_write(rt2x00dev, 39, 0x1b);
  162. + rt2800_rfcsr_write(rt2x00dev, 40, 0x0b);
  163. + rt2800_rfcsr_write(rt2x00dev, 41, 0xbb);
  164. + rt2800_rfcsr_write(rt2x00dev, 42, 0xd5);
  165. + rt2800_rfcsr_write(rt2x00dev, 43, 0x9b);
  166. + rt2800_rfcsr_write(rt2x00dev, 44, 0x0c);
  167. + rt2800_rfcsr_write(rt2x00dev, 45, 0xa6);
  168. + rt2800_rfcsr_write(rt2x00dev, 46, 0x73);
  169. + rt2800_rfcsr_write(rt2x00dev, 47, 0x00);
  170. + rt2800_rfcsr_write(rt2x00dev, 48, 0x10);
  171. + rt2800_rfcsr_write(rt2x00dev, 49, 0x80);
  172. + rt2800_rfcsr_write(rt2x00dev, 50, 0x00);
  173. + rt2800_rfcsr_write(rt2x00dev, 51, 0x00);
  174. + rt2800_rfcsr_write(rt2x00dev, 52, 0x38);
  175. + rt2800_rfcsr_write(rt2x00dev, 53, 0x00);
  176. + rt2800_rfcsr_write(rt2x00dev, 54, 0x38);
  177. + rt2800_rfcsr_write(rt2x00dev, 55, 0x43);
  178. + rt2800_rfcsr_write(rt2x00dev, 56, 0x82);
  179. + rt2800_rfcsr_write(rt2x00dev, 57, 0x00);
  180. + rt2800_rfcsr_write(rt2x00dev, 58, 0x39);
  181. + rt2800_rfcsr_write(rt2x00dev, 59, 0x0b);
  182. + rt2800_rfcsr_write(rt2x00dev, 60, 0x45);
  183. + rt2800_rfcsr_write(rt2x00dev, 61, 0xd1);
  184. + rt2800_rfcsr_write(rt2x00dev, 62, 0x00);
  185. + rt2800_rfcsr_write(rt2x00dev, 63, 0x00);
  186. +}
  187. +
  188. static void rt2800_init_rfcsr_5390(struct rt2x00_dev *rt2x00dev)
  189. {
  190. rt2800_rf_init_calibration(rt2x00dev, 2);
  191. @@ -7318,6 +7417,9 @@ static void rt2800_init_rfcsr(struct rt2
  192. case RT3593:
  193. rt2800_init_rfcsr_3593(rt2x00dev);
  194. break;
  195. + case RT5350:
  196. + rt2800_init_rfcsr_5350(rt2x00dev);
  197. + break;
  198. case RT5390:
  199. rt2800_init_rfcsr_5390(rt2x00dev);
  200. break;
  201. @@ -7577,6 +7679,12 @@ static int rt2800_validate_eeprom(struct
  202. rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF2820);
  203. rt2800_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  204. rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  205. + } else if (rt2x00_rt(rt2x00dev, RT5350)) {
  206. + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RXPATH, 1);
  207. + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_TXPATH, 1);
  208. + rt2x00_set_field16(&word, EEPROM_NIC_CONF0_RF_TYPE, RF3320);
  209. + rt2x00_eeprom_write(rt2x00dev, EEPROM_NIC_CONF0, word);
  210. + rt2x00_eeprom_dbg(rt2x00dev, "Antenna: 0x%04x\n", word);
  211. } else if (rt2x00_rt(rt2x00dev, RT2860) ||
  212. rt2x00_rt(rt2x00dev, RT2872)) {
  213. /*
  214. @@ -7715,6 +7823,8 @@ static int rt2800_init_eeprom(struct rt2
  215. rt2800_eeprom_read(rt2x00dev, EEPROM_CHIP_ID, &rf);
  216. else if (rt2x00_rt(rt2x00dev, RT3883))
  217. rf = RF3853;
  218. + else if (rt2x00_rt(rt2x00dev, RT5350))
  219. + rf = RF5350;
  220. else
  221. rf = rt2x00_get_field16(eeprom, EEPROM_NIC_CONF0_RF_TYPE);
  222. @@ -7734,6 +7844,7 @@ static int rt2800_init_eeprom(struct rt2
  223. case RF3320:
  224. case RF3322:
  225. case RF3853:
  226. + case RF5350:
  227. case RF5360:
  228. case RF5362:
  229. case RF5370:
  230. @@ -8287,6 +8398,7 @@ static int rt2800_probe_hw_mode(struct r
  231. case RF3290:
  232. case RF3320:
  233. case RF3322:
  234. + case RF5350:
  235. case RF5360:
  236. case RF5362:
  237. case RF5370:
  238. @@ -8426,6 +8538,7 @@ static int rt2800_probe_hw_mode(struct r
  239. case RF3070:
  240. case RF3290:
  241. case RF3853:
  242. + case RF5350:
  243. case RF5360:
  244. case RF5362:
  245. case RF5370:
  246. @@ -8466,6 +8579,7 @@ static int rt2800_probe_rt(struct rt2x00
  247. case RT3572:
  248. case RT3593:
  249. case RT3883:
  250. + case RT5350:
  251. case RT5390:
  252. case RT5392:
  253. case RT5592:
  254. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  255. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
  256. @@ -169,6 +169,7 @@ struct rt2x00_chip {
  257. #define RT3572 0x3572
  258. #define RT3593 0x3593
  259. #define RT3883 0x3883 /* WSOC */
  260. +#define RT5350 0x5350 /* WSOC 2.4GHz */
  261. #define RT5390 0x5390 /* 2.4GHz */
  262. #define RT5392 0x5392 /* 2.4GHz */
  263. #define RT5592 0x5592