From fc3fed8a8612a4ffc6194d5237961949ae8120b5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 12 Apr 2013 13:02:20 -0700 Subject: [PATCH] 3.8-stable patches added patches: arm-imx35-bugfix-admux-clock.patch arm-kirkwood-fix-typo-in-the-definition-of-ix2-200-rebuild-led.patch asoc-core-fix-to-check-return-value-of-snd_soc_update_bits_locked.patch asoc-wm5102-correct-lookup-of-arizona-struct-in-sysclk-event.patch asoc-wm8903-fix-the-bypass-to-hp-lineout-when-no-dac-or-adc-is-running.patch dmaengine-omap-dma-start-dma-without-delay-for-cyclic-channels.patch gfs2-fix-unlock-of-fcntl-locks-during-withdrawn-state.patch gfs2-return-error-if-malloc-failed-in-gfs2_rs_alloc.patch ipc-set-msg-back-to-eagain-if-copy-wasn-t-performed.patch pm-reboot-call-syscore_shutdown-after-disable_nonboot_cpus.patch revert-brcmsmac-support-4313ipa.patch tracing-fix-double-free-when-function-profile-init-failed.patch --- queue-3.8/arm-imx35-bugfix-admux-clock.patch | 34 + ...he-definition-of-ix2-200-rebuild-led.patch | 57 ++ ...-value-of-snd_soc_update_bits_locked.patch | 31 + ...up-of-arizona-struct-in-sysclk-event.patch | 28 + ...ineout-when-no-dac-or-adc-is-running.patch | 33 + ...ma-without-delay-for-cyclic-channels.patch | 54 ++ ...f-fcntl-locks-during-withdrawn-state.patch | 37 + ...or-if-malloc-failed-in-gfs2_rs_alloc.patch | 33 + ...k-to-eagain-if-copy-wasn-t-performed.patch | 35 + ..._shutdown-after-disable_nonboot_cpus.patch | 57 ++ .../revert-brcmsmac-support-4313ipa.patch | 703 ++++++++++++++++++ queue-3.8/series | 12 + ...ee-when-function-profile-init-failed.patch | 34 + 13 files changed, 1148 insertions(+) create mode 100644 queue-3.8/arm-imx35-bugfix-admux-clock.patch create mode 100644 queue-3.8/arm-kirkwood-fix-typo-in-the-definition-of-ix2-200-rebuild-led.patch create mode 100644 queue-3.8/asoc-core-fix-to-check-return-value-of-snd_soc_update_bits_locked.patch create mode 100644 queue-3.8/asoc-wm5102-correct-lookup-of-arizona-struct-in-sysclk-event.patch create mode 100644 queue-3.8/asoc-wm8903-fix-the-bypass-to-hp-lineout-when-no-dac-or-adc-is-running.patch create mode 100644 queue-3.8/dmaengine-omap-dma-start-dma-without-delay-for-cyclic-channels.patch create mode 100644 queue-3.8/gfs2-fix-unlock-of-fcntl-locks-during-withdrawn-state.patch create mode 100644 queue-3.8/gfs2-return-error-if-malloc-failed-in-gfs2_rs_alloc.patch create mode 100644 queue-3.8/ipc-set-msg-back-to-eagain-if-copy-wasn-t-performed.patch create mode 100644 queue-3.8/pm-reboot-call-syscore_shutdown-after-disable_nonboot_cpus.patch create mode 100644 queue-3.8/revert-brcmsmac-support-4313ipa.patch create mode 100644 queue-3.8/tracing-fix-double-free-when-function-profile-init-failed.patch diff --git a/queue-3.8/arm-imx35-bugfix-admux-clock.patch b/queue-3.8/arm-imx35-bugfix-admux-clock.patch new file mode 100644 index 00000000000..6a0c64c1eb1 --- /dev/null +++ b/queue-3.8/arm-imx35-bugfix-admux-clock.patch @@ -0,0 +1,34 @@ +From 75498083e25e96932ad998ffdeadb17234c68d3a Mon Sep 17 00:00:00 2001 +From: Markus Pargmann +Date: Fri, 29 Mar 2013 16:20:10 +0100 +Subject: ARM: imx35 Bugfix admux clock + +From: Markus Pargmann + +commit 75498083e25e96932ad998ffdeadb17234c68d3a upstream. + +The admux clock seems to be the audmux clock as tests show. audmux does +not work without this clock enabled. Currently imx35 does not register a +clock device for audmux. This patch adds this registration. imx-audmux +driver already handles a clock device, so no changes are necessary +there. + +Signed-off-by: Markus Pargmann +Signed-off-by: Sascha Hauer +Signed-off-by: Shawn Guo +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/mach-imx/clk-imx35.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/arm/mach-imx/clk-imx35.c ++++ b/arch/arm/mach-imx/clk-imx35.c +@@ -257,6 +257,7 @@ int __init mx35_clocks_init() + clk_register_clkdev(clk[wdog_gate], NULL, "imx2-wdt.0"); + clk_register_clkdev(clk[nfc_div], NULL, "imx25-nand.0"); + clk_register_clkdev(clk[csi_gate], NULL, "mx3-camera.0"); ++ clk_register_clkdev(clk[admux_gate], "audmux", NULL); + + clk_prepare_enable(clk[spba_gate]); + clk_prepare_enable(clk[gpio1_gate]); diff --git a/queue-3.8/arm-kirkwood-fix-typo-in-the-definition-of-ix2-200-rebuild-led.patch b/queue-3.8/arm-kirkwood-fix-typo-in-the-definition-of-ix2-200-rebuild-led.patch new file mode 100644 index 00000000000..fd79448f36b --- /dev/null +++ b/queue-3.8/arm-kirkwood-fix-typo-in-the-definition-of-ix2-200-rebuild-led.patch @@ -0,0 +1,57 @@ +From 8f08d6667287241f6818d35e02b223fb5df97cf1 Mon Sep 17 00:00:00 2001 +From: Nigel Roberts +Date: Mon, 1 Apr 2013 23:03:22 +1100 +Subject: ARM: Kirkwood: Fix typo in the definition of ix2-200 rebuild LED + +From: Nigel Roberts + +commit 8f08d6667287241f6818d35e02b223fb5df97cf1 upstream. + +In the conversion to pinctrl, an error in the pins for the rebuild +LED was introduced. This patch assigns the correct pins and includes +the correct name for the LED in kirkwood-iomega_ix2_200.dts. + +Signed-off-by: Nigel Roberts +Signed-off-by: Jason Cooper +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +--- a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts ++++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts +@@ -96,11 +96,11 @@ + marvell,function = "gpio"; + }; + pmx_led_rebuild_brt_ctrl_1: pmx-led-rebuild-brt-ctrl-1 { +- marvell,pins = "mpp44"; ++ marvell,pins = "mpp46"; + marvell,function = "gpio"; + }; + pmx_led_rebuild_brt_ctrl_2: pmx-led-rebuild-brt-ctrl-2 { +- marvell,pins = "mpp45"; ++ marvell,pins = "mpp47"; + marvell,function = "gpio"; + }; + +@@ -157,14 +157,14 @@ + gpios = <&gpio0 16 0>; + linux,default-trigger = "default-on"; + }; +- health_led1 { ++ rebuild_led { ++ label = "status:white:rebuild_led"; ++ gpios = <&gpio1 4 0>; ++ }; ++ health_led { + label = "status:red:health_led"; + gpios = <&gpio1 5 0>; + }; +- health_led2 { +- label = "status:white:health_led"; +- gpios = <&gpio1 4 0>; +- }; + backup_led { + label = "status:blue:backup_led"; + gpios = <&gpio0 15 0>; diff --git a/queue-3.8/asoc-core-fix-to-check-return-value-of-snd_soc_update_bits_locked.patch b/queue-3.8/asoc-core-fix-to-check-return-value-of-snd_soc_update_bits_locked.patch new file mode 100644 index 00000000000..d30ee9cd499 --- /dev/null +++ b/queue-3.8/asoc-core-fix-to-check-return-value-of-snd_soc_update_bits_locked.patch @@ -0,0 +1,31 @@ +From 0eaa6cca1f75e12e4f5ec62cbe887330fe3b5fe9 Mon Sep 17 00:00:00 2001 +From: Joonyoung Shim +Date: Tue, 26 Mar 2013 14:41:05 +0900 +Subject: ASoC: core: Fix to check return value of snd_soc_update_bits_locked() + +From: Joonyoung Shim + +commit 0eaa6cca1f75e12e4f5ec62cbe887330fe3b5fe9 upstream. + +It can be 0 or 1 return value of snd_soc_update_bits_locked() when it is +success. So just check return value is negative. + +Signed-off-by: Joonyoung Shim +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/soc-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/soc-core.c ++++ b/sound/soc/soc-core.c +@@ -2959,7 +2959,7 @@ int snd_soc_put_volsw_range(struct snd_k + val = val << shift; + + ret = snd_soc_update_bits_locked(codec, reg, val_mask, val); +- if (ret != 0) ++ if (ret < 0) + return ret; + + if (snd_soc_volsw_is_stereo(mc)) { diff --git a/queue-3.8/asoc-wm5102-correct-lookup-of-arizona-struct-in-sysclk-event.patch b/queue-3.8/asoc-wm5102-correct-lookup-of-arizona-struct-in-sysclk-event.patch new file mode 100644 index 00000000000..1ba3b2f30b6 --- /dev/null +++ b/queue-3.8/asoc-wm5102-correct-lookup-of-arizona-struct-in-sysclk-event.patch @@ -0,0 +1,28 @@ +From f6f629f8332ea70255f6c60c904270640a21a114 Mon Sep 17 00:00:00 2001 +From: Mark Brown +Date: Fri, 5 Apr 2013 13:19:26 +0100 +Subject: ASoC: wm5102: Correct lookup of arizona struct in SYSCLK event + +From: Mark Brown + +commit f6f629f8332ea70255f6c60c904270640a21a114 upstream. + +Reported-by: Ryo Tsutsui +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/wm5102.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/soc/codecs/wm5102.c ++++ b/sound/soc/codecs/wm5102.c +@@ -576,7 +576,7 @@ static int wm5102_sysclk_ev(struct snd_s + struct snd_kcontrol *kcontrol, int event) + { + struct snd_soc_codec *codec = w->codec; +- struct arizona *arizona = dev_get_drvdata(codec->dev); ++ struct arizona *arizona = dev_get_drvdata(codec->dev->parent); + struct regmap *regmap = codec->control_data; + const struct reg_default *patch = NULL; + int i, patch_size; diff --git a/queue-3.8/asoc-wm8903-fix-the-bypass-to-hp-lineout-when-no-dac-or-adc-is-running.patch b/queue-3.8/asoc-wm8903-fix-the-bypass-to-hp-lineout-when-no-dac-or-adc-is-running.patch new file mode 100644 index 00000000000..92edd16ce7b --- /dev/null +++ b/queue-3.8/asoc-wm8903-fix-the-bypass-to-hp-lineout-when-no-dac-or-adc-is-running.patch @@ -0,0 +1,33 @@ +From f1ca493b0b5e8f42d3b2dc8877860db2983f47b6 Mon Sep 17 00:00:00 2001 +From: Alban Bedel +Date: Tue, 9 Apr 2013 17:13:59 +0200 +Subject: ASoC: wm8903: Fix the bypass to HP/LINEOUT when no DAC or ADC is running + +From: Alban Bedel + +commit f1ca493b0b5e8f42d3b2dc8877860db2983f47b6 upstream. + +The Charge Pump needs the DSP clock to work properly, without it the +bypass to HP/LINEOUT is not working properly. This requirement is not +mentioned in the datasheet but has been confirmed by Mark Brown from +Wolfson. + +Signed-off-by: Alban Bedel +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/codecs/wm8903.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/soc/codecs/wm8903.c ++++ b/sound/soc/codecs/wm8903.c +@@ -1083,6 +1083,8 @@ static const struct snd_soc_dapm_route w + { "ROP", NULL, "Right Speaker PGA" }, + { "RON", NULL, "Right Speaker PGA" }, + ++ { "Charge Pump", NULL, "CLK_DSP" }, ++ + { "Left Headphone Output PGA", NULL, "Charge Pump" }, + { "Right Headphone Output PGA", NULL, "Charge Pump" }, + { "Left Line Output PGA", NULL, "Charge Pump" }, diff --git a/queue-3.8/dmaengine-omap-dma-start-dma-without-delay-for-cyclic-channels.patch b/queue-3.8/dmaengine-omap-dma-start-dma-without-delay-for-cyclic-channels.patch new file mode 100644 index 00000000000..a756858fa23 --- /dev/null +++ b/queue-3.8/dmaengine-omap-dma-start-dma-without-delay-for-cyclic-channels.patch @@ -0,0 +1,54 @@ +From 765024697807ad1e1cac332aa891253ca4a339da Mon Sep 17 00:00:00 2001 +From: Peter Ujfalusi +Date: Tue, 9 Apr 2013 16:33:06 +0200 +Subject: dmaengine: omap-dma: Start DMA without delay for cyclic channels + +From: Peter Ujfalusi + +commit 765024697807ad1e1cac332aa891253ca4a339da upstream. + +cyclic DMA is only used by audio which needs DMA to be started without a +delay. +If the DMA for audio is started using the tasklet we experience random +channel switch (to be more precise: channel shift). + +Reported-by: Peter Meerwald +Signed-off-by: Peter Ujfalusi +Acked-by: Santosh Shilimkar +Acked-by: Russell King +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/dma/omap-dma.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +--- a/drivers/dma/omap-dma.c ++++ b/drivers/dma/omap-dma.c +@@ -276,12 +276,20 @@ static void omap_dma_issue_pending(struc + + spin_lock_irqsave(&c->vc.lock, flags); + if (vchan_issue_pending(&c->vc) && !c->desc) { +- struct omap_dmadev *d = to_omap_dma_dev(chan->device); +- spin_lock(&d->lock); +- if (list_empty(&c->node)) +- list_add_tail(&c->node, &d->pending); +- spin_unlock(&d->lock); +- tasklet_schedule(&d->task); ++ /* ++ * c->cyclic is used only by audio and in this case the DMA need ++ * to be started without delay. ++ */ ++ if (!c->cyclic) { ++ struct omap_dmadev *d = to_omap_dma_dev(chan->device); ++ spin_lock(&d->lock); ++ if (list_empty(&c->node)) ++ list_add_tail(&c->node, &d->pending); ++ spin_unlock(&d->lock); ++ tasklet_schedule(&d->task); ++ } else { ++ omap_dma_start_desc(c); ++ } + } + spin_unlock_irqrestore(&c->vc.lock, flags); + } diff --git a/queue-3.8/gfs2-fix-unlock-of-fcntl-locks-during-withdrawn-state.patch b/queue-3.8/gfs2-fix-unlock-of-fcntl-locks-during-withdrawn-state.patch new file mode 100644 index 00000000000..ab839288335 --- /dev/null +++ b/queue-3.8/gfs2-fix-unlock-of-fcntl-locks-during-withdrawn-state.patch @@ -0,0 +1,37 @@ +From c2952d202f710d326ac36a8ea6bd216b20615ec8 Mon Sep 17 00:00:00 2001 +From: Steven Whitehouse +Date: Thu, 14 Mar 2013 15:49:59 +0000 +Subject: GFS2: Fix unlock of fcntl locks during withdrawn state + +From: Steven Whitehouse + +commit c2952d202f710d326ac36a8ea6bd216b20615ec8 upstream. + +When withdraw occurs, we need to continue to allow unlocks of fcntl +locks to occur, however these will only be local, since the node has +withdrawn from the cluster. This prevents triggering a VFS level +bug trap due to locks remaining when a file is closed. + +Signed-off-by: Steven Whitehouse +Signed-off-by: Jonghwan Choi +Signed-off-by: Greg Kroah-Hartman + +--- + fs/gfs2/file.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/fs/gfs2/file.c ++++ b/fs/gfs2/file.c +@@ -924,8 +924,11 @@ static int gfs2_lock(struct file *file, + cmd = F_SETLK; + fl->fl_type = F_UNLCK; + } +- if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) ++ if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) { ++ if (fl->fl_type == F_UNLCK) ++ posix_lock_file_wait(file, fl); + return -EIO; ++ } + if (IS_GETLK(cmd)) + return dlm_posix_get(ls->ls_dlm, ip->i_no_addr, file, fl); + else if (fl->fl_type == F_UNLCK) diff --git a/queue-3.8/gfs2-return-error-if-malloc-failed-in-gfs2_rs_alloc.patch b/queue-3.8/gfs2-return-error-if-malloc-failed-in-gfs2_rs_alloc.patch new file mode 100644 index 00000000000..2e0e22e05dc --- /dev/null +++ b/queue-3.8/gfs2-return-error-if-malloc-failed-in-gfs2_rs_alloc.patch @@ -0,0 +1,33 @@ +From 441362d06be349430d06e37286adce4b90e6ce96 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Mon, 11 Mar 2013 23:01:37 +0800 +Subject: GFS2: return error if malloc failed in gfs2_rs_alloc() + +From: Wei Yongjun + +commit 441362d06be349430d06e37286adce4b90e6ce96 upstream. + +The error code in gfs2_rs_alloc() is set to ENOMEM when error +but never be used, instead, gfs2_rs_alloc() always return 0. +Fix to return 'error'. + +Signed-off-by: Wei Yongjun +Signed-off-by: Steven Whitehouse +Signed-off-by: Jonghwan Choi +Signed-off-by: Greg Kroah-Hartman + +--- + fs/gfs2/rgrp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/gfs2/rgrp.c ++++ b/fs/gfs2/rgrp.c +@@ -576,7 +576,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip) + RB_CLEAR_NODE(&ip->i_res->rs_node); + out: + up_write(&ip->i_rw_mutex); +- return 0; ++ return error; + } + + static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) diff --git a/queue-3.8/ipc-set-msg-back-to-eagain-if-copy-wasn-t-performed.patch b/queue-3.8/ipc-set-msg-back-to-eagain-if-copy-wasn-t-performed.patch new file mode 100644 index 00000000000..97a24191f4b --- /dev/null +++ b/queue-3.8/ipc-set-msg-back-to-eagain-if-copy-wasn-t-performed.patch @@ -0,0 +1,35 @@ +From 2dc958fa2fe6987e7ab106bd97029a09a82fcd8d Mon Sep 17 00:00:00 2001 +From: Stanislav Kinsbursky +Date: Mon, 1 Apr 2013 11:40:51 +0400 +Subject: ipc: set msg back to -EAGAIN if copy wasn't performed + +From: Stanislav Kinsbursky + +commit 2dc958fa2fe6987e7ab106bd97029a09a82fcd8d upstream. + +Make sure that msg pointer is set back to error value in case of +MSG_COPY flag is set and desired message to copy wasn't found. This +garantees that msg is either a error pointer or a copy address. + +Otherwise the last message in queue will be freed without unlinking from +the queue (which leads to memory corruption) and the dummy allocated +copy won't be released. + +Signed-off-by: Stanislav Kinsbursky +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + ipc/msg.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/ipc/msg.c ++++ b/ipc/msg.c +@@ -872,6 +872,7 @@ long do_msgrcv(int msqid, void __user *b + goto out_unlock; + break; + } ++ msg = ERR_PTR(-EAGAIN); + } else + break; + msg_counter++; diff --git a/queue-3.8/pm-reboot-call-syscore_shutdown-after-disable_nonboot_cpus.patch b/queue-3.8/pm-reboot-call-syscore_shutdown-after-disable_nonboot_cpus.patch new file mode 100644 index 00000000000..9e54951dcf6 --- /dev/null +++ b/queue-3.8/pm-reboot-call-syscore_shutdown-after-disable_nonboot_cpus.patch @@ -0,0 +1,57 @@ +From 6f389a8f1dd22a24f3d9afc2812b30d639e94625 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Sun, 7 Apr 2013 02:14:14 +0000 +Subject: PM / reboot: call syscore_shutdown() after disable_nonboot_cpus() + +From: Huacai Chen + +commit 6f389a8f1dd22a24f3d9afc2812b30d639e94625 upstream. + +As commit 40dc166c (PM / Core: Introduce struct syscore_ops for core +subsystems PM) say, syscore_ops operations should be carried with one +CPU on-line and interrupts disabled. However, after commit f96972f2d +(kernel/sys.c: call disable_nonboot_cpus() in kernel_restart()), +syscore_shutdown() is called before disable_nonboot_cpus(), so break +the rules. We have a MIPS machine with a 8259A PIC, and there is an +external timer (HPET) linked at 8259A. Since 8259A has been shutdown +too early (by syscore_shutdown()), disable_nonboot_cpus() runs without +timer interrupt, so it hangs and reboot fails. This patch call +syscore_shutdown() a little later (after disable_nonboot_cpus()) to +avoid reboot failure, this is the same way as poweroff does. + +For consistency, add disable_nonboot_cpus() to kernel_halt(). + +Signed-off-by: Huacai Chen +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/sys.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/sys.c ++++ b/kernel/sys.c +@@ -323,7 +323,6 @@ void kernel_restart_prepare(char *cmd) + system_state = SYSTEM_RESTART; + usermodehelper_disable(); + device_shutdown(); +- syscore_shutdown(); + } + + /** +@@ -369,6 +368,7 @@ void kernel_restart(char *cmd) + { + kernel_restart_prepare(cmd); + disable_nonboot_cpus(); ++ syscore_shutdown(); + if (!cmd) + printk(KERN_EMERG "Restarting system.\n"); + else +@@ -394,6 +394,7 @@ static void kernel_shutdown_prepare(enum + void kernel_halt(void) + { + kernel_shutdown_prepare(SYSTEM_HALT); ++ disable_nonboot_cpus(); + syscore_shutdown(); + printk(KERN_EMERG "System halted.\n"); + kmsg_dump(KMSG_DUMP_HALT); diff --git a/queue-3.8/revert-brcmsmac-support-4313ipa.patch b/queue-3.8/revert-brcmsmac-support-4313ipa.patch new file mode 100644 index 00000000000..03901f75d00 --- /dev/null +++ b/queue-3.8/revert-brcmsmac-support-4313ipa.patch @@ -0,0 +1,703 @@ +From 54683441a92ebe20c5282465ea6f21e5e74d2974 Mon Sep 17 00:00:00 2001 +From: "John W. Linville" +Date: Wed, 27 Mar 2013 10:52:11 -0400 +Subject: Revert "brcmsmac: support 4313iPA" + +From: "John W. Linville" + +commit 54683441a92ebe20c5282465ea6f21e5e74d2974 upstream. + +This reverts commit b6fc28a158076ca2764edc9a6d1e1402f56e1c0c. + +This commit is reported to cause a regression in the support for some +revisions of 4313 ePA devices. + +http://marc.info/?l=linux-wireless&m=136360340200943&w=2 + +Conflicts: + drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c + +Reported-by: David Herrmann +Signed-off-by: John W. Linville +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 375 +++++---------- + drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | 64 +- + 2 files changed, 165 insertions(+), 274 deletions(-) + +--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(s + gain0_15 = ((biq1 & 0xf) << 12) | + ((tia & 0xf) << 8) | + ((lna2 & 0x3) << 6) | +- ((lna2 & 0x3) << 4) | +- ((lna1 & 0x3) << 2) | +- ((lna1 & 0x3) << 0); ++ ((lna2 & ++ 0x3) << 4) | ((lna1 & 0x3) << 2) | ((lna1 & 0x3) << 0); + + mod_phy_reg(pi, 0x4b6, (0xffff << 0), gain0_15 << 0); + mod_phy_reg(pi, 0x4b7, (0xf << 0), gain16_19 << 0); +@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(s + } + + mod_phy_reg(pi, 0x44d, (0x1 << 0), (!trsw) << 0); +- mod_phy_reg(pi, 0x4b1, (0x3 << 11), lna1 << 11); +- mod_phy_reg(pi, 0x4e6, (0x3 << 3), lna1 << 3); + + } + +@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_po + return (iq_est.i_pwr + iq_est.q_pwr) / nsamples; + } + +-static bool wlc_lcnphy_rx_iq_cal_gain(struct brcms_phy *pi, u16 biq1_gain, +- u16 tia_gain, u16 lna2_gain) +-{ +- u32 i_thresh_l, q_thresh_l; +- u32 i_thresh_h, q_thresh_h; +- struct lcnphy_iq_est iq_est_h, iq_est_l; +- +- wlc_lcnphy_set_rx_gain_by_distribution(pi, 0, 0, 0, biq1_gain, tia_gain, +- lna2_gain, 0); +- +- wlc_lcnphy_rx_gain_override_enable(pi, true); +- wlc_lcnphy_start_tx_tone(pi, 2000, (40 >> 1), 0); +- udelay(500); +- write_radio_reg(pi, RADIO_2064_REG112, 0); +- if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_l)) +- return false; +- +- wlc_lcnphy_start_tx_tone(pi, 2000, 40, 0); +- udelay(500); +- write_radio_reg(pi, RADIO_2064_REG112, 0); +- if (!wlc_lcnphy_rx_iq_est(pi, 1024, 32, &iq_est_h)) +- return false; +- +- i_thresh_l = (iq_est_l.i_pwr << 1); +- i_thresh_h = (iq_est_l.i_pwr << 2) + iq_est_l.i_pwr; +- +- q_thresh_l = (iq_est_l.q_pwr << 1); +- q_thresh_h = (iq_est_l.q_pwr << 2) + iq_est_l.q_pwr; +- if ((iq_est_h.i_pwr > i_thresh_l) && +- (iq_est_h.i_pwr < i_thresh_h) && +- (iq_est_h.q_pwr > q_thresh_l) && +- (iq_est_h.q_pwr < q_thresh_h)) +- return true; +- +- return false; +-} +- + static bool + wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, + const struct lcnphy_rx_iqcomp *iqcomp, +@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *p + RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, + rfoverride3_old, rfoverride3val_old, rfoverride4_old, + rfoverride4val_old, afectrlovr_old, afectrlovrval_old; +- int tia_gain, lna2_gain, biq1_gain; +- bool set_gain; ++ int tia_gain; ++ u32 received_power, rx_pwr_threshold; + u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl; + u16 values_to_save[11]; + s16 *ptr; +@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *p + goto cal_done; + } + +- WARN_ON(module != 1); +- tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); +- wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); +- +- for (i = 0; i < 11; i++) +- values_to_save[i] = +- read_radio_reg(pi, rxiq_cal_rf_reg[i]); +- Core1TxControl_old = read_phy_reg(pi, 0x631); +- +- or_phy_reg(pi, 0x631, 0x0015); +- +- RFOverride0_old = read_phy_reg(pi, 0x44c); +- RFOverrideVal0_old = read_phy_reg(pi, 0x44d); +- rfoverride2_old = read_phy_reg(pi, 0x4b0); +- rfoverride2val_old = read_phy_reg(pi, 0x4b1); +- rfoverride3_old = read_phy_reg(pi, 0x4f9); +- rfoverride3val_old = read_phy_reg(pi, 0x4fa); +- rfoverride4_old = read_phy_reg(pi, 0x938); +- rfoverride4val_old = read_phy_reg(pi, 0x939); +- afectrlovr_old = read_phy_reg(pi, 0x43b); +- afectrlovrval_old = read_phy_reg(pi, 0x43c); +- old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); +- old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); +- +- tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); +- if (tx_gain_override_old) { +- wlc_lcnphy_get_tx_gain(pi, &old_gains); +- tx_gain_index_old = pi_lcn->lcnphy_current_index; +- } ++ if (module == 1) { + +- wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); +- +- mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); +- mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); +- +- mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); +- mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); ++ tx_pwr_ctrl = wlc_lcnphy_get_tx_pwr_ctrl(pi); ++ wlc_lcnphy_set_tx_pwr_ctrl(pi, LCNPHY_TX_PWR_CTRL_OFF); + +- write_radio_reg(pi, RADIO_2064_REG116, 0x06); +- write_radio_reg(pi, RADIO_2064_REG12C, 0x07); +- write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); +- write_radio_reg(pi, RADIO_2064_REG098, 0x03); +- write_radio_reg(pi, RADIO_2064_REG00B, 0x7); +- mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); +- write_radio_reg(pi, RADIO_2064_REG01D, 0x01); +- write_radio_reg(pi, RADIO_2064_REG114, 0x01); +- write_radio_reg(pi, RADIO_2064_REG02E, 0x10); +- write_radio_reg(pi, RADIO_2064_REG12A, 0x08); +- +- mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); +- mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); +- mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); +- mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); +- mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); +- mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); +- mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); +- mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); +- mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); +- mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); ++ for (i = 0; i < 11; i++) ++ values_to_save[i] = ++ read_radio_reg(pi, rxiq_cal_rf_reg[i]); ++ Core1TxControl_old = read_phy_reg(pi, 0x631); ++ ++ or_phy_reg(pi, 0x631, 0x0015); ++ ++ RFOverride0_old = read_phy_reg(pi, 0x44c); ++ RFOverrideVal0_old = read_phy_reg(pi, 0x44d); ++ rfoverride2_old = read_phy_reg(pi, 0x4b0); ++ rfoverride2val_old = read_phy_reg(pi, 0x4b1); ++ rfoverride3_old = read_phy_reg(pi, 0x4f9); ++ rfoverride3val_old = read_phy_reg(pi, 0x4fa); ++ rfoverride4_old = read_phy_reg(pi, 0x938); ++ rfoverride4val_old = read_phy_reg(pi, 0x939); ++ afectrlovr_old = read_phy_reg(pi, 0x43b); ++ afectrlovrval_old = read_phy_reg(pi, 0x43c); ++ old_sslpnCalibClkEnCtrl = read_phy_reg(pi, 0x6da); ++ old_sslpnRxFeClkEnCtrl = read_phy_reg(pi, 0x6db); ++ ++ tx_gain_override_old = wlc_lcnphy_tx_gain_override_enabled(pi); ++ if (tx_gain_override_old) { ++ wlc_lcnphy_get_tx_gain(pi, &old_gains); ++ tx_gain_index_old = pi_lcn->lcnphy_current_index; ++ } + +- mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); +- mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); ++ wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_idx); + +- write_phy_reg(pi, 0x6da, 0xffff); +- or_phy_reg(pi, 0x6db, 0x3); ++ mod_phy_reg(pi, 0x4f9, (0x1 << 0), 1 << 0); ++ mod_phy_reg(pi, 0x4fa, (0x1 << 0), 0 << 0); + +- wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); +- set_gain = false; ++ mod_phy_reg(pi, 0x43b, (0x1 << 1), 1 << 1); ++ mod_phy_reg(pi, 0x43c, (0x1 << 1), 0 << 1); + +- lna2_gain = 3; +- while ((lna2_gain >= 0) && !set_gain) { +- tia_gain = 4; +- +- while ((tia_gain >= 0) && !set_gain) { +- biq1_gain = 6; +- +- while ((biq1_gain >= 0) && !set_gain) { +- set_gain = wlc_lcnphy_rx_iq_cal_gain(pi, +- (u16) +- biq1_gain, +- (u16) +- tia_gain, +- (u16) +- lna2_gain); +- biq1_gain -= 1; +- } ++ write_radio_reg(pi, RADIO_2064_REG116, 0x06); ++ write_radio_reg(pi, RADIO_2064_REG12C, 0x07); ++ write_radio_reg(pi, RADIO_2064_REG06A, 0xd3); ++ write_radio_reg(pi, RADIO_2064_REG098, 0x03); ++ write_radio_reg(pi, RADIO_2064_REG00B, 0x7); ++ mod_radio_reg(pi, RADIO_2064_REG113, 1 << 4, 1 << 4); ++ write_radio_reg(pi, RADIO_2064_REG01D, 0x01); ++ write_radio_reg(pi, RADIO_2064_REG114, 0x01); ++ write_radio_reg(pi, RADIO_2064_REG02E, 0x10); ++ write_radio_reg(pi, RADIO_2064_REG12A, 0x08); ++ ++ mod_phy_reg(pi, 0x938, (0x1 << 0), 1 << 0); ++ mod_phy_reg(pi, 0x939, (0x1 << 0), 0 << 0); ++ mod_phy_reg(pi, 0x938, (0x1 << 1), 1 << 1); ++ mod_phy_reg(pi, 0x939, (0x1 << 1), 1 << 1); ++ mod_phy_reg(pi, 0x938, (0x1 << 2), 1 << 2); ++ mod_phy_reg(pi, 0x939, (0x1 << 2), 1 << 2); ++ mod_phy_reg(pi, 0x938, (0x1 << 3), 1 << 3); ++ mod_phy_reg(pi, 0x939, (0x1 << 3), 1 << 3); ++ mod_phy_reg(pi, 0x938, (0x1 << 5), 1 << 5); ++ mod_phy_reg(pi, 0x939, (0x1 << 5), 0 << 5); ++ ++ mod_phy_reg(pi, 0x43b, (0x1 << 0), 1 << 0); ++ mod_phy_reg(pi, 0x43c, (0x1 << 0), 0 << 0); ++ ++ wlc_lcnphy_start_tx_tone(pi, 2000, 120, 0); ++ write_phy_reg(pi, 0x6da, 0xffff); ++ or_phy_reg(pi, 0x6db, 0x3); ++ wlc_lcnphy_set_trsw_override(pi, tx_switch, rx_switch); ++ wlc_lcnphy_rx_gain_override_enable(pi, true); ++ ++ tia_gain = 8; ++ rx_pwr_threshold = 950; ++ while (tia_gain > 0) { + tia_gain -= 1; ++ wlc_lcnphy_set_rx_gain_by_distribution(pi, ++ 0, 0, 2, 2, ++ (u16) ++ tia_gain, 1, 0); ++ udelay(500); ++ ++ received_power = ++ wlc_lcnphy_measure_digital_power(pi, 2000); ++ if (received_power < rx_pwr_threshold) ++ break; + } +- lna2_gain -= 1; +- } +- +- if (set_gain) +- result = wlc_lcnphy_calc_rx_iq_comp(pi, 1024); +- else +- result = false; +- +- wlc_lcnphy_stop_tx_tone(pi); +- +- write_phy_reg(pi, 0x631, Core1TxControl_old); +- +- write_phy_reg(pi, 0x44c, RFOverrideVal0_old); +- write_phy_reg(pi, 0x44d, RFOverrideVal0_old); +- write_phy_reg(pi, 0x4b0, rfoverride2_old); +- write_phy_reg(pi, 0x4b1, rfoverride2val_old); +- write_phy_reg(pi, 0x4f9, rfoverride3_old); +- write_phy_reg(pi, 0x4fa, rfoverride3val_old); +- write_phy_reg(pi, 0x938, rfoverride4_old); +- write_phy_reg(pi, 0x939, rfoverride4val_old); +- write_phy_reg(pi, 0x43b, afectrlovr_old); +- write_phy_reg(pi, 0x43c, afectrlovrval_old); +- write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); +- write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); ++ result = wlc_lcnphy_calc_rx_iq_comp(pi, 0xffff); + +- wlc_lcnphy_clear_trsw_override(pi); ++ wlc_lcnphy_stop_tx_tone(pi); + +- mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); ++ write_phy_reg(pi, 0x631, Core1TxControl_old); + +- for (i = 0; i < 11; i++) +- write_radio_reg(pi, rxiq_cal_rf_reg[i], +- values_to_save[i]); ++ write_phy_reg(pi, 0x44c, RFOverrideVal0_old); ++ write_phy_reg(pi, 0x44d, RFOverrideVal0_old); ++ write_phy_reg(pi, 0x4b0, rfoverride2_old); ++ write_phy_reg(pi, 0x4b1, rfoverride2val_old); ++ write_phy_reg(pi, 0x4f9, rfoverride3_old); ++ write_phy_reg(pi, 0x4fa, rfoverride3val_old); ++ write_phy_reg(pi, 0x938, rfoverride4_old); ++ write_phy_reg(pi, 0x939, rfoverride4val_old); ++ write_phy_reg(pi, 0x43b, afectrlovr_old); ++ write_phy_reg(pi, 0x43c, afectrlovrval_old); ++ write_phy_reg(pi, 0x6da, old_sslpnCalibClkEnCtrl); ++ write_phy_reg(pi, 0x6db, old_sslpnRxFeClkEnCtrl); ++ ++ wlc_lcnphy_clear_trsw_override(pi); ++ ++ mod_phy_reg(pi, 0x44c, (0x1 << 2), 0 << 2); ++ ++ for (i = 0; i < 11; i++) ++ write_radio_reg(pi, rxiq_cal_rf_reg[i], ++ values_to_save[i]); + +- if (tx_gain_override_old) +- wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); +- else +- wlc_lcnphy_disable_tx_gain_override(pi); ++ if (tx_gain_override_old) ++ wlc_lcnphy_set_tx_pwr_by_index(pi, tx_gain_index_old); ++ else ++ wlc_lcnphy_disable_tx_gain_override(pi); + +- wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); +- wlc_lcnphy_rx_gain_override_enable(pi, false); ++ wlc_lcnphy_set_tx_pwr_ctrl(pi, tx_pwr_ctrl); ++ wlc_lcnphy_rx_gain_override_enable(pi, false); ++ } + + cal_done: + kfree(ptr); +@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313( + write_radio_reg(pi, RADIO_2064_REG038, 3); + write_radio_reg(pi, RADIO_2064_REG091, 7); + } +- +- if (!(pi->sh->boardflags & BFL_FEM)) { +- u8 reg038[14] = {0xd, 0xe, 0xd, 0xd, 0xd, 0xc, +- 0xa, 0xb, 0xb, 0x3, 0x3, 0x2, 0x0, 0x0}; +- +- write_radio_reg(pi, RADIO_2064_REG02A, 0xf); +- write_radio_reg(pi, RADIO_2064_REG091, 0x3); +- write_radio_reg(pi, RADIO_2064_REG038, 0x3); +- +- write_radio_reg(pi, RADIO_2064_REG038, reg038[channel - 1]); +- } + } + + static int +@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy + } else { + mod_radio_reg(pi, RADIO_2064_REG03A, 1, 0x1); + mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); +- mod_radio_reg(pi, RADIO_2064_REG028, 0x1, 0x0); +- mod_radio_reg(pi, RADIO_2064_REG11A, 0x4, 1<<2); +- mod_radio_reg(pi, RADIO_2064_REG036, 0x10, 0x0); +- mod_radio_reg(pi, RADIO_2064_REG11A, 0x10, 1<<4); +- mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); +- mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x77); +- mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, 0xe<<1); +- mod_radio_reg(pi, RADIO_2064_REG112, 0x80, 1<<7); +- mod_radio_reg(pi, RADIO_2064_REG005, 0x7, 1<<1); +- mod_radio_reg(pi, RADIO_2064_REG029, 0xf0, 0<<4); + } + } else { + mod_phy_reg(pi, 0x4d9, (0x1 << 2), (0x1) << 2); +@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparam + (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12)); + + mod_radio_reg(pi, RADIO_2064_REG082, (1 << 5), (1 << 5)); +- mod_radio_reg(pi, RADIO_2064_REG07C, (1 << 0), (1 << 0)); + } + + static void wlc_lcnphy_tssi_setup(struct brcms_phy *pi) + { + struct phytbl_info tab; + u32 rfseq, ind; +- u8 tssi_sel; + + tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; + tab.tbl_width = 32; +@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(struct + + mod_phy_reg(pi, 0x503, (0x1 << 4), (1) << 4); + +- if (pi->sh->boardflags & BFL_FEM) { +- tssi_sel = 0x1; +- wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); +- } else { +- tssi_sel = 0xe; +- wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_POST_PA); +- } ++ wlc_lcnphy_set_tssi_mux(pi, LCNPHY_TSSI_EXT); + mod_phy_reg(pi, 0x4a4, (0x1 << 14), (0) << 14); + + mod_phy_reg(pi, 0x4a4, (0x1 << 15), (1) << 15); +@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(struct + mod_phy_reg(pi, 0x49a, (0x1ff << 0), (0xff) << 0); + + if (LCNREV_IS(pi->pubpi.phy_rev, 2)) { +- mod_radio_reg(pi, RADIO_2064_REG028, 0xf, tssi_sel); ++ mod_radio_reg(pi, RADIO_2064_REG028, 0xf, 0xe); + mod_radio_reg(pi, RADIO_2064_REG086, 0x4, 0x4); + } else { +- mod_radio_reg(pi, RADIO_2064_REG028, 0x1e, tssi_sel << 1); + mod_radio_reg(pi, RADIO_2064_REG03A, 0x1, 1); + mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 1 << 3); + } +@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(struct + + mod_phy_reg(pi, 0x4d7, (0xf << 8), (0) << 8); + +- mod_radio_reg(pi, RADIO_2064_REG035, 0xff, 0x0); +- mod_radio_reg(pi, RADIO_2064_REG036, 0x3, 0x0); +- mod_radio_reg(pi, RADIO_2064_REG11A, 0x8, 0x8); +- + wlc_lcnphy_pwrctrl_rssiparams(pi); + } + +@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(str + read_radio_reg(pi, RADIO_2064_REG007) & 1; + u16 SAVE_jtag_auxpga = read_radio_reg(pi, RADIO_2064_REG0FF) & 0x10; + u16 SAVE_iqadc_aux_en = read_radio_reg(pi, RADIO_2064_REG11F) & 4; +- u8 SAVE_bbmult = wlc_lcnphy_get_bbmult(pi); +- + idleTssi = read_phy_reg(pi, 0x4ab); + suspend = (0 == (bcma_read32(pi->d11core, D11REGOFFS(maccontrol)) & + MCTL_EN_MAC)); +@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(str + mod_radio_reg(pi, RADIO_2064_REG0FF, 0x10, 1 << 4); + mod_radio_reg(pi, RADIO_2064_REG11F, 0x4, 1 << 2); + wlc_lcnphy_tssi_setup(pi); +- +- mod_phy_reg(pi, 0x4d7, (0x1 << 0), (1 << 0)); +- mod_phy_reg(pi, 0x4d7, (0x1 << 6), (1 << 6)); +- +- wlc_lcnphy_set_bbmult(pi, 0x0); +- + wlc_phy_do_dummy_tx(pi, true, OFF); + idleTssi = ((read_phy_reg(pi, 0x4ab) & (0x1ff << 0)) + >> 0); +@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(str + + mod_phy_reg(pi, 0x44c, (0x1 << 12), (0) << 12); + +- wlc_lcnphy_set_bbmult(pi, SAVE_bbmult); + wlc_lcnphy_set_tx_gain_override(pi, tx_gain_override_old); + wlc_lcnphy_set_tx_gain(pi, &old_gains); + wlc_lcnphy_set_tx_pwr_ctrl(pi, SAVE_txpwrctrl); +@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init( + wlc_lcnphy_write_table(pi, &tab); + tab.tbl_offset++; + } +- mod_phy_reg(pi, 0x4d0, (0x1 << 0), (0) << 0); +- mod_phy_reg(pi, 0x4d3, (0xff << 0), (0) << 0); +- mod_phy_reg(pi, 0x4d3, (0xff << 8), (0) << 8); +- mod_phy_reg(pi, 0x4d0, (0x1 << 4), (0) << 4); +- mod_phy_reg(pi, 0x4d0, (0x1 << 2), (0) << 2); + + mod_phy_reg(pi, 0x410, (0x1 << 7), (0) << 7); + +@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal + target_gains.pad_gain = 21; + target_gains.dac_gain = 0; + wlc_lcnphy_set_tx_gain(pi, &target_gains); ++ wlc_lcnphy_set_tx_pwr_by_index(pi, 16); + + if (LCNREV_IS(pi->pubpi.phy_rev, 1) || pi_lcn->lcnphy_hw_iqcal_en) { + +@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal + lcnphy_recal ? LCNPHY_CAL_RECAL : + LCNPHY_CAL_FULL), false); + } else { +- wlc_lcnphy_set_tx_pwr_by_index(pi, 16); + wlc_lcnphy_tx_iqlo_soft_cal_full(pi); + } + +@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brc + if (CHSPEC_IS5G(pi->radio_chanspec)) + pa_gain = 0x70; + else +- pa_gain = 0x60; ++ pa_gain = 0x70; + + if (pi->sh->boardflags & BFL_FEM) + pa_gain = 0x10; +- + tab.tbl_id = LCNPHY_TBL_ID_TXPWRCTL; + tab.tbl_width = 32; + tab.tbl_len = 1; + tab.tbl_ptr = &val; + + for (j = 0; j < 128; j++) { +- if (pi->sh->boardflags & BFL_FEM) +- gm_gain = gain_table[j].gm; +- else +- gm_gain = 15; +- ++ gm_gain = gain_table[j].gm; + val = (((u32) pa_gain << 24) | + (gain_table[j].pad << 16) | + (gain_table[j].pga << 8) | gm_gain); +@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct b + + write_phy_reg(pi, 0x4ea, 0x4688); + +- if (pi->sh->boardflags & BFL_FEM) +- mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); +- else +- mod_phy_reg(pi, 0x4eb, (0x7 << 0), 3 << 0); ++ mod_phy_reg(pi, 0x4eb, (0x7 << 0), 2 << 0); + + mod_phy_reg(pi, 0x4eb, (0x7 << 6), 0 << 6); + +@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct b + wlc_lcnphy_rcal(pi); + + wlc_lcnphy_rc_cal(pi); +- +- if (!(pi->sh->boardflags & BFL_FEM)) { +- write_radio_reg(pi, RADIO_2064_REG032, 0x6f); +- write_radio_reg(pi, RADIO_2064_REG033, 0x19); +- write_radio_reg(pi, RADIO_2064_REG039, 0xe); +- } +- + } + + static void wlc_lcnphy_radio_init(struct brcms_phy *pi) +@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct b + wlc_lcnphy_write_table(pi, &tab); + } + +- if (!(pi->sh->boardflags & BFL_FEM)) { +- tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; +- tab.tbl_width = 16; +- tab.tbl_ptr = &val; +- tab.tbl_len = 1; ++ tab.tbl_id = LCNPHY_TBL_ID_RFSEQ; ++ tab.tbl_width = 16; ++ tab.tbl_ptr = &val; ++ tab.tbl_len = 1; + +- val = 150; +- tab.tbl_offset = 0; +- wlc_lcnphy_write_table(pi, &tab); ++ val = 114; ++ tab.tbl_offset = 0; ++ wlc_lcnphy_write_table(pi, &tab); + +- val = 220; +- tab.tbl_offset = 1; +- wlc_lcnphy_write_table(pi, &tab); +- } ++ val = 130; ++ tab.tbl_offset = 1; ++ wlc_lcnphy_write_table(pi, &tab); ++ ++ val = 6; ++ tab.tbl_offset = 8; ++ wlc_lcnphy_write_table(pi, &tab); + + if (CHSPEC_IS2G(pi->radio_chanspec)) { + if (pi->sh->boardflags & BFL_FEM) +@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(struct + wlc_lcnphy_load_tx_iir_filter(pi, true, 3); + + mod_phy_reg(pi, 0x4eb, (0x7 << 3), (1) << 3); +- wlc_lcnphy_tssi_setup(pi); + } + + void wlc_phy_detach_lcnphy(struct brcms_phy *pi) +@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_ + if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) + return false; + +- if (LCNREV_IS(pi->pubpi.phy_rev, 1)) { ++ if ((pi->sh->boardflags & BFL_FEM) && ++ (LCNREV_IS(pi->pubpi.phy_rev, 1))) { + if (pi_lcn->lcnphy_tempsense_option == 3) { + pi->hwpwrctrl = true; + pi->hwpwrctrl_capable = true; +--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c ++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +@@ -1992,70 +1992,70 @@ static const u16 dot11lcn_sw_ctrl_tbl_43 + }; + + static const u16 dot11lcn_sw_ctrl_tbl_4313_rev0[] = { +- 0x0009, + 0x000a, +- 0x0005, +- 0x0006, + 0x0009, +- 0x000a, +- 0x0005, + 0x0006, +- 0x0009, +- 0x000a, + 0x0005, +- 0x0006, +- 0x0009, + 0x000a, +- 0x0005, +- 0x0006, + 0x0009, +- 0x000a, +- 0x0005, + 0x0006, +- 0x0009, +- 0x000a, + 0x0005, +- 0x0006, +- 0x0009, + 0x000a, +- 0x0005, +- 0x0006, + 0x0009, +- 0x000a, +- 0x0005, + 0x0006, +- 0x0009, +- 0x000a, + 0x0005, +- 0x0006, +- 0x0009, + 0x000a, +- 0x0005, +- 0x0006, + 0x0009, +- 0x000a, +- 0x0005, + 0x0006, +- 0x0009, +- 0x000a, + 0x0005, +- 0x0006, ++ 0x000a, + 0x0009, ++ 0x0006, ++ 0x0005, + 0x000a, ++ 0x0009, ++ 0x0006, + 0x0005, ++ 0x000a, ++ 0x0009, + 0x0006, ++ 0x0005, ++ 0x000a, + 0x0009, ++ 0x0006, ++ 0x0005, + 0x000a, ++ 0x0009, ++ 0x0006, + 0x0005, ++ 0x000a, ++ 0x0009, + 0x0006, ++ 0x0005, ++ 0x000a, + 0x0009, ++ 0x0006, ++ 0x0005, + 0x000a, ++ 0x0009, ++ 0x0006, + 0x0005, ++ 0x000a, ++ 0x0009, + 0x0006, ++ 0x0005, ++ 0x000a, + 0x0009, ++ 0x0006, ++ 0x0005, + 0x000a, ++ 0x0009, ++ 0x0006, + 0x0005, ++ 0x000a, ++ 0x0009, + 0x0006, ++ 0x0005, + }; + + static const u16 dot11lcn_sw_ctrl_tbl_rev0[] = { diff --git a/queue-3.8/series b/queue-3.8/series index b51adad3dde..92756581cd7 100644 --- a/queue-3.8/series +++ b/queue-3.8/series @@ -1 +1,13 @@ alsa-usb-audio-fix-endianness-bug-in-snd_nativeinstruments_.patch +asoc-core-fix-to-check-return-value-of-snd_soc_update_bits_locked.patch +asoc-wm5102-correct-lookup-of-arizona-struct-in-sysclk-event.patch +asoc-wm8903-fix-the-bypass-to-hp-lineout-when-no-dac-or-adc-is-running.patch +tracing-fix-double-free-when-function-profile-init-failed.patch +arm-kirkwood-fix-typo-in-the-definition-of-ix2-200-rebuild-led.patch +arm-imx35-bugfix-admux-clock.patch +dmaengine-omap-dma-start-dma-without-delay-for-cyclic-channels.patch +pm-reboot-call-syscore_shutdown-after-disable_nonboot_cpus.patch +revert-brcmsmac-support-4313ipa.patch +ipc-set-msg-back-to-eagain-if-copy-wasn-t-performed.patch +gfs2-fix-unlock-of-fcntl-locks-during-withdrawn-state.patch +gfs2-return-error-if-malloc-failed-in-gfs2_rs_alloc.patch diff --git a/queue-3.8/tracing-fix-double-free-when-function-profile-init-failed.patch b/queue-3.8/tracing-fix-double-free-when-function-profile-init-failed.patch new file mode 100644 index 00000000000..792c8889252 --- /dev/null +++ b/queue-3.8/tracing-fix-double-free-when-function-profile-init-failed.patch @@ -0,0 +1,34 @@ +From 83e03b3fe4daffdebbb42151d5410d730ae50bd1 Mon Sep 17 00:00:00 2001 +From: Namhyung Kim +Date: Mon, 1 Apr 2013 21:46:23 +0900 +Subject: tracing: Fix double free when function profile init failed + +From: Namhyung Kim + +commit 83e03b3fe4daffdebbb42151d5410d730ae50bd1 upstream. + +On the failure path, stat->start and stat->pages will refer same page. +So it'll attempt to free the same page again and get kernel panic. + +Link: http://lkml.kernel.org/r/1364820385-32027-1-git-send-email-namhyung@kernel.org + +Signed-off-by: Namhyung Kim +Cc: Frederic Weisbecker +Cc: Namhyung Kim +Signed-off-by: Steven Rostedt +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/trace/ftrace.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/kernel/trace/ftrace.c ++++ b/kernel/trace/ftrace.c +@@ -668,7 +668,6 @@ int ftrace_profile_pages_init(struct ftr + free_page(tmp); + } + +- free_page((unsigned long)stat->pages); + stat->pages = NULL; + stat->start = NULL; + -- 2.47.3