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