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