--- /dev/null
+From 7c4e9ced424be4d36df6a3e3825763e97ee97607 Mon Sep 17 00:00:00 2001
+From: Joonsoo Kim <js1304@gmail.com>
+Date: Sat, 9 Feb 2013 05:52:45 +0100
+Subject: ARM: 7643/1: sched: correct update_sched_clock()
+
+From: Joonsoo Kim <js1304@gmail.com>
+
+commit 7c4e9ced424be4d36df6a3e3825763e97ee97607 upstream.
+
+If we want load epoch_cyc and epoch_ns atomically,
+we should update epoch_cyc_copy first of all.
+This notify reader that updating is in progress.
+
+If we update epoch_cyc first like as current implementation,
+there is subtle error case.
+Look at the below example.
+
+<Initial Condition>
+cyc = 9
+ns = 900
+cyc_copy = 9
+
+== CASE 1 ==
+<CPU A = reader> <CPU B = updater>
+ write cyc = 10
+read cyc = 10
+read ns = 900
+ write ns = 1000
+ write cyc_copy = 10
+read cyc_copy = 10
+
+output = (10, 900)
+
+== CASE 2 ==
+<CPU A = reader> <CPU B = updater>
+read cyc = 9
+ write cyc = 10
+ write ns = 1000
+read ns = 1000
+read cyc_copy = 9
+ write cyc_copy = 10
+output = (9, 1000)
+
+If atomic read is ensured, output should be (9, 900) or (10, 1000).
+But, output in example case are not.
+
+So, change updating sequence in order to correct this problem.
+
+Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kernel/sched_clock.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/kernel/sched_clock.c
++++ b/arch/arm/kernel/sched_clock.c
+@@ -93,11 +93,11 @@ static void notrace update_sched_clock(v
+ * detectable in cyc_to_fixed_sched_clock().
+ */
+ raw_local_irq_save(flags);
+- cd.epoch_cyc = cyc;
++ cd.epoch_cyc_copy = cyc;
+ smp_wmb();
+ cd.epoch_ns = ns;
+ smp_wmb();
+- cd.epoch_cyc_copy = cyc;
++ cd.epoch_cyc = cyc;
+ raw_local_irq_restore(flags);
+ }
+
--- /dev/null
+From c3f0f282d950a1e87496a2633ed9e924e275ff8c Mon Sep 17 00:00:00 2001
+From: Nicolas Ferre <nicolas.ferre@atmel.com>
+Date: Wed, 30 Jan 2013 15:32:26 +0100
+Subject: ARM: at91/DT: remove atmel,use-dma-* from 9x5 and 9n12 USART nodes
+
+From: Nicolas Ferre <nicolas.ferre@atmel.com>
+
+commit c3f0f282d950a1e87496a2633ed9e924e275ff8c upstream.
+
+Fix the use of USART on both at91sam9x5 and at91sam9n12. In DTS, the
+atmel,use-dma-[rx|tx] property is present but a DMA channel cannot be used.
+Indeed the connexion between the DMA engine and the slave is not implemented
+yet in Device Tree.
+Note however that this property is also used for PDC (private DMA) on older
+SoCs. This is why the driver alone cannot determine the validity of this
+property.
+
+Reported-by: Douglas Gilbert <dgilbert@interlog.com>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/at91sam9n12.dtsi | 8 --------
+ arch/arm/boot/dts/at91sam9x5.dtsi | 6 ------
+ 2 files changed, 14 deletions(-)
+
+--- a/arch/arm/boot/dts/at91sam9n12.dtsi
++++ b/arch/arm/boot/dts/at91sam9n12.dtsi
+@@ -324,8 +324,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf801c000 0x4000>;
+ interrupts = <5 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart0>;
+ status = "disabled";
+@@ -335,8 +333,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf8020000 0x4000>;
+ interrupts = <6 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart1>;
+ status = "disabled";
+@@ -346,8 +342,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf8024000 0x4000>;
+ interrupts = <7 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart2>;
+ status = "disabled";
+@@ -357,8 +351,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf8028000 0x4000>;
+ interrupts = <8 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart3>;
+ status = "disabled";
+--- a/arch/arm/boot/dts/at91sam9x5.dtsi
++++ b/arch/arm/boot/dts/at91sam9x5.dtsi
+@@ -402,8 +402,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf801c000 0x200>;
+ interrupts = <5 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart0>;
+ status = "disabled";
+@@ -413,8 +411,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf8020000 0x200>;
+ interrupts = <6 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart1>;
+ status = "disabled";
+@@ -424,8 +420,6 @@
+ compatible = "atmel,at91sam9260-usart";
+ reg = <0xf8024000 0x200>;
+ interrupts = <7 4 5>;
+- atmel,use-dma-rx;
+- atmel,use-dma-tx;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_usart2>;
+ status = "disabled";
--- /dev/null
+From 4b526ca5f627188425184a22ed46c91baa602d43 Mon Sep 17 00:00:00 2001
+From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
+Date: Wed, 30 Jan 2013 14:16:00 +0100
+Subject: ARM: i.MX25: clk: parent per5_clk to AHB clock
+
+From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
+
+commit 4b526ca5f627188425184a22ed46c91baa602d43 upstream.
+
+The mxc-timer on the imx25 needs to be derived from the AHB clock.
+If a bootloader reparents this clock to the ipg_clk_highfreq, which according
+to the datasheet is a valid operation, the system can/will produce lockups/
+freezes after some time [1].
+
+This can be forced with code like
+ while(1)
+ syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp);
+
+This was already fixed with the commit
+ "i.MX25 GPT clock fix: ensure correct the clock source" [2],
+for 3.1-rc2, but was lost, when i.MX was converted to the common clock framework
+("ARM i.MX25: implement clocks using common clock framework") [3]
+
+[1]: http://lists.arm.linux.org.uk/lurker/message/20130129.161230.229bda17.en.html
+[2]: 2012d9ca2a1381ae3e733330a7f0d1d2f1988bba
+[3]: 6bbaec5676e4f475b0d78743cbd4c70a8804ce14
+
+Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
+Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-imx/clk-imx25.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/arch/arm/mach-imx/clk-imx25.c
++++ b/arch/arm/mach-imx/clk-imx25.c
+@@ -224,6 +224,9 @@ static int __init __mx25_clocks_init(uns
+
+ clk_prepare_enable(clk[emi_ahb]);
+
++ /* Clock source for gpt must be derived from AHB */
++ clk_set_parent(clk[per5_sel], clk[ahb]);
++
+ clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
+ clk_register_clkdev(clk[gpt_ipg_per], "per", "imx-gpt.0");
+
--- /dev/null
+From ab2a724a2ef9cee5957692257a5d1f08fd7acbbd Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Wed, 6 Feb 2013 18:25:12 +0000
+Subject: ARM: integrator: ensure ap_syscon_base is initialised when !CONFIG_MMU
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit ab2a724a2ef9cee5957692257a5d1f08fd7acbbd upstream.
+
+When running on Integrator/AP using atags, ap_syscon_base is initialised
+in ->map_io, which isn't called for !MMU platforms.
+
+Instead, initialise the pointer in ->machine_init, as we do when booting
+with device-tree.
+
+Acked-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Olof Johansson <olof@lixom.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-integrator/integrator_ap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/mach-integrator/integrator_ap.c
++++ b/arch/arm/mach-integrator/integrator_ap.c
+@@ -613,7 +613,6 @@ static struct map_desc ap_io_desc_atag[]
+ static void __init ap_map_io_atag(void)
+ {
+ iotable_init(ap_io_desc_atag, ARRAY_SIZE(ap_io_desc_atag));
+- ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
+ ap_map_io();
+ }
+
+@@ -685,6 +684,7 @@ static void __init ap_init(void)
+
+ platform_device_register(&cfi_flash_device);
+
++ ap_syscon_base = __io_address(INTEGRATOR_SC_BASE);
+ sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET);
+ for (i = 0; i < 4; i++) {
+ struct lm_device *lmdev;
--- /dev/null
+From d107a204154ddd79339203c2deeb7433f0cf6777 Mon Sep 17 00:00:00 2001
+From: Igor Grinberg <grinberg@compulab.co.il>
+Date: Sun, 13 Jan 2013 13:49:47 +0200
+Subject: ARM: PXA3xx: program the CSMSADRCFG register
+
+From: Igor Grinberg <grinberg@compulab.co.il>
+
+commit d107a204154ddd79339203c2deeb7433f0cf6777 upstream.
+
+The Chip Select Configuration Register must be programmed to 0x2 in
+order to achieve the correct behavior of the Static Memory Controller.
+
+Without this patch devices wired to DFI and accessed through SMC cannot
+be accessed after resume from S2.
+
+Do not rely on the boot loader to program the CSMSADRCFG register by
+programming it in the kernel smemc module.
+
+Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
+Acked-by: Eric Miao <eric.y.miao@gmail.com>
+Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-pxa/include/mach/smemc.h | 1 +
+ arch/arm/mach-pxa/smemc.c | 15 ++++++++++++++-
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/mach-pxa/include/mach/smemc.h
++++ b/arch/arm/mach-pxa/include/mach/smemc.h
+@@ -37,6 +37,7 @@
+ #define CSADRCFG1 (SMEMC_VIRT + 0x84) /* Address Configuration Register for CS1 */
+ #define CSADRCFG2 (SMEMC_VIRT + 0x88) /* Address Configuration Register for CS2 */
+ #define CSADRCFG3 (SMEMC_VIRT + 0x8C) /* Address Configuration Register for CS3 */
++#define CSMSADRCFG (SMEMC_VIRT + 0xA0) /* Chip Select Configuration Register */
+
+ /*
+ * More handy macros for PCMCIA
+--- a/arch/arm/mach-pxa/smemc.c
++++ b/arch/arm/mach-pxa/smemc.c
+@@ -40,6 +40,8 @@ static void pxa3xx_smemc_resume(void)
+ __raw_writel(csadrcfg[1], CSADRCFG1);
+ __raw_writel(csadrcfg[2], CSADRCFG2);
+ __raw_writel(csadrcfg[3], CSADRCFG3);
++ /* CSMSADRCFG wakes up in its default state (0), so we need to set it */
++ __raw_writel(0x2, CSMSADRCFG);
+ }
+
+ static struct syscore_ops smemc_syscore_ops = {
+@@ -49,8 +51,19 @@ static struct syscore_ops smemc_syscore_
+
+ static int __init smemc_init(void)
+ {
+- if (cpu_is_pxa3xx())
++ if (cpu_is_pxa3xx()) {
++ /*
++ * The only documentation we have on the
++ * Chip Select Configuration Register (CSMSADRCFG) is that
++ * it must be programmed to 0x2.
++ * Moreover, in the bit definitions, the second bit
++ * (CSMSADRCFG[1]) is called "SETALWAYS".
++ * Other bits are reserved in this register.
++ */
++ __raw_writel(0x2, CSMSADRCFG);
++
+ register_syscore_ops(&smemc_syscore_ops);
++ }
+
+ return 0;
+ }
--- /dev/null
+From 2815774bb38445006074e16251b9ef5123bdc616 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Tue, 8 Jan 2013 21:58:31 +0000
+Subject: ARM: samsung: fix assembly syntax for new gas
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 2815774bb38445006074e16251b9ef5123bdc616 upstream.
+
+Recent assembler versions complain about extraneous
+whitespace inside [] brackets. This fixes all of
+these instances for the samsung platforms. We should
+backport this to all kernels that might need to
+be built with new binutils.
+
+arch/arm/kernel/entry-armv.S: Assembler messages:
+arch/arm/kernel/entry-armv.S:214: Error: ARM register expected -- `ldr r2,[ r6,#(0x10)]'
+arch/arm/kernel/entry-armv.S:214: Error: ARM register expected -- `ldr r0,[ r6,#(0x14)]'
+arch/arm/kernel/entry-armv.S:430: Error: ARM register expected -- `ldr r2,[ r6,#(0x10)]'
+arch/arm/kernel/entry-armv.S:430: Error: ARM register expected -- `ldr r0,[ r6,#(0x14)]'
+arch/arm/mach-s3c24xx/sleep-s3c2410.S: Assembler messages:
+arch/arm/mach-s3c24xx/sleep-s3c2410.S:48: Error: ARM register expected -- `ldr r7,[ r4 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2410.S:49: Error: ARM register expected -- `ldr r8,[ r5 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2410.S:50: Error: ARM register expected -- `ldr r9,[ r6 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2410.S:64: Error: ARM register expected -- `streq r7,[ r4 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2410.S:65: Error: ARM register expected -- `streq r8,[ r5 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2410.S:66: Error: ARM register expected -- `streq r9,[ r6 ]'
+arch/arm/kernel/debug.S: Assembler messages:
+arch/arm/kernel/debug.S:83: Error: ARM register expected -- `ldr r2,[ r2,#((0x0B0)+(((0x56000000)-(0x50000000))+(0xF6000000+(0x01000000))))-((0)+(((0x56000000)-(0x50000000))+(0xF6000000+(0x01000000))))]'
+arch/arm/kernel/debug.S:83: Error: ARM register expected -- `ldr r2,[ r3,#(0x18)]'
+arch/arm/kernel/debug.S:85: Error: ARM register expected -- `ldr r2,[ r2,#((0x0B0)+(((0x56000000)-(0x50000000))+(0xF6000000+(0x01000000))))-((0)+(((0x56000000)-(0x50000000))+(0xF6000000+(0x01000000))))]'
+arch/arm/kernel/debug.S:85: Error: ARM register expected -- `ldr r2,[ r3,#(0x18)]'
+arch/arm/mach-s3c24xx/pm-h1940.S: Assembler messages:
+arch/arm/mach-s3c24xx/pm-h1940.S:33: Error: ARM register expected -- `ldr pc,[ r0,#((0x0B8)+(((0x56000000)-(0x50000000))+(0xF6000000+(0x01000000))))-(((0x56000000)-(0x50000000))+(0xF6000000+(0x01000000)))]'
+arch/arm/mach-s3c24xx/sleep-s3c2412.S: Assembler messages:
+arch/arm/mach-s3c24xx/sleep-s3c2412.S:60: Error: ARM register expected -- `ldrne r9,[ r1 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2412.S:61: Error: ARM register expected -- `strne r9,[ r1 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2412.S:62: Error: ARM register expected -- `ldrne r9,[ r2 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2412.S:63: Error: ARM register expected -- `strne r9,[ r2 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2412.S:64: Error: ARM register expected -- `ldrne r9,[ r3 ]'
+arch/arm/mach-s3c24xx/sleep-s3c2412.S:65: Error: ARM register expected -- `strne r9,[ r3 ]'
+arch/arm/kernel/debug.S:83: Error: ARM register expected -- `ldr r2,[ r3,#(0x08)]'
+arch/arm/kernel/debug.S:83: Error: ARM register expected -- `ldr r2,[ r3,#(0x18)]'
+arch/arm/kernel/debug.S:83: Error: ARM register expected -- `ldr r2,[ r3,#(0x10)]'
+arch/arm/kernel/debug.S:85: Error: ARM register expected -- `ldr r2,[ r3,#(0x08)]'
+arch/arm/kernel/debug.S:85: Error: ARM register expected -- `ldr r2,[ r3,#(0x18)]'
+arch/arm/kernel/debug.S:85: Error: ARM register expected -- `ldr r2,[ r3,#(0x10)]'
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Kukjin Kim <kgene.kim@samsung.com>
+Cc: Ben Dooks <ben-linux@fluff.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-s3c24xx/include/mach/debug-macro.S | 12 ++++++------
+ arch/arm/mach-s3c24xx/include/mach/entry-macro.S | 4 ++--
+ arch/arm/mach-s3c24xx/pm-h1940.S | 2 +-
+ arch/arm/mach-s3c24xx/sleep-s3c2410.S | 12 ++++++------
+ arch/arm/mach-s3c24xx/sleep-s3c2412.S | 12 ++++++------
+ arch/arm/plat-samsung/include/plat/debug-macro.S | 18 +++++++++---------
+ 6 files changed, 30 insertions(+), 30 deletions(-)
+
+--- a/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
++++ b/arch/arm/mach-s3c24xx/include/mach/debug-macro.S
+@@ -40,17 +40,17 @@
+ addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
+ addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
+ bic \rd, \rd, #0xff000
+- ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
++ ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
+ and \rd, \rd, #0x00ff0000
+ teq \rd, #0x00440000 @ is it 2440?
+ 1004:
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ moveq \rd, \rd, lsr #SHIFT_2440TXF
+ tst \rd, #S3C2410_UFSTAT_TXFULL
+ .endm
+
+ .macro fifo_full_s3c2410 rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ tst \rd, #S3C2410_UFSTAT_TXFULL
+ .endm
+
+@@ -68,18 +68,18 @@
+ addeq \rd, \rx, #(S3C24XX_PA_GPIO - S3C24XX_PA_UART)
+ addne \rd, \rx, #(S3C24XX_VA_GPIO - S3C24XX_VA_UART)
+ bic \rd, \rd, #0xff000
+- ldr \rd, [ \rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0) ]
++ ldr \rd, [\rd, # S3C2410_GSTATUS1 - S3C2410_GPIOREG(0)]
+ and \rd, \rd, #0x00ff0000
+ teq \rd, #0x00440000 @ is it 2440?
+
+ 10000:
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ andne \rd, \rd, #S3C2410_UFSTAT_TXMASK
+ andeq \rd, \rd, #S3C2440_UFSTAT_TXMASK
+ .endm
+
+ .macro fifo_level_s3c2410 rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ and \rd, \rd, #S3C2410_UFSTAT_TXMASK
+ .endm
+
+--- a/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
++++ b/arch/arm/mach-s3c24xx/include/mach/entry-macro.S
+@@ -31,10 +31,10 @@
+
+ @@ try the interrupt offset register, since it is there
+
+- ldr \irqstat, [ \base, #INTPND ]
++ ldr \irqstat, [\base, #INTPND ]
+ teq \irqstat, #0
+ beq 1002f
+- ldr \irqnr, [ \base, #INTOFFSET ]
++ ldr \irqnr, [\base, #INTOFFSET ]
+ mov \tmp, #1
+ tst \irqstat, \tmp, lsl \irqnr
+ bne 1001f
+--- a/arch/arm/mach-s3c24xx/pm-h1940.S
++++ b/arch/arm/mach-s3c24xx/pm-h1940.S
+@@ -30,4 +30,4 @@
+
+ h1940_pm_return:
+ mov r0, #S3C2410_PA_GPIO
+- ldr pc, [ r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO ]
++ ldr pc, [r0, #S3C2410_GSTATUS3 - S3C24XX_VA_GPIO]
+--- a/arch/arm/mach-s3c24xx/sleep-s3c2410.S
++++ b/arch/arm/mach-s3c24xx/sleep-s3c2410.S
+@@ -45,9 +45,9 @@ ENTRY(s3c2410_cpu_suspend)
+ ldr r4, =S3C2410_REFRESH
+ ldr r5, =S3C24XX_MISCCR
+ ldr r6, =S3C2410_CLKCON
+- ldr r7, [ r4 ] @ get REFRESH (and ensure in TLB)
+- ldr r8, [ r5 ] @ get MISCCR (and ensure in TLB)
+- ldr r9, [ r6 ] @ get CLKCON (and ensure in TLB)
++ ldr r7, [r4] @ get REFRESH (and ensure in TLB)
++ ldr r8, [r5] @ get MISCCR (and ensure in TLB)
++ ldr r9, [r6] @ get CLKCON (and ensure in TLB)
+
+ orr r7, r7, #S3C2410_REFRESH_SELF @ SDRAM sleep command
+ orr r8, r8, #S3C2410_MISCCR_SDSLEEP @ SDRAM power-down signals
+@@ -61,8 +61,8 @@ ENTRY(s3c2410_cpu_suspend)
+ @@ align next bit of code to cache line
+ .align 5
+ s3c2410_do_sleep:
+- streq r7, [ r4 ] @ SDRAM sleep command
+- streq r8, [ r5 ] @ SDRAM power-down config
+- streq r9, [ r6 ] @ CPU sleep
++ streq r7, [r4] @ SDRAM sleep command
++ streq r8, [r5] @ SDRAM power-down config
++ streq r9, [r6] @ CPU sleep
+ 1: beq 1b
+ mov pc, r14
+--- a/arch/arm/mach-s3c24xx/sleep-s3c2412.S
++++ b/arch/arm/mach-s3c24xx/sleep-s3c2412.S
+@@ -57,12 +57,12 @@ s3c2412_sleep_enter1:
+ * retry, as simply returning causes the system to lock.
+ */
+
+- ldrne r9, [ r1 ]
+- strne r9, [ r1 ]
+- ldrne r9, [ r2 ]
+- strne r9, [ r2 ]
+- ldrne r9, [ r3 ]
+- strne r9, [ r3 ]
++ ldrne r9, [r1]
++ strne r9, [r1]
++ ldrne r9, [r2]
++ strne r9, [r2]
++ ldrne r9, [r3]
++ strne r9, [r3]
+ bne s3c2412_sleep_enter1
+
+ mov pc, r14
+--- a/arch/arm/plat-samsung/include/plat/debug-macro.S
++++ b/arch/arm/plat-samsung/include/plat/debug-macro.S
+@@ -14,12 +14,12 @@
+ /* The S5PV210/S5PC110 implementations are as belows. */
+
+ .macro fifo_level_s5pv210 rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ and \rd, \rd, #S5PV210_UFSTAT_TXMASK
+ .endm
+
+ .macro fifo_full_s5pv210 rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ tst \rd, #S5PV210_UFSTAT_TXFULL
+ .endm
+
+@@ -27,7 +27,7 @@
+ * most widely re-used */
+
+ .macro fifo_level_s3c2440 rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ and \rd, \rd, #S3C2440_UFSTAT_TXMASK
+ .endm
+
+@@ -36,7 +36,7 @@
+ #endif
+
+ .macro fifo_full_s3c2440 rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFSTAT ]
++ ldr \rd, [\rx, # S3C2410_UFSTAT]
+ tst \rd, #S3C2440_UFSTAT_TXFULL
+ .endm
+
+@@ -45,11 +45,11 @@
+ #endif
+
+ .macro senduart,rd,rx
+- strb \rd, [\rx, # S3C2410_UTXH ]
++ strb \rd, [\rx, # S3C2410_UTXH]
+ .endm
+
+ .macro busyuart, rd, rx
+- ldr \rd, [ \rx, # S3C2410_UFCON ]
++ ldr \rd, [\rx, # S3C2410_UFCON]
+ tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
+ beq 1001f @
+ @ FIFO enabled...
+@@ -60,7 +60,7 @@
+
+ 1001:
+ @ busy waiting for non fifo
+- ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
++ ldr \rd, [\rx, # S3C2410_UTRSTAT]
+ tst \rd, #S3C2410_UTRSTAT_TXFE
+ beq 1001b
+
+@@ -68,7 +68,7 @@
+ .endm
+
+ .macro waituart,rd,rx
+- ldr \rd, [ \rx, # S3C2410_UFCON ]
++ ldr \rd, [\rx, # S3C2410_UFCON]
+ tst \rd, #S3C2410_UFCON_FIFOMODE @ fifo enabled?
+ beq 1001f @
+ @ FIFO enabled...
+@@ -79,7 +79,7 @@
+ b 1002f
+ 1001:
+ @ idle waiting for non fifo
+- ldr \rd, [ \rx, # S3C2410_UTRSTAT ]
++ ldr \rd, [\rx, # S3C2410_UTRSTAT]
+ tst \rd, #S3C2410_UTRSTAT_TXFE
+ beq 1001b
+
--- /dev/null
+From c0e01d5d8f15c085236df184e5bc3d79a8b700cd Mon Sep 17 00:00:00 2001
+From: Will Deacon <will.deacon@arm.com>
+Date: Wed, 6 Feb 2013 11:42:23 +0000
+Subject: arm64: compat: use compat_uptr_t type for compat_ucontext.uc_link
+
+From: Will Deacon <will.deacon@arm.com>
+
+commit c0e01d5d8f15c085236df184e5bc3d79a8b700cd upstream.
+
+struct compat_ucontext * is a 64-bit pointer, so we need to use a
+compat_uptr_t instead to avoid declaring a structure incompatible with
+what AArch32 userspace expects.
+
+Reported-by: Edmund Grimley-Evans <Edmund.Grimley-Evans@arm.com>
+Signed-off-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm64/kernel/signal32.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm64/kernel/signal32.c
++++ b/arch/arm64/kernel/signal32.c
+@@ -76,7 +76,7 @@ struct compat_sigcontext {
+
+ struct compat_ucontext {
+ compat_ulong_t uc_flags;
+- struct compat_ucontext *uc_link;
++ compat_uptr_t uc_link;
+ compat_stack_t uc_stack;
+ struct compat_sigcontext uc_mcontext;
+ compat_sigset_t uc_sigmask;
+@@ -703,7 +703,7 @@ int compat_setup_rt_frame(int usig, stru
+ err |= copy_siginfo_to_user32(&frame->info, info);
+
+ __put_user_error(0, &frame->sig.uc.uc_flags, err);
+- __put_user_error(NULL, &frame->sig.uc.uc_link, err);
++ __put_user_error(0, &frame->sig.uc.uc_link, err);
+
+ memset(&stack, 0, sizeof(stack));
+ stack.ss_sp = (compat_uptr_t)current->sas_ss_sp;
--- /dev/null
+From b2639b5f1d01f218dc95537a1c352b3a551c4dd5 Mon Sep 17 00:00:00 2001
+From: Anatolij Gustschin <agust@denx.de>
+Date: Sat, 19 Jan 2013 10:59:10 +0100
+Subject: drivers/video: fsl-diu-fb: fix bugs in interrupt handling
+
+From: Anatolij Gustschin <agust@denx.de>
+
+commit b2639b5f1d01f218dc95537a1c352b3a551c4dd5 upstream.
+
+Since commit f74de500 "drivers/video: fsl-diu-fb: streamline
+enabling of interrupts" the interrupt handling in the driver
+is broken. Enabling diu interrupt causes an interrupt storm and
+results in system lockup.
+
+The cookie for the interrupt handler function passed to request_irq()
+is wrong (it must be a pointer to the diu struct, and not the address
+of the pointer to the diu struct). As a result the interrupt handler
+can not read diu registers and acknowledge the interrupt. Fix cookie
+arguments for request_irq() and free_irq().
+
+Registering the diu interrupt handler in probe() must happen before
+install_fb() calls since this function registers framebuffer devices
+and if fbcon tries to take over framebuffer after registering a frame
+buffer device, it will call fb_open of the diu driver and enable the
+interrupts. At this time the diu interrupt handler must be registered
+already.
+
+Disabling the interrupts in fsl_diu_release() must happen only if all
+other AOIs are closed. Otherwise closing an overlay plane will disable
+the interrupts even if the primary frame buffer plane is opened. Add
+an appropriate check in the release function.
+
+Signed-off-by: Anatolij Gustschin <agust@denx.de>
+Cc: Timur Tabi <timur@tabi.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fsl-diu-fb.c | 58 +++++++++++++++++++++++++--------------------
+ 1 file changed, 33 insertions(+), 25 deletions(-)
+
+--- a/drivers/video/fsl-diu-fb.c
++++ b/drivers/video/fsl-diu-fb.c
+@@ -1232,6 +1232,16 @@ static int fsl_diu_ioctl(struct fb_info
+ return 0;
+ }
+
++static inline void fsl_diu_enable_interrupts(struct fsl_diu_data *data)
++{
++ u32 int_mask = INT_UNDRUN; /* enable underrun detection */
++
++ if (IS_ENABLED(CONFIG_NOT_COHERENT_CACHE))
++ int_mask |= INT_VSYNC; /* enable vertical sync */
++
++ clrbits32(&data->diu_reg->int_mask, int_mask);
++}
++
+ /* turn on fb if count == 1
+ */
+ static int fsl_diu_open(struct fb_info *info, int user)
+@@ -1251,19 +1261,7 @@ static int fsl_diu_open(struct fb_info *
+ if (res < 0)
+ mfbi->count--;
+ else {
+- struct fsl_diu_data *data = mfbi->parent;
+-
+-#ifdef CONFIG_NOT_COHERENT_CACHE
+- /*
+- * Enable underrun detection and vertical sync
+- * interrupts.
+- */
+- clrbits32(&data->diu_reg->int_mask,
+- INT_UNDRUN | INT_VSYNC);
+-#else
+- /* Enable underrun detection */
+- clrbits32(&data->diu_reg->int_mask, INT_UNDRUN);
+-#endif
++ fsl_diu_enable_interrupts(mfbi->parent);
+ fsl_diu_enable_panel(info);
+ }
+ }
+@@ -1283,9 +1281,18 @@ static int fsl_diu_release(struct fb_inf
+ mfbi->count--;
+ if (mfbi->count == 0) {
+ struct fsl_diu_data *data = mfbi->parent;
++ bool disable = true;
++ int i;
++
++ /* Disable interrupts only if all AOIs are closed */
++ for (i = 0; i < NUM_AOIS; i++) {
++ struct mfb_info *mi = data->fsl_diu_info[i].par;
+
+- /* Disable interrupts */
+- out_be32(&data->diu_reg->int_mask, 0xffffffff);
++ if (mi->count)
++ disable = false;
++ }
++ if (disable)
++ out_be32(&data->diu_reg->int_mask, 0xffffffff);
+ fsl_diu_disable_panel(info);
+ }
+
+@@ -1614,14 +1621,6 @@ static int fsl_diu_probe(struct platform
+ out_be32(&data->diu_reg->desc[1], data->dummy_ad.paddr);
+ out_be32(&data->diu_reg->desc[2], data->dummy_ad.paddr);
+
+- for (i = 0; i < NUM_AOIS; i++) {
+- ret = install_fb(&data->fsl_diu_info[i]);
+- if (ret) {
+- dev_err(&pdev->dev, "could not register fb %d\n", i);
+- goto error;
+- }
+- }
+-
+ /*
+ * Older versions of U-Boot leave interrupts enabled, so disable
+ * all of them and clear the status register.
+@@ -1630,12 +1629,21 @@ static int fsl_diu_probe(struct platform
+ in_be32(&data->diu_reg->int_status);
+
+ ret = request_irq(data->irq, fsl_diu_isr, 0, "fsl-diu-fb",
+- &data->diu_reg);
++ data->diu_reg);
+ if (ret) {
+ dev_err(&pdev->dev, "could not claim irq\n");
+ goto error;
+ }
+
++ for (i = 0; i < NUM_AOIS; i++) {
++ ret = install_fb(&data->fsl_diu_info[i]);
++ if (ret) {
++ dev_err(&pdev->dev, "could not register fb %d\n", i);
++ free_irq(data->irq, data->diu_reg);
++ goto error;
++ }
++ }
++
+ sysfs_attr_init(&data->dev_attr.attr);
+ data->dev_attr.attr.name = "monitor";
+ data->dev_attr.attr.mode = S_IRUGO|S_IWUSR;
+@@ -1667,7 +1675,7 @@ static int fsl_diu_remove(struct platfor
+ data = dev_get_drvdata(&pdev->dev);
+ disable_lcdc(&data->fsl_diu_info[0]);
+
+- free_irq(data->irq, &data->diu_reg);
++ free_irq(data->irq, data->diu_reg);
+
+ for (i = 0; i < NUM_AOIS; i++)
+ uninstall_fb(&data->fsl_diu_info[i]);
--- /dev/null
+From 5d3cc311a76073f6e0a27c0752f7e41f69e95ea7 Mon Sep 17 00:00:00 2001
+From: Anatolij Gustschin <agust@denx.de>
+Date: Thu, 17 Jan 2013 21:28:37 +0100
+Subject: drivers/video: fsl-diu-fb: fix pixel formats for 24 and 16 bpp
+
+From: Anatolij Gustschin <agust@denx.de>
+
+commit 5d3cc311a76073f6e0a27c0752f7e41f69e95ea7 upstream.
+
+Framebuffer colors for 24 and 16 bpp are currently wrong. The order
+of the color component arguments in the MAKE_PF() is not natural
+and causes some confusion. The generated pixel format values for 24
+and 16 bpp depths do not much the values in the comments.
+
+Fix the macro arguments to be in the natural RGB order and adjust
+the arguments for all depths to generate correct pixel format values
+(equal to the values mentioned in the comments).
+
+Signed-off-by: Anatolij Gustschin <agust@denx.de>
+Cc: Timur Tabi <timur@tabi.org>
+Acked-by: Timur Tabi <timur@freescale.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/fsl-diu-fb.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/video/fsl-diu-fb.c
++++ b/drivers/video/fsl-diu-fb.c
+@@ -944,7 +944,7 @@ static u32 fsl_diu_get_pixel_format(unsi
+ #define PF_COMP_0_MASK 0x0000000F
+ #define PF_COMP_0_SHIFT 0
+
+-#define MAKE_PF(alpha, red, blue, green, size, c0, c1, c2, c3) \
++#define MAKE_PF(alpha, red, green, blue, size, c0, c1, c2, c3) \
+ cpu_to_le32(PF_BYTE_F | (alpha << PF_ALPHA_C_SHIFT) | \
+ (blue << PF_BLUE_C_SHIFT) | (green << PF_GREEN_C_SHIFT) | \
+ (red << PF_RED_C_SHIFT) | (c3 << PF_COMP_3_SHIFT) | \
+@@ -954,10 +954,10 @@ static u32 fsl_diu_get_pixel_format(unsi
+ switch (bits_per_pixel) {
+ case 32:
+ /* 0x88883316 */
+- return MAKE_PF(3, 2, 0, 1, 3, 8, 8, 8, 8);
++ return MAKE_PF(3, 2, 1, 0, 3, 8, 8, 8, 8);
+ case 24:
+ /* 0x88082219 */
+- return MAKE_PF(4, 0, 1, 2, 2, 0, 8, 8, 8);
++ return MAKE_PF(4, 0, 1, 2, 2, 8, 8, 8, 0);
+ case 16:
+ /* 0x65053118 */
+ return MAKE_PF(4, 2, 1, 0, 1, 5, 6, 5, 0);
--- /dev/null
+From 50e244cc793d511b86adea24972f3a7264cae114 Mon Sep 17 00:00:00 2001
+From: Alan Cox <alan@linux.intel.com>
+Date: Fri, 25 Jan 2013 10:28:15 +1000
+Subject: fb: rework locking to fix lock ordering on takeover
+
+From: Alan Cox <alan@linux.intel.com>
+
+commit 50e244cc793d511b86adea24972f3a7264cae114 upstream.
+
+Adjust the console layer to allow a take over call where the caller
+already holds the locks. Make the fb layer lock in order.
+
+This is partly a band aid, the fb layer is terminally confused about the
+locking rules it uses for its notifiers it seems.
+
+[akpm@linux-foundation.org: remove stray non-ascii char, tidy comment]
+[akpm@linux-foundation.org: export do_take_over_console()]
+[airlied: cleanup another non-ascii char]
+Signed-off-by: Alan Cox <alan@linux.intel.com>
+Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+Cc: Stephen Rothwell <sfr@canb.auug.org.au>
+Cc: Jiri Kosina <jkosina@suse.cz>
+Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
+Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/vt/vt.c | 93 +++++++++++++++++++++++++++++++-----------
+ drivers/video/console/fbcon.c | 29 ++++++++++++-
+ drivers/video/fbmem.c | 5 --
+ drivers/video/fbsysfs.c | 3 +
+ include/linux/console.h | 1
+ 5 files changed, 104 insertions(+), 27 deletions(-)
+
+--- a/drivers/tty/vt/vt.c
++++ b/drivers/tty/vt/vt.c
+@@ -2987,7 +2987,7 @@ int __init vty_init(const struct file_op
+
+ static struct class *vtconsole_class;
+
+-static int bind_con_driver(const struct consw *csw, int first, int last,
++static int do_bind_con_driver(const struct consw *csw, int first, int last,
+ int deflt)
+ {
+ struct module *owner = csw->owner;
+@@ -2998,7 +2998,7 @@ static int bind_con_driver(const struct
+ if (!try_module_get(owner))
+ return -ENODEV;
+
+- console_lock();
++ WARN_CONSOLE_UNLOCKED();
+
+ /* check if driver is registered */
+ for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
+@@ -3083,11 +3083,22 @@ static int bind_con_driver(const struct
+
+ retval = 0;
+ err:
+- console_unlock();
+ module_put(owner);
+ return retval;
+ };
+
++
++static int bind_con_driver(const struct consw *csw, int first, int last,
++ int deflt)
++{
++ int ret;
++
++ console_lock();
++ ret = do_bind_con_driver(csw, first, last, deflt);
++ console_unlock();
++ return ret;
++}
++
+ #ifdef CONFIG_VT_HW_CONSOLE_BINDING
+ static int con_is_graphics(const struct consw *csw, int first, int last)
+ {
+@@ -3199,9 +3210,9 @@ int unbind_con_driver(const struct consw
+ if (!con_is_bound(csw))
+ con_driver->flag &= ~CON_DRIVER_FLAG_INIT;
+
+- console_unlock();
+ /* ignore return value, binding should not fail */
+- bind_con_driver(defcsw, first, last, deflt);
++ do_bind_con_driver(defcsw, first, last, deflt);
++ console_unlock();
+ err:
+ module_put(owner);
+ return retval;
+@@ -3492,28 +3503,18 @@ int con_debug_leave(void)
+ }
+ EXPORT_SYMBOL_GPL(con_debug_leave);
+
+-/**
+- * register_con_driver - register console driver to console layer
+- * @csw: console driver
+- * @first: the first console to take over, minimum value is 0
+- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
+- *
+- * DESCRIPTION: This function registers a console driver which can later
+- * bind to a range of consoles specified by @first and @last. It will
+- * also initialize the console driver by calling con_startup().
+- */
+-int register_con_driver(const struct consw *csw, int first, int last)
++static int do_register_con_driver(const struct consw *csw, int first, int last)
+ {
+ struct module *owner = csw->owner;
+ struct con_driver *con_driver;
+ const char *desc;
+ int i, retval = 0;
+
++ WARN_CONSOLE_UNLOCKED();
++
+ if (!try_module_get(owner))
+ return -ENODEV;
+
+- console_lock();
+-
+ for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
+ con_driver = ®istered_con_driver[i];
+
+@@ -3566,10 +3567,29 @@ int register_con_driver(const struct con
+ }
+
+ err:
+- console_unlock();
+ module_put(owner);
+ return retval;
+ }
++
++/**
++ * register_con_driver - register console driver to console layer
++ * @csw: console driver
++ * @first: the first console to take over, minimum value is 0
++ * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
++ *
++ * DESCRIPTION: This function registers a console driver which can later
++ * bind to a range of consoles specified by @first and @last. It will
++ * also initialize the console driver by calling con_startup().
++ */
++int register_con_driver(const struct consw *csw, int first, int last)
++{
++ int retval;
++
++ console_lock();
++ retval = do_register_con_driver(csw, first, last);
++ console_unlock();
++ return retval;
++}
+ EXPORT_SYMBOL(register_con_driver);
+
+ /**
+@@ -3623,17 +3643,44 @@ EXPORT_SYMBOL(unregister_con_driver);
+ * when a driver wants to take over some existing consoles
+ * and become default driver for newly opened ones.
+ *
+- * take_over_console is basically a register followed by unbind
++ * take_over_console is basically a register followed by unbind
++ */
++int do_take_over_console(const struct consw *csw, int first, int last, int deflt)
++{
++ int err;
++
++ err = do_register_con_driver(csw, first, last);
++ /*
++ * If we get an busy error we still want to bind the console driver
++ * and return success, as we may have unbound the console driver
++ * but not unregistered it.
++ */
++ if (err == -EBUSY)
++ err = 0;
++ if (!err)
++ do_bind_con_driver(csw, first, last, deflt);
++
++ return err;
++}
++EXPORT_SYMBOL_GPL(do_take_over_console);
++
++/*
++ * If we support more console drivers, this function is used
++ * when a driver wants to take over some existing consoles
++ * and become default driver for newly opened ones.
++ *
++ * take_over_console is basically a register followed by unbind
+ */
+ int take_over_console(const struct consw *csw, int first, int last, int deflt)
+ {
+ int err;
+
+ err = register_con_driver(csw, first, last);
+- /* if we get an busy error we still want to bind the console driver
++ /*
++ * If we get an busy error we still want to bind the console driver
+ * and return success, as we may have unbound the console driver
+- * but not unregistered it.
+- */
++ * but not unregistered it.
++ */
+ if (err == -EBUSY)
+ err = 0;
+ if (!err)
+--- a/drivers/video/console/fbcon.c
++++ b/drivers/video/console/fbcon.c
+@@ -529,6 +529,33 @@ static int search_for_mapped_con(void)
+ return retval;
+ }
+
++static int do_fbcon_takeover(int show_logo)
++{
++ int err, i;
++
++ if (!num_registered_fb)
++ return -ENODEV;
++
++ if (!show_logo)
++ logo_shown = FBCON_LOGO_DONTSHOW;
++
++ for (i = first_fb_vc; i <= last_fb_vc; i++)
++ con2fb_map[i] = info_idx;
++
++ err = do_take_over_console(&fb_con, first_fb_vc, last_fb_vc,
++ fbcon_is_default);
++
++ if (err) {
++ for (i = first_fb_vc; i <= last_fb_vc; i++)
++ con2fb_map[i] = -1;
++ info_idx = -1;
++ } else {
++ fbcon_has_console_bind = 1;
++ }
++
++ return err;
++}
++
+ static int fbcon_takeover(int show_logo)
+ {
+ int err, i;
+@@ -3121,7 +3148,7 @@ static int fbcon_fb_registered(struct fb
+ }
+
+ if (info_idx != -1)
+- ret = fbcon_takeover(1);
++ ret = do_fbcon_takeover(1);
+ } else {
+ for (i = first_fb_vc; i <= last_fb_vc; i++) {
+ if (con2fb_map_boot[i] == idx)
+--- a/drivers/video/fbmem.c
++++ b/drivers/video/fbmem.c
+@@ -1650,7 +1650,9 @@ static int do_register_framebuffer(struc
+ event.info = fb_info;
+ if (!lock_fb_info(fb_info))
+ return -ENODEV;
++ console_lock();
+ fb_notifier_call_chain(FB_EVENT_FB_REGISTERED, &event);
++ console_unlock();
+ unlock_fb_info(fb_info);
+ return 0;
+ }
+@@ -1853,11 +1855,8 @@ int fb_new_modelist(struct fb_info *info
+ err = 1;
+
+ if (!list_empty(&info->modelist)) {
+- if (!lock_fb_info(info))
+- return -ENODEV;
+ event.info = info;
+ err = fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);
+- unlock_fb_info(info);
+ }
+
+ return err;
+--- a/drivers/video/fbsysfs.c
++++ b/drivers/video/fbsysfs.c
+@@ -177,6 +177,8 @@ static ssize_t store_modes(struct device
+ if (i * sizeof(struct fb_videomode) != count)
+ return -EINVAL;
+
++ if (!lock_fb_info(fb_info))
++ return -ENODEV;
+ console_lock();
+ list_splice(&fb_info->modelist, &old_list);
+ fb_videomode_to_modelist((const struct fb_videomode *)buf, i,
+@@ -188,6 +190,7 @@ static ssize_t store_modes(struct device
+ fb_destroy_modelist(&old_list);
+
+ console_unlock();
++ unlock_fb_info(fb_info);
+
+ return 0;
+ }
+--- a/include/linux/console.h
++++ b/include/linux/console.h
+@@ -78,6 +78,7 @@ int con_is_bound(const struct consw *csw
+ int register_con_driver(const struct consw *csw, int first, int last);
+ int unregister_con_driver(const struct consw *csw);
+ int take_over_console(const struct consw *sw, int first, int last, int deflt);
++int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
+ void give_up_console(const struct consw *sw);
+ #ifdef CONFIG_HW_CONSOLE
+ int con_debug_enter(struct vc_data *vc);
--- /dev/null
+From e93a9a868792ad71cdd09d75e5a02d8067473c4e Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 25 Jan 2013 10:28:18 +1000
+Subject: fb: Yet another band-aid for fixing lockdep mess
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit e93a9a868792ad71cdd09d75e5a02d8067473c4e upstream.
+
+I've still got lockdep warnings even after Alan's patch, and it seems that
+yet more band aids are required to paper over similar paths for
+unbind_con_driver() and unregister_con_driver(). After this hack, lockdep
+warnings are finally gone.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Cc: Alan Cox <alan@linux.intel.com>
+Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
+Cc: Jiri Kosina <jkosina@suse.cz>
+Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/vt/vt.c | 43 +++++++++++++++++++++++++++---------------
+ drivers/video/console/fbcon.c | 4 +--
+ drivers/video/fbmem.c | 4 +++
+ include/linux/console.h | 1
+ include/linux/vt_kern.h | 2 +
+ 5 files changed, 37 insertions(+), 17 deletions(-)
+
+--- a/drivers/tty/vt/vt.c
++++ b/drivers/tty/vt/vt.c
+@@ -3135,6 +3135,18 @@ static int con_is_graphics(const struct
+ */
+ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
+ {
++ int retval;
++
++ console_lock();
++ retval = do_unbind_con_driver(csw, first, last, deflt);
++ console_unlock();
++ return retval;
++}
++EXPORT_SYMBOL(unbind_con_driver);
++
++/* unlocked version of unbind_con_driver() */
++int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
++{
+ struct module *owner = csw->owner;
+ const struct consw *defcsw = NULL;
+ struct con_driver *con_driver = NULL, *con_back = NULL;
+@@ -3143,7 +3155,7 @@ int unbind_con_driver(const struct consw
+ if (!try_module_get(owner))
+ return -ENODEV;
+
+- console_lock();
++ WARN_CONSOLE_UNLOCKED();
+
+ /* check if driver is registered and if it is unbindable */
+ for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
+@@ -3156,10 +3168,8 @@ int unbind_con_driver(const struct consw
+ }
+ }
+
+- if (retval) {
+- console_unlock();
++ if (retval)
+ goto err;
+- }
+
+ retval = -ENODEV;
+
+@@ -3175,15 +3185,11 @@ int unbind_con_driver(const struct consw
+ }
+ }
+
+- if (retval) {
+- console_unlock();
++ if (retval)
+ goto err;
+- }
+
+- if (!con_is_bound(csw)) {
+- console_unlock();
++ if (!con_is_bound(csw))
+ goto err;
+- }
+
+ first = max(first, con_driver->first);
+ last = min(last, con_driver->last);
+@@ -3212,13 +3218,12 @@ int unbind_con_driver(const struct consw
+
+ /* ignore return value, binding should not fail */
+ do_bind_con_driver(defcsw, first, last, deflt);
+- console_unlock();
+ err:
+ module_put(owner);
+ return retval;
+
+ }
+-EXPORT_SYMBOL(unbind_con_driver);
++EXPORT_SYMBOL_GPL(do_unbind_con_driver);
+
+ static int vt_bind(struct con_driver *con)
+ {
+@@ -3605,9 +3610,18 @@ EXPORT_SYMBOL(register_con_driver);
+ */
+ int unregister_con_driver(const struct consw *csw)
+ {
+- int i, retval = -ENODEV;
++ int retval;
+
+ console_lock();
++ retval = do_unregister_con_driver(csw);
++ console_unlock();
++ return retval;
++}
++EXPORT_SYMBOL(unregister_con_driver);
++
++int do_unregister_con_driver(const struct consw *csw)
++{
++ int i, retval = -ENODEV;
+
+ /* cannot unregister a bound driver */
+ if (con_is_bound(csw))
+@@ -3633,10 +3647,9 @@ int unregister_con_driver(const struct c
+ }
+ }
+ err:
+- console_unlock();
+ return retval;
+ }
+-EXPORT_SYMBOL(unregister_con_driver);
++EXPORT_SYMBOL_GPL(do_unregister_con_driver);
+
+ /*
+ * If we support more console drivers, this function is used
+--- a/drivers/video/console/fbcon.c
++++ b/drivers/video/console/fbcon.c
+@@ -3010,7 +3010,7 @@ static int fbcon_unbind(void)
+ {
+ int ret;
+
+- ret = unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
++ ret = do_unbind_con_driver(&fb_con, first_fb_vc, last_fb_vc,
+ fbcon_is_default);
+
+ if (!ret)
+@@ -3083,7 +3083,7 @@ static int fbcon_fb_unregistered(struct
+ primary_device = -1;
+
+ if (!num_registered_fb)
+- unregister_con_driver(&fb_con);
++ do_unregister_con_driver(&fb_con);
+
+ return 0;
+ }
+--- a/drivers/video/fbmem.c
++++ b/drivers/video/fbmem.c
+@@ -1668,8 +1668,10 @@ static int do_unregister_framebuffer(str
+
+ if (!lock_fb_info(fb_info))
+ return -ENODEV;
++ console_lock();
+ event.info = fb_info;
+ ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
++ console_unlock();
+ unlock_fb_info(fb_info);
+
+ if (ret)
+@@ -1684,7 +1686,9 @@ static int do_unregister_framebuffer(str
+ num_registered_fb--;
+ fb_cleanup_device(fb_info);
+ event.info = fb_info;
++ console_lock();
+ fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
++ console_unlock();
+
+ /* this may free fb info */
+ put_fb_info(fb_info);
+--- a/include/linux/console.h
++++ b/include/linux/console.h
+@@ -77,6 +77,7 @@ extern const struct consw prom_con; /* S
+ int con_is_bound(const struct consw *csw);
+ int register_con_driver(const struct consw *csw, int first, int last);
+ int unregister_con_driver(const struct consw *csw);
++int do_unregister_con_driver(const struct consw *csw);
+ int take_over_console(const struct consw *sw, int first, int last, int deflt);
+ int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
+ void give_up_console(const struct consw *sw);
+--- a/include/linux/vt_kern.h
++++ b/include/linux/vt_kern.h
+@@ -131,6 +131,8 @@ void vt_event_post(unsigned int event, u
+ int vt_waitactive(int n);
+ void change_console(struct vc_data *new_vc);
+ void reset_vc(struct vc_data *vc);
++extern int do_unbind_con_driver(const struct consw *csw, int first, int last,
++ int deflt);
+ extern int unbind_con_driver(const struct consw *csw, int first, int last,
+ int deflt);
+ int vty_init(const struct file_operations *console_fops);
--- /dev/null
+From ae1287865f5361fa138d4d3b1b6277908b54eac9 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Thu, 24 Jan 2013 16:12:41 +1000
+Subject: fbcon: don't lose the console font across generic->chip driver switch
+
+From: Dave Airlie <airlied@redhat.com>
+
+commit ae1287865f5361fa138d4d3b1b6277908b54eac9 upstream.
+
+If grub2 loads efifb/vesafb, then when systemd starts it can set the console
+font on that framebuffer device, however when we then load the native KMS
+driver, the first thing it does is tear down the generic framebuffer driver.
+
+The thing is the generic code is doing the right thing, it frees the font
+because otherwise it would leak memory. However we can assume that if you
+are removing the generic firmware driver (vesa/efi/offb), that a new driver
+*should* be loading soon after, so we effectively leak the font.
+
+However the old code left a dangling pointer in vc->vc_font.data and we
+can now reuse that dangling pointer to load the font into the new
+driver, now that we aren't freeing it.
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=892340
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Cc: Kay Sievers <kay.sievers@vrfy.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/console/fbcon.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+--- a/drivers/video/console/fbcon.c
++++ b/drivers/video/console/fbcon.c
+@@ -990,7 +990,7 @@ static const char *fbcon_startup(void)
+ }
+
+ /* Setup default font */
+- if (!p->fontdata) {
++ if (!p->fontdata && !vc->vc_font.data) {
+ if (!fontname[0] || !(font = find_font(fontname)))
+ font = get_default_font(info->var.xres,
+ info->var.yres,
+@@ -1000,6 +1000,8 @@ static const char *fbcon_startup(void)
+ vc->vc_font.height = font->height;
+ vc->vc_font.data = (void *)(p->fontdata = font->data);
+ vc->vc_font.charcount = 256; /* FIXME Need to support more fonts */
++ } else {
++ p->fontdata = vc->vc_font.data;
+ }
+
+ cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
+@@ -1159,9 +1161,9 @@ static void fbcon_init(struct vc_data *v
+ ops->p = &fb_display[fg_console];
+ }
+
+-static void fbcon_free_font(struct display *p)
++static void fbcon_free_font(struct display *p, bool freefont)
+ {
+- if (p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
++ if (freefont && p->userfont && p->fontdata && (--REFCOUNT(p->fontdata) == 0))
+ kfree(p->fontdata - FONT_EXTRA_WORDS * sizeof(int));
+ p->fontdata = NULL;
+ p->userfont = 0;
+@@ -1173,8 +1175,8 @@ static void fbcon_deinit(struct vc_data
+ struct fb_info *info;
+ struct fbcon_ops *ops;
+ int idx;
++ bool free_font = true;
+
+- fbcon_free_font(p);
+ idx = con2fb_map[vc->vc_num];
+
+ if (idx == -1)
+@@ -1185,6 +1187,8 @@ static void fbcon_deinit(struct vc_data
+ if (!info)
+ goto finished;
+
++ if (info->flags & FBINFO_MISC_FIRMWARE)
++ free_font = false;
+ ops = info->fbcon_par;
+
+ if (!ops)
+@@ -1196,6 +1200,8 @@ static void fbcon_deinit(struct vc_data
+ ops->flags &= ~FBCON_FLAGS_INIT;
+ finished:
+
++ fbcon_free_font(p, free_font);
++
+ if (!con_is_bound(&fb_con))
+ fbcon_exit();
+
--- /dev/null
+From 89bdd0c6f38ccf0de43d5a36ede384a730f3394e Mon Sep 17 00:00:00 2001
+From: David Herrmann <dh.herrmann@gmail.com>
+Date: Mon, 18 Feb 2013 01:47:15 +0100
+Subject: HID: wiimote: fix nunchuck button parser
+
+From: David Herrmann <dh.herrmann@gmail.com>
+
+commit 89bdd0c6f38ccf0de43d5a36ede384a730f3394e upstream.
+
+The buttons of the Wii Remote Nunchuck extension are actually active low.
+Fix the parser to forward the inverted values. The comment in the function
+always said "0 == pressed" but the implementation was wrong from the
+beginning.
+
+Reported-by: Victor Quicksilver <victor.quicksilver@gmail.com>
+Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-wiimote-ext.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/hid/hid-wiimote-ext.c
++++ b/drivers/hid/hid-wiimote-ext.c
+@@ -403,14 +403,14 @@ static void handler_nunchuck(struct wiim
+
+ if (ext->motionp) {
+ input_report_key(ext->input,
+- wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x04));
++ wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x04));
+ input_report_key(ext->input,
+- wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x08));
++ wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x08));
+ } else {
+ input_report_key(ext->input,
+- wiiext_keymap[WIIEXT_KEY_Z], !!(payload[5] & 0x01));
++ wiiext_keymap[WIIEXT_KEY_Z], !(payload[5] & 0x01));
+ input_report_key(ext->input,
+- wiiext_keymap[WIIEXT_KEY_C], !!(payload[5] & 0x02));
++ wiiext_keymap[WIIEXT_KEY_C], !(payload[5] & 0x02));
+ }
+
+ input_sync(ext->input);
--- /dev/null
+From d0123ccac55088811bde4f76c4a3fdbd39c3cfba Mon Sep 17 00:00:00 2001
+From: Balaji T K <balajitk@ti.com>
+Date: Fri, 25 Jan 2013 17:00:30 +0530
+Subject: mmc: core: expose RPMB partition only for CMD23 capable hosts
+
+From: Balaji T K <balajitk@ti.com>
+
+commit d0123ccac55088811bde4f76c4a3fdbd39c3cfba upstream.
+
+SET_BLOCK_COUNT CMD23 is needed for all access to RPMB partition. If
+block count is not set by CMD23, all subsequent read/write commands fail
+as per eMMC specification. So, If the host does not support CMD23, do not
+expose RPMB partition.
+
+Accessing RPMB partition can cause hang / huge delay for hosts which do
+not support CMD23.
+
+Signed-off-by: Balaji T K <balajitk@ti.com>
+Reported-and-Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
+Signed-off-by: Chris Ball <cjb@laptop.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/core/mmc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/mmc/core/mmc.c
++++ b/drivers/mmc/core/mmc.c
+@@ -496,7 +496,7 @@ static int mmc_read_ext_csd(struct mmc_c
+ * RPMB regions are defined in multiples of 128K.
+ */
+ card->ext_csd.raw_rpmb_size_mult = ext_csd[EXT_CSD_RPMB_MULT];
+- if (ext_csd[EXT_CSD_RPMB_MULT]) {
++ if (ext_csd[EXT_CSD_RPMB_MULT] && mmc_host_cmd23(card->host)) {
+ mmc_part_add(card, ext_csd[EXT_CSD_RPMB_MULT] << 17,
+ EXT_CSD_PART_CONFIG_ACC_RPMB,
+ "rpmb", 0, false,
--- /dev/null
+From ef4d0888bb7e1b963880f086575081c3d39cad2d Mon Sep 17 00:00:00 2001
+From: Shawn Guo <shawn.guo@linaro.org>
+Date: Tue, 15 Jan 2013 23:30:27 +0800
+Subject: mmc: sdhci-esdhc-imx: fix host version read
+
+From: Shawn Guo <shawn.guo@linaro.org>
+
+commit ef4d0888bb7e1b963880f086575081c3d39cad2d upstream.
+
+When commit 95a2482 (mmc: sdhci-esdhc-imx: add basic imx6q usdhc
+support) works around host version issue on imx6q, it gets the
+register address fixup "reg ^= 2" lost for imx25/35/51/53 esdhc.
+Thus, the controller version on these SoCs is wrongly identified
+as v1 while it's actually v2.
+
+Add the address fixup back and take a different approach to correct
+imx6q host version, so that the host version read gets back to work
+for all SoCs.
+
+Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
+Signed-off-by: Chris Ball <cjb@laptop.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/host/sdhci-esdhc-imx.c | 19 +++++++++++--------
+ 1 file changed, 11 insertions(+), 8 deletions(-)
+
+--- a/drivers/mmc/host/sdhci-esdhc-imx.c
++++ b/drivers/mmc/host/sdhci-esdhc-imx.c
+@@ -237,15 +237,18 @@ static void esdhc_writel_le(struct sdhci
+
+ static u16 esdhc_readw_le(struct sdhci_host *host, int reg)
+ {
++ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
++ struct pltfm_imx_data *imx_data = pltfm_host->priv;
++
+ if (unlikely(reg == SDHCI_HOST_VERSION)) {
+- u16 val = readw(host->ioaddr + (reg ^ 2));
+- /*
+- * uSDHC supports SDHCI v3.0, but it's encoded as value
+- * 0x3 in host controller version register, which violates
+- * SDHCI_SPEC_300 definition. Work it around here.
+- */
+- if ((val & SDHCI_SPEC_VER_MASK) == 3)
+- return --val;
++ reg ^= 2;
++ if (is_imx6q_usdhc(imx_data)) {
++ /*
++ * The usdhc register returns a wrong host version.
++ * Correct it here.
++ */
++ return SDHCI_SPEC_300;
++ }
+ }
+
+ return readw(host->ioaddr + reg);
--- /dev/null
+From 811af9723859884f2f771f3174f3ddedab7c53b5 Mon Sep 17 00:00:00 2001
+From: Jean Delvare <khali@linux-fr.org>
+Date: Sun, 16 Dec 2012 22:00:50 +0100
+Subject: pcmcia/vrc4171: Add missing spinlock init
+
+From: Jean Delvare <khali@linux-fr.org>
+
+commit 811af9723859884f2f771f3174f3ddedab7c53b5 upstream.
+
+It doesn't seem this spinlock was properly initialized. This bug was
+introduced by commit 7a410e8d4d97457c8c381e2de9cdc7bd3306badc.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pcmcia/vrc4171_card.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/pcmcia/vrc4171_card.c
++++ b/drivers/pcmcia/vrc4171_card.c
+@@ -246,6 +246,7 @@ static int pccard_init(struct pcmcia_soc
+ socket = &vrc4171_sockets[slot];
+ socket->csc_irq = search_nonuse_irq();
+ socket->io_irq = search_nonuse_irq();
++ spin_lock_init(&socket->lock);
+
+ return 0;
+ }
--- /dev/null
+From 6a040ce72598159a74969a2d01ab0ba5ee6536b3 Mon Sep 17 00:00:00 2001
+From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
+Date: Fri, 28 Dec 2012 09:13:19 +0000
+Subject: powerpc/eeh: Fix crash when adding a device in a slot with DDW
+
+From: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
+
+commit 6a040ce72598159a74969a2d01ab0ba5ee6536b3 upstream.
+
+The DDW code uses a eeh_dev struct from the pci_dev. However, this is
+not set until eeh_add_device_late is called.
+
+Since pci_bus_add_devices is called before eeh_add_device_late, the PCI
+devices are added to the bus, making drivers' probe hooks to be called.
+These will call set_dma_mask, which will call the DDW code, which will
+require the eeh_dev struct from pci_dev. This would result in a crash,
+due to a NULL dereference.
+
+Calling eeh_add_device_late after pci_bus_add_devices would make the
+system BUG, because device files shouldn't be added to devices there
+were not added to the system. So, a new function is needed to add such
+files only after pci_bus_add_devices have been called.
+
+Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
+Acked-by: Gavin Shan <shangw@linux.vnet.ibm.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/include/asm/eeh.h | 3 +++
+ arch/powerpc/kernel/of_platform.c | 3 +++
+ arch/powerpc/kernel/pci-common.c | 7 +++++--
+ arch/powerpc/platforms/pseries/eeh.c | 24 +++++++++++++++++++++++-
+ 4 files changed, 34 insertions(+), 3 deletions(-)
+
+--- a/arch/powerpc/include/asm/eeh.h
++++ b/arch/powerpc/include/asm/eeh.h
+@@ -201,6 +201,7 @@ int eeh_dev_check_failure(struct eeh_dev
+ void __init eeh_addr_cache_build(void);
+ void eeh_add_device_tree_early(struct device_node *);
+ void eeh_add_device_tree_late(struct pci_bus *);
++void eeh_add_sysfs_files(struct pci_bus *);
+ void eeh_remove_bus_device(struct pci_dev *, int);
+
+ /**
+@@ -240,6 +241,8 @@ static inline void eeh_add_device_tree_e
+
+ static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
+
++static inline void eeh_add_sysfs_files(struct pci_bus *bus) { }
++
+ static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
+
+ static inline void eeh_lock(void) { }
+--- a/arch/powerpc/kernel/of_platform.c
++++ b/arch/powerpc/kernel/of_platform.c
+@@ -95,6 +95,9 @@ static int of_pci_phb_probe(struct platf
+ /* Add probed PCI devices to the device model */
+ pci_bus_add_devices(phb->bus);
+
++ /* sysfs files should only be added after devices are added */
++ eeh_add_sysfs_files(phb->bus);
++
+ return 0;
+ }
+
+--- a/arch/powerpc/kernel/pci-common.c
++++ b/arch/powerpc/kernel/pci-common.c
+@@ -1477,11 +1477,14 @@ void pcibios_finish_adding_to_bus(struct
+ pcibios_allocate_bus_resources(bus);
+ pcibios_claim_one_bus(bus);
+
++ /* Fixup EEH */
++ eeh_add_device_tree_late(bus);
++
+ /* Add new devices to global lists. Register in proc, sysfs. */
+ pci_bus_add_devices(bus);
+
+- /* Fixup EEH */
+- eeh_add_device_tree_late(bus);
++ /* sysfs files should only be added after devices are added */
++ eeh_add_sysfs_files(bus);
+ }
+ EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
+
+--- a/arch/powerpc/platforms/pseries/eeh.c
++++ b/arch/powerpc/platforms/pseries/eeh.c
+@@ -788,7 +788,6 @@ static void eeh_add_device_late(struct p
+ dev->dev.archdata.edev = edev;
+
+ eeh_addr_cache_insert_dev(dev);
+- eeh_sysfs_add_device(dev);
+ }
+
+ /**
+@@ -815,6 +814,29 @@ void eeh_add_device_tree_late(struct pci
+ EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
+
+ /**
++ * eeh_add_sysfs_files - Add EEH sysfs files for the indicated PCI bus
++ * @bus: PCI bus
++ *
++ * This routine must be used to add EEH sysfs files for PCI
++ * devices which are attached to the indicated PCI bus. The PCI bus
++ * is added after system boot through hotplug or dlpar.
++ */
++void eeh_add_sysfs_files(struct pci_bus *bus)
++{
++ struct pci_dev *dev;
++
++ list_for_each_entry(dev, &bus->devices, bus_list) {
++ eeh_sysfs_add_device(dev);
++ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
++ struct pci_bus *subbus = dev->subordinate;
++ if (subbus)
++ eeh_add_sysfs_files(subbus);
++ }
++ }
++}
++EXPORT_SYMBOL_GPL(eeh_add_sysfs_files);
++
++/**
+ * eeh_remove_device - Undo EEH setup for the indicated pci device
+ * @dev: pci device to be removed
+ * @purge_pe: remove the PE or not
--- /dev/null
+From 8520e443aa56cc157b015205ea53e7b9fc831291 Mon Sep 17 00:00:00 2001
+From: Phileas Fogg <phileas-fogg@mail.ru>
+Date: Sat, 23 Feb 2013 00:32:19 +0100
+Subject: powerpc/kexec: Disable hard IRQ before kexec
+
+From: Phileas Fogg <phileas-fogg@mail.ru>
+
+commit 8520e443aa56cc157b015205ea53e7b9fc831291 upstream.
+
+Disable hard IRQ before kexec a new kernel image.
+Not doing it can result in corrupted data in the memory segments
+reserved for the new kernel.
+
+Signed-off-by: Phileas Fogg <phileas-fogg@mail.ru>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/machine_kexec_64.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/arch/powerpc/kernel/machine_kexec_64.c
++++ b/arch/powerpc/kernel/machine_kexec_64.c
+@@ -162,6 +162,8 @@ static int kexec_all_irq_disabled = 0;
+ static void kexec_smp_down(void *arg)
+ {
+ local_irq_disable();
++ hard_irq_disable();
++
+ mb(); /* make sure our irqs are disabled before we say they are */
+ get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
+ while(kexec_all_irq_disabled == 0)
+@@ -244,6 +246,8 @@ static void kexec_prepare_cpus(void)
+ wake_offline_cpus();
+ smp_call_function(kexec_smp_down, NULL, /* wait */0);
+ local_irq_disable();
++ hard_irq_disable();
++
+ mb(); /* make sure IRQs are disabled before we say they are */
+ get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
+
+@@ -281,6 +285,7 @@ static void kexec_prepare_cpus(void)
+ if (ppc_md.kexec_cpu_down)
+ ppc_md.kexec_cpu_down(0, 0);
+ local_irq_disable();
++ hard_irq_disable();
+ }
+
+ #endif /* SMP */
--- /dev/null
+From 7139bc1579901b53db7e898789e916ee2fb52d78 Mon Sep 17 00:00:00 2001
+From: John David Anglin <dave.anglin@bell.net>
+Date: Mon, 14 Jan 2013 19:45:00 -0500
+Subject: [PARISC] Purge existing TLB entries in set_pte_at and ptep_set_wrprotect
+
+From: John David Anglin <dave.anglin@bell.net>
+
+commit 7139bc1579901b53db7e898789e916ee2fb52d78 upstream.
+
+This patch goes a long way toward fixing the minifail bug, and
+it significantly improves the stability of SMP machines such as
+the rp3440. When write protecting a page for COW, we need to
+purge the existing translation. Otherwise, the COW break
+doesn't occur as expected because the TLB may still have a stale entry
+which allows writes.
+
+[jejb: fix up checkpatch errors]
+Signed-off-by: John David Anglin <dave.anglin@bell.net>
+Signed-off-by: James Bottomley <JBottomley@Parallels.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/parisc/include/asm/pgtable.h | 13 ++++++++++---
+ arch/parisc/kernel/cache.c | 18 ++++++++++++++++++
+ 2 files changed, 28 insertions(+), 3 deletions(-)
+
+--- a/arch/parisc/include/asm/pgtable.h
++++ b/arch/parisc/include/asm/pgtable.h
+@@ -12,11 +12,10 @@
+
+ #include <linux/bitops.h>
+ #include <linux/spinlock.h>
++#include <linux/mm_types.h>
+ #include <asm/processor.h>
+ #include <asm/cache.h>
+
+-struct vm_area_struct;
+-
+ /*
+ * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
+ * memory. For the return value to be meaningful, ADDR must be >=
+@@ -40,7 +39,14 @@ struct vm_area_struct;
+ do{ \
+ *(pteptr) = (pteval); \
+ } while(0)
+-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
++
++extern void purge_tlb_entries(struct mm_struct *, unsigned long);
++
++#define set_pte_at(mm, addr, ptep, pteval) \
++ do { \
++ set_pte(ptep, pteval); \
++ purge_tlb_entries(mm, addr); \
++ } while (0)
+
+ #endif /* !__ASSEMBLY__ */
+
+@@ -466,6 +472,7 @@ static inline void ptep_set_wrprotect(st
+ old = pte_val(*ptep);
+ new = pte_val(pte_wrprotect(__pte (old)));
+ } while (cmpxchg((unsigned long *) ptep, old, new) != old);
++ purge_tlb_entries(mm, addr);
+ #else
+ pte_t old_pte = *ptep;
+ set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
+--- a/arch/parisc/kernel/cache.c
++++ b/arch/parisc/kernel/cache.c
+@@ -419,6 +419,24 @@ void kunmap_parisc(void *addr)
+ EXPORT_SYMBOL(kunmap_parisc);
+ #endif
+
++void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
++{
++ unsigned long flags;
++
++ /* Note: purge_tlb_entries can be called at startup with
++ no context. */
++
++ /* Disable preemption while we play with %sr1. */
++ preempt_disable();
++ mtsp(mm->context, 1);
++ purge_tlb_start(flags);
++ pdtlb(addr);
++ pitlb(addr);
++ purge_tlb_end(flags);
++ preempt_enable();
++}
++EXPORT_SYMBOL(purge_tlb_entries);
++
+ void __flush_tlb_range(unsigned long sid, unsigned long start,
+ unsigned long end)
+ {
asoc-wm2200-correct-in2l-and-in3l-digital-mute.patch
asoc-arizona-fixed-a-bug-in-fll-fractional-calculation.patch
arm-7635-1-versatile-fix-the-pci-irq-regression.patch
+arm-pxa3xx-program-the-csmsadrcfg-register.patch
+arm-at91-dt-remove-atmel-use-dma-from-9x5-and-9n12-usart-nodes.patch
+arm-samsung-fix-assembly-syntax-for-new-gas.patch
+arm-i.mx25-clk-parent-per5_clk-to-ahb-clock.patch
+arm-integrator-ensure-ap_syscon_base-is-initialised-when-config_mmu.patch
+arm64-compat-use-compat_uptr_t-type-for-compat_ucontext.uc_link.patch
+arm-7643-1-sched-correct-update_sched_clock.patch
+powerpc-kexec-disable-hard-irq-before-kexec.patch
+uprobes-powerpc-add-dependency-on-single-step-emulation.patch
+powerpc-eeh-fix-crash-when-adding-a-device-in-a-slot-with-ddw.patch
+purge-existing-tlb-entries-in-set_pte_at-and-ptep_set_wrprotect.patch
+pcmcia-vrc4171-add-missing-spinlock-init.patch
+drivers-video-fsl-diu-fb-fix-pixel-formats-for-24-and-16-bpp.patch
+drivers-video-fsl-diu-fb-fix-bugs-in-interrupt-handling.patch
+fbcon-don-t-lose-the-console-font-across-generic-chip-driver-switch.patch
+fb-rework-locking-to-fix-lock-ordering-on-takeover.patch
+fb-yet-another-band-aid-for-fixing-lockdep-mess.patch
+mmc-sdhci-esdhc-imx-fix-host-version-read.patch
+mmc-core-expose-rpmb-partition-only-for-cmd23-capable-hosts.patch
+hid-wiimote-fix-nunchuck-button-parser.patch
--- /dev/null
+From 5e249d4528528c9a77da051a89ec7f99d31b83eb Mon Sep 17 00:00:00 2001
+From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
+Date: Mon, 7 Jan 2013 00:26:57 +0000
+Subject: uprobes/powerpc: Add dependency on single step emulation
+
+From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
+
+commit 5e249d4528528c9a77da051a89ec7f99d31b83eb upstream.
+
+Uprobes uses emulate_step in sstep.c, but we haven't explicitly specified
+the dependency. On pseries HAVE_HW_BREAKPOINT protects us, but 44x has no
+such luxury.
+
+Consolidate other users that depend on sstep and create a new config option.
+
+Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
+Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
+Cc: linuxppc-dev@ozlabs.org
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/Kconfig | 4 ++++
+ arch/powerpc/lib/Makefile | 4 +---
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+--- a/arch/powerpc/Kconfig
++++ b/arch/powerpc/Kconfig
+@@ -275,6 +275,10 @@ config PPC_ADV_DEBUG_DAC_RANGE
+ depends on PPC_ADV_DEBUG_REGS && 44x
+ default y
+
++config PPC_EMULATE_SSTEP
++ bool
++ default y if KPROBES || UPROBES || XMON || HAVE_HW_BREAKPOINT
++
+ source "init/Kconfig"
+
+ source "kernel/Kconfig.freezer"
+--- a/arch/powerpc/lib/Makefile
++++ b/arch/powerpc/lib/Makefile
+@@ -19,9 +19,7 @@ obj-$(CONFIG_PPC64) += copypage_64.o cop
+ checksum_wrappers_64.o hweight_64.o \
+ copyuser_power7.o string_64.o copypage_power7.o \
+ memcpy_power7.o
+-obj-$(CONFIG_XMON) += sstep.o ldstfp.o
+-obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o
+-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o
++obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o
+
+ ifeq ($(CONFIG_PPC64),y)
+ obj-$(CONFIG_SMP) += locks.o