Browse Source

Merge commit 'v3.3-rc6'

Merge v3.3-rc6 to get the latest DSS and OMAP arch fixes.

Conflicts:
	arch/arm/mach-omap1/board-innovator.c
	drivers/video/omap2/dss/apply.c
Tomi Valkeinen 13 years ago
parent
commit
0ba86d7ede
100 changed files with 682 additions and 267 deletions
  1. 6 9
      MAINTAINERS
  2. 1 1
      Makefile
  3. 0 7
      arch/arm/common/it8152.c
  4. 2 1
      arch/arm/common/pl330.c
  5. 5 0
      arch/arm/include/asm/assembler.h
  6. 1 1
      arch/arm/include/asm/hardware/pl330.h
  7. 1 0
      arch/arm/include/asm/processor.h
  8. 8 1
      arch/arm/kernel/ptrace.c
  9. 1 1
      arch/arm/kernel/smp_twd.c
  10. 1 1
      arch/arm/mach-lpc32xx/include/mach/irqs.h
  11. 20 5
      arch/arm/mach-lpc32xx/irq.c
  12. 19 1
      arch/arm/mach-lpc32xx/serial.c
  13. 0 1
      arch/arm/mach-mmp/aspenite.c
  14. 0 1
      arch/arm/mach-mmp/pxa168.c
  15. 0 1
      arch/arm/mach-mmp/tavorevb.c
  16. 2 2
      arch/arm/mach-omap2/Kconfig
  17. 4 0
      arch/arm/mach-omap2/board-n8x0.c
  18. 1 1
      arch/arm/mach-omap2/board-omap3evm.c
  19. 1 0
      arch/arm/mach-omap2/common.h
  20. 2 3
      arch/arm/mach-omap2/cpuidle44xx.c
  21. 52 0
      arch/arm/mach-omap2/gpmc-smsc911x.c
  22. 6 0
      arch/arm/mach-omap2/hsmmc.c
  23. 1 0
      arch/arm/mach-omap2/io.c
  24. 11 2
      arch/arm/mach-omap2/mailbox.c
  25. 1 1
      arch/arm/mach-omap2/mux.c
  26. 16 9
      arch/arm/mach-omap2/omap4-common.c
  27. 3 0
      arch/arm/mach-omap2/pm.c
  28. 3 3
      arch/arm/mach-omap2/usb-host.c
  29. 2 0
      arch/arm/mach-omap2/voltagedomains3xxx_data.c
  30. 2 0
      arch/arm/mach-omap2/voltagedomains44xx_data.c
  31. 25 0
      arch/arm/mach-pxa/hx4700.c
  32. 0 1
      arch/arm/mach-pxa/pxa25x.c
  33. 0 1
      arch/arm/mach-pxa/pxa27x.c
  34. 0 1
      arch/arm/mach-pxa/saarb.c
  35. 1 2
      arch/arm/mach-pxa/sharpsl_pm.c
  36. 2 3
      arch/arm/mach-pxa/spitz_pm.c
  37. 15 14
      arch/arm/mach-shmobile/board-ag5evm.c
  38. 2 10
      arch/arm/mach-shmobile/board-ap4evb.c
  39. 1 2
      arch/arm/mach-shmobile/board-kota2.c
  40. 21 74
      arch/arm/mach-shmobile/board-mackerel.c
  41. 113 0
      arch/arm/mach-shmobile/clock-sh73a0.c
  42. 3 3
      arch/arm/mach-shmobile/include/mach/sh73a0.h
  43. 2 0
      arch/arm/mach-shmobile/intc-sh73a0.c
  44. 1 1
      arch/arm/mach-shmobile/pfc-r8a7779.c
  45. 41 0
      arch/arm/mach-shmobile/pfc-sh7372.c
  46. 1 1
      arch/arm/mach-shmobile/smp-sh73a0.c
  47. 2 1
      arch/arm/mm/Kconfig
  48. 1 1
      arch/arm/mm/cache-v7.S
  49. 1 0
      arch/arm/plat-omap/common.c
  50. 6 0
      arch/arm/plat-omap/include/plat/omap-secure.h
  51. 1 1
      arch/c6x/boot/Makefile
  52. 2 1
      arch/m68k/include/asm/mcf_pgtable.h
  53. 5 4
      arch/m68k/mm/mcfmmu.c
  54. 1 3
      arch/m68k/platform/coldfire/entry.S
  55. 7 1
      arch/openrisc/include/asm/ptrace.h
  56. 1 0
      arch/openrisc/kernel/init_task.c
  57. 1 0
      arch/openrisc/kernel/irq.c
  58. 4 8
      arch/openrisc/kernel/ptrace.c
  59. 4 0
      arch/parisc/Makefile
  60. 1 1
      arch/powerpc/kernel/entry_32.S
  61. 5 1
      arch/powerpc/kernel/entry_64.S
  62. 1 1
      arch/powerpc/kernel/exceptions-64s.S
  63. 8 4
      arch/powerpc/kernel/signal.c
  64. 1 1
      arch/powerpc/kernel/signal.h
  65. 1 1
      arch/powerpc/platforms/wsp/smp.c
  66. 3 0
      arch/s390/Kconfig
  67. 0 7
      arch/s390/include/asm/compat.h
  68. 1 1
      arch/s390/kernel/compat_wrapper.S
  69. 0 1
      arch/s390/kernel/crash_dump.c
  70. 3 3
      arch/s390/kernel/process.c
  71. 1 1
      arch/s390/kernel/ptrace.c
  72. 1 1
      arch/s390/kernel/setup.c
  73. 0 1
      arch/s390/kernel/signal.c
  74. 5 2
      arch/s390/kernel/time.c
  75. 0 1
      arch/s390/mm/fault.c
  76. 26 4
      arch/s390/mm/init.c
  77. 1 1
      arch/s390/mm/mmap.c
  78. 1 1
      arch/s390/mm/pgtable.c
  79. 9 11
      arch/sh/boards/board-sh7757lcr.c
  80. 1 0
      arch/sh/boards/mach-ap325rxa/setup.c
  81. 2 0
      arch/sh/boards/mach-ecovec24/setup.c
  82. 1 0
      arch/sh/boards/mach-kfr2r09/setup.c
  83. 2 0
      arch/sh/boards/mach-migor/setup.c
  84. 1 0
      arch/sh/boards/mach-se/7724/setup.c
  85. 1 1
      arch/sh/drivers/pci/pci-sh7780.c
  86. 4 4
      arch/sh/include/asm/device.h
  87. 1 1
      arch/sh/kernel/cpu/sh4a/clock-sh7724.c
  88. 21 1
      arch/sh/kernel/cpu/sh4a/setup-sh7757.c
  89. 1 1
      arch/sh/kernel/smp.c
  90. 1 1
      arch/sh/kernel/topology.c
  91. 2 0
      arch/sh/mm/cache-sh2a.c
  92. 38 15
      arch/x86/include/asm/i387.h
  93. 8 0
      arch/x86/include/asm/perf_event.h
  94. 2 1
      arch/x86/include/asm/processor.h
  95. 5 0
      arch/x86/kernel/cpu/common.c
  96. 36 8
      arch/x86/kernel/cpu/intel_cacheinfo.c
  97. 2 0
      arch/x86/kernel/cpu/mcheck/mce_amd.c
  98. 6 2
      arch/x86/kernel/cpu/perf_event.h
  99. 35 2
      arch/x86/kernel/cpu/perf_event_amd.c
  100. 8 1
      arch/x86/kernel/entry_64.S

+ 6 - 9
MAINTAINERS

@@ -269,7 +269,6 @@ S:	Orphan
 F:	drivers/platform/x86/wmi.c
 F:	drivers/platform/x86/wmi.c
 
 
 AD1889 ALSA SOUND DRIVER
 AD1889 ALSA SOUND DRIVER
-M:	Kyle McMartin <kyle@mcmartin.ca>
 M:	Thibaut Varene <T-Bone@parisc-linux.org>
 M:	Thibaut Varene <T-Bone@parisc-linux.org>
 W:	http://wiki.parisc-linux.org/AD1889
 W:	http://wiki.parisc-linux.org/AD1889
 L:	linux-parisc@vger.kernel.org
 L:	linux-parisc@vger.kernel.org
@@ -3047,7 +3046,6 @@ F:	drivers/hwspinlock/hwspinlock_*
 F:	include/linux/hwspinlock.h
 F:	include/linux/hwspinlock.h
 
 
 HARMONY SOUND DRIVER
 HARMONY SOUND DRIVER
-M:	Kyle McMartin <kyle@mcmartin.ca>
 L:	linux-parisc@vger.kernel.org
 L:	linux-parisc@vger.kernel.org
 S:	Maintained
 S:	Maintained
 F:	sound/parisc/harmony.*
 F:	sound/parisc/harmony.*
@@ -3782,7 +3780,7 @@ F:	Documentation/kdump/
 
 
 KERNEL AUTOMOUNTER v4 (AUTOFS4)
 KERNEL AUTOMOUNTER v4 (AUTOFS4)
 M:	Ian Kent <raven@themaw.net>
 M:	Ian Kent <raven@themaw.net>
-L:	autofs@linux.kernel.org
+L:	autofs@vger.kernel.org
 S:	Maintained
 S:	Maintained
 F:	fs/autofs4/
 F:	fs/autofs4/
 
 
@@ -4687,7 +4685,7 @@ NTFS FILESYSTEM
 M:	Anton Altaparmakov <anton@tuxera.com>
 M:	Anton Altaparmakov <anton@tuxera.com>
 L:	linux-ntfs-dev@lists.sourceforge.net
 L:	linux-ntfs-dev@lists.sourceforge.net
 W:	http://www.tuxera.com/
 W:	http://www.tuxera.com/
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs-2.6.git
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/aia21/ntfs.git
 S:	Supported
 S:	Supported
 F:	Documentation/filesystems/ntfs.txt
 F:	Documentation/filesystems/ntfs.txt
 F:	fs/ntfs/
 F:	fs/ntfs/
@@ -5000,9 +4998,8 @@ F:	Documentation/blockdev/paride.txt
 F:	drivers/block/paride/
 F:	drivers/block/paride/
 
 
 PARISC ARCHITECTURE
 PARISC ARCHITECTURE
-M:	Kyle McMartin <kyle@mcmartin.ca>
-M:	Helge Deller <deller@gmx.de>
 M:	"James E.J. Bottomley" <jejb@parisc-linux.org>
 M:	"James E.J. Bottomley" <jejb@parisc-linux.org>
+M:	Helge Deller <deller@gmx.de>
 L:	linux-parisc@vger.kernel.org
 L:	linux-parisc@vger.kernel.org
 W:	http://www.parisc-linux.org/
 W:	http://www.parisc-linux.org/
 Q:	http://patchwork.kernel.org/project/linux-parisc/list/
 Q:	http://patchwork.kernel.org/project/linux-parisc/list/
@@ -5861,7 +5858,7 @@ S:	Maintained
 F:	drivers/mmc/host/sdhci-spear.c
 F:	drivers/mmc/host/sdhci-spear.c
 
 
 SECURITY SUBSYSTEM
 SECURITY SUBSYSTEM
-M:	James Morris <jmorris@namei.org>
+M:	James Morris <james.l.morris@oracle.com>
 L:	linux-security-module@vger.kernel.org (suggested Cc:)
 L:	linux-security-module@vger.kernel.org (suggested Cc:)
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git
 W:	http://security.wiki.kernel.org/
 W:	http://security.wiki.kernel.org/
@@ -5874,7 +5871,7 @@ S:	Supported
 
 
 SELINUX SECURITY MODULE
 SELINUX SECURITY MODULE
 M:	Stephen Smalley <sds@tycho.nsa.gov>
 M:	Stephen Smalley <sds@tycho.nsa.gov>
-M:	James Morris <jmorris@namei.org>
+M:	James Morris <james.l.morris@oracle.com>
 M:	Eric Paris <eparis@parisplace.org>
 M:	Eric Paris <eparis@parisplace.org>
 L:	selinux@tycho.nsa.gov (subscribers-only, general discussion)
 L:	selinux@tycho.nsa.gov (subscribers-only, general discussion)
 W:	http://selinuxproject.org
 W:	http://selinuxproject.org
@@ -7274,7 +7271,7 @@ WATCHDOG DEVICE DRIVERS
 M:	Wim Van Sebroeck <wim@iguana.be>
 M:	Wim Van Sebroeck <wim@iguana.be>
 L:	linux-watchdog@vger.kernel.org
 L:	linux-watchdog@vger.kernel.org
 W:	http://www.linux-watchdog.org/
 W:	http://www.linux-watchdog.org/
-T:	git git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog.git
+T:	git git://www.linux-watchdog.org/linux-watchdog.git
 S:	Maintained
 S:	Maintained
 F:	Documentation/watchdog/
 F:	Documentation/watchdog/
 F:	drivers/watchdog/
 F:	drivers/watchdog/

+ 1 - 1
Makefile

@@ -1,7 +1,7 @@
 VERSION = 3
 VERSION = 3
 PATCHLEVEL = 3
 PATCHLEVEL = 3
 SUBLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc6
 NAME = Saber-toothed Squirrel
 NAME = Saber-toothed Squirrel
 
 
 # *DOCUMENTATION*
 # *DOCUMENTATION*

+ 0 - 7
arch/arm/common/it8152.c

@@ -320,13 +320,6 @@ err0:
 	return -EBUSY;
 	return -EBUSY;
 }
 }
 
 
-/*
- * If we set up a device for bus mastering, we need to check the latency
- * timer as we don't have even crappy BIOSes to set it properly.
- * The implementation is from arch/i386/pci/i386.c
- */
-unsigned int pcibios_max_latency = 255;
-
 /* ITE bridge requires setting latency timer to avoid early bus access
 /* ITE bridge requires setting latency timer to avoid early bus access
    termination by PCI bus master devices
    termination by PCI bus master devices
 */
 */

+ 2 - 1
arch/arm/common/pl330.c

@@ -1502,12 +1502,13 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
 	struct pl330_thread *thrd = ch_id;
 	struct pl330_thread *thrd = ch_id;
 	struct pl330_dmac *pl330;
 	struct pl330_dmac *pl330;
 	unsigned long flags;
 	unsigned long flags;
-	int ret = 0, active = thrd->req_running;
+	int ret = 0, active;
 
 
 	if (!thrd || thrd->free || thrd->dmac->state == DYING)
 	if (!thrd || thrd->free || thrd->dmac->state == DYING)
 		return -EINVAL;
 		return -EINVAL;
 
 
 	pl330 = thrd->dmac;
 	pl330 = thrd->dmac;
+	active = thrd->req_running;
 
 
 	spin_lock_irqsave(&pl330->lock, flags);
 	spin_lock_irqsave(&pl330->lock, flags);
 
 

+ 5 - 0
arch/arm/include/asm/assembler.h

@@ -137,6 +137,11 @@
 	disable_irq
 	disable_irq
 	.endm
 	.endm
 
 
+	.macro	save_and_disable_irqs_notrace, oldcpsr
+	mrs	\oldcpsr, cpsr
+	disable_irq_notrace
+	.endm
+
 /*
 /*
  * Restore interrupt state previously stored in a register.  We don't
  * Restore interrupt state previously stored in a register.  We don't
  * guarantee that this will preserve the flags.
  * guarantee that this will preserve the flags.

+ 1 - 1
arch/arm/include/asm/hardware/pl330.h

@@ -41,7 +41,7 @@ enum pl330_dstcachectrl {
 	DCCTRL1, /* Bufferable only */
 	DCCTRL1, /* Bufferable only */
 	DCCTRL2, /* Cacheable, but do not allocate */
 	DCCTRL2, /* Cacheable, but do not allocate */
 	DCCTRL3, /* Cacheable and bufferable, but do not allocate */
 	DCCTRL3, /* Cacheable and bufferable, but do not allocate */
-	DINVALID1 = 8,
+	DINVALID1,              /* AWCACHE = 0x1000 */
 	DINVALID2,
 	DINVALID2,
 	DCCTRL6, /* Cacheable write-through, allocate on writes only */
 	DCCTRL6, /* Cacheable write-through, allocate on writes only */
 	DCCTRL7, /* Cacheable write-back, allocate on writes only */
 	DCCTRL7, /* Cacheable write-back, allocate on writes only */

+ 1 - 0
arch/arm/include/asm/processor.h

@@ -22,6 +22,7 @@
 #include <asm/hw_breakpoint.h>
 #include <asm/hw_breakpoint.h>
 #include <asm/ptrace.h>
 #include <asm/ptrace.h>
 #include <asm/types.h>
 #include <asm/types.h>
+#include <asm/system.h>
 
 
 #ifdef __KERNEL__
 #ifdef __KERNEL__
 #define STACK_TOP	((current->personality & ADDR_LIMIT_32BIT) ? \
 #define STACK_TOP	((current->personality & ADDR_LIMIT_32BIT) ? \

+ 8 - 1
arch/arm/kernel/ptrace.c

@@ -23,6 +23,7 @@
 #include <linux/perf_event.h>
 #include <linux/perf_event.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/regset.h>
 #include <linux/regset.h>
+#include <linux/audit.h>
 
 
 #include <asm/pgtable.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
 #include <asm/system.h>
@@ -904,6 +905,12 @@ long arch_ptrace(struct task_struct *child, long request,
 	return ret;
 	return ret;
 }
 }
 
 
+#ifdef __ARMEB__
+#define AUDIT_ARCH_NR AUDIT_ARCH_ARMEB
+#else
+#define AUDIT_ARCH_NR AUDIT_ARCH_ARM
+#endif
+
 asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
 asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
 {
 {
 	unsigned long ip;
 	unsigned long ip;
@@ -918,7 +925,7 @@ asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
 	if (!ip)
 	if (!ip)
 		audit_syscall_exit(regs);
 		audit_syscall_exit(regs);
 	else
 	else
-		audit_syscall_entry(AUDIT_ARCH_ARMEB, scno, regs->ARM_r0,
+		audit_syscall_entry(AUDIT_ARCH_NR, scno, regs->ARM_r0,
 				    regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);
 				    regs->ARM_r1, regs->ARM_r2, regs->ARM_r3);
 
 
 	if (!test_thread_flag(TIF_SYSCALL_TRACE))
 	if (!test_thread_flag(TIF_SYSCALL_TRACE))

+ 1 - 1
arch/arm/kernel/smp_twd.c

@@ -129,7 +129,7 @@ static struct notifier_block twd_cpufreq_nb = {
 
 
 static int twd_cpufreq_init(void)
 static int twd_cpufreq_init(void)
 {
 {
-	if (!IS_ERR(twd_clk))
+	if (twd_evt && *__this_cpu_ptr(twd_evt) && !IS_ERR(twd_clk))
 		return cpufreq_register_notifier(&twd_cpufreq_nb,
 		return cpufreq_register_notifier(&twd_cpufreq_nb,
 			CPUFREQ_TRANSITION_NOTIFIER);
 			CPUFREQ_TRANSITION_NOTIFIER);
 
 

+ 1 - 1
arch/arm/mach-lpc32xx/include/mach/irqs.h

@@ -61,7 +61,7 @@
  */
  */
 #define IRQ_LPC32XX_JTAG_COMM_TX	LPC32XX_SIC1_IRQ(1)
 #define IRQ_LPC32XX_JTAG_COMM_TX	LPC32XX_SIC1_IRQ(1)
 #define IRQ_LPC32XX_JTAG_COMM_RX	LPC32XX_SIC1_IRQ(2)
 #define IRQ_LPC32XX_JTAG_COMM_RX	LPC32XX_SIC1_IRQ(2)
-#define IRQ_LPC32XX_GPI_11		LPC32XX_SIC1_IRQ(4)
+#define IRQ_LPC32XX_GPI_28		LPC32XX_SIC1_IRQ(4)
 #define IRQ_LPC32XX_TS_P		LPC32XX_SIC1_IRQ(6)
 #define IRQ_LPC32XX_TS_P		LPC32XX_SIC1_IRQ(6)
 #define IRQ_LPC32XX_TS_IRQ		LPC32XX_SIC1_IRQ(7)
 #define IRQ_LPC32XX_TS_IRQ		LPC32XX_SIC1_IRQ(7)
 #define IRQ_LPC32XX_TS_AUX		LPC32XX_SIC1_IRQ(8)
 #define IRQ_LPC32XX_TS_AUX		LPC32XX_SIC1_IRQ(8)

+ 20 - 5
arch/arm/mach-lpc32xx/irq.c

@@ -118,6 +118,10 @@ static const struct lpc32xx_event_info lpc32xx_events[NR_IRQS] = {
 		.event_group = &lpc32xx_event_pin_regs,
 		.event_group = &lpc32xx_event_pin_regs,
 		.mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT,
 		.mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT,
 	},
 	},
+	[IRQ_LPC32XX_GPI_28] = {
+		.event_group = &lpc32xx_event_pin_regs,
+		.mask = LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT,
+	},
 	[IRQ_LPC32XX_GPIO_00] = {
 	[IRQ_LPC32XX_GPIO_00] = {
 		.event_group = &lpc32xx_event_int_regs,
 		.event_group = &lpc32xx_event_int_regs,
 		.mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT,
 		.mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT,
@@ -305,9 +309,18 @@ static int lpc32xx_irq_wake(struct irq_data *d, unsigned int state)
 
 
 		if (state)
 		if (state)
 			eventreg |= lpc32xx_events[d->irq].mask;
 			eventreg |= lpc32xx_events[d->irq].mask;
-		else
+		else {
 			eventreg &= ~lpc32xx_events[d->irq].mask;
 			eventreg &= ~lpc32xx_events[d->irq].mask;
 
 
+			/*
+			 * When disabling the wakeup, clear the latched
+			 * event
+			 */
+			__raw_writel(lpc32xx_events[d->irq].mask,
+				lpc32xx_events[d->irq].
+				event_group->rawstat_reg);
+		}
+
 		__raw_writel(eventreg,
 		__raw_writel(eventreg,
 			lpc32xx_events[d->irq].event_group->enab_reg);
 			lpc32xx_events[d->irq].event_group->enab_reg);
 
 
@@ -380,13 +393,15 @@ void __init lpc32xx_init_irq(void)
 
 
 	/* Setup SIC1 */
 	/* Setup SIC1 */
 	__raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
 	__raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
-	__raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE));
-	__raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE));
+	__raw_writel(SIC1_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE));
+	__raw_writel(SIC1_ATR_DEFAULT,
+				LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE));
 
 
 	/* Setup SIC2 */
 	/* Setup SIC2 */
 	__raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
 	__raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
-	__raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE));
-	__raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE));
+	__raw_writel(SIC2_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE));
+	__raw_writel(SIC2_ATR_DEFAULT,
+				LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE));
 
 
 	/* Configure supported IRQ's */
 	/* Configure supported IRQ's */
 	for (i = 0; i < NR_IRQS; i++) {
 	for (i = 0; i < NR_IRQS; i++) {

+ 19 - 1
arch/arm/mach-lpc32xx/serial.c

@@ -88,6 +88,7 @@ struct uartinit {
 	char *uart_ck_name;
 	char *uart_ck_name;
 	u32 ck_mode_mask;
 	u32 ck_mode_mask;
 	void __iomem *pdiv_clk_reg;
 	void __iomem *pdiv_clk_reg;
+	resource_size_t mapbase;
 };
 };
 
 
 static struct uartinit uartinit_data[] __initdata = {
 static struct uartinit uartinit_data[] __initdata = {
@@ -97,6 +98,7 @@ static struct uartinit uartinit_data[] __initdata = {
 		.ck_mode_mask =
 		.ck_mode_mask =
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5),
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5),
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL,
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL,
+		.mapbase = LPC32XX_UART5_BASE,
 	},
 	},
 #endif
 #endif
 #ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
 #ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
@@ -105,6 +107,7 @@ static struct uartinit uartinit_data[] __initdata = {
 		.ck_mode_mask =
 		.ck_mode_mask =
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3),
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3),
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL,
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL,
+		.mapbase = LPC32XX_UART3_BASE,
 	},
 	},
 #endif
 #endif
 #ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
 #ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
@@ -113,6 +116,7 @@ static struct uartinit uartinit_data[] __initdata = {
 		.ck_mode_mask =
 		.ck_mode_mask =
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4),
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4),
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL,
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL,
+		.mapbase = LPC32XX_UART4_BASE,
 	},
 	},
 #endif
 #endif
 #ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
 #ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
@@ -121,6 +125,7 @@ static struct uartinit uartinit_data[] __initdata = {
 		.ck_mode_mask =
 		.ck_mode_mask =
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6),
 			LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6),
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL,
 		.pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL,
+		.mapbase = LPC32XX_UART6_BASE,
 	},
 	},
 #endif
 #endif
 };
 };
@@ -165,11 +170,24 @@ void __init lpc32xx_serial_init(void)
 
 
 		/* pre-UART clock divider set to 1 */
 		/* pre-UART clock divider set to 1 */
 		__raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg);
 		__raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg);
+
+		/*
+		 * Force a flush of the RX FIFOs to work around a
+		 * HW bug
+		 */
+		puart = uartinit_data[i].mapbase;
+		__raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
+		__raw_writel(0x00, LPC32XX_UART_DLL_FIFO(puart));
+		j = LPC32XX_SUART_FIFO_SIZE;
+		while (j--)
+			tmp = __raw_readl(
+				LPC32XX_UART_DLL_FIFO(puart));
+		__raw_writel(0, LPC32XX_UART_IIR_FCR(puart));
 	}
 	}
 
 
 	/* This needs to be done after all UART clocks are setup */
 	/* This needs to be done after all UART clocks are setup */
 	__raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE);
 	__raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE);
-	for (i = 0; i < ARRAY_SIZE(uartinit_data) - 1; i++) {
+	for (i = 0; i < ARRAY_SIZE(uartinit_data); i++) {
 		/* Force a flush of the RX FIFOs to work around a HW bug */
 		/* Force a flush of the RX FIFOs to work around a HW bug */
 		puart = serial_std_platform_data[i].mapbase;
 		puart = serial_std_platform_data[i].mapbase;
 		__raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
 		__raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));

+ 0 - 1
arch/arm/mach-mmp/aspenite.c

@@ -17,7 +17,6 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/nand.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
-#include <linux/gpio.h>
 
 
 #include <asm/mach-types.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/arch.h>

+ 0 - 1
arch/arm/mach-mmp/pxa168.c

@@ -24,7 +24,6 @@
 #include <mach/dma.h>
 #include <mach/dma.h>
 #include <mach/devices.h>
 #include <mach/devices.h>
 #include <mach/mfp.h>
 #include <mach/mfp.h>
-#include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-mapping.h>
 #include <mach/pxa168.h>
 #include <mach/pxa168.h>
 
 

+ 0 - 1
arch/arm/mach-mmp/tavorevb.c

@@ -12,7 +12,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/smc91x.h>
 #include <linux/smc91x.h>
-#include <linux/gpio.h>
 
 
 #include <asm/mach-types.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/arch.h>

+ 2 - 2
arch/arm/mach-omap2/Kconfig

@@ -364,8 +364,8 @@ config OMAP3_SDRC_AC_TIMING
 	  going on could result in system crashes;
 	  going on could result in system crashes;
 
 
 config OMAP4_ERRATA_I688
 config OMAP4_ERRATA_I688
-	bool "OMAP4 errata: Async Bridge Corruption (BROKEN)"
-	depends on ARCH_OMAP4 && BROKEN
+	bool "OMAP4 errata: Async Bridge Corruption"
+	depends on ARCH_OMAP4
 	select ARCH_HAS_BARRIERS
 	select ARCH_HAS_BARRIERS
 	help
 	help
 	  If a data is stalled inside asynchronous bridge because of back
 	  If a data is stalled inside asynchronous bridge because of back

+ 4 - 0
arch/arm/mach-omap2/board-n8x0.c

@@ -371,7 +371,11 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
 	else
 	else
 		*openp = 0;
 		*openp = 0;
 
 
+#ifdef CONFIG_MMC_OMAP
 	omap_mmc_notify_cover_event(mmc_device, index, *openp);
 	omap_mmc_notify_cover_event(mmc_device, index, *openp);
+#else
+	pr_warn("MMC: notify cover event not available\n");
+#endif
 }
 }
 
 
 static int n8x0_mmc_late_init(struct device *dev)
 static int n8x0_mmc_late_init(struct device *dev)

+ 1 - 1
arch/arm/mach-omap2/board-omap3evm.c

@@ -381,7 +381,7 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
 	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
 	gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
 
 
 	/* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
 	/* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
-	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
+	gpio_leds[0].gpio = gpio + TWL4030_GPIO_MAX + 1;
 
 
 	platform_device_register(&leds_gpio);
 	platform_device_register(&leds_gpio);
 
 

+ 1 - 0
arch/arm/mach-omap2/common.h

@@ -132,6 +132,7 @@ void omap3_map_io(void);
 void am33xx_map_io(void);
 void am33xx_map_io(void);
 void omap4_map_io(void);
 void omap4_map_io(void);
 void ti81xx_map_io(void);
 void ti81xx_map_io(void);
+void omap_barriers_init(void);
 
 
 /**
 /**
  * omap_test_timeout - busy-loop, testing a condition
  * omap_test_timeout - busy-loop, testing a condition

+ 2 - 3
arch/arm/mach-omap2/cpuidle44xx.c

@@ -65,7 +65,6 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
 	struct timespec ts_preidle, ts_postidle, ts_idle;
 	struct timespec ts_preidle, ts_postidle, ts_idle;
 	u32 cpu1_state;
 	u32 cpu1_state;
 	int idle_time;
 	int idle_time;
-	int new_state_idx;
 	int cpu_id = smp_processor_id();
 	int cpu_id = smp_processor_id();
 
 
 	/* Used to keep track of the total time in idle */
 	/* Used to keep track of the total time in idle */
@@ -84,8 +83,8 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
 	 */
 	 */
 	cpu1_state = pwrdm_read_pwrst(cpu1_pd);
 	cpu1_state = pwrdm_read_pwrst(cpu1_pd);
 	if (cpu1_state != PWRDM_POWER_OFF) {
 	if (cpu1_state != PWRDM_POWER_OFF) {
-		new_state_idx = drv->safe_state_index;
-		cx = cpuidle_get_statedata(&dev->states_usage[new_state_idx]);
+		index = drv->safe_state_index;
+		cx = cpuidle_get_statedata(&dev->states_usage[index]);
 	}
 	}
 
 
 	if (index > 0)
 	if (index > 0)

+ 52 - 0
arch/arm/mach-omap2/gpmc-smsc911x.c

@@ -19,6 +19,8 @@
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/smsc911x.h>
 #include <linux/smsc911x.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
 
 
 #include <plat/board.h>
 #include <plat/board.h>
 #include <plat/gpmc.h>
 #include <plat/gpmc.h>
@@ -42,6 +44,50 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = {
 	.flags		= SMSC911X_USE_16BIT,
 	.flags		= SMSC911X_USE_16BIT,
 };
 };
 
 
+static struct regulator_consumer_supply gpmc_smsc911x_supply[] = {
+	REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
+	REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
+};
+
+/* Generic regulator definition to satisfy smsc911x */
+static struct regulator_init_data gpmc_smsc911x_reg_init_data = {
+	.constraints = {
+		.min_uV			= 3300000,
+		.max_uV			= 3300000,
+		.valid_modes_mask	= REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask		= REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies	= ARRAY_SIZE(gpmc_smsc911x_supply),
+	.consumer_supplies	= gpmc_smsc911x_supply,
+};
+
+static struct fixed_voltage_config gpmc_smsc911x_fixed_reg_data = {
+	.supply_name		= "gpmc_smsc911x",
+	.microvolts		= 3300000,
+	.gpio			= -EINVAL,
+	.startup_delay		= 0,
+	.enable_high		= 0,
+	.enabled_at_boot	= 1,
+	.init_data		= &gpmc_smsc911x_reg_init_data,
+};
+
+/*
+ * Platform device id of 42 is a temporary fix to avoid conflicts
+ * with other reg-fixed-voltage devices. The real fix should
+ * involve the driver core providing a way of dynamically
+ * assigning a unique id on registration for platform devices
+ * in the same name space.
+ */
+static struct platform_device gpmc_smsc911x_regulator = {
+	.name		= "reg-fixed-voltage",
+	.id		= 42,
+	.dev = {
+		.platform_data	= &gpmc_smsc911x_fixed_reg_data,
+	},
+};
+
 /*
 /*
  * Initialize smsc911x device connected to the GPMC. Note that we
  * Initialize smsc911x device connected to the GPMC. Note that we
  * assume that pin multiplexing is done in the board-*.c file,
  * assume that pin multiplexing is done in the board-*.c file,
@@ -55,6 +101,12 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
 
 
 	gpmc_cfg = board_data;
 	gpmc_cfg = board_data;
 
 
+	ret = platform_device_register(&gpmc_smsc911x_regulator);
+	if (ret < 0) {
+		pr_err("Unable to register smsc911x regulators: %d\n", ret);
+		return;
+	}
+
 	if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
 	if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
 		pr_err("Failed to request GPMC mem region\n");
 		pr_err("Failed to request GPMC mem region\n");
 		return;
 		return;

+ 6 - 0
arch/arm/mach-omap2/hsmmc.c

@@ -428,6 +428,7 @@ static int omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
 	return 0;
 	return 0;
 }
 }
 
 
+static int omap_hsmmc_done;
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN		16
 #define MAX_OMAP_MMC_HWMOD_NAME_LEN		16
 
 
 void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
 void omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
@@ -491,6 +492,11 @@ void omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 {
 {
 	u32 reg;
 	u32 reg;
 
 
+	if (omap_hsmmc_done)
+		return;
+
+	omap_hsmmc_done = 1;
+
 	if (!cpu_is_omap44xx()) {
 	if (!cpu_is_omap44xx()) {
 		if (cpu_is_omap2430()) {
 		if (cpu_is_omap2430()) {
 			control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;
 			control_pbias_offset = OMAP243X_CONTROL_PBIAS_LITE;

+ 1 - 0
arch/arm/mach-omap2/io.c

@@ -306,6 +306,7 @@ void __init omapam33xx_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 void __init omap44xx_map_common_io(void)
 {
 {
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
 	iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
+	omap_barriers_init();
 }
 }
 #endif
 #endif
 
 

+ 11 - 2
arch/arm/mach-omap2/mailbox.c

@@ -281,8 +281,16 @@ static struct omap_mbox mbox_iva_info = {
 	.ops	= &omap2_mbox_ops,
 	.ops	= &omap2_mbox_ops,
 	.priv	= &omap2_mbox_iva_priv,
 	.priv	= &omap2_mbox_iva_priv,
 };
 };
+#endif
 
 
-struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL };
+#ifdef CONFIG_ARCH_OMAP2
+struct omap_mbox *omap2_mboxes[] = {
+	&mbox_dsp_info,
+#ifdef CONFIG_SOC_OMAP2420
+	&mbox_iva_info,
+#endif
+	NULL
+};
 #endif
 #endif
 
 
 #if defined(CONFIG_ARCH_OMAP4)
 #if defined(CONFIG_ARCH_OMAP4)
@@ -412,7 +420,8 @@ static void __exit omap2_mbox_exit(void)
 	platform_driver_unregister(&omap2_mbox_driver);
 	platform_driver_unregister(&omap2_mbox_driver);
 }
 }
 
 
-module_init(omap2_mbox_init);
+/* must be ready before omap3isp is probed */
+subsys_initcall(omap2_mbox_init);
 module_exit(omap2_mbox_exit);
 module_exit(omap2_mbox_exit);
 
 
 MODULE_LICENSE("GPL v2");
 MODULE_LICENSE("GPL v2");

+ 1 - 1
arch/arm/mach-omap2/mux.c

@@ -218,7 +218,7 @@ static int _omap_mux_get_by_name(struct omap_mux_partition *partition,
 	return -ENODEV;
 	return -ENODEV;
 }
 }
 
 
-static int __init
+static int
 omap_mux_get_by_name(const char *muxname,
 omap_mux_get_by_name(const char *muxname,
 			struct omap_mux_partition **found_partition,
 			struct omap_mux_partition **found_partition,
 			struct omap_mux **found_mux)
 			struct omap_mux **found_mux)

+ 16 - 9
arch/arm/mach-omap2/omap4-common.c

@@ -24,6 +24,7 @@
 
 
 #include <plat/irqs.h>
 #include <plat/irqs.h>
 #include <plat/sram.h>
 #include <plat/sram.h>
+#include <plat/omap-secure.h>
 
 
 #include <mach/hardware.h>
 #include <mach/hardware.h>
 #include <mach/omap-wakeupgen.h>
 #include <mach/omap-wakeupgen.h>
@@ -43,6 +44,9 @@ static void __iomem *sar_ram_base;
 
 
 void __iomem *dram_sync, *sram_sync;
 void __iomem *dram_sync, *sram_sync;
 
 
+static phys_addr_t paddr;
+static u32 size;
+
 void omap_bus_sync(void)
 void omap_bus_sync(void)
 {
 {
 	if (dram_sync && sram_sync) {
 	if (dram_sync && sram_sync) {
@@ -52,18 +56,20 @@ void omap_bus_sync(void)
 	}
 	}
 }
 }
 
 
-static int __init omap_barriers_init(void)
+/* Steal one page physical memory for barrier implementation */
+int __init omap_barrier_reserve_memblock(void)
 {
 {
-	struct map_desc dram_io_desc[1];
-	phys_addr_t paddr;
-	u32 size;
-
-	if (!cpu_is_omap44xx())
-		return -ENODEV;
 
 
 	size = ALIGN(PAGE_SIZE, SZ_1M);
 	size = ALIGN(PAGE_SIZE, SZ_1M);
 	paddr = arm_memblock_steal(size, SZ_1M);
 	paddr = arm_memblock_steal(size, SZ_1M);
 
 
+	return 0;
+}
+
+void __init omap_barriers_init(void)
+{
+	struct map_desc dram_io_desc[1];
+
 	dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
 	dram_io_desc[0].virtual = OMAP4_DRAM_BARRIER_VA;
 	dram_io_desc[0].pfn = __phys_to_pfn(paddr);
 	dram_io_desc[0].pfn = __phys_to_pfn(paddr);
 	dram_io_desc[0].length = size;
 	dram_io_desc[0].length = size;
@@ -75,9 +81,10 @@ static int __init omap_barriers_init(void)
 	pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n",
 	pr_info("OMAP4: Map 0x%08llx to 0x%08lx for dram barrier\n",
 		(long long) paddr, dram_io_desc[0].virtual);
 		(long long) paddr, dram_io_desc[0].virtual);
 
 
-	return 0;
 }
 }
-core_initcall(omap_barriers_init);
+#else
+void __init omap_barriers_init(void)
+{}
 #endif
 #endif
 
 
 void __init gic_init_irq(void)
 void __init gic_init_irq(void)

+ 3 - 0
arch/arm/mach-omap2/pm.c

@@ -174,14 +174,17 @@ static int __init omap2_set_init_voltage(char *vdd_name, char *clk_name,
 	freq = clk->rate;
 	freq = clk->rate;
 	clk_put(clk);
 	clk_put(clk);
 
 
+	rcu_read_lock();
 	opp = opp_find_freq_ceil(dev, &freq);
 	opp = opp_find_freq_ceil(dev, &freq);
 	if (IS_ERR(opp)) {
 	if (IS_ERR(opp)) {
+		rcu_read_unlock();
 		pr_err("%s: unable to find boot up OPP for vdd_%s\n",
 		pr_err("%s: unable to find boot up OPP for vdd_%s\n",
 			__func__, vdd_name);
 			__func__, vdd_name);
 		goto exit;
 		goto exit;
 	}
 	}
 
 
 	bootup_volt = opp_get_voltage(opp);
 	bootup_volt = opp_get_voltage(opp);
+	rcu_read_unlock();
 	if (!bootup_volt) {
 	if (!bootup_volt) {
 		pr_err("%s: unable to find voltage corresponding "
 		pr_err("%s: unable to find voltage corresponding "
 			"to the bootup OPP for vdd_%s\n", __func__, vdd_name);
 			"to the bootup OPP for vdd_%s\n", __func__, vdd_name);

+ 3 - 3
arch/arm/mach-omap2/usb-host.c

@@ -486,7 +486,7 @@ static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
 {
 	struct omap_hwmod	*oh[2];
 	struct omap_hwmod	*oh[2];
-	struct omap_device	*od;
+	struct platform_device	*pdev;
 	int			bus_id = -1;
 	int			bus_id = -1;
 	int			i;
 	int			i;
 
 
@@ -522,11 +522,11 @@ void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 		return;
 		return;
 	}
 	}
 
 
-	od = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
+	pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
 				(void *)&usbhs_data, sizeof(usbhs_data),
 				(void *)&usbhs_data, sizeof(usbhs_data),
 				omap_uhhtll_latency,
 				omap_uhhtll_latency,
 				ARRAY_SIZE(omap_uhhtll_latency), false);
 				ARRAY_SIZE(omap_uhhtll_latency), false);
-	if (IS_ERR(od)) {
+	if (IS_ERR(pdev)) {
 		pr_err("Could not build hwmod devices %s,%s\n",
 		pr_err("Could not build hwmod devices %s,%s\n",
 			USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
 			USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
 		return;
 		return;

+ 2 - 0
arch/arm/mach-omap2/voltagedomains3xxx_data.c

@@ -108,6 +108,7 @@ void __init omap3xxx_voltagedomains_init(void)
 	 * XXX Will depend on the process, validation, and binning
 	 * XXX Will depend on the process, validation, and binning
 	 * for the currently-running IC
 	 * for the currently-running IC
 	 */
 	 */
+#ifdef CONFIG_PM_OPP
 	if (cpu_is_omap3630()) {
 	if (cpu_is_omap3630()) {
 		omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
 		omap3_voltdm_mpu.volt_data = omap36xx_vddmpu_volt_data;
 		omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
 		omap3_voltdm_core.volt_data = omap36xx_vddcore_volt_data;
@@ -115,6 +116,7 @@ void __init omap3xxx_voltagedomains_init(void)
 		omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
 		omap3_voltdm_mpu.volt_data = omap34xx_vddmpu_volt_data;
 		omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
 		omap3_voltdm_core.volt_data = omap34xx_vddcore_volt_data;
 	}
 	}
+#endif
 
 
 	if (cpu_is_omap3517() || cpu_is_omap3505())
 	if (cpu_is_omap3517() || cpu_is_omap3505())
 		voltdms = voltagedomains_am35xx;
 		voltdms = voltagedomains_am35xx;

+ 2 - 0
arch/arm/mach-omap2/voltagedomains44xx_data.c

@@ -100,9 +100,11 @@ void __init omap44xx_voltagedomains_init(void)
 	 * XXX Will depend on the process, validation, and binning
 	 * XXX Will depend on the process, validation, and binning
 	 * for the currently-running IC
 	 * for the currently-running IC
 	 */
 	 */
+#ifdef CONFIG_PM_OPP
 	omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data;
 	omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data;
 	omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data;
 	omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data;
 	omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data;
 	omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data;
+#endif
 
 
 	for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
 	for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
 		voltdm->sys_clk.name = sys_clk_name;
 		voltdm->sys_clk.name = sys_clk_name;

+ 25 - 0
arch/arm/mach-pxa/hx4700.c

@@ -45,6 +45,7 @@
 #include <mach/hx4700.h>
 #include <mach/hx4700.h>
 #include <mach/irda.h>
 #include <mach/irda.h>
 
 
+#include <sound/ak4641.h>
 #include <video/platform_lcd.h>
 #include <video/platform_lcd.h>
 #include <video/w100fb.h>
 #include <video/w100fb.h>
 
 
@@ -764,6 +765,28 @@ static struct i2c_board_info __initdata pi2c_board_info[] = {
 	},
 	},
 };
 };
 
 
+/*
+ * Asahi Kasei AK4641 on I2C
+ */
+
+static struct ak4641_platform_data ak4641_info = {
+	.gpio_power = GPIO27_HX4700_CODEC_ON,
+	.gpio_npdn  = GPIO109_HX4700_CODEC_nPDN,
+};
+
+static struct i2c_board_info i2c_board_info[] __initdata = {
+	{
+		I2C_BOARD_INFO("ak4641", 0x12),
+		.platform_data = &ak4641_info,
+	},
+};
+
+static struct platform_device audio = {
+	.name	= "hx4700-audio",
+	.id	= -1,
+};
+
+
 /*
 /*
  * PCMCIA
  * PCMCIA
  */
  */
@@ -790,6 +813,7 @@ static struct platform_device *devices[] __initdata = {
 	&gpio_vbus,
 	&gpio_vbus,
 	&power_supply,
 	&power_supply,
 	&strataflash,
 	&strataflash,
+	&audio,
 	&pcmcia,
 	&pcmcia,
 };
 };
 
 
@@ -827,6 +851,7 @@ static void __init hx4700_init(void)
 	pxa_set_ficp_info(&ficp_info);
 	pxa_set_ficp_info(&ficp_info);
 	pxa27x_set_i2c_power_info(NULL);
 	pxa27x_set_i2c_power_info(NULL);
 	pxa_set_i2c_info(NULL);
 	pxa_set_i2c_info(NULL);
+	i2c_register_board_info(0, ARRAY_AND_SIZE(i2c_board_info));
 	i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info));
 	i2c_register_board_info(1, ARRAY_AND_SIZE(pi2c_board_info));
 	pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
 	pxa2xx_set_spi_info(2, &pxa_ssp2_master_info);
 	spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info));
 	spi_register_board_info(ARRAY_AND_SIZE(tsc2046_board_info));

+ 0 - 1
arch/arm/mach-pxa/pxa25x.c

@@ -25,7 +25,6 @@
 #include <linux/suspend.h>
 #include <linux/suspend.h>
 #include <linux/syscore_ops.h>
 #include <linux/syscore_ops.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 
 
 #include <asm/mach/map.h>
 #include <asm/mach/map.h>
 #include <asm/suspend.h>
 #include <asm/suspend.h>

+ 0 - 1
arch/arm/mach-pxa/pxa27x.c

@@ -22,7 +22,6 @@
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/i2c/pxa-i2c.h>
-#include <linux/gpio.h>
 
 
 #include <asm/mach/map.h>
 #include <asm/mach/map.h>
 #include <mach/hardware.h>
 #include <mach/hardware.h>

+ 0 - 1
arch/arm/mach-pxa/saarb.c

@@ -15,7 +15,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <linux/mfd/88pm860x.h>
 #include <linux/mfd/88pm860x.h>
-#include <linux/gpio.h>
 
 
 #include <asm/mach-types.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/arch.h>

+ 1 - 2
arch/arm/mach-pxa/sharpsl_pm.c

@@ -168,6 +168,7 @@ struct battery_thresh sharpsl_battery_levels_noac[] = {
 #define MAXCTRL_SEL_SH   4
 #define MAXCTRL_SEL_SH   4
 #define MAXCTRL_STR      (1u << 7)
 #define MAXCTRL_STR      (1u << 7)
 
 
+extern int max1111_read_channel(int);
 /*
 /*
  * Read MAX1111 ADC
  * Read MAX1111 ADC
  */
  */
@@ -177,8 +178,6 @@ int sharpsl_pm_pxa_read_max1111(int channel)
 	if (machine_is_tosa())
 	if (machine_is_tosa())
 	    return 0;
 	    return 0;
 
 
-	extern int max1111_read_channel(int);
-
 	/* max1111 accepts channels from 0-3, however,
 	/* max1111 accepts channels from 0-3, however,
 	 * it is encoded from 0-7 here in the code.
 	 * it is encoded from 0-7 here in the code.
 	 */
 	 */

+ 2 - 3
arch/arm/mach-pxa/spitz_pm.c

@@ -172,10 +172,9 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
 static unsigned long spitz_charger_wakeup(void)
 static unsigned long spitz_charger_wakeup(void)
 {
 {
 	unsigned long ret;
 	unsigned long ret;
-	ret = (!gpio_get_value(SPITZ_GPIO_KEY_INT)
+	ret = ((!gpio_get_value(SPITZ_GPIO_KEY_INT)
 		<< GPIO_bit(SPITZ_GPIO_KEY_INT))
 		<< GPIO_bit(SPITZ_GPIO_KEY_INT))
-		| (!gpio_get_value(SPITZ_GPIO_SYNC)
-		<< GPIO_bit(SPITZ_GPIO_SYNC));
+		| gpio_get_value(SPITZ_GPIO_SYNC));
 	return ret;
 	return ret;
 }
 }
 
 

+ 15 - 14
arch/arm/mach-shmobile/board-ag5evm.c

@@ -30,6 +30,7 @@
 #include <linux/serial_sci.h>
 #include <linux/serial_sci.h>
 #include <linux/smsc911x.h>
 #include <linux/smsc911x.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
+#include <linux/videodev2.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/host.h>
@@ -37,7 +38,6 @@
 #include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mfd/tmio.h>
 #include <linux/sh_clk.h>
 #include <linux/sh_clk.h>
-#include <linux/dma-mapping.h>
 #include <video/sh_mobile_lcdc.h>
 #include <video/sh_mobile_lcdc.h>
 #include <video/sh_mipi_dsi.h>
 #include <video/sh_mipi_dsi.h>
 #include <sound/sh_fsi.h>
 #include <sound/sh_fsi.h>
@@ -159,19 +159,12 @@ static struct resource sh_mmcif_resources[] = {
 	},
 	},
 };
 };
 
 
-static struct sh_mmcif_dma sh_mmcif_dma = {
-	.chan_priv_rx	= {
-		.slave_id	= SHDMA_SLAVE_MMCIF_RX,
-	},
-	.chan_priv_tx	= {
-		.slave_id	= SHDMA_SLAVE_MMCIF_TX,
-	},
-};
 static struct sh_mmcif_plat_data sh_mmcif_platdata = {
 static struct sh_mmcif_plat_data sh_mmcif_platdata = {
 	.sup_pclk	= 0,
 	.sup_pclk	= 0,
 	.ocr		= MMC_VDD_165_195,
 	.ocr		= MMC_VDD_165_195,
 	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
 	.caps		= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
-	.dma		= &sh_mmcif_dma,
+	.slave_id_tx	= SHDMA_SLAVE_MMCIF_TX,
+	.slave_id_rx	= SHDMA_SLAVE_MMCIF_RX,
 };
 };
 
 
 static struct platform_device mmc_device = {
 static struct platform_device mmc_device = {
@@ -321,12 +314,11 @@ static struct resource mipidsi0_resources[] = {
 	},
 	},
 };
 };
 
 
-#define DSI0PHYCR	0xe615006c
 static int sh_mipi_set_dot_clock(struct platform_device *pdev,
 static int sh_mipi_set_dot_clock(struct platform_device *pdev,
 				 void __iomem *base,
 				 void __iomem *base,
 				 int enable)
 				 int enable)
 {
 {
-	struct clk *pck;
+	struct clk *pck, *phy;
 	int ret;
 	int ret;
 
 
 	pck = clk_get(&pdev->dev, "dsip_clk");
 	pck = clk_get(&pdev->dev, "dsip_clk");
@@ -335,18 +327,27 @@ static int sh_mipi_set_dot_clock(struct platform_device *pdev,
 		goto sh_mipi_set_dot_clock_pck_err;
 		goto sh_mipi_set_dot_clock_pck_err;
 	}
 	}
 
 
+	phy = clk_get(&pdev->dev, "dsiphy_clk");
+	if (IS_ERR(phy)) {
+		ret = PTR_ERR(phy);
+		goto sh_mipi_set_dot_clock_phy_err;
+	}
+
 	if (enable) {
 	if (enable) {
 		clk_set_rate(pck, clk_round_rate(pck,  24000000));
 		clk_set_rate(pck, clk_round_rate(pck,  24000000));
-		__raw_writel(0x2a809010, DSI0PHYCR);
+		clk_set_rate(phy, clk_round_rate(pck, 510000000));
 		clk_enable(pck);
 		clk_enable(pck);
+		clk_enable(phy);
 	} else {
 	} else {
 		clk_disable(pck);
 		clk_disable(pck);
+		clk_disable(phy);
 	}
 	}
 
 
 	ret = 0;
 	ret = 0;
 
 
+	clk_put(phy);
+sh_mipi_set_dot_clock_phy_err:
 	clk_put(pck);
 	clk_put(pck);
-
 sh_mipi_set_dot_clock_pck_err:
 sh_mipi_set_dot_clock_pck_err:
 	return ret;
 	return ret;
 }
 }

+ 2 - 10
arch/arm/mach-shmobile/board-ap4evb.c

@@ -295,15 +295,6 @@ static struct resource sh_mmcif_resources[] = {
 	},
 	},
 };
 };
 
 
-static struct sh_mmcif_dma sh_mmcif_dma = {
-	.chan_priv_rx	= {
-		.slave_id	= SHDMA_SLAVE_MMCIF_RX,
-	},
-	.chan_priv_tx	= {
-		.slave_id	= SHDMA_SLAVE_MMCIF_TX,
-	},
-};
-
 static struct sh_mmcif_plat_data sh_mmcif_plat = {
 static struct sh_mmcif_plat_data sh_mmcif_plat = {
 	.sup_pclk	= 0,
 	.sup_pclk	= 0,
 	.ocr		= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
 	.ocr		= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -311,7 +302,8 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
 			  MMC_CAP_8_BIT_DATA |
 			  MMC_CAP_8_BIT_DATA |
 			  MMC_CAP_NEEDS_POLL,
 			  MMC_CAP_NEEDS_POLL,
 	.get_cd		= slot_cn7_get_cd,
 	.get_cd		= slot_cn7_get_cd,
-	.dma		= &sh_mmcif_dma,
+	.slave_id_tx	= SHDMA_SLAVE_MMCIF_TX,
+	.slave_id_rx	= SHDMA_SLAVE_MMCIF_RX,
 };
 };
 
 
 static struct platform_device sh_mmcif_device = {
 static struct platform_device sh_mmcif_device = {

+ 1 - 2
arch/arm/mach-shmobile/board-kota2.c

@@ -143,11 +143,10 @@ static struct gpio_keys_button gpio_buttons[] = {
 static struct gpio_keys_platform_data gpio_key_info = {
 static struct gpio_keys_platform_data gpio_key_info = {
 	.buttons        = gpio_buttons,
 	.buttons        = gpio_buttons,
 	.nbuttons       = ARRAY_SIZE(gpio_buttons),
 	.nbuttons       = ARRAY_SIZE(gpio_buttons),
-	.poll_interval  = 250, /* polled for now */
 };
 };
 
 
 static struct platform_device gpio_keys_device = {
 static struct platform_device gpio_keys_device = {
-	.name   = "gpio-keys-polled", /* polled for now */
+	.name   = "gpio-keys",
 	.id     = -1,
 	.id     = -1,
 	.dev    = {
 	.dev    = {
 		.platform_data  = &gpio_key_info,
 		.platform_data  = &gpio_key_info,

+ 21 - 74
arch/arm/mach-shmobile/board-mackerel.c

@@ -43,7 +43,6 @@
 #include <linux/smsc911x.h>
 #include <linux/smsc911x.h>
 #include <linux/sh_intc.h>
 #include <linux/sh_intc.h>
 #include <linux/tca6416_keypad.h>
 #include <linux/tca6416_keypad.h>
-#include <linux/usb/r8a66597.h>
 #include <linux/usb/renesas_usbhs.h>
 #include <linux/usb/renesas_usbhs.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-mapping.h>
 
 
@@ -145,11 +144,6 @@
  * 1-2 short | VBUS 5V       | Host
  * 1-2 short | VBUS 5V       | Host
  * open      | external VBUS | Function
  * open      | external VBUS | Function
  *
  *
- * *1
- * CN31 is used as
- * CONFIG_USB_R8A66597_HCD	Host
- * CONFIG_USB_RENESAS_USBHS	Function
- *
  * CAUTION
  * CAUTION
  *
  *
  * renesas_usbhs driver can use external interrupt mode
  * renesas_usbhs driver can use external interrupt mode
@@ -161,15 +155,6 @@
  * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0",
  * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0",
  * because Touchscreen is using IRQ7-PORT40.
  * because Touchscreen is using IRQ7-PORT40.
  * It is impossible to use IRQ7 demux on this board.
  * It is impossible to use IRQ7 demux on this board.
- *
- * We can use external interrupt mode USB-Function on "USB1".
- * USB1 can become Host by r8a66597, and become Function by renesas_usbhs.
- * But don't select both drivers in same time.
- * These uses same IRQ number for request_irq(), and aren't supporting
- * IRQF_SHARED / IORESOURCE_IRQ_SHAREABLE.
- *
- * Actually these are old/new version of USB driver.
- * This mean its register will be broken if it supports shared IRQ,
  */
  */
 
 
 /*
 /*
@@ -207,6 +192,16 @@
  *
  *
  */
  */
 
 
+/*
+ * FSI - AK4642
+ *
+ * it needs amixer settings for playing
+ *
+ * amixer set "Headphone" on
+ * amixer set "HPOUTL Mixer DACH" on
+ * amixer set "HPOUTR Mixer DACH" on
+ */
+
 /*
 /*
  * FIXME !!
  * FIXME !!
  *
  *
@@ -676,51 +671,16 @@ static struct platform_device usbhs0_device = {
  * Use J30 to select between Host and Function. This setting
  * Use J30 to select between Host and Function. This setting
  * can however not be detected by software. Hotplug of USBHS1
  * can however not be detected by software. Hotplug of USBHS1
  * is provided via IRQ8.
  * is provided via IRQ8.
+ *
+ * Current USB1 works as "USB Host".
+ *  - set J30 "short"
+ *
+ * If you want to use it as "USB gadget",
+ *  - J30 "open"
+ *  - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET
+ *  - add .get_vbus = usbhs_get_vbus in usbhs1_private
  */
  */
 #define IRQ8 evt2irq(0x0300)
 #define IRQ8 evt2irq(0x0300)
-
-/* USBHS1 USB Host support via r8a66597_hcd */
-static void usb1_host_port_power(int port, int power)
-{
-	if (!power) /* only power-on is supported for now */
-		return;
-
-	/* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
-	__raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
-}
-
-static struct r8a66597_platdata usb1_host_data = {
-	.on_chip	= 1,
-	.port_power	= usb1_host_port_power,
-};
-
-static struct resource usb1_host_resources[] = {
-	[0] = {
-		.name	= "USBHS1",
-		.start	= 0xe68b0000,
-		.end	= 0xe68b00e6 - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= evt2irq(0x1ce0) /* USB1_USB1I0 */,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device usb1_host_device = {
-	.name	= "r8a66597_hcd",
-	.id	= 1,
-	.dev = {
-		.dma_mask		= NULL,         /*  not use dma */
-		.coherent_dma_mask	= 0xffffffff,
-		.platform_data		= &usb1_host_data,
-	},
-	.num_resources	= ARRAY_SIZE(usb1_host_resources),
-	.resource	= usb1_host_resources,
-};
-
-/* USBHS1 USB Function support via renesas_usbhs */
-
 #define USB_PHY_MODE		(1 << 4)
 #define USB_PHY_MODE		(1 << 4)
 #define USB_PHY_INT_EN		((1 << 3) | (1 << 2))
 #define USB_PHY_INT_EN		((1 << 3) | (1 << 2))
 #define USB_PHY_ON		(1 << 1)
 #define USB_PHY_ON		(1 << 1)
@@ -776,7 +736,7 @@ static void usbhs1_hardware_exit(struct platform_device *pdev)
 
 
 static int usbhs1_get_id(struct platform_device *pdev)
 static int usbhs1_get_id(struct platform_device *pdev)
 {
 {
-	return USBHS_GADGET;
+	return USBHS_HOST;
 }
 }
 
 
 static u32 usbhs1_pipe_cfg[] = {
 static u32 usbhs1_pipe_cfg[] = {
@@ -807,7 +767,6 @@ static struct usbhs_private usbhs1_private = {
 			.hardware_exit	= usbhs1_hardware_exit,
 			.hardware_exit	= usbhs1_hardware_exit,
 			.get_id		= usbhs1_get_id,
 			.get_id		= usbhs1_get_id,
 			.phy_reset	= usbhs_phy_reset,
 			.phy_reset	= usbhs_phy_reset,
-			.get_vbus	= usbhs_get_vbus,
 		},
 		},
 		.driver_param = {
 		.driver_param = {
 			.buswait_bwait	= 4,
 			.buswait_bwait	= 4,
@@ -1184,15 +1143,6 @@ static struct resource sh_mmcif_resources[] = {
 	},
 	},
 };
 };
 
 
-static struct sh_mmcif_dma sh_mmcif_dma = {
-	.chan_priv_rx	= {
-		.slave_id	= SHDMA_SLAVE_MMCIF_RX,
-	},
-	.chan_priv_tx	= {
-		.slave_id	= SHDMA_SLAVE_MMCIF_TX,
-	},
-};
-
 static struct sh_mmcif_plat_data sh_mmcif_plat = {
 static struct sh_mmcif_plat_data sh_mmcif_plat = {
 	.sup_pclk	= 0,
 	.sup_pclk	= 0,
 	.ocr		= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
 	.ocr		= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
@@ -1200,7 +1150,8 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
 			  MMC_CAP_8_BIT_DATA |
 			  MMC_CAP_8_BIT_DATA |
 			  MMC_CAP_NEEDS_POLL,
 			  MMC_CAP_NEEDS_POLL,
 	.get_cd		= slot_cn7_get_cd,
 	.get_cd		= slot_cn7_get_cd,
-	.dma		= &sh_mmcif_dma,
+	.slave_id_tx	= SHDMA_SLAVE_MMCIF_TX,
+	.slave_id_rx	= SHDMA_SLAVE_MMCIF_RX,
 };
 };
 
 
 static struct platform_device sh_mmcif_device = {
 static struct platform_device sh_mmcif_device = {
@@ -1311,7 +1262,6 @@ static struct platform_device *mackerel_devices[] __initdata = {
 	&nor_flash_device,
 	&nor_flash_device,
 	&smc911x_device,
 	&smc911x_device,
 	&lcdc_device,
 	&lcdc_device,
-	&usb1_host_device,
 	&usbhs1_device,
 	&usbhs1_device,
 	&usbhs0_device,
 	&usbhs0_device,
 	&leds_device,
 	&leds_device,
@@ -1473,9 +1423,6 @@ static void __init mackerel_init(void)
 	gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */
 	gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */
 	gpio_request(GPIO_FN_IDIN_1_113, NULL);
 	gpio_request(GPIO_FN_IDIN_1_113, NULL);
 
 
-	/* USB phy tweak to make the r8a66597_hcd host driver work */
-	__raw_writew(0x8a0a, 0xe6058130);       /* USBCR4 */
-
 	/* enable FSI2 port A (ak4643) */
 	/* enable FSI2 port A (ak4643) */
 	gpio_request(GPIO_FN_FSIAIBT,	NULL);
 	gpio_request(GPIO_FN_FSIAIBT,	NULL);
 	gpio_request(GPIO_FN_FSIAILR,	NULL);
 	gpio_request(GPIO_FN_FSIAILR,	NULL);

+ 113 - 0
arch/arm/mach-shmobile/clock-sh73a0.c

@@ -365,6 +365,114 @@ static struct clk div6_clks[DIV6_NR] = {
 			dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
 			dsi_parent, ARRAY_SIZE(dsi_parent), 12, 3),
 };
 };
 
 
+/* DSI DIV */
+static unsigned long dsiphy_recalc(struct clk *clk)
+{
+	u32 value;
+
+	value = __raw_readl(clk->mapping->base);
+
+	/* FIXME */
+	if (!(value & 0x000B8000))
+		return clk->parent->rate;
+
+	value &= 0x3f;
+	value += 1;
+
+	if ((value < 12) ||
+	    (value > 33)) {
+		pr_err("DSIPHY has wrong value (%d)", value);
+		return 0;
+	}
+
+	return clk->parent->rate / value;
+}
+
+static long dsiphy_round_rate(struct clk *clk, unsigned long rate)
+{
+	return clk_rate_mult_range_round(clk, 12, 33, rate);
+}
+
+static void dsiphy_disable(struct clk *clk)
+{
+	u32 value;
+
+	value = __raw_readl(clk->mapping->base);
+	value &= ~0x000B8000;
+
+	__raw_writel(value , clk->mapping->base);
+}
+
+static int dsiphy_enable(struct clk *clk)
+{
+	u32 value;
+	int multi;
+
+	value = __raw_readl(clk->mapping->base);
+	multi = (value & 0x3f) + 1;
+
+	if ((multi < 12) || (multi > 33))
+		return -EIO;
+
+	__raw_writel(value | 0x000B8000, clk->mapping->base);
+
+	return 0;
+}
+
+static int dsiphy_set_rate(struct clk *clk, unsigned long rate)
+{
+	u32 value;
+	int idx;
+
+	idx = rate / clk->parent->rate;
+	if ((idx < 12) || (idx > 33))
+		return -EINVAL;
+
+	idx += -1;
+
+	value = __raw_readl(clk->mapping->base);
+	value = (value & ~0x3f) + idx;
+
+	__raw_writel(value, clk->mapping->base);
+
+	return 0;
+}
+
+static struct clk_ops dsiphy_clk_ops = {
+	.recalc		= dsiphy_recalc,
+	.round_rate	= dsiphy_round_rate,
+	.set_rate	= dsiphy_set_rate,
+	.enable		= dsiphy_enable,
+	.disable	= dsiphy_disable,
+};
+
+static struct clk_mapping dsi0phy_clk_mapping = {
+	.phys	= DSI0PHYCR,
+	.len	= 4,
+};
+
+static struct clk_mapping dsi1phy_clk_mapping = {
+	.phys	= DSI1PHYCR,
+	.len	= 4,
+};
+
+static struct clk dsi0phy_clk = {
+	.ops		= &dsiphy_clk_ops,
+	.parent		= &div6_clks[DIV6_DSI0P], /* late install */
+	.mapping	= &dsi0phy_clk_mapping,
+};
+
+static struct clk dsi1phy_clk = {
+	.ops		= &dsiphy_clk_ops,
+	.parent		= &div6_clks[DIV6_DSI1P], /* late install */
+	.mapping	= &dsi1phy_clk_mapping,
+};
+
+static struct clk *late_main_clks[] = {
+	&dsi0phy_clk,
+	&dsi1phy_clk,
+};
+
 enum { MSTP001,
 enum { MSTP001,
 	MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
 	MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
 	MSTP219,
 	MSTP219,
@@ -429,6 +537,8 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
 	CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
 	CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
 	CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
 	CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
 	CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
+	CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk),
+	CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk),
 
 
 	/* MSTP32 clocks */
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
 	CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
@@ -504,6 +614,9 @@ void __init sh73a0_clock_init(void)
 	if (!ret)
 	if (!ret)
 		ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
 		ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
 
 
+	for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
+		ret = clk_register(late_main_clks[k]);
+
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 
 	if (!ret)
 	if (!ret)

+ 3 - 3
arch/arm/mach-shmobile/include/mach/sh73a0.h

@@ -515,8 +515,8 @@ enum {
 	SHDMA_SLAVE_MMCIF_RX,
 	SHDMA_SLAVE_MMCIF_RX,
 };
 };
 
 
-/* PINT interrupts are located at Linux IRQ 768 and up */
-#define SH73A0_PINT0_IRQ(irq) ((irq) + 768)
-#define SH73A0_PINT1_IRQ(irq) ((irq) + 800)
+/* PINT interrupts are located at Linux IRQ 800 and up */
+#define SH73A0_PINT0_IRQ(irq) ((irq) + 800)
+#define SH73A0_PINT1_IRQ(irq) ((irq) + 832)
 
 
 #endif /* __ASM_SH73A0_H__ */
 #endif /* __ASM_SH73A0_H__ */

+ 2 - 0
arch/arm/mach-shmobile/intc-sh73a0.c

@@ -19,6 +19,7 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/sh_intc.h>
 #include <linux/sh_intc.h>
@@ -445,6 +446,7 @@ void __init sh73a0_init_irq(void)
 		setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]);
 		setup_irq(gic_spi(1 + k), &sh73a0_irq_pin_cascade[k]);
 
 
 		n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k)));
 		n = intcs_evt2irq(to_intc_vect(gic_spi(1 + k)));
+		WARN_ON(irq_alloc_desc_at(n, numa_node_id()) != n);
 		irq_set_chip_and_handler_name(n, &intca_gic_irq_chip,
 		irq_set_chip_and_handler_name(n, &intca_gic_irq_chip,
 					      handle_level_irq, "level");
 					      handle_level_irq, "level");
 		set_irq_flags(n, IRQF_VALID); /* yuck */
 		set_irq_flags(n, IRQF_VALID); /* yuck */

+ 1 - 1
arch/arm/mach-shmobile/pfc-r8a7779.c

@@ -2120,7 +2120,7 @@ static struct pinmux_cfg_reg pinmux_config_regs[] = {
 	    FN_AUDATA3, 0, 0, 0 }
 	    FN_AUDATA3, 0, 0, 0 }
 	},
 	},
 	{ PINMUX_CFG_REG_VAR("IPSR4", 0xfffc0030, 32,
 	{ PINMUX_CFG_REG_VAR("IPSR4", 0xfffc0030, 32,
-			     3, 1, 1, 1, 1, 1, 1, 3, 3, 1,
+			     3, 1, 1, 1, 1, 1, 1, 3, 3,
 			     1, 1, 1, 1, 1, 1, 3, 3, 3, 2) {
 			     1, 1, 1, 1, 1, 1, 3, 3, 3, 2) {
 	    /* IP4_31_29 [3] */
 	    /* IP4_31_29 [3] */
 	    FN_DU1_DB0, FN_VI2_DATA4_VI2_B4, FN_SCL2_B, FN_SD3_DAT0,
 	    FN_DU1_DB0, FN_VI2_DATA4_VI2_B4, FN_SCL2_B, FN_SD3_DAT0,

+ 41 - 0
arch/arm/mach-shmobile/pfc-sh7372.c

@@ -23,6 +23,7 @@
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
+#include <mach/irqs.h>
 #include <mach/sh7372.h>
 #include <mach/sh7372.h>
 
 
 #define CPU_ALL_PORT(fn, pfx, sfx) \
 #define CPU_ALL_PORT(fn, pfx, sfx) \
@@ -1594,6 +1595,43 @@ static struct pinmux_data_reg pinmux_data_regs[] = {
 	{ },
 	{ },
 };
 };
 
 
+#define EXT_IRQ16L(n) evt2irq(0x200 + ((n) << 5))
+#define EXT_IRQ16H(n) evt2irq(0x3200 + (((n) - 16) << 5))
+static struct pinmux_irq pinmux_irqs[] = {
+	PINMUX_IRQ(EXT_IRQ16L(0), PORT6_FN0, PORT162_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(1), PORT12_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(2), PORT4_FN0, PORT5_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(3), PORT8_FN0, PORT16_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(4), PORT17_FN0, PORT163_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(5), PORT18_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(6), PORT39_FN0, PORT164_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(7), PORT40_FN0, PORT167_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(8), PORT41_FN0, PORT168_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(9), PORT42_FN0, PORT169_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(10), PORT65_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(11), PORT67_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(12), PORT80_FN0, PORT137_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(13), PORT81_FN0, PORT145_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(14), PORT82_FN0, PORT146_FN0),
+	PINMUX_IRQ(EXT_IRQ16L(15), PORT83_FN0, PORT147_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(16), PORT84_FN0, PORT170_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(17), PORT85_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(18), PORT86_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(19), PORT87_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(20), PORT92_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(21), PORT93_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(22), PORT94_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(23), PORT95_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(24), PORT112_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(25), PORT119_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(26), PORT121_FN0, PORT172_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(27), PORT122_FN0, PORT180_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(28), PORT123_FN0, PORT181_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(29), PORT129_FN0, PORT182_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(30), PORT130_FN0, PORT183_FN0),
+	PINMUX_IRQ(EXT_IRQ16H(31), PORT138_FN0, PORT184_FN0),
+};
+
 static struct pinmux_info sh7372_pinmux_info = {
 static struct pinmux_info sh7372_pinmux_info = {
 	.name = "sh7372_pfc",
 	.name = "sh7372_pfc",
 	.reserved_id = PINMUX_RESERVED,
 	.reserved_id = PINMUX_RESERVED,
@@ -1614,6 +1652,9 @@ static struct pinmux_info sh7372_pinmux_info = {
 
 
 	.gpio_data = pinmux_data,
 	.gpio_data = pinmux_data,
 	.gpio_data_size = ARRAY_SIZE(pinmux_data),
 	.gpio_data_size = ARRAY_SIZE(pinmux_data),
+
+	.gpio_irq = pinmux_irqs,
+	.gpio_irq_size = ARRAY_SIZE(pinmux_irqs),
 };
 };
 
 
 void sh7372_pinmux_init(void)
 void sh7372_pinmux_init(void)

+ 1 - 1
arch/arm/mach-shmobile/smp-sh73a0.c

@@ -80,7 +80,7 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu)
 	/* enable cache coherency */
 	/* enable cache coherency */
 	modify_scu_cpu_psr(0, 3 << (cpu * 8));
 	modify_scu_cpu_psr(0, 3 << (cpu * 8));
 
 
-	if (((__raw_readw(__io(PSTR)) >> (4 * cpu)) & 3) == 3)
+	if (((__raw_readl(__io(PSTR)) >> (4 * cpu)) & 3) == 3)
 		__raw_writel(1 << cpu, __io(WUPCR));	/* wake up */
 		__raw_writel(1 << cpu, __io(WUPCR));	/* wake up */
 	else
 	else
 		__raw_writel(1 << cpu, __io(SRESCR));	/* reset */
 		__raw_writel(1 << cpu, __io(SRESCR));	/* reset */

+ 2 - 1
arch/arm/mm/Kconfig

@@ -631,7 +631,8 @@ comment "Processor Features"
 
 
 config ARM_LPAE
 config ARM_LPAE
 	bool "Support for the Large Physical Address Extension"
 	bool "Support for the Large Physical Address Extension"
-	depends on MMU && CPU_V7
+	depends on MMU && CPU_32v7 && !CPU_32v6 && !CPU_32v5 && \
+		!CPU_32v4 && !CPU_32v3
 	help
 	help
 	  Say Y if you have an ARMv7 processor supporting the LPAE page
 	  Say Y if you have an ARMv7 processor supporting the LPAE page
 	  table format and you would like to access memory beyond the
 	  table format and you would like to access memory beyond the

+ 1 - 1
arch/arm/mm/cache-v7.S

@@ -55,7 +55,7 @@ loop1:
 	cmp	r1, #2				@ see what cache we have at this level
 	cmp	r1, #2				@ see what cache we have at this level
 	blt	skip				@ skip if no cache, or just i-cache
 	blt	skip				@ skip if no cache, or just i-cache
 #ifdef CONFIG_PREEMPT
 #ifdef CONFIG_PREEMPT
-	save_and_disable_irqs r9		@ make cssr&csidr read atomic
+	save_and_disable_irqs_notrace r9	@ make cssr&csidr read atomic
 #endif
 #endif
 	mcr	p15, 2, r10, c0, c0, 0		@ select current cache level in cssr
 	mcr	p15, 2, r10, c0, c0, 0		@ select current cache level in cssr
 	isb					@ isb to sych the new cssr&csidr
 	isb					@ isb to sych the new cssr&csidr

+ 1 - 0
arch/arm/plat-omap/common.c

@@ -67,6 +67,7 @@ void __init omap_reserve(void)
 	omap_vram_reserve_sdram_memblock();
 	omap_vram_reserve_sdram_memblock();
 	omap_dsp_reserve_sdram_memblock();
 	omap_dsp_reserve_sdram_memblock();
 	omap_secure_ram_reserve_memblock();
 	omap_secure_ram_reserve_memblock();
+	omap_barrier_reserve_memblock();
 }
 }
 
 
 void __init omap_init_consistent_dma_size(void)
 void __init omap_init_consistent_dma_size(void)

+ 6 - 0
arch/arm/plat-omap/include/plat/omap-secure.h

@@ -10,4 +10,10 @@ static inline void omap_secure_ram_reserve_memblock(void)
 { }
 { }
 #endif
 #endif
 
 
+#ifdef CONFIG_OMAP4_ERRATA_I688
+extern int omap_barrier_reserve_memblock(void);
+#else
+static inline void omap_barrier_reserve_memblock(void)
+{ }
+#endif
 #endif /* __OMAP_SECURE_H__ */
 #endif /* __OMAP_SECURE_H__ */

+ 1 - 1
arch/c6x/boot/Makefile

@@ -13,7 +13,7 @@ obj-y += linked_dtb.o
 endif
 endif
 
 
 $(obj)/%.dtb: $(src)/dts/%.dts FORCE
 $(obj)/%.dtb: $(src)/dts/%.dts FORCE
-	$(call cmd,dtc)
+	$(call if_changed_dep,dtc)
 
 
 quiet_cmd_cp = CP      $< $@$2
 quiet_cmd_cp = CP      $< $@$2
 	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
 	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)

+ 2 - 1
arch/m68k/include/asm/mcf_pgtable.h

@@ -78,7 +78,8 @@
 				 | CF_PAGE_READABLE \
 				 | CF_PAGE_READABLE \
 				 | CF_PAGE_WRITABLE \
 				 | CF_PAGE_WRITABLE \
 				 | CF_PAGE_EXEC \
 				 | CF_PAGE_EXEC \
-				 | CF_PAGE_SYSTEM)
+				 | CF_PAGE_SYSTEM \
+				 | CF_PAGE_SHARED)
 
 
 #define PAGE_COPY	__pgprot(CF_PAGE_VALID \
 #define PAGE_COPY	__pgprot(CF_PAGE_VALID \
 				 | CF_PAGE_ACCESSED \
 				 | CF_PAGE_ACCESSED \

+ 5 - 4
arch/m68k/mm/mcfmmu.c

@@ -87,7 +87,7 @@ void __init paging_init(void)
 
 
 int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word)
 int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word)
 {
 {
-	unsigned long flags, mmuar;
+	unsigned long flags, mmuar, mmutr;
 	struct mm_struct *mm;
 	struct mm_struct *mm;
 	pgd_t *pgd;
 	pgd_t *pgd;
 	pmd_t *pmd;
 	pmd_t *pmd;
@@ -137,9 +137,10 @@ int cf_tlb_miss(struct pt_regs *regs, int write, int dtlb, int extension_word)
 	if (!pte_dirty(*pte) && !KMAPAREA(mmuar))
 	if (!pte_dirty(*pte) && !KMAPAREA(mmuar))
 		set_pte(pte, pte_wrprotect(*pte));
 		set_pte(pte, pte_wrprotect(*pte));
 
 
-	mmu_write(MMUTR, (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) |
-		(((int)(pte->pte) & (int)CF_PAGE_MMUTR_MASK)
-		>> CF_PAGE_MMUTR_SHIFT) | MMUTR_V);
+	mmutr = (mmuar & PAGE_MASK) | (asid << MMUTR_IDN) | MMUTR_V;
+	if ((mmuar < TASK_UNMAPPED_BASE) || (mmuar >= TASK_SIZE))
+		mmutr |= (pte->pte & CF_PAGE_MMUTR_MASK) >> CF_PAGE_MMUTR_SHIFT;
+	mmu_write(MMUTR, mmutr);
 
 
 	mmu_write(MMUDR, (pte_val(*pte) & PAGE_MASK) |
 	mmu_write(MMUDR, (pte_val(*pte) & PAGE_MASK) |
 		((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X);
 		((pte->pte) & CF_PAGE_MMUDR_MASK) | MMUDR_SZ_8KB | MMUDR_X);

+ 1 - 3
arch/m68k/platform/coldfire/entry.S

@@ -136,7 +136,7 @@ Luser_return:
 	movel	%sp,%d1			/* get thread_info pointer */
 	movel	%sp,%d1			/* get thread_info pointer */
 	andl	#-THREAD_SIZE,%d1	/* at base of kernel stack */
 	andl	#-THREAD_SIZE,%d1	/* at base of kernel stack */
 	movel	%d1,%a0
 	movel	%d1,%a0
-	movel	%a0@(TINFO_FLAGS),%d1	/* get thread_info->flags */
+	moveb	%a0@(TINFO_FLAGS+3),%d1	/* thread_info->flags (low 8 bits) */
 	jne	Lwork_to_do		/* still work to do */
 	jne	Lwork_to_do		/* still work to do */
 
 
 Lreturn:
 Lreturn:
@@ -148,8 +148,6 @@ Lwork_to_do:
 	btst	#TIF_NEED_RESCHED,%d1
 	btst	#TIF_NEED_RESCHED,%d1
 	jne	reschedule
 	jne	reschedule
 
 
-	/* GERG: do we need something here for TRACEing?? */
-
 Lsignal_return:
 Lsignal_return:
 	subql	#4,%sp			/* dummy return address */
 	subql	#4,%sp			/* dummy return address */
 	SAVE_SWITCH_STACK
 	SAVE_SWITCH_STACK

+ 7 - 1
arch/openrisc/include/asm/ptrace.h

@@ -77,7 +77,6 @@ struct pt_regs {
 	long  syscallno;	/* Syscall number (used by strace) */
 	long  syscallno;	/* Syscall number (used by strace) */
 	long dummy;		/* Cheap alignment fix */
 	long dummy;		/* Cheap alignment fix */
 };
 };
-#endif /* __ASSEMBLY__ */
 
 
 /* TODO: Rename this to REDZONE because that's what it is */
 /* TODO: Rename this to REDZONE because that's what it is */
 #define STACK_FRAME_OVERHEAD  128  /* size of minimum stack frame */
 #define STACK_FRAME_OVERHEAD  128  /* size of minimum stack frame */
@@ -87,6 +86,13 @@ struct pt_regs {
 #define user_stack_pointer(regs)	((unsigned long)(regs)->sp)
 #define user_stack_pointer(regs)	((unsigned long)(regs)->sp)
 #define profile_pc(regs)		instruction_pointer(regs)
 #define profile_pc(regs)		instruction_pointer(regs)
 
 
+static inline long regs_return_value(struct pt_regs *regs)
+{
+	return regs->gpr[11];
+}
+
+#endif /* __ASSEMBLY__ */
+
 /*
 /*
  * Offsets used by 'ptrace' system call interface.
  * Offsets used by 'ptrace' system call interface.
  */
  */

+ 1 - 0
arch/openrisc/kernel/init_task.c

@@ -17,6 +17,7 @@
 
 
 #include <linux/init_task.h>
 #include <linux/init_task.h>
 #include <linux/mqueue.h>
 #include <linux/mqueue.h>
+#include <linux/export.h>
 
 
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
 static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);

+ 1 - 0
arch/openrisc/kernel/irq.c

@@ -23,6 +23,7 @@
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/seq_file.h>
 #include <linux/seq_file.h>
 #include <linux/kernel_stat.h>
 #include <linux/kernel_stat.h>
+#include <linux/export.h>
 
 
 #include <linux/irqflags.h>
 #include <linux/irqflags.h>
 
 

+ 4 - 8
arch/openrisc/kernel/ptrace.c

@@ -188,11 +188,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
 		 */
 		 */
 		ret = -1L;
 		ret = -1L;
 
 
-	/* Are these regs right??? */
-	if (unlikely(current->audit_context))
-		audit_syscall_entry(audit_arch(), regs->syscallno,
-				    regs->gpr[3], regs->gpr[4],
-				    regs->gpr[5], regs->gpr[6]);
+	audit_syscall_entry(audit_arch(), regs->syscallno,
+			    regs->gpr[3], regs->gpr[4],
+			    regs->gpr[5], regs->gpr[6]);
 
 
 	return ret ? : regs->syscallno;
 	return ret ? : regs->syscallno;
 }
 }
@@ -201,9 +199,7 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
 {
 {
 	int step;
 	int step;
 
 
-	if (unlikely(current->audit_context))
-		audit_syscall_exit(AUDITSC_RESULT(regs->gpr[11]),
-				   regs->gpr[11]);
+	audit_syscall_exit(regs);
 
 
 	step = test_thread_flag(TIF_SINGLESTEP);
 	step = test_thread_flag(TIF_SINGLESTEP);
 	if (step || test_thread_flag(TIF_SYSCALL_TRACE))
 	if (step || test_thread_flag(TIF_SYSCALL_TRACE))

+ 4 - 0
arch/parisc/Makefile

@@ -31,7 +31,11 @@ ifdef CONFIG_64BIT
 UTS_MACHINE	:= parisc64
 UTS_MACHINE	:= parisc64
 CHECKFLAGS	+= -D__LP64__=1 -m64
 CHECKFLAGS	+= -D__LP64__=1 -m64
 WIDTH		:= 64
 WIDTH		:= 64
+
+# FIXME: if no default set, should really try to locate dynamically
+ifeq ($(CROSS_COMPILE),)
 CROSS_COMPILE	:= hppa64-linux-gnu-
 CROSS_COMPILE	:= hppa64-linux-gnu-
+endif
 else # 32-bit
 else # 32-bit
 WIDTH		:=
 WIDTH		:=
 endif
 endif

+ 1 - 1
arch/powerpc/kernel/entry_32.S

@@ -1213,7 +1213,7 @@ do_user_signal:			/* r10 contains MSR_KERNEL here */
 	stw	r3,_TRAP(r1)
 	stw	r3,_TRAP(r1)
 2:	addi	r3,r1,STACK_FRAME_OVERHEAD
 2:	addi	r3,r1,STACK_FRAME_OVERHEAD
 	mr	r4,r9
 	mr	r4,r9
-	bl	do_signal
+	bl	do_notify_resume
 	REST_NVGPRS(r1)
 	REST_NVGPRS(r1)
 	b	recheck
 	b	recheck
 
 

+ 5 - 1
arch/powerpc/kernel/entry_64.S

@@ -751,12 +751,16 @@ user_work:
 
 
 	andi.	r0,r4,_TIF_NEED_RESCHED
 	andi.	r0,r4,_TIF_NEED_RESCHED
 	beq	1f
 	beq	1f
+	li	r5,1
+	TRACE_AND_RESTORE_IRQ(r5);
 	bl	.schedule
 	bl	.schedule
 	b	.ret_from_except_lite
 	b	.ret_from_except_lite
 
 
 1:	bl	.save_nvgprs
 1:	bl	.save_nvgprs
+	li	r5,1
+	TRACE_AND_RESTORE_IRQ(r5);
 	addi	r3,r1,STACK_FRAME_OVERHEAD
 	addi	r3,r1,STACK_FRAME_OVERHEAD
-	bl	.do_signal
+	bl	.do_notify_resume
 	b	.ret_from_except
 	b	.ret_from_except
 
 
 unrecov_restore:
 unrecov_restore:

+ 1 - 1
arch/powerpc/kernel/exceptions-64s.S

@@ -774,8 +774,8 @@ alignment_common:
 program_check_common:
 program_check_common:
 	EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
 	EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
 	bl	.save_nvgprs
 	bl	.save_nvgprs
-	addi	r3,r1,STACK_FRAME_OVERHEAD
 	DISABLE_INTS
 	DISABLE_INTS
+	addi	r3,r1,STACK_FRAME_OVERHEAD
 	bl	.program_check_exception
 	bl	.program_check_exception
 	b	.ret_from_except
 	b	.ret_from_except
 
 

+ 8 - 4
arch/powerpc/kernel/signal.c

@@ -11,6 +11,7 @@
 
 
 #include <linux/tracehook.h>
 #include <linux/tracehook.h>
 #include <linux/signal.h>
 #include <linux/signal.h>
+#include <linux/key.h>
 #include <asm/hw_breakpoint.h>
 #include <asm/hw_breakpoint.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
 #include <asm/unistd.h>
@@ -113,8 +114,9 @@ static void check_syscall_restart(struct pt_regs *regs, struct k_sigaction *ka,
 	}
 	}
 }
 }
 
 
-static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
+static int do_signal(struct pt_regs *regs)
 {
 {
+	sigset_t *oldset;
 	siginfo_t info;
 	siginfo_t info;
 	int signr;
 	int signr;
 	struct k_sigaction ka;
 	struct k_sigaction ka;
@@ -123,7 +125,7 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
 
 
 	if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK)
 	if (current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK)
 		oldset = &current->saved_sigmask;
 		oldset = &current->saved_sigmask;
-	else if (!oldset)
+	else
 		oldset = &current->blocked;
 		oldset = &current->blocked;
 
 
 	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
 	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
@@ -191,14 +193,16 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
 	return ret;
 	return ret;
 }
 }
 
 
-void do_signal(struct pt_regs *regs, unsigned long thread_info_flags)
+void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
 {
 {
 	if (thread_info_flags & _TIF_SIGPENDING)
 	if (thread_info_flags & _TIF_SIGPENDING)
-		do_signal_pending(NULL, regs);
+		do_signal(regs);
 
 
 	if (thread_info_flags & _TIF_NOTIFY_RESUME) {
 	if (thread_info_flags & _TIF_NOTIFY_RESUME) {
 		clear_thread_flag(TIF_NOTIFY_RESUME);
 		clear_thread_flag(TIF_NOTIFY_RESUME);
 		tracehook_notify_resume(regs);
 		tracehook_notify_resume(regs);
+		if (current->replacement_session_keyring)
+			key_replace_session_keyring();
 	}
 	}
 }
 }
 
 

+ 1 - 1
arch/powerpc/kernel/signal.h

@@ -12,7 +12,7 @@
 
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
 
-extern void do_signal(struct pt_regs *regs, unsigned long thread_info_flags);
+extern void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags);
 
 
 extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 extern void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
 				  size_t frame_size, int is_32);
 				  size_t frame_size, int is_32);

+ 1 - 1
arch/powerpc/platforms/wsp/smp.c

@@ -71,7 +71,7 @@ int __devinit smp_a2_kick_cpu(int nr)
 
 
 static int __init smp_a2_probe(void)
 static int __init smp_a2_probe(void)
 {
 {
-	return cpus_weight(cpu_possible_map);
+	return num_possible_cpus();
 }
 }
 
 
 static struct smp_ops_t a2_smp_ops = {
 static struct smp_ops_t a2_smp_ops = {

+ 3 - 0
arch/s390/Kconfig

@@ -227,6 +227,9 @@ config COMPAT
 config SYSVIPC_COMPAT
 config SYSVIPC_COMPAT
 	def_bool y if COMPAT && SYSVIPC
 	def_bool y if COMPAT && SYSVIPC
 
 
+config KEYS_COMPAT
+	def_bool y if COMPAT && KEYS
+
 config AUDIT_ARCH
 config AUDIT_ARCH
 	def_bool y
 	def_bool y
 
 

+ 0 - 7
arch/s390/include/asm/compat.h

@@ -172,13 +172,6 @@ static inline int is_compat_task(void)
 	return is_32bit_task();
 	return is_32bit_task();
 }
 }
 
 
-#else
-
-static inline int is_compat_task(void)
-{
-	return 0;
-}
-
 #endif
 #endif
 
 
 static inline void __user *arch_compat_alloc_user_space(long len)
 static inline void __user *arch_compat_alloc_user_space(long len)

+ 1 - 1
arch/s390/kernel/compat_wrapper.S

@@ -662,7 +662,7 @@ ENTRY(sys32_getresuid16_wrapper)
 ENTRY(sys32_poll_wrapper)
 ENTRY(sys32_poll_wrapper)
 	llgtr	%r2,%r2			# struct pollfd *
 	llgtr	%r2,%r2			# struct pollfd *
 	llgfr	%r3,%r3			# unsigned int
 	llgfr	%r3,%r3			# unsigned int
-	lgfr	%r4,%r4			# long
+	lgfr	%r4,%r4			# int
 	jg	sys_poll		# branch to system call
 	jg	sys_poll		# branch to system call
 
 
 ENTRY(sys32_setresgid16_wrapper)
 ENTRY(sys32_setresgid16_wrapper)

+ 0 - 1
arch/s390/kernel/crash_dump.c

@@ -11,7 +11,6 @@
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <linux/gfp.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
-#include <linux/crash_dump.h>
 #include <linux/bootmem.h>
 #include <linux/bootmem.h>
 #include <linux/elf.h>
 #include <linux/elf.h>
 #include <asm/ipl.h>
 #include <asm/ipl.h>

+ 3 - 3
arch/s390/kernel/process.c

@@ -29,7 +29,6 @@
 #include <asm/irq.h>
 #include <asm/irq.h>
 #include <asm/timer.h>
 #include <asm/timer.h>
 #include <asm/nmi.h>
 #include <asm/nmi.h>
-#include <asm/compat.h>
 #include <asm/smp.h>
 #include <asm/smp.h>
 #include "entry.h"
 #include "entry.h"
 
 
@@ -76,7 +75,6 @@ static void default_idle(void)
 	if (test_thread_flag(TIF_MCCK_PENDING)) {
 	if (test_thread_flag(TIF_MCCK_PENDING)) {
 		local_mcck_enable();
 		local_mcck_enable();
 		local_irq_enable();
 		local_irq_enable();
-		s390_handle_mcck();
 		return;
 		return;
 	}
 	}
 	trace_hardirqs_on();
 	trace_hardirqs_on();
@@ -93,10 +91,12 @@ void cpu_idle(void)
 	for (;;) {
 	for (;;) {
 		tick_nohz_idle_enter();
 		tick_nohz_idle_enter();
 		rcu_idle_enter();
 		rcu_idle_enter();
-		while (!need_resched())
+		while (!need_resched() && !test_thread_flag(TIF_MCCK_PENDING))
 			default_idle();
 			default_idle();
 		rcu_idle_exit();
 		rcu_idle_exit();
 		tick_nohz_idle_exit();
 		tick_nohz_idle_exit();
+		if (test_thread_flag(TIF_MCCK_PENDING))
+			s390_handle_mcck();
 		preempt_enable_no_resched();
 		preempt_enable_no_resched();
 		schedule();
 		schedule();
 		preempt_disable();
 		preempt_disable();

+ 1 - 1
arch/s390/kernel/ptrace.c

@@ -20,8 +20,8 @@
 #include <linux/regset.h>
 #include <linux/regset.h>
 #include <linux/tracehook.h>
 #include <linux/tracehook.h>
 #include <linux/seccomp.h>
 #include <linux/seccomp.h>
+#include <linux/compat.h>
 #include <trace/syscall.h>
 #include <trace/syscall.h>
-#include <asm/compat.h>
 #include <asm/segment.h>
 #include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/pgtable.h>

+ 1 - 1
arch/s390/kernel/setup.c

@@ -46,6 +46,7 @@
 #include <linux/kexec.h>
 #include <linux/kexec.h>
 #include <linux/crash_dump.h>
 #include <linux/crash_dump.h>
 #include <linux/memory.h>
 #include <linux/memory.h>
+#include <linux/compat.h>
 
 
 #include <asm/ipl.h>
 #include <asm/ipl.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
@@ -59,7 +60,6 @@
 #include <asm/ptrace.h>
 #include <asm/ptrace.h>
 #include <asm/sections.h>
 #include <asm/sections.h>
 #include <asm/ebcdic.h>
 #include <asm/ebcdic.h>
-#include <asm/compat.h>
 #include <asm/kvm_virtio.h>
 #include <asm/kvm_virtio.h>
 #include <asm/diag.h>
 #include <asm/diag.h>
 
 

+ 0 - 1
arch/s390/kernel/signal.c

@@ -30,7 +30,6 @@
 #include <asm/ucontext.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
 #include <asm/lowcore.h>
 #include <asm/lowcore.h>
-#include <asm/compat.h>
 #include "entry.h"
 #include "entry.h"
 
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))

+ 5 - 2
arch/s390/kernel/time.c

@@ -113,11 +113,14 @@ static void fixup_clock_comparator(unsigned long long delta)
 static int s390_next_ktime(ktime_t expires,
 static int s390_next_ktime(ktime_t expires,
 			   struct clock_event_device *evt)
 			   struct clock_event_device *evt)
 {
 {
+	struct timespec ts;
 	u64 nsecs;
 	u64 nsecs;
 
 
-	nsecs = ktime_to_ns(ktime_sub(expires, ktime_get_monotonic_offset()));
+	ts.tv_sec = ts.tv_nsec = 0;
+	monotonic_to_bootbased(&ts);
+	nsecs = ktime_to_ns(ktime_add(timespec_to_ktime(ts), expires));
 	do_div(nsecs, 125);
 	do_div(nsecs, 125);
-	S390_lowcore.clock_comparator = TOD_UNIX_EPOCH + (nsecs << 9);
+	S390_lowcore.clock_comparator = sched_clock_base_cc + (nsecs << 9);
 	set_clock_comparator(S390_lowcore.clock_comparator);
 	set_clock_comparator(S390_lowcore.clock_comparator);
 	return 0;
 	return 0;
 }
 }

+ 0 - 1
arch/s390/mm/fault.c

@@ -36,7 +36,6 @@
 #include <asm/pgtable.h>
 #include <asm/pgtable.h>
 #include <asm/irq.h>
 #include <asm/irq.h>
 #include <asm/mmu_context.h>
 #include <asm/mmu_context.h>
-#include <asm/compat.h>
 #include "../kernel/entry.h"
 #include "../kernel/entry.h"
 
 
 #ifndef CONFIG_64BIT
 #ifndef CONFIG_64BIT

+ 26 - 4
arch/s390/mm/init.c

@@ -223,16 +223,38 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 #ifdef CONFIG_MEMORY_HOTPLUG
 #ifdef CONFIG_MEMORY_HOTPLUG
 int arch_add_memory(int nid, u64 start, u64 size)
 int arch_add_memory(int nid, u64 start, u64 size)
 {
 {
-	struct pglist_data *pgdat;
+	unsigned long zone_start_pfn, zone_end_pfn, nr_pages;
+	unsigned long start_pfn = PFN_DOWN(start);
+	unsigned long size_pages = PFN_DOWN(size);
 	struct zone *zone;
 	struct zone *zone;
 	int rc;
 	int rc;
 
 
-	pgdat = NODE_DATA(nid);
-	zone = pgdat->node_zones + ZONE_MOVABLE;
 	rc = vmem_add_mapping(start, size);
 	rc = vmem_add_mapping(start, size);
 	if (rc)
 	if (rc)
 		return rc;
 		return rc;
-	rc = __add_pages(nid, zone, PFN_DOWN(start), PFN_DOWN(size));
+	for_each_zone(zone) {
+		if (zone_idx(zone) != ZONE_MOVABLE) {
+			/* Add range within existing zone limits */
+			zone_start_pfn = zone->zone_start_pfn;
+			zone_end_pfn = zone->zone_start_pfn +
+				       zone->spanned_pages;
+		} else {
+			/* Add remaining range to ZONE_MOVABLE */
+			zone_start_pfn = start_pfn;
+			zone_end_pfn = start_pfn + size_pages;
+		}
+		if (start_pfn < zone_start_pfn || start_pfn >= zone_end_pfn)
+			continue;
+		nr_pages = (start_pfn + size_pages > zone_end_pfn) ?
+			   zone_end_pfn - start_pfn : size_pages;
+		rc = __add_pages(nid, zone, start_pfn, nr_pages);
+		if (rc)
+			break;
+		start_pfn += nr_pages;
+		size_pages -= nr_pages;
+		if (!size_pages)
+			break;
+	}
 	if (rc)
 	if (rc)
 		vmem_remove_mapping(start, size);
 		vmem_remove_mapping(start, size);
 	return rc;
 	return rc;

+ 1 - 1
arch/s390/mm/mmap.c

@@ -29,8 +29,8 @@
 #include <linux/mman.h>
 #include <linux/mman.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/random.h>
 #include <linux/random.h>
+#include <linux/compat.h>
 #include <asm/pgalloc.h>
 #include <asm/pgalloc.h>
-#include <asm/compat.h>
 
 
 static unsigned long stack_maxrandom_size(void)
 static unsigned long stack_maxrandom_size(void)
 {
 {

+ 1 - 1
arch/s390/mm/pgtable.c

@@ -574,7 +574,7 @@ static inline void page_table_free_pgste(unsigned long *table)
 	page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
 	page = pfn_to_page(__pa(table) >> PAGE_SHIFT);
 	mp = (struct gmap_pgtable *) page->index;
 	mp = (struct gmap_pgtable *) page->index;
 	BUG_ON(!list_empty(&mp->mapper));
 	BUG_ON(!list_empty(&mp->mapper));
-	pgtable_page_ctor(page);
+	pgtable_page_dtor(page);
 	atomic_set(&page->_mapcount, -1);
 	atomic_set(&page->_mapcount, -1);
 	kfree(mp);
 	kfree(mp);
 	__free_page(page);
 	__free_page(page);

+ 9 - 11
arch/sh/boards/board-sh7757lcr.c

@@ -168,6 +168,11 @@ static struct resource sh_eth_giga1_resources[] = {
 		.start  = 0xfee00800,
 		.start  = 0xfee00800,
 		.end    = 0xfee00fff,
 		.end    = 0xfee00fff,
 		.flags  = IORESOURCE_MEM,
 		.flags  = IORESOURCE_MEM,
+	}, {
+		/* TSU */
+		.start  = 0xfee01800,
+		.end    = 0xfee01fff,
+		.flags  = IORESOURCE_MEM,
 	}, {
 	}, {
 		.start  = 316,
 		.start  = 316,
 		.end    = 316,
 		.end    = 316,
@@ -210,20 +215,13 @@ static struct resource sh_mmcif_resources[] = {
 	},
 	},
 };
 };
 
 
-static struct sh_mmcif_dma sh7757lcr_mmcif_dma = {
-	.chan_priv_tx	= {
-		.slave_id = SHDMA_SLAVE_MMCIF_TX,
-	},
-	.chan_priv_rx	= {
-		.slave_id = SHDMA_SLAVE_MMCIF_RX,
-	}
-};
-
 static struct sh_mmcif_plat_data sh_mmcif_plat = {
 static struct sh_mmcif_plat_data sh_mmcif_plat = {
-	.dma		= &sh7757lcr_mmcif_dma,
 	.sup_pclk	= 0x0f,
 	.sup_pclk	= 0x0f,
-	.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
+	.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA |
+			  MMC_CAP_NONREMOVABLE,
 	.ocr		= MMC_VDD_32_33 | MMC_VDD_33_34,
 	.ocr		= MMC_VDD_32_33 | MMC_VDD_33_34,
+	.slave_id_tx	= SHDMA_SLAVE_MMCIF_TX,
+	.slave_id_rx	= SHDMA_SLAVE_MMCIF_RX,
 };
 };
 
 
 static struct platform_device sh_mmcif_device = {
 static struct platform_device sh_mmcif_device = {

+ 1 - 0
arch/sh/boards/mach-ap325rxa/setup.c

@@ -22,6 +22,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/smsc911x.h>
 #include <linux/smsc911x.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
+#include <linux/videodev2.h>
 #include <media/ov772x.h>
 #include <media/ov772x.h>
 #include <media/soc_camera.h>
 #include <media/soc_camera.h>
 #include <media/soc_camera_platform.h>
 #include <media/soc_camera_platform.h>

+ 2 - 0
arch/sh/boards/mach-ecovec24/setup.c

@@ -29,9 +29,11 @@
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/sh_eth.h>
 #include <linux/sh_eth.h>
+#include <linux/videodev2.h>
 #include <video/sh_mobile_lcdc.h>
 #include <video/sh_mobile_lcdc.h>
 #include <sound/sh_fsi.h>
 #include <sound/sh_fsi.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/sh_mobile_ceu.h>
+#include <media/soc_camera.h>
 #include <media/tw9910.h>
 #include <media/tw9910.h>
 #include <media/mt9t112.h>
 #include <media/mt9t112.h>
 #include <asm/heartbeat.h>
 #include <asm/heartbeat.h>

+ 1 - 0
arch/sh/boards/mach-kfr2r09/setup.c

@@ -22,6 +22,7 @@
 #include <linux/input/sh_keysc.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/usb/r8a66597.h>
+#include <linux/videodev2.h>
 #include <media/rj54n1cb0c.h>
 #include <media/rj54n1cb0c.h>
 #include <media/soc_camera.h>
 #include <media/soc_camera.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/sh_mobile_ceu.h>

+ 2 - 0
arch/sh/boards/mach-migor/setup.c

@@ -21,9 +21,11 @@
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/gpio.h>
+#include <linux/videodev2.h>
 #include <video/sh_mobile_lcdc.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/ov772x.h>
 #include <media/ov772x.h>
+#include <media/soc_camera.h>
 #include <media/tw9910.h>
 #include <media/tw9910.h>
 #include <asm/clock.h>
 #include <asm/clock.h>
 #include <asm/machvec.h>
 #include <asm/machvec.h>

+ 1 - 0
arch/sh/boards/mach-se/7724/setup.c

@@ -24,6 +24,7 @@
 #include <linux/input/sh_keysc.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/sh_eth.h>
 #include <linux/sh_eth.h>
+#include <linux/videodev2.h>
 #include <video/sh_mobile_lcdc.h>
 #include <video/sh_mobile_lcdc.h>
 #include <media/sh_mobile_ceu.h>
 #include <media/sh_mobile_ceu.h>
 #include <sound/sh_fsi.h>
 #include <sound/sh_fsi.h>

+ 1 - 1
arch/sh/drivers/pci/pci-sh7780.c

@@ -74,7 +74,7 @@ struct pci_errors {
 	{ SH4_PCIINT_MLCK,	"master lock error" },
 	{ SH4_PCIINT_MLCK,	"master lock error" },
 	{ SH4_PCIINT_TABT,	"target-target abort" },
 	{ SH4_PCIINT_TABT,	"target-target abort" },
 	{ SH4_PCIINT_TRET,	"target retry time out" },
 	{ SH4_PCIINT_TRET,	"target retry time out" },
-	{ SH4_PCIINT_MFDE,	"master function disable erorr" },
+	{ SH4_PCIINT_MFDE,	"master function disable error" },
 	{ SH4_PCIINT_PRTY,	"address parity error" },
 	{ SH4_PCIINT_PRTY,	"address parity error" },
 	{ SH4_PCIINT_SERR,	"SERR" },
 	{ SH4_PCIINT_SERR,	"SERR" },
 	{ SH4_PCIINT_TWDP,	"data parity error for target write" },
 	{ SH4_PCIINT_TWDP,	"data parity error for target write" },

+ 4 - 4
arch/sh/include/asm/device.h

@@ -3,9 +3,10 @@
  *
  *
  * This file is released under the GPLv2
  * This file is released under the GPLv2
  */
  */
+#ifndef __ASM_SH_DEVICE_H
+#define __ASM_SH_DEVICE_H
 
 
-struct dev_archdata {
-};
+#include <asm-generic/device.h>
 
 
 struct platform_device;
 struct platform_device;
 /* allocate contiguous memory chunk and fill in struct resource */
 /* allocate contiguous memory chunk and fill in struct resource */
@@ -14,5 +15,4 @@ int platform_resource_setup_memory(struct platform_device *pdev,
 
 
 void plat_early_device_setup(void);
 void plat_early_device_setup(void);
 
 
-struct pdev_archdata {
-};
+#endif /* __ASM_SH_DEVICE_H */

+ 1 - 1
arch/sh/kernel/cpu/sh4a/clock-sh7724.c

@@ -343,7 +343,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[HWBLK_CEU1]),
 	CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[HWBLK_CEU1]),
 	CLKDEV_CON_ID("beu1", &mstp_clks[HWBLK_BEU1]),
 	CLKDEV_CON_ID("beu1", &mstp_clks[HWBLK_BEU1]),
 	CLKDEV_CON_ID("2ddmac0", &mstp_clks[HWBLK_2DDMAC]),
 	CLKDEV_CON_ID("2ddmac0", &mstp_clks[HWBLK_2DDMAC]),
-	CLKDEV_CON_ID("spu0", &mstp_clks[HWBLK_SPU]),
+	CLKDEV_DEV_ID("sh_fsi.0", &mstp_clks[HWBLK_SPU]),
 	CLKDEV_CON_ID("jpu0", &mstp_clks[HWBLK_JPU]),
 	CLKDEV_CON_ID("jpu0", &mstp_clks[HWBLK_JPU]),
 	CLKDEV_DEV_ID("sh-vou.0", &mstp_clks[HWBLK_VOU]),
 	CLKDEV_DEV_ID("sh-vou.0", &mstp_clks[HWBLK_VOU]),
 	CLKDEV_CON_ID("beu0", &mstp_clks[HWBLK_BEU0]),
 	CLKDEV_CON_ID("beu0", &mstp_clks[HWBLK_BEU0]),

+ 21 - 1
arch/sh/kernel/cpu/sh4a/setup-sh7757.c

@@ -133,7 +133,7 @@ static struct resource spi0_resources[] = {
 	[0] = {
 	[0] = {
 		.start	= 0xfe002000,
 		.start	= 0xfe002000,
 		.end	= 0xfe0020ff,
 		.end	= 0xfe0020ff,
-		.flags	= IORESOURCE_MEM,
+		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
 	},
 	},
 	[1] = {
 	[1] = {
 		.start	= 86,
 		.start	= 86,
@@ -661,6 +661,25 @@ static struct platform_device spi0_device = {
 	.resource	= spi0_resources,
 	.resource	= spi0_resources,
 };
 };
 
 
+static struct resource spi1_resources[] = {
+	{
+		.start	= 0xffd8ee70,
+		.end	= 0xffd8eeff,
+		.flags	= IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
+	},
+	{
+		.start	= 54,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device spi1_device = {
+	.name	= "sh_spi",
+	.id	= 1,
+	.num_resources	= ARRAY_SIZE(spi1_resources),
+	.resource	= spi1_resources,
+};
+
 static struct resource usb_ehci_resources[] = {
 static struct resource usb_ehci_resources[] = {
 	[0] = {
 	[0] = {
 		.start	= 0xfe4f1000,
 		.start	= 0xfe4f1000,
@@ -720,6 +739,7 @@ static struct platform_device *sh7757_devices[] __initdata = {
 	&dma2_device,
 	&dma2_device,
 	&dma3_device,
 	&dma3_device,
 	&spi0_device,
 	&spi0_device,
+	&spi1_device,
 	&usb_ehci_device,
 	&usb_ehci_device,
 	&usb_ohci_device,
 	&usb_ohci_device,
 };
 };

+ 1 - 1
arch/sh/kernel/smp.c

@@ -63,7 +63,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 	mp_ops->prepare_cpus(max_cpus);
 	mp_ops->prepare_cpus(max_cpus);
 
 
 #ifndef CONFIG_HOTPLUG_CPU
 #ifndef CONFIG_HOTPLUG_CPU
-	init_cpu_present(&cpu_possible_map);
+	init_cpu_present(cpu_possible_mask);
 #endif
 #endif
 }
 }
 
 

+ 1 - 1
arch/sh/kernel/topology.c

@@ -27,7 +27,7 @@ static cpumask_t cpu_coregroup_map(unsigned int cpu)
 	 * Presently all SH-X3 SMP cores are multi-cores, so just keep it
 	 * Presently all SH-X3 SMP cores are multi-cores, so just keep it
 	 * simple until we have a method for determining topology..
 	 * simple until we have a method for determining topology..
 	 */
 	 */
-	return cpu_possible_map;
+	return *cpu_possible_mask;
 }
 }
 
 
 const struct cpumask *cpu_coregroup_mask(unsigned int cpu)
 const struct cpumask *cpu_coregroup_mask(unsigned int cpu)

+ 2 - 0
arch/sh/mm/cache-sh2a.c

@@ -23,6 +23,7 @@
 #define MAX_OCACHE_PAGES	32
 #define MAX_OCACHE_PAGES	32
 #define MAX_ICACHE_PAGES	32
 #define MAX_ICACHE_PAGES	32
 
 
+#ifdef CONFIG_CACHE_WRITEBACK
 static void sh2a_flush_oc_line(unsigned long v, int way)
 static void sh2a_flush_oc_line(unsigned long v, int way)
 {
 {
 	unsigned long addr = (v & 0x000007f0) | (way << 11);
 	unsigned long addr = (v & 0x000007f0) | (way << 11);
@@ -34,6 +35,7 @@ static void sh2a_flush_oc_line(unsigned long v, int way)
 		__raw_writel(data, CACHE_OC_ADDRESS_ARRAY | addr);
 		__raw_writel(data, CACHE_OC_ADDRESS_ARRAY | addr);
 	}
 	}
 }
 }
+#endif
 
 
 static void sh2a_invalidate_line(unsigned long cache_addr, unsigned long v)
 static void sh2a_invalidate_line(unsigned long cache_addr, unsigned long v)
 {
 {

+ 38 - 15
arch/x86/include/asm/i387.h

@@ -29,10 +29,11 @@ extern unsigned int sig_xstate_size;
 extern void fpu_init(void);
 extern void fpu_init(void);
 extern void mxcsr_feature_mask_init(void);
 extern void mxcsr_feature_mask_init(void);
 extern int init_fpu(struct task_struct *child);
 extern int init_fpu(struct task_struct *child);
-extern void __math_state_restore(struct task_struct *);
 extern void math_state_restore(void);
 extern void math_state_restore(void);
 extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
 extern int dump_fpu(struct pt_regs *, struct user_i387_struct *);
 
 
+DECLARE_PER_CPU(struct task_struct *, fpu_owner_task);
+
 extern user_regset_active_fn fpregs_active, xfpregs_active;
 extern user_regset_active_fn fpregs_active, xfpregs_active;
 extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get,
 extern user_regset_get_fn fpregs_get, xfpregs_get, fpregs_soft_get,
 				xstateregs_get;
 				xstateregs_get;
@@ -269,6 +270,16 @@ static inline int fpu_restore_checking(struct fpu *fpu)
 
 
 static inline int restore_fpu_checking(struct task_struct *tsk)
 static inline int restore_fpu_checking(struct task_struct *tsk)
 {
 {
+	/* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
+	   is pending.  Clear the x87 state here by setting it to fixed
+	   values. "m" is a random variable that should be in L1 */
+	alternative_input(
+		ASM_NOP8 ASM_NOP2,
+		"emms\n\t"	  	/* clear stack tags */
+		"fildl %P[addr]",	/* set F?P to defined value */
+		X86_FEATURE_FXSAVE_LEAK,
+		[addr] "m" (tsk->thread.fpu.has_fpu));
+
 	return fpu_restore_checking(&tsk->thread.fpu);
 	return fpu_restore_checking(&tsk->thread.fpu);
 }
 }
 
 
@@ -279,19 +290,21 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
  */
  */
 static inline int __thread_has_fpu(struct task_struct *tsk)
 static inline int __thread_has_fpu(struct task_struct *tsk)
 {
 {
-	return tsk->thread.has_fpu;
+	return tsk->thread.fpu.has_fpu;
 }
 }
 
 
 /* Must be paired with an 'stts' after! */
 /* Must be paired with an 'stts' after! */
 static inline void __thread_clear_has_fpu(struct task_struct *tsk)
 static inline void __thread_clear_has_fpu(struct task_struct *tsk)
 {
 {
-	tsk->thread.has_fpu = 0;
+	tsk->thread.fpu.has_fpu = 0;
+	percpu_write(fpu_owner_task, NULL);
 }
 }
 
 
 /* Must be paired with a 'clts' before! */
 /* Must be paired with a 'clts' before! */
 static inline void __thread_set_has_fpu(struct task_struct *tsk)
 static inline void __thread_set_has_fpu(struct task_struct *tsk)
 {
 {
-	tsk->thread.has_fpu = 1;
+	tsk->thread.fpu.has_fpu = 1;
+	percpu_write(fpu_owner_task, tsk);
 }
 }
 
 
 /*
 /*
@@ -336,30 +349,36 @@ typedef struct { int preload; } fpu_switch_t;
  * We don't do that yet, so "fpu_lazy_restore()" always returns
  * We don't do that yet, so "fpu_lazy_restore()" always returns
  * false, but some day..
  * false, but some day..
  */
  */
-#define fpu_lazy_restore(tsk) (0)
-#define fpu_lazy_state_intact(tsk) do { } while (0)
+static inline int fpu_lazy_restore(struct task_struct *new, unsigned int cpu)
+{
+	return new == percpu_read_stable(fpu_owner_task) &&
+		cpu == new->thread.fpu.last_cpu;
+}
 
 
-static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct task_struct *new)
+static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct task_struct *new, int cpu)
 {
 {
 	fpu_switch_t fpu;
 	fpu_switch_t fpu;
 
 
 	fpu.preload = tsk_used_math(new) && new->fpu_counter > 5;
 	fpu.preload = tsk_used_math(new) && new->fpu_counter > 5;
 	if (__thread_has_fpu(old)) {
 	if (__thread_has_fpu(old)) {
-		if (__save_init_fpu(old))
-			fpu_lazy_state_intact(old);
-		__thread_clear_has_fpu(old);
-		old->fpu_counter++;
+		if (!__save_init_fpu(old))
+			cpu = ~0;
+		old->thread.fpu.last_cpu = cpu;
+		old->thread.fpu.has_fpu = 0;	/* But leave fpu_owner_task! */
 
 
 		/* Don't change CR0.TS if we just switch! */
 		/* Don't change CR0.TS if we just switch! */
 		if (fpu.preload) {
 		if (fpu.preload) {
+			new->fpu_counter++;
 			__thread_set_has_fpu(new);
 			__thread_set_has_fpu(new);
 			prefetch(new->thread.fpu.state);
 			prefetch(new->thread.fpu.state);
 		} else
 		} else
 			stts();
 			stts();
 	} else {
 	} else {
 		old->fpu_counter = 0;
 		old->fpu_counter = 0;
+		old->thread.fpu.last_cpu = ~0;
 		if (fpu.preload) {
 		if (fpu.preload) {
-			if (fpu_lazy_restore(new))
+			new->fpu_counter++;
+			if (fpu_lazy_restore(new, cpu))
 				fpu.preload = 0;
 				fpu.preload = 0;
 			else
 			else
 				prefetch(new->thread.fpu.state);
 				prefetch(new->thread.fpu.state);
@@ -377,8 +396,10 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
  */
  */
 static inline void switch_fpu_finish(struct task_struct *new, fpu_switch_t fpu)
 static inline void switch_fpu_finish(struct task_struct *new, fpu_switch_t fpu)
 {
 {
-	if (fpu.preload)
-		__math_state_restore(new);
+	if (fpu.preload) {
+		if (unlikely(restore_fpu_checking(new)))
+			__thread_fpu_end(new);
+	}
 }
 }
 
 
 /*
 /*
@@ -451,8 +472,10 @@ static inline void kernel_fpu_begin(void)
 		__save_init_fpu(me);
 		__save_init_fpu(me);
 		__thread_clear_has_fpu(me);
 		__thread_clear_has_fpu(me);
 		/* We do 'stts()' in kernel_fpu_end() */
 		/* We do 'stts()' in kernel_fpu_end() */
-	} else
+	} else {
+		percpu_write(fpu_owner_task, NULL);
 		clts();
 		clts();
+	}
 }
 }
 
 
 static inline void kernel_fpu_end(void)
 static inline void kernel_fpu_end(void)

+ 8 - 0
arch/x86/include/asm/perf_event.h

@@ -242,4 +242,12 @@ static inline void perf_get_x86_pmu_capability(struct x86_pmu_capability *cap)
 static inline void perf_events_lapic_init(void)	{ }
 static inline void perf_events_lapic_init(void)	{ }
 #endif
 #endif
 
 
+#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
+ extern void amd_pmu_enable_virt(void);
+ extern void amd_pmu_disable_virt(void);
+#else
+ static inline void amd_pmu_enable_virt(void) { }
+ static inline void amd_pmu_disable_virt(void) { }
+#endif
+
 #endif /* _ASM_X86_PERF_EVENT_H */
 #endif /* _ASM_X86_PERF_EVENT_H */

+ 2 - 1
arch/x86/include/asm/processor.h

@@ -374,6 +374,8 @@ union thread_xstate {
 };
 };
 
 
 struct fpu {
 struct fpu {
+	unsigned int last_cpu;
+	unsigned int has_fpu;
 	union thread_xstate *state;
 	union thread_xstate *state;
 };
 };
 
 
@@ -454,7 +456,6 @@ struct thread_struct {
 	unsigned long		trap_no;
 	unsigned long		trap_no;
 	unsigned long		error_code;
 	unsigned long		error_code;
 	/* floating point and extended processor state */
 	/* floating point and extended processor state */
-	unsigned long		has_fpu;
 	struct fpu		fpu;
 	struct fpu		fpu;
 #ifdef CONFIG_X86_32
 #ifdef CONFIG_X86_32
 	/* Virtual 86 mode info */
 	/* Virtual 86 mode info */

+ 5 - 0
arch/x86/kernel/cpu/common.c

@@ -1044,6 +1044,9 @@ DEFINE_PER_CPU(char *, irq_stack_ptr) =
 
 
 DEFINE_PER_CPU(unsigned int, irq_count) = -1;
 DEFINE_PER_CPU(unsigned int, irq_count) = -1;
 
 
+DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
+EXPORT_PER_CPU_SYMBOL(fpu_owner_task);
+
 /*
 /*
  * Special IST stacks which the CPU switches to when it calls
  * Special IST stacks which the CPU switches to when it calls
  * an IST-marked descriptor entry. Up to 7 stacks (hardware
  * an IST-marked descriptor entry. Up to 7 stacks (hardware
@@ -1111,6 +1114,8 @@ void debug_stack_reset(void)
 
 
 DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
 DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
 EXPORT_PER_CPU_SYMBOL(current_task);
 EXPORT_PER_CPU_SYMBOL(current_task);
+DEFINE_PER_CPU(struct task_struct *, fpu_owner_task);
+EXPORT_PER_CPU_SYMBOL(fpu_owner_task);
 
 
 #ifdef CONFIG_CC_STACKPROTECTOR
 #ifdef CONFIG_CC_STACKPROTECTOR
 DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);
 DEFINE_PER_CPU_ALIGNED(struct stack_canary, stack_canary);

+ 36 - 8
arch/x86/kernel/cpu/intel_cacheinfo.c

@@ -326,8 +326,7 @@ static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
 	l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1;
 	l3->indices = (max(max3(sc0, sc1, sc2), sc3) << 10) - 1;
 }
 }
 
 
-static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf,
-					int index)
+static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index)
 {
 {
 	int node;
 	int node;
 
 
@@ -725,14 +724,16 @@ static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
 #define CPUID4_INFO_IDX(x, y)	(&((per_cpu(ici_cpuid4_info, x))[y]))
 #define CPUID4_INFO_IDX(x, y)	(&((per_cpu(ici_cpuid4_info, x))[y]))
 
 
 #ifdef CONFIG_SMP
 #ifdef CONFIG_SMP
-static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
+
+static int __cpuinit cache_shared_amd_cpu_map_setup(unsigned int cpu, int index)
 {
 {
-	struct _cpuid4_info	*this_leaf, *sibling_leaf;
-	unsigned long num_threads_sharing;
-	int index_msb, i, sibling;
+	struct _cpuid4_info *this_leaf;
+	int ret, i, sibling;
 	struct cpuinfo_x86 *c = &cpu_data(cpu);
 	struct cpuinfo_x86 *c = &cpu_data(cpu);
 
 
-	if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) {
+	ret = 0;
+	if (index == 3) {
+		ret = 1;
 		for_each_cpu(i, cpu_llc_shared_mask(cpu)) {
 		for_each_cpu(i, cpu_llc_shared_mask(cpu)) {
 			if (!per_cpu(ici_cpuid4_info, i))
 			if (!per_cpu(ici_cpuid4_info, i))
 				continue;
 				continue;
@@ -743,8 +744,35 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
 				set_bit(sibling, this_leaf->shared_cpu_map);
 				set_bit(sibling, this_leaf->shared_cpu_map);
 			}
 			}
 		}
 		}
-		return;
+	} else if ((c->x86 == 0x15) && ((index == 1) || (index == 2))) {
+		ret = 1;
+		for_each_cpu(i, cpu_sibling_mask(cpu)) {
+			if (!per_cpu(ici_cpuid4_info, i))
+				continue;
+			this_leaf = CPUID4_INFO_IDX(i, index);
+			for_each_cpu(sibling, cpu_sibling_mask(cpu)) {
+				if (!cpu_online(sibling))
+					continue;
+				set_bit(sibling, this_leaf->shared_cpu_map);
+			}
+		}
 	}
 	}
+
+	return ret;
+}
+
+static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
+{
+	struct _cpuid4_info *this_leaf, *sibling_leaf;
+	unsigned long num_threads_sharing;
+	int index_msb, i;
+	struct cpuinfo_x86 *c = &cpu_data(cpu);
+
+	if (c->x86_vendor == X86_VENDOR_AMD) {
+		if (cache_shared_amd_cpu_map_setup(cpu, index))
+			return;
+	}
+
 	this_leaf = CPUID4_INFO_IDX(cpu, index);
 	this_leaf = CPUID4_INFO_IDX(cpu, index);
 	num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
 	num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
 
 

+ 2 - 0
arch/x86/kernel/cpu/mcheck/mce_amd.c

@@ -528,6 +528,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
 
 
 	sprintf(name, "threshold_bank%i", bank);
 	sprintf(name, "threshold_bank%i", bank);
 
 
+#ifdef CONFIG_SMP
 	if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) {	/* symlink */
 	if (cpu_data(cpu).cpu_core_id && shared_bank[bank]) {	/* symlink */
 		i = cpumask_first(cpu_llc_shared_mask(cpu));
 		i = cpumask_first(cpu_llc_shared_mask(cpu));
 
 
@@ -553,6 +554,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
 
 
 		goto out;
 		goto out;
 	}
 	}
+#endif
 
 
 	b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL);
 	b = kzalloc(sizeof(struct threshold_bank), GFP_KERNEL);
 	if (!b) {
 	if (!b) {

+ 6 - 2
arch/x86/kernel/cpu/perf_event.h

@@ -147,7 +147,9 @@ struct cpu_hw_events {
 	/*
 	/*
 	 * AMD specific bits
 	 * AMD specific bits
 	 */
 	 */
-	struct amd_nb		*amd_nb;
+	struct amd_nb			*amd_nb;
+	/* Inverted mask of bits to clear in the perf_ctr ctrl registers */
+	u64				perf_ctr_virt_mask;
 
 
 	void				*kfree_on_online;
 	void				*kfree_on_online;
 };
 };
@@ -417,9 +419,11 @@ void x86_pmu_disable_all(void);
 static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
 static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
 					  u64 enable_mask)
 					  u64 enable_mask)
 {
 {
+	u64 disable_mask = __this_cpu_read(cpu_hw_events.perf_ctr_virt_mask);
+
 	if (hwc->extra_reg.reg)
 	if (hwc->extra_reg.reg)
 		wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
 		wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
-	wrmsrl(hwc->config_base, hwc->config | enable_mask);
+	wrmsrl(hwc->config_base, (hwc->config | enable_mask) & ~disable_mask);
 }
 }
 
 
 void x86_pmu_enable_all(int added);
 void x86_pmu_enable_all(int added);

+ 35 - 2
arch/x86/kernel/cpu/perf_event_amd.c

@@ -1,4 +1,5 @@
 #include <linux/perf_event.h>
 #include <linux/perf_event.h>
+#include <linux/export.h>
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
@@ -357,7 +358,9 @@ static void amd_pmu_cpu_starting(int cpu)
 	struct amd_nb *nb;
 	struct amd_nb *nb;
 	int i, nb_id;
 	int i, nb_id;
 
 
-	if (boot_cpu_data.x86_max_cores < 2)
+	cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
+
+	if (boot_cpu_data.x86_max_cores < 2 || boot_cpu_data.x86 == 0x15)
 		return;
 		return;
 
 
 	nb_id = amd_get_nb_id(cpu);
 	nb_id = amd_get_nb_id(cpu);
@@ -587,9 +590,9 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
 	.put_event_constraints	= amd_put_event_constraints,
 	.put_event_constraints	= amd_put_event_constraints,
 
 
 	.cpu_prepare		= amd_pmu_cpu_prepare,
 	.cpu_prepare		= amd_pmu_cpu_prepare,
-	.cpu_starting		= amd_pmu_cpu_starting,
 	.cpu_dead		= amd_pmu_cpu_dead,
 	.cpu_dead		= amd_pmu_cpu_dead,
 #endif
 #endif
+	.cpu_starting		= amd_pmu_cpu_starting,
 };
 };
 
 
 __init int amd_pmu_init(void)
 __init int amd_pmu_init(void)
@@ -621,3 +624,33 @@ __init int amd_pmu_init(void)
 
 
 	return 0;
 	return 0;
 }
 }
+
+void amd_pmu_enable_virt(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	cpuc->perf_ctr_virt_mask = 0;
+
+	/* Reload all events */
+	x86_pmu_disable_all();
+	x86_pmu_enable_all(0);
+}
+EXPORT_SYMBOL_GPL(amd_pmu_enable_virt);
+
+void amd_pmu_disable_virt(void)
+{
+	struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
+
+	/*
+	 * We only mask out the Host-only bit so that host-only counting works
+	 * when SVM is disabled. If someone sets up a guest-only counter when
+	 * SVM is disabled the Guest-only bits still gets set and the counter
+	 * will not count anything.
+	 */
+	cpuc->perf_ctr_virt_mask = AMD_PERFMON_EVENTSEL_HOSTONLY;
+
+	/* Reload all events */
+	x86_pmu_disable_all();
+	x86_pmu_enable_all(0);
+}
+EXPORT_SYMBOL_GPL(amd_pmu_disable_virt);

+ 8 - 1
arch/x86/kernel/entry_64.S

@@ -1531,11 +1531,18 @@ ENTRY(nmi)
 	/* Use %rdx as out temp variable throughout */
 	/* Use %rdx as out temp variable throughout */
 	pushq_cfi %rdx
 	pushq_cfi %rdx
 
 
+	/*
+	 * If %cs was not the kernel segment, then the NMI triggered in user
+	 * space, which means it is definitely not nested.
+	 */
+	cmpl $__KERNEL_CS, 16(%rsp)
+	jne first_nmi
+
 	/*
 	/*
 	 * Check the special variable on the stack to see if NMIs are
 	 * Check the special variable on the stack to see if NMIs are
 	 * executing.
 	 * executing.
 	 */
 	 */
-	cmp $1, -8(%rsp)
+	cmpl $1, -8(%rsp)
 	je nested_nmi
 	je nested_nmi
 
 
 	/*
 	/*

Some files were not shown because too many files changed in this diff