rtl8xxxu: add support for rtl8188eu
[openwrt/staging/dedeckeh.git] / package / kernel / mac80211 / patches / 652-0049-rtl8xxxu-Use-a-struct-rtl8xxxu_fileops-in-rtl8xxxu_i.patch
1 From e3c6694ed9367142704930754f3d6bff6c25f7e7 Mon Sep 17 00:00:00 2001
2 From: Jes Sorensen <Jes.Sorensen@redhat.com>
3 Date: Wed, 24 Aug 2016 14:06:04 -0400
4 Subject: [PATCH] rtl8xxxu: Use a struct rtl8xxxu_fileops * in
5 rtl8xxxu_init_device()
6
7 This saves some 217, or about, derefences of priv->fops.
8
9 Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
10 ---
11 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 39 +++++++++++-----------
12 1 file changed, 20 insertions(+), 19 deletions(-)
13
14 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
15 +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
16 @@ -3896,6 +3896,7 @@ static int rtl8xxxu_init_device(struct i
17 {
18 struct rtl8xxxu_priv *priv = hw->priv;
19 struct device *dev = &priv->udev->dev;
20 + struct rtl8xxxu_fileops *fops = priv->fops;
21 bool macpower;
22 int ret;
23 u8 val8;
24 @@ -3914,7 +3915,7 @@ static int rtl8xxxu_init_device(struct i
25 else
26 macpower = true;
27
28 - ret = priv->fops->power_on(priv);
29 + ret = fops->power_on(priv);
30 if (ret < 0) {
31 dev_warn(dev, "%s: Failed power on\n", __func__);
32 goto exit;
33 @@ -3931,7 +3932,7 @@ static int rtl8xxxu_init_device(struct i
34 /*
35 * Set RX page boundary
36 */
37 - rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, priv->fops->trxff_boundary);
38 + rtl8xxxu_write16(priv, REG_TRXFF_BNDY + 2, fops->trxff_boundary);
39
40 ret = rtl8xxxu_download_firmware(priv);
41 dev_dbg(dev, "%s: download_firmware %i\n", __func__, ret);
42 @@ -3942,8 +3943,8 @@ static int rtl8xxxu_init_device(struct i
43 if (ret)
44 goto exit;
45
46 - if (priv->fops->phy_init_antenna_selection)
47 - priv->fops->phy_init_antenna_selection(priv);
48 + if (fops->phy_init_antenna_selection)
49 + fops->phy_init_antenna_selection(priv);
50
51 ret = rtl8xxxu_init_mac(priv);
52
53 @@ -3956,7 +3957,7 @@ static int rtl8xxxu_init_device(struct i
54 if (ret)
55 goto exit;
56
57 - ret = priv->fops->init_phy_rf(priv);
58 + ret = fops->init_phy_rf(priv);
59 if (ret)
60 goto exit;
61
62 @@ -3982,7 +3983,7 @@ static int rtl8xxxu_init_device(struct i
63 /*
64 * Set TX buffer boundary
65 */
66 - val8 = priv->fops->total_page_num + 1;
67 + val8 = fops->total_page_num + 1;
68
69 rtl8xxxu_write8(priv, REG_TXPKTBUF_BCNQ_BDNY, val8);
70 rtl8xxxu_write8(priv, REG_TXPKTBUF_MGQ_BDNY, val8);
71 @@ -3995,14 +3996,14 @@ static int rtl8xxxu_init_device(struct i
72 * The vendor drivers set PBP for all devices, except 8192e.
73 * There is no explanation for this in any of the sources.
74 */
75 - val8 = (priv->fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) |
76 - (priv->fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT);
77 + val8 = (fops->pbp_rx << PBP_PAGE_SIZE_RX_SHIFT) |
78 + (fops->pbp_tx << PBP_PAGE_SIZE_TX_SHIFT);
79 if (priv->rtl_chip != RTL8192E)
80 rtl8xxxu_write8(priv, REG_PBP, val8);
81
82 dev_dbg(dev, "%s: macpower %i\n", __func__, macpower);
83 if (!macpower) {
84 - ret = priv->fops->llt_init(priv);
85 + ret = fops->llt_init(priv);
86 if (ret) {
87 dev_warn(dev, "%s: LLT table init failed\n", __func__);
88 goto exit;
89 @@ -4011,12 +4012,12 @@ static int rtl8xxxu_init_device(struct i
90 /*
91 * Chip specific quirks
92 */
93 - priv->fops->usb_quirks(priv);
94 + fops->usb_quirks(priv);
95
96 /*
97 * Enable TX report and TX report timer for 8723bu/8188eu/...
98 */
99 - if (priv->fops->has_tx_report) {
100 + if (fops->has_tx_report) {
101 val8 = rtl8xxxu_read8(priv, REG_TX_REPORT_CTRL);
102 val8 |= TX_REPORT_CTRL_TIMER_ENABLE;
103 rtl8xxxu_write8(priv, REG_TX_REPORT_CTRL, val8);
104 @@ -4108,7 +4109,7 @@ static int rtl8xxxu_init_device(struct i
105 * Set data auto rate fallback retry count.
106 * Notably the 8188eu doesn't seem to use this
107 */
108 - if (priv->fops->has_darfrc) {
109 + if (fops->has_darfrc) {
110 rtl8xxxu_write32(priv, REG_DARFRC, 0x00000000);
111 rtl8xxxu_write32(priv, REG_DARFRC + 4, 0x10080404);
112 rtl8xxxu_write32(priv, REG_RARFRC, 0x04030201);
113 @@ -4165,8 +4166,8 @@ static int rtl8xxxu_init_device(struct i
114 rtl8xxxu_write8(priv, REG_RSV_CTRL, val8);
115 }
116
117 - if (priv->fops->init_aggregation)
118 - priv->fops->init_aggregation(priv);
119 + if (fops->init_aggregation)
120 + fops->init_aggregation(priv);
121
122 /*
123 * Enable CCK and OFDM block
124 @@ -4183,7 +4184,7 @@ static int rtl8xxxu_init_device(struct i
125 /*
126 * Start out with default power levels for channel 6, 20MHz
127 */
128 - priv->fops->set_tx_power(priv, 1, false);
129 + fops->set_tx_power(priv, 1, false);
130
131 /* Let the 8051 take control of antenna setting */
132 if (priv->rtl_chip != RTL8192E) {
133 @@ -4199,8 +4200,8 @@ static int rtl8xxxu_init_device(struct i
134
135 rtl8xxxu_write16(priv, REG_FAST_EDCA_CTRL, 0);
136
137 - if (priv->fops->init_statistics)
138 - priv->fops->init_statistics(priv);
139 + if (fops->init_statistics)
140 + fops->init_statistics(priv);
141
142 if (priv->rtl_chip == RTL8192E) {
143 /*
144 @@ -4225,12 +4226,12 @@ static int rtl8xxxu_init_device(struct i
145
146 rtl8723a_phy_lc_calibrate(priv);
147
148 - priv->fops->phy_iq_calibrate(priv);
149 + fops->phy_iq_calibrate(priv);
150
151 /*
152 * This should enable thermal meter
153 */
154 - if (priv->fops->gen2_thermal_meter)
155 + if (fops->gen2_thermal_meter)
156 rtl8xxxu_write_rfreg(priv,
157 RF_A, RF6052_REG_T_METER_8723B, 0x37cf8);
158 else