--- /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
+@@ -84,11 +84,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 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 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
+@@ -923,7 +923,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) | \
+@@ -933,10 +933,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
+@@ -3017,7 +3017,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;
+@@ -3028,7 +3028,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++) {
+@@ -3113,11 +3113,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)
+ {
+@@ -3229,9 +3240,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;
+@@ -3522,28 +3533,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];
+
+@@ -3596,10 +3597,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);
+
+ /**
+@@ -3653,17 +3673,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
+@@ -1642,7 +1642,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;
+ }
+@@ -1845,11 +1847,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
+@@ -175,6 +175,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,
+@@ -186,6 +188,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
+@@ -3165,6 +3165,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;
+@@ -3173,7 +3185,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++) {
+@@ -3186,10 +3198,8 @@ int unbind_con_driver(const struct consw
+ }
+ }
+
+- if (retval) {
+- console_unlock();
++ if (retval)
+ goto err;
+- }
+
+ retval = -ENODEV;
+
+@@ -3205,15 +3215,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);
+@@ -3242,13 +3248,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)
+ {
+@@ -3635,9 +3640,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))
+@@ -3663,10 +3677,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
+@@ -1660,8 +1660,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)
+@@ -1676,7 +1678,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
+@@ -132,6 +132,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
+@@ -378,14 +378,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 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
+@@ -232,15 +232,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 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
+@@ -420,6 +420,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)
+ {
staging-comedi-disallow-comedi_devconfig-on-non-board-minors.patch
staging-vt6656-fix-urb-submitted-while-active-warning.patch
asoc-wm2200-correct-in2l-and-in3l-digital-mute.patch
+arm-pxa3xx-program-the-csmsadrcfg-register.patch
+arm-samsung-fix-assembly-syntax-for-new-gas.patch
+arm-7643-1-sched-correct-update_sched_clock.patch
+powerpc-kexec-disable-hard-irq-before-kexec.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
+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
+hid-wiimote-fix-nunchuck-button-parser.patch