aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig10
-rw-r--r--arch/arm/Makefile5
-rw-r--r--arch/arm/boot/Makefile22
-rw-r--r--arch/arm/boot/compressed/head.S14
-rw-r--r--arch/arm/boot/dts/Makefile56
-rw-r--r--arch/arm/boot/dts/animeo_ip.dts178
-rw-r--r--arch/arm/boot/dts/at91rm9200.dtsi349
-rw-r--r--arch/arm/boot/dts/at91rm9200ek.dts79
-rw-r--r--arch/arm/boot/dts/at91sam9260.dtsi295
-rw-r--r--arch/arm/boot/dts/at91sam9263.dtsi299
-rw-r--r--arch/arm/boot/dts/at91sam9263ek.dts29
-rw-r--r--arch/arm/boot/dts/at91sam9g15.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9g15ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_2mmc.dts26
-rw-r--r--arch/arm/boot/dts/at91sam9g20ek_common.dtsi30
-rw-r--r--arch/arm/boot/dts/at91sam9g25.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9g25ek.dts49
-rw-r--r--arch/arm/boot/dts/at91sam9g35.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9g35ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi301
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts48
-rw-r--r--arch/arm/boot/dts/at91sam9n12.dtsi225
-rw-r--r--arch/arm/boot/dts/at91sam9n12ek.dts22
-rw-r--r--arch/arm/boot/dts/at91sam9x25.dtsi49
-rw-r--r--arch/arm/boot/dts/at91sam9x25ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9x35.dtsi28
-rw-r--r--arch/arm/boot/dts/at91sam9x35ek.dts16
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi270
-rw-r--r--arch/arm/boot/dts/at91sam9x5ek.dtsi101
-rw-r--r--arch/arm/boot/dts/dbx5x0.dtsi14
-rw-r--r--arch/arm/boot/dts/imx28.dtsi1
-rw-r--r--arch/arm/boot/dts/pm9g45.dts165
-rw-r--r--arch/arm/boot/dts/snowball.dts31
-rw-r--r--arch/arm/boot/dts/spear1310-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi27
-rw-r--r--arch/arm/boot/dts/spear1340-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi26
-rw-r--r--arch/arm/boot/dts/spear310.dtsi22
-rw-r--r--arch/arm/boot/dts/spear320-evb.dts4
-rw-r--r--arch/arm/boot/dts/spear320.dtsi23
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts4
-rw-r--r--arch/arm/boot/dts/tegra30.dtsi4
-rw-r--r--arch/arm/common/gic.c45
-rw-r--r--arch/arm/common/timer-sp.c2
-rw-r--r--arch/arm/common/vic.c19
-rw-r--r--arch/arm/configs/at91_dt_defconfig1
-rw-r--r--arch/arm/configs/at91sam9260_defconfig2
-rw-r--r--arch/arm/configs/at91sam9261_defconfig2
-rw-r--r--arch/arm/configs/at91sam9263_defconfig2
-rw-r--r--arch/arm/configs/at91sam9g20_defconfig2
-rw-r--r--arch/arm/configs/corgi_defconfig2
-rw-r--r--arch/arm/configs/davinci_all_defconfig2
-rw-r--r--arch/arm/configs/h7202_defconfig3
-rw-r--r--arch/arm/configs/magician_defconfig2
-rw-r--r--arch/arm/configs/mini2440_defconfig2
-rw-r--r--arch/arm/configs/omap1_defconfig3
-rw-r--r--arch/arm/configs/prima2_defconfig1
-rw-r--r--arch/arm/configs/spitz_defconfig2
-rw-r--r--arch/arm/configs/u8500_defconfig2
-rw-r--r--arch/arm/configs/viper_defconfig2
-rw-r--r--arch/arm/configs/zeus_defconfig2
-rw-r--r--arch/arm/include/asm/Kbuild2
-rw-r--r--arch/arm/include/asm/assembler.h8
-rw-r--r--arch/arm/include/asm/cpu.h1
-rw-r--r--arch/arm/include/asm/cputype.h13
-rw-r--r--arch/arm/include/asm/cti.h20
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h5
-rw-r--r--arch/arm/include/asm/hardware/sp810.h2
-rw-r--r--arch/arm/include/asm/hardware/vic.h2
-rw-r--r--arch/arm/include/asm/hw_breakpoint.h8
-rw-r--r--arch/arm/include/asm/io.h6
-rw-r--r--arch/arm/include/asm/mach/serial_at91.h33
-rw-r--r--arch/arm/include/asm/mach/serial_sa1100.h31
-rw-r--r--arch/arm/include/asm/mach/udc_pxa2xx.h26
-rw-r--r--arch/arm/include/asm/mmu.h13
-rw-r--r--arch/arm/include/asm/mmu_context.h88
-rw-r--r--arch/arm/include/asm/percpu.h45
-rw-r--r--arch/arm/include/asm/perf_event.h7
-rw-r--r--arch/arm/include/asm/pgtable-2level.h2
-rw-r--r--arch/arm/include/asm/pgtable-3level.h4
-rw-r--r--arch/arm/include/asm/pgtable.h10
-rw-r--r--arch/arm/include/asm/pmu.h28
-rw-r--r--arch/arm/include/asm/prom.h4
-rw-r--r--arch/arm/include/asm/sched_clock.h2
-rw-r--r--arch/arm/include/asm/smp.h1
-rw-r--r--arch/arm/include/asm/smp_plat.h17
-rw-r--r--arch/arm/include/asm/syscall.h9
-rw-r--r--arch/arm/include/asm/thread_info.h7
-rw-r--r--arch/arm/include/asm/vfpmacros.h12
-rw-r--r--arch/arm/include/debug/vexpress.S11
-rw-r--r--arch/arm/include/uapi/asm/hwcap.h3
-rw-r--r--arch/arm/kernel/devtree.c104
-rw-r--r--arch/arm/kernel/entry-common.S16
-rw-r--r--arch/arm/kernel/head-nommu.S2
-rw-r--r--arch/arm/kernel/hw_breakpoint.c154
-rw-r--r--arch/arm/kernel/perf_event.c85
-rw-r--r--arch/arm/kernel/perf_event_cpu.c74
-rw-r--r--arch/arm/kernel/perf_event_v6.c126
-rw-r--r--arch/arm/kernel/perf_event_v7.c246
-rw-r--r--arch/arm/kernel/perf_event_xscale.c157
-rw-r--r--arch/arm/kernel/process.c4
-rw-r--r--arch/arm/kernel/ptrace.c43
-rw-r--r--arch/arm/kernel/sched_clock.c18
-rw-r--r--arch/arm/kernel/setup.c84
-rw-r--r--arch/arm/kernel/smp.c12
-rw-r--r--arch/arm/kernel/smp_twd.c54
-rw-r--r--arch/arm/kernel/topology.c42
-rw-r--r--arch/arm/kernel/vmlinux.lds.S19
-rw-r--r--arch/arm/mach-at91/Kconfig9
-rw-r--r--arch/arm/mach-at91/Makefile1
-rw-r--r--arch/arm/mach-at91/at91rm9200.c22
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91/at91rm9200_time.c63
-rw-r--r--arch/arm/mach-at91/at91sam9260.c8
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261.c4
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263.c11
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c12
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9n12.c16
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c4
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c21
-rw-r--r--arch/arm/mach-at91/board-dt.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200-dt.c57
-rw-r--r--arch/arm/mach-at91/board.h10
-rw-r--r--arch/arm/mach-at91/generic.h1
-rw-r--r--arch/arm/mach-at91/gpio.c190
-rw-r--r--arch/arm/mach-at91/setup.c20
-rw-r--r--arch/arm/mach-at91/soc.h12
-rw-r--r--arch/arm/mach-cns3xxx/Kconfig1
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c53
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c5
-rw-r--r--arch/arm/mach-davinci/devices-tnetv107x.c2
-rw-r--r--arch/arm/mach-davinci/dm644x.c3
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h6
-rw-r--r--arch/arm/mach-dove/include/mach/pm.h2
-rw-r--r--arch/arm/mach-dove/irq.c14
-rw-r--r--arch/arm/mach-exynos/dma.c3
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h1
-rw-r--r--arch/arm/mach-highbank/system.c3
-rw-r--r--arch/arm/mach-imx/clk-gate2.c2
-rw-r--r--arch/arm/mach-imx/ehci-imx25.c2
-rw-r--r--arch/arm/mach-imx/ehci-imx35.c2
-rw-r--r--arch/arm/mach-integrator/impd1.c76
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c1
-rw-r--r--arch/arm/mach-ixp4xx/common.c13
-rw-r--r--arch/arm/mach-ixp4xx/goramo_mlr.c3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/debug-macro.S4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h46
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/qmgr.h12
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/udc.h2
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_npe.c9
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_qmgr.c12
-rw-r--r--arch/arm/mach-kirkwood/pcie.c11
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c3
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c2
-rw-r--r--arch/arm/mach-nomadik/i2c-8815nhk.c3
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c5
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c34
-rw-r--r--arch/arm/mach-omap2/common.h4
-rw-r--r--arch/arm/mach-omap2/devices.c79
-rw-r--r--arch/arm/mach-omap2/drm.c7
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S38
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c9
-rw-r--r--arch/arm/mach-omap2/omap-smp.c41
-rw-r--r--arch/arm/mach-omap2/omap4-common.c42
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c63
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h6
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c36
-rw-r--r--arch/arm/mach-omap2/pm.h9
-rw-r--r--arch/arm/mach-omap2/pmu.c2
-rw-r--r--arch/arm/mach-omap2/twl-common.c3
-rw-r--r--arch/arm/mach-omap2/vc.c2
-rw-r--r--arch/arm/mach-pxa/hx4700.c8
-rw-r--r--arch/arm/mach-pxa/include/mach/udc.h2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c6
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c8
-rw-r--r--arch/arm/mach-realview/realview_eb.c1
-rw-r--r--arch/arm/mach-s3c24xx/Kconfig2
-rw-r--r--arch/arm/mach-sa1100/assabet.c2
-rw-r--r--arch/arm/mach-sa1100/badge4.c2
-rw-r--r--arch/arm/mach-sa1100/cerf.c2
-rw-r--r--arch/arm/mach-sa1100/collie.c2
-rw-r--r--arch/arm/mach-sa1100/h3xxx.c2
-rw-r--r--arch/arm/mach-sa1100/hackkit.c2
-rw-r--r--arch/arm/mach-sa1100/jornada720.c2
-rw-r--r--arch/arm/mach-sa1100/lart.c2
-rw-r--r--arch/arm/mach-sa1100/nanoengine.c2
-rw-r--r--arch/arm/mach-sa1100/neponset.c2
-rw-r--r--arch/arm/mach-sa1100/pleb.c2
-rw-r--r--arch/arm/mach-sa1100/shannon.c2
-rw-r--r--arch/arm/mach-sa1100/simpad.c2
-rw-r--r--arch/arm/mach-shmobile/board-kzm9g.c2
-rw-r--r--arch/arm/mach-u300/core.c5
-rw-r--r--arch/arm/mach-u300/include/mach/irqs.h126
-rw-r--r--arch/arm/mach-ux500/board-mop500-audio.c3
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c3
-rw-r--r--arch/arm/mach-ux500/board-mop500.c66
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c12
-rw-r--r--arch/arm/mach-ux500/devices-common.c3
-rw-r--r--arch/arm/mach-ux500/devices-common.h8
-rw-r--r--arch/arm/mach-vexpress/v2m.c2
-rw-r--r--arch/arm/mm/alignment.c2
-rw-r--r--arch/arm/mm/cache-aurora-l2.h55
-rw-r--r--arch/arm/mm/cache-l2x0.c278
-rw-r--r--arch/arm/mm/context.c207
-rw-r--r--arch/arm/mm/idmap.c14
-rw-r--r--arch/arm/mm/ioremap.c16
-rw-r--r--arch/arm/mm/mmap.c134
-rw-r--r--arch/arm/mm/mmu.c2
-rw-r--r--arch/arm/mm/proc-macros.S4
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/mm/proc-v7-2level.S10
-rw-r--r--arch/arm/mm/proc-v7-3level.S5
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/net/bpf_jit_32.c6
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio-nomadik.h102
-rw-r--r--arch/arm/plat-nomadik/include/plat/pincfg.h173
-rw-r--r--arch/arm/plat-omap/include/plat/omap-serial.h55
-rw-r--r--arch/arm/plat-s3c24xx/dma.c9
-rw-r--r--arch/arm/plat-spear/Kconfig1
-rw-r--r--arch/arm/plat-versatile/Kconfig2
-rw-r--r--arch/arm/tools/Makefile2
-rw-r--r--arch/arm/vfp/vfpmodule.c9
-rw-r--r--arch/arm/xen/enlighten.c11
-rw-r--r--arch/arm/xen/hypercall.S14
231 files changed, 5062 insertions, 2220 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 041cf0774776..f24e07630778 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -5,8 +5,9 @@ config ARM
5 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE 5 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
6 select ARCH_HAVE_CUSTOM_GPIO_H 6 select ARCH_HAVE_CUSTOM_GPIO_H
7 select ARCH_WANT_IPC_PARSE_VERSION 7 select ARCH_WANT_IPC_PARSE_VERSION
8 select BUILDTIME_EXTABLE_SORT if MMU
8 select CPU_PM if (SUSPEND || CPU_IDLE) 9 select CPU_PM if (SUSPEND || CPU_IDLE)
9 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN 10 select DCACHE_WORD_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && !CPU_BIG_ENDIAN && MMU
10 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) 11 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI)
11 select GENERIC_CLOCKEVENTS_BROADCAST if SMP 12 select GENERIC_CLOCKEVENTS_BROADCAST if SMP
12 select GENERIC_IRQ_PROBE 13 select GENERIC_IRQ_PROBE
@@ -21,6 +22,7 @@ config ARM
21 select HAVE_AOUT 22 select HAVE_AOUT
22 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 23 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
23 select HAVE_ARCH_KGDB 24 select HAVE_ARCH_KGDB
25 select HAVE_ARCH_SECCOMP_FILTER
24 select HAVE_ARCH_TRACEHOOK 26 select HAVE_ARCH_TRACEHOOK
25 select HAVE_BPF_JIT 27 select HAVE_BPF_JIT
26 select HAVE_C_RECORDMCOUNT 28 select HAVE_C_RECORDMCOUNT
@@ -330,6 +332,8 @@ config ARCH_AT91
330 select IRQ_DOMAIN 332 select IRQ_DOMAIN
331 select NEED_MACH_GPIO_H 333 select NEED_MACH_GPIO_H
332 select NEED_MACH_IO_H if PCCARD 334 select NEED_MACH_IO_H if PCCARD
335 select PINCTRL
336 select PINCTRL_AT91 if USE_OF
333 help 337 help
334 This enables support for systems based on Atmel 338 This enables support for systems based on Atmel
335 AT91RM9200 and AT91SAM9* processors. 339 AT91RM9200 and AT91SAM9* processors.
@@ -364,6 +368,7 @@ config ARCH_CNS3XXX
364 368
365config ARCH_CLPS711X 369config ARCH_CLPS711X
366 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based" 370 bool "Cirrus Logic CLPS711x/EP721x/EP731x-based"
371 select ARCH_REQUIRE_GPIOLIB
367 select ARCH_USES_GETTIMEOFFSET 372 select ARCH_USES_GETTIMEOFFSET
368 select CLKDEV_LOOKUP 373 select CLKDEV_LOOKUP
369 select COMMON_CLK 374 select COMMON_CLK
@@ -547,6 +552,7 @@ config ARCH_KIRKWOOD
547 select CPU_FEROCEON 552 select CPU_FEROCEON
548 select GENERIC_CLOCKEVENTS 553 select GENERIC_CLOCKEVENTS
549 select PCI 554 select PCI
555 select PCI_QUIRKS
550 select PLAT_ORION_LEGACY 556 select PLAT_ORION_LEGACY
551 help 557 help
552 Support for the following Marvell Kirkwood series SoCs: 558 Support for the following Marvell Kirkwood series SoCs:
@@ -586,6 +592,7 @@ config ARCH_MMP
586 select GPIO_PXA 592 select GPIO_PXA
587 select IRQ_DOMAIN 593 select IRQ_DOMAIN
588 select NEED_MACH_GPIO_H 594 select NEED_MACH_GPIO_H
595 select PINCTRL
589 select PLAT_PXA 596 select PLAT_PXA
590 select SPARSE_IRQ 597 select SPARSE_IRQ
591 help 598 help
@@ -904,6 +911,7 @@ config ARCH_NOMADIK
904 911
905config PLAT_SPEAR 912config PLAT_SPEAR
906 bool "ST SPEAr" 913 bool "ST SPEAr"
914 select ARCH_HAS_CPUFREQ
907 select ARCH_REQUIRE_GPIOLIB 915 select ARCH_REQUIRE_GPIOLIB
908 select ARM_AMBA 916 select ARM_AMBA
909 select CLKDEV_LOOKUP 917 select CLKDEV_LOOKUP
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 5f914fca911b..45096a1ee0a0 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -32,6 +32,7 @@ KBUILD_DEFCONFIG := versatile_defconfig
32# defines filename extension depending memory management type. 32# defines filename extension depending memory management type.
33ifeq ($(CONFIG_MMU),) 33ifeq ($(CONFIG_MMU),)
34MMUEXT := -nommu 34MMUEXT := -nommu
35KBUILD_CFLAGS += $(call cc-option,-mno-unaligned-access)
35endif 36endif
36 37
37ifeq ($(CONFIG_FRAME_POINTER),y) 38ifeq ($(CONFIG_FRAME_POINTER),y)
@@ -292,10 +293,10 @@ zinstall uinstall install: vmlinux
292 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 293 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
293 294
294%.dtb: scripts 295%.dtb: scripts
295 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 296 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
296 297
297dtbs: scripts 298dtbs: scripts
298 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 299 $(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
299 300
300# We use MRPROPER_FILES and CLEAN_FILES now 301# We use MRPROPER_FILES and CLEAN_FILES now
301archclean: 302archclean:
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index f2aa09eb658e..abfce280f57b 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -15,8 +15,6 @@ ifneq ($(MACHINE),)
15include $(srctree)/$(MACHINE)/Makefile.boot 15include $(srctree)/$(MACHINE)/Makefile.boot
16endif 16endif
17 17
18include $(srctree)/arch/arm/boot/dts/Makefile
19
20# Note: the following conditions must always be true: 18# Note: the following conditions must always be true:
21# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET) 19# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
22# PARAMS_PHYS must be within 4MB of ZRELADDR 20# PARAMS_PHYS must be within 4MB of ZRELADDR
@@ -33,7 +31,7 @@ ifeq ($(CONFIG_XIP_KERNEL),y)
33 31
34$(obj)/xipImage: vmlinux FORCE 32$(obj)/xipImage: vmlinux FORCE
35 $(call if_changed,objcopy) 33 $(call if_changed,objcopy)
36 $(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))' 34 @$(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))'
37 35
38$(obj)/Image $(obj)/zImage: FORCE 36$(obj)/Image $(obj)/zImage: FORCE
39 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)' 37 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)'
@@ -48,27 +46,17 @@ $(obj)/xipImage: FORCE
48 46
49$(obj)/Image: vmlinux FORCE 47$(obj)/Image: vmlinux FORCE
50 $(call if_changed,objcopy) 48 $(call if_changed,objcopy)
51 $(kecho) ' Kernel: $@ is ready' 49 @$(kecho) ' Kernel: $@ is ready'
52 50
53$(obj)/compressed/vmlinux: $(obj)/Image FORCE 51$(obj)/compressed/vmlinux: $(obj)/Image FORCE
54 $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 52 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
55 53
56$(obj)/zImage: $(obj)/compressed/vmlinux FORCE 54$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
57 $(call if_changed,objcopy) 55 $(call if_changed,objcopy)
58 $(kecho) ' Kernel: $@ is ready' 56 @$(kecho) ' Kernel: $@ is ready'
59 57
60endif 58endif
61 59
62targets += $(dtb-y)
63
64# Rule to build device tree blobs
65$(obj)/%.dtb: $(src)/dts/%.dts FORCE
66 $(call if_changed_dep,dtc)
67
68$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
69
70clean-files := *.dtb
71
72ifneq ($(LOADADDR),) 60ifneq ($(LOADADDR),)
73 UIMAGE_LOADADDR=$(LOADADDR) 61 UIMAGE_LOADADDR=$(LOADADDR)
74else 62else
@@ -90,7 +78,7 @@ fi
90$(obj)/uImage: $(obj)/zImage FORCE 78$(obj)/uImage: $(obj)/zImage FORCE
91 @$(check_for_multiple_loadaddr) 79 @$(check_for_multiple_loadaddr)
92 $(call if_changed,uimage) 80 $(call if_changed,uimage)
93 $(kecho) ' Image $@ is ready' 81 @$(kecho) ' Image $@ is ready'
94 82
95$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE 83$(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
96 $(Q)$(MAKE) $(build)=$(obj)/bootp $@ 84 $(Q)$(MAKE) $(build)=$(obj)/bootp $@
@@ -98,7 +86,7 @@ $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
98 86
99$(obj)/bootpImage: $(obj)/bootp/bootp FORCE 87$(obj)/bootpImage: $(obj)/bootp/bootp FORCE
100 $(call if_changed,objcopy) 88 $(call if_changed,objcopy)
101 $(kecho) ' Kernel: $@ is ready' 89 @$(kecho) ' Kernel: $@ is ready'
102 90
103PHONY += initrd FORCE 91PHONY += initrd FORCE
104initrd: 92initrd:
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 90275f036cd1..49ca86e37b8d 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -652,6 +652,15 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
652 mov pc, lr 652 mov pc, lr
653ENDPROC(__setup_mmu) 653ENDPROC(__setup_mmu)
654 654
655@ Enable unaligned access on v6, to allow better code generation
656@ for the decompressor C code:
657__armv6_mmu_cache_on:
658 mrc p15, 0, r0, c1, c0, 0 @ read SCTLR
659 bic r0, r0, #2 @ A (no unaligned access fault)
660 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
661 mcr p15, 0, r0, c1, c0, 0 @ write SCTLR
662 b __armv4_mmu_cache_on
663
655__arm926ejs_mmu_cache_on: 664__arm926ejs_mmu_cache_on:
656#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH 665#ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
657 mov r0, #4 @ put dcache in WT mode 666 mov r0, #4 @ put dcache in WT mode
@@ -694,6 +703,9 @@ __armv7_mmu_cache_on:
694 bic r0, r0, #1 << 28 @ clear SCTLR.TRE 703 bic r0, r0, #1 << 28 @ clear SCTLR.TRE
695 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement 704 orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement
696 orr r0, r0, #0x003c @ write buffer 705 orr r0, r0, #0x003c @ write buffer
706 bic r0, r0, #2 @ A (no unaligned access fault)
707 orr r0, r0, #1 << 22 @ U (v6 unaligned access model)
708 @ (needed for ARM1176)
697#ifdef CONFIG_MMU 709#ifdef CONFIG_MMU
698#ifdef CONFIG_CPU_ENDIAN_BE8 710#ifdef CONFIG_CPU_ENDIAN_BE8
699 orr r0, r0, #1 << 25 @ big-endian page tables 711 orr r0, r0, #1 << 25 @ big-endian page tables
@@ -914,7 +926,7 @@ proc_types:
914 926
915 .word 0x0007b000 @ ARMv6 927 .word 0x0007b000 @ ARMv6
916 .word 0x000ff000 928 .word 0x000ff000
917 W(b) __armv4_mmu_cache_on 929 W(b) __armv6_mmu_cache_on
918 W(b) __armv4_mmu_cache_off 930 W(b) __armv4_mmu_cache_off
919 W(b) __armv6_mmu_cache_flush 931 W(b) __armv6_mmu_cache_flush
920 932
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index f37cf9fa5fa0..262493752234 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1,21 +1,37 @@
1ifeq ($(CONFIG_OF),y) 1ifeq ($(CONFIG_OF),y)
2 2
3dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb \ 3# Keep at91 dtb files sorted alphabetically for each SoC
4 at91sam9263ek.dtb \ 4# rm9200
5 at91sam9g20ek_2mmc.dtb \ 5dtb-$(CONFIG_ARCH_AT91) += at91rm9200ek.dtb
6 at91sam9g20ek.dtb \ 6# sam9260
7 at91sam9g25ek.dtb \ 7dtb-$(CONFIG_ARCH_AT91) += animeo_ip.dtb
8 at91sam9m10g45ek.dtb \ 8dtb-$(CONFIG_ARCH_AT91) += aks-cdu.dtb
9 at91sam9n12ek.dtb \ 9dtb-$(CONFIG_ARCH_AT91) += ethernut5.dtb
10 ethernut5.dtb \ 10dtb-$(CONFIG_ARCH_AT91) += evk-pro3.dtb
11 evk-pro3.dtb \ 11dtb-$(CONFIG_ARCH_AT91) += tny_a9260.dtb
12 kizbox.dtb \ 12dtb-$(CONFIG_ARCH_AT91) += usb_a9260.dtb
13 tny_a9260.dtb \ 13# sam9263
14 tny_a9263.dtb \ 14dtb-$(CONFIG_ARCH_AT91) += at91sam9263ek.dtb
15 tny_a9g20.dtb \ 15dtb-$(CONFIG_ARCH_AT91) += tny_a9263.dtb
16 usb_a9260.dtb \ 16dtb-$(CONFIG_ARCH_AT91) += usb_a9263.dtb
17 usb_a9263.dtb \ 17# sam9g20
18 usb_a9g20.dtb 18dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek.dtb
19dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek_2mmc.dtb
20dtb-$(CONFIG_ARCH_AT91) += kizbox.dtb
21dtb-$(CONFIG_ARCH_AT91) += tny_a9g20.dtb
22dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb
23# sam9g45
24dtb-$(CONFIG_ARCH_AT91) += at91sam9m10g45ek.dtb
25dtb-$(CONFIG_ARCH_AT91) += pm9g45.dtb
26# sam9n12
27dtb-$(CONFIG_ARCH_AT91) += at91sam9n12ek.dtb
28# sam9x5
29dtb-$(CONFIG_ARCH_AT91) += at91sam9g15ek.dtb
30dtb-$(CONFIG_ARCH_AT91) += at91sam9g25ek.dtb
31dtb-$(CONFIG_ARCH_AT91) += at91sam9g35ek.dtb
32dtb-$(CONFIG_ARCH_AT91) += at91sam9x25ek.dtb
33dtb-$(CONFIG_ARCH_AT91) += at91sam9x35ek.dtb
34
19dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb 35dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-b.dtb
20dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \ 36dtb-$(CONFIG_ARCH_DOVE) += dove-cm-a510.dtb \
21 dove-cubox.dtb \ 37 dove-cubox.dtb \
@@ -104,4 +120,12 @@ dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
104 wm8505-ref.dtb \ 120 wm8505-ref.dtb \
105 wm8650-mid.dtb 121 wm8650-mid.dtb
106 122
123targets += dtbs
107endif 124endif
125
126# *.dtb used to be generated in the directory above. Clean out the
127# old build results so people don't accidentally use them.
128dtbs: $(addprefix $(obj)/, $(dtb-y))
129 $(Q)rm -f $(obj)/../*.dtb
130
131clean-files := *.dtb
diff --git a/arch/arm/boot/dts/animeo_ip.dts b/arch/arm/boot/dts/animeo_ip.dts
new file mode 100644
index 000000000000..74d92cd29d87
--- /dev/null
+++ b/arch/arm/boot/dts/animeo_ip.dts
@@ -0,0 +1,178 @@
1/*
2 * animeo_ip.dts - Device Tree file for Somfy Animeo IP Boards
3 *
4 * Copyright (C) 2011-2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2 only.
7 */
8
9/dts-v1/;
10/include/ "at91sam9260.dtsi"
11
12/ {
13 model = "Somfy Animeo IP";
14 compatible = "somfy,animeo-ip", "atmel,at91sam9260", "atmel,at91sam9";
15
16 aliases {
17 serial0 = &usart1;
18 serial1 = &usart2;
19 serial2 = &usart0;
20 serial3 = &dbgu;
21 serial4 = &usart3;
22 serial5 = &uart0;
23 serial6 = &uart1;
24 };
25
26 chosen {
27 linux,stdout-path = &usart2;
28 };
29
30 memory {
31 reg = <0x20000000 0x4000000>;
32 };
33
34 clocks {
35 #address-cells = <1>;
36 #size-cells = <1>;
37 ranges;
38
39 main_clock: clock@0 {
40 compatible = "atmel,osc", "fixed-clock";
41 clock-frequency = <18432000>;
42 };
43 };
44
45 ahb {
46 apb {
47 usart0: serial@fffb0000 {
48 pinctrl-0 = <&pinctrl_usart0 &pinctrl_usart0_rts>;
49 linux,rs485-enabled-at-boot-time;
50 status = "okay";
51 };
52
53 usart1: serial@fffb4000 {
54 pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts>;
55 linux,rs485-enabled-at-boot-time;
56 status = "okay";
57 };
58
59 usart2: serial@fffb8000 {
60 pinctrl-0 = <&pinctrl_usart2>;
61 status = "okay";
62 };
63
64 macb0: ethernet@fffc4000 {
65 pinctrl-0 = <&pinctrl_macb_rmii &pinctrl_macb_rmii_mii>;
66 phy-mode = "mii";
67 status = "okay";
68 };
69
70 mmc0: mmc@fffa8000 {
71 pinctrl-0 = <&pinctrl_mmc0_clk
72 &pinctrl_mmc0_slot1_cmd_dat0
73 &pinctrl_mmc0_slot1_dat1_3>;
74 status = "okay";
75
76 slot@1 {
77 reg = <1>;
78 bus-width = <4>;
79 };
80 };
81 };
82
83 nand0: nand@40000000 {
84 nand-bus-width = <8>;
85 nand-ecc-mode = "soft";
86 nand-on-flash-bbt;
87 status = "okay";
88
89 at91bootstrap@0 {
90 label = "at91bootstrap";
91 reg = <0x0 0x8000>;
92 };
93
94 barebox@8000 {
95 label = "barebox";
96 reg = <0x8000 0x40000>;
97 };
98
99 bareboxenv@48000 {
100 label = "bareboxenv";
101 reg = <0x48000 0x8000>;
102 };
103
104 user_block@0x50000 {
105 label = "user_block";
106 reg = <0x50000 0xb0000>;
107 };
108
109 kernel@100000 {
110 label = "kernel";
111 reg = <0x100000 0x1b0000>;
112 };
113
114 root@2b0000 {
115 label = "root";
116 reg = <0x2b0000 0x1D50000>;
117 };
118 };
119
120 usb0: ohci@00500000 {
121 num-ports = <2>;
122 atmel,vbus-gpio = <&pioB 15 1>;
123 status = "okay";
124 };
125 };
126
127 leds {
128 compatible = "gpio-leds";
129
130 power_green {
131 label = "power_green";
132 gpios = <&pioC 17 0>;
133 linux,default-trigger = "heartbeat";
134 };
135
136 power_red {
137 label = "power_red";
138 gpios = <&pioA 2 0>;
139 };
140
141 tx_green {
142 label = "tx_green";
143 gpios = <&pioC 19 0>;
144 };
145
146 tx_red {
147 label = "tx_red";
148 gpios = <&pioC 18 0>;
149 };
150 };
151
152 gpio_keys {
153 compatible = "gpio-keys";
154 #address-cells = <1>;
155 #size-cells = <0>;
156
157 keyswitch_in {
158 label = "keyswitch_in";
159 gpios = <&pioB 1 0>;
160 linux,code = <28>;
161 gpio-key,wakeup;
162 };
163
164 error_in {
165 label = "error_in";
166 gpios = <&pioB 2 0>;
167 linux,code = <29>;
168 gpio-key,wakeup;
169 };
170
171 btn {
172 label = "btn";
173 gpios = <&pioC 23 0>;
174 linux,code = <31>;
175 gpio-key,wakeup;
176 };
177 };
178};
diff --git a/arch/arm/boot/dts/at91rm9200.dtsi b/arch/arm/boot/dts/at91rm9200.dtsi
new file mode 100644
index 000000000000..e154f242c680
--- /dev/null
+++ b/arch/arm/boot/dts/at91rm9200.dtsi
@@ -0,0 +1,349 @@
1/*
2 * at91rm9200.dtsi - Device Tree Include file for AT91RM9200 family SoC
3 *
4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>,
6 * 2012 Joachim Eastwood <manabian@gmail.com>
7 *
8 * Based on at91sam9260.dtsi
9 *
10 * Licensed under GPLv2 or later.
11 */
12
13/include/ "skeleton.dtsi"
14
15/ {
16 model = "Atmel AT91RM9200 family SoC";
17 compatible = "atmel,at91rm9200";
18 interrupt-parent = <&aic>;
19
20 aliases {
21 serial0 = &dbgu;
22 serial1 = &usart0;
23 serial2 = &usart1;
24 serial3 = &usart2;
25 serial4 = &usart3;
26 gpio0 = &pioA;
27 gpio1 = &pioB;
28 gpio2 = &pioC;
29 gpio3 = &pioD;
30 tcb0 = &tcb0;
31 tcb1 = &tcb1;
32 };
33 cpus {
34 cpu@0 {
35 compatible = "arm,arm920t";
36 };
37 };
38
39 memory {
40 reg = <0x20000000 0x04000000>;
41 };
42
43 ahb {
44 compatible = "simple-bus";
45 #address-cells = <1>;
46 #size-cells = <1>;
47 ranges;
48
49 apb {
50 compatible = "simple-bus";
51 #address-cells = <1>;
52 #size-cells = <1>;
53 ranges;
54
55 aic: interrupt-controller@fffff000 {
56 #interrupt-cells = <3>;
57 compatible = "atmel,at91rm9200-aic";
58 interrupt-controller;
59 reg = <0xfffff000 0x200>;
60 atmel,external-irqs = <25 26 27 28 29 30 31>;
61 };
62
63 ramc0: ramc@ffffff00 {
64 compatible = "atmel,at91rm9200-sdramc";
65 reg = <0xffffff00 0x100>;
66 };
67
68 pmc: pmc@fffffc00 {
69 compatible = "atmel,at91rm9200-pmc";
70 reg = <0xfffffc00 0x100>;
71 };
72
73 st: timer@fffffd00 {
74 compatible = "atmel,at91rm9200-st";
75 reg = <0xfffffd00 0x100>;
76 interrupts = <1 4 7>;
77 };
78
79 tcb0: timer@fffa0000 {
80 compatible = "atmel,at91rm9200-tcb";
81 reg = <0xfffa0000 0x100>;
82 interrupts = <17 4 0 18 4 0 19 4 0>;
83 };
84
85 tcb1: timer@fffa4000 {
86 compatible = "atmel,at91rm9200-tcb";
87 reg = <0xfffa4000 0x100>;
88 interrupts = <20 4 0 21 4 0 22 4 0>;
89 };
90
91 pinctrl@fffff400 {
92 #address-cells = <1>;
93 #size-cells = <1>;
94 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
95 ranges = <0xfffff400 0xfffff400 0x800>;
96
97 atmel,mux-mask = <
98 /* A B */
99 0xffffffff 0xffffffff /* pioA */
100 0xffffffff 0x083fffff /* pioB */
101 0xffff3fff 0x00000000 /* pioC */
102 0x03ff87ff 0x0fffff80 /* pioD */
103 >;
104
105 /* shared pinctrl settings */
106 dbgu {
107 pinctrl_dbgu: dbgu-0 {
108 atmel,pins =
109 <0 30 0x1 0x0 /* PA30 periph A */
110 0 31 0x1 0x1>; /* PA31 periph with pullup */
111 };
112 };
113
114 uart0 {
115 pinctrl_uart0: uart0-0 {
116 atmel,pins =
117 <0 17 0x1 0x0 /* PA17 periph A */
118 0 18 0x1 0x0>; /* PA18 periph A */
119 };
120
121 pinctrl_uart0_rts: uart0_rts-0 {
122 atmel,pins =
123 <0 20 0x1 0x0>; /* PA20 periph A */
124 };
125
126 pinctrl_uart0_cts: uart0_cts-0 {
127 atmel,pins =
128 <0 21 0x1 0x0>; /* PA21 periph A */
129 };
130 };
131
132 uart1 {
133 pinctrl_uart1: uart1-0 {
134 atmel,pins =
135 <1 20 0x1 0x1 /* PB20 periph A with pullup */
136 1 21 0x1 0x0>; /* PB21 periph A */
137 };
138
139 pinctrl_uart1_rts: uart1_rts-0 {
140 atmel,pins =
141 <1 24 0x1 0x0>; /* PB24 periph A */
142 };
143
144 pinctrl_uart1_cts: uart1_cts-0 {
145 atmel,pins =
146 <1 26 0x1 0x0>; /* PB26 periph A */
147 };
148
149 pinctrl_uart1_dtr_dsr: uart1_dtr_dsr-0 {
150 atmel,pins =
151 <1 19 0x1 0x0 /* PB19 periph A */
152 1 25 0x1 0x0>; /* PB25 periph A */
153 };
154
155 pinctrl_uart1_dcd: uart1_dcd-0 {
156 atmel,pins =
157 <1 23 0x1 0x0>; /* PB23 periph A */
158 };
159
160 pinctrl_uart1_ri: uart1_ri-0 {
161 atmel,pins =
162 <1 18 0x1 0x0>; /* PB18 periph A */
163 };
164 };
165
166 uart2 {
167 pinctrl_uart2: uart2-0 {
168 atmel,pins =
169 <0 22 0x1 0x0 /* PA22 periph A */
170 0 23 0x1 0x1>; /* PA23 periph A with pullup */
171 };
172
173 pinctrl_uart2_rts: uart2_rts-0 {
174 atmel,pins =
175 <0 30 0x2 0x0>; /* PA30 periph B */
176 };
177
178 pinctrl_uart2_cts: uart2_cts-0 {
179 atmel,pins =
180 <0 31 0x2 0x0>; /* PA31 periph B */
181 };
182 };
183
184 uart3 {
185 pinctrl_uart3: uart3-0 {
186 atmel,pins =
187 <0 5 0x2 0x1 /* PA5 periph B with pullup */
188 0 6 0x2 0x0>; /* PA6 periph B */
189 };
190
191 pinctrl_uart3_rts: uart3_rts-0 {
192 atmel,pins =
193 <1 0 0x2 0x0>; /* PB0 periph B */
194 };
195
196 pinctrl_uart3_cts: uart3_cts-0 {
197 atmel,pins =
198 <1 1 0x2 0x0>; /* PB1 periph B */
199 };
200 };
201
202 nand {
203 pinctrl_nand: nand-0 {
204 atmel,pins =
205 <2 2 0x0 0x1 /* PC2 gpio RDY pin pull_up */
206 1 1 0x0 0x1>; /* PB1 gpio CD pin pull_up */
207 };
208 };
209
210 pioA: gpio@fffff400 {
211 compatible = "atmel,at91rm9200-gpio";
212 reg = <0xfffff400 0x200>;
213 interrupts = <2 4 1>;
214 #gpio-cells = <2>;
215 gpio-controller;
216 interrupt-controller;
217 #interrupt-cells = <2>;
218 };
219
220 pioB: gpio@fffff600 {
221 compatible = "atmel,at91rm9200-gpio";
222 reg = <0xfffff600 0x200>;
223 interrupts = <3 4 1>;
224 #gpio-cells = <2>;
225 gpio-controller;
226 interrupt-controller;
227 #interrupt-cells = <2>;
228 };
229
230 pioC: gpio@fffff800 {
231 compatible = "atmel,at91rm9200-gpio";
232 reg = <0xfffff800 0x200>;
233 interrupts = <4 4 1>;
234 #gpio-cells = <2>;
235 gpio-controller;
236 interrupt-controller;
237 #interrupt-cells = <2>;
238 };
239
240 pioD: gpio@fffffa00 {
241 compatible = "atmel,at91rm9200-gpio";
242 reg = <0xfffffa00 0x200>;
243 interrupts = <5 4 1>;
244 #gpio-cells = <2>;
245 gpio-controller;
246 interrupt-controller;
247 #interrupt-cells = <2>;
248 };
249 };
250
251 dbgu: serial@fffff200 {
252 compatible = "atmel,at91rm9200-usart";
253 reg = <0xfffff200 0x200>;
254 interrupts = <1 4 7>;
255 pinctrl-names = "default";
256 pinctrl-0 = <&pinctrl_dbgu>;
257 status = "disabled";
258 };
259
260 usart0: serial@fffc0000 {
261 compatible = "atmel,at91rm9200-usart";
262 reg = <0xfffc0000 0x200>;
263 interrupts = <6 4 5>;
264 atmel,use-dma-rx;
265 atmel,use-dma-tx;
266 pinctrl-names = "default";
267 pinctrl-0 = <&pinctrl_uart0>;
268 status = "disabled";
269 };
270
271 usart1: serial@fffc4000 {
272 compatible = "atmel,at91rm9200-usart";
273 reg = <0xfffc4000 0x200>;
274 interrupts = <7 4 5>;
275 atmel,use-dma-rx;
276 atmel,use-dma-tx;
277 pinctrl-names = "default";
278 pinctrl-0 = <&pinctrl_uart1>;
279 status = "disabled";
280 };
281
282 usart2: serial@fffc8000 {
283 compatible = "atmel,at91rm9200-usart";
284 reg = <0xfffc8000 0x200>;
285 interrupts = <8 4 5>;
286 atmel,use-dma-rx;
287 atmel,use-dma-tx;
288 pinctrl-names = "default";
289 pinctrl-0 = <&pinctrl_uart2>;
290 status = "disabled";
291 };
292
293 usart3: serial@fffcc000 {
294 compatible = "atmel,at91rm9200-usart";
295 reg = <0xfffcc000 0x200>;
296 interrupts = <23 4 5>;
297 atmel,use-dma-rx;
298 atmel,use-dma-tx;
299 pinctrl-names = "default";
300 pinctrl-0 = <&pinctrl_uart3>;
301 status = "disabled";
302 };
303
304 usb1: gadget@fffb0000 {
305 compatible = "atmel,at91rm9200-udc";
306 reg = <0xfffb0000 0x4000>;
307 interrupts = <11 4 2>;
308 status = "disabled";
309 };
310 };
311
312 nand0: nand@40000000 {
313 compatible = "atmel,at91rm9200-nand";
314 #address-cells = <1>;
315 #size-cells = <1>;
316 reg = <0x40000000 0x10000000>;
317 atmel,nand-addr-offset = <21>;
318 atmel,nand-cmd-offset = <22>;
319 pinctrl-names = "default";
320 pinctrl-0 = <&pinctrl_nand>;
321 nand-ecc-mode = "soft";
322 gpios = <&pioC 2 0
323 0
324 &pioB 1 0
325 >;
326 status = "disabled";
327 };
328
329 usb0: ohci@00300000 {
330 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
331 reg = <0x00300000 0x100000>;
332 interrupts = <23 4 2>;
333 status = "disabled";
334 };
335 };
336
337 i2c@0 {
338 compatible = "i2c-gpio";
339 gpios = <&pioA 23 0 /* sda */
340 &pioA 24 0 /* scl */
341 >;
342 i2c-gpio,sda-open-drain;
343 i2c-gpio,scl-open-drain;
344 i2c-gpio,delay-us = <2>; /* ~100 kHz */
345 #address-cells = <1>;
346 #size-cells = <0>;
347 status = "disabled";
348 };
349};
diff --git a/arch/arm/boot/dts/at91rm9200ek.dts b/arch/arm/boot/dts/at91rm9200ek.dts
new file mode 100644
index 000000000000..8aa48931e0a2
--- /dev/null
+++ b/arch/arm/boot/dts/at91rm9200ek.dts
@@ -0,0 +1,79 @@
1/*
2 * at91rm9200ek.dts - Device Tree file for Atmel AT91RM9200 evaluation kit
3 *
4 * Copyright (C) 2012 Joachim Eastwood <manabian@gmail.com>
5 *
6 * Licensed under GPLv2 only
7 */
8/dts-v1/;
9/include/ "at91rm9200.dtsi"
10
11/ {
12 model = "Atmel AT91RM9200 evaluation kit";
13 compatible = "atmel,at91rm9200ek", "atmel,at91rm9200";
14
15 memory {
16 reg = <0x20000000 0x4000000>;
17 };
18
19 clocks {
20 #address-cells = <1>;
21 #size-cells = <1>;
22 ranges;
23
24 main_clock: clock@0 {
25 compatible = "atmel,osc", "fixed-clock";
26 clock-frequency = <18432000>;
27 };
28 };
29
30 ahb {
31 apb {
32 dbgu: serial@fffff200 {
33 status = "okay";
34 };
35
36 usart1: serial@fffc4000 {
37 pinctrl-0 =
38 <&pinctrl_uart1
39 &pinctrl_uart1_rts
40 &pinctrl_uart1_cts
41 &pinctrl_uart1_dtr_dsr
42 &pinctrl_uart1_dcd
43 &pinctrl_uart1_ri>;
44 status = "okay";
45 };
46
47 usb1: gadget@fffb0000 {
48 atmel,vbus-gpio = <&pioD 4 0>;
49 status = "okay";
50 };
51 };
52
53 usb0: ohci@00300000 {
54 num-ports = <2>;
55 status = "okay";
56 };
57 };
58
59 leds {
60 compatible = "gpio-leds";
61
62 ds2 {
63 label = "green";
64 gpios = <&pioB 0 0x1>;
65 linux,default-trigger = "mmc0";
66 };
67
68 ds4 {
69 label = "yellow";
70 gpios = <&pioB 1 0x1>;
71 linux,default-trigger = "heartbeat";
72 };
73
74 ds6 {
75 label = "red";
76 gpios = <&pioB 2 0x1>;
77 };
78 };
79};
diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi
index d410581a5a85..b1d3fab60e0a 100644
--- a/arch/arm/boot/dts/at91sam9260.dtsi
+++ b/arch/arm/boot/dts/at91sam9260.dtsi
@@ -21,8 +21,8 @@
21 serial2 = &usart1; 21 serial2 = &usart1;
22 serial3 = &usart2; 22 serial3 = &usart2;
23 serial4 = &usart3; 23 serial4 = &usart3;
24 serial5 = &usart4; 24 serial5 = &uart0;
25 serial6 = &usart5; 25 serial6 = &uart1;
26 gpio0 = &pioA; 26 gpio0 = &pioA;
27 gpio1 = &pioB; 27 gpio1 = &pioB;
28 gpio2 = &pioC; 28 gpio2 = &pioC;
@@ -98,40 +98,250 @@
98 interrupts = <26 4 0 27 4 0 28 4 0>; 98 interrupts = <26 4 0 27 4 0 28 4 0>;
99 }; 99 };
100 100
101 pioA: gpio@fffff400 { 101 pinctrl@fffff400 {
102 compatible = "atmel,at91rm9200-gpio"; 102 #address-cells = <1>;
103 reg = <0xfffff400 0x100>; 103 #size-cells = <1>;
104 interrupts = <2 4 1>; 104 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
105 #gpio-cells = <2>; 105 ranges = <0xfffff400 0xfffff400 0x600>;
106 gpio-controller; 106
107 interrupt-controller; 107 atmel,mux-mask = <
108 #interrupt-cells = <2>; 108 /* A B */
109 }; 109 0xffffffff 0xffc00c3b /* pioA */
110 0xffffffff 0x7fff3ccf /* pioB */
111 0xffffffff 0x007fffff /* pioC */
112 >;
113
114 /* shared pinctrl settings */
115 dbgu {
116 pinctrl_dbgu: dbgu-0 {
117 atmel,pins =
118 <1 14 0x1 0x0 /* PB14 periph A */
119 1 15 0x1 0x1>; /* PB15 periph with pullup */
120 };
121 };
110 122
111 pioB: gpio@fffff600 { 123 usart0 {
112 compatible = "atmel,at91rm9200-gpio"; 124 pinctrl_usart0: usart0-0 {
113 reg = <0xfffff600 0x100>; 125 atmel,pins =
114 interrupts = <3 4 1>; 126 <1 4 0x1 0x0 /* PB4 periph A */
115 #gpio-cells = <2>; 127 1 5 0x1 0x0>; /* PB5 periph A */
116 gpio-controller; 128 };
117 interrupt-controller; 129
118 #interrupt-cells = <2>; 130 pinctrl_usart0_rts: usart0_rts-0 {
119 }; 131 atmel,pins =
132 <1 26 0x1 0x0>; /* PB26 periph A */
133 };
134
135 pinctrl_usart0_cts: usart0_cts-0 {
136 atmel,pins =
137 <1 27 0x1 0x0>; /* PB27 periph A */
138 };
139
140 pinctrl_usart0_dtr_dsr: usart0_dtr_dsr-0 {
141 atmel,pins =
142 <1 24 0x1 0x0 /* PB24 periph A */
143 1 22 0x1 0x0>; /* PB22 periph A */
144 };
145
146 pinctrl_usart0_dcd: usart0_dcd-0 {
147 atmel,pins =
148 <1 23 0x1 0x0>; /* PB23 periph A */
149 };
150
151 pinctrl_usart0_ri: usart0_ri-0 {
152 atmel,pins =
153 <1 25 0x1 0x0>; /* PB25 periph A */
154 };
155 };
120 156
121 pioC: gpio@fffff800 { 157 usart1 {
122 compatible = "atmel,at91rm9200-gpio"; 158 pinctrl_usart1: usart1-0 {
123 reg = <0xfffff800 0x100>; 159 atmel,pins =
124 interrupts = <4 4 1>; 160 <2 6 0x1 0x1 /* PB6 periph A with pullup */
125 #gpio-cells = <2>; 161 2 7 0x1 0x0>; /* PB7 periph A */
126 gpio-controller; 162 };
127 interrupt-controller; 163
128 #interrupt-cells = <2>; 164 pinctrl_usart1_rts: usart1_rts-0 {
165 atmel,pins =
166 <1 28 0x1 0x0>; /* PB28 periph A */
167 };
168
169 pinctrl_usart1_cts: usart1_cts-0 {
170 atmel,pins =
171 <1 29 0x1 0x0>; /* PB29 periph A */
172 };
173 };
174
175 usart2 {
176 pinctrl_usart2: usart2-0 {
177 atmel,pins =
178 <1 8 0x1 0x1 /* PB8 periph A with pullup */
179 1 9 0x1 0x0>; /* PB9 periph A */
180 };
181
182 pinctrl_usart2_rts: usart2_rts-0 {
183 atmel,pins =
184 <0 4 0x1 0x0>; /* PA4 periph A */
185 };
186
187 pinctrl_usart2_cts: usart2_cts-0 {
188 atmel,pins =
189 <0 5 0x1 0x0>; /* PA5 periph A */
190 };
191 };
192
193 usart3 {
194 pinctrl_usart3: usart3-0 {
195 atmel,pins =
196 <2 10 0x1 0x1 /* PB10 periph A with pullup */
197 2 11 0x1 0x0>; /* PB11 periph A */
198 };
199
200 pinctrl_usart3_rts: usart3_rts-0 {
201 atmel,pins =
202 <3 8 0x2 0x0>; /* PB8 periph B */
203 };
204
205 pinctrl_usart3_cts: usart3_cts-0 {
206 atmel,pins =
207 <3 10 0x2 0x0>; /* PB10 periph B */
208 };
209 };
210
211 uart0 {
212 pinctrl_uart0: uart0-0 {
213 atmel,pins =
214 <0 31 0x2 0x1 /* PA31 periph B with pullup */
215 0 30 0x2 0x0>; /* PA30 periph B */
216 };
217 };
218
219 uart1 {
220 pinctrl_uart1: uart1-0 {
221 atmel,pins =
222 <2 12 0x1 0x1 /* PB12 periph A with pullup */
223 2 13 0x1 0x0>; /* PB13 periph A */
224 };
225 };
226
227 nand {
228 pinctrl_nand: nand-0 {
229 atmel,pins =
230 <2 13 0x0 0x1 /* PC13 gpio RDY pin pull_up */
231 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */
232 };
233 };
234
235 macb {
236 pinctrl_macb_rmii: macb_rmii-0 {
237 atmel,pins =
238 <0 12 0x1 0x0 /* PA12 periph A */
239 0 13 0x1 0x0 /* PA13 periph A */
240 0 14 0x1 0x0 /* PA14 periph A */
241 0 15 0x1 0x0 /* PA15 periph A */
242 0 16 0x1 0x0 /* PA16 periph A */
243 0 17 0x1 0x0 /* PA17 periph A */
244 0 18 0x1 0x0 /* PA18 periph A */
245 0 19 0x1 0x0 /* PA19 periph A */
246 0 20 0x1 0x0 /* PA20 periph A */
247 0 21 0x1 0x0>; /* PA21 periph A */
248 };
249
250 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
251 atmel,pins =
252 <0 22 0x2 0x0 /* PA22 periph B */
253 0 23 0x2 0x0 /* PA23 periph B */
254 0 24 0x2 0x0 /* PA24 periph B */
255 0 25 0x2 0x0 /* PA25 periph B */
256 0 26 0x2 0x0 /* PA26 periph B */
257 0 27 0x2 0x0 /* PA27 periph B */
258 0 28 0x2 0x0 /* PA28 periph B */
259 0 29 0x2 0x0>; /* PA29 periph B */
260 };
261
262 pinctrl_macb_rmii_mii_alt: macb_rmii_mii-1 {
263 atmel,pins =
264 <0 10 0x2 0x0 /* PA10 periph B */
265 0 11 0x2 0x0 /* PA11 periph B */
266 0 24 0x2 0x0 /* PA24 periph B */
267 0 25 0x2 0x0 /* PA25 periph B */
268 0 26 0x2 0x0 /* PA26 periph B */
269 0 27 0x2 0x0 /* PA27 periph B */
270 0 28 0x2 0x0 /* PA28 periph B */
271 0 29 0x2 0x0>; /* PA29 periph B */
272 };
273 };
274
275 mmc0 {
276 pinctrl_mmc0_clk: mmc0_clk-0 {
277 atmel,pins =
278 <0 8 0x1 0x0>; /* PA8 periph A */
279 };
280
281 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
282 atmel,pins =
283 <0 7 0x1 0x1 /* PA7 periph A with pullup */
284 0 6 0x1 0x1>; /* PA6 periph A with pullup */
285 };
286
287 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
288 atmel,pins =
289 <0 9 0x1 0x1 /* PA9 periph A with pullup */
290 0 10 0x1 0x1 /* PA10 periph A with pullup */
291 0 11 0x1 0x1>; /* PA11 periph A with pullup */
292 };
293
294 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
295 atmel,pins =
296 <0 1 0x2 0x1 /* PA1 periph B with pullup */
297 0 0 0x2 0x1>; /* PA0 periph B with pullup */
298 };
299
300 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
301 atmel,pins =
302 <0 5 0x2 0x1 /* PA5 periph B with pullup */
303 0 4 0x2 0x1 /* PA4 periph B with pullup */
304 0 3 0x2 0x1>; /* PA3 periph B with pullup */
305 };
306 };
307
308 pioA: gpio@fffff400 {
309 compatible = "atmel,at91rm9200-gpio";
310 reg = <0xfffff400 0x200>;
311 interrupts = <2 4 1>;
312 #gpio-cells = <2>;
313 gpio-controller;
314 interrupt-controller;
315 #interrupt-cells = <2>;
316 };
317
318 pioB: gpio@fffff600 {
319 compatible = "atmel,at91rm9200-gpio";
320 reg = <0xfffff600 0x200>;
321 interrupts = <3 4 1>;
322 #gpio-cells = <2>;
323 gpio-controller;
324 interrupt-controller;
325 #interrupt-cells = <2>;
326 };
327
328 pioC: gpio@fffff800 {
329 compatible = "atmel,at91rm9200-gpio";
330 reg = <0xfffff800 0x200>;
331 interrupts = <4 4 1>;
332 #gpio-cells = <2>;
333 gpio-controller;
334 interrupt-controller;
335 #interrupt-cells = <2>;
336 };
129 }; 337 };
130 338
131 dbgu: serial@fffff200 { 339 dbgu: serial@fffff200 {
132 compatible = "atmel,at91sam9260-usart"; 340 compatible = "atmel,at91sam9260-usart";
133 reg = <0xfffff200 0x200>; 341 reg = <0xfffff200 0x200>;
134 interrupts = <1 4 7>; 342 interrupts = <1 4 7>;
343 pinctrl-names = "default";
344 pinctrl-0 = <&pinctrl_dbgu>;
135 status = "disabled"; 345 status = "disabled";
136 }; 346 };
137 347
@@ -141,6 +351,8 @@
141 interrupts = <6 4 5>; 351 interrupts = <6 4 5>;
142 atmel,use-dma-rx; 352 atmel,use-dma-rx;
143 atmel,use-dma-tx; 353 atmel,use-dma-tx;
354 pinctrl-names = "default";
355 pinctrl-0 = <&pinctrl_usart0>;
144 status = "disabled"; 356 status = "disabled";
145 }; 357 };
146 358
@@ -150,6 +362,8 @@
150 interrupts = <7 4 5>; 362 interrupts = <7 4 5>;
151 atmel,use-dma-rx; 363 atmel,use-dma-rx;
152 atmel,use-dma-tx; 364 atmel,use-dma-tx;
365 pinctrl-names = "default";
366 pinctrl-0 = <&pinctrl_usart1>;
153 status = "disabled"; 367 status = "disabled";
154 }; 368 };
155 369
@@ -159,6 +373,8 @@
159 interrupts = <8 4 5>; 373 interrupts = <8 4 5>;
160 atmel,use-dma-rx; 374 atmel,use-dma-rx;
161 atmel,use-dma-tx; 375 atmel,use-dma-tx;
376 pinctrl-names = "default";
377 pinctrl-0 = <&pinctrl_usart2>;
162 status = "disabled"; 378 status = "disabled";
163 }; 379 };
164 380
@@ -168,24 +384,30 @@
168 interrupts = <23 4 5>; 384 interrupts = <23 4 5>;
169 atmel,use-dma-rx; 385 atmel,use-dma-rx;
170 atmel,use-dma-tx; 386 atmel,use-dma-tx;
387 pinctrl-names = "default";
388 pinctrl-0 = <&pinctrl_usart3>;
171 status = "disabled"; 389 status = "disabled";
172 }; 390 };
173 391
174 usart4: serial@fffd4000 { 392 uart0: serial@fffd4000 {
175 compatible = "atmel,at91sam9260-usart"; 393 compatible = "atmel,at91sam9260-usart";
176 reg = <0xfffd4000 0x200>; 394 reg = <0xfffd4000 0x200>;
177 interrupts = <24 4 5>; 395 interrupts = <24 4 5>;
178 atmel,use-dma-rx; 396 atmel,use-dma-rx;
179 atmel,use-dma-tx; 397 atmel,use-dma-tx;
398 pinctrl-names = "default";
399 pinctrl-0 = <&pinctrl_uart0>;
180 status = "disabled"; 400 status = "disabled";
181 }; 401 };
182 402
183 usart5: serial@fffd8000 { 403 uart1: serial@fffd8000 {
184 compatible = "atmel,at91sam9260-usart"; 404 compatible = "atmel,at91sam9260-usart";
185 reg = <0xfffd8000 0x200>; 405 reg = <0xfffd8000 0x200>;
186 interrupts = <25 4 5>; 406 interrupts = <25 4 5>;
187 atmel,use-dma-rx; 407 atmel,use-dma-rx;
188 atmel,use-dma-tx; 408 atmel,use-dma-tx;
409 pinctrl-names = "default";
410 pinctrl-0 = <&pinctrl_uart1>;
189 status = "disabled"; 411 status = "disabled";
190 }; 412 };
191 413
@@ -193,6 +415,8 @@
193 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 415 compatible = "cdns,at32ap7000-macb", "cdns,macb";
194 reg = <0xfffc4000 0x100>; 416 reg = <0xfffc4000 0x100>;
195 interrupts = <21 4 3>; 417 interrupts = <21 4 3>;
418 pinctrl-names = "default";
419 pinctrl-0 = <&pinctrl_macb_rmii>;
196 status = "disabled"; 420 status = "disabled";
197 }; 421 };
198 422
@@ -212,6 +436,15 @@
212 status = "disabled"; 436 status = "disabled";
213 }; 437 };
214 438
439 mmc0: mmc@fffa8000 {
440 compatible = "atmel,hsmci";
441 reg = <0xfffa8000 0x600>;
442 interrupts = <9 4 0>;
443 #address-cells = <1>;
444 #size-cells = <0>;
445 status = "disabled";
446 };
447
215 adc0: adc@fffe0000 { 448 adc0: adc@fffe0000 {
216 compatible = "atmel,at91sam9260-adc"; 449 compatible = "atmel,at91sam9260-adc";
217 reg = <0xfffe0000 0x100>; 450 reg = <0xfffe0000 0x100>;
@@ -257,6 +490,8 @@
257 >; 490 >;
258 atmel,nand-addr-offset = <21>; 491 atmel,nand-addr-offset = <21>;
259 atmel,nand-cmd-offset = <22>; 492 atmel,nand-cmd-offset = <22>;
493 pinctrl-names = "default";
494 pinctrl-0 = <&pinctrl_nand>;
260 gpios = <&pioC 13 0 495 gpios = <&pioC 13 0
261 &pioC 14 0 496 &pioC 14 0
262 0 497 0
diff --git a/arch/arm/boot/dts/at91sam9263.dtsi b/arch/arm/boot/dts/at91sam9263.dtsi
index 3e6e5c1abbf3..66106eecf1ed 100644
--- a/arch/arm/boot/dts/at91sam9263.dtsi
+++ b/arch/arm/boot/dts/at91sam9263.dtsi
@@ -89,60 +89,243 @@
89 reg = <0xfffffd10 0x10>; 89 reg = <0xfffffd10 0x10>;
90 }; 90 };
91 91
92 pioA: gpio@fffff200 { 92 pinctrl@fffff200 {
93 compatible = "atmel,at91rm9200-gpio"; 93 #address-cells = <1>;
94 reg = <0xfffff200 0x100>; 94 #size-cells = <1>;
95 interrupts = <2 4 1>; 95 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
96 #gpio-cells = <2>; 96 ranges = <0xfffff200 0xfffff200 0xa00>;
97 gpio-controller;
98 interrupt-controller;
99 #interrupt-cells = <2>;
100 };
101 97
102 pioB: gpio@fffff400 { 98 atmel,mux-mask = <
103 compatible = "atmel,at91rm9200-gpio"; 99 /* A B */
104 reg = <0xfffff400 0x100>; 100 0xfffffffb 0xffffe07f /* pioA */
105 interrupts = <3 4 1>; 101 0x0007ffff 0x39072fff /* pioB */
106 #gpio-cells = <2>; 102 0xffffffff 0x3ffffff8 /* pioC */
107 gpio-controller; 103 0xfffffbff 0xffffffff /* pioD */
108 interrupt-controller; 104 0xffe00fff 0xfbfcff00 /* pioE */
109 #interrupt-cells = <2>; 105 >;
110 };
111 106
112 pioC: gpio@fffff600 { 107 /* shared pinctrl settings */
113 compatible = "atmel,at91rm9200-gpio"; 108 dbgu {
114 reg = <0xfffff600 0x100>; 109 pinctrl_dbgu: dbgu-0 {
115 interrupts = <4 4 1>; 110 atmel,pins =
116 #gpio-cells = <2>; 111 <2 30 0x1 0x0 /* PC30 periph A */
117 gpio-controller; 112 2 31 0x1 0x1>; /* PC31 periph with pullup */
118 interrupt-controller; 113 };
119 #interrupt-cells = <2>; 114 };
120 };
121 115
122 pioD: gpio@fffff800 { 116 usart0 {
123 compatible = "atmel,at91rm9200-gpio"; 117 pinctrl_usart0: usart0-0 {
124 reg = <0xfffff800 0x100>; 118 atmel,pins =
125 interrupts = <4 4 1>; 119 <0 26 0x1 0x1 /* PA26 periph A with pullup */
126 #gpio-cells = <2>; 120 0 27 0x1 0x0>; /* PA27 periph A */
127 gpio-controller; 121 };
128 interrupt-controller;
129 #interrupt-cells = <2>;
130 };
131 122
132 pioE: gpio@fffffa00 { 123 pinctrl_usart0_rts: usart0_rts-0 {
133 compatible = "atmel,at91rm9200-gpio"; 124 atmel,pins =
134 reg = <0xfffffa00 0x100>; 125 <0 28 0x1 0x0>; /* PA28 periph A */
135 interrupts = <4 4 1>; 126 };
136 #gpio-cells = <2>; 127
137 gpio-controller; 128 pinctrl_usart0_cts: usart0_cts-0 {
138 interrupt-controller; 129 atmel,pins =
139 #interrupt-cells = <2>; 130 <0 29 0x1 0x0>; /* PA29 periph A */
131 };
132 };
133
134 usart1 {
135 pinctrl_usart1: usart1-0 {
136 atmel,pins =
137 <3 0 0x1 0x1 /* PD0 periph A with pullup */
138 3 1 0x1 0x0>; /* PD1 periph A */
139 };
140
141 pinctrl_usart1_rts: usart1_rts-0 {
142 atmel,pins =
143 <3 7 0x2 0x0>; /* PD7 periph B */
144 };
145
146 pinctrl_usart1_cts: usart1_cts-0 {
147 atmel,pins =
148 <3 8 0x2 0x0>; /* PD8 periph B */
149 };
150 };
151
152 usart2 {
153 pinctrl_usart2: usart2-0 {
154 atmel,pins =
155 <3 2 0x1 0x1 /* PD2 periph A with pullup */
156 3 3 0x1 0x0>; /* PD3 periph A */
157 };
158
159 pinctrl_usart2_rts: usart2_rts-0 {
160 atmel,pins =
161 <3 5 0x2 0x0>; /* PD5 periph B */
162 };
163
164 pinctrl_usart2_cts: usart2_cts-0 {
165 atmel,pins =
166 <4 6 0x2 0x0>; /* PD6 periph B */
167 };
168 };
169
170 nand {
171 pinctrl_nand: nand-0 {
172 atmel,pins =
173 <0 22 0x0 0x1 /* PA22 gpio RDY pin pull_up*/
174 3 15 0x0 0x1>; /* PD15 gpio enable pin pull_up */
175 };
176 };
177
178 macb {
179 pinctrl_macb_rmii: macb_rmii-0 {
180 atmel,pins =
181 <2 25 0x2 0x0 /* PC25 periph B */
182 4 21 0x1 0x0 /* PE21 periph A */
183 4 23 0x1 0x0 /* PE23 periph A */
184 4 24 0x1 0x0 /* PE24 periph A */
185 4 25 0x1 0x0 /* PE25 periph A */
186 4 26 0x1 0x0 /* PE26 periph A */
187 4 27 0x1 0x0 /* PE27 periph A */
188 4 28 0x1 0x0 /* PE28 periph A */
189 4 29 0x1 0x0 /* PE29 periph A */
190 4 30 0x1 0x0>; /* PE30 periph A */
191 };
192
193 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
194 atmel,pins =
195 <2 20 0x2 0x0 /* PC20 periph B */
196 2 21 0x2 0x0 /* PC21 periph B */
197 2 22 0x2 0x0 /* PC22 periph B */
198 2 23 0x2 0x0 /* PC23 periph B */
199 2 24 0x2 0x0 /* PC24 periph B */
200 2 25 0x2 0x0 /* PC25 periph B */
201 2 27 0x2 0x0 /* PC27 periph B */
202 4 22 0x2 0x0>; /* PE22 periph B */
203 };
204 };
205
206 mmc0 {
207 pinctrl_mmc0_clk: mmc0_clk-0 {
208 atmel,pins =
209 <0 12 0x1 0x0>; /* PA12 periph A */
210 };
211
212 pinctrl_mmc0_slot0_cmd_dat0: mmc0_slot0_cmd_dat0-0 {
213 atmel,pins =
214 <0 1 0x1 0x1 /* PA1 periph A with pullup */
215 0 0 0x1 0x1>; /* PA0 periph A with pullup */
216 };
217
218 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
219 atmel,pins =
220 <0 3 0x1 0x1 /* PA3 periph A with pullup */
221 0 4 0x1 0x1 /* PA4 periph A with pullup */
222 0 5 0x1 0x1>; /* PA5 periph A with pullup */
223 };
224
225 pinctrl_mmc0_slot1_cmd_dat0: mmc0_slot1_cmd_dat0-0 {
226 atmel,pins =
227 <0 16 0x1 0x1 /* PA16 periph A with pullup */
228 0 17 0x1 0x1>; /* PA17 periph A with pullup */
229 };
230
231 pinctrl_mmc0_slot1_dat1_3: mmc0_slot1_dat1_3-0 {
232 atmel,pins =
233 <0 18 0x1 0x1 /* PA18 periph A with pullup */
234 0 19 0x1 0x1 /* PA19 periph A with pullup */
235 0 20 0x1 0x1>; /* PA20 periph A with pullup */
236 };
237 };
238
239 mmc1 {
240 pinctrl_mmc1_clk: mmc1_clk-0 {
241 atmel,pins =
242 <0 6 0x1 0x0>; /* PA6 periph A */
243 };
244
245 pinctrl_mmc1_slot0_cmd_dat0: mmc1_slot0_cmd_dat0-0 {
246 atmel,pins =
247 <0 7 0x1 0x1 /* PA7 periph A with pullup */
248 0 8 0x1 0x1>; /* PA8 periph A with pullup */
249 };
250
251 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
252 atmel,pins =
253 <0 9 0x1 0x1 /* PA9 periph A with pullup */
254 0 10 0x1 0x1 /* PA10 periph A with pullup */
255 0 11 0x1 0x1>; /* PA11 periph A with pullup */
256 };
257
258 pinctrl_mmc1_slot1_cmd_dat0: mmc1_slot1_cmd_dat0-0 {
259 atmel,pins =
260 <0 21 0x1 0x1 /* PA21 periph A with pullup */
261 0 22 0x1 0x1>; /* PA22 periph A with pullup */
262 };
263
264 pinctrl_mmc1_slot1_dat1_3: mmc1_slot1_dat1_3-0 {
265 atmel,pins =
266 <0 23 0x1 0x1 /* PA23 periph A with pullup */
267 0 24 0x1 0x1 /* PA24 periph A with pullup */
268 0 25 0x1 0x1>; /* PA25 periph A with pullup */
269 };
270 };
271
272 pioA: gpio@fffff200 {
273 compatible = "atmel,at91rm9200-gpio";
274 reg = <0xfffff200 0x200>;
275 interrupts = <2 4 1>;
276 #gpio-cells = <2>;
277 gpio-controller;
278 interrupt-controller;
279 #interrupt-cells = <2>;
280 };
281
282 pioB: gpio@fffff400 {
283 compatible = "atmel,at91rm9200-gpio";
284 reg = <0xfffff400 0x200>;
285 interrupts = <3 4 1>;
286 #gpio-cells = <2>;
287 gpio-controller;
288 interrupt-controller;
289 #interrupt-cells = <2>;
290 };
291
292 pioC: gpio@fffff600 {
293 compatible = "atmel,at91rm9200-gpio";
294 reg = <0xfffff600 0x200>;
295 interrupts = <4 4 1>;
296 #gpio-cells = <2>;
297 gpio-controller;
298 interrupt-controller;
299 #interrupt-cells = <2>;
300 };
301
302 pioD: gpio@fffff800 {
303 compatible = "atmel,at91rm9200-gpio";
304 reg = <0xfffff800 0x200>;
305 interrupts = <4 4 1>;
306 #gpio-cells = <2>;
307 gpio-controller;
308 interrupt-controller;
309 #interrupt-cells = <2>;
310 };
311
312 pioE: gpio@fffffa00 {
313 compatible = "atmel,at91rm9200-gpio";
314 reg = <0xfffffa00 0x200>;
315 interrupts = <4 4 1>;
316 #gpio-cells = <2>;
317 gpio-controller;
318 interrupt-controller;
319 #interrupt-cells = <2>;
320 };
140 }; 321 };
141 322
142 dbgu: serial@ffffee00 { 323 dbgu: serial@ffffee00 {
143 compatible = "atmel,at91sam9260-usart"; 324 compatible = "atmel,at91sam9260-usart";
144 reg = <0xffffee00 0x200>; 325 reg = <0xffffee00 0x200>;
145 interrupts = <1 4 7>; 326 interrupts = <1 4 7>;
327 pinctrl-names = "default";
328 pinctrl-0 = <&pinctrl_dbgu>;
146 status = "disabled"; 329 status = "disabled";
147 }; 330 };
148 331
@@ -152,6 +335,8 @@
152 interrupts = <7 4 5>; 335 interrupts = <7 4 5>;
153 atmel,use-dma-rx; 336 atmel,use-dma-rx;
154 atmel,use-dma-tx; 337 atmel,use-dma-tx;
338 pinctrl-names = "default";
339 pinctrl-0 = <&pinctrl_usart0>;
155 status = "disabled"; 340 status = "disabled";
156 }; 341 };
157 342
@@ -161,6 +346,8 @@
161 interrupts = <8 4 5>; 346 interrupts = <8 4 5>;
162 atmel,use-dma-rx; 347 atmel,use-dma-rx;
163 atmel,use-dma-tx; 348 atmel,use-dma-tx;
349 pinctrl-names = "default";
350 pinctrl-0 = <&pinctrl_usart1>;
164 status = "disabled"; 351 status = "disabled";
165 }; 352 };
166 353
@@ -170,6 +357,8 @@
170 interrupts = <9 4 5>; 357 interrupts = <9 4 5>;
171 atmel,use-dma-rx; 358 atmel,use-dma-rx;
172 atmel,use-dma-tx; 359 atmel,use-dma-tx;
360 pinctrl-names = "default";
361 pinctrl-0 = <&pinctrl_usart2>;
173 status = "disabled"; 362 status = "disabled";
174 }; 363 };
175 364
@@ -177,6 +366,8 @@
177 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 366 compatible = "cdns,at32ap7000-macb", "cdns,macb";
178 reg = <0xfffbc000 0x100>; 367 reg = <0xfffbc000 0x100>;
179 interrupts = <21 4 3>; 368 interrupts = <21 4 3>;
369 pinctrl-names = "default";
370 pinctrl-0 = <&pinctrl_macb_rmii>;
180 status = "disabled"; 371 status = "disabled";
181 }; 372 };
182 373
@@ -195,6 +386,24 @@
195 #size-cells = <0>; 386 #size-cells = <0>;
196 status = "disabled"; 387 status = "disabled";
197 }; 388 };
389
390 mmc0: mmc@fff80000 {
391 compatible = "atmel,hsmci";
392 reg = <0xfff80000 0x600>;
393 interrupts = <10 4 0>;
394 #address-cells = <1>;
395 #size-cells = <0>;
396 status = "disabled";
397 };
398
399 mmc1: mmc@fff84000 {
400 compatible = "atmel,hsmci";
401 reg = <0xfff84000 0x600>;
402 interrupts = <11 4 0>;
403 #address-cells = <1>;
404 #size-cells = <0>;
405 status = "disabled";
406 };
198 }; 407 };
199 408
200 nand0: nand@40000000 { 409 nand0: nand@40000000 {
@@ -206,6 +415,8 @@
206 >; 415 >;
207 atmel,nand-addr-offset = <21>; 416 atmel,nand-addr-offset = <21>;
208 atmel,nand-cmd-offset = <22>; 417 atmel,nand-cmd-offset = <22>;
418 pinctrl-names = "default";
419 pinctrl-0 = <&pinctrl_nand>;
209 gpios = <&pioA 22 0 420 gpios = <&pioA 22 0
210 &pioD 15 0 421 &pioD 15 0
211 0 422 0
diff --git a/arch/arm/boot/dts/at91sam9263ek.dts b/arch/arm/boot/dts/at91sam9263ek.dts
index f86ac4b609fc..1eb08728f527 100644
--- a/arch/arm/boot/dts/at91sam9263ek.dts
+++ b/arch/arm/boot/dts/at91sam9263ek.dts
@@ -38,6 +38,10 @@
38 }; 38 };
39 39
40 usart0: serial@fff8c000 { 40 usart0: serial@fff8c000 {
41 pinctrl-0 = <
42 &pinctrl_usart0
43 &pinctrl_usart0_rts
44 &pinctrl_usart0_cts>;
41 status = "okay"; 45 status = "okay";
42 }; 46 };
43 47
@@ -50,6 +54,31 @@
50 atmel,vbus-gpio = <&pioA 25 0>; 54 atmel,vbus-gpio = <&pioA 25 0>;
51 status = "okay"; 55 status = "okay";
52 }; 56 };
57
58 mmc0: mmc@fff80000 {
59 pinctrl-0 = <
60 &pinctrl_board_mmc0
61 &pinctrl_mmc0_clk
62 &pinctrl_mmc0_slot0_cmd_dat0
63 &pinctrl_mmc0_slot0_dat1_3>;
64 status = "okay";
65 slot@0 {
66 reg = <0>;
67 bus-width = <4>;
68 cd-gpios = <&pioE 18 0>;
69 wp-gpios = <&pioE 19 0>;
70 };
71 };
72
73 pinctrl@fffff200 {
74 mmc0 {
75 pinctrl_board_mmc0: mmc0-board {
76 atmel,pins =
77 <5 18 0x0 0x5 /* PE18 gpio CD pin pull up and deglitch */
78 5 19 0x0 0x1>; /* PE19 gpio WP pin pull up */
79 };
80 };
81 };
53 }; 82 };
54 83
55 nand0: nand@40000000 { 84 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9g15.dtsi b/arch/arm/boot/dts/at91sam9g15.dtsi
new file mode 100644
index 000000000000..fbe7a7089c2a
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g15.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9g15.dtsi - Device Tree Include file for AT91SAM9G15 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9G15 SoC";
13 compatible = "atmel, at91sam9g15, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe0399f 0x00000000 /* pioA */
21 0x00040000 0x00047e3f 0x00000000 /* pioB */
22 0xfdffffff 0x00000000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9g15ek.dts b/arch/arm/boot/dts/at91sam9g15ek.dts
new file mode 100644
index 000000000000..86dd3f6d938f
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g15ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9g15ek.dts - Device Tree file for AT91SAM9G15-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9g15.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9g15ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
index f1b2e148ac8c..66467b113126 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
+++ b/arch/arm/boot/dts/at91sam9g20ek_2mmc.dts
@@ -12,6 +12,32 @@
12 model = "Atmel at91sam9g20ek 2 mmc"; 12 model = "Atmel at91sam9g20ek 2 mmc";
13 compatible = "atmel,at91sam9g20ek_2mmc", "atmel,at91sam9g20", "atmel,at91sam9"; 13 compatible = "atmel,at91sam9g20ek_2mmc", "atmel,at91sam9g20", "atmel,at91sam9";
14 14
15 ahb {
16 apb{
17 mmc0: mmc@fffa8000 {
18 /* clk already mux wuth slot0 */
19 pinctrl-0 = <
20 &pinctrl_board_mmc0_slot0
21 &pinctrl_mmc0_slot0_cmd_dat0
22 &pinctrl_mmc0_slot0_dat1_3>;
23 slot@0 {
24 reg = <0>;
25 bus-width = <4>;
26 cd-gpios = <&pioC 2 0>;
27 };
28 };
29
30 pinctrl@fffff400 {
31 mmc0_slot0 {
32 pinctrl_board_mmc0_slot0: mmc0_slot0-board {
33 atmel,pins =
34 <2 2 0x0 0x5>; /* PC2 gpio CD pin pull up and deglitch */
35 };
36 };
37 };
38 };
39 };
40
15 leds { 41 leds {
16 compatible = "gpio-leds"; 42 compatible = "gpio-leds";
17 43
diff --git a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
index e6391a4e6649..32a500a0e481 100644
--- a/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20ek_common.dtsi
@@ -35,6 +35,13 @@
35 }; 35 };
36 36
37 usart0: serial@fffb0000 { 37 usart0: serial@fffb0000 {
38 pinctrl-0 =
39 <&pinctrl_usart0
40 &pinctrl_usart0_rts
41 &pinctrl_usart0_cts
42 &pinctrl_usart0_dtr_dsr
43 &pinctrl_usart0_dcd
44 &pinctrl_usart0_ri>;
38 status = "okay"; 45 status = "okay";
39 }; 46 };
40 47
@@ -51,6 +58,29 @@
51 atmel,vbus-gpio = <&pioC 5 0>; 58 atmel,vbus-gpio = <&pioC 5 0>;
52 status = "okay"; 59 status = "okay";
53 }; 60 };
61
62 mmc0: mmc@fffa8000 {
63 pinctrl-0 = <
64 &pinctrl_board_mmc0_slot1
65 &pinctrl_mmc0_clk
66 &pinctrl_mmc0_slot1_cmd_dat0
67 &pinctrl_mmc0_slot1_dat1_3>;
68 status = "okay";
69 slot@1 {
70 reg = <1>;
71 bus-width = <4>;
72 cd-gpios = <&pioC 9 0>;
73 };
74 };
75
76 pinctrl@fffff400 {
77 mmc0_slot1 {
78 pinctrl_board_mmc0_slot1: mmc0_slot1-board {
79 atmel,pins =
80 <2 9 0x0 0x5>; /* PC9 gpio CD pin pull up and deglitch */
81 };
82 };
83 };
54 }; 84 };
55 85
56 nand0: nand@40000000 { 86 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
new file mode 100644
index 000000000000..05a718fb83c4
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g25.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9g25.dtsi - Device Tree Include file for AT91SAM9G25 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9G25 SoC";
13 compatible = "atmel, at91sam9g25, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe0399f 0xc000001c /* pioA */
21 0x0007ffff 0x8000fe3f 0x00000000 /* pioB */
22 0x80000000 0x07c0ffff 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index 877c08f06763..c5ab16fba059 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -7,55 +7,10 @@
7 * Licensed under GPLv2 or later. 7 * Licensed under GPLv2 or later.
8 */ 8 */
9/dts-v1/; 9/dts-v1/;
10/include/ "at91sam9x5.dtsi" 10/include/ "at91sam9g25.dtsi"
11/include/ "at91sam9x5cm.dtsi" 11/include/ "at91sam9x5ek.dtsi"
12 12
13/ { 13/ {
14 model = "Atmel AT91SAM9G25-EK"; 14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16
17 chosen {
18 bootargs = "console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
19 };
20
21 ahb {
22 apb {
23 dbgu: serial@fffff200 {
24 status = "okay";
25 };
26
27 usart0: serial@f801c000 {
28 status = "okay";
29 };
30
31 macb0: ethernet@f802c000 {
32 phy-mode = "rmii";
33 status = "okay";
34 };
35
36 i2c0: i2c@f8010000 {
37 status = "okay";
38 };
39
40 i2c1: i2c@f8014000 {
41 status = "okay";
42 };
43
44 i2c2: i2c@f8018000 {
45 status = "okay";
46 };
47 };
48
49 usb0: ohci@00600000 {
50 status = "okay";
51 num-ports = <2>;
52 atmel,vbus-gpio = <&pioD 19 1
53 &pioD 20 1
54 >;
55 };
56
57 usb1: ehci@00700000 {
58 status = "okay";
59 };
60 };
61}; 16};
diff --git a/arch/arm/boot/dts/at91sam9g35.dtsi b/arch/arm/boot/dts/at91sam9g35.dtsi
new file mode 100644
index 000000000000..f9d14a722794
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g35.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9g35.dtsi - Device Tree Include file for AT91SAM9G35 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9G35 SoC";
13 compatible = "atmel, at91sam9g35, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe0399f 0xc000000c /* pioA */
21 0x000406ff 0x00047e3f 0x00000000 /* pioB */
22 0xfdffffff 0x00000000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9g35ek.dts b/arch/arm/boot/dts/at91sam9g35ek.dts
new file mode 100644
index 000000000000..95944bdd798d
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9g35ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9g35ek.dts - Device Tree file for AT91SAM9G35-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9g35.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G35-EK";
15 compatible = "atmel,at91sam9g35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index 3add030d61f8..0741caeeced1 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -108,60 +108,243 @@
108 interrupts = <21 4 0>; 108 interrupts = <21 4 0>;
109 }; 109 };
110 110
111 pioA: gpio@fffff200 { 111 pinctrl@fffff200 {
112 compatible = "atmel,at91rm9200-gpio"; 112 #address-cells = <1>;
113 reg = <0xfffff200 0x100>; 113 #size-cells = <1>;
114 interrupts = <2 4 1>; 114 compatible = "atmel,at91rm9200-pinctrl", "simple-bus";
115 #gpio-cells = <2>; 115 ranges = <0xfffff200 0xfffff200 0xa00>;
116 gpio-controller; 116
117 interrupt-controller; 117 atmel,mux-mask = <
118 #interrupt-cells = <2>; 118 /* A B */
119 }; 119 0xffffffff 0xffc003ff /* pioA */
120 0xffffffff 0x800f8f00 /* pioB */
121 0xffffffff 0x00000e00 /* pioC */
122 0xffffffff 0xff0c1381 /* pioD */
123 0xffffffff 0x81ffff81 /* pioE */
124 >;
125
126 /* shared pinctrl settings */
127 dbgu {
128 pinctrl_dbgu: dbgu-0 {
129 atmel,pins =
130 <1 12 0x1 0x0 /* PB12 periph A */
131 1 13 0x1 0x0>; /* PB13 periph A */
132 };
133 };
120 134
121 pioB: gpio@fffff400 { 135 usart0 {
122 compatible = "atmel,at91rm9200-gpio"; 136 pinctrl_usart0: usart0-0 {
123 reg = <0xfffff400 0x100>; 137 atmel,pins =
124 interrupts = <3 4 1>; 138 <1 19 0x1 0x1 /* PB19 periph A with pullup */
125 #gpio-cells = <2>; 139 1 18 0x1 0x0>; /* PB18 periph A */
126 gpio-controller; 140 };
127 interrupt-controller; 141
128 #interrupt-cells = <2>; 142 pinctrl_usart0_rts: usart0_rts-0 {
129 }; 143 atmel,pins =
144 <1 17 0x2 0x0>; /* PB17 periph B */
145 };
146
147 pinctrl_usart0_cts: usart0_cts-0 {
148 atmel,pins =
149 <1 15 0x2 0x0>; /* PB15 periph B */
150 };
151 };
130 152
131 pioC: gpio@fffff600 { 153 uart1 {
132 compatible = "atmel,at91rm9200-gpio"; 154 pinctrl_usart1: usart1-0 {
133 reg = <0xfffff600 0x100>; 155 atmel,pins =
134 interrupts = <4 4 1>; 156 <1 4 0x1 0x1 /* PB4 periph A with pullup */
135 #gpio-cells = <2>; 157 1 5 0x1 0x0>; /* PB5 periph A */
136 gpio-controller; 158 };
137 interrupt-controller; 159
138 #interrupt-cells = <2>; 160 pinctrl_usart1_rts: usart1_rts-0 {
139 }; 161 atmel,pins =
162 <3 16 0x1 0x0>; /* PD16 periph A */
163 };
164
165 pinctrl_usart1_cts: usart1_cts-0 {
166 atmel,pins =
167 <3 17 0x1 0x0>; /* PD17 periph A */
168 };
169 };
140 170
141 pioD: gpio@fffff800 { 171 usart2 {
142 compatible = "atmel,at91rm9200-gpio"; 172 pinctrl_usart2: usart2-0 {
143 reg = <0xfffff800 0x100>; 173 atmel,pins =
144 interrupts = <5 4 1>; 174 <1 6 0x1 0x1 /* PB6 periph A with pullup */
145 #gpio-cells = <2>; 175 1 7 0x1 0x0>; /* PB7 periph A */
146 gpio-controller; 176 };
147 interrupt-controller; 177
148 #interrupt-cells = <2>; 178 pinctrl_usart2_rts: usart2_rts-0 {
149 }; 179 atmel,pins =
180 <2 9 0x2 0x0>; /* PC9 periph B */
181 };
182
183 pinctrl_usart2_cts: usart2_cts-0 {
184 atmel,pins =
185 <2 11 0x2 0x0>; /* PC11 periph B */
186 };
187 };
150 188
151 pioE: gpio@fffffa00 { 189 usart3 {
152 compatible = "atmel,at91rm9200-gpio"; 190 pinctrl_usart3: usart3-0 {
153 reg = <0xfffffa00 0x100>; 191 atmel,pins =
154 interrupts = <5 4 1>; 192 <1 8 0x1 0x1 /* PB9 periph A with pullup */
155 #gpio-cells = <2>; 193 1 9 0x1 0x0>; /* PB8 periph A */
156 gpio-controller; 194 };
157 interrupt-controller; 195
158 #interrupt-cells = <2>; 196 pinctrl_usart3_rts: usart3_rts-0 {
197 atmel,pins =
198 <0 23 0x2 0x0>; /* PA23 periph B */
199 };
200
201 pinctrl_usart3_cts: usart3_cts-0 {
202 atmel,pins =
203 <0 24 0x2 0x0>; /* PA24 periph B */
204 };
205 };
206
207 nand {
208 pinctrl_nand: nand-0 {
209 atmel,pins =
210 <2 8 0x0 0x1 /* PC8 gpio RDY pin pull_up*/
211 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */
212 };
213 };
214
215 macb {
216 pinctrl_macb_rmii: macb_rmii-0 {
217 atmel,pins =
218 <0 10 0x1 0x0 /* PA10 periph A */
219 0 11 0x1 0x0 /* PA11 periph A */
220 0 12 0x1 0x0 /* PA12 periph A */
221 0 13 0x1 0x0 /* PA13 periph A */
222 0 14 0x1 0x0 /* PA14 periph A */
223 0 15 0x1 0x0 /* PA15 periph A */
224 0 16 0x1 0x0 /* PA16 periph A */
225 0 17 0x1 0x0 /* PA17 periph A */
226 0 18 0x1 0x0 /* PA18 periph A */
227 0 19 0x1 0x0>; /* PA19 periph A */
228 };
229
230 pinctrl_macb_rmii_mii: macb_rmii_mii-0 {
231 atmel,pins =
232 <0 6 0x2 0x0 /* PA6 periph B */
233 0 7 0x2 0x0 /* PA7 periph B */
234 0 8 0x2 0x0 /* PA8 periph B */
235 0 9 0x2 0x0 /* PA9 periph B */
236 0 27 0x2 0x0 /* PA27 periph B */
237 0 28 0x2 0x0 /* PA28 periph B */
238 0 29 0x2 0x0 /* PA29 periph B */
239 0 30 0x2 0x0>; /* PA30 periph B */
240 };
241 };
242
243 mmc0 {
244 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
245 atmel,pins =
246 <0 0 0x1 0x0 /* PA0 periph A */
247 0 1 0x1 0x1 /* PA1 periph A with pullup */
248 0 2 0x1 0x1>; /* PA2 periph A with pullup */
249 };
250
251 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
252 atmel,pins =
253 <0 3 0x1 0x1 /* PA3 periph A with pullup */
254 0 4 0x1 0x1 /* PA4 periph A with pullup */
255 0 5 0x1 0x1>; /* PA5 periph A with pullup */
256 };
257
258 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 {
259 atmel,pins =
260 <0 6 0x1 0x1 /* PA6 periph A with pullup */
261 0 7 0x1 0x1 /* PA7 periph A with pullup */
262 0 8 0x1 0x1 /* PA8 periph A with pullup */
263 0 9 0x1 0x1>; /* PA9 periph A with pullup */
264 };
265 };
266
267 mmc1 {
268 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 {
269 atmel,pins =
270 <0 31 0x1 0x0 /* PA31 periph A */
271 0 22 0x1 0x1 /* PA22 periph A with pullup */
272 0 23 0x1 0x1>; /* PA23 periph A with pullup */
273 };
274
275 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
276 atmel,pins =
277 <0 24 0x1 0x1 /* PA24 periph A with pullup */
278 0 25 0x1 0x1 /* PA25 periph A with pullup */
279 0 26 0x1 0x1>; /* PA26 periph A with pullup */
280 };
281
282 pinctrl_mmc1_slot0_dat4_7: mmc1_slot0_dat4_7-0 {
283 atmel,pins =
284 <0 27 0x1 0x1 /* PA27 periph A with pullup */
285 0 28 0x1 0x1 /* PA28 periph A with pullup */
286 0 29 0x1 0x1 /* PA29 periph A with pullup */
287 0 20 0x1 0x1>; /* PA30 periph A with pullup */
288 };
289 };
290
291 pioA: gpio@fffff200 {
292 compatible = "atmel,at91rm9200-gpio";
293 reg = <0xfffff200 0x200>;
294 interrupts = <2 4 1>;
295 #gpio-cells = <2>;
296 gpio-controller;
297 interrupt-controller;
298 #interrupt-cells = <2>;
299 };
300
301 pioB: gpio@fffff400 {
302 compatible = "atmel,at91rm9200-gpio";
303 reg = <0xfffff400 0x200>;
304 interrupts = <3 4 1>;
305 #gpio-cells = <2>;
306 gpio-controller;
307 interrupt-controller;
308 #interrupt-cells = <2>;
309 };
310
311 pioC: gpio@fffff600 {
312 compatible = "atmel,at91rm9200-gpio";
313 reg = <0xfffff600 0x200>;
314 interrupts = <4 4 1>;
315 #gpio-cells = <2>;
316 gpio-controller;
317 interrupt-controller;
318 #interrupt-cells = <2>;
319 };
320
321 pioD: gpio@fffff800 {
322 compatible = "atmel,at91rm9200-gpio";
323 reg = <0xfffff800 0x200>;
324 interrupts = <5 4 1>;
325 #gpio-cells = <2>;
326 gpio-controller;
327 interrupt-controller;
328 #interrupt-cells = <2>;
329 };
330
331 pioE: gpio@fffffa00 {
332 compatible = "atmel,at91rm9200-gpio";
333 reg = <0xfffffa00 0x200>;
334 interrupts = <5 4 1>;
335 #gpio-cells = <2>;
336 gpio-controller;
337 interrupt-controller;
338 #interrupt-cells = <2>;
339 };
159 }; 340 };
160 341
161 dbgu: serial@ffffee00 { 342 dbgu: serial@ffffee00 {
162 compatible = "atmel,at91sam9260-usart"; 343 compatible = "atmel,at91sam9260-usart";
163 reg = <0xffffee00 0x200>; 344 reg = <0xffffee00 0x200>;
164 interrupts = <1 4 7>; 345 interrupts = <1 4 7>;
346 pinctrl-names = "default";
347 pinctrl-0 = <&pinctrl_dbgu>;
165 status = "disabled"; 348 status = "disabled";
166 }; 349 };
167 350
@@ -171,6 +354,8 @@
171 interrupts = <7 4 5>; 354 interrupts = <7 4 5>;
172 atmel,use-dma-rx; 355 atmel,use-dma-rx;
173 atmel,use-dma-tx; 356 atmel,use-dma-tx;
357 pinctrl-names = "default";
358 pinctrl-0 = <&pinctrl_usart0>;
174 status = "disabled"; 359 status = "disabled";
175 }; 360 };
176 361
@@ -180,6 +365,8 @@
180 interrupts = <8 4 5>; 365 interrupts = <8 4 5>;
181 atmel,use-dma-rx; 366 atmel,use-dma-rx;
182 atmel,use-dma-tx; 367 atmel,use-dma-tx;
368 pinctrl-names = "default";
369 pinctrl-0 = <&pinctrl_usart1>;
183 status = "disabled"; 370 status = "disabled";
184 }; 371 };
185 372
@@ -189,6 +376,8 @@
189 interrupts = <9 4 5>; 376 interrupts = <9 4 5>;
190 atmel,use-dma-rx; 377 atmel,use-dma-rx;
191 atmel,use-dma-tx; 378 atmel,use-dma-tx;
379 pinctrl-names = "default";
380 pinctrl-0 = <&pinctrl_usart2>;
192 status = "disabled"; 381 status = "disabled";
193 }; 382 };
194 383
@@ -198,6 +387,8 @@
198 interrupts = <10 4 5>; 387 interrupts = <10 4 5>;
199 atmel,use-dma-rx; 388 atmel,use-dma-rx;
200 atmel,use-dma-tx; 389 atmel,use-dma-tx;
390 pinctrl-names = "default";
391 pinctrl-0 = <&pinctrl_usart3>;
201 status = "disabled"; 392 status = "disabled";
202 }; 393 };
203 394
@@ -205,6 +396,8 @@
205 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 396 compatible = "cdns,at32ap7000-macb", "cdns,macb";
206 reg = <0xfffbc000 0x100>; 397 reg = <0xfffbc000 0x100>;
207 interrupts = <25 4 3>; 398 interrupts = <25 4 3>;
399 pinctrl-names = "default";
400 pinctrl-0 = <&pinctrl_macb_rmii>;
208 status = "disabled"; 401 status = "disabled";
209 }; 402 };
210 403
@@ -262,6 +455,24 @@
262 trigger-value = <0x6>; 455 trigger-value = <0x6>;
263 }; 456 };
264 }; 457 };
458
459 mmc0: mmc@fff80000 {
460 compatible = "atmel,hsmci";
461 reg = <0xfff80000 0x600>;
462 interrupts = <11 4 0>;
463 #address-cells = <1>;
464 #size-cells = <0>;
465 status = "disabled";
466 };
467
468 mmc1: mmc@fffd0000 {
469 compatible = "atmel,hsmci";
470 reg = <0xfffd0000 0x600>;
471 interrupts = <29 4 0>;
472 #address-cells = <1>;
473 #size-cells = <0>;
474 status = "disabled";
475 };
265 }; 476 };
266 477
267 nand0: nand@40000000 { 478 nand0: nand@40000000 {
@@ -273,6 +484,8 @@
273 >; 484 >;
274 atmel,nand-addr-offset = <21>; 485 atmel,nand-addr-offset = <21>;
275 atmel,nand-cmd-offset = <22>; 486 atmel,nand-cmd-offset = <22>;
487 pinctrl-names = "default";
488 pinctrl-0 = <&pinctrl_nand>;
276 gpios = <&pioC 8 0 489 gpios = <&pioC 8 0
277 &pioC 14 0 490 &pioC 14 0
278 0 491 0
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 15e1dd43f625..20c31913c270 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -39,6 +39,10 @@
39 }; 39 };
40 40
41 usart1: serial@fff90000 { 41 usart1: serial@fff90000 {
42 pinctrl-0 =
43 <&pinctrl_usart1
44 &pinctrl_usart1_rts
45 &pinctrl_usart1_cts>;
42 status = "okay"; 46 status = "okay";
43 }; 47 };
44 48
@@ -54,6 +58,50 @@
54 i2c1: i2c@fff88000 { 58 i2c1: i2c@fff88000 {
55 status = "okay"; 59 status = "okay";
56 }; 60 };
61
62 mmc0: mmc@fff80000 {
63 pinctrl-0 = <
64 &pinctrl_board_mmc0
65 &pinctrl_mmc0_slot0_clk_cmd_dat0
66 &pinctrl_mmc0_slot0_dat1_3>;
67 status = "okay";
68 slot@0 {
69 reg = <0>;
70 bus-width = <4>;
71 cd-gpios = <&pioD 10 0>;
72 };
73 };
74
75 mmc1: mmc@fffd0000 {
76 pinctrl-0 = <
77 &pinctrl_board_mmc1
78 &pinctrl_mmc1_slot0_clk_cmd_dat0
79 &pinctrl_mmc1_slot0_dat1_3>;
80 status = "okay";
81 slot@0 {
82 reg = <0>;
83 bus-width = <4>;
84 cd-gpios = <&pioD 11 0>;
85 wp-gpios = <&pioD 29 0>;
86 };
87 };
88
89 pinctrl@fffff200 {
90 mmc0 {
91 pinctrl_board_mmc0: mmc0-board {
92 atmel,pins =
93 <3 10 0x0 0x5>; /* PD10 gpio CD pin pull up and deglitch */
94 };
95 };
96
97 mmc1 {
98 pinctrl_board_mmc1: mmc1-board {
99 atmel,pins =
100 <3 11 0x0 0x5 /* PD11 gpio CD pin pull up and deglitch */
101 3 29 0x0 0x1>; /* PD29 gpio WP pin pull up */
102 };
103 };
104 };
57 }; 105 };
58 106
59 nand0: nand@40000000 { 107 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi b/arch/arm/boot/dts/at91sam9n12.dtsi
index 82508d68aa7e..e9efb34f4379 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -84,6 +84,15 @@
84 reg = <0xfffffe10 0x10>; 84 reg = <0xfffffe10 0x10>;
85 }; 85 };
86 86
87 mmc0: mmc@f0008000 {
88 compatible = "atmel,hsmci";
89 reg = <0xf0008000 0x600>;
90 interrupts = <12 4 0>;
91 #address-cells = <1>;
92 #size-cells = <0>;
93 status = "disabled";
94 };
95
87 tcb0: timer@f8008000 { 96 tcb0: timer@f8008000 {
88 compatible = "atmel,at91sam9x5-tcb"; 97 compatible = "atmel,at91sam9x5-tcb";
89 reg = <0xf8008000 0x100>; 98 reg = <0xf8008000 0x100>;
@@ -102,50 +111,186 @@
102 interrupts = <20 4 0>; 111 interrupts = <20 4 0>;
103 }; 112 };
104 113
105 pioA: gpio@fffff400 { 114 pinctrl@fffff400 {
106 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 115 #address-cells = <1>;
107 reg = <0xfffff400 0x100>; 116 #size-cells = <1>;
108 interrupts = <2 4 1>; 117 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
109 #gpio-cells = <2>; 118 ranges = <0xfffff400 0xfffff400 0x800>;
110 gpio-controller;
111 interrupt-controller;
112 #interrupt-cells = <2>;
113 };
114 119
115 pioB: gpio@fffff600 { 120 atmel,mux-mask = <
116 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 121 /* A B C */
117 reg = <0xfffff600 0x100>; 122 0xffffffff 0xffe07983 0x00000000 /* pioA */
118 interrupts = <2 4 1>; 123 0x00040000 0x00047e0f 0x00000000 /* pioB */
119 #gpio-cells = <2>; 124 0xfdffffff 0x07c00000 0xb83fffff /* pioC */
120 gpio-controller; 125 0x003fffff 0x003f8000 0x00000000 /* pioD */
121 interrupt-controller; 126 >;
122 #interrupt-cells = <2>;
123 };
124 127
125 pioC: gpio@fffff800 { 128 /* shared pinctrl settings */
126 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 129 dbgu {
127 reg = <0xfffff800 0x100>; 130 pinctrl_dbgu: dbgu-0 {
128 interrupts = <3 4 1>; 131 atmel,pins =
129 #gpio-cells = <2>; 132 <0 9 0x1 0x0 /* PA9 periph A */
130 gpio-controller; 133 0 10 0x1 0x1>; /* PA10 periph with pullup */
131 interrupt-controller; 134 };
132 #interrupt-cells = <2>; 135 };
133 };
134 136
135 pioD: gpio@fffffa00 { 137 usart0 {
136 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 138 pinctrl_usart0: usart0-0 {
137 reg = <0xfffffa00 0x100>; 139 atmel,pins =
138 interrupts = <3 4 1>; 140 <0 1 0x1 0x1 /* PA1 periph A with pullup */
139 #gpio-cells = <2>; 141 0 0 0x1 0x0>; /* PA0 periph A */
140 gpio-controller; 142 };
141 interrupt-controller; 143
142 #interrupt-cells = <2>; 144 pinctrl_usart0_rts: usart0_rts-0 {
145 atmel,pins =
146 <0 2 0x1 0x0>; /* PA2 periph A */
147 };
148
149 pinctrl_usart0_cts: usart0_cts-0 {
150 atmel,pins =
151 <0 3 0x1 0x0>; /* PA3 periph A */
152 };
153 };
154
155 usart1 {
156 pinctrl_usart1: usart1-0 {
157 atmel,pins =
158 <0 6 0x1 0x1 /* PA6 periph A with pullup */
159 0 5 0x1 0x0>; /* PA5 periph A */
160 };
161 };
162
163 usart2 {
164 pinctrl_usart2: usart2-0 {
165 atmel,pins =
166 <0 8 0x1 0x1 /* PA8 periph A with pullup */
167 0 7 0x1 0x0>; /* PA7 periph A */
168 };
169
170 pinctrl_usart2_rts: usart2_rts-0 {
171 atmel,pins =
172 <1 0 0x2 0x0>; /* PB0 periph B */
173 };
174
175 pinctrl_usart2_cts: usart2_cts-0 {
176 atmel,pins =
177 <1 1 0x2 0x0>; /* PB1 periph B */
178 };
179 };
180
181 usart3 {
182 pinctrl_usart3: usart3-0 {
183 atmel,pins =
184 <2 23 0x2 0x1 /* PC23 periph B with pullup */
185 2 22 0x2 0x0>; /* PC22 periph B */
186 };
187
188 pinctrl_usart3_rts: usart3_rts-0 {
189 atmel,pins =
190 <2 24 0x2 0x0>; /* PC24 periph B */
191 };
192
193 pinctrl_usart3_cts: usart3_cts-0 {
194 atmel,pins =
195 <2 25 0x2 0x0>; /* PC25 periph B */
196 };
197 };
198
199 uart0 {
200 pinctrl_uart0: uart0-0 {
201 atmel,pins =
202 <2 9 0x3 0x1 /* PC9 periph C with pullup */
203 2 8 0x3 0x0>; /* PC8 periph C */
204 };
205 };
206
207 uart1 {
208 pinctrl_uart1: uart1-0 {
209 atmel,pins =
210 <2 16 0x3 0x1 /* PC17 periph C with pullup */
211 2 17 0x3 0x0>; /* PC16 periph C */
212 };
213 };
214
215 nand {
216 pinctrl_nand: nand-0 {
217 atmel,pins =
218 <3 5 0x0 0x1 /* PD5 gpio RDY pin pull_up*/
219 3 4 0x0 0x1>; /* PD4 gpio enable pin pull_up */
220 };
221 };
222
223 mmc0 {
224 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
225 atmel,pins =
226 <0 17 0x1 0x0 /* PA17 periph A */
227 0 16 0x1 0x1 /* PA16 periph A with pullup */
228 0 15 0x1 0x1>; /* PA15 periph A with pullup */
229 };
230
231 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
232 atmel,pins =
233 <0 18 0x1 0x1 /* PA18 periph A with pullup */
234 0 19 0x1 0x1 /* PA19 periph A with pullup */
235 0 20 0x1 0x1>; /* PA20 periph A with pullup */
236 };
237
238 pinctrl_mmc0_slot0_dat4_7: mmc0_slot0_dat4_7-0 {
239 atmel,pins =
240 <0 11 0x2 0x1 /* PA11 periph B with pullup */
241 0 12 0x2 0x1 /* PA12 periph B with pullup */
242 0 13 0x2 0x1 /* PA13 periph B with pullup */
243 0 14 0x2 0x1>; /* PA14 periph B with pullup */
244 };
245 };
246
247 pioA: gpio@fffff400 {
248 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
249 reg = <0xfffff400 0x200>;
250 interrupts = <2 4 1>;
251 #gpio-cells = <2>;
252 gpio-controller;
253 interrupt-controller;
254 #interrupt-cells = <2>;
255 };
256
257 pioB: gpio@fffff600 {
258 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
259 reg = <0xfffff600 0x200>;
260 interrupts = <2 4 1>;
261 #gpio-cells = <2>;
262 gpio-controller;
263 interrupt-controller;
264 #interrupt-cells = <2>;
265 };
266
267 pioC: gpio@fffff800 {
268 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
269 reg = <0xfffff800 0x200>;
270 interrupts = <3 4 1>;
271 #gpio-cells = <2>;
272 gpio-controller;
273 interrupt-controller;
274 #interrupt-cells = <2>;
275 };
276
277 pioD: gpio@fffffa00 {
278 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
279 reg = <0xfffffa00 0x200>;
280 interrupts = <3 4 1>;
281 #gpio-cells = <2>;
282 gpio-controller;
283 interrupt-controller;
284 #interrupt-cells = <2>;
285 };
143 }; 286 };
144 287
145 dbgu: serial@fffff200 { 288 dbgu: serial@fffff200 {
146 compatible = "atmel,at91sam9260-usart"; 289 compatible = "atmel,at91sam9260-usart";
147 reg = <0xfffff200 0x200>; 290 reg = <0xfffff200 0x200>;
148 interrupts = <1 4 7>; 291 interrupts = <1 4 7>;
292 pinctrl-names = "default";
293 pinctrl-0 = <&pinctrl_dbgu>;
149 status = "disabled"; 294 status = "disabled";
150 }; 295 };
151 296
@@ -155,6 +300,8 @@
155 interrupts = <5 4 5>; 300 interrupts = <5 4 5>;
156 atmel,use-dma-rx; 301 atmel,use-dma-rx;
157 atmel,use-dma-tx; 302 atmel,use-dma-tx;
303 pinctrl-names = "default";
304 pinctrl-0 = <&pinctrl_usart0>;
158 status = "disabled"; 305 status = "disabled";
159 }; 306 };
160 307
@@ -164,6 +311,8 @@
164 interrupts = <6 4 5>; 311 interrupts = <6 4 5>;
165 atmel,use-dma-rx; 312 atmel,use-dma-rx;
166 atmel,use-dma-tx; 313 atmel,use-dma-tx;
314 pinctrl-names = "default";
315 pinctrl-0 = <&pinctrl_usart1>;
167 status = "disabled"; 316 status = "disabled";
168 }; 317 };
169 318
@@ -173,6 +322,8 @@
173 interrupts = <7 4 5>; 322 interrupts = <7 4 5>;
174 atmel,use-dma-rx; 323 atmel,use-dma-rx;
175 atmel,use-dma-tx; 324 atmel,use-dma-tx;
325 pinctrl-names = "default";
326 pinctrl-0 = <&pinctrl_usart2>;
176 status = "disabled"; 327 status = "disabled";
177 }; 328 };
178 329
@@ -182,6 +333,8 @@
182 interrupts = <8 4 5>; 333 interrupts = <8 4 5>;
183 atmel,use-dma-rx; 334 atmel,use-dma-rx;
184 atmel,use-dma-tx; 335 atmel,use-dma-tx;
336 pinctrl-names = "default";
337 pinctrl-0 = <&pinctrl_usart3>;
185 status = "disabled"; 338 status = "disabled";
186 }; 339 };
187 340
@@ -215,6 +368,8 @@
215 >; 368 >;
216 atmel,nand-addr-offset = <21>; 369 atmel,nand-addr-offset = <21>;
217 atmel,nand-cmd-offset = <22>; 370 atmel,nand-cmd-offset = <22>;
371 pinctrl-names = "default";
372 pinctrl-0 = <&pinctrl_nand>;
218 gpios = <&pioD 5 0 373 gpios = <&pioD 5 0
219 &pioD 4 0 374 &pioD 4 0
220 0 375 0
diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts b/arch/arm/boot/dts/at91sam9n12ek.dts
index 912b2c283d6f..0376bf4fd66b 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -45,6 +45,28 @@
45 i2c1: i2c@f8014000 { 45 i2c1: i2c@f8014000 {
46 status = "okay"; 46 status = "okay";
47 }; 47 };
48
49 mmc0: mmc@f0008000 {
50 pinctrl-0 = <
51 &pinctrl_board_mmc0
52 &pinctrl_mmc0_slot0_clk_cmd_dat0
53 &pinctrl_mmc0_slot0_dat1_3>;
54 status = "okay";
55 slot@0 {
56 reg = <0>;
57 bus-width = <4>;
58 cd-gpios = <&pioA 7 0>;
59 };
60 };
61
62 pinctrl@fffff400 {
63 mmc0 {
64 pinctrl_board_mmc0: mmc0-board {
65 atmel,pins =
66 <0 7 0x0 0x5>; /* PA7 gpio CD pin pull up and deglitch */
67 };
68 };
69 };
48 }; 70 };
49 71
50 nand0: nand@40000000 { 72 nand0: nand@40000000 {
diff --git a/arch/arm/boot/dts/at91sam9x25.dtsi b/arch/arm/boot/dts/at91sam9x25.dtsi
new file mode 100644
index 000000000000..54eb33ba6d22
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x25.dtsi
@@ -0,0 +1,49 @@
1/*
2 * at91sam9x25.dtsi - Device Tree Include file for AT91SAM9X25 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9X25 SoC";
13 compatible = "atmel, at91sam9x25, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe03fff 0xc000001c /* pioA */
21 0x0007ffff 0x00047e3f 0x00000000 /* pioB */
22 0x80000000 0xfffd0000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25
26 macb1 {
27 pinctrl_macb1_rmii: macb1_rmii-0 {
28 atmel,pins =
29 <2 16 0x2 0x0 /* PC16 periph B */
30 2 18 0x2 0x0 /* PC18 periph B */
31 2 19 0x2 0x0 /* PC19 periph B */
32 2 20 0x2 0x0 /* PC20 periph B */
33 2 21 0x2 0x0 /* PC21 periph B */
34 2 27 0x2 0x0 /* PC27 periph B */
35 2 28 0x2 0x0 /* PC28 periph B */
36 2 29 0x2 0x0 /* PC29 periph B */
37 2 30 0x2 0x0 /* PC30 periph B */
38 2 31 0x2 0x0>; /* PC31 periph B */
39 };
40 };
41 };
42
43 macb1: ethernet@f8030000 {
44 pinctrl-names = "default";
45 pinctrl-0 = <&pinctrl_macb1_rmii>;
46 };
47 };
48 };
49};
diff --git a/arch/arm/boot/dts/at91sam9x25ek.dts b/arch/arm/boot/dts/at91sam9x25ek.dts
new file mode 100644
index 000000000000..af907eaa1f25
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x25ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9x25ek.dts - Device Tree file for AT91SAM9X25-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9x25.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9G25-EK";
15 compatible = "atmel,at91sam9x25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9x35.dtsi b/arch/arm/boot/dts/at91sam9x35.dtsi
new file mode 100644
index 000000000000..fb102d6126ce
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x35.dtsi
@@ -0,0 +1,28 @@
1/*
2 * at91sam9x35.dtsi - Device Tree Include file for AT91SAM9X35 SoC
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/include/ "at91sam9x5.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9X35 SoC";
13 compatible = "atmel, at91sam9x35, atmel,at91sam9x5";
14
15 ahb {
16 apb {
17 pinctrl@fffff400 {
18 atmel,mux-mask = <
19 /* A B C */
20 0xffffffff 0xffe03fff 0xc000000c /* pioA */
21 0x000406ff 0x00047e3f 0x00000000 /* pioB */
22 0xfdffffff 0x00000000 0xb83fffff /* pioC */
23 0x003fffff 0x003f8000 0x00000000 /* pioD */
24 >;
25 };
26 };
27 };
28};
diff --git a/arch/arm/boot/dts/at91sam9x35ek.dts b/arch/arm/boot/dts/at91sam9x35ek.dts
new file mode 100644
index 000000000000..5ccb607b5414
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x35ek.dts
@@ -0,0 +1,16 @@
1/*
2 * at91sam9x35ek.dts - Device Tree file for AT91SAM9X35-EK board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/dts-v1/;
10/include/ "at91sam9x35.dtsi"
11/include/ "at91sam9x5ek.dtsi"
12
13/ {
14 model = "Atmel AT91SAM9X35-EK";
15 compatible = "atmel,at91sam9x35ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16};
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index 03fc136421c5..7ee49e8daf98 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -111,50 +111,244 @@
111 interrupts = <21 4 0>; 111 interrupts = <21 4 0>;
112 }; 112 };
113 113
114 pioA: gpio@fffff400 { 114 pinctrl@fffff400 {
115 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 115 #address-cells = <1>;
116 reg = <0xfffff400 0x100>; 116 #size-cells = <1>;
117 interrupts = <2 4 1>; 117 compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
118 #gpio-cells = <2>; 118 ranges = <0xfffff400 0xfffff400 0x800>;
119 gpio-controller; 119
120 interrupt-controller; 120 /* shared pinctrl settings */
121 #interrupt-cells = <2>; 121 dbgu {
122 }; 122 pinctrl_dbgu: dbgu-0 {
123 atmel,pins =
124 <0 9 0x1 0x0 /* PA9 periph A */
125 0 10 0x1 0x1>; /* PA10 periph A with pullup */
126 };
127 };
123 128
124 pioB: gpio@fffff600 { 129 usart0 {
125 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 130 pinctrl_usart0: usart0-0 {
126 reg = <0xfffff600 0x100>; 131 atmel,pins =
127 interrupts = <2 4 1>; 132 <0 0 0x1 0x1 /* PA0 periph A with pullup */
128 #gpio-cells = <2>; 133 0 1 0x1 0x0>; /* PA1 periph A */
129 gpio-controller; 134 };
130 interrupt-controller; 135
131 #interrupt-cells = <2>; 136 pinctrl_usart0_rts: usart0_rts-0 {
137 atmel,pins =
138 <0 2 0x1 0x0>; /* PA2 periph A */
139 };
140
141 pinctrl_usart0_cts: usart0_cts-0 {
142 atmel,pins =
143 <0 3 0x1 0x0>; /* PA3 periph A */
144 };
145 };
146
147 usart1 {
148 pinctrl_usart1: usart1-0 {
149 atmel,pins =
150 <0 5 0x1 0x1 /* PA5 periph A with pullup */
151 0 6 0x1 0x0>; /* PA6 periph A */
152 };
153
154 pinctrl_usart1_rts: usart1_rts-0 {
155 atmel,pins =
156 <3 27 0x3 0x0>; /* PC27 periph C */
157 };
158
159 pinctrl_usart1_cts: usart1_cts-0 {
160 atmel,pins =
161 <3 28 0x3 0x0>; /* PC28 periph C */
162 };
163 };
164
165 usart2 {
166 pinctrl_usart2: usart2-0 {
167 atmel,pins =
168 <0 7 0x1 0x1 /* PA7 periph A with pullup */
169 0 8 0x1 0x0>; /* PA8 periph A */
170 };
171
172 pinctrl_uart2_rts: uart2_rts-0 {
173 atmel,pins =
174 <0 0 0x2 0x0>; /* PB0 periph B */
175 };
176
177 pinctrl_uart2_cts: uart2_cts-0 {
178 atmel,pins =
179 <0 1 0x2 0x0>; /* PB1 periph B */
180 };
181 };
182
183 usart3 {
184 pinctrl_uart3: usart3-0 {
185 atmel,pins =
186 <3 23 0x2 0x1 /* PC22 periph B with pullup */
187 3 23 0x2 0x0>; /* PC23 periph B */
188 };
189
190 pinctrl_usart3_rts: usart3_rts-0 {
191 atmel,pins =
192 <3 24 0x2 0x0>; /* PC24 periph B */
193 };
194
195 pinctrl_usart3_cts: usart3_cts-0 {
196 atmel,pins =
197 <3 25 0x2 0x0>; /* PC25 periph B */
198 };
199 };
200
201 uart0 {
202 pinctrl_uart0: uart0-0 {
203 atmel,pins =
204 <3 8 0x3 0x0 /* PC8 periph C */
205 3 9 0x3 0x1>; /* PC9 periph C with pullup */
206 };
207 };
208
209 uart1 {
210 pinctrl_uart1: uart1-0 {
211 atmel,pins =
212 <3 16 0x3 0x0 /* PC16 periph C */
213 3 17 0x3 0x1>; /* PC17 periph C with pullup */
214 };
215 };
216
217 nand {
218 pinctrl_nand: nand-0 {
219 atmel,pins =
220 <3 4 0x0 0x1 /* PD5 gpio RDY pin pull_up */
221 3 5 0x0 0x1>; /* PD4 gpio enable pin pull_up */
222 };
223 };
224
225 macb0 {
226 pinctrl_macb0_rmii: macb0_rmii-0 {
227 atmel,pins =
228 <1 0 0x1 0x0 /* PB0 periph A */
229 1 1 0x1 0x0 /* PB1 periph A */
230 1 2 0x1 0x0 /* PB2 periph A */
231 1 3 0x1 0x0 /* PB3 periph A */
232 1 4 0x1 0x0 /* PB4 periph A */
233 1 5 0x1 0x0 /* PB5 periph A */
234 1 6 0x1 0x0 /* PB6 periph A */
235 1 7 0x1 0x0 /* PB7 periph A */
236 1 9 0x1 0x0 /* PB9 periph A */
237 1 10 0x1 0x0>; /* PB10 periph A */
238 };
239
240 pinctrl_macb0_rmii_mii: macb0_rmii_mii-0 {
241 atmel,pins =
242 <1 8 0x1 0x0 /* PA8 periph A */
243 1 11 0x1 0x0 /* PA11 periph A */
244 1 12 0x1 0x0 /* PA12 periph A */
245 1 13 0x1 0x0 /* PA13 periph A */
246 1 14 0x1 0x0 /* PA14 periph A */
247 1 15 0x1 0x0 /* PA15 periph A */
248 1 16 0x1 0x0 /* PA16 periph A */
249 1 17 0x1 0x0>; /* PA17 periph A */
250 };
251 };
252
253 mmc0 {
254 pinctrl_mmc0_slot0_clk_cmd_dat0: mmc0_slot0_clk_cmd_dat0-0 {
255 atmel,pins =
256 <0 17 0x1 0x0 /* PA17 periph A */
257 0 16 0x1 0x1 /* PA16 periph A with pullup */
258 0 15 0x1 0x1>; /* PA15 periph A with pullup */
259 };
260
261 pinctrl_mmc0_slot0_dat1_3: mmc0_slot0_dat1_3-0 {
262 atmel,pins =
263 <0 18 0x1 0x1 /* PA18 periph A with pullup */
264 0 19 0x1 0x1 /* PA19 periph A with pullup */
265 0 20 0x1 0x1>; /* PA20 periph A with pullup */
266 };
267 };
268
269 mmc1 {
270 pinctrl_mmc1_slot0_clk_cmd_dat0: mmc1_slot0_clk_cmd_dat0-0 {
271 atmel,pins =
272 <0 13 0x2 0x0 /* PA13 periph B */
273 0 12 0x2 0x1 /* PA12 periph B with pullup */
274 0 11 0x2 0x1>; /* PA11 periph B with pullup */
275 };
276
277 pinctrl_mmc1_slot0_dat1_3: mmc1_slot0_dat1_3-0 {
278 atmel,pins =
279 <0 2 0x2 0x1 /* PA2 periph B with pullup */
280 0 3 0x2 0x1 /* PA3 periph B with pullup */
281 0 4 0x2 0x1>; /* PA4 periph B with pullup */
282 };
283 };
284
285 pioA: gpio@fffff400 {
286 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
287 reg = <0xfffff400 0x200>;
288 interrupts = <2 4 1>;
289 #gpio-cells = <2>;
290 gpio-controller;
291 interrupt-controller;
292 #interrupt-cells = <2>;
293 };
294
295 pioB: gpio@fffff600 {
296 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
297 reg = <0xfffff600 0x200>;
298 interrupts = <2 4 1>;
299 #gpio-cells = <2>;
300 gpio-controller;
301 #gpio-lines = <19>;
302 interrupt-controller;
303 #interrupt-cells = <2>;
304 };
305
306 pioC: gpio@fffff800 {
307 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
308 reg = <0xfffff800 0x200>;
309 interrupts = <3 4 1>;
310 #gpio-cells = <2>;
311 gpio-controller;
312 interrupt-controller;
313 #interrupt-cells = <2>;
314 };
315
316 pioD: gpio@fffffa00 {
317 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
318 reg = <0xfffffa00 0x200>;
319 interrupts = <3 4 1>;
320 #gpio-cells = <2>;
321 gpio-controller;
322 #gpio-lines = <22>;
323 interrupt-controller;
324 #interrupt-cells = <2>;
325 };
132 }; 326 };
133 327
134 pioC: gpio@fffff800 { 328 mmc0: mmc@f0008000 {
135 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 329 compatible = "atmel,hsmci";
136 reg = <0xfffff800 0x100>; 330 reg = <0xf0008000 0x600>;
137 interrupts = <3 4 1>; 331 interrupts = <12 4 0>;
138 #gpio-cells = <2>; 332 #address-cells = <1>;
139 gpio-controller; 333 #size-cells = <0>;
140 interrupt-controller; 334 status = "disabled";
141 #interrupt-cells = <2>;
142 }; 335 };
143 336
144 pioD: gpio@fffffa00 { 337 mmc1: mmc@f000c000 {
145 compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio"; 338 compatible = "atmel,hsmci";
146 reg = <0xfffffa00 0x100>; 339 reg = <0xf000c000 0x600>;
147 interrupts = <3 4 1>; 340 interrupts = <26 4 0>;
148 #gpio-cells = <2>; 341 #address-cells = <1>;
149 gpio-controller; 342 #size-cells = <0>;
150 interrupt-controller; 343 status = "disabled";
151 #interrupt-cells = <2>;
152 }; 344 };
153 345
154 dbgu: serial@fffff200 { 346 dbgu: serial@fffff200 {
155 compatible = "atmel,at91sam9260-usart"; 347 compatible = "atmel,at91sam9260-usart";
156 reg = <0xfffff200 0x200>; 348 reg = <0xfffff200 0x200>;
157 interrupts = <1 4 7>; 349 interrupts = <1 4 7>;
350 pinctrl-names = "default";
351 pinctrl-0 = <&pinctrl_dbgu>;
158 status = "disabled"; 352 status = "disabled";
159 }; 353 };
160 354
@@ -164,6 +358,8 @@
164 interrupts = <5 4 5>; 358 interrupts = <5 4 5>;
165 atmel,use-dma-rx; 359 atmel,use-dma-rx;
166 atmel,use-dma-tx; 360 atmel,use-dma-tx;
361 pinctrl-names = "default";
362 pinctrl-0 = <&pinctrl_usart0>;
167 status = "disabled"; 363 status = "disabled";
168 }; 364 };
169 365
@@ -173,6 +369,8 @@
173 interrupts = <6 4 5>; 369 interrupts = <6 4 5>;
174 atmel,use-dma-rx; 370 atmel,use-dma-rx;
175 atmel,use-dma-tx; 371 atmel,use-dma-tx;
372 pinctrl-names = "default";
373 pinctrl-0 = <&pinctrl_usart1>;
176 status = "disabled"; 374 status = "disabled";
177 }; 375 };
178 376
@@ -182,6 +380,8 @@
182 interrupts = <7 4 5>; 380 interrupts = <7 4 5>;
183 atmel,use-dma-rx; 381 atmel,use-dma-rx;
184 atmel,use-dma-tx; 382 atmel,use-dma-tx;
383 pinctrl-names = "default";
384 pinctrl-0 = <&pinctrl_usart2>;
185 status = "disabled"; 385 status = "disabled";
186 }; 386 };
187 387
@@ -189,6 +389,8 @@
189 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 389 compatible = "cdns,at32ap7000-macb", "cdns,macb";
190 reg = <0xf802c000 0x100>; 390 reg = <0xf802c000 0x100>;
191 interrupts = <24 4 3>; 391 interrupts = <24 4 3>;
392 pinctrl-names = "default";
393 pinctrl-0 = <&pinctrl_macb0_rmii>;
192 status = "disabled"; 394 status = "disabled";
193 }; 395 };
194 396
@@ -273,6 +475,8 @@
273 >; 475 >;
274 atmel,nand-addr-offset = <21>; 476 atmel,nand-addr-offset = <21>;
275 atmel,nand-cmd-offset = <22>; 477 atmel,nand-cmd-offset = <22>;
478 pinctrl-names = "default";
479 pinctrl-0 = <&pinctrl_nand>;
276 gpios = <&pioD 5 0 480 gpios = <&pioD 5 0
277 &pioD 4 0 481 &pioD 4 0
278 0 482 0
diff --git a/arch/arm/boot/dts/at91sam9x5ek.dtsi b/arch/arm/boot/dts/at91sam9x5ek.dtsi
new file mode 100644
index 000000000000..8a7cf1d9cf5d
--- /dev/null
+++ b/arch/arm/boot/dts/at91sam9x5ek.dtsi
@@ -0,0 +1,101 @@
1/*
2 * at91sam9x5ek.dtsi - Device Tree file for AT91SAM9x5CM Base board
3 *
4 * Copyright (C) 2012 Atmel,
5 * 2012 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * Licensed under GPLv2 or later.
8 */
9/include/ "at91sam9x5cm.dtsi"
10
11/ {
12 model = "Atmel AT91SAM9X5-EK";
13 compatible = "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
17 };
18
19 ahb {
20 apb {
21 mmc0: mmc@f0008000 {
22 pinctrl-0 = <
23 &pinctrl_board_mmc0
24 &pinctrl_mmc0_slot0_clk_cmd_dat0
25 &pinctrl_mmc0_slot0_dat1_3>;
26 status = "okay";
27 slot@0 {
28 reg = <0>;
29 bus-width = <4>;
30 cd-gpios = <&pioD 15 0>;
31 };
32 };
33
34 mmc1: mmc@f000c000 {
35 pinctrl-0 = <
36 &pinctrl_board_mmc1
37 &pinctrl_mmc1_slot0_clk_cmd_dat0
38 &pinctrl_mmc1_slot0_dat1_3>;
39 status = "okay";
40 slot@0 {
41 reg = <0>;
42 bus-width = <4>;
43 cd-gpios = <&pioD 14 0>;
44 };
45 };
46
47 dbgu: serial@fffff200 {
48 status = "okay";
49 };
50
51 usart0: serial@f801c000 {
52 status = "okay";
53 };
54
55 macb0: ethernet@f802c000 {
56 phy-mode = "rmii";
57 status = "okay";
58 };
59
60 i2c0: i2c@f8010000 {
61 status = "okay";
62 };
63
64 i2c1: i2c@f8014000 {
65 status = "okay";
66 };
67
68 i2c2: i2c@f8018000 {
69 status = "okay";
70 };
71
72 pinctrl@fffff400 {
73 mmc0 {
74 pinctrl_board_mmc0: mmc0-board {
75 atmel,pins =
76 <3 15 0x0 0x5>; /* PD15 gpio CD pin pull up and deglitch */
77 };
78 };
79
80 mmc1 {
81 pinctrl_board_mmc1: mmc1-board {
82 atmel,pins =
83 <3 14 0x0 0x5>; /* PD14 gpio CD pin pull up and deglitch */
84 };
85 };
86 };
87 };
88
89 usb0: ohci@00600000 {
90 status = "okay";
91 num-ports = <2>;
92 atmel,vbus-gpio = <&pioD 19 1
93 &pioD 20 1
94 >;
95 };
96
97 usb1: ehci@00700000 {
98 status = "okay";
99 };
100 };
101};
diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 4b0e0ca08f40..731086b2fca2 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -203,6 +203,14 @@
203 reg = <0x80157450 0xC>; 203 reg = <0x80157450 0xC>;
204 }; 204 };
205 205
206 thermal@801573c0 {
207 compatible = "stericsson,db8500-thermal";
208 reg = <0x801573c0 0x40>;
209 interrupts = <21 0x4>, <22 0x4>;
210 interrupt-names = "IRQ_HOTMON_LOW", "IRQ_HOTMON_HIGH";
211 status = "disabled";
212 };
213
206 db8500-prcmu-regulators { 214 db8500-prcmu-regulators {
207 compatible = "stericsson,db8500-prcmu-regulator"; 215 compatible = "stericsson,db8500-prcmu-regulator";
208 216
@@ -660,5 +668,11 @@
660 ranges = <0 0x50000000 0x4000000>; 668 ranges = <0 0x50000000 0x4000000>;
661 status = "disabled"; 669 status = "disabled";
662 }; 670 };
671
672 cpufreq-cooling {
673 compatible = "stericsson,db8500-cpufreq-cooling";
674 status = "disabled";
675 };
676
663 }; 677 };
664}; 678};
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index 55c57ea6169e..b4587b27ae42 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -799,6 +799,7 @@
799 compatible = "fsl,imx28-auart", "fsl,imx23-auart"; 799 compatible = "fsl,imx28-auart", "fsl,imx23-auart";
800 reg = <0x8006a000 0x2000>; 800 reg = <0x8006a000 0x2000>;
801 interrupts = <112 70 71>; 801 interrupts = <112 70 71>;
802 fsl,auart-dma-channel = <8 9>;
802 clocks = <&clks 45>; 803 clocks = <&clks 45>;
803 status = "disabled"; 804 status = "disabled";
804 }; 805 };
diff --git a/arch/arm/boot/dts/pm9g45.dts b/arch/arm/boot/dts/pm9g45.dts
new file mode 100644
index 000000000000..387fedb58988
--- /dev/null
+++ b/arch/arm/boot/dts/pm9g45.dts
@@ -0,0 +1,165 @@
1/*
2 * pm9g45.dts - Device Tree file for Ronetix pm9g45 board
3 *
4 * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8/dts-v1/;
9/include/ "at91sam9g45.dtsi"
10
11/ {
12 model = "Ronetix pm9g45";
13 compatible = "ronetix,pm9g45", "atmel,at91sam9g45", "atmel,at91sam9";
14
15 chosen {
16 bootargs = "console=ttyS0,115200";
17 };
18
19 memory {
20 reg = <0x70000000 0x8000000>;
21 };
22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>;
31 };
32 };
33
34 ahb {
35 apb {
36 dbgu: serial@ffffee00 {
37 status = "okay";
38 };
39
40 pinctrl@fffff200 {
41
42 board {
43 pinctrl_board_nand: nand0-board {
44 atmel,pins =
45 <3 3 0x0 0x1 /* PD3 gpio RDY pin pull_up*/
46 2 14 0x0 0x1>; /* PC14 gpio enable pin pull_up */
47 };
48 };
49
50 mmc {
51 pinctrl_board_mmc: mmc0-board {
52 atmel,pins =
53 <3 6 0x0 0x5>; /* PD6 gpio CD pin pull_up and deglitch */
54 };
55 };
56 };
57
58 mmc0: mmc@fff80000 {
59 pinctrl-0 = <
60 &pinctrl_board_mmc
61 &pinctrl_mmc0_slot0_clk_cmd_dat0
62 &pinctrl_mmc0_slot0_dat1_3>;
63 status = "okay";
64 slot@0 {
65 reg = <0>;
66 bus-width = <4>;
67 cd-gpios = <&pioD 6 0>;
68 };
69 };
70
71 macb0: ethernet@fffbc000 {
72 phy-mode = "rmii";
73 status = "okay";
74 };
75
76 };
77
78 nand0: nand@40000000 {
79 nand-bus-width = <8>;
80 nand-ecc-mode = "soft";
81 nand-on-flash-bbt;
82 pinctrl-0 = <&pinctrl_board_nand>;
83
84 gpios = <&pioD 3 0
85 &pioC 14 0
86 0
87 >;
88
89 status = "okay";
90
91 at91bootstrap@0 {
92 label = "at91bootstrap";
93 reg = <0x0 0x20000>;
94 };
95
96 barebox@20000 {
97 label = "barebox";
98 reg = <0x20000 0x40000>;
99 };
100
101 bareboxenv@60000 {
102 label = "bareboxenv";
103 reg = <0x60000 0x1A0000>;
104 };
105
106 kernel@200000 {
107 label = "bareboxenv2";
108 reg = <0x200000 0x300000>;
109 };
110
111 kernel@500000 {
112 label = "root";
113 reg = <0x500000 0x400000>;
114 };
115
116 data@900000 {
117 label = "data";
118 reg = <0x900000 0x8340000>;
119 };
120 };
121
122 usb0: ohci@00700000 {
123 status = "okay";
124 num-ports = <2>;
125 };
126
127 usb1: ehci@00800000 {
128 status = "okay";
129 };
130 };
131
132 leds {
133 compatible = "gpio-leds";
134
135 led0 {
136 label = "led0";
137 gpios = <&pioD 0 1>;
138 linux,default-trigger = "nand-disk";
139 };
140
141 led1 {
142 label = "led1";
143 gpios = <&pioD 31 0>;
144 linux,default-trigger = "heartbeat";
145 };
146 };
147
148 gpio_keys {
149 compatible = "gpio-keys";
150 #address-cells = <1>;
151 #size-cells = <0>;
152
153 right {
154 label = "SW4";
155 gpios = <&pioE 7 1>;
156 linux,code = <106>;
157 };
158
159 up {
160 label = "SW3";
161 gpios = <&pioE 8 1>;
162 linux,code = <103>;
163 };
164 };
165};
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
index 702c0baa6004..c6f85f0bc531 100644
--- a/arch/arm/boot/dts/snowball.dts
+++ b/arch/arm/boot/dts/snowball.dts
@@ -99,6 +99,33 @@
99 status = "okay"; 99 status = "okay";
100 }; 100 };
101 101
102 prcmu@80157000 {
103 thermal@801573c0 {
104 num-trips = <4>;
105
106 trip0-temp = <70000>;
107 trip0-type = "active";
108 trip0-cdev-num = <1>;
109 trip0-cdev-name0 = "thermal-cpufreq-0";
110
111 trip1-temp = <75000>;
112 trip1-type = "active";
113 trip1-cdev-num = <1>;
114 trip1-cdev-name0 = "thermal-cpufreq-0";
115
116 trip2-temp = <80000>;
117 trip2-type = "active";
118 trip2-cdev-num = <1>;
119 trip2-cdev-name0 = "thermal-cpufreq-0";
120
121 trip3-temp = <85000>;
122 trip3-type = "critical";
123 trip3-cdev-num = <0>;
124
125 status = "okay";
126 };
127 };
128
102 external-bus@50000000 { 129 external-bus@50000000 {
103 status = "okay"; 130 status = "okay";
104 131
@@ -183,5 +210,9 @@
183 reg = <0x33>; 210 reg = <0x33>;
184 }; 211 };
185 }; 212 };
213
214 cpufreq-cooling {
215 status = "okay";
216 };
186 }; 217 };
187}; 218};
diff --git a/arch/arm/boot/dts/spear1310-evb.dts b/arch/arm/boot/dts/spear1310-evb.dts
index dd4358bc26e2..2e4c5727468e 100644
--- a/arch/arm/boot/dts/spear1310-evb.dts
+++ b/arch/arm/boot/dts/spear1310-evb.dts
@@ -181,6 +181,10 @@
181 status = "okay"; 181 status = "okay";
182 }; 182 };
183 183
184 gpio@d8400000 {
185 status = "okay";
186 };
187
184 i2c0: i2c@e0280000 { 188 i2c0: i2c@e0280000 {
185 status = "okay"; 189 status = "okay";
186 }; 190 };
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 419ea7413d23..7cd25eb4f8e0 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -70,6 +70,12 @@
70 status = "disabled"; 70 status = "disabled";
71 }; 71 };
72 72
73 pinmux: pinmux@e0700000 {
74 compatible = "st,spear1310-pinmux";
75 reg = <0xe0700000 0x1000>;
76 #gpio-range-cells = <2>;
77 };
78
73 spi1: spi@5d400000 { 79 spi1: spi@5d400000 {
74 compatible = "arm,pl022", "arm,primecell"; 80 compatible = "arm,pl022", "arm,primecell";
75 reg = <0x5d400000 0x1000>; 81 reg = <0x5d400000 0x1000>;
@@ -179,6 +185,27 @@
179 thermal@e07008c4 { 185 thermal@e07008c4 {
180 st,thermal-flags = <0x7000>; 186 st,thermal-flags = <0x7000>;
181 }; 187 };
188
189 gpiopinctrl: gpio@d8400000 {
190 compatible = "st,spear-plgpio";
191 reg = <0xd8400000 0x1000>;
192 interrupts = <0 100 0x4>;
193 #interrupt-cells = <1>;
194 interrupt-controller;
195 gpio-controller;
196 #gpio-cells = <2>;
197 gpio-ranges = <&pinmux 0 246>;
198 status = "disabled";
199
200 st-plgpio,ngpio = <246>;
201 st-plgpio,enb-reg = <0xd0>;
202 st-plgpio,wdata-reg = <0x90>;
203 st-plgpio,dir-reg = <0xb0>;
204 st-plgpio,ie-reg = <0x30>;
205 st-plgpio,rdata-reg = <0x70>;
206 st-plgpio,mis-reg = <0x10>;
207 st-plgpio,eit-reg = <0x50>;
208 };
182 }; 209 };
183 }; 210 };
184}; 211};
diff --git a/arch/arm/boot/dts/spear1340-evb.dts b/arch/arm/boot/dts/spear1340-evb.dts
index c9a54e06fb68..045f7123ffac 100644
--- a/arch/arm/boot/dts/spear1340-evb.dts
+++ b/arch/arm/boot/dts/spear1340-evb.dts
@@ -193,6 +193,10 @@
193 status = "okay"; 193 status = "okay";
194 }; 194 };
195 195
196 gpio@e2800000 {
197 status = "okay";
198 };
199
196 i2c0: i2c@e0280000 { 200 i2c0: i2c@e0280000 {
197 status = "okay"; 201 status = "okay";
198 }; 202 };
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index d71fe2a68f09..6c09eb0a1b2b 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -24,6 +24,12 @@
24 status = "disabled"; 24 status = "disabled";
25 }; 25 };
26 26
27 pinmux: pinmux@e0700000 {
28 compatible = "st,spear1340-pinmux";
29 reg = <0xe0700000 0x1000>;
30 #gpio-range-cells = <2>;
31 };
32
27 spi1: spi@5d400000 { 33 spi1: spi@5d400000 {
28 compatible = "arm,pl022", "arm,primecell"; 34 compatible = "arm,pl022", "arm,primecell";
29 reg = <0x5d400000 0x1000>; 35 reg = <0x5d400000 0x1000>;
@@ -51,6 +57,26 @@
51 thermal@e07008c4 { 57 thermal@e07008c4 {
52 st,thermal-flags = <0x2a00>; 58 st,thermal-flags = <0x2a00>;
53 }; 59 };
60
61 gpiopinctrl: gpio@e2800000 {
62 compatible = "st,spear-plgpio";
63 reg = <0xe2800000 0x1000>;
64 interrupts = <0 107 0x4>;
65 #interrupt-cells = <1>;
66 interrupt-controller;
67 gpio-controller;
68 #gpio-cells = <2>;
69 gpio-ranges = <&pinmux 0 252>;
70 status = "disabled";
71
72 st-plgpio,ngpio = <250>;
73 st-plgpio,wdata-reg = <0x40>;
74 st-plgpio,dir-reg = <0x00>;
75 st-plgpio,ie-reg = <0x80>;
76 st-plgpio,rdata-reg = <0x20>;
77 st-plgpio,mis-reg = <0xa0>;
78 st-plgpio,eit-reg = <0x60>;
79 };
54 }; 80 };
55 }; 81 };
56}; 82};
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index 62fc4fb3e5f9..930303e48df9 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -22,9 +22,10 @@
22 0xb0000000 0xb0000000 0x10000000 22 0xb0000000 0xb0000000 0x10000000
23 0xd0000000 0xd0000000 0x30000000>; 23 0xd0000000 0xd0000000 0x30000000>;
24 24
25 pinmux@b4000000 { 25 pinmux: pinmux@b4000000 {
26 compatible = "st,spear310-pinmux"; 26 compatible = "st,spear310-pinmux";
27 reg = <0xb4000000 0x1000>; 27 reg = <0xb4000000 0x1000>;
28 #gpio-range-cells = <2>;
28 }; 29 };
29 30
30 fsmc: flash@44000000 { 31 fsmc: flash@44000000 {
@@ -75,6 +76,25 @@
75 reg = <0xb2200000 0x1000>; 76 reg = <0xb2200000 0x1000>;
76 status = "disabled"; 77 status = "disabled";
77 }; 78 };
79
80 gpiopinctrl: gpio@b4000000 {
81 compatible = "st,spear-plgpio";
82 reg = <0xb4000000 0x1000>;
83 #interrupt-cells = <1>;
84 interrupt-controller;
85 gpio-controller;
86 #gpio-cells = <2>;
87 gpio-ranges = <&pinmux 0 102>;
88 status = "disabled";
89
90 st-plgpio,ngpio = <102>;
91 st-plgpio,enb-reg = <0x10>;
92 st-plgpio,wdata-reg = <0x20>;
93 st-plgpio,dir-reg = <0x30>;
94 st-plgpio,ie-reg = <0x50>;
95 st-plgpio,rdata-reg = <0x40>;
96 st-plgpio,mis-reg = <0x60>;
97 };
78 }; 98 };
79 }; 99 };
80}; 100};
diff --git a/arch/arm/boot/dts/spear320-evb.dts b/arch/arm/boot/dts/spear320-evb.dts
index 082328bd64ab..ad4bfc68ee05 100644
--- a/arch/arm/boot/dts/spear320-evb.dts
+++ b/arch/arm/boot/dts/spear320-evb.dts
@@ -164,6 +164,10 @@
164 status = "okay"; 164 status = "okay";
165 }; 165 };
166 166
167 gpio@b3000000 {
168 status = "okay";
169 };
170
167 i2c0: i2c@d0180000 { 171 i2c0: i2c@d0180000 {
168 status = "okay"; 172 status = "okay";
169 }; 173 };
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index 1f49d69595a0..67d7ada71275 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -21,9 +21,10 @@
21 ranges = <0x40000000 0x40000000 0x80000000 21 ranges = <0x40000000 0x40000000 0x80000000
22 0xd0000000 0xd0000000 0x30000000>; 22 0xd0000000 0xd0000000 0x30000000>;
23 23
24 pinmux@b3000000 { 24 pinmux: pinmux@b3000000 {
25 compatible = "st,spear320-pinmux"; 25 compatible = "st,spear320-pinmux";
26 reg = <0xb3000000 0x1000>; 26 reg = <0xb3000000 0x1000>;
27 #gpio-range-cells = <2>;
27 }; 28 };
28 29
29 clcd@90000000 { 30 clcd@90000000 {
@@ -90,6 +91,26 @@
90 reg = <0xa4000000 0x1000>; 91 reg = <0xa4000000 0x1000>;
91 status = "disabled"; 92 status = "disabled";
92 }; 93 };
94
95 gpiopinctrl: gpio@b3000000 {
96 compatible = "st,spear-plgpio";
97 reg = <0xb3000000 0x1000>;
98 #interrupt-cells = <1>;
99 interrupt-controller;
100 gpio-controller;
101 #gpio-cells = <2>;
102 gpio-ranges = <&pinmux 0 102>;
103 status = "disabled";
104
105 st-plgpio,ngpio = <102>;
106 st-plgpio,enb-reg = <0x24>;
107 st-plgpio,wdata-reg = <0x34>;
108 st-plgpio,dir-reg = <0x44>;
109 st-plgpio,ie-reg = <0x64>;
110 st-plgpio,rdata-reg = <0x54>;
111 st-plgpio,mis-reg = <0x84>;
112 st-plgpio,eit-reg = <0x94>;
113 };
93 }; 114 };
94 }; 115 };
95}; 116};
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index f0ba901676ac..a20d4ff3fb3c 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -523,12 +523,12 @@
523 }; 523 };
524 524
525 temperature-sensor@4c { 525 temperature-sensor@4c {
526 compatible = "nct1008"; 526 compatible = "onnn,nct1008";
527 reg = <0x4c>; 527 reg = <0x4c>;
528 }; 528 };
529 529
530 magnetometer@c { 530 magnetometer@c {
531 compatible = "ak8975"; 531 compatible = "ak,ak8975";
532 reg = <0xc>; 532 reg = <0xc>;
533 interrupt-parent = <&gpio>; 533 interrupt-parent = <&gpio>;
534 interrupts = <109 0x04>; /* gpio PN5 */ 534 interrupts = <109 0x04>; /* gpio PN5 */
diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi
index b1497c7d7d68..df7f2270fc91 100644
--- a/arch/arm/boot/dts/tegra30.dtsi
+++ b/arch/arm/boot/dts/tegra30.dtsi
@@ -73,8 +73,8 @@
73 73
74 pinmux: pinmux { 74 pinmux: pinmux {
75 compatible = "nvidia,tegra30-pinmux"; 75 compatible = "nvidia,tegra30-pinmux";
76 reg = <0x70000868 0xd0 /* Pad control registers */ 76 reg = <0x70000868 0xd4 /* Pad control registers */
77 0x70003000 0x3e0>; /* Mux registers */ 77 0x70003000 0x3e4>; /* Mux registers */
78 }; 78 };
79 79
80 serial@70006000 { 80 serial@70006000 {
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index aa5269984187..36ae03a3f5d1 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -70,6 +70,14 @@ struct gic_chip_data {
70static DEFINE_RAW_SPINLOCK(irq_controller_lock); 70static DEFINE_RAW_SPINLOCK(irq_controller_lock);
71 71
72/* 72/*
73 * The GIC mapping of CPU interfaces does not necessarily match
74 * the logical CPU numbering. Let's use a mapping as returned
75 * by the GIC itself.
76 */
77#define NR_GIC_CPU_IF 8
78static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
79
80/*
73 * Supported arch specific GIC irq extension. 81 * Supported arch specific GIC irq extension.
74 * Default make them NULL. 82 * Default make them NULL.
75 */ 83 */
@@ -238,11 +246,11 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
238 unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); 246 unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask);
239 u32 val, mask, bit; 247 u32 val, mask, bit;
240 248
241 if (cpu >= 8 || cpu >= nr_cpu_ids) 249 if (cpu >= NR_GIC_CPU_IF || cpu >= nr_cpu_ids)
242 return -EINVAL; 250 return -EINVAL;
243 251
244 mask = 0xff << shift; 252 mask = 0xff << shift;
245 bit = 1 << (cpu_logical_map(cpu) + shift); 253 bit = gic_cpu_map[cpu] << shift;
246 254
247 raw_spin_lock(&irq_controller_lock); 255 raw_spin_lock(&irq_controller_lock);
248 val = readl_relaxed(reg) & ~mask; 256 val = readl_relaxed(reg) & ~mask;
@@ -349,11 +357,6 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
349 u32 cpumask; 357 u32 cpumask;
350 unsigned int gic_irqs = gic->gic_irqs; 358 unsigned int gic_irqs = gic->gic_irqs;
351 void __iomem *base = gic_data_dist_base(gic); 359 void __iomem *base = gic_data_dist_base(gic);
352 u32 cpu = cpu_logical_map(smp_processor_id());
353
354 cpumask = 1 << cpu;
355 cpumask |= cpumask << 8;
356 cpumask |= cpumask << 16;
357 360
358 writel_relaxed(0, base + GIC_DIST_CTRL); 361 writel_relaxed(0, base + GIC_DIST_CTRL);
359 362
@@ -366,6 +369,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic)
366 /* 369 /*
367 * Set all global interrupts to this CPU only. 370 * Set all global interrupts to this CPU only.
368 */ 371 */
372 cpumask = readl_relaxed(base + GIC_DIST_TARGET + 0);
369 for (i = 32; i < gic_irqs; i += 4) 373 for (i = 32; i < gic_irqs; i += 4)
370 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 374 writel_relaxed(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
371 375
@@ -389,9 +393,25 @@ static void __cpuinit gic_cpu_init(struct gic_chip_data *gic)
389{ 393{
390 void __iomem *dist_base = gic_data_dist_base(gic); 394 void __iomem *dist_base = gic_data_dist_base(gic);
391 void __iomem *base = gic_data_cpu_base(gic); 395 void __iomem *base = gic_data_cpu_base(gic);
396 unsigned int cpu_mask, cpu = smp_processor_id();
392 int i; 397 int i;
393 398
394 /* 399 /*
400 * Get what the GIC says our CPU mask is.
401 */
402 BUG_ON(cpu >= NR_GIC_CPU_IF);
403 cpu_mask = readl_relaxed(dist_base + GIC_DIST_TARGET + 0);
404 gic_cpu_map[cpu] = cpu_mask;
405
406 /*
407 * Clear our mask from the other map entries in case they're
408 * still undefined.
409 */
410 for (i = 0; i < NR_GIC_CPU_IF; i++)
411 if (i != cpu)
412 gic_cpu_map[i] &= ~cpu_mask;
413
414 /*
395 * Deal with the banked PPI and SGI interrupts - disable all 415 * Deal with the banked PPI and SGI interrupts - disable all
396 * PPI interrupts, ensure all SGI interrupts are enabled. 416 * PPI interrupts, ensure all SGI interrupts are enabled.
397 */ 417 */
@@ -646,7 +666,7 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
646{ 666{
647 irq_hw_number_t hwirq_base; 667 irq_hw_number_t hwirq_base;
648 struct gic_chip_data *gic; 668 struct gic_chip_data *gic;
649 int gic_irqs, irq_base; 669 int gic_irqs, irq_base, i;
650 670
651 BUG_ON(gic_nr >= MAX_GIC_NR); 671 BUG_ON(gic_nr >= MAX_GIC_NR);
652 672
@@ -683,6 +703,13 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
683 } 703 }
684 704
685 /* 705 /*
706 * Initialize the CPU interface map to all CPUs.
707 * It will be refined as each CPU probes its ID.
708 */
709 for (i = 0; i < NR_GIC_CPU_IF; i++)
710 gic_cpu_map[i] = 0xff;
711
712 /*
686 * For primary GICs, skip over SGIs. 713 * For primary GICs, skip over SGIs.
687 * For secondary GICs, skip over PPIs, too. 714 * For secondary GICs, skip over PPIs, too.
688 */ 715 */
@@ -737,7 +764,7 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
737 764
738 /* Convert our logical CPU mask into a physical one. */ 765 /* Convert our logical CPU mask into a physical one. */
739 for_each_cpu(cpu, mask) 766 for_each_cpu(cpu, mask)
740 map |= 1 << cpu_logical_map(cpu); 767 map |= gic_cpu_map[cpu];
741 768
742 /* 769 /*
743 * Ensure that stores to Normal memory are visible to the 770 * Ensure that stores to Normal memory are visible to the
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index df13a3ffff35..9d2d3ba339ff 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -162,7 +162,6 @@ static struct clock_event_device sp804_clockevent = {
162 .set_mode = sp804_set_mode, 162 .set_mode = sp804_set_mode,
163 .set_next_event = sp804_set_next_event, 163 .set_next_event = sp804_set_next_event,
164 .rating = 300, 164 .rating = 300,
165 .cpumask = cpu_all_mask,
166}; 165};
167 166
168static struct irqaction sp804_timer_irq = { 167static struct irqaction sp804_timer_irq = {
@@ -185,6 +184,7 @@ void __init sp804_clockevents_init(void __iomem *base, unsigned int irq,
185 clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ); 184 clkevt_reload = DIV_ROUND_CLOSEST(rate, HZ);
186 evt->name = name; 185 evt->name = name;
187 evt->irq = irq; 186 evt->irq = irq;
187 evt->cpumask = cpu_possible_mask;
188 188
189 setup_irq(irq, &sp804_timer_irq); 189 setup_irq(irq, &sp804_timer_irq);
190 clockevents_config_and_register(evt, rate, 0xf, 0xffffffff); 190 clockevents_config_and_register(evt, rate, 0xf, 0xffffffff);
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index e0d538803cc3..e4df17ca90c7 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -218,7 +218,7 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
218 v->resume_sources = resume_sources; 218 v->resume_sources = resume_sources;
219 v->irq = irq; 219 v->irq = irq;
220 vic_id++; 220 vic_id++;
221 v->domain = irq_domain_add_legacy(node, fls(valid_sources), irq, 0, 221 v->domain = irq_domain_add_simple(node, fls(valid_sources), irq,
222 &vic_irqdomain_ops, v); 222 &vic_irqdomain_ops, v);
223} 223}
224 224
@@ -350,7 +350,7 @@ static void __init vic_init_st(void __iomem *base, unsigned int irq_start,
350 vic_register(base, irq_start, vic_sources, 0, node); 350 vic_register(base, irq_start, vic_sources, 0, node);
351} 351}
352 352
353void __init __vic_init(void __iomem *base, unsigned int irq_start, 353void __init __vic_init(void __iomem *base, int irq_start,
354 u32 vic_sources, u32 resume_sources, 354 u32 vic_sources, u32 resume_sources,
355 struct device_node *node) 355 struct device_node *node)
356{ 356{
@@ -407,7 +407,6 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
407int __init vic_of_init(struct device_node *node, struct device_node *parent) 407int __init vic_of_init(struct device_node *node, struct device_node *parent)
408{ 408{
409 void __iomem *regs; 409 void __iomem *regs;
410 int irq_base;
411 410
412 if (WARN(parent, "non-root VICs are not supported")) 411 if (WARN(parent, "non-root VICs are not supported"))
413 return -EINVAL; 412 return -EINVAL;
@@ -416,18 +415,12 @@ int __init vic_of_init(struct device_node *node, struct device_node *parent)
416 if (WARN_ON(!regs)) 415 if (WARN_ON(!regs))
417 return -EIO; 416 return -EIO;
418 417
419 irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id()); 418 /*
420 if (WARN_ON(irq_base < 0)) 419 * Passing -1 as first IRQ makes the simple domain allocate descriptors
421 goto out_unmap; 420 */
422 421 __vic_init(regs, -1, ~0, ~0, node);
423 __vic_init(regs, irq_base, ~0, ~0, node);
424 422
425 return 0; 423 return 0;
426
427 out_unmap:
428 iounmap(regs);
429
430 return -EIO;
431} 424}
432#endif /* CONFIG OF */ 425#endif /* CONFIG OF */
433 426
diff --git a/arch/arm/configs/at91_dt_defconfig b/arch/arm/configs/at91_dt_defconfig
index 67bc571ed0c3..b175577d7abb 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -111,6 +111,7 @@ CONFIG_I2C=y
111CONFIG_I2C_GPIO=y 111CONFIG_I2C_GPIO=y
112CONFIG_SPI=y 112CONFIG_SPI=y
113CONFIG_SPI_ATMEL=y 113CONFIG_SPI_ATMEL=y
114CONFIG_PINCTRL_AT91=y
114# CONFIG_HWMON is not set 115# CONFIG_HWMON is not set
115CONFIG_WATCHDOG=y 116CONFIG_WATCHDOG=y
116CONFIG_AT91SAM9X_WATCHDOG=y 117CONFIG_AT91SAM9X_WATCHDOG=y
diff --git a/arch/arm/configs/at91sam9260_defconfig b/arch/arm/configs/at91sam9260_defconfig
index 505b3765f87e..0ea5d2c97fc4 100644
--- a/arch/arm/configs/at91sam9260_defconfig
+++ b/arch/arm/configs/at91sam9260_defconfig
@@ -75,7 +75,7 @@ CONFIG_USB_STORAGE_DEBUG=y
75CONFIG_USB_GADGET=y 75CONFIG_USB_GADGET=y
76CONFIG_USB_ZERO=m 76CONFIG_USB_ZERO=m
77CONFIG_USB_GADGETFS=m 77CONFIG_USB_GADGETFS=m
78CONFIG_USB_FILE_STORAGE=m 78CONFIG_USB_MASS_STORAGE=m
79CONFIG_USB_G_SERIAL=m 79CONFIG_USB_G_SERIAL=m
80CONFIG_RTC_CLASS=y 80CONFIG_RTC_CLASS=y
81CONFIG_RTC_DRV_AT91SAM9=y 81CONFIG_RTC_DRV_AT91SAM9=y
diff --git a/arch/arm/configs/at91sam9261_defconfig b/arch/arm/configs/at91sam9261_defconfig
index 1e8712ef062e..c87beb973b37 100644
--- a/arch/arm/configs/at91sam9261_defconfig
+++ b/arch/arm/configs/at91sam9261_defconfig
@@ -125,7 +125,7 @@ CONFIG_USB_GADGET=y
125CONFIG_USB_ZERO=m 125CONFIG_USB_ZERO=m
126CONFIG_USB_ETH=m 126CONFIG_USB_ETH=m
127CONFIG_USB_GADGETFS=m 127CONFIG_USB_GADGETFS=m
128CONFIG_USB_FILE_STORAGE=m 128CONFIG_USB_MASS_STORAGE=m
129CONFIG_USB_G_SERIAL=m 129CONFIG_USB_G_SERIAL=m
130CONFIG_MMC=y 130CONFIG_MMC=y
131CONFIG_MMC_ATMELMCI=m 131CONFIG_MMC_ATMELMCI=m
diff --git a/arch/arm/configs/at91sam9263_defconfig b/arch/arm/configs/at91sam9263_defconfig
index d2050cada82d..c5212f43eee6 100644
--- a/arch/arm/configs/at91sam9263_defconfig
+++ b/arch/arm/configs/at91sam9263_defconfig
@@ -133,7 +133,7 @@ CONFIG_USB_GADGET=y
133CONFIG_USB_ZERO=m 133CONFIG_USB_ZERO=m
134CONFIG_USB_ETH=m 134CONFIG_USB_ETH=m
135CONFIG_USB_GADGETFS=m 135CONFIG_USB_GADGETFS=m
136CONFIG_USB_FILE_STORAGE=m 136CONFIG_USB_MASS_STORAGE=m
137CONFIG_USB_G_SERIAL=m 137CONFIG_USB_G_SERIAL=m
138CONFIG_MMC=y 138CONFIG_MMC=y
139CONFIG_SDIO_UART=m 139CONFIG_SDIO_UART=m
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig
index e1b0e80b54a5..3b1881033ad8 100644
--- a/arch/arm/configs/at91sam9g20_defconfig
+++ b/arch/arm/configs/at91sam9g20_defconfig
@@ -96,7 +96,7 @@ CONFIG_USB_STORAGE=y
96CONFIG_USB_GADGET=y 96CONFIG_USB_GADGET=y
97CONFIG_USB_ZERO=m 97CONFIG_USB_ZERO=m
98CONFIG_USB_GADGETFS=m 98CONFIG_USB_GADGETFS=m
99CONFIG_USB_FILE_STORAGE=m 99CONFIG_USB_MASS_STORAGE=m
100CONFIG_USB_G_SERIAL=m 100CONFIG_USB_G_SERIAL=m
101CONFIG_MMC=y 101CONFIG_MMC=y
102CONFIG_MMC_ATMELMCI=m 102CONFIG_MMC_ATMELMCI=m
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index 4b8a25d9e686..1fd1d1de3220 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -218,7 +218,7 @@ CONFIG_USB_GADGET=y
218CONFIG_USB_ZERO=m 218CONFIG_USB_ZERO=m
219CONFIG_USB_ETH=m 219CONFIG_USB_ETH=m
220CONFIG_USB_GADGETFS=m 220CONFIG_USB_GADGETFS=m
221CONFIG_USB_FILE_STORAGE=m 221CONFIG_USB_MASS_STORAGE=m
222CONFIG_USB_G_SERIAL=m 222CONFIG_USB_G_SERIAL=m
223CONFIG_MMC=y 223CONFIG_MMC=y
224CONFIG_MMC_PXA=y 224CONFIG_MMC_PXA=y
diff --git a/arch/arm/configs/davinci_all_defconfig b/arch/arm/configs/davinci_all_defconfig
index 67b5abb6f857..4ea7c95719d2 100644
--- a/arch/arm/configs/davinci_all_defconfig
+++ b/arch/arm/configs/davinci_all_defconfig
@@ -144,7 +144,7 @@ CONFIG_USB_GADGET_DEBUG_FS=y
144CONFIG_USB_ZERO=m 144CONFIG_USB_ZERO=m
145CONFIG_USB_ETH=m 145CONFIG_USB_ETH=m
146CONFIG_USB_GADGETFS=m 146CONFIG_USB_GADGETFS=m
147CONFIG_USB_FILE_STORAGE=m 147CONFIG_USB_MASS_STORAGE=m
148CONFIG_USB_G_SERIAL=m 148CONFIG_USB_G_SERIAL=m
149CONFIG_USB_G_PRINTER=m 149CONFIG_USB_G_PRINTER=m
150CONFIG_USB_CDC_COMPOSITE=m 150CONFIG_USB_CDC_COMPOSITE=m
diff --git a/arch/arm/configs/h7202_defconfig b/arch/arm/configs/h7202_defconfig
index 69405a762423..e16d3f372e2a 100644
--- a/arch/arm/configs/h7202_defconfig
+++ b/arch/arm/configs/h7202_defconfig
@@ -34,8 +34,7 @@ CONFIG_FB_MODE_HELPERS=y
34CONFIG_USB_GADGET=m 34CONFIG_USB_GADGET=m
35CONFIG_USB_ZERO=m 35CONFIG_USB_ZERO=m
36CONFIG_USB_GADGETFS=m 36CONFIG_USB_GADGETFS=m
37CONFIG_USB_FILE_STORAGE=m 37CONFIG_USB_MASS_STORAGE=m
38CONFIG_USB_FILE_STORAGE_TEST=y
39CONFIG_USB_G_SERIAL=m 38CONFIG_USB_G_SERIAL=m
40CONFIG_EXT2_FS=y 39CONFIG_EXT2_FS=y
41CONFIG_TMPFS=y 40CONFIG_TMPFS=y
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig
index a691ef4c6008..557dd291288b 100644
--- a/arch/arm/configs/magician_defconfig
+++ b/arch/arm/configs/magician_defconfig
@@ -136,7 +136,7 @@ CONFIG_USB_PXA27X=y
136CONFIG_USB_ETH=m 136CONFIG_USB_ETH=m
137# CONFIG_USB_ETH_RNDIS is not set 137# CONFIG_USB_ETH_RNDIS is not set
138CONFIG_USB_GADGETFS=m 138CONFIG_USB_GADGETFS=m
139CONFIG_USB_FILE_STORAGE=m 139CONFIG_USB_MASS_STORAGE=m
140CONFIG_USB_G_SERIAL=m 140CONFIG_USB_G_SERIAL=m
141CONFIG_USB_CDC_COMPOSITE=m 141CONFIG_USB_CDC_COMPOSITE=m
142CONFIG_USB_GPIO_VBUS=y 142CONFIG_USB_GPIO_VBUS=y
diff --git a/arch/arm/configs/mini2440_defconfig b/arch/arm/configs/mini2440_defconfig
index 00630e6af45c..a07948a87caa 100644
--- a/arch/arm/configs/mini2440_defconfig
+++ b/arch/arm/configs/mini2440_defconfig
@@ -240,7 +240,7 @@ CONFIG_USB_GADGET_S3C2410=y
240CONFIG_USB_ZERO=m 240CONFIG_USB_ZERO=m
241CONFIG_USB_ETH=m 241CONFIG_USB_ETH=m
242CONFIG_USB_GADGETFS=m 242CONFIG_USB_GADGETFS=m
243CONFIG_USB_FILE_STORAGE=m 243CONFIG_USB_MASS_STORAGE=m
244CONFIG_USB_G_SERIAL=m 244CONFIG_USB_G_SERIAL=m
245CONFIG_USB_CDC_COMPOSITE=m 245CONFIG_USB_CDC_COMPOSITE=m
246CONFIG_MMC=y 246CONFIG_MMC=y
diff --git a/arch/arm/configs/omap1_defconfig b/arch/arm/configs/omap1_defconfig
index dde2a1af7b39..42eab9a2a0fd 100644
--- a/arch/arm/configs/omap1_defconfig
+++ b/arch/arm/configs/omap1_defconfig
@@ -214,8 +214,7 @@ CONFIG_USB_TEST=y
214CONFIG_USB_GADGET=y 214CONFIG_USB_GADGET=y
215CONFIG_USB_ETH=m 215CONFIG_USB_ETH=m
216# CONFIG_USB_ETH_RNDIS is not set 216# CONFIG_USB_ETH_RNDIS is not set
217CONFIG_USB_FILE_STORAGE=m 217CONFIG_USB_MASS_STORAGE=m
218CONFIG_USB_FILE_STORAGE_TEST=y
219CONFIG_MMC=y 218CONFIG_MMC=y
220CONFIG_MMC_SDHCI=y 219CONFIG_MMC_SDHCI=y
221CONFIG_MMC_SDHCI_PLTFM=y 220CONFIG_MMC_SDHCI_PLTFM=y
diff --git a/arch/arm/configs/prima2_defconfig b/arch/arm/configs/prima2_defconfig
index 807d4e2acb17..6a936c7c078a 100644
--- a/arch/arm/configs/prima2_defconfig
+++ b/arch/arm/configs/prima2_defconfig
@@ -37,7 +37,6 @@ CONFIG_SPI_SIRF=y
37CONFIG_SPI_SPIDEV=y 37CONFIG_SPI_SPIDEV=y
38# CONFIG_HWMON is not set 38# CONFIG_HWMON is not set
39CONFIG_USB_GADGET=y 39CONFIG_USB_GADGET=y
40CONFIG_USB_FILE_STORAGE=m
41CONFIG_USB_MASS_STORAGE=m 40CONFIG_USB_MASS_STORAGE=m
42CONFIG_MMC=y 41CONFIG_MMC=y
43CONFIG_MMC_SDHCI=y 42CONFIG_MMC_SDHCI=y
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index df77931a4326..2e0419d1b964 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -214,7 +214,7 @@ CONFIG_USB_GADGET_DUMMY_HCD=y
214CONFIG_USB_ZERO=m 214CONFIG_USB_ZERO=m
215CONFIG_USB_ETH=m 215CONFIG_USB_ETH=m
216CONFIG_USB_GADGETFS=m 216CONFIG_USB_GADGETFS=m
217CONFIG_USB_FILE_STORAGE=m 217CONFIG_USB_MASS_STORAGE=m
218CONFIG_USB_G_SERIAL=m 218CONFIG_USB_G_SERIAL=m
219CONFIG_MMC=y 219CONFIG_MMC=y
220CONFIG_MMC_PXA=y 220CONFIG_MMC_PXA=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index da6845493caa..250625d5223f 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -69,6 +69,8 @@ CONFIG_GPIO_TC3589X=y
69CONFIG_POWER_SUPPLY=y 69CONFIG_POWER_SUPPLY=y
70CONFIG_AB8500_BM=y 70CONFIG_AB8500_BM=y
71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y 71CONFIG_AB8500_BATTERY_THERM_ON_BATCTRL=y
72CONFIG_THERMAL=y
73CONFIG_CPU_THERMAL=y
72CONFIG_MFD_STMPE=y 74CONFIG_MFD_STMPE=y
73CONFIG_MFD_TC3589X=y 75CONFIG_MFD_TC3589X=y
74CONFIG_AB5500_CORE=y 76CONFIG_AB5500_CORE=y
diff --git a/arch/arm/configs/viper_defconfig b/arch/arm/configs/viper_defconfig
index 1d01ddd33122..d36e0d3c86ec 100644
--- a/arch/arm/configs/viper_defconfig
+++ b/arch/arm/configs/viper_defconfig
@@ -139,7 +139,7 @@ CONFIG_USB_SERIAL_MCT_U232=m
139CONFIG_USB_GADGET=m 139CONFIG_USB_GADGET=m
140CONFIG_USB_ETH=m 140CONFIG_USB_ETH=m
141CONFIG_USB_GADGETFS=m 141CONFIG_USB_GADGETFS=m
142CONFIG_USB_FILE_STORAGE=m 142CONFIG_USB_MASS_STORAGE=m
143CONFIG_USB_G_SERIAL=m 143CONFIG_USB_G_SERIAL=m
144CONFIG_USB_G_PRINTER=m 144CONFIG_USB_G_PRINTER=m
145CONFIG_RTC_CLASS=y 145CONFIG_RTC_CLASS=y
diff --git a/arch/arm/configs/zeus_defconfig b/arch/arm/configs/zeus_defconfig
index 547a3c1e59db..731d4f985310 100644
--- a/arch/arm/configs/zeus_defconfig
+++ b/arch/arm/configs/zeus_defconfig
@@ -143,7 +143,7 @@ CONFIG_USB_GADGET=m
143CONFIG_USB_PXA27X=y 143CONFIG_USB_PXA27X=y
144CONFIG_USB_ETH=m 144CONFIG_USB_ETH=m
145CONFIG_USB_GADGETFS=m 145CONFIG_USB_GADGETFS=m
146CONFIG_USB_FILE_STORAGE=m 146CONFIG_USB_MASS_STORAGE=m
147CONFIG_USB_G_SERIAL=m 147CONFIG_USB_G_SERIAL=m
148CONFIG_USB_G_PRINTER=m 148CONFIG_USB_G_PRINTER=m
149CONFIG_MMC=y 149CONFIG_MMC=y
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index f70ae175a3d6..d3db39860b9c 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -16,7 +16,6 @@ generic-y += local64.h
16generic-y += msgbuf.h 16generic-y += msgbuf.h
17generic-y += param.h 17generic-y += param.h
18generic-y += parport.h 18generic-y += parport.h
19generic-y += percpu.h
20generic-y += poll.h 19generic-y += poll.h
21generic-y += resource.h 20generic-y += resource.h
22generic-y += sections.h 21generic-y += sections.h
@@ -31,5 +30,6 @@ generic-y += sockios.h
31generic-y += termbits.h 30generic-y += termbits.h
32generic-y += termios.h 31generic-y += termios.h
33generic-y += timex.h 32generic-y += timex.h
33generic-y += trace_clock.h
34generic-y += types.h 34generic-y += types.h
35generic-y += unaligned.h 35generic-y += unaligned.h
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 2ef95813fce0..eb87200aa4b5 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -250,6 +250,7 @@
250 * Beware, it also clobers LR. 250 * Beware, it also clobers LR.
251 */ 251 */
252.macro safe_svcmode_maskall reg:req 252.macro safe_svcmode_maskall reg:req
253#if __LINUX_ARM_ARCH__ >= 6
253 mrs \reg , cpsr 254 mrs \reg , cpsr
254 mov lr , \reg 255 mov lr , \reg
255 and lr , lr , #MODE_MASK 256 and lr , lr , #MODE_MASK
@@ -266,6 +267,13 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
266 __ERET 267 __ERET
2671: msr cpsr_c, \reg 2681: msr cpsr_c, \reg
2682: 2692:
270#else
271/*
272 * workaround for possibly broken pre-v6 hardware
273 * (akita, Sharp Zaurus C-1000, PXA270-based)
274 */
275 setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, \reg
276#endif
269.endm 277.endm
270 278
271/* 279/*
diff --git a/arch/arm/include/asm/cpu.h b/arch/arm/include/asm/cpu.h
index d797223b39d5..2744f0602550 100644
--- a/arch/arm/include/asm/cpu.h
+++ b/arch/arm/include/asm/cpu.h
@@ -15,6 +15,7 @@
15 15
16struct cpuinfo_arm { 16struct cpuinfo_arm {
17 struct cpu cpu; 17 struct cpu cpu;
18 u32 cpuid;
18#ifdef CONFIG_SMP 19#ifdef CONFIG_SMP
19 unsigned int loops_per_jiffy; 20 unsigned int loops_per_jiffy;
20#endif 21#endif
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index cb47d28cbe1f..a59dcb5ab5fc 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -25,6 +25,19 @@
25#define CPUID_EXT_ISAR4 "c2, 4" 25#define CPUID_EXT_ISAR4 "c2, 4"
26#define CPUID_EXT_ISAR5 "c2, 5" 26#define CPUID_EXT_ISAR5 "c2, 5"
27 27
28#define MPIDR_SMP_BITMASK (0x3 << 30)
29#define MPIDR_SMP_VALUE (0x2 << 30)
30
31#define MPIDR_MT_BITMASK (0x1 << 24)
32
33#define MPIDR_HWID_BITMASK 0xFFFFFF
34
35#define MPIDR_LEVEL_BITS 8
36#define MPIDR_LEVEL_MASK ((1 << MPIDR_LEVEL_BITS) - 1)
37
38#define MPIDR_AFFINITY_LEVEL(mpidr, level) \
39 ((mpidr >> (MPIDR_LEVEL_BITS * level)) & MPIDR_LEVEL_MASK)
40
28extern unsigned int processor_id; 41extern unsigned int processor_id;
29 42
30#ifdef CONFIG_CPU_CP15 43#ifdef CONFIG_CPU_CP15
diff --git a/arch/arm/include/asm/cti.h b/arch/arm/include/asm/cti.h
index a0ada3ea4358..f2e5cad3f306 100644
--- a/arch/arm/include/asm/cti.h
+++ b/arch/arm/include/asm/cti.h
@@ -146,15 +146,7 @@ static inline void cti_irq_ack(struct cti *cti)
146 */ 146 */
147static inline void cti_unlock(struct cti *cti) 147static inline void cti_unlock(struct cti *cti)
148{ 148{
149 void __iomem *base = cti->base; 149 __raw_writel(LOCKCODE, cti->base + LOCKACCESS);
150 unsigned long val;
151
152 val = __raw_readl(base + LOCKSTATUS);
153
154 if (val & 1) {
155 val = LOCKCODE;
156 __raw_writel(val, base + LOCKACCESS);
157 }
158} 150}
159 151
160/** 152/**
@@ -166,14 +158,6 @@ static inline void cti_unlock(struct cti *cti)
166 */ 158 */
167static inline void cti_lock(struct cti *cti) 159static inline void cti_lock(struct cti *cti)
168{ 160{
169 void __iomem *base = cti->base; 161 __raw_writel(~LOCKCODE, cti->base + LOCKACCESS);
170 unsigned long val;
171
172 val = __raw_readl(base + LOCKSTATUS);
173
174 if (!(val & 1)) {
175 val = ~LOCKCODE;
176 __raw_writel(val, base + LOCKACCESS);
177 }
178} 162}
179#endif 163#endif
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index c4c87bc12231..3b2c40b5bfa2 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -102,6 +102,10 @@
102 102
103#define L2X0_ADDR_FILTER_EN 1 103#define L2X0_ADDR_FILTER_EN 1
104 104
105#define L2X0_CTRL_EN 1
106
107#define L2X0_WAY_SIZE_SHIFT 3
108
105#ifndef __ASSEMBLY__ 109#ifndef __ASSEMBLY__
106extern void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask); 110extern void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask);
107#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF) 111#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF)
@@ -126,6 +130,7 @@ struct l2x0_regs {
126 unsigned long filter_end; 130 unsigned long filter_end;
127 unsigned long prefetch_ctrl; 131 unsigned long prefetch_ctrl;
128 unsigned long pwr_ctrl; 132 unsigned long pwr_ctrl;
133 unsigned long ctrl;
129}; 134};
130 135
131extern struct l2x0_regs l2x0_saved_regs; 136extern struct l2x0_regs l2x0_saved_regs;
diff --git a/arch/arm/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h
index 6b9b077d86b3..afd7e916472f 100644
--- a/arch/arm/include/asm/hardware/sp810.h
+++ b/arch/arm/include/asm/hardware/sp810.h
@@ -56,6 +56,8 @@
56#define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17) 56#define SCCTRL_TIMEREN1SEL_REFCLK (0 << 17)
57#define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17) 57#define SCCTRL_TIMEREN1SEL_TIMCLK (1 << 17)
58 58
59#define SCCTRL_TIMERENnSEL_SHIFT(n) (15 + ((n) * 2))
60
59static inline void sysctl_soft_reset(void __iomem *base) 61static inline void sysctl_soft_reset(void __iomem *base)
60{ 62{
61 /* switch to slow mode */ 63 /* switch to slow mode */
diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h
index e14af1a1a320..2bebad36fc83 100644
--- a/arch/arm/include/asm/hardware/vic.h
+++ b/arch/arm/include/asm/hardware/vic.h
@@ -47,7 +47,7 @@
47struct device_node; 47struct device_node;
48struct pt_regs; 48struct pt_regs;
49 49
50void __vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, 50void __vic_init(void __iomem *base, int irq_start, u32 vic_sources,
51 u32 resume_sources, struct device_node *node); 51 u32 resume_sources, struct device_node *node);
52void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); 52void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
53int vic_of_init(struct device_node *node, struct device_node *parent); 53int vic_of_init(struct device_node *node, struct device_node *parent);
diff --git a/arch/arm/include/asm/hw_breakpoint.h b/arch/arm/include/asm/hw_breakpoint.h
index c190bc992f0e..01169dd723f1 100644
--- a/arch/arm/include/asm/hw_breakpoint.h
+++ b/arch/arm/include/asm/hw_breakpoint.h
@@ -98,12 +98,12 @@ static inline void decode_ctrl_reg(u32 reg,
98#define ARM_BASE_WCR 112 98#define ARM_BASE_WCR 112
99 99
100/* Accessor macros for the debug registers. */ 100/* Accessor macros for the debug registers. */
101#define ARM_DBG_READ(M, OP2, VAL) do {\ 101#define ARM_DBG_READ(N, M, OP2, VAL) do {\
102 asm volatile("mrc p14, 0, %0, c0," #M ", " #OP2 : "=r" (VAL));\ 102 asm volatile("mrc p14, 0, %0, " #N "," #M ", " #OP2 : "=r" (VAL));\
103} while (0) 103} while (0)
104 104
105#define ARM_DBG_WRITE(M, OP2, VAL) do {\ 105#define ARM_DBG_WRITE(N, M, OP2, VAL) do {\
106 asm volatile("mcr p14, 0, %0, c0," #M ", " #OP2 : : "r" (VAL));\ 106 asm volatile("mcr p14, 0, %0, " #N "," #M ", " #OP2 : : "r" (VAL));\
107} while (0) 107} while (0)
108 108
109struct notifier_block; 109struct notifier_block;
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 35c1ed89b936..652b56086de7 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -64,7 +64,7 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
64static inline void __raw_writew(u16 val, volatile void __iomem *addr) 64static inline void __raw_writew(u16 val, volatile void __iomem *addr)
65{ 65{
66 asm volatile("strh %1, %0" 66 asm volatile("strh %1, %0"
67 : "+Qo" (*(volatile u16 __force *)addr) 67 : "+Q" (*(volatile u16 __force *)addr)
68 : "r" (val)); 68 : "r" (val));
69} 69}
70 70
@@ -72,7 +72,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr)
72{ 72{
73 u16 val; 73 u16 val;
74 asm volatile("ldrh %1, %0" 74 asm volatile("ldrh %1, %0"
75 : "+Qo" (*(volatile u16 __force *)addr), 75 : "+Q" (*(volatile u16 __force *)addr),
76 "=r" (val)); 76 "=r" (val));
77 return val; 77 return val;
78} 78}
@@ -374,7 +374,7 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
374 374
375#ifdef CONFIG_MMU 375#ifdef CONFIG_MMU
376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE 376#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
377extern int valid_phys_addr_range(unsigned long addr, size_t size); 377extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
378extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size); 378extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
379extern int devmem_is_allowed(unsigned long pfn); 379extern int devmem_is_allowed(unsigned long pfn);
380#endif 380#endif
diff --git a/arch/arm/include/asm/mach/serial_at91.h b/arch/arm/include/asm/mach/serial_at91.h
deleted file mode 100644
index ea6d063923b8..000000000000
--- a/arch/arm/include/asm/mach/serial_at91.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/include/asm/mach/serial_at91.h
3 *
4 * Based on serial_sa1100.h by Nicolas Pitre
5 *
6 * Copyright (C) 2002 ATMEL Rousset
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12
13/*
14 * This is a temporary structure for registering these
15 * functions; it is intended to be discarded after boot.
16 */
17struct atmel_port_fns {
18 void (*set_mctrl)(struct uart_port *, u_int);
19 u_int (*get_mctrl)(struct uart_port *);
20 void (*enable_ms)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23 int (*open)(struct uart_port *);
24 void (*close)(struct uart_port *);
25};
26
27#if defined(CONFIG_SERIAL_ATMEL)
28void atmel_register_uart_fns(struct atmel_port_fns *fns);
29#else
30#define atmel_register_uart_fns(fns) do { } while (0)
31#endif
32
33
diff --git a/arch/arm/include/asm/mach/serial_sa1100.h b/arch/arm/include/asm/mach/serial_sa1100.h
deleted file mode 100644
index d09064bf95a0..000000000000
--- a/arch/arm/include/asm/mach/serial_sa1100.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/arm/include/asm/mach/serial_sa1100.h
3 *
4 * Author: Nicolas Pitre
5 *
6 * Moved and changed lots, Russell King
7 *
8 * Low level machine dependent UART functions.
9 */
10
11struct uart_port;
12struct uart_info;
13
14/*
15 * This is a temporary structure for registering these
16 * functions; it is intended to be discarded after boot.
17 */
18struct sa1100_port_fns {
19 void (*set_mctrl)(struct uart_port *, u_int);
20 u_int (*get_mctrl)(struct uart_port *);
21 void (*pm)(struct uart_port *, u_int, u_int);
22 int (*set_wake)(struct uart_port *, u_int);
23};
24
25#ifdef CONFIG_SERIAL_SA1100
26void sa1100_register_uart_fns(struct sa1100_port_fns *fns);
27void sa1100_register_uart(int idx, int port);
28#else
29#define sa1100_register_uart_fns(fns) do { } while (0)
30#define sa1100_register_uart(idx,port) do { } while (0)
31#endif
diff --git a/arch/arm/include/asm/mach/udc_pxa2xx.h b/arch/arm/include/asm/mach/udc_pxa2xx.h
deleted file mode 100644
index ea297ac70bc6..000000000000
--- a/arch/arm/include/asm/mach/udc_pxa2xx.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/include/asm/mach/udc_pxa2xx.h
3 *
4 * This supports machine-specific differences in how the PXA2xx
5 * USB Device Controller (UDC) is wired.
6 *
7 * It is set in linux/arch/arm/mach-pxa/<machine>.c or in
8 * linux/arch/mach-ixp4xx/<machine>.c and used in
9 * the probe routine of linux/drivers/usb/gadget/pxa2xx_udc.c
10 */
11
12struct pxa2xx_udc_mach_info {
13 int (*udc_is_connected)(void); /* do we see host? */
14 void (*udc_command)(int cmd);
15#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
16#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
17
18 /* Boards following the design guidelines in the developer's manual,
19 * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
20 * VBUS IRQ and omit the methods above. Store the GPIO number
21 * here. Note that sometimes the signals go through inverters...
22 */
23 bool gpio_pullup_inverted;
24 int gpio_pullup; /* high == pullup activated */
25};
26
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 14965658a923..9f77e7804f3b 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -5,18 +5,15 @@
5 5
6typedef struct { 6typedef struct {
7#ifdef CONFIG_CPU_HAS_ASID 7#ifdef CONFIG_CPU_HAS_ASID
8 unsigned int id; 8 u64 id;
9 raw_spinlock_t id_lock;
10#endif 9#endif
11 unsigned int kvm_seq; 10 unsigned int vmalloc_seq;
12} mm_context_t; 11} mm_context_t;
13 12
14#ifdef CONFIG_CPU_HAS_ASID 13#ifdef CONFIG_CPU_HAS_ASID
15#define ASID(mm) ((mm)->context.id & 255) 14#define ASID_BITS 8
16 15#define ASID_MASK ((~0ULL) << ASID_BITS)
17/* init_mm.context.id_lock should be initialized. */ 16#define ASID(mm) ((mm)->context.id & ~ASID_MASK)
18#define INIT_MM_CONTEXT(name) \
19 .context.id_lock = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
20#else 17#else
21#define ASID(mm) (0) 18#define ASID(mm) (0)
22#endif 19#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 0306bc642c0d..e1f644bc7cc5 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -20,88 +20,12 @@
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm-generic/mm_hooks.h> 21#include <asm-generic/mm_hooks.h>
22 22
23void __check_kvm_seq(struct mm_struct *mm); 23void __check_vmalloc_seq(struct mm_struct *mm);
24 24
25#ifdef CONFIG_CPU_HAS_ASID 25#ifdef CONFIG_CPU_HAS_ASID
26 26
27/* 27void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
28 * On ARMv6, we have the following structure in the Context ID: 28#define init_new_context(tsk,mm) ({ mm->context.id = 0; })
29 *
30 * 31 7 0
31 * +-------------------------+-----------+
32 * | process ID | ASID |
33 * +-------------------------+-----------+
34 * | context ID |
35 * +-------------------------------------+
36 *
37 * The ASID is used to tag entries in the CPU caches and TLBs.
38 * The context ID is used by debuggers and trace logic, and
39 * should be unique within all running processes.
40 */
41#define ASID_BITS 8
42#define ASID_MASK ((~0) << ASID_BITS)
43#define ASID_FIRST_VERSION (1 << ASID_BITS)
44
45extern unsigned int cpu_last_asid;
46
47void __init_new_context(struct task_struct *tsk, struct mm_struct *mm);
48void __new_context(struct mm_struct *mm);
49void cpu_set_reserved_ttbr0(void);
50
51static inline void switch_new_context(struct mm_struct *mm)
52{
53 unsigned long flags;
54
55 __new_context(mm);
56
57 local_irq_save(flags);
58 cpu_switch_mm(mm->pgd, mm);
59 local_irq_restore(flags);
60}
61
62static inline void check_and_switch_context(struct mm_struct *mm,
63 struct task_struct *tsk)
64{
65 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq))
66 __check_kvm_seq(mm);
67
68 /*
69 * Required during context switch to avoid speculative page table
70 * walking with the wrong TTBR.
71 */
72 cpu_set_reserved_ttbr0();
73
74 if (!((mm->context.id ^ cpu_last_asid) >> ASID_BITS))
75 /*
76 * The ASID is from the current generation, just switch to the
77 * new pgd. This condition is only true for calls from
78 * context_switch() and interrupts are already disabled.
79 */
80 cpu_switch_mm(mm->pgd, mm);
81 else if (irqs_disabled())
82 /*
83 * Defer the new ASID allocation until after the context
84 * switch critical region since __new_context() cannot be
85 * called with interrupts disabled (it sends IPIs).
86 */
87 set_ti_thread_flag(task_thread_info(tsk), TIF_SWITCH_MM);
88 else
89 /*
90 * That is a direct call to switch_mm() or activate_mm() with
91 * interrupts enabled and a new context.
92 */
93 switch_new_context(mm);
94}
95
96#define init_new_context(tsk,mm) (__init_new_context(tsk,mm),0)
97
98#define finish_arch_post_lock_switch \
99 finish_arch_post_lock_switch
100static inline void finish_arch_post_lock_switch(void)
101{
102 if (test_and_clear_thread_flag(TIF_SWITCH_MM))
103 switch_new_context(current->mm);
104}
105 29
106#else /* !CONFIG_CPU_HAS_ASID */ 30#else /* !CONFIG_CPU_HAS_ASID */
107 31
@@ -110,8 +34,8 @@ static inline void finish_arch_post_lock_switch(void)
110static inline void check_and_switch_context(struct mm_struct *mm, 34static inline void check_and_switch_context(struct mm_struct *mm,
111 struct task_struct *tsk) 35 struct task_struct *tsk)
112{ 36{
113 if (unlikely(mm->context.kvm_seq != init_mm.context.kvm_seq)) 37 if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
114 __check_kvm_seq(mm); 38 __check_vmalloc_seq(mm);
115 39
116 if (irqs_disabled()) 40 if (irqs_disabled())
117 /* 41 /*
@@ -143,6 +67,7 @@ static inline void finish_arch_post_lock_switch(void)
143#endif /* CONFIG_CPU_HAS_ASID */ 67#endif /* CONFIG_CPU_HAS_ASID */
144 68
145#define destroy_context(mm) do { } while(0) 69#define destroy_context(mm) do { } while(0)
70#define activate_mm(prev,next) switch_mm(prev, next, NULL)
146 71
147/* 72/*
148 * This is called when "tsk" is about to enter lazy TLB mode. 73 * This is called when "tsk" is about to enter lazy TLB mode.
@@ -186,6 +111,5 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
186} 111}
187 112
188#define deactivate_mm(tsk,mm) do { } while (0) 113#define deactivate_mm(tsk,mm) do { } while (0)
189#define activate_mm(prev,next) switch_mm(prev, next, NULL)
190 114
191#endif 115#endif
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h
new file mode 100644
index 000000000000..968c0a14e0a3
--- /dev/null
+++ b/arch/arm/include/asm/percpu.h
@@ -0,0 +1,45 @@
1/*
2 * Copyright 2012 Calxeda, Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#ifndef _ASM_ARM_PERCPU_H_
17#define _ASM_ARM_PERCPU_H_
18
19/*
20 * Same as asm-generic/percpu.h, except that we store the per cpu offset
21 * in the TPIDRPRW. TPIDRPRW only exists on V6K and V7
22 */
23#if defined(CONFIG_SMP) && !defined(CONFIG_CPU_V6)
24static inline void set_my_cpu_offset(unsigned long off)
25{
26 /* Set TPIDRPRW */
27 asm volatile("mcr p15, 0, %0, c13, c0, 4" : : "r" (off) : "memory");
28}
29
30static inline unsigned long __my_cpu_offset(void)
31{
32 unsigned long off;
33 /* Read TPIDRPRW */
34 asm("mrc p15, 0, %0, c13, c0, 4" : "=r" (off) : : "memory");
35 return off;
36}
37#define __my_cpu_offset __my_cpu_offset()
38#else
39#define set_my_cpu_offset(x) do {} while(0)
40
41#endif /* CONFIG_SMP */
42
43#include <asm-generic/percpu.h>
44
45#endif /* _ASM_ARM_PERCPU_H_ */
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index 625cd621a436..755877527cf9 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -21,4 +21,11 @@
21#define C(_x) PERF_COUNT_HW_CACHE_##_x 21#define C(_x) PERF_COUNT_HW_CACHE_##_x
22#define CACHE_OP_UNSUPPORTED 0xFFFF 22#define CACHE_OP_UNSUPPORTED 0xFFFF
23 23
24#ifdef CONFIG_HW_PERF_EVENTS
25struct pt_regs;
26extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
27extern unsigned long perf_misc_flags(struct pt_regs *regs);
28#define perf_misc_flags(regs) perf_misc_flags(regs)
29#endif
30
24#endif /* __ARM_PERF_EVENT_H__ */ 31#endif /* __ARM_PERF_EVENT_H__ */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
index 2317a71c8f8e..f97ee02386ee 100644
--- a/arch/arm/include/asm/pgtable-2level.h
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -115,6 +115,7 @@
115 * The PTE table pointer refers to the hardware entries; the "Linux" 115 * The PTE table pointer refers to the hardware entries; the "Linux"
116 * entries are stored 1024 bytes below. 116 * entries are stored 1024 bytes below.
117 */ 117 */
118#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
118#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0) 119#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
119#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1) 120#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
120#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ 121#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
@@ -123,6 +124,7 @@
123#define L_PTE_USER (_AT(pteval_t, 1) << 8) 124#define L_PTE_USER (_AT(pteval_t, 1) << 8)
124#define L_PTE_XN (_AT(pteval_t, 1) << 9) 125#define L_PTE_XN (_AT(pteval_t, 1) << 9)
125#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */ 126#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
127#define L_PTE_NONE (_AT(pteval_t, 1) << 11)
126 128
127/* 129/*
128 * These are the memory types, defined to be compatible with 130 * These are the memory types, defined to be compatible with
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index b24903549d1c..a3f37929940a 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -67,7 +67,8 @@
67 * These bits overlap with the hardware bits but the naming is preserved for 67 * These bits overlap with the hardware bits but the naming is preserved for
68 * consistency with the classic page table format. 68 * consistency with the classic page table format.
69 */ 69 */
70#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Valid */ 70#define L_PTE_VALID (_AT(pteval_t, 1) << 0) /* Valid */
71#define L_PTE_PRESENT (_AT(pteval_t, 3) << 0) /* Present */
71#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */ 72#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
72#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */ 73#define L_PTE_USER (_AT(pteval_t, 1) << 6) /* AP[1] */
73#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */ 74#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
@@ -76,6 +77,7 @@
76#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */ 77#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */
77#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55) /* unused */ 78#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55) /* unused */
78#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */ 79#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */
80#define L_PTE_NONE (_AT(pteval_t, 1) << 57) /* PROT_NONE */
79 81
80/* 82/*
81 * To be used in assembly code with the upper page attributes. 83 * To be used in assembly code with the upper page attributes.
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 08c12312a1f9..9c82f988c0e3 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -73,7 +73,7 @@ extern pgprot_t pgprot_kernel;
73 73
74#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b)) 74#define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
75 75
76#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY) 76#define PAGE_NONE _MOD_PROT(pgprot_user, L_PTE_XN | L_PTE_RDONLY | L_PTE_NONE)
77#define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN) 77#define PAGE_SHARED _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_XN)
78#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER) 78#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_user, L_PTE_USER)
79#define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) 79#define PAGE_COPY _MOD_PROT(pgprot_user, L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
@@ -83,7 +83,7 @@ extern pgprot_t pgprot_kernel;
83#define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN) 83#define PAGE_KERNEL _MOD_PROT(pgprot_kernel, L_PTE_XN)
84#define PAGE_KERNEL_EXEC pgprot_kernel 84#define PAGE_KERNEL_EXEC pgprot_kernel
85 85
86#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN) 86#define __PAGE_NONE __pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN | L_PTE_NONE)
87#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN) 87#define __PAGE_SHARED __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
88#define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER) 88#define __PAGE_SHARED_EXEC __pgprot(_L_PTE_DEFAULT | L_PTE_USER)
89#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN) 89#define __PAGE_COPY __pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_RDONLY | L_PTE_XN)
@@ -203,9 +203,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
203#define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN)) 203#define pte_exec(pte) (!(pte_val(pte) & L_PTE_XN))
204#define pte_special(pte) (0) 204#define pte_special(pte) (0)
205 205
206#define pte_present_user(pte) \ 206#define pte_present_user(pte) (pte_present(pte) && (pte_val(pte) & L_PTE_USER))
207 ((pte_val(pte) & (L_PTE_PRESENT | L_PTE_USER)) == \
208 (L_PTE_PRESENT | L_PTE_USER))
209 207
210#if __LINUX_ARM_ARCH__ < 6 208#if __LINUX_ARM_ARCH__ < 6
211static inline void __sync_icache_dcache(pte_t pteval) 209static inline void __sync_icache_dcache(pte_t pteval)
@@ -242,7 +240,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
242 240
243static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 241static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
244{ 242{
245 const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER; 243 const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER | L_PTE_NONE;
246 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); 244 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
247 return pte; 245 return pte;
248} 246}
diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h
index a26170dce02e..f24edad26c70 100644
--- a/arch/arm/include/asm/pmu.h
+++ b/arch/arm/include/asm/pmu.h
@@ -67,19 +67,19 @@ struct arm_pmu {
67 cpumask_t active_irqs; 67 cpumask_t active_irqs;
68 char *name; 68 char *name;
69 irqreturn_t (*handle_irq)(int irq_num, void *dev); 69 irqreturn_t (*handle_irq)(int irq_num, void *dev);
70 void (*enable)(struct hw_perf_event *evt, int idx); 70 void (*enable)(struct perf_event *event);
71 void (*disable)(struct hw_perf_event *evt, int idx); 71 void (*disable)(struct perf_event *event);
72 int (*get_event_idx)(struct pmu_hw_events *hw_events, 72 int (*get_event_idx)(struct pmu_hw_events *hw_events,
73 struct hw_perf_event *hwc); 73 struct perf_event *event);
74 int (*set_event_filter)(struct hw_perf_event *evt, 74 int (*set_event_filter)(struct hw_perf_event *evt,
75 struct perf_event_attr *attr); 75 struct perf_event_attr *attr);
76 u32 (*read_counter)(int idx); 76 u32 (*read_counter)(struct perf_event *event);
77 void (*write_counter)(int idx, u32 val); 77 void (*write_counter)(struct perf_event *event, u32 val);
78 void (*start)(void); 78 void (*start)(struct arm_pmu *);
79 void (*stop)(void); 79 void (*stop)(struct arm_pmu *);
80 void (*reset)(void *); 80 void (*reset)(void *);
81 int (*request_irq)(irq_handler_t handler); 81 int (*request_irq)(struct arm_pmu *, irq_handler_t handler);
82 void (*free_irq)(void); 82 void (*free_irq)(struct arm_pmu *);
83 int (*map_event)(struct perf_event *event); 83 int (*map_event)(struct perf_event *event);
84 int num_events; 84 int num_events;
85 atomic_t active_events; 85 atomic_t active_events;
@@ -93,15 +93,11 @@ struct arm_pmu {
93 93
94extern const struct dev_pm_ops armpmu_dev_pm_ops; 94extern const struct dev_pm_ops armpmu_dev_pm_ops;
95 95
96int armpmu_register(struct arm_pmu *armpmu, char *name, int type); 96int armpmu_register(struct arm_pmu *armpmu, int type);
97 97
98u64 armpmu_event_update(struct perf_event *event, 98u64 armpmu_event_update(struct perf_event *event);
99 struct hw_perf_event *hwc,
100 int idx);
101 99
102int armpmu_event_set_period(struct perf_event *event, 100int armpmu_event_set_period(struct perf_event *event);
103 struct hw_perf_event *hwc,
104 int idx);
105 101
106int armpmu_map_event(struct perf_event *event, 102int armpmu_map_event(struct perf_event *event,
107 const unsigned (*event_map)[PERF_COUNT_HW_MAX], 103 const unsigned (*event_map)[PERF_COUNT_HW_MAX],
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index aeae9c609df4..a219227c3e43 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -11,10 +11,13 @@
11#ifndef __ASMARM_PROM_H 11#ifndef __ASMARM_PROM_H
12#define __ASMARM_PROM_H 12#define __ASMARM_PROM_H
13 13
14#define HAVE_ARCH_DEVTREE_FIXUPS
15
14#ifdef CONFIG_OF 16#ifdef CONFIG_OF
15 17
16extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 18extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
17extern void arm_dt_memblock_reserve(void); 19extern void arm_dt_memblock_reserve(void);
20extern void __init arm_dt_init_cpu_maps(void);
18 21
19#else /* CONFIG_OF */ 22#else /* CONFIG_OF */
20 23
@@ -24,6 +27,7 @@ static inline struct machine_desc *setup_machine_fdt(unsigned int dt_phys)
24} 27}
25 28
26static inline void arm_dt_memblock_reserve(void) { } 29static inline void arm_dt_memblock_reserve(void) { }
30static inline void arm_dt_init_cpu_maps(void) { }
27 31
28#endif /* CONFIG_OF */ 32#endif /* CONFIG_OF */
29#endif /* ASMARM_PROM_H */ 33#endif /* ASMARM_PROM_H */
diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h
index 05b8e82ec9f5..e3f757263438 100644
--- a/arch/arm/include/asm/sched_clock.h
+++ b/arch/arm/include/asm/sched_clock.h
@@ -10,7 +10,5 @@
10 10
11extern void sched_clock_postinit(void); 11extern void sched_clock_postinit(void);
12extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); 12extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
13extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
14 unsigned long rate);
15 13
16#endif 14#endif
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 2e3be16c6766..d3a22bebe6ce 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -79,6 +79,7 @@ extern void cpu_die(void);
79 79
80extern void arch_send_call_function_single_ipi(int cpu); 80extern void arch_send_call_function_single_ipi(int cpu);
81extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 81extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
82extern void arch_send_wakeup_ipi_mask(const struct cpumask *mask);
82 83
83struct smp_operations { 84struct smp_operations {
84#ifdef CONFIG_SMP 85#ifdef CONFIG_SMP
diff --git a/arch/arm/include/asm/smp_plat.h b/arch/arm/include/asm/smp_plat.h
index 558d6c80aca9..aaa61b6f50ff 100644
--- a/arch/arm/include/asm/smp_plat.h
+++ b/arch/arm/include/asm/smp_plat.h
@@ -5,6 +5,9 @@
5#ifndef __ASMARM_SMP_PLAT_H 5#ifndef __ASMARM_SMP_PLAT_H
6#define __ASMARM_SMP_PLAT_H 6#define __ASMARM_SMP_PLAT_H
7 7
8#include <linux/cpumask.h>
9#include <linux/err.h>
10
8#include <asm/cputype.h> 11#include <asm/cputype.h>
9 12
10/* 13/*
@@ -48,5 +51,19 @@ static inline int cache_ops_need_broadcast(void)
48 */ 51 */
49extern int __cpu_logical_map[]; 52extern int __cpu_logical_map[];
50#define cpu_logical_map(cpu) __cpu_logical_map[cpu] 53#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
54/*
55 * Retrieve logical cpu index corresponding to a given MPIDR[23:0]
56 * - mpidr: MPIDR[23:0] to be used for the look-up
57 *
58 * Returns the cpu logical index or -EINVAL on look-up error
59 */
60static inline int get_logical_index(u32 mpidr)
61{
62 int cpu;
63 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
64 if (cpu_logical_map(cpu) == mpidr)
65 return cpu;
66 return -EINVAL;
67}
51 68
52#endif 69#endif
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index 9fdded6b1089..f1d96d4e8092 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -7,6 +7,8 @@
7#ifndef _ASM_ARM_SYSCALL_H 7#ifndef _ASM_ARM_SYSCALL_H
8#define _ASM_ARM_SYSCALL_H 8#define _ASM_ARM_SYSCALL_H
9 9
10#include <linux/audit.h> /* for AUDIT_ARCH_* */
11#include <linux/elf.h> /* for ELF_EM */
10#include <linux/err.h> 12#include <linux/err.h>
11#include <linux/sched.h> 13#include <linux/sched.h>
12 14
@@ -95,4 +97,11 @@ static inline void syscall_set_arguments(struct task_struct *task,
95 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0])); 97 memcpy(&regs->ARM_r0 + i, args, n * sizeof(args[0]));
96} 98}
97 99
100static inline int syscall_get_arch(struct task_struct *task,
101 struct pt_regs *regs)
102{
103 /* ARM tasks don't change audit architectures on the fly. */
104 return AUDIT_ARCH_ARM;
105}
106
98#endif /* _ASM_ARM_SYSCALL_H */ 107#endif /* _ASM_ARM_SYSCALL_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index 8477b4c1d39f..cddda1f41f0f 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -151,10 +151,10 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
151#define TIF_SYSCALL_TRACE 8 151#define TIF_SYSCALL_TRACE 8
152#define TIF_SYSCALL_AUDIT 9 152#define TIF_SYSCALL_AUDIT 9
153#define TIF_SYSCALL_TRACEPOINT 10 153#define TIF_SYSCALL_TRACEPOINT 10
154#define TIF_SECCOMP 11 /* seccomp syscall filtering active */
154#define TIF_USING_IWMMXT 17 155#define TIF_USING_IWMMXT 17
155#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 156#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
156#define TIF_RESTORE_SIGMASK 20 157#define TIF_RESTORE_SIGMASK 20
157#define TIF_SECCOMP 21
158#define TIF_SWITCH_MM 22 /* deferred switch_mm */ 158#define TIF_SWITCH_MM 22 /* deferred switch_mm */
159 159
160#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 160#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
@@ -163,11 +163,12 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
163#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 163#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
164#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 164#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
165#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 165#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
166#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
167#define _TIF_SECCOMP (1 << TIF_SECCOMP) 166#define _TIF_SECCOMP (1 << TIF_SECCOMP)
167#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
168 168
169/* Checks for any syscall work in entry-common.S */ 169/* Checks for any syscall work in entry-common.S */
170#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT) 170#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
171 _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP)
171 172
172/* 173/*
173 * Change these and you break ASM code in entry-common.S 174 * Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
index 6a6f1e485f41..301c1db3e99b 100644
--- a/arch/arm/include/asm/vfpmacros.h
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -27,9 +27,9 @@
27#if __LINUX_ARM_ARCH__ <= 6 27#if __LINUX_ARM_ARCH__ <= 6
28 ldr \tmp, =elf_hwcap @ may not have MVFR regs 28 ldr \tmp, =elf_hwcap @ may not have MVFR regs
29 ldr \tmp, [\tmp, #0] 29 ldr \tmp, [\tmp, #0]
30 tst \tmp, #HWCAP_VFPv3D16 30 tst \tmp, #HWCAP_VFPD32
31 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} 31 ldcnel p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
32 addne \base, \base, #32*4 @ step over unused register space 32 addeq \base, \base, #32*4 @ step over unused register space
33#else 33#else
34 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 34 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
35 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field 35 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
@@ -51,9 +51,9 @@
51#if __LINUX_ARM_ARCH__ <= 6 51#if __LINUX_ARM_ARCH__ <= 6
52 ldr \tmp, =elf_hwcap @ may not have MVFR regs 52 ldr \tmp, =elf_hwcap @ may not have MVFR regs
53 ldr \tmp, [\tmp, #0] 53 ldr \tmp, [\tmp, #0]
54 tst \tmp, #HWCAP_VFPv3D16 54 tst \tmp, #HWCAP_VFPD32
55 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} 55 stcnel p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
56 addne \base, \base, #32*4 @ step over unused register space 56 addeq \base, \base, #32*4 @ step over unused register space
57#else 57#else
58 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 58 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
59 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field 59 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
diff --git a/arch/arm/include/debug/vexpress.S b/arch/arm/include/debug/vexpress.S
index 9f509f55d078..dc8e882a6257 100644
--- a/arch/arm/include/debug/vexpress.S
+++ b/arch/arm/include/debug/vexpress.S
@@ -21,14 +21,17 @@
21#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT) 21#if defined(CONFIG_DEBUG_VEXPRESS_UART0_DETECT)
22 22
23 .macro addruart,rp,rv,tmp 23 .macro addruart,rp,rv,tmp
24 .arch armv7-a
24 25
25 @ Make an educated guess regarding the memory map: 26 @ Make an educated guess regarding the memory map:
26 @ - the original A9 core tile, which has MPCore peripherals 27 @ - the original A9 core tile (based on ARM Cortex-A9 r0p1)
27 @ located at 0x1e000000, should use UART at 0x10009000 28 @ should use UART at 0x10009000
28 @ - all other (RS1 complaint) tiles use UART mapped 29 @ - all other (RS1 complaint) tiles use UART mapped
29 @ at 0x1c090000 30 @ at 0x1c090000
30 mrc p15, 4, \tmp, c15, c0, 0 31 mrc p15, 0, \rp, c0, c0, 0
31 cmp \tmp, #0x1e000000 32 movw \rv, #0xc091
33 movt \rv, #0x410f
34 cmp \rp, \rv
32 35
33 @ Original memory map 36 @ Original memory map
34 moveq \rp, #DEBUG_LL_UART_OFFSET 37 moveq \rp, #DEBUG_LL_UART_OFFSET
diff --git a/arch/arm/include/uapi/asm/hwcap.h b/arch/arm/include/uapi/asm/hwcap.h
index f254f6503cce..3688fd15a32d 100644
--- a/arch/arm/include/uapi/asm/hwcap.h
+++ b/arch/arm/include/uapi/asm/hwcap.h
@@ -18,11 +18,12 @@
18#define HWCAP_THUMBEE (1 << 11) 18#define HWCAP_THUMBEE (1 << 11)
19#define HWCAP_NEON (1 << 12) 19#define HWCAP_NEON (1 << 12)
20#define HWCAP_VFPv3 (1 << 13) 20#define HWCAP_VFPv3 (1 << 13)
21#define HWCAP_VFPv3D16 (1 << 14) 21#define HWCAP_VFPv3D16 (1 << 14) /* also set for VFPv4-D16 */
22#define HWCAP_TLS (1 << 15) 22#define HWCAP_TLS (1 << 15)
23#define HWCAP_VFPv4 (1 << 16) 23#define HWCAP_VFPv4 (1 << 16)
24#define HWCAP_IDIVA (1 << 17) 24#define HWCAP_IDIVA (1 << 17)
25#define HWCAP_IDIVT (1 << 18) 25#define HWCAP_IDIVT (1 << 18)
26#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */
26#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) 27#define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
27 28
28 29
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index bee7f9d47f02..70f1bdeb241b 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -19,8 +19,10 @@
19#include <linux/of_irq.h> 19#include <linux/of_irq.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21 21
22#include <asm/cputype.h>
22#include <asm/setup.h> 23#include <asm/setup.h>
23#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/smp_plat.h>
24#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
25#include <asm/mach-types.h> 27#include <asm/mach-types.h>
26 28
@@ -61,6 +63,108 @@ void __init arm_dt_memblock_reserve(void)
61 } 63 }
62} 64}
63 65
66/*
67 * arm_dt_init_cpu_maps - Function retrieves cpu nodes from the device tree
68 * and builds the cpu logical map array containing MPIDR values related to
69 * logical cpus
70 *
71 * Updates the cpu possible mask with the number of parsed cpu nodes
72 */
73void __init arm_dt_init_cpu_maps(void)
74{
75 /*
76 * Temp logical map is initialized with UINT_MAX values that are
77 * considered invalid logical map entries since the logical map must
78 * contain a list of MPIDR[23:0] values where MPIDR[31:24] must
79 * read as 0.
80 */
81 struct device_node *cpu, *cpus;
82 u32 i, j, cpuidx = 1;
83 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
84
85 u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = UINT_MAX };
86 bool bootcpu_valid = false;
87 cpus = of_find_node_by_path("/cpus");
88
89 if (!cpus)
90 return;
91
92 for_each_child_of_node(cpus, cpu) {
93 u32 hwid;
94
95 pr_debug(" * %s...\n", cpu->full_name);
96 /*
97 * A device tree containing CPU nodes with missing "reg"
98 * properties is considered invalid to build the
99 * cpu_logical_map.
100 */
101 if (of_property_read_u32(cpu, "reg", &hwid)) {
102 pr_debug(" * %s missing reg property\n",
103 cpu->full_name);
104 return;
105 }
106
107 /*
108 * 8 MSBs must be set to 0 in the DT since the reg property
109 * defines the MPIDR[23:0].
110 */
111 if (hwid & ~MPIDR_HWID_BITMASK)
112 return;
113
114 /*
115 * Duplicate MPIDRs are a recipe for disaster.
116 * Scan all initialized entries and check for
117 * duplicates. If any is found just bail out.
118 * temp values were initialized to UINT_MAX
119 * to avoid matching valid MPIDR[23:0] values.
120 */
121 for (j = 0; j < cpuidx; j++)
122 if (WARN(tmp_map[j] == hwid, "Duplicate /cpu reg "
123 "properties in the DT\n"))
124 return;
125
126 /*
127 * Build a stashed array of MPIDR values. Numbering scheme
128 * requires that if detected the boot CPU must be assigned
129 * logical id 0. Other CPUs get sequential indexes starting
130 * from 1. If a CPU node with a reg property matching the
131 * boot CPU MPIDR is detected, this is recorded so that the
132 * logical map built from DT is validated and can be used
133 * to override the map created in smp_setup_processor_id().
134 */
135 if (hwid == mpidr) {
136 i = 0;
137 bootcpu_valid = true;
138 } else {
139 i = cpuidx++;
140 }
141
142 if (WARN(cpuidx > nr_cpu_ids, "DT /cpu %u nodes greater than "
143 "max cores %u, capping them\n",
144 cpuidx, nr_cpu_ids)) {
145 cpuidx = nr_cpu_ids;
146 break;
147 }
148
149 tmp_map[i] = hwid;
150 }
151
152 if (WARN(!bootcpu_valid, "DT missing boot CPU MPIDR[23:0], "
153 "fall back to default cpu_logical_map\n"))
154 return;
155
156 /*
157 * Since the boot CPU node contains proper data, and all nodes have
158 * a reg property, the DT CPU list can be considered valid and the
159 * logical map created in smp_setup_processor_id() can be overridden
160 */
161 for (i = 0; i < cpuidx; i++) {
162 set_cpu_possible(i, true);
163 cpu_logical_map(i) = tmp_map[i];
164 pr_debug("cpu logical map 0x%x\n", cpu_logical_map(i));
165 }
166}
167
64/** 168/**
65 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 169 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
66 * @dt_phys: physical address of dt blob 170 * @dt_phys: physical address of dt blob
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 34711757ba59..804153c0a9cf 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -417,16 +417,6 @@ local_restart:
417 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing 417 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
418 stmdb sp!, {r4, r5} @ push fifth and sixth args 418 stmdb sp!, {r4, r5} @ push fifth and sixth args
419 419
420#ifdef CONFIG_SECCOMP
421 tst r10, #_TIF_SECCOMP
422 beq 1f
423 mov r0, scno
424 bl __secure_computing
425 add r0, sp, #S_R0 + S_OFF @ pointer to regs
426 ldmia r0, {r0 - r3} @ have to reload r0 - r3
4271:
428#endif
429
430 tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls? 420 tst r10, #_TIF_SYSCALL_WORK @ are we tracing syscalls?
431 bne __sys_trace 421 bne __sys_trace
432 422
@@ -458,11 +448,13 @@ __sys_trace:
458 ldmccia r1, {r0 - r6} @ have to reload r0 - r6 448 ldmccia r1, {r0 - r6} @ have to reload r0 - r6
459 stmccia sp, {r4, r5} @ and update the stack args 449 stmccia sp, {r4, r5} @ and update the stack args
460 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine 450 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
461 b 2b 451 cmp scno, #-1 @ skip the syscall?
452 bne 2b
453 add sp, sp, #S_OFF @ restore stack
454 b ret_slow_syscall
462 455
463__sys_trace_return: 456__sys_trace_return:
464 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 457 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
465 mov r1, scno
466 mov r0, sp 458 mov r0, sp
467 bl syscall_trace_exit 459 bl syscall_trace_exit
468 b ret_slow_syscall 460 b ret_slow_syscall
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index 278cfc144f44..2c228a07e58c 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -68,7 +68,7 @@ __after_proc_init:
68 * CP15 system control register value returned in r0 from 68 * CP15 system control register value returned in r0 from
69 * the CPU init function. 69 * the CPU init function.
70 */ 70 */
71#ifdef CONFIG_ALIGNMENT_TRAP 71#if defined(CONFIG_ALIGNMENT_TRAP) && __LINUX_ARM_ARCH__ < 6
72 orr r0, r0, #CR_A 72 orr r0, r0, #CR_A
73#else 73#else
74 bic r0, r0, #CR_A 74 bic r0, r0, #CR_A
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 281bf3301241..5ff2e77782b1 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -52,14 +52,14 @@ static u8 debug_arch;
52/* Maximum supported watchpoint length. */ 52/* Maximum supported watchpoint length. */
53static u8 max_watchpoint_len; 53static u8 max_watchpoint_len;
54 54
55#define READ_WB_REG_CASE(OP2, M, VAL) \ 55#define READ_WB_REG_CASE(OP2, M, VAL) \
56 case ((OP2 << 4) + M): \ 56 case ((OP2 << 4) + M): \
57 ARM_DBG_READ(c ## M, OP2, VAL); \ 57 ARM_DBG_READ(c0, c ## M, OP2, VAL); \
58 break 58 break
59 59
60#define WRITE_WB_REG_CASE(OP2, M, VAL) \ 60#define WRITE_WB_REG_CASE(OP2, M, VAL) \
61 case ((OP2 << 4) + M): \ 61 case ((OP2 << 4) + M): \
62 ARM_DBG_WRITE(c ## M, OP2, VAL);\ 62 ARM_DBG_WRITE(c0, c ## M, OP2, VAL); \
63 break 63 break
64 64
65#define GEN_READ_WB_REG_CASES(OP2, VAL) \ 65#define GEN_READ_WB_REG_CASES(OP2, VAL) \
@@ -136,12 +136,12 @@ static u8 get_debug_arch(void)
136 136
137 /* Do we implement the extended CPUID interface? */ 137 /* Do we implement the extended CPUID interface? */
138 if (((read_cpuid_id() >> 16) & 0xf) != 0xf) { 138 if (((read_cpuid_id() >> 16) & 0xf) != 0xf) {
139 pr_warning("CPUID feature registers not supported. " 139 pr_warn_once("CPUID feature registers not supported. "
140 "Assuming v6 debug is present.\n"); 140 "Assuming v6 debug is present.\n");
141 return ARM_DEBUG_ARCH_V6; 141 return ARM_DEBUG_ARCH_V6;
142 } 142 }
143 143
144 ARM_DBG_READ(c0, 0, didr); 144 ARM_DBG_READ(c0, c0, 0, didr);
145 return (didr >> 16) & 0xf; 145 return (didr >> 16) & 0xf;
146} 146}
147 147
@@ -169,7 +169,7 @@ static int debug_exception_updates_fsr(void)
169static int get_num_wrp_resources(void) 169static int get_num_wrp_resources(void)
170{ 170{
171 u32 didr; 171 u32 didr;
172 ARM_DBG_READ(c0, 0, didr); 172 ARM_DBG_READ(c0, c0, 0, didr);
173 return ((didr >> 28) & 0xf) + 1; 173 return ((didr >> 28) & 0xf) + 1;
174} 174}
175 175
@@ -177,7 +177,7 @@ static int get_num_wrp_resources(void)
177static int get_num_brp_resources(void) 177static int get_num_brp_resources(void)
178{ 178{
179 u32 didr; 179 u32 didr;
180 ARM_DBG_READ(c0, 0, didr); 180 ARM_DBG_READ(c0, c0, 0, didr);
181 return ((didr >> 24) & 0xf) + 1; 181 return ((didr >> 24) & 0xf) + 1;
182} 182}
183 183
@@ -228,19 +228,17 @@ static int get_num_brps(void)
228 * be put into halting debug mode at any time by an external debugger 228 * be put into halting debug mode at any time by an external debugger
229 * but there is nothing we can do to prevent that. 229 * but there is nothing we can do to prevent that.
230 */ 230 */
231static int enable_monitor_mode(void) 231static int monitor_mode_enabled(void)
232{ 232{
233 u32 dscr; 233 u32 dscr;
234 int ret = 0; 234 ARM_DBG_READ(c0, c1, 0, dscr);
235 235 return !!(dscr & ARM_DSCR_MDBGEN);
236 ARM_DBG_READ(c1, 0, dscr); 236}
237 237
238 /* Ensure that halting mode is disabled. */ 238static int enable_monitor_mode(void)
239 if (WARN_ONCE(dscr & ARM_DSCR_HDBGEN, 239{
240 "halting debug mode enabled. Unable to access hardware resources.\n")) { 240 u32 dscr;
241 ret = -EPERM; 241 ARM_DBG_READ(c0, c1, 0, dscr);
242 goto out;
243 }
244 242
245 /* If monitor mode is already enabled, just return. */ 243 /* If monitor mode is already enabled, just return. */
246 if (dscr & ARM_DSCR_MDBGEN) 244 if (dscr & ARM_DSCR_MDBGEN)
@@ -250,24 +248,27 @@ static int enable_monitor_mode(void)
250 switch (get_debug_arch()) { 248 switch (get_debug_arch()) {
251 case ARM_DEBUG_ARCH_V6: 249 case ARM_DEBUG_ARCH_V6:
252 case ARM_DEBUG_ARCH_V6_1: 250 case ARM_DEBUG_ARCH_V6_1:
253 ARM_DBG_WRITE(c1, 0, (dscr | ARM_DSCR_MDBGEN)); 251 ARM_DBG_WRITE(c0, c1, 0, (dscr | ARM_DSCR_MDBGEN));
254 break; 252 break;
255 case ARM_DEBUG_ARCH_V7_ECP14: 253 case ARM_DEBUG_ARCH_V7_ECP14:
256 case ARM_DEBUG_ARCH_V7_1: 254 case ARM_DEBUG_ARCH_V7_1:
257 ARM_DBG_WRITE(c2, 2, (dscr | ARM_DSCR_MDBGEN)); 255 ARM_DBG_WRITE(c0, c2, 2, (dscr | ARM_DSCR_MDBGEN));
256 isb();
258 break; 257 break;
259 default: 258 default:
260 ret = -ENODEV; 259 return -ENODEV;
261 goto out;
262 } 260 }
263 261
264 /* Check that the write made it through. */ 262 /* Check that the write made it through. */
265 ARM_DBG_READ(c1, 0, dscr); 263 ARM_DBG_READ(c0, c1, 0, dscr);
266 if (!(dscr & ARM_DSCR_MDBGEN)) 264 if (!(dscr & ARM_DSCR_MDBGEN)) {
267 ret = -EPERM; 265 pr_warn_once("Failed to enable monitor mode on CPU %d.\n",
266 smp_processor_id());
267 return -EPERM;
268 }
268 269
269out: 270out:
270 return ret; 271 return 0;
271} 272}
272 273
273int hw_breakpoint_slots(int type) 274int hw_breakpoint_slots(int type)
@@ -328,14 +329,9 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
328{ 329{
329 struct arch_hw_breakpoint *info = counter_arch_bp(bp); 330 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
330 struct perf_event **slot, **slots; 331 struct perf_event **slot, **slots;
331 int i, max_slots, ctrl_base, val_base, ret = 0; 332 int i, max_slots, ctrl_base, val_base;
332 u32 addr, ctrl; 333 u32 addr, ctrl;
333 334
334 /* Ensure that we are in monitor mode and halting mode is disabled. */
335 ret = enable_monitor_mode();
336 if (ret)
337 goto out;
338
339 addr = info->address; 335 addr = info->address;
340 ctrl = encode_ctrl_reg(info->ctrl) | 0x1; 336 ctrl = encode_ctrl_reg(info->ctrl) | 0x1;
341 337
@@ -362,9 +358,9 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
362 } 358 }
363 } 359 }
364 360
365 if (WARN_ONCE(i == max_slots, "Can't find any breakpoint slot\n")) { 361 if (i == max_slots) {
366 ret = -EBUSY; 362 pr_warning("Can't find any breakpoint slot\n");
367 goto out; 363 return -EBUSY;
368 } 364 }
369 365
370 /* Override the breakpoint data with the step data. */ 366 /* Override the breakpoint data with the step data. */
@@ -383,9 +379,7 @@ int arch_install_hw_breakpoint(struct perf_event *bp)
383 379
384 /* Setup the control register. */ 380 /* Setup the control register. */
385 write_wb_reg(ctrl_base + i, ctrl); 381 write_wb_reg(ctrl_base + i, ctrl);
386 382 return 0;
387out:
388 return ret;
389} 383}
390 384
391void arch_uninstall_hw_breakpoint(struct perf_event *bp) 385void arch_uninstall_hw_breakpoint(struct perf_event *bp)
@@ -416,8 +410,10 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp)
416 } 410 }
417 } 411 }
418 412
419 if (WARN_ONCE(i == max_slots, "Can't find any breakpoint slot\n")) 413 if (i == max_slots) {
414 pr_warning("Can't find any breakpoint slot\n");
420 return; 415 return;
416 }
421 417
422 /* Ensure that we disable the mismatch breakpoint. */ 418 /* Ensure that we disable the mismatch breakpoint. */
423 if (info->ctrl.type != ARM_BREAKPOINT_EXECUTE && 419 if (info->ctrl.type != ARM_BREAKPOINT_EXECUTE &&
@@ -596,6 +592,10 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
596 int ret = 0; 592 int ret = 0;
597 u32 offset, alignment_mask = 0x3; 593 u32 offset, alignment_mask = 0x3;
598 594
595 /* Ensure that we are in monitor debug mode. */
596 if (!monitor_mode_enabled())
597 return -ENODEV;
598
599 /* Build the arch_hw_breakpoint. */ 599 /* Build the arch_hw_breakpoint. */
600 ret = arch_build_bp_info(bp); 600 ret = arch_build_bp_info(bp);
601 if (ret) 601 if (ret)
@@ -858,7 +858,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
858 local_irq_enable(); 858 local_irq_enable();
859 859
860 /* We only handle watchpoints and hardware breakpoints. */ 860 /* We only handle watchpoints and hardware breakpoints. */
861 ARM_DBG_READ(c1, 0, dscr); 861 ARM_DBG_READ(c0, c1, 0, dscr);
862 862
863 /* Perform perf callbacks. */ 863 /* Perform perf callbacks. */
864 switch (ARM_DSCR_MOE(dscr)) { 864 switch (ARM_DSCR_MOE(dscr)) {
@@ -906,7 +906,7 @@ static struct undef_hook debug_reg_hook = {
906static void reset_ctrl_regs(void *unused) 906static void reset_ctrl_regs(void *unused)
907{ 907{
908 int i, raw_num_brps, err = 0, cpu = smp_processor_id(); 908 int i, raw_num_brps, err = 0, cpu = smp_processor_id();
909 u32 dbg_power; 909 u32 val;
910 910
911 /* 911 /*
912 * v7 debug contains save and restore registers so that debug state 912 * v7 debug contains save and restore registers so that debug state
@@ -919,23 +919,30 @@ static void reset_ctrl_regs(void *unused)
919 switch (debug_arch) { 919 switch (debug_arch) {
920 case ARM_DEBUG_ARCH_V6: 920 case ARM_DEBUG_ARCH_V6:
921 case ARM_DEBUG_ARCH_V6_1: 921 case ARM_DEBUG_ARCH_V6_1:
922 /* ARMv6 cores just need to reset the registers. */ 922 /* ARMv6 cores clear the registers out of reset. */
923 goto reset_regs; 923 goto out_mdbgen;
924 case ARM_DEBUG_ARCH_V7_ECP14: 924 case ARM_DEBUG_ARCH_V7_ECP14:
925 /* 925 /*
926 * Ensure sticky power-down is clear (i.e. debug logic is 926 * Ensure sticky power-down is clear (i.e. debug logic is
927 * powered up). 927 * powered up).
928 */ 928 */
929 asm volatile("mrc p14, 0, %0, c1, c5, 4" : "=r" (dbg_power)); 929 ARM_DBG_READ(c1, c5, 4, val);
930 if ((dbg_power & 0x1) == 0) 930 if ((val & 0x1) == 0)
931 err = -EPERM; 931 err = -EPERM;
932
933 /*
934 * Check whether we implement OS save and restore.
935 */
936 ARM_DBG_READ(c1, c1, 4, val);
937 if ((val & 0x9) == 0)
938 goto clear_vcr;
932 break; 939 break;
933 case ARM_DEBUG_ARCH_V7_1: 940 case ARM_DEBUG_ARCH_V7_1:
934 /* 941 /*
935 * Ensure the OS double lock is clear. 942 * Ensure the OS double lock is clear.
936 */ 943 */
937 asm volatile("mrc p14, 0, %0, c1, c3, 4" : "=r" (dbg_power)); 944 ARM_DBG_READ(c1, c3, 4, val);
938 if ((dbg_power & 0x1) == 1) 945 if ((val & 0x1) == 1)
939 err = -EPERM; 946 err = -EPERM;
940 break; 947 break;
941 } 948 }
@@ -947,24 +954,29 @@ static void reset_ctrl_regs(void *unused)
947 } 954 }
948 955
949 /* 956 /*
950 * Unconditionally clear the lock by writing a value 957 * Unconditionally clear the OS lock by writing a value
951 * other than 0xC5ACCE55 to the access register. 958 * other than 0xC5ACCE55 to the access register.
952 */ 959 */
953 asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0)); 960 ARM_DBG_WRITE(c1, c0, 4, 0);
954 isb(); 961 isb();
955 962
956 /* 963 /*
957 * Clear any configured vector-catch events before 964 * Clear any configured vector-catch events before
958 * enabling monitor mode. 965 * enabling monitor mode.
959 */ 966 */
960 asm volatile("mcr p14, 0, %0, c0, c7, 0" : : "r" (0)); 967clear_vcr:
968 ARM_DBG_WRITE(c0, c7, 0, 0);
961 isb(); 969 isb();
962 970
963reset_regs: 971 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
964 if (enable_monitor_mode()) 972 pr_warning("CPU %d failed to disable vector catch\n", cpu);
965 return; 973 return;
974 }
966 975
967 /* We must also reset any reserved registers. */ 976 /*
977 * The control/value register pairs are UNKNOWN out of reset so
978 * clear them to avoid spurious debug events.
979 */
968 raw_num_brps = get_num_brp_resources(); 980 raw_num_brps = get_num_brp_resources();
969 for (i = 0; i < raw_num_brps; ++i) { 981 for (i = 0; i < raw_num_brps; ++i) {
970 write_wb_reg(ARM_BASE_BCR + i, 0UL); 982 write_wb_reg(ARM_BASE_BCR + i, 0UL);
@@ -975,6 +987,19 @@ reset_regs:
975 write_wb_reg(ARM_BASE_WCR + i, 0UL); 987 write_wb_reg(ARM_BASE_WCR + i, 0UL);
976 write_wb_reg(ARM_BASE_WVR + i, 0UL); 988 write_wb_reg(ARM_BASE_WVR + i, 0UL);
977 } 989 }
990
991 if (cpumask_intersects(&debug_err_mask, cpumask_of(cpu))) {
992 pr_warning("CPU %d failed to clear debug register pairs\n", cpu);
993 return;
994 }
995
996 /*
997 * Have a crack at enabling monitor mode. We don't actually need
998 * it yet, but reporting an error early is useful if it fails.
999 */
1000out_mdbgen:
1001 if (enable_monitor_mode())
1002 cpumask_or(&debug_err_mask, &debug_err_mask, cpumask_of(cpu));
978} 1003}
979 1004
980static int __cpuinit dbg_reset_notify(struct notifier_block *self, 1005static int __cpuinit dbg_reset_notify(struct notifier_block *self,
@@ -992,8 +1017,6 @@ static struct notifier_block __cpuinitdata dbg_reset_nb = {
992 1017
993static int __init arch_hw_breakpoint_init(void) 1018static int __init arch_hw_breakpoint_init(void)
994{ 1019{
995 u32 dscr;
996
997 debug_arch = get_debug_arch(); 1020 debug_arch = get_debug_arch();
998 1021
999 if (!debug_arch_supported()) { 1022 if (!debug_arch_supported()) {
@@ -1028,17 +1051,10 @@ static int __init arch_hw_breakpoint_init(void)
1028 core_num_brps, core_has_mismatch_brps() ? "(+1 reserved) " : 1051 core_num_brps, core_has_mismatch_brps() ? "(+1 reserved) " :
1029 "", core_num_wrps); 1052 "", core_num_wrps);
1030 1053
1031 ARM_DBG_READ(c1, 0, dscr); 1054 /* Work out the maximum supported watchpoint length. */
1032 if (dscr & ARM_DSCR_HDBGEN) { 1055 max_watchpoint_len = get_max_wp_len();
1033 max_watchpoint_len = 4; 1056 pr_info("maximum watchpoint size is %u bytes.\n",
1034 pr_warning("halting debug mode enabled. Assuming maximum watchpoint size of %u bytes.\n", 1057 max_watchpoint_len);
1035 max_watchpoint_len);
1036 } else {
1037 /* Work out the maximum supported watchpoint length. */
1038 max_watchpoint_len = get_max_wp_len();
1039 pr_info("maximum watchpoint size is %u bytes.\n",
1040 max_watchpoint_len);
1041 }
1042 1058
1043 /* Register debug fault handler. */ 1059 /* Register debug fault handler. */
1044 hook_fault_code(FAULT_CODE_DEBUG, hw_breakpoint_pending, SIGTRAP, 1060 hook_fault_code(FAULT_CODE_DEBUG, hw_breakpoint_pending, SIGTRAP,
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 53c0304b734a..f9e8657dd241 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -86,12 +86,10 @@ armpmu_map_event(struct perf_event *event,
86 return -ENOENT; 86 return -ENOENT;
87} 87}
88 88
89int 89int armpmu_event_set_period(struct perf_event *event)
90armpmu_event_set_period(struct perf_event *event,
91 struct hw_perf_event *hwc,
92 int idx)
93{ 90{
94 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 91 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
92 struct hw_perf_event *hwc = &event->hw;
95 s64 left = local64_read(&hwc->period_left); 93 s64 left = local64_read(&hwc->period_left);
96 s64 period = hwc->sample_period; 94 s64 period = hwc->sample_period;
97 int ret = 0; 95 int ret = 0;
@@ -119,24 +117,22 @@ armpmu_event_set_period(struct perf_event *event,
119 117
120 local64_set(&hwc->prev_count, (u64)-left); 118 local64_set(&hwc->prev_count, (u64)-left);
121 119
122 armpmu->write_counter(idx, (u64)(-left) & 0xffffffff); 120 armpmu->write_counter(event, (u64)(-left) & 0xffffffff);
123 121
124 perf_event_update_userpage(event); 122 perf_event_update_userpage(event);
125 123
126 return ret; 124 return ret;
127} 125}
128 126
129u64 127u64 armpmu_event_update(struct perf_event *event)
130armpmu_event_update(struct perf_event *event,
131 struct hw_perf_event *hwc,
132 int idx)
133{ 128{
134 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 129 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
130 struct hw_perf_event *hwc = &event->hw;
135 u64 delta, prev_raw_count, new_raw_count; 131 u64 delta, prev_raw_count, new_raw_count;
136 132
137again: 133again:
138 prev_raw_count = local64_read(&hwc->prev_count); 134 prev_raw_count = local64_read(&hwc->prev_count);
139 new_raw_count = armpmu->read_counter(idx); 135 new_raw_count = armpmu->read_counter(event);
140 136
141 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, 137 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
142 new_raw_count) != prev_raw_count) 138 new_raw_count) != prev_raw_count)
@@ -159,7 +155,7 @@ armpmu_read(struct perf_event *event)
159 if (hwc->idx < 0) 155 if (hwc->idx < 0)
160 return; 156 return;
161 157
162 armpmu_event_update(event, hwc, hwc->idx); 158 armpmu_event_update(event);
163} 159}
164 160
165static void 161static void
@@ -173,14 +169,13 @@ armpmu_stop(struct perf_event *event, int flags)
173 * PERF_EF_UPDATE, see comments in armpmu_start(). 169 * PERF_EF_UPDATE, see comments in armpmu_start().
174 */ 170 */
175 if (!(hwc->state & PERF_HES_STOPPED)) { 171 if (!(hwc->state & PERF_HES_STOPPED)) {
176 armpmu->disable(hwc, hwc->idx); 172 armpmu->disable(event);
177 armpmu_event_update(event, hwc, hwc->idx); 173 armpmu_event_update(event);
178 hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE; 174 hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE;
179 } 175 }
180} 176}
181 177
182static void 178static void armpmu_start(struct perf_event *event, int flags)
183armpmu_start(struct perf_event *event, int flags)
184{ 179{
185 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 180 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
186 struct hw_perf_event *hwc = &event->hw; 181 struct hw_perf_event *hwc = &event->hw;
@@ -200,8 +195,8 @@ armpmu_start(struct perf_event *event, int flags)
200 * get an interrupt too soon or *way* too late if the overflow has 195 * get an interrupt too soon or *way* too late if the overflow has
201 * happened since disabling. 196 * happened since disabling.
202 */ 197 */
203 armpmu_event_set_period(event, hwc, hwc->idx); 198 armpmu_event_set_period(event);
204 armpmu->enable(hwc, hwc->idx); 199 armpmu->enable(event);
205} 200}
206 201
207static void 202static void
@@ -233,7 +228,7 @@ armpmu_add(struct perf_event *event, int flags)
233 perf_pmu_disable(event->pmu); 228 perf_pmu_disable(event->pmu);
234 229
235 /* If we don't have a space for the counter then finish early. */ 230 /* If we don't have a space for the counter then finish early. */
236 idx = armpmu->get_event_idx(hw_events, hwc); 231 idx = armpmu->get_event_idx(hw_events, event);
237 if (idx < 0) { 232 if (idx < 0) {
238 err = idx; 233 err = idx;
239 goto out; 234 goto out;
@@ -244,7 +239,7 @@ armpmu_add(struct perf_event *event, int flags)
244 * sure it is disabled. 239 * sure it is disabled.
245 */ 240 */
246 event->hw.idx = idx; 241 event->hw.idx = idx;
247 armpmu->disable(hwc, idx); 242 armpmu->disable(event);
248 hw_events->events[idx] = event; 243 hw_events->events[idx] = event;
249 244
250 hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; 245 hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE;
@@ -264,13 +259,12 @@ validate_event(struct pmu_hw_events *hw_events,
264 struct perf_event *event) 259 struct perf_event *event)
265{ 260{
266 struct arm_pmu *armpmu = to_arm_pmu(event->pmu); 261 struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
267 struct hw_perf_event fake_event = event->hw;
268 struct pmu *leader_pmu = event->group_leader->pmu; 262 struct pmu *leader_pmu = event->group_leader->pmu;
269 263
270 if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF) 264 if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF)
271 return 1; 265 return 1;
272 266
273 return armpmu->get_event_idx(hw_events, &fake_event) >= 0; 267 return armpmu->get_event_idx(hw_events, event) >= 0;
274} 268}
275 269
276static int 270static int
@@ -316,7 +310,7 @@ static irqreturn_t armpmu_dispatch_irq(int irq, void *dev)
316static void 310static void
317armpmu_release_hardware(struct arm_pmu *armpmu) 311armpmu_release_hardware(struct arm_pmu *armpmu)
318{ 312{
319 armpmu->free_irq(); 313 armpmu->free_irq(armpmu);
320 pm_runtime_put_sync(&armpmu->plat_device->dev); 314 pm_runtime_put_sync(&armpmu->plat_device->dev);
321} 315}
322 316
@@ -330,7 +324,7 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)
330 return -ENODEV; 324 return -ENODEV;
331 325
332 pm_runtime_get_sync(&pmu_device->dev); 326 pm_runtime_get_sync(&pmu_device->dev);
333 err = armpmu->request_irq(armpmu_dispatch_irq); 327 err = armpmu->request_irq(armpmu, armpmu_dispatch_irq);
334 if (err) { 328 if (err) {
335 armpmu_release_hardware(armpmu); 329 armpmu_release_hardware(armpmu);
336 return err; 330 return err;
@@ -465,13 +459,13 @@ static void armpmu_enable(struct pmu *pmu)
465 int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events); 459 int enabled = bitmap_weight(hw_events->used_mask, armpmu->num_events);
466 460
467 if (enabled) 461 if (enabled)
468 armpmu->start(); 462 armpmu->start(armpmu);
469} 463}
470 464
471static void armpmu_disable(struct pmu *pmu) 465static void armpmu_disable(struct pmu *pmu)
472{ 466{
473 struct arm_pmu *armpmu = to_arm_pmu(pmu); 467 struct arm_pmu *armpmu = to_arm_pmu(pmu);
474 armpmu->stop(); 468 armpmu->stop(armpmu);
475} 469}
476 470
477#ifdef CONFIG_PM_RUNTIME 471#ifdef CONFIG_PM_RUNTIME
@@ -517,12 +511,13 @@ static void __init armpmu_init(struct arm_pmu *armpmu)
517 }; 511 };
518} 512}
519 513
520int armpmu_register(struct arm_pmu *armpmu, char *name, int type) 514int armpmu_register(struct arm_pmu *armpmu, int type)
521{ 515{
522 armpmu_init(armpmu); 516 armpmu_init(armpmu);
517 pm_runtime_enable(&armpmu->plat_device->dev);
523 pr_info("enabled with %s PMU driver, %d counters available\n", 518 pr_info("enabled with %s PMU driver, %d counters available\n",
524 armpmu->name, armpmu->num_events); 519 armpmu->name, armpmu->num_events);
525 return perf_pmu_register(&armpmu->pmu, name, type); 520 return perf_pmu_register(&armpmu->pmu, armpmu->name, type);
526} 521}
527 522
528/* 523/*
@@ -576,6 +571,10 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
576{ 571{
577 struct frame_tail __user *tail; 572 struct frame_tail __user *tail;
578 573
574 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
575 /* We don't support guest os callchain now */
576 return;
577 }
579 578
580 tail = (struct frame_tail __user *)regs->ARM_fp - 1; 579 tail = (struct frame_tail __user *)regs->ARM_fp - 1;
581 580
@@ -603,9 +602,41 @@ perf_callchain_kernel(struct perf_callchain_entry *entry, struct pt_regs *regs)
603{ 602{
604 struct stackframe fr; 603 struct stackframe fr;
605 604
605 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
606 /* We don't support guest os callchain now */
607 return;
608 }
609
606 fr.fp = regs->ARM_fp; 610 fr.fp = regs->ARM_fp;
607 fr.sp = regs->ARM_sp; 611 fr.sp = regs->ARM_sp;
608 fr.lr = regs->ARM_lr; 612 fr.lr = regs->ARM_lr;
609 fr.pc = regs->ARM_pc; 613 fr.pc = regs->ARM_pc;
610 walk_stackframe(&fr, callchain_trace, entry); 614 walk_stackframe(&fr, callchain_trace, entry);
611} 615}
616
617unsigned long perf_instruction_pointer(struct pt_regs *regs)
618{
619 if (perf_guest_cbs && perf_guest_cbs->is_in_guest())
620 return perf_guest_cbs->get_guest_ip();
621
622 return instruction_pointer(regs);
623}
624
625unsigned long perf_misc_flags(struct pt_regs *regs)
626{
627 int misc = 0;
628
629 if (perf_guest_cbs && perf_guest_cbs->is_in_guest()) {
630 if (perf_guest_cbs->is_user_mode())
631 misc |= PERF_RECORD_MISC_GUEST_USER;
632 else
633 misc |= PERF_RECORD_MISC_GUEST_KERNEL;
634 } else {
635 if (user_mode(regs))
636 misc |= PERF_RECORD_MISC_USER;
637 else
638 misc |= PERF_RECORD_MISC_KERNEL;
639 }
640
641 return misc;
642}
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
index 8d7d8d4de9d6..9a4f6307a016 100644
--- a/arch/arm/kernel/perf_event_cpu.c
+++ b/arch/arm/kernel/perf_event_cpu.c
@@ -23,6 +23,7 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/slab.h>
26#include <linux/spinlock.h> 27#include <linux/spinlock.h>
27 28
28#include <asm/cputype.h> 29#include <asm/cputype.h>
@@ -45,7 +46,7 @@ const char *perf_pmu_name(void)
45 if (!cpu_pmu) 46 if (!cpu_pmu)
46 return NULL; 47 return NULL;
47 48
48 return cpu_pmu->pmu.name; 49 return cpu_pmu->name;
49} 50}
50EXPORT_SYMBOL_GPL(perf_pmu_name); 51EXPORT_SYMBOL_GPL(perf_pmu_name);
51 52
@@ -70,7 +71,7 @@ static struct pmu_hw_events *cpu_pmu_get_cpu_events(void)
70 return &__get_cpu_var(cpu_hw_events); 71 return &__get_cpu_var(cpu_hw_events);
71} 72}
72 73
73static void cpu_pmu_free_irq(void) 74static void cpu_pmu_free_irq(struct arm_pmu *cpu_pmu)
74{ 75{
75 int i, irq, irqs; 76 int i, irq, irqs;
76 struct platform_device *pmu_device = cpu_pmu->plat_device; 77 struct platform_device *pmu_device = cpu_pmu->plat_device;
@@ -86,7 +87,7 @@ static void cpu_pmu_free_irq(void)
86 } 87 }
87} 88}
88 89
89static int cpu_pmu_request_irq(irq_handler_t handler) 90static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
90{ 91{
91 int i, err, irq, irqs; 92 int i, err, irq, irqs;
92 struct platform_device *pmu_device = cpu_pmu->plat_device; 93 struct platform_device *pmu_device = cpu_pmu->plat_device;
@@ -147,7 +148,7 @@ static void __devinit cpu_pmu_init(struct arm_pmu *cpu_pmu)
147 148
148 /* Ensure the PMU has sane values out of reset. */ 149 /* Ensure the PMU has sane values out of reset. */
149 if (cpu_pmu && cpu_pmu->reset) 150 if (cpu_pmu && cpu_pmu->reset)
150 on_each_cpu(cpu_pmu->reset, NULL, 1); 151 on_each_cpu(cpu_pmu->reset, cpu_pmu, 1);
151} 152}
152 153
153/* 154/*
@@ -163,7 +164,9 @@ static int __cpuinit cpu_pmu_notify(struct notifier_block *b,
163 return NOTIFY_DONE; 164 return NOTIFY_DONE;
164 165
165 if (cpu_pmu && cpu_pmu->reset) 166 if (cpu_pmu && cpu_pmu->reset)
166 cpu_pmu->reset(NULL); 167 cpu_pmu->reset(cpu_pmu);
168 else
169 return NOTIFY_DONE;
167 170
168 return NOTIFY_OK; 171 return NOTIFY_OK;
169} 172}
@@ -195,13 +198,13 @@ static struct platform_device_id __devinitdata cpu_pmu_plat_device_ids[] = {
195/* 198/*
196 * CPU PMU identification and probing. 199 * CPU PMU identification and probing.
197 */ 200 */
198static struct arm_pmu *__devinit probe_current_pmu(void) 201static int __devinit probe_current_pmu(struct arm_pmu *pmu)
199{ 202{
200 struct arm_pmu *pmu = NULL;
201 int cpu = get_cpu(); 203 int cpu = get_cpu();
202 unsigned long cpuid = read_cpuid_id(); 204 unsigned long cpuid = read_cpuid_id();
203 unsigned long implementor = (cpuid & 0xFF000000) >> 24; 205 unsigned long implementor = (cpuid & 0xFF000000) >> 24;
204 unsigned long part_number = (cpuid & 0xFFF0); 206 unsigned long part_number = (cpuid & 0xFFF0);
207 int ret = -ENODEV;
205 208
206 pr_info("probing PMU on CPU %d\n", cpu); 209 pr_info("probing PMU on CPU %d\n", cpu);
207 210
@@ -211,25 +214,25 @@ static struct arm_pmu *__devinit probe_current_pmu(void)
211 case 0xB360: /* ARM1136 */ 214 case 0xB360: /* ARM1136 */
212 case 0xB560: /* ARM1156 */ 215 case 0xB560: /* ARM1156 */
213 case 0xB760: /* ARM1176 */ 216 case 0xB760: /* ARM1176 */
214 pmu = armv6pmu_init(); 217 ret = armv6pmu_init(pmu);
215 break; 218 break;
216 case 0xB020: /* ARM11mpcore */ 219 case 0xB020: /* ARM11mpcore */
217 pmu = armv6mpcore_pmu_init(); 220 ret = armv6mpcore_pmu_init(pmu);
218 break; 221 break;
219 case 0xC080: /* Cortex-A8 */ 222 case 0xC080: /* Cortex-A8 */
220 pmu = armv7_a8_pmu_init(); 223 ret = armv7_a8_pmu_init(pmu);
221 break; 224 break;
222 case 0xC090: /* Cortex-A9 */ 225 case 0xC090: /* Cortex-A9 */
223 pmu = armv7_a9_pmu_init(); 226 ret = armv7_a9_pmu_init(pmu);
224 break; 227 break;
225 case 0xC050: /* Cortex-A5 */ 228 case 0xC050: /* Cortex-A5 */
226 pmu = armv7_a5_pmu_init(); 229 ret = armv7_a5_pmu_init(pmu);
227 break; 230 break;
228 case 0xC0F0: /* Cortex-A15 */ 231 case 0xC0F0: /* Cortex-A15 */
229 pmu = armv7_a15_pmu_init(); 232 ret = armv7_a15_pmu_init(pmu);
230 break; 233 break;
231 case 0xC070: /* Cortex-A7 */ 234 case 0xC070: /* Cortex-A7 */
232 pmu = armv7_a7_pmu_init(); 235 ret = armv7_a7_pmu_init(pmu);
233 break; 236 break;
234 } 237 }
235 /* Intel CPUs [xscale]. */ 238 /* Intel CPUs [xscale]. */
@@ -237,43 +240,54 @@ static struct arm_pmu *__devinit probe_current_pmu(void)
237 part_number = (cpuid >> 13) & 0x7; 240 part_number = (cpuid >> 13) & 0x7;
238 switch (part_number) { 241 switch (part_number) {
239 case 1: 242 case 1:
240 pmu = xscale1pmu_init(); 243 ret = xscale1pmu_init(pmu);
241 break; 244 break;
242 case 2: 245 case 2:
243 pmu = xscale2pmu_init(); 246 ret = xscale2pmu_init(pmu);
244 break; 247 break;
245 } 248 }
246 } 249 }
247 250
248 put_cpu(); 251 put_cpu();
249 return pmu; 252 return ret;
250} 253}
251 254
252static int __devinit cpu_pmu_device_probe(struct platform_device *pdev) 255static int __devinit cpu_pmu_device_probe(struct platform_device *pdev)
253{ 256{
254 const struct of_device_id *of_id; 257 const struct of_device_id *of_id;
255 struct arm_pmu *(*init_fn)(void); 258 int (*init_fn)(struct arm_pmu *);
256 struct device_node *node = pdev->dev.of_node; 259 struct device_node *node = pdev->dev.of_node;
260 struct arm_pmu *pmu;
261 int ret = -ENODEV;
257 262
258 if (cpu_pmu) { 263 if (cpu_pmu) {
259 pr_info("attempt to register multiple PMU devices!"); 264 pr_info("attempt to register multiple PMU devices!");
260 return -ENOSPC; 265 return -ENOSPC;
261 } 266 }
262 267
268 pmu = kzalloc(sizeof(struct arm_pmu), GFP_KERNEL);
269 if (!pmu) {
270 pr_info("failed to allocate PMU device!");
271 return -ENOMEM;
272 }
273
263 if (node && (of_id = of_match_node(cpu_pmu_of_device_ids, pdev->dev.of_node))) { 274 if (node && (of_id = of_match_node(cpu_pmu_of_device_ids, pdev->dev.of_node))) {
264 init_fn = of_id->data; 275 init_fn = of_id->data;
265 cpu_pmu = init_fn(); 276 ret = init_fn(pmu);
266 } else { 277 } else {
267 cpu_pmu = probe_current_pmu(); 278 ret = probe_current_pmu(pmu);
268 } 279 }
269 280
270 if (!cpu_pmu) 281 if (ret) {
271 return -ENODEV; 282 pr_info("failed to register PMU devices!");
283 kfree(pmu);
284 return ret;
285 }
272 286
287 cpu_pmu = pmu;
273 cpu_pmu->plat_device = pdev; 288 cpu_pmu->plat_device = pdev;
274 cpu_pmu_init(cpu_pmu); 289 cpu_pmu_init(cpu_pmu);
275 register_cpu_notifier(&cpu_pmu_hotplug_notifier); 290 armpmu_register(cpu_pmu, PERF_TYPE_RAW);
276 armpmu_register(cpu_pmu, cpu_pmu->name, PERF_TYPE_RAW);
277 291
278 return 0; 292 return 0;
279} 293}
@@ -290,6 +304,16 @@ static struct platform_driver cpu_pmu_driver = {
290 304
291static int __init register_pmu_driver(void) 305static int __init register_pmu_driver(void)
292{ 306{
293 return platform_driver_register(&cpu_pmu_driver); 307 int err;
308
309 err = register_cpu_notifier(&cpu_pmu_hotplug_notifier);
310 if (err)
311 return err;
312
313 err = platform_driver_register(&cpu_pmu_driver);
314 if (err)
315 unregister_cpu_notifier(&cpu_pmu_hotplug_notifier);
316
317 return err;
294} 318}
295device_initcall(register_pmu_driver); 319device_initcall(register_pmu_driver);
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index 6ccc07971745..f3e22ff8b6a2 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -401,9 +401,10 @@ armv6_pmcr_counter_has_overflowed(unsigned long pmcr,
401 return ret; 401 return ret;
402} 402}
403 403
404static inline u32 404static inline u32 armv6pmu_read_counter(struct perf_event *event)
405armv6pmu_read_counter(int counter)
406{ 405{
406 struct hw_perf_event *hwc = &event->hw;
407 int counter = hwc->idx;
407 unsigned long value = 0; 408 unsigned long value = 0;
408 409
409 if (ARMV6_CYCLE_COUNTER == counter) 410 if (ARMV6_CYCLE_COUNTER == counter)
@@ -418,10 +419,11 @@ armv6pmu_read_counter(int counter)
418 return value; 419 return value;
419} 420}
420 421
421static inline void 422static inline void armv6pmu_write_counter(struct perf_event *event, u32 value)
422armv6pmu_write_counter(int counter,
423 u32 value)
424{ 423{
424 struct hw_perf_event *hwc = &event->hw;
425 int counter = hwc->idx;
426
425 if (ARMV6_CYCLE_COUNTER == counter) 427 if (ARMV6_CYCLE_COUNTER == counter)
426 asm volatile("mcr p15, 0, %0, c15, c12, 1" : : "r"(value)); 428 asm volatile("mcr p15, 0, %0, c15, c12, 1" : : "r"(value));
427 else if (ARMV6_COUNTER0 == counter) 429 else if (ARMV6_COUNTER0 == counter)
@@ -432,12 +434,13 @@ armv6pmu_write_counter(int counter,
432 WARN_ONCE(1, "invalid counter number (%d)\n", counter); 434 WARN_ONCE(1, "invalid counter number (%d)\n", counter);
433} 435}
434 436
435static void 437static void armv6pmu_enable_event(struct perf_event *event)
436armv6pmu_enable_event(struct hw_perf_event *hwc,
437 int idx)
438{ 438{
439 unsigned long val, mask, evt, flags; 439 unsigned long val, mask, evt, flags;
440 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
441 struct hw_perf_event *hwc = &event->hw;
440 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 442 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
443 int idx = hwc->idx;
441 444
442 if (ARMV6_CYCLE_COUNTER == idx) { 445 if (ARMV6_CYCLE_COUNTER == idx) {
443 mask = 0; 446 mask = 0;
@@ -473,7 +476,8 @@ armv6pmu_handle_irq(int irq_num,
473{ 476{
474 unsigned long pmcr = armv6_pmcr_read(); 477 unsigned long pmcr = armv6_pmcr_read();
475 struct perf_sample_data data; 478 struct perf_sample_data data;
476 struct pmu_hw_events *cpuc; 479 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
480 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
477 struct pt_regs *regs; 481 struct pt_regs *regs;
478 int idx; 482 int idx;
479 483
@@ -489,7 +493,6 @@ armv6pmu_handle_irq(int irq_num,
489 */ 493 */
490 armv6_pmcr_write(pmcr); 494 armv6_pmcr_write(pmcr);
491 495
492 cpuc = &__get_cpu_var(cpu_hw_events);
493 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 496 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
494 struct perf_event *event = cpuc->events[idx]; 497 struct perf_event *event = cpuc->events[idx];
495 struct hw_perf_event *hwc; 498 struct hw_perf_event *hwc;
@@ -506,13 +509,13 @@ armv6pmu_handle_irq(int irq_num,
506 continue; 509 continue;
507 510
508 hwc = &event->hw; 511 hwc = &event->hw;
509 armpmu_event_update(event, hwc, idx); 512 armpmu_event_update(event);
510 perf_sample_data_init(&data, 0, hwc->last_period); 513 perf_sample_data_init(&data, 0, hwc->last_period);
511 if (!armpmu_event_set_period(event, hwc, idx)) 514 if (!armpmu_event_set_period(event))
512 continue; 515 continue;
513 516
514 if (perf_event_overflow(event, &data, regs)) 517 if (perf_event_overflow(event, &data, regs))
515 cpu_pmu->disable(hwc, idx); 518 cpu_pmu->disable(event);
516 } 519 }
517 520
518 /* 521 /*
@@ -527,8 +530,7 @@ armv6pmu_handle_irq(int irq_num,
527 return IRQ_HANDLED; 530 return IRQ_HANDLED;
528} 531}
529 532
530static void 533static void armv6pmu_start(struct arm_pmu *cpu_pmu)
531armv6pmu_start(void)
532{ 534{
533 unsigned long flags, val; 535 unsigned long flags, val;
534 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 536 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -540,8 +542,7 @@ armv6pmu_start(void)
540 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 542 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
541} 543}
542 544
543static void 545static void armv6pmu_stop(struct arm_pmu *cpu_pmu)
544armv6pmu_stop(void)
545{ 546{
546 unsigned long flags, val; 547 unsigned long flags, val;
547 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 548 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -555,10 +556,11 @@ armv6pmu_stop(void)
555 556
556static int 557static int
557armv6pmu_get_event_idx(struct pmu_hw_events *cpuc, 558armv6pmu_get_event_idx(struct pmu_hw_events *cpuc,
558 struct hw_perf_event *event) 559 struct perf_event *event)
559{ 560{
561 struct hw_perf_event *hwc = &event->hw;
560 /* Always place a cycle counter into the cycle counter. */ 562 /* Always place a cycle counter into the cycle counter. */
561 if (ARMV6_PERFCTR_CPU_CYCLES == event->config_base) { 563 if (ARMV6_PERFCTR_CPU_CYCLES == hwc->config_base) {
562 if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask)) 564 if (test_and_set_bit(ARMV6_CYCLE_COUNTER, cpuc->used_mask))
563 return -EAGAIN; 565 return -EAGAIN;
564 566
@@ -579,12 +581,13 @@ armv6pmu_get_event_idx(struct pmu_hw_events *cpuc,
579 } 581 }
580} 582}
581 583
582static void 584static void armv6pmu_disable_event(struct perf_event *event)
583armv6pmu_disable_event(struct hw_perf_event *hwc,
584 int idx)
585{ 585{
586 unsigned long val, mask, evt, flags; 586 unsigned long val, mask, evt, flags;
587 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
588 struct hw_perf_event *hwc = &event->hw;
587 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 589 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
590 int idx = hwc->idx;
588 591
589 if (ARMV6_CYCLE_COUNTER == idx) { 592 if (ARMV6_CYCLE_COUNTER == idx) {
590 mask = ARMV6_PMCR_CCOUNT_IEN; 593 mask = ARMV6_PMCR_CCOUNT_IEN;
@@ -613,12 +616,13 @@ armv6pmu_disable_event(struct hw_perf_event *hwc,
613 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 616 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
614} 617}
615 618
616static void 619static void armv6mpcore_pmu_disable_event(struct perf_event *event)
617armv6mpcore_pmu_disable_event(struct hw_perf_event *hwc,
618 int idx)
619{ 620{
620 unsigned long val, mask, flags, evt = 0; 621 unsigned long val, mask, flags, evt = 0;
622 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
623 struct hw_perf_event *hwc = &event->hw;
621 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 624 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
625 int idx = hwc->idx;
622 626
623 if (ARMV6_CYCLE_COUNTER == idx) { 627 if (ARMV6_CYCLE_COUNTER == idx) {
624 mask = ARMV6_PMCR_CCOUNT_IEN; 628 mask = ARMV6_PMCR_CCOUNT_IEN;
@@ -649,24 +653,22 @@ static int armv6_map_event(struct perf_event *event)
649 &armv6_perf_cache_map, 0xFF); 653 &armv6_perf_cache_map, 0xFF);
650} 654}
651 655
652static struct arm_pmu armv6pmu = { 656static int __devinit armv6pmu_init(struct arm_pmu *cpu_pmu)
653 .name = "v6",
654 .handle_irq = armv6pmu_handle_irq,
655 .enable = armv6pmu_enable_event,
656 .disable = armv6pmu_disable_event,
657 .read_counter = armv6pmu_read_counter,
658 .write_counter = armv6pmu_write_counter,
659 .get_event_idx = armv6pmu_get_event_idx,
660 .start = armv6pmu_start,
661 .stop = armv6pmu_stop,
662 .map_event = armv6_map_event,
663 .num_events = 3,
664 .max_period = (1LLU << 32) - 1,
665};
666
667static struct arm_pmu *__devinit armv6pmu_init(void)
668{ 657{
669 return &armv6pmu; 658 cpu_pmu->name = "v6";
659 cpu_pmu->handle_irq = armv6pmu_handle_irq;
660 cpu_pmu->enable = armv6pmu_enable_event;
661 cpu_pmu->disable = armv6pmu_disable_event;
662 cpu_pmu->read_counter = armv6pmu_read_counter;
663 cpu_pmu->write_counter = armv6pmu_write_counter;
664 cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
665 cpu_pmu->start = armv6pmu_start;
666 cpu_pmu->stop = armv6pmu_stop;
667 cpu_pmu->map_event = armv6_map_event;
668 cpu_pmu->num_events = 3;
669 cpu_pmu->max_period = (1LLU << 32) - 1;
670
671 return 0;
670} 672}
671 673
672/* 674/*
@@ -683,33 +685,31 @@ static int armv6mpcore_map_event(struct perf_event *event)
683 &armv6mpcore_perf_cache_map, 0xFF); 685 &armv6mpcore_perf_cache_map, 0xFF);
684} 686}
685 687
686static struct arm_pmu armv6mpcore_pmu = { 688static int __devinit armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
687 .name = "v6mpcore",
688 .handle_irq = armv6pmu_handle_irq,
689 .enable = armv6pmu_enable_event,
690 .disable = armv6mpcore_pmu_disable_event,
691 .read_counter = armv6pmu_read_counter,
692 .write_counter = armv6pmu_write_counter,
693 .get_event_idx = armv6pmu_get_event_idx,
694 .start = armv6pmu_start,
695 .stop = armv6pmu_stop,
696 .map_event = armv6mpcore_map_event,
697 .num_events = 3,
698 .max_period = (1LLU << 32) - 1,
699};
700
701static struct arm_pmu *__devinit armv6mpcore_pmu_init(void)
702{ 689{
703 return &armv6mpcore_pmu; 690 cpu_pmu->name = "v6mpcore";
691 cpu_pmu->handle_irq = armv6pmu_handle_irq;
692 cpu_pmu->enable = armv6pmu_enable_event;
693 cpu_pmu->disable = armv6mpcore_pmu_disable_event;
694 cpu_pmu->read_counter = armv6pmu_read_counter;
695 cpu_pmu->write_counter = armv6pmu_write_counter;
696 cpu_pmu->get_event_idx = armv6pmu_get_event_idx;
697 cpu_pmu->start = armv6pmu_start;
698 cpu_pmu->stop = armv6pmu_stop;
699 cpu_pmu->map_event = armv6mpcore_map_event;
700 cpu_pmu->num_events = 3;
701 cpu_pmu->max_period = (1LLU << 32) - 1;
702
703 return 0;
704} 704}
705#else 705#else
706static struct arm_pmu *__devinit armv6pmu_init(void) 706static int armv6pmu_init(struct arm_pmu *cpu_pmu)
707{ 707{
708 return NULL; 708 return -ENODEV;
709} 709}
710 710
711static struct arm_pmu *__devinit armv6mpcore_pmu_init(void) 711static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu)
712{ 712{
713 return NULL; 713 return -ENODEV;
714} 714}
715#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */ 715#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index bd4b090ebcfd..7d0cce85d17e 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -18,8 +18,6 @@
18 18
19#ifdef CONFIG_CPU_V7 19#ifdef CONFIG_CPU_V7
20 20
21static struct arm_pmu armv7pmu;
22
23/* 21/*
24 * Common ARMv7 event types 22 * Common ARMv7 event types
25 * 23 *
@@ -738,7 +736,8 @@ static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
738 */ 736 */
739#define ARMV7_IDX_CYCLE_COUNTER 0 737#define ARMV7_IDX_CYCLE_COUNTER 0
740#define ARMV7_IDX_COUNTER0 1 738#define ARMV7_IDX_COUNTER0 1
741#define ARMV7_IDX_COUNTER_LAST (ARMV7_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1) 739#define ARMV7_IDX_COUNTER_LAST(cpu_pmu) \
740 (ARMV7_IDX_CYCLE_COUNTER + cpu_pmu->num_events - 1)
742 741
743#define ARMV7_MAX_COUNTERS 32 742#define ARMV7_MAX_COUNTERS 32
744#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1) 743#define ARMV7_COUNTER_MASK (ARMV7_MAX_COUNTERS - 1)
@@ -804,49 +803,34 @@ static inline int armv7_pmnc_has_overflowed(u32 pmnc)
804 return pmnc & ARMV7_OVERFLOWED_MASK; 803 return pmnc & ARMV7_OVERFLOWED_MASK;
805} 804}
806 805
807static inline int armv7_pmnc_counter_valid(int idx) 806static inline int armv7_pmnc_counter_valid(struct arm_pmu *cpu_pmu, int idx)
808{ 807{
809 return idx >= ARMV7_IDX_CYCLE_COUNTER && idx <= ARMV7_IDX_COUNTER_LAST; 808 return idx >= ARMV7_IDX_CYCLE_COUNTER &&
809 idx <= ARMV7_IDX_COUNTER_LAST(cpu_pmu);
810} 810}
811 811
812static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx) 812static inline int armv7_pmnc_counter_has_overflowed(u32 pmnc, int idx)
813{ 813{
814 int ret = 0; 814 return pmnc & BIT(ARMV7_IDX_TO_COUNTER(idx));
815 u32 counter;
816
817 if (!armv7_pmnc_counter_valid(idx)) {
818 pr_err("CPU%u checking wrong counter %d overflow status\n",
819 smp_processor_id(), idx);
820 } else {
821 counter = ARMV7_IDX_TO_COUNTER(idx);
822 ret = pmnc & BIT(counter);
823 }
824
825 return ret;
826} 815}
827 816
828static inline int armv7_pmnc_select_counter(int idx) 817static inline int armv7_pmnc_select_counter(int idx)
829{ 818{
830 u32 counter; 819 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
831
832 if (!armv7_pmnc_counter_valid(idx)) {
833 pr_err("CPU%u selecting wrong PMNC counter %d\n",
834 smp_processor_id(), idx);
835 return -EINVAL;
836 }
837
838 counter = ARMV7_IDX_TO_COUNTER(idx);
839 asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter)); 820 asm volatile("mcr p15, 0, %0, c9, c12, 5" : : "r" (counter));
840 isb(); 821 isb();
841 822
842 return idx; 823 return idx;
843} 824}
844 825
845static inline u32 armv7pmu_read_counter(int idx) 826static inline u32 armv7pmu_read_counter(struct perf_event *event)
846{ 827{
828 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
829 struct hw_perf_event *hwc = &event->hw;
830 int idx = hwc->idx;
847 u32 value = 0; 831 u32 value = 0;
848 832
849 if (!armv7_pmnc_counter_valid(idx)) 833 if (!armv7_pmnc_counter_valid(cpu_pmu, idx))
850 pr_err("CPU%u reading wrong counter %d\n", 834 pr_err("CPU%u reading wrong counter %d\n",
851 smp_processor_id(), idx); 835 smp_processor_id(), idx);
852 else if (idx == ARMV7_IDX_CYCLE_COUNTER) 836 else if (idx == ARMV7_IDX_CYCLE_COUNTER)
@@ -857,9 +841,13 @@ static inline u32 armv7pmu_read_counter(int idx)
857 return value; 841 return value;
858} 842}
859 843
860static inline void armv7pmu_write_counter(int idx, u32 value) 844static inline void armv7pmu_write_counter(struct perf_event *event, u32 value)
861{ 845{
862 if (!armv7_pmnc_counter_valid(idx)) 846 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
847 struct hw_perf_event *hwc = &event->hw;
848 int idx = hwc->idx;
849
850 if (!armv7_pmnc_counter_valid(cpu_pmu, idx))
863 pr_err("CPU%u writing wrong counter %d\n", 851 pr_err("CPU%u writing wrong counter %d\n",
864 smp_processor_id(), idx); 852 smp_processor_id(), idx);
865 else if (idx == ARMV7_IDX_CYCLE_COUNTER) 853 else if (idx == ARMV7_IDX_CYCLE_COUNTER)
@@ -878,60 +866,28 @@ static inline void armv7_pmnc_write_evtsel(int idx, u32 val)
878 866
879static inline int armv7_pmnc_enable_counter(int idx) 867static inline int armv7_pmnc_enable_counter(int idx)
880{ 868{
881 u32 counter; 869 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
882
883 if (!armv7_pmnc_counter_valid(idx)) {
884 pr_err("CPU%u enabling wrong PMNC counter %d\n",
885 smp_processor_id(), idx);
886 return -EINVAL;
887 }
888
889 counter = ARMV7_IDX_TO_COUNTER(idx);
890 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter))); 870 asm volatile("mcr p15, 0, %0, c9, c12, 1" : : "r" (BIT(counter)));
891 return idx; 871 return idx;
892} 872}
893 873
894static inline int armv7_pmnc_disable_counter(int idx) 874static inline int armv7_pmnc_disable_counter(int idx)
895{ 875{
896 u32 counter; 876 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
897
898 if (!armv7_pmnc_counter_valid(idx)) {
899 pr_err("CPU%u disabling wrong PMNC counter %d\n",
900 smp_processor_id(), idx);
901 return -EINVAL;
902 }
903
904 counter = ARMV7_IDX_TO_COUNTER(idx);
905 asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter))); 877 asm volatile("mcr p15, 0, %0, c9, c12, 2" : : "r" (BIT(counter)));
906 return idx; 878 return idx;
907} 879}
908 880
909static inline int armv7_pmnc_enable_intens(int idx) 881static inline int armv7_pmnc_enable_intens(int idx)
910{ 882{
911 u32 counter; 883 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
912
913 if (!armv7_pmnc_counter_valid(idx)) {
914 pr_err("CPU%u enabling wrong PMNC counter IRQ enable %d\n",
915 smp_processor_id(), idx);
916 return -EINVAL;
917 }
918
919 counter = ARMV7_IDX_TO_COUNTER(idx);
920 asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter))); 884 asm volatile("mcr p15, 0, %0, c9, c14, 1" : : "r" (BIT(counter)));
921 return idx; 885 return idx;
922} 886}
923 887
924static inline int armv7_pmnc_disable_intens(int idx) 888static inline int armv7_pmnc_disable_intens(int idx)
925{ 889{
926 u32 counter; 890 u32 counter = ARMV7_IDX_TO_COUNTER(idx);
927
928 if (!armv7_pmnc_counter_valid(idx)) {
929 pr_err("CPU%u disabling wrong PMNC counter IRQ enable %d\n",
930 smp_processor_id(), idx);
931 return -EINVAL;
932 }
933
934 counter = ARMV7_IDX_TO_COUNTER(idx);
935 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter))); 891 asm volatile("mcr p15, 0, %0, c9, c14, 2" : : "r" (BIT(counter)));
936 isb(); 892 isb();
937 /* Clear the overflow flag in case an interrupt is pending. */ 893 /* Clear the overflow flag in case an interrupt is pending. */
@@ -956,7 +912,7 @@ static inline u32 armv7_pmnc_getreset_flags(void)
956} 912}
957 913
958#ifdef DEBUG 914#ifdef DEBUG
959static void armv7_pmnc_dump_regs(void) 915static void armv7_pmnc_dump_regs(struct arm_pmu *cpu_pmu)
960{ 916{
961 u32 val; 917 u32 val;
962 unsigned int cnt; 918 unsigned int cnt;
@@ -981,7 +937,8 @@ static void armv7_pmnc_dump_regs(void)
981 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val)); 937 asm volatile("mrc p15, 0, %0, c9, c13, 0" : "=r" (val));
982 printk(KERN_INFO "CCNT =0x%08x\n", val); 938 printk(KERN_INFO "CCNT =0x%08x\n", val);
983 939
984 for (cnt = ARMV7_IDX_COUNTER0; cnt <= ARMV7_IDX_COUNTER_LAST; cnt++) { 940 for (cnt = ARMV7_IDX_COUNTER0;
941 cnt <= ARMV7_IDX_COUNTER_LAST(cpu_pmu); cnt++) {
985 armv7_pmnc_select_counter(cnt); 942 armv7_pmnc_select_counter(cnt);
986 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val)); 943 asm volatile("mrc p15, 0, %0, c9, c13, 2" : "=r" (val));
987 printk(KERN_INFO "CNT[%d] count =0x%08x\n", 944 printk(KERN_INFO "CNT[%d] count =0x%08x\n",
@@ -993,10 +950,19 @@ static void armv7_pmnc_dump_regs(void)
993} 950}
994#endif 951#endif
995 952
996static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx) 953static void armv7pmu_enable_event(struct perf_event *event)
997{ 954{
998 unsigned long flags; 955 unsigned long flags;
956 struct hw_perf_event *hwc = &event->hw;
957 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
999 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 958 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
959 int idx = hwc->idx;
960
961 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
962 pr_err("CPU%u enabling wrong PMNC counter IRQ enable %d\n",
963 smp_processor_id(), idx);
964 return;
965 }
1000 966
1001 /* 967 /*
1002 * Enable counter and interrupt, and set the counter to count 968 * Enable counter and interrupt, and set the counter to count
@@ -1014,7 +980,7 @@ static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
1014 * We only need to set the event for the cycle counter if we 980 * We only need to set the event for the cycle counter if we
1015 * have the ability to perform event filtering. 981 * have the ability to perform event filtering.
1016 */ 982 */
1017 if (armv7pmu.set_event_filter || idx != ARMV7_IDX_CYCLE_COUNTER) 983 if (cpu_pmu->set_event_filter || idx != ARMV7_IDX_CYCLE_COUNTER)
1018 armv7_pmnc_write_evtsel(idx, hwc->config_base); 984 armv7_pmnc_write_evtsel(idx, hwc->config_base);
1019 985
1020 /* 986 /*
@@ -1030,10 +996,19 @@ static void armv7pmu_enable_event(struct hw_perf_event *hwc, int idx)
1030 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 996 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
1031} 997}
1032 998
1033static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx) 999static void armv7pmu_disable_event(struct perf_event *event)
1034{ 1000{
1035 unsigned long flags; 1001 unsigned long flags;
1002 struct hw_perf_event *hwc = &event->hw;
1003 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1036 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1004 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
1005 int idx = hwc->idx;
1006
1007 if (!armv7_pmnc_counter_valid(cpu_pmu, idx)) {
1008 pr_err("CPU%u disabling wrong PMNC counter IRQ enable %d\n",
1009 smp_processor_id(), idx);
1010 return;
1011 }
1037 1012
1038 /* 1013 /*
1039 * Disable counter and interrupt 1014 * Disable counter and interrupt
@@ -1057,7 +1032,8 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1057{ 1032{
1058 u32 pmnc; 1033 u32 pmnc;
1059 struct perf_sample_data data; 1034 struct perf_sample_data data;
1060 struct pmu_hw_events *cpuc; 1035 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
1036 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
1061 struct pt_regs *regs; 1037 struct pt_regs *regs;
1062 int idx; 1038 int idx;
1063 1039
@@ -1077,7 +1053,6 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1077 */ 1053 */
1078 regs = get_irq_regs(); 1054 regs = get_irq_regs();
1079 1055
1080 cpuc = &__get_cpu_var(cpu_hw_events);
1081 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 1056 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
1082 struct perf_event *event = cpuc->events[idx]; 1057 struct perf_event *event = cpuc->events[idx];
1083 struct hw_perf_event *hwc; 1058 struct hw_perf_event *hwc;
@@ -1094,13 +1069,13 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1094 continue; 1069 continue;
1095 1070
1096 hwc = &event->hw; 1071 hwc = &event->hw;
1097 armpmu_event_update(event, hwc, idx); 1072 armpmu_event_update(event);
1098 perf_sample_data_init(&data, 0, hwc->last_period); 1073 perf_sample_data_init(&data, 0, hwc->last_period);
1099 if (!armpmu_event_set_period(event, hwc, idx)) 1074 if (!armpmu_event_set_period(event))
1100 continue; 1075 continue;
1101 1076
1102 if (perf_event_overflow(event, &data, regs)) 1077 if (perf_event_overflow(event, &data, regs))
1103 cpu_pmu->disable(hwc, idx); 1078 cpu_pmu->disable(event);
1104 } 1079 }
1105 1080
1106 /* 1081 /*
@@ -1115,7 +1090,7 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev)
1115 return IRQ_HANDLED; 1090 return IRQ_HANDLED;
1116} 1091}
1117 1092
1118static void armv7pmu_start(void) 1093static void armv7pmu_start(struct arm_pmu *cpu_pmu)
1119{ 1094{
1120 unsigned long flags; 1095 unsigned long flags;
1121 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1096 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -1126,7 +1101,7 @@ static void armv7pmu_start(void)
1126 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 1101 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
1127} 1102}
1128 1103
1129static void armv7pmu_stop(void) 1104static void armv7pmu_stop(struct arm_pmu *cpu_pmu)
1130{ 1105{
1131 unsigned long flags; 1106 unsigned long flags;
1132 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 1107 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -1138,10 +1113,12 @@ static void armv7pmu_stop(void)
1138} 1113}
1139 1114
1140static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc, 1115static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc,
1141 struct hw_perf_event *event) 1116 struct perf_event *event)
1142{ 1117{
1143 int idx; 1118 int idx;
1144 unsigned long evtype = event->config_base & ARMV7_EVTYPE_EVENT; 1119 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
1120 struct hw_perf_event *hwc = &event->hw;
1121 unsigned long evtype = hwc->config_base & ARMV7_EVTYPE_EVENT;
1145 1122
1146 /* Always place a cycle counter into the cycle counter. */ 1123 /* Always place a cycle counter into the cycle counter. */
1147 if (evtype == ARMV7_PERFCTR_CPU_CYCLES) { 1124 if (evtype == ARMV7_PERFCTR_CPU_CYCLES) {
@@ -1192,11 +1169,14 @@ static int armv7pmu_set_event_filter(struct hw_perf_event *event,
1192 1169
1193static void armv7pmu_reset(void *info) 1170static void armv7pmu_reset(void *info)
1194{ 1171{
1172 struct arm_pmu *cpu_pmu = (struct arm_pmu *)info;
1195 u32 idx, nb_cnt = cpu_pmu->num_events; 1173 u32 idx, nb_cnt = cpu_pmu->num_events;
1196 1174
1197 /* The counter and interrupt enable registers are unknown at reset. */ 1175 /* The counter and interrupt enable registers are unknown at reset. */
1198 for (idx = ARMV7_IDX_CYCLE_COUNTER; idx < nb_cnt; ++idx) 1176 for (idx = ARMV7_IDX_CYCLE_COUNTER; idx < nb_cnt; ++idx) {
1199 armv7pmu_disable_event(NULL, idx); 1177 armv7_pmnc_disable_counter(idx);
1178 armv7_pmnc_disable_intens(idx);
1179 }
1200 1180
1201 /* Initialize & Reset PMNC: C and P bits */ 1181 /* Initialize & Reset PMNC: C and P bits */
1202 armv7_pmnc_write(ARMV7_PMNC_P | ARMV7_PMNC_C); 1182 armv7_pmnc_write(ARMV7_PMNC_P | ARMV7_PMNC_C);
@@ -1232,17 +1212,18 @@ static int armv7_a7_map_event(struct perf_event *event)
1232 &armv7_a7_perf_cache_map, 0xFF); 1212 &armv7_a7_perf_cache_map, 0xFF);
1233} 1213}
1234 1214
1235static struct arm_pmu armv7pmu = { 1215static void armv7pmu_init(struct arm_pmu *cpu_pmu)
1236 .handle_irq = armv7pmu_handle_irq, 1216{
1237 .enable = armv7pmu_enable_event, 1217 cpu_pmu->handle_irq = armv7pmu_handle_irq;
1238 .disable = armv7pmu_disable_event, 1218 cpu_pmu->enable = armv7pmu_enable_event;
1239 .read_counter = armv7pmu_read_counter, 1219 cpu_pmu->disable = armv7pmu_disable_event;
1240 .write_counter = armv7pmu_write_counter, 1220 cpu_pmu->read_counter = armv7pmu_read_counter;
1241 .get_event_idx = armv7pmu_get_event_idx, 1221 cpu_pmu->write_counter = armv7pmu_write_counter;
1242 .start = armv7pmu_start, 1222 cpu_pmu->get_event_idx = armv7pmu_get_event_idx;
1243 .stop = armv7pmu_stop, 1223 cpu_pmu->start = armv7pmu_start;
1244 .reset = armv7pmu_reset, 1224 cpu_pmu->stop = armv7pmu_stop;
1245 .max_period = (1LLU << 32) - 1, 1225 cpu_pmu->reset = armv7pmu_reset;
1226 cpu_pmu->max_period = (1LLU << 32) - 1;
1246}; 1227};
1247 1228
1248static u32 __devinit armv7_read_num_pmnc_events(void) 1229static u32 __devinit armv7_read_num_pmnc_events(void)
@@ -1256,70 +1237,75 @@ static u32 __devinit armv7_read_num_pmnc_events(void)
1256 return nb_cnt + 1; 1237 return nb_cnt + 1;
1257} 1238}
1258 1239
1259static struct arm_pmu *__devinit armv7_a8_pmu_init(void) 1240static int __devinit armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1260{ 1241{
1261 armv7pmu.name = "ARMv7 Cortex-A8"; 1242 armv7pmu_init(cpu_pmu);
1262 armv7pmu.map_event = armv7_a8_map_event; 1243 cpu_pmu->name = "ARMv7 Cortex-A8";
1263 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1244 cpu_pmu->map_event = armv7_a8_map_event;
1264 return &armv7pmu; 1245 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1246 return 0;
1265} 1247}
1266 1248
1267static struct arm_pmu *__devinit armv7_a9_pmu_init(void) 1249static int __devinit armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1268{ 1250{
1269 armv7pmu.name = "ARMv7 Cortex-A9"; 1251 armv7pmu_init(cpu_pmu);
1270 armv7pmu.map_event = armv7_a9_map_event; 1252 cpu_pmu->name = "ARMv7 Cortex-A9";
1271 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1253 cpu_pmu->map_event = armv7_a9_map_event;
1272 return &armv7pmu; 1254 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1255 return 0;
1273} 1256}
1274 1257
1275static struct arm_pmu *__devinit armv7_a5_pmu_init(void) 1258static int __devinit armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1276{ 1259{
1277 armv7pmu.name = "ARMv7 Cortex-A5"; 1260 armv7pmu_init(cpu_pmu);
1278 armv7pmu.map_event = armv7_a5_map_event; 1261 cpu_pmu->name = "ARMv7 Cortex-A5";
1279 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1262 cpu_pmu->map_event = armv7_a5_map_event;
1280 return &armv7pmu; 1263 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1264 return 0;
1281} 1265}
1282 1266
1283static struct arm_pmu *__devinit armv7_a15_pmu_init(void) 1267static int __devinit armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1284{ 1268{
1285 armv7pmu.name = "ARMv7 Cortex-A15"; 1269 armv7pmu_init(cpu_pmu);
1286 armv7pmu.map_event = armv7_a15_map_event; 1270 cpu_pmu->name = "ARMv7 Cortex-A15";
1287 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1271 cpu_pmu->map_event = armv7_a15_map_event;
1288 armv7pmu.set_event_filter = armv7pmu_set_event_filter; 1272 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1289 return &armv7pmu; 1273 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
1274 return 0;
1290} 1275}
1291 1276
1292static struct arm_pmu *__devinit armv7_a7_pmu_init(void) 1277static int __devinit armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1293{ 1278{
1294 armv7pmu.name = "ARMv7 Cortex-A7"; 1279 armv7pmu_init(cpu_pmu);
1295 armv7pmu.map_event = armv7_a7_map_event; 1280 cpu_pmu->name = "ARMv7 Cortex-A7";
1296 armv7pmu.num_events = armv7_read_num_pmnc_events(); 1281 cpu_pmu->map_event = armv7_a7_map_event;
1297 armv7pmu.set_event_filter = armv7pmu_set_event_filter; 1282 cpu_pmu->num_events = armv7_read_num_pmnc_events();
1298 return &armv7pmu; 1283 cpu_pmu->set_event_filter = armv7pmu_set_event_filter;
1284 return 0;
1299} 1285}
1300#else 1286#else
1301static struct arm_pmu *__devinit armv7_a8_pmu_init(void) 1287static inline int armv7_a8_pmu_init(struct arm_pmu *cpu_pmu)
1302{ 1288{
1303 return NULL; 1289 return -ENODEV;
1304} 1290}
1305 1291
1306static struct arm_pmu *__devinit armv7_a9_pmu_init(void) 1292static inline int armv7_a9_pmu_init(struct arm_pmu *cpu_pmu)
1307{ 1293{
1308 return NULL; 1294 return -ENODEV;
1309} 1295}
1310 1296
1311static struct arm_pmu *__devinit armv7_a5_pmu_init(void) 1297static inline int armv7_a5_pmu_init(struct arm_pmu *cpu_pmu)
1312{ 1298{
1313 return NULL; 1299 return -ENODEV;
1314} 1300}
1315 1301
1316static struct arm_pmu *__devinit armv7_a15_pmu_init(void) 1302static inline int armv7_a15_pmu_init(struct arm_pmu *cpu_pmu)
1317{ 1303{
1318 return NULL; 1304 return -ENODEV;
1319} 1305}
1320 1306
1321static struct arm_pmu *__devinit armv7_a7_pmu_init(void) 1307static inline int armv7_a7_pmu_init(struct arm_pmu *cpu_pmu)
1322{ 1308{
1323 return NULL; 1309 return -ENODEV;
1324} 1310}
1325#endif /* CONFIG_CPU_V7 */ 1311#endif /* CONFIG_CPU_V7 */
diff --git a/arch/arm/kernel/perf_event_xscale.c b/arch/arm/kernel/perf_event_xscale.c
index 426e19f380a2..0c8265e53d5f 100644
--- a/arch/arm/kernel/perf_event_xscale.c
+++ b/arch/arm/kernel/perf_event_xscale.c
@@ -224,7 +224,8 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
224{ 224{
225 unsigned long pmnc; 225 unsigned long pmnc;
226 struct perf_sample_data data; 226 struct perf_sample_data data;
227 struct pmu_hw_events *cpuc; 227 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
228 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
228 struct pt_regs *regs; 229 struct pt_regs *regs;
229 int idx; 230 int idx;
230 231
@@ -248,7 +249,6 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
248 249
249 regs = get_irq_regs(); 250 regs = get_irq_regs();
250 251
251 cpuc = &__get_cpu_var(cpu_hw_events);
252 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 252 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
253 struct perf_event *event = cpuc->events[idx]; 253 struct perf_event *event = cpuc->events[idx];
254 struct hw_perf_event *hwc; 254 struct hw_perf_event *hwc;
@@ -260,13 +260,13 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
260 continue; 260 continue;
261 261
262 hwc = &event->hw; 262 hwc = &event->hw;
263 armpmu_event_update(event, hwc, idx); 263 armpmu_event_update(event);
264 perf_sample_data_init(&data, 0, hwc->last_period); 264 perf_sample_data_init(&data, 0, hwc->last_period);
265 if (!armpmu_event_set_period(event, hwc, idx)) 265 if (!armpmu_event_set_period(event))
266 continue; 266 continue;
267 267
268 if (perf_event_overflow(event, &data, regs)) 268 if (perf_event_overflow(event, &data, regs))
269 cpu_pmu->disable(hwc, idx); 269 cpu_pmu->disable(event);
270 } 270 }
271 271
272 irq_work_run(); 272 irq_work_run();
@@ -280,11 +280,13 @@ xscale1pmu_handle_irq(int irq_num, void *dev)
280 return IRQ_HANDLED; 280 return IRQ_HANDLED;
281} 281}
282 282
283static void 283static void xscale1pmu_enable_event(struct perf_event *event)
284xscale1pmu_enable_event(struct hw_perf_event *hwc, int idx)
285{ 284{
286 unsigned long val, mask, evt, flags; 285 unsigned long val, mask, evt, flags;
286 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
287 struct hw_perf_event *hwc = &event->hw;
287 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 288 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
289 int idx = hwc->idx;
288 290
289 switch (idx) { 291 switch (idx) {
290 case XSCALE_CYCLE_COUNTER: 292 case XSCALE_CYCLE_COUNTER:
@@ -314,11 +316,13 @@ xscale1pmu_enable_event(struct hw_perf_event *hwc, int idx)
314 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 316 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
315} 317}
316 318
317static void 319static void xscale1pmu_disable_event(struct perf_event *event)
318xscale1pmu_disable_event(struct hw_perf_event *hwc, int idx)
319{ 320{
320 unsigned long val, mask, evt, flags; 321 unsigned long val, mask, evt, flags;
322 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
323 struct hw_perf_event *hwc = &event->hw;
321 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 324 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
325 int idx = hwc->idx;
322 326
323 switch (idx) { 327 switch (idx) {
324 case XSCALE_CYCLE_COUNTER: 328 case XSCALE_CYCLE_COUNTER:
@@ -348,9 +352,10 @@ xscale1pmu_disable_event(struct hw_perf_event *hwc, int idx)
348 352
349static int 353static int
350xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc, 354xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc,
351 struct hw_perf_event *event) 355 struct perf_event *event)
352{ 356{
353 if (XSCALE_PERFCTR_CCNT == event->config_base) { 357 struct hw_perf_event *hwc = &event->hw;
358 if (XSCALE_PERFCTR_CCNT == hwc->config_base) {
354 if (test_and_set_bit(XSCALE_CYCLE_COUNTER, cpuc->used_mask)) 359 if (test_and_set_bit(XSCALE_CYCLE_COUNTER, cpuc->used_mask))
355 return -EAGAIN; 360 return -EAGAIN;
356 361
@@ -366,8 +371,7 @@ xscale1pmu_get_event_idx(struct pmu_hw_events *cpuc,
366 } 371 }
367} 372}
368 373
369static void 374static void xscale1pmu_start(struct arm_pmu *cpu_pmu)
370xscale1pmu_start(void)
371{ 375{
372 unsigned long flags, val; 376 unsigned long flags, val;
373 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 377 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -379,8 +383,7 @@ xscale1pmu_start(void)
379 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 383 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
380} 384}
381 385
382static void 386static void xscale1pmu_stop(struct arm_pmu *cpu_pmu)
383xscale1pmu_stop(void)
384{ 387{
385 unsigned long flags, val; 388 unsigned long flags, val;
386 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 389 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -392,9 +395,10 @@ xscale1pmu_stop(void)
392 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 395 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
393} 396}
394 397
395static inline u32 398static inline u32 xscale1pmu_read_counter(struct perf_event *event)
396xscale1pmu_read_counter(int counter)
397{ 399{
400 struct hw_perf_event *hwc = &event->hw;
401 int counter = hwc->idx;
398 u32 val = 0; 402 u32 val = 0;
399 403
400 switch (counter) { 404 switch (counter) {
@@ -412,9 +416,11 @@ xscale1pmu_read_counter(int counter)
412 return val; 416 return val;
413} 417}
414 418
415static inline void 419static inline void xscale1pmu_write_counter(struct perf_event *event, u32 val)
416xscale1pmu_write_counter(int counter, u32 val)
417{ 420{
421 struct hw_perf_event *hwc = &event->hw;
422 int counter = hwc->idx;
423
418 switch (counter) { 424 switch (counter) {
419 case XSCALE_CYCLE_COUNTER: 425 case XSCALE_CYCLE_COUNTER:
420 asm volatile("mcr p14, 0, %0, c1, c0, 0" : : "r" (val)); 426 asm volatile("mcr p14, 0, %0, c1, c0, 0" : : "r" (val));
@@ -434,24 +440,22 @@ static int xscale_map_event(struct perf_event *event)
434 &xscale_perf_cache_map, 0xFF); 440 &xscale_perf_cache_map, 0xFF);
435} 441}
436 442
437static struct arm_pmu xscale1pmu = { 443static int __devinit xscale1pmu_init(struct arm_pmu *cpu_pmu)
438 .name = "xscale1",
439 .handle_irq = xscale1pmu_handle_irq,
440 .enable = xscale1pmu_enable_event,
441 .disable = xscale1pmu_disable_event,
442 .read_counter = xscale1pmu_read_counter,
443 .write_counter = xscale1pmu_write_counter,
444 .get_event_idx = xscale1pmu_get_event_idx,
445 .start = xscale1pmu_start,
446 .stop = xscale1pmu_stop,
447 .map_event = xscale_map_event,
448 .num_events = 3,
449 .max_period = (1LLU << 32) - 1,
450};
451
452static struct arm_pmu *__devinit xscale1pmu_init(void)
453{ 444{
454 return &xscale1pmu; 445 cpu_pmu->name = "xscale1";
446 cpu_pmu->handle_irq = xscale1pmu_handle_irq;
447 cpu_pmu->enable = xscale1pmu_enable_event;
448 cpu_pmu->disable = xscale1pmu_disable_event;
449 cpu_pmu->read_counter = xscale1pmu_read_counter;
450 cpu_pmu->write_counter = xscale1pmu_write_counter;
451 cpu_pmu->get_event_idx = xscale1pmu_get_event_idx;
452 cpu_pmu->start = xscale1pmu_start;
453 cpu_pmu->stop = xscale1pmu_stop;
454 cpu_pmu->map_event = xscale_map_event;
455 cpu_pmu->num_events = 3;
456 cpu_pmu->max_period = (1LLU << 32) - 1;
457
458 return 0;
455} 459}
456 460
457#define XSCALE2_OVERFLOWED_MASK 0x01f 461#define XSCALE2_OVERFLOWED_MASK 0x01f
@@ -567,7 +571,8 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
567{ 571{
568 unsigned long pmnc, of_flags; 572 unsigned long pmnc, of_flags;
569 struct perf_sample_data data; 573 struct perf_sample_data data;
570 struct pmu_hw_events *cpuc; 574 struct arm_pmu *cpu_pmu = (struct arm_pmu *)dev;
575 struct pmu_hw_events *cpuc = cpu_pmu->get_hw_events();
571 struct pt_regs *regs; 576 struct pt_regs *regs;
572 int idx; 577 int idx;
573 578
@@ -585,7 +590,6 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
585 590
586 regs = get_irq_regs(); 591 regs = get_irq_regs();
587 592
588 cpuc = &__get_cpu_var(cpu_hw_events);
589 for (idx = 0; idx < cpu_pmu->num_events; ++idx) { 593 for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
590 struct perf_event *event = cpuc->events[idx]; 594 struct perf_event *event = cpuc->events[idx];
591 struct hw_perf_event *hwc; 595 struct hw_perf_event *hwc;
@@ -597,13 +601,13 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
597 continue; 601 continue;
598 602
599 hwc = &event->hw; 603 hwc = &event->hw;
600 armpmu_event_update(event, hwc, idx); 604 armpmu_event_update(event);
601 perf_sample_data_init(&data, 0, hwc->last_period); 605 perf_sample_data_init(&data, 0, hwc->last_period);
602 if (!armpmu_event_set_period(event, hwc, idx)) 606 if (!armpmu_event_set_period(event))
603 continue; 607 continue;
604 608
605 if (perf_event_overflow(event, &data, regs)) 609 if (perf_event_overflow(event, &data, regs))
606 cpu_pmu->disable(hwc, idx); 610 cpu_pmu->disable(event);
607 } 611 }
608 612
609 irq_work_run(); 613 irq_work_run();
@@ -617,11 +621,13 @@ xscale2pmu_handle_irq(int irq_num, void *dev)
617 return IRQ_HANDLED; 621 return IRQ_HANDLED;
618} 622}
619 623
620static void 624static void xscale2pmu_enable_event(struct perf_event *event)
621xscale2pmu_enable_event(struct hw_perf_event *hwc, int idx)
622{ 625{
623 unsigned long flags, ien, evtsel; 626 unsigned long flags, ien, evtsel;
627 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
628 struct hw_perf_event *hwc = &event->hw;
624 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 629 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
630 int idx = hwc->idx;
625 631
626 ien = xscale2pmu_read_int_enable(); 632 ien = xscale2pmu_read_int_enable();
627 evtsel = xscale2pmu_read_event_select(); 633 evtsel = xscale2pmu_read_event_select();
@@ -661,11 +667,13 @@ xscale2pmu_enable_event(struct hw_perf_event *hwc, int idx)
661 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 667 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
662} 668}
663 669
664static void 670static void xscale2pmu_disable_event(struct perf_event *event)
665xscale2pmu_disable_event(struct hw_perf_event *hwc, int idx)
666{ 671{
667 unsigned long flags, ien, evtsel, of_flags; 672 unsigned long flags, ien, evtsel, of_flags;
673 struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu);
674 struct hw_perf_event *hwc = &event->hw;
668 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 675 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
676 int idx = hwc->idx;
669 677
670 ien = xscale2pmu_read_int_enable(); 678 ien = xscale2pmu_read_int_enable();
671 evtsel = xscale2pmu_read_event_select(); 679 evtsel = xscale2pmu_read_event_select();
@@ -713,7 +721,7 @@ xscale2pmu_disable_event(struct hw_perf_event *hwc, int idx)
713 721
714static int 722static int
715xscale2pmu_get_event_idx(struct pmu_hw_events *cpuc, 723xscale2pmu_get_event_idx(struct pmu_hw_events *cpuc,
716 struct hw_perf_event *event) 724 struct perf_event *event)
717{ 725{
718 int idx = xscale1pmu_get_event_idx(cpuc, event); 726 int idx = xscale1pmu_get_event_idx(cpuc, event);
719 if (idx >= 0) 727 if (idx >= 0)
@@ -727,8 +735,7 @@ out:
727 return idx; 735 return idx;
728} 736}
729 737
730static void 738static void xscale2pmu_start(struct arm_pmu *cpu_pmu)
731xscale2pmu_start(void)
732{ 739{
733 unsigned long flags, val; 740 unsigned long flags, val;
734 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 741 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -740,8 +747,7 @@ xscale2pmu_start(void)
740 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 747 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
741} 748}
742 749
743static void 750static void xscale2pmu_stop(struct arm_pmu *cpu_pmu)
744xscale2pmu_stop(void)
745{ 751{
746 unsigned long flags, val; 752 unsigned long flags, val;
747 struct pmu_hw_events *events = cpu_pmu->get_hw_events(); 753 struct pmu_hw_events *events = cpu_pmu->get_hw_events();
@@ -753,9 +759,10 @@ xscale2pmu_stop(void)
753 raw_spin_unlock_irqrestore(&events->pmu_lock, flags); 759 raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
754} 760}
755 761
756static inline u32 762static inline u32 xscale2pmu_read_counter(struct perf_event *event)
757xscale2pmu_read_counter(int counter)
758{ 763{
764 struct hw_perf_event *hwc = &event->hw;
765 int counter = hwc->idx;
759 u32 val = 0; 766 u32 val = 0;
760 767
761 switch (counter) { 768 switch (counter) {
@@ -779,9 +786,11 @@ xscale2pmu_read_counter(int counter)
779 return val; 786 return val;
780} 787}
781 788
782static inline void 789static inline void xscale2pmu_write_counter(struct perf_event *event, u32 val)
783xscale2pmu_write_counter(int counter, u32 val)
784{ 790{
791 struct hw_perf_event *hwc = &event->hw;
792 int counter = hwc->idx;
793
785 switch (counter) { 794 switch (counter) {
786 case XSCALE_CYCLE_COUNTER: 795 case XSCALE_CYCLE_COUNTER:
787 asm volatile("mcr p14, 0, %0, c1, c1, 0" : : "r" (val)); 796 asm volatile("mcr p14, 0, %0, c1, c1, 0" : : "r" (val));
@@ -801,33 +810,31 @@ xscale2pmu_write_counter(int counter, u32 val)
801 } 810 }
802} 811}
803 812
804static struct arm_pmu xscale2pmu = { 813static int __devinit xscale2pmu_init(struct arm_pmu *cpu_pmu)
805 .name = "xscale2",
806 .handle_irq = xscale2pmu_handle_irq,
807 .enable = xscale2pmu_enable_event,
808 .disable = xscale2pmu_disable_event,
809 .read_counter = xscale2pmu_read_counter,
810 .write_counter = xscale2pmu_write_counter,
811 .get_event_idx = xscale2pmu_get_event_idx,
812 .start = xscale2pmu_start,
813 .stop = xscale2pmu_stop,
814 .map_event = xscale_map_event,
815 .num_events = 5,
816 .max_period = (1LLU << 32) - 1,
817};
818
819static struct arm_pmu *__devinit xscale2pmu_init(void)
820{ 814{
821 return &xscale2pmu; 815 cpu_pmu->name = "xscale2";
816 cpu_pmu->handle_irq = xscale2pmu_handle_irq;
817 cpu_pmu->enable = xscale2pmu_enable_event;
818 cpu_pmu->disable = xscale2pmu_disable_event;
819 cpu_pmu->read_counter = xscale2pmu_read_counter;
820 cpu_pmu->write_counter = xscale2pmu_write_counter;
821 cpu_pmu->get_event_idx = xscale2pmu_get_event_idx;
822 cpu_pmu->start = xscale2pmu_start;
823 cpu_pmu->stop = xscale2pmu_stop;
824 cpu_pmu->map_event = xscale_map_event;
825 cpu_pmu->num_events = 5;
826 cpu_pmu->max_period = (1LLU << 32) - 1;
827
828 return 0;
822} 829}
823#else 830#else
824static struct arm_pmu *__devinit xscale1pmu_init(void) 831static inline int xscale1pmu_init(struct arm_pmu *cpu_pmu)
825{ 832{
826 return NULL; 833 return -ENODEV;
827} 834}
828 835
829static struct arm_pmu *__devinit xscale2pmu_init(void) 836static inline int xscale2pmu_init(struct arm_pmu *cpu_pmu)
830{ 837{
831 return NULL; 838 return -ENODEV;
832} 839}
833#endif /* CONFIG_CPU_XSCALE */ 840#endif /* CONFIG_CPU_XSCALE */
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 90084a6de35a..44bc0b327e2b 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -34,6 +34,7 @@
34#include <linux/leds.h> 34#include <linux/leds.h>
35 35
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/idmap.h>
37#include <asm/processor.h> 38#include <asm/processor.h>
38#include <asm/thread_notify.h> 39#include <asm/thread_notify.h>
39#include <asm/stacktrace.h> 40#include <asm/stacktrace.h>
@@ -56,8 +57,6 @@ static const char *isa_modes[] = {
56 "ARM" , "Thumb" , "Jazelle", "ThumbEE" 57 "ARM" , "Thumb" , "Jazelle", "ThumbEE"
57}; 58};
58 59
59extern void setup_mm_for_reboot(void);
60
61static volatile int hlt_counter; 60static volatile int hlt_counter;
62 61
63void disable_hlt(void) 62void disable_hlt(void)
@@ -70,6 +69,7 @@ EXPORT_SYMBOL(disable_hlt);
70void enable_hlt(void) 69void enable_hlt(void)
71{ 70{
72 hlt_counter--; 71 hlt_counter--;
72 BUG_ON(hlt_counter < 0);
73} 73}
74 74
75EXPORT_SYMBOL(enable_hlt); 75EXPORT_SYMBOL(enable_hlt);
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 739db3a1b2d2..03deeffd9f6d 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -916,16 +916,11 @@ enum ptrace_syscall_dir {
916 PTRACE_SYSCALL_EXIT, 916 PTRACE_SYSCALL_EXIT,
917}; 917};
918 918
919static int ptrace_syscall_trace(struct pt_regs *regs, int scno, 919static int tracehook_report_syscall(struct pt_regs *regs,
920 enum ptrace_syscall_dir dir) 920 enum ptrace_syscall_dir dir)
921{ 921{
922 unsigned long ip; 922 unsigned long ip;
923 923
924 current_thread_info()->syscall = scno;
925
926 if (!test_thread_flag(TIF_SYSCALL_TRACE))
927 return scno;
928
929 /* 924 /*
930 * IP is used to denote syscall entry/exit: 925 * IP is used to denote syscall entry/exit:
931 * IP = 0 -> entry, =1 -> exit 926 * IP = 0 -> entry, =1 -> exit
@@ -944,19 +939,41 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
944 939
945asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) 940asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
946{ 941{
947 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); 942 current_thread_info()->syscall = scno;
943
944 /* Do the secure computing check first; failures should be fast. */
945 if (secure_computing(scno) == -1)
946 return -1;
947
948 if (test_thread_flag(TIF_SYSCALL_TRACE))
949 scno = tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
950
948 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 951 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
949 trace_sys_enter(regs, scno); 952 trace_sys_enter(regs, scno);
953
950 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, 954 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
951 regs->ARM_r2, regs->ARM_r3); 955 regs->ARM_r2, regs->ARM_r3);
956
952 return scno; 957 return scno;
953} 958}
954 959
955asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno) 960asmlinkage void syscall_trace_exit(struct pt_regs *regs)
956{ 961{
957 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT); 962 /*
958 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 963 * Audit the syscall before anything else, as a debugger may
959 trace_sys_exit(regs, scno); 964 * come in and change the current registers.
965 */
960 audit_syscall_exit(regs); 966 audit_syscall_exit(regs);
961 return scno; 967
968 /*
969 * Note that we haven't updated the ->syscall field for the
970 * current thread. This isn't a problem because it will have
971 * been set on syscall entry and there hasn't been an opportunity
972 * for a PTRACE_SET_SYSCALL since then.
973 */
974 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
975 trace_sys_exit(regs, regs_return_value(regs));
976
977 if (test_thread_flag(TIF_SYSCALL_TRACE))
978 tracehook_report_syscall(regs, PTRACE_SYSCALL_EXIT);
962} 979}
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index e21bac20d90d..fc6692e2b603 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -107,13 +107,6 @@ static void sched_clock_poll(unsigned long wrap_ticks)
107 update_sched_clock(); 107 update_sched_clock();
108} 108}
109 109
110void __init setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
111 unsigned long rate)
112{
113 setup_sched_clock(read, bits, rate);
114 cd.needs_suspend = true;
115}
116
117void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate) 110void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
118{ 111{
119 unsigned long r, w; 112 unsigned long r, w;
@@ -189,18 +182,15 @@ void __init sched_clock_postinit(void)
189static int sched_clock_suspend(void) 182static int sched_clock_suspend(void)
190{ 183{
191 sched_clock_poll(sched_clock_timer.data); 184 sched_clock_poll(sched_clock_timer.data);
192 if (cd.needs_suspend) 185 cd.suspended = true;
193 cd.suspended = true;
194 return 0; 186 return 0;
195} 187}
196 188
197static void sched_clock_resume(void) 189static void sched_clock_resume(void)
198{ 190{
199 if (cd.needs_suspend) { 191 cd.epoch_cyc = read_sched_clock();
200 cd.epoch_cyc = read_sched_clock(); 192 cd.epoch_cyc_copy = cd.epoch_cyc;
201 cd.epoch_cyc_copy = cd.epoch_cyc; 193 cd.suspended = false;
202 cd.suspended = false;
203 }
204} 194}
205 195
206static struct syscore_ops sched_clock_ops = { 196static struct syscore_ops sched_clock_ops = {
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index da1d1aa20ad9..9a89bf4aefe1 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -383,6 +383,12 @@ void cpu_init(void)
383 BUG(); 383 BUG();
384 } 384 }
385 385
386 /*
387 * This only works on resume and secondary cores. For booting on the
388 * boot cpu, smp_prepare_boot_cpu is called after percpu area setup.
389 */
390 set_my_cpu_offset(per_cpu_offset(cpu));
391
386 cpu_proc_init(); 392 cpu_proc_init();
387 393
388 /* 394 /*
@@ -426,13 +432,14 @@ int __cpu_logical_map[NR_CPUS];
426void __init smp_setup_processor_id(void) 432void __init smp_setup_processor_id(void)
427{ 433{
428 int i; 434 int i;
429 u32 cpu = is_smp() ? read_cpuid_mpidr() & 0xff : 0; 435 u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
436 u32 cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
430 437
431 cpu_logical_map(0) = cpu; 438 cpu_logical_map(0) = cpu;
432 for (i = 1; i < NR_CPUS; ++i) 439 for (i = 1; i < nr_cpu_ids; ++i)
433 cpu_logical_map(i) = i == cpu ? 0 : i; 440 cpu_logical_map(i) = i == cpu ? 0 : i;
434 441
435 printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu); 442 printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr);
436} 443}
437 444
438static void __init setup_processor(void) 445static void __init setup_processor(void)
@@ -758,6 +765,7 @@ void __init setup_arch(char **cmdline_p)
758 765
759 unflatten_device_tree(); 766 unflatten_device_tree();
760 767
768 arm_dt_init_cpu_maps();
761#ifdef CONFIG_SMP 769#ifdef CONFIG_SMP
762 if (is_smp()) { 770 if (is_smp()) {
763 smp_set_ops(mdesc->smp); 771 smp_set_ops(mdesc->smp);
@@ -841,12 +849,9 @@ static const char *hwcap_str[] = {
841 849
842static int c_show(struct seq_file *m, void *v) 850static int c_show(struct seq_file *m, void *v)
843{ 851{
844 int i; 852 int i, j;
853 u32 cpuid;
845 854
846 seq_printf(m, "Processor\t: %s rev %d (%s)\n",
847 cpu_name, read_cpuid_id() & 15, elf_platform);
848
849#if defined(CONFIG_SMP)
850 for_each_online_cpu(i) { 855 for_each_online_cpu(i) {
851 /* 856 /*
852 * glibc reads /proc/cpuinfo to determine the number of 857 * glibc reads /proc/cpuinfo to determine the number of
@@ -854,45 +859,48 @@ static int c_show(struct seq_file *m, void *v)
854 * "processor". Give glibc what it expects. 859 * "processor". Give glibc what it expects.
855 */ 860 */
856 seq_printf(m, "processor\t: %d\n", i); 861 seq_printf(m, "processor\t: %d\n", i);
857 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n", 862 cpuid = is_smp() ? per_cpu(cpu_data, i).cpuid : read_cpuid_id();
863 seq_printf(m, "model name\t: %s rev %d (%s)\n",
864 cpu_name, cpuid & 15, elf_platform);
865
866#if defined(CONFIG_SMP)
867 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
858 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ), 868 per_cpu(cpu_data, i).loops_per_jiffy / (500000UL/HZ),
859 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100); 869 (per_cpu(cpu_data, i).loops_per_jiffy / (5000UL/HZ)) % 100);
860 } 870#else
861#else /* CONFIG_SMP */ 871 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
862 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", 872 loops_per_jiffy / (500000/HZ),
863 loops_per_jiffy / (500000/HZ), 873 (loops_per_jiffy / (5000/HZ)) % 100);
864 (loops_per_jiffy / (5000/HZ)) % 100);
865#endif 874#endif
875 /* dump out the processor features */
876 seq_puts(m, "Features\t: ");
866 877
867 /* dump out the processor features */ 878 for (j = 0; hwcap_str[j]; j++)
868 seq_puts(m, "Features\t: "); 879 if (elf_hwcap & (1 << j))
869 880 seq_printf(m, "%s ", hwcap_str[j]);
870 for (i = 0; hwcap_str[i]; i++)
871 if (elf_hwcap & (1 << i))
872 seq_printf(m, "%s ", hwcap_str[i]);
873 881
874 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24); 882 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", cpuid >> 24);
875 seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]); 883 seq_printf(m, "CPU architecture: %s\n",
884 proc_arch[cpu_architecture()]);
876 885
877 if ((read_cpuid_id() & 0x0008f000) == 0x00000000) { 886 if ((cpuid & 0x0008f000) == 0x00000000) {
878 /* pre-ARM7 */ 887 /* pre-ARM7 */
879 seq_printf(m, "CPU part\t: %07x\n", read_cpuid_id() >> 4); 888 seq_printf(m, "CPU part\t: %07x\n", cpuid >> 4);
880 } else {
881 if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
882 /* ARM7 */
883 seq_printf(m, "CPU variant\t: 0x%02x\n",
884 (read_cpuid_id() >> 16) & 127);
885 } else { 889 } else {
886 /* post-ARM7 */ 890 if ((cpuid & 0x0008f000) == 0x00007000) {
887 seq_printf(m, "CPU variant\t: 0x%x\n", 891 /* ARM7 */
888 (read_cpuid_id() >> 20) & 15); 892 seq_printf(m, "CPU variant\t: 0x%02x\n",
893 (cpuid >> 16) & 127);
894 } else {
895 /* post-ARM7 */
896 seq_printf(m, "CPU variant\t: 0x%x\n",
897 (cpuid >> 20) & 15);
898 }
899 seq_printf(m, "CPU part\t: 0x%03x\n",
900 (cpuid >> 4) & 0xfff);
889 } 901 }
890 seq_printf(m, "CPU part\t: 0x%03x\n", 902 seq_printf(m, "CPU revision\t: %d\n\n", cpuid & 15);
891 (read_cpuid_id() >> 4) & 0xfff);
892 } 903 }
893 seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
894
895 seq_puts(m, "\n");
896 904
897 seq_printf(m, "Hardware\t: %s\n", machine_name); 905 seq_printf(m, "Hardware\t: %s\n", machine_name);
898 seq_printf(m, "Revision\t: %04x\n", system_rev); 906 seq_printf(m, "Revision\t: %04x\n", system_rev);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index fbc8b2623d82..84f4cbf652e5 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -281,6 +281,7 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
281 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid); 281 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid);
282 282
283 cpu_info->loops_per_jiffy = loops_per_jiffy; 283 cpu_info->loops_per_jiffy = loops_per_jiffy;
284 cpu_info->cpuid = read_cpuid_id();
284 285
285 store_cpu_topology(cpuid); 286 store_cpu_topology(cpuid);
286} 287}
@@ -313,9 +314,10 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
313 current->active_mm = mm; 314 current->active_mm = mm;
314 cpumask_set_cpu(cpu, mm_cpumask(mm)); 315 cpumask_set_cpu(cpu, mm_cpumask(mm));
315 316
317 cpu_init();
318
316 printk("CPU%u: Booted secondary processor\n", cpu); 319 printk("CPU%u: Booted secondary processor\n", cpu);
317 320
318 cpu_init();
319 preempt_disable(); 321 preempt_disable();
320 trace_hardirqs_off(); 322 trace_hardirqs_off();
321 323
@@ -371,6 +373,7 @@ void __init smp_cpus_done(unsigned int max_cpus)
371 373
372void __init smp_prepare_boot_cpu(void) 374void __init smp_prepare_boot_cpu(void)
373{ 375{
376 set_my_cpu_offset(per_cpu_offset(smp_processor_id()));
374} 377}
375 378
376void __init smp_prepare_cpus(unsigned int max_cpus) 379void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -421,6 +424,11 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask)
421 smp_cross_call(mask, IPI_CALL_FUNC); 424 smp_cross_call(mask, IPI_CALL_FUNC);
422} 425}
423 426
427void arch_send_wakeup_ipi_mask(const struct cpumask *mask)
428{
429 smp_cross_call(mask, IPI_WAKEUP);
430}
431
424void arch_send_call_function_single_ipi(int cpu) 432void arch_send_call_function_single_ipi(int cpu)
425{ 433{
426 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); 434 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE);
@@ -443,7 +451,7 @@ void show_ipi_list(struct seq_file *p, int prec)
443 for (i = 0; i < NR_IPI; i++) { 451 for (i = 0; i < NR_IPI; i++) {
444 seq_printf(p, "%*s%u: ", prec - 1, "IPI", i); 452 seq_printf(p, "%*s%u: ", prec - 1, "IPI", i);
445 453
446 for_each_present_cpu(cpu) 454 for_each_online_cpu(cpu)
447 seq_printf(p, "%10u ", 455 seq_printf(p, "%10u ",
448 __get_irq_stat(cpu, ipi_irqs[i])); 456 __get_irq_stat(cpu, ipi_irqs[i]));
449 457
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index b22d700fea27..ff07879ad95d 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -31,6 +31,8 @@ static void __iomem *twd_base;
31 31
32static struct clk *twd_clk; 32static struct clk *twd_clk;
33static unsigned long twd_timer_rate; 33static unsigned long twd_timer_rate;
34static bool common_setup_called;
35static DEFINE_PER_CPU(bool, percpu_setup_called);
34 36
35static struct clock_event_device __percpu **twd_evt; 37static struct clock_event_device __percpu **twd_evt;
36static int twd_ppi; 38static int twd_ppi;
@@ -248,17 +250,9 @@ static struct clk *twd_get_clock(void)
248 return clk; 250 return clk;
249 } 251 }
250 252
251 err = clk_prepare(clk); 253 err = clk_prepare_enable(clk);
252 if (err) { 254 if (err) {
253 pr_err("smp_twd: clock failed to prepare: %d\n", err); 255 pr_err("smp_twd: clock failed to prepare+enable: %d\n", err);
254 clk_put(clk);
255 return ERR_PTR(err);
256 }
257
258 err = clk_enable(clk);
259 if (err) {
260 pr_err("smp_twd: clock failed to enable: %d\n", err);
261 clk_unprepare(clk);
262 clk_put(clk); 256 clk_put(clk);
263 return ERR_PTR(err); 257 return ERR_PTR(err);
264 } 258 }
@@ -272,15 +266,45 @@ static struct clk *twd_get_clock(void)
272static int __cpuinit twd_timer_setup(struct clock_event_device *clk) 266static int __cpuinit twd_timer_setup(struct clock_event_device *clk)
273{ 267{
274 struct clock_event_device **this_cpu_clk; 268 struct clock_event_device **this_cpu_clk;
269 int cpu = smp_processor_id();
270
271 /*
272 * If the basic setup for this CPU has been done before don't
273 * bother with the below.
274 */
275 if (per_cpu(percpu_setup_called, cpu)) {
276 __raw_writel(0, twd_base + TWD_TIMER_CONTROL);
277 clockevents_register_device(*__this_cpu_ptr(twd_evt));
278 enable_percpu_irq(clk->irq, 0);
279 return 0;
280 }
281 per_cpu(percpu_setup_called, cpu) = true;
275 282
276 if (!twd_clk) 283 /*
284 * This stuff only need to be done once for the entire TWD cluster
285 * during the runtime of the system.
286 */
287 if (!common_setup_called) {
277 twd_clk = twd_get_clock(); 288 twd_clk = twd_get_clock();
278 289
279 if (!IS_ERR_OR_NULL(twd_clk)) 290 /*
280 twd_timer_rate = clk_get_rate(twd_clk); 291 * We use IS_ERR_OR_NULL() here, because if the clock stubs
281 else 292 * are active we will get a valid clk reference which is
282 twd_calibrate_rate(); 293 * however NULL and will return the rate 0. In that case we
294 * need to calibrate the rate instead.
295 */
296 if (!IS_ERR_OR_NULL(twd_clk))
297 twd_timer_rate = clk_get_rate(twd_clk);
298 else
299 twd_calibrate_rate();
300
301 common_setup_called = true;
302 }
283 303
304 /*
305 * The following is done once per CPU the first time .setup() is
306 * called.
307 */
284 __raw_writel(0, twd_base + TWD_TIMER_CONTROL); 308 __raw_writel(0, twd_base + TWD_TIMER_CONTROL);
285 309
286 clk->name = "local_timer"; 310 clk->name = "local_timer";
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 26c12c6440fc..79282ebcd939 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -196,32 +196,7 @@ static inline void parse_dt_topology(void) {}
196static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {} 196static inline void update_cpu_power(unsigned int cpuid, unsigned int mpidr) {}
197#endif 197#endif
198 198
199 199 /*
200/*
201 * cpu topology management
202 */
203
204#define MPIDR_SMP_BITMASK (0x3 << 30)
205#define MPIDR_SMP_VALUE (0x2 << 30)
206
207#define MPIDR_MT_BITMASK (0x1 << 24)
208
209/*
210 * These masks reflect the current use of the affinity levels.
211 * The affinity level can be up to 16 bits according to ARM ARM
212 */
213#define MPIDR_HWID_BITMASK 0xFFFFFF
214
215#define MPIDR_LEVEL0_MASK 0x3
216#define MPIDR_LEVEL0_SHIFT 0
217
218#define MPIDR_LEVEL1_MASK 0xF
219#define MPIDR_LEVEL1_SHIFT 8
220
221#define MPIDR_LEVEL2_MASK 0xFF
222#define MPIDR_LEVEL2_SHIFT 16
223
224/*
225 * cpu topology table 200 * cpu topology table
226 */ 201 */
227struct cputopo_arm cpu_topology[NR_CPUS]; 202struct cputopo_arm cpu_topology[NR_CPUS];
@@ -282,19 +257,14 @@ void store_cpu_topology(unsigned int cpuid)
282 257
283 if (mpidr & MPIDR_MT_BITMASK) { 258 if (mpidr & MPIDR_MT_BITMASK) {
284 /* core performance interdependency */ 259 /* core performance interdependency */
285 cpuid_topo->thread_id = (mpidr >> MPIDR_LEVEL0_SHIFT) 260 cpuid_topo->thread_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
286 & MPIDR_LEVEL0_MASK; 261 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
287 cpuid_topo->core_id = (mpidr >> MPIDR_LEVEL1_SHIFT) 262 cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL(mpidr, 2);
288 & MPIDR_LEVEL1_MASK;
289 cpuid_topo->socket_id = (mpidr >> MPIDR_LEVEL2_SHIFT)
290 & MPIDR_LEVEL2_MASK;
291 } else { 263 } else {
292 /* largely independent cores */ 264 /* largely independent cores */
293 cpuid_topo->thread_id = -1; 265 cpuid_topo->thread_id = -1;
294 cpuid_topo->core_id = (mpidr >> MPIDR_LEVEL0_SHIFT) 266 cpuid_topo->core_id = MPIDR_AFFINITY_LEVEL(mpidr, 0);
295 & MPIDR_LEVEL0_MASK; 267 cpuid_topo->socket_id = MPIDR_AFFINITY_LEVEL(mpidr, 1);
296 cpuid_topo->socket_id = (mpidr >> MPIDR_LEVEL1_SHIFT)
297 & MPIDR_LEVEL1_MASK;
298 } 268 }
299 } else { 269 } else {
300 /* 270 /*
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 36ff15bbfdd4..b9f38e388b43 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -114,6 +114,15 @@ SECTIONS
114 114
115 RO_DATA(PAGE_SIZE) 115 RO_DATA(PAGE_SIZE)
116 116
117 . = ALIGN(4);
118 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
119 __start___ex_table = .;
120#ifdef CONFIG_MMU
121 *(__ex_table)
122#endif
123 __stop___ex_table = .;
124 }
125
117#ifdef CONFIG_ARM_UNWIND 126#ifdef CONFIG_ARM_UNWIND
118 /* 127 /*
119 * Stack unwinding tables 128 * Stack unwinding tables
@@ -220,16 +229,6 @@ SECTIONS
220 READ_MOSTLY_DATA(L1_CACHE_BYTES) 229 READ_MOSTLY_DATA(L1_CACHE_BYTES)
221 230
222 /* 231 /*
223 * The exception fixup table (might need resorting at runtime)
224 */
225 . = ALIGN(4);
226 __start___ex_table = .;
227#ifdef CONFIG_MMU
228 *(__ex_table)
229#endif
230 __stop___ex_table = .;
231
232 /*
233 * and the usual data section 232 * and the usual data section
234 */ 233 */
235 DATA_DATA 234 DATA_DATA
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 043624219b55..e34c1bdb804d 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -494,8 +494,17 @@ endif
494 494
495comment "Generic Board Type" 495comment "Generic Board Type"
496 496
497config MACH_AT91RM9200_DT
498 bool "Atmel AT91RM9200 Evaluation Kits with device-tree support"
499 depends on SOC_AT91RM9200
500 select USE_OF
501 help
502 Select this if you want to experiment device-tree with
503 an Atmel RM9200 Evaluation Kit.
504
497config MACH_AT91SAM_DT 505config MACH_AT91SAM_DT
498 bool "Atmel AT91SAM Evaluation Kits with device-tree support" 506 bool "Atmel AT91SAM Evaluation Kits with device-tree support"
507 depends on SOC_AT91SAM9
499 select USE_OF 508 select USE_OF
500 help 509 help
501 Select this if you want to experiment device-tree with 510 Select this if you want to experiment device-tree with
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 3bb7a51efc9d..b38a1dcb79b8 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -88,6 +88,7 @@ obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
88obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o 88obj-$(CONFIG_MACH_AT91SAM9M10G45EK) += board-sam9m10g45ek.o
89 89
90# AT91SAM board with device-tree 90# AT91SAM board with device-tree
91obj-$(CONFIG_MACH_AT91RM9200_DT) += board-rm9200-dt.o
91obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o 92obj-$(CONFIG_MACH_AT91SAM_DT) += board-dt.o
92 93
93# AT91X40 board-specific support 94# AT91X40 board-specific support
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index aeac7cfc0313..8ce068240c69 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -194,6 +194,24 @@ static struct clk_lookup periph_clocks_lookups[] = {
194 CLKDEV_CON_ID("pioB", &pioB_clk), 194 CLKDEV_CON_ID("pioB", &pioB_clk),
195 CLKDEV_CON_ID("pioC", &pioC_clk), 195 CLKDEV_CON_ID("pioC", &pioC_clk),
196 CLKDEV_CON_ID("pioD", &pioD_clk), 196 CLKDEV_CON_ID("pioD", &pioD_clk),
197 /* usart lookup table for DT entries */
198 CLKDEV_CON_DEV_ID("usart", "fffff200.serial", &mck),
199 CLKDEV_CON_DEV_ID("usart", "fffc0000.serial", &usart0_clk),
200 CLKDEV_CON_DEV_ID("usart", "fffc4000.serial", &usart1_clk),
201 CLKDEV_CON_DEV_ID("usart", "fffc8000.serial", &usart2_clk),
202 CLKDEV_CON_DEV_ID("usart", "fffcc000.serial", &usart3_clk),
203 /* tc lookup table for DT entries */
204 CLKDEV_CON_DEV_ID("t0_clk", "fffa0000.timer", &tc0_clk),
205 CLKDEV_CON_DEV_ID("t1_clk", "fffa0000.timer", &tc1_clk),
206 CLKDEV_CON_DEV_ID("t2_clk", "fffa0000.timer", &tc2_clk),
207 CLKDEV_CON_DEV_ID("t0_clk", "fffa4000.timer", &tc3_clk),
208 CLKDEV_CON_DEV_ID("t1_clk", "fffa4000.timer", &tc4_clk),
209 CLKDEV_CON_DEV_ID("t2_clk", "fffa4000.timer", &tc5_clk),
210 CLKDEV_CON_DEV_ID("hclk", "300000.ohci", &ohci_clk),
211 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
212 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
213 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
214 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioD_clk),
197}; 215};
198 216
199static struct clk_lookup usart_clocks_lookups[] = { 217static struct clk_lookup usart_clocks_lookups[] = {
@@ -361,10 +379,10 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
361 0 /* Advanced Interrupt Controller (IRQ6) */ 379 0 /* Advanced Interrupt Controller (IRQ6) */
362}; 380};
363 381
364struct at91_init_soc __initdata at91rm9200_soc = { 382AT91_SOC_START(rm9200)
365 .map_io = at91rm9200_map_io, 383 .map_io = at91rm9200_map_io,
366 .default_irq_priority = at91rm9200_default_irq_priority, 384 .default_irq_priority = at91rm9200_default_irq_priority,
367 .ioremap_registers = at91rm9200_ioremap_registers, 385 .ioremap_registers = at91rm9200_ioremap_registers,
368 .register_clocks = at91rm9200_register_clocks, 386 .register_clocks = at91rm9200_register_clocks,
369 .init = at91rm9200_initialize, 387 .init = at91rm9200_initialize,
370}; 388AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 94bbf7dedb09..2a1f8e67683d 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -68,7 +68,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
68 68
69 /* Enable overcurrent notification */ 69 /* Enable overcurrent notification */
70 for (i = 0; i < data->ports; i++) { 70 for (i = 0; i < data->ports; i++) {
71 if (data->overcurrent_pin[i]) 71 if (gpio_is_valid(data->overcurrent_pin[i]))
72 at91_set_gpio_input(data->overcurrent_pin[i], 1); 72 at91_set_gpio_input(data->overcurrent_pin[i], 1);
73 } 73 }
74 74
diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index aaa443b48c91..cafe98836c8a 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -24,6 +24,9 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/clockchips.h> 25#include <linux/clockchips.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/of.h>
28#include <linux/of_address.h>
29#include <linux/of_irq.h>
27 30
28#include <asm/mach/time.h> 31#include <asm/mach/time.h>
29 32
@@ -91,7 +94,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
91static struct irqaction at91rm9200_timer_irq = { 94static struct irqaction at91rm9200_timer_irq = {
92 .name = "at91_tick", 95 .name = "at91_tick",
93 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 96 .flags = IRQF_SHARED | IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
94 .handler = at91rm9200_timer_interrupt 97 .handler = at91rm9200_timer_interrupt,
98 .irq = NR_IRQS_LEGACY + AT91_ID_SYS,
95}; 99};
96 100
97static cycle_t read_clk32k(struct clocksource *cs) 101static cycle_t read_clk32k(struct clocksource *cs)
@@ -179,8 +183,60 @@ static struct clock_event_device clkevt = {
179void __iomem *at91_st_base; 183void __iomem *at91_st_base;
180EXPORT_SYMBOL_GPL(at91_st_base); 184EXPORT_SYMBOL_GPL(at91_st_base);
181 185
186#ifdef CONFIG_OF
187static struct of_device_id at91rm9200_st_timer_ids[] = {
188 { .compatible = "atmel,at91rm9200-st" },
189 { /* sentinel */ }
190};
191
192static int __init of_at91rm9200_st_init(void)
193{
194 struct device_node *np;
195 int ret;
196
197 np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
198 if (!np)
199 goto err;
200
201 at91_st_base = of_iomap(np, 0);
202 if (!at91_st_base)
203 goto node_err;
204
205 /* Get the interrupts property */
206 ret = irq_of_parse_and_map(np, 0);
207 if (!ret)
208 goto ioremap_err;
209 at91rm9200_timer_irq.irq = ret;
210
211 of_node_put(np);
212
213 return 0;
214
215ioremap_err:
216 iounmap(at91_st_base);
217node_err:
218 of_node_put(np);
219err:
220 return -EINVAL;
221}
222#else
223static int __init of_at91rm9200_st_init(void)
224{
225 return -EINVAL;
226}
227#endif
228
182void __init at91rm9200_ioremap_st(u32 addr) 229void __init at91rm9200_ioremap_st(u32 addr)
183{ 230{
231#ifdef CONFIG_OF
232 struct device_node *np;
233
234 np = of_find_matching_node(NULL, at91rm9200_st_timer_ids);
235 if (np) {
236 of_node_put(np);
237 return;
238 }
239#endif
184 at91_st_base = ioremap(addr, 256); 240 at91_st_base = ioremap(addr, 256);
185 if (!at91_st_base) 241 if (!at91_st_base)
186 panic("Impossible to ioremap ST\n"); 242 panic("Impossible to ioremap ST\n");
@@ -191,13 +247,16 @@ void __init at91rm9200_ioremap_st(u32 addr)
191 */ 247 */
192void __init at91rm9200_timer_init(void) 248void __init at91rm9200_timer_init(void)
193{ 249{
250 /* For device tree enabled device: initialize here */
251 of_at91rm9200_st_init();
252
194 /* Disable all timer interrupts, and clear any pending ones */ 253 /* Disable all timer interrupts, and clear any pending ones */
195 at91_st_write(AT91_ST_IDR, 254 at91_st_write(AT91_ST_IDR,
196 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); 255 AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
197 at91_st_read(AT91_ST_SR); 256 at91_st_read(AT91_ST_SR);
198 257
199 /* Make IRQs happen for the system timer */ 258 /* Make IRQs happen for the system timer */
200 setup_irq(NR_IRQS_LEGACY + AT91_ID_SYS, &at91rm9200_timer_irq); 259 setup_irq(at91rm9200_timer_irq.irq, &at91rm9200_timer_irq);
201 260
202 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used 261 /* The 32KiHz "Slow Clock" (tick every 30517.58 nanoseconds) is used
203 * directly for the clocksource and all clockevents, after adjusting 262 * directly for the clocksource and all clockevents, after adjusting
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 99429849f780..c65e7b8d7a81 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -230,11 +230,15 @@ static struct clk_lookup periph_clocks_lookups[] = {
230 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk), 230 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
231 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk), 231 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
232 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk), 232 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
233 CLKDEV_CON_DEV_ID("mci_clk", "fffa8000.mmc", &mmc_clk),
233 /* fake hclk clock */ 234 /* fake hclk clock */
234 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 235 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
235 CLKDEV_CON_ID("pioA", &pioA_clk), 236 CLKDEV_CON_ID("pioA", &pioA_clk),
236 CLKDEV_CON_ID("pioB", &pioB_clk), 237 CLKDEV_CON_ID("pioB", &pioB_clk),
237 CLKDEV_CON_ID("pioC", &pioC_clk), 238 CLKDEV_CON_ID("pioC", &pioC_clk),
239 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioA_clk),
240 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioB_clk),
241 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioC_clk),
238}; 242};
239 243
240static struct clk_lookup usart_clocks_lookups[] = { 244static struct clk_lookup usart_clocks_lookups[] = {
@@ -390,10 +394,10 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
390 0, /* Advanced Interrupt Controller */ 394 0, /* Advanced Interrupt Controller */
391}; 395};
392 396
393struct at91_init_soc __initdata at91sam9260_soc = { 397AT91_SOC_START(sam9260)
394 .map_io = at91sam9260_map_io, 398 .map_io = at91sam9260_map_io,
395 .default_irq_priority = at91sam9260_default_irq_priority, 399 .default_irq_priority = at91sam9260_default_irq_priority,
396 .ioremap_registers = at91sam9260_ioremap_registers, 400 .ioremap_registers = at91sam9260_ioremap_registers,
397 .register_clocks = at91sam9260_register_clocks, 401 .register_clocks = at91sam9260_register_clocks,
398 .init = at91sam9260_initialize, 402 .init = at91sam9260_initialize,
399}; 403AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 2670bac7d984..1f6fac21b2c8 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -72,7 +72,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
72 72
73 /* Enable overcurrent notification */ 73 /* Enable overcurrent notification */
74 for (i = 0; i < data->ports; i++) { 74 for (i = 0; i < data->ports; i++) {
75 if (data->overcurrent_pin[i]) 75 if (gpio_is_valid(data->overcurrent_pin[i]))
76 at91_set_gpio_input(data->overcurrent_pin[i], 1); 76 at91_set_gpio_input(data->overcurrent_pin[i], 1);
77 } 77 }
78 78
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index c583ba224622..9d3e9b8b9926 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -334,10 +334,10 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
334 0, /* Advanced Interrupt Controller */ 334 0, /* Advanced Interrupt Controller */
335}; 335};
336 336
337struct at91_init_soc __initdata at91sam9261_soc = { 337AT91_SOC_START(sam9261)
338 .map_io = at91sam9261_map_io, 338 .map_io = at91sam9261_map_io,
339 .default_irq_priority = at91sam9261_default_irq_priority, 339 .default_irq_priority = at91sam9261_default_irq_priority,
340 .ioremap_registers = at91sam9261_ioremap_registers, 340 .ioremap_registers = at91sam9261_ioremap_registers,
341 .register_clocks = at91sam9261_register_clocks, 341 .register_clocks = at91sam9261_register_clocks,
342 .init = at91sam9261_initialize, 342 .init = at91sam9261_initialize,
343}; 343AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index a3c0d976ad78..6ce6d27e2442 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -72,7 +72,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
72 72
73 /* Enable overcurrent notification */ 73 /* Enable overcurrent notification */
74 for (i = 0; i < data->ports; i++) { 74 for (i = 0; i < data->ports; i++) {
75 if (data->overcurrent_pin[i]) 75 if (gpio_is_valid(data->overcurrent_pin[i]))
76 at91_set_gpio_input(data->overcurrent_pin[i], 1); 76 at91_set_gpio_input(data->overcurrent_pin[i], 1);
77 } 77 }
78 78
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 500ee19eaac9..82deb4d748b2 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -211,7 +211,14 @@ static struct clk_lookup periph_clocks_lookups[] = {
211 CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk), 211 CLKDEV_CON_DEV_ID("hclk", "a00000.ohci", &ohci_clk),
212 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk), 212 CLKDEV_CON_DEV_ID("spi_clk", "fffa4000.spi", &spi0_clk),
213 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk), 213 CLKDEV_CON_DEV_ID("spi_clk", "fffa8000.spi", &spi1_clk),
214 CLKDEV_CON_DEV_ID("mci_clk", "fff80000.mmc", &mmc0_clk),
215 CLKDEV_CON_DEV_ID("mci_clk", "fff84000.mmc", &mmc1_clk),
214 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk), 216 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi_clk),
217 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
218 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
219 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioCDE_clk),
220 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCDE_clk),
221 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCDE_clk),
215}; 222};
216 223
217static struct clk_lookup usart_clocks_lookups[] = { 224static struct clk_lookup usart_clocks_lookups[] = {
@@ -365,10 +372,10 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
365 0, /* Advanced Interrupt Controller (IRQ1) */ 372 0, /* Advanced Interrupt Controller (IRQ1) */
366}; 373};
367 374
368struct at91_init_soc __initdata at91sam9263_soc = { 375AT91_SOC_START(sam9263)
369 .map_io = at91sam9263_map_io, 376 .map_io = at91sam9263_map_io,
370 .default_irq_priority = at91sam9263_default_irq_priority, 377 .default_irq_priority = at91sam9263_default_irq_priority,
371 .ioremap_registers = at91sam9263_ioremap_registers, 378 .ioremap_registers = at91sam9263_ioremap_registers,
372 .register_clocks = at91sam9263_register_clocks, 379 .register_clocks = at91sam9263_register_clocks,
373 .init = at91sam9263_initialize, 380 .init = at91sam9263_initialize,
374}; 381AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 2ad7fea02535..fb98163b9b3a 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -78,7 +78,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
78 78
79 /* Enable overcurrent notification */ 79 /* Enable overcurrent notification */
80 for (i = 0; i < data->ports; i++) { 80 for (i = 0; i < data->ports; i++) {
81 if (data->overcurrent_pin[i]) 81 if (gpio_is_valid(data->overcurrent_pin[i]))
82 at91_set_gpio_input(data->overcurrent_pin[i], 1); 82 at91_set_gpio_input(data->overcurrent_pin[i], 1);
83 } 83 }
84 84
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 098fe16448c3..c754b75ffc27 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -256,10 +256,18 @@ static struct clk_lookup periph_clocks_lookups[] = {
256 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk), 256 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
257 CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk), 257 CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
258 CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk), 258 CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
259 CLKDEV_CON_DEV_ID("mci_clk", "fff80000.mmc", &mmc0_clk),
260 CLKDEV_CON_DEV_ID("mci_clk", "fffd0000.mmc", &mmc1_clk),
259 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk), 261 CLKDEV_CON_DEV_ID(NULL, "fff84000.i2c", &twi0_clk),
260 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk), 262 CLKDEV_CON_DEV_ID(NULL, "fff88000.i2c", &twi1_clk),
261 /* fake hclk clock */ 263 /* fake hclk clock */
262 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), 264 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
265 CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk),
266 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk),
267 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk),
268 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioDE_clk),
269 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioDE_clk),
270
263 CLKDEV_CON_ID("pioA", &pioA_clk), 271 CLKDEV_CON_ID("pioA", &pioA_clk),
264 CLKDEV_CON_ID("pioB", &pioB_clk), 272 CLKDEV_CON_ID("pioB", &pioB_clk),
265 CLKDEV_CON_ID("pioC", &pioC_clk), 273 CLKDEV_CON_ID("pioC", &pioC_clk),
@@ -409,10 +417,10 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
409 0, /* Advanced Interrupt Controller (IRQ0) */ 417 0, /* Advanced Interrupt Controller (IRQ0) */
410}; 418};
411 419
412struct at91_init_soc __initdata at91sam9g45_soc = { 420AT91_SOC_START(sam9g45)
413 .map_io = at91sam9g45_map_io, 421 .map_io = at91sam9g45_map_io,
414 .default_irq_priority = at91sam9g45_default_irq_priority, 422 .default_irq_priority = at91sam9g45_default_irq_priority,
415 .ioremap_registers = at91sam9g45_ioremap_registers, 423 .ioremap_registers = at91sam9g45_ioremap_registers,
416 .register_clocks = at91sam9g45_register_clocks, 424 .register_clocks = at91sam9g45_register_clocks,
417 .init = at91sam9g45_initialize, 425 .init = at91sam9g45_initialize,
418}; 426AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index ddc3285208f1..e35964201a10 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -1841,8 +1841,8 @@ static struct resource sha_resources[] = {
1841 .flags = IORESOURCE_MEM, 1841 .flags = IORESOURCE_MEM,
1842 }, 1842 },
1843 [1] = { 1843 [1] = {
1844 .start = AT91SAM9G45_ID_AESTDESSHA, 1844 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1845 .end = AT91SAM9G45_ID_AESTDESSHA, 1845 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1846 .flags = IORESOURCE_IRQ, 1846 .flags = IORESOURCE_IRQ,
1847 }, 1847 },
1848}; 1848};
@@ -1874,8 +1874,8 @@ static struct resource tdes_resources[] = {
1874 .flags = IORESOURCE_MEM, 1874 .flags = IORESOURCE_MEM,
1875 }, 1875 },
1876 [1] = { 1876 [1] = {
1877 .start = AT91SAM9G45_ID_AESTDESSHA, 1877 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1878 .end = AT91SAM9G45_ID_AESTDESSHA, 1878 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1879 .flags = IORESOURCE_IRQ, 1879 .flags = IORESOURCE_IRQ,
1880 }, 1880 },
1881}; 1881};
@@ -1910,8 +1910,8 @@ static struct resource aes_resources[] = {
1910 .flags = IORESOURCE_MEM, 1910 .flags = IORESOURCE_MEM,
1911 }, 1911 },
1912 [1] = { 1912 [1] = {
1913 .start = AT91SAM9G45_ID_AESTDESSHA, 1913 .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1914 .end = AT91SAM9G45_ID_AESTDESSHA, 1914 .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1915 .flags = IORESOURCE_IRQ, 1915 .flags = IORESOURCE_IRQ,
1916 }, 1916 },
1917}; 1917};
diff --git a/arch/arm/mach-at91/at91sam9n12.c b/arch/arm/mach-at91/at91sam9n12.c
index 896d09e1d24b..5dfc8fd87103 100644
--- a/arch/arm/mach-at91/at91sam9n12.c
+++ b/arch/arm/mach-at91/at91sam9n12.c
@@ -168,13 +168,14 @@ static struct clk_lookup periph_clocks_lookups[] = {
168 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), 168 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk), 169 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb_clk),
170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk), 170 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb_clk),
171 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc_clk),
171 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk), 172 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma_clk),
172 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 173 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
173 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 174 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
174 CLKDEV_CON_ID("pioA", &pioAB_clk), 175 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
175 CLKDEV_CON_ID("pioB", &pioAB_clk), 176 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
176 CLKDEV_CON_ID("pioC", &pioCD_clk), 177 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
177 CLKDEV_CON_ID("pioD", &pioCD_clk), 178 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCD_clk),
178 /* additional fake clock for macb_hclk */ 179 /* additional fake clock for macb_hclk */
179 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk), 180 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &uhp_clk),
180 CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk), 181 CLKDEV_CON_DEV_ID("ohci_clk", "500000.ohci", &uhp_clk),
@@ -223,13 +224,10 @@ static void __init at91sam9n12_map_io(void)
223void __init at91sam9n12_initialize(void) 224void __init at91sam9n12_initialize(void)
224{ 225{
225 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0); 226 at91_extern_irq = (1 << AT91SAM9N12_ID_IRQ0);
226
227 /* Register GPIO subsystem (using DT) */
228 at91_gpio_init(NULL, 0);
229} 227}
230 228
231struct at91_init_soc __initdata at91sam9n12_soc = { 229AT91_SOC_START(sam9n12)
232 .map_io = at91sam9n12_map_io, 230 .map_io = at91sam9n12_map_io,
233 .register_clocks = at91sam9n12_register_clocks, 231 .register_clocks = at91sam9n12_register_clocks,
234 .init = at91sam9n12_initialize, 232 .init = at91sam9n12_initialize,
235}; 233AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 97dd8f15e09a..44e3a633fda7 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -338,10 +338,10 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
338 0, /* Advanced Interrupt Controller */ 338 0, /* Advanced Interrupt Controller */
339}; 339};
340 340
341struct at91_init_soc __initdata at91sam9rl_soc = { 341AT91_SOC_START(sam9rl)
342 .map_io = at91sam9rl_map_io, 342 .map_io = at91sam9rl_map_io,
343 .default_irq_priority = at91sam9rl_default_irq_priority, 343 .default_irq_priority = at91sam9rl_default_irq_priority,
344 .ioremap_registers = at91sam9rl_ioremap_registers, 344 .ioremap_registers = at91sam9rl_ioremap_registers,
345 .register_clocks = at91sam9rl_register_clocks, 345 .register_clocks = at91sam9rl_register_clocks,
346 .init = at91sam9rl_initialize, 346 .init = at91sam9rl_initialize,
347}; 347AT91_SOC_END
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 1d6655193de6..dfb2c0c13fb5 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -229,15 +229,17 @@ static struct clk_lookup periph_clocks_lookups[] = {
229 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), 229 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
230 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk), 230 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
231 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk), 231 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
232 CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc0_clk),
233 CLKDEV_CON_DEV_ID("mci_clk", "f000c000.mmc", &mmc1_clk),
232 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk), 234 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
233 CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk), 235 CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
234 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk), 236 CLKDEV_CON_DEV_ID(NULL, "f8010000.i2c", &twi0_clk),
235 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk), 237 CLKDEV_CON_DEV_ID(NULL, "f8014000.i2c", &twi1_clk),
236 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk), 238 CLKDEV_CON_DEV_ID(NULL, "f8018000.i2c", &twi2_clk),
237 CLKDEV_CON_ID("pioA", &pioAB_clk), 239 CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioAB_clk),
238 CLKDEV_CON_ID("pioB", &pioAB_clk), 240 CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioAB_clk),
239 CLKDEV_CON_ID("pioC", &pioCD_clk), 241 CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioCD_clk),
240 CLKDEV_CON_ID("pioD", &pioCD_clk), 242 CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioCD_clk),
241 /* additional fake clock for macb_hclk */ 243 /* additional fake clock for macb_hclk */
242 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk), 244 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk),
243 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk), 245 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk),
@@ -313,18 +315,11 @@ static void __init at91sam9x5_map_io(void)
313 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); 315 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE);
314} 316}
315 317
316void __init at91sam9x5_initialize(void)
317{
318 /* Register GPIO subsystem (using DT) */
319 at91_gpio_init(NULL, 0);
320}
321
322/* -------------------------------------------------------------------- 318/* --------------------------------------------------------------------
323 * Interrupt initialization 319 * Interrupt initialization
324 * -------------------------------------------------------------------- */ 320 * -------------------------------------------------------------------- */
325 321
326struct at91_init_soc __initdata at91sam9x5_soc = { 322AT91_SOC_START(sam9x5)
327 .map_io = at91sam9x5_map_io, 323 .map_io = at91sam9x5_map_io,
328 .register_clocks = at91sam9x5_register_clocks, 324 .register_clocks = at91sam9x5_register_clocks,
329 .init = at91sam9x5_initialize, 325AT91_SOC_END
330};
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
index 03f028e4d8ce..881170ce61dd 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt.c
@@ -29,8 +29,6 @@
29static const struct of_device_id irq_of_match[] __initconst = { 29static const struct of_device_id irq_of_match[] __initconst = {
30 30
31 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init }, 31 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
32 { .compatible = "atmel,at91rm9200-gpio", .data = at91_gpio_of_irq_setup },
33 { .compatible = "atmel,at91sam9x5-gpio", .data = at91_gpio_of_irq_setup },
34 { /*sentinel*/ } 32 { /*sentinel*/ }
35}; 33};
36 34
diff --git a/arch/arm/mach-at91/board-rm9200-dt.c b/arch/arm/mach-at91/board-rm9200-dt.c
new file mode 100644
index 000000000000..5f9ce3da3fde
--- /dev/null
+++ b/arch/arm/mach-at91/board-rm9200-dt.c
@@ -0,0 +1,57 @@
1/*
2 * Setup code for AT91RM9200 Evaluation Kits with Device Tree support
3 *
4 * Copyright (C) 2011 Atmel,
5 * 2011 Nicolas Ferre <nicolas.ferre@atmel.com>
6 * 2012 Joachim Eastwood <manabian@gmail.com>
7 *
8 * Licensed under GPLv2 or later.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/gpio.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
17#include <linux/of_platform.h>
18
19#include <asm/setup.h>
20#include <asm/irq.h>
21#include <asm/mach/arch.h>
22#include <asm/mach/map.h>
23#include <asm/mach/irq.h>
24
25#include "at91_aic.h"
26#include "generic.h"
27
28
29static const struct of_device_id irq_of_match[] __initconst = {
30 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
31 { /*sentinel*/ }
32};
33
34static void __init at91rm9200_dt_init_irq(void)
35{
36 of_irq_init(irq_of_match);
37}
38
39static void __init at91rm9200_dt_device_init(void)
40{
41 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
42}
43
44static const char *at91rm9200_dt_board_compat[] __initdata = {
45 "atmel,at91rm9200",
46 NULL
47};
48
49DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
50 .timer = &at91rm9200_timer,
51 .map_io = at91_map_io,
52 .handle_irq = at91_aic_handle_irq,
53 .init_early = at91rm9200_dt_initialize,
54 .init_irq = at91rm9200_dt_init_irq,
55 .init_machine = at91rm9200_dt_device_init,
56 .dt_compat = at91rm9200_dt_board_compat,
57MACHINE_END
diff --git a/arch/arm/mach-at91/board.h b/arch/arm/mach-at91/board.h
index 662451d85fc9..4a234fb2ab3b 100644
--- a/arch/arm/mach-at91/board.h
+++ b/arch/arm/mach-at91/board.h
@@ -43,16 +43,6 @@ extern void __init at91_add_device_usba(struct usba_platform_data *data);
43extern void __init at91_add_device_cf(struct at91_cf_data *data); 43extern void __init at91_add_device_cf(struct at91_cf_data *data);
44 44
45 /* MMC / SD */ 45 /* MMC / SD */
46 /* at91_mci platform config */
47struct at91_mmc_data {
48 int det_pin; /* card detect IRQ */
49 unsigned slot_b:1; /* uses Slot B */
50 unsigned wire4:1; /* (SD) supports DAT0..DAT3 */
51 int wp_pin; /* (SD) writeprotect detect */
52 int vcc_pin; /* power switching (high == on) */
53};
54extern void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data);
55
56 /* atmel-mci platform config */ 46 /* atmel-mci platform config */
57extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data); 47extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data);
58 48
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index b62f560e6c75..fc593d615e7d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
20extern void __init at91rm9200_set_type(int type); 20extern void __init at91rm9200_set_type(int type);
21extern void __init at91_initialize(unsigned long main_clock); 21extern void __init at91_initialize(unsigned long main_clock);
22extern void __init at91x40_initialize(unsigned long main_clock); 22extern void __init at91x40_initialize(unsigned long main_clock);
23extern void __init at91rm9200_dt_initialize(void);
23extern void __init at91_dt_initialize(void); 24extern void __init at91_dt_initialize(void);
24 25
25 /* Interrupts */ 26 /* Interrupts */
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index be42cf0e74bd..c5d7e1e9d757 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -23,8 +23,6 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/irqdomain.h> 24#include <linux/irqdomain.h>
25#include <linux/of_address.h> 25#include <linux/of_address.h>
26#include <linux/of_irq.h>
27#include <linux/of_gpio.h>
28 26
29#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
30 28
@@ -33,6 +31,8 @@
33 31
34#include "generic.h" 32#include "generic.h"
35 33
34#define MAX_NB_GPIO_PER_BANK 32
35
36struct at91_gpio_chip { 36struct at91_gpio_chip {
37 struct gpio_chip chip; 37 struct gpio_chip chip;
38 struct at91_gpio_chip *next; /* Bank sharing same clock */ 38 struct at91_gpio_chip *next; /* Bank sharing same clock */
@@ -46,6 +46,7 @@ struct at91_gpio_chip {
46 46
47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip) 47#define to_at91_gpio_chip(c) container_of(c, struct at91_gpio_chip, chip)
48 48
49static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset);
49static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip); 50static void at91_gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip);
50static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val); 51static void at91_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val);
51static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset); 52static int at91_gpiolib_get(struct gpio_chip *chip, unsigned offset);
@@ -55,26 +56,27 @@ static int at91_gpiolib_direction_input(struct gpio_chip *chip,
55 unsigned offset); 56 unsigned offset);
56static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset); 57static int at91_gpiolib_to_irq(struct gpio_chip *chip, unsigned offset);
57 58
58#define AT91_GPIO_CHIP(name, nr_gpio) \ 59#define AT91_GPIO_CHIP(name) \
59 { \ 60 { \
60 .chip = { \ 61 .chip = { \
61 .label = name, \ 62 .label = name, \
63 .request = at91_gpiolib_request, \
62 .direction_input = at91_gpiolib_direction_input, \ 64 .direction_input = at91_gpiolib_direction_input, \
63 .direction_output = at91_gpiolib_direction_output, \ 65 .direction_output = at91_gpiolib_direction_output, \
64 .get = at91_gpiolib_get, \ 66 .get = at91_gpiolib_get, \
65 .set = at91_gpiolib_set, \ 67 .set = at91_gpiolib_set, \
66 .dbg_show = at91_gpiolib_dbg_show, \ 68 .dbg_show = at91_gpiolib_dbg_show, \
67 .to_irq = at91_gpiolib_to_irq, \ 69 .to_irq = at91_gpiolib_to_irq, \
68 .ngpio = nr_gpio, \ 70 .ngpio = MAX_NB_GPIO_PER_BANK, \
69 }, \ 71 }, \
70 } 72 }
71 73
72static struct at91_gpio_chip gpio_chip[] = { 74static struct at91_gpio_chip gpio_chip[] = {
73 AT91_GPIO_CHIP("pioA", 32), 75 AT91_GPIO_CHIP("pioA"),
74 AT91_GPIO_CHIP("pioB", 32), 76 AT91_GPIO_CHIP("pioB"),
75 AT91_GPIO_CHIP("pioC", 32), 77 AT91_GPIO_CHIP("pioC"),
76 AT91_GPIO_CHIP("pioD", 32), 78 AT91_GPIO_CHIP("pioD"),
77 AT91_GPIO_CHIP("pioE", 32), 79 AT91_GPIO_CHIP("pioE"),
78}; 80};
79 81
80static int gpio_banks; 82static int gpio_banks;
@@ -89,7 +91,7 @@ static unsigned long at91_gpio_caps;
89 91
90static inline void __iomem *pin_to_controller(unsigned pin) 92static inline void __iomem *pin_to_controller(unsigned pin)
91{ 93{
92 pin /= 32; 94 pin /= MAX_NB_GPIO_PER_BANK;
93 if (likely(pin < gpio_banks)) 95 if (likely(pin < gpio_banks))
94 return gpio_chip[pin].regbase; 96 return gpio_chip[pin].regbase;
95 97
@@ -98,7 +100,7 @@ static inline void __iomem *pin_to_controller(unsigned pin)
98 100
99static inline unsigned pin_to_mask(unsigned pin) 101static inline unsigned pin_to_mask(unsigned pin)
100{ 102{
101 return 1 << (pin % 32); 103 return 1 << (pin % MAX_NB_GPIO_PER_BANK);
102} 104}
103 105
104 106
@@ -713,80 +715,6 @@ postcore_initcall(at91_gpio_debugfs_init);
713 */ 715 */
714static struct lock_class_key gpio_lock_class; 716static struct lock_class_key gpio_lock_class;
715 717
716#if defined(CONFIG_OF)
717static int at91_gpio_irq_map(struct irq_domain *h, unsigned int virq,
718 irq_hw_number_t hw)
719{
720 struct at91_gpio_chip *at91_gpio = h->host_data;
721
722 irq_set_lockdep_class(virq, &gpio_lock_class);
723
724 /*
725 * Can use the "simple" and not "edge" handler since it's
726 * shorter, and the AIC handles interrupts sanely.
727 */
728 irq_set_chip_and_handler(virq, &gpio_irqchip,
729 handle_simple_irq);
730 set_irq_flags(virq, IRQF_VALID);
731 irq_set_chip_data(virq, at91_gpio);
732
733 return 0;
734}
735
736static struct irq_domain_ops at91_gpio_ops = {
737 .map = at91_gpio_irq_map,
738 .xlate = irq_domain_xlate_twocell,
739};
740
741int __init at91_gpio_of_irq_setup(struct device_node *node,
742 struct device_node *parent)
743{
744 struct at91_gpio_chip *prev = NULL;
745 int alias_idx = of_alias_get_id(node, "gpio");
746 struct at91_gpio_chip *at91_gpio = &gpio_chip[alias_idx];
747
748 /* Setup proper .irq_set_type function */
749 if (has_pio3())
750 gpio_irqchip.irq_set_type = alt_gpio_irq_type;
751 else
752 gpio_irqchip.irq_set_type = gpio_irq_type;
753
754 /* Disable irqs of this PIO controller */
755 __raw_writel(~0, at91_gpio->regbase + PIO_IDR);
756
757 /* Setup irq domain */
758 at91_gpio->domain = irq_domain_add_linear(node, at91_gpio->chip.ngpio,
759 &at91_gpio_ops, at91_gpio);
760 if (!at91_gpio->domain)
761 panic("at91_gpio.%d: couldn't allocate irq domain (DT).\n",
762 at91_gpio->pioc_idx);
763
764 /* Setup chained handler */
765 if (at91_gpio->pioc_idx)
766 prev = &gpio_chip[at91_gpio->pioc_idx - 1];
767
768 /* The toplevel handler handles one bank of GPIOs, except
769 * on some SoC it can handles up to three...
770 * We only set up the handler for the first of the list.
771 */
772 if (prev && prev->next == at91_gpio)
773 return 0;
774
775 at91_gpio->pioc_virq = irq_create_mapping(irq_find_host(parent),
776 at91_gpio->pioc_hwirq);
777 irq_set_chip_data(at91_gpio->pioc_virq, at91_gpio);
778 irq_set_chained_handler(at91_gpio->pioc_virq, gpio_irq_handler);
779
780 return 0;
781}
782#else
783int __init at91_gpio_of_irq_setup(struct device_node *node,
784 struct device_node *parent)
785{
786 return -EINVAL;
787}
788#endif
789
790/* 718/*
791 * irqdomain initialization: pile up irqdomains on top of AIC range 719 * irqdomain initialization: pile up irqdomains on top of AIC range
792 */ 720 */
@@ -862,6 +790,16 @@ void __init at91_gpio_irq_setup(void)
862} 790}
863 791
864/* gpiolib support */ 792/* gpiolib support */
793static int at91_gpiolib_request(struct gpio_chip *chip, unsigned offset)
794{
795 struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip);
796 void __iomem *pio = at91_gpio->regbase;
797 unsigned mask = 1 << offset;
798
799 __raw_writel(mask, pio + PIO_PER);
800 return 0;
801}
802
865static int at91_gpiolib_direction_input(struct gpio_chip *chip, 803static int at91_gpiolib_direction_input(struct gpio_chip *chip,
866 unsigned offset) 804 unsigned offset)
867{ 805{
@@ -975,81 +913,11 @@ err:
975 return -EINVAL; 913 return -EINVAL;
976} 914}
977 915
978#ifdef CONFIG_OF_GPIO
979static void __init of_at91_gpio_init_one(struct device_node *np)
980{
981 int alias_idx;
982 struct at91_gpio_chip *at91_gpio;
983
984 if (!np)
985 return;
986
987 alias_idx = of_alias_get_id(np, "gpio");
988 if (alias_idx >= MAX_GPIO_BANKS) {
989 pr_err("at91_gpio, failed alias idx(%d) > MAX_GPIO_BANKS(%d), ignoring.\n",
990 alias_idx, MAX_GPIO_BANKS);
991 return;
992 }
993
994 at91_gpio = &gpio_chip[alias_idx];
995 at91_gpio->chip.base = alias_idx * at91_gpio->chip.ngpio;
996
997 at91_gpio->regbase = of_iomap(np, 0);
998 if (!at91_gpio->regbase) {
999 pr_err("at91_gpio.%d, failed to map registers, ignoring.\n",
1000 alias_idx);
1001 return;
1002 }
1003
1004 /* Get the interrupts property */
1005 if (of_property_read_u32(np, "interrupts", &at91_gpio->pioc_hwirq)) {
1006 pr_err("at91_gpio.%d, failed to get interrupts property, ignoring.\n",
1007 alias_idx);
1008 goto ioremap_err;
1009 }
1010
1011 /* Get capabilities from compatibility property */
1012 if (of_device_is_compatible(np, "atmel,at91sam9x5-gpio"))
1013 at91_gpio_caps |= AT91_GPIO_CAP_PIO3;
1014
1015 /* Setup clock */
1016 if (at91_gpio_setup_clk(alias_idx))
1017 goto ioremap_err;
1018
1019 at91_gpio->chip.of_node = np;
1020 gpio_banks = max(gpio_banks, alias_idx + 1);
1021 at91_gpio->pioc_idx = alias_idx;
1022 return;
1023
1024ioremap_err:
1025 iounmap(at91_gpio->regbase);
1026}
1027
1028static int __init of_at91_gpio_init(void)
1029{
1030 struct device_node *np = NULL;
1031
1032 /*
1033 * This isn't ideal, but it gets things hooked up until this
1034 * driver is converted into a platform_device
1035 */
1036 for_each_compatible_node(np, NULL, "atmel,at91rm9200-gpio")
1037 of_at91_gpio_init_one(np);
1038
1039 return gpio_banks > 0 ? 0 : -EINVAL;
1040}
1041#else
1042static int __init of_at91_gpio_init(void)
1043{
1044 return -EINVAL;
1045}
1046#endif
1047
1048static void __init at91_gpio_init_one(int idx, u32 regbase, int pioc_hwirq) 916static void __init at91_gpio_init_one(int idx, u32 regbase, int pioc_hwirq)
1049{ 917{
1050 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx]; 918 struct at91_gpio_chip *at91_gpio = &gpio_chip[idx];
1051 919
1052 at91_gpio->chip.base = idx * at91_gpio->chip.ngpio; 920 at91_gpio->chip.base = idx * MAX_NB_GPIO_PER_BANK;
1053 at91_gpio->pioc_hwirq = pioc_hwirq; 921 at91_gpio->pioc_hwirq = pioc_hwirq;
1054 at91_gpio->pioc_idx = idx; 922 at91_gpio->pioc_idx = idx;
1055 923
@@ -1079,11 +947,11 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
1079 947
1080 BUG_ON(nr_banks > MAX_GPIO_BANKS); 948 BUG_ON(nr_banks > MAX_GPIO_BANKS);
1081 949
1082 if (of_at91_gpio_init() < 0) { 950 if (of_have_populated_dt())
1083 /* No GPIO controller found in device tree */ 951 return;
1084 for (i = 0; i < nr_banks; i++) 952
1085 at91_gpio_init_one(i, data[i].regbase, data[i].id); 953 for (i = 0; i < nr_banks; i++)
1086 } 954 at91_gpio_init_one(i, data[i].regbase, data[i].id);
1087 955
1088 for (i = 0; i < gpio_banks; i++) { 956 for (i = 0; i < gpio_banks; i++) {
1089 at91_gpio = &gpio_chip[i]; 957 at91_gpio = &gpio_chip[i];
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 8a66979f5611..9ee866ce0478 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -10,6 +10,7 @@
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/of_address.h> 12#include <linux/of_address.h>
13#include <linux/pinctrl/machine.h>
13 14
14#include <asm/system_misc.h> 15#include <asm/system_misc.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
@@ -338,6 +339,7 @@ static void at91_dt_rstc(void)
338} 339}
339 340
340static struct of_device_id ramc_ids[] = { 341static struct of_device_id ramc_ids[] = {
342 { .compatible = "atmel,at91rm9200-sdramc" },
341 { .compatible = "atmel,at91sam9260-sdramc" }, 343 { .compatible = "atmel,at91sam9260-sdramc" },
342 { .compatible = "atmel,at91sam9g45-ddramc" }, 344 { .compatible = "atmel,at91sam9g45-ddramc" },
343 { /*sentinel*/ } 345 { /*sentinel*/ }
@@ -436,6 +438,19 @@ end:
436 of_node_put(np); 438 of_node_put(np);
437} 439}
438 440
441void __init at91rm9200_dt_initialize(void)
442{
443 at91_dt_ramc();
444
445 /* Init clock subsystem */
446 at91_dt_clock_init();
447
448 /* Register the processor-specific clocks */
449 at91_boot_soc.register_clocks();
450
451 at91_boot_soc.init();
452}
453
439void __init at91_dt_initialize(void) 454void __init at91_dt_initialize(void)
440{ 455{
441 at91_dt_rstc(); 456 at91_dt_rstc();
@@ -448,7 +463,8 @@ void __init at91_dt_initialize(void)
448 /* Register the processor-specific clocks */ 463 /* Register the processor-specific clocks */
449 at91_boot_soc.register_clocks(); 464 at91_boot_soc.register_clocks();
450 465
451 at91_boot_soc.init(); 466 if (at91_boot_soc.init)
467 at91_boot_soc.init();
452} 468}
453#endif 469#endif
454 470
@@ -463,4 +479,6 @@ void __init at91_initialize(unsigned long main_clock)
463 at91_boot_soc.register_clocks(); 479 at91_boot_soc.register_clocks();
464 480
465 at91_boot_soc.init(); 481 at91_boot_soc.init();
482
483 pinctrl_provide_dummies();
466} 484}
diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h
index a9cfeb153719..9c6d3d4f9a23 100644
--- a/arch/arm/mach-at91/soc.h
+++ b/arch/arm/mach-at91/soc.h
@@ -5,6 +5,7 @@
5 */ 5 */
6 6
7struct at91_init_soc { 7struct at91_init_soc {
8 int builtin;
8 unsigned int *default_irq_priority; 9 unsigned int *default_irq_priority;
9 void (*map_io)(void); 10 void (*map_io)(void);
10 void (*ioremap_registers)(void); 11 void (*ioremap_registers)(void);
@@ -22,9 +23,18 @@ extern struct at91_init_soc at91sam9rl_soc;
22extern struct at91_init_soc at91sam9x5_soc; 23extern struct at91_init_soc at91sam9x5_soc;
23extern struct at91_init_soc at91sam9n12_soc; 24extern struct at91_init_soc at91sam9n12_soc;
24 25
26#define AT91_SOC_START(_name) \
27struct at91_init_soc __initdata at91##_name##_soc \
28 __used \
29 = { \
30 .builtin = 1, \
31
32#define AT91_SOC_END \
33};
34
25static inline int at91_soc_is_enabled(void) 35static inline int at91_soc_is_enabled(void)
26{ 36{
27 return at91_boot_soc.init != NULL; 37 return at91_boot_soc.builtin;
28} 38}
29 39
30#if !defined(CONFIG_SOC_AT91RM9200) 40#if !defined(CONFIG_SOC_AT91RM9200)
diff --git a/arch/arm/mach-cns3xxx/Kconfig b/arch/arm/mach-cns3xxx/Kconfig
index 29b13f249aa9..9ebfcc46feb1 100644
--- a/arch/arm/mach-cns3xxx/Kconfig
+++ b/arch/arm/mach-cns3xxx/Kconfig
@@ -3,7 +3,6 @@ menu "CNS3XXX platform type"
3 3
4config MACH_CNS3420VB 4config MACH_CNS3420VB
5 bool "Support for CNS3420 Validation Board" 5 bool "Support for CNS3420 Validation Board"
6 select MIGHT_HAVE_PCI
7 help 6 help
8 Include support for the Cavium Networks CNS3420 MPCore Platform 7 Include support for the Cavium Networks CNS3420 MPCore Platform
9 Baseboard. 8 Baseboard.
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 2c5fb4c7e509..ae305397003c 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -24,6 +24,8 @@
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/physmap.h> 25#include <linux/mtd/physmap.h>
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/usb/ehci_pdriver.h>
28#include <linux/usb/ohci_pdriver.h>
27#include <asm/setup.h> 29#include <asm/setup.h>
28#include <asm/mach-types.h> 30#include <asm/mach-types.h>
29#include <asm/hardware/gic.h> 31#include <asm/hardware/gic.h>
@@ -32,6 +34,7 @@
32#include <asm/mach/time.h> 34#include <asm/mach/time.h>
33#include <mach/cns3xxx.h> 35#include <mach/cns3xxx.h>
34#include <mach/irqs.h> 36#include <mach/irqs.h>
37#include <mach/pm.h>
35#include "core.h" 38#include "core.h"
36#include "devices.h" 39#include "devices.h"
37 40
@@ -125,13 +128,52 @@ static struct resource cns3xxx_usb_ehci_resources[] = {
125 128
126static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32); 129static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32);
127 130
131static int csn3xxx_usb_power_on(struct platform_device *pdev)
132{
133 /*
134 * EHCI and OHCI share the same clock and power,
135 * resetting twice would cause the 1st controller been reset.
136 * Therefore only do power up at the first up device, and
137 * power down at the last down device.
138 *
139 * Set USB AHB INCR length to 16
140 */
141 if (atomic_inc_return(&usb_pwr_ref) == 1) {
142 cns3xxx_pwr_power_up(1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB);
143 cns3xxx_pwr_clk_en(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
144 cns3xxx_pwr_soft_rst(1 << PM_SOFT_RST_REG_OFFST_USB_HOST);
145 __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 << 24)),
146 MISC_CHIP_CONFIG_REG);
147 }
148
149 return 0;
150}
151
152static void csn3xxx_usb_power_off(struct platform_device *pdev)
153{
154 /*
155 * EHCI and OHCI share the same clock and power,
156 * resetting twice would cause the 1st controller been reset.
157 * Therefore only do power up at the first up device, and
158 * power down at the last down device.
159 */
160 if (atomic_dec_return(&usb_pwr_ref) == 0)
161 cns3xxx_pwr_clk_dis(1 << PM_CLK_GATE_REG_OFFSET_USB_HOST);
162}
163
164static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = {
165 .power_on = csn3xxx_usb_power_on,
166 .power_off = csn3xxx_usb_power_off,
167};
168
128static struct platform_device cns3xxx_usb_ehci_device = { 169static struct platform_device cns3xxx_usb_ehci_device = {
129 .name = "cns3xxx-ehci", 170 .name = "ehci-platform",
130 .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources), 171 .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources),
131 .resource = cns3xxx_usb_ehci_resources, 172 .resource = cns3xxx_usb_ehci_resources,
132 .dev = { 173 .dev = {
133 .dma_mask = &cns3xxx_usb_ehci_dma_mask, 174 .dma_mask = &cns3xxx_usb_ehci_dma_mask,
134 .coherent_dma_mask = DMA_BIT_MASK(32), 175 .coherent_dma_mask = DMA_BIT_MASK(32),
176 .platform_data = &cns3xxx_usb_ehci_pdata,
135 }, 177 },
136}; 178};
137 179
@@ -149,13 +191,20 @@ static struct resource cns3xxx_usb_ohci_resources[] = {
149 191
150static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32); 192static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32);
151 193
194static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = {
195 .num_ports = 1,
196 .power_on = csn3xxx_usb_power_on,
197 .power_off = csn3xxx_usb_power_off,
198};
199
152static struct platform_device cns3xxx_usb_ohci_device = { 200static struct platform_device cns3xxx_usb_ohci_device = {
153 .name = "cns3xxx-ohci", 201 .name = "ohci-platform",
154 .num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources), 202 .num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources),
155 .resource = cns3xxx_usb_ohci_resources, 203 .resource = cns3xxx_usb_ohci_resources,
156 .dev = { 204 .dev = {
157 .dma_mask = &cns3xxx_usb_ohci_dma_mask, 205 .dma_mask = &cns3xxx_usb_ohci_dma_mask,
158 .coherent_dma_mask = DMA_BIT_MASK(32), 206 .coherent_dma_mask = DMA_BIT_MASK(32),
207 .platform_data = &cns3xxx_usb_ohci_pdata,
159 }, 208 },
160}; 209};
161 210
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index f22572cee49d..f8a99ee6bffc 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -519,13 +519,11 @@ static int dm6444evm_msp430_get_pins(void)
519 char buf[4]; 519 char buf[4];
520 struct i2c_msg msg[2] = { 520 struct i2c_msg msg[2] = {
521 { 521 {
522 .addr = dm6446evm_msp->addr,
523 .flags = 0, 522 .flags = 0,
524 .len = 2, 523 .len = 2,
525 .buf = (void __force *)txbuf, 524 .buf = (void __force *)txbuf,
526 }, 525 },
527 { 526 {
528 .addr = dm6446evm_msp->addr,
529 .flags = I2C_M_RD, 527 .flags = I2C_M_RD,
530 .len = 4, 528 .len = 4,
531 .buf = buf, 529 .buf = buf,
@@ -536,6 +534,9 @@ static int dm6444evm_msp430_get_pins(void)
536 if (!dm6446evm_msp) 534 if (!dm6446evm_msp)
537 return -ENXIO; 535 return -ENXIO;
538 536
537 msg[0].addr = dm6446evm_msp->addr;
538 msg[1].addr = dm6446evm_msp->addr;
539
539 /* Command 4 == get input state, returns port 2 and port3 data 540 /* Command 4 == get input state, returns port 2 and port3 data
540 * S Addr W [A] len=2 [A] cmd=4 [A] 541 * S Addr W [A] len=2 [A] cmd=4 [A]
541 * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P 542 * RS Addr R [A] [len=4] A [cmd=4] A [port2] A [port3] N P
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index 29b17f7d3a5f..773ab07a71a0 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -374,7 +374,7 @@ void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
374 * complete sample conversion in time. 374 * complete sample conversion in time.
375 */ 375 */
376 tsc_clk = clk_get(NULL, "sys_tsc_clk"); 376 tsc_clk = clk_get(NULL, "sys_tsc_clk");
377 if (tsc_clk) { 377 if (!IS_ERR(tsc_clk)) {
378 error = clk_set_rate(tsc_clk, 5000000); 378 error = clk_set_rate(tsc_clk, 5000000);
379 WARN_ON(error < 0); 379 WARN_ON(error < 0);
380 clk_put(tsc_clk); 380 clk_put(tsc_clk);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index cd0c8b1e1ecf..14e9947bad6e 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -713,8 +713,7 @@ static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
713 break; 713 break;
714 case VPBE_ENC_CUSTOM_TIMINGS: 714 case VPBE_ENC_CUSTOM_TIMINGS:
715 if (pclock <= 27000000) { 715 if (pclock <= 27000000) {
716 v |= DM644X_VPSS_MUXSEL_PLL2_MODE | 716 v |= DM644X_VPSS_DACCLKEN;
717 DM644X_VPSS_DACCLKEN;
718 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL)); 717 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
719 } else { 718 } else {
720 /* 719 /*
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index 46b3cd11c3c2..86a01fa6d3fe 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -38,7 +38,7 @@
38 38
39#ifndef __ASSEMBLY__ 39#ifndef __ASSEMBLY__
40struct davinci_uart_config { 40struct davinci_uart_config {
41 /* Bit field of UARTs present; bit 0 --> UART1 */ 41 /* Bit field of UARTs present; bit 0 --> UART0 */
42 unsigned int enabled_uarts; 42 unsigned int enabled_uarts;
43}; 43};
44 44
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 18cfd4977155..3a0ff905a69b 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -32,6 +32,9 @@ u32 *uart;
32/* PORT_16C550A, in polled non-fifo mode */ 32/* PORT_16C550A, in polled non-fifo mode */
33static void putc(char c) 33static void putc(char c)
34{ 34{
35 if (!uart)
36 return;
37
35 while (!(uart[UART_LSR] & UART_LSR_THRE)) 38 while (!(uart[UART_LSR] & UART_LSR_THRE))
36 barrier(); 39 barrier();
37 uart[UART_TX] = c; 40 uart[UART_TX] = c;
@@ -39,6 +42,9 @@ static void putc(char c)
39 42
40static inline void flush(void) 43static inline void flush(void)
41{ 44{
45 if (!uart)
46 return;
47
42 while (!(uart[UART_LSR] & UART_LSR_THRE)) 48 while (!(uart[UART_LSR] & UART_LSR_THRE))
43 barrier(); 49 barrier();
44} 50}
diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 7bcd0dfce4b1..b47f75038686 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -63,7 +63,7 @@ static inline int pmu_to_irq(int pin)
63 63
64static inline int irq_to_pmu(int irq) 64static inline int irq_to_pmu(int irq)
65{ 65{
66 if (IRQ_DOVE_PMU_START < irq && irq < NR_IRQS) 66 if (IRQ_DOVE_PMU_START <= irq && irq < NR_IRQS)
67 return irq - IRQ_DOVE_PMU_START; 67 return irq - IRQ_DOVE_PMU_START;
68 68
69 return -EINVAL; 69 return -EINVAL;
diff --git a/arch/arm/mach-dove/irq.c b/arch/arm/mach-dove/irq.c
index 087711524e8a..bc4344aa1009 100644
--- a/arch/arm/mach-dove/irq.c
+++ b/arch/arm/mach-dove/irq.c
@@ -46,8 +46,20 @@ static void pmu_irq_ack(struct irq_data *d)
46 int pin = irq_to_pmu(d->irq); 46 int pin = irq_to_pmu(d->irq);
47 u32 u; 47 u32 u;
48 48
49 /*
50 * The PMU mask register is not RW0C: it is RW. This means that
51 * the bits take whatever value is written to them; if you write
52 * a '1', you will set the interrupt.
53 *
54 * Unfortunately this means there is NO race free way to clear
55 * these interrupts.
56 *
57 * So, let's structure the code so that the window is as small as
58 * possible.
59 */
49 u = ~(1 << (pin & 31)); 60 u = ~(1 << (pin & 31));
50 writel(u, PMU_INTERRUPT_CAUSE); 61 u &= readl_relaxed(PMU_INTERRUPT_CAUSE);
62 writel_relaxed(u, PMU_INTERRUPT_CAUSE);
51} 63}
52 64
53static struct irq_chip pmu_irq_chip = { 65static struct irq_chip pmu_irq_chip = {
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c
index 21d568b3b149..87e07d6fc615 100644
--- a/arch/arm/mach-exynos/dma.c
+++ b/arch/arm/mach-exynos/dma.c
@@ -275,6 +275,9 @@ static int __init exynos_dma_init(void)
275 exynos_pdma1_pdata.nr_valid_peri = 275 exynos_pdma1_pdata.nr_valid_peri =
276 ARRAY_SIZE(exynos4210_pdma1_peri); 276 ARRAY_SIZE(exynos4210_pdma1_peri);
277 exynos_pdma1_pdata.peri_id = exynos4210_pdma1_peri; 277 exynos_pdma1_pdata.peri_id = exynos4210_pdma1_peri;
278
279 if (samsung_rev() == EXYNOS4210_REV_0)
280 exynos_mdma1_device.res.start = EXYNOS4_PA_S_MDMA1;
278 } else if (soc_is_exynos4212() || soc_is_exynos4412()) { 281 } else if (soc_is_exynos4212() || soc_is_exynos4412()) {
279 exynos_pdma0_pdata.nr_valid_peri = 282 exynos_pdma0_pdata.nr_valid_peri =
280 ARRAY_SIZE(exynos4212_pdma0_peri); 283 ARRAY_SIZE(exynos4212_pdma0_peri);
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 8480849affb9..ed4da4544cd2 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -90,6 +90,7 @@
90 90
91#define EXYNOS4_PA_MDMA0 0x10810000 91#define EXYNOS4_PA_MDMA0 0x10810000
92#define EXYNOS4_PA_MDMA1 0x12850000 92#define EXYNOS4_PA_MDMA1 0x12850000
93#define EXYNOS4_PA_S_MDMA1 0x12840000
93#define EXYNOS4_PA_PDMA0 0x12680000 94#define EXYNOS4_PA_PDMA0 0x12680000
94#define EXYNOS4_PA_PDMA1 0x12690000 95#define EXYNOS4_PA_PDMA1 0x12690000
95#define EXYNOS5_PA_MDMA0 0x10800000 96#define EXYNOS5_PA_MDMA0 0x10800000
diff --git a/arch/arm/mach-highbank/system.c b/arch/arm/mach-highbank/system.c
index 82c27230d4a9..86e37cd9376c 100644
--- a/arch/arm/mach-highbank/system.c
+++ b/arch/arm/mach-highbank/system.c
@@ -28,6 +28,7 @@ void highbank_restart(char mode, const char *cmd)
28 hignbank_set_pwr_soft_reset(); 28 hignbank_set_pwr_soft_reset();
29 29
30 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF); 30 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
31 cpu_do_idle(); 31 while (1)
32 cpu_do_idle();
32} 33}
33 34
diff --git a/arch/arm/mach-imx/clk-gate2.c b/arch/arm/mach-imx/clk-gate2.c
index 3c1b8ff9a0a6..cc49c7ae186e 100644
--- a/arch/arm/mach-imx/clk-gate2.c
+++ b/arch/arm/mach-imx/clk-gate2.c
@@ -112,7 +112,7 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
112 112
113 clk = clk_register(dev, &gate->hw); 113 clk = clk_register(dev, &gate->hw);
114 if (IS_ERR(clk)) 114 if (IS_ERR(clk))
115 kfree(clk); 115 kfree(gate);
116 116
117 return clk; 117 return clk;
118} 118}
diff --git a/arch/arm/mach-imx/ehci-imx25.c b/arch/arm/mach-imx/ehci-imx25.c
index 412c583a24b0..576af7446952 100644
--- a/arch/arm/mach-imx/ehci-imx25.c
+++ b/arch/arm/mach-imx/ehci-imx25.c
@@ -30,7 +30,7 @@
30#define MX25_H1_SIC_SHIFT 21 30#define MX25_H1_SIC_SHIFT 21
31#define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT) 31#define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT)
32#define MX25_H1_PP_BIT (1 << 18) 32#define MX25_H1_PP_BIT (1 << 18)
33#define MX25_H1_PM_BIT (1 << 8) 33#define MX25_H1_PM_BIT (1 << 16)
34#define MX25_H1_IPPUE_UP_BIT (1 << 7) 34#define MX25_H1_IPPUE_UP_BIT (1 << 7)
35#define MX25_H1_IPPUE_DOWN_BIT (1 << 6) 35#define MX25_H1_IPPUE_DOWN_BIT (1 << 6)
36#define MX25_H1_TLL_BIT (1 << 5) 36#define MX25_H1_TLL_BIT (1 << 5)
diff --git a/arch/arm/mach-imx/ehci-imx35.c b/arch/arm/mach-imx/ehci-imx35.c
index 779e16eb65cb..293397852e4e 100644
--- a/arch/arm/mach-imx/ehci-imx35.c
+++ b/arch/arm/mach-imx/ehci-imx35.c
@@ -30,7 +30,7 @@
30#define MX35_H1_SIC_SHIFT 21 30#define MX35_H1_SIC_SHIFT 21
31#define MX35_H1_SIC_MASK (0x3 << MX35_H1_SIC_SHIFT) 31#define MX35_H1_SIC_MASK (0x3 << MX35_H1_SIC_SHIFT)
32#define MX35_H1_PP_BIT (1 << 18) 32#define MX35_H1_PP_BIT (1 << 18)
33#define MX35_H1_PM_BIT (1 << 8) 33#define MX35_H1_PM_BIT (1 << 16)
34#define MX35_H1_IPPUE_UP_BIT (1 << 7) 34#define MX35_H1_IPPUE_UP_BIT (1 << 7)
35#define MX35_H1_IPPUE_DOWN_BIT (1 << 6) 35#define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
36#define MX35_H1_TLL_BIT (1 << 5) 36#define MX35_H1_TLL_BIT (1 << 5)
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index e428f3ab15c7..9f82f9dcbb98 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -21,10 +21,9 @@
21#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
22#include <linux/amba/clcd.h> 22#include <linux/amba/clcd.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/platform_data/clk-integrator.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
25#include <linux/clkdev.h>
26 26
27#include <asm/hardware/icst.h>
28#include <mach/lm.h> 27#include <mach/lm.h>
29#include <mach/impd1.h> 28#include <mach/impd1.h>
30#include <asm/sizes.h> 29#include <asm/sizes.h>
@@ -36,45 +35,6 @@ MODULE_PARM_DESC(lmid, "logic module stack position");
36 35
37struct impd1_module { 36struct impd1_module {
38 void __iomem *base; 37 void __iomem *base;
39 struct clk vcos[2];
40 struct clk_lookup *clks[3];
41};
42
43static const struct icst_params impd1_vco_params = {
44 .ref = 24000000, /* 24 MHz */
45 .vco_max = ICST525_VCO_MAX_3V,
46 .vco_min = ICST525_VCO_MIN,
47 .vd_min = 12,
48 .vd_max = 519,
49 .rd_min = 3,
50 .rd_max = 120,
51 .s2div = icst525_s2div,
52 .idx2s = icst525_idx2s,
53};
54
55static void impd1_setvco(struct clk *clk, struct icst_vco vco)
56{
57 struct impd1_module *impd1 = clk->data;
58 u32 val = vco.v | (vco.r << 9) | (vco.s << 16);
59
60 writel(0xa05f, impd1->base + IMPD1_LOCK);
61 writel(val, clk->vcoreg);
62 writel(0, impd1->base + IMPD1_LOCK);
63
64#ifdef DEBUG
65 vco.v = val & 0x1ff;
66 vco.r = (val >> 9) & 0x7f;
67 vco.s = (val >> 16) & 7;
68
69 pr_debug("IM-PD1: VCO%d clock is %ld Hz\n",
70 vconr, icst525_hz(&impd1_vco_params, vco));
71#endif
72}
73
74static const struct clk_ops impd1_clk_ops = {
75 .round = icst_clk_round,
76 .set = icst_clk_set,
77 .setvco = impd1_setvco,
78}; 38};
79 39
80void impd1_tweak_control(struct device *dev, u32 mask, u32 val) 40void impd1_tweak_control(struct device *dev, u32 mask, u32 val)
@@ -344,10 +304,6 @@ static struct impd1_device impd1_devs[] = {
344 } 304 }
345}; 305};
346 306
347static struct clk fixed_14745600 = {
348 .rate = 14745600,
349};
350
351static int impd1_probe(struct lm_device *dev) 307static int impd1_probe(struct lm_device *dev)
352{ 308{
353 struct impd1_module *impd1; 309 struct impd1_module *impd1;
@@ -376,23 +332,7 @@ static int impd1_probe(struct lm_device *dev)
376 printk("IM-PD1 found at 0x%08lx\n", 332 printk("IM-PD1 found at 0x%08lx\n",
377 (unsigned long)dev->resource.start); 333 (unsigned long)dev->resource.start);
378 334
379 for (i = 0; i < ARRAY_SIZE(impd1->vcos); i++) { 335 integrator_impd1_clk_init(impd1->base, dev->id);
380 impd1->vcos[i].ops = &impd1_clk_ops,
381 impd1->vcos[i].owner = THIS_MODULE,
382 impd1->vcos[i].params = &impd1_vco_params,
383 impd1->vcos[i].data = impd1;
384 }
385 impd1->vcos[0].vcoreg = impd1->base + IMPD1_OSC1;
386 impd1->vcos[1].vcoreg = impd1->base + IMPD1_OSC2;
387
388 impd1->clks[0] = clkdev_alloc(&impd1->vcos[0], NULL, "lm%x:01000",
389 dev->id);
390 impd1->clks[1] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00100",
391 dev->id);
392 impd1->clks[2] = clkdev_alloc(&fixed_14745600, NULL, "lm%x:00200",
393 dev->id);
394 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
395 clkdev_add(impd1->clks[i]);
396 336
397 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) { 337 for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) {
398 struct impd1_device *idev = impd1_devs + i; 338 struct impd1_device *idev = impd1_devs + i;
@@ -402,9 +342,10 @@ static int impd1_probe(struct lm_device *dev)
402 342
403 pc_base = dev->resource.start + idev->offset; 343 pc_base = dev->resource.start + idev->offset;
404 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12); 344 snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12);
405 d = amba_ahb_device_add(&dev->dev, devname, pc_base, SZ_4K, 345 d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K,
406 dev->irq, dev->irq, 346 dev->irq, dev->irq,
407 idev->platform_data, idev->id); 347 idev->platform_data, idev->id,
348 &dev->resource);
408 if (IS_ERR(d)) { 349 if (IS_ERR(d)) {
409 dev_err(&dev->dev, "unable to register device: %ld\n", PTR_ERR(d)); 350 dev_err(&dev->dev, "unable to register device: %ld\n", PTR_ERR(d));
410 continue; 351 continue;
@@ -431,12 +372,9 @@ static int impd1_remove_one(struct device *dev, void *data)
431static void impd1_remove(struct lm_device *dev) 372static void impd1_remove(struct lm_device *dev)
432{ 373{
433 struct impd1_module *impd1 = lm_get_drvdata(dev); 374 struct impd1_module *impd1 = lm_get_drvdata(dev);
434 int i;
435 375
436 device_for_each_child(&dev->dev, NULL, impd1_remove_one); 376 device_for_each_child(&dev->dev, NULL, impd1_remove_one);
437 377 integrator_impd1_clk_exit(dev->id);
438 for (i = 0; i < ARRAY_SIZE(impd1->clks); i++)
439 clkdev_drop(impd1->clks[i]);
440 378
441 lm_set_drvdata(dev, NULL); 379 lm_set_drvdata(dev, NULL);
442 380
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 1694f01ce2b6..6d6bde3e15fa 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -410,6 +410,7 @@ void __init ixp4xx_pci_preinit(void)
410 * Enable the IO window to be way up high, at 0xfffffc00 410 * Enable the IO window to be way up high, at 0xfffffc00
411 */ 411 */
412 local_write_config(PCI_BASE_ADDRESS_5, 4, 0xfffffc01); 412 local_write_config(PCI_BASE_ADDRESS_5, 4, 0xfffffc01);
413 local_write_config(0x40, 4, 0x000080FF); /* No TRDY time limit */
413 } else { 414 } else {
414 printk("PCI: IXP4xx is target - No bus scan performed\n"); 415 printk("PCI: IXP4xx is target - No bus scan performed\n");
415 } 416 }
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index fdf91a160884..8c0c0e2d0727 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -67,15 +67,12 @@ static struct map_desc ixp4xx_io_desc[] __initdata = {
67 .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS), 67 .pfn = __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS),
68 .length = IXP4XX_PCI_CFG_REGION_SIZE, 68 .length = IXP4XX_PCI_CFG_REGION_SIZE,
69 .type = MT_DEVICE 69 .type = MT_DEVICE
70 }, 70 }, { /* Queue Manager */
71#ifdef CONFIG_DEBUG_LL 71 .virtual = (unsigned long)IXP4XX_QMGR_BASE_VIRT,
72 { /* Debug UART mapping */ 72 .pfn = __phys_to_pfn(IXP4XX_QMGR_BASE_PHYS),
73 .virtual = (unsigned long)IXP4XX_DEBUG_UART_BASE_VIRT, 73 .length = IXP4XX_QMGR_REGION_SIZE,
74 .pfn = __phys_to_pfn(IXP4XX_DEBUG_UART_BASE_PHYS),
75 .length = IXP4XX_DEBUG_UART_REGION_SIZE,
76 .type = MT_DEVICE 74 .type = MT_DEVICE
77 } 75 },
78#endif
79}; 76};
80 77
81void __init ixp4xx_map_io(void) 78void __init ixp4xx_map_io(void)
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index b800a031207c..53b8348dfcc2 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -15,6 +15,7 @@
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/mach/flash.h> 16#include <asm/mach/flash.h>
17#include <asm/mach/pci.h> 17#include <asm/mach/pci.h>
18#include <asm/system_info.h>
18 19
19#define SLOT_ETHA 0x0B /* IDSEL = AD21 */ 20#define SLOT_ETHA 0x0B /* IDSEL = AD21 */
20#define SLOT_ETHB 0x0C /* IDSEL = AD20 */ 21#define SLOT_ETHB 0x0C /* IDSEL = AD20 */
@@ -329,7 +330,7 @@ static struct platform_device device_hss_tab[] = {
329}; 330};
330 331
331 332
332static struct platform_device *device_tab[6] __initdata = { 333static struct platform_device *device_tab[7] __initdata = {
333 &device_flash, /* index 0 */ 334 &device_flash, /* index 0 */
334}; 335};
335 336
diff --git a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
index 8c9f8d564492..ff686cbc5df4 100644
--- a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
+++ b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S
@@ -17,8 +17,8 @@
17#else 17#else
18 mov \rp, #0 18 mov \rp, #0
19#endif 19#endif
20 orr \rv, \rp, #0xff000000 @ virtual 20 orr \rv, \rp, #0xfe000000 @ virtual
21 orr \rv, \rv, #0x00b00000 21 orr \rv, \rv, #0x00f00000
22 orr \rp, \rp, #0xc8000000 @ physical 22 orr \rp, \rp, #0xc8000000 @ physical
23 .endm 23 .endm
24 24
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
index eb68b61ce975..c5bae9c035d5 100644
--- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
+++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h
@@ -30,51 +30,43 @@
30 * 30 *
31 * 0x50000000 0x10000000 ioremap'd EXP BUS 31 * 0x50000000 0x10000000 ioremap'd EXP BUS
32 * 32 *
33 * 0x6000000 0x00004000 ioremap'd QMgr 33 * 0xC8000000 0x00013000 0xFEF00000 On-Chip Peripherals
34 * 34 *
35 * 0xC0000000 0x00001000 0xffbff000 PCI CFG 35 * 0xC0000000 0x00001000 0xFEF13000 PCI CFG
36 * 36 *
37 * 0xC4000000 0x00001000 0xffbfe000 EXP CFG 37 * 0xC4000000 0x00001000 0xFEF14000 EXP CFG
38 * 38 *
39 * 0xC8000000 0x00013000 0xffbeb000 On-Chip Peripherals 39 * 0x60000000 0x00004000 0xFEF15000 QMgr
40 */ 40 */
41 41
42/* 42/*
43 * Queue Manager 43 * Queue Manager
44 */ 44 */
45#define IXP4XX_QMGR_BASE_PHYS (0x60000000) 45#define IXP4XX_QMGR_BASE_PHYS 0x60000000
46#define IXP4XX_QMGR_REGION_SIZE (0x00004000) 46#define IXP4XX_QMGR_BASE_VIRT IOMEM(0xFEF15000)
47#define IXP4XX_QMGR_REGION_SIZE 0x00004000
47 48
48/* 49/*
49 * Expansion BUS Configuration registers 50 * Peripheral space, including debug UART. Must be section-aligned so that
51 * it can be used with the low-level debug code.
50 */ 52 */
51#define IXP4XX_EXP_CFG_BASE_PHYS (0xC4000000) 53#define IXP4XX_PERIPHERAL_BASE_PHYS 0xC8000000
52#define IXP4XX_EXP_CFG_BASE_VIRT IOMEM(0xFFBFE000) 54#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFEF00000)
53#define IXP4XX_EXP_CFG_REGION_SIZE (0x00001000) 55#define IXP4XX_PERIPHERAL_REGION_SIZE 0x00013000
54 56
55/* 57/*
56 * PCI Config registers 58 * PCI Config registers
57 */ 59 */
58#define IXP4XX_PCI_CFG_BASE_PHYS (0xC0000000) 60#define IXP4XX_PCI_CFG_BASE_PHYS 0xC0000000
59#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFFBFF000) 61#define IXP4XX_PCI_CFG_BASE_VIRT IOMEM(0xFEF13000)
60#define IXP4XX_PCI_CFG_REGION_SIZE (0x00001000) 62#define IXP4XX_PCI_CFG_REGION_SIZE 0x00001000
61
62/*
63 * Peripheral space
64 */
65#define IXP4XX_PERIPHERAL_BASE_PHYS (0xC8000000)
66#define IXP4XX_PERIPHERAL_BASE_VIRT IOMEM(0xFFBEB000)
67#define IXP4XX_PERIPHERAL_REGION_SIZE (0x00013000)
68 63
69/* 64/*
70 * Debug UART 65 * Expansion BUS Configuration registers
71 *
72 * This is basically a remap of UART1 into a region that is section
73 * aligned so that it * can be used with the low-level debug code.
74 */ 66 */
75#define IXP4XX_DEBUG_UART_BASE_PHYS (0xC8000000) 67#define IXP4XX_EXP_CFG_BASE_PHYS 0xC4000000
76#define IXP4XX_DEBUG_UART_BASE_VIRT IOMEM(0xffb00000) 68#define IXP4XX_EXP_CFG_BASE_VIRT 0xFEF14000
77#define IXP4XX_DEBUG_UART_REGION_SIZE (0x00001000) 69#define IXP4XX_EXP_CFG_REGION_SIZE 0x00001000
78 70
79#define IXP4XX_EXP_CS0_OFFSET 0x00 71#define IXP4XX_EXP_CS0_OFFSET 0x00
80#define IXP4XX_EXP_CS1_OFFSET 0x04 72#define IXP4XX_EXP_CS1_OFFSET 0x04
diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
index 9e7cad2d54cb..4de8da536dbb 100644
--- a/arch/arm/mach-ixp4xx/include/mach/qmgr.h
+++ b/arch/arm/mach-ixp4xx/include/mach/qmgr.h
@@ -86,7 +86,7 @@ void qmgr_release_queue(unsigned int queue);
86 86
87static inline void qmgr_put_entry(unsigned int queue, u32 val) 87static inline void qmgr_put_entry(unsigned int queue, u32 val)
88{ 88{
89 extern struct qmgr_regs __iomem *qmgr_regs; 89 struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
90#if DEBUG_QMGR 90#if DEBUG_QMGR
91 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 91 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
92 92
@@ -99,7 +99,7 @@ static inline void qmgr_put_entry(unsigned int queue, u32 val)
99static inline u32 qmgr_get_entry(unsigned int queue) 99static inline u32 qmgr_get_entry(unsigned int queue)
100{ 100{
101 u32 val; 101 u32 val;
102 extern struct qmgr_regs __iomem *qmgr_regs; 102 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
103 val = __raw_readl(&qmgr_regs->acc[queue][0]); 103 val = __raw_readl(&qmgr_regs->acc[queue][0]);
104#if DEBUG_QMGR 104#if DEBUG_QMGR
105 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ 105 BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */
@@ -112,14 +112,14 @@ static inline u32 qmgr_get_entry(unsigned int queue)
112 112
113static inline int __qmgr_get_stat1(unsigned int queue) 113static inline int __qmgr_get_stat1(unsigned int queue)
114{ 114{
115 extern struct qmgr_regs __iomem *qmgr_regs; 115 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
116 return (__raw_readl(&qmgr_regs->stat1[queue >> 3]) 116 return (__raw_readl(&qmgr_regs->stat1[queue >> 3])
117 >> ((queue & 7) << 2)) & 0xF; 117 >> ((queue & 7) << 2)) & 0xF;
118} 118}
119 119
120static inline int __qmgr_get_stat2(unsigned int queue) 120static inline int __qmgr_get_stat2(unsigned int queue)
121{ 121{
122 extern struct qmgr_regs __iomem *qmgr_regs; 122 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
123 BUG_ON(queue >= HALF_QUEUES); 123 BUG_ON(queue >= HALF_QUEUES);
124 return (__raw_readl(&qmgr_regs->stat2[queue >> 4]) 124 return (__raw_readl(&qmgr_regs->stat2[queue >> 4])
125 >> ((queue & 0xF) << 1)) & 0x3; 125 >> ((queue & 0xF) << 1)) & 0x3;
@@ -145,7 +145,7 @@ static inline int qmgr_stat_empty(unsigned int queue)
145 */ 145 */
146static inline int qmgr_stat_below_low_watermark(unsigned int queue) 146static inline int qmgr_stat_below_low_watermark(unsigned int queue)
147{ 147{
148 extern struct qmgr_regs __iomem *qmgr_regs; 148 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
149 if (queue >= HALF_QUEUES) 149 if (queue >= HALF_QUEUES)
150 return (__raw_readl(&qmgr_regs->statne_h) >> 150 return (__raw_readl(&qmgr_regs->statne_h) >>
151 (queue - HALF_QUEUES)) & 0x01; 151 (queue - HALF_QUEUES)) & 0x01;
@@ -172,7 +172,7 @@ static inline int qmgr_stat_above_high_watermark(unsigned int queue)
172 */ 172 */
173static inline int qmgr_stat_full(unsigned int queue) 173static inline int qmgr_stat_full(unsigned int queue)
174{ 174{
175 extern struct qmgr_regs __iomem *qmgr_regs; 175 const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
176 if (queue >= HALF_QUEUES) 176 if (queue >= HALF_QUEUES)
177 return (__raw_readl(&qmgr_regs->statf_h) >> 177 return (__raw_readl(&qmgr_regs->statf_h) >>
178 (queue - HALF_QUEUES)) & 0x01; 178 (queue - HALF_QUEUES)) & 0x01;
diff --git a/arch/arm/mach-ixp4xx/include/mach/udc.h b/arch/arm/mach-ixp4xx/include/mach/udc.h
index 80d6da2eafac..7bd8b96c8843 100644
--- a/arch/arm/mach-ixp4xx/include/mach/udc.h
+++ b/arch/arm/mach-ixp4xx/include/mach/udc.h
@@ -2,7 +2,7 @@
2 * arch/arm/mach-ixp4xx/include/mach/udc.h 2 * arch/arm/mach-ixp4xx/include/mach/udc.h
3 * 3 *
4 */ 4 */
5#include <asm/mach/udc_pxa2xx.h> 5#include <linux/platform_data/pxa2xx_udc.h>
6 6
7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); 7extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info);
8 8
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
index a17ed79207a4..d4eb09a62863 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
@@ -116,7 +116,11 @@
116/* NPE mailbox_status value for reset */ 116/* NPE mailbox_status value for reset */
117#define RESET_MBOX_STAT 0x0000F0F0 117#define RESET_MBOX_STAT 0x0000F0F0
118 118
119const char *npe_names[] = { "NPE-A", "NPE-B", "NPE-C" }; 119#define NPE_A_FIRMWARE "NPE-A"
120#define NPE_B_FIRMWARE "NPE-B"
121#define NPE_C_FIRMWARE "NPE-C"
122
123const char *npe_names[] = { NPE_A_FIRMWARE, NPE_B_FIRMWARE, NPE_C_FIRMWARE };
120 124
121#define print_npe(pri, npe, fmt, ...) \ 125#define print_npe(pri, npe, fmt, ...) \
122 printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__) 126 printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__)
@@ -724,6 +728,9 @@ module_exit(npe_cleanup_module);
724 728
725MODULE_AUTHOR("Krzysztof Halasa"); 729MODULE_AUTHOR("Krzysztof Halasa");
726MODULE_LICENSE("GPL v2"); 730MODULE_LICENSE("GPL v2");
731MODULE_FIRMWARE(NPE_A_FIRMWARE);
732MODULE_FIRMWARE(NPE_B_FIRMWARE);
733MODULE_FIRMWARE(NPE_C_FIRMWARE);
727 734
728EXPORT_SYMBOL(npe_names); 735EXPORT_SYMBOL(npe_names);
729EXPORT_SYMBOL(npe_running); 736EXPORT_SYMBOL(npe_running);
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index 852f7c9f87d0..9d1b6b7c394c 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -14,7 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <mach/qmgr.h> 15#include <mach/qmgr.h>
16 16
17struct qmgr_regs __iomem *qmgr_regs; 17static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;
18static struct resource *mem_res; 18static struct resource *mem_res;
19static spinlock_t qmgr_lock; 19static spinlock_t qmgr_lock;
20static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ 20static u32 used_sram_bitmap[4]; /* 128 16-dword pages */
@@ -293,12 +293,6 @@ static int qmgr_init(void)
293 if (mem_res == NULL) 293 if (mem_res == NULL)
294 return -EBUSY; 294 return -EBUSY;
295 295
296 qmgr_regs = ioremap(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
297 if (qmgr_regs == NULL) {
298 err = -ENOMEM;
299 goto error_map;
300 }
301
302 /* reset qmgr registers */ 296 /* reset qmgr registers */
303 for (i = 0; i < 4; i++) { 297 for (i = 0; i < 4; i++) {
304 __raw_writel(0x33333333, &qmgr_regs->stat1[i]); 298 __raw_writel(0x33333333, &qmgr_regs->stat1[i]);
@@ -347,8 +341,6 @@ static int qmgr_init(void)
347error_irq2: 341error_irq2:
348 free_irq(IRQ_IXP4XX_QM1, NULL); 342 free_irq(IRQ_IXP4XX_QM1, NULL);
349error_irq: 343error_irq:
350 iounmap(qmgr_regs);
351error_map:
352 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); 344 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
353 return err; 345 return err;
354} 346}
@@ -359,7 +351,6 @@ static void qmgr_remove(void)
359 free_irq(IRQ_IXP4XX_QM2, NULL); 351 free_irq(IRQ_IXP4XX_QM2, NULL);
360 synchronize_irq(IRQ_IXP4XX_QM1); 352 synchronize_irq(IRQ_IXP4XX_QM1);
361 synchronize_irq(IRQ_IXP4XX_QM2); 353 synchronize_irq(IRQ_IXP4XX_QM2);
362 iounmap(qmgr_regs);
363 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); 354 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
364} 355}
365 356
@@ -369,7 +360,6 @@ module_exit(qmgr_remove);
369MODULE_LICENSE("GPL v2"); 360MODULE_LICENSE("GPL v2");
370MODULE_AUTHOR("Krzysztof Halasa"); 361MODULE_AUTHOR("Krzysztof Halasa");
371 362
372EXPORT_SYMBOL(qmgr_regs);
373EXPORT_SYMBOL(qmgr_set_irq); 363EXPORT_SYMBOL(qmgr_set_irq);
374EXPORT_SYMBOL(qmgr_enable_irq); 364EXPORT_SYMBOL(qmgr_enable_irq);
375EXPORT_SYMBOL(qmgr_disable_irq); 365EXPORT_SYMBOL(qmgr_disable_irq);
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index ec544918b12c..74fc5a074fc4 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -207,14 +207,19 @@ static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
207 return 1; 207 return 1;
208} 208}
209 209
210/*
211 * The root complex has a hardwired class of PCI_CLASS_MEMORY_OTHER, when it
212 * is operating as a root complex this needs to be switched to
213 * PCI_CLASS_BRIDGE_HOST or Linux will errantly try to process the BAR's on
214 * the device. Decoding setup is handled by the orion code.
215 */
210static void __devinit rc_pci_fixup(struct pci_dev *dev) 216static void __devinit rc_pci_fixup(struct pci_dev *dev)
211{ 217{
212 /*
213 * Prevent enumeration of root complex.
214 */
215 if (dev->bus->parent == NULL && dev->devfn == 0) { 218 if (dev->bus->parent == NULL && dev->devfn == 0) {
216 int i; 219 int i;
217 220
221 dev->class &= 0xff;
222 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
218 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 223 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
219 dev->resource[i].start = 0; 224 dev->resource[i].start = 0;
220 dev->resource[i].end = 0; 225 dev->resource[i].end = 0;
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index bfa1eab91f41..22ef8a1abe08 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -24,6 +24,7 @@
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/pinctrl/machine.h> 26#include <linux/pinctrl/machine.h>
27#include <linux/platform_data/pinctrl-nomadik.h>
27#include <asm/hardware/vic.h> 28#include <asm/hardware/vic.h>
28#include <asm/sizes.h> 29#include <asm/sizes.h>
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
@@ -32,9 +33,7 @@
32#include <asm/mach/flash.h> 33#include <asm/mach/flash.h>
33#include <asm/mach/time.h> 34#include <asm/mach/time.h>
34 35
35#include <plat/gpio-nomadik.h>
36#include <plat/mtu.h> 36#include <plat/mtu.h>
37#include <plat/pincfg.h>
38 37
39#include <linux/platform_data/mtd-nomadik-nand.h> 38#include <linux/platform_data/mtd-nomadik-nand.h>
40#include <mach/fsmc.h> 39#include <mach/fsmc.h>
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index b617eaed0ce5..1273931303fb 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -26,8 +26,8 @@
26#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/platform_data/clk-nomadik.h> 28#include <linux/platform_data/clk-nomadik.h>
29#include <linux/platform_data/pinctrl-nomadik.h>
29 30
30#include <plat/gpio-nomadik.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/irqs.h> 32#include <mach/irqs.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c
index 6d14454d4609..0c2f6628299a 100644
--- a/arch/arm/mach-nomadik/i2c-8815nhk.c
+++ b/arch/arm/mach-nomadik/i2c-8815nhk.c
@@ -4,8 +4,7 @@
4#include <linux/i2c-algo-bit.h> 4#include <linux/i2c-algo-bit.h>
5#include <linux/i2c-gpio.h> 5#include <linux/i2c-gpio.h>
6#include <linux/platform_device.h> 6#include <linux/platform_device.h>
7#include <plat/gpio-nomadik.h> 7#include <linux/platform_data/pinctrl-nomadik.h>
8#include <plat/pincfg.h>
9 8
10/* 9/*
11 * There are two busses in the 8815NHK. 10 * There are two busses in the 8815NHK.
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index dbc705ac4334..549080c8446b 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -579,6 +579,11 @@ static void __init igep_wlan_bt_init(void)
579 } else 579 } else
580 return; 580 return;
581 581
582 /* Make sure that the GPIO pins are muxed correctly */
583 omap_mux_init_gpio(igep_wlan_bt_gpios[0].gpio, OMAP_PIN_OUTPUT);
584 omap_mux_init_gpio(igep_wlan_bt_gpios[1].gpio, OMAP_PIN_OUTPUT);
585 omap_mux_init_gpio(igep_wlan_bt_gpios[2].gpio, OMAP_PIN_OUTPUT);
586
582 err = gpio_request_array(igep_wlan_bt_gpios, 587 err = gpio_request_array(igep_wlan_bt_gpios,
583 ARRAY_SIZE(igep_wlan_bt_gpios)); 588 ARRAY_SIZE(igep_wlan_bt_gpios));
584 if (err) { 589 if (err) {
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 1cfb0374f5e2..f5ba43fa0400 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -45,7 +45,6 @@
45#include <asm/mach/flash.h> 45#include <asm/mach/flash.h>
46#include <asm/mach/map.h> 46#include <asm/mach/map.h>
47 47
48#include "common.h"
49#include <video/omapdss.h> 48#include <video/omapdss.h>
50#include <video/omap-panel-generic-dpi.h> 49#include <video/omap-panel-generic-dpi.h>
51#include <video/omap-panel-tfp410.h> 50#include <video/omap-panel-tfp410.h>
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index b56d06b48782..95192a062d5d 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -359,7 +359,7 @@ static struct clockdomain iss_44xx_clkdm = {
359 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS, 359 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS,
360 .wkdep_srcs = iss_wkup_sleep_deps, 360 .wkdep_srcs = iss_wkup_sleep_deps,
361 .sleepdep_srcs = iss_wkup_sleep_deps, 361 .sleepdep_srcs = iss_wkup_sleep_deps,
362 .flags = CLKDM_CAN_HWSUP_SWSUP, 362 .flags = CLKDM_CAN_SWSUP,
363}; 363};
364 364
365static struct clockdomain l3_dss_44xx_clkdm = { 365static struct clockdomain l3_dss_44xx_clkdm = {
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index ad856092c06a..d246efd9f734 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -63,30 +63,36 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
63 struct spi_board_info *spi_bi = &ads7846_spi_board_info; 63 struct spi_board_info *spi_bi = &ads7846_spi_board_info;
64 int err; 64 int err;
65 65
66 err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown"); 66 /*
67 if (err) { 67 * If a board defines get_pendown_state() function, request the pendown
68 pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err); 68 * GPIO and set the GPIO debounce time.
69 return; 69 * If a board does not define the get_pendown_state() function, then
70 } 70 * the ads7846 driver will setup the pendown GPIO itself.
71 */
72 if (board_pdata && board_pdata->get_pendown_state) {
73 err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
74 if (err) {
75 pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
76 return;
77 }
78
79 if (gpio_debounce)
80 gpio_set_debounce(gpio_pendown, gpio_debounce);
71 81
72 if (gpio_debounce) 82 gpio_export(gpio_pendown, 0);
73 gpio_set_debounce(gpio_pendown, gpio_debounce); 83 }
74 84
75 spi_bi->bus_num = bus_num; 85 spi_bi->bus_num = bus_num;
76 spi_bi->irq = gpio_to_irq(gpio_pendown); 86 spi_bi->irq = gpio_to_irq(gpio_pendown);
77 87
88 ads7846_config.gpio_pendown = gpio_pendown;
89
78 if (board_pdata) { 90 if (board_pdata) {
79 board_pdata->gpio_pendown = gpio_pendown; 91 board_pdata->gpio_pendown = gpio_pendown;
92 board_pdata->gpio_pendown_debounce = gpio_debounce;
80 spi_bi->platform_data = board_pdata; 93 spi_bi->platform_data = board_pdata;
81 if (board_pdata->get_pendown_state)
82 gpio_export(gpio_pendown, 0);
83 } else {
84 ads7846_config.gpio_pendown = gpio_pendown;
85 } 94 }
86 95
87 if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
88 gpio_free(gpio_pendown);
89
90 spi_register_board_info(&ads7846_spi_board_info, 1); 96 spi_register_board_info(&ads7846_spi_board_info, 1);
91} 97}
92#else 98#else
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 426fcfcfd821..fd97f317de2e 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -278,6 +278,9 @@ static inline void __iomem *omap4_get_scu_base(void)
278#endif 278#endif
279 279
280extern void __init gic_init_irq(void); 280extern void __init gic_init_irq(void);
281extern void gic_dist_disable(void);
282extern bool gic_dist_disabled(void);
283extern void gic_timer_retrigger(void);
281extern void omap_smc1(u32 fn, u32 arg); 284extern void omap_smc1(u32 fn, u32 arg);
282extern void __iomem *omap4_get_sar_ram_base(void); 285extern void __iomem *omap4_get_sar_ram_base(void);
283extern void omap_do_wfi(void); 286extern void omap_do_wfi(void);
@@ -285,6 +288,7 @@ extern void omap_do_wfi(void);
285#ifdef CONFIG_SMP 288#ifdef CONFIG_SMP
286/* Needed for secondary core boot */ 289/* Needed for secondary core boot */
287extern void omap_secondary_startup(void); 290extern void omap_secondary_startup(void);
291extern void omap_secondary_startup_4460(void);
288extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask); 292extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
289extern void omap_auxcoreboot_addr(u32 cpu_addr); 293extern void omap_auxcoreboot_addr(u32 cpu_addr);
290extern u32 omap_read_auxcoreboot0(void); 294extern u32 omap_read_auxcoreboot0(void);
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 9adbdc846ceb..738ae0d7b5b5 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -19,6 +19,7 @@
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/pinctrl/machine.h> 20#include <linux/pinctrl/machine.h>
21#include <linux/platform_data/omap4-keypad.h> 21#include <linux/platform_data/omap4-keypad.h>
22#include <linux/platform_data/omap_ocp2scp.h>
22 23
23#include <asm/mach-types.h> 24#include <asm/mach-types.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
@@ -615,6 +616,83 @@ static void omap_init_vout(void)
615static inline void omap_init_vout(void) {} 616static inline void omap_init_vout(void) {}
616#endif 617#endif
617 618
619#if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE)
620static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)
621{
622 int cnt = 0;
623
624 while (ocp2scp_dev->drv_name != NULL) {
625 cnt++;
626 ocp2scp_dev++;
627 }
628
629 return cnt;
630}
631
632static void omap_init_ocp2scp(void)
633{
634 struct omap_hwmod *oh;
635 struct platform_device *pdev;
636 int bus_id = -1, dev_cnt = 0, i;
637 struct omap_ocp2scp_dev *ocp2scp_dev;
638 const char *oh_name, *name;
639 struct omap_ocp2scp_platform_data *pdata;
640
641 if (!cpu_is_omap44xx())
642 return;
643
644 oh_name = "ocp2scp_usb_phy";
645 name = "omap-ocp2scp";
646
647 oh = omap_hwmod_lookup(oh_name);
648 if (!oh) {
649 pr_err("%s: could not find omap_hwmod for %s\n", __func__,
650 oh_name);
651 return;
652 }
653
654 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
655 if (!pdata) {
656 pr_err("%s: No memory for ocp2scp pdata\n", __func__);
657 return;
658 }
659
660 ocp2scp_dev = oh->dev_attr;
661 dev_cnt = count_ocp2scp_devices(ocp2scp_dev);
662
663 if (!dev_cnt) {
664 pr_err("%s: No devices connected to ocp2scp\n", __func__);
665 kfree(pdata);
666 return;
667 }
668
669 pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *)
670 * dev_cnt, GFP_KERNEL);
671 if (!pdata->devices) {
672 pr_err("%s: No memory for ocp2scp pdata devices\n", __func__);
673 kfree(pdata);
674 return;
675 }
676
677 for (i = 0; i < dev_cnt; i++, ocp2scp_dev++)
678 pdata->devices[i] = ocp2scp_dev;
679
680 pdata->dev_cnt = dev_cnt;
681
682 pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata), NULL,
683 0, false);
684 if (IS_ERR(pdev)) {
685 pr_err("Could not build omap_device for %s %s\n",
686 name, oh_name);
687 kfree(pdata->devices);
688 kfree(pdata);
689 return;
690 }
691}
692#else
693static inline void omap_init_ocp2scp(void) { }
694#endif
695
618/*-------------------------------------------------------------------------*/ 696/*-------------------------------------------------------------------------*/
619 697
620static int __init omap2_init_devices(void) 698static int __init omap2_init_devices(void)
@@ -642,6 +720,7 @@ static int __init omap2_init_devices(void)
642 omap_init_sham(); 720 omap_init_sham();
643 omap_init_aes(); 721 omap_init_aes();
644 omap_init_vout(); 722 omap_init_vout();
723 omap_init_ocp2scp();
645 724
646 return 0; 725 return 0;
647} 726}
diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c
index 6282cc826613..fce5aa3fff49 100644
--- a/arch/arm/mach-omap2/drm.c
+++ b/arch/arm/mach-omap2/drm.c
@@ -23,15 +23,20 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/dma-mapping.h> 25#include <linux/dma-mapping.h>
26#include <linux/platform_data/omap_drm.h>
26 27
27#include "omap_device.h" 28#include "omap_device.h"
28#include "omap_hwmod.h" 29#include "omap_hwmod.h"
30#include <plat/cpu.h>
29 31
30#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) 32#if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE)
31 33
34static struct omap_drm_platform_data platform_data;
35
32static struct platform_device omap_drm_device = { 36static struct platform_device omap_drm_device = {
33 .dev = { 37 .dev = {
34 .coherent_dma_mask = DMA_BIT_MASK(32), 38 .coherent_dma_mask = DMA_BIT_MASK(32),
39 .platform_data = &platform_data,
35 }, 40 },
36 .name = "omapdrm", 41 .name = "omapdrm",
37 .id = 0, 42 .id = 0,
@@ -52,6 +57,8 @@ static int __init omap_init_drm(void)
52 oh->name); 57 oh->name);
53 } 58 }
54 59
60 platform_data.omaprev = GET_OMAP_REVISION();
61
55 return platform_device_register(&omap_drm_device); 62 return platform_device_register(&omap_drm_device);
56 63
57} 64}
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 502e3135aad3..0ea09faf327b 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -18,6 +18,8 @@
18#include <linux/linkage.h> 18#include <linux/linkage.h>
19#include <linux/init.h> 19#include <linux/init.h>
20 20
21#include "omap44xx.h"
22
21 __CPUINIT 23 __CPUINIT
22 24
23/* Physical address needed since MMU not enabled yet on secondary core */ 25/* Physical address needed since MMU not enabled yet on secondary core */
@@ -64,3 +66,39 @@ hold: ldr r12,=0x103
64 b secondary_startup 66 b secondary_startup
65ENDPROC(omap_secondary_startup) 67ENDPROC(omap_secondary_startup)
66 68
69ENTRY(omap_secondary_startup_4460)
70hold_2: ldr r12,=0x103
71 dsb
72 smc #0 @ read from AuxCoreBoot0
73 mov r0, r0, lsr #9
74 mrc p15, 0, r4, c0, c0, 5
75 and r4, r4, #0x0f
76 cmp r0, r4
77 bne hold_2
78
79 /*
80 * GIC distributor control register has changed between
81 * CortexA9 r1pX and r2pX. The Control Register secure
82 * banked version is now composed of 2 bits:
83 * bit 0 == Secure Enable
84 * bit 1 == Non-Secure Enable
85 * The Non-Secure banked register has not changed
86 * Because the ROM Code is based on the r1pX GIC, the CPU1
87 * GIC restoration will cause a problem to CPU0 Non-Secure SW.
88 * The workaround must be:
89 * 1) Before doing the CPU1 wakeup, CPU0 must disable
90 * the GIC distributor
91 * 2) CPU1 must re-enable the GIC distributor on
92 * it's wakeup path.
93 */
94 ldr r1, =OMAP44XX_GIC_DIST_BASE
95 ldr r0, [r1]
96 orr r0, #1
97 str r0, [r1]
98
99 /*
100 * we've been released from the wait loop,secondary_stack
101 * should now contain the SVC stack for this core
102 */
103 b secondary_startup
104ENDPROC(omap_secondary_startup_4460)
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 3f5fd7e3549d..aac46bfdbeb2 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -68,6 +68,7 @@ struct omap4_cpu_pm_info {
68 void __iomem *scu_sar_addr; 68 void __iomem *scu_sar_addr;
69 void __iomem *wkup_sar_addr; 69 void __iomem *wkup_sar_addr;
70 void __iomem *l2x0_sar_addr; 70 void __iomem *l2x0_sar_addr;
71 void (*secondary_startup)(void);
71}; 72};
72 73
73static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); 74static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
@@ -300,6 +301,7 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
300int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) 301int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
301{ 302{
302 unsigned int cpu_state = 0; 303 unsigned int cpu_state = 0;
304 struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu);
303 305
304 if (omap_rev() == OMAP4430_REV_ES1_0) 306 if (omap_rev() == OMAP4430_REV_ES1_0)
305 return -ENXIO; 307 return -ENXIO;
@@ -309,7 +311,7 @@ int __cpuinit omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state)
309 311
310 clear_cpu_prev_pwrst(cpu); 312 clear_cpu_prev_pwrst(cpu);
311 set_cpu_next_pwrst(cpu, power_state); 313 set_cpu_next_pwrst(cpu, power_state);
312 set_cpu_wakeup_addr(cpu, virt_to_phys(omap_secondary_startup)); 314 set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup));
313 scu_pwrst_prepare(cpu, power_state); 315 scu_pwrst_prepare(cpu, power_state);
314 316
315 /* 317 /*
@@ -360,6 +362,11 @@ int __init omap4_mpuss_init(void)
360 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; 362 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
361 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 363 pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
362 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; 364 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
365 if (cpu_is_omap446x())
366 pm_info->secondary_startup = omap_secondary_startup_4460;
367 else
368 pm_info->secondary_startup = omap_secondary_startup;
369
363 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); 370 pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm");
364 if (!pm_info->pwrdm) { 371 if (!pm_info->pwrdm) {
365 pr_err("Lookup failed for CPU1 pwrdm\n"); 372 pr_err("Lookup failed for CPU1 pwrdm\n");
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 4d05fa8a4e48..cd42d921940d 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -32,6 +32,7 @@
32#include "iomap.h" 32#include "iomap.h"
33#include "common.h" 33#include "common.h"
34#include "clockdomain.h" 34#include "clockdomain.h"
35#include "pm.h"
35 36
36#define CPU_MASK 0xff0ffff0 37#define CPU_MASK 0xff0ffff0
37#define CPU_CORTEX_A9 0x410FC090 38#define CPU_CORTEX_A9 0x410FC090
@@ -39,6 +40,8 @@
39 40
40#define OMAP5_CORE_COUNT 0x2 41#define OMAP5_CORE_COUNT 0x2
41 42
43u16 pm44xx_errata;
44
42/* SCU base address */ 45/* SCU base address */
43static void __iomem *scu_base; 46static void __iomem *scu_base;
44 47
@@ -118,8 +121,37 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
118 * 4.3.4.2 Power States of CPU0 and CPU1 121 * 4.3.4.2 Power States of CPU0 and CPU1
119 */ 122 */
120 if (booted) { 123 if (booted) {
124 /*
125 * GIC distributor control register has changed between
126 * CortexA9 r1pX and r2pX. The Control Register secure
127 * banked version is now composed of 2 bits:
128 * bit 0 == Secure Enable
129 * bit 1 == Non-Secure Enable
130 * The Non-Secure banked register has not changed
131 * Because the ROM Code is based on the r1pX GIC, the CPU1
132 * GIC restoration will cause a problem to CPU0 Non-Secure SW.
133 * The workaround must be:
134 * 1) Before doing the CPU1 wakeup, CPU0 must disable
135 * the GIC distributor
136 * 2) CPU1 must re-enable the GIC distributor on
137 * it's wakeup path.
138 */
139 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
140 local_irq_disable();
141 gic_dist_disable();
142 }
143
121 clkdm_wakeup(cpu1_clkdm); 144 clkdm_wakeup(cpu1_clkdm);
122 clkdm_allow_idle(cpu1_clkdm); 145 clkdm_allow_idle(cpu1_clkdm);
146
147 if (IS_PM44XX_ERRATUM(PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD)) {
148 while (gic_dist_disabled()) {
149 udelay(1);
150 cpu_relax();
151 }
152 gic_timer_retrigger();
153 local_irq_enable();
154 }
123 } else { 155 } else {
124 dsb_sev(); 156 dsb_sev();
125 booted = true; 157 booted = true;
@@ -138,7 +170,14 @@ static int __cpuinit omap4_boot_secondary(unsigned int cpu, struct task_struct *
138 170
139static void __init wakeup_secondary(void) 171static void __init wakeup_secondary(void)
140{ 172{
173 void *startup_addr = omap_secondary_startup;
141 void __iomem *base = omap_get_wakeupgen_base(); 174 void __iomem *base = omap_get_wakeupgen_base();
175
176 if (cpu_is_omap446x()) {
177 startup_addr = omap_secondary_startup_4460;
178 pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD;
179 }
180
142 /* 181 /*
143 * Write the address of secondary startup routine into the 182 * Write the address of secondary startup routine into the
144 * AuxCoreBoot1 where ROM code will jump and start executing 183 * AuxCoreBoot1 where ROM code will jump and start executing
@@ -146,7 +185,7 @@ static void __init wakeup_secondary(void)
146 * A barrier is added to ensure that write buffer is drained 185 * A barrier is added to ensure that write buffer is drained
147 */ 186 */
148 if (omap_secure_apis_support()) 187 if (omap_secure_apis_support())
149 omap_auxcoreboot_addr(virt_to_phys(omap_secondary_startup)); 188 omap_auxcoreboot_addr(virt_to_phys(startup_addr));
150 else 189 else
151 __raw_writel(virt_to_phys(omap5_secondary_startup), 190 __raw_writel(virt_to_phys(omap5_secondary_startup),
152 base + OMAP_AUX_CORE_BOOT_1); 191 base + OMAP_AUX_CORE_BOOT_1);
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 3cfcd41bf8fa..eda316abbff5 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/irq.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/memblock.h> 19#include <linux/memblock.h>
19#include <linux/of_irq.h> 20#include <linux/of_irq.h>
@@ -24,6 +25,7 @@
24#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/memblock.h> 27#include <asm/memblock.h>
28#include <asm/smp_twd.h>
27 29
28#include "omap-wakeupgen.h" 30#include "omap-wakeupgen.h"
29#include "soc.h" 31#include "soc.h"
@@ -39,6 +41,10 @@ static void __iomem *l2cache_base;
39#endif 41#endif
40 42
41static void __iomem *sar_ram_base; 43static void __iomem *sar_ram_base;
44static void __iomem *gic_dist_base_addr;
45static void __iomem *twd_base;
46
47#define IRQ_LOCALTIMER 29
42 48
43#ifdef CONFIG_OMAP4_ERRATA_I688 49#ifdef CONFIG_OMAP4_ERRATA_I688
44/* Used to implement memory barrier on DRAM path */ 50/* Used to implement memory barrier on DRAM path */
@@ -93,12 +99,14 @@ void __init omap_barriers_init(void)
93void __init gic_init_irq(void) 99void __init gic_init_irq(void)
94{ 100{
95 void __iomem *omap_irq_base; 101 void __iomem *omap_irq_base;
96 void __iomem *gic_dist_base_addr;
97 102
98 /* Static mapping, never released */ 103 /* Static mapping, never released */
99 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K); 104 gic_dist_base_addr = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
100 BUG_ON(!gic_dist_base_addr); 105 BUG_ON(!gic_dist_base_addr);
101 106
107 twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_4K);
108 BUG_ON(!twd_base);
109
102 /* Static mapping, never released */ 110 /* Static mapping, never released */
103 omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512); 111 omap_irq_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_512);
104 BUG_ON(!omap_irq_base); 112 BUG_ON(!omap_irq_base);
@@ -108,6 +116,38 @@ void __init gic_init_irq(void)
108 gic_init(0, 29, gic_dist_base_addr, omap_irq_base); 116 gic_init(0, 29, gic_dist_base_addr, omap_irq_base);
109} 117}
110 118
119void gic_dist_disable(void)
120{
121 if (gic_dist_base_addr)
122 __raw_writel(0x0, gic_dist_base_addr + GIC_DIST_CTRL);
123}
124
125bool gic_dist_disabled(void)
126{
127 return !(__raw_readl(gic_dist_base_addr + GIC_DIST_CTRL) & 0x1);
128}
129
130void gic_timer_retrigger(void)
131{
132 u32 twd_int = __raw_readl(twd_base + TWD_TIMER_INTSTAT);
133 u32 gic_int = __raw_readl(gic_dist_base_addr + GIC_DIST_PENDING_SET);
134 u32 twd_ctrl = __raw_readl(twd_base + TWD_TIMER_CONTROL);
135
136 if (twd_int && !(gic_int & BIT(IRQ_LOCALTIMER))) {
137 /*
138 * The local timer interrupt got lost while the distributor was
139 * disabled. Ack the pending interrupt, and retrigger it.
140 */
141 pr_warn("%s: lost localtimer interrupt\n", __func__);
142 __raw_writel(1, twd_base + TWD_TIMER_INTSTAT);
143 if (!(twd_ctrl & TWD_TIMER_CONTROL_PERIODIC)) {
144 __raw_writel(1, twd_base + TWD_TIMER_COUNTER);
145 twd_ctrl |= TWD_TIMER_CONTROL_ENABLE;
146 __raw_writel(twd_ctrl, twd_base + TWD_TIMER_CONTROL);
147 }
148 }
149}
150
111#ifdef CONFIG_CACHE_L2X0 151#ifdef CONFIG_CACHE_L2X0
112 152
113void __iomem *omap4_get_l2cache_base(void) 153void __iomem *omap4_get_l2cache_base(void)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 37eeb45612f8..437fbc59eb0c 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -423,6 +423,38 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
423} 423}
424 424
425/** 425/**
426 * _wait_softreset_complete - wait for an OCP softreset to complete
427 * @oh: struct omap_hwmod * to wait on
428 *
429 * Wait until the IP block represented by @oh reports that its OCP
430 * softreset is complete. This can be triggered by software (see
431 * _ocp_softreset()) or by hardware upon returning from off-mode (one
432 * example is HSMMC). Waits for up to MAX_MODULE_SOFTRESET_WAIT
433 * microseconds. Returns the number of microseconds waited.
434 */
435static int _wait_softreset_complete(struct omap_hwmod *oh)
436{
437 struct omap_hwmod_class_sysconfig *sysc;
438 u32 softrst_mask;
439 int c = 0;
440
441 sysc = oh->class->sysc;
442
443 if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
444 omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
445 & SYSS_RESETDONE_MASK),
446 MAX_MODULE_SOFTRESET_WAIT, c);
447 else if (sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
448 softrst_mask = (0x1 << sysc->sysc_fields->srst_shift);
449 omap_test_timeout(!(omap_hwmod_read(oh, sysc->sysc_offs)
450 & softrst_mask),
451 MAX_MODULE_SOFTRESET_WAIT, c);
452 }
453
454 return c;
455}
456
457/**
426 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v 458 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v
427 * @oh: struct omap_hwmod * 459 * @oh: struct omap_hwmod *
428 * 460 *
@@ -1283,6 +1315,18 @@ static void _enable_sysc(struct omap_hwmod *oh)
1283 if (!oh->class->sysc) 1315 if (!oh->class->sysc)
1284 return; 1316 return;
1285 1317
1318 /*
1319 * Wait until reset has completed, this is needed as the IP
1320 * block is reset automatically by hardware in some cases
1321 * (off-mode for example), and the drivers require the
1322 * IP to be ready when they access it
1323 */
1324 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1325 _enable_optional_clocks(oh);
1326 _wait_softreset_complete(oh);
1327 if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1328 _disable_optional_clocks(oh);
1329
1286 v = oh->_sysc_cache; 1330 v = oh->_sysc_cache;
1287 sf = oh->class->sysc->sysc_flags; 1331 sf = oh->class->sysc->sysc_flags;
1288 1332
@@ -1805,7 +1849,7 @@ static int _am33xx_disable_module(struct omap_hwmod *oh)
1805 */ 1849 */
1806static int _ocp_softreset(struct omap_hwmod *oh) 1850static int _ocp_softreset(struct omap_hwmod *oh)
1807{ 1851{
1808 u32 v, softrst_mask; 1852 u32 v;
1809 int c = 0; 1853 int c = 0;
1810 int ret = 0; 1854 int ret = 0;
1811 1855
@@ -1835,19 +1879,7 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1835 if (oh->class->sysc->srst_udelay) 1879 if (oh->class->sysc->srst_udelay)
1836 udelay(oh->class->sysc->srst_udelay); 1880 udelay(oh->class->sysc->srst_udelay);
1837 1881
1838 if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS) 1882 c = _wait_softreset_complete(oh);
1839 omap_test_timeout((omap_hwmod_read(oh,
1840 oh->class->sysc->syss_offs)
1841 & SYSS_RESETDONE_MASK),
1842 MAX_MODULE_SOFTRESET_WAIT, c);
1843 else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
1844 softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
1845 omap_test_timeout(!(omap_hwmod_read(oh,
1846 oh->class->sysc->sysc_offs)
1847 & softrst_mask),
1848 MAX_MODULE_SOFTRESET_WAIT, c);
1849 }
1850
1851 if (c == MAX_MODULE_SOFTRESET_WAIT) 1883 if (c == MAX_MODULE_SOFTRESET_WAIT)
1852 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", 1884 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",
1853 oh->name, MAX_MODULE_SOFTRESET_WAIT); 1885 oh->name, MAX_MODULE_SOFTRESET_WAIT);
@@ -2353,6 +2385,9 @@ static int __init _setup_reset(struct omap_hwmod *oh)
2353 if (oh->_state != _HWMOD_STATE_INITIALIZED) 2385 if (oh->_state != _HWMOD_STATE_INITIALIZED)
2354 return -EINVAL; 2386 return -EINVAL;
2355 2387
2388 if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK)
2389 return -EPERM;
2390
2356 if (oh->rst_lines_cnt == 0) { 2391 if (oh->rst_lines_cnt == 0) {
2357 r = _enable(oh); 2392 r = _enable(oh);
2358 if (r) { 2393 if (r) {
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 87b59b45c678..87a3c5b7aa74 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -442,6 +442,11 @@ struct omap_hwmod_omap4_prcm {
442 * in order to complete the reset. Optional clocks will be disabled 442 * in order to complete the reset. Optional clocks will be disabled
443 * again after the reset. 443 * again after the reset.
444 * HWMOD_16BIT_REG: Module has 16bit registers 444 * HWMOD_16BIT_REG: Module has 16bit registers
445 * HWMOD_EXT_OPT_MAIN_CLK: The only main functional clock source for
446 * this IP block comes from an off-chip source and is not always
447 * enabled. This prevents the hwmod code from being able to
448 * enable and reset the IP block early. XXX Eventually it should
449 * be possible to query the clock framework for this information.
445 */ 450 */
446#define HWMOD_SWSUP_SIDLE (1 << 0) 451#define HWMOD_SWSUP_SIDLE (1 << 0)
447#define HWMOD_SWSUP_MSTANDBY (1 << 1) 452#define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -452,6 +457,7 @@ struct omap_hwmod_omap4_prcm {
452#define HWMOD_NO_IDLEST (1 << 6) 457#define HWMOD_NO_IDLEST (1 << 6)
453#define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7) 458#define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7)
454#define HWMOD_16BIT_REG (1 << 8) 459#define HWMOD_16BIT_REG (1 << 8)
460#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9)
455 461
456/* 462/*
457 * omap_hwmod._int_flags definitions 463 * omap_hwmod._int_flags definitions
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 224bbaf73f32..caf946dfd4a4 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -21,6 +21,7 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/platform_data/gpio-omap.h> 22#include <linux/platform_data/gpio-omap.h>
23#include <linux/power/smartreflex.h> 23#include <linux/power/smartreflex.h>
24#include <linux/platform_data/omap_ocp2scp.h>
24#include <linux/i2c-omap.h> 25#include <linux/i2c-omap.h>
25 26
26#include <plat-omap/dma-omap.h> 27#include <plat-omap/dma-omap.h>
@@ -2126,6 +2127,14 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = {
2126 .name = "mcpdm", 2127 .name = "mcpdm",
2127 .class = &omap44xx_mcpdm_hwmod_class, 2128 .class = &omap44xx_mcpdm_hwmod_class,
2128 .clkdm_name = "abe_clkdm", 2129 .clkdm_name = "abe_clkdm",
2130 /*
2131 * It's suspected that the McPDM requires an off-chip main
2132 * functional clock, controlled via I2C. This IP block is
2133 * currently reset very early during boot, before I2C is
2134 * available, so it doesn't seem that we have any choice in
2135 * the kernel other than to avoid resetting it.
2136 */
2137 .flags = HWMOD_EXT_OPT_MAIN_CLK,
2129 .mpu_irqs = omap44xx_mcpdm_irqs, 2138 .mpu_irqs = omap44xx_mcpdm_irqs,
2130 .sdma_reqs = omap44xx_mcpdm_sdma_reqs, 2139 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,
2131 .main_clk = "mcpdm_fck", 2140 .main_clk = "mcpdm_fck",
@@ -2682,6 +2691,32 @@ static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = {
2682 .sysc = &omap44xx_ocp2scp_sysc, 2691 .sysc = &omap44xx_ocp2scp_sysc,
2683}; 2692};
2684 2693
2694/* ocp2scp dev_attr */
2695static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
2696 {
2697 .name = "usb_phy",
2698 .start = 0x4a0ad080,
2699 .end = 0x4a0ae000,
2700 .flags = IORESOURCE_MEM,
2701 },
2702 {
2703 /* XXX: Remove this once control module driver is in place */
2704 .name = "ctrl_dev",
2705 .start = 0x4a002300,
2706 .end = 0x4a002303,
2707 .flags = IORESOURCE_MEM,
2708 },
2709 { }
2710};
2711
2712static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
2713 {
2714 .drv_name = "omap-usb2",
2715 .res = omap44xx_usb_phy_and_pll_addrs,
2716 },
2717 { }
2718};
2719
2685/* ocp2scp_usb_phy */ 2720/* ocp2scp_usb_phy */
2686static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { 2721static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2687 .name = "ocp2scp_usb_phy", 2722 .name = "ocp2scp_usb_phy",
@@ -2695,6 +2730,7 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
2695 .modulemode = MODULEMODE_HWCTRL, 2730 .modulemode = MODULEMODE_HWCTRL,
2696 }, 2731 },
2697 }, 2732 },
2733 .dev_attr = ocp2scp_dev_attr,
2698}; 2734};
2699 2735
2700/* 2736/*
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 67d66131cfa7..fc3c96d5e013 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -102,6 +102,15 @@ extern void enable_omap3630_toggle_l2_on_restore(void);
102static inline void enable_omap3630_toggle_l2_on_restore(void) { } 102static inline void enable_omap3630_toggle_l2_on_restore(void) { }
103#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ 103#endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
104 104
105#define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0)
106
107#if defined(CONFIG_ARCH_OMAP4)
108extern u16 pm44xx_errata;
109#define IS_PM44XX_ERRATUM(id) (pm44xx_errata & (id))
110#else
111#define IS_PM44XX_ERRATUM(id) 0
112#endif
113
105#ifdef CONFIG_POWER_AVS_OMAP 114#ifdef CONFIG_POWER_AVS_OMAP
106extern int omap_devinit_smartreflex(void); 115extern int omap_devinit_smartreflex(void);
107extern void omap_enable_smartreflex_on_init(void); 116extern void omap_enable_smartreflex_on_init(void);
diff --git a/arch/arm/mach-omap2/pmu.c b/arch/arm/mach-omap2/pmu.c
index 3cf79b54ce61..250d909e38bd 100644
--- a/arch/arm/mach-omap2/pmu.c
+++ b/arch/arm/mach-omap2/pmu.c
@@ -58,8 +58,6 @@ static int __init omap2_init_pmu(unsigned oh_num, char *oh_names[])
58 if (IS_ERR(omap_pmu_dev)) 58 if (IS_ERR(omap_pmu_dev))
59 return PTR_ERR(omap_pmu_dev); 59 return PTR_ERR(omap_pmu_dev);
60 60
61 pm_runtime_enable(&omap_pmu_dev->dev);
62
63 return 0; 61 return 0;
64} 62}
65 63
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 827f54a1dd1d..e49b40b4c90a 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -70,6 +70,7 @@ void __init omap4_pmic_init(const char *pmic_type,
70{ 70{
71 /* PMIC part*/ 71 /* PMIC part*/
72 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE); 72 omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
73 omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
73 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data); 74 omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
74 75
75 /* Register additional devices on i2c1 bus if needed */ 76 /* Register additional devices on i2c1 bus if needed */
@@ -363,7 +364,7 @@ static struct regulator_init_data omap4_clk32kg_idata = {
363}; 364};
364 365
365static struct regulator_consumer_supply omap4_vdd1_supply[] = { 366static struct regulator_consumer_supply omap4_vdd1_supply[] = {
366 REGULATOR_SUPPLY("vcc", "mpu.0"), 367 REGULATOR_SUPPLY("vcc", "cpu0"),
367}; 368};
368 369
369static struct regulator_consumer_supply omap4_vdd2_supply[] = { 370static struct regulator_consumer_supply omap4_vdd2_supply[] = {
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 880249b17012..75878c37959b 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -264,7 +264,7 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
264 264
265 if (initialized) { 265 if (initialized) {
266 if (voltdm->pmic->i2c_high_speed != i2c_high_speed) 266 if (voltdm->pmic->i2c_high_speed != i2c_high_speed)
267 pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).", 267 pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).\n",
268 __func__, voltdm->name, i2c_high_speed); 268 __func__, voltdm->name, i2c_high_speed);
269 return; 269 return;
270 } 270 }
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 5ecbd17b5641..e2c6391863fe 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -28,6 +28,7 @@
28#include <linux/mfd/asic3.h> 28#include <linux/mfd/asic3.h>
29#include <linux/mtd/physmap.h> 29#include <linux/mtd/physmap.h>
30#include <linux/pda_power.h> 30#include <linux/pda_power.h>
31#include <linux/pwm.h>
31#include <linux/pwm_backlight.h> 32#include <linux/pwm_backlight.h>
32#include <linux/regulator/driver.h> 33#include <linux/regulator/driver.h>
33#include <linux/regulator/gpio-regulator.h> 34#include <linux/regulator/gpio-regulator.h>
@@ -556,7 +557,7 @@ static struct platform_device hx4700_lcd = {
556 */ 557 */
557 558
558static struct platform_pwm_backlight_data backlight_data = { 559static struct platform_pwm_backlight_data backlight_data = {
559 .pwm_id = 1, 560 .pwm_id = -1, /* Superseded by pwm_lookup */
560 .max_brightness = 200, 561 .max_brightness = 200,
561 .dft_brightness = 100, 562 .dft_brightness = 100,
562 .pwm_period_ns = 30923, 563 .pwm_period_ns = 30923,
@@ -571,6 +572,10 @@ static struct platform_device backlight = {
571 }, 572 },
572}; 573};
573 574
575static struct pwm_lookup hx4700_pwm_lookup[] = {
576 PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight", NULL),
577};
578
574/* 579/*
575 * USB "Transceiver" 580 * USB "Transceiver"
576 */ 581 */
@@ -872,6 +877,7 @@ static void __init hx4700_init(void)
872 pxa_set_stuart_info(NULL); 877 pxa_set_stuart_info(NULL);
873 878
874 platform_add_devices(devices, ARRAY_SIZE(devices)); 879 platform_add_devices(devices, ARRAY_SIZE(devices));
880 pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup));
875 881
876 pxa_set_ficp_info(&ficp_info); 882 pxa_set_ficp_info(&ficp_info);
877 pxa27x_set_i2c_power_info(NULL); 883 pxa27x_set_i2c_power_info(NULL);
diff --git a/arch/arm/mach-pxa/include/mach/udc.h b/arch/arm/mach-pxa/include/mach/udc.h
index 2f82332e81a0..9a827e32db98 100644
--- a/arch/arm/mach-pxa/include/mach/udc.h
+++ b/arch/arm/mach-pxa/include/mach/udc.h
@@ -2,7 +2,7 @@
2 * arch/arm/mach-pxa/include/mach/udc.h 2 * arch/arm/mach-pxa/include/mach/udc.h
3 * 3 *
4 */ 4 */
5#include <asm/mach/udc_pxa2xx.h> 5#include <linux/platform_data/pxa2xx_udc.h>
6 6
7extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info); 7extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
8 8
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 3352b37b60cf..3f5171eaf67b 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -209,6 +209,7 @@ static struct clk_lookup pxa25x_clkregs[] = {
209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"), 209 INIT_CLKREG(&clk_pxa25x_gpio12, NULL, "GPIO12_CLK"),
210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL), 210 INIT_CLKREG(&clk_pxa25x_mem, "pxa2xx-pcmcia", NULL),
211 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL), 211 INIT_CLKREG(&clk_dummy, "pxa-gpio", NULL),
212 INIT_CLKREG(&clk_dummy, "sa1100-rtc", NULL),
212}; 213};
213 214
214static struct clk_lookup pxa25x_hwuart_clkreg = 215static struct clk_lookup pxa25x_hwuart_clkreg =
@@ -338,6 +339,10 @@ void __init pxa25x_map_io(void)
338 pxa25x_get_clk_frequency_khz(1); 339 pxa25x_get_clk_frequency_khz(1);
339} 340}
340 341
342static struct pxa_gpio_platform_data pxa25x_gpio_info __initdata = {
343 .gpio_set_wake = gpio_set_wake,
344};
345
341static struct platform_device *pxa25x_devices[] __initdata = { 346static struct platform_device *pxa25x_devices[] __initdata = {
342 &pxa25x_device_udc, 347 &pxa25x_device_udc,
343 &pxa_device_pmu, 348 &pxa_device_pmu,
@@ -370,6 +375,7 @@ static int __init pxa25x_init(void)
370 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 375 register_syscore_ops(&pxa2xx_mfp_syscore_ops);
371 register_syscore_ops(&pxa2xx_clock_syscore_ops); 376 register_syscore_ops(&pxa2xx_clock_syscore_ops);
372 377
378 pxa_register_device(&pxa_device_gpio, &pxa25x_gpio_info);
373 ret = platform_add_devices(pxa25x_devices, 379 ret = platform_add_devices(pxa25x_devices,
374 ARRAY_SIZE(pxa25x_devices)); 380 ARRAY_SIZE(pxa25x_devices));
375 if (ret) 381 if (ret)
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 438f02fe122a..842596d4d31e 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -86,10 +86,7 @@ static void spitz_discharge1(int on)
86 gpio_set_value(SPITZ_GPIO_LED_GREEN, on); 86 gpio_set_value(SPITZ_GPIO_LED_GREEN, on);
87} 87}
88 88
89static unsigned long gpio18_config[] = { 89static unsigned long gpio18_config = GPIO18_GPIO;
90 GPIO18_RDY,
91 GPIO18_GPIO,
92};
93 90
94static void spitz_presuspend(void) 91static void spitz_presuspend(void)
95{ 92{
@@ -112,7 +109,7 @@ static void spitz_presuspend(void)
112 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT; 109 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
113 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0); 110 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
114 111
115 pxa2xx_mfp_config(&gpio18_config[0], 1); 112 pxa2xx_mfp_config(&gpio18_config, 1);
116 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown"); 113 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown");
117 gpio_free(18); 114 gpio_free(18);
118 115
@@ -131,7 +128,6 @@ static void spitz_presuspend(void)
131 128
132static void spitz_postsuspend(void) 129static void spitz_postsuspend(void)
133{ 130{
134 pxa2xx_mfp_config(&gpio18_config[1], 1);
135} 131}
136 132
137static int spitz_should_wakeup(unsigned int resume_on_alarm) 133static int spitz_should_wakeup(unsigned int resume_on_alarm)
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index d3b3cd216d64..28511d43637a 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -467,6 +467,7 @@ static void __init realview_eb_init(void)
467MACHINE_START(REALVIEW_EB, "ARM-RealView EB") 467MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
468 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 468 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
469 .atag_offset = 0x100, 469 .atag_offset = 0x100,
470 .smp = smp_ops(realview_smp_ops),
470 .fixup = realview_fixup, 471 .fixup = realview_fixup,
471 .map_io = realview_eb_map_io, 472 .map_io = realview_eb_map_io,
472 .init_early = realview_init_early, 473 .init_early = realview_init_early,
diff --git a/arch/arm/mach-s3c24xx/Kconfig b/arch/arm/mach-s3c24xx/Kconfig
index 2b6cb5f29c2d..d7a13d1771a3 100644
--- a/arch/arm/mach-s3c24xx/Kconfig
+++ b/arch/arm/mach-s3c24xx/Kconfig
@@ -400,7 +400,7 @@ config MACH_MINI2440
400 bool "MINI2440 development board" 400 bool "MINI2440 development board"
401 select EEPROM_AT24 401 select EEPROM_AT24
402 select LEDS_CLASS 402 select LEDS_CLASS
403 select LEDS_TRIGGER 403 select LEDS_TRIGGERS
404 select LEDS_TRIGGER_BACKLIGHT 404 select LEDS_TRIGGER_BACKLIGHT
405 select NEW_LEDS 405 select NEW_LEDS
406 select S3C_DEV_NAND 406 select S3C_DEV_NAND
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 6a7ad3c2a3fc..9a23739f7026 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -14,6 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/platform_data/sa11x0-serial.h>
17#include <linux/serial_core.h> 18#include <linux/serial_core.h>
18#include <linux/mfd/ucb1x00.h> 19#include <linux/mfd/ucb1x00.h>
19#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
38#include <asm/mach/irda.h> 39#include <asm/mach/irda.h>
39#include <asm/mach/map.h> 40#include <asm/mach/map.h>
40#include <asm/mach/serial_sa1100.h>
41#include <mach/assabet.h> 41#include <mach/assabet.h>
42#include <linux/platform_data/mfd-mcp-sa11x0.h> 42#include <linux/platform_data/mfd-mcp-sa11x0.h>
43#include <mach/irqs.h> 43#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index 038df4894b0f..b2dadf3ea3df 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/platform_data/sa11x0-serial.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/tty.h> 22#include <linux/tty.h>
@@ -34,7 +35,6 @@
34#include <asm/mach/flash.h> 35#include <asm/mach/flash.h>
35#include <asm/mach/map.h> 36#include <asm/mach/map.h>
36#include <asm/hardware/sa1111.h> 37#include <asm/hardware/sa1111.h>
37#include <asm/mach/serial_sa1100.h>
38 38
39#include <mach/badge4.h> 39#include <mach/badge4.h>
40 40
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index ad0eb08ea077..304bca4a07c0 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/platform_data/sa11x0-serial.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/irq.h> 18#include <linux/irq.h>
18#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
@@ -27,7 +28,6 @@
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
29#include <asm/mach/map.h> 30#include <asm/mach/map.h>
30#include <asm/mach/serial_sa1100.h>
31 31
32#include <mach/cerf.h> 32#include <mach/cerf.h>
33#include <linux/platform_data/mfd-mcp-sa11x0.h> 33#include <linux/platform_data/mfd-mcp-sa11x0.h>
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 170cb6107f68..45f424f5fca6 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -21,6 +21,7 @@
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/tty.h> 22#include <linux/tty.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/platform_data/sa11x0-serial.h>
24#include <linux/platform_device.h> 25#include <linux/platform_device.h>
25#include <linux/mfd/ucb1x00.h> 26#include <linux/mfd/ucb1x00.h>
26#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
@@ -40,7 +41,6 @@
40#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
41#include <asm/mach/flash.h> 42#include <asm/mach/flash.h>
42#include <asm/mach/map.h> 43#include <asm/mach/map.h>
43#include <asm/mach/serial_sa1100.h>
44 44
45#include <asm/hardware/scoop.h> 45#include <asm/hardware/scoop.h>
46#include <asm/mach/sharpsl_param.h> 46#include <asm/mach/sharpsl_param.h>
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
index 63150e1ffe9e..f17e7382242a 100644
--- a/arch/arm/mach-sa1100/h3xxx.c
+++ b/arch/arm/mach-sa1100/h3xxx.c
@@ -17,12 +17,12 @@
17#include <linux/mfd/htc-egpio.h> 17#include <linux/mfd/htc-egpio.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/platform_data/sa11x0-serial.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/serial_core.h> 22#include <linux/serial_core.h>
22 23
23#include <asm/mach/flash.h> 24#include <asm/mach/flash.h>
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25#include <asm/mach/serial_sa1100.h>
26 26
27#include <mach/h3xxx.h> 27#include <mach/h3xxx.h>
28 28
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index fc106aab7c7e..d005939c41fc 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -18,6 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/cpufreq.h> 20#include <linux/cpufreq.h>
21#include <linux/platform_data/sa11x0-serial.h>
21#include <linux/serial_core.h> 22#include <linux/serial_core.h>
22#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
@@ -35,7 +36,6 @@
35#include <asm/mach/flash.h> 36#include <asm/mach/flash.h>
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38#include <asm/mach/serial_sa1100.h>
39 39
40#include <mach/hardware.h> 40#include <mach/hardware.h>
41#include <mach/irqs.h> 41#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index e3084f47027d..35cfc428b4d4 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/tty.h> 18#include <linux/tty.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/platform_data/sa11x0-serial.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21#include <linux/ioport.h> 22#include <linux/ioport.h>
22#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
@@ -30,7 +31,6 @@
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
33#include <asm/mach/serial_sa1100.h>
34 34
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <mach/irqs.h> 36#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 3048b17e84c5..f69f78fc3ddd 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -4,6 +4,7 @@
4 4
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/platform_data/sa11x0-serial.h>
7#include <linux/tty.h> 8#include <linux/tty.h>
8#include <linux/gpio.h> 9#include <linux/gpio.h>
9#include <linux/leds.h> 10#include <linux/leds.h>
@@ -18,7 +19,6 @@
18 19
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21#include <asm/mach/serial_sa1100.h>
22#include <linux/platform_data/mfd-mcp-sa11x0.h> 22#include <linux/platform_data/mfd-mcp-sa11x0.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24 24
diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c
index 41f69d97066f..102e08f7b109 100644
--- a/arch/arm/mach-sa1100/nanoengine.c
+++ b/arch/arm/mach-sa1100/nanoengine.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/platform_data/sa11x0-serial.h>
16#include <linux/mtd/mtd.h> 17#include <linux/mtd/mtd.h>
17#include <linux/mtd/partitions.h> 18#include <linux/mtd/partitions.h>
18#include <linux/root_dev.h> 19#include <linux/root_dev.h>
@@ -24,7 +25,6 @@
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
25#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
27#include <asm/mach/serial_sa1100.h>
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/nanoengine.h> 30#include <mach/nanoengine.h>
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 266db873a4e4..88be0474f3d7 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -7,6 +7,7 @@
7#include <linux/irq.h> 7#include <linux/irq.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/platform_data/sa11x0-serial.h>
10#include <linux/platform_device.h> 11#include <linux/platform_device.h>
11#include <linux/pm.h> 12#include <linux/pm.h>
12#include <linux/serial_core.h> 13#include <linux/serial_core.h>
@@ -14,7 +15,6 @@
14 15
15#include <asm/mach-types.h> 16#include <asm/mach-types.h>
16#include <asm/mach/map.h> 17#include <asm/mach/map.h>
17#include <asm/mach/serial_sa1100.h>
18#include <asm/hardware/sa1111.h> 18#include <asm/hardware/sa1111.h>
19#include <asm/sizes.h> 19#include <asm/sizes.h>
20 20
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 37fe0a0a5369..c51bb63f90fb 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -6,6 +6,7 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8#include <linux/ioport.h> 8#include <linux/ioport.h>
9#include <linux/platform_data/sa11x0-serial.h>
9#include <linux/platform_device.h> 10#include <linux/platform_device.h>
10#include <linux/irq.h> 11#include <linux/irq.h>
11#include <linux/io.h> 12#include <linux/io.h>
@@ -18,7 +19,6 @@
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
20#include <asm/mach/flash.h> 21#include <asm/mach/flash.h>
21#include <asm/mach/serial_sa1100.h>
22#include <mach/irqs.h> 22#include <mach/irqs.h>
23 23
24#include "generic.h" 24#include "generic.h"
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index ff6b7b35bca9..6460d25fbb88 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -5,6 +5,7 @@
5#include <linux/init.h> 5#include <linux/init.h>
6#include <linux/device.h> 6#include <linux/device.h>
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/platform_data/sa11x0-serial.h>
8#include <linux/tty.h> 9#include <linux/tty.h>
9#include <linux/mtd/mtd.h> 10#include <linux/mtd/mtd.h>
10#include <linux/mtd/partitions.h> 11#include <linux/mtd/partitions.h>
@@ -18,7 +19,6 @@
18#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
19#include <asm/mach/flash.h> 20#include <asm/mach/flash.h>
20#include <asm/mach/map.h> 21#include <asm/mach/map.h>
21#include <asm/mach/serial_sa1100.h>
22#include <linux/platform_data/mfd-mcp-sa11x0.h> 22#include <linux/platform_data/mfd-mcp-sa11x0.h>
23#include <mach/shannon.h> 23#include <mach/shannon.h>
24#include <mach/irqs.h> 24#include <mach/irqs.h>
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index 71790e581d93..6d65f65fcb23 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -9,6 +9,7 @@
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/platform_data/sa11x0-serial.h>
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
13#include <linux/mfd/ucb1x00.h> 14#include <linux/mfd/ucb1x00.h>
14#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
@@ -23,7 +24,6 @@
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <asm/mach/flash.h> 25#include <asm/mach/flash.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/mach/serial_sa1100.h>
27#include <linux/platform_data/mfd-mcp-sa11x0.h> 27#include <linux/platform_data/mfd-mcp-sa11x0.h>
28#include <mach/simpad.h> 28#include <mach/simpad.h>
29#include <mach/irqs.h> 29#include <mach/irqs.h>
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c
index 0a43f3189c21..7a05de794a8c 100644
--- a/arch/arm/mach-shmobile/board-kzm9g.c
+++ b/arch/arm/mach-shmobile/board-kzm9g.c
@@ -548,7 +548,6 @@ static struct platform_device fsi_ak4648_device = {
548/* I2C */ 548/* I2C */
549static struct pcf857x_platform_data pcf8575_pdata = { 549static struct pcf857x_platform_data pcf8575_pdata = {
550 .gpio_base = GPIO_PCF8575_BASE, 550 .gpio_base = GPIO_PCF8575_BASE,
551 .irq = intcs_evt2irq(0x3260), /* IRQ19 */
552}; 551};
553 552
554static struct i2c_board_info i2c0_devices[] = { 553static struct i2c_board_info i2c0_devices[] = {
@@ -570,6 +569,7 @@ static struct i2c_board_info i2c1_devices[] = {
570static struct i2c_board_info i2c3_devices[] = { 569static struct i2c_board_info i2c3_devices[] = {
571 { 570 {
572 I2C_BOARD_INFO("pcf8575", 0x20), 571 I2C_BOARD_INFO("pcf8575", 0x20),
572 .irq = intcs_evt2irq(0x3260), /* IRQ19 */
573 .platform_data = &pcf8575_pdata, 573 .platform_data = &pcf8575_pdata,
574 }, 574 },
575}; 575};
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index b8efac4daed8..ece8a2dfb814 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1445,8 +1445,6 @@ static struct platform_device pinctrl_device = {
1445static struct u300_gpio_platform u300_gpio_plat = { 1445static struct u300_gpio_platform u300_gpio_plat = {
1446 .ports = 7, 1446 .ports = 7,
1447 .gpio_base = 0, 1447 .gpio_base = 0,
1448 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1449 .pinctrl_device = &pinctrl_device,
1450}; 1448};
1451 1449
1452static struct platform_device gpio_device = { 1450static struct platform_device gpio_device = {
@@ -1590,6 +1588,7 @@ static struct platform_device *platform_devs[] __initdata = {
1590 &i2c1_device, 1588 &i2c1_device,
1591 &keypad_device, 1589 &keypad_device,
1592 &rtc_device, 1590 &rtc_device,
1591 &pinctrl_device,
1593 &gpio_device, 1592 &gpio_device,
1594 &nand_device, 1593 &nand_device,
1595 &wdog_device, 1594 &wdog_device,
@@ -1804,7 +1803,7 @@ MACHINE_START(U300, "Ericsson AB U335 S335/B335 Prototype Board")
1804 /* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */ 1803 /* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */
1805 .atag_offset = 0x100, 1804 .atag_offset = 0x100,
1806 .map_io = u300_map_io, 1805 .map_io = u300_map_io,
1807 .nr_irqs = NR_IRQS_U300, 1806 .nr_irqs = 0,
1808 .init_irq = u300_init_irq, 1807 .init_irq = u300_init_irq,
1809 .handle_irq = vic_handle_irq, 1808 .handle_irq = vic_handle_irq,
1810 .timer = &u300_timer, 1809 .timer = &u300_timer,
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h
index e27425a63fa1..21d5e76a6cd3 100644
--- a/arch/arm/mach-u300/include/mach/irqs.h
+++ b/arch/arm/mach-u300/include/mach/irqs.h
@@ -12,79 +12,69 @@
12#ifndef __MACH_IRQS_H 12#ifndef __MACH_IRQS_H
13#define __MACH_IRQS_H 13#define __MACH_IRQS_H
14 14
15#define IRQ_U300_INTCON0_START 1 15#define IRQ_U300_INTCON0_START 32
16#define IRQ_U300_INTCON1_START 33 16#define IRQ_U300_INTCON1_START 64
17/* These are on INTCON0 - 30 lines */ 17/* These are on INTCON0 - 30 lines */
18#define IRQ_U300_IRQ0_EXT 1 18#define IRQ_U300_IRQ0_EXT 32
19#define IRQ_U300_IRQ1_EXT 2 19#define IRQ_U300_IRQ1_EXT 33
20#define IRQ_U300_DMA 3 20#define IRQ_U300_DMA 34
21#define IRQ_U300_VIDEO_ENC_0 4 21#define IRQ_U300_VIDEO_ENC_0 35
22#define IRQ_U300_VIDEO_ENC_1 5 22#define IRQ_U300_VIDEO_ENC_1 36
23#define IRQ_U300_AAIF_RX 6 23#define IRQ_U300_AAIF_RX 37
24#define IRQ_U300_AAIF_TX 7 24#define IRQ_U300_AAIF_TX 38
25#define IRQ_U300_AAIF_VGPIO 8 25#define IRQ_U300_AAIF_VGPIO 39
26#define IRQ_U300_AAIF_WAKEUP 9 26#define IRQ_U300_AAIF_WAKEUP 40
27#define IRQ_U300_PCM_I2S0_FRAME 10 27#define IRQ_U300_PCM_I2S0_FRAME 41
28#define IRQ_U300_PCM_I2S0_FIFO 11 28#define IRQ_U300_PCM_I2S0_FIFO 42
29#define IRQ_U300_PCM_I2S1_FRAME 12 29#define IRQ_U300_PCM_I2S1_FRAME 43
30#define IRQ_U300_PCM_I2S1_FIFO 13 30#define IRQ_U300_PCM_I2S1_FIFO 44
31#define IRQ_U300_XGAM_GAMCON 14 31#define IRQ_U300_XGAM_GAMCON 45
32#define IRQ_U300_XGAM_CDI 15 32#define IRQ_U300_XGAM_CDI 46
33#define IRQ_U300_XGAM_CDICON 16 33#define IRQ_U300_XGAM_CDICON 47
34#define IRQ_U300_XGAM_PDI 18 34#define IRQ_U300_XGAM_PDI 49
35#define IRQ_U300_XGAM_PDICON 19 35#define IRQ_U300_XGAM_PDICON 50
36#define IRQ_U300_XGAM_GAMEACC 20 36#define IRQ_U300_XGAM_GAMEACC 51
37#define IRQ_U300_XGAM_MCIDCT 21 37#define IRQ_U300_XGAM_MCIDCT 52
38#define IRQ_U300_APEX 22 38#define IRQ_U300_APEX 53
39#define IRQ_U300_UART0 23 39#define IRQ_U300_UART0 54
40#define IRQ_U300_SPI 24 40#define IRQ_U300_SPI 55
41#define IRQ_U300_TIMER_APP_OS 25 41#define IRQ_U300_TIMER_APP_OS 56
42#define IRQ_U300_TIMER_APP_DD 26 42#define IRQ_U300_TIMER_APP_DD 57
43#define IRQ_U300_TIMER_APP_GP1 27 43#define IRQ_U300_TIMER_APP_GP1 58
44#define IRQ_U300_TIMER_APP_GP2 28 44#define IRQ_U300_TIMER_APP_GP2 59
45#define IRQ_U300_TIMER_OS 29 45#define IRQ_U300_TIMER_OS 60
46#define IRQ_U300_TIMER_MS 30 46#define IRQ_U300_TIMER_MS 61
47#define IRQ_U300_KEYPAD_KEYBF 31 47#define IRQ_U300_KEYPAD_KEYBF 62
48#define IRQ_U300_KEYPAD_KEYBR 32 48#define IRQ_U300_KEYPAD_KEYBR 63
49/* These are on INTCON1 - 32 lines */ 49/* These are on INTCON1 - 32 lines */
50#define IRQ_U300_GPIO_PORT0 33 50#define IRQ_U300_GPIO_PORT0 64
51#define IRQ_U300_GPIO_PORT1 34 51#define IRQ_U300_GPIO_PORT1 65
52#define IRQ_U300_GPIO_PORT2 35 52#define IRQ_U300_GPIO_PORT2 66
53 53
54/* These are for DB3150, DB3200 and DB3350 */ 54/* These are for DB3150, DB3200 and DB3350 */
55#define IRQ_U300_WDOG 36 55#define IRQ_U300_WDOG 67
56#define IRQ_U300_EVHIST 37 56#define IRQ_U300_EVHIST 68
57#define IRQ_U300_MSPRO 38 57#define IRQ_U300_MSPRO 69
58#define IRQ_U300_MMCSD_MCIINTR0 39 58#define IRQ_U300_MMCSD_MCIINTR0 70
59#define IRQ_U300_MMCSD_MCIINTR1 40 59#define IRQ_U300_MMCSD_MCIINTR1 71
60#define IRQ_U300_I2C0 41 60#define IRQ_U300_I2C0 72
61#define IRQ_U300_I2C1 42 61#define IRQ_U300_I2C1 73
62#define IRQ_U300_RTC 43 62#define IRQ_U300_RTC 74
63#define IRQ_U300_NFIF 44 63#define IRQ_U300_NFIF 75
64#define IRQ_U300_NFIF2 45 64#define IRQ_U300_NFIF2 76
65 65
66/* The DB3350-specific interrupt lines */ 66/* The DB3350-specific interrupt lines */
67#define IRQ_U300_ISP_F0 46 67#define IRQ_U300_ISP_F0 77
68#define IRQ_U300_ISP_F1 47 68#define IRQ_U300_ISP_F1 78
69#define IRQ_U300_ISP_F2 48 69#define IRQ_U300_ISP_F2 79
70#define IRQ_U300_ISP_F3 49 70#define IRQ_U300_ISP_F3 80
71#define IRQ_U300_ISP_F4 50 71#define IRQ_U300_ISP_F4 81
72#define IRQ_U300_GPIO_PORT3 51 72#define IRQ_U300_GPIO_PORT3 82
73#define IRQ_U300_SYSCON_PLL_LOCK 52 73#define IRQ_U300_SYSCON_PLL_LOCK 83
74#define IRQ_U300_UART1 53 74#define IRQ_U300_UART1 84
75#define IRQ_U300_GPIO_PORT4 54 75#define IRQ_U300_GPIO_PORT4 85
76#define IRQ_U300_GPIO_PORT5 55 76#define IRQ_U300_GPIO_PORT5 86
77#define IRQ_U300_GPIO_PORT6 56 77#define IRQ_U300_GPIO_PORT6 87
78#define U300_VIC_IRQS_END 57 78#define U300_VIC_IRQS_END 88
79
80/* Maximum 8*7 GPIO lines */
81#ifdef CONFIG_PINCTRL_COH901
82#define IRQ_U300_GPIO_BASE (U300_VIC_IRQS_END)
83#define IRQ_U300_GPIO_END (IRQ_U300_GPIO_BASE + 56)
84#else
85#define IRQ_U300_GPIO_END (U300_VIC_IRQS_END)
86#endif
87
88#define NR_IRQS_U300 (IRQ_U300_GPIO_END - IRQ_U300_INTCON0_START)
89 79
90#endif 80#endif
diff --git a/arch/arm/mach-ux500/board-mop500-audio.c b/arch/arm/mach-ux500/board-mop500-audio.c
index 070629a95625..33631c9f1218 100644
--- a/arch/arm/mach-ux500/board-mop500-audio.c
+++ b/arch/arm/mach-ux500/board-mop500-audio.c
@@ -7,9 +7,8 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/gpio.h> 9#include <linux/gpio.h>
10#include <linux/platform_data/pinctrl-nomadik.h>
10 11
11#include <plat/gpio-nomadik.h>
12#include <plat/pincfg.h>
13#include <plat/ste_dma40.h> 12#include <plat/ste_dma40.h>
14 13
15#include <mach/devices.h> 14#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index a267c6d30e37..c34d4efd0d5c 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -9,10 +9,9 @@
9#include <linux/bug.h> 9#include <linux/bug.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pinctrl/machine.h> 11#include <linux/pinctrl/machine.h>
12#include <linux/platform_data/pinctrl-nomadik.h>
12 13
13#include <asm/mach-types.h> 14#include <asm/mach-types.h>
14#include <plat/pincfg.h>
15#include <plat/gpio-nomadik.h>
16 15
17#include <mach/hardware.h> 16#include <mach/hardware.h>
18 17
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 416d436111f2..2d16b1dd5fec 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -16,6 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/platform_data/i2c-nomadik.h> 18#include <linux/platform_data/i2c-nomadik.h>
19#include <linux/platform_data/db8500_thermal.h>
19#include <linux/gpio.h> 20#include <linux/gpio.h>
20#include <linux/amba/bus.h> 21#include <linux/amba/bus.h>
21#include <linux/amba/pl022.h> 22#include <linux/amba/pl022.h>
@@ -37,13 +38,13 @@
37#include <linux/of_platform.h> 38#include <linux/of_platform.h>
38#include <linux/leds.h> 39#include <linux/leds.h>
39#include <linux/pinctrl/consumer.h> 40#include <linux/pinctrl/consumer.h>
41#include <linux/platform_data/pinctrl-nomadik.h>
40 42
41#include <asm/mach-types.h> 43#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 44#include <asm/mach/arch.h>
43#include <asm/hardware/gic.h> 45#include <asm/hardware/gic.h>
44 46
45#include <plat/ste_dma40.h> 47#include <plat/ste_dma40.h>
46#include <plat/gpio-nomadik.h>
47 48
48#include <mach/hardware.h> 49#include <mach/hardware.h>
49#include <mach/setup.h> 50#include <mach/setup.h>
@@ -229,6 +230,67 @@ static struct ab8500_platform_data ab8500_platdata = {
229}; 230};
230 231
231/* 232/*
233 * Thermal Sensor
234 */
235
236static struct resource db8500_thsens_resources[] = {
237 {
238 .name = "IRQ_HOTMON_LOW",
239 .start = IRQ_PRCMU_HOTMON_LOW,
240 .end = IRQ_PRCMU_HOTMON_LOW,
241 .flags = IORESOURCE_IRQ,
242 },
243 {
244 .name = "IRQ_HOTMON_HIGH",
245 .start = IRQ_PRCMU_HOTMON_HIGH,
246 .end = IRQ_PRCMU_HOTMON_HIGH,
247 .flags = IORESOURCE_IRQ,
248 },
249};
250
251static struct db8500_thsens_platform_data db8500_thsens_data = {
252 .trip_points[0] = {
253 .temp = 70000,
254 .type = THERMAL_TRIP_ACTIVE,
255 .cdev_name = {
256 [0] = "thermal-cpufreq-0",
257 },
258 },
259 .trip_points[1] = {
260 .temp = 75000,
261 .type = THERMAL_TRIP_ACTIVE,
262 .cdev_name = {
263 [0] = "thermal-cpufreq-0",
264 },
265 },
266 .trip_points[2] = {
267 .temp = 80000,
268 .type = THERMAL_TRIP_ACTIVE,
269 .cdev_name = {
270 [0] = "thermal-cpufreq-0",
271 },
272 },
273 .trip_points[3] = {
274 .temp = 85000,
275 .type = THERMAL_TRIP_CRITICAL,
276 },
277 .num_trips = 4,
278};
279
280static struct platform_device u8500_thsens_device = {
281 .name = "db8500-thermal",
282 .resource = db8500_thsens_resources,
283 .num_resources = ARRAY_SIZE(db8500_thsens_resources),
284 .dev = {
285 .platform_data = &db8500_thsens_data,
286 },
287};
288
289static struct platform_device u8500_cpufreq_cooling_device = {
290 .name = "db8500-cpufreq-cooling",
291};
292
293/*
232 * TPS61052 294 * TPS61052
233 */ 295 */
234 296
@@ -583,6 +645,8 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
583 &snowball_key_dev, 645 &snowball_key_dev,
584 &snowball_sbnet_dev, 646 &snowball_sbnet_dev,
585 &snowball_gpio_en_3v3_regulator_dev, 647 &snowball_gpio_en_3v3_regulator_dev,
648 &u8500_thsens_device,
649 &u8500_cpufreq_cooling_device,
586}; 650};
587 651
588static void __init mop500_init_machine(void) 652static void __init mop500_init_machine(void)
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index bcdfe6b1d453..91f028c1264a 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -17,14 +17,14 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/mfd/abx500/ab8500.h> 19#include <linux/mfd/abx500/ab8500.h>
20#include <linux/platform_data/usb-musb-ux500.h>
21#include <linux/platform_data/pinctrl-nomadik.h>
20 22
21#include <asm/pmu.h> 23#include <asm/pmu.h>
22#include <asm/mach/map.h> 24#include <asm/mach/map.h>
23#include <plat/gpio-nomadik.h>
24#include <mach/hardware.h> 25#include <mach/hardware.h>
25#include <mach/setup.h> 26#include <mach/setup.h>
26#include <mach/devices.h> 27#include <mach/devices.h>
27#include <linux/platform_data/usb-musb-ux500.h>
28#include <mach/db8500-regs.h> 28#include <mach/db8500-regs.h>
29 29
30#include "devices-db8500.h" 30#include "devices-db8500.h"
@@ -158,7 +158,7 @@ static void __init db8500_add_gpios(struct device *parent)
158 158
159 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base), 159 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base),
160 IRQ_DB8500_GPIO0, &pdata); 160 IRQ_DB8500_GPIO0, &pdata);
161 dbx500_add_pinctrl(parent, "pinctrl-db8500"); 161 dbx500_add_pinctrl(parent, "pinctrl-db8500", U8500_PRCMU_BASE);
162} 162}
163 163
164static int usb_db8500_rx_dma_cfg[] = { 164static int usb_db8500_rx_dma_cfg[] = {
@@ -214,9 +214,6 @@ struct device * __init u8500_init_devices(struct ab8500_platform_data *ab8500)
214 db8500_add_gpios(parent); 214 db8500_add_gpios(parent);
215 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 215 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
216 216
217 platform_device_register_data(parent,
218 "cpufreq-u8500", -1, NULL, 0);
219
220 for (i = 0; i < ARRAY_SIZE(platform_devs); i++) 217 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
221 platform_devs[i]->dev.parent = parent; 218 platform_devs[i]->dev.parent = parent;
222 219
@@ -236,9 +233,6 @@ struct device * __init u8500_of_init_devices(void)
236 233
237 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 234 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
238 235
239 platform_device_register_data(parent,
240 "cpufreq-u8500", -1, NULL, 0);
241
242 u8500_dma40_device.dev.parent = parent; 236 u8500_dma40_device.dev.parent = parent;
243 237
244 /* 238 /*
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index dfdd4a54668d..692a77a1c153 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -11,8 +11,7 @@
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14 14#include <linux/platform_data/pinctrl-nomadik.h>
15#include <plat/gpio-nomadik.h>
16 15
17#include <mach/hardware.h> 16#include <mach/hardware.h>
18 17
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 7fbf0ba336e1..96fa4ac89e2e 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -129,12 +129,18 @@ void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
129 int irq, struct nmk_gpio_platform_data *pdata); 129 int irq, struct nmk_gpio_platform_data *pdata);
130 130
131static inline void 131static inline void
132dbx500_add_pinctrl(struct device *parent, const char *name) 132dbx500_add_pinctrl(struct device *parent, const char *name,
133 resource_size_t base)
133{ 134{
135 struct resource res[] = {
136 DEFINE_RES_MEM(base, SZ_8K),
137 };
134 struct platform_device_info pdevinfo = { 138 struct platform_device_info pdevinfo = {
135 .parent = parent, 139 .parent = parent,
136 .name = name, 140 .name = name,
137 .id = -1, 141 .id = -1,
142 .res = res,
143 .num_res = ARRAY_SIZE(res),
138 }; 144 };
139 145
140 platform_device_register_full(&pdevinfo); 146 platform_device_register_full(&pdevinfo);
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index 560e0df728f8..359f782c747d 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -589,7 +589,7 @@ void __init v2m_dt_init_early(void)
589 return; 589 return;
590 590
591 /* Confirm board type against DT property, if available */ 591 /* Confirm board type against DT property, if available */
592 if (of_property_read_u32(allnodes, "arm,hbi", &dt_hbi) == 0) { 592 if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) {
593 int site = v2m_get_master_site(); 593 int site = v2m_get_master_site();
594 u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ? 594 u32 id = readl(v2m_sysreg_base + (site == SYS_CFG_SITE_DB2 ?
595 V2M_SYS_PROCID1 : V2M_SYS_PROCID0)); 595 V2M_SYS_PROCID1 : V2M_SYS_PROCID0));
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 023f443784ec..b820edaf3184 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -745,7 +745,7 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
745static int 745static int
746do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) 746do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
747{ 747{
748 union offset_union offset; 748 union offset_union uninitialized_var(offset);
749 unsigned long instr = 0, instrptr; 749 unsigned long instr = 0, instrptr;
750 int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs); 750 int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
751 unsigned int type; 751 unsigned int type;
diff --git a/arch/arm/mm/cache-aurora-l2.h b/arch/arm/mm/cache-aurora-l2.h
new file mode 100644
index 000000000000..c86124769831
--- /dev/null
+++ b/arch/arm/mm/cache-aurora-l2.h
@@ -0,0 +1,55 @@
1/*
2 * AURORA shared L2 cache controller support
3 *
4 * Copyright (C) 2012 Marvell
5 *
6 * Yehuda Yitschak <yehuday@marvell.com>
7 * Gregory CLEMENT <gregory.clement@free-electrons.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __ASM_ARM_HARDWARE_AURORA_L2_H
15#define __ASM_ARM_HARDWARE_AURORA_L2_H
16
17#define AURORA_SYNC_REG 0x700
18#define AURORA_RANGE_BASE_ADDR_REG 0x720
19#define AURORA_FLUSH_PHY_ADDR_REG 0x7f0
20#define AURORA_INVAL_RANGE_REG 0x774
21#define AURORA_CLEAN_RANGE_REG 0x7b4
22#define AURORA_FLUSH_RANGE_REG 0x7f4
23
24#define AURORA_ACR_REPLACEMENT_OFFSET 27
25#define AURORA_ACR_REPLACEMENT_MASK \
26 (0x3 << AURORA_ACR_REPLACEMENT_OFFSET)
27#define AURORA_ACR_REPLACEMENT_TYPE_WAYRR \
28 (0 << AURORA_ACR_REPLACEMENT_OFFSET)
29#define AURORA_ACR_REPLACEMENT_TYPE_LFSR \
30 (1 << AURORA_ACR_REPLACEMENT_OFFSET)
31#define AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU \
32 (3 << AURORA_ACR_REPLACEMENT_OFFSET)
33
34#define AURORA_ACR_FORCE_WRITE_POLICY_OFFSET 0
35#define AURORA_ACR_FORCE_WRITE_POLICY_MASK \
36 (0x3 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
37#define AURORA_ACR_FORCE_WRITE_POLICY_DIS \
38 (0 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
39#define AURORA_ACR_FORCE_WRITE_BACK_POLICY \
40 (1 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
41#define AURORA_ACR_FORCE_WRITE_THRO_POLICY \
42 (2 << AURORA_ACR_FORCE_WRITE_POLICY_OFFSET)
43
44#define MAX_RANGE_SIZE 1024
45
46#define AURORA_WAY_SIZE_SHIFT 2
47
48#define AURORA_CTRL_FW 0x100
49
50/* chose a number outside L2X0_CACHE_ID_PART_MASK to be sure to make
51 * the distinction between a number coming from hardware and a number
52 * coming from the device tree */
53#define AURORA_CACHE_ID 0x100
54
55#endif /* __ASM_ARM_HARDWARE_AURORA_L2_H */
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 8a97e6443c62..6911b8b2745c 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -25,6 +25,7 @@
25 25
26#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
27#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
28#include "cache-aurora-l2.h"
28 29
29#define CACHE_LINE_SIZE 32 30#define CACHE_LINE_SIZE 32
30 31
@@ -34,14 +35,20 @@ static u32 l2x0_way_mask; /* Bitmask of active ways */
34static u32 l2x0_size; 35static u32 l2x0_size;
35static unsigned long sync_reg_offset = L2X0_CACHE_SYNC; 36static unsigned long sync_reg_offset = L2X0_CACHE_SYNC;
36 37
38/* Aurora don't have the cache ID register available, so we have to
39 * pass it though the device tree */
40static u32 cache_id_part_number_from_dt;
41
37struct l2x0_regs l2x0_saved_regs; 42struct l2x0_regs l2x0_saved_regs;
38 43
39struct l2x0_of_data { 44struct l2x0_of_data {
40 void (*setup)(const struct device_node *, u32 *, u32 *); 45 void (*setup)(const struct device_node *, u32 *, u32 *);
41 void (*save)(void); 46 void (*save)(void);
42 void (*resume)(void); 47 struct outer_cache_fns outer_cache;
43}; 48};
44 49
50static bool of_init = false;
51
45static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 52static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
46{ 53{
47 /* wait for cache operation by line or way to complete */ 54 /* wait for cache operation by line or way to complete */
@@ -168,7 +175,7 @@ static void l2x0_inv_all(void)
168 /* invalidate all ways */ 175 /* invalidate all ways */
169 raw_spin_lock_irqsave(&l2x0_lock, flags); 176 raw_spin_lock_irqsave(&l2x0_lock, flags);
170 /* Invalidating when L2 is enabled is a nono */ 177 /* Invalidating when L2 is enabled is a nono */
171 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1); 178 BUG_ON(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN);
172 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 179 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
173 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); 180 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
174 cache_sync(); 181 cache_sync();
@@ -292,11 +299,18 @@ static void l2x0_unlock(u32 cache_id)
292 int lockregs; 299 int lockregs;
293 int i; 300 int i;
294 301
295 if (cache_id == L2X0_CACHE_ID_PART_L310) 302 switch (cache_id) {
303 case L2X0_CACHE_ID_PART_L310:
296 lockregs = 8; 304 lockregs = 8;
297 else 305 break;
306 case AURORA_CACHE_ID:
307 lockregs = 4;
308 break;
309 default:
298 /* L210 and unknown types */ 310 /* L210 and unknown types */
299 lockregs = 1; 311 lockregs = 1;
312 break;
313 }
300 314
301 for (i = 0; i < lockregs; i++) { 315 for (i = 0; i < lockregs; i++) {
302 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE + 316 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE +
@@ -312,18 +326,22 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
312 u32 cache_id; 326 u32 cache_id;
313 u32 way_size = 0; 327 u32 way_size = 0;
314 int ways; 328 int ways;
329 int way_size_shift = L2X0_WAY_SIZE_SHIFT;
315 const char *type; 330 const char *type;
316 331
317 l2x0_base = base; 332 l2x0_base = base;
318 333 if (cache_id_part_number_from_dt)
319 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID); 334 cache_id = cache_id_part_number_from_dt;
335 else
336 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID)
337 & L2X0_CACHE_ID_PART_MASK;
320 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 338 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
321 339
322 aux &= aux_mask; 340 aux &= aux_mask;
323 aux |= aux_val; 341 aux |= aux_val;
324 342
325 /* Determine the number of ways */ 343 /* Determine the number of ways */
326 switch (cache_id & L2X0_CACHE_ID_PART_MASK) { 344 switch (cache_id) {
327 case L2X0_CACHE_ID_PART_L310: 345 case L2X0_CACHE_ID_PART_L310:
328 if (aux & (1 << 16)) 346 if (aux & (1 << 16))
329 ways = 16; 347 ways = 16;
@@ -340,6 +358,14 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
340 ways = (aux >> 13) & 0xf; 358 ways = (aux >> 13) & 0xf;
341 type = "L210"; 359 type = "L210";
342 break; 360 break;
361
362 case AURORA_CACHE_ID:
363 sync_reg_offset = AURORA_SYNC_REG;
364 ways = (aux >> 13) & 0xf;
365 ways = 2 << ((ways + 1) >> 2);
366 way_size_shift = AURORA_WAY_SIZE_SHIFT;
367 type = "Aurora";
368 break;
343 default: 369 default:
344 /* Assume unknown chips have 8 ways */ 370 /* Assume unknown chips have 8 ways */
345 ways = 8; 371 ways = 8;
@@ -353,7 +379,8 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
353 * L2 cache Size = Way size * Number of ways 379 * L2 cache Size = Way size * Number of ways
354 */ 380 */
355 way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17; 381 way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17;
356 way_size = 1 << (way_size + 3); 382 way_size = 1 << (way_size + way_size_shift);
383
357 l2x0_size = ways * way_size * SZ_1K; 384 l2x0_size = ways * way_size * SZ_1K;
358 385
359 /* 386 /*
@@ -361,7 +388,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
361 * If you are booting from non-secure mode 388 * If you are booting from non-secure mode
362 * accessing the below registers will fault. 389 * accessing the below registers will fault.
363 */ 390 */
364 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 391 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
365 /* Make sure that I&D is not locked down when starting */ 392 /* Make sure that I&D is not locked down when starting */
366 l2x0_unlock(cache_id); 393 l2x0_unlock(cache_id);
367 394
@@ -371,7 +398,7 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
371 l2x0_inv_all(); 398 l2x0_inv_all();
372 399
373 /* enable L2X0 */ 400 /* enable L2X0 */
374 writel_relaxed(1, l2x0_base + L2X0_CTRL); 401 writel_relaxed(L2X0_CTRL_EN, l2x0_base + L2X0_CTRL);
375 } 402 }
376 403
377 /* Re-read it in case some bits are reserved. */ 404 /* Re-read it in case some bits are reserved. */
@@ -380,13 +407,15 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
380 /* Save the value for resuming. */ 407 /* Save the value for resuming. */
381 l2x0_saved_regs.aux_ctrl = aux; 408 l2x0_saved_regs.aux_ctrl = aux;
382 409
383 outer_cache.inv_range = l2x0_inv_range; 410 if (!of_init) {
384 outer_cache.clean_range = l2x0_clean_range; 411 outer_cache.inv_range = l2x0_inv_range;
385 outer_cache.flush_range = l2x0_flush_range; 412 outer_cache.clean_range = l2x0_clean_range;
386 outer_cache.sync = l2x0_cache_sync; 413 outer_cache.flush_range = l2x0_flush_range;
387 outer_cache.flush_all = l2x0_flush_all; 414 outer_cache.sync = l2x0_cache_sync;
388 outer_cache.inv_all = l2x0_inv_all; 415 outer_cache.flush_all = l2x0_flush_all;
389 outer_cache.disable = l2x0_disable; 416 outer_cache.inv_all = l2x0_inv_all;
417 outer_cache.disable = l2x0_disable;
418 }
390 419
391 printk(KERN_INFO "%s cache controller enabled\n", type); 420 printk(KERN_INFO "%s cache controller enabled\n", type);
392 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 421 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
@@ -394,6 +423,100 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
394} 423}
395 424
396#ifdef CONFIG_OF 425#ifdef CONFIG_OF
426static int l2_wt_override;
427
428/*
429 * Note that the end addresses passed to Linux primitives are
430 * noninclusive, while the hardware cache range operations use
431 * inclusive start and end addresses.
432 */
433static unsigned long calc_range_end(unsigned long start, unsigned long end)
434{
435 /*
436 * Limit the number of cache lines processed at once,
437 * since cache range operations stall the CPU pipeline
438 * until completion.
439 */
440 if (end > start + MAX_RANGE_SIZE)
441 end = start + MAX_RANGE_SIZE;
442
443 /*
444 * Cache range operations can't straddle a page boundary.
445 */
446 if (end > PAGE_ALIGN(start+1))
447 end = PAGE_ALIGN(start+1);
448
449 return end;
450}
451
452/*
453 * Make sure 'start' and 'end' reference the same page, as L2 is PIPT
454 * and range operations only do a TLB lookup on the start address.
455 */
456static void aurora_pa_range(unsigned long start, unsigned long end,
457 unsigned long offset)
458{
459 unsigned long flags;
460
461 raw_spin_lock_irqsave(&l2x0_lock, flags);
462 writel(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG);
463 writel(end, l2x0_base + offset);
464 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
465
466 cache_sync();
467}
468
469static void aurora_inv_range(unsigned long start, unsigned long end)
470{
471 /*
472 * round start and end adresses up to cache line size
473 */
474 start &= ~(CACHE_LINE_SIZE - 1);
475 end = ALIGN(end, CACHE_LINE_SIZE);
476
477 /*
478 * Invalidate all full cache lines between 'start' and 'end'.
479 */
480 while (start < end) {
481 unsigned long range_end = calc_range_end(start, end);
482 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
483 AURORA_INVAL_RANGE_REG);
484 start = range_end;
485 }
486}
487
488static void aurora_clean_range(unsigned long start, unsigned long end)
489{
490 /*
491 * If L2 is forced to WT, the L2 will always be clean and we
492 * don't need to do anything here.
493 */
494 if (!l2_wt_override) {
495 start &= ~(CACHE_LINE_SIZE - 1);
496 end = ALIGN(end, CACHE_LINE_SIZE);
497 while (start != end) {
498 unsigned long range_end = calc_range_end(start, end);
499 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
500 AURORA_CLEAN_RANGE_REG);
501 start = range_end;
502 }
503 }
504}
505
506static void aurora_flush_range(unsigned long start, unsigned long end)
507{
508 if (!l2_wt_override) {
509 start &= ~(CACHE_LINE_SIZE - 1);
510 end = ALIGN(end, CACHE_LINE_SIZE);
511 while (start != end) {
512 unsigned long range_end = calc_range_end(start, end);
513 aurora_pa_range(start, range_end - CACHE_LINE_SIZE,
514 AURORA_FLUSH_RANGE_REG);
515 start = range_end;
516 }
517 }
518}
519
397static void __init l2x0_of_setup(const struct device_node *np, 520static void __init l2x0_of_setup(const struct device_node *np,
398 u32 *aux_val, u32 *aux_mask) 521 u32 *aux_val, u32 *aux_mask)
399{ 522{
@@ -491,9 +614,15 @@ static void __init pl310_save(void)
491 } 614 }
492} 615}
493 616
617static void aurora_save(void)
618{
619 l2x0_saved_regs.ctrl = readl_relaxed(l2x0_base + L2X0_CTRL);
620 l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
621}
622
494static void l2x0_resume(void) 623static void l2x0_resume(void)
495{ 624{
496 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 625 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
497 /* restore aux ctrl and enable l2 */ 626 /* restore aux ctrl and enable l2 */
498 l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID)); 627 l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID));
499 628
@@ -502,7 +631,7 @@ static void l2x0_resume(void)
502 631
503 l2x0_inv_all(); 632 l2x0_inv_all();
504 633
505 writel_relaxed(1, l2x0_base + L2X0_CTRL); 634 writel_relaxed(L2X0_CTRL_EN, l2x0_base + L2X0_CTRL);
506 } 635 }
507} 636}
508 637
@@ -510,7 +639,7 @@ static void pl310_resume(void)
510{ 639{
511 u32 l2x0_revision; 640 u32 l2x0_revision;
512 641
513 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 642 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
514 /* restore pl310 setup */ 643 /* restore pl310 setup */
515 writel_relaxed(l2x0_saved_regs.tag_latency, 644 writel_relaxed(l2x0_saved_regs.tag_latency,
516 l2x0_base + L2X0_TAG_LATENCY_CTRL); 645 l2x0_base + L2X0_TAG_LATENCY_CTRL);
@@ -536,22 +665,108 @@ static void pl310_resume(void)
536 l2x0_resume(); 665 l2x0_resume();
537} 666}
538 667
668static void aurora_resume(void)
669{
670 if (!(readl(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
671 writel(l2x0_saved_regs.aux_ctrl, l2x0_base + L2X0_AUX_CTRL);
672 writel(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL);
673 }
674}
675
676static void __init aurora_broadcast_l2_commands(void)
677{
678 __u32 u;
679 /* Enable Broadcasting of cache commands to L2*/
680 __asm__ __volatile__("mrc p15, 1, %0, c15, c2, 0" : "=r"(u));
681 u |= AURORA_CTRL_FW; /* Set the FW bit */
682 __asm__ __volatile__("mcr p15, 1, %0, c15, c2, 0\n" : : "r"(u));
683 isb();
684}
685
686static void __init aurora_of_setup(const struct device_node *np,
687 u32 *aux_val, u32 *aux_mask)
688{
689 u32 val = AURORA_ACR_REPLACEMENT_TYPE_SEMIPLRU;
690 u32 mask = AURORA_ACR_REPLACEMENT_MASK;
691
692 of_property_read_u32(np, "cache-id-part",
693 &cache_id_part_number_from_dt);
694
695 /* Determine and save the write policy */
696 l2_wt_override = of_property_read_bool(np, "wt-override");
697
698 if (l2_wt_override) {
699 val |= AURORA_ACR_FORCE_WRITE_THRO_POLICY;
700 mask |= AURORA_ACR_FORCE_WRITE_POLICY_MASK;
701 }
702
703 *aux_val &= ~mask;
704 *aux_val |= val;
705 *aux_mask &= ~mask;
706}
707
539static const struct l2x0_of_data pl310_data = { 708static const struct l2x0_of_data pl310_data = {
540 pl310_of_setup, 709 .setup = pl310_of_setup,
541 pl310_save, 710 .save = pl310_save,
542 pl310_resume, 711 .outer_cache = {
712 .resume = pl310_resume,
713 .inv_range = l2x0_inv_range,
714 .clean_range = l2x0_clean_range,
715 .flush_range = l2x0_flush_range,
716 .sync = l2x0_cache_sync,
717 .flush_all = l2x0_flush_all,
718 .inv_all = l2x0_inv_all,
719 .disable = l2x0_disable,
720 .set_debug = pl310_set_debug,
721 },
543}; 722};
544 723
545static const struct l2x0_of_data l2x0_data = { 724static const struct l2x0_of_data l2x0_data = {
546 l2x0_of_setup, 725 .setup = l2x0_of_setup,
547 NULL, 726 .save = NULL,
548 l2x0_resume, 727 .outer_cache = {
728 .resume = l2x0_resume,
729 .inv_range = l2x0_inv_range,
730 .clean_range = l2x0_clean_range,
731 .flush_range = l2x0_flush_range,
732 .sync = l2x0_cache_sync,
733 .flush_all = l2x0_flush_all,
734 .inv_all = l2x0_inv_all,
735 .disable = l2x0_disable,
736 },
737};
738
739static const struct l2x0_of_data aurora_with_outer_data = {
740 .setup = aurora_of_setup,
741 .save = aurora_save,
742 .outer_cache = {
743 .resume = aurora_resume,
744 .inv_range = aurora_inv_range,
745 .clean_range = aurora_clean_range,
746 .flush_range = aurora_flush_range,
747 .sync = l2x0_cache_sync,
748 .flush_all = l2x0_flush_all,
749 .inv_all = l2x0_inv_all,
750 .disable = l2x0_disable,
751 },
752};
753
754static const struct l2x0_of_data aurora_no_outer_data = {
755 .setup = aurora_of_setup,
756 .save = aurora_save,
757 .outer_cache = {
758 .resume = aurora_resume,
759 },
549}; 760};
550 761
551static const struct of_device_id l2x0_ids[] __initconst = { 762static const struct of_device_id l2x0_ids[] __initconst = {
552 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data }, 763 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
553 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data }, 764 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
554 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data }, 765 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
766 { .compatible = "marvell,aurora-system-cache",
767 .data = (void *)&aurora_no_outer_data},
768 { .compatible = "marvell,aurora-outer-cache",
769 .data = (void *)&aurora_with_outer_data},
555 {} 770 {}
556}; 771};
557 772
@@ -577,17 +792,24 @@ int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
577 data = of_match_node(l2x0_ids, np)->data; 792 data = of_match_node(l2x0_ids, np)->data;
578 793
579 /* L2 configuration can only be changed if the cache is disabled */ 794 /* L2 configuration can only be changed if the cache is disabled */
580 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) { 795 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) {
581 if (data->setup) 796 if (data->setup)
582 data->setup(np, &aux_val, &aux_mask); 797 data->setup(np, &aux_val, &aux_mask);
798
799 /* For aurora cache in no outer mode select the
800 * correct mode using the coprocessor*/
801 if (data == &aurora_no_outer_data)
802 aurora_broadcast_l2_commands();
583 } 803 }
584 804
585 if (data->save) 805 if (data->save)
586 data->save(); 806 data->save();
587 807
808 of_init = true;
588 l2x0_init(l2x0_base, aux_val, aux_mask); 809 l2x0_init(l2x0_base, aux_val, aux_mask);
589 810
590 outer_cache.resume = data->resume; 811 memcpy(&outer_cache, &data->outer_cache, sizeof(outer_cache));
812
591 return 0; 813 return 0;
592} 814}
593#endif 815#endif
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index 4e07eec1270d..bc4a5e9ebb78 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -2,6 +2,9 @@
2 * linux/arch/arm/mm/context.c 2 * linux/arch/arm/mm/context.c
3 * 3 *
4 * Copyright (C) 2002-2003 Deep Blue Solutions Ltd, all rights reserved. 4 * Copyright (C) 2002-2003 Deep Blue Solutions Ltd, all rights reserved.
5 * Copyright (C) 2012 ARM Limited
6 *
7 * Author: Will Deacon <will.deacon@arm.com>
5 * 8 *
6 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -14,14 +17,40 @@
14#include <linux/percpu.h> 17#include <linux/percpu.h>
15 18
16#include <asm/mmu_context.h> 19#include <asm/mmu_context.h>
20#include <asm/smp_plat.h>
17#include <asm/thread_notify.h> 21#include <asm/thread_notify.h>
18#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
19 23
24/*
25 * On ARMv6, we have the following structure in the Context ID:
26 *
27 * 31 7 0
28 * +-------------------------+-----------+
29 * | process ID | ASID |
30 * +-------------------------+-----------+
31 * | context ID |
32 * +-------------------------------------+
33 *
34 * The ASID is used to tag entries in the CPU caches and TLBs.
35 * The context ID is used by debuggers and trace logic, and
36 * should be unique within all running processes.
37 */
38#define ASID_FIRST_VERSION (1ULL << ASID_BITS)
39#define NUM_USER_ASIDS (ASID_FIRST_VERSION - 1)
40
41#define ASID_TO_IDX(asid) ((asid & ~ASID_MASK) - 1)
42#define IDX_TO_ASID(idx) ((idx + 1) & ~ASID_MASK)
43
20static DEFINE_RAW_SPINLOCK(cpu_asid_lock); 44static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
21unsigned int cpu_last_asid = ASID_FIRST_VERSION; 45static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
46static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
47
48static DEFINE_PER_CPU(atomic64_t, active_asids);
49static DEFINE_PER_CPU(u64, reserved_asids);
50static cpumask_t tlb_flush_pending;
22 51
23#ifdef CONFIG_ARM_LPAE 52#ifdef CONFIG_ARM_LPAE
24void cpu_set_reserved_ttbr0(void) 53static void cpu_set_reserved_ttbr0(void)
25{ 54{
26 unsigned long ttbl = __pa(swapper_pg_dir); 55 unsigned long ttbl = __pa(swapper_pg_dir);
27 unsigned long ttbh = 0; 56 unsigned long ttbh = 0;
@@ -37,7 +66,7 @@ void cpu_set_reserved_ttbr0(void)
37 isb(); 66 isb();
38} 67}
39#else 68#else
40void cpu_set_reserved_ttbr0(void) 69static void cpu_set_reserved_ttbr0(void)
41{ 70{
42 u32 ttb; 71 u32 ttb;
43 /* Copy TTBR1 into TTBR0 */ 72 /* Copy TTBR1 into TTBR0 */
@@ -84,124 +113,104 @@ static int __init contextidr_notifier_init(void)
84arch_initcall(contextidr_notifier_init); 113arch_initcall(contextidr_notifier_init);
85#endif 114#endif
86 115
87/* 116static void flush_context(unsigned int cpu)
88 * We fork()ed a process, and we need a new context for the child
89 * to run in.
90 */
91void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
92{ 117{
93 mm->context.id = 0; 118 int i;
94 raw_spin_lock_init(&mm->context.id_lock); 119 u64 asid;
95} 120
121 /* Update the list of reserved ASIDs and the ASID bitmap. */
122 bitmap_clear(asid_map, 0, NUM_USER_ASIDS);
123 for_each_possible_cpu(i) {
124 if (i == cpu) {
125 asid = 0;
126 } else {
127 asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
128 __set_bit(ASID_TO_IDX(asid), asid_map);
129 }
130 per_cpu(reserved_asids, i) = asid;
131 }
96 132
97static void flush_context(void) 133 /* Queue a TLB invalidate and flush the I-cache if necessary. */
98{ 134 if (!tlb_ops_need_broadcast())
99 cpu_set_reserved_ttbr0(); 135 cpumask_set_cpu(cpu, &tlb_flush_pending);
100 local_flush_tlb_all(); 136 else
101 if (icache_is_vivt_asid_tagged()) { 137 cpumask_setall(&tlb_flush_pending);
138
139 if (icache_is_vivt_asid_tagged())
102 __flush_icache_all(); 140 __flush_icache_all();
103 dsb();
104 }
105} 141}
106 142
107#ifdef CONFIG_SMP 143static int is_reserved_asid(u64 asid)
144{
145 int cpu;
146 for_each_possible_cpu(cpu)
147 if (per_cpu(reserved_asids, cpu) == asid)
148 return 1;
149 return 0;
150}
108 151
109static void set_mm_context(struct mm_struct *mm, unsigned int asid) 152static void new_context(struct mm_struct *mm, unsigned int cpu)
110{ 153{
111 unsigned long flags; 154 u64 asid = mm->context.id;
155 u64 generation = atomic64_read(&asid_generation);
112 156
113 /* 157 if (asid != 0 && is_reserved_asid(asid)) {
114 * Locking needed for multi-threaded applications where the
115 * same mm->context.id could be set from different CPUs during
116 * the broadcast. This function is also called via IPI so the
117 * mm->context.id_lock has to be IRQ-safe.
118 */
119 raw_spin_lock_irqsave(&mm->context.id_lock, flags);
120 if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) {
121 /* 158 /*
122 * Old version of ASID found. Set the new one and 159 * Our current ASID was active during a rollover, we can
123 * reset mm_cpumask(mm). 160 * continue to use it and this was just a false alarm.
124 */ 161 */
125 mm->context.id = asid; 162 asid = generation | (asid & ~ASID_MASK);
163 } else {
164 /*
165 * Allocate a free ASID. If we can't find one, take a
166 * note of the currently active ASIDs and mark the TLBs
167 * as requiring flushes.
168 */
169 asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS);
170 if (asid == NUM_USER_ASIDS) {
171 generation = atomic64_add_return(ASID_FIRST_VERSION,
172 &asid_generation);
173 flush_context(cpu);
174 asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS);
175 }
176 __set_bit(asid, asid_map);
177 asid = generation | IDX_TO_ASID(asid);
126 cpumask_clear(mm_cpumask(mm)); 178 cpumask_clear(mm_cpumask(mm));
127 } 179 }
128 raw_spin_unlock_irqrestore(&mm->context.id_lock, flags);
129 180
130 /* 181 mm->context.id = asid;
131 * Set the mm_cpumask(mm) bit for the current CPU.
132 */
133 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
134} 182}
135 183
136/* 184void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
137 * Reset the ASID on the current CPU. This function call is broadcast
138 * from the CPU handling the ASID rollover and holding cpu_asid_lock.
139 */
140static void reset_context(void *info)
141{ 185{
142 unsigned int asid; 186 unsigned long flags;
143 unsigned int cpu = smp_processor_id(); 187 unsigned int cpu = smp_processor_id();
144 struct mm_struct *mm = current->active_mm;
145 188
146 smp_rmb(); 189 if (unlikely(mm->context.vmalloc_seq != init_mm.context.vmalloc_seq))
147 asid = cpu_last_asid + cpu + 1; 190 __check_vmalloc_seq(mm);
148 191
149 flush_context(); 192 /*
150 set_mm_context(mm, asid); 193 * Required during context switch to avoid speculative page table
151 194 * walking with the wrong TTBR.
152 /* set the new ASID */ 195 */
153 cpu_switch_mm(mm->pgd, mm); 196 cpu_set_reserved_ttbr0();
154}
155 197
156#else 198 if (!((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS)
199 && atomic64_xchg(&per_cpu(active_asids, cpu), mm->context.id))
200 goto switch_mm_fastpath;
157 201
158static inline void set_mm_context(struct mm_struct *mm, unsigned int asid) 202 raw_spin_lock_irqsave(&cpu_asid_lock, flags);
159{ 203 /* Check that our ASID belongs to the current generation. */
160 mm->context.id = asid; 204 if ((mm->context.id ^ atomic64_read(&asid_generation)) >> ASID_BITS)
161 cpumask_copy(mm_cpumask(mm), cpumask_of(smp_processor_id())); 205 new_context(mm, cpu);
162}
163 206
164#endif 207 atomic64_set(&per_cpu(active_asids, cpu), mm->context.id);
208 cpumask_set_cpu(cpu, mm_cpumask(mm));
165 209
166void __new_context(struct mm_struct *mm) 210 if (cpumask_test_and_clear_cpu(cpu, &tlb_flush_pending))
167{ 211 local_flush_tlb_all();
168 unsigned int asid; 212 raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
169 213
170 raw_spin_lock(&cpu_asid_lock); 214switch_mm_fastpath:
171#ifdef CONFIG_SMP 215 cpu_switch_mm(mm->pgd, mm);
172 /*
173 * Check the ASID again, in case the change was broadcast from
174 * another CPU before we acquired the lock.
175 */
176 if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) {
177 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
178 raw_spin_unlock(&cpu_asid_lock);
179 return;
180 }
181#endif
182 /*
183 * At this point, it is guaranteed that the current mm (with
184 * an old ASID) isn't active on any other CPU since the ASIDs
185 * are changed simultaneously via IPI.
186 */
187 asid = ++cpu_last_asid;
188 if (asid == 0)
189 asid = cpu_last_asid = ASID_FIRST_VERSION;
190
191 /*
192 * If we've used up all our ASIDs, we need
193 * to start a new version and flush the TLB.
194 */
195 if (unlikely((asid & ~ASID_MASK) == 0)) {
196 asid = cpu_last_asid + smp_processor_id() + 1;
197 flush_context();
198#ifdef CONFIG_SMP
199 smp_wmb();
200 smp_call_function(reset_context, NULL, 1);
201#endif
202 cpu_last_asid += NR_CPUS;
203 }
204
205 set_mm_context(mm, asid);
206 raw_spin_unlock(&cpu_asid_lock);
207} 216}
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index ab88ed4f8e08..99db769307ec 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -92,6 +92,9 @@ static int __init init_static_idmap(void)
92 (long long)idmap_start, (long long)idmap_end); 92 (long long)idmap_start, (long long)idmap_end);
93 identity_mapping_add(idmap_pgd, idmap_start, idmap_end); 93 identity_mapping_add(idmap_pgd, idmap_start, idmap_end);
94 94
95 /* Flush L1 for the hardware to see this page table content */
96 flush_cache_louis();
97
95 return 0; 98 return 0;
96} 99}
97early_initcall(init_static_idmap); 100early_initcall(init_static_idmap);
@@ -103,12 +106,15 @@ early_initcall(init_static_idmap);
103 */ 106 */
104void setup_mm_for_reboot(void) 107void setup_mm_for_reboot(void)
105{ 108{
106 /* Clean and invalidate L1. */
107 flush_cache_all();
108
109 /* Switch to the identity mapping. */ 109 /* Switch to the identity mapping. */
110 cpu_switch_mm(idmap_pgd, &init_mm); 110 cpu_switch_mm(idmap_pgd, &init_mm);
111 111
112 /* Flush the TLB. */ 112#ifdef CONFIG_CPU_HAS_ASID
113 /*
114 * We don't have a clean ASID for the identity mapping, which
115 * may clash with virtual addresses of the previous page tables
116 * and therefore potentially in the TLB.
117 */
113 local_flush_tlb_all(); 118 local_flush_tlb_all();
119#endif
114} 120}
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 5dcc2fd46c46..88fd86cf3d9a 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -47,18 +47,18 @@ int ioremap_page(unsigned long virt, unsigned long phys,
47} 47}
48EXPORT_SYMBOL(ioremap_page); 48EXPORT_SYMBOL(ioremap_page);
49 49
50void __check_kvm_seq(struct mm_struct *mm) 50void __check_vmalloc_seq(struct mm_struct *mm)
51{ 51{
52 unsigned int seq; 52 unsigned int seq;
53 53
54 do { 54 do {
55 seq = init_mm.context.kvm_seq; 55 seq = init_mm.context.vmalloc_seq;
56 memcpy(pgd_offset(mm, VMALLOC_START), 56 memcpy(pgd_offset(mm, VMALLOC_START),
57 pgd_offset_k(VMALLOC_START), 57 pgd_offset_k(VMALLOC_START),
58 sizeof(pgd_t) * (pgd_index(VMALLOC_END) - 58 sizeof(pgd_t) * (pgd_index(VMALLOC_END) -
59 pgd_index(VMALLOC_START))); 59 pgd_index(VMALLOC_START)));
60 mm->context.kvm_seq = seq; 60 mm->context.vmalloc_seq = seq;
61 } while (seq != init_mm.context.kvm_seq); 61 } while (seq != init_mm.context.vmalloc_seq);
62} 62}
63 63
64#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE) 64#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
@@ -89,13 +89,13 @@ static void unmap_area_sections(unsigned long virt, unsigned long size)
89 if (!pmd_none(pmd)) { 89 if (!pmd_none(pmd)) {
90 /* 90 /*
91 * Clear the PMD from the page table, and 91 * Clear the PMD from the page table, and
92 * increment the kvm sequence so others 92 * increment the vmalloc sequence so others
93 * notice this change. 93 * notice this change.
94 * 94 *
95 * Note: this is still racy on SMP machines. 95 * Note: this is still racy on SMP machines.
96 */ 96 */
97 pmd_clear(pmdp); 97 pmd_clear(pmdp);
98 init_mm.context.kvm_seq++; 98 init_mm.context.vmalloc_seq++;
99 99
100 /* 100 /*
101 * Free the page table, if there was one. 101 * Free the page table, if there was one.
@@ -112,8 +112,8 @@ static void unmap_area_sections(unsigned long virt, unsigned long size)
112 * Ensure that the active_mm is up to date - we want to 112 * Ensure that the active_mm is up to date - we want to
113 * catch any use-after-iounmap cases. 113 * catch any use-after-iounmap cases.
114 */ 114 */
115 if (current->active_mm->context.kvm_seq != init_mm.context.kvm_seq) 115 if (current->active_mm->context.vmalloc_seq != init_mm.context.vmalloc_seq)
116 __check_kvm_seq(current->active_mm); 116 __check_vmalloc_seq(current->active_mm);
117 117
118 flush_tlb_kernel_range(virt, end); 118 flush_tlb_kernel_range(virt, end);
119} 119}
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index ce8cb1970d7a..10062ceadd1c 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -11,18 +11,6 @@
11#include <linux/random.h> 11#include <linux/random.h>
12#include <asm/cachetype.h> 12#include <asm/cachetype.h>
13 13
14static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
15 unsigned long pgoff)
16{
17 unsigned long base = addr & ~(SHMLBA-1);
18 unsigned long off = (pgoff << PAGE_SHIFT) & (SHMLBA-1);
19
20 if (base + off <= addr)
21 return base + off;
22
23 return base - off;
24}
25
26#define COLOUR_ALIGN(addr,pgoff) \ 14#define COLOUR_ALIGN(addr,pgoff) \
27 ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \ 15 ((((addr)+SHMLBA-1)&~(SHMLBA-1)) + \
28 (((pgoff)<<PAGE_SHIFT) & (SHMLBA-1))) 16 (((pgoff)<<PAGE_SHIFT) & (SHMLBA-1)))
@@ -69,9 +57,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
69{ 57{
70 struct mm_struct *mm = current->mm; 58 struct mm_struct *mm = current->mm;
71 struct vm_area_struct *vma; 59 struct vm_area_struct *vma;
72 unsigned long start_addr;
73 int do_align = 0; 60 int do_align = 0;
74 int aliasing = cache_is_vipt_aliasing(); 61 int aliasing = cache_is_vipt_aliasing();
62 struct vm_unmapped_area_info info;
75 63
76 /* 64 /*
77 * We only need to do colour alignment if either the I or D 65 * We only need to do colour alignment if either the I or D
@@ -104,46 +92,14 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
104 (!vma || addr + len <= vma->vm_start)) 92 (!vma || addr + len <= vma->vm_start))
105 return addr; 93 return addr;
106 } 94 }
107 if (len > mm->cached_hole_size) {
108 start_addr = addr = mm->free_area_cache;
109 } else {
110 start_addr = addr = mm->mmap_base;
111 mm->cached_hole_size = 0;
112 }
113 95
114full_search: 96 info.flags = 0;
115 if (do_align) 97 info.length = len;
116 addr = COLOUR_ALIGN(addr, pgoff); 98 info.low_limit = mm->mmap_base;
117 else 99 info.high_limit = TASK_SIZE;
118 addr = PAGE_ALIGN(addr); 100 info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
119 101 info.align_offset = pgoff << PAGE_SHIFT;
120 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) { 102 return vm_unmapped_area(&info);
121 /* At this point: (!vma || addr < vma->vm_end). */
122 if (TASK_SIZE - len < addr) {
123 /*
124 * Start a new search - just in case we missed
125 * some holes.
126 */
127 if (start_addr != TASK_UNMAPPED_BASE) {
128 start_addr = addr = TASK_UNMAPPED_BASE;
129 mm->cached_hole_size = 0;
130 goto full_search;
131 }
132 return -ENOMEM;
133 }
134 if (!vma || addr + len <= vma->vm_start) {
135 /*
136 * Remember the place where we stopped the search:
137 */
138 mm->free_area_cache = addr + len;
139 return addr;
140 }
141 if (addr + mm->cached_hole_size < vma->vm_start)
142 mm->cached_hole_size = vma->vm_start - addr;
143 addr = vma->vm_end;
144 if (do_align)
145 addr = COLOUR_ALIGN(addr, pgoff);
146 }
147} 103}
148 104
149unsigned long 105unsigned long
@@ -156,6 +112,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
156 unsigned long addr = addr0; 112 unsigned long addr = addr0;
157 int do_align = 0; 113 int do_align = 0;
158 int aliasing = cache_is_vipt_aliasing(); 114 int aliasing = cache_is_vipt_aliasing();
115 struct vm_unmapped_area_info info;
159 116
160 /* 117 /*
161 * We only need to do colour alignment if either the I or D 118 * We only need to do colour alignment if either the I or D
@@ -187,70 +144,27 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
187 return addr; 144 return addr;
188 } 145 }
189 146
190 /* check if free_area_cache is useful for us */ 147 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
191 if (len <= mm->cached_hole_size) { 148 info.length = len;
192 mm->cached_hole_size = 0; 149 info.low_limit = PAGE_SIZE;
193 mm->free_area_cache = mm->mmap_base; 150 info.high_limit = mm->mmap_base;
194 } 151 info.align_mask = do_align ? (PAGE_MASK & (SHMLBA - 1)) : 0;
195 152 info.align_offset = pgoff << PAGE_SHIFT;
196 /* either no address requested or can't fit in requested address hole */ 153 addr = vm_unmapped_area(&info);
197 addr = mm->free_area_cache;
198 if (do_align) {
199 unsigned long base = COLOUR_ALIGN_DOWN(addr - len, pgoff);
200 addr = base + len;
201 }
202
203 /* make sure it can fit in the remaining address space */
204 if (addr > len) {
205 vma = find_vma(mm, addr-len);
206 if (!vma || addr <= vma->vm_start)
207 /* remember the address as a hint for next time */
208 return (mm->free_area_cache = addr-len);
209 }
210
211 if (mm->mmap_base < len)
212 goto bottomup;
213
214 addr = mm->mmap_base - len;
215 if (do_align)
216 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
217
218 do {
219 /*
220 * Lookup failure means no vma is above this address,
221 * else if new region fits below vma->vm_start,
222 * return with success:
223 */
224 vma = find_vma(mm, addr);
225 if (!vma || addr+len <= vma->vm_start)
226 /* remember the address as a hint for next time */
227 return (mm->free_area_cache = addr);
228 154
229 /* remember the largest hole we saw so far */
230 if (addr + mm->cached_hole_size < vma->vm_start)
231 mm->cached_hole_size = vma->vm_start - addr;
232
233 /* try just below the current vma->vm_start */
234 addr = vma->vm_start - len;
235 if (do_align)
236 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
237 } while (len < vma->vm_start);
238
239bottomup:
240 /* 155 /*
241 * A failed mmap() very likely causes application failure, 156 * A failed mmap() very likely causes application failure,
242 * so fall back to the bottom-up function here. This scenario 157 * so fall back to the bottom-up function here. This scenario
243 * can happen with large stack limits and large mmap() 158 * can happen with large stack limits and large mmap()
244 * allocations. 159 * allocations.
245 */ 160 */
246 mm->cached_hole_size = ~0UL; 161 if (addr & ~PAGE_MASK) {
247 mm->free_area_cache = TASK_UNMAPPED_BASE; 162 VM_BUG_ON(addr != -ENOMEM);
248 addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags); 163 info.flags = 0;
249 /* 164 info.low_limit = mm->mmap_base;
250 * Restore the topdown base: 165 info.high_limit = TASK_SIZE;
251 */ 166 addr = vm_unmapped_area(&info);
252 mm->free_area_cache = mm->mmap_base; 167 }
253 mm->cached_hole_size = ~0UL;
254 168
255 return addr; 169 return addr;
256} 170}
@@ -279,7 +193,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
279 * You really shouldn't be using read() or write() on /dev/mem. This 193 * You really shouldn't be using read() or write() on /dev/mem. This
280 * might go away in the future. 194 * might go away in the future.
281 */ 195 */
282int valid_phys_addr_range(unsigned long addr, size_t size) 196int valid_phys_addr_range(phys_addr_t addr, size_t size)
283{ 197{
284 if (addr < PHYS_OFFSET) 198 if (addr < PHYS_OFFSET)
285 return 0; 199 return 0;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 941dfb9e9a78..99b47b950efc 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -488,7 +488,7 @@ static void __init build_mem_type_table(void)
488#endif 488#endif
489 489
490 for (i = 0; i < 16; i++) { 490 for (i = 0; i < 16; i++) {
491 unsigned long v = pgprot_val(protection_map[i]); 491 pteval_t v = pgprot_val(protection_map[i]);
492 protection_map[i] = __pgprot(v | user_pgprot); 492 protection_map[i] = __pgprot(v | user_pgprot);
493 } 493 }
494 494
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index b29a2265af01..eb6aa73bc8b7 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -167,6 +167,10 @@
167 tst r1, #L_PTE_YOUNG 167 tst r1, #L_PTE_YOUNG
168 tstne r1, #L_PTE_PRESENT 168 tstne r1, #L_PTE_PRESENT
169 moveq r3, #0 169 moveq r3, #0
170#ifndef CONFIG_CPU_USE_DOMAINS
171 tstne r1, #L_PTE_NONE
172 movne r3, #0
173#endif
170 174
171 str r3, [r0] 175 str r3, [r0]
172 mcr p15, 0, r0, c7, c10, 1 @ flush_pte 176 mcr p15, 0, r0, c7, c10, 1 @ flush_pte
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 86b8b480634f..09c5233f4dfc 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -89,7 +89,7 @@ ENTRY(cpu_v6_dcache_clean_area)
89 mov pc, lr 89 mov pc, lr
90 90
91/* 91/*
92 * cpu_arm926_switch_mm(pgd_phys, tsk) 92 * cpu_v6_switch_mm(pgd_phys, tsk)
93 * 93 *
94 * Set the translation table base pointer to be pgd_phys 94 * Set the translation table base pointer to be pgd_phys
95 * 95 *
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index fd045e706390..6d98c13ab827 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -100,7 +100,11 @@ ENTRY(cpu_v7_set_pte_ext)
100 orrne r3, r3, #PTE_EXT_XN 100 orrne r3, r3, #PTE_EXT_XN
101 101
102 tst r1, #L_PTE_YOUNG 102 tst r1, #L_PTE_YOUNG
103 tstne r1, #L_PTE_PRESENT 103 tstne r1, #L_PTE_VALID
104#ifndef CONFIG_CPU_USE_DOMAINS
105 eorne r1, r1, #L_PTE_NONE
106 tstne r1, #L_PTE_NONE
107#endif
104 moveq r3, #0 108 moveq r3, #0
105 109
106 ARM( str r3, [r0, #2048]! ) 110 ARM( str r3, [r0, #2048]! )
@@ -161,11 +165,11 @@ ENDPROC(cpu_v7_set_pte_ext)
161 * TFR EV X F I D LR S 165 * TFR EV X F I D LR S
162 * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM 166 * .EEE ..EE PUI. .T.T 4RVI ZWRS BLDP WCAM
163 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced 167 * rxxx rrxx xxx0 0101 xxxx xxxx x111 xxxx < forced
164 * 1 0 110 0011 1100 .111 1101 < we want 168 * 01 0 110 0011 1100 .111 1101 < we want
165 */ 169 */
166 .align 2 170 .align 2
167 .type v7_crval, #object 171 .type v7_crval, #object
168v7_crval: 172v7_crval:
169 crval clear=0x0120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c 173 crval clear=0x2120c302, mmuset=0x10c03c7d, ucset=0x00c01c7c
170 174
171 .previous 175 .previous
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 8de0f1dd1549..7b56386f9496 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -65,8 +65,11 @@ ENDPROC(cpu_v7_switch_mm)
65 */ 65 */
66ENTRY(cpu_v7_set_pte_ext) 66ENTRY(cpu_v7_set_pte_ext)
67#ifdef CONFIG_MMU 67#ifdef CONFIG_MMU
68 tst r2, #L_PTE_PRESENT 68 tst r2, #L_PTE_VALID
69 beq 1f 69 beq 1f
70 tst r3, #1 << (57 - 32) @ L_PTE_NONE
71 bicne r2, #L_PTE_VALID
72 bne 1f
70 tst r3, #1 << (55 - 32) @ L_PTE_DIRTY 73 tst r3, #1 << (55 - 32) @ L_PTE_DIRTY
71 orreq r2, #L_PTE_RDONLY 74 orreq r2, #L_PTE_RDONLY
721: strd r2, r3, [r0] 751: strd r2, r3, [r0]
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 846d279f3176..42cc833aa02f 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -57,7 +57,7 @@ ENTRY(cpu_v7_reset)
57 THUMB( bic r1, r1, #1 << 30 ) @ SCTLR.TE (Thumb exceptions) 57 THUMB( bic r1, r1, #1 << 30 ) @ SCTLR.TE (Thumb exceptions)
58 mcr p15, 0, r1, c1, c0, 0 @ disable MMU 58 mcr p15, 0, r1, c1, c0, 0 @ disable MMU
59 isb 59 isb
60 mov pc, r0 60 bx r0
61ENDPROC(cpu_v7_reset) 61ENDPROC(cpu_v7_reset)
62 .popsection 62 .popsection
63 63
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
index c641fb685017..b6f305e3b908 100644
--- a/arch/arm/net/bpf_jit_32.c
+++ b/arch/arm/net/bpf_jit_32.c
@@ -42,7 +42,7 @@
42#define r_skb_hl ARM_R8 42#define r_skb_hl ARM_R8
43 43
44#define SCRATCH_SP_OFFSET 0 44#define SCRATCH_SP_OFFSET 0
45#define SCRATCH_OFF(k) (SCRATCH_SP_OFFSET + (k)) 45#define SCRATCH_OFF(k) (SCRATCH_SP_OFFSET + 4 * (k))
46 46
47#define SEEN_MEM ((1 << BPF_MEMWORDS) - 1) 47#define SEEN_MEM ((1 << BPF_MEMWORDS) - 1)
48#define SEEN_MEM_WORD(k) (1 << (k)) 48#define SEEN_MEM_WORD(k) (1 << (k))
@@ -845,7 +845,7 @@ void bpf_jit_compile(struct sk_filter *fp)
845 ctx.skf = fp; 845 ctx.skf = fp;
846 ctx.ret0_fp_idx = -1; 846 ctx.ret0_fp_idx = -1;
847 847
848 ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1)); 848 ctx.offsets = kzalloc(4 * (ctx.skf->len + 1), GFP_KERNEL);
849 if (ctx.offsets == NULL) 849 if (ctx.offsets == NULL)
850 return; 850 return;
851 851
@@ -864,7 +864,7 @@ void bpf_jit_compile(struct sk_filter *fp)
864 864
865 ctx.idx += ctx.imm_count; 865 ctx.idx += ctx.imm_count;
866 if (ctx.imm_count) { 866 if (ctx.imm_count) {
867 ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count); 867 ctx.imms = kzalloc(4 * ctx.imm_count, GFP_KERNEL);
868 if (ctx.imms == NULL) 868 if (ctx.imms == NULL)
869 goto out; 869 goto out;
870 } 870 }
diff --git a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
deleted file mode 100644
index c08a54d9d889..000000000000
--- a/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
+++ /dev/null
@@ -1,102 +0,0 @@
1/*
2 * Structures and registers for GPIO access in the Nomadik SoC
3 *
4 * Copyright (C) 2008 STMicroelectronics
5 * Author: Prafulla WADASKAR <prafulla.wadaskar@st.com>
6 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __PLAT_NOMADIK_GPIO
14#define __PLAT_NOMADIK_GPIO
15
16/*
17 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
18 * the "gpio" namespace for generic and cross-machine functions
19 */
20
21/* Register in the logic block */
22#define NMK_GPIO_DAT 0x00
23#define NMK_GPIO_DATS 0x04
24#define NMK_GPIO_DATC 0x08
25#define NMK_GPIO_PDIS 0x0c
26#define NMK_GPIO_DIR 0x10
27#define NMK_GPIO_DIRS 0x14
28#define NMK_GPIO_DIRC 0x18
29#define NMK_GPIO_SLPC 0x1c
30#define NMK_GPIO_AFSLA 0x20
31#define NMK_GPIO_AFSLB 0x24
32#define NMK_GPIO_LOWEMI 0x28
33
34#define NMK_GPIO_RIMSC 0x40
35#define NMK_GPIO_FIMSC 0x44
36#define NMK_GPIO_IS 0x48
37#define NMK_GPIO_IC 0x4c
38#define NMK_GPIO_RWIMSC 0x50
39#define NMK_GPIO_FWIMSC 0x54
40#define NMK_GPIO_WKS 0x58
41
42/* Alternate functions: function C is set in hw by setting both A and B */
43#define NMK_GPIO_ALT_GPIO 0
44#define NMK_GPIO_ALT_A 1
45#define NMK_GPIO_ALT_B 2
46#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
47
48#define NMK_GPIO_ALT_CX_SHIFT 2
49#define NMK_GPIO_ALT_C1 ((1<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
50#define NMK_GPIO_ALT_C2 ((2<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
51#define NMK_GPIO_ALT_C3 ((3<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
52#define NMK_GPIO_ALT_C4 ((4<<NMK_GPIO_ALT_CX_SHIFT) | NMK_GPIO_ALT_C)
53
54/* Pull up/down values */
55enum nmk_gpio_pull {
56 NMK_GPIO_PULL_NONE,
57 NMK_GPIO_PULL_UP,
58 NMK_GPIO_PULL_DOWN,
59};
60
61/* Sleep mode */
62enum nmk_gpio_slpm {
63 NMK_GPIO_SLPM_INPUT,
64 NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT,
65 NMK_GPIO_SLPM_NOCHANGE,
66 NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE,
67};
68
69extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
70extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
71#ifdef CONFIG_PINCTRL_NOMADIK
72extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
73#else
74static inline int nmk_gpio_set_mode(int gpio, int gpio_mode)
75{
76 return -ENODEV;
77}
78#endif
79extern int nmk_gpio_get_mode(int gpio);
80
81extern void nmk_gpio_wakeups_suspend(void);
82extern void nmk_gpio_wakeups_resume(void);
83
84extern void nmk_gpio_clocks_enable(void);
85extern void nmk_gpio_clocks_disable(void);
86
87extern void nmk_gpio_read_pull(int gpio_bank, u32 *pull_up);
88
89/*
90 * Platform data to register a block: only the initial gpio/irq number.
91 */
92struct nmk_gpio_platform_data {
93 char *name;
94 int first_gpio;
95 int first_irq;
96 int num_gpio;
97 u32 (*get_secondary_status)(unsigned int bank);
98 void (*set_ioforce)(bool enable);
99 bool supports_sleepmode;
100};
101
102#endif /* __PLAT_NOMADIK_GPIO */
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h
deleted file mode 100644
index 3b8ec60af351..000000000000
--- a/arch/arm/plat-nomadik/include/plat/pincfg.h
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
6 *
7 * Based on arch/arm/mach-pxa/include/mach/mfp.h:
8 * Copyright (C) 2007 Marvell International Ltd.
9 * eric miao <eric.miao@marvell.com>
10 */
11
12#ifndef __PLAT_PINCFG_H
13#define __PLAT_PINCFG_H
14
15/*
16 * pin configurations are represented by 32-bit integers:
17 *
18 * bit 0.. 8 - Pin Number (512 Pins Maximum)
19 * bit 9..10 - Alternate Function Selection
20 * bit 11..12 - Pull up/down state
21 * bit 13 - Sleep mode behaviour
22 * bit 14 - Direction
23 * bit 15 - Value (if output)
24 * bit 16..18 - SLPM pull up/down state
25 * bit 19..20 - SLPM direction
26 * bit 21..22 - SLPM Value (if output)
27 * bit 23..25 - PDIS value (if input)
28 * bit 26 - Gpio mode
29 * bit 27 - Sleep mode
30 *
31 * to facilitate the definition, the following macros are provided
32 *
33 * PIN_CFG_DEFAULT - default config (0):
34 * pull up/down = disabled
35 * sleep mode = input/wakeup
36 * direction = input
37 * value = low
38 * SLPM direction = same as normal
39 * SLPM pull = same as normal
40 * SLPM value = same as normal
41 *
42 * PIN_CFG - default config with alternate function
43 */
44
45typedef unsigned long pin_cfg_t;
46
47#define PIN_NUM_MASK 0x1ff
48#define PIN_NUM(x) ((x) & PIN_NUM_MASK)
49
50#define PIN_ALT_SHIFT 9
51#define PIN_ALT_MASK (0x3 << PIN_ALT_SHIFT)
52#define PIN_ALT(x) (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
53#define PIN_GPIO (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
54#define PIN_ALT_A (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
55#define PIN_ALT_B (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
56#define PIN_ALT_C (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
57
58#define PIN_PULL_SHIFT 11
59#define PIN_PULL_MASK (0x3 << PIN_PULL_SHIFT)
60#define PIN_PULL(x) (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
61#define PIN_PULL_NONE (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
62#define PIN_PULL_UP (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
63#define PIN_PULL_DOWN (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
64
65#define PIN_SLPM_SHIFT 13
66#define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT)
67#define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
68#define PIN_SLPM_MAKE_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
69#define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
70/* These two replace the above in DB8500v2+ */
71#define PIN_SLPM_WAKEUP_ENABLE (NMK_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT)
72#define PIN_SLPM_WAKEUP_DISABLE (NMK_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT)
73#define PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP PIN_SLPM_WAKEUP_DISABLE
74
75#define PIN_SLPM_GPIO PIN_SLPM_WAKEUP_ENABLE /* In SLPM, pin is a gpio */
76#define PIN_SLPM_ALTFUNC PIN_SLPM_WAKEUP_DISABLE /* In SLPM, pin is altfunc */
77
78#define PIN_DIR_SHIFT 14
79#define PIN_DIR_MASK (0x1 << PIN_DIR_SHIFT)
80#define PIN_DIR(x) (((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT)
81#define PIN_DIR_INPUT (0 << PIN_DIR_SHIFT)
82#define PIN_DIR_OUTPUT (1 << PIN_DIR_SHIFT)
83
84#define PIN_VAL_SHIFT 15
85#define PIN_VAL_MASK (0x1 << PIN_VAL_SHIFT)
86#define PIN_VAL(x) (((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT)
87#define PIN_VAL_LOW (0 << PIN_VAL_SHIFT)
88#define PIN_VAL_HIGH (1 << PIN_VAL_SHIFT)
89
90#define PIN_SLPM_PULL_SHIFT 16
91#define PIN_SLPM_PULL_MASK (0x7 << PIN_SLPM_PULL_SHIFT)
92#define PIN_SLPM_PULL(x) \
93 (((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT)
94#define PIN_SLPM_PULL_NONE \
95 ((1 + NMK_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT)
96#define PIN_SLPM_PULL_UP \
97 ((1 + NMK_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT)
98#define PIN_SLPM_PULL_DOWN \
99 ((1 + NMK_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT)
100
101#define PIN_SLPM_DIR_SHIFT 19
102#define PIN_SLPM_DIR_MASK (0x3 << PIN_SLPM_DIR_SHIFT)
103#define PIN_SLPM_DIR(x) \
104 (((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT)
105#define PIN_SLPM_DIR_INPUT ((1 + 0) << PIN_SLPM_DIR_SHIFT)
106#define PIN_SLPM_DIR_OUTPUT ((1 + 1) << PIN_SLPM_DIR_SHIFT)
107
108#define PIN_SLPM_VAL_SHIFT 21
109#define PIN_SLPM_VAL_MASK (0x3 << PIN_SLPM_VAL_SHIFT)
110#define PIN_SLPM_VAL(x) \
111 (((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT)
112#define PIN_SLPM_VAL_LOW ((1 + 0) << PIN_SLPM_VAL_SHIFT)
113#define PIN_SLPM_VAL_HIGH ((1 + 1) << PIN_SLPM_VAL_SHIFT)
114
115#define PIN_SLPM_PDIS_SHIFT 23
116#define PIN_SLPM_PDIS_MASK (0x3 << PIN_SLPM_PDIS_SHIFT)
117#define PIN_SLPM_PDIS(x) \
118 (((x) & PIN_SLPM_PDIS_MASK) >> PIN_SLPM_PDIS_SHIFT)
119#define PIN_SLPM_PDIS_NO_CHANGE (0 << PIN_SLPM_PDIS_SHIFT)
120#define PIN_SLPM_PDIS_DISABLED (1 << PIN_SLPM_PDIS_SHIFT)
121#define PIN_SLPM_PDIS_ENABLED (2 << PIN_SLPM_PDIS_SHIFT)
122
123#define PIN_LOWEMI_SHIFT 25
124#define PIN_LOWEMI_MASK (0x1 << PIN_LOWEMI_SHIFT)
125#define PIN_LOWEMI(x) (((x) & PIN_LOWEMI_MASK) >> PIN_LOWEMI_SHIFT)
126#define PIN_LOWEMI_DISABLED (0 << PIN_LOWEMI_SHIFT)
127#define PIN_LOWEMI_ENABLED (1 << PIN_LOWEMI_SHIFT)
128
129#define PIN_GPIOMODE_SHIFT 26
130#define PIN_GPIOMODE_MASK (0x1 << PIN_GPIOMODE_SHIFT)
131#define PIN_GPIOMODE(x) (((x) & PIN_GPIOMODE_MASK) >> PIN_GPIOMODE_SHIFT)
132#define PIN_GPIOMODE_DISABLED (0 << PIN_GPIOMODE_SHIFT)
133#define PIN_GPIOMODE_ENABLED (1 << PIN_GPIOMODE_SHIFT)
134
135#define PIN_SLEEPMODE_SHIFT 27
136#define PIN_SLEEPMODE_MASK (0x1 << PIN_SLEEPMODE_SHIFT)
137#define PIN_SLEEPMODE(x) (((x) & PIN_SLEEPMODE_MASK) >> PIN_SLEEPMODE_SHIFT)
138#define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT)
139#define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT)
140
141
142/* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */
143#define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN)
144#define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP)
145#define PIN_INPUT_NOPULL (PIN_DIR_INPUT | PIN_PULL_NONE)
146#define PIN_OUTPUT_LOW (PIN_DIR_OUTPUT | PIN_VAL_LOW)
147#define PIN_OUTPUT_HIGH (PIN_DIR_OUTPUT | PIN_VAL_HIGH)
148
149#define PIN_SLPM_INPUT_PULLDOWN (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN)
150#define PIN_SLPM_INPUT_PULLUP (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP)
151#define PIN_SLPM_INPUT_NOPULL (PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE)
152#define PIN_SLPM_OUTPUT_LOW (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW)
153#define PIN_SLPM_OUTPUT_HIGH (PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH)
154
155#define PIN_CFG_DEFAULT (0)
156
157#define PIN_CFG(num, alt) \
158 (PIN_CFG_DEFAULT |\
159 (PIN_NUM(num) | PIN_##alt))
160
161#define PIN_CFG_INPUT(num, alt, pull) \
162 (PIN_CFG_DEFAULT |\
163 (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull))
164
165#define PIN_CFG_OUTPUT(num, alt, val) \
166 (PIN_CFG_DEFAULT |\
167 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val))
168
169extern int nmk_config_pin(pin_cfg_t cfg, bool sleep);
170extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
171extern int nmk_config_pins_sleep(pin_cfg_t *cfgs, int num);
172
173#endif
diff --git a/arch/arm/plat-omap/include/plat/omap-serial.h b/arch/arm/plat-omap/include/plat/omap-serial.h
index 1957a8516e93..ff9b0aab5281 100644
--- a/arch/arm/plat-omap/include/plat/omap-serial.h
+++ b/arch/arm/plat-omap/include/plat/omap-serial.h
@@ -30,35 +30,6 @@
30 */ 30 */
31#define OMAP_SERIAL_NAME "ttyO" 31#define OMAP_SERIAL_NAME "ttyO"
32 32
33#define OMAP_MODE13X_SPEED 230400
34
35#define OMAP_UART_SCR_TX_EMPTY 0x08
36
37/* WER = 0x7F
38 * Enable module level wakeup in WER reg
39 */
40#define OMAP_UART_WER_MOD_WKUP 0X7F
41
42/* Enable XON/XOFF flow control on output */
43#define OMAP_UART_SW_TX 0x04
44
45/* Enable XON/XOFF flow control on input */
46#define OMAP_UART_SW_RX 0x04
47
48#define OMAP_UART_SYSC_RESET 0X07
49#define OMAP_UART_TCR_TRIG 0X0F
50#define OMAP_UART_SW_CLR 0XF0
51#define OMAP_UART_FIFO_CLR 0X06
52
53#define OMAP_UART_DMA_CH_FREE -1
54
55#define OMAP_MAX_HSUART_PORTS 6
56
57#define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA
58
59#define UART_ERRATA_i202_MDR1_ACCESS BIT(0)
60#define UART_ERRATA_i291_DMA_FORCEIDLE BIT(1)
61
62struct omap_uart_port_info { 33struct omap_uart_port_info {
63 bool dma_enabled; /* To specify DMA Mode */ 34 bool dma_enabled; /* To specify DMA Mode */
64 unsigned int uartclk; /* UART clock rate */ 35 unsigned int uartclk; /* UART clock rate */
@@ -77,30 +48,4 @@ struct omap_uart_port_info {
77 void (*enable_wakeup)(struct device *, bool); 48 void (*enable_wakeup)(struct device *, bool);
78}; 49};
79 50
80struct uart_omap_dma {
81 u8 uart_dma_tx;
82 u8 uart_dma_rx;
83 int rx_dma_channel;
84 int tx_dma_channel;
85 dma_addr_t rx_buf_dma_phys;
86 dma_addr_t tx_buf_dma_phys;
87 unsigned int uart_base;
88 /*
89 * Buffer for rx dma.It is not required for tx because the buffer
90 * comes from port structure.
91 */
92 unsigned char *rx_buf;
93 unsigned int prev_rx_dma_pos;
94 int tx_buf_size;
95 int tx_dma_used;
96 int rx_dma_used;
97 spinlock_t tx_lock;
98 spinlock_t rx_lock;
99 /* timer to poll activity on rx dma */
100 struct timer_list rx_timer;
101 unsigned int rx_buf_size;
102 unsigned int rx_poll_rate;
103 unsigned int rx_timeout;
104};
105
106#endif /* __OMAP_SERIAL_H__ */ 51#endif /* __OMAP_SERIAL_H__ */
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index db98e7021f0d..0abd1c469887 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -473,12 +473,13 @@ int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
473 pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n", 473 pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n",
474 chan->number, __func__, buf); 474 chan->number, __func__, buf);
475 475
476 if (chan->end == NULL) 476 if (chan->end == NULL) {
477 pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n", 477 pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n",
478 chan->number, __func__, chan); 478 chan->number, __func__, chan);
479 479 } else {
480 chan->end->next = buf; 480 chan->end->next = buf;
481 chan->end = buf; 481 chan->end = buf;
482 }
482 } 483 }
483 484
484 /* if necessary, update the next buffer field */ 485 /* if necessary, update the next buffer field */
diff --git a/arch/arm/plat-spear/Kconfig b/arch/arm/plat-spear/Kconfig
index f8db7b2deb36..87dbd81bdf51 100644
--- a/arch/arm/plat-spear/Kconfig
+++ b/arch/arm/plat-spear/Kconfig
@@ -12,6 +12,7 @@ config ARCH_SPEAR13XX
12 bool "ST SPEAr13xx with Device Tree" 12 bool "ST SPEAr13xx with Device Tree"
13 select ARM_GIC 13 select ARM_GIC
14 select CPU_V7 14 select CPU_V7
15 select GPIO_SPEAR_SPICS
15 select HAVE_SMP 16 select HAVE_SMP
16 select MIGHT_HAVE_CACHE_L2X0 17 select MIGHT_HAVE_CACHE_L2X0
17 select PINCTRL 18 select PINCTRL
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 2a4ae8a6a081..eb50231c4efd 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -19,7 +19,7 @@ config PLAT_VERSATILE_LEDS
19 def_bool y if NEW_LEDS 19 def_bool y if NEW_LEDS
20 depends on ARCH_REALVIEW || ARCH_VERSATILE 20 depends on ARCH_REALVIEW || ARCH_VERSATILE
21 select LEDS_CLASS 21 select LEDS_CLASS
22 select LEDS_TRIGGER 22 select LEDS_TRIGGERS
23 23
24config PLAT_VERSATILE_SCHED_CLOCK 24config PLAT_VERSATILE_SCHED_CLOCK
25 def_bool y 25 def_bool y
diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index cd60a81163e9..32d05c8219dc 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -5,6 +5,6 @@
5# 5#
6 6
7include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types 7include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
8 $(kecho) ' Generating $@' 8 @$(kecho) ' Generating $@'
9 @mkdir -p $(dir $@) 9 @mkdir -p $(dir $@)
10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; } 10 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index c834b32af275..3b44e0dd0a93 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -701,11 +701,14 @@ static int __init vfp_init(void)
701 elf_hwcap |= HWCAP_VFPv3; 701 elf_hwcap |= HWCAP_VFPv3;
702 702
703 /* 703 /*
704 * Check for VFPv3 D16. CPUs in this configuration 704 * Check for VFPv3 D16 and VFPv4 D16. CPUs in
705 * only have 16 x 64bit registers. 705 * this configuration only have 16 x 64bit
706 * registers.
706 */ 707 */
707 if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1) 708 if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1)
708 elf_hwcap |= HWCAP_VFPv3D16; 709 elf_hwcap |= HWCAP_VFPv3D16; /* also v4-D16 */
710 else
711 elf_hwcap |= HWCAP_VFPD32;
709 } 712 }
710#endif 713#endif
711 /* 714 /*
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index 59bcb96ac369..f57609275449 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -166,3 +166,14 @@ void free_xenballooned_pages(int nr_pages, struct page **pages)
166 *pages = NULL; 166 *pages = NULL;
167} 167}
168EXPORT_SYMBOL_GPL(free_xenballooned_pages); 168EXPORT_SYMBOL_GPL(free_xenballooned_pages);
169
170/* In the hypervisor.S file. */
171EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
172EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
173EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version);
174EXPORT_SYMBOL_GPL(HYPERVISOR_console_io);
175EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);
176EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
177EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
178EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
179EXPORT_SYMBOL_GPL(privcmd_call);
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S
index 074f5ed101b9..71f723984cbd 100644
--- a/arch/arm/xen/hypercall.S
+++ b/arch/arm/xen/hypercall.S
@@ -48,20 +48,16 @@
48 48
49#include <linux/linkage.h> 49#include <linux/linkage.h>
50#include <asm/assembler.h> 50#include <asm/assembler.h>
51#include <asm/opcodes-virt.h>
51#include <xen/interface/xen.h> 52#include <xen/interface/xen.h>
52 53
53 54
54/* HVC 0xEA1 */ 55#define XEN_IMM 0xEA1
55#ifdef CONFIG_THUMB2_KERNEL
56#define xen_hvc .word 0xf7e08ea1
57#else
58#define xen_hvc .word 0xe140ea71
59#endif
60 56
61#define HYPERCALL_SIMPLE(hypercall) \ 57#define HYPERCALL_SIMPLE(hypercall) \
62ENTRY(HYPERVISOR_##hypercall) \ 58ENTRY(HYPERVISOR_##hypercall) \
63 mov r12, #__HYPERVISOR_##hypercall; \ 59 mov r12, #__HYPERVISOR_##hypercall; \
64 xen_hvc; \ 60 __HVC(XEN_IMM); \
65 mov pc, lr; \ 61 mov pc, lr; \
66ENDPROC(HYPERVISOR_##hypercall) 62ENDPROC(HYPERVISOR_##hypercall)
67 63
@@ -76,7 +72,7 @@ ENTRY(HYPERVISOR_##hypercall) \
76 stmdb sp!, {r4} \ 72 stmdb sp!, {r4} \
77 ldr r4, [sp, #4] \ 73 ldr r4, [sp, #4] \
78 mov r12, #__HYPERVISOR_##hypercall; \ 74 mov r12, #__HYPERVISOR_##hypercall; \
79 xen_hvc \ 75 __HVC(XEN_IMM); \
80 ldm sp!, {r4} \ 76 ldm sp!, {r4} \
81 mov pc, lr \ 77 mov pc, lr \
82ENDPROC(HYPERVISOR_##hypercall) 78ENDPROC(HYPERVISOR_##hypercall)
@@ -100,7 +96,7 @@ ENTRY(privcmd_call)
100 mov r2, r3 96 mov r2, r3
101 ldr r3, [sp, #8] 97 ldr r3, [sp, #8]
102 ldr r4, [sp, #4] 98 ldr r4, [sp, #4]
103 xen_hvc 99 __HVC(XEN_IMM)
104 ldm sp!, {r4} 100 ldm sp!, {r4}
105 mov pc, lr 101 mov pc, lr
106ENDPROC(privcmd_call); 102ENDPROC(privcmd_call);