aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig34
-rw-r--r--arch/arm/Kconfig.debug6
-rw-r--r--arch/arm/Kconfig.instrumentation10
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/head-at91rm9200.S81
-rw-r--r--arch/arm/common/rtctime.c1
-rw-r--r--arch/arm/configs/at91cap9adk_defconfig1143
-rw-r--r--arch/arm/configs/collie_defconfig1
-rw-r--r--arch/arm/configs/msm_defconfig895
-rw-r--r--arch/arm/kernel/Makefile1
-rw-r--r--arch/arm/kernel/dma-isa.c2
-rw-r--r--arch/arm/kernel/entry-armv.S63
-rw-r--r--arch/arm/kernel/entry-common.S2
-rw-r--r--arch/arm/kernel/kprobes-decode.c1529
-rw-r--r--arch/arm/kernel/kprobes.c447
-rw-r--r--arch/arm/kernel/time.c2
-rw-r--r--arch/arm/kernel/traps.c21
-rw-r--r--arch/arm/kernel/vmlinux.lds.S1
-rw-r--r--arch/arm/mach-aaec2000/core.c4
-rw-r--r--arch/arm/mach-at91/Kconfig38
-rw-r--r--arch/arm/mach-at91/Makefile23
-rw-r--r--arch/arm/mach-at91/Makefile.boot7
-rw-r--r--arch/arm/mach-at91/at91cap9.c365
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c1066
-rw-r--r--arch/arm/mach-at91/at91rm9200.c30
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c350
-rw-r--r--arch/arm/mach-at91/at91sam9260.c28
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c315
-rw-r--r--arch/arm/mach-at91/at91sam9261.c28
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c366
-rw-r--r--arch/arm/mach-at91/at91sam9263.c30
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c382
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c346
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c359
-rw-r--r--arch/arm/mach-at91/board-csb337.c85
-rw-r--r--arch/arm/mach-at91/board-dk.c10
-rw-r--r--arch/arm/mach-at91/board-ek.c21
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c84
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c80
-rw-r--r--arch/arm/mach-at91/clock.c2
-rw-r--r--arch/arm/mach-at91/generic.h2
-rw-r--r--arch/arm/mach-at91/gpio.c62
-rw-r--r--arch/arm/mach-at91/leds.c68
-rw-r--r--arch/arm/mach-at91/pm.c5
-rw-r--r--arch/arm/mach-clps711x/time.c2
-rw-r--r--arch/arm/mach-clps7500/core.c4
-rw-r--r--arch/arm/mach-ebsa110/core.c4
-rw-r--r--arch/arm/mach-ep93xx/core.c262
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c4
-rw-r--r--arch/arm/mach-footbridge/isa-timer.c2
-rw-r--r--arch/arm/mach-h720x/cpu-h7201.c4
-rw-r--r--arch/arm/mach-h720x/cpu-h7202.c2
-rw-r--r--arch/arm/mach-integrator/core.c4
-rw-r--r--arch/arm/mach-integrator/pci_v3.c8
-rw-r--r--arch/arm/mach-ixp2000/core.c4
-rw-r--r--arch/arm/mach-ixp23xx/core.c1
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c2
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c2
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c2
-rw-r--r--arch/arm/mach-ixp4xx/avila-setup.c14
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c13
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c14
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c14
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-power.c1
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c14
-rw-r--r--arch/arm/mach-ks8695/Makefile2
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c2
-rw-r--r--arch/arm/mach-ks8695/gpio.c83
-rw-r--r--arch/arm/mach-ks8695/pci.c326
-rw-r--r--arch/arm/mach-ks8695/time.c3
-rw-r--r--arch/arm/mach-lh7a40x/time.c4
-rw-r--r--arch/arm/mach-msm/Kconfig18
-rw-r--r--arch/arm/mach-msm/Makefile7
-rw-r--r--arch/arm/mach-msm/Makefile.boot3
-rw-r--r--arch/arm/mach-msm/board-halibut.c114
-rw-r--r--arch/arm/mach-msm/common.c116
-rw-r--r--arch/arm/mach-msm/dma.c214
-rw-r--r--arch/arm/mach-msm/idle.S36
-rw-r--r--arch/arm/mach-msm/io.c85
-rw-r--r--arch/arm/mach-msm/irq.c154
-rw-r--r--arch/arm/mach-msm/timer.c205
-rw-r--r--arch/arm/mach-mx3/time.c4
-rw-r--r--arch/arm/mach-netx/time.c4
-rw-r--r--arch/arm/mach-omap1/board-h2.c2
-rw-r--r--arch/arm/mach-omap1/board-h3.c2
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c1
-rw-r--r--arch/arm/mach-omap1/board-osk.c4
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c1
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c1
-rw-r--r--arch/arm/mach-omap1/leds-osk.c2
-rw-r--r--arch/arm/mach-omap1/pm.c2
-rw-r--r--arch/arm/mach-omap2/board-apollon.c1
-rw-r--r--arch/arm/mach-omap2/timer-gp.c4
-rw-r--r--arch/arm/mach-pnx4008/time.c4
-rw-r--r--arch/arm/mach-pxa/akita-ioexp.c2
-rw-r--r--arch/arm/mach-pxa/pxa25x.c9
-rw-r--r--arch/arm/mach-pxa/pxa27x.c6
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c2
-rw-r--r--arch/arm/mach-pxa/ssp.c2
-rw-r--r--arch/arm/mach-realview/core.c4
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c3
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c1
-rw-r--r--arch/arm/mach-s3c2410/usb-simtec.c2
-rw-r--r--arch/arm/mach-s3c2412/Kconfig1
-rw-r--r--arch/arm/mach-s3c2412/Makefile3
-rw-r--r--arch/arm/mach-s3c2412/clock.c54
-rw-r--r--arch/arm/mach-s3c2412/dma.c48
-rw-r--r--arch/arm/mach-s3c2412/gpio.c60
-rw-r--r--arch/arm/mach-s3c2412/irq.c24
-rw-r--r--arch/arm/mach-s3c2412/pm.c18
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c2
-rw-r--r--arch/arm/mach-s3c2412/sleep.S68
-rw-r--r--arch/arm/mach-s3c2440/clock.c22
-rw-r--r--arch/arm/mach-s3c2442/clock.c22
-rw-r--r--arch/arm/mach-sa1100/ssp.c3
-rw-r--r--arch/arm/mach-sa1100/time.c42
-rw-r--r--arch/arm/mach-shark/core.c2
-rw-r--r--arch/arm/mm/Kconfig7
-rw-r--r--arch/arm/mm/fault.c31
-rw-r--r--arch/arm/plat-omap/mailbox.c2
-rw-r--r--arch/arm/plat-omap/mcbsp.c20
-rw-r--r--arch/arm/plat-s3c24xx/Makefile1
-rw-r--r--arch/arm/plat-s3c24xx/clock.c19
-rw-r--r--arch/arm/plat-s3c24xx/dma.c47
-rw-r--r--arch/arm/plat-s3c24xx/gpio.c29
-rw-r--r--arch/arm/plat-s3c24xx/irq.c2
-rw-r--r--arch/arm/plat-s3c24xx/pm.c247
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x-clock.c137
-rw-r--r--arch/arm/tools/mach-types258
-rw-r--r--arch/arm/vfp/vfp.h4
-rw-r--r--arch/arm/vfp/vfphw.S60
-rw-r--r--arch/arm/vfp/vfpinstr.h6
-rw-r--r--arch/arm/vfp/vfpmodule.c98
-rw-r--r--arch/blackfin/Kconfig131
-rw-r--r--arch/blackfin/Makefile12
-rw-r--r--arch/blackfin/configs/BF527-EZKIT_defconfig17
-rw-r--r--arch/blackfin/configs/BF533-EZKIT_defconfig17
-rw-r--r--arch/blackfin/configs/BF533-STAMP_defconfig39
-rw-r--r--arch/blackfin/configs/BF537-STAMP_defconfig50
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig90
-rw-r--r--arch/blackfin/configs/BF561-EZKIT_defconfig32
-rw-r--r--arch/blackfin/kernel/Makefile2
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c4
-rw-r--r--arch/blackfin/kernel/bfin_gpio.c171
-rw-r--r--arch/blackfin/kernel/cplb-mpu/Makefile8
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cacheinit.c62
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbinfo.c144
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbinit.c91
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbmgr.c338
-rw-r--r--arch/blackfin/kernel/cplb-nompu/Makefile8
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cacheinit.c (renamed from arch/blackfin/kernel/cacheinit.c)2
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbhdlr.S (renamed from arch/blackfin/mach-common/cplbhdlr.S)0
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinfo.c (renamed from arch/blackfin/mach-common/cplbinfo.c)0
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c (renamed from arch/blackfin/kernel/cplbinit.c)0
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbmgr.S (renamed from arch/blackfin/mach-common/cplbmgr.S)37
-rw-r--r--arch/blackfin/kernel/early_printk.c4
-rw-r--r--arch/blackfin/kernel/process.c32
-rw-r--r--arch/blackfin/kernel/reboot.c13
-rw-r--r--arch/blackfin/kernel/setup.c13
-rw-r--r--arch/blackfin/kernel/time.c70
-rw-r--r--arch/blackfin/kernel/traps.c212
-rw-r--r--arch/blackfin/lib/memcpy.S8
-rw-r--r--arch/blackfin/mach-bf527/Kconfig2
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c107
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c83
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c52
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c103
-rw-r--r--arch/blackfin/mach-bf537/boards/Kconfig6
-rw-r--r--arch/blackfin/mach-bf537/boards/Makefile1
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c11
-rw-r--r--arch/blackfin/mach-bf537/boards/generic_board.c11
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c317
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c9
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c80
-rw-r--r--arch/blackfin/mach-bf548/Kconfig2
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c96
-rw-r--r--arch/blackfin/mach-bf548/head.S55
-rw-r--r--arch/blackfin/mach-bf548/ints-priority.c4
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c11
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c96
-rw-r--r--arch/blackfin/mach-bf561/coreb.c12
-rw-r--r--arch/blackfin/mach-common/Makefile3
-rw-r--r--arch/blackfin/mach-common/dpmc.S74
-rw-r--r--arch/blackfin/mach-common/entry.S26
-rw-r--r--arch/blackfin/mach-common/interrupt.S48
-rw-r--r--arch/blackfin/mach-common/ints-priority-dc.c10
-rw-r--r--arch/blackfin/mach-common/ints-priority-sc.c84
-rw-r--r--arch/blackfin/mach-common/irqpanic.c50
-rw-r--r--arch/blackfin/mach-common/pm.c16
-rw-r--r--arch/blackfin/mm/init.c33
-rw-r--r--arch/mips/au1000/common/platform.c21
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c20
-rw-r--r--arch/ppc/platforms/85xx/tqm85xx.c21
-rw-r--r--arch/ppc/platforms/katana.c21
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/crypto/Kconfig60
-rw-r--r--arch/s390/crypto/aes_s390.c2
-rw-r--r--arch/s390/crypto/prng.c4
-rw-r--r--arch/s390/kernel/Makefile4
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/head64.S2
-rw-r--r--arch/s390/kernel/ipl.c948
-rw-r--r--arch/s390/kernel/process.c18
-rw-r--r--arch/s390/kernel/ptrace.c15
-rw-r--r--arch/s390/kernel/setup.c139
-rw-r--r--arch/s390/kernel/signal.c20
-rw-r--r--arch/s390/kernel/smp.c575
-rw-r--r--arch/s390/kernel/traps.c20
-rw-r--r--arch/s390/kernel/vmlinux.lds.S12
-rw-r--r--arch/s390/lib/spinlock.c35
-rw-r--r--arch/s390/mm/extmem.c2
-rw-r--r--arch/s390/mm/vmem.c26
213 files changed, 14233 insertions, 2295 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a04f507e7f2c..e53b0ed9d00a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -180,8 +180,8 @@ config ARCH_AT91
180 bool "Atmel AT91" 180 bool "Atmel AT91"
181 select GENERIC_GPIO 181 select GENERIC_GPIO
182 help 182 help
183 This enables support for systems based on the Atmel AT91RM9200 183 This enables support for systems based on the Atmel AT91RM9200,
184 and AT91SAM9xxx processors. 184 AT91SAM9 and AT91CAP9 processors.
185 185
186config ARCH_CLPS7500 186config ARCH_CLPS7500
187 bool "Cirrus CL-PS7500FE" 187 bool "Cirrus CL-PS7500FE"
@@ -217,6 +217,7 @@ config ARCH_EP93XX
217 bool "EP93xx-based" 217 bool "EP93xx-based"
218 select ARM_AMBA 218 select ARM_AMBA
219 select ARM_VIC 219 select ARM_VIC
220 select GENERIC_GPIO
220 help 221 help
221 This enables support for the Cirrus EP93xx series of CPUs. 222 This enables support for the Cirrus EP93xx series of CPUs.
222 223
@@ -366,6 +367,7 @@ config ARCH_SA1100
366 select ARCH_DISCONTIGMEM_ENABLE 367 select ARCH_DISCONTIGMEM_ENABLE
367 select ARCH_MTD_XIP 368 select ARCH_MTD_XIP
368 select GENERIC_GPIO 369 select GENERIC_GPIO
370 select GENERIC_TIME
369 help 371 help
370 Support for StrongARM 11x0 based boards. 372 Support for StrongARM 11x0 based boards.
371 373
@@ -409,6 +411,17 @@ config ARCH_OMAP
409 help 411 help
410 Support for TI's OMAP platform (OMAP1 and OMAP2). 412 Support for TI's OMAP platform (OMAP1 and OMAP2).
411 413
414config ARCH_MSM7X00A
415 bool "Qualcomm MSM7X00A"
416 select GENERIC_TIME
417 select GENERIC_CLOCKEVENTS
418 help
419 Support for Qualcomm MSM7X00A based systems. This runs on the ARM11
420 apps processor of the MSM7X00A and depends on a shared memory
421 interface to the ARM9 modem processor which runs the baseband stack
422 and controls some vital subsystems (clock and power control, etc).
423 <http://www.cdmatech.com/products/msm7200_chipset_solution.jsp>
424
412endchoice 425endchoice
413 426
414source "arch/arm/mach-clps711x/Kconfig" 427source "arch/arm/mach-clps711x/Kconfig"
@@ -477,6 +490,8 @@ source "arch/arm/mach-davinci/Kconfig"
477 490
478source "arch/arm/mach-ks8695/Kconfig" 491source "arch/arm/mach-ks8695/Kconfig"
479 492
493source "arch/arm/mach-msm/Kconfig"
494
480# Definitions to make life easier 495# Definitions to make life easier
481config ARCH_ACORN 496config ARCH_ACORN
482 bool 497 bool
@@ -657,6 +672,7 @@ config HZ
657 default 128 if ARCH_L7200 672 default 128 if ARCH_L7200
658 default 200 if ARCH_EBSA110 || ARCH_S3C2410 673 default 200 if ARCH_EBSA110 || ARCH_S3C2410
659 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER 674 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
675 default AT91_TIMER_HZ if ARCH_AT91
660 default 100 676 default 100
661 677
662config AEABI 678config AEABI
@@ -951,7 +967,7 @@ config FPE_FASTFPE
951 967
952config VFP 968config VFP
953 bool "VFP-format floating point maths" 969 bool "VFP-format floating point maths"
954 depends on CPU_V6 || CPU_ARM926T 970 depends on CPU_V6 || CPU_ARM926T || CPU_V7
955 help 971 help
956 Say Y to include VFP support code in the kernel. This is needed 972 Say Y to include VFP support code in the kernel. This is needed
957 if your hardware includes a VFP unit. 973 if your hardware includes a VFP unit.
@@ -961,6 +977,18 @@ config VFP
961 977
962 Say N if your target does not have VFP hardware. 978 Say N if your target does not have VFP hardware.
963 979
980config VFPv3
981 bool
982 depends on VFP
983 default y if CPU_V7
984
985config NEON
986 bool "Advanced SIMD (NEON) Extension support"
987 depends on VFPv3 && CPU_V7
988 help
989 Say Y to include support code for NEON, the ARMv7 Advanced SIMD
990 Extension.
991
964endmenu 992endmenu
965 993
966menu "Userspace binary formats" 994menu "Userspace binary formats"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 18101f5f5f24..192ee01a9ba2 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -43,6 +43,12 @@ config DEBUG_ERRORS
43 you are concerned with the code size or don't want to see these 43 you are concerned with the code size or don't want to see these
44 messages. 44 messages.
45 45
46config DEBUG_STACK_USAGE
47 bool "Enable stack utilization instrumentation"
48 depends on DEBUG_KERNEL
49 help
50 Enables the display of the minimum amount of free stack which each
51 task has ever had available in the sysrq-T output.
46 52
47# These options are only for real kernel hackers who want to get their hands dirty. 53# These options are only for real kernel hackers who want to get their hands dirty.
48config DEBUG_LL 54config DEBUG_LL
diff --git a/arch/arm/Kconfig.instrumentation b/arch/arm/Kconfig.instrumentation
index 63b8c6d5606a..453ad8e15d69 100644
--- a/arch/arm/Kconfig.instrumentation
+++ b/arch/arm/Kconfig.instrumentation
@@ -43,6 +43,16 @@ config OPROFILE_MPCORE
43config OPROFILE_ARM11_CORE 43config OPROFILE_ARM11_CORE
44 bool 44 bool
45 45
46config KPROBES
47 bool "Kprobes"
48 depends on KALLSYMS && MODULES && !UML && !XIP_KERNEL
49 help
50 Kprobes allows you to trap at almost any kernel address and
51 execute a callback function. register_kprobe() establishes
52 a probepoint and specifies the callback. Kprobes is useful
53 for kernel debugging, non-intrusive instrumentation and testing.
54 If in doubt, say "N".
55
46config MARKERS 56config MARKERS
47 bool "Activate markers" 57 bool "Activate markers"
48 help 58 help
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 35e56c99ad1d..dd220d189843 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -139,6 +139,7 @@ endif
139 machine-$(CONFIG_ARCH_KS8695) := ks8695 139 machine-$(CONFIG_ARCH_KS8695) := ks8695
140 incdir-$(CONFIG_ARCH_MXC) := mxc 140 incdir-$(CONFIG_ARCH_MXC) := mxc
141 machine-$(CONFIG_ARCH_MX3) := mx3 141 machine-$(CONFIG_ARCH_MX3) := mx3
142 machine-$(CONFIG_ARCH_MSM7X00A) := msm
142 143
143ifeq ($(CONFIG_ARCH_EBSA110),y) 144ifeq ($(CONFIG_ARCH_EBSA110),y)
144# This is what happens if you forget the IOCS16 line. 145# This is what happens if you forget the IOCS16 line.
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 5fde99f9d9f9..de9d9ee50958 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -44,10 +44,6 @@ ifeq ($(CONFIG_PXA_SHARPSL),y)
44OBJS += head-sharpsl.o 44OBJS += head-sharpsl.o
45endif 45endif
46 46
47ifeq ($(CONFIG_ARCH_AT91RM9200),y)
48OBJS += head-at91rm9200.o
49endif
50
51ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) 47ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
52ifeq ($(CONFIG_CPU_CP15),y) 48ifeq ($(CONFIG_CPU_CP15),y)
53OBJS += big-endian.o 49OBJS += big-endian.o
diff --git a/arch/arm/boot/compressed/head-at91rm9200.S b/arch/arm/boot/compressed/head-at91rm9200.S
deleted file mode 100644
index 11782ccd93a1..000000000000
--- a/arch/arm/boot/compressed/head-at91rm9200.S
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * linux/arch/arm/boot/compressed/head-at91rm9200.S
3 *
4 * Copyright (C) 2003 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12#include <asm/mach-types.h>
13
14 .section ".start", "ax"
15
16 @ Atmel AT91RM9200-DK : 262
17 mov r3, #(MACH_TYPE_AT91RM9200DK & 0xff)
18 orr r3, r3, #(MACH_TYPE_AT91RM9200DK & 0xff00)
19 cmp r7, r3
20 beq 99f
21
22 @ Cogent CSB337 : 399
23 mov r3, #(MACH_TYPE_CSB337 & 0xff)
24 orr r3, r3, #(MACH_TYPE_CSB337 & 0xff00)
25 cmp r7, r3
26 beq 99f
27
28 @ Cogent CSB637 : 648
29 mov r3, #(MACH_TYPE_CSB637 & 0xff)
30 orr r3, r3, #(MACH_TYPE_CSB637 & 0xff00)
31 cmp r7, r3
32 beq 99f
33
34 @ Atmel AT91RM9200-EK : 705
35 mov r3, #(MACH_TYPE_AT91RM9200EK & 0xff)
36 orr r3, r3, #(MACH_TYPE_AT91RM9200EK & 0xff00)
37 cmp r7, r3
38 beq 99f
39
40 @ Conitec Carmeva : 769
41 mov r3, #(MACH_TYPE_CARMEVA & 0xff)
42 orr r3, r3, #(MACH_TYPE_CARMEVA & 0xff00)
43 cmp r7, r3
44 beq 99f
45
46 @ KwikByte KB920x : 612
47 mov r3, #(MACH_TYPE_KB9200 & 0xff)
48 orr r3, r3, #(MACH_TYPE_KB9200 & 0xff00)
49 cmp r7, r3
50 beq 99f
51
52 @ Embest ATEB9200 : 923
53 mov r3, #(MACH_TYPE_ATEB9200 & 0xff)
54 orr r3, r3, #(MACH_TYPE_ATEB9200 & 0xff00)
55 cmp r7, r3
56 beq 99f
57
58 @ Sperry-Sun KAFA : 662
59 mov r3, #(MACH_TYPE_KAFA & 0xff)
60 orr r3, r3, #(MACH_TYPE_KAFA & 0xff00)
61 cmp r7, r3
62 beq 99f
63
64 @ picotux 200 : 963
65 mov r3, #(MACH_TYPE_PICOTUX2XX & 0xff)
66 orr r3, r3, #(MACH_TYPE_PICOTUX2XX & 0xff00)
67 cmp r7, r3
68 beq 99f
69
70 @ Ajeco 1ARM : 1075
71 mov r3, #(MACH_TYPE_ONEARM & 0xff)
72 orr r3, r3, #(MACH_TYPE_ONEARM & 0xff00)
73 cmp r7, r3
74 beq 99f
75
76 @ Unknown board, use the AT91RM9200DK board
77 @ mov r7, #MACH_TYPE_AT91RM9200
78 mov r7, #(MACH_TYPE_AT91RM9200DK & 0xff)
79 orr r7, r7, #(MACH_TYPE_AT91RM9200DK & 0xff00)
80
8199:
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index bf1075e1f571..f53bca46e23c 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -20,7 +20,6 @@
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/rtc.h>
24 23
25#include <asm/rtc.h> 24#include <asm/rtc.h>
26#include <asm/semaphore.h> 25#include <asm/semaphore.h>
diff --git a/arch/arm/configs/at91cap9adk_defconfig b/arch/arm/configs/at91cap9adk_defconfig
new file mode 100644
index 000000000000..e32e73648129
--- /dev/null
+++ b/arch/arm/configs/at91cap9adk_defconfig
@@ -0,0 +1,1143 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.24-rc8
4# Wed Jan 23 22:55:57 2008
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9# CONFIG_GENERIC_TIME is not set
10# CONFIG_GENERIC_CLOCKEVENTS is not set
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_STACKTRACE_SUPPORT=y
15CONFIG_LOCKDEP_SUPPORT=y
16CONFIG_TRACE_IRQFLAGS_SUPPORT=y
17CONFIG_HARDIRQS_SW_RESEND=y
18CONFIG_GENERIC_IRQ_PROBE=y
19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_GENERIC_HWEIGHT=y
23CONFIG_GENERIC_CALIBRATE_DELAY=y
24CONFIG_ZONE_DMA=y
25CONFIG_VECTORS_BASE=0xffff0000
26CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35# CONFIG_LOCALVERSION_AUTO is not set
36# CONFIG_SWAP is not set
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44# CONFIG_AUDIT is not set
45# CONFIG_IKCONFIG is not set
46CONFIG_LOG_BUF_SHIFT=14
47# CONFIG_CGROUPS is not set
48CONFIG_FAIR_GROUP_SCHED=y
49CONFIG_FAIR_USER_SCHED=y
50# CONFIG_FAIR_CGROUP_SCHED is not set
51CONFIG_SYSFS_DEPRECATED=y
52# CONFIG_RELAY is not set
53CONFIG_BLK_DEV_INITRD=y
54CONFIG_INITRAMFS_SOURCE=""
55CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56CONFIG_SYSCTL=y
57# CONFIG_EMBEDDED is not set
58CONFIG_UID16=y
59CONFIG_SYSCTL_SYSCALL=y
60CONFIG_KALLSYMS=y
61# CONFIG_KALLSYMS_ALL is not set
62# CONFIG_KALLSYMS_EXTRA_PASS is not set
63CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
67CONFIG_BASE_FULL=y
68CONFIG_FUTEX=y
69CONFIG_ANON_INODES=y
70CONFIG_EPOLL=y
71CONFIG_SIGNALFD=y
72CONFIG_EVENTFD=y
73CONFIG_SHMEM=y
74CONFIG_VM_EVENT_COUNTERS=y
75CONFIG_SLAB=y
76# CONFIG_SLUB is not set
77# CONFIG_SLOB is not set
78CONFIG_SLABINFO=y
79CONFIG_RT_MUTEXES=y
80# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=0
82CONFIG_MODULES=y
83CONFIG_MODULE_UNLOAD=y
84# CONFIG_MODULE_FORCE_UNLOAD is not set
85# CONFIG_MODVERSIONS is not set
86# CONFIG_MODULE_SRCVERSION_ALL is not set
87CONFIG_KMOD=y
88CONFIG_BLOCK=y
89# CONFIG_LBD is not set
90# CONFIG_BLK_DEV_IO_TRACE is not set
91# CONFIG_LSF is not set
92# CONFIG_BLK_DEV_BSG is not set
93
94#
95# IO Schedulers
96#
97CONFIG_IOSCHED_NOOP=y
98CONFIG_IOSCHED_AS=y
99# CONFIG_IOSCHED_DEADLINE is not set
100# CONFIG_IOSCHED_CFQ is not set
101CONFIG_DEFAULT_AS=y
102# CONFIG_DEFAULT_DEADLINE is not set
103# CONFIG_DEFAULT_CFQ is not set
104# CONFIG_DEFAULT_NOOP is not set
105CONFIG_DEFAULT_IOSCHED="anticipatory"
106
107#
108# System Type
109#
110# CONFIG_ARCH_AAEC2000 is not set
111# CONFIG_ARCH_INTEGRATOR is not set
112# CONFIG_ARCH_REALVIEW is not set
113# CONFIG_ARCH_VERSATILE is not set
114CONFIG_ARCH_AT91=y
115# CONFIG_ARCH_CLPS7500 is not set
116# CONFIG_ARCH_CLPS711X is not set
117# CONFIG_ARCH_CO285 is not set
118# CONFIG_ARCH_EBSA110 is not set
119# CONFIG_ARCH_EP93XX is not set
120# CONFIG_ARCH_FOOTBRIDGE is not set
121# CONFIG_ARCH_NETX is not set
122# CONFIG_ARCH_H720X is not set
123# CONFIG_ARCH_IMX is not set
124# CONFIG_ARCH_IOP13XX is not set
125# CONFIG_ARCH_IOP32X is not set
126# CONFIG_ARCH_IOP33X is not set
127# CONFIG_ARCH_IXP23XX is not set
128# CONFIG_ARCH_IXP2000 is not set
129# CONFIG_ARCH_IXP4XX is not set
130# CONFIG_ARCH_L7200 is not set
131# CONFIG_ARCH_KS8695 is not set
132# CONFIG_ARCH_NS9XXX is not set
133# CONFIG_ARCH_MXC is not set
134# CONFIG_ARCH_PNX4008 is not set
135# CONFIG_ARCH_PXA is not set
136# CONFIG_ARCH_RPC is not set
137# CONFIG_ARCH_SA1100 is not set
138# CONFIG_ARCH_S3C2410 is not set
139# CONFIG_ARCH_SHARK is not set
140# CONFIG_ARCH_LH7A40X is not set
141# CONFIG_ARCH_DAVINCI is not set
142# CONFIG_ARCH_OMAP is not set
143
144#
145# Boot options
146#
147
148#
149# Power management
150#
151
152#
153# Atmel AT91 System-on-Chip
154#
155# CONFIG_ARCH_AT91RM9200 is not set
156# CONFIG_ARCH_AT91SAM9260 is not set
157# CONFIG_ARCH_AT91SAM9261 is not set
158# CONFIG_ARCH_AT91SAM9263 is not set
159# CONFIG_ARCH_AT91SAM9RL is not set
160CONFIG_ARCH_AT91CAP9=y
161# CONFIG_ARCH_AT91X40 is not set
162CONFIG_AT91_PMC_UNIT=y
163
164#
165# AT91CAP9 Board Type
166#
167CONFIG_MACH_AT91CAP9ADK=y
168
169#
170# AT91 Board Options
171#
172CONFIG_MTD_AT91_DATAFLASH_CARD=y
173# CONFIG_MTD_NAND_AT91_BUSWIDTH_16 is not set
174
175#
176# AT91 Feature Selections
177#
178CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
179CONFIG_AT91_TIMER_HZ=100
180
181#
182# Processor Type
183#
184CONFIG_CPU_32=y
185CONFIG_CPU_ARM926T=y
186CONFIG_CPU_32v5=y
187CONFIG_CPU_ABRT_EV5TJ=y
188CONFIG_CPU_CACHE_VIVT=y
189CONFIG_CPU_COPY_V4WB=y
190CONFIG_CPU_TLB_V4WBI=y
191CONFIG_CPU_CP15=y
192CONFIG_CPU_CP15_MMU=y
193
194#
195# Processor Features
196#
197# CONFIG_ARM_THUMB is not set
198# CONFIG_CPU_ICACHE_DISABLE is not set
199# CONFIG_CPU_DCACHE_DISABLE is not set
200# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
201# CONFIG_CPU_CACHE_ROUND_ROBIN is not set
202# CONFIG_OUTER_CACHE is not set
203
204#
205# Bus support
206#
207# CONFIG_PCI_SYSCALL is not set
208# CONFIG_ARCH_SUPPORTS_MSI is not set
209# CONFIG_PCCARD is not set
210
211#
212# Kernel Features
213#
214# CONFIG_TICK_ONESHOT is not set
215# CONFIG_PREEMPT is not set
216# CONFIG_NO_IDLE_HZ is not set
217CONFIG_HZ=100
218CONFIG_AEABI=y
219CONFIG_OABI_COMPAT=y
220# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
221CONFIG_SELECT_MEMORY_MODEL=y
222CONFIG_FLATMEM_MANUAL=y
223# CONFIG_DISCONTIGMEM_MANUAL is not set
224# CONFIG_SPARSEMEM_MANUAL is not set
225CONFIG_FLATMEM=y
226CONFIG_FLAT_NODE_MEM_MAP=y
227# CONFIG_SPARSEMEM_STATIC is not set
228# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
229CONFIG_SPLIT_PTLOCK_CPUS=4096
230# CONFIG_RESOURCES_64BIT is not set
231CONFIG_ZONE_DMA_FLAG=1
232CONFIG_BOUNCE=y
233CONFIG_VIRT_TO_BUS=y
234CONFIG_LEDS=y
235CONFIG_LEDS_TIMER=y
236CONFIG_LEDS_CPU=y
237CONFIG_ALIGNMENT_TRAP=y
238
239#
240# Boot options
241#
242CONFIG_ZBOOT_ROM_TEXT=0x0
243CONFIG_ZBOOT_ROM_BSS=0x0
244CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/ram0 rw"
245# CONFIG_XIP_KERNEL is not set
246# CONFIG_KEXEC is not set
247
248#
249# Floating point emulation
250#
251
252#
253# At least one emulation must be selected
254#
255CONFIG_FPE_NWFPE=y
256# CONFIG_FPE_NWFPE_XP is not set
257# CONFIG_FPE_FASTFPE is not set
258# CONFIG_VFP is not set
259
260#
261# Userspace binary formats
262#
263CONFIG_BINFMT_ELF=y
264# CONFIG_BINFMT_AOUT is not set
265# CONFIG_BINFMT_MISC is not set
266
267#
268# Power management options
269#
270# CONFIG_PM is not set
271CONFIG_SUSPEND_UP_POSSIBLE=y
272
273#
274# Networking
275#
276CONFIG_NET=y
277
278#
279# Networking options
280#
281CONFIG_PACKET=y
282# CONFIG_PACKET_MMAP is not set
283CONFIG_UNIX=y
284# CONFIG_NET_KEY is not set
285CONFIG_INET=y
286# CONFIG_IP_MULTICAST is not set
287# CONFIG_IP_ADVANCED_ROUTER is not set
288CONFIG_IP_FIB_HASH=y
289CONFIG_IP_PNP=y
290# CONFIG_IP_PNP_DHCP is not set
291CONFIG_IP_PNP_BOOTP=y
292CONFIG_IP_PNP_RARP=y
293# CONFIG_NET_IPIP is not set
294# CONFIG_NET_IPGRE is not set
295# CONFIG_ARPD is not set
296# CONFIG_SYN_COOKIES is not set
297# CONFIG_INET_AH is not set
298# CONFIG_INET_ESP is not set
299# CONFIG_INET_IPCOMP is not set
300# CONFIG_INET_XFRM_TUNNEL is not set
301# CONFIG_INET_TUNNEL is not set
302# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
303# CONFIG_INET_XFRM_MODE_TUNNEL is not set
304# CONFIG_INET_XFRM_MODE_BEET is not set
305# CONFIG_INET_LRO is not set
306# CONFIG_INET_DIAG is not set
307# CONFIG_TCP_CONG_ADVANCED is not set
308CONFIG_TCP_CONG_CUBIC=y
309CONFIG_DEFAULT_TCP_CONG="cubic"
310# CONFIG_TCP_MD5SIG is not set
311# CONFIG_IPV6 is not set
312# CONFIG_INET6_XFRM_TUNNEL is not set
313# CONFIG_INET6_TUNNEL is not set
314# CONFIG_NETWORK_SECMARK is not set
315# CONFIG_NETFILTER is not set
316# CONFIG_IP_DCCP is not set
317# CONFIG_IP_SCTP is not set
318# CONFIG_TIPC is not set
319# CONFIG_ATM is not set
320# CONFIG_BRIDGE is not set
321# CONFIG_VLAN_8021Q is not set
322# CONFIG_DECNET is not set
323# CONFIG_LLC2 is not set
324# CONFIG_IPX is not set
325# CONFIG_ATALK is not set
326# CONFIG_X25 is not set
327# CONFIG_LAPB is not set
328# CONFIG_ECONET is not set
329# CONFIG_WAN_ROUTER is not set
330# CONFIG_NET_SCHED is not set
331
332#
333# Network testing
334#
335# CONFIG_NET_PKTGEN is not set
336# CONFIG_HAMRADIO is not set
337# CONFIG_IRDA is not set
338# CONFIG_BT is not set
339# CONFIG_AF_RXRPC is not set
340
341#
342# Wireless
343#
344# CONFIG_CFG80211 is not set
345# CONFIG_WIRELESS_EXT is not set
346# CONFIG_MAC80211 is not set
347# CONFIG_IEEE80211 is not set
348# CONFIG_RFKILL is not set
349# CONFIG_NET_9P is not set
350
351#
352# Device Drivers
353#
354
355#
356# Generic Driver Options
357#
358CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
359CONFIG_STANDALONE=y
360CONFIG_PREVENT_FIRMWARE_BUILD=y
361# CONFIG_FW_LOADER is not set
362# CONFIG_DEBUG_DRIVER is not set
363# CONFIG_DEBUG_DEVRES is not set
364# CONFIG_SYS_HYPERVISOR is not set
365# CONFIG_CONNECTOR is not set
366CONFIG_MTD=y
367# CONFIG_MTD_DEBUG is not set
368# CONFIG_MTD_CONCAT is not set
369CONFIG_MTD_PARTITIONS=y
370# CONFIG_MTD_REDBOOT_PARTS is not set
371CONFIG_MTD_CMDLINE_PARTS=y
372# CONFIG_MTD_AFS_PARTS is not set
373
374#
375# User Modules And Translation Layers
376#
377CONFIG_MTD_CHAR=y
378CONFIG_MTD_BLKDEVS=y
379CONFIG_MTD_BLOCK=y
380# CONFIG_FTL is not set
381# CONFIG_NFTL is not set
382# CONFIG_INFTL is not set
383# CONFIG_RFD_FTL is not set
384# CONFIG_SSFDC is not set
385# CONFIG_MTD_OOPS is not set
386
387#
388# RAM/ROM/Flash chip drivers
389#
390CONFIG_MTD_CFI=y
391CONFIG_MTD_JEDECPROBE=y
392CONFIG_MTD_GEN_PROBE=y
393# CONFIG_MTD_CFI_ADV_OPTIONS is not set
394CONFIG_MTD_MAP_BANK_WIDTH_1=y
395CONFIG_MTD_MAP_BANK_WIDTH_2=y
396CONFIG_MTD_MAP_BANK_WIDTH_4=y
397# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
398# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
399# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
400CONFIG_MTD_CFI_I1=y
401CONFIG_MTD_CFI_I2=y
402# CONFIG_MTD_CFI_I4 is not set
403# CONFIG_MTD_CFI_I8 is not set
404# CONFIG_MTD_CFI_INTELEXT is not set
405CONFIG_MTD_CFI_AMDSTD=y
406# CONFIG_MTD_CFI_STAA is not set
407CONFIG_MTD_CFI_UTIL=y
408# CONFIG_MTD_RAM is not set
409# CONFIG_MTD_ROM is not set
410# CONFIG_MTD_ABSENT is not set
411
412#
413# Mapping drivers for chip access
414#
415# CONFIG_MTD_COMPLEX_MAPPINGS is not set
416CONFIG_MTD_PHYSMAP=y
417CONFIG_MTD_PHYSMAP_START=0x0
418CONFIG_MTD_PHYSMAP_LEN=0x0
419CONFIG_MTD_PHYSMAP_BANKWIDTH=0
420# CONFIG_MTD_ARM_INTEGRATOR is not set
421# CONFIG_MTD_IMPA7 is not set
422# CONFIG_MTD_PLATRAM is not set
423
424#
425# Self-contained MTD device drivers
426#
427CONFIG_MTD_DATAFLASH=y
428# CONFIG_MTD_M25P80 is not set
429# CONFIG_MTD_SLRAM is not set
430# CONFIG_MTD_PHRAM is not set
431# CONFIG_MTD_MTDRAM is not set
432# CONFIG_MTD_BLOCK2MTD is not set
433
434#
435# Disk-On-Chip Device Drivers
436#
437# CONFIG_MTD_DOC2000 is not set
438# CONFIG_MTD_DOC2001 is not set
439# CONFIG_MTD_DOC2001PLUS is not set
440CONFIG_MTD_NAND=y
441# CONFIG_MTD_NAND_VERIFY_WRITE is not set
442# CONFIG_MTD_NAND_ECC_SMC is not set
443# CONFIG_MTD_NAND_MUSEUM_IDS is not set
444CONFIG_MTD_NAND_IDS=y
445# CONFIG_MTD_NAND_DISKONCHIP is not set
446CONFIG_MTD_NAND_AT91=y
447# CONFIG_MTD_NAND_NANDSIM is not set
448# CONFIG_MTD_NAND_PLATFORM is not set
449# CONFIG_MTD_ALAUDA is not set
450# CONFIG_MTD_ONENAND is not set
451
452#
453# UBI - Unsorted block images
454#
455# CONFIG_MTD_UBI is not set
456# CONFIG_PARPORT is not set
457CONFIG_BLK_DEV=y
458# CONFIG_BLK_DEV_COW_COMMON is not set
459CONFIG_BLK_DEV_LOOP=y
460# CONFIG_BLK_DEV_CRYPTOLOOP is not set
461# CONFIG_BLK_DEV_NBD is not set
462# CONFIG_BLK_DEV_UB is not set
463CONFIG_BLK_DEV_RAM=y
464CONFIG_BLK_DEV_RAM_COUNT=16
465CONFIG_BLK_DEV_RAM_SIZE=8192
466CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
467# CONFIG_CDROM_PKTCDVD is not set
468# CONFIG_ATA_OVER_ETH is not set
469CONFIG_MISC_DEVICES=y
470# CONFIG_EEPROM_93CX6 is not set
471CONFIG_ATMEL_SSC=y
472
473#
474# SCSI device support
475#
476# CONFIG_RAID_ATTRS is not set
477CONFIG_SCSI=y
478CONFIG_SCSI_DMA=y
479# CONFIG_SCSI_TGT is not set
480# CONFIG_SCSI_NETLINK is not set
481CONFIG_SCSI_PROC_FS=y
482
483#
484# SCSI support type (disk, tape, CD-ROM)
485#
486CONFIG_BLK_DEV_SD=y
487# CONFIG_CHR_DEV_ST is not set
488# CONFIG_CHR_DEV_OSST is not set
489# CONFIG_BLK_DEV_SR is not set
490# CONFIG_CHR_DEV_SG is not set
491# CONFIG_CHR_DEV_SCH is not set
492
493#
494# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
495#
496CONFIG_SCSI_MULTI_LUN=y
497# CONFIG_SCSI_CONSTANTS is not set
498# CONFIG_SCSI_LOGGING is not set
499# CONFIG_SCSI_SCAN_ASYNC is not set
500CONFIG_SCSI_WAIT_SCAN=m
501
502#
503# SCSI Transports
504#
505# CONFIG_SCSI_SPI_ATTRS is not set
506# CONFIG_SCSI_FC_ATTRS is not set
507# CONFIG_SCSI_ISCSI_ATTRS is not set
508# CONFIG_SCSI_SAS_LIBSAS is not set
509# CONFIG_SCSI_SRP_ATTRS is not set
510CONFIG_SCSI_LOWLEVEL=y
511# CONFIG_ISCSI_TCP is not set
512# CONFIG_SCSI_DEBUG is not set
513# CONFIG_ATA is not set
514# CONFIG_MD is not set
515CONFIG_NETDEVICES=y
516# CONFIG_NETDEVICES_MULTIQUEUE is not set
517# CONFIG_DUMMY is not set
518# CONFIG_BONDING is not set
519# CONFIG_MACVLAN is not set
520# CONFIG_EQUALIZER is not set
521# CONFIG_TUN is not set
522# CONFIG_VETH is not set
523CONFIG_PHYLIB=y
524
525#
526# MII PHY device drivers
527#
528# CONFIG_MARVELL_PHY is not set
529# CONFIG_DAVICOM_PHY is not set
530# CONFIG_QSEMI_PHY is not set
531# CONFIG_LXT_PHY is not set
532# CONFIG_CICADA_PHY is not set
533# CONFIG_VITESSE_PHY is not set
534# CONFIG_SMSC_PHY is not set
535# CONFIG_BROADCOM_PHY is not set
536# CONFIG_ICPLUS_PHY is not set
537# CONFIG_FIXED_PHY is not set
538# CONFIG_MDIO_BITBANG is not set
539CONFIG_NET_ETHERNET=y
540CONFIG_MII=y
541CONFIG_MACB=y
542# CONFIG_AX88796 is not set
543# CONFIG_SMC91X is not set
544# CONFIG_DM9000 is not set
545# CONFIG_IBM_NEW_EMAC_ZMII is not set
546# CONFIG_IBM_NEW_EMAC_RGMII is not set
547# CONFIG_IBM_NEW_EMAC_TAH is not set
548# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
549# CONFIG_B44 is not set
550# CONFIG_NETDEV_1000 is not set
551# CONFIG_NETDEV_10000 is not set
552
553#
554# Wireless LAN
555#
556# CONFIG_WLAN_PRE80211 is not set
557# CONFIG_WLAN_80211 is not set
558
559#
560# USB Network Adapters
561#
562# CONFIG_USB_CATC is not set
563# CONFIG_USB_KAWETH is not set
564# CONFIG_USB_PEGASUS is not set
565# CONFIG_USB_RTL8150 is not set
566# CONFIG_USB_USBNET is not set
567# CONFIG_WAN is not set
568# CONFIG_PPP is not set
569# CONFIG_SLIP is not set
570# CONFIG_SHAPER is not set
571# CONFIG_NETCONSOLE is not set
572# CONFIG_NETPOLL is not set
573# CONFIG_NET_POLL_CONTROLLER is not set
574# CONFIG_ISDN is not set
575
576#
577# Input device support
578#
579CONFIG_INPUT=y
580# CONFIG_INPUT_FF_MEMLESS is not set
581# CONFIG_INPUT_POLLDEV is not set
582
583#
584# Userland interfaces
585#
586CONFIG_INPUT_MOUSEDEV=y
587# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
588CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
589CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
590# CONFIG_INPUT_JOYDEV is not set
591CONFIG_INPUT_EVDEV=y
592# CONFIG_INPUT_EVBUG is not set
593
594#
595# Input Device Drivers
596#
597# CONFIG_INPUT_KEYBOARD is not set
598# CONFIG_INPUT_MOUSE is not set
599# CONFIG_INPUT_JOYSTICK is not set
600# CONFIG_INPUT_TABLET is not set
601CONFIG_INPUT_TOUCHSCREEN=y
602CONFIG_TOUCHSCREEN_ADS7846=y
603# CONFIG_TOUCHSCREEN_FUJITSU is not set
604# CONFIG_TOUCHSCREEN_GUNZE is not set
605# CONFIG_TOUCHSCREEN_ELO is not set
606# CONFIG_TOUCHSCREEN_MTOUCH is not set
607# CONFIG_TOUCHSCREEN_MK712 is not set
608# CONFIG_TOUCHSCREEN_PENMOUNT is not set
609# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
610# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
611# CONFIG_TOUCHSCREEN_UCB1400 is not set
612# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
613# CONFIG_INPUT_MISC is not set
614
615#
616# Hardware I/O ports
617#
618# CONFIG_SERIO is not set
619# CONFIG_GAMEPORT is not set
620
621#
622# Character devices
623#
624CONFIG_VT=y
625CONFIG_VT_CONSOLE=y
626CONFIG_HW_CONSOLE=y
627# CONFIG_VT_HW_CONSOLE_BINDING is not set
628# CONFIG_SERIAL_NONSTANDARD is not set
629
630#
631# Serial drivers
632#
633# CONFIG_SERIAL_8250 is not set
634
635#
636# Non-8250 serial port support
637#
638CONFIG_SERIAL_ATMEL=y
639CONFIG_SERIAL_ATMEL_CONSOLE=y
640# CONFIG_SERIAL_ATMEL_TTYAT is not set
641CONFIG_SERIAL_CORE=y
642CONFIG_SERIAL_CORE_CONSOLE=y
643CONFIG_UNIX98_PTYS=y
644CONFIG_LEGACY_PTYS=y
645CONFIG_LEGACY_PTY_COUNT=256
646# CONFIG_IPMI_HANDLER is not set
647CONFIG_HW_RANDOM=y
648# CONFIG_NVRAM is not set
649# CONFIG_R3964 is not set
650# CONFIG_RAW_DRIVER is not set
651# CONFIG_TCG_TPM is not set
652CONFIG_I2C=y
653CONFIG_I2C_BOARDINFO=y
654CONFIG_I2C_CHARDEV=y
655
656#
657# I2C Algorithms
658#
659# CONFIG_I2C_ALGOBIT is not set
660# CONFIG_I2C_ALGOPCF is not set
661# CONFIG_I2C_ALGOPCA is not set
662
663#
664# I2C Hardware Bus support
665#
666# CONFIG_I2C_GPIO is not set
667# CONFIG_I2C_OCORES is not set
668# CONFIG_I2C_PARPORT_LIGHT is not set
669# CONFIG_I2C_SIMTEC is not set
670# CONFIG_I2C_TAOS_EVM is not set
671# CONFIG_I2C_STUB is not set
672# CONFIG_I2C_TINY_USB is not set
673
674#
675# Miscellaneous I2C Chip support
676#
677# CONFIG_SENSORS_DS1337 is not set
678# CONFIG_SENSORS_DS1374 is not set
679# CONFIG_DS1682 is not set
680# CONFIG_SENSORS_EEPROM is not set
681# CONFIG_SENSORS_PCF8574 is not set
682# CONFIG_SENSORS_PCA9539 is not set
683# CONFIG_SENSORS_PCF8591 is not set
684# CONFIG_SENSORS_MAX6875 is not set
685# CONFIG_SENSORS_TSL2550 is not set
686# CONFIG_I2C_DEBUG_CORE is not set
687# CONFIG_I2C_DEBUG_ALGO is not set
688# CONFIG_I2C_DEBUG_BUS is not set
689# CONFIG_I2C_DEBUG_CHIP is not set
690
691#
692# SPI support
693#
694CONFIG_SPI=y
695# CONFIG_SPI_DEBUG is not set
696CONFIG_SPI_MASTER=y
697
698#
699# SPI Master Controller Drivers
700#
701CONFIG_SPI_ATMEL=y
702# CONFIG_SPI_BITBANG is not set
703
704#
705# SPI Protocol Masters
706#
707# CONFIG_SPI_AT25 is not set
708# CONFIG_SPI_SPIDEV is not set
709# CONFIG_SPI_TLE62X0 is not set
710# CONFIG_W1 is not set
711# CONFIG_POWER_SUPPLY is not set
712# CONFIG_HWMON is not set
713CONFIG_WATCHDOG=y
714CONFIG_WATCHDOG_NOWAYOUT=y
715
716#
717# Watchdog Device Drivers
718#
719# CONFIG_SOFT_WATCHDOG is not set
720
721#
722# USB-based Watchdog Cards
723#
724# CONFIG_USBPCWATCHDOG is not set
725
726#
727# Sonics Silicon Backplane
728#
729CONFIG_SSB_POSSIBLE=y
730# CONFIG_SSB is not set
731
732#
733# Multifunction device drivers
734#
735# CONFIG_MFD_SM501 is not set
736
737#
738# Multimedia devices
739#
740# CONFIG_VIDEO_DEV is not set
741# CONFIG_DVB_CORE is not set
742# CONFIG_DAB is not set
743
744#
745# Graphics support
746#
747# CONFIG_VGASTATE is not set
748# CONFIG_VIDEO_OUTPUT_CONTROL is not set
749CONFIG_FB=y
750# CONFIG_FIRMWARE_EDID is not set
751# CONFIG_FB_DDC is not set
752CONFIG_FB_CFB_FILLRECT=y
753CONFIG_FB_CFB_COPYAREA=y
754CONFIG_FB_CFB_IMAGEBLIT=y
755# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
756# CONFIG_FB_SYS_FILLRECT is not set
757# CONFIG_FB_SYS_COPYAREA is not set
758# CONFIG_FB_SYS_IMAGEBLIT is not set
759# CONFIG_FB_SYS_FOPS is not set
760CONFIG_FB_DEFERRED_IO=y
761# CONFIG_FB_SVGALIB is not set
762# CONFIG_FB_MACMODES is not set
763# CONFIG_FB_BACKLIGHT is not set
764# CONFIG_FB_MODE_HELPERS is not set
765# CONFIG_FB_TILEBLITTING is not set
766
767#
768# Frame buffer hardware drivers
769#
770# CONFIG_FB_S1D13XXX is not set
771CONFIG_FB_ATMEL=y
772# CONFIG_FB_VIRTUAL is not set
773# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
774
775#
776# Display device support
777#
778# CONFIG_DISPLAY_SUPPORT is not set
779
780#
781# Console display driver support
782#
783# CONFIG_VGA_CONSOLE is not set
784CONFIG_DUMMY_CONSOLE=y
785# CONFIG_FRAMEBUFFER_CONSOLE is not set
786CONFIG_LOGO=y
787# CONFIG_LOGO_LINUX_MONO is not set
788CONFIG_LOGO_LINUX_VGA16=y
789# CONFIG_LOGO_LINUX_CLUT224 is not set
790
791#
792# Sound
793#
794# CONFIG_SOUND is not set
795CONFIG_HID_SUPPORT=y
796CONFIG_HID=y
797CONFIG_HID_DEBUG=y
798# CONFIG_HIDRAW is not set
799
800#
801# USB Input Devices
802#
803# CONFIG_USB_HID is not set
804
805#
806# USB HID Boot Protocol drivers
807#
808# CONFIG_USB_KBD is not set
809# CONFIG_USB_MOUSE is not set
810CONFIG_USB_SUPPORT=y
811CONFIG_USB_ARCH_HAS_HCD=y
812CONFIG_USB_ARCH_HAS_OHCI=y
813# CONFIG_USB_ARCH_HAS_EHCI is not set
814CONFIG_USB=y
815# CONFIG_USB_DEBUG is not set
816
817#
818# Miscellaneous USB options
819#
820CONFIG_USB_DEVICEFS=y
821CONFIG_USB_DEVICE_CLASS=y
822# CONFIG_USB_DYNAMIC_MINORS is not set
823# CONFIG_USB_OTG is not set
824
825#
826# USB Host Controller Drivers
827#
828# CONFIG_USB_ISP116X_HCD is not set
829CONFIG_USB_OHCI_HCD=y
830# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
831# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
832CONFIG_USB_OHCI_LITTLE_ENDIAN=y
833# CONFIG_USB_SL811_HCD is not set
834# CONFIG_USB_R8A66597_HCD is not set
835
836#
837# USB Device Class drivers
838#
839# CONFIG_USB_ACM is not set
840# CONFIG_USB_PRINTER is not set
841
842#
843# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
844#
845
846#
847# may also be needed; see USB_STORAGE Help for more information
848#
849CONFIG_USB_STORAGE=y
850# CONFIG_USB_STORAGE_DEBUG is not set
851# CONFIG_USB_STORAGE_DATAFAB is not set
852# CONFIG_USB_STORAGE_FREECOM is not set
853# CONFIG_USB_STORAGE_ISD200 is not set
854# CONFIG_USB_STORAGE_DPCM is not set
855# CONFIG_USB_STORAGE_USBAT is not set
856# CONFIG_USB_STORAGE_SDDR09 is not set
857# CONFIG_USB_STORAGE_SDDR55 is not set
858# CONFIG_USB_STORAGE_JUMPSHOT is not set
859# CONFIG_USB_STORAGE_ALAUDA is not set
860# CONFIG_USB_STORAGE_ONETOUCH is not set
861# CONFIG_USB_STORAGE_KARMA is not set
862# CONFIG_USB_LIBUSUAL is not set
863
864#
865# USB Imaging devices
866#
867# CONFIG_USB_MDC800 is not set
868# CONFIG_USB_MICROTEK is not set
869CONFIG_USB_MON=y
870
871#
872# USB port drivers
873#
874
875#
876# USB Serial Converter support
877#
878# CONFIG_USB_SERIAL is not set
879
880#
881# USB Miscellaneous drivers
882#
883# CONFIG_USB_EMI62 is not set
884# CONFIG_USB_EMI26 is not set
885# CONFIG_USB_ADUTUX is not set
886# CONFIG_USB_AUERSWALD is not set
887# CONFIG_USB_RIO500 is not set
888# CONFIG_USB_LEGOTOWER is not set
889# CONFIG_USB_LCD is not set
890# CONFIG_USB_BERRY_CHARGE is not set
891# CONFIG_USB_LED is not set
892# CONFIG_USB_CYPRESS_CY7C63 is not set
893# CONFIG_USB_CYTHERM is not set
894# CONFIG_USB_PHIDGET is not set
895# CONFIG_USB_IDMOUSE is not set
896# CONFIG_USB_FTDI_ELAN is not set
897# CONFIG_USB_APPLEDISPLAY is not set
898# CONFIG_USB_LD is not set
899# CONFIG_USB_TRANCEVIBRATOR is not set
900# CONFIG_USB_IOWARRIOR is not set
901# CONFIG_USB_TEST is not set
902
903#
904# USB DSL modem support
905#
906
907#
908# USB Gadget Support
909#
910# CONFIG_USB_GADGET is not set
911CONFIG_MMC=y
912# CONFIG_MMC_DEBUG is not set
913# CONFIG_MMC_UNSAFE_RESUME is not set
914
915#
916# MMC/SD Card Drivers
917#
918CONFIG_MMC_BLOCK=y
919CONFIG_MMC_BLOCK_BOUNCE=y
920# CONFIG_SDIO_UART is not set
921
922#
923# MMC/SD Host Controller Drivers
924#
925CONFIG_MMC_AT91=y
926# CONFIG_MMC_SPI is not set
927# CONFIG_NEW_LEDS is not set
928CONFIG_RTC_LIB=y
929# CONFIG_RTC_CLASS is not set
930
931#
932# File systems
933#
934CONFIG_EXT2_FS=y
935# CONFIG_EXT2_FS_XATTR is not set
936# CONFIG_EXT2_FS_XIP is not set
937# CONFIG_EXT3_FS is not set
938# CONFIG_EXT4DEV_FS is not set
939# CONFIG_REISERFS_FS is not set
940# CONFIG_JFS_FS is not set
941# CONFIG_FS_POSIX_ACL is not set
942# CONFIG_XFS_FS is not set
943# CONFIG_GFS2_FS is not set
944# CONFIG_OCFS2_FS is not set
945# CONFIG_MINIX_FS is not set
946# CONFIG_ROMFS_FS is not set
947CONFIG_INOTIFY=y
948CONFIG_INOTIFY_USER=y
949# CONFIG_QUOTA is not set
950CONFIG_DNOTIFY=y
951# CONFIG_AUTOFS_FS is not set
952# CONFIG_AUTOFS4_FS is not set
953# CONFIG_FUSE_FS is not set
954
955#
956# CD-ROM/DVD Filesystems
957#
958# CONFIG_ISO9660_FS is not set
959# CONFIG_UDF_FS is not set
960
961#
962# DOS/FAT/NT Filesystems
963#
964CONFIG_FAT_FS=y
965# CONFIG_MSDOS_FS is not set
966CONFIG_VFAT_FS=y
967CONFIG_FAT_DEFAULT_CODEPAGE=437
968CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
969# CONFIG_NTFS_FS is not set
970
971#
972# Pseudo filesystems
973#
974CONFIG_PROC_FS=y
975CONFIG_PROC_SYSCTL=y
976CONFIG_SYSFS=y
977CONFIG_TMPFS=y
978# CONFIG_TMPFS_POSIX_ACL is not set
979# CONFIG_HUGETLB_PAGE is not set
980# CONFIG_CONFIGFS_FS is not set
981
982#
983# Miscellaneous filesystems
984#
985# CONFIG_ADFS_FS is not set
986# CONFIG_AFFS_FS is not set
987# CONFIG_HFS_FS is not set
988# CONFIG_HFSPLUS_FS is not set
989# CONFIG_BEFS_FS is not set
990# CONFIG_BFS_FS is not set
991# CONFIG_EFS_FS is not set
992CONFIG_JFFS2_FS=y
993CONFIG_JFFS2_FS_DEBUG=0
994CONFIG_JFFS2_FS_WRITEBUFFER=y
995# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
996# CONFIG_JFFS2_SUMMARY is not set
997# CONFIG_JFFS2_FS_XATTR is not set
998# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
999CONFIG_JFFS2_ZLIB=y
1000# CONFIG_JFFS2_LZO is not set
1001CONFIG_JFFS2_RTIME=y
1002# CONFIG_JFFS2_RUBIN is not set
1003CONFIG_CRAMFS=y
1004# CONFIG_VXFS_FS is not set
1005# CONFIG_HPFS_FS is not set
1006# CONFIG_QNX4FS_FS is not set
1007# CONFIG_SYSV_FS is not set
1008# CONFIG_UFS_FS is not set
1009CONFIG_NETWORK_FILESYSTEMS=y
1010CONFIG_NFS_FS=y
1011# CONFIG_NFS_V3 is not set
1012# CONFIG_NFS_V4 is not set
1013# CONFIG_NFS_DIRECTIO is not set
1014# CONFIG_NFSD is not set
1015CONFIG_ROOT_NFS=y
1016CONFIG_LOCKD=y
1017CONFIG_NFS_COMMON=y
1018CONFIG_SUNRPC=y
1019# CONFIG_SUNRPC_BIND34 is not set
1020# CONFIG_RPCSEC_GSS_KRB5 is not set
1021# CONFIG_RPCSEC_GSS_SPKM3 is not set
1022# CONFIG_SMB_FS is not set
1023# CONFIG_CIFS is not set
1024# CONFIG_NCP_FS is not set
1025# CONFIG_CODA_FS is not set
1026# CONFIG_AFS_FS is not set
1027
1028#
1029# Partition Types
1030#
1031# CONFIG_PARTITION_ADVANCED is not set
1032CONFIG_MSDOS_PARTITION=y
1033CONFIG_NLS=y
1034CONFIG_NLS_DEFAULT="iso8859-1"
1035CONFIG_NLS_CODEPAGE_437=y
1036# CONFIG_NLS_CODEPAGE_737 is not set
1037# CONFIG_NLS_CODEPAGE_775 is not set
1038CONFIG_NLS_CODEPAGE_850=y
1039# CONFIG_NLS_CODEPAGE_852 is not set
1040# CONFIG_NLS_CODEPAGE_855 is not set
1041# CONFIG_NLS_CODEPAGE_857 is not set
1042# CONFIG_NLS_CODEPAGE_860 is not set
1043# CONFIG_NLS_CODEPAGE_861 is not set
1044# CONFIG_NLS_CODEPAGE_862 is not set
1045# CONFIG_NLS_CODEPAGE_863 is not set
1046# CONFIG_NLS_CODEPAGE_864 is not set
1047# CONFIG_NLS_CODEPAGE_865 is not set
1048# CONFIG_NLS_CODEPAGE_866 is not set
1049# CONFIG_NLS_CODEPAGE_869 is not set
1050# CONFIG_NLS_CODEPAGE_936 is not set
1051# CONFIG_NLS_CODEPAGE_950 is not set
1052# CONFIG_NLS_CODEPAGE_932 is not set
1053# CONFIG_NLS_CODEPAGE_949 is not set
1054# CONFIG_NLS_CODEPAGE_874 is not set
1055# CONFIG_NLS_ISO8859_8 is not set
1056# CONFIG_NLS_CODEPAGE_1250 is not set
1057# CONFIG_NLS_CODEPAGE_1251 is not set
1058# CONFIG_NLS_ASCII is not set
1059CONFIG_NLS_ISO8859_1=y
1060# CONFIG_NLS_ISO8859_2 is not set
1061# CONFIG_NLS_ISO8859_3 is not set
1062# CONFIG_NLS_ISO8859_4 is not set
1063# CONFIG_NLS_ISO8859_5 is not set
1064# CONFIG_NLS_ISO8859_6 is not set
1065# CONFIG_NLS_ISO8859_7 is not set
1066# CONFIG_NLS_ISO8859_9 is not set
1067# CONFIG_NLS_ISO8859_13 is not set
1068# CONFIG_NLS_ISO8859_14 is not set
1069# CONFIG_NLS_ISO8859_15 is not set
1070# CONFIG_NLS_KOI8_R is not set
1071# CONFIG_NLS_KOI8_U is not set
1072# CONFIG_NLS_UTF8 is not set
1073# CONFIG_DLM is not set
1074CONFIG_INSTRUMENTATION=y
1075# CONFIG_PROFILING is not set
1076# CONFIG_MARKERS is not set
1077
1078#
1079# Kernel hacking
1080#
1081# CONFIG_PRINTK_TIME is not set
1082CONFIG_ENABLE_WARN_DEPRECATED=y
1083CONFIG_ENABLE_MUST_CHECK=y
1084# CONFIG_MAGIC_SYSRQ is not set
1085# CONFIG_UNUSED_SYMBOLS is not set
1086CONFIG_DEBUG_FS=y
1087# CONFIG_HEADERS_CHECK is not set
1088CONFIG_DEBUG_KERNEL=y
1089# CONFIG_DEBUG_SHIRQ is not set
1090CONFIG_DETECT_SOFTLOCKUP=y
1091CONFIG_SCHED_DEBUG=y
1092# CONFIG_SCHEDSTATS is not set
1093# CONFIG_TIMER_STATS is not set
1094# CONFIG_DEBUG_SLAB is not set
1095# CONFIG_DEBUG_RT_MUTEXES is not set
1096# CONFIG_RT_MUTEX_TESTER is not set
1097# CONFIG_DEBUG_SPINLOCK is not set
1098# CONFIG_DEBUG_MUTEXES is not set
1099# CONFIG_DEBUG_LOCK_ALLOC is not set
1100# CONFIG_PROVE_LOCKING is not set
1101# CONFIG_LOCK_STAT is not set
1102# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1103# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1104# CONFIG_DEBUG_KOBJECT is not set
1105CONFIG_DEBUG_BUGVERBOSE=y
1106CONFIG_DEBUG_INFO=y
1107# CONFIG_DEBUG_VM is not set
1108# CONFIG_DEBUG_LIST is not set
1109# CONFIG_DEBUG_SG is not set
1110CONFIG_FRAME_POINTER=y
1111CONFIG_FORCED_INLINING=y
1112# CONFIG_BOOT_PRINTK_DELAY is not set
1113# CONFIG_RCU_TORTURE_TEST is not set
1114# CONFIG_FAULT_INJECTION is not set
1115# CONFIG_SAMPLES is not set
1116CONFIG_DEBUG_USER=y
1117# CONFIG_DEBUG_ERRORS is not set
1118# CONFIG_DEBUG_LL is not set
1119
1120#
1121# Security options
1122#
1123# CONFIG_KEYS is not set
1124# CONFIG_SECURITY is not set
1125# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1126# CONFIG_CRYPTO is not set
1127
1128#
1129# Library routines
1130#
1131CONFIG_BITREVERSE=y
1132# CONFIG_CRC_CCITT is not set
1133# CONFIG_CRC16 is not set
1134# CONFIG_CRC_ITU_T is not set
1135CONFIG_CRC32=y
1136# CONFIG_CRC7 is not set
1137# CONFIG_LIBCRC32C is not set
1138CONFIG_ZLIB_INFLATE=y
1139CONFIG_ZLIB_DEFLATE=y
1140CONFIG_PLIST=y
1141CONFIG_HAS_IOMEM=y
1142CONFIG_HAS_IOPORT=y
1143CONFIG_HAS_DMA=y
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index 970c8c772eb7..4264e273202d 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -367,7 +367,6 @@ CONFIG_MTD_CFI_UTIL=y
367# CONFIG_MTD_RAM is not set 367# CONFIG_MTD_RAM is not set
368# CONFIG_MTD_ROM is not set 368# CONFIG_MTD_ROM is not set
369# CONFIG_MTD_ABSENT is not set 369# CONFIG_MTD_ABSENT is not set
370CONFIG_MTD_OBSOLETE_CHIPS=y
371CONFIG_MTD_SHARP=y 370CONFIG_MTD_SHARP=y
372# CONFIG_MTD_XIP is not set 371# CONFIG_MTD_XIP is not set
373 372
diff --git a/arch/arm/configs/msm_defconfig b/arch/arm/configs/msm_defconfig
new file mode 100644
index 000000000000..ae4c5e62086a
--- /dev/null
+++ b/arch/arm/configs/msm_defconfig
@@ -0,0 +1,895 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.23
4# Wed Nov 7 01:36:45 2007
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8# CONFIG_GENERIC_GPIO is not set
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y
12# CONFIG_NO_IOPORT is not set
13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_GPIOS=y
15CONFIG_STACKTRACE_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_TRACE_IRQFLAGS_SUPPORT=y
18CONFIG_HARDIRQS_SW_RESEND=y
19CONFIG_GENERIC_IRQ_PROBE=y
20CONFIG_RWSEM_GENERIC_SPINLOCK=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_GENERIC_HWEIGHT=y
24CONFIG_GENERIC_CALIBRATE_DELAY=y
25CONFIG_ZONE_DMA=y
26CONFIG_VECTORS_BASE=0xffff0000
27CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
28
29#
30# General setup
31#
32CONFIG_EXPERIMENTAL=y
33CONFIG_BROKEN_ON_SMP=y
34CONFIG_LOCK_KERNEL=y
35CONFIG_INIT_ENV_ARG_LIMIT=32
36CONFIG_LOCALVERSION=""
37CONFIG_LOCALVERSION_AUTO=y
38CONFIG_SWAP=y
39# CONFIG_SYSVIPC is not set
40# CONFIG_POSIX_MQUEUE is not set
41# CONFIG_BSD_PROCESS_ACCT is not set
42# CONFIG_TASKSTATS is not set
43# CONFIG_USER_NS is not set
44# CONFIG_AUDIT is not set
45CONFIG_IKCONFIG=y
46CONFIG_IKCONFIG_PROC=y
47CONFIG_LOG_BUF_SHIFT=17
48CONFIG_SYSFS_DEPRECATED=y
49# CONFIG_RELAY is not set
50CONFIG_BLK_DEV_INITRD=y
51CONFIG_INITRAMFS_SOURCE=""
52CONFIG_CC_OPTIMIZE_FOR_SIZE=y
53CONFIG_SYSCTL=y
54CONFIG_PANIC_TIMEOUT=0
55# CONFIG_EMBEDDED is not set
56CONFIG_UID16=y
57CONFIG_SYSCTL_SYSCALL=y
58CONFIG_KALLSYMS=y
59# CONFIG_KALLSYMS_ALL is not set
60# CONFIG_KALLSYMS_EXTRA_PASS is not set
61CONFIG_HOTPLUG=y
62CONFIG_PRINTK=y
63CONFIG_BUG=y
64CONFIG_ELF_CORE=y
65CONFIG_BASE_FULL=y
66CONFIG_FUTEX=y
67CONFIG_ANON_INODES=y
68CONFIG_EPOLL=y
69CONFIG_SIGNALFD=y
70CONFIG_EVENTFD=y
71CONFIG_SHMEM=y
72CONFIG_VM_EVENT_COUNTERS=y
73CONFIG_SLAB=y
74# CONFIG_SLUB is not set
75# CONFIG_SLOB is not set
76CONFIG_RT_MUTEXES=y
77# CONFIG_TINY_SHMEM is not set
78CONFIG_BASE_SMALL=0
79# CONFIG_MODULES is not set
80CONFIG_BLOCK=y
81# CONFIG_LBD is not set
82# CONFIG_BLK_DEV_IO_TRACE is not set
83# CONFIG_LSF is not set
84# CONFIG_BLK_DEV_BSG is not set
85
86#
87# IO Schedulers
88#
89CONFIG_IOSCHED_NOOP=y
90CONFIG_IOSCHED_AS=y
91# CONFIG_IOSCHED_DEADLINE is not set
92# CONFIG_IOSCHED_CFQ is not set
93CONFIG_DEFAULT_AS=y
94# CONFIG_DEFAULT_DEADLINE is not set
95# CONFIG_DEFAULT_CFQ is not set
96# CONFIG_DEFAULT_NOOP is not set
97CONFIG_DEFAULT_IOSCHED="anticipatory"
98
99#
100# System Type
101#
102# CONFIG_ARCH_AAEC2000 is not set
103# CONFIG_ARCH_GOLDFISH is not set
104# CONFIG_ARCH_INTEGRATOR is not set
105# CONFIG_ARCH_REALVIEW is not set
106# CONFIG_ARCH_VERSATILE is not set
107# CONFIG_ARCH_AT91 is not set
108# CONFIG_ARCH_CLPS7500 is not set
109# CONFIG_ARCH_CLPS711X is not set
110# CONFIG_ARCH_CO285 is not set
111# CONFIG_ARCH_EBSA110 is not set
112# CONFIG_ARCH_EP93XX is not set
113# CONFIG_ARCH_FOOTBRIDGE is not set
114# CONFIG_ARCH_NETX is not set
115# CONFIG_ARCH_H720X is not set
116# CONFIG_ARCH_IMX is not set
117# CONFIG_ARCH_IOP13XX is not set
118# CONFIG_ARCH_IOP32X is not set
119# CONFIG_ARCH_IOP33X is not set
120# CONFIG_ARCH_IXP23XX is not set
121# CONFIG_ARCH_IXP2000 is not set
122# CONFIG_ARCH_IXP4XX is not set
123# CONFIG_ARCH_L7200 is not set
124# CONFIG_ARCH_KS8695 is not set
125# CONFIG_ARCH_NS9XXX is not set
126# CONFIG_ARCH_MXC is not set
127# CONFIG_ARCH_PNX4008 is not set
128# CONFIG_ARCH_PXA is not set
129# CONFIG_ARCH_RPC is not set
130# CONFIG_ARCH_SA1100 is not set
131# CONFIG_ARCH_S3C2410 is not set
132# CONFIG_ARCH_SHARK is not set
133# CONFIG_ARCH_LH7A40X is not set
134# CONFIG_ARCH_DAVINCI is not set
135# CONFIG_ARCH_OMAP is not set
136CONFIG_ARCH_MSM7X00A=y
137
138#
139# Boot options
140#
141
142#
143# Power management
144#
145
146#
147# MSM7200 Board Type
148#
149CONFIG_MACH_HALIBUT=y
150CONFIG_SERIAL_MSM=y
151CONFIG_SERIAL_MSM_CONSOLE=y
152# CONFIG_SERIAL_MSM_NOINIT is not set
153CONFIG_MSM_SMD=y
154
155#
156# Processor Type
157#
158CONFIG_CPU_32=y
159CONFIG_CPU_V6=y
160# CONFIG_CPU_32v6K is not set
161CONFIG_CPU_32v6=y
162CONFIG_CPU_ABRT_EV6=y
163CONFIG_CPU_CACHE_V6=y
164CONFIG_CPU_CACHE_VIPT=y
165CONFIG_CPU_COPY_V6=y
166CONFIG_CPU_TLB_V6=y
167CONFIG_CPU_HAS_ASID=y
168CONFIG_CPU_CP15=y
169CONFIG_CPU_CP15_MMU=y
170
171#
172# Processor Features
173#
174CONFIG_ARM_THUMB=y
175# CONFIG_CPU_ICACHE_DISABLE is not set
176# CONFIG_CPU_DCACHE_DISABLE is not set
177# CONFIG_CPU_BPREDICT_DISABLE is not set
178# CONFIG_OUTER_CACHE is not set
179
180#
181# Bus support
182#
183# CONFIG_PCI_SYSCALL is not set
184# CONFIG_ARCH_SUPPORTS_MSI is not set
185
186#
187# PCCARD (PCMCIA/CardBus) support
188#
189# CONFIG_PCCARD is not set
190
191#
192# Kernel Features
193#
194CONFIG_TICK_ONESHOT=y
195CONFIG_NO_HZ=y
196CONFIG_HIGH_RES_TIMERS=y
197CONFIG_PREEMPT=y
198CONFIG_HZ=100
199CONFIG_AEABI=y
200# CONFIG_OABI_COMPAT is not set
201# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
202CONFIG_SELECT_MEMORY_MODEL=y
203CONFIG_FLATMEM_MANUAL=y
204# CONFIG_DISCONTIGMEM_MANUAL is not set
205# CONFIG_SPARSEMEM_MANUAL is not set
206CONFIG_FLATMEM=y
207CONFIG_FLAT_NODE_MEM_MAP=y
208# CONFIG_SPARSEMEM_STATIC is not set
209CONFIG_SPLIT_PTLOCK_CPUS=4
210CONFIG_RESOURCES_64BIT=y
211CONFIG_ZONE_DMA_FLAG=1
212CONFIG_BOUNCE=y
213CONFIG_VIRT_TO_BUS=y
214CONFIG_ALIGNMENT_TRAP=y
215
216#
217# Boot options
218#
219CONFIG_ZBOOT_ROM_TEXT=0x0
220CONFIG_ZBOOT_ROM_BSS=0x0
221CONFIG_CMDLINE="mem=64M console=ttyMSM,115200n8"
222# CONFIG_XIP_KERNEL is not set
223# CONFIG_KEXEC is not set
224
225#
226# Floating point emulation
227#
228
229#
230# At least one emulation must be selected
231#
232# CONFIG_VFP is not set
233
234#
235# Userspace binary formats
236#
237CONFIG_BINFMT_ELF=y
238# CONFIG_BINFMT_AOUT is not set
239# CONFIG_BINFMT_MISC is not set
240
241#
242# Power management options
243#
244CONFIG_PM=y
245CONFIG_SUSPEND_UP_POSSIBLE=y
246
247#
248# Networking
249#
250CONFIG_NET=y
251
252#
253# Networking options
254#
255# CONFIG_PACKET is not set
256CONFIG_UNIX=y
257# CONFIG_NET_KEY is not set
258CONFIG_INET=y
259# CONFIG_IP_MULTICAST is not set
260# CONFIG_IP_ADVANCED_ROUTER is not set
261CONFIG_IP_FIB_HASH=y
262# CONFIG_IP_PNP is not set
263# CONFIG_NET_IPIP is not set
264# CONFIG_NET_IPGRE is not set
265# CONFIG_ARPD is not set
266# CONFIG_SYN_COOKIES is not set
267# CONFIG_INET_AH is not set
268# CONFIG_INET_ESP is not set
269# CONFIG_INET_IPCOMP is not set
270# CONFIG_INET_XFRM_TUNNEL is not set
271# CONFIG_INET_TUNNEL is not set
272# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
273# CONFIG_INET_XFRM_MODE_TUNNEL is not set
274# CONFIG_INET_XFRM_MODE_BEET is not set
275# CONFIG_INET_DIAG is not set
276# CONFIG_TCP_CONG_ADVANCED is not set
277CONFIG_TCP_CONG_CUBIC=y
278CONFIG_DEFAULT_TCP_CONG="cubic"
279# CONFIG_TCP_MD5SIG is not set
280# CONFIG_IPV6 is not set
281# CONFIG_INET6_XFRM_TUNNEL is not set
282# CONFIG_INET6_TUNNEL is not set
283# CONFIG_NETWORK_SECMARK is not set
284# CONFIG_NETFILTER is not set
285# CONFIG_IP_DCCP is not set
286# CONFIG_IP_SCTP is not set
287# CONFIG_TIPC is not set
288# CONFIG_ATM is not set
289# CONFIG_BRIDGE is not set
290# CONFIG_VLAN_8021Q is not set
291# CONFIG_DECNET is not set
292# CONFIG_LLC2 is not set
293# CONFIG_IPX is not set
294# CONFIG_ATALK is not set
295# CONFIG_X25 is not set
296# CONFIG_LAPB is not set
297# CONFIG_ECONET is not set
298# CONFIG_WAN_ROUTER is not set
299
300#
301# QoS and/or fair queueing
302#
303# CONFIG_NET_SCHED is not set
304
305#
306# Network testing
307#
308# CONFIG_NET_PKTGEN is not set
309# CONFIG_HAMRADIO is not set
310# CONFIG_IRDA is not set
311# CONFIG_BT is not set
312# CONFIG_AF_RXRPC is not set
313
314#
315# Wireless
316#
317# CONFIG_CFG80211 is not set
318# CONFIG_WIRELESS_EXT is not set
319# CONFIG_MAC80211 is not set
320# CONFIG_IEEE80211 is not set
321# CONFIG_RFKILL is not set
322# CONFIG_NET_9P is not set
323
324#
325# Device Drivers
326#
327
328#
329# Generic Driver Options
330#
331CONFIG_STANDALONE=y
332CONFIG_PREVENT_FIRMWARE_BUILD=y
333CONFIG_FW_LOADER=y
334# CONFIG_DEBUG_DRIVER is not set
335# CONFIG_DEBUG_DEVRES is not set
336# CONFIG_SYS_HYPERVISOR is not set
337# CONFIG_CONNECTOR is not set
338CONFIG_MTD=y
339# CONFIG_MTD_DEBUG is not set
340# CONFIG_MTD_CONCAT is not set
341CONFIG_MTD_PARTITIONS=y
342# CONFIG_MTD_REDBOOT_PARTS is not set
343CONFIG_MTD_CMDLINE_PARTS=y
344# CONFIG_MTD_AFS_PARTS is not set
345
346#
347# User Modules And Translation Layers
348#
349CONFIG_MTD_CHAR=y
350CONFIG_MTD_BLKDEVS=y
351CONFIG_MTD_BLOCK=y
352# CONFIG_FTL is not set
353# CONFIG_NFTL is not set
354# CONFIG_INFTL is not set
355# CONFIG_RFD_FTL is not set
356# CONFIG_SSFDC is not set
357
358#
359# RAM/ROM/Flash chip drivers
360#
361# CONFIG_MTD_CFI is not set
362# CONFIG_MTD_JEDECPROBE is not set
363CONFIG_MTD_MAP_BANK_WIDTH_1=y
364CONFIG_MTD_MAP_BANK_WIDTH_2=y
365CONFIG_MTD_MAP_BANK_WIDTH_4=y
366# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
367# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
368# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
369CONFIG_MTD_CFI_I1=y
370CONFIG_MTD_CFI_I2=y
371# CONFIG_MTD_CFI_I4 is not set
372# CONFIG_MTD_CFI_I8 is not set
373# CONFIG_MTD_RAM is not set
374# CONFIG_MTD_ROM is not set
375# CONFIG_MTD_ABSENT is not set
376
377#
378# Mapping drivers for chip access
379#
380# CONFIG_MTD_COMPLEX_MAPPINGS is not set
381# CONFIG_MTD_PLATRAM is not set
382
383#
384# Self-contained MTD device drivers
385#
386# CONFIG_MTD_SLRAM is not set
387# CONFIG_MTD_PHRAM is not set
388# CONFIG_MTD_MTDRAM is not set
389# CONFIG_MTD_BLOCK2MTD is not set
390CONFIG_MTD_MSM_NAND=y
391
392#
393# Disk-On-Chip Device Drivers
394#
395# CONFIG_MTD_DOC2000 is not set
396# CONFIG_MTD_DOC2001 is not set
397# CONFIG_MTD_DOC2001PLUS is not set
398# CONFIG_MTD_GOLDFISH_NAND is not set
399# CONFIG_MTD_NAND is not set
400# CONFIG_MTD_ONENAND is not set
401
402#
403# UBI - Unsorted block images
404#
405# CONFIG_MTD_UBI is not set
406# CONFIG_PARPORT is not set
407CONFIG_BLK_DEV=y
408# CONFIG_BLK_DEV_COW_COMMON is not set
409# CONFIG_BLK_DEV_LOOP is not set
410# CONFIG_BLK_DEV_NBD is not set
411# CONFIG_BLK_DEV_RAM is not set
412# CONFIG_CDROM_PKTCDVD is not set
413# CONFIG_ATA_OVER_ETH is not set
414
415#
416# SCSI device support
417#
418# CONFIG_RAID_ATTRS is not set
419# CONFIG_SCSI is not set
420# CONFIG_SCSI_DMA is not set
421# CONFIG_SCSI_NETLINK is not set
422# CONFIG_ATA is not set
423# CONFIG_MD is not set
424CONFIG_NETDEVICES=y
425# CONFIG_NETDEVICES_MULTIQUEUE is not set
426CONFIG_DUMMY=y
427# CONFIG_BONDING is not set
428# CONFIG_MACVLAN is not set
429# CONFIG_EQUALIZER is not set
430# CONFIG_TUN is not set
431# CONFIG_PHYLIB is not set
432CONFIG_NET_ETHERNET=y
433CONFIG_MII=y
434# CONFIG_AX88796 is not set
435CONFIG_SMC91X=y
436# CONFIG_DM9000 is not set
437CONFIG_NETDEV_1000=y
438CONFIG_NETDEV_10000=y
439
440#
441# Wireless LAN
442#
443# CONFIG_WLAN_PRE80211 is not set
444# CONFIG_WLAN_80211 is not set
445# CONFIG_WAN is not set
446CONFIG_PPP=y
447# CONFIG_PPP_MULTILINK is not set
448# CONFIG_PPP_FILTER is not set
449CONFIG_PPP_ASYNC=y
450# CONFIG_PPP_SYNC_TTY is not set
451CONFIG_PPP_DEFLATE=y
452CONFIG_PPP_BSDCOMP=y
453# CONFIG_PPP_MPPE is not set
454# CONFIG_PPPOE is not set
455# CONFIG_PPPOL2TP is not set
456# CONFIG_SLIP is not set
457CONFIG_SLHC=y
458# CONFIG_SHAPER is not set
459# CONFIG_NETCONSOLE is not set
460CONFIG_MSM_RMNET=y
461# CONFIG_NETPOLL is not set
462# CONFIG_NET_POLL_CONTROLLER is not set
463# CONFIG_ISDN is not set
464
465#
466# Input device support
467#
468CONFIG_INPUT=y
469# CONFIG_INPUT_FF_MEMLESS is not set
470# CONFIG_INPUT_POLLDEV is not set
471
472#
473# Userland interfaces
474#
475CONFIG_INPUT_MOUSEDEV=y
476# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
477CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
478CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
479# CONFIG_INPUT_JOYDEV is not set
480# CONFIG_INPUT_TSDEV is not set
481CONFIG_INPUT_EVDEV=y
482# CONFIG_INPUT_EVBUG is not set
483
484#
485# Input Device Drivers
486#
487CONFIG_INPUT_KEYBOARD=y
488# CONFIG_KEYBOARD_ATKBD is not set
489# CONFIG_KEYBOARD_SUNKBD is not set
490# CONFIG_KEYBOARD_LKKBD is not set
491# CONFIG_KEYBOARD_XTKBD is not set
492# CONFIG_KEYBOARD_NEWTON is not set
493# CONFIG_KEYBOARD_STOWAWAY is not set
494# CONFIG_KEYBOARD_GOLDFISH_EVENTS is not set
495# CONFIG_INPUT_MOUSE is not set
496# CONFIG_INPUT_JOYSTICK is not set
497# CONFIG_INPUT_TABLET is not set
498CONFIG_INPUT_TOUCHSCREEN=y
499# CONFIG_TOUCHSCREEN_FUJITSU is not set
500# CONFIG_TOUCHSCREEN_GUNZE is not set
501# CONFIG_TOUCHSCREEN_ELO is not set
502# CONFIG_TOUCHSCREEN_MTOUCH is not set
503# CONFIG_TOUCHSCREEN_MK712 is not set
504# CONFIG_TOUCHSCREEN_PENMOUNT is not set
505# CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_MEP is not set
506CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI=y
507# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
508# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
509# CONFIG_TOUCHSCREEN_UCB1400 is not set
510# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
511CONFIG_INPUT_MISC=y
512# CONFIG_INPUT_ATI_REMOTE is not set
513# CONFIG_INPUT_ATI_REMOTE2 is not set
514# CONFIG_INPUT_KEYSPAN_REMOTE is not set
515# CONFIG_INPUT_POWERMATE is not set
516# CONFIG_INPUT_YEALINK is not set
517# CONFIG_INPUT_UINPUT is not set
518CONFIG_INPUT_GPIO=y
519
520#
521# Hardware I/O ports
522#
523# CONFIG_SERIO is not set
524# CONFIG_GAMEPORT is not set
525
526#
527# Character devices
528#
529CONFIG_VT=y
530CONFIG_VT_CONSOLE=y
531CONFIG_HW_CONSOLE=y
532CONFIG_VT_HW_CONSOLE_BINDING=y
533# CONFIG_SERIAL_NONSTANDARD is not set
534
535#
536# Serial drivers
537#
538# CONFIG_SERIAL_8250 is not set
539
540#
541# Non-8250 serial port support
542#
543CONFIG_SERIAL_CORE=y
544CONFIG_SERIAL_CORE_CONSOLE=y
545CONFIG_UNIX98_PTYS=y
546# CONFIG_LEGACY_PTYS is not set
547# CONFIG_IPMI_HANDLER is not set
548# CONFIG_WATCHDOG is not set
549# CONFIG_HW_RANDOM is not set
550# CONFIG_NVRAM is not set
551# CONFIG_R3964 is not set
552# CONFIG_RAW_DRIVER is not set
553# CONFIG_TCG_TPM is not set
554CONFIG_DCC_TTY=y
555# CONFIG_GOLDFISH_TTY is not set
556CONFIG_BINDER=y
557CONFIG_I2C=y
558CONFIG_I2C_BOARDINFO=y
559# CONFIG_I2C_CHARDEV is not set
560
561#
562# I2C Algorithms
563#
564# CONFIG_I2C_ALGOBIT is not set
565# CONFIG_I2C_ALGOPCF is not set
566# CONFIG_I2C_ALGOPCA is not set
567
568#
569# I2C Hardware Bus support
570#
571CONFIG_I2C_MSM=y
572# CONFIG_I2C_OCORES is not set
573# CONFIG_I2C_PARPORT_LIGHT is not set
574# CONFIG_I2C_SIMTEC is not set
575# CONFIG_I2C_TAOS_EVM is not set
576
577#
578# Miscellaneous I2C Chip support
579#
580# CONFIG_SENSORS_DS1337 is not set
581# CONFIG_SENSORS_DS1374 is not set
582# CONFIG_DS1682 is not set
583# CONFIG_SENSORS_EEPROM is not set
584# CONFIG_SENSORS_PCF8574 is not set
585# CONFIG_SENSORS_PCA9539 is not set
586CONFIG_SENSORS_PCA9633=y
587# CONFIG_SENSORS_PCF8591 is not set
588# CONFIG_SENSORS_MAX6875 is not set
589CONFIG_SENSORS_AKM8976=y
590# CONFIG_SENSORS_TSL2550 is not set
591# CONFIG_I2C_DEBUG_CORE is not set
592# CONFIG_I2C_DEBUG_ALGO is not set
593# CONFIG_I2C_DEBUG_BUS is not set
594# CONFIG_I2C_DEBUG_CHIP is not set
595
596#
597# SPI support
598#
599# CONFIG_SPI is not set
600# CONFIG_SPI_MASTER is not set
601# CONFIG_W1 is not set
602# CONFIG_HWMON is not set
603CONFIG_MISC_DEVICES=y
604# CONFIG_EEPROM_93CX6 is not set
605CONFIG_LOW_MEMORY_KILLER=y
606
607#
608# Multifunction device drivers
609#
610# CONFIG_MFD_SM501 is not set
611CONFIG_NEW_LEDS=y
612CONFIG_LEDS_CLASS=y
613
614#
615# Multimedia devices
616#
617# CONFIG_VIDEO_DEV is not set
618# CONFIG_DVB_CORE is not set
619CONFIG_DAB=y
620
621#
622# Graphics support
623#
624# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
625
626#
627# Display device support
628#
629# CONFIG_DISPLAY_SUPPORT is not set
630# CONFIG_VGASTATE is not set
631CONFIG_VIDEO_OUTPUT_CONTROL=y
632CONFIG_FB=y
633# CONFIG_FIRMWARE_EDID is not set
634# CONFIG_FB_DDC is not set
635CONFIG_FB_CFB_FILLRECT=y
636CONFIG_FB_CFB_COPYAREA=y
637CONFIG_FB_CFB_IMAGEBLIT=y
638# CONFIG_FB_SYS_FILLRECT is not set
639# CONFIG_FB_SYS_COPYAREA is not set
640# CONFIG_FB_SYS_IMAGEBLIT is not set
641# CONFIG_FB_SYS_FOPS is not set
642CONFIG_FB_DEFERRED_IO=y
643# CONFIG_FB_SVGALIB is not set
644# CONFIG_FB_MACMODES is not set
645# CONFIG_FB_BACKLIGHT is not set
646CONFIG_FB_MODE_HELPERS=y
647CONFIG_FB_TILEBLITTING=y
648
649#
650# Frame buffer hardware drivers
651#
652# CONFIG_FB_S1D13XXX is not set
653CONFIG_FB_MSM=y
654# CONFIG_FB_GOLDFISH is not set
655# CONFIG_FB_VIRTUAL is not set
656
657#
658# Console display driver support
659#
660# CONFIG_VGA_CONSOLE is not set
661CONFIG_DUMMY_CONSOLE=y
662CONFIG_FRAMEBUFFER_CONSOLE=y
663# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
664# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
665# CONFIG_FONTS is not set
666CONFIG_FONT_8x8=y
667CONFIG_FONT_8x16=y
668# CONFIG_LOGO is not set
669
670#
671# Sound
672#
673# CONFIG_SOUND is not set
674CONFIG_HID_SUPPORT=y
675CONFIG_HID=y
676# CONFIG_HID_DEBUG is not set
677CONFIG_USB_SUPPORT=y
678CONFIG_USB_ARCH_HAS_HCD=y
679# CONFIG_USB_ARCH_HAS_OHCI is not set
680# CONFIG_USB_ARCH_HAS_EHCI is not set
681# CONFIG_USB is not set
682
683#
684# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
685#
686
687#
688# USB Gadget Support
689#
690# CONFIG_USB_GADGET is not set
691
692#
693# USB Function Support
694#
695CONFIG_USB_FUNCTION=y
696CONFIG_USB_FUNCTION_MSM_HSUSB=y
697# CONFIG_USB_FUNCTION_NULL is not set
698# CONFIG_USB_FUNCTION_ZERO is not set
699# CONFIG_USB_FUNCTION_LOOPBACK is not set
700CONFIG_USB_FUNCTION_ADB=y
701# CONFIG_MMC is not set
702CONFIG_RTC_LIB=y
703# CONFIG_RTC_CLASS is not set
704
705#
706# DMA Engine support
707#
708# CONFIG_DMA_ENGINE is not set
709
710#
711# DMA Clients
712#
713
714#
715# DMA Devices
716#
717
718#
719# Android
720#
721# CONFIG_ANDROID_GADGET is not set
722# CONFIG_ANDROID_RAM_CONSOLE is not set
723CONFIG_ANDROID_LOGGER=y
724CONFIG_ANDROID_VIBRATOR=y
725
726#
727# File systems
728#
729# CONFIG_EXT2_FS is not set
730# CONFIG_EXT3_FS is not set
731# CONFIG_EXT4DEV_FS is not set
732# CONFIG_REISERFS_FS is not set
733# CONFIG_JFS_FS is not set
734# CONFIG_FS_POSIX_ACL is not set
735# CONFIG_XFS_FS is not set
736# CONFIG_GFS2_FS is not set
737# CONFIG_OCFS2_FS is not set
738# CONFIG_MINIX_FS is not set
739# CONFIG_ROMFS_FS is not set
740CONFIG_INOTIFY=y
741CONFIG_INOTIFY_USER=y
742# CONFIG_QUOTA is not set
743CONFIG_DNOTIFY=y
744# CONFIG_AUTOFS_FS is not set
745# CONFIG_AUTOFS4_FS is not set
746# CONFIG_FUSE_FS is not set
747
748#
749# CD-ROM/DVD Filesystems
750#
751# CONFIG_ISO9660_FS is not set
752# CONFIG_UDF_FS is not set
753
754#
755# DOS/FAT/NT Filesystems
756#
757# CONFIG_MSDOS_FS is not set
758# CONFIG_VFAT_FS is not set
759# CONFIG_NTFS_FS is not set
760
761#
762# Pseudo filesystems
763#
764CONFIG_PROC_FS=y
765CONFIG_PROC_SYSCTL=y
766CONFIG_SYSFS=y
767CONFIG_TMPFS=y
768# CONFIG_TMPFS_POSIX_ACL is not set
769# CONFIG_HUGETLB_PAGE is not set
770CONFIG_RAMFS=y
771# CONFIG_CONFIGFS_FS is not set
772
773#
774# Miscellaneous filesystems
775#
776# CONFIG_ADFS_FS is not set
777# CONFIG_AFFS_FS is not set
778# CONFIG_HFS_FS is not set
779# CONFIG_HFSPLUS_FS is not set
780# CONFIG_BEFS_FS is not set
781# CONFIG_BFS_FS is not set
782# CONFIG_EFS_FS is not set
783CONFIG_YAFFS_FS=y
784CONFIG_YAFFS_YAFFS1=y
785# CONFIG_YAFFS_9BYTE_TAGS is not set
786# CONFIG_YAFFS_DOES_ECC is not set
787CONFIG_YAFFS_YAFFS2=y
788CONFIG_YAFFS_AUTO_YAFFS2=y
789# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
790CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
791# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
792# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
793CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
794# CONFIG_JFFS2_FS is not set
795# CONFIG_CRAMFS is not set
796# CONFIG_VXFS_FS is not set
797# CONFIG_HPFS_FS is not set
798# CONFIG_QNX4FS_FS is not set
799# CONFIG_SYSV_FS is not set
800# CONFIG_UFS_FS is not set
801
802#
803# Network File Systems
804#
805# CONFIG_NFS_FS is not set
806# CONFIG_NFSD is not set
807# CONFIG_SMB_FS is not set
808# CONFIG_CIFS is not set
809# CONFIG_NCP_FS is not set
810# CONFIG_CODA_FS is not set
811# CONFIG_AFS_FS is not set
812
813#
814# Partition Types
815#
816# CONFIG_PARTITION_ADVANCED is not set
817CONFIG_MSDOS_PARTITION=y
818
819#
820# Native Language Support
821#
822# CONFIG_NLS is not set
823
824#
825# Distributed Lock Manager
826#
827# CONFIG_DLM is not set
828
829#
830# Profiling support
831#
832# CONFIG_PROFILING is not set
833
834#
835# Kernel hacking
836#
837# CONFIG_PRINTK_TIME is not set
838CONFIG_ENABLE_MUST_CHECK=y
839CONFIG_MAGIC_SYSRQ=y
840# CONFIG_UNUSED_SYMBOLS is not set
841# CONFIG_DEBUG_FS is not set
842# CONFIG_HEADERS_CHECK is not set
843CONFIG_DEBUG_KERNEL=y
844# CONFIG_DEBUG_SHIRQ is not set
845CONFIG_DETECT_SOFTLOCKUP=y
846CONFIG_SCHED_DEBUG=y
847CONFIG_SCHEDSTATS=y
848# CONFIG_TIMER_STATS is not set
849# CONFIG_DEBUG_SLAB is not set
850CONFIG_DEBUG_PREEMPT=y
851# CONFIG_DEBUG_RT_MUTEXES is not set
852# CONFIG_RT_MUTEX_TESTER is not set
853# CONFIG_DEBUG_SPINLOCK is not set
854CONFIG_DEBUG_MUTEXES=y
855# CONFIG_DEBUG_LOCK_ALLOC is not set
856# CONFIG_PROVE_LOCKING is not set
857# CONFIG_LOCK_STAT is not set
858CONFIG_DEBUG_SPINLOCK_SLEEP=y
859# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
860# CONFIG_DEBUG_KOBJECT is not set
861CONFIG_DEBUG_BUGVERBOSE=y
862CONFIG_DEBUG_INFO=y
863# CONFIG_DEBUG_VM is not set
864# CONFIG_DEBUG_LIST is not set
865CONFIG_FRAME_POINTER=y
866# CONFIG_FORCED_INLINING is not set
867# CONFIG_FAULT_INJECTION is not set
868# CONFIG_DEBUG_USER is not set
869# CONFIG_DEBUG_ERRORS is not set
870CONFIG_DEBUG_LL=y
871# CONFIG_DEBUG_ICEDCC is not set
872
873#
874# Security options
875#
876# CONFIG_KEYS is not set
877# CONFIG_SECURITY is not set
878# CONFIG_CRYPTO is not set
879
880#
881# Library routines
882#
883CONFIG_BITREVERSE=y
884CONFIG_CRC_CCITT=y
885# CONFIG_CRC16 is not set
886# CONFIG_CRC_ITU_T is not set
887CONFIG_CRC32=y
888# CONFIG_CRC7 is not set
889# CONFIG_LIBCRC32C is not set
890CONFIG_ZLIB_INFLATE=y
891CONFIG_ZLIB_DEFLATE=y
892CONFIG_PLIST=y
893CONFIG_HAS_IOMEM=y
894CONFIG_HAS_IOPORT=y
895CONFIG_HAS_DMA=y
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 593b56509f4f..faa761921153 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_ISA_DMA) += dma-isa.o
19obj-$(CONFIG_PCI) += bios32.o isa.o 19obj-$(CONFIG_PCI) += bios32.o isa.o
20obj-$(CONFIG_SMP) += smp.o 20obj-$(CONFIG_SMP) += smp.o
21obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 21obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
22obj-$(CONFIG_KPROBES) += kprobes.o kprobes-decode.o
22obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 23obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
23 24
24obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o 25obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index 0a3e9ad297d8..2f080a35a2d9 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -216,7 +216,7 @@ void __init isa_init_dma(dma_t *dma)
216 216
217 request_dma(DMA_ISA_CASCADE, "cascade"); 217 request_dma(DMA_ISA_CASCADE, "cascade");
218 218
219 for (i = 0; i < sizeof(dma_resources) / sizeof(dma_resources[0]); i++) 219 for (i = 0; i < ARRAY_SIZE(dma_resources); i++)
220 request_resource(&ioport_resource, dma_resources + i); 220 request_resource(&ioport_resource, dma_resources + i);
221 } 221 }
222} 222}
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 29dec080a604..a46d5b456765 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -11,8 +11,8 @@
11 * 11 *
12 * Low-level vector interface routines 12 * Low-level vector interface routines
13 * 13 *
14 * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction that causes 14 * Note: there is a StrongARM bug in the STMIA rn, {regs}^ instruction
15 * it to save wrong values... Be aware! 15 * that causes it to save wrong values... Be aware!
16 */ 16 */
17 17
18#include <asm/memory.h> 18#include <asm/memory.h>
@@ -58,6 +58,12 @@
58 58
59 .endm 59 .endm
60 60
61#ifdef CONFIG_KPROBES
62 .section .kprobes.text,"ax",%progbits
63#else
64 .text
65#endif
66
61/* 67/*
62 * Invalid mode handlers 68 * Invalid mode handlers
63 */ 69 */
@@ -112,8 +118,8 @@ common_invalid:
112#define SPFIX(code...) 118#define SPFIX(code...)
113#endif 119#endif
114 120
115 .macro svc_entry 121 .macro svc_entry, stack_hole=0
116 sub sp, sp, #S_FRAME_SIZE 122 sub sp, sp, #(S_FRAME_SIZE + \stack_hole)
117 SPFIX( tst sp, #4 ) 123 SPFIX( tst sp, #4 )
118 SPFIX( bicne sp, sp, #4 ) 124 SPFIX( bicne sp, sp, #4 )
119 stmib sp, {r1 - r12} 125 stmib sp, {r1 - r12}
@@ -121,7 +127,7 @@ common_invalid:
121 ldmia r0, {r1 - r3} 127 ldmia r0, {r1 - r3}
122 add r5, sp, #S_SP @ here for interlock avoidance 128 add r5, sp, #S_SP @ here for interlock avoidance
123 mov r4, #-1 @ "" "" "" "" 129 mov r4, #-1 @ "" "" "" ""
124 add r0, sp, #S_FRAME_SIZE @ "" "" "" "" 130 add r0, sp, #(S_FRAME_SIZE + \stack_hole)
125 SPFIX( addne r0, r0, #4 ) 131 SPFIX( addne r0, r0, #4 )
126 str r1, [sp] @ save the "real" r0 copied 132 str r1, [sp] @ save the "real" r0 copied
127 @ from the exception stack 133 @ from the exception stack
@@ -242,7 +248,14 @@ svc_preempt:
242 248
243 .align 5 249 .align 5
244__und_svc: 250__und_svc:
251#ifdef CONFIG_KPROBES
252 @ If a kprobe is about to simulate a "stmdb sp..." instruction,
253 @ it obviously needs free stack space which then will belong to
254 @ the saved context.
255 svc_entry 64
256#else
245 svc_entry 257 svc_entry
258#endif
246 259
247 @ 260 @
248 @ call emulation code, which returns using r9 if it has emulated 261 @ call emulation code, which returns using r9 if it has emulated
@@ -480,6 +493,13 @@ __und_usr:
480 * co-processor instructions. However, we have to watch out 493 * co-processor instructions. However, we have to watch out
481 * for the ARM6/ARM7 SWI bug. 494 * for the ARM6/ARM7 SWI bug.
482 * 495 *
496 * NEON is a special case that has to be handled here. Not all
497 * NEON instructions are co-processor instructions, so we have
498 * to make a special case of checking for them. Plus, there's
499 * five groups of them, so we have a table of mask/opcode pairs
500 * to check against, and if any match then we branch off into the
501 * NEON handler code.
502 *
483 * Emulators may wish to make use of the following registers: 503 * Emulators may wish to make use of the following registers:
484 * r0 = instruction opcode. 504 * r0 = instruction opcode.
485 * r2 = PC+4 505 * r2 = PC+4
@@ -488,6 +508,23 @@ __und_usr:
488 * lr = unrecognised instruction return address 508 * lr = unrecognised instruction return address
489 */ 509 */
490call_fpe: 510call_fpe:
511#ifdef CONFIG_NEON
512 adr r6, .LCneon_opcodes
5132:
514 ldr r7, [r6], #4 @ mask value
515 cmp r7, #0 @ end mask?
516 beq 1f
517 and r8, r0, r7
518 ldr r7, [r6], #4 @ opcode bits matching in mask
519 cmp r8, r7 @ NEON instruction?
520 bne 2b
521 get_thread_info r10
522 mov r7, #1
523 strb r7, [r10, #TI_USED_CP + 10] @ mark CP#10 as used
524 strb r7, [r10, #TI_USED_CP + 11] @ mark CP#11 as used
525 b do_vfp @ let VFP handler handle this
5261:
527#endif
491 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27 528 tst r0, #0x08000000 @ only CDP/CPRT/LDC/STC have bit 27
492#if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710) 529#if defined(CONFIG_CPU_ARM610) || defined(CONFIG_CPU_ARM710)
493 and r8, r0, #0x0f000000 @ mask out op-code bits 530 and r8, r0, #0x0f000000 @ mask out op-code bits
@@ -537,6 +574,20 @@ call_fpe:
537 mov pc, lr @ CP#14 (Debug) 574 mov pc, lr @ CP#14 (Debug)
538 mov pc, lr @ CP#15 (Control) 575 mov pc, lr @ CP#15 (Control)
539 576
577#ifdef CONFIG_NEON
578 .align 6
579
580.LCneon_opcodes:
581 .word 0xfe000000 @ mask
582 .word 0xf2000000 @ opcode
583
584 .word 0xff100000 @ mask
585 .word 0xf4000000 @ opcode
586
587 .word 0x00000000 @ mask
588 .word 0x00000000 @ opcode
589#endif
590
540do_fpe: 591do_fpe:
541 enable_irq 592 enable_irq
542 ldr r4, .LCfp 593 ldr r4, .LCfp
@@ -555,7 +606,7 @@ do_fpe:
555 .data 606 .data
556ENTRY(fp_enter) 607ENTRY(fp_enter)
557 .word no_fp 608 .word no_fp
558 .text 609 .previous
559 610
560no_fp: mov pc, lr 611no_fp: mov pc, lr
561 612
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 33e6cc2ffd3b..6c90c50a9ee3 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -72,7 +72,7 @@ no_work_pending:
72 ldr r1, [sp, #S_PSR] @ get calling cpsr 72 ldr r1, [sp, #S_PSR] @ get calling cpsr
73 ldr lr, [sp, #S_PC]! @ get pc 73 ldr lr, [sp, #S_PC]! @ get pc
74 msr spsr_cxsf, r1 @ save in spsr_svc 74 msr spsr_cxsf, r1 @ save in spsr_svc
75 ldmdb sp, {r0 - lr}^ @ get calling r1 - lr 75 ldmdb sp, {r0 - lr}^ @ get calling r0 - lr
76 mov r0, r0 76 mov r0, r0
77 add sp, sp, #S_FRAME_SIZE - S_PC 77 add sp, sp, #S_FRAME_SIZE - S_PC
78 movs pc, lr @ return & move spsr_svc into cpsr 78 movs pc, lr @ return & move spsr_svc into cpsr
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
new file mode 100644
index 000000000000..d51bc8b60557
--- /dev/null
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -0,0 +1,1529 @@
1/*
2 * arch/arm/kernel/kprobes-decode.c
3 *
4 * Copyright (C) 2006, 2007 Motorola Inc.
5 *
6 * 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
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16/*
17 * We do not have hardware single-stepping on ARM, This
18 * effort is further complicated by the ARM not having a
19 * "next PC" register. Instructions that change the PC
20 * can't be safely single-stepped in a MP environment, so
21 * we have a lot of work to do:
22 *
23 * In the prepare phase:
24 * *) If it is an instruction that does anything
25 * with the CPU mode, we reject it for a kprobe.
26 * (This is out of laziness rather than need. The
27 * instructions could be simulated.)
28 *
29 * *) Otherwise, decode the instruction rewriting its
30 * registers to take fixed, ordered registers and
31 * setting a handler for it to run the instruction.
32 *
33 * In the execution phase by an instruction's handler:
34 *
35 * *) If the PC is written to by the instruction, the
36 * instruction must be fully simulated in software.
37 * If it is a conditional instruction, the handler
38 * will use insn[0] to copy its condition code to
39 * set r0 to 1 and insn[1] to "mov pc, lr" to return.
40 *
41 * *) Otherwise, a modified form of the instruction is
42 * directly executed. Its handler calls the
43 * instruction in insn[0]. In insn[1] is a
44 * "mov pc, lr" to return.
45 *
46 * Before calling, load up the reordered registers
47 * from the original instruction's registers. If one
48 * of the original input registers is the PC, compute
49 * and adjust the appropriate input register.
50 *
51 * After call completes, copy the output registers to
52 * the original instruction's original registers.
53 *
54 * We don't use a real breakpoint instruction since that
55 * would have us in the kernel go from SVC mode to SVC
56 * mode losing the link register. Instead we use an
57 * undefined instruction. To simplify processing, the
58 * undefined instruction used for kprobes must be reserved
59 * exclusively for kprobes use.
60 *
61 * TODO: ifdef out some instruction decoding based on architecture.
62 */
63
64#include <linux/kernel.h>
65#include <linux/kprobes.h>
66
67#define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit)))))
68
69#define branch_displacement(insn) sign_extend(((insn) & 0xffffff) << 2, 25)
70
71#define PSR_fs (PSR_f|PSR_s)
72
73#define KPROBE_RETURN_INSTRUCTION 0xe1a0f00e /* mov pc, lr */
74#define SET_R0_TRUE_INSTRUCTION 0xe3a00001 /* mov r0, #1 */
75
76#define truecc_insn(insn) (((insn) & 0xf0000000) | \
77 (SET_R0_TRUE_INSTRUCTION & 0x0fffffff))
78
79typedef long (insn_0arg_fn_t)(void);
80typedef long (insn_1arg_fn_t)(long);
81typedef long (insn_2arg_fn_t)(long, long);
82typedef long (insn_3arg_fn_t)(long, long, long);
83typedef long (insn_4arg_fn_t)(long, long, long, long);
84typedef long long (insn_llret_0arg_fn_t)(void);
85typedef long long (insn_llret_3arg_fn_t)(long, long, long);
86typedef long long (insn_llret_4arg_fn_t)(long, long, long, long);
87
88union reg_pair {
89 long long dr;
90#ifdef __LITTLE_ENDIAN
91 struct { long r0, r1; };
92#else
93 struct { long r1, r0; };
94#endif
95};
96
97/*
98 * For STR and STM instructions, an ARM core may choose to use either
99 * a +8 or a +12 displacement from the current instruction's address.
100 * Whichever value is chosen for a given core, it must be the same for
101 * both instructions and may not change. This function measures it.
102 */
103
104static int str_pc_offset;
105
106static void __init find_str_pc_offset(void)
107{
108 int addr, scratch, ret;
109
110 __asm__ (
111 "sub %[ret], pc, #4 \n\t"
112 "str pc, %[addr] \n\t"
113 "ldr %[scr], %[addr] \n\t"
114 "sub %[ret], %[scr], %[ret] \n\t"
115 : [ret] "=r" (ret), [scr] "=r" (scratch), [addr] "+m" (addr));
116
117 str_pc_offset = ret;
118}
119
120/*
121 * The insnslot_?arg_r[w]flags() functions below are to keep the
122 * msr -> *fn -> mrs instruction sequences indivisible so that
123 * the state of the CPSR flags aren't inadvertently modified
124 * just before or just after the call.
125 */
126
127static inline long __kprobes
128insnslot_0arg_rflags(long cpsr, insn_0arg_fn_t *fn)
129{
130 register long ret asm("r0");
131
132 __asm__ __volatile__ (
133 "msr cpsr_fs, %[cpsr] \n\t"
134 "mov lr, pc \n\t"
135 "mov pc, %[fn] \n\t"
136 : "=r" (ret)
137 : [cpsr] "r" (cpsr), [fn] "r" (fn)
138 : "lr", "cc"
139 );
140 return ret;
141}
142
143static inline long long __kprobes
144insnslot_llret_0arg_rflags(long cpsr, insn_llret_0arg_fn_t *fn)
145{
146 register long ret0 asm("r0");
147 register long ret1 asm("r1");
148 union reg_pair fnr;
149
150 __asm__ __volatile__ (
151 "msr cpsr_fs, %[cpsr] \n\t"
152 "mov lr, pc \n\t"
153 "mov pc, %[fn] \n\t"
154 : "=r" (ret0), "=r" (ret1)
155 : [cpsr] "r" (cpsr), [fn] "r" (fn)
156 : "lr", "cc"
157 );
158 fnr.r0 = ret0;
159 fnr.r1 = ret1;
160 return fnr.dr;
161}
162
163static inline long __kprobes
164insnslot_1arg_rflags(long r0, long cpsr, insn_1arg_fn_t *fn)
165{
166 register long rr0 asm("r0") = r0;
167 register long ret asm("r0");
168
169 __asm__ __volatile__ (
170 "msr cpsr_fs, %[cpsr] \n\t"
171 "mov lr, pc \n\t"
172 "mov pc, %[fn] \n\t"
173 : "=r" (ret)
174 : "0" (rr0), [cpsr] "r" (cpsr), [fn] "r" (fn)
175 : "lr", "cc"
176 );
177 return ret;
178}
179
180static inline long __kprobes
181insnslot_2arg_rflags(long r0, long r1, long cpsr, insn_2arg_fn_t *fn)
182{
183 register long rr0 asm("r0") = r0;
184 register long rr1 asm("r1") = r1;
185 register long ret asm("r0");
186
187 __asm__ __volatile__ (
188 "msr cpsr_fs, %[cpsr] \n\t"
189 "mov lr, pc \n\t"
190 "mov pc, %[fn] \n\t"
191 : "=r" (ret)
192 : "0" (rr0), "r" (rr1),
193 [cpsr] "r" (cpsr), [fn] "r" (fn)
194 : "lr", "cc"
195 );
196 return ret;
197}
198
199static inline long __kprobes
200insnslot_3arg_rflags(long r0, long r1, long r2, long cpsr, insn_3arg_fn_t *fn)
201{
202 register long rr0 asm("r0") = r0;
203 register long rr1 asm("r1") = r1;
204 register long rr2 asm("r2") = r2;
205 register long ret asm("r0");
206
207 __asm__ __volatile__ (
208 "msr cpsr_fs, %[cpsr] \n\t"
209 "mov lr, pc \n\t"
210 "mov pc, %[fn] \n\t"
211 : "=r" (ret)
212 : "0" (rr0), "r" (rr1), "r" (rr2),
213 [cpsr] "r" (cpsr), [fn] "r" (fn)
214 : "lr", "cc"
215 );
216 return ret;
217}
218
219static inline long long __kprobes
220insnslot_llret_3arg_rflags(long r0, long r1, long r2, long cpsr,
221 insn_llret_3arg_fn_t *fn)
222{
223 register long rr0 asm("r0") = r0;
224 register long rr1 asm("r1") = r1;
225 register long rr2 asm("r2") = r2;
226 register long ret0 asm("r0");
227 register long ret1 asm("r1");
228 union reg_pair fnr;
229
230 __asm__ __volatile__ (
231 "msr cpsr_fs, %[cpsr] \n\t"
232 "mov lr, pc \n\t"
233 "mov pc, %[fn] \n\t"
234 : "=r" (ret0), "=r" (ret1)
235 : "0" (rr0), "r" (rr1), "r" (rr2),
236 [cpsr] "r" (cpsr), [fn] "r" (fn)
237 : "lr", "cc"
238 );
239 fnr.r0 = ret0;
240 fnr.r1 = ret1;
241 return fnr.dr;
242}
243
244static inline long __kprobes
245insnslot_4arg_rflags(long r0, long r1, long r2, long r3, long cpsr,
246 insn_4arg_fn_t *fn)
247{
248 register long rr0 asm("r0") = r0;
249 register long rr1 asm("r1") = r1;
250 register long rr2 asm("r2") = r2;
251 register long rr3 asm("r3") = r3;
252 register long ret asm("r0");
253
254 __asm__ __volatile__ (
255 "msr cpsr_fs, %[cpsr] \n\t"
256 "mov lr, pc \n\t"
257 "mov pc, %[fn] \n\t"
258 : "=r" (ret)
259 : "0" (rr0), "r" (rr1), "r" (rr2), "r" (rr3),
260 [cpsr] "r" (cpsr), [fn] "r" (fn)
261 : "lr", "cc"
262 );
263 return ret;
264}
265
266static inline long __kprobes
267insnslot_1arg_rwflags(long r0, long *cpsr, insn_1arg_fn_t *fn)
268{
269 register long rr0 asm("r0") = r0;
270 register long ret asm("r0");
271 long oldcpsr = *cpsr;
272 long newcpsr;
273
274 __asm__ __volatile__ (
275 "msr cpsr_fs, %[oldcpsr] \n\t"
276 "mov lr, pc \n\t"
277 "mov pc, %[fn] \n\t"
278 "mrs %[newcpsr], cpsr \n\t"
279 : "=r" (ret), [newcpsr] "=r" (newcpsr)
280 : "0" (rr0), [oldcpsr] "r" (oldcpsr), [fn] "r" (fn)
281 : "lr", "cc"
282 );
283 *cpsr = (oldcpsr & ~PSR_fs) | (newcpsr & PSR_fs);
284 return ret;
285}
286
287static inline long __kprobes
288insnslot_2arg_rwflags(long r0, long r1, long *cpsr, insn_2arg_fn_t *fn)
289{
290 register long rr0 asm("r0") = r0;
291 register long rr1 asm("r1") = r1;
292 register long ret asm("r0");
293 long oldcpsr = *cpsr;
294 long newcpsr;
295
296 __asm__ __volatile__ (
297 "msr cpsr_fs, %[oldcpsr] \n\t"
298 "mov lr, pc \n\t"
299 "mov pc, %[fn] \n\t"
300 "mrs %[newcpsr], cpsr \n\t"
301 : "=r" (ret), [newcpsr] "=r" (newcpsr)
302 : "0" (rr0), "r" (rr1), [oldcpsr] "r" (oldcpsr), [fn] "r" (fn)
303 : "lr", "cc"
304 );
305 *cpsr = (oldcpsr & ~PSR_fs) | (newcpsr & PSR_fs);
306 return ret;
307}
308
309static inline long __kprobes
310insnslot_3arg_rwflags(long r0, long r1, long r2, long *cpsr,
311 insn_3arg_fn_t *fn)
312{
313 register long rr0 asm("r0") = r0;
314 register long rr1 asm("r1") = r1;
315 register long rr2 asm("r2") = r2;
316 register long ret asm("r0");
317 long oldcpsr = *cpsr;
318 long newcpsr;
319
320 __asm__ __volatile__ (
321 "msr cpsr_fs, %[oldcpsr] \n\t"
322 "mov lr, pc \n\t"
323 "mov pc, %[fn] \n\t"
324 "mrs %[newcpsr], cpsr \n\t"
325 : "=r" (ret), [newcpsr] "=r" (newcpsr)
326 : "0" (rr0), "r" (rr1), "r" (rr2),
327 [oldcpsr] "r" (oldcpsr), [fn] "r" (fn)
328 : "lr", "cc"
329 );
330 *cpsr = (oldcpsr & ~PSR_fs) | (newcpsr & PSR_fs);
331 return ret;
332}
333
334static inline long __kprobes
335insnslot_4arg_rwflags(long r0, long r1, long r2, long r3, long *cpsr,
336 insn_4arg_fn_t *fn)
337{
338 register long rr0 asm("r0") = r0;
339 register long rr1 asm("r1") = r1;
340 register long rr2 asm("r2") = r2;
341 register long rr3 asm("r3") = r3;
342 register long ret asm("r0");
343 long oldcpsr = *cpsr;
344 long newcpsr;
345
346 __asm__ __volatile__ (
347 "msr cpsr_fs, %[oldcpsr] \n\t"
348 "mov lr, pc \n\t"
349 "mov pc, %[fn] \n\t"
350 "mrs %[newcpsr], cpsr \n\t"
351 : "=r" (ret), [newcpsr] "=r" (newcpsr)
352 : "0" (rr0), "r" (rr1), "r" (rr2), "r" (rr3),
353 [oldcpsr] "r" (oldcpsr), [fn] "r" (fn)
354 : "lr", "cc"
355 );
356 *cpsr = (oldcpsr & ~PSR_fs) | (newcpsr & PSR_fs);
357 return ret;
358}
359
360static inline long long __kprobes
361insnslot_llret_4arg_rwflags(long r0, long r1, long r2, long r3, long *cpsr,
362 insn_llret_4arg_fn_t *fn)
363{
364 register long rr0 asm("r0") = r0;
365 register long rr1 asm("r1") = r1;
366 register long rr2 asm("r2") = r2;
367 register long rr3 asm("r3") = r3;
368 register long ret0 asm("r0");
369 register long ret1 asm("r1");
370 long oldcpsr = *cpsr;
371 long newcpsr;
372 union reg_pair fnr;
373
374 __asm__ __volatile__ (
375 "msr cpsr_fs, %[oldcpsr] \n\t"
376 "mov lr, pc \n\t"
377 "mov pc, %[fn] \n\t"
378 "mrs %[newcpsr], cpsr \n\t"
379 : "=r" (ret0), "=r" (ret1), [newcpsr] "=r" (newcpsr)
380 : "0" (rr0), "r" (rr1), "r" (rr2), "r" (rr3),
381 [oldcpsr] "r" (oldcpsr), [fn] "r" (fn)
382 : "lr", "cc"
383 );
384 *cpsr = (oldcpsr & ~PSR_fs) | (newcpsr & PSR_fs);
385 fnr.r0 = ret0;
386 fnr.r1 = ret1;
387 return fnr.dr;
388}
389
390/*
391 * To avoid the complications of mimicing single-stepping on a
392 * processor without a Next-PC or a single-step mode, and to
393 * avoid having to deal with the side-effects of boosting, we
394 * simulate or emulate (almost) all ARM instructions.
395 *
396 * "Simulation" is where the instruction's behavior is duplicated in
397 * C code. "Emulation" is where the original instruction is rewritten
398 * and executed, often by altering its registers.
399 *
400 * By having all behavior of the kprobe'd instruction completed before
401 * returning from the kprobe_handler(), all locks (scheduler and
402 * interrupt) can safely be released. There is no need for secondary
403 * breakpoints, no race with MP or preemptable kernels, nor having to
404 * clean up resources counts at a later time impacting overall system
405 * performance. By rewriting the instruction, only the minimum registers
406 * need to be loaded and saved back optimizing performance.
407 *
408 * Calling the insnslot_*_rwflags version of a function doesn't hurt
409 * anything even when the CPSR flags aren't updated by the
410 * instruction. It's just a little slower in return for saving
411 * a little space by not having a duplicate function that doesn't
412 * update the flags. (The same optimization can be said for
413 * instructions that do or don't perform register writeback)
414 * Also, instructions can either read the flags, only write the
415 * flags, or read and write the flags. To save combinations
416 * rather than for sheer performance, flag functions just assume
417 * read and write of flags.
418 */
419
420static void __kprobes simulate_bbl(struct kprobe *p, struct pt_regs *regs)
421{
422 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
423 kprobe_opcode_t insn = p->opcode;
424 long iaddr = (long)p->addr;
425 int disp = branch_displacement(insn);
426
427 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
428 return;
429
430 if (insn & (1 << 24))
431 regs->ARM_lr = iaddr + 4;
432
433 regs->ARM_pc = iaddr + 8 + disp;
434}
435
436static void __kprobes simulate_blx1(struct kprobe *p, struct pt_regs *regs)
437{
438 kprobe_opcode_t insn = p->opcode;
439 long iaddr = (long)p->addr;
440 int disp = branch_displacement(insn);
441
442 regs->ARM_lr = iaddr + 4;
443 regs->ARM_pc = iaddr + 8 + disp + ((insn >> 23) & 0x2);
444 regs->ARM_cpsr |= PSR_T_BIT;
445}
446
447static void __kprobes simulate_blx2bx(struct kprobe *p, struct pt_regs *regs)
448{
449 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
450 kprobe_opcode_t insn = p->opcode;
451 int rm = insn & 0xf;
452 long rmv = regs->uregs[rm];
453
454 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
455 return;
456
457 if (insn & (1 << 5))
458 regs->ARM_lr = (long)p->addr + 4;
459
460 regs->ARM_pc = rmv & ~0x1;
461 regs->ARM_cpsr &= ~PSR_T_BIT;
462 if (rmv & 0x1)
463 regs->ARM_cpsr |= PSR_T_BIT;
464}
465
466static void __kprobes simulate_ldm1stm1(struct kprobe *p, struct pt_regs *regs)
467{
468 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
469 kprobe_opcode_t insn = p->opcode;
470 int rn = (insn >> 16) & 0xf;
471 int lbit = insn & (1 << 20);
472 int wbit = insn & (1 << 21);
473 int ubit = insn & (1 << 23);
474 int pbit = insn & (1 << 24);
475 long *addr = (long *)regs->uregs[rn];
476 int reg_bit_vector;
477 int reg_count;
478
479 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
480 return;
481
482 reg_count = 0;
483 reg_bit_vector = insn & 0xffff;
484 while (reg_bit_vector) {
485 reg_bit_vector &= (reg_bit_vector - 1);
486 ++reg_count;
487 }
488
489 if (!ubit)
490 addr -= reg_count;
491 addr += (!pbit ^ !ubit);
492
493 reg_bit_vector = insn & 0xffff;
494 while (reg_bit_vector) {
495 int reg = __ffs(reg_bit_vector);
496 reg_bit_vector &= (reg_bit_vector - 1);
497 if (lbit)
498 regs->uregs[reg] = *addr++;
499 else
500 *addr++ = regs->uregs[reg];
501 }
502
503 if (wbit) {
504 if (!ubit)
505 addr -= reg_count;
506 addr -= (!pbit ^ !ubit);
507 regs->uregs[rn] = (long)addr;
508 }
509}
510
511static void __kprobes simulate_stm1_pc(struct kprobe *p, struct pt_regs *regs)
512{
513 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
514
515 if (!insnslot_1arg_rflags(0, regs->ARM_cpsr, i_fn))
516 return;
517
518 regs->ARM_pc = (long)p->addr + str_pc_offset;
519 simulate_ldm1stm1(p, regs);
520 regs->ARM_pc = (long)p->addr + 4;
521}
522
523static void __kprobes simulate_mov_ipsp(struct kprobe *p, struct pt_regs *regs)
524{
525 regs->uregs[12] = regs->uregs[13];
526}
527
528static void __kprobes emulate_ldcstc(struct kprobe *p, struct pt_regs *regs)
529{
530 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
531 kprobe_opcode_t insn = p->opcode;
532 int rn = (insn >> 16) & 0xf;
533 long rnv = regs->uregs[rn];
534
535 /* Save Rn in case of writeback. */
536 regs->uregs[rn] = insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn);
537}
538
539static void __kprobes emulate_ldrd(struct kprobe *p, struct pt_regs *regs)
540{
541 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
542 kprobe_opcode_t insn = p->opcode;
543 int rd = (insn >> 12) & 0xf;
544 int rn = (insn >> 16) & 0xf;
545 int rm = insn & 0xf; /* rm may be invalid, don't care. */
546
547 /* Not following the C calling convention here, so need asm(). */
548 __asm__ __volatile__ (
549 "ldr r0, %[rn] \n\t"
550 "ldr r1, %[rm] \n\t"
551 "msr cpsr_fs, %[cpsr]\n\t"
552 "mov lr, pc \n\t"
553 "mov pc, %[i_fn] \n\t"
554 "str r0, %[rn] \n\t" /* in case of writeback */
555 "str r2, %[rd0] \n\t"
556 "str r3, %[rd1] \n\t"
557 : [rn] "+m" (regs->uregs[rn]),
558 [rd0] "=m" (regs->uregs[rd]),
559 [rd1] "=m" (regs->uregs[rd+1])
560 : [rm] "m" (regs->uregs[rm]),
561 [cpsr] "r" (regs->ARM_cpsr),
562 [i_fn] "r" (i_fn)
563 : "r0", "r1", "r2", "r3", "lr", "cc"
564 );
565}
566
567static void __kprobes emulate_strd(struct kprobe *p, struct pt_regs *regs)
568{
569 insn_4arg_fn_t *i_fn = (insn_4arg_fn_t *)&p->ainsn.insn[0];
570 kprobe_opcode_t insn = p->opcode;
571 int rd = (insn >> 12) & 0xf;
572 int rn = (insn >> 16) & 0xf;
573 int rm = insn & 0xf;
574 long rnv = regs->uregs[rn];
575 long rmv = regs->uregs[rm]; /* rm/rmv may be invalid, don't care. */
576
577 regs->uregs[rn] = insnslot_4arg_rflags(rnv, rmv, regs->uregs[rd],
578 regs->uregs[rd+1],
579 regs->ARM_cpsr, i_fn);
580}
581
582static void __kprobes emulate_ldr(struct kprobe *p, struct pt_regs *regs)
583{
584 insn_llret_3arg_fn_t *i_fn = (insn_llret_3arg_fn_t *)&p->ainsn.insn[0];
585 kprobe_opcode_t insn = p->opcode;
586 union reg_pair fnr;
587 int rd = (insn >> 12) & 0xf;
588 int rn = (insn >> 16) & 0xf;
589 int rm = insn & 0xf;
590 long rdv;
591 long rnv = regs->uregs[rn];
592 long rmv = regs->uregs[rm]; /* rm/rmv may be invalid, don't care. */
593 long cpsr = regs->ARM_cpsr;
594
595 fnr.dr = insnslot_llret_3arg_rflags(rnv, 0, rmv, cpsr, i_fn);
596 regs->uregs[rn] = fnr.r0; /* Save Rn in case of writeback. */
597 rdv = fnr.r1;
598
599 if (rd == 15) {
600#if __LINUX_ARM_ARCH__ >= 5
601 cpsr &= ~PSR_T_BIT;
602 if (rdv & 0x1)
603 cpsr |= PSR_T_BIT;
604 regs->ARM_cpsr = cpsr;
605 rdv &= ~0x1;
606#else
607 rdv &= ~0x2;
608#endif
609 }
610 regs->uregs[rd] = rdv;
611}
612
613static void __kprobes emulate_str(struct kprobe *p, struct pt_regs *regs)
614{
615 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0];
616 kprobe_opcode_t insn = p->opcode;
617 long iaddr = (long)p->addr;
618 int rd = (insn >> 12) & 0xf;
619 int rn = (insn >> 16) & 0xf;
620 int rm = insn & 0xf;
621 long rdv = (rd == 15) ? iaddr + str_pc_offset : regs->uregs[rd];
622 long rnv = (rn == 15) ? iaddr + 8 : regs->uregs[rn];
623 long rmv = regs->uregs[rm]; /* rm/rmv may be invalid, don't care. */
624
625 /* Save Rn in case of writeback. */
626 regs->uregs[rn] =
627 insnslot_3arg_rflags(rnv, rdv, rmv, regs->ARM_cpsr, i_fn);
628}
629
630static void __kprobes emulate_mrrc(struct kprobe *p, struct pt_regs *regs)
631{
632 insn_llret_0arg_fn_t *i_fn = (insn_llret_0arg_fn_t *)&p->ainsn.insn[0];
633 kprobe_opcode_t insn = p->opcode;
634 union reg_pair fnr;
635 int rd = (insn >> 12) & 0xf;
636 int rn = (insn >> 16) & 0xf;
637
638 fnr.dr = insnslot_llret_0arg_rflags(regs->ARM_cpsr, i_fn);
639 regs->uregs[rn] = fnr.r0;
640 regs->uregs[rd] = fnr.r1;
641}
642
643static void __kprobes emulate_mcrr(struct kprobe *p, struct pt_regs *regs)
644{
645 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
646 kprobe_opcode_t insn = p->opcode;
647 int rd = (insn >> 12) & 0xf;
648 int rn = (insn >> 16) & 0xf;
649 long rnv = regs->uregs[rn];
650 long rdv = regs->uregs[rd];
651
652 insnslot_2arg_rflags(rnv, rdv, regs->ARM_cpsr, i_fn);
653}
654
655static void __kprobes emulate_sat(struct kprobe *p, struct pt_regs *regs)
656{
657 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
658 kprobe_opcode_t insn = p->opcode;
659 int rd = (insn >> 12) & 0xf;
660 int rm = insn & 0xf;
661 long rmv = regs->uregs[rm];
662
663 /* Writes Q flag */
664 regs->uregs[rd] = insnslot_1arg_rwflags(rmv, &regs->ARM_cpsr, i_fn);
665}
666
667static void __kprobes emulate_sel(struct kprobe *p, struct pt_regs *regs)
668{
669 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
670 kprobe_opcode_t insn = p->opcode;
671 int rd = (insn >> 12) & 0xf;
672 int rn = (insn >> 16) & 0xf;
673 int rm = insn & 0xf;
674 long rnv = regs->uregs[rn];
675 long rmv = regs->uregs[rm];
676
677 /* Reads GE bits */
678 regs->uregs[rd] = insnslot_2arg_rflags(rnv, rmv, regs->ARM_cpsr, i_fn);
679}
680
681static void __kprobes emulate_none(struct kprobe *p, struct pt_regs *regs)
682{
683 insn_0arg_fn_t *i_fn = (insn_0arg_fn_t *)&p->ainsn.insn[0];
684
685 insnslot_0arg_rflags(regs->ARM_cpsr, i_fn);
686}
687
688static void __kprobes emulate_rd12(struct kprobe *p, struct pt_regs *regs)
689{
690 insn_0arg_fn_t *i_fn = (insn_0arg_fn_t *)&p->ainsn.insn[0];
691 kprobe_opcode_t insn = p->opcode;
692 int rd = (insn >> 12) & 0xf;
693
694 regs->uregs[rd] = insnslot_0arg_rflags(regs->ARM_cpsr, i_fn);
695}
696
697static void __kprobes emulate_ird12(struct kprobe *p, struct pt_regs *regs)
698{
699 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
700 kprobe_opcode_t insn = p->opcode;
701 int ird = (insn >> 12) & 0xf;
702
703 insnslot_1arg_rflags(regs->uregs[ird], regs->ARM_cpsr, i_fn);
704}
705
706static void __kprobes emulate_rn16(struct kprobe *p, struct pt_regs *regs)
707{
708 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
709 kprobe_opcode_t insn = p->opcode;
710 int rn = (insn >> 16) & 0xf;
711 long rnv = regs->uregs[rn];
712
713 insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn);
714}
715
716static void __kprobes emulate_rd12rm0(struct kprobe *p, struct pt_regs *regs)
717{
718 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
719 kprobe_opcode_t insn = p->opcode;
720 int rd = (insn >> 12) & 0xf;
721 int rm = insn & 0xf;
722 long rmv = regs->uregs[rm];
723
724 regs->uregs[rd] = insnslot_1arg_rflags(rmv, regs->ARM_cpsr, i_fn);
725}
726
727static void __kprobes
728emulate_rd12rn16rm0_rwflags(struct kprobe *p, struct pt_regs *regs)
729{
730 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
731 kprobe_opcode_t insn = p->opcode;
732 int rd = (insn >> 12) & 0xf;
733 int rn = (insn >> 16) & 0xf;
734 int rm = insn & 0xf;
735 long rnv = regs->uregs[rn];
736 long rmv = regs->uregs[rm];
737
738 regs->uregs[rd] =
739 insnslot_2arg_rwflags(rnv, rmv, &regs->ARM_cpsr, i_fn);
740}
741
742static void __kprobes
743emulate_rd16rn12rs8rm0_rwflags(struct kprobe *p, struct pt_regs *regs)
744{
745 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0];
746 kprobe_opcode_t insn = p->opcode;
747 int rd = (insn >> 16) & 0xf;
748 int rn = (insn >> 12) & 0xf;
749 int rs = (insn >> 8) & 0xf;
750 int rm = insn & 0xf;
751 long rnv = regs->uregs[rn];
752 long rsv = regs->uregs[rs];
753 long rmv = regs->uregs[rm];
754
755 regs->uregs[rd] =
756 insnslot_3arg_rwflags(rnv, rsv, rmv, &regs->ARM_cpsr, i_fn);
757}
758
759static void __kprobes
760emulate_rd16rs8rm0_rwflags(struct kprobe *p, struct pt_regs *regs)
761{
762 insn_2arg_fn_t *i_fn = (insn_2arg_fn_t *)&p->ainsn.insn[0];
763 kprobe_opcode_t insn = p->opcode;
764 int rd = (insn >> 16) & 0xf;
765 int rs = (insn >> 8) & 0xf;
766 int rm = insn & 0xf;
767 long rsv = regs->uregs[rs];
768 long rmv = regs->uregs[rm];
769
770 regs->uregs[rd] =
771 insnslot_2arg_rwflags(rsv, rmv, &regs->ARM_cpsr, i_fn);
772}
773
774static void __kprobes
775emulate_rdhi16rdlo12rs8rm0_rwflags(struct kprobe *p, struct pt_regs *regs)
776{
777 insn_llret_4arg_fn_t *i_fn = (insn_llret_4arg_fn_t *)&p->ainsn.insn[0];
778 kprobe_opcode_t insn = p->opcode;
779 union reg_pair fnr;
780 int rdhi = (insn >> 16) & 0xf;
781 int rdlo = (insn >> 12) & 0xf;
782 int rs = (insn >> 8) & 0xf;
783 int rm = insn & 0xf;
784 long rsv = regs->uregs[rs];
785 long rmv = regs->uregs[rm];
786
787 fnr.dr = insnslot_llret_4arg_rwflags(regs->uregs[rdhi],
788 regs->uregs[rdlo], rsv, rmv,
789 &regs->ARM_cpsr, i_fn);
790 regs->uregs[rdhi] = fnr.r0;
791 regs->uregs[rdlo] = fnr.r1;
792}
793
794static void __kprobes
795emulate_alu_imm_rflags(struct kprobe *p, struct pt_regs *regs)
796{
797 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
798 kprobe_opcode_t insn = p->opcode;
799 int rd = (insn >> 12) & 0xf;
800 int rn = (insn >> 16) & 0xf;
801 long rnv = (rn == 15) ? (long)p->addr + 8 : regs->uregs[rn];
802
803 regs->uregs[rd] = insnslot_1arg_rflags(rnv, regs->ARM_cpsr, i_fn);
804}
805
806static void __kprobes
807emulate_alu_imm_rwflags(struct kprobe *p, struct pt_regs *regs)
808{
809 insn_1arg_fn_t *i_fn = (insn_1arg_fn_t *)&p->ainsn.insn[0];
810 kprobe_opcode_t insn = p->opcode;
811 int rd = (insn >> 12) & 0xf;
812 int rn = (insn >> 16) & 0xf;
813 long rnv = (rn == 15) ? (long)p->addr + 8 : regs->uregs[rn];
814
815 regs->uregs[rd] = insnslot_1arg_rwflags(rnv, &regs->ARM_cpsr, i_fn);
816}
817
818static void __kprobes
819emulate_alu_rflags(struct kprobe *p, struct pt_regs *regs)
820{
821 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0];
822 kprobe_opcode_t insn = p->opcode;
823 long ppc = (long)p->addr + 8;
824 int rd = (insn >> 12) & 0xf;
825 int rn = (insn >> 16) & 0xf; /* rn/rnv/rs/rsv may be */
826 int rs = (insn >> 8) & 0xf; /* invalid, don't care. */
827 int rm = insn & 0xf;
828 long rnv = (rn == 15) ? ppc : regs->uregs[rn];
829 long rmv = (rm == 15) ? ppc : regs->uregs[rm];
830 long rsv = regs->uregs[rs];
831
832 regs->uregs[rd] =
833 insnslot_3arg_rflags(rnv, rmv, rsv, regs->ARM_cpsr, i_fn);
834}
835
836static void __kprobes
837emulate_alu_rwflags(struct kprobe *p, struct pt_regs *regs)
838{
839 insn_3arg_fn_t *i_fn = (insn_3arg_fn_t *)&p->ainsn.insn[0];
840 kprobe_opcode_t insn = p->opcode;
841 long ppc = (long)p->addr + 8;
842 int rd = (insn >> 12) & 0xf;
843 int rn = (insn >> 16) & 0xf; /* rn/rnv/rs/rsv may be */
844 int rs = (insn >> 8) & 0xf; /* invalid, don't care. */
845 int rm = insn & 0xf;
846 long rnv = (rn == 15) ? ppc : regs->uregs[rn];
847 long rmv = (rm == 15) ? ppc : regs->uregs[rm];
848 long rsv = regs->uregs[rs];
849
850 regs->uregs[rd] =
851 insnslot_3arg_rwflags(rnv, rmv, rsv, &regs->ARM_cpsr, i_fn);
852}
853
854static enum kprobe_insn __kprobes
855prep_emulate_ldr_str(kprobe_opcode_t insn, struct arch_specific_insn *asi)
856{
857 int ibit = (insn & (1 << 26)) ? 25 : 22;
858
859 insn &= 0xfff00fff;
860 insn |= 0x00001000; /* Rn = r0, Rd = r1 */
861 if (insn & (1 << ibit)) {
862 insn &= ~0xf;
863 insn |= 2; /* Rm = r2 */
864 }
865 asi->insn[0] = insn;
866 asi->insn_handler = (insn & (1 << 20)) ? emulate_ldr : emulate_str;
867 return INSN_GOOD;
868}
869
870static enum kprobe_insn __kprobes
871prep_emulate_rd12rm0(kprobe_opcode_t insn, struct arch_specific_insn *asi)
872{
873 insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */
874 asi->insn[0] = insn;
875 asi->insn_handler = emulate_rd12rm0;
876 return INSN_GOOD;
877}
878
879static enum kprobe_insn __kprobes
880prep_emulate_rd12(kprobe_opcode_t insn, struct arch_specific_insn *asi)
881{
882 insn &= 0xffff0fff; /* Rd = r0 */
883 asi->insn[0] = insn;
884 asi->insn_handler = emulate_rd12;
885 return INSN_GOOD;
886}
887
888static enum kprobe_insn __kprobes
889prep_emulate_rd12rn16rm0_wflags(kprobe_opcode_t insn,
890 struct arch_specific_insn *asi)
891{
892 insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */
893 insn |= 0x00000001; /* Rm = r1 */
894 asi->insn[0] = insn;
895 asi->insn_handler = emulate_rd12rn16rm0_rwflags;
896 return INSN_GOOD;
897}
898
899static enum kprobe_insn __kprobes
900prep_emulate_rd16rs8rm0_wflags(kprobe_opcode_t insn,
901 struct arch_specific_insn *asi)
902{
903 insn &= 0xfff0f0f0; /* Rd = r0, Rs = r0 */
904 insn |= 0x00000001; /* Rm = r1 */
905 asi->insn[0] = insn;
906 asi->insn_handler = emulate_rd16rs8rm0_rwflags;
907 return INSN_GOOD;
908}
909
910static enum kprobe_insn __kprobes
911prep_emulate_rd16rn12rs8rm0_wflags(kprobe_opcode_t insn,
912 struct arch_specific_insn *asi)
913{
914 insn &= 0xfff000f0; /* Rd = r0, Rn = r0 */
915 insn |= 0x00000102; /* Rs = r1, Rm = r2 */
916 asi->insn[0] = insn;
917 asi->insn_handler = emulate_rd16rn12rs8rm0_rwflags;
918 return INSN_GOOD;
919}
920
921static enum kprobe_insn __kprobes
922prep_emulate_rdhi16rdlo12rs8rm0_wflags(kprobe_opcode_t insn,
923 struct arch_specific_insn *asi)
924{
925 insn &= 0xfff000f0; /* RdHi = r0, RdLo = r1 */
926 insn |= 0x00001203; /* Rs = r2, Rm = r3 */
927 asi->insn[0] = insn;
928 asi->insn_handler = emulate_rdhi16rdlo12rs8rm0_rwflags;
929 return INSN_GOOD;
930}
931
932/*
933 * For the instruction masking and comparisons in all the "space_*"
934 * functions below, Do _not_ rearrange the order of tests unless
935 * you're very, very sure of what you are doing. For the sake of
936 * efficiency, the masks for some tests sometimes assume other test
937 * have been done prior to them so the number of patterns to test
938 * for an instruction set can be as broad as possible to reduce the
939 * number of tests needed.
940 */
941
942static enum kprobe_insn __kprobes
943space_1111(kprobe_opcode_t insn, struct arch_specific_insn *asi)
944{
945 /* CPS mmod == 1 : 1111 0001 0000 xx10 xxxx xxxx xx0x xxxx */
946 /* RFE : 1111 100x x0x1 xxxx xxxx 1010 xxxx xxxx */
947 /* SRS : 1111 100x x1x0 1101 xxxx 0101 xxxx xxxx */
948 if ((insn & 0xfff30020) == 0xf1020000 ||
949 (insn & 0xfe500f00) == 0xf8100a00 ||
950 (insn & 0xfe5f0f00) == 0xf84d0500)
951 return INSN_REJECTED;
952
953 /* PLD : 1111 01x1 x101 xxxx xxxx xxxx xxxx xxxx : */
954 if ((insn & 0xfd700000) == 0xf4500000) {
955 insn &= 0xfff0ffff; /* Rn = r0 */
956 asi->insn[0] = insn;
957 asi->insn_handler = emulate_rn16;
958 return INSN_GOOD;
959 }
960
961 /* BLX(1) : 1111 101x xxxx xxxx xxxx xxxx xxxx xxxx : */
962 if ((insn & 0xfe000000) == 0xfa000000) {
963 asi->insn_handler = simulate_blx1;
964 return INSN_GOOD_NO_SLOT;
965 }
966
967 /* SETEND : 1111 0001 0000 0001 xxxx xxxx 0000 xxxx */
968 /* CDP2 : 1111 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */
969 if ((insn & 0xffff00f0) == 0xf1010000 ||
970 (insn & 0xff000010) == 0xfe000000) {
971 asi->insn[0] = insn;
972 asi->insn_handler = emulate_none;
973 return INSN_GOOD;
974 }
975
976 /* MCRR2 : 1111 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */
977 /* MRRC2 : 1111 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd != Rn) */
978 if ((insn & 0xffe00000) == 0xfc400000) {
979 insn &= 0xfff00fff; /* Rn = r0 */
980 insn |= 0x00001000; /* Rd = r1 */
981 asi->insn[0] = insn;
982 asi->insn_handler =
983 (insn & (1 << 20)) ? emulate_mrrc : emulate_mcrr;
984 return INSN_GOOD;
985 }
986
987 /* LDC2 : 1111 110x xxx1 xxxx xxxx xxxx xxxx xxxx */
988 /* STC2 : 1111 110x xxx0 xxxx xxxx xxxx xxxx xxxx */
989 if ((insn & 0xfe000000) == 0xfc000000) {
990 insn &= 0xfff0ffff; /* Rn = r0 */
991 asi->insn[0] = insn;
992 asi->insn_handler = emulate_ldcstc;
993 return INSN_GOOD;
994 }
995
996 /* MCR2 : 1111 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */
997 /* MRC2 : 1111 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */
998 insn &= 0xffff0fff; /* Rd = r0 */
999 asi->insn[0] = insn;
1000 asi->insn_handler = (insn & (1 << 20)) ? emulate_rd12 : emulate_ird12;
1001 return INSN_GOOD;
1002}
1003
1004static enum kprobe_insn __kprobes
1005space_cccc_000x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1006{
1007 /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx xxx0 xxxx */
1008 if ((insn & 0x0f900010) == 0x01000000) {
1009
1010 /* BXJ : cccc 0001 0010 xxxx xxxx xxxx 0010 xxxx */
1011 /* MSR : cccc 0001 0x10 xxxx xxxx xxxx 0000 xxxx */
1012 if ((insn & 0x0ff000f0) == 0x01200020 ||
1013 (insn & 0x0fb000f0) == 0x01200000)
1014 return INSN_REJECTED;
1015
1016 /* MRS : cccc 0001 0x00 xxxx xxxx xxxx 0000 xxxx */
1017 if ((insn & 0x0fb00010) == 0x01000000)
1018 return prep_emulate_rd12(insn, asi);
1019
1020 /* SMLALxy : cccc 0001 0100 xxxx xxxx xxxx 1xx0 xxxx */
1021 if ((insn & 0x0ff00090) == 0x01400080)
1022 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi);
1023
1024 /* SMULWy : cccc 0001 0010 xxxx xxxx xxxx 1x10 xxxx */
1025 /* SMULxy : cccc 0001 0110 xxxx xxxx xxxx 1xx0 xxxx */
1026 if ((insn & 0x0ff000b0) == 0x012000a0 ||
1027 (insn & 0x0ff00090) == 0x01600080)
1028 return prep_emulate_rd16rs8rm0_wflags(insn, asi);
1029
1030 /* SMLAxy : cccc 0001 0000 xxxx xxxx xxxx 1xx0 xxxx : Q */
1031 /* SMLAWy : cccc 0001 0010 xxxx xxxx xxxx 0x00 xxxx : Q */
1032 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1033
1034 }
1035
1036 /* cccc 0001 0xx0 xxxx xxxx xxxx xxxx 0xx1 xxxx */
1037 else if ((insn & 0x0f900090) == 0x01000010) {
1038
1039 /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */
1040 if ((insn & 0xfff000f0) == 0xe1200070)
1041 return INSN_REJECTED;
1042
1043 /* BLX(2) : cccc 0001 0010 xxxx xxxx xxxx 0011 xxxx */
1044 /* BX : cccc 0001 0010 xxxx xxxx xxxx 0001 xxxx */
1045 if ((insn & 0x0ff000d0) == 0x01200010) {
1046 asi->insn[0] = truecc_insn(insn);
1047 asi->insn_handler = simulate_blx2bx;
1048 return INSN_GOOD;
1049 }
1050
1051 /* CLZ : cccc 0001 0110 xxxx xxxx xxxx 0001 xxxx */
1052 if ((insn & 0x0ff000f0) == 0x01600010)
1053 return prep_emulate_rd12rm0(insn, asi);
1054
1055 /* QADD : cccc 0001 0000 xxxx xxxx xxxx 0101 xxxx :Q */
1056 /* QSUB : cccc 0001 0010 xxxx xxxx xxxx 0101 xxxx :Q */
1057 /* QDADD : cccc 0001 0100 xxxx xxxx xxxx 0101 xxxx :Q */
1058 /* QDSUB : cccc 0001 0110 xxxx xxxx xxxx 0101 xxxx :Q */
1059 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1060 }
1061
1062 /* cccc 0000 xxxx xxxx xxxx xxxx xxxx 1001 xxxx */
1063 else if ((insn & 0x0f000090) == 0x00000090) {
1064
1065 /* MUL : cccc 0000 0000 xxxx xxxx xxxx 1001 xxxx : */
1066 /* MULS : cccc 0000 0001 xxxx xxxx xxxx 1001 xxxx :cc */
1067 /* MLA : cccc 0000 0010 xxxx xxxx xxxx 1001 xxxx : */
1068 /* MLAS : cccc 0000 0011 xxxx xxxx xxxx 1001 xxxx :cc */
1069 /* UMAAL : cccc 0000 0100 xxxx xxxx xxxx 1001 xxxx : */
1070 /* UMULL : cccc 0000 1000 xxxx xxxx xxxx 1001 xxxx : */
1071 /* UMULLS : cccc 0000 1001 xxxx xxxx xxxx 1001 xxxx :cc */
1072 /* UMLAL : cccc 0000 1010 xxxx xxxx xxxx 1001 xxxx : */
1073 /* UMLALS : cccc 0000 1011 xxxx xxxx xxxx 1001 xxxx :cc */
1074 /* SMULL : cccc 0000 1100 xxxx xxxx xxxx 1001 xxxx : */
1075 /* SMULLS : cccc 0000 1101 xxxx xxxx xxxx 1001 xxxx :cc */
1076 /* SMLAL : cccc 0000 1110 xxxx xxxx xxxx 1001 xxxx : */
1077 /* SMLALS : cccc 0000 1111 xxxx xxxx xxxx 1001 xxxx :cc */
1078 if ((insn & 0x0fe000f0) == 0x00000090) {
1079 return prep_emulate_rd16rs8rm0_wflags(insn, asi);
1080 } else if ((insn & 0x0fe000f0) == 0x00200090) {
1081 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1082 } else {
1083 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi);
1084 }
1085 }
1086
1087 /* cccc 000x xxxx xxxx xxxx xxxx xxxx 1xx1 xxxx */
1088 else if ((insn & 0x0e000090) == 0x00000090) {
1089
1090 /* SWP : cccc 0001 0000 xxxx xxxx xxxx 1001 xxxx */
1091 /* SWPB : cccc 0001 0100 xxxx xxxx xxxx 1001 xxxx */
1092 /* LDRD : cccc 000x xxx0 xxxx xxxx xxxx 1101 xxxx */
1093 /* STRD : cccc 000x xxx0 xxxx xxxx xxxx 1111 xxxx */
1094 /* STREX : cccc 0001 1000 xxxx xxxx xxxx 1001 xxxx */
1095 /* LDREX : cccc 0001 1001 xxxx xxxx xxxx 1001 xxxx */
1096 /* LDRH : cccc 000x xxx1 xxxx xxxx xxxx 1011 xxxx */
1097 /* STRH : cccc 000x xxx0 xxxx xxxx xxxx 1011 xxxx */
1098 /* LDRSB : cccc 000x xxx1 xxxx xxxx xxxx 1101 xxxx */
1099 /* LDRSH : cccc 000x xxx1 xxxx xxxx xxxx 1111 xxxx */
1100 if ((insn & 0x0fb000f0) == 0x01000090) {
1101 /* SWP/SWPB */
1102 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1103 } else if ((insn & 0x0e1000d0) == 0x00000d0) {
1104 /* STRD/LDRD */
1105 insn &= 0xfff00fff;
1106 insn |= 0x00002000; /* Rn = r0, Rd = r2 */
1107 if (insn & (1 << 22)) {
1108 /* I bit */
1109 insn &= ~0xf;
1110 insn |= 1; /* Rm = r1 */
1111 }
1112 asi->insn[0] = insn;
1113 asi->insn_handler =
1114 (insn & (1 << 5)) ? emulate_strd : emulate_ldrd;
1115 return INSN_GOOD;
1116 }
1117
1118 return prep_emulate_ldr_str(insn, asi);
1119 }
1120
1121 /* cccc 000x xxxx xxxx xxxx xxxx xxxx xxxx xxxx */
1122
1123 /*
1124 * ALU op with S bit and Rd == 15 :
1125 * cccc 000x xxx1 xxxx 1111 xxxx xxxx xxxx
1126 */
1127 if ((insn & 0x0e10f000) == 0x0010f000)
1128 return INSN_REJECTED;
1129
1130 /*
1131 * "mov ip, sp" is the most common kprobe'd instruction by far.
1132 * Check and optimize for it explicitly.
1133 */
1134 if (insn == 0xe1a0c00d) {
1135 asi->insn_handler = simulate_mov_ipsp;
1136 return INSN_GOOD_NO_SLOT;
1137 }
1138
1139 /*
1140 * Data processing: Immediate-shift / Register-shift
1141 * ALU op : cccc 000x xxxx xxxx xxxx xxxx xxxx xxxx
1142 * CPY : cccc 0001 1010 xxxx xxxx 0000 0000 xxxx
1143 * MOV : cccc 0001 101x xxxx xxxx xxxx xxxx xxxx
1144 * *S (bit 20) updates condition codes
1145 * ADC/SBC/RSC reads the C flag
1146 */
1147 insn &= 0xfff00ff0; /* Rn = r0, Rd = r0 */
1148 insn |= 0x00000001; /* Rm = r1 */
1149 if (insn & 0x010) {
1150 insn &= 0xfffff0ff; /* register shift */
1151 insn |= 0x00000200; /* Rs = r2 */
1152 }
1153 asi->insn[0] = insn;
1154 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */
1155 emulate_alu_rwflags : emulate_alu_rflags;
1156 return INSN_GOOD;
1157}
1158
1159static enum kprobe_insn __kprobes
1160space_cccc_001x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1161{
1162 /*
1163 * MSR : cccc 0011 0x10 xxxx xxxx xxxx xxxx xxxx
1164 * Undef : cccc 0011 0x00 xxxx xxxx xxxx xxxx xxxx
1165 * ALU op with S bit and Rd == 15 :
1166 * cccc 001x xxx1 xxxx 1111 xxxx xxxx xxxx
1167 */
1168 if ((insn & 0x0f900000) == 0x03200000 || /* MSR & Undef */
1169 (insn & 0x0e10f000) == 0x0210f000) /* ALU s-bit, R15 */
1170 return INSN_REJECTED;
1171
1172 /*
1173 * Data processing: 32-bit Immediate
1174 * ALU op : cccc 001x xxxx xxxx xxxx xxxx xxxx xxxx
1175 * MOV : cccc 0011 101x xxxx xxxx xxxx xxxx xxxx
1176 * *S (bit 20) updates condition codes
1177 * ADC/SBC/RSC reads the C flag
1178 */
1179 insn &= 0xfff00ff0; /* Rn = r0, Rd = r0 */
1180 asi->insn[0] = insn;
1181 asi->insn_handler = (insn & (1 << 20)) ? /* S-bit */
1182 emulate_alu_imm_rwflags : emulate_alu_imm_rflags;
1183 return INSN_GOOD;
1184}
1185
1186static enum kprobe_insn __kprobes
1187space_cccc_0110__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1188{
1189 /* SEL : cccc 0110 1000 xxxx xxxx xxxx 1011 xxxx GE: !!! */
1190 if ((insn & 0x0ff000f0) == 0x068000b0) {
1191 insn &= 0xfff00ff0; /* Rd = r0, Rn = r0 */
1192 insn |= 0x00000001; /* Rm = r1 */
1193 asi->insn[0] = insn;
1194 asi->insn_handler = emulate_sel;
1195 return INSN_GOOD;
1196 }
1197
1198 /* SSAT : cccc 0110 101x xxxx xxxx xxxx xx01 xxxx :Q */
1199 /* USAT : cccc 0110 111x xxxx xxxx xxxx xx01 xxxx :Q */
1200 /* SSAT16 : cccc 0110 1010 xxxx xxxx xxxx 0011 xxxx :Q */
1201 /* USAT16 : cccc 0110 1110 xxxx xxxx xxxx 0011 xxxx :Q */
1202 if ((insn & 0x0fa00030) == 0x06a00010 ||
1203 (insn & 0x0fb000f0) == 0x06a00030) {
1204 insn &= 0xffff0ff0; /* Rd = r0, Rm = r0 */
1205 asi->insn[0] = insn;
1206 asi->insn_handler = emulate_sat;
1207 return INSN_GOOD;
1208 }
1209
1210 /* REV : cccc 0110 1011 xxxx xxxx xxxx 0011 xxxx */
1211 /* REV16 : cccc 0110 1011 xxxx xxxx xxxx 1011 xxxx */
1212 /* REVSH : cccc 0110 1111 xxxx xxxx xxxx 1011 xxxx */
1213 if ((insn & 0x0ff00070) == 0x06b00030 ||
1214 (insn & 0x0ff000f0) == 0x06f000b0)
1215 return prep_emulate_rd12rm0(insn, asi);
1216
1217 /* SADD16 : cccc 0110 0001 xxxx xxxx xxxx 0001 xxxx :GE */
1218 /* SADDSUBX : cccc 0110 0001 xxxx xxxx xxxx 0011 xxxx :GE */
1219 /* SSUBADDX : cccc 0110 0001 xxxx xxxx xxxx 0101 xxxx :GE */
1220 /* SSUB16 : cccc 0110 0001 xxxx xxxx xxxx 0111 xxxx :GE */
1221 /* SADD8 : cccc 0110 0001 xxxx xxxx xxxx 1001 xxxx :GE */
1222 /* SSUB8 : cccc 0110 0001 xxxx xxxx xxxx 1111 xxxx :GE */
1223 /* QADD16 : cccc 0110 0010 xxxx xxxx xxxx 0001 xxxx : */
1224 /* QADDSUBX : cccc 0110 0010 xxxx xxxx xxxx 0011 xxxx : */
1225 /* QSUBADDX : cccc 0110 0010 xxxx xxxx xxxx 0101 xxxx : */
1226 /* QSUB16 : cccc 0110 0010 xxxx xxxx xxxx 0111 xxxx : */
1227 /* QADD8 : cccc 0110 0010 xxxx xxxx xxxx 1001 xxxx : */
1228 /* QSUB8 : cccc 0110 0010 xxxx xxxx xxxx 1111 xxxx : */
1229 /* SHADD16 : cccc 0110 0011 xxxx xxxx xxxx 0001 xxxx : */
1230 /* SHADDSUBX : cccc 0110 0011 xxxx xxxx xxxx 0011 xxxx : */
1231 /* SHSUBADDX : cccc 0110 0011 xxxx xxxx xxxx 0101 xxxx : */
1232 /* SHSUB16 : cccc 0110 0011 xxxx xxxx xxxx 0111 xxxx : */
1233 /* SHADD8 : cccc 0110 0011 xxxx xxxx xxxx 1001 xxxx : */
1234 /* SHSUB8 : cccc 0110 0011 xxxx xxxx xxxx 1111 xxxx : */
1235 /* UADD16 : cccc 0110 0101 xxxx xxxx xxxx 0001 xxxx :GE */
1236 /* UADDSUBX : cccc 0110 0101 xxxx xxxx xxxx 0011 xxxx :GE */
1237 /* USUBADDX : cccc 0110 0101 xxxx xxxx xxxx 0101 xxxx :GE */
1238 /* USUB16 : cccc 0110 0101 xxxx xxxx xxxx 0111 xxxx :GE */
1239 /* UADD8 : cccc 0110 0101 xxxx xxxx xxxx 1001 xxxx :GE */
1240 /* USUB8 : cccc 0110 0101 xxxx xxxx xxxx 1111 xxxx :GE */
1241 /* UQADD16 : cccc 0110 0110 xxxx xxxx xxxx 0001 xxxx : */
1242 /* UQADDSUBX : cccc 0110 0110 xxxx xxxx xxxx 0011 xxxx : */
1243 /* UQSUBADDX : cccc 0110 0110 xxxx xxxx xxxx 0101 xxxx : */
1244 /* UQSUB16 : cccc 0110 0110 xxxx xxxx xxxx 0111 xxxx : */
1245 /* UQADD8 : cccc 0110 0110 xxxx xxxx xxxx 1001 xxxx : */
1246 /* UQSUB8 : cccc 0110 0110 xxxx xxxx xxxx 1111 xxxx : */
1247 /* UHADD16 : cccc 0110 0111 xxxx xxxx xxxx 0001 xxxx : */
1248 /* UHADDSUBX : cccc 0110 0111 xxxx xxxx xxxx 0011 xxxx : */
1249 /* UHSUBADDX : cccc 0110 0111 xxxx xxxx xxxx 0101 xxxx : */
1250 /* UHSUB16 : cccc 0110 0111 xxxx xxxx xxxx 0111 xxxx : */
1251 /* UHADD8 : cccc 0110 0111 xxxx xxxx xxxx 1001 xxxx : */
1252 /* UHSUB8 : cccc 0110 0111 xxxx xxxx xxxx 1111 xxxx : */
1253 /* PKHBT : cccc 0110 1000 xxxx xxxx xxxx x001 xxxx : */
1254 /* PKHTB : cccc 0110 1000 xxxx xxxx xxxx x101 xxxx : */
1255 /* SXTAB16 : cccc 0110 1000 xxxx xxxx xxxx 0111 xxxx : */
1256 /* SXTB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
1257 /* SXTAB : cccc 0110 1010 xxxx xxxx xxxx 0111 xxxx : */
1258 /* SXTAH : cccc 0110 1011 xxxx xxxx xxxx 0111 xxxx : */
1259 /* UXTAB16 : cccc 0110 1100 xxxx xxxx xxxx 0111 xxxx : */
1260 /* UXTAB : cccc 0110 1110 xxxx xxxx xxxx 0111 xxxx : */
1261 /* UXTAH : cccc 0110 1111 xxxx xxxx xxxx 0111 xxxx : */
1262 return prep_emulate_rd12rn16rm0_wflags(insn, asi);
1263}
1264
1265static enum kprobe_insn __kprobes
1266space_cccc_0111__1(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1267{
1268 /* Undef : cccc 0111 1111 xxxx xxxx xxxx 1111 xxxx */
1269 if ((insn & 0x0ff000f0) == 0x03f000f0)
1270 return INSN_REJECTED;
1271
1272 /* USADA8 : cccc 0111 1000 xxxx xxxx xxxx 0001 xxxx */
1273 /* USAD8 : cccc 0111 1000 xxxx 1111 xxxx 0001 xxxx */
1274 if ((insn & 0x0ff000f0) == 0x07800010)
1275 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1276
1277 /* SMLALD : cccc 0111 0100 xxxx xxxx xxxx 00x1 xxxx */
1278 /* SMLSLD : cccc 0111 0100 xxxx xxxx xxxx 01x1 xxxx */
1279 if ((insn & 0x0ff00090) == 0x07400010)
1280 return prep_emulate_rdhi16rdlo12rs8rm0_wflags(insn, asi);
1281
1282 /* SMLAD : cccc 0111 0000 xxxx xxxx xxxx 00x1 xxxx :Q */
1283 /* SMLSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx :Q */
1284 /* SMMLA : cccc 0111 0101 xxxx xxxx xxxx 00x1 xxxx : */
1285 /* SMMLS : cccc 0111 0101 xxxx xxxx xxxx 11x1 xxxx : */
1286 if ((insn & 0x0ff00090) == 0x07000010 ||
1287 (insn & 0x0ff000d0) == 0x07500010 ||
1288 (insn & 0x0ff000d0) == 0x075000d0)
1289 return prep_emulate_rd16rn12rs8rm0_wflags(insn, asi);
1290
1291 /* SMUSD : cccc 0111 0000 xxxx xxxx xxxx 01x1 xxxx : */
1292 /* SMUAD : cccc 0111 0000 xxxx 1111 xxxx 00x1 xxxx :Q */
1293 /* SMMUL : cccc 0111 0101 xxxx 1111 xxxx 00x1 xxxx : */
1294 return prep_emulate_rd16rs8rm0_wflags(insn, asi);
1295}
1296
1297static enum kprobe_insn __kprobes
1298space_cccc_01xx(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1299{
1300 /* LDR : cccc 01xx x0x1 xxxx xxxx xxxx xxxx xxxx */
1301 /* LDRB : cccc 01xx x1x1 xxxx xxxx xxxx xxxx xxxx */
1302 /* LDRBT : cccc 01x0 x111 xxxx xxxx xxxx xxxx xxxx */
1303 /* LDRT : cccc 01x0 x011 xxxx xxxx xxxx xxxx xxxx */
1304 /* STR : cccc 01xx x0x0 xxxx xxxx xxxx xxxx xxxx */
1305 /* STRB : cccc 01xx x1x0 xxxx xxxx xxxx xxxx xxxx */
1306 /* STRBT : cccc 01x0 x110 xxxx xxxx xxxx xxxx xxxx */
1307 /* STRT : cccc 01x0 x010 xxxx xxxx xxxx xxxx xxxx */
1308 return prep_emulate_ldr_str(insn, asi);
1309}
1310
1311static enum kprobe_insn __kprobes
1312space_cccc_100x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1313{
1314 /* LDM(2) : cccc 100x x101 xxxx 0xxx xxxx xxxx xxxx */
1315 /* LDM(3) : cccc 100x x1x1 xxxx 1xxx xxxx xxxx xxxx */
1316 if ((insn & 0x0e708000) == 0x85000000 ||
1317 (insn & 0x0e508000) == 0x85010000)
1318 return INSN_REJECTED;
1319
1320 /* LDM(1) : cccc 100x x0x1 xxxx xxxx xxxx xxxx xxxx */
1321 /* STM(1) : cccc 100x x0x0 xxxx xxxx xxxx xxxx xxxx */
1322 asi->insn[0] = truecc_insn(insn);
1323 asi->insn_handler = ((insn & 0x108000) == 0x008000) ? /* STM & R15 */
1324 simulate_stm1_pc : simulate_ldm1stm1;
1325 return INSN_GOOD;
1326}
1327
1328static enum kprobe_insn __kprobes
1329space_cccc_101x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1330{
1331 /* B : cccc 1010 xxxx xxxx xxxx xxxx xxxx xxxx */
1332 /* BL : cccc 1011 xxxx xxxx xxxx xxxx xxxx xxxx */
1333 asi->insn[0] = truecc_insn(insn);
1334 asi->insn_handler = simulate_bbl;
1335 return INSN_GOOD;
1336}
1337
1338static enum kprobe_insn __kprobes
1339space_cccc_1100_010x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1340{
1341 /* MCRR : cccc 1100 0100 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */
1342 /* MRRC : cccc 1100 0101 xxxx xxxx xxxx xxxx xxxx : (Rd!=Rn) */
1343 insn &= 0xfff00fff;
1344 insn |= 0x00001000; /* Rn = r0, Rd = r1 */
1345 asi->insn[0] = insn;
1346 asi->insn_handler = (insn & (1 << 20)) ? emulate_mrrc : emulate_mcrr;
1347 return INSN_GOOD;
1348}
1349
1350static enum kprobe_insn __kprobes
1351space_cccc_110x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1352{
1353 /* LDC : cccc 110x xxx1 xxxx xxxx xxxx xxxx xxxx */
1354 /* STC : cccc 110x xxx0 xxxx xxxx xxxx xxxx xxxx */
1355 insn &= 0xfff0ffff; /* Rn = r0 */
1356 asi->insn[0] = insn;
1357 asi->insn_handler = emulate_ldcstc;
1358 return INSN_GOOD;
1359}
1360
1361static enum kprobe_insn __kprobes
1362space_cccc_111x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1363{
1364 /* BKPT : 1110 0001 0010 xxxx xxxx xxxx 0111 xxxx */
1365 /* SWI : cccc 1111 xxxx xxxx xxxx xxxx xxxx xxxx */
1366 if ((insn & 0xfff000f0) == 0xe1200070 ||
1367 (insn & 0x0f000000) == 0x0f000000)
1368 return INSN_REJECTED;
1369
1370 /* CDP : cccc 1110 xxxx xxxx xxxx xxxx xxx0 xxxx */
1371 if ((insn & 0x0f000010) == 0x0e000000) {
1372 asi->insn[0] = insn;
1373 asi->insn_handler = emulate_none;
1374 return INSN_GOOD;
1375 }
1376
1377 /* MCR : cccc 1110 xxx0 xxxx xxxx xxxx xxx1 xxxx */
1378 /* MRC : cccc 1110 xxx1 xxxx xxxx xxxx xxx1 xxxx */
1379 insn &= 0xffff0fff; /* Rd = r0 */
1380 asi->insn[0] = insn;
1381 asi->insn_handler = (insn & (1 << 20)) ? emulate_rd12 : emulate_ird12;
1382 return INSN_GOOD;
1383}
1384
1385/* Return:
1386 * INSN_REJECTED If instruction is one not allowed to kprobe,
1387 * INSN_GOOD If instruction is supported and uses instruction slot,
1388 * INSN_GOOD_NO_SLOT If instruction is supported but doesn't use its slot.
1389 *
1390 * For instructions we don't want to kprobe (INSN_REJECTED return result):
1391 * These are generally ones that modify the processor state making
1392 * them "hard" to simulate such as switches processor modes or
1393 * make accesses in alternate modes. Any of these could be simulated
1394 * if the work was put into it, but low return considering they
1395 * should also be very rare.
1396 */
1397enum kprobe_insn __kprobes
1398arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1399{
1400 asi->insn[1] = KPROBE_RETURN_INSTRUCTION;
1401
1402 if ((insn & 0xf0000000) == 0xf0000000) {
1403
1404 return space_1111(insn, asi);
1405
1406 } else if ((insn & 0x0e000000) == 0x00000000) {
1407
1408 return space_cccc_000x(insn, asi);
1409
1410 } else if ((insn & 0x0e000000) == 0x02000000) {
1411
1412 return space_cccc_001x(insn, asi);
1413
1414 } else if ((insn & 0x0f000010) == 0x06000010) {
1415
1416 return space_cccc_0110__1(insn, asi);
1417
1418 } else if ((insn & 0x0f000010) == 0x07000010) {
1419
1420 return space_cccc_0111__1(insn, asi);
1421
1422 } else if ((insn & 0x0c000000) == 0x04000000) {
1423
1424 return space_cccc_01xx(insn, asi);
1425
1426 } else if ((insn & 0x0e000000) == 0x08000000) {
1427
1428 return space_cccc_100x(insn, asi);
1429
1430 } else if ((insn & 0x0e000000) == 0x0a000000) {
1431
1432 return space_cccc_101x(insn, asi);
1433
1434 } else if ((insn & 0x0fe00000) == 0x0c400000) {
1435
1436 return space_cccc_1100_010x(insn, asi);
1437
1438 } else if ((insn & 0x0e000000) == 0x0c400000) {
1439
1440 return space_cccc_110x(insn, asi);
1441
1442 }
1443
1444 return space_cccc_111x(insn, asi);
1445}
1446
1447void __init arm_kprobe_decode_init(void)
1448{
1449 find_str_pc_offset();
1450}
1451
1452
1453/*
1454 * All ARM instructions listed below.
1455 *
1456 * Instructions and their general purpose registers are given.
1457 * If a particular register may not use R15, it is prefixed with a "!".
1458 * If marked with a "*" means the value returned by reading R15
1459 * is implementation defined.
1460 *
1461 * ADC/ADD/AND/BIC/CMN/CMP/EOR/MOV/MVN/ORR/RSB/RSC/SBC/SUB/TEQ
1462 * TST: Rd, Rn, Rm, !Rs
1463 * BX: Rm
1464 * BLX(2): !Rm
1465 * BX: Rm (R15 legal, but discouraged)
1466 * BXJ: !Rm,
1467 * CLZ: !Rd, !Rm
1468 * CPY: Rd, Rm
1469 * LDC/2,STC/2 immediate offset & unindex: Rn
1470 * LDC/2,STC/2 immediate pre/post-indexed: !Rn
1471 * LDM(1/3): !Rn, register_list
1472 * LDM(2): !Rn, !register_list
1473 * LDR,STR,PLD immediate offset: Rd, Rn
1474 * LDR,STR,PLD register offset: Rd, Rn, !Rm
1475 * LDR,STR,PLD scaled register offset: Rd, !Rn, !Rm
1476 * LDR,STR immediate pre/post-indexed: Rd, !Rn
1477 * LDR,STR register pre/post-indexed: Rd, !Rn, !Rm
1478 * LDR,STR scaled register pre/post-indexed: Rd, !Rn, !Rm
1479 * LDRB,STRB immediate offset: !Rd, Rn
1480 * LDRB,STRB register offset: !Rd, Rn, !Rm
1481 * LDRB,STRB scaled register offset: !Rd, !Rn, !Rm
1482 * LDRB,STRB immediate pre/post-indexed: !Rd, !Rn
1483 * LDRB,STRB register pre/post-indexed: !Rd, !Rn, !Rm
1484 * LDRB,STRB scaled register pre/post-indexed: !Rd, !Rn, !Rm
1485 * LDRT,LDRBT,STRBT immediate pre/post-indexed: !Rd, !Rn
1486 * LDRT,LDRBT,STRBT register pre/post-indexed: !Rd, !Rn, !Rm
1487 * LDRT,LDRBT,STRBT scaled register pre/post-indexed: !Rd, !Rn, !Rm
1488 * LDRH/SH/SB/D,STRH/SH/SB/D immediate offset: !Rd, Rn
1489 * LDRH/SH/SB/D,STRH/SH/SB/D register offset: !Rd, Rn, !Rm
1490 * LDRH/SH/SB/D,STRH/SH/SB/D immediate pre/post-indexed: !Rd, !Rn
1491 * LDRH/SH/SB/D,STRH/SH/SB/D register pre/post-indexed: !Rd, !Rn, !Rm
1492 * LDREX: !Rd, !Rn
1493 * MCR/2: !Rd
1494 * MCRR/2,MRRC/2: !Rd, !Rn
1495 * MLA: !Rd, !Rn, !Rm, !Rs
1496 * MOV: Rd
1497 * MRC/2: !Rd (if Rd==15, only changes cond codes, not the register)
1498 * MRS,MSR: !Rd
1499 * MUL: !Rd, !Rm, !Rs
1500 * PKH{BT,TB}: !Rd, !Rn, !Rm
1501 * QDADD,[U]QADD/16/8/SUBX: !Rd, !Rm, !Rn
1502 * QDSUB,[U]QSUB/16/8/ADDX: !Rd, !Rm, !Rn
1503 * REV/16/SH: !Rd, !Rm
1504 * RFE: !Rn
1505 * {S,U}[H]ADD{16,8,SUBX},{S,U}[H]SUB{16,8,ADDX}: !Rd, !Rn, !Rm
1506 * SEL: !Rd, !Rn, !Rm
1507 * SMLA<x><y>,SMLA{D,W<y>},SMLSD,SMML{A,S}: !Rd, !Rn, !Rm, !Rs
1508 * SMLAL<x><y>,SMLA{D,LD},SMLSLD,SMMULL,SMULW<y>: !RdHi, !RdLo, !Rm, !Rs
1509 * SMMUL,SMUAD,SMUL<x><y>,SMUSD: !Rd, !Rm, !Rs
1510 * SSAT/16: !Rd, !Rm
1511 * STM(1/2): !Rn, register_list* (R15 in reg list not recommended)
1512 * STRT immediate pre/post-indexed: Rd*, !Rn
1513 * STRT register pre/post-indexed: Rd*, !Rn, !Rm
1514 * STRT scaled register pre/post-indexed: Rd*, !Rn, !Rm
1515 * STREX: !Rd, !Rn, !Rm
1516 * SWP/B: !Rd, !Rn, !Rm
1517 * {S,U}XTA{B,B16,H}: !Rd, !Rn, !Rm
1518 * {S,U}XT{B,B16,H}: !Rd, !Rm
1519 * UM{AA,LA,UL}L: !RdHi, !RdLo, !Rm, !Rs
1520 * USA{D8,A8,T,T16}: !Rd, !Rm, !Rs
1521 *
1522 * May transfer control by writing R15 (possible mode changes or alternate
1523 * mode accesses marked by "*"):
1524 * ALU op (* with s-bit), B, BL, BKPT, BLX(1/2), BX, BXJ, CPS*, CPY,
1525 * LDM(1), LDM(2/3)*, LDR, MOV, RFE*, SWI*
1526 *
1527 * Instructions that do not take general registers, nor transfer control:
1528 * CDP/2, SETEND, SRS*
1529 */
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
new file mode 100644
index 000000000000..a22a98c43ca5
--- /dev/null
+++ b/arch/arm/kernel/kprobes.c
@@ -0,0 +1,447 @@
1/*
2 * arch/arm/kernel/kprobes.c
3 *
4 * Kprobes on ARM
5 *
6 * Abhishek Sagar <sagar.abhishek@gmail.com>
7 * Copyright (C) 2006, 2007 Motorola Inc.
8 *
9 * Nicolas Pitre <nico@marvell.com>
10 * Copyright (C) 2007 Marvell Ltd.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 */
21
22#include <linux/kernel.h>
23#include <linux/kprobes.h>
24#include <linux/module.h>
25#include <linux/stringify.h>
26#include <asm/traps.h>
27#include <asm/cacheflush.h>
28
29#define MIN_STACK_SIZE(addr) \
30 min((unsigned long)MAX_STACK_SIZE, \
31 (unsigned long)current_thread_info() + THREAD_START_SP - (addr))
32
33#define flush_insns(addr, cnt) \
34 flush_icache_range((unsigned long)(addr), \
35 (unsigned long)(addr) + \
36 sizeof(kprobe_opcode_t) * (cnt))
37
38/* Used as a marker in ARM_pc to note when we're in a jprobe. */
39#define JPROBE_MAGIC_ADDR 0xffffffff
40
41DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
42DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
43
44
45int __kprobes arch_prepare_kprobe(struct kprobe *p)
46{
47 kprobe_opcode_t insn;
48 kprobe_opcode_t tmp_insn[MAX_INSN_SIZE];
49 unsigned long addr = (unsigned long)p->addr;
50 int is;
51
52 if (addr & 0x3 || in_exception_text(addr))
53 return -EINVAL;
54
55 insn = *p->addr;
56 p->opcode = insn;
57 p->ainsn.insn = tmp_insn;
58
59 switch (arm_kprobe_decode_insn(insn, &p->ainsn)) {
60 case INSN_REJECTED: /* not supported */
61 return -EINVAL;
62
63 case INSN_GOOD: /* instruction uses slot */
64 p->ainsn.insn = get_insn_slot();
65 if (!p->ainsn.insn)
66 return -ENOMEM;
67 for (is = 0; is < MAX_INSN_SIZE; ++is)
68 p->ainsn.insn[is] = tmp_insn[is];
69 flush_insns(&p->ainsn.insn, MAX_INSN_SIZE);
70 break;
71
72 case INSN_GOOD_NO_SLOT: /* instruction doesn't need insn slot */
73 p->ainsn.insn = NULL;
74 break;
75 }
76
77 return 0;
78}
79
80void __kprobes arch_arm_kprobe(struct kprobe *p)
81{
82 *p->addr = KPROBE_BREAKPOINT_INSTRUCTION;
83 flush_insns(p->addr, 1);
84}
85
86void __kprobes arch_disarm_kprobe(struct kprobe *p)
87{
88 *p->addr = p->opcode;
89 flush_insns(p->addr, 1);
90}
91
92void __kprobes arch_remove_kprobe(struct kprobe *p)
93{
94 if (p->ainsn.insn) {
95 mutex_lock(&kprobe_mutex);
96 free_insn_slot(p->ainsn.insn, 0);
97 mutex_unlock(&kprobe_mutex);
98 p->ainsn.insn = NULL;
99 }
100}
101
102static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
103{
104 kcb->prev_kprobe.kp = kprobe_running();
105 kcb->prev_kprobe.status = kcb->kprobe_status;
106}
107
108static void __kprobes restore_previous_kprobe(struct kprobe_ctlblk *kcb)
109{
110 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
111 kcb->kprobe_status = kcb->prev_kprobe.status;
112}
113
114static void __kprobes set_current_kprobe(struct kprobe *p)
115{
116 __get_cpu_var(current_kprobe) = p;
117}
118
119static void __kprobes singlestep(struct kprobe *p, struct pt_regs *regs,
120 struct kprobe_ctlblk *kcb)
121{
122 regs->ARM_pc += 4;
123 p->ainsn.insn_handler(p, regs);
124}
125
126/*
127 * Called with IRQs disabled. IRQs must remain disabled from that point
128 * all the way until processing this kprobe is complete. The current
129 * kprobes implementation cannot process more than one nested level of
130 * kprobe, and that level is reserved for user kprobe handlers, so we can't
131 * risk encountering a new kprobe in an interrupt handler.
132 */
133void __kprobes kprobe_handler(struct pt_regs *regs)
134{
135 struct kprobe *p, *cur;
136 struct kprobe_ctlblk *kcb;
137 kprobe_opcode_t *addr = (kprobe_opcode_t *)regs->ARM_pc;
138
139 kcb = get_kprobe_ctlblk();
140 cur = kprobe_running();
141 p = get_kprobe(addr);
142
143 if (p) {
144 if (cur) {
145 /* Kprobe is pending, so we're recursing. */
146 switch (kcb->kprobe_status) {
147 case KPROBE_HIT_ACTIVE:
148 case KPROBE_HIT_SSDONE:
149 /* A pre- or post-handler probe got us here. */
150 kprobes_inc_nmissed_count(p);
151 save_previous_kprobe(kcb);
152 set_current_kprobe(p);
153 kcb->kprobe_status = KPROBE_REENTER;
154 singlestep(p, regs, kcb);
155 restore_previous_kprobe(kcb);
156 break;
157 default:
158 /* impossible cases */
159 BUG();
160 }
161 } else {
162 set_current_kprobe(p);
163 kcb->kprobe_status = KPROBE_HIT_ACTIVE;
164
165 /*
166 * If we have no pre-handler or it returned 0, we
167 * continue with normal processing. If we have a
168 * pre-handler and it returned non-zero, it prepped
169 * for calling the break_handler below on re-entry,
170 * so get out doing nothing more here.
171 */
172 if (!p->pre_handler || !p->pre_handler(p, regs)) {
173 kcb->kprobe_status = KPROBE_HIT_SS;
174 singlestep(p, regs, kcb);
175 if (p->post_handler) {
176 kcb->kprobe_status = KPROBE_HIT_SSDONE;
177 p->post_handler(p, regs, 0);
178 }
179 reset_current_kprobe();
180 }
181 }
182 } else if (cur) {
183 /* We probably hit a jprobe. Call its break handler. */
184 if (cur->break_handler && cur->break_handler(cur, regs)) {
185 kcb->kprobe_status = KPROBE_HIT_SS;
186 singlestep(cur, regs, kcb);
187 if (cur->post_handler) {
188 kcb->kprobe_status = KPROBE_HIT_SSDONE;
189 cur->post_handler(cur, regs, 0);
190 }
191 }
192 reset_current_kprobe();
193 } else {
194 /*
195 * The probe was removed and a race is in progress.
196 * There is nothing we can do about it. Let's restart
197 * the instruction. By the time we can restart, the
198 * real instruction will be there.
199 */
200 }
201}
202
203int kprobe_trap_handler(struct pt_regs *regs, unsigned int instr)
204{
205 kprobe_handler(regs);
206 return 0;
207}
208
209int __kprobes kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr)
210{
211 struct kprobe *cur = kprobe_running();
212 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
213
214 switch (kcb->kprobe_status) {
215 case KPROBE_HIT_SS:
216 case KPROBE_REENTER:
217 /*
218 * We are here because the instruction being single
219 * stepped caused a page fault. We reset the current
220 * kprobe and the PC to point back to the probe address
221 * and allow the page fault handler to continue as a
222 * normal page fault.
223 */
224 regs->ARM_pc = (long)cur->addr;
225 if (kcb->kprobe_status == KPROBE_REENTER) {
226 restore_previous_kprobe(kcb);
227 } else {
228 reset_current_kprobe();
229 }
230 break;
231
232 case KPROBE_HIT_ACTIVE:
233 case KPROBE_HIT_SSDONE:
234 /*
235 * We increment the nmissed count for accounting,
236 * we can also use npre/npostfault count for accounting
237 * these specific fault cases.
238 */
239 kprobes_inc_nmissed_count(cur);
240
241 /*
242 * We come here because instructions in the pre/post
243 * handler caused the page_fault, this could happen
244 * if handler tries to access user space by
245 * copy_from_user(), get_user() etc. Let the
246 * user-specified handler try to fix it.
247 */
248 if (cur->fault_handler && cur->fault_handler(cur, regs, fsr))
249 return 1;
250 break;
251
252 default:
253 break;
254 }
255
256 return 0;
257}
258
259int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
260 unsigned long val, void *data)
261{
262 /*
263 * notify_die() is currently never called on ARM,
264 * so this callback is currently empty.
265 */
266 return NOTIFY_DONE;
267}
268
269/*
270 * When a retprobed function returns, trampoline_handler() is called,
271 * calling the kretprobe's handler. We construct a struct pt_regs to
272 * give a view of registers r0-r11 to the user return-handler. This is
273 * not a complete pt_regs structure, but that should be plenty sufficient
274 * for kretprobe handlers which should normally be interested in r0 only
275 * anyway.
276 */
277static void __attribute__((naked)) __kprobes kretprobe_trampoline(void)
278{
279 __asm__ __volatile__ (
280 "stmdb sp!, {r0 - r11} \n\t"
281 "mov r0, sp \n\t"
282 "bl trampoline_handler \n\t"
283 "mov lr, r0 \n\t"
284 "ldmia sp!, {r0 - r11} \n\t"
285 "mov pc, lr \n\t"
286 : : : "memory");
287}
288
289/* Called from kretprobe_trampoline */
290static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
291{
292 struct kretprobe_instance *ri = NULL;
293 struct hlist_head *head, empty_rp;
294 struct hlist_node *node, *tmp;
295 unsigned long flags, orig_ret_address = 0;
296 unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline;
297
298 INIT_HLIST_HEAD(&empty_rp);
299 spin_lock_irqsave(&kretprobe_lock, flags);
300 head = kretprobe_inst_table_head(current);
301
302 /*
303 * It is possible to have multiple instances associated with a given
304 * task either because multiple functions in the call path have
305 * a return probe installed on them, and/or more than one return
306 * probe was registered for a target function.
307 *
308 * We can handle this because:
309 * - instances are always inserted at the head of the list
310 * - when multiple return probes are registered for the same
311 * function, the first instance's ret_addr will point to the
312 * real return address, and all the rest will point to
313 * kretprobe_trampoline
314 */
315 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
316 if (ri->task != current)
317 /* another task is sharing our hash bucket */
318 continue;
319
320 if (ri->rp && ri->rp->handler) {
321 __get_cpu_var(current_kprobe) = &ri->rp->kp;
322 get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
323 ri->rp->handler(ri, regs);
324 __get_cpu_var(current_kprobe) = NULL;
325 }
326
327 orig_ret_address = (unsigned long)ri->ret_addr;
328 recycle_rp_inst(ri, &empty_rp);
329
330 if (orig_ret_address != trampoline_address)
331 /*
332 * This is the real return address. Any other
333 * instances associated with this task are for
334 * other calls deeper on the call stack
335 */
336 break;
337 }
338
339 kretprobe_assert(ri, orig_ret_address, trampoline_address);
340 spin_unlock_irqrestore(&kretprobe_lock, flags);
341
342 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
343 hlist_del(&ri->hlist);
344 kfree(ri);
345 }
346
347 return (void *)orig_ret_address;
348}
349
350/* Called with kretprobe_lock held. */
351void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
352 struct pt_regs *regs)
353{
354 ri->ret_addr = (kprobe_opcode_t *)regs->ARM_lr;
355
356 /* Replace the return addr with trampoline addr. */
357 regs->ARM_lr = (unsigned long)&kretprobe_trampoline;
358}
359
360int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
361{
362 struct jprobe *jp = container_of(p, struct jprobe, kp);
363 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
364 long sp_addr = regs->ARM_sp;
365
366 kcb->jprobe_saved_regs = *regs;
367 memcpy(kcb->jprobes_stack, (void *)sp_addr, MIN_STACK_SIZE(sp_addr));
368 regs->ARM_pc = (long)jp->entry;
369 regs->ARM_cpsr |= PSR_I_BIT;
370 preempt_disable();
371 return 1;
372}
373
374void __kprobes jprobe_return(void)
375{
376 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
377
378 __asm__ __volatile__ (
379 /*
380 * Setup an empty pt_regs. Fill SP and PC fields as
381 * they're needed by longjmp_break_handler.
382 */
383 "sub sp, %0, %1 \n\t"
384 "ldr r0, ="__stringify(JPROBE_MAGIC_ADDR)"\n\t"
385 "str %0, [sp, %2] \n\t"
386 "str r0, [sp, %3] \n\t"
387 "mov r0, sp \n\t"
388 "bl kprobe_handler \n\t"
389
390 /*
391 * Return to the context saved by setjmp_pre_handler
392 * and restored by longjmp_break_handler.
393 */
394 "ldr r0, [sp, %4] \n\t"
395 "msr cpsr_cxsf, r0 \n\t"
396 "ldmia sp, {r0 - pc} \n\t"
397 :
398 : "r" (kcb->jprobe_saved_regs.ARM_sp),
399 "I" (sizeof(struct pt_regs)),
400 "J" (offsetof(struct pt_regs, ARM_sp)),
401 "J" (offsetof(struct pt_regs, ARM_pc)),
402 "J" (offsetof(struct pt_regs, ARM_cpsr))
403 : "memory", "cc");
404}
405
406int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
407{
408 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
409 long stack_addr = kcb->jprobe_saved_regs.ARM_sp;
410 long orig_sp = regs->ARM_sp;
411 struct jprobe *jp = container_of(p, struct jprobe, kp);
412
413 if (regs->ARM_pc == JPROBE_MAGIC_ADDR) {
414 if (orig_sp != stack_addr) {
415 struct pt_regs *saved_regs =
416 (struct pt_regs *)kcb->jprobe_saved_regs.ARM_sp;
417 printk("current sp %lx does not match saved sp %lx\n",
418 orig_sp, stack_addr);
419 printk("Saved registers for jprobe %p\n", jp);
420 show_regs(saved_regs);
421 printk("Current registers\n");
422 show_regs(regs);
423 BUG();
424 }
425 *regs = kcb->jprobe_saved_regs;
426 memcpy((void *)stack_addr, kcb->jprobes_stack,
427 MIN_STACK_SIZE(stack_addr));
428 preempt_enable_no_resched();
429 return 1;
430 }
431 return 0;
432}
433
434static struct undef_hook kprobes_break_hook = {
435 .instr_mask = 0xffffffff,
436 .instr_val = KPROBE_BREAKPOINT_INSTRUCTION,
437 .cpsr_mask = MODE_MASK,
438 .cpsr_val = SVC_MODE,
439 .fn = kprobe_trap_handler,
440};
441
442int __init arch_init_kprobes()
443{
444 arm_kprobe_decode_init();
445 register_undef_hook(&kprobes_break_hook);
446 return 0;
447}
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index e59b5b84168d..b5867eca1d0b 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -325,7 +325,9 @@ void timer_tick(void)
325 profile_tick(CPU_PROFILING); 325 profile_tick(CPU_PROFILING);
326 do_leds(); 326 do_leds();
327 do_set_rtc(); 327 do_set_rtc();
328 write_seqlock(&xtime_lock);
328 do_timer(1); 329 do_timer(1);
330 write_sequnlock(&xtime_lock);
329#ifndef CONFIG_SMP 331#ifndef CONFIG_SMP
330 update_process_times(user_mode(get_irq_regs())); 332 update_process_times(user_mode(get_irq_regs()));
331#endif 333#endif
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index c34db4e868fa..5595fdd75e82 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -19,6 +19,7 @@
19#include <linux/kallsyms.h> 19#include <linux/kallsyms.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kprobes.h>
22 23
23#include <asm/atomic.h> 24#include <asm/atomic.h>
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
@@ -46,15 +47,6 @@ __setup("user_debug=", user_debug_setup);
46 47
47static void dump_mem(const char *str, unsigned long bottom, unsigned long top); 48static void dump_mem(const char *str, unsigned long bottom, unsigned long top);
48 49
49static inline int in_exception_text(unsigned long ptr)
50{
51 extern char __exception_text_start[];
52 extern char __exception_text_end[];
53
54 return ptr >= (unsigned long)&__exception_text_start &&
55 ptr < (unsigned long)&__exception_text_end;
56}
57
58void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) 50void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
59{ 51{
60#ifdef CONFIG_KALLSYMS 52#ifdef CONFIG_KALLSYMS
@@ -322,6 +314,17 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
322 get_user(instr, (u32 __user *)pc); 314 get_user(instr, (u32 __user *)pc);
323 } 315 }
324 316
317#ifdef CONFIG_KPROBES
318 /*
319 * It is possible to have recursive kprobes, so we can't call
320 * the kprobe trap handler with the undef_lock held.
321 */
322 if (instr == KPROBE_BREAKPOINT_INSTRUCTION && !user_mode(regs)) {
323 kprobe_trap_handler(regs, instr);
324 return;
325 }
326#endif
327
325 spin_lock_irqsave(&undef_lock, flags); 328 spin_lock_irqsave(&undef_lock, flags);
326 list_for_each_entry(hook, &undef_hook, node) { 329 list_for_each_entry(hook, &undef_hook, node) {
327 if ((instr & hook->instr_mask) == hook->instr_val && 330 if ((instr & hook->instr_mask) == hook->instr_val &&
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 5ff5406666b4..30f732c7fdb5 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -94,6 +94,7 @@ SECTIONS
94 TEXT_TEXT 94 TEXT_TEXT
95 SCHED_TEXT 95 SCHED_TEXT
96 LOCK_TEXT 96 LOCK_TEXT
97 KPROBES_TEXT
97#ifdef CONFIG_MMU 98#ifdef CONFIG_MMU
98 *(.fixup) 99 *(.fixup)
99#endif 100#endif
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index 0446ef2f5bd6..b016be2b0e35 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -130,13 +130,9 @@ static irqreturn_t
130aaec2000_timer_interrupt(int irq, void *dev_id) 130aaec2000_timer_interrupt(int irq, void *dev_id)
131{ 131{
132 /* TODO: Check timer accuracy */ 132 /* TODO: Check timer accuracy */
133 write_seqlock(&xtime_lock);
134
135 timer_tick(); 133 timer_tick();
136 TIMER1_CLEAR = 1; 134 TIMER1_CLEAR = 1;
137 135
138 write_sequnlock(&xtime_lock);
139
140 return IRQ_HANDLED; 136 return IRQ_HANDLED;
141} 137}
142 138
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 05a9f8a1b45e..5b0422cdde76 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -22,6 +22,9 @@ config ARCH_AT91SAM9263
22config ARCH_AT91SAM9RL 22config ARCH_AT91SAM9RL
23 bool "AT91SAM9RL" 23 bool "AT91SAM9RL"
24 24
25config ARCH_AT91CAP9
26 bool "AT91CAP9"
27
25config ARCH_AT91X40 28config ARCH_AT91X40
26 bool "AT91x40" 29 bool "AT91x40"
27 30
@@ -178,6 +181,21 @@ endif
178 181
179# ---------------------------------------------------------- 182# ----------------------------------------------------------
180 183
184if ARCH_AT91CAP9
185
186comment "AT91CAP9 Board Type"
187
188config MACH_AT91CAP9ADK
189 bool "Atmel AT91CAP9A-DK Evaluation Kit"
190 depends on ARCH_AT91CAP9
191 help
192 Select this if you are using Atmel's AT91CAP9A-DK Evaluation Kit.
193 <http://www.atmel.com/dyn/products/tools_card.asp?tool_id=4138>
194
195endif
196
197# ----------------------------------------------------------
198
181if ARCH_AT91X40 199if ARCH_AT91X40
182 200
183comment "AT91X40 Board Type" 201comment "AT91X40 Board Type"
@@ -198,13 +216,13 @@ comment "AT91 Board Options"
198 216
199config MTD_AT91_DATAFLASH_CARD 217config MTD_AT91_DATAFLASH_CARD
200 bool "Enable DataFlash Card support" 218 bool "Enable DataFlash Card support"
201 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK) 219 depends on (ARCH_AT91RM9200DK || MACH_AT91RM9200EK || MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK)
202 help 220 help
203 Enable support for the DataFlash card. 221 Enable support for the DataFlash card.
204 222
205config MTD_NAND_AT91_BUSWIDTH_16 223config MTD_NAND_AT91_BUSWIDTH_16
206 bool "Enable 16-bit data bus interface to NAND flash" 224 bool "Enable 16-bit data bus interface to NAND flash"
207 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK) 225 depends on (MACH_AT91SAM9260EK || MACH_AT91SAM9261EK || MACH_AT91SAM9263EK || MACH_AT91CAP9ADK)
208 help 226 help
209 On AT91SAM926x boards both types of NAND flash can be present 227 On AT91SAM926x boards both types of NAND flash can be present
210 (8 and 16 bit data bus width). 228 (8 and 16 bit data bus width).
@@ -219,6 +237,22 @@ config AT91_PROGRAMMABLE_CLOCKS
219 Select this if you need to program one or more of the PCK0..PCK3 237 Select this if you need to program one or more of the PCK0..PCK3
220 programmable clock outputs. 238 programmable clock outputs.
221 239
240config AT91_TIMER_HZ
241 int "Kernel HZ (jiffies per second)"
242 range 32 1024
243 depends on ARCH_AT91
244 default "128" if ARCH_AT91RM9200
245 default "100"
246 help
247 On AT91rm9200 chips where you're using a system clock derived
248 from the 32768 Hz hardware clock, this tick rate should divide
249 it exactly: use a power-of-two value, such as 128 or 256, to
250 reduce timing errors caused by rounding.
251
252 On AT91sam926x chips, or otherwise when using a higher precision
253 system clock (of at least several MHz), rounding is less of a
254 problem so it can be safer to use a decimal values like 100.
255
222endmenu 256endmenu
223 257
224endif 258endif
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index a21f08c64ea6..bf5f293dccf8 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -8,7 +8,6 @@ obj-n :=
8obj- := 8obj- :=
9 9
10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o 10obj-$(CONFIG_AT91_PMC_UNIT) += clock.o
11obj-$(CONFIG_PM) += pm.o
12 11
13# CPU-specific support 12# CPU-specific support
14obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o 13obj-$(CONFIG_ARCH_AT91RM9200) += at91rm9200.o at91rm9200_time.o at91rm9200_devices.o
@@ -16,6 +15,7 @@ obj-$(CONFIG_ARCH_AT91SAM9260) += at91sam9260.o at91sam926x_time.o at91sam9260_d
16obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o 15obj-$(CONFIG_ARCH_AT91SAM9261) += at91sam9261.o at91sam926x_time.o at91sam9261_devices.o
17obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o 16obj-$(CONFIG_ARCH_AT91SAM9263) += at91sam9263.o at91sam926x_time.o at91sam9263_devices.o
18obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o 17obj-$(CONFIG_ARCH_AT91SAM9RL) += at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o
18obj-$(CONFIG_ARCH_AT91CAP9) += at91cap9.o at91sam926x_time.o at91cap9_devices.o
19obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o 19obj-$(CONFIG_ARCH_AT91X40) += at91x40.o at91x40_time.o
20 20
21# AT91RM9200 board-specific support 21# AT91RM9200 board-specific support
@@ -29,7 +29,6 @@ obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
29obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o 29obj-$(CONFIG_MACH_ATEB9200) += board-eb9200.o
30obj-$(CONFIG_MACH_KAFA) += board-kafa.o 30obj-$(CONFIG_MACH_KAFA) += board-kafa.o
31obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o 31obj-$(CONFIG_MACH_PICOTUX2XX) += board-picotux200.o
32obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
33 32
34# AT91SAM9260 board-specific support 33# AT91SAM9260 board-specific support
35obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o 34obj-$(CONFIG_MACH_AT91SAM9260EK) += board-sam9260ek.o
@@ -43,19 +42,17 @@ obj-$(CONFIG_MACH_AT91SAM9263EK) += board-sam9263ek.o
43# AT91SAM9RL board-specific support 42# AT91SAM9RL board-specific support
44obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o 43obj-$(CONFIG_MACH_AT91SAM9RLEK) += board-sam9rlek.o
45 44
46# LEDs support 45# AT91CAP9 board-specific support
47led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o 46obj-$(CONFIG_MACH_AT91CAP9ADK) += board-cap9adk.o
48led-$(CONFIG_MACH_AT91RM9200EK) += leds.o
49led-$(CONFIG_MACH_AT91SAM9261EK)+= leds.o
50led-$(CONFIG_MACH_CSB337) += leds.o
51led-$(CONFIG_MACH_CSB637) += leds.o
52led-$(CONFIG_MACH_KB9200) += leds.o
53led-$(CONFIG_MACH_KAFA) += leds.o
54obj-$(CONFIG_LEDS) += $(led-y)
55 47
56# VGA support 48# AT91X40 board-specific support
57#obj-$(CONFIG_FB_S1D13XXX) += ics1523.o 49obj-$(CONFIG_MACH_AT91EB01) += board-eb01.o
58 50
51# Drivers
52obj-y += leds.o
53
54# Power Management
55obj-$(CONFIG_PM) += pm.o
59 56
60ifeq ($(CONFIG_PM_DEBUG),y) 57ifeq ($(CONFIG_PM_DEBUG),y)
61CFLAGS_pm.o += -DDEBUG 58CFLAGS_pm.o += -DDEBUG
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index e667dcc7cd34..071a2506a69f 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -3,7 +3,12 @@
3# PARAMS_PHYS must be within 4MB of ZRELADDR 3# PARAMS_PHYS must be within 4MB of ZRELADDR
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifeq ($(CONFIG_ARCH_AT91CAP9),y)
7 zreladdr-y := 0x70008000
8params_phys-y := 0x70000100
9initrd_phys-y := 0x70410000
10else
6 zreladdr-y := 0x20008000 11 zreladdr-y := 0x20008000
7params_phys-y := 0x20000100 12params_phys-y := 0x20000100
8initrd_phys-y := 0x20410000 13initrd_phys-y := 0x20410000
9 14endif
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
new file mode 100644
index 000000000000..48d27d8000b0
--- /dev/null
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -0,0 +1,365 @@
1/*
2 * arch/arm/mach-at91/at91cap9.c
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2007 Atmel Corporation.
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/module.h>
16
17#include <asm/mach/arch.h>
18#include <asm/mach/map.h>
19#include <asm/arch/at91cap9.h>
20#include <asm/arch/at91_pmc.h>
21#include <asm/arch/at91_rstc.h>
22
23#include "generic.h"
24#include "clock.h"
25
26static struct map_desc at91cap9_io_desc[] __initdata = {
27 {
28 .virtual = AT91_VA_BASE_SYS,
29 .pfn = __phys_to_pfn(AT91_BASE_SYS),
30 .length = SZ_16K,
31 .type = MT_DEVICE,
32 }, {
33 .virtual = AT91_IO_VIRT_BASE - AT91CAP9_SRAM_SIZE,
34 .pfn = __phys_to_pfn(AT91CAP9_SRAM_BASE),
35 .length = AT91CAP9_SRAM_SIZE,
36 .type = MT_DEVICE,
37 },
38};
39
40/* --------------------------------------------------------------------
41 * Clocks
42 * -------------------------------------------------------------------- */
43
44/*
45 * The peripheral clocks.
46 */
47static struct clk pioABCD_clk = {
48 .name = "pioABCD_clk",
49 .pmc_mask = 1 << AT91CAP9_ID_PIOABCD,
50 .type = CLK_TYPE_PERIPHERAL,
51};
52static struct clk mpb0_clk = {
53 .name = "mpb0_clk",
54 .pmc_mask = 1 << AT91CAP9_ID_MPB0,
55 .type = CLK_TYPE_PERIPHERAL,
56};
57static struct clk mpb1_clk = {
58 .name = "mpb1_clk",
59 .pmc_mask = 1 << AT91CAP9_ID_MPB1,
60 .type = CLK_TYPE_PERIPHERAL,
61};
62static struct clk mpb2_clk = {
63 .name = "mpb2_clk",
64 .pmc_mask = 1 << AT91CAP9_ID_MPB2,
65 .type = CLK_TYPE_PERIPHERAL,
66};
67static struct clk mpb3_clk = {
68 .name = "mpb3_clk",
69 .pmc_mask = 1 << AT91CAP9_ID_MPB3,
70 .type = CLK_TYPE_PERIPHERAL,
71};
72static struct clk mpb4_clk = {
73 .name = "mpb4_clk",
74 .pmc_mask = 1 << AT91CAP9_ID_MPB4,
75 .type = CLK_TYPE_PERIPHERAL,
76};
77static struct clk usart0_clk = {
78 .name = "usart0_clk",
79 .pmc_mask = 1 << AT91CAP9_ID_US0,
80 .type = CLK_TYPE_PERIPHERAL,
81};
82static struct clk usart1_clk = {
83 .name = "usart1_clk",
84 .pmc_mask = 1 << AT91CAP9_ID_US1,
85 .type = CLK_TYPE_PERIPHERAL,
86};
87static struct clk usart2_clk = {
88 .name = "usart2_clk",
89 .pmc_mask = 1 << AT91CAP9_ID_US2,
90 .type = CLK_TYPE_PERIPHERAL,
91};
92static struct clk mmc0_clk = {
93 .name = "mci0_clk",
94 .pmc_mask = 1 << AT91CAP9_ID_MCI0,
95 .type = CLK_TYPE_PERIPHERAL,
96};
97static struct clk mmc1_clk = {
98 .name = "mci1_clk",
99 .pmc_mask = 1 << AT91CAP9_ID_MCI1,
100 .type = CLK_TYPE_PERIPHERAL,
101};
102static struct clk can_clk = {
103 .name = "can_clk",
104 .pmc_mask = 1 << AT91CAP9_ID_CAN,
105 .type = CLK_TYPE_PERIPHERAL,
106};
107static struct clk twi_clk = {
108 .name = "twi_clk",
109 .pmc_mask = 1 << AT91CAP9_ID_TWI,
110 .type = CLK_TYPE_PERIPHERAL,
111};
112static struct clk spi0_clk = {
113 .name = "spi0_clk",
114 .pmc_mask = 1 << AT91CAP9_ID_SPI0,
115 .type = CLK_TYPE_PERIPHERAL,
116};
117static struct clk spi1_clk = {
118 .name = "spi1_clk",
119 .pmc_mask = 1 << AT91CAP9_ID_SPI1,
120 .type = CLK_TYPE_PERIPHERAL,
121};
122static struct clk ssc0_clk = {
123 .name = "ssc0_clk",
124 .pmc_mask = 1 << AT91CAP9_ID_SSC0,
125 .type = CLK_TYPE_PERIPHERAL,
126};
127static struct clk ssc1_clk = {
128 .name = "ssc1_clk",
129 .pmc_mask = 1 << AT91CAP9_ID_SSC1,
130 .type = CLK_TYPE_PERIPHERAL,
131};
132static struct clk ac97_clk = {
133 .name = "ac97_clk",
134 .pmc_mask = 1 << AT91CAP9_ID_AC97C,
135 .type = CLK_TYPE_PERIPHERAL,
136};
137static struct clk tcb_clk = {
138 .name = "tcb_clk",
139 .pmc_mask = 1 << AT91CAP9_ID_TCB,
140 .type = CLK_TYPE_PERIPHERAL,
141};
142static struct clk pwmc_clk = {
143 .name = "pwmc_clk",
144 .pmc_mask = 1 << AT91CAP9_ID_PWMC,
145 .type = CLK_TYPE_PERIPHERAL,
146};
147static struct clk macb_clk = {
148 .name = "macb_clk",
149 .pmc_mask = 1 << AT91CAP9_ID_EMAC,
150 .type = CLK_TYPE_PERIPHERAL,
151};
152static struct clk aestdes_clk = {
153 .name = "aestdes_clk",
154 .pmc_mask = 1 << AT91CAP9_ID_AESTDES,
155 .type = CLK_TYPE_PERIPHERAL,
156};
157static struct clk adc_clk = {
158 .name = "adc_clk",
159 .pmc_mask = 1 << AT91CAP9_ID_ADC,
160 .type = CLK_TYPE_PERIPHERAL,
161};
162static struct clk isi_clk = {
163 .name = "isi_clk",
164 .pmc_mask = 1 << AT91CAP9_ID_ISI,
165 .type = CLK_TYPE_PERIPHERAL,
166};
167static struct clk lcdc_clk = {
168 .name = "lcdc_clk",
169 .pmc_mask = 1 << AT91CAP9_ID_LCDC,
170 .type = CLK_TYPE_PERIPHERAL,
171};
172static struct clk dma_clk = {
173 .name = "dma_clk",
174 .pmc_mask = 1 << AT91CAP9_ID_DMA,
175 .type = CLK_TYPE_PERIPHERAL,
176};
177static struct clk udphs_clk = {
178 .name = "udphs_clk",
179 .pmc_mask = 1 << AT91CAP9_ID_UDPHS,
180 .type = CLK_TYPE_PERIPHERAL,
181};
182static struct clk ohci_clk = {
183 .name = "ohci_clk",
184 .pmc_mask = 1 << AT91CAP9_ID_UHP,
185 .type = CLK_TYPE_PERIPHERAL,
186};
187
188static struct clk *periph_clocks[] __initdata = {
189 &pioABCD_clk,
190 &mpb0_clk,
191 &mpb1_clk,
192 &mpb2_clk,
193 &mpb3_clk,
194 &mpb4_clk,
195 &usart0_clk,
196 &usart1_clk,
197 &usart2_clk,
198 &mmc0_clk,
199 &mmc1_clk,
200 &can_clk,
201 &twi_clk,
202 &spi0_clk,
203 &spi1_clk,
204 &ssc0_clk,
205 &ssc1_clk,
206 &ac97_clk,
207 &tcb_clk,
208 &pwmc_clk,
209 &macb_clk,
210 &aestdes_clk,
211 &adc_clk,
212 &isi_clk,
213 &lcdc_clk,
214 &dma_clk,
215 &udphs_clk,
216 &ohci_clk,
217 // irq0 .. irq1
218};
219
220/*
221 * The four programmable clocks.
222 * You must configure pin multiplexing to bring these signals out.
223 */
224static struct clk pck0 = {
225 .name = "pck0",
226 .pmc_mask = AT91_PMC_PCK0,
227 .type = CLK_TYPE_PROGRAMMABLE,
228 .id = 0,
229};
230static struct clk pck1 = {
231 .name = "pck1",
232 .pmc_mask = AT91_PMC_PCK1,
233 .type = CLK_TYPE_PROGRAMMABLE,
234 .id = 1,
235};
236static struct clk pck2 = {
237 .name = "pck2",
238 .pmc_mask = AT91_PMC_PCK2,
239 .type = CLK_TYPE_PROGRAMMABLE,
240 .id = 2,
241};
242static struct clk pck3 = {
243 .name = "pck3",
244 .pmc_mask = AT91_PMC_PCK3,
245 .type = CLK_TYPE_PROGRAMMABLE,
246 .id = 3,
247};
248
249static void __init at91cap9_register_clocks(void)
250{
251 int i;
252
253 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
254 clk_register(periph_clocks[i]);
255
256 clk_register(&pck0);
257 clk_register(&pck1);
258 clk_register(&pck2);
259 clk_register(&pck3);
260}
261
262/* --------------------------------------------------------------------
263 * GPIO
264 * -------------------------------------------------------------------- */
265
266static struct at91_gpio_bank at91cap9_gpio[] = {
267 {
268 .id = AT91CAP9_ID_PIOABCD,
269 .offset = AT91_PIOA,
270 .clock = &pioABCD_clk,
271 }, {
272 .id = AT91CAP9_ID_PIOABCD,
273 .offset = AT91_PIOB,
274 .clock = &pioABCD_clk,
275 }, {
276 .id = AT91CAP9_ID_PIOABCD,
277 .offset = AT91_PIOC,
278 .clock = &pioABCD_clk,
279 }, {
280 .id = AT91CAP9_ID_PIOABCD,
281 .offset = AT91_PIOD,
282 .clock = &pioABCD_clk,
283 }
284};
285
286static void at91cap9_reset(void)
287{
288 at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
289}
290
291/* --------------------------------------------------------------------
292 * AT91CAP9 processor initialization
293 * -------------------------------------------------------------------- */
294
295void __init at91cap9_initialize(unsigned long main_clock)
296{
297 /* Map peripherals */
298 iotable_init(at91cap9_io_desc, ARRAY_SIZE(at91cap9_io_desc));
299
300 at91_arch_reset = at91cap9_reset;
301 at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
302
303 /* Init clock subsystem */
304 at91_clock_init(main_clock);
305
306 /* Register the processor-specific clocks */
307 at91cap9_register_clocks();
308
309 /* Register GPIO subsystem */
310 at91_gpio_init(at91cap9_gpio, 4);
311}
312
313/* --------------------------------------------------------------------
314 * Interrupt initialization
315 * -------------------------------------------------------------------- */
316
317/*
318 * The default interrupt priority levels (0 = lowest, 7 = highest).
319 */
320static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = {
321 7, /* Advanced Interrupt Controller (FIQ) */
322 7, /* System Peripherals */
323 1, /* Parallel IO Controller A, B, C and D */
324 0, /* MP Block Peripheral 0 */
325 0, /* MP Block Peripheral 1 */
326 0, /* MP Block Peripheral 2 */
327 0, /* MP Block Peripheral 3 */
328 0, /* MP Block Peripheral 4 */
329 5, /* USART 0 */
330 5, /* USART 1 */
331 5, /* USART 2 */
332 0, /* Multimedia Card Interface 0 */
333 0, /* Multimedia Card Interface 1 */
334 3, /* CAN */
335 6, /* Two-Wire Interface */
336 5, /* Serial Peripheral Interface 0 */
337 5, /* Serial Peripheral Interface 1 */
338 4, /* Serial Synchronous Controller 0 */
339 4, /* Serial Synchronous Controller 1 */
340 5, /* AC97 Controller */
341 0, /* Timer Counter 0, 1 and 2 */
342 0, /* Pulse Width Modulation Controller */
343 3, /* Ethernet */
344 0, /* Advanced Encryption Standard, Triple DES*/
345 0, /* Analog-to-Digital Converter */
346 0, /* Image Sensor Interface */
347 3, /* LCD Controller */
348 0, /* DMA Controller */
349 2, /* USB Device Port */
350 2, /* USB Host port */
351 0, /* Advanced Interrupt Controller (IRQ0) */
352 0, /* Advanced Interrupt Controller (IRQ1) */
353};
354
355void __init at91cap9_init_interrupts(unsigned int priority[NR_AIC_IRQS])
356{
357 if (!priority)
358 priority = at91cap9_default_irq_priority;
359
360 /* Initialize the AIC interrupt controller */
361 at91_aic_init(priority);
362
363 /* Enable GPIO interrupts */
364 at91_gpio_irq_setup();
365}
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
new file mode 100644
index 000000000000..c50fad9cd143
--- /dev/null
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -0,0 +1,1066 @@
1/*
2 * arch/arm/mach-at91/at91cap9_devices.c
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2007 Atmel Corporation.
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14#include <asm/mach/arch.h>
15#include <asm/mach/map.h>
16
17#include <linux/dma-mapping.h>
18#include <linux/platform_device.h>
19#include <linux/mtd/physmap.h>
20
21#include <video/atmel_lcdc.h>
22
23#include <asm/arch/board.h>
24#include <asm/arch/gpio.h>
25#include <asm/arch/at91cap9.h>
26#include <asm/arch/at91sam926x_mc.h>
27#include <asm/arch/at91cap9_matrix.h>
28
29#include "generic.h"
30
31
32/* --------------------------------------------------------------------
33 * USB Host
34 * -------------------------------------------------------------------- */
35
36#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
37static u64 ohci_dmamask = DMA_BIT_MASK(32);
38static struct at91_usbh_data usbh_data;
39
40static struct resource usbh_resources[] = {
41 [0] = {
42 .start = AT91CAP9_UHP_BASE,
43 .end = AT91CAP9_UHP_BASE + SZ_1M - 1,
44 .flags = IORESOURCE_MEM,
45 },
46 [1] = {
47 .start = AT91CAP9_ID_UHP,
48 .end = AT91CAP9_ID_UHP,
49 .flags = IORESOURCE_IRQ,
50 },
51};
52
53static struct platform_device at91_usbh_device = {
54 .name = "at91_ohci",
55 .id = -1,
56 .dev = {
57 .dma_mask = &ohci_dmamask,
58 .coherent_dma_mask = DMA_BIT_MASK(32),
59 .platform_data = &usbh_data,
60 },
61 .resource = usbh_resources,
62 .num_resources = ARRAY_SIZE(usbh_resources),
63};
64
65void __init at91_add_device_usbh(struct at91_usbh_data *data)
66{
67 int i;
68
69 if (!data)
70 return;
71
72 /* Enable VBus control for UHP ports */
73 for (i = 0; i < data->ports; i++) {
74 if (data->vbus_pin[i])
75 at91_set_gpio_output(data->vbus_pin[i], 0);
76 }
77
78 usbh_data = *data;
79 platform_device_register(&at91_usbh_device);
80}
81#else
82void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
83#endif
84
85
86/* --------------------------------------------------------------------
87 * Ethernet
88 * -------------------------------------------------------------------- */
89
90#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
91static u64 eth_dmamask = DMA_BIT_MASK(32);
92static struct at91_eth_data eth_data;
93
94static struct resource eth_resources[] = {
95 [0] = {
96 .start = AT91CAP9_BASE_EMAC,
97 .end = AT91CAP9_BASE_EMAC + SZ_16K - 1,
98 .flags = IORESOURCE_MEM,
99 },
100 [1] = {
101 .start = AT91CAP9_ID_EMAC,
102 .end = AT91CAP9_ID_EMAC,
103 .flags = IORESOURCE_IRQ,
104 },
105};
106
107static struct platform_device at91cap9_eth_device = {
108 .name = "macb",
109 .id = -1,
110 .dev = {
111 .dma_mask = &eth_dmamask,
112 .coherent_dma_mask = DMA_BIT_MASK(32),
113 .platform_data = &eth_data,
114 },
115 .resource = eth_resources,
116 .num_resources = ARRAY_SIZE(eth_resources),
117};
118
119void __init at91_add_device_eth(struct at91_eth_data *data)
120{
121 if (!data)
122 return;
123
124 if (data->phy_irq_pin) {
125 at91_set_gpio_input(data->phy_irq_pin, 0);
126 at91_set_deglitch(data->phy_irq_pin, 1);
127 }
128
129 /* Pins used for MII and RMII */
130 at91_set_A_periph(AT91_PIN_PB21, 0); /* ETXCK_EREFCK */
131 at91_set_A_periph(AT91_PIN_PB22, 0); /* ERXDV */
132 at91_set_A_periph(AT91_PIN_PB25, 0); /* ERX0 */
133 at91_set_A_periph(AT91_PIN_PB26, 0); /* ERX1 */
134 at91_set_A_periph(AT91_PIN_PB27, 0); /* ERXER */
135 at91_set_A_periph(AT91_PIN_PB28, 0); /* ETXEN */
136 at91_set_A_periph(AT91_PIN_PB23, 0); /* ETX0 */
137 at91_set_A_periph(AT91_PIN_PB24, 0); /* ETX1 */
138 at91_set_A_periph(AT91_PIN_PB30, 0); /* EMDIO */
139 at91_set_A_periph(AT91_PIN_PB29, 0); /* EMDC */
140
141 if (!data->is_rmii) {
142 at91_set_B_periph(AT91_PIN_PC25, 0); /* ECRS */
143 at91_set_B_periph(AT91_PIN_PC26, 0); /* ECOL */
144 at91_set_B_periph(AT91_PIN_PC22, 0); /* ERX2 */
145 at91_set_B_periph(AT91_PIN_PC23, 0); /* ERX3 */
146 at91_set_B_periph(AT91_PIN_PC27, 0); /* ERXCK */
147 at91_set_B_periph(AT91_PIN_PC20, 0); /* ETX2 */
148 at91_set_B_periph(AT91_PIN_PC21, 0); /* ETX3 */
149 at91_set_B_periph(AT91_PIN_PC24, 0); /* ETXER */
150 }
151
152 eth_data = *data;
153 platform_device_register(&at91cap9_eth_device);
154}
155#else
156void __init at91_add_device_eth(struct at91_eth_data *data) {}
157#endif
158
159
160/* --------------------------------------------------------------------
161 * MMC / SD
162 * -------------------------------------------------------------------- */
163
164#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
165static u64 mmc_dmamask = DMA_BIT_MASK(32);
166static struct at91_mmc_data mmc0_data, mmc1_data;
167
168static struct resource mmc0_resources[] = {
169 [0] = {
170 .start = AT91CAP9_BASE_MCI0,
171 .end = AT91CAP9_BASE_MCI0 + SZ_16K - 1,
172 .flags = IORESOURCE_MEM,
173 },
174 [1] = {
175 .start = AT91CAP9_ID_MCI0,
176 .end = AT91CAP9_ID_MCI0,
177 .flags = IORESOURCE_IRQ,
178 },
179};
180
181static struct platform_device at91cap9_mmc0_device = {
182 .name = "at91_mci",
183 .id = 0,
184 .dev = {
185 .dma_mask = &mmc_dmamask,
186 .coherent_dma_mask = DMA_BIT_MASK(32),
187 .platform_data = &mmc0_data,
188 },
189 .resource = mmc0_resources,
190 .num_resources = ARRAY_SIZE(mmc0_resources),
191};
192
193static struct resource mmc1_resources[] = {
194 [0] = {
195 .start = AT91CAP9_BASE_MCI1,
196 .end = AT91CAP9_BASE_MCI1 + SZ_16K - 1,
197 .flags = IORESOURCE_MEM,
198 },
199 [1] = {
200 .start = AT91CAP9_ID_MCI1,
201 .end = AT91CAP9_ID_MCI1,
202 .flags = IORESOURCE_IRQ,
203 },
204};
205
206static struct platform_device at91cap9_mmc1_device = {
207 .name = "at91_mci",
208 .id = 1,
209 .dev = {
210 .dma_mask = &mmc_dmamask,
211 .coherent_dma_mask = DMA_BIT_MASK(32),
212 .platform_data = &mmc1_data,
213 },
214 .resource = mmc1_resources,
215 .num_resources = ARRAY_SIZE(mmc1_resources),
216};
217
218void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
219{
220 if (!data)
221 return;
222
223 /* input/irq */
224 if (data->det_pin) {
225 at91_set_gpio_input(data->det_pin, 1);
226 at91_set_deglitch(data->det_pin, 1);
227 }
228 if (data->wp_pin)
229 at91_set_gpio_input(data->wp_pin, 1);
230 if (data->vcc_pin)
231 at91_set_gpio_output(data->vcc_pin, 0);
232
233 if (mmc_id == 0) { /* MCI0 */
234 /* CLK */
235 at91_set_A_periph(AT91_PIN_PA2, 0);
236
237 /* CMD */
238 at91_set_A_periph(AT91_PIN_PA1, 1);
239
240 /* DAT0, maybe DAT1..DAT3 */
241 at91_set_A_periph(AT91_PIN_PA0, 1);
242 if (data->wire4) {
243 at91_set_A_periph(AT91_PIN_PA3, 1);
244 at91_set_A_periph(AT91_PIN_PA4, 1);
245 at91_set_A_periph(AT91_PIN_PA5, 1);
246 }
247
248 mmc0_data = *data;
249 at91_clock_associate("mci0_clk", &at91cap9_mmc1_device.dev, "mci_clk");
250 platform_device_register(&at91cap9_mmc0_device);
251 } else { /* MCI1 */
252 /* CLK */
253 at91_set_A_periph(AT91_PIN_PA16, 0);
254
255 /* CMD */
256 at91_set_A_periph(AT91_PIN_PA17, 1);
257
258 /* DAT0, maybe DAT1..DAT3 */
259 at91_set_A_periph(AT91_PIN_PA18, 1);
260 if (data->wire4) {
261 at91_set_A_periph(AT91_PIN_PA19, 1);
262 at91_set_A_periph(AT91_PIN_PA20, 1);
263 at91_set_A_periph(AT91_PIN_PA21, 1);
264 }
265
266 mmc1_data = *data;
267 at91_clock_associate("mci1_clk", &at91cap9_mmc1_device.dev, "mci_clk");
268 platform_device_register(&at91cap9_mmc1_device);
269 }
270}
271#else
272void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
273#endif
274
275
276/* --------------------------------------------------------------------
277 * NAND / SmartMedia
278 * -------------------------------------------------------------------- */
279
280#if defined(CONFIG_MTD_NAND_AT91) || defined(CONFIG_MTD_NAND_AT91_MODULE)
281static struct at91_nand_data nand_data;
282
283#define NAND_BASE AT91_CHIPSELECT_3
284
285static struct resource nand_resources[] = {
286 {
287 .start = NAND_BASE,
288 .end = NAND_BASE + SZ_256M - 1,
289 .flags = IORESOURCE_MEM,
290 }
291};
292
293static struct platform_device at91cap9_nand_device = {
294 .name = "at91_nand",
295 .id = -1,
296 .dev = {
297 .platform_data = &nand_data,
298 },
299 .resource = nand_resources,
300 .num_resources = ARRAY_SIZE(nand_resources),
301};
302
303void __init at91_add_device_nand(struct at91_nand_data *data)
304{
305 unsigned long csa, mode;
306
307 if (!data)
308 return;
309
310 csa = at91_sys_read(AT91_MATRIX_EBICSA);
311 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
312
313 /* set the bus interface characteristics */
314 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(2) | AT91_SMC_NCS_WRSETUP_(1)
315 | AT91_SMC_NRDSETUP_(2) | AT91_SMC_NCS_RDSETUP_(1));
316
317 at91_sys_write(AT91_SMC_PULSE(3), AT91_SMC_NWEPULSE_(4) | AT91_SMC_NCS_WRPULSE_(6)
318 | AT91_SMC_NRDPULSE_(4) | AT91_SMC_NCS_RDPULSE_(6));
319
320 at91_sys_write(AT91_SMC_CYCLE(3), AT91_SMC_NWECYCLE_(8) | AT91_SMC_NRDCYCLE_(8));
321
322 if (data->bus_width_16)
323 mode = AT91_SMC_DBW_16;
324 else
325 mode = AT91_SMC_DBW_8;
326 at91_sys_write(AT91_SMC_MODE(3), mode | AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_TDF_(1));
327
328 /* enable pin */
329 if (data->enable_pin)
330 at91_set_gpio_output(data->enable_pin, 1);
331
332 /* ready/busy pin */
333 if (data->rdy_pin)
334 at91_set_gpio_input(data->rdy_pin, 1);
335
336 /* card detect pin */
337 if (data->det_pin)
338 at91_set_gpio_input(data->det_pin, 1);
339
340 nand_data = *data;
341 platform_device_register(&at91cap9_nand_device);
342}
343#else
344void __init at91_add_device_nand(struct at91_nand_data *data) {}
345#endif
346
347/* --------------------------------------------------------------------
348 * TWI (i2c)
349 * -------------------------------------------------------------------- */
350
351/*
352 * Prefer the GPIO code since the TWI controller isn't robust
353 * (gets overruns and underruns under load) and can only issue
354 * repeated STARTs in one scenario (the driver doesn't yet handle them).
355 */
356#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
357
358static struct i2c_gpio_platform_data pdata = {
359 .sda_pin = AT91_PIN_PB4,
360 .sda_is_open_drain = 1,
361 .scl_pin = AT91_PIN_PB5,
362 .scl_is_open_drain = 1,
363 .udelay = 2, /* ~100 kHz */
364};
365
366static struct platform_device at91cap9_twi_device = {
367 .name = "i2c-gpio",
368 .id = -1,
369 .dev.platform_data = &pdata,
370};
371
372void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
373{
374 at91_set_GPIO_periph(AT91_PIN_PB4, 1); /* TWD (SDA) */
375 at91_set_multi_drive(AT91_PIN_PB4, 1);
376
377 at91_set_GPIO_periph(AT91_PIN_PB5, 1); /* TWCK (SCL) */
378 at91_set_multi_drive(AT91_PIN_PB5, 1);
379
380 i2c_register_board_info(0, devices, nr_devices);
381 platform_device_register(&at91cap9_twi_device);
382}
383
384#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
385
386static struct resource twi_resources[] = {
387 [0] = {
388 .start = AT91CAP9_BASE_TWI,
389 .end = AT91CAP9_BASE_TWI + SZ_16K - 1,
390 .flags = IORESOURCE_MEM,
391 },
392 [1] = {
393 .start = AT91CAP9_ID_TWI,
394 .end = AT91CAP9_ID_TWI,
395 .flags = IORESOURCE_IRQ,
396 },
397};
398
399static struct platform_device at91cap9_twi_device = {
400 .name = "at91_i2c",
401 .id = -1,
402 .resource = twi_resources,
403 .num_resources = ARRAY_SIZE(twi_resources),
404};
405
406void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
407{
408 /* pins used for TWI interface */
409 at91_set_B_periph(AT91_PIN_PB4, 0); /* TWD */
410 at91_set_multi_drive(AT91_PIN_PB4, 1);
411
412 at91_set_B_periph(AT91_PIN_PB5, 0); /* TWCK */
413 at91_set_multi_drive(AT91_PIN_PB5, 1);
414
415 i2c_register_board_info(0, devices, nr_devices);
416 platform_device_register(&at91cap9_twi_device);
417}
418#else
419void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
420#endif
421
422/* --------------------------------------------------------------------
423 * SPI
424 * -------------------------------------------------------------------- */
425
426#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
427static u64 spi_dmamask = DMA_BIT_MASK(32);
428
429static struct resource spi0_resources[] = {
430 [0] = {
431 .start = AT91CAP9_BASE_SPI0,
432 .end = AT91CAP9_BASE_SPI0 + SZ_16K - 1,
433 .flags = IORESOURCE_MEM,
434 },
435 [1] = {
436 .start = AT91CAP9_ID_SPI0,
437 .end = AT91CAP9_ID_SPI0,
438 .flags = IORESOURCE_IRQ,
439 },
440};
441
442static struct platform_device at91cap9_spi0_device = {
443 .name = "atmel_spi",
444 .id = 0,
445 .dev = {
446 .dma_mask = &spi_dmamask,
447 .coherent_dma_mask = DMA_BIT_MASK(32),
448 },
449 .resource = spi0_resources,
450 .num_resources = ARRAY_SIZE(spi0_resources),
451};
452
453static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA5, AT91_PIN_PA3, AT91_PIN_PD0, AT91_PIN_PD1 };
454
455static struct resource spi1_resources[] = {
456 [0] = {
457 .start = AT91CAP9_BASE_SPI1,
458 .end = AT91CAP9_BASE_SPI1 + SZ_16K - 1,
459 .flags = IORESOURCE_MEM,
460 },
461 [1] = {
462 .start = AT91CAP9_ID_SPI1,
463 .end = AT91CAP9_ID_SPI1,
464 .flags = IORESOURCE_IRQ,
465 },
466};
467
468static struct platform_device at91cap9_spi1_device = {
469 .name = "atmel_spi",
470 .id = 1,
471 .dev = {
472 .dma_mask = &spi_dmamask,
473 .coherent_dma_mask = DMA_BIT_MASK(32),
474 },
475 .resource = spi1_resources,
476 .num_resources = ARRAY_SIZE(spi1_resources),
477};
478
479static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB15, AT91_PIN_PB16, AT91_PIN_PB17, AT91_PIN_PB18 };
480
481void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
482{
483 int i;
484 unsigned long cs_pin;
485 short enable_spi0 = 0;
486 short enable_spi1 = 0;
487
488 /* Choose SPI chip-selects */
489 for (i = 0; i < nr_devices; i++) {
490 if (devices[i].controller_data)
491 cs_pin = (unsigned long) devices[i].controller_data;
492 else if (devices[i].bus_num == 0)
493 cs_pin = spi0_standard_cs[devices[i].chip_select];
494 else
495 cs_pin = spi1_standard_cs[devices[i].chip_select];
496
497 if (devices[i].bus_num == 0)
498 enable_spi0 = 1;
499 else
500 enable_spi1 = 1;
501
502 /* enable chip-select pin */
503 at91_set_gpio_output(cs_pin, 1);
504
505 /* pass chip-select pin to driver */
506 devices[i].controller_data = (void *) cs_pin;
507 }
508
509 spi_register_board_info(devices, nr_devices);
510
511 /* Configure SPI bus(es) */
512 if (enable_spi0) {
513 at91_set_B_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
514 at91_set_B_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
515 at91_set_B_periph(AT91_PIN_PA2, 0); /* SPI0_SPCK */
516
517 at91_clock_associate("spi0_clk", &at91cap9_spi0_device.dev, "spi_clk");
518 platform_device_register(&at91cap9_spi0_device);
519 }
520 if (enable_spi1) {
521 at91_set_A_periph(AT91_PIN_PB12, 0); /* SPI1_MISO */
522 at91_set_A_periph(AT91_PIN_PB13, 0); /* SPI1_MOSI */
523 at91_set_A_periph(AT91_PIN_PB14, 0); /* SPI1_SPCK */
524
525 at91_clock_associate("spi1_clk", &at91cap9_spi1_device.dev, "spi_clk");
526 platform_device_register(&at91cap9_spi1_device);
527 }
528}
529#else
530void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
531#endif
532
533
534/* --------------------------------------------------------------------
535 * RTT
536 * -------------------------------------------------------------------- */
537
538static struct platform_device at91cap9_rtt_device = {
539 .name = "at91_rtt",
540 .id = -1,
541 .num_resources = 0,
542};
543
544static void __init at91_add_device_rtt(void)
545{
546 platform_device_register(&at91cap9_rtt_device);
547}
548
549
550/* --------------------------------------------------------------------
551 * Watchdog
552 * -------------------------------------------------------------------- */
553
554#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
555static struct platform_device at91cap9_wdt_device = {
556 .name = "at91_wdt",
557 .id = -1,
558 .num_resources = 0,
559};
560
561static void __init at91_add_device_watchdog(void)
562{
563 platform_device_register(&at91cap9_wdt_device);
564}
565#else
566static void __init at91_add_device_watchdog(void) {}
567#endif
568
569
570/* --------------------------------------------------------------------
571 * AC97
572 * -------------------------------------------------------------------- */
573
574#if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE)
575static u64 ac97_dmamask = DMA_BIT_MASK(32);
576static struct atmel_ac97_data ac97_data;
577
578static struct resource ac97_resources[] = {
579 [0] = {
580 .start = AT91CAP9_BASE_AC97C,
581 .end = AT91CAP9_BASE_AC97C + SZ_16K - 1,
582 .flags = IORESOURCE_MEM,
583 },
584 [1] = {
585 .start = AT91CAP9_ID_AC97C,
586 .end = AT91CAP9_ID_AC97C,
587 .flags = IORESOURCE_IRQ,
588 },
589};
590
591static struct platform_device at91cap9_ac97_device = {
592 .name = "ac97c",
593 .id = 1,
594 .dev = {
595 .dma_mask = &ac97_dmamask,
596 .coherent_dma_mask = DMA_BIT_MASK(32),
597 .platform_data = &ac97_data,
598 },
599 .resource = ac97_resources,
600 .num_resources = ARRAY_SIZE(ac97_resources),
601};
602
603void __init at91_add_device_ac97(struct atmel_ac97_data *data)
604{
605 if (!data)
606 return;
607
608 at91_set_A_periph(AT91_PIN_PA6, 0); /* AC97FS */
609 at91_set_A_periph(AT91_PIN_PA7, 0); /* AC97CK */
610 at91_set_A_periph(AT91_PIN_PA8, 0); /* AC97TX */
611 at91_set_A_periph(AT91_PIN_PA9, 0); /* AC97RX */
612
613 /* reset */
614 if (data->reset_pin)
615 at91_set_gpio_output(data->reset_pin, 0);
616
617 ac97_data = *data;
618 platform_device_register(&at91cap9_ac97_device);
619}
620#else
621void __init at91_add_device_ac97(struct atmel_ac97_data *data) {}
622#endif
623
624
625/* --------------------------------------------------------------------
626 * LCD Controller
627 * -------------------------------------------------------------------- */
628
629#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
630static u64 lcdc_dmamask = DMA_BIT_MASK(32);
631static struct atmel_lcdfb_info lcdc_data;
632
633static struct resource lcdc_resources[] = {
634 [0] = {
635 .start = AT91CAP9_LCDC_BASE,
636 .end = AT91CAP9_LCDC_BASE + SZ_4K - 1,
637 .flags = IORESOURCE_MEM,
638 },
639 [1] = {
640 .start = AT91CAP9_ID_LCDC,
641 .end = AT91CAP9_ID_LCDC,
642 .flags = IORESOURCE_IRQ,
643 },
644};
645
646static struct platform_device at91_lcdc_device = {
647 .name = "atmel_lcdfb",
648 .id = 0,
649 .dev = {
650 .dma_mask = &lcdc_dmamask,
651 .coherent_dma_mask = DMA_BIT_MASK(32),
652 .platform_data = &lcdc_data,
653 },
654 .resource = lcdc_resources,
655 .num_resources = ARRAY_SIZE(lcdc_resources),
656};
657
658void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
659{
660 if (!data)
661 return;
662
663 at91_set_A_periph(AT91_PIN_PC1, 0); /* LCDHSYNC */
664 at91_set_A_periph(AT91_PIN_PC2, 0); /* LCDDOTCK */
665 at91_set_A_periph(AT91_PIN_PC3, 0); /* LCDDEN */
666 at91_set_B_periph(AT91_PIN_PB9, 0); /* LCDCC */
667 at91_set_A_periph(AT91_PIN_PC6, 0); /* LCDD2 */
668 at91_set_A_periph(AT91_PIN_PC7, 0); /* LCDD3 */
669 at91_set_A_periph(AT91_PIN_PC8, 0); /* LCDD4 */
670 at91_set_A_periph(AT91_PIN_PC9, 0); /* LCDD5 */
671 at91_set_A_periph(AT91_PIN_PC10, 0); /* LCDD6 */
672 at91_set_A_periph(AT91_PIN_PC11, 0); /* LCDD7 */
673 at91_set_A_periph(AT91_PIN_PC14, 0); /* LCDD10 */
674 at91_set_A_periph(AT91_PIN_PC15, 0); /* LCDD11 */
675 at91_set_A_periph(AT91_PIN_PC16, 0); /* LCDD12 */
676 at91_set_A_periph(AT91_PIN_PC17, 0); /* LCDD13 */
677 at91_set_A_periph(AT91_PIN_PC18, 0); /* LCDD14 */
678 at91_set_A_periph(AT91_PIN_PC19, 0); /* LCDD15 */
679 at91_set_A_periph(AT91_PIN_PC22, 0); /* LCDD18 */
680 at91_set_A_periph(AT91_PIN_PC23, 0); /* LCDD19 */
681 at91_set_A_periph(AT91_PIN_PC24, 0); /* LCDD20 */
682 at91_set_A_periph(AT91_PIN_PC25, 0); /* LCDD21 */
683 at91_set_A_periph(AT91_PIN_PC26, 0); /* LCDD22 */
684 at91_set_A_periph(AT91_PIN_PC27, 0); /* LCDD23 */
685
686 lcdc_data = *data;
687 platform_device_register(&at91_lcdc_device);
688}
689#else
690void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
691#endif
692
693
694/* --------------------------------------------------------------------
695 * SSC -- Synchronous Serial Controller
696 * -------------------------------------------------------------------- */
697
698#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
699static u64 ssc0_dmamask = DMA_BIT_MASK(32);
700
701static struct resource ssc0_resources[] = {
702 [0] = {
703 .start = AT91CAP9_BASE_SSC0,
704 .end = AT91CAP9_BASE_SSC0 + SZ_16K - 1,
705 .flags = IORESOURCE_MEM,
706 },
707 [1] = {
708 .start = AT91CAP9_ID_SSC0,
709 .end = AT91CAP9_ID_SSC0,
710 .flags = IORESOURCE_IRQ,
711 },
712};
713
714static struct platform_device at91cap9_ssc0_device = {
715 .name = "ssc",
716 .id = 0,
717 .dev = {
718 .dma_mask = &ssc0_dmamask,
719 .coherent_dma_mask = DMA_BIT_MASK(32),
720 },
721 .resource = ssc0_resources,
722 .num_resources = ARRAY_SIZE(ssc0_resources),
723};
724
725static inline void configure_ssc0_pins(unsigned pins)
726{
727 if (pins & ATMEL_SSC_TF)
728 at91_set_A_periph(AT91_PIN_PB0, 1);
729 if (pins & ATMEL_SSC_TK)
730 at91_set_A_periph(AT91_PIN_PB1, 1);
731 if (pins & ATMEL_SSC_TD)
732 at91_set_A_periph(AT91_PIN_PB2, 1);
733 if (pins & ATMEL_SSC_RD)
734 at91_set_A_periph(AT91_PIN_PB3, 1);
735 if (pins & ATMEL_SSC_RK)
736 at91_set_A_periph(AT91_PIN_PB4, 1);
737 if (pins & ATMEL_SSC_RF)
738 at91_set_A_periph(AT91_PIN_PB5, 1);
739}
740
741static u64 ssc1_dmamask = DMA_BIT_MASK(32);
742
743static struct resource ssc1_resources[] = {
744 [0] = {
745 .start = AT91CAP9_BASE_SSC1,
746 .end = AT91CAP9_BASE_SSC1 + SZ_16K - 1,
747 .flags = IORESOURCE_MEM,
748 },
749 [1] = {
750 .start = AT91CAP9_ID_SSC1,
751 .end = AT91CAP9_ID_SSC1,
752 .flags = IORESOURCE_IRQ,
753 },
754};
755
756static struct platform_device at91cap9_ssc1_device = {
757 .name = "ssc",
758 .id = 1,
759 .dev = {
760 .dma_mask = &ssc1_dmamask,
761 .coherent_dma_mask = DMA_BIT_MASK(32),
762 },
763 .resource = ssc1_resources,
764 .num_resources = ARRAY_SIZE(ssc1_resources),
765};
766
767static inline void configure_ssc1_pins(unsigned pins)
768{
769 if (pins & ATMEL_SSC_TF)
770 at91_set_A_periph(AT91_PIN_PB6, 1);
771 if (pins & ATMEL_SSC_TK)
772 at91_set_A_periph(AT91_PIN_PB7, 1);
773 if (pins & ATMEL_SSC_TD)
774 at91_set_A_periph(AT91_PIN_PB8, 1);
775 if (pins & ATMEL_SSC_RD)
776 at91_set_A_periph(AT91_PIN_PB9, 1);
777 if (pins & ATMEL_SSC_RK)
778 at91_set_A_periph(AT91_PIN_PB10, 1);
779 if (pins & ATMEL_SSC_RF)
780 at91_set_A_periph(AT91_PIN_PB11, 1);
781}
782
783/*
784 * SSC controllers are accessed through library code, instead of any
785 * kind of all-singing/all-dancing driver. For example one could be
786 * used by a particular I2S audio codec's driver, while another one
787 * on the same system might be used by a custom data capture driver.
788 */
789void __init at91_add_device_ssc(unsigned id, unsigned pins)
790{
791 struct platform_device *pdev;
792
793 /*
794 * NOTE: caller is responsible for passing information matching
795 * "pins" to whatever will be using each particular controller.
796 */
797 switch (id) {
798 case AT91CAP9_ID_SSC0:
799 pdev = &at91cap9_ssc0_device;
800 configure_ssc0_pins(pins);
801 at91_clock_associate("ssc0_clk", &pdev->dev, "ssc");
802 break;
803 case AT91CAP9_ID_SSC1:
804 pdev = &at91cap9_ssc1_device;
805 configure_ssc1_pins(pins);
806 at91_clock_associate("ssc1_clk", &pdev->dev, "ssc");
807 break;
808 default:
809 return;
810 }
811
812 platform_device_register(pdev);
813}
814
815#else
816void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
817#endif
818
819
820/* --------------------------------------------------------------------
821 * UART
822 * -------------------------------------------------------------------- */
823
824#if defined(CONFIG_SERIAL_ATMEL)
825static struct resource dbgu_resources[] = {
826 [0] = {
827 .start = AT91_VA_BASE_SYS + AT91_DBGU,
828 .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1,
829 .flags = IORESOURCE_MEM,
830 },
831 [1] = {
832 .start = AT91_ID_SYS,
833 .end = AT91_ID_SYS,
834 .flags = IORESOURCE_IRQ,
835 },
836};
837
838static struct atmel_uart_data dbgu_data = {
839 .use_dma_tx = 0,
840 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
841 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
842};
843
844static u64 dbgu_dmamask = DMA_BIT_MASK(32);
845
846static struct platform_device at91cap9_dbgu_device = {
847 .name = "atmel_usart",
848 .id = 0,
849 .dev = {
850 .dma_mask = &dbgu_dmamask,
851 .coherent_dma_mask = DMA_BIT_MASK(32),
852 .platform_data = &dbgu_data,
853 },
854 .resource = dbgu_resources,
855 .num_resources = ARRAY_SIZE(dbgu_resources),
856};
857
858static inline void configure_dbgu_pins(void)
859{
860 at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */
861 at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */
862}
863
864static struct resource uart0_resources[] = {
865 [0] = {
866 .start = AT91CAP9_BASE_US0,
867 .end = AT91CAP9_BASE_US0 + SZ_16K - 1,
868 .flags = IORESOURCE_MEM,
869 },
870 [1] = {
871 .start = AT91CAP9_ID_US0,
872 .end = AT91CAP9_ID_US0,
873 .flags = IORESOURCE_IRQ,
874 },
875};
876
877static struct atmel_uart_data uart0_data = {
878 .use_dma_tx = 1,
879 .use_dma_rx = 1,
880};
881
882static u64 uart0_dmamask = DMA_BIT_MASK(32);
883
884static struct platform_device at91cap9_uart0_device = {
885 .name = "atmel_usart",
886 .id = 1,
887 .dev = {
888 .dma_mask = &uart0_dmamask,
889 .coherent_dma_mask = DMA_BIT_MASK(32),
890 .platform_data = &uart0_data,
891 },
892 .resource = uart0_resources,
893 .num_resources = ARRAY_SIZE(uart0_resources),
894};
895
896static inline void configure_usart0_pins(unsigned pins)
897{
898 at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */
899 at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */
900
901 if (pins & ATMEL_UART_RTS)
902 at91_set_A_periph(AT91_PIN_PA24, 0); /* RTS0 */
903 if (pins & ATMEL_UART_CTS)
904 at91_set_A_periph(AT91_PIN_PA25, 0); /* CTS0 */
905}
906
907static struct resource uart1_resources[] = {
908 [0] = {
909 .start = AT91CAP9_BASE_US1,
910 .end = AT91CAP9_BASE_US1 + SZ_16K - 1,
911 .flags = IORESOURCE_MEM,
912 },
913 [1] = {
914 .start = AT91CAP9_ID_US1,
915 .end = AT91CAP9_ID_US1,
916 .flags = IORESOURCE_IRQ,
917 },
918};
919
920static struct atmel_uart_data uart1_data = {
921 .use_dma_tx = 1,
922 .use_dma_rx = 1,
923};
924
925static u64 uart1_dmamask = DMA_BIT_MASK(32);
926
927static struct platform_device at91cap9_uart1_device = {
928 .name = "atmel_usart",
929 .id = 2,
930 .dev = {
931 .dma_mask = &uart1_dmamask,
932 .coherent_dma_mask = DMA_BIT_MASK(32),
933 .platform_data = &uart1_data,
934 },
935 .resource = uart1_resources,
936 .num_resources = ARRAY_SIZE(uart1_resources),
937};
938
939static inline void configure_usart1_pins(unsigned pins)
940{
941 at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
942 at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
943
944 if (pins & ATMEL_UART_RTS)
945 at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */
946 if (pins & ATMEL_UART_CTS)
947 at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */
948}
949
950static struct resource uart2_resources[] = {
951 [0] = {
952 .start = AT91CAP9_BASE_US2,
953 .end = AT91CAP9_BASE_US2 + SZ_16K - 1,
954 .flags = IORESOURCE_MEM,
955 },
956 [1] = {
957 .start = AT91CAP9_ID_US2,
958 .end = AT91CAP9_ID_US2,
959 .flags = IORESOURCE_IRQ,
960 },
961};
962
963static struct atmel_uart_data uart2_data = {
964 .use_dma_tx = 1,
965 .use_dma_rx = 1,
966};
967
968static u64 uart2_dmamask = DMA_BIT_MASK(32);
969
970static struct platform_device at91cap9_uart2_device = {
971 .name = "atmel_usart",
972 .id = 3,
973 .dev = {
974 .dma_mask = &uart2_dmamask,
975 .coherent_dma_mask = DMA_BIT_MASK(32),
976 .platform_data = &uart2_data,
977 },
978 .resource = uart2_resources,
979 .num_resources = ARRAY_SIZE(uart2_resources),
980};
981
982static inline void configure_usart2_pins(unsigned pins)
983{
984 at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
985 at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
986
987 if (pins & ATMEL_UART_RTS)
988 at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */
989 if (pins & ATMEL_UART_CTS)
990 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
991}
992
993static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
994struct platform_device *atmel_default_console_device; /* the serial console device */
995
996void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
997{
998 struct platform_device *pdev;
999
1000 switch (id) {
1001 case 0: /* DBGU */
1002 pdev = &at91cap9_dbgu_device;
1003 configure_dbgu_pins();
1004 at91_clock_associate("mck", &pdev->dev, "usart");
1005 break;
1006 case AT91CAP9_ID_US0:
1007 pdev = &at91cap9_uart0_device;
1008 configure_usart0_pins(pins);
1009 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
1010 break;
1011 case AT91CAP9_ID_US1:
1012 pdev = &at91cap9_uart1_device;
1013 configure_usart1_pins(pins);
1014 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
1015 break;
1016 case AT91CAP9_ID_US2:
1017 pdev = &at91cap9_uart2_device;
1018 configure_usart2_pins(pins);
1019 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
1020 break;
1021 default:
1022 return;
1023 }
1024 pdev->id = portnr; /* update to mapped ID */
1025
1026 if (portnr < ATMEL_MAX_UART)
1027 at91_uarts[portnr] = pdev;
1028}
1029
1030void __init at91_set_serial_console(unsigned portnr)
1031{
1032 if (portnr < ATMEL_MAX_UART)
1033 atmel_default_console_device = at91_uarts[portnr];
1034 if (!atmel_default_console_device)
1035 printk(KERN_INFO "AT91: No default serial console defined.\n");
1036}
1037
1038void __init at91_add_device_serial(void)
1039{
1040 int i;
1041
1042 for (i = 0; i < ATMEL_MAX_UART; i++) {
1043 if (at91_uarts[i])
1044 platform_device_register(at91_uarts[i]);
1045 }
1046}
1047#else
1048void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1049void __init at91_set_serial_console(unsigned portnr) {}
1050void __init at91_add_device_serial(void) {}
1051#endif
1052
1053
1054/* -------------------------------------------------------------------- */
1055/*
1056 * These devices are always present and don't need any board-specific
1057 * setup.
1058 */
1059static int __init at91_add_standard_devices(void)
1060{
1061 at91_add_device_rtt();
1062 at91_add_device_watchdog();
1063 return 0;
1064}
1065
1066arch_initcall(at91_add_standard_devices);
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 2cad2bf864be..d688c1dbd925 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -301,28 +301,28 @@ void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks
301static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { 301static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
302 7, /* Advanced Interrupt Controller (FIQ) */ 302 7, /* Advanced Interrupt Controller (FIQ) */
303 7, /* System Peripherals */ 303 7, /* System Peripherals */
304 0, /* Parallel IO Controller A */ 304 1, /* Parallel IO Controller A */
305 0, /* Parallel IO Controller B */ 305 1, /* Parallel IO Controller B */
306 0, /* Parallel IO Controller C */ 306 1, /* Parallel IO Controller C */
307 0, /* Parallel IO Controller D */ 307 1, /* Parallel IO Controller D */
308 6, /* USART 0 */ 308 5, /* USART 0 */
309 6, /* USART 1 */ 309 5, /* USART 1 */
310 6, /* USART 2 */ 310 5, /* USART 2 */
311 6, /* USART 3 */ 311 5, /* USART 3 */
312 0, /* Multimedia Card Interface */ 312 0, /* Multimedia Card Interface */
313 4, /* USB Device Port */ 313 2, /* USB Device Port */
314 0, /* Two-Wire Interface */ 314 6, /* Two-Wire Interface */
315 6, /* Serial Peripheral Interface */ 315 5, /* Serial Peripheral Interface */
316 5, /* Serial Synchronous Controller 0 */ 316 4, /* Serial Synchronous Controller 0 */
317 5, /* Serial Synchronous Controller 1 */ 317 4, /* Serial Synchronous Controller 1 */
318 5, /* Serial Synchronous Controller 2 */ 318 4, /* Serial Synchronous Controller 2 */
319 0, /* Timer Counter 0 */ 319 0, /* Timer Counter 0 */
320 0, /* Timer Counter 1 */ 320 0, /* Timer Counter 1 */
321 0, /* Timer Counter 2 */ 321 0, /* Timer Counter 2 */
322 0, /* Timer Counter 3 */ 322 0, /* Timer Counter 3 */
323 0, /* Timer Counter 4 */ 323 0, /* Timer Counter 4 */
324 0, /* Timer Counter 5 */ 324 0, /* Timer Counter 5 */
325 3, /* USB Host port */ 325 2, /* USB Host port */
326 3, /* Ethernet MAC */ 326 3, /* Ethernet MAC */
327 0, /* Advanced Interrupt Controller (IRQ0) */ 327 0, /* Advanced Interrupt Controller (IRQ0) */
328 0, /* Advanced Interrupt Controller (IRQ1) */ 328 0, /* Advanced Interrupt Controller (IRQ1) */
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 9296833f91cc..ef6aeb86e980 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/arch.h> 13#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/dma-mapping.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18 19
@@ -29,7 +30,7 @@
29 * -------------------------------------------------------------------- */ 30 * -------------------------------------------------------------------- */
30 31
31#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 32#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
32static u64 ohci_dmamask = 0xffffffffUL; 33static u64 ohci_dmamask = DMA_BIT_MASK(32);
33static struct at91_usbh_data usbh_data; 34static struct at91_usbh_data usbh_data;
34 35
35static struct resource usbh_resources[] = { 36static struct resource usbh_resources[] = {
@@ -50,7 +51,7 @@ static struct platform_device at91rm9200_usbh_device = {
50 .id = -1, 51 .id = -1,
51 .dev = { 52 .dev = {
52 .dma_mask = &ohci_dmamask, 53 .dma_mask = &ohci_dmamask,
53 .coherent_dma_mask = 0xffffffff, 54 .coherent_dma_mask = DMA_BIT_MASK(32),
54 .platform_data = &usbh_data, 55 .platform_data = &usbh_data,
55 }, 56 },
56 .resource = usbh_resources, 57 .resource = usbh_resources,
@@ -125,7 +126,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
125 * -------------------------------------------------------------------- */ 126 * -------------------------------------------------------------------- */
126 127
127#if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE) 128#if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
128static u64 eth_dmamask = 0xffffffffUL; 129static u64 eth_dmamask = DMA_BIT_MASK(32);
129static struct at91_eth_data eth_data; 130static struct at91_eth_data eth_data;
130 131
131static struct resource eth_resources[] = { 132static struct resource eth_resources[] = {
@@ -146,7 +147,7 @@ static struct platform_device at91rm9200_eth_device = {
146 .id = -1, 147 .id = -1,
147 .dev = { 148 .dev = {
148 .dma_mask = &eth_dmamask, 149 .dma_mask = &eth_dmamask,
149 .coherent_dma_mask = 0xffffffff, 150 .coherent_dma_mask = DMA_BIT_MASK(32),
150 .platform_data = &eth_data, 151 .platform_data = &eth_data,
151 }, 152 },
152 .resource = eth_resources, 153 .resource = eth_resources,
@@ -285,7 +286,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) {}
285 * -------------------------------------------------------------------- */ 286 * -------------------------------------------------------------------- */
286 287
287#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 288#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
288static u64 mmc_dmamask = 0xffffffffUL; 289static u64 mmc_dmamask = DMA_BIT_MASK(32);
289static struct at91_mmc_data mmc_data; 290static struct at91_mmc_data mmc_data;
290 291
291static struct resource mmc_resources[] = { 292static struct resource mmc_resources[] = {
@@ -306,7 +307,7 @@ static struct platform_device at91rm9200_mmc_device = {
306 .id = -1, 307 .id = -1,
307 .dev = { 308 .dev = {
308 .dma_mask = &mmc_dmamask, 309 .dma_mask = &mmc_dmamask,
309 .coherent_dma_mask = 0xffffffff, 310 .coherent_dma_mask = DMA_BIT_MASK(32),
310 .platform_data = &mmc_data, 311 .platform_data = &mmc_data,
311 }, 312 },
312 .resource = mmc_resources, 313 .resource = mmc_resources,
@@ -375,7 +376,7 @@ static struct at91_nand_data nand_data;
375static struct resource nand_resources[] = { 376static struct resource nand_resources[] = {
376 { 377 {
377 .start = NAND_BASE, 378 .start = NAND_BASE,
378 .end = NAND_BASE + SZ_8M - 1, 379 .end = NAND_BASE + SZ_256M - 1,
379 .flags = IORESOURCE_MEM, 380 .flags = IORESOURCE_MEM,
380 } 381 }
381}; 382};
@@ -513,7 +514,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
513 * -------------------------------------------------------------------- */ 514 * -------------------------------------------------------------------- */
514 515
515#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) 516#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
516static u64 spi_dmamask = 0xffffffffUL; 517static u64 spi_dmamask = DMA_BIT_MASK(32);
517 518
518static struct resource spi_resources[] = { 519static struct resource spi_resources[] = {
519 [0] = { 520 [0] = {
@@ -533,7 +534,7 @@ static struct platform_device at91rm9200_spi_device = {
533 .id = 0, 534 .id = 0,
534 .dev = { 535 .dev = {
535 .dma_mask = &spi_dmamask, 536 .dma_mask = &spi_dmamask,
536 .coherent_dma_mask = 0xffffffff, 537 .coherent_dma_mask = DMA_BIT_MASK(32),
537 }, 538 },
538 .resource = spi_resources, 539 .resource = spi_resources,
539 .num_resources = ARRAY_SIZE(spi_resources), 540 .num_resources = ARRAY_SIZE(spi_resources),
@@ -557,8 +558,11 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
557 else 558 else
558 cs_pin = spi_standard_cs[devices[i].chip_select]; 559 cs_pin = spi_standard_cs[devices[i].chip_select];
559 560
560 /* enable chip-select pin */ 561 if (devices[i].chip_select == 0) /* for CS0 errata */
561 at91_set_gpio_output(cs_pin, 1); 562 at91_set_A_periph(cs_pin, 0);
563 else
564 at91_set_gpio_output(cs_pin, 1);
565
562 566
563 /* pass chip-select pin to driver */ 567 /* pass chip-select pin to driver */
564 devices[i].controller_data = (void *) cs_pin; 568 devices[i].controller_data = (void *) cs_pin;
@@ -613,24 +617,175 @@ static void __init at91_add_device_watchdog(void) {}
613 617
614 618
615/* -------------------------------------------------------------------- 619/* --------------------------------------------------------------------
616 * LEDs 620 * SSC -- Synchronous Serial Controller
617 * -------------------------------------------------------------------- */ 621 * -------------------------------------------------------------------- */
618 622
619#if defined(CONFIG_LEDS) 623#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
620u8 at91_leds_cpu; 624static u64 ssc0_dmamask = DMA_BIT_MASK(32);
621u8 at91_leds_timer; 625
626static struct resource ssc0_resources[] = {
627 [0] = {
628 .start = AT91RM9200_BASE_SSC0,
629 .end = AT91RM9200_BASE_SSC0 + SZ_16K - 1,
630 .flags = IORESOURCE_MEM,
631 },
632 [1] = {
633 .start = AT91RM9200_ID_SSC0,
634 .end = AT91RM9200_ID_SSC0,
635 .flags = IORESOURCE_IRQ,
636 },
637};
638
639static struct platform_device at91rm9200_ssc0_device = {
640 .name = "ssc",
641 .id = 0,
642 .dev = {
643 .dma_mask = &ssc0_dmamask,
644 .coherent_dma_mask = DMA_BIT_MASK(32),
645 },
646 .resource = ssc0_resources,
647 .num_resources = ARRAY_SIZE(ssc0_resources),
648};
649
650static inline void configure_ssc0_pins(unsigned pins)
651{
652 if (pins & ATMEL_SSC_TF)
653 at91_set_A_periph(AT91_PIN_PB0, 1);
654 if (pins & ATMEL_SSC_TK)
655 at91_set_A_periph(AT91_PIN_PB1, 1);
656 if (pins & ATMEL_SSC_TD)
657 at91_set_A_periph(AT91_PIN_PB2, 1);
658 if (pins & ATMEL_SSC_RD)
659 at91_set_A_periph(AT91_PIN_PB3, 1);
660 if (pins & ATMEL_SSC_RK)
661 at91_set_A_periph(AT91_PIN_PB4, 1);
662 if (pins & ATMEL_SSC_RF)
663 at91_set_A_periph(AT91_PIN_PB5, 1);
664}
665
666static u64 ssc1_dmamask = DMA_BIT_MASK(32);
667
668static struct resource ssc1_resources[] = {
669 [0] = {
670 .start = AT91RM9200_BASE_SSC1,
671 .end = AT91RM9200_BASE_SSC1 + SZ_16K - 1,
672 .flags = IORESOURCE_MEM,
673 },
674 [1] = {
675 .start = AT91RM9200_ID_SSC1,
676 .end = AT91RM9200_ID_SSC1,
677 .flags = IORESOURCE_IRQ,
678 },
679};
680
681static struct platform_device at91rm9200_ssc1_device = {
682 .name = "ssc",
683 .id = 1,
684 .dev = {
685 .dma_mask = &ssc1_dmamask,
686 .coherent_dma_mask = DMA_BIT_MASK(32),
687 },
688 .resource = ssc1_resources,
689 .num_resources = ARRAY_SIZE(ssc1_resources),
690};
691
692static inline void configure_ssc1_pins(unsigned pins)
693{
694 if (pins & ATMEL_SSC_TF)
695 at91_set_A_periph(AT91_PIN_PB6, 1);
696 if (pins & ATMEL_SSC_TK)
697 at91_set_A_periph(AT91_PIN_PB7, 1);
698 if (pins & ATMEL_SSC_TD)
699 at91_set_A_periph(AT91_PIN_PB8, 1);
700 if (pins & ATMEL_SSC_RD)
701 at91_set_A_periph(AT91_PIN_PB9, 1);
702 if (pins & ATMEL_SSC_RK)
703 at91_set_A_periph(AT91_PIN_PB10, 1);
704 if (pins & ATMEL_SSC_RF)
705 at91_set_A_periph(AT91_PIN_PB11, 1);
706}
707
708static u64 ssc2_dmamask = DMA_BIT_MASK(32);
709
710static struct resource ssc2_resources[] = {
711 [0] = {
712 .start = AT91RM9200_BASE_SSC2,
713 .end = AT91RM9200_BASE_SSC2 + SZ_16K - 1,
714 .flags = IORESOURCE_MEM,
715 },
716 [1] = {
717 .start = AT91RM9200_ID_SSC2,
718 .end = AT91RM9200_ID_SSC2,
719 .flags = IORESOURCE_IRQ,
720 },
721};
722
723static struct platform_device at91rm9200_ssc2_device = {
724 .name = "ssc",
725 .id = 2,
726 .dev = {
727 .dma_mask = &ssc2_dmamask,
728 .coherent_dma_mask = DMA_BIT_MASK(32),
729 },
730 .resource = ssc2_resources,
731 .num_resources = ARRAY_SIZE(ssc2_resources),
732};
733
734static inline void configure_ssc2_pins(unsigned pins)
735{
736 if (pins & ATMEL_SSC_TF)
737 at91_set_A_periph(AT91_PIN_PB12, 1);
738 if (pins & ATMEL_SSC_TK)
739 at91_set_A_periph(AT91_PIN_PB13, 1);
740 if (pins & ATMEL_SSC_TD)
741 at91_set_A_periph(AT91_PIN_PB14, 1);
742 if (pins & ATMEL_SSC_RD)
743 at91_set_A_periph(AT91_PIN_PB15, 1);
744 if (pins & ATMEL_SSC_RK)
745 at91_set_A_periph(AT91_PIN_PB16, 1);
746 if (pins & ATMEL_SSC_RF)
747 at91_set_A_periph(AT91_PIN_PB17, 1);
748}
622 749
623void __init at91_init_leds(u8 cpu_led, u8 timer_led) 750/*
751 * SSC controllers are accessed through library code, instead of any
752 * kind of all-singing/all-dancing driver. For example one could be
753 * used by a particular I2S audio codec's driver, while another one
754 * on the same system might be used by a custom data capture driver.
755 */
756void __init at91_add_device_ssc(unsigned id, unsigned pins)
624{ 757{
625 /* Enable GPIO to access the LEDs */ 758 struct platform_device *pdev;
626 at91_set_gpio_output(cpu_led, 1);
627 at91_set_gpio_output(timer_led, 1);
628 759
629 at91_leds_cpu = cpu_led; 760 /*
630 at91_leds_timer = timer_led; 761 * NOTE: caller is responsible for passing information matching
762 * "pins" to whatever will be using each particular controller.
763 */
764 switch (id) {
765 case AT91RM9200_ID_SSC0:
766 pdev = &at91rm9200_ssc0_device;
767 configure_ssc0_pins(pins);
768 at91_clock_associate("ssc0_clk", &pdev->dev, "ssc");
769 break;
770 case AT91RM9200_ID_SSC1:
771 pdev = &at91rm9200_ssc1_device;
772 configure_ssc1_pins(pins);
773 at91_clock_associate("ssc1_clk", &pdev->dev, "ssc");
774 break;
775 case AT91RM9200_ID_SSC2:
776 pdev = &at91rm9200_ssc2_device;
777 configure_ssc2_pins(pins);
778 at91_clock_associate("ssc2_clk", &pdev->dev, "ssc");
779 break;
780 default:
781 return;
782 }
783
784 platform_device_register(pdev);
631} 785}
786
632#else 787#else
633void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} 788void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
634#endif 789#endif
635 790
636 791
@@ -658,12 +813,15 @@ static struct atmel_uart_data dbgu_data = {
658 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), 813 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
659}; 814};
660 815
816static u64 dbgu_dmamask = DMA_BIT_MASK(32);
817
661static struct platform_device at91rm9200_dbgu_device = { 818static struct platform_device at91rm9200_dbgu_device = {
662 .name = "atmel_usart", 819 .name = "atmel_usart",
663 .id = 0, 820 .id = 0,
664 .dev = { 821 .dev = {
665 .platform_data = &dbgu_data, 822 .dma_mask = &dbgu_dmamask,
666 .coherent_dma_mask = 0xffffffff, 823 .coherent_dma_mask = DMA_BIT_MASK(32),
824 .platform_data = &dbgu_data,
667 }, 825 },
668 .resource = dbgu_resources, 826 .resource = dbgu_resources,
669 .num_resources = ARRAY_SIZE(dbgu_resources), 827 .num_resources = ARRAY_SIZE(dbgu_resources),
@@ -693,28 +851,35 @@ static struct atmel_uart_data uart0_data = {
693 .use_dma_rx = 1, 851 .use_dma_rx = 1,
694}; 852};
695 853
854static u64 uart0_dmamask = DMA_BIT_MASK(32);
855
696static struct platform_device at91rm9200_uart0_device = { 856static struct platform_device at91rm9200_uart0_device = {
697 .name = "atmel_usart", 857 .name = "atmel_usart",
698 .id = 1, 858 .id = 1,
699 .dev = { 859 .dev = {
700 .platform_data = &uart0_data, 860 .dma_mask = &uart0_dmamask,
701 .coherent_dma_mask = 0xffffffff, 861 .coherent_dma_mask = DMA_BIT_MASK(32),
862 .platform_data = &uart0_data,
702 }, 863 },
703 .resource = uart0_resources, 864 .resource = uart0_resources,
704 .num_resources = ARRAY_SIZE(uart0_resources), 865 .num_resources = ARRAY_SIZE(uart0_resources),
705}; 866};
706 867
707static inline void configure_usart0_pins(void) 868static inline void configure_usart0_pins(unsigned pins)
708{ 869{
709 at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */ 870 at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */
710 at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */ 871 at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */
711 at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */
712 872
713 /* 873 if (pins & ATMEL_UART_CTS)
714 * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. 874 at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */
715 * We need to drive the pin manually. Default is off (RTS is active low). 875
716 */ 876 if (pins & ATMEL_UART_RTS) {
717 at91_set_gpio_output(AT91_PIN_PA21, 1); 877 /*
878 * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21.
879 * We need to drive the pin manually. Default is off (RTS is active low).
880 */
881 at91_set_gpio_output(AT91_PIN_PA21, 1);
882 }
718} 883}
719 884
720static struct resource uart1_resources[] = { 885static struct resource uart1_resources[] = {
@@ -735,27 +900,37 @@ static struct atmel_uart_data uart1_data = {
735 .use_dma_rx = 1, 900 .use_dma_rx = 1,
736}; 901};
737 902
903static u64 uart1_dmamask = DMA_BIT_MASK(32);
904
738static struct platform_device at91rm9200_uart1_device = { 905static struct platform_device at91rm9200_uart1_device = {
739 .name = "atmel_usart", 906 .name = "atmel_usart",
740 .id = 2, 907 .id = 2,
741 .dev = { 908 .dev = {
742 .platform_data = &uart1_data, 909 .dma_mask = &uart1_dmamask,
743 .coherent_dma_mask = 0xffffffff, 910 .coherent_dma_mask = DMA_BIT_MASK(32),
911 .platform_data = &uart1_data,
744 }, 912 },
745 .resource = uart1_resources, 913 .resource = uart1_resources,
746 .num_resources = ARRAY_SIZE(uart1_resources), 914 .num_resources = ARRAY_SIZE(uart1_resources),
747}; 915};
748 916
749static inline void configure_usart1_pins(void) 917static inline void configure_usart1_pins(unsigned pins)
750{ 918{
751 at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */
752 at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */
753 at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */ 919 at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */
754 at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */ 920 at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */
755 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */ 921
756 at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */ 922 if (pins & ATMEL_UART_RI)
757 at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */ 923 at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */
758 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */ 924 if (pins & ATMEL_UART_DTR)
925 at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */
926 if (pins & ATMEL_UART_DCD)
927 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */
928 if (pins & ATMEL_UART_CTS)
929 at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */
930 if (pins & ATMEL_UART_DSR)
931 at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */
932 if (pins & ATMEL_UART_RTS)
933 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */
759} 934}
760 935
761static struct resource uart2_resources[] = { 936static struct resource uart2_resources[] = {
@@ -776,21 +951,29 @@ static struct atmel_uart_data uart2_data = {
776 .use_dma_rx = 1, 951 .use_dma_rx = 1,
777}; 952};
778 953
954static u64 uart2_dmamask = DMA_BIT_MASK(32);
955
779static struct platform_device at91rm9200_uart2_device = { 956static struct platform_device at91rm9200_uart2_device = {
780 .name = "atmel_usart", 957 .name = "atmel_usart",
781 .id = 3, 958 .id = 3,
782 .dev = { 959 .dev = {
783 .platform_data = &uart2_data, 960 .dma_mask = &uart2_dmamask,
784 .coherent_dma_mask = 0xffffffff, 961 .coherent_dma_mask = DMA_BIT_MASK(32),
962 .platform_data = &uart2_data,
785 }, 963 },
786 .resource = uart2_resources, 964 .resource = uart2_resources,
787 .num_resources = ARRAY_SIZE(uart2_resources), 965 .num_resources = ARRAY_SIZE(uart2_resources),
788}; 966};
789 967
790static inline void configure_usart2_pins(void) 968static inline void configure_usart2_pins(unsigned pins)
791{ 969{
792 at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */ 970 at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */
793 at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */ 971 at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */
972
973 if (pins & ATMEL_UART_CTS)
974 at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */
975 if (pins & ATMEL_UART_RTS)
976 at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */
794} 977}
795 978
796static struct resource uart3_resources[] = { 979static struct resource uart3_resources[] = {
@@ -811,27 +994,35 @@ static struct atmel_uart_data uart3_data = {
811 .use_dma_rx = 1, 994 .use_dma_rx = 1,
812}; 995};
813 996
997static u64 uart3_dmamask = DMA_BIT_MASK(32);
998
814static struct platform_device at91rm9200_uart3_device = { 999static struct platform_device at91rm9200_uart3_device = {
815 .name = "atmel_usart", 1000 .name = "atmel_usart",
816 .id = 4, 1001 .id = 4,
817 .dev = { 1002 .dev = {
818 .platform_data = &uart3_data, 1003 .dma_mask = &uart3_dmamask,
819 .coherent_dma_mask = 0xffffffff, 1004 .coherent_dma_mask = DMA_BIT_MASK(32),
1005 .platform_data = &uart3_data,
820 }, 1006 },
821 .resource = uart3_resources, 1007 .resource = uart3_resources,
822 .num_resources = ARRAY_SIZE(uart3_resources), 1008 .num_resources = ARRAY_SIZE(uart3_resources),
823}; 1009};
824 1010
825static inline void configure_usart3_pins(void) 1011static inline void configure_usart3_pins(unsigned pins)
826{ 1012{
827 at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */ 1013 at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */
828 at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */ 1014 at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */
1015
1016 if (pins & ATMEL_UART_CTS)
1017 at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */
1018 if (pins & ATMEL_UART_RTS)
1019 at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */
829} 1020}
830 1021
831struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1022static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
832struct platform_device *atmel_default_console_device; /* the serial console device */ 1023struct platform_device *atmel_default_console_device; /* the serial console device */
833 1024
834void __init at91_init_serial(struct at91_uart_config *config) 1025void __init __deprecated at91_init_serial(struct at91_uart_config *config)
835{ 1026{
836 int i; 1027 int i;
837 1028
@@ -839,22 +1030,22 @@ void __init at91_init_serial(struct at91_uart_config *config)
839 for (i = 0; i < config->nr_tty; i++) { 1030 for (i = 0; i < config->nr_tty; i++) {
840 switch (config->tty_map[i]) { 1031 switch (config->tty_map[i]) {
841 case 0: 1032 case 0:
842 configure_usart0_pins(); 1033 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
843 at91_uarts[i] = &at91rm9200_uart0_device; 1034 at91_uarts[i] = &at91rm9200_uart0_device;
844 at91_clock_associate("usart0_clk", &at91rm9200_uart0_device.dev, "usart"); 1035 at91_clock_associate("usart0_clk", &at91rm9200_uart0_device.dev, "usart");
845 break; 1036 break;
846 case 1: 1037 case 1:
847 configure_usart1_pins(); 1038 configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI);
848 at91_uarts[i] = &at91rm9200_uart1_device; 1039 at91_uarts[i] = &at91rm9200_uart1_device;
849 at91_clock_associate("usart1_clk", &at91rm9200_uart1_device.dev, "usart"); 1040 at91_clock_associate("usart1_clk", &at91rm9200_uart1_device.dev, "usart");
850 break; 1041 break;
851 case 2: 1042 case 2:
852 configure_usart2_pins(); 1043 configure_usart2_pins(0);
853 at91_uarts[i] = &at91rm9200_uart2_device; 1044 at91_uarts[i] = &at91rm9200_uart2_device;
854 at91_clock_associate("usart2_clk", &at91rm9200_uart2_device.dev, "usart"); 1045 at91_clock_associate("usart2_clk", &at91rm9200_uart2_device.dev, "usart");
855 break; 1046 break;
856 case 3: 1047 case 3:
857 configure_usart3_pins(); 1048 configure_usart3_pins(0);
858 at91_uarts[i] = &at91rm9200_uart3_device; 1049 at91_uarts[i] = &at91rm9200_uart3_device;
859 at91_clock_associate("usart3_clk", &at91rm9200_uart3_device.dev, "usart"); 1050 at91_clock_associate("usart3_clk", &at91rm9200_uart3_device.dev, "usart");
860 break; 1051 break;
@@ -876,6 +1067,53 @@ void __init at91_init_serial(struct at91_uart_config *config)
876 printk(KERN_INFO "AT91: No default serial console defined.\n"); 1067 printk(KERN_INFO "AT91: No default serial console defined.\n");
877} 1068}
878 1069
1070void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1071{
1072 struct platform_device *pdev;
1073
1074 switch (id) {
1075 case 0: /* DBGU */
1076 pdev = &at91rm9200_dbgu_device;
1077 configure_dbgu_pins();
1078 at91_clock_associate("mck", &pdev->dev, "usart");
1079 break;
1080 case AT91RM9200_ID_US0:
1081 pdev = &at91rm9200_uart0_device;
1082 configure_usart0_pins(pins);
1083 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
1084 break;
1085 case AT91RM9200_ID_US1:
1086 pdev = &at91rm9200_uart1_device;
1087 configure_usart1_pins(pins);
1088 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
1089 break;
1090 case AT91RM9200_ID_US2:
1091 pdev = &at91rm9200_uart2_device;
1092 configure_usart2_pins(pins);
1093 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
1094 break;
1095 case AT91RM9200_ID_US3:
1096 pdev = &at91rm9200_uart3_device;
1097 configure_usart3_pins(pins);
1098 at91_clock_associate("usart3_clk", &pdev->dev, "usart");
1099 break;
1100 default:
1101 return;
1102 }
1103 pdev->id = portnr; /* update to mapped ID */
1104
1105 if (portnr < ATMEL_MAX_UART)
1106 at91_uarts[portnr] = pdev;
1107}
1108
1109void __init at91_set_serial_console(unsigned portnr)
1110{
1111 if (portnr < ATMEL_MAX_UART)
1112 atmel_default_console_device = at91_uarts[portnr];
1113 if (!atmel_default_console_device)
1114 printk(KERN_INFO "AT91: No default serial console defined.\n");
1115}
1116
879void __init at91_add_device_serial(void) 1117void __init at91_add_device_serial(void)
880{ 1118{
881 int i; 1119 int i;
@@ -886,7 +1124,9 @@ void __init at91_add_device_serial(void)
886 } 1124 }
887} 1125}
888#else 1126#else
889void __init at91_init_serial(struct at91_uart_config *config) {} 1127void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1128void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1129void __init at91_set_serial_console(unsigned portnr) {}
890void __init at91_add_device_serial(void) {} 1130void __init at91_add_device_serial(void) {}
891#endif 1131#endif
892 1132
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index e47381e8aaba..18d06612ce8a 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -327,30 +327,30 @@ void __init at91sam9260_initialize(unsigned long main_clock)
327static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { 327static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
328 7, /* Advanced Interrupt Controller */ 328 7, /* Advanced Interrupt Controller */
329 7, /* System Peripherals */ 329 7, /* System Peripherals */
330 0, /* Parallel IO Controller A */ 330 1, /* Parallel IO Controller A */
331 0, /* Parallel IO Controller B */ 331 1, /* Parallel IO Controller B */
332 0, /* Parallel IO Controller C */ 332 1, /* Parallel IO Controller C */
333 0, /* Analog-to-Digital Converter */ 333 0, /* Analog-to-Digital Converter */
334 6, /* USART 0 */ 334 5, /* USART 0 */
335 6, /* USART 1 */ 335 5, /* USART 1 */
336 6, /* USART 2 */ 336 5, /* USART 2 */
337 0, /* Multimedia Card Interface */ 337 0, /* Multimedia Card Interface */
338 4, /* USB Device Port */ 338 2, /* USB Device Port */
339 0, /* Two-Wire Interface */ 339 6, /* Two-Wire Interface */
340 6, /* Serial Peripheral Interface 0 */ 340 5, /* Serial Peripheral Interface 0 */
341 6, /* Serial Peripheral Interface 1 */ 341 5, /* Serial Peripheral Interface 1 */
342 5, /* Serial Synchronous Controller */ 342 5, /* Serial Synchronous Controller */
343 0, 343 0,
344 0, 344 0,
345 0, /* Timer Counter 0 */ 345 0, /* Timer Counter 0 */
346 0, /* Timer Counter 1 */ 346 0, /* Timer Counter 1 */
347 0, /* Timer Counter 2 */ 347 0, /* Timer Counter 2 */
348 3, /* USB Host port */ 348 2, /* USB Host port */
349 3, /* Ethernet */ 349 3, /* Ethernet */
350 0, /* Image Sensor Interface */ 350 0, /* Image Sensor Interface */
351 6, /* USART 3 */ 351 5, /* USART 3 */
352 6, /* USART 4 */ 352 5, /* USART 4 */
353 6, /* USART 5 */ 353 5, /* USART 5 */
354 0, /* Timer Counter 3 */ 354 0, /* Timer Counter 3 */
355 0, /* Timer Counter 4 */ 355 0, /* Timer Counter 4 */
356 0, /* Timer Counter 5 */ 356 0, /* Timer Counter 5 */
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 3091bf47d8c9..105f8403860b 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -12,6 +12,7 @@
12#include <asm/mach/arch.h> 12#include <asm/mach/arch.h>
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h> 17#include <linux/i2c-gpio.h>
17 18
@@ -29,7 +30,7 @@
29 * -------------------------------------------------------------------- */ 30 * -------------------------------------------------------------------- */
30 31
31#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 32#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
32static u64 ohci_dmamask = 0xffffffffUL; 33static u64 ohci_dmamask = DMA_BIT_MASK(32);
33static struct at91_usbh_data usbh_data; 34static struct at91_usbh_data usbh_data;
34 35
35static struct resource usbh_resources[] = { 36static struct resource usbh_resources[] = {
@@ -50,7 +51,7 @@ static struct platform_device at91_usbh_device = {
50 .id = -1, 51 .id = -1,
51 .dev = { 52 .dev = {
52 .dma_mask = &ohci_dmamask, 53 .dma_mask = &ohci_dmamask,
53 .coherent_dma_mask = 0xffffffff, 54 .coherent_dma_mask = DMA_BIT_MASK(32),
54 .platform_data = &usbh_data, 55 .platform_data = &usbh_data,
55 }, 56 },
56 .resource = usbh_resources, 57 .resource = usbh_resources,
@@ -125,7 +126,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
125 * -------------------------------------------------------------------- */ 126 * -------------------------------------------------------------------- */
126 127
127#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 128#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
128static u64 eth_dmamask = 0xffffffffUL; 129static u64 eth_dmamask = DMA_BIT_MASK(32);
129static struct at91_eth_data eth_data; 130static struct at91_eth_data eth_data;
130 131
131static struct resource eth_resources[] = { 132static struct resource eth_resources[] = {
@@ -146,7 +147,7 @@ static struct platform_device at91sam9260_eth_device = {
146 .id = -1, 147 .id = -1,
147 .dev = { 148 .dev = {
148 .dma_mask = &eth_dmamask, 149 .dma_mask = &eth_dmamask,
149 .coherent_dma_mask = 0xffffffff, 150 .coherent_dma_mask = DMA_BIT_MASK(32),
150 .platform_data = &eth_data, 151 .platform_data = &eth_data,
151 }, 152 },
152 .resource = eth_resources, 153 .resource = eth_resources,
@@ -199,7 +200,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {}
199 * -------------------------------------------------------------------- */ 200 * -------------------------------------------------------------------- */
200 201
201#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 202#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
202static u64 mmc_dmamask = 0xffffffffUL; 203static u64 mmc_dmamask = DMA_BIT_MASK(32);
203static struct at91_mmc_data mmc_data; 204static struct at91_mmc_data mmc_data;
204 205
205static struct resource mmc_resources[] = { 206static struct resource mmc_resources[] = {
@@ -220,7 +221,7 @@ static struct platform_device at91sam9260_mmc_device = {
220 .id = -1, 221 .id = -1,
221 .dev = { 222 .dev = {
222 .dma_mask = &mmc_dmamask, 223 .dma_mask = &mmc_dmamask,
223 .coherent_dma_mask = 0xffffffff, 224 .coherent_dma_mask = DMA_BIT_MASK(32),
224 .platform_data = &mmc_data, 225 .platform_data = &mmc_data,
225 }, 226 },
226 .resource = mmc_resources, 227 .resource = mmc_resources,
@@ -289,7 +290,7 @@ static struct at91_nand_data nand_data;
289static struct resource nand_resources[] = { 290static struct resource nand_resources[] = {
290 { 291 {
291 .start = NAND_BASE, 292 .start = NAND_BASE,
292 .end = NAND_BASE + SZ_8M - 1, 293 .end = NAND_BASE + SZ_256M - 1,
293 .flags = IORESOURCE_MEM, 294 .flags = IORESOURCE_MEM,
294 } 295 }
295}; 296};
@@ -312,7 +313,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
312 return; 313 return;
313 314
314 csa = at91_sys_read(AT91_MATRIX_EBICSA); 315 csa = at91_sys_read(AT91_MATRIX_EBICSA);
315 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC); 316 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
316 317
317 /* set the bus interface characteristics */ 318 /* set the bus interface characteristics */
318 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 319 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
@@ -431,7 +432,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
431 * -------------------------------------------------------------------- */ 432 * -------------------------------------------------------------------- */
432 433
433#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) 434#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
434static u64 spi_dmamask = 0xffffffffUL; 435static u64 spi_dmamask = DMA_BIT_MASK(32);
435 436
436static struct resource spi0_resources[] = { 437static struct resource spi0_resources[] = {
437 [0] = { 438 [0] = {
@@ -451,7 +452,7 @@ static struct platform_device at91sam9260_spi0_device = {
451 .id = 0, 452 .id = 0,
452 .dev = { 453 .dev = {
453 .dma_mask = &spi_dmamask, 454 .dma_mask = &spi_dmamask,
454 .coherent_dma_mask = 0xffffffff, 455 .coherent_dma_mask = DMA_BIT_MASK(32),
455 }, 456 },
456 .resource = spi0_resources, 457 .resource = spi0_resources,
457 .num_resources = ARRAY_SIZE(spi0_resources), 458 .num_resources = ARRAY_SIZE(spi0_resources),
@@ -477,7 +478,7 @@ static struct platform_device at91sam9260_spi1_device = {
477 .id = 1, 478 .id = 1,
478 .dev = { 479 .dev = {
479 .dma_mask = &spi_dmamask, 480 .dma_mask = &spi_dmamask,
480 .coherent_dma_mask = 0xffffffff, 481 .coherent_dma_mask = DMA_BIT_MASK(32),
481 }, 482 },
482 .resource = spi1_resources, 483 .resource = spi1_resources,
483 .num_resources = ARRAY_SIZE(spi1_resources), 484 .num_resources = ARRAY_SIZE(spi1_resources),
@@ -539,24 +540,126 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
539 540
540 541
541/* -------------------------------------------------------------------- 542/* --------------------------------------------------------------------
542 * LEDs 543 * RTT
543 * -------------------------------------------------------------------- */ 544 * -------------------------------------------------------------------- */
544 545
545#if defined(CONFIG_LEDS) 546static struct resource rtt_resources[] = {
546u8 at91_leds_cpu; 547 {
547u8 at91_leds_timer; 548 .start = AT91_BASE_SYS + AT91_RTT,
549 .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
550 .flags = IORESOURCE_MEM,
551 }
552};
548 553
549void __init at91_init_leds(u8 cpu_led, u8 timer_led) 554static struct platform_device at91sam9260_rtt_device = {
555 .name = "at91_rtt",
556 .id = -1,
557 .resource = rtt_resources,
558 .num_resources = ARRAY_SIZE(rtt_resources),
559};
560
561static void __init at91_add_device_rtt(void)
550{ 562{
551 /* Enable GPIO to access the LEDs */ 563 platform_device_register(&at91sam9260_rtt_device);
552 at91_set_gpio_output(cpu_led, 1); 564}
553 at91_set_gpio_output(timer_led, 1); 565
554 566
555 at91_leds_cpu = cpu_led; 567/* --------------------------------------------------------------------
556 at91_leds_timer = timer_led; 568 * Watchdog
569 * -------------------------------------------------------------------- */
570
571#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
572static struct platform_device at91sam9260_wdt_device = {
573 .name = "at91_wdt",
574 .id = -1,
575 .num_resources = 0,
576};
577
578static void __init at91_add_device_watchdog(void)
579{
580 platform_device_register(&at91sam9260_wdt_device);
557} 581}
558#else 582#else
559void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} 583static void __init at91_add_device_watchdog(void) {}
584#endif
585
586
587/* --------------------------------------------------------------------
588 * SSC -- Synchronous Serial Controller
589 * -------------------------------------------------------------------- */
590
591#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
592static u64 ssc_dmamask = DMA_BIT_MASK(32);
593
594static struct resource ssc_resources[] = {
595 [0] = {
596 .start = AT91SAM9260_BASE_SSC,
597 .end = AT91SAM9260_BASE_SSC + SZ_16K - 1,
598 .flags = IORESOURCE_MEM,
599 },
600 [1] = {
601 .start = AT91SAM9260_ID_SSC,
602 .end = AT91SAM9260_ID_SSC,
603 .flags = IORESOURCE_IRQ,
604 },
605};
606
607static struct platform_device at91sam9260_ssc_device = {
608 .name = "ssc",
609 .id = 0,
610 .dev = {
611 .dma_mask = &ssc_dmamask,
612 .coherent_dma_mask = DMA_BIT_MASK(32),
613 },
614 .resource = ssc_resources,
615 .num_resources = ARRAY_SIZE(ssc_resources),
616};
617
618static inline void configure_ssc_pins(unsigned pins)
619{
620 if (pins & ATMEL_SSC_TF)
621 at91_set_A_periph(AT91_PIN_PB17, 1);
622 if (pins & ATMEL_SSC_TK)
623 at91_set_A_periph(AT91_PIN_PB16, 1);
624 if (pins & ATMEL_SSC_TD)
625 at91_set_A_periph(AT91_PIN_PB18, 1);
626 if (pins & ATMEL_SSC_RD)
627 at91_set_A_periph(AT91_PIN_PB19, 1);
628 if (pins & ATMEL_SSC_RK)
629 at91_set_A_periph(AT91_PIN_PB20, 1);
630 if (pins & ATMEL_SSC_RF)
631 at91_set_A_periph(AT91_PIN_PB21, 1);
632}
633
634/*
635 * SSC controllers are accessed through library code, instead of any
636 * kind of all-singing/all-dancing driver. For example one could be
637 * used by a particular I2S audio codec's driver, while another one
638 * on the same system might be used by a custom data capture driver.
639 */
640void __init at91_add_device_ssc(unsigned id, unsigned pins)
641{
642 struct platform_device *pdev;
643
644 /*
645 * NOTE: caller is responsible for passing information matching
646 * "pins" to whatever will be using each particular controller.
647 */
648 switch (id) {
649 case AT91SAM9260_ID_SSC:
650 pdev = &at91sam9260_ssc_device;
651 configure_ssc_pins(pins);
652 at91_clock_associate("ssc_clk", &pdev->dev, "pclk");
653 break;
654 default:
655 return;
656 }
657
658 platform_device_register(pdev);
659}
660
661#else
662void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
560#endif 663#endif
561 664
562 665
@@ -583,12 +686,15 @@ static struct atmel_uart_data dbgu_data = {
583 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), 686 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
584}; 687};
585 688
689static u64 dbgu_dmamask = DMA_BIT_MASK(32);
690
586static struct platform_device at91sam9260_dbgu_device = { 691static struct platform_device at91sam9260_dbgu_device = {
587 .name = "atmel_usart", 692 .name = "atmel_usart",
588 .id = 0, 693 .id = 0,
589 .dev = { 694 .dev = {
590 .platform_data = &dbgu_data, 695 .dma_mask = &dbgu_dmamask,
591 .coherent_dma_mask = 0xffffffff, 696 .coherent_dma_mask = DMA_BIT_MASK(32),
697 .platform_data = &dbgu_data,
592 }, 698 },
593 .resource = dbgu_resources, 699 .resource = dbgu_resources,
594 .num_resources = ARRAY_SIZE(dbgu_resources), 700 .num_resources = ARRAY_SIZE(dbgu_resources),
@@ -618,27 +724,37 @@ static struct atmel_uart_data uart0_data = {
618 .use_dma_rx = 1, 724 .use_dma_rx = 1,
619}; 725};
620 726
727static u64 uart0_dmamask = DMA_BIT_MASK(32);
728
621static struct platform_device at91sam9260_uart0_device = { 729static struct platform_device at91sam9260_uart0_device = {
622 .name = "atmel_usart", 730 .name = "atmel_usart",
623 .id = 1, 731 .id = 1,
624 .dev = { 732 .dev = {
625 .platform_data = &uart0_data, 733 .dma_mask = &uart0_dmamask,
626 .coherent_dma_mask = 0xffffffff, 734 .coherent_dma_mask = DMA_BIT_MASK(32),
735 .platform_data = &uart0_data,
627 }, 736 },
628 .resource = uart0_resources, 737 .resource = uart0_resources,
629 .num_resources = ARRAY_SIZE(uart0_resources), 738 .num_resources = ARRAY_SIZE(uart0_resources),
630}; 739};
631 740
632static inline void configure_usart0_pins(void) 741static inline void configure_usart0_pins(unsigned pins)
633{ 742{
634 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ 743 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
635 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ 744 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
636 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */ 745
637 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */ 746 if (pins & ATMEL_UART_RTS)
638 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */ 747 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */
639 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */ 748 if (pins & ATMEL_UART_CTS)
640 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */ 749 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */
641 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */ 750 if (pins & ATMEL_UART_DTR)
751 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */
752 if (pins & ATMEL_UART_DSR)
753 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */
754 if (pins & ATMEL_UART_DCD)
755 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
756 if (pins & ATMEL_UART_RI)
757 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
642} 758}
643 759
644static struct resource uart1_resources[] = { 760static struct resource uart1_resources[] = {
@@ -659,23 +775,29 @@ static struct atmel_uart_data uart1_data = {
659 .use_dma_rx = 1, 775 .use_dma_rx = 1,
660}; 776};
661 777
778static u64 uart1_dmamask = DMA_BIT_MASK(32);
779
662static struct platform_device at91sam9260_uart1_device = { 780static struct platform_device at91sam9260_uart1_device = {
663 .name = "atmel_usart", 781 .name = "atmel_usart",
664 .id = 2, 782 .id = 2,
665 .dev = { 783 .dev = {
666 .platform_data = &uart1_data, 784 .dma_mask = &uart1_dmamask,
667 .coherent_dma_mask = 0xffffffff, 785 .coherent_dma_mask = DMA_BIT_MASK(32),
786 .platform_data = &uart1_data,
668 }, 787 },
669 .resource = uart1_resources, 788 .resource = uart1_resources,
670 .num_resources = ARRAY_SIZE(uart1_resources), 789 .num_resources = ARRAY_SIZE(uart1_resources),
671}; 790};
672 791
673static inline void configure_usart1_pins(void) 792static inline void configure_usart1_pins(unsigned pins)
674{ 793{
675 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ 794 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
676 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ 795 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
677 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */ 796
678 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */ 797 if (pins & ATMEL_UART_RTS)
798 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
799 if (pins & ATMEL_UART_CTS)
800 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
679} 801}
680 802
681static struct resource uart2_resources[] = { 803static struct resource uart2_resources[] = {
@@ -696,21 +818,29 @@ static struct atmel_uart_data uart2_data = {
696 .use_dma_rx = 1, 818 .use_dma_rx = 1,
697}; 819};
698 820
821static u64 uart2_dmamask = DMA_BIT_MASK(32);
822
699static struct platform_device at91sam9260_uart2_device = { 823static struct platform_device at91sam9260_uart2_device = {
700 .name = "atmel_usart", 824 .name = "atmel_usart",
701 .id = 3, 825 .id = 3,
702 .dev = { 826 .dev = {
703 .platform_data = &uart2_data, 827 .dma_mask = &uart2_dmamask,
704 .coherent_dma_mask = 0xffffffff, 828 .coherent_dma_mask = DMA_BIT_MASK(32),
829 .platform_data = &uart2_data,
705 }, 830 },
706 .resource = uart2_resources, 831 .resource = uart2_resources,
707 .num_resources = ARRAY_SIZE(uart2_resources), 832 .num_resources = ARRAY_SIZE(uart2_resources),
708}; 833};
709 834
710static inline void configure_usart2_pins(void) 835static inline void configure_usart2_pins(unsigned pins)
711{ 836{
712 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ 837 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
713 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ 838 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
839
840 if (pins & ATMEL_UART_RTS)
841 at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */
842 if (pins & ATMEL_UART_CTS)
843 at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */
714} 844}
715 845
716static struct resource uart3_resources[] = { 846static struct resource uart3_resources[] = {
@@ -731,21 +861,29 @@ static struct atmel_uart_data uart3_data = {
731 .use_dma_rx = 1, 861 .use_dma_rx = 1,
732}; 862};
733 863
864static u64 uart3_dmamask = DMA_BIT_MASK(32);
865
734static struct platform_device at91sam9260_uart3_device = { 866static struct platform_device at91sam9260_uart3_device = {
735 .name = "atmel_usart", 867 .name = "atmel_usart",
736 .id = 4, 868 .id = 4,
737 .dev = { 869 .dev = {
738 .platform_data = &uart3_data, 870 .dma_mask = &uart3_dmamask,
739 .coherent_dma_mask = 0xffffffff, 871 .coherent_dma_mask = DMA_BIT_MASK(32),
872 .platform_data = &uart3_data,
740 }, 873 },
741 .resource = uart3_resources, 874 .resource = uart3_resources,
742 .num_resources = ARRAY_SIZE(uart3_resources), 875 .num_resources = ARRAY_SIZE(uart3_resources),
743}; 876};
744 877
745static inline void configure_usart3_pins(void) 878static inline void configure_usart3_pins(unsigned pins)
746{ 879{
747 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */ 880 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
748 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */ 881 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
882
883 if (pins & ATMEL_UART_RTS)
884 at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */
885 if (pins & ATMEL_UART_CTS)
886 at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */
749} 887}
750 888
751static struct resource uart4_resources[] = { 889static struct resource uart4_resources[] = {
@@ -766,12 +904,15 @@ static struct atmel_uart_data uart4_data = {
766 .use_dma_rx = 1, 904 .use_dma_rx = 1,
767}; 905};
768 906
907static u64 uart4_dmamask = DMA_BIT_MASK(32);
908
769static struct platform_device at91sam9260_uart4_device = { 909static struct platform_device at91sam9260_uart4_device = {
770 .name = "atmel_usart", 910 .name = "atmel_usart",
771 .id = 5, 911 .id = 5,
772 .dev = { 912 .dev = {
773 .platform_data = &uart4_data, 913 .dma_mask = &uart4_dmamask,
774 .coherent_dma_mask = 0xffffffff, 914 .coherent_dma_mask = DMA_BIT_MASK(32),
915 .platform_data = &uart4_data,
775 }, 916 },
776 .resource = uart4_resources, 917 .resource = uart4_resources,
777 .num_resources = ARRAY_SIZE(uart4_resources), 918 .num_resources = ARRAY_SIZE(uart4_resources),
@@ -801,12 +942,15 @@ static struct atmel_uart_data uart5_data = {
801 .use_dma_rx = 1, 942 .use_dma_rx = 1,
802}; 943};
803 944
945static u64 uart5_dmamask = DMA_BIT_MASK(32);
946
804static struct platform_device at91sam9260_uart5_device = { 947static struct platform_device at91sam9260_uart5_device = {
805 .name = "atmel_usart", 948 .name = "atmel_usart",
806 .id = 6, 949 .id = 6,
807 .dev = { 950 .dev = {
808 .platform_data = &uart5_data, 951 .dma_mask = &uart5_dmamask,
809 .coherent_dma_mask = 0xffffffff, 952 .coherent_dma_mask = DMA_BIT_MASK(32),
953 .platform_data = &uart5_data,
810 }, 954 },
811 .resource = uart5_resources, 955 .resource = uart5_resources,
812 .num_resources = ARRAY_SIZE(uart5_resources), 956 .num_resources = ARRAY_SIZE(uart5_resources),
@@ -818,10 +962,10 @@ static inline void configure_usart5_pins(void)
818 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */ 962 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
819} 963}
820 964
821struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 965static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
822struct platform_device *atmel_default_console_device; /* the serial console device */ 966struct platform_device *atmel_default_console_device; /* the serial console device */
823 967
824void __init at91_init_serial(struct at91_uart_config *config) 968void __init __deprecated at91_init_serial(struct at91_uart_config *config)
825{ 969{
826 int i; 970 int i;
827 971
@@ -829,22 +973,22 @@ void __init at91_init_serial(struct at91_uart_config *config)
829 for (i = 0; i < config->nr_tty; i++) { 973 for (i = 0; i < config->nr_tty; i++) {
830 switch (config->tty_map[i]) { 974 switch (config->tty_map[i]) {
831 case 0: 975 case 0:
832 configure_usart0_pins(); 976 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI);
833 at91_uarts[i] = &at91sam9260_uart0_device; 977 at91_uarts[i] = &at91sam9260_uart0_device;
834 at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart"); 978 at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart");
835 break; 979 break;
836 case 1: 980 case 1:
837 configure_usart1_pins(); 981 configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
838 at91_uarts[i] = &at91sam9260_uart1_device; 982 at91_uarts[i] = &at91sam9260_uart1_device;
839 at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart"); 983 at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart");
840 break; 984 break;
841 case 2: 985 case 2:
842 configure_usart2_pins(); 986 configure_usart2_pins(0);
843 at91_uarts[i] = &at91sam9260_uart2_device; 987 at91_uarts[i] = &at91sam9260_uart2_device;
844 at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart"); 988 at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart");
845 break; 989 break;
846 case 3: 990 case 3:
847 configure_usart3_pins(); 991 configure_usart3_pins(0);
848 at91_uarts[i] = &at91sam9260_uart3_device; 992 at91_uarts[i] = &at91sam9260_uart3_device;
849 at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart"); 993 at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart");
850 break; 994 break;
@@ -876,6 +1020,63 @@ void __init at91_init_serial(struct at91_uart_config *config)
876 printk(KERN_INFO "AT91: No default serial console defined.\n"); 1020 printk(KERN_INFO "AT91: No default serial console defined.\n");
877} 1021}
878 1022
1023void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1024{
1025 struct platform_device *pdev;
1026
1027 switch (id) {
1028 case 0: /* DBGU */
1029 pdev = &at91sam9260_dbgu_device;
1030 configure_dbgu_pins();
1031 at91_clock_associate("mck", &pdev->dev, "usart");
1032 break;
1033 case AT91SAM9260_ID_US0:
1034 pdev = &at91sam9260_uart0_device;
1035 configure_usart0_pins(pins);
1036 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
1037 break;
1038 case AT91SAM9260_ID_US1:
1039 pdev = &at91sam9260_uart1_device;
1040 configure_usart1_pins(pins);
1041 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
1042 break;
1043 case AT91SAM9260_ID_US2:
1044 pdev = &at91sam9260_uart2_device;
1045 configure_usart2_pins(pins);
1046 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
1047 break;
1048 case AT91SAM9260_ID_US3:
1049 pdev = &at91sam9260_uart3_device;
1050 configure_usart3_pins(pins);
1051 at91_clock_associate("usart3_clk", &pdev->dev, "usart");
1052 break;
1053 case AT91SAM9260_ID_US4:
1054 pdev = &at91sam9260_uart4_device;
1055 configure_usart4_pins();
1056 at91_clock_associate("usart4_clk", &pdev->dev, "usart");
1057 break;
1058 case AT91SAM9260_ID_US5:
1059 pdev = &at91sam9260_uart5_device;
1060 configure_usart5_pins();
1061 at91_clock_associate("usart5_clk", &pdev->dev, "usart");
1062 break;
1063 default:
1064 return;
1065 }
1066 pdev->id = portnr; /* update to mapped ID */
1067
1068 if (portnr < ATMEL_MAX_UART)
1069 at91_uarts[portnr] = pdev;
1070}
1071
1072void __init at91_set_serial_console(unsigned portnr)
1073{
1074 if (portnr < ATMEL_MAX_UART)
1075 atmel_default_console_device = at91_uarts[portnr];
1076 if (!atmel_default_console_device)
1077 printk(KERN_INFO "AT91: No default serial console defined.\n");
1078}
1079
879void __init at91_add_device_serial(void) 1080void __init at91_add_device_serial(void)
880{ 1081{
881 int i; 1082 int i;
@@ -886,7 +1087,9 @@ void __init at91_add_device_serial(void)
886 } 1087 }
887} 1088}
888#else 1089#else
889void __init at91_init_serial(struct at91_uart_config *config) {} 1090void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1091void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1092void __init at91_set_serial_console(unsigned portnr) {}
890void __init at91_add_device_serial(void) {} 1093void __init at91_add_device_serial(void) {}
891#endif 1094#endif
892 1095
@@ -898,6 +1101,8 @@ void __init at91_add_device_serial(void) {}
898 */ 1101 */
899static int __init at91_add_standard_devices(void) 1102static int __init at91_add_standard_devices(void)
900{ 1103{
1104 at91_add_device_rtt();
1105 at91_add_device_watchdog();
901 return 0; 1106 return 0;
902} 1107}
903 1108
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index dfe8c39c9fb9..90b87e1877d9 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -279,25 +279,25 @@ void __init at91sam9261_initialize(unsigned long main_clock)
279static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { 279static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
280 7, /* Advanced Interrupt Controller */ 280 7, /* Advanced Interrupt Controller */
281 7, /* System Peripherals */ 281 7, /* System Peripherals */
282 0, /* Parallel IO Controller A */ 282 1, /* Parallel IO Controller A */
283 0, /* Parallel IO Controller B */ 283 1, /* Parallel IO Controller B */
284 0, /* Parallel IO Controller C */ 284 1, /* Parallel IO Controller C */
285 0, 285 0,
286 6, /* USART 0 */ 286 5, /* USART 0 */
287 6, /* USART 1 */ 287 5, /* USART 1 */
288 6, /* USART 2 */ 288 5, /* USART 2 */
289 0, /* Multimedia Card Interface */ 289 0, /* Multimedia Card Interface */
290 4, /* USB Device Port */ 290 2, /* USB Device Port */
291 0, /* Two-Wire Interface */ 291 6, /* Two-Wire Interface */
292 6, /* Serial Peripheral Interface 0 */ 292 5, /* Serial Peripheral Interface 0 */
293 6, /* Serial Peripheral Interface 1 */ 293 5, /* Serial Peripheral Interface 1 */
294 5, /* Serial Synchronous Controller 0 */ 294 4, /* Serial Synchronous Controller 0 */
295 5, /* Serial Synchronous Controller 1 */ 295 4, /* Serial Synchronous Controller 1 */
296 5, /* Serial Synchronous Controller 2 */ 296 4, /* Serial Synchronous Controller 2 */
297 0, /* Timer Counter 0 */ 297 0, /* Timer Counter 0 */
298 0, /* Timer Counter 1 */ 298 0, /* Timer Counter 1 */
299 0, /* Timer Counter 2 */ 299 0, /* Timer Counter 2 */
300 3, /* USB Host port */ 300 2, /* USB Host port */
301 3, /* LCD Controller */ 301 3, /* LCD Controller */
302 0, 302 0,
303 0, 303 0,
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 64979a9023c2..245641263fce 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/arch.h> 13#include <asm/mach/arch.h>
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/dma-mapping.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18 19
@@ -33,7 +34,7 @@
33 * -------------------------------------------------------------------- */ 34 * -------------------------------------------------------------------- */
34 35
35#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 36#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
36static u64 ohci_dmamask = 0xffffffffUL; 37static u64 ohci_dmamask = DMA_BIT_MASK(32);
37static struct at91_usbh_data usbh_data; 38static struct at91_usbh_data usbh_data;
38 39
39static struct resource usbh_resources[] = { 40static struct resource usbh_resources[] = {
@@ -54,7 +55,7 @@ static struct platform_device at91sam9261_usbh_device = {
54 .id = -1, 55 .id = -1,
55 .dev = { 56 .dev = {
56 .dma_mask = &ohci_dmamask, 57 .dma_mask = &ohci_dmamask,
57 .coherent_dma_mask = 0xffffffff, 58 .coherent_dma_mask = DMA_BIT_MASK(32),
58 .platform_data = &usbh_data, 59 .platform_data = &usbh_data,
59 }, 60 },
60 .resource = usbh_resources, 61 .resource = usbh_resources,
@@ -106,8 +107,6 @@ static struct platform_device at91sam9261_udc_device = {
106 107
107void __init at91_add_device_udc(struct at91_udc_data *data) 108void __init at91_add_device_udc(struct at91_udc_data *data)
108{ 109{
109 unsigned long x;
110
111 if (!data) 110 if (!data)
112 return; 111 return;
113 112
@@ -116,9 +115,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
116 at91_set_deglitch(data->vbus_pin, 1); 115 at91_set_deglitch(data->vbus_pin, 1);
117 } 116 }
118 117
119 /* Pullup pin is handled internally */ 118 /* Pullup pin is handled internally by USB device peripheral */
120 x = at91_sys_read(AT91_MATRIX_USBPUCR);
121 at91_sys_write(AT91_MATRIX_USBPUCR, x | AT91_MATRIX_USBPUCR_PUON);
122 119
123 udc_data = *data; 120 udc_data = *data;
124 platform_device_register(&at91sam9261_udc_device); 121 platform_device_register(&at91sam9261_udc_device);
@@ -132,7 +129,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
132 * -------------------------------------------------------------------- */ 129 * -------------------------------------------------------------------- */
133 130
134#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 131#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
135static u64 mmc_dmamask = 0xffffffffUL; 132static u64 mmc_dmamask = DMA_BIT_MASK(32);
136static struct at91_mmc_data mmc_data; 133static struct at91_mmc_data mmc_data;
137 134
138static struct resource mmc_resources[] = { 135static struct resource mmc_resources[] = {
@@ -153,7 +150,7 @@ static struct platform_device at91sam9261_mmc_device = {
153 .id = -1, 150 .id = -1,
154 .dev = { 151 .dev = {
155 .dma_mask = &mmc_dmamask, 152 .dma_mask = &mmc_dmamask,
156 .coherent_dma_mask = 0xffffffff, 153 .coherent_dma_mask = DMA_BIT_MASK(32),
157 .platform_data = &mmc_data, 154 .platform_data = &mmc_data,
158 }, 155 },
159 .resource = mmc_resources, 156 .resource = mmc_resources,
@@ -232,7 +229,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
232 return; 229 return;
233 230
234 csa = at91_sys_read(AT91_MATRIX_EBICSA); 231 csa = at91_sys_read(AT91_MATRIX_EBICSA);
235 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC); 232 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
236 233
237 /* set the bus interface characteristics */ 234 /* set the bus interface characteristics */
238 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 235 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
@@ -354,7 +351,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
354 * -------------------------------------------------------------------- */ 351 * -------------------------------------------------------------------- */
355 352
356#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) 353#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
357static u64 spi_dmamask = 0xffffffffUL; 354static u64 spi_dmamask = DMA_BIT_MASK(32);
358 355
359static struct resource spi0_resources[] = { 356static struct resource spi0_resources[] = {
360 [0] = { 357 [0] = {
@@ -374,7 +371,7 @@ static struct platform_device at91sam9261_spi0_device = {
374 .id = 0, 371 .id = 0,
375 .dev = { 372 .dev = {
376 .dma_mask = &spi_dmamask, 373 .dma_mask = &spi_dmamask,
377 .coherent_dma_mask = 0xffffffff, 374 .coherent_dma_mask = DMA_BIT_MASK(32),
378 }, 375 },
379 .resource = spi0_resources, 376 .resource = spi0_resources,
380 .num_resources = ARRAY_SIZE(spi0_resources), 377 .num_resources = ARRAY_SIZE(spi0_resources),
@@ -400,7 +397,7 @@ static struct platform_device at91sam9261_spi1_device = {
400 .id = 1, 397 .id = 1,
401 .dev = { 398 .dev = {
402 .dma_mask = &spi_dmamask, 399 .dma_mask = &spi_dmamask,
403 .coherent_dma_mask = 0xffffffff, 400 .coherent_dma_mask = DMA_BIT_MASK(32),
404 }, 401 },
405 .resource = spi1_resources, 402 .resource = spi1_resources,
406 .num_resources = ARRAY_SIZE(spi1_resources), 403 .num_resources = ARRAY_SIZE(spi1_resources),
@@ -466,7 +463,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
466 * -------------------------------------------------------------------- */ 463 * -------------------------------------------------------------------- */
467 464
468#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 465#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
469static u64 lcdc_dmamask = 0xffffffffUL; 466static u64 lcdc_dmamask = DMA_BIT_MASK(32);
470static struct atmel_lcdfb_info lcdc_data; 467static struct atmel_lcdfb_info lcdc_data;
471 468
472static struct resource lcdc_resources[] = { 469static struct resource lcdc_resources[] = {
@@ -494,7 +491,7 @@ static struct platform_device at91_lcdc_device = {
494 .id = 0, 491 .id = 0,
495 .dev = { 492 .dev = {
496 .dma_mask = &lcdc_dmamask, 493 .dma_mask = &lcdc_dmamask,
497 .coherent_dma_mask = 0xffffffff, 494 .coherent_dma_mask = DMA_BIT_MASK(32),
498 .platform_data = &lcdc_data, 495 .platform_data = &lcdc_data,
499 }, 496 },
500 .resource = lcdc_resources, 497 .resource = lcdc_resources,
@@ -507,6 +504,17 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
507 return; 504 return;
508 } 505 }
509 506
507#if defined(CONFIG_FB_ATMEL_STN)
508 at91_set_A_periph(AT91_PIN_PB0, 0); /* LCDVSYNC */
509 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */
510 at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */
511 at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */
512 at91_set_A_periph(AT91_PIN_PB4, 0); /* LCDCC */
513 at91_set_A_periph(AT91_PIN_PB5, 0); /* LCDD0 */
514 at91_set_A_periph(AT91_PIN_PB6, 0); /* LCDD1 */
515 at91_set_A_periph(AT91_PIN_PB7, 0); /* LCDD2 */
516 at91_set_A_periph(AT91_PIN_PB8, 0); /* LCDD3 */
517#else
510 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */ 518 at91_set_A_periph(AT91_PIN_PB1, 0); /* LCDHSYNC */
511 at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */ 519 at91_set_A_periph(AT91_PIN_PB2, 0); /* LCDDOTCK */
512 at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */ 520 at91_set_A_periph(AT91_PIN_PB3, 0); /* LCDDEN */
@@ -529,6 +537,7 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data)
529 at91_set_B_periph(AT91_PIN_PB26, 0); /* LCDD21 */ 537 at91_set_B_periph(AT91_PIN_PB26, 0); /* LCDD21 */
530 at91_set_B_periph(AT91_PIN_PB27, 0); /* LCDD22 */ 538 at91_set_B_periph(AT91_PIN_PB27, 0); /* LCDD22 */
531 at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */ 539 at91_set_B_periph(AT91_PIN_PB28, 0); /* LCDD23 */
540#endif
532 541
533 lcdc_data = *data; 542 lcdc_data = *data;
534 platform_device_register(&at91_lcdc_device); 543 platform_device_register(&at91_lcdc_device);
@@ -539,24 +548,220 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
539 548
540 549
541/* -------------------------------------------------------------------- 550/* --------------------------------------------------------------------
542 * LEDs 551 * RTT
552 * -------------------------------------------------------------------- */
553
554static struct resource rtt_resources[] = {
555 {
556 .start = AT91_BASE_SYS + AT91_RTT,
557 .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
558 .flags = IORESOURCE_MEM,
559 }
560};
561
562static struct platform_device at91sam9261_rtt_device = {
563 .name = "at91_rtt",
564 .id = -1,
565 .resource = rtt_resources,
566 .num_resources = ARRAY_SIZE(rtt_resources),
567};
568
569static void __init at91_add_device_rtt(void)
570{
571 platform_device_register(&at91sam9261_rtt_device);
572}
573
574
575/* --------------------------------------------------------------------
576 * Watchdog
577 * -------------------------------------------------------------------- */
578
579#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
580static struct platform_device at91sam9261_wdt_device = {
581 .name = "at91_wdt",
582 .id = -1,
583 .num_resources = 0,
584};
585
586static void __init at91_add_device_watchdog(void)
587{
588 platform_device_register(&at91sam9261_wdt_device);
589}
590#else
591static void __init at91_add_device_watchdog(void) {}
592#endif
593
594
595/* --------------------------------------------------------------------
596 * SSC -- Synchronous Serial Controller
543 * -------------------------------------------------------------------- */ 597 * -------------------------------------------------------------------- */
544 598
545#if defined(CONFIG_LEDS) 599#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
546u8 at91_leds_cpu; 600static u64 ssc0_dmamask = DMA_BIT_MASK(32);
547u8 at91_leds_timer; 601
602static struct resource ssc0_resources[] = {
603 [0] = {
604 .start = AT91SAM9261_BASE_SSC0,
605 .end = AT91SAM9261_BASE_SSC0 + SZ_16K - 1,
606 .flags = IORESOURCE_MEM,
607 },
608 [1] = {
609 .start = AT91SAM9261_ID_SSC0,
610 .end = AT91SAM9261_ID_SSC0,
611 .flags = IORESOURCE_IRQ,
612 },
613};
614
615static struct platform_device at91sam9261_ssc0_device = {
616 .name = "ssc",
617 .id = 0,
618 .dev = {
619 .dma_mask = &ssc0_dmamask,
620 .coherent_dma_mask = DMA_BIT_MASK(32),
621 },
622 .resource = ssc0_resources,
623 .num_resources = ARRAY_SIZE(ssc0_resources),
624};
625
626static inline void configure_ssc0_pins(unsigned pins)
627{
628 if (pins & ATMEL_SSC_TF)
629 at91_set_A_periph(AT91_PIN_PB21, 1);
630 if (pins & ATMEL_SSC_TK)
631 at91_set_A_periph(AT91_PIN_PB22, 1);
632 if (pins & ATMEL_SSC_TD)
633 at91_set_A_periph(AT91_PIN_PB23, 1);
634 if (pins & ATMEL_SSC_RD)
635 at91_set_A_periph(AT91_PIN_PB24, 1);
636 if (pins & ATMEL_SSC_RK)
637 at91_set_A_periph(AT91_PIN_PB25, 1);
638 if (pins & ATMEL_SSC_RF)
639 at91_set_A_periph(AT91_PIN_PB26, 1);
640}
641
642static u64 ssc1_dmamask = DMA_BIT_MASK(32);
643
644static struct resource ssc1_resources[] = {
645 [0] = {
646 .start = AT91SAM9261_BASE_SSC1,
647 .end = AT91SAM9261_BASE_SSC1 + SZ_16K - 1,
648 .flags = IORESOURCE_MEM,
649 },
650 [1] = {
651 .start = AT91SAM9261_ID_SSC1,
652 .end = AT91SAM9261_ID_SSC1,
653 .flags = IORESOURCE_IRQ,
654 },
655};
656
657static struct platform_device at91sam9261_ssc1_device = {
658 .name = "ssc",
659 .id = 1,
660 .dev = {
661 .dma_mask = &ssc1_dmamask,
662 .coherent_dma_mask = DMA_BIT_MASK(32),
663 },
664 .resource = ssc1_resources,
665 .num_resources = ARRAY_SIZE(ssc1_resources),
666};
667
668static inline void configure_ssc1_pins(unsigned pins)
669{
670 if (pins & ATMEL_SSC_TF)
671 at91_set_B_periph(AT91_PIN_PA17, 1);
672 if (pins & ATMEL_SSC_TK)
673 at91_set_B_periph(AT91_PIN_PA18, 1);
674 if (pins & ATMEL_SSC_TD)
675 at91_set_B_periph(AT91_PIN_PA19, 1);
676 if (pins & ATMEL_SSC_RD)
677 at91_set_B_periph(AT91_PIN_PA20, 1);
678 if (pins & ATMEL_SSC_RK)
679 at91_set_B_periph(AT91_PIN_PA21, 1);
680 if (pins & ATMEL_SSC_RF)
681 at91_set_B_periph(AT91_PIN_PA22, 1);
682}
683
684static u64 ssc2_dmamask = DMA_BIT_MASK(32);
685
686static struct resource ssc2_resources[] = {
687 [0] = {
688 .start = AT91SAM9261_BASE_SSC2,
689 .end = AT91SAM9261_BASE_SSC2 + SZ_16K - 1,
690 .flags = IORESOURCE_MEM,
691 },
692 [1] = {
693 .start = AT91SAM9261_ID_SSC2,
694 .end = AT91SAM9261_ID_SSC2,
695 .flags = IORESOURCE_IRQ,
696 },
697};
698
699static struct platform_device at91sam9261_ssc2_device = {
700 .name = "ssc",
701 .id = 2,
702 .dev = {
703 .dma_mask = &ssc2_dmamask,
704 .coherent_dma_mask = DMA_BIT_MASK(32),
705 },
706 .resource = ssc2_resources,
707 .num_resources = ARRAY_SIZE(ssc2_resources),
708};
709
710static inline void configure_ssc2_pins(unsigned pins)
711{
712 if (pins & ATMEL_SSC_TF)
713 at91_set_B_periph(AT91_PIN_PC25, 1);
714 if (pins & ATMEL_SSC_TK)
715 at91_set_B_periph(AT91_PIN_PC26, 1);
716 if (pins & ATMEL_SSC_TD)
717 at91_set_B_periph(AT91_PIN_PC27, 1);
718 if (pins & ATMEL_SSC_RD)
719 at91_set_B_periph(AT91_PIN_PC28, 1);
720 if (pins & ATMEL_SSC_RK)
721 at91_set_B_periph(AT91_PIN_PC29, 1);
722 if (pins & ATMEL_SSC_RF)
723 at91_set_B_periph(AT91_PIN_PC30, 1);
724}
548 725
549void __init at91_init_leds(u8 cpu_led, u8 timer_led) 726/*
727 * SSC controllers are accessed through library code, instead of any
728 * kind of all-singing/all-dancing driver. For example one could be
729 * used by a particular I2S audio codec's driver, while another one
730 * on the same system might be used by a custom data capture driver.
731 */
732void __init at91_add_device_ssc(unsigned id, unsigned pins)
550{ 733{
551 /* Enable GPIO to access the LEDs */ 734 struct platform_device *pdev;
552 at91_set_gpio_output(cpu_led, 1); 735
553 at91_set_gpio_output(timer_led, 1); 736 /*
737 * NOTE: caller is responsible for passing information matching
738 * "pins" to whatever will be using each particular controller.
739 */
740 switch (id) {
741 case AT91SAM9261_ID_SSC0:
742 pdev = &at91sam9261_ssc0_device;
743 configure_ssc0_pins(pins);
744 at91_clock_associate("ssc0_clk", &pdev->dev, "pclk");
745 break;
746 case AT91SAM9261_ID_SSC1:
747 pdev = &at91sam9261_ssc1_device;
748 configure_ssc1_pins(pins);
749 at91_clock_associate("ssc1_clk", &pdev->dev, "pclk");
750 break;
751 case AT91SAM9261_ID_SSC2:
752 pdev = &at91sam9261_ssc2_device;
753 configure_ssc2_pins(pins);
754 at91_clock_associate("ssc2_clk", &pdev->dev, "pclk");
755 break;
756 default:
757 return;
758 }
554 759
555 at91_leds_cpu = cpu_led; 760 platform_device_register(pdev);
556 at91_leds_timer = timer_led;
557} 761}
762
558#else 763#else
559void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} 764void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
560#endif 765#endif
561 766
562 767
@@ -584,12 +789,15 @@ static struct atmel_uart_data dbgu_data = {
584 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), 789 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
585}; 790};
586 791
792static u64 dbgu_dmamask = DMA_BIT_MASK(32);
793
587static struct platform_device at91sam9261_dbgu_device = { 794static struct platform_device at91sam9261_dbgu_device = {
588 .name = "atmel_usart", 795 .name = "atmel_usart",
589 .id = 0, 796 .id = 0,
590 .dev = { 797 .dev = {
591 .platform_data = &dbgu_data, 798 .dma_mask = &dbgu_dmamask,
592 .coherent_dma_mask = 0xffffffff, 799 .coherent_dma_mask = DMA_BIT_MASK(32),
800 .platform_data = &dbgu_data,
593 }, 801 },
594 .resource = dbgu_resources, 802 .resource = dbgu_resources,
595 .num_resources = ARRAY_SIZE(dbgu_resources), 803 .num_resources = ARRAY_SIZE(dbgu_resources),
@@ -619,23 +827,29 @@ static struct atmel_uart_data uart0_data = {
619 .use_dma_rx = 1, 827 .use_dma_rx = 1,
620}; 828};
621 829
830static u64 uart0_dmamask = DMA_BIT_MASK(32);
831
622static struct platform_device at91sam9261_uart0_device = { 832static struct platform_device at91sam9261_uart0_device = {
623 .name = "atmel_usart", 833 .name = "atmel_usart",
624 .id = 1, 834 .id = 1,
625 .dev = { 835 .dev = {
626 .platform_data = &uart0_data, 836 .dma_mask = &uart0_dmamask,
627 .coherent_dma_mask = 0xffffffff, 837 .coherent_dma_mask = DMA_BIT_MASK(32),
838 .platform_data = &uart0_data,
628 }, 839 },
629 .resource = uart0_resources, 840 .resource = uart0_resources,
630 .num_resources = ARRAY_SIZE(uart0_resources), 841 .num_resources = ARRAY_SIZE(uart0_resources),
631}; 842};
632 843
633static inline void configure_usart0_pins(void) 844static inline void configure_usart0_pins(unsigned pins)
634{ 845{
635 at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */ 846 at91_set_A_periph(AT91_PIN_PC8, 1); /* TXD0 */
636 at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */ 847 at91_set_A_periph(AT91_PIN_PC9, 0); /* RXD0 */
637 at91_set_A_periph(AT91_PIN_PC10, 0); /* RTS0 */ 848
638 at91_set_A_periph(AT91_PIN_PC11, 0); /* CTS0 */ 849 if (pins & ATMEL_UART_RTS)
850 at91_set_A_periph(AT91_PIN_PC10, 0); /* RTS0 */
851 if (pins & ATMEL_UART_CTS)
852 at91_set_A_periph(AT91_PIN_PC11, 0); /* CTS0 */
639} 853}
640 854
641static struct resource uart1_resources[] = { 855static struct resource uart1_resources[] = {
@@ -656,21 +870,29 @@ static struct atmel_uart_data uart1_data = {
656 .use_dma_rx = 1, 870 .use_dma_rx = 1,
657}; 871};
658 872
873static u64 uart1_dmamask = DMA_BIT_MASK(32);
874
659static struct platform_device at91sam9261_uart1_device = { 875static struct platform_device at91sam9261_uart1_device = {
660 .name = "atmel_usart", 876 .name = "atmel_usart",
661 .id = 2, 877 .id = 2,
662 .dev = { 878 .dev = {
663 .platform_data = &uart1_data, 879 .dma_mask = &uart1_dmamask,
664 .coherent_dma_mask = 0xffffffff, 880 .coherent_dma_mask = DMA_BIT_MASK(32),
881 .platform_data = &uart1_data,
665 }, 882 },
666 .resource = uart1_resources, 883 .resource = uart1_resources,
667 .num_resources = ARRAY_SIZE(uart1_resources), 884 .num_resources = ARRAY_SIZE(uart1_resources),
668}; 885};
669 886
670static inline void configure_usart1_pins(void) 887static inline void configure_usart1_pins(unsigned pins)
671{ 888{
672 at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */ 889 at91_set_A_periph(AT91_PIN_PC12, 1); /* TXD1 */
673 at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */ 890 at91_set_A_periph(AT91_PIN_PC13, 0); /* RXD1 */
891
892 if (pins & ATMEL_UART_RTS)
893 at91_set_B_periph(AT91_PIN_PA12, 0); /* RTS1 */
894 if (pins & ATMEL_UART_CTS)
895 at91_set_B_periph(AT91_PIN_PA13, 0); /* CTS1 */
674} 896}
675 897
676static struct resource uart2_resources[] = { 898static struct resource uart2_resources[] = {
@@ -691,27 +913,35 @@ static struct atmel_uart_data uart2_data = {
691 .use_dma_rx = 1, 913 .use_dma_rx = 1,
692}; 914};
693 915
916static u64 uart2_dmamask = DMA_BIT_MASK(32);
917
694static struct platform_device at91sam9261_uart2_device = { 918static struct platform_device at91sam9261_uart2_device = {
695 .name = "atmel_usart", 919 .name = "atmel_usart",
696 .id = 3, 920 .id = 3,
697 .dev = { 921 .dev = {
698 .platform_data = &uart2_data, 922 .dma_mask = &uart2_dmamask,
699 .coherent_dma_mask = 0xffffffff, 923 .coherent_dma_mask = DMA_BIT_MASK(32),
924 .platform_data = &uart2_data,
700 }, 925 },
701 .resource = uart2_resources, 926 .resource = uart2_resources,
702 .num_resources = ARRAY_SIZE(uart2_resources), 927 .num_resources = ARRAY_SIZE(uart2_resources),
703}; 928};
704 929
705static inline void configure_usart2_pins(void) 930static inline void configure_usart2_pins(unsigned pins)
706{ 931{
707 at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */ 932 at91_set_A_periph(AT91_PIN_PC15, 0); /* RXD2 */
708 at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */ 933 at91_set_A_periph(AT91_PIN_PC14, 1); /* TXD2 */
934
935 if (pins & ATMEL_UART_RTS)
936 at91_set_B_periph(AT91_PIN_PA15, 0); /* RTS2*/
937 if (pins & ATMEL_UART_CTS)
938 at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */
709} 939}
710 940
711struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 941static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
712struct platform_device *atmel_default_console_device; /* the serial console device */ 942struct platform_device *atmel_default_console_device; /* the serial console device */
713 943
714void __init at91_init_serial(struct at91_uart_config *config) 944void __init __deprecated at91_init_serial(struct at91_uart_config *config)
715{ 945{
716 int i; 946 int i;
717 947
@@ -719,17 +949,17 @@ void __init at91_init_serial(struct at91_uart_config *config)
719 for (i = 0; i < config->nr_tty; i++) { 949 for (i = 0; i < config->nr_tty; i++) {
720 switch (config->tty_map[i]) { 950 switch (config->tty_map[i]) {
721 case 0: 951 case 0:
722 configure_usart0_pins(); 952 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
723 at91_uarts[i] = &at91sam9261_uart0_device; 953 at91_uarts[i] = &at91sam9261_uart0_device;
724 at91_clock_associate("usart0_clk", &at91sam9261_uart0_device.dev, "usart"); 954 at91_clock_associate("usart0_clk", &at91sam9261_uart0_device.dev, "usart");
725 break; 955 break;
726 case 1: 956 case 1:
727 configure_usart1_pins(); 957 configure_usart1_pins(0);
728 at91_uarts[i] = &at91sam9261_uart1_device; 958 at91_uarts[i] = &at91sam9261_uart1_device;
729 at91_clock_associate("usart1_clk", &at91sam9261_uart1_device.dev, "usart"); 959 at91_clock_associate("usart1_clk", &at91sam9261_uart1_device.dev, "usart");
730 break; 960 break;
731 case 2: 961 case 2:
732 configure_usart2_pins(); 962 configure_usart2_pins(0);
733 at91_uarts[i] = &at91sam9261_uart2_device; 963 at91_uarts[i] = &at91sam9261_uart2_device;
734 at91_clock_associate("usart2_clk", &at91sam9261_uart2_device.dev, "usart"); 964 at91_clock_associate("usart2_clk", &at91sam9261_uart2_device.dev, "usart");
735 break; 965 break;
@@ -751,6 +981,48 @@ void __init at91_init_serial(struct at91_uart_config *config)
751 printk(KERN_INFO "AT91: No default serial console defined.\n"); 981 printk(KERN_INFO "AT91: No default serial console defined.\n");
752} 982}
753 983
984void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
985{
986 struct platform_device *pdev;
987
988 switch (id) {
989 case 0: /* DBGU */
990 pdev = &at91sam9261_dbgu_device;
991 configure_dbgu_pins();
992 at91_clock_associate("mck", &pdev->dev, "usart");
993 break;
994 case AT91SAM9261_ID_US0:
995 pdev = &at91sam9261_uart0_device;
996 configure_usart0_pins(pins);
997 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
998 break;
999 case AT91SAM9261_ID_US1:
1000 pdev = &at91sam9261_uart1_device;
1001 configure_usart1_pins(pins);
1002 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
1003 break;
1004 case AT91SAM9261_ID_US2:
1005 pdev = &at91sam9261_uart2_device;
1006 configure_usart2_pins(pins);
1007 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
1008 break;
1009 default:
1010 return;
1011 }
1012 pdev->id = portnr; /* update to mapped ID */
1013
1014 if (portnr < ATMEL_MAX_UART)
1015 at91_uarts[portnr] = pdev;
1016}
1017
1018void __init at91_set_serial_console(unsigned portnr)
1019{
1020 if (portnr < ATMEL_MAX_UART)
1021 atmel_default_console_device = at91_uarts[portnr];
1022 if (!atmel_default_console_device)
1023 printk(KERN_INFO "AT91: No default serial console defined.\n");
1024}
1025
754void __init at91_add_device_serial(void) 1026void __init at91_add_device_serial(void)
755{ 1027{
756 int i; 1028 int i;
@@ -761,7 +1033,9 @@ void __init at91_add_device_serial(void)
761 } 1033 }
762} 1034}
763#else 1035#else
764void __init at91_init_serial(struct at91_uart_config *config) {} 1036void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1037void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1038void __init at91_set_serial_console(unsigned portnr) {}
765void __init at91_add_device_serial(void) {} 1039void __init at91_add_device_serial(void) {}
766#endif 1040#endif
767 1041
@@ -774,6 +1048,8 @@ void __init at91_add_device_serial(void) {}
774 */ 1048 */
775static int __init at91_add_standard_devices(void) 1049static int __init at91_add_standard_devices(void)
776{ 1050{
1051 at91_add_device_rtt();
1052 at91_add_device_watchdog();
777 return 0; 1053 return 0;
778} 1054}
779 1055
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 00e27b177857..a53ba0f74351 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -304,34 +304,34 @@ void __init at91sam9263_initialize(unsigned long main_clock)
304static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { 304static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
305 7, /* Advanced Interrupt Controller (FIQ) */ 305 7, /* Advanced Interrupt Controller (FIQ) */
306 7, /* System Peripherals */ 306 7, /* System Peripherals */
307 0, /* Parallel IO Controller A */ 307 1, /* Parallel IO Controller A */
308 0, /* Parallel IO Controller B */ 308 1, /* Parallel IO Controller B */
309 0, /* Parallel IO Controller C, D and E */ 309 1, /* Parallel IO Controller C, D and E */
310 0, 310 0,
311 0, 311 0,
312 6, /* USART 0 */ 312 5, /* USART 0 */
313 6, /* USART 1 */ 313 5, /* USART 1 */
314 6, /* USART 2 */ 314 5, /* USART 2 */
315 0, /* Multimedia Card Interface 0 */ 315 0, /* Multimedia Card Interface 0 */
316 0, /* Multimedia Card Interface 1 */ 316 0, /* Multimedia Card Interface 1 */
317 4, /* CAN */ 317 3, /* CAN */
318 0, /* Two-Wire Interface */ 318 6, /* Two-Wire Interface */
319 6, /* Serial Peripheral Interface 0 */ 319 5, /* Serial Peripheral Interface 0 */
320 6, /* Serial Peripheral Interface 1 */ 320 5, /* Serial Peripheral Interface 1 */
321 5, /* Serial Synchronous Controller 0 */ 321 4, /* Serial Synchronous Controller 0 */
322 5, /* Serial Synchronous Controller 1 */ 322 4, /* Serial Synchronous Controller 1 */
323 6, /* AC97 Controller */ 323 5, /* AC97 Controller */
324 0, /* Timer Counter 0, 1 and 2 */ 324 0, /* Timer Counter 0, 1 and 2 */
325 0, /* Pulse Width Modulation Controller */ 325 0, /* Pulse Width Modulation Controller */
326 3, /* Ethernet */ 326 3, /* Ethernet */
327 0, 327 0,
328 0, /* 2D Graphic Engine */ 328 0, /* 2D Graphic Engine */
329 3, /* USB Device Port */ 329 2, /* USB Device Port */
330 0, /* Image Sensor Interface */ 330 0, /* Image Sensor Interface */
331 3, /* LDC Controller */ 331 3, /* LDC Controller */
332 0, /* DMA Controller */ 332 0, /* DMA Controller */
333 0, 333 0,
334 3, /* USB Host port */ 334 2, /* USB Host port */
335 0, /* Advanced Interrupt Controller (IRQ0) */ 335 0, /* Advanced Interrupt Controller (IRQ0) */
336 0, /* Advanced Interrupt Controller (IRQ1) */ 336 0, /* Advanced Interrupt Controller (IRQ1) */
337}; 337};
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index ac329a98e959..0b12e1adcc8e 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -12,6 +12,7 @@
12#include <asm/mach/arch.h> 12#include <asm/mach/arch.h>
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h> 17#include <linux/i2c-gpio.h>
17 18
@@ -32,7 +33,7 @@
32 * -------------------------------------------------------------------- */ 33 * -------------------------------------------------------------------- */
33 34
34#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 35#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
35static u64 ohci_dmamask = 0xffffffffUL; 36static u64 ohci_dmamask = DMA_BIT_MASK(32);
36static struct at91_usbh_data usbh_data; 37static struct at91_usbh_data usbh_data;
37 38
38static struct resource usbh_resources[] = { 39static struct resource usbh_resources[] = {
@@ -53,7 +54,7 @@ static struct platform_device at91_usbh_device = {
53 .id = -1, 54 .id = -1,
54 .dev = { 55 .dev = {
55 .dma_mask = &ohci_dmamask, 56 .dma_mask = &ohci_dmamask,
56 .coherent_dma_mask = 0xffffffff, 57 .coherent_dma_mask = DMA_BIT_MASK(32),
57 .platform_data = &usbh_data, 58 .platform_data = &usbh_data,
58 }, 59 },
59 .resource = usbh_resources, 60 .resource = usbh_resources,
@@ -136,7 +137,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
136 * -------------------------------------------------------------------- */ 137 * -------------------------------------------------------------------- */
137 138
138#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 139#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
139static u64 eth_dmamask = 0xffffffffUL; 140static u64 eth_dmamask = DMA_BIT_MASK(32);
140static struct at91_eth_data eth_data; 141static struct at91_eth_data eth_data;
141 142
142static struct resource eth_resources[] = { 143static struct resource eth_resources[] = {
@@ -157,7 +158,7 @@ static struct platform_device at91sam9263_eth_device = {
157 .id = -1, 158 .id = -1,
158 .dev = { 159 .dev = {
159 .dma_mask = &eth_dmamask, 160 .dma_mask = &eth_dmamask,
160 .coherent_dma_mask = 0xffffffff, 161 .coherent_dma_mask = DMA_BIT_MASK(32),
161 .platform_data = &eth_data, 162 .platform_data = &eth_data,
162 }, 163 },
163 .resource = eth_resources, 164 .resource = eth_resources,
@@ -210,7 +211,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {}
210 * -------------------------------------------------------------------- */ 211 * -------------------------------------------------------------------- */
211 212
212#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 213#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
213static u64 mmc_dmamask = 0xffffffffUL; 214static u64 mmc_dmamask = DMA_BIT_MASK(32);
214static struct at91_mmc_data mmc0_data, mmc1_data; 215static struct at91_mmc_data mmc0_data, mmc1_data;
215 216
216static struct resource mmc0_resources[] = { 217static struct resource mmc0_resources[] = {
@@ -231,7 +232,7 @@ static struct platform_device at91sam9263_mmc0_device = {
231 .id = 0, 232 .id = 0,
232 .dev = { 233 .dev = {
233 .dma_mask = &mmc_dmamask, 234 .dma_mask = &mmc_dmamask,
234 .coherent_dma_mask = 0xffffffff, 235 .coherent_dma_mask = DMA_BIT_MASK(32),
235 .platform_data = &mmc0_data, 236 .platform_data = &mmc0_data,
236 }, 237 },
237 .resource = mmc0_resources, 238 .resource = mmc0_resources,
@@ -256,7 +257,7 @@ static struct platform_device at91sam9263_mmc1_device = {
256 .id = 1, 257 .id = 1,
257 .dev = { 258 .dev = {
258 .dma_mask = &mmc_dmamask, 259 .dma_mask = &mmc_dmamask,
259 .coherent_dma_mask = 0xffffffff, 260 .coherent_dma_mask = DMA_BIT_MASK(32),
260 .platform_data = &mmc1_data, 261 .platform_data = &mmc1_data,
261 }, 262 },
262 .resource = mmc1_resources, 263 .resource = mmc1_resources,
@@ -382,7 +383,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
382 return; 383 return;
383 384
384 csa = at91_sys_read(AT91_MATRIX_EBI0CSA); 385 csa = at91_sys_read(AT91_MATRIX_EBI0CSA);
385 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC); 386 at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA);
386 387
387 /* set the bus interface characteristics */ 388 /* set the bus interface characteristics */
388 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 389 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
@@ -500,7 +501,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
500 * -------------------------------------------------------------------- */ 501 * -------------------------------------------------------------------- */
501 502
502#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) 503#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
503static u64 spi_dmamask = 0xffffffffUL; 504static u64 spi_dmamask = DMA_BIT_MASK(32);
504 505
505static struct resource spi0_resources[] = { 506static struct resource spi0_resources[] = {
506 [0] = { 507 [0] = {
@@ -520,7 +521,7 @@ static struct platform_device at91sam9263_spi0_device = {
520 .id = 0, 521 .id = 0,
521 .dev = { 522 .dev = {
522 .dma_mask = &spi_dmamask, 523 .dma_mask = &spi_dmamask,
523 .coherent_dma_mask = 0xffffffff, 524 .coherent_dma_mask = DMA_BIT_MASK(32),
524 }, 525 },
525 .resource = spi0_resources, 526 .resource = spi0_resources,
526 .num_resources = ARRAY_SIZE(spi0_resources), 527 .num_resources = ARRAY_SIZE(spi0_resources),
@@ -546,7 +547,7 @@ static struct platform_device at91sam9263_spi1_device = {
546 .id = 1, 547 .id = 1,
547 .dev = { 548 .dev = {
548 .dma_mask = &spi_dmamask, 549 .dma_mask = &spi_dmamask,
549 .coherent_dma_mask = 0xffffffff, 550 .coherent_dma_mask = DMA_BIT_MASK(32),
550 }, 551 },
551 .resource = spi1_resources, 552 .resource = spi1_resources,
552 .num_resources = ARRAY_SIZE(spi1_resources), 553 .num_resources = ARRAY_SIZE(spi1_resources),
@@ -612,7 +613,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
612 * -------------------------------------------------------------------- */ 613 * -------------------------------------------------------------------- */
613 614
614#if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE) 615#if defined(CONFIG_SND_AT91_AC97) || defined(CONFIG_SND_AT91_AC97_MODULE)
615static u64 ac97_dmamask = 0xffffffffUL; 616static u64 ac97_dmamask = DMA_BIT_MASK(32);
616static struct atmel_ac97_data ac97_data; 617static struct atmel_ac97_data ac97_data;
617 618
618static struct resource ac97_resources[] = { 619static struct resource ac97_resources[] = {
@@ -633,7 +634,7 @@ static struct platform_device at91sam9263_ac97_device = {
633 .id = 1, 634 .id = 1,
634 .dev = { 635 .dev = {
635 .dma_mask = &ac97_dmamask, 636 .dma_mask = &ac97_dmamask,
636 .coherent_dma_mask = 0xffffffff, 637 .coherent_dma_mask = DMA_BIT_MASK(32),
637 .platform_data = &ac97_data, 638 .platform_data = &ac97_data,
638 }, 639 },
639 .resource = ac97_resources, 640 .resource = ac97_resources,
@@ -667,7 +668,7 @@ void __init at91_add_device_ac97(struct atmel_ac97_data *data) {}
667 * -------------------------------------------------------------------- */ 668 * -------------------------------------------------------------------- */
668 669
669#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 670#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
670static u64 lcdc_dmamask = 0xffffffffUL; 671static u64 lcdc_dmamask = DMA_BIT_MASK(32);
671static struct atmel_lcdfb_info lcdc_data; 672static struct atmel_lcdfb_info lcdc_data;
672 673
673static struct resource lcdc_resources[] = { 674static struct resource lcdc_resources[] = {
@@ -688,7 +689,7 @@ static struct platform_device at91_lcdc_device = {
688 .id = 0, 689 .id = 0,
689 .dev = { 690 .dev = {
690 .dma_mask = &lcdc_dmamask, 691 .dma_mask = &lcdc_dmamask,
691 .coherent_dma_mask = 0xffffffff, 692 .coherent_dma_mask = DMA_BIT_MASK(32),
692 .platform_data = &lcdc_data, 693 .platform_data = &lcdc_data,
693 }, 694 },
694 .resource = lcdc_resources, 695 .resource = lcdc_resources,
@@ -732,24 +733,242 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
732 733
733 734
734/* -------------------------------------------------------------------- 735/* --------------------------------------------------------------------
735 * LEDs 736 * Image Sensor Interface
736 * -------------------------------------------------------------------- */ 737 * -------------------------------------------------------------------- */
737 738
738#if defined(CONFIG_LEDS) 739#if defined(CONFIG_VIDEO_AT91_ISI) || defined(CONFIG_VIDEO_AT91_ISI_MODULE)
739u8 at91_leds_cpu;
740u8 at91_leds_timer;
741 740
742void __init at91_init_leds(u8 cpu_led, u8 timer_led) 741struct resource isi_resources[] = {
742 [0] = {
743 .start = AT91SAM9263_BASE_ISI,
744 .end = AT91SAM9263_BASE_ISI + SZ_16K - 1,
745 .flags = IORESOURCE_MEM,
746 },
747 [1] = {
748 .start = AT91SAM9263_ID_ISI,
749 .end = AT91SAM9263_ID_ISI,
750 .flags = IORESOURCE_IRQ,
751 },
752};
753
754static struct platform_device at91sam9263_isi_device = {
755 .name = "at91_isi",
756 .id = -1,
757 .resource = isi_resources,
758 .num_resources = ARRAY_SIZE(isi_resources),
759};
760
761void __init at91_add_device_isi(void)
762{
763 at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */
764 at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */
765 at91_set_A_periph(AT91_PIN_PE2, 0); /* ISI_D2 */
766 at91_set_A_periph(AT91_PIN_PE3, 0); /* ISI_D3 */
767 at91_set_A_periph(AT91_PIN_PE4, 0); /* ISI_D4 */
768 at91_set_A_periph(AT91_PIN_PE5, 0); /* ISI_D5 */
769 at91_set_A_periph(AT91_PIN_PE6, 0); /* ISI_D6 */
770 at91_set_A_periph(AT91_PIN_PE7, 0); /* ISI_D7 */
771 at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */
772 at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */
773 at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */
774 at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */
775 at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */
776 at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */
777 at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */
778 at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */
779}
780#else
781void __init at91_add_device_isi(void) {}
782#endif
783
784
785/* --------------------------------------------------------------------
786 * RTT
787 * -------------------------------------------------------------------- */
788
789static struct resource rtt0_resources[] = {
790 {
791 .start = AT91_BASE_SYS + AT91_RTT0,
792 .end = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1,
793 .flags = IORESOURCE_MEM,
794 }
795};
796
797static struct platform_device at91sam9263_rtt0_device = {
798 .name = "at91_rtt",
799 .id = 0,
800 .resource = rtt0_resources,
801 .num_resources = ARRAY_SIZE(rtt0_resources),
802};
803
804static struct resource rtt1_resources[] = {
805 {
806 .start = AT91_BASE_SYS + AT91_RTT1,
807 .end = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1,
808 .flags = IORESOURCE_MEM,
809 }
810};
811
812static struct platform_device at91sam9263_rtt1_device = {
813 .name = "at91_rtt",
814 .id = 1,
815 .resource = rtt1_resources,
816 .num_resources = ARRAY_SIZE(rtt1_resources),
817};
818
819static void __init at91_add_device_rtt(void)
820{
821 platform_device_register(&at91sam9263_rtt0_device);
822 platform_device_register(&at91sam9263_rtt1_device);
823}
824
825
826/* --------------------------------------------------------------------
827 * Watchdog
828 * -------------------------------------------------------------------- */
829
830#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
831static struct platform_device at91sam9263_wdt_device = {
832 .name = "at91_wdt",
833 .id = -1,
834 .num_resources = 0,
835};
836
837static void __init at91_add_device_watchdog(void)
838{
839 platform_device_register(&at91sam9263_wdt_device);
840}
841#else
842static void __init at91_add_device_watchdog(void) {}
843#endif
844
845
846/* --------------------------------------------------------------------
847 * SSC -- Synchronous Serial Controller
848 * -------------------------------------------------------------------- */
849
850#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
851static u64 ssc0_dmamask = DMA_BIT_MASK(32);
852
853static struct resource ssc0_resources[] = {
854 [0] = {
855 .start = AT91SAM9263_BASE_SSC0,
856 .end = AT91SAM9263_BASE_SSC0 + SZ_16K - 1,
857 .flags = IORESOURCE_MEM,
858 },
859 [1] = {
860 .start = AT91SAM9263_ID_SSC0,
861 .end = AT91SAM9263_ID_SSC0,
862 .flags = IORESOURCE_IRQ,
863 },
864};
865
866static struct platform_device at91sam9263_ssc0_device = {
867 .name = "ssc",
868 .id = 0,
869 .dev = {
870 .dma_mask = &ssc0_dmamask,
871 .coherent_dma_mask = DMA_BIT_MASK(32),
872 },
873 .resource = ssc0_resources,
874 .num_resources = ARRAY_SIZE(ssc0_resources),
875};
876
877static inline void configure_ssc0_pins(unsigned pins)
878{
879 if (pins & ATMEL_SSC_TF)
880 at91_set_B_periph(AT91_PIN_PB0, 1);
881 if (pins & ATMEL_SSC_TK)
882 at91_set_B_periph(AT91_PIN_PB1, 1);
883 if (pins & ATMEL_SSC_TD)
884 at91_set_B_periph(AT91_PIN_PB2, 1);
885 if (pins & ATMEL_SSC_RD)
886 at91_set_B_periph(AT91_PIN_PB3, 1);
887 if (pins & ATMEL_SSC_RK)
888 at91_set_B_periph(AT91_PIN_PB4, 1);
889 if (pins & ATMEL_SSC_RF)
890 at91_set_B_periph(AT91_PIN_PB5, 1);
891}
892
893static u64 ssc1_dmamask = DMA_BIT_MASK(32);
894
895static struct resource ssc1_resources[] = {
896 [0] = {
897 .start = AT91SAM9263_BASE_SSC1,
898 .end = AT91SAM9263_BASE_SSC1 + SZ_16K - 1,
899 .flags = IORESOURCE_MEM,
900 },
901 [1] = {
902 .start = AT91SAM9263_ID_SSC1,
903 .end = AT91SAM9263_ID_SSC1,
904 .flags = IORESOURCE_IRQ,
905 },
906};
907
908static struct platform_device at91sam9263_ssc1_device = {
909 .name = "ssc",
910 .id = 1,
911 .dev = {
912 .dma_mask = &ssc1_dmamask,
913 .coherent_dma_mask = DMA_BIT_MASK(32),
914 },
915 .resource = ssc1_resources,
916 .num_resources = ARRAY_SIZE(ssc1_resources),
917};
918
919static inline void configure_ssc1_pins(unsigned pins)
920{
921 if (pins & ATMEL_SSC_TF)
922 at91_set_A_periph(AT91_PIN_PB6, 1);
923 if (pins & ATMEL_SSC_TK)
924 at91_set_A_periph(AT91_PIN_PB7, 1);
925 if (pins & ATMEL_SSC_TD)
926 at91_set_A_periph(AT91_PIN_PB8, 1);
927 if (pins & ATMEL_SSC_RD)
928 at91_set_A_periph(AT91_PIN_PB9, 1);
929 if (pins & ATMEL_SSC_RK)
930 at91_set_A_periph(AT91_PIN_PB10, 1);
931 if (pins & ATMEL_SSC_RF)
932 at91_set_A_periph(AT91_PIN_PB11, 1);
933}
934
935/*
936 * Return the device node so that board init code can use it as the
937 * parent for the device node reflecting how it's used on this board.
938 *
939 * SSC controllers are accessed through library code, instead of any
940 * kind of all-singing/all-dancing driver. For example one could be
941 * used by a particular I2S audio codec's driver, while another one
942 * on the same system might be used by a custom data capture driver.
943 */
944void __init at91_add_device_ssc(unsigned id, unsigned pins)
743{ 945{
744 /* Enable GPIO to access the LEDs */ 946 struct platform_device *pdev;
745 at91_set_gpio_output(cpu_led, 1); 947
746 at91_set_gpio_output(timer_led, 1); 948 /*
949 * NOTE: caller is responsible for passing information matching
950 * "pins" to whatever will be using each particular controller.
951 */
952 switch (id) {
953 case AT91SAM9263_ID_SSC0:
954 pdev = &at91sam9263_ssc0_device;
955 configure_ssc0_pins(pins);
956 at91_clock_associate("ssc0_clk", &pdev->dev, "pclk");
957 break;
958 case AT91SAM9263_ID_SSC1:
959 pdev = &at91sam9263_ssc1_device;
960 configure_ssc1_pins(pins);
961 at91_clock_associate("ssc1_clk", &pdev->dev, "pclk");
962 break;
963 default:
964 return;
965 }
747 966
748 at91_leds_cpu = cpu_led; 967 platform_device_register(pdev);
749 at91_leds_timer = timer_led;
750} 968}
969
751#else 970#else
752void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} 971void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
753#endif 972#endif
754 973
755 974
@@ -778,12 +997,15 @@ static struct atmel_uart_data dbgu_data = {
778 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), 997 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
779}; 998};
780 999
1000static u64 dbgu_dmamask = DMA_BIT_MASK(32);
1001
781static struct platform_device at91sam9263_dbgu_device = { 1002static struct platform_device at91sam9263_dbgu_device = {
782 .name = "atmel_usart", 1003 .name = "atmel_usart",
783 .id = 0, 1004 .id = 0,
784 .dev = { 1005 .dev = {
785 .platform_data = &dbgu_data, 1006 .dma_mask = &dbgu_dmamask,
786 .coherent_dma_mask = 0xffffffff, 1007 .coherent_dma_mask = DMA_BIT_MASK(32),
1008 .platform_data = &dbgu_data,
787 }, 1009 },
788 .resource = dbgu_resources, 1010 .resource = dbgu_resources,
789 .num_resources = ARRAY_SIZE(dbgu_resources), 1011 .num_resources = ARRAY_SIZE(dbgu_resources),
@@ -813,23 +1035,29 @@ static struct atmel_uart_data uart0_data = {
813 .use_dma_rx = 1, 1035 .use_dma_rx = 1,
814}; 1036};
815 1037
1038static u64 uart0_dmamask = DMA_BIT_MASK(32);
1039
816static struct platform_device at91sam9263_uart0_device = { 1040static struct platform_device at91sam9263_uart0_device = {
817 .name = "atmel_usart", 1041 .name = "atmel_usart",
818 .id = 1, 1042 .id = 1,
819 .dev = { 1043 .dev = {
820 .platform_data = &uart0_data, 1044 .dma_mask = &uart0_dmamask,
821 .coherent_dma_mask = 0xffffffff, 1045 .coherent_dma_mask = DMA_BIT_MASK(32),
1046 .platform_data = &uart0_data,
822 }, 1047 },
823 .resource = uart0_resources, 1048 .resource = uart0_resources,
824 .num_resources = ARRAY_SIZE(uart0_resources), 1049 .num_resources = ARRAY_SIZE(uart0_resources),
825}; 1050};
826 1051
827static inline void configure_usart0_pins(void) 1052static inline void configure_usart0_pins(unsigned pins)
828{ 1053{
829 at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */ 1054 at91_set_A_periph(AT91_PIN_PA26, 1); /* TXD0 */
830 at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */ 1055 at91_set_A_periph(AT91_PIN_PA27, 0); /* RXD0 */
831 at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */ 1056
832 at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */ 1057 if (pins & ATMEL_UART_RTS)
1058 at91_set_A_periph(AT91_PIN_PA28, 0); /* RTS0 */
1059 if (pins & ATMEL_UART_CTS)
1060 at91_set_A_periph(AT91_PIN_PA29, 0); /* CTS0 */
833} 1061}
834 1062
835static struct resource uart1_resources[] = { 1063static struct resource uart1_resources[] = {
@@ -850,23 +1078,29 @@ static struct atmel_uart_data uart1_data = {
850 .use_dma_rx = 1, 1078 .use_dma_rx = 1,
851}; 1079};
852 1080
1081static u64 uart1_dmamask = DMA_BIT_MASK(32);
1082
853static struct platform_device at91sam9263_uart1_device = { 1083static struct platform_device at91sam9263_uart1_device = {
854 .name = "atmel_usart", 1084 .name = "atmel_usart",
855 .id = 2, 1085 .id = 2,
856 .dev = { 1086 .dev = {
857 .platform_data = &uart1_data, 1087 .dma_mask = &uart1_dmamask,
858 .coherent_dma_mask = 0xffffffff, 1088 .coherent_dma_mask = DMA_BIT_MASK(32),
1089 .platform_data = &uart1_data,
859 }, 1090 },
860 .resource = uart1_resources, 1091 .resource = uart1_resources,
861 .num_resources = ARRAY_SIZE(uart1_resources), 1092 .num_resources = ARRAY_SIZE(uart1_resources),
862}; 1093};
863 1094
864static inline void configure_usart1_pins(void) 1095static inline void configure_usart1_pins(unsigned pins)
865{ 1096{
866 at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ 1097 at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */
867 at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ 1098 at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */
868 at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ 1099
869 at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ 1100 if (pins & ATMEL_UART_RTS)
1101 at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */
1102 if (pins & ATMEL_UART_CTS)
1103 at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */
870} 1104}
871 1105
872static struct resource uart2_resources[] = { 1106static struct resource uart2_resources[] = {
@@ -887,29 +1121,35 @@ static struct atmel_uart_data uart2_data = {
887 .use_dma_rx = 1, 1121 .use_dma_rx = 1,
888}; 1122};
889 1123
1124static u64 uart2_dmamask = DMA_BIT_MASK(32);
1125
890static struct platform_device at91sam9263_uart2_device = { 1126static struct platform_device at91sam9263_uart2_device = {
891 .name = "atmel_usart", 1127 .name = "atmel_usart",
892 .id = 3, 1128 .id = 3,
893 .dev = { 1129 .dev = {
894 .platform_data = &uart2_data, 1130 .dma_mask = &uart2_dmamask,
895 .coherent_dma_mask = 0xffffffff, 1131 .coherent_dma_mask = DMA_BIT_MASK(32),
1132 .platform_data = &uart2_data,
896 }, 1133 },
897 .resource = uart2_resources, 1134 .resource = uart2_resources,
898 .num_resources = ARRAY_SIZE(uart2_resources), 1135 .num_resources = ARRAY_SIZE(uart2_resources),
899}; 1136};
900 1137
901static inline void configure_usart2_pins(void) 1138static inline void configure_usart2_pins(unsigned pins)
902{ 1139{
903 at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ 1140 at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */
904 at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ 1141 at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */
905 at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ 1142
906 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ 1143 if (pins & ATMEL_UART_RTS)
1144 at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */
1145 if (pins & ATMEL_UART_CTS)
1146 at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */
907} 1147}
908 1148
909struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 1149static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
910struct platform_device *atmel_default_console_device; /* the serial console device */ 1150struct platform_device *atmel_default_console_device; /* the serial console device */
911 1151
912void __init at91_init_serial(struct at91_uart_config *config) 1152void __init __deprecated at91_init_serial(struct at91_uart_config *config)
913{ 1153{
914 int i; 1154 int i;
915 1155
@@ -917,17 +1157,17 @@ void __init at91_init_serial(struct at91_uart_config *config)
917 for (i = 0; i < config->nr_tty; i++) { 1157 for (i = 0; i < config->nr_tty; i++) {
918 switch (config->tty_map[i]) { 1158 switch (config->tty_map[i]) {
919 case 0: 1159 case 0:
920 configure_usart0_pins(); 1160 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
921 at91_uarts[i] = &at91sam9263_uart0_device; 1161 at91_uarts[i] = &at91sam9263_uart0_device;
922 at91_clock_associate("usart0_clk", &at91sam9263_uart0_device.dev, "usart"); 1162 at91_clock_associate("usart0_clk", &at91sam9263_uart0_device.dev, "usart");
923 break; 1163 break;
924 case 1: 1164 case 1:
925 configure_usart1_pins(); 1165 configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
926 at91_uarts[i] = &at91sam9263_uart1_device; 1166 at91_uarts[i] = &at91sam9263_uart1_device;
927 at91_clock_associate("usart1_clk", &at91sam9263_uart1_device.dev, "usart"); 1167 at91_clock_associate("usart1_clk", &at91sam9263_uart1_device.dev, "usart");
928 break; 1168 break;
929 case 2: 1169 case 2:
930 configure_usart2_pins(); 1170 configure_usart2_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
931 at91_uarts[i] = &at91sam9263_uart2_device; 1171 at91_uarts[i] = &at91sam9263_uart2_device;
932 at91_clock_associate("usart2_clk", &at91sam9263_uart2_device.dev, "usart"); 1172 at91_clock_associate("usart2_clk", &at91sam9263_uart2_device.dev, "usart");
933 break; 1173 break;
@@ -949,6 +1189,48 @@ void __init at91_init_serial(struct at91_uart_config *config)
949 printk(KERN_INFO "AT91: No default serial console defined.\n"); 1189 printk(KERN_INFO "AT91: No default serial console defined.\n");
950} 1190}
951 1191
1192void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1193{
1194 struct platform_device *pdev;
1195
1196 switch (id) {
1197 case 0: /* DBGU */
1198 pdev = &at91sam9263_dbgu_device;
1199 configure_dbgu_pins();
1200 at91_clock_associate("mck", &pdev->dev, "usart");
1201 break;
1202 case AT91SAM9263_ID_US0:
1203 pdev = &at91sam9263_uart0_device;
1204 configure_usart0_pins(pins);
1205 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
1206 break;
1207 case AT91SAM9263_ID_US1:
1208 pdev = &at91sam9263_uart1_device;
1209 configure_usart1_pins(pins);
1210 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
1211 break;
1212 case AT91SAM9263_ID_US2:
1213 pdev = &at91sam9263_uart2_device;
1214 configure_usart2_pins(pins);
1215 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
1216 break;
1217 default:
1218 return;
1219 }
1220 pdev->id = portnr; /* update to mapped ID */
1221
1222 if (portnr < ATMEL_MAX_UART)
1223 at91_uarts[portnr] = pdev;
1224}
1225
1226void __init at91_set_serial_console(unsigned portnr)
1227{
1228 if (portnr < ATMEL_MAX_UART)
1229 atmel_default_console_device = at91_uarts[portnr];
1230 if (!atmel_default_console_device)
1231 printk(KERN_INFO "AT91: No default serial console defined.\n");
1232}
1233
952void __init at91_add_device_serial(void) 1234void __init at91_add_device_serial(void)
953{ 1235{
954 int i; 1236 int i;
@@ -960,6 +1242,8 @@ void __init at91_add_device_serial(void)
960} 1242}
961#else 1243#else
962void __init at91_init_serial(struct at91_uart_config *config) {} 1244void __init at91_init_serial(struct at91_uart_config *config) {}
1245void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1246void __init at91_set_serial_console(unsigned portnr) {}
963void __init at91_add_device_serial(void) {} 1247void __init at91_add_device_serial(void) {}
964#endif 1248#endif
965 1249
@@ -971,6 +1255,8 @@ void __init at91_add_device_serial(void) {}
971 */ 1255 */
972static int __init at91_add_standard_devices(void) 1256static int __init at91_add_standard_devices(void)
973{ 1257{
1258 at91_add_device_rtt();
1259 at91_add_device_watchdog();
974 return 0; 1260 return 0;
975} 1261}
976 1262
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 2bd60a3dc623..f43b5c33e45d 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -9,6 +9,7 @@
9#include <asm/mach/arch.h> 9#include <asm/mach/arch.h>
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/dma-mapping.h>
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
13#include <linux/i2c-gpio.h> 14#include <linux/i2c-gpio.h>
14 15
@@ -29,7 +30,7 @@
29 * -------------------------------------------------------------------- */ 30 * -------------------------------------------------------------------- */
30 31
31#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 32#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
32static u64 mmc_dmamask = 0xffffffffUL; 33static u64 mmc_dmamask = DMA_BIT_MASK(32);
33static struct at91_mmc_data mmc_data; 34static struct at91_mmc_data mmc_data;
34 35
35static struct resource mmc_resources[] = { 36static struct resource mmc_resources[] = {
@@ -50,7 +51,7 @@ static struct platform_device at91sam9rl_mmc_device = {
50 .id = -1, 51 .id = -1,
51 .dev = { 52 .dev = {
52 .dma_mask = &mmc_dmamask, 53 .dma_mask = &mmc_dmamask,
53 .coherent_dma_mask = 0xffffffff, 54 .coherent_dma_mask = DMA_BIT_MASK(32),
54 .platform_data = &mmc_data, 55 .platform_data = &mmc_data,
55 }, 56 },
56 .resource = mmc_resources, 57 .resource = mmc_resources,
@@ -247,7 +248,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
247 * -------------------------------------------------------------------- */ 248 * -------------------------------------------------------------------- */
248 249
249#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) 250#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
250static u64 spi_dmamask = 0xffffffffUL; 251static u64 spi_dmamask = DMA_BIT_MASK(32);
251 252
252static struct resource spi_resources[] = { 253static struct resource spi_resources[] = {
253 [0] = { 254 [0] = {
@@ -267,7 +268,7 @@ static struct platform_device at91sam9rl_spi_device = {
267 .id = 0, 268 .id = 0,
268 .dev = { 269 .dev = {
269 .dma_mask = &spi_dmamask, 270 .dma_mask = &spi_dmamask,
270 .coherent_dma_mask = 0xffffffff, 271 .coherent_dma_mask = DMA_BIT_MASK(32),
271 }, 272 },
272 .resource = spi_resources, 273 .resource = spi_resources,
273 .num_resources = ARRAY_SIZE(spi_resources), 274 .num_resources = ARRAY_SIZE(spi_resources),
@@ -312,7 +313,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
312 * -------------------------------------------------------------------- */ 313 * -------------------------------------------------------------------- */
313 314
314#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 315#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
315static u64 lcdc_dmamask = 0xffffffffUL; 316static u64 lcdc_dmamask = DMA_BIT_MASK(32);
316static struct atmel_lcdfb_info lcdc_data; 317static struct atmel_lcdfb_info lcdc_data;
317 318
318static struct resource lcdc_resources[] = { 319static struct resource lcdc_resources[] = {
@@ -340,7 +341,7 @@ static struct platform_device at91_lcdc_device = {
340 .id = 0, 341 .id = 0,
341 .dev = { 342 .dev = {
342 .dma_mask = &lcdc_dmamask, 343 .dma_mask = &lcdc_dmamask,
343 .coherent_dma_mask = 0xffffffff, 344 .coherent_dma_mask = DMA_BIT_MASK(32),
344 .platform_data = &lcdc_data, 345 .platform_data = &lcdc_data,
345 }, 346 },
346 .resource = lcdc_resources, 347 .resource = lcdc_resources,
@@ -384,24 +385,196 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
384 385
385 386
386/* -------------------------------------------------------------------- 387/* --------------------------------------------------------------------
387 * LEDs 388 * RTC
388 * -------------------------------------------------------------------- */ 389 * -------------------------------------------------------------------- */
389 390
390#if defined(CONFIG_LEDS) 391#if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE)
391u8 at91_leds_cpu; 392static struct platform_device at91sam9rl_rtc_device = {
392u8 at91_leds_timer; 393 .name = "at91_rtc",
394 .id = -1,
395 .num_resources = 0,
396};
393 397
394void __init at91_init_leds(u8 cpu_led, u8 timer_led) 398static void __init at91_add_device_rtc(void)
395{ 399{
396 /* Enable GPIO to access the LEDs */ 400 platform_device_register(&at91sam9rl_rtc_device);
397 at91_set_gpio_output(cpu_led, 1); 401}
398 at91_set_gpio_output(timer_led, 1); 402#else
403static void __init at91_add_device_rtc(void) {}
404#endif
405
406
407/* --------------------------------------------------------------------
408 * RTT
409 * -------------------------------------------------------------------- */
410
411static struct resource rtt_resources[] = {
412 {
413 .start = AT91_BASE_SYS + AT91_RTT,
414 .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
415 .flags = IORESOURCE_MEM,
416 }
417};
418
419static struct platform_device at91sam9rl_rtt_device = {
420 .name = "at91_rtt",
421 .id = -1,
422 .resource = rtt_resources,
423 .num_resources = ARRAY_SIZE(rtt_resources),
424};
399 425
400 at91_leds_cpu = cpu_led; 426static void __init at91_add_device_rtt(void)
401 at91_leds_timer = timer_led; 427{
428 platform_device_register(&at91sam9rl_rtt_device);
429}
430
431
432/* --------------------------------------------------------------------
433 * Watchdog
434 * -------------------------------------------------------------------- */
435
436#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
437static struct platform_device at91sam9rl_wdt_device = {
438 .name = "at91_wdt",
439 .id = -1,
440 .num_resources = 0,
441};
442
443static void __init at91_add_device_watchdog(void)
444{
445 platform_device_register(&at91sam9rl_wdt_device);
402} 446}
403#else 447#else
404void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} 448static void __init at91_add_device_watchdog(void) {}
449#endif
450
451
452/* --------------------------------------------------------------------
453 * SSC -- Synchronous Serial Controller
454 * -------------------------------------------------------------------- */
455
456#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
457static u64 ssc0_dmamask = DMA_BIT_MASK(32);
458
459static struct resource ssc0_resources[] = {
460 [0] = {
461 .start = AT91SAM9RL_BASE_SSC0,
462 .end = AT91SAM9RL_BASE_SSC0 + SZ_16K - 1,
463 .flags = IORESOURCE_MEM,
464 },
465 [1] = {
466 .start = AT91SAM9RL_ID_SSC0,
467 .end = AT91SAM9RL_ID_SSC0,
468 .flags = IORESOURCE_IRQ,
469 },
470};
471
472static struct platform_device at91sam9rl_ssc0_device = {
473 .name = "ssc",
474 .id = 0,
475 .dev = {
476 .dma_mask = &ssc0_dmamask,
477 .coherent_dma_mask = DMA_BIT_MASK(32),
478 },
479 .resource = ssc0_resources,
480 .num_resources = ARRAY_SIZE(ssc0_resources),
481};
482
483static inline void configure_ssc0_pins(unsigned pins)
484{
485 if (pins & ATMEL_SSC_TF)
486 at91_set_A_periph(AT91_PIN_PC0, 1);
487 if (pins & ATMEL_SSC_TK)
488 at91_set_A_periph(AT91_PIN_PC1, 1);
489 if (pins & ATMEL_SSC_TD)
490 at91_set_A_periph(AT91_PIN_PA15, 1);
491 if (pins & ATMEL_SSC_RD)
492 at91_set_A_periph(AT91_PIN_PA16, 1);
493 if (pins & ATMEL_SSC_RK)
494 at91_set_B_periph(AT91_PIN_PA10, 1);
495 if (pins & ATMEL_SSC_RF)
496 at91_set_B_periph(AT91_PIN_PA22, 1);
497}
498
499static u64 ssc1_dmamask = DMA_BIT_MASK(32);
500
501static struct resource ssc1_resources[] = {
502 [0] = {
503 .start = AT91SAM9RL_BASE_SSC1,
504 .end = AT91SAM9RL_BASE_SSC1 + SZ_16K - 1,
505 .flags = IORESOURCE_MEM,
506 },
507 [1] = {
508 .start = AT91SAM9RL_ID_SSC1,
509 .end = AT91SAM9RL_ID_SSC1,
510 .flags = IORESOURCE_IRQ,
511 },
512};
513
514static struct platform_device at91sam9rl_ssc1_device = {
515 .name = "ssc",
516 .id = 1,
517 .dev = {
518 .dma_mask = &ssc1_dmamask,
519 .coherent_dma_mask = DMA_BIT_MASK(32),
520 },
521 .resource = ssc1_resources,
522 .num_resources = ARRAY_SIZE(ssc1_resources),
523};
524
525static inline void configure_ssc1_pins(unsigned pins)
526{
527 if (pins & ATMEL_SSC_TF)
528 at91_set_B_periph(AT91_PIN_PA29, 1);
529 if (pins & ATMEL_SSC_TK)
530 at91_set_B_periph(AT91_PIN_PA30, 1);
531 if (pins & ATMEL_SSC_TD)
532 at91_set_B_periph(AT91_PIN_PA13, 1);
533 if (pins & ATMEL_SSC_RD)
534 at91_set_B_periph(AT91_PIN_PA14, 1);
535 if (pins & ATMEL_SSC_RK)
536 at91_set_B_periph(AT91_PIN_PA9, 1);
537 if (pins & ATMEL_SSC_RF)
538 at91_set_B_periph(AT91_PIN_PA8, 1);
539}
540
541/*
542 * Return the device node so that board init code can use it as the
543 * parent for the device node reflecting how it's used on this board.
544 *
545 * SSC controllers are accessed through library code, instead of any
546 * kind of all-singing/all-dancing driver. For example one could be
547 * used by a particular I2S audio codec's driver, while another one
548 * on the same system might be used by a custom data capture driver.
549 */
550void __init at91_add_device_ssc(unsigned id, unsigned pins)
551{
552 struct platform_device *pdev;
553
554 /*
555 * NOTE: caller is responsible for passing information matching
556 * "pins" to whatever will be using each particular controller.
557 */
558 switch (id) {
559 case AT91SAM9RL_ID_SSC0:
560 pdev = &at91sam9rl_ssc0_device;
561 configure_ssc0_pins(pins);
562 at91_clock_associate("ssc0_clk", &pdev->dev, "pclk");
563 break;
564 case AT91SAM9RL_ID_SSC1:
565 pdev = &at91sam9rl_ssc1_device;
566 configure_ssc1_pins(pins);
567 at91_clock_associate("ssc1_clk", &pdev->dev, "pclk");
568 break;
569 default:
570 return;
571 }
572
573 platform_device_register(pdev);
574}
575
576#else
577void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
405#endif 578#endif
406 579
407 580
@@ -429,12 +602,15 @@ static struct atmel_uart_data dbgu_data = {
429 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), 602 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
430}; 603};
431 604
605static u64 dbgu_dmamask = DMA_BIT_MASK(32);
606
432static struct platform_device at91sam9rl_dbgu_device = { 607static struct platform_device at91sam9rl_dbgu_device = {
433 .name = "atmel_usart", 608 .name = "atmel_usart",
434 .id = 0, 609 .id = 0,
435 .dev = { 610 .dev = {
436 .platform_data = &dbgu_data, 611 .dma_mask = &dbgu_dmamask,
437 .coherent_dma_mask = 0xffffffff, 612 .coherent_dma_mask = DMA_BIT_MASK(32),
613 .platform_data = &dbgu_data,
438 }, 614 },
439 .resource = dbgu_resources, 615 .resource = dbgu_resources,
440 .num_resources = ARRAY_SIZE(dbgu_resources), 616 .num_resources = ARRAY_SIZE(dbgu_resources),
@@ -464,23 +640,37 @@ static struct atmel_uart_data uart0_data = {
464 .use_dma_rx = 1, 640 .use_dma_rx = 1,
465}; 641};
466 642
643static u64 uart0_dmamask = DMA_BIT_MASK(32);
644
467static struct platform_device at91sam9rl_uart0_device = { 645static struct platform_device at91sam9rl_uart0_device = {
468 .name = "atmel_usart", 646 .name = "atmel_usart",
469 .id = 1, 647 .id = 1,
470 .dev = { 648 .dev = {
471 .platform_data = &uart0_data, 649 .dma_mask = &uart0_dmamask,
472 .coherent_dma_mask = 0xffffffff, 650 .coherent_dma_mask = DMA_BIT_MASK(32),
651 .platform_data = &uart0_data,
473 }, 652 },
474 .resource = uart0_resources, 653 .resource = uart0_resources,
475 .num_resources = ARRAY_SIZE(uart0_resources), 654 .num_resources = ARRAY_SIZE(uart0_resources),
476}; 655};
477 656
478static inline void configure_usart0_pins(void) 657static inline void configure_usart0_pins(unsigned pins)
479{ 658{
480 at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ 659 at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */
481 at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ 660 at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */
482 at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */ 661
483 at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */ 662 if (pins & ATMEL_UART_RTS)
663 at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */
664 if (pins & ATMEL_UART_CTS)
665 at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */
666 if (pins & ATMEL_UART_DSR)
667 at91_set_A_periph(AT91_PIN_PD14, 0); /* DSR0 */
668 if (pins & ATMEL_UART_DTR)
669 at91_set_A_periph(AT91_PIN_PD15, 0); /* DTR0 */
670 if (pins & ATMEL_UART_DCD)
671 at91_set_A_periph(AT91_PIN_PD16, 0); /* DCD0 */
672 if (pins & ATMEL_UART_RI)
673 at91_set_A_periph(AT91_PIN_PD17, 0); /* RI0 */
484} 674}
485 675
486static struct resource uart1_resources[] = { 676static struct resource uart1_resources[] = {
@@ -501,21 +691,29 @@ static struct atmel_uart_data uart1_data = {
501 .use_dma_rx = 1, 691 .use_dma_rx = 1,
502}; 692};
503 693
694static u64 uart1_dmamask = DMA_BIT_MASK(32);
695
504static struct platform_device at91sam9rl_uart1_device = { 696static struct platform_device at91sam9rl_uart1_device = {
505 .name = "atmel_usart", 697 .name = "atmel_usart",
506 .id = 2, 698 .id = 2,
507 .dev = { 699 .dev = {
508 .platform_data = &uart1_data, 700 .dma_mask = &uart1_dmamask,
509 .coherent_dma_mask = 0xffffffff, 701 .coherent_dma_mask = DMA_BIT_MASK(32),
702 .platform_data = &uart1_data,
510 }, 703 },
511 .resource = uart1_resources, 704 .resource = uart1_resources,
512 .num_resources = ARRAY_SIZE(uart1_resources), 705 .num_resources = ARRAY_SIZE(uart1_resources),
513}; 706};
514 707
515static inline void configure_usart1_pins(void) 708static inline void configure_usart1_pins(unsigned pins)
516{ 709{
517 at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ 710 at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */
518 at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ 711 at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */
712
713 if (pins & ATMEL_UART_RTS)
714 at91_set_B_periph(AT91_PIN_PA18, 0); /* RTS1 */
715 if (pins & ATMEL_UART_CTS)
716 at91_set_B_periph(AT91_PIN_PA19, 0); /* CTS1 */
519} 717}
520 718
521static struct resource uart2_resources[] = { 719static struct resource uart2_resources[] = {
@@ -536,21 +734,29 @@ static struct atmel_uart_data uart2_data = {
536 .use_dma_rx = 1, 734 .use_dma_rx = 1,
537}; 735};
538 736
737static u64 uart2_dmamask = DMA_BIT_MASK(32);
738
539static struct platform_device at91sam9rl_uart2_device = { 739static struct platform_device at91sam9rl_uart2_device = {
540 .name = "atmel_usart", 740 .name = "atmel_usart",
541 .id = 3, 741 .id = 3,
542 .dev = { 742 .dev = {
543 .platform_data = &uart2_data, 743 .dma_mask = &uart2_dmamask,
544 .coherent_dma_mask = 0xffffffff, 744 .coherent_dma_mask = DMA_BIT_MASK(32),
745 .platform_data = &uart2_data,
545 }, 746 },
546 .resource = uart2_resources, 747 .resource = uart2_resources,
547 .num_resources = ARRAY_SIZE(uart2_resources), 748 .num_resources = ARRAY_SIZE(uart2_resources),
548}; 749};
549 750
550static inline void configure_usart2_pins(void) 751static inline void configure_usart2_pins(unsigned pins)
551{ 752{
552 at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ 753 at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */
553 at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ 754 at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */
755
756 if (pins & ATMEL_UART_RTS)
757 at91_set_A_periph(AT91_PIN_PA29, 0); /* RTS2 */
758 if (pins & ATMEL_UART_CTS)
759 at91_set_A_periph(AT91_PIN_PA30, 0); /* CTS2 */
554} 760}
555 761
556static struct resource uart3_resources[] = { 762static struct resource uart3_resources[] = {
@@ -571,27 +777,35 @@ static struct atmel_uart_data uart3_data = {
571 .use_dma_rx = 1, 777 .use_dma_rx = 1,
572}; 778};
573 779
780static u64 uart3_dmamask = DMA_BIT_MASK(32);
781
574static struct platform_device at91sam9rl_uart3_device = { 782static struct platform_device at91sam9rl_uart3_device = {
575 .name = "atmel_usart", 783 .name = "atmel_usart",
576 .id = 4, 784 .id = 4,
577 .dev = { 785 .dev = {
578 .platform_data = &uart3_data, 786 .dma_mask = &uart3_dmamask,
579 .coherent_dma_mask = 0xffffffff, 787 .coherent_dma_mask = DMA_BIT_MASK(32),
788 .platform_data = &uart3_data,
580 }, 789 },
581 .resource = uart3_resources, 790 .resource = uart3_resources,
582 .num_resources = ARRAY_SIZE(uart3_resources), 791 .num_resources = ARRAY_SIZE(uart3_resources),
583}; 792};
584 793
585static inline void configure_usart3_pins(void) 794static inline void configure_usart3_pins(unsigned pins)
586{ 795{
587 at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */ 796 at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */
588 at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */ 797 at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */
798
799 if (pins & ATMEL_UART_RTS)
800 at91_set_B_periph(AT91_PIN_PD4, 0); /* RTS3 */
801 if (pins & ATMEL_UART_CTS)
802 at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */
589} 803}
590 804
591struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 805static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
592struct platform_device *atmel_default_console_device; /* the serial console device */ 806struct platform_device *atmel_default_console_device; /* the serial console device */
593 807
594void __init at91_init_serial(struct at91_uart_config *config) 808void __init __deprecated at91_init_serial(struct at91_uart_config *config)
595{ 809{
596 int i; 810 int i;
597 811
@@ -599,22 +813,22 @@ void __init at91_init_serial(struct at91_uart_config *config)
599 for (i = 0; i < config->nr_tty; i++) { 813 for (i = 0; i < config->nr_tty; i++) {
600 switch (config->tty_map[i]) { 814 switch (config->tty_map[i]) {
601 case 0: 815 case 0:
602 configure_usart0_pins(); 816 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
603 at91_uarts[i] = &at91sam9rl_uart0_device; 817 at91_uarts[i] = &at91sam9rl_uart0_device;
604 at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart"); 818 at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart");
605 break; 819 break;
606 case 1: 820 case 1:
607 configure_usart1_pins(); 821 configure_usart1_pins(0);
608 at91_uarts[i] = &at91sam9rl_uart1_device; 822 at91_uarts[i] = &at91sam9rl_uart1_device;
609 at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart"); 823 at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart");
610 break; 824 break;
611 case 2: 825 case 2:
612 configure_usart2_pins(); 826 configure_usart2_pins(0);
613 at91_uarts[i] = &at91sam9rl_uart2_device; 827 at91_uarts[i] = &at91sam9rl_uart2_device;
614 at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart"); 828 at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart");
615 break; 829 break;
616 case 3: 830 case 3:
617 configure_usart3_pins(); 831 configure_usart3_pins(0);
618 at91_uarts[i] = &at91sam9rl_uart3_device; 832 at91_uarts[i] = &at91sam9rl_uart3_device;
619 at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart"); 833 at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart");
620 break; 834 break;
@@ -636,6 +850,53 @@ void __init at91_init_serial(struct at91_uart_config *config)
636 printk(KERN_INFO "AT91: No default serial console defined.\n"); 850 printk(KERN_INFO "AT91: No default serial console defined.\n");
637} 851}
638 852
853void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
854{
855 struct platform_device *pdev;
856
857 switch (id) {
858 case 0: /* DBGU */
859 pdev = &at91sam9rl_dbgu_device;
860 configure_dbgu_pins();
861 at91_clock_associate("mck", &pdev->dev, "usart");
862 break;
863 case AT91SAM9RL_ID_US0:
864 pdev = &at91sam9rl_uart0_device;
865 configure_usart0_pins(pins);
866 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
867 break;
868 case AT91SAM9RL_ID_US1:
869 pdev = &at91sam9rl_uart1_device;
870 configure_usart1_pins(pins);
871 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
872 break;
873 case AT91SAM9RL_ID_US2:
874 pdev = &at91sam9rl_uart2_device;
875 configure_usart2_pins(pins);
876 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
877 break;
878 case AT91SAM9RL_ID_US3:
879 pdev = &at91sam9rl_uart3_device;
880 configure_usart3_pins(pins);
881 at91_clock_associate("usart3_clk", &pdev->dev, "usart");
882 break;
883 default:
884 return;
885 }
886 pdev->id = portnr; /* update to mapped ID */
887
888 if (portnr < ATMEL_MAX_UART)
889 at91_uarts[portnr] = pdev;
890}
891
892void __init at91_set_serial_console(unsigned portnr)
893{
894 if (portnr < ATMEL_MAX_UART)
895 atmel_default_console_device = at91_uarts[portnr];
896 if (!atmel_default_console_device)
897 printk(KERN_INFO "AT91: No default serial console defined.\n");
898}
899
639void __init at91_add_device_serial(void) 900void __init at91_add_device_serial(void)
640{ 901{
641 int i; 902 int i;
@@ -646,7 +907,9 @@ void __init at91_add_device_serial(void)
646 } 907 }
647} 908}
648#else 909#else
649void __init at91_init_serial(struct at91_uart_config *config) {} 910void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
911void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
912void __init at91_set_serial_console(unsigned portnr) {}
650void __init at91_add_device_serial(void) {} 913void __init at91_add_device_serial(void) {}
651#endif 914#endif
652 915
@@ -659,6 +922,9 @@ void __init at91_add_device_serial(void) {}
659 */ 922 */
660static int __init at91_add_standard_devices(void) 923static int __init at91_add_standard_devices(void)
661{ 924{
925 at91_add_device_rtc();
926 at91_add_device_rtt();
927 at91_add_device_watchdog();
662 return 0; 928 return 0;
663} 929}
664 930
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
new file mode 100644
index 000000000000..185437131541
--- /dev/null
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -0,0 +1,359 @@
1/*
2 * linux/arch/arm/mach-at91/board-cap9adk.c
3 *
4 * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com>
5 * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com>
6 * Copyright (C) 2005 SAN People
7 * Copyright (C) 2007 Atmel Corporation.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/types.h>
25#include <linux/init.h>
26#include <linux/mm.h>
27#include <linux/module.h>
28#include <linux/platform_device.h>
29#include <linux/spi/spi.h>
30#include <linux/spi/ads7846.h>
31#include <linux/fb.h>
32#include <linux/mtd/physmap.h>
33
34#include <video/atmel_lcdc.h>
35
36#include <asm/hardware.h>
37#include <asm/setup.h>
38#include <asm/mach-types.h>
39#include <asm/irq.h>
40
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/irq.h>
44
45#include <asm/arch/board.h>
46#include <asm/arch/gpio.h>
47#include <asm/arch/at91cap9_matrix.h>
48#include <asm/arch/at91sam926x_mc.h>
49
50#include "generic.h"
51
52
53static void __init cap9adk_map_io(void)
54{
55 /* Initialize processor: 12 MHz crystal */
56 at91cap9_initialize(12000000);
57
58 /* Setup the LEDs: USER1 and USER2 LED for cpu/timer... */
59 at91_init_leds(AT91_PIN_PA10, AT91_PIN_PA11);
60 /* ... POWER LED always on */
61 at91_set_gpio_output(AT91_PIN_PC29, 1);
62
63 /* Setup the serial ports and console */
64 at91_register_uart(0, 0, 0); /* DBGU = ttyS0 */
65 at91_set_serial_console(0);
66}
67
68static void __init cap9adk_init_irq(void)
69{
70 at91cap9_init_interrupts(NULL);
71}
72
73
74/*
75 * USB Host port
76 */
77static struct at91_usbh_data __initdata cap9adk_usbh_data = {
78 .ports = 2,
79};
80
81
82/*
83 * ADS7846 Touchscreen
84 */
85#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
86static int ads7843_pendown_state(void)
87{
88 return !at91_get_gpio_value(AT91_PIN_PC4); /* Touchscreen PENIRQ */
89}
90
91static struct ads7846_platform_data ads_info = {
92 .model = 7843,
93 .x_min = 150,
94 .x_max = 3830,
95 .y_min = 190,
96 .y_max = 3830,
97 .vref_delay_usecs = 100,
98 .x_plate_ohms = 450,
99 .y_plate_ohms = 250,
100 .pressure_max = 15000,
101 .debounce_max = 1,
102 .debounce_rep = 0,
103 .debounce_tol = (~0),
104 .get_pendown_state = ads7843_pendown_state,
105};
106
107static void __init cap9adk_add_device_ts(void)
108{
109 at91_set_gpio_input(AT91_PIN_PC4, 1); /* Touchscreen PENIRQ */
110 at91_set_gpio_input(AT91_PIN_PC5, 1); /* Touchscreen BUSY */
111}
112#else
113static void __init cap9adk_add_device_ts(void) {}
114#endif
115
116
117/*
118 * SPI devices.
119 */
120static struct spi_board_info cap9adk_spi_devices[] = {
121#if defined(CONFIG_MTD_AT91_DATAFLASH_CARD)
122 { /* DataFlash card */
123 .modalias = "mtd_dataflash",
124 .chip_select = 0,
125 .max_speed_hz = 15 * 1000 * 1000,
126 .bus_num = 0,
127 },
128#endif
129#if defined(CONFIG_TOUCHSCREEN_ADS7846) || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
130 {
131 .modalias = "ads7846",
132 .chip_select = 3, /* can be 2 or 3, depending on J2 jumper */
133 .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
134 .bus_num = 0,
135 .platform_data = &ads_info,
136 .irq = AT91_PIN_PC4,
137 },
138#endif
139};
140
141
142/*
143 * MCI (SD/MMC)
144 */
145static struct at91_mmc_data __initdata cap9adk_mmc_data = {
146 .wire4 = 1,
147// .det_pin = ... not connected
148// .wp_pin = ... not connected
149// .vcc_pin = ... not connected
150};
151
152
153/*
154 * MACB Ethernet device
155 */
156static struct at91_eth_data __initdata cap9adk_macb_data = {
157 .is_rmii = 1,
158};
159
160
161/*
162 * NAND flash
163 */
164static struct mtd_partition __initdata cap9adk_nand_partitions[] = {
165 {
166 .name = "NAND partition",
167 .offset = 0,
168 .size = MTDPART_SIZ_FULL,
169 },
170};
171
172static struct mtd_partition * __init nand_partitions(int size, int *num_partitions)
173{
174 *num_partitions = ARRAY_SIZE(cap9adk_nand_partitions);
175 return cap9adk_nand_partitions;
176}
177
178static struct at91_nand_data __initdata cap9adk_nand_data = {
179 .ale = 21,
180 .cle = 22,
181// .det_pin = ... not connected
182// .rdy_pin = ... not connected
183 .enable_pin = AT91_PIN_PD15,
184 .partition_info = nand_partitions,
185#if defined(CONFIG_MTD_NAND_AT91_BUSWIDTH_16)
186 .bus_width_16 = 1,
187#else
188 .bus_width_16 = 0,
189#endif
190};
191
192
193/*
194 * NOR flash
195 */
196static struct mtd_partition cap9adk_nor_partitions[] = {
197 {
198 .name = "NOR partition",
199 .offset = 0,
200 .size = MTDPART_SIZ_FULL,
201 },
202};
203
204static struct physmap_flash_data cap9adk_nor_data = {
205 .width = 2,
206 .parts = cap9adk_nor_partitions,
207 .nr_parts = ARRAY_SIZE(cap9adk_nor_partitions),
208};
209
210#define NOR_BASE AT91_CHIPSELECT_0
211#define NOR_SIZE 0x800000
212
213static struct resource nor_flash_resources[] = {
214 {
215 .start = NOR_BASE,
216 .end = NOR_BASE + NOR_SIZE - 1,
217 .flags = IORESOURCE_MEM,
218 }
219};
220
221static struct platform_device cap9adk_nor_flash = {
222 .name = "physmap-flash",
223 .id = 0,
224 .dev = {
225 .platform_data = &cap9adk_nor_data,
226 },
227 .resource = nor_flash_resources,
228 .num_resources = ARRAY_SIZE(nor_flash_resources),
229};
230
231static __init void cap9adk_add_device_nor(void)
232{
233 unsigned long csa;
234
235 csa = at91_sys_read(AT91_MATRIX_EBICSA);
236 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V);
237
238 /* set the bus interface characteristics */
239 at91_sys_write(AT91_SMC_SETUP(0), AT91_SMC_NWESETUP_(4) | AT91_SMC_NCS_WRSETUP_(2)
240 | AT91_SMC_NRDSETUP_(4) | AT91_SMC_NCS_RDSETUP_(2));
241
242 at91_sys_write(AT91_SMC_PULSE(0), AT91_SMC_NWEPULSE_(8) | AT91_SMC_NCS_WRPULSE_(10)
243 | AT91_SMC_NRDPULSE_(8) | AT91_SMC_NCS_RDPULSE_(10));
244
245 at91_sys_write(AT91_SMC_CYCLE(0), AT91_SMC_NWECYCLE_(16) | AT91_SMC_NRDCYCLE_(16));
246
247 at91_sys_write(AT91_SMC_MODE(0), AT91_SMC_READMODE | AT91_SMC_WRITEMODE
248 | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_BAT_WRITE
249 | AT91_SMC_DBW_16 | AT91_SMC_TDF_(1));
250
251 platform_device_register(&cap9adk_nor_flash);
252}
253
254
255/*
256 * LCD Controller
257 */
258#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
259static struct fb_videomode at91_tft_vga_modes[] = {
260 {
261 .name = "TX09D50VM1CCA @ 60",
262 .refresh = 60,
263 .xres = 240, .yres = 320,
264 .pixclock = KHZ2PICOS(4965),
265
266 .left_margin = 1, .right_margin = 33,
267 .upper_margin = 1, .lower_margin = 0,
268 .hsync_len = 5, .vsync_len = 1,
269
270 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
271 .vmode = FB_VMODE_NONINTERLACED,
272 },
273};
274
275static struct fb_monspecs at91fb_default_monspecs = {
276 .manufacturer = "HIT",
277 .monitor = "TX09D70VM1CCA",
278
279 .modedb = at91_tft_vga_modes,
280 .modedb_len = ARRAY_SIZE(at91_tft_vga_modes),
281 .hfmin = 15000,
282 .hfmax = 64000,
283 .vfmin = 50,
284 .vfmax = 150,
285};
286
287#define AT91CAP9_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
288 | ATMEL_LCDC_DISTYPE_TFT \
289 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
290
291static void at91_lcdc_power_control(int on)
292{
293 if (on)
294 at91_set_gpio_value(AT91_PIN_PC0, 0); /* power up */
295 else
296 at91_set_gpio_value(AT91_PIN_PC0, 1); /* power down */
297}
298
299/* Driver datas */
300static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data = {
301 .default_bpp = 16,
302 .default_dmacon = ATMEL_LCDC_DMAEN,
303 .default_lcdcon2 = AT91CAP9_DEFAULT_LCDCON2,
304 .default_monspecs = &at91fb_default_monspecs,
305 .atmel_lcdfb_power_control = at91_lcdc_power_control,
306 .guard_time = 1,
307};
308
309#else
310static struct atmel_lcdfb_info __initdata cap9adk_lcdc_data;
311#endif
312
313
314/*
315 * AC97
316 */
317static struct atmel_ac97_data cap9adk_ac97_data = {
318// .reset_pin = ... not connected
319};
320
321
322static void __init cap9adk_board_init(void)
323{
324 /* Serial */
325 at91_add_device_serial();
326 /* USB Host */
327 set_irq_type(AT91CAP9_ID_UHP, IRQT_HIGH);
328 at91_add_device_usbh(&cap9adk_usbh_data);
329 /* SPI */
330 at91_add_device_spi(cap9adk_spi_devices, ARRAY_SIZE(cap9adk_spi_devices));
331 /* Touchscreen */
332 cap9adk_add_device_ts();
333 /* MMC */
334 at91_add_device_mmc(1, &cap9adk_mmc_data);
335 /* Ethernet */
336 at91_add_device_eth(&cap9adk_macb_data);
337 /* NAND */
338 at91_add_device_nand(&cap9adk_nand_data);
339 /* NOR Flash */
340 cap9adk_add_device_nor();
341 /* I2C */
342 at91_add_device_i2c(NULL, 0);
343 /* LCD Controller */
344 set_irq_type(AT91CAP9_ID_LCDC, IRQT_HIGH);
345 at91_add_device_lcdc(&cap9adk_lcdc_data);
346 /* AC97 */
347 at91_add_device_ac97(&cap9adk_ac97_data);
348}
349
350MACHINE_START(AT91CAP9ADK, "Atmel AT91CAP9A-DK")
351 /* Maintainer: Stelian Pop <stelian.pop@leadtechdesign.com> */
352 .phys_io = AT91_BASE_SYS,
353 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
354 .boot_params = AT91_SDRAM_BASE + 0x100,
355 .timer = &at91sam926x_timer,
356 .map_io = cap9adk_map_io,
357 .init_irq = cap9adk_init_irq,
358 .init_machine = cap9adk_board_init,
359MACHINE_END
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index d0aa20c9383e..0e2a11fc5bbd 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -25,6 +25,8 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/mtd/physmap.h> 27#include <linux/mtd/physmap.h>
28#include <linux/input.h>
29#include <linux/gpio_keys.h>
28 30
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/setup.h> 32#include <asm/setup.h>
@@ -156,6 +158,85 @@ static struct platform_device csb_flash = {
156 .num_resources = ARRAY_SIZE(csb_flash_resources), 158 .num_resources = ARRAY_SIZE(csb_flash_resources),
157}; 159};
158 160
161/*
162 * GPIO Buttons (on CSB300)
163 */
164#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
165static struct gpio_keys_button csb300_buttons[] = {
166 {
167 .gpio = AT91_PIN_PB29,
168 .code = BTN_0,
169 .desc = "sw0",
170 .active_low = 1,
171 .wakeup = 1,
172 },
173 {
174 .gpio = AT91_PIN_PB28,
175 .code = BTN_1,
176 .desc = "sw1",
177 .active_low = 1,
178 .wakeup = 1,
179 },
180 {
181 .gpio = AT91_PIN_PA21,
182 .code = BTN_2,
183 .desc = "sw2",
184 .active_low = 1,
185 .wakeup = 1,
186 }
187};
188
189static struct gpio_keys_platform_data csb300_button_data = {
190 .buttons = csb300_buttons,
191 .nbuttons = ARRAY_SIZE(csb300_buttons),
192};
193
194static struct platform_device csb300_button_device = {
195 .name = "gpio-keys",
196 .id = -1,
197 .num_resources = 0,
198 .dev = {
199 .platform_data = &csb300_button_data,
200 }
201};
202
203static void __init csb300_add_device_buttons(void)
204{
205 at91_set_gpio_input(AT91_PIN_PB29, 0); /* sw0 */
206 at91_set_deglitch(AT91_PIN_PB29, 1);
207 at91_set_gpio_input(AT91_PIN_PB28, 0); /* sw1 */
208 at91_set_deglitch(AT91_PIN_PB28, 1);
209 at91_set_gpio_input(AT91_PIN_PA21, 0); /* sw2 */
210 at91_set_deglitch(AT91_PIN_PA21, 1);
211
212 platform_device_register(&csb300_button_device);
213}
214#else
215static void __init csb300_add_device_buttons(void) {}
216#endif
217
218static struct gpio_led csb_leds[] = {
219 { /* "led0", yellow */
220 .name = "led0",
221 .gpio = AT91_PIN_PB2,
222 .active_low = 1,
223 .default_trigger = "heartbeat",
224 },
225 { /* "led1", green */
226 .name = "led1",
227 .gpio = AT91_PIN_PB1,
228 .active_low = 1,
229 .default_trigger = "mmc0",
230 },
231 { /* "led2", yellow */
232 .name = "led2",
233 .gpio = AT91_PIN_PB0,
234 .active_low = 1,
235 .default_trigger = "ide-disk",
236 },
237};
238
239
159static void __init csb337_board_init(void) 240static void __init csb337_board_init(void)
160{ 241{
161 /* Serial */ 242 /* Serial */
@@ -177,6 +258,10 @@ static void __init csb337_board_init(void)
177 at91_add_device_mmc(0, &csb337_mmc_data); 258 at91_add_device_mmc(0, &csb337_mmc_data);
178 /* NOR flash */ 259 /* NOR flash */
179 platform_device_register(&csb_flash); 260 platform_device_register(&csb_flash);
261 /* LEDs */
262 at91_gpio_leds(csb_leds, ARRAY_SIZE(csb_leds));
263 /* Switches on CSB300 */
264 csb300_add_device_buttons();
180} 265}
181 266
182MACHINE_START(CSB337, "Cogent CSB337") 267MACHINE_START(CSB337, "Cogent CSB337")
diff --git a/arch/arm/mach-at91/board-dk.c b/arch/arm/mach-at91/board-dk.c
index 40c9e4331706..0a897efeba8e 100644
--- a/arch/arm/mach-at91/board-dk.c
+++ b/arch/arm/mach-at91/board-dk.c
@@ -183,6 +183,14 @@ static struct platform_device dk_flash = {
183 .num_resources = 1, 183 .num_resources = 1,
184}; 184};
185 185
186static struct gpio_led dk_leds[] = {
187 {
188 .name = "led0",
189 .gpio = AT91_PIN_PB2,
190 .active_low = 1,
191 .default_trigger = "heartbeat",
192 }
193};
186 194
187static void __init dk_board_init(void) 195static void __init dk_board_init(void)
188{ 196{
@@ -213,6 +221,8 @@ static void __init dk_board_init(void)
213 at91_add_device_nand(&dk_nand_data); 221 at91_add_device_nand(&dk_nand_data);
214 /* NOR Flash */ 222 /* NOR Flash */
215 platform_device_register(&dk_flash); 223 platform_device_register(&dk_flash);
224 /* LEDs */
225 at91_gpio_leds(dk_leds, ARRAY_SIZE(dk_leds));
216 /* VGA */ 226 /* VGA */
217// dk_add_device_video(); 227// dk_add_device_video();
218} 228}
diff --git a/arch/arm/mach-at91/board-ek.c b/arch/arm/mach-at91/board-ek.c
index 53a5ef9e72ee..0574e50a30dd 100644
--- a/arch/arm/mach-at91/board-ek.c
+++ b/arch/arm/mach-at91/board-ek.c
@@ -141,6 +141,25 @@ static struct platform_device ek_flash = {
141 .num_resources = 1, 141 .num_resources = 1,
142}; 142};
143 143
144static struct gpio_led ek_leds[] = {
145 { /* "user led 1", DS2 */
146 .name = "green",
147 .gpio = AT91_PIN_PB0,
148 .active_low = 1,
149 .default_trigger = "mmc0",
150 },
151 { /* "user led 2", DS4 */
152 .name = "yellow",
153 .gpio = AT91_PIN_PB1,
154 .active_low = 1,
155 .default_trigger = "heartbeat",
156 },
157 { /* "user led 3", DS6 */
158 .name = "red",
159 .gpio = AT91_PIN_PB2,
160 .active_low = 1,
161 }
162};
144 163
145static void __init ek_board_init(void) 164static void __init ek_board_init(void)
146{ 165{
@@ -167,6 +186,8 @@ static void __init ek_board_init(void)
167#endif 186#endif
168 /* NOR Flash */ 187 /* NOR Flash */
169 platform_device_register(&ek_flash); 188 platform_device_register(&ek_flash);
189 /* LEDs */
190 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
170 /* VGA */ 191 /* VGA */
171// ek_add_device_video(); 192// ek_add_device_video();
172} 193}
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 550ae59a3aca..aa29ea58ca09 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -280,6 +280,68 @@ static struct spi_board_info ek_spi_devices[] = {
280 * LCD Controller 280 * LCD Controller
281 */ 281 */
282#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) 282#if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE)
283
284#if defined(CONFIG_FB_ATMEL_STN)
285
286/* STN */
287static struct fb_videomode at91_stn_modes[] = {
288 {
289 .name = "SP06Q002 @ 75",
290 .refresh = 75,
291 .xres = 320, .yres = 240,
292 .pixclock = KHZ2PICOS(1440),
293
294 .left_margin = 1, .right_margin = 1,
295 .upper_margin = 0, .lower_margin = 0,
296 .hsync_len = 1, .vsync_len = 1,
297
298 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
299 .vmode = FB_VMODE_NONINTERLACED,
300 },
301};
302
303static struct fb_monspecs at91fb_default_stn_monspecs = {
304 .manufacturer = "HIT",
305 .monitor = "SP06Q002",
306
307 .modedb = at91_stn_modes,
308 .modedb_len = ARRAY_SIZE(at91_stn_modes),
309 .hfmin = 15000,
310 .hfmax = 64000,
311 .vfmin = 50,
312 .vfmax = 150,
313};
314
315#define AT91SAM9261_DEFAULT_STN_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
316 | ATMEL_LCDC_DISTYPE_STNMONO \
317 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE \
318 | ATMEL_LCDC_IFWIDTH_4 \
319 | ATMEL_LCDC_SCANMOD_SINGLE)
320
321static void at91_lcdc_stn_power_control(int on)
322{
323 /* backlight */
324 if (on) { /* power up */
325 at91_set_gpio_value(AT91_PIN_PC14, 0);
326 at91_set_gpio_value(AT91_PIN_PC15, 0);
327 } else { /* power down */
328 at91_set_gpio_value(AT91_PIN_PC14, 1);
329 at91_set_gpio_value(AT91_PIN_PC15, 1);
330 }
331}
332
333static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
334 .default_bpp = 1,
335 .default_dmacon = ATMEL_LCDC_DMAEN,
336 .default_lcdcon2 = AT91SAM9261_DEFAULT_STN_LCDCON2,
337 .default_monspecs = &at91fb_default_stn_monspecs,
338 .atmel_lcdfb_power_control = at91_lcdc_stn_power_control,
339 .guard_time = 1,
340};
341
342#else
343
344/* TFT */
283static struct fb_videomode at91_tft_vga_modes[] = { 345static struct fb_videomode at91_tft_vga_modes[] = {
284 { 346 {
285 .name = "TX09D50VM1CCA @ 60", 347 .name = "TX09D50VM1CCA @ 60",
@@ -296,7 +358,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
296 }, 358 },
297}; 359};
298 360
299static struct fb_monspecs at91fb_default_monspecs = { 361static struct fb_monspecs at91fb_default_tft_monspecs = {
300 .manufacturer = "HIT", 362 .manufacturer = "HIT",
301 .monitor = "TX09D50VM1CCA", 363 .monitor = "TX09D50VM1CCA",
302 364
@@ -308,11 +370,11 @@ static struct fb_monspecs at91fb_default_monspecs = {
308 .vfmax = 150, 370 .vfmax = 150,
309}; 371};
310 372
311#define AT91SAM9261_DEFAULT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \ 373#define AT91SAM9261_DEFAULT_TFT_LCDCON2 (ATMEL_LCDC_MEMOR_LITTLE \
312 | ATMEL_LCDC_DISTYPE_TFT \ 374 | ATMEL_LCDC_DISTYPE_TFT \
313 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE) 375 | ATMEL_LCDC_CLKMOD_ALWAYSACTIVE)
314 376
315static void at91_lcdc_power_control(int on) 377static void at91_lcdc_tft_power_control(int on)
316{ 378{
317 if (on) 379 if (on)
318 at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */ 380 at91_set_gpio_value(AT91_PIN_PA12, 0); /* power up */
@@ -320,15 +382,15 @@ static void at91_lcdc_power_control(int on)
320 at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */ 382 at91_set_gpio_value(AT91_PIN_PA12, 1); /* power down */
321} 383}
322 384
323/* Driver datas */
324static struct atmel_lcdfb_info __initdata ek_lcdc_data = { 385static struct atmel_lcdfb_info __initdata ek_lcdc_data = {
325 .default_bpp = 16, 386 .default_bpp = 16,
326 .default_dmacon = ATMEL_LCDC_DMAEN, 387 .default_dmacon = ATMEL_LCDC_DMAEN,
327 .default_lcdcon2 = AT91SAM9261_DEFAULT_LCDCON2, 388 .default_lcdcon2 = AT91SAM9261_DEFAULT_TFT_LCDCON2,
328 .default_monspecs = &at91fb_default_monspecs, 389 .default_monspecs = &at91fb_default_tft_monspecs,
329 .atmel_lcdfb_power_control = at91_lcdc_power_control, 390 .atmel_lcdfb_power_control = at91_lcdc_tft_power_control,
330 .guard_time = 1, 391 .guard_time = 1,
331}; 392};
393#endif
332 394
333#else 395#else
334static struct atmel_lcdfb_info __initdata ek_lcdc_data; 396static struct atmel_lcdfb_info __initdata ek_lcdc_data;
@@ -342,25 +404,25 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data;
342static struct gpio_keys_button ek_buttons[] = { 404static struct gpio_keys_button ek_buttons[] = {
343 { 405 {
344 .gpio = AT91_PIN_PA27, 406 .gpio = AT91_PIN_PA27,
345 .keycode = BTN_0, 407 .code = BTN_0,
346 .desc = "Button 0", 408 .desc = "Button 0",
347 .active_low = 1, 409 .active_low = 1,
348 }, 410 },
349 { 411 {
350 .gpio = AT91_PIN_PA26, 412 .gpio = AT91_PIN_PA26,
351 .keycode = BTN_1, 413 .code = BTN_1,
352 .desc = "Button 1", 414 .desc = "Button 1",
353 .active_low = 1, 415 .active_low = 1,
354 }, 416 },
355 { 417 {
356 .gpio = AT91_PIN_PA25, 418 .gpio = AT91_PIN_PA25,
357 .keycode = BTN_2, 419 .code = BTN_2,
358 .desc = "Button 2", 420 .desc = "Button 2",
359 .active_low = 1, 421 .active_low = 1,
360 }, 422 },
361 { 423 {
362 .gpio = AT91_PIN_PA24, 424 .gpio = AT91_PIN_PA24,
363 .keycode = BTN_3, 425 .code = BTN_3,
364 .desc = "Button 3", 426 .desc = "Button 3",
365 .active_low = 1, 427 .active_low = 1,
366 } 428 }
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index ab9dcc075454..f09347a86e71 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -27,6 +27,8 @@
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h> 28#include <linux/spi/ads7846.h>
29#include <linux/fb.h> 29#include <linux/fb.h>
30#include <linux/gpio_keys.h>
31#include <linux/input.h>
30 32
31#include <video/atmel_lcdc.h> 33#include <video/atmel_lcdc.h>
32 34
@@ -163,6 +165,7 @@ static struct at91_mmc_data __initdata ek_mmc_data = {
163 * MACB Ethernet device 165 * MACB Ethernet device
164 */ 166 */
165static struct at91_eth_data __initdata ek_macb_data = { 167static struct at91_eth_data __initdata ek_macb_data = {
168 .phy_irq_pin = AT91_PIN_PE31,
166 .is_rmii = 1, 169 .is_rmii = 1,
167}; 170};
168 171
@@ -264,6 +267,55 @@ static struct atmel_lcdfb_info __initdata ek_lcdc_data;
264 267
265 268
266/* 269/*
270 * GPIO Buttons
271 */
272#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
273static struct gpio_keys_button ek_buttons[] = {
274 { /* BP1, "leftclic" */
275 .code = BTN_LEFT,
276 .gpio = AT91_PIN_PC5,
277 .active_low = 1,
278 .desc = "left_click",
279 .wakeup = 1,
280 },
281 { /* BP2, "rightclic" */
282 .code = BTN_RIGHT,
283 .gpio = AT91_PIN_PC4,
284 .active_low = 1,
285 .desc = "right_click",
286 .wakeup = 1,
287 },
288};
289
290static struct gpio_keys_platform_data ek_button_data = {
291 .buttons = ek_buttons,
292 .nbuttons = ARRAY_SIZE(ek_buttons),
293};
294
295static struct platform_device ek_button_device = {
296 .name = "gpio-keys",
297 .id = -1,
298 .num_resources = 0,
299 .dev = {
300 .platform_data = &ek_button_data,
301 }
302};
303
304static void __init ek_add_device_buttons(void)
305{
306 at91_set_GPIO_periph(AT91_PIN_PC5, 0); /* left button */
307 at91_set_deglitch(AT91_PIN_PC5, 1);
308 at91_set_GPIO_periph(AT91_PIN_PC4, 0); /* right button */
309 at91_set_deglitch(AT91_PIN_PC4, 1);
310
311 platform_device_register(&ek_button_device);
312}
313#else
314static void __init ek_add_device_buttons(void) {}
315#endif
316
317
318/*
267 * AC97 319 * AC97
268 */ 320 */
269static struct atmel_ac97_data ek_ac97_data = { 321static struct atmel_ac97_data ek_ac97_data = {
@@ -271,6 +323,30 @@ static struct atmel_ac97_data ek_ac97_data = {
271}; 323};
272 324
273 325
326/*
327 * LEDs ... these could all be PWM-driven, for variable brightness
328 */
329static struct gpio_led ek_leds[] = {
330 { /* "left" led, green, userled1, pwm1 */
331 .name = "ds1",
332 .gpio = AT91_PIN_PB8,
333 .active_low = 1,
334 .default_trigger = "mmc0",
335 },
336 { /* "right" led, green, userled2, pwm2 */
337 .name = "ds2",
338 .gpio = AT91_PIN_PC29,
339 .active_low = 1,
340 .default_trigger = "nand-disk",
341 },
342 { /* "power" led, yellow, pwm0 */
343 .name = "ds3",
344 .gpio = AT91_PIN_PB7,
345 .default_trigger = "heartbeat",
346 },
347};
348
349
274static void __init ek_board_init(void) 350static void __init ek_board_init(void)
275{ 351{
276 /* Serial */ 352 /* Serial */
@@ -294,8 +370,12 @@ static void __init ek_board_init(void)
294 at91_add_device_i2c(NULL, 0); 370 at91_add_device_i2c(NULL, 0);
295 /* LCD Controller */ 371 /* LCD Controller */
296 at91_add_device_lcdc(&ek_lcdc_data); 372 at91_add_device_lcdc(&ek_lcdc_data);
373 /* Push Buttons */
374 ek_add_device_buttons();
297 /* AC97 */ 375 /* AC97 */
298 at91_add_device_ac97(&ek_ac97_data); 376 at91_add_device_ac97(&ek_ac97_data);
377 /* LEDs */
378 at91_gpio_leds(ek_leds, ARRAY_SIZE(ek_leds));
299} 379}
300 380
301MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK") 381MACHINE_START(AT91SAM9263EK, "Atmel AT91SAM9263-EK")
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index 57c3b647ce83..ec76eeaafd45 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -574,6 +574,8 @@ int __init at91_clock_init(unsigned long main_clock)
574 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) { 574 } else if (cpu_is_at91sam9260() || cpu_is_at91sam9261() || cpu_is_at91sam9263()) {
575 uhpck.pmc_mask = AT91SAM926x_PMC_UHP; 575 uhpck.pmc_mask = AT91SAM926x_PMC_UHP;
576 udpck.pmc_mask = AT91SAM926x_PMC_UDP; 576 udpck.pmc_mask = AT91SAM926x_PMC_UDP;
577 } else if (cpu_is_at91cap9()) {
578 uhpck.pmc_mask = AT91CAP9_PMC_UHP;
577 } 579 }
578 at91_sys_write(AT91_CKGR_PLLBR, 0); 580 at91_sys_write(AT91_CKGR_PLLBR, 0);
579 581
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 77d4c0a37842..b5daf7f5e011 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -15,6 +15,7 @@ extern void __init at91sam9261_initialize(unsigned long main_clock);
15extern void __init at91sam9263_initialize(unsigned long main_clock); 15extern void __init at91sam9263_initialize(unsigned long main_clock);
16extern void __init at91sam9rl_initialize(unsigned long main_clock); 16extern void __init at91sam9rl_initialize(unsigned long main_clock);
17extern void __init at91x40_initialize(unsigned long main_clock); 17extern void __init at91x40_initialize(unsigned long main_clock);
18extern void __init at91cap9_initialize(unsigned long main_clock);
18 19
19 /* Interrupts */ 20 /* Interrupts */
20extern void __init at91rm9200_init_interrupts(unsigned int priority[]); 21extern void __init at91rm9200_init_interrupts(unsigned int priority[]);
@@ -23,6 +24,7 @@ extern void __init at91sam9261_init_interrupts(unsigned int priority[]);
23extern void __init at91sam9263_init_interrupts(unsigned int priority[]); 24extern void __init at91sam9263_init_interrupts(unsigned int priority[]);
24extern void __init at91sam9rl_init_interrupts(unsigned int priority[]); 25extern void __init at91sam9rl_init_interrupts(unsigned int priority[]);
25extern void __init at91x40_init_interrupts(unsigned int priority[]); 26extern void __init at91x40_init_interrupts(unsigned int priority[]);
27extern void __init at91cap9_init_interrupts(unsigned int priority[]);
26extern void __init at91_aic_init(unsigned int priority[]); 28extern void __init at91_aic_init(unsigned int priority[]);
27 29
28 /* Timer */ 30 /* Timer */
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index aa2d365c93fb..6aeddd68d8af 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -13,6 +13,8 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/debugfs.h>
17#include <linux/seq_file.h>
16#include <linux/kernel.h> 18#include <linux/kernel.h>
17#include <linux/list.h> 19#include <linux/list.h>
18#include <linux/module.h> 20#include <linux/module.h>
@@ -414,6 +416,66 @@ static void gpio_irq_handler(unsigned irq, struct irq_desc *desc)
414 416
415/*--------------------------------------------------------------------------*/ 417/*--------------------------------------------------------------------------*/
416 418
419#ifdef CONFIG_DEBUG_FS
420
421static int at91_gpio_show(struct seq_file *s, void *unused)
422{
423 int bank, j;
424
425 /* print heading */
426 seq_printf(s, "Pin\t");
427 for (bank = 0; bank < gpio_banks; bank++) {
428 seq_printf(s, "PIO%c\t", 'A' + bank);
429 };
430 seq_printf(s, "\n\n");
431
432 /* print pin status */
433 for (j = 0; j < 32; j++) {
434 seq_printf(s, "%i:\t", j);
435
436 for (bank = 0; bank < gpio_banks; bank++) {
437 unsigned pin = PIN_BASE + (32 * bank) + j;
438 void __iomem *pio = pin_to_controller(pin);
439 unsigned mask = pin_to_mask(pin);
440
441 if (__raw_readl(pio + PIO_PSR) & mask)
442 seq_printf(s, "GPIO:%s", __raw_readl(pio + PIO_PDSR) & mask ? "1" : "0");
443 else
444 seq_printf(s, "%s", __raw_readl(pio + PIO_ABSR) & mask ? "B" : "A");
445
446 seq_printf(s, "\t");
447 }
448
449 seq_printf(s, "\n");
450 }
451
452 return 0;
453}
454
455static int at91_gpio_open(struct inode *inode, struct file *file)
456{
457 return single_open(file, at91_gpio_show, NULL);
458}
459
460static const struct file_operations at91_gpio_operations = {
461 .open = at91_gpio_open,
462 .read = seq_read,
463 .llseek = seq_lseek,
464 .release = single_release,
465};
466
467static int __init at91_gpio_debugfs_init(void)
468{
469 /* /sys/kernel/debug/at91_gpio */
470 (void) debugfs_create_file("at91_gpio", S_IFREG | S_IRUGO, NULL, NULL, &at91_gpio_operations);
471 return 0;
472}
473postcore_initcall(at91_gpio_debugfs_init);
474
475#endif
476
477/*--------------------------------------------------------------------------*/
478
417/* 479/*
418 * Called from the processor-specific init to enable GPIO interrupt support. 480 * Called from the processor-specific init to enable GPIO interrupt support.
419 */ 481 */
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 0d5144973988..9cdcda500fe8 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -14,11 +14,62 @@
14#include <linux/init.h> 14#include <linux/init.h>
15 15
16#include <asm/mach-types.h> 16#include <asm/mach-types.h>
17#include <asm/leds.h>
18#include <asm/arch/board.h> 17#include <asm/arch/board.h>
19#include <asm/arch/gpio.h> 18#include <asm/arch/gpio.h>
20 19
21 20
21/* ------------------------------------------------------------------------- */
22
23#if defined(CONFIG_NEW_LEDS)
24
25#include <linux/platform_device.h>
26
27/*
28 * New cross-platform LED support.
29 */
30
31static struct gpio_led_platform_data led_data;
32
33static struct platform_device at91_leds = {
34 .name = "leds-gpio",
35 .id = -1,
36 .dev.platform_data = &led_data,
37};
38
39void __init at91_gpio_leds(struct gpio_led *leds, int nr)
40{
41 int i;
42
43 if (!nr)
44 return;
45
46 for (i = 0; i < nr; i++)
47 at91_set_gpio_output(leds[i].gpio, leds[i].active_low);
48
49 led_data.leds = leds;
50 led_data.num_leds = nr;
51 platform_device_register(&at91_leds);
52}
53
54#else
55void __init at91_gpio_leds(struct gpio_led *leds, int nr) {}
56#endif
57
58
59/* ------------------------------------------------------------------------- */
60
61#if defined(CONFIG_LEDS)
62
63#include <asm/leds.h>
64
65/*
66 * Old ARM-specific LED framework; not fully functional when generic time is
67 * in use.
68 */
69
70static u8 at91_leds_cpu;
71static u8 at91_leds_timer;
72
22static inline void at91_led_on(unsigned int led) 73static inline void at91_led_on(unsigned int led)
23{ 74{
24 at91_set_gpio_value(led, 0); 75 at91_set_gpio_value(led, 0);
@@ -93,3 +144,18 @@ static int __init leds_init(void)
93} 144}
94 145
95__initcall(leds_init); 146__initcall(leds_init);
147
148
149void __init at91_init_leds(u8 cpu_led, u8 timer_led)
150{
151 /* Enable GPIO to access the LEDs */
152 at91_set_gpio_output(cpu_led, 1);
153 at91_set_gpio_output(timer_led, 1);
154
155 at91_leds_cpu = cpu_led;
156 at91_leds_timer = timer_led;
157}
158
159#else
160void __init at91_init_leds(u8 cpu_led, u8 timer_led) {}
161#endif
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 98cb61482917..4b120cc36135 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -80,6 +80,11 @@ static int at91_pm_verify_clocks(void)
80 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n"); 80 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
81 return 0; 81 return 0;
82 } 82 }
83 } else if (cpu_is_at91cap9()) {
84 if ((scsr & AT91CAP9_PMC_UHP) != 0) {
85 pr_debug("AT91: PM - Suspend-to-RAM with USB still active\n");
86 return 0;
87 }
83 } 88 }
84 89
85#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS 90#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
diff --git a/arch/arm/mach-clps711x/time.c b/arch/arm/mach-clps711x/time.c
index f428af7545b4..e5dc33f1f95c 100644
--- a/arch/arm/mach-clps711x/time.c
+++ b/arch/arm/mach-clps711x/time.c
@@ -50,9 +50,7 @@ static unsigned long clps711x_gettimeoffset(void)
50static irqreturn_t 50static irqreturn_t
51p720t_timer_interrupt(int irq, void *dev_id) 51p720t_timer_interrupt(int irq, void *dev_id)
52{ 52{
53 write_seqlock(&xtime_lock);
54 timer_tick(); 53 timer_tick();
55 write_sequnlock(&xtime_lock);
56 return IRQ_HANDLED; 54 return IRQ_HANDLED;
57} 55}
58 56
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
index 986205ec9269..2ac63671ea5f 100644
--- a/arch/arm/mach-clps7500/core.c
+++ b/arch/arm/mach-clps7500/core.c
@@ -298,8 +298,6 @@ extern unsigned long ioc_timer_gettimeoffset(void);
298static irqreturn_t 298static irqreturn_t
299clps7500_timer_interrupt(int irq, void *dev_id) 299clps7500_timer_interrupt(int irq, void *dev_id)
300{ 300{
301 write_seqlock(&xtime_lock);
302
303 timer_tick(); 301 timer_tick();
304 302
305 /* Why not using do_leds interface?? */ 303 /* Why not using do_leds interface?? */
@@ -313,8 +311,6 @@ clps7500_timer_interrupt(int irq, void *dev_id)
313 } 311 }
314 } 312 }
315 313
316 write_sequnlock(&xtime_lock);
317
318 return IRQ_HANDLED; 314 return IRQ_HANDLED;
319} 315}
320 316
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 8c1b5690dfe8..7710e14b5268 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -178,8 +178,6 @@ ebsa110_timer_interrupt(int irq, void *dev_id)
178{ 178{
179 u32 count; 179 u32 count;
180 180
181 write_seqlock(&xtime_lock);
182
183 /* latch and read timer 1 */ 181 /* latch and read timer 1 */
184 __raw_writeb(0x40, PIT_CTRL); 182 __raw_writeb(0x40, PIT_CTRL);
185 count = __raw_readb(PIT_T1); 183 count = __raw_readb(PIT_T1);
@@ -192,8 +190,6 @@ ebsa110_timer_interrupt(int irq, void *dev_id)
192 190
193 timer_tick(); 191 timer_tick();
194 192
195 write_sequnlock(&xtime_lock);
196
197 return IRQ_HANDLED; 193 return IRQ_HANDLED;
198} 194}
199 195
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 70b2c7801110..91f6a07a51d5 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -3,6 +3,7 @@
3 * Core routines for Cirrus EP93xx chips. 3 * Core routines for Cirrus EP93xx chips.
4 * 4 *
5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> 5 * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
6 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
6 * 7 *
7 * Thanks go to Michael Burian and Ray Lehtiniemi for their key 8 * Thanks go to Michael Burian and Ray Lehtiniemi for their key
8 * role in the ep93xx linux community. 9 * role in the ep93xx linux community.
@@ -21,7 +22,6 @@
21#include <linux/serial.h> 22#include <linux/serial.h>
22#include <linux/tty.h> 23#include <linux/tty.h>
23#include <linux/bitops.h> 24#include <linux/bitops.h>
24#include <linux/serial.h>
25#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
26#include <linux/serial_core.h> 26#include <linux/serial_core.h>
27#include <linux/device.h> 27#include <linux/device.h>
@@ -99,8 +99,6 @@ static unsigned int last_jiffy_time;
99 99
100static int ep93xx_timer_interrupt(int irq, void *dev_id) 100static int ep93xx_timer_interrupt(int irq, void *dev_id)
101{ 101{
102 write_seqlock(&xtime_lock);
103
104 __raw_writel(1, EP93XX_TIMER1_CLEAR); 102 __raw_writel(1, EP93XX_TIMER1_CLEAR);
105 while ((signed long) 103 while ((signed long)
106 (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time) 104 (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time)
@@ -109,8 +107,6 @@ static int ep93xx_timer_interrupt(int irq, void *dev_id)
109 timer_tick(); 107 timer_tick();
110 } 108 }
111 109
112 write_sequnlock(&xtime_lock);
113
114 return IRQ_HANDLED; 110 return IRQ_HANDLED;
115} 111}
116 112
@@ -157,38 +153,41 @@ static unsigned char gpio_int_enabled[3];
157static unsigned char gpio_int_type1[3]; 153static unsigned char gpio_int_type1[3];
158static unsigned char gpio_int_type2[3]; 154static unsigned char gpio_int_type2[3];
159 155
160static void update_gpio_int_params(int abf) 156/* Port ordering is: A B F */
157static const u8 int_type1_register_offset[3] = { 0x90, 0xac, 0x4c };
158static const u8 int_type2_register_offset[3] = { 0x94, 0xb0, 0x50 };
159static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 };
160static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x5c };
161
162static void update_gpio_int_params(unsigned port)
161{ 163{
162 if (abf == 0) { 164 BUG_ON(port > 2);
163 __raw_writeb(0, EP93XX_GPIO_A_INT_ENABLE);
164 __raw_writeb(gpio_int_type2[0], EP93XX_GPIO_A_INT_TYPE2);
165 __raw_writeb(gpio_int_type1[0], EP93XX_GPIO_A_INT_TYPE1);
166 __raw_writeb(gpio_int_unmasked[0] & gpio_int_enabled[0], EP93XX_GPIO_A_INT_ENABLE);
167 } else if (abf == 1) {
168 __raw_writeb(0, EP93XX_GPIO_B_INT_ENABLE);
169 __raw_writeb(gpio_int_type2[1], EP93XX_GPIO_B_INT_TYPE2);
170 __raw_writeb(gpio_int_type1[1], EP93XX_GPIO_B_INT_TYPE1);
171 __raw_writeb(gpio_int_unmasked[1] & gpio_int_enabled[1], EP93XX_GPIO_B_INT_ENABLE);
172 } else if (abf == 2) {
173 __raw_writeb(0, EP93XX_GPIO_F_INT_ENABLE);
174 __raw_writeb(gpio_int_type2[2], EP93XX_GPIO_F_INT_TYPE2);
175 __raw_writeb(gpio_int_type1[2], EP93XX_GPIO_F_INT_TYPE1);
176 __raw_writeb(gpio_int_unmasked[2] & gpio_int_enabled[2], EP93XX_GPIO_F_INT_ENABLE);
177 } else {
178 BUG();
179 }
180}
181 165
166 __raw_writeb(0, EP93XX_GPIO_REG(int_en_register_offset[port]));
182 167
183static unsigned char data_register_offset[8] = { 168 __raw_writeb(gpio_int_type2[port],
184 0x00, 0x04, 0x08, 0x0c, 0x20, 0x30, 0x38, 0x40, 169 EP93XX_GPIO_REG(int_type2_register_offset[port]));
170
171 __raw_writeb(gpio_int_type1[port],
172 EP93XX_GPIO_REG(int_type1_register_offset[port]));
173
174 __raw_writeb(gpio_int_unmasked[port] & gpio_int_enabled[port],
175 EP93XX_GPIO_REG(int_en_register_offset[port]));
176}
177
178/* Port ordering is: A B F D E C G H */
179static const u8 data_register_offset[8] = {
180 0x00, 0x04, 0x30, 0x0c, 0x20, 0x08, 0x38, 0x40,
185}; 181};
186 182
187static unsigned char data_direction_register_offset[8] = { 183static const u8 data_direction_register_offset[8] = {
188 0x10, 0x14, 0x18, 0x1c, 0x24, 0x34, 0x3c, 0x44, 184 0x10, 0x14, 0x34, 0x1c, 0x24, 0x18, 0x3c, 0x44,
189}; 185};
190 186
191void gpio_line_config(int line, int direction) 187#define GPIO_IN 0
188#define GPIO_OUT 1
189
190static void ep93xx_gpio_set_direction(unsigned line, int direction)
192{ 191{
193 unsigned int data_direction_register; 192 unsigned int data_direction_register;
194 unsigned long flags; 193 unsigned long flags;
@@ -199,14 +198,10 @@ void gpio_line_config(int line, int direction)
199 198
200 local_irq_save(flags); 199 local_irq_save(flags);
201 if (direction == GPIO_OUT) { 200 if (direction == GPIO_OUT) {
202 if (line >= 0 && line < 16) { 201 if (line >= 0 && line <= EP93XX_GPIO_LINE_MAX_IRQ) {
203 /* Port A/B. */ 202 /* Port A/B/F */
204 gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7)); 203 gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7));
205 update_gpio_int_params(line >> 3); 204 update_gpio_int_params(line >> 3);
206 } else if (line >= 40 && line < 48) {
207 /* Port F. */
208 gpio_int_unmasked[2] &= ~(1 << (line & 7));
209 update_gpio_int_params(2);
210 } 205 }
211 206
212 v = __raw_readb(data_direction_register); 207 v = __raw_readb(data_direction_register);
@@ -219,39 +214,58 @@ void gpio_line_config(int line, int direction)
219 } 214 }
220 local_irq_restore(flags); 215 local_irq_restore(flags);
221} 216}
222EXPORT_SYMBOL(gpio_line_config);
223 217
224int gpio_line_get(int line) 218int gpio_direction_input(unsigned gpio)
219{
220 if (gpio > EP93XX_GPIO_LINE_MAX)
221 return -EINVAL;
222
223 ep93xx_gpio_set_direction(gpio, GPIO_IN);
224
225 return 0;
226}
227EXPORT_SYMBOL(gpio_direction_input);
228
229int gpio_direction_output(unsigned gpio, int value)
230{
231 if (gpio > EP93XX_GPIO_LINE_MAX)
232 return -EINVAL;
233
234 gpio_set_value(gpio, value);
235 ep93xx_gpio_set_direction(gpio, GPIO_OUT);
236
237 return 0;
238}
239EXPORT_SYMBOL(gpio_direction_output);
240
241int gpio_get_value(unsigned gpio)
225{ 242{
226 unsigned int data_register; 243 unsigned int data_register;
227 244
228 data_register = EP93XX_GPIO_REG(data_register_offset[line >> 3]); 245 data_register = EP93XX_GPIO_REG(data_register_offset[gpio >> 3]);
229 246
230 return !!(__raw_readb(data_register) & (1 << (line & 7))); 247 return !!(__raw_readb(data_register) & (1 << (gpio & 7)));
231} 248}
232EXPORT_SYMBOL(gpio_line_get); 249EXPORT_SYMBOL(gpio_get_value);
233 250
234void gpio_line_set(int line, int value) 251void gpio_set_value(unsigned gpio, int value)
235{ 252{
236 unsigned int data_register; 253 unsigned int data_register;
237 unsigned long flags; 254 unsigned long flags;
238 unsigned char v; 255 unsigned char v;
239 256
240 data_register = EP93XX_GPIO_REG(data_register_offset[line >> 3]); 257 data_register = EP93XX_GPIO_REG(data_register_offset[gpio >> 3]);
241 258
242 local_irq_save(flags); 259 local_irq_save(flags);
243 if (value == EP93XX_GPIO_HIGH) { 260 v = __raw_readb(data_register);
244 v = __raw_readb(data_register); 261 if (value)
245 v |= 1 << (line & 7); 262 v |= 1 << (gpio & 7);
246 __raw_writeb(v, data_register); 263 else
247 } else if (value == EP93XX_GPIO_LOW) { 264 v &= ~(1 << (gpio & 7));
248 v = __raw_readb(data_register); 265 __raw_writeb(v, data_register);
249 v &= ~(1 << (line & 7));
250 __raw_writeb(v, data_register);
251 }
252 local_irq_restore(flags); 266 local_irq_restore(flags);
253} 267}
254EXPORT_SYMBOL(gpio_line_set); 268EXPORT_SYMBOL(gpio_set_value);
255 269
256 270
257/************************************************************************* 271/*************************************************************************
@@ -265,47 +279,67 @@ static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc)
265 status = __raw_readb(EP93XX_GPIO_A_INT_STATUS); 279 status = __raw_readb(EP93XX_GPIO_A_INT_STATUS);
266 for (i = 0; i < 8; i++) { 280 for (i = 0; i < 8; i++) {
267 if (status & (1 << i)) { 281 if (status & (1 << i)) {
268 desc = irq_desc + IRQ_EP93XX_GPIO(0) + i; 282 int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_A(0)) + i;
269 desc_handle_irq(IRQ_EP93XX_GPIO(0) + i, desc); 283 desc = irq_desc + gpio_irq;
284 desc_handle_irq(gpio_irq, desc);
270 } 285 }
271 } 286 }
272 287
273 status = __raw_readb(EP93XX_GPIO_B_INT_STATUS); 288 status = __raw_readb(EP93XX_GPIO_B_INT_STATUS);
274 for (i = 0; i < 8; i++) { 289 for (i = 0; i < 8; i++) {
275 if (status & (1 << i)) { 290 if (status & (1 << i)) {
276 desc = irq_desc + IRQ_EP93XX_GPIO(8) + i; 291 int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_B(0)) + i;
277 desc_handle_irq(IRQ_EP93XX_GPIO(8) + i, desc); 292 desc = irq_desc + gpio_irq;
293 desc_handle_irq(gpio_irq, desc);
278 } 294 }
279 } 295 }
280} 296}
281 297
282static void ep93xx_gpio_f_irq_handler(unsigned int irq, struct irq_desc *desc) 298static void ep93xx_gpio_f_irq_handler(unsigned int irq, struct irq_desc *desc)
283{ 299{
284 int gpio_irq = IRQ_EP93XX_GPIO(16) + (((irq + 1) & 7) ^ 4); 300 /*
301 * map discontiguous hw irq range to continous sw irq range:
302 *
303 * IRQ_EP93XX_GPIO{0..7}MUX -> gpio_to_irq(EP93XX_GPIO_LINE_F({0..7})
304 */
305 int port_f_idx = ((irq + 1) & 7) ^ 4; /* {19..22,47..50} -> {0..7} */
306 int gpio_irq = gpio_to_irq(EP93XX_GPIO_LINE_F(0)) + port_f_idx;
285 307
286 desc_handle_irq(gpio_irq, irq_desc + gpio_irq); 308 desc_handle_irq(gpio_irq, irq_desc + gpio_irq);
287} 309}
288 310
311static void ep93xx_gpio_irq_ack(unsigned int irq)
312{
313 int line = irq_to_gpio(irq);
314 int port = line >> 3;
315 int port_mask = 1 << (line & 7);
316
317 if ((irq_desc[irq].status & IRQ_TYPE_SENSE_MASK) == IRQT_BOTHEDGE) {
318 gpio_int_type2[port] ^= port_mask; /* switch edge direction */
319 update_gpio_int_params(port);
320 }
321
322 __raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
323}
324
289static void ep93xx_gpio_irq_mask_ack(unsigned int irq) 325static void ep93xx_gpio_irq_mask_ack(unsigned int irq)
290{ 326{
291 int line = irq - IRQ_EP93XX_GPIO(0); 327 int line = irq_to_gpio(irq);
292 int port = line >> 3; 328 int port = line >> 3;
329 int port_mask = 1 << (line & 7);
293 330
294 gpio_int_unmasked[port] &= ~(1 << (line & 7)); 331 if ((irq_desc[irq].status & IRQ_TYPE_SENSE_MASK) == IRQT_BOTHEDGE)
332 gpio_int_type2[port] ^= port_mask; /* switch edge direction */
333
334 gpio_int_unmasked[port] &= ~port_mask;
295 update_gpio_int_params(port); 335 update_gpio_int_params(port);
296 336
297 if (port == 0) { 337 __raw_writeb(port_mask, EP93XX_GPIO_REG(eoi_register_offset[port]));
298 __raw_writel(1 << (line & 7), EP93XX_GPIO_A_INT_ACK);
299 } else if (port == 1) {
300 __raw_writel(1 << (line & 7), EP93XX_GPIO_B_INT_ACK);
301 } else if (port == 2) {
302 __raw_writel(1 << (line & 7), EP93XX_GPIO_F_INT_ACK);
303 }
304} 338}
305 339
306static void ep93xx_gpio_irq_mask(unsigned int irq) 340static void ep93xx_gpio_irq_mask(unsigned int irq)
307{ 341{
308 int line = irq - IRQ_EP93XX_GPIO(0); 342 int line = irq_to_gpio(irq);
309 int port = line >> 3; 343 int port = line >> 3;
310 344
311 gpio_int_unmasked[port] &= ~(1 << (line & 7)); 345 gpio_int_unmasked[port] &= ~(1 << (line & 7));
@@ -314,7 +348,7 @@ static void ep93xx_gpio_irq_mask(unsigned int irq)
314 348
315static void ep93xx_gpio_irq_unmask(unsigned int irq) 349static void ep93xx_gpio_irq_unmask(unsigned int irq)
316{ 350{
317 int line = irq - IRQ_EP93XX_GPIO(0); 351 int line = irq_to_gpio(irq);
318 int port = line >> 3; 352 int port = line >> 3;
319 353
320 gpio_int_unmasked[port] |= 1 << (line & 7); 354 gpio_int_unmasked[port] |= 1 << (line & 7);
@@ -329,38 +363,54 @@ static void ep93xx_gpio_irq_unmask(unsigned int irq)
329 */ 363 */
330static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type) 364static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type)
331{ 365{
332 int port; 366 struct irq_desc *desc = irq_desc + irq;
333 int line; 367 const int gpio = irq_to_gpio(irq);
334 368 const int port = gpio >> 3;
335 line = irq - IRQ_EP93XX_GPIO(0); 369 const int port_mask = 1 << (gpio & 7);
336 if (line >= 0 && line < 16) { 370
337 gpio_line_config(line, GPIO_IN); 371 ep93xx_gpio_set_direction(gpio, GPIO_IN);
338 } else { 372
339 gpio_line_config(EP93XX_GPIO_LINE_F(line-16), GPIO_IN); 373 switch (type) {
374 case IRQT_RISING:
375 gpio_int_type1[port] |= port_mask;
376 gpio_int_type2[port] |= port_mask;
377 desc->handle_irq = handle_edge_irq;
378 break;
379 case IRQT_FALLING:
380 gpio_int_type1[port] |= port_mask;
381 gpio_int_type2[port] &= ~port_mask;
382 desc->handle_irq = handle_edge_irq;
383 break;
384 case IRQT_HIGH:
385 gpio_int_type1[port] &= ~port_mask;
386 gpio_int_type2[port] |= port_mask;
387 desc->handle_irq = handle_level_irq;
388 break;
389 case IRQT_LOW:
390 gpio_int_type1[port] &= ~port_mask;
391 gpio_int_type2[port] &= ~port_mask;
392 desc->handle_irq = handle_level_irq;
393 break;
394 case IRQT_BOTHEDGE:
395 gpio_int_type1[port] |= port_mask;
396 /* set initial polarity based on current input level */
397 if (gpio_get_value(gpio))
398 gpio_int_type2[port] &= ~port_mask; /* falling */
399 else
400 gpio_int_type2[port] |= port_mask; /* rising */
401 desc->handle_irq = handle_edge_irq;
402 break;
403 default:
404 pr_err("ep93xx: failed to set irq type %d for gpio %d\n",
405 type, gpio);
406 return -EINVAL;
340 } 407 }
341 408
342 port = line >> 3; 409 gpio_int_enabled[port] |= port_mask;
343 line &= 7; 410
344 411 desc->status &= ~IRQ_TYPE_SENSE_MASK;
345 if (type & IRQT_RISING) { 412 desc->status |= type & IRQ_TYPE_SENSE_MASK;
346 gpio_int_enabled[port] |= 1 << line; 413
347 gpio_int_type1[port] |= 1 << line;
348 gpio_int_type2[port] |= 1 << line;
349 } else if (type & IRQT_FALLING) {
350 gpio_int_enabled[port] |= 1 << line;
351 gpio_int_type1[port] |= 1 << line;
352 gpio_int_type2[port] &= ~(1 << line);
353 } else if (type & IRQT_HIGH) {
354 gpio_int_enabled[port] |= 1 << line;
355 gpio_int_type1[port] &= ~(1 << line);
356 gpio_int_type2[port] |= 1 << line;
357 } else if (type & IRQT_LOW) {
358 gpio_int_enabled[port] |= 1 << line;
359 gpio_int_type1[port] &= ~(1 << line);
360 gpio_int_type2[port] &= ~(1 << line);
361 } else {
362 gpio_int_enabled[port] &= ~(1 << line);
363 }
364 update_gpio_int_params(port); 414 update_gpio_int_params(port);
365 415
366 return 0; 416 return 0;
@@ -368,7 +418,8 @@ static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type)
368 418
369static struct irq_chip ep93xx_gpio_irq_chip = { 419static struct irq_chip ep93xx_gpio_irq_chip = {
370 .name = "GPIO", 420 .name = "GPIO",
371 .ack = ep93xx_gpio_irq_mask_ack, 421 .ack = ep93xx_gpio_irq_ack,
422 .mask_ack = ep93xx_gpio_irq_mask_ack,
372 .mask = ep93xx_gpio_irq_mask, 423 .mask = ep93xx_gpio_irq_mask,
373 .unmask = ep93xx_gpio_irq_unmask, 424 .unmask = ep93xx_gpio_irq_unmask,
374 .set_type = ep93xx_gpio_irq_type, 425 .set_type = ep93xx_gpio_irq_type,
@@ -377,15 +428,16 @@ static struct irq_chip ep93xx_gpio_irq_chip = {
377 428
378void __init ep93xx_init_irq(void) 429void __init ep93xx_init_irq(void)
379{ 430{
380 int irq; 431 int gpio_irq;
381 432
382 vic_init((void *)EP93XX_VIC1_BASE, 0, EP93XX_VIC1_VALID_IRQ_MASK); 433 vic_init((void *)EP93XX_VIC1_BASE, 0, EP93XX_VIC1_VALID_IRQ_MASK);
383 vic_init((void *)EP93XX_VIC2_BASE, 32, EP93XX_VIC2_VALID_IRQ_MASK); 434 vic_init((void *)EP93XX_VIC2_BASE, 32, EP93XX_VIC2_VALID_IRQ_MASK);
384 435
385 for (irq = IRQ_EP93XX_GPIO(0); irq <= IRQ_EP93XX_GPIO(23); irq++) { 436 for (gpio_irq = gpio_to_irq(0);
386 set_irq_chip(irq, &ep93xx_gpio_irq_chip); 437 gpio_irq <= gpio_to_irq(EP93XX_GPIO_LINE_MAX_IRQ); ++gpio_irq) {
387 set_irq_handler(irq, handle_level_irq); 438 set_irq_chip(gpio_irq, &ep93xx_gpio_irq_chip);
388 set_irq_flags(irq, IRQF_VALID); 439 set_irq_handler(gpio_irq, handle_level_irq);
440 set_irq_flags(gpio_irq, IRQF_VALID);
389 } 441 }
390 442
391 set_irq_chained_handler(IRQ_EP93XX_GPIO_AB, ep93xx_gpio_ab_irq_handler); 443 set_irq_chained_handler(IRQ_EP93XX_GPIO_AB, ep93xx_gpio_ab_irq_handler);
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index 3a63941d43be..b2a21189dd81 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -30,14 +30,10 @@ static unsigned long timer1_gettimeoffset (void)
30static irqreturn_t 30static irqreturn_t
31timer1_interrupt(int irq, void *dev_id) 31timer1_interrupt(int irq, void *dev_id)
32{ 32{
33 write_seqlock(&xtime_lock);
34
35 *CSR_TIMER1_CLR = 0; 33 *CSR_TIMER1_CLR = 0;
36 34
37 timer_tick(); 35 timer_tick();
38 36
39 write_sequnlock(&xtime_lock);
40
41 return IRQ_HANDLED; 37 return IRQ_HANDLED;
42} 38}
43 39
diff --git a/arch/arm/mach-footbridge/isa-timer.c b/arch/arm/mach-footbridge/isa-timer.c
index d08d64139d00..a764e01d3573 100644
--- a/arch/arm/mach-footbridge/isa-timer.c
+++ b/arch/arm/mach-footbridge/isa-timer.c
@@ -64,9 +64,7 @@ static unsigned long isa_gettimeoffset(void)
64static irqreturn_t 64static irqreturn_t
65isa_timer_interrupt(int irq, void *dev_id) 65isa_timer_interrupt(int irq, void *dev_id)
66{ 66{
67 write_seqlock(&xtime_lock);
68 timer_tick(); 67 timer_tick();
69 write_sequnlock(&xtime_lock);
70 return IRQ_HANDLED; 68 return IRQ_HANDLED;
71} 69}
72 70
diff --git a/arch/arm/mach-h720x/cpu-h7201.c b/arch/arm/mach-h720x/cpu-h7201.c
index 9107b8e2ad6e..c2a431f482f0 100644
--- a/arch/arm/mach-h720x/cpu-h7201.c
+++ b/arch/arm/mach-h720x/cpu-h7201.c
@@ -29,13 +29,9 @@
29static irqreturn_t 29static irqreturn_t
30h7201_timer_interrupt(int irq, void *dev_id) 30h7201_timer_interrupt(int irq, void *dev_id)
31{ 31{
32 write_seqlock(&xtime_lock);
33
34 CPU_REG (TIMER_VIRT, TIMER_TOPSTAT); 32 CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
35 timer_tick(); 33 timer_tick();
36 34
37 write_sequnlock(&xtime_lock);
38
39 return IRQ_HANDLED; 35 return IRQ_HANDLED;
40} 36}
41 37
diff --git a/arch/arm/mach-h720x/cpu-h7202.c b/arch/arm/mach-h720x/cpu-h7202.c
index 0a1a25fb8ba8..c627fa124eb3 100644
--- a/arch/arm/mach-h720x/cpu-h7202.c
+++ b/arch/arm/mach-h720x/cpu-h7202.c
@@ -113,9 +113,7 @@ h7202_timerx_demux_handler(unsigned int irq_unused, struct irq_desc *desc)
113 mask = CPU_REG (TIMER_VIRT, TIMER_TOPSTAT); 113 mask = CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
114 114
115 if ( mask & TSTAT_T0INT ) { 115 if ( mask & TSTAT_T0INT ) {
116 write_seqlock(&xtime_lock);
117 timer_tick(); 116 timer_tick();
118 write_sequnlock(&xtime_lock);
119 if( mask == TSTAT_T0INT ) 117 if( mask == TSTAT_T0INT )
120 return; 118 return;
121 } 119 }
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index e9c82deb791d..7fbbc17f8e8b 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -250,8 +250,6 @@ unsigned long integrator_gettimeoffset(void)
250static irqreturn_t 250static irqreturn_t
251integrator_timer_interrupt(int irq, void *dev_id) 251integrator_timer_interrupt(int irq, void *dev_id)
252{ 252{
253 write_seqlock(&xtime_lock);
254
255 /* 253 /*
256 * clear the interrupt 254 * clear the interrupt
257 */ 255 */
@@ -259,8 +257,6 @@ integrator_timer_interrupt(int irq, void *dev_id)
259 257
260 timer_tick(); 258 timer_tick();
261 259
262 write_sequnlock(&xtime_lock);
263
264 return IRQ_HANDLED; 260 return IRQ_HANDLED;
265} 261}
266 262
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index d4d8134ce567..d55fa4e9bb43 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -440,7 +440,7 @@ v3_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
440 return 1; 440 return 1;
441} 441}
442 442
443static irqreturn_t v3_irq(int irq, void *devid) 443static irqreturn_t v3_irq(int dummy, void *devid)
444{ 444{
445#ifdef CONFIG_DEBUG_LL 445#ifdef CONFIG_DEBUG_LL
446 struct pt_regs *regs = get_irq_regs(); 446 struct pt_regs *regs = get_irq_regs();
@@ -448,8 +448,10 @@ static irqreturn_t v3_irq(int irq, void *devid)
448 unsigned long instr = *(unsigned long *)pc; 448 unsigned long instr = *(unsigned long *)pc;
449 char buf[128]; 449 char buf[128];
450 450
451 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x ISTAT=%02x\n", irq, 451 sprintf(buf, "V3 int %d: pc=0x%08lx [%08lx] LBFADDR=%08x LBFCODE=%02x "
452 pc, instr, __raw_readl(SC_LBFADDR), __raw_readl(SC_LBFCODE) & 255, 452 "ISTAT=%02x\n", IRQ_AP_V3INT, pc, instr,
453 __raw_readl(SC_LBFADDR),
454 __raw_readl(SC_LBFCODE) & 255,
453 v3_readb(V3_LB_ISTAT)); 455 v3_readb(V3_LB_ISTAT));
454 printascii(buf); 456 printascii(buf);
455#endif 457#endif
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index cb6ad211887a..81cdc8267206 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -206,8 +206,6 @@ unsigned long ixp2000_gettimeoffset (void)
206 206
207static int ixp2000_timer_interrupt(int irq, void *dev_id) 207static int ixp2000_timer_interrupt(int irq, void *dev_id)
208{ 208{
209 write_seqlock(&xtime_lock);
210
211 /* clear timer 1 */ 209 /* clear timer 1 */
212 ixp2000_reg_wrb(IXP2000_T1_CLR, 1); 210 ixp2000_reg_wrb(IXP2000_T1_CLR, 1);
213 211
@@ -217,8 +215,6 @@ static int ixp2000_timer_interrupt(int irq, void *dev_id)
217 next_jiffy_time -= ticks_per_jiffy; 215 next_jiffy_time -= ticks_per_jiffy;
218 } 216 }
219 217
220 write_sequnlock(&xtime_lock);
221
222 return IRQ_HANDLED; 218 return IRQ_HANDLED;
223} 219}
224 220
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index 16356ffc86ae..5fea5a132939 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -22,7 +22,6 @@
22#include <linux/serial.h> 22#include <linux/serial.h>
23#include <linux/tty.h> 23#include <linux/tty.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/serial.h>
26#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
27#include <linux/serial_core.h> 26#include <linux/serial_core.h>
28#include <linux/device.h> 27#include <linux/device.h>
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
index 7a85ced56718..d3a779a7a35f 100644
--- a/arch/arm/mach-ixp23xx/espresso.c
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -19,7 +19,6 @@
19#include <linux/tty.h> 19#include <linux/tty.h>
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21#include <linux/ioport.h> 21#include <linux/ioport.h>
22#include <linux/serial.h>
23#include <linux/serial_8250.h> 22#include <linux/serial_8250.h>
24#include <linux/serial_core.h> 23#include <linux/serial_core.h>
25#include <linux/device.h> 24#include <linux/device.h>
@@ -40,7 +39,6 @@
40#include <asm/mach/map.h> 39#include <asm/mach/map.h>
41#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
42#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
43#include <asm/mach/irq.h>
44#include <asm/mach/pci.h> 42#include <asm/mach/pci.h>
45 43
46static int __init espresso_pci_init(void) 44static int __init espresso_pci_init(void)
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index c41a6b5a0acc..5c5d4d66dee8 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -24,7 +24,6 @@
24#include <linux/tty.h> 24#include <linux/tty.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/ioport.h> 26#include <linux/ioport.h>
27#include <linux/serial.h>
28#include <linux/serial_8250.h> 27#include <linux/serial_8250.h>
29#include <linux/serial_core.h> 28#include <linux/serial_core.h>
30#include <linux/device.h> 29#include <linux/device.h>
@@ -44,7 +43,6 @@
44#include <asm/mach/map.h> 43#include <asm/mach/map.h>
45#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
46#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
47#include <asm/mach/irq.h>
48#include <asm/mach/pci.h> 46#include <asm/mach/pci.h>
49 47
50/* 48/*
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
index e35644961aa4..f0f70ba1e46d 100644
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -23,7 +23,6 @@
23#include <linux/tty.h> 23#include <linux/tty.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <linux/ioport.h> 25#include <linux/ioport.h>
26#include <linux/serial.h>
27#include <linux/serial_8250.h> 26#include <linux/serial_8250.h>
28#include <linux/serial_core.h> 27#include <linux/serial_core.h>
29#include <linux/device.h> 28#include <linux/device.h>
@@ -44,7 +43,6 @@
44#include <asm/mach/map.h> 43#include <asm/mach/map.h>
45#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
46#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
47#include <asm/mach/irq.h>
48#include <asm/mach/pci.h> 46#include <asm/mach/pci.h>
49 47
50/* 48/*
diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c
index d59b8dc7dc7a..e38f45fa58ae 100644
--- a/arch/arm/mach-ixp4xx/avila-setup.c
+++ b/arch/arm/mach-ixp4xx/avila-setup.c
@@ -18,6 +18,7 @@
18#include <linux/tty.h> 18#include <linux/tty.h>
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/i2c-gpio.h>
21 22
22#include <asm/types.h> 23#include <asm/types.h>
23#include <asm/setup.h> 24#include <asm/setup.h>
@@ -47,18 +48,17 @@ static struct platform_device avila_flash = {
47 .resource = &avila_flash_resource, 48 .resource = &avila_flash_resource,
48}; 49};
49 50
50static struct ixp4xx_i2c_pins avila_i2c_gpio_pins = { 51static struct i2c_gpio_platform_data avila_i2c_gpio_data = {
51 .sda_pin = AVILA_SDA_PIN, 52 .sda_pin = AVILA_SDA_PIN,
52 .scl_pin = AVILA_SCL_PIN, 53 .scl_pin = AVILA_SCL_PIN,
53}; 54};
54 55
55static struct platform_device avila_i2c_controller = { 56static struct platform_device avila_i2c_gpio = {
56 .name = "IXP4XX-I2C", 57 .name = "i2c-gpio",
57 .id = 0, 58 .id = 0,
58 .dev = { 59 .dev = {
59 .platform_data = &avila_i2c_gpio_pins, 60 .platform_data = &avila_i2c_gpio_data,
60 }, 61 },
61 .num_resources = 0
62}; 62};
63 63
64static struct resource avila_uart_resources[] = { 64static struct resource avila_uart_resources[] = {
@@ -133,7 +133,7 @@ static struct platform_device avila_pata = {
133}; 133};
134 134
135static struct platform_device *avila_devices[] __initdata = { 135static struct platform_device *avila_devices[] __initdata = {
136 &avila_i2c_controller, 136 &avila_i2c_gpio,
137 &avila_flash, 137 &avila_flash,
138 &avila_uart 138 &avila_uart
139}; 139};
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 1e75e105c4f7..c473d408aa7c 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -14,6 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/serial.h> 15#include <linux/serial.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/i2c-gpio.h>
17 18
18#include <asm/mach-types.h> 19#include <asm/mach-types.h>
19#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
@@ -37,15 +38,17 @@ static struct platform_device dsmg600_flash = {
37 .resource = &dsmg600_flash_resource, 38 .resource = &dsmg600_flash_resource,
38}; 39};
39 40
40static struct ixp4xx_i2c_pins dsmg600_i2c_gpio_pins = { 41static struct i2c_gpio_platform_data dsmg600_i2c_gpio_data = {
41 .sda_pin = DSMG600_SDA_PIN, 42 .sda_pin = DSMG600_SDA_PIN,
42 .scl_pin = DSMG600_SCL_PIN, 43 .scl_pin = DSMG600_SCL_PIN,
43}; 44};
44 45
45static struct platform_device dsmg600_i2c_controller = { 46static struct platform_device dsmg600_i2c_gpio = {
46 .name = "IXP4XX-I2C", 47 .name = "i2c-gpio",
47 .id = 0, 48 .id = 0,
48 .dev.platform_data = &dsmg600_i2c_gpio_pins, 49 .dev = {
50 .platform_data = &dsmg600_i2c_gpio_data,
51 },
49}; 52};
50 53
51#ifdef CONFIG_LEDS_CLASS 54#ifdef CONFIG_LEDS_CLASS
@@ -116,7 +119,7 @@ static struct platform_device dsmg600_uart = {
116}; 119};
117 120
118static struct platform_device *dsmg600_devices[] __initdata = { 121static struct platform_device *dsmg600_devices[] __initdata = {
119 &dsmg600_i2c_controller, 122 &dsmg600_i2c_gpio,
120 &dsmg600_flash, 123 &dsmg600_flash,
121}; 124};
122 125
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index d5008d8fc9a5..e89070da28bf 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -15,6 +15,7 @@
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/i2c-gpio.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
20#include <linux/mtd/nand.h> 21#include <linux/mtd/nand.h>
@@ -120,18 +121,17 @@ static struct platform_device ixdp425_flash_nand = {
120}; 121};
121#endif /* CONFIG_MTD_NAND_PLATFORM */ 122#endif /* CONFIG_MTD_NAND_PLATFORM */
122 123
123static struct ixp4xx_i2c_pins ixdp425_i2c_gpio_pins = { 124static struct i2c_gpio_platform_data ixdp425_i2c_gpio_data = {
124 .sda_pin = IXDP425_SDA_PIN, 125 .sda_pin = IXDP425_SDA_PIN,
125 .scl_pin = IXDP425_SCL_PIN, 126 .scl_pin = IXDP425_SCL_PIN,
126}; 127};
127 128
128static struct platform_device ixdp425_i2c_controller = { 129static struct platform_device ixdp425_i2c_gpio = {
129 .name = "IXP4XX-I2C", 130 .name = "i2c-gpio",
130 .id = 0, 131 .id = 0,
131 .dev = { 132 .dev = {
132 .platform_data = &ixdp425_i2c_gpio_pins, 133 .platform_data = &ixdp425_i2c_gpio_data,
133 }, 134 },
134 .num_resources = 0
135}; 135};
136 136
137static struct resource ixdp425_uart_resources[] = { 137static struct resource ixdp425_uart_resources[] = {
@@ -178,7 +178,7 @@ static struct platform_device ixdp425_uart = {
178}; 178};
179 179
180static struct platform_device *ixdp425_devices[] __initdata = { 180static struct platform_device *ixdp425_devices[] __initdata = {
181 &ixdp425_i2c_controller, 181 &ixdp425_i2c_gpio,
182 &ixdp425_flash, 182 &ixdp425_flash,
183#if defined(CONFIG_MTD_NAND_PLATFORM) || \ 183#if defined(CONFIG_MTD_NAND_PLATFORM) || \
184 defined(CONFIG_MTD_NAND_PLATFORM_MODULE) 184 defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 78a17413ceca..54d884fb2517 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -16,6 +16,7 @@
16#include <linux/serial.h> 16#include <linux/serial.h>
17#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/leds.h> 18#include <linux/leds.h>
19#include <linux/i2c-gpio.h>
19 20
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
@@ -68,16 +69,17 @@ static struct platform_device nas100d_leds = {
68}; 69};
69#endif 70#endif
70 71
71static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = { 72static struct i2c_gpio_platform_data nas100d_i2c_gpio_data = {
72 .sda_pin = NAS100D_SDA_PIN, 73 .sda_pin = NAS100D_SDA_PIN,
73 .scl_pin = NAS100D_SCL_PIN, 74 .scl_pin = NAS100D_SCL_PIN,
74}; 75};
75 76
76static struct platform_device nas100d_i2c_controller = { 77static struct platform_device nas100d_i2c_gpio = {
77 .name = "IXP4XX-I2C", 78 .name = "i2c-gpio",
78 .id = 0, 79 .id = 0,
79 .dev.platform_data = &nas100d_i2c_gpio_pins, 80 .dev = {
80 .num_resources = 0, 81 .platform_data = &nas100d_i2c_gpio_data,
82 },
81}; 83};
82 84
83static struct resource nas100d_uart_resources[] = { 85static struct resource nas100d_uart_resources[] = {
@@ -124,7 +126,7 @@ static struct platform_device nas100d_uart = {
124}; 126};
125 127
126static struct platform_device *nas100d_devices[] __initdata = { 128static struct platform_device *nas100d_devices[] __initdata = {
127 &nas100d_i2c_controller, 129 &nas100d_i2c_gpio,
128 &nas100d_flash, 130 &nas100d_flash,
129#ifdef CONFIG_LEDS_IXP4XX 131#ifdef CONFIG_LEDS_IXP4XX
130 &nas100d_leds, 132 &nas100d_leds,
diff --git a/arch/arm/mach-ixp4xx/nslu2-power.c b/arch/arm/mach-ixp4xx/nslu2-power.c
index acd71e9c38a7..6f10dc208320 100644
--- a/arch/arm/mach-ixp4xx/nslu2-power.c
+++ b/arch/arm/mach-ixp4xx/nslu2-power.c
@@ -21,7 +21,6 @@
21#include <linux/reboot.h> 21#include <linux/reboot.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/reboot.h>
25 24
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
27 26
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 9bf8ccbcaccf..77277d27fcc5 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -18,6 +18,7 @@
18#include <linux/serial.h> 18#include <linux/serial.h>
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/i2c-gpio.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
@@ -41,7 +42,7 @@ static struct platform_device nslu2_flash = {
41 .resource = &nslu2_flash_resource, 42 .resource = &nslu2_flash_resource,
42}; 43};
43 44
44static struct ixp4xx_i2c_pins nslu2_i2c_gpio_pins = { 45static struct i2c_gpio_platform_data nslu2_i2c_gpio_data = {
45 .sda_pin = NSLU2_SDA_PIN, 46 .sda_pin = NSLU2_SDA_PIN,
46 .scl_pin = NSLU2_SCL_PIN, 47 .scl_pin = NSLU2_SCL_PIN,
47}; 48};
@@ -82,11 +83,12 @@ static struct platform_device nslu2_leds = {
82}; 83};
83#endif 84#endif
84 85
85static struct platform_device nslu2_i2c_controller = { 86static struct platform_device nslu2_i2c_gpio = {
86 .name = "IXP4XX-I2C", 87 .name = "i2c-gpio",
87 .id = 0, 88 .id = 0,
88 .dev.platform_data = &nslu2_i2c_gpio_pins, 89 .dev = {
89 .num_resources = 0, 90 .platform_data = &nslu2_i2c_gpio_data,
91 },
90}; 92};
91 93
92static struct platform_device nslu2_beeper = { 94static struct platform_device nslu2_beeper = {
@@ -139,7 +141,7 @@ static struct platform_device nslu2_uart = {
139}; 141};
140 142
141static struct platform_device *nslu2_devices[] __initdata = { 143static struct platform_device *nslu2_devices[] __initdata = {
142 &nslu2_i2c_controller, 144 &nslu2_i2c_gpio,
143 &nslu2_flash, 145 &nslu2_flash,
144 &nslu2_beeper, 146 &nslu2_beeper,
145#ifdef CONFIG_LEDS_IXP4XX 147#ifdef CONFIG_LEDS_IXP4XX
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index 2a07a281fa8a..730a3af12c98 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -9,7 +9,7 @@ obj-n :=
9obj- := 9obj- :=
10 10
11# PCI support is optional 11# PCI support is optional
12#obj-$(CONFIG_PCI) += pci.o 12obj-$(CONFIG_PCI) += pci.o
13 13
14# Board-specific support 14# Board-specific support
15obj-$(CONFIG_MACH_KS8695) += board-micrel.o 15obj-$(CONFIG_MACH_KS8695) += board-micrel.o
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index 2feeef81d843..05ac2bd04020 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -40,7 +40,7 @@ static void __init micrel_init(void)
40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n"); 40 printk(KERN_INFO "Micrel KS8695 Development Board initializing\n");
41 41
42#ifdef CONFIG_PCI 42#ifdef CONFIG_PCI
43// ks8695_init_pci(&micrel_pci); 43 ks8695_init_pci(&micrel_pci);
44#endif 44#endif
45 45
46 /* Add devices */ 46 /* Add devices */
diff --git a/arch/arm/mach-ks8695/gpio.c b/arch/arm/mach-ks8695/gpio.c
index b1aa3cb3d4a3..5e46191c0af9 100644
--- a/arch/arm/mach-ks8695/gpio.c
+++ b/arch/arm/mach-ks8695/gpio.c
@@ -20,6 +20,8 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/debugfs.h>
24#include <linux/seq_file.h>
23#include <linux/module.h> 25#include <linux/module.h>
24 26
25#include <asm/io.h> 27#include <asm/io.h>
@@ -216,3 +218,84 @@ int irq_to_gpio(unsigned int irq)
216 return (irq - KS8695_IRQ_EXTERN0); 218 return (irq - KS8695_IRQ_EXTERN0);
217} 219}
218EXPORT_SYMBOL(irq_to_gpio); 220EXPORT_SYMBOL(irq_to_gpio);
221
222
223/* .... Debug interface ..................................................... */
224
225#ifdef CONFIG_DEBUG_FS
226
227static int ks8695_gpio_show(struct seq_file *s, void *unused)
228{
229 unsigned int enable[] = { IOPC_IOEINT0EN, IOPC_IOEINT1EN, IOPC_IOEINT2EN, IOPC_IOEINT3EN, IOPC_IOTIM0EN, IOPC_IOTIM1EN };
230 unsigned int intmask[] = { IOPC_IOEINT0TM, IOPC_IOEINT1TM, IOPC_IOEINT2TM, IOPC_IOEINT3TM };
231 unsigned long mode, ctrl, data;
232 int i;
233
234 mode = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
235 ctrl = __raw_readl(KS8695_GPIO_VA + KS8695_IOPC);
236 data = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
237
238 seq_printf(s, "Pin\tI/O\tFunction\tState\n\n");
239
240 for (i = KS8695_GPIO_0; i <= KS8695_GPIO_15 ; i++) {
241 seq_printf(s, "%i:\t", i);
242
243 seq_printf(s, "%s\t", (mode & IOPM_(i)) ? "Output" : "Input");
244
245 if (i <= KS8695_GPIO_3) {
246 if (ctrl & enable[i]) {
247 seq_printf(s, "EXT%i ", i);
248
249 switch ((ctrl & intmask[i]) >> (4 * i)) {
250 case IOPC_TM_LOW:
251 seq_printf(s, "(Low)"); break;
252 case IOPC_TM_HIGH:
253 seq_printf(s, "(High)"); break;
254 case IOPC_TM_RISING:
255 seq_printf(s, "(Rising)"); break;
256 case IOPC_TM_FALLING:
257 seq_printf(s, "(Falling)"); break;
258 case IOPC_TM_EDGE:
259 seq_printf(s, "(Edges)"); break;
260 }
261 }
262 else
263 seq_printf(s, "GPIO\t");
264 }
265 else if (i <= KS8695_GPIO_5) {
266 if (ctrl & enable[i])
267 seq_printf(s, "TOUT%i\t", i - KS8695_GPIO_4);
268 else
269 seq_printf(s, "GPIO\t");
270 }
271 else
272 seq_printf(s, "GPIO\t");
273
274 seq_printf(s, "\t");
275
276 seq_printf(s, "%i\n", (data & IOPD_(i)) ? 1 : 0);
277 }
278 return 0;
279}
280
281static int ks8695_gpio_open(struct inode *inode, struct file *file)
282{
283 return single_open(file, ks8695_gpio_show, NULL);
284}
285
286static const struct file_operations ks8695_gpio_operations = {
287 .open = ks8695_gpio_open,
288 .read = seq_read,
289 .llseek = seq_lseek,
290 .release = single_release,
291};
292
293static int __init ks8695_gpio_debugfs_init(void)
294{
295 /* /sys/kernel/debug/ks8695_gpio */
296 (void) debugfs_create_file("ks8695_gpio", S_IFREG | S_IRUGO, NULL, NULL, &ks8695_gpio_operations);
297 return 0;
298}
299postcore_initcall(ks8695_gpio_debugfs_init);
300
301#endif
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c
new file mode 100644
index 000000000000..3f4e0330cb1a
--- /dev/null
+++ b/arch/arm/mach-ks8695/pci.c
@@ -0,0 +1,326 @@
1/*
2 * arch/arm/mach-ks8695/pci.c
3 *
4 * Copyright (C) 2003, Micrel Semiconductors
5 * Copyright (C) 2006, Greg Ungerer <gerg@snapgear.com>
6 * Copyright (C) 2006, Ben Dooks
7 * Copyright (C) 2007, Andrew Victor
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/kernel.h>
25#include <linux/pci.h>
26#include <linux/mm.h>
27#include <linux/init.h>
28#include <linux/irq.h>
29#include <linux/delay.h>
30
31#include <asm/io.h>
32#include <asm/signal.h>
33#include <asm/mach/pci.h>
34#include <asm/hardware.h>
35
36#include <asm/arch/devices.h>
37#include <asm/arch/regs-pci.h>
38
39
40static int pci_dbg;
41static int pci_cfg_dbg;
42
43
44static void ks8695_pci_setupconfig(unsigned int bus_nr, unsigned int devfn, unsigned int where)
45{
46 unsigned long pbca;
47
48 pbca = PBCA_ENABLE | (where & ~3);
49 pbca |= PCI_SLOT(devfn) << 11 ;
50 pbca |= PCI_FUNC(devfn) << 8;
51 pbca |= bus_nr << 16;
52
53 if (bus_nr == 0) {
54 /* use Type-0 transaction */
55 __raw_writel(pbca, KS8695_PCI_VA + KS8695_PBCA);
56 } else {
57 /* use Type-1 transaction */
58 __raw_writel(pbca | PBCA_TYPE1, KS8695_PCI_VA + KS8695_PBCA);
59 }
60}
61
62
63/*
64 * The KS8695 datasheet prohibits anything other than 32bit accesses
65 * to the IO registers, so all our configuration must be done with
66 * 32bit operations, and the correct bit masking and shifting.
67 */
68
69static int ks8695_pci_readconfig(struct pci_bus *bus,
70 unsigned int devfn, int where, int size, u32 *value)
71{
72 ks8695_pci_setupconfig(bus->number, devfn, where);
73
74 *value = __raw_readl(KS8695_PCI_VA + KS8695_PBCD);
75
76 switch (size) {
77 case 4:
78 break;
79 case 2:
80 *value = *value >> ((where & 2) * 8);
81 *value &= 0xffff;
82 break;
83 case 1:
84 *value = *value >> ((where & 3) * 8);
85 *value &= 0xff;
86 break;
87 }
88
89 if (pci_cfg_dbg) {
90 printk("read: %d,%08x,%02x,%d: %08x (%08x)\n",
91 bus->number, devfn, where, size, *value,
92 __raw_readl(KS8695_PCI_VA + KS8695_PBCD));
93 }
94
95 return PCIBIOS_SUCCESSFUL;
96}
97
98static int ks8695_pci_writeconfig(struct pci_bus *bus,
99 unsigned int devfn, int where, int size, u32 value)
100{
101 unsigned long tmp;
102
103 if (pci_cfg_dbg) {
104 printk("write: %d,%08x,%02x,%d: %08x\n",
105 bus->number, devfn, where, size, value);
106 }
107
108 ks8695_pci_setupconfig(bus->number, devfn, where);
109
110 switch (size) {
111 case 4:
112 __raw_writel(value, KS8695_PCI_VA + KS8695_PBCD);
113 break;
114 case 2:
115 tmp = __raw_readl(KS8695_PCI_VA + KS8695_PBCD);
116 tmp &= ~(0xffff << ((where & 2) * 8));
117 tmp |= value << ((where & 2) * 8);
118
119 __raw_writel(tmp, KS8695_PCI_VA + KS8695_PBCD);
120 break;
121 case 1:
122 tmp = __raw_readl(KS8695_PCI_VA + KS8695_PBCD);
123 tmp &= ~(0xff << ((where & 3) * 8));
124 tmp |= value << ((where & 3) * 8);
125
126 __raw_writel(tmp, KS8695_PCI_VA + KS8695_PBCD);
127 break;
128 }
129
130 return PCIBIOS_SUCCESSFUL;
131}
132
133static void ks8695_local_writeconfig(int where, u32 value)
134{
135 ks8695_pci_setupconfig(0, 0, where);
136 __raw_writel(value, KS8695_PCI_VA + KS8695_PBCD);
137}
138
139static struct pci_ops ks8695_pci_ops = {
140 .read = ks8695_pci_readconfig,
141 .write = ks8695_pci_writeconfig,
142};
143
144static struct pci_bus *ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
145{
146 return pci_scan_bus(sys->busnr, &ks8695_pci_ops, sys);
147}
148
149static struct resource pci_mem = {
150 .name = "PCI Memory space",
151 .start = KS8695_PCIMEM_PA,
152 .end = KS8695_PCIMEM_PA + (KS8695_PCIMEM_SIZE - 1),
153 .flags = IORESOURCE_MEM,
154};
155
156static struct resource pci_io = {
157 .name = "PCI IO space",
158 .start = KS8695_PCIIO_PA,
159 .end = KS8695_PCIIO_PA + (KS8695_PCIIO_SIZE - 1),
160 .flags = IORESOURCE_IO,
161};
162
163static int __init ks8695_pci_setup(int nr, struct pci_sys_data *sys)
164{
165 if (nr > 0)
166 return 0;
167
168 request_resource(&iomem_resource, &pci_mem);
169 request_resource(&ioport_resource, &pci_io);
170
171 sys->resource[0] = &pci_io;
172 sys->resource[1] = &pci_mem;
173 sys->resource[2] = NULL;
174
175 /* Assign and enable processor bridge */
176 ks8695_local_writeconfig(PCI_BASE_ADDRESS_0, KS8695_PCIMEM_PA);
177
178 /* Enable bus-master & Memory Space access */
179 ks8695_local_writeconfig(PCI_COMMAND, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
180
181 /* Set cache-line size & latency. */
182 ks8695_local_writeconfig(PCI_CACHE_LINE_SIZE, (32 << 8) | (L1_CACHE_BYTES / sizeof(u32)));
183
184 /* Reserve PCI memory space for PCI-AHB resources */
185 if (!request_mem_region(KS8695_PCIMEM_PA, SZ_64M, "PCI-AHB Bridge")) {
186 printk(KERN_ERR "Cannot allocate PCI-AHB Bridge memory.\n");
187 return -EBUSY;
188 }
189
190 return 1;
191}
192
193static inline unsigned int size_mask(unsigned long size)
194{
195 return (~size) + 1;
196}
197
198static int ks8695_pci_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
199{
200 unsigned long pc = instruction_pointer(regs);
201 unsigned long instr = *(unsigned long *)pc;
202 unsigned long cmdstat;
203
204 cmdstat = __raw_readl(KS8695_PCI_VA + KS8695_CRCFCS);
205
206 printk(KERN_ERR "PCI abort: address = 0x%08lx fsr = 0x%03x PC = 0x%08lx LR = 0x%08lx [%s%s%s%s%s]\n",
207 addr, fsr, regs->ARM_pc, regs->ARM_lr,
208 cmdstat & (PCI_STATUS_SIG_TARGET_ABORT << 16) ? "GenTarget" : " ",
209 cmdstat & (PCI_STATUS_REC_TARGET_ABORT << 16) ? "RecvTarget" : " ",
210 cmdstat & (PCI_STATUS_REC_MASTER_ABORT << 16) ? "MasterAbort" : " ",
211 cmdstat & (PCI_STATUS_SIG_SYSTEM_ERROR << 16) ? "SysError" : " ",
212 cmdstat & (PCI_STATUS_DETECTED_PARITY << 16) ? "Parity" : " "
213 );
214
215 __raw_writel(cmdstat, KS8695_PCI_VA + KS8695_CRCFCS);
216
217 /*
218 * If the instruction being executed was a read,
219 * make it look like it read all-ones.
220 */
221 if ((instr & 0x0c100000) == 0x04100000) {
222 int reg = (instr >> 12) & 15;
223 unsigned long val;
224
225 if (instr & 0x00400000)
226 val = 255;
227 else
228 val = -1;
229
230 regs->uregs[reg] = val;
231 regs->ARM_pc += 4;
232 return 0;
233 }
234
235 if ((instr & 0x0e100090) == 0x00100090) {
236 int reg = (instr >> 12) & 15;
237
238 regs->uregs[reg] = -1;
239 regs->ARM_pc += 4;
240 return 0;
241 }
242
243 return 1;
244}
245
246static void __init ks8695_pci_preinit(void)
247{
248 /* stage 1 initialization, subid, subdevice = 0x0001 */
249 __raw_writel(0x00010001, KS8695_PCI_VA + KS8695_CRCSID);
250
251 /* stage 2 initialization */
252 /* prefetch limits with 16 words, retry enable */
253 __raw_writel(0x40000000, KS8695_PCI_VA + KS8695_PBCS);
254
255 /* configure memory mapping */
256 __raw_writel(KS8695_PCIMEM_PA, KS8695_PCI_VA + KS8695_PMBA);
257 __raw_writel(size_mask(KS8695_PCIMEM_SIZE), KS8695_PCI_VA + KS8695_PMBAM);
258 __raw_writel(KS8695_PCIMEM_PA, KS8695_PCI_VA + KS8695_PMBAT);
259 __raw_writel(0, KS8695_PCI_VA + KS8695_PMBAC);
260
261 /* configure IO mapping */
262 __raw_writel(KS8695_PCIIO_PA, KS8695_PCI_VA + KS8695_PIOBA);
263 __raw_writel(size_mask(KS8695_PCIIO_SIZE), KS8695_PCI_VA + KS8695_PIOBAM);
264 __raw_writel(KS8695_PCIIO_PA, KS8695_PCI_VA + KS8695_PIOBAT);
265 __raw_writel(0, KS8695_PCI_VA + KS8695_PIOBAC);
266
267 /* hook in fault handlers */
268 hook_fault_code(8, ks8695_pci_fault, SIGBUS, "external abort on non-linefetch");
269 hook_fault_code(10, ks8695_pci_fault, SIGBUS, "external abort on non-linefetch");
270}
271
272static void ks8695_show_pciregs(void)
273{
274 if (!pci_dbg)
275 return;
276
277 printk(KERN_INFO "PCI: CRCFID = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCFID));
278 printk(KERN_INFO "PCI: CRCFCS = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCFCS));
279 printk(KERN_INFO "PCI: CRCFRV = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCFRV));
280 printk(KERN_INFO "PCI: CRCFLT = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCFLT));
281 printk(KERN_INFO "PCI: CRCBMA = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCBMA));
282 printk(KERN_INFO "PCI: CRCSID = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCSID));
283 printk(KERN_INFO "PCI: CRCFIT = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_CRCFIT));
284
285 printk(KERN_INFO "PCI: PBM = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PBM));
286 printk(KERN_INFO "PCI: PBCS = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PBCS));
287
288 printk(KERN_INFO "PCI: PMBA = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PMBA));
289 printk(KERN_INFO "PCI: PMBAC = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PMBAC));
290 printk(KERN_INFO "PCI: PMBAM = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PMBAM));
291 printk(KERN_INFO "PCI: PMBAT = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PMBAT));
292
293 printk(KERN_INFO "PCI: PIOBA = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PIOBA));
294 printk(KERN_INFO "PCI: PIOBAC = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PIOBAC));
295 printk(KERN_INFO "PCI: PIOBAM = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PIOBAM));
296 printk(KERN_INFO "PCI: PIOBAT = %08x\n", __raw_readl(KS8695_PCI_VA + KS8695_PIOBAT));
297}
298
299
300static struct hw_pci ks8695_pci __initdata = {
301 .nr_controllers = 1,
302 .preinit = ks8695_pci_preinit,
303 .setup = ks8695_pci_setup,
304 .scan = ks8695_pci_scan_bus,
305 .postinit = NULL,
306 .swizzle = pci_std_swizzle,
307 .map_irq = NULL,
308};
309
310void __init ks8695_init_pci(struct ks8695_pci_cfg *cfg)
311{
312 if (__raw_readl(KS8695_PCI_VA + KS8695_CRCFRV) & CFRV_GUEST) {
313 printk("PCI: KS8695 in guest mode, not initialising\n");
314 return;
315 }
316
317 printk(KERN_INFO "PCI: Initialising\n");
318 ks8695_show_pciregs();
319
320 /* set Mode */
321 __raw_writel(cfg->mode << 29, KS8695_PCI_VA + KS8695_PBM);
322
323 ks8695_pci.map_irq = cfg->map_irq; /* board-specific map_irq method */
324
325 pci_common_init(&ks8695_pci);
326}
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index d2c86e4a72eb..02f766b3121d 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -70,10 +70,7 @@ static unsigned long ks8695_gettimeoffset (void)
70 */ 70 */
71static irqreturn_t ks8695_timer_interrupt(int irq, void *dev_id) 71static irqreturn_t ks8695_timer_interrupt(int irq, void *dev_id)
72{ 72{
73 write_seqlock(&xtime_lock);
74 timer_tick(); 73 timer_tick();
75 write_sequnlock(&xtime_lock);
76
77 return IRQ_HANDLED; 74 return IRQ_HANDLED;
78} 75}
79 76
diff --git a/arch/arm/mach-lh7a40x/time.c b/arch/arm/mach-lh7a40x/time.c
index c25316d02537..e50e60b33851 100644
--- a/arch/arm/mach-lh7a40x/time.c
+++ b/arch/arm/mach-lh7a40x/time.c
@@ -41,13 +41,9 @@
41static irqreturn_t 41static irqreturn_t
42lh7a40x_timer_interrupt(int irq, void *dev_id) 42lh7a40x_timer_interrupt(int irq, void *dev_id)
43{ 43{
44 write_seqlock(&xtime_lock);
45
46 TIMER_EOI = 0; 44 TIMER_EOI = 0;
47 timer_tick(); 45 timer_tick();
48 46
49 write_sequnlock(&xtime_lock);
50
51 return IRQ_HANDLED; 47 return IRQ_HANDLED;
52} 48}
53 49
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
new file mode 100644
index 000000000000..3553babbbf05
--- /dev/null
+++ b/arch/arm/mach-msm/Kconfig
@@ -0,0 +1,18 @@
1if ARCH_MSM7X00A
2
3comment "MSM7X00A Board Type"
4 depends on ARCH_MSM7X00A
5
6config MACH_HALIBUT
7 depends on ARCH_MSM7X00A
8 default y
9 bool "Halibut Board (QCT SURF7200A)"
10 help
11 Support for the Qualcomm SURF7200A eval board.
12
13config MSM7X00A_IDLE
14 depends on ARCH_MSM7X00A
15 default y
16 bool "Idle Support for MSM7X00A"
17
18endif
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
new file mode 100644
index 000000000000..d12f23655850
--- /dev/null
+++ b/arch/arm/mach-msm/Makefile
@@ -0,0 +1,7 @@
1obj-y += io.o idle.o irq.o timer.o dma.o
2
3# Common code for board init
4obj-y += common.o
5
6obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o
7
diff --git a/arch/arm/mach-msm/Makefile.boot b/arch/arm/mach-msm/Makefile.boot
new file mode 100644
index 000000000000..24dfbf8c07c4
--- /dev/null
+++ b/arch/arm/mach-msm/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x10008000
2params_phys-y := 0x10000100
3initrd_phys-y := 0x10800000
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
new file mode 100644
index 000000000000..86dfb2b5261c
--- /dev/null
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -0,0 +1,114 @@
1/* linux/arch/arm/mach-msm/board-halibut.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/platform_device.h>
20#include <linux/input.h>
21
22#include <asm/hardware.h>
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <asm/mach/map.h>
26#include <asm/mach/flash.h>
27
28#include <asm/arch/board.h>
29#include <asm/arch/msm_iomap.h>
30
31#include <asm/io.h>
32#include <asm/delay.h>
33
34#include <linux/mtd/nand.h>
35#include <linux/mtd/partitions.h>
36
37static struct resource smc91x_resources[] = {
38 [0] = {
39 .start = 0x9C004300,
40 .end = 0x9C004400,
41 .flags = IORESOURCE_MEM,
42 },
43 [1] = {
44 .start = MSM_GPIO_TO_INT(49),
45 .end = MSM_GPIO_TO_INT(49),
46 .flags = IORESOURCE_IRQ,
47 },
48};
49
50static struct platform_device smc91x_device = {
51 .name = "smc91x",
52 .id = 0,
53 .num_resources = ARRAY_SIZE(smc91x_resources),
54 .resource = smc91x_resources,
55};
56
57static void mddi0_panel_power(int on)
58{
59}
60
61static struct msm_mddi_platform_data msm_mddi0_pdata = {
62 .panel_power = mddi0_panel_power,
63 .has_vsync_irq = 0,
64};
65
66static struct platform_device msm_mddi0_device = {
67 .name = "msm_mddi",
68 .id = 0,
69 .dev = {
70 .platform_data = &msm_mddi0_pdata
71 },
72};
73
74static struct platform_device msm_serial0_device = {
75 .name = "msm_serial",
76 .id = 0,
77};
78
79static struct platform_device *devices[] __initdata = {
80 &msm_serial0_device,
81 &msm_mddi0_device,
82 &smc91x_device,
83};
84
85extern struct sys_timer msm_timer;
86
87static void __init halibut_init_irq(void)
88{
89 msm_init_irq();
90}
91
92static void __init halibut_init(void)
93{
94 platform_add_devices(devices, ARRAY_SIZE(devices));
95 msm_add_devices();
96}
97
98static void __init halibut_map_io(void)
99{
100 msm_map_common_io();
101}
102
103MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
104
105/* UART for LL DEBUG */
106 .phys_io = MSM_UART1_PHYS,
107 .io_pg_offst = ((MSM_UART1_BASE) >> 18) & 0xfffc,
108
109 .boot_params = 0x10000100,
110 .map_io = halibut_map_io,
111 .init_irq = halibut_init_irq,
112 .init_machine = halibut_init,
113 .timer = &msm_timer,
114MACHINE_END
diff --git a/arch/arm/mach-msm/common.c b/arch/arm/mach-msm/common.c
new file mode 100644
index 000000000000..3f5d3362f887
--- /dev/null
+++ b/arch/arm/mach-msm/common.c
@@ -0,0 +1,116 @@
1/* linux/arch/arm/mach-msm/common.c
2 *
3 * Common setup code for MSM7K Boards
4 *
5 * Copyright (C) 2007 Google, Inc.
6 * Author: Brian Swetland <swetland@google.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/platform_device.h>
22
23#include <asm/mach/flash.h>
24#include <asm/io.h>
25
26#include <asm/setup.h>
27
28#include <linux/mtd/nand.h>
29#include <linux/mtd/partitions.h>
30
31#include <asm/arch/msm_iomap.h>
32
33#include <asm/arch/board.h>
34
35struct flash_platform_data msm_nand_data = {
36 .parts = 0,
37 .nr_parts = 0,
38};
39
40static struct resource msm_nand_resources[] = {
41 [0] = {
42 .start = 7,
43 .end = 7,
44 .flags = IORESOURCE_DMA,
45 },
46};
47
48static struct platform_device msm_nand_device = {
49 .name = "msm_nand",
50 .id = -1,
51 .num_resources = ARRAY_SIZE(msm_nand_resources),
52 .resource = msm_nand_resources,
53 .dev = {
54 .platform_data = &msm_nand_data,
55 },
56};
57
58static struct platform_device msm_smd_device = {
59 .name = "msm_smd",
60 .id = -1,
61};
62
63static struct resource msm_i2c_resources[] = {
64 {
65 .start = MSM_I2C_BASE,
66 .end = MSM_I2C_BASE + MSM_I2C_SIZE - 1,
67 .flags = IORESOURCE_MEM,
68 },
69 {
70 .start = INT_PWB_I2C,
71 .end = INT_PWB_I2C,
72 .flags = IORESOURCE_IRQ,
73 },
74};
75
76static struct platform_device msm_i2c_device = {
77 .name = "msm_i2c",
78 .id = 0,
79 .num_resources = ARRAY_SIZE(msm_i2c_resources),
80 .resource = msm_i2c_resources,
81};
82
83static struct resource usb_resources[] = {
84 {
85 .start = MSM_HSUSB_PHYS,
86 .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE,
87 .flags = IORESOURCE_MEM,
88 },
89 {
90 .start = INT_USB_HS,
91 .end = INT_USB_HS,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96static struct platform_device msm_hsusb_device = {
97 .name = "msm_hsusb",
98 .id = -1,
99 .num_resources = ARRAY_SIZE(usb_resources),
100 .resource = usb_resources,
101 .dev = {
102 .coherent_dma_mask = 0xffffffff,
103 },
104};
105
106static struct platform_device *devices[] __initdata = {
107 &msm_nand_device,
108 &msm_smd_device,
109 &msm_i2c_device,
110 &msm_hsusb_device,
111};
112
113void __init msm_add_devices(void)
114{
115 platform_add_devices(devices, ARRAY_SIZE(devices));
116}
diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c
new file mode 100644
index 000000000000..8b0f339b3274
--- /dev/null
+++ b/arch/arm/mach-msm/dma.c
@@ -0,0 +1,214 @@
1/* linux/arch/arm/mach-msm/dma.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <asm/io.h>
17#include <linux/interrupt.h>
18#include <asm/arch/dma.h>
19
20#define MSM_DMOV_CHANNEL_COUNT 16
21
22enum {
23 MSM_DMOV_PRINT_ERRORS = 1,
24 MSM_DMOV_PRINT_IO = 2,
25 MSM_DMOV_PRINT_FLOW = 4
26};
27
28static DEFINE_SPINLOCK(msm_dmov_lock);
29static struct msm_dmov_cmd active_command;
30static struct list_head ready_commands[MSM_DMOV_CHANNEL_COUNT];
31static struct list_head active_commands[MSM_DMOV_CHANNEL_COUNT];
32unsigned int msm_dmov_print_mask = MSM_DMOV_PRINT_ERRORS;
33
34#define MSM_DMOV_DPRINTF(mask, format, args...) \
35 do { \
36 if ((mask) & msm_dmov_print_mask) \
37 printk(KERN_ERR format, args); \
38 } while (0)
39#define PRINT_ERROR(format, args...) \
40 MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_ERRORS, format, args);
41#define PRINT_IO(format, args...) \
42 MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_IO, format, args);
43#define PRINT_FLOW(format, args...) \
44 MSM_DMOV_DPRINTF(MSM_DMOV_PRINT_FLOW, format, args);
45
46void msm_dmov_enqueue_cmd(unsigned id, struct msm_dmov_cmd *cmd)
47{
48 unsigned long irq_flags;
49 unsigned int status;
50
51 spin_lock_irqsave(&msm_dmov_lock, irq_flags);
52 status = readl(DMOV_STATUS(id));
53 if (list_empty(&ready_commands[id]) &&
54 (status & DMOV_STATUS_CMD_PTR_RDY)) {
55#if 0
56 if (list_empty(&active_commands[id])) {
57 PRINT_FLOW("msm_dmov_enqueue_cmd(%d), enable interrupt\n", id);
58 writel(DMOV_CONFIG_IRQ_EN, DMOV_CONFIG(id));
59 }
60#endif
61 PRINT_IO("msm_dmov_enqueue_cmd(%d), start command, status %x\n", id, status);
62 list_add_tail(&cmd->list, &active_commands[id]);
63 writel(cmd->cmdptr, DMOV_CMD_PTR(id));
64 } else {
65 if (list_empty(&active_commands[id]))
66 PRINT_ERROR("msm_dmov_enqueue_cmd(%d), error datamover stalled, status %x\n", id, status);
67
68 PRINT_IO("msm_dmov_enqueue_cmd(%d), enqueue command, status %x\n", id, status);
69 list_add_tail(&cmd->list, &ready_commands[id]);
70 }
71 spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
72}
73
74struct msm_dmov_exec_cmdptr_cmd {
75 struct msm_dmov_cmd dmov_cmd;
76 struct completion complete;
77 unsigned id;
78 unsigned int result;
79 unsigned int flush[6];
80};
81
82static void dmov_exec_cmdptr_complete_func(struct msm_dmov_cmd *_cmd, unsigned int result)
83{
84 struct msm_dmov_exec_cmdptr_cmd *cmd = container_of(_cmd, struct msm_dmov_exec_cmdptr_cmd, dmov_cmd);
85 cmd->result = result;
86 if (result != 0x80000002) {
87 cmd->flush[0] = readl(DMOV_FLUSH0(cmd->id));
88 cmd->flush[1] = readl(DMOV_FLUSH1(cmd->id));
89 cmd->flush[2] = readl(DMOV_FLUSH2(cmd->id));
90 cmd->flush[3] = readl(DMOV_FLUSH3(cmd->id));
91 cmd->flush[4] = readl(DMOV_FLUSH4(cmd->id));
92 cmd->flush[5] = readl(DMOV_FLUSH5(cmd->id));
93 }
94 complete(&cmd->complete);
95}
96
97int msm_dmov_exec_cmd(unsigned id, unsigned int cmdptr)
98{
99 struct msm_dmov_exec_cmdptr_cmd cmd;
100
101 PRINT_FLOW("dmov_exec_cmdptr(%d, %x)\n", id, cmdptr);
102
103 cmd.dmov_cmd.cmdptr = cmdptr;
104 cmd.dmov_cmd.complete_func = dmov_exec_cmdptr_complete_func;
105 cmd.id = id;
106 init_completion(&cmd.complete);
107
108 msm_dmov_enqueue_cmd(id, &cmd.dmov_cmd);
109 wait_for_completion(&cmd.complete);
110
111 if (cmd.result != 0x80000002) {
112 PRINT_ERROR("dmov_exec_cmdptr(%d): ERROR, result: %x\n", id, cmd.result);
113 PRINT_ERROR("dmov_exec_cmdptr(%d): flush: %x %x %x %x\n",
114 id, cmd.flush[0], cmd.flush[1], cmd.flush[2], cmd.flush[3]);
115 return -EIO;
116 }
117 PRINT_FLOW("dmov_exec_cmdptr(%d, %x) done\n", id, cmdptr);
118 return 0;
119}
120
121
122static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id)
123{
124 unsigned int int_status, mask, id;
125 unsigned long irq_flags;
126 unsigned int ch_status;
127 unsigned int ch_result;
128 struct msm_dmov_cmd *cmd;
129
130 spin_lock_irqsave(&msm_dmov_lock, irq_flags);
131
132 int_status = readl(DMOV_ISR); /* read and clear interrupt */
133 PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status);
134
135 while (int_status) {
136 mask = int_status & -int_status;
137 id = fls(mask) - 1;
138 PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id);
139 int_status &= ~mask;
140 ch_status = readl(DMOV_STATUS(id));
141 if (!(ch_status & DMOV_STATUS_RSLT_VALID)) {
142 PRINT_FLOW("msm_datamover_irq_handler id %d, result not valid %x\n", id, ch_status);
143 continue;
144 }
145 do {
146 ch_result = readl(DMOV_RSLT(id));
147 if (list_empty(&active_commands[id])) {
148 PRINT_ERROR("msm_datamover_irq_handler id %d, got result "
149 "with no active command, status %x, result %x\n",
150 id, ch_status, ch_result);
151 cmd = NULL;
152 } else
153 cmd = list_entry(active_commands[id].next, typeof(*cmd), list);
154 PRINT_FLOW("msm_datamover_irq_handler id %d, status %x, result %x\n", id, ch_status, ch_result);
155 if (ch_result & DMOV_RSLT_DONE) {
156 PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n",
157 id, ch_status);
158 PRINT_IO("msm_datamover_irq_handler id %d, got result "
159 "for %p, result %x\n", id, cmd, ch_result);
160 if (cmd) {
161 list_del(&cmd->list);
162 cmd->complete_func(cmd, ch_result);
163 }
164 }
165 if (ch_result & DMOV_RSLT_FLUSH) {
166 unsigned int flush0 = readl(DMOV_FLUSH0(id));
167 PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
168 PRINT_FLOW("msm_datamover_irq_handler id %d, flush, result %x, flush0 %x\n", id, ch_result, flush0);
169 if (cmd) {
170 list_del(&cmd->list);
171 cmd->complete_func(cmd, ch_result);
172 }
173 }
174 if (ch_result & DMOV_RSLT_ERROR) {
175 unsigned int flush0 = readl(DMOV_FLUSH0(id));
176 PRINT_ERROR("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
177 PRINT_ERROR("msm_datamover_irq_handler id %d, error, result %x, flush0 %x\n", id, ch_result, flush0);
178 if (cmd) {
179 list_del(&cmd->list);
180 cmd->complete_func(cmd, ch_result);
181 }
182 /* this does not seem to work, once we get an error */
183 /* the datamover will no longer accept commands */
184 writel(0, DMOV_FLUSH0(id));
185 }
186 ch_status = readl(DMOV_STATUS(id));
187 PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
188 if ((ch_status & DMOV_STATUS_CMD_PTR_RDY) && !list_empty(&ready_commands[id])) {
189 cmd = list_entry(ready_commands[id].next, typeof(*cmd), list);
190 list_del(&cmd->list);
191 list_add_tail(&cmd->list, &active_commands[id]);
192 PRINT_FLOW("msm_datamover_irq_handler id %d, start command\n", id);
193 writel(cmd->cmdptr, DMOV_CMD_PTR(id));
194 }
195 } while (ch_status & DMOV_STATUS_RSLT_VALID);
196 PRINT_FLOW("msm_datamover_irq_handler id %d, status %x\n", id, ch_status);
197 }
198 spin_unlock_irqrestore(&msm_dmov_lock, irq_flags);
199 return IRQ_HANDLED;
200}
201
202static int __init msm_init_datamover(void)
203{
204 int i;
205 for (i = 0; i < MSM_DMOV_CHANNEL_COUNT; i++) {
206 INIT_LIST_HEAD(&ready_commands[i]);
207 INIT_LIST_HEAD(&active_commands[i]);
208 writel(DMOV_CONFIG_IRQ_EN | DMOV_CONFIG_FORCE_TOP_PTR_RSLT | DMOV_CONFIG_FORCE_FLUSH_RSLT, DMOV_CONFIG(i));
209 }
210 return request_irq(INT_ADM_AARM, msm_datamover_irq_handler, 0, "msmdatamover", NULL);
211}
212
213arch_initcall(msm_init_datamover);
214
diff --git a/arch/arm/mach-msm/idle.S b/arch/arm/mach-msm/idle.S
new file mode 100644
index 000000000000..2b1cb7f16943
--- /dev/null
+++ b/arch/arm/mach-msm/idle.S
@@ -0,0 +1,36 @@
1/* linux/include/asm-arm/arch-msm/idle.S
2 *
3 * Idle processing for MSM7K - work around bugs with SWFI.
4 *
5 * Copyright (c) 2007 QUALCOMM Incorporated.
6 * Copyright (C) 2007 Google, Inc.
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#include <linux/linkage.h>
20#include <asm/assembler.h>
21
22ENTRY(arch_idle)
23#ifdef CONFIG_MSM7X00A_IDLE
24 mrc p15, 0, r1, c1, c0, 0 /* read current CR */
25 bic r0, r1, #(1 << 2) /* clear dcache bit */
26 bic r0, r0, #(1 << 12) /* clear icache bit */
27 mcr p15, 0, r0, c1, c0, 0 /* disable d/i cache */
28
29 mov r0, #0 /* prepare wfi value */
30 mcr p15, 0, r0, c7, c10, 0 /* flush the cache */
31 mcr p15, 0, r0, c7, c10, 4 /* memory barrier */
32 mcr p15, 0, r0, c7, c0, 4 /* wait for interrupt */
33
34 mcr p15, 0, r1, c1, c0, 0 /* restore d/i cache */
35#endif
36 mov pc, lr
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
new file mode 100644
index 000000000000..c39edb994a88
--- /dev/null
+++ b/arch/arm/mach-msm/io.c
@@ -0,0 +1,85 @@
1/* arch/arm/mach-msm/io.c
2 *
3 * MSM7K io support
4 *
5 * Copyright (C) 2007 Google, Inc.
6 * Author: Brian Swetland <swetland@google.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21
22#include <asm/hardware.h>
23#include <asm/io.h>
24#include <asm/page.h>
25#include <asm/arch/msm_iomap.h>
26#include <asm/mach/map.h>
27
28#include <asm/arch/board.h>
29
30#define MSM_DEVICE(name) { \
31 .virtual = MSM_##name##_BASE, \
32 .pfn = __phys_to_pfn(MSM_##name##_PHYS), \
33 .length = MSM_##name##_SIZE, \
34 .type = MT_DEVICE_NONSHARED, \
35 }
36
37static struct map_desc msm_io_desc[] __initdata = {
38 MSM_DEVICE(VIC),
39 MSM_DEVICE(CSR),
40 MSM_DEVICE(GPT),
41 MSM_DEVICE(DMOV),
42 MSM_DEVICE(UART1),
43 MSM_DEVICE(UART2),
44 MSM_DEVICE(UART3),
45 MSM_DEVICE(I2C),
46 MSM_DEVICE(GPIO1),
47 MSM_DEVICE(GPIO2),
48 MSM_DEVICE(HSUSB),
49 MSM_DEVICE(CLK_CTL),
50 MSM_DEVICE(PMDH),
51 MSM_DEVICE(EMDH),
52 MSM_DEVICE(MDP),
53 {
54 .virtual = MSM_SHARED_RAM_BASE,
55 .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
56 .length = MSM_SHARED_RAM_SIZE,
57 .type = MT_DEVICE,
58 },
59};
60
61void __init msm_map_common_io(void)
62{
63 /* Make sure the peripheral register window is closed, since
64 * we will use PTE flags (TEX[1]=1,B=0,C=1) to determine which
65 * pages are peripheral interface or not.
66 */
67 asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0));
68
69 iotable_init(msm_io_desc, ARRAY_SIZE(msm_io_desc));
70}
71
72void __iomem *
73__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
74{
75 if (mtype == MT_DEVICE) {
76 /* The peripherals in the 88000000 - D0000000 range
77 * are only accessable by type MT_DEVICE_NONSHARED.
78 * Adjust mtype as necessary to make this "just work."
79 */
80 if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000))
81 mtype = MT_DEVICE_NONSHARED;
82 }
83
84 return __arm_ioremap(phys_addr, size, mtype);
85}
diff --git a/arch/arm/mach-msm/irq.c b/arch/arm/mach-msm/irq.c
new file mode 100644
index 000000000000..24158040b789
--- /dev/null
+++ b/arch/arm/mach-msm/irq.c
@@ -0,0 +1,154 @@
1/* linux/arch/arm/mach-msm/irq.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/sched.h>
19#include <linux/interrupt.h>
20#include <linux/ptrace.h>
21#include <linux/timer.h>
22
23#include <linux/irq.h>
24#include <asm/hardware.h>
25
26#include <asm/io.h>
27
28#include <asm/arch/msm_iomap.h>
29
30#define VIC_REG(off) (MSM_VIC_BASE + (off))
31
32#define VIC_INT_SELECT0 VIC_REG(0x0000) /* 1: FIQ, 0: IRQ */
33#define VIC_INT_SELECT1 VIC_REG(0x0004) /* 1: FIQ, 0: IRQ */
34#define VIC_INT_EN0 VIC_REG(0x0010)
35#define VIC_INT_EN1 VIC_REG(0x0014)
36#define VIC_INT_ENCLEAR0 VIC_REG(0x0020)
37#define VIC_INT_ENCLEAR1 VIC_REG(0x0024)
38#define VIC_INT_ENSET0 VIC_REG(0x0030)
39#define VIC_INT_ENSET1 VIC_REG(0x0034)
40#define VIC_INT_TYPE0 VIC_REG(0x0040) /* 1: EDGE, 0: LEVEL */
41#define VIC_INT_TYPE1 VIC_REG(0x0044) /* 1: EDGE, 0: LEVEL */
42#define VIC_INT_POLARITY0 VIC_REG(0x0050) /* 1: NEG, 0: POS */
43#define VIC_INT_POLARITY1 VIC_REG(0x0054) /* 1: NEG, 0: POS */
44#define VIC_NO_PEND_VAL VIC_REG(0x0060)
45#define VIC_INT_MASTEREN VIC_REG(0x0064) /* 1: IRQ, 2: FIQ */
46#define VIC_PROTECTION VIC_REG(0x006C) /* 1: ENABLE */
47#define VIC_CONFIG VIC_REG(0x0068) /* 1: USE ARM1136 VIC */
48#define VIC_IRQ_STATUS0 VIC_REG(0x0080)
49#define VIC_IRQ_STATUS1 VIC_REG(0x0084)
50#define VIC_FIQ_STATUS0 VIC_REG(0x0090)
51#define VIC_FIQ_STATUS1 VIC_REG(0x0094)
52#define VIC_RAW_STATUS0 VIC_REG(0x00A0)
53#define VIC_RAW_STATUS1 VIC_REG(0x00A4)
54#define VIC_INT_CLEAR0 VIC_REG(0x00B0)
55#define VIC_INT_CLEAR1 VIC_REG(0x00B4)
56#define VIC_SOFTINT0 VIC_REG(0x00C0)
57#define VIC_SOFTINT1 VIC_REG(0x00C4)
58#define VIC_IRQ_VEC_RD VIC_REG(0x00D0) /* pending int # */
59#define VIC_IRQ_VEC_PEND_RD VIC_REG(0x00D4) /* pending vector addr */
60#define VIC_IRQ_VEC_WR VIC_REG(0x00D8)
61#define VIC_IRQ_IN_SERVICE VIC_REG(0x00E0)
62#define VIC_IRQ_IN_STACK VIC_REG(0x00E4)
63#define VIC_TEST_BUS_SEL VIC_REG(0x00E8)
64
65#define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4))
66#define VIC_VECTADDR(n) VIC_REG(0x0400+((n) * 4))
67
68static void msm_irq_ack(unsigned int irq)
69{
70 unsigned reg = VIC_INT_CLEAR0 + ((irq & 32) ? 4 : 0);
71 irq = 1 << (irq & 31);
72 writel(irq, reg);
73}
74
75static void msm_irq_mask(unsigned int irq)
76{
77 unsigned reg = VIC_INT_ENCLEAR0 + ((irq & 32) ? 4 : 0);
78 writel(1 << (irq & 31), reg);
79}
80
81static void msm_irq_unmask(unsigned int irq)
82{
83 unsigned reg = VIC_INT_ENSET0 + ((irq & 32) ? 4 : 0);
84 writel(1 << (irq & 31), reg);
85}
86
87static int msm_irq_set_wake(unsigned int irq, unsigned int on)
88{
89 return -EINVAL;
90}
91
92static int msm_irq_set_type(unsigned int irq, unsigned int flow_type)
93{
94 unsigned treg = VIC_INT_TYPE0 + ((irq & 32) ? 4 : 0);
95 unsigned preg = VIC_INT_POLARITY0 + ((irq & 32) ? 4 : 0);
96 int b = 1 << (irq & 31);
97
98 if (flow_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
99 writel(readl(preg) | b, preg);
100 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_HIGH))
101 writel(readl(preg) & (~b), preg);
102
103 if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
104 writel(readl(treg) | b, treg);
105 set_irq_handler(irq, handle_edge_irq);
106 }
107 if (flow_type & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW)) {
108 writel(readl(treg) & (~b), treg);
109 set_irq_handler(irq, handle_level_irq);
110 }
111 return 0;
112}
113
114static struct irq_chip msm_irq_chip = {
115 .name = "msm",
116 .ack = msm_irq_ack,
117 .mask = msm_irq_mask,
118 .unmask = msm_irq_unmask,
119 .set_wake = msm_irq_set_wake,
120 .set_type = msm_irq_set_type,
121};
122
123void __init msm_init_irq(void)
124{
125 unsigned n;
126
127 /* select level interrupts */
128 writel(0, VIC_INT_TYPE0);
129 writel(0, VIC_INT_TYPE1);
130
131 /* select highlevel interrupts */
132 writel(0, VIC_INT_POLARITY0);
133 writel(0, VIC_INT_POLARITY1);
134
135 /* select IRQ for all INTs */
136 writel(0, VIC_INT_SELECT0);
137 writel(0, VIC_INT_SELECT1);
138
139 /* disable all INTs */
140 writel(0, VIC_INT_EN0);
141 writel(0, VIC_INT_EN1);
142
143 /* don't use 1136 vic */
144 writel(0, VIC_CONFIG);
145
146 /* enable interrupt controller */
147 writel(1, VIC_INT_MASTEREN);
148
149 for (n = 0; n < NR_MSM_IRQS; n++) {
150 set_irq_chip(n, &msm_irq_chip);
151 set_irq_handler(n, handle_level_irq);
152 set_irq_flags(n, IRQF_VALID);
153 }
154}
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
new file mode 100644
index 000000000000..bd4732d1ab3e
--- /dev/null
+++ b/arch/arm/mach-msm/timer.c
@@ -0,0 +1,205 @@
1/* linux/arch/arm/mach-msm/timer.c
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/init.h>
17#include <linux/time.h>
18#include <linux/interrupt.h>
19#include <linux/irq.h>
20#include <linux/clk.h>
21#include <linux/clockchips.h>
22#include <linux/delay.h>
23
24#include <asm/mach/time.h>
25#include <asm/arch/msm_iomap.h>
26
27#include <asm/io.h>
28
29#define MSM_DGT_BASE (MSM_GPT_BASE + 0x10)
30#define MSM_DGT_SHIFT (5)
31
32#define TIMER_MATCH_VAL 0x0000
33#define TIMER_COUNT_VAL 0x0004
34#define TIMER_ENABLE 0x0008
35#define TIMER_ENABLE_CLR_ON_MATCH_EN 2
36#define TIMER_ENABLE_EN 1
37#define TIMER_CLEAR 0x000C
38
39#define CSR_PROTECTION 0x0020
40#define CSR_PROTECTION_EN 1
41
42#define GPT_HZ 32768
43#define DGT_HZ 19200000 /* 19.2 MHz or 600 KHz after shift */
44
45struct msm_clock {
46 struct clock_event_device clockevent;
47 struct clocksource clocksource;
48 struct irqaction irq;
49 uint32_t regbase;
50 uint32_t freq;
51 uint32_t shift;
52};
53
54static irqreturn_t msm_timer_interrupt(int irq, void *dev_id)
55{
56 struct clock_event_device *evt = dev_id;
57 evt->event_handler(evt);
58 return IRQ_HANDLED;
59}
60
61static cycle_t msm_gpt_read(void)
62{
63 return readl(MSM_GPT_BASE + TIMER_COUNT_VAL);
64}
65
66static cycle_t msm_dgt_read(void)
67{
68 return readl(MSM_DGT_BASE + TIMER_COUNT_VAL) >> MSM_DGT_SHIFT;
69}
70
71static int msm_timer_set_next_event(unsigned long cycles,
72 struct clock_event_device *evt)
73{
74 struct msm_clock *clock = container_of(evt, struct msm_clock, clockevent);
75 uint32_t now = readl(clock->regbase + TIMER_COUNT_VAL);
76 uint32_t alarm = now + (cycles << clock->shift);
77 int late;
78
79 writel(alarm, clock->regbase + TIMER_MATCH_VAL);
80 now = readl(clock->regbase + TIMER_COUNT_VAL);
81 late = now - alarm;
82 if (late >= (-2 << clock->shift) && late < DGT_HZ*5) {
83 printk(KERN_NOTICE "msm_timer_set_next_event(%lu) clock %s, "
84 "alarm already expired, now %x, alarm %x, late %d\n",
85 cycles, clock->clockevent.name, now, alarm, late);
86 return -ETIME;
87 }
88 return 0;
89}
90
91static void msm_timer_set_mode(enum clock_event_mode mode,
92 struct clock_event_device *evt)
93{
94 struct msm_clock *clock = container_of(evt, struct msm_clock, clockevent);
95 switch (mode) {
96 case CLOCK_EVT_MODE_RESUME:
97 case CLOCK_EVT_MODE_PERIODIC:
98 break;
99 case CLOCK_EVT_MODE_ONESHOT:
100 writel(TIMER_ENABLE_EN, clock->regbase + TIMER_ENABLE);
101 break;
102 case CLOCK_EVT_MODE_UNUSED:
103 case CLOCK_EVT_MODE_SHUTDOWN:
104 writel(0, clock->regbase + TIMER_ENABLE);
105 break;
106 }
107}
108
109static struct msm_clock msm_clocks[] = {
110 {
111 .clockevent = {
112 .name = "gp_timer",
113 .features = CLOCK_EVT_FEAT_ONESHOT,
114 .shift = 32,
115 .rating = 200,
116 .set_next_event = msm_timer_set_next_event,
117 .set_mode = msm_timer_set_mode,
118 },
119 .clocksource = {
120 .name = "gp_timer",
121 .rating = 200,
122 .read = msm_gpt_read,
123 .mask = CLOCKSOURCE_MASK(32),
124 .shift = 24,
125 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
126 },
127 .irq = {
128 .name = "gp_timer",
129 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_TRIGGER_RISING,
130 .handler = msm_timer_interrupt,
131 .dev_id = &msm_clocks[0].clockevent,
132 .irq = INT_GP_TIMER_EXP
133 },
134 .regbase = MSM_GPT_BASE,
135 .freq = GPT_HZ
136 },
137 {
138 .clockevent = {
139 .name = "dg_timer",
140 .features = CLOCK_EVT_FEAT_ONESHOT,
141 .shift = 32 + MSM_DGT_SHIFT,
142 .rating = 300,
143 .set_next_event = msm_timer_set_next_event,
144 .set_mode = msm_timer_set_mode,
145 },
146 .clocksource = {
147 .name = "dg_timer",
148 .rating = 300,
149 .read = msm_dgt_read,
150 .mask = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT)),
151 .shift = 24 - MSM_DGT_SHIFT,
152 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
153 },
154 .irq = {
155 .name = "dg_timer",
156 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_TRIGGER_RISING,
157 .handler = msm_timer_interrupt,
158 .dev_id = &msm_clocks[1].clockevent,
159 .irq = INT_DEBUG_TIMER_EXP
160 },
161 .regbase = MSM_DGT_BASE,
162 .freq = DGT_HZ >> MSM_DGT_SHIFT,
163 .shift = MSM_DGT_SHIFT
164 }
165};
166
167static void __init msm_timer_init(void)
168{
169 int i;
170 int res;
171
172 for (i = 0; i < ARRAY_SIZE(msm_clocks); i++) {
173 struct msm_clock *clock = &msm_clocks[i];
174 struct clock_event_device *ce = &clock->clockevent;
175 struct clocksource *cs = &clock->clocksource;
176 writel(0, clock->regbase + TIMER_ENABLE);
177 writel(0, clock->regbase + TIMER_CLEAR);
178 writel(~0, clock->regbase + TIMER_MATCH_VAL);
179
180 ce->mult = div_sc(clock->freq, NSEC_PER_SEC, ce->shift);
181 /* allow at least 10 seconds to notice that the timer wrapped */
182 ce->max_delta_ns =
183 clockevent_delta2ns(0xf0000000 >> clock->shift, ce);
184 /* 4 gets rounded down to 3 */
185 ce->min_delta_ns = clockevent_delta2ns(4, ce);
186 ce->cpumask = cpumask_of_cpu(0);
187
188 cs->mult = clocksource_hz2mult(clock->freq, cs->shift);
189 res = clocksource_register(cs);
190 if (res)
191 printk(KERN_ERR "msm_timer_init: clocksource_register "
192 "failed for %s\n", cs->name);
193
194 res = setup_irq(clock->irq.irq, &clock->irq);
195 if (res)
196 printk(KERN_ERR "msm_timer_init: setup_irq "
197 "failed for %s\n", cs->name);
198
199 clockevents_register_device(ce);
200 }
201}
202
203struct sys_timer msm_timer = {
204 .init = msm_timer_init
205};
diff --git a/arch/arm/mach-mx3/time.c b/arch/arm/mach-mx3/time.c
index e81fb5c5d7c3..fb565c98dbfb 100644
--- a/arch/arm/mach-mx3/time.c
+++ b/arch/arm/mach-mx3/time.c
@@ -45,8 +45,6 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
45{ 45{
46 unsigned int next_match; 46 unsigned int next_match;
47 47
48 write_seqlock(&xtime_lock);
49
50 if (__raw_readl(MXC_GPT_GPTSR) & GPTSR_OF1) { 48 if (__raw_readl(MXC_GPT_GPTSR) & GPTSR_OF1) {
51 do { 49 do {
52 timer_tick(); 50 timer_tick();
@@ -57,8 +55,6 @@ static irqreturn_t mxc_timer_interrupt(int irq, void *dev_id)
57 __raw_readl(MXC_GPT_GPTCNT)) <= 0); 55 __raw_readl(MXC_GPT_GPTCNT)) <= 0);
58 } 56 }
59 57
60 write_sequnlock(&xtime_lock);
61
62 return IRQ_HANDLED; 58 return IRQ_HANDLED;
63} 59}
64 60
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
index 4762e207b0bf..ea07b54afa59 100644
--- a/arch/arm/mach-netx/time.c
+++ b/arch/arm/mach-netx/time.c
@@ -33,12 +33,8 @@
33static irqreturn_t 33static irqreturn_t
34netx_timer_interrupt(int irq, void *dev_id) 34netx_timer_interrupt(int irq, void *dev_id)
35{ 35{
36 write_seqlock(&xtime_lock);
37
38 timer_tick(); 36 timer_tick();
39 37
40 write_sequnlock(&xtime_lock);
41
42 /* acknowledge interrupt */ 38 /* acknowledge interrupt */
43 writel(COUNTER_BIT(0), NETX_GPIO_IRQ); 39 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
44 40
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 130681201c19..9393824cc150 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -27,6 +27,7 @@
27#include <linux/mtd/nand.h> 27#include <linux/mtd/nand.h>
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/i2c/tps65010.h>
30 31
31#include <asm/hardware.h> 32#include <asm/hardware.h>
32#include <asm/gpio.h> 33#include <asm/gpio.h>
@@ -36,7 +37,6 @@
36#include <asm/mach/flash.h> 37#include <asm/mach/flash.h>
37#include <asm/mach/map.h> 38#include <asm/mach/map.h>
38 39
39#include <asm/arch/tps65010.h>
40#include <asm/arch/mux.h> 40#include <asm/arch/mux.h>
41#include <asm/arch/tc.h> 41#include <asm/arch/tc.h>
42#include <asm/arch/irda.h> 42#include <asm/arch/irda.h>
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 4f84ae273a1f..978cdab16535 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -26,6 +26,7 @@
26#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
27#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/i2c/tps65010.h>
29 30
30#include <asm/setup.h> 31#include <asm/setup.h>
31#include <asm/page.h> 32#include <asm/page.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
38#include <asm/mach/map.h> 39#include <asm/mach/map.h>
39 40
40#include <asm/arch/tps65010.h>
41#include <asm/arch/gpioexpander.h> 41#include <asm/arch/gpioexpander.h>
42#include <asm/arch/irqs.h> 42#include <asm/arch/irqs.h>
43#include <asm/arch/mux.h> 43#include <asm/arch/mux.h>
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 182a98a9df4c..e2c8ffd75cff 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -32,7 +32,6 @@
32#include <asm/arch/common.h> 32#include <asm/arch/common.h>
33#include <asm/arch/dsp_common.h> 33#include <asm/arch/dsp_common.h>
34#include <asm/arch/aic23.h> 34#include <asm/arch/aic23.h>
35#include <asm/arch/gpio.h>
36#include <asm/arch/omapfb.h> 35#include <asm/arch/omapfb.h>
37#include <asm/arch/lcd_mipid.h> 36#include <asm/arch/lcd_mipid.h>
38 37
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 5db182da322b..4e016179f312 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -31,12 +31,13 @@
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/interrupt.h>
35#include <linux/i2c.h> 34#include <linux/i2c.h>
36 35
37#include <linux/mtd/mtd.h> 36#include <linux/mtd/mtd.h>
38#include <linux/mtd/partitions.h> 37#include <linux/mtd/partitions.h>
39 38
39#include <linux/i2c/tps65010.h>
40
40#include <asm/hardware.h> 41#include <asm/hardware.h>
41#include <asm/gpio.h> 42#include <asm/gpio.h>
42 43
@@ -46,7 +47,6 @@
46#include <asm/mach/flash.h> 47#include <asm/mach/flash.h>
47 48
48#include <asm/arch/usb.h> 49#include <asm/arch/usb.h>
49#include <asm/arch/tps65010.h>
50#include <asm/arch/mux.h> 50#include <asm/arch/mux.h>
51#include <asm/arch/tc.h> 51#include <asm/arch/tc.h>
52#include <asm/arch/common.h> 52#include <asm/arch/common.h>
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index e47010fec275..ed7094a70064 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -42,7 +42,6 @@
42#include <asm/arch/common.h> 42#include <asm/arch/common.h>
43#include <asm/arch/omap-alsa.h> 43#include <asm/arch/omap-alsa.h>
44 44
45#include <linux/input.h>
46#include <linux/spi/spi.h> 45#include <linux/spi/spi.h>
47#include <linux/spi/ads7846.h> 46#include <linux/spi/ads7846.h>
48 47
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index c275d517764a..a9a0f6610c3d 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -44,7 +44,6 @@
44#include <asm/arch/common.h> 44#include <asm/arch/common.h>
45#include <asm/arch/omap-alsa.h> 45#include <asm/arch/omap-alsa.h>
46 46
47#include <linux/input.h>
48#include <linux/spi/spi.h> 47#include <linux/spi/spi.h>
49#include <linux/spi/ads7846.h> 48#include <linux/spi/ads7846.h>
50 49
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 86de303ecab2..6939d5e7569a 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -5,13 +5,13 @@
5 */ 5 */
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/workqueue.h> 7#include <linux/workqueue.h>
8#include <linux/i2c/tps65010.h>
8 9
9#include <asm/hardware.h> 10#include <asm/hardware.h>
10#include <asm/leds.h> 11#include <asm/leds.h>
11#include <asm/system.h> 12#include <asm/system.h>
12 13
13#include <asm/arch/gpio.h> 14#include <asm/arch/gpio.h>
14#include <asm/arch/tps65010.h>
15 15
16#include "leds.h" 16#include "leds.h"
17 17
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index d9805e3d9304..06b7e54a0128 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -639,7 +639,7 @@ static void omap_pm_finish(void)
639} 639}
640 640
641 641
642static irqreturn_t omap_wakeup_interrupt(int irq, void *dev) 642static irqreturn_t omap_wakeup_interrupt(int irq, void *dev)
643{ 643{
644 return IRQ_HANDLED; 644 return IRQ_HANDLED;
645} 645}
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 3bb49c17c858..94e38cc2bb6c 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -26,7 +26,6 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/irq.h>
30 29
31#include <asm/hardware.h> 30#include <asm/hardware.h>
32#include <asm/mach-types.h> 31#include <asm/mach-types.h>
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 8d322c20ccae..3234deedb946 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -40,13 +40,9 @@ static inline void omap2_gp_timer_start(unsigned long load_val)
40 40
41static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id) 41static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
42{ 42{
43 write_seqlock(&xtime_lock);
44
45 omap_dm_timer_write_status(gptimer, OMAP_TIMER_INT_OVERFLOW); 43 omap_dm_timer_write_status(gptimer, OMAP_TIMER_INT_OVERFLOW);
46 timer_tick(); 44 timer_tick();
47 45
48 write_sequnlock(&xtime_lock);
49
50 return IRQ_HANDLED; 46 return IRQ_HANDLED;
51} 47}
52 48
diff --git a/arch/arm/mach-pnx4008/time.c b/arch/arm/mach-pnx4008/time.c
index 67e05f005a6b..6d4ca8fc0cb4 100644
--- a/arch/arm/mach-pnx4008/time.c
+++ b/arch/arm/mach-pnx4008/time.c
@@ -51,8 +51,6 @@ static irqreturn_t pnx4008_timer_interrupt(int irq, void *dev_id)
51{ 51{
52 if (__raw_readl(HSTIM_INT) & MATCH0_INT) { 52 if (__raw_readl(HSTIM_INT) & MATCH0_INT) {
53 53
54 write_seqlock(&xtime_lock);
55
56 do { 54 do {
57 timer_tick(); 55 timer_tick();
58 56
@@ -73,8 +71,6 @@ static irqreturn_t pnx4008_timer_interrupt(int irq, void *dev_id)
73 } while ((signed) 71 } while ((signed)
74 (__raw_readl(HSTIM_MATCH0) - 72 (__raw_readl(HSTIM_MATCH0) -
75 __raw_readl(HSTIM_COUNTER)) < 0); 73 __raw_readl(HSTIM_COUNTER)) < 0);
76
77 write_sequnlock(&xtime_lock);
78 } 74 }
79 75
80 return IRQ_HANDLED; 76 return IRQ_HANDLED;
diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c
index 12d2fe0ceff6..254892ac30cd 100644
--- a/arch/arm/mach-pxa/akita-ioexp.c
+++ b/arch/arm/mach-pxa/akita-ioexp.c
@@ -29,7 +29,7 @@
29#define MAX7310_TIMEOUT 0x04 29#define MAX7310_TIMEOUT 0x04
30 30
31/* Addresses to scan */ 31/* Addresses to scan */
32static unsigned short normal_i2c[] = { 0x18, I2C_CLIENT_END }; 32static const unsigned short normal_i2c[] = { 0x18, I2C_CLIENT_END };
33 33
34/* I2C Magic */ 34/* I2C Magic */
35I2C_CLIENT_INSMOD; 35I2C_CLIENT_INSMOD;
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 9732d5d9466b..006a6e09589c 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -111,11 +111,14 @@ static const struct clkops clk_pxa25x_lcd_ops = {
111 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz 111 * 95.842MHz -> MMC 19.169MHz, I2C 31.949MHz, FICP 47.923MHz, USB 47.923MHz
112 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly) 112 * 147.456MHz -> UART 14.7456MHz, AC97 12.288MHz, I2S 5.672MHz (allegedly)
113 */ 113 */
114static struct clk pxa25x_hwuart_clk =
115 INIT_CKEN("UARTCLK", HWUART, 14745600, 1, &pxa_device_hwuart.dev)
116;
117
114static struct clk pxa25x_clks[] = { 118static struct clk pxa25x_clks[] = {
115 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev), 119 INIT_CK("LCDCLK", LCD, &clk_pxa25x_lcd_ops, &pxa_device_fb.dev),
116 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev), 120 INIT_CKEN("UARTCLK", FFUART, 14745600, 1, &pxa_device_ffuart.dev),
117 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev), 121 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
118 INIT_CKEN("UARTCLK", BTUART, 14745600, 1, &pxa_device_btuart.dev),
119 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL), 122 INIT_CKEN("UARTCLK", STUART, 14745600, 1, NULL),
120 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev), 123 INIT_CKEN("UDCCLK", USB, 47923000, 5, &pxa_device_udc.dev),
121 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev), 124 INIT_CKEN("MMCCLK", MMC, 19169000, 0, &pxa_device_mci.dev),
@@ -303,6 +306,10 @@ static int __init pxa25x_init(void)
303{ 306{
304 int ret = 0; 307 int ret = 0;
305 308
309 /* Only add HWUART for PXA255/26x; PXA210/250/27x do not have it. */
310 if (cpu_is_pxa25x())
311 clks_register(&pxa25x_hwuart_clk, 1);
312
306 if (cpu_is_pxa21x() || cpu_is_pxa25x()) { 313 if (cpu_is_pxa21x() || cpu_is_pxa25x()) {
307 clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks)); 314 clks_register(pxa25x_clks, ARRAY_SIZE(pxa25x_clks));
308 315
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 8e126e6b74c3..57efebdc4324 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -24,6 +24,7 @@
24#include <asm/arch/ohci.h> 24#include <asm/arch/ohci.h>
25#include <asm/arch/pm.h> 25#include <asm/arch/pm.h>
26#include <asm/arch/dma.h> 26#include <asm/arch/dma.h>
27#include <asm/arch/i2c.h>
27 28
28#include "generic.h" 29#include "generic.h"
29#include "devices.h" 30#include "devices.h"
@@ -423,6 +424,11 @@ struct platform_device pxa27x_device_i2c_power = {
423 .num_resources = ARRAY_SIZE(i2c_power_resources), 424 .num_resources = ARRAY_SIZE(i2c_power_resources),
424}; 425};
425 426
427void __init pxa_set_i2c_power_info(struct i2c_pxa_platform_data *info)
428{
429 pxa27x_device_i2c_power.dev.platform_data = info;
430}
431
426static struct platform_device *devices[] __initdata = { 432static struct platform_device *devices[] __initdata = {
427 &pxa_device_mci, 433 &pxa_device_mci,
428 &pxa_device_udc, 434 &pxa_device_udc,
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 61d9c9d69e6b..37e93f9ba8fc 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -86,7 +86,7 @@ unsigned int pxa3xx_get_clk_frequency_khz(int info)
86 HSS / 1000000, (HSS % 1000000) / 10000); 86 HSS / 1000000, (HSS % 1000000) / 10000);
87 } 87 }
88 88
89 return CLK; 89 return CLK / 1000;
90} 90}
91 91
92/* 92/*
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index 422afee88169..b2eb38543d1c 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -67,7 +67,7 @@ static int use_count[PXA_SSP_PORTS] = {0, 0, 0};
67 67
68static irqreturn_t ssp_interrupt(int irq, void *dev_id) 68static irqreturn_t ssp_interrupt(int irq, void *dev_id)
69{ 69{
70 struct ssp_dev *dev = (struct ssp_dev*) dev_id; 70 struct ssp_dev *dev = dev_id;
71 unsigned int status = SSSR_P(dev->port); 71 unsigned int status = SSSR_P(dev->port);
72 72
73 SSSR_P(dev->port) = status; /* clear status bits */ 73 SSSR_P(dev->port) = status; /* clear status bits */
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index c7f1b44da40d..61d70218f1e8 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -530,8 +530,6 @@ static unsigned long realview_gettimeoffset(void)
530 */ 530 */
531static irqreturn_t realview_timer_interrupt(int irq, void *dev_id) 531static irqreturn_t realview_timer_interrupt(int irq, void *dev_id)
532{ 532{
533 write_seqlock(&xtime_lock);
534
535 // ...clear the interrupt 533 // ...clear the interrupt
536 writel(1, TIMER0_VA_BASE + TIMER_INTCLR); 534 writel(1, TIMER0_VA_BASE + TIMER_INTCLR);
537 535
@@ -542,8 +540,6 @@ static irqreturn_t realview_timer_interrupt(int irq, void *dev_id)
542 update_process_times(user_mode(get_irq_regs())); 540 update_process_times(user_mode(get_irq_regs()));
543#endif 541#endif
544 542
545 write_sequnlock(&xtime_lock);
546
547 return IRQ_HANDLED; 543 return IRQ_HANDLED;
548} 544}
549 545
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 587864fe25fb..66175471fff3 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -530,7 +530,7 @@ static struct s3c2410fb_mach_info __initdata bast_fb_info = {
530 530
531 .displays = bast_lcd_info, 531 .displays = bast_lcd_info,
532 .num_displays = ARRAY_SIZE(bast_lcd_info), 532 .num_displays = ARRAY_SIZE(bast_lcd_info),
533 .default_display = 4, 533 .default_display = 1,
534}; 534};
535 535
536/* Standard BAST devices */ 536/* Standard BAST devices */
@@ -540,7 +540,6 @@ static struct platform_device *bast_devices[] __initdata = {
540 &s3c_device_lcd, 540 &s3c_device_lcd,
541 &s3c_device_wdt, 541 &s3c_device_wdt,
542 &s3c_device_i2c, 542 &s3c_device_i2c,
543 &s3c_device_iis,
544 &s3c_device_rtc, 543 &s3c_device_rtc,
545 &s3c_device_nand, 544 &s3c_device_nand,
546 &bast_device_nor, 545 &bast_device_nor,
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 9f43f3f124f5..3aade7b78fe5 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -365,7 +365,6 @@ static struct platform_device *vr1000_devices[] __initdata = {
365 &s3c_device_lcd, 365 &s3c_device_lcd,
366 &s3c_device_wdt, 366 &s3c_device_wdt,
367 &s3c_device_i2c, 367 &s3c_device_i2c,
368 &s3c_device_iis,
369 &s3c_device_adc, 368 &s3c_device_adc,
370 &serial_device, 369 &serial_device,
371 &vr1000_nor, 370 &vr1000_nor,
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
index bcd562ac1d3d..6aec86a5da56 100644
--- a/arch/arm/mach-s3c2410/usb-simtec.c
+++ b/arch/arm/mach-s3c2410/usb-simtec.c
@@ -60,7 +60,7 @@ usb_simtec_powercontrol(int port, int to)
60static irqreturn_t 60static irqreturn_t
61usb_simtec_ocirq(int irq, void *pw) 61usb_simtec_ocirq(int irq, void *pw)
62{ 62{
63 struct s3c2410_hcd_info *info = (struct s3c2410_hcd_info *)pw; 63 struct s3c2410_hcd_info *info = pw;
64 64
65 if (s3c2410_gpio_getpin(S3C2410_GPG10) == 0) { 65 if (s3c2410_gpio_getpin(S3C2410_GPG10) == 0) {
66 pr_debug("usb_simtec: over-current irq (oc detected)\n"); 66 pr_debug("usb_simtec: over-current irq (oc detected)\n");
diff --git a/arch/arm/mach-s3c2412/Kconfig b/arch/arm/mach-s3c2412/Kconfig
index 8e8fe48ea47f..0b43431d4b75 100644
--- a/arch/arm/mach-s3c2412/Kconfig
+++ b/arch/arm/mach-s3c2412/Kconfig
@@ -10,6 +10,7 @@ config CPU_S3C2412
10 select CPU_LLSERIAL_S3C2440 10 select CPU_LLSERIAL_S3C2440
11 select S3C2412_PM if PM 11 select S3C2412_PM if PM
12 select S3C2412_DMA if S3C2410_DMA 12 select S3C2412_DMA if S3C2410_DMA
13 select S3C2410_GPIO
13 help 14 help
14 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line 15 Support for the S3C2412 and S3C2413 SoCs from the S3C24XX line
15 16
diff --git a/arch/arm/mach-s3c2412/Makefile b/arch/arm/mach-s3c2412/Makefile
index f8e011691b31..267f3348301e 100644
--- a/arch/arm/mach-s3c2412/Makefile
+++ b/arch/arm/mach-s3c2412/Makefile
@@ -12,8 +12,9 @@ obj- :=
12obj-$(CONFIG_CPU_S3C2412) += s3c2412.o 12obj-$(CONFIG_CPU_S3C2412) += s3c2412.o
13obj-$(CONFIG_CPU_S3C2412) += irq.o 13obj-$(CONFIG_CPU_S3C2412) += irq.o
14obj-$(CONFIG_CPU_S3C2412) += clock.o 14obj-$(CONFIG_CPU_S3C2412) += clock.o
15obj-$(CONFIG_CPU_S3C2412) += gpio.o
15obj-$(CONFIG_S3C2412_DMA) += dma.o 16obj-$(CONFIG_S3C2412_DMA) += dma.o
16obj-$(CONFIG_S3C2412_PM) += pm.o 17obj-$(CONFIG_S3C2412_PM) += pm.o sleep.o
17 18
18# Machine support 19# Machine support
19 20
diff --git a/arch/arm/mach-s3c2412/clock.c b/arch/arm/mach-s3c2412/clock.c
index 458993601897..2697a65ba727 100644
--- a/arch/arm/mach-s3c2412/clock.c
+++ b/arch/arm/mach-s3c2412/clock.c
@@ -217,7 +217,7 @@ static int s3c2412_setparent_msysclk(struct clk *clk, struct clk *parent)
217 217
218 if (parent == &clk_mdivclk) 218 if (parent == &clk_mdivclk)
219 clksrc &= ~S3C2412_CLKSRC_MSYSCLK_MPLL; 219 clksrc &= ~S3C2412_CLKSRC_MSYSCLK_MPLL;
220 else if (parent == &clk_upll) 220 else if (parent == &clk_mpll)
221 clksrc |= S3C2412_CLKSRC_MSYSCLK_MPLL; 221 clksrc |= S3C2412_CLKSRC_MSYSCLK_MPLL;
222 else 222 else
223 return -EINVAL; 223 return -EINVAL;
@@ -234,6 +234,45 @@ static struct clk clk_msysclk = {
234 .set_parent = s3c2412_setparent_msysclk, 234 .set_parent = s3c2412_setparent_msysclk,
235}; 235};
236 236
237static int s3c2412_setparent_armclk(struct clk *clk, struct clk *parent)
238{
239 unsigned long flags;
240 unsigned long clkdiv;
241 unsigned long dvs;
242
243 /* Note, we current equate fclk andf msysclk for S3C2412 */
244
245 if (parent == &clk_msysclk || parent == &clk_f)
246 dvs = 0;
247 else if (parent == &clk_h)
248 dvs = S3C2412_CLKDIVN_DVSEN;
249 else
250 return -EINVAL;
251
252 clk->parent = parent;
253
254 /* update this under irq lockdown, clkdivn is not protected
255 * by the clock system. */
256
257 local_irq_save(flags);
258
259 clkdiv = __raw_readl(S3C2410_CLKDIVN);
260 clkdiv &= ~S3C2412_CLKDIVN_DVSEN;
261 clkdiv |= dvs;
262 __raw_writel(clkdiv, S3C2410_CLKDIVN);
263
264 local_irq_restore(flags);
265
266 return 0;
267}
268
269static struct clk clk_armclk = {
270 .name = "armclk",
271 .id = -1,
272 .parent = &clk_msysclk,
273 .set_parent = s3c2412_setparent_armclk,
274};
275
237/* these next clocks have an divider immediately after them, 276/* these next clocks have an divider immediately after them,
238 * so we can register them with their divider and leave out the 277 * so we can register them with their divider and leave out the
239 * intermediate clock stage 278 * intermediate clock stage
@@ -630,11 +669,13 @@ static struct clk *clks[] __initdata = {
630 &clk_erefclk, 669 &clk_erefclk,
631 &clk_urefclk, 670 &clk_urefclk,
632 &clk_mrefclk, 671 &clk_mrefclk,
672 &clk_armclk,
633}; 673};
634 674
635int __init s3c2412_baseclk_add(void) 675int __init s3c2412_baseclk_add(void)
636{ 676{
637 unsigned long clkcon = __raw_readl(S3C2410_CLKCON); 677 unsigned long clkcon = __raw_readl(S3C2410_CLKCON);
678 unsigned int dvs;
638 struct clk *clkp; 679 struct clk *clkp;
639 int ret; 680 int ret;
640 int ptr; 681 int ptr;
@@ -643,6 +684,8 @@ int __init s3c2412_baseclk_add(void)
643 clk_usb_bus.parent = &clk_usbsrc; 684 clk_usb_bus.parent = &clk_usbsrc;
644 clk_usb_bus.rate = 0x0; 685 clk_usb_bus.rate = 0x0;
645 686
687 clk_f.parent = &clk_msysclk;
688
646 s3c2412_clk_initparents(); 689 s3c2412_clk_initparents();
647 690
648 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) { 691 for (ptr = 0; ptr < ARRAY_SIZE(clks); ptr++) {
@@ -655,6 +698,15 @@ int __init s3c2412_baseclk_add(void)
655 } 698 }
656 } 699 }
657 700
701 /* set the dvs state according to what we got at boot time */
702
703 dvs = __raw_readl(S3C2410_CLKDIVN) & S3C2412_CLKDIVN_DVSEN;
704
705 if (dvs)
706 clk_armclk.parent = &clk_h;
707
708 printk(KERN_INFO "S3C2412: DVS is %s\n", dvs ? "on" : "off");
709
658 /* ensure usb bus clock is within correct rate of 48MHz */ 710 /* ensure usb bus clock is within correct rate of 48MHz */
659 711
660 if (clk_get_rate(&clk_usb_bus) != (48 * 1000 * 1000)) { 712 if (clk_get_rate(&clk_usb_bus) != (48 * 1000 * 1000)) {
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c
index 53c1d5bbce19..1dd864993566 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c2412/dma.c
@@ -30,6 +30,7 @@
30#include <asm/arch/regs-mem.h> 30#include <asm/arch/regs-mem.h>
31#include <asm/arch/regs-lcd.h> 31#include <asm/arch/regs-lcd.h>
32#include <asm/arch/regs-sdi.h> 32#include <asm/arch/regs-sdi.h>
33#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
33#include <asm/plat-s3c24xx/regs-iis.h> 34#include <asm/plat-s3c24xx/regs-iis.h>
34#include <asm/plat-s3c24xx/regs-spi.h> 35#include <asm/plat-s3c24xx/regs-spi.h>
35 36
@@ -39,106 +40,141 @@ static struct s3c24xx_dma_map __initdata s3c2412_dma_mappings[] = {
39 [DMACH_XD0] = { 40 [DMACH_XD0] = {
40 .name = "xdreq0", 41 .name = "xdreq0",
41 .channels = MAP(S3C2412_DMAREQSEL_XDREQ0), 42 .channels = MAP(S3C2412_DMAREQSEL_XDREQ0),
43 .channels_rx = MAP(S3C2412_DMAREQSEL_XDREQ0),
42 }, 44 },
43 [DMACH_XD1] = { 45 [DMACH_XD1] = {
44 .name = "xdreq1", 46 .name = "xdreq1",
45 .channels = MAP(S3C2412_DMAREQSEL_XDREQ1), 47 .channels = MAP(S3C2412_DMAREQSEL_XDREQ1),
48 .channels_rx = MAP(S3C2412_DMAREQSEL_XDREQ1),
46 }, 49 },
47 [DMACH_SDI] = { 50 [DMACH_SDI] = {
48 .name = "sdi", 51 .name = "sdi",
49 .channels = MAP(S3C2412_DMAREQSEL_SDI), 52 .channels = MAP(S3C2412_DMAREQSEL_SDI),
50 .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO, 53 .channels_rx = MAP(S3C2412_DMAREQSEL_SDI),
51 .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO, 54 .hw_addr.to = S3C2410_PA_SDI + S3C2410_SDIDATA,
55 .hw_addr.from = S3C2410_PA_SDI + S3C2410_SDIDATA,
52 }, 56 },
53 [DMACH_SPI0] = { 57 [DMACH_SPI0] = {
54 .name = "spi0", 58 .name = "spi0",
55 .channels = MAP(S3C2412_DMAREQSEL_SPI0TX), 59 .channels = MAP(S3C2412_DMAREQSEL_SPI0TX),
60 .channels_rx = MAP(S3C2412_DMAREQSEL_SPI0RX),
56 .hw_addr.to = S3C2410_PA_SPI + S3C2410_SPTDAT, 61 .hw_addr.to = S3C2410_PA_SPI + S3C2410_SPTDAT,
57 .hw_addr.from = S3C2410_PA_SPI + S3C2410_SPRDAT, 62 .hw_addr.from = S3C2410_PA_SPI + S3C2410_SPRDAT,
58 }, 63 },
59 [DMACH_SPI1] = { 64 [DMACH_SPI1] = {
60 .name = "spi1", 65 .name = "spi1",
61 .channels = MAP(S3C2412_DMAREQSEL_SPI1TX), 66 .channels = MAP(S3C2412_DMAREQSEL_SPI1TX),
67 .channels_rx = MAP(S3C2412_DMAREQSEL_SPI1RX),
62 .hw_addr.to = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPTDAT, 68 .hw_addr.to = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPTDAT,
63 .hw_addr.from = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPRDAT, 69 .hw_addr.from = S3C2410_PA_SPI + S3C2412_SPI1 + S3C2410_SPRDAT,
64 }, 70 },
65 [DMACH_UART0] = { 71 [DMACH_UART0] = {
66 .name = "uart0", 72 .name = "uart0",
67 .channels = MAP(S3C2412_DMAREQSEL_UART0_0), 73 .channels = MAP(S3C2412_DMAREQSEL_UART0_0),
74 .channels_rx = MAP(S3C2412_DMAREQSEL_UART0_0),
68 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH, 75 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
69 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH, 76 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
70 }, 77 },
71 [DMACH_UART1] = { 78 [DMACH_UART1] = {
72 .name = "uart1", 79 .name = "uart1",
73 .channels = MAP(S3C2412_DMAREQSEL_UART1_0), 80 .channels = MAP(S3C2412_DMAREQSEL_UART1_0),
81 .channels_rx = MAP(S3C2412_DMAREQSEL_UART1_0),
74 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH, 82 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
75 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH, 83 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
76 }, 84 },
77 [DMACH_UART2] = { 85 [DMACH_UART2] = {
78 .name = "uart2", 86 .name = "uart2",
79 .channels = MAP(S3C2412_DMAREQSEL_UART2_0), 87 .channels = MAP(S3C2412_DMAREQSEL_UART2_0),
88 .channels_rx = MAP(S3C2412_DMAREQSEL_UART2_0),
80 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH, 89 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
81 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH, 90 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
82 }, 91 },
83 [DMACH_UART0_SRC2] = { 92 [DMACH_UART0_SRC2] = {
84 .name = "uart0", 93 .name = "uart0",
85 .channels = MAP(S3C2412_DMAREQSEL_UART0_1), 94 .channels = MAP(S3C2412_DMAREQSEL_UART0_1),
95 .channels_rx = MAP(S3C2412_DMAREQSEL_UART0_1),
86 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH, 96 .hw_addr.to = S3C2410_PA_UART0 + S3C2410_UTXH,
87 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH, 97 .hw_addr.from = S3C2410_PA_UART0 + S3C2410_URXH,
88 }, 98 },
89 [DMACH_UART1_SRC2] = { 99 [DMACH_UART1_SRC2] = {
90 .name = "uart1", 100 .name = "uart1",
91 .channels = MAP(S3C2412_DMAREQSEL_UART1_1), 101 .channels = MAP(S3C2412_DMAREQSEL_UART1_1),
102 .channels_rx = MAP(S3C2412_DMAREQSEL_UART1_1),
92 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH, 103 .hw_addr.to = S3C2410_PA_UART1 + S3C2410_UTXH,
93 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH, 104 .hw_addr.from = S3C2410_PA_UART1 + S3C2410_URXH,
94 }, 105 },
95 [DMACH_UART2_SRC2] = { 106 [DMACH_UART2_SRC2] = {
96 .name = "uart2", 107 .name = "uart2",
97 .channels = MAP(S3C2412_DMAREQSEL_UART2_1), 108 .channels = MAP(S3C2412_DMAREQSEL_UART2_1),
109 .channels_rx = MAP(S3C2412_DMAREQSEL_UART2_1),
98 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH, 110 .hw_addr.to = S3C2410_PA_UART2 + S3C2410_UTXH,
99 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH, 111 .hw_addr.from = S3C2410_PA_UART2 + S3C2410_URXH,
100 }, 112 },
101 [DMACH_TIMER] = { 113 [DMACH_TIMER] = {
102 .name = "timer", 114 .name = "timer",
103 .channels = MAP(S3C2412_DMAREQSEL_TIMER), 115 .channels = MAP(S3C2412_DMAREQSEL_TIMER),
116 .channels_rx = MAP(S3C2412_DMAREQSEL_TIMER),
104 }, 117 },
105 [DMACH_I2S_IN] = { 118 [DMACH_I2S_IN] = {
106 .name = "i2s-sdi", 119 .name = "i2s-sdi",
107 .channels = MAP(S3C2412_DMAREQSEL_I2SRX), 120 .channels = MAP(S3C2412_DMAREQSEL_I2SRX),
108 .hw_addr.from = S3C2410_PA_IIS + S3C2410_IISFIFO, 121 .channels_rx = MAP(S3C2412_DMAREQSEL_I2SRX),
122 .hw_addr.from = S3C2410_PA_IIS + S3C2412_IISRXD,
109 }, 123 },
110 [DMACH_I2S_OUT] = { 124 [DMACH_I2S_OUT] = {
111 .name = "i2s-sdo", 125 .name = "i2s-sdo",
112 .channels = MAP(S3C2412_DMAREQSEL_I2STX), 126 .channels = MAP(S3C2412_DMAREQSEL_I2STX),
113 .hw_addr.to = S3C2410_PA_IIS + S3C2410_IISFIFO, 127 .channels_rx = MAP(S3C2412_DMAREQSEL_I2STX),
128 .hw_addr.to = S3C2410_PA_IIS + S3C2412_IISTXD,
114 }, 129 },
115 [DMACH_USB_EP1] = { 130 [DMACH_USB_EP1] = {
116 .name = "usb-ep1", 131 .name = "usb-ep1",
117 .channels = MAP(S3C2412_DMAREQSEL_USBEP1), 132 .channels = MAP(S3C2412_DMAREQSEL_USBEP1),
133 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP1),
118 }, 134 },
119 [DMACH_USB_EP2] = { 135 [DMACH_USB_EP2] = {
120 .name = "usb-ep2", 136 .name = "usb-ep2",
121 .channels = MAP(S3C2412_DMAREQSEL_USBEP2), 137 .channels = MAP(S3C2412_DMAREQSEL_USBEP2),
138 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP2),
122 }, 139 },
123 [DMACH_USB_EP3] = { 140 [DMACH_USB_EP3] = {
124 .name = "usb-ep3", 141 .name = "usb-ep3",
125 .channels = MAP(S3C2412_DMAREQSEL_USBEP3), 142 .channels = MAP(S3C2412_DMAREQSEL_USBEP3),
143 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP3),
126 }, 144 },
127 [DMACH_USB_EP4] = { 145 [DMACH_USB_EP4] = {
128 .name = "usb-ep4", 146 .name = "usb-ep4",
129 .channels = MAP(S3C2412_DMAREQSEL_USBEP4), 147 .channels = MAP(S3C2412_DMAREQSEL_USBEP4),
148 .channels_rx = MAP(S3C2412_DMAREQSEL_USBEP4),
130 }, 149 },
131}; 150};
132 151
152static void s3c2412_dma_direction(struct s3c2410_dma_chan *chan,
153 struct s3c24xx_dma_map *map,
154 enum s3c2410_dmasrc dir)
155{
156 unsigned long chsel;
157
158 if (dir == S3C2410_DMASRC_HW)
159 chsel = map->channels_rx[0];
160 else
161 chsel = map->channels[0];
162
163 chsel &= ~DMA_CH_VALID;
164 chsel |= S3C2412_DMAREQSEL_HW;
165
166 writel(chsel, chan->regs + S3C2412_DMA_DMAREQSEL);
167}
168
133static void s3c2412_dma_select(struct s3c2410_dma_chan *chan, 169static void s3c2412_dma_select(struct s3c2410_dma_chan *chan,
134 struct s3c24xx_dma_map *map) 170 struct s3c24xx_dma_map *map)
135{ 171{
136 writel(map->channels[0] | S3C2412_DMAREQSEL_HW, 172 s3c2412_dma_direction(chan, map, chan->source);
137 chan->regs + S3C2412_DMA_DMAREQSEL);
138} 173}
139 174
140static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = { 175static struct s3c24xx_dma_selection __initdata s3c2412_dma_sel = {
141 .select = s3c2412_dma_select, 176 .select = s3c2412_dma_select,
177 .direction = s3c2412_dma_direction,
142 .dcon_mask = 0, 178 .dcon_mask = 0,
143 .map = s3c2412_dma_mappings, 179 .map = s3c2412_dma_mappings,
144 .map_size = ARRAY_SIZE(s3c2412_dma_mappings), 180 .map_size = ARRAY_SIZE(s3c2412_dma_mappings),
diff --git a/arch/arm/mach-s3c2412/gpio.c b/arch/arm/mach-s3c2412/gpio.c
new file mode 100644
index 000000000000..8e55c3a2eab8
--- /dev/null
+++ b/arch/arm/mach-s3c2412/gpio.c
@@ -0,0 +1,60 @@
1/* linux/arch/arm/mach-s3c2412/gpio.c
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * http://armlinux.simtec.co.uk/.
7 *
8 * S3C2412/S3C2413 specific GPIO support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/module.h>
18#include <linux/interrupt.h>
19
20#include <asm/mach/arch.h>
21#include <asm/mach/map.h>
22
23#include <asm/arch/regs-gpio.h>
24
25#include <asm/hardware.h>
26
27int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state)
28{
29 void __iomem *base = S3C24XX_GPIO_BASE(pin);
30 unsigned long offs = S3C2410_GPIO_OFFSET(pin);
31 unsigned long flags;
32 unsigned long slpcon;
33
34 offs *= 2;
35
36 if (pin < S3C2410_GPIO_BANKB)
37 return -EINVAL;
38
39 if (pin >= S3C2410_GPIO_BANKF &&
40 pin <= S3C2410_GPIO_BANKG)
41 return -EINVAL;
42
43 if (pin > (S3C2410_GPIO_BANKH + 32))
44 return -EINVAL;
45
46 local_irq_save(flags);
47
48 slpcon = __raw_readl(base + 0x0C);
49
50 slpcon &= ~(3 << offs);
51 slpcon |= state << offs;
52
53 __raw_writel(slpcon, base + 0x0C);
54
55 local_irq_restore(flags);
56
57 return 0;
58}
59
60EXPORT_SYMBOL(s3c2412_gpio_set_sleepcfg);
diff --git a/arch/arm/mach-s3c2412/irq.c b/arch/arm/mach-s3c2412/irq.c
index e9d0c769f5da..cc1917bf952a 100644
--- a/arch/arm/mach-s3c2412/irq.c
+++ b/arch/arm/mach-s3c2412/irq.c
@@ -33,6 +33,7 @@
33 33
34#include <asm/arch/regs-irq.h> 34#include <asm/arch/regs-irq.h>
35#include <asm/arch/regs-gpio.h> 35#include <asm/arch/regs-gpio.h>
36#include <asm/arch/regs-power.h>
36 37
37#include <asm/plat-s3c24xx/cpu.h> 38#include <asm/plat-s3c24xx/cpu.h>
38#include <asm/plat-s3c24xx/irq.h> 39#include <asm/plat-s3c24xx/irq.h>
@@ -153,6 +154,22 @@ static struct irq_chip s3c2412_irq_cfsdi = {
153 .unmask = s3c2412_irq_cfsdi_unmask, 154 .unmask = s3c2412_irq_cfsdi_unmask,
154}; 155};
155 156
157static int s3c2412_irq_rtc_wake(unsigned int irqno, unsigned int state)
158{
159 unsigned long pwrcfg;
160
161 pwrcfg = __raw_readl(S3C2412_PWRCFG);
162 if (state)
163 pwrcfg &= ~S3C2412_PWRCFG_RTC_MASKIRQ;
164 else
165 pwrcfg |= S3C2412_PWRCFG_RTC_MASKIRQ;
166 __raw_writel(pwrcfg, S3C2412_PWRCFG);
167
168 return s3c_irq_chip.set_wake(irqno, state);
169}
170
171static struct irq_chip s3c2412_irq_rtc_chip;
172
156static int s3c2412_irq_add(struct sys_device *sysdev) 173static int s3c2412_irq_add(struct sys_device *sysdev)
157{ 174{
158 unsigned int irqno; 175 unsigned int irqno;
@@ -173,6 +190,13 @@ static int s3c2412_irq_add(struct sys_device *sysdev)
173 set_irq_flags(irqno, IRQF_VALID); 190 set_irq_flags(irqno, IRQF_VALID);
174 } 191 }
175 192
193 /* change RTC IRQ's set wake method */
194
195 s3c2412_irq_rtc_chip = s3c_irq_chip;
196 s3c2412_irq_rtc_chip.set_wake = s3c2412_irq_rtc_wake;
197
198 set_irq_chip(IRQ_RTC, &s3c2412_irq_rtc_chip);
199
176 return 0; 200 return 0;
177} 201}
178 202
diff --git a/arch/arm/mach-s3c2412/pm.c b/arch/arm/mach-s3c2412/pm.c
index 8988dac388a9..d4ffb2d98076 100644
--- a/arch/arm/mach-s3c2412/pm.c
+++ b/arch/arm/mach-s3c2412/pm.c
@@ -33,6 +33,8 @@
33 33
34#include <asm/plat-s3c24xx/s3c2412.h> 34#include <asm/plat-s3c24xx/s3c2412.h>
35 35
36extern void s3c2412_sleep_enter(void);
37
36static void s3c2412_cpu_suspend(void) 38static void s3c2412_cpu_suspend(void)
37{ 39{
38 unsigned long tmp; 40 unsigned long tmp;
@@ -43,20 +45,7 @@ static void s3c2412_cpu_suspend(void)
43 tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP; 45 tmp |= S3C2412_PWRCFG_STANDBYWFI_SLEEP;
44 __raw_writel(tmp, S3C2412_PWRCFG); 46 __raw_writel(tmp, S3C2412_PWRCFG);
45 47
46 /* issue the standby signal into the pm unit. Note, we 48 s3c2412_sleep_enter();
47 * issue a write-buffer drain just in case */
48
49 tmp = 0;
50
51 asm("b 1f\n\t"
52 ".align 5\n\t"
53 "1:\n\t"
54 "mcr p15, 0, %0, c7, c10, 4\n\t"
55 "mcr p15, 0, %0, c7, c0, 4" :: "r" (tmp));
56
57 /* we should never get past here */
58
59 panic("sleep resumed to originator?");
60} 49}
61 50
62static void s3c2412_pm_prepare(void) 51static void s3c2412_pm_prepare(void)
@@ -88,7 +77,6 @@ static struct sleep_save s3c2412_sleep[] = {
88 SAVE_ITEM(S3C2412_GPBSLPCON), 77 SAVE_ITEM(S3C2412_GPBSLPCON),
89 SAVE_ITEM(S3C2412_GPCSLPCON), 78 SAVE_ITEM(S3C2412_GPCSLPCON),
90 SAVE_ITEM(S3C2412_GPDSLPCON), 79 SAVE_ITEM(S3C2412_GPDSLPCON),
91 SAVE_ITEM(S3C2412_GPESLPCON),
92 SAVE_ITEM(S3C2412_GPFSLPCON), 80 SAVE_ITEM(S3C2412_GPFSLPCON),
93 SAVE_ITEM(S3C2412_GPGSLPCON), 81 SAVE_ITEM(S3C2412_GPGSLPCON),
94 SAVE_ITEM(S3C2412_GPHSLPCON), 82 SAVE_ITEM(S3C2412_GPHSLPCON),
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 265cd3f567a3..abf1599c9f97 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -168,6 +168,8 @@ void __init s3c2412_init_clocks(int xtal)
168 168
169 fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal*2); 169 fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal*2);
170 170
171 clk_mpll.rate = fclk;
172
171 tmp = __raw_readl(S3C2410_CLKDIVN); 173 tmp = __raw_readl(S3C2410_CLKDIVN);
172 174
173 /* work out clock scalings */ 175 /* work out clock scalings */
diff --git a/arch/arm/mach-s3c2412/sleep.S b/arch/arm/mach-s3c2412/sleep.S
new file mode 100644
index 000000000000..db32cac4199a
--- /dev/null
+++ b/arch/arm/mach-s3c2412/sleep.S
@@ -0,0 +1,68 @@
1/* linux/arch/arm/mach-s3c2412/sleep.S
2 *
3 * Copyright (c) 2007 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * S3C2412 Power Manager low-level sleep support
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21*/
22
23#include <linux/linkage.h>
24#include <asm/assembler.h>
25#include <asm/hardware.h>
26#include <asm/arch/map.h>
27
28#include <asm/arch/regs-irq.h>
29
30 .text
31
32 .global s3c2412_sleep_enter
33
34s3c2412_sleep_enter:
35 mov r0, #0 /* argument for coprocessors */
36 ldr r1, =S3C2410_INTPND
37 ldr r2, =S3C2410_SRCPND
38 ldr r3, =S3C2410_EINTPEND
39
40 teq r0, r0
41 bl s3c2412_sleep_enter1
42 teq pc, r0
43 bl s3c2412_sleep_enter1
44
45 .align 5
46
47 /* this is called twice, first with the Z flag to ensure that the
48 * instructions have been loaded into the cache, and the second
49 * time to try and suspend the system.
50 */
51s3c2412_sleep_enter1:
52 mcr p15, 0, r0, c7, c10, 4
53 mcrne p15, 0, r0, c7, c0, 4
54
55 /* if we return from here, it is because an interrupt was
56 * active when we tried to shutdown. Try and ack the IRQ and
57 * retry, as simply returning causes the system to lock.
58 */
59
60 ldrne r9, [ r1 ]
61 strne r9, [ r1 ]
62 ldrne r9, [ r2 ]
63 strne r9, [ r2 ]
64 ldrne r9, [ r3 ]
65 strne r9, [ r3 ]
66 bne s3c2412_sleep_enter1
67
68 mov pc, r14
diff --git a/arch/arm/mach-s3c2440/clock.c b/arch/arm/mach-s3c2440/clock.c
index 79e2ea4adaf3..184d804934c9 100644
--- a/arch/arm/mach-s3c2440/clock.c
+++ b/arch/arm/mach-s3c2440/clock.c
@@ -111,14 +111,9 @@ static struct clk s3c2440_clk_ac97 = {
111 111
112static int s3c2440_clk_add(struct sys_device *sysdev) 112static int s3c2440_clk_add(struct sys_device *sysdev)
113{ 113{
114 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); 114 struct clk *clock_upll;
115 unsigned long clkdivn;
116 struct clk *clock_h; 115 struct clk *clock_h;
117 struct clk *clock_p; 116 struct clk *clock_p;
118 struct clk *clock_upll;
119
120 printk("S3C2440: Clock Support, DVS %s\n",
121 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
122 117
123 clock_p = clk_get(NULL, "pclk"); 118 clock_p = clk_get(NULL, "pclk");
124 clock_h = clk_get(NULL, "hclk"); 119 clock_h = clk_get(NULL, "hclk");
@@ -129,21 +124,6 @@ static int s3c2440_clk_add(struct sys_device *sysdev)
129 return -EINVAL; 124 return -EINVAL;
130 } 125 }
131 126
132 /* check rate of UPLL, and if it is near 96MHz, then change
133 * to using half the UPLL rate for the system */
134
135 if (clk_get_rate(clock_upll) > (94 * MHZ)) {
136 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
137
138 mutex_lock(&clocks_mutex);
139
140 clkdivn = __raw_readl(S3C2410_CLKDIVN);
141 clkdivn |= S3C2440_CLKDIVN_UCLK;
142 __raw_writel(clkdivn, S3C2410_CLKDIVN);
143
144 mutex_unlock(&clocks_mutex);
145 }
146
147 s3c2440_clk_cam.parent = clock_h; 127 s3c2440_clk_cam.parent = clock_h;
148 s3c2440_clk_ac97.parent = clock_p; 128 s3c2440_clk_ac97.parent = clock_p;
149 s3c2440_clk_cam_upll.parent = clock_upll; 129 s3c2440_clk_cam_upll.parent = clock_upll;
diff --git a/arch/arm/mach-s3c2442/clock.c b/arch/arm/mach-s3c2442/clock.c
index 5b9e830ac4d3..2d030d439fe9 100644
--- a/arch/arm/mach-s3c2442/clock.c
+++ b/arch/arm/mach-s3c2442/clock.c
@@ -115,14 +115,9 @@ static struct clk s3c2442_clk_cam_upll = {
115 115
116static int s3c2442_clk_add(struct sys_device *sysdev) 116static int s3c2442_clk_add(struct sys_device *sysdev)
117{ 117{
118 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); 118 struct clk *clock_upll;
119 unsigned long clkdivn;
120 struct clk *clock_h; 119 struct clk *clock_h;
121 struct clk *clock_p; 120 struct clk *clock_p;
122 struct clk *clock_upll;
123
124 printk("S3C2442: Clock Support, DVS %s\n",
125 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
126 121
127 clock_p = clk_get(NULL, "pclk"); 122 clock_p = clk_get(NULL, "pclk");
128 clock_h = clk_get(NULL, "hclk"); 123 clock_h = clk_get(NULL, "hclk");
@@ -133,21 +128,6 @@ static int s3c2442_clk_add(struct sys_device *sysdev)
133 return -EINVAL; 128 return -EINVAL;
134 } 129 }
135 130
136 /* check rate of UPLL, and if it is near 96MHz, then change
137 * to using half the UPLL rate for the system */
138
139 if (clk_get_rate(clock_upll) > (94 * MHZ)) {
140 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
141
142 mutex_lock(&clocks_mutex);
143
144 clkdivn = __raw_readl(S3C2410_CLKDIVN);
145 clkdivn |= S3C2440_CLKDIVN_UCLK;
146 __raw_writel(clkdivn, S3C2410_CLKDIVN);
147
148 mutex_unlock(&clocks_mutex);
149 }
150
151 s3c2442_clk_cam.parent = clock_h; 131 s3c2442_clk_cam.parent = clock_h;
152 s3c2442_clk_cam_upll.parent = clock_upll; 132 s3c2442_clk_cam_upll.parent = clock_upll;
153 133
diff --git a/arch/arm/mach-sa1100/ssp.c b/arch/arm/mach-sa1100/ssp.c
index 59703c6fb29b..06206ceb312e 100644
--- a/arch/arm/mach-sa1100/ssp.c
+++ b/arch/arm/mach-sa1100/ssp.c
@@ -29,9 +29,8 @@ static irqreturn_t ssp_interrupt(int irq, void *dev_id)
29{ 29{
30 unsigned int status = Ser4SSSR; 30 unsigned int status = Ser4SSSR;
31 31
32 if (status & SSSR_ROR) { 32 if (status & SSSR_ROR)
33 printk(KERN_WARNING "SSP: receiver overrun\n"); 33 printk(KERN_WARNING "SSP: receiver overrun\n");
34 }
35 34
36 Ser4SSSR = SSSR_ROR; 35 Ser4SSSR = SSSR_ROR;
37 36
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index fdf7b016e7ad..c2677368d6af 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -14,6 +14,7 @@
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <linux/timex.h> 15#include <linux/timex.h>
16#include <linux/signal.h> 16#include <linux/signal.h>
17#include <linux/clocksource.h>
17 18
18#include <asm/mach/time.h> 19#include <asm/mach/time.h>
19#include <asm/hardware.h> 20#include <asm/hardware.h>
@@ -35,23 +36,6 @@ static int sa1100_set_rtc(void)
35 return 0; 36 return 0;
36} 37}
37 38
38/* IRQs are disabled before entering here from do_gettimeofday() */
39static unsigned long sa1100_gettimeoffset (void)
40{
41 unsigned long ticks_to_match, elapsed, usec;
42
43 /* Get ticks before next timer match */
44 ticks_to_match = OSMR0 - OSCR;
45
46 /* We need elapsed ticks since last match */
47 elapsed = LATCH - ticks_to_match;
48
49 /* Now convert them to usec */
50 usec = (unsigned long)(elapsed * (tick_nsec / 1000))/LATCH;
51
52 return usec;
53}
54
55#ifdef CONFIG_NO_IDLE_HZ 39#ifdef CONFIG_NO_IDLE_HZ
56static unsigned long initial_match; 40static unsigned long initial_match;
57static int match_posponed; 41static int match_posponed;
@@ -62,8 +46,6 @@ sa1100_timer_interrupt(int irq, void *dev_id)
62{ 46{
63 unsigned int next_match; 47 unsigned int next_match;
64 48
65 write_seqlock(&xtime_lock);
66
67#ifdef CONFIG_NO_IDLE_HZ 49#ifdef CONFIG_NO_IDLE_HZ
68 if (match_posponed) { 50 if (match_posponed) {
69 match_posponed = 0; 51 match_posponed = 0;
@@ -85,8 +67,6 @@ sa1100_timer_interrupt(int irq, void *dev_id)
85 next_match = (OSMR0 += LATCH); 67 next_match = (OSMR0 += LATCH);
86 } while ((signed long)(next_match - OSCR) <= 0); 68 } while ((signed long)(next_match - OSCR) <= 0);
87 69
88 write_sequnlock(&xtime_lock);
89
90 return IRQ_HANDLED; 70 return IRQ_HANDLED;
91} 71}
92 72
@@ -96,6 +76,20 @@ static struct irqaction sa1100_timer_irq = {
96 .handler = sa1100_timer_interrupt, 76 .handler = sa1100_timer_interrupt,
97}; 77};
98 78
79static cycle_t sa1100_read_oscr(void)
80{
81 return OSCR;
82}
83
84static struct clocksource cksrc_sa1100_oscr = {
85 .name = "oscr",
86 .rating = 200,
87 .read = sa1100_read_oscr,
88 .mask = CLOCKSOURCE_MASK(32),
89 .shift = 20,
90 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
91};
92
99static void __init sa1100_timer_init(void) 93static void __init sa1100_timer_init(void)
100{ 94{
101 unsigned long flags; 95 unsigned long flags;
@@ -109,6 +103,11 @@ static void __init sa1100_timer_init(void)
109 OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */ 103 OIER = OIER_E0; /* enable match on timer 0 to cause interrupts */
110 OSMR0 = OSCR + LATCH; /* set initial match */ 104 OSMR0 = OSCR + LATCH; /* set initial match */
111 local_irq_restore(flags); 105 local_irq_restore(flags);
106
107 cksrc_sa1100_oscr.mult =
108 clocksource_hz2mult(CLOCK_TICK_RATE, cksrc_sa1100_oscr.shift);
109
110 clocksource_register(&cksrc_sa1100_oscr);
112} 111}
113 112
114#ifdef CONFIG_NO_IDLE_HZ 113#ifdef CONFIG_NO_IDLE_HZ
@@ -182,7 +181,6 @@ struct sys_timer sa1100_timer = {
182 .init = sa1100_timer_init, 181 .init = sa1100_timer_init,
183 .suspend = sa1100_timer_suspend, 182 .suspend = sa1100_timer_suspend,
184 .resume = sa1100_timer_resume, 183 .resume = sa1100_timer_resume,
185 .offset = sa1100_gettimeoffset,
186#ifdef CONFIG_NO_IDLE_HZ 184#ifdef CONFIG_NO_IDLE_HZ
187 .dyn_tick = &sa1100_dyn_tick, 185 .dyn_tick = &sa1100_dyn_tick,
188#endif 186#endif
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index a0545db2a34f..09d9f33d4072 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -82,9 +82,7 @@ static void __init shark_map_io(void)
82static irqreturn_t 82static irqreturn_t
83shark_timer_interrupt(int irq, void *dev_id) 83shark_timer_interrupt(int irq, void *dev_id)
84{ 84{
85 write_seqlock(&xtime_lock);
86 timer_tick(); 85 timer_tick();
87 write_sequnlock(&xtime_lock);
88 return IRQ_HANDLED; 86 return IRQ_HANDLED;
89} 87}
90 88
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 7868f4dc1d00..cb104c2a7329 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -171,8 +171,8 @@ config CPU_ARM925T
171# ARM926T 171# ARM926T
172config CPU_ARM926T 172config CPU_ARM926T
173 bool "Support ARM926T processor" 173 bool "Support ARM926T processor"
174 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_NS9XXX || ARCH_DAVINCI 174 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI
175 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_NS9XXX || ARCH_DAVINCI 175 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX || CPU_S3C2412 || ARCH_AT91SAM9260 || ARCH_AT91SAM9261 || ARCH_AT91SAM9263 || ARCH_AT91SAM9RL || ARCH_AT91CAP9 || ARCH_NS9XXX || ARCH_DAVINCI
176 select CPU_32v5 176 select CPU_32v5
177 select CPU_ABRT_EV5TJ 177 select CPU_ABRT_EV5TJ
178 select CPU_CACHE_VIVT 178 select CPU_CACHE_VIVT
@@ -345,8 +345,9 @@ config CPU_XSC3
345# ARMv6 345# ARMv6
346config CPU_V6 346config CPU_V6
347 bool "Support ARM V6 processor" 347 bool "Support ARM V6 processor"
348 depends on ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_OMAP2 || ARCH_MX3 348 depends on ARCH_INTEGRATOR || MACH_REALVIEW_EB || ARCH_OMAP2 || ARCH_MX3 || ARCH_MSM7X00A
349 default y if ARCH_MX3 349 default y if ARCH_MX3
350 default y if ARCH_MSM7X00A
350 select CPU_32v6 351 select CPU_32v6
351 select CPU_ABRT_EV6 352 select CPU_ABRT_EV6
352 select CPU_CACHE_V6 353 select CPU_CACHE_V6
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index a8a7dab757eb..28ad7ab1c0cd 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -12,6 +12,7 @@
12#include <linux/signal.h> 12#include <linux/signal.h>
13#include <linux/mm.h> 13#include <linux/mm.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kprobes.h>
15 16
16#include <asm/system.h> 17#include <asm/system.h>
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
@@ -20,6 +21,29 @@
20 21
21#include "fault.h" 22#include "fault.h"
22 23
24
25#ifdef CONFIG_KPROBES
26static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
27{
28 int ret = 0;
29
30 if (!user_mode(regs)) {
31 /* kprobe_running() needs smp_processor_id() */
32 preempt_disable();
33 if (kprobe_running() && kprobe_fault_handler(regs, fsr))
34 ret = 1;
35 preempt_enable();
36 }
37
38 return ret;
39}
40#else
41static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr)
42{
43 return 0;
44}
45#endif
46
23/* 47/*
24 * This is useful to dump out the page tables associated with 48 * This is useful to dump out the page tables associated with
25 * 'addr' in mm 'mm'. 49 * 'addr' in mm 'mm'.
@@ -215,13 +239,16 @@ out:
215 return fault; 239 return fault;
216} 240}
217 241
218static int 242static int __kprobes
219do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs) 243do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
220{ 244{
221 struct task_struct *tsk; 245 struct task_struct *tsk;
222 struct mm_struct *mm; 246 struct mm_struct *mm;
223 int fault, sig, code; 247 int fault, sig, code;
224 248
249 if (notify_page_fault(regs, fsr))
250 return 0;
251
225 tsk = current; 252 tsk = current;
226 mm = tsk->mm; 253 mm = tsk->mm;
227 254
@@ -311,7 +338,7 @@ no_context:
311 * interrupt or a critical region, and should only copy the information 338 * interrupt or a critical region, and should only copy the information
312 * from the master page table, nothing more. 339 * from the master page table, nothing more.
313 */ 340 */
314static int 341static int __kprobes
315do_translation_fault(unsigned long addr, unsigned int fsr, 342do_translation_fault(unsigned long addr, unsigned int fsr,
316 struct pt_regs *regs) 343 struct pt_regs *regs)
317{ 344{
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 0360b1f14d11..45a77df668f1 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -212,7 +212,7 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
212 212
213static irqreturn_t mbox_interrupt(int irq, void *p) 213static irqreturn_t mbox_interrupt(int irq, void *p)
214{ 214{
215 struct omap_mbox *mbox = (struct omap_mbox *)p; 215 struct omap_mbox *mbox = p;
216 216
217 if (is_mbox_irq(mbox, IRQ_TX)) 217 if (is_mbox_irq(mbox, IRQ_TX))
218 __mbox_tx_interrupt(mbox); 218 __mbox_tx_interrupt(mbox);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index f7b9ccdaacbc..2af5bd5a1344 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -98,9 +98,10 @@ static void omap_mcbsp_dump_reg(u8 id)
98 98
99static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id) 99static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id)
100{ 100{
101 struct omap_mcbsp * mcbsp_tx = (struct omap_mcbsp *)(dev_id); 101 struct omap_mcbsp *mcbsp_tx = dev_id;
102 102
103 DBG("TX IRQ callback : 0x%x\n", OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2)); 103 DBG("TX IRQ callback : 0x%x\n",
104 OMAP_MCBSP_READ(mcbsp_tx->io_base, SPCR2));
104 105
105 complete(&mcbsp_tx->tx_irq_completion); 106 complete(&mcbsp_tx->tx_irq_completion);
106 return IRQ_HANDLED; 107 return IRQ_HANDLED;
@@ -108,9 +109,10 @@ static irqreturn_t omap_mcbsp_tx_irq_handler(int irq, void *dev_id)
108 109
109static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id) 110static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
110{ 111{
111 struct omap_mcbsp * mcbsp_rx = (struct omap_mcbsp *)(dev_id); 112 struct omap_mcbsp *mcbsp_rx = dev_id;
112 113
113 DBG("RX IRQ callback : 0x%x\n", OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR2)); 114 DBG("RX IRQ callback : 0x%x\n",
115 OMAP_MCBSP_READ(mcbsp_rx->io_base, SPCR2));
114 116
115 complete(&mcbsp_rx->rx_irq_completion); 117 complete(&mcbsp_rx->rx_irq_completion);
116 return IRQ_HANDLED; 118 return IRQ_HANDLED;
@@ -118,9 +120,10 @@ static irqreturn_t omap_mcbsp_rx_irq_handler(int irq, void *dev_id)
118 120
119static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data) 121static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data)
120{ 122{
121 struct omap_mcbsp * mcbsp_dma_tx = (struct omap_mcbsp *)(data); 123 struct omap_mcbsp *mcbsp_dma_tx = data;
122 124
123 DBG("TX DMA callback : 0x%x\n", OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2)); 125 DBG("TX DMA callback : 0x%x\n",
126 OMAP_MCBSP_READ(mcbsp_dma_tx->io_base, SPCR2));
124 127
125 /* We can free the channels */ 128 /* We can free the channels */
126 omap_free_dma(mcbsp_dma_tx->dma_tx_lch); 129 omap_free_dma(mcbsp_dma_tx->dma_tx_lch);
@@ -131,9 +134,10 @@ static void omap_mcbsp_tx_dma_callback(int lch, u16 ch_status, void *data)
131 134
132static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data) 135static void omap_mcbsp_rx_dma_callback(int lch, u16 ch_status, void *data)
133{ 136{
134 struct omap_mcbsp * mcbsp_dma_rx = (struct omap_mcbsp *)(data); 137 struct omap_mcbsp *mcbsp_dma_rx = data;
135 138
136 DBG("RX DMA callback : 0x%x\n", OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2)); 139 DBG("RX DMA callback : 0x%x\n",
140 OMAP_MCBSP_READ(mcbsp_dma_rx->io_base, SPCR2));
137 141
138 /* We can free the channels */ 142 /* We can free the channels */
139 omap_free_dma(mcbsp_dma_rx->dma_rx_lch); 143 omap_free_dma(mcbsp_dma_rx->dma_rx_lch);
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile
index 8e5ccaa1f03c..131d20237dd7 100644
--- a/arch/arm/plat-s3c24xx/Makefile
+++ b/arch/arm/plat-s3c24xx/Makefile
@@ -23,6 +23,7 @@ obj-y += clock.o
23 23
24obj-$(CONFIG_CPU_S3C244X) += s3c244x.o 24obj-$(CONFIG_CPU_S3C244X) += s3c244x.o
25obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o 25obj-$(CONFIG_CPU_S3C244X) += s3c244x-irq.o
26obj-$(CONFIG_CPU_S3C244X) += s3c244x-clock.o
26obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o 27obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
27obj-$(CONFIG_PM) += pm.o 28obj-$(CONFIG_PM) += pm.o
28obj-$(CONFIG_PM) += sleep.o 29obj-$(CONFIG_PM) += sleep.o
diff --git a/arch/arm/plat-s3c24xx/clock.c b/arch/arm/plat-s3c24xx/clock.c
index 79cda0faec86..99a44746f8f2 100644
--- a/arch/arm/plat-s3c24xx/clock.c
+++ b/arch/arm/plat-s3c24xx/clock.c
@@ -172,6 +172,15 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
172 if (IS_ERR(clk)) 172 if (IS_ERR(clk))
173 return -EINVAL; 173 return -EINVAL;
174 174
175 /* We do not default just do a clk->rate = rate as
176 * the clock may have been made this way by choice.
177 */
178
179 WARN_ON(clk->set_rate == NULL);
180
181 if (clk->set_rate == NULL)
182 return -EINVAL;
183
175 mutex_lock(&clocks_mutex); 184 mutex_lock(&clocks_mutex);
176 ret = (clk->set_rate)(clk, rate); 185 ret = (clk->set_rate)(clk, rate);
177 mutex_unlock(&clocks_mutex); 186 mutex_unlock(&clocks_mutex);
@@ -213,6 +222,12 @@ EXPORT_SYMBOL(clk_set_parent);
213 222
214/* base clocks */ 223/* base clocks */
215 224
225static int clk_default_setrate(struct clk *clk, unsigned long rate)
226{
227 clk->rate = rate;
228 return 0;
229}
230
216struct clk clk_xtal = { 231struct clk clk_xtal = {
217 .name = "xtal", 232 .name = "xtal",
218 .id = -1, 233 .id = -1,
@@ -224,6 +239,7 @@ struct clk clk_xtal = {
224struct clk clk_mpll = { 239struct clk clk_mpll = {
225 .name = "mpll", 240 .name = "mpll",
226 .id = -1, 241 .id = -1,
242 .set_rate = clk_default_setrate,
227}; 243};
228 244
229struct clk clk_upll = { 245struct clk clk_upll = {
@@ -239,6 +255,7 @@ struct clk clk_f = {
239 .rate = 0, 255 .rate = 0,
240 .parent = &clk_mpll, 256 .parent = &clk_mpll,
241 .ctrlbit = 0, 257 .ctrlbit = 0,
258 .set_rate = clk_default_setrate,
242}; 259};
243 260
244struct clk clk_h = { 261struct clk clk_h = {
@@ -247,6 +264,7 @@ struct clk clk_h = {
247 .rate = 0, 264 .rate = 0,
248 .parent = NULL, 265 .parent = NULL,
249 .ctrlbit = 0, 266 .ctrlbit = 0,
267 .set_rate = clk_default_setrate,
250}; 268};
251 269
252struct clk clk_p = { 270struct clk clk_p = {
@@ -255,6 +273,7 @@ struct clk clk_p = {
255 .rate = 0, 273 .rate = 0,
256 .parent = NULL, 274 .parent = NULL,
257 .ctrlbit = 0, 275 .ctrlbit = 0,
276 .set_rate = clk_default_setrate,
258}; 277};
259 278
260struct clk clk_usb_bus = { 279struct clk clk_usb_bus = {
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index aae1b9cbaf44..ac9ff1666fcc 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -525,7 +525,8 @@ int s3c2410_dma_enqueue(unsigned int channel, void *id,
525 } 525 }
526 } else if (chan->state == S3C2410_DMA_IDLE) { 526 } else if (chan->state == S3C2410_DMA_IDLE) {
527 if (chan->flags & S3C2410_DMAF_AUTOSTART) { 527 if (chan->flags & S3C2410_DMAF_AUTOSTART) {
528 s3c2410_dma_ctrl(chan->number, S3C2410_DMAOP_START); 528 s3c2410_dma_ctrl(chan->number | DMACH_LOW_LEVEL,
529 S3C2410_DMAOP_START);
529 } 530 }
530 } 531 }
531 532
@@ -787,7 +788,7 @@ int s3c2410_dma_request(unsigned int channel,
787 788
788 pr_debug("%s: channel initialised, %p\n", __FUNCTION__, chan); 789 pr_debug("%s: channel initialised, %p\n", __FUNCTION__, chan);
789 790
790 return 0; 791 return chan->number | DMACH_LOW_LEVEL;
791} 792}
792 793
793EXPORT_SYMBOL(s3c2410_dma_request); 794EXPORT_SYMBOL(s3c2410_dma_request);
@@ -1173,6 +1174,7 @@ int s3c2410_dma_devconfig(int channel,
1173 1174
1174 chan->source = source; 1175 chan->source = source;
1175 chan->dev_addr = devaddr; 1176 chan->dev_addr = devaddr;
1177 chan->hw_cfg = hwcfg;
1176 1178
1177 switch (source) { 1179 switch (source) {
1178 case S3C2410_DMASRC_HW: 1180 case S3C2410_DMASRC_HW:
@@ -1184,7 +1186,7 @@ int s3c2410_dma_devconfig(int channel,
1184 dma_wrreg(chan, S3C2410_DMA_DIDSTC, (0<<1) | (0<<0)); 1186 dma_wrreg(chan, S3C2410_DMA_DIDSTC, (0<<1) | (0<<0));
1185 1187
1186 chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DIDST); 1188 chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DIDST);
1187 return 0; 1189 break;
1188 1190
1189 case S3C2410_DMASRC_MEM: 1191 case S3C2410_DMASRC_MEM:
1190 /* source is memory */ 1192 /* source is memory */
@@ -1195,11 +1197,19 @@ int s3c2410_dma_devconfig(int channel,
1195 dma_wrreg(chan, S3C2410_DMA_DIDSTC, hwcfg & 3); 1197 dma_wrreg(chan, S3C2410_DMA_DIDSTC, hwcfg & 3);
1196 1198
1197 chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DISRC); 1199 chan->addr_reg = dma_regaddr(chan, S3C2410_DMA_DISRC);
1198 return 0; 1200 break;
1201
1202 default:
1203 printk(KERN_ERR "dma%d: invalid source type (%d)\n",
1204 channel, source);
1205
1206 return -EINVAL;
1199 } 1207 }
1200 1208
1201 printk(KERN_ERR "dma%d: invalid source type (%d)\n", channel, source); 1209 if (dma_sel.direction != NULL)
1202 return -EINVAL; 1210 (dma_sel.direction)(chan, chan->map, source);
1211
1212 return 0;
1203} 1213}
1204 1214
1205EXPORT_SYMBOL(s3c2410_dma_devconfig); 1215EXPORT_SYMBOL(s3c2410_dma_devconfig);
@@ -1227,6 +1237,10 @@ int s3c2410_dma_getposition(dmach_t channel, dma_addr_t *src, dma_addr_t *dst)
1227 1237
1228EXPORT_SYMBOL(s3c2410_dma_getposition); 1238EXPORT_SYMBOL(s3c2410_dma_getposition);
1229 1239
1240static struct s3c2410_dma_chan *to_dma_chan(struct sys_device *dev)
1241{
1242 return container_of(dev, struct s3c2410_dma_chan, dev);
1243}
1230 1244
1231/* system device class */ 1245/* system device class */
1232 1246
@@ -1234,7 +1248,7 @@ EXPORT_SYMBOL(s3c2410_dma_getposition);
1234 1248
1235static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state) 1249static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state)
1236{ 1250{
1237 struct s3c2410_dma_chan *cp = container_of(dev, struct s3c2410_dma_chan, dev); 1251 struct s3c2410_dma_chan *cp = to_dma_chan(dev);
1238 1252
1239 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number); 1253 printk(KERN_DEBUG "suspending dma channel %d\n", cp->number);
1240 1254
@@ -1256,6 +1270,24 @@ static int s3c2410_dma_suspend(struct sys_device *dev, pm_message_t state)
1256 1270
1257static int s3c2410_dma_resume(struct sys_device *dev) 1271static int s3c2410_dma_resume(struct sys_device *dev)
1258{ 1272{
1273 struct s3c2410_dma_chan *cp = to_dma_chan(dev);
1274 unsigned int no = cp->number | DMACH_LOW_LEVEL;
1275
1276 /* restore channel's hardware configuration */
1277
1278 if (!cp->in_use)
1279 return 0;
1280
1281 printk(KERN_INFO "dma%d: restoring configuration\n", cp->number);
1282
1283 s3c2410_dma_config(no, cp->xfer_unit, cp->dcon);
1284 s3c2410_dma_devconfig(no, cp->source, cp->hw_cfg, cp->dev_addr);
1285
1286 /* re-select the dma source for this channel */
1287
1288 if (cp->map != NULL)
1289 dma_sel.select(cp, cp->map);
1290
1259 return 0; 1291 return 0;
1260} 1292}
1261 1293
@@ -1445,6 +1477,7 @@ static struct s3c2410_dma_chan *s3c2410_dma_map_channel(int channel)
1445 1477
1446 found: 1478 found:
1447 dmach = &s3c2410_chans[ch]; 1479 dmach = &s3c2410_chans[ch];
1480 dmach->map = ch_map;
1448 dma_chan_map[channel] = dmach; 1481 dma_chan_map[channel] = dmach;
1449 1482
1450 /* select the channel */ 1483 /* select the channel */
diff --git a/arch/arm/plat-s3c24xx/gpio.c b/arch/arm/plat-s3c24xx/gpio.c
index ec3a09c4d181..ee99dcc7f0bd 100644
--- a/arch/arm/plat-s3c24xx/gpio.c
+++ b/arch/arm/plat-s3c24xx/gpio.c
@@ -122,6 +122,19 @@ void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
122 122
123EXPORT_SYMBOL(s3c2410_gpio_pullup); 123EXPORT_SYMBOL(s3c2410_gpio_pullup);
124 124
125int s3c2410_gpio_getpull(unsigned int pin)
126{
127 void __iomem *base = S3C24XX_GPIO_BASE(pin);
128 unsigned long offs = S3C2410_GPIO_OFFSET(pin);
129
130 if (pin < S3C2410_GPIO_BANKB)
131 return -EINVAL;
132
133 return (__raw_readl(base + 0x08) & (1L << offs)) ? 1 : 0;
134}
135
136EXPORT_SYMBOL(s3c2410_gpio_getpull);
137
125void s3c2410_gpio_setpin(unsigned int pin, unsigned int to) 138void s3c2410_gpio_setpin(unsigned int pin, unsigned int to)
126{ 139{
127 void __iomem *base = S3C24XX_GPIO_BASE(pin); 140 void __iomem *base = S3C24XX_GPIO_BASE(pin);
@@ -186,3 +199,19 @@ int s3c2410_gpio_getirq(unsigned int pin)
186} 199}
187 200
188EXPORT_SYMBOL(s3c2410_gpio_getirq); 201EXPORT_SYMBOL(s3c2410_gpio_getirq);
202
203int s3c2410_gpio_irq2pin(unsigned int irq)
204{
205 if (irq >= IRQ_EINT0 && irq <= IRQ_EINT3)
206 return S3C2410_GPF0 + (irq - IRQ_EINT0);
207
208 if (irq >= IRQ_EINT4 && irq <= IRQ_EINT7)
209 return S3C2410_GPF4 + (irq - IRQ_EINT4);
210
211 if (irq >= IRQ_EINT8 && irq <= IRQ_EINT23)
212 return S3C2410_GPG0 + (irq - IRQ_EINT8);
213
214 return -EINVAL;
215}
216
217EXPORT_SYMBOL(s3c2410_gpio_irq2pin);
diff --git a/arch/arm/plat-s3c24xx/irq.c b/arch/arm/plat-s3c24xx/irq.c
index 8fbc88470261..d486f5112569 100644
--- a/arch/arm/plat-s3c24xx/irq.c
+++ b/arch/arm/plat-s3c24xx/irq.c
@@ -187,7 +187,7 @@ struct irq_chip s3c_irq_level_chip = {
187 .set_wake = s3c_irq_wake 187 .set_wake = s3c_irq_wake
188}; 188};
189 189
190static struct irq_chip s3c_irq_chip = { 190struct irq_chip s3c_irq_chip = {
191 .name = "s3c", 191 .name = "s3c",
192 .ack = s3c_irq_ack, 192 .ack = s3c_irq_ack,
193 .mask = s3c_irq_mask, 193 .mask = s3c_irq_mask,
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index 4fdb3117744f..bf5581a9aeea 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -83,38 +83,39 @@ static struct sleep_save core_save[] = {
83 SAVE_ITEM(S3C2410_REFRESH), 83 SAVE_ITEM(S3C2410_REFRESH),
84}; 84};
85 85
86static struct sleep_save gpio_save[] = { 86static struct gpio_sleep {
87 SAVE_ITEM(S3C2410_GPACON), 87 void __iomem *base;
88 SAVE_ITEM(S3C2410_GPADAT), 88 unsigned int gpcon;
89 89 unsigned int gpdat;
90 SAVE_ITEM(S3C2410_GPBCON), 90 unsigned int gpup;
91 SAVE_ITEM(S3C2410_GPBDAT), 91} gpio_save[] = {
92 SAVE_ITEM(S3C2410_GPBUP), 92 [0] = {
93 93 .base = S3C2410_GPACON,
94 SAVE_ITEM(S3C2410_GPCCON), 94 },
95 SAVE_ITEM(S3C2410_GPCDAT), 95 [1] = {
96 SAVE_ITEM(S3C2410_GPCUP), 96 .base = S3C2410_GPBCON,
97 97 },
98 SAVE_ITEM(S3C2410_GPDCON), 98 [2] = {
99 SAVE_ITEM(S3C2410_GPDDAT), 99 .base = S3C2410_GPCCON,
100 SAVE_ITEM(S3C2410_GPDUP), 100 },
101 101 [3] = {
102 SAVE_ITEM(S3C2410_GPECON), 102 .base = S3C2410_GPDCON,
103 SAVE_ITEM(S3C2410_GPEDAT), 103 },
104 SAVE_ITEM(S3C2410_GPEUP), 104 [4] = {
105 105 .base = S3C2410_GPECON,
106 SAVE_ITEM(S3C2410_GPFCON), 106 },
107 SAVE_ITEM(S3C2410_GPFDAT), 107 [5] = {
108 SAVE_ITEM(S3C2410_GPFUP), 108 .base = S3C2410_GPFCON,
109 109 },
110 SAVE_ITEM(S3C2410_GPGCON), 110 [6] = {
111 SAVE_ITEM(S3C2410_GPGDAT), 111 .base = S3C2410_GPGCON,
112 SAVE_ITEM(S3C2410_GPGUP), 112 },
113 113 [7] = {
114 SAVE_ITEM(S3C2410_GPHCON), 114 .base = S3C2410_GPHCON,
115 SAVE_ITEM(S3C2410_GPHDAT), 115 },
116 SAVE_ITEM(S3C2410_GPHUP), 116};
117 117
118static struct sleep_save misc_save[] = {
118 SAVE_ITEM(S3C2410_DCLKCON), 119 SAVE_ITEM(S3C2410_DCLKCON),
119}; 120};
120 121
@@ -486,6 +487,184 @@ static void s3c2410_pm_configure_extint(void)
486 } 487 }
487} 488}
488 489
490/* offsets for CON/DAT/UP registers */
491
492#define OFFS_CON (S3C2410_GPACON - S3C2410_GPACON)
493#define OFFS_DAT (S3C2410_GPADAT - S3C2410_GPACON)
494#define OFFS_UP (S3C2410_GPBUP - S3C2410_GPBCON)
495
496/* s3c2410_pm_save_gpios()
497 *
498 * Save the state of the GPIOs
499 */
500
501static void s3c2410_pm_save_gpios(void)
502{
503 struct gpio_sleep *gps = gpio_save;
504 unsigned int gpio;
505
506 for (gpio = 0; gpio < ARRAY_SIZE(gpio_save); gpio++, gps++) {
507 void __iomem *base = gps->base;
508
509 gps->gpcon = __raw_readl(base + OFFS_CON);
510 gps->gpdat = __raw_readl(base + OFFS_DAT);
511
512 if (gpio > 0)
513 gps->gpup = __raw_readl(base + OFFS_UP);
514
515 }
516}
517
518/* Test whether the given masked+shifted bits of an GPIO configuration
519 * are one of the SFN (special function) modes. */
520
521static inline int is_sfn(unsigned long con)
522{
523 return (con == 2 || con == 3);
524}
525
526/* Test if the given masked+shifted GPIO configuration is an input */
527
528static inline int is_in(unsigned long con)
529{
530 return con == 0;
531}
532
533/* Test if the given masked+shifted GPIO configuration is an output */
534
535static inline int is_out(unsigned long con)
536{
537 return con == 1;
538}
539
540/* s3c2410_pm_restore_gpio()
541 *
542 * Restore one of the GPIO banks that was saved during suspend. This is
543 * not as simple as once thought, due to the possibility of glitches
544 * from the order that the CON and DAT registers are set in.
545 *
546 * The three states the pin can be are {IN,OUT,SFN} which gives us 9
547 * combinations of changes to check. Three of these, if the pin stays
548 * in the same configuration can be discounted. This leaves us with
549 * the following:
550 *
551 * { IN => OUT } Change DAT first
552 * { IN => SFN } Change CON first
553 * { OUT => SFN } Change CON first, so new data will not glitch
554 * { OUT => IN } Change CON first, so new data will not glitch
555 * { SFN => IN } Change CON first
556 * { SFN => OUT } Change DAT first, so new data will not glitch [1]
557 *
558 * We do not currently deal with the UP registers as these control
559 * weak resistors, so a small delay in change should not need to bring
560 * these into the calculations.
561 *
562 * [1] this assumes that writing to a pin DAT whilst in SFN will set the
563 * state for when it is next output.
564 */
565
566static void s3c2410_pm_restore_gpio(int index, struct gpio_sleep *gps)
567{
568 void __iomem *base = gps->base;
569 unsigned long gps_gpcon = gps->gpcon;
570 unsigned long gps_gpdat = gps->gpdat;
571 unsigned long old_gpcon;
572 unsigned long old_gpdat;
573 unsigned long old_gpup = 0x0;
574 unsigned long gpcon;
575 int nr;
576
577 old_gpcon = __raw_readl(base + OFFS_CON);
578 old_gpdat = __raw_readl(base + OFFS_DAT);
579
580 if (base == S3C2410_GPACON) {
581 /* GPACON only has one bit per control / data and no PULLUPs.
582 * GPACON[x] = 0 => Output, 1 => SFN */
583
584 /* first set all SFN bits to SFN */
585
586 gpcon = old_gpcon | gps->gpcon;
587 __raw_writel(gpcon, base + OFFS_CON);
588
589 /* now set all the other bits */
590
591 __raw_writel(gps_gpdat, base + OFFS_DAT);
592 __raw_writel(gps_gpcon, base + OFFS_CON);
593 } else {
594 unsigned long old, new, mask;
595 unsigned long change_mask = 0x0;
596
597 old_gpup = __raw_readl(base + OFFS_UP);
598
599 /* Create a change_mask of all the items that need to have
600 * their CON value changed before their DAT value, so that
601 * we minimise the work between the two settings.
602 */
603
604 for (nr = 0, mask = 0x03; nr < 32; nr += 2, mask <<= 2) {
605 old = (old_gpcon & mask) >> nr;
606 new = (gps_gpcon & mask) >> nr;
607
608 /* If there is no change, then skip */
609
610 if (old == new)
611 continue;
612
613 /* If both are special function, then skip */
614
615 if (is_sfn(old) && is_sfn(new))
616 continue;
617
618 /* Change is IN => OUT, do not change now */
619
620 if (is_in(old) && is_out(new))
621 continue;
622
623 /* Change is SFN => OUT, do not change now */
624
625 if (is_sfn(old) && is_out(new))
626 continue;
627
628 /* We should now be at the case of IN=>SFN,
629 * OUT=>SFN, OUT=>IN, SFN=>IN. */
630
631 change_mask |= mask;
632 }
633
634 /* Write the new CON settings */
635
636 gpcon = old_gpcon & ~change_mask;
637 gpcon |= gps_gpcon & change_mask;
638
639 __raw_writel(gpcon, base + OFFS_CON);
640
641 /* Now change any items that require DAT,CON */
642
643 __raw_writel(gps_gpdat, base + OFFS_DAT);
644 __raw_writel(gps_gpcon, base + OFFS_CON);
645 __raw_writel(gps->gpup, base + OFFS_UP);
646 }
647
648 DBG("GPIO[%d] CON %08lx => %08lx, DAT %08lx => %08lx\n",
649 index, old_gpcon, gps_gpcon, old_gpdat, gps_gpdat);
650}
651
652
653/** s3c2410_pm_restore_gpios()
654 *
655 * Restore the state of the GPIOs
656 */
657
658static void s3c2410_pm_restore_gpios(void)
659{
660 struct gpio_sleep *gps = gpio_save;
661 int gpio;
662
663 for (gpio = 0; gpio < ARRAY_SIZE(gpio_save); gpio++, gps++) {
664 s3c2410_pm_restore_gpio(gpio, gps);
665 }
666}
667
489void (*pm_cpu_prep)(void); 668void (*pm_cpu_prep)(void);
490void (*pm_cpu_sleep)(void); 669void (*pm_cpu_sleep)(void);
491 670
@@ -535,7 +714,8 @@ static int s3c2410_pm_enter(suspend_state_t state)
535 714
536 /* save all necessary core registers not covered by the drivers */ 715 /* save all necessary core registers not covered by the drivers */
537 716
538 s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save)); 717 s3c2410_pm_save_gpios();
718 s3c2410_pm_do_save(misc_save, ARRAY_SIZE(misc_save));
539 s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save)); 719 s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save));
540 s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save)); 720 s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
541 721
@@ -585,8 +765,9 @@ static int s3c2410_pm_enter(suspend_state_t state)
585 /* restore the system state */ 765 /* restore the system state */
586 766
587 s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save)); 767 s3c2410_pm_do_restore_core(core_save, ARRAY_SIZE(core_save));
588 s3c2410_pm_do_restore(gpio_save, ARRAY_SIZE(gpio_save)); 768 s3c2410_pm_do_restore(misc_save, ARRAY_SIZE(misc_save));
589 s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save)); 769 s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
770 s3c2410_pm_restore_gpios();
590 771
591 s3c2410_pm_debug_init(); 772 s3c2410_pm_debug_init();
592 773
diff --git a/arch/arm/plat-s3c24xx/s3c244x-clock.c b/arch/arm/plat-s3c24xx/s3c244x-clock.c
new file mode 100644
index 000000000000..faf3e0f9f4e2
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/s3c244x-clock.c
@@ -0,0 +1,137 @@
1/* linux/arch/arm/plat-s3c24xx/s3c24xx-clock.c
2 *
3 * Copyright (c) 2004-2005,2008 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2440/S3C2442 Common clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/sysdev.h>
32#include <linux/interrupt.h>
33#include <linux/ioport.h>
34#include <linux/mutex.h>
35#include <linux/clk.h>
36
37#include <asm/hardware.h>
38#include <asm/atomic.h>
39#include <asm/irq.h>
40#include <asm/io.h>
41
42#include <asm/arch/regs-clock.h>
43
44#include <asm/plat-s3c24xx/clock.h>
45#include <asm/plat-s3c24xx/cpu.h>
46
47static int s3c2440_setparent_armclk(struct clk *clk, struct clk *parent)
48{
49 unsigned long camdivn;
50 unsigned long dvs;
51
52 if (parent == &clk_f)
53 dvs = 0;
54 else if (parent == &clk_h)
55 dvs = S3C2440_CAMDIVN_DVSEN;
56 else
57 return -EINVAL;
58
59 clk->parent = parent;
60
61 camdivn = __raw_readl(S3C2440_CAMDIVN);
62 camdivn &= ~S3C2440_CAMDIVN_DVSEN;
63 camdivn |= dvs;
64 __raw_writel(camdivn, S3C2440_CAMDIVN);
65
66 return 0;
67}
68
69static struct clk clk_arm = {
70 .name = "armclk",
71 .id = -1,
72 .set_parent = s3c2440_setparent_armclk,
73};
74
75static int s3c244x_clk_add(struct sys_device *sysdev)
76{
77 unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN);
78 unsigned long clkdivn;
79 struct clk *clock_upll;
80 int ret;
81
82 printk("S3C244X: Clock Support, DVS %s\n",
83 (camdivn & S3C2440_CAMDIVN_DVSEN) ? "on" : "off");
84
85 clk_arm.parent = (camdivn & S3C2440_CAMDIVN_DVSEN) ? &clk_h : &clk_f;
86
87 ret = s3c24xx_register_clock(&clk_arm);
88 if (ret < 0) {
89 printk(KERN_ERR "S3C24XX: Failed to add armclk (%d)\n", ret);
90 return ret;
91 }
92
93 clock_upll = clk_get(NULL, "upll");
94 if (IS_ERR(clock_upll)) {
95 printk(KERN_ERR "S3C244X: Failed to get upll clock\n");
96 return -ENOENT;
97 }
98
99 /* check rate of UPLL, and if it is near 96MHz, then change
100 * to using half the UPLL rate for the system */
101
102 if (clk_get_rate(clock_upll) > (94 * MHZ)) {
103 clk_usb_bus.rate = clk_get_rate(clock_upll) / 2;
104
105 mutex_lock(&clocks_mutex);
106
107 clkdivn = __raw_readl(S3C2410_CLKDIVN);
108 clkdivn |= S3C2440_CLKDIVN_UCLK;
109 __raw_writel(clkdivn, S3C2410_CLKDIVN);
110
111 mutex_unlock(&clocks_mutex);
112 }
113
114 return 0;
115}
116
117static struct sysdev_driver s3c2440_clk_driver = {
118 .add = s3c244x_clk_add,
119};
120
121static int s3c2440_clk_init(void)
122{
123 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver);
124}
125
126arch_initcall(s3c2440_clk_init);
127
128static struct sysdev_driver s3c2442_clk_driver = {
129 .add = s3c244x_clk_add,
130};
131
132static int s3c2442_clk_init(void)
133{
134 return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_clk_driver);
135}
136
137arch_initcall(s3c2442_clk_init);
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 0a9a5e7f62e5..7ed58c0c24c2 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Fri May 11 19:53:41 2007 15# Last update: Sat Jan 26 14:45:34 2008
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -266,7 +266,7 @@ stork_egg ARCH_STORK_EGG STORK_EGG 248
266wismo SA1100_WISMO WISMO 249 266wismo SA1100_WISMO WISMO 249
267ezlinx ARCH_EZLINX EZLINX 250 267ezlinx ARCH_EZLINX EZLINX 250
268at91rm9200 ARCH_AT91RM9200 AT91RM9200 251 268at91rm9200 ARCH_AT91RM9200 AT91RM9200 251
269orion ARCH_ORION ORION 252 269adtech_orion ARCH_ADTECH_ORION ADTECH_ORION 252
270neptune ARCH_NEPTUNE NEPTUNE 253 270neptune ARCH_NEPTUNE NEPTUNE 253
271hackkit SA1100_HACKKIT HACKKIT 254 271hackkit SA1100_HACKKIT HACKKIT 254
272pxa_wins30 ARCH_PXA_WINS30 PXA_WINS30 255 272pxa_wins30 ARCH_PXA_WINS30 PXA_WINS30 255
@@ -661,7 +661,6 @@ a9200ec MACH_A9200EC A9200EC 645
661pnx0105 MACH_PNX0105 PNX0105 646 661pnx0105 MACH_PNX0105 PNX0105 646
662adcpoecpu MACH_ADCPOECPU ADCPOECPU 647 662adcpoecpu MACH_ADCPOECPU ADCPOECPU 647
663csb637 MACH_CSB637 CSB637 648 663csb637 MACH_CSB637 CSB637 648
664ml69q6203 MACH_ML69Q6203 ML69Q6203 649
665mb9200 MACH_MB9200 MB9200 650 664mb9200 MACH_MB9200 MB9200 650
666kulun MACH_KULUN KULUN 651 665kulun MACH_KULUN KULUN 651
667snapper MACH_SNAPPER SNAPPER 652 666snapper MACH_SNAPPER SNAPPER 652
@@ -953,7 +952,6 @@ fred_jack MACH_FRED_JACK FRED_JACK 939
953ttg_color1 MACH_TTG_COLOR1 TTG_COLOR1 940 952ttg_color1 MACH_TTG_COLOR1 TTG_COLOR1 940
954nxeb500hmi MACH_NXEB500HMI NXEB500HMI 941 953nxeb500hmi MACH_NXEB500HMI NXEB500HMI 941
955netdcu8 MACH_NETDCU8 NETDCU8 942 954netdcu8 MACH_NETDCU8 NETDCU8 942
956ml675050_cpu_boa MACH_ML675050_CPU_BOA ML675050_CPU_BOA 943
957ng_fvx538 MACH_NG_FVX538 NG_FVX538 944 955ng_fvx538 MACH_NG_FVX538 NG_FVX538 944
958ng_fvs338 MACH_NG_FVS338 NG_FVS338 945 956ng_fvs338 MACH_NG_FVS338 NG_FVS338 945
959pnx4103 MACH_PNX4103 PNX4103 946 957pnx4103 MACH_PNX4103 PNX4103 946
@@ -1148,7 +1146,7 @@ aidx270 MACH_AIDX270 AIDX270 1134
1148rema MACH_REMA REMA 1135 1146rema MACH_REMA REMA 1135
1149bps1000 MACH_BPS1000 BPS1000 1136 1147bps1000 MACH_BPS1000 BPS1000 1136
1150hw90350 MACH_HW90350 HW90350 1137 1148hw90350 MACH_HW90350 HW90350 1137
1151omap_sdp3430 MACH_OMAP_SDP3430 OMAP_SDP3430 1138 1149omap_3430sdp MACH_OMAP_3430SDP OMAP_3430SDP 1138
1152bluetouch MACH_BLUETOUCH BLUETOUCH 1139 1150bluetouch MACH_BLUETOUCH BLUETOUCH 1139
1153vstms MACH_VSTMS VSTMS 1140 1151vstms MACH_VSTMS VSTMS 1140
1154xsbase270 MACH_XSBASE270 XSBASE270 1141 1152xsbase270 MACH_XSBASE270 XSBASE270 1141
@@ -1214,7 +1212,7 @@ osstbox MACH_OSSTBOX OSSTBOX 1203
1214kbat9261 MACH_KBAT9261 KBAT9261 1204 1212kbat9261 MACH_KBAT9261 KBAT9261 1204
1215ct1100 MACH_CT1100 CT1100 1205 1213ct1100 MACH_CT1100 CT1100 1205
1216akcppxa MACH_AKCPPXA AKCPPXA 1206 1214akcppxa MACH_AKCPPXA AKCPPXA 1206
1217zevio_1020 MACH_ZEVIO_1020 ZEVIO_1020 1207 1215ochaya1020 MACH_OCHAYA1020 OCHAYA1020 1207
1218hitrack MACH_HITRACK HITRACK 1208 1216hitrack MACH_HITRACK HITRACK 1208
1219syme1 MACH_SYME1 SYME1 1209 1217syme1 MACH_SYME1 SYME1 1209
1220syhl1 MACH_SYHL1 SYHL1 1210 1218syhl1 MACH_SYHL1 SYHL1 1210
@@ -1299,7 +1297,7 @@ xp179 MACH_XP179 XP179 1290
1299h4300 MACH_H4300 H4300 1291 1297h4300 MACH_H4300 H4300 1291
1300goramo_mlr MACH_GORAMO_MLR GORAMO_MLR 1292 1298goramo_mlr MACH_GORAMO_MLR GORAMO_MLR 1292
1301mxc30020evb MACH_MXC30020EVB MXC30020EVB 1293 1299mxc30020evb MACH_MXC30020EVB MXC30020EVB 1293
1302adsbitsymx MACH_ADSBITSIMX ADSBITSIMX 1294 1300adsbitsyg5 MACH_ADSBITSYG5 ADSBITSYG5 1294
1303adsportalplus MACH_ADSPORTALPLUS ADSPORTALPLUS 1295 1301adsportalplus MACH_ADSPORTALPLUS ADSPORTALPLUS 1295
1304mmsp2plus MACH_MMSP2PLUS MMSP2PLUS 1296 1302mmsp2plus MACH_MMSP2PLUS MMSP2PLUS 1296
1305em_x270 MACH_EM_X270 EM_X270 1297 1303em_x270 MACH_EM_X270 EM_X270 1297
@@ -1367,3 +1365,249 @@ db88f5281 MACH_DB88F5281 DB88F5281 1358
1367csb726 MACH_CSB726 CSB726 1359 1365csb726 MACH_CSB726 CSB726 1359
1368tik27 MACH_TIK27 TIK27 1360 1366tik27 MACH_TIK27 TIK27 1360
1369mx_uc7420 MACH_MX_UC7420 MX_UC7420 1361 1367mx_uc7420 MACH_MX_UC7420 MX_UC7420 1361
1368rirm3 MACH_RIRM3 RIRM3 1362
1369pelco_odyssey MACH_PELCO_ODYSSEY PELCO_ODYSSEY 1363
1370adx_abox MACH_ADX_ABOX ADX_ABOX 1365
1371adx_tpid MACH_ADX_TPID ADX_TPID 1366
1372minicheck MACH_MINICHECK MINICHECK 1367
1373idam MACH_IDAM IDAM 1368
1374mario_mx MACH_MARIO_MX MARIO_MX 1369
1375vi1888 MACH_VI1888 VI1888 1370
1376zr4230 MACH_ZR4230 ZR4230 1371
1377t1_ix_blue MACH_T1_IX_BLUE T1_IX_BLUE 1372
1378syhq2 MACH_SYHQ2 SYHQ2 1373
1379computime_r3 MACH_COMPUTIME_R3 COMPUTIME_R3 1374
1380oratis MACH_ORATIS ORATIS 1375
1381mikko MACH_MIKKO MIKKO 1376
1382holon MACH_HOLON HOLON 1377
1383olip8 MACH_OLIP8 OLIP8 1378
1384ghi270hg MACH_GHI270HG GHI270HG 1379
1385davinci_dm6467_evm MACH_DAVINCI_DM6467_EVM DAVINCI_DM6467_EVM 1380
1386davinci_dm355_evm MACH_DAVINCI_DM350_EVM DAVINCI_DM350_EVM 1381
1387blackriver MACH_BLACKRIVER BLACKRIVER 1383
1388sandgate_wp MACH_SANDGATEWP SANDGATEWP 1384
1389cdotbwsg MACH_CDOTBWSG CDOTBWSG 1385
1390quark963 MACH_QUARK963 QUARK963 1386
1391csb735 MACH_CSB735 CSB735 1387
1392littleton MACH_LITTLETON LITTLETON 1388
1393mio_p550 MACH_MIO_P550 MIO_P550 1389
1394motion2440 MACH_MOTION2440 MOTION2440 1390
1395imm500 MACH_IMM500 IMM500 1391
1396homematic MACH_HOMEMATIC HOMEMATIC 1392
1397ermine MACH_ERMINE ERMINE 1393
1398kb9202b MACH_KB9202B KB9202B 1394
1399hs1xx MACH_HS1XX HS1XX 1395
1400studentmate2440 MACH_STUDENTMATE2440 STUDENTMATE2440 1396
1401arvoo_l1_z1 MACH_ARVOO_L1_Z1 ARVOO_L1_Z1 1397
1402dep2410k MACH_DEP2410K DEP2410K 1398
1403xxsvideo MACH_XXSVIDEO XXSVIDEO 1399
1404im4004 MACH_IM4004 IM4004 1400
1405ochaya1050 MACH_OCHAYA1050 OCHAYA1050 1401
1406lep9261 MACH_LEP9261 LEP9261 1402
1407svenmeb MACH_SVENMEB SVENMEB 1403
1408fortunet2ne MACH_FORTUNET2NE FORTUNET2NE 1404
1409nxhx MACH_NXHX NXHX 1406
1410realview_pb11mp MACH_REALVIEW_PB11MP REALVIEW_PB11MP 1407
1411ids500 MACH_IDS500 IDS500 1408
1412ors_n725 MACH_ORS_N725 ORS_N725 1409
1413hsdarm MACH_HSDARM HSDARM 1410
1414sha_pon003 MACH_SHA_PON003 SHA_PON003 1411
1415sha_pon004 MACH_SHA_PON004 SHA_PON004 1412
1416sha_pon007 MACH_SHA_PON007 SHA_PON007 1413
1417sha_pon011 MACH_SHA_PON011 SHA_PON011 1414
1418h6042 MACH_H6042 H6042 1415
1419h6043 MACH_H6043 H6043 1416
1420looxc550 MACH_LOOXC550 LOOXC550 1417
1421cnty_titan MACH_CNTY_TITAN CNTY_TITAN 1418
1422app3xx MACH_APP3XX APP3XX 1419
1423sideoatsgrama MACH_SIDEOATSGRAMA SIDEOATSGRAMA 1420
1424xscale_palmt700p MACH_XSCALE_PALMT700P XSCALE_PALMT700P 1421
1425xscale_palmt700w MACH_XSCALE_PALMT700W XSCALE_PALMT700W 1422
1426xscale_palmt750 MACH_XSCALE_PALMT750 XSCALE_PALMT750 1423
1427xscale_palmt755p MACH_XSCALE_PALMT755P XSCALE_PALMT755P 1424
1428ezreganut9200 MACH_EZREGANUT9200 EZREGANUT9200 1425
1429sarge MACH_SARGE SARGE 1426
1430a696 MACH_A696 A696 1427
1431turtle1916 MACH_TURTLE TURTLE 1428
1432mx27_3ds MACH_MX27_3DS MX27_3DS 1430
1433bishop MACH_BISHOP BISHOP 1431
1434pxx MACH_PXX PXX 1432
1435redwood MACH_REDWOOD REDWOOD 1433
1436omap_2430dlp MACH_OMAP_2430DLP OMAP_2430DLP 1436
1437omap_2430osk MACH_OMAP_2430OSK OMAP_2430OSK 1437
1438sardine MACH_SARDINE SARDINE 1438
1439halibut MACH_HALIBUT HALIBUT 1439
1440trout MACH_TROUT TROUT 1440
1441goldfish MACH_GOLDFISH GOLDFISH 1441
1442gesbc2440 MACH_GESBC2440 GESBC2440 1442
1443nomad MACH_NOMAD NOMAD 1443
1444rosalind MACH_ROSALIND ROSALIND 1444
1445cc9p9215 MACH_CC9P9215 CC9P9215 1445
1446cc9p9210 MACH_CC9P9210 CC9P9210 1446
1447cc9p9215js MACH_CC9P9215JS CC9P9215JS 1447
1448cc9p9210js MACH_CC9P9210JS CC9P9210JS 1448
1449nasffe MACH_NASFFE NASFFE 1449
1450tn2x0bd MACH_TN2X0BD TN2X0BD 1450
1451gwmpxa MACH_GWMPXA GWMPXA 1451
1452exyplus MACH_EXYPLUS EXYPLUS 1452
1453jadoo21 MACH_JADOO21 JADOO21 1453
1454looxn560 MACH_LOOXN560 LOOXN560 1454
1455bonsai MACH_BONSAI BONSAI 1455
1456adsmilgato MACH_ADSMILGATO ADSMILGATO 1456
1457gba MACH_GBA GBA 1457
1458h6044 MACH_H6044 H6044 1458
1459app MACH_APP APP 1459
1460tct_hammer MACH_TCT_HAMMER TCT_HAMMER 1460
1461herald MACH_HERMES HERMES 1461
1462artemis MACH_ARTEMIS ARTEMIS 1462
1463htctitan MACH_HTCTITAN HTCTITAN 1463
1464qranium MACH_QRANIUM QRANIUM 1464
1465adx_wsc2 MACH_ADX_WSC2 ADX_WSC2 1465
1466adx_medinet MACH_ADX_MEDINET ADX_MEDINET 1466
1467bboard MACH_BBOARD BBOARD 1467
1468cambria MACH_CAMBRIA CAMBRIA 1468
1469mt7xxx MACH_MT7XXX MT7XXX 1469
1470matrix512 MACH_MATRIX512 MATRIX512 1470
1471matrix522 MACH_MATRIX522 MATRIX522 1471
1472ipac5010 MACH_IPAC5010 IPAC5010 1472
1473sakura MACH_SAKURA SAKURA 1473
1474grocx MACH_GROCX GROCX 1474
1475pm9263 MACH_PM9263 PM9263 1475
1476sim_one MACH_SIM_ONE SIM_ONE 1476
1477acq132 MACH_ACQ132 ACQ132 1477
1478datr MACH_DATR DATR 1478
1479actux1 MACH_ACTUX1 ACTUX1 1479
1480actux2 MACH_ACTUX2 ACTUX2 1480
1481actux3 MACH_ACTUX3 ACTUX3 1481
1482flexit MACH_FLEXIT FLEXIT 1482
1483bh2x0bd MACH_BH2X0BD BH2X0BD 1483
1484atb2002 MACH_ATB2002 ATB2002 1484
1485xenon MACH_XENON XENON 1485
1486fm607 MACH_FM607 FM607 1486
1487matrix514 MACH_MATRIX514 MATRIX514 1487
1488matrix524 MACH_MATRIX524 MATRIX524 1488
1489inpod MACH_INPOD INPOD 1489
1490jive MACH_JIVE JIVE 1490
1491tll_mx21 MACH_TLL_MX21 TLL_MX21 1491
1492sbc2800 MACH_SBC2800 SBC2800 1492
1493cc7ucamry MACH_CC7UCAMRY CC7UCAMRY 1493
1494ubisys_p9_sc15 MACH_UBISYS_P9_SC15 UBISYS_P9_SC15 1494
1495ubisys_p9_ssc2d10 MACH_UBISYS_P9_SSC2D10 UBISYS_P9_SSC2D10 1495
1496ubisys_p9_rcu3 MACH_UBISYS_P9_RCU3 UBISYS_P9_RCU3 1496
1497aml_m8000 MACH_AML_M8000 AML_M8000 1497
1498snapper_270 MACH_SNAPPER_270 SNAPPER_270 1498
1499omap_bbx MACH_OMAP_BBX OMAP_BBX 1499
1500ucn2410 MACH_UCN2410 UCN2410 1500
1501sam9_l9260 MACH_SAM9_L9260 SAM9_L9260 1501
1502eti_c2 MACH_ETI_C2 ETI_C2 1502
1503avalanche MACH_AVALANCHE AVALANCHE 1503
1504realview_pb1176 MACH_REALVIEW_PB1176 REALVIEW_PB1176 1504
1505dp1500 MACH_DP1500 DP1500 1505
1506apple_iphone MACH_APPLE_IPHONE APPLE_IPHONE 1506
1507yl9200 MACH_YL9200 YL9200 1507
1508rd88f5182 MACH_RD88F5182 RD88F5182 1508
1509kurobox_pro MACH_KUROBOX_PRO KUROBOX_PRO 1509
1510se_poet MACH_SE_POET SE_POET 1510
1511mx31_3ds MACH_MX31_3DS MX31_3DS 1511
1512r270 MACH_R270 R270 1512
1513armour21 MACH_ARMOUR21 ARMOUR21 1513
1514dt2 MACH_DT2 DT2 1514
1515vt4 MACH_VT4 VT4 1515
1516tyco320 MACH_TYCO320 TYCO320 1516
1517adma MACH_ADMA ADMA 1517
1518wp188 MACH_WP188 WP188 1518
1519corsica MACH_CORSICA CORSICA 1519
1520bigeye MACH_BIGEYE BIGEYE 1520
1521tll5000 MACH_TLL5000 TLL5000 1522
1522hni270 MACH_HNI_X270 HNI_X270 1523
1523qong MACH_QONG QONG 1524
1524tcompact MACH_TCOMPACT TCOMPACT 1525
1525puma5 MACH_PUMA5 PUMA5 1526
1526elara MACH_ELARA ELARA 1527
1527ellington MACH_ELLINGTON ELLINGTON 1528
1528xda_atom MACH_XDA_ATOM XDA_ATOM 1529
1529energizer2 MACH_ENERGIZER2 ENERGIZER2 1530
1530odin MACH_ODIN ODIN 1531
1531actux4 MACH_ACTUX4 ACTUX4 1532
1532esl_omap MACH_ESL_OMAP ESL_OMAP 1533
1533omap2evm MACH_OMAP2EVM OMAP2EVM 1534
1534omap3evm MACH_OMAP3EVM OMAP3EVM 1535
1535adx_pcu57 MACH_ADX_PCU57 ADX_PCU57 1536
1536monaco MACH_MONACO MONACO 1537
1537levante MACH_LEVANTE LEVANTE 1538
1538tmxipx425 MACH_TMXIPX425 TMXIPX425 1539
1539leep MACH_LEEP LEEP 1540
1540raad MACH_RAAD RAAD 1541
1541dns323 MACH_DNS323 DNS323 1542
1542ap1000 MACH_AP1000 AP1000 1543
1543a9sam6432 MACH_A9SAM6432 A9SAM6432 1544
1544shiny MACH_SHINY SHINY 1545
1545omap3_beagle MACH_OMAP3_BEAGLE OMAP3_BEAGLE 1546
1546csr_bdb2 MACH_CSR_BDB2 CSR_BDB2 1547
1547nokia_n810 MACH_NOKIA_N810 NOKIA_N810 1548
1548c270 MACH_C270 C270 1549
1549sentry MACH_SENTRY SENTRY 1550
1550pcm038 MACH_PCM038 PCM038 1551
1551anc300 MACH_ANC300 ANC300 1552
1552htckaiser MACH_HTCKAISER HTCKAISER 1553
1553sbat100 MACH_SBAT100 SBAT100 1554
1554modunorm MACH_MODUNORM MODUNORM 1555
1555pelos_twarm MACH_PELOS_TWARM PELOS_TWARM 1556
1556flank MACH_FLANK FLANK 1557
1557sirloin MACH_SIRLOIN SIRLOIN 1558
1558brisket MACH_BRISKET BRISKET 1559
1559chuck MACH_CHUCK CHUCK 1560
1560otter MACH_OTTER OTTER 1561
1561davinci_ldk MACH_DAVINCI_LDK DAVINCI_LDK 1562
1562phreedom MACH_PHREEDOM PHREEDOM 1563
1563sg310 MACH_SG310 SG310 1564
1564ts_x09 MACH_TS209 TS209 1565
1565at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
1566tion9315 MACH_TION9315 TION9315 1567
1567mast MACH_MAST MAST 1568
1568pfw MACH_PFW PFW 1569
1569yl_p2440 MACH_YL_P2440 YL_P2440 1570
1570zsbc32 MACH_ZSBC32 ZSBC32 1571
1571omap_pace2 MACH_OMAP_PACE2 OMAP_PACE2 1572
1572imx_pace2 MACH_IMX_PACE2 IMX_PACE2 1573
1573mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
1574mx37_3ds MACH_MX37_3DS MX37_3DS 1575
1575rcc MACH_RCC RCC 1576
1576dmp MACH_ARM9 ARM9 1577
1577vision_ep9307 MACH_VISION_EP9307 VISION_EP9307 1578
1578scly1000 MACH_SCLY1000 SCLY1000 1579
1579fontel_ep MACH_FONTEL_EP FONTEL_EP 1580
1580voiceblue3g MACH_VOICEBLUE3G VOICEBLUE3G 1581
1581tt9200 MACH_TT9200 TT9200 1582
1582digi2410 MACH_DIGI2410 DIGI2410 1583
1583terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584
1584linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585
1585motorola_a780 MACH_MOTOROLA_A780 MOTOROLA_A780 1587
1586motorola_e6 MACH_MOTOROLA_E6 MOTOROLA_E6 1588
1587motorola_e2 MACH_MOTOROLA_E2 MOTOROLA_E2 1589
1588motorola_e680 MACH_MOTOROLA_E680 MOTOROLA_E680 1590
1589ur2410 MACH_UR2410 UR2410 1591
1590tas9261 MACH_TAS9261 TAS9261 1592
1591davinci_hermes_hd MACH_HERMES_HD HERMES_HD 1593
1592davinci_perseo_hd MACH_PERSEO_HD PERSEO_HD 1594
1593stargazer2 MACH_STARGAZER2 STARGAZER2 1595
1594e350 MACH_E350 E350 1596
1595wpcm450 MACH_WPCM450 WPCM450 1597
1596cartesio MACH_CARTESIO CARTESIO 1598
1597toybox MACH_TOYBOX TOYBOX 1599
1598tx27 MACH_TX27 TX27 1600
1599ts409 MACH_TS409 TS409 1601
1600p300 MACH_P300 P300 1602
1601xdacomet MACH_XDACOMET XDACOMET 1603
1602dexflex2 MACH_DEXFLEX2 DEXFLEX2 1604
1603ow MACH_OW OW 1605
1604armebs3 MACH_ARMEBS3 ARMEBS3 1606
1605u3 MACH_U3 U3 1607
1606smdk2450 MACH_SMDK2450 SMDK2450 1608
1607rsi_ews MACH_RSI_EWS RSI_EWS 1609
1608tnb MACH_TNB TNB 1610
1609toepath MACH_TOEPATH TOEPATH 1611
1610kb9263 MACH_KB9263 KB9263 1612
1611mt7108 MACH_MT7108 MT7108 1613
1612smtr2440 MACH_SMTR2440 SMTR2440 1614
1613manao MACH_MANAO MANAO 1615
diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h
index 791d0238c68f..c85860bad585 100644
--- a/arch/arm/vfp/vfp.h
+++ b/arch/arm/vfp/vfp.h
@@ -265,7 +265,11 @@ struct vfp_double {
265 * which returns (double)0.0. This is useful for the compare with 265 * which returns (double)0.0. This is useful for the compare with
266 * zero instructions. 266 * zero instructions.
267 */ 267 */
268#ifdef CONFIG_VFPv3
269#define VFP_REG_ZERO 32
270#else
268#define VFP_REG_ZERO 16 271#define VFP_REG_ZERO 16
272#endif
269extern u64 vfp_get_double(unsigned int reg); 273extern u64 vfp_get_double(unsigned int reg);
270extern void vfp_put_double(u64 val, unsigned int reg); 274extern void vfp_put_double(u64 val, unsigned int reg);
271 275
diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
index 0ac022f800a1..353f9e5c7919 100644
--- a/arch/arm/vfp/vfphw.S
+++ b/arch/arm/vfp/vfphw.S
@@ -99,12 +99,12 @@ vfp_support_entry:
99 DBGSTR1 "save old state %p", r4 99 DBGSTR1 "save old state %p", r4
100 cmp r4, #0 100 cmp r4, #0
101 beq no_old_VFP_process 101 beq no_old_VFP_process
102 VFPFSTMIA r4, r5 @ save the working registers
102 VFPFMRX r5, FPSCR @ current status 103 VFPFMRX r5, FPSCR @ current status
103 VFPFMRX r6, FPINST @ FPINST (always there, rev0 onwards) 104 tst r1, #FPEXC_EX @ is there additional state to save?
104 tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read? 105 VFPFMRX r6, FPINST, NE @ FPINST (only if FPEXC.EX is set)
105 VFPFMRX r8, FPINST2, NE @ FPINST2 if needed - avoids reading 106 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read?
106 @ nonexistant reg on rev0 107 VFPFMRX r8, FPINST2, NE @ FPINST2 if needed (and present)
107 VFPFSTMIA r4 @ save the working registers
108 stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2 108 stmia r4, {r1, r5, r6, r8} @ save FPEXC, FPSCR, FPINST, FPINST2
109 @ and point r4 at the word at the 109 @ and point r4 at the word at the
110 @ start of the register dump 110 @ start of the register dump
@@ -114,13 +114,13 @@ no_old_VFP_process:
114 DBGSTR1 "load state %p", r10 114 DBGSTR1 "load state %p", r10
115 str r10, [r3, r11, lsl #2] @ update the last_VFP_context pointer 115 str r10, [r3, r11, lsl #2] @ update the last_VFP_context pointer
116 @ Load the saved state back into the VFP 116 @ Load the saved state back into the VFP
117 VFPFLDMIA r10 @ reload the working registers while 117 VFPFLDMIA r10, r5 @ reload the working registers while
118 @ FPEXC is in a safe state 118 @ FPEXC is in a safe state
119 ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2 119 ldmia r10, {r1, r5, r6, r8} @ load FPEXC, FPSCR, FPINST, FPINST2
120 tst r1, #FPEXC_FPV2 @ is there an FPINST2 to write? 120 tst r1, #FPEXC_EX @ is there additional state to restore?
121 VFPFMXR FPINST2, r8, NE @ FPINST2 if needed - avoids writing 121 VFPFMXR FPINST, r6, NE @ restore FPINST (only if FPEXC.EX is set)
122 @ nonexistant reg on rev0 122 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to write?
123 VFPFMXR FPINST, r6 123 VFPFMXR FPINST2, r8, NE @ FPINST2 if needed (and present)
124 VFPFMXR FPSCR, r5 @ restore status 124 VFPFMXR FPSCR, r5 @ restore status
125 125
126check_for_exception: 126check_for_exception:
@@ -136,10 +136,14 @@ check_for_exception:
136 136
137 137
138look_for_VFP_exceptions: 138look_for_VFP_exceptions:
139 tst r1, #FPEXC_EX 139 @ Check for synchronous or asynchronous exception
140 tst r1, #FPEXC_EX | FPEXC_DEX
140 bne process_exception 141 bne process_exception
142 @ On some implementations of the VFP subarch 1, setting FPSCR.IXE
143 @ causes all the CDP instructions to be bounced synchronously without
144 @ setting the FPEXC.EX bit
141 VFPFMRX r5, FPSCR 145 VFPFMRX r5, FPSCR
142 tst r5, #FPSCR_IXE @ IXE doesn't set FPEXC_EX ! 146 tst r5, #FPSCR_IXE
143 bne process_exception 147 bne process_exception
144 148
145 @ Fall into hand on to next handler - appropriate coproc instr 149 @ Fall into hand on to next handler - appropriate coproc instr
@@ -150,10 +154,6 @@ look_for_VFP_exceptions:
150 154
151process_exception: 155process_exception:
152 DBGSTR "bounce" 156 DBGSTR "bounce"
153 sub r2, r2, #4
154 str r2, [sp, #S_PC] @ retry the instruction on exit from
155 @ the imprecise exception handling in
156 @ the support code
157 mov r2, sp @ nothing stacked - regdump is at TOS 157 mov r2, sp @ nothing stacked - regdump is at TOS
158 mov lr, r9 @ setup for a return to the user code. 158 mov lr, r9 @ setup for a return to the user code.
159 159
@@ -161,7 +161,7 @@ process_exception:
161 @ r0 holds the trigger instruction 161 @ r0 holds the trigger instruction
162 @ r1 holds the FPEXC value 162 @ r1 holds the FPEXC value
163 @ r2 pointer to register dump 163 @ r2 pointer to register dump
164 b VFP9_bounce @ we have handled this - the support 164 b VFP_bounce @ we have handled this - the support
165 @ code will raise an exception if 165 @ code will raise an exception if
166 @ required. If not, the user code will 166 @ required. If not, the user code will
167 @ retry the faulted instruction 167 @ retry the faulted instruction
@@ -174,12 +174,12 @@ vfp_save_state:
174 @ r0 - save location 174 @ r0 - save location
175 @ r1 - FPEXC 175 @ r1 - FPEXC
176 DBGSTR1 "save VFP state %p", r0 176 DBGSTR1 "save VFP state %p", r0
177 VFPFSTMIA r0, r2 @ save the working registers
177 VFPFMRX r2, FPSCR @ current status 178 VFPFMRX r2, FPSCR @ current status
178 VFPFMRX r3, FPINST @ FPINST (always there, rev0 onwards) 179 tst r1, #FPEXC_EX @ is there additional state to save?
179 tst r1, #FPEXC_FPV2 @ is there an FPINST2 to read? 180 VFPFMRX r3, FPINST, NE @ FPINST (only if FPEXC.EX is set)
180 VFPFMRX r12, FPINST2, NE @ FPINST2 if needed - avoids reading 181 tstne r1, #FPEXC_FP2V @ is there an FPINST2 to read?
181 @ nonexistant reg on rev0 182 VFPFMRX r12, FPINST2, NE @ FPINST2 if needed (and present)
182 VFPFSTMIA r0 @ save the working registers
183 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2 183 stmia r0, {r1, r2, r3, r12} @ save FPEXC, FPSCR, FPINST, FPINST2
184 mov pc, lr 184 mov pc, lr
185#endif 185#endif
@@ -217,8 +217,15 @@ vfp_get_double:
217 fmrrd r0, r1, d\dr 217 fmrrd r0, r1, d\dr
218 mov pc, lr 218 mov pc, lr
219 .endr 219 .endr
220#ifdef CONFIG_VFPv3
221 @ d16 - d31 registers
222 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
223 mrrc p11, 3, r0, r1, c\dr @ fmrrd r0, r1, d\dr
224 mov pc, lr
225 .endr
226#endif
220 227
221 @ virtual register 16 for compare with zero 228 @ virtual register 16 (or 32 if VFPv3) for compare with zero
222 mov r0, #0 229 mov r0, #0
223 mov r1, #0 230 mov r1, #0
224 mov pc, lr 231 mov pc, lr
@@ -231,3 +238,10 @@ vfp_put_double:
231 fmdrr d\dr, r0, r1 238 fmdrr d\dr, r0, r1
232 mov pc, lr 239 mov pc, lr
233 .endr 240 .endr
241#ifdef CONFIG_VFPv3
242 @ d16 - d31 registers
243 .irp dr,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
244 mcrr p11, 3, r1, r2, c\dr @ fmdrr r1, r2, d\dr
245 mov pc, lr
246 .endr
247#endif
diff --git a/arch/arm/vfp/vfpinstr.h b/arch/arm/vfp/vfpinstr.h
index 7f343a4beca0..15b95b5ab97e 100644
--- a/arch/arm/vfp/vfpinstr.h
+++ b/arch/arm/vfp/vfpinstr.h
@@ -52,11 +52,11 @@
52#define FEXT_TO_IDX(inst) ((inst & 0x000f0000) >> 15 | (inst & (1 << 7)) >> 7) 52#define FEXT_TO_IDX(inst) ((inst & 0x000f0000) >> 15 | (inst & (1 << 7)) >> 7)
53 53
54#define vfp_get_sd(inst) ((inst & 0x0000f000) >> 11 | (inst & (1 << 22)) >> 22) 54#define vfp_get_sd(inst) ((inst & 0x0000f000) >> 11 | (inst & (1 << 22)) >> 22)
55#define vfp_get_dd(inst) ((inst & 0x0000f000) >> 12) 55#define vfp_get_dd(inst) ((inst & 0x0000f000) >> 12 | (inst & (1 << 22)) >> 18)
56#define vfp_get_sm(inst) ((inst & 0x0000000f) << 1 | (inst & (1 << 5)) >> 5) 56#define vfp_get_sm(inst) ((inst & 0x0000000f) << 1 | (inst & (1 << 5)) >> 5)
57#define vfp_get_dm(inst) ((inst & 0x0000000f)) 57#define vfp_get_dm(inst) ((inst & 0x0000000f) | (inst & (1 << 5)) >> 1)
58#define vfp_get_sn(inst) ((inst & 0x000f0000) >> 15 | (inst & (1 << 7)) >> 7) 58#define vfp_get_sn(inst) ((inst & 0x000f0000) >> 15 | (inst & (1 << 7)) >> 7)
59#define vfp_get_dn(inst) ((inst & 0x000f0000) >> 16) 59#define vfp_get_dn(inst) ((inst & 0x000f0000) >> 16 | (inst & (1 << 7)) >> 3)
60 60
61#define vfp_single(inst) (((inst) & 0x0000f00) == 0xa00) 61#define vfp_single(inst) (((inst) & 0x0000f00) == 0xa00)
62 62
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index b4e210df92f2..32455c633f1c 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -125,13 +125,13 @@ void vfp_raise_sigfpe(unsigned int sicode, struct pt_regs *regs)
125 send_sig_info(SIGFPE, &info, current); 125 send_sig_info(SIGFPE, &info, current);
126} 126}
127 127
128static void vfp_panic(char *reason) 128static void vfp_panic(char *reason, u32 inst)
129{ 129{
130 int i; 130 int i;
131 131
132 printk(KERN_ERR "VFP: Error: %s\n", reason); 132 printk(KERN_ERR "VFP: Error: %s\n", reason);
133 printk(KERN_ERR "VFP: EXC 0x%08x SCR 0x%08x INST 0x%08x\n", 133 printk(KERN_ERR "VFP: EXC 0x%08x SCR 0x%08x INST 0x%08x\n",
134 fmrx(FPEXC), fmrx(FPSCR), fmrx(FPINST)); 134 fmrx(FPEXC), fmrx(FPSCR), inst);
135 for (i = 0; i < 32; i += 2) 135 for (i = 0; i < 32; i += 2)
136 printk(KERN_ERR "VFP: s%2u: 0x%08x s%2u: 0x%08x\n", 136 printk(KERN_ERR "VFP: s%2u: 0x%08x s%2u: 0x%08x\n",
137 i, vfp_get_float(i), i+1, vfp_get_float(i+1)); 137 i, vfp_get_float(i), i+1, vfp_get_float(i+1));
@@ -147,19 +147,16 @@ static void vfp_raise_exceptions(u32 exceptions, u32 inst, u32 fpscr, struct pt_
147 pr_debug("VFP: raising exceptions %08x\n", exceptions); 147 pr_debug("VFP: raising exceptions %08x\n", exceptions);
148 148
149 if (exceptions == VFP_EXCEPTION_ERROR) { 149 if (exceptions == VFP_EXCEPTION_ERROR) {
150 vfp_panic("unhandled bounce"); 150 vfp_panic("unhandled bounce", inst);
151 vfp_raise_sigfpe(0, regs); 151 vfp_raise_sigfpe(0, regs);
152 return; 152 return;
153 } 153 }
154 154
155 /* 155 /*
156 * If any of the status flags are set, update the FPSCR. 156 * Update the FPSCR with the additional exception flags.
157 * Comparison instructions always return at least one of 157 * Comparison instructions always return at least one of
158 * these flags set. 158 * these flags set.
159 */ 159 */
160 if (exceptions & (FPSCR_N|FPSCR_Z|FPSCR_C|FPSCR_V))
161 fpscr &= ~(FPSCR_N|FPSCR_Z|FPSCR_C|FPSCR_V);
162
163 fpscr |= exceptions; 160 fpscr |= exceptions;
164 161
165 fmxr(FPSCR, fpscr); 162 fmxr(FPSCR, fpscr);
@@ -220,35 +217,64 @@ static u32 vfp_emulate_instruction(u32 inst, u32 fpscr, struct pt_regs *regs)
220/* 217/*
221 * Package up a bounce condition. 218 * Package up a bounce condition.
222 */ 219 */
223void VFP9_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs) 220void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
224{ 221{
225 u32 fpscr, orig_fpscr, exceptions, inst; 222 u32 fpscr, orig_fpscr, fpsid, exceptions;
226 223
227 pr_debug("VFP: bounce: trigger %08x fpexc %08x\n", trigger, fpexc); 224 pr_debug("VFP: bounce: trigger %08x fpexc %08x\n", trigger, fpexc);
228 225
229 /* 226 /*
230 * Enable access to the VFP so we can handle the bounce. 227 * At this point, FPEXC can have the following configuration:
228 *
229 * EX DEX IXE
230 * 0 1 x - synchronous exception
231 * 1 x 0 - asynchronous exception
232 * 1 x 1 - sychronous on VFP subarch 1 and asynchronous on later
233 * 0 0 1 - synchronous on VFP9 (non-standard subarch 1
234 * implementation), undefined otherwise
235 *
236 * Clear various bits and enable access to the VFP so we can
237 * handle the bounce.
231 */ 238 */
232 fmxr(FPEXC, fpexc & ~(FPEXC_EX|FPEXC_FPV2|FPEXC_INV|FPEXC_UFC|FPEXC_OFC|FPEXC_IOC)); 239 fmxr(FPEXC, fpexc & ~(FPEXC_EX|FPEXC_DEX|FPEXC_FP2V|FPEXC_VV|FPEXC_TRAP_MASK));
233 240
241 fpsid = fmrx(FPSID);
234 orig_fpscr = fpscr = fmrx(FPSCR); 242 orig_fpscr = fpscr = fmrx(FPSCR);
235 243
236 /* 244 /*
237 * If we are running with inexact exceptions enabled, we need to 245 * Check for the special VFP subarch 1 and FPSCR.IXE bit case
238 * emulate the trigger instruction. Note that as we're emulating
239 * the trigger instruction, we need to increment PC.
240 */ 246 */
241 if (fpscr & FPSCR_IXE) { 247 if ((fpsid & FPSID_ARCH_MASK) == (1 << FPSID_ARCH_BIT)
242 regs->ARM_pc += 4; 248 && (fpscr & FPSCR_IXE)) {
249 /*
250 * Synchronous exception, emulate the trigger instruction
251 */
243 goto emulate; 252 goto emulate;
244 } 253 }
245 254
246 barrier(); 255 if (fpexc & FPEXC_EX) {
256 /*
257 * Asynchronous exception. The instruction is read from FPINST
258 * and the interrupted instruction has to be restarted.
259 */
260 trigger = fmrx(FPINST);
261 regs->ARM_pc -= 4;
262 } else if (!(fpexc & FPEXC_DEX)) {
263 /*
264 * Illegal combination of bits. It can be caused by an
265 * unallocated VFP instruction but with FPSCR.IXE set and not
266 * on VFP subarch 1.
267 */
268 vfp_raise_exceptions(VFP_EXCEPTION_ERROR, trigger, fpscr, regs);
269 return;
270 }
247 271
248 /* 272 /*
249 * Modify fpscr to indicate the number of iterations remaining 273 * Modify fpscr to indicate the number of iterations remaining.
274 * If FPEXC.EX is 0, FPEXC.DEX is 1 and the FPEXC.VV bit indicates
275 * whether FPEXC.VECITR or FPSCR.LEN is used.
250 */ 276 */
251 if (fpexc & FPEXC_EX) { 277 if (fpexc & (FPEXC_EX | FPEXC_VV)) {
252 u32 len; 278 u32 len;
253 279
254 len = fpexc + (1 << FPEXC_LENGTH_BIT); 280 len = fpexc + (1 << FPEXC_LENGTH_BIT);
@@ -262,15 +288,15 @@ void VFP9_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
262 * FPEXC bounce reason, but this appears to be unreliable. 288 * FPEXC bounce reason, but this appears to be unreliable.
263 * Emulate the bounced instruction instead. 289 * Emulate the bounced instruction instead.
264 */ 290 */
265 inst = fmrx(FPINST); 291 exceptions = vfp_emulate_instruction(trigger, fpscr, regs);
266 exceptions = vfp_emulate_instruction(inst, fpscr, regs);
267 if (exceptions) 292 if (exceptions)
268 vfp_raise_exceptions(exceptions, inst, orig_fpscr, regs); 293 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs);
269 294
270 /* 295 /*
271 * If there isn't a second FP instruction, exit now. 296 * If there isn't a second FP instruction, exit now. Note that
297 * the FPEXC.FP2V bit is valid only if FPEXC.EX is 1.
272 */ 298 */
273 if (!(fpexc & FPEXC_FPV2)) 299 if (fpexc ^ (FPEXC_EX | FPEXC_FP2V))
274 return; 300 return;
275 301
276 /* 302 /*
@@ -279,10 +305,9 @@ void VFP9_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
279 */ 305 */
280 barrier(); 306 barrier();
281 trigger = fmrx(FPINST2); 307 trigger = fmrx(FPINST2);
282 orig_fpscr = fpscr = fmrx(FPSCR);
283 308
284 emulate: 309 emulate:
285 exceptions = vfp_emulate_instruction(trigger, fpscr, regs); 310 exceptions = vfp_emulate_instruction(trigger, orig_fpscr, regs);
286 if (exceptions) 311 if (exceptions)
287 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs); 312 vfp_raise_exceptions(exceptions, trigger, orig_fpscr, regs);
288} 313}
@@ -306,16 +331,9 @@ static int __init vfp_init(void)
306{ 331{
307 unsigned int vfpsid; 332 unsigned int vfpsid;
308 unsigned int cpu_arch = cpu_architecture(); 333 unsigned int cpu_arch = cpu_architecture();
309 u32 access = 0;
310 334
311 if (cpu_arch >= CPU_ARCH_ARMv6) { 335 if (cpu_arch >= CPU_ARCH_ARMv6)
312 access = get_copro_access(); 336 vfp_enable(NULL);
313
314 /*
315 * Enable full access to VFP (cp10 and cp11)
316 */
317 set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
318 }
319 337
320 /* 338 /*
321 * First check that there is a VFP that we can use. 339 * First check that there is a VFP that we can use.
@@ -329,15 +347,9 @@ static int __init vfp_init(void)
329 vfp_vector = vfp_null_entry; 347 vfp_vector = vfp_null_entry;
330 348
331 printk(KERN_INFO "VFP support v0.3: "); 349 printk(KERN_INFO "VFP support v0.3: ");
332 if (VFP_arch) { 350 if (VFP_arch)
333 printk("not present\n"); 351 printk("not present\n");
334 352 else if (vfpsid & FPSID_NODOUBLE) {
335 /*
336 * Restore the copro access register.
337 */
338 if (cpu_arch >= CPU_ARCH_ARMv6)
339 set_copro_access(access);
340 } else if (vfpsid & FPSID_NODOUBLE) {
341 printk("no double precision support\n"); 353 printk("no double precision support\n");
342 } else { 354 } else {
343 smp_call_function(vfp_enable, NULL, 1, 1); 355 smp_call_function(vfp_enable, NULL, 1, 1);
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index 25232ba08119..fc7ca86ac8bf 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -85,11 +85,26 @@ config BF522
85 help 85 help
86 BF522 Processor Support. 86 BF522 Processor Support.
87 87
88config BF523
89 bool "BF523"
90 help
91 BF523 Processor Support.
92
93config BF524
94 bool "BF524"
95 help
96 BF524 Processor Support.
97
88config BF525 98config BF525
89 bool "BF525" 99 bool "BF525"
90 help 100 help
91 BF525 Processor Support. 101 BF525 Processor Support.
92 102
103config BF526
104 bool "BF526"
105 help
106 BF526 Processor Support.
107
93config BF527 108config BF527
94 bool "BF527" 109 bool "BF527"
95 help 110 help
@@ -198,7 +213,7 @@ endchoice
198 213
199config BF52x 214config BF52x
200 bool 215 bool
201 depends on (BF522 || BF525 || BF527) 216 depends on (BF522 || BF523 || BF524 || BF525 || BF526 || BF527)
202 default y 217 default y
203 218
204config BF53x 219config BF53x
@@ -253,11 +268,6 @@ config MEM_MT48LC32M16A2TG_75
253 depends on (BFIN527_EZKIT) 268 depends on (BFIN527_EZKIT)
254 default y 269 default y
255 270
256config BFIN_SHARED_FLASH_ENET
257 bool
258 depends on (BFIN533_STAMP)
259 default y
260
261source "arch/blackfin/mach-bf527/Kconfig" 271source "arch/blackfin/mach-bf527/Kconfig"
262source "arch/blackfin/mach-bf533/Kconfig" 272source "arch/blackfin/mach-bf533/Kconfig"
263source "arch/blackfin/mach-bf561/Kconfig" 273source "arch/blackfin/mach-bf561/Kconfig"
@@ -317,7 +327,7 @@ config VCO_MULT
317 range 1 64 327 range 1 64
318 default "22" if BFIN533_EZKIT 328 default "22" if BFIN533_EZKIT
319 default "45" if BFIN533_STAMP 329 default "45" if BFIN533_STAMP
320 default "20" if (BFIN537_STAMP || BFIN527_EZKIT) 330 default "20" if (BFIN537_STAMP || BFIN527_EZKIT || BFIN548_EZKIT)
321 default "22" if BFIN533_BLUETECHNIX_CM 331 default "22" if BFIN533_BLUETECHNIX_CM
322 default "20" if BFIN537_BLUETECHNIX_CM 332 default "20" if BFIN537_BLUETECHNIX_CM
323 default "20" if BFIN561_BLUETECHNIX_CM 333 default "20" if BFIN561_BLUETECHNIX_CM
@@ -354,7 +364,7 @@ config SCLK_DIV
354 range 1 15 364 range 1 15
355 default 5 if BFIN533_EZKIT 365 default 5 if BFIN533_EZKIT
356 default 5 if BFIN533_STAMP 366 default 5 if BFIN533_STAMP
357 default 4 if (BFIN537_STAMP || BFIN527_EZKIT) 367 default 4 if (BFIN537_STAMP || BFIN527_EZKIT || BFIN548_EZKIT)
358 default 5 if BFIN533_BLUETECHNIX_CM 368 default 5 if BFIN533_BLUETECHNIX_CM
359 default 4 if BFIN537_BLUETECHNIX_CM 369 default 4 if BFIN537_BLUETECHNIX_CM
360 default 4 if BFIN561_BLUETECHNIX_CM 370 default 4 if BFIN561_BLUETECHNIX_CM
@@ -371,7 +381,10 @@ config SCLK_DIV
371config MAX_VCO_HZ 381config MAX_VCO_HZ
372 int 382 int
373 default 600000000 if BF522 383 default 600000000 if BF522
384 default 400000000 if BF523
385 default 400000000 if BF524
374 default 600000000 if BF525 386 default 600000000 if BF525
387 default 400000000 if BF526
375 default 600000000 if BF527 388 default 600000000 if BF527
376 default 400000000 if BF531 389 default 400000000 if BF531
377 default 400000000 if BF532 390 default 400000000 if BF532
@@ -383,6 +396,8 @@ config MAX_VCO_HZ
383 default 533333333 if BF539 396 default 533333333 if BF539
384 default 600000000 if BF542 397 default 600000000 if BF542
385 default 533333333 if BF544 398 default 533333333 if BF544
399 default 600000000 if BF547
400 default 600000000 if BF548
386 default 533333333 if BF549 401 default 533333333 if BF549
387 default 600000000 if BF561 402 default 600000000 if BF561
388 403
@@ -409,6 +424,7 @@ config MEM_SIZE
409 default 32 if BFIN533_EZKIT 424 default 32 if BFIN533_EZKIT
410 default 64 if BFIN527_EZKIT 425 default 64 if BFIN527_EZKIT
411 default 64 if BFIN537_STAMP 426 default 64 if BFIN537_STAMP
427 default 64 if BFIN548_EZKIT
412 default 64 if BFIN561_EZKIT 428 default 64 if BFIN561_EZKIT
413 default 128 if BFIN533_STAMP 429 default 128 if BFIN533_STAMP
414 default 64 if PNAV10 430 default 64 if PNAV10
@@ -416,6 +432,7 @@ config MEM_SIZE
416 432
417config MEM_ADD_WIDTH 433config MEM_ADD_WIDTH
418 int "SDRAM Memory Address Width" 434 int "SDRAM Memory Address Width"
435 depends on (!BF54x)
419 default 9 if BFIN533_EZKIT 436 default 9 if BFIN533_EZKIT
420 default 9 if BFIN561_EZKIT 437 default 9 if BFIN561_EZKIT
421 default 9 if H8606_HVSISTEMAS 438 default 9 if H8606_HVSISTEMAS
@@ -424,6 +441,19 @@ config MEM_ADD_WIDTH
424 default 11 if BFIN533_STAMP 441 default 11 if BFIN533_STAMP
425 default 10 if PNAV10 442 default 10 if PNAV10
426 443
444
445choice
446 prompt "DDR SDRAM Chip Type"
447 depends on BFIN548_EZKIT
448 default MEM_MT46V32M16_5B
449
450config MEM_MT46V32M16_6T
451 bool "MT46V32M16_6T"
452
453config MEM_MT46V32M16_5B
454 bool "MT46V32M16_5B"
455endchoice
456
427config ENET_FLASH_PIN 457config ENET_FLASH_PIN
428 int "PF port/pin used for flash and ethernet sharing" 458 int "PF port/pin used for flash and ethernet sharing"
429 depends on (BFIN533_STAMP) 459 depends on (BFIN533_STAMP)
@@ -448,40 +478,6 @@ config BOOT_LOAD
448 memory region is used to capture NULL pointer references as well 478 memory region is used to capture NULL pointer references as well
449 as some core kernel functions. 479 as some core kernel functions.
450 480
451comment "LED Status Indicators"
452 depends on (BFIN533_STAMP || BFIN533_BLUETECHNIX_CM)
453
454config BFIN_ALIVE_LED
455 bool "Enable Board Alive"
456 depends on (BFIN533_STAMP || BFIN533_BLUETECHNIX_CM)
457 default n
458 help
459 Blink the LEDs you select when the kernel is running. Helps detect
460 a hung kernel.
461
462config BFIN_ALIVE_LED_NUM
463 int "LED"
464 depends on BFIN_ALIVE_LED
465 range 1 3 if BFIN533_STAMP
466 default "3" if BFIN533_STAMP
467 help
468 Select the LED (marked on the board) for you to blink.
469
470config BFIN_IDLE_LED
471 bool "Enable System Load/Idle LED"
472 depends on (BFIN533_STAMP || BFIN533_BLUETECHNIX_CM)
473 default n
474 help
475 Blinks the LED you select when to determine kernel load.
476
477config BFIN_IDLE_LED_NUM
478 int "LED"
479 depends on BFIN_IDLE_LED
480 range 1 3 if BFIN533_STAMP
481 default "2" if BFIN533_STAMP
482 help
483 Select the LED (marked on the board) for you to blink.
484
485choice 481choice
486 prompt "Blackfin Exception Scratch Register" 482 prompt "Blackfin Exception Scratch Register"
487 default BFIN_SCRATCH_REG_RETN 483 default BFIN_SCRATCH_REG_RETN
@@ -528,41 +524,6 @@ config BFIN_SCRATCH_REG_CYCLES
528 524
529endchoice 525endchoice
530 526
531#
532# Sorry - but you need to put the hex address here -
533#
534
535# Flag Data register
536config BFIN_ALIVE_LED_PORT
537 hex
538 default 0xFFC00700 if (BFIN533_STAMP)
539
540# Peripheral Flag Direction Register
541config BFIN_ALIVE_LED_DPORT
542 hex
543 default 0xFFC00730 if (BFIN533_STAMP)
544
545config BFIN_ALIVE_LED_PIN
546 hex
547 default 0x04 if (BFIN533_STAMP && BFIN_ALIVE_LED_NUM = 1)
548 default 0x08 if (BFIN533_STAMP && BFIN_ALIVE_LED_NUM = 2)
549 default 0x10 if (BFIN533_STAMP && BFIN_ALIVE_LED_NUM = 3)
550
551config BFIN_IDLE_LED_PORT
552 hex
553 default 0xFFC00700 if (BFIN533_STAMP)
554
555# Peripheral Flag Direction Register
556config BFIN_IDLE_LED_DPORT
557 hex
558 default 0xFFC00730 if (BFIN533_STAMP)
559
560config BFIN_IDLE_LED_PIN
561 hex
562 default 0x04 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 1)
563 default 0x08 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 2)
564 default 0x10 if (BFIN533_STAMP && BFIN_IDLE_LED_NUM = 3)
565
566endmenu 527endmenu
567 528
568 529
@@ -799,6 +760,15 @@ config L1_MAX_PIECE
799 Set the max memory pieces for the L1 SRAM allocation algorithm. 760 Set the max memory pieces for the L1 SRAM allocation algorithm.
800 Min value is 16. Max value is 1024. 761 Min value is 16. Max value is 1024.
801 762
763
764config MPU
765 bool "Enable the memory protection unit (EXPERIMENTAL)"
766 default n
767 help
768 Use the processor's MPU to protect applications from accessing
769 memory they do not own. This comes at a performance penalty
770 and is recommended only for debugging.
771
802comment "Asynchonous Memory Configuration" 772comment "Asynchonous Memory Configuration"
803 773
804menu "EBIU_AMGCTL Global Control" 774menu "EBIU_AMGCTL Global Control"
@@ -808,7 +778,6 @@ config C_AMCKEN
808 778
809config C_CDPRIO 779config C_CDPRIO
810 bool "DMA has priority over core for ext. accesses" 780 bool "DMA has priority over core for ext. accesses"
811 depends on !BF54x
812 default n 781 default n
813 782
814config C_B0PEN 783config C_B0PEN
@@ -949,8 +918,10 @@ endchoice
949config PM_WAKEUP_SIC_IWR 918config PM_WAKEUP_SIC_IWR
950 hex "Wakeup Events (SIC_IWR)" 919 hex "Wakeup Events (SIC_IWR)"
951 depends on PM_WAKEUP_GPIO_BY_SIC_IWR 920 depends on PM_WAKEUP_GPIO_BY_SIC_IWR
952 default 0x80000000 if (BF537 || BF536 || BF534) 921 default 0x8 if (BF537 || BF536 || BF534)
953 default 0x100000 if (BF533 || BF532 || BF531) 922 default 0x80 if (BF533 || BF532 || BF531)
923 default 0x80 if (BF54x)
924 default 0x80 if (BF52x)
954 925
955config PM_WAKEUP_GPIO_NUMBER 926config PM_WAKEUP_GPIO_NUMBER
956 int "Wakeup GPIO number" 927 int "Wakeup GPIO number"
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index c47e000f8324..0edc402fef54 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -21,7 +21,10 @@ KBUILD_DEFCONFIG := BF537-STAMP_defconfig
21 21
22# setup the machine name and the machine dependent settings 22# setup the machine name and the machine dependent settings
23machine-$(CONFIG_BF522) := bf527 23machine-$(CONFIG_BF522) := bf527
24machine-$(CONFIG_BF523) := bf527
25machine-$(CONFIG_BF524) := bf527
24machine-$(CONFIG_BF525) := bf527 26machine-$(CONFIG_BF525) := bf527
27machine-$(CONFIG_BF526) := bf527
25machine-$(CONFIG_BF527) := bf527 28machine-$(CONFIG_BF527) := bf527
26machine-$(CONFIG_BF531) := bf533 29machine-$(CONFIG_BF531) := bf533
27machine-$(CONFIG_BF532) := bf533 30machine-$(CONFIG_BF532) := bf533
@@ -39,7 +42,10 @@ MACHINE := $(machine-y)
39export MACHINE 42export MACHINE
40 43
41cpu-$(CONFIG_BF522) := bf522 44cpu-$(CONFIG_BF522) := bf522
45cpu-$(CONFIG_BF523) := bf523
46cpu-$(CONFIG_BF524) := bf524
42cpu-$(CONFIG_BF525) := bf525 47cpu-$(CONFIG_BF525) := bf525
48cpu-$(CONFIG_BF526) := bf526
43cpu-$(CONFIG_BF527) := bf527 49cpu-$(CONFIG_BF527) := bf527
44cpu-$(CONFIG_BF531) := bf531 50cpu-$(CONFIG_BF531) := bf531
45cpu-$(CONFIG_BF532) := bf532 51cpu-$(CONFIG_BF532) := bf532
@@ -76,6 +82,12 @@ core-y += arch/$(ARCH)/mach-$(MACHINE)/
76core-y += arch/$(ARCH)/mach-$(MACHINE)/boards/ 82core-y += arch/$(ARCH)/mach-$(MACHINE)/boards/
77endif 83endif
78 84
85ifeq ($(CONFIG_MPU),y)
86core-y += arch/$(ARCH)/kernel/cplb-mpu/
87else
88core-y += arch/$(ARCH)/kernel/cplb-nompu/
89endif
90
79libs-y += arch/$(ARCH)/lib/ 91libs-y += arch/$(ARCH)/lib/
80 92
81drivers-$(CONFIG_OPROFILE) += arch/$(ARCH)/oprofile/ 93drivers-$(CONFIG_OPROFILE) += arch/$(ARCH)/oprofile/
diff --git a/arch/blackfin/configs/BF527-EZKIT_defconfig b/arch/blackfin/configs/BF527-EZKIT_defconfig
index fa6eb4e00fae..d59ee1530bd4 100644
--- a/arch/blackfin/configs/BF527-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF527-EZKIT_defconfig
@@ -1,6 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.22.14
4# Thu Nov 29 17:32:47 2007
4# 5#
5# CONFIG_MMU is not set 6# CONFIG_MMU is not set
6# CONFIG_FPU is not set 7# CONFIG_FPU is not set
@@ -153,8 +154,8 @@ CONFIG_BFIN527_EZKIT=y
153CONFIG_BF527_SPORT0_PORTG=y 154CONFIG_BF527_SPORT0_PORTG=y
154CONFIG_BF527_SPORT0_TSCLK_PG10=y 155CONFIG_BF527_SPORT0_TSCLK_PG10=y
155# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set 156# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
156# CONFIG_BF527_UART1_PORTF is not set 157CONFIG_BF527_UART1_PORTF=y
157CONFIG_BF527_UART1_PORTG=y 158# CONFIG_BF527_UART1_PORTG is not set
158# CONFIG_BF527_NAND_D_PORTF is not set 159# CONFIG_BF527_NAND_D_PORTF is not set
159CONFIG_BF527_NAND_D_PORTH=y 160CONFIG_BF527_NAND_D_PORTH=y
160 161
@@ -232,7 +233,7 @@ CONFIG_CLKIN_HZ=25000000
232# CONFIG_BFIN_KERNEL_CLOCK is not set 233# CONFIG_BFIN_KERNEL_CLOCK is not set
233CONFIG_MAX_VCO_HZ=600000000 234CONFIG_MAX_VCO_HZ=600000000
234CONFIG_MIN_VCO_HZ=50000000 235CONFIG_MIN_VCO_HZ=50000000
235CONFIG_MAX_SCLK_HZ=133000000 236CONFIG_MAX_SCLK_HZ=133333333
236CONFIG_MIN_SCLK_HZ=27000000 237CONFIG_MIN_SCLK_HZ=27000000
237 238
238# 239#
@@ -626,8 +627,8 @@ CONFIG_BFIN_MAC_RMII=y
626# CONFIG_SMSC911X is not set 627# CONFIG_SMSC911X is not set
627# CONFIG_DM9000 is not set 628# CONFIG_DM9000 is not set
628CONFIG_NETDEV_1000=y 629CONFIG_NETDEV_1000=y
629CONFIG_NETDEV_10000=y
630# CONFIG_AX88180 is not set 630# CONFIG_AX88180 is not set
631CONFIG_NETDEV_10000=y
631 632
632# 633#
633# Wireless LAN 634# Wireless LAN
@@ -1183,7 +1184,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
1183# 1184#
1184# CONFIG_PRINTK_TIME is not set 1185# CONFIG_PRINTK_TIME is not set
1185CONFIG_ENABLE_MUST_CHECK=y 1186CONFIG_ENABLE_MUST_CHECK=y
1186CONFIG_MAGIC_SYSRQ=y 1187# CONFIG_MAGIC_SYSRQ is not set
1187# CONFIG_UNUSED_SYMBOLS is not set 1188# CONFIG_UNUSED_SYMBOLS is not set
1188CONFIG_DEBUG_FS=y 1189CONFIG_DEBUG_FS=y
1189# CONFIG_HEADERS_CHECK is not set 1190# CONFIG_HEADERS_CHECK is not set
@@ -1208,7 +1209,7 @@ CONFIG_ACCESS_CHECK=y
1208# CONFIG_KEYS is not set 1209# CONFIG_KEYS is not set
1209CONFIG_SECURITY=y 1210CONFIG_SECURITY=y
1210# CONFIG_SECURITY_NETWORK is not set 1211# CONFIG_SECURITY_NETWORK is not set
1211CONFIG_SECURITY_CAPABILITIES=y 1212CONFIG_SECURITY_CAPABILITIES=m
1212 1213
1213# 1214#
1214# Cryptographic options 1215# Cryptographic options
@@ -1219,7 +1220,7 @@ CONFIG_SECURITY_CAPABILITIES=y
1219# Library routines 1220# Library routines
1220# 1221#
1221CONFIG_BITREVERSE=y 1222CONFIG_BITREVERSE=y
1222# CONFIG_CRC_CCITT is not set 1223CONFIG_CRC_CCITT=m
1223# CONFIG_CRC16 is not set 1224# CONFIG_CRC16 is not set
1224# CONFIG_CRC_ITU_T is not set 1225# CONFIG_CRC_ITU_T is not set
1225CONFIG_CRC32=y 1226CONFIG_CRC32=y
diff --git a/arch/blackfin/configs/BF533-EZKIT_defconfig b/arch/blackfin/configs/BF533-EZKIT_defconfig
index 4fdb49362ba3..811711f59a25 100644
--- a/arch/blackfin/configs/BF533-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF533-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.22.16
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,7 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# Processor and Board Settings 115# Processor and Board Settings
116# 116#
117# CONFIG_BF522 is not set 117# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set
118# CONFIG_BF525 is not set 120# CONFIG_BF525 is not set
121# CONFIG_BF526 is not set
119# CONFIG_BF527 is not set 122# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
@@ -194,7 +197,7 @@ CONFIG_CLKIN_HZ=27000000
194# CONFIG_BFIN_KERNEL_CLOCK is not set 197# CONFIG_BFIN_KERNEL_CLOCK is not set
195CONFIG_MAX_VCO_HZ=750000000 198CONFIG_MAX_VCO_HZ=750000000
196CONFIG_MIN_VCO_HZ=50000000 199CONFIG_MIN_VCO_HZ=50000000
197CONFIG_MAX_SCLK_HZ=133000000 200CONFIG_MAX_SCLK_HZ=133333333
198CONFIG_MIN_SCLK_HZ=27000000 201CONFIG_MIN_SCLK_HZ=27000000
199 202
200# 203#
@@ -267,6 +270,7 @@ CONFIG_BFIN_DCACHE=y
267# CONFIG_BFIN_WB is not set 270# CONFIG_BFIN_WB is not set
268CONFIG_BFIN_WT=y 271CONFIG_BFIN_WT=y
269CONFIG_L1_MAX_PIECE=16 272CONFIG_L1_MAX_PIECE=16
273# CONFIG_MPU is not set
270 274
271# 275#
272# Asynchonous Memory Configuration 276# Asynchonous Memory Configuration
@@ -321,7 +325,7 @@ CONFIG_PM=y
321CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 325CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
322# CONFIG_PM_WAKEUP_BY_GPIO is not set 326# CONFIG_PM_WAKEUP_BY_GPIO is not set
323# CONFIG_PM_WAKEUP_GPIO_API is not set 327# CONFIG_PM_WAKEUP_GPIO_API is not set
324CONFIG_PM_WAKEUP_SIC_IWR=0x100000 328CONFIG_PM_WAKEUP_SIC_IWR=0x80
325 329
326# 330#
327# CPU Frequency scaling 331# CPU Frequency scaling
@@ -510,7 +514,6 @@ CONFIG_MTD_CFI_I2=y
510# CONFIG_MTD_CFI_INTELEXT is not set 514# CONFIG_MTD_CFI_INTELEXT is not set
511# CONFIG_MTD_CFI_AMDSTD is not set 515# CONFIG_MTD_CFI_AMDSTD is not set
512# CONFIG_MTD_CFI_STAA is not set 516# CONFIG_MTD_CFI_STAA is not set
513CONFIG_MTD_MW320D=m
514CONFIG_MTD_RAM=y 517CONFIG_MTD_RAM=y
515CONFIG_MTD_ROM=m 518CONFIG_MTD_ROM=m
516# CONFIG_MTD_ABSENT is not set 519# CONFIG_MTD_ABSENT is not set
@@ -520,9 +523,6 @@ CONFIG_MTD_ROM=m
520# 523#
521CONFIG_MTD_COMPLEX_MAPPINGS=y 524CONFIG_MTD_COMPLEX_MAPPINGS=y
522# CONFIG_MTD_PHYSMAP is not set 525# CONFIG_MTD_PHYSMAP is not set
523CONFIG_MTD_BF5xx=m
524CONFIG_BFIN_FLASH_SIZE=0x400000
525CONFIG_EBIU_FLASH_BASE=0x20000000
526# CONFIG_MTD_UCLINUX is not set 526# CONFIG_MTD_UCLINUX is not set
527# CONFIG_MTD_PLATRAM is not set 527# CONFIG_MTD_PLATRAM is not set
528 528
@@ -610,8 +610,8 @@ CONFIG_SMC91X=y
610# CONFIG_SMSC911X is not set 610# CONFIG_SMSC911X is not set
611# CONFIG_DM9000 is not set 611# CONFIG_DM9000 is not set
612CONFIG_NETDEV_1000=y 612CONFIG_NETDEV_1000=y
613CONFIG_NETDEV_10000=y
614# CONFIG_AX88180 is not set 613# CONFIG_AX88180 is not set
614CONFIG_NETDEV_10000=y
615 615
616# 616#
617# Wireless LAN 617# Wireless LAN
@@ -680,7 +680,6 @@ CONFIG_INPUT_EVDEV=m
680CONFIG_BFIN_SPORT=y 680CONFIG_BFIN_SPORT=y
681# CONFIG_BFIN_TIMER_LATENCY is not set 681# CONFIG_BFIN_TIMER_LATENCY is not set
682# CONFIG_AD5304 is not set 682# CONFIG_AD5304 is not set
683# CONFIG_BF5xx_FBDMA is not set
684# CONFIG_VT is not set 683# CONFIG_VT is not set
685# CONFIG_SERIAL_NONSTANDARD is not set 684# CONFIG_SERIAL_NONSTANDARD is not set
686 685
diff --git a/arch/blackfin/configs/BF533-STAMP_defconfig b/arch/blackfin/configs/BF533-STAMP_defconfig
index b04e8e533e9a..9b7123cf27a3 100644
--- a/arch/blackfin/configs/BF533-STAMP_defconfig
+++ b/arch/blackfin/configs/BF533-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.22.16
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,7 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# Processor and Board Settings 115# Processor and Board Settings
116# 116#
117# CONFIG_BF522 is not set 117# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set
118# CONFIG_BF525 is not set 120# CONFIG_BF525 is not set
121# CONFIG_BF526 is not set
119# CONFIG_BF527 is not set 122# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
@@ -140,7 +143,6 @@ CONFIG_BF_REV_0_3=y
140CONFIG_BF53x=y 143CONFIG_BF53x=y
141CONFIG_BFIN_SINGLE_CORE=y 144CONFIG_BFIN_SINGLE_CORE=y
142CONFIG_MEM_MT48LC64M4A2FB_7E=y 145CONFIG_MEM_MT48LC64M4A2FB_7E=y
143CONFIG_BFIN_SHARED_FLASH_ENET=y
144# CONFIG_BFIN533_EZKIT is not set 146# CONFIG_BFIN533_EZKIT is not set
145CONFIG_BFIN533_STAMP=y 147CONFIG_BFIN533_STAMP=y
146# CONFIG_BFIN533_BLUETECHNIX_CM is not set 148# CONFIG_BFIN533_BLUETECHNIX_CM is not set
@@ -195,7 +197,7 @@ CONFIG_CLKIN_HZ=11059200
195# CONFIG_BFIN_KERNEL_CLOCK is not set 197# CONFIG_BFIN_KERNEL_CLOCK is not set
196CONFIG_MAX_VCO_HZ=750000000 198CONFIG_MAX_VCO_HZ=750000000
197CONFIG_MIN_VCO_HZ=50000000 199CONFIG_MIN_VCO_HZ=50000000
198CONFIG_MAX_SCLK_HZ=133000000 200CONFIG_MAX_SCLK_HZ=133333333
199CONFIG_MIN_SCLK_HZ=27000000 201CONFIG_MIN_SCLK_HZ=27000000
200 202
201# 203#
@@ -215,18 +217,10 @@ CONFIG_MEM_ADD_WIDTH=11
215CONFIG_ENET_FLASH_PIN=0 217CONFIG_ENET_FLASH_PIN=0
216CONFIG_BOOT_LOAD=0x1000 218CONFIG_BOOT_LOAD=0x1000
217 219
218# 220
219# LED Status Indicators
220#
221# CONFIG_BFIN_ALIVE_LED is not set
222# CONFIG_BFIN_IDLE_LED is not set
223CONFIG_BFIN_SCRATCH_REG_RETN=y 221CONFIG_BFIN_SCRATCH_REG_RETN=y
224# CONFIG_BFIN_SCRATCH_REG_RETE is not set 222# CONFIG_BFIN_SCRATCH_REG_RETE is not set
225# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set 223# CONFIG_BFIN_SCRATCH_REG_CYCLES is not set
226CONFIG_BFIN_ALIVE_LED_PORT=0xFFC00700
227CONFIG_BFIN_ALIVE_LED_DPORT=0xFFC00730
228CONFIG_BFIN_IDLE_LED_PORT=0xFFC00700
229CONFIG_BFIN_IDLE_LED_DPORT=0xFFC00730
230 224
231# 225#
232# Blackfin Kernel Optimizations 226# Blackfin Kernel Optimizations
@@ -279,6 +273,7 @@ CONFIG_BFIN_DCACHE=y
279# CONFIG_BFIN_WB is not set 273# CONFIG_BFIN_WB is not set
280CONFIG_BFIN_WT=y 274CONFIG_BFIN_WT=y
281CONFIG_L1_MAX_PIECE=16 275CONFIG_L1_MAX_PIECE=16
276# CONFIG_MPU is not set
282 277
283# 278#
284# Asynchonous Memory Configuration 279# Asynchonous Memory Configuration
@@ -333,7 +328,7 @@ CONFIG_PM=y
333CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 328CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
334# CONFIG_PM_WAKEUP_BY_GPIO is not set 329# CONFIG_PM_WAKEUP_BY_GPIO is not set
335# CONFIG_PM_WAKEUP_GPIO_API is not set 330# CONFIG_PM_WAKEUP_GPIO_API is not set
336CONFIG_PM_WAKEUP_SIC_IWR=0x100000 331CONFIG_PM_WAKEUP_SIC_IWR=0x80
337 332
338# 333#
339# CPU Frequency scaling 334# CPU Frequency scaling
@@ -522,7 +517,6 @@ CONFIG_MTD_CFI_I2=y
522# CONFIG_MTD_CFI_INTELEXT is not set 517# CONFIG_MTD_CFI_INTELEXT is not set
523# CONFIG_MTD_CFI_AMDSTD is not set 518# CONFIG_MTD_CFI_AMDSTD is not set
524# CONFIG_MTD_CFI_STAA is not set 519# CONFIG_MTD_CFI_STAA is not set
525CONFIG_MTD_MW320D=m
526CONFIG_MTD_RAM=y 520CONFIG_MTD_RAM=y
527CONFIG_MTD_ROM=m 521CONFIG_MTD_ROM=m
528# CONFIG_MTD_ABSENT is not set 522# CONFIG_MTD_ABSENT is not set
@@ -532,17 +526,6 @@ CONFIG_MTD_ROM=m
532# 526#
533CONFIG_MTD_COMPLEX_MAPPINGS=y 527CONFIG_MTD_COMPLEX_MAPPINGS=y
534# CONFIG_MTD_PHYSMAP is not set 528# CONFIG_MTD_PHYSMAP is not set
535CONFIG_MTD_BF5xx=m
536CONFIG_BFIN_FLASH_SIZE=0x400000
537CONFIG_EBIU_FLASH_BASE=0x20000000
538
539#
540# FLASH_EBIU_AMBCTL Control
541#
542CONFIG_BFIN_FLASH_BANK_0=0x7BB0
543CONFIG_BFIN_FLASH_BANK_1=0x7BB0
544CONFIG_BFIN_FLASH_BANK_2=0x7BB0
545CONFIG_BFIN_FLASH_BANK_3=0x7BB0
546# CONFIG_MTD_UCLINUX is not set 529# CONFIG_MTD_UCLINUX is not set
547# CONFIG_MTD_PLATRAM is not set 530# CONFIG_MTD_PLATRAM is not set
548 531
@@ -630,8 +613,8 @@ CONFIG_SMC91X=y
630# CONFIG_SMSC911X is not set 613# CONFIG_SMSC911X is not set
631# CONFIG_DM9000 is not set 614# CONFIG_DM9000 is not set
632CONFIG_NETDEV_1000=y 615CONFIG_NETDEV_1000=y
633CONFIG_NETDEV_10000=y
634# CONFIG_AX88180 is not set 616# CONFIG_AX88180 is not set
617CONFIG_NETDEV_10000=y
635 618
636# 619#
637# Wireless LAN 620# Wireless LAN
@@ -687,7 +670,6 @@ CONFIG_INPUT_MISC=y
687# CONFIG_INPUT_POWERMATE is not set 670# CONFIG_INPUT_POWERMATE is not set
688# CONFIG_INPUT_YEALINK is not set 671# CONFIG_INPUT_YEALINK is not set
689# CONFIG_INPUT_UINPUT is not set 672# CONFIG_INPUT_UINPUT is not set
690# CONFIG_BF53X_PFBUTTONS is not set
691CONFIG_TWI_KEYPAD=m 673CONFIG_TWI_KEYPAD=m
692CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39 674CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=39
693 675
@@ -711,8 +693,6 @@ CONFIG_BFIN_SPORT=y
711CONFIG_TWI_LCD=m 693CONFIG_TWI_LCD=m
712CONFIG_TWI_LCD_SLAVE_ADDR=34 694CONFIG_TWI_LCD_SLAVE_ADDR=34
713# CONFIG_AD5304 is not set 695# CONFIG_AD5304 is not set
714# CONFIG_BF5xx_TEA5764 is not set
715# CONFIG_BF5xx_FBDMA is not set
716# CONFIG_VT is not set 696# CONFIG_VT is not set
717# CONFIG_SERIAL_NONSTANDARD is not set 697# CONFIG_SERIAL_NONSTANDARD is not set
718 698
@@ -778,7 +758,6 @@ CONFIG_I2C_ALGOBIT=m
778# 758#
779# I2C Hardware Bus support 759# I2C Hardware Bus support
780# 760#
781# CONFIG_I2C_BLACKFIN_GPIO is not set
782# CONFIG_I2C_GPIO is not set 761# CONFIG_I2C_GPIO is not set
783# CONFIG_I2C_OCORES is not set 762# CONFIG_I2C_OCORES is not set
784# CONFIG_I2C_PARPORT_LIGHT is not set 763# CONFIG_I2C_PARPORT_LIGHT is not set
diff --git a/arch/blackfin/configs/BF537-STAMP_defconfig b/arch/blackfin/configs/BF537-STAMP_defconfig
index f812b66318b9..b37ccc681e7a 100644
--- a/arch/blackfin/configs/BF537-STAMP_defconfig
+++ b/arch/blackfin/configs/BF537-STAMP_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.22.16
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,7 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# Processor and Board Settings 115# Processor and Board Settings
116# 116#
117# CONFIG_BF522 is not set 117# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set
118# CONFIG_BF525 is not set 120# CONFIG_BF525 is not set
121# CONFIG_BF526 is not set
119# CONFIG_BF527 is not set 122# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
@@ -170,6 +173,7 @@ CONFIG_IRQ_WATCH=13
170CONFIG_BFIN537_STAMP=y 173CONFIG_BFIN537_STAMP=y
171# CONFIG_BFIN537_BLUETECHNIX_CM is not set 174# CONFIG_BFIN537_BLUETECHNIX_CM is not set
172# CONFIG_PNAV10 is not set 175# CONFIG_PNAV10 is not set
176# CONFIG_CAMSIG_MINOTAUR is not set
173# CONFIG_GENERIC_BF537_BOARD is not set 177# CONFIG_GENERIC_BF537_BOARD is not set
174 178
175# 179#
@@ -201,7 +205,7 @@ CONFIG_CLKIN_HZ=25000000
201# CONFIG_BFIN_KERNEL_CLOCK is not set 205# CONFIG_BFIN_KERNEL_CLOCK is not set
202CONFIG_MAX_VCO_HZ=600000000 206CONFIG_MAX_VCO_HZ=600000000
203CONFIG_MIN_VCO_HZ=50000000 207CONFIG_MIN_VCO_HZ=50000000
204CONFIG_MAX_SCLK_HZ=133000000 208CONFIG_MAX_SCLK_HZ=133333333
205CONFIG_MIN_SCLK_HZ=27000000 209CONFIG_MIN_SCLK_HZ=27000000
206 210
207# 211#
@@ -274,6 +278,7 @@ CONFIG_BFIN_DCACHE=y
274# CONFIG_BFIN_WB is not set 278# CONFIG_BFIN_WB is not set
275CONFIG_BFIN_WT=y 279CONFIG_BFIN_WT=y
276CONFIG_L1_MAX_PIECE=16 280CONFIG_L1_MAX_PIECE=16
281# CONFIG_MPU is not set
277 282
278# 283#
279# Asynchonous Memory Configuration 284# Asynchonous Memory Configuration
@@ -328,7 +333,7 @@ CONFIG_PM=y
328CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y 333CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR=y
329# CONFIG_PM_WAKEUP_BY_GPIO is not set 334# CONFIG_PM_WAKEUP_BY_GPIO is not set
330# CONFIG_PM_WAKEUP_GPIO_API is not set 335# CONFIG_PM_WAKEUP_GPIO_API is not set
331CONFIG_PM_WAKEUP_SIC_IWR=0x80000000 336CONFIG_PM_WAKEUP_SIC_IWR=0x8
332 337
333# 338#
334# CPU Frequency scaling 339# CPU Frequency scaling
@@ -483,7 +488,7 @@ CONFIG_MTD=y
483# CONFIG_MTD_CONCAT is not set 488# CONFIG_MTD_CONCAT is not set
484CONFIG_MTD_PARTITIONS=y 489CONFIG_MTD_PARTITIONS=y
485# CONFIG_MTD_REDBOOT_PARTS is not set 490# CONFIG_MTD_REDBOOT_PARTS is not set
486# CONFIG_MTD_CMDLINE_PARTS is not set 491CONFIG_MTD_CMDLINE_PARTS=y
487 492
488# 493#
489# User Modules And Translation Layers 494# User Modules And Translation Layers
@@ -500,8 +505,8 @@ CONFIG_MTD_BLOCK=y
500# 505#
501# RAM/ROM/Flash chip drivers 506# RAM/ROM/Flash chip drivers
502# 507#
503# CONFIG_MTD_CFI is not set 508CONFIG_MTD_CFI=m
504CONFIG_MTD_JEDECPROBE=m 509# CONFIG_MTD_JEDECPROBE is not set
505CONFIG_MTD_GEN_PROBE=m 510CONFIG_MTD_GEN_PROBE=m
506# CONFIG_MTD_CFI_ADV_OPTIONS is not set 511# CONFIG_MTD_CFI_ADV_OPTIONS is not set
507CONFIG_MTD_MAP_BANK_WIDTH_1=y 512CONFIG_MTD_MAP_BANK_WIDTH_1=y
@@ -515,9 +520,9 @@ CONFIG_MTD_CFI_I2=y
515# CONFIG_MTD_CFI_I4 is not set 520# CONFIG_MTD_CFI_I4 is not set
516# CONFIG_MTD_CFI_I8 is not set 521# CONFIG_MTD_CFI_I8 is not set
517# CONFIG_MTD_CFI_INTELEXT is not set 522# CONFIG_MTD_CFI_INTELEXT is not set
518# CONFIG_MTD_CFI_AMDSTD is not set 523CONFIG_MTD_CFI_AMDSTD=m
519# CONFIG_MTD_CFI_STAA is not set 524# CONFIG_MTD_CFI_STAA is not set
520CONFIG_MTD_MW320D=m 525CONFIG_MTD_CFI_UTIL=m
521CONFIG_MTD_RAM=y 526CONFIG_MTD_RAM=y
522CONFIG_MTD_ROM=m 527CONFIG_MTD_ROM=m
523# CONFIG_MTD_ABSENT is not set 528# CONFIG_MTD_ABSENT is not set
@@ -525,11 +530,11 @@ CONFIG_MTD_ROM=m
525# 530#
526# Mapping drivers for chip access 531# Mapping drivers for chip access
527# 532#
528CONFIG_MTD_COMPLEX_MAPPINGS=y 533# CONFIG_MTD_COMPLEX_MAPPINGS is not set
529# CONFIG_MTD_PHYSMAP is not set 534CONFIG_MTD_PHYSMAP=m
530CONFIG_MTD_BF5xx=m 535CONFIG_MTD_PHYSMAP_START=0x20000000
531CONFIG_BFIN_FLASH_SIZE=0x400000 536CONFIG_MTD_PHYSMAP_LEN=0x0
532CONFIG_EBIU_FLASH_BASE=0x20000000 537CONFIG_MTD_PHYSMAP_BANKWIDTH=2
533# CONFIG_MTD_UCLINUX is not set 538# CONFIG_MTD_UCLINUX is not set
534# CONFIG_MTD_PLATRAM is not set 539# CONFIG_MTD_PLATRAM is not set
535 540
@@ -647,8 +652,8 @@ CONFIG_BFIN_RX_DESC_NUM=20
647# CONFIG_SMSC911X is not set 652# CONFIG_SMSC911X is not set
648# CONFIG_DM9000 is not set 653# CONFIG_DM9000 is not set
649CONFIG_NETDEV_1000=y 654CONFIG_NETDEV_1000=y
650CONFIG_NETDEV_10000=y
651# CONFIG_AX88180 is not set 655# CONFIG_AX88180 is not set
656CONFIG_NETDEV_10000=y
652 657
653# 658#
654# Wireless LAN 659# Wireless LAN
@@ -704,7 +709,6 @@ CONFIG_INPUT_MISC=y
704# CONFIG_INPUT_POWERMATE is not set 709# CONFIG_INPUT_POWERMATE is not set
705# CONFIG_INPUT_YEALINK is not set 710# CONFIG_INPUT_YEALINK is not set
706# CONFIG_INPUT_UINPUT is not set 711# CONFIG_INPUT_UINPUT is not set
707# CONFIG_BF53X_PFBUTTONS is not set
708CONFIG_TWI_KEYPAD=m 712CONFIG_TWI_KEYPAD=m
709CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72 713CONFIG_BFIN_TWIKEYPAD_IRQ_PFX=72
710 714
@@ -728,8 +732,6 @@ CONFIG_BFIN_SPORT=y
728CONFIG_TWI_LCD=m 732CONFIG_TWI_LCD=m
729CONFIG_TWI_LCD_SLAVE_ADDR=34 733CONFIG_TWI_LCD_SLAVE_ADDR=34
730# CONFIG_AD5304 is not set 734# CONFIG_AD5304 is not set
731# CONFIG_BF5xx_TEA5764 is not set
732# CONFIG_BF5xx_FBDMA is not set
733# CONFIG_VT is not set 735# CONFIG_VT is not set
734# CONFIG_SERIAL_NONSTANDARD is not set 736# CONFIG_SERIAL_NONSTANDARD is not set
735 737
@@ -802,7 +804,6 @@ CONFIG_I2C_CHARDEV=m
802# 804#
803# I2C Hardware Bus support 805# I2C Hardware Bus support
804# 806#
805# CONFIG_I2C_BLACKFIN_GPIO is not set
806CONFIG_I2C_BLACKFIN_TWI=m 807CONFIG_I2C_BLACKFIN_TWI=m
807CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 808CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
808# CONFIG_I2C_GPIO is not set 809# CONFIG_I2C_GPIO is not set
@@ -957,6 +958,7 @@ CONFIG_LQ035_SLAVE_ADDR=0x58
957# CONFIG_FB_BFIN_LANDSCAPE is not set 958# CONFIG_FB_BFIN_LANDSCAPE is not set
958# CONFIG_FB_BFIN_BGR is not set 959# CONFIG_FB_BFIN_BGR is not set
959# CONFIG_FB_BFIN_T350MCQB is not set 960# CONFIG_FB_BFIN_T350MCQB is not set
961# CONFIG_FB_HITACHI_TX09 is not set
960# CONFIG_FB_S1D13XXX is not set 962# CONFIG_FB_S1D13XXX is not set
961# CONFIG_FB_VIRTUAL is not set 963# CONFIG_FB_VIRTUAL is not set
962# CONFIG_LOGO is not set 964# CONFIG_LOGO is not set
@@ -1008,12 +1010,22 @@ CONFIG_SND_BFIN_AD73311_SE=4
1008# 1010#
1009# System on Chip audio support 1011# System on Chip audio support
1010# 1012#
1011# CONFIG_SND_SOC is not set 1013CONFIG_SND_SOC_AC97_BUS=y
1014CONFIG_SND_SOC=m
1015CONFIG_SND_BF5XX_SOC=m
1016CONFIG_SND_BF5XX_SOC_AC97=m
1017# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1018# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1019CONFIG_SND_BF5XX_SOC_BF5xx=m
1020CONFIG_SND_BF5XX_SPORT_NUM=0
1021# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
1022CONFIG_SND_SOC_AD1980=m
1012 1023
1013# 1024#
1014# Open Sound System 1025# Open Sound System
1015# 1026#
1016# CONFIG_SOUND_PRIME is not set 1027# CONFIG_SOUND_PRIME is not set
1028CONFIG_AC97_BUS=m
1017 1029
1018# 1030#
1019# HID Devices 1031# HID Devices
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 48367cc9fe35..fd702161ef59 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.22.16
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,7 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# Processor and Board Settings 115# Processor and Board Settings
116# 116#
117# CONFIG_BF522 is not set 117# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set
118# CONFIG_BF525 is not set 120# CONFIG_BF525 is not set
121# CONFIG_BF526 is not set
119# CONFIG_BF527 is not set 122# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
@@ -126,8 +129,8 @@ CONFIG_PREEMPT_VOLUNTARY=y
126# CONFIG_BF542 is not set 129# CONFIG_BF542 is not set
127# CONFIG_BF544 is not set 130# CONFIG_BF544 is not set
128# CONFIG_BF547 is not set 131# CONFIG_BF547 is not set
129# CONFIG_BF548 is not set 132CONFIG_BF548=y
130CONFIG_BF549=y 133# CONFIG_BF549 is not set
131# CONFIG_BF561 is not set 134# CONFIG_BF561 is not set
132CONFIG_BF_REV_0_0=y 135CONFIG_BF_REV_0_0=y
133# CONFIG_BF_REV_0_1 is not set 136# CONFIG_BF_REV_0_1 is not set
@@ -265,9 +268,9 @@ CONFIG_PINT3_ASSIGN=0x02020303
265# 268#
266CONFIG_CLKIN_HZ=25000000 269CONFIG_CLKIN_HZ=25000000
267# CONFIG_BFIN_KERNEL_CLOCK is not set 270# CONFIG_BFIN_KERNEL_CLOCK is not set
268CONFIG_MAX_VCO_HZ=533000000 271CONFIG_MAX_VCO_HZ=600000000
269CONFIG_MIN_VCO_HZ=50000000 272CONFIG_MIN_VCO_HZ=50000000
270CONFIG_MAX_SCLK_HZ=133000000 273CONFIG_MAX_SCLK_HZ=133333333
271CONFIG_MIN_SCLK_HZ=27000000 274CONFIG_MIN_SCLK_HZ=27000000
272 275
273# 276#
@@ -283,7 +286,8 @@ CONFIG_HZ=250
283# Memory Setup 286# Memory Setup
284# 287#
285CONFIG_MEM_SIZE=64 288CONFIG_MEM_SIZE=64
286CONFIG_MEM_ADD_WIDTH=10 289# CONFIG_MEM_MT46V32M16_6T is not set
290CONFIG_MEM_MT46V32M16_5B=y
287CONFIG_BOOT_LOAD=0x1000 291CONFIG_BOOT_LOAD=0x1000
288CONFIG_BFIN_SCRATCH_REG_RETN=y 292CONFIG_BFIN_SCRATCH_REG_RETN=y
289# CONFIG_BFIN_SCRATCH_REG_RETE is not set 293# CONFIG_BFIN_SCRATCH_REG_RETE is not set
@@ -340,6 +344,7 @@ CONFIG_BFIN_DCACHE=y
340# CONFIG_BFIN_WB is not set 344# CONFIG_BFIN_WB is not set
341CONFIG_BFIN_WT=y 345CONFIG_BFIN_WT=y
342CONFIG_L1_MAX_PIECE=16 346CONFIG_L1_MAX_PIECE=16
347# CONFIG_MPU is not set
343 348
344# 349#
345# Asynchonous Memory Configuration 350# Asynchonous Memory Configuration
@@ -349,6 +354,7 @@ CONFIG_L1_MAX_PIECE=16
349# EBIU_AMGCTL Global Control 354# EBIU_AMGCTL Global Control
350# 355#
351CONFIG_C_AMCKEN=y 356CONFIG_C_AMCKEN=y
357# CONFIG_C_CDPRIO is not set
352# CONFIG_C_AMBEN is not set 358# CONFIG_C_AMBEN is not set
353# CONFIG_C_AMBEN_B0 is not set 359# CONFIG_C_AMBEN_B0 is not set
354# CONFIG_C_AMBEN_B0_B1 is not set 360# CONFIG_C_AMBEN_B0_B1 is not set
@@ -362,9 +368,9 @@ CONFIG_BANK_0=0x7BB0
362CONFIG_BANK_1=0x5554 368CONFIG_BANK_1=0x5554
363CONFIG_BANK_2=0x7BB0 369CONFIG_BANK_2=0x7BB0
364CONFIG_BANK_3=0x99B3 370CONFIG_BANK_3=0x99B3
365CONFIG_EBUI_MBSCTLVAL=0x0 371CONFIG_EBIU_MBSCTLVAL=0x0
366CONFIG_EBUI_MODEVAL=0x1 372CONFIG_EBIU_MODEVAL=0x1
367CONFIG_EBUI_FCTLVAL=0x6 373CONFIG_EBIU_FCTLVAL=0x6
368 374
369# 375#
370# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 376# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -537,7 +543,6 @@ CONFIG_MTD_CFI_I2=y
537CONFIG_MTD_CFI_INTELEXT=y 543CONFIG_MTD_CFI_INTELEXT=y
538# CONFIG_MTD_CFI_AMDSTD is not set 544# CONFIG_MTD_CFI_AMDSTD is not set
539# CONFIG_MTD_CFI_STAA is not set 545# CONFIG_MTD_CFI_STAA is not set
540# CONFIG_MTD_MW320D is not set
541CONFIG_MTD_CFI_UTIL=y 546CONFIG_MTD_CFI_UTIL=y
542CONFIG_MTD_RAM=y 547CONFIG_MTD_RAM=y
543# CONFIG_MTD_ROM is not set 548# CONFIG_MTD_ROM is not set
@@ -549,9 +554,8 @@ CONFIG_MTD_RAM=y
549CONFIG_MTD_COMPLEX_MAPPINGS=y 554CONFIG_MTD_COMPLEX_MAPPINGS=y
550CONFIG_MTD_PHYSMAP=y 555CONFIG_MTD_PHYSMAP=y
551CONFIG_MTD_PHYSMAP_START=0x20000000 556CONFIG_MTD_PHYSMAP_START=0x20000000
552CONFIG_MTD_PHYSMAP_LEN=0x400000 557CONFIG_MTD_PHYSMAP_LEN=0
553CONFIG_MTD_PHYSMAP_BANKWIDTH=2 558CONFIG_MTD_PHYSMAP_BANKWIDTH=2
554# CONFIG_MTD_BF5xx is not set
555# CONFIG_MTD_UCLINUX is not set 559# CONFIG_MTD_UCLINUX is not set
556# CONFIG_MTD_PLATRAM is not set 560# CONFIG_MTD_PLATRAM is not set
557 561
@@ -690,8 +694,8 @@ CONFIG_MII=y
690CONFIG_SMSC911X=y 694CONFIG_SMSC911X=y
691# CONFIG_DM9000 is not set 695# CONFIG_DM9000 is not set
692CONFIG_NETDEV_1000=y 696CONFIG_NETDEV_1000=y
693CONFIG_NETDEV_10000=y
694# CONFIG_AX88180 is not set 697# CONFIG_AX88180 is not set
698CONFIG_NETDEV_10000=y
695 699
696# 700#
697# Wireless LAN 701# Wireless LAN
@@ -719,7 +723,7 @@ CONFIG_NETDEV_10000=y
719# 723#
720# Input device support 724# Input device support
721# 725#
722CONFIG_INPUT=m 726CONFIG_INPUT=y
723# CONFIG_INPUT_FF_MEMLESS is not set 727# CONFIG_INPUT_FF_MEMLESS is not set
724# CONFIG_INPUT_POLLDEV is not set 728# CONFIG_INPUT_POLLDEV is not set
725 729
@@ -745,7 +749,8 @@ CONFIG_INPUT_KEYBOARD=y
745# CONFIG_KEYBOARD_NEWTON is not set 749# CONFIG_KEYBOARD_NEWTON is not set
746# CONFIG_KEYBOARD_STOWAWAY is not set 750# CONFIG_KEYBOARD_STOWAWAY is not set
747# CONFIG_KEYBOARD_GPIO is not set 751# CONFIG_KEYBOARD_GPIO is not set
748CONFIG_KEYBOARD_BFIN=m 752CONFIG_KEYBOARD_BFIN=y
753# CONFIG_KEYBOARD_OPENCORES is not set
749# CONFIG_INPUT_MOUSE is not set 754# CONFIG_INPUT_MOUSE is not set
750# CONFIG_INPUT_JOYSTICK is not set 755# CONFIG_INPUT_JOYSTICK is not set
751# CONFIG_INPUT_TABLET is not set 756# CONFIG_INPUT_TABLET is not set
@@ -768,7 +773,6 @@ CONFIG_INPUT_MISC=y
768# CONFIG_INPUT_POWERMATE is not set 773# CONFIG_INPUT_POWERMATE is not set
769# CONFIG_INPUT_YEALINK is not set 774# CONFIG_INPUT_YEALINK is not set
770# CONFIG_INPUT_UINPUT is not set 775# CONFIG_INPUT_UINPUT is not set
771# CONFIG_BF53X_PFBUTTONS is not set
772# CONFIG_TWI_KEYPAD is not set 776# CONFIG_TWI_KEYPAD is not set
773 777
774# 778#
@@ -786,13 +790,16 @@ CONFIG_INPUT_MISC=y
786# CONFIG_BF5xx_PPIFCD is not set 790# CONFIG_BF5xx_PPIFCD is not set
787# CONFIG_BFIN_SIMPLE_TIMER is not set 791# CONFIG_BFIN_SIMPLE_TIMER is not set
788# CONFIG_BF5xx_PPI is not set 792# CONFIG_BF5xx_PPI is not set
793CONFIG_BFIN_OTP=y
794# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
789# CONFIG_BFIN_SPORT is not set 795# CONFIG_BFIN_SPORT is not set
790# CONFIG_BFIN_TIMER_LATENCY is not set 796# CONFIG_BFIN_TIMER_LATENCY is not set
791# CONFIG_TWI_LCD is not set 797# CONFIG_TWI_LCD is not set
792# CONFIG_AD5304 is not set 798# CONFIG_AD5304 is not set
793# CONFIG_BF5xx_TEA5764 is not set 799CONFIG_VT=y
794# CONFIG_BF5xx_FBDMA is not set 800CONFIG_VT_CONSOLE=y
795# CONFIG_VT is not set 801CONFIG_HW_CONSOLE=y
802# CONFIG_VT_HW_CONSOLE_BINDING is not set
796# CONFIG_SERIAL_NONSTANDARD is not set 803# CONFIG_SERIAL_NONSTANDARD is not set
797 804
798# 805#
@@ -858,7 +865,6 @@ CONFIG_I2C_CHARDEV=y
858# 865#
859# I2C Hardware Bus support 866# I2C Hardware Bus support
860# 867#
861# CONFIG_I2C_BLACKFIN_GPIO is not set
862CONFIG_I2C_BLACKFIN_TWI=y 868CONFIG_I2C_BLACKFIN_TWI=y
863CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50 869CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=50
864# CONFIG_I2C_GPIO is not set 870# CONFIG_I2C_GPIO is not set
@@ -976,12 +982,12 @@ CONFIG_DAB=y
976# 982#
977# CONFIG_DISPLAY_SUPPORT is not set 983# CONFIG_DISPLAY_SUPPORT is not set
978# CONFIG_VGASTATE is not set 984# CONFIG_VGASTATE is not set
979CONFIG_FB=m 985CONFIG_FB=y
980CONFIG_FIRMWARE_EDID=y 986CONFIG_FIRMWARE_EDID=y
981# CONFIG_FB_DDC is not set 987# CONFIG_FB_DDC is not set
982CONFIG_FB_CFB_FILLRECT=m 988CONFIG_FB_CFB_FILLRECT=y
983CONFIG_FB_CFB_COPYAREA=m 989CONFIG_FB_CFB_COPYAREA=y
984CONFIG_FB_CFB_IMAGEBLIT=m 990CONFIG_FB_CFB_IMAGEBLIT=y
985# CONFIG_FB_SYS_FILLRECT is not set 991# CONFIG_FB_SYS_FILLRECT is not set
986# CONFIG_FB_SYS_COPYAREA is not set 992# CONFIG_FB_SYS_COPYAREA is not set
987# CONFIG_FB_SYS_IMAGEBLIT is not set 993# CONFIG_FB_SYS_IMAGEBLIT is not set
@@ -998,11 +1004,34 @@ CONFIG_FB_DEFERRED_IO=y
998# 1004#
999# CONFIG_FB_BFIN_7171 is not set 1005# CONFIG_FB_BFIN_7171 is not set
1000# CONFIG_FB_BFIN_7393 is not set 1006# CONFIG_FB_BFIN_7393 is not set
1001CONFIG_FB_BF54X_LQ043=m 1007CONFIG_FB_BF54X_LQ043=y
1002# CONFIG_FB_BFIN_T350MCQB is not set 1008# CONFIG_FB_BFIN_T350MCQB is not set
1003# CONFIG_FB_S1D13XXX is not set 1009# CONFIG_FB_S1D13XXX is not set
1004# CONFIG_FB_VIRTUAL is not set 1010# CONFIG_FB_VIRTUAL is not set
1005# CONFIG_LOGO is not set 1011
1012#
1013# Console display driver support
1014#
1015CONFIG_DUMMY_CONSOLE=y
1016CONFIG_FRAMEBUFFER_CONSOLE=y
1017# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1018CONFIG_FONTS=y
1019# CONFIG_FONT_8x8 is not set
1020# CONFIG_FONT_8x16 is not set
1021CONFIG_FONT_6x11=y
1022# CONFIG_FONT_7x14 is not set
1023# CONFIG_FONT_PEARL_8x8 is not set
1024# CONFIG_FONT_ACORN_8x8 is not set
1025# CONFIG_FONT_MINI_4x6 is not set
1026# CONFIG_FONT_SUN8x16 is not set
1027# CONFIG_FONT_SUN12x22 is not set
1028# CONFIG_FONT_10x18 is not set
1029CONFIG_LOGO=y
1030# CONFIG_LOGO_LINUX_MONO is not set
1031# CONFIG_LOGO_LINUX_VGA16 is not set
1032# CONFIG_LOGO_LINUX_CLUT224 is not set
1033# CONFIG_LOGO_BLACKFIN_VGA16 is not set
1034CONFIG_LOGO_BLACKFIN_CLUT224=y
1006 1035
1007# 1036#
1008# Sound 1037# Sound
@@ -1051,7 +1080,8 @@ CONFIG_SND_BF5XX_SOC_BF548_EZKIT=y
1051# CONFIG_SND_BF5XX_SOC_WM8750 is not set 1080# CONFIG_SND_BF5XX_SOC_WM8750 is not set
1052# CONFIG_SND_BF5XX_SOC_WM8731 is not set 1081# CONFIG_SND_BF5XX_SOC_WM8731 is not set
1053CONFIG_SND_BF5XX_SPORT_NUM=0 1082CONFIG_SND_BF5XX_SPORT_NUM=0
1054# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set 1083CONFIG_SND_BF5XX_HAVE_COLD_RESET=y
1084CONFIG_SND_BF5XX_RESET_GPIO_NUM=19
1055CONFIG_SND_SOC_AD1980=y 1085CONFIG_SND_SOC_AD1980=y
1056 1086
1057# 1087#
@@ -1403,7 +1433,7 @@ CONFIG_NLS_UTF8=m
1403# 1433#
1404# CONFIG_PRINTK_TIME is not set 1434# CONFIG_PRINTK_TIME is not set
1405CONFIG_ENABLE_MUST_CHECK=y 1435CONFIG_ENABLE_MUST_CHECK=y
1406CONFIG_MAGIC_SYSRQ=y 1436# CONFIG_MAGIC_SYSRQ is not set
1407# CONFIG_UNUSED_SYMBOLS is not set 1437# CONFIG_UNUSED_SYMBOLS is not set
1408CONFIG_DEBUG_FS=y 1438CONFIG_DEBUG_FS=y
1409# CONFIG_HEADERS_CHECK is not set 1439# CONFIG_HEADERS_CHECK is not set
@@ -1428,7 +1458,7 @@ CONFIG_ACCESS_CHECK=y
1428# CONFIG_KEYS is not set 1458# CONFIG_KEYS is not set
1429CONFIG_SECURITY=y 1459CONFIG_SECURITY=y
1430# CONFIG_SECURITY_NETWORK is not set 1460# CONFIG_SECURITY_NETWORK is not set
1431CONFIG_SECURITY_CAPABILITIES=y 1461CONFIG_SECURITY_CAPABILITIES=m
1432 1462
1433# 1463#
1434# Cryptographic options 1464# Cryptographic options
@@ -1439,7 +1469,7 @@ CONFIG_SECURITY_CAPABILITIES=y
1439# Library routines 1469# Library routines
1440# 1470#
1441CONFIG_BITREVERSE=y 1471CONFIG_BITREVERSE=y
1442# CONFIG_CRC_CCITT is not set 1472CONFIG_CRC_CCITT=m
1443# CONFIG_CRC16 is not set 1473# CONFIG_CRC16 is not set
1444# CONFIG_CRC_ITU_T is not set 1474# CONFIG_CRC_ITU_T is not set
1445CONFIG_CRC32=y 1475CONFIG_CRC32=y
diff --git a/arch/blackfin/configs/BF561-EZKIT_defconfig b/arch/blackfin/configs/BF561-EZKIT_defconfig
index e9f100b45eb1..8546994939fb 100644
--- a/arch/blackfin/configs/BF561-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF561-EZKIT_defconfig
@@ -1,6 +1,6 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.12 3# Linux kernel version: 2.6.22.16
4# 4#
5# CONFIG_MMU is not set 5# CONFIG_MMU is not set
6# CONFIG_FPU is not set 6# CONFIG_FPU is not set
@@ -115,7 +115,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
115# Processor and Board Settings 115# Processor and Board Settings
116# 116#
117# CONFIG_BF522 is not set 117# CONFIG_BF522 is not set
118# CONFIG_BF523 is not set
119# CONFIG_BF524 is not set
118# CONFIG_BF525 is not set 120# CONFIG_BF525 is not set
121# CONFIG_BF526 is not set
119# CONFIG_BF527 is not set 122# CONFIG_BF527 is not set
120# CONFIG_BF531 is not set 123# CONFIG_BF531 is not set
121# CONFIG_BF532 is not set 124# CONFIG_BF532 is not set
@@ -238,7 +241,7 @@ CONFIG_CLKIN_HZ=30000000
238# CONFIG_BFIN_KERNEL_CLOCK is not set 241# CONFIG_BFIN_KERNEL_CLOCK is not set
239CONFIG_MAX_VCO_HZ=600000000 242CONFIG_MAX_VCO_HZ=600000000
240CONFIG_MIN_VCO_HZ=50000000 243CONFIG_MIN_VCO_HZ=50000000
241CONFIG_MAX_SCLK_HZ=133000000 244CONFIG_MAX_SCLK_HZ=133333333
242CONFIG_MIN_SCLK_HZ=27000000 245CONFIG_MIN_SCLK_HZ=27000000
243 246
244# 247#
@@ -311,6 +314,7 @@ CONFIG_BFIN_DCACHE=y
311# CONFIG_BFIN_WB is not set 314# CONFIG_BFIN_WB is not set
312CONFIG_BFIN_WT=y 315CONFIG_BFIN_WT=y
313CONFIG_L1_MAX_PIECE=16 316CONFIG_L1_MAX_PIECE=16
317# CONFIG_MPU is not set
314 318
315# 319#
316# Asynchonous Memory Configuration 320# Asynchonous Memory Configuration
@@ -512,7 +516,7 @@ CONFIG_MTD=y
512# CONFIG_MTD_CONCAT is not set 516# CONFIG_MTD_CONCAT is not set
513CONFIG_MTD_PARTITIONS=y 517CONFIG_MTD_PARTITIONS=y
514# CONFIG_MTD_REDBOOT_PARTS is not set 518# CONFIG_MTD_REDBOOT_PARTS is not set
515# CONFIG_MTD_CMDLINE_PARTS is not set 519CONFIG_MTD_CMDLINE_PARTS=y
516 520
517# 521#
518# User Modules And Translation Layers 522# User Modules And Translation Layers
@@ -529,8 +533,8 @@ CONFIG_MTD_BLOCK=y
529# 533#
530# RAM/ROM/Flash chip drivers 534# RAM/ROM/Flash chip drivers
531# 535#
532# CONFIG_MTD_CFI is not set 536CONFIG_MTD_CFI=m
533CONFIG_MTD_JEDECPROBE=m 537# CONFIG_MTD_JEDECPROBE is not set
534CONFIG_MTD_GEN_PROBE=m 538CONFIG_MTD_GEN_PROBE=m
535# CONFIG_MTD_CFI_ADV_OPTIONS is not set 539# CONFIG_MTD_CFI_ADV_OPTIONS is not set
536CONFIG_MTD_MAP_BANK_WIDTH_1=y 540CONFIG_MTD_MAP_BANK_WIDTH_1=y
@@ -544,9 +548,9 @@ CONFIG_MTD_CFI_I2=y
544# CONFIG_MTD_CFI_I4 is not set 548# CONFIG_MTD_CFI_I4 is not set
545# CONFIG_MTD_CFI_I8 is not set 549# CONFIG_MTD_CFI_I8 is not set
546# CONFIG_MTD_CFI_INTELEXT is not set 550# CONFIG_MTD_CFI_INTELEXT is not set
547# CONFIG_MTD_CFI_AMDSTD is not set 551CONFIG_MTD_CFI_AMDSTD=m
548# CONFIG_MTD_CFI_STAA is not set 552# CONFIG_MTD_CFI_STAA is not set
549CONFIG_MTD_MW320D=m 553CONFIG_MTD_CFI_UTIL=m
550CONFIG_MTD_RAM=y 554CONFIG_MTD_RAM=y
551CONFIG_MTD_ROM=m 555CONFIG_MTD_ROM=m
552# CONFIG_MTD_ABSENT is not set 556# CONFIG_MTD_ABSENT is not set
@@ -554,12 +558,11 @@ CONFIG_MTD_ROM=m
554# 558#
555# Mapping drivers for chip access 559# Mapping drivers for chip access
556# 560#
557CONFIG_MTD_COMPLEX_MAPPINGS=y 561# CONFIG_MTD_COMPLEX_MAPPINGS is not set
558# CONFIG_MTD_PHYSMAP is not set 562CONFIG_MTD_PHYSMAP=m
559# CONFIG_MTD_EZKIT561 is not set 563CONFIG_MTD_PHYSMAP_START=0x20000000
560CONFIG_MTD_BF5xx=m 564CONFIG_MTD_PHYSMAP_LEN=0x0
561CONFIG_BFIN_FLASH_SIZE=0x0400000 565CONFIG_MTD_PHYSMAP_BANKWIDTH=2
562CONFIG_EBIU_FLASH_BASE=0x20000000
563# CONFIG_MTD_UCLINUX is not set 566# CONFIG_MTD_UCLINUX is not set
564# CONFIG_MTD_PLATRAM is not set 567# CONFIG_MTD_PLATRAM is not set
565 568
@@ -647,8 +650,8 @@ CONFIG_SMC91X=y
647# CONFIG_SMSC911X is not set 650# CONFIG_SMSC911X is not set
648# CONFIG_DM9000 is not set 651# CONFIG_DM9000 is not set
649CONFIG_NETDEV_1000=y 652CONFIG_NETDEV_1000=y
650CONFIG_NETDEV_10000=y
651# CONFIG_AX88180 is not set 653# CONFIG_AX88180 is not set
654CONFIG_NETDEV_10000=y
652 655
653# 656#
654# Wireless LAN 657# Wireless LAN
@@ -717,7 +720,6 @@ CONFIG_INPUT_EVDEV=m
717# CONFIG_BFIN_SPORT is not set 720# CONFIG_BFIN_SPORT is not set
718# CONFIG_BFIN_TIMER_LATENCY is not set 721# CONFIG_BFIN_TIMER_LATENCY is not set
719# CONFIG_AD5304 is not set 722# CONFIG_AD5304 is not set
720# CONFIG_BF5xx_FBDMA is not set
721# CONFIG_VT is not set 723# CONFIG_VT is not set
722# CONFIG_SERIAL_NONSTANDARD is not set 724# CONFIG_SERIAL_NONSTANDARD is not set
723 725
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index 8a4cfb293b27..318b9b692a48 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -7,7 +7,7 @@ extra-y := init_task.o vmlinux.lds
7obj-y := \ 7obj-y := \
8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \ 8 entry.o process.o bfin_ksyms.o ptrace.o setup.o signal.o \
9 sys_bfin.o time.o traps.o irqchip.o dma-mapping.o flat.o \ 9 sys_bfin.o time.o traps.o irqchip.o dma-mapping.o flat.o \
10 fixed_code.o cplbinit.o cacheinit.o reboot.o bfin_gpio.o 10 fixed_code.o reboot.o bfin_gpio.o
11 11
12obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o 12obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o
13obj-$(CONFIG_MODULES) += module.o 13obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index b54446055a43..fa9debe8d5f4 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -339,13 +339,13 @@ EXPORT_SYMBOL(set_dma_config);
339 339
340unsigned short 340unsigned short
341set_bfin_dma_config(char direction, char flow_mode, 341set_bfin_dma_config(char direction, char flow_mode,
342 char intr_mode, char dma_mode, char width) 342 char intr_mode, char dma_mode, char width, char syncmode)
343{ 343{
344 unsigned short config; 344 unsigned short config;
345 345
346 config = 346 config =
347 ((direction << 1) | (width << 2) | (dma_mode << 4) | 347 ((direction << 1) | (width << 2) | (dma_mode << 4) |
348 (intr_mode << 6) | (flow_mode << 12) | RESTART); 348 (intr_mode << 6) | (flow_mode << 12) | (syncmode << 5));
349 return config; 349 return config;
350} 350}
351EXPORT_SYMBOL(set_bfin_dma_config); 351EXPORT_SYMBOL(set_bfin_dma_config);
diff --git a/arch/blackfin/kernel/bfin_gpio.c b/arch/blackfin/kernel/bfin_gpio.c
index ce85d4bf34ca..6bbe0a2fccb8 100644
--- a/arch/blackfin/kernel/bfin_gpio.c
+++ b/arch/blackfin/kernel/bfin_gpio.c
@@ -7,7 +7,7 @@
7 * Description: GPIO Abstraction Layer 7 * Description: GPIO Abstraction Layer
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2007 Analog Devices Inc. 10 * Copyright 2008 Analog Devices Inc.
11 * 11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 * 13 *
@@ -83,6 +83,7 @@
83#include <linux/delay.h> 83#include <linux/delay.h>
84#include <linux/module.h> 84#include <linux/module.h>
85#include <linux/err.h> 85#include <linux/err.h>
86#include <linux/proc_fs.h>
86#include <asm/blackfin.h> 87#include <asm/blackfin.h>
87#include <asm/gpio.h> 88#include <asm/gpio.h>
88#include <asm/portmux.h> 89#include <asm/portmux.h>
@@ -136,7 +137,6 @@ static unsigned short *port_fer[gpio_bank(MAX_BLACKFIN_GPIOS)] = {
136 (unsigned short *) PORTG_FER, 137 (unsigned short *) PORTG_FER,
137 (unsigned short *) PORTH_FER, 138 (unsigned short *) PORTH_FER,
138}; 139};
139
140#endif 140#endif
141 141
142#ifdef BF527_FAMILY 142#ifdef BF527_FAMILY
@@ -178,15 +178,13 @@ static struct gpio_port_t *gpio_array[gpio_bank(MAX_BLACKFIN_GPIOS)] = {
178#endif 178#endif
179 179
180static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 180static unsigned short reserved_gpio_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
181static unsigned short reserved_peri_map[gpio_bank(MAX_BLACKFIN_GPIOS + 16)]; 181static unsigned short reserved_peri_map[gpio_bank(MAX_RESOURCES)];
182 182
183#define MAX_RESOURCES 256
184#define RESOURCE_LABEL_SIZE 16 183#define RESOURCE_LABEL_SIZE 16
185 184
186struct str_ident { 185static struct str_ident {
187 char name[RESOURCE_LABEL_SIZE]; 186 char name[RESOURCE_LABEL_SIZE];
188} *str_ident; 187} str_ident[MAX_RESOURCES];
189
190 188
191#ifdef CONFIG_PM 189#ifdef CONFIG_PM
192static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)]; 190static unsigned short wakeup_map[gpio_bank(MAX_BLACKFIN_GPIOS)];
@@ -212,7 +210,7 @@ static unsigned int sic_iwr_irqs[gpio_bank(MAX_BLACKFIN_GPIOS)] = {IRQ_PROG0_INT
212#endif /* CONFIG_PM */ 210#endif /* CONFIG_PM */
213 211
214#if defined(BF548_FAMILY) 212#if defined(BF548_FAMILY)
215inline int check_gpio(unsigned short gpio) 213inline int check_gpio(unsigned gpio)
216{ 214{
217 if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15 215 if (gpio == GPIO_PB15 || gpio == GPIO_PC14 || gpio == GPIO_PC15
218 || gpio == GPIO_PH14 || gpio == GPIO_PH15 216 || gpio == GPIO_PH14 || gpio == GPIO_PH15
@@ -222,7 +220,7 @@ inline int check_gpio(unsigned short gpio)
222 return 0; 220 return 0;
223} 221}
224#else 222#else
225inline int check_gpio(unsigned short gpio) 223inline int check_gpio(unsigned gpio)
226{ 224{
227 if (gpio >= MAX_BLACKFIN_GPIOS) 225 if (gpio >= MAX_BLACKFIN_GPIOS)
228 return -EINVAL; 226 return -EINVAL;
@@ -230,9 +228,13 @@ inline int check_gpio(unsigned short gpio)
230} 228}
231#endif 229#endif
232 230
233static void set_label(unsigned short ident, const char *label) 231void gpio_error(unsigned gpio)
234{ 232{
233 printk(KERN_ERR "bfin-gpio: GPIO %d wasn't requested!\n", gpio);
234}
235 235
236static void set_label(unsigned short ident, const char *label)
237{
236 if (label && str_ident) { 238 if (label && str_ident) {
237 strncpy(str_ident[ident].name, label, 239 strncpy(str_ident[ident].name, label,
238 RESOURCE_LABEL_SIZE); 240 RESOURCE_LABEL_SIZE);
@@ -250,6 +252,11 @@ static char *get_label(unsigned short ident)
250 252
251static int cmp_label(unsigned short ident, const char *label) 253static int cmp_label(unsigned short ident, const char *label)
252{ 254{
255 if (label == NULL) {
256 dump_stack();
257 printk(KERN_ERR "Please provide none-null label\n");
258 }
259
253 if (label && str_ident) 260 if (label && str_ident)
254 return strncmp(str_ident[ident].name, 261 return strncmp(str_ident[ident].name,
255 label, strlen(label)); 262 label, strlen(label));
@@ -258,7 +265,7 @@ static int cmp_label(unsigned short ident, const char *label)
258} 265}
259 266
260#if defined(BF527_FAMILY) || defined(BF537_FAMILY) 267#if defined(BF527_FAMILY) || defined(BF537_FAMILY)
261static void port_setup(unsigned short gpio, unsigned short usage) 268static void port_setup(unsigned gpio, unsigned short usage)
262{ 269{
263 if (!check_gpio(gpio)) { 270 if (!check_gpio(gpio)) {
264 if (usage == GPIO_USAGE) 271 if (usage == GPIO_USAGE)
@@ -269,7 +276,7 @@ static void port_setup(unsigned short gpio, unsigned short usage)
269 } 276 }
270} 277}
271#elif defined(BF548_FAMILY) 278#elif defined(BF548_FAMILY)
272static void port_setup(unsigned short gpio, unsigned short usage) 279static void port_setup(unsigned gpio, unsigned short usage)
273{ 280{
274 if (usage == GPIO_USAGE) 281 if (usage == GPIO_USAGE)
275 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio); 282 gpio_array[gpio_bank(gpio)]->port_fer &= ~gpio_bit(gpio);
@@ -390,7 +397,7 @@ inline void portmux_setup(unsigned short portno, unsigned short function)
390#endif 397#endif
391 398
392#ifndef BF548_FAMILY 399#ifndef BF548_FAMILY
393static void default_gpio(unsigned short gpio) 400static void default_gpio(unsigned gpio)
394{ 401{
395 unsigned short bank, bitmask; 402 unsigned short bank, bitmask;
396 unsigned long flags; 403 unsigned long flags;
@@ -410,7 +417,6 @@ static void default_gpio(unsigned short gpio)
410 gpio_bankb[bank]->edge &= ~bitmask; 417 gpio_bankb[bank]->edge &= ~bitmask;
411 AWA_DUMMY_READ(edge); 418 AWA_DUMMY_READ(edge);
412 local_irq_restore(flags); 419 local_irq_restore(flags);
413
414} 420}
415#else 421#else
416# define default_gpio(...) do { } while (0) 422# define default_gpio(...) do { } while (0)
@@ -418,12 +424,6 @@ static void default_gpio(unsigned short gpio)
418 424
419static int __init bfin_gpio_init(void) 425static int __init bfin_gpio_init(void)
420{ 426{
421 str_ident = kcalloc(MAX_RESOURCES,
422 sizeof(struct str_ident), GFP_KERNEL);
423 if (str_ident == NULL)
424 return -ENOMEM;
425
426 memset(str_ident, 0, MAX_RESOURCES * sizeof(struct str_ident));
427 427
428 printk(KERN_INFO "Blackfin GPIO Controller\n"); 428 printk(KERN_INFO "Blackfin GPIO Controller\n");
429 429
@@ -454,10 +454,9 @@ arch_initcall(bfin_gpio_init);
454/* Set a specific bit */ 454/* Set a specific bit */
455 455
456#define SET_GPIO(name) \ 456#define SET_GPIO(name) \
457void set_gpio_ ## name(unsigned short gpio, unsigned short arg) \ 457void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
458{ \ 458{ \
459 unsigned long flags; \ 459 unsigned long flags; \
460 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); \
461 local_irq_save(flags); \ 460 local_irq_save(flags); \
462 if (arg) \ 461 if (arg) \
463 gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \ 462 gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
@@ -477,10 +476,9 @@ SET_GPIO(both)
477 476
478#if ANOMALY_05000311 || ANOMALY_05000323 477#if ANOMALY_05000311 || ANOMALY_05000323
479#define SET_GPIO_SC(name) \ 478#define SET_GPIO_SC(name) \
480void set_gpio_ ## name(unsigned short gpio, unsigned short arg) \ 479void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
481{ \ 480{ \
482 unsigned long flags; \ 481 unsigned long flags; \
483 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); \
484 local_irq_save(flags); \ 482 local_irq_save(flags); \
485 if (arg) \ 483 if (arg) \
486 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ 484 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
@@ -492,9 +490,8 @@ void set_gpio_ ## name(unsigned short gpio, unsigned short arg) \
492EXPORT_SYMBOL(set_gpio_ ## name); 490EXPORT_SYMBOL(set_gpio_ ## name);
493#else 491#else
494#define SET_GPIO_SC(name) \ 492#define SET_GPIO_SC(name) \
495void set_gpio_ ## name(unsigned short gpio, unsigned short arg) \ 493void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
496{ \ 494{ \
497 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); \
498 if (arg) \ 495 if (arg) \
499 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \ 496 gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
500 else \ 497 else \
@@ -508,19 +505,17 @@ SET_GPIO_SC(maskb)
508SET_GPIO_SC(data) 505SET_GPIO_SC(data)
509 506
510#if ANOMALY_05000311 || ANOMALY_05000323 507#if ANOMALY_05000311 || ANOMALY_05000323
511void set_gpio_toggle(unsigned short gpio) 508void set_gpio_toggle(unsigned gpio)
512{ 509{
513 unsigned long flags; 510 unsigned long flags;
514 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)));
515 local_irq_save(flags); 511 local_irq_save(flags);
516 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio); 512 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
517 AWA_DUMMY_READ(toggle); 513 AWA_DUMMY_READ(toggle);
518 local_irq_restore(flags); 514 local_irq_restore(flags);
519} 515}
520#else 516#else
521void set_gpio_toggle(unsigned short gpio) 517void set_gpio_toggle(unsigned gpio)
522{ 518{
523 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)));
524 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio); 519 gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
525} 520}
526#endif 521#endif
@@ -531,7 +526,7 @@ EXPORT_SYMBOL(set_gpio_toggle);
531 526
532#if ANOMALY_05000311 || ANOMALY_05000323 527#if ANOMALY_05000311 || ANOMALY_05000323
533#define SET_GPIO_P(name) \ 528#define SET_GPIO_P(name) \
534void set_gpiop_ ## name(unsigned short gpio, unsigned short arg) \ 529void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
535{ \ 530{ \
536 unsigned long flags; \ 531 unsigned long flags; \
537 local_irq_save(flags); \ 532 local_irq_save(flags); \
@@ -542,7 +537,7 @@ void set_gpiop_ ## name(unsigned short gpio, unsigned short arg) \
542EXPORT_SYMBOL(set_gpiop_ ## name); 537EXPORT_SYMBOL(set_gpiop_ ## name);
543#else 538#else
544#define SET_GPIO_P(name) \ 539#define SET_GPIO_P(name) \
545void set_gpiop_ ## name(unsigned short gpio, unsigned short arg) \ 540void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
546{ \ 541{ \
547 gpio_bankb[gpio_bank(gpio)]->name = arg; \ 542 gpio_bankb[gpio_bank(gpio)]->name = arg; \
548} \ 543} \
@@ -558,11 +553,10 @@ SET_GPIO_P(both)
558SET_GPIO_P(maska) 553SET_GPIO_P(maska)
559SET_GPIO_P(maskb) 554SET_GPIO_P(maskb)
560 555
561
562/* Get a specific bit */ 556/* Get a specific bit */
563#if ANOMALY_05000311 || ANOMALY_05000323 557#if ANOMALY_05000311 || ANOMALY_05000323
564#define GET_GPIO(name) \ 558#define GET_GPIO(name) \
565unsigned short get_gpio_ ## name(unsigned short gpio) \ 559unsigned short get_gpio_ ## name(unsigned gpio) \
566{ \ 560{ \
567 unsigned long flags; \ 561 unsigned long flags; \
568 unsigned short ret; \ 562 unsigned short ret; \
@@ -575,7 +569,7 @@ unsigned short get_gpio_ ## name(unsigned short gpio) \
575EXPORT_SYMBOL(get_gpio_ ## name); 569EXPORT_SYMBOL(get_gpio_ ## name);
576#else 570#else
577#define GET_GPIO(name) \ 571#define GET_GPIO(name) \
578unsigned short get_gpio_ ## name(unsigned short gpio) \ 572unsigned short get_gpio_ ## name(unsigned gpio) \
579{ \ 573{ \
580 return (0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio))); \ 574 return (0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio))); \
581} \ 575} \
@@ -595,7 +589,7 @@ GET_GPIO(maskb)
595 589
596#if ANOMALY_05000311 || ANOMALY_05000323 590#if ANOMALY_05000311 || ANOMALY_05000323
597#define GET_GPIO_P(name) \ 591#define GET_GPIO_P(name) \
598unsigned short get_gpiop_ ## name(unsigned short gpio) \ 592unsigned short get_gpiop_ ## name(unsigned gpio) \
599{ \ 593{ \
600 unsigned long flags; \ 594 unsigned long flags; \
601 unsigned short ret; \ 595 unsigned short ret; \
@@ -608,7 +602,7 @@ unsigned short get_gpiop_ ## name(unsigned short gpio) \
608EXPORT_SYMBOL(get_gpiop_ ## name); 602EXPORT_SYMBOL(get_gpiop_ ## name);
609#else 603#else
610#define GET_GPIO_P(name) \ 604#define GET_GPIO_P(name) \
611unsigned short get_gpiop_ ## name(unsigned short gpio) \ 605unsigned short get_gpiop_ ## name(unsigned gpio) \
612{ \ 606{ \
613 return (gpio_bankb[gpio_bank(gpio)]->name);\ 607 return (gpio_bankb[gpio_bank(gpio)]->name);\
614} \ 608} \
@@ -645,7 +639,7 @@ GET_GPIO_P(maskb)
645************************************************************* 639*************************************************************
646* MODIFICATION HISTORY : 640* MODIFICATION HISTORY :
647**************************************************************/ 641**************************************************************/
648int gpio_pm_wakeup_request(unsigned short gpio, unsigned char type) 642int gpio_pm_wakeup_request(unsigned gpio, unsigned char type)
649{ 643{
650 unsigned long flags; 644 unsigned long flags;
651 645
@@ -653,7 +647,6 @@ int gpio_pm_wakeup_request(unsigned short gpio, unsigned char type)
653 return -EINVAL; 647 return -EINVAL;
654 648
655 local_irq_save(flags); 649 local_irq_save(flags);
656
657 wakeup_map[gpio_bank(gpio)] |= gpio_bit(gpio); 650 wakeup_map[gpio_bank(gpio)] |= gpio_bit(gpio);
658 wakeup_flags_map[gpio] = type; 651 wakeup_flags_map[gpio] = type;
659 local_irq_restore(flags); 652 local_irq_restore(flags);
@@ -662,7 +655,7 @@ int gpio_pm_wakeup_request(unsigned short gpio, unsigned char type)
662} 655}
663EXPORT_SYMBOL(gpio_pm_wakeup_request); 656EXPORT_SYMBOL(gpio_pm_wakeup_request);
664 657
665void gpio_pm_wakeup_free(unsigned short gpio) 658void gpio_pm_wakeup_free(unsigned gpio)
666{ 659{
667 unsigned long flags; 660 unsigned long flags;
668 661
@@ -677,7 +670,7 @@ void gpio_pm_wakeup_free(unsigned short gpio)
677} 670}
678EXPORT_SYMBOL(gpio_pm_wakeup_free); 671EXPORT_SYMBOL(gpio_pm_wakeup_free);
679 672
680static int bfin_gpio_wakeup_type(unsigned short gpio, unsigned char type) 673static int bfin_gpio_wakeup_type(unsigned gpio, unsigned char type)
681{ 674{
682 port_setup(gpio, GPIO_USAGE); 675 port_setup(gpio, GPIO_USAGE);
683 set_gpio_dir(gpio, 0); 676 set_gpio_dir(gpio, 0);
@@ -784,6 +777,14 @@ void gpio_pm_restore(void)
784} 777}
785 778
786#endif 779#endif
780#else /* BF548_FAMILY */
781
782unsigned short get_gpio_dir(unsigned gpio)
783{
784 return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio)));
785}
786EXPORT_SYMBOL(get_gpio_dir);
787
787#endif /* BF548_FAMILY */ 788#endif /* BF548_FAMILY */
788 789
789/*********************************************************** 790/***********************************************************
@@ -1028,7 +1029,7 @@ EXPORT_SYMBOL(peripheral_free_list);
1028* MODIFICATION HISTORY : 1029* MODIFICATION HISTORY :
1029**************************************************************/ 1030**************************************************************/
1030 1031
1031int gpio_request(unsigned short gpio, const char *label) 1032int gpio_request(unsigned gpio, const char *label)
1032{ 1033{
1033 unsigned long flags; 1034 unsigned long flags;
1034 1035
@@ -1075,7 +1076,7 @@ int gpio_request(unsigned short gpio, const char *label)
1075} 1076}
1076EXPORT_SYMBOL(gpio_request); 1077EXPORT_SYMBOL(gpio_request);
1077 1078
1078void gpio_free(unsigned short gpio) 1079void gpio_free(unsigned gpio)
1079{ 1080{
1080 unsigned long flags; 1081 unsigned long flags;
1081 1082
@@ -1085,7 +1086,7 @@ void gpio_free(unsigned short gpio)
1085 local_irq_save(flags); 1086 local_irq_save(flags);
1086 1087
1087 if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) { 1088 if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
1088 printk(KERN_ERR "bfin-gpio: GPIO %d wasn't reserved!\n", gpio); 1089 gpio_error(gpio);
1089 dump_stack(); 1090 dump_stack();
1090 local_irq_restore(flags); 1091 local_irq_restore(flags);
1091 return; 1092 return;
@@ -1101,44 +1102,55 @@ void gpio_free(unsigned short gpio)
1101} 1102}
1102EXPORT_SYMBOL(gpio_free); 1103EXPORT_SYMBOL(gpio_free);
1103 1104
1105
1104#ifdef BF548_FAMILY 1106#ifdef BF548_FAMILY
1105void gpio_direction_input(unsigned short gpio) 1107int gpio_direction_input(unsigned gpio)
1106{ 1108{
1107 unsigned long flags; 1109 unsigned long flags;
1108 1110
1109 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); 1111 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1112 gpio_error(gpio);
1113 return -EINVAL;
1114 }
1110 1115
1111 local_irq_save(flags); 1116 local_irq_save(flags);
1112 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio); 1117 gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
1113 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio); 1118 gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
1114 local_irq_restore(flags); 1119 local_irq_restore(flags);
1120
1121 return 0;
1115} 1122}
1116EXPORT_SYMBOL(gpio_direction_input); 1123EXPORT_SYMBOL(gpio_direction_input);
1117 1124
1118void gpio_direction_output(unsigned short gpio) 1125int gpio_direction_output(unsigned gpio, int value)
1119{ 1126{
1120 unsigned long flags; 1127 unsigned long flags;
1121 1128
1122 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); 1129 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1130 gpio_error(gpio);
1131 return -EINVAL;
1132 }
1123 1133
1124 local_irq_save(flags); 1134 local_irq_save(flags);
1125 gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio); 1135 gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio);
1136 gpio_set_value(gpio, value);
1126 gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio); 1137 gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio);
1127 local_irq_restore(flags); 1138 local_irq_restore(flags);
1139
1140 return 0;
1128} 1141}
1129EXPORT_SYMBOL(gpio_direction_output); 1142EXPORT_SYMBOL(gpio_direction_output);
1130 1143
1131void gpio_set_value(unsigned short gpio, unsigned short arg) 1144void gpio_set_value(unsigned gpio, int arg)
1132{ 1145{
1133 if (arg) 1146 if (arg)
1134 gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio); 1147 gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio);
1135 else 1148 else
1136 gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio); 1149 gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio);
1137
1138} 1150}
1139EXPORT_SYMBOL(gpio_set_value); 1151EXPORT_SYMBOL(gpio_set_value);
1140 1152
1141unsigned short gpio_get_value(unsigned short gpio) 1153int gpio_get_value(unsigned gpio)
1142{ 1154{
1143 return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio))); 1155 return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio)));
1144} 1156}
@@ -1146,31 +1158,47 @@ EXPORT_SYMBOL(gpio_get_value);
1146 1158
1147#else 1159#else
1148 1160
1149void gpio_direction_input(unsigned short gpio) 1161int gpio_direction_input(unsigned gpio)
1150{ 1162{
1151 unsigned long flags; 1163 unsigned long flags;
1152 1164
1153 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); 1165 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1166 gpio_error(gpio);
1167 return -EINVAL;
1168 }
1154 1169
1155 local_irq_save(flags); 1170 local_irq_save(flags);
1156 gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio); 1171 gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
1157 gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio); 1172 gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
1158 AWA_DUMMY_READ(inen); 1173 AWA_DUMMY_READ(inen);
1159 local_irq_restore(flags); 1174 local_irq_restore(flags);
1175
1176 return 0;
1160} 1177}
1161EXPORT_SYMBOL(gpio_direction_input); 1178EXPORT_SYMBOL(gpio_direction_input);
1162 1179
1163void gpio_direction_output(unsigned short gpio) 1180int gpio_direction_output(unsigned gpio, int value)
1164{ 1181{
1165 unsigned long flags; 1182 unsigned long flags;
1166 1183
1167 BUG_ON(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))); 1184 if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
1185 gpio_error(gpio);
1186 return -EINVAL;
1187 }
1168 1188
1169 local_irq_save(flags); 1189 local_irq_save(flags);
1170 gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio); 1190 gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
1191
1192 if (value)
1193 gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
1194 else
1195 gpio_bankb[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
1196
1171 gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio); 1197 gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
1172 AWA_DUMMY_READ(dir); 1198 AWA_DUMMY_READ(dir);
1173 local_irq_restore(flags); 1199 local_irq_restore(flags);
1200
1201 return 0;
1174} 1202}
1175EXPORT_SYMBOL(gpio_direction_output); 1203EXPORT_SYMBOL(gpio_direction_output);
1176 1204
@@ -1190,7 +1218,40 @@ void bfin_gpio_reset_spi0_ssel1(void)
1190 1218
1191 port_setup(gpio, GPIO_USAGE); 1219 port_setup(gpio, GPIO_USAGE);
1192 gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio); 1220 gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
1221 AWA_DUMMY_READ(data_set);
1193 udelay(1); 1222 udelay(1);
1194} 1223}
1195 1224
1196#endif /*BF548_FAMILY */ 1225#endif /*BF548_FAMILY */
1226
1227#if defined(CONFIG_PROC_FS)
1228static int gpio_proc_read(char *buf, char **start, off_t offset,
1229 int len, int *unused_i, void *unused_v)
1230{
1231 int c, outlen = 0;
1232
1233 for (c = 0; c < MAX_RESOURCES; c++) {
1234 if (!check_gpio(c) && (reserved_gpio_map[gpio_bank(c)] & gpio_bit(c)))
1235 len = sprintf(buf, "GPIO_%d: %s \t\tGPIO %s\n", c,
1236 get_label(c), get_gpio_dir(c) ? "OUTPUT" : "INPUT");
1237 else if (reserved_peri_map[gpio_bank(c)] & gpio_bit(c))
1238 len = sprintf(buf, "GPIO_%d: %s \t\tPeripheral\n", c, get_label(c));
1239 else
1240 continue;
1241 buf += len;
1242 outlen += len;
1243 }
1244 return outlen;
1245}
1246
1247static __init int gpio_register_proc(void)
1248{
1249 struct proc_dir_entry *proc_gpio;
1250
1251 proc_gpio = create_proc_entry("gpio", S_IRUGO, NULL);
1252 if (proc_gpio)
1253 proc_gpio->read_proc = gpio_proc_read;
1254 return proc_gpio != NULL;
1255}
1256__initcall(gpio_register_proc);
1257#endif
diff --git a/arch/blackfin/kernel/cplb-mpu/Makefile b/arch/blackfin/kernel/cplb-mpu/Makefile
new file mode 100644
index 000000000000..286b69357f97
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-mpu/Makefile
@@ -0,0 +1,8 @@
1#
2# arch/blackfin/kernel/cplb-nompu/Makefile
3#
4
5obj-y := cplbinit.o cacheinit.o cplbmgr.o
6
7obj-$(CONFIG_CPLB_INFO) += cplbinfo.o
8
diff --git a/arch/blackfin/kernel/cplb-mpu/cacheinit.c b/arch/blackfin/kernel/cplb-mpu/cacheinit.c
new file mode 100644
index 000000000000..9eecfa403187
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-mpu/cacheinit.c
@@ -0,0 +1,62 @@
1/*
2 * Copyright 2004-2007 Analog Devices Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see the file COPYING, or write
16 * to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#include <linux/cpu.h>
21
22#include <asm/cacheflush.h>
23#include <asm/blackfin.h>
24#include <asm/cplb.h>
25#include <asm/cplbinit.h>
26
27#if defined(CONFIG_BFIN_ICACHE)
28void bfin_icache_init(void)
29{
30 unsigned long ctrl;
31 int i;
32
33 SSYNC();
34 for (i = 0; i < MAX_CPLBS; i++) {
35 bfin_write32(ICPLB_ADDR0 + i * 4, icplb_tbl[i].addr);
36 bfin_write32(ICPLB_DATA0 + i * 4, icplb_tbl[i].data);
37 }
38 ctrl = bfin_read_IMEM_CONTROL();
39 ctrl |= IMC | ENICPLB;
40 bfin_write_IMEM_CONTROL(ctrl);
41 SSYNC();
42}
43#endif
44
45#if defined(CONFIG_BFIN_DCACHE)
46void bfin_dcache_init(void)
47{
48 unsigned long ctrl;
49 int i;
50
51 SSYNC();
52 for (i = 0; i < MAX_CPLBS; i++) {
53 bfin_write32(DCPLB_ADDR0 + i * 4, dcplb_tbl[i].addr);
54 bfin_write32(DCPLB_DATA0 + i * 4, dcplb_tbl[i].data);
55 }
56
57 ctrl = bfin_read_DMEM_CONTROL();
58 ctrl |= DMEM_CNTR;
59 bfin_write_DMEM_CONTROL(ctrl);
60 SSYNC();
61}
62#endif
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinfo.c b/arch/blackfin/kernel/cplb-mpu/cplbinfo.c
new file mode 100644
index 000000000000..bd072299f7f2
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-mpu/cplbinfo.c
@@ -0,0 +1,144 @@
1/*
2 * File: arch/blackfin/mach-common/cplbinfo.c
3 * Based on:
4 * Author: Sonic Zhang <sonic.zhang@analog.com>
5 *
6 * Created: Jan. 2005
7 * Description: Display CPLB status
8 *
9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc.
11 *
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, see the file COPYING, or write
26 * to the Free Software Foundation, Inc.,
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29
30#include <linux/module.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33#include <linux/proc_fs.h>
34#include <linux/uaccess.h>
35
36#include <asm/current.h>
37#include <asm/system.h>
38#include <asm/cplb.h>
39#include <asm/cplbinit.h>
40#include <asm/blackfin.h>
41
42#define CPLB_I 1
43#define CPLB_D 2
44
45#define SYNC_SYS SSYNC()
46#define SYNC_CORE CSYNC()
47
48#define CPLB_BIT_PAGESIZE 0x30000
49
50static char page_size_string_table[][4] = { "1K", "4K", "1M", "4M" };
51
52static char *cplb_print_entry(char *buf, struct cplb_entry *tbl, int switched)
53{
54 int i;
55 buf += sprintf(buf, "Index\tAddress\t\tData\tSize\tU/RD\tU/WR\tS/WR\tSwitch\n");
56 for (i = 0; i < MAX_CPLBS; i++) {
57 unsigned long data = tbl[i].data;
58 unsigned long addr = tbl[i].addr;
59 if (!(data & CPLB_VALID))
60 continue;
61
62 buf +=
63 sprintf(buf,
64 "%d\t0x%08lx\t%06lx\t%s\t%c\t%c\t%c\t%c\n",
65 i, addr, data,
66 page_size_string_table[(data & 0x30000) >> 16],
67 (data & CPLB_USER_RD) ? 'Y' : 'N',
68 (data & CPLB_USER_WR) ? 'Y' : 'N',
69 (data & CPLB_SUPV_WR) ? 'Y' : 'N',
70 i < switched ? 'N' : 'Y');
71 }
72 buf += sprintf(buf, "\n");
73
74 return buf;
75}
76
77int cplbinfo_proc_output(char *buf)
78{
79 char *p;
80
81 p = buf;
82
83 p += sprintf(p, "------------------ CPLB Information ------------------\n\n");
84
85 if (bfin_read_IMEM_CONTROL() & ENICPLB) {
86 p += sprintf(p, "Instruction CPLB entry:\n");
87 p = cplb_print_entry(p, icplb_tbl, first_switched_icplb);
88 } else
89 p += sprintf(p, "Instruction CPLB is disabled.\n\n");
90
91 if (1 || bfin_read_DMEM_CONTROL() & ENDCPLB) {
92 p += sprintf(p, "Data CPLB entry:\n");
93 p = cplb_print_entry(p, dcplb_tbl, first_switched_dcplb);
94 } else
95 p += sprintf(p, "Data CPLB is disabled.\n");
96
97 p += sprintf(p, "ICPLB miss: %d\nICPLB supervisor miss: %d\n",
98 nr_icplb_miss, nr_icplb_supv_miss);
99 p += sprintf(p, "DCPLB miss: %d\nDCPLB protection fault:%d\n",
100 nr_dcplb_miss, nr_dcplb_prot);
101 p += sprintf(p, "CPLB flushes: %d\n",
102 nr_cplb_flush);
103
104 return p - buf;
105}
106
107static int cplbinfo_read_proc(char *page, char **start, off_t off,
108 int count, int *eof, void *data)
109{
110 int len;
111
112 len = cplbinfo_proc_output(page);
113 if (len <= off + count)
114 *eof = 1;
115 *start = page + off;
116 len -= off;
117 if (len > count)
118 len = count;
119 if (len < 0)
120 len = 0;
121 return len;
122}
123
124static int __init cplbinfo_init(void)
125{
126 struct proc_dir_entry *entry;
127
128 entry = create_proc_entry("cplbinfo", 0, NULL);
129 if (!entry)
130 return -ENOMEM;
131
132 entry->read_proc = cplbinfo_read_proc;
133 entry->data = NULL;
134
135 return 0;
136}
137
138static void __exit cplbinfo_exit(void)
139{
140 remove_proc_entry("cplbinfo", NULL);
141}
142
143module_init(cplbinfo_init);
144module_exit(cplbinfo_exit);
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbinit.c b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
new file mode 100644
index 000000000000..e2e2b5079f5b
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-mpu/cplbinit.c
@@ -0,0 +1,91 @@
1/*
2 * Blackfin CPLB initialization
3 *
4 * Copyright 2004-2007 Analog Devices Inc.
5 *
6 * Bugs: Enter bugs at http://blackfin.uclinux.org/
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 as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see the file COPYING, or write
20 * to the Free Software Foundation, Inc.,
21 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23#include <linux/module.h>
24
25#include <asm/blackfin.h>
26#include <asm/cplb.h>
27#include <asm/cplbinit.h>
28
29struct cplb_entry icplb_tbl[MAX_CPLBS];
30struct cplb_entry dcplb_tbl[MAX_CPLBS];
31
32int first_switched_icplb, first_switched_dcplb;
33int first_mask_dcplb;
34
35void __init generate_cpl_tables(void)
36{
37 int i_d, i_i;
38 unsigned long addr;
39 unsigned long d_data, i_data;
40 unsigned long d_cache = 0, i_cache = 0;
41
42#ifdef CONFIG_BFIN_ICACHE
43 i_cache = CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND;
44#endif
45
46#ifdef CONFIG_BFIN_DCACHE
47 d_cache = CPLB_L1_CHBL;
48#ifdef CONFIG_BLKFIN_WT
49 d_cache |= CPLB_L1_AOW | CPLB_WT;
50#endif
51#endif
52 i_d = i_i = 0;
53
54 /* Set up the zero page. */
55 dcplb_tbl[i_d].addr = 0;
56 dcplb_tbl[i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
57
58#if 0
59 icplb_tbl[i_i].addr = 0;
60 icplb_tbl[i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB;
61#endif
62
63 /* Cover kernel memory with 4M pages. */
64 addr = 0;
65 d_data = d_cache | CPLB_SUPV_WR | CPLB_VALID | PAGE_SIZE_4MB | CPLB_DIRTY;
66 i_data = i_cache | CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4MB;
67
68 for (; addr < memory_start; addr += 4 * 1024 * 1024) {
69 dcplb_tbl[i_d].addr = addr;
70 dcplb_tbl[i_d++].data = d_data;
71 icplb_tbl[i_i].addr = addr;
72 icplb_tbl[i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0);
73 }
74
75 /* Cover L1 memory. One 4M area for code and data each is enough. */
76#if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0
77 dcplb_tbl[i_d].addr = L1_DATA_A_START;
78 dcplb_tbl[i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB;
79#endif
80 icplb_tbl[i_i].addr = L1_CODE_START;
81 icplb_tbl[i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB;
82
83 first_mask_dcplb = i_d;
84 first_switched_dcplb = i_d + (1 << page_mask_order);
85 first_switched_icplb = i_i;
86
87 while (i_d < MAX_CPLBS)
88 dcplb_tbl[i_d++].data = 0;
89 while (i_i < MAX_CPLBS)
90 icplb_tbl[i_i++].data = 0;
91}
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
new file mode 100644
index 000000000000..c426a22f9907
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
@@ -0,0 +1,338 @@
1/*
2 * Blackfin CPLB exception handling.
3 * Copyright 2004-2007 Analog Devices Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see the file COPYING, or write
17 * to the Free Software Foundation, Inc.,
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20#include <linux/module.h>
21#include <linux/mm.h>
22
23#include <asm/blackfin.h>
24#include <asm/cplbinit.h>
25#include <asm/mmu_context.h>
26
27#ifdef CONFIG_BFIN_ICACHE
28
29#define FAULT_RW (1 << 16)
30#define FAULT_USERSUPV (1 << 17)
31
32int page_mask_nelts;
33int page_mask_order;
34unsigned long *current_rwx_mask;
35
36int nr_dcplb_miss, nr_icplb_miss, nr_icplb_supv_miss, nr_dcplb_prot;
37int nr_cplb_flush;
38
39static inline void disable_dcplb(void)
40{
41 unsigned long ctrl;
42 SSYNC();
43 ctrl = bfin_read_DMEM_CONTROL();
44 ctrl &= ~ENDCPLB;
45 bfin_write_DMEM_CONTROL(ctrl);
46 SSYNC();
47}
48
49static inline void enable_dcplb(void)
50{
51 unsigned long ctrl;
52 SSYNC();
53 ctrl = bfin_read_DMEM_CONTROL();
54 ctrl |= ENDCPLB;
55 bfin_write_DMEM_CONTROL(ctrl);
56 SSYNC();
57}
58
59static inline void disable_icplb(void)
60{
61 unsigned long ctrl;
62 SSYNC();
63 ctrl = bfin_read_IMEM_CONTROL();
64 ctrl &= ~ENICPLB;
65 bfin_write_IMEM_CONTROL(ctrl);
66 SSYNC();
67}
68
69static inline void enable_icplb(void)
70{
71 unsigned long ctrl;
72 SSYNC();
73 ctrl = bfin_read_IMEM_CONTROL();
74 ctrl |= ENICPLB;
75 bfin_write_IMEM_CONTROL(ctrl);
76 SSYNC();
77}
78
79/*
80 * Given the contents of the status register, return the index of the
81 * CPLB that caused the fault.
82 */
83static inline int faulting_cplb_index(int status)
84{
85 int signbits = __builtin_bfin_norm_fr1x32(status & 0xFFFF);
86 return 30 - signbits;
87}
88
89/*
90 * Given the contents of the status register and the DCPLB_DATA contents,
91 * return true if a write access should be permitted.
92 */
93static inline int write_permitted(int status, unsigned long data)
94{
95 if (status & FAULT_USERSUPV)
96 return !!(data & CPLB_SUPV_WR);
97 else
98 return !!(data & CPLB_USER_WR);
99}
100
101/* Counters to implement round-robin replacement. */
102static int icplb_rr_index, dcplb_rr_index;
103
104/*
105 * Find an ICPLB entry to be evicted and return its index.
106 */
107static int evict_one_icplb(void)
108{
109 int i;
110 for (i = first_switched_icplb; i < MAX_CPLBS; i++)
111 if ((icplb_tbl[i].data & CPLB_VALID) == 0)
112 return i;
113 i = first_switched_icplb + icplb_rr_index;
114 if (i >= MAX_CPLBS) {
115 i -= MAX_CPLBS - first_switched_icplb;
116 icplb_rr_index -= MAX_CPLBS - first_switched_icplb;
117 }
118 icplb_rr_index++;
119 return i;
120}
121
122static int evict_one_dcplb(void)
123{
124 int i;
125 for (i = first_switched_dcplb; i < MAX_CPLBS; i++)
126 if ((dcplb_tbl[i].data & CPLB_VALID) == 0)
127 return i;
128 i = first_switched_dcplb + dcplb_rr_index;
129 if (i >= MAX_CPLBS) {
130 i -= MAX_CPLBS - first_switched_dcplb;
131 dcplb_rr_index -= MAX_CPLBS - first_switched_dcplb;
132 }
133 dcplb_rr_index++;
134 return i;
135}
136
137static noinline int dcplb_miss(void)
138{
139 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR();
140 int status = bfin_read_DCPLB_STATUS();
141 unsigned long *mask;
142 int idx;
143 unsigned long d_data;
144
145 nr_dcplb_miss++;
146 if (addr >= _ramend)
147 return CPLB_PROT_VIOL;
148
149 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
150#ifdef CONFIG_BFIN_DCACHE
151 d_data |= CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND;
152#ifdef CONFIG_BLKFIN_WT
153 d_data |= CPLB_L1_AOW | CPLB_WT;
154#endif
155#endif
156 mask = current_rwx_mask;
157 if (mask) {
158 int page = addr >> PAGE_SHIFT;
159 int offs = page >> 5;
160 int bit = 1 << (page & 31);
161
162 if (mask[offs] & bit)
163 d_data |= CPLB_USER_RD;
164
165 mask += page_mask_nelts;
166 if (mask[offs] & bit)
167 d_data |= CPLB_USER_WR;
168 }
169
170 idx = evict_one_dcplb();
171
172 addr &= PAGE_MASK;
173 dcplb_tbl[idx].addr = addr;
174 dcplb_tbl[idx].data = d_data;
175
176 disable_dcplb();
177 bfin_write32(DCPLB_DATA0 + idx * 4, d_data);
178 bfin_write32(DCPLB_ADDR0 + idx * 4, addr);
179 enable_dcplb();
180
181 return 0;
182}
183
184static noinline int icplb_miss(void)
185{
186 unsigned long addr = bfin_read_ICPLB_FAULT_ADDR();
187 int status = bfin_read_ICPLB_STATUS();
188 int idx;
189 unsigned long i_data;
190
191 nr_icplb_miss++;
192 if (status & FAULT_USERSUPV)
193 nr_icplb_supv_miss++;
194
195 if (addr >= _ramend)
196 return CPLB_PROT_VIOL;
197
198 /*
199 * First, try to find a CPLB that matches this address. If we
200 * find one, then the fact that we're in the miss handler means
201 * that the instruction crosses a page boundary.
202 */
203 for (idx = first_switched_icplb; idx < MAX_CPLBS; idx++) {
204 if (icplb_tbl[idx].data & CPLB_VALID) {
205 unsigned long this_addr = icplb_tbl[idx].addr;
206 if (this_addr <= addr && this_addr + PAGE_SIZE > addr) {
207 addr += PAGE_SIZE;
208 break;
209 }
210 }
211 }
212
213 i_data = CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4KB;
214#ifdef CONFIG_BFIN_ICACHE
215 i_data |= CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND;
216#endif
217
218 /*
219 * Two cases to distinguish - a supervisor access must necessarily
220 * be for a module page; we grant it unconditionally (could do better
221 * here in the future). Otherwise, check the x bitmap of the current
222 * process.
223 */
224 if (!(status & FAULT_USERSUPV)) {
225 unsigned long *mask = current_rwx_mask;
226
227 if (mask) {
228 int page = addr >> PAGE_SHIFT;
229 int offs = page >> 5;
230 int bit = 1 << (page & 31);
231
232 mask += 2 * page_mask_nelts;
233 if (mask[offs] & bit)
234 i_data |= CPLB_USER_RD;
235 }
236 }
237
238 idx = evict_one_icplb();
239 addr &= PAGE_MASK;
240 icplb_tbl[idx].addr = addr;
241 icplb_tbl[idx].data = i_data;
242
243 disable_icplb();
244 bfin_write32(ICPLB_DATA0 + idx * 4, i_data);
245 bfin_write32(ICPLB_ADDR0 + idx * 4, addr);
246 enable_icplb();
247
248 return 0;
249}
250
251static noinline int dcplb_protection_fault(void)
252{
253 unsigned long addr = bfin_read_DCPLB_FAULT_ADDR();
254 int status = bfin_read_DCPLB_STATUS();
255
256 nr_dcplb_prot++;
257
258 if (status & FAULT_RW) {
259 int idx = faulting_cplb_index(status);
260 unsigned long data = dcplb_tbl[idx].data;
261 if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) &&
262 write_permitted(status, data)) {
263 data |= CPLB_DIRTY;
264 dcplb_tbl[idx].data = data;
265 bfin_write32(DCPLB_DATA0 + idx * 4, data);
266 return 0;
267 }
268 }
269 return CPLB_PROT_VIOL;
270}
271
272int cplb_hdr(int seqstat, struct pt_regs *regs)
273{
274 int cause = seqstat & 0x3f;
275 switch (cause) {
276 case 0x23:
277 return dcplb_protection_fault();
278 case 0x2C:
279 return icplb_miss();
280 case 0x26:
281 return dcplb_miss();
282 default:
283 return 1;
284 panic_cplb_error(seqstat, regs);
285 }
286}
287
288void flush_switched_cplbs(void)
289{
290 int i;
291
292 nr_cplb_flush++;
293
294 disable_icplb();
295 for (i = first_switched_icplb; i < MAX_CPLBS; i++) {
296 icplb_tbl[i].data = 0;
297 bfin_write32(ICPLB_DATA0 + i * 4, 0);
298 }
299 enable_icplb();
300
301 disable_dcplb();
302 for (i = first_mask_dcplb; i < MAX_CPLBS; i++) {
303 dcplb_tbl[i].data = 0;
304 bfin_write32(DCPLB_DATA0 + i * 4, 0);
305 }
306 enable_dcplb();
307}
308
309void set_mask_dcplbs(unsigned long *masks)
310{
311 int i;
312 unsigned long addr = (unsigned long)masks;
313 unsigned long d_data;
314 current_rwx_mask = masks;
315
316 if (!masks)
317 return;
318
319 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
320#ifdef CONFIG_BFIN_DCACHE
321 d_data |= CPLB_L1_CHBL;
322#ifdef CONFIG_BLKFIN_WT
323 d_data |= CPLB_L1_AOW | CPLB_WT;
324#endif
325#endif
326
327 disable_dcplb();
328 for (i = first_mask_dcplb; i < first_switched_dcplb; i++) {
329 dcplb_tbl[i].addr = addr;
330 dcplb_tbl[i].data = d_data;
331 bfin_write32(DCPLB_DATA0 + i * 4, d_data);
332 bfin_write32(DCPLB_ADDR0 + i * 4, addr);
333 addr += PAGE_SIZE;
334 }
335 enable_dcplb();
336}
337
338#endif
diff --git a/arch/blackfin/kernel/cplb-nompu/Makefile b/arch/blackfin/kernel/cplb-nompu/Makefile
new file mode 100644
index 000000000000..d36ea9b5382e
--- /dev/null
+++ b/arch/blackfin/kernel/cplb-nompu/Makefile
@@ -0,0 +1,8 @@
1#
2# arch/blackfin/kernel/cplb-nompu/Makefile
3#
4
5obj-y := cplbinit.o cacheinit.o cplbhdlr.o cplbmgr.o
6
7obj-$(CONFIG_CPLB_INFO) += cplbinfo.o
8
diff --git a/arch/blackfin/kernel/cacheinit.c b/arch/blackfin/kernel/cplb-nompu/cacheinit.c
index 62cbba7364b0..8a18399f6072 100644
--- a/arch/blackfin/kernel/cacheinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cacheinit.c
@@ -42,6 +42,7 @@ void bfin_icache_init(void)
42 ctrl = bfin_read_IMEM_CONTROL(); 42 ctrl = bfin_read_IMEM_CONTROL();
43 ctrl |= IMC | ENICPLB; 43 ctrl |= IMC | ENICPLB;
44 bfin_write_IMEM_CONTROL(ctrl); 44 bfin_write_IMEM_CONTROL(ctrl);
45 SSYNC();
45} 46}
46#endif 47#endif
47 48
@@ -63,5 +64,6 @@ void bfin_dcache_init(void)
63 ctrl = bfin_read_DMEM_CONTROL(); 64 ctrl = bfin_read_DMEM_CONTROL();
64 ctrl |= DMEM_CNTR; 65 ctrl |= DMEM_CNTR;
65 bfin_write_DMEM_CONTROL(ctrl); 66 bfin_write_DMEM_CONTROL(ctrl);
67 SSYNC();
66} 68}
67#endif 69#endif
diff --git a/arch/blackfin/mach-common/cplbhdlr.S b/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
index 2788532de72b..2788532de72b 100644
--- a/arch/blackfin/mach-common/cplbhdlr.S
+++ b/arch/blackfin/kernel/cplb-nompu/cplbhdlr.S
diff --git a/arch/blackfin/mach-common/cplbinfo.c b/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
index a4f0b428a34d..a4f0b428a34d 100644
--- a/arch/blackfin/mach-common/cplbinfo.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinfo.c
diff --git a/arch/blackfin/kernel/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 6320bc45fbba..6320bc45fbba 100644
--- a/arch/blackfin/kernel/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
diff --git a/arch/blackfin/mach-common/cplbmgr.S b/arch/blackfin/kernel/cplb-nompu/cplbmgr.S
index 6f909cbfac7b..f5cf3accef37 100644
--- a/arch/blackfin/mach-common/cplbmgr.S
+++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.S
@@ -75,6 +75,15 @@ ENTRY(_cplb_mgr)
75 * from the configuration table. 75 * from the configuration table.
76 */ 76 */
77 77
78 /* A multi-word instruction can cross a page boundary. This means the
79 * first part of the instruction can be in a valid page, but the
80 * second part is not, and hence generates the instruction miss.
81 * However, the fault address is for the start of the instruction,
82 * not the part that's in the bad page. Therefore, we have to check
83 * whether the fault address applies to a page that is already present
84 * in the table.
85 */
86
78 P4.L = LO(ICPLB_FAULT_ADDR); 87 P4.L = LO(ICPLB_FAULT_ADDR);
79 P4.H = HI(ICPLB_FAULT_ADDR); 88 P4.H = HI(ICPLB_FAULT_ADDR);
80 89
@@ -87,7 +96,7 @@ ENTRY(_cplb_mgr)
87 R4 = [P4]; /* Get faulting address*/ 96 R4 = [P4]; /* Get faulting address*/
88 R6 = 64; /* Advance past the fault address, which*/ 97 R6 = 64; /* Advance past the fault address, which*/
89 R6 = R6 + R4; /* we'll use if we find a match*/ 98 R6 = R6 + R4; /* we'll use if we find a match*/
90 R3 = ((16 << 8) | 2); /* Extract mask, bits 16 and 17.*/ 99 R3 = ((16 << 8) | 2); /* Extract mask, two bits at posn 16 */
91 100
92 R5 = 0; 101 R5 = 0;
93.Lisearch: 102.Lisearch:
@@ -125,7 +134,9 @@ ENTRY(_cplb_mgr)
125 P4.L = LO(IMEM_CONTROL); 134 P4.L = LO(IMEM_CONTROL);
126 P4.H = HI(IMEM_CONTROL); 135 P4.H = HI(IMEM_CONTROL);
127 136
128 /* disable cplbs */ 137 /* Turn off CPLBs while we work, necessary according to HRM before
138 * modifying CPLB descriptors
139 */
129 R5 = [P4]; /* Control Register*/ 140 R5 = [P4]; /* Control Register*/
130 BITCLR(R5,ENICPLB_P); 141 BITCLR(R5,ENICPLB_P);
131 CLI R1; 142 CLI R1;
@@ -179,7 +190,14 @@ ENTRY(_cplb_mgr)
179 [P0 - 4] = R0; 190 [P0 - 4] = R0;
180 R0 = [P0 - 0x100]; 191 R0 = [P0 - 0x100];
181 [P0-0x104] = R0; 192 [P0-0x104] = R0;
182.Lie_move:P0+=4; 193.Lie_move:
194 P0+=4;
195
196 /* Clear ICPLB_DATA15, in case we don't find a replacement
197 * otherwise, we would have a duplicate entry, and will crash
198 */
199 R0 = 0;
200 [P0 - 4] = R0;
183 201
184 /* We've made space in the ICPLB table, so that ICPLB15 202 /* We've made space in the ICPLB table, so that ICPLB15
185 * is now free to be overwritten. Next, we have to determine 203 * is now free to be overwritten. Next, we have to determine
@@ -504,14 +522,23 @@ ENTRY(_cplb_mgr)
504 R0 = [P0++]; /* move data */ 522 R0 = [P0++]; /* move data */
505 [P0 - 8] = R0; 523 [P0 - 8] = R0;
506 R0 = [P0-0x104] /* move address */ 524 R0 = [P0-0x104] /* move address */
507.Lde_move: [P0-0x108] = R0; 525.Lde_move:
526 [P0-0x108] = R0;
527
528.Lde_moved:
529 NOP;
530
531 /* Clear DCPLB_DATA15, in case we don't find a replacement
532 * otherwise, we would have a duplicate entry, and will crash
533 */
534 R0 = 0;
535 [P0 - 0x4] = R0;
508 536
509 /* We've now made space in DCPLB15 for the new CPLB to be 537 /* We've now made space in DCPLB15 for the new CPLB to be
510 * installed. The next stage is to locate a CPLB in the 538 * installed. The next stage is to locate a CPLB in the
511 * config table that covers the faulting address. 539 * config table that covers the faulting address.
512 */ 540 */
513 541
514.Lde_moved:NOP;
515 R0 = I0; /* Our faulting address */ 542 R0 = I0; /* Our faulting address */
516 543
517 P2.L = _dpdt_table; 544 P2.L = _dpdt_table;
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c
index 724f4a5a1d46..60f67f90fe35 100644
--- a/arch/blackfin/kernel/early_printk.c
+++ b/arch/blackfin/kernel/early_printk.c
@@ -187,7 +187,7 @@ asmlinkage void __init init_early_exception_vectors(void)
187 bfin_write_EVT15(early_trap); 187 bfin_write_EVT15(early_trap);
188 CSYNC(); 188 CSYNC();
189 189
190 /* Set all the return from interupt, exception, NMI to a known place 190 /* Set all the return from interrupt, exception, NMI to a known place
191 * so if we do a RETI, RETX or RETN by mistake - we go somewhere known 191 * so if we do a RETI, RETX or RETN by mistake - we go somewhere known
192 * Note - don't change RETS - we are in a subroutine, or 192 * Note - don't change RETS - we are in a subroutine, or
193 * RETE - since it might screw up if emulator is attached 193 * RETE - since it might screw up if emulator is attached
@@ -205,7 +205,7 @@ asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr)
205 if (likely(early_console == NULL)) 205 if (likely(early_console == NULL))
206 setup_early_printk(DEFAULT_EARLY_PORT); 206 setup_early_printk(DEFAULT_EARLY_PORT);
207 207
208 dump_bfin_mem((void *)fp->retx); 208 dump_bfin_mem(fp);
209 show_regs(fp); 209 show_regs(fp);
210 dump_bfin_trace_buffer(); 210 dump_bfin_trace_buffer();
211 211
diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c
index 5bf15125f0d6..023dc80af187 100644
--- a/arch/blackfin/kernel/process.c
+++ b/arch/blackfin/kernel/process.c
@@ -39,9 +39,6 @@
39#include <asm/blackfin.h> 39#include <asm/blackfin.h>
40#include <asm/fixed_code.h> 40#include <asm/fixed_code.h>
41 41
42#define LED_ON 0
43#define LED_OFF 1
44
45asmlinkage void ret_from_fork(void); 42asmlinkage void ret_from_fork(void);
46 43
47/* Points to the SDRAM backup memory for the stack that is currently in 44/* Points to the SDRAM backup memory for the stack that is currently in
@@ -70,32 +67,6 @@ void (*pm_power_off)(void) = NULL;
70EXPORT_SYMBOL(pm_power_off); 67EXPORT_SYMBOL(pm_power_off);
71 68
72/* 69/*
73 * We are using a different LED from the one used to indicate timer interrupt.
74 */
75#if defined(CONFIG_BFIN_IDLE_LED)
76static inline void leds_switch(int flag)
77{
78 unsigned short tmp = 0;
79
80 tmp = bfin_read_CONFIG_BFIN_IDLE_LED_PORT();
81 SSYNC();
82
83 if (flag == LED_ON)
84 tmp &= ~CONFIG_BFIN_IDLE_LED_PIN; /* light on */
85 else
86 tmp |= CONFIG_BFIN_IDLE_LED_PIN; /* light off */
87
88 bfin_write_CONFIG_BFIN_IDLE_LED_PORT(tmp);
89 SSYNC();
90
91}
92#else
93static inline void leds_switch(int flag)
94{
95}
96#endif
97
98/*
99 * The idle loop on BFIN 70 * The idle loop on BFIN
100 */ 71 */
101#ifdef CONFIG_IDLE_L1 72#ifdef CONFIG_IDLE_L1
@@ -106,12 +77,10 @@ void cpu_idle(void)__attribute__((l1_text));
106void default_idle(void) 77void default_idle(void)
107{ 78{
108 while (!need_resched()) { 79 while (!need_resched()) {
109 leds_switch(LED_OFF);
110 local_irq_disable(); 80 local_irq_disable();
111 if (likely(!need_resched())) 81 if (likely(!need_resched()))
112 idle_with_irq_disabled(); 82 idle_with_irq_disabled();
113 local_irq_enable(); 83 local_irq_enable();
114 leds_switch(LED_ON);
115 } 84 }
116} 85}
117 86
@@ -327,6 +296,7 @@ void finish_atomic_sections (struct pt_regs *regs)
327} 296}
328 297
329#if defined(CONFIG_ACCESS_CHECK) 298#if defined(CONFIG_ACCESS_CHECK)
299/* Return 1 if access to memory range is OK, 0 otherwise */
330int _access_ok(unsigned long addr, unsigned long size) 300int _access_ok(unsigned long addr, unsigned long size)
331{ 301{
332 if (size == 0) 302 if (size == 0)
diff --git a/arch/blackfin/kernel/reboot.c b/arch/blackfin/kernel/reboot.c
index ae28aac6fec1..483f93dfc1b5 100644
--- a/arch/blackfin/kernel/reboot.c
+++ b/arch/blackfin/kernel/reboot.c
@@ -19,6 +19,11 @@
19#define SYSCR_VAL 0x10 19#define SYSCR_VAL 0x10
20#endif 20#endif
21 21
22/*
23 * Delay min 5 SCLK cycles using worst case CCLK/SCLK ratio (15)
24 */
25#define SWRST_DELAY (5 * 15)
26
22/* A system soft reset makes external memory unusable 27/* A system soft reset makes external memory unusable
23 * so force this function into L1. 28 * so force this function into L1.
24 */ 29 */
@@ -34,7 +39,13 @@ void bfin_reset(void)
34 while (1) { 39 while (1) {
35 /* initiate system soft reset with magic 0x7 */ 40 /* initiate system soft reset with magic 0x7 */
36 bfin_write_SWRST(0x7); 41 bfin_write_SWRST(0x7);
37 asm("ssync;"); 42
43 /* Wait for System reset to actually reset, needs to be 5 SCLKs, */
44 /* Assume CCLK / SCLK ratio is worst case (15), and use 5*15 */
45
46 asm("LSETUP(.Lfoo,.Lfoo) LC0 = %0\n .Lfoo: NOP;\n"
47 : : "a" (SWRST_DELAY) : "LC0", "LT0", "LB0");
48
38 /* clear system soft reset */ 49 /* clear system soft reset */
39 bfin_write_SWRST(0); 50 bfin_write_SWRST(0);
40 asm("ssync;"); 51 asm("ssync;");
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index d2822010b7ce..462cae893757 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -238,7 +238,13 @@ void __init setup_arch(char **cmdline_p)
238 memory_end = _ramend - DMA_UNCACHED_REGION; 238 memory_end = _ramend - DMA_UNCACHED_REGION;
239 239
240 _ramstart = (unsigned long)__bss_stop; 240 _ramstart = (unsigned long)__bss_stop;
241 _rambase = (unsigned long)_stext;
242#ifdef CONFIG_MPU
243 /* Round up to multiple of 4MB. */
244 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
245#else
241 memory_start = PAGE_ALIGN(_ramstart); 246 memory_start = PAGE_ALIGN(_ramstart);
247#endif
242 248
243#if defined(CONFIG_MTD_UCLINUX) 249#if defined(CONFIG_MTD_UCLINUX)
244 /* generic memory mapped MTD driver */ 250 /* generic memory mapped MTD driver */
@@ -307,6 +313,11 @@ void __init setup_arch(char **cmdline_p)
307 printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20); 313 printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20);
308#endif /* ANOMALY_05000263 */ 314#endif /* ANOMALY_05000263 */
309 315
316#ifdef CONFIG_MPU
317 page_mask_nelts = ((_ramend >> PAGE_SHIFT) + 31) / 32;
318 page_mask_order = get_order(3 * page_mask_nelts * sizeof(long));
319#endif
320
310#if !defined(CONFIG_MTD_UCLINUX) 321#if !defined(CONFIG_MTD_UCLINUX)
311 memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/ 322 memory_end -= SIZE_4K; /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
312#endif 323#endif
@@ -315,8 +326,6 @@ void __init setup_arch(char **cmdline_p)
315 init_mm.end_data = (unsigned long)_edata; 326 init_mm.end_data = (unsigned long)_edata;
316 init_mm.brk = (unsigned long)0; 327 init_mm.brk = (unsigned long)0;
317 328
318 init_leds();
319
320 _bfin_swrst = bfin_read_SWRST(); 329 _bfin_swrst = bfin_read_SWRST();
321 330
322 if (_bfin_swrst & RESET_DOUBLE) 331 if (_bfin_swrst & RESET_DOUBLE)
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index beef057bd1dc..5bd64e341df3 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -42,75 +42,6 @@
42static void time_sched_init(irqreturn_t(*timer_routine) 42static void time_sched_init(irqreturn_t(*timer_routine)
43 (int, void *)); 43 (int, void *));
44static unsigned long gettimeoffset(void); 44static unsigned long gettimeoffset(void);
45static inline void do_leds(void);
46
47#if (defined(CONFIG_BFIN_ALIVE_LED) || defined(CONFIG_BFIN_IDLE_LED))
48void __init init_leds(void)
49{
50 unsigned int tmp = 0;
51
52#if defined(CONFIG_BFIN_ALIVE_LED)
53 /* config pins as output. */
54 tmp = bfin_read_CONFIG_BFIN_ALIVE_LED_DPORT();
55 SSYNC();
56 bfin_write_CONFIG_BFIN_ALIVE_LED_DPORT(tmp | CONFIG_BFIN_ALIVE_LED_PIN);
57 SSYNC();
58
59 /* First set led be off */
60 tmp = bfin_read_CONFIG_BFIN_ALIVE_LED_PORT();
61 SSYNC();
62 bfin_write_CONFIG_BFIN_ALIVE_LED_PORT(tmp | CONFIG_BFIN_ALIVE_LED_PIN); /* light off */
63 SSYNC();
64#endif
65
66#if defined(CONFIG_BFIN_IDLE_LED)
67 /* config pins as output. */
68 tmp = bfin_read_CONFIG_BFIN_IDLE_LED_DPORT();
69 SSYNC();
70 bfin_write_CONFIG_BFIN_IDLE_LED_DPORT(tmp | CONFIG_BFIN_IDLE_LED_PIN);
71 SSYNC();
72
73 /* First set led be off */
74 tmp = bfin_read_CONFIG_BFIN_IDLE_LED_PORT();
75 SSYNC();
76 bfin_write_CONFIG_BFIN_IDLE_LED_PORT(tmp | CONFIG_BFIN_IDLE_LED_PIN); /* light off */
77 SSYNC();
78#endif
79}
80#else
81void __init init_leds(void)
82{
83}
84#endif
85
86#if defined(CONFIG_BFIN_ALIVE_LED)
87static inline void do_leds(void)
88{
89 static unsigned int count = 50;
90 static int flag;
91 unsigned short tmp = 0;
92
93 if (--count == 0) {
94 count = 50;
95 flag = ~flag;
96 }
97 tmp = bfin_read_CONFIG_BFIN_ALIVE_LED_PORT();
98 SSYNC();
99
100 if (flag)
101 tmp &= ~CONFIG_BFIN_ALIVE_LED_PIN; /* light on */
102 else
103 tmp |= CONFIG_BFIN_ALIVE_LED_PIN; /* light off */
104
105 bfin_write_CONFIG_BFIN_ALIVE_LED_PORT(tmp);
106 SSYNC();
107
108}
109#else
110static inline void do_leds(void)
111{
112}
113#endif
114 45
115static struct irqaction bfin_timer_irq = { 46static struct irqaction bfin_timer_irq = {
116 .name = "BFIN Timer Tick", 47 .name = "BFIN Timer Tick",
@@ -205,7 +136,6 @@ irqreturn_t timer_interrupt(int irq, void *dummy)
205 write_seqlock(&xtime_lock); 136 write_seqlock(&xtime_lock);
206 137
207 do_timer(1); 138 do_timer(1);
208 do_leds();
209 139
210#ifndef CONFIG_SMP 140#ifndef CONFIG_SMP
211 update_process_times(user_mode(get_irq_regs())); 141 update_process_times(user_mode(get_irq_regs()));
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 21a55ef19cbd..66b5f3e3ae2a 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -36,8 +36,10 @@
36#include <asm/cacheflush.h> 36#include <asm/cacheflush.h>
37#include <asm/blackfin.h> 37#include <asm/blackfin.h>
38#include <asm/irq_handler.h> 38#include <asm/irq_handler.h>
39#include <linux/irq.h>
39#include <asm/trace.h> 40#include <asm/trace.h>
40#include <asm/fixed_code.h> 41#include <asm/fixed_code.h>
42#include <asm/dma.h>
41 43
42#ifdef CONFIG_KGDB 44#ifdef CONFIG_KGDB
43# include <linux/debugger.h> 45# include <linux/debugger.h>
@@ -170,7 +172,7 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
170 oops_in_progress = 1; 172 oops_in_progress = 1;
171 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); 173 printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n");
172 dump_bfin_process(fp); 174 dump_bfin_process(fp);
173 dump_bfin_mem((void *)fp->retx); 175 dump_bfin_mem(fp);
174 show_regs(fp); 176 show_regs(fp);
175 panic("Double Fault - unrecoverable event\n"); 177 panic("Double Fault - unrecoverable event\n");
176 178
@@ -195,9 +197,13 @@ asmlinkage void trap_c(struct pt_regs *fp)
195 * we will kernel panic, so the system reboots. 197 * we will kernel panic, so the system reboots.
196 * If KGDB is enabled, don't set this for kernel breakpoints 198 * If KGDB is enabled, don't set this for kernel breakpoints
197 */ 199 */
198 if ((bfin_read_IPEND() & 0xFFC0) 200
201 /* TODO: check to see if we are in some sort of deferred HWERR
202 * that we should be able to recover from, not kernel panic
203 */
204 if ((bfin_read_IPEND() & 0xFFC0) && (trapnr != VEC_STEP)
199#ifdef CONFIG_KGDB 205#ifdef CONFIG_KGDB
200 && trapnr != VEC_EXCPT02 206 && (trapnr != VEC_EXCPT02)
201#endif 207#endif
202 ){ 208 ){
203 console_verbose(); 209 console_verbose();
@@ -433,6 +439,36 @@ asmlinkage void trap_c(struct pt_regs *fp)
433 /* 0x3D - Reserved, Caught by default */ 439 /* 0x3D - Reserved, Caught by default */
434 /* 0x3E - Reserved, Caught by default */ 440 /* 0x3E - Reserved, Caught by default */
435 /* 0x3F - Reserved, Caught by default */ 441 /* 0x3F - Reserved, Caught by default */
442 case VEC_HWERR:
443 info.si_code = BUS_ADRALN;
444 sig = SIGBUS;
445 switch (fp->seqstat & SEQSTAT_HWERRCAUSE) {
446 /* System MMR Error */
447 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR):
448 info.si_code = BUS_ADRALN;
449 sig = SIGBUS;
450 printk(KERN_NOTICE HWC_x2(KERN_NOTICE));
451 break;
452 /* External Memory Addressing Error */
453 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR):
454 info.si_code = BUS_ADRERR;
455 sig = SIGBUS;
456 printk(KERN_NOTICE HWC_x3(KERN_NOTICE));
457 break;
458 /* Performance Monitor Overflow */
459 case (SEQSTAT_HWERRCAUSE_PERF_FLOW):
460 printk(KERN_NOTICE HWC_x12(KERN_NOTICE));
461 break;
462 /* RAISE 5 instruction */
463 case (SEQSTAT_HWERRCAUSE_RAISE_5):
464 printk(KERN_NOTICE HWC_x18(KERN_NOTICE));
465 break;
466 default: /* Reserved */
467 printk(KERN_NOTICE HWC_default(KERN_NOTICE));
468 break;
469 }
470 CHK_DEBUGGER_TRAP();
471 break;
436 default: 472 default:
437 info.si_code = TRAP_ILLTRAP; 473 info.si_code = TRAP_ILLTRAP;
438 sig = SIGTRAP; 474 sig = SIGTRAP;
@@ -447,7 +483,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
447 if (sig != SIGTRAP) { 483 if (sig != SIGTRAP) {
448 unsigned long stack; 484 unsigned long stack;
449 dump_bfin_process(fp); 485 dump_bfin_process(fp);
450 dump_bfin_mem((void *)fp->retx); 486 dump_bfin_mem(fp);
451 show_regs(fp); 487 show_regs(fp);
452 488
453 /* Print out the trace buffer if it makes sense */ 489 /* Print out the trace buffer if it makes sense */
@@ -461,6 +497,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
461 dump_bfin_trace_buffer(); 497 dump_bfin_trace_buffer();
462 show_stack(current, &stack); 498 show_stack(current, &stack);
463 if (oops_in_progress) { 499 if (oops_in_progress) {
500 print_modules();
464#ifndef CONFIG_ACCESS_CHECK 501#ifndef CONFIG_ACCESS_CHECK
465 printk(KERN_EMERG "Please turn on " 502 printk(KERN_EMERG "Please turn on "
466 "CONFIG_ACCESS_CHECK\n"); 503 "CONFIG_ACCESS_CHECK\n");
@@ -474,13 +511,6 @@ asmlinkage void trap_c(struct pt_regs *fp)
474 info.si_addr = (void *)fp->pc; 511 info.si_addr = (void *)fp->pc;
475 force_sig_info(sig, &info, current); 512 force_sig_info(sig, &info, current);
476 513
477 /* Ensure that bad return addresses don't end up in an infinite
478 * loop, due to speculative loads/reads. This needs to be done after
479 * the signal has been sent.
480 */
481 if (trapnr == VEC_CPLB_I_M && sig != SIGTRAP)
482 fp->pc = SAFE_USER_INSTRUCTION;
483
484 trace_buffer_restore(j); 514 trace_buffer_restore(j);
485 return; 515 return;
486} 516}
@@ -616,8 +646,10 @@ void dump_bfin_process(struct pt_regs *fp)
616 if (oops_in_progress) 646 if (oops_in_progress)
617 printk(KERN_EMERG "Kernel OOPS in progress\n"); 647 printk(KERN_EMERG "Kernel OOPS in progress\n");
618 648
619 if (context & 0x0020) 649 if (context & 0x0020 && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR)
620 printk(KERN_NOTICE "Deferred excecption or HW Error context\n"); 650 printk(KERN_NOTICE "HW Error context\n");
651 else if (context & 0x0020)
652 printk(KERN_NOTICE "Defered Exception context\n");
621 else if (context & 0x3FC0) 653 else if (context & 0x3FC0)
622 printk(KERN_NOTICE "Interrupt context\n"); 654 printk(KERN_NOTICE "Interrupt context\n");
623 else if (context & 0x4000) 655 else if (context & 0x4000)
@@ -645,59 +677,124 @@ void dump_bfin_process(struct pt_regs *fp)
645 "No Valid process in current context\n"); 677 "No Valid process in current context\n");
646} 678}
647 679
648void dump_bfin_mem(void *retaddr) 680void dump_bfin_mem(struct pt_regs *fp)
649{ 681{
682 unsigned short *addr, *erraddr, val = 0, err = 0;
683 char sti = 0, buf[6];
650 684
651 if (retaddr >= (void *)FIXED_CODE_START && retaddr < (void *)physical_mem_end 685 if (unlikely((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR))
652#if L1_CODE_LENGTH != 0 686 erraddr = (void *)fp->pc;
653 /* FIXME: Copy the code out of L1 Instruction SRAM through dma 687 else
654 memcpy. */ 688 erraddr = (void *)fp->retx;
655 && !(retaddr >= (void *)L1_CODE_START 689
656 && retaddr < (void *)(L1_CODE_START + L1_CODE_LENGTH)) 690 printk(KERN_NOTICE "return address: [0x%p]; contents of:", erraddr);
657#endif 691
658 ) { 692 for (addr = (unsigned short *)((unsigned long)erraddr & ~0xF) - 0x10;
659 int i = ((unsigned int)retaddr & 0xFFFFFFF0) - 32; 693 addr < (unsigned short *)((unsigned long)erraddr & ~0xF) + 0x10;
660 unsigned short x = 0; 694 addr++) {
661 printk(KERN_NOTICE "return address: [0x%p]; contents of:", retaddr); 695 if (!((unsigned long)addr & 0xF))
662 for (; i < ((unsigned int)retaddr & 0xFFFFFFF0) + 32; i += 2) { 696 printk("\n" KERN_NOTICE "0x%p: ", addr);
663 if (!(i & 0xF)) 697
664 printk("\n" KERN_NOTICE "0x%08x: ", i); 698 if (get_user(val, addr)) {
665 699 if (addr >= (unsigned short *)L1_CODE_START &&
666 if (get_user(x, (unsigned short *)i)) 700 addr < (unsigned short *)(L1_CODE_START + L1_CODE_LENGTH)) {
667 break; 701 dma_memcpy(&val, addr, sizeof(val));
702 sprintf(buf, "%04x", val);
703 } else if (addr >= (unsigned short *)FIXED_CODE_START &&
704 addr <= (unsigned short *)memory_start) {
705 val = bfin_read16(addr);
706 sprintf(buf, "%04x", val);
707 } else {
708 val = 0;
709 sprintf(buf, "????");
710 }
711 } else
712 sprintf(buf, "%04x", val);
713
714 if (addr == erraddr) {
715 printk("[%s]", buf);
716 err = val;
717 } else
718 printk(" %s ", buf);
719
720 /* Do any previous instructions turn on interrupts? */
721 if (addr <= erraddr && /* in the past */
722 ((val >= 0x0040 && val <= 0x0047) || /* STI instruction */
723 val == 0x017b)) /* [SP++] = RETI */
724 sti = 1;
725 }
726
727 printk("\n");
728
729 /* Hardware error interrupts can be deferred */
730 if (unlikely(sti && (fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR &&
731 oops_in_progress)){
732 printk(KERN_NOTICE "Looks like this was a deferred error - sorry\n");
668#ifndef CONFIG_DEBUG_HWERR 733#ifndef CONFIG_DEBUG_HWERR
669 /* If one of the last few instructions was a STI 734 printk(KERN_NOTICE "The remaining message may be meaningless\n"
670 * it is likely that the error occured awhile ago 735 KERN_NOTICE "You should enable CONFIG_DEBUG_HWERR to get a"
671 * and we just noticed. This only happens in kernel 736 " better idea where it came from\n");
672 * context, which should mean an oops is happening 737#else
673 */ 738 /* If we are handling only one peripheral interrupt
674 if (oops_in_progress && x >= 0x0040 && x <= 0x0047 && i <= 0) 739 * and current mm and pid are valid, and the last error
675 panic("\n\nWARNING : You should reconfigure" 740 * was in that user space process's text area
676 " the kernel to turn on\n" 741 * print it out - because that is where the problem exists
677 " 'Hardware error interrupt" 742 */
678 " debugging'\n" 743 if ((!(((fp)->ipend & ~0x30) & (((fp)->ipend & ~0x30) - 1))) &&
679 " The rest of this error" 744 (current->pid && current->mm)) {
680 " is meanless\n"); 745 /* And the last RETI points to the current userspace context */
681#endif 746 if ((fp + 1)->pc >= current->mm->start_code &&
682 if (i == (unsigned int)retaddr) 747 (fp + 1)->pc <= current->mm->end_code) {
683 printk("[%04x]", x); 748 printk(KERN_NOTICE "It might be better to look around here : \n");
684 else 749 printk(KERN_NOTICE "-------------------------------------------\n");
685 printk(" %04x ", x); 750 show_regs(fp + 1);
751 printk(KERN_NOTICE "-------------------------------------------\n");
752 }
686 } 753 }
687 printk("\n"); 754#endif
688 } else 755 }
689 printk("\n" KERN_NOTICE
690 "Cannot look at the [PC] <%p> for it is"
691 " in unreadable memory - sorry\n", retaddr);
692} 756}
693 757
694void show_regs(struct pt_regs *fp) 758void show_regs(struct pt_regs *fp)
695{ 759{
696 char buf [150]; 760 char buf [150];
761 struct irqaction *action;
762 unsigned int i;
763 unsigned long flags;
697 764
698 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\n"); 765 printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted());
699 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", 766 printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n",
700 (long)fp->seqstat, fp->ipend, fp->syscfg); 767 (long)fp->seqstat, fp->ipend, fp->syscfg);
768 printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n",
769 (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14);
770 printk(KERN_NOTICE " EXCAUSE : 0x%lx\n",
771 fp->seqstat & SEQSTAT_EXCAUSE);
772 for (i = 6; i <= 15 ; i++) {
773 if (fp->ipend & (1 << i)) {
774 decode_address(buf, bfin_read32(EVT0 + 4*i));
775 printk(KERN_NOTICE " physical IVG%i asserted : %s\n", i, buf);
776 }
777 }
778
779 /* if no interrupts are going off, don't print this out */
780 if (fp->ipend & ~0x3F) {
781 for (i = 0; i < (NR_IRQS - 1); i++) {
782 spin_lock_irqsave(&irq_desc[i].lock, flags);
783 action = irq_desc[i].action;
784 if (!action)
785 goto unlock;
786
787 decode_address(buf, (unsigned int)action->handler);
788 printk(KERN_NOTICE " logical irq %3d mapped : %s", i, buf);
789 for (action = action->next; action; action = action->next) {
790 decode_address(buf, (unsigned int)action->handler);
791 printk(", %s", buf);
792 }
793 printk("\n");
794unlock:
795 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
796 }
797 }
701 798
702 decode_address(buf, fp->rete); 799 decode_address(buf, fp->rete);
703 printk(KERN_NOTICE " RETE: %s\n", buf); 800 printk(KERN_NOTICE " RETE: %s\n", buf);
@@ -708,9 +805,10 @@ void show_regs(struct pt_regs *fp)
708 decode_address(buf, fp->rets); 805 decode_address(buf, fp->rets);
709 printk(KERN_NOTICE " RETS: %s\n", buf); 806 printk(KERN_NOTICE " RETS: %s\n", buf);
710 decode_address(buf, fp->pc); 807 decode_address(buf, fp->pc);
711 printk(KERN_NOTICE " PC: %s\n", buf); 808 printk(KERN_NOTICE " PC : %s\n", buf);
712 809
713 if ((long)fp->seqstat & SEQSTAT_EXCAUSE) { 810 if (((long)fp->seqstat & SEQSTAT_EXCAUSE) &&
811 (((long)fp->seqstat & SEQSTAT_EXCAUSE) != VEC_HWERR)) {
714 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR()); 812 decode_address(buf, bfin_read_DCPLB_FAULT_ADDR());
715 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf); 813 printk(KERN_NOTICE "DCPLB_FAULT_ADDR: %s\n", buf);
716 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR()); 814 decode_address(buf, bfin_read_ICPLB_FAULT_ADDR());
@@ -824,7 +922,7 @@ void panic_cplb_error(int cplb_panic, struct pt_regs *fp)
824 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR()); 922 printk(KERN_EMERG "DCPLB_FAULT_ADDR=%p\n", (void *)bfin_read_DCPLB_FAULT_ADDR());
825 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR()); 923 printk(KERN_EMERG "ICPLB_FAULT_ADDR=%p\n", (void *)bfin_read_ICPLB_FAULT_ADDR());
826 dump_bfin_process(fp); 924 dump_bfin_process(fp);
827 dump_bfin_mem((void *)fp->retx); 925 dump_bfin_mem(fp);
828 show_regs(fp); 926 show_regs(fp);
829 dump_stack(); 927 dump_stack();
830 panic("Unrecoverable event\n"); 928 panic("Unrecoverable event\n");
diff --git a/arch/blackfin/lib/memcpy.S b/arch/blackfin/lib/memcpy.S
index 2e6336492b4b..e654a18a0754 100644
--- a/arch/blackfin/lib/memcpy.S
+++ b/arch/blackfin/lib/memcpy.S
@@ -70,8 +70,8 @@ ENTRY(_memcpy)
70 /* Check for aligned data.*/ 70 /* Check for aligned data.*/
71 71
72 R3 = R1 | R0; 72 R3 = R1 | R0;
73 R0 = 0x3; 73 R1 = 0x3;
74 R3 = R3 & R0; 74 R3 = R3 & R1;
75 CC = R3; /* low bits set on either address? */ 75 CC = R3; /* low bits set on either address? */
76 IF CC JUMP .Lnot_aligned; 76 IF CC JUMP .Lnot_aligned;
77 77
@@ -83,7 +83,6 @@ ENTRY(_memcpy)
83 /* less than eight bytes... */ 83 /* less than eight bytes... */
84 P2 = R2; 84 P2 = R2;
85 LSETUP(.Lthree_start, .Lthree_end) LC0=P2; 85 LSETUP(.Lthree_start, .Lthree_end) LC0=P2;
86 R0 = R1; /* setup src address for return */
87.Lthree_start: 86.Lthree_start:
88 R3 = B[P1++] (X); 87 R3 = B[P1++] (X);
89.Lthree_end: 88.Lthree_end:
@@ -95,7 +94,6 @@ ENTRY(_memcpy)
95 /* There's at least eight bytes to copy. */ 94 /* There's at least eight bytes to copy. */
96 P2 += -1; /* because we unroll one iteration */ 95 P2 += -1; /* because we unroll one iteration */
97 LSETUP(.Lword_loops, .Lword_loope) LC0=P2; 96 LSETUP(.Lword_loops, .Lword_loope) LC0=P2;
98 R0 = R1;
99 I1 = P1; 97 I1 = P1;
100 R3 = [I1++]; 98 R3 = [I1++];
101#if ANOMALY_05000202 99#if ANOMALY_05000202
@@ -120,7 +118,6 @@ ENTRY(_memcpy)
120.Lnot_aligned: 118.Lnot_aligned:
121 /* From here, we're copying byte-by-byte. */ 119 /* From here, we're copying byte-by-byte. */
122 LSETUP (.Lbyte_start, .Lbyte_end) LC0=P2; 120 LSETUP (.Lbyte_start, .Lbyte_end) LC0=P2;
123 R0 = R1; /* Save src address for return */
124.Lbyte_start: 121.Lbyte_start:
125 R1 = B[P1++] (X); 122 R1 = B[P1++] (X);
126.Lbyte_end: 123.Lbyte_end:
@@ -135,7 +132,6 @@ ENTRY(_memcpy)
135 * Don't bother to work out alignment for 132 * Don't bother to work out alignment for
136 * the reverse case. 133 * the reverse case.
137 */ 134 */
138 R0 = R1; /* save src for later. */
139 P0 = P0 + P2; 135 P0 = P0 + P2;
140 P0 += -1; 136 P0 += -1;
141 P1 = P1 + P2; 137 P1 = P1 + P2;
diff --git a/arch/blackfin/mach-bf527/Kconfig b/arch/blackfin/mach-bf527/Kconfig
index 5c736837d4bf..3cde4beeb214 100644
--- a/arch/blackfin/mach-bf527/Kconfig
+++ b/arch/blackfin/mach-bf527/Kconfig
@@ -43,7 +43,7 @@ endchoice
43 43
44choice 44choice
45 prompt "UART1" 45 prompt "UART1"
46 default BF527_UART1_PORTG 46 default BF527_UART1_PORTF
47 help 47 help
48 Select PORT used for UART1. See Hardware Reference Manual 48 Select PORT used for UART1. See Hardware Reference Manual
49 49
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 003e2ac654d8..f8c411a24af7 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA) 10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2007 Analog Devices Inc. 11 * Copyright 2004-2008 Analog Devices Inc.
12 * 12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * 14 *
@@ -41,6 +41,7 @@
41#include <linux/irq.h> 41#include <linux/irq.h>
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/usb/sl811.h> 43#include <linux/usb/sl811.h>
44#include <linux/usb/musb.h>
44#include <asm/cplb.h> 45#include <asm/cplb.h>
45#include <asm/dma.h> 46#include <asm/dma.h>
46#include <asm/bfin5xx_spi.h> 47#include <asm/bfin5xx_spi.h>
@@ -105,6 +106,69 @@ void __exit bfin_isp1761_exit(void)
105arch_initcall(bfin_isp1761_init); 106arch_initcall(bfin_isp1761_init);
106#endif 107#endif
107 108
109#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
110static struct resource musb_resources[] = {
111 [0] = {
112 .start = 0xffc03800,
113 .end = 0xffc03cff,
114 .flags = IORESOURCE_MEM,
115 },
116 [1] = { /* general IRQ */
117 .start = IRQ_USB_INT0,
118 .end = IRQ_USB_INT0,
119 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
120 },
121 [2] = { /* DMA IRQ */
122 .start = IRQ_USB_DMA,
123 .end = IRQ_USB_DMA,
124 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
125 },
126};
127
128static struct musb_hdrc_platform_data musb_plat = {
129#if defined(CONFIG_USB_MUSB_OTG)
130 .mode = MUSB_OTG,
131#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
132 .mode = MUSB_HOST,
133#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
134 .mode = MUSB_PERIPHERAL,
135#endif
136 .multipoint = 0,
137};
138
139static u64 musb_dmamask = ~(u32)0;
140
141static struct platform_device musb_device = {
142 .name = "musb_hdrc",
143 .id = 0,
144 .dev = {
145 .dma_mask = &musb_dmamask,
146 .coherent_dma_mask = 0xffffffff,
147 .platform_data = &musb_plat,
148 },
149 .num_resources = ARRAY_SIZE(musb_resources),
150 .resource = musb_resources,
151};
152#endif
153
154#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
155
156static struct resource bf52x_t350mcqb_resources[] = {
157 {
158 .start = IRQ_PPI_ERROR,
159 .end = IRQ_PPI_ERROR,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164static struct platform_device bf52x_t350mcqb_device = {
165 .name = "bfin-t350mcqb",
166 .id = -1,
167 .num_resources = ARRAY_SIZE(bf52x_t350mcqb_resources),
168 .resource = bf52x_t350mcqb_resources,
169};
170#endif
171
108#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) 172#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
109static struct mtd_partition partition_info[] = { 173static struct mtd_partition partition_info[] = {
110 { 174 {
@@ -253,12 +317,7 @@ static struct resource sl811_hcd_resources[] = {
253void sl811_port_power(struct device *dev, int is_on) 317void sl811_port_power(struct device *dev, int is_on)
254{ 318{
255 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); 319 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
256 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS); 320 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
257
258 if (is_on)
259 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
260 else
261 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
262} 321}
263#endif 322#endif
264 323
@@ -718,6 +777,28 @@ static struct platform_device bfin_pata_device = {
718}; 777};
719#endif 778#endif
720 779
780#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
781#include <linux/input.h>
782#include <linux/gpio_keys.h>
783
784static struct gpio_keys_button bfin_gpio_keys_table[] = {
785 {BTN_0, GPIO_PG0, 1, "gpio-keys: BTN0"},
786 {BTN_1, GPIO_PG13, 1, "gpio-keys: BTN1"},
787};
788
789static struct gpio_keys_platform_data bfin_gpio_keys_data = {
790 .buttons = bfin_gpio_keys_table,
791 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
792};
793
794static struct platform_device bfin_device_gpiokeys = {
795 .name = "gpio-keys",
796 .dev = {
797 .platform_data = &bfin_gpio_keys_data,
798 },
799};
800#endif
801
721static struct platform_device *stamp_devices[] __initdata = { 802static struct platform_device *stamp_devices[] __initdata = {
722#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE) 803#if defined(CONFIG_MTD_NAND_BF5XX) || defined(CONFIG_MTD_NAND_BF5XX_MODULE)
723 &bf5xx_nand_device, 804 &bf5xx_nand_device,
@@ -739,6 +820,10 @@ static struct platform_device *stamp_devices[] __initdata = {
739 &isp1362_hcd_device, 820 &isp1362_hcd_device,
740#endif 821#endif
741 822
823#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
824 &musb_device,
825#endif
826
742#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 827#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
743 &smc91x_device, 828 &smc91x_device,
744#endif 829#endif
@@ -763,6 +848,10 @@ static struct platform_device *stamp_devices[] __initdata = {
763 &bfin_fb_device, 848 &bfin_fb_device,
764#endif 849#endif
765 850
851#if defined(CONFIG_FB_BFIN_T350MCQB) || defined(CONFIG_FB_BFIN_T350MCQB_MODULE)
852 &bf52x_t350mcqb_device,
853#endif
854
766#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE) 855#if defined(CONFIG_FB_BFIN_7393) || defined(CONFIG_FB_BFIN_7393_MODULE)
767 &bfin_fb_adv7393_device, 856 &bfin_fb_adv7393_device,
768#endif 857#endif
@@ -783,6 +872,10 @@ static struct platform_device *stamp_devices[] __initdata = {
783#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 872#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
784 &bfin_pata_device, 873 &bfin_pata_device,
785#endif 874#endif
875
876#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
877 &bfin_device_gpiokeys,
878#endif
786}; 879};
787 880
788static int __init stamp_init(void) 881static int __init stamp_init(void)
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index 6bcf4047f89c..a72c7a620fa1 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -40,6 +40,7 @@
40#endif 40#endif
41#include <linux/pata_platform.h> 41#include <linux/pata_platform.h>
42#include <linux/irq.h> 42#include <linux/irq.h>
43
43#include <asm/dma.h> 44#include <asm/dma.h>
44#include <asm/bfin5xx_spi.h> 45#include <asm/bfin5xx_spi.h>
45#include <asm/reboot.h> 46#include <asm/reboot.h>
@@ -303,7 +304,77 @@ static struct platform_device bfin_uart_device = {
303}; 304};
304#endif 305#endif
305 306
306static struct platform_device *stamp_devices[] __initdata = { 307#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
308
309#include <linux/serial_8250.h>
310#include <linux/serial.h>
311
312/*
313 * Configuration for two 16550 UARTS in FPGA at addresses 0x20200000 and 0x202000010.
314 * running at half system clock, both with interrupt output or-ed to PF8. Change to
315 * suit different FPGA configuration, or to suit real 16550 UARTS connected to the bus
316 */
317
318static struct plat_serial8250_port serial8250_platform_data [] = {
319 {
320 .membase = 0x20200000,
321 .mapbase = 0x20200000,
322 .irq = IRQ_PF8,
323 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
324 .iotype = UPIO_MEM,
325 .regshift = 1,
326 .uartclk = 66666667,
327 }, {
328 .membase = 0x20200010,
329 .mapbase = 0x20200010,
330 .irq = IRQ_PF8,
331 .flags = UPF_BOOT_AUTOCONF | UART_CONFIG_TYPE,
332 .iotype = UPIO_MEM,
333 .regshift = 1,
334 .uartclk = 66666667,
335 }, {
336 }
337};
338
339static struct platform_device serial8250_device = {
340 .id = PLAT8250_DEV_PLATFORM,
341 .name = "serial8250",
342 .dev = {
343 .platform_data = serial8250_platform_data,
344 },
345};
346
347#endif
348
349#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
350
351/*
352 * Configuration for one OpenCores keyboard controller in FPGA at address 0x20200030,
353 * interrupt output wired to PF9. Change to suit different FPGA configuration
354 */
355
356static struct resource opencores_kbd_resources[] = {
357 [0] = {
358 .start = 0x20200030,
359 .end = 0x20300030 + 2,
360 .flags = IORESOURCE_MEM,
361 },
362 [1] = {
363 .start = IRQ_PF9,
364 .end = IRQ_PF9,
365 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
366 },
367};
368
369static struct platform_device opencores_kbd_device = {
370 .id = -1,
371 .name = "opencores-kbd",
372 .resource = opencores_kbd_resources,
373 .num_resources = ARRAY_SIZE(opencores_kbd_resources),
374};
375#endif
376
377static struct platform_device *h8606_devices[] __initdata = {
307#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 378#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
308 &rtc_device, 379 &rtc_device,
309#endif 380#endif
@@ -327,13 +398,21 @@ static struct platform_device *stamp_devices[] __initdata = {
327#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 398#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
328 &bfin_uart_device, 399 &bfin_uart_device,
329#endif 400#endif
401
402#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
403 &serial8250_device,
404#endif
405
406#if defined(CONFIG_KEYBOARD_OPENCORES) || defined(CONFIG_KEYBOARD_OPENCORES_MODULE)
407 &opencores_kbd_device,
408#endif
330}; 409};
331 410
332static int __init H8606_init(void) 411static int __init H8606_init(void)
333{ 412{
334 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n"); 413 printk(KERN_INFO "HV Sistemas H8606 board support by http://www.hvsistemas.com\n");
335 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__); 414 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
336 platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices)); 415 platform_add_devices(h8606_devices, ARRAY_SIZE(h8606_devices));
337#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 416#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
338 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info)); 417 spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
339#endif 418#endif
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index be852034a68b..c37dd45c8803 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -256,6 +256,50 @@ static struct platform_device bfin_pata_device = {
256}; 256};
257#endif 257#endif
258 258
259#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
260#include <linux/input.h>
261#include <linux/gpio_keys.h>
262
263static struct gpio_keys_button bfin_gpio_keys_table[] = {
264 {BTN_0, GPIO_PF7, 1, "gpio-keys: BTN0"},
265 {BTN_1, GPIO_PF8, 1, "gpio-keys: BTN1"},
266 {BTN_2, GPIO_PF9, 1, "gpio-keys: BTN2"},
267 {BTN_3, GPIO_PF10, 1, "gpio-keys: BTN3"},
268};
269
270static struct gpio_keys_platform_data bfin_gpio_keys_data = {
271 .buttons = bfin_gpio_keys_table,
272 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
273};
274
275static struct platform_device bfin_device_gpiokeys = {
276 .name = "gpio-keys",
277 .dev = {
278 .platform_data = &bfin_gpio_keys_data,
279 },
280};
281#endif
282
283#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
284#include <linux/i2c-gpio.h>
285
286static struct i2c_gpio_platform_data i2c_gpio_data = {
287 .sda_pin = 1,
288 .scl_pin = 0,
289 .sda_is_open_drain = 0,
290 .scl_is_open_drain = 0,
291 .udelay = 40,
292};
293
294static struct platform_device i2c_gpio_device = {
295 .name = "i2c-gpio",
296 .id = 0,
297 .dev = {
298 .platform_data = &i2c_gpio_data,
299 },
300};
301#endif
302
259static struct platform_device *ezkit_devices[] __initdata = { 303static struct platform_device *ezkit_devices[] __initdata = {
260#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 304#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
261 &smc91x_device, 305 &smc91x_device,
@@ -280,6 +324,14 @@ static struct platform_device *ezkit_devices[] __initdata = {
280#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 324#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
281 &bfin_pata_device, 325 &bfin_pata_device,
282#endif 326#endif
327
328#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
329 &bfin_device_gpiokeys,
330#endif
331
332#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
333 &i2c_gpio_device,
334#endif
283}; 335};
284 336
285static int __init ezkit_init(void) 337static int __init ezkit_init(void)
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index 8fde8d832850..ac52b040b336 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -32,6 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/mtd/physmap.h>
35#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 37#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
@@ -108,6 +109,50 @@ static struct platform_device net2272_bfin_device = {
108}; 109};
109#endif 110#endif
110 111
112static struct mtd_partition stamp_partitions[] = {
113 {
114 .name = "Bootloader",
115 .size = 0x20000,
116 .offset = 0,
117 }, {
118 .name = "Kernel",
119 .size = 0xE0000,
120 .offset = MTDPART_OFS_APPEND,
121 }, {
122 .name = "RootFS",
123 .size = MTDPART_SIZ_FULL,
124 .offset = MTDPART_OFS_APPEND,
125 }
126};
127
128static struct physmap_flash_data stamp_flash_data = {
129 .width = 2,
130 .parts = stamp_partitions,
131 .nr_parts = ARRAY_SIZE(stamp_partitions),
132};
133
134static struct resource stamp_flash_resource[] = {
135 {
136 .name = "cfi_probe",
137 .start = 0x20000000,
138 .end = 0x203fffff,
139 .flags = IORESOURCE_MEM,
140 }, {
141 .start = CONFIG_ENET_FLASH_PIN,
142 .flags = IORESOURCE_IRQ,
143 }
144};
145
146static struct platform_device stamp_flash_device = {
147 .name = "BF5xx-Flash",
148 .id = 0,
149 .dev = {
150 .platform_data = &stamp_flash_data,
151 },
152 .num_resources = ARRAY_SIZE(stamp_flash_resource),
153 .resource = stamp_flash_resource,
154};
155
111#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 156#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
112/* all SPI peripherals info goes here */ 157/* all SPI peripherals info goes here */
113 158
@@ -373,6 +418,49 @@ static struct platform_device bfin_pata_device = {
373}; 418};
374#endif 419#endif
375 420
421#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
422#include <linux/input.h>
423#include <linux/gpio_keys.h>
424
425static struct gpio_keys_button bfin_gpio_keys_table[] = {
426 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
427 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
428 {BTN_2, GPIO_PF8, 1, "gpio-keys: BTN2"},
429};
430
431static struct gpio_keys_platform_data bfin_gpio_keys_data = {
432 .buttons = bfin_gpio_keys_table,
433 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
434};
435
436static struct platform_device bfin_device_gpiokeys = {
437 .name = "gpio-keys",
438 .dev = {
439 .platform_data = &bfin_gpio_keys_data,
440 },
441};
442#endif
443
444#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
445#include <linux/i2c-gpio.h>
446
447static struct i2c_gpio_platform_data i2c_gpio_data = {
448 .sda_pin = 2,
449 .scl_pin = 3,
450 .sda_is_open_drain = 0,
451 .scl_is_open_drain = 0,
452 .udelay = 40,
453};
454
455static struct platform_device i2c_gpio_device = {
456 .name = "i2c-gpio",
457 .id = 0,
458 .dev = {
459 .platform_data = &i2c_gpio_data,
460 },
461};
462#endif
463
376static struct platform_device *stamp_devices[] __initdata = { 464static struct platform_device *stamp_devices[] __initdata = {
377#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 465#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
378 &rtc_device, 466 &rtc_device,
@@ -406,6 +494,15 @@ static struct platform_device *stamp_devices[] __initdata = {
406#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 494#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
407 &bfin_pata_device, 495 &bfin_pata_device,
408#endif 496#endif
497
498#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
499 &bfin_device_gpiokeys,
500#endif
501
502#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
503 &i2c_gpio_device,
504#endif
505 &stamp_flash_device,
409}; 506};
410 507
411static int __init stamp_init(void) 508static int __init stamp_init(void)
@@ -418,12 +515,10 @@ static int __init stamp_init(void)
418 return ret; 515 return ret;
419 516
420#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 517#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
421# if defined(CONFIG_BFIN_SHARED_FLASH_ENET)
422 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */ 518 /* setup BF533_STAMP CPLD to route AMS3 to Ethernet MAC */
423 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN)); 519 bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (1 << CONFIG_ENET_FLASH_PIN));
424 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN); 520 bfin_write_FIO_FLAG_S(1 << CONFIG_ENET_FLASH_PIN);
425 SSYNC(); 521 SSYNC();
426# endif
427#endif 522#endif
428 523
429#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 524#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
@@ -440,10 +535,8 @@ arch_initcall(stamp_init);
440 535
441void native_machine_restart(char *cmd) 536void native_machine_restart(char *cmd)
442{ 537{
443#if defined(CONFIG_BFIN_SHARED_FLASH_ENET) 538#define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
444# define BIT_TO_SET (1 << CONFIG_ENET_FLASH_PIN)
445 bfin_write_FIO_INEN(~BIT_TO_SET); 539 bfin_write_FIO_INEN(~BIT_TO_SET);
446 bfin_write_FIO_DIR(BIT_TO_SET); 540 bfin_write_FIO_DIR(BIT_TO_SET);
447 bfin_write_FIO_FLAG_C(BIT_TO_SET); 541 bfin_write_FIO_FLAG_C(BIT_TO_SET);
448#endif
449} 542}
diff --git a/arch/blackfin/mach-bf537/boards/Kconfig b/arch/blackfin/mach-bf537/boards/Kconfig
index 96a15196e416..7e789dbef036 100644
--- a/arch/blackfin/mach-bf537/boards/Kconfig
+++ b/arch/blackfin/mach-bf537/boards/Kconfig
@@ -21,6 +21,12 @@ config PNAV10
21 help 21 help
22 PNAV board support. 22 PNAV board support.
23 23
24config CAMSIG_MINOTAUR
25 bool "Cambridge Signal Processing LTD Minotaur"
26 depends on (BF537)
27 help
28 Board supply package for CSP Minotaur
29
24config GENERIC_BF537_BOARD 30config GENERIC_BF537_BOARD
25 bool "Generic" 31 bool "Generic"
26 help 32 help
diff --git a/arch/blackfin/mach-bf537/boards/Makefile b/arch/blackfin/mach-bf537/boards/Makefile
index 94a85174283a..87e450f29e37 100644
--- a/arch/blackfin/mach-bf537/boards/Makefile
+++ b/arch/blackfin/mach-bf537/boards/Makefile
@@ -6,3 +6,4 @@ obj-$(CONFIG_GENERIC_BF537_BOARD) += generic_board.o
6obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o 6obj-$(CONFIG_BFIN537_STAMP) += stamp.o led.o
7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o 7obj-$(CONFIG_BFIN537_BLUETECHNIX_CM) += cm_bf537.o
8obj-$(CONFIG_PNAV10) += pnav10.o 8obj-$(CONFIG_PNAV10) += pnav10.o
9obj-$(CONFIG_CAMSIG_MINOTAUR) += minotaur.o
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index c0fb06dbc42e..8703b67d5ec6 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -29,6 +29,7 @@
29 */ 29 */
30 30
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/etherdevice.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 34#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 35#include <linux/mtd/partitions.h>
@@ -216,6 +217,12 @@ static struct platform_device rtc_device = {
216}; 217};
217#endif 218#endif
218 219
220#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
221static struct platform_device hitachi_fb_device = {
222 .name = "hitachi-tx09",
223};
224#endif
225
219#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 226#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
220static struct resource smc91x_resources[] = { 227static struct resource smc91x_resources[] = {
221 { 228 {
@@ -374,6 +381,10 @@ static struct platform_device bfin_pata_device = {
374#endif 381#endif
375 382
376static struct platform_device *cm_bf537_devices[] __initdata = { 383static struct platform_device *cm_bf537_devices[] __initdata = {
384#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
385 &hitachi_fb_device,
386#endif
387
377#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 388#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
378 &rtc_device, 389 &rtc_device,
379#endif 390#endif
diff --git a/arch/blackfin/mach-bf537/boards/generic_board.c b/arch/blackfin/mach-bf537/boards/generic_board.c
index 09f4bfbd2350..3e52f3f5bd58 100644
--- a/arch/blackfin/mach-bf537/boards/generic_board.c
+++ b/arch/blackfin/mach-bf537/boards/generic_board.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA) 10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2007 Analog Devices Inc. 11 * Copyright 2004-2008 Analog Devices Inc.
12 * 12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * 14 *
@@ -29,6 +29,7 @@
29 */ 29 */
30 30
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/etherdevice.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 34#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 35#include <linux/mtd/partitions.h>
@@ -204,12 +205,8 @@ static struct resource sl811_hcd_resources[] = {
204void sl811_port_power(struct device *dev, int is_on) 205void sl811_port_power(struct device *dev, int is_on)
205{ 206{
206 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); 207 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
207 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS); 208 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
208 209
209 if (is_on)
210 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
211 else
212 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
213} 210}
214#endif 211#endif
215 212
@@ -733,9 +730,11 @@ void native_machine_restart(char *cmd)
733 bfin_gpio_reset_spi0_ssel1(); 730 bfin_gpio_reset_spi0_ssel1();
734} 731}
735 732
733#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
736void bfin_get_ether_addr(char *addr) 734void bfin_get_ether_addr(char *addr)
737{ 735{
738 random_ether_addr(addr); 736 random_ether_addr(addr);
739 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__); 737 printk(KERN_WARNING "%s:%s: Setting Ethernet MAC to a random one\n", __FILE__, __func__);
740} 738}
741EXPORT_SYMBOL(bfin_get_ether_addr); 739EXPORT_SYMBOL(bfin_get_ether_addr);
740#endif
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
new file mode 100644
index 000000000000..b8bbba85af53
--- /dev/null
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -0,0 +1,317 @@
1/*
2 */
3
4#include <linux/device.h>
5#include <linux/platform_device.h>
6#include <linux/mtd/mtd.h>
7#include <linux/mtd/partitions.h>
8#include <linux/spi/spi.h>
9#include <linux/spi/flash.h>
10#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
11#include <linux/usb_isp1362.h>
12#endif
13#include <linux/pata_platform.h>
14#include <linux/irq.h>
15#include <linux/interrupt.h>
16#include <linux/usb_sl811.h>
17#include <asm/dma.h>
18#include <asm/bfin5xx_spi.h>
19#include <asm/reboot.h>
20#include <linux/spi/ad7877.h>
21
22/*
23 * Name the Board for the /proc/cpuinfo
24 */
25char *bfin_board_name = "CamSig Minotaur BF537";
26
27#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
28static struct resource bfin_pcmcia_cf_resources[] = {
29 {
30 .start = 0x20310000, /* IO PORT */
31 .end = 0x20312000,
32 .flags = IORESOURCE_MEM,
33 }, {
34 .start = 0x20311000, /* Attribute Memory */
35 .end = 0x20311FFF,
36 .flags = IORESOURCE_MEM,
37 }, {
38 .start = IRQ_PF4,
39 .end = IRQ_PF4,
40 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
41 }, {
42 .start = IRQ_PF6, /* Card Detect PF6 */
43 .end = IRQ_PF6,
44 .flags = IORESOURCE_IRQ,
45 },
46};
47
48static struct platform_device bfin_pcmcia_cf_device = {
49 .name = "bfin_cf_pcmcia",
50 .id = -1,
51 .num_resources = ARRAY_SIZE(bfin_pcmcia_cf_resources),
52 .resource = bfin_pcmcia_cf_resources,
53};
54#endif
55
56#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
57static struct platform_device rtc_device = {
58 .name = "rtc-bfin",
59 .id = -1,
60};
61#endif
62
63#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
64static struct platform_device bfin_mac_device = {
65 .name = "bfin_mac",
66};
67#endif
68
69#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
70static struct resource net2272_bfin_resources[] = {
71 {
72 .start = 0x20300000,
73 .end = 0x20300000 + 0x100,
74 .flags = IORESOURCE_MEM,
75 }, {
76 .start = IRQ_PF7,
77 .end = IRQ_PF7,
78 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
79 },
80};
81
82static struct platform_device net2272_bfin_device = {
83 .name = "net2272",
84 .id = -1,
85 .num_resources = ARRAY_SIZE(net2272_bfin_resources),
86 .resource = net2272_bfin_resources,
87};
88#endif
89
90#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
91/* all SPI peripherals info goes here */
92
93#if defined(CONFIG_MTD_M25P80) \
94 || defined(CONFIG_MTD_M25P80_MODULE)
95
96/* Partition sizes */
97#define FLASH_SIZE 0x00400000
98#define PSIZE_UBOOT 0x00030000
99#define PSIZE_INITRAMFS 0x00240000
100
101static struct mtd_partition bfin_spi_flash_partitions[] = {
102 {
103 .name = "uboot",
104 .size = PSIZE_UBOOT,
105 .offset = 0x000000,
106 .mask_flags = MTD_CAP_ROM
107 }, {
108 .name = "initramfs",
109 .size = PSIZE_INITRAMFS,
110 .offset = PSIZE_UBOOT
111 }, {
112 .name = "opt",
113 .size = FLASH_SIZE - (PSIZE_UBOOT + PSIZE_INITRAMFS),
114 .offset = PSIZE_UBOOT + PSIZE_INITRAMFS,
115 }
116};
117
118static struct flash_platform_data bfin_spi_flash_data = {
119 .name = "m25p80",
120 .parts = bfin_spi_flash_partitions,
121 .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
122 .type = "m25p64",
123};
124
125/* SPI flash chip (m25p64) */
126static struct bfin5xx_spi_chip spi_flash_chip_info = {
127 .enable_dma = 0, /* use dma transfer with this chip*/
128 .bits_per_word = 8,
129};
130#endif
131
132#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
133static struct bfin5xx_spi_chip spi_mmc_chip_info = {
134 .enable_dma = 1,
135 .bits_per_word = 8,
136};
137#endif
138
139static struct spi_board_info bfin_spi_board_info[] __initdata = {
140#if defined(CONFIG_MTD_M25P80) \
141 || defined(CONFIG_MTD_M25P80_MODULE)
142 {
143 /* the modalias must be the same as spi device driver name */
144 .modalias = "m25p80", /* Name of spi_driver for this device */
145 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
146 .bus_num = 0, /* Framework bus number */
147 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
148 .platform_data = &bfin_spi_flash_data,
149 .controller_data = &spi_flash_chip_info,
150 .mode = SPI_MODE_3,
151 },
152#endif
153
154#if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
155 {
156 .modalias = "spi_mmc_dummy",
157 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
158 .bus_num = 0,
159 .chip_select = 0,
160 .platform_data = NULL,
161 .controller_data = &spi_mmc_chip_info,
162 .mode = SPI_MODE_3,
163 },
164 {
165 .modalias = "spi_mmc",
166 .max_speed_hz = 5000000, /* max spi clock (SCK) speed in HZ */
167 .bus_num = 0,
168 .chip_select = CONFIG_SPI_MMC_CS_CHAN,
169 .platform_data = NULL,
170 .controller_data = &spi_mmc_chip_info,
171 .mode = SPI_MODE_3,
172 },
173#endif
174};
175
176/* SPI controller data */
177static struct bfin5xx_spi_master bfin_spi0_info = {
178 .num_chipselect = 8,
179 .enable_dma = 1, /* master has the ability to do dma transfer */
180};
181
182/* SPI (0) */
183static struct resource bfin_spi0_resource[] = {
184 [0] = {
185 .start = SPI0_REGBASE,
186 .end = SPI0_REGBASE + 0xFF,
187 .flags = IORESOURCE_MEM,
188 },
189 [1] = {
190 .start = CH_SPI,
191 .end = CH_SPI,
192 .flags = IORESOURCE_IRQ,
193 },
194};
195
196static struct platform_device bfin_spi0_device = {
197 .name = "bfin-spi",
198 .id = 0, /* Bus number */
199 .num_resources = ARRAY_SIZE(bfin_spi0_resource),
200 .resource = bfin_spi0_resource,
201 .dev = {
202 .platform_data = &bfin_spi0_info, /* Passed to driver */
203 },
204};
205#endif /* spi master and devices */
206
207#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
208static struct resource bfin_uart_resources[] = {
209 {
210 .start = 0xFFC00400,
211 .end = 0xFFC004FF,
212 .flags = IORESOURCE_MEM,
213 }, {
214 .start = 0xFFC02000,
215 .end = 0xFFC020FF,
216 .flags = IORESOURCE_MEM,
217 },
218};
219
220static struct platform_device bfin_uart_device = {
221 .name = "bfin-uart",
222 .id = 1,
223 .num_resources = ARRAY_SIZE(bfin_uart_resources),
224 .resource = bfin_uart_resources,
225};
226#endif
227
228#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
229static struct resource bfin_twi0_resource[] = {
230 [0] = {
231 .start = TWI0_REGBASE,
232 .end = TWI0_REGBASE + 0xFF,
233 .flags = IORESOURCE_MEM,
234 },
235 [1] = {
236 .start = IRQ_TWI,
237 .end = IRQ_TWI,
238 .flags = IORESOURCE_IRQ,
239 },
240};
241
242static struct platform_device i2c_bfin_twi_device = {
243 .name = "i2c-bfin-twi",
244 .id = 0,
245 .num_resources = ARRAY_SIZE(bfin_twi0_resource),
246 .resource = bfin_twi0_resource,
247};
248#endif
249
250#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
251static struct platform_device bfin_sport0_uart_device = {
252 .name = "bfin-sport-uart",
253 .id = 0,
254};
255
256static struct platform_device bfin_sport1_uart_device = {
257 .name = "bfin-sport-uart",
258 .id = 1,
259};
260#endif
261
262static struct platform_device *minotaur_devices[] __initdata = {
263#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
264 &bfin_pcmcia_cf_device,
265#endif
266
267#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
268 &rtc_device,
269#endif
270
271#if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
272 &bfin_mac_device,
273#endif
274
275#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
276 &net2272_bfin_device,
277#endif
278
279#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
280 &bfin_spi0_device,
281#endif
282
283#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
284 &bfin_uart_device,
285#endif
286
287#if defined(CONFIG_I2C_BLACKFIN_TWI) || defined(CONFIG_I2C_BLACKFIN_TWI_MODULE)
288 &i2c_bfin_twi_device,
289#endif
290
291#if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
292 &bfin_sport0_uart_device,
293 &bfin_sport1_uart_device,
294#endif
295
296};
297
298static int __init minotaur_init(void)
299{
300 printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
301 platform_add_devices(minotaur_devices, ARRAY_SIZE(minotaur_devices));
302#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
303 spi_register_board_info(bfin_spi_board_info,
304 ARRAY_SIZE(bfin_spi_board_info));
305#endif
306
307 return 0;
308}
309
310arch_initcall(minotaur_init);
311
312void native_machine_restart(char *cmd)
313{
314 /* workaround reboot hang when booting from SPI */
315 if ((bfin_read_SYSCR() & 0x7) == 0x3)
316 bfin_gpio_reset_spi0_ssel1();
317}
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index fd5f4a6f08e4..509a8a236fd0 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2005 National ICT Australia (NICTA) 10 * Copyright 2005 National ICT Australia (NICTA)
11 * Copyright 2004-2006 Analog Devices Inc. 11 * Copyright 2004-2008 Analog Devices Inc.
12 * 12 *
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/ 13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
14 * 14 *
@@ -29,6 +29,7 @@
29 */ 29 */
30 30
31#include <linux/device.h> 31#include <linux/device.h>
32#include <linux/etherdevice.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 34#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 35#include <linux/mtd/partitions.h>
@@ -133,12 +134,8 @@ static struct resource sl811_hcd_resources[] = {
133void sl811_port_power(struct device *dev, int is_on) 134void sl811_port_power(struct device *dev, int is_on)
134{ 135{
135 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); 136 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
136 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS); 137 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
137 138
138 if (is_on)
139 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
140 else
141 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
142} 139}
143#endif 140#endif
144 141
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index 07b0dc273d2f..772541548b76 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -32,6 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/mtd/physmap.h>
35#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 37#include <linux/spi/flash.h>
37#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE) 38#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
@@ -103,6 +104,30 @@ void __exit bfin_isp1761_exit(void)
103arch_initcall(bfin_isp1761_init); 104arch_initcall(bfin_isp1761_init);
104#endif 105#endif
105 106
107#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
108#include <linux/input.h>
109#include <linux/gpio_keys.h>
110
111static struct gpio_keys_button bfin_gpio_keys_table[] = {
112 {BTN_0, GPIO_PF2, 1, "gpio-keys: BTN0"},
113 {BTN_1, GPIO_PF3, 1, "gpio-keys: BTN1"},
114 {BTN_2, GPIO_PF4, 1, "gpio-keys: BTN2"},
115 {BTN_3, GPIO_PF5, 1, "gpio-keys: BTN3"},
116};
117
118static struct gpio_keys_platform_data bfin_gpio_keys_data = {
119 .buttons = bfin_gpio_keys_table,
120 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
121};
122
123static struct platform_device bfin_device_gpiokeys = {
124 .name = "gpio-keys",
125 .dev = {
126 .platform_data = &bfin_gpio_keys_data,
127 },
128};
129#endif
130
106#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE) 131#if defined(CONFIG_BFIN_CFPCMCIA) || defined(CONFIG_BFIN_CFPCMCIA_MODULE)
107static struct resource bfin_pcmcia_cf_resources[] = { 132static struct resource bfin_pcmcia_cf_resources[] = {
108 { 133 {
@@ -226,12 +251,7 @@ static struct resource sl811_hcd_resources[] = {
226void sl811_port_power(struct device *dev, int is_on) 251void sl811_port_power(struct device *dev, int is_on)
227{ 252{
228 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS"); 253 gpio_request(CONFIG_USB_SL811_BFIN_GPIO_VBUS, "usb:SL811_VBUS");
229 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS); 254 gpio_direction_output(CONFIG_USB_SL811_BFIN_GPIO_VBUS, is_on);
230
231 if (is_on)
232 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 1);
233 else
234 gpio_set_value(CONFIG_USB_SL811_BFIN_GPIO_VBUS, 0);
235} 255}
236#endif 256#endif
237 257
@@ -320,6 +340,49 @@ static struct platform_device net2272_bfin_device = {
320}; 340};
321#endif 341#endif
322 342
343static struct mtd_partition stamp_partitions[] = {
344 {
345 .name = "Bootloader",
346 .size = 0x20000,
347 .offset = 0,
348 }, {
349 .name = "Kernel",
350 .size = 0xE0000,
351 .offset = MTDPART_OFS_APPEND,
352 }, {
353 .name = "RootFS",
354 .size = 0x400000 - 0x20000 - 0xE0000 - 0x10000,
355 .offset = MTDPART_OFS_APPEND,
356 }, {
357 .name = "MAC Address",
358 .size = MTDPART_SIZ_FULL,
359 .offset = 0x3F0000,
360 .mask_flags = MTD_WRITEABLE,
361 }
362};
363
364static struct physmap_flash_data stamp_flash_data = {
365 .width = 2,
366 .parts = stamp_partitions,
367 .nr_parts = ARRAY_SIZE(stamp_partitions),
368};
369
370static struct resource stamp_flash_resource = {
371 .start = 0x20000000,
372 .end = 0x203fffff,
373 .flags = IORESOURCE_MEM,
374};
375
376static struct platform_device stamp_flash_device = {
377 .name = "physmap-flash",
378 .id = 0,
379 .dev = {
380 .platform_data = &stamp_flash_data,
381 },
382 .num_resources = 1,
383 .resource = &stamp_flash_resource,
384};
385
323#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 386#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
324/* all SPI peripherals info goes here */ 387/* all SPI peripherals info goes here */
325 388
@@ -738,6 +801,11 @@ static struct platform_device *stamp_devices[] __initdata = {
738#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 801#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
739 &bfin_pata_device, 802 &bfin_pata_device,
740#endif 803#endif
804
805#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
806 &bfin_device_gpiokeys,
807#endif
808 &stamp_flash_device,
741}; 809};
742 810
743static int __init stamp_init(void) 811static int __init stamp_init(void)
diff --git a/arch/blackfin/mach-bf548/Kconfig b/arch/blackfin/mach-bf548/Kconfig
index d8bd3b49f150..1bfcd8f646ab 100644
--- a/arch/blackfin/mach-bf548/Kconfig
+++ b/arch/blackfin/mach-bf548/Kconfig
@@ -7,7 +7,7 @@ menu "BF548 Specific Configuration"
7config DEB_DMA_URGENT 7config DEB_DMA_URGENT
8 bool "DMA has priority over core for ext. accesses" 8 bool "DMA has priority over core for ext. accesses"
9 depends on BF54x 9 depends on BF54x
10 default n 10 default y
11 help 11 help
12 Treat any DEB1, DEB2 and DEB3 request as Urgent 12 Treat any DEB1, DEB2 and DEB3 request as Urgent
13 13
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index d37d6653c4bc..14860f04d1bd 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -32,6 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/mtd/mtd.h> 33#include <linux/mtd/mtd.h>
34#include <linux/mtd/partitions.h> 34#include <linux/mtd/partitions.h>
35#include <linux/mtd/physmap.h>
35#include <linux/spi/spi.h> 36#include <linux/spi/spi.h>
36#include <linux/spi/flash.h> 37#include <linux/spi/flash.h>
37#include <linux/irq.h> 38#include <linux/irq.h>
@@ -206,23 +207,6 @@ static struct platform_device smsc911x_device = {
206}; 207};
207#endif 208#endif
208 209
209#if defined(CONFIG_USB_BF54x_HCD) || defined(CONFIG_USB_BF54x_HCD_MODULE)
210static struct resource bf54x_hcd_resources[] = {
211 {
212 .start = 0xFFC03C00,
213 .end = 0xFFC040FF,
214 .flags = IORESOURCE_MEM,
215 },
216};
217
218static struct platform_device bf54x_hcd = {
219 .name = "bf54x-hcd",
220 .id = 0,
221 .num_resources = ARRAY_SIZE(bf54x_hcd_resources),
222 .resource = bf54x_hcd_resources,
223};
224#endif
225
226#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 210#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
227static struct resource musb_resources[] = { 211static struct resource musb_resources[] = {
228 [0] = { 212 [0] = {
@@ -243,14 +227,14 @@ static struct resource musb_resources[] = {
243}; 227};
244 228
245static struct musb_hdrc_platform_data musb_plat = { 229static struct musb_hdrc_platform_data musb_plat = {
246#ifdef CONFIG_USB_MUSB_OTG 230#if defined(CONFIG_USB_MUSB_OTG)
247 .mode = MUSB_OTG, 231 .mode = MUSB_OTG,
248#elif CONFIG_USB_MUSB_HDRC_HCD 232#elif defined(CONFIG_USB_MUSB_HDRC_HCD)
249 .mode = MUSB_HOST, 233 .mode = MUSB_HOST,
250#elif CONFIG_USB_GADGET_MUSB_HDRC 234#elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
251 .mode = MUSB_PERIPHERAL, 235 .mode = MUSB_PERIPHERAL,
252#endif 236#endif
253 .multipoint = 1, 237 .multipoint = 0,
254}; 238};
255 239
256static u64 musb_dmamask = ~(u32)0; 240static u64 musb_dmamask = ~(u32)0;
@@ -344,6 +328,44 @@ static struct platform_device bf54x_sdh_device = {
344}; 328};
345#endif 329#endif
346 330
331static struct mtd_partition ezkit_partitions[] = {
332 {
333 .name = "Bootloader",
334 .size = 0x20000,
335 .offset = 0,
336 }, {
337 .name = "Kernel",
338 .size = 0xE0000,
339 .offset = MTDPART_OFS_APPEND,
340 }, {
341 .name = "RootFS",
342 .size = MTDPART_SIZ_FULL,
343 .offset = MTDPART_OFS_APPEND,
344 }
345};
346
347static struct physmap_flash_data ezkit_flash_data = {
348 .width = 2,
349 .parts = ezkit_partitions,
350 .nr_parts = ARRAY_SIZE(ezkit_partitions),
351};
352
353static struct resource ezkit_flash_resource = {
354 .start = 0x20000000,
355 .end = 0x20ffffff,
356 .flags = IORESOURCE_MEM,
357};
358
359static struct platform_device ezkit_flash_device = {
360 .name = "physmap-flash",
361 .id = 0,
362 .dev = {
363 .platform_data = &ezkit_flash_data,
364 },
365 .num_resources = 1,
366 .resource = &ezkit_flash_resource,
367};
368
347#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 369#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
348/* all SPI peripherals info goes here */ 370/* all SPI peripherals info goes here */
349#if defined(CONFIG_MTD_M25P80) \ 371#if defined(CONFIG_MTD_M25P80) \
@@ -531,6 +553,29 @@ static struct platform_device i2c_bfin_twi1_device = {
531#endif 553#endif
532#endif 554#endif
533 555
556#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
557#include <linux/gpio_keys.h>
558
559static struct gpio_keys_button bfin_gpio_keys_table[] = {
560 {BTN_0, GPIO_PB8, 1, "gpio-keys: BTN0"},
561 {BTN_1, GPIO_PB9, 1, "gpio-keys: BTN1"},
562 {BTN_2, GPIO_PB10, 1, "gpio-keys: BTN2"},
563 {BTN_3, GPIO_PB11, 1, "gpio-keys: BTN3"},
564};
565
566static struct gpio_keys_platform_data bfin_gpio_keys_data = {
567 .buttons = bfin_gpio_keys_table,
568 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
569};
570
571static struct platform_device bfin_device_gpiokeys = {
572 .name = "gpio-keys",
573 .dev = {
574 .platform_data = &bfin_gpio_keys_data,
575 },
576};
577#endif
578
534static struct platform_device *ezkit_devices[] __initdata = { 579static struct platform_device *ezkit_devices[] __initdata = {
535#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE) 580#if defined(CONFIG_RTC_DRV_BFIN) || defined(CONFIG_RTC_DRV_BFIN_MODULE)
536 &rtc_device, 581 &rtc_device,
@@ -548,10 +593,6 @@ static struct platform_device *ezkit_devices[] __initdata = {
548 &smsc911x_device, 593 &smsc911x_device,
549#endif 594#endif
550 595
551#if defined(CONFIG_USB_BF54x_HCD) || defined(CONFIG_USB_BF54x_HCD_MODULE)
552 &bf54x_hcd,
553#endif
554
555#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) 596#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
556 &musb_device, 597 &musb_device,
557#endif 598#endif
@@ -583,6 +624,11 @@ static struct platform_device *ezkit_devices[] __initdata = {
583 &i2c_bfin_twi1_device, 624 &i2c_bfin_twi1_device,
584#endif 625#endif
585#endif 626#endif
627
628#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
629 &bfin_device_gpiokeys,
630#endif
631 &ezkit_flash_device,
586}; 632};
587 633
588static int __init stamp_init(void) 634static int __init stamp_init(void)
diff --git a/arch/blackfin/mach-bf548/head.S b/arch/blackfin/mach-bf548/head.S
index 74b34c7f3629..74fe258421a5 100644
--- a/arch/blackfin/mach-bf548/head.S
+++ b/arch/blackfin/mach-bf548/head.S
@@ -298,8 +298,8 @@ ENTRY(_start_dma_code)
298 w[p0] = r0.l; 298 w[p0] = r0.l;
299 ssync; 299 ssync;
300 300
301 p0.h = hi(SIC_IWR); 301 p0.h = hi(SIC_IWR0);
302 p0.l = lo(SIC_IWR); 302 p0.l = lo(SIC_IWR0);
303 r0.l = 0x1; 303 r0.l = 0x1;
304 r0.h = 0x0; 304 r0.h = 0x0;
305 [p0] = r0; 305 [p0] = r0;
@@ -324,12 +324,25 @@ ENTRY(_start_dma_code)
324 w[p0] = r0.l; 324 w[p0] = r0.l;
325 ssync; 325 ssync;
326 326
327#if defined(CONFIG_BF54x)
328 P2.H = hi(EBIU_RSTCTL);
329 P2.L = lo(EBIU_RSTCTL);
330 R0 = [P2];
331 BITSET (R0, 3);
332#else
327 P2.H = hi(EBIU_SDGCTL); 333 P2.H = hi(EBIU_SDGCTL);
328 P2.L = lo(EBIU_SDGCTL); 334 P2.L = lo(EBIU_SDGCTL);
329 R0 = [P2]; 335 R0 = [P2];
330 BITSET (R0, 24); 336 BITSET (R0, 24);
337#endif
331 [P2] = R0; 338 [P2] = R0;
332 SSYNC; 339 SSYNC;
340#if defined(CONFIG_BF54x)
341.LSRR_MODE:
342 R0 = [P2];
343 CC = BITTST(R0, 4);
344 if !CC JUMP .LSRR_MODE;
345#endif
333 346
334 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */ 347 r0 = CONFIG_VCO_MULT & 63; /* Load the VCO multiplier */
335 r0 = r0 << 9; /* Shift it over, */ 348 r0 = r0 << 9; /* Shift it over, */
@@ -361,6 +374,39 @@ ENTRY(_start_dma_code)
361 w[p0] = r0.l; 374 w[p0] = r0.l;
362 ssync; 375 ssync;
363 376
377#if defined(CONFIG_BF54x)
378 P2.H = hi(EBIU_RSTCTL);
379 P2.L = lo(EBIU_RSTCTL);
380 R0 = [P2];
381 CC = BITTST(R0, 0);
382 if CC jump .Lskipddrrst;
383 BITSET (R0, 0);
384.Lskipddrrst:
385 BITCLR (R0, 3);
386 [P2] = R0;
387 SSYNC;
388
389 p0.l = lo(EBIU_DDRCTL0);
390 p0.h = hi(EBIU_DDRCTL0);
391 r0.l = lo(mem_DDRCTL0);
392 r0.h = hi(mem_DDRCTL0);
393 [p0] = r0;
394 ssync;
395
396 p0.l = lo(EBIU_DDRCTL1);
397 p0.h = hi(EBIU_DDRCTL1);
398 r0.l = lo(mem_DDRCTL1);
399 r0.h = hi(mem_DDRCTL1);
400 [p0] = r0;
401 ssync;
402
403 p0.l = lo(EBIU_DDRCTL2);
404 p0.h = hi(EBIU_DDRCTL2);
405 r0.l = lo(mem_DDRCTL2);
406 r0.h = hi(mem_DDRCTL2);
407 [p0] = r0;
408 ssync;
409#else
364 p0.l = lo(EBIU_SDRRC); 410 p0.l = lo(EBIU_SDRRC);
365 p0.h = hi(EBIU_SDRRC); 411 p0.h = hi(EBIU_SDRRC);
366 r0 = mem_SDRRC; 412 r0 = mem_SDRRC;
@@ -394,9 +440,10 @@ ENTRY(_start_dma_code)
394 R1 = R1 | R0; 440 R1 = R1 | R0;
395 [P2] = R1; 441 [P2] = R1;
396 SSYNC; 442 SSYNC;
443#endif
397 444
398 p0.h = hi(SIC_IWR); 445 p0.h = hi(SIC_IWR0);
399 p0.l = lo(SIC_IWR); 446 p0.l = lo(SIC_IWR0);
400 r0.l = lo(IWR_ENABLE_ALL); 447 r0.l = lo(IWR_ENABLE_ALL);
401 r0.h = hi(IWR_ENABLE_ALL); 448 r0.h = hi(IWR_ENABLE_ALL);
402 [p0] = r0; 449 [p0] = r0;
diff --git a/arch/blackfin/mach-bf548/ints-priority.c b/arch/blackfin/mach-bf548/ints-priority.c
index cb0ebac53c79..2665653cee37 100644
--- a/arch/blackfin/mach-bf548/ints-priority.c
+++ b/arch/blackfin/mach-bf548/ints-priority.c
@@ -4,7 +4,7 @@
4 * Author: Michael Hennerich 4 * Author: Michael Hennerich
5 * 5 *
6 * Created: 6 * Created:
7 * Description: Set up the interupt priorities 7 * Description: Set up the interrupt priorities
8 * 8 *
9 * Modified: 9 * Modified:
10 * Copyright 2004-2006 Analog Devices Inc. 10 * Copyright 2004-2006 Analog Devices Inc.
@@ -58,7 +58,7 @@ void program_IAR(void)
58 ((CONFIG_IRQ_PINT1 - 7) << IRQ_PINT1_POS) | 58 ((CONFIG_IRQ_PINT1 - 7) << IRQ_PINT1_POS) |
59 ((CONFIG_IRQ_MDMAS0 - 7) << IRQ_MDMAS0_POS) | 59 ((CONFIG_IRQ_MDMAS0 - 7) << IRQ_MDMAS0_POS) |
60 ((CONFIG_IRQ_MDMAS1 - 7) << IRQ_MDMAS1_POS) | 60 ((CONFIG_IRQ_MDMAS1 - 7) << IRQ_MDMAS1_POS) |
61 ((CONFIG_IRQ_WATCHDOG - 7) << IRQ_WATCHDOG_POS)); 61 ((CONFIG_IRQ_WATCHDOG - 7) << IRQ_WATCH_POS));
62 62
63 bfin_write_SIC_IAR3(((CONFIG_IRQ_DMAC1_ERR - 7) << IRQ_DMAC1_ERR_POS) | 63 bfin_write_SIC_IAR3(((CONFIG_IRQ_DMAC1_ERR - 7) << IRQ_DMAC1_ERR_POS) |
64 ((CONFIG_IRQ_SPORT2_ERR - 7) << IRQ_SPORT2_ERR_POS) | 64 ((CONFIG_IRQ_SPORT2_ERR - 7) << IRQ_SPORT2_ERR_POS) |
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index c19cd29b948a..3a79a9061bdc 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -198,6 +198,13 @@ static struct platform_device bfin_spi0_device = {
198#endif /* spi master and devices */ 198#endif /* spi master and devices */
199 199
200 200
201#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
202static struct platform_device hitachi_fb_device = {
203 .name = "hitachi-tx09",
204};
205#endif
206
207
201#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 208#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
202 209
203static struct resource smc91x_resources[] = { 210static struct resource smc91x_resources[] = {
@@ -315,6 +322,10 @@ static struct platform_device bfin_pata_device = {
315 322
316static struct platform_device *cm_bf561_devices[] __initdata = { 323static struct platform_device *cm_bf561_devices[] __initdata = {
317 324
325#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
326 &hitachi_fb_device,
327#endif
328
318#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 329#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
319 &bfin_uart_device, 330 &bfin_uart_device,
320#endif 331#endif
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 4ff8f6e7a11f..7601c3be1b5c 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -29,6 +29,9 @@
29 29
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/mtd/mtd.h>
33#include <linux/mtd/partitions.h>
34#include <linux/mtd/physmap.h>
32#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
33#include <linux/irq.h> 36#include <linux/irq.h>
34#include <linux/interrupt.h> 37#include <linux/interrupt.h>
@@ -155,6 +158,44 @@ static struct platform_device bfin_uart_device = {
155}; 158};
156#endif 159#endif
157 160
161static struct mtd_partition ezkit_partitions[] = {
162 {
163 .name = "Bootloader",
164 .size = 0x20000,
165 .offset = 0,
166 }, {
167 .name = "Kernel",
168 .size = 0xE0000,
169 .offset = MTDPART_OFS_APPEND,
170 }, {
171 .name = "RootFS",
172 .size = MTDPART_SIZ_FULL,
173 .offset = MTDPART_OFS_APPEND,
174 }
175};
176
177static struct physmap_flash_data ezkit_flash_data = {
178 .width = 2,
179 .parts = ezkit_partitions,
180 .nr_parts = ARRAY_SIZE(ezkit_partitions),
181};
182
183static struct resource ezkit_flash_resource = {
184 .start = 0x20000000,
185 .end = 0x207fffff,
186 .flags = IORESOURCE_MEM,
187};
188
189static struct platform_device ezkit_flash_device = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev = {
193 .platform_data = &ezkit_flash_data,
194 },
195 .num_resources = 1,
196 .resource = &ezkit_flash_resource,
197};
198
158#ifdef CONFIG_SPI_BFIN 199#ifdef CONFIG_SPI_BFIN
159#if defined(CONFIG_SND_BLACKFIN_AD1836) \ 200#if defined(CONFIG_SND_BLACKFIN_AD1836) \
160 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE) 201 || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
@@ -246,6 +287,50 @@ static struct platform_device bfin_pata_device = {
246}; 287};
247#endif 288#endif
248 289
290#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
291#include <linux/input.h>
292#include <linux/gpio_keys.h>
293
294static struct gpio_keys_button bfin_gpio_keys_table[] = {
295 {BTN_0, GPIO_PF5, 1, "gpio-keys: BTN0"},
296 {BTN_1, GPIO_PF6, 1, "gpio-keys: BTN1"},
297 {BTN_2, GPIO_PF7, 1, "gpio-keys: BTN2"},
298 {BTN_3, GPIO_PF8, 1, "gpio-keys: BTN3"},
299};
300
301static struct gpio_keys_platform_data bfin_gpio_keys_data = {
302 .buttons = bfin_gpio_keys_table,
303 .nbuttons = ARRAY_SIZE(bfin_gpio_keys_table),
304};
305
306static struct platform_device bfin_device_gpiokeys = {
307 .name = "gpio-keys",
308 .dev = {
309 .platform_data = &bfin_gpio_keys_data,
310 },
311};
312#endif
313
314#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
315#include <linux/i2c-gpio.h>
316
317static struct i2c_gpio_platform_data i2c_gpio_data = {
318 .sda_pin = 1,
319 .scl_pin = 0,
320 .sda_is_open_drain = 0,
321 .scl_is_open_drain = 0,
322 .udelay = 40,
323};
324
325static struct platform_device i2c_gpio_device = {
326 .name = "i2c-gpio",
327 .id = 0,
328 .dev = {
329 .platform_data = &i2c_gpio_data,
330 },
331};
332#endif
333
249static struct platform_device *ezkit_devices[] __initdata = { 334static struct platform_device *ezkit_devices[] __initdata = {
250#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 335#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
251 &smc91x_device, 336 &smc91x_device,
@@ -258,12 +343,23 @@ static struct platform_device *ezkit_devices[] __initdata = {
258#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE) 343#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
259 &bfin_spi0_device, 344 &bfin_spi0_device,
260#endif 345#endif
346
261#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE) 347#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
262 &bfin_uart_device, 348 &bfin_uart_device,
263#endif 349#endif
350
264#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE) 351#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
265 &bfin_pata_device, 352 &bfin_pata_device,
266#endif 353#endif
354
355#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
356 &bfin_device_gpiokeys,
357#endif
358
359#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
360 &i2c_gpio_device,
361#endif
362 &ezkit_flash_device,
267}; 363};
268 364
269static int __init ezkit_init(void) 365static int __init ezkit_init(void)
diff --git a/arch/blackfin/mach-bf561/coreb.c b/arch/blackfin/mach-bf561/coreb.c
index 5d1d21b4c2a7..1b44e9e6dc3b 100644
--- a/arch/blackfin/mach-bf561/coreb.c
+++ b/arch/blackfin/mach-bf561/coreb.c
@@ -33,7 +33,9 @@
33#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/uaccess.h> 35#include <linux/uaccess.h>
36#include <linux/fs.h>
36#include <asm/dma.h> 37#include <asm/dma.h>
38#include <asm/cacheflush.h>
37 39
38#define MODULE_VER "v0.1" 40#define MODULE_VER "v0.1"
39 41
@@ -90,11 +92,12 @@ static ssize_t coreb_write(struct file *file, const char *buf, size_t count,
90 92
91 coreb_dma_done = 0; 93 coreb_dma_done = 0;
92 94
95 flush_dcache_range((unsigned long)buf, (unsigned long)(buf+len));
93 /* Source Channel */ 96 /* Source Channel */
94 set_dma_start_addr(CH_MEM_STREAM2_SRC, (unsigned long)buf); 97 set_dma_start_addr(CH_MEM_STREAM2_SRC, (unsigned long)buf);
95 set_dma_x_count(CH_MEM_STREAM2_SRC, len); 98 set_dma_x_count(CH_MEM_STREAM2_SRC, len);
96 set_dma_x_modify(CH_MEM_STREAM2_SRC, sizeof(char)); 99 set_dma_x_modify(CH_MEM_STREAM2_SRC, sizeof(char));
97 set_dma_config(CH_MEM_STREAM2_SRC, RESTART); 100 set_dma_config(CH_MEM_STREAM2_SRC, 0);
98 /* Destination Channel */ 101 /* Destination Channel */
99 set_dma_start_addr(CH_MEM_STREAM2_DEST, coreb_base + p); 102 set_dma_start_addr(CH_MEM_STREAM2_DEST, coreb_base + p);
100 set_dma_x_count(CH_MEM_STREAM2_DEST, len); 103 set_dma_x_count(CH_MEM_STREAM2_DEST, len);
@@ -135,11 +138,12 @@ static ssize_t coreb_read(struct file *file, char *buf, size_t count,
135 138
136 coreb_dma_done = 0; 139 coreb_dma_done = 0;
137 140
141 invalidate_dcache_range((unsigned long)buf, (unsigned long)(buf+len));
138 /* Source Channel */ 142 /* Source Channel */
139 set_dma_start_addr(CH_MEM_STREAM2_SRC, coreb_base + p); 143 set_dma_start_addr(CH_MEM_STREAM2_SRC, coreb_base + p);
140 set_dma_x_count(CH_MEM_STREAM2_SRC, len); 144 set_dma_x_count(CH_MEM_STREAM2_SRC, len);
141 set_dma_x_modify(CH_MEM_STREAM2_SRC, sizeof(char)); 145 set_dma_x_modify(CH_MEM_STREAM2_SRC, sizeof(char));
142 set_dma_config(CH_MEM_STREAM2_SRC, RESTART); 146 set_dma_config(CH_MEM_STREAM2_SRC, 0);
143 /* Destination Channel */ 147 /* Destination Channel */
144 set_dma_start_addr(CH_MEM_STREAM2_DEST, (unsigned long)buf); 148 set_dma_start_addr(CH_MEM_STREAM2_DEST, (unsigned long)buf);
145 set_dma_x_count(CH_MEM_STREAM2_DEST, len); 149 set_dma_x_count(CH_MEM_STREAM2_DEST, len);
@@ -266,7 +270,7 @@ static int coreb_ioctl(struct inode *inode, struct file *file,
266 coreb_status |= COREB_IS_RUNNING; 270 coreb_status |= COREB_IS_RUNNING;
267 bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() & ~0x0020); 271 bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() & ~0x0020);
268 SSYNC(); 272 SSYNC();
269 spin_lock_irq(&coreb_lock); 273 spin_unlock_irq(&coreb_lock);
270 break; 274 break;
271#if defined(CONFIG_BF561_COREB_RESET) 275#if defined(CONFIG_BF561_COREB_RESET)
272 case CMD_COREB_STOP: 276 case CMD_COREB_STOP:
@@ -275,7 +279,7 @@ static int coreb_ioctl(struct inode *inode, struct file *file,
275 bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() | 0x0020); 279 bfin_write_SICA_SYSCR(bfin_read_SICA_SYSCR() | 0x0020);
276 bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080); 280 bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | 0x0080);
277 coreb_status &= ~COREB_IS_RUNNING; 281 coreb_status &= ~COREB_IS_RUNNING;
278 spin_lock_irq(&coreb_lock); 282 spin_unlock_irq(&coreb_lock);
279 break; 283 break;
280 case CMD_COREB_RESET: 284 case CMD_COREB_RESET:
281 printk(KERN_INFO "Resetting Core B\n"); 285 printk(KERN_INFO "Resetting Core B\n");
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile
index 4d7733dfd5de..8636d4284bdb 100644
--- a/arch/blackfin/mach-common/Makefile
+++ b/arch/blackfin/mach-common/Makefile
@@ -3,10 +3,9 @@
3# 3#
4 4
5obj-y := \ 5obj-y := \
6 cache.o cacheinit.o cplbhdlr.o cplbmgr.o entry.o \ 6 cache.o cacheinit.o entry.o \
7 interrupt.o lock.o irqpanic.o arch_checks.o 7 interrupt.o lock.o irqpanic.o arch_checks.o
8 8
9obj-$(CONFIG_CPLB_INFO) += cplbinfo.o
10obj-$(CONFIG_BFIN_SINGLE_CORE) += ints-priority-sc.o 9obj-$(CONFIG_BFIN_SINGLE_CORE) += ints-priority-sc.o
11obj-$(CONFIG_BFIN_DUAL_CORE) += ints-priority-dc.o 10obj-$(CONFIG_BFIN_DUAL_CORE) += ints-priority-dc.o
12obj-$(CONFIG_PM) += pm.o dpmc.o 11obj-$(CONFIG_PM) += pm.o dpmc.o
diff --git a/arch/blackfin/mach-common/dpmc.S b/arch/blackfin/mach-common/dpmc.S
index 39fbc2861107..b82c096e1980 100644
--- a/arch/blackfin/mach-common/dpmc.S
+++ b/arch/blackfin/mach-common/dpmc.S
@@ -38,6 +38,9 @@ ENTRY(_unmask_wdog_wakeup_evt)
38#if defined(CONFIG_BF561) 38#if defined(CONFIG_BF561)
39 P0.H = hi(SICA_IWR1); 39 P0.H = hi(SICA_IWR1);
40 P0.L = lo(SICA_IWR1); 40 P0.L = lo(SICA_IWR1);
41#elif defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
42 P0.h = HI(SIC_IWR0);
43 P0.l = LO(SIC_IWR0);
41#else 44#else
42 P0.h = HI(SIC_IWR); 45 P0.h = HI(SIC_IWR);
43 P0.l = LO(SIC_IWR); 46 P0.l = LO(SIC_IWR);
@@ -172,7 +175,7 @@ ENTRY(_sleep_mode)
172 call _set_sic_iwr; 175 call _set_sic_iwr;
173 176
174 R0 = 0xFFFF (Z); 177 R0 = 0xFFFF (Z);
175 call _set_rtc_istat 178 call _set_rtc_istat;
176 179
177 P0.H = hi(PLL_CTL); 180 P0.H = hi(PLL_CTL);
178 P0.L = lo(PLL_CTL); 181 P0.L = lo(PLL_CTL);
@@ -210,7 +213,7 @@ ENTRY(_hibernate_mode)
210 call _set_sic_iwr; 213 call _set_sic_iwr;
211 214
212 R0 = 0xFFFF (Z); 215 R0 = 0xFFFF (Z);
213 call _set_rtc_istat 216 call _set_rtc_istat;
214 217
215 P0.H = hi(VR_CTL); 218 P0.H = hi(VR_CTL);
216 P0.L = lo(VR_CTL); 219 P0.L = lo(VR_CTL);
@@ -236,7 +239,7 @@ ENTRY(_deep_sleep)
236 239
237 call _set_sic_iwr; 240 call _set_sic_iwr;
238 241
239 call _set_sdram_srfs; 242 call _set_dram_srfs;
240 243
241 /* Clear all the interrupts,bits sticky */ 244 /* Clear all the interrupts,bits sticky */
242 R0 = 0xFFFF (Z); 245 R0 = 0xFFFF (Z);
@@ -253,7 +256,7 @@ ENTRY(_deep_sleep)
253 SSYNC; 256 SSYNC;
254 IDLE; 257 IDLE;
255 258
256 call _unset_sdram_srfs; 259 call _unset_dram_srfs;
257 260
258 call _test_pll_locked; 261 call _test_pll_locked;
259 262
@@ -285,23 +288,22 @@ ENTRY(_sleep_deeper)
285 P3 = R0; 288 P3 = R0;
286 R0 = IWR_ENABLE(0); 289 R0 = IWR_ENABLE(0);
287 call _set_sic_iwr; 290 call _set_sic_iwr;
288 call _set_sdram_srfs; 291 call _set_dram_srfs; /* Set SDRAM Self Refresh */
289 292
290 /* Clear all the interrupts,bits sticky */ 293 /* Clear all the interrupts,bits sticky */
291 R0 = 0xFFFF (Z); 294 R0 = 0xFFFF (Z);
292 call _set_rtc_istat 295 call _set_rtc_istat;
293
294 P0.H = hi(PLL_DIV); 296 P0.H = hi(PLL_DIV);
295 P0.L = lo(PLL_DIV); 297 P0.L = lo(PLL_DIV);
296 R6 = W[P0](z); 298 R6 = W[P0](z);
297 R0.L = 0xF; 299 R0.L = 0xF;
298 W[P0] = R0.l; 300 W[P0] = R0.l; /* Set Max VCO to SCLK divider */
299 301
300 P0.H = hi(PLL_CTL); 302 P0.H = hi(PLL_CTL);
301 P0.L = lo(PLL_CTL); 303 P0.L = lo(PLL_CTL);
302 R5 = W[P0](z); 304 R5 = W[P0](z);
303 R0.L = (CONFIG_MIN_VCO_HZ/CONFIG_CLKIN_HZ) << 9; 305 R0.L = (CONFIG_MIN_VCO_HZ/CONFIG_CLKIN_HZ) << 9;
304 W[P0] = R0.l; 306 W[P0] = R0.l; /* Set Min CLKIN to VCO multiplier */
305 307
306 SSYNC; 308 SSYNC;
307 IDLE; 309 IDLE;
@@ -317,29 +319,28 @@ ENTRY(_sleep_deeper)
317 R1 = R1|R2; 319 R1 = R1|R2;
318 320
319 R2 = DEPOSIT(R7, R1); 321 R2 = DEPOSIT(R7, R1);
320 W[P0] = R2; 322 W[P0] = R2; /* Set Min Core Voltage */
321 323
322 SSYNC; 324 SSYNC;
323 IDLE; 325 IDLE;
324 326
325 call _test_pll_locked; 327 call _test_pll_locked;
326 328
329 R0 = P3;
330 call _set_sic_iwr; /* Set Awake from IDLE */
331
327 P0.H = hi(PLL_CTL); 332 P0.H = hi(PLL_CTL);
328 P0.L = lo(PLL_CTL); 333 P0.L = lo(PLL_CTL);
329 R0 = W[P0](z); 334 R0 = W[P0](z);
330 BITSET (R0, 3); 335 BITSET (R0, 3);
331 W[P0] = R0.L; 336 W[P0] = R0.L; /* Turn CCLK OFF */
332
333 R0 = P3;
334 call _set_sic_iwr;
335
336 SSYNC; 337 SSYNC;
337 IDLE; 338 IDLE;
338 339
339 call _test_pll_locked; 340 call _test_pll_locked;
340 341
341 R0 = IWR_ENABLE(0); 342 R0 = IWR_ENABLE(0);
342 call _set_sic_iwr; 343 call _set_sic_iwr; /* Set Awake from IDLE PLL */
343 344
344 P0.H = hi(VR_CTL); 345 P0.H = hi(VR_CTL);
345 P0.L = lo(VR_CTL); 346 P0.L = lo(VR_CTL);
@@ -352,15 +353,15 @@ ENTRY(_sleep_deeper)
352 353
353 P0.H = hi(PLL_DIV); 354 P0.H = hi(PLL_DIV);
354 P0.L = lo(PLL_DIV); 355 P0.L = lo(PLL_DIV);
355 W[P0]= R6; 356 W[P0]= R6; /* Restore CCLK and SCLK divider */
356 357
357 P0.H = hi(PLL_CTL); 358 P0.H = hi(PLL_CTL);
358 P0.L = lo(PLL_CTL); 359 P0.L = lo(PLL_CTL);
359 w[p0] = R5; 360 w[p0] = R5; /* Restore VCO multiplier */
360 IDLE; 361 IDLE;
361 call _test_pll_locked; 362 call _test_pll_locked;
362 363
363 call _unset_sdram_srfs; 364 call _unset_dram_srfs; /* SDRAM Self Refresh Off */
364 365
365 STI R4; 366 STI R4;
366 367
@@ -368,25 +369,47 @@ ENTRY(_sleep_deeper)
368 ( R7:0, P5:0 ) = [SP++]; 369 ( R7:0, P5:0 ) = [SP++];
369 RTS; 370 RTS;
370 371
371ENTRY(_set_sdram_srfs) 372ENTRY(_set_dram_srfs)
372 /* set the sdram to self refresh mode */ 373 /* set the dram to self refresh mode */
374#if defined(CONFIG_BF54x)
375 P0.H = hi(EBIU_RSTCTL);
376 P0.L = lo(EBIU_RSTCTL);
377 R2 = [P0];
378 R3.H = hi(SRREQ);
379 R3.L = lo(SRREQ);
380#else
373 P0.H = hi(EBIU_SDGCTL); 381 P0.H = hi(EBIU_SDGCTL);
374 P0.L = lo(EBIU_SDGCTL); 382 P0.L = lo(EBIU_SDGCTL);
375 R2 = [P0]; 383 R2 = [P0];
376 R3.H = hi(SRFS); 384 R3.H = hi(SRFS);
377 R3.L = lo(SRFS); 385 R3.L = lo(SRFS);
386#endif
378 R2 = R2|R3; 387 R2 = R2|R3;
379 [P0] = R2; 388 [P0] = R2;
380 ssync; 389 ssync;
390#if defined(CONFIG_BF54x)
391.LSRR_MODE:
392 R2 = [P0];
393 CC = BITTST(R2, 4);
394 if !CC JUMP .LSRR_MODE;
395#endif
381 RTS; 396 RTS;
382 397
383ENTRY(_unset_sdram_srfs) 398ENTRY(_unset_dram_srfs)
384 /* set the sdram out of self refresh mode */ 399 /* set the dram out of self refresh mode */
400#if defined(CONFIG_BF54x)
401 P0.H = hi(EBIU_RSTCTL);
402 P0.L = lo(EBIU_RSTCTL);
403 R2 = [P0];
404 R3.H = hi(SRREQ);
405 R3.L = lo(SRREQ);
406#else
385 P0.H = hi(EBIU_SDGCTL); 407 P0.H = hi(EBIU_SDGCTL);
386 P0.L = lo(EBIU_SDGCTL); 408 P0.L = lo(EBIU_SDGCTL);
387 R2 = [P0]; 409 R2 = [P0];
388 R3.H = hi(SRFS); 410 R3.H = hi(SRFS);
389 R3.L = lo(SRFS); 411 R3.L = lo(SRFS);
412#endif
390 R3 = ~R3; 413 R3 = ~R3;
391 R2 = R2&R3; 414 R2 = R2&R3;
392 [P0] = R2; 415 [P0] = R2;
@@ -394,8 +417,13 @@ ENTRY(_unset_sdram_srfs)
394 RTS; 417 RTS;
395 418
396ENTRY(_set_sic_iwr) 419ENTRY(_set_sic_iwr)
420#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
421 P0.H = hi(SIC_IWR0);
422 P0.L = lo(SIC_IWR0);
423#else
397 P0.H = hi(SIC_IWR); 424 P0.H = hi(SIC_IWR);
398 P0.L = lo(SIC_IWR); 425 P0.L = lo(SIC_IWR);
426#endif
399 [P0] = R0; 427 [P0] = R0;
400 SSYNC; 428 SSYNC;
401 RTS; 429 RTS;
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index dc9d3ee2e691..56ff51bc8c21 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -95,6 +95,9 @@ ENTRY(_ex_workaround_261)
95 R6 = 0x26; /* Data CPLB Miss */ 95 R6 = 0x26; /* Data CPLB Miss */
96 cc = R6 == R7; 96 cc = R6 == R7;
97 if cc jump _ex_dcplb_miss (BP); 97 if cc jump _ex_dcplb_miss (BP);
98 R6 = 0x23; /* Data CPLB Miss */
99 cc = R6 == R7;
100 if cc jump _ex_dcplb_viol (BP);
98 /* Handle 0x23 Data CPLB Protection Violation 101 /* Handle 0x23 Data CPLB Protection Violation
99 * and Data CPLB Multiple Hits - Linux Trap Zero 102 * and Data CPLB Multiple Hits - Linux Trap Zero
100 */ 103 */
@@ -102,17 +105,33 @@ ENTRY(_ex_workaround_261)
102ENDPROC(_ex_workaround_261) 105ENDPROC(_ex_workaround_261)
103 106
104#else 107#else
108#ifdef CONFIG_MPU
109#define _ex_dviol _ex_dcplb_viol
110#else
105#define _ex_dviol _ex_trap_c 111#define _ex_dviol _ex_trap_c
112#endif
106#define _ex_dmiss _ex_dcplb_miss 113#define _ex_dmiss _ex_dcplb_miss
107#define _ex_dmult _ex_trap_c 114#define _ex_dmult _ex_trap_c
108#endif 115#endif
109 116
117
118ENTRY(_ex_dcplb_viol)
110ENTRY(_ex_dcplb_miss) 119ENTRY(_ex_dcplb_miss)
111ENTRY(_ex_icplb_miss) 120ENTRY(_ex_icplb_miss)
112 (R7:6,P5:4) = [sp++]; 121 (R7:6,P5:4) = [sp++];
113 ASTAT = [sp++]; 122 ASTAT = [sp++];
114 SAVE_ALL_SYS 123 SAVE_ALL_SYS
124#ifdef CONFIG_MPU
125 R0 = SEQSTAT;
126 R1 = SP;
127 sp += -12;
128 call _cplb_hdr;
129 sp += 12;
130 CC = R0 == 0;
131 IF !CC JUMP _handle_bad_cplb;
132#else
115 call __cplb_hdr; 133 call __cplb_hdr;
134#endif
116 DEBUG_START_HWTRACE(p5, r7) 135 DEBUG_START_HWTRACE(p5, r7)
117 RESTORE_ALL_SYS 136 RESTORE_ALL_SYS
118 SP = EX_SCRATCH_REG; 137 SP = EX_SCRATCH_REG;
@@ -329,7 +348,7 @@ ENTRY(_exception_to_level5)
329 R7 = R7 + R6; 348 R7 = R7 + R6;
330 P5 = R7; 349 P5 = R7;
331 R1 = [P5]; 350 R1 = [P5];
332 [SP + 8] = r1; 351 [SP + PT_SEQSTAT] = r1;
333 352
334 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ 353 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
335 SP += -12; 354 SP += -12;
@@ -633,9 +652,7 @@ ENTRY(_ret_from_exception)
633 [sp + PT_IPEND] = r0; 652 [sp + PT_IPEND] = r0;
634 653
6351: 6541:
636 r1 = 0x37(Z); 655 r2 = LO(~0x37) (Z);
637 r2 = ~r1;
638 r2.h = 0;
639 r0 = r2 & r0; 656 r0 = r2 & r0;
640 cc = r0 == 0; 657 cc = r0 == 0;
641 if !cc jump 4f; /* if not return to user mode, get out */ 658 if !cc jump 4f; /* if not return to user mode, get out */
@@ -1364,6 +1381,7 @@ ENTRY(_sys_call_table)
1364 .long _sys_set_robust_list 1381 .long _sys_set_robust_list
1365 .long _sys_get_robust_list /* 355 */ 1382 .long _sys_get_robust_list /* 355 */
1366 .long _sys_fallocate 1383 .long _sys_fallocate
1384 .long _sys_semtimedop
1367 .rept NR_syscalls-(.-_sys_call_table)/4 1385 .rept NR_syscalls-(.-_sys_call_table)/4
1368 .long _sys_ni_syscall 1386 .long _sys_ni_syscall
1369 .endr 1387 .endr
diff --git a/arch/blackfin/mach-common/interrupt.S b/arch/blackfin/mach-common/interrupt.S
index 4de376418a18..7f752c87fe46 100644
--- a/arch/blackfin/mach-common/interrupt.S
+++ b/arch/blackfin/mach-common/interrupt.S
@@ -34,9 +34,13 @@
34#include <asm/entry.h> 34#include <asm/entry.h>
35#include <asm/asm-offsets.h> 35#include <asm/asm-offsets.h>
36#include <asm/trace.h> 36#include <asm/trace.h>
37#include <asm/traps.h>
38#include <asm/thread_info.h>
37 39
38#include <asm/mach-common/context.S> 40#include <asm/mach-common/context.S>
39 41
42.extern _ret_from_exception
43
40#ifdef CONFIG_I_ENTRY_L1 44#ifdef CONFIG_I_ENTRY_L1
41.section .l1.text 45.section .l1.text
42#else 46#else
@@ -117,8 +121,8 @@ __common_int_entry:
117 121
118#if ANOMALY_05000283 || ANOMALY_05000315 122#if ANOMALY_05000283 || ANOMALY_05000315
119 cc = r7 == r7; 123 cc = r7 == r7;
120 p5.h = 0xffc0; 124 p5.h = HI(CHIPID);
121 p5.l = 0x0014; 125 p5.l = LO(CHIPID);
122 if cc jump 1f; 126 if cc jump 1f;
123 r7.l = W[p5]; 127 r7.l = W[p5];
1241: 1281:
@@ -134,26 +138,22 @@ __common_int_entry:
134 138
135/* interrupt routine for ivhw - 5 */ 139/* interrupt routine for ivhw - 5 */
136ENTRY(_evt_ivhw) 140ENTRY(_evt_ivhw)
137 SAVE_CONTEXT 141 SAVE_ALL_SYS
138#ifdef CONFIG_FRAME_POINTER 142#ifdef CONFIG_FRAME_POINTER
139 fp = 0; 143 fp = 0;
140#endif 144#endif
145
141#if ANOMALY_05000283 146#if ANOMALY_05000283
142 cc = r7 == r7; 147 cc = r7 == r7;
143 p5.h = 0xffc0; 148 p5.h = HI(CHIPID);
144 p5.l = 0x0014; 149 p5.l = LO(CHIPID);
145 if cc jump 1f; 150 if cc jump 1f;
146 r7.l = W[p5]; 151 r7.l = W[p5];
1471: 1521:
148#endif 153#endif
149 154
150 trace_buffer_stop(p0, r0);
151
152 r0 = IRQ_HWERR;
153 r1 = sp;
154
155#ifdef CONFIG_HARDWARE_PM 155#ifdef CONFIG_HARDWARE_PM
156 r7 = SEQSTAT; 156 r7 = [sp + PT_SEQSTAT];
157 r7 = r7 >>> 0xe; 157 r7 = r7 >>> 0xe;
158 r6 = 0x1F; 158 r6 = 0x1F;
159 r7 = r7 & r6; 159 r7 = r7 & r6;
@@ -161,11 +161,29 @@ ENTRY(_evt_ivhw)
161 cc = r7 == r5; 161 cc = r7 == r5;
162 if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */ 162 if cc jump .Lcall_do_ovf; /* deal with performance counter overflow */
163#endif 163#endif
164 164 # We are going to dump something out, so make sure we print IPEND properly
165 p2.l = lo(IPEND);
166 p2.h = hi(IPEND);
167 r0 = [p2];
168 [sp + PT_IPEND] = r0;
169
170 /* set the EXCAUSE to HWERR for trap_c */
171 r0 = [sp + PT_SEQSTAT];
172 R1.L = LO(VEC_HWERR);
173 R1.H = HI(VEC_HWERR);
174 R0 = R0 | R1;
175 [sp + PT_SEQSTAT] = R0;
176
177 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
165 SP += -12; 178 SP += -12;
166 call _irq_panic; 179 call _trap_c;
167 SP += 12; 180 SP += 12;
181
182 call _ret_from_exception;
183.Lcommon_restore_all_sys:
184 RESTORE_ALL_SYS
168 rti; 185 rti;
186
169#ifdef CONFIG_HARDWARE_PM 187#ifdef CONFIG_HARDWARE_PM
170.Lcall_do_ovf: 188.Lcall_do_ovf:
171 189
@@ -173,9 +191,11 @@ ENTRY(_evt_ivhw)
173 call _pm_overflow; 191 call _pm_overflow;
174 SP += 12; 192 SP += 12;
175 193
176 jump .Lcommon_restore_context; 194 jump .Lcommon_restore_all_sys;
177#endif 195#endif
178 196
197ENDPROC(_evt_ivhw)
198
179/* Interrupt routine for evt2 (NMI). 199/* Interrupt routine for evt2 (NMI).
180 * We don't actually use this, so just return. 200 * We don't actually use this, so just return.
181 * For inner circle type details, please see: 201 * For inner circle type details, please see:
diff --git a/arch/blackfin/mach-common/ints-priority-dc.c b/arch/blackfin/mach-common/ints-priority-dc.c
index 4882f0e801a9..8d18d6b163bb 100644
--- a/arch/blackfin/mach-common/ints-priority-dc.c
+++ b/arch/blackfin/mach-common/ints-priority-dc.c
@@ -222,11 +222,12 @@ static void bf561_gpio_unmask_irq(unsigned int irq)
222static unsigned int bf561_gpio_irq_startup(unsigned int irq) 222static unsigned int bf561_gpio_irq_startup(unsigned int irq)
223{ 223{
224 unsigned int ret; 224 unsigned int ret;
225 char buf[8];
225 u16 gpionr = irq - IRQ_PF0; 226 u16 gpionr = irq - IRQ_PF0;
226 227
227 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 228 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
228 229 snprintf(buf, sizeof buf, "IRQ %d", irq);
229 ret = gpio_request(gpionr, "IRQ"); 230 ret = gpio_request(gpionr, buf);
230 if (ret) 231 if (ret)
231 return ret; 232 return ret;
232 233
@@ -250,6 +251,7 @@ static int bf561_gpio_irq_type(unsigned int irq, unsigned int type)
250{ 251{
251 252
252 unsigned int ret; 253 unsigned int ret;
254 char buf[8];
253 u16 gpionr = irq - IRQ_PF0; 255 u16 gpionr = irq - IRQ_PF0;
254 256
255 257
@@ -265,8 +267,8 @@ static int bf561_gpio_irq_type(unsigned int irq, unsigned int type)
265 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 267 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
266 268
267 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 269 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
268 270 snprintf(buf, sizeof buf, "IRQ %d", irq);
269 ret = gpio_request(gpionr, "IRQ"); 271 ret = gpio_request(gpionr, buf);
270 if (ret) 272 if (ret)
271 return ret; 273 return ret;
272 274
diff --git a/arch/blackfin/mach-common/ints-priority-sc.c b/arch/blackfin/mach-common/ints-priority-sc.c
index 147f0731087a..dec42acb5de0 100644
--- a/arch/blackfin/mach-common/ints-priority-sc.c
+++ b/arch/blackfin/mach-common/ints-priority-sc.c
@@ -313,6 +313,7 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
313static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)]; 313static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
314static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)]; 314static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
315 315
316
316static void bfin_gpio_ack_irq(unsigned int irq) 317static void bfin_gpio_ack_irq(unsigned int irq)
317{ 318{
318 u16 gpionr = irq - IRQ_PF0; 319 u16 gpionr = irq - IRQ_PF0;
@@ -352,9 +353,11 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
352{ 353{
353 unsigned int ret; 354 unsigned int ret;
354 u16 gpionr = irq - IRQ_PF0; 355 u16 gpionr = irq - IRQ_PF0;
356 char buf[8];
355 357
356 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 358 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
357 ret = gpio_request(gpionr, "IRQ"); 359 snprintf(buf, sizeof buf, "IRQ %d", irq);
360 ret = gpio_request(gpionr, buf);
358 if (ret) 361 if (ret)
359 return ret; 362 return ret;
360 } 363 }
@@ -376,6 +379,7 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
376{ 379{
377 380
378 unsigned int ret; 381 unsigned int ret;
382 char buf[8];
379 u16 gpionr = irq - IRQ_PF0; 383 u16 gpionr = irq - IRQ_PF0;
380 384
381 if (type == IRQ_TYPE_PROBE) { 385 if (type == IRQ_TYPE_PROBE) {
@@ -388,7 +392,8 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
388 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | 392 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
389 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 393 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
390 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 394 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
391 ret = gpio_request(gpionr, "IRQ"); 395 snprintf(buf, sizeof buf, "IRQ %d", irq);
396 ret = gpio_request(gpionr, buf);
392 if (ret) 397 if (ret)
393 return ret; 398 return ret;
394 } 399 }
@@ -478,6 +483,10 @@ static void bfin_demux_gpio_irq(unsigned int intb_irq,
478static unsigned char irq2pint_lut[NR_PINTS]; 483static unsigned char irq2pint_lut[NR_PINTS];
479static unsigned char pint2irq_lut[NR_PINT_SYS_IRQS * NR_PINT_BITS]; 484static unsigned char pint2irq_lut[NR_PINT_SYS_IRQS * NR_PINT_BITS];
480 485
486static unsigned int gpio_both_edge_triggered[NR_PINT_SYS_IRQS];
487static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
488
489
481struct pin_int_t { 490struct pin_int_t {
482 unsigned int mask_set; 491 unsigned int mask_set;
483 unsigned int mask_clear; 492 unsigned int mask_clear;
@@ -544,13 +553,20 @@ void init_pint_lut(void)
544 553
545} 554}
546 555
547static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
548
549static void bfin_gpio_ack_irq(unsigned int irq) 556static void bfin_gpio_ack_irq(unsigned int irq)
550{ 557{
551 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 558 u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
559 u32 pintbit = PINT_BIT(pint_val);
560 u8 bank = PINT_2_BANK(pint_val);
561
562 if (unlikely(gpio_both_edge_triggered[bank] & pintbit)) {
563 if (pint[bank]->invert_set & pintbit)
564 pint[bank]->invert_clear = pintbit;
565 else
566 pint[bank]->invert_set = pintbit;
567 }
568 pint[bank]->request = pintbit;
552 569
553 pint[PINT_2_BANK(pint_val)]->request = PINT_BIT(pint_val);
554 SSYNC(); 570 SSYNC();
555} 571}
556 572
@@ -560,6 +576,13 @@ static void bfin_gpio_mask_ack_irq(unsigned int irq)
560 u32 pintbit = PINT_BIT(pint_val); 576 u32 pintbit = PINT_BIT(pint_val);
561 u8 bank = PINT_2_BANK(pint_val); 577 u8 bank = PINT_2_BANK(pint_val);
562 578
579 if (unlikely(gpio_both_edge_triggered[bank] & pintbit)) {
580 if (pint[bank]->invert_set & pintbit)
581 pint[bank]->invert_clear = pintbit;
582 else
583 pint[bank]->invert_set = pintbit;
584 }
585
563 pint[bank]->request = pintbit; 586 pint[bank]->request = pintbit;
564 pint[bank]->mask_clear = pintbit; 587 pint[bank]->mask_clear = pintbit;
565 SSYNC(); 588 SSYNC();
@@ -587,7 +610,8 @@ static void bfin_gpio_unmask_irq(unsigned int irq)
587static unsigned int bfin_gpio_irq_startup(unsigned int irq) 610static unsigned int bfin_gpio_irq_startup(unsigned int irq)
588{ 611{
589 unsigned int ret; 612 unsigned int ret;
590 u16 gpionr = irq - IRQ_PA0; 613 char buf[8];
614 u16 gpionr = irq_to_gpio(irq);
591 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 615 u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
592 616
593 if (pint_val == IRQ_NOT_AVAIL) { 617 if (pint_val == IRQ_NOT_AVAIL) {
@@ -598,7 +622,8 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
598 } 622 }
599 623
600 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 624 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
601 ret = gpio_request(gpionr, "IRQ"); 625 snprintf(buf, sizeof buf, "IRQ %d", irq);
626 ret = gpio_request(gpionr, buf);
602 if (ret) 627 if (ret)
603 return ret; 628 return ret;
604 } 629 }
@@ -611,16 +636,19 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
611 636
612static void bfin_gpio_irq_shutdown(unsigned int irq) 637static void bfin_gpio_irq_shutdown(unsigned int irq)
613{ 638{
639 u16 gpionr = irq_to_gpio(irq);
640
614 bfin_gpio_mask_irq(irq); 641 bfin_gpio_mask_irq(irq);
615 gpio_free(irq - IRQ_PA0); 642 gpio_free(gpionr);
616 gpio_enabled[gpio_bank(irq - IRQ_PA0)] &= ~gpio_bit(irq - IRQ_PA0); 643 gpio_enabled[gpio_bank(gpionr)] &= ~gpio_bit(gpionr);
617} 644}
618 645
619static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) 646static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
620{ 647{
621 648
622 unsigned int ret; 649 unsigned int ret;
623 u16 gpionr = irq - IRQ_PA0; 650 char buf[8];
651 u16 gpionr = irq_to_gpio(irq);
624 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 652 u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
625 u32 pintbit = PINT_BIT(pint_val); 653 u32 pintbit = PINT_BIT(pint_val);
626 u8 bank = PINT_2_BANK(pint_val); 654 u8 bank = PINT_2_BANK(pint_val);
@@ -638,7 +666,8 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
638 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | 666 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
639 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 667 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
640 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 668 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
641 ret = gpio_request(gpionr, "IRQ"); 669 snprintf(buf, sizeof buf, "IRQ %d", irq);
670 ret = gpio_request(gpionr, buf);
642 if (ret) 671 if (ret)
643 return ret; 672 return ret;
644 } 673 }
@@ -651,28 +680,33 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
651 680
652 gpio_direction_input(gpionr); 681 gpio_direction_input(gpionr);
653 682
654 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
655 pint[bank]->edge_set = pintbit;
656 } else {
657 pint[bank]->edge_clear = pintbit;
658 }
659
660 if ((type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW))) 683 if ((type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)))
661 pint[bank]->invert_set = pintbit; /* low or falling edge denoted by one */ 684 pint[bank]->invert_set = pintbit; /* low or falling edge denoted by one */
662 else 685 else
663 pint[bank]->invert_set = pintbit; /* high or rising edge denoted by zero */ 686 pint[bank]->invert_clear = pintbit; /* high or rising edge denoted by zero */
664 687
665 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) 688 if ((type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING))
666 pint[bank]->invert_set = pintbit; 689 == (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
667 else
668 pint[bank]->invert_set = pintbit;
669 690
670 SSYNC(); 691 gpio_both_edge_triggered[bank] |= pintbit;
671 692
672 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) 693 if (gpio_get_value(gpionr))
694 pint[bank]->invert_set = pintbit;
695 else
696 pint[bank]->invert_clear = pintbit;
697 } else {
698 gpio_both_edge_triggered[bank] &= ~pintbit;
699 }
700
701 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
702 pint[bank]->edge_set = pintbit;
673 set_irq_handler(irq, handle_edge_irq); 703 set_irq_handler(irq, handle_edge_irq);
674 else 704 } else {
705 pint[bank]->edge_clear = pintbit;
675 set_irq_handler(irq, handle_level_irq); 706 set_irq_handler(irq, handle_level_irq);
707 }
708
709 SSYNC();
676 710
677 return 0; 711 return 0;
678} 712}
diff --git a/arch/blackfin/mach-common/irqpanic.c b/arch/blackfin/mach-common/irqpanic.c
index b22959b197e5..606ded9ff4e1 100644
--- a/arch/blackfin/mach-common/irqpanic.c
+++ b/arch/blackfin/mach-common/irqpanic.c
@@ -46,9 +46,6 @@ void irq_panic(int reason, struct pt_regs *regs) __attribute__ ((l1_text));
46 */ 46 */
47asmlinkage void irq_panic(int reason, struct pt_regs *regs) 47asmlinkage void irq_panic(int reason, struct pt_regs *regs)
48{ 48{
49 int sig = 0;
50 siginfo_t info;
51
52#ifdef CONFIG_DEBUG_ICACHE_CHECK 49#ifdef CONFIG_DEBUG_ICACHE_CHECK
53 unsigned int cmd, tag, ca, cache_hi, cache_lo, *pa; 50 unsigned int cmd, tag, ca, cache_hi, cache_lo, *pa;
54 unsigned short i, j, die; 51 unsigned short i, j, die;
@@ -136,53 +133,6 @@ asmlinkage void irq_panic(int reason, struct pt_regs *regs)
136 } 133 }
137#endif 134#endif
138 135
139 printk(KERN_EMERG "\n");
140 printk(KERN_EMERG "Exception: IRQ 0x%x entered\n", reason);
141 printk(KERN_EMERG " code=[0x%08lx], stack frame=0x%08lx, "
142 " bad PC=0x%08lx\n",
143 (unsigned long)regs->seqstat,
144 (unsigned long)regs,
145 (unsigned long)regs->pc);
146 if (reason == 0x5) {
147 printk(KERN_EMERG "----------- HARDWARE ERROR -----------\n");
148
149 /* There is only need to check for Hardware Errors, since other
150 * EXCEPTIONS are handled in TRAPS.c (MH)
151 */
152 switch (regs->seqstat & SEQSTAT_HWERRCAUSE) {
153 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): /* System MMR Error */
154 info.si_code = BUS_ADRALN;
155 sig = SIGBUS;
156 printk(KERN_EMERG HWC_x2(KERN_EMERG));
157 break;
158 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): /* External Memory Addressing Error */
159 info.si_code = BUS_ADRERR;
160 sig = SIGBUS;
161 printk(KERN_EMERG HWC_x3(KERN_EMERG));
162 break;
163 case (SEQSTAT_HWERRCAUSE_PERF_FLOW): /* Performance Monitor Overflow */
164 printk(KERN_EMERG HWC_x12(KERN_EMERG));
165 break;
166 case (SEQSTAT_HWERRCAUSE_RAISE_5): /* RAISE 5 instruction */
167 printk(KERN_EMERG HWC_x18(KERN_EMERG));
168 break;
169 default: /* Reserved */
170 printk(KERN_EMERG HWC_default(KERN_EMERG));
171 break;
172 }
173 }
174
175 regs->ipend = bfin_read_IPEND();
176 dump_bfin_process(regs);
177 dump_bfin_mem((void *)regs->pc);
178 show_regs(regs);
179 if (0 == (info.si_signo = sig) || 0 == user_mode(regs)) /* in kernelspace */
180 panic("Unhandled IRQ or exceptions!\n");
181 else { /* in userspace */
182 info.si_errno = 0;
183 info.si_addr = (void *)regs->pc;
184 force_sig_info(sig, &info, current);
185 }
186} 136}
187 137
188#ifdef CONFIG_HARDWARE_PM 138#ifdef CONFIG_HARDWARE_PM
diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index dac51fb06f22..81930f7d06f1 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -77,7 +77,15 @@ void bfin_pm_suspend_standby_enter(void)
77 77
78 gpio_pm_restore(); 78 gpio_pm_restore();
79 79
80#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
81 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
82 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
83# ifdef CONFIG_BF54x
84 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
85# endif
86#else
80 bfin_write_SIC_IWR(IWR_ENABLE_ALL); 87 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
88#endif
81 89
82 local_irq_restore(flags); 90 local_irq_restore(flags);
83 } 91 }
@@ -85,7 +93,15 @@ void bfin_pm_suspend_standby_enter(void)
85 93
86#if defined(CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR) 94#if defined(CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR)
87 sleep_deeper(CONFIG_PM_WAKEUP_SIC_IWR); 95 sleep_deeper(CONFIG_PM_WAKEUP_SIC_IWR);
96# if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
97 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
98 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
99# ifdef CONFIG_BF54x
100 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
101# endif
102# else
88 bfin_write_SIC_IWR(IWR_ENABLE_ALL); 103 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
104# endif
89#endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */ 105#endif /* CONFIG_PM_WAKEUP_GPIO_BY_SIC_IWR */
90} 106}
91 107
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index e97ea8fc8dc4..eb1a12ac9e33 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -128,8 +128,8 @@ void __init paging_init(void)
128void __init mem_init(void) 128void __init mem_init(void)
129{ 129{
130 unsigned int codek = 0, datak = 0, initk = 0; 130 unsigned int codek = 0, datak = 0, initk = 0;
131 unsigned int reservedpages = 0, freepages = 0;
131 unsigned long tmp; 132 unsigned long tmp;
132 unsigned int len = _ramend - _rambase;
133 unsigned long start_mem = memory_start; 133 unsigned long start_mem = memory_start;
134 unsigned long end_mem = memory_end; 134 unsigned long end_mem = memory_end;
135 135
@@ -138,19 +138,36 @@ void __init mem_init(void)
138 138
139 start_mem = PAGE_ALIGN(start_mem); 139 start_mem = PAGE_ALIGN(start_mem);
140 max_mapnr = num_physpages = MAP_NR(high_memory); 140 max_mapnr = num_physpages = MAP_NR(high_memory);
141 printk(KERN_INFO "Physical pages: %lx\n", num_physpages); 141 printk(KERN_INFO "Kernel managed physical pages: %lu\n",
142 num_physpages);
142 143
143 /* This will put all memory onto the freelists. */ 144 /* This will put all memory onto the freelists. */
144 totalram_pages = free_all_bootmem(); 145 totalram_pages = free_all_bootmem();
145 146
147 reservedpages = 0;
148 for (tmp = 0; tmp < max_mapnr; tmp++)
149 if (PageReserved(pfn_to_page(tmp)))
150 reservedpages++;
151 freepages = max_mapnr - reservedpages;
152
153 /* do not count in kernel image between _rambase and _ramstart */
154 reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
155#if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
156 reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >>
157 PAGE_SHIFT;
158#endif
159
146 codek = (_etext - _stext) >> 10; 160 codek = (_etext - _stext) >> 10;
147 datak = (__bss_stop - __bss_start) >> 10;
148 initk = (__init_end - __init_begin) >> 10; 161 initk = (__init_end - __init_begin) >> 10;
162 datak = ((_ramstart - _rambase) >> 10) - codek - initk;
149 163
150 tmp = nr_free_pages() << PAGE_SHIFT;
151 printk(KERN_INFO 164 printk(KERN_INFO
152 "Memory available: %luk/%uk RAM, (%uk init code, %uk kernel code, %uk data, %uk dma)\n", 165 "Memory available: %luk/%luk RAM, "
153 tmp >> 10, len >> 10, initk, codek, datak, DMA_UNCACHED_REGION >> 10); 166 "(%uk init code, %uk kernel code, "
167 "%uk data, %uk dma, %uk reserved)\n",
168 (unsigned long) freepages << (PAGE_SHIFT-10), _ramend >> 10,
169 initk, codek, datak, DMA_UNCACHED_REGION >> 10,
170 (reservedpages << (PAGE_SHIFT-10)));
154 171
155 /* Initialize the blackfin L1 Memory. */ 172 /* Initialize the blackfin L1 Memory. */
156 l1sram_init(); 173 l1sram_init();
@@ -184,13 +201,15 @@ static __init void free_init_pages(const char *what, unsigned long begin, unsign
184#ifdef CONFIG_BLK_DEV_INITRD 201#ifdef CONFIG_BLK_DEV_INITRD
185void __init free_initrd_mem(unsigned long start, unsigned long end) 202void __init free_initrd_mem(unsigned long start, unsigned long end)
186{ 203{
204#ifndef CONFIG_MPU
187 free_init_pages("initrd memory", start, end); 205 free_init_pages("initrd memory", start, end);
206#endif
188} 207}
189#endif 208#endif
190 209
191void __init free_initmem(void) 210void __init free_initmem(void)
192{ 211{
193#ifdef CONFIG_RAMKERNEL 212#if defined CONFIG_RAMKERNEL && !defined CONFIG_MPU
194 free_init_pages("unused kernel memory", 213 free_init_pages("unused kernel memory",
195 (unsigned long)(&__init_begin), 214 (unsigned long)(&__init_begin),
196 (unsigned long)(&__init_end)); 215 (unsigned long)(&__init_end));
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index d51e18fb789b..841904cdef4d 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -270,6 +270,24 @@ static struct platform_device smc91x_device = {
270 270
271#endif 271#endif
272 272
273/* All Alchemy demoboards with I2C have this #define in their headers */
274#ifdef SMBUS_PSC_BASE
275static struct resource pbdb_smbus_resources[] = {
276 {
277 .start = SMBUS_PSC_BASE,
278 .end = SMBUS_PSC_BASE + 0x24 - 1,
279 .flags = IORESOURCE_MEM,
280 },
281};
282
283static struct platform_device pbdb_smbus_device = {
284 .name = "au1xpsc_smbus",
285 .id = 0, /* bus number */
286 .num_resources = ARRAY_SIZE(pbdb_smbus_resources),
287 .resource = pbdb_smbus_resources,
288};
289#endif
290
273static struct platform_device *au1xxx_platform_devices[] __initdata = { 291static struct platform_device *au1xxx_platform_devices[] __initdata = {
274 &au1xxx_usb_ohci_device, 292 &au1xxx_usb_ohci_device,
275 &au1x00_pcmcia_device, 293 &au1x00_pcmcia_device,
@@ -287,6 +305,9 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
287#ifdef CONFIG_MIPS_DB1200 305#ifdef CONFIG_MIPS_DB1200
288 &smc91x_device, 306 &smc91x_device,
289#endif 307#endif
308#ifdef SMBUS_PSC_BASE
309 &pbdb_smbus_device,
310#endif
290}; 311};
291 312
292int __init au1xxx_platform_init(void) 313int __init au1xxx_platform_init(void)
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index b84f8df325c4..cb0a7493ff64 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -224,26 +224,6 @@ mpc834x_sys_init_IRQ(void)
224 ipic_set_default_priority(); 224 ipic_set_default_priority();
225} 225}
226 226
227#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
228extern ulong ds1374_get_rtc_time(void);
229extern int ds1374_set_rtc_time(ulong);
230
231static int __init
232mpc834x_rtc_hookup(void)
233{
234 struct timespec tv;
235
236 ppc_md.get_rtc_time = ds1374_get_rtc_time;
237 ppc_md.set_rtc_time = ds1374_set_rtc_time;
238
239 tv.tv_nsec = 0;
240 tv.tv_sec = (ppc_md.get_rtc_time)();
241 do_settimeofday(&tv);
242
243 return 0;
244}
245late_initcall(mpc834x_rtc_hookup);
246#endif
247static __inline__ void 227static __inline__ void
248mpc834x_sys_set_bat(void) 228mpc834x_sys_set_bat(void)
249{ 229{
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
index 4ee2bd156dc5..27ce389c1224 100644
--- a/arch/ppc/platforms/85xx/tqm85xx.c
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -258,27 +258,6 @@ int tqm85xx_show_cpuinfo(struct seq_file *m)
258 return 0; 258 return 0;
259} 259}
260 260
261#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_DS1337)
262extern ulong ds1337_get_rtc_time(void);
263extern int ds1337_set_rtc_time(unsigned long nowtime);
264
265static int __init
266tqm85xx_rtc_hookup(void)
267{
268 struct timespec tv;
269
270 ppc_md.set_rtc_time = ds1337_set_rtc_time;
271 ppc_md.get_rtc_time = ds1337_get_rtc_time;
272
273 tv.tv_nsec = 0;
274 tv.tv_sec = (ppc_md.get_rtc_time)();
275 do_settimeofday(&tv);
276
277 return 0;
278}
279late_initcall(tqm85xx_rtc_hookup);
280#endif
281
282#ifdef CONFIG_PCI 261#ifdef CONFIG_PCI
283/* 262/*
284 * interrupt routing 263 * interrupt routing
diff --git a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c
index 52f63e6f0856..fe6e88cdb1cd 100644
--- a/arch/ppc/platforms/katana.c
+++ b/arch/ppc/platforms/katana.c
@@ -838,27 +838,6 @@ katana_find_end_of_memory(void)
838 return bdp->bi_memsize; 838 return bdp->bi_memsize;
839} 839}
840 840
841#if defined(CONFIG_I2C_MV64XXX) && defined(CONFIG_SENSORS_M41T00)
842extern ulong m41t00_get_rtc_time(void);
843extern int m41t00_set_rtc_time(ulong);
844
845static int __init
846katana_rtc_hookup(void)
847{
848 struct timespec tv;
849
850 ppc_md.get_rtc_time = m41t00_get_rtc_time;
851 ppc_md.set_rtc_time = m41t00_set_rtc_time;
852
853 tv.tv_nsec = 0;
854 tv.tv_sec = (ppc_md.get_rtc_time)();
855 do_settimeofday(&tv);
856
857 return 0;
858}
859late_initcall(katana_rtc_hookup);
860#endif
861
862#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE) 841#if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE)
863static void __init 842static void __init
864katana_map_io(void) 843katana_map_io(void)
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 1330061020ab..6ef54d27fc00 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -276,9 +276,6 @@ source "kernel/Kconfig.preempt"
276 276
277source "mm/Kconfig" 277source "mm/Kconfig"
278 278
279config HOLES_IN_ZONE
280 def_bool y
281
282comment "I/O subsystem configuration" 279comment "I/O subsystem configuration"
283 280
284config MACHCHK_WARNING 281config MACHCHK_WARNING
diff --git a/arch/s390/crypto/Kconfig b/arch/s390/crypto/Kconfig
deleted file mode 100644
index d1defbbfcd81..000000000000
--- a/arch/s390/crypto/Kconfig
+++ /dev/null
@@ -1,60 +0,0 @@
1config CRYPTO_SHA1_S390
2 tristate "SHA1 digest algorithm"
3 depends on S390
4 select CRYPTO_ALGAPI
5 help
6 This is the s390 hardware accelerated implementation of the
7 SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2).
8
9config CRYPTO_SHA256_S390
10 tristate "SHA256 digest algorithm"
11 depends on S390
12 select CRYPTO_ALGAPI
13 help
14 This is the s390 hardware accelerated implementation of the
15 SHA256 secure hash standard (DFIPS 180-2).
16
17 This version of SHA implements a 256 bit hash with 128 bits of
18 security against collision attacks.
19
20config CRYPTO_DES_S390
21 tristate "DES and Triple DES cipher algorithms"
22 depends on S390
23 select CRYPTO_ALGAPI
24 select CRYPTO_BLKCIPHER
25 help
26 This us the s390 hardware accelerated implementation of the
27 DES cipher algorithm (FIPS 46-2), and Triple DES EDE (FIPS 46-3).
28
29config CRYPTO_AES_S390
30 tristate "AES cipher algorithms"
31 depends on S390
32 select CRYPTO_ALGAPI
33 select CRYPTO_BLKCIPHER
34 help
35 This is the s390 hardware accelerated implementation of the
36 AES cipher algorithms (FIPS-197). AES uses the Rijndael
37 algorithm.
38
39 Rijndael appears to be consistently a very good performer in
40 both hardware and software across a wide range of computing
41 environments regardless of its use in feedback or non-feedback
42 modes. Its key setup time is excellent, and its key agility is
43 good. Rijndael's very low memory requirements make it very well
44 suited for restricted-space environments, in which it also
45 demonstrates excellent performance. Rijndael's operations are
46 among the easiest to defend against power and timing attacks.
47
48 On s390 the System z9-109 currently only supports the key size
49 of 128 bit.
50
51config S390_PRNG
52 tristate "Pseudo random number generator device driver"
53 depends on S390
54 default "m"
55 help
56 Select this option if you want to use the s390 pseudo random number
57 generator. The PRNG is part of the cryptographic processor functions
58 and uses triple-DES to generate secure random numbers like the
59 ANSI X9.17 standard. The PRNG is usable via the char device
60 /dev/prandom.
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
index 46c97058ebe1..a3f67f8b5427 100644
--- a/arch/s390/crypto/aes_s390.c
+++ b/arch/s390/crypto/aes_s390.c
@@ -516,7 +516,7 @@ static int __init aes_init(void)
516 /* z9 109 and z9 BC/EC only support 128 bit key length */ 516 /* z9 109 and z9 BC/EC only support 128 bit key length */
517 if (keylen_flag == AES_KEYLEN_128) 517 if (keylen_flag == AES_KEYLEN_128)
518 printk(KERN_INFO 518 printk(KERN_INFO
519 "aes_s390: hardware acceleration only available for" 519 "aes_s390: hardware acceleration only available for "
520 "128 bit keys\n"); 520 "128 bit keys\n");
521 521
522 ret = crypto_register_alg(&aes_alg); 522 ret = crypto_register_alg(&aes_alg);
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c
index 8eb3a1aedc22..0cfefddd8375 100644
--- a/arch/s390/crypto/prng.c
+++ b/arch/s390/crypto/prng.c
@@ -90,7 +90,7 @@ static ssize_t prng_read(struct file *file, char __user *ubuf, size_t nbytes,
90 int ret = 0; 90 int ret = 0;
91 int tmp; 91 int tmp;
92 92
93 /* nbytes can be arbitrary long, we spilt it into chunks */ 93 /* nbytes can be arbitrary length, we split it into chunks */
94 while (nbytes) { 94 while (nbytes) {
95 /* same as in extract_entropy_user in random.c */ 95 /* same as in extract_entropy_user in random.c */
96 if (need_resched()) { 96 if (need_resched()) {
@@ -146,7 +146,7 @@ static ssize_t prng_read(struct file *file, char __user *ubuf, size_t nbytes,
146 return ret; 146 return ret;
147} 147}
148 148
149static struct file_operations prng_fops = { 149static const struct file_operations prng_fops = {
150 .owner = THIS_MODULE, 150 .owner = THIS_MODULE,
151 .open = &prng_open, 151 .open = &prng_open,
152 .release = NULL, 152 .release = NULL,
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 56cb71007cd9..b3b650a93c7c 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -31,7 +31,3 @@ S390_KEXEC_OBJS := machine_kexec.o crash.o
31S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o) 31S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
32obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS) 32obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
33 33
34#
35# This is just to get the dependencies...
36#
37binfmt_elf32.o: $(TOPDIR)/fs/binfmt_elf.c
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 1b3af7dab816..9f7b73b180f0 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -276,7 +276,7 @@ void __init startup_init(void)
276 create_kernel_nss(); 276 create_kernel_nss();
277 sort_main_extable(); 277 sort_main_extable();
278 setup_lowcore_early(); 278 setup_lowcore_early();
279 sclp_readinfo_early(); 279 sclp_read_info_early();
280 sclp_facilities_detect(); 280 sclp_facilities_detect();
281 memsize = sclp_memory_detect(); 281 memsize = sclp_memory_detect();
282#ifndef CONFIG_64BIT 282#ifndef CONFIG_64BIT
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index a87b1976d409..79dccd206a6e 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -157,7 +157,7 @@ startup_continue:
157 .long 0xb2b10000 # store facility list 157 .long 0xb2b10000 # store facility list
158 tm 0xc8,0x08 # check bit for clearing-by-ASCE 158 tm 0xc8,0x08 # check bit for clearing-by-ASCE
159 bno 0f-.LPG1(%r13) 159 bno 0f-.LPG1(%r13)
160 lhi %r1,2094 160 lhi %r1,2048
161 lhi %r2,0 161 lhi %r2,0
162 .long 0xb98e2001 162 .long 0xb98e2001
163 oi 7(%r12),0x80 # set IDTE flag 163 oi 7(%r12),0x80 # set IDTE flag
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index b97694fa62ec..db28cca81fef 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -2,7 +2,7 @@
2 * arch/s390/kernel/ipl.c 2 * arch/s390/kernel/ipl.c
3 * ipl/reipl/dump support for Linux on s390. 3 * ipl/reipl/dump support for Linux on s390.
4 * 4 *
5 * Copyright (C) IBM Corp. 2005,2006 5 * Copyright IBM Corp. 2005,2007
6 * Author(s): Michael Holzheu <holzheu@de.ibm.com> 6 * Author(s): Michael Holzheu <holzheu@de.ibm.com>
7 * Heiko Carstens <heiko.carstens@de.ibm.com> 7 * Heiko Carstens <heiko.carstens@de.ibm.com>
8 * Volker Sameske <sameske@de.ibm.com> 8 * Volker Sameske <sameske@de.ibm.com>
@@ -31,6 +31,43 @@
31#define IPL_FCP_DUMP_STR "fcp_dump" 31#define IPL_FCP_DUMP_STR "fcp_dump"
32#define IPL_NSS_STR "nss" 32#define IPL_NSS_STR "nss"
33 33
34#define DUMP_CCW_STR "ccw"
35#define DUMP_FCP_STR "fcp"
36#define DUMP_NONE_STR "none"
37
38/*
39 * Four shutdown trigger types are supported:
40 * - panic
41 * - halt
42 * - power off
43 * - reipl
44 */
45#define ON_PANIC_STR "on_panic"
46#define ON_HALT_STR "on_halt"
47#define ON_POFF_STR "on_poff"
48#define ON_REIPL_STR "on_reboot"
49
50struct shutdown_action;
51struct shutdown_trigger {
52 char *name;
53 struct shutdown_action *action;
54};
55
56/*
57 * Five shutdown action types are supported:
58 */
59#define SHUTDOWN_ACTION_IPL_STR "ipl"
60#define SHUTDOWN_ACTION_REIPL_STR "reipl"
61#define SHUTDOWN_ACTION_DUMP_STR "dump"
62#define SHUTDOWN_ACTION_VMCMD_STR "vmcmd"
63#define SHUTDOWN_ACTION_STOP_STR "stop"
64
65struct shutdown_action {
66 char *name;
67 void (*fn) (struct shutdown_trigger *trigger);
68 int (*init) (void);
69};
70
34static char *ipl_type_str(enum ipl_type type) 71static char *ipl_type_str(enum ipl_type type)
35{ 72{
36 switch (type) { 73 switch (type) {
@@ -54,10 +91,6 @@ enum dump_type {
54 DUMP_TYPE_FCP = 4, 91 DUMP_TYPE_FCP = 4,
55}; 92};
56 93
57#define DUMP_NONE_STR "none"
58#define DUMP_CCW_STR "ccw"
59#define DUMP_FCP_STR "fcp"
60
61static char *dump_type_str(enum dump_type type) 94static char *dump_type_str(enum dump_type type)
62{ 95{
63 switch (type) { 96 switch (type) {
@@ -99,30 +132,6 @@ enum dump_method {
99 DUMP_METHOD_FCP_DIAG, 132 DUMP_METHOD_FCP_DIAG,
100}; 133};
101 134
102enum shutdown_action {
103 SHUTDOWN_REIPL,
104 SHUTDOWN_DUMP,
105 SHUTDOWN_STOP,
106};
107
108#define SHUTDOWN_REIPL_STR "reipl"
109#define SHUTDOWN_DUMP_STR "dump"
110#define SHUTDOWN_STOP_STR "stop"
111
112static char *shutdown_action_str(enum shutdown_action action)
113{
114 switch (action) {
115 case SHUTDOWN_REIPL:
116 return SHUTDOWN_REIPL_STR;
117 case SHUTDOWN_DUMP:
118 return SHUTDOWN_DUMP_STR;
119 case SHUTDOWN_STOP:
120 return SHUTDOWN_STOP_STR;
121 default:
122 return NULL;
123 }
124}
125
126static int diag308_set_works = 0; 135static int diag308_set_works = 0;
127 136
128static int reipl_capabilities = IPL_TYPE_UNKNOWN; 137static int reipl_capabilities = IPL_TYPE_UNKNOWN;
@@ -140,8 +149,6 @@ static enum dump_method dump_method = DUMP_METHOD_NONE;
140static struct ipl_parameter_block *dump_block_fcp; 149static struct ipl_parameter_block *dump_block_fcp;
141static struct ipl_parameter_block *dump_block_ccw; 150static struct ipl_parameter_block *dump_block_ccw;
142 151
143static enum shutdown_action on_panic_action = SHUTDOWN_STOP;
144
145static struct sclp_ipl_info sclp_ipl_info; 152static struct sclp_ipl_info sclp_ipl_info;
146 153
147int diag308(unsigned long subcode, void *addr) 154int diag308(unsigned long subcode, void *addr)
@@ -205,8 +212,8 @@ static ssize_t sys_##_prefix##_##_name##_store(struct kobject *kobj, \
205 struct kobj_attribute *attr, \ 212 struct kobj_attribute *attr, \
206 const char *buf, size_t len) \ 213 const char *buf, size_t len) \
207{ \ 214{ \
208 if (sscanf(buf, _fmt_in, _value) != 1) \ 215 strncpy(_value, buf, sizeof(_value) - 1); \
209 return -EINVAL; \ 216 strstrip(_value); \
210 return len; \ 217 return len; \
211} \ 218} \
212static struct kobj_attribute sys_##_prefix##_##_name##_attr = \ 219static struct kobj_attribute sys_##_prefix##_##_name##_attr = \
@@ -245,33 +252,6 @@ static __init enum ipl_type get_ipl_type(void)
245 return IPL_TYPE_FCP; 252 return IPL_TYPE_FCP;
246} 253}
247 254
248void __init setup_ipl_info(void)
249{
250 ipl_info.type = get_ipl_type();
251 switch (ipl_info.type) {
252 case IPL_TYPE_CCW:
253 ipl_info.data.ccw.dev_id.devno = ipl_devno;
254 ipl_info.data.ccw.dev_id.ssid = 0;
255 break;
256 case IPL_TYPE_FCP:
257 case IPL_TYPE_FCP_DUMP:
258 ipl_info.data.fcp.dev_id.devno =
259 IPL_PARMBLOCK_START->ipl_info.fcp.devno;
260 ipl_info.data.fcp.dev_id.ssid = 0;
261 ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn;
262 ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun;
263 break;
264 case IPL_TYPE_NSS:
265 strncpy(ipl_info.data.nss.name, kernel_nss_name,
266 sizeof(ipl_info.data.nss.name));
267 break;
268 case IPL_TYPE_UNKNOWN:
269 default:
270 /* We have no info to copy */
271 break;
272 }
273}
274
275struct ipl_info ipl_info; 255struct ipl_info ipl_info;
276EXPORT_SYMBOL_GPL(ipl_info); 256EXPORT_SYMBOL_GPL(ipl_info);
277 257
@@ -428,8 +408,74 @@ static struct attribute_group ipl_unknown_attr_group = {
428 408
429static struct kset *ipl_kset; 409static struct kset *ipl_kset;
430 410
411static int __init ipl_register_fcp_files(void)
412{
413 int rc;
414
415 rc = sysfs_create_group(&ipl_kset->kobj, &ipl_fcp_attr_group);
416 if (rc)
417 goto out;
418 rc = sysfs_create_bin_file(&ipl_kset->kobj, &ipl_parameter_attr);
419 if (rc)
420 goto out_ipl_parm;
421 rc = sysfs_create_bin_file(&ipl_kset->kobj, &ipl_scp_data_attr);
422 if (!rc)
423 goto out;
424
425 sysfs_remove_bin_file(&ipl_kset->kobj, &ipl_parameter_attr);
426
427out_ipl_parm:
428 sysfs_remove_group(&ipl_kset->kobj, &ipl_fcp_attr_group);
429out:
430 return rc;
431}
432
433static void ipl_run(struct shutdown_trigger *trigger)
434{
435 diag308(DIAG308_IPL, NULL);
436 if (MACHINE_IS_VM)
437 __cpcmd("IPL", NULL, 0, NULL);
438 else if (ipl_info.type == IPL_TYPE_CCW)
439 reipl_ccw_dev(&ipl_info.data.ccw.dev_id);
440}
441
442static int ipl_init(void)
443{
444 int rc;
445
446 ipl_kset = kset_create_and_add("ipl", NULL, firmware_kobj);
447 if (!ipl_kset) {
448 rc = -ENOMEM;
449 goto out;
450 }
451 switch (ipl_info.type) {
452 case IPL_TYPE_CCW:
453 rc = sysfs_create_group(&ipl_kset->kobj, &ipl_ccw_attr_group);
454 break;
455 case IPL_TYPE_FCP:
456 case IPL_TYPE_FCP_DUMP:
457 rc = ipl_register_fcp_files();
458 break;
459 case IPL_TYPE_NSS:
460 rc = sysfs_create_group(&ipl_kset->kobj, &ipl_nss_attr_group);
461 break;
462 default:
463 rc = sysfs_create_group(&ipl_kset->kobj,
464 &ipl_unknown_attr_group);
465 break;
466 }
467out:
468 if (rc)
469 panic("ipl_init failed: rc = %i\n", rc);
470
471 return 0;
472}
473
474static struct shutdown_action ipl_action = {SHUTDOWN_ACTION_IPL_STR, ipl_run,
475 ipl_init};
476
431/* 477/*
432 * reipl section 478 * reipl shutdown action: Reboot Linux on shutdown.
433 */ 479 */
434 480
435/* FCP reipl device attributes */ 481/* FCP reipl device attributes */
@@ -549,7 +595,9 @@ static int reipl_set_type(enum ipl_type type)
549 595
550 switch(type) { 596 switch(type) {
551 case IPL_TYPE_CCW: 597 case IPL_TYPE_CCW:
552 if (MACHINE_IS_VM) 598 if (diag308_set_works)
599 reipl_method = REIPL_METHOD_CCW_DIAG;
600 else if (MACHINE_IS_VM)
553 reipl_method = REIPL_METHOD_CCW_VM; 601 reipl_method = REIPL_METHOD_CCW_VM;
554 else 602 else
555 reipl_method = REIPL_METHOD_CCW_CIO; 603 reipl_method = REIPL_METHOD_CCW_CIO;
@@ -600,143 +648,11 @@ static ssize_t reipl_type_store(struct kobject *kobj,
600} 648}
601 649
602static struct kobj_attribute reipl_type_attr = 650static struct kobj_attribute reipl_type_attr =
603 __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store); 651 __ATTR(reipl_type, 0644, reipl_type_show, reipl_type_store);
604 652
605static struct kset *reipl_kset; 653static struct kset *reipl_kset;
606 654
607/* 655void reipl_run(struct shutdown_trigger *trigger)
608 * dump section
609 */
610
611/* FCP dump device attributes */
612
613DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%016llx\n",
614 dump_block_fcp->ipl_info.fcp.wwpn);
615DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%016llx\n",
616 dump_block_fcp->ipl_info.fcp.lun);
617DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n",
618 dump_block_fcp->ipl_info.fcp.bootprog);
619DEFINE_IPL_ATTR_RW(dump_fcp, br_lba, "%lld\n", "%lld\n",
620 dump_block_fcp->ipl_info.fcp.br_lba);
621DEFINE_IPL_ATTR_RW(dump_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
622 dump_block_fcp->ipl_info.fcp.devno);
623
624static struct attribute *dump_fcp_attrs[] = {
625 &sys_dump_fcp_device_attr.attr,
626 &sys_dump_fcp_wwpn_attr.attr,
627 &sys_dump_fcp_lun_attr.attr,
628 &sys_dump_fcp_bootprog_attr.attr,
629 &sys_dump_fcp_br_lba_attr.attr,
630 NULL,
631};
632
633static struct attribute_group dump_fcp_attr_group = {
634 .name = IPL_FCP_STR,
635 .attrs = dump_fcp_attrs,
636};
637
638/* CCW dump device attributes */
639
640DEFINE_IPL_ATTR_RW(dump_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
641 dump_block_ccw->ipl_info.ccw.devno);
642
643static struct attribute *dump_ccw_attrs[] = {
644 &sys_dump_ccw_device_attr.attr,
645 NULL,
646};
647
648static struct attribute_group dump_ccw_attr_group = {
649 .name = IPL_CCW_STR,
650 .attrs = dump_ccw_attrs,
651};
652
653/* dump type */
654
655static int dump_set_type(enum dump_type type)
656{
657 if (!(dump_capabilities & type))
658 return -EINVAL;
659 switch(type) {
660 case DUMP_TYPE_CCW:
661 if (MACHINE_IS_VM)
662 dump_method = DUMP_METHOD_CCW_VM;
663 else if (diag308_set_works)
664 dump_method = DUMP_METHOD_CCW_DIAG;
665 else
666 dump_method = DUMP_METHOD_CCW_CIO;
667 break;
668 case DUMP_TYPE_FCP:
669 dump_method = DUMP_METHOD_FCP_DIAG;
670 break;
671 default:
672 dump_method = DUMP_METHOD_NONE;
673 }
674 dump_type = type;
675 return 0;
676}
677
678static ssize_t dump_type_show(struct kobject *kobj,
679 struct kobj_attribute *attr, char *page)
680{
681 return sprintf(page, "%s\n", dump_type_str(dump_type));
682}
683
684static ssize_t dump_type_store(struct kobject *kobj,
685 struct kobj_attribute *attr,
686 const char *buf, size_t len)
687{
688 int rc = -EINVAL;
689
690 if (strncmp(buf, DUMP_NONE_STR, strlen(DUMP_NONE_STR)) == 0)
691 rc = dump_set_type(DUMP_TYPE_NONE);
692 else if (strncmp(buf, DUMP_CCW_STR, strlen(DUMP_CCW_STR)) == 0)
693 rc = dump_set_type(DUMP_TYPE_CCW);
694 else if (strncmp(buf, DUMP_FCP_STR, strlen(DUMP_FCP_STR)) == 0)
695 rc = dump_set_type(DUMP_TYPE_FCP);
696 return (rc != 0) ? rc : len;
697}
698
699static struct kobj_attribute dump_type_attr =
700 __ATTR(dump_type, 0644, dump_type_show, dump_type_store);
701
702static struct kset *dump_kset;
703
704/*
705 * Shutdown actions section
706 */
707
708static struct kset *shutdown_actions_kset;
709
710/* on panic */
711
712static ssize_t on_panic_show(struct kobject *kobj,
713 struct kobj_attribute *attr, char *page)
714{
715 return sprintf(page, "%s\n", shutdown_action_str(on_panic_action));
716}
717
718static ssize_t on_panic_store(struct kobject *kobj,
719 struct kobj_attribute *attr,
720 const char *buf, size_t len)
721{
722 if (strncmp(buf, SHUTDOWN_REIPL_STR, strlen(SHUTDOWN_REIPL_STR)) == 0)
723 on_panic_action = SHUTDOWN_REIPL;
724 else if (strncmp(buf, SHUTDOWN_DUMP_STR,
725 strlen(SHUTDOWN_DUMP_STR)) == 0)
726 on_panic_action = SHUTDOWN_DUMP;
727 else if (strncmp(buf, SHUTDOWN_STOP_STR,
728 strlen(SHUTDOWN_STOP_STR)) == 0)
729 on_panic_action = SHUTDOWN_STOP;
730 else
731 return -EINVAL;
732
733 return len;
734}
735
736static struct kobj_attribute on_panic_attr =
737 __ATTR(on_panic, 0644, on_panic_show, on_panic_store);
738
739void do_reipl(void)
740{ 656{
741 struct ccw_dev_id devid; 657 struct ccw_dev_id devid;
742 static char buf[100]; 658 static char buf[100];
@@ -745,8 +661,6 @@ void do_reipl(void)
745 switch (reipl_method) { 661 switch (reipl_method) {
746 case REIPL_METHOD_CCW_CIO: 662 case REIPL_METHOD_CCW_CIO:
747 devid.devno = reipl_block_ccw->ipl_info.ccw.devno; 663 devid.devno = reipl_block_ccw->ipl_info.ccw.devno;
748 if (ipl_info.type == IPL_TYPE_CCW && devid.devno == ipl_devno)
749 diag308(DIAG308_IPL, NULL);
750 devid.ssid = 0; 664 devid.ssid = 0;
751 reipl_ccw_dev(&devid); 665 reipl_ccw_dev(&devid);
752 break; 666 break;
@@ -787,98 +701,6 @@ void do_reipl(void)
787 default: 701 default:
788 break; 702 break;
789 } 703 }
790 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
791}
792
793static void do_dump(void)
794{
795 struct ccw_dev_id devid;
796 static char buf[100];
797
798 switch (dump_method) {
799 case DUMP_METHOD_CCW_CIO:
800 smp_send_stop();
801 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
802 devid.ssid = 0;
803 reipl_ccw_dev(&devid);
804 break;
805 case DUMP_METHOD_CCW_VM:
806 smp_send_stop();
807 sprintf(buf, "STORE STATUS");
808 __cpcmd(buf, NULL, 0, NULL);
809 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
810 __cpcmd(buf, NULL, 0, NULL);
811 break;
812 case DUMP_METHOD_CCW_DIAG:
813 diag308(DIAG308_SET, dump_block_ccw);
814 diag308(DIAG308_DUMP, NULL);
815 break;
816 case DUMP_METHOD_FCP_DIAG:
817 diag308(DIAG308_SET, dump_block_fcp);
818 diag308(DIAG308_DUMP, NULL);
819 break;
820 case DUMP_METHOD_NONE:
821 default:
822 return;
823 }
824 printk(KERN_EMERG "Dump failed!\n");
825}
826
827/* init functions */
828
829static int __init ipl_register_fcp_files(void)
830{
831 int rc;
832
833 rc = sysfs_create_group(&ipl_kset->kobj,
834 &ipl_fcp_attr_group);
835 if (rc)
836 goto out;
837 rc = sysfs_create_bin_file(&ipl_kset->kobj,
838 &ipl_parameter_attr);
839 if (rc)
840 goto out_ipl_parm;
841 rc = sysfs_create_bin_file(&ipl_kset->kobj,
842 &ipl_scp_data_attr);
843 if (!rc)
844 goto out;
845
846 sysfs_remove_bin_file(&ipl_kset->kobj, &ipl_parameter_attr);
847
848out_ipl_parm:
849 sysfs_remove_group(&ipl_kset->kobj, &ipl_fcp_attr_group);
850out:
851 return rc;
852}
853
854static int __init ipl_init(void)
855{
856 int rc;
857
858 ipl_kset = kset_create_and_add("ipl", NULL, firmware_kobj);
859 if (!ipl_kset)
860 return -ENOMEM;
861 switch (ipl_info.type) {
862 case IPL_TYPE_CCW:
863 rc = sysfs_create_group(&ipl_kset->kobj,
864 &ipl_ccw_attr_group);
865 break;
866 case IPL_TYPE_FCP:
867 case IPL_TYPE_FCP_DUMP:
868 rc = ipl_register_fcp_files();
869 break;
870 case IPL_TYPE_NSS:
871 rc = sysfs_create_group(&ipl_kset->kobj,
872 &ipl_nss_attr_group);
873 break;
874 default:
875 rc = sysfs_create_group(&ipl_kset->kobj,
876 &ipl_unknown_attr_group);
877 break;
878 }
879 if (rc)
880 kset_unregister(ipl_kset);
881 return rc;
882} 704}
883 705
884static void __init reipl_probe(void) 706static void __init reipl_probe(void)
@@ -923,6 +745,7 @@ static int __init reipl_ccw_init(void)
923 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION; 745 reipl_block_ccw->hdr.version = IPL_PARM_BLOCK_VERSION;
924 reipl_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN; 746 reipl_block_ccw->hdr.blk0_len = IPL_PARM_BLK0_CCW_LEN;
925 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW; 747 reipl_block_ccw->hdr.pbt = DIAG308_IPL_TYPE_CCW;
748 reipl_block_ccw->hdr.flags = DIAG308_FLAGS_LP_VALID;
926 /* check if read scp info worked and set loadparm */ 749 /* check if read scp info worked and set loadparm */
927 if (sclp_ipl_info.is_valid) 750 if (sclp_ipl_info.is_valid)
928 memcpy(reipl_block_ccw->ipl_info.ccw.load_param, 751 memcpy(reipl_block_ccw->ipl_info.ccw.load_param,
@@ -931,8 +754,7 @@ static int __init reipl_ccw_init(void)
931 /* read scp info failed: set empty loadparm (EBCDIC blanks) */ 754 /* read scp info failed: set empty loadparm (EBCDIC blanks) */
932 memset(reipl_block_ccw->ipl_info.ccw.load_param, 0x40, 755 memset(reipl_block_ccw->ipl_info.ccw.load_param, 0x40,
933 LOADPARM_LEN); 756 LOADPARM_LEN);
934 /* FIXME: check for diag308_set_works when enabling diag ccw reipl */ 757 if (!MACHINE_IS_VM && !diag308_set_works)
935 if (!MACHINE_IS_VM)
936 sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO; 758 sys_reipl_ccw_loadparm_attr.attr.mode = S_IRUGO;
937 if (ipl_info.type == IPL_TYPE_CCW) 759 if (ipl_info.type == IPL_TYPE_CCW)
938 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno; 760 reipl_block_ccw->ipl_info.ccw.devno = ipl_devno;
@@ -970,7 +792,7 @@ static int __init reipl_fcp_init(void)
970 return 0; 792 return 0;
971} 793}
972 794
973static int __init reipl_init(void) 795static int reipl_init(void)
974{ 796{
975 int rc; 797 int rc;
976 798
@@ -997,6 +819,140 @@ static int __init reipl_init(void)
997 return 0; 819 return 0;
998} 820}
999 821
822static struct shutdown_action reipl_action = {SHUTDOWN_ACTION_REIPL_STR,
823 reipl_run, reipl_init};
824
825/*
826 * dump shutdown action: Dump Linux on shutdown.
827 */
828
829/* FCP dump device attributes */
830
831DEFINE_IPL_ATTR_RW(dump_fcp, wwpn, "0x%016llx\n", "%016llx\n",
832 dump_block_fcp->ipl_info.fcp.wwpn);
833DEFINE_IPL_ATTR_RW(dump_fcp, lun, "0x%016llx\n", "%016llx\n",
834 dump_block_fcp->ipl_info.fcp.lun);
835DEFINE_IPL_ATTR_RW(dump_fcp, bootprog, "%lld\n", "%lld\n",
836 dump_block_fcp->ipl_info.fcp.bootprog);
837DEFINE_IPL_ATTR_RW(dump_fcp, br_lba, "%lld\n", "%lld\n",
838 dump_block_fcp->ipl_info.fcp.br_lba);
839DEFINE_IPL_ATTR_RW(dump_fcp, device, "0.0.%04llx\n", "0.0.%llx\n",
840 dump_block_fcp->ipl_info.fcp.devno);
841
842static struct attribute *dump_fcp_attrs[] = {
843 &sys_dump_fcp_device_attr.attr,
844 &sys_dump_fcp_wwpn_attr.attr,
845 &sys_dump_fcp_lun_attr.attr,
846 &sys_dump_fcp_bootprog_attr.attr,
847 &sys_dump_fcp_br_lba_attr.attr,
848 NULL,
849};
850
851static struct attribute_group dump_fcp_attr_group = {
852 .name = IPL_FCP_STR,
853 .attrs = dump_fcp_attrs,
854};
855
856/* CCW dump device attributes */
857
858DEFINE_IPL_ATTR_RW(dump_ccw, device, "0.0.%04llx\n", "0.0.%llx\n",
859 dump_block_ccw->ipl_info.ccw.devno);
860
861static struct attribute *dump_ccw_attrs[] = {
862 &sys_dump_ccw_device_attr.attr,
863 NULL,
864};
865
866static struct attribute_group dump_ccw_attr_group = {
867 .name = IPL_CCW_STR,
868 .attrs = dump_ccw_attrs,
869};
870
871/* dump type */
872
873static int dump_set_type(enum dump_type type)
874{
875 if (!(dump_capabilities & type))
876 return -EINVAL;
877 switch (type) {
878 case DUMP_TYPE_CCW:
879 if (diag308_set_works)
880 dump_method = DUMP_METHOD_CCW_DIAG;
881 else if (MACHINE_IS_VM)
882 dump_method = DUMP_METHOD_CCW_VM;
883 else
884 dump_method = DUMP_METHOD_CCW_CIO;
885 break;
886 case DUMP_TYPE_FCP:
887 dump_method = DUMP_METHOD_FCP_DIAG;
888 break;
889 default:
890 dump_method = DUMP_METHOD_NONE;
891 }
892 dump_type = type;
893 return 0;
894}
895
896static ssize_t dump_type_show(struct kobject *kobj,
897 struct kobj_attribute *attr, char *page)
898{
899 return sprintf(page, "%s\n", dump_type_str(dump_type));
900}
901
902static ssize_t dump_type_store(struct kobject *kobj,
903 struct kobj_attribute *attr,
904 const char *buf, size_t len)
905{
906 int rc = -EINVAL;
907
908 if (strncmp(buf, DUMP_NONE_STR, strlen(DUMP_NONE_STR)) == 0)
909 rc = dump_set_type(DUMP_TYPE_NONE);
910 else if (strncmp(buf, DUMP_CCW_STR, strlen(DUMP_CCW_STR)) == 0)
911 rc = dump_set_type(DUMP_TYPE_CCW);
912 else if (strncmp(buf, DUMP_FCP_STR, strlen(DUMP_FCP_STR)) == 0)
913 rc = dump_set_type(DUMP_TYPE_FCP);
914 return (rc != 0) ? rc : len;
915}
916
917static struct kobj_attribute dump_type_attr =
918 __ATTR(dump_type, 0644, dump_type_show, dump_type_store);
919
920static struct kset *dump_kset;
921
922static void dump_run(struct shutdown_trigger *trigger)
923{
924 struct ccw_dev_id devid;
925 static char buf[100];
926
927 switch (dump_method) {
928 case DUMP_METHOD_CCW_CIO:
929 smp_send_stop();
930 devid.devno = dump_block_ccw->ipl_info.ccw.devno;
931 devid.ssid = 0;
932 reipl_ccw_dev(&devid);
933 break;
934 case DUMP_METHOD_CCW_VM:
935 smp_send_stop();
936 sprintf(buf, "STORE STATUS");
937 __cpcmd(buf, NULL, 0, NULL);
938 sprintf(buf, "IPL %X", dump_block_ccw->ipl_info.ccw.devno);
939 __cpcmd(buf, NULL, 0, NULL);
940 break;
941 case DUMP_METHOD_CCW_DIAG:
942 diag308(DIAG308_SET, dump_block_ccw);
943 diag308(DIAG308_DUMP, NULL);
944 break;
945 case DUMP_METHOD_FCP_DIAG:
946 diag308(DIAG308_SET, dump_block_fcp);
947 diag308(DIAG308_DUMP, NULL);
948 break;
949 case DUMP_METHOD_NONE:
950 default:
951 return;
952 }
953 printk(KERN_EMERG "Dump failed!\n");
954}
955
1000static int __init dump_ccw_init(void) 956static int __init dump_ccw_init(void)
1001{ 957{
1002 int rc; 958 int rc;
@@ -1042,31 +998,14 @@ static int __init dump_fcp_init(void)
1042 return 0; 998 return 0;
1043} 999}
1044 1000
1045#define SHUTDOWN_ON_PANIC_PRIO 0 1001static int dump_init(void)
1046
1047static int shutdown_on_panic_notify(struct notifier_block *self,
1048 unsigned long event, void *data)
1049{
1050 if (on_panic_action == SHUTDOWN_DUMP)
1051 do_dump();
1052 else if (on_panic_action == SHUTDOWN_REIPL)
1053 do_reipl();
1054 return NOTIFY_OK;
1055}
1056
1057static struct notifier_block shutdown_on_panic_nb = {
1058 .notifier_call = shutdown_on_panic_notify,
1059 .priority = SHUTDOWN_ON_PANIC_PRIO
1060};
1061
1062static int __init dump_init(void)
1063{ 1002{
1064 int rc; 1003 int rc;
1065 1004
1066 dump_kset = kset_create_and_add("dump", NULL, firmware_kobj); 1005 dump_kset = kset_create_and_add("dump", NULL, firmware_kobj);
1067 if (!dump_kset) 1006 if (!dump_kset)
1068 return -ENOMEM; 1007 return -ENOMEM;
1069 rc = sysfs_create_file(&dump_kset->kobj, &dump_type_attr); 1008 rc = sysfs_create_file(&dump_kset->kobj, &dump_type_attr.attr);
1070 if (rc) { 1009 if (rc) {
1071 kset_unregister(dump_kset); 1010 kset_unregister(dump_kset);
1072 return rc; 1011 return rc;
@@ -1081,47 +1020,381 @@ static int __init dump_init(void)
1081 return 0; 1020 return 0;
1082} 1021}
1083 1022
1084static int __init shutdown_actions_init(void) 1023static struct shutdown_action dump_action = {SHUTDOWN_ACTION_DUMP_STR,
1024 dump_run, dump_init};
1025
1026/*
1027 * vmcmd shutdown action: Trigger vm command on shutdown.
1028 */
1029
1030static char vmcmd_on_reboot[128];
1031static char vmcmd_on_panic[128];
1032static char vmcmd_on_halt[128];
1033static char vmcmd_on_poff[128];
1034
1035DEFINE_IPL_ATTR_STR_RW(vmcmd, on_reboot, "%s\n", "%s\n", vmcmd_on_reboot);
1036DEFINE_IPL_ATTR_STR_RW(vmcmd, on_panic, "%s\n", "%s\n", vmcmd_on_panic);
1037DEFINE_IPL_ATTR_STR_RW(vmcmd, on_halt, "%s\n", "%s\n", vmcmd_on_halt);
1038DEFINE_IPL_ATTR_STR_RW(vmcmd, on_poff, "%s\n", "%s\n", vmcmd_on_poff);
1039
1040static struct attribute *vmcmd_attrs[] = {
1041 &sys_vmcmd_on_reboot_attr.attr,
1042 &sys_vmcmd_on_panic_attr.attr,
1043 &sys_vmcmd_on_halt_attr.attr,
1044 &sys_vmcmd_on_poff_attr.attr,
1045 NULL,
1046};
1047
1048static struct attribute_group vmcmd_attr_group = {
1049 .attrs = vmcmd_attrs,
1050};
1051
1052static struct kset *vmcmd_kset;
1053
1054static void vmcmd_run(struct shutdown_trigger *trigger)
1055{
1056 char *cmd, *next_cmd;
1057
1058 if (strcmp(trigger->name, ON_REIPL_STR) == 0)
1059 cmd = vmcmd_on_reboot;
1060 else if (strcmp(trigger->name, ON_PANIC_STR) == 0)
1061 cmd = vmcmd_on_panic;
1062 else if (strcmp(trigger->name, ON_HALT_STR) == 0)
1063 cmd = vmcmd_on_halt;
1064 else if (strcmp(trigger->name, ON_POFF_STR) == 0)
1065 cmd = vmcmd_on_poff;
1066 else
1067 return;
1068
1069 if (strlen(cmd) == 0)
1070 return;
1071 do {
1072 next_cmd = strchr(cmd, '\n');
1073 if (next_cmd) {
1074 next_cmd[0] = 0;
1075 next_cmd += 1;
1076 }
1077 __cpcmd(cmd, NULL, 0, NULL);
1078 cmd = next_cmd;
1079 } while (cmd != NULL);
1080}
1081
1082static int vmcmd_init(void)
1085{ 1083{
1086 int rc; 1084 if (!MACHINE_IS_VM)
1085 return -ENOTSUPP;
1086 vmcmd_kset = kset_create_and_add("vmcmd", NULL, firmware_kobj);
1087 if (!vmcmd_kset)
1088 return -ENOMEM;
1089 return sysfs_create_group(&vmcmd_kset->kobj, &vmcmd_attr_group);
1090}
1091
1092static struct shutdown_action vmcmd_action = {SHUTDOWN_ACTION_VMCMD_STR,
1093 vmcmd_run, vmcmd_init};
1094
1095/*
1096 * stop shutdown action: Stop Linux on shutdown.
1097 */
1098
1099static void stop_run(struct shutdown_trigger *trigger)
1100{
1101 if (strcmp(trigger->name, ON_PANIC_STR) == 0)
1102 disabled_wait((unsigned long) __builtin_return_address(0));
1103 else {
1104 signal_processor(smp_processor_id(), sigp_stop);
1105 for (;;);
1106 }
1107}
1108
1109static struct shutdown_action stop_action = {SHUTDOWN_ACTION_STOP_STR,
1110 stop_run, NULL};
1111
1112/* action list */
1113
1114static struct shutdown_action *shutdown_actions_list[] = {
1115 &ipl_action, &reipl_action, &dump_action, &vmcmd_action, &stop_action};
1116#define SHUTDOWN_ACTIONS_COUNT (sizeof(shutdown_actions_list) / sizeof(void *))
1117
1118/*
1119 * Trigger section
1120 */
1121
1122static struct kset *shutdown_actions_kset;
1123
1124static int set_trigger(const char *buf, struct shutdown_trigger *trigger,
1125 size_t len)
1126{
1127 int i;
1128 for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) {
1129 if (!shutdown_actions_list[i])
1130 continue;
1131 if (strncmp(buf, shutdown_actions_list[i]->name,
1132 strlen(shutdown_actions_list[i]->name)) == 0) {
1133 trigger->action = shutdown_actions_list[i];
1134 return len;
1135 }
1136 }
1137 return -EINVAL;
1138}
1139
1140/* on reipl */
1141
1142static struct shutdown_trigger on_reboot_trigger = {ON_REIPL_STR,
1143 &reipl_action};
1144
1145static ssize_t on_reboot_show(struct kobject *kobj,
1146 struct kobj_attribute *attr, char *page)
1147{
1148 return sprintf(page, "%s\n", on_reboot_trigger.action->name);
1149}
1150
1151static ssize_t on_reboot_store(struct kobject *kobj,
1152 struct kobj_attribute *attr,
1153 const char *buf, size_t len)
1154{
1155 return set_trigger(buf, &on_reboot_trigger, len);
1156}
1157
1158static struct kobj_attribute on_reboot_attr =
1159 __ATTR(on_reboot, 0644, on_reboot_show, on_reboot_store);
1160
1161static void do_machine_restart(char *__unused)
1162{
1163 smp_send_stop();
1164 on_reboot_trigger.action->fn(&on_reboot_trigger);
1165 reipl_run(NULL);
1166}
1167void (*_machine_restart)(char *command) = do_machine_restart;
1168
1169/* on panic */
1170
1171static struct shutdown_trigger on_panic_trigger = {ON_PANIC_STR, &stop_action};
1172
1173static ssize_t on_panic_show(struct kobject *kobj,
1174 struct kobj_attribute *attr, char *page)
1175{
1176 return sprintf(page, "%s\n", on_panic_trigger.action->name);
1177}
1087 1178
1179static ssize_t on_panic_store(struct kobject *kobj,
1180 struct kobj_attribute *attr,
1181 const char *buf, size_t len)
1182{
1183 return set_trigger(buf, &on_panic_trigger, len);
1184}
1185
1186static struct kobj_attribute on_panic_attr =
1187 __ATTR(on_panic, 0644, on_panic_show, on_panic_store);
1188
1189static void do_panic(void)
1190{
1191 on_panic_trigger.action->fn(&on_panic_trigger);
1192 stop_run(&on_panic_trigger);
1193}
1194
1195/* on halt */
1196
1197static struct shutdown_trigger on_halt_trigger = {ON_HALT_STR, &stop_action};
1198
1199static ssize_t on_halt_show(struct kobject *kobj,
1200 struct kobj_attribute *attr, char *page)
1201{
1202 return sprintf(page, "%s\n", on_halt_trigger.action->name);
1203}
1204
1205static ssize_t on_halt_store(struct kobject *kobj,
1206 struct kobj_attribute *attr,
1207 const char *buf, size_t len)
1208{
1209 return set_trigger(buf, &on_halt_trigger, len);
1210}
1211
1212static struct kobj_attribute on_halt_attr =
1213 __ATTR(on_halt, 0644, on_halt_show, on_halt_store);
1214
1215
1216static void do_machine_halt(void)
1217{
1218 smp_send_stop();
1219 on_halt_trigger.action->fn(&on_halt_trigger);
1220 stop_run(&on_halt_trigger);
1221}
1222void (*_machine_halt)(void) = do_machine_halt;
1223
1224/* on power off */
1225
1226static struct shutdown_trigger on_poff_trigger = {ON_POFF_STR, &stop_action};
1227
1228static ssize_t on_poff_show(struct kobject *kobj,
1229 struct kobj_attribute *attr, char *page)
1230{
1231 return sprintf(page, "%s\n", on_poff_trigger.action->name);
1232}
1233
1234static ssize_t on_poff_store(struct kobject *kobj,
1235 struct kobj_attribute *attr,
1236 const char *buf, size_t len)
1237{
1238 return set_trigger(buf, &on_poff_trigger, len);
1239}
1240
1241static struct kobj_attribute on_poff_attr =
1242 __ATTR(on_poff, 0644, on_poff_show, on_poff_store);
1243
1244
1245static void do_machine_power_off(void)
1246{
1247 smp_send_stop();
1248 on_poff_trigger.action->fn(&on_poff_trigger);
1249 stop_run(&on_poff_trigger);
1250}
1251void (*_machine_power_off)(void) = do_machine_power_off;
1252
1253static void __init shutdown_triggers_init(void)
1254{
1088 shutdown_actions_kset = kset_create_and_add("shutdown_actions", NULL, 1255 shutdown_actions_kset = kset_create_and_add("shutdown_actions", NULL,
1089 firmware_kobj); 1256 firmware_kobj);
1090 if (!shutdown_actions_kset) 1257 if (!shutdown_actions_kset)
1091 return -ENOMEM; 1258 goto fail;
1092 rc = sysfs_create_file(&shutdown_actions_kset->kobj, &on_panic_attr); 1259 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1093 if (rc) { 1260 &on_reboot_attr.attr))
1094 kset_unregister(shutdown_actions_kset); 1261 goto fail;
1095 return rc; 1262 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1263 &on_panic_attr.attr))
1264 goto fail;
1265 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1266 &on_halt_attr.attr))
1267 goto fail;
1268 if (sysfs_create_file(&shutdown_actions_kset->kobj,
1269 &on_poff_attr.attr))
1270 goto fail;
1271
1272 return;
1273fail:
1274 panic("shutdown_triggers_init failed\n");
1275}
1276
1277static void __init shutdown_actions_init(void)
1278{
1279 int i;
1280
1281 for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) {
1282 if (!shutdown_actions_list[i]->init)
1283 continue;
1284 if (shutdown_actions_list[i]->init())
1285 shutdown_actions_list[i] = NULL;
1096 } 1286 }
1097 atomic_notifier_chain_register(&panic_notifier_list,
1098 &shutdown_on_panic_nb);
1099 return 0;
1100} 1287}
1101 1288
1102static int __init s390_ipl_init(void) 1289static int __init s390_ipl_init(void)
1103{ 1290{
1104 int rc;
1105
1106 sclp_get_ipl_info(&sclp_ipl_info);
1107 reipl_probe(); 1291 reipl_probe();
1108 rc = ipl_init(); 1292 sclp_get_ipl_info(&sclp_ipl_info);
1109 if (rc) 1293 shutdown_actions_init();
1110 return rc; 1294 shutdown_triggers_init();
1111 rc = reipl_init();
1112 if (rc)
1113 return rc;
1114 rc = dump_init();
1115 if (rc)
1116 return rc;
1117 rc = shutdown_actions_init();
1118 if (rc)
1119 return rc;
1120 return 0; 1295 return 0;
1121} 1296}
1122 1297
1123__initcall(s390_ipl_init); 1298__initcall(s390_ipl_init);
1124 1299
1300static void __init strncpy_skip_quote(char *dst, char *src, int n)
1301{
1302 int sx, dx;
1303
1304 dx = 0;
1305 for (sx = 0; src[sx] != 0; sx++) {
1306 if (src[sx] == '"')
1307 continue;
1308 dst[dx++] = src[sx];
1309 if (dx >= n)
1310 break;
1311 }
1312}
1313
1314static int __init vmcmd_on_reboot_setup(char *str)
1315{
1316 if (!MACHINE_IS_VM)
1317 return 1;
1318 strncpy_skip_quote(vmcmd_on_reboot, str, 127);
1319 vmcmd_on_reboot[127] = 0;
1320 on_reboot_trigger.action = &vmcmd_action;
1321 return 1;
1322}
1323__setup("vmreboot=", vmcmd_on_reboot_setup);
1324
1325static int __init vmcmd_on_panic_setup(char *str)
1326{
1327 if (!MACHINE_IS_VM)
1328 return 1;
1329 strncpy_skip_quote(vmcmd_on_panic, str, 127);
1330 vmcmd_on_panic[127] = 0;
1331 on_panic_trigger.action = &vmcmd_action;
1332 return 1;
1333}
1334__setup("vmpanic=", vmcmd_on_panic_setup);
1335
1336static int __init vmcmd_on_halt_setup(char *str)
1337{
1338 if (!MACHINE_IS_VM)
1339 return 1;
1340 strncpy_skip_quote(vmcmd_on_halt, str, 127);
1341 vmcmd_on_halt[127] = 0;
1342 on_halt_trigger.action = &vmcmd_action;
1343 return 1;
1344}
1345__setup("vmhalt=", vmcmd_on_halt_setup);
1346
1347static int __init vmcmd_on_poff_setup(char *str)
1348{
1349 if (!MACHINE_IS_VM)
1350 return 1;
1351 strncpy_skip_quote(vmcmd_on_poff, str, 127);
1352 vmcmd_on_poff[127] = 0;
1353 on_poff_trigger.action = &vmcmd_action;
1354 return 1;
1355}
1356__setup("vmpoff=", vmcmd_on_poff_setup);
1357
1358static int on_panic_notify(struct notifier_block *self,
1359 unsigned long event, void *data)
1360{
1361 do_panic();
1362 return NOTIFY_OK;
1363}
1364
1365static struct notifier_block on_panic_nb = {
1366 .notifier_call = on_panic_notify,
1367 .priority = 0,
1368};
1369
1370void __init setup_ipl(void)
1371{
1372 ipl_info.type = get_ipl_type();
1373 switch (ipl_info.type) {
1374 case IPL_TYPE_CCW:
1375 ipl_info.data.ccw.dev_id.devno = ipl_devno;
1376 ipl_info.data.ccw.dev_id.ssid = 0;
1377 break;
1378 case IPL_TYPE_FCP:
1379 case IPL_TYPE_FCP_DUMP:
1380 ipl_info.data.fcp.dev_id.devno =
1381 IPL_PARMBLOCK_START->ipl_info.fcp.devno;
1382 ipl_info.data.fcp.dev_id.ssid = 0;
1383 ipl_info.data.fcp.wwpn = IPL_PARMBLOCK_START->ipl_info.fcp.wwpn;
1384 ipl_info.data.fcp.lun = IPL_PARMBLOCK_START->ipl_info.fcp.lun;
1385 break;
1386 case IPL_TYPE_NSS:
1387 strncpy(ipl_info.data.nss.name, kernel_nss_name,
1388 sizeof(ipl_info.data.nss.name));
1389 break;
1390 case IPL_TYPE_UNKNOWN:
1391 default:
1392 /* We have no info to copy */
1393 break;
1394 }
1395 atomic_notifier_chain_register(&panic_notifier_list, &on_panic_nb);
1396}
1397
1125void __init ipl_save_parameters(void) 1398void __init ipl_save_parameters(void)
1126{ 1399{
1127 struct cio_iplinfo iplinfo; 1400 struct cio_iplinfo iplinfo;
@@ -1202,3 +1475,4 @@ void s390_reset_system(void)
1202 1475
1203 do_reset_calls(); 1476 do_reset_calls();
1204} 1477}
1478
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 29f7884b4ffa..0e7aca039307 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -36,7 +36,7 @@
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/notifier.h> 38#include <linux/notifier.h>
39 39#include <linux/utsname.h>
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/pgtable.h> 41#include <asm/pgtable.h>
42#include <asm/system.h> 42#include <asm/system.h>
@@ -182,13 +182,15 @@ void cpu_idle(void)
182 182
183void show_regs(struct pt_regs *regs) 183void show_regs(struct pt_regs *regs)
184{ 184{
185 struct task_struct *tsk = current; 185 print_modules();
186 186 printk("CPU: %d %s %s %.*s\n",
187 printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted()); 187 task_thread_info(current)->cpu, print_tainted(),
188 printk("Process %s (pid: %d, task: %p, ksp: %p)\n", 188 init_utsname()->release,
189 current->comm, task_pid_nr(current), (void *) tsk, 189 (int)strcspn(init_utsname()->version, " "),
190 (void *) tsk->thread.ksp); 190 init_utsname()->version);
191 191 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
192 current->comm, current->pid, current,
193 (void *) current->thread.ksp);
192 show_registers(regs); 194 show_registers(regs);
193 /* Show stack backtrace if pt_regs is from kernel mode */ 195 /* Show stack backtrace if pt_regs is from kernel mode */
194 if (!(regs->psw.mask & PSW_MASK_PSTATE)) 196 if (!(regs->psw.mask & PSW_MASK_PSTATE))
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 1d81bf9488ae..6e036bae9875 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -86,13 +86,13 @@ FixPerRegisters(struct task_struct *task)
86 per_info->control_regs.bits.storage_alt_space_ctl = 0; 86 per_info->control_regs.bits.storage_alt_space_ctl = 0;
87} 87}
88 88
89static void set_single_step(struct task_struct *task) 89void user_enable_single_step(struct task_struct *task)
90{ 90{
91 task->thread.per_info.single_step = 1; 91 task->thread.per_info.single_step = 1;
92 FixPerRegisters(task); 92 FixPerRegisters(task);
93} 93}
94 94
95static void clear_single_step(struct task_struct *task) 95void user_disable_single_step(struct task_struct *task)
96{ 96{
97 task->thread.per_info.single_step = 0; 97 task->thread.per_info.single_step = 0;
98 FixPerRegisters(task); 98 FixPerRegisters(task);
@@ -107,7 +107,7 @@ void
107ptrace_disable(struct task_struct *child) 107ptrace_disable(struct task_struct *child)
108{ 108{
109 /* make sure the single step bit is not set. */ 109 /* make sure the single step bit is not set. */
110 clear_single_step(child); 110 user_disable_single_step(child);
111} 111}
112 112
113#ifndef CONFIG_64BIT 113#ifndef CONFIG_64BIT
@@ -651,7 +651,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
651 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 651 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
652 child->exit_code = data; 652 child->exit_code = data;
653 /* make sure the single step bit is not set. */ 653 /* make sure the single step bit is not set. */
654 clear_single_step(child); 654 user_disable_single_step(child);
655 wake_up_process(child); 655 wake_up_process(child);
656 return 0; 656 return 0;
657 657
@@ -665,7 +665,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
665 return 0; 665 return 0;
666 child->exit_code = SIGKILL; 666 child->exit_code = SIGKILL;
667 /* make sure the single step bit is not set. */ 667 /* make sure the single step bit is not set. */
668 clear_single_step(child); 668 user_disable_single_step(child);
669 wake_up_process(child); 669 wake_up_process(child);
670 return 0; 670 return 0;
671 671
@@ -675,10 +675,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
675 return -EIO; 675 return -EIO;
676 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 676 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
677 child->exit_code = data; 677 child->exit_code = data;
678 if (data) 678 user_enable_single_step(child);
679 set_tsk_thread_flag(child, TIF_SINGLE_STEP);
680 else
681 set_single_step(child);
682 /* give it a chance to run. */ 679 /* give it a chance to run. */
683 wake_up_process(child); 680 wake_up_process(child);
684 return 0; 681 return 0;
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 577aa7dd660e..766c783bd7a7 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -126,75 +126,6 @@ void __cpuinit cpu_init(void)
126} 126}
127 127
128/* 128/*
129 * VM halt and poweroff setup routines
130 */
131char vmhalt_cmd[128] = "";
132char vmpoff_cmd[128] = "";
133static char vmpanic_cmd[128] = "";
134
135static void strncpy_skip_quote(char *dst, char *src, int n)
136{
137 int sx, dx;
138
139 dx = 0;
140 for (sx = 0; src[sx] != 0; sx++) {
141 if (src[sx] == '"') continue;
142 dst[dx++] = src[sx];
143 if (dx >= n) break;
144 }
145}
146
147static int __init vmhalt_setup(char *str)
148{
149 strncpy_skip_quote(vmhalt_cmd, str, 127);
150 vmhalt_cmd[127] = 0;
151 return 1;
152}
153
154__setup("vmhalt=", vmhalt_setup);
155
156static int __init vmpoff_setup(char *str)
157{
158 strncpy_skip_quote(vmpoff_cmd, str, 127);
159 vmpoff_cmd[127] = 0;
160 return 1;
161}
162
163__setup("vmpoff=", vmpoff_setup);
164
165static int vmpanic_notify(struct notifier_block *self, unsigned long event,
166 void *data)
167{
168 if (MACHINE_IS_VM && strlen(vmpanic_cmd) > 0)
169 cpcmd(vmpanic_cmd, NULL, 0, NULL);
170
171 return NOTIFY_OK;
172}
173
174#define PANIC_PRI_VMPANIC 0
175
176static struct notifier_block vmpanic_nb = {
177 .notifier_call = vmpanic_notify,
178 .priority = PANIC_PRI_VMPANIC
179};
180
181static int __init vmpanic_setup(char *str)
182{
183 static int register_done __initdata = 0;
184
185 strncpy_skip_quote(vmpanic_cmd, str, 127);
186 vmpanic_cmd[127] = 0;
187 if (!register_done) {
188 register_done = 1;
189 atomic_notifier_chain_register(&panic_notifier_list,
190 &vmpanic_nb);
191 }
192 return 1;
193}
194
195__setup("vmpanic=", vmpanic_setup);
196
197/*
198 * condev= and conmode= setup parameter. 129 * condev= and conmode= setup parameter.
199 */ 130 */
200 131
@@ -308,38 +239,6 @@ static void __init setup_zfcpdump(unsigned int console_devno)
308static inline void setup_zfcpdump(unsigned int console_devno) {} 239static inline void setup_zfcpdump(unsigned int console_devno) {}
309#endif /* CONFIG_ZFCPDUMP */ 240#endif /* CONFIG_ZFCPDUMP */
310 241
311#ifdef CONFIG_SMP
312void (*_machine_restart)(char *command) = machine_restart_smp;
313void (*_machine_halt)(void) = machine_halt_smp;
314void (*_machine_power_off)(void) = machine_power_off_smp;
315#else
316/*
317 * Reboot, halt and power_off routines for non SMP.
318 */
319static void do_machine_restart_nonsmp(char * __unused)
320{
321 do_reipl();
322}
323
324static void do_machine_halt_nonsmp(void)
325{
326 if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
327 __cpcmd(vmhalt_cmd, NULL, 0, NULL);
328 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
329}
330
331static void do_machine_power_off_nonsmp(void)
332{
333 if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
334 __cpcmd(vmpoff_cmd, NULL, 0, NULL);
335 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
336}
337
338void (*_machine_restart)(char *command) = do_machine_restart_nonsmp;
339void (*_machine_halt)(void) = do_machine_halt_nonsmp;
340void (*_machine_power_off)(void) = do_machine_power_off_nonsmp;
341#endif
342
343 /* 242 /*
344 * Reboot, halt and power_off stubs. They just call _machine_restart, 243 * Reboot, halt and power_off stubs. They just call _machine_restart,
345 * _machine_halt or _machine_power_off. 244 * _machine_halt or _machine_power_off.
@@ -559,7 +458,9 @@ setup_resources(void)
559 data_resource.start = (unsigned long) &_etext; 458 data_resource.start = (unsigned long) &_etext;
560 data_resource.end = (unsigned long) &_edata - 1; 459 data_resource.end = (unsigned long) &_edata - 1;
561 460
562 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 461 for (i = 0; i < MEMORY_CHUNKS; i++) {
462 if (!memory_chunk[i].size)
463 continue;
563 res = alloc_bootmem_low(sizeof(struct resource)); 464 res = alloc_bootmem_low(sizeof(struct resource));
564 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM; 465 res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
565 switch (memory_chunk[i].type) { 466 switch (memory_chunk[i].type) {
@@ -617,7 +518,7 @@ EXPORT_SYMBOL_GPL(real_memory_size);
617static void __init setup_memory_end(void) 518static void __init setup_memory_end(void)
618{ 519{
619 unsigned long memory_size; 520 unsigned long memory_size;
620 unsigned long max_mem, max_phys; 521 unsigned long max_mem;
621 int i; 522 int i;
622 523
623#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) 524#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE)
@@ -625,10 +526,31 @@ static void __init setup_memory_end(void)
625 memory_end = ZFCPDUMP_HSA_SIZE; 526 memory_end = ZFCPDUMP_HSA_SIZE;
626#endif 527#endif
627 memory_size = 0; 528 memory_size = 0;
628 max_phys = VMALLOC_END_INIT - VMALLOC_MIN_SIZE;
629 memory_end &= PAGE_MASK; 529 memory_end &= PAGE_MASK;
630 530
631 max_mem = memory_end ? min(max_phys, memory_end) : max_phys; 531 max_mem = memory_end ? min(VMALLOC_START, memory_end) : VMALLOC_START;
532 memory_end = min(max_mem, memory_end);
533
534 /*
535 * Make sure all chunks are MAX_ORDER aligned so we don't need the
536 * extra checks that HOLES_IN_ZONE would require.
537 */
538 for (i = 0; i < MEMORY_CHUNKS; i++) {
539 unsigned long start, end;
540 struct mem_chunk *chunk;
541 unsigned long align;
542
543 chunk = &memory_chunk[i];
544 align = 1UL << (MAX_ORDER + PAGE_SHIFT - 1);
545 start = (chunk->addr + align - 1) & ~(align - 1);
546 end = (chunk->addr + chunk->size) & ~(align - 1);
547 if (start >= end)
548 memset(chunk, 0, sizeof(*chunk));
549 else {
550 chunk->addr = start;
551 chunk->size = end - start;
552 }
553 }
632 554
633 for (i = 0; i < MEMORY_CHUNKS; i++) { 555 for (i = 0; i < MEMORY_CHUNKS; i++) {
634 struct mem_chunk *chunk = &memory_chunk[i]; 556 struct mem_chunk *chunk = &memory_chunk[i];
@@ -890,7 +812,7 @@ setup_arch(char **cmdline_p)
890 812
891 parse_early_param(); 813 parse_early_param();
892 814
893 setup_ipl_info(); 815 setup_ipl();
894 setup_memory_end(); 816 setup_memory_end();
895 setup_addressing_mode(); 817 setup_addressing_mode();
896 setup_memory(); 818 setup_memory();
@@ -899,7 +821,6 @@ setup_arch(char **cmdline_p)
899 821
900 cpu_init(); 822 cpu_init();
901 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr; 823 __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
902 smp_setup_cpu_possible_map();
903 824
904 /* 825 /*
905 * Setup capabilities (ELF_HWCAP & ELF_PLATFORM). 826 * Setup capabilities (ELF_HWCAP & ELF_PLATFORM).
@@ -920,7 +841,7 @@ setup_arch(char **cmdline_p)
920 841
921void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo) 842void __cpuinit print_cpu_info(struct cpuinfo_S390 *cpuinfo)
922{ 843{
923 printk("cpu %d " 844 printk(KERN_INFO "cpu %d "
924#ifdef CONFIG_SMP 845#ifdef CONFIG_SMP
925 "phys_idx=%d " 846 "phys_idx=%d "
926#endif 847#endif
@@ -996,7 +917,7 @@ static void *c_next(struct seq_file *m, void *v, loff_t *pos)
996static void c_stop(struct seq_file *m, void *v) 917static void c_stop(struct seq_file *m, void *v)
997{ 918{
998} 919}
999struct seq_operations cpuinfo_op = { 920const struct seq_operations cpuinfo_op = {
1000 .start = c_start, 921 .start = c_start,
1001 .next = c_next, 922 .next = c_next,
1002 .stop = c_stop, 923 .stop = c_stop,
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index d264671c1b71..4449bf32cbf1 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -471,6 +471,7 @@ void do_signal(struct pt_regs *regs)
471 471
472 if (signr > 0) { 472 if (signr > 0) {
473 /* Whee! Actually deliver the signal. */ 473 /* Whee! Actually deliver the signal. */
474 int ret;
474#ifdef CONFIG_COMPAT 475#ifdef CONFIG_COMPAT
475 if (test_thread_flag(TIF_31BIT)) { 476 if (test_thread_flag(TIF_31BIT)) {
476 extern int handle_signal32(unsigned long sig, 477 extern int handle_signal32(unsigned long sig,
@@ -478,15 +479,12 @@ void do_signal(struct pt_regs *regs)
478 siginfo_t *info, 479 siginfo_t *info,
479 sigset_t *oldset, 480 sigset_t *oldset,
480 struct pt_regs *regs); 481 struct pt_regs *regs);
481 if (handle_signal32( 482 ret = handle_signal32(signr, &ka, &info, oldset, regs);
482 signr, &ka, &info, oldset, regs) == 0) {
483 if (test_thread_flag(TIF_RESTORE_SIGMASK))
484 clear_thread_flag(TIF_RESTORE_SIGMASK);
485 }
486 return;
487 } 483 }
484 else
488#endif 485#endif
489 if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { 486 ret = handle_signal(signr, &ka, &info, oldset, regs);
487 if (!ret) {
490 /* 488 /*
491 * A signal was successfully delivered; the saved 489 * A signal was successfully delivered; the saved
492 * sigmask will have been stored in the signal frame, 490 * sigmask will have been stored in the signal frame,
@@ -495,6 +493,14 @@ void do_signal(struct pt_regs *regs)
495 */ 493 */
496 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 494 if (test_thread_flag(TIF_RESTORE_SIGMASK))
497 clear_thread_flag(TIF_RESTORE_SIGMASK); 495 clear_thread_flag(TIF_RESTORE_SIGMASK);
496
497 /*
498 * If we would have taken a single-step trap
499 * for a normal instruction, act like we took
500 * one for the handler setup.
501 */
502 if (current->thread.per_info.single_step)
503 set_thread_flag(TIF_SINGLE_STEP);
498 } 504 }
499 return; 505 return;
500 } 506 }
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 264ea906db4c..aa37fa154512 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -42,6 +42,7 @@
42#include <asm/tlbflush.h> 42#include <asm/tlbflush.h>
43#include <asm/timer.h> 43#include <asm/timer.h>
44#include <asm/lowcore.h> 44#include <asm/lowcore.h>
45#include <asm/sclp.h>
45#include <asm/cpu.h> 46#include <asm/cpu.h>
46 47
47/* 48/*
@@ -53,11 +54,27 @@ EXPORT_SYMBOL(lowcore_ptr);
53cpumask_t cpu_online_map = CPU_MASK_NONE; 54cpumask_t cpu_online_map = CPU_MASK_NONE;
54EXPORT_SYMBOL(cpu_online_map); 55EXPORT_SYMBOL(cpu_online_map);
55 56
56cpumask_t cpu_possible_map = CPU_MASK_NONE; 57cpumask_t cpu_possible_map = CPU_MASK_ALL;
57EXPORT_SYMBOL(cpu_possible_map); 58EXPORT_SYMBOL(cpu_possible_map);
58 59
59static struct task_struct *current_set[NR_CPUS]; 60static struct task_struct *current_set[NR_CPUS];
60 61
62static u8 smp_cpu_type;
63static int smp_use_sigp_detection;
64
65enum s390_cpu_state {
66 CPU_STATE_STANDBY,
67 CPU_STATE_CONFIGURED,
68};
69
70#ifdef CONFIG_HOTPLUG_CPU
71static DEFINE_MUTEX(smp_cpu_state_mutex);
72#endif
73static int smp_cpu_state[NR_CPUS];
74
75static DEFINE_PER_CPU(struct cpu, cpu_devices);
76DEFINE_PER_CPU(struct s390_idle_data, s390_idle);
77
61static void smp_ext_bitcall(int, ec_bit_sig); 78static void smp_ext_bitcall(int, ec_bit_sig);
62 79
63/* 80/*
@@ -193,6 +210,33 @@ int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
193} 210}
194EXPORT_SYMBOL(smp_call_function_single); 211EXPORT_SYMBOL(smp_call_function_single);
195 212
213/**
214 * smp_call_function_mask(): Run a function on a set of other CPUs.
215 * @mask: The set of cpus to run on. Must not include the current cpu.
216 * @func: The function to run. This must be fast and non-blocking.
217 * @info: An arbitrary pointer to pass to the function.
218 * @wait: If true, wait (atomically) until function has completed on other CPUs.
219 *
220 * Returns 0 on success, else a negative status code.
221 *
222 * If @wait is true, then returns once @func has returned; otherwise
223 * it returns just before the target cpu calls @func.
224 *
225 * You must not call this function with disabled interrupts or from a
226 * hardware interrupt handler or from a bottom half handler.
227 */
228int
229smp_call_function_mask(cpumask_t mask,
230 void (*func)(void *), void *info,
231 int wait)
232{
233 preempt_disable();
234 __smp_call_function_map(func, info, 0, wait, mask);
235 preempt_enable();
236 return 0;
237}
238EXPORT_SYMBOL(smp_call_function_mask);
239
196void smp_send_stop(void) 240void smp_send_stop(void)
197{ 241{
198 int cpu, rc; 242 int cpu, rc;
@@ -217,33 +261,6 @@ void smp_send_stop(void)
217} 261}
218 262
219/* 263/*
220 * Reboot, halt and power_off routines for SMP.
221 */
222void machine_restart_smp(char *__unused)
223{
224 smp_send_stop();
225 do_reipl();
226}
227
228void machine_halt_smp(void)
229{
230 smp_send_stop();
231 if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
232 __cpcmd(vmhalt_cmd, NULL, 0, NULL);
233 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
234 for (;;);
235}
236
237void machine_power_off_smp(void)
238{
239 smp_send_stop();
240 if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
241 __cpcmd(vmpoff_cmd, NULL, 0, NULL);
242 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
243 for (;;);
244}
245
246/*
247 * This is the main routine where commands issued by other 264 * This is the main routine where commands issued by other
248 * cpus are handled. 265 * cpus are handled.
249 */ 266 */
@@ -355,6 +372,13 @@ void smp_ctl_clear_bit(int cr, int bit)
355} 372}
356EXPORT_SYMBOL(smp_ctl_clear_bit); 373EXPORT_SYMBOL(smp_ctl_clear_bit);
357 374
375/*
376 * In early ipl state a temp. logically cpu number is needed, so the sigp
377 * functions can be used to sense other cpus. Since NR_CPUS is >= 2 on
378 * CONFIG_SMP and the ipl cpu is logical cpu 0, it must be 1.
379 */
380#define CPU_INIT_NO 1
381
358#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE) 382#if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE)
359 383
360/* 384/*
@@ -375,9 +399,10 @@ static void __init smp_get_save_area(unsigned int cpu, unsigned int phy_cpu)
375 "kernel was compiled with NR_CPUS=%i\n", cpu, NR_CPUS); 399 "kernel was compiled with NR_CPUS=%i\n", cpu, NR_CPUS);
376 return; 400 return;
377 } 401 }
378 zfcpdump_save_areas[cpu] = alloc_bootmem(sizeof(union save_area)); 402 zfcpdump_save_areas[cpu] = kmalloc(sizeof(union save_area), GFP_KERNEL);
379 __cpu_logical_map[1] = (__u16) phy_cpu; 403 __cpu_logical_map[CPU_INIT_NO] = (__u16) phy_cpu;
380 while (signal_processor(1, sigp_stop_and_store_status) == sigp_busy) 404 while (signal_processor(CPU_INIT_NO, sigp_stop_and_store_status) ==
405 sigp_busy)
381 cpu_relax(); 406 cpu_relax();
382 memcpy(zfcpdump_save_areas[cpu], 407 memcpy(zfcpdump_save_areas[cpu],
383 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE, 408 (void *)(unsigned long) store_prefix() + SAVE_AREA_BASE,
@@ -397,32 +422,155 @@ static inline void smp_get_save_area(unsigned int cpu, unsigned int phy_cpu) { }
397 422
398#endif /* CONFIG_ZFCPDUMP || CONFIG_ZFCPDUMP_MODULE */ 423#endif /* CONFIG_ZFCPDUMP || CONFIG_ZFCPDUMP_MODULE */
399 424
400/* 425static int cpu_stopped(int cpu)
401 * Lets check how many CPUs we have.
402 */
403static unsigned int __init smp_count_cpus(void)
404{ 426{
405 unsigned int cpu, num_cpus; 427 __u32 status;
406 __u16 boot_cpu_addr;
407 428
408 /* 429 /* Check for stopped state */
409 * cpu 0 is the boot cpu. See smp_prepare_boot_cpu. 430 if (signal_processor_ps(&status, 0, cpu, sigp_sense) ==
410 */ 431 sigp_status_stored) {
432 if (status & 0x40)
433 return 1;
434 }
435 return 0;
436}
437
438static int cpu_known(int cpu_id)
439{
440 int cpu;
441
442 for_each_present_cpu(cpu) {
443 if (__cpu_logical_map[cpu] == cpu_id)
444 return 1;
445 }
446 return 0;
447}
448
449static int smp_rescan_cpus_sigp(cpumask_t avail)
450{
451 int cpu_id, logical_cpu;
452
453 logical_cpu = first_cpu(avail);
454 if (logical_cpu == NR_CPUS)
455 return 0;
456 for (cpu_id = 0; cpu_id <= 65535; cpu_id++) {
457 if (cpu_known(cpu_id))
458 continue;
459 __cpu_logical_map[logical_cpu] = cpu_id;
460 if (!cpu_stopped(logical_cpu))
461 continue;
462 cpu_set(logical_cpu, cpu_present_map);
463 smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
464 logical_cpu = next_cpu(logical_cpu, avail);
465 if (logical_cpu == NR_CPUS)
466 break;
467 }
468 return 0;
469}
470
471static int smp_rescan_cpus_sclp(cpumask_t avail)
472{
473 struct sclp_cpu_info *info;
474 int cpu_id, logical_cpu, cpu;
475 int rc;
476
477 logical_cpu = first_cpu(avail);
478 if (logical_cpu == NR_CPUS)
479 return 0;
480 info = kmalloc(sizeof(*info), GFP_KERNEL);
481 if (!info)
482 return -ENOMEM;
483 rc = sclp_get_cpu_info(info);
484 if (rc)
485 goto out;
486 for (cpu = 0; cpu < info->combined; cpu++) {
487 if (info->has_cpu_type && info->cpu[cpu].type != smp_cpu_type)
488 continue;
489 cpu_id = info->cpu[cpu].address;
490 if (cpu_known(cpu_id))
491 continue;
492 __cpu_logical_map[logical_cpu] = cpu_id;
493 cpu_set(logical_cpu, cpu_present_map);
494 if (cpu >= info->configured)
495 smp_cpu_state[logical_cpu] = CPU_STATE_STANDBY;
496 else
497 smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
498 logical_cpu = next_cpu(logical_cpu, avail);
499 if (logical_cpu == NR_CPUS)
500 break;
501 }
502out:
503 kfree(info);
504 return rc;
505}
506
507static int smp_rescan_cpus(void)
508{
509 cpumask_t avail;
510
511 cpus_xor(avail, cpu_possible_map, cpu_present_map);
512 if (smp_use_sigp_detection)
513 return smp_rescan_cpus_sigp(avail);
514 else
515 return smp_rescan_cpus_sclp(avail);
516}
517
518static void __init smp_detect_cpus(void)
519{
520 unsigned int cpu, c_cpus, s_cpus;
521 struct sclp_cpu_info *info;
522 u16 boot_cpu_addr, cpu_addr;
523
524 c_cpus = 1;
525 s_cpus = 0;
411 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr; 526 boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
412 current_thread_info()->cpu = 0; 527 info = kmalloc(sizeof(*info), GFP_KERNEL);
413 num_cpus = 1; 528 if (!info)
414 for (cpu = 0; cpu <= 65535; cpu++) { 529 panic("smp_detect_cpus failed to allocate memory\n");
415 if ((__u16) cpu == boot_cpu_addr) 530 /* Use sigp detection algorithm if sclp doesn't work. */
531 if (sclp_get_cpu_info(info)) {
532 smp_use_sigp_detection = 1;
533 for (cpu = 0; cpu <= 65535; cpu++) {
534 if (cpu == boot_cpu_addr)
535 continue;
536 __cpu_logical_map[CPU_INIT_NO] = cpu;
537 if (!cpu_stopped(CPU_INIT_NO))
538 continue;
539 smp_get_save_area(c_cpus, cpu);
540 c_cpus++;
541 }
542 goto out;
543 }
544
545 if (info->has_cpu_type) {
546 for (cpu = 0; cpu < info->combined; cpu++) {
547 if (info->cpu[cpu].address == boot_cpu_addr) {
548 smp_cpu_type = info->cpu[cpu].type;
549 break;
550 }
551 }
552 }
553
554 for (cpu = 0; cpu < info->combined; cpu++) {
555 if (info->has_cpu_type && info->cpu[cpu].type != smp_cpu_type)
556 continue;
557 cpu_addr = info->cpu[cpu].address;
558 if (cpu_addr == boot_cpu_addr)
416 continue; 559 continue;
417 __cpu_logical_map[1] = (__u16) cpu; 560 __cpu_logical_map[CPU_INIT_NO] = cpu_addr;
418 if (signal_processor(1, sigp_sense) == sigp_not_operational) 561 if (!cpu_stopped(CPU_INIT_NO)) {
562 s_cpus++;
419 continue; 563 continue;
420 smp_get_save_area(num_cpus, cpu); 564 }
421 num_cpus++; 565 smp_get_save_area(c_cpus, cpu_addr);
566 c_cpus++;
422 } 567 }
423 printk("Detected %d CPU's\n", (int) num_cpus); 568out:
424 printk("Boot cpu address %2X\n", boot_cpu_addr); 569 kfree(info);
425 return num_cpus; 570 printk(KERN_INFO "CPUs: %d configured, %d standby\n", c_cpus, s_cpus);
571 get_online_cpus();
572 smp_rescan_cpus();
573 put_online_cpus();
426} 574}
427 575
428/* 576/*
@@ -453,8 +601,6 @@ int __cpuinit start_secondary(void *cpuvoid)
453 return 0; 601 return 0;
454} 602}
455 603
456DEFINE_PER_CPU(struct s390_idle_data, s390_idle);
457
458static void __init smp_create_idle(unsigned int cpu) 604static void __init smp_create_idle(unsigned int cpu)
459{ 605{
460 struct task_struct *p; 606 struct task_struct *p;
@@ -470,37 +616,82 @@ static void __init smp_create_idle(unsigned int cpu)
470 spin_lock_init(&(&per_cpu(s390_idle, cpu))->lock); 616 spin_lock_init(&(&per_cpu(s390_idle, cpu))->lock);
471} 617}
472 618
473static int cpu_stopped(int cpu) 619static int __cpuinit smp_alloc_lowcore(int cpu)
474{ 620{
475 __u32 status; 621 unsigned long async_stack, panic_stack;
622 struct _lowcore *lowcore;
623 int lc_order;
624
625 lc_order = sizeof(long) == 8 ? 1 : 0;
626 lowcore = (void *) __get_free_pages(GFP_KERNEL | GFP_DMA, lc_order);
627 if (!lowcore)
628 return -ENOMEM;
629 async_stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
630 if (!async_stack)
631 goto out_async_stack;
632 panic_stack = __get_free_page(GFP_KERNEL);
633 if (!panic_stack)
634 goto out_panic_stack;
635
636 *lowcore = S390_lowcore;
637 lowcore->async_stack = async_stack + ASYNC_SIZE;
638 lowcore->panic_stack = panic_stack + PAGE_SIZE;
476 639
477 /* Check for stopped state */ 640#ifndef CONFIG_64BIT
478 if (signal_processor_ps(&status, 0, cpu, sigp_sense) == 641 if (MACHINE_HAS_IEEE) {
479 sigp_status_stored) { 642 unsigned long save_area;
480 if (status & 0x40) 643
481 return 1; 644 save_area = get_zeroed_page(GFP_KERNEL);
645 if (!save_area)
646 goto out_save_area;
647 lowcore->extended_save_area_addr = (u32) save_area;
482 } 648 }
649#endif
650 lowcore_ptr[cpu] = lowcore;
483 return 0; 651 return 0;
652
653#ifndef CONFIG_64BIT
654out_save_area:
655 free_page(panic_stack);
656#endif
657out_panic_stack:
658 free_pages(async_stack, ASYNC_ORDER);
659out_async_stack:
660 free_pages((unsigned long) lowcore, lc_order);
661 return -ENOMEM;
484} 662}
485 663
486/* Upping and downing of CPUs */ 664#ifdef CONFIG_HOTPLUG_CPU
665static void smp_free_lowcore(int cpu)
666{
667 struct _lowcore *lowcore;
668 int lc_order;
669
670 lc_order = sizeof(long) == 8 ? 1 : 0;
671 lowcore = lowcore_ptr[cpu];
672#ifndef CONFIG_64BIT
673 if (MACHINE_HAS_IEEE)
674 free_page((unsigned long) lowcore->extended_save_area_addr);
675#endif
676 free_page(lowcore->panic_stack - PAGE_SIZE);
677 free_pages(lowcore->async_stack - ASYNC_SIZE, ASYNC_ORDER);
678 free_pages((unsigned long) lowcore, lc_order);
679 lowcore_ptr[cpu] = NULL;
680}
681#endif /* CONFIG_HOTPLUG_CPU */
487 682
488int __cpu_up(unsigned int cpu) 683/* Upping and downing of CPUs */
684int __cpuinit __cpu_up(unsigned int cpu)
489{ 685{
490 struct task_struct *idle; 686 struct task_struct *idle;
491 struct _lowcore *cpu_lowcore; 687 struct _lowcore *cpu_lowcore;
492 struct stack_frame *sf; 688 struct stack_frame *sf;
493 sigp_ccode ccode; 689 sigp_ccode ccode;
494 int curr_cpu;
495 690
496 for (curr_cpu = 0; curr_cpu <= 65535; curr_cpu++) { 691 if (smp_cpu_state[cpu] != CPU_STATE_CONFIGURED)
497 __cpu_logical_map[cpu] = (__u16) curr_cpu; 692 return -EIO;
498 if (cpu_stopped(cpu)) 693 if (smp_alloc_lowcore(cpu))
499 break; 694 return -ENOMEM;
500 }
501
502 if (!cpu_stopped(cpu))
503 return -ENODEV;
504 695
505 ccode = signal_processor_p((__u32)(unsigned long)(lowcore_ptr[cpu]), 696 ccode = signal_processor_p((__u32)(unsigned long)(lowcore_ptr[cpu]),
506 cpu, sigp_set_prefix); 697 cpu, sigp_set_prefix);
@@ -515,6 +706,7 @@ int __cpu_up(unsigned int cpu)
515 cpu_lowcore = lowcore_ptr[cpu]; 706 cpu_lowcore = lowcore_ptr[cpu];
516 cpu_lowcore->kernel_stack = (unsigned long) 707 cpu_lowcore->kernel_stack = (unsigned long)
517 task_stack_page(idle) + THREAD_SIZE; 708 task_stack_page(idle) + THREAD_SIZE;
709 cpu_lowcore->thread_info = (unsigned long) task_thread_info(idle);
518 sf = (struct stack_frame *) (cpu_lowcore->kernel_stack 710 sf = (struct stack_frame *) (cpu_lowcore->kernel_stack
519 - sizeof(struct pt_regs) 711 - sizeof(struct pt_regs)
520 - sizeof(struct stack_frame)); 712 - sizeof(struct stack_frame));
@@ -528,6 +720,8 @@ int __cpu_up(unsigned int cpu)
528 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu]; 720 cpu_lowcore->percpu_offset = __per_cpu_offset[cpu];
529 cpu_lowcore->current_task = (unsigned long) idle; 721 cpu_lowcore->current_task = (unsigned long) idle;
530 cpu_lowcore->cpu_data.cpu_nr = cpu; 722 cpu_lowcore->cpu_data.cpu_nr = cpu;
723 cpu_lowcore->softirq_pending = 0;
724 cpu_lowcore->ext_call_fast = 0;
531 eieio(); 725 eieio();
532 726
533 while (signal_processor(cpu, sigp_restart) == sigp_busy) 727 while (signal_processor(cpu, sigp_restart) == sigp_busy)
@@ -538,44 +732,20 @@ int __cpu_up(unsigned int cpu)
538 return 0; 732 return 0;
539} 733}
540 734
541static unsigned int __initdata additional_cpus; 735static int __init setup_possible_cpus(char *s)
542static unsigned int __initdata possible_cpus;
543
544void __init smp_setup_cpu_possible_map(void)
545{ 736{
546 unsigned int phy_cpus, pos_cpus, cpu; 737 int pcpus, cpu;
547
548 phy_cpus = smp_count_cpus();
549 pos_cpus = min(phy_cpus + additional_cpus, (unsigned int) NR_CPUS);
550
551 if (possible_cpus)
552 pos_cpus = min(possible_cpus, (unsigned int) NR_CPUS);
553 738
554 for (cpu = 0; cpu < pos_cpus; cpu++) 739 pcpus = simple_strtoul(s, NULL, 0);
740 cpu_possible_map = cpumask_of_cpu(0);
741 for (cpu = 1; cpu < pcpus && cpu < NR_CPUS; cpu++)
555 cpu_set(cpu, cpu_possible_map); 742 cpu_set(cpu, cpu_possible_map);
556
557 phy_cpus = min(phy_cpus, pos_cpus);
558
559 for (cpu = 0; cpu < phy_cpus; cpu++)
560 cpu_set(cpu, cpu_present_map);
561}
562
563#ifdef CONFIG_HOTPLUG_CPU
564
565static int __init setup_additional_cpus(char *s)
566{
567 additional_cpus = simple_strtoul(s, NULL, 0);
568 return 0;
569}
570early_param("additional_cpus", setup_additional_cpus);
571
572static int __init setup_possible_cpus(char *s)
573{
574 possible_cpus = simple_strtoul(s, NULL, 0);
575 return 0; 743 return 0;
576} 744}
577early_param("possible_cpus", setup_possible_cpus); 745early_param("possible_cpus", setup_possible_cpus);
578 746
747#ifdef CONFIG_HOTPLUG_CPU
748
579int __cpu_disable(void) 749int __cpu_disable(void)
580{ 750{
581 struct ec_creg_mask_parms cr_parms; 751 struct ec_creg_mask_parms cr_parms;
@@ -612,7 +782,8 @@ void __cpu_die(unsigned int cpu)
612 /* Wait until target cpu is down */ 782 /* Wait until target cpu is down */
613 while (!smp_cpu_not_running(cpu)) 783 while (!smp_cpu_not_running(cpu))
614 cpu_relax(); 784 cpu_relax();
615 printk("Processor %d spun down\n", cpu); 785 smp_free_lowcore(cpu);
786 printk(KERN_INFO "Processor %d spun down\n", cpu);
616} 787}
617 788
618void cpu_die(void) 789void cpu_die(void)
@@ -625,49 +796,19 @@ void cpu_die(void)
625 796
626#endif /* CONFIG_HOTPLUG_CPU */ 797#endif /* CONFIG_HOTPLUG_CPU */
627 798
628/*
629 * Cycle through the processors and setup structures.
630 */
631
632void __init smp_prepare_cpus(unsigned int max_cpus) 799void __init smp_prepare_cpus(unsigned int max_cpus)
633{ 800{
634 unsigned long stack;
635 unsigned int cpu; 801 unsigned int cpu;
636 int i; 802
803 smp_detect_cpus();
637 804
638 /* request the 0x1201 emergency signal external interrupt */ 805 /* request the 0x1201 emergency signal external interrupt */
639 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0) 806 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
640 panic("Couldn't request external interrupt 0x1201"); 807 panic("Couldn't request external interrupt 0x1201");
641 memset(lowcore_ptr, 0, sizeof(lowcore_ptr)); 808 memset(lowcore_ptr, 0, sizeof(lowcore_ptr));
642 /*
643 * Initialize prefix pages and stacks for all possible cpus
644 */
645 print_cpu_info(&S390_lowcore.cpu_data); 809 print_cpu_info(&S390_lowcore.cpu_data);
810 smp_alloc_lowcore(smp_processor_id());
646 811
647 for_each_possible_cpu(i) {
648 lowcore_ptr[i] = (struct _lowcore *)
649 __get_free_pages(GFP_KERNEL | GFP_DMA,
650 sizeof(void*) == 8 ? 1 : 0);
651 stack = __get_free_pages(GFP_KERNEL, ASYNC_ORDER);
652 if (!lowcore_ptr[i] || !stack)
653 panic("smp_boot_cpus failed to allocate memory\n");
654
655 *(lowcore_ptr[i]) = S390_lowcore;
656 lowcore_ptr[i]->async_stack = stack + ASYNC_SIZE;
657 stack = __get_free_pages(GFP_KERNEL, 0);
658 if (!stack)
659 panic("smp_boot_cpus failed to allocate memory\n");
660 lowcore_ptr[i]->panic_stack = stack + PAGE_SIZE;
661#ifndef CONFIG_64BIT
662 if (MACHINE_HAS_IEEE) {
663 lowcore_ptr[i]->extended_save_area_addr =
664 (__u32) __get_free_pages(GFP_KERNEL, 0);
665 if (!lowcore_ptr[i]->extended_save_area_addr)
666 panic("smp_boot_cpus failed to "
667 "allocate memory\n");
668 }
669#endif
670 }
671#ifndef CONFIG_64BIT 812#ifndef CONFIG_64BIT
672 if (MACHINE_HAS_IEEE) 813 if (MACHINE_HAS_IEEE)
673 ctl_set_bit(14, 29); /* enable extended save area */ 814 ctl_set_bit(14, 29); /* enable extended save area */
@@ -683,15 +824,17 @@ void __init smp_prepare_boot_cpu(void)
683{ 824{
684 BUG_ON(smp_processor_id() != 0); 825 BUG_ON(smp_processor_id() != 0);
685 826
827 current_thread_info()->cpu = 0;
828 cpu_set(0, cpu_present_map);
686 cpu_set(0, cpu_online_map); 829 cpu_set(0, cpu_online_map);
687 S390_lowcore.percpu_offset = __per_cpu_offset[0]; 830 S390_lowcore.percpu_offset = __per_cpu_offset[0];
688 current_set[0] = current; 831 current_set[0] = current;
832 smp_cpu_state[0] = CPU_STATE_CONFIGURED;
689 spin_lock_init(&(&__get_cpu_var(s390_idle))->lock); 833 spin_lock_init(&(&__get_cpu_var(s390_idle))->lock);
690} 834}
691 835
692void __init smp_cpus_done(unsigned int max_cpus) 836void __init smp_cpus_done(unsigned int max_cpus)
693{ 837{
694 cpu_present_map = cpu_possible_map;
695} 838}
696 839
697/* 840/*
@@ -705,7 +848,79 @@ int setup_profiling_timer(unsigned int multiplier)
705 return 0; 848 return 0;
706} 849}
707 850
708static DEFINE_PER_CPU(struct cpu, cpu_devices); 851#ifdef CONFIG_HOTPLUG_CPU
852static ssize_t cpu_configure_show(struct sys_device *dev, char *buf)
853{
854 ssize_t count;
855
856 mutex_lock(&smp_cpu_state_mutex);
857 count = sprintf(buf, "%d\n", smp_cpu_state[dev->id]);
858 mutex_unlock(&smp_cpu_state_mutex);
859 return count;
860}
861
862static ssize_t cpu_configure_store(struct sys_device *dev, const char *buf,
863 size_t count)
864{
865 int cpu = dev->id;
866 int val, rc;
867 char delim;
868
869 if (sscanf(buf, "%d %c", &val, &delim) != 1)
870 return -EINVAL;
871 if (val != 0 && val != 1)
872 return -EINVAL;
873
874 mutex_lock(&smp_cpu_state_mutex);
875 get_online_cpus();
876 rc = -EBUSY;
877 if (cpu_online(cpu))
878 goto out;
879 rc = 0;
880 switch (val) {
881 case 0:
882 if (smp_cpu_state[cpu] == CPU_STATE_CONFIGURED) {
883 rc = sclp_cpu_deconfigure(__cpu_logical_map[cpu]);
884 if (!rc)
885 smp_cpu_state[cpu] = CPU_STATE_STANDBY;
886 }
887 break;
888 case 1:
889 if (smp_cpu_state[cpu] == CPU_STATE_STANDBY) {
890 rc = sclp_cpu_configure(__cpu_logical_map[cpu]);
891 if (!rc)
892 smp_cpu_state[cpu] = CPU_STATE_CONFIGURED;
893 }
894 break;
895 default:
896 break;
897 }
898out:
899 put_online_cpus();
900 mutex_unlock(&smp_cpu_state_mutex);
901 return rc ? rc : count;
902}
903static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store);
904#endif /* CONFIG_HOTPLUG_CPU */
905
906static ssize_t show_cpu_address(struct sys_device *dev, char *buf)
907{
908 return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]);
909}
910static SYSDEV_ATTR(address, 0444, show_cpu_address, NULL);
911
912
913static struct attribute *cpu_common_attrs[] = {
914#ifdef CONFIG_HOTPLUG_CPU
915 &attr_configure.attr,
916#endif
917 &attr_address.attr,
918 NULL,
919};
920
921static struct attribute_group cpu_common_attr_group = {
922 .attrs = cpu_common_attrs,
923};
709 924
710static ssize_t show_capability(struct sys_device *dev, char *buf) 925static ssize_t show_capability(struct sys_device *dev, char *buf)
711{ 926{
@@ -750,15 +965,15 @@ static ssize_t show_idle_time(struct sys_device *dev, char *buf)
750} 965}
751static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); 966static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL);
752 967
753static struct attribute *cpu_attrs[] = { 968static struct attribute *cpu_online_attrs[] = {
754 &attr_capability.attr, 969 &attr_capability.attr,
755 &attr_idle_count.attr, 970 &attr_idle_count.attr,
756 &attr_idle_time_us.attr, 971 &attr_idle_time_us.attr,
757 NULL, 972 NULL,
758}; 973};
759 974
760static struct attribute_group cpu_attr_group = { 975static struct attribute_group cpu_online_attr_group = {
761 .attrs = cpu_attrs, 976 .attrs = cpu_online_attrs,
762}; 977};
763 978
764static int __cpuinit smp_cpu_notify(struct notifier_block *self, 979static int __cpuinit smp_cpu_notify(struct notifier_block *self,
@@ -778,12 +993,12 @@ static int __cpuinit smp_cpu_notify(struct notifier_block *self,
778 idle->idle_time = 0; 993 idle->idle_time = 0;
779 idle->idle_count = 0; 994 idle->idle_count = 0;
780 spin_unlock_irq(&idle->lock); 995 spin_unlock_irq(&idle->lock);
781 if (sysfs_create_group(&s->kobj, &cpu_attr_group)) 996 if (sysfs_create_group(&s->kobj, &cpu_online_attr_group))
782 return NOTIFY_BAD; 997 return NOTIFY_BAD;
783 break; 998 break;
784 case CPU_DEAD: 999 case CPU_DEAD:
785 case CPU_DEAD_FROZEN: 1000 case CPU_DEAD_FROZEN:
786 sysfs_remove_group(&s->kobj, &cpu_attr_group); 1001 sysfs_remove_group(&s->kobj, &cpu_online_attr_group);
787 break; 1002 break;
788 } 1003 }
789 return NOTIFY_OK; 1004 return NOTIFY_OK;
@@ -793,6 +1008,62 @@ static struct notifier_block __cpuinitdata smp_cpu_nb = {
793 .notifier_call = smp_cpu_notify, 1008 .notifier_call = smp_cpu_notify,
794}; 1009};
795 1010
1011static int smp_add_present_cpu(int cpu)
1012{
1013 struct cpu *c = &per_cpu(cpu_devices, cpu);
1014 struct sys_device *s = &c->sysdev;
1015 int rc;
1016
1017 c->hotpluggable = 1;
1018 rc = register_cpu(c, cpu);
1019 if (rc)
1020 goto out;
1021 rc = sysfs_create_group(&s->kobj, &cpu_common_attr_group);
1022 if (rc)
1023 goto out_cpu;
1024 if (!cpu_online(cpu))
1025 goto out;
1026 rc = sysfs_create_group(&s->kobj, &cpu_online_attr_group);
1027 if (!rc)
1028 return 0;
1029 sysfs_remove_group(&s->kobj, &cpu_common_attr_group);
1030out_cpu:
1031#ifdef CONFIG_HOTPLUG_CPU
1032 unregister_cpu(c);
1033#endif
1034out:
1035 return rc;
1036}
1037
1038#ifdef CONFIG_HOTPLUG_CPU
1039static ssize_t rescan_store(struct sys_device *dev, const char *buf,
1040 size_t count)
1041{
1042 cpumask_t newcpus;
1043 int cpu;
1044 int rc;
1045
1046 mutex_lock(&smp_cpu_state_mutex);
1047 get_online_cpus();
1048 newcpus = cpu_present_map;
1049 rc = smp_rescan_cpus();
1050 if (rc)
1051 goto out;
1052 cpus_andnot(newcpus, cpu_present_map, newcpus);
1053 for_each_cpu_mask(cpu, newcpus) {
1054 rc = smp_add_present_cpu(cpu);
1055 if (rc)
1056 cpu_clear(cpu, cpu_present_map);
1057 }
1058 rc = 0;
1059out:
1060 put_online_cpus();
1061 mutex_unlock(&smp_cpu_state_mutex);
1062 return rc ? rc : count;
1063}
1064static SYSDEV_ATTR(rescan, 0200, NULL, rescan_store);
1065#endif /* CONFIG_HOTPLUG_CPU */
1066
796static int __init topology_init(void) 1067static int __init topology_init(void)
797{ 1068{
798 int cpu; 1069 int cpu;
@@ -800,16 +1071,14 @@ static int __init topology_init(void)
800 1071
801 register_cpu_notifier(&smp_cpu_nb); 1072 register_cpu_notifier(&smp_cpu_nb);
802 1073
803 for_each_possible_cpu(cpu) { 1074#ifdef CONFIG_HOTPLUG_CPU
804 struct cpu *c = &per_cpu(cpu_devices, cpu); 1075 rc = sysfs_create_file(&cpu_sysdev_class.kset.kobj,
805 struct sys_device *s = &c->sysdev; 1076 &attr_rescan.attr);
806 1077 if (rc)
807 c->hotpluggable = 1; 1078 return rc;
808 register_cpu(c, cpu); 1079#endif
809 if (!cpu_online(cpu)) 1080 for_each_present_cpu(cpu) {
810 continue; 1081 rc = smp_add_present_cpu(cpu);
811 s = &c->sysdev;
812 rc = sysfs_create_group(&s->kobj, &cpu_attr_group);
813 if (rc) 1082 if (rc)
814 return rc; 1083 return rc;
815 } 1084 }
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 8ed16a83fba7..52b8342c6bf2 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -31,6 +31,7 @@
31#include <linux/reboot.h> 31#include <linux/reboot.h>
32#include <linux/kprobes.h> 32#include <linux/kprobes.h>
33#include <linux/bug.h> 33#include <linux/bug.h>
34#include <linux/utsname.h>
34#include <asm/system.h> 35#include <asm/system.h>
35#include <asm/uaccess.h> 36#include <asm/uaccess.h>
36#include <asm/io.h> 37#include <asm/io.h>
@@ -168,9 +169,16 @@ void show_stack(struct task_struct *task, unsigned long *sp)
168 */ 169 */
169void dump_stack(void) 170void dump_stack(void)
170{ 171{
172 printk("CPU: %d %s %s %.*s\n",
173 task_thread_info(current)->cpu, print_tainted(),
174 init_utsname()->release,
175 (int)strcspn(init_utsname()->version, " "),
176 init_utsname()->version);
177 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
178 current->comm, current->pid, current,
179 (void *) current->thread.ksp);
171 show_stack(NULL, NULL); 180 show_stack(NULL, NULL);
172} 181}
173
174EXPORT_SYMBOL(dump_stack); 182EXPORT_SYMBOL(dump_stack);
175 183
176static inline int mask_bits(struct pt_regs *regs, unsigned long bits) 184static inline int mask_bits(struct pt_regs *regs, unsigned long bits)
@@ -258,8 +266,14 @@ void die(const char * str, struct pt_regs * regs, long err)
258 console_verbose(); 266 console_verbose();
259 spin_lock_irq(&die_lock); 267 spin_lock_irq(&die_lock);
260 bust_spinlocks(1); 268 bust_spinlocks(1);
261 printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 269 printk("%s: %04lx [#%d] ", str, err & 0xffff, ++die_counter);
262 print_modules(); 270#ifdef CONFIG_PREEMPT
271 printk("PREEMPT ");
272#endif
273#ifdef CONFIG_SMP
274 printk("SMP");
275#endif
276 printk("\n");
263 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); 277 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
264 show_regs(regs); 278 show_regs(regs);
265 bust_spinlocks(0); 279 bust_spinlocks(0);
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 849120e3e28a..936159199346 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -17,6 +17,12 @@ ENTRY(_start)
17jiffies = jiffies_64; 17jiffies = jiffies_64;
18#endif 18#endif
19 19
20PHDRS {
21 text PT_LOAD FLAGS(5); /* R_E */
22 data PT_LOAD FLAGS(7); /* RWE */
23 note PT_NOTE FLAGS(0); /* ___ */
24}
25
20SECTIONS 26SECTIONS
21{ 27{
22 . = 0x00000000; 28 . = 0x00000000;
@@ -33,6 +39,9 @@ SECTIONS
33 39
34 _etext = .; /* End of text section */ 40 _etext = .; /* End of text section */
35 41
42 NOTES :text :note
43 BUG_TABLE :text
44
36 RODATA 45 RODATA
37 46
38#ifdef CONFIG_SHARED_KERNEL 47#ifdef CONFIG_SHARED_KERNEL
@@ -49,9 +58,6 @@ SECTIONS
49 __stop___ex_table = .; 58 __stop___ex_table = .;
50 } 59 }
51 60
52 NOTES
53 BUG_TABLE
54
55 .data : { /* Data */ 61 .data : { /* Data */
56 DATA_DATA 62 DATA_DATA
57 CONSTRUCTORS 63 CONSTRUCTORS
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 8d76403fcf89..e41f4008afc5 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -39,7 +39,7 @@ static inline void _raw_yield_cpu(int cpu)
39 _raw_yield(); 39 _raw_yield();
40} 40}
41 41
42void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc) 42void _raw_spin_lock_wait(raw_spinlock_t *lp)
43{ 43{
44 int count = spin_retry; 44 int count = spin_retry;
45 unsigned int cpu = ~smp_processor_id(); 45 unsigned int cpu = ~smp_processor_id();
@@ -53,15 +53,36 @@ void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc)
53 } 53 }
54 if (__raw_spin_is_locked(lp)) 54 if (__raw_spin_is_locked(lp))
55 continue; 55 continue;
56 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) { 56 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
57 lp->owner_pc = pc;
58 return; 57 return;
59 }
60 } 58 }
61} 59}
62EXPORT_SYMBOL(_raw_spin_lock_wait); 60EXPORT_SYMBOL(_raw_spin_lock_wait);
63 61
64int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc) 62void _raw_spin_lock_wait_flags(raw_spinlock_t *lp, unsigned long flags)
63{
64 int count = spin_retry;
65 unsigned int cpu = ~smp_processor_id();
66
67 local_irq_restore(flags);
68 while (1) {
69 if (count-- <= 0) {
70 unsigned int owner = lp->owner_cpu;
71 if (owner != 0)
72 _raw_yield_cpu(~owner);
73 count = spin_retry;
74 }
75 if (__raw_spin_is_locked(lp))
76 continue;
77 local_irq_disable();
78 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
79 return;
80 local_irq_restore(flags);
81 }
82}
83EXPORT_SYMBOL(_raw_spin_lock_wait_flags);
84
85int _raw_spin_trylock_retry(raw_spinlock_t *lp)
65{ 86{
66 unsigned int cpu = ~smp_processor_id(); 87 unsigned int cpu = ~smp_processor_id();
67 int count; 88 int count;
@@ -69,10 +90,8 @@ int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
69 for (count = spin_retry; count > 0; count--) { 90 for (count = spin_retry; count > 0; count--) {
70 if (__raw_spin_is_locked(lp)) 91 if (__raw_spin_is_locked(lp))
71 continue; 92 continue;
72 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) { 93 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
73 lp->owner_pc = pc;
74 return 1; 94 return 1;
75 }
76 } 95 }
77 return 0; 96 return 0;
78} 97}
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 394980b05e6f..880b0ebf894b 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -83,7 +83,7 @@ struct dcss_segment {
83}; 83};
84 84
85static DEFINE_MUTEX(dcss_lock); 85static DEFINE_MUTEX(dcss_lock);
86static struct list_head dcss_list = LIST_HEAD_INIT(dcss_list); 86static LIST_HEAD(dcss_list);
87static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC", 87static char *segtype_string[] = { "SW", "EW", "SR", "ER", "SN", "EN", "SC",
88 "EW/EN-MIXED" }; 88 "EW/EN-MIXED" };
89 89
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index fb9c5a85aa56..79d13a166a3d 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -15,10 +15,6 @@
15#include <asm/setup.h> 15#include <asm/setup.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17 17
18unsigned long vmalloc_end;
19EXPORT_SYMBOL(vmalloc_end);
20
21static struct page *vmem_map;
22static DEFINE_MUTEX(vmem_mutex); 18static DEFINE_MUTEX(vmem_mutex);
23 19
24struct memory_segment { 20struct memory_segment {
@@ -188,8 +184,8 @@ static int vmem_add_mem_map(unsigned long start, unsigned long size)
188 pte_t pte; 184 pte_t pte;
189 int ret = -ENOMEM; 185 int ret = -ENOMEM;
190 186
191 map_start = vmem_map + PFN_DOWN(start); 187 map_start = VMEM_MAP + PFN_DOWN(start);
192 map_end = vmem_map + PFN_DOWN(start + size); 188 map_end = VMEM_MAP + PFN_DOWN(start + size);
193 189
194 start_addr = (unsigned long) map_start & PAGE_MASK; 190 start_addr = (unsigned long) map_start & PAGE_MASK;
195 end_addr = PFN_ALIGN((unsigned long) map_end); 191 end_addr = PFN_ALIGN((unsigned long) map_end);
@@ -240,10 +236,10 @@ static int vmem_add_mem(unsigned long start, unsigned long size)
240{ 236{
241 int ret; 237 int ret;
242 238
243 ret = vmem_add_range(start, size); 239 ret = vmem_add_mem_map(start, size);
244 if (ret) 240 if (ret)
245 return ret; 241 return ret;
246 return vmem_add_mem_map(start, size); 242 return vmem_add_range(start, size);
247} 243}
248 244
249/* 245/*
@@ -254,7 +250,7 @@ static int insert_memory_segment(struct memory_segment *seg)
254{ 250{
255 struct memory_segment *tmp; 251 struct memory_segment *tmp;
256 252
257 if (PFN_DOWN(seg->start + seg->size) > max_pfn || 253 if (seg->start + seg->size >= VMALLOC_START ||
258 seg->start + seg->size < seg->start) 254 seg->start + seg->size < seg->start)
259 return -ERANGE; 255 return -ERANGE;
260 256
@@ -357,17 +353,15 @@ out:
357 353
358/* 354/*
359 * map whole physical memory to virtual memory (identity mapping) 355 * map whole physical memory to virtual memory (identity mapping)
356 * we reserve enough space in the vmalloc area for vmemmap to hotplug
357 * additional memory segments.
360 */ 358 */
361void __init vmem_map_init(void) 359void __init vmem_map_init(void)
362{ 360{
363 unsigned long map_size;
364 int i; 361 int i;
365 362
366 map_size = ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * sizeof(struct page); 363 BUILD_BUG_ON((unsigned long)VMEM_MAP + VMEM_MAP_SIZE > VMEM_MAP_MAX);
367 vmalloc_end = PFN_ALIGN(VMALLOC_END_INIT) - PFN_ALIGN(map_size); 364 NODE_DATA(0)->node_mem_map = VMEM_MAP;
368 vmem_map = (struct page *) vmalloc_end;
369 NODE_DATA(0)->node_mem_map = vmem_map;
370
371 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) 365 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++)
372 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size); 366 vmem_add_mem(memory_chunk[i].addr, memory_chunk[i].size);
373} 367}
@@ -382,7 +376,7 @@ static int __init vmem_convert_memory_chunk(void)
382 int i; 376 int i;
383 377
384 mutex_lock(&vmem_mutex); 378 mutex_lock(&vmem_mutex);
385 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 379 for (i = 0; i < MEMORY_CHUNKS; i++) {
386 if (!memory_chunk[i].size) 380 if (!memory_chunk[i].size)
387 continue; 381 continue;
388 seg = kzalloc(sizeof(*seg), GFP_KERNEL); 382 seg = kzalloc(sizeof(*seg), GFP_KERNEL);