653-0016-rtl8xxxu-Implement-rtl8188eu_init_phy_rf.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. From 0c6fa292a9c6d7f1b870c42ed9166674463206f1 Mon Sep 17 00:00:00 2001
  2. From: Jes Sorensen <Jes.Sorensen@redhat.com>
  3. Date: Tue, 19 Jul 2016 17:12:42 -0400
  4. Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_init_phy_rf()
  5. Include the table rtl8188eu_radioa_init_table derived from vendor
  6. driver. The vendor table relies on a hack setting RF6052_REG_RCK1 +
  7. RF6052_REG_RCK2 with delays. This workaround is open coded here
  8. instead of modifying the table parsing code.
  9. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
  10. ---
  11. .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 65 ++++++++++++++++++++++
  12. 1 file changed, 65 insertions(+)
  13. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  14. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  15. @@ -235,6 +235,54 @@ static struct rtl8xxxu_reg32val rtl8188e
  16. {0xffff, 0xffffffff}
  17. };
  18. +static struct rtl8xxxu_rfregval rtl8188eu_radioa_init_table[] = {
  19. + {0x00, 0x00030000}, {0x08, 0x00084000},
  20. + {0x18, 0x00000407}, {0x19, 0x00000012},
  21. + {0x1e, 0x00080009}, {0x1f, 0x00000880},
  22. + {0x2f, 0x0001a060}, {0x3f, 0x00000000},
  23. + {0x42, 0x000060c0}, {0x57, 0x000d0000},
  24. + {0x58, 0x000be180}, {0x67, 0x00001552},
  25. + {0x83, 0x00000000}, {0xb0, 0x000ff8fc},
  26. + {0xb1, 0x00054400}, {0xb2, 0x000ccc19},
  27. + {0xb4, 0x00043003}, {0xb6, 0x0004953e},
  28. + {0xb7, 0x0001c718}, {0xb8, 0x000060ff},
  29. + {0xb9, 0x00080001}, {0xba, 0x00040000},
  30. + {0xbb, 0x00000400}, {0xbf, 0x000c0000},
  31. + {0xc2, 0x00002400}, {0xc3, 0x00000009},
  32. + {0xc4, 0x00040c91}, {0xc5, 0x00099999},
  33. + {0xc6, 0x000000a3}, {0xc7, 0x00088820},
  34. + {0xc8, 0x00076c06}, {0xc9, 0x00000000},
  35. + {0xca, 0x00080000}, {0xdf, 0x00000180},
  36. + {0xef, 0x000001a0}, {0x51, 0x0006b27d},
  37. + {0x52, 0x0007e49d}, /* Set to 0x0007e4dd for SDIO */
  38. + {0x53, 0x00000073}, {0x56, 0x00051ff3},
  39. + {0x35, 0x00000086}, {0x35, 0x00000186},
  40. + {0x35, 0x00000286}, {0x36, 0x00001c25},
  41. + {0x36, 0x00009c25}, {0x36, 0x00011c25},
  42. + {0x36, 0x00019c25}, {0xb6, 0x00048538},
  43. + {0x18, 0x00000c07}, {0x5a, 0x0004bd00},
  44. + {0x19, 0x000739d0}, {0x34, 0x0000adf3},
  45. + {0x34, 0x00009df0}, {0x34, 0x00008ded},
  46. + {0x34, 0x00007dea}, {0x34, 0x00006de7},
  47. + {0x34, 0x000054ee}, {0x34, 0x000044eb},
  48. + {0x34, 0x000034e8}, {0x34, 0x0000246b},
  49. + {0x34, 0x00001468}, {0x34, 0x0000006d},
  50. + {0x00, 0x00030159}, {0x84, 0x00068200},
  51. + {0x86, 0x000000ce}, {0x87, 0x00048a00},
  52. + {0x8e, 0x00065540}, {0x8f, 0x00088000},
  53. + {0xef, 0x000020a0}, {0x3b, 0x000f02b0},
  54. + {0x3b, 0x000ef7b0}, {0x3b, 0x000d4fb0},
  55. + {0x3b, 0x000cf060}, {0x3b, 0x000b0090},
  56. + {0x3b, 0x000a0080}, {0x3b, 0x00090080},
  57. + {0x3b, 0x0008f780}, {0x3b, 0x000722b0},
  58. + {0x3b, 0x0006f7b0}, {0x3b, 0x00054fb0},
  59. + {0x3b, 0x0004f060}, {0x3b, 0x00030090},
  60. + {0x3b, 0x00020080}, {0x3b, 0x00010080},
  61. + {0x3b, 0x0000f780}, {0xef, 0x000000a0},
  62. + {0x00, 0x00010159}, {0x18, 0x0000f407},
  63. + {0xff, 0xffffffff}
  64. +};
  65. +
  66. static int rtl8188eu_parse_efuse(struct rtl8xxxu_priv *priv)
  67. {
  68. struct rtl8188eu_efuse *efuse = &priv->efuse_wifi.efuse8188eu;
  69. @@ -320,6 +368,22 @@ static void rtl8188eu_init_phy_bb(struct
  70. rtl8xxxu_write32(priv, REG_AFE_XTAL_CTRL, val32);
  71. }
  72. +static int rtl8188eu_init_phy_rf(struct rtl8xxxu_priv *priv)
  73. +{
  74. + int ret;
  75. +
  76. + ret = rtl8xxxu_init_phy_rf(priv, rtl8188eu_radioa_init_table, RF_A);
  77. +
  78. + msleep(100);
  79. + rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80003);
  80. + msleep(100);
  81. + rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK1, 0x00001);
  82. + rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_RCK2, 0x80000);
  83. + rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0x33e60);
  84. +
  85. + return ret;
  86. +}
  87. +
  88. static void rtl8188e_disabled_to_emu(struct rtl8xxxu_priv *priv)
  89. {
  90. u16 val16;
  91. @@ -454,6 +518,7 @@ struct rtl8xxxu_fileops rtl8188eu_fops =
  92. .power_off = rtl8xxxu_power_off,
  93. .reset_8051 = rtl8xxxu_reset_8051,
  94. .init_phy_bb = rtl8188eu_init_phy_bb,
  95. + .init_phy_rf = rtl8188eu_init_phy_rf,
  96. .usb_quirks = rtl8188e_usb_quirks,
  97. .writeN_block_size = 128,
  98. /*