aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/arm/arm-boards12
-rw-r--r--Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt31
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt2
-rw-r--r--Documentation/devicetree/bindings/timer/brcm,bcm2835-system-timer.txt2
-rw-r--r--arch/arm/Kconfig43
-rw-r--r--arch/arm/Makefile9
-rw-r--r--arch/arm/boot/compressed/decompress.c3
-rw-r--r--arch/arm/boot/dts/Makefile11
-rw-r--r--arch/arm/boot/dts/integrator.dtsi76
-rw-r--r--arch/arm/boot/dts/integratorap.dts68
-rw-r--r--arch/arm/boot/dts/integratorcp.dts110
-rw-r--r--arch/arm/boot/dts/tegra20-seaboard.dts2
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi4
-rw-r--r--arch/arm/common/it8152.c12
-rw-r--r--arch/arm/include/asm/Kbuild17
-rw-r--r--arch/arm/include/asm/arch_timer.h8
-rw-r--r--arch/arm/include/asm/current.h15
-rw-r--r--arch/arm/include/asm/delay.h9
-rw-r--r--arch/arm/include/asm/exec.h6
-rw-r--r--arch/arm/include/asm/glue-cache.h16
-rw-r--r--arch/arm/include/asm/hardirq.h2
-rw-r--r--arch/arm/include/asm/hardware/linkup-l1110.h48
-rw-r--r--arch/arm/include/asm/io.h67
-rw-r--r--arch/arm/include/asm/ipcbuf.h1
-rw-r--r--arch/arm/include/asm/msgbuf.h31
-rw-r--r--arch/arm/include/asm/mutex.h9
-rw-r--r--arch/arm/include/asm/opcodes-virt.h29
-rw-r--r--arch/arm/include/asm/opcodes.h181
-rw-r--r--arch/arm/include/asm/param.h31
-rw-r--r--arch/arm/include/asm/parport.h18
-rw-r--r--arch/arm/include/asm/segment.h11
-rw-r--r--arch/arm/include/asm/sembuf.h25
-rw-r--r--arch/arm/include/asm/serial.h19
-rw-r--r--arch/arm/include/asm/shmbuf.h42
-rw-r--r--arch/arm/include/asm/socket.h72
-rw-r--r--arch/arm/include/asm/sockios.h13
-rw-r--r--arch/arm/include/asm/syscall.h5
-rw-r--r--arch/arm/include/asm/termbits.h198
-rw-r--r--arch/arm/include/asm/termios.h92
-rw-r--r--arch/arm/include/asm/thread_info.h6
-rw-r--r--arch/arm/include/asm/timex.h6
-rw-r--r--arch/arm/include/asm/types.h16
-rw-r--r--arch/arm/include/asm/unaligned.h19
-rw-r--r--arch/arm/include/asm/unistd.h8
-rw-r--r--arch/arm/kernel/Makefile5
-rw-r--r--arch/arm/kernel/arch_timer.c383
-rw-r--r--arch/arm/kernel/asm-offsets.c2
-rw-r--r--arch/arm/kernel/atags.h14
-rw-r--r--arch/arm/kernel/atags_compat.c (renamed from arch/arm/kernel/compat.c)4
-rw-r--r--arch/arm/kernel/atags_parse.c238
-rw-r--r--arch/arm/kernel/atags_proc.c (renamed from arch/arm/kernel/atags.c)0
-rw-r--r--arch/arm/kernel/compat.h11
-rw-r--r--arch/arm/kernel/entry-common.S9
-rw-r--r--arch/arm/kernel/machine_kexec.c29
-rw-r--r--arch/arm/kernel/ptrace.c19
-rw-r--r--arch/arm/kernel/sched_clock.c8
-rw-r--r--arch/arm/kernel/setup.c236
-rw-r--r--arch/arm/kernel/smp.c13
-rw-r--r--arch/arm/lib/delay.c35
-rw-r--r--arch/arm/mach-at91/pm.c5
-rw-r--r--arch/arm/mach-at91/setup.c2
-rw-r--r--arch/arm/mach-davinci/da850.c2
-rw-r--r--arch/arm/mach-exynos/platsmp.c2
-rw-r--r--arch/arm/mach-footbridge/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-integrator/common.h3
-rw-r--r--arch/arm/mach-integrator/core.c17
-rw-r--r--arch/arm/mach-integrator/include/mach/cm.h2
-rw-r--r--arch/arm/mach-integrator/include/mach/platform.h6
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c278
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c325
-rw-r--r--arch/arm/mach-iop13xx/iq81340sc.c2
-rw-r--r--arch/arm/mach-iop13xx/pci.c2
-rw-r--r--arch/arm/mach-ks8695/include/mach/memory.h3
-rw-r--r--arch/arm/mach-mv78xx0/addr-map.c2
-rw-r--r--arch/arm/mach-mv78xx0/common.c2
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c1
-rw-r--r--arch/arm/mach-pxa/palmte2.c2
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c48
-rw-r--r--arch/arm/mach-pxa/viper.c3
-rw-r--r--arch/arm/mach-rpc/ecard.c4
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2416.c6
-rw-r--r--arch/arm/mach-s3c24xx/irq-s3c2443.c4
-rw-r--r--arch/arm/mach-s3c24xx/simtec-usb.c2
-rw-r--r--arch/arm/mach-sa1100/assabet.c2
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1111.h5
-rw-r--r--arch/arm/mach-sa1100/include/mach/lart.h13
-rw-r--r--arch/arm/mach-shark/pci.c2
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h2
-rw-r--r--arch/arm/mach-shmobile/smp-emev2.c2
-rw-r--r--arch/arm/mach-tegra/Kconfig6
-rw-r--r--arch/arm/mach-ux500/Kconfig4
-rw-r--r--arch/arm/mach-vt8500/include/mach/uncompress.h8
-rw-r--r--arch/arm/mach-vt8500/vt8500.c5
-rw-r--r--arch/arm/mm/alignment.c6
-rw-r--r--arch/arm/mm/cache-l2x0.c8
-rw-r--r--arch/arm/mm/cache-v7.S3
-rw-r--r--arch/arm/mm/init.c2
-rw-r--r--arch/arm/mm/ioremap.c1
-rw-r--r--arch/arm/plat-versatile/fpga-irq.c72
-rw-r--r--arch/arm/plat-versatile/include/plat/fpga-irq.h2
-rw-r--r--arch/m68k/include/asm/cacheflush_no.h19
-rw-r--r--arch/m68k/include/asm/m5206sim.h98
-rw-r--r--arch/m68k/include/asm/m523xsim.h24
-rw-r--r--arch/m68k/include/asm/m5249sim.h98
-rw-r--r--arch/m68k/include/asm/m525xsim.h70
-rw-r--r--arch/m68k/include/asm/m5272sim.h99
-rw-r--r--arch/m68k/include/asm/m527xsim.h84
-rw-r--r--arch/m68k/include/asm/m528xsim.h51
-rw-r--r--arch/m68k/include/asm/m5307sim.h136
-rw-r--r--arch/m68k/include/asm/m532xsim.h1189
-rw-r--r--arch/m68k/include/asm/m5407sim.h110
-rw-r--r--arch/m68k/include/asm/m54xxgpt.h40
-rw-r--r--arch/m68k/include/asm/m54xxsim.h27
-rw-r--r--arch/m68k/include/asm/mcfslt.h7
-rw-r--r--arch/m68k/include/asm/nettel.h9
-rw-r--r--arch/m68k/platform/68VZ328/Makefile8
-rw-r--r--arch/m68k/platform/coldfire/device.c4
-rw-r--r--arch/m68k/platform/coldfire/head.S2
-rw-r--r--arch/m68k/platform/coldfire/intc-5249.c10
-rw-r--r--arch/m68k/platform/coldfire/intc-5272.c20
-rw-r--r--arch/m68k/platform/coldfire/intc.c28
-rw-r--r--arch/m68k/platform/coldfire/m523x.c8
-rw-r--r--arch/m68k/platform/coldfire/m5249.c10
-rw-r--r--arch/m68k/platform/coldfire/m525x.c4
-rw-r--r--arch/m68k/platform/coldfire/m5272.c19
-rw-r--r--arch/m68k/platform/coldfire/m527x.c24
-rw-r--r--arch/m68k/platform/coldfire/m528x.c6
-rw-r--r--arch/m68k/platform/coldfire/m532x.c221
-rw-r--r--arch/m68k/platform/coldfire/m54xx.c16
-rw-r--r--arch/m68k/platform/coldfire/nettel.c4
-rw-r--r--arch/m68k/platform/coldfire/pci.c4
-rw-r--r--arch/m68k/platform/coldfire/reset.c2
-rw-r--r--arch/m68k/platform/coldfire/sltimers.c4
-rw-r--r--arch/m68k/platform/coldfire/timers.c4
-rw-r--r--arch/microblaze/Kconfig7
-rw-r--r--arch/microblaze/include/asm/clinkage.h1
-rw-r--r--arch/microblaze/include/asm/io.h94
-rw-r--r--arch/microblaze/include/asm/page.h9
-rw-r--r--arch/microblaze/include/asm/pci.h2
-rw-r--r--arch/microblaze/include/asm/pgtable.h6
-rw-r--r--arch/microblaze/kernel/head.S14
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S61
-rw-r--r--arch/microblaze/kernel/reset.c21
-rw-r--r--arch/microblaze/kernel/setup.c15
-rw-r--r--arch/microblaze/kernel/signal.c8
-rw-r--r--arch/microblaze/kernel/timer.c24
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/x86/lguest/Kconfig1
-rw-r--r--drivers/block/virtio_blk.c306
-rw-r--r--drivers/char/ds1620.c8
-rw-r--r--drivers/char/nwflash.c4
-rw-r--r--drivers/char/virtio_console.c198
-rw-r--r--drivers/lguest/lguest_device.c5
-rw-r--r--drivers/mmc/host/sdhci-tegra.c1
-rw-r--r--drivers/remoteproc/remoteproc_virtio.c5
-rw-r--r--drivers/rpmsg/Kconfig1
-rw-r--r--drivers/s390/kvm/kvm_virtio.c5
-rw-r--r--drivers/virtio/Kconfig17
-rw-r--r--drivers/virtio/Makefile3
-rw-r--r--drivers/virtio/virtio.c2
-rw-r--r--drivers/virtio/virtio_mmio.c29
-rw-r--r--drivers/virtio/virtio_pci.c68
-rw-r--r--drivers/virtio/virtio_ring.c14
-rw-r--r--drivers/watchdog/m54xx_wdt.c21
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_config.h23
-rw-r--r--include/linux/virtio_ring.h3
-rw-r--r--kernel/trace/trace.c8
-rw-r--r--security/integrity/ima/ima.h6
-rw-r--r--security/integrity/ima/ima_appraise.c2
-rw-r--r--sound/oss/waveartist.c4
-rw-r--r--tools/lguest/lguest.c1
-rw-r--r--tools/virtio/virtio-trace/Makefile13
-rw-r--r--tools/virtio/virtio-trace/README118
-rw-r--r--tools/virtio/virtio-trace/trace-agent-ctl.c137
-rw-r--r--tools/virtio/virtio-trace/trace-agent-rw.c192
-rw-r--r--tools/virtio/virtio-trace/trace-agent.c270
-rw-r--r--tools/virtio/virtio-trace/trace-agent.h75
178 files changed, 4157 insertions, 3386 deletions
diff --git a/Documentation/devicetree/bindings/arm/arm-boards b/Documentation/devicetree/bindings/arm/arm-boards
index 91f26148af79..fc81a7d6b0f1 100644
--- a/Documentation/devicetree/bindings/arm/arm-boards
+++ b/Documentation/devicetree/bindings/arm/arm-boards
@@ -1,3 +1,15 @@
1ARM Integrator/AP (Application Platform) and Integrator/CP (Compact Platform)
2-----------------------------------------------------------------------------
3ARM's oldest Linux-supported platform with connectors for different core
4tiles of ARMv4, ARMv5 and ARMv6 type.
5
6Required properties (in root node):
7 compatible = "arm,integrator-ap"; /* Application Platform */
8 compatible = "arm,integrator-cp"; /* Compact Platform */
9
10FPGA type interrupt controllers, see the versatile-fpga-irq binding doc.
11
12
1ARM Versatile Application and Platform Baseboards 13ARM Versatile Application and Platform Baseboards
2------------------------------------------------- 14-------------------------------------------------
3ARM's development hardware platform with connectors for customizable 15ARM's development hardware platform with connectors for customizable
diff --git a/Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt b/Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt
new file mode 100644
index 000000000000..9989eda755d9
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/versatile-fpga-irq.txt
@@ -0,0 +1,31 @@
1* ARM Versatile FPGA interrupt controller
2
3One or more FPGA IRQ controllers can be synthesized in an ARM reference board
4such as the Integrator or Versatile family. The output of these different
5controllers are OR:ed together and fed to the CPU tile's IRQ input. Each
6instance can handle up to 32 interrupts.
7
8Required properties:
9- compatible: "arm,versatile-fpga-irq"
10- interrupt-controller: Identifies the node as an interrupt controller
11- #interrupt-cells: The number of cells to define the interrupts. Must be 1
12 as the FPGA IRQ controller has no configuration options for interrupt
13 sources. The cell is a u32 and defines the interrupt number.
14- reg: The register bank for the FPGA interrupt controller.
15- clear-mask: a u32 number representing the mask written to clear all IRQs
16 on the controller at boot for example.
17- valid-mask: a u32 number representing a bit mask determining which of
18 the interrupts are valid. Unconnected/unused lines are set to 0, and
19 the system till not make it possible for devices to request these
20 interrupts.
21
22Example:
23
24pic: pic@14000000 {
25 compatible = "arm,versatile-fpga-irq";
26 #interrupt-cells = <1>;
27 interrupt-controller;
28 reg = <0x14000000 0x100>;
29 clear-mask = <0xffffffff>;
30 valid-mask = <0x003fffff>;
31};
diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
index 548892c08c59..7da578d72123 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2835-armctrl-ic.txt
@@ -7,7 +7,7 @@ as "armctrl" in the SoC documentation, hence naming of this binding.
7 7
8Required properties: 8Required properties:
9 9
10- compatible : should be "brcm,bcm2835-armctrl-ic.txt" 10- compatible : should be "brcm,bcm2835-armctrl-ic"
11- reg : Specifies base physical address and size of the registers. 11- reg : Specifies base physical address and size of the registers.
12- interrupt-controller : Identifies the node as an interrupt controller 12- interrupt-controller : Identifies the node as an interrupt controller
13- #interrupt-cells : Specifies the number of cells needed to encode an 13- #interrupt-cells : Specifies the number of cells needed to encode an
diff --git a/Documentation/devicetree/bindings/timer/brcm,bcm2835-system-timer.txt b/Documentation/devicetree/bindings/timer/brcm,bcm2835-system-timer.txt
index 2de21c2acf55..844bd5fbd04c 100644
--- a/Documentation/devicetree/bindings/timer/brcm,bcm2835-system-timer.txt
+++ b/Documentation/devicetree/bindings/timer/brcm,bcm2835-system-timer.txt
@@ -7,7 +7,7 @@ free running counter values, and generates an interrupt.
7 7
8Required properties: 8Required properties:
9 9
10- compatible : should be "brcm,bcm2835-system-timer.txt" 10- compatible : should be "brcm,bcm2835-system-timer"
11- reg : Specifies base physical address and size of the registers. 11- reg : Specifies base physical address and size of the registers.
12- interrupts : A list of 4 interrupt sinks; one per timer channel. 12- interrupts : A list of 4 interrupt sinks; one per timer channel.
13- clock-frequency : The frequency of the clock that drives the counter, in Hz. 13- clock-frequency : The frequency of the clock that drives the counter, in Hz.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c0065c777e9b..5520b033ee84 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -16,6 +16,7 @@ config ARM
16 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL 16 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
17 select HAVE_ARCH_KGDB 17 select HAVE_ARCH_KGDB
18 select HAVE_ARCH_TRACEHOOK 18 select HAVE_ARCH_TRACEHOOK
19 select HAVE_SYSCALL_TRACEPOINTS
19 select HAVE_KPROBES if !XIP_KERNEL 20 select HAVE_KPROBES if !XIP_KERNEL
20 select HAVE_KRETPROBES if (HAVE_KPROBES) 21 select HAVE_KRETPROBES if (HAVE_KPROBES)
21 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL) 22 select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
@@ -490,7 +491,6 @@ config ARCH_IOP32X
490 depends on MMU 491 depends on MMU
491 select CPU_XSCALE 492 select CPU_XSCALE
492 select NEED_MACH_GPIO_H 493 select NEED_MACH_GPIO_H
493 select NEED_MACH_IO_H
494 select NEED_RET_TO_USER 494 select NEED_RET_TO_USER
495 select PLAT_IOP 495 select PLAT_IOP
496 select PCI 496 select PCI
@@ -504,7 +504,6 @@ config ARCH_IOP33X
504 depends on MMU 504 depends on MMU
505 select CPU_XSCALE 505 select CPU_XSCALE
506 select NEED_MACH_GPIO_H 506 select NEED_MACH_GPIO_H
507 select NEED_MACH_IO_H
508 select NEED_RET_TO_USER 507 select NEED_RET_TO_USER
509 select PLAT_IOP 508 select PLAT_IOP
510 select PCI 509 select PCI
@@ -1402,6 +1401,16 @@ config PL310_ERRATA_769419
1402 on systems with an outer cache, the store buffer is drained 1401 on systems with an outer cache, the store buffer is drained
1403 explicitly. 1402 explicitly.
1404 1403
1404config ARM_ERRATA_775420
1405 bool "ARM errata: A data cache maintenance operation which aborts, might lead to deadlock"
1406 depends on CPU_V7
1407 help
1408 This option enables the workaround for the 775420 Cortex-A9 (r2p2,
1409 r2p6,r2p8,r2p10,r3p0) erratum. In case a date cache maintenance
1410 operation aborts with MMU exception, it might cause the processor
1411 to deadlock. This workaround puts DSB before executing ISB if
1412 an abort may occur on cache maintenance.
1413
1405endmenu 1414endmenu
1406 1415
1407source "arch/arm/common/Kconfig" 1416source "arch/arm/common/Kconfig"
@@ -1787,8 +1796,8 @@ config ALIGNMENT_TRAP
1787 configuration it is safe to say N, otherwise say Y. 1796 configuration it is safe to say N, otherwise say Y.
1788 1797
1789config UACCESS_WITH_MEMCPY 1798config UACCESS_WITH_MEMCPY
1790 bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user() (EXPERIMENTAL)" 1799 bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user()"
1791 depends on MMU && EXPERIMENTAL 1800 depends on MMU
1792 default y if CPU_FEROCEON 1801 default y if CPU_FEROCEON
1793 help 1802 help
1794 Implement faster copy_to_user and clear_user methods for CPU 1803 Implement faster copy_to_user and clear_user methods for CPU
@@ -1829,12 +1838,6 @@ config CC_STACKPROTECTOR
1829 neutralized via a kernel panic. 1838 neutralized via a kernel panic.
1830 This feature requires gcc version 4.2 or above. 1839 This feature requires gcc version 4.2 or above.
1831 1840
1832config DEPRECATED_PARAM_STRUCT
1833 bool "Provide old way to pass kernel parameters"
1834 help
1835 This was deprecated in 2001 and announced to live on for 5 years.
1836 Some old boot loaders still use this way.
1837
1838config XEN_DOM0 1841config XEN_DOM0
1839 def_bool y 1842 def_bool y
1840 depends on XEN 1843 depends on XEN
@@ -1857,6 +1860,23 @@ config USE_OF
1857 help 1860 help
1858 Include support for flattened device tree machine descriptions. 1861 Include support for flattened device tree machine descriptions.
1859 1862
1863config ATAGS
1864 bool "Support for the traditional ATAGS boot data passing" if USE_OF
1865 default y
1866 help
1867 This is the traditional way of passing data to the kernel at boot
1868 time. If you are solely relying on the flattened device tree (or
1869 the ARM_ATAG_DTB_COMPAT option) then you may unselect this option
1870 to remove ATAGS support from your kernel binary. If unsure,
1871 leave this to y.
1872
1873config DEPRECATED_PARAM_STRUCT
1874 bool "Provide old way to pass kernel parameters"
1875 depends on ATAGS
1876 help
1877 This was deprecated in 2001 and announced to live on for 5 years.
1878 Some old boot loaders still use this way.
1879
1860# Compressed boot loader in ROM. Yes, we really want to ask about 1880# Compressed boot loader in ROM. Yes, we really want to ask about
1861# TEXT and BSS so we preserve their values in the config files. 1881# TEXT and BSS so we preserve their values in the config files.
1862config ZBOOT_ROM_TEXT 1882config ZBOOT_ROM_TEXT
@@ -1983,6 +2003,7 @@ config CMDLINE
1983choice 2003choice
1984 prompt "Kernel command line type" if CMDLINE != "" 2004 prompt "Kernel command line type" if CMDLINE != ""
1985 default CMDLINE_FROM_BOOTLOADER 2005 default CMDLINE_FROM_BOOTLOADER
2006 depends on ATAGS
1986 2007
1987config CMDLINE_FROM_BOOTLOADER 2008config CMDLINE_FROM_BOOTLOADER
1988 bool "Use bootloader kernel arguments if available" 2009 bool "Use bootloader kernel arguments if available"
@@ -2052,7 +2073,7 @@ config KEXEC
2052 2073
2053config ATAGS_PROC 2074config ATAGS_PROC
2054 bool "Export atags in procfs" 2075 bool "Export atags in procfs"
2055 depends on KEXEC 2076 depends on ATAGS && KEXEC
2056 default y 2077 default y
2057 help 2078 help
2058 Should the atags used to boot the kernel be exported in an "atags" 2079 Should the atags used to boot the kernel be exported in an "atags"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 40ea991b6782..f023e3acdfbd 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -269,7 +269,12 @@ else
269KBUILD_IMAGE := zImage 269KBUILD_IMAGE := zImage
270endif 270endif
271 271
272all: $(KBUILD_IMAGE) 272# Build the DT binary blobs if we have OF configured
273ifeq ($(CONFIG_USE_OF),y)
274KBUILD_DTBS := dtbs
275endif
276
277all: $(KBUILD_IMAGE) $(KBUILD_DTBS)
273 278
274boot := arch/arm/boot 279boot := arch/arm/boot
275 280
@@ -307,7 +312,7 @@ define archhelp
307 echo ' uImage - U-Boot wrapped zImage' 312 echo ' uImage - U-Boot wrapped zImage'
308 echo ' bootpImage - Combined zImage and initial RAM disk' 313 echo ' bootpImage - Combined zImage and initial RAM disk'
309 echo ' (supply initrd image via make variable INITRD=<path>)' 314 echo ' (supply initrd image via make variable INITRD=<path>)'
310 echo ' dtbs - Build device tree blobs for enabled boards' 315 echo '* dtbs - Build device tree blobs for enabled boards'
311 echo ' install - Install uncompressed kernel' 316 echo ' install - Install uncompressed kernel'
312 echo ' zinstall - Install compressed kernel' 317 echo ' zinstall - Install compressed kernel'
313 echo ' uinstall - Install U-Boot wrapped compressed kernel' 318 echo ' uinstall - Install U-Boot wrapped compressed kernel'
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index f41b38cafce8..9deb56a702ce 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -32,6 +32,9 @@ extern void error(char *);
32# define Tracecv(c,x) 32# define Tracecv(c,x)
33#endif 33#endif
34 34
35/* Not needed, but used in some headers pulled in by decompressors */
36extern char * strstr(const char * s1, const char *s2);
37
35#ifdef CONFIG_KERNEL_GZIP 38#ifdef CONFIG_KERNEL_GZIP
36#include "../../../../lib/decompress_inflate.c" 39#include "../../../../lib/decompress_inflate.c"
37#endif 40#endif
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 5c28db351c28..c1ce813fcc4a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -25,14 +25,6 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
25 exynos4210-trats.dtb \ 25 exynos4210-trats.dtb \
26 exynos5250-smdk5250.dtb 26 exynos5250-smdk5250.dtb
27dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb 27dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb
28dtb-$(CONFIG_ARCH_IMX5) += imx51-babbage.dtb \
29 imx53-ard.dtb \
30 imx53-evk.dtb \
31 imx53-qsb.dtb \
32 imx53-smd.dtb
33dtb-$(CONFIG_SOC_IMX6Q) += imx6q-arm2.dtb \
34 imx6q-sabrelite.dtb \
35 imx6q-sabresd.dtb
36dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb 28dtb-$(CONFIG_ARCH_LPC32XX) += ea3250.dtb phy3250.dtb
37dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \ 29dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
38 kirkwood-dns325.dtb \ 30 kirkwood-dns325.dtb \
@@ -106,5 +98,8 @@ dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \
106 vexpress-v2p-ca15-tc1.dtb \ 98 vexpress-v2p-ca15-tc1.dtb \
107 vexpress-v2p-ca15_a7.dtb \ 99 vexpress-v2p-ca15_a7.dtb \
108 xenvm-4.2.dtb 100 xenvm-4.2.dtb
101dtb-$(CONFIG_ARCH_VT8500) += vt8500-bv07.dtb \
102 wm8505-ref.dtb \
103 wm8650-mid.dtb
109 104
110endif 105endif
diff --git a/arch/arm/boot/dts/integrator.dtsi b/arch/arm/boot/dts/integrator.dtsi
new file mode 100644
index 000000000000..813b91d7bea2
--- /dev/null
+++ b/arch/arm/boot/dts/integrator.dtsi
@@ -0,0 +1,76 @@
1/*
2 * SoC core Device Tree for the ARM Integrator platforms
3 */
4
5/include/ "skeleton.dtsi"
6
7/ {
8 timer@13000000 {
9 reg = <0x13000000 0x100>;
10 interrupt-parent = <&pic>;
11 interrupts = <5>;
12 };
13
14 timer@13000100 {
15 reg = <0x13000100 0x100>;
16 interrupt-parent = <&pic>;
17 interrupts = <6>;
18 };
19
20 timer@13000200 {
21 reg = <0x13000200 0x100>;
22 interrupt-parent = <&pic>;
23 interrupts = <7>;
24 };
25
26 pic@14000000 {
27 compatible = "arm,versatile-fpga-irq";
28 #interrupt-cells = <1>;
29 interrupt-controller;
30 reg = <0x14000000 0x100>;
31 clear-mask = <0xffffffff>;
32 };
33
34 flash@24000000 {
35 compatible = "cfi-flash";
36 reg = <0x24000000 0x02000000>;
37 };
38
39 fpga {
40 compatible = "arm,amba-bus", "simple-bus";
41 #address-cells = <1>;
42 #size-cells = <1>;
43 ranges;
44 interrupt-parent = <&pic>;
45
46 /*
47 * These PrimeCells are in the same locations and using the
48 * same interrupts in all Integrators, however the silicon
49 * version deployed is different.
50 */
51 rtc@15000000 {
52 reg = <0x15000000 0x1000>;
53 interrupts = <8>;
54 };
55
56 uart@16000000 {
57 reg = <0x16000000 0x1000>;
58 interrupts = <1>;
59 };
60
61 uart@17000000 {
62 reg = <0x17000000 0x1000>;
63 interrupts = <2>;
64 };
65
66 kmi@18000000 {
67 reg = <0x18000000 0x1000>;
68 interrupts = <3>;
69 };
70
71 kmi@19000000 {
72 reg = <0x19000000 0x1000>;
73 interrupts = <4>;
74 };
75 };
76};
diff --git a/arch/arm/boot/dts/integratorap.dts b/arch/arm/boot/dts/integratorap.dts
new file mode 100644
index 000000000000..61767757b50a
--- /dev/null
+++ b/arch/arm/boot/dts/integratorap.dts
@@ -0,0 +1,68 @@
1/*
2 * Device Tree for the ARM Integrator/AP platform
3 */
4
5/dts-v1/;
6/include/ "integrator.dtsi"
7
8/ {
9 model = "ARM Integrator/AP";
10 compatible = "arm,integrator-ap";
11
12 aliases {
13 arm,timer-primary = &timer2;
14 arm,timer-secondary = &timer1;
15 };
16
17 chosen {
18 bootargs = "root=/dev/ram0 console=ttyAM0,38400n8 earlyprintk";
19 };
20
21 timer0: timer@13000000 {
22 compatible = "arm,integrator-timer";
23 };
24
25 timer1: timer@13000100 {
26 compatible = "arm,integrator-timer";
27 };
28
29 timer2: timer@13000200 {
30 compatible = "arm,integrator-timer";
31 };
32
33 pic: pic@14000000 {
34 valid-mask = <0x003fffff>;
35 };
36
37 fpga {
38 /*
39 * The Integator/AP predates the idea to have magic numbers
40 * identifying the PrimeCell in hardware, thus we have to
41 * supply these from the device tree.
42 */
43 rtc: rtc@15000000 {
44 compatible = "arm,pl030", "arm,primecell";
45 arm,primecell-periphid = <0x00041030>;
46 };
47
48 uart0: uart@16000000 {
49 compatible = "arm,pl010", "arm,primecell";
50 arm,primecell-periphid = <0x00041010>;
51 };
52
53 uart1: uart@17000000 {
54 compatible = "arm,pl010", "arm,primecell";
55 arm,primecell-periphid = <0x00041010>;
56 };
57
58 kmi0: kmi@18000000 {
59 compatible = "arm,pl050", "arm,primecell";
60 arm,primecell-periphid = <0x00041050>;
61 };
62
63 kmi1: kmi@19000000 {
64 compatible = "arm,pl050", "arm,primecell";
65 arm,primecell-periphid = <0x00041050>;
66 };
67 };
68};
diff --git a/arch/arm/boot/dts/integratorcp.dts b/arch/arm/boot/dts/integratorcp.dts
new file mode 100644
index 000000000000..2dd5e4e48481
--- /dev/null
+++ b/arch/arm/boot/dts/integratorcp.dts
@@ -0,0 +1,110 @@
1/*
2 * Device Tree for the ARM Integrator/CP platform
3 */
4
5/dts-v1/;
6/include/ "integrator.dtsi"
7
8/ {
9 model = "ARM Integrator/CP";
10 compatible = "arm,integrator-cp";
11
12 aliases {
13 arm,timer-primary = &timer2;
14 arm,timer-secondary = &timer1;
15 };
16
17 chosen {
18 bootargs = "root=/dev/ram0 console=ttyAMA0,38400n8 earlyprintk";
19 };
20
21 timer0: timer@13000000 {
22 compatible = "arm,sp804", "arm,primecell";
23 };
24
25 timer1: timer@13000100 {
26 compatible = "arm,sp804", "arm,primecell";
27 };
28
29 timer2: timer@13000200 {
30 compatible = "arm,sp804", "arm,primecell";
31 };
32
33 pic: pic@14000000 {
34 valid-mask = <0x1fc003ff>;
35 };
36
37 cic: cic@10000040 {
38 compatible = "arm,versatile-fpga-irq";
39 #interrupt-cells = <1>;
40 interrupt-controller;
41 reg = <0x10000040 0x100>;
42 clear-mask = <0xffffffff>;
43 valid-mask = <0x00000007>;
44 };
45
46 sic: sic@ca000000 {
47 compatible = "arm,versatile-fpga-irq";
48 #interrupt-cells = <1>;
49 interrupt-controller;
50 reg = <0xca000000 0x100>;
51 clear-mask = <0x00000fff>;
52 valid-mask = <0x00000fff>;
53 };
54
55 ethernet@c8000000 {
56 compatible = "smsc,lan91c111";
57 reg = <0xc8000000 0x10>;
58 interrupt-parent = <&pic>;
59 interrupts = <27>;
60 };
61
62 fpga {
63 /*
64 * These PrimeCells are at the same location and using
65 * the same interrupts in all Integrators, but in the CP
66 * slightly newer versions are deployed.
67 */
68 rtc@15000000 {
69 compatible = "arm,pl031", "arm,primecell";
70 };
71
72 uart@16000000 {
73 compatible = "arm,pl011", "arm,primecell";
74 };
75
76 uart@17000000 {
77 compatible = "arm,pl011", "arm,primecell";
78 };
79
80 kmi@18000000 {
81 compatible = "arm,pl050", "arm,primecell";
82 };
83
84 kmi@19000000 {
85 compatible = "arm,pl050", "arm,primecell";
86 };
87
88 /*
89 * These PrimeCells are only available on the Integrator/CP
90 */
91 mmc@1c000000 {
92 compatible = "arm,pl180", "arm,primecell";
93 reg = <0x1c000000 0x1000>;
94 interrupts = <23 24>;
95 max-frequency = <515633>;
96 };
97
98 aaci@1d000000 {
99 compatible = "arm,pl041", "arm,primecell";
100 reg = <0x1d000000 0x1000>;
101 interrupts = <25>;
102 };
103
104 clcd@c0000000 {
105 compatible = "arm,pl110", "arm,primecell";
106 reg = <0xC0000000 0x1000>;
107 interrupts = <22>;
108 };
109 };
110};
diff --git a/arch/arm/boot/dts/tegra20-seaboard.dts b/arch/arm/boot/dts/tegra20-seaboard.dts
index e60dc7124e92..f0ba901676ac 100644
--- a/arch/arm/boot/dts/tegra20-seaboard.dts
+++ b/arch/arm/boot/dts/tegra20-seaboard.dts
@@ -539,7 +539,7 @@
539 nvidia,invert-interrupt; 539 nvidia,invert-interrupt;
540 }; 540 };
541 541
542 memory-controller@0x7000f400 { 542 memory-controller@7000f400 {
543 emc-table@190000 { 543 emc-table@190000 {
544 reg = <190000>; 544 reg = <190000>;
545 compatible = "nvidia,tegra20-emc-table"; 545 compatible = "nvidia,tegra20-emc-table";
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 67a6cd910b96..f3a09d0d45bc 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -170,7 +170,7 @@
170 reg = <0x7000e400 0x400>; 170 reg = <0x7000e400 0x400>;
171 }; 171 };
172 172
173 memory-controller@0x7000f000 { 173 memory-controller@7000f000 {
174 compatible = "nvidia,tegra20-mc"; 174 compatible = "nvidia,tegra20-mc";
175 reg = <0x7000f000 0x024 175 reg = <0x7000f000 0x024
176 0x7000f03c 0x3c4>; 176 0x7000f03c 0x3c4>;
@@ -183,7 +183,7 @@
183 0x58000000 0x02000000>; /* GART aperture */ 183 0x58000000 0x02000000>; /* GART aperture */
184 }; 184 };
185 185
186 memory-controller@0x7000f400 { 186 memory-controller@7000f400 {
187 compatible = "nvidia,tegra20-emc"; 187 compatible = "nvidia,tegra20-emc";
188 reg = <0x7000f400 0x200>; 188 reg = <0x7000f400 0x200>;
189 #address-cells = <1>; 189 #address-cells = <1>;
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c
index c4110d1b1f2d..001f4913799c 100644
--- a/arch/arm/common/it8152.c
+++ b/arch/arm/common/it8152.c
@@ -284,11 +284,17 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
284 284
285int __init it8152_pci_setup(int nr, struct pci_sys_data *sys) 285int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
286{ 286{
287 it8152_io.start = IT8152_IO_BASE + 0x12000; 287 /*
288 it8152_io.end = IT8152_IO_BASE + 0x12000 + 0x100000; 288 * FIXME: use pci_ioremap_io to remap the IO space here and
289 * move over to the generic io.h implementation.
290 * This requires solving the same problem for PXA PCMCIA
291 * support.
292 */
293 it8152_io.start = (unsigned long)IT8152_IO_BASE + 0x12000;
294 it8152_io.end = (unsigned long)IT8152_IO_BASE + 0x12000 + 0x100000;
289 295
290 sys->mem_offset = 0x10000000; 296 sys->mem_offset = 0x10000000;
291 sys->io_offset = IT8152_IO_BASE; 297 sys->io_offset = (unsigned long)IT8152_IO_BASE;
292 298
293 if (request_resource(&ioport_resource, &it8152_io)) { 299 if (request_resource(&ioport_resource, &it8152_io)) {
294 printk(KERN_ERR "PCI: unable to allocate IO region\n"); 300 printk(KERN_ERR "PCI: unable to allocate IO region\n");
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 960abceb8e14..8a7196ca5106 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -5,16 +5,33 @@ header-y += hwcap.h
5generic-y += auxvec.h 5generic-y += auxvec.h
6generic-y += bitsperlong.h 6generic-y += bitsperlong.h
7generic-y += cputime.h 7generic-y += cputime.h
8generic-y += current.h
8generic-y += emergency-restart.h 9generic-y += emergency-restart.h
9generic-y += errno.h 10generic-y += errno.h
11generic-y += exec.h
10generic-y += ioctl.h 12generic-y += ioctl.h
13generic-y += ipcbuf.h
11generic-y += irq_regs.h 14generic-y += irq_regs.h
12generic-y += kdebug.h 15generic-y += kdebug.h
13generic-y += local.h 16generic-y += local.h
14generic-y += local64.h 17generic-y += local64.h
18generic-y += msgbuf.h
19generic-y += param.h
20generic-y += parport.h
15generic-y += percpu.h 21generic-y += percpu.h
16generic-y += poll.h 22generic-y += poll.h
17generic-y += resource.h 23generic-y += resource.h
18generic-y += sections.h 24generic-y += sections.h
25generic-y += segment.h
26generic-y += sembuf.h
27generic-y += serial.h
28generic-y += shmbuf.h
19generic-y += siginfo.h 29generic-y += siginfo.h
20generic-y += sizes.h 30generic-y += sizes.h
31generic-y += socket.h
32generic-y += sockios.h
33generic-y += termbits.h
34generic-y += termios.h
35generic-y += timex.h
36generic-y += types.h
37generic-y += unaligned.h
diff --git a/arch/arm/include/asm/arch_timer.h b/arch/arm/include/asm/arch_timer.h
index 62e75475e57e..d40229d9a1c9 100644
--- a/arch/arm/include/asm/arch_timer.h
+++ b/arch/arm/include/asm/arch_timer.h
@@ -2,11 +2,12 @@
2#define __ASMARM_ARCH_TIMER_H 2#define __ASMARM_ARCH_TIMER_H
3 3
4#include <asm/errno.h> 4#include <asm/errno.h>
5#include <linux/clocksource.h>
5 6
6#ifdef CONFIG_ARM_ARCH_TIMER 7#ifdef CONFIG_ARM_ARCH_TIMER
7#define ARCH_HAS_READ_CURRENT_TIMER
8int arch_timer_of_register(void); 8int arch_timer_of_register(void);
9int arch_timer_sched_clock_init(void); 9int arch_timer_sched_clock_init(void);
10struct timecounter *arch_timer_get_timecounter(void);
10#else 11#else
11static inline int arch_timer_of_register(void) 12static inline int arch_timer_of_register(void)
12{ 13{
@@ -17,6 +18,11 @@ static inline int arch_timer_sched_clock_init(void)
17{ 18{
18 return -ENXIO; 19 return -ENXIO;
19} 20}
21
22static inline struct timecounter *arch_timer_get_timecounter(void)
23{
24 return NULL;
25}
20#endif 26#endif
21 27
22#endif 28#endif
diff --git a/arch/arm/include/asm/current.h b/arch/arm/include/asm/current.h
deleted file mode 100644
index 75d21e2a3ff7..000000000000
--- a/arch/arm/include/asm/current.h
+++ /dev/null
@@ -1,15 +0,0 @@
1#ifndef _ASMARM_CURRENT_H
2#define _ASMARM_CURRENT_H
3
4#include <linux/thread_info.h>
5
6static inline struct task_struct *get_current(void) __attribute_const__;
7
8static inline struct task_struct *get_current(void)
9{
10 return current_thread_info()->task;
11}
12
13#define current (get_current())
14
15#endif /* _ASMARM_CURRENT_H */
diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h
index dc6145120de3..ab98fdd083bd 100644
--- a/arch/arm/include/asm/delay.h
+++ b/arch/arm/include/asm/delay.h
@@ -15,6 +15,11 @@
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17 17
18struct delay_timer {
19 unsigned long (*read_current_timer)(void);
20 unsigned long freq;
21};
22
18extern struct arm_delay_ops { 23extern struct arm_delay_ops {
19 void (*delay)(unsigned long); 24 void (*delay)(unsigned long);
20 void (*const_udelay)(unsigned long); 25 void (*const_udelay)(unsigned long);
@@ -56,6 +61,10 @@ extern void __loop_delay(unsigned long loops);
56extern void __loop_udelay(unsigned long usecs); 61extern void __loop_udelay(unsigned long usecs);
57extern void __loop_const_udelay(unsigned long); 62extern void __loop_const_udelay(unsigned long);
58 63
64/* Delay-loop timer registration. */
65#define ARCH_HAS_READ_CURRENT_TIMER
66extern void register_current_timer_delay(const struct delay_timer *timer);
67
59#endif /* __ASSEMBLY__ */ 68#endif /* __ASSEMBLY__ */
60 69
61#endif /* defined(_ARM_DELAY_H) */ 70#endif /* defined(_ARM_DELAY_H) */
diff --git a/arch/arm/include/asm/exec.h b/arch/arm/include/asm/exec.h
deleted file mode 100644
index 7c4fbef72b3a..000000000000
--- a/arch/arm/include/asm/exec.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ASM_ARM_EXEC_H
2#define __ASM_ARM_EXEC_H
3
4#define arch_align_stack(x) (x)
5
6#endif /* __ASM_ARM_EXEC_H */
diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h
index 7e30874377e6..4f8d2c0dc441 100644
--- a/arch/arm/include/asm/glue-cache.h
+++ b/arch/arm/include/asm/glue-cache.h
@@ -110,19 +110,19 @@
110#endif 110#endif
111 111
112#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) 112#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
113//# ifdef _CACHE 113# ifdef _CACHE
114# define MULTI_CACHE 1 114# define MULTI_CACHE 1
115//# else 115# else
116//# define _CACHE v6 116# define _CACHE v6
117//# endif 117# endif
118#endif 118#endif
119 119
120#if defined(CONFIG_CPU_V7) 120#if defined(CONFIG_CPU_V7)
121//# ifdef _CACHE 121# ifdef _CACHE
122# define MULTI_CACHE 1 122# define MULTI_CACHE 1
123//# else 123# else
124//# define _CACHE v7 124# define _CACHE v7
125//# endif 125# endif
126#endif 126#endif
127 127
128#if !defined(_CACHE) && !defined(MULTI_CACHE) 128#if !defined(_CACHE) && !defined(MULTI_CACHE)
diff --git a/arch/arm/include/asm/hardirq.h b/arch/arm/include/asm/hardirq.h
index 436e60b2cf7a..2740c2a2df63 100644
--- a/arch/arm/include/asm/hardirq.h
+++ b/arch/arm/include/asm/hardirq.h
@@ -5,7 +5,7 @@
5#include <linux/threads.h> 5#include <linux/threads.h>
6#include <asm/irq.h> 6#include <asm/irq.h>
7 7
8#define NR_IPI 5 8#define NR_IPI 6
9 9
10typedef struct { 10typedef struct {
11 unsigned int __softirq_pending; 11 unsigned int __softirq_pending;
diff --git a/arch/arm/include/asm/hardware/linkup-l1110.h b/arch/arm/include/asm/hardware/linkup-l1110.h
deleted file mode 100644
index 7ec91168a576..000000000000
--- a/arch/arm/include/asm/hardware/linkup-l1110.h
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2*
3* Definitions for H3600 Handheld Computer
4*
5* Copyright 2001 Compaq Computer Corporation.
6*
7* Use consistent with the GNU GPL is permitted,
8* provided that this copyright notice is
9* preserved in its entirety in all copies and derived works.
10*
11* COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12* AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13* FITNESS FOR ANY PARTICULAR PURPOSE.
14*
15* Author: Jamey Hicks.
16*
17*/
18
19/* LinkUp Systems PCCard/CompactFlash Interface for SA-1100 */
20
21/* PC Card Status Register */
22#define LINKUP_PRS_S1 (1 << 0) /* voltage control bits S1-S4 */
23#define LINKUP_PRS_S2 (1 << 1)
24#define LINKUP_PRS_S3 (1 << 2)
25#define LINKUP_PRS_S4 (1 << 3)
26#define LINKUP_PRS_BVD1 (1 << 4)
27#define LINKUP_PRS_BVD2 (1 << 5)
28#define LINKUP_PRS_VS1 (1 << 6)
29#define LINKUP_PRS_VS2 (1 << 7)
30#define LINKUP_PRS_RDY (1 << 8)
31#define LINKUP_PRS_CD1 (1 << 9)
32#define LINKUP_PRS_CD2 (1 << 10)
33
34/* PC Card Command Register */
35#define LINKUP_PRC_S1 (1 << 0)
36#define LINKUP_PRC_S2 (1 << 1)
37#define LINKUP_PRC_S3 (1 << 2)
38#define LINKUP_PRC_S4 (1 << 3)
39#define LINKUP_PRC_RESET (1 << 4)
40#define LINKUP_PRC_APOE (1 << 5) /* Auto Power Off Enable: clears S1-S4 when either nCD goes high */
41#define LINKUP_PRC_CFE (1 << 6) /* CompactFlash mode Enable: addresses A[10:0] only, A[25:11] high */
42#define LINKUP_PRC_SOE (1 << 7) /* signal output driver enable */
43#define LINKUP_PRC_SSP (1 << 8) /* sock select polarity: 0 for socket 0, 1 for socket 1 */
44#define LINKUP_PRC_MBZ (1 << 15) /* must be zero */
45
46struct linkup_l1110 {
47 volatile short prc;
48};
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 8f4db67533e5..35c1ed89b936 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -47,13 +47,68 @@ extern void __raw_readsb(const void __iomem *addr, void *data, int bytelen);
47extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen); 47extern void __raw_readsw(const void __iomem *addr, void *data, int wordlen);
48extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); 48extern void __raw_readsl(const void __iomem *addr, void *data, int longlen);
49 49
50#define __raw_writeb(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned char __force *)(a) = (v))) 50#if __LINUX_ARM_ARCH__ < 6
51#define __raw_writew(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))) 51/*
52#define __raw_writel(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned int __force *)(a) = (v))) 52 * Half-word accesses are problematic with RiscPC due to limitations of
53 * the bus. Rather than special-case the machine, just let the compiler
54 * generate the access for CPUs prior to ARMv6.
55 */
56#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a))
57#define __raw_writew(v,a) ((void)(__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v)))
58#else
59/*
60 * When running under a hypervisor, we want to avoid I/O accesses with
61 * writeback addressing modes as these incur a significant performance
62 * overhead (the address generation must be emulated in software).
63 */
64static inline void __raw_writew(u16 val, volatile void __iomem *addr)
65{
66 asm volatile("strh %1, %0"
67 : "+Qo" (*(volatile u16 __force *)addr)
68 : "r" (val));
69}
70
71static inline u16 __raw_readw(const volatile void __iomem *addr)
72{
73 u16 val;
74 asm volatile("ldrh %1, %0"
75 : "+Qo" (*(volatile u16 __force *)addr),
76 "=r" (val));
77 return val;
78}
79#endif
53 80
54#define __raw_readb(a) (__chk_io_ptr(a), *(volatile unsigned char __force *)(a)) 81static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
55#define __raw_readw(a) (__chk_io_ptr(a), *(volatile unsigned short __force *)(a)) 82{
56#define __raw_readl(a) (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)) 83 asm volatile("strb %1, %0"
84 : "+Qo" (*(volatile u8 __force *)addr)
85 : "r" (val));
86}
87
88static inline void __raw_writel(u32 val, volatile void __iomem *addr)
89{
90 asm volatile("str %1, %0"
91 : "+Qo" (*(volatile u32 __force *)addr)
92 : "r" (val));
93}
94
95static inline u8 __raw_readb(const volatile void __iomem *addr)
96{
97 u8 val;
98 asm volatile("ldrb %1, %0"
99 : "+Qo" (*(volatile u8 __force *)addr),
100 "=r" (val));
101 return val;
102}
103
104static inline u32 __raw_readl(const volatile void __iomem *addr)
105{
106 u32 val;
107 asm volatile("ldr %1, %0"
108 : "+Qo" (*(volatile u32 __force *)addr),
109 "=r" (val));
110 return val;
111}
57 112
58/* 113/*
59 * Architecture ioremap implementation. 114 * Architecture ioremap implementation.
diff --git a/arch/arm/include/asm/ipcbuf.h b/arch/arm/include/asm/ipcbuf.h
deleted file mode 100644
index 84c7e51cb6d0..000000000000
--- a/arch/arm/include/asm/ipcbuf.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ipcbuf.h>
diff --git a/arch/arm/include/asm/msgbuf.h b/arch/arm/include/asm/msgbuf.h
deleted file mode 100644
index 33b35b946eaa..000000000000
--- a/arch/arm/include/asm/msgbuf.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _ASMARM_MSGBUF_H
2#define _ASMARM_MSGBUF_H
3
4/*
5 * The msqid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct msqid64_ds {
15 struct ipc64_perm msg_perm;
16 __kernel_time_t msg_stime; /* last msgsnd time */
17 unsigned long __unused1;
18 __kernel_time_t msg_rtime; /* last msgrcv time */
19 unsigned long __unused2;
20 __kernel_time_t msg_ctime; /* last change time */
21 unsigned long __unused3;
22 unsigned long msg_cbytes; /* current number of bytes on queue */
23 unsigned long msg_qnum; /* number of messages in queue */
24 unsigned long msg_qbytes; /* max number of bytes on queue */
25 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
26 __kernel_pid_t msg_lrpid; /* last receive pid */
27 unsigned long __unused4;
28 unsigned long __unused5;
29};
30
31#endif /* _ASMARM_MSGBUF_H */
diff --git a/arch/arm/include/asm/mutex.h b/arch/arm/include/asm/mutex.h
index b1479fd04a95..87c044910fe0 100644
--- a/arch/arm/include/asm/mutex.h
+++ b/arch/arm/include/asm/mutex.h
@@ -9,8 +9,13 @@
9#define _ASM_MUTEX_H 9#define _ASM_MUTEX_H
10/* 10/*
11 * On pre-ARMv6 hardware this results in a swp-based implementation, 11 * On pre-ARMv6 hardware this results in a swp-based implementation,
12 * which is the most efficient. For ARMv6+, we emit a pair of exclusive 12 * which is the most efficient. For ARMv6+, we have exclusive memory
13 * accesses instead. 13 * accessors and use atomic_dec to avoid the extra xchg operations
14 * on the locking slowpaths.
14 */ 15 */
16#if __LINUX_ARM_ARCH__ < 6
15#include <asm-generic/mutex-xchg.h> 17#include <asm-generic/mutex-xchg.h>
18#else
19#include <asm-generic/mutex-dec.h>
16#endif 20#endif
21#endif /* _ASM_MUTEX_H */
diff --git a/arch/arm/include/asm/opcodes-virt.h b/arch/arm/include/asm/opcodes-virt.h
new file mode 100644
index 000000000000..b85665a96f8e
--- /dev/null
+++ b/arch/arm/include/asm/opcodes-virt.h
@@ -0,0 +1,29 @@
1/*
2 * opcodes-virt.h: Opcode definitions for the ARM virtualization extensions
3 * Copyright (C) 2012 Linaro Limited
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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19#ifndef __ASM_ARM_OPCODES_VIRT_H
20#define __ASM_ARM_OPCODES_VIRT_H
21
22#include <asm/opcodes.h>
23
24#define __HVC(imm16) __inst_arm_thumb32( \
25 0xE1400070 | (((imm16) & 0xFFF0) << 4) | ((imm16) & 0x000F), \
26 0xF7E08000 | (((imm16) & 0xF000) << 4) | ((imm16) & 0x0FFF) \
27)
28
29#endif /* ! __ASM_ARM_OPCODES_VIRT_H */
diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h
index 19c48deda70f..74e211a6fb24 100644
--- a/arch/arm/include/asm/opcodes.h
+++ b/arch/arm/include/asm/opcodes.h
@@ -19,6 +19,33 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
19 19
20 20
21/* 21/*
22 * Assembler opcode byteswap helpers.
23 * These are only intended for use by this header: don't use them directly,
24 * because they will be suboptimal in most cases.
25 */
26#define ___asm_opcode_swab32(x) ( \
27 (((x) << 24) & 0xFF000000) \
28 | (((x) << 8) & 0x00FF0000) \
29 | (((x) >> 8) & 0x0000FF00) \
30 | (((x) >> 24) & 0x000000FF) \
31)
32#define ___asm_opcode_swab16(x) ( \
33 (((x) << 8) & 0xFF00) \
34 | (((x) >> 8) & 0x00FF) \
35)
36#define ___asm_opcode_swahb32(x) ( \
37 (((x) << 8) & 0xFF00FF00) \
38 | (((x) >> 8) & 0x00FF00FF) \
39)
40#define ___asm_opcode_swahw32(x) ( \
41 (((x) << 16) & 0xFFFF0000) \
42 | (((x) >> 16) & 0x0000FFFF) \
43)
44#define ___asm_opcode_identity32(x) ((x) & 0xFFFFFFFF)
45#define ___asm_opcode_identity16(x) ((x) & 0xFFFF)
46
47
48/*
22 * Opcode byteswap helpers 49 * Opcode byteswap helpers
23 * 50 *
24 * These macros help with converting instructions between a canonical integer 51 * These macros help with converting instructions between a canonical integer
@@ -41,39 +68,163 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
41 * Note that values in the range 0x0000E800..0xE7FFFFFF intentionally do not 68 * Note that values in the range 0x0000E800..0xE7FFFFFF intentionally do not
42 * represent any valid Thumb-2 instruction. For this range, 69 * represent any valid Thumb-2 instruction. For this range,
43 * __opcode_is_thumb32() and __opcode_is_thumb16() will both be false. 70 * __opcode_is_thumb32() and __opcode_is_thumb16() will both be false.
71 *
72 * The ___asm variants are intended only for use by this header, in situations
73 * involving inline assembler. For .S files, the normal __opcode_*() macros
74 * should do the right thing.
44 */ 75 */
76#ifdef __ASSEMBLY__
45 77
46#ifndef __ASSEMBLY__ 78#define ___opcode_swab32(x) ___asm_opcode_swab32(x)
79#define ___opcode_swab16(x) ___asm_opcode_swab16(x)
80#define ___opcode_swahb32(x) ___asm_opcode_swahb32(x)
81#define ___opcode_swahw32(x) ___asm_opcode_swahw32(x)
82#define ___opcode_identity32(x) ___asm_opcode_identity32(x)
83#define ___opcode_identity16(x) ___asm_opcode_identity16(x)
84
85#else /* ! __ASSEMBLY__ */
47 86
48#include <linux/types.h> 87#include <linux/types.h>
49#include <linux/swab.h> 88#include <linux/swab.h>
50 89
90#define ___opcode_swab32(x) swab32(x)
91#define ___opcode_swab16(x) swab16(x)
92#define ___opcode_swahb32(x) swahb32(x)
93#define ___opcode_swahw32(x) swahw32(x)
94#define ___opcode_identity32(x) ((u32)(x))
95#define ___opcode_identity16(x) ((u16)(x))
96
97#endif /* ! __ASSEMBLY__ */
98
99
51#ifdef CONFIG_CPU_ENDIAN_BE8 100#ifdef CONFIG_CPU_ENDIAN_BE8
52#define __opcode_to_mem_arm(x) swab32(x) 101
53#define __opcode_to_mem_thumb16(x) swab16(x) 102#define __opcode_to_mem_arm(x) ___opcode_swab32(x)
54#define __opcode_to_mem_thumb32(x) swahb32(x) 103#define __opcode_to_mem_thumb16(x) ___opcode_swab16(x)
55#else 104#define __opcode_to_mem_thumb32(x) ___opcode_swahb32(x)
56#define __opcode_to_mem_arm(x) ((u32)(x)) 105#define ___asm_opcode_to_mem_arm(x) ___asm_opcode_swab32(x)
57#define __opcode_to_mem_thumb16(x) ((u16)(x)) 106#define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_swab16(x)
58#define __opcode_to_mem_thumb32(x) swahw32(x) 107#define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahb32(x)
108
109#else /* ! CONFIG_CPU_ENDIAN_BE8 */
110
111#define __opcode_to_mem_arm(x) ___opcode_identity32(x)
112#define __opcode_to_mem_thumb16(x) ___opcode_identity16(x)
113#define ___asm_opcode_to_mem_arm(x) ___asm_opcode_identity32(x)
114#define ___asm_opcode_to_mem_thumb16(x) ___asm_opcode_identity16(x)
115#ifndef CONFIG_CPU_ENDIAN_BE32
116/*
117 * On BE32 systems, using 32-bit accesses to store Thumb instructions will not
118 * work in all cases, due to alignment constraints. For now, a correct
119 * version is not provided for BE32.
120 */
121#define __opcode_to_mem_thumb32(x) ___opcode_swahw32(x)
122#define ___asm_opcode_to_mem_thumb32(x) ___asm_opcode_swahw32(x)
59#endif 123#endif
60 124
125#endif /* ! CONFIG_CPU_ENDIAN_BE8 */
126
61#define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x) 127#define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x)
62#define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x) 128#define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x)
129#ifndef CONFIG_CPU_ENDIAN_BE32
63#define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x) 130#define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x)
131#endif
64 132
65/* Operations specific to Thumb opcodes */ 133/* Operations specific to Thumb opcodes */
66 134
67/* Instruction size checks: */ 135/* Instruction size checks: */
68#define __opcode_is_thumb32(x) ((u32)(x) >= 0xE8000000UL) 136#define __opcode_is_thumb32(x) ( \
69#define __opcode_is_thumb16(x) ((u32)(x) < 0xE800UL) 137 ((x) & 0xF8000000) == 0xE8000000 \
138 || ((x) & 0xF0000000) == 0xF0000000 \
139)
140#define __opcode_is_thumb16(x) ( \
141 ((x) & 0xFFFF0000) == 0 \
142 && !(((x) & 0xF800) == 0xE800 || ((x) & 0xF000) == 0xF000) \
143)
70 144
71/* Operations to construct or split 32-bit Thumb instructions: */ 145/* Operations to construct or split 32-bit Thumb instructions: */
72#define __opcode_thumb32_first(x) ((u16)((x) >> 16)) 146#define __opcode_thumb32_first(x) (___opcode_identity16((x) >> 16))
73#define __opcode_thumb32_second(x) ((u16)(x)) 147#define __opcode_thumb32_second(x) (___opcode_identity16(x))
74#define __opcode_thumb32_compose(first, second) \ 148#define __opcode_thumb32_compose(first, second) ( \
75 (((u32)(u16)(first) << 16) | (u32)(u16)(second)) 149 (___opcode_identity32(___opcode_identity16(first)) << 16) \
150 | ___opcode_identity32(___opcode_identity16(second)) \
151)
152#define ___asm_opcode_thumb32_first(x) (___asm_opcode_identity16((x) >> 16))
153#define ___asm_opcode_thumb32_second(x) (___asm_opcode_identity16(x))
154#define ___asm_opcode_thumb32_compose(first, second) ( \
155 (___asm_opcode_identity32(___asm_opcode_identity16(first)) << 16) \
156 | ___asm_opcode_identity32(___asm_opcode_identity16(second)) \
157)
76 158
77#endif /* __ASSEMBLY__ */ 159/*
160 * Opcode injection helpers
161 *
162 * In rare cases it is necessary to assemble an opcode which the
163 * assembler does not support directly, or which would normally be
164 * rejected because of the CFLAGS or AFLAGS used to build the affected
165 * file.
166 *
167 * Before using these macros, consider carefully whether it is feasible
168 * instead to change the build flags for your file, or whether it really
169 * makes sense to support old assembler versions when building that
170 * particular kernel feature.
171 *
172 * The macros defined here should only be used where there is no viable
173 * alternative.
174 *
175 *
176 * __inst_arm(x): emit the specified ARM opcode
177 * __inst_thumb16(x): emit the specified 16-bit Thumb opcode
178 * __inst_thumb32(x): emit the specified 32-bit Thumb opcode
179 *
180 * __inst_arm_thumb16(arm, thumb): emit either the specified arm or
181 * 16-bit Thumb opcode, depending on whether an ARM or Thumb-2
182 * kernel is being built
183 *
184 * __inst_arm_thumb32(arm, thumb): emit either the specified arm or
185 * 32-bit Thumb opcode, depending on whether an ARM or Thumb-2
186 * kernel is being built
187 *
188 *
189 * Note that using these macros directly is poor practice. Instead, you
190 * should use them to define human-readable wrapper macros to encode the
191 * instructions that you care about. In code which might run on ARMv7 or
192 * above, you can usually use the __inst_arm_thumb{16,32} macros to
193 * specify the ARM and Thumb alternatives at the same time. This ensures
194 * that the correct opcode gets emitted depending on the instruction set
195 * used for the kernel build.
196 *
197 * Look at opcodes-virt.h for an example of how to use these macros.
198 */
199#include <linux/stringify.h>
200
201#define __inst_arm(x) ___inst_arm(___asm_opcode_to_mem_arm(x))
202#define __inst_thumb32(x) ___inst_thumb32( \
203 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_first(x)), \
204 ___asm_opcode_to_mem_thumb16(___asm_opcode_thumb32_second(x)) \
205)
206#define __inst_thumb16(x) ___inst_thumb16(___asm_opcode_to_mem_thumb16(x))
207
208#ifdef CONFIG_THUMB2_KERNEL
209#define __inst_arm_thumb16(arm_opcode, thumb_opcode) \
210 __inst_thumb16(thumb_opcode)
211#define __inst_arm_thumb32(arm_opcode, thumb_opcode) \
212 __inst_thumb32(thumb_opcode)
213#else
214#define __inst_arm_thumb16(arm_opcode, thumb_opcode) __inst_arm(arm_opcode)
215#define __inst_arm_thumb32(arm_opcode, thumb_opcode) __inst_arm(arm_opcode)
216#endif
217
218/* Helpers for the helpers. Don't use these directly. */
219#ifdef __ASSEMBLY__
220#define ___inst_arm(x) .long x
221#define ___inst_thumb16(x) .short x
222#define ___inst_thumb32(first, second) .short first, second
223#else
224#define ___inst_arm(x) ".long " __stringify(x) "\n\t"
225#define ___inst_thumb16(x) ".short " __stringify(x) "\n\t"
226#define ___inst_thumb32(first, second) \
227 ".short " __stringify(first) ", " __stringify(second) "\n\t"
228#endif
78 229
79#endif /* __ASM_ARM_OPCODES_H */ 230#endif /* __ASM_ARM_OPCODES_H */
diff --git a/arch/arm/include/asm/param.h b/arch/arm/include/asm/param.h
deleted file mode 100644
index 8b24bf94c06b..000000000000
--- a/arch/arm/include/asm/param.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * arch/arm/include/asm/param.h
3 *
4 * Copyright (C) 1995-1999 Russell King
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#ifndef __ASM_PARAM_H
11#define __ASM_PARAM_H
12
13#ifdef __KERNEL__
14# define HZ CONFIG_HZ /* Internal kernel timer frequency */
15# define USER_HZ 100 /* User interfaces are in "ticks" */
16# define CLOCKS_PER_SEC (USER_HZ) /* like times() */
17#else
18# define HZ 100
19#endif
20
21#define EXEC_PAGESIZE 4096
22
23#ifndef NOGROUP
24#define NOGROUP (-1)
25#endif
26
27/* max length of hostname */
28#define MAXHOSTNAMELEN 64
29
30#endif
31
diff --git a/arch/arm/include/asm/parport.h b/arch/arm/include/asm/parport.h
deleted file mode 100644
index 26e94b09035a..000000000000
--- a/arch/arm/include/asm/parport.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * arch/arm/include/asm/parport.h: ARM-specific parport initialisation
3 *
4 * Copyright (C) 1999, 2000 Tim Waugh <tim@cyberelk.demon.co.uk>
5 *
6 * This file should only be included by drivers/parport/parport_pc.c.
7 */
8
9#ifndef __ASMARM_PARPORT_H
10#define __ASMARM_PARPORT_H
11
12static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
13static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
14{
15 return parport_pc_find_isa_ports (autoirq, autodma);
16}
17
18#endif /* !(_ASMARM_PARPORT_H) */
diff --git a/arch/arm/include/asm/segment.h b/arch/arm/include/asm/segment.h
deleted file mode 100644
index 9e24c21f6304..000000000000
--- a/arch/arm/include/asm/segment.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __ASM_ARM_SEGMENT_H
2#define __ASM_ARM_SEGMENT_H
3
4#define __KERNEL_CS 0x0
5#define __KERNEL_DS 0x0
6
7#define __USER_CS 0x1
8#define __USER_DS 0x1
9
10#endif /* __ASM_ARM_SEGMENT_H */
11
diff --git a/arch/arm/include/asm/sembuf.h b/arch/arm/include/asm/sembuf.h
deleted file mode 100644
index 1c0283954289..000000000000
--- a/arch/arm/include/asm/sembuf.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef _ASMARM_SEMBUF_H
2#define _ASMARM_SEMBUF_H
3
4/*
5 * The semid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct semid64_ds {
15 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
16 __kernel_time_t sem_otime; /* last semop time */
17 unsigned long __unused1;
18 __kernel_time_t sem_ctime; /* last change time */
19 unsigned long __unused2;
20 unsigned long sem_nsems; /* no. of semaphores in array */
21 unsigned long __unused3;
22 unsigned long __unused4;
23};
24
25#endif /* _ASMARM_SEMBUF_H */
diff --git a/arch/arm/include/asm/serial.h b/arch/arm/include/asm/serial.h
deleted file mode 100644
index ebb049091e26..000000000000
--- a/arch/arm/include/asm/serial.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/include/asm/serial.h
3 *
4 * Copyright (C) 1996 Russell King.
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 * Changelog:
11 * 15-10-1996 RMK Created
12 */
13
14#ifndef __ASM_SERIAL_H
15#define __ASM_SERIAL_H
16
17#define BASE_BAUD (1843200 / 16)
18
19#endif
diff --git a/arch/arm/include/asm/shmbuf.h b/arch/arm/include/asm/shmbuf.h
deleted file mode 100644
index 2e5c67ba1c97..000000000000
--- a/arch/arm/include/asm/shmbuf.h
+++ /dev/null
@@ -1,42 +0,0 @@
1#ifndef _ASMARM_SHMBUF_H
2#define _ASMARM_SHMBUF_H
3
4/*
5 * The shmid64_ds structure for arm architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 64-bit time_t to solve y2038 problem
11 * - 2 miscellaneous 32-bit values
12 */
13
14struct shmid64_ds {
15 struct ipc64_perm shm_perm; /* operation perms */
16 size_t shm_segsz; /* size of segment (bytes) */
17 __kernel_time_t shm_atime; /* last attach time */
18 unsigned long __unused1;
19 __kernel_time_t shm_dtime; /* last detach time */
20 unsigned long __unused2;
21 __kernel_time_t shm_ctime; /* last change time */
22 unsigned long __unused3;
23 __kernel_pid_t shm_cpid; /* pid of creator */
24 __kernel_pid_t shm_lpid; /* pid of last operator */
25 unsigned long shm_nattch; /* no. of current attaches */
26 unsigned long __unused4;
27 unsigned long __unused5;
28};
29
30struct shminfo64 {
31 unsigned long shmmax;
32 unsigned long shmmin;
33 unsigned long shmmni;
34 unsigned long shmseg;
35 unsigned long shmall;
36 unsigned long __unused1;
37 unsigned long __unused2;
38 unsigned long __unused3;
39 unsigned long __unused4;
40};
41
42#endif /* _ASMARM_SHMBUF_H */
diff --git a/arch/arm/include/asm/socket.h b/arch/arm/include/asm/socket.h
deleted file mode 100644
index 6433cadb6ed4..000000000000
--- a/arch/arm/include/asm/socket.h
+++ /dev/null
@@ -1,72 +0,0 @@
1#ifndef _ASMARM_SOCKET_H
2#define _ASMARM_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26#define SO_PASSCRED 16
27#define SO_PEERCRED 17
28#define SO_RCVLOWAT 18
29#define SO_SNDLOWAT 19
30#define SO_RCVTIMEO 20
31#define SO_SNDTIMEO 21
32
33/* Security levels - as per NRL IPv6 - don't actually do anything */
34#define SO_SECURITY_AUTHENTICATION 22
35#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
36#define SO_SECURITY_ENCRYPTION_NETWORK 24
37
38#define SO_BINDTODEVICE 25
39
40/* Socket filtering */
41#define SO_ATTACH_FILTER 26
42#define SO_DETACH_FILTER 27
43
44#define SO_PEERNAME 28
45#define SO_TIMESTAMP 29
46#define SCM_TIMESTAMP SO_TIMESTAMP
47
48#define SO_ACCEPTCONN 30
49
50#define SO_PEERSEC 31
51#define SO_PASSSEC 34
52#define SO_TIMESTAMPNS 35
53#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
54
55#define SO_MARK 36
56
57#define SO_TIMESTAMPING 37
58#define SCM_TIMESTAMPING SO_TIMESTAMPING
59
60#define SO_PROTOCOL 38
61#define SO_DOMAIN 39
62
63#define SO_RXQ_OVFL 40
64
65#define SO_WIFI_STATUS 41
66#define SCM_WIFI_STATUS SO_WIFI_STATUS
67#define SO_PEEK_OFF 42
68
69/* Instruct lower device to use last 4-bytes of skb data as FCS */
70#define SO_NOFCS 43
71
72#endif /* _ASM_SOCKET_H */
diff --git a/arch/arm/include/asm/sockios.h b/arch/arm/include/asm/sockios.h
deleted file mode 100644
index a2588a2512df..000000000000
--- a/arch/arm/include/asm/sockios.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef __ARCH_ARM_SOCKIOS_H
2#define __ARCH_ARM_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif
diff --git a/arch/arm/include/asm/syscall.h b/arch/arm/include/asm/syscall.h
index c334a23ddf75..9fdded6b1089 100644
--- a/arch/arm/include/asm/syscall.h
+++ b/arch/arm/include/asm/syscall.h
@@ -8,6 +8,11 @@
8#define _ASM_ARM_SYSCALL_H 8#define _ASM_ARM_SYSCALL_H
9 9
10#include <linux/err.h> 10#include <linux/err.h>
11#include <linux/sched.h>
12
13#include <asm/unistd.h>
14
15#define NR_syscalls (__NR_syscalls)
11 16
12extern const unsigned long sys_call_table[]; 17extern const unsigned long sys_call_table[];
13 18
diff --git a/arch/arm/include/asm/termbits.h b/arch/arm/include/asm/termbits.h
deleted file mode 100644
index 704135d28d1d..000000000000
--- a/arch/arm/include/asm/termbits.h
+++ /dev/null
@@ -1,198 +0,0 @@
1#ifndef __ASM_ARM_TERMBITS_H
2#define __ASM_ARM_TERMBITS_H
3
4typedef unsigned char cc_t;
5typedef unsigned int speed_t;
6typedef unsigned int tcflag_t;
7
8#define NCCS 19
9struct termios {
10 tcflag_t c_iflag; /* input mode flags */
11 tcflag_t c_oflag; /* output mode flags */
12 tcflag_t c_cflag; /* control mode flags */
13 tcflag_t c_lflag; /* local mode flags */
14 cc_t c_line; /* line discipline */
15 cc_t c_cc[NCCS]; /* control characters */
16};
17
18struct termios2 {
19 tcflag_t c_iflag; /* input mode flags */
20 tcflag_t c_oflag; /* output mode flags */
21 tcflag_t c_cflag; /* control mode flags */
22 tcflag_t c_lflag; /* local mode flags */
23 cc_t c_line; /* line discipline */
24 cc_t c_cc[NCCS]; /* control characters */
25 speed_t c_ispeed; /* input speed */
26 speed_t c_ospeed; /* output speed */
27};
28
29struct ktermios {
30 tcflag_t c_iflag; /* input mode flags */
31 tcflag_t c_oflag; /* output mode flags */
32 tcflag_t c_cflag; /* control mode flags */
33 tcflag_t c_lflag; /* local mode flags */
34 cc_t c_line; /* line discipline */
35 cc_t c_cc[NCCS]; /* control characters */
36 speed_t c_ispeed; /* input speed */
37 speed_t c_ospeed; /* output speed */
38};
39
40
41/* c_cc characters */
42#define VINTR 0
43#define VQUIT 1
44#define VERASE 2
45#define VKILL 3
46#define VEOF 4
47#define VTIME 5
48#define VMIN 6
49#define VSWTC 7
50#define VSTART 8
51#define VSTOP 9
52#define VSUSP 10
53#define VEOL 11
54#define VREPRINT 12
55#define VDISCARD 13
56#define VWERASE 14
57#define VLNEXT 15
58#define VEOL2 16
59
60/* c_iflag bits */
61#define IGNBRK 0000001
62#define BRKINT 0000002
63#define IGNPAR 0000004
64#define PARMRK 0000010
65#define INPCK 0000020
66#define ISTRIP 0000040
67#define INLCR 0000100
68#define IGNCR 0000200
69#define ICRNL 0000400
70#define IUCLC 0001000
71#define IXON 0002000
72#define IXANY 0004000
73#define IXOFF 0010000
74#define IMAXBEL 0020000
75#define IUTF8 0040000
76
77/* c_oflag bits */
78#define OPOST 0000001
79#define OLCUC 0000002
80#define ONLCR 0000004
81#define OCRNL 0000010
82#define ONOCR 0000020
83#define ONLRET 0000040
84#define OFILL 0000100
85#define OFDEL 0000200
86#define NLDLY 0000400
87#define NL0 0000000
88#define NL1 0000400
89#define CRDLY 0003000
90#define CR0 0000000
91#define CR1 0001000
92#define CR2 0002000
93#define CR3 0003000
94#define TABDLY 0014000
95#define TAB0 0000000
96#define TAB1 0004000
97#define TAB2 0010000
98#define TAB3 0014000
99#define XTABS 0014000
100#define BSDLY 0020000
101#define BS0 0000000
102#define BS1 0020000
103#define VTDLY 0040000
104#define VT0 0000000
105#define VT1 0040000
106#define FFDLY 0100000
107#define FF0 0000000
108#define FF1 0100000
109
110/* c_cflag bit meaning */
111#define CBAUD 0010017
112#define B0 0000000 /* hang up */
113#define B50 0000001
114#define B75 0000002
115#define B110 0000003
116#define B134 0000004
117#define B150 0000005
118#define B200 0000006
119#define B300 0000007
120#define B600 0000010
121#define B1200 0000011
122#define B1800 0000012
123#define B2400 0000013
124#define B4800 0000014
125#define B9600 0000015
126#define B19200 0000016
127#define B38400 0000017
128#define EXTA B19200
129#define EXTB B38400
130#define CSIZE 0000060
131#define CS5 0000000
132#define CS6 0000020
133#define CS7 0000040
134#define CS8 0000060
135#define CSTOPB 0000100
136#define CREAD 0000200
137#define PARENB 0000400
138#define PARODD 0001000
139#define HUPCL 0002000
140#define CLOCAL 0004000
141#define CBAUDEX 0010000
142#define BOTHER 0010000
143#define B57600 0010001
144#define B115200 0010002
145#define B230400 0010003
146#define B460800 0010004
147#define B500000 0010005
148#define B576000 0010006
149#define B921600 0010007
150#define B1000000 0010010
151#define B1152000 0010011
152#define B1500000 0010012
153#define B2000000 0010013
154#define B2500000 0010014
155#define B3000000 0010015
156#define B3500000 0010016
157#define B4000000 0010017
158#define CIBAUD 002003600000 /* input baud rate */
159#define CMSPAR 010000000000 /* mark or space (stick) parity */
160#define CRTSCTS 020000000000 /* flow control */
161
162#define IBSHIFT 16
163
164/* c_lflag bits */
165#define ISIG 0000001
166#define ICANON 0000002
167#define XCASE 0000004
168#define ECHO 0000010
169#define ECHOE 0000020
170#define ECHOK 0000040
171#define ECHONL 0000100
172#define NOFLSH 0000200
173#define TOSTOP 0000400
174#define ECHOCTL 0001000
175#define ECHOPRT 0002000
176#define ECHOKE 0004000
177#define FLUSHO 0010000
178#define PENDIN 0040000
179#define IEXTEN 0100000
180#define EXTPROC 0200000
181
182/* tcflow() and TCXONC use these */
183#define TCOOFF 0
184#define TCOON 1
185#define TCIOFF 2
186#define TCION 3
187
188/* tcflush() and TCFLSH use these */
189#define TCIFLUSH 0
190#define TCOFLUSH 1
191#define TCIOFLUSH 2
192
193/* tcsetattr uses these */
194#define TCSANOW 0
195#define TCSADRAIN 1
196#define TCSAFLUSH 2
197
198#endif /* __ASM_ARM_TERMBITS_H */
diff --git a/arch/arm/include/asm/termios.h b/arch/arm/include/asm/termios.h
deleted file mode 100644
index 293e3f1bc3f2..000000000000
--- a/arch/arm/include/asm/termios.h
+++ /dev/null
@@ -1,92 +0,0 @@
1#ifndef __ASM_ARM_TERMIOS_H
2#define __ASM_ARM_TERMIOS_H
3
4#include <asm/termbits.h>
5#include <asm/ioctls.h>
6
7struct winsize {
8 unsigned short ws_row;
9 unsigned short ws_col;
10 unsigned short ws_xpixel;
11 unsigned short ws_ypixel;
12};
13
14#define NCC 8
15struct termio {
16 unsigned short c_iflag; /* input mode flags */
17 unsigned short c_oflag; /* output mode flags */
18 unsigned short c_cflag; /* control mode flags */
19 unsigned short c_lflag; /* local mode flags */
20 unsigned char c_line; /* line discipline */
21 unsigned char c_cc[NCC]; /* control characters */
22};
23
24#ifdef __KERNEL__
25/* intr=^C quit=^| erase=del kill=^U
26 eof=^D vtime=\0 vmin=\1 sxtc=\0
27 start=^Q stop=^S susp=^Z eol=\0
28 reprint=^R discard=^U werase=^W lnext=^V
29 eol2=\0
30*/
31#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
32#endif
33
34/* modem lines */
35#define TIOCM_LE 0x001
36#define TIOCM_DTR 0x002
37#define TIOCM_RTS 0x004
38#define TIOCM_ST 0x008
39#define TIOCM_SR 0x010
40#define TIOCM_CTS 0x020
41#define TIOCM_CAR 0x040
42#define TIOCM_RNG 0x080
43#define TIOCM_DSR 0x100
44#define TIOCM_CD TIOCM_CAR
45#define TIOCM_RI TIOCM_RNG
46#define TIOCM_OUT1 0x2000
47#define TIOCM_OUT2 0x4000
48#define TIOCM_LOOP 0x8000
49
50/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
51
52#ifdef __KERNEL__
53
54/*
55 * Translate a "termio" structure into a "termios". Ugh.
56 */
57#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
58 unsigned short __tmp; \
59 get_user(__tmp,&(termio)->x); \
60 *(unsigned short *) &(termios)->x = __tmp; \
61}
62
63#define user_termio_to_kernel_termios(termios, termio) \
64({ \
65 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
66 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
67 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
68 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
69 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
70})
71
72/*
73 * Translate a "termios" structure into a "termio". Ugh.
74 */
75#define kernel_termios_to_user_termio(termio, termios) \
76({ \
77 put_user((termios)->c_iflag, &(termio)->c_iflag); \
78 put_user((termios)->c_oflag, &(termio)->c_oflag); \
79 put_user((termios)->c_cflag, &(termio)->c_cflag); \
80 put_user((termios)->c_lflag, &(termio)->c_lflag); \
81 put_user((termios)->c_line, &(termio)->c_line); \
82 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
83})
84
85#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
86#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
87#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
88#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
89
90#endif /* __KERNEL__ */
91
92#endif /* __ASM_ARM_TERMIOS_H */
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index af7b0bda3355..f71cdab18b87 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -59,7 +59,9 @@ struct thread_info {
59 __u32 syscall; /* syscall number */ 59 __u32 syscall; /* syscall number */
60 __u8 used_cp[16]; /* thread used copro */ 60 __u8 used_cp[16]; /* thread used copro */
61 unsigned long tp_value; 61 unsigned long tp_value;
62#ifdef CONFIG_CRUNCH
62 struct crunch_state crunchstate; 63 struct crunch_state crunchstate;
64#endif
63 union fp_state fpstate __attribute__((aligned(8))); 65 union fp_state fpstate __attribute__((aligned(8)));
64 union vfp_state vfpstate; 66 union vfp_state vfpstate;
65#ifdef CONFIG_ARM_THUMBEE 67#ifdef CONFIG_ARM_THUMBEE
@@ -148,6 +150,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
148#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */ 150#define TIF_NOTIFY_RESUME 2 /* callback before returning to user */
149#define TIF_SYSCALL_TRACE 8 151#define TIF_SYSCALL_TRACE 8
150#define TIF_SYSCALL_AUDIT 9 152#define TIF_SYSCALL_AUDIT 9
153#define TIF_SYSCALL_TRACEPOINT 10
151#define TIF_POLLING_NRFLAG 16 154#define TIF_POLLING_NRFLAG 16
152#define TIF_USING_IWMMXT 17 155#define TIF_USING_IWMMXT 17
153#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 156#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
@@ -160,12 +163,13 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
160#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 163#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
161#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 164#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
162#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 165#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
166#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
163#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 167#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
164#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT) 168#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
165#define _TIF_SECCOMP (1 << TIF_SECCOMP) 169#define _TIF_SECCOMP (1 << TIF_SECCOMP)
166 170
167/* Checks for any syscall work in entry-common.S */ 171/* Checks for any syscall work in entry-common.S */
168#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT) 172#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
169 173
170/* 174/*
171 * Change these and you break ASM code in entry-common.S 175 * Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/include/asm/timex.h b/arch/arm/include/asm/timex.h
index 963342acebb7..83f2aa83899c 100644
--- a/arch/arm/include/asm/timex.h
+++ b/arch/arm/include/asm/timex.h
@@ -12,7 +12,6 @@
12#ifndef _ASMARM_TIMEX_H 12#ifndef _ASMARM_TIMEX_H
13#define _ASMARM_TIMEX_H 13#define _ASMARM_TIMEX_H
14 14
15#include <asm/arch_timer.h>
16#ifdef CONFIG_ARCH_MULTIPLATFORM 15#ifdef CONFIG_ARCH_MULTIPLATFORM
17#define CLOCK_TICK_RATE 1000000 16#define CLOCK_TICK_RATE 1000000
18#else 17#else
@@ -20,11 +19,6 @@
20#endif 19#endif
21 20
22typedef unsigned long cycles_t; 21typedef unsigned long cycles_t;
23
24#ifdef ARCH_HAS_READ_CURRENT_TIMER
25#define get_cycles() ({ cycles_t c; read_current_timer(&c) ? 0 : c; }) 22#define get_cycles() ({ cycles_t c; read_current_timer(&c) ? 0 : c; })
26#else
27#define get_cycles() (0)
28#endif
29 23
30#endif 24#endif
diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
deleted file mode 100644
index 28beab917ffc..000000000000
--- a/arch/arm/include/asm/types.h
+++ /dev/null
@@ -1,16 +0,0 @@
1#ifndef __ASM_ARM_TYPES_H
2#define __ASM_ARM_TYPES_H
3
4#include <asm-generic/int-ll64.h>
5
6/*
7 * These aren't exported outside the kernel to avoid name space clashes
8 */
9#ifdef __KERNEL__
10
11#define BITS_PER_LONG 32
12
13#endif /* __KERNEL__ */
14
15#endif
16
diff --git a/arch/arm/include/asm/unaligned.h b/arch/arm/include/asm/unaligned.h
deleted file mode 100644
index 44593a894903..000000000000
--- a/arch/arm/include/asm/unaligned.h
+++ /dev/null
@@ -1,19 +0,0 @@
1#ifndef _ASM_ARM_UNALIGNED_H
2#define _ASM_ARM_UNALIGNED_H
3
4#include <linux/unaligned/le_byteshift.h>
5#include <linux/unaligned/be_byteshift.h>
6#include <linux/unaligned/generic.h>
7
8/*
9 * Select endianness
10 */
11#ifndef __ARMEB__
12#define get_unaligned __get_unaligned_le
13#define put_unaligned __put_unaligned_le
14#else
15#define get_unaligned __get_unaligned_be
16#define put_unaligned __put_unaligned_be
17#endif
18
19#endif /* _ASM_ARM_UNALIGNED_H */
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 2fde5fd1acce..d9ff5cc3a506 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -407,6 +407,14 @@
407 /* 378 for kcmp */ 407 /* 378 for kcmp */
408 408
409/* 409/*
410 * This may need to be greater than __NR_last_syscall+1 in order to
411 * account for the padding in the syscall table
412 */
413#ifdef __KERNEL__
414#define __NR_syscalls (380)
415#endif /* __KERNEL__ */
416
417/*
410 * The following SWIs are ARM private. 418 * The following SWIs are ARM private.
411 */ 419 */
412#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000) 420#define __ARM_NR_BASE (__NR_SYSCALL_BASE+0x0f0000)
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index d81f3a6d9ad8..5dfef9d97ed9 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -19,7 +19,9 @@ obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
19 process.o ptrace.o return_address.o sched_clock.o \ 19 process.o ptrace.o return_address.o sched_clock.o \
20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o 20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
21 21
22obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o 22obj-$(CONFIG_ATAGS) += atags_parse.o
23obj-$(CONFIG_ATAGS_PROC) += atags_proc.o
24obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o
23 25
24obj-$(CONFIG_OC_ETM) += etm.o 26obj-$(CONFIG_OC_ETM) += etm.o
25obj-$(CONFIG_CPU_IDLE) += cpuidle.o 27obj-$(CONFIG_CPU_IDLE) += cpuidle.o
@@ -51,7 +53,6 @@ test-kprobes-objs += kprobes-test-thumb.o
51else 53else
52test-kprobes-objs += kprobes-test-arm.o 54test-kprobes-objs += kprobes-test-arm.o
53endif 55endif
54obj-$(CONFIG_ATAGS_PROC) += atags.o
55obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o 56obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
56obj-$(CONFIG_ARM_THUMBEE) += thumbee.o 57obj-$(CONFIG_ARM_THUMBEE) += thumbee.o
57obj-$(CONFIG_KGDB) += kgdb.o 58obj-$(CONFIG_KGDB) += kgdb.o
diff --git a/arch/arm/kernel/arch_timer.c b/arch/arm/kernel/arch_timer.c
index cf258807160d..c8ef20747ee7 100644
--- a/arch/arm/kernel/arch_timer.c
+++ b/arch/arm/kernel/arch_timer.c
@@ -21,18 +21,28 @@
21#include <linux/io.h> 21#include <linux/io.h>
22 22
23#include <asm/cputype.h> 23#include <asm/cputype.h>
24#include <asm/delay.h>
24#include <asm/localtimer.h> 25#include <asm/localtimer.h>
25#include <asm/arch_timer.h> 26#include <asm/arch_timer.h>
26#include <asm/system_info.h> 27#include <asm/system_info.h>
27#include <asm/sched_clock.h> 28#include <asm/sched_clock.h>
28 29
29static unsigned long arch_timer_rate; 30static unsigned long arch_timer_rate;
30static int arch_timer_ppi; 31
31static int arch_timer_ppi2; 32enum ppi_nr {
33 PHYS_SECURE_PPI,
34 PHYS_NONSECURE_PPI,
35 VIRT_PPI,
36 HYP_PPI,
37 MAX_TIMER_PPI
38};
39
40static int arch_timer_ppi[MAX_TIMER_PPI];
32 41
33static struct clock_event_device __percpu **arch_timer_evt; 42static struct clock_event_device __percpu **arch_timer_evt;
43static struct delay_timer arch_delay_timer;
34 44
35extern void init_current_timer_delay(unsigned long freq); 45static bool arch_timer_use_virtual = true;
36 46
37/* 47/*
38 * Architected system timer support. 48 * Architected system timer support.
@@ -46,50 +56,104 @@ extern void init_current_timer_delay(unsigned long freq);
46#define ARCH_TIMER_REG_FREQ 1 56#define ARCH_TIMER_REG_FREQ 1
47#define ARCH_TIMER_REG_TVAL 2 57#define ARCH_TIMER_REG_TVAL 2
48 58
49static void arch_timer_reg_write(int reg, u32 val) 59#define ARCH_TIMER_PHYS_ACCESS 0
60#define ARCH_TIMER_VIRT_ACCESS 1
61
62/*
63 * These register accessors are marked inline so the compiler can
64 * nicely work out which register we want, and chuck away the rest of
65 * the code. At least it does so with a recent GCC (4.6.3).
66 */
67static inline void arch_timer_reg_write(const int access, const int reg, u32 val)
50{ 68{
51 switch (reg) { 69 if (access == ARCH_TIMER_PHYS_ACCESS) {
52 case ARCH_TIMER_REG_CTRL: 70 switch (reg) {
53 asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" (val)); 71 case ARCH_TIMER_REG_CTRL:
54 break; 72 asm volatile("mcr p15, 0, %0, c14, c2, 1" : : "r" (val));
55 case ARCH_TIMER_REG_TVAL: 73 break;
56 asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" (val)); 74 case ARCH_TIMER_REG_TVAL:
57 break; 75 asm volatile("mcr p15, 0, %0, c14, c2, 0" : : "r" (val));
76 break;
77 }
78 }
79
80 if (access == ARCH_TIMER_VIRT_ACCESS) {
81 switch (reg) {
82 case ARCH_TIMER_REG_CTRL:
83 asm volatile("mcr p15, 0, %0, c14, c3, 1" : : "r" (val));
84 break;
85 case ARCH_TIMER_REG_TVAL:
86 asm volatile("mcr p15, 0, %0, c14, c3, 0" : : "r" (val));
87 break;
88 }
58 } 89 }
59 90
60 isb(); 91 isb();
61} 92}
62 93
63static u32 arch_timer_reg_read(int reg) 94static inline u32 arch_timer_reg_read(const int access, const int reg)
64{ 95{
65 u32 val; 96 u32 val = 0;
97
98 if (access == ARCH_TIMER_PHYS_ACCESS) {
99 switch (reg) {
100 case ARCH_TIMER_REG_CTRL:
101 asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val));
102 break;
103 case ARCH_TIMER_REG_TVAL:
104 asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val));
105 break;
106 case ARCH_TIMER_REG_FREQ:
107 asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val));
108 break;
109 }
110 }
66 111
67 switch (reg) { 112 if (access == ARCH_TIMER_VIRT_ACCESS) {
68 case ARCH_TIMER_REG_CTRL: 113 switch (reg) {
69 asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val)); 114 case ARCH_TIMER_REG_CTRL:
70 break; 115 asm volatile("mrc p15, 0, %0, c14, c3, 1" : "=r" (val));
71 case ARCH_TIMER_REG_FREQ: 116 break;
72 asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val)); 117 case ARCH_TIMER_REG_TVAL:
73 break; 118 asm volatile("mrc p15, 0, %0, c14, c3, 0" : "=r" (val));
74 case ARCH_TIMER_REG_TVAL: 119 break;
75 asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val)); 120 }
76 break;
77 default:
78 BUG();
79 } 121 }
80 122
81 return val; 123 return val;
82} 124}
83 125
84static irqreturn_t arch_timer_handler(int irq, void *dev_id) 126static inline cycle_t arch_timer_counter_read(const int access)
85{ 127{
86 struct clock_event_device *evt = *(struct clock_event_device **)dev_id; 128 cycle_t cval = 0;
87 unsigned long ctrl; 129
130 if (access == ARCH_TIMER_PHYS_ACCESS)
131 asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (cval));
132
133 if (access == ARCH_TIMER_VIRT_ACCESS)
134 asm volatile("mrrc p15, 1, %Q0, %R0, c14" : "=r" (cval));
135
136 return cval;
137}
138
139static inline cycle_t arch_counter_get_cntpct(void)
140{
141 return arch_timer_counter_read(ARCH_TIMER_PHYS_ACCESS);
142}
88 143
89 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL); 144static inline cycle_t arch_counter_get_cntvct(void)
145{
146 return arch_timer_counter_read(ARCH_TIMER_VIRT_ACCESS);
147}
148
149static irqreturn_t inline timer_handler(const int access,
150 struct clock_event_device *evt)
151{
152 unsigned long ctrl;
153 ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
90 if (ctrl & ARCH_TIMER_CTRL_IT_STAT) { 154 if (ctrl & ARCH_TIMER_CTRL_IT_STAT) {
91 ctrl |= ARCH_TIMER_CTRL_IT_MASK; 155 ctrl |= ARCH_TIMER_CTRL_IT_MASK;
92 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl); 156 arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl);
93 evt->event_handler(evt); 157 evt->event_handler(evt);
94 return IRQ_HANDLED; 158 return IRQ_HANDLED;
95 } 159 }
@@ -97,63 +161,100 @@ static irqreturn_t arch_timer_handler(int irq, void *dev_id)
97 return IRQ_NONE; 161 return IRQ_NONE;
98} 162}
99 163
100static void arch_timer_disable(void) 164static irqreturn_t arch_timer_handler_virt(int irq, void *dev_id)
101{ 165{
102 unsigned long ctrl; 166 struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
103 167
104 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL); 168 return timer_handler(ARCH_TIMER_VIRT_ACCESS, evt);
105 ctrl &= ~ARCH_TIMER_CTRL_ENABLE;
106 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl);
107} 169}
108 170
109static void arch_timer_set_mode(enum clock_event_mode mode, 171static irqreturn_t arch_timer_handler_phys(int irq, void *dev_id)
110 struct clock_event_device *clk)
111{ 172{
173 struct clock_event_device *evt = *(struct clock_event_device **)dev_id;
174
175 return timer_handler(ARCH_TIMER_PHYS_ACCESS, evt);
176}
177
178static inline void timer_set_mode(const int access, int mode)
179{
180 unsigned long ctrl;
112 switch (mode) { 181 switch (mode) {
113 case CLOCK_EVT_MODE_UNUSED: 182 case CLOCK_EVT_MODE_UNUSED:
114 case CLOCK_EVT_MODE_SHUTDOWN: 183 case CLOCK_EVT_MODE_SHUTDOWN:
115 arch_timer_disable(); 184 ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
185 ctrl &= ~ARCH_TIMER_CTRL_ENABLE;
186 arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl);
116 break; 187 break;
117 default: 188 default:
118 break; 189 break;
119 } 190 }
120} 191}
121 192
122static int arch_timer_set_next_event(unsigned long evt, 193static void arch_timer_set_mode_virt(enum clock_event_mode mode,
123 struct clock_event_device *unused) 194 struct clock_event_device *clk)
124{ 195{
125 unsigned long ctrl; 196 timer_set_mode(ARCH_TIMER_VIRT_ACCESS, mode);
197}
126 198
127 ctrl = arch_timer_reg_read(ARCH_TIMER_REG_CTRL); 199static void arch_timer_set_mode_phys(enum clock_event_mode mode,
200 struct clock_event_device *clk)
201{
202 timer_set_mode(ARCH_TIMER_PHYS_ACCESS, mode);
203}
204
205static inline void set_next_event(const int access, unsigned long evt)
206{
207 unsigned long ctrl;
208 ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
128 ctrl |= ARCH_TIMER_CTRL_ENABLE; 209 ctrl |= ARCH_TIMER_CTRL_ENABLE;
129 ctrl &= ~ARCH_TIMER_CTRL_IT_MASK; 210 ctrl &= ~ARCH_TIMER_CTRL_IT_MASK;
211 arch_timer_reg_write(access, ARCH_TIMER_REG_TVAL, evt);
212 arch_timer_reg_write(access, ARCH_TIMER_REG_CTRL, ctrl);
213}
130 214
131 arch_timer_reg_write(ARCH_TIMER_REG_TVAL, evt); 215static int arch_timer_set_next_event_virt(unsigned long evt,
132 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, ctrl); 216 struct clock_event_device *unused)
217{
218 set_next_event(ARCH_TIMER_VIRT_ACCESS, evt);
219 return 0;
220}
133 221
222static int arch_timer_set_next_event_phys(unsigned long evt,
223 struct clock_event_device *unused)
224{
225 set_next_event(ARCH_TIMER_PHYS_ACCESS, evt);
134 return 0; 226 return 0;
135} 227}
136 228
137static int __cpuinit arch_timer_setup(struct clock_event_device *clk) 229static int __cpuinit arch_timer_setup(struct clock_event_device *clk)
138{ 230{
139 /* Be safe... */
140 arch_timer_disable();
141
142 clk->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP; 231 clk->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP;
143 clk->name = "arch_sys_timer"; 232 clk->name = "arch_sys_timer";
144 clk->rating = 450; 233 clk->rating = 450;
145 clk->set_mode = arch_timer_set_mode; 234 if (arch_timer_use_virtual) {
146 clk->set_next_event = arch_timer_set_next_event; 235 clk->irq = arch_timer_ppi[VIRT_PPI];
147 clk->irq = arch_timer_ppi; 236 clk->set_mode = arch_timer_set_mode_virt;
237 clk->set_next_event = arch_timer_set_next_event_virt;
238 } else {
239 clk->irq = arch_timer_ppi[PHYS_SECURE_PPI];
240 clk->set_mode = arch_timer_set_mode_phys;
241 clk->set_next_event = arch_timer_set_next_event_phys;
242 }
243
244 clk->set_mode(CLOCK_EVT_MODE_SHUTDOWN, NULL);
148 245
149 clockevents_config_and_register(clk, arch_timer_rate, 246 clockevents_config_and_register(clk, arch_timer_rate,
150 0xf, 0x7fffffff); 247 0xf, 0x7fffffff);
151 248
152 *__this_cpu_ptr(arch_timer_evt) = clk; 249 *__this_cpu_ptr(arch_timer_evt) = clk;
153 250
154 enable_percpu_irq(clk->irq, 0); 251 if (arch_timer_use_virtual)
155 if (arch_timer_ppi2) 252 enable_percpu_irq(arch_timer_ppi[VIRT_PPI], 0);
156 enable_percpu_irq(arch_timer_ppi2, 0); 253 else {
254 enable_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI], 0);
255 if (arch_timer_ppi[PHYS_NONSECURE_PPI])
256 enable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI], 0);
257 }
157 258
158 return 0; 259 return 0;
159} 260}
@@ -173,8 +274,8 @@ static int arch_timer_available(void)
173 return -ENXIO; 274 return -ENXIO;
174 275
175 if (arch_timer_rate == 0) { 276 if (arch_timer_rate == 0) {
176 arch_timer_reg_write(ARCH_TIMER_REG_CTRL, 0); 277 freq = arch_timer_reg_read(ARCH_TIMER_PHYS_ACCESS,
177 freq = arch_timer_reg_read(ARCH_TIMER_REG_FREQ); 278 ARCH_TIMER_REG_FREQ);
178 279
179 /* Check the timer frequency. */ 280 /* Check the timer frequency. */
180 if (freq == 0) { 281 if (freq == 0) {
@@ -185,52 +286,57 @@ static int arch_timer_available(void)
185 arch_timer_rate = freq; 286 arch_timer_rate = freq;
186 } 287 }
187 288
188 pr_info_once("Architected local timer running at %lu.%02luMHz.\n", 289 pr_info_once("Architected local timer running at %lu.%02luMHz (%s).\n",
189 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100); 290 arch_timer_rate / 1000000, (arch_timer_rate / 10000) % 100,
291 arch_timer_use_virtual ? "virt" : "phys");
190 return 0; 292 return 0;
191} 293}
192 294
193static inline cycle_t arch_counter_get_cntpct(void) 295static u32 notrace arch_counter_get_cntpct32(void)
194{ 296{
195 u32 cvall, cvalh; 297 cycle_t cnt = arch_counter_get_cntpct();
196
197 asm volatile("mrrc p15, 0, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
198 298
199 return ((cycle_t) cvalh << 32) | cvall; 299 /*
200} 300 * The sched_clock infrastructure only knows about counters
201 301 * with at most 32bits. Forget about the upper 24 bits for the
202static inline cycle_t arch_counter_get_cntvct(void) 302 * time being...
203{ 303 */
204 u32 cvall, cvalh; 304 return (u32)cnt;
205
206 asm volatile("mrrc p15, 1, %0, %1, c14" : "=r" (cvall), "=r" (cvalh));
207
208 return ((cycle_t) cvalh << 32) | cvall;
209} 305}
210 306
211static u32 notrace arch_counter_get_cntvct32(void) 307static u32 notrace arch_counter_get_cntvct32(void)
212{ 308{
213 cycle_t cntvct = arch_counter_get_cntvct(); 309 cycle_t cnt = arch_counter_get_cntvct();
214 310
215 /* 311 /*
216 * The sched_clock infrastructure only knows about counters 312 * The sched_clock infrastructure only knows about counters
217 * with at most 32bits. Forget about the upper 24 bits for the 313 * with at most 32bits. Forget about the upper 24 bits for the
218 * time being... 314 * time being...
219 */ 315 */
220 return (u32)(cntvct & (u32)~0); 316 return (u32)cnt;
221} 317}
222 318
223static cycle_t arch_counter_read(struct clocksource *cs) 319static cycle_t arch_counter_read(struct clocksource *cs)
224{ 320{
321 /*
322 * Always use the physical counter for the clocksource.
323 * CNTHCTL.PL1PCTEN must be set to 1.
324 */
225 return arch_counter_get_cntpct(); 325 return arch_counter_get_cntpct();
226} 326}
227 327
228int read_current_timer(unsigned long *timer_val) 328static unsigned long arch_timer_read_current_timer(void)
229{ 329{
230 if (!arch_timer_rate) 330 return arch_counter_get_cntpct();
231 return -ENXIO; 331}
232 *timer_val = arch_counter_get_cntpct(); 332
233 return 0; 333static cycle_t arch_counter_read_cc(const struct cyclecounter *cc)
334{
335 /*
336 * Always use the physical counter for the clocksource.
337 * CNTHCTL.PL1PCTEN must be set to 1.
338 */
339 return arch_counter_get_cntpct();
234} 340}
235 341
236static struct clocksource clocksource_counter = { 342static struct clocksource clocksource_counter = {
@@ -241,14 +347,32 @@ static struct clocksource clocksource_counter = {
241 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 347 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
242}; 348};
243 349
350static struct cyclecounter cyclecounter = {
351 .read = arch_counter_read_cc,
352 .mask = CLOCKSOURCE_MASK(56),
353};
354
355static struct timecounter timecounter;
356
357struct timecounter *arch_timer_get_timecounter(void)
358{
359 return &timecounter;
360}
361
244static void __cpuinit arch_timer_stop(struct clock_event_device *clk) 362static void __cpuinit arch_timer_stop(struct clock_event_device *clk)
245{ 363{
246 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n", 364 pr_debug("arch_timer_teardown disable IRQ%d cpu #%d\n",
247 clk->irq, smp_processor_id()); 365 clk->irq, smp_processor_id());
248 disable_percpu_irq(clk->irq); 366
249 if (arch_timer_ppi2) 367 if (arch_timer_use_virtual)
250 disable_percpu_irq(arch_timer_ppi2); 368 disable_percpu_irq(arch_timer_ppi[VIRT_PPI]);
251 arch_timer_set_mode(CLOCK_EVT_MODE_UNUSED, clk); 369 else {
370 disable_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI]);
371 if (arch_timer_ppi[PHYS_NONSECURE_PPI])
372 disable_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI]);
373 }
374
375 clk->set_mode(CLOCK_EVT_MODE_UNUSED, clk);
252} 376}
253 377
254static struct local_timer_ops arch_timer_ops __cpuinitdata = { 378static struct local_timer_ops arch_timer_ops __cpuinitdata = {
@@ -261,36 +385,48 @@ static struct clock_event_device arch_timer_global_evt;
261static int __init arch_timer_register(void) 385static int __init arch_timer_register(void)
262{ 386{
263 int err; 387 int err;
388 int ppi;
264 389
265 err = arch_timer_available(); 390 err = arch_timer_available();
266 if (err) 391 if (err)
267 return err; 392 goto out;
268 393
269 arch_timer_evt = alloc_percpu(struct clock_event_device *); 394 arch_timer_evt = alloc_percpu(struct clock_event_device *);
270 if (!arch_timer_evt) 395 if (!arch_timer_evt) {
271 return -ENOMEM; 396 err = -ENOMEM;
397 goto out;
398 }
272 399
273 clocksource_register_hz(&clocksource_counter, arch_timer_rate); 400 clocksource_register_hz(&clocksource_counter, arch_timer_rate);
401 cyclecounter.mult = clocksource_counter.mult;
402 cyclecounter.shift = clocksource_counter.shift;
403 timecounter_init(&timecounter, &cyclecounter,
404 arch_counter_get_cntpct());
405
406 if (arch_timer_use_virtual) {
407 ppi = arch_timer_ppi[VIRT_PPI];
408 err = request_percpu_irq(ppi, arch_timer_handler_virt,
409 "arch_timer", arch_timer_evt);
410 } else {
411 ppi = arch_timer_ppi[PHYS_SECURE_PPI];
412 err = request_percpu_irq(ppi, arch_timer_handler_phys,
413 "arch_timer", arch_timer_evt);
414 if (!err && arch_timer_ppi[PHYS_NONSECURE_PPI]) {
415 ppi = arch_timer_ppi[PHYS_NONSECURE_PPI];
416 err = request_percpu_irq(ppi, arch_timer_handler_phys,
417 "arch_timer", arch_timer_evt);
418 if (err)
419 free_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI],
420 arch_timer_evt);
421 }
422 }
274 423
275 err = request_percpu_irq(arch_timer_ppi, arch_timer_handler,
276 "arch_timer", arch_timer_evt);
277 if (err) { 424 if (err) {
278 pr_err("arch_timer: can't register interrupt %d (%d)\n", 425 pr_err("arch_timer: can't register interrupt %d (%d)\n",
279 arch_timer_ppi, err); 426 ppi, err);
280 goto out_free; 427 goto out_free;
281 } 428 }
282 429
283 if (arch_timer_ppi2) {
284 err = request_percpu_irq(arch_timer_ppi2, arch_timer_handler,
285 "arch_timer", arch_timer_evt);
286 if (err) {
287 pr_err("arch_timer: can't register interrupt %d (%d)\n",
288 arch_timer_ppi2, err);
289 arch_timer_ppi2 = 0;
290 goto out_free_irq;
291 }
292 }
293
294 err = local_timer_register(&arch_timer_ops); 430 err = local_timer_register(&arch_timer_ops);
295 if (err) { 431 if (err) {
296 /* 432 /*
@@ -302,21 +438,29 @@ static int __init arch_timer_register(void)
302 arch_timer_global_evt.cpumask = cpumask_of(0); 438 arch_timer_global_evt.cpumask = cpumask_of(0);
303 err = arch_timer_setup(&arch_timer_global_evt); 439 err = arch_timer_setup(&arch_timer_global_evt);
304 } 440 }
305
306 if (err) 441 if (err)
307 goto out_free_irq; 442 goto out_free_irq;
308 443
309 init_current_timer_delay(arch_timer_rate); 444 /* Use the architected timer for the delay loop. */
445 arch_delay_timer.read_current_timer = &arch_timer_read_current_timer;
446 arch_delay_timer.freq = arch_timer_rate;
447 register_current_timer_delay(&arch_delay_timer);
310 return 0; 448 return 0;
311 449
312out_free_irq: 450out_free_irq:
313 free_percpu_irq(arch_timer_ppi, arch_timer_evt); 451 if (arch_timer_use_virtual)
314 if (arch_timer_ppi2) 452 free_percpu_irq(arch_timer_ppi[VIRT_PPI], arch_timer_evt);
315 free_percpu_irq(arch_timer_ppi2, arch_timer_evt); 453 else {
454 free_percpu_irq(arch_timer_ppi[PHYS_SECURE_PPI],
455 arch_timer_evt);
456 if (arch_timer_ppi[PHYS_NONSECURE_PPI])
457 free_percpu_irq(arch_timer_ppi[PHYS_NONSECURE_PPI],
458 arch_timer_evt);
459 }
316 460
317out_free: 461out_free:
318 free_percpu(arch_timer_evt); 462 free_percpu(arch_timer_evt);
319 463out:
320 return err; 464 return err;
321} 465}
322 466
@@ -329,6 +473,7 @@ int __init arch_timer_of_register(void)
329{ 473{
330 struct device_node *np; 474 struct device_node *np;
331 u32 freq; 475 u32 freq;
476 int i;
332 477
333 np = of_find_matching_node(NULL, arch_timer_of_match); 478 np = of_find_matching_node(NULL, arch_timer_of_match);
334 if (!np) { 479 if (!np) {
@@ -340,22 +485,40 @@ int __init arch_timer_of_register(void)
340 if (!of_property_read_u32(np, "clock-frequency", &freq)) 485 if (!of_property_read_u32(np, "clock-frequency", &freq))
341 arch_timer_rate = freq; 486 arch_timer_rate = freq;
342 487
343 arch_timer_ppi = irq_of_parse_and_map(np, 0); 488 for (i = PHYS_SECURE_PPI; i < MAX_TIMER_PPI; i++)
344 arch_timer_ppi2 = irq_of_parse_and_map(np, 1); 489 arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
345 pr_info("arch_timer: found %s irqs %d %d\n", 490
346 np->name, arch_timer_ppi, arch_timer_ppi2); 491 /*
492 * If no interrupt provided for virtual timer, we'll have to
493 * stick to the physical timer. It'd better be accessible...
494 */
495 if (!arch_timer_ppi[VIRT_PPI]) {
496 arch_timer_use_virtual = false;
497
498 if (!arch_timer_ppi[PHYS_SECURE_PPI] ||
499 !arch_timer_ppi[PHYS_NONSECURE_PPI]) {
500 pr_warn("arch_timer: No interrupt available, giving up\n");
501 return -EINVAL;
502 }
503 }
347 504
348 return arch_timer_register(); 505 return arch_timer_register();
349} 506}
350 507
351int __init arch_timer_sched_clock_init(void) 508int __init arch_timer_sched_clock_init(void)
352{ 509{
510 u32 (*cnt32)(void);
353 int err; 511 int err;
354 512
355 err = arch_timer_available(); 513 err = arch_timer_available();
356 if (err) 514 if (err)
357 return err; 515 return err;
358 516
359 setup_sched_clock(arch_counter_get_cntvct32, 32, arch_timer_rate); 517 if (arch_timer_use_virtual)
518 cnt32 = arch_counter_get_cntvct32;
519 else
520 cnt32 = arch_counter_get_cntpct32;
521
522 setup_sched_clock(cnt32, 32, arch_timer_rate);
360 return 0; 523 return 0;
361} 524}
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 1429d8989fb9..c985b481192c 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -59,10 +59,12 @@ int main(void)
59 DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp)); 59 DEFINE(TI_USED_CP, offsetof(struct thread_info, used_cp));
60 DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value)); 60 DEFINE(TI_TP_VALUE, offsetof(struct thread_info, tp_value));
61 DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate)); 61 DEFINE(TI_FPSTATE, offsetof(struct thread_info, fpstate));
62#ifdef CONFIG_VFP
62 DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate)); 63 DEFINE(TI_VFPSTATE, offsetof(struct thread_info, vfpstate));
63#ifdef CONFIG_SMP 64#ifdef CONFIG_SMP
64 DEFINE(VFP_CPU, offsetof(union vfp_state, hard.cpu)); 65 DEFINE(VFP_CPU, offsetof(union vfp_state, hard.cpu));
65#endif 66#endif
67#endif
66#ifdef CONFIG_ARM_THUMBEE 68#ifdef CONFIG_ARM_THUMBEE
67 DEFINE(TI_THUMBEE_STATE, offsetof(struct thread_info, thumbee_state)); 69 DEFINE(TI_THUMBEE_STATE, offsetof(struct thread_info, thumbee_state));
68#endif 70#endif
diff --git a/arch/arm/kernel/atags.h b/arch/arm/kernel/atags.h
index e5f028d214a1..9edc9692332d 100644
--- a/arch/arm/kernel/atags.h
+++ b/arch/arm/kernel/atags.h
@@ -3,3 +3,17 @@ extern void save_atags(struct tag *tags);
3#else 3#else
4static inline void save_atags(struct tag *tags) { } 4static inline void save_atags(struct tag *tags) { }
5#endif 5#endif
6
7void convert_to_tag_list(struct tag *tags);
8
9#ifdef CONFIG_ATAGS
10struct machine_desc *setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr);
11#else
12static inline struct machine_desc *
13setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr)
14{
15 early_print("no ATAGS support: can't continue\n");
16 while (true);
17 unreachable();
18}
19#endif
diff --git a/arch/arm/kernel/compat.c b/arch/arm/kernel/atags_compat.c
index 925652318b8b..5236ad38f417 100644
--- a/arch/arm/kernel/compat.c
+++ b/arch/arm/kernel/atags_compat.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/kernel/compat.c 2 * linux/arch/arm/kernel/atags_compat.c
3 * 3 *
4 * Copyright (C) 2001 Russell King 4 * Copyright (C) 2001 Russell King
5 * 5 *
@@ -26,7 +26,7 @@
26 26
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28 28
29#include "compat.h" 29#include "atags.h"
30 30
31/* 31/*
32 * Usage: 32 * Usage:
diff --git a/arch/arm/kernel/atags_parse.c b/arch/arm/kernel/atags_parse.c
new file mode 100644
index 000000000000..14512e6931d8
--- /dev/null
+++ b/arch/arm/kernel/atags_parse.c
@@ -0,0 +1,238 @@
1/*
2 * Tag parsing.
3 *
4 * Copyright (C) 1995-2001 Russell King
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
11/*
12 * This is the traditional way of passing data to the kernel at boot time. Rather
13 * than passing a fixed inflexible structure to the kernel, we pass a list
14 * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE
15 * tag for the list to be recognised (to distinguish the tagged list from
16 * a param_struct). The list is terminated with a zero-length tag (this tag
17 * is not parsed in any way).
18 */
19
20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/fs.h>
23#include <linux/root_dev.h>
24#include <linux/screen_info.h>
25
26#include <asm/setup.h>
27#include <asm/system_info.h>
28#include <asm/page.h>
29#include <asm/mach/arch.h>
30
31#include "atags.h"
32
33static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
34
35#ifndef MEM_SIZE
36#define MEM_SIZE (16*1024*1024)
37#endif
38
39static struct {
40 struct tag_header hdr1;
41 struct tag_core core;
42 struct tag_header hdr2;
43 struct tag_mem32 mem;
44 struct tag_header hdr3;
45} default_tags __initdata = {
46 { tag_size(tag_core), ATAG_CORE },
47 { 1, PAGE_SIZE, 0xff },
48 { tag_size(tag_mem32), ATAG_MEM },
49 { MEM_SIZE },
50 { 0, ATAG_NONE }
51};
52
53static int __init parse_tag_core(const struct tag *tag)
54{
55 if (tag->hdr.size > 2) {
56 if ((tag->u.core.flags & 1) == 0)
57 root_mountflags &= ~MS_RDONLY;
58 ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
59 }
60 return 0;
61}
62
63__tagtable(ATAG_CORE, parse_tag_core);
64
65static int __init parse_tag_mem32(const struct tag *tag)
66{
67 return arm_add_memory(tag->u.mem.start, tag->u.mem.size);
68}
69
70__tagtable(ATAG_MEM, parse_tag_mem32);
71
72#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
73static int __init parse_tag_videotext(const struct tag *tag)
74{
75 screen_info.orig_x = tag->u.videotext.x;
76 screen_info.orig_y = tag->u.videotext.y;
77 screen_info.orig_video_page = tag->u.videotext.video_page;
78 screen_info.orig_video_mode = tag->u.videotext.video_mode;
79 screen_info.orig_video_cols = tag->u.videotext.video_cols;
80 screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
81 screen_info.orig_video_lines = tag->u.videotext.video_lines;
82 screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
83 screen_info.orig_video_points = tag->u.videotext.video_points;
84 return 0;
85}
86
87__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
88#endif
89
90#ifdef CONFIG_BLK_DEV_RAM
91static int __init parse_tag_ramdisk(const struct tag *tag)
92{
93 extern int rd_size, rd_image_start, rd_prompt, rd_doload;
94
95 rd_image_start = tag->u.ramdisk.start;
96 rd_doload = (tag->u.ramdisk.flags & 1) == 0;
97 rd_prompt = (tag->u.ramdisk.flags & 2) == 0;
98
99 if (tag->u.ramdisk.size)
100 rd_size = tag->u.ramdisk.size;
101
102 return 0;
103}
104
105__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
106#endif
107
108static int __init parse_tag_serialnr(const struct tag *tag)
109{
110 system_serial_low = tag->u.serialnr.low;
111 system_serial_high = tag->u.serialnr.high;
112 return 0;
113}
114
115__tagtable(ATAG_SERIAL, parse_tag_serialnr);
116
117static int __init parse_tag_revision(const struct tag *tag)
118{
119 system_rev = tag->u.revision.rev;
120 return 0;
121}
122
123__tagtable(ATAG_REVISION, parse_tag_revision);
124
125static int __init parse_tag_cmdline(const struct tag *tag)
126{
127#if defined(CONFIG_CMDLINE_EXTEND)
128 strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
129 strlcat(default_command_line, tag->u.cmdline.cmdline,
130 COMMAND_LINE_SIZE);
131#elif defined(CONFIG_CMDLINE_FORCE)
132 pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
133#else
134 strlcpy(default_command_line, tag->u.cmdline.cmdline,
135 COMMAND_LINE_SIZE);
136#endif
137 return 0;
138}
139
140__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
141
142/*
143 * Scan the tag table for this tag, and call its parse function.
144 * The tag table is built by the linker from all the __tagtable
145 * declarations.
146 */
147static int __init parse_tag(const struct tag *tag)
148{
149 extern struct tagtable __tagtable_begin, __tagtable_end;
150 struct tagtable *t;
151
152 for (t = &__tagtable_begin; t < &__tagtable_end; t++)
153 if (tag->hdr.tag == t->tag) {
154 t->parse(tag);
155 break;
156 }
157
158 return t < &__tagtable_end;
159}
160
161/*
162 * Parse all tags in the list, checking both the global and architecture
163 * specific tag tables.
164 */
165static void __init parse_tags(const struct tag *t)
166{
167 for (; t->hdr.size; t = tag_next(t))
168 if (!parse_tag(t))
169 printk(KERN_WARNING
170 "Ignoring unrecognised tag 0x%08x\n",
171 t->hdr.tag);
172}
173
174static void __init squash_mem_tags(struct tag *tag)
175{
176 for (; tag->hdr.size; tag = tag_next(tag))
177 if (tag->hdr.tag == ATAG_MEM)
178 tag->hdr.tag = ATAG_NONE;
179}
180
181struct machine_desc * __init setup_machine_tags(phys_addr_t __atags_pointer,
182 unsigned int machine_nr)
183{
184 struct tag *tags = (struct tag *)&default_tags;
185 struct machine_desc *mdesc = NULL, *p;
186 char *from = default_command_line;
187
188 default_tags.mem.start = PHYS_OFFSET;
189
190 /*
191 * locate machine in the list of supported machines.
192 */
193 for_each_machine_desc(p)
194 if (machine_nr == p->nr) {
195 printk("Machine: %s\n", p->name);
196 mdesc = p;
197 break;
198 }
199
200 if (!mdesc) {
201 early_print("\nError: unrecognized/unsupported machine ID"
202 " (r1 = 0x%08x).\n\n", machine_nr);
203 dump_machine_table(); /* does not return */
204 }
205
206 if (__atags_pointer)
207 tags = phys_to_virt(__atags_pointer);
208 else if (mdesc->atag_offset)
209 tags = (void *)(PAGE_OFFSET + mdesc->atag_offset);
210
211#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
212 /*
213 * If we have the old style parameters, convert them to
214 * a tag list.
215 */
216 if (tags->hdr.tag != ATAG_CORE)
217 convert_to_tag_list(tags);
218#endif
219 if (tags->hdr.tag != ATAG_CORE) {
220 early_print("Warning: Neither atags nor dtb found\n");
221 tags = (struct tag *)&default_tags;
222 }
223
224 if (mdesc->fixup)
225 mdesc->fixup(tags, &from, &meminfo);
226
227 if (tags->hdr.tag == ATAG_CORE) {
228 if (meminfo.nr_banks != 0)
229 squash_mem_tags(tags);
230 save_atags(tags);
231 parse_tags(tags);
232 }
233
234 /* parse_early_param needs a boot_command_line */
235 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
236
237 return mdesc;
238}
diff --git a/arch/arm/kernel/atags.c b/arch/arm/kernel/atags_proc.c
index 42a1a1415fa6..42a1a1415fa6 100644
--- a/arch/arm/kernel/atags.c
+++ b/arch/arm/kernel/atags_proc.c
diff --git a/arch/arm/kernel/compat.h b/arch/arm/kernel/compat.h
deleted file mode 100644
index 39264ab1b9c6..000000000000
--- a/arch/arm/kernel/compat.h
+++ /dev/null
@@ -1,11 +0,0 @@
1/*
2 * linux/arch/arm/kernel/compat.h
3 *
4 * Copyright (C) 2001 Russell King
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
11extern void convert_to_tag_list(struct tag *tags);
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 978eac57e04a..f45987037bf1 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -94,6 +94,15 @@ ENDPROC(ret_from_fork)
94 .equ NR_syscalls,0 94 .equ NR_syscalls,0
95#define CALL(x) .equ NR_syscalls,NR_syscalls+1 95#define CALL(x) .equ NR_syscalls,NR_syscalls+1
96#include "calls.S" 96#include "calls.S"
97
98/*
99 * Ensure that the system call table is equal to __NR_syscalls,
100 * which is the value the rest of the system sees
101 */
102.ifne NR_syscalls - __NR_syscalls
103.error "__NR_syscalls is not equal to the size of the syscall table"
104.endif
105
97#undef CALL 106#undef CALL
98#define CALL(x) .long x 107#define CALL(x) .long x
99 108
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index dfcdb9f7c126..e29c3337ca81 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -8,7 +8,9 @@
8#include <linux/reboot.h> 8#include <linux/reboot.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/irq.h> 10#include <linux/irq.h>
11#include <linux/memblock.h>
11#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13#include <linux/of_fdt.h>
12#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
13#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
14#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
@@ -32,6 +34,29 @@ static atomic_t waiting_for_crash_ipi;
32 34
33int machine_kexec_prepare(struct kimage *image) 35int machine_kexec_prepare(struct kimage *image)
34{ 36{
37 struct kexec_segment *current_segment;
38 __be32 header;
39 int i, err;
40
41 /*
42 * No segment at default ATAGs address. try to locate
43 * a dtb using magic.
44 */
45 for (i = 0; i < image->nr_segments; i++) {
46 current_segment = &image->segment[i];
47
48 err = memblock_is_region_memory(current_segment->mem,
49 current_segment->memsz);
50 if (err)
51 return - EINVAL;
52
53 err = get_user(header, (__be32*)current_segment->buf);
54 if (err)
55 return err;
56
57 if (be32_to_cpu(header) == OF_DT_HEADER)
58 kexec_boot_atags = current_segment->mem;
59 }
35 return 0; 60 return 0;
36} 61}
37 62
@@ -122,7 +147,9 @@ void machine_kexec(struct kimage *image)
122 kexec_start_address = image->start; 147 kexec_start_address = image->start;
123 kexec_indirection_page = page_list; 148 kexec_indirection_page = page_list;
124 kexec_mach_type = machine_arch_type; 149 kexec_mach_type = machine_arch_type;
125 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; 150 if (!kexec_boot_atags)
151 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
152
126 153
127 /* copy our kernel relocation code to the control code page */ 154 /* copy our kernel relocation code to the control code page */
128 memcpy(reboot_code_buffer, 155 memcpy(reboot_code_buffer,
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 3e0fc5f7ed4b..739db3a1b2d2 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -30,6 +30,9 @@
30#include <asm/pgtable.h> 30#include <asm/pgtable.h>
31#include <asm/traps.h> 31#include <asm/traps.h>
32 32
33#define CREATE_TRACE_POINTS
34#include <trace/events/syscalls.h>
35
33#define REG_PC 15 36#define REG_PC 15
34#define REG_PSR 16 37#define REG_PSR 16
35/* 38/*
@@ -918,11 +921,11 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
918{ 921{
919 unsigned long ip; 922 unsigned long ip;
920 923
924 current_thread_info()->syscall = scno;
925
921 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 926 if (!test_thread_flag(TIF_SYSCALL_TRACE))
922 return scno; 927 return scno;
923 928
924 current_thread_info()->syscall = scno;
925
926 /* 929 /*
927 * IP is used to denote syscall entry/exit: 930 * IP is used to denote syscall entry/exit:
928 * IP = 0 -> entry, =1 -> exit 931 * IP = 0 -> entry, =1 -> exit
@@ -941,15 +944,19 @@ static int ptrace_syscall_trace(struct pt_regs *regs, int scno,
941 944
942asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno) 945asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
943{ 946{
944 int ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER); 947 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_ENTER);
948 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
949 trace_sys_enter(regs, scno);
945 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1, 950 audit_syscall_entry(AUDIT_ARCH_ARM, scno, regs->ARM_r0, regs->ARM_r1,
946 regs->ARM_r2, regs->ARM_r3); 951 regs->ARM_r2, regs->ARM_r3);
947 return ret; 952 return scno;
948} 953}
949 954
950asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno) 955asmlinkage int syscall_trace_exit(struct pt_regs *regs, int scno)
951{ 956{
952 int ret = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT); 957 scno = ptrace_syscall_trace(regs, scno, PTRACE_SYSCALL_EXIT);
958 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
959 trace_sys_exit(regs, scno);
953 audit_syscall_exit(regs); 960 audit_syscall_exit(regs);
954 return ret; 961 return scno;
955} 962}
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index f4515393248d..e21bac20d90d 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -9,6 +9,7 @@
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/jiffies.h> 10#include <linux/jiffies.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/moduleparam.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/syscore_ops.h> 14#include <linux/syscore_ops.h>
14#include <linux/timer.h> 15#include <linux/timer.h>
@@ -27,6 +28,9 @@ struct clock_data {
27 28
28static void sched_clock_poll(unsigned long wrap_ticks); 29static void sched_clock_poll(unsigned long wrap_ticks);
29static DEFINE_TIMER(sched_clock_timer, sched_clock_poll, 0, 0); 30static DEFINE_TIMER(sched_clock_timer, sched_clock_poll, 0, 0);
31static int irqtime = -1;
32
33core_param(irqtime, irqtime, int, 0400);
30 34
31static struct clock_data cd = { 35static struct clock_data cd = {
32 .mult = NSEC_PER_SEC / HZ, 36 .mult = NSEC_PER_SEC / HZ,
@@ -157,6 +161,10 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
157 */ 161 */
158 cd.epoch_ns = 0; 162 cd.epoch_ns = 0;
159 163
164 /* Enable IRQ time accounting if we have a fast enough sched_clock */
165 if (irqtime > 0 || (irqtime == -1 && rate >= 1000000))
166 enable_sched_clock_irqtime();
167
160 pr_debug("Registered %pF as sched_clock source\n", read); 168 pr_debug("Registered %pF as sched_clock source\n", read);
161} 169}
162 170
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 725f9f2a9541..febafa0f552d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -21,11 +21,9 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kexec.h> 22#include <linux/kexec.h>
23#include <linux/of_fdt.h> 23#include <linux/of_fdt.h>
24#include <linux/root_dev.h>
25#include <linux/cpu.h> 24#include <linux/cpu.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/smp.h> 26#include <linux/smp.h>
28#include <linux/fs.h>
29#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
30#include <linux/memblock.h> 28#include <linux/memblock.h>
31#include <linux/bug.h> 29#include <linux/bug.h>
@@ -56,15 +54,9 @@
56#include <asm/unwind.h> 54#include <asm/unwind.h>
57#include <asm/memblock.h> 55#include <asm/memblock.h>
58 56
59#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
60#include "compat.h"
61#endif
62#include "atags.h" 57#include "atags.h"
63#include "tcm.h" 58#include "tcm.h"
64 59
65#ifndef MEM_SIZE
66#define MEM_SIZE (16*1024*1024)
67#endif
68 60
69#if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE) 61#if defined(CONFIG_FPE_NWFPE) || defined(CONFIG_FPE_FASTFPE)
70char fpe_type[8]; 62char fpe_type[8];
@@ -145,7 +137,6 @@ static const char *machine_name;
145static char __initdata cmd_line[COMMAND_LINE_SIZE]; 137static char __initdata cmd_line[COMMAND_LINE_SIZE];
146struct machine_desc *machine_desc __initdata; 138struct machine_desc *machine_desc __initdata;
147 139
148static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
149static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; 140static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
150#define ENDIANNESS ((char)endian_test.l) 141#define ENDIANNESS ((char)endian_test.l)
151 142
@@ -583,21 +574,6 @@ static int __init early_mem(char *p)
583} 574}
584early_param("mem", early_mem); 575early_param("mem", early_mem);
585 576
586static void __init
587setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
588{
589#ifdef CONFIG_BLK_DEV_RAM
590 extern int rd_size, rd_image_start, rd_prompt, rd_doload;
591
592 rd_image_start = image_start;
593 rd_prompt = prompt;
594 rd_doload = doload;
595
596 if (rd_sz)
597 rd_size = rd_sz;
598#endif
599}
600
601static void __init request_standard_resources(struct machine_desc *mdesc) 577static void __init request_standard_resources(struct machine_desc *mdesc)
602{ 578{
603 struct memblock_region *region; 579 struct memblock_region *region;
@@ -643,35 +619,6 @@ static void __init request_standard_resources(struct machine_desc *mdesc)
643 request_resource(&ioport_resource, &lp2); 619 request_resource(&ioport_resource, &lp2);
644} 620}
645 621
646/*
647 * Tag parsing.
648 *
649 * This is the new way of passing data to the kernel at boot time. Rather
650 * than passing a fixed inflexible structure to the kernel, we pass a list
651 * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE
652 * tag for the list to be recognised (to distinguish the tagged list from
653 * a param_struct). The list is terminated with a zero-length tag (this tag
654 * is not parsed in any way).
655 */
656static int __init parse_tag_core(const struct tag *tag)
657{
658 if (tag->hdr.size > 2) {
659 if ((tag->u.core.flags & 1) == 0)
660 root_mountflags &= ~MS_RDONLY;
661 ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
662 }
663 return 0;
664}
665
666__tagtable(ATAG_CORE, parse_tag_core);
667
668static int __init parse_tag_mem32(const struct tag *tag)
669{
670 return arm_add_memory(tag->u.mem.start, tag->u.mem.size);
671}
672
673__tagtable(ATAG_MEM, parse_tag_mem32);
674
675#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 622#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
676struct screen_info screen_info = { 623struct screen_info screen_info = {
677 .orig_video_lines = 30, 624 .orig_video_lines = 30,
@@ -681,117 +628,8 @@ struct screen_info screen_info = {
681 .orig_video_isVGA = 1, 628 .orig_video_isVGA = 1,
682 .orig_video_points = 8 629 .orig_video_points = 8
683}; 630};
684
685static int __init parse_tag_videotext(const struct tag *tag)
686{
687 screen_info.orig_x = tag->u.videotext.x;
688 screen_info.orig_y = tag->u.videotext.y;
689 screen_info.orig_video_page = tag->u.videotext.video_page;
690 screen_info.orig_video_mode = tag->u.videotext.video_mode;
691 screen_info.orig_video_cols = tag->u.videotext.video_cols;
692 screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
693 screen_info.orig_video_lines = tag->u.videotext.video_lines;
694 screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
695 screen_info.orig_video_points = tag->u.videotext.video_points;
696 return 0;
697}
698
699__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
700#endif 631#endif
701 632
702static int __init parse_tag_ramdisk(const struct tag *tag)
703{
704 setup_ramdisk((tag->u.ramdisk.flags & 1) == 0,
705 (tag->u.ramdisk.flags & 2) == 0,
706 tag->u.ramdisk.start, tag->u.ramdisk.size);
707 return 0;
708}
709
710__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
711
712static int __init parse_tag_serialnr(const struct tag *tag)
713{
714 system_serial_low = tag->u.serialnr.low;
715 system_serial_high = tag->u.serialnr.high;
716 return 0;
717}
718
719__tagtable(ATAG_SERIAL, parse_tag_serialnr);
720
721static int __init parse_tag_revision(const struct tag *tag)
722{
723 system_rev = tag->u.revision.rev;
724 return 0;
725}
726
727__tagtable(ATAG_REVISION, parse_tag_revision);
728
729static int __init parse_tag_cmdline(const struct tag *tag)
730{
731#if defined(CONFIG_CMDLINE_EXTEND)
732 strlcat(default_command_line, " ", COMMAND_LINE_SIZE);
733 strlcat(default_command_line, tag->u.cmdline.cmdline,
734 COMMAND_LINE_SIZE);
735#elif defined(CONFIG_CMDLINE_FORCE)
736 pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");
737#else
738 strlcpy(default_command_line, tag->u.cmdline.cmdline,
739 COMMAND_LINE_SIZE);
740#endif
741 return 0;
742}
743
744__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
745
746/*
747 * Scan the tag table for this tag, and call its parse function.
748 * The tag table is built by the linker from all the __tagtable
749 * declarations.
750 */
751static int __init parse_tag(const struct tag *tag)
752{
753 extern struct tagtable __tagtable_begin, __tagtable_end;
754 struct tagtable *t;
755
756 for (t = &__tagtable_begin; t < &__tagtable_end; t++)
757 if (tag->hdr.tag == t->tag) {
758 t->parse(tag);
759 break;
760 }
761
762 return t < &__tagtable_end;
763}
764
765/*
766 * Parse all tags in the list, checking both the global and architecture
767 * specific tag tables.
768 */
769static void __init parse_tags(const struct tag *t)
770{
771 for (; t->hdr.size; t = tag_next(t))
772 if (!parse_tag(t))
773 printk(KERN_WARNING
774 "Ignoring unrecognised tag 0x%08x\n",
775 t->hdr.tag);
776}
777
778/*
779 * This holds our defaults.
780 */
781static struct init_tags {
782 struct tag_header hdr1;
783 struct tag_core core;
784 struct tag_header hdr2;
785 struct tag_mem32 mem;
786 struct tag_header hdr3;
787} init_tags __initdata = {
788 { tag_size(tag_core), ATAG_CORE },
789 { 1, PAGE_SIZE, 0xff },
790 { tag_size(tag_mem32), ATAG_MEM },
791 { MEM_SIZE },
792 { 0, ATAG_NONE }
793};
794
795static int __init customize_machine(void) 633static int __init customize_machine(void)
796{ 634{
797 /* customizes platform devices, or adds new ones */ 635 /* customizes platform devices, or adds new ones */
@@ -858,78 +696,6 @@ static void __init reserve_crashkernel(void)
858static inline void reserve_crashkernel(void) {} 696static inline void reserve_crashkernel(void) {}
859#endif /* CONFIG_KEXEC */ 697#endif /* CONFIG_KEXEC */
860 698
861static void __init squash_mem_tags(struct tag *tag)
862{
863 for (; tag->hdr.size; tag = tag_next(tag))
864 if (tag->hdr.tag == ATAG_MEM)
865 tag->hdr.tag = ATAG_NONE;
866}
867
868static struct machine_desc * __init setup_machine_tags(unsigned int nr)
869{
870 struct tag *tags = (struct tag *)&init_tags;
871 struct machine_desc *mdesc = NULL, *p;
872 char *from = default_command_line;
873
874 init_tags.mem.start = PHYS_OFFSET;
875
876 /*
877 * locate machine in the list of supported machines.
878 */
879 for_each_machine_desc(p)
880 if (nr == p->nr) {
881 printk("Machine: %s\n", p->name);
882 mdesc = p;
883 break;
884 }
885
886 if (!mdesc) {
887 early_print("\nError: unrecognized/unsupported machine ID"
888 " (r1 = 0x%08x).\n\n", nr);
889 dump_machine_table(); /* does not return */
890 }
891
892 if (__atags_pointer)
893 tags = phys_to_virt(__atags_pointer);
894 else if (mdesc->atag_offset)
895 tags = (void *)(PAGE_OFFSET + mdesc->atag_offset);
896
897#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
898 /*
899 * If we have the old style parameters, convert them to
900 * a tag list.
901 */
902 if (tags->hdr.tag != ATAG_CORE)
903 convert_to_tag_list(tags);
904#endif
905
906 if (tags->hdr.tag != ATAG_CORE) {
907#if defined(CONFIG_OF)
908 /*
909 * If CONFIG_OF is set, then assume this is a reasonably
910 * modern system that should pass boot parameters
911 */
912 early_print("Warning: Neither atags nor dtb found\n");
913#endif
914 tags = (struct tag *)&init_tags;
915 }
916
917 if (mdesc->fixup)
918 mdesc->fixup(tags, &from, &meminfo);
919
920 if (tags->hdr.tag == ATAG_CORE) {
921 if (meminfo.nr_banks != 0)
922 squash_mem_tags(tags);
923 save_atags(tags);
924 parse_tags(tags);
925 }
926
927 /* parse_early_param needs a boot_command_line */
928 strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
929
930 return mdesc;
931}
932
933static int __init meminfo_cmp(const void *_a, const void *_b) 699static int __init meminfo_cmp(const void *_a, const void *_b)
934{ 700{
935 const struct membank *a = _a, *b = _b; 701 const struct membank *a = _a, *b = _b;
@@ -944,7 +710,7 @@ void __init setup_arch(char **cmdline_p)
944 setup_processor(); 710 setup_processor();
945 mdesc = setup_machine_fdt(__atags_pointer); 711 mdesc = setup_machine_fdt(__atags_pointer);
946 if (!mdesc) 712 if (!mdesc)
947 mdesc = setup_machine_tags(machine_arch_type); 713 mdesc = setup_machine_tags(__atags_pointer, machine_arch_type);
948 machine_desc = mdesc; 714 machine_desc = mdesc;
949 machine_name = mdesc->name; 715 machine_name = mdesc->name;
950 716
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index dea7a925c7e2..d100eacdb798 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -59,7 +59,8 @@ struct secondary_data secondary_data;
59volatile int __cpuinitdata pen_release = -1; 59volatile int __cpuinitdata pen_release = -1;
60 60
61enum ipi_msg_type { 61enum ipi_msg_type {
62 IPI_TIMER = 2, 62 IPI_WAKEUP,
63 IPI_TIMER,
63 IPI_RESCHEDULE, 64 IPI_RESCHEDULE,
64 IPI_CALL_FUNC, 65 IPI_CALL_FUNC,
65 IPI_CALL_FUNC_SINGLE, 66 IPI_CALL_FUNC_SINGLE,
@@ -414,7 +415,8 @@ void arch_send_call_function_single_ipi(int cpu)
414} 415}
415 416
416static const char *ipi_types[NR_IPI] = { 417static const char *ipi_types[NR_IPI] = {
417#define S(x,s) [x - IPI_TIMER] = s 418#define S(x,s) [x] = s
419 S(IPI_WAKEUP, "CPU wakeup interrupts"),
418 S(IPI_TIMER, "Timer broadcast interrupts"), 420 S(IPI_TIMER, "Timer broadcast interrupts"),
419 S(IPI_RESCHEDULE, "Rescheduling interrupts"), 421 S(IPI_RESCHEDULE, "Rescheduling interrupts"),
420 S(IPI_CALL_FUNC, "Function call interrupts"), 422 S(IPI_CALL_FUNC, "Function call interrupts"),
@@ -567,10 +569,13 @@ void handle_IPI(int ipinr, struct pt_regs *regs)
567 unsigned int cpu = smp_processor_id(); 569 unsigned int cpu = smp_processor_id();
568 struct pt_regs *old_regs = set_irq_regs(regs); 570 struct pt_regs *old_regs = set_irq_regs(regs);
569 571
570 if (ipinr >= IPI_TIMER && ipinr < IPI_TIMER + NR_IPI) 572 if (ipinr < NR_IPI)
571 __inc_irq_stat(cpu, ipi_irqs[ipinr - IPI_TIMER]); 573 __inc_irq_stat(cpu, ipi_irqs[ipinr]);
572 574
573 switch (ipinr) { 575 switch (ipinr) {
576 case IPI_WAKEUP:
577 break;
578
574 case IPI_TIMER: 579 case IPI_TIMER:
575 irq_enter(); 580 irq_enter();
576 ipi_timer(); 581 ipi_timer();
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index 395d5fbb8fa2..9d0a30032d7f 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -34,7 +34,18 @@ struct arm_delay_ops arm_delay_ops = {
34 .udelay = __loop_udelay, 34 .udelay = __loop_udelay,
35}; 35};
36 36
37#ifdef ARCH_HAS_READ_CURRENT_TIMER 37static const struct delay_timer *delay_timer;
38static bool delay_calibrated;
39
40int read_current_timer(unsigned long *timer_val)
41{
42 if (!delay_timer)
43 return -ENXIO;
44
45 *timer_val = delay_timer->read_current_timer();
46 return 0;
47}
48
38static void __timer_delay(unsigned long cycles) 49static void __timer_delay(unsigned long cycles)
39{ 50{
40 cycles_t start = get_cycles(); 51 cycles_t start = get_cycles();
@@ -55,18 +66,24 @@ static void __timer_udelay(unsigned long usecs)
55 __timer_const_udelay(usecs * UDELAY_MULT); 66 __timer_const_udelay(usecs * UDELAY_MULT);
56} 67}
57 68
58void __init init_current_timer_delay(unsigned long freq) 69void __init register_current_timer_delay(const struct delay_timer *timer)
59{ 70{
60 pr_info("Switching to timer-based delay loop\n"); 71 if (!delay_calibrated) {
61 lpj_fine = freq / HZ; 72 pr_info("Switching to timer-based delay loop\n");
62 loops_per_jiffy = lpj_fine; 73 delay_timer = timer;
63 arm_delay_ops.delay = __timer_delay; 74 lpj_fine = timer->freq / HZ;
64 arm_delay_ops.const_udelay = __timer_const_udelay; 75 loops_per_jiffy = lpj_fine;
65 arm_delay_ops.udelay = __timer_udelay; 76 arm_delay_ops.delay = __timer_delay;
77 arm_delay_ops.const_udelay = __timer_const_udelay;
78 arm_delay_ops.udelay = __timer_udelay;
79 delay_calibrated = true;
80 } else {
81 pr_info("Ignoring duplicate/late registration of read_current_timer delay\n");
82 }
66} 83}
67 84
68unsigned long __cpuinit calibrate_delay_is_known(void) 85unsigned long __cpuinit calibrate_delay_is_known(void)
69{ 86{
87 delay_calibrated = true;
70 return lpj_fine; 88 return lpj_fine;
71} 89}
72#endif
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 2c2d86505a54..5315f05896e9 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -153,7 +153,9 @@ static int at91_pm_verify_clocks(void)
153 } 153 }
154 } 154 }
155 155
156#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS 156 if (!IS_ENABLED(CONFIG_AT91_PROGRAMMABLE_CLOCKS))
157 return 1;
158
157 /* PCK0..PCK3 must be disabled, or configured to use clk32k */ 159 /* PCK0..PCK3 must be disabled, or configured to use clk32k */
158 for (i = 0; i < 4; i++) { 160 for (i = 0; i < 4; i++) {
159 u32 css; 161 u32 css;
@@ -167,7 +169,6 @@ static int at91_pm_verify_clocks(void)
167 return 0; 169 return 0;
168 } 170 }
169 } 171 }
170#endif
171 172
172 return 1; 173 return 1;
173} 174}
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index e6f52de1062f..da9881b161e1 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -87,7 +87,7 @@ void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
87 iotable_init(desc, 1); 87 iotable_init(desc, 1);
88} 88}
89 89
90static struct map_desc at91_io_desc __initdata = { 90static struct map_desc at91_io_desc __initdata __maybe_unused = {
91 .virtual = (unsigned long)AT91_VA_BASE_SYS, 91 .virtual = (unsigned long)AT91_VA_BASE_SYS,
92 .pfn = __phys_to_pfn(AT91_BASE_SYS), 92 .pfn = __phys_to_pfn(AT91_BASE_SYS),
93 .length = SZ_16K, 93 .length = SZ_16K,
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 6676dee7104e..e517e1036b09 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -939,7 +939,7 @@ static struct platform_device da850_cpufreq_device = {
939 939
940unsigned int da850_max_speed = 300000; 940unsigned int da850_max_speed = 300000;
941 941
942int __init da850_register_cpufreq(char *async_clk) 942int da850_register_cpufreq(char *async_clk)
943{ 943{
944 int i; 944 int i;
945 945
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 8d57e4223bdb..f93d820ecab5 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -134,7 +134,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct
134 134
135 __raw_writel(virt_to_phys(exynos4_secondary_startup), 135 __raw_writel(virt_to_phys(exynos4_secondary_startup),
136 CPU1_BOOT_REG); 136 CPU1_BOOT_REG);
137 gic_raise_softirq(cpumask_of(cpu), 1); 137 gic_raise_softirq(cpumask_of(cpu), 0);
138 138
139 if (pen_release == -1) 139 if (pen_release == -1)
140 break; 140 break;
diff --git a/arch/arm/mach-footbridge/include/mach/irqs.h b/arch/arm/mach-footbridge/include/mach/irqs.h
index 400551e43e4e..61c714c4920e 100644
--- a/arch/arm/mach-footbridge/include/mach/irqs.h
+++ b/arch/arm/mach-footbridge/include/mach/irqs.h
@@ -89,8 +89,6 @@
89#define IRQ_NETWINDER_VGA _ISA_IRQ(11) 89#define IRQ_NETWINDER_VGA _ISA_IRQ(11)
90#define IRQ_NETWINDER_SOUND _ISA_IRQ(12) 90#define IRQ_NETWINDER_SOUND _ISA_IRQ(12)
91 91
92#undef RTC_IRQ
93#define RTC_IRQ IRQ_ISA_RTC_ALARM
94#define I8042_KBD_IRQ IRQ_ISA_KEYBOARD 92#define I8042_KBD_IRQ IRQ_ISA_KEYBOARD
95#define I8042_AUX_IRQ (machine_is_netwinder() ? IRQ_NETWINDER_PS2MOUSE : IRQ_ISA_PS2MOUSE) 93#define I8042_AUX_IRQ (machine_is_netwinder() ? IRQ_NETWINDER_PS2MOUSE : IRQ_ISA_PS2MOUSE)
96#define IRQ_FLOPPYDISK IRQ_ISA_FLOPPY 94#define IRQ_FLOPPYDISK IRQ_ISA_FLOPPY
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
index 899561d8db28..c3ff21b5ea24 100644
--- a/arch/arm/mach-integrator/common.h
+++ b/arch/arm/mach-integrator/common.h
@@ -1,3 +1,6 @@
1#include <linux/amba/serial.h>
2extern struct amba_pl010_data integrator_uart_data;
1void integrator_init_early(void); 3void integrator_init_early(void);
4int integrator_init(bool is_cp);
2void integrator_reserve(void); 5void integrator_reserve(void);
3void integrator_restart(char, const char *); 6void integrator_restart(char, const char *);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index dad3cb74ed31..ea22a17246d7 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -32,7 +32,9 @@
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34 34
35static struct amba_pl010_data integrator_uart_data; 35#include "common.h"
36
37#ifdef CONFIG_ATAGS
36 38
37#define INTEGRATOR_RTC_IRQ { IRQ_RTCINT } 39#define INTEGRATOR_RTC_IRQ { IRQ_RTCINT }
38#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 } 40#define INTEGRATOR_UART0_IRQ { IRQ_UARTINT0 }
@@ -60,7 +62,7 @@ static struct amba_device *amba_devs[] __initdata = {
60 &kmi1_device, 62 &kmi1_device,
61}; 63};
62 64
63static int __init integrator_init(void) 65int __init integrator_init(bool is_cp)
64{ 66{
65 int i; 67 int i;
66 68
@@ -69,7 +71,7 @@ static int __init integrator_init(void)
69 * hard-code them. The Integator/CP and forward have proper cell IDs. 71 * hard-code them. The Integator/CP and forward have proper cell IDs.
70 * Else we leave them undefined to the bus driver can autoprobe them. 72 * Else we leave them undefined to the bus driver can autoprobe them.
71 */ 73 */
72 if (machine_is_integrator()) { 74 if (!is_cp) {
73 rtc_device.periphid = 0x00041030; 75 rtc_device.periphid = 0x00041030;
74 uart0_device.periphid = 0x00041010; 76 uart0_device.periphid = 0x00041010;
75 uart1_device.periphid = 0x00041010; 77 uart1_device.periphid = 0x00041010;
@@ -85,7 +87,7 @@ static int __init integrator_init(void)
85 return 0; 87 return 0;
86} 88}
87 89
88arch_initcall(integrator_init); 90#endif
89 91
90/* 92/*
91 * On the Integrator platform, the port RTS and DTR are provided by 93 * On the Integrator platform, the port RTS and DTR are provided by
@@ -100,11 +102,14 @@ arch_initcall(integrator_init);
100static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl) 102static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
101{ 103{
102 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask; 104 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
105 u32 phybase = dev->res.start;
103 106
104 if (dev == &uart0_device) { 107 if (phybase == INTEGRATOR_UART0_BASE) {
108 /* UART0 */
105 rts_mask = 1 << 4; 109 rts_mask = 1 << 4;
106 dtr_mask = 1 << 5; 110 dtr_mask = 1 << 5;
107 } else { 111 } else {
112 /* UART1 */
108 rts_mask = 1 << 6; 113 rts_mask = 1 << 6;
109 dtr_mask = 1 << 7; 114 dtr_mask = 1 << 7;
110 } 115 }
@@ -123,7 +128,7 @@ static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *bas
123 __raw_writel(ctrlc, SC_CTRLC); 128 __raw_writel(ctrlc, SC_CTRLC);
124} 129}
125 130
126static struct amba_pl010_data integrator_uart_data = { 131struct amba_pl010_data integrator_uart_data = {
127 .set_mctrl = integrator_uart_set_mctrl, 132 .set_mctrl = integrator_uart_set_mctrl,
128}; 133};
129 134
diff --git a/arch/arm/mach-integrator/include/mach/cm.h b/arch/arm/mach-integrator/include/mach/cm.h
index 1a78692e32a4..202e6a57f100 100644
--- a/arch/arm/mach-integrator/include/mach/cm.h
+++ b/arch/arm/mach-integrator/include/mach/cm.h
@@ -3,7 +3,7 @@
3 */ 3 */
4void cm_control(u32, u32); 4void cm_control(u32, u32);
5 5
6#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL) 6#define CM_CTRL __io_address(INTEGRATOR_HDR_CTRL)
7 7
8#define CM_CTRL_LED (1 << 0) 8#define CM_CTRL_LED (1 << 0)
9#define CM_CTRL_nMBDET (1 << 1) 9#define CM_CTRL_nMBDET (1 << 1)
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
index 4c0347526851..efeac5d0bc9e 100644
--- a/arch/arm/mach-integrator/include/mach/platform.h
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -324,9 +324,9 @@
324 */ 324 */
325#define PHYS_PCI_V3_BASE 0x62000000 325#define PHYS_PCI_V3_BASE 0x62000000
326 326
327#define PCI_MEMORY_VADDR 0xe8000000 327#define PCI_MEMORY_VADDR IOMEM(0xe8000000)
328#define PCI_CONFIG_VADDR 0xec000000 328#define PCI_CONFIG_VADDR IOMEM(0xec000000)
329#define PCI_V3_VADDR 0xed000000 329#define PCI_V3_VADDR IOMEM(0xed000000)
330 330
331/* ------------------------------------------------------------------------ 331/* ------------------------------------------------------------------------
332 * Integrator Interrupt Controllers 332 * Integrator Interrupt Controllers
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 2215d96cd735..e6617c134faf 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -34,6 +34,9 @@
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/platform_data/clk-integrator.h> 36#include <linux/platform_data/clk-integrator.h>
37#include <linux/of_irq.h>
38#include <linux/of_address.h>
39#include <linux/of_platform.h>
37#include <video/vga.h> 40#include <video/vga.h>
38 41
39#include <mach/hardware.h> 42#include <mach/hardware.h>
@@ -154,27 +157,10 @@ static struct map_desc ap_io_desc[] __initdata = {
154static void __init ap_map_io(void) 157static void __init ap_map_io(void)
155{ 158{
156 iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc)); 159 iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc));
157 vga_base = PCI_MEMORY_VADDR; 160 vga_base = (unsigned long)PCI_MEMORY_VADDR;
158 pci_map_io_early(__phys_to_pfn(PHYS_PCI_IO_BASE)); 161 pci_map_io_early(__phys_to_pfn(PHYS_PCI_IO_BASE));
159} 162}
160 163
161#define INTEGRATOR_SC_VALID_INT 0x003fffff
162
163static void __init ap_init_irq(void)
164{
165 /* Disable all interrupts initially. */
166 /* Do the core module ones */
167 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
168
169 /* do the header card stuff next */
170 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
171 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
172
173 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
174 -1, INTEGRATOR_SC_VALID_INT, NULL);
175 integrator_clk_init(false);
176}
177
178#ifdef CONFIG_PM 164#ifdef CONFIG_PM
179static unsigned long ic_irq_enable; 165static unsigned long ic_irq_enable;
180 166
@@ -267,50 +253,6 @@ static struct physmap_flash_data ap_flash_data = {
267 .set_vpp = ap_flash_set_vpp, 253 .set_vpp = ap_flash_set_vpp,
268}; 254};
269 255
270static struct resource cfi_flash_resource = {
271 .start = INTEGRATOR_FLASH_BASE,
272 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1,
273 .flags = IORESOURCE_MEM,
274};
275
276static struct platform_device cfi_flash_device = {
277 .name = "physmap-flash",
278 .id = 0,
279 .dev = {
280 .platform_data = &ap_flash_data,
281 },
282 .num_resources = 1,
283 .resource = &cfi_flash_resource,
284};
285
286static void __init ap_init(void)
287{
288 unsigned long sc_dec;
289 int i;
290
291 platform_device_register(&cfi_flash_device);
292
293 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
294 for (i = 0; i < 4; i++) {
295 struct lm_device *lmdev;
296
297 if ((sc_dec & (16 << i)) == 0)
298 continue;
299
300 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
301 if (!lmdev)
302 continue;
303
304 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
305 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
306 lmdev->resource.flags = IORESOURCE_MEM;
307 lmdev->irq = IRQ_AP_EXPINT0 + i;
308 lmdev->id = i;
309
310 lm_device_register(lmdev);
311 }
312}
313
314/* 256/*
315 * Where is the timer (VA)? 257 * Where is the timer (VA)?
316 */ 258 */
@@ -325,9 +267,9 @@ static u32 notrace integrator_read_sched_clock(void)
325 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE); 267 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
326} 268}
327 269
328static void integrator_clocksource_init(unsigned long inrate) 270static void integrator_clocksource_init(unsigned long inrate,
271 void __iomem *base)
329{ 272{
330 void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
331 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC; 273 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
332 unsigned long rate = inrate; 274 unsigned long rate = inrate;
333 275
@@ -344,7 +286,7 @@ static void integrator_clocksource_init(unsigned long inrate)
344 setup_sched_clock(integrator_read_sched_clock, 16, rate); 286 setup_sched_clock(integrator_read_sched_clock, 16, rate);
345} 287}
346 288
347static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; 289static void __iomem * clkevt_base;
348 290
349/* 291/*
350 * IRQ handler for the timer 292 * IRQ handler for the timer
@@ -416,11 +358,13 @@ static struct irqaction integrator_timer_irq = {
416 .dev_id = &integrator_clockevent, 358 .dev_id = &integrator_clockevent,
417}; 359};
418 360
419static void integrator_clockevent_init(unsigned long inrate) 361static void integrator_clockevent_init(unsigned long inrate,
362 void __iomem *base, int irq)
420{ 363{
421 unsigned long rate = inrate; 364 unsigned long rate = inrate;
422 unsigned int ctrl = 0; 365 unsigned int ctrl = 0;
423 366
367 clkevt_base = base;
424 /* Calculate and program a divisor */ 368 /* Calculate and program a divisor */
425 if (rate > 0x100000 * HZ) { 369 if (rate > 0x100000 * HZ) {
426 rate /= 256; 370 rate /= 256;
@@ -432,7 +376,7 @@ static void integrator_clockevent_init(unsigned long inrate)
432 timer_reload = rate / HZ; 376 timer_reload = rate / HZ;
433 writel(ctrl, clkevt_base + TIMER_CTRL); 377 writel(ctrl, clkevt_base + TIMER_CTRL);
434 378
435 setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); 379 setup_irq(irq, &integrator_timer_irq);
436 clockevents_config_and_register(&integrator_clockevent, 380 clockevents_config_and_register(&integrator_clockevent,
437 rate, 381 rate,
438 1, 382 1,
@@ -443,9 +387,153 @@ void __init ap_init_early(void)
443{ 387{
444} 388}
445 389
390#ifdef CONFIG_OF
391
392static void __init ap_init_timer_of(void)
393{
394 struct device_node *node;
395 const char *path;
396 void __iomem *base;
397 int err;
398 int irq;
399 struct clk *clk;
400 unsigned long rate;
401
402 clk = clk_get_sys("ap_timer", NULL);
403 BUG_ON(IS_ERR(clk));
404 clk_prepare_enable(clk);
405 rate = clk_get_rate(clk);
406
407 err = of_property_read_string(of_aliases,
408 "arm,timer-primary", &path);
409 if (WARN_ON(err))
410 return;
411 node = of_find_node_by_path(path);
412 base = of_iomap(node, 0);
413 if (WARN_ON(!base))
414 return;
415 writel(0, base + TIMER_CTRL);
416 integrator_clocksource_init(rate, base);
417
418 err = of_property_read_string(of_aliases,
419 "arm,timer-secondary", &path);
420 if (WARN_ON(err))
421 return;
422 node = of_find_node_by_path(path);
423 base = of_iomap(node, 0);
424 if (WARN_ON(!base))
425 return;
426 irq = irq_of_parse_and_map(node, 0);
427 writel(0, base + TIMER_CTRL);
428 integrator_clockevent_init(rate, base, irq);
429}
430
431static struct sys_timer ap_of_timer = {
432 .init = ap_init_timer_of,
433};
434
435static const struct of_device_id fpga_irq_of_match[] __initconst = {
436 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
437 { /* Sentinel */ }
438};
439
440static void __init ap_init_irq_of(void)
441{
442 /* disable core module IRQs */
443 writel(0xffffffffU, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
444 of_irq_init(fpga_irq_of_match);
445 integrator_clk_init(false);
446}
447
448/* For the Device Tree, add in the UART callbacks as AUXDATA */
449static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = {
450 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
451 "rtc", NULL),
452 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE,
453 "uart0", &integrator_uart_data),
454 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE,
455 "uart1", &integrator_uart_data),
456 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE,
457 "kmi0", NULL),
458 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
459 "kmi1", NULL),
460 OF_DEV_AUXDATA("cfi-flash", INTEGRATOR_FLASH_BASE,
461 "physmap-flash", &ap_flash_data),
462 { /* sentinel */ },
463};
464
465static void __init ap_init_of(void)
466{
467 unsigned long sc_dec;
468 int i;
469
470 of_platform_populate(NULL, of_default_bus_match_table,
471 ap_auxdata_lookup, NULL);
472
473 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
474 for (i = 0; i < 4; i++) {
475 struct lm_device *lmdev;
476
477 if ((sc_dec & (16 << i)) == 0)
478 continue;
479
480 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
481 if (!lmdev)
482 continue;
483
484 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
485 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
486 lmdev->resource.flags = IORESOURCE_MEM;
487 lmdev->irq = IRQ_AP_EXPINT0 + i;
488 lmdev->id = i;
489
490 lm_device_register(lmdev);
491 }
492}
493
494static const char * ap_dt_board_compat[] = {
495 "arm,integrator-ap",
496 NULL,
497};
498
499DT_MACHINE_START(INTEGRATOR_AP_DT, "ARM Integrator/AP (Device Tree)")
500 .reserve = integrator_reserve,
501 .map_io = ap_map_io,
502 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
503 .init_early = ap_init_early,
504 .init_irq = ap_init_irq_of,
505 .handle_irq = fpga_handle_irq,
506 .timer = &ap_of_timer,
507 .init_machine = ap_init_of,
508 .restart = integrator_restart,
509 .dt_compat = ap_dt_board_compat,
510MACHINE_END
511
512#endif
513
514#ifdef CONFIG_ATAGS
515
446/* 516/*
447 * Set up timer(s). 517 * This is where non-devicetree initialization code is collected and stashed
518 * for eventual deletion.
448 */ 519 */
520
521static struct resource cfi_flash_resource = {
522 .start = INTEGRATOR_FLASH_BASE,
523 .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1,
524 .flags = IORESOURCE_MEM,
525};
526
527static struct platform_device cfi_flash_device = {
528 .name = "physmap-flash",
529 .id = 0,
530 .dev = {
531 .platform_data = &ap_flash_data,
532 },
533 .num_resources = 1,
534 .resource = &cfi_flash_resource,
535};
536
449static void __init ap_init_timer(void) 537static void __init ap_init_timer(void)
450{ 538{
451 struct clk *clk; 539 struct clk *clk;
@@ -460,14 +548,62 @@ static void __init ap_init_timer(void)
460 writel(0, TIMER1_VA_BASE + TIMER_CTRL); 548 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
461 writel(0, TIMER2_VA_BASE + TIMER_CTRL); 549 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
462 550
463 integrator_clocksource_init(rate); 551 integrator_clocksource_init(rate, (void __iomem *)TIMER2_VA_BASE);
464 integrator_clockevent_init(rate); 552 integrator_clockevent_init(rate, (void __iomem *)TIMER1_VA_BASE,
553 IRQ_TIMERINT1);
465} 554}
466 555
467static struct sys_timer ap_timer = { 556static struct sys_timer ap_timer = {
468 .init = ap_init_timer, 557 .init = ap_init_timer,
469}; 558};
470 559
560#define INTEGRATOR_SC_VALID_INT 0x003fffff
561
562static void __init ap_init_irq(void)
563{
564 /* Disable all interrupts initially. */
565 /* Do the core module ones */
566 writel(-1, VA_CMIC_BASE + IRQ_ENABLE_CLEAR);
567
568 /* do the header card stuff next */
569 writel(-1, VA_IC_BASE + IRQ_ENABLE_CLEAR);
570 writel(-1, VA_IC_BASE + FIQ_ENABLE_CLEAR);
571
572 fpga_irq_init(VA_IC_BASE, "SC", IRQ_PIC_START,
573 -1, INTEGRATOR_SC_VALID_INT, NULL);
574 integrator_clk_init(false);
575}
576
577static void __init ap_init(void)
578{
579 unsigned long sc_dec;
580 int i;
581
582 platform_device_register(&cfi_flash_device);
583
584 sc_dec = readl(VA_SC_BASE + INTEGRATOR_SC_DEC_OFFSET);
585 for (i = 0; i < 4; i++) {
586 struct lm_device *lmdev;
587
588 if ((sc_dec & (16 << i)) == 0)
589 continue;
590
591 lmdev = kzalloc(sizeof(struct lm_device), GFP_KERNEL);
592 if (!lmdev)
593 continue;
594
595 lmdev->resource.start = 0xc0000000 + 0x10000000 * i;
596 lmdev->resource.end = lmdev->resource.start + 0x0fffffff;
597 lmdev->resource.flags = IORESOURCE_MEM;
598 lmdev->irq = IRQ_AP_EXPINT0 + i;
599 lmdev->id = i;
600
601 lm_device_register(lmdev);
602 }
603
604 integrator_init(false);
605}
606
471MACHINE_START(INTEGRATOR, "ARM-Integrator") 607MACHINE_START(INTEGRATOR, "ARM-Integrator")
472 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 608 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
473 .atag_offset = 0x100, 609 .atag_offset = 0x100,
@@ -481,3 +617,5 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
481 .init_machine = ap_init, 617 .init_machine = ap_init,
482 .restart = integrator_restart, 618 .restart = integrator_restart,
483MACHINE_END 619MACHINE_END
620
621#endif
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 3df5fc369361..5b08e8e4cc83 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -23,6 +23,9 @@
23#include <linux/gfp.h> 23#include <linux/gfp.h>
24#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/platform_data/clk-integrator.h> 25#include <linux/platform_data/clk-integrator.h>
26#include <linux/of_irq.h>
27#include <linux/of_address.h>
28#include <linux/of_platform.h>
26 29
27#include <mach/hardware.h> 30#include <mach/hardware.h>
28#include <mach/platform.h> 31#include <mach/platform.h>
@@ -49,16 +52,9 @@
49#include "common.h" 52#include "common.h"
50 53
51#define INTCP_PA_FLASH_BASE 0x24000000 54#define INTCP_PA_FLASH_BASE 0x24000000
52#define INTCP_FLASH_SIZE SZ_32M
53 55
54#define INTCP_PA_CLCD_BASE 0xc0000000 56#define INTCP_PA_CLCD_BASE 0xc0000000
55 57
56#define INTCP_VA_CIC_BASE __io_address(INTEGRATOR_HDR_BASE + 0x40)
57#define INTCP_VA_PIC_BASE __io_address(INTEGRATOR_IC_BASE)
58#define INTCP_VA_SIC_BASE __io_address(INTEGRATOR_CP_SIC_BASE)
59
60#define INTCP_ETH_SIZE 0x10
61
62#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE) 58#define INTCP_VA_CTRL_BASE __io_address(INTEGRATOR_CP_CTL_BASE)
63#define INTCP_FLASHPROG 0x04 59#define INTCP_FLASHPROG 0x04
64#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0) 60#define CINTEGRATOR_FLASHPROG_FLVPPEN (1 << 0)
@@ -143,37 +139,6 @@ static void __init intcp_map_io(void)
143 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc)); 139 iotable_init(intcp_io_desc, ARRAY_SIZE(intcp_io_desc));
144} 140}
145 141
146static void __init intcp_init_irq(void)
147{
148 u32 pic_mask, cic_mask, sic_mask;
149
150 /* These masks are for the HW IRQ registers */
151 pic_mask = ~((~0u) << (11 - IRQ_PIC_START));
152 pic_mask |= (~((~0u) << (29 - 22))) << 22;
153 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
154 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
155
156 /*
157 * Disable all interrupt sources
158 */
159 writel(0xffffffff, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
160 writel(0xffffffff, INTCP_VA_PIC_BASE + FIQ_ENABLE_CLEAR);
161 writel(0xffffffff, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
162 writel(0xffffffff, INTCP_VA_CIC_BASE + FIQ_ENABLE_CLEAR);
163 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
164 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
165
166 fpga_irq_init(INTCP_VA_PIC_BASE, "PIC", IRQ_PIC_START,
167 -1, pic_mask, NULL);
168
169 fpga_irq_init(INTCP_VA_CIC_BASE, "CIC", IRQ_CIC_START,
170 -1, cic_mask, NULL);
171
172 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
173 IRQ_CP_CPPLDINT, sic_mask, NULL);
174 integrator_clk_init(true);
175}
176
177/* 142/*
178 * Flash handling. 143 * Flash handling.
179 */ 144 */
@@ -216,47 +181,6 @@ static struct physmap_flash_data intcp_flash_data = {
216 .set_vpp = intcp_flash_set_vpp, 181 .set_vpp = intcp_flash_set_vpp,
217}; 182};
218 183
219static struct resource intcp_flash_resource = {
220 .start = INTCP_PA_FLASH_BASE,
221 .end = INTCP_PA_FLASH_BASE + INTCP_FLASH_SIZE - 1,
222 .flags = IORESOURCE_MEM,
223};
224
225static struct platform_device intcp_flash_device = {
226 .name = "physmap-flash",
227 .id = 0,
228 .dev = {
229 .platform_data = &intcp_flash_data,
230 },
231 .num_resources = 1,
232 .resource = &intcp_flash_resource,
233};
234
235static struct resource smc91x_resources[] = {
236 [0] = {
237 .start = INTEGRATOR_CP_ETH_BASE,
238 .end = INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
239 .flags = IORESOURCE_MEM,
240 },
241 [1] = {
242 .start = IRQ_CP_ETHINT,
243 .end = IRQ_CP_ETHINT,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct platform_device smc91x_device = {
249 .name = "smc91x",
250 .id = 0,
251 .num_resources = ARRAY_SIZE(smc91x_resources),
252 .resource = smc91x_resources,
253};
254
255static struct platform_device *intcp_devs[] __initdata = {
256 &intcp_flash_device,
257 &smc91x_device,
258};
259
260/* 184/*
261 * It seems that the card insertion interrupt remains active after 185 * It seems that the card insertion interrupt remains active after
262 * we've acknowledged it. We therefore ignore the interrupt, and 186 * we've acknowledged it. We therefore ignore the interrupt, and
@@ -278,16 +202,6 @@ static struct mmci_platform_data mmc_data = {
278 .gpio_cd = -1, 202 .gpio_cd = -1,
279}; 203};
280 204
281#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
282#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
283
284static AMBA_APB_DEVICE(mmc, "mmci", 0, INTEGRATOR_CP_MMC_BASE,
285 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
286
287static AMBA_APB_DEVICE(aaci, "aaci", 0, INTEGRATOR_CP_AACI_BASE,
288 INTEGRATOR_CP_AACI_IRQS, NULL);
289
290
291/* 205/*
292 * CLCD support 206 * CLCD support
293 */ 207 */
@@ -338,15 +252,6 @@ static struct clcd_board clcd_data = {
338 .remove = versatile_clcd_remove_dma, 252 .remove = versatile_clcd_remove_dma,
339}; 253};
340 254
341static AMBA_AHB_DEVICE(clcd, "clcd", 0, INTCP_PA_CLCD_BASE,
342 { IRQ_CP_CLCDCINT }, &clcd_data);
343
344static struct amba_device *amba_devs[] __initdata = {
345 &mmc_device,
346 &aaci_device,
347 &clcd_device,
348};
349
350#define REFCOUNTER (__io_address(INTEGRATOR_HDR_BASE) + 0x28) 255#define REFCOUNTER (__io_address(INTEGRATOR_HDR_BASE) + 0x28)
351 256
352static void __init intcp_init_early(void) 257static void __init intcp_init_early(void)
@@ -356,16 +261,193 @@ static void __init intcp_init_early(void)
356#endif 261#endif
357} 262}
358 263
359static void __init intcp_init(void) 264#ifdef CONFIG_OF
265
266static void __init intcp_timer_init_of(void)
360{ 267{
361 int i; 268 struct device_node *node;
269 const char *path;
270 void __iomem *base;
271 int err;
272 int irq;
273
274 err = of_property_read_string(of_aliases,
275 "arm,timer-primary", &path);
276 if (WARN_ON(err))
277 return;
278 node = of_find_node_by_path(path);
279 base = of_iomap(node, 0);
280 if (WARN_ON(!base))
281 return;
282 writel(0, base + TIMER_CTRL);
283 sp804_clocksource_init(base, node->name);
284
285 err = of_property_read_string(of_aliases,
286 "arm,timer-secondary", &path);
287 if (WARN_ON(err))
288 return;
289 node = of_find_node_by_path(path);
290 base = of_iomap(node, 0);
291 if (WARN_ON(!base))
292 return;
293 irq = irq_of_parse_and_map(node, 0);
294 writel(0, base + TIMER_CTRL);
295 sp804_clockevents_init(base, irq, node->name);
296}
362 297
363 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs)); 298static struct sys_timer cp_of_timer = {
299 .init = intcp_timer_init_of,
300};
364 301
365 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 302static const struct of_device_id fpga_irq_of_match[] __initconst = {
366 struct amba_device *d = amba_devs[i]; 303 { .compatible = "arm,versatile-fpga-irq", .data = fpga_irq_of_init, },
367 amba_device_register(d, &iomem_resource); 304 { /* Sentinel */ }
368 } 305};
306
307static void __init intcp_init_irq_of(void)
308{
309 of_irq_init(fpga_irq_of_match);
310 integrator_clk_init(true);
311}
312
313/*
314 * For the Device Tree, add in the UART, MMC and CLCD specifics as AUXDATA
315 * and enforce the bus names since these are used for clock lookups.
316 */
317static struct of_dev_auxdata intcp_auxdata_lookup[] __initdata = {
318 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_RTC_BASE,
319 "rtc", NULL),
320 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART0_BASE,
321 "uart0", &integrator_uart_data),
322 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_UART1_BASE,
323 "uart1", &integrator_uart_data),
324 OF_DEV_AUXDATA("arm,primecell", KMI0_BASE,
325 "kmi0", NULL),
326 OF_DEV_AUXDATA("arm,primecell", KMI1_BASE,
327 "kmi1", NULL),
328 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_CP_MMC_BASE,
329 "mmci", &mmc_data),
330 OF_DEV_AUXDATA("arm,primecell", INTEGRATOR_CP_AACI_BASE,
331 "aaci", &mmc_data),
332 OF_DEV_AUXDATA("arm,primecell", INTCP_PA_CLCD_BASE,
333 "clcd", &clcd_data),
334 OF_DEV_AUXDATA("cfi-flash", INTCP_PA_FLASH_BASE,
335 "physmap-flash", &intcp_flash_data),
336 { /* sentinel */ },
337};
338
339static void __init intcp_init_of(void)
340{
341 of_platform_populate(NULL, of_default_bus_match_table,
342 intcp_auxdata_lookup, NULL);
343}
344
345static const char * intcp_dt_board_compat[] = {
346 "arm,integrator-cp",
347 NULL,
348};
349
350DT_MACHINE_START(INTEGRATOR_CP_DT, "ARM Integrator/CP (Device Tree)")
351 .reserve = integrator_reserve,
352 .map_io = intcp_map_io,
353 .nr_irqs = NR_IRQS_INTEGRATOR_CP,
354 .init_early = intcp_init_early,
355 .init_irq = intcp_init_irq_of,
356 .handle_irq = fpga_handle_irq,
357 .timer = &cp_of_timer,
358 .init_machine = intcp_init_of,
359 .restart = integrator_restart,
360 .dt_compat = intcp_dt_board_compat,
361MACHINE_END
362
363#endif
364
365#ifdef CONFIG_ATAGS
366
367/*
368 * This is where non-devicetree initialization code is collected and stashed
369 * for eventual deletion.
370 */
371
372#define INTCP_FLASH_SIZE SZ_32M
373
374static struct resource intcp_flash_resource = {
375 .start = INTCP_PA_FLASH_BASE,
376 .end = INTCP_PA_FLASH_BASE + INTCP_FLASH_SIZE - 1,
377 .flags = IORESOURCE_MEM,
378};
379
380static struct platform_device intcp_flash_device = {
381 .name = "physmap-flash",
382 .id = 0,
383 .dev = {
384 .platform_data = &intcp_flash_data,
385 },
386 .num_resources = 1,
387 .resource = &intcp_flash_resource,
388};
389
390#define INTCP_ETH_SIZE 0x10
391
392static struct resource smc91x_resources[] = {
393 [0] = {
394 .start = INTEGRATOR_CP_ETH_BASE,
395 .end = INTEGRATOR_CP_ETH_BASE + INTCP_ETH_SIZE - 1,
396 .flags = IORESOURCE_MEM,
397 },
398 [1] = {
399 .start = IRQ_CP_ETHINT,
400 .end = IRQ_CP_ETHINT,
401 .flags = IORESOURCE_IRQ,
402 },
403};
404
405static struct platform_device smc91x_device = {
406 .name = "smc91x",
407 .id = 0,
408 .num_resources = ARRAY_SIZE(smc91x_resources),
409 .resource = smc91x_resources,
410};
411
412static struct platform_device *intcp_devs[] __initdata = {
413 &intcp_flash_device,
414 &smc91x_device,
415};
416
417#define INTCP_VA_CIC_BASE __io_address(INTEGRATOR_HDR_BASE + 0x40)
418#define INTCP_VA_PIC_BASE __io_address(INTEGRATOR_IC_BASE)
419#define INTCP_VA_SIC_BASE __io_address(INTEGRATOR_CP_SIC_BASE)
420
421static void __init intcp_init_irq(void)
422{
423 u32 pic_mask, cic_mask, sic_mask;
424
425 /* These masks are for the HW IRQ registers */
426 pic_mask = ~((~0u) << (11 - IRQ_PIC_START));
427 pic_mask |= (~((~0u) << (29 - 22))) << 22;
428 cic_mask = ~((~0u) << (1 + IRQ_CIC_END - IRQ_CIC_START));
429 sic_mask = ~((~0u) << (1 + IRQ_SIC_END - IRQ_SIC_START));
430
431 /*
432 * Disable all interrupt sources
433 */
434 writel(0xffffffff, INTCP_VA_PIC_BASE + IRQ_ENABLE_CLEAR);
435 writel(0xffffffff, INTCP_VA_PIC_BASE + FIQ_ENABLE_CLEAR);
436 writel(0xffffffff, INTCP_VA_CIC_BASE + IRQ_ENABLE_CLEAR);
437 writel(0xffffffff, INTCP_VA_CIC_BASE + FIQ_ENABLE_CLEAR);
438 writel(sic_mask, INTCP_VA_SIC_BASE + IRQ_ENABLE_CLEAR);
439 writel(sic_mask, INTCP_VA_SIC_BASE + FIQ_ENABLE_CLEAR);
440
441 fpga_irq_init(INTCP_VA_PIC_BASE, "PIC", IRQ_PIC_START,
442 -1, pic_mask, NULL);
443
444 fpga_irq_init(INTCP_VA_CIC_BASE, "CIC", IRQ_CIC_START,
445 -1, cic_mask, NULL);
446
447 fpga_irq_init(INTCP_VA_SIC_BASE, "SIC", IRQ_SIC_START,
448 IRQ_CP_CPPLDINT, sic_mask, NULL);
449
450 integrator_clk_init(true);
369} 451}
370 452
371#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE) 453#define TIMER0_VA_BASE __io_address(INTEGRATOR_TIMER0_BASE)
@@ -386,6 +468,37 @@ static struct sys_timer cp_timer = {
386 .init = intcp_timer_init, 468 .init = intcp_timer_init,
387}; 469};
388 470
471#define INTEGRATOR_CP_MMC_IRQS { IRQ_CP_MMCIINT0, IRQ_CP_MMCIINT1 }
472#define INTEGRATOR_CP_AACI_IRQS { IRQ_CP_AACIINT }
473
474static AMBA_APB_DEVICE(mmc, "mmci", 0, INTEGRATOR_CP_MMC_BASE,
475 INTEGRATOR_CP_MMC_IRQS, &mmc_data);
476
477static AMBA_APB_DEVICE(aaci, "aaci", 0, INTEGRATOR_CP_AACI_BASE,
478 INTEGRATOR_CP_AACI_IRQS, NULL);
479
480static AMBA_AHB_DEVICE(clcd, "clcd", 0, INTCP_PA_CLCD_BASE,
481 { IRQ_CP_CLCDCINT }, &clcd_data);
482
483static struct amba_device *amba_devs[] __initdata = {
484 &mmc_device,
485 &aaci_device,
486 &clcd_device,
487};
488
489static void __init intcp_init(void)
490{
491 int i;
492
493 platform_add_devices(intcp_devs, ARRAY_SIZE(intcp_devs));
494
495 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
496 struct amba_device *d = amba_devs[i];
497 amba_device_register(d, &iomem_resource);
498 }
499 integrator_init(true);
500}
501
389MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") 502MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
390 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 503 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
391 .atag_offset = 0x100, 504 .atag_offset = 0x100,
@@ -399,3 +512,5 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
399 .init_machine = intcp_init, 512 .init_machine = intcp_init,
400 .restart = integrator_restart, 513 .restart = integrator_restart,
401MACHINE_END 514MACHINE_END
515
516#endif
diff --git a/arch/arm/mach-iop13xx/iq81340sc.c b/arch/arm/mach-iop13xx/iq81340sc.c
index 060cddde2fd4..e94744111634 100644
--- a/arch/arm/mach-iop13xx/iq81340sc.c
+++ b/arch/arm/mach-iop13xx/iq81340sc.c
@@ -30,7 +30,7 @@
30extern int init_atu; 30extern int init_atu;
31 31
32static int __init 32static int __init
33iq81340sc_atux_map_irq(struct pci_dev *dev, u8 idsel, u8 pin) 33iq81340sc_atux_map_irq(const struct pci_dev *dev, u8 idsel, u8 pin)
34{ 34{
35 WARN_ON(idsel < 1 || idsel > 2); 35 WARN_ON(idsel < 1 || idsel > 2);
36 36
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 9082b84aeebb..2f28018c4447 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -504,7 +504,7 @@ iop13xx_pci_abort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
504 504
505/* Scan an IOP13XX PCI bus. nr selects which ATU we use. 505/* Scan an IOP13XX PCI bus. nr selects which ATU we use.
506 */ 506 */
507struct pci_bus *iop13xx_scan_bus(int nr, struct pci_sys_data *sys) 507struct pci_bus * __devinit iop13xx_scan_bus(int nr, struct pci_sys_data *sys)
508{ 508{
509 int which_atu; 509 int which_atu;
510 struct pci_bus *bus = NULL; 510 struct pci_bus *bus = NULL;
diff --git a/arch/arm/mach-ks8695/include/mach/memory.h b/arch/arm/mach-ks8695/include/mach/memory.h
index f7e1b9bce345..95e731a7ed6a 100644
--- a/arch/arm/mach-ks8695/include/mach/memory.h
+++ b/arch/arm/mach-ks8695/include/mach/memory.h
@@ -34,7 +34,8 @@ extern struct bus_type platform_bus_type;
34#define __arch_dma_to_virt(dev, x) ({ (void *) (is_lbus_device(dev) ? \ 34#define __arch_dma_to_virt(dev, x) ({ (void *) (is_lbus_device(dev) ? \
35 __phys_to_virt(x) : __bus_to_virt(x)); }) 35 __phys_to_virt(x) : __bus_to_virt(x)); })
36#define __arch_virt_to_dma(dev, x) ({ is_lbus_device(dev) ? \ 36#define __arch_virt_to_dma(dev, x) ({ is_lbus_device(dev) ? \
37 (dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); }) 37 (dma_addr_t)__virt_to_phys((unsigned long)x) \
38 : (dma_addr_t)__virt_to_bus(x); })
38#define __arch_pfn_to_dma(dev, pfn) \ 39#define __arch_pfn_to_dma(dev, pfn) \
39 ({ dma_addr_t __dma = __pfn_to_phys(pfn); \ 40 ({ dma_addr_t __dma = __pfn_to_phys(pfn); \
40 if (!is_lbus_device(dev)) \ 41 if (!is_lbus_device(dev)) \
diff --git a/arch/arm/mach-mv78xx0/addr-map.c b/arch/arm/mach-mv78xx0/addr-map.c
index 343c435b4176..26e9876b50e9 100644
--- a/arch/arm/mach-mv78xx0/addr-map.c
+++ b/arch/arm/mach-mv78xx0/addr-map.c
@@ -54,7 +54,7 @@ static void __init __iomem *win_cfg_base(const struct orion_addr_map_cfg *cfg, i
54/* 54/*
55 * Description of the windows needed by the platform code 55 * Description of the windows needed by the platform code
56 */ 56 */
57static struct __initdata orion_addr_map_cfg addr_map_cfg = { 57static struct orion_addr_map_cfg addr_map_cfg __initdata = {
58 .num_wins = 14, 58 .num_wins = 14,
59 .remappable_wins = 8, 59 .remappable_wins = 8,
60 .win_cfg_base = win_cfg_base, 60 .win_cfg_base = win_cfg_base,
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index 131cd4883f3d..d0cb4857b4b3 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -336,7 +336,7 @@ void __init mv78xx0_init_early(void)
336 orion_time_set_base(TIMER_VIRT_BASE); 336 orion_time_set_base(TIMER_VIRT_BASE);
337} 337}
338 338
339static void mv78xx0_timer_init(void) 339static void __init_refok mv78xx0_timer_init(void)
340{ 340{
341 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR, 341 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
342 IRQ_MV78XX0_TIMER_1, get_tclk()); 342 IRQ_MV78XX0_TIMER_1, get_tclk());
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index fc3afc7cd366..a103c8ffea9f 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -22,6 +22,7 @@
22#include <asm/mach/map.h> 22#include <asm/mach/map.h>
23 23
24#include <mach/pxa25x.h> 24#include <mach/pxa25x.h>
25#undef GPIO24_SSP1_SFRM
25#include <mach/pxa27x.h> 26#include <mach/pxa27x.h>
26#include <mach/audio.h> 27#include <mach/audio.h>
27#include <linux/platform_data/video-pxafb.h> 28#include <linux/platform_data/video-pxafb.h>
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c
index 997e6da9a9c4..32e0d7998355 100644
--- a/arch/arm/mach-pxa/palmte2.c
+++ b/arch/arm/mach-pxa/palmte2.c
@@ -105,6 +105,7 @@ static struct pxamci_platform_data palmte2_mci_platform_data = {
105 .gpio_power = GPIO_NR_PALMTE2_SD_POWER, 105 .gpio_power = GPIO_NR_PALMTE2_SD_POWER,
106}; 106};
107 107
108#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
108/****************************************************************************** 109/******************************************************************************
109 * GPIO keys 110 * GPIO keys
110 ******************************************************************************/ 111 ******************************************************************************/
@@ -132,6 +133,7 @@ static struct platform_device palmte2_pxa_keys = {
132 .platform_data = &palmte2_pxa_keys_data, 133 .platform_data = &palmte2_pxa_keys_data,
133 }, 134 },
134}; 135};
136#endif
135 137
136/****************************************************************************** 138/******************************************************************************
137 * Backlight 139 * Backlight
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 5a406f794798..ec55c575ed19 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -55,7 +55,6 @@
55#ifdef CONFIG_PM 55#ifdef CONFIG_PM
56static int sharpsl_off_charge_battery(void); 56static int sharpsl_off_charge_battery(void);
57static int sharpsl_check_battery_voltage(void); 57static int sharpsl_check_battery_voltage(void);
58static int sharpsl_fatal_check(void);
59#endif 58#endif
60static int sharpsl_check_battery_temp(void); 59static int sharpsl_check_battery_temp(void);
61static int sharpsl_ac_check(void); 60static int sharpsl_ac_check(void);
@@ -686,53 +685,6 @@ static int corgi_pxa_pm_enter(suspend_state_t state)
686 return 0; 685 return 0;
687} 686}
688 687
689/*
690 * Check for fatal battery errors
691 * Fatal returns -1
692 */
693static int sharpsl_fatal_check(void)
694{
695 int buff[5], temp, i, acin;
696
697 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
698
699 /* Check AC-Adapter */
700 acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
701
702 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
703 sharpsl_pm.machinfo->charge(0);
704 udelay(100);
705 sharpsl_pm.machinfo->discharge(1); /* enable discharge */
706 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
707 }
708
709 if (sharpsl_pm.machinfo->discharge1)
710 sharpsl_pm.machinfo->discharge1(1);
711
712 /* Check battery : check inserting battery ? */
713 for (i = 0; i < 5; i++) {
714 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
715 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
716 }
717
718 if (sharpsl_pm.machinfo->discharge1)
719 sharpsl_pm.machinfo->discharge1(0);
720
721 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
722 udelay(100);
723 sharpsl_pm.machinfo->charge(1);
724 sharpsl_pm.machinfo->discharge(0);
725 }
726
727 temp = get_select_val(buff);
728 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %ld\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT));
729
730 if ((acin && (temp < sharpsl_pm.machinfo->fatal_acin_volt)) ||
731 (!acin && (temp < sharpsl_pm.machinfo->fatal_noacin_volt)))
732 return -1;
733 return 0;
734}
735
736static int sharpsl_off_charge_error(void) 688static int sharpsl_off_charge_error(void)
737{ 689{
738 dev_err(sharpsl_pm.dev, "Offline Charger: Error occurred.\n"); 690 dev_err(sharpsl_pm.dev, "Offline Charger: Error occurred.\n");
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 392412ce4dac..c773e4dded64 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -768,8 +768,7 @@ static unsigned long viper_tpm;
768 768
769static int __init viper_tpm_setup(char *str) 769static int __init viper_tpm_setup(char *str)
770{ 770{
771 strict_strtoul(str, 10, &viper_tpm); 771 return strict_strtoul(str, 10, &viper_tpm) >= 0;
772 return 1;
773} 772}
774 773
775__setup("tpm=", viper_tpm_setup); 774__setup("tpm=", viper_tpm_setup);
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index b91bc87b3dcf..fcb1d59f7aec 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -960,7 +960,9 @@ static int __init ecard_probe(int slot, unsigned irq, card_type_t type)
960 *ecp = ec; 960 *ecp = ec;
961 slot_to_expcard[slot] = ec; 961 slot_to_expcard[slot] = ec;
962 962
963 device_register(&ec->dev); 963 rc = device_register(&ec->dev);
964 if (rc)
965 goto nodev;
964 966
965 return 0; 967 return 0;
966 968
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2416.c b/arch/arm/mach-s3c24xx/irq-s3c2416.c
index 23ec97370f32..ff141b0af26b 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c2416.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2416.c
@@ -232,7 +232,7 @@ struct irq_chip s3c2416_irq_second = {
232 232
233/* IRQ initialisation code */ 233/* IRQ initialisation code */
234 234
235static int __init s3c2416_add_sub(unsigned int base, 235static int s3c2416_add_sub(unsigned int base,
236 void (*demux)(unsigned int, 236 void (*demux)(unsigned int,
237 struct irq_desc *), 237 struct irq_desc *),
238 struct irq_chip *chip, 238 struct irq_chip *chip,
@@ -251,7 +251,7 @@ static int __init s3c2416_add_sub(unsigned int base,
251 return 0; 251 return 0;
252} 252}
253 253
254static void __init s3c2416_irq_add_second(void) 254static void s3c2416_irq_add_second(void)
255{ 255{
256 unsigned long pend; 256 unsigned long pend;
257 unsigned long last; 257 unsigned long last;
@@ -287,7 +287,7 @@ static void __init s3c2416_irq_add_second(void)
287 } 287 }
288} 288}
289 289
290static int __init s3c2416_irq_add(struct device *dev, 290static int s3c2416_irq_add(struct device *dev,
291 struct subsys_interface *sif) 291 struct subsys_interface *sif)
292{ 292{
293 printk(KERN_INFO "S3C2416: IRQ Support\n"); 293 printk(KERN_INFO "S3C2416: IRQ Support\n");
diff --git a/arch/arm/mach-s3c24xx/irq-s3c2443.c b/arch/arm/mach-s3c24xx/irq-s3c2443.c
index ac2829f56d12..5e69109c0928 100644
--- a/arch/arm/mach-s3c24xx/irq-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/irq-s3c2443.c
@@ -222,7 +222,7 @@ static struct irq_chip s3c2443_irq_cam = {
222 222
223/* IRQ initialisation code */ 223/* IRQ initialisation code */
224 224
225static int __init s3c2443_add_sub(unsigned int base, 225static int s3c2443_add_sub(unsigned int base,
226 void (*demux)(unsigned int, 226 void (*demux)(unsigned int,
227 struct irq_desc *), 227 struct irq_desc *),
228 struct irq_chip *chip, 228 struct irq_chip *chip,
@@ -241,7 +241,7 @@ static int __init s3c2443_add_sub(unsigned int base,
241 return 0; 241 return 0;
242} 242}
243 243
244static int __init s3c2443_irq_add(struct device *dev, 244static int s3c2443_irq_add(struct device *dev,
245 struct subsys_interface *sif) 245 struct subsys_interface *sif)
246{ 246{
247 printk("S3C2443: IRQ Support\n"); 247 printk("S3C2443: IRQ Support\n");
diff --git a/arch/arm/mach-s3c24xx/simtec-usb.c b/arch/arm/mach-s3c24xx/simtec-usb.c
index 17f8356177c1..ddf7a3c743ac 100644
--- a/arch/arm/mach-s3c24xx/simtec-usb.c
+++ b/arch/arm/mach-s3c24xx/simtec-usb.c
@@ -104,7 +104,7 @@ static struct s3c2410_hcd_info usb_simtec_info __initdata = {
104}; 104};
105 105
106 106
107int usb_simtec_init(void) 107int __init usb_simtec_init(void)
108{ 108{
109 int ret; 109 int ret;
110 110
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index e1ccda6128eb..6a7ad3c2a3fc 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -388,7 +388,7 @@ static void __init map_sa1100_gpio_regs( void )
388 */ 388 */
389static void __init get_assabet_scr(void) 389static void __init get_assabet_scr(void)
390{ 390{
391 unsigned long scr, i; 391 unsigned long uninitialized_var(scr), i;
392 392
393 GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */ 393 GPDR |= 0x3fc; /* Configure GPIO 9:2 as outputs */
394 GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */ 394 GPSR = 0x3fc; /* Write 0xFF to GPIO 9:2 */
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1111.h b/arch/arm/mach-sa1100/include/mach/SA-1111.h
deleted file mode 100644
index c38f60915cb6..000000000000
--- a/arch/arm/mach-sa1100/include/mach/SA-1111.h
+++ /dev/null
@@ -1,5 +0,0 @@
1/*
2 * Moved to new location
3 */
4#warning using old SA-1111.h - update to <asm/hardware/sa1111.h>
5#include <asm/hardware/sa1111.h>
diff --git a/arch/arm/mach-sa1100/include/mach/lart.h b/arch/arm/mach-sa1100/include/mach/lart.h
deleted file mode 100644
index 8a5482d908db..000000000000
--- a/arch/arm/mach-sa1100/include/mach/lart.h
+++ /dev/null
@@ -1,13 +0,0 @@
1#ifndef _INCLUDE_LART_H
2#define _INCLUDE_LART_H
3
4#define LART_GPIO_ETH0 GPIO_GPIO0
5#define LART_IRQ_ETH0 IRQ_GPIO0
6
7#define LART_GPIO_IDE GPIO_GPIO1
8#define LART_IRQ_IDE IRQ_GPIO1
9
10#define LART_GPIO_UCB1200 GPIO_GPIO18
11#define LART_IRQ_UCB1200 IRQ_GPIO18
12
13#endif
diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c
index b8b4ab323a3e..6d91a914c1dd 100644
--- a/arch/arm/mach-shark/pci.c
+++ b/arch/arm/mach-shark/pci.c
@@ -41,7 +41,7 @@ static struct hw_pci shark_pci __initdata = {
41static int __init shark_pci_init(void) 41static int __init shark_pci_init(void)
42{ 42{
43 if (!machine_is_shark()) 43 if (!machine_is_shark())
44 return; 44 return -ENODEV;
45 45
46 pcibios_min_io = 0x6000; 46 pcibios_min_io = 0x6000;
47 pcibios_min_mem = 0x50000000; 47 pcibios_min_mem = 0x50000000;
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index ed77ab8c9143..d47e215aca87 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -100,7 +100,7 @@ static inline int shmobile_cpu_is_dead(unsigned int cpu) { return 1; }
100 100
101extern void shmobile_smp_init_cpus(unsigned int ncores); 101extern void shmobile_smp_init_cpus(unsigned int ncores);
102 102
103static inline void shmobile_init_late(void) 103static inline void __init shmobile_init_late(void)
104{ 104{
105 shmobile_suspend_init(); 105 shmobile_suspend_init();
106 shmobile_cpuidle_init(); 106 shmobile_cpuidle_init();
diff --git a/arch/arm/mach-shmobile/smp-emev2.c b/arch/arm/mach-shmobile/smp-emev2.c
index f978c5d0e1ae..f67456286280 100644
--- a/arch/arm/mach-shmobile/smp-emev2.c
+++ b/arch/arm/mach-shmobile/smp-emev2.c
@@ -100,7 +100,7 @@ static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *
100 /* Tell ROM loader about our vector (in headsmp.S) */ 100 /* Tell ROM loader about our vector (in headsmp.S) */
101 emev2_set_boot_vector(__pa(shmobile_secondary_vector)); 101 emev2_set_boot_vector(__pa(shmobile_secondary_vector));
102 102
103 gic_raise_softirq(cpumask_of(cpu), 1); 103 gic_raise_softirq(cpumask_of(cpu), 0);
104 return 0; 104 return 0;
105} 105}
106 106
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 5f3c03b61f8e..11680c532b38 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -16,7 +16,7 @@ config ARCH_TEGRA_2x_SOC
16 select ARM_ERRATA_742230 16 select ARM_ERRATA_742230
17 select ARM_ERRATA_751472 17 select ARM_ERRATA_751472
18 select ARM_ERRATA_754327 18 select ARM_ERRATA_754327
19 select ARM_ERRATA_764369 19 select ARM_ERRATA_764369 if SMP
20 select PL310_ERRATA_727915 if CACHE_L2X0 20 select PL310_ERRATA_727915 if CACHE_L2X0
21 select PL310_ERRATA_769419 if CACHE_L2X0 21 select PL310_ERRATA_769419 if CACHE_L2X0
22 select CPU_FREQ_TABLE if CPU_FREQ 22 select CPU_FREQ_TABLE if CPU_FREQ
@@ -37,7 +37,7 @@ config ARCH_TEGRA_3x_SOC
37 select ARM_ERRATA_743622 37 select ARM_ERRATA_743622
38 select ARM_ERRATA_751472 38 select ARM_ERRATA_751472
39 select ARM_ERRATA_754322 39 select ARM_ERRATA_754322
40 select ARM_ERRATA_764369 40 select ARM_ERRATA_764369 if SMP
41 select PL310_ERRATA_769419 if CACHE_L2X0 41 select PL310_ERRATA_769419 if CACHE_L2X0
42 select CPU_FREQ_TABLE if CPU_FREQ 42 select CPU_FREQ_TABLE if CPU_FREQ
43 help 43 help
@@ -57,8 +57,6 @@ config TEGRA_AHB
57 which controls AHB bus master arbitration and some 57 which controls AHB bus master arbitration and some
58 perfomance parameters(priority, prefech size). 58 perfomance parameters(priority, prefech size).
59 59
60comment "Tegra board type"
61
62choice 60choice
63 prompt "Default low-level debug console UART" 61 prompt "Default low-level debug console UART"
64 default TEGRA_DEBUG_UART_NONE 62 default TEGRA_DEBUG_UART_NONE
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index c77c86c47369..5848206ee9b9 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -5,9 +5,9 @@ config UX500_SOC_COMMON
5 default y 5 default y
6 select ARM_GIC 6 select ARM_GIC
7 select HAS_MTU 7 select HAS_MTU
8 select PL310_ERRATA_753970 8 select PL310_ERRATA_753970 if CACHE_PL310
9 select ARM_ERRATA_754322 9 select ARM_ERRATA_754322
10 select ARM_ERRATA_764369 10 select ARM_ERRATA_764369 if SMP
11 select CACHE_L2X0 11 select CACHE_L2X0
12 select PINCTRL 12 select PINCTRL
13 select PINCTRL_NOMADIK 13 select PINCTRL_NOMADIK
diff --git a/arch/arm/mach-vt8500/include/mach/uncompress.h b/arch/arm/mach-vt8500/include/mach/uncompress.h
index bb9e2d23fee3..e6e81fdaf109 100644
--- a/arch/arm/mach-vt8500/include/mach/uncompress.h
+++ b/arch/arm/mach-vt8500/include/mach/uncompress.h
@@ -15,15 +15,15 @@
15 * 15 *
16 */ 16 */
17 17
18#define UART0_PHYS 0xd8200000 18#define UART0_PHYS 0xd8200000
19#include <asm/io.h> 19#define UART0_ADDR(x) *(volatile unsigned char *)(UART0_PHYS + x)
20 20
21static void putc(const char c) 21static void putc(const char c)
22{ 22{
23 while (readb(UART0_PHYS + 0x1c) & 0x2) 23 while (UART0_ADDR(0x1c) & 0x2)
24 /* Tx busy, wait and poll */; 24 /* Tx busy, wait and poll */;
25 25
26 writeb(c, UART0_PHYS); 26 UART0_ADDR(0) = c;
27} 27}
28 28
29static void flush(void) 29static void flush(void)
diff --git a/arch/arm/mach-vt8500/vt8500.c b/arch/arm/mach-vt8500/vt8500.c
index 587ea950d08b..8d3871f110a5 100644
--- a/arch/arm/mach-vt8500/vt8500.c
+++ b/arch/arm/mach-vt8500/vt8500.c
@@ -77,8 +77,11 @@ static void vt8500_power_off(void)
77 77
78void __init vt8500_init(void) 78void __init vt8500_init(void)
79{ 79{
80 struct device_node *np, *fb; 80 struct device_node *np;
81#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505)
82 struct device_node *fb;
81 void __iomem *gpio_base; 83 void __iomem *gpio_base;
84#endif
82 85
83#ifdef CONFIG_FB_VT8500 86#ifdef CONFIG_FB_VT8500
84 fb = of_find_compatible_node(NULL, NULL, "via,vt8500-fb"); 87 fb = of_find_compatible_node(NULL, NULL, "via,vt8500-fb");
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 9107231aacc5..b9f60ebe3bc4 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -699,7 +699,6 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
699 unsigned long instr = *pinstr; 699 unsigned long instr = *pinstr;
700 u16 tinst1 = (instr >> 16) & 0xffff; 700 u16 tinst1 = (instr >> 16) & 0xffff;
701 u16 tinst2 = instr & 0xffff; 701 u16 tinst2 = instr & 0xffff;
702 poffset->un = 0;
703 702
704 switch (tinst1 & 0xffe0) { 703 switch (tinst1 & 0xffe0) {
705 /* A6.3.5 Load/Store multiple */ 704 /* A6.3.5 Load/Store multiple */
@@ -854,9 +853,10 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
854 break; 853 break;
855 854
856 case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */ 855 case 0x08000000: /* ldm or stm, or thumb-2 32bit instruction */
857 if (thumb2_32b) 856 if (thumb2_32b) {
857 offset.un = 0;
858 handler = do_alignment_t32_to_handler(&instr, regs, &offset); 858 handler = do_alignment_t32_to_handler(&instr, regs, &offset);
859 else 859 } else
860 handler = do_alignment_ldmstm; 860 handler = do_alignment_ldmstm;
861 break; 861 break;
862 862
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 577baf7d0a8d..8a97e6443c62 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -368,14 +368,18 @@ void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
368 /* l2x0 controller is disabled */ 368 /* l2x0 controller is disabled */
369 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL); 369 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
370 370
371 l2x0_saved_regs.aux_ctrl = aux;
372
373 l2x0_inv_all(); 371 l2x0_inv_all();
374 372
375 /* enable L2X0 */ 373 /* enable L2X0 */
376 writel_relaxed(1, l2x0_base + L2X0_CTRL); 374 writel_relaxed(1, l2x0_base + L2X0_CTRL);
377 } 375 }
378 376
377 /* Re-read it in case some bits are reserved. */
378 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
379
380 /* Save the value for resuming. */
381 l2x0_saved_regs.aux_ctrl = aux;
382
379 outer_cache.inv_range = l2x0_inv_range; 383 outer_cache.inv_range = l2x0_inv_range;
380 outer_cache.clean_range = l2x0_clean_range; 384 outer_cache.clean_range = l2x0_clean_range;
381 outer_cache.flush_range = l2x0_flush_range; 385 outer_cache.flush_range = l2x0_flush_range;
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 39e3fb3db801..3b172275262e 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -211,6 +211,9 @@ ENTRY(v7_coherent_user_range)
211 * isn't mapped, fail with -EFAULT. 211 * isn't mapped, fail with -EFAULT.
212 */ 212 */
2139001: 2139001:
214#ifdef CONFIG_ARM_ERRATA_775420
215 dsb
216#endif
214 mov r0, #-EFAULT 217 mov r0, #-EFAULT
215 mov pc, lr 218 mov pc, lr
216 UNWIND(.fnend ) 219 UNWIND(.fnend )
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 9aec41fa80ae..ad722f1208a5 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -324,7 +324,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
324 324
325 BUG_ON(!arm_memblock_steal_permitted); 325 BUG_ON(!arm_memblock_steal_permitted);
326 326
327 phys = memblock_alloc(size, align); 327 phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
328 memblock_free(phys, size); 328 memblock_free(phys, size);
329 memblock_remove(phys, size); 329 memblock_remove(phys, size);
330 330
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 9d869f93a3da..5dcc2fd46c46 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -248,6 +248,7 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
248 if (!area) 248 if (!area)
249 return NULL; 249 return NULL;
250 addr = (unsigned long)area->addr; 250 addr = (unsigned long)area->addr;
251 area->phys_addr = __pfn_to_phys(pfn);
251 252
252#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE) 253#if !defined(CONFIG_SMP) && !defined(CONFIG_ARM_LPAE)
253 if (DOMAIN_IO == 0 && 254 if (DOMAIN_IO == 0 &&
diff --git a/arch/arm/plat-versatile/fpga-irq.c b/arch/arm/plat-versatile/fpga-irq.c
index 6e70d03824a1..091ae1030045 100644
--- a/arch/arm/plat-versatile/fpga-irq.c
+++ b/arch/arm/plat-versatile/fpga-irq.c
@@ -5,6 +5,8 @@
5#include <linux/io.h> 5#include <linux/io.h>
6#include <linux/irqdomain.h> 6#include <linux/irqdomain.h>
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/of.h>
9#include <linux/of_address.h>
8 10
9#include <asm/exception.h> 11#include <asm/exception.h>
10#include <asm/mach/irq.h> 12#include <asm/mach/irq.h>
@@ -14,11 +16,17 @@
14#define IRQ_RAW_STATUS 0x04 16#define IRQ_RAW_STATUS 0x04
15#define IRQ_ENABLE_SET 0x08 17#define IRQ_ENABLE_SET 0x08
16#define IRQ_ENABLE_CLEAR 0x0c 18#define IRQ_ENABLE_CLEAR 0x0c
19#define INT_SOFT_SET 0x10
20#define INT_SOFT_CLEAR 0x14
21#define FIQ_STATUS 0x20
22#define FIQ_RAW_STATUS 0x24
23#define FIQ_ENABLE 0x28
24#define FIQ_ENABLE_SET 0x28
25#define FIQ_ENABLE_CLEAR 0x2C
17 26
18/** 27/**
19 * struct fpga_irq_data - irq data container for the FPGA IRQ controller 28 * struct fpga_irq_data - irq data container for the FPGA IRQ controller
20 * @base: memory offset in virtual memory 29 * @base: memory offset in virtual memory
21 * @irq_start: first IRQ number handled by this instance
22 * @chip: chip container for this instance 30 * @chip: chip container for this instance
23 * @domain: IRQ domain for this instance 31 * @domain: IRQ domain for this instance
24 * @valid: mask for valid IRQs on this controller 32 * @valid: mask for valid IRQs on this controller
@@ -26,7 +34,6 @@
26 */ 34 */
27struct fpga_irq_data { 35struct fpga_irq_data {
28 void __iomem *base; 36 void __iomem *base;
29 unsigned int irq_start;
30 struct irq_chip chip; 37 struct irq_chip chip;
31 u32 valid; 38 u32 valid;
32 struct irq_domain *domain; 39 struct irq_domain *domain;
@@ -125,34 +132,79 @@ static struct irq_domain_ops fpga_irqdomain_ops = {
125 .xlate = irq_domain_xlate_onetwocell, 132 .xlate = irq_domain_xlate_onetwocell,
126}; 133};
127 134
128void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start, 135static __init struct fpga_irq_data *
129 int parent_irq, u32 valid, struct device_node *node) 136fpga_irq_prep_struct(void __iomem *base, const char *name, u32 valid) {
130{
131 struct fpga_irq_data *f; 137 struct fpga_irq_data *f;
132 138
133 if (fpga_irq_id >= ARRAY_SIZE(fpga_irq_devices)) { 139 if (fpga_irq_id >= ARRAY_SIZE(fpga_irq_devices)) {
134 printk(KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__); 140 printk(KERN_ERR "%s: too few FPGA IRQ controllers, increase CONFIG_PLAT_VERSATILE_FPGA_IRQ_NR\n", __func__);
135 return; 141 return NULL;
136 } 142 }
137
138 f = &fpga_irq_devices[fpga_irq_id]; 143 f = &fpga_irq_devices[fpga_irq_id];
139 f->base = base; 144 f->base = base;
140 f->irq_start = irq_start;
141 f->chip.name = name; 145 f->chip.name = name;
142 f->chip.irq_ack = fpga_irq_mask; 146 f->chip.irq_ack = fpga_irq_mask;
143 f->chip.irq_mask = fpga_irq_mask; 147 f->chip.irq_mask = fpga_irq_mask;
144 f->chip.irq_unmask = fpga_irq_unmask; 148 f->chip.irq_unmask = fpga_irq_unmask;
145 f->valid = valid; 149 f->valid = valid;
150 fpga_irq_id++;
151
152 return f;
153}
154
155void __init fpga_irq_init(void __iomem *base, const char *name, int irq_start,
156 int parent_irq, u32 valid, struct device_node *node)
157{
158 struct fpga_irq_data *f;
159
160 f = fpga_irq_prep_struct(base, name, valid);
161 if (!f)
162 return;
146 163
147 if (parent_irq != -1) { 164 if (parent_irq != -1) {
148 irq_set_handler_data(parent_irq, f); 165 irq_set_handler_data(parent_irq, f);
149 irq_set_chained_handler(parent_irq, fpga_irq_handle); 166 irq_set_chained_handler(parent_irq, fpga_irq_handle);
150 } 167 }
151 168
152 f->domain = irq_domain_add_legacy(node, fls(valid), f->irq_start, 0, 169 f->domain = irq_domain_add_legacy(node, fls(valid), irq_start, 0,
153 &fpga_irqdomain_ops, f); 170 &fpga_irqdomain_ops, f);
154 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n", 171 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
155 fpga_irq_id, name, base, f->used_irqs); 172 fpga_irq_id, name, base, f->used_irqs);
173}
156 174
157 fpga_irq_id++; 175#ifdef CONFIG_OF
176int __init fpga_irq_of_init(struct device_node *node,
177 struct device_node *parent)
178{
179 struct fpga_irq_data *f;
180 void __iomem *base;
181 u32 clear_mask;
182 u32 valid_mask;
183
184 if (WARN_ON(!node))
185 return -ENODEV;
186
187 base = of_iomap(node, 0);
188 WARN(!base, "unable to map fpga irq registers\n");
189
190 if (of_property_read_u32(node, "clear-mask", &clear_mask))
191 clear_mask = 0;
192
193 if (of_property_read_u32(node, "valid-mask", &valid_mask))
194 valid_mask = 0;
195
196 f = fpga_irq_prep_struct(base, node->name, valid_mask);
197 if (!f)
198 return -ENOMEM;
199
200 writel(clear_mask, base + IRQ_ENABLE_CLEAR);
201 writel(clear_mask, base + FIQ_ENABLE_CLEAR);
202
203 f->domain = irq_domain_add_linear(node, fls(valid_mask), &fpga_irqdomain_ops, f);
204 f->used_irqs = hweight32(valid_mask);
205
206 pr_info("FPGA IRQ chip %d \"%s\" @ %p, %u irqs\n",
207 fpga_irq_id, node->name, base, f->used_irqs);
208 return 0;
158} 209}
210#endif
diff --git a/arch/arm/plat-versatile/include/plat/fpga-irq.h b/arch/arm/plat-versatile/include/plat/fpga-irq.h
index 91bcfb67551d..1fac9651d3ca 100644
--- a/arch/arm/plat-versatile/include/plat/fpga-irq.h
+++ b/arch/arm/plat-versatile/include/plat/fpga-irq.h
@@ -7,5 +7,7 @@ struct pt_regs;
7void fpga_handle_irq(struct pt_regs *regs); 7void fpga_handle_irq(struct pt_regs *regs);
8void fpga_irq_init(void __iomem *, const char *, int, int, u32, 8void fpga_irq_init(void __iomem *, const char *, int, int, u32,
9 struct device_node *node); 9 struct device_node *node);
10int fpga_irq_of_init(struct device_node *node,
11 struct device_node *parent);
10 12
11#endif 13#endif
diff --git a/arch/m68k/include/asm/cacheflush_no.h b/arch/m68k/include/asm/cacheflush_no.h
index 7cafb537d03c..d2b3935ae147 100644
--- a/arch/m68k/include/asm/cacheflush_no.h
+++ b/arch/m68k/include/asm/cacheflush_no.h
@@ -34,10 +34,9 @@ static inline void __clear_cache_all(void)
34{ 34{
35#ifdef CACHE_INVALIDATE 35#ifdef CACHE_INVALIDATE
36 __asm__ __volatile__ ( 36 __asm__ __volatile__ (
37 "movel %0, %%d0\n\t" 37 "movec %0, %%CACR\n\t"
38 "movec %%d0, %%CACR\n\t"
39 "nop\n\t" 38 "nop\n\t"
40 : : "i" (CACHE_INVALIDATE) : "d0" ); 39 : : "r" (CACHE_INVALIDATE) );
41#endif 40#endif
42} 41}
43 42
@@ -58,10 +57,9 @@ static inline void __flush_icache_all(void)
58{ 57{
59#ifdef CACHE_INVALIDATEI 58#ifdef CACHE_INVALIDATEI
60 __asm__ __volatile__ ( 59 __asm__ __volatile__ (
61 "movel %0, %%d0\n\t" 60 "movec %0, %%CACR\n\t"
62 "movec %%d0, %%CACR\n\t"
63 "nop\n\t" 61 "nop\n\t"
64 : : "i" (CACHE_INVALIDATEI) : "d0" ); 62 : : "r" (CACHE_INVALIDATEI) );
65#endif 63#endif
66} 64}
67 65
@@ -72,19 +70,18 @@ static inline void __flush_dcache_all(void)
72#endif 70#endif
73#ifdef CACHE_INVALIDATED 71#ifdef CACHE_INVALIDATED
74 __asm__ __volatile__ ( 72 __asm__ __volatile__ (
75 "movel %0, %%d0\n\t" 73 "movec %0, %%CACR\n\t"
76 "movec %%d0, %%CACR\n\t"
77 "nop\n\t" 74 "nop\n\t"
78 : : "i" (CACHE_INVALIDATED) : "d0" ); 75 : : "r" (CACHE_INVALIDATED) );
79#else 76#else
80 /* Flush the wrtite buffer */ 77 /* Flush the write buffer */
81 __asm__ __volatile__ ( "nop" ); 78 __asm__ __volatile__ ( "nop" );
82#endif 79#endif
83} 80}
84 81
85/* 82/*
86 * Push cache entries at supplied address. We want to write back any dirty 83 * Push cache entries at supplied address. We want to write back any dirty
87 * data and the invalidate the cache lines associated with this address. 84 * data and then invalidate the cache lines associated with this address.
88 */ 85 */
89static inline void cache_push(unsigned long paddr, int len) 86static inline void cache_push(unsigned long paddr, int len)
90{ 87{
diff --git a/arch/m68k/include/asm/m5206sim.h b/arch/m68k/include/asm/m5206sim.h
index 69722366b084..4cf864f5ea7a 100644
--- a/arch/m68k/include/asm/m5206sim.h
+++ b/arch/m68k/include/asm/m5206sim.h
@@ -21,33 +21,33 @@
21/* 21/*
22 * Define the 5206 SIM register set addresses. 22 * Define the 5206 SIM register set addresses.
23 */ 23 */
24#define MCFSIM_SIMR 0x03 /* SIM Config reg (r/w) */ 24#define MCFSIM_SIMR (MCF_MBAR + 0x03) /* SIM Config reg */
25#define MCFSIM_ICR1 0x14 /* Intr Ctrl reg 1 (r/w) */ 25#define MCFSIM_ICR1 (MCF_MBAR + 0x14) /* Intr Ctrl reg 1 */
26#define MCFSIM_ICR2 0x15 /* Intr Ctrl reg 2 (r/w) */ 26#define MCFSIM_ICR2 (MCF_MBAR + 0x15) /* Intr Ctrl reg 2 */
27#define MCFSIM_ICR3 0x16 /* Intr Ctrl reg 3 (r/w) */ 27#define MCFSIM_ICR3 (MCF_MBAR + 0x16) /* Intr Ctrl reg 3 */
28#define MCFSIM_ICR4 0x17 /* Intr Ctrl reg 4 (r/w) */ 28#define MCFSIM_ICR4 (MCF_MBAR + 0x17) /* Intr Ctrl reg 4 */
29#define MCFSIM_ICR5 0x18 /* Intr Ctrl reg 5 (r/w) */ 29#define MCFSIM_ICR5 (MCF_MBAR + 0x18) /* Intr Ctrl reg 5 */
30#define MCFSIM_ICR6 0x19 /* Intr Ctrl reg 6 (r/w) */ 30#define MCFSIM_ICR6 (MCF_MBAR + 0x19) /* Intr Ctrl reg 6 */
31#define MCFSIM_ICR7 0x1a /* Intr Ctrl reg 7 (r/w) */ 31#define MCFSIM_ICR7 (MCF_MBAR + 0x1a) /* Intr Ctrl reg 7 */
32#define MCFSIM_ICR8 0x1b /* Intr Ctrl reg 8 (r/w) */ 32#define MCFSIM_ICR8 (MCF_MBAR + 0x1b) /* Intr Ctrl reg 8 */
33#define MCFSIM_ICR9 0x1c /* Intr Ctrl reg 9 (r/w) */ 33#define MCFSIM_ICR9 (MCF_MBAR + 0x1c) /* Intr Ctrl reg 9 */
34#define MCFSIM_ICR10 0x1d /* Intr Ctrl reg 10 (r/w) */ 34#define MCFSIM_ICR10 (MCF_MBAR + 0x1d) /* Intr Ctrl reg 10 */
35#define MCFSIM_ICR11 0x1e /* Intr Ctrl reg 11 (r/w) */ 35#define MCFSIM_ICR11 (MCF_MBAR + 0x1e) /* Intr Ctrl reg 11 */
36#define MCFSIM_ICR12 0x1f /* Intr Ctrl reg 12 (r/w) */ 36#define MCFSIM_ICR12 (MCF_MBAR + 0x1f) /* Intr Ctrl reg 12 */
37#define MCFSIM_ICR13 0x20 /* Intr Ctrl reg 13 (r/w) */ 37#define MCFSIM_ICR13 (MCF_MBAR + 0x20) /* Intr Ctrl reg 13 */
38#ifdef CONFIG_M5206e 38#ifdef CONFIG_M5206e
39#define MCFSIM_ICR14 0x21 /* Intr Ctrl reg 14 (r/w) */ 39#define MCFSIM_ICR14 (MCF_MBAR + 0x21) /* Intr Ctrl reg 14 */
40#define MCFSIM_ICR15 0x22 /* Intr Ctrl reg 15 (r/w) */ 40#define MCFSIM_ICR15 (MCF_MBAR + 0x22) /* Intr Ctrl reg 15 */
41#endif 41#endif
42 42
43#define MCFSIM_IMR 0x36 /* Interrupt Mask reg (r/w) */ 43#define MCFSIM_IMR (MCF_MBAR + 0x36) /* Interrupt Mask */
44#define MCFSIM_IPR 0x3a /* Interrupt Pend reg (r/w) */ 44#define MCFSIM_IPR (MCF_MBAR + 0x3a) /* Interrupt Pending */
45 45
46#define MCFSIM_RSR 0x40 /* Reset Status reg (r/w) */ 46#define MCFSIM_RSR (MCF_MBAR + 0x40) /* Reset Status */
47#define MCFSIM_SYPCR 0x41 /* System Protection reg (r/w)*/ 47#define MCFSIM_SYPCR (MCF_MBAR + 0x41) /* System Protection */
48 48
49#define MCFSIM_SWIVR 0x42 /* SW Watchdog intr reg (r/w) */ 49#define MCFSIM_SWIVR (MCF_MBAR + 0x42) /* SW Watchdog intr */
50#define MCFSIM_SWSR 0x43 /* SW Watchdog service (r/w) */ 50#define MCFSIM_SWSR (MCF_MBAR + 0x43) /* SW Watchdog srv */
51 51
52#define MCFSIM_DCRR (MCF_MBAR + 0x46) /* DRAM Refresh reg (r/w) */ 52#define MCFSIM_DCRR (MCF_MBAR + 0x46) /* DRAM Refresh reg (r/w) */
53#define MCFSIM_DCTR (MCF_MBAR + 0x4a) /* DRAM Timing reg (r/w) */ 53#define MCFSIM_DCTR (MCF_MBAR + 0x4a) /* DRAM Timing reg (r/w) */
@@ -58,36 +58,36 @@
58#define MCFSIM_DMR1 (MCF_MBAR + 0x5c) /* DRAM 1 Mask reg (r/w) */ 58#define MCFSIM_DMR1 (MCF_MBAR + 0x5c) /* DRAM 1 Mask reg (r/w) */
59#define MCFSIM_DCR1 (MCF_MBAR + 0x63) /* DRAM 1 Control reg (r/w) */ 59#define MCFSIM_DCR1 (MCF_MBAR + 0x63) /* DRAM 1 Control reg (r/w) */
60 60
61#define MCFSIM_CSAR0 0x64 /* CS 0 Address 0 reg (r/w) */ 61#define MCFSIM_CSAR0 (MCF_MBAR + 0x64) /* CS 0 Address reg */
62#define MCFSIM_CSMR0 0x68 /* CS 0 Mask 0 reg (r/w) */ 62#define MCFSIM_CSMR0 (MCF_MBAR + 0x68) /* CS 0 Mask reg */
63#define MCFSIM_CSCR0 0x6e /* CS 0 Control reg (r/w) */ 63#define MCFSIM_CSCR0 (MCF_MBAR + 0x6e) /* CS 0 Control reg */
64#define MCFSIM_CSAR1 0x70 /* CS 1 Address reg (r/w) */ 64#define MCFSIM_CSAR1 (MCF_MBAR + 0x70) /* CS 1 Address reg */
65#define MCFSIM_CSMR1 0x74 /* CS 1 Mask reg (r/w) */ 65#define MCFSIM_CSMR1 (MCF_MBAR + 0x74) /* CS 1 Mask reg */
66#define MCFSIM_CSCR1 0x7a /* CS 1 Control reg (r/w) */ 66#define MCFSIM_CSCR1 (MCF_MBAR + 0x7a) /* CS 1 Control reg */
67#define MCFSIM_CSAR2 0x7c /* CS 2 Address reg (r/w) */ 67#define MCFSIM_CSAR2 (MCF_MBAR + 0x7c) /* CS 2 Address reg */
68#define MCFSIM_CSMR2 0x80 /* CS 2 Mask reg (r/w) */ 68#define MCFSIM_CSMR2 (MCF_MBAR + 0x80) /* CS 2 Mask reg */
69#define MCFSIM_CSCR2 0x86 /* CS 2 Control reg (r/w) */ 69#define MCFSIM_CSCR2 (MCF_MBAR + 0x86) /* CS 2 Control reg */
70#define MCFSIM_CSAR3 0x88 /* CS 3 Address reg (r/w) */ 70#define MCFSIM_CSAR3 (MCF_MBAR + 0x88) /* CS 3 Address reg */
71#define MCFSIM_CSMR3 0x8c /* CS 3 Mask reg (r/w) */ 71#define MCFSIM_CSMR3 (MCF_MBAR + 0x8c) /* CS 3 Mask reg */
72#define MCFSIM_CSCR3 0x92 /* CS 3 Control reg (r/w) */ 72#define MCFSIM_CSCR3 (MCF_MBAR + 0x92) /* CS 3 Control reg */
73#define MCFSIM_CSAR4 0x94 /* CS 4 Address reg (r/w) */ 73#define MCFSIM_CSAR4 (MCF_MBAR + 0x94) /* CS 4 Address reg */
74#define MCFSIM_CSMR4 0x98 /* CS 4 Mask reg (r/w) */ 74#define MCFSIM_CSMR4 (MCF_MBAR + 0x98) /* CS 4 Mask reg */
75#define MCFSIM_CSCR4 0x9e /* CS 4 Control reg (r/w) */ 75#define MCFSIM_CSCR4 (MCF_MBAR + 0x9e) /* CS 4 Control reg */
76#define MCFSIM_CSAR5 0xa0 /* CS 5 Address reg (r/w) */ 76#define MCFSIM_CSAR5 (MCF_MBAR + 0xa0) /* CS 5 Address reg */
77#define MCFSIM_CSMR5 0xa4 /* CS 5 Mask reg (r/w) */ 77#define MCFSIM_CSMR5 (MCF_MBAR + 0xa4) /* CS 5 Mask reg */
78#define MCFSIM_CSCR5 0xaa /* CS 5 Control reg (r/w) */ 78#define MCFSIM_CSCR5 (MCF_MBAR + 0xaa) /* CS 5 Control reg */
79#define MCFSIM_CSAR6 0xac /* CS 6 Address reg (r/w) */ 79#define MCFSIM_CSAR6 (MCF_MBAR + 0xac) /* CS 6 Address reg */
80#define MCFSIM_CSMR6 0xb0 /* CS 6 Mask reg (r/w) */ 80#define MCFSIM_CSMR6 (MCF_MBAR + 0xb0) /* CS 6 Mask reg */
81#define MCFSIM_CSCR6 0xb6 /* CS 6 Control reg (r/w) */ 81#define MCFSIM_CSCR6 (MCF_MBAR + 0xb6) /* CS 6 Control reg */
82#define MCFSIM_CSAR7 0xb8 /* CS 7 Address reg (r/w) */ 82#define MCFSIM_CSAR7 (MCF_MBAR + 0xb8) /* CS 7 Address reg */
83#define MCFSIM_CSMR7 0xbc /* CS 7 Mask reg (r/w) */ 83#define MCFSIM_CSMR7 (MCF_MBAR + 0xbc) /* CS 7 Mask reg */
84#define MCFSIM_CSCR7 0xc2 /* CS 7 Control reg (r/w) */ 84#define MCFSIM_CSCR7 (MCF_MBAR + 0xc2) /* CS 7 Control reg */
85#define MCFSIM_DMCR 0xc6 /* Default control */ 85#define MCFSIM_DMCR (MCF_MBAR + 0xc6) /* Default control */
86 86
87#ifdef CONFIG_M5206e 87#ifdef CONFIG_M5206e
88#define MCFSIM_PAR 0xca /* Pin Assignment reg (r/w) */ 88#define MCFSIM_PAR (MCF_MBAR + 0xca) /* Pin Assignment */
89#else 89#else
90#define MCFSIM_PAR 0xcb /* Pin Assignment reg (r/w) */ 90#define MCFSIM_PAR (MCF_MBAR + 0xcb) /* Pin Assignment */
91#endif 91#endif
92 92
93#define MCFTIMER_BASE1 (MCF_MBAR + 0x100) /* Base of TIMER1 */ 93#define MCFTIMER_BASE1 (MCF_MBAR + 0x100) /* Base of TIMER1 */
diff --git a/arch/m68k/include/asm/m523xsim.h b/arch/m68k/include/asm/m523xsim.h
index 91d3abc3f2a5..5e06b4eb57f3 100644
--- a/arch/m68k/include/asm/m523xsim.h
+++ b/arch/m68k/include/asm/m523xsim.h
@@ -176,21 +176,29 @@
176/* 176/*
177 * Generic GPIO support 177 * Generic GPIO support
178 */ 178 */
179#define MCFGPIO_PODR MCFGPIO_PODR_ADDR 179#define MCFGPIO_PODR MCFGPIO_PODR_ADDR
180#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR 180#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR
181#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR 181#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR
182#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR 182#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR
183#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR 183#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR
184 184
185#define MCFGPIO_PIN_MAX 107 185#define MCFGPIO_PIN_MAX 107
186#define MCFGPIO_IRQ_MAX 8 186#define MCFGPIO_IRQ_MAX 8
187#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 187#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
188 188
189/* 189/*
190 * Pin Assignment 190 * Pin Assignment
191*/ 191*/
192#define MCFGPIO_PAR_AD (MCF_IPSBAR + 0x100040)
193#define MCFGPIO_PAR_BUSCTL (MCF_IPSBAR + 0x100042)
194#define MCFGPIO_PAR_BS (MCF_IPSBAR + 0x100044)
195#define MCFGPIO_PAR_CS (MCF_IPSBAR + 0x100045)
196#define MCFGPIO_PAR_SDRAM (MCF_IPSBAR + 0x100046)
197#define MCFGPIO_PAR_FECI2C (MCF_IPSBAR + 0x100047)
198#define MCFGPIO_PAR_UART (MCF_IPSBAR + 0x100048)
192#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A) 199#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A)
193#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C) 200#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C)
201#define MCFGPIO_PAR_ETPU (MCF_IPSBAR + 0x10004E)
194 202
195/* 203/*
196 * DMA unit base addresses. 204 * DMA unit base addresses.
diff --git a/arch/m68k/include/asm/m5249sim.h b/arch/m68k/include/asm/m5249sim.h
index 7f0c2c3660fd..fdf45e6807c9 100644
--- a/arch/m68k/include/asm/m5249sim.h
+++ b/arch/m68k/include/asm/m5249sim.h
@@ -25,41 +25,41 @@
25/* 25/*
26 * Define the 5249 SIM register set addresses. 26 * Define the 5249 SIM register set addresses.
27 */ 27 */
28#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 28#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
29#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 29#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
30#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 30#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
31#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 31#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog srv */
32#define MCFSIM_PAR 0x04 /* Pin Assignment reg (r/w) */ 32#define MCFSIM_PAR (MCF_MBAR + 0x04) /* Pin Assignment */
33#define MCFSIM_IRQPAR 0x06 /* Interrupt Assignment reg (r/w) */ 33#define MCFSIM_IRQPAR (MCF_MBAR + 0x06) /* Intr Assignment */
34#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 34#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
35#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 35#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
36#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 36#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
37#define MCFSIM_AVR 0x4b /* Autovector Ctrl reg (r/w) */ 37#define MCFSIM_AVR (MCF_MBAR + 0x4b) /* Autovector Ctrl */
38#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 38#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
39#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 39#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
40#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 40#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
41#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 41#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
42#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 42#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
43#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 43#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
44#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 44#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
45#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 45#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
46#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 46#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
47#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 47#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
48#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 48#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
49#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 49#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
50 50
51#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 51#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
52#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 52#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
53#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 53#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
54#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 54#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
55#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 55#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
56#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 56#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
57#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 57#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
58#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 58#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
59#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 59#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
60#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 60#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
61#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 61#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
62#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 62#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
63 63
64#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 64#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
65#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */ 65#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
@@ -134,23 +134,23 @@
134#define MCFSIM2_GPIO1ENABLE (MCF_MBAR2 + 0x0B8) /* GPIO1 enabled */ 134#define MCFSIM2_GPIO1ENABLE (MCF_MBAR2 + 0x0B8) /* GPIO1 enabled */
135#define MCFSIM2_GPIO1FUNC (MCF_MBAR2 + 0x0BC) /* GPIO1 function */ 135#define MCFSIM2_GPIO1FUNC (MCF_MBAR2 + 0x0BC) /* GPIO1 function */
136 136
137#define MCFSIM2_GPIOINTSTAT 0xc0 /* GPIO interrupt status */ 137#define MCFSIM2_GPIOINTSTAT (MCF_MBAR2 + 0xc0) /* GPIO intr status */
138#define MCFSIM2_GPIOINTCLEAR 0xc0 /* GPIO interrupt clear */ 138#define MCFSIM2_GPIOINTCLEAR (MCF_MBAR2 + 0xc0) /* GPIO intr clear */
139#define MCFSIM2_GPIOINTENABLE 0xc4 /* GPIO interrupt enable */ 139#define MCFSIM2_GPIOINTENABLE (MCF_MBAR2 + 0xc4) /* GPIO intr enable */
140 140
141#define MCFSIM2_INTLEVEL1 0x140 /* Interrupt level reg 1 */ 141#define MCFSIM2_INTLEVEL1 (MCF_MBAR2 + 0x140) /* Intr level reg 1 */
142#define MCFSIM2_INTLEVEL2 0x144 /* Interrupt level reg 2 */ 142#define MCFSIM2_INTLEVEL2 (MCF_MBAR2 + 0x144) /* Intr level reg 2 */
143#define MCFSIM2_INTLEVEL3 0x148 /* Interrupt level reg 3 */ 143#define MCFSIM2_INTLEVEL3 (MCF_MBAR2 + 0x148) /* Intr level reg 3 */
144#define MCFSIM2_INTLEVEL4 0x14c /* Interrupt level reg 4 */ 144#define MCFSIM2_INTLEVEL4 (MCF_MBAR2 + 0x14c) /* Intr level reg 4 */
145#define MCFSIM2_INTLEVEL5 0x150 /* Interrupt level reg 5 */ 145#define MCFSIM2_INTLEVEL5 (MCF_MBAR2 + 0x150) /* Intr level reg 5 */
146#define MCFSIM2_INTLEVEL6 0x154 /* Interrupt level reg 6 */ 146#define MCFSIM2_INTLEVEL6 (MCF_MBAR2 + 0x154) /* Intr level reg 6 */
147#define MCFSIM2_INTLEVEL7 0x158 /* Interrupt level reg 7 */ 147#define MCFSIM2_INTLEVEL7 (MCF_MBAR2 + 0x158) /* Intr level reg 7 */
148#define MCFSIM2_INTLEVEL8 0x15c /* Interrupt level reg 8 */ 148#define MCFSIM2_INTLEVEL8 (MCF_MBAR2 + 0x15c) /* Intr level reg 8 */
149 149
150#define MCFSIM2_DMAROUTE 0x188 /* DMA routing */ 150#define MCFSIM2_DMAROUTE (MCF_MBAR2 + 0x188) /* DMA routing */
151 151
152#define MCFSIM2_IDECONFIG1 0x18c /* IDEconfig1 */ 152#define MCFSIM2_IDECONFIG1 (MCF_MBAR2 + 0x18c) /* IDEconfig1 */
153#define MCFSIM2_IDECONFIG2 0x190 /* IDEconfig2 */ 153#define MCFSIM2_IDECONFIG2 (MCF_MBAR2 + 0x190) /* IDEconfig2 */
154 154
155/* 155/*
156 * Define the base interrupt for the second interrupt controller. 156 * Define the base interrupt for the second interrupt controller.
diff --git a/arch/m68k/include/asm/m525xsim.h b/arch/m68k/include/asm/m525xsim.h
index 6da24f653902..acab61cb91ed 100644
--- a/arch/m68k/include/asm/m525xsim.h
+++ b/arch/m68k/include/asm/m525xsim.h
@@ -26,41 +26,41 @@
26/* 26/*
27 * Define the 525x SIM register set addresses. 27 * Define the 525x SIM register set addresses.
28 */ 28 */
29#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 29#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
30#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 30#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
31#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 31#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
32#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 32#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog srv */
33#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 33#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
34#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 34#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
35#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 35#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
36#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 36#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
37#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 37#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
38#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 38#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
39#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 39#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
40#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 40#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
41#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 41#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
42#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 42#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
43#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 43#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
44#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 44#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
45#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 45#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
46#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 46#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
47#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 47#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
48 48
49#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 49#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
50#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 50#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
51#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 51#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
52#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 52#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
53#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 53#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
54#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 54#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
55#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 55#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
56#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 56#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
57#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 57#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
58#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 58#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
59#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 59#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
60#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 60#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
61#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ 61#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
62#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 62#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
63#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 63#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
64 64
65#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 65#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
66#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */ 66#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
diff --git a/arch/m68k/include/asm/m5272sim.h b/arch/m68k/include/asm/m5272sim.h
index a58f1760d858..1fb01bb05d6c 100644
--- a/arch/m68k/include/asm/m5272sim.h
+++ b/arch/m68k/include/asm/m5272sim.h
@@ -21,52 +21,52 @@
21/* 21/*
22 * Define the 5272 SIM register set addresses. 22 * Define the 5272 SIM register set addresses.
23 */ 23 */
24#define MCFSIM_SCR 0x04 /* SIM Config reg (r/w) */ 24#define MCFSIM_SCR (MCF_MBAR + 0x04) /* SIM Config reg */
25#define MCFSIM_SPR 0x06 /* System Protection reg (r/w)*/ 25#define MCFSIM_SPR (MCF_MBAR + 0x06) /* System Protection */
26#define MCFSIM_PMR 0x08 /* Power Management reg (r/w) */ 26#define MCFSIM_PMR (MCF_MBAR + 0x08) /* Power Management */
27#define MCFSIM_APMR 0x0e /* Active Low Power reg (r/w) */ 27#define MCFSIM_APMR (MCF_MBAR + 0x0e) /* Active Low Power */
28#define MCFSIM_DIR 0x10 /* Device Identity reg (r/w) */ 28#define MCFSIM_DIR (MCF_MBAR + 0x10) /* Device Identity */
29 29
30#define MCFSIM_ICR1 0x20 /* Intr Ctrl reg 1 (r/w) */ 30#define MCFSIM_ICR1 (MCF_MBAR + 0x20) /* Intr Ctrl reg 1 */
31#define MCFSIM_ICR2 0x24 /* Intr Ctrl reg 2 (r/w) */ 31#define MCFSIM_ICR2 (MCF_MBAR + 0x24) /* Intr Ctrl reg 2 */
32#define MCFSIM_ICR3 0x28 /* Intr Ctrl reg 3 (r/w) */ 32#define MCFSIM_ICR3 (MCF_MBAR + 0x28) /* Intr Ctrl reg 3 */
33#define MCFSIM_ICR4 0x2c /* Intr Ctrl reg 4 (r/w) */ 33#define MCFSIM_ICR4 (MCF_MBAR + 0x2c) /* Intr Ctrl reg 4 */
34 34
35#define MCFSIM_ISR 0x30 /* Interrupt Source reg (r/w) */ 35#define MCFSIM_ISR (MCF_MBAR + 0x30) /* Intr Source */
36#define MCFSIM_PITR 0x34 /* Interrupt Transition (r/w) */ 36#define MCFSIM_PITR (MCF_MBAR + 0x34) /* Intr Transition */
37#define MCFSIM_PIWR 0x38 /* Interrupt Wakeup reg (r/w) */ 37#define MCFSIM_PIWR (MCF_MBAR + 0x38) /* Intr Wakeup */
38#define MCFSIM_PIVR 0x3f /* Interrupt Vector reg (r/w( */ 38#define MCFSIM_PIVR (MCF_MBAR + 0x3f) /* Intr Vector */
39 39
40#define MCFSIM_WRRR 0x280 /* Watchdog reference (r/w) */ 40#define MCFSIM_WRRR (MCF_MBAR + 0x280) /* Watchdog reference */
41#define MCFSIM_WIRR 0x284 /* Watchdog interrupt (r/w) */ 41#define MCFSIM_WIRR (MCF_MBAR + 0x284) /* Watchdog interrupt */
42#define MCFSIM_WCR 0x288 /* Watchdog counter (r/w) */ 42#define MCFSIM_WCR (MCF_MBAR + 0x288) /* Watchdog counter */
43#define MCFSIM_WER 0x28c /* Watchdog event (r/w) */ 43#define MCFSIM_WER (MCF_MBAR + 0x28c) /* Watchdog event */
44 44
45#define MCFSIM_CSBR0 0x40 /* CS0 Base Address (r/w) */ 45#define MCFSIM_CSBR0 (MCF_MBAR + 0x40) /* CS0 Base Address */
46#define MCFSIM_CSOR0 0x44 /* CS0 Option (r/w) */ 46#define MCFSIM_CSOR0 (MCF_MBAR + 0x44) /* CS0 Option */
47#define MCFSIM_CSBR1 0x48 /* CS1 Base Address (r/w) */ 47#define MCFSIM_CSBR1 (MCF_MBAR + 0x48) /* CS1 Base Address */
48#define MCFSIM_CSOR1 0x4c /* CS1 Option (r/w) */ 48#define MCFSIM_CSOR1 (MCF_MBAR + 0x4c) /* CS1 Option */
49#define MCFSIM_CSBR2 0x50 /* CS2 Base Address (r/w) */ 49#define MCFSIM_CSBR2 (MCF_MBAR + 0x50) /* CS2 Base Address */
50#define MCFSIM_CSOR2 0x54 /* CS2 Option (r/w) */ 50#define MCFSIM_CSOR2 (MCF_MBAR + 0x54) /* CS2 Option */
51#define MCFSIM_CSBR3 0x58 /* CS3 Base Address (r/w) */ 51#define MCFSIM_CSBR3 (MCF_MBAR + 0x58) /* CS3 Base Address */
52#define MCFSIM_CSOR3 0x5c /* CS3 Option (r/w) */ 52#define MCFSIM_CSOR3 (MCF_MBAR + 0x5c) /* CS3 Option */
53#define MCFSIM_CSBR4 0x60 /* CS4 Base Address (r/w) */ 53#define MCFSIM_CSBR4 (MCF_MBAR + 0x60) /* CS4 Base Address */
54#define MCFSIM_CSOR4 0x64 /* CS4 Option (r/w) */ 54#define MCFSIM_CSOR4 (MCF_MBAR + 0x64) /* CS4 Option */
55#define MCFSIM_CSBR5 0x68 /* CS5 Base Address (r/w) */ 55#define MCFSIM_CSBR5 (MCF_MBAR + 0x68) /* CS5 Base Address */
56#define MCFSIM_CSOR5 0x6c /* CS5 Option (r/w) */ 56#define MCFSIM_CSOR5 (MCF_MBAR + 0x6c) /* CS5 Option */
57#define MCFSIM_CSBR6 0x70 /* CS6 Base Address (r/w) */ 57#define MCFSIM_CSBR6 (MCF_MBAR + 0x70) /* CS6 Base Address */
58#define MCFSIM_CSOR6 0x74 /* CS6 Option (r/w) */ 58#define MCFSIM_CSOR6 (MCF_MBAR + 0x74) /* CS6 Option */
59#define MCFSIM_CSBR7 0x78 /* CS7 Base Address (r/w) */ 59#define MCFSIM_CSBR7 (MCF_MBAR + 0x78) /* CS7 Base Address */
60#define MCFSIM_CSOR7 0x7c /* CS7 Option (r/w) */ 60#define MCFSIM_CSOR7 (MCF_MBAR + 0x7c) /* CS7 Option */
61 61
62#define MCFSIM_SDCR 0x180 /* SDRAM Configuration (r/w) */ 62#define MCFSIM_SDCR (MCF_MBAR + 0x180) /* SDRAM Config */
63#define MCFSIM_SDTR 0x184 /* SDRAM Timing (r/w) */ 63#define MCFSIM_SDTR (MCF_MBAR + 0x184) /* SDRAM Timing */
64#define MCFSIM_DCAR0 0x4c /* DRAM 0 Address reg(r/w) */ 64#define MCFSIM_DCAR0 (MCF_MBAR + 0x4c) /* DRAM 0 Address */
65#define MCFSIM_DCMR0 0x50 /* DRAM 0 Mask reg (r/w) */ 65#define MCFSIM_DCMR0 (MCF_MBAR + 0x50) /* DRAM 0 Mask */
66#define MCFSIM_DCCR0 0x57 /* DRAM 0 Control reg (r/w) */ 66#define MCFSIM_DCCR0 (MCF_MBAR + 0x57) /* DRAM 0 Control */
67#define MCFSIM_DCAR1 0x58 /* DRAM 1 Address reg (r/w) */ 67#define MCFSIM_DCAR1 (MCF_MBAR + 0x58) /* DRAM 1 Address */
68#define MCFSIM_DCMR1 0x5c /* DRAM 1 Mask reg (r/w) */ 68#define MCFSIM_DCMR1 (MCF_MBAR + 0x5c) /* DRAM 1 Mask reg */
69#define MCFSIM_DCCR1 0x63 /* DRAM 1 Control reg (r/w) */ 69#define MCFSIM_DCCR1 (MCF_MBAR + 0x63) /* DRAM 1 Control */
70 70
71#define MCFUART_BASE0 (MCF_MBAR + 0x100) /* Base address UART0 */ 71#define MCFUART_BASE0 (MCF_MBAR + 0x100) /* Base address UART0 */
72#define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */ 72#define MCFUART_BASE1 (MCF_MBAR + 0x140) /* Base address UART1 */
@@ -132,8 +132,9 @@
132/* 132/*
133 * Generic GPIO support 133 * Generic GPIO support
134 */ 134 */
135#define MCFGPIO_PIN_MAX 48 135#define MCFGPIO_PIN_MAX 48
136#define MCFGPIO_IRQ_MAX -1 136#define MCFGPIO_IRQ_MAX -1
137#define MCFGPIO_IRQ_VECBASE -1 137#define MCFGPIO_IRQ_VECBASE -1
138
138/****************************************************************************/ 139/****************************************************************************/
139#endif /* m5272sim_h */ 140#endif /* m5272sim_h */
diff --git a/arch/m68k/include/asm/m527xsim.h b/arch/m68k/include/asm/m527xsim.h
index 71aa5104d3d6..1bebbe78055a 100644
--- a/arch/m68k/include/asm/m527xsim.h
+++ b/arch/m68k/include/asm/m527xsim.h
@@ -184,19 +184,33 @@
184/* 184/*
185 * Generic GPIO support 185 * Generic GPIO support
186 */ 186 */
187#define MCFGPIO_PODR MCFGPIO_PODR_ADDR 187#define MCFGPIO_PODR MCFGPIO_PODR_ADDR
188#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR 188#define MCFGPIO_PDDR MCFGPIO_PDDR_ADDR
189#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR 189#define MCFGPIO_PPDR MCFGPIO_PPDSDR_ADDR
190#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR 190#define MCFGPIO_SETR MCFGPIO_PPDSDR_ADDR
191#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR 191#define MCFGPIO_CLRR MCFGPIO_PCLRR_ADDR
192 192
193#define MCFGPIO_PIN_MAX 100 193#define MCFGPIO_PIN_MAX 100
194#define MCFGPIO_IRQ_MAX 8 194#define MCFGPIO_IRQ_MAX 8
195#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 195#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
196 196
197/*
198 * Port Pin Assignment registers.
199 */
200#define MCFGPIO_PAR_AD (MCF_IPSBAR + 0x100040)
201#define MCFGPIO_PAR_BUSCTL (MCF_IPSBAR + 0x100042)
202#define MCFGPIO_PAR_BS (MCF_IPSBAR + 0x100044)
203#define MCFGPIO_PAR_CS (MCF_IPSBAR + 0x100045)
204#define MCFGPIO_PAR_SDRAM (MCF_IPSBAR + 0x100046)
205#define MCFGPIO_PAR_FECI2C (MCF_IPSBAR + 0x100047)
206#define MCFGPIO_PAR_UART (MCF_IPSBAR + 0x100048)
197#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A) 207#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10004A)
198#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C) 208#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10004C)
199#endif 209
210#define UART0_ENABLE_MASK 0x000f
211#define UART1_ENABLE_MASK 0x0ff0
212#define UART2_ENABLE_MASK 0x3000
213#endif /* CONFIG_M5271 */
200 214
201#ifdef CONFIG_M5275 215#ifdef CONFIG_M5275
202#define MCFGPIO_PODR_BUSCTL (MCF_IPSBAR + 0x100004) 216#define MCFGPIO_PODR_BUSCTL (MCF_IPSBAR + 0x100004)
@@ -279,18 +293,36 @@
279/* 293/*
280 * Generic GPIO support 294 * Generic GPIO support
281 */ 295 */
282#define MCFGPIO_PODR MCFGPIO_PODR_BUSCTL 296#define MCFGPIO_PODR MCFGPIO_PODR_BUSCTL
283#define MCFGPIO_PDDR MCFGPIO_PDDR_BUSCTL 297#define MCFGPIO_PDDR MCFGPIO_PDDR_BUSCTL
284#define MCFGPIO_PPDR MCFGPIO_PPDSDR_BUSCTL 298#define MCFGPIO_PPDR MCFGPIO_PPDSDR_BUSCTL
285#define MCFGPIO_SETR MCFGPIO_PPDSDR_BUSCTL 299#define MCFGPIO_SETR MCFGPIO_PPDSDR_BUSCTL
286#define MCFGPIO_CLRR MCFGPIO_PCLRR_BUSCTL 300#define MCFGPIO_CLRR MCFGPIO_PCLRR_BUSCTL
287 301
288#define MCFGPIO_PIN_MAX 148 302#define MCFGPIO_PIN_MAX 148
289#define MCFGPIO_IRQ_MAX 8 303#define MCFGPIO_IRQ_MAX 8
290#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 304#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
291 305
306/*
307 * Port Pin Assignment registers.
308 */
309#define MCFGPIO_PAR_AD (MCF_IPSBAR + 0x100070)
310#define MCFGPIO_PAR_CS (MCF_IPSBAR + 0x100071)
311#define MCFGPIO_PAR_BUSCTL (MCF_IPSBAR + 0x100072)
312#define MCFGPIO_PAR_USB (MCF_IPSBAR + 0x100076)
313#define MCFGPIO_PAR_FEC0HL (MCF_IPSBAR + 0x100078)
314#define MCFGPIO_PAR_FEC1HL (MCF_IPSBAR + 0x100079)
315#define MCFGPIO_PAR_TIMER (MCF_IPSBAR + 0x10007A)
316#define MCFGPIO_PAR_UART (MCF_IPSBAR + 0x10007C)
292#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10007E) 317#define MCFGPIO_PAR_QSPI (MCF_IPSBAR + 0x10007E)
293#endif 318#define MCFGPIO_PAR_SDRAM (MCF_IPSBAR + 0x100080)
319#define MCFGPIO_PAR_FECI2C (MCF_IPSBAR + 0x100082)
320#define MCFGPIO_PAR_BS (MCF_IPSBAR + 0x100084)
321
322#define UART0_ENABLE_MASK 0x000f
323#define UART1_ENABLE_MASK 0x00f0
324#define UART2_ENABLE_MASK 0x3f00
325#endif /* CONFIG_M5275 */
294 326
295/* 327/*
296 * PIT timer base addresses. 328 * PIT timer base addresses.
@@ -311,22 +343,6 @@
311#define MCFEPORT_EPFR (MCF_IPSBAR + 0x130006) 343#define MCFEPORT_EPFR (MCF_IPSBAR + 0x130006)
312 344
313/* 345/*
314 * GPIO pins setups to enable the UARTs.
315 */
316#ifdef CONFIG_M5271
317#define MCF_GPIO_PAR_UART 0x100048 /* PAR UART address */
318#define UART0_ENABLE_MASK 0x000f
319#define UART1_ENABLE_MASK 0x0ff0
320#define UART2_ENABLE_MASK 0x3000
321#endif
322#ifdef CONFIG_M5275
323#define MCF_GPIO_PAR_UART 0x10007c /* PAR UART address */
324#define UART0_ENABLE_MASK 0x000f
325#define UART1_ENABLE_MASK 0x00f0
326#define UART2_ENABLE_MASK 0x3f00
327#endif
328
329/*
330 * Reset Control Unit (relative to IPSBAR). 346 * Reset Control Unit (relative to IPSBAR).
331 */ 347 */
332#define MCF_RCR (MCF_IPSBAR + 0x110000) 348#define MCF_RCR (MCF_IPSBAR + 0x110000)
diff --git a/arch/m68k/include/asm/m528xsim.h b/arch/m68k/include/asm/m528xsim.h
index 4acb3c0a642e..cf68ca0ac3a5 100644
--- a/arch/m68k/include/asm/m528xsim.h
+++ b/arch/m68k/include/asm/m528xsim.h
@@ -233,23 +233,6 @@
233#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 233#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
234#define MCFGPIO_PIN_MAX 180 234#define MCFGPIO_PIN_MAX 180
235 235
236
237/*
238 * Derek Cheung - 6 Feb 2005
239 * add I2C and QSPI register definition using Freescale's MCF5282
240 */
241/* set Port AS pin for I2C or UART */
242#define MCF5282_GPIO_PASPAR (volatile u16 *) (MCF_IPSBAR + 0x00100056)
243
244/* Port UA Pin Assignment Register (8 Bit) */
245#define MCF5282_GPIO_PUAPAR 0x10005C
246
247/* Interrupt Mask Register Register Low */
248#define MCF5282_INTC0_IMRL (volatile u32 *) (MCF_IPSBAR + 0x0C0C)
249/* Interrupt Control Register 7 */
250#define MCF5282_INTC0_ICR17 (volatile u8 *) (MCF_IPSBAR + 0x0C51)
251
252
253/* 236/*
254 * Reset Control Unit (relative to IPSBAR). 237 * Reset Control Unit (relative to IPSBAR).
255 */ 238 */
@@ -259,37 +242,5 @@
259#define MCF_RCR_SWRESET 0x80 /* Software reset bit */ 242#define MCF_RCR_SWRESET 0x80 /* Software reset bit */
260#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */ 243#define MCF_RCR_FRCSTOUT 0x40 /* Force external reset */
261 244
262/********************************************************************* 245/****************************************************************************/
263*
264* Inter-IC (I2C) Module
265*
266*********************************************************************/
267/* Read/Write access macros for general use */
268#define MCF5282_I2C_I2ADR (volatile u8 *) (MCF_IPSBAR + 0x0300) // Address
269#define MCF5282_I2C_I2FDR (volatile u8 *) (MCF_IPSBAR + 0x0304) // Freq Divider
270#define MCF5282_I2C_I2CR (volatile u8 *) (MCF_IPSBAR + 0x0308) // Control
271#define MCF5282_I2C_I2SR (volatile u8 *) (MCF_IPSBAR + 0x030C) // Status
272#define MCF5282_I2C_I2DR (volatile u8 *) (MCF_IPSBAR + 0x0310) // Data I/O
273
274/* Bit level definitions and macros */
275#define MCF5282_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
276
277#define MCF5282_I2C_I2FDR_IC(x) (((x)&0x3F))
278
279#define MCF5282_I2C_I2CR_IEN (0x80) // I2C enable
280#define MCF5282_I2C_I2CR_IIEN (0x40) // interrupt enable
281#define MCF5282_I2C_I2CR_MSTA (0x20) // master/slave mode
282#define MCF5282_I2C_I2CR_MTX (0x10) // transmit/receive mode
283#define MCF5282_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
284#define MCF5282_I2C_I2CR_RSTA (0x04) // repeat start
285
286#define MCF5282_I2C_I2SR_ICF (0x80) // data transfer bit
287#define MCF5282_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
288#define MCF5282_I2C_I2SR_IBB (0x20) // I2C bus busy
289#define MCF5282_I2C_I2SR_IAL (0x10) // aribitration lost
290#define MCF5282_I2C_I2SR_SRW (0x04) // slave read/write
291#define MCF5282_I2C_I2SR_IIF (0x02) // I2C interrupt
292#define MCF5282_I2C_I2SR_RXAK (0x01) // received acknowledge
293
294
295#endif /* m528xsim_h */ 246#endif /* m528xsim_h */
diff --git a/arch/m68k/include/asm/m5307sim.h b/arch/m68k/include/asm/m5307sim.h
index 3bc3adaa7ee0..5d0bb7ec31f8 100644
--- a/arch/m68k/include/asm/m5307sim.h
+++ b/arch/m68k/include/asm/m5307sim.h
@@ -23,71 +23,71 @@
23/* 23/*
24 * Define the 5307 SIM register set addresses. 24 * Define the 5307 SIM register set addresses.
25 */ 25 */
26#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 26#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status reg */
27#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 27#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
28#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 28#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
29#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 29#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog service*/
30#define MCFSIM_PAR 0x04 /* Pin Assignment reg (r/w) */ 30#define MCFSIM_PAR (MCF_MBAR + 0x04) /* Pin Assignment */
31#define MCFSIM_IRQPAR 0x06 /* Interrupt Assignment reg (r/w) */ 31#define MCFSIM_IRQPAR (MCF_MBAR + 0x06) /* Itr Assignment */
32#define MCFSIM_PLLCR 0x08 /* PLL Control Reg*/ 32#define MCFSIM_PLLCR (MCF_MBAR + 0x08) /* PLL Ctrl Reg */
33#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 33#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
34#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 34#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pend */
35#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 35#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
36#define MCFSIM_AVR 0x4b /* Autovector Ctrl reg (r/w) */ 36#define MCFSIM_AVR (MCF_MBAR + 0x4b) /* Autovector Ctrl */
37#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 37#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
38#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 38#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
39#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 39#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
40#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 40#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
41#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 41#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
42#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 42#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
43#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 43#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
44#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 44#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
45#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 45#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
46#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 46#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
47#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 47#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
48#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 48#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
49 49
50#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 50#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
51#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 51#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
52#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 52#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
53#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 53#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
54#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 54#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
55#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 55#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
56 56
57#ifdef CONFIG_OLDMASK 57#ifdef CONFIG_OLDMASK
58#define MCFSIM_CSBAR 0x98 /* CS Base Address reg (r/w) */ 58#define MCFSIM_CSBAR (MCF_MBAR + 0x98) /* CS Base Address */
59#define MCFSIM_CSBAMR 0x9c /* CS Base Mask reg (r/w) */ 59#define MCFSIM_CSBAMR (MCF_MBAR + 0x9c) /* CS Base Mask */
60#define MCFSIM_CSMR2 0x9e /* CS 2 Mask reg (r/w) */ 60#define MCFSIM_CSMR2 (MCF_MBAR + 0x9e) /* CS 2 Mask reg */
61#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 61#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
62#define MCFSIM_CSMR3 0xaa /* CS 3 Mask reg (r/w) */ 62#define MCFSIM_CSMR3 (MCF_MBAR + 0xaa) /* CS 3 Mask reg */
63#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 63#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
64#define MCFSIM_CSMR4 0xb6 /* CS 4 Mask reg (r/w) */ 64#define MCFSIM_CSMR4 (MCF_MBAR + 0xb6) /* CS 4 Mask reg */
65#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 65#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
66#define MCFSIM_CSMR5 0xc2 /* CS 5 Mask reg (r/w) */ 66#define MCFSIM_CSMR5 (MCF_MBAR + 0xc2) /* CS 5 Mask reg */
67#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 67#define MCFSIM_CSCR5 (MCF_MBAR + 0xc6) /* CS 5 Control reg */
68#define MCFSIM_CSMR6 0xce /* CS 6 Mask reg (r/w) */ 68#define MCFSIM_CSMR6 (MCF_MBAR + 0xce) /* CS 6 Mask reg */
69#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 69#define MCFSIM_CSCR6 (MCF_MBAR + 0xd2) /* CS 6 Control reg */
70#define MCFSIM_CSMR7 0xda /* CS 7 Mask reg (r/w) */ 70#define MCFSIM_CSMR7 (MCF_MBAR + 0xda) /* CS 7 Mask reg */
71#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 71#define MCFSIM_CSCR7 (MCF_MBAR + 0xde) /* CS 7 Control reg */
72#else 72#else
73#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 73#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
74#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 74#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
75#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 75#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
76#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 76#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
77#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 77#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
78#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 78#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
79#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ 79#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
80#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 80#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
81#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 81#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
82#define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */ 82#define MCFSIM_CSAR5 (MCF_MBAR + 0xbc) /* CS 5 Address reg */
83#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ 83#define MCFSIM_CSMR5 (MCF_MBAR + 0xc0) /* CS 5 Mask reg */
84#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 84#define MCFSIM_CSCR5 (MCF_MBAR + 0xc6) /* CS 5 Control reg */
85#define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */ 85#define MCFSIM_CSAR6 (MCF_MBAR + 0xc8) /* CS 6 Address reg */
86#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ 86#define MCFSIM_CSMR6 (MCF_MBAR + 0xcc) /* CS 6 Mask reg */
87#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 87#define MCFSIM_CSCR6 (MCF_MBAR + 0xd2) /* CS 6 Control reg */
88#define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */ 88#define MCFSIM_CSAR7 (MCF_MBAR + 0xd4) /* CS 7 Address reg */
89#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ 89#define MCFSIM_CSMR7 (MCF_MBAR + 0xd8) /* CS 7 Mask reg */
90#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 90#define MCFSIM_CSCR7 (MCF_MBAR + 0xde) /* CS 7 Control reg */
91#endif /* CONFIG_OLDMASK */ 91#endif /* CONFIG_OLDMASK */
92 92
93#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 93#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
@@ -127,9 +127,9 @@
127/* 127/*
128 * Generic GPIO support 128 * Generic GPIO support
129 */ 129 */
130#define MCFGPIO_PIN_MAX 16 130#define MCFGPIO_PIN_MAX 16
131#define MCFGPIO_IRQ_MAX -1 131#define MCFGPIO_IRQ_MAX -1
132#define MCFGPIO_IRQ_VECBASE -1 132#define MCFGPIO_IRQ_VECBASE -1
133 133
134 134
135/* Definition offset address for CS2-7 -- old mask 5307 */ 135/* Definition offset address for CS2-7 -- old mask 5307 */
@@ -167,9 +167,9 @@
167/* 167/*
168 * Defines for the IRQPAR Register 168 * Defines for the IRQPAR Register
169 */ 169 */
170#define IRQ5_LEVEL4 0x80 170#define IRQ5_LEVEL4 0x80
171#define IRQ3_LEVEL6 0x40 171#define IRQ3_LEVEL6 0x40
172#define IRQ1_LEVEL2 0x20 172#define IRQ1_LEVEL2 0x20
173 173
174/* 174/*
175 * Define system peripheral IRQ usage. 175 * Define system peripheral IRQ usage.
diff --git a/arch/m68k/include/asm/m532xsim.h b/arch/m68k/include/asm/m532xsim.h
index 5ca7b298c6eb..8668e47ced0e 100644
--- a/arch/m68k/include/asm/m532xsim.h
+++ b/arch/m68k/include/asm/m532xsim.h
@@ -15,10 +15,6 @@
15 15
16#include <asm/m53xxacr.h> 16#include <asm/m53xxacr.h>
17 17
18#define MCF_REG32(x) (*(volatile unsigned long *)(x))
19#define MCF_REG16(x) (*(volatile unsigned short *)(x))
20#define MCF_REG08(x) (*(volatile unsigned char *)(x))
21
22#define MCFINT_VECBASE 64 18#define MCFINT_VECBASE 64
23#define MCFINT_UART0 26 /* Interrupt number for UART0 */ 19#define MCFINT_UART0 26 /* Interrupt number for UART0 */
24#define MCFINT_UART1 27 /* Interrupt number for UART1 */ 20#define MCFINT_UART1 27 /* Interrupt number for UART1 */
@@ -38,7 +34,7 @@
38 34
39#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI) 35#define MCF_IRQ_QSPI (MCFINT_VECBASE + MCFINT_QSPI)
40 36
41#define MCF_WTM_WCR MCF_REG16(0xFC098000) 37#define MCF_WTM_WCR 0xFC098000
42 38
43/* 39/*
44 * Define the 532x SIM register set addresses. 40 * Define the 532x SIM register set addresses.
@@ -152,42 +148,6 @@
152#define MCFPM_PPMHR1 0xfc040038 148#define MCFPM_PPMHR1 0xfc040038
153#define MCFPM_LPCR 0xec090007 149#define MCFPM_LPCR 0xec090007
154 150
155/*********************************************************************
156 *
157 * Inter-IC (I2C) Module
158 *
159 *********************************************************************/
160
161/* Read/Write access macros for general use */
162#define MCF532x_I2C_I2ADR (volatile u8 *) (0xFC058000) // Address
163#define MCF532x_I2C_I2FDR (volatile u8 *) (0xFC058004) // Freq Divider
164#define MCF532x_I2C_I2CR (volatile u8 *) (0xFC058008) // Control
165#define MCF532x_I2C_I2SR (volatile u8 *) (0xFC05800C) // Status
166#define MCF532x_I2C_I2DR (volatile u8 *) (0xFC058010) // Data I/O
167
168/* Bit level definitions and macros */
169#define MCF532x_I2C_I2ADR_ADDR(x) (((x)&0x7F)<<0x01)
170
171#define MCF532x_I2C_I2FDR_IC(x) (((x)&0x3F))
172
173#define MCF532x_I2C_I2CR_IEN (0x80) // I2C enable
174#define MCF532x_I2C_I2CR_IIEN (0x40) // interrupt enable
175#define MCF532x_I2C_I2CR_MSTA (0x20) // master/slave mode
176#define MCF532x_I2C_I2CR_MTX (0x10) // transmit/receive mode
177#define MCF532x_I2C_I2CR_TXAK (0x08) // transmit acknowledge enable
178#define MCF532x_I2C_I2CR_RSTA (0x04) // repeat start
179
180#define MCF532x_I2C_I2SR_ICF (0x80) // data transfer bit
181#define MCF532x_I2C_I2SR_IAAS (0x40) // I2C addressed as a slave
182#define MCF532x_I2C_I2SR_IBB (0x20) // I2C bus busy
183#define MCF532x_I2C_I2SR_IAL (0x10) // aribitration lost
184#define MCF532x_I2C_I2SR_SRW (0x04) // slave read/write
185#define MCF532x_I2C_I2SR_IIF (0x02) // I2C interrupt
186#define MCF532x_I2C_I2SR_RXAK (0x01) // received acknowledge
187
188#define MCF532x_PAR_FECI2C (volatile u8 *) (0xFC0A4053)
189
190
191/* 151/*
192 * The M5329EVB board needs a help getting its devices initialized 152 * The M5329EVB board needs a help getting its devices initialized
193 * at kernel start time if dBUG doesn't set it up (for example 153 * at kernel start time if dBUG doesn't set it up (for example
@@ -217,13 +177,13 @@
217 *********************************************************************/ 177 *********************************************************************/
218 178
219/* Register read/write macros */ 179/* Register read/write macros */
220#define MCF_CCM_CCR MCF_REG16(0xFC0A0004) 180#define MCF_CCM_CCR 0xFC0A0004
221#define MCF_CCM_RCON MCF_REG16(0xFC0A0008) 181#define MCF_CCM_RCON 0xFC0A0008
222#define MCF_CCM_CIR MCF_REG16(0xFC0A000A) 182#define MCF_CCM_CIR 0xFC0A000A
223#define MCF_CCM_MISCCR MCF_REG16(0xFC0A0010) 183#define MCF_CCM_MISCCR 0xFC0A0010
224#define MCF_CCM_CDR MCF_REG16(0xFC0A0012) 184#define MCF_CCM_CDR 0xFC0A0012
225#define MCF_CCM_UHCSR MCF_REG16(0xFC0A0014) 185#define MCF_CCM_UHCSR 0xFC0A0014
226#define MCF_CCM_UOCSR MCF_REG16(0xFC0A0016) 186#define MCF_CCM_UOCSR 0xFC0A0016
227 187
228/* Bit definitions and macros for MCF_CCM_CCR */ 188/* Bit definitions and macros for MCF_CCM_CCR */
229#define MCF_CCM_CCR_RESERVED (0x0001) 189#define MCF_CCM_CCR_RESERVED (0x0001)
@@ -287,104 +247,29 @@
287 247
288/********************************************************************* 248/*********************************************************************
289 * 249 *
290 * DMA Timers (DTIM)
291 *
292 *********************************************************************/
293
294/* Register read/write macros */
295#define MCF_DTIM0_DTMR MCF_REG16(0xFC070000)
296#define MCF_DTIM0_DTXMR MCF_REG08(0xFC070002)
297#define MCF_DTIM0_DTER MCF_REG08(0xFC070003)
298#define MCF_DTIM0_DTRR MCF_REG32(0xFC070004)
299#define MCF_DTIM0_DTCR MCF_REG32(0xFC070008)
300#define MCF_DTIM0_DTCN MCF_REG32(0xFC07000C)
301#define MCF_DTIM1_DTMR MCF_REG16(0xFC074000)
302#define MCF_DTIM1_DTXMR MCF_REG08(0xFC074002)
303#define MCF_DTIM1_DTER MCF_REG08(0xFC074003)
304#define MCF_DTIM1_DTRR MCF_REG32(0xFC074004)
305#define MCF_DTIM1_DTCR MCF_REG32(0xFC074008)
306#define MCF_DTIM1_DTCN MCF_REG32(0xFC07400C)
307#define MCF_DTIM2_DTMR MCF_REG16(0xFC078000)
308#define MCF_DTIM2_DTXMR MCF_REG08(0xFC078002)
309#define MCF_DTIM2_DTER MCF_REG08(0xFC078003)
310#define MCF_DTIM2_DTRR MCF_REG32(0xFC078004)
311#define MCF_DTIM2_DTCR MCF_REG32(0xFC078008)
312#define MCF_DTIM2_DTCN MCF_REG32(0xFC07800C)
313#define MCF_DTIM3_DTMR MCF_REG16(0xFC07C000)
314#define MCF_DTIM3_DTXMR MCF_REG08(0xFC07C002)
315#define MCF_DTIM3_DTER MCF_REG08(0xFC07C003)
316#define MCF_DTIM3_DTRR MCF_REG32(0xFC07C004)
317#define MCF_DTIM3_DTCR MCF_REG32(0xFC07C008)
318#define MCF_DTIM3_DTCN MCF_REG32(0xFC07C00C)
319#define MCF_DTIM_DTMR(x) MCF_REG16(0xFC070000+((x)*0x4000))
320#define MCF_DTIM_DTXMR(x) MCF_REG08(0xFC070002+((x)*0x4000))
321#define MCF_DTIM_DTER(x) MCF_REG08(0xFC070003+((x)*0x4000))
322#define MCF_DTIM_DTRR(x) MCF_REG32(0xFC070004+((x)*0x4000))
323#define MCF_DTIM_DTCR(x) MCF_REG32(0xFC070008+((x)*0x4000))
324#define MCF_DTIM_DTCN(x) MCF_REG32(0xFC07000C+((x)*0x4000))
325
326/* Bit definitions and macros for MCF_DTIM_DTMR */
327#define MCF_DTIM_DTMR_RST (0x0001)
328#define MCF_DTIM_DTMR_CLK(x) (((x)&0x0003)<<1)
329#define MCF_DTIM_DTMR_FRR (0x0008)
330#define MCF_DTIM_DTMR_ORRI (0x0010)
331#define MCF_DTIM_DTMR_OM (0x0020)
332#define MCF_DTIM_DTMR_CE(x) (((x)&0x0003)<<6)
333#define MCF_DTIM_DTMR_PS(x) (((x)&0x00FF)<<8)
334#define MCF_DTIM_DTMR_CE_ANY (0x00C0)
335#define MCF_DTIM_DTMR_CE_FALL (0x0080)
336#define MCF_DTIM_DTMR_CE_RISE (0x0040)
337#define MCF_DTIM_DTMR_CE_NONE (0x0000)
338#define MCF_DTIM_DTMR_CLK_DTIN (0x0006)
339#define MCF_DTIM_DTMR_CLK_DIV16 (0x0004)
340#define MCF_DTIM_DTMR_CLK_DIV1 (0x0002)
341#define MCF_DTIM_DTMR_CLK_STOP (0x0000)
342
343/* Bit definitions and macros for MCF_DTIM_DTXMR */
344#define MCF_DTIM_DTXMR_MODE16 (0x01)
345#define MCF_DTIM_DTXMR_DMAEN (0x80)
346
347/* Bit definitions and macros for MCF_DTIM_DTER */
348#define MCF_DTIM_DTER_CAP (0x01)
349#define MCF_DTIM_DTER_REF (0x02)
350
351/* Bit definitions and macros for MCF_DTIM_DTRR */
352#define MCF_DTIM_DTRR_REF(x) (((x)&0xFFFFFFFF)<<0)
353
354/* Bit definitions and macros for MCF_DTIM_DTCR */
355#define MCF_DTIM_DTCR_CAP(x) (((x)&0xFFFFFFFF)<<0)
356
357/* Bit definitions and macros for MCF_DTIM_DTCN */
358#define MCF_DTIM_DTCN_CNT(x) (((x)&0xFFFFFFFF)<<0)
359
360/*********************************************************************
361 *
362 * FlexBus Chip Selects (FBCS) 250 * FlexBus Chip Selects (FBCS)
363 * 251 *
364 *********************************************************************/ 252 *********************************************************************/
365 253
366/* Register read/write macros */ 254/* Register read/write macros */
367#define MCF_FBCS0_CSAR MCF_REG32(0xFC008000) 255#define MCF_FBCS0_CSAR 0xFC008000
368#define MCF_FBCS0_CSMR MCF_REG32(0xFC008004) 256#define MCF_FBCS0_CSMR 0xFC008004
369#define MCF_FBCS0_CSCR MCF_REG32(0xFC008008) 257#define MCF_FBCS0_CSCR 0xFC008008
370#define MCF_FBCS1_CSAR MCF_REG32(0xFC00800C) 258#define MCF_FBCS1_CSAR 0xFC00800C
371#define MCF_FBCS1_CSMR MCF_REG32(0xFC008010) 259#define MCF_FBCS1_CSMR 0xFC008010
372#define MCF_FBCS1_CSCR MCF_REG32(0xFC008014) 260#define MCF_FBCS1_CSCR 0xFC008014
373#define MCF_FBCS2_CSAR MCF_REG32(0xFC008018) 261#define MCF_FBCS2_CSAR 0xFC008018
374#define MCF_FBCS2_CSMR MCF_REG32(0xFC00801C) 262#define MCF_FBCS2_CSMR 0xFC00801C
375#define MCF_FBCS2_CSCR MCF_REG32(0xFC008020) 263#define MCF_FBCS2_CSCR 0xFC008020
376#define MCF_FBCS3_CSAR MCF_REG32(0xFC008024) 264#define MCF_FBCS3_CSAR 0xFC008024
377#define MCF_FBCS3_CSMR MCF_REG32(0xFC008028) 265#define MCF_FBCS3_CSMR 0xFC008028
378#define MCF_FBCS3_CSCR MCF_REG32(0xFC00802C) 266#define MCF_FBCS3_CSCR 0xFC00802C
379#define MCF_FBCS4_CSAR MCF_REG32(0xFC008030) 267#define MCF_FBCS4_CSAR 0xFC008030
380#define MCF_FBCS4_CSMR MCF_REG32(0xFC008034) 268#define MCF_FBCS4_CSMR 0xFC008034
381#define MCF_FBCS4_CSCR MCF_REG32(0xFC008038) 269#define MCF_FBCS4_CSCR 0xFC008038
382#define MCF_FBCS5_CSAR MCF_REG32(0xFC00803C) 270#define MCF_FBCS5_CSAR 0xFC00803C
383#define MCF_FBCS5_CSMR MCF_REG32(0xFC008040) 271#define MCF_FBCS5_CSMR 0xFC008040
384#define MCF_FBCS5_CSCR MCF_REG32(0xFC008044) 272#define MCF_FBCS5_CSCR 0xFC008044
385#define MCF_FBCS_CSAR(x) MCF_REG32(0xFC008000+((x)*0x00C))
386#define MCF_FBCS_CSMR(x) MCF_REG32(0xFC008004+((x)*0x00C))
387#define MCF_FBCS_CSCR(x) MCF_REG32(0xFC008008+((x)*0x00C))
388 273
389/* Bit definitions and macros for MCF_FBCS_CSAR */ 274/* Bit definitions and macros for MCF_FBCS_CSAR */
390#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000) 275#define MCF_FBCS_CSAR_BA(x) ((x)&0xFFFF0000)
@@ -501,32 +386,32 @@
501#define MCFGPIO_PCLRR_LCDDATAL (0xFC0A404B) 386#define MCFGPIO_PCLRR_LCDDATAL (0xFC0A404B)
502#define MCFGPIO_PCLRR_LCDCTLH (0xFC0A404C) 387#define MCFGPIO_PCLRR_LCDCTLH (0xFC0A404C)
503#define MCFGPIO_PCLRR_LCDCTLL (0xFC0A404D) 388#define MCFGPIO_PCLRR_LCDCTLL (0xFC0A404D)
504#define MCF_GPIO_PAR_FEC MCF_REG08(0xFC0A4050) 389#define MCFGPIO_PAR_FEC (0xFC0A4050)
505#define MCF_GPIO_PAR_PWM MCF_REG08(0xFC0A4051) 390#define MCFGPIO_PAR_PWM (0xFC0A4051)
506#define MCF_GPIO_PAR_BUSCTL MCF_REG08(0xFC0A4052) 391#define MCFGPIO_PAR_BUSCTL (0xFC0A4052)
507#define MCF_GPIO_PAR_FECI2C MCF_REG08(0xFC0A4053) 392#define MCFGPIO_PAR_FECI2C (0xFC0A4053)
508#define MCF_GPIO_PAR_BE MCF_REG08(0xFC0A4054) 393#define MCFGPIO_PAR_BE (0xFC0A4054)
509#define MCF_GPIO_PAR_CS MCF_REG08(0xFC0A4055) 394#define MCFGPIO_PAR_CS (0xFC0A4055)
510#define MCF_GPIO_PAR_SSI MCF_REG16(0xFC0A4056) 395#define MCFGPIO_PAR_SSI (0xFC0A4056)
511#define MCF_GPIO_PAR_UART MCF_REG16(0xFC0A4058) 396#define MCFGPIO_PAR_UART (0xFC0A4058)
512#define MCF_GPIO_PAR_QSPI MCF_REG16(0xFC0A405A) 397#define MCFGPIO_PAR_QSPI (0xFC0A405A)
513#define MCF_GPIO_PAR_TIMER MCF_REG08(0xFC0A405C) 398#define MCFGPIO_PAR_TIMER (0xFC0A405C)
514#define MCF_GPIO_PAR_LCDDATA MCF_REG08(0xFC0A405D) 399#define MCFGPIO_PAR_LCDDATA (0xFC0A405D)
515#define MCF_GPIO_PAR_LCDCTL MCF_REG16(0xFC0A405E) 400#define MCFGPIO_PAR_LCDCTL (0xFC0A405E)
516#define MCF_GPIO_PAR_IRQ MCF_REG16(0xFC0A4060) 401#define MCFGPIO_PAR_IRQ (0xFC0A4060)
517#define MCF_GPIO_MSCR_FLEXBUS MCF_REG08(0xFC0A4064) 402#define MCFGPIO_MSCR_FLEXBUS (0xFC0A4064)
518#define MCF_GPIO_MSCR_SDRAM MCF_REG08(0xFC0A4065) 403#define MCFGPIO_MSCR_SDRAM (0xFC0A4065)
519#define MCF_GPIO_DSCR_I2C MCF_REG08(0xFC0A4068) 404#define MCFGPIO_DSCR_I2C (0xFC0A4068)
520#define MCF_GPIO_DSCR_PWM MCF_REG08(0xFC0A4069) 405#define MCFGPIO_DSCR_PWM (0xFC0A4069)
521#define MCF_GPIO_DSCR_FEC MCF_REG08(0xFC0A406A) 406#define MCFGPIO_DSCR_FEC (0xFC0A406A)
522#define MCF_GPIO_DSCR_UART MCF_REG08(0xFC0A406B) 407#define MCFGPIO_DSCR_UART (0xFC0A406B)
523#define MCF_GPIO_DSCR_QSPI MCF_REG08(0xFC0A406C) 408#define MCFGPIO_DSCR_QSPI (0xFC0A406C)
524#define MCF_GPIO_DSCR_TIMER MCF_REG08(0xFC0A406D) 409#define MCFGPIO_DSCR_TIMER (0xFC0A406D)
525#define MCF_GPIO_DSCR_SSI MCF_REG08(0xFC0A406E) 410#define MCFGPIO_DSCR_SSI (0xFC0A406E)
526#define MCF_GPIO_DSCR_LCD MCF_REG08(0xFC0A406F) 411#define MCFGPIO_DSCR_LCD (0xFC0A406F)
527#define MCF_GPIO_DSCR_DEBUG MCF_REG08(0xFC0A4070) 412#define MCFGPIO_DSCR_DEBUG (0xFC0A4070)
528#define MCF_GPIO_DSCR_CLKRST MCF_REG08(0xFC0A4071) 413#define MCFGPIO_DSCR_CLKRST (0xFC0A4071)
529#define MCF_GPIO_DSCR_IRQ MCF_REG08(0xFC0A4072) 414#define MCFGPIO_DSCR_IRQ (0xFC0A4072)
530 415
531/* Bit definitions and macros for MCF_GPIO_PODR_FECH */ 416/* Bit definitions and macros for MCF_GPIO_PODR_FECH */
532#define MCF_GPIO_PODR_FECH_PODR_FECH0 (0x01) 417#define MCF_GPIO_PODR_FECH_PODR_FECH0 (0x01)
@@ -1215,709 +1100,6 @@
1215#define MCFGPIO_IRQ_MAX 8 1100#define MCFGPIO_IRQ_MAX 8
1216#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE 1101#define MCFGPIO_IRQ_VECBASE MCFINT_VECBASE
1217 1102
1218
1219/*********************************************************************
1220 *
1221 * Interrupt Controller (INTC)
1222 *
1223 *********************************************************************/
1224
1225/* Register read/write macros */
1226#define MCF_INTC0_IPRH MCF_REG32(0xFC048000)
1227#define MCF_INTC0_IPRL MCF_REG32(0xFC048004)
1228#define MCF_INTC0_IMRH MCF_REG32(0xFC048008)
1229#define MCF_INTC0_IMRL MCF_REG32(0xFC04800C)
1230#define MCF_INTC0_INTFRCH MCF_REG32(0xFC048010)
1231#define MCF_INTC0_INTFRCL MCF_REG32(0xFC048014)
1232#define MCF_INTC0_ICONFIG MCF_REG16(0xFC04801A)
1233#define MCF_INTC0_SIMR MCF_REG08(0xFC04801C)
1234#define MCF_INTC0_CIMR MCF_REG08(0xFC04801D)
1235#define MCF_INTC0_CLMASK MCF_REG08(0xFC04801E)
1236#define MCF_INTC0_SLMASK MCF_REG08(0xFC04801F)
1237#define MCF_INTC0_ICR0 MCF_REG08(0xFC048040)
1238#define MCF_INTC0_ICR1 MCF_REG08(0xFC048041)
1239#define MCF_INTC0_ICR2 MCF_REG08(0xFC048042)
1240#define MCF_INTC0_ICR3 MCF_REG08(0xFC048043)
1241#define MCF_INTC0_ICR4 MCF_REG08(0xFC048044)
1242#define MCF_INTC0_ICR5 MCF_REG08(0xFC048045)
1243#define MCF_INTC0_ICR6 MCF_REG08(0xFC048046)
1244#define MCF_INTC0_ICR7 MCF_REG08(0xFC048047)
1245#define MCF_INTC0_ICR8 MCF_REG08(0xFC048048)
1246#define MCF_INTC0_ICR9 MCF_REG08(0xFC048049)
1247#define MCF_INTC0_ICR10 MCF_REG08(0xFC04804A)
1248#define MCF_INTC0_ICR11 MCF_REG08(0xFC04804B)
1249#define MCF_INTC0_ICR12 MCF_REG08(0xFC04804C)
1250#define MCF_INTC0_ICR13 MCF_REG08(0xFC04804D)
1251#define MCF_INTC0_ICR14 MCF_REG08(0xFC04804E)
1252#define MCF_INTC0_ICR15 MCF_REG08(0xFC04804F)
1253#define MCF_INTC0_ICR16 MCF_REG08(0xFC048050)
1254#define MCF_INTC0_ICR17 MCF_REG08(0xFC048051)
1255#define MCF_INTC0_ICR18 MCF_REG08(0xFC048052)
1256#define MCF_INTC0_ICR19 MCF_REG08(0xFC048053)
1257#define MCF_INTC0_ICR20 MCF_REG08(0xFC048054)
1258#define MCF_INTC0_ICR21 MCF_REG08(0xFC048055)
1259#define MCF_INTC0_ICR22 MCF_REG08(0xFC048056)
1260#define MCF_INTC0_ICR23 MCF_REG08(0xFC048057)
1261#define MCF_INTC0_ICR24 MCF_REG08(0xFC048058)
1262#define MCF_INTC0_ICR25 MCF_REG08(0xFC048059)
1263#define MCF_INTC0_ICR26 MCF_REG08(0xFC04805A)
1264#define MCF_INTC0_ICR27 MCF_REG08(0xFC04805B)
1265#define MCF_INTC0_ICR28 MCF_REG08(0xFC04805C)
1266#define MCF_INTC0_ICR29 MCF_REG08(0xFC04805D)
1267#define MCF_INTC0_ICR30 MCF_REG08(0xFC04805E)
1268#define MCF_INTC0_ICR31 MCF_REG08(0xFC04805F)
1269#define MCF_INTC0_ICR32 MCF_REG08(0xFC048060)
1270#define MCF_INTC0_ICR33 MCF_REG08(0xFC048061)
1271#define MCF_INTC0_ICR34 MCF_REG08(0xFC048062)
1272#define MCF_INTC0_ICR35 MCF_REG08(0xFC048063)
1273#define MCF_INTC0_ICR36 MCF_REG08(0xFC048064)
1274#define MCF_INTC0_ICR37 MCF_REG08(0xFC048065)
1275#define MCF_INTC0_ICR38 MCF_REG08(0xFC048066)
1276#define MCF_INTC0_ICR39 MCF_REG08(0xFC048067)
1277#define MCF_INTC0_ICR40 MCF_REG08(0xFC048068)
1278#define MCF_INTC0_ICR41 MCF_REG08(0xFC048069)
1279#define MCF_INTC0_ICR42 MCF_REG08(0xFC04806A)
1280#define MCF_INTC0_ICR43 MCF_REG08(0xFC04806B)
1281#define MCF_INTC0_ICR44 MCF_REG08(0xFC04806C)
1282#define MCF_INTC0_ICR45 MCF_REG08(0xFC04806D)
1283#define MCF_INTC0_ICR46 MCF_REG08(0xFC04806E)
1284#define MCF_INTC0_ICR47 MCF_REG08(0xFC04806F)
1285#define MCF_INTC0_ICR48 MCF_REG08(0xFC048070)
1286#define MCF_INTC0_ICR49 MCF_REG08(0xFC048071)
1287#define MCF_INTC0_ICR50 MCF_REG08(0xFC048072)
1288#define MCF_INTC0_ICR51 MCF_REG08(0xFC048073)
1289#define MCF_INTC0_ICR52 MCF_REG08(0xFC048074)
1290#define MCF_INTC0_ICR53 MCF_REG08(0xFC048075)
1291#define MCF_INTC0_ICR54 MCF_REG08(0xFC048076)
1292#define MCF_INTC0_ICR55 MCF_REG08(0xFC048077)
1293#define MCF_INTC0_ICR56 MCF_REG08(0xFC048078)
1294#define MCF_INTC0_ICR57 MCF_REG08(0xFC048079)
1295#define MCF_INTC0_ICR58 MCF_REG08(0xFC04807A)
1296#define MCF_INTC0_ICR59 MCF_REG08(0xFC04807B)
1297#define MCF_INTC0_ICR60 MCF_REG08(0xFC04807C)
1298#define MCF_INTC0_ICR61 MCF_REG08(0xFC04807D)
1299#define MCF_INTC0_ICR62 MCF_REG08(0xFC04807E)
1300#define MCF_INTC0_ICR63 MCF_REG08(0xFC04807F)
1301#define MCF_INTC0_ICR(x) MCF_REG08(0xFC048040+((x)*0x001))
1302#define MCF_INTC0_SWIACK MCF_REG08(0xFC0480E0)
1303#define MCF_INTC0_L1IACK MCF_REG08(0xFC0480E4)
1304#define MCF_INTC0_L2IACK MCF_REG08(0xFC0480E8)
1305#define MCF_INTC0_L3IACK MCF_REG08(0xFC0480EC)
1306#define MCF_INTC0_L4IACK MCF_REG08(0xFC0480F0)
1307#define MCF_INTC0_L5IACK MCF_REG08(0xFC0480F4)
1308#define MCF_INTC0_L6IACK MCF_REG08(0xFC0480F8)
1309#define MCF_INTC0_L7IACK MCF_REG08(0xFC0480FC)
1310#define MCF_INTC0_LIACK(x) MCF_REG08(0xFC0480E4+((x)*0x004))
1311#define MCF_INTC1_IPRH MCF_REG32(0xFC04C000)
1312#define MCF_INTC1_IPRL MCF_REG32(0xFC04C004)
1313#define MCF_INTC1_IMRH MCF_REG32(0xFC04C008)
1314#define MCF_INTC1_IMRL MCF_REG32(0xFC04C00C)
1315#define MCF_INTC1_INTFRCH MCF_REG32(0xFC04C010)
1316#define MCF_INTC1_INTFRCL MCF_REG32(0xFC04C014)
1317#define MCF_INTC1_ICONFIG MCF_REG16(0xFC04C01A)
1318#define MCF_INTC1_SIMR MCF_REG08(0xFC04C01C)
1319#define MCF_INTC1_CIMR MCF_REG08(0xFC04C01D)
1320#define MCF_INTC1_CLMASK MCF_REG08(0xFC04C01E)
1321#define MCF_INTC1_SLMASK MCF_REG08(0xFC04C01F)
1322#define MCF_INTC1_ICR0 MCF_REG08(0xFC04C040)
1323#define MCF_INTC1_ICR1 MCF_REG08(0xFC04C041)
1324#define MCF_INTC1_ICR2 MCF_REG08(0xFC04C042)
1325#define MCF_INTC1_ICR3 MCF_REG08(0xFC04C043)
1326#define MCF_INTC1_ICR4 MCF_REG08(0xFC04C044)
1327#define MCF_INTC1_ICR5 MCF_REG08(0xFC04C045)
1328#define MCF_INTC1_ICR6 MCF_REG08(0xFC04C046)
1329#define MCF_INTC1_ICR7 MCF_REG08(0xFC04C047)
1330#define MCF_INTC1_ICR8 MCF_REG08(0xFC04C048)
1331#define MCF_INTC1_ICR9 MCF_REG08(0xFC04C049)
1332#define MCF_INTC1_ICR10 MCF_REG08(0xFC04C04A)
1333#define MCF_INTC1_ICR11 MCF_REG08(0xFC04C04B)
1334#define MCF_INTC1_ICR12 MCF_REG08(0xFC04C04C)
1335#define MCF_INTC1_ICR13 MCF_REG08(0xFC04C04D)
1336#define MCF_INTC1_ICR14 MCF_REG08(0xFC04C04E)
1337#define MCF_INTC1_ICR15 MCF_REG08(0xFC04C04F)
1338#define MCF_INTC1_ICR16 MCF_REG08(0xFC04C050)
1339#define MCF_INTC1_ICR17 MCF_REG08(0xFC04C051)
1340#define MCF_INTC1_ICR18 MCF_REG08(0xFC04C052)
1341#define MCF_INTC1_ICR19 MCF_REG08(0xFC04C053)
1342#define MCF_INTC1_ICR20 MCF_REG08(0xFC04C054)
1343#define MCF_INTC1_ICR21 MCF_REG08(0xFC04C055)
1344#define MCF_INTC1_ICR22 MCF_REG08(0xFC04C056)
1345#define MCF_INTC1_ICR23 MCF_REG08(0xFC04C057)
1346#define MCF_INTC1_ICR24 MCF_REG08(0xFC04C058)
1347#define MCF_INTC1_ICR25 MCF_REG08(0xFC04C059)
1348#define MCF_INTC1_ICR26 MCF_REG08(0xFC04C05A)
1349#define MCF_INTC1_ICR27 MCF_REG08(0xFC04C05B)
1350#define MCF_INTC1_ICR28 MCF_REG08(0xFC04C05C)
1351#define MCF_INTC1_ICR29 MCF_REG08(0xFC04C05D)
1352#define MCF_INTC1_ICR30 MCF_REG08(0xFC04C05E)
1353#define MCF_INTC1_ICR31 MCF_REG08(0xFC04C05F)
1354#define MCF_INTC1_ICR32 MCF_REG08(0xFC04C060)
1355#define MCF_INTC1_ICR33 MCF_REG08(0xFC04C061)
1356#define MCF_INTC1_ICR34 MCF_REG08(0xFC04C062)
1357#define MCF_INTC1_ICR35 MCF_REG08(0xFC04C063)
1358#define MCF_INTC1_ICR36 MCF_REG08(0xFC04C064)
1359#define MCF_INTC1_ICR37 MCF_REG08(0xFC04C065)
1360#define MCF_INTC1_ICR38 MCF_REG08(0xFC04C066)
1361#define MCF_INTC1_ICR39 MCF_REG08(0xFC04C067)
1362#define MCF_INTC1_ICR40 MCF_REG08(0xFC04C068)
1363#define MCF_INTC1_ICR41 MCF_REG08(0xFC04C069)
1364#define MCF_INTC1_ICR42 MCF_REG08(0xFC04C06A)
1365#define MCF_INTC1_ICR43 MCF_REG08(0xFC04C06B)
1366#define MCF_INTC1_ICR44 MCF_REG08(0xFC04C06C)
1367#define MCF_INTC1_ICR45 MCF_REG08(0xFC04C06D)
1368#define MCF_INTC1_ICR46 MCF_REG08(0xFC04C06E)
1369#define MCF_INTC1_ICR47 MCF_REG08(0xFC04C06F)
1370#define MCF_INTC1_ICR48 MCF_REG08(0xFC04C070)
1371#define MCF_INTC1_ICR49 MCF_REG08(0xFC04C071)
1372#define MCF_INTC1_ICR50 MCF_REG08(0xFC04C072)
1373#define MCF_INTC1_ICR51 MCF_REG08(0xFC04C073)
1374#define MCF_INTC1_ICR52 MCF_REG08(0xFC04C074)
1375#define MCF_INTC1_ICR53 MCF_REG08(0xFC04C075)
1376#define MCF_INTC1_ICR54 MCF_REG08(0xFC04C076)
1377#define MCF_INTC1_ICR55 MCF_REG08(0xFC04C077)
1378#define MCF_INTC1_ICR56 MCF_REG08(0xFC04C078)
1379#define MCF_INTC1_ICR57 MCF_REG08(0xFC04C079)
1380#define MCF_INTC1_ICR58 MCF_REG08(0xFC04C07A)
1381#define MCF_INTC1_ICR59 MCF_REG08(0xFC04C07B)
1382#define MCF_INTC1_ICR60 MCF_REG08(0xFC04C07C)
1383#define MCF_INTC1_ICR61 MCF_REG08(0xFC04C07D)
1384#define MCF_INTC1_ICR62 MCF_REG08(0xFC04C07E)
1385#define MCF_INTC1_ICR63 MCF_REG08(0xFC04C07F)
1386#define MCF_INTC1_ICR(x) MCF_REG08(0xFC04C040+((x)*0x001))
1387#define MCF_INTC1_SWIACK MCF_REG08(0xFC04C0E0)
1388#define MCF_INTC1_L1IACK MCF_REG08(0xFC04C0E4)
1389#define MCF_INTC1_L2IACK MCF_REG08(0xFC04C0E8)
1390#define MCF_INTC1_L3IACK MCF_REG08(0xFC04C0EC)
1391#define MCF_INTC1_L4IACK MCF_REG08(0xFC04C0F0)
1392#define MCF_INTC1_L5IACK MCF_REG08(0xFC04C0F4)
1393#define MCF_INTC1_L6IACK MCF_REG08(0xFC04C0F8)
1394#define MCF_INTC1_L7IACK MCF_REG08(0xFC04C0FC)
1395#define MCF_INTC1_LIACK(x) MCF_REG08(0xFC04C0E4+((x)*0x004))
1396#define MCF_INTC_IPRH(x) MCF_REG32(0xFC048000+((x)*0x4000))
1397#define MCF_INTC_IPRL(x) MCF_REG32(0xFC048004+((x)*0x4000))
1398#define MCF_INTC_IMRH(x) MCF_REG32(0xFC048008+((x)*0x4000))
1399#define MCF_INTC_IMRL(x) MCF_REG32(0xFC04800C+((x)*0x4000))
1400#define MCF_INTC_INTFRCH(x) MCF_REG32(0xFC048010+((x)*0x4000))
1401#define MCF_INTC_INTFRCL(x) MCF_REG32(0xFC048014+((x)*0x4000))
1402#define MCF_INTC_ICONFIG(x) MCF_REG16(0xFC04801A+((x)*0x4000))
1403#define MCF_INTC_SIMR(x) MCF_REG08(0xFC04801C+((x)*0x4000))
1404#define MCF_INTC_CIMR(x) MCF_REG08(0xFC04801D+((x)*0x4000))
1405#define MCF_INTC_CLMASK(x) MCF_REG08(0xFC04801E+((x)*0x4000))
1406#define MCF_INTC_SLMASK(x) MCF_REG08(0xFC04801F+((x)*0x4000))
1407#define MCF_INTC_ICR0(x) MCF_REG08(0xFC048040+((x)*0x4000))
1408#define MCF_INTC_ICR1(x) MCF_REG08(0xFC048041+((x)*0x4000))
1409#define MCF_INTC_ICR2(x) MCF_REG08(0xFC048042+((x)*0x4000))
1410#define MCF_INTC_ICR3(x) MCF_REG08(0xFC048043+((x)*0x4000))
1411#define MCF_INTC_ICR4(x) MCF_REG08(0xFC048044+((x)*0x4000))
1412#define MCF_INTC_ICR5(x) MCF_REG08(0xFC048045+((x)*0x4000))
1413#define MCF_INTC_ICR6(x) MCF_REG08(0xFC048046+((x)*0x4000))
1414#define MCF_INTC_ICR7(x) MCF_REG08(0xFC048047+((x)*0x4000))
1415#define MCF_INTC_ICR8(x) MCF_REG08(0xFC048048+((x)*0x4000))
1416#define MCF_INTC_ICR9(x) MCF_REG08(0xFC048049+((x)*0x4000))
1417#define MCF_INTC_ICR10(x) MCF_REG08(0xFC04804A+((x)*0x4000))
1418#define MCF_INTC_ICR11(x) MCF_REG08(0xFC04804B+((x)*0x4000))
1419#define MCF_INTC_ICR12(x) MCF_REG08(0xFC04804C+((x)*0x4000))
1420#define MCF_INTC_ICR13(x) MCF_REG08(0xFC04804D+((x)*0x4000))
1421#define MCF_INTC_ICR14(x) MCF_REG08(0xFC04804E+((x)*0x4000))
1422#define MCF_INTC_ICR15(x) MCF_REG08(0xFC04804F+((x)*0x4000))
1423#define MCF_INTC_ICR16(x) MCF_REG08(0xFC048050+((x)*0x4000))
1424#define MCF_INTC_ICR17(x) MCF_REG08(0xFC048051+((x)*0x4000))
1425#define MCF_INTC_ICR18(x) MCF_REG08(0xFC048052+((x)*0x4000))
1426#define MCF_INTC_ICR19(x) MCF_REG08(0xFC048053+((x)*0x4000))
1427#define MCF_INTC_ICR20(x) MCF_REG08(0xFC048054+((x)*0x4000))
1428#define MCF_INTC_ICR21(x) MCF_REG08(0xFC048055+((x)*0x4000))
1429#define MCF_INTC_ICR22(x) MCF_REG08(0xFC048056+((x)*0x4000))
1430#define MCF_INTC_ICR23(x) MCF_REG08(0xFC048057+((x)*0x4000))
1431#define MCF_INTC_ICR24(x) MCF_REG08(0xFC048058+((x)*0x4000))
1432#define MCF_INTC_ICR25(x) MCF_REG08(0xFC048059+((x)*0x4000))
1433#define MCF_INTC_ICR26(x) MCF_REG08(0xFC04805A+((x)*0x4000))
1434#define MCF_INTC_ICR27(x) MCF_REG08(0xFC04805B+((x)*0x4000))
1435#define MCF_INTC_ICR28(x) MCF_REG08(0xFC04805C+((x)*0x4000))
1436#define MCF_INTC_ICR29(x) MCF_REG08(0xFC04805D+((x)*0x4000))
1437#define MCF_INTC_ICR30(x) MCF_REG08(0xFC04805E+((x)*0x4000))
1438#define MCF_INTC_ICR31(x) MCF_REG08(0xFC04805F+((x)*0x4000))
1439#define MCF_INTC_ICR32(x) MCF_REG08(0xFC048060+((x)*0x4000))
1440#define MCF_INTC_ICR33(x) MCF_REG08(0xFC048061+((x)*0x4000))
1441#define MCF_INTC_ICR34(x) MCF_REG08(0xFC048062+((x)*0x4000))
1442#define MCF_INTC_ICR35(x) MCF_REG08(0xFC048063+((x)*0x4000))
1443#define MCF_INTC_ICR36(x) MCF_REG08(0xFC048064+((x)*0x4000))
1444#define MCF_INTC_ICR37(x) MCF_REG08(0xFC048065+((x)*0x4000))
1445#define MCF_INTC_ICR38(x) MCF_REG08(0xFC048066+((x)*0x4000))
1446#define MCF_INTC_ICR39(x) MCF_REG08(0xFC048067+((x)*0x4000))
1447#define MCF_INTC_ICR40(x) MCF_REG08(0xFC048068+((x)*0x4000))
1448#define MCF_INTC_ICR41(x) MCF_REG08(0xFC048069+((x)*0x4000))
1449#define MCF_INTC_ICR42(x) MCF_REG08(0xFC04806A+((x)*0x4000))
1450#define MCF_INTC_ICR43(x) MCF_REG08(0xFC04806B+((x)*0x4000))
1451#define MCF_INTC_ICR44(x) MCF_REG08(0xFC04806C+((x)*0x4000))
1452#define MCF_INTC_ICR45(x) MCF_REG08(0xFC04806D+((x)*0x4000))
1453#define MCF_INTC_ICR46(x) MCF_REG08(0xFC04806E+((x)*0x4000))
1454#define MCF_INTC_ICR47(x) MCF_REG08(0xFC04806F+((x)*0x4000))
1455#define MCF_INTC_ICR48(x) MCF_REG08(0xFC048070+((x)*0x4000))
1456#define MCF_INTC_ICR49(x) MCF_REG08(0xFC048071+((x)*0x4000))
1457#define MCF_INTC_ICR50(x) MCF_REG08(0xFC048072+((x)*0x4000))
1458#define MCF_INTC_ICR51(x) MCF_REG08(0xFC048073+((x)*0x4000))
1459#define MCF_INTC_ICR52(x) MCF_REG08(0xFC048074+((x)*0x4000))
1460#define MCF_INTC_ICR53(x) MCF_REG08(0xFC048075+((x)*0x4000))
1461#define MCF_INTC_ICR54(x) MCF_REG08(0xFC048076+((x)*0x4000))
1462#define MCF_INTC_ICR55(x) MCF_REG08(0xFC048077+((x)*0x4000))
1463#define MCF_INTC_ICR56(x) MCF_REG08(0xFC048078+((x)*0x4000))
1464#define MCF_INTC_ICR57(x) MCF_REG08(0xFC048079+((x)*0x4000))
1465#define MCF_INTC_ICR58(x) MCF_REG08(0xFC04807A+((x)*0x4000))
1466#define MCF_INTC_ICR59(x) MCF_REG08(0xFC04807B+((x)*0x4000))
1467#define MCF_INTC_ICR60(x) MCF_REG08(0xFC04807C+((x)*0x4000))
1468#define MCF_INTC_ICR61(x) MCF_REG08(0xFC04807D+((x)*0x4000))
1469#define MCF_INTC_ICR62(x) MCF_REG08(0xFC04807E+((x)*0x4000))
1470#define MCF_INTC_ICR63(x) MCF_REG08(0xFC04807F+((x)*0x4000))
1471#define MCF_INTC_SWIACK(x) MCF_REG08(0xFC0480E0+((x)*0x4000))
1472#define MCF_INTC_L1IACK(x) MCF_REG08(0xFC0480E4+((x)*0x4000))
1473#define MCF_INTC_L2IACK(x) MCF_REG08(0xFC0480E8+((x)*0x4000))
1474#define MCF_INTC_L3IACK(x) MCF_REG08(0xFC0480EC+((x)*0x4000))
1475#define MCF_INTC_L4IACK(x) MCF_REG08(0xFC0480F0+((x)*0x4000))
1476#define MCF_INTC_L5IACK(x) MCF_REG08(0xFC0480F4+((x)*0x4000))
1477#define MCF_INTC_L6IACK(x) MCF_REG08(0xFC0480F8+((x)*0x4000))
1478#define MCF_INTC_L7IACK(x) MCF_REG08(0xFC0480FC+((x)*0x4000))
1479
1480/* Bit definitions and macros for MCF_INTC_IPRH */
1481#define MCF_INTC_IPRH_INT32 (0x00000001)
1482#define MCF_INTC_IPRH_INT33 (0x00000002)
1483#define MCF_INTC_IPRH_INT34 (0x00000004)
1484#define MCF_INTC_IPRH_INT35 (0x00000008)
1485#define MCF_INTC_IPRH_INT36 (0x00000010)
1486#define MCF_INTC_IPRH_INT37 (0x00000020)
1487#define MCF_INTC_IPRH_INT38 (0x00000040)
1488#define MCF_INTC_IPRH_INT39 (0x00000080)
1489#define MCF_INTC_IPRH_INT40 (0x00000100)
1490#define MCF_INTC_IPRH_INT41 (0x00000200)
1491#define MCF_INTC_IPRH_INT42 (0x00000400)
1492#define MCF_INTC_IPRH_INT43 (0x00000800)
1493#define MCF_INTC_IPRH_INT44 (0x00001000)
1494#define MCF_INTC_IPRH_INT45 (0x00002000)
1495#define MCF_INTC_IPRH_INT46 (0x00004000)
1496#define MCF_INTC_IPRH_INT47 (0x00008000)
1497#define MCF_INTC_IPRH_INT48 (0x00010000)
1498#define MCF_INTC_IPRH_INT49 (0x00020000)
1499#define MCF_INTC_IPRH_INT50 (0x00040000)
1500#define MCF_INTC_IPRH_INT51 (0x00080000)
1501#define MCF_INTC_IPRH_INT52 (0x00100000)
1502#define MCF_INTC_IPRH_INT53 (0x00200000)
1503#define MCF_INTC_IPRH_INT54 (0x00400000)
1504#define MCF_INTC_IPRH_INT55 (0x00800000)
1505#define MCF_INTC_IPRH_INT56 (0x01000000)
1506#define MCF_INTC_IPRH_INT57 (0x02000000)
1507#define MCF_INTC_IPRH_INT58 (0x04000000)
1508#define MCF_INTC_IPRH_INT59 (0x08000000)
1509#define MCF_INTC_IPRH_INT60 (0x10000000)
1510#define MCF_INTC_IPRH_INT61 (0x20000000)
1511#define MCF_INTC_IPRH_INT62 (0x40000000)
1512#define MCF_INTC_IPRH_INT63 (0x80000000)
1513
1514/* Bit definitions and macros for MCF_INTC_IPRL */
1515#define MCF_INTC_IPRL_INT0 (0x00000001)
1516#define MCF_INTC_IPRL_INT1 (0x00000002)
1517#define MCF_INTC_IPRL_INT2 (0x00000004)
1518#define MCF_INTC_IPRL_INT3 (0x00000008)
1519#define MCF_INTC_IPRL_INT4 (0x00000010)
1520#define MCF_INTC_IPRL_INT5 (0x00000020)
1521#define MCF_INTC_IPRL_INT6 (0x00000040)
1522#define MCF_INTC_IPRL_INT7 (0x00000080)
1523#define MCF_INTC_IPRL_INT8 (0x00000100)
1524#define MCF_INTC_IPRL_INT9 (0x00000200)
1525#define MCF_INTC_IPRL_INT10 (0x00000400)
1526#define MCF_INTC_IPRL_INT11 (0x00000800)
1527#define MCF_INTC_IPRL_INT12 (0x00001000)
1528#define MCF_INTC_IPRL_INT13 (0x00002000)
1529#define MCF_INTC_IPRL_INT14 (0x00004000)
1530#define MCF_INTC_IPRL_INT15 (0x00008000)
1531#define MCF_INTC_IPRL_INT16 (0x00010000)
1532#define MCF_INTC_IPRL_INT17 (0x00020000)
1533#define MCF_INTC_IPRL_INT18 (0x00040000)
1534#define MCF_INTC_IPRL_INT19 (0x00080000)
1535#define MCF_INTC_IPRL_INT20 (0x00100000)
1536#define MCF_INTC_IPRL_INT21 (0x00200000)
1537#define MCF_INTC_IPRL_INT22 (0x00400000)
1538#define MCF_INTC_IPRL_INT23 (0x00800000)
1539#define MCF_INTC_IPRL_INT24 (0x01000000)
1540#define MCF_INTC_IPRL_INT25 (0x02000000)
1541#define MCF_INTC_IPRL_INT26 (0x04000000)
1542#define MCF_INTC_IPRL_INT27 (0x08000000)
1543#define MCF_INTC_IPRL_INT28 (0x10000000)
1544#define MCF_INTC_IPRL_INT29 (0x20000000)
1545#define MCF_INTC_IPRL_INT30 (0x40000000)
1546#define MCF_INTC_IPRL_INT31 (0x80000000)
1547
1548/* Bit definitions and macros for MCF_INTC_IMRH */
1549#define MCF_INTC_IMRH_INT_MASK32 (0x00000001)
1550#define MCF_INTC_IMRH_INT_MASK33 (0x00000002)
1551#define MCF_INTC_IMRH_INT_MASK34 (0x00000004)
1552#define MCF_INTC_IMRH_INT_MASK35 (0x00000008)
1553#define MCF_INTC_IMRH_INT_MASK36 (0x00000010)
1554#define MCF_INTC_IMRH_INT_MASK37 (0x00000020)
1555#define MCF_INTC_IMRH_INT_MASK38 (0x00000040)
1556#define MCF_INTC_IMRH_INT_MASK39 (0x00000080)
1557#define MCF_INTC_IMRH_INT_MASK40 (0x00000100)
1558#define MCF_INTC_IMRH_INT_MASK41 (0x00000200)
1559#define MCF_INTC_IMRH_INT_MASK42 (0x00000400)
1560#define MCF_INTC_IMRH_INT_MASK43 (0x00000800)
1561#define MCF_INTC_IMRH_INT_MASK44 (0x00001000)
1562#define MCF_INTC_IMRH_INT_MASK45 (0x00002000)
1563#define MCF_INTC_IMRH_INT_MASK46 (0x00004000)
1564#define MCF_INTC_IMRH_INT_MASK47 (0x00008000)
1565#define MCF_INTC_IMRH_INT_MASK48 (0x00010000)
1566#define MCF_INTC_IMRH_INT_MASK49 (0x00020000)
1567#define MCF_INTC_IMRH_INT_MASK50 (0x00040000)
1568#define MCF_INTC_IMRH_INT_MASK51 (0x00080000)
1569#define MCF_INTC_IMRH_INT_MASK52 (0x00100000)
1570#define MCF_INTC_IMRH_INT_MASK53 (0x00200000)
1571#define MCF_INTC_IMRH_INT_MASK54 (0x00400000)
1572#define MCF_INTC_IMRH_INT_MASK55 (0x00800000)
1573#define MCF_INTC_IMRH_INT_MASK56 (0x01000000)
1574#define MCF_INTC_IMRH_INT_MASK57 (0x02000000)
1575#define MCF_INTC_IMRH_INT_MASK58 (0x04000000)
1576#define MCF_INTC_IMRH_INT_MASK59 (0x08000000)
1577#define MCF_INTC_IMRH_INT_MASK60 (0x10000000)
1578#define MCF_INTC_IMRH_INT_MASK61 (0x20000000)
1579#define MCF_INTC_IMRH_INT_MASK62 (0x40000000)
1580#define MCF_INTC_IMRH_INT_MASK63 (0x80000000)
1581
1582/* Bit definitions and macros for MCF_INTC_IMRL */
1583#define MCF_INTC_IMRL_INT_MASK0 (0x00000001)
1584#define MCF_INTC_IMRL_INT_MASK1 (0x00000002)
1585#define MCF_INTC_IMRL_INT_MASK2 (0x00000004)
1586#define MCF_INTC_IMRL_INT_MASK3 (0x00000008)
1587#define MCF_INTC_IMRL_INT_MASK4 (0x00000010)
1588#define MCF_INTC_IMRL_INT_MASK5 (0x00000020)
1589#define MCF_INTC_IMRL_INT_MASK6 (0x00000040)
1590#define MCF_INTC_IMRL_INT_MASK7 (0x00000080)
1591#define MCF_INTC_IMRL_INT_MASK8 (0x00000100)
1592#define MCF_INTC_IMRL_INT_MASK9 (0x00000200)
1593#define MCF_INTC_IMRL_INT_MASK10 (0x00000400)
1594#define MCF_INTC_IMRL_INT_MASK11 (0x00000800)
1595#define MCF_INTC_IMRL_INT_MASK12 (0x00001000)
1596#define MCF_INTC_IMRL_INT_MASK13 (0x00002000)
1597#define MCF_INTC_IMRL_INT_MASK14 (0x00004000)
1598#define MCF_INTC_IMRL_INT_MASK15 (0x00008000)
1599#define MCF_INTC_IMRL_INT_MASK16 (0x00010000)
1600#define MCF_INTC_IMRL_INT_MASK17 (0x00020000)
1601#define MCF_INTC_IMRL_INT_MASK18 (0x00040000)
1602#define MCF_INTC_IMRL_INT_MASK19 (0x00080000)
1603#define MCF_INTC_IMRL_INT_MASK20 (0x00100000)
1604#define MCF_INTC_IMRL_INT_MASK21 (0x00200000)
1605#define MCF_INTC_IMRL_INT_MASK22 (0x00400000)
1606#define MCF_INTC_IMRL_INT_MASK23 (0x00800000)
1607#define MCF_INTC_IMRL_INT_MASK24 (0x01000000)
1608#define MCF_INTC_IMRL_INT_MASK25 (0x02000000)
1609#define MCF_INTC_IMRL_INT_MASK26 (0x04000000)
1610#define MCF_INTC_IMRL_INT_MASK27 (0x08000000)
1611#define MCF_INTC_IMRL_INT_MASK28 (0x10000000)
1612#define MCF_INTC_IMRL_INT_MASK29 (0x20000000)
1613#define MCF_INTC_IMRL_INT_MASK30 (0x40000000)
1614#define MCF_INTC_IMRL_INT_MASK31 (0x80000000)
1615
1616/* Bit definitions and macros for MCF_INTC_INTFRCH */
1617#define MCF_INTC_INTFRCH_INTFRC32 (0x00000001)
1618#define MCF_INTC_INTFRCH_INTFRC33 (0x00000002)
1619#define MCF_INTC_INTFRCH_INTFRC34 (0x00000004)
1620#define MCF_INTC_INTFRCH_INTFRC35 (0x00000008)
1621#define MCF_INTC_INTFRCH_INTFRC36 (0x00000010)
1622#define MCF_INTC_INTFRCH_INTFRC37 (0x00000020)
1623#define MCF_INTC_INTFRCH_INTFRC38 (0x00000040)
1624#define MCF_INTC_INTFRCH_INTFRC39 (0x00000080)
1625#define MCF_INTC_INTFRCH_INTFRC40 (0x00000100)
1626#define MCF_INTC_INTFRCH_INTFRC41 (0x00000200)
1627#define MCF_INTC_INTFRCH_INTFRC42 (0x00000400)
1628#define MCF_INTC_INTFRCH_INTFRC43 (0x00000800)
1629#define MCF_INTC_INTFRCH_INTFRC44 (0x00001000)
1630#define MCF_INTC_INTFRCH_INTFRC45 (0x00002000)
1631#define MCF_INTC_INTFRCH_INTFRC46 (0x00004000)
1632#define MCF_INTC_INTFRCH_INTFRC47 (0x00008000)
1633#define MCF_INTC_INTFRCH_INTFRC48 (0x00010000)
1634#define MCF_INTC_INTFRCH_INTFRC49 (0x00020000)
1635#define MCF_INTC_INTFRCH_INTFRC50 (0x00040000)
1636#define MCF_INTC_INTFRCH_INTFRC51 (0x00080000)
1637#define MCF_INTC_INTFRCH_INTFRC52 (0x00100000)
1638#define MCF_INTC_INTFRCH_INTFRC53 (0x00200000)
1639#define MCF_INTC_INTFRCH_INTFRC54 (0x00400000)
1640#define MCF_INTC_INTFRCH_INTFRC55 (0x00800000)
1641#define MCF_INTC_INTFRCH_INTFRC56 (0x01000000)
1642#define MCF_INTC_INTFRCH_INTFRC57 (0x02000000)
1643#define MCF_INTC_INTFRCH_INTFRC58 (0x04000000)
1644#define MCF_INTC_INTFRCH_INTFRC59 (0x08000000)
1645#define MCF_INTC_INTFRCH_INTFRC60 (0x10000000)
1646#define MCF_INTC_INTFRCH_INTFRC61 (0x20000000)
1647#define MCF_INTC_INTFRCH_INTFRC62 (0x40000000)
1648#define MCF_INTC_INTFRCH_INTFRC63 (0x80000000)
1649
1650/* Bit definitions and macros for MCF_INTC_INTFRCL */
1651#define MCF_INTC_INTFRCL_INTFRC0 (0x00000001)
1652#define MCF_INTC_INTFRCL_INTFRC1 (0x00000002)
1653#define MCF_INTC_INTFRCL_INTFRC2 (0x00000004)
1654#define MCF_INTC_INTFRCL_INTFRC3 (0x00000008)
1655#define MCF_INTC_INTFRCL_INTFRC4 (0x00000010)
1656#define MCF_INTC_INTFRCL_INTFRC5 (0x00000020)
1657#define MCF_INTC_INTFRCL_INTFRC6 (0x00000040)
1658#define MCF_INTC_INTFRCL_INTFRC7 (0x00000080)
1659#define MCF_INTC_INTFRCL_INTFRC8 (0x00000100)
1660#define MCF_INTC_INTFRCL_INTFRC9 (0x00000200)
1661#define MCF_INTC_INTFRCL_INTFRC10 (0x00000400)
1662#define MCF_INTC_INTFRCL_INTFRC11 (0x00000800)
1663#define MCF_INTC_INTFRCL_INTFRC12 (0x00001000)
1664#define MCF_INTC_INTFRCL_INTFRC13 (0x00002000)
1665#define MCF_INTC_INTFRCL_INTFRC14 (0x00004000)
1666#define MCF_INTC_INTFRCL_INTFRC15 (0x00008000)
1667#define MCF_INTC_INTFRCL_INTFRC16 (0x00010000)
1668#define MCF_INTC_INTFRCL_INTFRC17 (0x00020000)
1669#define MCF_INTC_INTFRCL_INTFRC18 (0x00040000)
1670#define MCF_INTC_INTFRCL_INTFRC19 (0x00080000)
1671#define MCF_INTC_INTFRCL_INTFRC20 (0x00100000)
1672#define MCF_INTC_INTFRCL_INTFRC21 (0x00200000)
1673#define MCF_INTC_INTFRCL_INTFRC22 (0x00400000)
1674#define MCF_INTC_INTFRCL_INTFRC23 (0x00800000)
1675#define MCF_INTC_INTFRCL_INTFRC24 (0x01000000)
1676#define MCF_INTC_INTFRCL_INTFRC25 (0x02000000)
1677#define MCF_INTC_INTFRCL_INTFRC26 (0x04000000)
1678#define MCF_INTC_INTFRCL_INTFRC27 (0x08000000)
1679#define MCF_INTC_INTFRCL_INTFRC28 (0x10000000)
1680#define MCF_INTC_INTFRCL_INTFRC29 (0x20000000)
1681#define MCF_INTC_INTFRCL_INTFRC30 (0x40000000)
1682#define MCF_INTC_INTFRCL_INTFRC31 (0x80000000)
1683
1684/* Bit definitions and macros for MCF_INTC_ICONFIG */
1685#define MCF_INTC_ICONFIG_EMASK (0x0020)
1686#define MCF_INTC_ICONFIG_ELVLPRI1 (0x0200)
1687#define MCF_INTC_ICONFIG_ELVLPRI2 (0x0400)
1688#define MCF_INTC_ICONFIG_ELVLPRI3 (0x0800)
1689#define MCF_INTC_ICONFIG_ELVLPRI4 (0x1000)
1690#define MCF_INTC_ICONFIG_ELVLPRI5 (0x2000)
1691#define MCF_INTC_ICONFIG_ELVLPRI6 (0x4000)
1692#define MCF_INTC_ICONFIG_ELVLPRI7 (0x8000)
1693
1694/* Bit definitions and macros for MCF_INTC_SIMR */
1695#define MCF_INTC_SIMR_SIMR(x) (((x)&0x7F)<<0)
1696
1697/* Bit definitions and macros for MCF_INTC_CIMR */
1698#define MCF_INTC_CIMR_CIMR(x) (((x)&0x7F)<<0)
1699
1700/* Bit definitions and macros for MCF_INTC_CLMASK */
1701#define MCF_INTC_CLMASK_CLMASK(x) (((x)&0x0F)<<0)
1702
1703/* Bit definitions and macros for MCF_INTC_SLMASK */
1704#define MCF_INTC_SLMASK_SLMASK(x) (((x)&0x0F)<<0)
1705
1706/* Bit definitions and macros for MCF_INTC_ICR */
1707#define MCF_INTC_ICR_IL(x) (((x)&0x07)<<0)
1708
1709/* Bit definitions and macros for MCF_INTC_SWIACK */
1710#define MCF_INTC_SWIACK_VECTOR(x) (((x)&0xFF)<<0)
1711
1712/* Bit definitions and macros for MCF_INTC_LIACK */
1713#define MCF_INTC_LIACK_VECTOR(x) (((x)&0xFF)<<0)
1714
1715/********************************************************************/
1716/*********************************************************************
1717*
1718* LCD Controller (LCDC)
1719*
1720*********************************************************************/
1721
1722/* Register read/write macros */
1723#define MCF_LCDC_LSSAR MCF_REG32(0xFC0AC000)
1724#define MCF_LCDC_LSR MCF_REG32(0xFC0AC004)
1725#define MCF_LCDC_LVPWR MCF_REG32(0xFC0AC008)
1726#define MCF_LCDC_LCPR MCF_REG32(0xFC0AC00C)
1727#define MCF_LCDC_LCWHBR MCF_REG32(0xFC0AC010)
1728#define MCF_LCDC_LCCMR MCF_REG32(0xFC0AC014)
1729#define MCF_LCDC_LPCR MCF_REG32(0xFC0AC018)
1730#define MCF_LCDC_LHCR MCF_REG32(0xFC0AC01C)
1731#define MCF_LCDC_LVCR MCF_REG32(0xFC0AC020)
1732#define MCF_LCDC_LPOR MCF_REG32(0xFC0AC024)
1733#define MCF_LCDC_LSCR MCF_REG32(0xFC0AC028)
1734#define MCF_LCDC_LPCCR MCF_REG32(0xFC0AC02C)
1735#define MCF_LCDC_LDCR MCF_REG32(0xFC0AC030)
1736#define MCF_LCDC_LRMCR MCF_REG32(0xFC0AC034)
1737#define MCF_LCDC_LICR MCF_REG32(0xFC0AC038)
1738#define MCF_LCDC_LIER MCF_REG32(0xFC0AC03C)
1739#define MCF_LCDC_LISR MCF_REG32(0xFC0AC040)
1740#define MCF_LCDC_LGWSAR MCF_REG32(0xFC0AC050)
1741#define MCF_LCDC_LGWSR MCF_REG32(0xFC0AC054)
1742#define MCF_LCDC_LGWVPWR MCF_REG32(0xFC0AC058)
1743#define MCF_LCDC_LGWPOR MCF_REG32(0xFC0AC05C)
1744#define MCF_LCDC_LGWPR MCF_REG32(0xFC0AC060)
1745#define MCF_LCDC_LGWCR MCF_REG32(0xFC0AC064)
1746#define MCF_LCDC_LGWDCR MCF_REG32(0xFC0AC068)
1747#define MCF_LCDC_BPLUT_BASE MCF_REG32(0xFC0AC800)
1748#define MCF_LCDC_GWLUT_BASE MCF_REG32(0xFC0ACC00)
1749
1750/* Bit definitions and macros for MCF_LCDC_LSSAR */
1751#define MCF_LCDC_LSSAR_SSA(x) (((x)&0x3FFFFFFF)<<2)
1752
1753/* Bit definitions and macros for MCF_LCDC_LSR */
1754#define MCF_LCDC_LSR_YMAX(x) (((x)&0x000003FF)<<0)
1755#define MCF_LCDC_LSR_XMAX(x) (((x)&0x0000003F)<<20)
1756
1757/* Bit definitions and macros for MCF_LCDC_LVPWR */
1758#define MCF_LCDC_LVPWR_VPW(x) (((x)&0x000003FF)<<0)
1759
1760/* Bit definitions and macros for MCF_LCDC_LCPR */
1761#define MCF_LCDC_LCPR_CYP(x) (((x)&0x000003FF)<<0)
1762#define MCF_LCDC_LCPR_CXP(x) (((x)&0x000003FF)<<16)
1763#define MCF_LCDC_LCPR_OP (0x10000000)
1764#define MCF_LCDC_LCPR_CC(x) (((x)&0x00000003)<<30)
1765#define MCF_LCDC_LCPR_CC_TRANSPARENT (0x00000000)
1766#define MCF_LCDC_LCPR_CC_OR (0x40000000)
1767#define MCF_LCDC_LCPR_CC_XOR (0x80000000)
1768#define MCF_LCDC_LCPR_CC_AND (0xC0000000)
1769#define MCF_LCDC_LCPR_OP_ON (0x10000000)
1770#define MCF_LCDC_LCPR_OP_OFF (0x00000000)
1771
1772/* Bit definitions and macros for MCF_LCDC_LCWHBR */
1773#define MCF_LCDC_LCWHBR_BD(x) (((x)&0x000000FF)<<0)
1774#define MCF_LCDC_LCWHBR_CH(x) (((x)&0x0000001F)<<16)
1775#define MCF_LCDC_LCWHBR_CW(x) (((x)&0x0000001F)<<24)
1776#define MCF_LCDC_LCWHBR_BK_EN (0x80000000)
1777#define MCF_LCDC_LCWHBR_BK_EN_ON (0x80000000)
1778#define MCF_LCDC_LCWHBR_BK_EN_OFF (0x00000000)
1779
1780/* Bit definitions and macros for MCF_LCDC_LCCMR */
1781#define MCF_LCDC_LCCMR_CUR_COL_B(x) (((x)&0x0000003F)<<0)
1782#define MCF_LCDC_LCCMR_CUR_COL_G(x) (((x)&0x0000003F)<<6)
1783#define MCF_LCDC_LCCMR_CUR_COL_R(x) (((x)&0x0000003F)<<12)
1784
1785/* Bit definitions and macros for MCF_LCDC_LPCR */
1786#define MCF_LCDC_LPCR_PCD(x) (((x)&0x0000003F)<<0)
1787#define MCF_LCDC_LPCR_SHARP (0x00000040)
1788#define MCF_LCDC_LPCR_SCLKSEL (0x00000080)
1789#define MCF_LCDC_LPCR_ACD(x) (((x)&0x0000007F)<<8)
1790#define MCF_LCDC_LPCR_ACDSEL (0x00008000)
1791#define MCF_LCDC_LPCR_REV_VS (0x00010000)
1792#define MCF_LCDC_LPCR_SWAP_SEL (0x00020000)
1793#define MCF_LCDC_LPCR_ENDSEL (0x00040000)
1794#define MCF_LCDC_LPCR_SCLKIDLE (0x00080000)
1795#define MCF_LCDC_LPCR_OEPOL (0x00100000)
1796#define MCF_LCDC_LPCR_CLKPOL (0x00200000)
1797#define MCF_LCDC_LPCR_LPPOL (0x00400000)
1798#define MCF_LCDC_LPCR_FLM (0x00800000)
1799#define MCF_LCDC_LPCR_PIXPOL (0x01000000)
1800#define MCF_LCDC_LPCR_BPIX(x) (((x)&0x00000007)<<25)
1801#define MCF_LCDC_LPCR_PBSIZ(x) (((x)&0x00000003)<<28)
1802#define MCF_LCDC_LPCR_COLOR (0x40000000)
1803#define MCF_LCDC_LPCR_TFT (0x80000000)
1804#define MCF_LCDC_LPCR_MODE_MONOCGROME (0x00000000)
1805#define MCF_LCDC_LPCR_MODE_CSTN (0x40000000)
1806#define MCF_LCDC_LPCR_MODE_TFT (0xC0000000)
1807#define MCF_LCDC_LPCR_PBSIZ_1 (0x00000000)
1808#define MCF_LCDC_LPCR_PBSIZ_2 (0x10000000)
1809#define MCF_LCDC_LPCR_PBSIZ_4 (0x20000000)
1810#define MCF_LCDC_LPCR_PBSIZ_8 (0x30000000)
1811#define MCF_LCDC_LPCR_BPIX_1bpp (0x00000000)
1812#define MCF_LCDC_LPCR_BPIX_2bpp (0x02000000)
1813#define MCF_LCDC_LPCR_BPIX_4bpp (0x04000000)
1814#define MCF_LCDC_LPCR_BPIX_8bpp (0x06000000)
1815#define MCF_LCDC_LPCR_BPIX_12bpp (0x08000000)
1816#define MCF_LCDC_LPCR_BPIX_16bpp (0x0A000000)
1817#define MCF_LCDC_LPCR_BPIX_18bpp (0x0C000000)
1818
1819#define MCF_LCDC_LPCR_PANEL_TYPE(x) (((x)&0x00000003)<<30)
1820
1821/* Bit definitions and macros for MCF_LCDC_LHCR */
1822#define MCF_LCDC_LHCR_H_WAIT_2(x) (((x)&0x000000FF)<<0)
1823#define MCF_LCDC_LHCR_H_WAIT_1(x) (((x)&0x000000FF)<<8)
1824#define MCF_LCDC_LHCR_H_WIDTH(x) (((x)&0x0000003F)<<26)
1825
1826/* Bit definitions and macros for MCF_LCDC_LVCR */
1827#define MCF_LCDC_LVCR_V_WAIT_2(x) (((x)&0x000000FF)<<0)
1828#define MCF_LCDC_LVCR_V_WAIT_1(x) (((x)&0x000000FF)<<8)
1829#define MCF_LCDC_LVCR_V_WIDTH(x) (((x)&0x0000003F)<<26)
1830
1831/* Bit definitions and macros for MCF_LCDC_LPOR */
1832#define MCF_LCDC_LPOR_POS(x) (((x)&0x0000001F)<<0)
1833
1834/* Bit definitions and macros for MCF_LCDC_LPCCR */
1835#define MCF_LCDC_LPCCR_PW(x) (((x)&0x000000FF)<<0)
1836#define MCF_LCDC_LPCCR_CC_EN (0x00000100)
1837#define MCF_LCDC_LPCCR_SCR(x) (((x)&0x00000003)<<9)
1838#define MCF_LCDC_LPCCR_LDMSK (0x00008000)
1839#define MCF_LCDC_LPCCR_CLS_HI_WIDTH(x) (((x)&0x000001FF)<<16)
1840#define MCF_LCDC_LPCCR_SCR_LINEPULSE (0x00000000)
1841#define MCF_LCDC_LPCCR_SCR_PIXELCLK (0x00002000)
1842#define MCF_LCDC_LPCCR_SCR_LCDCLOCK (0x00004000)
1843
1844/* Bit definitions and macros for MCF_LCDC_LDCR */
1845#define MCF_LCDC_LDCR_TM(x) (((x)&0x0000001F)<<0)
1846#define MCF_LCDC_LDCR_HM(x) (((x)&0x0000001F)<<16)
1847#define MCF_LCDC_LDCR_BURST (0x80000000)
1848
1849/* Bit definitions and macros for MCF_LCDC_LRMCR */
1850#define MCF_LCDC_LRMCR_SEL_REF (0x00000001)
1851
1852/* Bit definitions and macros for MCF_LCDC_LICR */
1853#define MCF_LCDC_LICR_INTCON (0x00000001)
1854#define MCF_LCDC_LICR_INTSYN (0x00000004)
1855#define MCF_LCDC_LICR_GW_INT_CON (0x00000010)
1856
1857/* Bit definitions and macros for MCF_LCDC_LIER */
1858#define MCF_LCDC_LIER_BOF_EN (0x00000001)
1859#define MCF_LCDC_LIER_EOF_EN (0x00000002)
1860#define MCF_LCDC_LIER_ERR_RES_EN (0x00000004)
1861#define MCF_LCDC_LIER_UDR_ERR_EN (0x00000008)
1862#define MCF_LCDC_LIER_GW_BOF_EN (0x00000010)
1863#define MCF_LCDC_LIER_GW_EOF_EN (0x00000020)
1864#define MCF_LCDC_LIER_GW_ERR_RES_EN (0x00000040)
1865#define MCF_LCDC_LIER_GW_UDR_ERR_EN (0x00000080)
1866
1867/* Bit definitions and macros for MCF_LCDC_LISR */
1868#define MCF_LCDC_LISR_BOF (0x00000001)
1869#define MCF_LCDC_LISR_EOF (0x00000002)
1870#define MCF_LCDC_LISR_ERR_RES (0x00000004)
1871#define MCF_LCDC_LISR_UDR_ERR (0x00000008)
1872#define MCF_LCDC_LISR_GW_BOF (0x00000010)
1873#define MCF_LCDC_LISR_GW_EOF (0x00000020)
1874#define MCF_LCDC_LISR_GW_ERR_RES (0x00000040)
1875#define MCF_LCDC_LISR_GW_UDR_ERR (0x00000080)
1876
1877/* Bit definitions and macros for MCF_LCDC_LGWSAR */
1878#define MCF_LCDC_LGWSAR_GWSA(x) (((x)&0x3FFFFFFF)<<2)
1879
1880/* Bit definitions and macros for MCF_LCDC_LGWSR */
1881#define MCF_LCDC_LGWSR_GWH(x) (((x)&0x000003FF)<<0)
1882#define MCF_LCDC_LGWSR_GWW(x) (((x)&0x0000003F)<<20)
1883
1884/* Bit definitions and macros for MCF_LCDC_LGWVPWR */
1885#define MCF_LCDC_LGWVPWR_GWVPW(x) (((x)&0x000003FF)<<0)
1886
1887/* Bit definitions and macros for MCF_LCDC_LGWPOR */
1888#define MCF_LCDC_LGWPOR_GWPO(x) (((x)&0x0000001F)<<0)
1889
1890/* Bit definitions and macros for MCF_LCDC_LGWPR */
1891#define MCF_LCDC_LGWPR_GWYP(x) (((x)&0x000003FF)<<0)
1892#define MCF_LCDC_LGWPR_GWXP(x) (((x)&0x000003FF)<<16)
1893
1894/* Bit definitions and macros for MCF_LCDC_LGWCR */
1895#define MCF_LCDC_LGWCR_GWCKB(x) (((x)&0x0000003F)<<0)
1896#define MCF_LCDC_LGWCR_GWCKG(x) (((x)&0x0000003F)<<6)
1897#define MCF_LCDC_LGWCR_GWCKR(x) (((x)&0x0000003F)<<12)
1898#define MCF_LCDC_LGWCR_GW_RVS (0x00200000)
1899#define MCF_LCDC_LGWCR_GWE (0x00400000)
1900#define MCF_LCDC_LGWCR_GWCKE (0x00800000)
1901#define MCF_LCDC_LGWCR_GWAV(x) (((x)&0x000000FF)<<24)
1902
1903/* Bit definitions and macros for MCF_LCDC_LGWDCR */
1904#define MCF_LCDC_LGWDCR_GWTM(x) (((x)&0x0000001F)<<0)
1905#define MCF_LCDC_LGWDCR_GWHM(x) (((x)&0x0000001F)<<16)
1906#define MCF_LCDC_LGWDCR_GWBT (0x80000000)
1907
1908/* Bit definitions and macros for MCF_LCDC_LSCR */
1909#define MCF_LCDC_LSCR_PS_RISE_DELAY(x) (((x)&0x0000003F)<<26)
1910#define MCF_LCDC_LSCR_CLS_RISE_DELAY(x) (((x)&0x000000FF)<<16)
1911#define MCF_LCDC_LSCR_REV_TOGGLE_DELAY(x) (((x)&0x0000000F)<<8)
1912#define MCF_LCDC_LSCR_GRAY_2(x) (((x)&0x0000000F)<<4)
1913#define MCF_LCDC_LSCR_GRAY_1(x) (((x)&0x0000000F)<<0)
1914
1915/* Bit definitions and macros for MCF_LCDC_BPLUT_BASE */
1916#define MCF_LCDC_BPLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1917
1918/* Bit definitions and macros for MCF_LCDC_GWLUT_BASE */
1919#define MCF_LCDC_GWLUT_BASE_BASE(x) (((x)&0xFFFFFFFF)<<0)
1920
1921/********************************************************************* 1103/*********************************************************************
1922 * 1104 *
1923 * Phase Locked Loop (PLL) 1105 * Phase Locked Loop (PLL)
@@ -1925,10 +1107,10 @@
1925 *********************************************************************/ 1107 *********************************************************************/
1926 1108
1927/* Register read/write macros */ 1109/* Register read/write macros */
1928#define MCF_PLL_PODR MCF_REG08(0xFC0C0000) 1110#define MCF_PLL_PODR 0xFC0C0000
1929#define MCF_PLL_PLLCR MCF_REG08(0xFC0C0004) 1111#define MCF_PLL_PLLCR 0xFC0C0004
1930#define MCF_PLL_PMDR MCF_REG08(0xFC0C0008) 1112#define MCF_PLL_PMDR 0xFC0C0008
1931#define MCF_PLL_PFDR MCF_REG08(0xFC0C000C) 1113#define MCF_PLL_PFDR 0xFC0C000C
1932 1114
1933/* Bit definitions and macros for MCF_PLL_PODR */ 1115/* Bit definitions and macros for MCF_PLL_PODR */
1934#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0) 1116#define MCF_PLL_PODR_BUSDIV(x) (((x)&0x0F)<<0)
@@ -1951,15 +1133,15 @@
1951 *********************************************************************/ 1133 *********************************************************************/
1952 1134
1953/* Register read/write macros */ 1135/* Register read/write macros */
1954#define MCF_SCM_MPR MCF_REG32(0xFC000000) 1136#define MCF_SCM_MPR 0xFC000000
1955#define MCF_SCM_PACRA MCF_REG32(0xFC000020) 1137#define MCF_SCM_PACRA 0xFC000020
1956#define MCF_SCM_PACRB MCF_REG32(0xFC000024) 1138#define MCF_SCM_PACRB 0xFC000024
1957#define MCF_SCM_PACRC MCF_REG32(0xFC000028) 1139#define MCF_SCM_PACRC 0xFC000028
1958#define MCF_SCM_PACRD MCF_REG32(0xFC00002C) 1140#define MCF_SCM_PACRD 0xFC00002C
1959#define MCF_SCM_PACRE MCF_REG32(0xFC000040) 1141#define MCF_SCM_PACRE 0xFC000040
1960#define MCF_SCM_PACRF MCF_REG32(0xFC000044) 1142#define MCF_SCM_PACRF 0xFC000044
1961 1143
1962#define MCF_SCM_BCR MCF_REG32(0xFC040024) 1144#define MCF_SCM_BCR 0xFC040024
1963 1145
1964/********************************************************************* 1146/*********************************************************************
1965 * 1147 *
@@ -1968,17 +1150,16 @@
1968 *********************************************************************/ 1150 *********************************************************************/
1969 1151
1970/* Register read/write macros */ 1152/* Register read/write macros */
1971#define MCF_SDRAMC_SDMR MCF_REG32(0xFC0B8000) 1153#define MCF_SDRAMC_SDMR 0xFC0B8000
1972#define MCF_SDRAMC_SDCR MCF_REG32(0xFC0B8004) 1154#define MCF_SDRAMC_SDCR 0xFC0B8004
1973#define MCF_SDRAMC_SDCFG1 MCF_REG32(0xFC0B8008) 1155#define MCF_SDRAMC_SDCFG1 0xFC0B8008
1974#define MCF_SDRAMC_SDCFG2 MCF_REG32(0xFC0B800C) 1156#define MCF_SDRAMC_SDCFG2 0xFC0B800C
1975#define MCF_SDRAMC_LIMP_FIX MCF_REG32(0xFC0B8080) 1157#define MCF_SDRAMC_LIMP_FIX 0xFC0B8080
1976#define MCF_SDRAMC_SDDS MCF_REG32(0xFC0B8100) 1158#define MCF_SDRAMC_SDDS 0xFC0B8100
1977#define MCF_SDRAMC_SDCS0 MCF_REG32(0xFC0B8110) 1159#define MCF_SDRAMC_SDCS0 0xFC0B8110
1978#define MCF_SDRAMC_SDCS1 MCF_REG32(0xFC0B8114) 1160#define MCF_SDRAMC_SDCS1 0xFC0B8114
1979#define MCF_SDRAMC_SDCS2 MCF_REG32(0xFC0B8118) 1161#define MCF_SDRAMC_SDCS2 0xFC0B8118
1980#define MCF_SDRAMC_SDCS3 MCF_REG32(0xFC0B811C) 1162#define MCF_SDRAMC_SDCS3 0xFC0B811C
1981#define MCF_SDRAMC_SDCS(x) MCF_REG32(0xFC0B8110+((x)*0x004))
1982 1163
1983/* Bit definitions and macros for MCF_SDRAMC_SDMR */ 1164/* Bit definitions and macros for MCF_SDRAMC_SDMR */
1984#define MCF_SDRAMC_SDMR_CMD (0x00010000) 1165#define MCF_SDRAMC_SDMR_CMD (0x00010000)
@@ -2046,143 +1227,9 @@
2046#define MCF_SDRAMC_SDCS_CSSZ_2GBYTE (0x0000001E) 1227#define MCF_SDRAMC_SDCS_CSSZ_2GBYTE (0x0000001E)
2047#define MCF_SDRAMC_SDCS_CSSZ_4GBYTE (0x0000001F) 1228#define MCF_SDRAMC_SDCS_CSSZ_4GBYTE (0x0000001F)
2048 1229
2049/*********************************************************************
2050 *
2051 * FlexCAN module registers
2052 *
2053 *********************************************************************/
2054#define MCF_FLEXCAN_BASEADDR(x) (0xFC020000+(x)*0x0800)
2055#define MCF_FLEXCAN_CANMCR(x) MCF_REG32(0xFC020000+(x)*0x0800+0x00)
2056#define MCF_FLEXCAN_CANCTRL(x) MCF_REG32(0xFC020000+(x)*0x0800+0x04)
2057#define MCF_FLEXCAN_TIMER(x) MCF_REG32(0xFC020000+(x)*0x0800+0x08)
2058#define MCF_FLEXCAN_RXGMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x10)
2059#define MCF_FLEXCAN_RX14MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x14)
2060#define MCF_FLEXCAN_RX15MASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x18)
2061#define MCF_FLEXCAN_ERRCNT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x1C)
2062#define MCF_FLEXCAN_ERRSTAT(x) MCF_REG32(0xFC020000+(x)*0x0800+0x20)
2063#define MCF_FLEXCAN_IMASK(x) MCF_REG32(0xFC020000+(x)*0x0800+0x28)
2064#define MCF_FLEXCAN_IFLAG(x) MCF_REG32(0xFC020000+(x)*0x0800+0x30)
2065
2066#define MCF_FLEXCAN_MB_CNT(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x0)
2067#define MCF_FLEXCAN_MB_ID(x,y) MCF_REG32(0xFC020080+(x)*0x0800+(y)*0x10+0x4)
2068#define MCF_FLEXCAN_MB_DB(x,y,z) MCF_REG08(0xFC020080+(x)*0x0800+(y)*0x10+0x8+(z)*0x1)
2069
2070/*
2071 * FlexCAN Module Configuration Register
2072 */
2073#define CANMCR_MDIS (0x80000000)
2074#define CANMCR_FRZ (0x40000000)
2075#define CANMCR_HALT (0x10000000)
2076#define CANMCR_SOFTRST (0x02000000)
2077#define CANMCR_FRZACK (0x01000000)
2078#define CANMCR_SUPV (0x00800000)
2079#define CANMCR_MAXMB(x) ((x)&0x0F)
2080
2081/*
2082 * FlexCAN Control Register
2083 */
2084#define CANCTRL_PRESDIV(x) (((x)&0xFF)<<24)
2085#define CANCTRL_RJW(x) (((x)&0x03)<<22)
2086#define CANCTRL_PSEG1(x) (((x)&0x07)<<19)
2087#define CANCTRL_PSEG2(x) (((x)&0x07)<<16)
2088#define CANCTRL_BOFFMSK (0x00008000)
2089#define CANCTRL_ERRMSK (0x00004000)
2090#define CANCTRL_CLKSRC (0x00002000)
2091#define CANCTRL_LPB (0x00001000)
2092#define CANCTRL_SAMP (0x00000080)
2093#define CANCTRL_BOFFREC (0x00000040)
2094#define CANCTRL_TSYNC (0x00000020)
2095#define CANCTRL_LBUF (0x00000010)
2096#define CANCTRL_LOM (0x00000008)
2097#define CANCTRL_PROPSEG(x) ((x)&0x07)
2098
2099/*
2100 * FlexCAN Error Counter Register
2101 */
2102#define ERRCNT_RXECTR(x) (((x)&0xFF)<<8)
2103#define ERRCNT_TXECTR(x) ((x)&0xFF)
2104
2105/*
2106 * FlexCAN Error and Status Register
2107 */
2108#define ERRSTAT_BITERR(x) (((x)&0x03)<<14)
2109#define ERRSTAT_ACKERR (0x00002000)
2110#define ERRSTAT_CRCERR (0x00001000)
2111#define ERRSTAT_FRMERR (0x00000800)
2112#define ERRSTAT_STFERR (0x00000400)
2113#define ERRSTAT_TXWRN (0x00000200)
2114#define ERRSTAT_RXWRN (0x00000100)
2115#define ERRSTAT_IDLE (0x00000080)
2116#define ERRSTAT_TXRX (0x00000040)
2117#define ERRSTAT_FLTCONF(x) (((x)&0x03)<<4)
2118#define ERRSTAT_BOFFINT (0x00000004)
2119#define ERRSTAT_ERRINT (0x00000002)
2120
2121/* 1230/*
2122 * Interrupt Mask Register
2123 */
2124#define IMASK_BUF15M (0x8000)
2125#define IMASK_BUF14M (0x4000)
2126#define IMASK_BUF13M (0x2000)
2127#define IMASK_BUF12M (0x1000)
2128#define IMASK_BUF11M (0x0800)
2129#define IMASK_BUF10M (0x0400)
2130#define IMASK_BUF9M (0x0200)
2131#define IMASK_BUF8M (0x0100)
2132#define IMASK_BUF7M (0x0080)
2133#define IMASK_BUF6M (0x0040)
2134#define IMASK_BUF5M (0x0020)
2135#define IMASK_BUF4M (0x0010)
2136#define IMASK_BUF3M (0x0008)
2137#define IMASK_BUF2M (0x0004)
2138#define IMASK_BUF1M (0x0002)
2139#define IMASK_BUF0M (0x0001)
2140#define IMASK_BUFnM(x) (0x1<<(x))
2141#define IMASK_BUFF_ENABLE_ALL (0x1111)
2142#define IMASK_BUFF_DISABLE_ALL (0x0000)
2143
2144/*
2145 * Interrupt Flag Register
2146 */
2147#define IFLAG_BUF15M (0x8000)
2148#define IFLAG_BUF14M (0x4000)
2149#define IFLAG_BUF13M (0x2000)
2150#define IFLAG_BUF12M (0x1000)
2151#define IFLAG_BUF11M (0x0800)
2152#define IFLAG_BUF10M (0x0400)
2153#define IFLAG_BUF9M (0x0200)
2154#define IFLAG_BUF8M (0x0100)
2155#define IFLAG_BUF7M (0x0080)
2156#define IFLAG_BUF6M (0x0040)
2157#define IFLAG_BUF5M (0x0020)
2158#define IFLAG_BUF4M (0x0010)
2159#define IFLAG_BUF3M (0x0008)
2160#define IFLAG_BUF2M (0x0004)
2161#define IFLAG_BUF1M (0x0002)
2162#define IFLAG_BUF0M (0x0001)
2163#define IFLAG_BUFF_SET_ALL (0xFFFF)
2164#define IFLAG_BUFF_CLEAR_ALL (0x0000)
2165#define IFLAG_BUFnM(x) (0x1<<(x))
2166
2167/*
2168 * Message Buffers
2169 */
2170#define MB_CNT_CODE(x) (((x)&0x0F)<<24)
2171#define MB_CNT_SRR (0x00400000)
2172#define MB_CNT_IDE (0x00200000)
2173#define MB_CNT_RTR (0x00100000)
2174#define MB_CNT_LENGTH(x) (((x)&0x0F)<<16)
2175#define MB_CNT_TIMESTAMP(x) ((x)&0xFFFF)
2176#define MB_ID_STD(x) (((x)&0x07FF)<<18)
2177#define MB_ID_EXT(x) ((x)&0x3FFFF)
2178
2179/*********************************************************************
2180 *
2181 * Edge Port Module (EPORT) 1231 * Edge Port Module (EPORT)
2182 * 1232 */
2183 *********************************************************************/
2184
2185/* Register read/write macros */
2186#define MCFEPORT_EPPAR (0xFC094000) 1233#define MCFEPORT_EPPAR (0xFC094000)
2187#define MCFEPORT_EPDDR (0xFC094002) 1234#define MCFEPORT_EPDDR (0xFC094002)
2188#define MCFEPORT_EPIER (0xFC094003) 1235#define MCFEPORT_EPIER (0xFC094003)
@@ -2190,91 +1237,5 @@
2190#define MCFEPORT_EPPDR (0xFC094005) 1237#define MCFEPORT_EPPDR (0xFC094005)
2191#define MCFEPORT_EPFR (0xFC094006) 1238#define MCFEPORT_EPFR (0xFC094006)
2192 1239
2193/* Bit definitions and macros for MCF_EPORT_EPPAR */
2194#define MCF_EPORT_EPPAR_EPPA1(x) (((x)&0x0003)<<2)
2195#define MCF_EPORT_EPPAR_EPPA2(x) (((x)&0x0003)<<4)
2196#define MCF_EPORT_EPPAR_EPPA3(x) (((x)&0x0003)<<6)
2197#define MCF_EPORT_EPPAR_EPPA4(x) (((x)&0x0003)<<8)
2198#define MCF_EPORT_EPPAR_EPPA5(x) (((x)&0x0003)<<10)
2199#define MCF_EPORT_EPPAR_EPPA6(x) (((x)&0x0003)<<12)
2200#define MCF_EPORT_EPPAR_EPPA7(x) (((x)&0x0003)<<14)
2201#define MCF_EPORT_EPPAR_LEVEL (0)
2202#define MCF_EPORT_EPPAR_RISING (1)
2203#define MCF_EPORT_EPPAR_FALLING (2)
2204#define MCF_EPORT_EPPAR_BOTH (3)
2205#define MCF_EPORT_EPPAR_EPPA7_LEVEL (0x0000)
2206#define MCF_EPORT_EPPAR_EPPA7_RISING (0x4000)
2207#define MCF_EPORT_EPPAR_EPPA7_FALLING (0x8000)
2208#define MCF_EPORT_EPPAR_EPPA7_BOTH (0xC000)
2209#define MCF_EPORT_EPPAR_EPPA6_LEVEL (0x0000)
2210#define MCF_EPORT_EPPAR_EPPA6_RISING (0x1000)
2211#define MCF_EPORT_EPPAR_EPPA6_FALLING (0x2000)
2212#define MCF_EPORT_EPPAR_EPPA6_BOTH (0x3000)
2213#define MCF_EPORT_EPPAR_EPPA5_LEVEL (0x0000)
2214#define MCF_EPORT_EPPAR_EPPA5_RISING (0x0400)
2215#define MCF_EPORT_EPPAR_EPPA5_FALLING (0x0800)
2216#define MCF_EPORT_EPPAR_EPPA5_BOTH (0x0C00)
2217#define MCF_EPORT_EPPAR_EPPA4_LEVEL (0x0000)
2218#define MCF_EPORT_EPPAR_EPPA4_RISING (0x0100)
2219#define MCF_EPORT_EPPAR_EPPA4_FALLING (0x0200)
2220#define MCF_EPORT_EPPAR_EPPA4_BOTH (0x0300)
2221#define MCF_EPORT_EPPAR_EPPA3_LEVEL (0x0000)
2222#define MCF_EPORT_EPPAR_EPPA3_RISING (0x0040)
2223#define MCF_EPORT_EPPAR_EPPA3_FALLING (0x0080)
2224#define MCF_EPORT_EPPAR_EPPA3_BOTH (0x00C0)
2225#define MCF_EPORT_EPPAR_EPPA2_LEVEL (0x0000)
2226#define MCF_EPORT_EPPAR_EPPA2_RISING (0x0010)
2227#define MCF_EPORT_EPPAR_EPPA2_FALLING (0x0020)
2228#define MCF_EPORT_EPPAR_EPPA2_BOTH (0x0030)
2229#define MCF_EPORT_EPPAR_EPPA1_LEVEL (0x0000)
2230#define MCF_EPORT_EPPAR_EPPA1_RISING (0x0004)
2231#define MCF_EPORT_EPPAR_EPPA1_FALLING (0x0008)
2232#define MCF_EPORT_EPPAR_EPPA1_BOTH (0x000C)
2233
2234/* Bit definitions and macros for MCF_EPORT_EPDDR */
2235#define MCF_EPORT_EPDDR_EPDD1 (0x02)
2236#define MCF_EPORT_EPDDR_EPDD2 (0x04)
2237#define MCF_EPORT_EPDDR_EPDD3 (0x08)
2238#define MCF_EPORT_EPDDR_EPDD4 (0x10)
2239#define MCF_EPORT_EPDDR_EPDD5 (0x20)
2240#define MCF_EPORT_EPDDR_EPDD6 (0x40)
2241#define MCF_EPORT_EPDDR_EPDD7 (0x80)
2242
2243/* Bit definitions and macros for MCF_EPORT_EPIER */
2244#define MCF_EPORT_EPIER_EPIE1 (0x02)
2245#define MCF_EPORT_EPIER_EPIE2 (0x04)
2246#define MCF_EPORT_EPIER_EPIE3 (0x08)
2247#define MCF_EPORT_EPIER_EPIE4 (0x10)
2248#define MCF_EPORT_EPIER_EPIE5 (0x20)
2249#define MCF_EPORT_EPIER_EPIE6 (0x40)
2250#define MCF_EPORT_EPIER_EPIE7 (0x80)
2251
2252/* Bit definitions and macros for MCF_EPORT_EPDR */
2253#define MCF_EPORT_EPDR_EPD1 (0x02)
2254#define MCF_EPORT_EPDR_EPD2 (0x04)
2255#define MCF_EPORT_EPDR_EPD3 (0x08)
2256#define MCF_EPORT_EPDR_EPD4 (0x10)
2257#define MCF_EPORT_EPDR_EPD5 (0x20)
2258#define MCF_EPORT_EPDR_EPD6 (0x40)
2259#define MCF_EPORT_EPDR_EPD7 (0x80)
2260
2261/* Bit definitions and macros for MCF_EPORT_EPPDR */
2262#define MCF_EPORT_EPPDR_EPPD1 (0x02)
2263#define MCF_EPORT_EPPDR_EPPD2 (0x04)
2264#define MCF_EPORT_EPPDR_EPPD3 (0x08)
2265#define MCF_EPORT_EPPDR_EPPD4 (0x10)
2266#define MCF_EPORT_EPPDR_EPPD5 (0x20)
2267#define MCF_EPORT_EPPDR_EPPD6 (0x40)
2268#define MCF_EPORT_EPPDR_EPPD7 (0x80)
2269
2270/* Bit definitions and macros for MCF_EPORT_EPFR */
2271#define MCF_EPORT_EPFR_EPF1 (0x02)
2272#define MCF_EPORT_EPFR_EPF2 (0x04)
2273#define MCF_EPORT_EPFR_EPF3 (0x08)
2274#define MCF_EPORT_EPFR_EPF4 (0x10)
2275#define MCF_EPORT_EPFR_EPF5 (0x20)
2276#define MCF_EPORT_EPFR_EPF6 (0x40)
2277#define MCF_EPORT_EPFR_EPF7 (0x80)
2278
2279/********************************************************************/ 1240/********************************************************************/
2280#endif /* m532xsim_h */ 1241#endif /* m532xsim_h */
diff --git a/arch/m68k/include/asm/m5407sim.h b/arch/m68k/include/asm/m5407sim.h
index 79f58dd6a83d..a7550bc5cd1e 100644
--- a/arch/m68k/include/asm/m5407sim.h
+++ b/arch/m68k/include/asm/m5407sim.h
@@ -23,55 +23,55 @@
23/* 23/*
24 * Define the 5407 SIM register set addresses. 24 * Define the 5407 SIM register set addresses.
25 */ 25 */
26#define MCFSIM_RSR 0x00 /* Reset Status reg (r/w) */ 26#define MCFSIM_RSR (MCF_MBAR + 0x00) /* Reset Status */
27#define MCFSIM_SYPCR 0x01 /* System Protection reg (r/w)*/ 27#define MCFSIM_SYPCR (MCF_MBAR + 0x01) /* System Protection */
28#define MCFSIM_SWIVR 0x02 /* SW Watchdog intr reg (r/w) */ 28#define MCFSIM_SWIVR (MCF_MBAR + 0x02) /* SW Watchdog intr */
29#define MCFSIM_SWSR 0x03 /* SW Watchdog service (r/w) */ 29#define MCFSIM_SWSR (MCF_MBAR + 0x03) /* SW Watchdog service*/
30#define MCFSIM_PAR 0x04 /* Pin Assignment reg (r/w) */ 30#define MCFSIM_PAR (MCF_MBAR + 0x04) /* Pin Assignment */
31#define MCFSIM_IRQPAR 0x06 /* Interrupt Assignment reg (r/w) */ 31#define MCFSIM_IRQPAR (MCF_MBAR + 0x06) /* Intr Assignment */
32#define MCFSIM_PLLCR 0x08 /* PLL Control Reg*/ 32#define MCFSIM_PLLCR (MCF_MBAR + 0x08) /* PLL Ctrl */
33#define MCFSIM_MPARK 0x0C /* BUS Master Control Reg*/ 33#define MCFSIM_MPARK (MCF_MBAR + 0x0C) /* BUS Master Ctrl */
34#define MCFSIM_IPR 0x40 /* Interrupt Pend reg (r/w) */ 34#define MCFSIM_IPR (MCF_MBAR + 0x40) /* Interrupt Pending */
35#define MCFSIM_IMR 0x44 /* Interrupt Mask reg (r/w) */ 35#define MCFSIM_IMR (MCF_MBAR + 0x44) /* Interrupt Mask */
36#define MCFSIM_AVR 0x4b /* Autovector Ctrl reg (r/w) */ 36#define MCFSIM_AVR (MCF_MBAR + 0x4b) /* Autovector Ctrl */
37#define MCFSIM_ICR0 0x4c /* Intr Ctrl reg 0 (r/w) */ 37#define MCFSIM_ICR0 (MCF_MBAR + 0x4c) /* Intr Ctrl reg 0 */
38#define MCFSIM_ICR1 0x4d /* Intr Ctrl reg 1 (r/w) */ 38#define MCFSIM_ICR1 (MCF_MBAR + 0x4d) /* Intr Ctrl reg 1 */
39#define MCFSIM_ICR2 0x4e /* Intr Ctrl reg 2 (r/w) */ 39#define MCFSIM_ICR2 (MCF_MBAR + 0x4e) /* Intr Ctrl reg 2 */
40#define MCFSIM_ICR3 0x4f /* Intr Ctrl reg 3 (r/w) */ 40#define MCFSIM_ICR3 (MCF_MBAR + 0x4f) /* Intr Ctrl reg 3 */
41#define MCFSIM_ICR4 0x50 /* Intr Ctrl reg 4 (r/w) */ 41#define MCFSIM_ICR4 (MCF_MBAR + 0x50) /* Intr Ctrl reg 4 */
42#define MCFSIM_ICR5 0x51 /* Intr Ctrl reg 5 (r/w) */ 42#define MCFSIM_ICR5 (MCF_MBAR + 0x51) /* Intr Ctrl reg 5 */
43#define MCFSIM_ICR6 0x52 /* Intr Ctrl reg 6 (r/w) */ 43#define MCFSIM_ICR6 (MCF_MBAR + 0x52) /* Intr Ctrl reg 6 */
44#define MCFSIM_ICR7 0x53 /* Intr Ctrl reg 7 (r/w) */ 44#define MCFSIM_ICR7 (MCF_MBAR + 0x53) /* Intr Ctrl reg 7 */
45#define MCFSIM_ICR8 0x54 /* Intr Ctrl reg 8 (r/w) */ 45#define MCFSIM_ICR8 (MCF_MBAR + 0x54) /* Intr Ctrl reg 8 */
46#define MCFSIM_ICR9 0x55 /* Intr Ctrl reg 9 (r/w) */ 46#define MCFSIM_ICR9 (MCF_MBAR + 0x55) /* Intr Ctrl reg 9 */
47#define MCFSIM_ICR10 0x56 /* Intr Ctrl reg 10 (r/w) */ 47#define MCFSIM_ICR10 (MCF_MBAR + 0x56) /* Intr Ctrl reg 10 */
48#define MCFSIM_ICR11 0x57 /* Intr Ctrl reg 11 (r/w) */ 48#define MCFSIM_ICR11 (MCF_MBAR + 0x57) /* Intr Ctrl reg 11 */
49 49
50#define MCFSIM_CSAR0 0x80 /* CS 0 Address 0 reg (r/w) */ 50#define MCFSIM_CSAR0 (MCF_MBAR + 0x80) /* CS 0 Address reg */
51#define MCFSIM_CSMR0 0x84 /* CS 0 Mask 0 reg (r/w) */ 51#define MCFSIM_CSMR0 (MCF_MBAR + 0x84) /* CS 0 Mask reg */
52#define MCFSIM_CSCR0 0x8a /* CS 0 Control reg (r/w) */ 52#define MCFSIM_CSCR0 (MCF_MBAR + 0x8a) /* CS 0 Control reg */
53#define MCFSIM_CSAR1 0x8c /* CS 1 Address reg (r/w) */ 53#define MCFSIM_CSAR1 (MCF_MBAR + 0x8c) /* CS 1 Address reg */
54#define MCFSIM_CSMR1 0x90 /* CS 1 Mask reg (r/w) */ 54#define MCFSIM_CSMR1 (MCF_MBAR + 0x90) /* CS 1 Mask reg */
55#define MCFSIM_CSCR1 0x96 /* CS 1 Control reg (r/w) */ 55#define MCFSIM_CSCR1 (MCF_MBAR + 0x96) /* CS 1 Control reg */
56 56
57#define MCFSIM_CSAR2 0x98 /* CS 2 Address reg (r/w) */ 57#define MCFSIM_CSAR2 (MCF_MBAR + 0x98) /* CS 2 Address reg */
58#define MCFSIM_CSMR2 0x9c /* CS 2 Mask reg (r/w) */ 58#define MCFSIM_CSMR2 (MCF_MBAR + 0x9c) /* CS 2 Mask reg */
59#define MCFSIM_CSCR2 0xa2 /* CS 2 Control reg (r/w) */ 59#define MCFSIM_CSCR2 (MCF_MBAR + 0xa2) /* CS 2 Control reg */
60#define MCFSIM_CSAR3 0xa4 /* CS 3 Address reg (r/w) */ 60#define MCFSIM_CSAR3 (MCF_MBAR + 0xa4) /* CS 3 Address reg */
61#define MCFSIM_CSMR3 0xa8 /* CS 3 Mask reg (r/w) */ 61#define MCFSIM_CSMR3 (MCF_MBAR + 0xa8) /* CS 3 Mask reg */
62#define MCFSIM_CSCR3 0xae /* CS 3 Control reg (r/w) */ 62#define MCFSIM_CSCR3 (MCF_MBAR + 0xae) /* CS 3 Control reg */
63#define MCFSIM_CSAR4 0xb0 /* CS 4 Address reg (r/w) */ 63#define MCFSIM_CSAR4 (MCF_MBAR + 0xb0) /* CS 4 Address reg */
64#define MCFSIM_CSMR4 0xb4 /* CS 4 Mask reg (r/w) */ 64#define MCFSIM_CSMR4 (MCF_MBAR + 0xb4) /* CS 4 Mask reg */
65#define MCFSIM_CSCR4 0xba /* CS 4 Control reg (r/w) */ 65#define MCFSIM_CSCR4 (MCF_MBAR + 0xba) /* CS 4 Control reg */
66#define MCFSIM_CSAR5 0xbc /* CS 5 Address reg (r/w) */ 66#define MCFSIM_CSAR5 (MCF_MBAR + 0xbc) /* CS 5 Address reg */
67#define MCFSIM_CSMR5 0xc0 /* CS 5 Mask reg (r/w) */ 67#define MCFSIM_CSMR5 (MCF_MBAR + 0xc0) /* CS 5 Mask reg */
68#define MCFSIM_CSCR5 0xc6 /* CS 5 Control reg (r/w) */ 68#define MCFSIM_CSCR5 (MCF_MBAR + 0xc6) /* CS 5 Control reg */
69#define MCFSIM_CSAR6 0xc8 /* CS 6 Address reg (r/w) */ 69#define MCFSIM_CSAR6 (MCF_MBAR + 0xc8) /* CS 6 Address reg */
70#define MCFSIM_CSMR6 0xcc /* CS 6 Mask reg (r/w) */ 70#define MCFSIM_CSMR6 (MCF_MBAR + 0xcc) /* CS 6 Mask reg */
71#define MCFSIM_CSCR6 0xd2 /* CS 6 Control reg (r/w) */ 71#define MCFSIM_CSCR6 (MCF_MBAR + 0xd2) /* CS 6 Control reg */
72#define MCFSIM_CSAR7 0xd4 /* CS 7 Address reg (r/w) */ 72#define MCFSIM_CSAR7 (MCF_MBAR + 0xd4) /* CS 7 Address reg */
73#define MCFSIM_CSMR7 0xd8 /* CS 7 Mask reg (r/w) */ 73#define MCFSIM_CSMR7 (MCF_MBAR + 0xd8) /* CS 7 Mask reg */
74#define MCFSIM_CSCR7 0xde /* CS 7 Control reg (r/w) */ 74#define MCFSIM_CSCR7 (MCF_MBAR + 0xde) /* CS 7 Control reg */
75 75
76#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */ 76#define MCFSIM_DCR (MCF_MBAR + 0x100) /* DRAM Control */
77#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */ 77#define MCFSIM_DACR0 (MCF_MBAR + 0x108) /* DRAM 0 Addr/Ctrl */
@@ -102,9 +102,9 @@
102/* 102/*
103 * Generic GPIO support 103 * Generic GPIO support
104 */ 104 */
105#define MCFGPIO_PIN_MAX 16 105#define MCFGPIO_PIN_MAX 16
106#define MCFGPIO_IRQ_MAX -1 106#define MCFGPIO_IRQ_MAX -1
107#define MCFGPIO_IRQ_VECBASE -1 107#define MCFGPIO_IRQ_VECBASE -1
108 108
109/* 109/*
110 * Some symbol defines for the above... 110 * Some symbol defines for the above...
@@ -130,9 +130,9 @@
130/* 130/*
131 * Defines for the IRQPAR Register 131 * Defines for the IRQPAR Register
132 */ 132 */
133#define IRQ5_LEVEL4 0x80 133#define IRQ5_LEVEL4 0x80
134#define IRQ3_LEVEL6 0x40 134#define IRQ3_LEVEL6 0x40
135#define IRQ1_LEVEL2 0x20 135#define IRQ1_LEVEL2 0x20
136 136
137/* 137/*
138 * Define system peripheral IRQ usage. 138 * Define system peripheral IRQ usage.
diff --git a/arch/m68k/include/asm/m54xxgpt.h b/arch/m68k/include/asm/m54xxgpt.h
index df75dd87ae7a..0b69cd1ed0ed 100644
--- a/arch/m68k/include/asm/m54xxgpt.h
+++ b/arch/m68k/include/asm/m54xxgpt.h
@@ -16,26 +16,26 @@
16*********************************************************************/ 16*********************************************************************/
17 17
18/* Register read/write macros */ 18/* Register read/write macros */
19#define MCF_GPT_GMS0 0x000800 19#define MCF_GPT_GMS0 (MCF_MBAR + 0x000800)
20#define MCF_GPT_GCIR0 0x000804 20#define MCF_GPT_GCIR0 (MCF_MBAR + 0x000804)
21#define MCF_GPT_GPWM0 0x000808 21#define MCF_GPT_GPWM0 (MCF_MBAR + 0x000808)
22#define MCF_GPT_GSR0 0x00080C 22#define MCF_GPT_GSR0 (MCF_MBAR + 0x00080C)
23#define MCF_GPT_GMS1 0x000810 23#define MCF_GPT_GMS1 (MCF_MBAR + 0x000810)
24#define MCF_GPT_GCIR1 0x000814 24#define MCF_GPT_GCIR1 (MCF_MBAR + 0x000814)
25#define MCF_GPT_GPWM1 0x000818 25#define MCF_GPT_GPWM1 (MCF_MBAR + 0x000818)
26#define MCF_GPT_GSR1 0x00081C 26#define MCF_GPT_GSR1 (MCF_MBAR + 0x00081C)
27#define MCF_GPT_GMS2 0x000820 27#define MCF_GPT_GMS2 (MCF_MBAR + 0x000820)
28#define MCF_GPT_GCIR2 0x000824 28#define MCF_GPT_GCIR2 (MCF_MBAR + 0x000824)
29#define MCF_GPT_GPWM2 0x000828 29#define MCF_GPT_GPWM2 (MCF_MBAR + 0x000828)
30#define MCF_GPT_GSR2 0x00082C 30#define MCF_GPT_GSR2 (MCF_MBAR + 0x00082C)
31#define MCF_GPT_GMS3 0x000830 31#define MCF_GPT_GMS3 (MCF_MBAR + 0x000830)
32#define MCF_GPT_GCIR3 0x000834 32#define MCF_GPT_GCIR3 (MCF_MBAR + 0x000834)
33#define MCF_GPT_GPWM3 0x000838 33#define MCF_GPT_GPWM3 (MCF_MBAR + 0x000838)
34#define MCF_GPT_GSR3 0x00083C 34#define MCF_GPT_GSR3 (MCF_MBAR + 0x00083C)
35#define MCF_GPT_GMS(x) (0x000800+((x)*0x010)) 35#define MCF_GPT_GMS(x) (MCF_MBAR + 0x000800 + ((x) * 0x010))
36#define MCF_GPT_GCIR(x) (0x000804+((x)*0x010)) 36#define MCF_GPT_GCIR(x) (MCF_MBAR + 0x000804 + ((x) * 0x010))
37#define MCF_GPT_GPWM(x) (0x000808+((x)*0x010)) 37#define MCF_GPT_GPWM(x) (MCF_MBAR + 0x000808 + ((x) * 0x010))
38#define MCF_GPT_GSR(x) (0x00080C+((x)*0x010)) 38#define MCF_GPT_GSR(x) (MCF_MBAR + 0x00080C + ((x) * 0x010))
39 39
40/* Bit definitions and macros for MCF_GPT_GMS */ 40/* Bit definitions and macros for MCF_GPT_GMS */
41#define MCF_GPT_GMS_TMS(x) (((x)&0x00000007)<<0) 41#define MCF_GPT_GMS_TMS(x) (((x)&0x00000007)<<0)
diff --git a/arch/m68k/include/asm/m54xxsim.h b/arch/m68k/include/asm/m54xxsim.h
index d3c5e0dbdadf..d3bd83887429 100644
--- a/arch/m68k/include/asm/m54xxsim.h
+++ b/arch/m68k/include/asm/m54xxsim.h
@@ -47,6 +47,12 @@
47#define MCF_IRQ_UART3 (MCFINT_VECBASE + 32) 47#define MCF_IRQ_UART3 (MCFINT_VECBASE + 32)
48 48
49/* 49/*
50 * Slice Timer support.
51 */
52#define MCFSLT_TIMER0 (MCF_MBAR + 0x900) /* Base addr TIMER0 */
53#define MCFSLT_TIMER1 (MCF_MBAR + 0x910) /* Base addr TIMER1 */
54
55/*
50 * Generic GPIO support 56 * Generic GPIO support
51 */ 57 */
52#define MCFGPIO_PIN_MAX 0 /* I am too lazy to count */ 58#define MCFGPIO_PIN_MAX 0 /* I am too lazy to count */
@@ -64,15 +70,25 @@
64#define MCFEPORT_EPFR (MCF_MBAR + 0xf0c) /* Flags */ 70#define MCFEPORT_EPFR (MCF_MBAR + 0xf0c) /* Flags */
65 71
66/* 72/*
67 * Some PSC related definitions 73 * Pin Assignment register definitions
68 */ 74 */
69#define MCF_PAR_PSC(x) (0x000A4F-((x)&0x3)) 75#define MCFGPIO_PAR_FBCTL (MCF_MBAR + 0xA40)
76#define MCFGPIO_PAR_FBCS (MCF_MBAR + 0xA42)
77#define MCFGPIO_PAR_DMA (MCF_MBAR + 0xA43)
78#define MCFGPIO_PAR_FECI2CIRQ (MCF_MBAR + 0xA44)
79#define MCFGPIO_PAR_PCIBG (MCF_MBAR + 0xA48) /* PCI bus grant */
80#define MCFGPIO_PAR_PCIBR (MCF_MBAR + 0xA4A) /* PCI */
81#define MCFGPIO_PAR_PSC0 (MCF_MBAR + 0xA4F)
82#define MCFGPIO_PAR_PSC1 (MCF_MBAR + 0xA4E)
83#define MCFGPIO_PAR_PSC2 (MCF_MBAR + 0xA4D)
84#define MCFGPIO_PAR_PSC3 (MCF_MBAR + 0xA4C)
85#define MCFGPIO_PAR_DSPI (MCF_MBAR + 0xA50)
86#define MCFGPIO_PAR_TIMER (MCF_MBAR + 0xA52)
87
70#define MCF_PAR_SDA (0x0008) 88#define MCF_PAR_SDA (0x0008)
71#define MCF_PAR_SCL (0x0004) 89#define MCF_PAR_SCL (0x0004)
72#define MCF_PAR_PSC_TXD (0x04) 90#define MCF_PAR_PSC_TXD (0x04)
73#define MCF_PAR_PSC_RXD (0x08) 91#define MCF_PAR_PSC_RXD (0x08)
74#define MCF_PAR_PSC_RTS(x) (((x)&0x03)<<4)
75#define MCF_PAR_PSC_CTS(x) (((x)&0x03)<<6)
76#define MCF_PAR_PSC_CTS_GPIO (0x00) 92#define MCF_PAR_PSC_CTS_GPIO (0x00)
77#define MCF_PAR_PSC_CTS_BCLK (0x80) 93#define MCF_PAR_PSC_CTS_BCLK (0x80)
78#define MCF_PAR_PSC_CTS_CTS (0xC0) 94#define MCF_PAR_PSC_CTS_CTS (0xC0)
@@ -81,7 +97,4 @@
81#define MCF_PAR_PSC_RTS_RTS (0x30) 97#define MCF_PAR_PSC_RTS_RTS (0x30)
82#define MCF_PAR_PSC_CANRX (0x40) 98#define MCF_PAR_PSC_CANRX (0x40)
83 99
84#define MCF_PAR_PCIBG (CONFIG_MBAR + 0xa48) /* PCI bus grant */
85#define MCF_PAR_PCIBR (CONFIG_MBAR + 0xa4a) /* PCI */
86
87#endif /* m54xxsim_h */ 100#endif /* m54xxsim_h */
diff --git a/arch/m68k/include/asm/mcfslt.h b/arch/m68k/include/asm/mcfslt.h
index d0d0ecba5333..c2314b6f8caa 100644
--- a/arch/m68k/include/asm/mcfslt.h
+++ b/arch/m68k/include/asm/mcfslt.h
@@ -13,13 +13,6 @@
13/****************************************************************************/ 13/****************************************************************************/
14 14
15/* 15/*
16 * Get address specific defines for the 547x.
17 */
18#define MCFSLT_TIMER0 0x900 /* Base address of TIMER0 */
19#define MCFSLT_TIMER1 0x910 /* Base address of TIMER1 */
20
21
22/*
23 * Define the SLT timer register set addresses. 16 * Define the SLT timer register set addresses.
24 */ 17 */
25#define MCFSLT_STCNT 0x00 /* Terminal count */ 18#define MCFSLT_STCNT 0x00 /* Terminal count */
diff --git a/arch/m68k/include/asm/nettel.h b/arch/m68k/include/asm/nettel.h
index 4dec2d9fb994..2a7a7667d807 100644
--- a/arch/m68k/include/asm/nettel.h
+++ b/arch/m68k/include/asm/nettel.h
@@ -21,6 +21,7 @@
21#ifdef CONFIG_COLDFIRE 21#ifdef CONFIG_COLDFIRE
22#include <asm/coldfire.h> 22#include <asm/coldfire.h>
23#include <asm/mcfsim.h> 23#include <asm/mcfsim.h>
24#include <asm/io.h>
24#endif 25#endif
25 26
26/*---------------------------------------------------------------------------*/ 27/*---------------------------------------------------------------------------*/
@@ -86,16 +87,12 @@ static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits)
86 */ 87 */
87static __inline__ unsigned int mcf_getppdata(void) 88static __inline__ unsigned int mcf_getppdata(void)
88{ 89{
89 volatile unsigned short *pp; 90 return readw(MCFSIM_PBDAT);
90 pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PBDAT);
91 return((unsigned int) *pp);
92} 91}
93 92
94static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits) 93static __inline__ void mcf_setppdata(unsigned int mask, unsigned int bits)
95{ 94{
96 volatile unsigned short *pp; 95 write((readw(MCFSIM_PBDAT) & ~mask) | bits, MCFSIM_PBDAT);
97 pp = (volatile unsigned short *) (MCF_MBAR + MCFSIM_PBDAT);
98 *pp = (*pp & ~mask) | bits;
99} 96}
100#endif 97#endif
101 98
diff --git a/arch/m68k/platform/68VZ328/Makefile b/arch/m68k/platform/68VZ328/Makefile
index a49d75e65489..816674164682 100644
--- a/arch/m68k/platform/68VZ328/Makefile
+++ b/arch/m68k/platform/68VZ328/Makefile
@@ -1,11 +1,5 @@
1# 1#
2# Makefile for arch/m68knommu/platform/68VZ328. 2# Makefile for arch/m68k/platform/68VZ328.
3# 3#
4 4
5obj-y := config.o 5obj-y := config.o
6extra-$(DRAGEN2):= screen.h
7
8$(obj)/screen.h: $(src)/screen.xbm $(src)/xbm2lcd.pl
9 perl $(src)/xbm2lcd.pl < $(src)/screen.xbm > $(obj)/screen.h
10
11clean-files := $(obj)/screen.h
diff --git a/arch/m68k/platform/coldfire/device.c b/arch/m68k/platform/coldfire/device.c
index 81f0fb5e51cf..71ea4c02795d 100644
--- a/arch/m68k/platform/coldfire/device.c
+++ b/arch/m68k/platform/coldfire/device.c
@@ -347,12 +347,12 @@ static void __init mcf_uart_set_irq(void)
347{ 347{
348#ifdef MCFUART_UIVR 348#ifdef MCFUART_UIVR
349 /* UART0 interrupt setup */ 349 /* UART0 interrupt setup */
350 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR); 350 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCFSIM_UART1ICR);
351 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR); 351 writeb(MCF_IRQ_UART0, MCFUART_BASE0 + MCFUART_UIVR);
352 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0); 352 mcf_mapirq2imr(MCF_IRQ_UART0, MCFINTC_UART0);
353 353
354 /* UART1 interrupt setup */ 354 /* UART1 interrupt setup */
355 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR); 355 writeb(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCFSIM_UART2ICR);
356 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR); 356 writeb(MCF_IRQ_UART1, MCFUART_BASE1 + MCFUART_UIVR);
357 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1); 357 mcf_mapirq2imr(MCF_IRQ_UART1, MCFINTC_UART1);
358#endif 358#endif
diff --git a/arch/m68k/platform/coldfire/head.S b/arch/m68k/platform/coldfire/head.S
index b88f5716f357..fa31be297b85 100644
--- a/arch/m68k/platform/coldfire/head.S
+++ b/arch/m68k/platform/coldfire/head.S
@@ -60,7 +60,7 @@
60 60
61#elif defined(CONFIG_M5272) 61#elif defined(CONFIG_M5272)
62.macro GET_MEM_SIZE 62.macro GET_MEM_SIZE
63 movel MCF_MBAR+MCFSIM_CSOR7,%d0 /* get SDRAM address mask */ 63 movel MCFSIM_CSOR7,%d0 /* get SDRAM address mask */
64 andil #0xfffff000,%d0 /* mask out chip select options */ 64 andil #0xfffff000,%d0 /* mask out chip select options */
65 negl %d0 /* negate bits */ 65 negl %d0 /* negate bits */
66.endm 66.endm
diff --git a/arch/m68k/platform/coldfire/intc-5249.c b/arch/m68k/platform/coldfire/intc-5249.c
index f343bf7bf5b0..0864b836699a 100644
--- a/arch/m68k/platform/coldfire/intc-5249.c
+++ b/arch/m68k/platform/coldfire/intc-5249.c
@@ -20,22 +20,22 @@
20static void intc2_irq_gpio_mask(struct irq_data *d) 20static void intc2_irq_gpio_mask(struct irq_data *d)
21{ 21{
22 u32 imr; 22 u32 imr;
23 imr = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 23 imr = readl(MCFSIM2_GPIOINTENABLE);
24 imr &= ~(0x1 << (d->irq - MCFINTC2_GPIOIRQ0)); 24 imr &= ~(0x1 << (d->irq - MCFINTC2_GPIOIRQ0));
25 writel(imr, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 25 writel(imr, MCFSIM2_GPIOINTENABLE);
26} 26}
27 27
28static void intc2_irq_gpio_unmask(struct irq_data *d) 28static void intc2_irq_gpio_unmask(struct irq_data *d)
29{ 29{
30 u32 imr; 30 u32 imr;
31 imr = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 31 imr = readl(MCFSIM2_GPIOINTENABLE);
32 imr |= (0x1 << (d->irq - MCFINTC2_GPIOIRQ0)); 32 imr |= (0x1 << (d->irq - MCFINTC2_GPIOIRQ0));
33 writel(imr, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 33 writel(imr, MCFSIM2_GPIOINTENABLE);
34} 34}
35 35
36static void intc2_irq_gpio_ack(struct irq_data *d) 36static void intc2_irq_gpio_ack(struct irq_data *d)
37{ 37{
38 writel(0x1 << (d->irq - MCFINTC2_GPIOIRQ0), MCF_MBAR2 + MCFSIM2_GPIOINTCLEAR); 38 writel(0x1 << (d->irq - MCFINTC2_GPIOIRQ0), MCFSIM2_GPIOINTCLEAR);
39} 39}
40 40
41static struct irq_chip intc2_irq_gpio_chip = { 41static struct irq_chip intc2_irq_gpio_chip = {
diff --git a/arch/m68k/platform/coldfire/intc-5272.c b/arch/m68k/platform/coldfire/intc-5272.c
index 7160e618b0a9..d7b695629a7e 100644
--- a/arch/m68k/platform/coldfire/intc-5272.c
+++ b/arch/m68k/platform/coldfire/intc-5272.c
@@ -86,7 +86,7 @@ static void intc_irq_mask(struct irq_data *d)
86 u32 v; 86 u32 v;
87 irq -= MCFINT_VECBASE; 87 irq -= MCFINT_VECBASE;
88 v = 0x8 << intc_irqmap[irq].index; 88 v = 0x8 << intc_irqmap[irq].index;
89 writel(v, MCF_MBAR + intc_irqmap[irq].icr); 89 writel(v, intc_irqmap[irq].icr);
90 } 90 }
91} 91}
92 92
@@ -98,7 +98,7 @@ static void intc_irq_unmask(struct irq_data *d)
98 u32 v; 98 u32 v;
99 irq -= MCFINT_VECBASE; 99 irq -= MCFINT_VECBASE;
100 v = 0xd << intc_irqmap[irq].index; 100 v = 0xd << intc_irqmap[irq].index;
101 writel(v, MCF_MBAR + intc_irqmap[irq].icr); 101 writel(v, intc_irqmap[irq].icr);
102 } 102 }
103} 103}
104 104
@@ -111,10 +111,10 @@ static void intc_irq_ack(struct irq_data *d)
111 irq -= MCFINT_VECBASE; 111 irq -= MCFINT_VECBASE;
112 if (intc_irqmap[irq].ack) { 112 if (intc_irqmap[irq].ack) {
113 u32 v; 113 u32 v;
114 v = readl(MCF_MBAR + intc_irqmap[irq].icr); 114 v = readl(intc_irqmap[irq].icr);
115 v &= (0x7 << intc_irqmap[irq].index); 115 v &= (0x7 << intc_irqmap[irq].index);
116 v |= (0x8 << intc_irqmap[irq].index); 116 v |= (0x8 << intc_irqmap[irq].index);
117 writel(v, MCF_MBAR + intc_irqmap[irq].icr); 117 writel(v, intc_irqmap[irq].icr);
118 } 118 }
119 } 119 }
120} 120}
@@ -127,12 +127,12 @@ static int intc_irq_set_type(struct irq_data *d, unsigned int type)
127 irq -= MCFINT_VECBASE; 127 irq -= MCFINT_VECBASE;
128 if (intc_irqmap[irq].ack) { 128 if (intc_irqmap[irq].ack) {
129 u32 v; 129 u32 v;
130 v = readl(MCF_MBAR + MCFSIM_PITR); 130 v = readl(MCFSIM_PITR);
131 if (type == IRQ_TYPE_EDGE_FALLING) 131 if (type == IRQ_TYPE_EDGE_FALLING)
132 v &= ~(0x1 << (32 - irq)); 132 v &= ~(0x1 << (32 - irq));
133 else 133 else
134 v |= (0x1 << (32 - irq)); 134 v |= (0x1 << (32 - irq));
135 writel(v, MCF_MBAR + MCFSIM_PITR); 135 writel(v, MCFSIM_PITR);
136 } 136 }
137 } 137 }
138 return 0; 138 return 0;
@@ -163,10 +163,10 @@ void __init init_IRQ(void)
163 int irq, edge; 163 int irq, edge;
164 164
165 /* Mask all interrupt sources */ 165 /* Mask all interrupt sources */
166 writel(0x88888888, MCF_MBAR + MCFSIM_ICR1); 166 writel(0x88888888, MCFSIM_ICR1);
167 writel(0x88888888, MCF_MBAR + MCFSIM_ICR2); 167 writel(0x88888888, MCFSIM_ICR2);
168 writel(0x88888888, MCF_MBAR + MCFSIM_ICR3); 168 writel(0x88888888, MCFSIM_ICR3);
169 writel(0x88888888, MCF_MBAR + MCFSIM_ICR4); 169 writel(0x88888888, MCFSIM_ICR4);
170 170
171 for (irq = 0; (irq < NR_IRQS); irq++) { 171 for (irq = 0; (irq < NR_IRQS); irq++) {
172 irq_set_chip(irq, &intc_irq_chip); 172 irq_set_chip(irq, &intc_irq_chip);
diff --git a/arch/m68k/platform/coldfire/intc.c b/arch/m68k/platform/coldfire/intc.c
index 5c0c150b4067..cce257420388 100644
--- a/arch/m68k/platform/coldfire/intc.c
+++ b/arch/m68k/platform/coldfire/intc.c
@@ -45,23 +45,23 @@ unsigned char mcf_irq2imr[NR_IRQS];
45void mcf_setimr(int index) 45void mcf_setimr(int index)
46{ 46{
47 u16 imr; 47 u16 imr;
48 imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); 48 imr = __raw_readw(MCFSIM_IMR);
49 __raw_writew(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); 49 __raw_writew(imr | (0x1 << index), MCFSIM_IMR);
50} 50}
51 51
52void mcf_clrimr(int index) 52void mcf_clrimr(int index)
53{ 53{
54 u16 imr; 54 u16 imr;
55 imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); 55 imr = __raw_readw(MCFSIM_IMR);
56 __raw_writew(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); 56 __raw_writew(imr & ~(0x1 << index), MCFSIM_IMR);
57} 57}
58 58
59void mcf_maskimr(unsigned int mask) 59void mcf_maskimr(unsigned int mask)
60{ 60{
61 u16 imr; 61 u16 imr;
62 imr = __raw_readw(MCF_MBAR + MCFSIM_IMR); 62 imr = __raw_readw(MCFSIM_IMR);
63 imr |= mask; 63 imr |= mask;
64 __raw_writew(imr, MCF_MBAR + MCFSIM_IMR); 64 __raw_writew(imr, MCFSIM_IMR);
65} 65}
66 66
67#else 67#else
@@ -69,23 +69,23 @@ void mcf_maskimr(unsigned int mask)
69void mcf_setimr(int index) 69void mcf_setimr(int index)
70{ 70{
71 u32 imr; 71 u32 imr;
72 imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); 72 imr = __raw_readl(MCFSIM_IMR);
73 __raw_writel(imr | (0x1 << index), MCF_MBAR + MCFSIM_IMR); 73 __raw_writel(imr | (0x1 << index), MCFSIM_IMR);
74} 74}
75 75
76void mcf_clrimr(int index) 76void mcf_clrimr(int index)
77{ 77{
78 u32 imr; 78 u32 imr;
79 imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); 79 imr = __raw_readl(MCFSIM_IMR);
80 __raw_writel(imr & ~(0x1 << index), MCF_MBAR + MCFSIM_IMR); 80 __raw_writel(imr & ~(0x1 << index), MCFSIM_IMR);
81} 81}
82 82
83void mcf_maskimr(unsigned int mask) 83void mcf_maskimr(unsigned int mask)
84{ 84{
85 u32 imr; 85 u32 imr;
86 imr = __raw_readl(MCF_MBAR + MCFSIM_IMR); 86 imr = __raw_readl(MCFSIM_IMR);
87 imr |= mask; 87 imr |= mask;
88 __raw_writel(imr, MCF_MBAR + MCFSIM_IMR); 88 __raw_writel(imr, MCFSIM_IMR);
89} 89}
90 90
91#endif 91#endif
@@ -104,9 +104,9 @@ void mcf_autovector(int irq)
104#ifdef MCFSIM_AVR 104#ifdef MCFSIM_AVR
105 if ((irq >= EIRQ1) && (irq <= EIRQ7)) { 105 if ((irq >= EIRQ1) && (irq <= EIRQ7)) {
106 u8 avec; 106 u8 avec;
107 avec = __raw_readb(MCF_MBAR + MCFSIM_AVR); 107 avec = __raw_readb(MCFSIM_AVR);
108 avec |= (0x1 << (irq - EIRQ1 + 1)); 108 avec |= (0x1 << (irq - EIRQ1 + 1));
109 __raw_writeb(avec, MCF_MBAR + MCFSIM_AVR); 109 __raw_writeb(avec, MCFSIM_AVR);
110 } 110 }
111#endif 111#endif
112} 112}
diff --git a/arch/m68k/platform/coldfire/m523x.c b/arch/m68k/platform/coldfire/m523x.c
index d47dfd8f50a2..ff37fe9553ea 100644
--- a/arch/m68k/platform/coldfire/m523x.c
+++ b/arch/m68k/platform/coldfire/m523x.c
@@ -42,14 +42,8 @@ static void __init m523x_qspi_init(void)
42 42
43static void __init m523x_fec_init(void) 43static void __init m523x_fec_init(void)
44{ 44{
45 u16 par;
46 u8 v;
47
48 /* Set multi-function pins to ethernet use */ 45 /* Set multi-function pins to ethernet use */
49 par = readw(MCF_IPSBAR + 0x100082); 46 writeb(readb(MCFGPIO_PAR_FECI2C) | 0xf0, MCFGPIO_PAR_FECI2C);
50 writew(par | 0xf00, MCF_IPSBAR + 0x100082);
51 v = readb(MCF_IPSBAR + 0x100078);
52 writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
53} 47}
54 48
55/***************************************************************************/ 49/***************************************************************************/
diff --git a/arch/m68k/platform/coldfire/m5249.c b/arch/m68k/platform/coldfire/m5249.c
index 300e729a58d0..23b19cb7ab50 100644
--- a/arch/m68k/platform/coldfire/m5249.c
+++ b/arch/m68k/platform/coldfire/m5249.c
@@ -57,7 +57,7 @@ static void __init m5249_qspi_init(void)
57{ 57{
58 /* QSPI irq setup */ 58 /* QSPI irq setup */
59 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0, 59 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0,
60 MCF_MBAR + MCFSIM_QSPIICR); 60 MCFSIM_QSPIICR);
61 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 61 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
62} 62}
63 63
@@ -72,11 +72,11 @@ static void __init m5249_smc91x_init(void)
72 u32 gpio; 72 u32 gpio;
73 73
74 /* Set the GPIO line as interrupt source for smc91x device */ 74 /* Set the GPIO line as interrupt source for smc91x device */
75 gpio = readl(MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 75 gpio = readl(MCFSIM2_GPIOINTENABLE);
76 writel(gpio | 0x40, MCF_MBAR2 + MCFSIM2_GPIOINTENABLE); 76 writel(gpio | 0x40, MCFSIM2_GPIOINTENABLE);
77 77
78 gpio = readl(MCF_MBAR2 + MCFSIM2_INTLEVEL5); 78 gpio = readl(MCFSIM2_INTLEVEL5);
79 writel(gpio | 0x04000000, MCF_MBAR2 + MCFSIM2_INTLEVEL5); 79 writel(gpio | 0x04000000, MCFSIM2_INTLEVEL5);
80} 80}
81 81
82#endif /* CONFIG_M5249C3 */ 82#endif /* CONFIG_M5249C3 */
diff --git a/arch/m68k/platform/coldfire/m525x.c b/arch/m68k/platform/coldfire/m525x.c
index 8ce905f9b84f..fce8f8a45bf0 100644
--- a/arch/m68k/platform/coldfire/m525x.c
+++ b/arch/m68k/platform/coldfire/m525x.c
@@ -30,7 +30,7 @@ static void __init m525x_qspi_init(void)
30 30
31 /* QSPI irq setup */ 31 /* QSPI irq setup */
32 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0, 32 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL4 | MCFSIM_ICR_PRI0,
33 MCF_MBAR + MCFSIM_QSPIICR); 33 MCFSIM_QSPIICR);
34 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI); 34 mcf_mapirq2imr(MCF_IRQ_QSPI, MCFINTC_QSPI);
35#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ 35#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
36} 36}
@@ -42,7 +42,7 @@ static void __init m525x_i2c_init(void)
42 42
43 /* first I2C controller uses regular irq setup */ 43 /* first I2C controller uses regular irq setup */
44 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI0, 44 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI0,
45 MCF_MBAR + MCFSIM_I2CICR); 45 MCFSIM_I2CICR);
46 mcf_mapirq2imr(MCF_IRQ_I2C0, MCFINTC_I2C); 46 mcf_mapirq2imr(MCF_IRQ_I2C0, MCFINTC_I2C);
47 47
48 /* second I2C controller is completely different */ 48 /* second I2C controller is completely different */
diff --git a/arch/m68k/platform/coldfire/m5272.c b/arch/m68k/platform/coldfire/m5272.c
index e68bc7a148eb..45b246d052ef 100644
--- a/arch/m68k/platform/coldfire/m5272.c
+++ b/arch/m68k/platform/coldfire/m5272.c
@@ -35,13 +35,13 @@ static void __init m5272_uarts_init(void)
35 u32 v; 35 u32 v;
36 36
37 /* Enable the output lines for the serial ports */ 37 /* Enable the output lines for the serial ports */
38 v = readl(MCF_MBAR + MCFSIM_PBCNT); 38 v = readl(MCFSIM_PBCNT);
39 v = (v & ~0x000000ff) | 0x00000055; 39 v = (v & ~0x000000ff) | 0x00000055;
40 writel(v, MCF_MBAR + MCFSIM_PBCNT); 40 writel(v, MCFSIM_PBCNT);
41 41
42 v = readl(MCF_MBAR + MCFSIM_PDCNT); 42 v = readl(MCFSIM_PDCNT);
43 v = (v & ~0x000003fc) | 0x000002a8; 43 v = (v & ~0x000003fc) | 0x000002a8;
44 writel(v, MCF_MBAR + MCFSIM_PDCNT); 44 writel(v, MCFSIM_PDCNT);
45} 45}
46 46
47/***************************************************************************/ 47/***************************************************************************/
@@ -50,9 +50,9 @@ static void m5272_cpu_reset(void)
50{ 50{
51 local_irq_disable(); 51 local_irq_disable();
52 /* Set watchdog to reset, and enabled */ 52 /* Set watchdog to reset, and enabled */
53 __raw_writew(0, MCF_MBAR + MCFSIM_WIRR); 53 __raw_writew(0, MCFSIM_WIRR);
54 __raw_writew(1, MCF_MBAR + MCFSIM_WRRR); 54 __raw_writew(1, MCFSIM_WRRR);
55 __raw_writew(0, MCF_MBAR + MCFSIM_WCR); 55 __raw_writew(0, MCFSIM_WCR);
56 for (;;) 56 for (;;)
57 /* wait for watchdog to timeout */; 57 /* wait for watchdog to timeout */;
58} 58}
@@ -62,11 +62,8 @@ static void m5272_cpu_reset(void)
62void __init config_BSP(char *commandp, int size) 62void __init config_BSP(char *commandp, int size)
63{ 63{
64#if defined (CONFIG_MOD5272) 64#if defined (CONFIG_MOD5272)
65 volatile unsigned char *pivrp;
66
67 /* Set base of device vectors to be 64 */ 65 /* Set base of device vectors to be 64 */
68 pivrp = (volatile unsigned char *) (MCF_MBAR + MCFSIM_PIVR); 66 writeb(0x40, MCFSIM_PIVR);
69 *pivrp = 0x40;
70#endif 67#endif
71 68
72#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES) 69#if defined(CONFIG_NETtel) || defined(CONFIG_SCALES)
diff --git a/arch/m68k/platform/coldfire/m527x.c b/arch/m68k/platform/coldfire/m527x.c
index b3cb378c5e94..1431ba03c602 100644
--- a/arch/m68k/platform/coldfire/m527x.c
+++ b/arch/m68k/platform/coldfire/m527x.c
@@ -53,9 +53,9 @@ static void __init m527x_uarts_init(void)
53 /* 53 /*
54 * External Pin Mask Setting & Enable External Pin for Interface 54 * External Pin Mask Setting & Enable External Pin for Interface
55 */ 55 */
56 sepmask = readw(MCF_IPSBAR + MCF_GPIO_PAR_UART); 56 sepmask = readw(MCFGPIO_PAR_UART);
57 sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK; 57 sepmask |= UART0_ENABLE_MASK | UART1_ENABLE_MASK | UART2_ENABLE_MASK;
58 writew(sepmask, MCF_IPSBAR + MCF_GPIO_PAR_UART); 58 writew(sepmask, MCFGPIO_PAR_UART);
59} 59}
60 60
61/***************************************************************************/ 61/***************************************************************************/
@@ -67,19 +67,19 @@ static void __init m527x_fec_init(void)
67 67
68 /* Set multi-function pins to ethernet mode for fec0 */ 68 /* Set multi-function pins to ethernet mode for fec0 */
69#if defined(CONFIG_M5271) 69#if defined(CONFIG_M5271)
70 v = readb(MCF_IPSBAR + 0x100047); 70 v = readb(MCFGPIO_PAR_FECI2C);
71 writeb(v | 0xf0, MCF_IPSBAR + 0x100047); 71 writeb(v | 0xf0, MCFGPIO_PAR_FECI2C);
72#else 72#else
73 par = readw(MCF_IPSBAR + 0x100082); 73 par = readw(MCFGPIO_PAR_FECI2C);
74 writew(par | 0xf00, MCF_IPSBAR + 0x100082); 74 writew(par | 0xf00, MCFGPIO_PAR_FECI2C);
75 v = readb(MCF_IPSBAR + 0x100078); 75 v = readb(MCFGPIO_PAR_FEC0HL);
76 writeb(v | 0xc0, MCF_IPSBAR + 0x100078); 76 writeb(v | 0xc0, MCFGPIO_PAR_FEC0HL);
77 77
78 /* Set multi-function pins to ethernet mode for fec1 */ 78 /* Set multi-function pins to ethernet mode for fec1 */
79 par = readw(MCF_IPSBAR + 0x100082); 79 par = readw(MCFGPIO_PAR_FECI2C);
80 writew(par | 0xa0, MCF_IPSBAR + 0x100082); 80 writew(par | 0xa0, MCFGPIO_PAR_FECI2C);
81 v = readb(MCF_IPSBAR + 0x100079); 81 v = readb(MCFGPIO_PAR_FEC1HL);
82 writeb(v | 0xc0, MCF_IPSBAR + 0x100079); 82 writeb(v | 0xc0, MCFGPIO_PAR_FEC1HL);
83#endif 83#endif
84} 84}
85 85
diff --git a/arch/m68k/platform/coldfire/m528x.c b/arch/m68k/platform/coldfire/m528x.c
index f1319e5d2546..f9f7e6a13d04 100644
--- a/arch/m68k/platform/coldfire/m528x.c
+++ b/arch/m68k/platform/coldfire/m528x.c
@@ -53,9 +53,9 @@ static void __init m528x_fec_init(void)
53 u16 v16; 53 u16 v16;
54 54
55 /* Set multi-function pins to ethernet mode for fec0 */ 55 /* Set multi-function pins to ethernet mode for fec0 */
56 v16 = readw(MCF_IPSBAR + 0x100056); 56 v16 = readw(MCFGPIO_PASPAR);
57 writew(v16 | 0xf00, MCF_IPSBAR + 0x100056); 57 writew(v16 | 0xf00, MCFGPIO_PASPAR);
58 writeb(0xc0, MCF_IPSBAR + 0x100058); 58 writeb(0xc0, MCFGPIO_PEHLPAR);
59} 59}
60 60
61/***************************************************************************/ 61/***************************************************************************/
diff --git a/arch/m68k/platform/coldfire/m532x.c b/arch/m68k/platform/coldfire/m532x.c
index 4819a44991ed..7951d1d43357 100644
--- a/arch/m68k/platform/coldfire/m532x.c
+++ b/arch/m68k/platform/coldfire/m532x.c
@@ -172,7 +172,7 @@ static void __init m532x_clk_init(void)
172static void __init m532x_qspi_init(void) 172static void __init m532x_qspi_init(void)
173{ 173{
174 /* setup QSPS pins for QSPI with gpio CS control */ 174 /* setup QSPS pins for QSPI with gpio CS control */
175 writew(0x01f0, MCF_GPIO_PAR_QSPI); 175 writew(0x01f0, MCFGPIO_PAR_QSPI);
176} 176}
177 177
178#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */ 178#endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
@@ -182,18 +182,24 @@ static void __init m532x_qspi_init(void)
182static void __init m532x_uarts_init(void) 182static void __init m532x_uarts_init(void)
183{ 183{
184 /* UART GPIO initialization */ 184 /* UART GPIO initialization */
185 MCF_GPIO_PAR_UART |= 0x0FFF; 185 writew(readw(MCFGPIO_PAR_UART) | 0x0FFF, MCFGPIO_PAR_UART);
186} 186}
187 187
188/***************************************************************************/ 188/***************************************************************************/
189 189
190static void __init m532x_fec_init(void) 190static void __init m532x_fec_init(void)
191{ 191{
192 u8 v;
193
192 /* Set multi-function pins to ethernet mode for fec0 */ 194 /* Set multi-function pins to ethernet mode for fec0 */
193 MCF_GPIO_PAR_FECI2C |= (MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC | 195 v = readb(MCFGPIO_PAR_FECI2C);
194 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO); 196 v |= MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC |
195 MCF_GPIO_PAR_FEC = (MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC | 197 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO;
196 MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC); 198 writeb(v, MCFGPIO_PAR_FECI2C);
199
200 v = readb(MCFGPIO_PAR_FEC);
201 v = MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC | MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC;
202 writeb(v, MCFGPIO_PAR_FEC);
197} 203}
198 204
199/***************************************************************************/ 205/***************************************************************************/
@@ -298,7 +304,7 @@ asmlinkage void __init sysinit(void)
298void wtm_init(void) 304void wtm_init(void)
299{ 305{
300 /* Disable watchdog timer */ 306 /* Disable watchdog timer */
301 MCF_WTM_WCR = 0; 307 writew(0, MCF_WTM_WCR);
302} 308}
303 309
304#define MCF_SCM_BCR_GBW (0x00000100) 310#define MCF_SCM_BCR_GBW (0x00000100)
@@ -307,53 +313,53 @@ void wtm_init(void)
307void scm_init(void) 313void scm_init(void)
308{ 314{
309 /* All masters are trusted */ 315 /* All masters are trusted */
310 MCF_SCM_MPR = 0x77777777; 316 writel(0x77777777, MCF_SCM_MPR);
311 317
312 /* Allow supervisor/user, read/write, and trusted/untrusted 318 /* Allow supervisor/user, read/write, and trusted/untrusted
313 access to all slaves */ 319 access to all slaves */
314 MCF_SCM_PACRA = 0; 320 writel(0, MCF_SCM_PACRA);
315 MCF_SCM_PACRB = 0; 321 writel(0, MCF_SCM_PACRB);
316 MCF_SCM_PACRC = 0; 322 writel(0, MCF_SCM_PACRC);
317 MCF_SCM_PACRD = 0; 323 writel(0, MCF_SCM_PACRD);
318 MCF_SCM_PACRE = 0; 324 writel(0, MCF_SCM_PACRE);
319 MCF_SCM_PACRF = 0; 325 writel(0, MCF_SCM_PACRF);
320 326
321 /* Enable bursts */ 327 /* Enable bursts */
322 MCF_SCM_BCR = (MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW); 328 writel(MCF_SCM_BCR_GBR | MCF_SCM_BCR_GBW, MCF_SCM_BCR);
323} 329}
324 330
325 331
326void fbcs_init(void) 332void fbcs_init(void)
327{ 333{
328 MCF_GPIO_PAR_CS = 0x0000003E; 334 writeb(0x3E, MCFGPIO_PAR_CS);
329 335
330 /* Latch chip select */ 336 /* Latch chip select */
331 MCF_FBCS1_CSAR = 0x10080000; 337 writel(0x10080000, MCF_FBCS1_CSAR);
332 338
333 MCF_FBCS1_CSCR = 0x002A3780; 339 writel(0x002A3780, MCF_FBCS1_CSCR);
334 MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V); 340 writel(MCF_FBCS_CSMR_BAM_2M | MCF_FBCS_CSMR_V, MCF_FBCS1_CSMR);
335 341
336 /* Initialize latch to drive signals to inactive states */ 342 /* Initialize latch to drive signals to inactive states */
337 *((u16 *)(0x10080000)) = 0xFFFF; 343 writew(0xffff, 0x10080000);
338 344
339 /* External SRAM */ 345 /* External SRAM */
340 MCF_FBCS1_CSAR = EXT_SRAM_ADDRESS; 346 writel(EXT_SRAM_ADDRESS, MCF_FBCS1_CSAR);
341 MCF_FBCS1_CSCR = (MCF_FBCS_CSCR_PS_16 347 writel(MCF_FBCS_CSCR_PS_16 |
342 | MCF_FBCS_CSCR_AA 348 MCF_FBCS_CSCR_AA |
343 | MCF_FBCS_CSCR_SBM 349 MCF_FBCS_CSCR_SBM |
344 | MCF_FBCS_CSCR_WS(1)); 350 MCF_FBCS_CSCR_WS(1),
345 MCF_FBCS1_CSMR = (MCF_FBCS_CSMR_BAM_512K 351 MCF_FBCS1_CSCR);
346 | MCF_FBCS_CSMR_V); 352 writel(MCF_FBCS_CSMR_BAM_512K | MCF_FBCS_CSMR_V, MCF_FBCS1_CSMR);
347 353
348 /* Boot Flash connected to FBCS0 */ 354 /* Boot Flash connected to FBCS0 */
349 MCF_FBCS0_CSAR = FLASH_ADDRESS; 355 writel(FLASH_ADDRESS, MCF_FBCS0_CSAR);
350 MCF_FBCS0_CSCR = (MCF_FBCS_CSCR_PS_16 356 writel(MCF_FBCS_CSCR_PS_16 |
351 | MCF_FBCS_CSCR_BEM 357 MCF_FBCS_CSCR_BEM |
352 | MCF_FBCS_CSCR_AA 358 MCF_FBCS_CSCR_AA |
353 | MCF_FBCS_CSCR_SBM 359 MCF_FBCS_CSCR_SBM |
354 | MCF_FBCS_CSCR_WS(7)); 360 MCF_FBCS_CSCR_WS(7),
355 MCF_FBCS0_CSMR = (MCF_FBCS_CSMR_BAM_32M 361 MCF_FBCS0_CSCR);
356 | MCF_FBCS_CSMR_V); 362 writel(MCF_FBCS_CSMR_BAM_32M | MCF_FBCS_CSMR_V, MCF_FBCS0_CSMR);
357} 363}
358 364
359void sdramc_init(void) 365void sdramc_init(void)
@@ -362,102 +368,102 @@ void sdramc_init(void)
362 * Check to see if the SDRAM has already been initialized 368 * Check to see if the SDRAM has already been initialized
363 * by a run control tool 369 * by a run control tool
364 */ 370 */
365 if (!(MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF)) { 371 if (!(readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)) {
366 /* SDRAM chip select initialization */ 372 /* SDRAM chip select initialization */
367 373
368 /* Initialize SDRAM chip select */ 374 /* Initialize SDRAM chip select */
369 MCF_SDRAMC_SDCS0 = (0 375 writel(MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) |
370 | MCF_SDRAMC_SDCS_BA(SDRAM_ADDRESS) 376 MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE),
371 | MCF_SDRAMC_SDCS_CSSZ(MCF_SDRAMC_SDCS_CSSZ_32MBYTE)); 377 MCF_SDRAMC_SDCS0);
372 378
373 /* 379 /*
374 * Basic configuration and initialization 380 * Basic configuration and initialization
375 */ 381 */
376 MCF_SDRAMC_SDCFG1 = (0 382 writel(MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5)) |
377 | MCF_SDRAMC_SDCFG1_SRD2RW((int)((SDRAM_CASL + 2) + 0.5 )) 383 MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) |
378 | MCF_SDRAMC_SDCFG1_SWT2RD(SDRAM_TWR + 1) 384 MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL * 2) + 2)) |
379 | MCF_SDRAMC_SDCFG1_RDLAT((int)((SDRAM_CASL*2) + 2)) 385 MCF_SDRAMC_SDCFG1_ACT2RW((int)(SDRAM_TRCD + 0.5)) |
380 | MCF_SDRAMC_SDCFG1_ACT2RW((int)((SDRAM_TRCD ) + 0.5)) 386 MCF_SDRAMC_SDCFG1_PRE2ACT((int)(SDRAM_TRP + 0.5)) |
381 | MCF_SDRAMC_SDCFG1_PRE2ACT((int)((SDRAM_TRP ) + 0.5)) 387 MCF_SDRAMC_SDCFG1_REF2ACT((int)(SDRAM_TRFC + 0.5)) |
382 | MCF_SDRAMC_SDCFG1_REF2ACT((int)(((SDRAM_TRFC) ) + 0.5)) 388 MCF_SDRAMC_SDCFG1_WTLAT(3),
383 | MCF_SDRAMC_SDCFG1_WTLAT(3)); 389 MCF_SDRAMC_SDCFG1);
384 MCF_SDRAMC_SDCFG2 = (0 390 writel(MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL / 2 + 1) |
385 | MCF_SDRAMC_SDCFG2_BRD2PRE(SDRAM_BL/2 + 1) 391 MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL / 2 + SDRAM_TWR) |
386 | MCF_SDRAMC_SDCFG2_BWT2RW(SDRAM_BL/2 + SDRAM_TWR) 392 MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL + SDRAM_BL / 2 - 1.0) + 0.5)) |
387 | MCF_SDRAMC_SDCFG2_BRD2WT((int)((SDRAM_CASL+SDRAM_BL/2-1.0)+0.5)) 393 MCF_SDRAMC_SDCFG2_BL(SDRAM_BL - 1),
388 | MCF_SDRAMC_SDCFG2_BL(SDRAM_BL-1)); 394 MCF_SDRAMC_SDCFG2);
389 395
390 396
391 /* 397 /*
392 * Precharge and enable write to SDMR 398 * Precharge and enable write to SDMR
393 */ 399 */
394 MCF_SDRAMC_SDCR = (0 400 writel(MCF_SDRAMC_SDCR_MODE_EN |
395 | MCF_SDRAMC_SDCR_MODE_EN 401 MCF_SDRAMC_SDCR_CKE |
396 | MCF_SDRAMC_SDCR_CKE 402 MCF_SDRAMC_SDCR_DDR |
397 | MCF_SDRAMC_SDCR_DDR 403 MCF_SDRAMC_SDCR_MUX(1) |
398 | MCF_SDRAMC_SDCR_MUX(1) 404 MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI / (SYSTEM_PERIOD * 64)) - 1) + 0.5)) |
399 | MCF_SDRAMC_SDCR_RCNT((int)(((SDRAM_TREFI/(SYSTEM_PERIOD*64)) - 1) + 0.5)) 405 MCF_SDRAMC_SDCR_PS_16 |
400 | MCF_SDRAMC_SDCR_PS_16 406 MCF_SDRAMC_SDCR_IPALL,
401 | MCF_SDRAMC_SDCR_IPALL); 407 MCF_SDRAMC_SDCR);
402 408
403 /* 409 /*
404 * Write extended mode register 410 * Write extended mode register
405 */ 411 */
406 MCF_SDRAMC_SDMR = (0 412 writel(MCF_SDRAMC_SDMR_BNKAD_LEMR |
407 | MCF_SDRAMC_SDMR_BNKAD_LEMR 413 MCF_SDRAMC_SDMR_AD(0x0) |
408 | MCF_SDRAMC_SDMR_AD(0x0) 414 MCF_SDRAMC_SDMR_CMD,
409 | MCF_SDRAMC_SDMR_CMD); 415 MCF_SDRAMC_SDMR);
410 416
411 /* 417 /*
412 * Write mode register and reset DLL 418 * Write mode register and reset DLL
413 */ 419 */
414 MCF_SDRAMC_SDMR = (0 420 writel(MCF_SDRAMC_SDMR_BNKAD_LMR |
415 | MCF_SDRAMC_SDMR_BNKAD_LMR 421 MCF_SDRAMC_SDMR_AD(0x163) |
416 | MCF_SDRAMC_SDMR_AD(0x163) 422 MCF_SDRAMC_SDMR_CMD,
417 | MCF_SDRAMC_SDMR_CMD); 423 MCF_SDRAMC_SDMR);
418 424
419 /* 425 /*
420 * Execute a PALL command 426 * Execute a PALL command
421 */ 427 */
422 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IPALL; 428 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IPALL, MCF_SDRAMC_SDCR);
423 429
424 /* 430 /*
425 * Perform two REF cycles 431 * Perform two REF cycles
426 */ 432 */
427 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; 433 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IREF, MCF_SDRAMC_SDCR);
428 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_IREF; 434 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_IREF, MCF_SDRAMC_SDCR);
429 435
430 /* 436 /*
431 * Write mode register and clear reset DLL 437 * Write mode register and clear reset DLL
432 */ 438 */
433 MCF_SDRAMC_SDMR = (0 439 writel(MCF_SDRAMC_SDMR_BNKAD_LMR |
434 | MCF_SDRAMC_SDMR_BNKAD_LMR 440 MCF_SDRAMC_SDMR_AD(0x063) |
435 | MCF_SDRAMC_SDMR_AD(0x063) 441 MCF_SDRAMC_SDMR_CMD,
436 | MCF_SDRAMC_SDMR_CMD); 442 MCF_SDRAMC_SDMR);
437 443
438 /* 444 /*
439 * Enable auto refresh and lock SDMR 445 * Enable auto refresh and lock SDMR
440 */ 446 */
441 MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_MODE_EN; 447 writel(readl(MCF_SDRAMC_SDCR) & ~MCF_SDRAMC_SDCR_MODE_EN,
442 MCF_SDRAMC_SDCR |= (0 448 MCF_SDRAMC_SDCR);
443 | MCF_SDRAMC_SDCR_REF 449 writel(MCF_SDRAMC_SDCR_REF | MCF_SDRAMC_SDCR_DQS_OE(0xC),
444 | MCF_SDRAMC_SDCR_DQS_OE(0xC)); 450 MCF_SDRAMC_SDCR);
445 } 451 }
446} 452}
447 453
448void gpio_init(void) 454void gpio_init(void)
449{ 455{
450 /* Enable UART0 pins */ 456 /* Enable UART0 pins */
451 MCF_GPIO_PAR_UART = ( 0 457 writew(MCF_GPIO_PAR_UART_PAR_URXD0 | MCF_GPIO_PAR_UART_PAR_UTXD0,
452 | MCF_GPIO_PAR_UART_PAR_URXD0 458 MCFGPIO_PAR_UART);
453 | MCF_GPIO_PAR_UART_PAR_UTXD0);
454
455 /* Initialize TIN3 as a GPIO output to enable the write
456 half of the latch */
457 MCF_GPIO_PAR_TIMER = 0x00;
458 __raw_writeb(0x08, MCFGPIO_PDDR_TIMER);
459 __raw_writeb(0x00, MCFGPIO_PCLRR_TIMER);
460 459
460 /*
461 * Initialize TIN3 as a GPIO output to enable the write
462 * half of the latch.
463 */
464 writeb(0x00, MCFGPIO_PAR_TIMER);
465 writeb(0x08, MCFGPIO_PDDR_TIMER);
466 writeb(0x00, MCFGPIO_PCLRR_TIMER);
461} 467}
462 468
463int clock_pll(int fsys, int flags) 469int clock_pll(int fsys, int flags)
@@ -469,7 +475,7 @@ int clock_pll(int fsys, int flags)
469 475
470 if (fsys == 0) { 476 if (fsys == 0) {
471 /* Return current PLL output */ 477 /* Return current PLL output */
472 mfd = MCF_PLL_PFDR; 478 mfd = readb(MCF_PLL_PFDR);
473 479
474 return (fref * mfd / (BUSDIV * 4)); 480 return (fref * mfd / (BUSDIV * 4));
475 } 481 }
@@ -495,9 +501,10 @@ int clock_pll(int fsys, int flags)
495 * If it has then the SDRAM needs to be put into self refresh 501 * If it has then the SDRAM needs to be put into self refresh
496 * mode before reprogramming the PLL. 502 * mode before reprogramming the PLL.
497 */ 503 */
498 if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) 504 if (readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)
499 /* Put SDRAM into self refresh mode */ 505 /* Put SDRAM into self refresh mode */
500 MCF_SDRAMC_SDCR &= ~MCF_SDRAMC_SDCR_CKE; 506 writel(readl(MCF_SDRAMC_SDCR) & ~MCF_SDRAMC_SDCR_CKE,
507 MCF_SDRAMC_SDCR);
501 508
502 /* 509 /*
503 * Initialize the PLL to generate the new system clock frequency. 510 * Initialize the PLL to generate the new system clock frequency.
@@ -508,11 +515,10 @@ int clock_pll(int fsys, int flags)
508 clock_limp(DEFAULT_LPD); 515 clock_limp(DEFAULT_LPD);
509 516
510 /* Reprogram PLL for desired fsys */ 517 /* Reprogram PLL for desired fsys */
511 MCF_PLL_PODR = (0 518 writeb(MCF_PLL_PODR_CPUDIV(BUSDIV/3) | MCF_PLL_PODR_BUSDIV(BUSDIV),
512 | MCF_PLL_PODR_CPUDIV(BUSDIV/3) 519 MCF_PLL_PODR);
513 | MCF_PLL_PODR_BUSDIV(BUSDIV));
514 520
515 MCF_PLL_PFDR = mfd; 521 writeb(mfd, MCF_PLL_PFDR);
516 522
517 /* Exit LIMP mode */ 523 /* Exit LIMP mode */
518 clock_exit_limp(); 524 clock_exit_limp();
@@ -520,12 +526,13 @@ int clock_pll(int fsys, int flags)
520 /* 526 /*
521 * Return the SDRAM to normal operation if it is in use. 527 * Return the SDRAM to normal operation if it is in use.
522 */ 528 */
523 if (MCF_SDRAMC_SDCR & MCF_SDRAMC_SDCR_REF) 529 if (readl(MCF_SDRAMC_SDCR) & MCF_SDRAMC_SDCR_REF)
524 /* Exit self refresh mode */ 530 /* Exit self refresh mode */
525 MCF_SDRAMC_SDCR |= MCF_SDRAMC_SDCR_CKE; 531 writel(readl(MCF_SDRAMC_SDCR) | MCF_SDRAMC_SDCR_CKE,
532 MCF_SDRAMC_SDCR);
526 533
527 /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */ 534 /* Errata - workaround for SDRAM opeartion after exiting LIMP mode */
528 MCF_SDRAMC_LIMP_FIX = MCF_SDRAMC_REFRESH; 535 writel(MCF_SDRAMC_REFRESH, MCF_SDRAMC_LIMP_FIX);
529 536
530 /* wait for DQS logic to relock */ 537 /* wait for DQS logic to relock */
531 for (i = 0; i < 0x200; i++) 538 for (i = 0; i < 0x200; i++)
@@ -546,14 +553,12 @@ int clock_limp(int div)
546 553
547 /* Save of the current value of the SSIDIV so we don't 554 /* Save of the current value of the SSIDIV so we don't
548 overwrite the value*/ 555 overwrite the value*/
549 temp = (MCF_CCM_CDR & MCF_CCM_CDR_SSIDIV(0xF)); 556 temp = readw(MCF_CCM_CDR) & MCF_CCM_CDR_SSIDIV(0xF);
550 557
551 /* Apply the divider to the system clock */ 558 /* Apply the divider to the system clock */
552 MCF_CCM_CDR = ( 0 559 writew(MCF_CCM_CDR_LPDIV(div) | MCF_CCM_CDR_SSIDIV(temp), MCF_CCM_CDR);
553 | MCF_CCM_CDR_LPDIV(div)
554 | MCF_CCM_CDR_SSIDIV(temp));
555 560
556 MCF_CCM_MISCCR |= MCF_CCM_MISCCR_LIMP; 561 writew(readw(MCF_CCM_MISCCR) | MCF_CCM_MISCCR_LIMP, MCF_CCM_MISCCR);
557 562
558 return (FREF/(3*(1 << div))); 563 return (FREF/(3*(1 << div)));
559} 564}
@@ -563,10 +568,10 @@ int clock_exit_limp(void)
563 int fout; 568 int fout;
564 569
565 /* Exit LIMP mode */ 570 /* Exit LIMP mode */
566 MCF_CCM_MISCCR = (MCF_CCM_MISCCR & ~ MCF_CCM_MISCCR_LIMP); 571 writew(readw(MCF_CCM_MISCCR) & ~MCF_CCM_MISCCR_LIMP, MCF_CCM_MISCCR);
567 572
568 /* Wait for PLL to lock */ 573 /* Wait for PLL to lock */
569 while (!(MCF_CCM_MISCCR & MCF_CCM_MISCCR_PLL_LOCK)) 574 while (!(readw(MCF_CCM_MISCCR) & MCF_CCM_MISCCR_PLL_LOCK))
570 ; 575 ;
571 576
572 fout = get_sys_clock(); 577 fout = get_sys_clock();
@@ -579,10 +584,10 @@ int get_sys_clock(void)
579 int divider; 584 int divider;
580 585
581 /* Test to see if device is in LIMP mode */ 586 /* Test to see if device is in LIMP mode */
582 if (MCF_CCM_MISCCR & MCF_CCM_MISCCR_LIMP) { 587 if (readw(MCF_CCM_MISCCR) & MCF_CCM_MISCCR_LIMP) {
583 divider = MCF_CCM_CDR & MCF_CCM_CDR_LPDIV(0xF); 588 divider = readw(MCF_CCM_CDR) & MCF_CCM_CDR_LPDIV(0xF);
584 return (FREF/(2 << divider)); 589 return (FREF/(2 << divider));
585 } 590 }
586 else 591 else
587 return ((FREF * MCF_PLL_PFDR) / (BUSDIV * 4)); 592 return (FREF * readb(MCF_PLL_PFDR)) / (BUSDIV * 4);
588} 593}
diff --git a/arch/m68k/platform/coldfire/m54xx.c b/arch/m68k/platform/coldfire/m54xx.c
index 2081c6cbb3de..b587bf35175b 100644
--- a/arch/m68k/platform/coldfire/m54xx.c
+++ b/arch/m68k/platform/coldfire/m54xx.c
@@ -30,14 +30,12 @@
30static void __init m54xx_uarts_init(void) 30static void __init m54xx_uarts_init(void)
31{ 31{
32 /* enable io pins */ 32 /* enable io pins */
33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, 33 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC0);
34 MCF_MBAR + MCF_PAR_PSC(0));
35 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS, 34 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
36 MCF_MBAR + MCF_PAR_PSC(1)); 35 MCFGPIO_PAR_PSC1);
37 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS | 36 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
38 MCF_PAR_PSC_CTS_CTS, MCF_MBAR + MCF_PAR_PSC(2)); 37 MCF_PAR_PSC_CTS_CTS, MCFGPIO_PAR_PSC2);
39 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, 38 __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC3);
40 MCF_MBAR + MCF_PAR_PSC(3));
41} 39}
42 40
43/***************************************************************************/ 41/***************************************************************************/
@@ -46,10 +44,10 @@ static void mcf54xx_reset(void)
46{ 44{
47 /* disable interrupts and enable the watchdog */ 45 /* disable interrupts and enable the watchdog */
48 asm("movew #0x2700, %sr\n"); 46 asm("movew #0x2700, %sr\n");
49 __raw_writel(0, MCF_MBAR + MCF_GPT_GMS0); 47 __raw_writel(0, MCF_GPT_GMS0);
50 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_MBAR + MCF_GPT_GCIR0); 48 __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_GPT_GCIR0);
51 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4), 49 __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
52 MCF_MBAR + MCF_GPT_GMS0); 50 MCF_GPT_GMS0);
53} 51}
54 52
55/***************************************************************************/ 53/***************************************************************************/
diff --git a/arch/m68k/platform/coldfire/nettel.c b/arch/m68k/platform/coldfire/nettel.c
index e925ea4602f8..ddc48ec1b800 100644
--- a/arch/m68k/platform/coldfire/nettel.c
+++ b/arch/m68k/platform/coldfire/nettel.c
@@ -121,14 +121,14 @@ static void __init nettel_smc91x_setmac(unsigned int ioaddr, unsigned int flasha
121 121
122static void __init nettel_smc91x_init(void) 122static void __init nettel_smc91x_init(void)
123{ 123{
124 writew(0x00ec, MCF_MBAR + MCFSIM_PADDR); 124 writew(0x00ec, MCFSIM_PADDR);
125 mcf_setppdata(0, 0x0080); 125 mcf_setppdata(0, 0x0080);
126 writew(1, NETTEL_SMC0_ADDR + SMC91xx_BANKSELECT); 126 writew(1, NETTEL_SMC0_ADDR + SMC91xx_BANKSELECT);
127 writew(0x0067, NETTEL_SMC0_ADDR + SMC91xx_BASEADDR); 127 writew(0x0067, NETTEL_SMC0_ADDR + SMC91xx_BASEADDR);
128 mcf_setppdata(0x0080, 0); 128 mcf_setppdata(0x0080, 0);
129 129
130 /* Set correct chip select timing for SMC9196 accesses */ 130 /* Set correct chip select timing for SMC9196 accesses */
131 writew(0x1180, MCF_MBAR + MCFSIM_CSCR3); 131 writew(0x1180, MCFSIM_CSCR3);
132 132
133 /* Set the SMC interrupts to be auto-vectored */ 133 /* Set the SMC interrupts to be auto-vectored */
134 mcf_autovector(NETTEL_SMC0_IRQ); 134 mcf_autovector(NETTEL_SMC0_IRQ);
diff --git a/arch/m68k/platform/coldfire/pci.c b/arch/m68k/platform/coldfire/pci.c
index 553210d3d4c1..8572246db84d 100644
--- a/arch/m68k/platform/coldfire/pci.c
+++ b/arch/m68k/platform/coldfire/pci.c
@@ -272,8 +272,8 @@ static int __init mcf_pci_init(void)
272 PACR_EXTMINTE(0x1f), PACR); 272 PACR_EXTMINTE(0x1f), PACR);
273 273
274 /* Set required multi-function pins for PCI bus use */ 274 /* Set required multi-function pins for PCI bus use */
275 __raw_writew(0x3ff, MCF_PAR_PCIBG); 275 __raw_writew(0x3ff, MCFGPIO_PAR_PCIBG);
276 __raw_writew(0x3ff, MCF_PAR_PCIBR); 276 __raw_writew(0x3ff, MCFGPIO_PAR_PCIBR);
277 277
278 /* Set up config space for local host bus controller */ 278 /* Set up config space for local host bus controller */
279 __raw_writel(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | 279 __raw_writel(PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER |
diff --git a/arch/m68k/platform/coldfire/reset.c b/arch/m68k/platform/coldfire/reset.c
index 933e54eacc69..f30952f0cbe6 100644
--- a/arch/m68k/platform/coldfire/reset.c
+++ b/arch/m68k/platform/coldfire/reset.c
@@ -27,7 +27,7 @@ static void mcf_cpu_reset(void)
27{ 27{
28 local_irq_disable(); 28 local_irq_disable();
29 /* Set watchdog to soft reset, and enabled */ 29 /* Set watchdog to soft reset, and enabled */
30 __raw_writeb(0xc0, MCF_MBAR + MCFSIM_SYPCR); 30 __raw_writeb(0xc0, MCFSIM_SYPCR);
31 for (;;) 31 for (;;)
32 /* wait for watchdog to timeout */; 32 /* wait for watchdog to timeout */;
33} 33}
diff --git a/arch/m68k/platform/coldfire/sltimers.c b/arch/m68k/platform/coldfire/sltimers.c
index 2027fc20b876..bb5a25ada848 100644
--- a/arch/m68k/platform/coldfire/sltimers.c
+++ b/arch/m68k/platform/coldfire/sltimers.c
@@ -32,7 +32,7 @@
32/* 32/*
33 * By default use Slice Timer 1 as the profiler clock timer. 33 * By default use Slice Timer 1 as the profiler clock timer.
34 */ 34 */
35#define PA(a) (MCF_MBAR + MCFSLT_TIMER1 + (a)) 35#define PA(a) (MCFSLT_TIMER1 + (a))
36 36
37/* 37/*
38 * Choose a reasonably fast profile timer. Make it an odd value to 38 * Choose a reasonably fast profile timer. Make it an odd value to
@@ -76,7 +76,7 @@ void mcfslt_profile_init(void)
76/* 76/*
77 * By default use Slice Timer 0 as the system clock timer. 77 * By default use Slice Timer 0 as the system clock timer.
78 */ 78 */
79#define TA(a) (MCF_MBAR + MCFSLT_TIMER0 + (a)) 79#define TA(a) (MCFSLT_TIMER0 + (a))
80 80
81static u32 mcfslt_cycles_per_jiffy; 81static u32 mcfslt_cycles_per_jiffy;
82static u32 mcfslt_cnt; 82static u32 mcfslt_cnt;
diff --git a/arch/m68k/platform/coldfire/timers.c b/arch/m68k/platform/coldfire/timers.c
index 0a273e75408c..51f6d2af807f 100644
--- a/arch/m68k/platform/coldfire/timers.c
+++ b/arch/m68k/platform/coldfire/timers.c
@@ -56,13 +56,13 @@ static void init_timer_irq(void)
56#ifdef MCFSIM_ICR_AUTOVEC 56#ifdef MCFSIM_ICR_AUTOVEC
57 /* Timer1 is always used as system timer */ 57 /* Timer1 is always used as system timer */
58 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3, 58 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
59 MCF_MBAR + MCFSIM_TIMER1ICR); 59 MCFSIM_TIMER1ICR);
60 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1); 60 mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
61 61
62#ifdef CONFIG_HIGHPROFILE 62#ifdef CONFIG_HIGHPROFILE
63 /* Timer2 is to be used as a high speed profile timer */ 63 /* Timer2 is to be used as a high speed profile timer */
64 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3, 64 writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
65 MCF_MBAR + MCFSIM_TIMER2ICR); 65 MCFSIM_TIMER2ICR);
66 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2); 66 mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
67#endif 67#endif
68#endif /* MCFSIM_ICR_AUTOVEC */ 68#endif /* MCFSIM_ICR_AUTOVEC */
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index ab9afcaa7f6a..6133bed2b855 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -243,14 +243,11 @@ choice
243config MICROBLAZE_4K_PAGES 243config MICROBLAZE_4K_PAGES
244 bool "4k page size" 244 bool "4k page size"
245 245
246config MICROBLAZE_8K_PAGES
247 bool "8k page size"
248
249config MICROBLAZE_16K_PAGES 246config MICROBLAZE_16K_PAGES
250 bool "16k page size" 247 bool "16k page size"
251 248
252config MICROBLAZE_32K_PAGES 249config MICROBLAZE_64K_PAGES
253 bool "32k page size" 250 bool "64k page size"
254 251
255endchoice 252endchoice
256 253
diff --git a/arch/microblaze/include/asm/clinkage.h b/arch/microblaze/include/asm/clinkage.h
deleted file mode 100644
index 9e218435a55c..000000000000
--- a/arch/microblaze/include/asm/clinkage.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <linux/linkage.h>
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index 8cdac14b55b0..4fbfdc1ac7f8 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -35,6 +35,10 @@ extern resource_size_t isa_mem_base;
35 35
36#define IO_SPACE_LIMIT (0xFFFFFFFF) 36#define IO_SPACE_LIMIT (0xFFFFFFFF)
37 37
38/* the following is needed to support PCI with some drivers */
39
40#define mmiowb()
41
38static inline unsigned char __raw_readb(const volatile void __iomem *addr) 42static inline unsigned char __raw_readb(const volatile void __iomem *addr)
39{ 43{
40 return *(volatile unsigned char __force *)addr; 44 return *(volatile unsigned char __force *)addr;
@@ -248,4 +252,94 @@ static inline void __iomem *__ioremap(phys_addr_t address, unsigned long size,
248#define ioport_map(port, nr) ((void __iomem *)(port)) 252#define ioport_map(port, nr) ((void __iomem *)(port))
249#define ioport_unmap(addr) 253#define ioport_unmap(addr)
250 254
255/* from asm-generic/io.h */
256#ifndef insb
257static inline void insb(unsigned long addr, void *buffer, int count)
258{
259 if (count) {
260 u8 *buf = buffer;
261 do {
262 u8 x = inb(addr);
263 *buf++ = x;
264 } while (--count);
265 }
266}
267#endif
268
269#ifndef insw
270static inline void insw(unsigned long addr, void *buffer, int count)
271{
272 if (count) {
273 u16 *buf = buffer;
274 do {
275 u16 x = inw(addr);
276 *buf++ = x;
277 } while (--count);
278 }
279}
280#endif
281
282#ifndef insl
283static inline void insl(unsigned long addr, void *buffer, int count)
284{
285 if (count) {
286 u32 *buf = buffer;
287 do {
288 u32 x = inl(addr);
289 *buf++ = x;
290 } while (--count);
291 }
292}
293#endif
294
295#ifndef outsb
296static inline void outsb(unsigned long addr, const void *buffer, int count)
297{
298 if (count) {
299 const u8 *buf = buffer;
300 do {
301 outb(*buf++, addr);
302 } while (--count);
303 }
304}
305#endif
306
307#ifndef outsw
308static inline void outsw(unsigned long addr, const void *buffer, int count)
309{
310 if (count) {
311 const u16 *buf = buffer;
312 do {
313 outw(*buf++, addr);
314 } while (--count);
315 }
316}
317#endif
318
319#ifndef outsl
320static inline void outsl(unsigned long addr, const void *buffer, int count)
321{
322 if (count) {
323 const u32 *buf = buffer;
324 do {
325 outl(*buf++, addr);
326 } while (--count);
327 }
328}
329#endif
330
331#define ioread8_rep(p, dst, count) \
332 insb((unsigned long) (p), (dst), (count))
333#define ioread16_rep(p, dst, count) \
334 insw((unsigned long) (p), (dst), (count))
335#define ioread32_rep(p, dst, count) \
336 insl((unsigned long) (p), (dst), (count))
337
338#define iowrite8_rep(p, src, count) \
339 outsb((unsigned long) (p), (src), (count))
340#define iowrite16_rep(p, src, count) \
341 outsw((unsigned long) (p), (src), (count))
342#define iowrite32_rep(p, src, count) \
343 outsl((unsigned long) (p), (src), (count))
344
251#endif /* _ASM_MICROBLAZE_IO_H */ 345#endif /* _ASM_MICROBLAZE_IO_H */
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 287c5485d286..85a5ae8e9bd0 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -23,12 +23,10 @@
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25/* PAGE_SHIFT determines the page size */ 25/* PAGE_SHIFT determines the page size */
26#if defined(CONFIG_MICROBLAZE_32K_PAGES) 26#if defined(CONFIG_MICROBLAZE_64K_PAGES)
27#define PAGE_SHIFT 15 27#define PAGE_SHIFT 16
28#elif defined(CONFIG_MICROBLAZE_16K_PAGES) 28#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
29#define PAGE_SHIFT 14 29#define PAGE_SHIFT 14
30#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
31#define PAGE_SHIFT 13
32#else 30#else
33#define PAGE_SHIFT 12 31#define PAGE_SHIFT 12
34#endif 32#endif
@@ -37,6 +35,8 @@
37 35
38#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR)) 36#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
39 37
38#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
39
40#ifndef __ASSEMBLY__ 40#ifndef __ASSEMBLY__
41 41
42/* MS be sure that SLAB allocates aligned objects */ 42/* MS be sure that SLAB allocates aligned objects */
@@ -71,7 +71,6 @@ extern unsigned int __page_offset;
71 * The basic type of a PTE - 32 bit physical addressing. 71 * The basic type of a PTE - 32 bit physical addressing.
72 */ 72 */
73typedef unsigned long pte_basic_t; 73typedef unsigned long pte_basic_t;
74#define PTE_SHIFT (PAGE_SHIFT - 2) /* 1024 ptes per page */
75#define PTE_FMT "%.8lx" 74#define PTE_FMT "%.8lx"
76 75
77#endif /* CONFIG_MMU */ 76#endif /* CONFIG_MMU */
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index a0da88bf70c5..41cc841091b0 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -22,6 +22,8 @@
22#include <asm/prom.h> 22#include <asm/prom.h>
23#include <asm/pci-bridge.h> 23#include <asm/pci-bridge.h>
24 24
25#include <asm-generic/pci-dma-compat.h>
26
25#define PCIBIOS_MIN_IO 0x1000 27#define PCIBIOS_MIN_IO 0x1000
26#define PCIBIOS_MIN_MEM 0x10000000 28#define PCIBIOS_MIN_MEM 0x10000000
27 29
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 3ef7b9cafeca..a7311cd9dee0 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -234,12 +234,6 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
234#ifndef _PAGE_SHARED 234#ifndef _PAGE_SHARED
235#define _PAGE_SHARED 0 235#define _PAGE_SHARED 0
236#endif 236#endif
237#ifndef _PAGE_HWWRITE
238#define _PAGE_HWWRITE 0
239#endif
240#ifndef _PAGE_HWEXEC
241#define _PAGE_HWEXEC 0
242#endif
243#ifndef _PAGE_EXEC 237#ifndef _PAGE_EXEC
244#define _PAGE_EXEC 0 238#define _PAGE_EXEC 0
245#endif 239#endif
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 98b17f9f904b..eef84de5e8c8 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -109,20 +109,24 @@ no_fdt_arg:
109#ifndef CONFIG_CMDLINE_BOOL 109#ifndef CONFIG_CMDLINE_BOOL
110/* 110/*
111 * handling command line 111 * handling command line
112 * copy command line to __init_end. There is space for storing command line. 112 * copy command line directly to cmd_line placed in data section.
113 */ 113 */
114 beqid r5, skip /* Skip if NULL pointer */
114 or r6, r0, r0 /* incremment */ 115 or r6, r0, r0 /* incremment */
115 ori r4, r0, __init_end /* load address of command line */ 116 ori r4, r0, cmd_line /* load address of command line */
116 tophys(r4,r4) /* convert to phys address */ 117 tophys(r4,r4) /* convert to phys address */
117 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */ 118 ori r3, r0, COMMAND_LINE_SIZE - 1 /* number of loops */
118_copy_command_line: 119_copy_command_line:
119 lbu r2, r5, r6 /* r2=r5+r6 - r5 contain pointer to command line */ 120 /* r2=r5+r6 - r5 contain pointer to command line */
120 sb r2, r4, r6 /* addr[r4+r6]= r2*/ 121 lbu r2, r5, r6
122 beqid r2, skip /* Skip if no data */
123 sb r2, r4, r6 /* addr[r4+r6]= r2*/
121 addik r6, r6, 1 /* increment counting */ 124 addik r6, r6, 1 /* increment counting */
122 bgtid r3, _copy_command_line /* loop for all entries */ 125 bgtid r3, _copy_command_line /* loop for all entries */
123 addik r3, r3, -1 /* descrement loop */ 126 addik r3, r3, -1 /* decrement loop */
124 addik r5, r4, 0 /* add new space for command line */ 127 addik r5, r4, 0 /* add new space for command line */
125 tovirt(r5,r5) 128 tovirt(r5,r5)
129skip:
126#endif /* CONFIG_CMDLINE_BOOL */ 130#endif /* CONFIG_CMDLINE_BOOL */
127 131
128#ifdef NOT_COMPILE 132#ifdef NOT_COMPILE
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index aa510f450ac6..61b3a1fed46f 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -75,6 +75,7 @@
75#include <asm/mmu.h> 75#include <asm/mmu.h>
76#include <asm/pgtable.h> 76#include <asm/pgtable.h>
77#include <asm/signal.h> 77#include <asm/signal.h>
78#include <asm/registers.h>
78#include <asm/asm-offsets.h> 79#include <asm/asm-offsets.h>
79 80
80#undef DEBUG 81#undef DEBUG
@@ -581,7 +582,7 @@ ex_handler_done:
581 * tried to access a kernel or read-protected page - always 582 * tried to access a kernel or read-protected page - always
582 * a SEGV). All other faults here must be stores, so no 583 * a SEGV). All other faults here must be stores, so no
583 * need to check ESR_S as well. */ 584 * need to check ESR_S as well. */
584 andi r4, r4, 0x800 /* ESR_Z - zone protection */ 585 andi r4, r4, ESR_DIZ /* ESR_Z - zone protection */
585 bnei r4, ex2 586 bnei r4, ex2
586 587
587 ori r4, r0, swapper_pg_dir 588 ori r4, r0, swapper_pg_dir
@@ -595,25 +596,25 @@ ex_handler_done:
595 * tried to access a kernel or read-protected page - always 596 * tried to access a kernel or read-protected page - always
596 * a SEGV). All other faults here must be stores, so no 597 * a SEGV). All other faults here must be stores, so no
597 * need to check ESR_S as well. */ 598 * need to check ESR_S as well. */
598 andi r4, r4, 0x800 /* ESR_Z */ 599 andi r4, r4, ESR_DIZ /* ESR_Z */
599 bnei r4, ex2 600 bnei r4, ex2
600 /* get current task address */ 601 /* get current task address */
601 addi r4 ,CURRENT_TASK, TOPHYS(0); 602 addi r4 ,CURRENT_TASK, TOPHYS(0);
602 lwi r4, r4, TASK_THREAD+PGDIR 603 lwi r4, r4, TASK_THREAD+PGDIR
603 ex4: 604 ex4:
604 tophys(r4,r4) 605 tophys(r4,r4)
605 BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */ 606 /* Create L1 (pgdir/pmd) address */
606 andi r5, r5, 0xffc 607 BSRLI(r5,r3, PGDIR_SHIFT - 2)
608 andi r5, r5, PAGE_SIZE - 4
607/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 609/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
608 or r4, r4, r5 610 or r4, r4, r5
609 lwi r4, r4, 0 /* Get L1 entry */ 611 lwi r4, r4, 0 /* Get L1 entry */
610 andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */ 612 andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
611 beqi r5, ex2 /* Bail if no table */ 613 beqi r5, ex2 /* Bail if no table */
612 614
613 tophys(r5,r5) 615 tophys(r5,r5)
614 BSRLI(r6,r3,10) /* Compute PTE address */ 616 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
615 andi r6, r6, 0xffc 617 andi r6, r6, PAGE_SIZE - 4
616 andi r5, r5, 0xfffff003
617 or r5, r5, r6 618 or r5, r5, r6
618 lwi r4, r5, 0 /* Get Linux PTE */ 619 lwi r4, r5, 0 /* Get Linux PTE */
619 620
@@ -632,7 +633,9 @@ ex_handler_done:
632 * Many of these bits are software only. Bits we don't set 633 * Many of these bits are software only. Bits we don't set
633 * here we (properly should) assume have the appropriate value. 634 * here we (properly should) assume have the appropriate value.
634 */ 635 */
635 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 636/* Ignore memory coherent, just LSB on ZSEL is used + EX/WR */
637 andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
638 TLB_ZSEL(1) | TLB_ATTR_MASK
636 ori r4, r4, _PAGE_HWEXEC /* make it executable */ 639 ori r4, r4, _PAGE_HWEXEC /* make it executable */
637 640
638 /* find the TLB index that caused the fault. It has to be here*/ 641 /* find the TLB index that caused the fault. It has to be here*/
@@ -701,18 +704,18 @@ ex_handler_done:
701 lwi r4, r4, TASK_THREAD+PGDIR 704 lwi r4, r4, TASK_THREAD+PGDIR
702 ex6: 705 ex6:
703 tophys(r4,r4) 706 tophys(r4,r4)
704 BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */ 707 /* Create L1 (pgdir/pmd) address */
705 andi r5, r5, 0xffc 708 BSRLI(r5,r3, PGDIR_SHIFT - 2)
709 andi r5, r5, PAGE_SIZE - 4
706/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 710/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
707 or r4, r4, r5 711 or r4, r4, r5
708 lwi r4, r4, 0 /* Get L1 entry */ 712 lwi r4, r4, 0 /* Get L1 entry */
709 andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */ 713 andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
710 beqi r5, ex7 /* Bail if no table */ 714 beqi r5, ex7 /* Bail if no table */
711 715
712 tophys(r5,r5) 716 tophys(r5,r5)
713 BSRLI(r6,r3,10) /* Compute PTE address */ 717 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
714 andi r6, r6, 0xffc 718 andi r6, r6, PAGE_SIZE - 4
715 andi r5, r5, 0xfffff003
716 or r5, r5, r6 719 or r5, r5, r6
717 lwi r4, r5, 0 /* Get Linux PTE */ 720 lwi r4, r5, 0 /* Get Linux PTE */
718 721
@@ -731,7 +734,8 @@ ex_handler_done:
731 * here we (properly should) assume have the appropriate value. 734 * here we (properly should) assume have the appropriate value.
732 */ 735 */
733 brid finish_tlb_load 736 brid finish_tlb_load
734 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 737 andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
738 TLB_ZSEL(1) | TLB_ATTR_MASK
735 ex7: 739 ex7:
736 /* The bailout. Restore registers to pre-exception conditions 740 /* The bailout. Restore registers to pre-exception conditions
737 * and call the heavyweights to help us out. 741 * and call the heavyweights to help us out.
@@ -771,18 +775,18 @@ ex_handler_done:
771 lwi r4, r4, TASK_THREAD+PGDIR 775 lwi r4, r4, TASK_THREAD+PGDIR
772 ex9: 776 ex9:
773 tophys(r4,r4) 777 tophys(r4,r4)
774 BSRLI(r5,r3,20) /* Create L1 (pgdir/pmd) address */ 778 /* Create L1 (pgdir/pmd) address */
775 andi r5, r5, 0xffc 779 BSRLI(r5,r3, PGDIR_SHIFT - 2)
780 andi r5, r5, PAGE_SIZE - 4
776/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */ 781/* Assume pgdir aligned on 4K boundary, no need for "andi r4,r4,0xfffff003" */
777 or r4, r4, r5 782 or r4, r4, r5
778 lwi r4, r4, 0 /* Get L1 entry */ 783 lwi r4, r4, 0 /* Get L1 entry */
779 andi r5, r4, 0xfffff000 /* Extract L2 (pte) base address */ 784 andi r5, r4, PAGE_MASK /* Extract L2 (pte) base address */
780 beqi r5, ex10 /* Bail if no table */ 785 beqi r5, ex10 /* Bail if no table */
781 786
782 tophys(r5,r5) 787 tophys(r5,r5)
783 BSRLI(r6,r3,10) /* Compute PTE address */ 788 BSRLI(r6,r3,PTE_SHIFT) /* Compute PTE address */
784 andi r6, r6, 0xffc 789 andi r6, r6, PAGE_SIZE - 4
785 andi r5, r5, 0xfffff003
786 or r5, r5, r6 790 or r5, r5, r6
787 lwi r4, r5, 0 /* Get Linux PTE */ 791 lwi r4, r5, 0 /* Get Linux PTE */
788 792
@@ -801,7 +805,8 @@ ex_handler_done:
801 * here we (properly should) assume have the appropriate value. 805 * here we (properly should) assume have the appropriate value.
802 */ 806 */
803 brid finish_tlb_load 807 brid finish_tlb_load
804 andni r4, r4, 0x0ce2 /* Make sure 20, 21 are zero */ 808 andi r4, r4, PAGE_MASK | TLB_EX | TLB_WR | \
809 TLB_ZSEL(1) | TLB_ATTR_MASK
805 ex10: 810 ex10:
806 /* The bailout. Restore registers to pre-exception conditions 811 /* The bailout. Restore registers to pre-exception conditions
807 * and call the heavyweights to help us out. 812 * and call the heavyweights to help us out.
@@ -854,8 +859,14 @@ ex_handler_done:
854 * set of bits. These are size, valid, E, U0, and ensure 859 * set of bits. These are size, valid, E, U0, and ensure
855 * bits 20 and 21 are zero. 860 * bits 20 and 21 are zero.
856 */ 861 */
857 andi r3, r3, 0xfffff000 862 andi r3, r3, PAGE_MASK
858 ori r3, r3, 0x0c0 863#ifdef CONFIG_MICROBLAZE_64K_PAGES
864 ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_64K)
865#elif CONFIG_MICROBLAZE_16K_PAGES
866 ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_16K)
867#else
868 ori r3, r3, TLB_VALID | TLB_PAGESZ(PAGESZ_4K)
869#endif
859 mts rtlbhi, r3 /* Load TLB HI */ 870 mts rtlbhi, r3 /* Load TLB HI */
860 nop 871 nop
861 872
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index 88a01636f785..2e5079ab53d2 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -26,13 +26,14 @@ void of_platform_reset_gpio_probe(void)
26 "hard-reset-gpios", 0); 26 "hard-reset-gpios", 0);
27 27
28 if (!gpio_is_valid(handle)) { 28 if (!gpio_is_valid(handle)) {
29 printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n", 29 pr_info("Skipping unavailable RESET gpio %d (%s)\n",
30 handle, "reset"); 30 handle, "reset");
31 return;
31 } 32 }
32 33
33 ret = gpio_request(handle, "reset"); 34 ret = gpio_request(handle, "reset");
34 if (ret < 0) { 35 if (ret < 0) {
35 printk(KERN_INFO "GPIO pin is already allocated\n"); 36 pr_info("GPIO pin is already allocated\n");
36 return; 37 return;
37 } 38 }
38 39
@@ -49,7 +50,7 @@ void of_platform_reset_gpio_probe(void)
49 /* Setup output direction */ 50 /* Setup output direction */
50 gpio_set_value(handle, 0); 51 gpio_set_value(handle, 0);
51 52
52 printk(KERN_INFO "RESET: Registered gpio device: %d, current val: %d\n", 53 pr_info("RESET: Registered gpio device: %d, current val: %d\n",
53 handle, reset_val); 54 handle, reset_val);
54 return; 55 return;
55err: 56err:
@@ -60,7 +61,10 @@ err:
60 61
61static void gpio_system_reset(void) 62static void gpio_system_reset(void)
62{ 63{
63 gpio_set_value(handle, 1 - reset_val); 64 if (gpio_is_valid(handle))
65 gpio_set_value(handle, 1 - reset_val);
66 else
67 pr_notice("Reset GPIO unavailable - halting!\n");
64} 68}
65#else 69#else
66#define gpio_system_reset() do {} while (0) 70#define gpio_system_reset() do {} while (0)
@@ -72,30 +76,29 @@ void of_platform_reset_gpio_probe(void)
72 76
73void machine_restart(char *cmd) 77void machine_restart(char *cmd)
74{ 78{
75 printk(KERN_NOTICE "Machine restart...\n"); 79 pr_notice("Machine restart...\n");
76 gpio_system_reset(); 80 gpio_system_reset();
77 dump_stack();
78 while (1) 81 while (1)
79 ; 82 ;
80} 83}
81 84
82void machine_shutdown(void) 85void machine_shutdown(void)
83{ 86{
84 printk(KERN_NOTICE "Machine shutdown...\n"); 87 pr_notice("Machine shutdown...\n");
85 while (1) 88 while (1)
86 ; 89 ;
87} 90}
88 91
89void machine_halt(void) 92void machine_halt(void)
90{ 93{
91 printk(KERN_NOTICE "Machine halt...\n"); 94 pr_notice("Machine halt...\n");
92 while (1) 95 while (1)
93 ; 96 ;
94} 97}
95 98
96void machine_power_off(void) 99void machine_power_off(void)
97{ 100{
98 printk(KERN_NOTICE "Machine power off...\n"); 101 pr_notice("Machine power off...\n");
99 while (1) 102 while (1)
100 ; 103 ;
101} 104}
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 4da971d4392f..954348f83505 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -40,7 +40,12 @@ DEFINE_PER_CPU(unsigned int, R11_SAVE); /* Temp variable for entry */
40DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */ 40DEFINE_PER_CPU(unsigned int, CURRENT_SAVE); /* Saved current pointer */
41 41
42unsigned int boot_cpuid; 42unsigned int boot_cpuid;
43char cmd_line[COMMAND_LINE_SIZE]; 43/*
44 * Placed cmd_line to .data section because can be initialized from
45 * ASM code. Default position is BSS section which is cleared
46 * in machine_early_init().
47 */
48char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
44 49
45void __init setup_arch(char **cmdline_p) 50void __init setup_arch(char **cmdline_p)
46{ 51{
@@ -64,7 +69,7 @@ void __init setup_arch(char **cmdline_p)
64 xilinx_pci_init(); 69 xilinx_pci_init();
65 70
66#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER) 71#if defined(CONFIG_SELFMOD_INTC) || defined(CONFIG_SELFMOD_TIMER)
67 printk(KERN_NOTICE "Self modified code enable\n"); 72 pr_notice("Self modified code enable\n");
68#endif 73#endif
69 74
70#ifdef CONFIG_VT 75#ifdef CONFIG_VT
@@ -130,12 +135,6 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
130 memset(__bss_start, 0, __bss_stop-__bss_start); 135 memset(__bss_start, 0, __bss_stop-__bss_start);
131 memset(_ssbss, 0, _esbss-_ssbss); 136 memset(_ssbss, 0, _esbss-_ssbss);
132 137
133 /* Copy command line passed from bootloader */
134#ifndef CONFIG_CMDLINE_BOOL
135 if (cmdline && cmdline[0] != '\0')
136 strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
137#endif
138
139 lockdep_init(); 138 lockdep_init();
140 139
141/* initialize device tree for usage in early_printk */ 140/* initialize device tree for usage in early_printk */
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 76b9722557db..c1220dbf87cd 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -290,15 +290,7 @@ handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
290 case -ERESTARTNOINTR: 290 case -ERESTARTNOINTR:
291do_restart: 291do_restart:
292 /* offset of 4 bytes to re-execute trap (brki) instruction */ 292 /* offset of 4 bytes to re-execute trap (brki) instruction */
293#ifndef CONFIG_MMU
294 regs->pc -= 4; 293 regs->pc -= 4;
295#else
296 /* offset of 8 bytes required = 4 for rtbd
297 offset, plus 4 for size of
298 "brki r14,8"
299 instruction. */
300 regs->pc -= 8;
301#endif
302 break; 294 break;
303 } 295 }
304} 296}
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 522defa7d41f..aec5020a6e31 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -116,21 +116,21 @@ static void microblaze_timer_set_mode(enum clock_event_mode mode,
116{ 116{
117 switch (mode) { 117 switch (mode) {
118 case CLOCK_EVT_MODE_PERIODIC: 118 case CLOCK_EVT_MODE_PERIODIC:
119 printk(KERN_INFO "%s: periodic\n", __func__); 119 pr_info("%s: periodic\n", __func__);
120 microblaze_timer0_start_periodic(freq_div_hz); 120 microblaze_timer0_start_periodic(freq_div_hz);
121 break; 121 break;
122 case CLOCK_EVT_MODE_ONESHOT: 122 case CLOCK_EVT_MODE_ONESHOT:
123 printk(KERN_INFO "%s: oneshot\n", __func__); 123 pr_info("%s: oneshot\n", __func__);
124 break; 124 break;
125 case CLOCK_EVT_MODE_UNUSED: 125 case CLOCK_EVT_MODE_UNUSED:
126 printk(KERN_INFO "%s: unused\n", __func__); 126 pr_info("%s: unused\n", __func__);
127 break; 127 break;
128 case CLOCK_EVT_MODE_SHUTDOWN: 128 case CLOCK_EVT_MODE_SHUTDOWN:
129 printk(KERN_INFO "%s: shutdown\n", __func__); 129 pr_info("%s: shutdown\n", __func__);
130 microblaze_timer0_stop(); 130 microblaze_timer0_stop();
131 break; 131 break;
132 case CLOCK_EVT_MODE_RESUME: 132 case CLOCK_EVT_MODE_RESUME:
133 printk(KERN_INFO "%s: resume\n", __func__); 133 pr_info("%s: resume\n", __func__);
134 break; 134 break;
135 } 135 }
136} 136}
@@ -257,7 +257,15 @@ void __init time_init(void)
257 0 257 0
258 }; 258 };
259#endif 259#endif
260 timer = of_find_compatible_node(NULL, NULL, "xlnx,xps-timer-1.00.a"); 260 prop = of_get_property(of_chosen, "system-timer", NULL);
261 if (prop)
262 timer = of_find_node_by_phandle(be32_to_cpup(prop));
263 else
264 pr_info("No chosen timer found, using default\n");
265
266 if (!timer)
267 timer = of_find_compatible_node(NULL, NULL,
268 "xlnx,xps-timer-1.00.a");
261 BUG_ON(!timer); 269 BUG_ON(!timer);
262 270
263 timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL)); 271 timer_baseaddr = be32_to_cpup(of_get_property(timer, "reg", NULL));
@@ -266,14 +274,14 @@ void __init time_init(void)
266 timer_num = be32_to_cpup(of_get_property(timer, 274 timer_num = be32_to_cpup(of_get_property(timer,
267 "xlnx,one-timer-only", NULL)); 275 "xlnx,one-timer-only", NULL));
268 if (timer_num) { 276 if (timer_num) {
269 printk(KERN_EMERG "Please enable two timers in HW\n"); 277 pr_emerg("Please enable two timers in HW\n");
270 BUG(); 278 BUG();
271 } 279 }
272 280
273#ifdef CONFIG_SELFMOD_TIMER 281#ifdef CONFIG_SELFMOD_TIMER
274 selfmod_function((int *) arr_func, timer_baseaddr); 282 selfmod_function((int *) arr_func, timer_baseaddr);
275#endif 283#endif
276 printk(KERN_INFO "%s #0 at 0x%08x, irq=%d\n", 284 pr_info("%s #0 at 0x%08x, irq=%d\n",
277 timer->name, timer_baseaddr, irq); 285 timer->name, timer_baseaddr, irq);
278 286
279 /* If there is clock-frequency property than use it */ 287 /* If there is clock-frequency property than use it */
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index f9acddd9ace3..c8af429991d9 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -656,7 +656,6 @@ config S390_GUEST
656 depends on 64BIT && EXPERIMENTAL 656 depends on 64BIT && EXPERIMENTAL
657 select VIRTUALIZATION 657 select VIRTUALIZATION
658 select VIRTIO 658 select VIRTIO
659 select VIRTIO_RING
660 select VIRTIO_CONSOLE 659 select VIRTIO_CONSOLE
661 help 660 help
662 Enabling this option adds support for virtio based paravirtual device 661 Enabling this option adds support for virtio based paravirtual device
diff --git a/arch/x86/lguest/Kconfig b/arch/x86/lguest/Kconfig
index 6e121a2a49e1..7872a3330fb5 100644
--- a/arch/x86/lguest/Kconfig
+++ b/arch/x86/lguest/Kconfig
@@ -4,7 +4,6 @@ config LGUEST_GUEST
4 depends on X86_32 4 depends on X86_32
5 select VIRTUALIZATION 5 select VIRTUALIZATION
6 select VIRTIO 6 select VIRTIO
7 select VIRTIO_RING
8 select VIRTIO_CONSOLE 7 select VIRTIO_CONSOLE
9 help 8 help
10 Lguest is a tiny in-kernel hypervisor. Selecting this will 9 Lguest is a tiny in-kernel hypervisor. Selecting this will
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index c0bbeb470754..0bdde8fba397 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -14,6 +14,9 @@
14 14
15#define PART_BITS 4 15#define PART_BITS 4
16 16
17static bool use_bio;
18module_param(use_bio, bool, S_IRUGO);
19
17static int major; 20static int major;
18static DEFINE_IDA(vd_index_ida); 21static DEFINE_IDA(vd_index_ida);
19 22
@@ -23,6 +26,7 @@ struct virtio_blk
23{ 26{
24 struct virtio_device *vdev; 27 struct virtio_device *vdev;
25 struct virtqueue *vq; 28 struct virtqueue *vq;
29 wait_queue_head_t queue_wait;
26 30
27 /* The disk structure for the kernel. */ 31 /* The disk structure for the kernel. */
28 struct gendisk *disk; 32 struct gendisk *disk;
@@ -51,53 +55,244 @@ struct virtio_blk
51struct virtblk_req 55struct virtblk_req
52{ 56{
53 struct request *req; 57 struct request *req;
58 struct bio *bio;
54 struct virtio_blk_outhdr out_hdr; 59 struct virtio_blk_outhdr out_hdr;
55 struct virtio_scsi_inhdr in_hdr; 60 struct virtio_scsi_inhdr in_hdr;
61 struct work_struct work;
62 struct virtio_blk *vblk;
63 int flags;
56 u8 status; 64 u8 status;
65 struct scatterlist sg[];
66};
67
68enum {
69 VBLK_IS_FLUSH = 1,
70 VBLK_REQ_FLUSH = 2,
71 VBLK_REQ_DATA = 4,
72 VBLK_REQ_FUA = 8,
57}; 73};
58 74
59static void blk_done(struct virtqueue *vq) 75static inline int virtblk_result(struct virtblk_req *vbr)
76{
77 switch (vbr->status) {
78 case VIRTIO_BLK_S_OK:
79 return 0;
80 case VIRTIO_BLK_S_UNSUPP:
81 return -ENOTTY;
82 default:
83 return -EIO;
84 }
85}
86
87static inline struct virtblk_req *virtblk_alloc_req(struct virtio_blk *vblk,
88 gfp_t gfp_mask)
60{ 89{
61 struct virtio_blk *vblk = vq->vdev->priv;
62 struct virtblk_req *vbr; 90 struct virtblk_req *vbr;
63 unsigned int len;
64 unsigned long flags;
65 91
66 spin_lock_irqsave(vblk->disk->queue->queue_lock, flags); 92 vbr = mempool_alloc(vblk->pool, gfp_mask);
67 while ((vbr = virtqueue_get_buf(vblk->vq, &len)) != NULL) { 93 if (!vbr)
68 int error; 94 return NULL;
69 95
70 switch (vbr->status) { 96 vbr->vblk = vblk;
71 case VIRTIO_BLK_S_OK: 97 if (use_bio)
72 error = 0; 98 sg_init_table(vbr->sg, vblk->sg_elems);
73 break; 99
74 case VIRTIO_BLK_S_UNSUPP: 100 return vbr;
75 error = -ENOTTY; 101}
76 break; 102
77 default: 103static void virtblk_add_buf_wait(struct virtio_blk *vblk,
78 error = -EIO; 104 struct virtblk_req *vbr,
105 unsigned long out,
106 unsigned long in)
107{
108 DEFINE_WAIT(wait);
109
110 for (;;) {
111 prepare_to_wait_exclusive(&vblk->queue_wait, &wait,
112 TASK_UNINTERRUPTIBLE);
113
114 spin_lock_irq(vblk->disk->queue->queue_lock);
115 if (virtqueue_add_buf(vblk->vq, vbr->sg, out, in, vbr,
116 GFP_ATOMIC) < 0) {
117 spin_unlock_irq(vblk->disk->queue->queue_lock);
118 io_schedule();
119 } else {
120 virtqueue_kick(vblk->vq);
121 spin_unlock_irq(vblk->disk->queue->queue_lock);
79 break; 122 break;
80 } 123 }
81 124
82 switch (vbr->req->cmd_type) { 125 }
83 case REQ_TYPE_BLOCK_PC: 126
84 vbr->req->resid_len = vbr->in_hdr.residual; 127 finish_wait(&vblk->queue_wait, &wait);
85 vbr->req->sense_len = vbr->in_hdr.sense_len; 128}
86 vbr->req->errors = vbr->in_hdr.errors; 129
87 break; 130static inline void virtblk_add_req(struct virtblk_req *vbr,
88 case REQ_TYPE_SPECIAL: 131 unsigned int out, unsigned int in)
89 vbr->req->errors = (error != 0); 132{
90 break; 133 struct virtio_blk *vblk = vbr->vblk;
91 default: 134
92 break; 135 spin_lock_irq(vblk->disk->queue->queue_lock);
136 if (unlikely(virtqueue_add_buf(vblk->vq, vbr->sg, out, in, vbr,
137 GFP_ATOMIC) < 0)) {
138 spin_unlock_irq(vblk->disk->queue->queue_lock);
139 virtblk_add_buf_wait(vblk, vbr, out, in);
140 return;
141 }
142 virtqueue_kick(vblk->vq);
143 spin_unlock_irq(vblk->disk->queue->queue_lock);
144}
145
146static int virtblk_bio_send_flush(struct virtblk_req *vbr)
147{
148 unsigned int out = 0, in = 0;
149
150 vbr->flags |= VBLK_IS_FLUSH;
151 vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH;
152 vbr->out_hdr.sector = 0;
153 vbr->out_hdr.ioprio = 0;
154 sg_set_buf(&vbr->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr));
155 sg_set_buf(&vbr->sg[out + in++], &vbr->status, sizeof(vbr->status));
156
157 virtblk_add_req(vbr, out, in);
158
159 return 0;
160}
161
162static int virtblk_bio_send_data(struct virtblk_req *vbr)
163{
164 struct virtio_blk *vblk = vbr->vblk;
165 unsigned int num, out = 0, in = 0;
166 struct bio *bio = vbr->bio;
167
168 vbr->flags &= ~VBLK_IS_FLUSH;
169 vbr->out_hdr.type = 0;
170 vbr->out_hdr.sector = bio->bi_sector;
171 vbr->out_hdr.ioprio = bio_prio(bio);
172
173 sg_set_buf(&vbr->sg[out++], &vbr->out_hdr, sizeof(vbr->out_hdr));
174
175 num = blk_bio_map_sg(vblk->disk->queue, bio, vbr->sg + out);
176
177 sg_set_buf(&vbr->sg[num + out + in++], &vbr->status,
178 sizeof(vbr->status));
179
180 if (num) {
181 if (bio->bi_rw & REQ_WRITE) {
182 vbr->out_hdr.type |= VIRTIO_BLK_T_OUT;
183 out += num;
184 } else {
185 vbr->out_hdr.type |= VIRTIO_BLK_T_IN;
186 in += num;
93 } 187 }
188 }
189
190 virtblk_add_req(vbr, out, in);
191
192 return 0;
193}
194
195static void virtblk_bio_send_data_work(struct work_struct *work)
196{
197 struct virtblk_req *vbr;
198
199 vbr = container_of(work, struct virtblk_req, work);
200
201 virtblk_bio_send_data(vbr);
202}
203
204static void virtblk_bio_send_flush_work(struct work_struct *work)
205{
206 struct virtblk_req *vbr;
207
208 vbr = container_of(work, struct virtblk_req, work);
209
210 virtblk_bio_send_flush(vbr);
211}
212
213static inline void virtblk_request_done(struct virtblk_req *vbr)
214{
215 struct virtio_blk *vblk = vbr->vblk;
216 struct request *req = vbr->req;
217 int error = virtblk_result(vbr);
218
219 if (req->cmd_type == REQ_TYPE_BLOCK_PC) {
220 req->resid_len = vbr->in_hdr.residual;
221 req->sense_len = vbr->in_hdr.sense_len;
222 req->errors = vbr->in_hdr.errors;
223 } else if (req->cmd_type == REQ_TYPE_SPECIAL) {
224 req->errors = (error != 0);
225 }
226
227 __blk_end_request_all(req, error);
228 mempool_free(vbr, vblk->pool);
229}
230
231static inline void virtblk_bio_flush_done(struct virtblk_req *vbr)
232{
233 struct virtio_blk *vblk = vbr->vblk;
234
235 if (vbr->flags & VBLK_REQ_DATA) {
236 /* Send out the actual write data */
237 INIT_WORK(&vbr->work, virtblk_bio_send_data_work);
238 queue_work(virtblk_wq, &vbr->work);
239 } else {
240 bio_endio(vbr->bio, virtblk_result(vbr));
241 mempool_free(vbr, vblk->pool);
242 }
243}
244
245static inline void virtblk_bio_data_done(struct virtblk_req *vbr)
246{
247 struct virtio_blk *vblk = vbr->vblk;
94 248
95 __blk_end_request_all(vbr->req, error); 249 if (unlikely(vbr->flags & VBLK_REQ_FUA)) {
250 /* Send out a flush before end the bio */
251 vbr->flags &= ~VBLK_REQ_DATA;
252 INIT_WORK(&vbr->work, virtblk_bio_send_flush_work);
253 queue_work(virtblk_wq, &vbr->work);
254 } else {
255 bio_endio(vbr->bio, virtblk_result(vbr));
96 mempool_free(vbr, vblk->pool); 256 mempool_free(vbr, vblk->pool);
97 } 257 }
258}
259
260static inline void virtblk_bio_done(struct virtblk_req *vbr)
261{
262 if (unlikely(vbr->flags & VBLK_IS_FLUSH))
263 virtblk_bio_flush_done(vbr);
264 else
265 virtblk_bio_data_done(vbr);
266}
267
268static void virtblk_done(struct virtqueue *vq)
269{
270 struct virtio_blk *vblk = vq->vdev->priv;
271 bool bio_done = false, req_done = false;
272 struct virtblk_req *vbr;
273 unsigned long flags;
274 unsigned int len;
275
276 spin_lock_irqsave(vblk->disk->queue->queue_lock, flags);
277 do {
278 virtqueue_disable_cb(vq);
279 while ((vbr = virtqueue_get_buf(vblk->vq, &len)) != NULL) {
280 if (vbr->bio) {
281 virtblk_bio_done(vbr);
282 bio_done = true;
283 } else {
284 virtblk_request_done(vbr);
285 req_done = true;
286 }
287 }
288 } while (!virtqueue_enable_cb(vq));
98 /* In case queue is stopped waiting for more buffers. */ 289 /* In case queue is stopped waiting for more buffers. */
99 blk_start_queue(vblk->disk->queue); 290 if (req_done)
291 blk_start_queue(vblk->disk->queue);
100 spin_unlock_irqrestore(vblk->disk->queue->queue_lock, flags); 292 spin_unlock_irqrestore(vblk->disk->queue->queue_lock, flags);
293
294 if (bio_done)
295 wake_up(&vblk->queue_wait);
101} 296}
102 297
103static bool do_req(struct request_queue *q, struct virtio_blk *vblk, 298static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
@@ -106,13 +301,13 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
106 unsigned long num, out = 0, in = 0; 301 unsigned long num, out = 0, in = 0;
107 struct virtblk_req *vbr; 302 struct virtblk_req *vbr;
108 303
109 vbr = mempool_alloc(vblk->pool, GFP_ATOMIC); 304 vbr = virtblk_alloc_req(vblk, GFP_ATOMIC);
110 if (!vbr) 305 if (!vbr)
111 /* When another request finishes we'll try again. */ 306 /* When another request finishes we'll try again. */
112 return false; 307 return false;
113 308
114 vbr->req = req; 309 vbr->req = req;
115 310 vbr->bio = NULL;
116 if (req->cmd_flags & REQ_FLUSH) { 311 if (req->cmd_flags & REQ_FLUSH) {
117 vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH; 312 vbr->out_hdr.type = VIRTIO_BLK_T_FLUSH;
118 vbr->out_hdr.sector = 0; 313 vbr->out_hdr.sector = 0;
@@ -172,7 +367,8 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
172 } 367 }
173 } 368 }
174 369
175 if (virtqueue_add_buf(vblk->vq, vblk->sg, out, in, vbr, GFP_ATOMIC)<0) { 370 if (virtqueue_add_buf(vblk->vq, vblk->sg, out, in, vbr,
371 GFP_ATOMIC) < 0) {
176 mempool_free(vbr, vblk->pool); 372 mempool_free(vbr, vblk->pool);
177 return false; 373 return false;
178 } 374 }
@@ -180,7 +376,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
180 return true; 376 return true;
181} 377}
182 378
183static void do_virtblk_request(struct request_queue *q) 379static void virtblk_request(struct request_queue *q)
184{ 380{
185 struct virtio_blk *vblk = q->queuedata; 381 struct virtio_blk *vblk = q->queuedata;
186 struct request *req; 382 struct request *req;
@@ -203,6 +399,34 @@ static void do_virtblk_request(struct request_queue *q)
203 virtqueue_kick(vblk->vq); 399 virtqueue_kick(vblk->vq);
204} 400}
205 401
402static void virtblk_make_request(struct request_queue *q, struct bio *bio)
403{
404 struct virtio_blk *vblk = q->queuedata;
405 struct virtblk_req *vbr;
406
407 BUG_ON(bio->bi_phys_segments + 2 > vblk->sg_elems);
408
409 vbr = virtblk_alloc_req(vblk, GFP_NOIO);
410 if (!vbr) {
411 bio_endio(bio, -ENOMEM);
412 return;
413 }
414
415 vbr->bio = bio;
416 vbr->flags = 0;
417 if (bio->bi_rw & REQ_FLUSH)
418 vbr->flags |= VBLK_REQ_FLUSH;
419 if (bio->bi_rw & REQ_FUA)
420 vbr->flags |= VBLK_REQ_FUA;
421 if (bio->bi_size)
422 vbr->flags |= VBLK_REQ_DATA;
423
424 if (unlikely(vbr->flags & VBLK_REQ_FLUSH))
425 virtblk_bio_send_flush(vbr);
426 else
427 virtblk_bio_send_data(vbr);
428}
429
206/* return id (s/n) string for *disk to *id_str 430/* return id (s/n) string for *disk to *id_str
207 */ 431 */
208static int virtblk_get_id(struct gendisk *disk, char *id_str) 432static int virtblk_get_id(struct gendisk *disk, char *id_str)
@@ -360,7 +584,7 @@ static int init_vq(struct virtio_blk *vblk)
360 int err = 0; 584 int err = 0;
361 585
362 /* We expect one virtqueue, for output. */ 586 /* We expect one virtqueue, for output. */
363 vblk->vq = virtio_find_single_vq(vblk->vdev, blk_done, "requests"); 587 vblk->vq = virtio_find_single_vq(vblk->vdev, virtblk_done, "requests");
364 if (IS_ERR(vblk->vq)) 588 if (IS_ERR(vblk->vq))
365 err = PTR_ERR(vblk->vq); 589 err = PTR_ERR(vblk->vq);
366 590
@@ -477,6 +701,8 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
477 struct virtio_blk *vblk; 701 struct virtio_blk *vblk;
478 struct request_queue *q; 702 struct request_queue *q;
479 int err, index; 703 int err, index;
704 int pool_size;
705
480 u64 cap; 706 u64 cap;
481 u32 v, blk_size, sg_elems, opt_io_size; 707 u32 v, blk_size, sg_elems, opt_io_size;
482 u16 min_io_size; 708 u16 min_io_size;
@@ -506,10 +732,12 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
506 goto out_free_index; 732 goto out_free_index;
507 } 733 }
508 734
735 init_waitqueue_head(&vblk->queue_wait);
509 vblk->vdev = vdev; 736 vblk->vdev = vdev;
510 vblk->sg_elems = sg_elems; 737 vblk->sg_elems = sg_elems;
511 sg_init_table(vblk->sg, vblk->sg_elems); 738 sg_init_table(vblk->sg, vblk->sg_elems);
512 mutex_init(&vblk->config_lock); 739 mutex_init(&vblk->config_lock);
740
513 INIT_WORK(&vblk->config_work, virtblk_config_changed_work); 741 INIT_WORK(&vblk->config_work, virtblk_config_changed_work);
514 vblk->config_enable = true; 742 vblk->config_enable = true;
515 743
@@ -517,7 +745,10 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
517 if (err) 745 if (err)
518 goto out_free_vblk; 746 goto out_free_vblk;
519 747
520 vblk->pool = mempool_create_kmalloc_pool(1,sizeof(struct virtblk_req)); 748 pool_size = sizeof(struct virtblk_req);
749 if (use_bio)
750 pool_size += sizeof(struct scatterlist) * sg_elems;
751 vblk->pool = mempool_create_kmalloc_pool(1, pool_size);
521 if (!vblk->pool) { 752 if (!vblk->pool) {
522 err = -ENOMEM; 753 err = -ENOMEM;
523 goto out_free_vq; 754 goto out_free_vq;
@@ -530,12 +761,14 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
530 goto out_mempool; 761 goto out_mempool;
531 } 762 }
532 763
533 q = vblk->disk->queue = blk_init_queue(do_virtblk_request, NULL); 764 q = vblk->disk->queue = blk_init_queue(virtblk_request, NULL);
534 if (!q) { 765 if (!q) {
535 err = -ENOMEM; 766 err = -ENOMEM;
536 goto out_put_disk; 767 goto out_put_disk;
537 } 768 }
538 769
770 if (use_bio)
771 blk_queue_make_request(q, virtblk_make_request);
539 q->queuedata = vblk; 772 q->queuedata = vblk;
540 773
541 virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN); 774 virtblk_name_format("vd", index, vblk->disk->disk_name, DISK_NAME_LEN);
@@ -620,7 +853,6 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
620 if (!err && opt_io_size) 853 if (!err && opt_io_size)
621 blk_queue_io_opt(q, blk_size * opt_io_size); 854 blk_queue_io_opt(q, blk_size * opt_io_size);
622 855
623
624 add_disk(vblk->disk); 856 add_disk(vblk->disk);
625 err = device_create_file(disk_to_dev(vblk->disk), &dev_attr_serial); 857 err = device_create_file(disk_to_dev(vblk->disk), &dev_attr_serial);
626 if (err) 858 if (err)
diff --git a/drivers/char/ds1620.c b/drivers/char/ds1620.c
index aab9605f0b43..24ffd8cec51e 100644
--- a/drivers/char/ds1620.c
+++ b/drivers/char/ds1620.c
@@ -74,21 +74,21 @@ static inline void netwinder_ds1620_reset(void)
74 74
75static inline void netwinder_lock(unsigned long *flags) 75static inline void netwinder_lock(unsigned long *flags)
76{ 76{
77 spin_lock_irqsave(&nw_gpio_lock, *flags); 77 raw_spin_lock_irqsave(&nw_gpio_lock, *flags);
78} 78}
79 79
80static inline void netwinder_unlock(unsigned long *flags) 80static inline void netwinder_unlock(unsigned long *flags)
81{ 81{
82 spin_unlock_irqrestore(&nw_gpio_lock, *flags); 82 raw_spin_unlock_irqrestore(&nw_gpio_lock, *flags);
83} 83}
84 84
85static inline void netwinder_set_fan(int i) 85static inline void netwinder_set_fan(int i)
86{ 86{
87 unsigned long flags; 87 unsigned long flags;
88 88
89 spin_lock_irqsave(&nw_gpio_lock, flags); 89 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
90 nw_gpio_modify_op(GPIO_FAN, i ? GPIO_FAN : 0); 90 nw_gpio_modify_op(GPIO_FAN, i ? GPIO_FAN : 0);
91 spin_unlock_irqrestore(&nw_gpio_lock, flags); 91 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
92} 92}
93 93
94static inline int netwinder_get_fan(void) 94static inline int netwinder_get_fan(void)
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index a0e2f7d70355..e371480d3639 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -583,9 +583,9 @@ static void kick_open(void)
583 * we want to write a bit pattern XXX1 to Xilinx to enable 583 * we want to write a bit pattern XXX1 to Xilinx to enable
584 * the write gate, which will be open for about the next 2ms. 584 * the write gate, which will be open for about the next 2ms.
585 */ 585 */
586 spin_lock_irqsave(&nw_gpio_lock, flags); 586 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
587 nw_cpld_modify(CPLD_FLASH_WR_ENABLE, CPLD_FLASH_WR_ENABLE); 587 nw_cpld_modify(CPLD_FLASH_WR_ENABLE, CPLD_FLASH_WR_ENABLE);
588 spin_unlock_irqrestore(&nw_gpio_lock, flags); 588 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
589 589
590 /* 590 /*
591 * let the ISA bus to catch on... 591 * let the ISA bus to catch on...
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 060a672ebb7b..8ab9c3d4bf13 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -24,6 +24,8 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/freezer.h> 25#include <linux/freezer.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/splice.h>
28#include <linux/pagemap.h>
27#include <linux/init.h> 29#include <linux/init.h>
28#include <linux/list.h> 30#include <linux/list.h>
29#include <linux/poll.h> 31#include <linux/poll.h>
@@ -474,26 +476,53 @@ static ssize_t send_control_msg(struct port *port, unsigned int event,
474 return 0; 476 return 0;
475} 477}
476 478
479struct buffer_token {
480 union {
481 void *buf;
482 struct scatterlist *sg;
483 } u;
484 /* If sgpages == 0 then buf is used, else sg is used */
485 unsigned int sgpages;
486};
487
488static void reclaim_sg_pages(struct scatterlist *sg, unsigned int nrpages)
489{
490 int i;
491 struct page *page;
492
493 for (i = 0; i < nrpages; i++) {
494 page = sg_page(&sg[i]);
495 if (!page)
496 break;
497 put_page(page);
498 }
499 kfree(sg);
500}
501
477/* Callers must take the port->outvq_lock */ 502/* Callers must take the port->outvq_lock */
478static void reclaim_consumed_buffers(struct port *port) 503static void reclaim_consumed_buffers(struct port *port)
479{ 504{
480 void *buf; 505 struct buffer_token *tok;
481 unsigned int len; 506 unsigned int len;
482 507
483 if (!port->portdev) { 508 if (!port->portdev) {
484 /* Device has been unplugged. vqs are already gone. */ 509 /* Device has been unplugged. vqs are already gone. */
485 return; 510 return;
486 } 511 }
487 while ((buf = virtqueue_get_buf(port->out_vq, &len))) { 512 while ((tok = virtqueue_get_buf(port->out_vq, &len))) {
488 kfree(buf); 513 if (tok->sgpages)
514 reclaim_sg_pages(tok->u.sg, tok->sgpages);
515 else
516 kfree(tok->u.buf);
517 kfree(tok);
489 port->outvq_full = false; 518 port->outvq_full = false;
490 } 519 }
491} 520}
492 521
493static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count, 522static ssize_t __send_to_port(struct port *port, struct scatterlist *sg,
494 bool nonblock) 523 int nents, size_t in_count,
524 struct buffer_token *tok, bool nonblock)
495{ 525{
496 struct scatterlist sg[1];
497 struct virtqueue *out_vq; 526 struct virtqueue *out_vq;
498 ssize_t ret; 527 ssize_t ret;
499 unsigned long flags; 528 unsigned long flags;
@@ -505,8 +534,7 @@ static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count,
505 534
506 reclaim_consumed_buffers(port); 535 reclaim_consumed_buffers(port);
507 536
508 sg_init_one(sg, in_buf, in_count); 537 ret = virtqueue_add_buf(out_vq, sg, nents, 0, tok, GFP_ATOMIC);
509 ret = virtqueue_add_buf(out_vq, sg, 1, 0, in_buf, GFP_ATOMIC);
510 538
511 /* Tell Host to go! */ 539 /* Tell Host to go! */
512 virtqueue_kick(out_vq); 540 virtqueue_kick(out_vq);
@@ -544,6 +572,37 @@ done:
544 return in_count; 572 return in_count;
545} 573}
546 574
575static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count,
576 bool nonblock)
577{
578 struct scatterlist sg[1];
579 struct buffer_token *tok;
580
581 tok = kmalloc(sizeof(*tok), GFP_ATOMIC);
582 if (!tok)
583 return -ENOMEM;
584 tok->sgpages = 0;
585 tok->u.buf = in_buf;
586
587 sg_init_one(sg, in_buf, in_count);
588
589 return __send_to_port(port, sg, 1, in_count, tok, nonblock);
590}
591
592static ssize_t send_pages(struct port *port, struct scatterlist *sg, int nents,
593 size_t in_count, bool nonblock)
594{
595 struct buffer_token *tok;
596
597 tok = kmalloc(sizeof(*tok), GFP_ATOMIC);
598 if (!tok)
599 return -ENOMEM;
600 tok->sgpages = nents;
601 tok->u.sg = sg;
602
603 return __send_to_port(port, sg, nents, in_count, tok, nonblock);
604}
605
547/* 606/*
548 * Give out the data that's requested from the buffer that we have 607 * Give out the data that's requested from the buffer that we have
549 * queued up. 608 * queued up.
@@ -665,6 +724,26 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
665 return fill_readbuf(port, ubuf, count, true); 724 return fill_readbuf(port, ubuf, count, true);
666} 725}
667 726
727static int wait_port_writable(struct port *port, bool nonblock)
728{
729 int ret;
730
731 if (will_write_block(port)) {
732 if (nonblock)
733 return -EAGAIN;
734
735 ret = wait_event_freezable(port->waitqueue,
736 !will_write_block(port));
737 if (ret < 0)
738 return ret;
739 }
740 /* Port got hot-unplugged. */
741 if (!port->guest_connected)
742 return -ENODEV;
743
744 return 0;
745}
746
668static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, 747static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
669 size_t count, loff_t *offp) 748 size_t count, loff_t *offp)
670{ 749{
@@ -681,18 +760,9 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
681 760
682 nonblock = filp->f_flags & O_NONBLOCK; 761 nonblock = filp->f_flags & O_NONBLOCK;
683 762
684 if (will_write_block(port)) { 763 ret = wait_port_writable(port, nonblock);
685 if (nonblock) 764 if (ret < 0)
686 return -EAGAIN; 765 return ret;
687
688 ret = wait_event_freezable(port->waitqueue,
689 !will_write_block(port));
690 if (ret < 0)
691 return ret;
692 }
693 /* Port got hot-unplugged. */
694 if (!port->guest_connected)
695 return -ENODEV;
696 766
697 count = min((size_t)(32 * 1024), count); 767 count = min((size_t)(32 * 1024), count);
698 768
@@ -725,6 +795,93 @@ out:
725 return ret; 795 return ret;
726} 796}
727 797
798struct sg_list {
799 unsigned int n;
800 unsigned int size;
801 size_t len;
802 struct scatterlist *sg;
803};
804
805static int pipe_to_sg(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
806 struct splice_desc *sd)
807{
808 struct sg_list *sgl = sd->u.data;
809 unsigned int offset, len;
810
811 if (sgl->n == sgl->size)
812 return 0;
813
814 /* Try lock this page */
815 if (buf->ops->steal(pipe, buf) == 0) {
816 /* Get reference and unlock page for moving */
817 get_page(buf->page);
818 unlock_page(buf->page);
819
820 len = min(buf->len, sd->len);
821 sg_set_page(&(sgl->sg[sgl->n]), buf->page, len, buf->offset);
822 } else {
823 /* Failback to copying a page */
824 struct page *page = alloc_page(GFP_KERNEL);
825 char *src = buf->ops->map(pipe, buf, 1);
826 char *dst;
827
828 if (!page)
829 return -ENOMEM;
830 dst = kmap(page);
831
832 offset = sd->pos & ~PAGE_MASK;
833
834 len = sd->len;
835 if (len + offset > PAGE_SIZE)
836 len = PAGE_SIZE - offset;
837
838 memcpy(dst + offset, src + buf->offset, len);
839
840 kunmap(page);
841 buf->ops->unmap(pipe, buf, src);
842
843 sg_set_page(&(sgl->sg[sgl->n]), page, len, offset);
844 }
845 sgl->n++;
846 sgl->len += len;
847
848 return len;
849}
850
851/* Faster zero-copy write by splicing */
852static ssize_t port_fops_splice_write(struct pipe_inode_info *pipe,
853 struct file *filp, loff_t *ppos,
854 size_t len, unsigned int flags)
855{
856 struct port *port = filp->private_data;
857 struct sg_list sgl;
858 ssize_t ret;
859 struct splice_desc sd = {
860 .total_len = len,
861 .flags = flags,
862 .pos = *ppos,
863 .u.data = &sgl,
864 };
865
866 ret = wait_port_writable(port, filp->f_flags & O_NONBLOCK);
867 if (ret < 0)
868 return ret;
869
870 sgl.n = 0;
871 sgl.len = 0;
872 sgl.size = pipe->nrbufs;
873 sgl.sg = kmalloc(sizeof(struct scatterlist) * sgl.size, GFP_KERNEL);
874 if (unlikely(!sgl.sg))
875 return -ENOMEM;
876
877 sg_init_table(sgl.sg, sgl.size);
878 ret = __splice_from_pipe(pipe, &sd, pipe_to_sg);
879 if (likely(ret > 0))
880 ret = send_pages(port, sgl.sg, sgl.n, sgl.len, true);
881
882 return ret;
883}
884
728static unsigned int port_fops_poll(struct file *filp, poll_table *wait) 885static unsigned int port_fops_poll(struct file *filp, poll_table *wait)
729{ 886{
730 struct port *port; 887 struct port *port;
@@ -856,6 +1013,7 @@ static const struct file_operations port_fops = {
856 .open = port_fops_open, 1013 .open = port_fops_open,
857 .read = port_fops_read, 1014 .read = port_fops_read,
858 .write = port_fops_write, 1015 .write = port_fops_write,
1016 .splice_write = port_fops_splice_write,
859 .poll = port_fops_poll, 1017 .poll = port_fops_poll,
860 .release = port_fops_release, 1018 .release = port_fops_release,
861 .fasync = port_fops_fasync, 1019 .fasync = port_fops_fasync,
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 9e8388efd88e..fc92ccbd71dc 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -263,6 +263,9 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
263 struct virtqueue *vq; 263 struct virtqueue *vq;
264 int err; 264 int err;
265 265
266 if (!name)
267 return NULL;
268
266 /* We must have this many virtqueues. */ 269 /* We must have this many virtqueues. */
267 if (index >= ldev->desc->num_vq) 270 if (index >= ldev->desc->num_vq)
268 return ERR_PTR(-ENOENT); 271 return ERR_PTR(-ENOENT);
@@ -296,7 +299,7 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
296 * to 'true': the host just a(nother) SMP CPU, so we only need inter-cpu 299 * to 'true': the host just a(nother) SMP CPU, so we only need inter-cpu
297 * barriers. 300 * barriers.
298 */ 301 */
299 vq = vring_new_virtqueue(lvq->config.num, LGUEST_VRING_ALIGN, vdev, 302 vq = vring_new_virtqueue(index, lvq->config.num, LGUEST_VRING_ALIGN, vdev,
300 true, lvq->pages, lg_notify, callback, name); 303 true, lvq->pages, lg_notify, callback, name);
301 if (!vq) { 304 if (!vq) {
302 err = -ENOMEM; 305 err = -ENOMEM;
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index d43e7462941f..aa8c4dec356e 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -27,7 +27,6 @@
27 27
28#include <asm/gpio.h> 28#include <asm/gpio.h>
29 29
30#include <mach/gpio-tegra.h>
31#include <linux/platform_data/mmc-sdhci-tegra.h> 30#include <linux/platform_data/mmc-sdhci-tegra.h>
32 31
33#include "sdhci-pltfm.h" 32#include "sdhci-pltfm.h"
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index 3541b4492f64..e7a4780e93db 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -84,6 +84,9 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev,
84 if (id >= ARRAY_SIZE(rvdev->vring)) 84 if (id >= ARRAY_SIZE(rvdev->vring))
85 return ERR_PTR(-EINVAL); 85 return ERR_PTR(-EINVAL);
86 86
87 if (!name)
88 return NULL;
89
87 ret = rproc_alloc_vring(rvdev, id); 90 ret = rproc_alloc_vring(rvdev, id);
88 if (ret) 91 if (ret)
89 return ERR_PTR(ret); 92 return ERR_PTR(ret);
@@ -103,7 +106,7 @@ static struct virtqueue *rp_find_vq(struct virtio_device *vdev,
103 * Create the new vq, and tell virtio we're not interested in 106 * Create the new vq, and tell virtio we're not interested in
104 * the 'weak' smp barriers, since we're talking with a real device. 107 * the 'weak' smp barriers, since we're talking with a real device.
105 */ 108 */
106 vq = vring_new_virtqueue(len, rvring->align, vdev, false, addr, 109 vq = vring_new_virtqueue(id, len, rvring->align, vdev, false, addr,
107 rproc_virtio_notify, callback, name); 110 rproc_virtio_notify, callback, name);
108 if (!vq) { 111 if (!vq) {
109 dev_err(dev, "vring_new_virtqueue %s failed\n", name); 112 dev_err(dev, "vring_new_virtqueue %s failed\n", name);
diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig
index 32aead65735a..2bd911f12571 100644
--- a/drivers/rpmsg/Kconfig
+++ b/drivers/rpmsg/Kconfig
@@ -4,7 +4,6 @@ menu "Rpmsg drivers (EXPERIMENTAL)"
4config RPMSG 4config RPMSG
5 tristate 5 tristate
6 select VIRTIO 6 select VIRTIO
7 select VIRTIO_RING
8 depends on EXPERIMENTAL 7 depends on EXPERIMENTAL
9 8
10endmenu 9endmenu
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 47cccd52aae8..7dabef624da3 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -190,6 +190,9 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
190 if (index >= kdev->desc->num_vq) 190 if (index >= kdev->desc->num_vq)
191 return ERR_PTR(-ENOENT); 191 return ERR_PTR(-ENOENT);
192 192
193 if (!name)
194 return NULL;
195
193 config = kvm_vq_config(kdev->desc)+index; 196 config = kvm_vq_config(kdev->desc)+index;
194 197
195 err = vmem_add_mapping(config->address, 198 err = vmem_add_mapping(config->address,
@@ -198,7 +201,7 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
198 if (err) 201 if (err)
199 goto out; 202 goto out;
200 203
201 vq = vring_new_virtqueue(config->num, KVM_S390_VIRTIO_RING_ALIGN, 204 vq = vring_new_virtqueue(index, config->num, KVM_S390_VIRTIO_RING_ALIGN,
202 vdev, true, (void *) config->address, 205 vdev, true, (void *) config->address,
203 kvm_notify, callback, name); 206 kvm_notify, callback, name);
204 if (!vq) { 207 if (!vq) {
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index f38b17a86c35..8d5bddb56cb1 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -1,11 +1,9 @@
1# Virtio always gets selected by whoever wants it.
2config VIRTIO 1config VIRTIO
3 tristate 2 tristate
4 3 ---help---
5# Similarly the virtio ring implementation. 4 This option is selected by any driver which implements the virtio
6config VIRTIO_RING 5 bus, such as CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_MMIO, CONFIG_LGUEST,
7 tristate 6 CONFIG_RPMSG or CONFIG_S390_GUEST.
8 depends on VIRTIO
9 7
10menu "Virtio drivers" 8menu "Virtio drivers"
11 9
@@ -13,7 +11,6 @@ config VIRTIO_PCI
13 tristate "PCI driver for virtio devices (EXPERIMENTAL)" 11 tristate "PCI driver for virtio devices (EXPERIMENTAL)"
14 depends on PCI && EXPERIMENTAL 12 depends on PCI && EXPERIMENTAL
15 select VIRTIO 13 select VIRTIO
16 select VIRTIO_RING
17 ---help--- 14 ---help---
18 This drivers provides support for virtio based paravirtual device 15 This drivers provides support for virtio based paravirtual device
19 drivers over PCI. This requires that your VMM has appropriate PCI 16 drivers over PCI. This requires that your VMM has appropriate PCI
@@ -26,9 +23,8 @@ config VIRTIO_PCI
26 If unsure, say M. 23 If unsure, say M.
27 24
28config VIRTIO_BALLOON 25config VIRTIO_BALLOON
29 tristate "Virtio balloon driver (EXPERIMENTAL)" 26 tristate "Virtio balloon driver"
30 select VIRTIO 27 depends on VIRTIO
31 select VIRTIO_RING
32 ---help--- 28 ---help---
33 This driver supports increasing and decreasing the amount 29 This driver supports increasing and decreasing the amount
34 of memory within a KVM guest. 30 of memory within a KVM guest.
@@ -39,7 +35,6 @@ config VIRTIO_BALLOON
39 tristate "Platform bus driver for memory mapped virtio devices (EXPERIMENTAL)" 35 tristate "Platform bus driver for memory mapped virtio devices (EXPERIMENTAL)"
40 depends on HAS_IOMEM && EXPERIMENTAL 36 depends on HAS_IOMEM && EXPERIMENTAL
41 select VIRTIO 37 select VIRTIO
42 select VIRTIO_RING
43 ---help--- 38 ---help---
44 This drivers provides support for memory mapped virtio 39 This drivers provides support for memory mapped virtio
45 platform device driver. 40 platform device driver.
diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile
index 5a4c63cfd380..9076635697bb 100644
--- a/drivers/virtio/Makefile
+++ b/drivers/virtio/Makefile
@@ -1,5 +1,4 @@
1obj-$(CONFIG_VIRTIO) += virtio.o 1obj-$(CONFIG_VIRTIO) += virtio.o virtio_ring.o
2obj-$(CONFIG_VIRTIO_RING) += virtio_ring.o
3obj-$(CONFIG_VIRTIO_MMIO) += virtio_mmio.o 2obj-$(CONFIG_VIRTIO_MMIO) += virtio_mmio.o
4obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o 3obj-$(CONFIG_VIRTIO_PCI) += virtio_pci.o
5obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o 4obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index c3b3f7f0d9d1..1e8659ca27ef 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -159,7 +159,7 @@ static int virtio_dev_remove(struct device *_d)
159 drv->remove(dev); 159 drv->remove(dev);
160 160
161 /* Driver should have reset device. */ 161 /* Driver should have reset device. */
162 BUG_ON(dev->config->get_status(dev)); 162 WARN_ON_ONCE(dev->config->get_status(dev));
163 163
164 /* Acknowledge the device's existence again. */ 164 /* Acknowledge the device's existence again. */
165 add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE); 165 add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 453db0c403d8..6b1b7e184939 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -131,9 +131,6 @@ struct virtio_mmio_vq_info {
131 /* the number of entries in the queue */ 131 /* the number of entries in the queue */
132 unsigned int num; 132 unsigned int num;
133 133
134 /* the index of the queue */
135 int queue_index;
136
137 /* the virtual address of the ring queue */ 134 /* the virtual address of the ring queue */
138 void *queue; 135 void *queue;
139 136
@@ -225,11 +222,10 @@ static void vm_reset(struct virtio_device *vdev)
225static void vm_notify(struct virtqueue *vq) 222static void vm_notify(struct virtqueue *vq)
226{ 223{
227 struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); 224 struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev);
228 struct virtio_mmio_vq_info *info = vq->priv;
229 225
230 /* We write the queue's selector into the notification register to 226 /* We write the queue's selector into the notification register to
231 * signal the other end */ 227 * signal the other end */
232 writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); 228 writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY);
233} 229}
234 230
235/* Notify all virtqueues on an interrupt. */ 231/* Notify all virtqueues on an interrupt. */
@@ -270,6 +266,7 @@ static void vm_del_vq(struct virtqueue *vq)
270 struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); 266 struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev);
271 struct virtio_mmio_vq_info *info = vq->priv; 267 struct virtio_mmio_vq_info *info = vq->priv;
272 unsigned long flags, size; 268 unsigned long flags, size;
269 unsigned int index = virtqueue_get_queue_index(vq);
273 270
274 spin_lock_irqsave(&vm_dev->lock, flags); 271 spin_lock_irqsave(&vm_dev->lock, flags);
275 list_del(&info->node); 272 list_del(&info->node);
@@ -278,7 +275,7 @@ static void vm_del_vq(struct virtqueue *vq)
278 vring_del_virtqueue(vq); 275 vring_del_virtqueue(vq);
279 276
280 /* Select and deactivate the queue */ 277 /* Select and deactivate the queue */
281 writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); 278 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
282 writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN); 279 writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN);
283 280
284 size = PAGE_ALIGN(vring_size(info->num, VIRTIO_MMIO_VRING_ALIGN)); 281 size = PAGE_ALIGN(vring_size(info->num, VIRTIO_MMIO_VRING_ALIGN));
@@ -309,6 +306,9 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
309 unsigned long flags, size; 306 unsigned long flags, size;
310 int err; 307 int err;
311 308
309 if (!name)
310 return NULL;
311
312 /* Select the queue we're interested in */ 312 /* Select the queue we're interested in */
313 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); 313 writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
314 314
@@ -324,7 +324,6 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
324 err = -ENOMEM; 324 err = -ENOMEM;
325 goto error_kmalloc; 325 goto error_kmalloc;
326 } 326 }
327 info->queue_index = index;
328 327
329 /* Allocate pages for the queue - start with a queue as big as 328 /* Allocate pages for the queue - start with a queue as big as
330 * possible (limited by maximum size allowed by device), drop down 329 * possible (limited by maximum size allowed by device), drop down
@@ -332,11 +331,21 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
332 * and two rings (which makes it "alignment_size * 2") 331 * and two rings (which makes it "alignment_size * 2")
333 */ 332 */
334 info->num = readl(vm_dev->base + VIRTIO_MMIO_QUEUE_NUM_MAX); 333 info->num = readl(vm_dev->base + VIRTIO_MMIO_QUEUE_NUM_MAX);
334
335 /* If the device reports a 0 entry queue, we won't be able to
336 * use it to perform I/O, and vring_new_virtqueue() can't create
337 * empty queues anyway, so don't bother to set up the device.
338 */
339 if (info->num == 0) {
340 err = -ENOENT;
341 goto error_alloc_pages;
342 }
343
335 while (1) { 344 while (1) {
336 size = PAGE_ALIGN(vring_size(info->num, 345 size = PAGE_ALIGN(vring_size(info->num,
337 VIRTIO_MMIO_VRING_ALIGN)); 346 VIRTIO_MMIO_VRING_ALIGN));
338 /* Already smallest possible allocation? */ 347 /* Did the last iter shrink the queue below minimum size? */
339 if (size <= VIRTIO_MMIO_VRING_ALIGN * 2) { 348 if (size < VIRTIO_MMIO_VRING_ALIGN * 2) {
340 err = -ENOMEM; 349 err = -ENOMEM;
341 goto error_alloc_pages; 350 goto error_alloc_pages;
342 } 351 }
@@ -356,7 +365,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
356 vm_dev->base + VIRTIO_MMIO_QUEUE_PFN); 365 vm_dev->base + VIRTIO_MMIO_QUEUE_PFN);
357 366
358 /* Create the vring */ 367 /* Create the vring */
359 vq = vring_new_virtqueue(info->num, VIRTIO_MMIO_VRING_ALIGN, vdev, 368 vq = vring_new_virtqueue(index, info->num, VIRTIO_MMIO_VRING_ALIGN, vdev,
360 true, info->queue, vm_notify, callback, name); 369 true, info->queue, vm_notify, callback, name);
361 if (!vq) { 370 if (!vq) {
362 err = -ENOMEM; 371 err = -ENOMEM;
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 2e03d416b9af..c33aea36598a 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -48,6 +48,7 @@ struct virtio_pci_device
48 int msix_enabled; 48 int msix_enabled;
49 int intx_enabled; 49 int intx_enabled;
50 struct msix_entry *msix_entries; 50 struct msix_entry *msix_entries;
51 cpumask_var_t *msix_affinity_masks;
51 /* Name strings for interrupts. This size should be enough, 52 /* Name strings for interrupts. This size should be enough,
52 * and I'm too lazy to allocate each name separately. */ 53 * and I'm too lazy to allocate each name separately. */
53 char (*msix_names)[256]; 54 char (*msix_names)[256];
@@ -79,9 +80,6 @@ struct virtio_pci_vq_info
79 /* the number of entries in the queue */ 80 /* the number of entries in the queue */
80 int num; 81 int num;
81 82
82 /* the index of the queue */
83 int queue_index;
84
85 /* the virtual address of the ring queue */ 83 /* the virtual address of the ring queue */
86 void *queue; 84 void *queue;
87 85
@@ -202,11 +200,11 @@ static void vp_reset(struct virtio_device *vdev)
202static void vp_notify(struct virtqueue *vq) 200static void vp_notify(struct virtqueue *vq)
203{ 201{
204 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev); 202 struct virtio_pci_device *vp_dev = to_vp_device(vq->vdev);
205 struct virtio_pci_vq_info *info = vq->priv;
206 203
207 /* we write the queue's selector into the notification register to 204 /* we write the queue's selector into the notification register to
208 * signal the other end */ 205 * signal the other end */
209 iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY); 206 iowrite16(virtqueue_get_queue_index(vq),
207 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY);
210} 208}
211 209
212/* Handle a configuration change: Tell driver if it wants to know. */ 210/* Handle a configuration change: Tell driver if it wants to know. */
@@ -279,6 +277,10 @@ static void vp_free_vectors(struct virtio_device *vdev)
279 for (i = 0; i < vp_dev->msix_used_vectors; ++i) 277 for (i = 0; i < vp_dev->msix_used_vectors; ++i)
280 free_irq(vp_dev->msix_entries[i].vector, vp_dev); 278 free_irq(vp_dev->msix_entries[i].vector, vp_dev);
281 279
280 for (i = 0; i < vp_dev->msix_vectors; i++)
281 if (vp_dev->msix_affinity_masks[i])
282 free_cpumask_var(vp_dev->msix_affinity_masks[i]);
283
282 if (vp_dev->msix_enabled) { 284 if (vp_dev->msix_enabled) {
283 /* Disable the vector used for configuration */ 285 /* Disable the vector used for configuration */
284 iowrite16(VIRTIO_MSI_NO_VECTOR, 286 iowrite16(VIRTIO_MSI_NO_VECTOR,
@@ -296,6 +298,8 @@ static void vp_free_vectors(struct virtio_device *vdev)
296 vp_dev->msix_names = NULL; 298 vp_dev->msix_names = NULL;
297 kfree(vp_dev->msix_entries); 299 kfree(vp_dev->msix_entries);
298 vp_dev->msix_entries = NULL; 300 vp_dev->msix_entries = NULL;
301 kfree(vp_dev->msix_affinity_masks);
302 vp_dev->msix_affinity_masks = NULL;
299} 303}
300 304
301static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, 305static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
@@ -314,6 +318,15 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors,
314 GFP_KERNEL); 318 GFP_KERNEL);
315 if (!vp_dev->msix_names) 319 if (!vp_dev->msix_names)
316 goto error; 320 goto error;
321 vp_dev->msix_affinity_masks
322 = kzalloc(nvectors * sizeof *vp_dev->msix_affinity_masks,
323 GFP_KERNEL);
324 if (!vp_dev->msix_affinity_masks)
325 goto error;
326 for (i = 0; i < nvectors; ++i)
327 if (!alloc_cpumask_var(&vp_dev->msix_affinity_masks[i],
328 GFP_KERNEL))
329 goto error;
317 330
318 for (i = 0; i < nvectors; ++i) 331 for (i = 0; i < nvectors; ++i)
319 vp_dev->msix_entries[i].entry = i; 332 vp_dev->msix_entries[i].entry = i;
@@ -402,7 +415,6 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
402 if (!info) 415 if (!info)
403 return ERR_PTR(-ENOMEM); 416 return ERR_PTR(-ENOMEM);
404 417
405 info->queue_index = index;
406 info->num = num; 418 info->num = num;
407 info->msix_vector = msix_vec; 419 info->msix_vector = msix_vec;
408 420
@@ -418,7 +430,7 @@ static struct virtqueue *setup_vq(struct virtio_device *vdev, unsigned index,
418 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); 430 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
419 431
420 /* create the vring */ 432 /* create the vring */
421 vq = vring_new_virtqueue(info->num, VIRTIO_PCI_VRING_ALIGN, vdev, 433 vq = vring_new_virtqueue(index, info->num, VIRTIO_PCI_VRING_ALIGN, vdev,
422 true, info->queue, vp_notify, callback, name); 434 true, info->queue, vp_notify, callback, name);
423 if (!vq) { 435 if (!vq) {
424 err = -ENOMEM; 436 err = -ENOMEM;
@@ -467,7 +479,8 @@ static void vp_del_vq(struct virtqueue *vq)
467 list_del(&info->node); 479 list_del(&info->node);
468 spin_unlock_irqrestore(&vp_dev->lock, flags); 480 spin_unlock_irqrestore(&vp_dev->lock, flags);
469 481
470 iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL); 482 iowrite16(virtqueue_get_queue_index(vq),
483 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
471 484
472 if (vp_dev->msix_enabled) { 485 if (vp_dev->msix_enabled) {
473 iowrite16(VIRTIO_MSI_NO_VECTOR, 486 iowrite16(VIRTIO_MSI_NO_VECTOR,
@@ -542,7 +555,10 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
542 vp_dev->per_vq_vectors = per_vq_vectors; 555 vp_dev->per_vq_vectors = per_vq_vectors;
543 allocated_vectors = vp_dev->msix_used_vectors; 556 allocated_vectors = vp_dev->msix_used_vectors;
544 for (i = 0; i < nvqs; ++i) { 557 for (i = 0; i < nvqs; ++i) {
545 if (!callbacks[i] || !vp_dev->msix_enabled) 558 if (!names[i]) {
559 vqs[i] = NULL;
560 continue;
561 } else if (!callbacks[i] || !vp_dev->msix_enabled)
546 msix_vec = VIRTIO_MSI_NO_VECTOR; 562 msix_vec = VIRTIO_MSI_NO_VECTOR;
547 else if (vp_dev->per_vq_vectors) 563 else if (vp_dev->per_vq_vectors)
548 msix_vec = allocated_vectors++; 564 msix_vec = allocated_vectors++;
@@ -609,6 +625,35 @@ static const char *vp_bus_name(struct virtio_device *vdev)
609 return pci_name(vp_dev->pci_dev); 625 return pci_name(vp_dev->pci_dev);
610} 626}
611 627
628/* Setup the affinity for a virtqueue:
629 * - force the affinity for per vq vector
630 * - OR over all affinities for shared MSI
631 * - ignore the affinity request if we're using INTX
632 */
633static int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
634{
635 struct virtio_device *vdev = vq->vdev;
636 struct virtio_pci_device *vp_dev = to_vp_device(vdev);
637 struct virtio_pci_vq_info *info = vq->priv;
638 struct cpumask *mask;
639 unsigned int irq;
640
641 if (!vq->callback)
642 return -EINVAL;
643
644 if (vp_dev->msix_enabled) {
645 mask = vp_dev->msix_affinity_masks[info->msix_vector];
646 irq = vp_dev->msix_entries[info->msix_vector].vector;
647 if (cpu == -1)
648 irq_set_affinity_hint(irq, NULL);
649 else {
650 cpumask_set_cpu(cpu, mask);
651 irq_set_affinity_hint(irq, mask);
652 }
653 }
654 return 0;
655}
656
612static struct virtio_config_ops virtio_pci_config_ops = { 657static struct virtio_config_ops virtio_pci_config_ops = {
613 .get = vp_get, 658 .get = vp_get,
614 .set = vp_set, 659 .set = vp_set,
@@ -620,6 +665,7 @@ static struct virtio_config_ops virtio_pci_config_ops = {
620 .get_features = vp_get_features, 665 .get_features = vp_get_features,
621 .finalize_features = vp_finalize_features, 666 .finalize_features = vp_finalize_features,
622 .bus_name = vp_bus_name, 667 .bus_name = vp_bus_name,
668 .set_vq_affinity = vp_set_vq_affinity,
623}; 669};
624 670
625static void virtio_pci_release_dev(struct device *_d) 671static void virtio_pci_release_dev(struct device *_d)
@@ -673,8 +719,10 @@ static int __devinit virtio_pci_probe(struct pci_dev *pci_dev,
673 goto out_enable_device; 719 goto out_enable_device;
674 720
675 vp_dev->ioaddr = pci_iomap(pci_dev, 0, 0); 721 vp_dev->ioaddr = pci_iomap(pci_dev, 0, 0);
676 if (vp_dev->ioaddr == NULL) 722 if (vp_dev->ioaddr == NULL) {
723 err = -ENOMEM;
677 goto out_req_regions; 724 goto out_req_regions;
725 }
678 726
679 pci_set_drvdata(pci_dev, vp_dev); 727 pci_set_drvdata(pci_dev, vp_dev);
680 pci_set_master(pci_dev); 728 pci_set_master(pci_dev);
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 5aa43c3392a2..e639584b2dbd 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -106,6 +106,9 @@ struct vring_virtqueue
106 /* How to notify other side. FIXME: commonalize hcalls! */ 106 /* How to notify other side. FIXME: commonalize hcalls! */
107 void (*notify)(struct virtqueue *vq); 107 void (*notify)(struct virtqueue *vq);
108 108
109 /* Index of the queue */
110 int queue_index;
111
109#ifdef DEBUG 112#ifdef DEBUG
110 /* They're supposed to lock for us. */ 113 /* They're supposed to lock for us. */
111 unsigned int in_use; 114 unsigned int in_use;
@@ -171,6 +174,13 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
171 return head; 174 return head;
172} 175}
173 176
177int virtqueue_get_queue_index(struct virtqueue *_vq)
178{
179 struct vring_virtqueue *vq = to_vvq(_vq);
180 return vq->queue_index;
181}
182EXPORT_SYMBOL_GPL(virtqueue_get_queue_index);
183
174/** 184/**
175 * virtqueue_add_buf - expose buffer to other end 185 * virtqueue_add_buf - expose buffer to other end
176 * @vq: the struct virtqueue we're talking about. 186 * @vq: the struct virtqueue we're talking about.
@@ -616,7 +626,8 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
616} 626}
617EXPORT_SYMBOL_GPL(vring_interrupt); 627EXPORT_SYMBOL_GPL(vring_interrupt);
618 628
619struct virtqueue *vring_new_virtqueue(unsigned int num, 629struct virtqueue *vring_new_virtqueue(unsigned int index,
630 unsigned int num,
620 unsigned int vring_align, 631 unsigned int vring_align,
621 struct virtio_device *vdev, 632 struct virtio_device *vdev,
622 bool weak_barriers, 633 bool weak_barriers,
@@ -647,6 +658,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
647 vq->broken = false; 658 vq->broken = false;
648 vq->last_used_idx = 0; 659 vq->last_used_idx = 0;
649 vq->num_added = 0; 660 vq->num_added = 0;
661 vq->queue_index = index;
650 list_add_tail(&vq->vq.list, &vdev->vqs); 662 list_add_tail(&vq->vq.list, &vdev->vqs);
651#ifdef DEBUG 663#ifdef DEBUG
652 vq->in_use = false; 664 vq->in_use = false;
diff --git a/drivers/watchdog/m54xx_wdt.c b/drivers/watchdog/m54xx_wdt.c
index 663cad86c633..173494a681e6 100644
--- a/drivers/watchdog/m54xx_wdt.c
+++ b/drivers/watchdog/m54xx_wdt.c
@@ -46,17 +46,17 @@ static void wdt_enable(void)
46 unsigned int gms0; 46 unsigned int gms0;
47 47
48 /* preserve GPIO usage, if any */ 48 /* preserve GPIO usage, if any */
49 gms0 = __raw_readl(MCF_MBAR + MCF_GPT_GMS0); 49 gms0 = __raw_readl(MCF_GPT_GMS0);
50 if (gms0 & MCF_GPT_GMS_TMS_GPIO) 50 if (gms0 & MCF_GPT_GMS_TMS_GPIO)
51 gms0 &= (MCF_GPT_GMS_TMS_GPIO | MCF_GPT_GMS_GPIO_MASK 51 gms0 &= (MCF_GPT_GMS_TMS_GPIO | MCF_GPT_GMS_GPIO_MASK
52 | MCF_GPT_GMS_OD); 52 | MCF_GPT_GMS_OD);
53 else 53 else
54 gms0 = MCF_GPT_GMS_TMS_GPIO | MCF_GPT_GMS_OD; 54 gms0 = MCF_GPT_GMS_TMS_GPIO | MCF_GPT_GMS_OD;
55 __raw_writel(gms0, MCF_MBAR + MCF_GPT_GMS0); 55 __raw_writel(gms0, MCF_GPT_GMS0);
56 __raw_writel(MCF_GPT_GCIR_PRE(heartbeat*(MCF_BUSCLK/0xffff)) | 56 __raw_writel(MCF_GPT_GCIR_PRE(heartbeat*(MCF_BUSCLK/0xffff)) |
57 MCF_GPT_GCIR_CNT(0xffff), MCF_MBAR + MCF_GPT_GCIR0); 57 MCF_GPT_GCIR_CNT(0xffff), MCF_GPT_GCIR0);
58 gms0 |= MCF_GPT_GMS_OCPW(0xA5) | MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE; 58 gms0 |= MCF_GPT_GMS_OCPW(0xA5) | MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE;
59 __raw_writel(gms0, MCF_MBAR + MCF_GPT_GMS0); 59 __raw_writel(gms0, MCF_GPT_GMS0);
60} 60}
61 61
62static void wdt_disable(void) 62static void wdt_disable(void)
@@ -64,18 +64,18 @@ static void wdt_disable(void)
64 unsigned int gms0; 64 unsigned int gms0;
65 65
66 /* disable watchdog */ 66 /* disable watchdog */
67 gms0 = __raw_readl(MCF_MBAR + MCF_GPT_GMS0); 67 gms0 = __raw_readl(MCF_GPT_GMS0);
68 gms0 &= ~(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE); 68 gms0 &= ~(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE);
69 __raw_writel(gms0, MCF_MBAR + MCF_GPT_GMS0); 69 __raw_writel(gms0, MCF_GPT_GMS0);
70} 70}
71 71
72static void wdt_keepalive(void) 72static void wdt_keepalive(void)
73{ 73{
74 unsigned int gms0; 74 unsigned int gms0;
75 75
76 gms0 = __raw_readl(MCF_MBAR + MCF_GPT_GMS0); 76 gms0 = __raw_readl(MCF_GPT_GMS0);
77 gms0 |= MCF_GPT_GMS_OCPW(0xA5); 77 gms0 |= MCF_GPT_GMS_OCPW(0xA5);
78 __raw_writel(gms0, MCF_MBAR + MCF_GPT_GMS0); 78 __raw_writel(gms0, MCF_GPT_GMS0);
79} 79}
80 80
81static int m54xx_wdt_open(struct inode *inode, struct file *file) 81static int m54xx_wdt_open(struct inode *inode, struct file *file)
@@ -195,8 +195,7 @@ static struct miscdevice m54xx_wdt_miscdev = {
195 195
196static int __init m54xx_wdt_init(void) 196static int __init m54xx_wdt_init(void)
197{ 197{
198 if (!request_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4, 198 if (!request_mem_region(MCF_GPT_GCIR0, 4, "Coldfire M54xx Watchdog")) {
199 "Coldfire M54xx Watchdog")) {
200 pr_warn("I/O region busy\n"); 199 pr_warn("I/O region busy\n");
201 return -EBUSY; 200 return -EBUSY;
202 } 201 }
@@ -208,7 +207,7 @@ static int __init m54xx_wdt_init(void)
208static void __exit m54xx_wdt_exit(void) 207static void __exit m54xx_wdt_exit(void)
209{ 208{
210 misc_deregister(&m54xx_wdt_miscdev); 209 misc_deregister(&m54xx_wdt_miscdev);
211 release_mem_region(MCF_MBAR + MCF_GPT_GCIR0, 4); 210 release_mem_region(MCF_GPT_GCIR0, 4);
212} 211}
213 212
214module_init(m54xx_wdt_init); 213module_init(m54xx_wdt_init);
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index a1ba8bbd9fbe..533b1157f22e 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -50,6 +50,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
50 50
51unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 51unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
52 52
53int virtqueue_get_queue_index(struct virtqueue *vq);
54
53/** 55/**
54 * virtio_device - representation of a device using virtio 56 * virtio_device - representation of a device using virtio
55 * @index: unique position on the virtio bus 57 * @index: unique position on the virtio bus
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index fc457f452f64..e2850a7ea276 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -84,7 +84,9 @@
84 * nvqs: the number of virtqueues to find 84 * nvqs: the number of virtqueues to find
85 * vqs: on success, includes new virtqueues 85 * vqs: on success, includes new virtqueues
86 * callbacks: array of callbacks, for each virtqueue 86 * callbacks: array of callbacks, for each virtqueue
87 * include a NULL entry for vqs that do not need a callback
87 * names: array of virtqueue names (mainly for debugging) 88 * names: array of virtqueue names (mainly for debugging)
89 * include a NULL entry for vqs unused by driver
88 * Returns 0 on success or error status 90 * Returns 0 on success or error status
89 * @del_vqs: free virtqueues found by find_vqs(). 91 * @del_vqs: free virtqueues found by find_vqs().
90 * @get_features: get the array of feature bits for this device. 92 * @get_features: get the array of feature bits for this device.
@@ -98,6 +100,7 @@
98 * vdev: the virtio_device 100 * vdev: the virtio_device
99 * This returns a pointer to the bus name a la pci_name from which 101 * This returns a pointer to the bus name a la pci_name from which
100 * the caller can then copy. 102 * the caller can then copy.
103 * @set_vq_affinity: set the affinity for a virtqueue.
101 */ 104 */
102typedef void vq_callback_t(struct virtqueue *); 105typedef void vq_callback_t(struct virtqueue *);
103struct virtio_config_ops { 106struct virtio_config_ops {
@@ -116,6 +119,7 @@ struct virtio_config_ops {
116 u32 (*get_features)(struct virtio_device *vdev); 119 u32 (*get_features)(struct virtio_device *vdev);
117 void (*finalize_features)(struct virtio_device *vdev); 120 void (*finalize_features)(struct virtio_device *vdev);
118 const char *(*bus_name)(struct virtio_device *vdev); 121 const char *(*bus_name)(struct virtio_device *vdev);
122 int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
119}; 123};
120 124
121/* If driver didn't advertise the feature, it will never appear. */ 125/* If driver didn't advertise the feature, it will never appear. */
@@ -190,5 +194,24 @@ const char *virtio_bus_name(struct virtio_device *vdev)
190 return vdev->config->bus_name(vdev); 194 return vdev->config->bus_name(vdev);
191} 195}
192 196
197/**
198 * virtqueue_set_affinity - setting affinity for a virtqueue
199 * @vq: the virtqueue
200 * @cpu: the cpu no.
201 *
202 * Pay attention the function are best-effort: the affinity hint may not be set
203 * due to config support, irq type and sharing.
204 *
205 */
206static inline
207int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
208{
209 struct virtio_device *vdev = vq->vdev;
210 if (vdev->config->set_vq_affinity)
211 return vdev->config->set_vq_affinity(vq, cpu);
212 return 0;
213}
214
215
193#endif /* __KERNEL__ */ 216#endif /* __KERNEL__ */
194#endif /* _LINUX_VIRTIO_CONFIG_H */ 217#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index e338730c2660..c2d793a06ad7 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -165,7 +165,8 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
165struct virtio_device; 165struct virtio_device;
166struct virtqueue; 166struct virtqueue;
167 167
168struct virtqueue *vring_new_virtqueue(unsigned int num, 168struct virtqueue *vring_new_virtqueue(unsigned int index,
169 unsigned int num,
169 unsigned int vring_align, 170 unsigned int vring_align,
170 struct virtio_device *vdev, 171 struct virtio_device *vdev,
171 bool weak_barriers, 172 bool weak_barriers,
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index cdcb59450b49..31e4f55773f1 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4200,12 +4200,6 @@ static void buffer_pipe_buf_release(struct pipe_inode_info *pipe,
4200 buf->private = 0; 4200 buf->private = 0;
4201} 4201}
4202 4202
4203static int buffer_pipe_buf_steal(struct pipe_inode_info *pipe,
4204 struct pipe_buffer *buf)
4205{
4206 return 1;
4207}
4208
4209static void buffer_pipe_buf_get(struct pipe_inode_info *pipe, 4203static void buffer_pipe_buf_get(struct pipe_inode_info *pipe,
4210 struct pipe_buffer *buf) 4204 struct pipe_buffer *buf)
4211{ 4205{
@@ -4221,7 +4215,7 @@ static const struct pipe_buf_operations buffer_pipe_buf_ops = {
4221 .unmap = generic_pipe_buf_unmap, 4215 .unmap = generic_pipe_buf_unmap,
4222 .confirm = generic_pipe_buf_confirm, 4216 .confirm = generic_pipe_buf_confirm,
4223 .release = buffer_pipe_buf_release, 4217 .release = buffer_pipe_buf_release,
4224 .steal = buffer_pipe_buf_steal, 4218 .steal = generic_pipe_buf_steal,
4225 .get = buffer_pipe_buf_get, 4219 .get = buffer_pipe_buf_get,
4226}; 4220};
4227 4221
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h
index 8180adde10b7..6ee8826662cc 100644
--- a/security/integrity/ima/ima.h
+++ b/security/integrity/ima/ima.h
@@ -143,7 +143,7 @@ void ima_delete_rules(void);
143#ifdef CONFIG_IMA_APPRAISE 143#ifdef CONFIG_IMA_APPRAISE
144int ima_appraise_measurement(struct integrity_iint_cache *iint, 144int ima_appraise_measurement(struct integrity_iint_cache *iint,
145 struct file *file, const unsigned char *filename); 145 struct file *file, const unsigned char *filename);
146int ima_must_appraise(struct inode *inode, enum ima_hooks func, int mask); 146int ima_must_appraise(struct inode *inode, int mask, enum ima_hooks func);
147void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file); 147void ima_update_xattr(struct integrity_iint_cache *iint, struct file *file);
148 148
149#else 149#else
@@ -154,8 +154,8 @@ static inline int ima_appraise_measurement(struct integrity_iint_cache *iint,
154 return INTEGRITY_UNKNOWN; 154 return INTEGRITY_UNKNOWN;
155} 155}
156 156
157static inline int ima_must_appraise(struct inode *inode, 157static inline int ima_must_appraise(struct inode *inode, int mask,
158 enum ima_hooks func, int mask) 158 enum ima_hooks func)
159{ 159{
160 return 0; 160 return 0;
161} 161}
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index 0aa43bde441c..bdc8ba1d1d27 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -34,7 +34,7 @@ __setup("ima_appraise=", default_appraise_setup);
34 * 34 *
35 * Return 1 to appraise 35 * Return 1 to appraise
36 */ 36 */
37int ima_must_appraise(struct inode *inode, enum ima_hooks func, int mask) 37int ima_must_appraise(struct inode *inode, int mask, enum ima_hooks func)
38{ 38{
39 if (!ima_appraise) 39 if (!ima_appraise)
40 return 0; 40 return 0;
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c
index 24c430f721d4..672af8b56542 100644
--- a/sound/oss/waveartist.c
+++ b/sound/oss/waveartist.c
@@ -1482,9 +1482,9 @@ vnc_mute_spkr(wavnc_info *devc)
1482{ 1482{
1483 unsigned long flags; 1483 unsigned long flags;
1484 1484
1485 spin_lock_irqsave(&nw_gpio_lock, flags); 1485 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
1486 nw_cpld_modify(CPLD_UNMUTE, devc->spkr_mute_state ? 0 : CPLD_UNMUTE); 1486 nw_cpld_modify(CPLD_UNMUTE, devc->spkr_mute_state ? 0 : CPLD_UNMUTE);
1487 spin_unlock_irqrestore(&nw_gpio_lock, flags); 1487 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
1488} 1488}
1489 1489
1490static void 1490static void
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index f759f4f097c7..fd2f9221b241 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -1299,6 +1299,7 @@ static struct device *new_device(const char *name, u16 type)
1299 dev->feature_len = 0; 1299 dev->feature_len = 0;
1300 dev->num_vq = 0; 1300 dev->num_vq = 0;
1301 dev->running = false; 1301 dev->running = false;
1302 dev->next = NULL;
1302 1303
1303 /* 1304 /*
1304 * Append to device list. Prepending to a single-linked list is 1305 * Append to device list. Prepending to a single-linked list is
diff --git a/tools/virtio/virtio-trace/Makefile b/tools/virtio/virtio-trace/Makefile
new file mode 100644
index 000000000000..0d2381633475
--- /dev/null
+++ b/tools/virtio/virtio-trace/Makefile
@@ -0,0 +1,13 @@
1CC = gcc
2CFLAGS = -O2 -Wall -pthread
3
4all: trace-agent
5
6.c.o:
7 $(CC) $(CFLAGS) -c $^ -o $@
8
9trace-agent: trace-agent.o trace-agent-ctl.o trace-agent-rw.o
10 $(CC) $(CFLAGS) -o $@ $^
11
12clean:
13 rm -f *.o trace-agent
diff --git a/tools/virtio/virtio-trace/README b/tools/virtio/virtio-trace/README
new file mode 100644
index 000000000000..b64845b823ab
--- /dev/null
+++ b/tools/virtio/virtio-trace/README
@@ -0,0 +1,118 @@
1Trace Agent for virtio-trace
2============================
3
4Trace agent is a user tool for sending trace data of a guest to a Host in low
5overhead. Trace agent has the following functions:
6 - splice a page of ring-buffer to read_pipe without memory copying
7 - splice the page from write_pipe to virtio-console without memory copying
8 - write trace data to stdout by using -o option
9 - controlled by start/stop orders from a Host
10
11The trace agent operates as follows:
12 1) Initialize all structures.
13 2) Create a read/write thread per CPU. Each thread is bound to a CPU.
14 The read/write threads hold it.
15 3) A controller thread does poll() for a start order of a host.
16 4) After the controller of the trace agent receives a start order from a host,
17 the controller wake read/write threads.
18 5) The read/write threads start to read trace data from ring-buffers and
19 write the data to virtio-serial.
20 6) If the controller receives a stop order from a host, the read/write threads
21 stop to read trace data.
22
23
24Files
25=====
26
27README: this file
28Makefile: Makefile of trace agent for virtio-trace
29trace-agent.c: includes main function, sets up for operating trace agent
30trace-agent.h: includes all structures and some macros
31trace-agent-ctl.c: includes controller function for read/write threads
32trace-agent-rw.c: includes read/write threads function
33
34
35Setup
36=====
37
38To use this trace agent for virtio-trace, we need to prepare some virtio-serial
39I/Fs.
40
411) Make FIFO in a host
42 virtio-trace uses virtio-serial pipe as trace data paths as to the number
43of CPUs and a control path, so FIFO (named pipe) should be created as follows:
44 # mkdir /tmp/virtio-trace/
45 # mkfifo /tmp/virtio-trace/trace-path-cpu{0,1,2,...,X}.{in,out}
46 # mkfifo /tmp/virtio-trace/agent-ctl-path.{in,out}
47
48For example, if a guest use three CPUs, the names are
49 trace-path-cpu{0,1,2}.{in.out}
50and
51 agent-ctl-path.{in,out}.
52
532) Set up of virtio-serial pipe in a host
54 Add qemu option to use virtio-serial pipe.
55
56 ##virtio-serial device##
57 -device virtio-serial-pci,id=virtio-serial0\
58 ##control path##
59 -chardev pipe,id=charchannel0,path=/tmp/virtio-trace/agent-ctl-path\
60 -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\
61 id=channel0,name=agent-ctl-path\
62 ##data path##
63 -chardev pipe,id=charchannel1,path=/tmp/virtio-trace/trace-path-cpu0\
64 -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,\
65 id=channel1,name=trace-path-cpu0\
66 ...
67
68If you manage guests with libvirt, add the following tags to domain XML files.
69Then, libvirt passes the same command option to qemu.
70
71 <channel type='pipe'>
72 <source path='/tmp/virtio-trace/agent-ctl-path'/>
73 <target type='virtio' name='agent-ctl-path'/>
74 <address type='virtio-serial' controller='0' bus='0' port='0'/>
75 </channel>
76 <channel type='pipe'>
77 <source path='/tmp/virtio-trace/trace-path-cpu0'/>
78 <target type='virtio' name='trace-path-cpu0'/>
79 <address type='virtio-serial' controller='0' bus='0' port='1'/>
80 </channel>
81 ...
82Here, chardev names are restricted to trace-path-cpuX and agent-ctl-path. For
83example, if a guest use three CPUs, chardev names should be trace-path-cpu0,
84trace-path-cpu1, trace-path-cpu2, and agent-ctl-path.
85
863) Boot the guest
87 You can find some chardev in /dev/virtio-ports/ in the guest.
88
89
90Run
91===
92
930) Build trace agent in a guest
94 $ make
95
961) Enable ftrace in the guest
97 <Example>
98 # echo 1 > /sys/kernel/debug/tracing/events/sched/enable
99
1002) Run trace agent in the guest
101 This agent must be operated as root.
102 # ./trace-agent
103read/write threads in the agent wait for start order from host. If you add -o
104option, trace data are output via stdout in the guest.
105
1063) Open FIFO in a host
107 # cat /tmp/virtio-trace/trace-path-cpu0.out
108If a host does not open these, trace data get stuck in buffers of virtio. Then,
109the guest will stop by specification of chardev in QEMU. This blocking mode may
110be solved in the future.
111
1124) Start to read trace data by ordering from a host
113 A host injects read start order to the guest via virtio-serial.
114 # echo 1 > /tmp/virtio-trace/agent-ctl-path.in
115
1165) Stop to read trace data by ordering from a host
117 A host injects read stop order to the guest via virtio-serial.
118 # echo 0 > /tmp/virtio-trace/agent-ctl-path.in
diff --git a/tools/virtio/virtio-trace/trace-agent-ctl.c b/tools/virtio/virtio-trace/trace-agent-ctl.c
new file mode 100644
index 000000000000..a2d0403c4f94
--- /dev/null
+++ b/tools/virtio/virtio-trace/trace-agent-ctl.c
@@ -0,0 +1,137 @@
1/*
2 * Controller of read/write threads for virtio-trace
3 *
4 * Copyright (C) 2012 Hitachi, Ltd.
5 * Created by Yoshihiro Yunomae <yoshihiro.yunomae.ez@hitachi.com>
6 * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
7 *
8 * Licensed under GPL version 2 only.
9 *
10 */
11
12#define _GNU_SOURCE
13#include <fcntl.h>
14#include <poll.h>
15#include <signal.h>
16#include <stdio.h>
17#include <stdlib.h>
18#include <unistd.h>
19#include "trace-agent.h"
20
21#define HOST_MSG_SIZE 256
22#define EVENT_WAIT_MSEC 100
23
24static volatile sig_atomic_t global_signal_val;
25bool global_sig_receive; /* default false */
26bool global_run_operation; /* default false*/
27
28/* Handle SIGTERM/SIGINT/SIGQUIT to exit */
29static void signal_handler(int sig)
30{
31 global_signal_val = sig;
32}
33
34int rw_ctl_init(const char *ctl_path)
35{
36 int ctl_fd;
37
38 ctl_fd = open(ctl_path, O_RDONLY);
39 if (ctl_fd == -1) {
40 pr_err("Cannot open ctl_fd\n");
41 goto error;
42 }
43
44 return ctl_fd;
45
46error:
47 exit(EXIT_FAILURE);
48}
49
50static int wait_order(int ctl_fd)
51{
52 struct pollfd poll_fd;
53 int ret = 0;
54
55 while (!global_sig_receive) {
56 poll_fd.fd = ctl_fd;
57 poll_fd.events = POLLIN;
58
59 ret = poll(&poll_fd, 1, EVENT_WAIT_MSEC);
60
61 if (global_signal_val) {
62 global_sig_receive = true;
63 pr_info("Receive interrupt %d\n", global_signal_val);
64
65 /* Wakes rw-threads when they are sleeping */
66 if (!global_run_operation)
67 pthread_cond_broadcast(&cond_wakeup);
68
69 ret = -1;
70 break;
71 }
72
73 if (ret < 0) {
74 pr_err("Polling error\n");
75 goto error;
76 }
77
78 if (ret)
79 break;
80 };
81
82 return ret;
83
84error:
85 exit(EXIT_FAILURE);
86}
87
88/*
89 * contol read/write threads by handling global_run_operation
90 */
91void *rw_ctl_loop(int ctl_fd)
92{
93 ssize_t rlen;
94 char buf[HOST_MSG_SIZE];
95 int ret;
96
97 /* Setup signal handlers */
98 signal(SIGTERM, signal_handler);
99 signal(SIGINT, signal_handler);
100 signal(SIGQUIT, signal_handler);
101
102 while (!global_sig_receive) {
103
104 ret = wait_order(ctl_fd);
105 if (ret < 0)
106 break;
107
108 rlen = read(ctl_fd, buf, sizeof(buf));
109 if (rlen < 0) {
110 pr_err("read data error in ctl thread\n");
111 goto error;
112 }
113
114 if (rlen == 2 && buf[0] == '1') {
115 /*
116 * If host writes '1' to a control path,
117 * this controller wakes all read/write threads.
118 */
119 global_run_operation = true;
120 pthread_cond_broadcast(&cond_wakeup);
121 pr_debug("Wake up all read/write threads\n");
122 } else if (rlen == 2 && buf[0] == '0') {
123 /*
124 * If host writes '0' to a control path, read/write
125 * threads will wait for notification from Host.
126 */
127 global_run_operation = false;
128 pr_debug("Stop all read/write threads\n");
129 } else
130 pr_info("Invalid host notification: %s\n", buf);
131 }
132
133 return NULL;
134
135error:
136 exit(EXIT_FAILURE);
137}
diff --git a/tools/virtio/virtio-trace/trace-agent-rw.c b/tools/virtio/virtio-trace/trace-agent-rw.c
new file mode 100644
index 000000000000..3aace5ea4842
--- /dev/null
+++ b/tools/virtio/virtio-trace/trace-agent-rw.c
@@ -0,0 +1,192 @@
1/*
2 * Read/write thread of a guest agent for virtio-trace
3 *
4 * Copyright (C) 2012 Hitachi, Ltd.
5 * Created by Yoshihiro Yunomae <yoshihiro.yunomae.ez@hitachi.com>
6 * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
7 *
8 * Licensed under GPL version 2 only.
9 *
10 */
11
12#define _GNU_SOURCE
13#include <fcntl.h>
14#include <stdio.h>
15#include <stdlib.h>
16#include <unistd.h>
17#include <sys/syscall.h>
18#include "trace-agent.h"
19
20#define READ_WAIT_USEC 100000
21
22void *rw_thread_info_new(void)
23{
24 struct rw_thread_info *rw_ti;
25
26 rw_ti = zalloc(sizeof(struct rw_thread_info));
27 if (rw_ti == NULL) {
28 pr_err("rw_thread_info zalloc error\n");
29 exit(EXIT_FAILURE);
30 }
31
32 rw_ti->cpu_num = -1;
33 rw_ti->in_fd = -1;
34 rw_ti->out_fd = -1;
35 rw_ti->read_pipe = -1;
36 rw_ti->write_pipe = -1;
37 rw_ti->pipe_size = PIPE_INIT;
38
39 return rw_ti;
40}
41
42void *rw_thread_init(int cpu, const char *in_path, const char *out_path,
43 bool stdout_flag, unsigned long pipe_size,
44 struct rw_thread_info *rw_ti)
45{
46 int data_pipe[2];
47
48 rw_ti->cpu_num = cpu;
49
50 /* set read(input) fd */
51 rw_ti->in_fd = open(in_path, O_RDONLY);
52 if (rw_ti->in_fd == -1) {
53 pr_err("Could not open in_fd (CPU:%d)\n", cpu);
54 goto error;
55 }
56
57 /* set write(output) fd */
58 if (!stdout_flag) {
59 /* virtio-serial output mode */
60 rw_ti->out_fd = open(out_path, O_WRONLY);
61 if (rw_ti->out_fd == -1) {
62 pr_err("Could not open out_fd (CPU:%d)\n", cpu);
63 goto error;
64 }
65 } else
66 /* stdout mode */
67 rw_ti->out_fd = STDOUT_FILENO;
68
69 if (pipe2(data_pipe, O_NONBLOCK) < 0) {
70 pr_err("Could not create pipe in rw-thread(%d)\n", cpu);
71 goto error;
72 }
73
74 /*
75 * Size of pipe is 64kB in default based on fs/pipe.c.
76 * To read/write trace data speedy, pipe size is changed.
77 */
78 if (fcntl(*data_pipe, F_SETPIPE_SZ, pipe_size) < 0) {
79 pr_err("Could not change pipe size in rw-thread(%d)\n", cpu);
80 goto error;
81 }
82
83 rw_ti->read_pipe = data_pipe[1];
84 rw_ti->write_pipe = data_pipe[0];
85 rw_ti->pipe_size = pipe_size;
86
87 return NULL;
88
89error:
90 exit(EXIT_FAILURE);
91}
92
93/* Bind a thread to a cpu */
94static void bind_cpu(int cpu_num)
95{
96 cpu_set_t mask;
97
98 CPU_ZERO(&mask);
99 CPU_SET(cpu_num, &mask);
100
101 /* bind my thread to cpu_num by assigning zero to the first argument */
102 if (sched_setaffinity(0, sizeof(mask), &mask) == -1)
103 pr_err("Could not set CPU#%d affinity\n", (int)cpu_num);
104}
105
106static void *rw_thread_main(void *thread_info)
107{
108 ssize_t rlen, wlen;
109 ssize_t ret;
110 struct rw_thread_info *ts = (struct rw_thread_info *)thread_info;
111
112 bind_cpu(ts->cpu_num);
113
114 while (1) {
115 /* Wait for a read order of trace data by Host OS */
116 if (!global_run_operation) {
117 pthread_mutex_lock(&mutex_notify);
118 pthread_cond_wait(&cond_wakeup, &mutex_notify);
119 pthread_mutex_unlock(&mutex_notify);
120 }
121
122 if (global_sig_receive)
123 break;
124
125 /*
126 * Each thread read trace_pipe_raw of each cpu bounding the
127 * thread, so contention of multi-threads does not occur.
128 */
129 rlen = splice(ts->in_fd, NULL, ts->read_pipe, NULL,
130 ts->pipe_size, SPLICE_F_MOVE | SPLICE_F_MORE);
131
132 if (rlen < 0) {
133 pr_err("Splice_read in rw-thread(%d)\n", ts->cpu_num);
134 goto error;
135 } else if (rlen == 0) {
136 /*
137 * If trace data do not exist or are unreadable not
138 * for exceeding the page size, splice_read returns
139 * NULL. Then, this waits for being filled the data in a
140 * ring-buffer.
141 */
142 usleep(READ_WAIT_USEC);
143 pr_debug("Read retry(cpu:%d)\n", ts->cpu_num);
144 continue;
145 }
146
147 wlen = 0;
148
149 do {
150 ret = splice(ts->write_pipe, NULL, ts->out_fd, NULL,
151 rlen - wlen,
152 SPLICE_F_MOVE | SPLICE_F_MORE);
153
154 if (ret < 0) {
155 pr_err("Splice_write in rw-thread(%d)\n",
156 ts->cpu_num);
157 goto error;
158 } else if (ret == 0)
159 /*
160 * When host reader is not in time for reading
161 * trace data, guest will be stopped. This is
162 * because char dev in QEMU is not supported
163 * non-blocking mode. Then, writer might be
164 * sleep in that case.
165 * This sleep will be removed by supporting
166 * non-blocking mode.
167 */
168 sleep(1);
169 wlen += ret;
170 } while (wlen < rlen);
171 }
172
173 return NULL;
174
175error:
176 exit(EXIT_FAILURE);
177}
178
179
180pthread_t rw_thread_run(struct rw_thread_info *rw_ti)
181{
182 int ret;
183 pthread_t rw_thread_per_cpu;
184
185 ret = pthread_create(&rw_thread_per_cpu, NULL, rw_thread_main, rw_ti);
186 if (ret != 0) {
187 pr_err("Could not create a rw thread(%d)\n", rw_ti->cpu_num);
188 exit(EXIT_FAILURE);
189 }
190
191 return rw_thread_per_cpu;
192}
diff --git a/tools/virtio/virtio-trace/trace-agent.c b/tools/virtio/virtio-trace/trace-agent.c
new file mode 100644
index 000000000000..0a0a7dd4eff7
--- /dev/null
+++ b/tools/virtio/virtio-trace/trace-agent.c
@@ -0,0 +1,270 @@
1/*
2 * Guest agent for virtio-trace
3 *
4 * Copyright (C) 2012 Hitachi, Ltd.
5 * Created by Yoshihiro Yunomae <yoshihiro.yunomae.ez@hitachi.com>
6 * Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
7 *
8 * Licensed under GPL version 2 only.
9 *
10 */
11
12#define _GNU_SOURCE
13#include <limits.h>
14#include <stdio.h>
15#include <stdlib.h>
16#include <unistd.h>
17#include "trace-agent.h"
18
19#define PAGE_SIZE (sysconf(_SC_PAGE_SIZE))
20#define PIPE_DEF_BUFS 16
21#define PIPE_MIN_SIZE (PAGE_SIZE*PIPE_DEF_BUFS)
22#define PIPE_MAX_SIZE (1024*1024)
23#define READ_PATH_FMT \
24 "/sys/kernel/debug/tracing/per_cpu/cpu%d/trace_pipe_raw"
25#define WRITE_PATH_FMT "/dev/virtio-ports/trace-path-cpu%d"
26#define CTL_PATH "/dev/virtio-ports/agent-ctl-path"
27
28pthread_mutex_t mutex_notify = PTHREAD_MUTEX_INITIALIZER;
29pthread_cond_t cond_wakeup = PTHREAD_COND_INITIALIZER;
30
31static int get_total_cpus(void)
32{
33 int nr_cpus = (int)sysconf(_SC_NPROCESSORS_CONF);
34
35 if (nr_cpus <= 0) {
36 pr_err("Could not read cpus\n");
37 goto error;
38 } else if (nr_cpus > MAX_CPUS) {
39 pr_err("Exceed max cpus(%d)\n", (int)MAX_CPUS);
40 goto error;
41 }
42
43 return nr_cpus;
44
45error:
46 exit(EXIT_FAILURE);
47}
48
49static void *agent_info_new(void)
50{
51 struct agent_info *s;
52 int i;
53
54 s = zalloc(sizeof(struct agent_info));
55 if (s == NULL) {
56 pr_err("agent_info zalloc error\n");
57 exit(EXIT_FAILURE);
58 }
59
60 s->pipe_size = PIPE_INIT;
61 s->use_stdout = false;
62 s->cpus = get_total_cpus();
63 s->ctl_fd = -1;
64
65 /* read/write threads init */
66 for (i = 0; i < s->cpus; i++)
67 s->rw_ti[i] = rw_thread_info_new();
68
69 return s;
70}
71
72static unsigned long parse_size(const char *arg)
73{
74 unsigned long value, round;
75 char *ptr;
76
77 value = strtoul(arg, &ptr, 10);
78 switch (*ptr) {
79 case 'K': case 'k':
80 value <<= 10;
81 break;
82 case 'M': case 'm':
83 value <<= 20;
84 break;
85 default:
86 break;
87 }
88
89 if (value > PIPE_MAX_SIZE) {
90 pr_err("Pipe size must be less than 1MB\n");
91 goto error;
92 } else if (value < PIPE_MIN_SIZE) {
93 pr_err("Pipe size must be over 64KB\n");
94 goto error;
95 }
96
97 /* Align buffer size with page unit */
98 round = value & (PAGE_SIZE - 1);
99 value = value - round;
100
101 return value;
102error:
103 return 0;
104}
105
106static void usage(char const *prg)
107{
108 pr_err("usage: %s [-h] [-o] [-s <size of pipe>]\n", prg);
109}
110
111static const char *make_path(int cpu_num, bool this_is_write_path)
112{
113 int ret;
114 char *buf;
115
116 buf = zalloc(PATH_MAX);
117 if (buf == NULL) {
118 pr_err("Could not allocate buffer\n");
119 goto error;
120 }
121
122 if (this_is_write_path)
123 /* write(output) path */
124 ret = snprintf(buf, PATH_MAX, WRITE_PATH_FMT, cpu_num);
125 else
126 /* read(input) path */
127 ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, cpu_num);
128
129 if (ret <= 0) {
130 pr_err("Failed to generate %s path(CPU#%d):%d\n",
131 this_is_write_path ? "read" : "write", cpu_num, ret);
132 goto error;
133 }
134
135 return buf;
136
137error:
138 free(buf);
139 return NULL;
140}
141
142static const char *make_input_path(int cpu_num)
143{
144 return make_path(cpu_num, false);
145}
146
147static const char *make_output_path(int cpu_num)
148{
149 return make_path(cpu_num, true);
150}
151
152static void *agent_info_init(struct agent_info *s)
153{
154 int cpu;
155 const char *in_path = NULL;
156 const char *out_path = NULL;
157
158 /* init read/write threads */
159 for (cpu = 0; cpu < s->cpus; cpu++) {
160 /* set read(input) path per read/write thread */
161 in_path = make_input_path(cpu);
162 if (in_path == NULL)
163 goto error;
164
165 /* set write(output) path per read/write thread*/
166 if (!s->use_stdout) {
167 out_path = make_output_path(cpu);
168 if (out_path == NULL)
169 goto error;
170 } else
171 /* stdout mode */
172 pr_debug("stdout mode\n");
173
174 rw_thread_init(cpu, in_path, out_path, s->use_stdout,
175 s->pipe_size, s->rw_ti[cpu]);
176 }
177
178 /* init controller of read/write threads */
179 s->ctl_fd = rw_ctl_init((const char *)CTL_PATH);
180
181 return NULL;
182
183error:
184 exit(EXIT_FAILURE);
185}
186
187static void *parse_args(int argc, char *argv[], struct agent_info *s)
188{
189 int cmd;
190 unsigned long size;
191
192 while ((cmd = getopt(argc, argv, "hos:")) != -1) {
193 switch (cmd) {
194 /* stdout mode */
195 case 'o':
196 s->use_stdout = true;
197 break;
198 /* size of pipe */
199 case 's':
200 size = parse_size(optarg);
201 if (size == 0)
202 goto error;
203 s->pipe_size = size;
204 break;
205 case 'h':
206 default:
207 usage(argv[0]);
208 goto error;
209 }
210 }
211
212 agent_info_init(s);
213
214 return NULL;
215
216error:
217 exit(EXIT_FAILURE);
218}
219
220static void agent_main_loop(struct agent_info *s)
221{
222 int cpu;
223 pthread_t rw_thread_per_cpu[MAX_CPUS];
224
225 /* Start all read/write threads */
226 for (cpu = 0; cpu < s->cpus; cpu++)
227 rw_thread_per_cpu[cpu] = rw_thread_run(s->rw_ti[cpu]);
228
229 rw_ctl_loop(s->ctl_fd);
230
231 /* Finish all read/write threads */
232 for (cpu = 0; cpu < s->cpus; cpu++) {
233 int ret;
234
235 ret = pthread_join(rw_thread_per_cpu[cpu], NULL);
236 if (ret != 0) {
237 pr_err("pthread_join() error:%d (cpu %d)\n", ret, cpu);
238 exit(EXIT_FAILURE);
239 }
240 }
241}
242
243static void agent_info_free(struct agent_info *s)
244{
245 int i;
246
247 close(s->ctl_fd);
248 for (i = 0; i < s->cpus; i++) {
249 close(s->rw_ti[i]->in_fd);
250 close(s->rw_ti[i]->out_fd);
251 close(s->rw_ti[i]->read_pipe);
252 close(s->rw_ti[i]->write_pipe);
253 free(s->rw_ti[i]);
254 }
255 free(s);
256}
257
258int main(int argc, char *argv[])
259{
260 struct agent_info *s = NULL;
261
262 s = agent_info_new();
263 parse_args(argc, argv, s);
264
265 agent_main_loop(s);
266
267 agent_info_free(s);
268
269 return 0;
270}
diff --git a/tools/virtio/virtio-trace/trace-agent.h b/tools/virtio/virtio-trace/trace-agent.h
new file mode 100644
index 000000000000..8de79bfeaa73
--- /dev/null
+++ b/tools/virtio/virtio-trace/trace-agent.h
@@ -0,0 +1,75 @@
1#ifndef __TRACE_AGENT_H__
2#define __TRACE_AGENT_H__
3#include <pthread.h>
4#include <stdbool.h>
5
6#define MAX_CPUS 256
7#define PIPE_INIT (1024*1024)
8
9/*
10 * agent_info - structure managing total information of guest agent
11 * @pipe_size: size of pipe (default 1MB)
12 * @use_stdout: set to true when o option is added (default false)
13 * @cpus: total number of CPUs
14 * @ctl_fd: fd of control path, /dev/virtio-ports/agent-ctl-path
15 * @rw_ti: structure managing information of read/write threads
16 */
17struct agent_info {
18 unsigned long pipe_size;
19 bool use_stdout;
20 int cpus;
21 int ctl_fd;
22 struct rw_thread_info *rw_ti[MAX_CPUS];
23};
24
25/*
26 * rw_thread_info - structure managing a read/write thread a cpu
27 * @cpu_num: cpu number operating this read/write thread
28 * @in_fd: fd of reading trace data path in cpu_num
29 * @out_fd: fd of writing trace data path in cpu_num
30 * @read_pipe: fd of read pipe
31 * @write_pipe: fd of write pipe
32 * @pipe_size: size of pipe (default 1MB)
33 */
34struct rw_thread_info {
35 int cpu_num;
36 int in_fd;
37 int out_fd;
38 int read_pipe;
39 int write_pipe;
40 unsigned long pipe_size;
41};
42
43/* use for stopping rw threads */
44extern bool global_sig_receive;
45
46/* use for notification */
47extern bool global_run_operation;
48extern pthread_mutex_t mutex_notify;
49extern pthread_cond_t cond_wakeup;
50
51/* for controller of read/write threads */
52extern int rw_ctl_init(const char *ctl_path);
53extern void *rw_ctl_loop(int ctl_fd);
54
55/* for trace read/write thread */
56extern void *rw_thread_info_new(void);
57extern void *rw_thread_init(int cpu, const char *in_path, const char *out_path,
58 bool stdout_flag, unsigned long pipe_size,
59 struct rw_thread_info *rw_ti);
60extern pthread_t rw_thread_run(struct rw_thread_info *rw_ti);
61
62static inline void *zalloc(size_t size)
63{
64 return calloc(1, size);
65}
66
67#define pr_err(format, ...) fprintf(stderr, format, ## __VA_ARGS__)
68#define pr_info(format, ...) fprintf(stdout, format, ## __VA_ARGS__)
69#ifdef DEBUG
70#define pr_debug(format, ...) fprintf(stderr, format, ## __VA_ARGS__)
71#else
72#define pr_debug(format, ...) do {} while (0)
73#endif
74
75#endif /*__TRACE_AGENT_H__*/