Magellan Linux

Contents of /trunk/kernel-alx/patches-3.8/0107-3.8.8-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2165 - (show annotations) (download)
Mon May 6 09:37:48 2013 UTC (10 years, 11 months ago) by niro
File size: 45094 byte(s)
-fixed patch
1 diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
2 index 93c3afb..3694e94 100644
3 --- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
4 +++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
5 @@ -96,11 +96,11 @@
6 marvell,function = "gpio";
7 };
8 pmx_led_rebuild_brt_ctrl_1: pmx-led-rebuild-brt-ctrl-1 {
9 - marvell,pins = "mpp44";
10 + marvell,pins = "mpp46";
11 marvell,function = "gpio";
12 };
13 pmx_led_rebuild_brt_ctrl_2: pmx-led-rebuild-brt-ctrl-2 {
14 - marvell,pins = "mpp45";
15 + marvell,pins = "mpp47";
16 marvell,function = "gpio";
17 };
18
19 @@ -157,14 +157,14 @@
20 gpios = <&gpio0 16 0>;
21 linux,default-trigger = "default-on";
22 };
23 - health_led1 {
24 + rebuild_led {
25 + label = "status:white:rebuild_led";
26 + gpios = <&gpio1 4 0>;
27 + };
28 + health_led {
29 label = "status:red:health_led";
30 gpios = <&gpio1 5 0>;
31 };
32 - health_led2 {
33 - label = "status:white:health_led";
34 - gpios = <&gpio1 4 0>;
35 - };
36 backup_led {
37 label = "status:blue:backup_led";
38 gpios = <&gpio0 15 0>;
39 diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
40 index f0727e8..0edce4b 100644
41 --- a/arch/arm/mach-imx/clk-imx35.c
42 +++ b/arch/arm/mach-imx/clk-imx35.c
43 @@ -257,6 +257,7 @@ int __init mx35_clocks_init()
44 clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0");
45 clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0");
46 clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0");
47 + clk_register_clkdev(clk[admux_gate], "audmux", NULL);
48
49 clk_prepare_enable(clk[spba_gate]);
50 clk_prepare_enable(clk[gpio1_gate]);
51 diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
52 index 5edd174..7361e47 100644
53 --- a/arch/x86/include/asm/paravirt.h
54 +++ b/arch/x86/include/asm/paravirt.h
55 @@ -703,7 +703,10 @@ static inline void arch_leave_lazy_mmu_mode(void)
56 PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave);
57 }
58
59 -void arch_flush_lazy_mmu_mode(void);
60 +static inline void arch_flush_lazy_mmu_mode(void)
61 +{
62 + PVOP_VCALL0(pv_mmu_ops.lazy_mode.flush);
63 +}
64
65 static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
66 phys_addr_t phys, pgprot_t flags)
67 diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
68 index 142236e..b3b0ec1 100644
69 --- a/arch/x86/include/asm/paravirt_types.h
70 +++ b/arch/x86/include/asm/paravirt_types.h
71 @@ -91,6 +91,7 @@ struct pv_lazy_ops {
72 /* Set deferred update mode, used for batching operations. */
73 void (*enter)(void);
74 void (*leave)(void);
75 + void (*flush)(void);
76 };
77
78 struct pv_time_ops {
79 @@ -679,6 +680,7 @@ void paravirt_end_context_switch(struct task_struct *next);
80
81 void paravirt_enter_lazy_mmu(void);
82 void paravirt_leave_lazy_mmu(void);
83 +void paravirt_flush_lazy_mmu(void);
84
85 void _paravirt_nop(void);
86 u32 _paravirt_ident_32(u32);
87 diff --git a/arch/x86/include/asm/tlb.h b/arch/x86/include/asm/tlb.h
88 index 4fef207..c779730 100644
89 --- a/arch/x86/include/asm/tlb.h
90 +++ b/arch/x86/include/asm/tlb.h
91 @@ -7,7 +7,7 @@
92
93 #define tlb_flush(tlb) \
94 { \
95 - if (tlb->fullmm == 0) \
96 + if (!tlb->fullmm && !tlb->need_flush_all) \
97 flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end, 0UL); \
98 else \
99 flush_tlb_mm_range(tlb->mm, 0UL, TLB_FLUSH_ALL, 0UL); \
100 diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
101 index 17fff18..8bfb335 100644
102 --- a/arch/x86/kernel/paravirt.c
103 +++ b/arch/x86/kernel/paravirt.c
104 @@ -263,6 +263,18 @@ void paravirt_leave_lazy_mmu(void)
105 leave_lazy(PARAVIRT_LAZY_MMU);
106 }
107
108 +void paravirt_flush_lazy_mmu(void)
109 +{
110 + preempt_disable();
111 +
112 + if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
113 + arch_leave_lazy_mmu_mode();
114 + arch_enter_lazy_mmu_mode();
115 + }
116 +
117 + preempt_enable();
118 +}
119 +
120 void paravirt_start_context_switch(struct task_struct *prev)
121 {
122 BUG_ON(preemptible());
123 @@ -292,18 +304,6 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
124 return this_cpu_read(paravirt_lazy_mode);
125 }
126
127 -void arch_flush_lazy_mmu_mode(void)
128 -{
129 - preempt_disable();
130 -
131 - if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
132 - arch_leave_lazy_mmu_mode();
133 - arch_enter_lazy_mmu_mode();
134 - }
135 -
136 - preempt_enable();
137 -}
138 -
139 struct pv_info pv_info = {
140 .name = "bare hardware",
141 .paravirt_enabled = 0,
142 @@ -475,6 +475,7 @@ struct pv_mmu_ops pv_mmu_ops = {
143 .lazy_mode = {
144 .enter = paravirt_nop,
145 .leave = paravirt_nop,
146 + .flush = paravirt_nop,
147 },
148
149 .set_fixmap = native_set_fixmap,
150 diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
151 index df4176c..20a4fd4 100644
152 --- a/arch/x86/lguest/boot.c
153 +++ b/arch/x86/lguest/boot.c
154 @@ -1333,6 +1333,7 @@ __init void lguest_init(void)
155 pv_mmu_ops.read_cr3 = lguest_read_cr3;
156 pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu;
157 pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mmu_mode;
158 + pv_mmu_ops.lazy_mode.flush = paravirt_flush_lazy_mmu;
159 pv_mmu_ops.pte_update = lguest_pte_update;
160 pv_mmu_ops.pte_update_defer = lguest_pte_update;
161
162 diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
163 index fb674fd..4f7d793 100644
164 --- a/arch/x86/mm/fault.c
165 +++ b/arch/x86/mm/fault.c
166 @@ -378,10 +378,12 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
167 if (pgd_none(*pgd_ref))
168 return -1;
169
170 - if (pgd_none(*pgd))
171 + if (pgd_none(*pgd)) {
172 set_pgd(pgd, *pgd_ref);
173 - else
174 + arch_flush_lazy_mmu_mode();
175 + } else {
176 BUG_ON(pgd_page_vaddr(*pgd) != pgd_page_vaddr(*pgd_ref));
177 + }
178
179 /*
180 * Below here mismatches are bugs because these lower tables
181 diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
182 index e27fbf8..395b3b4 100644
183 --- a/arch/x86/mm/pgtable.c
184 +++ b/arch/x86/mm/pgtable.c
185 @@ -58,6 +58,13 @@ void ___pte_free_tlb(struct mmu_gather *tlb, struct page *pte)
186 void ___pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd)
187 {
188 paravirt_release_pmd(__pa(pmd) >> PAGE_SHIFT);
189 + /*
190 + * NOTE! For PAE, any changes to the top page-directory-pointer-table
191 + * entries need a full cr3 reload to flush.
192 + */
193 +#ifdef CONFIG_X86_PAE
194 + tlb->need_flush_all = 1;
195 +#endif
196 tlb_remove_page(tlb, virt_to_page(pmd));
197 }
198
199 diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
200 index 01de35c..cab96b6 100644
201 --- a/arch/x86/xen/mmu.c
202 +++ b/arch/x86/xen/mmu.c
203 @@ -2190,6 +2190,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
204 .lazy_mode = {
205 .enter = paravirt_enter_lazy_mmu,
206 .leave = xen_leave_lazy_mmu,
207 + .flush = paravirt_flush_lazy_mmu,
208 },
209
210 .set_fixmap = xen_set_fixmap,
211 diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
212 index 5a31264..8607724 100644
213 --- a/drivers/dma/omap-dma.c
214 +++ b/drivers/dma/omap-dma.c
215 @@ -276,12 +276,20 @@ static void omap_dma_issue_pending(struct dma_chan *chan)
216
217 spin_lock_irqsave(&c->vc.lock, flags);
218 if (vchan_issue_pending(&c->vc) && !c->desc) {
219 - struct omap_dmadev *d = to_omap_dma_dev(chan->device);
220 - spin_lock(&d->lock);
221 - if (list_empty(&c->node))
222 - list_add_tail(&c->node, &d->pending);
223 - spin_unlock(&d->lock);
224 - tasklet_schedule(&d->task);
225 + /*
226 + * c->cyclic is used only by audio and in this case the DMA need
227 + * to be started without delay.
228 + */
229 + if (!c->cyclic) {
230 + struct omap_dmadev *d = to_omap_dma_dev(chan->device);
231 + spin_lock(&d->lock);
232 + if (list_empty(&c->node))
233 + list_add_tail(&c->node, &d->pending);
234 + spin_unlock(&d->lock);
235 + tasklet_schedule(&d->task);
236 + } else {
237 + omap_dma_start_desc(c);
238 + }
239 }
240 spin_unlock_irqrestore(&c->vc.lock, flags);
241 }
242 diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
243 index d542a14..ea537fa 100644
244 --- a/drivers/gpio/gpiolib-of.c
245 +++ b/drivers/gpio/gpiolib-of.c
246 @@ -228,7 +228,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
247 if (!np)
248 return;
249
250 - do {
251 + for (;; index++) {
252 ret = of_parse_phandle_with_args(np, "gpio-ranges",
253 "#gpio-range-cells", index, &pinspec);
254 if (ret)
255 @@ -257,8 +257,7 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
256
257 if (ret)
258 break;
259 -
260 - } while (index++);
261 + }
262 }
263
264 #else
265 diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
266 index fe5cdbc..b44d548 100644
267 --- a/drivers/gpu/drm/udl/udl_connector.c
268 +++ b/drivers/gpu/drm/udl/udl_connector.c
269 @@ -61,6 +61,10 @@ static int udl_get_modes(struct drm_connector *connector)
270 int ret;
271
272 edid = (struct edid *)udl_get_edid(udl);
273 + if (!edid) {
274 + drm_mode_connector_update_edid_property(connector, NULL);
275 + return 0;
276 + }
277
278 /*
279 * We only read the main block, but if the monitor reports extension
280 diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
281 index 21a8242..18d3764 100644
282 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
283 +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
284 @@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
285 gain0_15 = ((biq1 & 0xf) << 12) |
286 ((tia & 0xf) << 8) |
287 ((lna2 & 0x3) << 6) |
288 - ((lna2 & 0x3) << 4) |
289 - ((lna1 & 0x3) << 2) |
290 - ((lna1 & 0x3) << 0);
291 + ((lna2 &
292 + 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0);
293
294 mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0);
295 mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0);
296 @@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(struct brcms_phy *pi,
297 }
298
299 mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0);
300 - mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11);
301 - mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3);
302
303 }
304
305 @@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_power(struct brcms_phy *pi, u16 nsamples)
306 return (iq_est.i_pwr + iq_est.q_pwr) / nsamples;
307 }
308
309 -static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain,
310 - u16 tia_gain, u16 lna2_gain)
311 -{
312 - u32 i_thresh_l, q_thresh_l;
313 - u32 i_thresh_h, q_thresh_h;
314 - struct lcnphy_iq_est iq_est_h, iq_est_l;
315 -
316 - wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain,
317 - lna2_gain, 0);
318 -
319 - wlc_lcnphy_rx_gain_override_enable(pi, true);
320 - wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0);
321 - udelay(500);
322 - write_radio_reg(pi, RADIO_2064_REG112, 0);
323 - if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l))
324 - return false;
325 -
326 - wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0);
327 - udelay(500);
328 - write_radio_reg(pi, RADIO_2064_REG112, 0);
329 - if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h))
330 - return false;
331 -
332 - i_thresh_l = (iq_est_l.i_pwr << 1);
333 - i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr;
334 -
335 - q_thresh_l = (iq_est_l.q_pwr << 1);
336 - q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr;
337 - if ((iq_est_h.i_pwr > i_thresh_l) &&
338 - (iq_est_h.i_pwr < i_thresh_h) &&
339 - (iq_est_h.q_pwr > q_thresh_l) &&
340 - (iq_est_h.q_pwr < q_thresh_h))
341 - return true;
342 -
343 - return false;
344 -}
345 -
346 static bool
347 wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
348 const struct lcnphy_rx_iqcomp *iqcomp,
349 @@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
350 RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old,
351 rfoverride3_old, rfoverride3val_old, rfoverride4_old,
352 rfoverride4val_old, afectrlovr_old, afectrlovrval_old;
353 - int tia_gain, lna2_gain, biq1_gain;
354 - bool set_gain;
355 + int tia_gain;
356 + u32 received_power, rx_pwr_threshold;
357 u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl;
358 u16 values_to_save[11];
359 s16 *ptr;
360 @@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi,
361 goto cal_done;
362 }
363
364 - WARN_ON(module != 1);
365 - tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
366 - wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
367 -
368 - for (i = 0; i < 11; i++)
369 - values_to_save[i] =
370 - read_radio_reg(pi, rxiq_cal_rf_reg[i]);
371 - Core1TxControl_old = read_phy_reg(pi, 0x631);
372 -
373 - or_phy_reg(pi, 0x631, 0x0015);
374 -
375 - RFOverride0_old = read_phy_reg(pi, 0x44c);
376 - RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
377 - rfoverride2_old = read_phy_reg(pi, 0x4b0);
378 - rfoverride2val_old = read_phy_reg(pi, 0x4b1);
379 - rfoverride3_old = read_phy_reg(pi, 0x4f9);
380 - rfoverride3val_old = read_phy_reg(pi, 0x4fa);
381 - rfoverride4_old = read_phy_reg(pi, 0x938);
382 - rfoverride4val_old = read_phy_reg(pi, 0x939);
383 - afectrlovr_old = read_phy_reg(pi, 0x43b);
384 - afectrlovrval_old = read_phy_reg(pi, 0x43c);
385 - old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
386 - old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
387 -
388 - tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
389 - if (tx_gain_override_old) {
390 - wlc_lcnphy_get_tx_gain(pi, &old_gains);
391 - tx_gain_index_old = pi_lcn->lcnphy_current_index;
392 - }
393 -
394 - wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
395 + if (module == 1) {
396
397 - mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0);
398 - mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0);
399 + tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi);
400 + wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF);
401
402 - mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1);
403 - mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1);
404 + for (i = 0; i < 11; i++)
405 + values_to_save[i] =
406 + read_radio_reg(pi, rxiq_cal_rf_reg[i]);
407 + Core1TxControl_old = read_phy_reg(pi, 0x631);
408 +
409 + or_phy_reg(pi, 0x631, 0x0015);
410 +
411 + RFOverride0_old = read_phy_reg(pi, 0x44c);
412 + RFOverrideVal0_old = read_phy_reg(pi, 0x44d);
413 + rfoverride2_old = read_phy_reg(pi, 0x4b0);
414 + rfoverride2val_old = read_phy_reg(pi, 0x4b1);
415 + rfoverride3_old = read_phy_reg(pi, 0x4f9);
416 + rfoverride3val_old = read_phy_reg(pi, 0x4fa);
417 + rfoverride4_old = read_phy_reg(pi, 0x938);
418 + rfoverride4val_old = read_phy_reg(pi, 0x939);
419 + afectrlovr_old = read_phy_reg(pi, 0x43b);
420 + afectrlovrval_old = read_phy_reg(pi, 0x43c);
421 + old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da);
422 + old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db);
423 +
424 + tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi);
425 + if (tx_gain_override_old) {
426 + wlc_lcnphy_get_tx_gain(pi, &old_gains);
427 + tx_gain_index_old = pi_lcn->lcnphy_current_index;
428 + }
429
430 - write_radio_reg(pi, RADIO_2064_REG116, 0x06);
431 - write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
432 - write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
433 - write_radio_reg(pi, RADIO_2064_REG098, 0x03);
434 - write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
435 - mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
436 - write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
437 - write_radio_reg(pi, RADIO_2064_REG114, 0x01);
438 - write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
439 - write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
440 -
441 - mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
442 - mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
443 - mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
444 - mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
445 - mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
446 - mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
447 - mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
448 - mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
449 - mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
450 - mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
451 + wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx);
452
453 - mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0);
454 - mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0);
455 + mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0);
456 + mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0);
457
458 - write_phy_reg(pi, 0x6da, 0xffff);
459 - or_phy_reg(pi, 0x6db, 0x3);
460 + mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1);
461 + mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1);
462
463 - wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch);
464 - set_gain = false;
465 -
466 - lna2_gain = 3;
467 - while ((lna2_gain >= 0) && !set_gain) {
468 - tia_gain = 4;
469 -
470 - while ((tia_gain >= 0) && !set_gain) {
471 - biq1_gain = 6;
472 -
473 - while ((biq1_gain >= 0) && !set_gain) {
474 - set_gain = wlc_lcnphy_rx_iq_cal_gain(pi,
475 - (u16)
476 - biq1_gain,
477 - (u16)
478 - tia_gain,
479 - (u16)
480 - lna2_gain);
481 - biq1_gain -= 1;
482 - }
483 + write_radio_reg(pi, RADIO_2064_REG116, 0x06);
484 + write_radio_reg(pi, RADIO_2064_REG12C, 0x07);
485 + write_radio_reg(pi, RADIO_2064_REG06A, 0xd3);
486 + write_radio_reg(pi, RADIO_2064_REG098, 0x03);
487 + write_radio_reg(pi, RADIO_2064_REG00B, 0x7);
488 + mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4);
489 + write_radio_reg(pi, RADIO_2064_REG01D, 0x01);
490 + write_radio_reg(pi, RADIO_2064_REG114, 0x01);
491 + write_radio_reg(pi, RADIO_2064_REG02E, 0x10);
492 + write_radio_reg(pi, RADIO_2064_REG12A, 0x08);
493 +
494 + mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0);
495 + mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0);
496 + mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1);
497 + mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1);
498 + mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2);
499 + mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2);
500 + mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3);
501 + mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3);
502 + mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5);
503 + mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5);
504 +
505 + mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0);
506 + mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0);
507 +
508 + wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0);
509 + write_phy_reg(pi, 0x6da, 0xffff);
510 + or_phy_reg(pi, 0x6db, 0x3);
511 + wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch);
512 + wlc_lcnphy_rx_gain_override_enable(pi, true);
513 +
514 + tia_gain = 8;
515 + rx_pwr_threshold = 950;
516 + while (tia_gain > 0) {
517 tia_gain -= 1;
518 + wlc_lcnphy_set_rx_gain_by_distribution(pi,
519 + 0, 0, 2, 2,
520 + (u16)
521 + tia_gain, 1, 0);
522 + udelay(500);
523 +
524 + received_power =
525 + wlc_lcnphy_measure_digital_power(pi, 2000);
526 + if (received_power < rx_pwr_threshold)
527 + break;
528 }
529 - lna2_gain -= 1;
530 - }
531 + result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff);
532
533 - if (set_gain)
534 - result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024);
535 - else
536 - result = false;
537 + wlc_lcnphy_stop_tx_tone(pi);
538
539 - wlc_lcnphy_stop_tx_tone(pi);
540 + write_phy_reg(pi, 0x631, Core1TxControl_old);
541
542 - write_phy_reg(pi, 0x631, Core1TxControl_old);
543 -
544 - write_phy_reg(pi, 0x44c, RFOverrideVal0_old);
545 - write_phy_reg(pi, 0x44d, RFOverrideVal0_old);
546 - write_phy_reg(pi, 0x4b0, rfoverride2_old);
547 - write_phy_reg(pi, 0x4b1, rfoverride2val_old);
548 - write_phy_reg(pi, 0x4f9, rfoverride3_old);
549 - write_phy_reg(pi, 0x4fa, rfoverride3val_old);
550 - write_phy_reg(pi, 0x938, rfoverride4_old);
551 - write_phy_reg(pi, 0x939, rfoverride4val_old);
552 - write_phy_reg(pi, 0x43b, afectrlovr_old);
553 - write_phy_reg(pi, 0x43c, afectrlovrval_old);
554 - write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
555 - write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
556 + write_phy_reg(pi, 0x44c, RFOverrideVal0_old);
557 + write_phy_reg(pi, 0x44d, RFOverrideVal0_old);
558 + write_phy_reg(pi, 0x4b0, rfoverride2_old);
559 + write_phy_reg(pi, 0x4b1, rfoverride2val_old);
560 + write_phy_reg(pi, 0x4f9, rfoverride3_old);
561 + write_phy_reg(pi, 0x4fa, rfoverride3val_old);
562 + write_phy_reg(pi, 0x938, rfoverride4_old);
563 + write_phy_reg(pi, 0x939, rfoverride4val_old);
564 + write_phy_reg(pi, 0x43b, afectrlovr_old);
565 + write_phy_reg(pi, 0x43c, afectrlovrval_old);
566 + write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl);
567 + write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl);
568
569 - wlc_lcnphy_clear_trsw_override(pi);
570 + wlc_lcnphy_clear_trsw_override(pi);
571
572 - mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
573 + mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2);
574
575 - for (i = 0; i < 11; i++)
576 - write_radio_reg(pi, rxiq_cal_rf_reg[i],
577 - values_to_save[i]);
578 + for (i = 0; i < 11; i++)
579 + write_radio_reg(pi, rxiq_cal_rf_reg[i],
580 + values_to_save[i]);
581
582 - if (tx_gain_override_old)
583 - wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
584 - else
585 - wlc_lcnphy_disable_tx_gain_override(pi);
586 + if (tx_gain_override_old)
587 + wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old);
588 + else
589 + wlc_lcnphy_disable_tx_gain_override(pi);
590
591 - wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
592 - wlc_lcnphy_rx_gain_override_enable(pi, false);
593 + wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl);
594 + wlc_lcnphy_rx_gain_override_enable(pi, false);
595 + }
596
597 cal_done:
598 kfree(ptr);
599 @@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(struct brcms_phy *pi, u8 channel)
600 write_radio_reg(pi, RADIO_2064_REG038, 3);
601 write_radio_reg(pi, RADIO_2064_REG091, 7);
602 }
603 -
604 - if (!(pi->sh->boardflags & BFL_FEM)) {
605 - u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc,
606 - 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0};
607 -
608 - write_radio_reg(pi, RADIO_2064_REG02A, 0xf);
609 - write_radio_reg(pi, RADIO_2064_REG091, 0x3);
610 - write_radio_reg(pi, RADIO_2064_REG038, 0x3);
611 -
612 - write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]);
613 - }
614 }
615
616 static int
617 @@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy *pi, enum lcnphy_tssi_mode pos)
618 } else {
619 mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1);
620 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
621 - mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0);
622 - mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2);
623 - mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0);
624 - mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4);
625 - mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
626 - mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77);
627 - mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1);
628 - mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7);
629 - mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1);
630 - mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4);
631 }
632 } else {
633 mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2);
634 @@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparams(struct brcms_phy *pi)
635 (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12));
636
637 mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5));
638 - mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0));
639 }
640
641 static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
642 {
643 struct phytbl_info tab;
644 u32 rfseq, ind;
645 - u8 tssi_sel;
646
647 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
648 tab.tbl_width = 32;
649 @@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
650
651 mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4);
652
653 - if (pi->sh->boardflags & BFL_FEM) {
654 - tssi_sel = 0x1;
655 - wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
656 - } else {
657 - tssi_sel = 0xe;
658 - wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA);
659 - }
660 + wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT);
661 mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14);
662
663 mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15);
664 @@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
665 mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0);
666
667 if (LCNREV_IS(pi->pubpi.phy_rev, 2)) {
668 - mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel);
669 + mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe);
670 mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4);
671 } else {
672 - mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1);
673 mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1);
674 mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3);
675 }
676 @@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi)
677
678 mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8);
679
680 - mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0);
681 - mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0);
682 - mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8);
683 -
684 wlc_lcnphy_pwrctrl_rssiparams(pi);
685 }
686
687 @@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
688 read_radio_reg(pi, RADIO_2064_REG007) & 1;
689 u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10;
690 u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4;
691 - u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi);
692 -
693 idleTssi = read_phy_reg(pi, 0x4ab);
694 suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) &
695 MCTL_EN_MAC));
696 @@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
697 mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4);
698 mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2);
699 wlc_lcnphy_tssi_setup(pi);
700 -
701 - mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0));
702 - mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6));
703 -
704 - wlc_lcnphy_set_bbmult(pi, 0x0);
705 -
706 wlc_phy_do_dummy_tx(pi, true, OFF);
707 idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0))
708 >> 0);
709 @@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(struct brcms_phy_pub *ppi)
710
711 mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12);
712
713 - wlc_lcnphy_set_bbmult(pi, SAVE_bbmult);
714 wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old);
715 wlc_lcnphy_set_tx_gain(pi, &old_gains);
716 wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl);
717 @@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(struct brcms_phy_pub *ppi)
718 wlc_lcnphy_write_table(pi, &tab);
719 tab.tbl_offset++;
720 }
721 - mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0);
722 - mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0);
723 - mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8);
724 - mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4);
725 - mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2);
726
727 mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7);
728
729 @@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
730 target_gains.pad_gain = 21;
731 target_gains.dac_gain = 0;
732 wlc_lcnphy_set_tx_gain(pi, &target_gains);
733 + wlc_lcnphy_set_tx_pwr_by_index(pi, 16);
734
735 if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) {
736
737 @@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal(struct brcms_phy *pi)
738 lcnphy_recal ? LCNPHY_CAL_RECAL :
739 LCNPHY_CAL_FULL), false);
740 } else {
741 - wlc_lcnphy_set_tx_pwr_by_index(pi, 16);
742 wlc_lcnphy_tx_iqlo_soft_cal_full(pi);
743 }
744
745 @@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcms_phy *pi,
746 if (CHSPEC_IS5G(pi->radio_chanspec))
747 pa_gain = 0x70;
748 else
749 - pa_gain = 0x60;
750 + pa_gain = 0x70;
751
752 if (pi->sh->boardflags & BFL_FEM)
753 pa_gain = 0x10;
754 -
755 tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL;
756 tab.tbl_width = 32;
757 tab.tbl_len = 1;
758 tab.tbl_ptr = &val;
759
760 for (j = 0; j < 128; j++) {
761 - if (pi->sh->boardflags & BFL_FEM)
762 - gm_gain = gain_table[j].gm;
763 - else
764 - gm_gain = 15;
765 -
766 + gm_gain = gain_table[j].gm;
767 val = (((u32) pa_gain << 24) |
768 (gain_table[j].pad << 16) |
769 (gain_table[j].pga << 8) | gm_gain);
770 @@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
771
772 write_phy_reg(pi, 0x4ea, 0x4688);
773
774 - if (pi->sh->boardflags & BFL_FEM)
775 - mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
776 - else
777 - mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0);
778 + mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0);
779
780 mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6);
781
782 @@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct brcms_phy *pi)
783 wlc_lcnphy_rcal(pi);
784
785 wlc_lcnphy_rc_cal(pi);
786 -
787 - if (!(pi->sh->boardflags & BFL_FEM)) {
788 - write_radio_reg(pi, RADIO_2064_REG032, 0x6f);
789 - write_radio_reg(pi, RADIO_2064_REG033, 0x19);
790 - write_radio_reg(pi, RADIO_2064_REG039, 0xe);
791 - }
792 -
793 }
794
795 static void wlc_lcnphy_radio_init(struct brcms_phy *pi)
796 @@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct brcms_phy *pi)
797 wlc_lcnphy_write_table(pi, &tab);
798 }
799
800 - if (!(pi->sh->boardflags & BFL_FEM)) {
801 - tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
802 - tab.tbl_width = 16;
803 - tab.tbl_ptr = &val;
804 - tab.tbl_len = 1;
805 + tab.tbl_id = LCNPHY_TBL_ID_RFSEQ;
806 + tab.tbl_width = 16;
807 + tab.tbl_ptr = &val;
808 + tab.tbl_len = 1;
809
810 - val = 150;
811 - tab.tbl_offset = 0;
812 - wlc_lcnphy_write_table(pi, &tab);
813 + val = 114;
814 + tab.tbl_offset = 0;
815 + wlc_lcnphy_write_table(pi, &tab);
816
817 - val = 220;
818 - tab.tbl_offset = 1;
819 - wlc_lcnphy_write_table(pi, &tab);
820 - }
821 + val = 130;
822 + tab.tbl_offset = 1;
823 + wlc_lcnphy_write_table(pi, &tab);
824 +
825 + val = 6;
826 + tab.tbl_offset = 8;
827 + wlc_lcnphy_write_table(pi, &tab);
828
829 if (CHSPEC_IS2G(pi->radio_chanspec)) {
830 if (pi->sh->boardflags & BFL_FEM)
831 @@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct brcms_phy *pi, u16 chanspec)
832 wlc_lcnphy_load_tx_iir_filter(pi, true, 3);
833
834 mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3);
835 - wlc_lcnphy_tssi_setup(pi);
836 }
837
838 void wlc_phy_detach_lcnphy(struct brcms_phy *pi)
839 @@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
840 if (!wlc_phy_txpwr_srom_read_lcnphy(pi))
841 return false;
842
843 - if (LCNREV_IS(pi->pubpi.phy_rev, 1)) {
844 + if ((pi->sh->boardflags & BFL_FEM) &&
845 + (LCNREV_IS(pi->pubpi.phy_rev, 1))) {
846 if (pi_lcn->lcnphy_tempsense_option == 3) {
847 pi->hwpwrctrl = true;
848 pi->hwpwrctrl_capable = true;
849 diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
850 index b7e95ac..622c01c 100644
851 --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
852 +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c
853 @@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_4313_epa_rev0[] = {
854 };
855
856 static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = {
857 - 0x0009,
858 0x000a,
859 - 0x0005,
860 - 0x0006,
861 0x0009,
862 - 0x000a,
863 - 0x0005,
864 0x0006,
865 - 0x0009,
866 - 0x000a,
867 0x0005,
868 - 0x0006,
869 - 0x0009,
870 0x000a,
871 - 0x0005,
872 - 0x0006,
873 0x0009,
874 - 0x000a,
875 - 0x0005,
876 0x0006,
877 - 0x0009,
878 - 0x000a,
879 0x0005,
880 - 0x0006,
881 - 0x0009,
882 0x000a,
883 - 0x0005,
884 - 0x0006,
885 0x0009,
886 - 0x000a,
887 - 0x0005,
888 0x0006,
889 - 0x0009,
890 - 0x000a,
891 0x0005,
892 - 0x0006,
893 - 0x0009,
894 0x000a,
895 - 0x0005,
896 - 0x0006,
897 0x0009,
898 - 0x000a,
899 - 0x0005,
900 0x0006,
901 - 0x0009,
902 - 0x000a,
903 0x0005,
904 - 0x0006,
905 + 0x000a,
906 0x0009,
907 + 0x0006,
908 + 0x0005,
909 0x000a,
910 + 0x0009,
911 + 0x0006,
912 0x0005,
913 + 0x000a,
914 + 0x0009,
915 0x0006,
916 + 0x0005,
917 + 0x000a,
918 0x0009,
919 + 0x0006,
920 + 0x0005,
921 0x000a,
922 + 0x0009,
923 + 0x0006,
924 0x0005,
925 + 0x000a,
926 + 0x0009,
927 0x0006,
928 + 0x0005,
929 + 0x000a,
930 0x0009,
931 + 0x0006,
932 + 0x0005,
933 0x000a,
934 + 0x0009,
935 + 0x0006,
936 0x0005,
937 + 0x000a,
938 + 0x0009,
939 0x0006,
940 + 0x0005,
941 + 0x000a,
942 0x0009,
943 + 0x0006,
944 + 0x0005,
945 0x000a,
946 + 0x0009,
947 + 0x0006,
948 0x0005,
949 + 0x000a,
950 + 0x0009,
951 0x0006,
952 + 0x0005,
953 };
954
955 static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = {
956 diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
957 index aec2e0d..1924d8b 100644
958 --- a/drivers/scsi/libsas/sas_expander.c
959 +++ b/drivers/scsi/libsas/sas_expander.c
960 @@ -235,6 +235,17 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
961 linkrate = phy->linkrate;
962 memcpy(sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE);
963
964 + /* Handle vacant phy - rest of dr data is not valid so skip it */
965 + if (phy->phy_state == PHY_VACANT) {
966 + memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
967 + phy->attached_dev_type = NO_DEVICE;
968 + if (!test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state)) {
969 + phy->phy_id = phy_id;
970 + goto skip;
971 + } else
972 + goto out;
973 + }
974 +
975 phy->attached_dev_type = to_dev_type(dr);
976 if (test_bit(SAS_HA_ATA_EH_ACTIVE, &ha->state))
977 goto out;
978 @@ -272,6 +283,7 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id, void *rsp)
979 phy->phy->maximum_linkrate = dr->pmax_linkrate;
980 phy->phy->negotiated_linkrate = phy->linkrate;
981
982 + skip:
983 if (new_phy)
984 if (sas_phy_add(phy->phy)) {
985 sas_phy_free(phy->phy);
986 diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
987 index 7d4ec02..fea564c 100644
988 --- a/drivers/target/target_core_alua.c
989 +++ b/drivers/target/target_core_alua.c
990 @@ -408,6 +408,7 @@ static inline int core_alua_state_standby(
991 case REPORT_LUNS:
992 case RECEIVE_DIAGNOSTIC:
993 case SEND_DIAGNOSTIC:
994 + return 0;
995 case MAINTENANCE_IN:
996 switch (cdb[1] & 0x1f) {
997 case MI_REPORT_TARGET_PGS:
998 @@ -450,6 +451,7 @@ static inline int core_alua_state_unavailable(
999 switch (cdb[0]) {
1000 case INQUIRY:
1001 case REPORT_LUNS:
1002 + return 0;
1003 case MAINTENANCE_IN:
1004 switch (cdb[1] & 0x1f) {
1005 case MI_REPORT_TARGET_PGS:
1006 @@ -490,6 +492,7 @@ static inline int core_alua_state_transition(
1007 switch (cdb[0]) {
1008 case INQUIRY:
1009 case REPORT_LUNS:
1010 + return 0;
1011 case MAINTENANCE_IN:
1012 switch (cdb[1] & 0x1f) {
1013 case MI_REPORT_TARGET_PGS:
1014 diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
1015 index c578229..78f1be2 100644
1016 --- a/drivers/tty/tty_ldisc.c
1017 +++ b/drivers/tty/tty_ldisc.c
1018 @@ -934,17 +934,17 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
1019 * race with the set_ldisc code path.
1020 */
1021
1022 - tty_lock_pair(tty, o_tty);
1023 tty_ldisc_halt(tty);
1024 - tty_ldisc_flush_works(tty);
1025 - if (o_tty) {
1026 + if (o_tty)
1027 tty_ldisc_halt(o_tty);
1028 +
1029 + tty_ldisc_flush_works(tty);
1030 + if (o_tty)
1031 tty_ldisc_flush_works(o_tty);
1032 - }
1033
1034 + tty_lock_pair(tty, o_tty);
1035 /* This will need doing differently if we need to lock */
1036 tty_ldisc_kill(tty);
1037 -
1038 if (o_tty)
1039 tty_ldisc_kill(o_tty);
1040
1041 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
1042 index 12b3da3..f7199b9 100644
1043 --- a/fs/cifs/connect.c
1044 +++ b/fs/cifs/connect.c
1045 @@ -1546,14 +1546,24 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1046 }
1047 break;
1048 case Opt_blank_pass:
1049 - vol->password = NULL;
1050 - break;
1051 - case Opt_pass:
1052 /* passwords have to be handled differently
1053 * to allow the character used for deliminator
1054 * to be passed within them
1055 */
1056
1057 + /*
1058 + * Check if this is a case where the password
1059 + * starts with a delimiter
1060 + */
1061 + tmp_end = strchr(data, '=');
1062 + tmp_end++;
1063 + if (!(tmp_end < end && tmp_end[1] == delim)) {
1064 + /* No it is not. Set the password to NULL */
1065 + vol->password = NULL;
1066 + break;
1067 + }
1068 + /* Yes it is. Drop down to Opt_pass below.*/
1069 + case Opt_pass:
1070 /* Obtain the value string */
1071 value = strchr(data, '=');
1072 value++;
1073 diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
1074 index 991ab2d..7af426b 100644
1075 --- a/fs/gfs2/file.c
1076 +++ b/fs/gfs2/file.c
1077 @@ -924,8 +924,11 @@ static int gfs2_lock(struct file *file, int cmd, struct file_lock *fl)
1078 cmd = F_SETLK;
1079 fl->fl_type = F_UNLCK;
1080 }
1081 - if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
1082 + if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) {
1083 + if (fl->fl_type == F_UNLCK)
1084 + posix_lock_file_wait(file, fl);
1085 return -EIO;
1086 + }
1087 if (IS_GETLK(cmd))
1088 return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl);
1089 else if (fl->fl_type == F_UNLCK)
1090 diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
1091 index b7eff07..9afba3d6 100644
1092 --- a/fs/gfs2/rgrp.c
1093 +++ b/fs/gfs2/rgrp.c
1094 @@ -576,7 +576,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
1095 RB_CLEAR_NODE(&ip->i_res->rs_node);
1096 out:
1097 up_write(&ip->i_rw_mutex);
1098 - return 0;
1099 + return error;
1100 }
1101
1102 static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs)
1103 diff --git a/fs/inode.c b/fs/inode.c
1104 index 14084b7..b98540e 100644
1105 --- a/fs/inode.c
1106 +++ b/fs/inode.c
1107 @@ -725,7 +725,7 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan)
1108 * inode to the back of the list so we don't spin on it.
1109 */
1110 if (!spin_trylock(&inode->i_lock)) {
1111 - list_move_tail(&inode->i_lru, &sb->s_inode_lru);
1112 + list_move(&inode->i_lru, &sb->s_inode_lru);
1113 continue;
1114 }
1115
1116 diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
1117 index 25f01d0..b1b1fa6 100644
1118 --- a/include/asm-generic/tlb.h
1119 +++ b/include/asm-generic/tlb.h
1120 @@ -99,7 +99,12 @@ struct mmu_gather {
1121 unsigned int need_flush : 1, /* Did free PTEs */
1122 fast_mode : 1; /* No batching */
1123
1124 - unsigned int fullmm;
1125 + /* we are in the middle of an operation to clear
1126 + * a full mm and can make some optimizations */
1127 + unsigned int fullmm : 1,
1128 + /* we have performed an operation which
1129 + * requires a complete flush of the tlb */
1130 + need_flush_all : 1;
1131
1132 struct mmu_gather_batch *active;
1133 struct mmu_gather_batch local;
1134 diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
1135 index 92691d8..616603d 100644
1136 --- a/include/linux/ftrace.h
1137 +++ b/include/linux/ftrace.h
1138 @@ -394,7 +394,6 @@ ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
1139 size_t cnt, loff_t *ppos);
1140 ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
1141 size_t cnt, loff_t *ppos);
1142 -loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int whence);
1143 int ftrace_regex_release(struct inode *inode, struct file *file);
1144
1145 void __init
1146 @@ -567,6 +566,8 @@ static inline int
1147 ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
1148 #endif /* CONFIG_DYNAMIC_FTRACE */
1149
1150 +loff_t ftrace_filter_lseek(struct file *file, loff_t offset, int whence);
1151 +
1152 /* totally disable ftrace - can not re-enable after this */
1153 void ftrace_kill(void);
1154
1155 diff --git a/ipc/msg.c b/ipc/msg.c
1156 index 31cd1bf..fede1d0 100644
1157 --- a/ipc/msg.c
1158 +++ b/ipc/msg.c
1159 @@ -872,6 +872,7 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
1160 goto out_unlock;
1161 break;
1162 }
1163 + msg = ERR_PTR(-EAGAIN);
1164 } else
1165 break;
1166 msg_counter++;
1167 diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
1168 index c685e31..c3ae144 100644
1169 --- a/kernel/sched/clock.c
1170 +++ b/kernel/sched/clock.c
1171 @@ -176,10 +176,36 @@ static u64 sched_clock_remote(struct sched_clock_data *scd)
1172 u64 this_clock, remote_clock;
1173 u64 *ptr, old_val, val;
1174
1175 +#if BITS_PER_LONG != 64
1176 +again:
1177 + /*
1178 + * Careful here: The local and the remote clock values need to
1179 + * be read out atomic as we need to compare the values and
1180 + * then update either the local or the remote side. So the
1181 + * cmpxchg64 below only protects one readout.
1182 + *
1183 + * We must reread via sched_clock_local() in the retry case on
1184 + * 32bit as an NMI could use sched_clock_local() via the
1185 + * tracer and hit between the readout of
1186 + * the low32bit and the high 32bit portion.
1187 + */
1188 + this_clock = sched_clock_local(my_scd);
1189 + /*
1190 + * We must enforce atomic readout on 32bit, otherwise the
1191 + * update on the remote cpu can hit inbetween the readout of
1192 + * the low32bit and the high 32bit portion.
1193 + */
1194 + remote_clock = cmpxchg64(&scd->clock, 0, 0);
1195 +#else
1196 + /*
1197 + * On 64bit the read of [my]scd->clock is atomic versus the
1198 + * update, so we can avoid the above 32bit dance.
1199 + */
1200 sched_clock_local(my_scd);
1201 again:
1202 this_clock = my_scd->clock;
1203 remote_clock = scd->clock;
1204 +#endif
1205
1206 /*
1207 * Use the opportunity that we have both locks
1208 diff --git a/kernel/sys.c b/kernel/sys.c
1209 index 265b376..47f1d1b 100644
1210 --- a/kernel/sys.c
1211 +++ b/kernel/sys.c
1212 @@ -323,7 +323,6 @@ void kernel_restart_prepare(char *cmd)
1213 system_state = SYSTEM_RESTART;
1214 usermodehelper_disable();
1215 device_shutdown();
1216 - syscore_shutdown();
1217 }
1218
1219 /**
1220 @@ -369,6 +368,7 @@ void kernel_restart(char *cmd)
1221 {
1222 kernel_restart_prepare(cmd);
1223 disable_nonboot_cpus();
1224 + syscore_shutdown();
1225 if (!cmd)
1226 printk(KERN_EMERG "Restarting system.\n");
1227 else
1228 @@ -394,6 +394,7 @@ static void kernel_shutdown_prepare(enum system_states state)
1229 void kernel_halt(void)
1230 {
1231 kernel_shutdown_prepare(SYSTEM_HALT);
1232 + disable_nonboot_cpus();
1233 syscore_shutdown();
1234 printk(KERN_EMERG "System halted.\n");
1235 kmsg_dump(KMSG_DUMP_HALT);
1236 diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1237 index 64bc5d8..35cc3a8 100644
1238 --- a/kernel/trace/ftrace.c
1239 +++ b/kernel/trace/ftrace.c
1240 @@ -668,7 +668,6 @@ int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
1241 free_page(tmp);
1242 }
1243
1244 - free_page((unsigned long)stat->pages);
1245 stat->pages = NULL;
1246 stat->start = NULL;
1247
1248 @@ -1028,6 +1027,19 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
1249
1250 static struct pid * const ftrace_swapper_pid = &init_struct_pid;
1251
1252 +loff_t
1253 +ftrace_filter_lseek(struct file *file, loff_t offset, int whence)
1254 +{
1255 + loff_t ret;
1256 +
1257 + if (file->f_mode & FMODE_READ)
1258 + ret = seq_lseek(file, offset, whence);
1259 + else
1260 + file->f_pos = ret = 1;
1261 +
1262 + return ret;
1263 +}
1264 +
1265 #ifdef CONFIG_DYNAMIC_FTRACE
1266
1267 #ifndef CONFIG_FTRACE_MCOUNT_RECORD
1268 @@ -2590,7 +2602,7 @@ static void ftrace_filter_reset(struct ftrace_hash *hash)
1269 * routine, you can use ftrace_filter_write() for the write
1270 * routine if @flag has FTRACE_ITER_FILTER set, or
1271 * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set.
1272 - * ftrace_regex_lseek() should be used as the lseek routine, and
1273 + * ftrace_filter_lseek() should be used as the lseek routine, and
1274 * release must call ftrace_regex_release().
1275 */
1276 int
1277 @@ -2674,19 +2686,6 @@ ftrace_notrace_open(struct inode *inode, struct file *file)
1278 inode, file);
1279 }
1280
1281 -loff_t
1282 -ftrace_regex_lseek(struct file *file, loff_t offset, int whence)
1283 -{
1284 - loff_t ret;
1285 -
1286 - if (file->f_mode & FMODE_READ)
1287 - ret = seq_lseek(file, offset, whence);
1288 - else
1289 - file->f_pos = ret = 1;
1290 -
1291 - return ret;
1292 -}
1293 -
1294 static int ftrace_match(char *str, char *regex, int len, int type)
1295 {
1296 int matched = 0;
1297 @@ -3549,7 +3548,7 @@ static const struct file_operations ftrace_filter_fops = {
1298 .open = ftrace_filter_open,
1299 .read = seq_read,
1300 .write = ftrace_filter_write,
1301 - .llseek = ftrace_regex_lseek,
1302 + .llseek = ftrace_filter_lseek,
1303 .release = ftrace_regex_release,
1304 };
1305
1306 @@ -3557,7 +3556,7 @@ static const struct file_operations ftrace_notrace_fops = {
1307 .open = ftrace_notrace_open,
1308 .read = seq_read,
1309 .write = ftrace_notrace_write,
1310 - .llseek = ftrace_regex_lseek,
1311 + .llseek = ftrace_filter_lseek,
1312 .release = ftrace_regex_release,
1313 };
1314
1315 @@ -3762,8 +3761,8 @@ static const struct file_operations ftrace_graph_fops = {
1316 .open = ftrace_graph_open,
1317 .read = seq_read,
1318 .write = ftrace_graph_write,
1319 + .llseek = ftrace_filter_lseek,
1320 .release = ftrace_graph_release,
1321 - .llseek = seq_lseek,
1322 };
1323 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
1324
1325 @@ -4421,7 +4420,7 @@ static const struct file_operations ftrace_pid_fops = {
1326 .open = ftrace_pid_open,
1327 .write = ftrace_pid_write,
1328 .read = seq_read,
1329 - .llseek = seq_lseek,
1330 + .llseek = ftrace_filter_lseek,
1331 .release = ftrace_pid_release,
1332 };
1333
1334 diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
1335 index 42ca822..83a8b5b 100644
1336 --- a/kernel/trace/trace_stack.c
1337 +++ b/kernel/trace/trace_stack.c
1338 @@ -322,7 +322,7 @@ static const struct file_operations stack_trace_filter_fops = {
1339 .open = stack_trace_filter_open,
1340 .read = seq_read,
1341 .write = ftrace_filter_write,
1342 - .llseek = ftrace_regex_lseek,
1343 + .llseek = ftrace_filter_lseek,
1344 .release = ftrace_regex_release,
1345 };
1346
1347 diff --git a/lib/kobject.c b/lib/kobject.c
1348 index e07ee1f..a654866 100644
1349 --- a/lib/kobject.c
1350 +++ b/lib/kobject.c
1351 @@ -529,6 +529,13 @@ struct kobject *kobject_get(struct kobject *kobj)
1352 return kobj;
1353 }
1354
1355 +static struct kobject *kobject_get_unless_zero(struct kobject *kobj)
1356 +{
1357 + if (!kref_get_unless_zero(&kobj->kref))
1358 + kobj = NULL;
1359 + return kobj;
1360 +}
1361 +
1362 /*
1363 * kobject_cleanup - free kobject resources.
1364 * @kobj: object to cleanup
1365 @@ -751,7 +758,7 @@ struct kobject *kset_find_obj(struct kset *kset, const char *name)
1366
1367 list_for_each_entry(k, &kset->list, entry) {
1368 if (kobject_name(k) && !strcmp(kobject_name(k), name)) {
1369 - ret = kobject_get(k);
1370 + ret = kobject_get_unless_zero(k);
1371 break;
1372 }
1373 }
1374 diff --git a/mm/memory.c b/mm/memory.c
1375 index bb1369f..f8b734a 100644
1376 --- a/mm/memory.c
1377 +++ b/mm/memory.c
1378 @@ -212,6 +212,7 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm)
1379 tlb->mm = mm;
1380
1381 tlb->fullmm = fullmm;
1382 + tlb->need_flush_all = 0;
1383 tlb->start = -1UL;
1384 tlb->end = 0;
1385 tlb->need_flush = 0;
1386 diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
1387 index 1440b3f..b54c2e8 100644
1388 --- a/sound/soc/codecs/wm5102.c
1389 +++ b/sound/soc/codecs/wm5102.c
1390 @@ -576,7 +576,7 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
1391 struct snd_kcontrol *kcontrol, int event)
1392 {
1393 struct snd_soc_codec *codec = w->codec;
1394 - struct arizona *arizona = dev_get_drvdata(codec->dev);
1395 + struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
1396 struct regmap *regmap = codec->control_data;
1397 const struct reg_default *patch = NULL;
1398 int i, patch_size;
1399 diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
1400 index 134e41c..f8a31ad 100644
1401 --- a/sound/soc/codecs/wm8903.c
1402 +++ b/sound/soc/codecs/wm8903.c
1403 @@ -1083,6 +1083,8 @@ static const struct snd_soc_dapm_route wm8903_intercon[] = {
1404 { "ROP", NULL, "Right Speaker PGA" },
1405 { "RON", NULL, "Right Speaker PGA" },
1406
1407 + { "Charge Pump", NULL, "CLK_DSP" },
1408 +
1409 { "Left Headphone Output PGA", NULL, "Charge Pump" },
1410 { "Right Headphone Output PGA", NULL, "Charge Pump" },
1411 { "Left Line Output PGA", NULL, "Charge Pump" },
1412 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
1413 index 2370063..f3ab918 100644
1414 --- a/sound/soc/soc-core.c
1415 +++ b/sound/soc/soc-core.c
1416 @@ -2959,7 +2959,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
1417 val = val << shift;
1418
1419 ret = snd_soc_update_bits_locked(codec, reg, val_mask, val);
1420 - if (ret != 0)
1421 + if (ret < 0)
1422 return ret;
1423
1424 if (snd_soc_volsw_is_stereo(mc)) {
1425 diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
1426 index 15520de..190f434 100644
1427 --- a/sound/usb/mixer_quirks.c
1428 +++ b/sound/usb/mixer_quirks.c
1429 @@ -509,7 +509,7 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol,
1430 else
1431 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
1432 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
1433 - 0, cpu_to_le16(wIndex),
1434 + 0, wIndex,
1435 &tmp, sizeof(tmp), 1000);
1436 up_read(&mixer->chip->shutdown_rwsem);
1437
1438 @@ -540,7 +540,7 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol,
1439 else
1440 ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
1441 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
1442 - cpu_to_le16(wValue), cpu_to_le16(wIndex),
1443 + wValue, wIndex,
1444 NULL, 0, 1000);
1445 up_read(&mixer->chip->shutdown_rwsem);
1446
1447 diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
1448 index 0115289..b9ca776 100644
1449 --- a/sound/usb/quirks.c
1450 +++ b/sound/usb/quirks.c
1451 @@ -486,7 +486,7 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev)
1452 {
1453 int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
1454 0xaf, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
1455 - cpu_to_le16(1), 0, NULL, 0, 1000);
1456 + 1, 0, NULL, 0, 1000);
1457
1458 if (ret < 0)
1459 return ret;