aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/Kconfig53
-rw-r--r--arch/arm/Kconfig.debug16
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/Makefile23
-rw-r--r--arch/arm/boot/compressed/.gitignore2
-rw-r--r--arch/arm/boot/compressed/Makefile15
-rw-r--r--arch/arm/boot/compressed/decompress.c6
-rw-r--r--arch/arm/boot/compressed/piggy.xzkern.S6
-rw-r--r--arch/arm/boot/dts/at91sam9g20.dtsi65
-rw-r--r--arch/arm/boot/dts/at91sam9g25ek.dts14
-rw-r--r--arch/arm/boot/dts/at91sam9g45.dtsi66
-rw-r--r--arch/arm/boot/dts/at91sam9m10g45ek.dts48
-rw-r--r--arch/arm/boot/dts/at91sam9x5.dtsi90
-rw-r--r--arch/arm/boot/dts/at91sam9x5cm.dtsi47
-rw-r--r--arch/arm/boot/dts/db8500.dtsi275
-rw-r--r--arch/arm/boot/dts/exynos5250-smdk5250.dts26
-rw-r--r--arch/arm/boot/dts/exynos5250.dtsi413
-rw-r--r--arch/arm/boot/dts/kirkwood-dreamplug.dts13
-rw-r--r--arch/arm/boot/dts/kirkwood.dtsi34
-rw-r--r--arch/arm/boot/dts/snowball.dts139
-rw-r--r--arch/arm/boot/dts/spear600-evb.dts47
-rw-r--r--arch/arm/boot/dts/spear600.dtsi174
-rw-r--r--arch/arm/boot/dts/tegra-cardhu.dts16
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts1
-rw-r--r--arch/arm/boot/dts/tegra20.dtsi1
-rw-r--r--arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi96
-rw-r--r--arch/arm/boot/dts/usb_a9g20.dts76
-rw-r--r--arch/arm/common/Kconfig6
-rw-r--r--arch/arm/common/Makefile2
-rw-r--r--arch/arm/common/gic.c13
-rw-r--r--arch/arm/common/pl330.c1960
-rw-r--r--arch/arm/common/sa1111.c281
-rw-r--r--arch/arm/common/via82c505.c1
-rw-r--r--arch/arm/configs/at91sam9g20_defconfig3
-rw-r--r--arch/arm/configs/integrator_defconfig8
-rw-r--r--arch/arm/configs/u8500_defconfig1
-rw-r--r--arch/arm/include/asm/assembler.h2
-rw-r--r--arch/arm/include/asm/atomic.h4
-rw-r--r--arch/arm/include/asm/barrier.h69
-rw-r--r--arch/arm/include/asm/bitops.h2
-rw-r--r--arch/arm/include/asm/bug.h30
-rw-r--r--arch/arm/include/asm/cmpxchg.h295
-rw-r--r--arch/arm/include/asm/compiler.h15
-rw-r--r--arch/arm/include/asm/cp15.h87
-rw-r--r--arch/arm/include/asm/cpuidle.h29
-rw-r--r--arch/arm/include/asm/div64.h2
-rw-r--r--arch/arm/include/asm/dma.h1
-rw-r--r--arch/arm/include/asm/domain.h4
-rw-r--r--arch/arm/include/asm/elf.h4
-rw-r--r--arch/arm/include/asm/exec.h6
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h6
-rw-r--r--arch/arm/include/asm/hardware/iop3xx.h3
-rw-r--r--arch/arm/include/asm/hardware/iop_adma.h2
-rw-r--r--arch/arm/include/asm/hardware/it8152.h3
-rw-r--r--arch/arm/include/asm/hardware/pl330.h217
-rw-r--r--arch/arm/include/asm/hardware/sa1111.h156
-rw-r--r--arch/arm/include/asm/io.h73
-rw-r--r--arch/arm/include/asm/irq.h8
-rw-r--r--arch/arm/include/asm/jump_label.h41
-rw-r--r--arch/arm/include/asm/mc146818rtc.h4
-rw-r--r--arch/arm/include/asm/memory.h2
-rw-r--r--arch/arm/include/asm/mmu.h7
-rw-r--r--arch/arm/include/asm/mmu_context.h29
-rw-r--r--arch/arm/include/asm/opcodes.h59
-rw-r--r--arch/arm/include/asm/page.h2
-rw-r--r--arch/arm/include/asm/perf_event.h1
-rw-r--r--arch/arm/include/asm/posix_types.h55
-rw-r--r--arch/arm/include/asm/processor.h4
-rw-r--r--arch/arm/include/asm/prom.h2
-rw-r--r--arch/arm/include/asm/switch_to.h18
-rw-r--r--arch/arm/include/asm/system.h552
-rw-r--r--arch/arm/include/asm/system_info.h27
-rw-r--r--arch/arm/include/asm/system_misc.h29
-rw-r--r--arch/arm/include/asm/tlbflush.h136
-rw-r--r--arch/arm/include/asm/traps.h2
-rw-r--r--arch/arm/include/asm/uaccess.h2
-rw-r--r--arch/arm/kernel/Makefile17
-rw-r--r--arch/arm/kernel/armksyms.c1
-rw-r--r--arch/arm/kernel/bios32.c1
-rw-r--r--arch/arm/kernel/cpuidle.c21
-rw-r--r--arch/arm/kernel/debug.S26
-rw-r--r--arch/arm/kernel/elf.c1
-rw-r--r--arch/arm/kernel/entry-armv.S3
-rw-r--r--arch/arm/kernel/fiq.c2
-rw-r--r--arch/arm/kernel/ftrace.c100
-rw-r--r--arch/arm/kernel/head-nommu.S2
-rw-r--r--arch/arm/kernel/head.S10
-rw-r--r--arch/arm/kernel/hw_breakpoint.c1
-rw-r--r--arch/arm/kernel/insn.c62
-rw-r--r--arch/arm/kernel/insn.h29
-rw-r--r--arch/arm/kernel/irq.c6
-rw-r--r--arch/arm/kernel/jump_label.c39
-rw-r--r--arch/arm/kernel/kprobes-common.c1
-rw-r--r--arch/arm/kernel/kprobes.c88
-rw-r--r--arch/arm/kernel/machine_kexec.c27
-rw-r--r--arch/arm/kernel/patch.c75
-rw-r--r--arch/arm/kernel/patch.h7
-rw-r--r--arch/arm/kernel/perf_event.c3
-rw-r--r--arch/arm/kernel/perf_event_v7.c145
-rw-r--r--arch/arm/kernel/process.c37
-rw-r--r--arch/arm/kernel/ptrace.c5
-rw-r--r--arch/arm/kernel/sched_clock.c18
-rw-r--r--arch/arm/kernel/setup.c5
-rw-r--r--arch/arm/kernel/signal.c24
-rw-r--r--arch/arm/kernel/sleep.S1
-rw-r--r--arch/arm/kernel/smp.c24
-rw-r--r--arch/arm/kernel/smp_tlb.c20
-rw-r--r--arch/arm/kernel/tcm.c1
-rw-r--r--arch/arm/kernel/thumbee.c1
-rw-r--r--arch/arm/kernel/time.c4
-rw-r--r--arch/arm/kernel/traps.c21
-rw-r--r--arch/arm/mach-at91/Kconfig10
-rw-r--r--arch/arm/mach-at91/at91rm9200.c1
-rw-r--r--arch/arm/mach-at91/at91sam9260.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c3
-rw-r--r--arch/arm/mach-at91/at91sam9261.c1
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c3
-rw-r--r--arch/arm/mach-at91/at91sam9263.c1
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c6
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c3
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c12
-rw-r--r--arch/arm/mach-at91/at91sam9rl.c1
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c3
-rw-r--r--arch/arm/mach-at91/at91sam9x5.c19
-rw-r--r--arch/arm/mach-at91/at91x40.c1
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c1
-rw-r--r--arch/arm/mach-at91/board-cam60.c1
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c1
-rw-r--r--arch/arm/mach-at91/board-dt.c57
-rw-r--r--arch/arm/mach-at91/board-kb9202.c1
-rw-r--r--arch/arm/mach-at91/board-neocore926.c1
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c2
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c1
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c3
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c3
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c1
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c1
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c2
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c1
-rw-r--r--arch/arm/mach-at91/clock.c56
-rw-r--r--arch/arm/mach-at91/cpuidle.c59
-rw-r--r--arch/arm/mach-at91/generic.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91_shdwc.h4
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9x5.h5
-rw-r--r--arch/arm/mach-at91/include/mach/at_hdmac.h15
-rw-r--r--arch/arm/mach-at91/include/mach/board.h28
-rw-r--r--arch/arm/mach-at91/include/mach/io.h6
-rw-r--r--arch/arm/mach-at91/include/mach/system_rev.h2
-rw-r--r--arch/arm/mach-at91/include/mach/uncompress.h1
-rw-r--r--arch/arm/mach-at91/pm.c13
-rw-r--r--arch/arm/mach-at91/setup.c159
-rw-r--r--arch/arm/mach-bcmring/include/mach/io.h33
-rw-r--r--arch/arm/mach-clps711x/common.c1
-rw-r--r--arch/arm/mach-clps711x/edb7211-mm.c1
-rw-r--r--arch/arm/mach-clps711x/include/mach/io.h36
-rw-r--r--arch/arm/mach-clps711x/include/mach/uncompress.h1
-rw-r--r--arch/arm/mach-clps711x/p720t-leds.c1
-rw-r--r--arch/arm/mach-cns3xxx/core.c8
-rw-r--r--arch/arm/mach-cns3xxx/devices.c2
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/io.h17
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c1
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c109
-rw-r--r--arch/arm/mach-davinci/cpuidle.c83
-rw-r--r--arch/arm/mach-davinci/davinci.h8
-rw-r--r--arch/arm/mach-davinci/dm644x.c166
-rw-r--r--arch/arm/mach-davinci/include/mach/entry-macro.S1
-rw-r--r--arch/arm/mach-davinci/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-davinci/include/mach/io.h24
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h2
-rw-r--r--arch/arm/mach-davinci/time.c28
-rw-r--r--arch/arm/mach-dove/addr-map.c1
-rw-r--r--arch/arm/mach-dove/include/mach/io.h1
-rw-r--r--arch/arm/mach-ebsa110/core.c30
-rw-r--r--arch/arm/mach-ebsa110/core.h41
-rw-r--r--arch/arm/mach-ebsa110/include/mach/hardware.h39
-rw-r--r--arch/arm/mach-ebsa110/include/mach/io.h9
-rw-r--r--arch/arm/mach-ebsa110/io.c20
-rw-r--r--arch/arm/mach-ebsa110/leds.c3
-rw-r--r--arch/arm/mach-ep93xx/include/mach/io.h22
-rw-r--r--arch/arm/mach-exynos/Kconfig29
-rw-r--r--arch/arm/mach-exynos/Makefile5
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c14
-rw-r--r--arch/arm/mach-exynos/clock-exynos5.c1247
-rw-r--r--arch/arm/mach-exynos/common.c465
-rw-r--r--arch/arm/mach-exynos/common.h37
-rw-r--r--arch/arm/mach-exynos/dev-ahci.c4
-rw-r--r--arch/arm/mach-exynos/dev-audio.c4
-rw-r--r--arch/arm/mach-exynos/dev-uart.c78
-rw-r--r--arch/arm/mach-exynos/dma.c8
-rw-r--r--arch/arm/mach-exynos/hotplug.c1
-rw-r--r--arch/arm/mach-exynos/include/mach/debug-macro.S8
-rw-r--r--arch/arm/mach-exynos/include/mach/gpio.h239
-rw-r--r--arch/arm/mach-exynos/include/mach/io.h26
-rw-r--r--arch/arm/mach-exynos/include/mach/irqs.h597
-rw-r--r--arch/arm/mach-exynos/include/mach/map.h45
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-clock.h62
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-gpio.h20
-rw-r--r--arch/arm/mach-exynos/include/mach/regs-pmu.h1
-rw-r--r--arch/arm/mach-exynos/include/mach/uncompress.h32
-rw-r--r--arch/arm/mach-exynos/mach-exynos4-dt.c8
-rw-r--r--arch/arm/mach-exynos/mach-exynos5-dt.c78
-rw-r--r--arch/arm/mach-exynos/mach-nuri.c5
-rw-r--r--arch/arm/mach-exynos/mach-universal_c210.c9
-rw-r--r--arch/arm/mach-exynos/mct.c23
-rw-r--r--arch/arm/mach-exynos/platsmp.c9
-rw-r--r--arch/arm/mach-exynos/pm_domains.c6
-rw-r--r--arch/arm/mach-exynos/setup-i2c0.c9
-rw-r--r--arch/arm/mach-footbridge/common.c1
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c1
-rw-r--r--arch/arm/mach-footbridge/dc21285.c1
-rw-r--r--arch/arm/mach-footbridge/ebsa285-leds.c1
-rw-r--r--arch/arm/mach-footbridge/include/mach/io.h13
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c1
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c1
-rw-r--r--arch/arm/mach-gemini/include/mach/io.h18
-rw-r--r--arch/arm/mach-h720x/common.c1
-rw-r--r--arch/arm/mach-h720x/include/mach/io.h22
-rw-r--r--arch/arm/mach-highbank/highbank.c1
-rw-r--r--arch/arm/mach-highbank/include/mach/io.h7
-rw-r--r--arch/arm/mach-highbank/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-imx/Kconfig6
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/clock-imx27.c1
-rw-r--r--arch/arm/mach-imx/clock-imx35.c2
-rw-r--r--arch/arm/mach-imx/dma-v1.c846
-rw-r--r--arch/arm/mach-imx/include/mach/dma-v1.h103
-rw-r--r--arch/arm/mach-imx/mach-armadillo5x0.c9
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c1
-rw-r--r--arch/arm/mach-imx/mach-kzm_arm11_01.c9
-rw-r--r--arch/arm/mach-imx/mach-mx31lilly.c9
-rw-r--r--arch/arm/mach-imx/mach-mx31lite.c9
-rw-r--r--arch/arm/mach-imx/mach-mx35_3ds.c2
-rw-r--r--arch/arm/mach-imx/mach-mx51_efikamx.c1
-rw-r--r--arch/arm/mach-imx/mach-mx51_efikasb.c1
-rw-r--r--arch/arm/mach-imx/mach-mx53_ard.c8
-rw-r--r--arch/arm/mach-imx/mm-imx3.c11
-rw-r--r--arch/arm/mach-imx/mm-imx5.c1
-rw-r--r--arch/arm/mach-integrator/core.c4
-rw-r--r--arch/arm/mach-integrator/include/mach/io.h1
-rw-r--r--arch/arm/mach-integrator/include/mach/irqs.h3
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c10
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c3
-rw-r--r--arch/arm/mach-integrator/leds.c1
-rw-r--r--arch/arm/mach-integrator/pci.c4
-rw-r--r--arch/arm/mach-integrator/pci_v3.c4
-rw-r--r--arch/arm/mach-iop13xx/include/mach/io.h13
-rw-r--r--arch/arm/mach-iop13xx/include/mach/iop13xx.h1
-rw-r--r--arch/arm/mach-iop13xx/io.c20
-rw-r--r--arch/arm/mach-iop13xx/iq81340mc.c1
-rw-r--r--arch/arm/mach-iop13xx/iq81340sc.c1
-rw-r--r--arch/arm/mach-iop13xx/pci.h6
-rw-r--r--arch/arm/mach-iop32x/include/mach/io.h1
-rw-r--r--arch/arm/mach-iop33x/include/mach/io.h1
-rw-r--r--arch/arm/mach-iop33x/uart.c1
-rw-r--r--arch/arm/mach-ixp2000/core.c1
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c1
-rw-r--r--arch/arm/mach-ixp2000/include/mach/io.h1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c1
-rw-r--r--arch/arm/mach-ixp2000/pci.c1
-rw-r--r--arch/arm/mach-ixp23xx/core.c2
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c1
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/io.h1
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c1
-rw-r--r--arch/arm/mach-ixp23xx/pci.c1
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c1
-rw-r--r--arch/arm/mach-ixp4xx/avila-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c1
-rw-r--r--arch/arm/mach-ixp4xx/common.c34
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c2
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/gateway7001-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/goramo_mlr.c2
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h24
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/platform.h1
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c4
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/omixp-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/vulcan-setup.c1
-rw-r--r--arch/arm/mach-ixp4xx/wg302v2-setup.c1
-rw-r--r--arch/arm/mach-kirkwood/Makefile1
-rw-r--r--arch/arm/mach-kirkwood/board-dreamplug.c152
-rw-r--r--arch/arm/mach-kirkwood/board-dt.c151
-rw-r--r--arch/arm/mach-kirkwood/common.c11
-rw-r--r--arch/arm/mach-kirkwood/common.h15
-rw-r--r--arch/arm/mach-kirkwood/cpuidle.c72
-rw-r--r--arch/arm/mach-kirkwood/include/mach/io.h2
-rw-r--r--arch/arm/mach-ks8695/include/mach/io.h19
-rw-r--r--arch/arm/mach-ks8695/time.c1
-rw-r--r--arch/arm/mach-lpc32xx/Kconfig25
-rw-r--r--arch/arm/mach-lpc32xx/clock.c89
-rw-r--r--arch/arm/mach-lpc32xx/common.c47
-rw-r--r--arch/arm/mach-lpc32xx/common.h4
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/board.h (renamed from arch/arm/mach-lpc32xx/include/mach/io.h)13
-rw-r--r--arch/arm/mach-lpc32xx/irq.c4
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c3
-rw-r--r--arch/arm/mach-mmp/aspenite.c5
-rw-r--r--arch/arm/mach-mmp/avengers_lite.c1
-rw-r--r--arch/arm/mach-mmp/brownstone.c4
-rw-r--r--arch/arm/mach-mmp/common.c1
-rw-r--r--arch/arm/mach-mmp/flint.c3
-rw-r--r--arch/arm/mach-mmp/gplugd.c2
-rw-r--r--arch/arm/mach-mmp/include/mach/addr-map.h6
-rw-r--r--arch/arm/mach-mmp/include/mach/io.h21
-rw-r--r--arch/arm/mach-mmp/include/mach/irqs.h3
-rw-r--r--arch/arm/mach-mmp/irq-mmp2.c1
-rw-r--r--arch/arm/mach-mmp/jasper.c5
-rw-r--r--arch/arm/mach-mmp/pxa168.c1
-rw-r--r--arch/arm/mach-mmp/tavorevb.c1
-rw-r--r--arch/arm/mach-mmp/teton_bga.c3
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c4
-rw-r--r--arch/arm/mach-msm/board-halibut.c6
-rw-r--r--arch/arm/mach-msm/board-sapphire.c1
-rw-r--r--arch/arm/mach-msm/board-trout.c6
-rw-r--r--arch/arm/mach-msm/include/mach/io.h36
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-7x00.h12
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-7x30.h4
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8960.h4
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8x50.h4
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap-8x60.h4
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap.h6
-rw-r--r--arch/arm/mach-msm/include/mach/uncompress.h1
-rw-r--r--arch/arm/mach-msm/io.c8
-rw-r--r--arch/arm/mach-msm/smd_debug.c8
-rw-r--r--arch/arm/mach-msm/timer.c12
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/io.h2
-rw-r--r--arch/arm/mach-mxs/include/mach/dma.h28
-rw-r--r--arch/arm/mach-mxs/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-mxs/include/mach/io.h22
-rw-r--r--arch/arm/mach-mxs/system.c2
-rw-r--r--arch/arm/mach-netx/generic.c2
-rw-r--r--arch/arm/mach-netx/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-netx/include/mach/io.h28
-rw-r--r--arch/arm/mach-netx/include/mach/netx-regs.h16
-rw-r--r--arch/arm/mach-nomadik/include/mach/io.h22
-rw-r--r--arch/arm/mach-omap1/ams-delta-fiq-handler.S1
-rw-r--r--arch/arm/mach-omap1/board-h2.c8
-rw-r--r--arch/arm/mach-omap1/board-h3.c9
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c6
-rw-r--r--arch/arm/mach-omap1/board-innovator.c4
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c2
-rw-r--r--arch/arm/mach-omap1/board-osk.c12
-rw-r--r--arch/arm/mach-omap1/board-palmte.c2
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c2
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c2
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c16
-rw-r--r--arch/arm/mach-omap1/flash.c20
-rw-r--r--arch/arm/mach-omap1/id.c1
-rw-r--r--arch/arm/mach-omap1/include/mach/entry-macro.S1
-rw-r--r--arch/arm/mach-omap1/include/mach/io.h1
-rw-r--r--arch/arm/mach-omap1/iomap.h6
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c1
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c1
-rw-r--r--arch/arm/mach-omap1/leds-osk.c1
-rw-r--r--arch/arm/mach-omap1/mux.c1
-rw-r--r--arch/arm/mach-omap1/pm.c1
-rw-r--r--arch/arm/mach-omap1/sleep.S2
-rw-r--r--arch/arm/mach-omap1/sram.S1
-rw-r--r--arch/arm/mach-omap1/time.c1
-rw-r--r--arch/arm/mach-omap1/timer32k.c1
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c15
-rw-r--r--arch/arm/mach-omap2/board-apollon.c4
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c16
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c2
-rw-r--r--arch/arm/mach-omap2/board-h4.c2
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c6
-rw-r--r--arch/arm/mach-omap2/board-ldp.c7
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c17
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c7
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c16
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c1
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c17
-rw-r--r--arch/arm/mach-omap2/board-overo.c8
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c4
-rw-r--r--arch/arm/mach-omap2/board-zoom-debugboard.c12
-rw-r--r--arch/arm/mach-omap2/board-zoom-peripherals.c6
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c19
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c6
-rw-r--r--arch/arm/mach-omap2/clockdomains44xx_data.c2
-rw-r--r--arch/arm/mach-omap2/common-board-devices.c2
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c42
-rw-r--r--arch/arm/mach-omap2/cpuidle44xx.c21
-rw-r--r--arch/arm/mach-omap2/display.c8
-rw-r--r--arch/arm/mach-omap2/gpmc-smsc911x.c65
-rw-r--r--arch/arm/mach-omap2/hsmmc.c8
-rw-r--r--arch/arm/mach-omap2/hsmmc.h2
-rw-r--r--arch/arm/mach-omap2/include/mach/barriers.h2
-rw-r--r--arch/arm/mach-omap2/include/mach/io.h49
-rw-r--r--arch/arm/mach-omap2/iomap.h6
-rw-r--r--arch/arm/mach-omap2/mux.c1
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c1
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c96
-rw-r--r--arch/arm/mach-omap2/omap_hwmod_44xx_data.c28
-rw-r--r--arch/arm/mach-omap2/opp.c4
-rw-r--r--arch/arm/mach-omap2/pm.c2
-rw-r--r--arch/arm/mach-omap2/pm24xx.c1
-rw-r--r--arch/arm/mach-omap2/pm34xx.c39
-rw-r--r--arch/arm/mach-omap2/pm44xx.c11
-rw-r--r--arch/arm/mach-omap2/powerdomain.c8
-rw-r--r--arch/arm/mach-omap2/prm44xx.c21
-rw-r--r--arch/arm/mach-omap2/prm_common.c2
-rw-r--r--arch/arm/mach-omap2/sleep44xx.S1
-rw-r--r--arch/arm/mach-omap2/usb-host.c10
-rw-r--r--arch/arm/mach-orion5x/common.c1
-rw-r--r--arch/arm/mach-orion5x/common.h9
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c1
-rw-r--r--arch/arm/mach-orion5x/include/mach/io.h33
-rw-r--r--arch/arm/mach-orion5x/ls-chl-setup.c1
-rw-r--r--arch/arm/mach-orion5x/ls_hgl-setup.c1
-rw-r--r--arch/arm/mach-orion5x/lsmini-setup.c1
-rw-r--r--arch/arm/mach-orion5x/pci.c1
-rw-r--r--arch/arm/mach-orion5x/tsx09-common.c1
-rw-r--r--arch/arm/mach-picoxcell/include/mach/io.h22
-rw-r--r--arch/arm/mach-picoxcell/include/mach/irqs.h20
-rw-r--r--arch/arm/mach-pnx4008/core.c2
-rw-r--r--arch/arm/mach-pnx4008/dma.c1
-rw-r--r--arch/arm/mach-pnx4008/include/mach/io.h21
-rw-r--r--arch/arm/mach-pnx4008/irq.c1
-rw-r--r--arch/arm/mach-pnx4008/time.c1
-rw-r--r--arch/arm/mach-prima2/include/mach/io.h16
-rw-r--r--arch/arm/mach-prima2/timer.c21
-rw-r--r--arch/arm/mach-pxa/Kconfig2
-rw-r--r--arch/arm/mach-pxa/capc7117.c1
-rw-r--r--arch/arm/mach-pxa/clock-pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/cm-x300.c3
-rw-r--r--arch/arm/mach-pxa/colibri-pxa270.c2
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c1
-rw-r--r--arch/arm/mach-pxa/colibri-pxa320.c1
-rw-r--r--arch/arm/mach-pxa/colibri-pxa3xx.c1
-rw-r--r--arch/arm/mach-pxa/corgi.c4
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c1
-rw-r--r--arch/arm/mach-pxa/cpufreq-pxa3xx.c1
-rw-r--r--arch/arm/mach-pxa/csb726.c1
-rw-r--r--arch/arm/mach-pxa/devices.c1
-rw-r--r--arch/arm/mach-pxa/em-x270.c12
-rw-r--r--arch/arm/mach-pxa/generic.c1
-rw-r--r--arch/arm/mach-pxa/gumstix.c1
-rw-r--r--arch/arm/mach-pxa/h5000.c1
-rw-r--r--arch/arm/mach-pxa/himalaya.c1
-rw-r--r--arch/arm/mach-pxa/hx4700.c2
-rw-r--r--arch/arm/mach-pxa/icontrol.c1
-rw-r--r--arch/arm/mach-pxa/idp.c1
-rw-r--r--arch/arm/mach-pxa/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-pxa/include/mach/io.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/mainstone.h2
-rw-r--r--arch/arm/mach-pxa/leds-idp.c1
-rw-r--r--arch/arm/mach-pxa/leds-lubbock.c1
-rw-r--r--arch/arm/mach-pxa/leds-mainstone.c1
-rw-r--r--arch/arm/mach-pxa/lubbock.c1
-rw-r--r--arch/arm/mach-pxa/magician.c3
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/mioa701.c1
-rw-r--r--arch/arm/mach-pxa/mp900.c1
-rw-r--r--arch/arm/mach-pxa/palmld.c1
-rw-r--r--arch/arm/mach-pxa/palmt5.c1
-rw-r--r--arch/arm/mach-pxa/palmtc.c1
-rw-r--r--arch/arm/mach-pxa/palmte2.c1
-rw-r--r--arch/arm/mach-pxa/palmtreo.c2
-rw-r--r--arch/arm/mach-pxa/palmtx.c1
-rw-r--r--arch/arm/mach-pxa/palmz72.c1
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/pxa2xx.c1
-rw-r--r--arch/arm/mach-pxa/pxa300.c1
-rw-r--r--arch/arm/mach-pxa/pxa320.c1
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c1
-rw-r--r--arch/arm/mach-pxa/raumfeld.c5
-rw-r--r--arch/arm/mach-pxa/reset.c1
-rw-r--r--arch/arm/mach-pxa/saar.c1
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c1
-rw-r--r--arch/arm/mach-pxa/spitz.c3
-rw-r--r--arch/arm/mach-pxa/stargate2.c3
-rw-r--r--arch/arm/mach-pxa/tavorevb.c1
-rw-r--r--arch/arm/mach-pxa/time.c1
-rw-r--r--arch/arm/mach-pxa/trizeps4.c2
-rw-r--r--arch/arm/mach-pxa/viper.c2
-rw-r--r--arch/arm/mach-pxa/vpac270.c1
-rw-r--r--arch/arm/mach-pxa/xcep.c1
-rw-r--r--arch/arm/mach-pxa/z2.c1
-rw-r--r--arch/arm/mach-pxa/zeus.c1
-rw-r--r--arch/arm/mach-realview/core.c1
-rw-r--r--arch/arm/mach-realview/hotplug.c1
-rw-r--r--arch/arm/mach-realview/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-realview/include/mach/io.h28
-rw-r--r--arch/arm/mach-rpc/Makefile2
-rw-r--r--arch/arm/mach-rpc/ecard.c (renamed from arch/arm/kernel/ecard.c)134
-rw-r--r--arch/arm/mach-rpc/ecard.h (renamed from arch/arm/kernel/ecard.h)0
-rw-r--r--arch/arm/mach-rpc/include/mach/hardware.h6
-rw-r--r--arch/arm/mach-rpc/include/mach/io.h5
-rw-r--r--arch/arm/mach-rpc/include/mach/irqs.h2
-rw-r--r--arch/arm/mach-rpc/riscpc.c46
-rw-r--r--arch/arm/mach-rpc/time.c (renamed from arch/arm/common/time-acorn.c)2
-rw-r--r--arch/arm/mach-s3c24xx/common.h18
-rw-r--r--arch/arm/mach-s3c24xx/include/mach/io.h5
-rw-r--r--arch/arm/mach-s3c24xx/s3c2410.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2412.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2416.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c2443.c1
-rw-r--r--arch/arm/mach-s3c24xx/s3c244x.c1
-rw-r--r--arch/arm/mach-s3c24xx/simtec-nor.c3
-rw-r--r--arch/arm/mach-s3c64xx/common.c1
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/io.h18
-rw-r--r--arch/arm/mach-s3c64xx/mach-crag6410-module.c14
-rw-r--r--arch/arm/mach-s5p64x0/common.c1
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/io.h25
-rw-r--r--arch/arm/mach-s5pc100/common.c1
-rw-r--r--arch/arm/mach-s5pc100/include/mach/io.h18
-rw-r--r--arch/arm/mach-s5pv210/include/mach/io.h26
-rw-r--r--arch/arm/mach-sa1100/Makefile2
-rw-r--r--arch/arm/mach-sa1100/assabet.c194
-rw-r--r--arch/arm/mach-sa1100/badge4.c42
-rw-r--r--arch/arm/mach-sa1100/cerf.c17
-rw-r--r--arch/arm/mach-sa1100/collie.c59
-rw-r--r--arch/arm/mach-sa1100/dma.c348
-rw-r--r--arch/arm/mach-sa1100/generic.c153
-rw-r--r--arch/arm/mach-sa1100/generic.h7
-rw-r--r--arch/arm/mach-sa1100/h3100.c25
-rw-r--r--arch/arm/mach-sa1100/h3600.c34
-rw-r--r--arch/arm/mach-sa1100/h3xxx.c13
-rw-r--r--arch/arm/mach-sa1100/hackkit.c13
-rw-r--r--arch/arm/mach-sa1100/include/mach/SA-1100.h229
-rw-r--r--arch/arm/mach-sa1100/include/mach/collie.h3
-rw-r--r--arch/arm/mach-sa1100/include/mach/dma.h117
-rw-r--r--arch/arm/mach-sa1100/include/mach/io.h20
-rw-r--r--arch/arm/mach-sa1100/include/mach/irqs.h27
-rw-r--r--arch/arm/mach-sa1100/include/mach/mcp.h2
-rw-r--r--arch/arm/mach-sa1100/include/mach/neponset.h52
-rw-r--r--arch/arm/mach-sa1100/include/mach/shannon.h2
-rw-r--r--arch/arm/mach-sa1100/irq.c8
-rw-r--r--arch/arm/mach-sa1100/jornada720.c46
-rw-r--r--arch/arm/mach-sa1100/lart.c82
-rw-r--r--arch/arm/mach-sa1100/leds-assabet.c1
-rw-r--r--arch/arm/mach-sa1100/leds-badge4.c1
-rw-r--r--arch/arm/mach-sa1100/leds-cerf.c1
-rw-r--r--arch/arm/mach-sa1100/leds-hackkit.c1
-rw-r--r--arch/arm/mach-sa1100/leds-lart.c1
-rw-r--r--arch/arm/mach-sa1100/nanoengine.c13
-rw-r--r--arch/arm/mach-sa1100/neponset.c549
-rw-r--r--arch/arm/mach-sa1100/pci-nanoengine.c8
-rw-r--r--arch/arm/mach-sa1100/pleb.c25
-rw-r--r--arch/arm/mach-sa1100/pm.c1
-rw-r--r--arch/arm/mach-sa1100/shannon.c27
-rw-r--r--arch/arm/mach-sa1100/simpad.c24
-rw-r--r--arch/arm/mach-sa1100/sleep.S37
-rw-r--r--arch/arm/mach-sa1100/ssp.c2
-rw-r--r--arch/arm/mach-sa1100/time.c1
-rw-r--r--arch/arm/mach-shark/core.c1
-rw-r--r--arch/arm/mach-shark/include/mach/io.h2
-rw-r--r--arch/arm/mach-shark/leds.c1
-rw-r--r--arch/arm/mach-shmobile/Kconfig4
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c3
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c1
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c3
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c1
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c1
-rw-r--r--arch/arm/mach-shmobile/board-kota2.c3
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c83
-rw-r--r--arch/arm/mach-shmobile/board-marzen.c1
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c4
-rw-r--r--arch/arm/mach-shmobile/cpuidle.c32
-rw-r--r--arch/arm/mach-shmobile/include/mach/io.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h6
-rw-r--r--arch/arm/mach-shmobile/include/mach/system.h2
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7740.c1
-rw-r--r--arch/arm/mach-shmobile/intc-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/intc-sh7367.c1
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c1
-rw-r--r--arch/arm/mach-shmobile/intc-sh7377.c1
-rw-r--r--arch/arm/mach-shmobile/intc-sh73a0.c5
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7779.c1
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c1
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7740.c1
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c8
-rw-r--r--arch/arm/mach-shmobile/setup-sh7377.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh73a0.c1
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7779.c4
-rw-r--r--arch/arm/mach-shmobile/smp-sh73a0.c20
-rw-r--r--arch/arm/mach-shmobile/suspend.c2
-rw-r--r--arch/arm/mach-spear3xx/clock.c1
-rw-r--r--arch/arm/mach-spear3xx/include/mach/io.h19
-rw-r--r--arch/arm/mach-spear6xx/Kconfig7
-rw-r--r--arch/arm/mach-spear6xx/Makefile6
-rw-r--r--arch/arm/mach-spear6xx/clock.c15
-rw-r--r--arch/arm/mach-spear6xx/include/mach/io.h20
-rw-r--r--arch/arm/mach-spear6xx/spear600.c25
-rw-r--r--arch/arm/mach-spear6xx/spear600_evb.c54
-rw-r--r--arch/arm/mach-spear6xx/spear6xx.c132
-rw-r--r--arch/arm/mach-tegra/Makefile2
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra20.c6
-rw-r--r--arch/arm/mach-tegra/board-dt-tegra30.c2
-rw-r--r--arch/arm/mach-tegra/common.c4
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c1
-rw-r--r--arch/arm/mach-tegra/devices.c7
-rw-r--r--arch/arm/mach-tegra/devices.h5
-rw-r--r--arch/arm/mach-tegra/flowctrl.c62
-rw-r--r--arch/arm/mach-tegra/flowctrl.h5
-rw-r--r--arch/arm/mach-tegra/fuse.c18
-rw-r--r--arch/arm/mach-tegra/fuse.h4
-rw-r--r--arch/arm/mach-tegra/headsmp.S167
-rw-r--r--arch/arm/mach-tegra/hotplug.c1
-rw-r--r--arch/arm/mach-tegra/include/mach/debug-macro.S1
-rw-r--r--arch/arm/mach-tegra/include/mach/io.h49
-rw-r--r--arch/arm/mach-tegra/include/mach/iomap.h45
-rw-r--r--arch/arm/mach-tegra/include/mach/powergate.h15
-rw-r--r--arch/arm/mach-tegra/io.c1
-rw-r--r--arch/arm/mach-tegra/platsmp.c137
-rw-r--r--arch/arm/mach-tegra/powergate.c53
-rw-r--r--arch/arm/mach-tegra/reset.c84
-rw-r--r--arch/arm/mach-tegra/reset.h50
-rw-r--r--arch/arm/mach-tegra/sleep.S4
-rw-r--r--arch/arm/mach-u300/core.c2
-rw-r--r--arch/arm/mach-u300/include/mach/io.h20
-rw-r--r--arch/arm/mach-u300/include/mach/u300-regs.h11
-rw-r--r--arch/arm/mach-ux500/Kconfig7
-rw-r--r--arch/arm/mach-ux500/Makefile.boot1
-rw-r--r--arch/arm/mach-ux500/board-mop500-sdi.c31
-rw-r--r--arch/arm/mach-ux500/board-mop500.c171
-rw-r--r--arch/arm/mach-ux500/board-mop500.h8
-rw-r--r--arch/arm/mach-ux500/board-u5500-sdi.c4
-rw-r--r--arch/arm/mach-ux500/board-u5500.c27
-rw-r--r--arch/arm/mach-ux500/cache-l2x0.c7
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c36
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c44
-rw-r--r--arch/arm/mach-ux500/cpu.c89
-rw-r--r--arch/arm/mach-ux500/devices-common.c79
-rw-r--r--arch/arm/mach-ux500/devices-common.h83
-rw-r--r--arch/arm/mach-ux500/devices-db5500.h116
-rw-r--r--arch/arm/mach-ux500/devices-db8500.h176
-rw-r--r--arch/arm/mach-ux500/dma-db5500.c3
-rw-r--r--arch/arm/mach-ux500/include/mach/db8500-regs.h3
-rw-r--r--arch/arm/mach-ux500/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-ux500/include/mach/io.h22
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-board-mop500.h2
-rw-r--r--arch/arm/mach-ux500/include/mach/setup.h10
-rw-r--r--arch/arm/mach-ux500/include/mach/usb.h4
-rw-r--r--arch/arm/mach-ux500/timer.c11
-rw-r--r--arch/arm/mach-ux500/usb.c7
-rw-r--r--arch/arm/mach-versatile/core.c1
-rw-r--r--arch/arm/mach-versatile/include/mach/io.h28
-rw-r--r--arch/arm/mach-versatile/pci.c11
-rw-r--r--arch/arm/mach-vexpress/hotplug.c2
-rw-r--r--arch/arm/mach-vexpress/include/mach/io.h26
-rw-r--r--arch/arm/mach-vt8500/include/mach/io.h26
-rw-r--r--arch/arm/mach-w90x900/cpu.c1
-rw-r--r--arch/arm/mach-w90x900/dev.c1
-rw-r--r--arch/arm/mach-w90x900/include/mach/io.h30
-rw-r--r--arch/arm/mach-zynq/include/mach/io.h33
-rw-r--r--arch/arm/mm/alignment.c3
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c1
-rw-r--r--arch/arm/mm/cache-l2x0.c22
-rw-r--r--arch/arm/mm/cache-tauros2.c1
-rw-r--r--arch/arm/mm/cache-xsc3l2.c2
-rw-r--r--arch/arm/mm/copypage-v4mc.c9
-rw-r--r--arch/arm/mm/copypage-v6.c20
-rw-r--r--arch/arm/mm/copypage-xscale.c9
-rw-r--r--arch/arm/mm/dma-mapping.c20
-rw-r--r--arch/arm/mm/fault.c6
-rw-r--r--arch/arm/mm/flush.c15
-rw-r--r--arch/arm/mm/highmem.c21
-rw-r--r--arch/arm/mm/idmap.c1
-rw-r--r--arch/arm/mm/init.c4
-rw-r--r--arch/arm/mm/ioremap.c19
-rw-r--r--arch/arm/mm/mm.h26
-rw-r--r--arch/arm/mm/mmu.c9
-rw-r--r--arch/arm/mm/nommu.c8
-rw-r--r--arch/arm/mm/pgd.c1
-rw-r--r--arch/arm/mm/proc-fa526.S1
-rw-r--r--arch/arm/mm/vmregion.c76
-rw-r--r--arch/arm/mm/vmregion.h5
-rw-r--r--arch/arm/net/Makefile3
-rw-r--r--arch/arm/net/bpf_jit_32.c915
-rw-r--r--arch/arm/net/bpf_jit_32.h190
-rw-r--r--arch/arm/nwfpe/fpa11.c1
-rw-r--r--arch/arm/plat-iop/i2c.c1
-rw-r--r--arch/arm/plat-iop/pci.c1
-rw-r--r--arch/arm/plat-iop/restart.c1
-rw-r--r--arch/arm/plat-mxc/3ds_debugboard.c2
-rw-r--r--arch/arm/plat-mxc/include/mach/hardware.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/io.h39
-rw-r--r--arch/arm/plat-mxc/system.c2
-rw-r--r--arch/arm/plat-nomadik/Kconfig1
-rw-r--r--arch/arm/plat-nomadik/include/plat/ste_dma40.h3
-rw-r--r--arch/arm/plat-omap/Kconfig1
-rw-r--r--arch/arm/plat-omap/clock.c5
-rw-r--r--arch/arm/plat-omap/debug-leds.c1
-rw-r--r--arch/arm/plat-omap/dma.c1
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h26
-rw-r--r--arch/arm/plat-omap/include/plat/hardware.h6
-rw-r--r--arch/arm/plat-omap/include/plat/mmc.h2
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h12
-rw-r--r--arch/arm/plat-omap/include/plat/sdrc.h1
-rw-r--r--arch/arm/plat-omap/include/plat/usb.h1
-rw-r--r--arch/arm/plat-orion/common.c7
-rw-r--r--arch/arm/plat-orion/include/plat/audio.h1
-rw-r--r--arch/arm/plat-pxa/dma.c1
-rw-r--r--arch/arm/plat-s3c24xx/cpu.c2
-rw-r--r--arch/arm/plat-s3c24xx/dma.c1
-rw-r--r--arch/arm/plat-s5p/Kconfig8
-rw-r--r--arch/arm/plat-s5p/Makefile3
-rw-r--r--arch/arm/plat-s5p/clock.c36
-rw-r--r--arch/arm/plat-s5p/irq-pm.c25
-rw-r--r--arch/arm/plat-samsung/cpu.c1
-rw-r--r--arch/arm/plat-samsung/dma-ops.c4
-rw-r--r--arch/arm/plat-samsung/include/plat/cpu.h10
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/s5p-clock.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/uncompress.h2
-rw-r--r--arch/arm/plat-samsung/irq-vic-timer.c16
-rw-r--r--arch/arm/plat-samsung/time.c1
-rw-r--r--arch/arm/plat-spear/include/plat/hardware.h6
-rw-r--r--arch/arm/plat-spear/include/plat/io.h22
-rw-r--r--arch/arm/plat-spear/include/plat/keyboard.h7
-rw-r--r--arch/arm/plat-spear/restart.c1
-rw-r--r--arch/arm/plat-versatile/Kconfig3
-rw-r--r--arch/arm/vfp/vfpmodule.c2
729 files changed, 11542 insertions, 9283 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 94422601ea5b..cf006d40342c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -9,6 +9,7 @@ config ARM
9 select SYS_SUPPORTS_APM_EMULATION 9 select SYS_SUPPORTS_APM_EMULATION
10 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI) 10 select GENERIC_ATOMIC64 if (CPU_V6 || !CPU_32v6K || !AEABI)
11 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 11 select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
12 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
12 select HAVE_ARCH_KGDB 13 select HAVE_ARCH_KGDB
13 select HAVE_KPROBES if !XIP_KERNEL 14 select HAVE_KPROBES if !XIP_KERNEL
14 select HAVE_KRETPROBES if (HAVE_KPROBES) 15 select HAVE_KRETPROBES if (HAVE_KPROBES)
@@ -21,6 +22,7 @@ config ARM
21 select HAVE_KERNEL_GZIP 22 select HAVE_KERNEL_GZIP
22 select HAVE_KERNEL_LZO 23 select HAVE_KERNEL_LZO
23 select HAVE_KERNEL_LZMA 24 select HAVE_KERNEL_LZMA
25 select HAVE_KERNEL_XZ
24 select HAVE_IRQ_WORK 26 select HAVE_IRQ_WORK
25 select HAVE_PERF_EVENTS 27 select HAVE_PERF_EVENTS
26 select PERF_USE_VMALLOC 28 select PERF_USE_VMALLOC
@@ -28,10 +30,10 @@ config ARM
28 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)) 30 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
29 select HAVE_C_RECORDMCOUNT 31 select HAVE_C_RECORDMCOUNT
30 select HAVE_GENERIC_HARDIRQS 32 select HAVE_GENERIC_HARDIRQS
31 select HAVE_SPARSE_IRQ
32 select GENERIC_IRQ_SHOW 33 select GENERIC_IRQ_SHOW
33 select CPU_PM if (SUSPEND || CPU_IDLE) 34 select CPU_PM if (SUSPEND || CPU_IDLE)
34 select GENERIC_PCI_IOMAP 35 select GENERIC_PCI_IOMAP
36 select HAVE_BPF_JIT if NET
35 help 37 help
36 The ARM series is a line of low-power-consumption RISC chip designs 38 The ARM series is a line of low-power-consumption RISC chip designs
37 licensed by ARM Ltd and targeted at embedded applications and 39 licensed by ARM Ltd and targeted at embedded applications and
@@ -52,9 +54,6 @@ config MIGHT_HAVE_PCI
52config SYS_SUPPORTS_APM_EMULATION 54config SYS_SUPPORTS_APM_EMULATION
53 bool 55 bool
54 56
55config HAVE_SCHED_CLOCK
56 bool
57
58config GENERIC_GPIO 57config GENERIC_GPIO
59 bool 58 bool
60 59
@@ -180,6 +179,9 @@ config ZONE_DMA
180config NEED_DMA_MAP_STATE 179config NEED_DMA_MAP_STATE
181 def_bool y 180 def_bool y
182 181
182config ARCH_HAS_DMA_SET_COHERENT_MASK
183 bool
184
183config GENERIC_ISA_DMA 185config GENERIC_ISA_DMA
184 bool 186 bool
185 187
@@ -217,6 +219,13 @@ config ARM_PATCH_PHYS_VIRT
217 this feature (eg, building a kernel for a single machine) and 219 this feature (eg, building a kernel for a single machine) and
218 you need to shrink the kernel to the minimal size. 220 you need to shrink the kernel to the minimal size.
219 221
222config NEED_MACH_IO_H
223 bool
224 help
225 Select this when mach/io.h is required to provide special
226 definitions for this platform. The need for mach/io.h should
227 be avoided when possible.
228
220config NEED_MACH_MEMORY_H 229config NEED_MACH_MEMORY_H
221 bool 230 bool
222 help 231 help
@@ -268,7 +277,9 @@ config ARCH_INTEGRATOR
268 select GENERIC_CLOCKEVENTS 277 select GENERIC_CLOCKEVENTS
269 select PLAT_VERSATILE 278 select PLAT_VERSATILE
270 select PLAT_VERSATILE_FPGA_IRQ 279 select PLAT_VERSATILE_FPGA_IRQ
280 select NEED_MACH_IO_H
271 select NEED_MACH_MEMORY_H 281 select NEED_MACH_MEMORY_H
282 select SPARSE_IRQ
272 help 283 help
273 Support for ARM's Integrator platform. 284 Support for ARM's Integrator platform.
274 285
@@ -315,6 +326,7 @@ config ARCH_VEXPRESS
315 select HAVE_CLK 326 select HAVE_CLK
316 select HAVE_PATA_PLATFORM 327 select HAVE_PATA_PLATFORM
317 select ICST 328 select ICST
329 select NO_IOPORT
318 select PLAT_VERSATILE 330 select PLAT_VERSATILE
319 select PLAT_VERSATILE_CLCD 331 select PLAT_VERSATILE_CLCD
320 help 332 help
@@ -326,6 +338,7 @@ config ARCH_AT91
326 select HAVE_CLK 338 select HAVE_CLK
327 select CLKDEV_LOOKUP 339 select CLKDEV_LOOKUP
328 select IRQ_DOMAIN 340 select IRQ_DOMAIN
341 select NEED_MACH_IO_H if PCCARD
329 help 342 help
330 This enables support for systems based on the Atmel AT91RM9200, 343 This enables support for systems based on the Atmel AT91RM9200,
331 AT91SAM9 processors. 344 AT91SAM9 processors.
@@ -354,6 +367,7 @@ config ARCH_HIGHBANK
354 select GENERIC_CLOCKEVENTS 367 select GENERIC_CLOCKEVENTS
355 select HAVE_ARM_SCU 368 select HAVE_ARM_SCU
356 select HAVE_SMP 369 select HAVE_SMP
370 select SPARSE_IRQ
357 select USE_OF 371 select USE_OF
358 help 372 help
359 Support for the Calxeda Highbank SoC based boards. 373 Support for the Calxeda Highbank SoC based boards.
@@ -404,6 +418,7 @@ config ARCH_EBSA110
404 select ISA 418 select ISA
405 select NO_IOPORT 419 select NO_IOPORT
406 select ARCH_USES_GETTIMEOFFSET 420 select ARCH_USES_GETTIMEOFFSET
421 select NEED_MACH_IO_H
407 select NEED_MACH_MEMORY_H 422 select NEED_MACH_MEMORY_H
408 help 423 help
409 This is an evaluation board for the StrongARM processor available 424 This is an evaluation board for the StrongARM processor available
@@ -430,6 +445,7 @@ config ARCH_FOOTBRIDGE
430 select FOOTBRIDGE 445 select FOOTBRIDGE
431 select GENERIC_CLOCKEVENTS 446 select GENERIC_CLOCKEVENTS
432 select HAVE_IDE 447 select HAVE_IDE
448 select NEED_MACH_IO_H
433 select NEED_MACH_MEMORY_H 449 select NEED_MACH_MEMORY_H
434 help 450 help
435 Support for systems based on the DC21285 companion chip 451 Support for systems based on the DC21285 companion chip
@@ -442,7 +458,6 @@ config ARCH_MXC
442 select CLKDEV_LOOKUP 458 select CLKDEV_LOOKUP
443 select CLKSRC_MMIO 459 select CLKSRC_MMIO
444 select GENERIC_IRQ_CHIP 460 select GENERIC_IRQ_CHIP
445 select HAVE_SCHED_CLOCK
446 select MULTI_IRQ_HANDLER 461 select MULTI_IRQ_HANDLER
447 help 462 help
448 Support for Freescale MXC/iMX-based family of processors 463 Support for Freescale MXC/iMX-based family of processors
@@ -482,6 +497,7 @@ config ARCH_IOP13XX
482 select PCI 497 select PCI
483 select ARCH_SUPPORTS_MSI 498 select ARCH_SUPPORTS_MSI
484 select VMSPLIT_1G 499 select VMSPLIT_1G
500 select NEED_MACH_IO_H
485 select NEED_MACH_MEMORY_H 501 select NEED_MACH_MEMORY_H
486 select NEED_RET_TO_USER 502 select NEED_RET_TO_USER
487 help 503 help
@@ -491,6 +507,7 @@ config ARCH_IOP32X
491 bool "IOP32x-based" 507 bool "IOP32x-based"
492 depends on MMU 508 depends on MMU
493 select CPU_XSCALE 509 select CPU_XSCALE
510 select NEED_MACH_IO_H
494 select NEED_RET_TO_USER 511 select NEED_RET_TO_USER
495 select PLAT_IOP 512 select PLAT_IOP
496 select PCI 513 select PCI
@@ -503,6 +520,7 @@ config ARCH_IOP33X
503 bool "IOP33x-based" 520 bool "IOP33x-based"
504 depends on MMU 521 depends on MMU
505 select CPU_XSCALE 522 select CPU_XSCALE
523 select NEED_MACH_IO_H
506 select NEED_RET_TO_USER 524 select NEED_RET_TO_USER
507 select PLAT_IOP 525 select PLAT_IOP
508 select PCI 526 select PCI
@@ -516,6 +534,7 @@ config ARCH_IXP23XX
516 select CPU_XSC3 534 select CPU_XSC3
517 select PCI 535 select PCI
518 select ARCH_USES_GETTIMEOFFSET 536 select ARCH_USES_GETTIMEOFFSET
537 select NEED_MACH_IO_H
519 select NEED_MACH_MEMORY_H 538 select NEED_MACH_MEMORY_H
520 help 539 help
521 Support for Intel's IXP23xx (XScale) family of processors. 540 Support for Intel's IXP23xx (XScale) family of processors.
@@ -526,6 +545,7 @@ config ARCH_IXP2000
526 select CPU_XSCALE 545 select CPU_XSCALE
527 select PCI 546 select PCI
528 select ARCH_USES_GETTIMEOFFSET 547 select ARCH_USES_GETTIMEOFFSET
548 select NEED_MACH_IO_H
529 select NEED_MACH_MEMORY_H 549 select NEED_MACH_MEMORY_H
530 help 550 help
531 Support for Intel's IXP2400/2800 (XScale) family of processors. 551 Support for Intel's IXP2400/2800 (XScale) family of processors.
@@ -533,12 +553,13 @@ config ARCH_IXP2000
533config ARCH_IXP4XX 553config ARCH_IXP4XX
534 bool "IXP4xx-based" 554 bool "IXP4xx-based"
535 depends on MMU 555 depends on MMU
556 select ARCH_HAS_DMA_SET_COHERENT_MASK
536 select CLKSRC_MMIO 557 select CLKSRC_MMIO
537 select CPU_XSCALE 558 select CPU_XSCALE
538 select GENERIC_GPIO 559 select GENERIC_GPIO
539 select GENERIC_CLOCKEVENTS 560 select GENERIC_CLOCKEVENTS
540 select HAVE_SCHED_CLOCK
541 select MIGHT_HAVE_PCI 561 select MIGHT_HAVE_PCI
562 select NEED_MACH_IO_H
542 select DMABOUNCE if PCI 563 select DMABOUNCE if PCI
543 help 564 help
544 Support for Intel's IXP4XX (XScale) family of processors. 565 Support for Intel's IXP4XX (XScale) family of processors.
@@ -549,6 +570,7 @@ config ARCH_DOVE
549 select PCI 570 select PCI
550 select ARCH_REQUIRE_GPIOLIB 571 select ARCH_REQUIRE_GPIOLIB
551 select GENERIC_CLOCKEVENTS 572 select GENERIC_CLOCKEVENTS
573 select NEED_MACH_IO_H
552 select PLAT_ORION 574 select PLAT_ORION
553 help 575 help
554 Support for the Marvell Dove SoC 88AP510 576 Support for the Marvell Dove SoC 88AP510
@@ -559,6 +581,7 @@ config ARCH_KIRKWOOD
559 select PCI 581 select PCI
560 select ARCH_REQUIRE_GPIOLIB 582 select ARCH_REQUIRE_GPIOLIB
561 select GENERIC_CLOCKEVENTS 583 select GENERIC_CLOCKEVENTS
584 select NEED_MACH_IO_H
562 select PLAT_ORION 585 select PLAT_ORION
563 help 586 help
564 Support for the following Marvell Kirkwood series SoCs: 587 Support for the following Marvell Kirkwood series SoCs:
@@ -583,6 +606,7 @@ config ARCH_MV78XX0
583 select PCI 606 select PCI
584 select ARCH_REQUIRE_GPIOLIB 607 select ARCH_REQUIRE_GPIOLIB
585 select GENERIC_CLOCKEVENTS 608 select GENERIC_CLOCKEVENTS
609 select NEED_MACH_IO_H
586 select PLAT_ORION 610 select PLAT_ORION
587 help 611 help
588 Support for the following Marvell MV78xx0 series SoCs: 612 Support for the following Marvell MV78xx0 series SoCs:
@@ -608,7 +632,6 @@ config ARCH_MMP
608 select CLKDEV_LOOKUP 632 select CLKDEV_LOOKUP
609 select GENERIC_CLOCKEVENTS 633 select GENERIC_CLOCKEVENTS
610 select GPIO_PXA 634 select GPIO_PXA
611 select HAVE_SCHED_CLOCK
612 select TICK_ONESHOT 635 select TICK_ONESHOT
613 select PLAT_PXA 636 select PLAT_PXA
614 select SPARSE_IRQ 637 select SPARSE_IRQ
@@ -649,9 +672,9 @@ config ARCH_TEGRA
649 select GENERIC_CLOCKEVENTS 672 select GENERIC_CLOCKEVENTS
650 select GENERIC_GPIO 673 select GENERIC_GPIO
651 select HAVE_CLK 674 select HAVE_CLK
652 select HAVE_SCHED_CLOCK
653 select HAVE_SMP 675 select HAVE_SMP
654 select MIGHT_HAVE_CACHE_L2X0 676 select MIGHT_HAVE_CACHE_L2X0
677 select NEED_MACH_IO_H if PCI
655 select ARCH_HAS_CPUFREQ 678 select ARCH_HAS_CPUFREQ
656 help 679 help
657 This enables support for NVIDIA Tegra based systems (Tegra APX, 680 This enables support for NVIDIA Tegra based systems (Tegra APX,
@@ -666,7 +689,6 @@ config ARCH_PICOXCELL
666 select DW_APB_TIMER 689 select DW_APB_TIMER
667 select GENERIC_CLOCKEVENTS 690 select GENERIC_CLOCKEVENTS
668 select GENERIC_GPIO 691 select GENERIC_GPIO
669 select HAVE_SCHED_CLOCK
670 select HAVE_TCM 692 select HAVE_TCM
671 select NO_IOPORT 693 select NO_IOPORT
672 select SPARSE_IRQ 694 select SPARSE_IRQ
@@ -694,7 +716,6 @@ config ARCH_PXA
694 select ARCH_REQUIRE_GPIOLIB 716 select ARCH_REQUIRE_GPIOLIB
695 select GENERIC_CLOCKEVENTS 717 select GENERIC_CLOCKEVENTS
696 select GPIO_PXA 718 select GPIO_PXA
697 select HAVE_SCHED_CLOCK
698 select TICK_ONESHOT 719 select TICK_ONESHOT
699 select PLAT_PXA 720 select PLAT_PXA
700 select SPARSE_IRQ 721 select SPARSE_IRQ
@@ -738,7 +759,6 @@ config ARCH_RPC
738 bool "RiscPC" 759 bool "RiscPC"
739 select ARCH_ACORN 760 select ARCH_ACORN
740 select FIQ 761 select FIQ
741 select TIMER_ACORN
742 select ARCH_MAY_HAVE_PC_FDC 762 select ARCH_MAY_HAVE_PC_FDC
743 select HAVE_PATA_PLATFORM 763 select HAVE_PATA_PLATFORM
744 select ISA_DMA_API 764 select ISA_DMA_API
@@ -746,6 +766,7 @@ config ARCH_RPC
746 select ARCH_SPARSEMEM_ENABLE 766 select ARCH_SPARSEMEM_ENABLE
747 select ARCH_USES_GETTIMEOFFSET 767 select ARCH_USES_GETTIMEOFFSET
748 select HAVE_IDE 768 select HAVE_IDE
769 select NEED_MACH_IO_H
749 select NEED_MACH_MEMORY_H 770 select NEED_MACH_MEMORY_H
750 help 771 help
751 On the Acorn Risc-PC, Linux can support the internal IDE disk and 772 On the Acorn Risc-PC, Linux can support the internal IDE disk and
@@ -762,11 +783,11 @@ config ARCH_SA1100
762 select CPU_FREQ 783 select CPU_FREQ
763 select GENERIC_CLOCKEVENTS 784 select GENERIC_CLOCKEVENTS
764 select CLKDEV_LOOKUP 785 select CLKDEV_LOOKUP
765 select HAVE_SCHED_CLOCK
766 select TICK_ONESHOT 786 select TICK_ONESHOT
767 select ARCH_REQUIRE_GPIOLIB 787 select ARCH_REQUIRE_GPIOLIB
768 select HAVE_IDE 788 select HAVE_IDE
769 select NEED_MACH_MEMORY_H 789 select NEED_MACH_MEMORY_H
790 select SPARSE_IRQ
770 help 791 help
771 Support for StrongARM 11x0 based boards. 792 Support for StrongARM 11x0 based boards.
772 793
@@ -780,6 +801,7 @@ config ARCH_S3C24XX
780 select HAVE_S3C2410_I2C if I2C 801 select HAVE_S3C2410_I2C if I2C
781 select HAVE_S3C_RTC if RTC_CLASS 802 select HAVE_S3C_RTC if RTC_CLASS
782 select HAVE_S3C2410_WATCHDOG if WATCHDOG 803 select HAVE_S3C2410_WATCHDOG if WATCHDOG
804 select NEED_MACH_IO_H
783 help 805 help
784 Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443 806 Samsung S3C2410, S3C2412, S3C2413, S3C2416, S3C2440, S3C2442, S3C2443
785 and S3C2450 SoCs based systems, such as the Simtec Electronics BAST 807 and S3C2450 SoCs based systems, such as the Simtec Electronics BAST
@@ -818,7 +840,6 @@ config ARCH_S5P64X0
818 select CLKSRC_MMIO 840 select CLKSRC_MMIO
819 select HAVE_S3C2410_WATCHDOG if WATCHDOG 841 select HAVE_S3C2410_WATCHDOG if WATCHDOG
820 select GENERIC_CLOCKEVENTS 842 select GENERIC_CLOCKEVENTS
821 select HAVE_SCHED_CLOCK
822 select HAVE_S3C2410_I2C if I2C 843 select HAVE_S3C2410_I2C if I2C
823 select HAVE_S3C_RTC if RTC_CLASS 844 select HAVE_S3C_RTC if RTC_CLASS
824 help 845 help
@@ -849,7 +870,6 @@ config ARCH_S5PV210
849 select CLKSRC_MMIO 870 select CLKSRC_MMIO
850 select ARCH_HAS_CPUFREQ 871 select ARCH_HAS_CPUFREQ
851 select GENERIC_CLOCKEVENTS 872 select GENERIC_CLOCKEVENTS
852 select HAVE_SCHED_CLOCK
853 select HAVE_S3C2410_I2C if I2C 873 select HAVE_S3C2410_I2C if I2C
854 select HAVE_S3C_RTC if RTC_CLASS 874 select HAVE_S3C_RTC if RTC_CLASS
855 select HAVE_S3C2410_WATCHDOG if WATCHDOG 875 select HAVE_S3C2410_WATCHDOG if WATCHDOG
@@ -883,6 +903,7 @@ config ARCH_SHARK
883 select PCI 903 select PCI
884 select ARCH_USES_GETTIMEOFFSET 904 select ARCH_USES_GETTIMEOFFSET
885 select NEED_MACH_MEMORY_H 905 select NEED_MACH_MEMORY_H
906 select NEED_MACH_IO_H
886 help 907 help
887 Support for the StrongARM based Digital DNARD machine, also known 908 Support for the StrongARM based Digital DNARD machine, also known
888 as "Shark" (<http://www.shark-linux.de/shark.html>). 909 as "Shark" (<http://www.shark-linux.de/shark.html>).
@@ -892,7 +913,6 @@ config ARCH_U300
892 depends on MMU 913 depends on MMU
893 select CLKSRC_MMIO 914 select CLKSRC_MMIO
894 select CPU_ARM926T 915 select CPU_ARM926T
895 select HAVE_SCHED_CLOCK
896 select HAVE_TCM 916 select HAVE_TCM
897 select ARM_AMBA 917 select ARM_AMBA
898 select ARM_PATCH_PHYS_VIRT 918 select ARM_PATCH_PHYS_VIRT
@@ -951,7 +971,6 @@ config ARCH_OMAP
951 select ARCH_HAS_CPUFREQ 971 select ARCH_HAS_CPUFREQ
952 select CLKSRC_MMIO 972 select CLKSRC_MMIO
953 select GENERIC_CLOCKEVENTS 973 select GENERIC_CLOCKEVENTS
954 select HAVE_SCHED_CLOCK
955 select ARCH_HAS_HOLES_MEMORYMODEL 974 select ARCH_HAS_HOLES_MEMORYMODEL
956 help 975 help
957 Support for TI's OMAP platform (OMAP1/2/3/4). 976 Support for TI's OMAP platform (OMAP1/2/3/4).
@@ -1115,13 +1134,11 @@ config ARCH_ACORN
1115config PLAT_IOP 1134config PLAT_IOP
1116 bool 1135 bool
1117 select GENERIC_CLOCKEVENTS 1136 select GENERIC_CLOCKEVENTS
1118 select HAVE_SCHED_CLOCK
1119 1137
1120config PLAT_ORION 1138config PLAT_ORION
1121 bool 1139 bool
1122 select CLKSRC_MMIO 1140 select CLKSRC_MMIO
1123 select GENERIC_IRQ_CHIP 1141 select GENERIC_IRQ_CHIP
1124 select HAVE_SCHED_CLOCK
1125 1142
1126config PLAT_PXA 1143config PLAT_PXA
1127 bool 1144 bool
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 66ca8014ff3e..85348a09d655 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -292,6 +292,22 @@ choice
292 Note that the system will appear to hang during boot if there 292 Note that the system will appear to hang during boot if there
293 is nothing connected to read from the DCC. 293 is nothing connected to read from the DCC.
294 294
295 config DEBUG_SEMIHOSTING
296 bool "Kernel low-level debug output via semihosting I"
297 help
298 Semihosting enables code running on an ARM target to use
299 the I/O facilities on a host debugger/emulator through a
300 simple SVC calls. The host debugger or emulator must have
301 semihosting enabled for the special svc call to be trapped
302 otherwise the kernel will crash.
303
304 This is known to work with OpenOCD, as wellas
305 ARM's Fast Models, or any other controlling environment
306 that implements semihosting.
307
308 For more details about semihosting, please see
309 chapter 8 of DUI0203I_rvct_developer_guide.pdf from ARM Ltd.
310
295endchoice 311endchoice
296 312
297config EARLY_PRINTK 313config EARLY_PRINTK
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0106f75530c0..047a20780fc1 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -180,6 +180,7 @@ machine-$(CONFIG_ARCH_S5P64X0) := s5p64x0
180machine-$(CONFIG_ARCH_S5PC100) := s5pc100 180machine-$(CONFIG_ARCH_S5PC100) := s5pc100
181machine-$(CONFIG_ARCH_S5PV210) := s5pv210 181machine-$(CONFIG_ARCH_S5PV210) := s5pv210
182machine-$(CONFIG_ARCH_EXYNOS4) := exynos 182machine-$(CONFIG_ARCH_EXYNOS4) := exynos
183machine-$(CONFIG_ARCH_EXYNOS5) := exynos
183machine-$(CONFIG_ARCH_SA1100) := sa1100 184machine-$(CONFIG_ARCH_SA1100) := sa1100
184machine-$(CONFIG_ARCH_SHARK) := shark 185machine-$(CONFIG_ARCH_SHARK) := shark
185machine-$(CONFIG_ARCH_SHMOBILE) := shmobile 186machine-$(CONFIG_ARCH_SHMOBILE) := shmobile
@@ -252,6 +253,7 @@ core-$(CONFIG_VFP) += arch/arm/vfp/
252 253
253# If we have a machine-specific directory, then include it in the build. 254# If we have a machine-specific directory, then include it in the build.
254core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ 255core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
256core-y += arch/arm/net/
255core-y += $(machdirs) $(platdirs) 257core-y += $(machdirs) $(platdirs)
256 258
257drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 259drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index fc871e719aae..c877087d2000 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -11,8 +11,6 @@
11# Copyright (C) 1995-2002 Russell King 11# Copyright (C) 1995-2002 Russell King
12# 12#
13 13
14MKIMAGE := $(srctree)/scripts/mkuboot.sh
15
16ifneq ($(MACHINE),) 14ifneq ($(MACHINE),)
17include $(srctree)/$(MACHINE)/Makefile.boot 15include $(srctree)/$(MACHINE)/Makefile.boot
18endif 16endif
@@ -69,22 +67,19 @@ $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
69 67
70clean-files := *.dtb 68clean-files := *.dtb
71 69
72quiet_cmd_uimage = UIMAGE $@ 70ifneq ($(LOADADDR),)
73 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \ 71 UIMAGE_LOADADDR=$(LOADADDR)
74 -C none -a $(LOADADDR) -e $(STARTADDR) \
75 -n 'Linux-$(KERNELRELEASE)' -d $< $@
76
77ifeq ($(CONFIG_ZBOOT_ROM),y)
78$(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
79else 72else
80$(obj)/uImage: LOADADDR=$(ZRELADDR) 73 ifeq ($(CONFIG_ZBOOT_ROM),y)
74 UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
75 else
76 UIMAGE_LOADADDR=$(ZRELADDR)
77 endif
81endif 78endif
82 79
83$(obj)/uImage: STARTADDR=$(LOADADDR)
84
85check_for_multiple_loadaddr = \ 80check_for_multiple_loadaddr = \
86if [ $(words $(LOADADDR)) -gt 1 ]; then \ 81if [ $(words $(UIMAGE_LOADADDR)) -gt 1 ]; then \
87 echo 'multiple load addresses: $(LOADADDR)'; \ 82 echo 'multiple load addresses: $(UIMAGE_LOADADDR)'; \
88 echo 'This is incompatible with uImages'; \ 83 echo 'This is incompatible with uImages'; \
89 echo 'Specify LOADADDR on the commandline to build an uImage'; \ 84 echo 'Specify LOADADDR on the commandline to build an uImage'; \
90 false; \ 85 false; \
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore
index e0936a148516..d0d441c429ae 100644
--- a/arch/arm/boot/compressed/.gitignore
+++ b/arch/arm/boot/compressed/.gitignore
@@ -1,8 +1,10 @@
1ashldi3.S
1font.c 2font.c
2lib1funcs.S 3lib1funcs.S
3piggy.gzip 4piggy.gzip
4piggy.lzo 5piggy.lzo
5piggy.lzma 6piggy.lzma
7piggy.xzkern
6vmlinux 8vmlinux
7vmlinux.lds 9vmlinux.lds
8 10
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index cf0a64ce4b83..bb267562e7ed 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -92,6 +92,7 @@ SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/
92suffix_$(CONFIG_KERNEL_GZIP) = gzip 92suffix_$(CONFIG_KERNEL_GZIP) = gzip
93suffix_$(CONFIG_KERNEL_LZO) = lzo 93suffix_$(CONFIG_KERNEL_LZO) = lzo
94suffix_$(CONFIG_KERNEL_LZMA) = lzma 94suffix_$(CONFIG_KERNEL_LZMA) = lzma
95suffix_$(CONFIG_KERNEL_XZ) = xzkern
95 96
96# Borrowed libfdt files for the ATAG compatibility mode 97# Borrowed libfdt files for the ATAG compatibility mode
97 98
@@ -112,10 +113,12 @@ endif
112 113
113targets := vmlinux vmlinux.lds \ 114targets := vmlinux vmlinux.lds \
114 piggy.$(suffix_y) piggy.$(suffix_y).o \ 115 piggy.$(suffix_y) piggy.$(suffix_y).o \
115 lib1funcs.o lib1funcs.S font.o font.c head.o misc.o $(OBJS) 116 lib1funcs.o lib1funcs.S ashldi3.o ashldi3.S \
117 font.o font.c head.o misc.o $(OBJS)
116 118
117# Make sure files are removed during clean 119# Make sure files are removed during clean
118extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S $(libfdt) $(libfdt_hdrs) 120extra-y += piggy.gzip piggy.lzo piggy.lzma piggy.xzkern \
121 lib1funcs.S ashldi3.S $(libfdt) $(libfdt_hdrs)
119 122
120ifeq ($(CONFIG_FUNCTION_TRACER),y) 123ifeq ($(CONFIG_FUNCTION_TRACER),y)
121ORIG_CFLAGS := $(KBUILD_CFLAGS) 124ORIG_CFLAGS := $(KBUILD_CFLAGS)
@@ -151,6 +154,12 @@ lib1funcs = $(obj)/lib1funcs.o
151$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S 154$(obj)/lib1funcs.S: $(srctree)/arch/$(SRCARCH)/lib/lib1funcs.S
152 $(call cmd,shipped) 155 $(call cmd,shipped)
153 156
157# For __aeabi_llsl
158ashldi3 = $(obj)/ashldi3.o
159
160$(obj)/ashldi3.S: $(srctree)/arch/$(SRCARCH)/lib/ashldi3.S
161 $(call cmd,shipped)
162
154# We need to prevent any GOTOFF relocs being used with references 163# We need to prevent any GOTOFF relocs being used with references
155# to symbols in the .bss section since we cannot relocate them 164# to symbols in the .bss section since we cannot relocate them
156# independently from the rest at run time. This can be achieved by 165# independently from the rest at run time. This can be achieved by
@@ -172,7 +181,7 @@ if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
172fi 181fi
173 182
174$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 183$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
175 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE 184 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) $(ashldi3) FORCE
176 @$(check_for_multiple_zreladdr) 185 @$(check_for_multiple_zreladdr)
177 $(call if_changed,ld) 186 $(call if_changed,ld)
178 @$(check_for_bad_syms) 187 @$(check_for_bad_syms)
diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c
index 07be5a2f8302..f41b38cafce8 100644
--- a/arch/arm/boot/compressed/decompress.c
+++ b/arch/arm/boot/compressed/decompress.c
@@ -44,6 +44,12 @@ extern void error(char *);
44#include "../../../../lib/decompress_unlzma.c" 44#include "../../../../lib/decompress_unlzma.c"
45#endif 45#endif
46 46
47#ifdef CONFIG_KERNEL_XZ
48#define memmove memmove
49#define memcpy memcpy
50#include "../../../../lib/decompress_unxz.c"
51#endif
52
47int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)) 53int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
48{ 54{
49 return decompress(input, len, NULL, NULL, output, NULL, error); 55 return decompress(input, len, NULL, NULL, output, NULL, error);
diff --git a/arch/arm/boot/compressed/piggy.xzkern.S b/arch/arm/boot/compressed/piggy.xzkern.S
new file mode 100644
index 000000000000..5703f300d027
--- /dev/null
+++ b/arch/arm/boot/compressed/piggy.xzkern.S
@@ -0,0 +1,6 @@
1 .section .piggydata,#alloc
2 .globl input_data
3input_data:
4 .incbin "arch/arm/boot/compressed/piggy.xzkern"
5 .globl input_data_end
6input_data_end:
diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi b/arch/arm/boot/dts/at91sam9g20.dtsi
index a100db03ec90..799ad1889b51 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -35,7 +35,7 @@
35 }; 35 };
36 }; 36 };
37 37
38 memory@20000000 { 38 memory {
39 reg = <0x20000000 0x08000000>; 39 reg = <0x20000000 0x08000000>;
40 }; 40 };
41 41
@@ -59,6 +59,26 @@
59 reg = <0xfffff000 0x200>; 59 reg = <0xfffff000 0x200>;
60 }; 60 };
61 61
62 ramc0: ramc@ffffea00 {
63 compatible = "atmel,at91sam9260-sdramc";
64 reg = <0xffffea00 0x200>;
65 };
66
67 pmc: pmc@fffffc00 {
68 compatible = "atmel,at91rm9200-pmc";
69 reg = <0xfffffc00 0x100>;
70 };
71
72 rstc@fffffd00 {
73 compatible = "atmel,at91sam9260-rstc";
74 reg = <0xfffffd00 0x10>;
75 };
76
77 shdwc@fffffd10 {
78 compatible = "atmel,at91sam9260-shdwc";
79 reg = <0xfffffd10 0x10>;
80 };
81
62 pit: timer@fffffd30 { 82 pit: timer@fffffd30 {
63 compatible = "atmel,at91sam9260-pit"; 83 compatible = "atmel,at91sam9260-pit";
64 reg = <0xfffffd30 0xf>; 84 reg = <0xfffffd30 0xf>;
@@ -171,6 +191,49 @@
171 interrupts = <21 4>; 191 interrupts = <21 4>;
172 status = "disabled"; 192 status = "disabled";
173 }; 193 };
194
195 usb1: gadget@fffa4000 {
196 compatible = "atmel,at91rm9200-udc";
197 reg = <0xfffa4000 0x4000>;
198 interrupts = <10 4>;
199 status = "disabled";
200 };
201 };
202
203 nand0: nand@40000000 {
204 compatible = "atmel,at91rm9200-nand";
205 #address-cells = <1>;
206 #size-cells = <1>;
207 reg = <0x40000000 0x10000000
208 0xffffe800 0x200
209 >;
210 atmel,nand-addr-offset = <21>;
211 atmel,nand-cmd-offset = <22>;
212 gpios = <&pioC 13 0
213 &pioC 14 0
214 0
215 >;
216 status = "disabled";
174 }; 217 };
218
219 usb0: ohci@00500000 {
220 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
221 reg = <0x00500000 0x100000>;
222 interrupts = <20 4>;
223 status = "disabled";
224 };
225 };
226
227 i2c@0 {
228 compatible = "i2c-gpio";
229 gpios = <&pioA 23 0 /* sda */
230 &pioA 24 0 /* scl */
231 >;
232 i2c-gpio,sda-open-drain;
233 i2c-gpio,scl-open-drain;
234 i2c-gpio,delay-us = <2>; /* ~100 kHz */
235 #address-cells = <1>;
236 #size-cells = <0>;
237 status = "disabled";
175 }; 238 };
176}; 239};
diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index e64eb932083b..7829a4d0cb22 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -15,7 +15,7 @@
15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; 15 compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9";
16 16
17 chosen { 17 chosen {
18 bootargs = "128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs"; 18 bootargs = "128M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs";
19 }; 19 };
20 20
21 ahb { 21 ahb {
@@ -33,5 +33,17 @@
33 status = "okay"; 33 status = "okay";
34 }; 34 };
35 }; 35 };
36
37 usb0: ohci@00600000 {
38 status = "okay";
39 num-ports = <2>;
40 atmel,vbus-gpio = <&pioD 19 1
41 &pioD 20 1
42 >;
43 };
44
45 usb1: ehci@00700000 {
46 status = "okay";
47 };
36 }; 48 };
37}; 49};
diff --git a/arch/arm/boot/dts/at91sam9g45.dtsi b/arch/arm/boot/dts/at91sam9g45.dtsi
index f779667159b1..9e6eb6ecea0e 100644
--- a/arch/arm/boot/dts/at91sam9g45.dtsi
+++ b/arch/arm/boot/dts/at91sam9g45.dtsi
@@ -36,7 +36,7 @@
36 }; 36 };
37 }; 37 };
38 38
39 memory@70000000 { 39 memory {
40 reg = <0x70000000 0x10000000>; 40 reg = <0x70000000 0x10000000>;
41 }; 41 };
42 42
@@ -60,6 +60,22 @@
60 reg = <0xfffff000 0x200>; 60 reg = <0xfffff000 0x200>;
61 }; 61 };
62 62
63 ramc0: ramc@ffffe400 {
64 compatible = "atmel,at91sam9g45-ddramc";
65 reg = <0xffffe400 0x200
66 0xffffe600 0x200>;
67 };
68
69 pmc: pmc@fffffc00 {
70 compatible = "atmel,at91rm9200-pmc";
71 reg = <0xfffffc00 0x100>;
72 };
73
74 rstc@fffffd00 {
75 compatible = "atmel,at91sam9g45-rstc";
76 reg = <0xfffffd00 0x10>;
77 };
78
63 pit: timer@fffffd30 { 79 pit: timer@fffffd30 {
64 compatible = "atmel,at91sam9260-pit"; 80 compatible = "atmel,at91sam9260-pit";
65 reg = <0xfffffd30 0xf>; 81 reg = <0xfffffd30 0xf>;
@@ -67,6 +83,11 @@
67 }; 83 };
68 84
69 85
86 shdwc@fffffd10 {
87 compatible = "atmel,at91sam9rl-shdwc";
88 reg = <0xfffffd10 0x10>;
89 };
90
70 tcb0: timer@fff7c000 { 91 tcb0: timer@fff7c000 {
71 compatible = "atmel,at91rm9200-tcb"; 92 compatible = "atmel,at91rm9200-tcb";
72 reg = <0xfff7c000 0x100>; 93 reg = <0xfff7c000 0x100>;
@@ -180,5 +201,48 @@
180 status = "disabled"; 201 status = "disabled";
181 }; 202 };
182 }; 203 };
204
205 nand0: nand@40000000 {
206 compatible = "atmel,at91rm9200-nand";
207 #address-cells = <1>;
208 #size-cells = <1>;
209 reg = <0x40000000 0x10000000
210 0xffffe200 0x200
211 >;
212 atmel,nand-addr-offset = <21>;
213 atmel,nand-cmd-offset = <22>;
214 gpios = <&pioC 8 0
215 &pioC 14 0
216 0
217 >;
218 status = "disabled";
219 };
220
221 usb0: ohci@00700000 {
222 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
223 reg = <0x00700000 0x100000>;
224 interrupts = <22 4>;
225 status = "disabled";
226 };
227
228 usb1: ehci@00800000 {
229 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
230 reg = <0x00800000 0x100000>;
231 interrupts = <22 4>;
232 status = "disabled";
233 };
234 };
235
236 i2c@0 {
237 compatible = "i2c-gpio";
238 gpios = <&pioA 20 0 /* sda */
239 &pioA 21 0 /* scl */
240 >;
241 i2c-gpio,sda-open-drain;
242 i2c-gpio,scl-open-drain;
243 i2c-gpio,delay-us = <5>; /* ~100 kHz */
244 #address-cells = <1>;
245 #size-cells = <0>;
246 status = "disabled";
183 }; 247 };
184}; 248};
diff --git a/arch/arm/boot/dts/at91sam9m10g45ek.dts b/arch/arm/boot/dts/at91sam9m10g45ek.dts
index 15e25f903cad..a3633bd13111 100644
--- a/arch/arm/boot/dts/at91sam9m10g45ek.dts
+++ b/arch/arm/boot/dts/at91sam9m10g45ek.dts
@@ -14,13 +14,24 @@
14 compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9"; 14 compatible = "atmel,at91sam9m10g45ek", "atmel,at91sam9g45", "atmel,at91sam9";
15 15
16 chosen { 16 chosen {
17 bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:4M(bootstrap/uboot/kernel)ro,60M(rootfs),-(data) root=/dev/mtdblock1 rw rootfstype=jffs2"; 17 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2";
18 }; 18 };
19 19
20 memory@70000000 { 20 memory {
21 reg = <0x70000000 0x4000000>; 21 reg = <0x70000000 0x4000000>;
22 }; 22 };
23 23
24 clocks {
25 #address-cells = <1>;
26 #size-cells = <1>;
27 ranges;
28
29 main_clock: clock@0 {
30 compatible = "atmel,osc", "fixed-clock";
31 clock-frequency = <12000000>;
32 };
33 };
34
24 ahb { 35 ahb {
25 apb { 36 apb {
26 dbgu: serial@ffffee00 { 37 dbgu: serial@ffffee00 {
@@ -36,6 +47,39 @@
36 status = "okay"; 47 status = "okay";
37 }; 48 };
38 }; 49 };
50
51 nand0: nand@40000000 {
52 nand-bus-width = <8>;
53 nand-ecc-mode = "soft";
54 nand-on-flash-bbt;
55 status = "okay";
56
57 boot@0 {
58 label = "bootstrap/uboot/kernel";
59 reg = <0x0 0x400000>;
60 };
61
62 rootfs@400000 {
63 label = "rootfs";
64 reg = <0x400000 0x3C00000>;
65 };
66
67 data@4000000 {
68 label = "data";
69 reg = <0x4000000 0xC000000>;
70 };
71 };
72
73 usb0: ohci@00700000 {
74 status = "okay";
75 num-ports = <2>;
76 atmel,vbus-gpio = <&pioD 1 1
77 &pioD 3 1>;
78 };
79
80 usb1: ehci@00800000 {
81 status = "okay";
82 };
39 }; 83 };
40 84
41 leds { 85 leds {
diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index a02e636d8a57..70ab3a4e026f 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -34,7 +34,7 @@
34 }; 34 };
35 }; 35 };
36 36
37 memory@20000000 { 37 memory {
38 reg = <0x20000000 0x10000000>; 38 reg = <0x20000000 0x10000000>;
39 }; 39 };
40 40
@@ -58,6 +58,26 @@
58 reg = <0xfffff000 0x200>; 58 reg = <0xfffff000 0x200>;
59 }; 59 };
60 60
61 ramc0: ramc@ffffe800 {
62 compatible = "atmel,at91sam9g45-ddramc";
63 reg = <0xffffe800 0x200>;
64 };
65
66 pmc: pmc@fffffc00 {
67 compatible = "atmel,at91rm9200-pmc";
68 reg = <0xfffffc00 0x100>;
69 };
70
71 rstc@fffffe00 {
72 compatible = "atmel,at91sam9g45-rstc";
73 reg = <0xfffffe00 0x10>;
74 };
75
76 shdwc@fffffe10 {
77 compatible = "atmel,at91sam9x5-shdwc";
78 reg = <0xfffffe10 0x10>;
79 };
80
61 pit: timer@fffffe30 { 81 pit: timer@fffffe30 {
62 compatible = "atmel,at91sam9260-pit"; 82 compatible = "atmel,at91sam9260-pit";
63 reg = <0xfffffe30 0xf>; 83 reg = <0xfffffe30 0xf>;
@@ -172,5 +192,73 @@
172 status = "disabled"; 192 status = "disabled";
173 }; 193 };
174 }; 194 };
195
196 nand0: nand@40000000 {
197 compatible = "atmel,at91rm9200-nand";
198 #address-cells = <1>;
199 #size-cells = <1>;
200 reg = <0x40000000 0x10000000
201 >;
202 atmel,nand-addr-offset = <21>;
203 atmel,nand-cmd-offset = <22>;
204 gpios = <&pioD 5 0
205 &pioD 4 0
206 0
207 >;
208 status = "disabled";
209 };
210
211 usb0: ohci@00600000 {
212 compatible = "atmel,at91rm9200-ohci", "usb-ohci";
213 reg = <0x00600000 0x100000>;
214 interrupts = <22 4>;
215 status = "disabled";
216 };
217
218 usb1: ehci@00700000 {
219 compatible = "atmel,at91sam9g45-ehci", "usb-ehci";
220 reg = <0x00700000 0x100000>;
221 interrupts = <22 4>;
222 status = "disabled";
223 };
224 };
225
226 i2c@0 {
227 compatible = "i2c-gpio";
228 gpios = <&pioA 30 0 /* sda */
229 &pioA 31 0 /* scl */
230 >;
231 i2c-gpio,sda-open-drain;
232 i2c-gpio,scl-open-drain;
233 i2c-gpio,delay-us = <2>; /* ~100 kHz */
234 #address-cells = <1>;
235 #size-cells = <0>;
236 status = "disabled";
237 };
238
239 i2c@1 {
240 compatible = "i2c-gpio";
241 gpios = <&pioC 0 0 /* sda */
242 &pioC 1 0 /* scl */
243 >;
244 i2c-gpio,sda-open-drain;
245 i2c-gpio,scl-open-drain;
246 i2c-gpio,delay-us = <2>; /* ~100 kHz */
247 #address-cells = <1>;
248 #size-cells = <0>;
249 status = "disabled";
250 };
251
252 i2c@2 {
253 compatible = "i2c-gpio";
254 gpios = <&pioB 4 0 /* sda */
255 &pioB 5 0 /* scl */
256 >;
257 i2c-gpio,sda-open-drain;
258 i2c-gpio,scl-open-drain;
259 i2c-gpio,delay-us = <2>; /* ~100 kHz */
260 #address-cells = <1>;
261 #size-cells = <0>;
262 status = "disabled";
175 }; 263 };
176}; 264};
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi b/arch/arm/boot/dts/at91sam9x5cm.dtsi
index 64ae3e890259..31e7be23703d 100644
--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -8,10 +8,55 @@
8 */ 8 */
9 9
10/ { 10/ {
11 memory@20000000 { 11 memory {
12 reg = <0x20000000 0x8000000>; 12 reg = <0x20000000 0x8000000>;
13 }; 13 };
14 14
15 clocks {
16 #address-cells = <1>;
17 #size-cells = <1>;
18 ranges;
19
20 main_clock: clock@0 {
21 compatible = "atmel,osc", "fixed-clock";
22 clock-frequency = <12000000>;
23 };
24 };
25
26 ahb {
27 nand0: nand@40000000 {
28 nand-bus-width = <8>;
29 nand-ecc-mode = "soft";
30 nand-on-flash-bbt;
31 status = "okay";
32
33 at91bootstrap@0 {
34 label = "at91bootstrap";
35 reg = <0x0 0x40000>;
36 };
37
38 uboot@40000 {
39 label = "u-boot";
40 reg = <0x40000 0x80000>;
41 };
42
43 ubootenv@c0000 {
44 label = "U-Boot Env";
45 reg = <0xc0000 0x140000>;
46 };
47
48 kernel@200000 {
49 label = "kernel";
50 reg = <0x200000 0x600000>;
51 };
52
53 rootfs@800000 {
54 label = "rootfs";
55 reg = <0x800000 0x1f800000>;
56 };
57 };
58 };
59
15 leds { 60 leds {
16 compatible = "gpio-leds"; 61 compatible = "gpio-leds";
17 62
diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi
new file mode 100644
index 000000000000..d73dce645667
--- /dev/null
+++ b/arch/arm/boot/dts/db8500.dtsi
@@ -0,0 +1,275 @@
1/*
2 * Copyright 2012 Linaro Ltd
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/include/ "skeleton.dtsi"
13
14/ {
15 soc-u9500 {
16 #address-cells = <1>;
17 #size-cells = <1>;
18 compatible = "stericsson,db8500";
19 interrupt-parent = <&intc>;
20 ranges;
21
22 intc: interrupt-controller@a0411000 {
23 compatible = "arm,cortex-a9-gic";
24 #interrupt-cells = <3>;
25 #address-cells = <1>;
26 interrupt-controller;
27 interrupt-parent;
28 reg = <0xa0411000 0x1000>,
29 <0xa0410100 0x100>;
30 };
31
32 L2: l2-cache {
33 compatible = "arm,pl310-cache";
34 reg = <0xa0412000 0x1000>;
35 interrupts = <0 13 4>;
36 cache-unified;
37 cache-level = <2>;
38 };
39
40 pmu {
41 compatible = "arm,cortex-a9-pmu";
42 interrupts = <0 7 0x4>;
43 };
44
45 timer@a0410600 {
46 compatible = "arm,cortex-a9-twd-timer";
47 reg = <0xa0410600 0x20>;
48 interrupts = <1 13 0x304>;
49 };
50
51 rtc@80154000 {
52 compatible = "stericsson,db8500-rtc";
53 reg = <0x80154000 0x1000>;
54 interrupts = <0 18 0x4>;
55 };
56
57 gpio0: gpio@8012e000 {
58 compatible = "stericsson,db8500-gpio",
59 "stmicroelectronics,nomadik-gpio";
60 reg = <0x8012e000 0x80>;
61 interrupts = <0 119 0x4>;
62 supports-sleepmode;
63 gpio-controller;
64 };
65
66 gpio1: gpio@8012e080 {
67 compatible = "stericsson,db8500-gpio",
68 "stmicroelectronics,nomadik-gpio";
69 reg = <0x8012e080 0x80>;
70 interrupts = <0 120 0x4>;
71 supports-sleepmode;
72 gpio-controller;
73 };
74
75 gpio2: gpio@8000e000 {
76 compatible = "stericsson,db8500-gpio",
77 "stmicroelectronics,nomadik-gpio";
78 reg = <0x8000e000 0x80>;
79 interrupts = <0 121 0x4>;
80 supports-sleepmode;
81 gpio-controller;
82 };
83
84 gpio3: gpio@8000e080 {
85 compatible = "stericsson,db8500-gpio",
86 "stmicroelectronics,nomadik-gpio";
87 reg = <0x8000e080 0x80>;
88 interrupts = <0 122 0x4>;
89 supports-sleepmode;
90 gpio-controller;
91 };
92
93 gpio4: gpio@8000e100 {
94 compatible = "stericsson,db8500-gpio",
95 "stmicroelectronics,nomadik-gpio";
96 reg = <0x8000e100 0x80>;
97 interrupts = <0 123 0x4>;
98 supports-sleepmode;
99 gpio-controller;
100 };
101
102 gpio5: gpio@8000e180 {
103 compatible = "stericsson,db8500-gpio",
104 "stmicroelectronics,nomadik-gpio";
105 reg = <0x8000e180 0x80>;
106 interrupts = <0 124 0x4>;
107 supports-sleepmode;
108 gpio-controller;
109 };
110
111 gpio6: gpio@8011e000 {
112 compatible = "stericsson,db8500-gpio",
113 "stmicroelectronics,nomadik-gpio";
114 reg = <0x8011e000 0x80>;
115 interrupts = <0 125 0x4>;
116 supports-sleepmode;
117 gpio-controller;
118 };
119
120 gpio7: gpio@8011e080 {
121 compatible = "stericsson,db8500-gpio",
122 "stmicroelectronics,nomadik-gpio";
123 reg = <0x8011e080 0x80>;
124 interrupts = <0 126 0x4>;
125 supports-sleepmode;
126 gpio-controller;
127 };
128
129 gpio8: gpio@a03fe000 {
130 compatible = "stericsson,db8500-gpio",
131 "stmicroelectronics,nomadik-gpio";
132 reg = <0xa03fe000 0x80>;
133 interrupts = <0 127 0x4>;
134 supports-sleepmode;
135 gpio-controller;
136 };
137
138 usb@a03e0000 {
139 compatible = "stericsson,db8500-musb",
140 "mentor,musb";
141 reg = <0xa03e0000 0x10000>;
142 interrupts = <0 23 0x4>;
143 };
144
145 dma-controller@801C0000 {
146 compatible = "stericsson,db8500-dma40",
147 "stericsson,dma40";
148 reg = <0x801C0000 0x1000 0x40010000 0x800>;
149 interrupts = <0 25 0x4>;
150 };
151
152 prcmu@80157000 {
153 compatible = "stericsson,db8500-prcmu";
154 reg = <0x80157000 0x1000>;
155 interrupts = <46 47>;
156 #address-cells = <1>;
157 #size-cells = <0>;
158
159 ab8500@5 {
160 compatible = "stericsson,ab8500";
161 reg = <5>; /* mailbox 5 is i2c */
162 interrupts = <0 40 0x4>;
163 };
164 };
165
166 i2c@80004000 {
167 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c";
168 reg = <0x80004000 0x1000>;
169 interrupts = <0 21 0x4>;
170 #address-cells = <1>;
171 #size-cells = <0>;
172 };
173
174 i2c@80122000 {
175 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c";
176 reg = <0x80122000 0x1000>;
177 interrupts = <0 22 0x4>;
178 #address-cells = <1>;
179 #size-cells = <0>;
180 };
181
182 i2c@80128000 {
183 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c";
184 reg = <0x80128000 0x1000>;
185 interrupts = <0 55 0x4>;
186 #address-cells = <1>;
187 #size-cells = <0>;
188 };
189
190 i2c@80110000 {
191 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c";
192 reg = <0x80110000 0x1000>;
193 interrupts = <0 12 0x4>;
194 #address-cells = <1>;
195 #size-cells = <0>;
196 };
197
198 i2c@8012a000 {
199 compatible = "stericsson,db8500-i2c", "stmicroelectronics,nomadik-i2c";
200 reg = <0x8012a000 0x1000>;
201 interrupts = <0 51 0x4>;
202 #address-cells = <1>;
203 #size-cells = <0>;
204 };
205
206 ssp@80002000 {
207 compatible = "arm,pl022", "arm,primecell";
208 reg = <80002000 0x1000>;
209 interrupts = <0 14 0x4>;
210 #address-cells = <1>;
211 #size-cells = <0>;
212 status = "disabled";
213
214 // Add one of these for each child device
215 cs-gpios = <&gpio0 31 &gpio4 14 &gpio4 16 &gpio6 22 &gpio7 0>;
216
217 };
218
219 uart@80120000 {
220 compatible = "arm,pl011", "arm,primecell";
221 reg = <0x80120000 0x1000>;
222 interrupts = <0 11 0x4>;
223 status = "disabled";
224 };
225 uart@80121000 {
226 compatible = "arm,pl011", "arm,primecell";
227 reg = <0x80121000 0x1000>;
228 interrupts = <0 19 0x4>;
229 status = "disabled";
230 };
231 uart@80007000 {
232 compatible = "arm,pl011", "arm,primecell";
233 reg = <0x80007000 0x1000>;
234 interrupts = <0 26 0x4>;
235 status = "disabled";
236 };
237
238 sdi@80126000 {
239 compatible = "arm,pl18x", "arm,primecell";
240 reg = <0x80126000 0x1000>;
241 interrupts = <0 60 0x4>;
242 status = "disabled";
243 };
244 sdi@80118000 {
245 compatible = "arm,pl18x", "arm,primecell";
246 reg = <0x80118000 0x1000>;
247 interrupts = <0 50 0x4>;
248 status = "disabled";
249 };
250 sdi@80005000 {
251 compatible = "arm,pl18x", "arm,primecell";
252 reg = <0x80005000 0x1000>;
253 interrupts = <0 41 0x4>;
254 status = "disabled";
255 };
256 sdi@80119000 {
257 compatible = "arm,pl18x", "arm,primecell";
258 reg = <0x80119000 0x1000>;
259 interrupts = <0 59 0x4>;
260 status = "disabled";
261 };
262 sdi@80114000 {
263 compatible = "arm,pl18x", "arm,primecell";
264 reg = <0x80114000 0x1000>;
265 interrupts = <0 99 0x4>;
266 status = "disabled";
267 };
268 sdi@80008000 {
269 compatible = "arm,pl18x", "arm,primecell";
270 reg = <0x80114000 0x1000>;
271 interrupts = <0 100 0x4>;
272 status = "disabled";
273 };
274 };
275};
diff --git a/arch/arm/boot/dts/exynos5250-smdk5250.dts b/arch/arm/boot/dts/exynos5250-smdk5250.dts
new file mode 100644
index 000000000000..399d17b231d2
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250-smdk5250.dts
@@ -0,0 +1,26 @@
1/*
2 * SAMSUNG SMDK5250 board device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12/dts-v1/;
13/include/ "exynos5250.dtsi"
14
15/ {
16 model = "SAMSUNG SMDK5250 board based on EXYNOS5250";
17 compatible = "samsung,smdk5250", "samsung,exynos5250";
18
19 memory {
20 reg = <0x40000000 0x80000000>;
21 };
22
23 chosen {
24 bootargs = "root=/dev/ram0 rw ramdisk=8192 console=ttySAC1,115200";
25 };
26};
diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
new file mode 100644
index 000000000000..dfc433599436
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5250.dtsi
@@ -0,0 +1,413 @@
1/*
2 * SAMSUNG EXYNOS5250 SoC device tree source
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * SAMSUNG EXYNOS5250 SoC device nodes are listed in this file.
8 * EXYNOS5250 based board files can include this file and provide
9 * values for board specfic bindings.
10 *
11 * Note: This file does not include device nodes for all the controllers in
12 * EXYNOS5250 SoC. As device tree coverage for EXYNOS5250 increases,
13 * additional nodes can be added to this file.
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation.
18*/
19
20/include/ "skeleton.dtsi"
21
22/ {
23 compatible = "samsung,exynos5250";
24 interrupt-parent = <&gic>;
25
26 gic:interrupt-controller@10490000 {
27 compatible = "arm,cortex-a9-gic";
28 #interrupt-cells = <3>;
29 interrupt-controller;
30 reg = <0x10490000 0x1000>, <0x10480000 0x100>;
31 };
32
33 watchdog {
34 compatible = "samsung,s3c2410-wdt";
35 reg = <0x101D0000 0x100>;
36 interrupts = <0 42 0>;
37 };
38
39 rtc {
40 compatible = "samsung,s3c6410-rtc";
41 reg = <0x101E0000 0x100>;
42 interrupts = <0 43 0>, <0 44 0>;
43 };
44
45 sdhci@12200000 {
46 compatible = "samsung,exynos4210-sdhci";
47 reg = <0x12200000 0x100>;
48 interrupts = <0 75 0>;
49 };
50
51 sdhci@12210000 {
52 compatible = "samsung,exynos4210-sdhci";
53 reg = <0x12210000 0x100>;
54 interrupts = <0 76 0>;
55 };
56
57 sdhci@12220000 {
58 compatible = "samsung,exynos4210-sdhci";
59 reg = <0x12220000 0x100>;
60 interrupts = <0 77 0>;
61 };
62
63 sdhci@12230000 {
64 compatible = "samsung,exynos4210-sdhci";
65 reg = <0x12230000 0x100>;
66 interrupts = <0 78 0>;
67 };
68
69 serial@12C00000 {
70 compatible = "samsung,exynos4210-uart";
71 reg = <0x12C00000 0x100>;
72 interrupts = <0 51 0>;
73 };
74
75 serial@12C10000 {
76 compatible = "samsung,exynos4210-uart";
77 reg = <0x12C10000 0x100>;
78 interrupts = <0 52 0>;
79 };
80
81 serial@12C20000 {
82 compatible = "samsung,exynos4210-uart";
83 reg = <0x12C20000 0x100>;
84 interrupts = <0 53 0>;
85 };
86
87 serial@12C30000 {
88 compatible = "samsung,exynos4210-uart";
89 reg = <0x12C30000 0x100>;
90 interrupts = <0 54 0>;
91 };
92
93 i2c@12C60000 {
94 compatible = "samsung,s3c2440-i2c";
95 reg = <0x12C60000 0x100>;
96 interrupts = <0 56 0>;
97 };
98
99 i2c@12C70000 {
100 compatible = "samsung,s3c2440-i2c";
101 reg = <0x12C70000 0x100>;
102 interrupts = <0 57 0>;
103 };
104
105 i2c@12C80000 {
106 compatible = "samsung,s3c2440-i2c";
107 reg = <0x12C80000 0x100>;
108 interrupts = <0 58 0>;
109 };
110
111 i2c@12C90000 {
112 compatible = "samsung,s3c2440-i2c";
113 reg = <0x12C90000 0x100>;
114 interrupts = <0 59 0>;
115 };
116
117 i2c@12CA0000 {
118 compatible = "samsung,s3c2440-i2c";
119 reg = <0x12CA0000 0x100>;
120 interrupts = <0 60 0>;
121 };
122
123 i2c@12CB0000 {
124 compatible = "samsung,s3c2440-i2c";
125 reg = <0x12CB0000 0x100>;
126 interrupts = <0 61 0>;
127 };
128
129 i2c@12CC0000 {
130 compatible = "samsung,s3c2440-i2c";
131 reg = <0x12CC0000 0x100>;
132 interrupts = <0 62 0>;
133 };
134
135 i2c@12CD0000 {
136 compatible = "samsung,s3c2440-i2c";
137 reg = <0x12CD0000 0x100>;
138 interrupts = <0 63 0>;
139 };
140
141 amba {
142 #address-cells = <1>;
143 #size-cells = <1>;
144 compatible = "arm,amba-bus";
145 interrupt-parent = <&gic>;
146 ranges;
147
148 pdma0: pdma@121A0000 {
149 compatible = "arm,pl330", "arm,primecell";
150 reg = <0x121A0000 0x1000>;
151 interrupts = <0 34 0>;
152 };
153
154 pdma1: pdma@121B0000 {
155 compatible = "arm,pl330", "arm,primecell";
156 reg = <0x121B0000 0x1000>;
157 interrupts = <0 35 0>;
158 };
159
160 mdma0: pdma@10800000 {
161 compatible = "arm,pl330", "arm,primecell";
162 reg = <0x10800000 0x1000>;
163 interrupts = <0 33 0>;
164 };
165
166 mdma1: pdma@11C10000 {
167 compatible = "arm,pl330", "arm,primecell";
168 reg = <0x11C10000 0x1000>;
169 interrupts = <0 124 0>;
170 };
171 };
172
173 gpio-controllers {
174 #address-cells = <1>;
175 #size-cells = <1>;
176 gpio-controller;
177 ranges;
178
179 gpa0: gpio-controller@11400000 {
180 compatible = "samsung,exynos4-gpio";
181 reg = <0x11400000 0x20>;
182 #gpio-cells = <4>;
183 };
184
185 gpa1: gpio-controller@11400020 {
186 compatible = "samsung,exynos4-gpio";
187 reg = <0x11400020 0x20>;
188 #gpio-cells = <4>;
189 };
190
191 gpa2: gpio-controller@11400040 {
192 compatible = "samsung,exynos4-gpio";
193 reg = <0x11400040 0x20>;
194 #gpio-cells = <4>;
195 };
196
197 gpb0: gpio-controller@11400060 {
198 compatible = "samsung,exynos4-gpio";
199 reg = <0x11400060 0x20>;
200 #gpio-cells = <4>;
201 };
202
203 gpb1: gpio-controller@11400080 {
204 compatible = "samsung,exynos4-gpio";
205 reg = <0x11400080 0x20>;
206 #gpio-cells = <4>;
207 };
208
209 gpb2: gpio-controller@114000A0 {
210 compatible = "samsung,exynos4-gpio";
211 reg = <0x114000A0 0x20>;
212 #gpio-cells = <4>;
213 };
214
215 gpb3: gpio-controller@114000C0 {
216 compatible = "samsung,exynos4-gpio";
217 reg = <0x114000C0 0x20>;
218 #gpio-cells = <4>;
219 };
220
221 gpc0: gpio-controller@114000E0 {
222 compatible = "samsung,exynos4-gpio";
223 reg = <0x114000E0 0x20>;
224 #gpio-cells = <4>;
225 };
226
227 gpc1: gpio-controller@11400100 {
228 compatible = "samsung,exynos4-gpio";
229 reg = <0x11400100 0x20>;
230 #gpio-cells = <4>;
231 };
232
233 gpc2: gpio-controller@11400120 {
234 compatible = "samsung,exynos4-gpio";
235 reg = <0x11400120 0x20>;
236 #gpio-cells = <4>;
237 };
238
239 gpc3: gpio-controller@11400140 {
240 compatible = "samsung,exynos4-gpio";
241 reg = <0x11400140 0x20>;
242 #gpio-cells = <4>;
243 };
244
245 gpd0: gpio-controller@11400160 {
246 compatible = "samsung,exynos4-gpio";
247 reg = <0x11400160 0x20>;
248 #gpio-cells = <4>;
249 };
250
251 gpd1: gpio-controller@11400180 {
252 compatible = "samsung,exynos4-gpio";
253 reg = <0x11400180 0x20>;
254 #gpio-cells = <4>;
255 };
256
257 gpy0: gpio-controller@114001A0 {
258 compatible = "samsung,exynos4-gpio";
259 reg = <0x114001A0 0x20>;
260 #gpio-cells = <4>;
261 };
262
263 gpy1: gpio-controller@114001C0 {
264 compatible = "samsung,exynos4-gpio";
265 reg = <0x114001C0 0x20>;
266 #gpio-cells = <4>;
267 };
268
269 gpy2: gpio-controller@114001E0 {
270 compatible = "samsung,exynos4-gpio";
271 reg = <0x114001E0 0x20>;
272 #gpio-cells = <4>;
273 };
274
275 gpy3: gpio-controller@11400200 {
276 compatible = "samsung,exynos4-gpio";
277 reg = <0x11400200 0x20>;
278 #gpio-cells = <4>;
279 };
280
281 gpy4: gpio-controller@11400220 {
282 compatible = "samsung,exynos4-gpio";
283 reg = <0x11400220 0x20>;
284 #gpio-cells = <4>;
285 };
286
287 gpy5: gpio-controller@11400240 {
288 compatible = "samsung,exynos4-gpio";
289 reg = <0x11400240 0x20>;
290 #gpio-cells = <4>;
291 };
292
293 gpy6: gpio-controller@11400260 {
294 compatible = "samsung,exynos4-gpio";
295 reg = <0x11400260 0x20>;
296 #gpio-cells = <4>;
297 };
298
299 gpx0: gpio-controller@11400C00 {
300 compatible = "samsung,exynos4-gpio";
301 reg = <0x11400C00 0x20>;
302 #gpio-cells = <4>;
303 };
304
305 gpx1: gpio-controller@11400C20 {
306 compatible = "samsung,exynos4-gpio";
307 reg = <0x11400C20 0x20>;
308 #gpio-cells = <4>;
309 };
310
311 gpx2: gpio-controller@11400C40 {
312 compatible = "samsung,exynos4-gpio";
313 reg = <0x11400C40 0x20>;
314 #gpio-cells = <4>;
315 };
316
317 gpx3: gpio-controller@11400C60 {
318 compatible = "samsung,exynos4-gpio";
319 reg = <0x11400C60 0x20>;
320 #gpio-cells = <4>;
321 };
322
323 gpe0: gpio-controller@13400000 {
324 compatible = "samsung,exynos4-gpio";
325 reg = <0x13400000 0x20>;
326 #gpio-cells = <4>;
327 };
328
329 gpe1: gpio-controller@13400020 {
330 compatible = "samsung,exynos4-gpio";
331 reg = <0x13400020 0x20>;
332 #gpio-cells = <4>;
333 };
334
335 gpf0: gpio-controller@13400040 {
336 compatible = "samsung,exynos4-gpio";
337 reg = <0x13400040 0x20>;
338 #gpio-cells = <4>;
339 };
340
341 gpf1: gpio-controller@13400060 {
342 compatible = "samsung,exynos4-gpio";
343 reg = <0x13400060 0x20>;
344 #gpio-cells = <4>;
345 };
346
347 gpg0: gpio-controller@13400080 {
348 compatible = "samsung,exynos4-gpio";
349 reg = <0x13400080 0x20>;
350 #gpio-cells = <4>;
351 };
352
353 gpg1: gpio-controller@134000A0 {
354 compatible = "samsung,exynos4-gpio";
355 reg = <0x134000A0 0x20>;
356 #gpio-cells = <4>;
357 };
358
359 gpg2: gpio-controller@134000C0 {
360 compatible = "samsung,exynos4-gpio";
361 reg = <0x134000C0 0x20>;
362 #gpio-cells = <4>;
363 };
364
365 gph0: gpio-controller@134000E0 {
366 compatible = "samsung,exynos4-gpio";
367 reg = <0x134000E0 0x20>;
368 #gpio-cells = <4>;
369 };
370
371 gph1: gpio-controller@13400100 {
372 compatible = "samsung,exynos4-gpio";
373 reg = <0x13400100 0x20>;
374 #gpio-cells = <4>;
375 };
376
377 gpv0: gpio-controller@10D10000 {
378 compatible = "samsung,exynos4-gpio";
379 reg = <0x10D10000 0x20>;
380 #gpio-cells = <4>;
381 };
382
383 gpv1: gpio-controller@10D10020 {
384 compatible = "samsung,exynos4-gpio";
385 reg = <0x10D10020 0x20>;
386 #gpio-cells = <4>;
387 };
388
389 gpv2: gpio-controller@10D10040 {
390 compatible = "samsung,exynos4-gpio";
391 reg = <0x10D10040 0x20>;
392 #gpio-cells = <4>;
393 };
394
395 gpv3: gpio-controller@10D10060 {
396 compatible = "samsung,exynos4-gpio";
397 reg = <0x10D10060 0x20>;
398 #gpio-cells = <4>;
399 };
400
401 gpv4: gpio-controller@10D10080 {
402 compatible = "samsung,exynos4-gpio";
403 reg = <0x10D10080 0x20>;
404 #gpio-cells = <4>;
405 };
406
407 gpz: gpio-controller@03860000 {
408 compatible = "samsung,exynos4-gpio";
409 reg = <0x03860000 0x20>;
410 #gpio-cells = <4>;
411 };
412 };
413};
diff --git a/arch/arm/boot/dts/kirkwood-dreamplug.dts b/arch/arm/boot/dts/kirkwood-dreamplug.dts
index 8a5dff807b45..a5376b84227f 100644
--- a/arch/arm/boot/dts/kirkwood-dreamplug.dts
+++ b/arch/arm/boot/dts/kirkwood-dreamplug.dts
@@ -4,7 +4,7 @@
4 4
5/ { 5/ {
6 model = "Globalscale Technologies Dreamplug"; 6 model = "Globalscale Technologies Dreamplug";
7 compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood"; 7 compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
8 8
9 memory { 9 memory {
10 device_type = "memory"; 10 device_type = "memory";
@@ -15,11 +15,10 @@
15 bootargs = "console=ttyS0,115200n8 earlyprintk"; 15 bootargs = "console=ttyS0,115200n8 earlyprintk";
16 }; 16 };
17 17
18 serial@f1012000 { 18 ocp@f1000000 {
19 compatible = "ns16550a"; 19 serial@12000 {
20 reg = <0xf1012000 0xff>; 20 clock-frequency = <200000000>;
21 reg-shift = <2>; 21 status = "ok";
22 interrupts = <33>; 22 };
23 clock-frequency = <200000000>;
24 }; 23 };
25}; 24};
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 771c6bbeb29a..3474ef890945 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -1,6 +1,36 @@
1/include/ "skeleton.dtsi" 1/include/ "skeleton.dtsi"
2 2
3/ { 3/ {
4 compatible = "marvell,kirkwood"; 4 compatible = "mrvl,kirkwood";
5}; 5
6 ocp@f1000000 {
7 compatible = "simple-bus";
8 ranges = <0 0xf1000000 0x1000000>;
9 #address-cells = <1>;
10 #size-cells = <1>;
11
12 serial@12000 {
13 compatible = "ns16550a";
14 reg = <0x12000 0x100>;
15 reg-shift = <2>;
16 interrupts = <33>;
17 /* set clock-frequency in board dts */
18 status = "disabled";
19 };
6 20
21 serial@12100 {
22 compatible = "ns16550a";
23 reg = <0x12100 0x100>;
24 reg-shift = <2>;
25 interrupts = <34>;
26 /* set clock-frequency in board dts */
27 status = "disabled";
28 };
29
30 rtc@10300 {
31 compatible = "mrvl,kirkwood-rtc", "mrvl,orion-rtc";
32 reg = <0x10300 0x20>;
33 interrupts = <53>;
34 };
35 };
36};
diff --git a/arch/arm/boot/dts/snowball.dts b/arch/arm/boot/dts/snowball.dts
new file mode 100644
index 000000000000..359c6d679156
--- /dev/null
+++ b/arch/arm/boot/dts/snowball.dts
@@ -0,0 +1,139 @@
1/*
2 * Copyright 2011 ST-Ericsson AB
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "db8500.dtsi"
14
15/ {
16 model = "Calao Systems Snowball platform with device tree";
17 compatible = "calaosystems,snowball-a9500";
18
19 memory {
20 reg = <0x00000000 0x20000000>;
21 };
22
23 gpio_keys {
24 compatible = "gpio-keys";
25 #address-cells = <1>;
26 #size-cells = <0>;
27
28 button@1 {
29 debounce_interval = <50>;
30 wakeup = <1>;
31 linux,code = <2>;
32 label = "userpb";
33 gpios = <&gpio1 0>;
34 };
35 button@2 {
36 debounce_interval = <50>;
37 wakeup = <1>;
38 linux,code = <3>;
39 label = "userpb";
40 gpios = <&gpio4 23>;
41 };
42 button@3 {
43 debounce_interval = <50>;
44 wakeup = <1>;
45 linux,code = <4>;
46 label = "userpb";
47 gpios = <&gpio4 23>;
48 };
49 button@4 {
50 debounce_interval = <50>;
51 wakeup = <1>;
52 linux,code = <5>;
53 label = "userpb";
54 gpios = <&gpio5 1>;
55 };
56 button@5 {
57 debounce_interval = <50>;
58 wakeup = <1>;
59 linux,code = <6>;
60 label = "userpb";
61 gpios = <&gpio5 2>;
62 };
63 };
64
65 leds {
66 compatible = "gpio-leds";
67 used-led {
68 label = "user_led";
69 gpios = <&gpio4 14>;
70 };
71 };
72
73 soc-u9500 {
74
75 external-bus@50000000 {
76 compatible = "simple-bus";
77 reg = <0x50000000 0x10000000>;
78 #address-cells = <1>;
79 #size-cells = <1>;
80 ranges;
81
82 ethernet@50000000 {
83 compatible = "smsc,9111";
84 reg = <0x50000000 0x10000>;
85 interrupts = <12>;
86 interrupt-parent = <&gpio4>;
87 };
88 };
89
90 sdi@80126000 {
91 status = "enabled";
92 cd-gpios = <&gpio6 26>;
93 };
94
95 sdi@80114000 {
96 status = "enabled";
97 };
98
99 uart@80120000 {
100 status = "okay";
101 };
102
103 uart@80121000 {
104 status = "okay";
105 };
106
107 uart@80007000 {
108 status = "okay";
109 };
110
111 i2c@80004000 {
112 tc3589x@42 {
113 //compatible = "tc3589x";
114 reg = <0x42>;
115 interrupts = <25>;
116 interrupt-parent = <&gpio6>;
117 };
118 tps61052@33 {
119 //compatible = "tps61052";
120 reg = <0x33>;
121 };
122 };
123
124 i2c@80128000 {
125 lp5521@0x33 {
126 // compatible = "lp5521";
127 reg = <0x33>;
128 };
129 lp5521@0x34 {
130 // compatible = "lp5521";
131 reg = <0x34>;
132 };
133 bh1780@0x29 {
134 // compatible = "rohm,bh1780gli";
135 reg = <0x33>;
136 };
137 };
138 };
139};
diff --git a/arch/arm/boot/dts/spear600-evb.dts b/arch/arm/boot/dts/spear600-evb.dts
new file mode 100644
index 000000000000..636292e18c90
--- /dev/null
+++ b/arch/arm/boot/dts/spear600-evb.dts
@@ -0,0 +1,47 @@
1/*
2 * Copyright 2012 Stefan Roese <sr@denx.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/dts-v1/;
13/include/ "spear600.dtsi"
14
15/ {
16 model = "ST SPEAr600 Evaluation Board";
17 compatible = "st,spear600-evb", "st,spear600";
18 #address-cells = <1>;
19 #size-cells = <1>;
20
21 memory {
22 device_type = "memory";
23 reg = <0 0x10000000>;
24 };
25
26 ahb {
27 gmac: ethernet@e0800000 {
28 phy-mode = "gmii";
29 status = "okay";
30 };
31
32 apb {
33 serial@d0000000 {
34 status = "okay";
35 };
36
37 serial@d0080000 {
38 status = "okay";
39 };
40
41 i2c@d0200000 {
42 clock-frequency = <400000>;
43 status = "okay";
44 };
45 };
46 };
47};
diff --git a/arch/arm/boot/dts/spear600.dtsi b/arch/arm/boot/dts/spear600.dtsi
new file mode 100644
index 000000000000..ebe0885a2b98
--- /dev/null
+++ b/arch/arm/boot/dts/spear600.dtsi
@@ -0,0 +1,174 @@
1/*
2 * Copyright 2012 Stefan Roese <sr@denx.de>
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12/include/ "skeleton.dtsi"
13
14/ {
15 compatible = "st,spear600";
16
17 cpus {
18 cpu@0 {
19 compatible = "arm,arm926ejs";
20 };
21 };
22
23 memory {
24 device_type = "memory";
25 reg = <0 0x40000000>;
26 };
27
28 ahb {
29 #address-cells = <1>;
30 #size-cells = <1>;
31 compatible = "simple-bus";
32 ranges = <0xd0000000 0xd0000000 0x30000000>;
33
34 vic0: interrupt-controller@f1100000 {
35 compatible = "arm,pl190-vic";
36 interrupt-controller;
37 reg = <0xf1100000 0x1000>;
38 #interrupt-cells = <1>;
39 };
40
41 vic1: interrupt-controller@f1000000 {
42 compatible = "arm,pl190-vic";
43 interrupt-controller;
44 reg = <0xf1000000 0x1000>;
45 #interrupt-cells = <1>;
46 };
47
48 gmac: ethernet@e0800000 {
49 compatible = "st,spear600-gmac";
50 reg = <0xe0800000 0x8000>;
51 interrupt-parent = <&vic1>;
52 interrupts = <24 23>;
53 interrupt-names = "macirq", "eth_wake_irq";
54 status = "disabled";
55 };
56
57 fsmc: flash@d1800000 {
58 compatible = "st,spear600-fsmc-nand";
59 #address-cells = <1>;
60 #size-cells = <1>;
61 reg = <0xd1800000 0x1000 /* FSMC Register */
62 0xd2000000 0x4000>; /* NAND Base */
63 reg-names = "fsmc_regs", "nand_data";
64 st,ale-off = <0x20000>;
65 st,cle-off = <0x10000>;
66 status = "disabled";
67 };
68
69 smi: flash@fc000000 {
70 compatible = "st,spear600-smi";
71 #address-cells = <1>;
72 #size-cells = <1>;
73 reg = <0xfc000000 0x1000>;
74 interrupt-parent = <&vic1>;
75 interrupts = <12>;
76 status = "disabled";
77 };
78
79 ehci@e1800000 {
80 compatible = "st,spear600-ehci", "usb-ehci";
81 reg = <0xe1800000 0x1000>;
82 interrupt-parent = <&vic1>;
83 interrupts = <27>;
84 status = "disabled";
85 };
86
87 ehci@e2000000 {
88 compatible = "st,spear600-ehci", "usb-ehci";
89 reg = <0xe2000000 0x1000>;
90 interrupt-parent = <&vic1>;
91 interrupts = <29>;
92 status = "disabled";
93 };
94
95 ohci@e1900000 {
96 compatible = "st,spear600-ohci", "usb-ohci";
97 reg = <0xe1900000 0x1000>;
98 interrupt-parent = <&vic1>;
99 interrupts = <26>;
100 status = "disabled";
101 };
102
103 ohci@e2100000 {
104 compatible = "st,spear600-ohci", "usb-ohci";
105 reg = <0xe2100000 0x1000>;
106 interrupt-parent = <&vic1>;
107 interrupts = <28>;
108 status = "disabled";
109 };
110
111 apb {
112 #address-cells = <1>;
113 #size-cells = <1>;
114 compatible = "simple-bus";
115 ranges = <0xd0000000 0xd0000000 0x30000000>;
116
117 serial@d0000000 {
118 compatible = "arm,pl011", "arm,primecell";
119 reg = <0xd0000000 0x1000>;
120 interrupt-parent = <&vic0>;
121 interrupts = <24>;
122 status = "disabled";
123 };
124
125 serial@d0080000 {
126 compatible = "arm,pl011", "arm,primecell";
127 reg = <0xd0080000 0x1000>;
128 interrupt-parent = <&vic0>;
129 interrupts = <25>;
130 status = "disabled";
131 };
132
133 /* local/cpu GPIO */
134 gpio0: gpio@f0100000 {
135 #gpio-cells = <2>;
136 compatible = "arm,pl061", "arm,primecell";
137 gpio-controller;
138 reg = <0xf0100000 0x1000>;
139 interrupt-parent = <&vic0>;
140 interrupts = <18>;
141 };
142
143 /* basic GPIO */
144 gpio1: gpio@fc980000 {
145 #gpio-cells = <2>;
146 compatible = "arm,pl061", "arm,primecell";
147 gpio-controller;
148 reg = <0xfc980000 0x1000>;
149 interrupt-parent = <&vic1>;
150 interrupts = <19>;
151 };
152
153 /* appl GPIO */
154 gpio2: gpio@d8100000 {
155 #gpio-cells = <2>;
156 compatible = "arm,pl061", "arm,primecell";
157 gpio-controller;
158 reg = <0xd8100000 0x1000>;
159 interrupt-parent = <&vic1>;
160 interrupts = <4>;
161 };
162
163 i2c@d0200000 {
164 #address-cells = <1>;
165 #size-cells = <0>;
166 compatible = "snps,designware-i2c";
167 reg = <0xd0200000 0x1000>;
168 interrupt-parent = <&vic0>;
169 interrupts = <28>;
170 status = "disabled";
171 };
172 };
173 };
174};
diff --git a/arch/arm/boot/dts/tegra-cardhu.dts b/arch/arm/boot/dts/tegra-cardhu.dts
index 73263501f581..ac3fb7558459 100644
--- a/arch/arm/boot/dts/tegra-cardhu.dts
+++ b/arch/arm/boot/dts/tegra-cardhu.dts
@@ -14,6 +14,22 @@
14 clock-frequency = < 408000000 >; 14 clock-frequency = < 408000000 >;
15 }; 15 };
16 16
17 serial@70006040 {
18 status = "disable";
19 };
20
21 serial@70006200 {
22 status = "disable";
23 };
24
25 serial@70006300 {
26 status = "disable";
27 };
28
29 serial@70006400 {
30 status = "disable";
31 };
32
17 i2c@7000c000 { 33 i2c@7000c000 {
18 clock-frequency = <100000>; 34 clock-frequency = <100000>;
19 }; 35 };
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index 876d5c92ce36..dbf1c5a171c2 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -112,6 +112,7 @@
112 112
113 usb@c5000000 { 113 usb@c5000000 {
114 nvidia,vbus-gpio = <&gpio 24 0>; /* PD0 */ 114 nvidia,vbus-gpio = <&gpio 24 0>; /* PD0 */
115 dr_mode = "otg";
115 }; 116 };
116 117
117 gpio-keys { 118 gpio-keys {
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index aff8a175aa40..108e894a8926 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -190,6 +190,7 @@
190 reg = <0xc5000000 0x4000>; 190 reg = <0xc5000000 0x4000>;
191 interrupts = < 0 20 0x04 >; 191 interrupts = < 0 20 0x04 >;
192 phy_type = "utmi"; 192 phy_type = "utmi";
193 nvidia,has-legacy-mode;
193 }; 194 };
194 195
195 usb@c5004000 { 196 usb@c5004000 {
diff --git a/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi b/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi
new file mode 100644
index 000000000000..ad3eca17c436
--- /dev/null
+++ b/arch/arm/boot/dts/usb_a9g20-dab-mmx.dtsi
@@ -0,0 +1,96 @@
1/*
2 * calao-dab-mmx.dtsi - Device Tree Include file for Calao DAB-MMX Daughter Board
3 *
4 * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
5 *
6 * Licensed under GPLv2.
7 */
8
9/ {
10 ahb {
11 apb {
12 usart1: serial@fffb4000 {
13 status = "okay";
14 };
15
16 usart3: serial@fffd0000 {
17 status = "okay";
18 };
19 };
20 };
21
22 i2c-gpio@0 {
23 status = "okay";
24 };
25
26 leds {
27 compatible = "gpio-leds";
28
29 user_led1 {
30 label = "user_led1";
31 gpios = <&pioB 20 1>;
32 };
33
34/*
35* led already used by mother board but active as high
36* user_led2 {
37* label = "user_led2";
38* gpios = <&pioB 21 1>;
39* };
40*/
41 user_led3 {
42 label = "user_led3";
43 gpios = <&pioB 22 1>;
44 };
45
46 user_led4 {
47 label = "user_led4";
48 gpios = <&pioB 23 1>;
49 };
50
51 red {
52 label = "red";
53 gpios = <&pioB 24 1>;
54 };
55
56 orange {
57 label = "orange";
58 gpios = <&pioB 30 1>;
59 };
60
61 green {
62 label = "green";
63 gpios = <&pioB 31 1>;
64 };
65 };
66
67 gpio_keys {
68 compatible = "gpio-keys";
69 #address-cells = <1>;
70 #size-cells = <0>;
71
72 user_pb1 {
73 label = "user_pb1";
74 gpios = <&pioB 25 1>;
75 linux,code = <0x100>;
76 };
77
78 user_pb2 {
79 label = "user_pb2";
80 gpios = <&pioB 13 1>;
81 linux,code = <0x101>;
82 };
83
84 user_pb3 {
85 label = "user_pb3";
86 gpios = <&pioA 26 1>;
87 linux,code = <0x102>;
88 };
89
90 user_pb4 {
91 label = "user_pb4";
92 gpios = <&pioC 9 1>;
93 linux,code = <0x103>;
94 };
95 };
96};
diff --git a/arch/arm/boot/dts/usb_a9g20.dts b/arch/arm/boot/dts/usb_a9g20.dts
index d74545a2a77c..7c2399c532e5 100644
--- a/arch/arm/boot/dts/usb_a9g20.dts
+++ b/arch/arm/boot/dts/usb_a9g20.dts
@@ -13,13 +13,24 @@
13 compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9"; 13 compatible = "calao,usb-a9g20", "atmel,at91sam9g20", "atmel,at91sam9";
14 14
15 chosen { 15 chosen {
16 bootargs = "mem=64M console=ttyS0,115200 mtdparts=atmel_nand:128k(at91bootstrap),256k(barebox)ro,128k(bareboxenv),128k(bareboxenv2),4M(kernel),120M(rootfs),-(data) root=/dev/mtdblock5 rw rootfstype=ubifs"; 16 bootargs = "mem=64M console=ttyS0,115200 root=/dev/mtdblock5 rw rootfstype=ubifs";
17 }; 17 };
18 18
19 memory@20000000 { 19 memory {
20 reg = <0x20000000 0x4000000>; 20 reg = <0x20000000 0x4000000>;
21 }; 21 };
22 22
23 clocks {
24 #address-cells = <1>;
25 #size-cells = <1>;
26 ranges;
27
28 main_clock: clock@0 {
29 compatible = "atmel,osc", "fixed-clock";
30 clock-frequency = <12000000>;
31 };
32 };
33
23 ahb { 34 ahb {
24 apb { 35 apb {
25 dbgu: serial@fffff200 { 36 dbgu: serial@fffff200 {
@@ -30,6 +41,58 @@
30 phy-mode = "rmii"; 41 phy-mode = "rmii";
31 status = "okay"; 42 status = "okay";
32 }; 43 };
44
45 usb1: gadget@fffa4000 {
46 atmel,vbus-gpio = <&pioC 5 0>;
47 status = "okay";
48 };
49 };
50
51 nand0: nand@40000000 {
52 nand-bus-width = <8>;
53 nand-ecc-mode = "soft";
54 nand-on-flash-bbt;
55 status = "okay";
56
57 at91bootstrap@0 {
58 label = "at91bootstrap";
59 reg = <0x0 0x20000>;
60 };
61
62 barebox@20000 {
63 label = "barebox";
64 reg = <0x20000 0x40000>;
65 };
66
67 bareboxenv@60000 {
68 label = "bareboxenv";
69 reg = <0x60000 0x20000>;
70 };
71
72 bareboxenv2@80000 {
73 label = "bareboxenv2";
74 reg = <0x80000 0x20000>;
75 };
76
77 kernel@a0000 {
78 label = "kernel";
79 reg = <0xa0000 0x400000>;
80 };
81
82 rootfs@4a0000 {
83 label = "rootfs";
84 reg = <0x4a0000 0x7800000>;
85 };
86
87 data@7ca0000 {
88 label = "data";
89 reg = <0x7ca0000 0x8360000>;
90 };
91 };
92
93 usb0: ohci@00500000 {
94 num-ports = <2>;
95 status = "okay";
33 }; 96 };
34 }; 97 };
35 98
@@ -55,4 +118,13 @@
55 gpio-key,wakeup; 118 gpio-key,wakeup;
56 }; 119 };
57 }; 120 };
121
122 i2c@0 {
123 status = "okay";
124
125 rv3029c2@56 {
126 compatible = "rv3029c2";
127 reg = <0x56>;
128 };
129 };
58}; 130};
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 81a933eb0903..283fa1d804f4 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -24,9 +24,6 @@ config ARM_VIC_NR
24config ICST 24config ICST
25 bool 25 bool
26 26
27config PL330
28 bool
29
30config SA1111 27config SA1111
31 bool 28 bool
32 select DMABOUNCE if !ARCH_PXA 29 select DMABOUNCE if !ARCH_PXA
@@ -35,9 +32,6 @@ config DMABOUNCE
35 bool 32 bool
36 select ZONE_DMA 33 select ZONE_DMA
37 34
38config TIMER_ACORN
39 bool
40
41config SHARP_LOCOMO 35config SHARP_LOCOMO
42 bool 36 bool
43 37
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index 6ea9b6f3607a..215816f1775f 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -5,11 +5,9 @@
5obj-$(CONFIG_ARM_GIC) += gic.o 5obj-$(CONFIG_ARM_GIC) += gic.o
6obj-$(CONFIG_ARM_VIC) += vic.o 6obj-$(CONFIG_ARM_VIC) += vic.o
7obj-$(CONFIG_ICST) += icst.o 7obj-$(CONFIG_ICST) += icst.o
8obj-$(CONFIG_PL330) += pl330.o
9obj-$(CONFIG_SA1111) += sa1111.o 8obj-$(CONFIG_SA1111) += sa1111.o
10obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o 9obj-$(CONFIG_PCI_HOST_VIA82C505) += via82c505.o
11obj-$(CONFIG_DMABOUNCE) += dmabounce.o 10obj-$(CONFIG_DMABOUNCE) += dmabounce.o
12obj-$(CONFIG_TIMER_ACORN) += time-acorn.o
13obj-$(CONFIG_SHARP_LOCOMO) += locomo.o 11obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
14obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o 12obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
15obj-$(CONFIG_SHARP_SCOOP) += scoop.o 13obj-$(CONFIG_SHARP_SCOOP) += scoop.o
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index f0783be17352..aa5269984187 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -686,13 +686,12 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start,
686 * For primary GICs, skip over SGIs. 686 * For primary GICs, skip over SGIs.
687 * For secondary GICs, skip over PPIs, too. 687 * For secondary GICs, skip over PPIs, too.
688 */ 688 */
689 hwirq_base = 32; 689 if (gic_nr == 0 && (irq_start & 31) > 0) {
690 if (gic_nr == 0) { 690 hwirq_base = 16;
691 if ((irq_start & 31) > 0) { 691 if (irq_start != -1)
692 hwirq_base = 16; 692 irq_start = (irq_start & ~31) + 16;
693 if (irq_start != -1) 693 } else {
694 irq_start = (irq_start & ~31) + 16; 694 hwirq_base = 32;
695 }
696 } 695 }
697 696
698 /* 697 /*
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
deleted file mode 100644
index ff3ad2244824..000000000000
--- a/arch/arm/common/pl330.c
+++ /dev/null
@@ -1,1960 +0,0 @@
1/* linux/arch/arm/common/pl330.c
2 *
3 * Copyright (C) 2010 Samsung Electronics Co Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/slab.h>
24#include <linux/module.h>
25#include <linux/string.h>
26#include <linux/io.h>
27#include <linux/delay.h>
28#include <linux/interrupt.h>
29#include <linux/dma-mapping.h>
30
31#include <asm/hardware/pl330.h>
32
33/* Register and Bit field Definitions */
34#define DS 0x0
35#define DS_ST_STOP 0x0
36#define DS_ST_EXEC 0x1
37#define DS_ST_CMISS 0x2
38#define DS_ST_UPDTPC 0x3
39#define DS_ST_WFE 0x4
40#define DS_ST_ATBRR 0x5
41#define DS_ST_QBUSY 0x6
42#define DS_ST_WFP 0x7
43#define DS_ST_KILL 0x8
44#define DS_ST_CMPLT 0x9
45#define DS_ST_FLTCMP 0xe
46#define DS_ST_FAULT 0xf
47
48#define DPC 0x4
49#define INTEN 0x20
50#define ES 0x24
51#define INTSTATUS 0x28
52#define INTCLR 0x2c
53#define FSM 0x30
54#define FSC 0x34
55#define FTM 0x38
56
57#define _FTC 0x40
58#define FTC(n) (_FTC + (n)*0x4)
59
60#define _CS 0x100
61#define CS(n) (_CS + (n)*0x8)
62#define CS_CNS (1 << 21)
63
64#define _CPC 0x104
65#define CPC(n) (_CPC + (n)*0x8)
66
67#define _SA 0x400
68#define SA(n) (_SA + (n)*0x20)
69
70#define _DA 0x404
71#define DA(n) (_DA + (n)*0x20)
72
73#define _CC 0x408
74#define CC(n) (_CC + (n)*0x20)
75
76#define CC_SRCINC (1 << 0)
77#define CC_DSTINC (1 << 14)
78#define CC_SRCPRI (1 << 8)
79#define CC_DSTPRI (1 << 22)
80#define CC_SRCNS (1 << 9)
81#define CC_DSTNS (1 << 23)
82#define CC_SRCIA (1 << 10)
83#define CC_DSTIA (1 << 24)
84#define CC_SRCBRSTLEN_SHFT 4
85#define CC_DSTBRSTLEN_SHFT 18
86#define CC_SRCBRSTSIZE_SHFT 1
87#define CC_DSTBRSTSIZE_SHFT 15
88#define CC_SRCCCTRL_SHFT 11
89#define CC_SRCCCTRL_MASK 0x7
90#define CC_DSTCCTRL_SHFT 25
91#define CC_DRCCCTRL_MASK 0x7
92#define CC_SWAP_SHFT 28
93
94#define _LC0 0x40c
95#define LC0(n) (_LC0 + (n)*0x20)
96
97#define _LC1 0x410
98#define LC1(n) (_LC1 + (n)*0x20)
99
100#define DBGSTATUS 0xd00
101#define DBG_BUSY (1 << 0)
102
103#define DBGCMD 0xd04
104#define DBGINST0 0xd08
105#define DBGINST1 0xd0c
106
107#define CR0 0xe00
108#define CR1 0xe04
109#define CR2 0xe08
110#define CR3 0xe0c
111#define CR4 0xe10
112#define CRD 0xe14
113
114#define PERIPH_ID 0xfe0
115#define PCELL_ID 0xff0
116
117#define CR0_PERIPH_REQ_SET (1 << 0)
118#define CR0_BOOT_EN_SET (1 << 1)
119#define CR0_BOOT_MAN_NS (1 << 2)
120#define CR0_NUM_CHANS_SHIFT 4
121#define CR0_NUM_CHANS_MASK 0x7
122#define CR0_NUM_PERIPH_SHIFT 12
123#define CR0_NUM_PERIPH_MASK 0x1f
124#define CR0_NUM_EVENTS_SHIFT 17
125#define CR0_NUM_EVENTS_MASK 0x1f
126
127#define CR1_ICACHE_LEN_SHIFT 0
128#define CR1_ICACHE_LEN_MASK 0x7
129#define CR1_NUM_ICACHELINES_SHIFT 4
130#define CR1_NUM_ICACHELINES_MASK 0xf
131
132#define CRD_DATA_WIDTH_SHIFT 0
133#define CRD_DATA_WIDTH_MASK 0x7
134#define CRD_WR_CAP_SHIFT 4
135#define CRD_WR_CAP_MASK 0x7
136#define CRD_WR_Q_DEP_SHIFT 8
137#define CRD_WR_Q_DEP_MASK 0xf
138#define CRD_RD_CAP_SHIFT 12
139#define CRD_RD_CAP_MASK 0x7
140#define CRD_RD_Q_DEP_SHIFT 16
141#define CRD_RD_Q_DEP_MASK 0xf
142#define CRD_DATA_BUFF_SHIFT 20
143#define CRD_DATA_BUFF_MASK 0x3ff
144
145#define PART 0x330
146#define DESIGNER 0x41
147#define REVISION 0x0
148#define INTEG_CFG 0x0
149#define PERIPH_ID_VAL ((PART << 0) | (DESIGNER << 12))
150
151#define PCELL_ID_VAL 0xb105f00d
152
153#define PL330_STATE_STOPPED (1 << 0)
154#define PL330_STATE_EXECUTING (1 << 1)
155#define PL330_STATE_WFE (1 << 2)
156#define PL330_STATE_FAULTING (1 << 3)
157#define PL330_STATE_COMPLETING (1 << 4)
158#define PL330_STATE_WFP (1 << 5)
159#define PL330_STATE_KILLING (1 << 6)
160#define PL330_STATE_FAULT_COMPLETING (1 << 7)
161#define PL330_STATE_CACHEMISS (1 << 8)
162#define PL330_STATE_UPDTPC (1 << 9)
163#define PL330_STATE_ATBARRIER (1 << 10)
164#define PL330_STATE_QUEUEBUSY (1 << 11)
165#define PL330_STATE_INVALID (1 << 15)
166
167#define PL330_STABLE_STATES (PL330_STATE_STOPPED | PL330_STATE_EXECUTING \
168 | PL330_STATE_WFE | PL330_STATE_FAULTING)
169
170#define CMD_DMAADDH 0x54
171#define CMD_DMAEND 0x00
172#define CMD_DMAFLUSHP 0x35
173#define CMD_DMAGO 0xa0
174#define CMD_DMALD 0x04
175#define CMD_DMALDP 0x25
176#define CMD_DMALP 0x20
177#define CMD_DMALPEND 0x28
178#define CMD_DMAKILL 0x01
179#define CMD_DMAMOV 0xbc
180#define CMD_DMANOP 0x18
181#define CMD_DMARMB 0x12
182#define CMD_DMASEV 0x34
183#define CMD_DMAST 0x08
184#define CMD_DMASTP 0x29
185#define CMD_DMASTZ 0x0c
186#define CMD_DMAWFE 0x36
187#define CMD_DMAWFP 0x30
188#define CMD_DMAWMB 0x13
189
190#define SZ_DMAADDH 3
191#define SZ_DMAEND 1
192#define SZ_DMAFLUSHP 2
193#define SZ_DMALD 1
194#define SZ_DMALDP 2
195#define SZ_DMALP 2
196#define SZ_DMALPEND 2
197#define SZ_DMAKILL 1
198#define SZ_DMAMOV 6
199#define SZ_DMANOP 1
200#define SZ_DMARMB 1
201#define SZ_DMASEV 2
202#define SZ_DMAST 1
203#define SZ_DMASTP 2
204#define SZ_DMASTZ 1
205#define SZ_DMAWFE 2
206#define SZ_DMAWFP 2
207#define SZ_DMAWMB 1
208#define SZ_DMAGO 6
209
210#define BRST_LEN(ccr) ((((ccr) >> CC_SRCBRSTLEN_SHFT) & 0xf) + 1)
211#define BRST_SIZE(ccr) (1 << (((ccr) >> CC_SRCBRSTSIZE_SHFT) & 0x7))
212
213#define BYTE_TO_BURST(b, ccr) ((b) / BRST_SIZE(ccr) / BRST_LEN(ccr))
214#define BURST_TO_BYTE(c, ccr) ((c) * BRST_SIZE(ccr) * BRST_LEN(ccr))
215
216/*
217 * With 256 bytes, we can do more than 2.5MB and 5MB xfers per req
218 * at 1byte/burst for P<->M and M<->M respectively.
219 * For typical scenario, at 1word/burst, 10MB and 20MB xfers per req
220 * should be enough for P<->M and M<->M respectively.
221 */
222#define MCODE_BUFF_PER_REQ 256
223
224/* If the _pl330_req is available to the client */
225#define IS_FREE(req) (*((u8 *)((req)->mc_cpu)) == CMD_DMAEND)
226
227/* Use this _only_ to wait on transient states */
228#define UNTIL(t, s) while (!(_state(t) & (s))) cpu_relax();
229
230#ifdef PL330_DEBUG_MCGEN
231static unsigned cmd_line;
232#define PL330_DBGCMD_DUMP(off, x...) do { \
233 printk("%x:", cmd_line); \
234 printk(x); \
235 cmd_line += off; \
236 } while (0)
237#define PL330_DBGMC_START(addr) (cmd_line = addr)
238#else
239#define PL330_DBGCMD_DUMP(off, x...) do {} while (0)
240#define PL330_DBGMC_START(addr) do {} while (0)
241#endif
242
243struct _xfer_spec {
244 u32 ccr;
245 struct pl330_req *r;
246 struct pl330_xfer *x;
247};
248
249enum dmamov_dst {
250 SAR = 0,
251 CCR,
252 DAR,
253};
254
255enum pl330_dst {
256 SRC = 0,
257 DST,
258};
259
260enum pl330_cond {
261 SINGLE,
262 BURST,
263 ALWAYS,
264};
265
266struct _pl330_req {
267 u32 mc_bus;
268 void *mc_cpu;
269 /* Number of bytes taken to setup MC for the req */
270 u32 mc_len;
271 struct pl330_req *r;
272 /* Hook to attach to DMAC's list of reqs with due callback */
273 struct list_head rqd;
274};
275
276/* ToBeDone for tasklet */
277struct _pl330_tbd {
278 bool reset_dmac;
279 bool reset_mngr;
280 u8 reset_chan;
281};
282
283/* A DMAC Thread */
284struct pl330_thread {
285 u8 id;
286 int ev;
287 /* If the channel is not yet acquired by any client */
288 bool free;
289 /* Parent DMAC */
290 struct pl330_dmac *dmac;
291 /* Only two at a time */
292 struct _pl330_req req[2];
293 /* Index of the last enqueued request */
294 unsigned lstenq;
295 /* Index of the last submitted request or -1 if the DMA is stopped */
296 int req_running;
297};
298
299enum pl330_dmac_state {
300 UNINIT,
301 INIT,
302 DYING,
303};
304
305/* A DMAC */
306struct pl330_dmac {
307 spinlock_t lock;
308 /* Holds list of reqs with due callbacks */
309 struct list_head req_done;
310 /* Pointer to platform specific stuff */
311 struct pl330_info *pinfo;
312 /* Maximum possible events/irqs */
313 int events[32];
314 /* BUS address of MicroCode buffer */
315 u32 mcode_bus;
316 /* CPU address of MicroCode buffer */
317 void *mcode_cpu;
318 /* List of all Channel threads */
319 struct pl330_thread *channels;
320 /* Pointer to the MANAGER thread */
321 struct pl330_thread *manager;
322 /* To handle bad news in interrupt */
323 struct tasklet_struct tasks;
324 struct _pl330_tbd dmac_tbd;
325 /* State of DMAC operation */
326 enum pl330_dmac_state state;
327};
328
329static inline void _callback(struct pl330_req *r, enum pl330_op_err err)
330{
331 if (r && r->xfer_cb)
332 r->xfer_cb(r->token, err);
333}
334
335static inline bool _queue_empty(struct pl330_thread *thrd)
336{
337 return (IS_FREE(&thrd->req[0]) && IS_FREE(&thrd->req[1]))
338 ? true : false;
339}
340
341static inline bool _queue_full(struct pl330_thread *thrd)
342{
343 return (IS_FREE(&thrd->req[0]) || IS_FREE(&thrd->req[1]))
344 ? false : true;
345}
346
347static inline bool is_manager(struct pl330_thread *thrd)
348{
349 struct pl330_dmac *pl330 = thrd->dmac;
350
351 /* MANAGER is indexed at the end */
352 if (thrd->id == pl330->pinfo->pcfg.num_chan)
353 return true;
354 else
355 return false;
356}
357
358/* If manager of the thread is in Non-Secure mode */
359static inline bool _manager_ns(struct pl330_thread *thrd)
360{
361 struct pl330_dmac *pl330 = thrd->dmac;
362
363 return (pl330->pinfo->pcfg.mode & DMAC_MODE_NS) ? true : false;
364}
365
366static inline u32 get_id(struct pl330_info *pi, u32 off)
367{
368 void __iomem *regs = pi->base;
369 u32 id = 0;
370
371 id |= (readb(regs + off + 0x0) << 0);
372 id |= (readb(regs + off + 0x4) << 8);
373 id |= (readb(regs + off + 0x8) << 16);
374 id |= (readb(regs + off + 0xc) << 24);
375
376 return id;
377}
378
379static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[],
380 enum pl330_dst da, u16 val)
381{
382 if (dry_run)
383 return SZ_DMAADDH;
384
385 buf[0] = CMD_DMAADDH;
386 buf[0] |= (da << 1);
387 *((u16 *)&buf[1]) = val;
388
389 PL330_DBGCMD_DUMP(SZ_DMAADDH, "\tDMAADDH %s %u\n",
390 da == 1 ? "DA" : "SA", val);
391
392 return SZ_DMAADDH;
393}
394
395static inline u32 _emit_END(unsigned dry_run, u8 buf[])
396{
397 if (dry_run)
398 return SZ_DMAEND;
399
400 buf[0] = CMD_DMAEND;
401
402 PL330_DBGCMD_DUMP(SZ_DMAEND, "\tDMAEND\n");
403
404 return SZ_DMAEND;
405}
406
407static inline u32 _emit_FLUSHP(unsigned dry_run, u8 buf[], u8 peri)
408{
409 if (dry_run)
410 return SZ_DMAFLUSHP;
411
412 buf[0] = CMD_DMAFLUSHP;
413
414 peri &= 0x1f;
415 peri <<= 3;
416 buf[1] = peri;
417
418 PL330_DBGCMD_DUMP(SZ_DMAFLUSHP, "\tDMAFLUSHP %u\n", peri >> 3);
419
420 return SZ_DMAFLUSHP;
421}
422
423static inline u32 _emit_LD(unsigned dry_run, u8 buf[], enum pl330_cond cond)
424{
425 if (dry_run)
426 return SZ_DMALD;
427
428 buf[0] = CMD_DMALD;
429
430 if (cond == SINGLE)
431 buf[0] |= (0 << 1) | (1 << 0);
432 else if (cond == BURST)
433 buf[0] |= (1 << 1) | (1 << 0);
434
435 PL330_DBGCMD_DUMP(SZ_DMALD, "\tDMALD%c\n",
436 cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'A'));
437
438 return SZ_DMALD;
439}
440
441static inline u32 _emit_LDP(unsigned dry_run, u8 buf[],
442 enum pl330_cond cond, u8 peri)
443{
444 if (dry_run)
445 return SZ_DMALDP;
446
447 buf[0] = CMD_DMALDP;
448
449 if (cond == BURST)
450 buf[0] |= (1 << 1);
451
452 peri &= 0x1f;
453 peri <<= 3;
454 buf[1] = peri;
455
456 PL330_DBGCMD_DUMP(SZ_DMALDP, "\tDMALDP%c %u\n",
457 cond == SINGLE ? 'S' : 'B', peri >> 3);
458
459 return SZ_DMALDP;
460}
461
462static inline u32 _emit_LP(unsigned dry_run, u8 buf[],
463 unsigned loop, u8 cnt)
464{
465 if (dry_run)
466 return SZ_DMALP;
467
468 buf[0] = CMD_DMALP;
469
470 if (loop)
471 buf[0] |= (1 << 1);
472
473 cnt--; /* DMAC increments by 1 internally */
474 buf[1] = cnt;
475
476 PL330_DBGCMD_DUMP(SZ_DMALP, "\tDMALP_%c %u\n", loop ? '1' : '0', cnt);
477
478 return SZ_DMALP;
479}
480
481struct _arg_LPEND {
482 enum pl330_cond cond;
483 bool forever;
484 unsigned loop;
485 u8 bjump;
486};
487
488static inline u32 _emit_LPEND(unsigned dry_run, u8 buf[],
489 const struct _arg_LPEND *arg)
490{
491 enum pl330_cond cond = arg->cond;
492 bool forever = arg->forever;
493 unsigned loop = arg->loop;
494 u8 bjump = arg->bjump;
495
496 if (dry_run)
497 return SZ_DMALPEND;
498
499 buf[0] = CMD_DMALPEND;
500
501 if (loop)
502 buf[0] |= (1 << 2);
503
504 if (!forever)
505 buf[0] |= (1 << 4);
506
507 if (cond == SINGLE)
508 buf[0] |= (0 << 1) | (1 << 0);
509 else if (cond == BURST)
510 buf[0] |= (1 << 1) | (1 << 0);
511
512 buf[1] = bjump;
513
514 PL330_DBGCMD_DUMP(SZ_DMALPEND, "\tDMALP%s%c_%c bjmpto_%x\n",
515 forever ? "FE" : "END",
516 cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'A'),
517 loop ? '1' : '0',
518 bjump);
519
520 return SZ_DMALPEND;
521}
522
523static inline u32 _emit_KILL(unsigned dry_run, u8 buf[])
524{
525 if (dry_run)
526 return SZ_DMAKILL;
527
528 buf[0] = CMD_DMAKILL;
529
530 return SZ_DMAKILL;
531}
532
533static inline u32 _emit_MOV(unsigned dry_run, u8 buf[],
534 enum dmamov_dst dst, u32 val)
535{
536 if (dry_run)
537 return SZ_DMAMOV;
538
539 buf[0] = CMD_DMAMOV;
540 buf[1] = dst;
541 *((u32 *)&buf[2]) = val;
542
543 PL330_DBGCMD_DUMP(SZ_DMAMOV, "\tDMAMOV %s 0x%x\n",
544 dst == SAR ? "SAR" : (dst == DAR ? "DAR" : "CCR"), val);
545
546 return SZ_DMAMOV;
547}
548
549static inline u32 _emit_NOP(unsigned dry_run, u8 buf[])
550{
551 if (dry_run)
552 return SZ_DMANOP;
553
554 buf[0] = CMD_DMANOP;
555
556 PL330_DBGCMD_DUMP(SZ_DMANOP, "\tDMANOP\n");
557
558 return SZ_DMANOP;
559}
560
561static inline u32 _emit_RMB(unsigned dry_run, u8 buf[])
562{
563 if (dry_run)
564 return SZ_DMARMB;
565
566 buf[0] = CMD_DMARMB;
567
568 PL330_DBGCMD_DUMP(SZ_DMARMB, "\tDMARMB\n");
569
570 return SZ_DMARMB;
571}
572
573static inline u32 _emit_SEV(unsigned dry_run, u8 buf[], u8 ev)
574{
575 if (dry_run)
576 return SZ_DMASEV;
577
578 buf[0] = CMD_DMASEV;
579
580 ev &= 0x1f;
581 ev <<= 3;
582 buf[1] = ev;
583
584 PL330_DBGCMD_DUMP(SZ_DMASEV, "\tDMASEV %u\n", ev >> 3);
585
586 return SZ_DMASEV;
587}
588
589static inline u32 _emit_ST(unsigned dry_run, u8 buf[], enum pl330_cond cond)
590{
591 if (dry_run)
592 return SZ_DMAST;
593
594 buf[0] = CMD_DMAST;
595
596 if (cond == SINGLE)
597 buf[0] |= (0 << 1) | (1 << 0);
598 else if (cond == BURST)
599 buf[0] |= (1 << 1) | (1 << 0);
600
601 PL330_DBGCMD_DUMP(SZ_DMAST, "\tDMAST%c\n",
602 cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'A'));
603
604 return SZ_DMAST;
605}
606
607static inline u32 _emit_STP(unsigned dry_run, u8 buf[],
608 enum pl330_cond cond, u8 peri)
609{
610 if (dry_run)
611 return SZ_DMASTP;
612
613 buf[0] = CMD_DMASTP;
614
615 if (cond == BURST)
616 buf[0] |= (1 << 1);
617
618 peri &= 0x1f;
619 peri <<= 3;
620 buf[1] = peri;
621
622 PL330_DBGCMD_DUMP(SZ_DMASTP, "\tDMASTP%c %u\n",
623 cond == SINGLE ? 'S' : 'B', peri >> 3);
624
625 return SZ_DMASTP;
626}
627
628static inline u32 _emit_STZ(unsigned dry_run, u8 buf[])
629{
630 if (dry_run)
631 return SZ_DMASTZ;
632
633 buf[0] = CMD_DMASTZ;
634
635 PL330_DBGCMD_DUMP(SZ_DMASTZ, "\tDMASTZ\n");
636
637 return SZ_DMASTZ;
638}
639
640static inline u32 _emit_WFE(unsigned dry_run, u8 buf[], u8 ev,
641 unsigned invalidate)
642{
643 if (dry_run)
644 return SZ_DMAWFE;
645
646 buf[0] = CMD_DMAWFE;
647
648 ev &= 0x1f;
649 ev <<= 3;
650 buf[1] = ev;
651
652 if (invalidate)
653 buf[1] |= (1 << 1);
654
655 PL330_DBGCMD_DUMP(SZ_DMAWFE, "\tDMAWFE %u%s\n",
656 ev >> 3, invalidate ? ", I" : "");
657
658 return SZ_DMAWFE;
659}
660
661static inline u32 _emit_WFP(unsigned dry_run, u8 buf[],
662 enum pl330_cond cond, u8 peri)
663{
664 if (dry_run)
665 return SZ_DMAWFP;
666
667 buf[0] = CMD_DMAWFP;
668
669 if (cond == SINGLE)
670 buf[0] |= (0 << 1) | (0 << 0);
671 else if (cond == BURST)
672 buf[0] |= (1 << 1) | (0 << 0);
673 else
674 buf[0] |= (0 << 1) | (1 << 0);
675
676 peri &= 0x1f;
677 peri <<= 3;
678 buf[1] = peri;
679
680 PL330_DBGCMD_DUMP(SZ_DMAWFP, "\tDMAWFP%c %u\n",
681 cond == SINGLE ? 'S' : (cond == BURST ? 'B' : 'P'), peri >> 3);
682
683 return SZ_DMAWFP;
684}
685
686static inline u32 _emit_WMB(unsigned dry_run, u8 buf[])
687{
688 if (dry_run)
689 return SZ_DMAWMB;
690
691 buf[0] = CMD_DMAWMB;
692
693 PL330_DBGCMD_DUMP(SZ_DMAWMB, "\tDMAWMB\n");
694
695 return SZ_DMAWMB;
696}
697
698struct _arg_GO {
699 u8 chan;
700 u32 addr;
701 unsigned ns;
702};
703
704static inline u32 _emit_GO(unsigned dry_run, u8 buf[],
705 const struct _arg_GO *arg)
706{
707 u8 chan = arg->chan;
708 u32 addr = arg->addr;
709 unsigned ns = arg->ns;
710
711 if (dry_run)
712 return SZ_DMAGO;
713
714 buf[0] = CMD_DMAGO;
715 buf[0] |= (ns << 1);
716
717 buf[1] = chan & 0x7;
718
719 *((u32 *)&buf[2]) = addr;
720
721 return SZ_DMAGO;
722}
723
724#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
725
726/* Returns Time-Out */
727static bool _until_dmac_idle(struct pl330_thread *thrd)
728{
729 void __iomem *regs = thrd->dmac->pinfo->base;
730 unsigned long loops = msecs_to_loops(5);
731
732 do {
733 /* Until Manager is Idle */
734 if (!(readl(regs + DBGSTATUS) & DBG_BUSY))
735 break;
736
737 cpu_relax();
738 } while (--loops);
739
740 if (!loops)
741 return true;
742
743 return false;
744}
745
746static inline void _execute_DBGINSN(struct pl330_thread *thrd,
747 u8 insn[], bool as_manager)
748{
749 void __iomem *regs = thrd->dmac->pinfo->base;
750 u32 val;
751
752 val = (insn[0] << 16) | (insn[1] << 24);
753 if (!as_manager) {
754 val |= (1 << 0);
755 val |= (thrd->id << 8); /* Channel Number */
756 }
757 writel(val, regs + DBGINST0);
758
759 val = *((u32 *)&insn[2]);
760 writel(val, regs + DBGINST1);
761
762 /* If timed out due to halted state-machine */
763 if (_until_dmac_idle(thrd)) {
764 dev_err(thrd->dmac->pinfo->dev, "DMAC halted!\n");
765 return;
766 }
767
768 /* Get going */
769 writel(0, regs + DBGCMD);
770}
771
772/*
773 * Mark a _pl330_req as free.
774 * We do it by writing DMAEND as the first instruction
775 * because no valid request is going to have DMAEND as
776 * its first instruction to execute.
777 */
778static void mark_free(struct pl330_thread *thrd, int idx)
779{
780 struct _pl330_req *req = &thrd->req[idx];
781
782 _emit_END(0, req->mc_cpu);
783 req->mc_len = 0;
784
785 thrd->req_running = -1;
786}
787
788static inline u32 _state(struct pl330_thread *thrd)
789{
790 void __iomem *regs = thrd->dmac->pinfo->base;
791 u32 val;
792
793 if (is_manager(thrd))
794 val = readl(regs + DS) & 0xf;
795 else
796 val = readl(regs + CS(thrd->id)) & 0xf;
797
798 switch (val) {
799 case DS_ST_STOP:
800 return PL330_STATE_STOPPED;
801 case DS_ST_EXEC:
802 return PL330_STATE_EXECUTING;
803 case DS_ST_CMISS:
804 return PL330_STATE_CACHEMISS;
805 case DS_ST_UPDTPC:
806 return PL330_STATE_UPDTPC;
807 case DS_ST_WFE:
808 return PL330_STATE_WFE;
809 case DS_ST_FAULT:
810 return PL330_STATE_FAULTING;
811 case DS_ST_ATBRR:
812 if (is_manager(thrd))
813 return PL330_STATE_INVALID;
814 else
815 return PL330_STATE_ATBARRIER;
816 case DS_ST_QBUSY:
817 if (is_manager(thrd))
818 return PL330_STATE_INVALID;
819 else
820 return PL330_STATE_QUEUEBUSY;
821 case DS_ST_WFP:
822 if (is_manager(thrd))
823 return PL330_STATE_INVALID;
824 else
825 return PL330_STATE_WFP;
826 case DS_ST_KILL:
827 if (is_manager(thrd))
828 return PL330_STATE_INVALID;
829 else
830 return PL330_STATE_KILLING;
831 case DS_ST_CMPLT:
832 if (is_manager(thrd))
833 return PL330_STATE_INVALID;
834 else
835 return PL330_STATE_COMPLETING;
836 case DS_ST_FLTCMP:
837 if (is_manager(thrd))
838 return PL330_STATE_INVALID;
839 else
840 return PL330_STATE_FAULT_COMPLETING;
841 default:
842 return PL330_STATE_INVALID;
843 }
844}
845
846static void _stop(struct pl330_thread *thrd)
847{
848 void __iomem *regs = thrd->dmac->pinfo->base;
849 u8 insn[6] = {0, 0, 0, 0, 0, 0};
850
851 if (_state(thrd) == PL330_STATE_FAULT_COMPLETING)
852 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING);
853
854 /* Return if nothing needs to be done */
855 if (_state(thrd) == PL330_STATE_COMPLETING
856 || _state(thrd) == PL330_STATE_KILLING
857 || _state(thrd) == PL330_STATE_STOPPED)
858 return;
859
860 _emit_KILL(0, insn);
861
862 /* Stop generating interrupts for SEV */
863 writel(readl(regs + INTEN) & ~(1 << thrd->ev), regs + INTEN);
864
865 _execute_DBGINSN(thrd, insn, is_manager(thrd));
866}
867
868/* Start doing req 'idx' of thread 'thrd' */
869static bool _trigger(struct pl330_thread *thrd)
870{
871 void __iomem *regs = thrd->dmac->pinfo->base;
872 struct _pl330_req *req;
873 struct pl330_req *r;
874 struct _arg_GO go;
875 unsigned ns;
876 u8 insn[6] = {0, 0, 0, 0, 0, 0};
877 int idx;
878
879 /* Return if already ACTIVE */
880 if (_state(thrd) != PL330_STATE_STOPPED)
881 return true;
882
883 idx = 1 - thrd->lstenq;
884 if (!IS_FREE(&thrd->req[idx]))
885 req = &thrd->req[idx];
886 else {
887 idx = thrd->lstenq;
888 if (!IS_FREE(&thrd->req[idx]))
889 req = &thrd->req[idx];
890 else
891 req = NULL;
892 }
893
894 /* Return if no request */
895 if (!req || !req->r)
896 return true;
897
898 r = req->r;
899
900 if (r->cfg)
901 ns = r->cfg->nonsecure ? 1 : 0;
902 else if (readl(regs + CS(thrd->id)) & CS_CNS)
903 ns = 1;
904 else
905 ns = 0;
906
907 /* See 'Abort Sources' point-4 at Page 2-25 */
908 if (_manager_ns(thrd) && !ns)
909 dev_info(thrd->dmac->pinfo->dev, "%s:%d Recipe for ABORT!\n",
910 __func__, __LINE__);
911
912 go.chan = thrd->id;
913 go.addr = req->mc_bus;
914 go.ns = ns;
915 _emit_GO(0, insn, &go);
916
917 /* Set to generate interrupts for SEV */
918 writel(readl(regs + INTEN) | (1 << thrd->ev), regs + INTEN);
919
920 /* Only manager can execute GO */
921 _execute_DBGINSN(thrd, insn, true);
922
923 thrd->req_running = idx;
924
925 return true;
926}
927
928static bool _start(struct pl330_thread *thrd)
929{
930 switch (_state(thrd)) {
931 case PL330_STATE_FAULT_COMPLETING:
932 UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING);
933
934 if (_state(thrd) == PL330_STATE_KILLING)
935 UNTIL(thrd, PL330_STATE_STOPPED)
936
937 case PL330_STATE_FAULTING:
938 _stop(thrd);
939
940 case PL330_STATE_KILLING:
941 case PL330_STATE_COMPLETING:
942 UNTIL(thrd, PL330_STATE_STOPPED)
943
944 case PL330_STATE_STOPPED:
945 return _trigger(thrd);
946
947 case PL330_STATE_WFP:
948 case PL330_STATE_QUEUEBUSY:
949 case PL330_STATE_ATBARRIER:
950 case PL330_STATE_UPDTPC:
951 case PL330_STATE_CACHEMISS:
952 case PL330_STATE_EXECUTING:
953 return true;
954
955 case PL330_STATE_WFE: /* For RESUME, nothing yet */
956 default:
957 return false;
958 }
959}
960
961static inline int _ldst_memtomem(unsigned dry_run, u8 buf[],
962 const struct _xfer_spec *pxs, int cyc)
963{
964 int off = 0;
965
966 while (cyc--) {
967 off += _emit_LD(dry_run, &buf[off], ALWAYS);
968 off += _emit_RMB(dry_run, &buf[off]);
969 off += _emit_ST(dry_run, &buf[off], ALWAYS);
970 off += _emit_WMB(dry_run, &buf[off]);
971 }
972
973 return off;
974}
975
976static inline int _ldst_devtomem(unsigned dry_run, u8 buf[],
977 const struct _xfer_spec *pxs, int cyc)
978{
979 int off = 0;
980
981 while (cyc--) {
982 off += _emit_WFP(dry_run, &buf[off], SINGLE, pxs->r->peri);
983 off += _emit_LDP(dry_run, &buf[off], SINGLE, pxs->r->peri);
984 off += _emit_ST(dry_run, &buf[off], ALWAYS);
985 off += _emit_FLUSHP(dry_run, &buf[off], pxs->r->peri);
986 }
987
988 return off;
989}
990
991static inline int _ldst_memtodev(unsigned dry_run, u8 buf[],
992 const struct _xfer_spec *pxs, int cyc)
993{
994 int off = 0;
995
996 while (cyc--) {
997 off += _emit_WFP(dry_run, &buf[off], SINGLE, pxs->r->peri);
998 off += _emit_LD(dry_run, &buf[off], ALWAYS);
999 off += _emit_STP(dry_run, &buf[off], SINGLE, pxs->r->peri);
1000 off += _emit_FLUSHP(dry_run, &buf[off], pxs->r->peri);
1001 }
1002
1003 return off;
1004}
1005
1006static int _bursts(unsigned dry_run, u8 buf[],
1007 const struct _xfer_spec *pxs, int cyc)
1008{
1009 int off = 0;
1010
1011 switch (pxs->r->rqtype) {
1012 case MEMTODEV:
1013 off += _ldst_memtodev(dry_run, &buf[off], pxs, cyc);
1014 break;
1015 case DEVTOMEM:
1016 off += _ldst_devtomem(dry_run, &buf[off], pxs, cyc);
1017 break;
1018 case MEMTOMEM:
1019 off += _ldst_memtomem(dry_run, &buf[off], pxs, cyc);
1020 break;
1021 default:
1022 off += 0x40000000; /* Scare off the Client */
1023 break;
1024 }
1025
1026 return off;
1027}
1028
1029/* Returns bytes consumed and updates bursts */
1030static inline int _loop(unsigned dry_run, u8 buf[],
1031 unsigned long *bursts, const struct _xfer_spec *pxs)
1032{
1033 int cyc, cycmax, szlp, szlpend, szbrst, off;
1034 unsigned lcnt0, lcnt1, ljmp0, ljmp1;
1035 struct _arg_LPEND lpend;
1036
1037 /* Max iterations possible in DMALP is 256 */
1038 if (*bursts >= 256*256) {
1039 lcnt1 = 256;
1040 lcnt0 = 256;
1041 cyc = *bursts / lcnt1 / lcnt0;
1042 } else if (*bursts > 256) {
1043 lcnt1 = 256;
1044 lcnt0 = *bursts / lcnt1;
1045 cyc = 1;
1046 } else {
1047 lcnt1 = *bursts;
1048 lcnt0 = 0;
1049 cyc = 1;
1050 }
1051
1052 szlp = _emit_LP(1, buf, 0, 0);
1053 szbrst = _bursts(1, buf, pxs, 1);
1054
1055 lpend.cond = ALWAYS;
1056 lpend.forever = false;
1057 lpend.loop = 0;
1058 lpend.bjump = 0;
1059 szlpend = _emit_LPEND(1, buf, &lpend);
1060
1061 if (lcnt0) {
1062 szlp *= 2;
1063 szlpend *= 2;
1064 }
1065
1066 /*
1067 * Max bursts that we can unroll due to limit on the
1068 * size of backward jump that can be encoded in DMALPEND
1069 * which is 8-bits and hence 255
1070 */
1071 cycmax = (255 - (szlp + szlpend)) / szbrst;
1072
1073 cyc = (cycmax < cyc) ? cycmax : cyc;
1074
1075 off = 0;
1076
1077 if (lcnt0) {
1078 off += _emit_LP(dry_run, &buf[off], 0, lcnt0);
1079 ljmp0 = off;
1080 }
1081
1082 off += _emit_LP(dry_run, &buf[off], 1, lcnt1);
1083 ljmp1 = off;
1084
1085 off += _bursts(dry_run, &buf[off], pxs, cyc);
1086
1087 lpend.cond = ALWAYS;
1088 lpend.forever = false;
1089 lpend.loop = 1;
1090 lpend.bjump = off - ljmp1;
1091 off += _emit_LPEND(dry_run, &buf[off], &lpend);
1092
1093 if (lcnt0) {
1094 lpend.cond = ALWAYS;
1095 lpend.forever = false;
1096 lpend.loop = 0;
1097 lpend.bjump = off - ljmp0;
1098 off += _emit_LPEND(dry_run, &buf[off], &lpend);
1099 }
1100
1101 *bursts = lcnt1 * cyc;
1102 if (lcnt0)
1103 *bursts *= lcnt0;
1104
1105 return off;
1106}
1107
1108static inline int _setup_loops(unsigned dry_run, u8 buf[],
1109 const struct _xfer_spec *pxs)
1110{
1111 struct pl330_xfer *x = pxs->x;
1112 u32 ccr = pxs->ccr;
1113 unsigned long c, bursts = BYTE_TO_BURST(x->bytes, ccr);
1114 int off = 0;
1115
1116 while (bursts) {
1117 c = bursts;
1118 off += _loop(dry_run, &buf[off], &c, pxs);
1119 bursts -= c;
1120 }
1121
1122 return off;
1123}
1124
1125static inline int _setup_xfer(unsigned dry_run, u8 buf[],
1126 const struct _xfer_spec *pxs)
1127{
1128 struct pl330_xfer *x = pxs->x;
1129 int off = 0;
1130
1131 /* DMAMOV SAR, x->src_addr */
1132 off += _emit_MOV(dry_run, &buf[off], SAR, x->src_addr);
1133 /* DMAMOV DAR, x->dst_addr */
1134 off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr);
1135
1136 /* Setup Loop(s) */
1137 off += _setup_loops(dry_run, &buf[off], pxs);
1138
1139 return off;
1140}
1141
1142/*
1143 * A req is a sequence of one or more xfer units.
1144 * Returns the number of bytes taken to setup the MC for the req.
1145 */
1146static int _setup_req(unsigned dry_run, struct pl330_thread *thrd,
1147 unsigned index, struct _xfer_spec *pxs)
1148{
1149 struct _pl330_req *req = &thrd->req[index];
1150 struct pl330_xfer *x;
1151 u8 *buf = req->mc_cpu;
1152 int off = 0;
1153
1154 PL330_DBGMC_START(req->mc_bus);
1155
1156 /* DMAMOV CCR, ccr */
1157 off += _emit_MOV(dry_run, &buf[off], CCR, pxs->ccr);
1158
1159 x = pxs->r->x;
1160 do {
1161 /* Error if xfer length is not aligned at burst size */
1162 if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr)))
1163 return -EINVAL;
1164
1165 pxs->x = x;
1166 off += _setup_xfer(dry_run, &buf[off], pxs);
1167
1168 x = x->next;
1169 } while (x);
1170
1171 /* DMASEV peripheral/event */
1172 off += _emit_SEV(dry_run, &buf[off], thrd->ev);
1173 /* DMAEND */
1174 off += _emit_END(dry_run, &buf[off]);
1175
1176 return off;
1177}
1178
1179static inline u32 _prepare_ccr(const struct pl330_reqcfg *rqc)
1180{
1181 u32 ccr = 0;
1182
1183 if (rqc->src_inc)
1184 ccr |= CC_SRCINC;
1185
1186 if (rqc->dst_inc)
1187 ccr |= CC_DSTINC;
1188
1189 /* We set same protection levels for Src and DST for now */
1190 if (rqc->privileged)
1191 ccr |= CC_SRCPRI | CC_DSTPRI;
1192 if (rqc->nonsecure)
1193 ccr |= CC_SRCNS | CC_DSTNS;
1194 if (rqc->insnaccess)
1195 ccr |= CC_SRCIA | CC_DSTIA;
1196
1197 ccr |= (((rqc->brst_len - 1) & 0xf) << CC_SRCBRSTLEN_SHFT);
1198 ccr |= (((rqc->brst_len - 1) & 0xf) << CC_DSTBRSTLEN_SHFT);
1199
1200 ccr |= (rqc->brst_size << CC_SRCBRSTSIZE_SHFT);
1201 ccr |= (rqc->brst_size << CC_DSTBRSTSIZE_SHFT);
1202
1203 ccr |= (rqc->scctl << CC_SRCCCTRL_SHFT);
1204 ccr |= (rqc->dcctl << CC_DSTCCTRL_SHFT);
1205
1206 ccr |= (rqc->swap << CC_SWAP_SHFT);
1207
1208 return ccr;
1209}
1210
1211static inline bool _is_valid(u32 ccr)
1212{
1213 enum pl330_dstcachectrl dcctl;
1214 enum pl330_srccachectrl scctl;
1215
1216 dcctl = (ccr >> CC_DSTCCTRL_SHFT) & CC_DRCCCTRL_MASK;
1217 scctl = (ccr >> CC_SRCCCTRL_SHFT) & CC_SRCCCTRL_MASK;
1218
1219 if (dcctl == DINVALID1 || dcctl == DINVALID2
1220 || scctl == SINVALID1 || scctl == SINVALID2)
1221 return false;
1222 else
1223 return true;
1224}
1225
1226/*
1227 * Submit a list of xfers after which the client wants notification.
1228 * Client is not notified after each xfer unit, just once after all
1229 * xfer units are done or some error occurs.
1230 */
1231int pl330_submit_req(void *ch_id, struct pl330_req *r)
1232{
1233 struct pl330_thread *thrd = ch_id;
1234 struct pl330_dmac *pl330;
1235 struct pl330_info *pi;
1236 struct _xfer_spec xs;
1237 unsigned long flags;
1238 void __iomem *regs;
1239 unsigned idx;
1240 u32 ccr;
1241 int ret = 0;
1242
1243 /* No Req or Unacquired Channel or DMAC */
1244 if (!r || !thrd || thrd->free)
1245 return -EINVAL;
1246
1247 pl330 = thrd->dmac;
1248 pi = pl330->pinfo;
1249 regs = pi->base;
1250
1251 if (pl330->state == DYING
1252 || pl330->dmac_tbd.reset_chan & (1 << thrd->id)) {
1253 dev_info(thrd->dmac->pinfo->dev, "%s:%d\n",
1254 __func__, __LINE__);
1255 return -EAGAIN;
1256 }
1257
1258 /* If request for non-existing peripheral */
1259 if (r->rqtype != MEMTOMEM && r->peri >= pi->pcfg.num_peri) {
1260 dev_info(thrd->dmac->pinfo->dev,
1261 "%s:%d Invalid peripheral(%u)!\n",
1262 __func__, __LINE__, r->peri);
1263 return -EINVAL;
1264 }
1265
1266 spin_lock_irqsave(&pl330->lock, flags);
1267
1268 if (_queue_full(thrd)) {
1269 ret = -EAGAIN;
1270 goto xfer_exit;
1271 }
1272
1273 /* Prefer Secure Channel */
1274 if (!_manager_ns(thrd))
1275 r->cfg->nonsecure = 0;
1276 else
1277 r->cfg->nonsecure = 1;
1278
1279 /* Use last settings, if not provided */
1280 if (r->cfg)
1281 ccr = _prepare_ccr(r->cfg);
1282 else
1283 ccr = readl(regs + CC(thrd->id));
1284
1285 /* If this req doesn't have valid xfer settings */
1286 if (!_is_valid(ccr)) {
1287 ret = -EINVAL;
1288 dev_info(thrd->dmac->pinfo->dev, "%s:%d Invalid CCR(%x)!\n",
1289 __func__, __LINE__, ccr);
1290 goto xfer_exit;
1291 }
1292
1293 idx = IS_FREE(&thrd->req[0]) ? 0 : 1;
1294
1295 xs.ccr = ccr;
1296 xs.r = r;
1297
1298 /* First dry run to check if req is acceptable */
1299 ret = _setup_req(1, thrd, idx, &xs);
1300 if (ret < 0)
1301 goto xfer_exit;
1302
1303 if (ret > pi->mcbufsz / 2) {
1304 dev_info(thrd->dmac->pinfo->dev,
1305 "%s:%d Trying increasing mcbufsz\n",
1306 __func__, __LINE__);
1307 ret = -ENOMEM;
1308 goto xfer_exit;
1309 }
1310
1311 /* Hook the request */
1312 thrd->lstenq = idx;
1313 thrd->req[idx].mc_len = _setup_req(0, thrd, idx, &xs);
1314 thrd->req[idx].r = r;
1315
1316 ret = 0;
1317
1318xfer_exit:
1319 spin_unlock_irqrestore(&pl330->lock, flags);
1320
1321 return ret;
1322}
1323EXPORT_SYMBOL(pl330_submit_req);
1324
1325static void pl330_dotask(unsigned long data)
1326{
1327 struct pl330_dmac *pl330 = (struct pl330_dmac *) data;
1328 struct pl330_info *pi = pl330->pinfo;
1329 unsigned long flags;
1330 int i;
1331
1332 spin_lock_irqsave(&pl330->lock, flags);
1333
1334 /* The DMAC itself gone nuts */
1335 if (pl330->dmac_tbd.reset_dmac) {
1336 pl330->state = DYING;
1337 /* Reset the manager too */
1338 pl330->dmac_tbd.reset_mngr = true;
1339 /* Clear the reset flag */
1340 pl330->dmac_tbd.reset_dmac = false;
1341 }
1342
1343 if (pl330->dmac_tbd.reset_mngr) {
1344 _stop(pl330->manager);
1345 /* Reset all channels */
1346 pl330->dmac_tbd.reset_chan = (1 << pi->pcfg.num_chan) - 1;
1347 /* Clear the reset flag */
1348 pl330->dmac_tbd.reset_mngr = false;
1349 }
1350
1351 for (i = 0; i < pi->pcfg.num_chan; i++) {
1352
1353 if (pl330->dmac_tbd.reset_chan & (1 << i)) {
1354 struct pl330_thread *thrd = &pl330->channels[i];
1355 void __iomem *regs = pi->base;
1356 enum pl330_op_err err;
1357
1358 _stop(thrd);
1359
1360 if (readl(regs + FSC) & (1 << thrd->id))
1361 err = PL330_ERR_FAIL;
1362 else
1363 err = PL330_ERR_ABORT;
1364
1365 spin_unlock_irqrestore(&pl330->lock, flags);
1366
1367 _callback(thrd->req[1 - thrd->lstenq].r, err);
1368 _callback(thrd->req[thrd->lstenq].r, err);
1369
1370 spin_lock_irqsave(&pl330->lock, flags);
1371
1372 thrd->req[0].r = NULL;
1373 thrd->req[1].r = NULL;
1374 mark_free(thrd, 0);
1375 mark_free(thrd, 1);
1376
1377 /* Clear the reset flag */
1378 pl330->dmac_tbd.reset_chan &= ~(1 << i);
1379 }
1380 }
1381
1382 spin_unlock_irqrestore(&pl330->lock, flags);
1383
1384 return;
1385}
1386
1387/* Returns 1 if state was updated, 0 otherwise */
1388int pl330_update(const struct pl330_info *pi)
1389{
1390 struct _pl330_req *rqdone;
1391 struct pl330_dmac *pl330;
1392 unsigned long flags;
1393 void __iomem *regs;
1394 u32 val;
1395 int id, ev, ret = 0;
1396
1397 if (!pi || !pi->pl330_data)
1398 return 0;
1399
1400 regs = pi->base;
1401 pl330 = pi->pl330_data;
1402
1403 spin_lock_irqsave(&pl330->lock, flags);
1404
1405 val = readl(regs + FSM) & 0x1;
1406 if (val)
1407 pl330->dmac_tbd.reset_mngr = true;
1408 else
1409 pl330->dmac_tbd.reset_mngr = false;
1410
1411 val = readl(regs + FSC) & ((1 << pi->pcfg.num_chan) - 1);
1412 pl330->dmac_tbd.reset_chan |= val;
1413 if (val) {
1414 int i = 0;
1415 while (i < pi->pcfg.num_chan) {
1416 if (val & (1 << i)) {
1417 dev_info(pi->dev,
1418 "Reset Channel-%d\t CS-%x FTC-%x\n",
1419 i, readl(regs + CS(i)),
1420 readl(regs + FTC(i)));
1421 _stop(&pl330->channels[i]);
1422 }
1423 i++;
1424 }
1425 }
1426
1427 /* Check which event happened i.e, thread notified */
1428 val = readl(regs + ES);
1429 if (pi->pcfg.num_events < 32
1430 && val & ~((1 << pi->pcfg.num_events) - 1)) {
1431 pl330->dmac_tbd.reset_dmac = true;
1432 dev_err(pi->dev, "%s:%d Unexpected!\n", __func__, __LINE__);
1433 ret = 1;
1434 goto updt_exit;
1435 }
1436
1437 for (ev = 0; ev < pi->pcfg.num_events; ev++) {
1438 if (val & (1 << ev)) { /* Event occurred */
1439 struct pl330_thread *thrd;
1440 u32 inten = readl(regs + INTEN);
1441 int active;
1442
1443 /* Clear the event */
1444 if (inten & (1 << ev))
1445 writel(1 << ev, regs + INTCLR);
1446
1447 ret = 1;
1448
1449 id = pl330->events[ev];
1450
1451 thrd = &pl330->channels[id];
1452
1453 active = thrd->req_running;
1454 if (active == -1) /* Aborted */
1455 continue;
1456
1457 rqdone = &thrd->req[active];
1458 mark_free(thrd, active);
1459
1460 /* Get going again ASAP */
1461 _start(thrd);
1462
1463 /* For now, just make a list of callbacks to be done */
1464 list_add_tail(&rqdone->rqd, &pl330->req_done);
1465 }
1466 }
1467
1468 /* Now that we are in no hurry, do the callbacks */
1469 while (!list_empty(&pl330->req_done)) {
1470 struct pl330_req *r;
1471
1472 rqdone = container_of(pl330->req_done.next,
1473 struct _pl330_req, rqd);
1474
1475 list_del_init(&rqdone->rqd);
1476
1477 /* Detach the req */
1478 r = rqdone->r;
1479 rqdone->r = NULL;
1480
1481 spin_unlock_irqrestore(&pl330->lock, flags);
1482 _callback(r, PL330_ERR_NONE);
1483 spin_lock_irqsave(&pl330->lock, flags);
1484 }
1485
1486updt_exit:
1487 spin_unlock_irqrestore(&pl330->lock, flags);
1488
1489 if (pl330->dmac_tbd.reset_dmac
1490 || pl330->dmac_tbd.reset_mngr
1491 || pl330->dmac_tbd.reset_chan) {
1492 ret = 1;
1493 tasklet_schedule(&pl330->tasks);
1494 }
1495
1496 return ret;
1497}
1498EXPORT_SYMBOL(pl330_update);
1499
1500int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
1501{
1502 struct pl330_thread *thrd = ch_id;
1503 struct pl330_dmac *pl330;
1504 unsigned long flags;
1505 int ret = 0, active;
1506
1507 if (!thrd || thrd->free || thrd->dmac->state == DYING)
1508 return -EINVAL;
1509
1510 pl330 = thrd->dmac;
1511 active = thrd->req_running;
1512
1513 spin_lock_irqsave(&pl330->lock, flags);
1514
1515 switch (op) {
1516 case PL330_OP_FLUSH:
1517 /* Make sure the channel is stopped */
1518 _stop(thrd);
1519
1520 thrd->req[0].r = NULL;
1521 thrd->req[1].r = NULL;
1522 mark_free(thrd, 0);
1523 mark_free(thrd, 1);
1524 break;
1525
1526 case PL330_OP_ABORT:
1527 /* Make sure the channel is stopped */
1528 _stop(thrd);
1529
1530 /* ABORT is only for the active req */
1531 if (active == -1)
1532 break;
1533
1534 thrd->req[active].r = NULL;
1535 mark_free(thrd, active);
1536
1537 /* Start the next */
1538 case PL330_OP_START:
1539 if ((active == -1) && !_start(thrd))
1540 ret = -EIO;
1541 break;
1542
1543 default:
1544 ret = -EINVAL;
1545 }
1546
1547 spin_unlock_irqrestore(&pl330->lock, flags);
1548 return ret;
1549}
1550EXPORT_SYMBOL(pl330_chan_ctrl);
1551
1552int pl330_chan_status(void *ch_id, struct pl330_chanstatus *pstatus)
1553{
1554 struct pl330_thread *thrd = ch_id;
1555 struct pl330_dmac *pl330;
1556 struct pl330_info *pi;
1557 void __iomem *regs;
1558 int active;
1559 u32 val;
1560
1561 if (!pstatus || !thrd || thrd->free)
1562 return -EINVAL;
1563
1564 pl330 = thrd->dmac;
1565 pi = pl330->pinfo;
1566 regs = pi->base;
1567
1568 /* The client should remove the DMAC and add again */
1569 if (pl330->state == DYING)
1570 pstatus->dmac_halted = true;
1571 else
1572 pstatus->dmac_halted = false;
1573
1574 val = readl(regs + FSC);
1575 if (val & (1 << thrd->id))
1576 pstatus->faulting = true;
1577 else
1578 pstatus->faulting = false;
1579
1580 active = thrd->req_running;
1581
1582 if (active == -1) {
1583 /* Indicate that the thread is not running */
1584 pstatus->top_req = NULL;
1585 pstatus->wait_req = NULL;
1586 } else {
1587 pstatus->top_req = thrd->req[active].r;
1588 pstatus->wait_req = !IS_FREE(&thrd->req[1 - active])
1589 ? thrd->req[1 - active].r : NULL;
1590 }
1591
1592 pstatus->src_addr = readl(regs + SA(thrd->id));
1593 pstatus->dst_addr = readl(regs + DA(thrd->id));
1594
1595 return 0;
1596}
1597EXPORT_SYMBOL(pl330_chan_status);
1598
1599/* Reserve an event */
1600static inline int _alloc_event(struct pl330_thread *thrd)
1601{
1602 struct pl330_dmac *pl330 = thrd->dmac;
1603 struct pl330_info *pi = pl330->pinfo;
1604 int ev;
1605
1606 for (ev = 0; ev < pi->pcfg.num_events; ev++)
1607 if (pl330->events[ev] == -1) {
1608 pl330->events[ev] = thrd->id;
1609 return ev;
1610 }
1611
1612 return -1;
1613}
1614
1615static bool _chan_ns(const struct pl330_info *pi, int i)
1616{
1617 return pi->pcfg.irq_ns & (1 << i);
1618}
1619
1620/* Upon success, returns IdentityToken for the
1621 * allocated channel, NULL otherwise.
1622 */
1623void *pl330_request_channel(const struct pl330_info *pi)
1624{
1625 struct pl330_thread *thrd = NULL;
1626 struct pl330_dmac *pl330;
1627 unsigned long flags;
1628 int chans, i;
1629
1630 if (!pi || !pi->pl330_data)
1631 return NULL;
1632
1633 pl330 = pi->pl330_data;
1634
1635 if (pl330->state == DYING)
1636 return NULL;
1637
1638 chans = pi->pcfg.num_chan;
1639
1640 spin_lock_irqsave(&pl330->lock, flags);
1641
1642 for (i = 0; i < chans; i++) {
1643 thrd = &pl330->channels[i];
1644 if ((thrd->free) && (!_manager_ns(thrd) ||
1645 _chan_ns(pi, i))) {
1646 thrd->ev = _alloc_event(thrd);
1647 if (thrd->ev >= 0) {
1648 thrd->free = false;
1649 thrd->lstenq = 1;
1650 thrd->req[0].r = NULL;
1651 mark_free(thrd, 0);
1652 thrd->req[1].r = NULL;
1653 mark_free(thrd, 1);
1654 break;
1655 }
1656 }
1657 thrd = NULL;
1658 }
1659
1660 spin_unlock_irqrestore(&pl330->lock, flags);
1661
1662 return thrd;
1663}
1664EXPORT_SYMBOL(pl330_request_channel);
1665
1666/* Release an event */
1667static inline void _free_event(struct pl330_thread *thrd, int ev)
1668{
1669 struct pl330_dmac *pl330 = thrd->dmac;
1670 struct pl330_info *pi = pl330->pinfo;
1671
1672 /* If the event is valid and was held by the thread */
1673 if (ev >= 0 && ev < pi->pcfg.num_events
1674 && pl330->events[ev] == thrd->id)
1675 pl330->events[ev] = -1;
1676}
1677
1678void pl330_release_channel(void *ch_id)
1679{
1680 struct pl330_thread *thrd = ch_id;
1681 struct pl330_dmac *pl330;
1682 unsigned long flags;
1683
1684 if (!thrd || thrd->free)
1685 return;
1686
1687 _stop(thrd);
1688
1689 _callback(thrd->req[1 - thrd->lstenq].r, PL330_ERR_ABORT);
1690 _callback(thrd->req[thrd->lstenq].r, PL330_ERR_ABORT);
1691
1692 pl330 = thrd->dmac;
1693
1694 spin_lock_irqsave(&pl330->lock, flags);
1695 _free_event(thrd, thrd->ev);
1696 thrd->free = true;
1697 spin_unlock_irqrestore(&pl330->lock, flags);
1698}
1699EXPORT_SYMBOL(pl330_release_channel);
1700
1701/* Initialize the structure for PL330 configuration, that can be used
1702 * by the client driver the make best use of the DMAC
1703 */
1704static void read_dmac_config(struct pl330_info *pi)
1705{
1706 void __iomem *regs = pi->base;
1707 u32 val;
1708
1709 val = readl(regs + CRD) >> CRD_DATA_WIDTH_SHIFT;
1710 val &= CRD_DATA_WIDTH_MASK;
1711 pi->pcfg.data_bus_width = 8 * (1 << val);
1712
1713 val = readl(regs + CRD) >> CRD_DATA_BUFF_SHIFT;
1714 val &= CRD_DATA_BUFF_MASK;
1715 pi->pcfg.data_buf_dep = val + 1;
1716
1717 val = readl(regs + CR0) >> CR0_NUM_CHANS_SHIFT;
1718 val &= CR0_NUM_CHANS_MASK;
1719 val += 1;
1720 pi->pcfg.num_chan = val;
1721
1722 val = readl(regs + CR0);
1723 if (val & CR0_PERIPH_REQ_SET) {
1724 val = (val >> CR0_NUM_PERIPH_SHIFT) & CR0_NUM_PERIPH_MASK;
1725 val += 1;
1726 pi->pcfg.num_peri = val;
1727 pi->pcfg.peri_ns = readl(regs + CR4);
1728 } else {
1729 pi->pcfg.num_peri = 0;
1730 }
1731
1732 val = readl(regs + CR0);
1733 if (val & CR0_BOOT_MAN_NS)
1734 pi->pcfg.mode |= DMAC_MODE_NS;
1735 else
1736 pi->pcfg.mode &= ~DMAC_MODE_NS;
1737
1738 val = readl(regs + CR0) >> CR0_NUM_EVENTS_SHIFT;
1739 val &= CR0_NUM_EVENTS_MASK;
1740 val += 1;
1741 pi->pcfg.num_events = val;
1742
1743 pi->pcfg.irq_ns = readl(regs + CR3);
1744
1745 pi->pcfg.periph_id = get_id(pi, PERIPH_ID);
1746 pi->pcfg.pcell_id = get_id(pi, PCELL_ID);
1747}
1748
1749static inline void _reset_thread(struct pl330_thread *thrd)
1750{
1751 struct pl330_dmac *pl330 = thrd->dmac;
1752 struct pl330_info *pi = pl330->pinfo;
1753
1754 thrd->req[0].mc_cpu = pl330->mcode_cpu
1755 + (thrd->id * pi->mcbufsz);
1756 thrd->req[0].mc_bus = pl330->mcode_bus
1757 + (thrd->id * pi->mcbufsz);
1758 thrd->req[0].r = NULL;
1759 mark_free(thrd, 0);
1760
1761 thrd->req[1].mc_cpu = thrd->req[0].mc_cpu
1762 + pi->mcbufsz / 2;
1763 thrd->req[1].mc_bus = thrd->req[0].mc_bus
1764 + pi->mcbufsz / 2;
1765 thrd->req[1].r = NULL;
1766 mark_free(thrd, 1);
1767}
1768
1769static int dmac_alloc_threads(struct pl330_dmac *pl330)
1770{
1771 struct pl330_info *pi = pl330->pinfo;
1772 int chans = pi->pcfg.num_chan;
1773 struct pl330_thread *thrd;
1774 int i;
1775
1776 /* Allocate 1 Manager and 'chans' Channel threads */
1777 pl330->channels = kzalloc((1 + chans) * sizeof(*thrd),
1778 GFP_KERNEL);
1779 if (!pl330->channels)
1780 return -ENOMEM;
1781
1782 /* Init Channel threads */
1783 for (i = 0; i < chans; i++) {
1784 thrd = &pl330->channels[i];
1785 thrd->id = i;
1786 thrd->dmac = pl330;
1787 _reset_thread(thrd);
1788 thrd->free = true;
1789 }
1790
1791 /* MANAGER is indexed at the end */
1792 thrd = &pl330->channels[chans];
1793 thrd->id = chans;
1794 thrd->dmac = pl330;
1795 thrd->free = false;
1796 pl330->manager = thrd;
1797
1798 return 0;
1799}
1800
1801static int dmac_alloc_resources(struct pl330_dmac *pl330)
1802{
1803 struct pl330_info *pi = pl330->pinfo;
1804 int chans = pi->pcfg.num_chan;
1805 int ret;
1806
1807 /*
1808 * Alloc MicroCode buffer for 'chans' Channel threads.
1809 * A channel's buffer offset is (Channel_Id * MCODE_BUFF_PERCHAN)
1810 */
1811 pl330->mcode_cpu = dma_alloc_coherent(pi->dev,
1812 chans * pi->mcbufsz,
1813 &pl330->mcode_bus, GFP_KERNEL);
1814 if (!pl330->mcode_cpu) {
1815 dev_err(pi->dev, "%s:%d Can't allocate memory!\n",
1816 __func__, __LINE__);
1817 return -ENOMEM;
1818 }
1819
1820 ret = dmac_alloc_threads(pl330);
1821 if (ret) {
1822 dev_err(pi->dev, "%s:%d Can't to create channels for DMAC!\n",
1823 __func__, __LINE__);
1824 dma_free_coherent(pi->dev,
1825 chans * pi->mcbufsz,
1826 pl330->mcode_cpu, pl330->mcode_bus);
1827 return ret;
1828 }
1829
1830 return 0;
1831}
1832
1833int pl330_add(struct pl330_info *pi)
1834{
1835 struct pl330_dmac *pl330;
1836 void __iomem *regs;
1837 int i, ret;
1838
1839 if (!pi || !pi->dev)
1840 return -EINVAL;
1841
1842 /* If already added */
1843 if (pi->pl330_data)
1844 return -EINVAL;
1845
1846 /*
1847 * If the SoC can perform reset on the DMAC, then do it
1848 * before reading its configuration.
1849 */
1850 if (pi->dmac_reset)
1851 pi->dmac_reset(pi);
1852
1853 regs = pi->base;
1854
1855 /* Check if we can handle this DMAC */
1856 if ((get_id(pi, PERIPH_ID) & 0xfffff) != PERIPH_ID_VAL
1857 || get_id(pi, PCELL_ID) != PCELL_ID_VAL) {
1858 dev_err(pi->dev, "PERIPH_ID 0x%x, PCELL_ID 0x%x !\n",
1859 get_id(pi, PERIPH_ID), get_id(pi, PCELL_ID));
1860 return -EINVAL;
1861 }
1862
1863 /* Read the configuration of the DMAC */
1864 read_dmac_config(pi);
1865
1866 if (pi->pcfg.num_events == 0) {
1867 dev_err(pi->dev, "%s:%d Can't work without events!\n",
1868 __func__, __LINE__);
1869 return -EINVAL;
1870 }
1871
1872 pl330 = kzalloc(sizeof(*pl330), GFP_KERNEL);
1873 if (!pl330) {
1874 dev_err(pi->dev, "%s:%d Can't allocate memory!\n",
1875 __func__, __LINE__);
1876 return -ENOMEM;
1877 }
1878
1879 /* Assign the info structure and private data */
1880 pl330->pinfo = pi;
1881 pi->pl330_data = pl330;
1882
1883 spin_lock_init(&pl330->lock);
1884
1885 INIT_LIST_HEAD(&pl330->req_done);
1886
1887 /* Use default MC buffer size if not provided */
1888 if (!pi->mcbufsz)
1889 pi->mcbufsz = MCODE_BUFF_PER_REQ * 2;
1890
1891 /* Mark all events as free */
1892 for (i = 0; i < pi->pcfg.num_events; i++)
1893 pl330->events[i] = -1;
1894
1895 /* Allocate resources needed by the DMAC */
1896 ret = dmac_alloc_resources(pl330);
1897 if (ret) {
1898 dev_err(pi->dev, "Unable to create channels for DMAC\n");
1899 kfree(pl330);
1900 return ret;
1901 }
1902
1903 tasklet_init(&pl330->tasks, pl330_dotask, (unsigned long) pl330);
1904
1905 pl330->state = INIT;
1906
1907 return 0;
1908}
1909EXPORT_SYMBOL(pl330_add);
1910
1911static int dmac_free_threads(struct pl330_dmac *pl330)
1912{
1913 struct pl330_info *pi = pl330->pinfo;
1914 int chans = pi->pcfg.num_chan;
1915 struct pl330_thread *thrd;
1916 int i;
1917
1918 /* Release Channel threads */
1919 for (i = 0; i < chans; i++) {
1920 thrd = &pl330->channels[i];
1921 pl330_release_channel((void *)thrd);
1922 }
1923
1924 /* Free memory */
1925 kfree(pl330->channels);
1926
1927 return 0;
1928}
1929
1930static void dmac_free_resources(struct pl330_dmac *pl330)
1931{
1932 struct pl330_info *pi = pl330->pinfo;
1933 int chans = pi->pcfg.num_chan;
1934
1935 dmac_free_threads(pl330);
1936
1937 dma_free_coherent(pi->dev, chans * pi->mcbufsz,
1938 pl330->mcode_cpu, pl330->mcode_bus);
1939}
1940
1941void pl330_del(struct pl330_info *pi)
1942{
1943 struct pl330_dmac *pl330;
1944
1945 if (!pi || !pi->pl330_data)
1946 return;
1947
1948 pl330 = pi->pl330_data;
1949
1950 pl330->state = UNINIT;
1951
1952 tasklet_kill(&pl330->tasks);
1953
1954 /* Free DMAC resources */
1955 dmac_free_resources(pl330);
1956
1957 kfree(pl330);
1958 pi->pl330_data = NULL;
1959}
1960EXPORT_SYMBOL(pl330_del);
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 61691cdbdcf2..9173d112ea01 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -16,6 +16,7 @@
16 */ 16 */
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h>
19#include <linux/kernel.h> 20#include <linux/kernel.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/errno.h> 22#include <linux/errno.h>
@@ -28,9 +29,8 @@
28#include <linux/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31#include <asm/mach-types.h>
32#include <asm/irq.h>
33#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
33#include <asm/mach-types.h>
34#include <asm/sizes.h> 34#include <asm/sizes.h>
35 35
36#include <asm/hardware/sa1111.h> 36#include <asm/hardware/sa1111.h>
@@ -86,8 +86,10 @@
86#define IRQ_S1_CD_VALID (52) 86#define IRQ_S1_CD_VALID (52)
87#define IRQ_S0_BVD1_STSCHG (53) 87#define IRQ_S0_BVD1_STSCHG (53)
88#define IRQ_S1_BVD1_STSCHG (54) 88#define IRQ_S1_BVD1_STSCHG (54)
89#define SA1111_IRQ_NR (55)
89 90
90extern void __init sa1110_mb_enable(void); 91extern void sa1110_mb_enable(void);
92extern void sa1110_mb_disable(void);
91 93
92/* 94/*
93 * We keep the following data for the overall SA1111. Note that the 95 * We keep the following data for the overall SA1111. Note that the
@@ -104,6 +106,7 @@ struct sa1111 {
104 int irq_base; /* base for cascaded on-chip IRQs */ 106 int irq_base; /* base for cascaded on-chip IRQs */
105 spinlock_t lock; 107 spinlock_t lock;
106 void __iomem *base; 108 void __iomem *base;
109 struct sa1111_platform_data *pdata;
107#ifdef CONFIG_PM 110#ifdef CONFIG_PM
108 void *saved_state; 111 void *saved_state;
109#endif 112#endif
@@ -118,6 +121,7 @@ static struct sa1111 *g_sa1111;
118struct sa1111_dev_info { 121struct sa1111_dev_info {
119 unsigned long offset; 122 unsigned long offset;
120 unsigned long skpcr_mask; 123 unsigned long skpcr_mask;
124 bool dma;
121 unsigned int devid; 125 unsigned int devid;
122 unsigned int irq[6]; 126 unsigned int irq[6];
123}; 127};
@@ -126,6 +130,7 @@ static struct sa1111_dev_info sa1111_devices[] = {
126 { 130 {
127 .offset = SA1111_USB, 131 .offset = SA1111_USB,
128 .skpcr_mask = SKPCR_UCLKEN, 132 .skpcr_mask = SKPCR_UCLKEN,
133 .dma = true,
129 .devid = SA1111_DEVID_USB, 134 .devid = SA1111_DEVID_USB,
130 .irq = { 135 .irq = {
131 IRQ_USBPWR, 136 IRQ_USBPWR,
@@ -139,6 +144,7 @@ static struct sa1111_dev_info sa1111_devices[] = {
139 { 144 {
140 .offset = 0x0600, 145 .offset = 0x0600,
141 .skpcr_mask = SKPCR_I2SCLKEN | SKPCR_L3CLKEN, 146 .skpcr_mask = SKPCR_I2SCLKEN | SKPCR_L3CLKEN,
147 .dma = true,
142 .devid = SA1111_DEVID_SAC, 148 .devid = SA1111_DEVID_SAC,
143 .irq = { 149 .irq = {
144 AUDXMTDMADONEA, 150 AUDXMTDMADONEA,
@@ -155,7 +161,7 @@ static struct sa1111_dev_info sa1111_devices[] = {
155 { 161 {
156 .offset = SA1111_KBD, 162 .offset = SA1111_KBD,
157 .skpcr_mask = SKPCR_PTCLKEN, 163 .skpcr_mask = SKPCR_PTCLKEN,
158 .devid = SA1111_DEVID_PS2, 164 .devid = SA1111_DEVID_PS2_KBD,
159 .irq = { 165 .irq = {
160 IRQ_TPRXINT, 166 IRQ_TPRXINT,
161 IRQ_TPTXINT 167 IRQ_TPTXINT
@@ -164,7 +170,7 @@ static struct sa1111_dev_info sa1111_devices[] = {
164 { 170 {
165 .offset = SA1111_MSE, 171 .offset = SA1111_MSE,
166 .skpcr_mask = SKPCR_PMCLKEN, 172 .skpcr_mask = SKPCR_PMCLKEN,
167 .devid = SA1111_DEVID_PS2, 173 .devid = SA1111_DEVID_PS2_MSE,
168 .irq = { 174 .irq = {
169 IRQ_MSRXINT, 175 IRQ_MSRXINT,
170 IRQ_MSTXINT 176 IRQ_MSTXINT
@@ -434,16 +440,28 @@ static struct irq_chip sa1111_high_chip = {
434 .irq_set_wake = sa1111_wake_highirq, 440 .irq_set_wake = sa1111_wake_highirq,
435}; 441};
436 442
437static void sa1111_setup_irq(struct sa1111 *sachip) 443static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base)
438{ 444{
439 void __iomem *irqbase = sachip->base + SA1111_INTC; 445 void __iomem *irqbase = sachip->base + SA1111_INTC;
440 unsigned int irq; 446 unsigned i, irq;
447 int ret;
441 448
442 /* 449 /*
443 * We're guaranteed that this region hasn't been taken. 450 * We're guaranteed that this region hasn't been taken.
444 */ 451 */
445 request_mem_region(sachip->phys + SA1111_INTC, 512, "irq"); 452 request_mem_region(sachip->phys + SA1111_INTC, 512, "irq");
446 453
454 ret = irq_alloc_descs(-1, irq_base, SA1111_IRQ_NR, -1);
455 if (ret <= 0) {
456 dev_err(sachip->dev, "unable to allocate %u irqs: %d\n",
457 SA1111_IRQ_NR, ret);
458 if (ret == 0)
459 ret = -EINVAL;
460 return ret;
461 }
462
463 sachip->irq_base = ret;
464
447 /* disable all IRQs */ 465 /* disable all IRQs */
448 sa1111_writel(0, irqbase + SA1111_INTEN0); 466 sa1111_writel(0, irqbase + SA1111_INTEN0);
449 sa1111_writel(0, irqbase + SA1111_INTEN1); 467 sa1111_writel(0, irqbase + SA1111_INTEN1);
@@ -463,14 +481,16 @@ static void sa1111_setup_irq(struct sa1111 *sachip)
463 sa1111_writel(~0, irqbase + SA1111_INTSTATCLR0); 481 sa1111_writel(~0, irqbase + SA1111_INTSTATCLR0);
464 sa1111_writel(~0, irqbase + SA1111_INTSTATCLR1); 482 sa1111_writel(~0, irqbase + SA1111_INTSTATCLR1);
465 483
466 for (irq = IRQ_GPAIN0; irq <= SSPROR; irq++) { 484 for (i = IRQ_GPAIN0; i <= SSPROR; i++) {
485 irq = sachip->irq_base + i;
467 irq_set_chip_and_handler(irq, &sa1111_low_chip, 486 irq_set_chip_and_handler(irq, &sa1111_low_chip,
468 handle_edge_irq); 487 handle_edge_irq);
469 irq_set_chip_data(irq, sachip); 488 irq_set_chip_data(irq, sachip);
470 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); 489 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
471 } 490 }
472 491
473 for (irq = AUDXMTDMADONEA; irq <= IRQ_S1_BVD1_STSCHG; irq++) { 492 for (i = AUDXMTDMADONEA; i <= IRQ_S1_BVD1_STSCHG; i++) {
493 irq = sachip->irq_base + i;
474 irq_set_chip_and_handler(irq, &sa1111_high_chip, 494 irq_set_chip_and_handler(irq, &sa1111_high_chip,
475 handle_edge_irq); 495 handle_edge_irq);
476 irq_set_chip_data(irq, sachip); 496 irq_set_chip_data(irq, sachip);
@@ -483,6 +503,11 @@ static void sa1111_setup_irq(struct sa1111 *sachip)
483 irq_set_irq_type(sachip->irq, IRQ_TYPE_EDGE_RISING); 503 irq_set_irq_type(sachip->irq, IRQ_TYPE_EDGE_RISING);
484 irq_set_handler_data(sachip->irq, sachip); 504 irq_set_handler_data(sachip->irq, sachip);
485 irq_set_chained_handler(sachip->irq, sa1111_irq_handler); 505 irq_set_chained_handler(sachip->irq, sa1111_irq_handler);
506
507 dev_info(sachip->dev, "Providing IRQ%u-%u\n",
508 sachip->irq_base, sachip->irq_base + SA1111_IRQ_NR - 1);
509
510 return 0;
486} 511}
487 512
488/* 513/*
@@ -581,41 +606,10 @@ sa1111_configure_smc(struct sa1111 *sachip, int sdram, unsigned int drac,
581} 606}
582#endif 607#endif
583 608
584#ifdef CONFIG_DMABOUNCE
585/*
586 * According to the "Intel StrongARM SA-1111 Microprocessor Companion
587 * Chip Specification Update" (June 2000), erratum #7, there is a
588 * significant bug in the SA1111 SDRAM shared memory controller. If
589 * an access to a region of memory above 1MB relative to the bank base,
590 * it is important that address bit 10 _NOT_ be asserted. Depending
591 * on the configuration of the RAM, bit 10 may correspond to one
592 * of several different (processor-relative) address bits.
593 *
594 * This routine only identifies whether or not a given DMA address
595 * is susceptible to the bug.
596 *
597 * This should only get called for sa1111_device types due to the
598 * way we configure our device dma_masks.
599 */
600static int sa1111_needs_bounce(struct device *dev, dma_addr_t addr, size_t size)
601{
602 /*
603 * Section 4.6 of the "Intel StrongARM SA-1111 Development Module
604 * User's Guide" mentions that jumpers R51 and R52 control the
605 * target of SA-1111 DMA (either SDRAM bank 0 on Assabet, or
606 * SDRAM bank 1 on Neponset). The default configuration selects
607 * Assabet, so any address in bank 1 is necessarily invalid.
608 */
609 return (machine_is_assabet() || machine_is_pfs168()) &&
610 (addr >= 0xc8000000 || (addr + size) >= 0xc8000000);
611}
612#endif
613
614static void sa1111_dev_release(struct device *_dev) 609static void sa1111_dev_release(struct device *_dev)
615{ 610{
616 struct sa1111_dev *dev = SA1111_DEV(_dev); 611 struct sa1111_dev *dev = SA1111_DEV(_dev);
617 612
618 release_resource(&dev->res);
619 kfree(dev); 613 kfree(dev);
620} 614}
621 615
@@ -624,67 +618,58 @@ sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent,
624 struct sa1111_dev_info *info) 618 struct sa1111_dev_info *info)
625{ 619{
626 struct sa1111_dev *dev; 620 struct sa1111_dev *dev;
621 unsigned i;
627 int ret; 622 int ret;
628 623
629 dev = kzalloc(sizeof(struct sa1111_dev), GFP_KERNEL); 624 dev = kzalloc(sizeof(struct sa1111_dev), GFP_KERNEL);
630 if (!dev) { 625 if (!dev) {
631 ret = -ENOMEM; 626 ret = -ENOMEM;
632 goto out; 627 goto err_alloc;
633 } 628 }
634 629
630 device_initialize(&dev->dev);
635 dev_set_name(&dev->dev, "%4.4lx", info->offset); 631 dev_set_name(&dev->dev, "%4.4lx", info->offset);
636 dev->devid = info->devid; 632 dev->devid = info->devid;
637 dev->dev.parent = sachip->dev; 633 dev->dev.parent = sachip->dev;
638 dev->dev.bus = &sa1111_bus_type; 634 dev->dev.bus = &sa1111_bus_type;
639 dev->dev.release = sa1111_dev_release; 635 dev->dev.release = sa1111_dev_release;
640 dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask;
641 dev->res.start = sachip->phys + info->offset; 636 dev->res.start = sachip->phys + info->offset;
642 dev->res.end = dev->res.start + 511; 637 dev->res.end = dev->res.start + 511;
643 dev->res.name = dev_name(&dev->dev); 638 dev->res.name = dev_name(&dev->dev);
644 dev->res.flags = IORESOURCE_MEM; 639 dev->res.flags = IORESOURCE_MEM;
645 dev->mapbase = sachip->base + info->offset; 640 dev->mapbase = sachip->base + info->offset;
646 dev->skpcr_mask = info->skpcr_mask; 641 dev->skpcr_mask = info->skpcr_mask;
647 memmove(dev->irq, info->irq, sizeof(dev->irq));
648
649 ret = request_resource(parent, &dev->res);
650 if (ret) {
651 printk("SA1111: failed to allocate resource for %s\n",
652 dev->res.name);
653 dev_set_name(&dev->dev, NULL);
654 kfree(dev);
655 goto out;
656 }
657
658 642
659 ret = device_register(&dev->dev); 643 for (i = 0; i < ARRAY_SIZE(info->irq); i++)
660 if (ret) { 644 dev->irq[i] = sachip->irq_base + info->irq[i];
661 release_resource(&dev->res);
662 kfree(dev);
663 goto out;
664 }
665 645
666#ifdef CONFIG_DMABOUNCE
667 /* 646 /*
668 * If the parent device has a DMA mask associated with it, 647 * If the parent device has a DMA mask associated with it, and
669 * propagate it down to the children. 648 * this child supports DMA, propagate it down to the children.
670 */ 649 */
671 if (sachip->dev->dma_mask) { 650 if (info->dma && sachip->dev->dma_mask) {
672 dev->dma_mask = *sachip->dev->dma_mask; 651 dev->dma_mask = *sachip->dev->dma_mask;
673 dev->dev.dma_mask = &dev->dma_mask; 652 dev->dev.dma_mask = &dev->dma_mask;
653 dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask;
654 }
674 655
675 if (dev->dma_mask != 0xffffffffUL) { 656 ret = request_resource(parent, &dev->res);
676 ret = dmabounce_register_dev(&dev->dev, 1024, 4096, 657 if (ret) {
677 sa1111_needs_bounce); 658 dev_err(sachip->dev, "failed to allocate resource for %s\n",
678 if (ret) { 659 dev->res.name);
679 dev_err(&dev->dev, "SA1111: Failed to register" 660 goto err_resource;
680 " with dmabounce\n");
681 device_unregister(&dev->dev);
682 }
683 }
684 } 661 }
685#endif
686 662
687out: 663 ret = device_add(&dev->dev);
664 if (ret)
665 goto err_add;
666 return 0;
667
668 err_add:
669 release_resource(&dev->res);
670 err_resource:
671 put_device(&dev->dev);
672 err_alloc:
688 return ret; 673 return ret;
689} 674}
690 675
@@ -698,16 +683,21 @@ out:
698 * Returns: 683 * Returns:
699 * %-ENODEV device not found. 684 * %-ENODEV device not found.
700 * %-EBUSY physical address already marked in-use. 685 * %-EBUSY physical address already marked in-use.
686 * %-EINVAL no platform data passed
701 * %0 successful. 687 * %0 successful.
702 */ 688 */
703static int __devinit 689static int __devinit
704__sa1111_probe(struct device *me, struct resource *mem, int irq) 690__sa1111_probe(struct device *me, struct resource *mem, int irq)
705{ 691{
692 struct sa1111_platform_data *pd = me->platform_data;
706 struct sa1111 *sachip; 693 struct sa1111 *sachip;
707 unsigned long id; 694 unsigned long id;
708 unsigned int has_devs; 695 unsigned int has_devs;
709 int i, ret = -ENODEV; 696 int i, ret = -ENODEV;
710 697
698 if (!pd)
699 return -EINVAL;
700
711 sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL); 701 sachip = kzalloc(sizeof(struct sa1111), GFP_KERNEL);
712 if (!sachip) 702 if (!sachip)
713 return -ENOMEM; 703 return -ENOMEM;
@@ -727,6 +717,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
727 sachip->dev = me; 717 sachip->dev = me;
728 dev_set_drvdata(sachip->dev, sachip); 718 dev_set_drvdata(sachip->dev, sachip);
729 719
720 sachip->pdata = pd;
730 sachip->phys = mem->start; 721 sachip->phys = mem->start;
731 sachip->irq = irq; 722 sachip->irq = irq;
732 723
@@ -759,6 +750,16 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
759 */ 750 */
760 sa1111_wake(sachip); 751 sa1111_wake(sachip);
761 752
753 /*
754 * The interrupt controller must be initialised before any
755 * other device to ensure that the interrupts are available.
756 */
757 if (sachip->irq != NO_IRQ) {
758 ret = sa1111_setup_irq(sachip, pd->irq_base);
759 if (ret)
760 goto err_unmap;
761 }
762
762#ifdef CONFIG_ARCH_SA1100 763#ifdef CONFIG_ARCH_SA1100
763 { 764 {
764 unsigned int val; 765 unsigned int val;
@@ -789,24 +790,14 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
789 } 790 }
790#endif 791#endif
791 792
792 /*
793 * The interrupt controller must be initialised before any
794 * other device to ensure that the interrupts are available.
795 */
796 if (sachip->irq != NO_IRQ)
797 sa1111_setup_irq(sachip);
798
799 g_sa1111 = sachip; 793 g_sa1111 = sachip;
800 794
801 has_devs = ~0; 795 has_devs = ~0;
802 if (machine_is_assabet() || machine_is_jornada720() || 796 if (pd)
803 machine_is_badge4()) 797 has_devs &= ~pd->disable_devs;
804 has_devs &= ~(1 << 4);
805 else
806 has_devs &= ~(1 << 1);
807 798
808 for (i = 0; i < ARRAY_SIZE(sa1111_devices); i++) 799 for (i = 0; i < ARRAY_SIZE(sa1111_devices); i++)
809 if (has_devs & (1 << i)) 800 if (sa1111_devices[i].devid & has_devs)
810 sa1111_init_one_child(sachip, mem, &sa1111_devices[i]); 801 sa1111_init_one_child(sachip, mem, &sa1111_devices[i]);
811 802
812 return 0; 803 return 0;
@@ -824,7 +815,10 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
824 815
825static int sa1111_remove_one(struct device *dev, void *data) 816static int sa1111_remove_one(struct device *dev, void *data)
826{ 817{
827 device_unregister(dev); 818 struct sa1111_dev *sadev = SA1111_DEV(dev);
819 device_del(&sadev->dev);
820 release_resource(&sadev->res);
821 put_device(&sadev->dev);
828 return 0; 822 return 0;
829} 823}
830 824
@@ -846,6 +840,7 @@ static void __sa1111_remove(struct sa1111 *sachip)
846 if (sachip->irq != NO_IRQ) { 840 if (sachip->irq != NO_IRQ) {
847 irq_set_chained_handler(sachip->irq, NULL); 841 irq_set_chained_handler(sachip->irq, NULL);
848 irq_set_handler_data(sachip->irq, NULL); 842 irq_set_handler_data(sachip->irq, NULL);
843 irq_free_descs(sachip->irq_base, SA1111_IRQ_NR);
849 844
850 release_mem_region(sachip->phys + SA1111_INTC, 512); 845 release_mem_region(sachip->phys + SA1111_INTC, 512);
851 } 846 }
@@ -904,6 +899,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
904 save->skpwm0 = sa1111_readl(base + SA1111_SKPWM0); 899 save->skpwm0 = sa1111_readl(base + SA1111_SKPWM0);
905 save->skpwm1 = sa1111_readl(base + SA1111_SKPWM1); 900 save->skpwm1 = sa1111_readl(base + SA1111_SKPWM1);
906 901
902 sa1111_writel(0, sachip->base + SA1111_SKPWM0);
903 sa1111_writel(0, sachip->base + SA1111_SKPWM1);
904
907 base = sachip->base + SA1111_INTC; 905 base = sachip->base + SA1111_INTC;
908 save->intpol0 = sa1111_readl(base + SA1111_INTPOL0); 906 save->intpol0 = sa1111_readl(base + SA1111_INTPOL0);
909 save->intpol1 = sa1111_readl(base + SA1111_INTPOL1); 907 save->intpol1 = sa1111_readl(base + SA1111_INTPOL1);
@@ -919,13 +917,15 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
919 */ 917 */
920 val = sa1111_readl(sachip->base + SA1111_SKCR); 918 val = sa1111_readl(sachip->base + SA1111_SKCR);
921 sa1111_writel(val | SKCR_SLEEP, sachip->base + SA1111_SKCR); 919 sa1111_writel(val | SKCR_SLEEP, sachip->base + SA1111_SKCR);
922 sa1111_writel(0, sachip->base + SA1111_SKPWM0);
923 sa1111_writel(0, sachip->base + SA1111_SKPWM1);
924 920
925 clk_disable(sachip->clk); 921 clk_disable(sachip->clk);
926 922
927 spin_unlock_irqrestore(&sachip->lock, flags); 923 spin_unlock_irqrestore(&sachip->lock, flags);
928 924
925#ifdef CONFIG_ARCH_SA1100
926 sa1110_mb_disable();
927#endif
928
929 return 0; 929 return 0;
930} 930}
931 931
@@ -966,6 +966,11 @@ static int sa1111_resume(struct platform_device *dev)
966 */ 966 */
967 sa1111_wake(sachip); 967 sa1111_wake(sachip);
968 968
969#ifdef CONFIG_ARCH_SA1100
970 /* Enable the memory bus request/grant signals */
971 sa1110_mb_enable();
972#endif
973
969 /* 974 /*
970 * Only lock for write ops. Also, sa1111_wake must be called with 975 * Only lock for write ops. Also, sa1111_wake must be called with
971 * released spinlock! 976 * released spinlock!
@@ -1053,6 +1058,7 @@ static struct platform_driver sa1111_device_driver = {
1053 .resume = sa1111_resume, 1058 .resume = sa1111_resume,
1054 .driver = { 1059 .driver = {
1055 .name = "sa1111", 1060 .name = "sa1111",
1061 .owner = THIS_MODULE,
1056 }, 1062 },
1057}; 1063};
1058 1064
@@ -1238,16 +1244,23 @@ EXPORT_SYMBOL(sa1111_set_sleep_io);
1238 * sa1111_enable_device - enable an on-chip SA1111 function block 1244 * sa1111_enable_device - enable an on-chip SA1111 function block
1239 * @sadev: SA1111 function block device to enable 1245 * @sadev: SA1111 function block device to enable
1240 */ 1246 */
1241void sa1111_enable_device(struct sa1111_dev *sadev) 1247int sa1111_enable_device(struct sa1111_dev *sadev)
1242{ 1248{
1243 struct sa1111 *sachip = sa1111_chip_driver(sadev); 1249 struct sa1111 *sachip = sa1111_chip_driver(sadev);
1244 unsigned long flags; 1250 unsigned long flags;
1245 unsigned int val; 1251 unsigned int val;
1252 int ret = 0;
1246 1253
1247 spin_lock_irqsave(&sachip->lock, flags); 1254 if (sachip->pdata && sachip->pdata->enable)
1248 val = sa1111_readl(sachip->base + SA1111_SKPCR); 1255 ret = sachip->pdata->enable(sachip->pdata->data, sadev->devid);
1249 sa1111_writel(val | sadev->skpcr_mask, sachip->base + SA1111_SKPCR); 1256
1250 spin_unlock_irqrestore(&sachip->lock, flags); 1257 if (ret == 0) {
1258 spin_lock_irqsave(&sachip->lock, flags);
1259 val = sa1111_readl(sachip->base + SA1111_SKPCR);
1260 sa1111_writel(val | sadev->skpcr_mask, sachip->base + SA1111_SKPCR);
1261 spin_unlock_irqrestore(&sachip->lock, flags);
1262 }
1263 return ret;
1251} 1264}
1252EXPORT_SYMBOL(sa1111_enable_device); 1265EXPORT_SYMBOL(sa1111_enable_device);
1253 1266
@@ -1265,6 +1278,9 @@ void sa1111_disable_device(struct sa1111_dev *sadev)
1265 val = sa1111_readl(sachip->base + SA1111_SKPCR); 1278 val = sa1111_readl(sachip->base + SA1111_SKPCR);
1266 sa1111_writel(val & ~sadev->skpcr_mask, sachip->base + SA1111_SKPCR); 1279 sa1111_writel(val & ~sadev->skpcr_mask, sachip->base + SA1111_SKPCR);
1267 spin_unlock_irqrestore(&sachip->lock, flags); 1280 spin_unlock_irqrestore(&sachip->lock, flags);
1281
1282 if (sachip->pdata && sachip->pdata->disable)
1283 sachip->pdata->disable(sachip->pdata->data, sadev->devid);
1268} 1284}
1269EXPORT_SYMBOL(sa1111_disable_device); 1285EXPORT_SYMBOL(sa1111_disable_device);
1270 1286
@@ -1279,7 +1295,7 @@ static int sa1111_match(struct device *_dev, struct device_driver *_drv)
1279 struct sa1111_dev *dev = SA1111_DEV(_dev); 1295 struct sa1111_dev *dev = SA1111_DEV(_dev);
1280 struct sa1111_driver *drv = SA1111_DRV(_drv); 1296 struct sa1111_driver *drv = SA1111_DRV(_drv);
1281 1297
1282 return dev->devid == drv->devid; 1298 return dev->devid & drv->devid;
1283} 1299}
1284 1300
1285static int sa1111_bus_suspend(struct device *dev, pm_message_t state) 1301static int sa1111_bus_suspend(struct device *dev, pm_message_t state)
@@ -1304,6 +1320,14 @@ static int sa1111_bus_resume(struct device *dev)
1304 return ret; 1320 return ret;
1305} 1321}
1306 1322
1323static void sa1111_bus_shutdown(struct device *dev)
1324{
1325 struct sa1111_driver *drv = SA1111_DRV(dev->driver);
1326
1327 if (drv && drv->shutdown)
1328 drv->shutdown(SA1111_DEV(dev));
1329}
1330
1307static int sa1111_bus_probe(struct device *dev) 1331static int sa1111_bus_probe(struct device *dev)
1308{ 1332{
1309 struct sa1111_dev *sadev = SA1111_DEV(dev); 1333 struct sa1111_dev *sadev = SA1111_DEV(dev);
@@ -1333,6 +1357,7 @@ struct bus_type sa1111_bus_type = {
1333 .remove = sa1111_bus_remove, 1357 .remove = sa1111_bus_remove,
1334 .suspend = sa1111_bus_suspend, 1358 .suspend = sa1111_bus_suspend,
1335 .resume = sa1111_bus_resume, 1359 .resume = sa1111_bus_resume,
1360 .shutdown = sa1111_bus_shutdown,
1336}; 1361};
1337EXPORT_SYMBOL(sa1111_bus_type); 1362EXPORT_SYMBOL(sa1111_bus_type);
1338 1363
@@ -1349,9 +1374,70 @@ void sa1111_driver_unregister(struct sa1111_driver *driver)
1349} 1374}
1350EXPORT_SYMBOL(sa1111_driver_unregister); 1375EXPORT_SYMBOL(sa1111_driver_unregister);
1351 1376
1377#ifdef CONFIG_DMABOUNCE
1378/*
1379 * According to the "Intel StrongARM SA-1111 Microprocessor Companion
1380 * Chip Specification Update" (June 2000), erratum #7, there is a
1381 * significant bug in the SA1111 SDRAM shared memory controller. If
1382 * an access to a region of memory above 1MB relative to the bank base,
1383 * it is important that address bit 10 _NOT_ be asserted. Depending
1384 * on the configuration of the RAM, bit 10 may correspond to one
1385 * of several different (processor-relative) address bits.
1386 *
1387 * This routine only identifies whether or not a given DMA address
1388 * is susceptible to the bug.
1389 *
1390 * This should only get called for sa1111_device types due to the
1391 * way we configure our device dma_masks.
1392 */
1393static int sa1111_needs_bounce(struct device *dev, dma_addr_t addr, size_t size)
1394{
1395 /*
1396 * Section 4.6 of the "Intel StrongARM SA-1111 Development Module
1397 * User's Guide" mentions that jumpers R51 and R52 control the
1398 * target of SA-1111 DMA (either SDRAM bank 0 on Assabet, or
1399 * SDRAM bank 1 on Neponset). The default configuration selects
1400 * Assabet, so any address in bank 1 is necessarily invalid.
1401 */
1402 return (machine_is_assabet() || machine_is_pfs168()) &&
1403 (addr >= 0xc8000000 || (addr + size) >= 0xc8000000);
1404}
1405
1406static int sa1111_notifier_call(struct notifier_block *n, unsigned long action,
1407 void *data)
1408{
1409 struct sa1111_dev *dev = SA1111_DEV(data);
1410
1411 switch (action) {
1412 case BUS_NOTIFY_ADD_DEVICE:
1413 if (dev->dev.dma_mask && dev->dma_mask < 0xffffffffUL) {
1414 int ret = dmabounce_register_dev(&dev->dev, 1024, 4096,
1415 sa1111_needs_bounce);
1416 if (ret)
1417 dev_err(&dev->dev, "failed to register with dmabounce: %d\n", ret);
1418 }
1419 break;
1420
1421 case BUS_NOTIFY_DEL_DEVICE:
1422 if (dev->dev.dma_mask && dev->dma_mask < 0xffffffffUL)
1423 dmabounce_unregister_dev(&dev->dev);
1424 break;
1425 }
1426 return NOTIFY_OK;
1427}
1428
1429static struct notifier_block sa1111_bus_notifier = {
1430 .notifier_call = sa1111_notifier_call,
1431};
1432#endif
1433
1352static int __init sa1111_init(void) 1434static int __init sa1111_init(void)
1353{ 1435{
1354 int ret = bus_register(&sa1111_bus_type); 1436 int ret = bus_register(&sa1111_bus_type);
1437#ifdef CONFIG_DMABOUNCE
1438 if (ret == 0)
1439 bus_register_notifier(&sa1111_bus_type, &sa1111_bus_notifier);
1440#endif
1355 if (ret == 0) 1441 if (ret == 0)
1356 platform_driver_register(&sa1111_device_driver); 1442 platform_driver_register(&sa1111_device_driver);
1357 return ret; 1443 return ret;
@@ -1360,6 +1446,9 @@ static int __init sa1111_init(void)
1360static void __exit sa1111_exit(void) 1446static void __exit sa1111_exit(void)
1361{ 1447{
1362 platform_driver_unregister(&sa1111_device_driver); 1448 platform_driver_unregister(&sa1111_device_driver);
1449#ifdef CONFIG_DMABOUNCE
1450 bus_unregister_notifier(&sa1111_bus_type, &sa1111_bus_notifier);
1451#endif
1363 bus_unregister(&sa1111_bus_type); 1452 bus_unregister(&sa1111_bus_type);
1364} 1453}
1365 1454
diff --git a/arch/arm/common/via82c505.c b/arch/arm/common/via82c505.c
index 67dd2affc57a..1171a5010aea 100644
--- a/arch/arm/common/via82c505.c
+++ b/arch/arm/common/via82c505.c
@@ -6,7 +6,6 @@
6#include <linux/ioport.h> 6#include <linux/ioport.h>
7#include <linux/io.h> 7#include <linux/io.h>
8 8
9#include <asm/system.h>
10 9
11#include <asm/mach/pci.h> 10#include <asm/mach/pci.h>
12 11
diff --git a/arch/arm/configs/at91sam9g20_defconfig b/arch/arm/configs/at91sam9g20_defconfig
index 9123568d9a8d..994d331b2319 100644
--- a/arch/arm/configs/at91sam9g20_defconfig
+++ b/arch/arm/configs/at91sam9g20_defconfig
@@ -74,6 +74,8 @@ CONFIG_LEGACY_PTY_COUNT=16
74CONFIG_SERIAL_ATMEL=y 74CONFIG_SERIAL_ATMEL=y
75CONFIG_SERIAL_ATMEL_CONSOLE=y 75CONFIG_SERIAL_ATMEL_CONSOLE=y
76CONFIG_HW_RANDOM=y 76CONFIG_HW_RANDOM=y
77CONFIG_I2C=y
78CONFIG_I2C_GPIO=y
77CONFIG_SPI=y 79CONFIG_SPI=y
78CONFIG_SPI_ATMEL=y 80CONFIG_SPI_ATMEL=y
79CONFIG_SPI_SPIDEV=y 81CONFIG_SPI_SPIDEV=y
@@ -105,6 +107,7 @@ CONFIG_LEDS_TRIGGERS=y
105CONFIG_LEDS_TRIGGER_TIMER=y 107CONFIG_LEDS_TRIGGER_TIMER=y
106CONFIG_LEDS_TRIGGER_HEARTBEAT=y 108CONFIG_LEDS_TRIGGER_HEARTBEAT=y
107CONFIG_RTC_CLASS=y 109CONFIG_RTC_CLASS=y
110CONFIG_RTC_DRV_RV3029C2=y
108CONFIG_RTC_DRV_AT91SAM9=y 111CONFIG_RTC_DRV_AT91SAM9=y
109CONFIG_EXT2_FS=y 112CONFIG_EXT2_FS=y
110CONFIG_MSDOS_FS=y 113CONFIG_MSDOS_FS=y
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index 1103f62a1964..a8314c3ee84d 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -57,18 +57,24 @@ CONFIG_NETDEVICES=y
57CONFIG_NET_ETHERNET=y 57CONFIG_NET_ETHERNET=y
58CONFIG_NET_PCI=y 58CONFIG_NET_PCI=y
59CONFIG_E100=y 59CONFIG_E100=y
60CONFIG_SMC91X=y
60# CONFIG_KEYBOARD_ATKBD is not set 61# CONFIG_KEYBOARD_ATKBD is not set
61# CONFIG_SERIO_SERPORT is not set 62# CONFIG_SERIO_SERPORT is not set
62CONFIG_SERIAL_AMBA_PL010=y 63CONFIG_SERIAL_AMBA_PL010=y
63CONFIG_SERIAL_AMBA_PL010_CONSOLE=y 64CONFIG_SERIAL_AMBA_PL010_CONSOLE=y
64CONFIG_FB=y 65CONFIG_FB=y
65CONFIG_FB_MODE_HELPERS=y 66CONFIG_FB_MODE_HELPERS=y
67CONFIG_FB_ARMCLCD=y
66CONFIG_FB_MATROX=y 68CONFIG_FB_MATROX=y
67CONFIG_FB_MATROX_MILLENIUM=y 69CONFIG_FB_MATROX_MILLENIUM=y
68CONFIG_FB_MATROX_MYSTIQUE=y 70CONFIG_FB_MATROX_MYSTIQUE=y
71# CONFIG_VGA_CONSOLE is not set
72CONFIG_MMC=y
73CONFIG_MMC_ARMMMCI=y
69CONFIG_RTC_CLASS=y 74CONFIG_RTC_CLASS=y
70CONFIG_RTC_DRV_PL030=y 75CONFIG_RTC_DRV_PL030=y
71CONFIG_EXT2_FS=y 76CONFIG_EXT2_FS=y
77CONFIG_VFAT_FS=y
72CONFIG_TMPFS=y 78CONFIG_TMPFS=y
73CONFIG_JFFS2_FS=y 79CONFIG_JFFS2_FS=y
74CONFIG_CRAMFS=y 80CONFIG_CRAMFS=y
@@ -78,5 +84,7 @@ CONFIG_ROOT_NFS=y
78CONFIG_NFSD=y 84CONFIG_NFSD=y
79CONFIG_NFSD_V3=y 85CONFIG_NFSD_V3=y
80CONFIG_PARTITION_ADVANCED=y 86CONFIG_PARTITION_ADVANCED=y
87CONFIG_NLS_CODEPAGE_437=y
88CONFIG_NLS_ISO8859_1=y
81CONFIG_MAGIC_SYSRQ=y 89CONFIG_MAGIC_SYSRQ=y
82CONFIG_DEBUG_KERNEL=y 90CONFIG_DEBUG_KERNEL=y
diff --git a/arch/arm/configs/u8500_defconfig b/arch/arm/configs/u8500_defconfig
index 2d7b6e7b7271..889d73ac1ae1 100644
--- a/arch/arm/configs/u8500_defconfig
+++ b/arch/arm/configs/u8500_defconfig
@@ -13,6 +13,7 @@ CONFIG_UX500_SOC_DB8500=y
13CONFIG_MACH_HREFV60=y 13CONFIG_MACH_HREFV60=y
14CONFIG_MACH_SNOWBALL=y 14CONFIG_MACH_SNOWBALL=y
15CONFIG_MACH_U5500=y 15CONFIG_MACH_U5500=y
16CONFIG_MACH_UX500_DT=y
16CONFIG_NO_HZ=y 17CONFIG_NO_HZ=y
17CONFIG_HIGH_RES_TIMERS=y 18CONFIG_HIGH_RES_TIMERS=y
18CONFIG_SMP=y 19CONFIG_SMP=y
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 23371b17b23e..03fb93621d0d 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -23,6 +23,8 @@
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/domain.h> 24#include <asm/domain.h>
25 25
26#define IOMEM(x) (x)
27
26/* 28/*
27 * Endian independent macros for shifting bytes within registers. 29 * Endian independent macros for shifting bytes within registers.
28 */ 30 */
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index 86976d034382..68374ba6a943 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -13,7 +13,9 @@
13 13
14#include <linux/compiler.h> 14#include <linux/compiler.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/system.h> 16#include <linux/irqflags.h>
17#include <asm/barrier.h>
18#include <asm/cmpxchg.h>
17 19
18#define ATOMIC_INIT(i) { (i) } 20#define ATOMIC_INIT(i) { (i) }
19 21
diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h
new file mode 100644
index 000000000000..05112380dc53
--- /dev/null
+++ b/arch/arm/include/asm/barrier.h
@@ -0,0 +1,69 @@
1#ifndef __ASM_BARRIER_H
2#define __ASM_BARRIER_H
3
4#ifndef __ASSEMBLY__
5#include <asm/outercache.h>
6
7#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
8
9#if __LINUX_ARM_ARCH__ >= 7 || \
10 (__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
11#define sev() __asm__ __volatile__ ("sev" : : : "memory")
12#define wfe() __asm__ __volatile__ ("wfe" : : : "memory")
13#define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
14#endif
15
16#if __LINUX_ARM_ARCH__ >= 7
17#define isb() __asm__ __volatile__ ("isb" : : : "memory")
18#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
19#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
20#elif defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ == 6
21#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
22 : : "r" (0) : "memory")
23#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
24 : : "r" (0) : "memory")
25#define dmb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
26 : : "r" (0) : "memory")
27#elif defined(CONFIG_CPU_FA526)
28#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
29 : : "r" (0) : "memory")
30#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
31 : : "r" (0) : "memory")
32#define dmb() __asm__ __volatile__ ("" : : : "memory")
33#else
34#define isb() __asm__ __volatile__ ("" : : : "memory")
35#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
36 : : "r" (0) : "memory")
37#define dmb() __asm__ __volatile__ ("" : : : "memory")
38#endif
39
40#ifdef CONFIG_ARCH_HAS_BARRIERS
41#include <mach/barriers.h>
42#elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP)
43#define mb() do { dsb(); outer_sync(); } while (0)
44#define rmb() dsb()
45#define wmb() mb()
46#else
47#include <asm/memory.h>
48#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
49#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
50#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
51#endif
52
53#ifndef CONFIG_SMP
54#define smp_mb() barrier()
55#define smp_rmb() barrier()
56#define smp_wmb() barrier()
57#else
58#define smp_mb() dmb()
59#define smp_rmb() dmb()
60#define smp_wmb() dmb()
61#endif
62
63#define read_barrier_depends() do { } while(0)
64#define smp_read_barrier_depends() do { } while(0)
65
66#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
67
68#endif /* !__ASSEMBLY__ */
69#endif /* __ASM_BARRIER_H */
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index f7419ef9c8f9..e691ec91e4d3 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -24,7 +24,7 @@
24#endif 24#endif
25 25
26#include <linux/compiler.h> 26#include <linux/compiler.h>
27#include <asm/system.h> 27#include <linux/irqflags.h>
28 28
29#define smp_mb__before_clear_bit() smp_mb() 29#define smp_mb__before_clear_bit() smp_mb()
30#define smp_mb__after_clear_bit() smp_mb() 30#define smp_mb__after_clear_bit() smp_mb()
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index fac79dceb736..7af5c6c3653a 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -1,6 +1,7 @@
1#ifndef _ASMARM_BUG_H 1#ifndef _ASMARM_BUG_H
2#define _ASMARM_BUG_H 2#define _ASMARM_BUG_H
3 3
4#include <linux/linkage.h>
4 5
5#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
6 7
@@ -57,4 +58,33 @@ do { \
57 58
58#include <asm-generic/bug.h> 59#include <asm-generic/bug.h>
59 60
61struct pt_regs;
62void die(const char *msg, struct pt_regs *regs, int err);
63
64struct siginfo;
65void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
66 unsigned long err, unsigned long trap);
67
68#ifdef CONFIG_ARM_LPAE
69#define FAULT_CODE_ALIGNMENT 33
70#define FAULT_CODE_DEBUG 34
71#else
72#define FAULT_CODE_ALIGNMENT 1
73#define FAULT_CODE_DEBUG 2
74#endif
75
76void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
77 struct pt_regs *),
78 int sig, int code, const char *name);
79
80void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
81 struct pt_regs *),
82 int sig, int code, const char *name);
83
84extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
85
86struct mm_struct;
87extern void show_pte(struct mm_struct *mm, unsigned long addr);
88extern void __show_regs(struct pt_regs *);
89
60#endif 90#endif
diff --git a/arch/arm/include/asm/cmpxchg.h b/arch/arm/include/asm/cmpxchg.h
new file mode 100644
index 000000000000..d41d7cbf0ada
--- /dev/null
+++ b/arch/arm/include/asm/cmpxchg.h
@@ -0,0 +1,295 @@
1#ifndef __ASM_ARM_CMPXCHG_H
2#define __ASM_ARM_CMPXCHG_H
3
4#include <linux/irqflags.h>
5#include <asm/barrier.h>
6
7#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
8/*
9 * On the StrongARM, "swp" is terminally broken since it bypasses the
10 * cache totally. This means that the cache becomes inconsistent, and,
11 * since we use normal loads/stores as well, this is really bad.
12 * Typically, this causes oopsen in filp_close, but could have other,
13 * more disastrous effects. There are two work-arounds:
14 * 1. Disable interrupts and emulate the atomic swap
15 * 2. Clean the cache, perform atomic swap, flush the cache
16 *
17 * We choose (1) since its the "easiest" to achieve here and is not
18 * dependent on the processor type.
19 *
20 * NOTE that this solution won't work on an SMP system, so explcitly
21 * forbid it here.
22 */
23#define swp_is_buggy
24#endif
25
26static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
27{
28 extern void __bad_xchg(volatile void *, int);
29 unsigned long ret;
30#ifdef swp_is_buggy
31 unsigned long flags;
32#endif
33#if __LINUX_ARM_ARCH__ >= 6
34 unsigned int tmp;
35#endif
36
37 smp_mb();
38
39 switch (size) {
40#if __LINUX_ARM_ARCH__ >= 6
41 case 1:
42 asm volatile("@ __xchg1\n"
43 "1: ldrexb %0, [%3]\n"
44 " strexb %1, %2, [%3]\n"
45 " teq %1, #0\n"
46 " bne 1b"
47 : "=&r" (ret), "=&r" (tmp)
48 : "r" (x), "r" (ptr)
49 : "memory", "cc");
50 break;
51 case 4:
52 asm volatile("@ __xchg4\n"
53 "1: ldrex %0, [%3]\n"
54 " strex %1, %2, [%3]\n"
55 " teq %1, #0\n"
56 " bne 1b"
57 : "=&r" (ret), "=&r" (tmp)
58 : "r" (x), "r" (ptr)
59 : "memory", "cc");
60 break;
61#elif defined(swp_is_buggy)
62#ifdef CONFIG_SMP
63#error SMP is not supported on this platform
64#endif
65 case 1:
66 raw_local_irq_save(flags);
67 ret = *(volatile unsigned char *)ptr;
68 *(volatile unsigned char *)ptr = x;
69 raw_local_irq_restore(flags);
70 break;
71
72 case 4:
73 raw_local_irq_save(flags);
74 ret = *(volatile unsigned long *)ptr;
75 *(volatile unsigned long *)ptr = x;
76 raw_local_irq_restore(flags);
77 break;
78#else
79 case 1:
80 asm volatile("@ __xchg1\n"
81 " swpb %0, %1, [%2]"
82 : "=&r" (ret)
83 : "r" (x), "r" (ptr)
84 : "memory", "cc");
85 break;
86 case 4:
87 asm volatile("@ __xchg4\n"
88 " swp %0, %1, [%2]"
89 : "=&r" (ret)
90 : "r" (x), "r" (ptr)
91 : "memory", "cc");
92 break;
93#endif
94 default:
95 __bad_xchg(ptr, size), ret = 0;
96 break;
97 }
98 smp_mb();
99
100 return ret;
101}
102
103#define xchg(ptr,x) \
104 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
105
106#include <asm-generic/cmpxchg-local.h>
107
108#if __LINUX_ARM_ARCH__ < 6
109/* min ARCH < ARMv6 */
110
111#ifdef CONFIG_SMP
112#error "SMP is not supported on this platform"
113#endif
114
115/*
116 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
117 * them available.
118 */
119#define cmpxchg_local(ptr, o, n) \
120 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
121 (unsigned long)(n), sizeof(*(ptr))))
122#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
123
124#ifndef CONFIG_SMP
125#include <asm-generic/cmpxchg.h>
126#endif
127
128#else /* min ARCH >= ARMv6 */
129
130extern void __bad_cmpxchg(volatile void *ptr, int size);
131
132/*
133 * cmpxchg only support 32-bits operands on ARMv6.
134 */
135
136static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
137 unsigned long new, int size)
138{
139 unsigned long oldval, res;
140
141 switch (size) {
142#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
143 case 1:
144 do {
145 asm volatile("@ __cmpxchg1\n"
146 " ldrexb %1, [%2]\n"
147 " mov %0, #0\n"
148 " teq %1, %3\n"
149 " strexbeq %0, %4, [%2]\n"
150 : "=&r" (res), "=&r" (oldval)
151 : "r" (ptr), "Ir" (old), "r" (new)
152 : "memory", "cc");
153 } while (res);
154 break;
155 case 2:
156 do {
157 asm volatile("@ __cmpxchg1\n"
158 " ldrexh %1, [%2]\n"
159 " mov %0, #0\n"
160 " teq %1, %3\n"
161 " strexheq %0, %4, [%2]\n"
162 : "=&r" (res), "=&r" (oldval)
163 : "r" (ptr), "Ir" (old), "r" (new)
164 : "memory", "cc");
165 } while (res);
166 break;
167#endif
168 case 4:
169 do {
170 asm volatile("@ __cmpxchg4\n"
171 " ldrex %1, [%2]\n"
172 " mov %0, #0\n"
173 " teq %1, %3\n"
174 " strexeq %0, %4, [%2]\n"
175 : "=&r" (res), "=&r" (oldval)
176 : "r" (ptr), "Ir" (old), "r" (new)
177 : "memory", "cc");
178 } while (res);
179 break;
180 default:
181 __bad_cmpxchg(ptr, size);
182 oldval = 0;
183 }
184
185 return oldval;
186}
187
188static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
189 unsigned long new, int size)
190{
191 unsigned long ret;
192
193 smp_mb();
194 ret = __cmpxchg(ptr, old, new, size);
195 smp_mb();
196
197 return ret;
198}
199
200#define cmpxchg(ptr,o,n) \
201 ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \
202 (unsigned long)(o), \
203 (unsigned long)(n), \
204 sizeof(*(ptr))))
205
206static inline unsigned long __cmpxchg_local(volatile void *ptr,
207 unsigned long old,
208 unsigned long new, int size)
209{
210 unsigned long ret;
211
212 switch (size) {
213#ifdef CONFIG_CPU_V6 /* min ARCH == ARMv6 */
214 case 1:
215 case 2:
216 ret = __cmpxchg_local_generic(ptr, old, new, size);
217 break;
218#endif
219 default:
220 ret = __cmpxchg(ptr, old, new, size);
221 }
222
223 return ret;
224}
225
226#define cmpxchg_local(ptr,o,n) \
227 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), \
228 (unsigned long)(o), \
229 (unsigned long)(n), \
230 sizeof(*(ptr))))
231
232#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
233
234/*
235 * Note : ARMv7-M (currently unsupported by Linux) does not support
236 * ldrexd/strexd. If ARMv7-M is ever supported by the Linux kernel, it should
237 * not be allowed to use __cmpxchg64.
238 */
239static inline unsigned long long __cmpxchg64(volatile void *ptr,
240 unsigned long long old,
241 unsigned long long new)
242{
243 register unsigned long long oldval asm("r0");
244 register unsigned long long __old asm("r2") = old;
245 register unsigned long long __new asm("r4") = new;
246 unsigned long res;
247
248 do {
249 asm volatile(
250 " @ __cmpxchg8\n"
251 " ldrexd %1, %H1, [%2]\n"
252 " mov %0, #0\n"
253 " teq %1, %3\n"
254 " teqeq %H1, %H3\n"
255 " strexdeq %0, %4, %H4, [%2]\n"
256 : "=&r" (res), "=&r" (oldval)
257 : "r" (ptr), "Ir" (__old), "r" (__new)
258 : "memory", "cc");
259 } while (res);
260
261 return oldval;
262}
263
264static inline unsigned long long __cmpxchg64_mb(volatile void *ptr,
265 unsigned long long old,
266 unsigned long long new)
267{
268 unsigned long long ret;
269
270 smp_mb();
271 ret = __cmpxchg64(ptr, old, new);
272 smp_mb();
273
274 return ret;
275}
276
277#define cmpxchg64(ptr,o,n) \
278 ((__typeof__(*(ptr)))__cmpxchg64_mb((ptr), \
279 (unsigned long long)(o), \
280 (unsigned long long)(n)))
281
282#define cmpxchg64_local(ptr,o,n) \
283 ((__typeof__(*(ptr)))__cmpxchg64((ptr), \
284 (unsigned long long)(o), \
285 (unsigned long long)(n)))
286
287#else /* min ARCH = ARMv6 */
288
289#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
290
291#endif
292
293#endif /* __LINUX_ARM_ARCH__ >= 6 */
294
295#endif /* __ASM_ARM_CMPXCHG_H */
diff --git a/arch/arm/include/asm/compiler.h b/arch/arm/include/asm/compiler.h
new file mode 100644
index 000000000000..8155db2f7fa1
--- /dev/null
+++ b/arch/arm/include/asm/compiler.h
@@ -0,0 +1,15 @@
1#ifndef __ASM_ARM_COMPILER_H
2#define __ASM_ARM_COMPILER_H
3
4/*
5 * This is used to ensure the compiler did actually allocate the register we
6 * asked it for some inline assembly sequences. Apparently we can't trust
7 * the compiler from one version to another so a bit of paranoia won't hurt.
8 * This string is meant to be concatenated with the inline asm string and
9 * will cause compilation to stop on mismatch.
10 * (for details, see gcc PR 15089)
11 */
12#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
13
14
15#endif /* __ASM_ARM_COMPILER_H */
diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h
new file mode 100644
index 000000000000..5ef4d8015a60
--- /dev/null
+++ b/arch/arm/include/asm/cp15.h
@@ -0,0 +1,87 @@
1#ifndef __ASM_ARM_CP15_H
2#define __ASM_ARM_CP15_H
3
4#include <asm/barrier.h>
5
6/*
7 * CR1 bits (CP#15 CR1)
8 */
9#define CR_M (1 << 0) /* MMU enable */
10#define CR_A (1 << 1) /* Alignment abort enable */
11#define CR_C (1 << 2) /* Dcache enable */
12#define CR_W (1 << 3) /* Write buffer enable */
13#define CR_P (1 << 4) /* 32-bit exception handler */
14#define CR_D (1 << 5) /* 32-bit data address range */
15#define CR_L (1 << 6) /* Implementation defined */
16#define CR_B (1 << 7) /* Big endian */
17#define CR_S (1 << 8) /* System MMU protection */
18#define CR_R (1 << 9) /* ROM MMU protection */
19#define CR_F (1 << 10) /* Implementation defined */
20#define CR_Z (1 << 11) /* Implementation defined */
21#define CR_I (1 << 12) /* Icache enable */
22#define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
23#define CR_RR (1 << 14) /* Round Robin cache replacement */
24#define CR_L4 (1 << 15) /* LDR pc can set T bit */
25#define CR_DT (1 << 16)
26#define CR_IT (1 << 18)
27#define CR_ST (1 << 19)
28#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
29#define CR_U (1 << 22) /* Unaligned access operation */
30#define CR_XP (1 << 23) /* Extended page tables */
31#define CR_VE (1 << 24) /* Vectored interrupts */
32#define CR_EE (1 << 25) /* Exception (Big) Endian */
33#define CR_TRE (1 << 28) /* TEX remap enable */
34#define CR_AFE (1 << 29) /* Access flag enable */
35#define CR_TE (1 << 30) /* Thumb exception enable */
36
37#ifndef __ASSEMBLY__
38
39#if __LINUX_ARM_ARCH__ >= 4
40#define vectors_high() (cr_alignment & CR_V)
41#else
42#define vectors_high() (0)
43#endif
44
45extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
46extern unsigned long cr_alignment; /* defined in entry-armv.S */
47
48static inline unsigned int get_cr(void)
49{
50 unsigned int val;
51 asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
52 return val;
53}
54
55static inline void set_cr(unsigned int val)
56{
57 asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
58 : : "r" (val) : "cc");
59 isb();
60}
61
62#ifndef CONFIG_SMP
63extern void adjust_cr(unsigned long mask, unsigned long set);
64#endif
65
66#define CPACC_FULL(n) (3 << (n * 2))
67#define CPACC_SVC(n) (1 << (n * 2))
68#define CPACC_DISABLE(n) (0 << (n * 2))
69
70static inline unsigned int get_copro_access(void)
71{
72 unsigned int val;
73 asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
74 : "=r" (val) : : "cc");
75 return val;
76}
77
78static inline void set_copro_access(unsigned int val)
79{
80 asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
81 : : "r" (val) : "cc");
82 isb();
83}
84
85#endif
86
87#endif
diff --git a/arch/arm/include/asm/cpuidle.h b/arch/arm/include/asm/cpuidle.h
new file mode 100644
index 000000000000..2fca60ab513a
--- /dev/null
+++ b/arch/arm/include/asm/cpuidle.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_ARM_CPUIDLE_H
2#define __ASM_ARM_CPUIDLE_H
3
4#ifdef CONFIG_CPU_IDLE
5extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
6 struct cpuidle_driver *drv, int index);
7#else
8static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
9 struct cpuidle_driver *drv, int index) { return -ENODEV; }
10#endif
11
12/* Common ARM WFI state */
13#define ARM_CPUIDLE_WFI_STATE_PWR(p) {\
14 .enter = arm_cpuidle_simple_enter,\
15 .exit_latency = 1,\
16 .target_residency = 1,\
17 .power_usage = p,\
18 .flags = CPUIDLE_FLAG_TIME_VALID,\
19 .name = "WFI",\
20 .desc = "ARM WFI",\
21}
22
23/*
24 * in case power_specified == 1, give a default WFI power value needed
25 * by some governors
26 */
27#define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX)
28
29#endif
diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
index d3f0a9eee9f6..fe92ccf1d0b0 100644
--- a/arch/arm/include/asm/div64.h
+++ b/arch/arm/include/asm/div64.h
@@ -1,8 +1,8 @@
1#ifndef __ASM_ARM_DIV64 1#ifndef __ASM_ARM_DIV64
2#define __ASM_ARM_DIV64 2#define __ASM_ARM_DIV64
3 3
4#include <asm/system.h>
5#include <linux/types.h> 4#include <linux/types.h>
5#include <asm/compiler.h>
6 6
7/* 7/*
8 * The semantics of do_div() are: 8 * The semantics of do_div() are:
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 69a5b0b6455c..5694a0d6576b 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -19,7 +19,6 @@
19 * It should not be re-used except for that purpose. 19 * It should not be re-used except for that purpose.
20 */ 20 */
21#include <linux/spinlock.h> 21#include <linux/spinlock.h>
22#include <asm/system.h>
23#include <asm/scatterlist.h> 22#include <asm/scatterlist.h>
24 23
25#include <mach/isa-dma.h> 24#include <mach/isa-dma.h>
diff --git a/arch/arm/include/asm/domain.h b/arch/arm/include/asm/domain.h
index b5dc173d336f..3d2220498abc 100644
--- a/arch/arm/include/asm/domain.h
+++ b/arch/arm/include/asm/domain.h
@@ -10,6 +10,10 @@
10#ifndef __ASM_PROC_DOMAIN_H 10#ifndef __ASM_PROC_DOMAIN_H
11#define __ASM_PROC_DOMAIN_H 11#define __ASM_PROC_DOMAIN_H
12 12
13#ifndef __ASSEMBLY__
14#include <asm/barrier.h>
15#endif
16
13/* 17/*
14 * Domain numbers 18 * Domain numbers
15 * 19 *
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index 0e9ce8d9686e..38050b1c4800 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -130,8 +130,4 @@ struct mm_struct;
130extern unsigned long arch_randomize_brk(struct mm_struct *mm); 130extern unsigned long arch_randomize_brk(struct mm_struct *mm);
131#define arch_randomize_brk arch_randomize_brk 131#define arch_randomize_brk arch_randomize_brk
132 132
133extern int vectors_user_mapping(void);
134#define arch_setup_additional_pages(bprm, uses_interp) vectors_user_mapping()
135#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
136
137#endif 133#endif
diff --git a/arch/arm/include/asm/exec.h b/arch/arm/include/asm/exec.h
new file mode 100644
index 000000000000..7c4fbef72b3a
--- /dev/null
+++ b/arch/arm/include/asm/exec.h
@@ -0,0 +1,6 @@
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/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 7df239bcdf27..c4c87bc12231 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -103,11 +103,11 @@
103#define L2X0_ADDR_FILTER_EN 1 103#define L2X0_ADDR_FILTER_EN 1
104 104
105#ifndef __ASSEMBLY__ 105#ifndef __ASSEMBLY__
106extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); 106extern void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask);
107#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF) 107#if defined(CONFIG_CACHE_L2X0) && defined(CONFIG_OF)
108extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask); 108extern int l2x0_of_init(u32 aux_val, u32 aux_mask);
109#else 109#else
110static inline int l2x0_of_init(__u32 aux_val, __u32 aux_mask) 110static inline int l2x0_of_init(u32 aux_val, u32 aux_mask)
111{ 111{
112 return -ENODEV; 112 return -ENODEV;
113} 113}
diff --git a/arch/arm/include/asm/hardware/iop3xx.h b/arch/arm/include/asm/hardware/iop3xx.h
index 077c32326c63..2ff2c75a4639 100644
--- a/arch/arm/include/asm/hardware/iop3xx.h
+++ b/arch/arm/include/asm/hardware/iop3xx.h
@@ -231,6 +231,9 @@ extern int iop3xx_get_init_atu(void);
231 231
232 232
233#ifndef __ASSEMBLY__ 233#ifndef __ASSEMBLY__
234
235#include <linux/types.h>
236
234void iop3xx_map_io(void); 237void iop3xx_map_io(void);
235void iop_init_cp6_handler(void); 238void iop_init_cp6_handler(void);
236void iop_init_time(unsigned long tickrate); 239void iop_init_time(unsigned long tickrate);
diff --git a/arch/arm/include/asm/hardware/iop_adma.h b/arch/arm/include/asm/hardware/iop_adma.h
index 59b8c3892f76..122f86d8c991 100644
--- a/arch/arm/include/asm/hardware/iop_adma.h
+++ b/arch/arm/include/asm/hardware/iop_adma.h
@@ -49,7 +49,6 @@ struct iop_adma_device {
49/** 49/**
50 * struct iop_adma_chan - internal representation of an ADMA device 50 * struct iop_adma_chan - internal representation of an ADMA device
51 * @pending: allows batching of hardware operations 51 * @pending: allows batching of hardware operations
52 * @completed_cookie: identifier for the most recently completed operation
53 * @lock: serializes enqueue/dequeue operations to the slot pool 52 * @lock: serializes enqueue/dequeue operations to the slot pool
54 * @mmr_base: memory mapped register base 53 * @mmr_base: memory mapped register base
55 * @chain: device chain view of the descriptors 54 * @chain: device chain view of the descriptors
@@ -62,7 +61,6 @@ struct iop_adma_device {
62 */ 61 */
63struct iop_adma_chan { 62struct iop_adma_chan {
64 int pending; 63 int pending;
65 dma_cookie_t completed_cookie;
66 spinlock_t lock; /* protects the descriptor slot pool */ 64 spinlock_t lock; /* protects the descriptor slot pool */
67 void __iomem *mmr_base; 65 void __iomem *mmr_base;
68 struct list_head chain; 66 struct list_head chain;
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
index 43cab498bc27..73f84fa4f366 100644
--- a/arch/arm/include/asm/hardware/it8152.h
+++ b/arch/arm/include/asm/hardware/it8152.h
@@ -9,6 +9,9 @@
9 9
10#ifndef __ASM_HARDWARE_IT8152_H 10#ifndef __ASM_HARDWARE_IT8152_H
11#define __ASM_HARDWARE_IT8152_H 11#define __ASM_HARDWARE_IT8152_H
12
13#include <mach/irqs.h>
14
12extern void __iomem *it8152_base_address; 15extern void __iomem *it8152_base_address;
13 16
14#define IT8152_IO_BASE (it8152_base_address + 0x03e00000) 17#define IT8152_IO_BASE (it8152_base_address + 0x03e00000)
diff --git a/arch/arm/include/asm/hardware/pl330.h b/arch/arm/include/asm/hardware/pl330.h
deleted file mode 100644
index c1821385abfa..000000000000
--- a/arch/arm/include/asm/hardware/pl330.h
+++ /dev/null
@@ -1,217 +0,0 @@
1/* linux/include/asm/hardware/pl330.h
2 *
3 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
4 * Jaswinder Singh <jassi.brar@samsung.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef __PL330_CORE_H
22#define __PL330_CORE_H
23
24#define PL330_MAX_CHAN 8
25#define PL330_MAX_IRQS 32
26#define PL330_MAX_PERI 32
27
28enum pl330_srccachectrl {
29 SCCTRL0 = 0, /* Noncacheable and nonbufferable */
30 SCCTRL1, /* Bufferable only */
31 SCCTRL2, /* Cacheable, but do not allocate */
32 SCCTRL3, /* Cacheable and bufferable, but do not allocate */
33 SINVALID1,
34 SINVALID2,
35 SCCTRL6, /* Cacheable write-through, allocate on reads only */
36 SCCTRL7, /* Cacheable write-back, allocate on reads only */
37};
38
39enum pl330_dstcachectrl {
40 DCCTRL0 = 0, /* Noncacheable and nonbufferable */
41 DCCTRL1, /* Bufferable only */
42 DCCTRL2, /* Cacheable, but do not allocate */
43 DCCTRL3, /* Cacheable and bufferable, but do not allocate */
44 DINVALID1, /* AWCACHE = 0x1000 */
45 DINVALID2,
46 DCCTRL6, /* Cacheable write-through, allocate on writes only */
47 DCCTRL7, /* Cacheable write-back, allocate on writes only */
48};
49
50/* Populated by the PL330 core driver for DMA API driver's info */
51struct pl330_config {
52 u32 periph_id;
53 u32 pcell_id;
54#define DMAC_MODE_NS (1 << 0)
55 unsigned int mode;
56 unsigned int data_bus_width:10; /* In number of bits */
57 unsigned int data_buf_dep:10;
58 unsigned int num_chan:4;
59 unsigned int num_peri:6;
60 u32 peri_ns;
61 unsigned int num_events:6;
62 u32 irq_ns;
63};
64
65/* Handle to the DMAC provided to the PL330 core */
66struct pl330_info {
67 /* Owning device */
68 struct device *dev;
69 /* Size of MicroCode buffers for each channel. */
70 unsigned mcbufsz;
71 /* ioremap'ed address of PL330 registers. */
72 void __iomem *base;
73 /* Client can freely use it. */
74 void *client_data;
75 /* PL330 core data, Client must not touch it. */
76 void *pl330_data;
77 /* Populated by the PL330 core driver during pl330_add */
78 struct pl330_config pcfg;
79 /*
80 * If the DMAC has some reset mechanism, then the
81 * client may want to provide pointer to the method.
82 */
83 void (*dmac_reset)(struct pl330_info *pi);
84};
85
86enum pl330_byteswap {
87 SWAP_NO = 0,
88 SWAP_2,
89 SWAP_4,
90 SWAP_8,
91 SWAP_16,
92};
93
94/**
95 * Request Configuration.
96 * The PL330 core does not modify this and uses the last
97 * working configuration if the request doesn't provide any.
98 *
99 * The Client may want to provide this info only for the
100 * first request and a request with new settings.
101 */
102struct pl330_reqcfg {
103 /* Address Incrementing */
104 unsigned dst_inc:1;
105 unsigned src_inc:1;
106
107 /*
108 * For now, the SRC & DST protection levels
109 * and burst size/length are assumed same.
110 */
111 bool nonsecure;
112 bool privileged;
113 bool insnaccess;
114 unsigned brst_len:5;
115 unsigned brst_size:3; /* in power of 2 */
116
117 enum pl330_dstcachectrl dcctl;
118 enum pl330_srccachectrl scctl;
119 enum pl330_byteswap swap;
120};
121
122/*
123 * One cycle of DMAC operation.
124 * There may be more than one xfer in a request.
125 */
126struct pl330_xfer {
127 u32 src_addr;
128 u32 dst_addr;
129 /* Size to xfer */
130 u32 bytes;
131 /*
132 * Pointer to next xfer in the list.
133 * The last xfer in the req must point to NULL.
134 */
135 struct pl330_xfer *next;
136};
137
138/* The xfer callbacks are made with one of these arguments. */
139enum pl330_op_err {
140 /* The all xfers in the request were success. */
141 PL330_ERR_NONE,
142 /* If req aborted due to global error. */
143 PL330_ERR_ABORT,
144 /* If req failed due to problem with Channel. */
145 PL330_ERR_FAIL,
146};
147
148enum pl330_reqtype {
149 MEMTOMEM,
150 MEMTODEV,
151 DEVTOMEM,
152 DEVTODEV,
153};
154
155/* A request defining Scatter-Gather List ending with NULL xfer. */
156struct pl330_req {
157 enum pl330_reqtype rqtype;
158 /* Index of peripheral for the xfer. */
159 unsigned peri:5;
160 /* Unique token for this xfer, set by the client. */
161 void *token;
162 /* Callback to be called after xfer. */
163 void (*xfer_cb)(void *token, enum pl330_op_err err);
164 /* If NULL, req will be done at last set parameters. */
165 struct pl330_reqcfg *cfg;
166 /* Pointer to first xfer in the request. */
167 struct pl330_xfer *x;
168};
169
170/*
171 * To know the status of the channel and DMAC, the client
172 * provides a pointer to this structure. The PL330 core
173 * fills it with current information.
174 */
175struct pl330_chanstatus {
176 /*
177 * If the DMAC engine halted due to some error,
178 * the client should remove-add DMAC.
179 */
180 bool dmac_halted;
181 /*
182 * If channel is halted due to some error,
183 * the client should ABORT/FLUSH and START the channel.
184 */
185 bool faulting;
186 /* Location of last load */
187 u32 src_addr;
188 /* Location of last store */
189 u32 dst_addr;
190 /*
191 * Pointer to the currently active req, NULL if channel is
192 * inactive, even though the requests may be present.
193 */
194 struct pl330_req *top_req;
195 /* Pointer to req waiting second in the queue if any. */
196 struct pl330_req *wait_req;
197};
198
199enum pl330_chan_op {
200 /* Start the channel */
201 PL330_OP_START,
202 /* Abort the active xfer */
203 PL330_OP_ABORT,
204 /* Stop xfer and flush queue */
205 PL330_OP_FLUSH,
206};
207
208extern int pl330_add(struct pl330_info *);
209extern void pl330_del(struct pl330_info *pi);
210extern int pl330_update(const struct pl330_info *pi);
211extern void pl330_release_channel(void *ch_id);
212extern void *pl330_request_channel(const struct pl330_info *pi);
213extern int pl330_chan_status(void *ch_id, struct pl330_chanstatus *pstatus);
214extern int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op);
215extern int pl330_submit_req(void *ch_id, struct pl330_req *r);
216
217#endif /* __PL330_CORE_H */
diff --git a/arch/arm/include/asm/hardware/sa1111.h b/arch/arm/include/asm/hardware/sa1111.h
index 92ed254c175b..7c2bbc7f0be1 100644
--- a/arch/arm/include/asm/hardware/sa1111.h
+++ b/arch/arm/include/asm/hardware/sa1111.h
@@ -132,34 +132,10 @@
132#define SKPCR_DCLKEN (1<<7) 132#define SKPCR_DCLKEN (1<<7)
133#define SKPCR_PWMCLKEN (1<<8) 133#define SKPCR_PWMCLKEN (1<<8)
134 134
135/* 135/* USB Host controller */
136 * USB Host controller
137 */
138#define SA1111_USB 0x0400 136#define SA1111_USB 0x0400
139 137
140/* 138/*
141 * Offsets from SA1111_USB_BASE
142 */
143#define SA1111_USB_STATUS 0x0118
144#define SA1111_USB_RESET 0x011c
145#define SA1111_USB_IRQTEST 0x0120
146
147#define USB_RESET_FORCEIFRESET (1 << 0)
148#define USB_RESET_FORCEHCRESET (1 << 1)
149#define USB_RESET_CLKGENRESET (1 << 2)
150#define USB_RESET_SIMSCALEDOWN (1 << 3)
151#define USB_RESET_USBINTTEST (1 << 4)
152#define USB_RESET_SLEEPSTBYEN (1 << 5)
153#define USB_RESET_PWRSENSELOW (1 << 6)
154#define USB_RESET_PWRCTRLLOW (1 << 7)
155
156#define USB_STATUS_IRQHCIRMTWKUP (1 << 7)
157#define USB_STATUS_IRQHCIBUFFACC (1 << 8)
158#define USB_STATUS_NIRQHCIM (1 << 9)
159#define USB_STATUS_NHCIMFCLR (1 << 10)
160#define USB_STATUS_USBPWRSENSE (1 << 11)
161
162/*
163 * Serial Audio Controller 139 * Serial Audio Controller
164 * 140 *
165 * Registers 141 * Registers
@@ -327,22 +303,6 @@
327 * PC_SSR GPIO Block C Sleep State 303 * PC_SSR GPIO Block C Sleep State
328 */ 304 */
329 305
330#define _PA_DDR _SA1111( 0x1000 )
331#define _PA_DRR _SA1111( 0x1004 )
332#define _PA_DWR _SA1111( 0x1004 )
333#define _PA_SDR _SA1111( 0x1008 )
334#define _PA_SSR _SA1111( 0x100c )
335#define _PB_DDR _SA1111( 0x1010 )
336#define _PB_DRR _SA1111( 0x1014 )
337#define _PB_DWR _SA1111( 0x1014 )
338#define _PB_SDR _SA1111( 0x1018 )
339#define _PB_SSR _SA1111( 0x101c )
340#define _PC_DDR _SA1111( 0x1020 )
341#define _PC_DRR _SA1111( 0x1024 )
342#define _PC_DWR _SA1111( 0x1024 )
343#define _PC_SDR _SA1111( 0x1028 )
344#define _PC_SSR _SA1111( 0x102c )
345
346#define SA1111_GPIO 0x1000 306#define SA1111_GPIO 0x1000
347 307
348#define SA1111_GPIO_PADDR (0x000) 308#define SA1111_GPIO_PADDR (0x000)
@@ -425,106 +385,30 @@
425#define SA1111_WAKEPOL0 0x0034 385#define SA1111_WAKEPOL0 0x0034
426#define SA1111_WAKEPOL1 0x0038 386#define SA1111_WAKEPOL1 0x0038
427 387
428/* 388/* PS/2 Trackpad and Mouse Interfaces */
429 * PS/2 Trackpad and Mouse Interfaces
430 *
431 * Registers
432 * PS2CR Control Register
433 * PS2STAT Status Register
434 * PS2DATA Transmit/Receive Data register
435 * PS2CLKDIV Clock Division Register
436 * PS2PRECNT Clock Precount Register
437 * PS2TEST1 Test register 1
438 * PS2TEST2 Test register 2
439 * PS2TEST3 Test register 3
440 * PS2TEST4 Test register 4
441 */
442
443#define SA1111_KBD 0x0a00 389#define SA1111_KBD 0x0a00
444#define SA1111_MSE 0x0c00 390#define SA1111_MSE 0x0c00
445 391
446/* 392/* PCMCIA Interface */
447 * These are offsets from the above bases. 393#define SA1111_PCMCIA 0x1600
448 */
449#define SA1111_PS2CR 0x0000
450#define SA1111_PS2STAT 0x0004
451#define SA1111_PS2DATA 0x0008
452#define SA1111_PS2CLKDIV 0x000c
453#define SA1111_PS2PRECNT 0x0010
454
455#define PS2CR_ENA 0x08
456#define PS2CR_FKD 0x02
457#define PS2CR_FKC 0x01
458
459#define PS2STAT_STP 0x0100
460#define PS2STAT_TXE 0x0080
461#define PS2STAT_TXB 0x0040
462#define PS2STAT_RXF 0x0020
463#define PS2STAT_RXB 0x0010
464#define PS2STAT_ENA 0x0008
465#define PS2STAT_RXP 0x0004
466#define PS2STAT_KBD 0x0002
467#define PS2STAT_KBC 0x0001
468 394
469/*
470 * PCMCIA Interface
471 *
472 * Registers
473 * PCSR Status Register
474 * PCCR Control Register
475 * PCSSR Sleep State Register
476 */
477
478#define SA1111_PCMCIA 0x1600
479
480/*
481 * These are offsets from the above base.
482 */
483#define SA1111_PCCR 0x0000
484#define SA1111_PCSSR 0x0004
485#define SA1111_PCSR 0x0008
486
487#define PCSR_S0_READY (1<<0)
488#define PCSR_S1_READY (1<<1)
489#define PCSR_S0_DETECT (1<<2)
490#define PCSR_S1_DETECT (1<<3)
491#define PCSR_S0_VS1 (1<<4)
492#define PCSR_S0_VS2 (1<<5)
493#define PCSR_S1_VS1 (1<<6)
494#define PCSR_S1_VS2 (1<<7)
495#define PCSR_S0_WP (1<<8)
496#define PCSR_S1_WP (1<<9)
497#define PCSR_S0_BVD1 (1<<10)
498#define PCSR_S0_BVD2 (1<<11)
499#define PCSR_S1_BVD1 (1<<12)
500#define PCSR_S1_BVD2 (1<<13)
501
502#define PCCR_S0_RST (1<<0)
503#define PCCR_S1_RST (1<<1)
504#define PCCR_S0_FLT (1<<2)
505#define PCCR_S1_FLT (1<<3)
506#define PCCR_S0_PWAITEN (1<<4)
507#define PCCR_S1_PWAITEN (1<<5)
508#define PCCR_S0_PSE (1<<6)
509#define PCCR_S1_PSE (1<<7)
510
511#define PCSSR_S0_SLEEP (1<<0)
512#define PCSSR_S1_SLEEP (1<<1)
513 395
514 396
515 397
516 398
517extern struct bus_type sa1111_bus_type; 399extern struct bus_type sa1111_bus_type;
518 400
519#define SA1111_DEVID_SBI 0 401#define SA1111_DEVID_SBI (1 << 0)
520#define SA1111_DEVID_SK 1 402#define SA1111_DEVID_SK (1 << 1)
521#define SA1111_DEVID_USB 2 403#define SA1111_DEVID_USB (1 << 2)
522#define SA1111_DEVID_SAC 3 404#define SA1111_DEVID_SAC (1 << 3)
523#define SA1111_DEVID_SSP 4 405#define SA1111_DEVID_SSP (1 << 4)
524#define SA1111_DEVID_PS2 5 406#define SA1111_DEVID_PS2 (3 << 5)
525#define SA1111_DEVID_GPIO 6 407#define SA1111_DEVID_PS2_KBD (1 << 5)
526#define SA1111_DEVID_INT 7 408#define SA1111_DEVID_PS2_MSE (1 << 6)
527#define SA1111_DEVID_PCMCIA 8 409#define SA1111_DEVID_GPIO (1 << 7)
410#define SA1111_DEVID_INT (1 << 8)
411#define SA1111_DEVID_PCMCIA (1 << 9)
528 412
529struct sa1111_dev { 413struct sa1111_dev {
530 struct device dev; 414 struct device dev;
@@ -548,6 +432,7 @@ struct sa1111_driver {
548 int (*remove)(struct sa1111_dev *); 432 int (*remove)(struct sa1111_dev *);
549 int (*suspend)(struct sa1111_dev *, pm_message_t); 433 int (*suspend)(struct sa1111_dev *, pm_message_t);
550 int (*resume)(struct sa1111_dev *); 434 int (*resume)(struct sa1111_dev *);
435 void (*shutdown)(struct sa1111_dev *);
551}; 436};
552 437
553#define SA1111_DRV(_d) container_of((_d), struct sa1111_driver, drv) 438#define SA1111_DRV(_d) container_of((_d), struct sa1111_driver, drv)
@@ -555,9 +440,10 @@ struct sa1111_driver {
555#define SA1111_DRIVER_NAME(_sadev) ((_sadev)->dev.driver->name) 440#define SA1111_DRIVER_NAME(_sadev) ((_sadev)->dev.driver->name)
556 441
557/* 442/*
558 * These frob the SKPCR register. 443 * These frob the SKPCR register, and call platform specific
444 * enable/disable functions.
559 */ 445 */
560void sa1111_enable_device(struct sa1111_dev *); 446int sa1111_enable_device(struct sa1111_dev *);
561void sa1111_disable_device(struct sa1111_dev *); 447void sa1111_disable_device(struct sa1111_dev *);
562 448
563unsigned int sa1111_pll_clock(struct sa1111_dev *); 449unsigned int sa1111_pll_clock(struct sa1111_dev *);
@@ -580,6 +466,10 @@ void sa1111_set_sleep_io(struct sa1111_dev *sadev, unsigned int bits, unsigned i
580 466
581struct sa1111_platform_data { 467struct sa1111_platform_data {
582 int irq_base; /* base for cascaded on-chip IRQs */ 468 int irq_base; /* base for cascaded on-chip IRQs */
469 unsigned disable_devs;
470 void *data;
471 int (*enable)(void *, unsigned);
472 void (*disable)(void *, unsigned);
583}; 473};
584 474
585#endif /* _ASM_ARCH_SA1111 */ 475#endif /* _ASM_ARCH_SA1111 */
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index 9275828feb3d..9af5563dd3eb 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -26,7 +26,6 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <asm/byteorder.h> 27#include <asm/byteorder.h>
28#include <asm/memory.h> 28#include <asm/memory.h>
29#include <asm/system.h>
30#include <asm-generic/pci_iomap.h> 29#include <asm-generic/pci_iomap.h>
31 30
32/* 31/*
@@ -83,6 +82,11 @@ extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, uns
83extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); 82extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
84extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached); 83extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
85extern void __iounmap(volatile void __iomem *addr); 84extern void __iounmap(volatile void __iomem *addr);
85extern void __arm_iounmap(volatile void __iomem *addr);
86
87extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
88 unsigned int, void *);
89extern void (*arch_iounmap)(volatile void __iomem *);
86 90
87/* 91/*
88 * Bad read/write accesses... 92 * Bad read/write accesses...
@@ -97,8 +101,11 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
97 return (void __iomem *)addr; 101 return (void __iomem *)addr;
98} 102}
99 103
104#define IOMEM(x) ((void __force __iomem *)(x))
105
100/* IO barriers */ 106/* IO barriers */
101#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE 107#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
108#include <asm/barrier.h>
102#define __iormb() rmb() 109#define __iormb() rmb()
103#define __iowmb() wmb() 110#define __iowmb() wmb()
104#else 111#else
@@ -109,7 +116,11 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
109/* 116/*
110 * Now, pick up the machine-defined IO definitions 117 * Now, pick up the machine-defined IO definitions
111 */ 118 */
119#ifdef CONFIG_NEED_MACH_IO_H
112#include <mach/io.h> 120#include <mach/io.h>
121#else
122#define __io(a) __typesafe_io((a) & IO_SPACE_LIMIT)
123#endif
113 124
114/* 125/*
115 * This is the limit of PC card/PCI/ISA IO space, which is by default 126 * This is the limit of PC card/PCI/ISA IO space, which is by default
@@ -211,18 +222,18 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
211 * Again, this are defined to perform little endian accesses. See the 222 * Again, this are defined to perform little endian accesses. See the
212 * IO port primitives for more information. 223 * IO port primitives for more information.
213 */ 224 */
214#ifdef __mem_pci 225#ifndef readl
215#define readb_relaxed(c) ({ u8 __r = __raw_readb(__mem_pci(c)); __r; }) 226#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; })
216#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \ 227#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
217 __raw_readw(__mem_pci(c))); __r; }) 228 __raw_readw(c)); __r; })
218#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \ 229#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
219 __raw_readl(__mem_pci(c))); __r; }) 230 __raw_readl(c)); __r; })
220 231
221#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c))) 232#define writeb_relaxed(v,c) ((void)__raw_writeb(v,c))
222#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \ 233#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
223 cpu_to_le16(v),__mem_pci(c))) 234 cpu_to_le16(v),c))
224#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \ 235#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
225 cpu_to_le32(v),__mem_pci(c))) 236 cpu_to_le32(v),c))
226 237
227#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) 238#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
228#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) 239#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
@@ -232,30 +243,19 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
232#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); }) 243#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
233#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); }) 244#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
234 245
235#define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l) 246#define readsb(p,d,l) __raw_readsb(p,d,l)
236#define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l) 247#define readsw(p,d,l) __raw_readsw(p,d,l)
237#define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l) 248#define readsl(p,d,l) __raw_readsl(p,d,l)
238
239#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
240#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
241#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
242 249
243#define memset_io(c,v,l) _memset_io(__mem_pci(c),(v),(l)) 250#define writesb(p,d,l) __raw_writesb(p,d,l)
244#define memcpy_fromio(a,c,l) _memcpy_fromio((a),__mem_pci(c),(l)) 251#define writesw(p,d,l) __raw_writesw(p,d,l)
245#define memcpy_toio(c,a,l) _memcpy_toio(__mem_pci(c),(a),(l)) 252#define writesl(p,d,l) __raw_writesl(p,d,l)
246 253
247#elif !defined(readb) 254#define memset_io(c,v,l) _memset_io(c,(v),(l))
255#define memcpy_fromio(a,c,l) _memcpy_fromio((a),c,(l))
256#define memcpy_toio(c,a,l) _memcpy_toio(c,(a),(l))
248 257
249#define readb(c) (__readwrite_bug("readb"),0) 258#endif /* readl */
250#define readw(c) (__readwrite_bug("readw"),0)
251#define readl(c) (__readwrite_bug("readl"),0)
252#define writeb(v,c) __readwrite_bug("writeb")
253#define writew(v,c) __readwrite_bug("writew")
254#define writel(v,c) __readwrite_bug("writel")
255
256#define check_signature(io,sig,len) (0)
257
258#endif /* __mem_pci */
259 259
260/* 260/*
261 * ioremap and friends. 261 * ioremap and friends.
@@ -264,16 +264,11 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
264 * Documentation/io-mapping.txt. 264 * Documentation/io-mapping.txt.
265 * 265 *
266 */ 266 */
267#ifndef __arch_ioremap 267#define ioremap(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE)
268#define __arch_ioremap __arm_ioremap 268#define ioremap_nocache(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE)
269#define __arch_iounmap __iounmap 269#define ioremap_cached(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_CACHED)
270#endif 270#define ioremap_wc(cookie,size) __arm_ioremap((cookie), (size), MT_DEVICE_WC)
271 271#define iounmap __arm_iounmap
272#define ioremap(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
273#define ioremap_nocache(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE)
274#define ioremap_cached(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_CACHED)
275#define ioremap_wc(cookie,size) __arch_ioremap((cookie), (size), MT_DEVICE_WC)
276#define iounmap __arch_iounmap
277 272
278/* 273/*
279 * io{read,write}{8,16,32} macros 274 * io{read,write}{8,16,32} macros
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 5a526afb5f18..35c21c375d81 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -1,14 +1,18 @@
1#ifndef __ASM_ARM_IRQ_H 1#ifndef __ASM_ARM_IRQ_H
2#define __ASM_ARM_IRQ_H 2#define __ASM_ARM_IRQ_H
3 3
4#define NR_IRQS_LEGACY 16
5
6#ifndef CONFIG_SPARSE_IRQ
4#include <mach/irqs.h> 7#include <mach/irqs.h>
8#else
9#define NR_IRQS NR_IRQS_LEGACY
10#endif
5 11
6#ifndef irq_canonicalize 12#ifndef irq_canonicalize
7#define irq_canonicalize(i) (i) 13#define irq_canonicalize(i) (i)
8#endif 14#endif
9 15
10#define NR_IRQS_LEGACY 16
11
12/* 16/*
13 * Use this value to indicate lack of interrupt 17 * Use this value to indicate lack of interrupt
14 * capability 18 * capability
diff --git a/arch/arm/include/asm/jump_label.h b/arch/arm/include/asm/jump_label.h
new file mode 100644
index 000000000000..5c5ca2ea62b0
--- /dev/null
+++ b/arch/arm/include/asm/jump_label.h
@@ -0,0 +1,41 @@
1#ifndef _ASM_ARM_JUMP_LABEL_H
2#define _ASM_ARM_JUMP_LABEL_H
3
4#ifdef __KERNEL__
5
6#include <linux/types.h>
7#include <asm/system.h>
8
9#define JUMP_LABEL_NOP_SIZE 4
10
11#ifdef CONFIG_THUMB2_KERNEL
12#define JUMP_LABEL_NOP "nop.w"
13#else
14#define JUMP_LABEL_NOP "nop"
15#endif
16
17static __always_inline bool arch_static_branch(struct jump_label_key *key)
18{
19 asm goto("1:\n\t"
20 JUMP_LABEL_NOP "\n\t"
21 ".pushsection __jump_table, \"aw\"\n\t"
22 ".word 1b, %l[l_yes], %c0\n\t"
23 ".popsection\n\t"
24 : : "i" (key) : : l_yes);
25
26 return false;
27l_yes:
28 return true;
29}
30
31#endif /* __KERNEL__ */
32
33typedef u32 jump_label_t;
34
35struct jump_entry {
36 jump_label_t code;
37 jump_label_t target;
38 jump_label_t key;
39};
40
41#endif
diff --git a/arch/arm/include/asm/mc146818rtc.h b/arch/arm/include/asm/mc146818rtc.h
index 6b884d2b0b69..e8567bb99dfc 100644
--- a/arch/arm/include/asm/mc146818rtc.h
+++ b/arch/arm/include/asm/mc146818rtc.h
@@ -5,7 +5,9 @@
5#define _ASM_MC146818RTC_H 5#define _ASM_MC146818RTC_H
6 6
7#include <linux/io.h> 7#include <linux/io.h>
8#include <mach/irqs.h> 8#include <linux/kernel.h>
9
10#define RTC_IRQ BUILD_BUG_ON(1)
9 11
10#ifndef RTC_PORT 12#ifndef RTC_PORT
11#define RTC_PORT(x) (0x70 + (x)) 13#define RTC_PORT(x) (0x70 + (x))
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index a8997d71084e..fcb575747e5e 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -116,6 +116,8 @@
116#define MODULES_END (END_MEM) 116#define MODULES_END (END_MEM)
117#define MODULES_VADDR (PHYS_OFFSET) 117#define MODULES_VADDR (PHYS_OFFSET)
118 118
119#define XIP_VIRT_ADDR(physaddr) (physaddr)
120
119#endif /* !CONFIG_MMU */ 121#endif /* !CONFIG_MMU */
120 122
121/* 123/*
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index 14965658a923..b8e580a297e4 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -34,4 +34,11 @@ typedef struct {
34 34
35#endif 35#endif
36 36
37/*
38 * switch_mm() may do a full cache flush over the context switch,
39 * so enable interrupts over the context switch to avoid high
40 * latency.
41 */
42#define __ARCH_WANT_INTERRUPTS_ON_CTXSW
43
37#endif 44#endif
diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
index 71605d9f8e42..a0b3cac0547c 100644
--- a/arch/arm/include/asm/mmu_context.h
+++ b/arch/arm/include/asm/mmu_context.h
@@ -18,6 +18,7 @@
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cachetype.h> 19#include <asm/cachetype.h>
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm-generic/mm_hooks.h>
21 22
22void __check_kvm_seq(struct mm_struct *mm); 23void __check_kvm_seq(struct mm_struct *mm);
23 24
@@ -133,32 +134,4 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
133#define deactivate_mm(tsk,mm) do { } while (0) 134#define deactivate_mm(tsk,mm) do { } while (0)
134#define activate_mm(prev,next) switch_mm(prev, next, NULL) 135#define activate_mm(prev,next) switch_mm(prev, next, NULL)
135 136
136/*
137 * We are inserting a "fake" vma for the user-accessible vector page so
138 * gdb and friends can get to it through ptrace and /proc/<pid>/mem.
139 * But we also want to remove it before the generic code gets to see it
140 * during process exit or the unmapping of it would cause total havoc.
141 * (the macro is used as remove_vma() is static to mm/mmap.c)
142 */
143#define arch_exit_mmap(mm) \
144do { \
145 struct vm_area_struct *high_vma = find_vma(mm, 0xffff0000); \
146 if (high_vma) { \
147 BUG_ON(high_vma->vm_next); /* it should be last */ \
148 if (high_vma->vm_prev) \
149 high_vma->vm_prev->vm_next = NULL; \
150 else \
151 mm->mmap = NULL; \
152 rb_erase(&high_vma->vm_rb, &mm->mm_rb); \
153 mm->mmap_cache = NULL; \
154 mm->map_count--; \
155 remove_vma(high_vma); \
156 } \
157} while (0)
158
159static inline void arch_dup_mmap(struct mm_struct *oldmm,
160 struct mm_struct *mm)
161{
162}
163
164#endif 137#endif
diff --git a/arch/arm/include/asm/opcodes.h b/arch/arm/include/asm/opcodes.h
index c0efdd60966f..19c48deda70f 100644
--- a/arch/arm/include/asm/opcodes.h
+++ b/arch/arm/include/asm/opcodes.h
@@ -17,4 +17,63 @@ extern asmlinkage unsigned int arm_check_condition(u32 opcode, u32 psr);
17#define ARM_OPCODE_CONDTEST_PASS 1 17#define ARM_OPCODE_CONDTEST_PASS 1
18#define ARM_OPCODE_CONDTEST_UNCOND 2 18#define ARM_OPCODE_CONDTEST_UNCOND 2
19 19
20
21/*
22 * Opcode byteswap helpers
23 *
24 * These macros help with converting instructions between a canonical integer
25 * format and in-memory representation, in an endianness-agnostic manner.
26 *
27 * __mem_to_opcode_*() convert from in-memory representation to canonical form.
28 * __opcode_to_mem_*() convert from canonical form to in-memory representation.
29 *
30 *
31 * Canonical instruction representation:
32 *
33 * ARM: 0xKKLLMMNN
34 * Thumb 16-bit: 0x0000KKLL, where KK < 0xE8
35 * Thumb 32-bit: 0xKKLLMMNN, where KK >= 0xE8
36 *
37 * There is no way to distinguish an ARM instruction in canonical representation
38 * from a Thumb instruction (just as these cannot be distinguished in memory).
39 * Where this distinction is important, it needs to be tracked separately.
40 *
41 * Note that values in the range 0x0000E800..0xE7FFFFFF intentionally do not
42 * represent any valid Thumb-2 instruction. For this range,
43 * __opcode_is_thumb32() and __opcode_is_thumb16() will both be false.
44 */
45
46#ifndef __ASSEMBLY__
47
48#include <linux/types.h>
49#include <linux/swab.h>
50
51#ifdef CONFIG_CPU_ENDIAN_BE8
52#define __opcode_to_mem_arm(x) swab32(x)
53#define __opcode_to_mem_thumb16(x) swab16(x)
54#define __opcode_to_mem_thumb32(x) swahb32(x)
55#else
56#define __opcode_to_mem_arm(x) ((u32)(x))
57#define __opcode_to_mem_thumb16(x) ((u16)(x))
58#define __opcode_to_mem_thumb32(x) swahw32(x)
59#endif
60
61#define __mem_to_opcode_arm(x) __opcode_to_mem_arm(x)
62#define __mem_to_opcode_thumb16(x) __opcode_to_mem_thumb16(x)
63#define __mem_to_opcode_thumb32(x) __opcode_to_mem_thumb32(x)
64
65/* Operations specific to Thumb opcodes */
66
67/* Instruction size checks: */
68#define __opcode_is_thumb32(x) ((u32)(x) >= 0xE8000000UL)
69#define __opcode_is_thumb16(x) ((u32)(x) < 0xE800UL)
70
71/* Operations to construct or split 32-bit Thumb instructions: */
72#define __opcode_thumb32_first(x) ((u16)((x) >> 16))
73#define __opcode_thumb32_second(x) ((u16)(x))
74#define __opcode_thumb32_compose(first, second) \
75 (((u32)(u16)(first) << 16) | (u32)(u16)(second))
76
77#endif /* __ASSEMBLY__ */
78
20#endif /* __ASM_ARM_OPCODES_H */ 79#endif /* __ASM_ARM_OPCODES_H */
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index 97b440c25c58..5838361c48b3 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -151,6 +151,8 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
151#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 151#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
152extern void copy_page(void *to, const void *from); 152extern void copy_page(void *to, const void *from);
153 153
154#define __HAVE_ARCH_GATE_AREA 1
155
154#ifdef CONFIG_ARM_LPAE 156#ifdef CONFIG_ARM_LPAE
155#include <asm/pgtable-3level-types.h> 157#include <asm/pgtable-3level-types.h>
156#else 158#else
diff --git a/arch/arm/include/asm/perf_event.h b/arch/arm/include/asm/perf_event.h
index 7523340afb8a..00cbe10a50e3 100644
--- a/arch/arm/include/asm/perf_event.h
+++ b/arch/arm/include/asm/perf_event.h
@@ -22,6 +22,7 @@ enum arm_perf_pmu_ids {
22 ARM_PERF_PMU_ID_CA9, 22 ARM_PERF_PMU_ID_CA9,
23 ARM_PERF_PMU_ID_CA5, 23 ARM_PERF_PMU_ID_CA5,
24 ARM_PERF_PMU_ID_CA15, 24 ARM_PERF_PMU_ID_CA15,
25 ARM_PERF_PMU_ID_CA7,
25 ARM_NUM_PMU_IDS, 26 ARM_NUM_PMU_IDS,
26}; 27};
27 28
diff --git a/arch/arm/include/asm/posix_types.h b/arch/arm/include/asm/posix_types.h
index 2446d23bfdbf..efdf99045d87 100644
--- a/arch/arm/include/asm/posix_types.h
+++ b/arch/arm/include/asm/posix_types.h
@@ -19,59 +19,22 @@
19 * assume GCC is being used. 19 * assume GCC is being used.
20 */ 20 */
21 21
22typedef unsigned long __kernel_ino_t;
23typedef unsigned short __kernel_mode_t; 22typedef unsigned short __kernel_mode_t;
23#define __kernel_mode_t __kernel_mode_t
24
24typedef unsigned short __kernel_nlink_t; 25typedef unsigned short __kernel_nlink_t;
25typedef long __kernel_off_t; 26#define __kernel_nlink_t __kernel_nlink_t
26typedef int __kernel_pid_t; 27
27typedef unsigned short __kernel_ipc_pid_t; 28typedef unsigned short __kernel_ipc_pid_t;
29#define __kernel_ipc_pid_t __kernel_ipc_pid_t
30
28typedef unsigned short __kernel_uid_t; 31typedef unsigned short __kernel_uid_t;
29typedef unsigned short __kernel_gid_t; 32typedef unsigned short __kernel_gid_t;
30typedef unsigned int __kernel_size_t; 33#define __kernel_uid_t __kernel_uid_t
31typedef int __kernel_ssize_t;
32typedef int __kernel_ptrdiff_t;
33typedef long __kernel_time_t;
34typedef long __kernel_suseconds_t;
35typedef long __kernel_clock_t;
36typedef int __kernel_timer_t;
37typedef int __kernel_clockid_t;
38typedef int __kernel_daddr_t;
39typedef char * __kernel_caddr_t;
40typedef unsigned short __kernel_uid16_t;
41typedef unsigned short __kernel_gid16_t;
42typedef unsigned int __kernel_uid32_t;
43typedef unsigned int __kernel_gid32_t;
44 34
45typedef unsigned short __kernel_old_uid_t;
46typedef unsigned short __kernel_old_gid_t;
47typedef unsigned short __kernel_old_dev_t; 35typedef unsigned short __kernel_old_dev_t;
36#define __kernel_old_dev_t __kernel_old_dev_t
48 37
49#ifdef __GNUC__ 38#include <asm-generic/posix_types.h>
50typedef long long __kernel_loff_t;
51#endif
52
53typedef struct {
54 int val[2];
55} __kernel_fsid_t;
56
57#if defined(__KERNEL__)
58
59#undef __FD_SET
60#define __FD_SET(fd, fdsetp) \
61 (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31)))
62
63#undef __FD_CLR
64#define __FD_CLR(fd, fdsetp) \
65 (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] &= ~(1<<((fd) & 31)))
66
67#undef __FD_ISSET
68#define __FD_ISSET(fd, fdsetp) \
69 ((((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] & (1<<((fd) & 31))) != 0)
70
71#undef __FD_ZERO
72#define __FD_ZERO(fdsetp) \
73 (memset (fdsetp, 0, sizeof (*(fd_set *)(fdsetp))))
74
75#endif
76 39
77#endif 40#endif
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index cb8d638924fd..5ac8d3d3e025 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -22,7 +22,6 @@
22#include <asm/hw_breakpoint.h> 22#include <asm/hw_breakpoint.h>
23#include <asm/ptrace.h> 23#include <asm/ptrace.h>
24#include <asm/types.h> 24#include <asm/types.h>
25#include <asm/system.h>
26 25
27#ifdef __KERNEL__ 26#ifdef __KERNEL__
28#define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \ 27#define STACK_TOP ((current->personality & ADDR_LIMIT_32BIT) ? \
@@ -56,7 +55,6 @@ struct thread_struct {
56#define start_thread(regs,pc,sp) \ 55#define start_thread(regs,pc,sp) \
57({ \ 56({ \
58 unsigned long *stack = (unsigned long *)sp; \ 57 unsigned long *stack = (unsigned long *)sp; \
59 set_fs(USER_DS); \
60 memset(regs->uregs, 0, sizeof(regs->uregs)); \ 58 memset(regs->uregs, 0, sizeof(regs->uregs)); \
61 if (current->personality & ADDR_LIMIT_32BIT) \ 59 if (current->personality & ADDR_LIMIT_32BIT) \
62 regs->ARM_cpsr = USR_MODE; \ 60 regs->ARM_cpsr = USR_MODE; \
@@ -90,6 +88,8 @@ unsigned long get_wchan(struct task_struct *p);
90#define cpu_relax() barrier() 88#define cpu_relax() barrier()
91#endif 89#endif
92 90
91void cpu_idle_wait(void);
92
93/* 93/*
94 * Create a new kernel thread 94 * Create a new kernel thread
95 */ 95 */
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index ee0363307918..aeae9c609df4 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -13,8 +13,6 @@
13 13
14#ifdef CONFIG_OF 14#ifdef CONFIG_OF
15 15
16#include <asm/irq.h>
17
18extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 16extern struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
19extern void arm_dt_memblock_reserve(void); 17extern void arm_dt_memblock_reserve(void);
20 18
diff --git a/arch/arm/include/asm/switch_to.h b/arch/arm/include/asm/switch_to.h
new file mode 100644
index 000000000000..fa09e6b49bf1
--- /dev/null
+++ b/arch/arm/include/asm/switch_to.h
@@ -0,0 +1,18 @@
1#ifndef __ASM_ARM_SWITCH_TO_H
2#define __ASM_ARM_SWITCH_TO_H
3
4#include <linux/thread_info.h>
5
6/*
7 * switch_to(prev, next) should switch from task `prev' to `next'
8 * `prev' will never be the same as `next'. schedule() itself
9 * contains the memory barrier to tell GCC not to cache `current'.
10 */
11extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
12
13#define switch_to(prev,next,last) \
14do { \
15 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
16} while (0)
17
18#endif /* __ASM_ARM_SWITCH_TO_H */
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 424aa458c487..74542c52f9be 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -1,544 +1,8 @@
1#ifndef __ASM_ARM_SYSTEM_H 1/* FILE TO BE DELETED. DO NOT ADD STUFF HERE! */
2#define __ASM_ARM_SYSTEM_H 2#include <asm/barrier.h>
3 3#include <asm/compiler.h>
4#ifdef __KERNEL__ 4#include <asm/cmpxchg.h>
5 5#include <asm/exec.h>
6#define CPU_ARCH_UNKNOWN 0 6#include <asm/switch_to.h>
7#define CPU_ARCH_ARMv3 1 7#include <asm/system_info.h>
8#define CPU_ARCH_ARMv4 2 8#include <asm/system_misc.h>
9#define CPU_ARCH_ARMv4T 3
10#define CPU_ARCH_ARMv5 4
11#define CPU_ARCH_ARMv5T 5
12#define CPU_ARCH_ARMv5TE 6
13#define CPU_ARCH_ARMv5TEJ 7
14#define CPU_ARCH_ARMv6 8
15#define CPU_ARCH_ARMv7 9
16
17/*
18 * CR1 bits (CP#15 CR1)
19 */
20#define CR_M (1 << 0) /* MMU enable */
21#define CR_A (1 << 1) /* Alignment abort enable */
22#define CR_C (1 << 2) /* Dcache enable */
23#define CR_W (1 << 3) /* Write buffer enable */
24#define CR_P (1 << 4) /* 32-bit exception handler */
25#define CR_D (1 << 5) /* 32-bit data address range */
26#define CR_L (1 << 6) /* Implementation defined */
27#define CR_B (1 << 7) /* Big endian */
28#define CR_S (1 << 8) /* System MMU protection */
29#define CR_R (1 << 9) /* ROM MMU protection */
30#define CR_F (1 << 10) /* Implementation defined */
31#define CR_Z (1 << 11) /* Implementation defined */
32#define CR_I (1 << 12) /* Icache enable */
33#define CR_V (1 << 13) /* Vectors relocated to 0xffff0000 */
34#define CR_RR (1 << 14) /* Round Robin cache replacement */
35#define CR_L4 (1 << 15) /* LDR pc can set T bit */
36#define CR_DT (1 << 16)
37#define CR_IT (1 << 18)
38#define CR_ST (1 << 19)
39#define CR_FI (1 << 21) /* Fast interrupt (lower latency mode) */
40#define CR_U (1 << 22) /* Unaligned access operation */
41#define CR_XP (1 << 23) /* Extended page tables */
42#define CR_VE (1 << 24) /* Vectored interrupts */
43#define CR_EE (1 << 25) /* Exception (Big) Endian */
44#define CR_TRE (1 << 28) /* TEX remap enable */
45#define CR_AFE (1 << 29) /* Access flag enable */
46#define CR_TE (1 << 30) /* Thumb exception enable */
47
48/*
49 * This is used to ensure the compiler did actually allocate the register we
50 * asked it for some inline assembly sequences. Apparently we can't trust
51 * the compiler from one version to another so a bit of paranoia won't hurt.
52 * This string is meant to be concatenated with the inline asm string and
53 * will cause compilation to stop on mismatch.
54 * (for details, see gcc PR 15089)
55 */
56#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"
57
58#ifndef __ASSEMBLY__
59
60#include <linux/compiler.h>
61#include <linux/linkage.h>
62#include <linux/irqflags.h>
63
64#include <asm/outercache.h>
65
66struct thread_info;
67struct task_struct;
68
69/* information about the system we're running on */
70extern unsigned int system_rev;
71extern unsigned int system_serial_low;
72extern unsigned int system_serial_high;
73extern unsigned int mem_fclk_21285;
74
75struct pt_regs;
76
77void die(const char *msg, struct pt_regs *regs, int err);
78
79struct siginfo;
80void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
81 unsigned long err, unsigned long trap);
82
83#ifdef CONFIG_ARM_LPAE
84#define FAULT_CODE_ALIGNMENT 33
85#define FAULT_CODE_DEBUG 34
86#else
87#define FAULT_CODE_ALIGNMENT 1
88#define FAULT_CODE_DEBUG 2
89#endif
90
91void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
92 struct pt_regs *),
93 int sig, int code, const char *name);
94
95void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
96 struct pt_regs *),
97 int sig, int code, const char *name);
98
99#define xchg(ptr,x) \
100 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
101
102extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
103
104struct mm_struct;
105extern void show_pte(struct mm_struct *mm, unsigned long addr);
106extern void __show_regs(struct pt_regs *);
107
108extern int __pure cpu_architecture(void);
109extern void cpu_init(void);
110
111void soft_restart(unsigned long);
112extern void (*arm_pm_restart)(char str, const char *cmd);
113extern void (*arm_pm_idle)(void);
114
115#define UDBG_UNDEFINED (1 << 0)
116#define UDBG_SYSCALL (1 << 1)
117#define UDBG_BADABORT (1 << 2)
118#define UDBG_SEGV (1 << 3)
119#define UDBG_BUS (1 << 4)
120
121extern unsigned int user_debug;
122
123#if __LINUX_ARM_ARCH__ >= 4
124#define vectors_high() (cr_alignment & CR_V)
125#else
126#define vectors_high() (0)
127#endif
128
129#if __LINUX_ARM_ARCH__ >= 7 || \
130 (__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
131#define sev() __asm__ __volatile__ ("sev" : : : "memory")
132#define wfe() __asm__ __volatile__ ("wfe" : : : "memory")
133#define wfi() __asm__ __volatile__ ("wfi" : : : "memory")
134#endif
135
136#if __LINUX_ARM_ARCH__ >= 7
137#define isb() __asm__ __volatile__ ("isb" : : : "memory")
138#define dsb() __asm__ __volatile__ ("dsb" : : : "memory")
139#define dmb() __asm__ __volatile__ ("dmb" : : : "memory")
140#elif defined(CONFIG_CPU_XSC3) || __LINUX_ARM_ARCH__ == 6
141#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
142 : : "r" (0) : "memory")
143#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
144 : : "r" (0) : "memory")
145#define dmb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" \
146 : : "r" (0) : "memory")
147#elif defined(CONFIG_CPU_FA526)
148#define isb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" \
149 : : "r" (0) : "memory")
150#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
151 : : "r" (0) : "memory")
152#define dmb() __asm__ __volatile__ ("" : : : "memory")
153#else
154#define isb() __asm__ __volatile__ ("" : : : "memory")
155#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \
156 : : "r" (0) : "memory")
157#define dmb() __asm__ __volatile__ ("" : : : "memory")
158#endif
159
160#ifdef CONFIG_ARCH_HAS_BARRIERS
161#include <mach/barriers.h>
162#elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP)
163#define mb() do { dsb(); outer_sync(); } while (0)
164#define rmb() dsb()
165#define wmb() mb()
166#else
167#include <asm/memory.h>
168#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
169#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
170#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
171#endif
172
173#ifndef CONFIG_SMP
174#define smp_mb() barrier()
175#define smp_rmb() barrier()
176#define smp_wmb() barrier()
177#else
178#define smp_mb() dmb()
179#define smp_rmb() dmb()
180#define smp_wmb() dmb()
181#endif
182
183#define read_barrier_depends() do { } while(0)
184#define smp_read_barrier_depends() do { } while(0)
185
186#define set_mb(var, value) do { var = value; smp_mb(); } while (0)
187#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
188
189extern unsigned long cr_no_alignment; /* defined in entry-armv.S */
190extern unsigned long cr_alignment; /* defined in entry-armv.S */
191
192static inline unsigned int get_cr(void)
193{
194 unsigned int val;
195 asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
196 return val;
197}
198
199static inline void set_cr(unsigned int val)
200{
201 asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
202 : : "r" (val) : "cc");
203 isb();
204}
205
206#ifndef CONFIG_SMP
207extern void adjust_cr(unsigned long mask, unsigned long set);
208#endif
209
210#define CPACC_FULL(n) (3 << (n * 2))
211#define CPACC_SVC(n) (1 << (n * 2))
212#define CPACC_DISABLE(n) (0 << (n * 2))
213
214static inline unsigned int get_copro_access(void)
215{
216 unsigned int val;
217 asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
218 : "=r" (val) : : "cc");
219 return val;
220}
221
222static inline void set_copro_access(unsigned int val)
223{
224 asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
225 : : "r" (val) : "cc");
226 isb();
227}
228
229/*
230 * switch_mm() may do a full cache flush over the context switch,
231 * so enable interrupts over the context switch to avoid high
232 * latency.
233 */
234#define __ARCH_WANT_INTERRUPTS_ON_CTXSW
235
236/*
237 * switch_to(prev, next) should switch from task `prev' to `next'
238 * `prev' will never be the same as `next'. schedule() itself
239 * contains the memory barrier to tell GCC not to cache `current'.
240 */
241extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
242
243#define switch_to(prev,next,last) \
244do { \
245 last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
246} while (0)
247
248#if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
249/*
250 * On the StrongARM, "swp" is terminally broken since it bypasses the
251 * cache totally. This means that the cache becomes inconsistent, and,
252 * since we use normal loads/stores as well, this is really bad.
253 * Typically, this causes oopsen in filp_close, but could have other,
254 * more disastrous effects. There are two work-arounds:
255 * 1. Disable interrupts and emulate the atomic swap
256 * 2. Clean the cache, perform atomic swap, flush the cache
257 *
258 * We choose (1) since its the "easiest" to achieve here and is not
259 * dependent on the processor type.
260 *
261 * NOTE that this solution won't work on an SMP system, so explcitly
262 * forbid it here.
263 */
264#define swp_is_buggy
265#endif
266
267static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
268{
269 extern void __bad_xchg(volatile void *, int);
270 unsigned long ret;
271#ifdef swp_is_buggy
272 unsigned long flags;
273#endif
274#if __LINUX_ARM_ARCH__ >= 6
275 unsigned int tmp;
276#endif
277
278 smp_mb();
279
280 switch (size) {
281#if __LINUX_ARM_ARCH__ >= 6
282 case 1:
283 asm volatile("@ __xchg1\n"
284 "1: ldrexb %0, [%3]\n"
285 " strexb %1, %2, [%3]\n"
286 " teq %1, #0\n"
287 " bne 1b"
288 : "=&r" (ret), "=&r" (tmp)
289 : "r" (x), "r" (ptr)
290 : "memory", "cc");
291 break;
292 case 4:
293 asm volatile("@ __xchg4\n"
294 "1: ldrex %0, [%3]\n"
295 " strex %1, %2, [%3]\n"
296 " teq %1, #0\n"
297 " bne 1b"
298 : "=&r" (ret), "=&r" (tmp)
299 : "r" (x), "r" (ptr)
300 : "memory", "cc");
301 break;
302#elif defined(swp_is_buggy)
303#ifdef CONFIG_SMP
304#error SMP is not supported on this platform
305#endif
306 case 1:
307 raw_local_irq_save(flags);
308 ret = *(volatile unsigned char *)ptr;
309 *(volatile unsigned char *)ptr = x;
310 raw_local_irq_restore(flags);
311 break;
312
313 case 4:
314 raw_local_irq_save(flags);
315 ret = *(volatile unsigned long *)ptr;
316 *(volatile unsigned long *)ptr = x;
317 raw_local_irq_restore(flags);
318 break;
319#else
320 case 1:
321 asm volatile("@ __xchg1\n"
322 " swpb %0, %1, [%2]"
323 : "=&r" (ret)
324 : "r" (x), "r" (ptr)
325 : "memory", "cc");
326 break;
327 case 4:
328 asm volatile("@ __xchg4\n"
329 " swp %0, %1, [%2]"
330 : "=&r" (ret)
331 : "r" (x), "r" (ptr)
332 : "memory", "cc");
333 break;
334#endif
335 default:
336 __bad_xchg(ptr, size), ret = 0;
337 break;
338 }
339 smp_mb();
340
341 return ret;
342}
343
344extern void disable_hlt(void);
345extern void enable_hlt(void);
346
347void cpu_idle_wait(void);
348
349#include <asm-generic/cmpxchg-local.h>
350
351#if __LINUX_ARM_ARCH__ < 6
352/* min ARCH < ARMv6 */
353
354#ifdef CONFIG_SMP
355#error "SMP is not supported on this platform"
356#endif
357
358/*
359 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
360 * them available.
361 */
362#define cmpxchg_local(ptr, o, n) \
363 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
364 (unsigned long)(n), sizeof(*(ptr))))
365#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
366
367#ifndef CONFIG_SMP
368#include <asm-generic/cmpxchg.h>
369#endif
370
371#else /* min ARCH >= ARMv6 */
372
373extern void __bad_cmpxchg(volatile void *ptr, int size);
374
375/*
376 * cmpxchg only support 32-bits operands on ARMv6.
377 */
378
379static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
380 unsigned long new, int size)
381{
382 unsigned long oldval, res;
383
384 switch (size) {
385#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
386 case 1:
387 do {
388 asm volatile("@ __cmpxchg1\n"
389 " ldrexb %1, [%2]\n"
390 " mov %0, #0\n"
391 " teq %1, %3\n"
392 " strexbeq %0, %4, [%2]\n"
393 : "=&r" (res), "=&r" (oldval)
394 : "r" (ptr), "Ir" (old), "r" (new)
395 : "memory", "cc");
396 } while (res);
397 break;
398 case 2:
399 do {
400 asm volatile("@ __cmpxchg1\n"
401 " ldrexh %1, [%2]\n"
402 " mov %0, #0\n"
403 " teq %1, %3\n"
404 " strexheq %0, %4, [%2]\n"
405 : "=&r" (res), "=&r" (oldval)
406 : "r" (ptr), "Ir" (old), "r" (new)
407 : "memory", "cc");
408 } while (res);
409 break;
410#endif
411 case 4:
412 do {
413 asm volatile("@ __cmpxchg4\n"
414 " ldrex %1, [%2]\n"
415 " mov %0, #0\n"
416 " teq %1, %3\n"
417 " strexeq %0, %4, [%2]\n"
418 : "=&r" (res), "=&r" (oldval)
419 : "r" (ptr), "Ir" (old), "r" (new)
420 : "memory", "cc");
421 } while (res);
422 break;
423 default:
424 __bad_cmpxchg(ptr, size);
425 oldval = 0;
426 }
427
428 return oldval;
429}
430
431static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
432 unsigned long new, int size)
433{
434 unsigned long ret;
435
436 smp_mb();
437 ret = __cmpxchg(ptr, old, new, size);
438 smp_mb();
439
440 return ret;
441}
442
443#define cmpxchg(ptr,o,n) \
444 ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \
445 (unsigned long)(o), \
446 (unsigned long)(n), \
447 sizeof(*(ptr))))
448
449static inline unsigned long __cmpxchg_local(volatile void *ptr,
450 unsigned long old,
451 unsigned long new, int size)
452{
453 unsigned long ret;
454
455 switch (size) {
456#ifdef CONFIG_CPU_V6 /* min ARCH == ARMv6 */
457 case 1:
458 case 2:
459 ret = __cmpxchg_local_generic(ptr, old, new, size);
460 break;
461#endif
462 default:
463 ret = __cmpxchg(ptr, old, new, size);
464 }
465
466 return ret;
467}
468
469#define cmpxchg_local(ptr,o,n) \
470 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), \
471 (unsigned long)(o), \
472 (unsigned long)(n), \
473 sizeof(*(ptr))))
474
475#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
476
477/*
478 * Note : ARMv7-M (currently unsupported by Linux) does not support
479 * ldrexd/strexd. If ARMv7-M is ever supported by the Linux kernel, it should
480 * not be allowed to use __cmpxchg64.
481 */
482static inline unsigned long long __cmpxchg64(volatile void *ptr,
483 unsigned long long old,
484 unsigned long long new)
485{
486 register unsigned long long oldval asm("r0");
487 register unsigned long long __old asm("r2") = old;
488 register unsigned long long __new asm("r4") = new;
489 unsigned long res;
490
491 do {
492 asm volatile(
493 " @ __cmpxchg8\n"
494 " ldrexd %1, %H1, [%2]\n"
495 " mov %0, #0\n"
496 " teq %1, %3\n"
497 " teqeq %H1, %H3\n"
498 " strexdeq %0, %4, %H4, [%2]\n"
499 : "=&r" (res), "=&r" (oldval)
500 : "r" (ptr), "Ir" (__old), "r" (__new)
501 : "memory", "cc");
502 } while (res);
503
504 return oldval;
505}
506
507static inline unsigned long long __cmpxchg64_mb(volatile void *ptr,
508 unsigned long long old,
509 unsigned long long new)
510{
511 unsigned long long ret;
512
513 smp_mb();
514 ret = __cmpxchg64(ptr, old, new);
515 smp_mb();
516
517 return ret;
518}
519
520#define cmpxchg64(ptr,o,n) \
521 ((__typeof__(*(ptr)))__cmpxchg64_mb((ptr), \
522 (unsigned long long)(o), \
523 (unsigned long long)(n)))
524
525#define cmpxchg64_local(ptr,o,n) \
526 ((__typeof__(*(ptr)))__cmpxchg64((ptr), \
527 (unsigned long long)(o), \
528 (unsigned long long)(n)))
529
530#else /* min ARCH = ARMv6 */
531
532#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
533
534#endif
535
536#endif /* __LINUX_ARM_ARCH__ >= 6 */
537
538#endif /* __ASSEMBLY__ */
539
540#define arch_align_stack(x) (x)
541
542#endif /* __KERNEL__ */
543
544#endif
diff --git a/arch/arm/include/asm/system_info.h b/arch/arm/include/asm/system_info.h
new file mode 100644
index 000000000000..dfd386d0c022
--- /dev/null
+++ b/arch/arm/include/asm/system_info.h
@@ -0,0 +1,27 @@
1#ifndef __ASM_ARM_SYSTEM_INFO_H
2#define __ASM_ARM_SYSTEM_INFO_H
3
4#define CPU_ARCH_UNKNOWN 0
5#define CPU_ARCH_ARMv3 1
6#define CPU_ARCH_ARMv4 2
7#define CPU_ARCH_ARMv4T 3
8#define CPU_ARCH_ARMv5 4
9#define CPU_ARCH_ARMv5T 5
10#define CPU_ARCH_ARMv5TE 6
11#define CPU_ARCH_ARMv5TEJ 7
12#define CPU_ARCH_ARMv6 8
13#define CPU_ARCH_ARMv7 9
14
15#ifndef __ASSEMBLY__
16
17/* information about the system we're running on */
18extern unsigned int system_rev;
19extern unsigned int system_serial_low;
20extern unsigned int system_serial_high;
21extern unsigned int mem_fclk_21285;
22
23extern int __pure cpu_architecture(void);
24
25#endif /* !__ASSEMBLY__ */
26
27#endif /* __ASM_ARM_SYSTEM_INFO_H */
diff --git a/arch/arm/include/asm/system_misc.h b/arch/arm/include/asm/system_misc.h
new file mode 100644
index 000000000000..5a85f148b607
--- /dev/null
+++ b/arch/arm/include/asm/system_misc.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_ARM_SYSTEM_MISC_H
2#define __ASM_ARM_SYSTEM_MISC_H
3
4#ifndef __ASSEMBLY__
5
6#include <linux/compiler.h>
7#include <linux/linkage.h>
8#include <linux/irqflags.h>
9
10extern void cpu_init(void);
11
12void soft_restart(unsigned long);
13extern void (*arm_pm_restart)(char str, const char *cmd);
14extern void (*arm_pm_idle)(void);
15
16#define UDBG_UNDEFINED (1 << 0)
17#define UDBG_SYSCALL (1 << 1)
18#define UDBG_BADABORT (1 << 2)
19#define UDBG_SEGV (1 << 3)
20#define UDBG_BUS (1 << 4)
21
22extern unsigned int user_debug;
23
24extern void disable_hlt(void);
25extern void enable_hlt(void);
26
27#endif /* !__ASSEMBLY__ */
28
29#endif /* __ASM_ARM_SYSTEM_MISC_H */
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 02b2f8203982..85fe61e73202 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -318,6 +318,21 @@ extern struct cpu_tlb_fns cpu_tlb;
318 318
319#define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f))) 319#define tlb_flag(f) ((always_tlb_flags & (f)) || (__tlb_flag & possible_tlb_flags & (f)))
320 320
321#define __tlb_op(f, insnarg, arg) \
322 do { \
323 if (always_tlb_flags & (f)) \
324 asm("mcr " insnarg \
325 : : "r" (arg) : "cc"); \
326 else if (possible_tlb_flags & (f)) \
327 asm("tst %1, %2\n\t" \
328 "mcrne " insnarg \
329 : : "r" (arg), "r" (__tlb_flag), "Ir" (f) \
330 : "cc"); \
331 } while (0)
332
333#define tlb_op(f, regs, arg) __tlb_op(f, "p15, 0, %0, " regs, arg)
334#define tlb_l2_op(f, regs, arg) __tlb_op(f, "p15, 1, %0, " regs, arg)
335
321static inline void local_flush_tlb_all(void) 336static inline void local_flush_tlb_all(void)
322{ 337{
323 const int zero = 0; 338 const int zero = 0;
@@ -326,16 +341,11 @@ static inline void local_flush_tlb_all(void)
326 if (tlb_flag(TLB_WB)) 341 if (tlb_flag(TLB_WB))
327 dsb(); 342 dsb();
328 343
329 if (tlb_flag(TLB_V3_FULL)) 344 tlb_op(TLB_V3_FULL, "c6, c0, 0", zero);
330 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc"); 345 tlb_op(TLB_V4_U_FULL | TLB_V6_U_FULL, "c8, c7, 0", zero);
331 if (tlb_flag(TLB_V4_U_FULL | TLB_V6_U_FULL)) 346 tlb_op(TLB_V4_D_FULL | TLB_V6_D_FULL, "c8, c6, 0", zero);
332 asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc"); 347 tlb_op(TLB_V4_I_FULL | TLB_V6_I_FULL, "c8, c5, 0", zero);
333 if (tlb_flag(TLB_V4_D_FULL | TLB_V6_D_FULL)) 348 tlb_op(TLB_V7_UIS_FULL, "c8, c3, 0", zero);
334 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc");
335 if (tlb_flag(TLB_V4_I_FULL | TLB_V6_I_FULL))
336 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
337 if (tlb_flag(TLB_V7_UIS_FULL))
338 asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc");
339 349
340 if (tlb_flag(TLB_BARRIER)) { 350 if (tlb_flag(TLB_BARRIER)) {
341 dsb(); 351 dsb();
@@ -352,29 +362,23 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
352 if (tlb_flag(TLB_WB)) 362 if (tlb_flag(TLB_WB))
353 dsb(); 363 dsb();
354 364
355 if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) { 365 if (possible_tlb_flags & (TLB_V3_FULL|TLB_V4_U_FULL|TLB_V4_D_FULL|TLB_V4_I_FULL)) {
356 if (tlb_flag(TLB_V3_FULL)) 366 if (cpumask_test_cpu(get_cpu(), mm_cpumask(mm))) {
357 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc"); 367 tlb_op(TLB_V3_FULL, "c6, c0, 0", zero);
358 if (tlb_flag(TLB_V4_U_FULL)) 368 tlb_op(TLB_V4_U_FULL, "c8, c7, 0", zero);
359 asm("mcr p15, 0, %0, c8, c7, 0" : : "r" (zero) : "cc"); 369 tlb_op(TLB_V4_D_FULL, "c8, c6, 0", zero);
360 if (tlb_flag(TLB_V4_D_FULL)) 370 tlb_op(TLB_V4_I_FULL, "c8, c5, 0", zero);
361 asm("mcr p15, 0, %0, c8, c6, 0" : : "r" (zero) : "cc"); 371 }
362 if (tlb_flag(TLB_V4_I_FULL)) 372 put_cpu();
363 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
364 } 373 }
365 put_cpu(); 374
366 375 tlb_op(TLB_V6_U_ASID, "c8, c7, 2", asid);
367 if (tlb_flag(TLB_V6_U_ASID)) 376 tlb_op(TLB_V6_D_ASID, "c8, c6, 2", asid);
368 asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc"); 377 tlb_op(TLB_V6_I_ASID, "c8, c5, 2", asid);
369 if (tlb_flag(TLB_V6_D_ASID))
370 asm("mcr p15, 0, %0, c8, c6, 2" : : "r" (asid) : "cc");
371 if (tlb_flag(TLB_V6_I_ASID))
372 asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc");
373 if (tlb_flag(TLB_V7_UIS_ASID))
374#ifdef CONFIG_ARM_ERRATA_720789 378#ifdef CONFIG_ARM_ERRATA_720789
375 asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc"); 379 tlb_op(TLB_V7_UIS_ASID, "c8, c3, 0", zero);
376#else 380#else
377 asm("mcr p15, 0, %0, c8, c3, 2" : : "r" (asid) : "cc"); 381 tlb_op(TLB_V7_UIS_ASID, "c8, c3, 2", asid);
378#endif 382#endif
379 383
380 if (tlb_flag(TLB_BARRIER)) 384 if (tlb_flag(TLB_BARRIER))
@@ -392,30 +396,23 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
392 if (tlb_flag(TLB_WB)) 396 if (tlb_flag(TLB_WB))
393 dsb(); 397 dsb();
394 398
395 if (cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) { 399 if (possible_tlb_flags & (TLB_V3_PAGE|TLB_V4_U_PAGE|TLB_V4_D_PAGE|TLB_V4_I_PAGE|TLB_V4_I_FULL) &&
396 if (tlb_flag(TLB_V3_PAGE)) 400 cpumask_test_cpu(smp_processor_id(), mm_cpumask(vma->vm_mm))) {
397 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (uaddr) : "cc"); 401 tlb_op(TLB_V3_PAGE, "c6, c0, 0", uaddr);
398 if (tlb_flag(TLB_V4_U_PAGE)) 402 tlb_op(TLB_V4_U_PAGE, "c8, c7, 1", uaddr);
399 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc"); 403 tlb_op(TLB_V4_D_PAGE, "c8, c6, 1", uaddr);
400 if (tlb_flag(TLB_V4_D_PAGE)) 404 tlb_op(TLB_V4_I_PAGE, "c8, c5, 1", uaddr);
401 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
402 if (tlb_flag(TLB_V4_I_PAGE))
403 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
404 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) 405 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
405 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); 406 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
406 } 407 }
407 408
408 if (tlb_flag(TLB_V6_U_PAGE)) 409 tlb_op(TLB_V6_U_PAGE, "c8, c7, 1", uaddr);
409 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (uaddr) : "cc"); 410 tlb_op(TLB_V6_D_PAGE, "c8, c6, 1", uaddr);
410 if (tlb_flag(TLB_V6_D_PAGE)) 411 tlb_op(TLB_V6_I_PAGE, "c8, c5, 1", uaddr);
411 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (uaddr) : "cc");
412 if (tlb_flag(TLB_V6_I_PAGE))
413 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
414 if (tlb_flag(TLB_V7_UIS_PAGE))
415#ifdef CONFIG_ARM_ERRATA_720789 412#ifdef CONFIG_ARM_ERRATA_720789
416 asm("mcr p15, 0, %0, c8, c3, 3" : : "r" (uaddr & PAGE_MASK) : "cc"); 413 tlb_op(TLB_V7_UIS_PAGE, "c8, c3, 3", uaddr & PAGE_MASK);
417#else 414#else
418 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (uaddr) : "cc"); 415 tlb_op(TLB_V7_UIS_PAGE, "c8, c3, 1", uaddr);
419#endif 416#endif
420 417
421 if (tlb_flag(TLB_BARRIER)) 418 if (tlb_flag(TLB_BARRIER))
@@ -432,25 +429,17 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
432 if (tlb_flag(TLB_WB)) 429 if (tlb_flag(TLB_WB))
433 dsb(); 430 dsb();
434 431
435 if (tlb_flag(TLB_V3_PAGE)) 432 tlb_op(TLB_V3_PAGE, "c6, c0, 0", kaddr);
436 asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (kaddr) : "cc"); 433 tlb_op(TLB_V4_U_PAGE, "c8, c7, 1", kaddr);
437 if (tlb_flag(TLB_V4_U_PAGE)) 434 tlb_op(TLB_V4_D_PAGE, "c8, c6, 1", kaddr);
438 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc"); 435 tlb_op(TLB_V4_I_PAGE, "c8, c5, 1", kaddr);
439 if (tlb_flag(TLB_V4_D_PAGE))
440 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc");
441 if (tlb_flag(TLB_V4_I_PAGE))
442 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
443 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL)) 436 if (!tlb_flag(TLB_V4_I_PAGE) && tlb_flag(TLB_V4_I_FULL))
444 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); 437 asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc");
445 438
446 if (tlb_flag(TLB_V6_U_PAGE)) 439 tlb_op(TLB_V6_U_PAGE, "c8, c7, 1", kaddr);
447 asm("mcr p15, 0, %0, c8, c7, 1" : : "r" (kaddr) : "cc"); 440 tlb_op(TLB_V6_D_PAGE, "c8, c6, 1", kaddr);
448 if (tlb_flag(TLB_V6_D_PAGE)) 441 tlb_op(TLB_V6_I_PAGE, "c8, c5, 1", kaddr);
449 asm("mcr p15, 0, %0, c8, c6, 1" : : "r" (kaddr) : "cc"); 442 tlb_op(TLB_V7_UIS_PAGE, "c8, c3, 1", kaddr);
450 if (tlb_flag(TLB_V6_I_PAGE))
451 asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (kaddr) : "cc");
452 if (tlb_flag(TLB_V7_UIS_PAGE))
453 asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (kaddr) : "cc");
454 443
455 if (tlb_flag(TLB_BARRIER)) { 444 if (tlb_flag(TLB_BARRIER)) {
456 dsb(); 445 dsb();
@@ -475,13 +464,8 @@ static inline void flush_pmd_entry(void *pmd)
475{ 464{
476 const unsigned int __tlb_flag = __cpu_tlb_flags; 465 const unsigned int __tlb_flag = __cpu_tlb_flags;
477 466
478 if (tlb_flag(TLB_DCLEAN)) 467 tlb_op(TLB_DCLEAN, "c7, c10, 1 @ flush_pmd", pmd);
479 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" 468 tlb_l2_op(TLB_L2CLEAN_FR, "c15, c9, 1 @ L2 flush_pmd", pmd);
480 : : "r" (pmd) : "cc");
481
482 if (tlb_flag(TLB_L2CLEAN_FR))
483 asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd"
484 : : "r" (pmd) : "cc");
485 469
486 if (tlb_flag(TLB_WB)) 470 if (tlb_flag(TLB_WB))
487 dsb(); 471 dsb();
@@ -491,15 +475,11 @@ static inline void clean_pmd_entry(void *pmd)
491{ 475{
492 const unsigned int __tlb_flag = __cpu_tlb_flags; 476 const unsigned int __tlb_flag = __cpu_tlb_flags;
493 477
494 if (tlb_flag(TLB_DCLEAN)) 478 tlb_op(TLB_DCLEAN, "c7, c10, 1 @ flush_pmd", pmd);
495 asm("mcr p15, 0, %0, c7, c10, 1 @ flush_pmd" 479 tlb_l2_op(TLB_L2CLEAN_FR, "c15, c9, 1 @ L2 flush_pmd", pmd);
496 : : "r" (pmd) : "cc");
497
498 if (tlb_flag(TLB_L2CLEAN_FR))
499 asm("mcr p15, 1, %0, c15, c9, 1 @ L2 flush_pmd"
500 : : "r" (pmd) : "cc");
501} 480}
502 481
482#undef tlb_op
503#undef tlb_flag 483#undef tlb_flag
504#undef always_tlb_flags 484#undef always_tlb_flags
505#undef possible_tlb_flags 485#undef possible_tlb_flags
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index 5b29a6673625..f555bb3664dc 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -46,7 +46,7 @@ static inline int in_exception_text(unsigned long ptr)
46 return in ? : __in_irqentry_text(ptr); 46 return in ? : __in_irqentry_text(ptr);
47} 47}
48 48
49extern void __init early_trap_init(void); 49extern void __init early_trap_init(void *);
50extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame); 50extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame);
51extern void ptrace_break(struct task_struct *tsk, struct pt_regs *regs); 51extern void ptrace_break(struct task_struct *tsk, struct pt_regs *regs);
52 52
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 2958976d867b..71f6536d17ac 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -16,8 +16,8 @@
16#include <asm/errno.h> 16#include <asm/errno.h>
17#include <asm/memory.h> 17#include <asm/memory.h>
18#include <asm/domain.h> 18#include <asm/domain.h>
19#include <asm/system.h>
20#include <asm/unified.h> 19#include <asm/unified.h>
20#include <asm/compiler.h>
21 21
22#define VERIFY_READ 0 22#define VERIFY_READ 0
23#define VERIFY_WRITE 1 23#define VERIFY_WRITE 1
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index f16d7652f34b..7b787d642af4 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -7,6 +7,8 @@ AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
7 7
8ifdef CONFIG_FUNCTION_TRACER 8ifdef CONFIG_FUNCTION_TRACER
9CFLAGS_REMOVE_ftrace.o = -pg 9CFLAGS_REMOVE_ftrace.o = -pg
10CFLAGS_REMOVE_insn.o = -pg
11CFLAGS_REMOVE_patch.o = -pg
10endif 12endif
11 13
12CFLAGS_REMOVE_return_address.o = -pg 14CFLAGS_REMOVE_return_address.o = -pg
@@ -14,30 +16,29 @@ CFLAGS_REMOVE_return_address.o = -pg
14# Object file lists. 16# Object file lists.
15 17
16obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \ 18obj-y := elf.o entry-armv.o entry-common.o irq.o opcodes.o \
17 process.o ptrace.o return_address.o setup.o signal.o \ 19 process.o ptrace.o return_address.o sched_clock.o \
18 sys_arm.o stacktrace.o time.o traps.o 20 setup.o signal.o stacktrace.o sys_arm.o time.o traps.o
19 21
20obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o 22obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
21 23
22obj-$(CONFIG_LEDS) += leds.o 24obj-$(CONFIG_LEDS) += leds.o
23obj-$(CONFIG_OC_ETM) += etm.o 25obj-$(CONFIG_OC_ETM) += etm.o
24 26obj-$(CONFIG_CPU_IDLE) += cpuidle.o
25obj-$(CONFIG_ISA_DMA_API) += dma.o 27obj-$(CONFIG_ISA_DMA_API) += dma.o
26obj-$(CONFIG_ARCH_ACORN) += ecard.o
27obj-$(CONFIG_FIQ) += fiq.o fiqasm.o 28obj-$(CONFIG_FIQ) += fiq.o fiqasm.o
28obj-$(CONFIG_MODULES) += armksyms.o module.o 29obj-$(CONFIG_MODULES) += armksyms.o module.o
29obj-$(CONFIG_ARTHUR) += arthur.o 30obj-$(CONFIG_ARTHUR) += arthur.o
30obj-$(CONFIG_ISA_DMA) += dma-isa.o 31obj-$(CONFIG_ISA_DMA) += dma-isa.o
31obj-$(CONFIG_PCI) += bios32.o isa.o 32obj-$(CONFIG_PCI) += bios32.o isa.o
32obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o 33obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
34obj-$(CONFIG_SMP) += smp.o smp_tlb.o 34obj-$(CONFIG_SMP) += smp.o smp_tlb.o
35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
36obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o 36obj-$(CONFIG_HAVE_ARM_TWD) += smp_twd.o
37obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o 37obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o
38obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o 38obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o
39obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o
39obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 40obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
40obj-$(CONFIG_KPROBES) += kprobes.o kprobes-common.o 41obj-$(CONFIG_KPROBES) += kprobes.o kprobes-common.o patch.o
41ifdef CONFIG_THUMB2_KERNEL 42ifdef CONFIG_THUMB2_KERNEL
42obj-$(CONFIG_KPROBES) += kprobes-thumb.o 43obj-$(CONFIG_KPROBES) += kprobes-thumb.o
43else 44else
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 5b0bce61eb69..b57c75e0b01f 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -18,7 +18,6 @@
18#include <linux/io.h> 18#include <linux/io.h>
19 19
20#include <asm/checksum.h> 20#include <asm/checksum.h>
21#include <asm/system.h>
22#include <asm/ftrace.h> 21#include <asm/ftrace.h>
23 22
24/* 23/*
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index 632df9a66f8c..ede5f7741c42 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -299,7 +299,6 @@ static inline int pdev_bad_for_parity(struct pci_dev *dev)
299 */ 299 */
300void pcibios_fixup_bus(struct pci_bus *bus) 300void pcibios_fixup_bus(struct pci_bus *bus)
301{ 301{
302 struct pci_sys_data *root = bus->sysdata;
303 struct pci_dev *dev; 302 struct pci_dev *dev;
304 u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK; 303 u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK;
305 304
diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c
new file mode 100644
index 000000000000..89545f6c8403
--- /dev/null
+++ b/arch/arm/kernel/cpuidle.c
@@ -0,0 +1,21 @@
1/*
2 * Copyright 2012 Linaro Ltd.
3 *
4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License
6 * Version 2 or later at the following locations:
7 *
8 * http://www.opensource.org/licenses/gpl-license.html
9 * http://www.gnu.org/copyleft/gpl.html
10 */
11
12#include <linux/cpuidle.h>
13#include <asm/proc-fns.h>
14
15int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
16 struct cpuidle_driver *drv, int index)
17{
18 cpu_do_idle();
19
20 return index;
21}
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index 204e2160cfcc..c45522c36787 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -10,6 +10,7 @@
10 * 32-bit debugging code 10 * 32-bit debugging code
11 */ 11 */
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/assembler.h>
13 14
14 .text 15 .text
15 16
@@ -100,7 +101,7 @@
100 101
101#endif /* CONFIG_CPU_V6 */ 102#endif /* CONFIG_CPU_V6 */
102 103
103#else 104#elif !defined(CONFIG_DEBUG_SEMIHOSTING)
104#include <mach/debug-macro.S> 105#include <mach/debug-macro.S>
105#endif /* CONFIG_DEBUG_ICEDCC */ 106#endif /* CONFIG_DEBUG_ICEDCC */
106 107
@@ -155,6 +156,8 @@ hexbuf: .space 16
155 156
156 .ltorg 157 .ltorg
157 158
159#ifndef CONFIG_DEBUG_SEMIHOSTING
160
158ENTRY(printascii) 161ENTRY(printascii)
159 addruart_current r3, r1, r2 162 addruart_current r3, r1, r2
160 b 2f 163 b 2f
@@ -177,3 +180,24 @@ ENTRY(printch)
177 mov r0, #0 180 mov r0, #0
178 b 1b 181 b 1b
179ENDPROC(printch) 182ENDPROC(printch)
183
184#else
185
186ENTRY(printascii)
187 mov r1, r0
188 mov r0, #0x04 @ SYS_WRITE0
189 ARM( svc #0x123456 )
190 THUMB( svc #0xab )
191 mov pc, lr
192ENDPROC(printascii)
193
194ENTRY(printch)
195 adr r1, hexbuf
196 strb r0, [r1]
197 mov r0, #0x03 @ SYS_WRITEC
198 ARM( svc #0x123456 )
199 THUMB( svc #0xab )
200 mov pc, lr
201ENDPROC(printch)
202
203#endif
diff --git a/arch/arm/kernel/elf.c b/arch/arm/kernel/elf.c
index ddba41d1fcf1..d0d1e83150c9 100644
--- a/arch/arm/kernel/elf.c
+++ b/arch/arm/kernel/elf.c
@@ -3,6 +3,7 @@
3#include <linux/personality.h> 3#include <linux/personality.h>
4#include <linux/binfmts.h> 4#include <linux/binfmts.h>
5#include <linux/elf.h> 5#include <linux/elf.h>
6#include <asm/system_info.h>
6 7
7int elf_check_arch(const struct elf32_hdr *x) 8int elf_check_arch(const struct elf32_hdr *x)
8{ 9{
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 22f0ed324f37..7fd3ad048da9 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -15,6 +15,7 @@
15 * that causes it to save wrong values... Be aware! 15 * that causes it to save wrong values... Be aware!
16 */ 16 */
17 17
18#include <asm/assembler.h>
18#include <asm/memory.h> 19#include <asm/memory.h>
19#include <asm/glue-df.h> 20#include <asm/glue-df.h>
20#include <asm/glue-pf.h> 21#include <asm/glue-pf.h>
@@ -26,7 +27,7 @@
26#include <asm/unwind.h> 27#include <asm/unwind.h>
27#include <asm/unistd.h> 28#include <asm/unistd.h>
28#include <asm/tls.h> 29#include <asm/tls.h>
29#include <asm/system.h> 30#include <asm/system_info.h>
30 31
31#include "entry-header.S" 32#include "entry-header.S"
32#include <asm/entry-macro-multi.S> 33#include <asm/entry-macro-multi.S>
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 4c164ece5891..c32f8456aa09 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -42,9 +42,9 @@
42#include <linux/seq_file.h> 42#include <linux/seq_file.h>
43 43
44#include <asm/cacheflush.h> 44#include <asm/cacheflush.h>
45#include <asm/cp15.h>
45#include <asm/fiq.h> 46#include <asm/fiq.h>
46#include <asm/irq.h> 47#include <asm/irq.h>
47#include <asm/system.h>
48#include <asm/traps.h> 48#include <asm/traps.h>
49 49
50static unsigned long no_fiq_insn; 50static unsigned long no_fiq_insn;
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index c0062ad1e847..df0bf0c8cb79 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -16,10 +16,13 @@
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17 17
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/opcodes.h>
19#include <asm/ftrace.h> 20#include <asm/ftrace.h>
20 21
22#include "insn.h"
23
21#ifdef CONFIG_THUMB2_KERNEL 24#ifdef CONFIG_THUMB2_KERNEL
22#define NOP 0xeb04f85d /* pop.w {lr} */ 25#define NOP 0xf85deb04 /* pop.w {lr} */
23#else 26#else
24#define NOP 0xe8bd4000 /* pop {lr} */ 27#define NOP 0xe8bd4000 /* pop {lr} */
25#endif 28#endif
@@ -60,76 +63,31 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
60} 63}
61#endif 64#endif
62 65
63#ifdef CONFIG_THUMB2_KERNEL
64static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
65 bool link)
66{
67 unsigned long s, j1, j2, i1, i2, imm10, imm11;
68 unsigned long first, second;
69 long offset;
70
71 offset = (long)addr - (long)(pc + 4);
72 if (offset < -16777216 || offset > 16777214) {
73 WARN_ON_ONCE(1);
74 return 0;
75 }
76
77 s = (offset >> 24) & 0x1;
78 i1 = (offset >> 23) & 0x1;
79 i2 = (offset >> 22) & 0x1;
80 imm10 = (offset >> 12) & 0x3ff;
81 imm11 = (offset >> 1) & 0x7ff;
82
83 j1 = (!i1) ^ s;
84 j2 = (!i2) ^ s;
85
86 first = 0xf000 | (s << 10) | imm10;
87 second = 0x9000 | (j1 << 13) | (j2 << 11) | imm11;
88 if (link)
89 second |= 1 << 14;
90
91 return (second << 16) | first;
92}
93#else
94static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
95 bool link)
96{
97 unsigned long opcode = 0xea000000;
98 long offset;
99
100 if (link)
101 opcode |= 1 << 24;
102
103 offset = (long)addr - (long)(pc + 8);
104 if (unlikely(offset < -33554432 || offset > 33554428)) {
105 /* Can't generate branches that far (from ARM ARM). Ftrace
106 * doesn't generate branches outside of kernel text.
107 */
108 WARN_ON_ONCE(1);
109 return 0;
110 }
111
112 offset = (offset >> 2) & 0x00ffffff;
113
114 return opcode | offset;
115}
116#endif
117
118static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr) 66static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
119{ 67{
120 return ftrace_gen_branch(pc, addr, true); 68 return arm_gen_branch_link(pc, addr);
121} 69}
122 70
123static int ftrace_modify_code(unsigned long pc, unsigned long old, 71static int ftrace_modify_code(unsigned long pc, unsigned long old,
124 unsigned long new) 72 unsigned long new, bool validate)
125{ 73{
126 unsigned long replaced; 74 unsigned long replaced;
127 75
128 if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE)) 76 if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
129 return -EFAULT; 77 old = __opcode_to_mem_thumb32(old);
78 new = __opcode_to_mem_thumb32(new);
79 } else {
80 old = __opcode_to_mem_arm(old);
81 new = __opcode_to_mem_arm(new);
82 }
130 83
131 if (replaced != old) 84 if (validate) {
132 return -EINVAL; 85 if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))
86 return -EFAULT;
87
88 if (replaced != old)
89 return -EINVAL;
90 }
133 91
134 if (probe_kernel_write((void *)pc, &new, MCOUNT_INSN_SIZE)) 92 if (probe_kernel_write((void *)pc, &new, MCOUNT_INSN_SIZE))
135 return -EPERM; 93 return -EPERM;
@@ -141,23 +99,21 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
141 99
142int ftrace_update_ftrace_func(ftrace_func_t func) 100int ftrace_update_ftrace_func(ftrace_func_t func)
143{ 101{
144 unsigned long pc, old; 102 unsigned long pc;
145 unsigned long new; 103 unsigned long new;
146 int ret; 104 int ret;
147 105
148 pc = (unsigned long)&ftrace_call; 106 pc = (unsigned long)&ftrace_call;
149 memcpy(&old, &ftrace_call, MCOUNT_INSN_SIZE);
150 new = ftrace_call_replace(pc, (unsigned long)func); 107 new = ftrace_call_replace(pc, (unsigned long)func);
151 108
152 ret = ftrace_modify_code(pc, old, new); 109 ret = ftrace_modify_code(pc, 0, new, false);
153 110
154#ifdef CONFIG_OLD_MCOUNT 111#ifdef CONFIG_OLD_MCOUNT
155 if (!ret) { 112 if (!ret) {
156 pc = (unsigned long)&ftrace_call_old; 113 pc = (unsigned long)&ftrace_call_old;
157 memcpy(&old, &ftrace_call_old, MCOUNT_INSN_SIZE);
158 new = ftrace_call_replace(pc, (unsigned long)func); 114 new = ftrace_call_replace(pc, (unsigned long)func);
159 115
160 ret = ftrace_modify_code(pc, old, new); 116 ret = ftrace_modify_code(pc, 0, new, false);
161 } 117 }
162#endif 118#endif
163 119
@@ -172,7 +128,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
172 old = ftrace_nop_replace(rec); 128 old = ftrace_nop_replace(rec);
173 new = ftrace_call_replace(ip, adjust_address(rec, addr)); 129 new = ftrace_call_replace(ip, adjust_address(rec, addr));
174 130
175 return ftrace_modify_code(rec->ip, old, new); 131 return ftrace_modify_code(rec->ip, old, new, true);
176} 132}
177 133
178int ftrace_make_nop(struct module *mod, 134int ftrace_make_nop(struct module *mod,
@@ -185,7 +141,7 @@ int ftrace_make_nop(struct module *mod,
185 141
186 old = ftrace_call_replace(ip, adjust_address(rec, addr)); 142 old = ftrace_call_replace(ip, adjust_address(rec, addr));
187 new = ftrace_nop_replace(rec); 143 new = ftrace_nop_replace(rec);
188 ret = ftrace_modify_code(ip, old, new); 144 ret = ftrace_modify_code(ip, old, new, true);
189 145
190#ifdef CONFIG_OLD_MCOUNT 146#ifdef CONFIG_OLD_MCOUNT
191 if (ret == -EINVAL && addr == MCOUNT_ADDR) { 147 if (ret == -EINVAL && addr == MCOUNT_ADDR) {
@@ -193,7 +149,7 @@ int ftrace_make_nop(struct module *mod,
193 149
194 old = ftrace_call_replace(ip, adjust_address(rec, addr)); 150 old = ftrace_call_replace(ip, adjust_address(rec, addr));
195 new = ftrace_nop_replace(rec); 151 new = ftrace_nop_replace(rec);
196 ret = ftrace_modify_code(ip, old, new); 152 ret = ftrace_modify_code(ip, old, new, true);
197 } 153 }
198#endif 154#endif
199 155
@@ -249,12 +205,12 @@ static int __ftrace_modify_caller(unsigned long *callsite,
249{ 205{
250 unsigned long caller_fn = (unsigned long) func; 206 unsigned long caller_fn = (unsigned long) func;
251 unsigned long pc = (unsigned long) callsite; 207 unsigned long pc = (unsigned long) callsite;
252 unsigned long branch = ftrace_gen_branch(pc, caller_fn, false); 208 unsigned long branch = arm_gen_branch(pc, caller_fn);
253 unsigned long nop = 0xe1a00000; /* mov r0, r0 */ 209 unsigned long nop = 0xe1a00000; /* mov r0, r0 */
254 unsigned long old = enable ? nop : branch; 210 unsigned long old = enable ? nop : branch;
255 unsigned long new = enable ? branch : nop; 211 unsigned long new = enable ? branch : nop;
256 212
257 return ftrace_modify_code(pc, old, new); 213 return ftrace_modify_code(pc, old, new, true);
258} 214}
259 215
260static int ftrace_modify_graph_caller(bool enable) 216static int ftrace_modify_graph_caller(bool enable)
diff --git a/arch/arm/kernel/head-nommu.S b/arch/arm/kernel/head-nommu.S
index d46f25968bec..278cfc144f44 100644
--- a/arch/arm/kernel/head-nommu.S
+++ b/arch/arm/kernel/head-nommu.S
@@ -17,8 +17,8 @@
17#include <asm/assembler.h> 17#include <asm/assembler.h>
18#include <asm/ptrace.h> 18#include <asm/ptrace.h>
19#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
20#include <asm/cp15.h>
20#include <asm/thread_info.h> 21#include <asm/thread_info.h>
21#include <asm/system.h>
22 22
23/* 23/*
24 * Kernel startup entry point. 24 * Kernel startup entry point.
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 6d5791144066..3bf0c7f8b043 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -15,12 +15,12 @@
15#include <linux/init.h> 15#include <linux/init.h>
16 16
17#include <asm/assembler.h> 17#include <asm/assembler.h>
18#include <asm/cp15.h>
18#include <asm/domain.h> 19#include <asm/domain.h>
19#include <asm/ptrace.h> 20#include <asm/ptrace.h>
20#include <asm/asm-offsets.h> 21#include <asm/asm-offsets.h>
21#include <asm/memory.h> 22#include <asm/memory.h>
22#include <asm/thread_info.h> 23#include <asm/thread_info.h>
23#include <asm/system.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25 25
26#ifdef CONFIG_DEBUG_LL 26#ifdef CONFIG_DEBUG_LL
@@ -265,7 +265,7 @@ __create_page_tables:
265 str r6, [r3] 265 str r6, [r3]
266 266
267#ifdef CONFIG_DEBUG_LL 267#ifdef CONFIG_DEBUG_LL
268#ifndef CONFIG_DEBUG_ICEDCC 268#if !defined(CONFIG_DEBUG_ICEDCC) && !defined(CONFIG_DEBUG_SEMIHOSTING)
269 /* 269 /*
270 * Map in IO space for serial debugging. 270 * Map in IO space for serial debugging.
271 * This allows debug messages to be output 271 * This allows debug messages to be output
@@ -297,10 +297,10 @@ __create_page_tables:
297 cmp r0, r6 297 cmp r0, r6
298 blo 1b 298 blo 1b
299 299
300#else /* CONFIG_DEBUG_ICEDCC */ 300#else /* CONFIG_DEBUG_ICEDCC || CONFIG_DEBUG_SEMIHOSTING */
301 /* we don't need any serial debugging mappings for ICEDCC */ 301 /* we don't need any serial debugging mappings */
302 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags 302 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
303#endif /* !CONFIG_DEBUG_ICEDCC */ 303#endif
304 304
305#if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS) 305#if defined(CONFIG_ARCH_NETWINDER) || defined(CONFIG_ARCH_CATS)
306 /* 306 /*
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index d6a95ef9131d..ba386bd94107 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -34,7 +34,6 @@
34#include <asm/current.h> 34#include <asm/current.h>
35#include <asm/hw_breakpoint.h> 35#include <asm/hw_breakpoint.h>
36#include <asm/kdebug.h> 36#include <asm/kdebug.h>
37#include <asm/system.h>
38#include <asm/traps.h> 37#include <asm/traps.h>
39 38
40/* Breakpoint currently in use for each BRP. */ 39/* Breakpoint currently in use for each BRP. */
diff --git a/arch/arm/kernel/insn.c b/arch/arm/kernel/insn.c
new file mode 100644
index 000000000000..b760340b7014
--- /dev/null
+++ b/arch/arm/kernel/insn.c
@@ -0,0 +1,62 @@
1#include <linux/bug.h>
2#include <linux/kernel.h>
3#include <asm/opcodes.h>
4
5static unsigned long
6__arm_gen_branch_thumb2(unsigned long pc, unsigned long addr, bool link)
7{
8 unsigned long s, j1, j2, i1, i2, imm10, imm11;
9 unsigned long first, second;
10 long offset;
11
12 offset = (long)addr - (long)(pc + 4);
13 if (offset < -16777216 || offset > 16777214) {
14 WARN_ON_ONCE(1);
15 return 0;
16 }
17
18 s = (offset >> 24) & 0x1;
19 i1 = (offset >> 23) & 0x1;
20 i2 = (offset >> 22) & 0x1;
21 imm10 = (offset >> 12) & 0x3ff;
22 imm11 = (offset >> 1) & 0x7ff;
23
24 j1 = (!i1) ^ s;
25 j2 = (!i2) ^ s;
26
27 first = 0xf000 | (s << 10) | imm10;
28 second = 0x9000 | (j1 << 13) | (j2 << 11) | imm11;
29 if (link)
30 second |= 1 << 14;
31
32 return __opcode_thumb32_compose(first, second);
33}
34
35static unsigned long
36__arm_gen_branch_arm(unsigned long pc, unsigned long addr, bool link)
37{
38 unsigned long opcode = 0xea000000;
39 long offset;
40
41 if (link)
42 opcode |= 1 << 24;
43
44 offset = (long)addr - (long)(pc + 8);
45 if (unlikely(offset < -33554432 || offset > 33554428)) {
46 WARN_ON_ONCE(1);
47 return 0;
48 }
49
50 offset = (offset >> 2) & 0x00ffffff;
51
52 return opcode | offset;
53}
54
55unsigned long
56__arm_gen_branch(unsigned long pc, unsigned long addr, bool link)
57{
58 if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
59 return __arm_gen_branch_thumb2(pc, addr, link);
60 else
61 return __arm_gen_branch_arm(pc, addr, link);
62}
diff --git a/arch/arm/kernel/insn.h b/arch/arm/kernel/insn.h
new file mode 100644
index 000000000000..e96065da4dae
--- /dev/null
+++ b/arch/arm/kernel/insn.h
@@ -0,0 +1,29 @@
1#ifndef __ASM_ARM_INSN_H
2#define __ASM_ARM_INSN_H
3
4static inline unsigned long
5arm_gen_nop(void)
6{
7#ifdef CONFIG_THUMB2_KERNEL
8 return 0xf3af8000; /* nop.w */
9#else
10 return 0xe1a00000; /* mov r0, r0 */
11#endif
12}
13
14unsigned long
15__arm_gen_branch(unsigned long pc, unsigned long addr, bool link);
16
17static inline unsigned long
18arm_gen_branch(unsigned long pc, unsigned long addr)
19{
20 return __arm_gen_branch(pc, addr, false);
21}
22
23static inline unsigned long
24arm_gen_branch_link(unsigned long pc, unsigned long addr)
25{
26 return __arm_gen_branch(pc, addr, true);
27}
28
29#endif
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 3efd82cc95f0..71ccdbfed662 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -36,7 +36,6 @@
36#include <linux/proc_fs.h> 36#include <linux/proc_fs.h>
37 37
38#include <asm/exception.h> 38#include <asm/exception.h>
39#include <asm/system.h>
40#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
41#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
42#include <asm/mach/time.h> 41#include <asm/mach/time.h>
@@ -181,10 +180,7 @@ void migrate_irqs(void)
181 local_irq_save(flags); 180 local_irq_save(flags);
182 181
183 for_each_irq_desc(i, desc) { 182 for_each_irq_desc(i, desc) {
184 bool affinity_broken = false; 183 bool affinity_broken;
185
186 if (!desc)
187 continue;
188 184
189 raw_spin_lock(&desc->lock); 185 raw_spin_lock(&desc->lock);
190 affinity_broken = migrate_one_irq(desc); 186 affinity_broken = migrate_one_irq(desc);
diff --git a/arch/arm/kernel/jump_label.c b/arch/arm/kernel/jump_label.c
new file mode 100644
index 000000000000..4ce4f789446d
--- /dev/null
+++ b/arch/arm/kernel/jump_label.c
@@ -0,0 +1,39 @@
1#include <linux/kernel.h>
2#include <linux/jump_label.h>
3
4#include "insn.h"
5#include "patch.h"
6
7#ifdef HAVE_JUMP_LABEL
8
9static void __arch_jump_label_transform(struct jump_entry *entry,
10 enum jump_label_type type,
11 bool is_static)
12{
13 void *addr = (void *)entry->code;
14 unsigned int insn;
15
16 if (type == JUMP_LABEL_ENABLE)
17 insn = arm_gen_branch(entry->code, entry->target);
18 else
19 insn = arm_gen_nop();
20
21 if (is_static)
22 __patch_text(addr, insn);
23 else
24 patch_text(addr, insn);
25}
26
27void arch_jump_label_transform(struct jump_entry *entry,
28 enum jump_label_type type)
29{
30 __arch_jump_label_transform(entry, type, false);
31}
32
33void arch_jump_label_transform_static(struct jump_entry *entry,
34 enum jump_label_type type)
35{
36 __arch_jump_label_transform(entry, type, true);
37}
38
39#endif
diff --git a/arch/arm/kernel/kprobes-common.c b/arch/arm/kernel/kprobes-common.c
index a5394fb4e4e0..18a76282970e 100644
--- a/arch/arm/kernel/kprobes-common.c
+++ b/arch/arm/kernel/kprobes-common.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/kprobes.h> 15#include <linux/kprobes.h>
16#include <asm/system_info.h>
16 17
17#include "kprobes.h" 18#include "kprobes.h"
18 19
diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c
index 129c1163248b..4dd41fc9e235 100644
--- a/arch/arm/kernel/kprobes.c
+++ b/arch/arm/kernel/kprobes.c
@@ -29,6 +29,7 @@
29#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
30 30
31#include "kprobes.h" 31#include "kprobes.h"
32#include "patch.h"
32 33
33#define MIN_STACK_SIZE(addr) \ 34#define MIN_STACK_SIZE(addr) \
34 min((unsigned long)MAX_STACK_SIZE, \ 35 min((unsigned long)MAX_STACK_SIZE, \
@@ -103,57 +104,33 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
103 return 0; 104 return 0;
104} 105}
105 106
106#ifdef CONFIG_THUMB2_KERNEL
107
108/*
109 * For a 32-bit Thumb breakpoint spanning two memory words we need to take
110 * special precautions to insert the breakpoint atomically, especially on SMP
111 * systems. This is achieved by calling this arming function using stop_machine.
112 */
113static int __kprobes set_t32_breakpoint(void *addr)
114{
115 ((u16 *)addr)[0] = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION >> 16;
116 ((u16 *)addr)[1] = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION & 0xffff;
117 flush_insns(addr, 2*sizeof(u16));
118 return 0;
119}
120
121void __kprobes arch_arm_kprobe(struct kprobe *p) 107void __kprobes arch_arm_kprobe(struct kprobe *p)
122{ 108{
123 uintptr_t addr = (uintptr_t)p->addr & ~1; /* Remove any Thumb flag */ 109 unsigned int brkp;
124 110 void *addr;
125 if (!is_wide_instruction(p->opcode)) { 111
126 *(u16 *)addr = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION; 112 if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
127 flush_insns(addr, sizeof(u16)); 113 /* Remove any Thumb flag */
128 } else if (addr & 2) { 114 addr = (void *)((uintptr_t)p->addr & ~1);
129 /* A 32-bit instruction spanning two words needs special care */ 115
130 stop_machine(set_t32_breakpoint, (void *)addr, &cpu_online_map); 116 if (is_wide_instruction(p->opcode))
117 brkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION;
118 else
119 brkp = KPROBE_THUMB16_BREAKPOINT_INSTRUCTION;
131 } else { 120 } else {
132 /* Word aligned 32-bit instruction can be written atomically */ 121 kprobe_opcode_t insn = p->opcode;
133 u32 bkp = KPROBE_THUMB32_BREAKPOINT_INSTRUCTION;
134#ifndef __ARMEB__ /* Swap halfwords for little-endian */
135 bkp = (bkp >> 16) | (bkp << 16);
136#endif
137 *(u32 *)addr = bkp;
138 flush_insns(addr, sizeof(u32));
139 }
140}
141 122
142#else /* !CONFIG_THUMB2_KERNEL */ 123 addr = p->addr;
124 brkp = KPROBE_ARM_BREAKPOINT_INSTRUCTION;
143 125
144void __kprobes arch_arm_kprobe(struct kprobe *p) 126 if (insn >= 0xe0000000)
145{ 127 brkp |= 0xe0000000; /* Unconditional instruction */
146 kprobe_opcode_t insn = p->opcode; 128 else
147 kprobe_opcode_t brkp = KPROBE_ARM_BREAKPOINT_INSTRUCTION; 129 brkp |= insn & 0xf0000000; /* Copy condition from insn */
148 if (insn >= 0xe0000000) 130 }
149 brkp |= 0xe0000000; /* Unconditional instruction */
150 else
151 brkp |= insn & 0xf0000000; /* Copy condition from insn */
152 *p->addr = brkp;
153 flush_insns(p->addr, sizeof(p->addr[0]));
154}
155 131
156#endif /* !CONFIG_THUMB2_KERNEL */ 132 patch_text(addr, brkp);
133}
157 134
158/* 135/*
159 * The actual disarming is done here on each CPU and synchronized using 136 * The actual disarming is done here on each CPU and synchronized using
@@ -166,31 +143,16 @@ void __kprobes arch_arm_kprobe(struct kprobe *p)
166int __kprobes __arch_disarm_kprobe(void *p) 143int __kprobes __arch_disarm_kprobe(void *p)
167{ 144{
168 struct kprobe *kp = p; 145 struct kprobe *kp = p;
169#ifdef CONFIG_THUMB2_KERNEL 146 void *addr = (void *)((uintptr_t)kp->addr & ~1);
170 u16 *addr = (u16 *)((uintptr_t)kp->addr & ~1);
171 kprobe_opcode_t insn = kp->opcode;
172 unsigned int len;
173 147
174 if (is_wide_instruction(insn)) { 148 __patch_text(addr, kp->opcode);
175 ((u16 *)addr)[0] = insn>>16;
176 ((u16 *)addr)[1] = insn;
177 len = 2*sizeof(u16);
178 } else {
179 ((u16 *)addr)[0] = insn;
180 len = sizeof(u16);
181 }
182 flush_insns(addr, len);
183 149
184#else /* !CONFIG_THUMB2_KERNEL */
185 *kp->addr = kp->opcode;
186 flush_insns(kp->addr, sizeof(kp->addr[0]));
187#endif
188 return 0; 150 return 0;
189} 151}
190 152
191void __kprobes arch_disarm_kprobe(struct kprobe *p) 153void __kprobes arch_disarm_kprobe(struct kprobe *p)
192{ 154{
193 stop_machine(__arch_disarm_kprobe, p, &cpu_online_map); 155 stop_machine(__arch_disarm_kprobe, p, cpu_online_mask);
194} 156}
195 157
196void __kprobes arch_remove_kprobe(struct kprobe *p) 158void __kprobes arch_remove_kprobe(struct kprobe *p)
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 764bd456d84f..dfcdb9f7c126 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -7,12 +7,13 @@
7#include <linux/delay.h> 7#include <linux/delay.h>
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 <asm/pgtable.h> 11#include <asm/pgtable.h>
11#include <asm/pgalloc.h> 12#include <asm/pgalloc.h>
12#include <asm/mmu_context.h> 13#include <asm/mmu_context.h>
13#include <asm/cacheflush.h> 14#include <asm/cacheflush.h>
14#include <asm/mach-types.h> 15#include <asm/mach-types.h>
15#include <asm/system.h> 16#include <asm/system_misc.h>
16 17
17extern const unsigned char relocate_new_kernel[]; 18extern const unsigned char relocate_new_kernel[];
18extern const unsigned int relocate_new_kernel_size; 19extern const unsigned int relocate_new_kernel_size;
@@ -53,6 +54,29 @@ void machine_crash_nonpanic_core(void *unused)
53 cpu_relax(); 54 cpu_relax();
54} 55}
55 56
57static void machine_kexec_mask_interrupts(void)
58{
59 unsigned int i;
60 struct irq_desc *desc;
61
62 for_each_irq_desc(i, desc) {
63 struct irq_chip *chip;
64
65 chip = irq_desc_get_chip(desc);
66 if (!chip)
67 continue;
68
69 if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
70 chip->irq_eoi(&desc->irq_data);
71
72 if (chip->irq_mask)
73 chip->irq_mask(&desc->irq_data);
74
75 if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
76 chip->irq_disable(&desc->irq_data);
77 }
78}
79
56void machine_crash_shutdown(struct pt_regs *regs) 80void machine_crash_shutdown(struct pt_regs *regs)
57{ 81{
58 unsigned long msecs; 82 unsigned long msecs;
@@ -70,6 +94,7 @@ void machine_crash_shutdown(struct pt_regs *regs)
70 printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n"); 94 printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n");
71 95
72 crash_save_cpu(regs, smp_processor_id()); 96 crash_save_cpu(regs, smp_processor_id());
97 machine_kexec_mask_interrupts();
73 98
74 printk(KERN_INFO "Loading crashdump kernel...\n"); 99 printk(KERN_INFO "Loading crashdump kernel...\n");
75} 100}
diff --git a/arch/arm/kernel/patch.c b/arch/arm/kernel/patch.c
new file mode 100644
index 000000000000..07314af47733
--- /dev/null
+++ b/arch/arm/kernel/patch.c
@@ -0,0 +1,75 @@
1#include <linux/kernel.h>
2#include <linux/kprobes.h>
3#include <linux/stop_machine.h>
4
5#include <asm/cacheflush.h>
6#include <asm/smp_plat.h>
7#include <asm/opcodes.h>
8
9#include "patch.h"
10
11struct patch {
12 void *addr;
13 unsigned int insn;
14};
15
16void __kprobes __patch_text(void *addr, unsigned int insn)
17{
18 bool thumb2 = IS_ENABLED(CONFIG_THUMB2_KERNEL);
19 int size;
20
21 if (thumb2 && __opcode_is_thumb16(insn)) {
22 *(u16 *)addr = __opcode_to_mem_thumb16(insn);
23 size = sizeof(u16);
24 } else if (thumb2 && ((uintptr_t)addr & 2)) {
25 u16 first = __opcode_thumb32_first(insn);
26 u16 second = __opcode_thumb32_second(insn);
27 u16 *addrh = addr;
28
29 addrh[0] = __opcode_to_mem_thumb16(first);
30 addrh[1] = __opcode_to_mem_thumb16(second);
31
32 size = sizeof(u32);
33 } else {
34 if (thumb2)
35 insn = __opcode_to_mem_thumb32(insn);
36 else
37 insn = __opcode_to_mem_arm(insn);
38
39 *(u32 *)addr = insn;
40 size = sizeof(u32);
41 }
42
43 flush_icache_range((uintptr_t)(addr),
44 (uintptr_t)(addr) + size);
45}
46
47static int __kprobes patch_text_stop_machine(void *data)
48{
49 struct patch *patch = data;
50
51 __patch_text(patch->addr, patch->insn);
52
53 return 0;
54}
55
56void __kprobes patch_text(void *addr, unsigned int insn)
57{
58 struct patch patch = {
59 .addr = addr,
60 .insn = insn,
61 };
62
63 if (cache_ops_need_broadcast()) {
64 stop_machine(patch_text_stop_machine, &patch, cpu_online_mask);
65 } else {
66 bool straddles_word = IS_ENABLED(CONFIG_THUMB2_KERNEL)
67 && __opcode_is_thumb32(insn)
68 && ((uintptr_t)addr & 2);
69
70 if (straddles_word)
71 stop_machine(patch_text_stop_machine, &patch, NULL);
72 else
73 __patch_text(addr, insn);
74 }
75}
diff --git a/arch/arm/kernel/patch.h b/arch/arm/kernel/patch.h
new file mode 100644
index 000000000000..b4731f2dac38
--- /dev/null
+++ b/arch/arm/kernel/patch.h
@@ -0,0 +1,7 @@
1#ifndef _ARM_KERNEL_PATCH_H
2#define _ARM_KERNEL_PATCH_H
3
4void patch_text(void *addr, unsigned int insn);
5void __patch_text(void *addr, unsigned int insn);
6
7#endif
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 8a89d3b7626b..186c8cb982c5 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -738,6 +738,9 @@ init_hw_perf_events(void)
738 case 0xC0F0: /* Cortex-A15 */ 738 case 0xC0F0: /* Cortex-A15 */
739 cpu_pmu = armv7_a15_pmu_init(); 739 cpu_pmu = armv7_a15_pmu_init();
740 break; 740 break;
741 case 0xC070: /* Cortex-A7 */
742 cpu_pmu = armv7_a7_pmu_init();
743 break;
741 } 744 }
742 /* Intel CPUs [xscale]. */ 745 /* Intel CPUs [xscale]. */
743 } else if (0x69 == implementor) { 746 } else if (0x69 == implementor) {
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 4d7095af2ab3..00755d82e2f2 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -610,6 +610,130 @@ static const unsigned armv7_a15_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
610}; 610};
611 611
612/* 612/*
613 * Cortex-A7 HW events mapping
614 */
615static const unsigned armv7_a7_perf_map[PERF_COUNT_HW_MAX] = {
616 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
617 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV7_PERFCTR_INSTR_EXECUTED,
618 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
619 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
620 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
621 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
622 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_BUS_CYCLES,
623 [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = HW_OP_UNSUPPORTED,
624 [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = HW_OP_UNSUPPORTED,
625};
626
627static const unsigned armv7_a7_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
628 [PERF_COUNT_HW_CACHE_OP_MAX]
629 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
630 [C(L1D)] = {
631 /*
632 * The performance counters don't differentiate between read
633 * and write accesses/misses so this isn't strictly correct,
634 * but it's the best we can do. Writes and reads get
635 * combined.
636 */
637 [C(OP_READ)] = {
638 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
639 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
640 },
641 [C(OP_WRITE)] = {
642 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_DCACHE_ACCESS,
643 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_DCACHE_REFILL,
644 },
645 [C(OP_PREFETCH)] = {
646 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
647 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
648 },
649 },
650 [C(L1I)] = {
651 [C(OP_READ)] = {
652 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS,
653 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
654 },
655 [C(OP_WRITE)] = {
656 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L1_ICACHE_ACCESS,
657 [C(RESULT_MISS)] = ARMV7_PERFCTR_L1_ICACHE_REFILL,
658 },
659 [C(OP_PREFETCH)] = {
660 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
661 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
662 },
663 },
664 [C(LL)] = {
665 [C(OP_READ)] = {
666 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS,
667 [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
668 },
669 [C(OP_WRITE)] = {
670 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_L2_CACHE_ACCESS,
671 [C(RESULT_MISS)] = ARMV7_PERFCTR_L2_CACHE_REFILL,
672 },
673 [C(OP_PREFETCH)] = {
674 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
675 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
676 },
677 },
678 [C(DTLB)] = {
679 [C(OP_READ)] = {
680 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
681 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
682 },
683 [C(OP_WRITE)] = {
684 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
685 [C(RESULT_MISS)] = ARMV7_PERFCTR_DTLB_REFILL,
686 },
687 [C(OP_PREFETCH)] = {
688 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
689 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
690 },
691 },
692 [C(ITLB)] = {
693 [C(OP_READ)] = {
694 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
695 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
696 },
697 [C(OP_WRITE)] = {
698 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
699 [C(RESULT_MISS)] = ARMV7_PERFCTR_ITLB_REFILL,
700 },
701 [C(OP_PREFETCH)] = {
702 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
703 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
704 },
705 },
706 [C(BPU)] = {
707 [C(OP_READ)] = {
708 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
709 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
710 },
711 [C(OP_WRITE)] = {
712 [C(RESULT_ACCESS)] = ARMV7_PERFCTR_PC_BRANCH_PRED,
713 [C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
714 },
715 [C(OP_PREFETCH)] = {
716 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
717 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
718 },
719 },
720 [C(NODE)] = {
721 [C(OP_READ)] = {
722 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
723 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
724 },
725 [C(OP_WRITE)] = {
726 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
727 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
728 },
729 [C(OP_PREFETCH)] = {
730 [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED,
731 [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED,
732 },
733 },
734};
735
736/*
613 * Perf Events' indices 737 * Perf Events' indices
614 */ 738 */
615#define ARMV7_IDX_CYCLE_COUNTER 0 739#define ARMV7_IDX_CYCLE_COUNTER 0
@@ -1104,6 +1228,12 @@ static int armv7_a15_map_event(struct perf_event *event)
1104 &armv7_a15_perf_cache_map, 0xFF); 1228 &armv7_a15_perf_cache_map, 0xFF);
1105} 1229}
1106 1230
1231static int armv7_a7_map_event(struct perf_event *event)
1232{
1233 return map_cpu_event(event, &armv7_a7_perf_map,
1234 &armv7_a7_perf_cache_map, 0xFF);
1235}
1236
1107static struct arm_pmu armv7pmu = { 1237static struct arm_pmu armv7pmu = {
1108 .handle_irq = armv7pmu_handle_irq, 1238 .handle_irq = armv7pmu_handle_irq,
1109 .enable = armv7pmu_enable_event, 1239 .enable = armv7pmu_enable_event,
@@ -1164,6 +1294,16 @@ static struct arm_pmu *__init armv7_a15_pmu_init(void)
1164 armv7pmu.set_event_filter = armv7pmu_set_event_filter; 1294 armv7pmu.set_event_filter = armv7pmu_set_event_filter;
1165 return &armv7pmu; 1295 return &armv7pmu;
1166} 1296}
1297
1298static struct arm_pmu *__init armv7_a7_pmu_init(void)
1299{
1300 armv7pmu.id = ARM_PERF_PMU_ID_CA7;
1301 armv7pmu.name = "ARMv7 Cortex-A7";
1302 armv7pmu.map_event = armv7_a7_map_event;
1303 armv7pmu.num_events = armv7_read_num_pmnc_events();
1304 armv7pmu.set_event_filter = armv7pmu_set_event_filter;
1305 return &armv7pmu;
1306}
1167#else 1307#else
1168static struct arm_pmu *__init armv7_a8_pmu_init(void) 1308static struct arm_pmu *__init armv7_a8_pmu_init(void)
1169{ 1309{
@@ -1184,4 +1324,9 @@ static struct arm_pmu *__init armv7_a15_pmu_init(void)
1184{ 1324{
1185 return NULL; 1325 return NULL;
1186} 1326}
1327
1328static struct arm_pmu *__init armv7_a7_pmu_init(void)
1329{
1330 return NULL;
1331}
1187#endif /* CONFIG_CPU_V7 */ 1332#endif /* CONFIG_CPU_V7 */
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index d3eca4524533..2b7b017a20cd 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -35,7 +35,6 @@
35#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
36#include <asm/leds.h> 36#include <asm/leds.h>
37#include <asm/processor.h> 37#include <asm/processor.h>
38#include <asm/system.h>
39#include <asm/thread_notify.h> 38#include <asm/thread_notify.h>
40#include <asm/stacktrace.h> 39#include <asm/stacktrace.h>
41#include <asm/mach/time.h> 40#include <asm/mach/time.h>
@@ -529,21 +528,39 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
529#ifdef CONFIG_MMU 528#ifdef CONFIG_MMU
530/* 529/*
531 * The vectors page is always readable from user space for the 530 * The vectors page is always readable from user space for the
532 * atomic helpers and the signal restart code. Let's declare a mapping 531 * atomic helpers and the signal restart code. Insert it into the
533 * for it so it is visible through ptrace and /proc/<pid>/mem. 532 * gate_vma so that it is visible through ptrace and /proc/<pid>/mem.
534 */ 533 */
534static struct vm_area_struct gate_vma;
535 535
536int vectors_user_mapping(void) 536static int __init gate_vma_init(void)
537{ 537{
538 struct mm_struct *mm = current->mm; 538 gate_vma.vm_start = 0xffff0000;
539 return install_special_mapping(mm, 0xffff0000, PAGE_SIZE, 539 gate_vma.vm_end = 0xffff0000 + PAGE_SIZE;
540 VM_READ | VM_EXEC | 540 gate_vma.vm_page_prot = PAGE_READONLY_EXEC;
541 VM_MAYREAD | VM_MAYEXEC | VM_RESERVED, 541 gate_vma.vm_flags = VM_READ | VM_EXEC |
542 NULL); 542 VM_MAYREAD | VM_MAYEXEC;
543 return 0;
544}
545arch_initcall(gate_vma_init);
546
547struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
548{
549 return &gate_vma;
550}
551
552int in_gate_area(struct mm_struct *mm, unsigned long addr)
553{
554 return (addr >= gate_vma.vm_start) && (addr < gate_vma.vm_end);
555}
556
557int in_gate_area_no_mm(unsigned long addr)
558{
559 return in_gate_area(NULL, addr);
543} 560}
544 561
545const char *arch_vma_name(struct vm_area_struct *vma) 562const char *arch_vma_name(struct vm_area_struct *vma)
546{ 563{
547 return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL; 564 return (vma == &gate_vma) ? "[vectors]" : NULL;
548} 565}
549#endif 566#endif
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index ede6443c34d9..80abafb9bf33 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -26,7 +26,6 @@
26#include <linux/audit.h> 26#include <linux/audit.h>
27 27
28#include <asm/pgtable.h> 28#include <asm/pgtable.h>
29#include <asm/system.h>
30#include <asm/traps.h> 29#include <asm/traps.h>
31 30
32#define REG_PC 15 31#define REG_PC 15
@@ -257,7 +256,7 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
257{ 256{
258 unsigned long tmp; 257 unsigned long tmp;
259 258
260 if (off & 3 || off >= sizeof(struct user)) 259 if (off & 3)
261 return -EIO; 260 return -EIO;
262 261
263 tmp = 0; 262 tmp = 0;
@@ -269,6 +268,8 @@ static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
269 tmp = tsk->mm->end_code; 268 tmp = tsk->mm->end_code;
270 else if (off < sizeof(struct pt_regs)) 269 else if (off < sizeof(struct pt_regs))
271 tmp = get_user_reg(tsk, off >> 2); 270 tmp = get_user_reg(tsk, off >> 2);
271 else if (off >= sizeof(struct user))
272 return -EIO;
272 273
273 return put_user(tmp, ret); 274 return put_user(tmp, ret);
274} 275}
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c
index 5416c7c12528..27d186abbc06 100644
--- a/arch/arm/kernel/sched_clock.c
+++ b/arch/arm/kernel/sched_clock.c
@@ -10,6 +10,7 @@
10#include <linux/jiffies.h> 10#include <linux/jiffies.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <linux/syscore_ops.h>
13#include <linux/timer.h> 14#include <linux/timer.h>
14 15
15#include <asm/sched_clock.h> 16#include <asm/sched_clock.h>
@@ -164,3 +165,20 @@ void __init sched_clock_postinit(void)
164 165
165 sched_clock_poll(sched_clock_timer.data); 166 sched_clock_poll(sched_clock_timer.data);
166} 167}
168
169static int sched_clock_suspend(void)
170{
171 sched_clock_poll(sched_clock_timer.data);
172 return 0;
173}
174
175static struct syscore_ops sched_clock_ops = {
176 .suspend = sched_clock_suspend,
177};
178
179static int __init sched_clock_syscore_init(void)
180{
181 register_syscore_ops(&sched_clock_ops);
182 return 0;
183}
184device_initcall(sched_clock_syscore_init);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index a255c39612ca..b91411371ae1 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -33,6 +33,7 @@
33#include <linux/sort.h> 33#include <linux/sort.h>
34 34
35#include <asm/unified.h> 35#include <asm/unified.h>
36#include <asm/cp15.h>
36#include <asm/cpu.h> 37#include <asm/cpu.h>
37#include <asm/cputype.h> 38#include <asm/cputype.h>
38#include <asm/elf.h> 39#include <asm/elf.h>
@@ -44,12 +45,13 @@
44#include <asm/cacheflush.h> 45#include <asm/cacheflush.h>
45#include <asm/cachetype.h> 46#include <asm/cachetype.h>
46#include <asm/tlbflush.h> 47#include <asm/tlbflush.h>
47#include <asm/system.h>
48 48
49#include <asm/prom.h> 49#include <asm/prom.h>
50#include <asm/mach/arch.h> 50#include <asm/mach/arch.h>
51#include <asm/mach/irq.h> 51#include <asm/mach/irq.h>
52#include <asm/mach/time.h> 52#include <asm/mach/time.h>
53#include <asm/system_info.h>
54#include <asm/system_misc.h>
53#include <asm/traps.h> 55#include <asm/traps.h>
54#include <asm/unwind.h> 56#include <asm/unwind.h>
55#include <asm/memblock.h> 57#include <asm/memblock.h>
@@ -974,7 +976,6 @@ void __init setup_arch(char **cmdline_p)
974 conswitchp = &dummy_con; 976 conswitchp = &dummy_con;
975#endif 977#endif
976#endif 978#endif
977 early_trap_init();
978 979
979 if (mdesc->init_early) 980 if (mdesc->init_early)
980 mdesc->init_early(); 981 mdesc->init_early();
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 9e617bd4a146..7cb532fc8aa4 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -66,12 +66,13 @@ const unsigned long syscall_restart_code[2] = {
66 */ 66 */
67asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask) 67asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask)
68{ 68{
69 mask &= _BLOCKABLE; 69 sigset_t blocked;
70 spin_lock_irq(&current->sighand->siglock); 70
71 current->saved_sigmask = current->blocked; 71 current->saved_sigmask = current->blocked;
72 siginitset(&current->blocked, mask); 72
73 recalc_sigpending(); 73 mask &= _BLOCKABLE;
74 spin_unlock_irq(&current->sighand->siglock); 74 siginitset(&blocked, mask);
75 set_current_blocked(&blocked);
75 76
76 current->state = TASK_INTERRUPTIBLE; 77 current->state = TASK_INTERRUPTIBLE;
77 schedule(); 78 schedule();
@@ -280,10 +281,7 @@ static int restore_sigframe(struct pt_regs *regs, struct sigframe __user *sf)
280 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); 281 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set));
281 if (err == 0) { 282 if (err == 0) {
282 sigdelsetmask(&set, ~_BLOCKABLE); 283 sigdelsetmask(&set, ~_BLOCKABLE);
283 spin_lock_irq(&current->sighand->siglock); 284 set_current_blocked(&set);
284 current->blocked = set;
285 recalc_sigpending();
286 spin_unlock_irq(&current->sighand->siglock);
287 } 285 }
288 286
289 __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err); 287 __get_user_error(regs->ARM_r0, &sf->uc.uc_mcontext.arm_r0, err);
@@ -636,13 +634,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
636 /* 634 /*
637 * Block the signal if we were successful. 635 * Block the signal if we were successful.
638 */ 636 */
639 spin_lock_irq(&tsk->sighand->siglock); 637 block_sigmask(ka, sig);
640 sigorsets(&tsk->blocked, &tsk->blocked,
641 &ka->sa.sa_mask);
642 if (!(ka->sa.sa_flags & SA_NODEFER))
643 sigaddset(&tsk->blocked, sig);
644 recalc_sigpending();
645 spin_unlock_irq(&tsk->sighand->siglock);
646 638
647 return 0; 639 return 0;
648} 640}
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
index 1f268bda4552..987dcf33415c 100644
--- a/arch/arm/kernel/sleep.S
+++ b/arch/arm/kernel/sleep.S
@@ -4,7 +4,6 @@
4#include <asm/assembler.h> 4#include <asm/assembler.h>
5#include <asm/glue-cache.h> 5#include <asm/glue-cache.h>
6#include <asm/glue-proc.h> 6#include <asm/glue-proc.h>
7#include <asm/system.h>
8 .text 7 .text
9 8
10/* 9/*
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 8f8cce2c46c4..addbbe8028c2 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -58,6 +58,8 @@ enum ipi_msg_type {
58 IPI_CPU_STOP, 58 IPI_CPU_STOP,
59}; 59};
60 60
61static DECLARE_COMPLETION(cpu_running);
62
61int __cpuinit __cpu_up(unsigned int cpu) 63int __cpuinit __cpu_up(unsigned int cpu)
62{ 64{
63 struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu); 65 struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
@@ -98,20 +100,12 @@ int __cpuinit __cpu_up(unsigned int cpu)
98 */ 100 */
99 ret = boot_secondary(cpu, idle); 101 ret = boot_secondary(cpu, idle);
100 if (ret == 0) { 102 if (ret == 0) {
101 unsigned long timeout;
102
103 /* 103 /*
104 * CPU was successfully started, wait for it 104 * CPU was successfully started, wait for it
105 * to come online or time out. 105 * to come online or time out.
106 */ 106 */
107 timeout = jiffies + HZ; 107 wait_for_completion_timeout(&cpu_running,
108 while (time_before(jiffies, timeout)) { 108 msecs_to_jiffies(1000));
109 if (cpu_online(cpu))
110 break;
111
112 udelay(10);
113 barrier();
114 }
115 109
116 if (!cpu_online(cpu)) { 110 if (!cpu_online(cpu)) {
117 pr_crit("CPU%u: failed to come online\n", cpu); 111 pr_crit("CPU%u: failed to come online\n", cpu);
@@ -288,9 +282,10 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
288 /* 282 /*
289 * OK, now it's safe to let the boot CPU continue. Wait for 283 * OK, now it's safe to let the boot CPU continue. Wait for
290 * the CPU migration code to notice that the CPU is online 284 * the CPU migration code to notice that the CPU is online
291 * before we continue. 285 * before we continue - which happens after __cpu_up returns.
292 */ 286 */
293 set_cpu_online(cpu, true); 287 set_cpu_online(cpu, true);
288 complete(&cpu_running);
294 289
295 /* 290 /*
296 * Setup the percpu timer for this CPU. 291 * Setup the percpu timer for this CPU.
@@ -354,7 +349,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
354 * re-initialize the map in platform_smp_prepare_cpus() if 349 * re-initialize the map in platform_smp_prepare_cpus() if
355 * present != possible (e.g. physical hotplug). 350 * present != possible (e.g. physical hotplug).
356 */ 351 */
357 init_cpu_present(&cpu_possible_map); 352 init_cpu_present(cpu_possible_mask);
358 353
359 /* 354 /*
360 * Initialise the SCU if there are more than one CPU 355 * Initialise the SCU if there are more than one CPU
@@ -586,8 +581,9 @@ void smp_send_stop(void)
586 unsigned long timeout; 581 unsigned long timeout;
587 582
588 if (num_online_cpus() > 1) { 583 if (num_online_cpus() > 1) {
589 cpumask_t mask = cpu_online_map; 584 struct cpumask mask;
590 cpu_clear(smp_processor_id(), mask); 585 cpumask_copy(&mask, cpu_online_mask);
586 cpumask_clear_cpu(smp_processor_id(), &mask);
591 587
592 smp_cross_call(&mask, IPI_CPU_STOP); 588 smp_cross_call(&mask, IPI_CPU_STOP);
593 } 589 }
diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
index 7dcb35285be7..02c5d2ce23bf 100644
--- a/arch/arm/kernel/smp_tlb.c
+++ b/arch/arm/kernel/smp_tlb.c
@@ -13,18 +13,6 @@
13#include <asm/smp_plat.h> 13#include <asm/smp_plat.h>
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15 15
16static void on_each_cpu_mask(void (*func)(void *), void *info, int wait,
17 const struct cpumask *mask)
18{
19 preempt_disable();
20
21 smp_call_function_many(mask, func, info, wait);
22 if (cpumask_test_cpu(smp_processor_id(), mask))
23 func(info);
24
25 preempt_enable();
26}
27
28/**********************************************************************/ 16/**********************************************************************/
29 17
30/* 18/*
@@ -87,7 +75,7 @@ void flush_tlb_all(void)
87void flush_tlb_mm(struct mm_struct *mm) 75void flush_tlb_mm(struct mm_struct *mm)
88{ 76{
89 if (tlb_ops_need_broadcast()) 77 if (tlb_ops_need_broadcast())
90 on_each_cpu_mask(ipi_flush_tlb_mm, mm, 1, mm_cpumask(mm)); 78 on_each_cpu_mask(mm_cpumask(mm), ipi_flush_tlb_mm, mm, 1);
91 else 79 else
92 local_flush_tlb_mm(mm); 80 local_flush_tlb_mm(mm);
93} 81}
@@ -98,7 +86,8 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
98 struct tlb_args ta; 86 struct tlb_args ta;
99 ta.ta_vma = vma; 87 ta.ta_vma = vma;
100 ta.ta_start = uaddr; 88 ta.ta_start = uaddr;
101 on_each_cpu_mask(ipi_flush_tlb_page, &ta, 1, mm_cpumask(vma->vm_mm)); 89 on_each_cpu_mask(mm_cpumask(vma->vm_mm), ipi_flush_tlb_page,
90 &ta, 1);
102 } else 91 } else
103 local_flush_tlb_page(vma, uaddr); 92 local_flush_tlb_page(vma, uaddr);
104} 93}
@@ -121,7 +110,8 @@ void flush_tlb_range(struct vm_area_struct *vma,
121 ta.ta_vma = vma; 110 ta.ta_vma = vma;
122 ta.ta_start = start; 111 ta.ta_start = start;
123 ta.ta_end = end; 112 ta.ta_end = end;
124 on_each_cpu_mask(ipi_flush_tlb_range, &ta, 1, mm_cpumask(vma->vm_mm)); 113 on_each_cpu_mask(mm_cpumask(vma->vm_mm), ipi_flush_tlb_range,
114 &ta, 1);
125 } else 115 } else
126 local_flush_tlb_range(vma, start, end); 116 local_flush_tlb_range(vma, start, end);
127} 117}
diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c
index 01ec453bb924..30ae6bb4a310 100644
--- a/arch/arm/kernel/tcm.c
+++ b/arch/arm/kernel/tcm.c
@@ -16,6 +16,7 @@
16#include <asm/cputype.h> 16#include <asm/cputype.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/memory.h> 18#include <asm/memory.h>
19#include <asm/system_info.h>
19#include "tcm.h" 20#include "tcm.h"
20 21
21static struct gen_pool *tcm_pool; 22static struct gen_pool *tcm_pool;
diff --git a/arch/arm/kernel/thumbee.c b/arch/arm/kernel/thumbee.c
index 9cb7aaca159f..aab899764053 100644
--- a/arch/arm/kernel/thumbee.c
+++ b/arch/arm/kernel/thumbee.c
@@ -20,6 +20,7 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22 22
23#include <asm/system_info.h>
23#include <asm/thread_notify.h> 24#include <asm/thread_notify.h>
24 25
25/* 26/*
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 8c57dd3680e9..fe31b22f18fd 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -25,8 +25,6 @@
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/irq.h> 26#include <linux/irq.h>
27 27
28#include <linux/mc146818rtc.h>
29
30#include <asm/leds.h> 28#include <asm/leds.h>
31#include <asm/thread_info.h> 29#include <asm/thread_info.h>
32#include <asm/sched_clock.h> 30#include <asm/sched_clock.h>
@@ -149,8 +147,6 @@ void __init time_init(void)
149{ 147{
150 system_timer = machine_desc->timer; 148 system_timer = machine_desc->timer;
151 system_timer->init(); 149 system_timer->init();
152#ifdef CONFIG_HAVE_SCHED_CLOCK
153 sched_clock_postinit(); 150 sched_clock_postinit();
154#endif
155} 151}
156 152
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index f84dfe67724f..778454750a6c 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -29,11 +29,11 @@
29#include <linux/atomic.h> 29#include <linux/atomic.h>
30#include <asm/cacheflush.h> 30#include <asm/cacheflush.h>
31#include <asm/exception.h> 31#include <asm/exception.h>
32#include <asm/system.h>
33#include <asm/unistd.h> 32#include <asm/unistd.h>
34#include <asm/traps.h> 33#include <asm/traps.h>
35#include <asm/unwind.h> 34#include <asm/unwind.h>
36#include <asm/tls.h> 35#include <asm/tls.h>
36#include <asm/system_misc.h>
37 37
38#include "signal.h" 38#include "signal.h"
39 39
@@ -227,6 +227,11 @@ void show_stack(struct task_struct *tsk, unsigned long *sp)
227#else 227#else
228#define S_SMP "" 228#define S_SMP ""
229#endif 229#endif
230#ifdef CONFIG_THUMB2_KERNEL
231#define S_ISA " THUMB2"
232#else
233#define S_ISA " ARM"
234#endif
230 235
231static int __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs) 236static int __die(const char *str, int err, struct thread_info *thread, struct pt_regs *regs)
232{ 237{
@@ -234,8 +239,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
234 static int die_counter; 239 static int die_counter;
235 int ret; 240 int ret;
236 241
237 printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n", 242 printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP
238 str, err, ++die_counter); 243 S_ISA "\n", str, err, ++die_counter);
239 244
240 /* trap and error numbers are mostly meaningless on ARM */ 245 /* trap and error numbers are mostly meaningless on ARM */
241 ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV); 246 ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV);
@@ -784,18 +789,16 @@ static void __init kuser_get_tls_init(unsigned long vectors)
784 memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4); 789 memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4);
785} 790}
786 791
787void __init early_trap_init(void) 792void __init early_trap_init(void *vectors_base)
788{ 793{
789#if defined(CONFIG_CPU_USE_DOMAINS) 794 unsigned long vectors = (unsigned long)vectors_base;
790 unsigned long vectors = CONFIG_VECTORS_BASE;
791#else
792 unsigned long vectors = (unsigned long)vectors_page;
793#endif
794 extern char __stubs_start[], __stubs_end[]; 795 extern char __stubs_start[], __stubs_end[];
795 extern char __vectors_start[], __vectors_end[]; 796 extern char __vectors_start[], __vectors_end[];
796 extern char __kuser_helper_start[], __kuser_helper_end[]; 797 extern char __kuser_helper_start[], __kuser_helper_end[];
797 int kuser_sz = __kuser_helper_end - __kuser_helper_start; 798 int kuser_sz = __kuser_helper_end - __kuser_helper_start;
798 799
800 vectors_page = vectors_base;
801
799 /* 802 /*
800 * Copy the vectors, stubs and kuser helpers (in entry-armv.S) 803 * Copy the vectors, stubs and kuser helpers (in entry-armv.S)
801 * into the vector page, mapped at 0xffff0000, and ensure these 804 * into the vector page, mapped at 0xffff0000, and ensure these
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index e55cdcbd81fb..45db05d8d94c 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -20,9 +20,11 @@ config HAVE_AT91_USART5
20 20
21config AT91_SAM9_ALT_RESET 21config AT91_SAM9_ALT_RESET
22 bool 22 bool
23 default !ARCH_AT91X40
23 24
24config AT91_SAM9G45_RESET 25config AT91_SAM9G45_RESET
25 bool 26 bool
27 default !ARCH_AT91X40
26 28
27menu "Atmel AT91 System-on-Chip" 29menu "Atmel AT91 System-on-Chip"
28 30
@@ -45,7 +47,6 @@ config ARCH_AT91SAM9260
45 select HAVE_AT91_USART4 47 select HAVE_AT91_USART4
46 select HAVE_AT91_USART5 48 select HAVE_AT91_USART5
47 select HAVE_NET_MACB 49 select HAVE_NET_MACB
48 select AT91_SAM9_ALT_RESET
49 50
50config ARCH_AT91SAM9261 51config ARCH_AT91SAM9261
51 bool "AT91SAM9261" 52 bool "AT91SAM9261"
@@ -53,7 +54,6 @@ config ARCH_AT91SAM9261
53 select GENERIC_CLOCKEVENTS 54 select GENERIC_CLOCKEVENTS
54 select HAVE_FB_ATMEL 55 select HAVE_FB_ATMEL
55 select HAVE_AT91_DBGU0 56 select HAVE_AT91_DBGU0
56 select AT91_SAM9_ALT_RESET
57 57
58config ARCH_AT91SAM9G10 58config ARCH_AT91SAM9G10
59 bool "AT91SAM9G10" 59 bool "AT91SAM9G10"
@@ -61,7 +61,6 @@ config ARCH_AT91SAM9G10
61 select GENERIC_CLOCKEVENTS 61 select GENERIC_CLOCKEVENTS
62 select HAVE_AT91_DBGU0 62 select HAVE_AT91_DBGU0
63 select HAVE_FB_ATMEL 63 select HAVE_FB_ATMEL
64 select AT91_SAM9_ALT_RESET
65 64
66config ARCH_AT91SAM9263 65config ARCH_AT91SAM9263
67 bool "AT91SAM9263" 66 bool "AT91SAM9263"
@@ -70,7 +69,6 @@ config ARCH_AT91SAM9263
70 select HAVE_FB_ATMEL 69 select HAVE_FB_ATMEL
71 select HAVE_NET_MACB 70 select HAVE_NET_MACB
72 select HAVE_AT91_DBGU1 71 select HAVE_AT91_DBGU1
73 select AT91_SAM9_ALT_RESET
74 72
75config ARCH_AT91SAM9RL 73config ARCH_AT91SAM9RL
76 bool "AT91SAM9RL" 74 bool "AT91SAM9RL"
@@ -79,7 +77,6 @@ config ARCH_AT91SAM9RL
79 select HAVE_AT91_USART3 77 select HAVE_AT91_USART3
80 select HAVE_FB_ATMEL 78 select HAVE_FB_ATMEL
81 select HAVE_AT91_DBGU0 79 select HAVE_AT91_DBGU0
82 select AT91_SAM9_ALT_RESET
83 80
84config ARCH_AT91SAM9G20 81config ARCH_AT91SAM9G20
85 bool "AT91SAM9G20" 82 bool "AT91SAM9G20"
@@ -90,7 +87,6 @@ config ARCH_AT91SAM9G20
90 select HAVE_AT91_USART4 87 select HAVE_AT91_USART4
91 select HAVE_AT91_USART5 88 select HAVE_AT91_USART5
92 select HAVE_NET_MACB 89 select HAVE_NET_MACB
93 select AT91_SAM9_ALT_RESET
94 90
95config ARCH_AT91SAM9G45 91config ARCH_AT91SAM9G45
96 bool "AT91SAM9G45" 92 bool "AT91SAM9G45"
@@ -100,7 +96,6 @@ config ARCH_AT91SAM9G45
100 select HAVE_FB_ATMEL 96 select HAVE_FB_ATMEL
101 select HAVE_NET_MACB 97 select HAVE_NET_MACB
102 select HAVE_AT91_DBGU1 98 select HAVE_AT91_DBGU1
103 select AT91_SAM9G45_RESET
104 99
105config ARCH_AT91SAM9X5 100config ARCH_AT91SAM9X5
106 bool "AT91SAM9x5 family" 101 bool "AT91SAM9x5 family"
@@ -109,7 +104,6 @@ config ARCH_AT91SAM9X5
109 select HAVE_FB_ATMEL 104 select HAVE_FB_ATMEL
110 select HAVE_NET_MACB 105 select HAVE_NET_MACB
111 select HAVE_AT91_DBGU0 106 select HAVE_AT91_DBGU0
112 select AT91_SAM9G45_RESET
113 107
114config ARCH_AT91X40 108config ARCH_AT91X40
115 bool "AT91x40" 109 bool "AT91x40"
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 0df1045311e4..364c19357e60 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -15,6 +15,7 @@
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/system_misc.h>
18#include <mach/at91rm9200.h> 19#include <mach/at91rm9200.h>
19#include <mach/at91_pmc.h> 20#include <mach/at91_pmc.h>
20#include <mach/at91_st.h> 21#include <mach/at91_st.h>
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 14b5a9c9a514..46f774233298 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -16,6 +16,7 @@
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/system_misc.h>
19#include <mach/cpu.h> 20#include <mach/cpu.h>
20#include <mach/at91_dbgu.h> 21#include <mach/at91_dbgu.h>
21#include <mach/at91sam9260.h> 22#include <mach/at91sam9260.h>
@@ -216,6 +217,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
216 CLKDEV_CON_DEV_ID("t0_clk", "fffdc000.timer", &tc3_clk), 217 CLKDEV_CON_DEV_ID("t0_clk", "fffdc000.timer", &tc3_clk),
217 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk), 218 CLKDEV_CON_DEV_ID("t1_clk", "fffdc000.timer", &tc4_clk),
218 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk), 219 CLKDEV_CON_DEV_ID("t2_clk", "fffdc000.timer", &tc5_clk),
220 CLKDEV_CON_DEV_ID("hclk", "500000.ohci", &ohci_clk),
219 /* fake hclk clock */ 221 /* fake hclk clock */
220 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk), 222 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
221 CLKDEV_CON_ID("pioA", &pioA_clk), 223 CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 7e5651ee9f85..5652dde4bbe2 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -598,6 +598,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
598 else 598 else
599 cs_pin = spi1_standard_cs[devices[i].chip_select]; 599 cs_pin = spi1_standard_cs[devices[i].chip_select];
600 600
601 if (!gpio_is_valid(cs_pin))
602 continue;
603
601 if (devices[i].bus_num == 0) 604 if (devices[i].bus_num == 0)
602 enable_spi0 = 1; 605 enable_spi0 = 1;
603 else 606 else
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index 684c5dfd92ac..7de81e6222f1 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -16,6 +16,7 @@
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/system_misc.h>
19#include <mach/cpu.h> 20#include <mach/cpu.h>
20#include <mach/at91sam9261.h> 21#include <mach/at91sam9261.h>
21#include <mach/at91_pmc.h> 22#include <mach/at91_pmc.h>
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 096da87dc00d..4db961a93085 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -415,6 +415,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
415 else 415 else
416 cs_pin = spi1_standard_cs[devices[i].chip_select]; 416 cs_pin = spi1_standard_cs[devices[i].chip_select];
417 417
418 if (!gpio_is_valid(cs_pin))
419 continue;
420
418 if (devices[i].bus_num == 0) 421 if (devices[i].bus_num == 0)
419 enable_spi0 = 1; 422 enable_spi0 = 1;
420 else 423 else
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 0b4fa5a7f685..ef301be66575 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -16,6 +16,7 @@
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/system_misc.h>
19#include <mach/at91sam9263.h> 20#include <mach/at91sam9263.h>
20#include <mach/at91_pmc.h> 21#include <mach/at91_pmc.h>
21#include <mach/at91_rstc.h> 22#include <mach/at91_rstc.h>
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 53688c46f956..fe99206de880 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -72,7 +72,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
72 /* Enable VBus control for UHP ports */ 72 /* Enable VBus control for UHP ports */
73 for (i = 0; i < data->ports; i++) { 73 for (i = 0; i < data->ports; i++) {
74 if (gpio_is_valid(data->vbus_pin[i])) 74 if (gpio_is_valid(data->vbus_pin[i]))
75 at91_set_gpio_output(data->vbus_pin[i], 0); 75 at91_set_gpio_output(data->vbus_pin[i],
76 data->vbus_pin_active_low[i]);
76 } 77 }
77 78
78 /* Enable overcurrent notification */ 79 /* Enable overcurrent notification */
@@ -671,6 +672,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
671 else 672 else
672 cs_pin = spi1_standard_cs[devices[i].chip_select]; 673 cs_pin = spi1_standard_cs[devices[i].chip_select];
673 674
675 if (!gpio_is_valid(cs_pin))
676 continue;
677
674 if (devices[i].bus_num == 0) 678 if (devices[i].bus_num == 0)
675 enable_spi0 = 1; 679 enable_spi0 = 1;
676 else 680 else
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 0014573dfe17..d222f8333dab 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -16,6 +16,7 @@
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/system_misc.h>
19#include <mach/at91sam9g45.h> 20#include <mach/at91sam9g45.h>
20#include <mach/at91_pmc.h> 21#include <mach/at91_pmc.h>
21#include <mach/cpu.h> 22#include <mach/cpu.h>
@@ -232,6 +233,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
232 /* more tc lookup table for DT entries */ 233 /* more tc lookup table for DT entries */
233 CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb0_clk), 234 CLKDEV_CON_DEV_ID("t0_clk", "fff7c000.timer", &tcb0_clk),
234 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk), 235 CLKDEV_CON_DEV_ID("t0_clk", "fffd4000.timer", &tcb0_clk),
236 CLKDEV_CON_DEV_ID("hclk", "700000.ohci", &uhphs_clk),
237 CLKDEV_CON_DEV_ID("ehci_clk", "800000.ehci", &uhphs_clk),
235 /* fake hclk clock */ 238 /* fake hclk clock */
236 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk), 239 CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
237 CLKDEV_CON_ID("pioA", &pioA_clk), 240 CLKDEV_CON_ID("pioA", &pioA_clk),
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 4320b2096789..6b008aee1dff 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -127,12 +127,13 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
127 /* Enable VBus control for UHP ports */ 127 /* Enable VBus control for UHP ports */
128 for (i = 0; i < data->ports; i++) { 128 for (i = 0; i < data->ports; i++) {
129 if (gpio_is_valid(data->vbus_pin[i])) 129 if (gpio_is_valid(data->vbus_pin[i]))
130 at91_set_gpio_output(data->vbus_pin[i], 0); 130 at91_set_gpio_output(data->vbus_pin[i],
131 data->vbus_pin_active_low[i]);
131 } 132 }
132 133
133 /* Enable overcurrent notification */ 134 /* Enable overcurrent notification */
134 for (i = 0; i < data->ports; i++) { 135 for (i = 0; i < data->ports; i++) {
135 if (data->overcurrent_pin[i]) 136 if (gpio_is_valid(data->overcurrent_pin[i]))
136 at91_set_gpio_input(data->overcurrent_pin[i], 1); 137 at91_set_gpio_input(data->overcurrent_pin[i], 1);
137 } 138 }
138 139
@@ -188,7 +189,8 @@ void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data)
188 /* Enable VBus control for UHP ports */ 189 /* Enable VBus control for UHP ports */
189 for (i = 0; i < data->ports; i++) { 190 for (i = 0; i < data->ports; i++) {
190 if (gpio_is_valid(data->vbus_pin[i])) 191 if (gpio_is_valid(data->vbus_pin[i]))
191 at91_set_gpio_output(data->vbus_pin[i], 0); 192 at91_set_gpio_output(data->vbus_pin[i],
193 data->vbus_pin_active_low[i]);
192 } 194 }
193 195
194 usbh_ehci_data = *data; 196 usbh_ehci_data = *data;
@@ -437,7 +439,6 @@ void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
437 439
438 /* DMA slave channel configuration */ 440 /* DMA slave channel configuration */
439 atslave->dma_dev = &at_hdmac_device.dev; 441 atslave->dma_dev = &at_hdmac_device.dev;
440 atslave->reg_width = AT_DMA_SLAVE_WIDTH_32BIT;
441 atslave->cfg = ATC_FIFOCFG_HALFFIFO 442 atslave->cfg = ATC_FIFOCFG_HALFFIFO
442 | ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW; 443 | ATC_SRC_H2SEL_HW | ATC_DST_H2SEL_HW;
443 atslave->ctrla = ATC_SCSIZE_16 | ATC_DCSIZE_16; 444 atslave->ctrla = ATC_SCSIZE_16 | ATC_DCSIZE_16;
@@ -786,6 +787,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
786 else 787 else
787 cs_pin = spi1_standard_cs[devices[i].chip_select]; 788 cs_pin = spi1_standard_cs[devices[i].chip_select];
788 789
790 if (!gpio_is_valid(cs_pin))
791 continue;
792
789 if (devices[i].bus_num == 0) 793 if (devices[i].bus_num == 0)
790 enable_spi0 = 1; 794 enable_spi0 = 1;
791 else 795 else
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 63d9372eb18e..d9f2774f385e 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -15,6 +15,7 @@
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <asm/mach/arch.h> 16#include <asm/mach/arch.h>
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/system_misc.h>
18#include <mach/cpu.h> 19#include <mach/cpu.h>
19#include <mach/at91_dbgu.h> 20#include <mach/at91_dbgu.h>
20#include <mach/at91sam9rl.h> 21#include <mach/at91sam9rl.h>
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index eda72e83037d..fe4ae22e8561 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -419,6 +419,9 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
419 else 419 else
420 cs_pin = spi_standard_cs[devices[i].chip_select]; 420 cs_pin = spi_standard_cs[devices[i].chip_select];
421 421
422 if (!gpio_is_valid(cs_pin))
423 continue;
424
422 /* enable chip-select pin */ 425 /* enable chip-select pin */
423 at91_set_gpio_output(cs_pin, 1); 426 at91_set_gpio_output(cs_pin, 1);
424 427
diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index a34d96afa746..13c8cae60462 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -131,7 +131,7 @@ static struct clk dma1_clk = {
131 .type = CLK_TYPE_PERIPHERAL, 131 .type = CLK_TYPE_PERIPHERAL,
132}; 132};
133static struct clk uhphs_clk = { 133static struct clk uhphs_clk = {
134 .name = "uhphs_clk", 134 .name = "uhphs",
135 .pmc_mask = 1 << AT91SAM9X5_ID_UHPHS, 135 .pmc_mask = 1 << AT91SAM9X5_ID_UHPHS,
136 .type = CLK_TYPE_PERIPHERAL, 136 .type = CLK_TYPE_PERIPHERAL,
137}; 137};
@@ -223,6 +223,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
223 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk), 223 CLKDEV_CON_DEV_ID("usart", "f8028000.serial", &usart3_clk),
224 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk), 224 CLKDEV_CON_DEV_ID("t0_clk", "f8008000.timer", &tcb0_clk),
225 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk), 225 CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
226 CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
227 CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
226 CLKDEV_CON_ID("pioA", &pioAB_clk), 228 CLKDEV_CON_ID("pioA", &pioAB_clk),
227 CLKDEV_CON_ID("pioB", &pioAB_clk), 229 CLKDEV_CON_ID("pioB", &pioAB_clk),
228 CLKDEV_CON_ID("pioC", &pioCD_clk), 230 CLKDEV_CON_ID("pioC", &pioCD_clk),
@@ -230,6 +232,9 @@ static struct clk_lookup periph_clocks_lookups[] = {
230 /* additional fake clock for macb_hclk */ 232 /* additional fake clock for macb_hclk */
231 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk), 233 CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb0_clk),
232 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk), 234 CLKDEV_CON_DEV_ID("hclk", "f8030000.ethernet", &macb1_clk),
235 CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk),
236 CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk),
237 CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk),
233}; 238};
234 239
235/* 240/*
@@ -299,14 +304,8 @@ static void __init at91sam9x5_map_io(void)
299 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE); 304 at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE);
300} 305}
301 306
302static void __init at91sam9x5_ioremap_registers(void)
303{
304 at91_ioremap_ramc(0, AT91SAM9X5_BASE_DDRSDRC0, 512);
305}
306
307void __init at91sam9x5_initialize(void) 307void __init at91sam9x5_initialize(void)
308{ 308{
309 arm_pm_restart = at91sam9g45_restart;
310 at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0); 309 at91_extern_irq = (1 << AT91SAM9X5_ID_IRQ0);
311 310
312 /* Register GPIO subsystem (using DT) */ 311 /* Register GPIO subsystem (using DT) */
@@ -314,11 +313,6 @@ void __init at91sam9x5_initialize(void)
314} 313}
315 314
316/* -------------------------------------------------------------------- 315/* --------------------------------------------------------------------
317 * AT91SAM9x5 devices (temporary before modification of code)
318 * -------------------------------------------------------------------- */
319void __init at91_add_device_nand(struct atmel_nand_data *data) {}
320
321/* --------------------------------------------------------------------
322 * Interrupt initialization 316 * Interrupt initialization
323 * -------------------------------------------------------------------- */ 317 * -------------------------------------------------------------------- */
324/* 318/*
@@ -362,7 +356,6 @@ static unsigned int at91sam9x5_default_irq_priority[NR_AIC_IRQS] __initdata = {
362struct at91_init_soc __initdata at91sam9x5_soc = { 356struct at91_init_soc __initdata at91sam9x5_soc = {
363 .map_io = at91sam9x5_map_io, 357 .map_io = at91sam9x5_map_io,
364 .default_irq_priority = at91sam9x5_default_irq_priority, 358 .default_irq_priority = at91sam9x5_default_irq_priority,
365 .ioremap_registers = at91sam9x5_ioremap_registers,
366 .register_clocks = at91sam9x5_register_clocks, 359 .register_clocks = at91sam9x5_register_clocks,
367 .init = at91sam9x5_initialize, 360 .init = at91sam9x5_initialize,
368}; 361};
diff --git a/arch/arm/mach-at91/at91x40.c b/arch/arm/mach-at91/at91x40.c
index 5400a1d65035..d62fe090d814 100644
--- a/arch/arm/mach-at91/at91x40.c
+++ b/arch/arm/mach-at91/at91x40.c
@@ -14,6 +14,7 @@
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <asm/proc-fns.h> 16#include <asm/proc-fns.h>
17#include <asm/system_misc.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <mach/at91x40.h> 19#include <mach/at91x40.h>
19#include <mach/at91_st.h> 20#include <mach/at91_st.h>
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index 3bb40694b02d..161efbaa1029 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -138,6 +138,7 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = {
138 .rdy_pin = AT91_PIN_PC13, 138 .rdy_pin = AT91_PIN_PC13,
139 .enable_pin = AT91_PIN_PC14, 139 .enable_pin = AT91_PIN_PC14,
140 .bus_width_16 = 0, 140 .bus_width_16 = 0,
141 .ecc_mode = NAND_ECC_SOFT,
141 .parts = afeb9260_nand_partition, 142 .parts = afeb9260_nand_partition,
142 .num_parts = ARRAY_SIZE(afeb9260_nand_partition), 143 .num_parts = ARRAY_SIZE(afeb9260_nand_partition),
143 .det_pin = -EINVAL, 144 .det_pin = -EINVAL,
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index 8510e9e54988..c6d44ee0c77e 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -140,6 +140,7 @@ static struct atmel_nand_data __initdata cam60_nand_data = {
140 .det_pin = -EINVAL, 140 .det_pin = -EINVAL,
141 .rdy_pin = AT91_PIN_PA9, 141 .rdy_pin = AT91_PIN_PA9,
142 .enable_pin = AT91_PIN_PA7, 142 .enable_pin = AT91_PIN_PA7,
143 .ecc_mode = NAND_ECC_SOFT,
143 .parts = cam60_nand_partition, 144 .parts = cam60_nand_partition,
144 .num_parts = ARRAY_SIZE(cam60_nand_partition), 145 .num_parts = ARRAY_SIZE(cam60_nand_partition),
145}; 146};
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index 989e1c5a9ca0..5f3680e7c883 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -117,6 +117,7 @@ static struct atmel_nand_data __initdata cpu9krea_nand_data = {
117 .enable_pin = AT91_PIN_PC14, 117 .enable_pin = AT91_PIN_PC14,
118 .bus_width_16 = 0, 118 .bus_width_16 = 0,
119 .det_pin = -EINVAL, 119 .det_pin = -EINVAL,
120 .ecc_mode = NAND_ECC_SOFT,
120}; 121};
121 122
122#ifdef CONFIG_MACH_CPU9260 123#ifdef CONFIG_MACH_CPU9260
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
index 583b72472ad9..c18d4d307801 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt.c
@@ -19,10 +19,7 @@
19#include <linux/of_irq.h> 19#include <linux/of_irq.h>
20#include <linux/of_platform.h> 20#include <linux/of_platform.h>
21 21
22#include <mach/hardware.h>
23#include <mach/board.h> 22#include <mach/board.h>
24#include <mach/system_rev.h>
25#include <mach/at91sam9_smc.h>
26 23
27#include <asm/setup.h> 24#include <asm/setup.h>
28#include <asm/irq.h> 25#include <asm/irq.h>
@@ -30,58 +27,9 @@
30#include <asm/mach/map.h> 27#include <asm/mach/map.h>
31#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
32 29
33#include "sam9_smc.h"
34#include "generic.h" 30#include "generic.h"
35 31
36 32
37static void __init ek_init_early(void)
38{
39 /* Initialize processor: 12.000 MHz crystal */
40 at91_initialize(12000000);
41}
42
43/* det_pin is not connected */
44static struct atmel_nand_data __initdata ek_nand_data = {
45 .ale = 21,
46 .cle = 22,
47 .det_pin = -EINVAL,
48 .rdy_pin = AT91_PIN_PC8,
49 .enable_pin = AT91_PIN_PC14,
50};
51
52static struct sam9_smc_config __initdata ek_nand_smc_config = {
53 .ncs_read_setup = 0,
54 .nrd_setup = 2,
55 .ncs_write_setup = 0,
56 .nwe_setup = 2,
57
58 .ncs_read_pulse = 4,
59 .nrd_pulse = 4,
60 .ncs_write_pulse = 4,
61 .nwe_pulse = 4,
62
63 .read_cycle = 7,
64 .write_cycle = 7,
65
66 .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE,
67 .tdf_cycles = 3,
68};
69
70static void __init ek_add_device_nand(void)
71{
72 ek_nand_data.bus_width_16 = board_have_nand_16bit();
73 /* setup bus-width (8 or 16) */
74 if (ek_nand_data.bus_width_16)
75 ek_nand_smc_config.mode |= AT91_SMC_DBW_16;
76 else
77 ek_nand_smc_config.mode |= AT91_SMC_DBW_8;
78
79 /* configure chip-select 3 (NAND) */
80 sam9_smc_configure(0, 3, &ek_nand_smc_config);
81
82 at91_add_device_nand(&ek_nand_data);
83}
84
85static const struct of_device_id irq_of_match[] __initconst = { 33static const struct of_device_id irq_of_match[] __initconst = {
86 34
87 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init }, 35 { .compatible = "atmel,at91rm9200-aic", .data = at91_aic_of_init },
@@ -98,9 +46,6 @@ static void __init at91_dt_init_irq(void)
98static void __init at91_dt_device_init(void) 46static void __init at91_dt_device_init(void)
99{ 47{
100 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 48 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
101
102 /* NAND */
103 ek_add_device_nand();
104} 49}
105 50
106static const char *at91_dt_board_compat[] __initdata = { 51static const char *at91_dt_board_compat[] __initdata = {
@@ -114,7 +59,7 @@ DT_MACHINE_START(at91sam_dt, "Atmel AT91SAM (Device Tree)")
114 /* Maintainer: Atmel */ 59 /* Maintainer: Atmel */
115 .timer = &at91sam926x_timer, 60 .timer = &at91sam926x_timer,
116 .map_io = at91_map_io, 61 .map_io = at91_map_io,
117 .init_early = ek_init_early, 62 .init_early = at91_dt_initialize,
118 .init_irq = at91_dt_init_irq, 63 .init_irq = at91_dt_init_irq,
119 .init_machine = at91_dt_device_init, 64 .init_machine = at91_dt_device_init,
120 .dt_compat = at91_dt_board_compat, 65 .dt_compat = at91_dt_board_compat,
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index bb9914582013..59b92aab9bcf 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -108,6 +108,7 @@ static struct atmel_nand_data __initdata kb9202_nand_data = {
108 .det_pin = -EINVAL, 108 .det_pin = -EINVAL,
109 .rdy_pin = AT91_PIN_PC29, 109 .rdy_pin = AT91_PIN_PC29,
110 .enable_pin = AT91_PIN_PC28, 110 .enable_pin = AT91_PIN_PC28,
111 .ecc_mode = NAND_ECC_SOFT,
111 .parts = kb9202_nand_partition, 112 .parts = kb9202_nand_partition,
112 .num_parts = ARRAY_SIZE(kb9202_nand_partition), 113 .num_parts = ARRAY_SIZE(kb9202_nand_partition),
113}; 114};
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 3f8617c0e04e..57d5f6a4726a 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -190,6 +190,7 @@ static struct atmel_nand_data __initdata neocore926_nand_data = {
190 .rdy_pin = AT91_PIN_PB19, 190 .rdy_pin = AT91_PIN_PB19,
191 .rdy_pin_active_low = 1, 191 .rdy_pin_active_low = 1,
192 .enable_pin = AT91_PIN_PD15, 192 .enable_pin = AT91_PIN_PD15,
193 .ecc_mode = NAND_ECC_SOFT,
193 .parts = neocore926_nand_partition, 194 .parts = neocore926_nand_partition,
194 .num_parts = ARRAY_SIZE(neocore926_nand_partition), 195 .num_parts = ARRAY_SIZE(neocore926_nand_partition),
195 .det_pin = -EINVAL, 196 .det_pin = -EINVAL,
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index e029d220cb84..b6ed5ed7081a 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -138,6 +138,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
138 .det_pin = -EINVAL, 138 .det_pin = -EINVAL,
139 .rdy_pin = AT91_PIN_PC13, 139 .rdy_pin = AT91_PIN_PC13,
140 .enable_pin = AT91_PIN_PC14, 140 .enable_pin = AT91_PIN_PC14,
141 .ecc_mode = NAND_ECC_SOFT,
142 .on_flash_bbt = 1,
141 .parts = ek_nand_partition, 143 .parts = ek_nand_partition,
142 .num_parts = ARRAY_SIZE(ek_nand_partition), 144 .num_parts = ARRAY_SIZE(ek_nand_partition),
143}; 145};
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 9083df04e7ed..01332aa538b2 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -150,6 +150,8 @@ static struct atmel_nand_data __initdata dk_nand_data = {
150 .det_pin = AT91_PIN_PB1, 150 .det_pin = AT91_PIN_PB1,
151 .rdy_pin = AT91_PIN_PC2, 151 .rdy_pin = AT91_PIN_PC2,
152 .enable_pin = -EINVAL, 152 .enable_pin = -EINVAL,
153 .ecc_mode = NAND_ECC_SOFT,
154 .on_flash_bbt = 1,
153 .parts = dk_nand_partition, 155 .parts = dk_nand_partition,
154 .num_parts = ARRAY_SIZE(dk_nand_partition), 156 .num_parts = ARRAY_SIZE(dk_nand_partition),
155}; 157};
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 84bce587735f..e8b116b6cba6 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -139,6 +139,7 @@ static struct atmel_nand_data __initdata ek_nand_data = {
139 .det_pin = -EINVAL, 139 .det_pin = -EINVAL,
140 .rdy_pin = AT91_PIN_PC13, 140 .rdy_pin = AT91_PIN_PC13,
141 .enable_pin = AT91_PIN_PC14, 141 .enable_pin = AT91_PIN_PC14,
142 .ecc_mode = NAND_ECC_SOFT,
142 .parts = ek_nand_partition, 143 .parts = ek_nand_partition,
143 .num_parts = ARRAY_SIZE(ek_nand_partition), 144 .num_parts = ARRAY_SIZE(ek_nand_partition),
144}; 145};
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index be8233bcabdc..d5aec55b0eb4 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -181,6 +181,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
181 .det_pin = -EINVAL, 181 .det_pin = -EINVAL,
182 .rdy_pin = AT91_PIN_PC13, 182 .rdy_pin = AT91_PIN_PC13,
183 .enable_pin = AT91_PIN_PC14, 183 .enable_pin = AT91_PIN_PC14,
184 .ecc_mode = NAND_ECC_SOFT,
185 .on_flash_bbt = 1,
184 .parts = ek_nand_partition, 186 .parts = ek_nand_partition,
185 .num_parts = ARRAY_SIZE(ek_nand_partition), 187 .num_parts = ARRAY_SIZE(ek_nand_partition),
186}; 188};
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 40895072a1a7..c3f994462864 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -187,6 +187,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
187 .det_pin = -EINVAL, 187 .det_pin = -EINVAL,
188 .rdy_pin = AT91_PIN_PC15, 188 .rdy_pin = AT91_PIN_PC15,
189 .enable_pin = AT91_PIN_PC14, 189 .enable_pin = AT91_PIN_PC14,
190 .ecc_mode = NAND_ECC_SOFT,
191 .on_flash_bbt = 1,
190 .parts = ek_nand_partition, 192 .parts = ek_nand_partition,
191 .num_parts = ARRAY_SIZE(ek_nand_partition), 193 .num_parts = ARRAY_SIZE(ek_nand_partition),
192}; 194};
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 29f66052fe63..2ffe50f3a9e9 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -74,6 +74,7 @@ static void __init ek_init_early(void)
74static struct at91_usbh_data __initdata ek_usbh_data = { 74static struct at91_usbh_data __initdata ek_usbh_data = {
75 .ports = 2, 75 .ports = 2,
76 .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 }, 76 .vbus_pin = { AT91_PIN_PA24, AT91_PIN_PA21 },
77 .vbus_pin_active_low = {1, 1},
77 .overcurrent_pin= {-EINVAL, -EINVAL}, 78 .overcurrent_pin= {-EINVAL, -EINVAL},
78}; 79};
79 80
@@ -187,6 +188,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
187 .det_pin = -EINVAL, 188 .det_pin = -EINVAL,
188 .rdy_pin = AT91_PIN_PA22, 189 .rdy_pin = AT91_PIN_PA22,
189 .enable_pin = AT91_PIN_PD15, 190 .enable_pin = AT91_PIN_PD15,
191 .ecc_mode = NAND_ECC_SOFT,
192 .on_flash_bbt = 1,
190 .parts = ek_nand_partition, 193 .parts = ek_nand_partition,
191 .num_parts = ARRAY_SIZE(ek_nand_partition), 194 .num_parts = ARRAY_SIZE(ek_nand_partition),
192}; 195};
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 843d6286c6f4..8923ec9f5831 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -166,6 +166,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
166 .rdy_pin = AT91_PIN_PC13, 166 .rdy_pin = AT91_PIN_PC13,
167 .enable_pin = AT91_PIN_PC14, 167 .enable_pin = AT91_PIN_PC14,
168 .det_pin = -EINVAL, 168 .det_pin = -EINVAL,
169 .ecc_mode = NAND_ECC_SOFT,
170 .on_flash_bbt = 1,
169 .parts = ek_nand_partition, 171 .parts = ek_nand_partition,
170 .num_parts = ARRAY_SIZE(ek_nand_partition), 172 .num_parts = ARRAY_SIZE(ek_nand_partition),
171}; 173};
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index 57497e2b8878..c88e908ddd82 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -71,6 +71,7 @@ static void __init ek_init_early(void)
71static struct at91_usbh_data __initdata ek_usbh_hs_data = { 71static struct at91_usbh_data __initdata ek_usbh_hs_data = {
72 .ports = 2, 72 .ports = 2,
73 .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3}, 73 .vbus_pin = {AT91_PIN_PD1, AT91_PIN_PD3},
74 .vbus_pin_active_low = {1, 1},
74 .overcurrent_pin= {-EINVAL, -EINVAL}, 75 .overcurrent_pin= {-EINVAL, -EINVAL},
75}; 76};
76 77
@@ -148,6 +149,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
148 .rdy_pin = AT91_PIN_PC8, 149 .rdy_pin = AT91_PIN_PC8,
149 .enable_pin = AT91_PIN_PC14, 150 .enable_pin = AT91_PIN_PC14,
150 .det_pin = -EINVAL, 151 .det_pin = -EINVAL,
152 .ecc_mode = NAND_ECC_SOFT,
153 .on_flash_bbt = 1,
151 .parts = ek_nand_partition, 154 .parts = ek_nand_partition,
152 .num_parts = ARRAY_SIZE(ek_nand_partition), 155 .num_parts = ARRAY_SIZE(ek_nand_partition),
153}; 156};
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index c1366d0032bf..b109ce2ba864 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -94,6 +94,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
94 .det_pin = -EINVAL, 94 .det_pin = -EINVAL,
95 .rdy_pin = AT91_PIN_PD17, 95 .rdy_pin = AT91_PIN_PD17,
96 .enable_pin = AT91_PIN_PB6, 96 .enable_pin = AT91_PIN_PB6,
97 .ecc_mode = NAND_ECC_SOFT,
98 .on_flash_bbt = 1,
97 .parts = ek_nand_partition, 99 .parts = ek_nand_partition,
98 .num_parts = ARRAY_SIZE(ek_nand_partition), 100 .num_parts = ARRAY_SIZE(ek_nand_partition),
99}; 101};
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 3c2e3fcc310c..ebc9d01ce742 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -110,6 +110,7 @@ static struct atmel_nand_data __initdata snapper9260_nand_data = {
110 .bus_width_16 = 0, 110 .bus_width_16 = 0,
111 .enable_pin = -EINVAL, 111 .enable_pin = -EINVAL,
112 .det_pin = -EINVAL, 112 .det_pin = -EINVAL,
113 .ecc_mode = NAND_ECC_SOFT,
113}; 114};
114 115
115static struct sam9_smc_config __initdata snapper9260_nand_smc_config = { 116static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index 72eb3b4d9ab6..7640049410a0 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -86,6 +86,7 @@ static struct atmel_nand_data __initdata nand_data = {
86 .enable_pin = AT91_PIN_PC14, 86 .enable_pin = AT91_PIN_PC14,
87 .bus_width_16 = 0, 87 .bus_width_16 = 0,
88 .det_pin = -EINVAL, 88 .det_pin = -EINVAL,
89 .ecc_mode = NAND_ECC_SOFT,
89}; 90};
90 91
91static struct sam9_smc_config __initdata nand_smc_config = { 92static struct sam9_smc_config __initdata nand_smc_config = {
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index 26c36fc2d1e5..b7483a3d0980 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -198,6 +198,8 @@ static struct atmel_nand_data __initdata ek_nand_data = {
198 .det_pin = -EINVAL, 198 .det_pin = -EINVAL,
199 .rdy_pin = AT91_PIN_PA22, 199 .rdy_pin = AT91_PIN_PA22,
200 .enable_pin = AT91_PIN_PD15, 200 .enable_pin = AT91_PIN_PD15,
201 .ecc_mode = NAND_ECC_SOFT,
202 .on_flash_bbt = 1,
201 .parts = ek_nand_partition, 203 .parts = ek_nand_partition,
202 .num_parts = ARRAY_SIZE(ek_nand_partition), 204 .num_parts = ARRAY_SIZE(ek_nand_partition),
203}; 205};
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 52f460768f71..38dd279d30b2 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -182,6 +182,7 @@ static struct atmel_nand_data __initdata yl9200_nand_data = {
182 .det_pin = -EINVAL, 182 .det_pin = -EINVAL,
183 .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */ 183 .rdy_pin = AT91_PIN_PC14, /* R/!B (Sheet10) */
184 .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */ 184 .enable_pin = AT91_PIN_PC15, /* !CE (Sheet10) */
185 .ecc_mode = NAND_ECC_SOFT,
185 .parts = yl9200_nand_partition, 186 .parts = yl9200_nand_partition,
186 .num_parts = ARRAY_SIZE(yl9200_nand_partition), 187 .num_parts = ARRAY_SIZE(yl9200_nand_partition),
187}; 188};
diff --git a/arch/arm/mach-at91/clock.c b/arch/arm/mach-at91/clock.c
index be51ca7f694d..a0f4d7424cdc 100644
--- a/arch/arm/mach-at91/clock.c
+++ b/arch/arm/mach-at91/clock.c
@@ -23,6 +23,7 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of_address.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <mach/at91_pmc.h> 29#include <mach/at91_pmc.h>
@@ -671,16 +672,12 @@ static void __init at91_upll_usbfs_clock_init(unsigned long main_clock)
671 uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8); 672 uhpck.rate_hz /= 1 + ((at91_pmc_read(AT91_PMC_USB) & AT91_PMC_OHCIUSBDIV) >> 8);
672} 673}
673 674
674int __init at91_clock_init(unsigned long main_clock) 675static int __init at91_pmc_init(unsigned long main_clock)
675{ 676{
676 unsigned tmp, freq, mckr; 677 unsigned tmp, freq, mckr;
677 int i; 678 int i;
678 int pll_overclock = false; 679 int pll_overclock = false;
679 680
680 at91_pmc_base = ioremap(AT91_PMC, 256);
681 if (!at91_pmc_base)
682 panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC);
683
684 /* 681 /*
685 * When the bootloader initialized the main oscillator correctly, 682 * When the bootloader initialized the main oscillator correctly,
686 * there's no problem using the cycle counter. But if it didn't, 683 * there's no problem using the cycle counter. But if it didn't,
@@ -802,6 +799,55 @@ int __init at91_clock_init(unsigned long main_clock)
802 return 0; 799 return 0;
803} 800}
804 801
802#if defined(CONFIG_OF)
803static struct of_device_id pmc_ids[] = {
804 { .compatible = "atmel,at91rm9200-pmc" },
805 { /*sentinel*/ }
806};
807
808static struct of_device_id osc_ids[] = {
809 { .compatible = "atmel,osc" },
810 { /*sentinel*/ }
811};
812
813int __init at91_dt_clock_init(void)
814{
815 struct device_node *np;
816 u32 main_clock = 0;
817
818 np = of_find_matching_node(NULL, pmc_ids);
819 if (!np)
820 panic("unable to find compatible pmc node in dtb\n");
821
822 at91_pmc_base = of_iomap(np, 0);
823 if (!at91_pmc_base)
824 panic("unable to map pmc cpu registers\n");
825
826 of_node_put(np);
827
828 /* retrieve the freqency of fixed clocks from device tree */
829 np = of_find_matching_node(NULL, osc_ids);
830 if (np) {
831 u32 rate;
832 if (!of_property_read_u32(np, "clock-frequency", &rate))
833 main_clock = rate;
834 }
835
836 of_node_put(np);
837
838 return at91_pmc_init(main_clock);
839}
840#endif
841
842int __init at91_clock_init(unsigned long main_clock)
843{
844 at91_pmc_base = ioremap(AT91_PMC, 256);
845 if (!at91_pmc_base)
846 panic("Impossible to ioremap AT91_PMC 0x%x\n", AT91_PMC);
847
848 return at91_pmc_init(main_clock);
849}
850
805/* 851/*
806 * Several unused clocks may be active. Turn them off. 852 * Several unused clocks may be active. Turn them off.
807 */ 853 */
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
index 555d956b3a57..ece1f9aefb47 100644
--- a/arch/arm/mach-at91/cpuidle.c
+++ b/arch/arm/mach-at91/cpuidle.c
@@ -17,9 +17,10 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/cpuidle.h> 19#include <linux/cpuidle.h>
20#include <asm/proc-fns.h>
21#include <linux/io.h> 20#include <linux/io.h>
22#include <linux/export.h> 21#include <linux/export.h>
22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h>
23 24
24#include "pm.h" 25#include "pm.h"
25 26
@@ -27,61 +28,39 @@
27 28
28static DEFINE_PER_CPU(struct cpuidle_device, at91_cpuidle_device); 29static DEFINE_PER_CPU(struct cpuidle_device, at91_cpuidle_device);
29 30
30static struct cpuidle_driver at91_idle_driver = {
31 .name = "at91_idle",
32 .owner = THIS_MODULE,
33};
34
35/* Actual code that puts the SoC in different idle states */ 31/* Actual code that puts the SoC in different idle states */
36static int at91_enter_idle(struct cpuidle_device *dev, 32static int at91_enter_idle(struct cpuidle_device *dev,
37 struct cpuidle_driver *drv, 33 struct cpuidle_driver *drv,
38 int index) 34 int index)
39{ 35{
40 struct timeval before, after; 36 at91_standby();
41 int idle_time;
42
43 local_irq_disable();
44 do_gettimeofday(&before);
45 if (index == 0)
46 /* Wait for interrupt state */
47 cpu_do_idle();
48 else if (index == 1)
49 at91_standby();
50 37
51 do_gettimeofday(&after);
52 local_irq_enable();
53 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
54 (after.tv_usec - before.tv_usec);
55
56 dev->last_residency = idle_time;
57 return index; 38 return index;
58} 39}
59 40
41static struct cpuidle_driver at91_idle_driver = {
42 .name = "at91_idle",
43 .owner = THIS_MODULE,
44 .en_core_tk_irqen = 1,
45 .states[0] = ARM_CPUIDLE_WFI_STATE,
46 .states[1] = {
47 .enter = at91_enter_idle,
48 .exit_latency = 10,
49 .target_residency = 100000,
50 .flags = CPUIDLE_FLAG_TIME_VALID,
51 .name = "RAM_SR",
52 .desc = "WFI and DDR Self Refresh",
53 },
54 .state_count = AT91_MAX_STATES,
55};
56
60/* Initialize CPU idle by registering the idle states */ 57/* Initialize CPU idle by registering the idle states */
61static int at91_init_cpuidle(void) 58static int at91_init_cpuidle(void)
62{ 59{
63 struct cpuidle_device *device; 60 struct cpuidle_device *device;
64 struct cpuidle_driver *driver = &at91_idle_driver;
65 61
66 device = &per_cpu(at91_cpuidle_device, smp_processor_id()); 62 device = &per_cpu(at91_cpuidle_device, smp_processor_id());
67 device->state_count = AT91_MAX_STATES; 63 device->state_count = AT91_MAX_STATES;
68 driver->state_count = AT91_MAX_STATES;
69
70 /* Wait for interrupt state */
71 driver->states[0].enter = at91_enter_idle;
72 driver->states[0].exit_latency = 1;
73 driver->states[0].target_residency = 10000;
74 driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
75 strcpy(driver->states[0].name, "WFI");
76 strcpy(driver->states[0].desc, "Wait for interrupt");
77
78 /* Wait for interrupt and RAM self refresh state */
79 driver->states[1].enter = at91_enter_idle;
80 driver->states[1].exit_latency = 10;
81 driver->states[1].target_residency = 10000;
82 driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
83 strcpy(driver->states[1].name, "RAM_SR");
84 strcpy(driver->states[1].desc, "WFI and RAM Self Refresh");
85 64
86 cpuidle_register_driver(&at91_idle_driver); 65 cpuidle_register_driver(&at91_idle_driver);
87 66
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 459f01a4a546..dd9b346c451d 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -20,6 +20,7 @@ extern void __init at91_init_sram(int bank, unsigned long base,
20extern void __init at91rm9200_set_type(int type); 20extern void __init at91rm9200_set_type(int type);
21extern void __init at91_initialize(unsigned long main_clock); 21extern void __init at91_initialize(unsigned long main_clock);
22extern void __init at91x40_initialize(unsigned long main_clock); 22extern void __init at91x40_initialize(unsigned long main_clock);
23extern void __init at91_dt_initialize(void);
23 24
24 /* Interrupts */ 25 /* Interrupts */
25extern void __init at91_init_irq_default(void); 26extern void __init at91_init_irq_default(void);
@@ -52,6 +53,7 @@ extern void __init at91sam9rl_set_console_clock(int id);
52extern void __init at91sam9g45_set_console_clock(int id); 53extern void __init at91sam9g45_set_console_clock(int id);
53#ifdef CONFIG_AT91_PMC_UNIT 54#ifdef CONFIG_AT91_PMC_UNIT
54extern int __init at91_clock_init(unsigned long main_clock); 55extern int __init at91_clock_init(unsigned long main_clock);
56extern int __init at91_dt_clock_init(void);
55#else 57#else
56static int inline at91_clock_init(unsigned long main_clock) { return 0; } 58static int inline at91_clock_init(unsigned long main_clock) { return 0; }
57#endif 59#endif
diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/include/mach/at91_shdwc.h
index 1d4fe822c77a..60478ea8bd46 100644
--- a/arch/arm/mach-at91/include/mach/at91_shdwc.h
+++ b/arch/arm/mach-at91/include/mach/at91_shdwc.h
@@ -36,9 +36,11 @@ extern void __iomem *at91_shdwc_base;
36#define AT91_SHDW_WKMODE0_HIGH 1 36#define AT91_SHDW_WKMODE0_HIGH 1
37#define AT91_SHDW_WKMODE0_LOW 2 37#define AT91_SHDW_WKMODE0_LOW 2
38#define AT91_SHDW_WKMODE0_ANYLEVEL 3 38#define AT91_SHDW_WKMODE0_ANYLEVEL 3
39#define AT91_SHDW_CPTWK0 (0xf << 4) /* Counter On Wake Up 0 */ 39#define AT91_SHDW_CPTWK0_MAX 0xf /* Maximum Counter On Wake Up 0 */
40#define AT91_SHDW_CPTWK0 (AT91_SHDW_CPTWK0_MAX << 4) /* Counter On Wake Up 0 */
40#define AT91_SHDW_CPTWK0_(x) ((x) << 4) 41#define AT91_SHDW_CPTWK0_(x) ((x) << 4)
41#define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */ 42#define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */
43#define AT91_SHDW_RTCWKEN (1 << 17) /* Real Time Clock Wake-up Enable */
42 44
43#define AT91_SHDW_SR 0x08 /* Shut Down Status Register */ 45#define AT91_SHDW_SR 0x08 /* Shut Down Status Register */
44#define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */ 46#define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */
diff --git a/arch/arm/mach-at91/include/mach/at91sam9x5.h b/arch/arm/mach-at91/include/mach/at91sam9x5.h
index a297a77d88e2..88e43d534cdf 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
@@ -55,11 +55,6 @@
55#define AT91SAM9X5_BASE_USART2 0xf8024000 55#define AT91SAM9X5_BASE_USART2 0xf8024000
56 56
57/* 57/*
58 * System Peripherals
59 */
60#define AT91SAM9X5_BASE_DDRSDRC0 0xffffe800
61
62/*
63 * Base addresses for early serial code (uncompress.h) 58 * Base addresses for early serial code (uncompress.h)
64 */ 59 */
65#define AT91_DBGU AT91_BASE_DBGU0 60#define AT91_DBGU AT91_BASE_DBGU0
diff --git a/arch/arm/mach-at91/include/mach/at_hdmac.h b/arch/arm/mach-at91/include/mach/at_hdmac.h
index 187cb58345c0..fff48d1a0f4e 100644
--- a/arch/arm/mach-at91/include/mach/at_hdmac.h
+++ b/arch/arm/mach-at91/include/mach/at_hdmac.h
@@ -24,18 +24,6 @@ struct at_dma_platform_data {
24}; 24};
25 25
26/** 26/**
27 * enum at_dma_slave_width - DMA slave register access width.
28 * @AT_DMA_SLAVE_WIDTH_8BIT: Do 8-bit slave register accesses
29 * @AT_DMA_SLAVE_WIDTH_16BIT: Do 16-bit slave register accesses
30 * @AT_DMA_SLAVE_WIDTH_32BIT: Do 32-bit slave register accesses
31 */
32enum at_dma_slave_width {
33 AT_DMA_SLAVE_WIDTH_8BIT = 0,
34 AT_DMA_SLAVE_WIDTH_16BIT,
35 AT_DMA_SLAVE_WIDTH_32BIT,
36};
37
38/**
39 * struct at_dma_slave - Controller-specific information about a slave 27 * struct at_dma_slave - Controller-specific information about a slave
40 * @dma_dev: required DMA master device 28 * @dma_dev: required DMA master device
41 * @tx_reg: physical address of data register used for 29 * @tx_reg: physical address of data register used for
@@ -48,9 +36,6 @@ enum at_dma_slave_width {
48 */ 36 */
49struct at_dma_slave { 37struct at_dma_slave {
50 struct device *dma_dev; 38 struct device *dma_dev;
51 dma_addr_t tx_reg;
52 dma_addr_t rx_reg;
53 enum at_dma_slave_width reg_width;
54 u32 cfg; 39 u32 cfg;
55 u32 ctrla; 40 u32 ctrla;
56}; 41};
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index dc8d6d4f17cf..49a821192c65 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -41,6 +41,7 @@
41#include <sound/atmel-ac97c.h> 41#include <sound/atmel-ac97c.h>
42#include <linux/serial.h> 42#include <linux/serial.h>
43#include <linux/platform_data/macb.h> 43#include <linux/platform_data/macb.h>
44#include <linux/platform_data/atmel.h>
44 45
45 /* USB Device */ 46 /* USB Device */
46struct at91_udc_data { 47struct at91_udc_data {
@@ -85,33 +86,20 @@ extern void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *d
85extern void __init at91_add_device_eth(struct macb_platform_data *data); 86extern void __init at91_add_device_eth(struct macb_platform_data *data);
86 87
87 /* USB Host */ 88 /* USB Host */
89#define AT91_MAX_USBH_PORTS 3
88struct at91_usbh_data { 90struct at91_usbh_data {
89 u8 ports; /* number of ports on root hub */ 91 int vbus_pin[AT91_MAX_USBH_PORTS]; /* port power-control pin */
90 int vbus_pin[2]; /* port power-control pin */ 92 int overcurrent_pin[AT91_MAX_USBH_PORTS];
91 u8 vbus_pin_active_low[2]; 93 u8 ports; /* number of ports on root hub */
92 u8 overcurrent_supported; 94 u8 overcurrent_supported;
93 int overcurrent_pin[2]; 95 u8 vbus_pin_active_low[AT91_MAX_USBH_PORTS];
94 u8 overcurrent_status[2]; 96 u8 overcurrent_status[AT91_MAX_USBH_PORTS];
95 u8 overcurrent_changed[2]; 97 u8 overcurrent_changed[AT91_MAX_USBH_PORTS];
96}; 98};
97extern void __init at91_add_device_usbh(struct at91_usbh_data *data); 99extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
98extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data); 100extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
99extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data); 101extern void __init at91_add_device_usbh_ehci(struct at91_usbh_data *data);
100 102
101 /* NAND / SmartMedia */
102struct atmel_nand_data {
103 int enable_pin; /* chip enable */
104 int det_pin; /* card detect */
105 int rdy_pin; /* ready/busy */
106 u8 rdy_pin_active_low; /* rdy_pin value is inverted */
107 u8 ale; /* address line number connected to ALE */
108 u8 cle; /* address line number connected to CLE */
109 u8 bus_width_16; /* buswidth is 16 bit */
110 u8 correction_cap; /* PMECC correction capability */
111 u16 sector_size; /* Sector size for PMECC */
112 struct mtd_partition *parts;
113 unsigned int num_parts;
114};
115extern void __init at91_add_device_nand(struct atmel_nand_data *data); 103extern void __init at91_add_device_nand(struct atmel_nand_data *data);
116 104
117 /* I2C*/ 105 /* I2C*/
diff --git a/arch/arm/mach-at91/include/mach/io.h b/arch/arm/mach-at91/include/mach/io.h
index 4003001eca3d..2d9ca0455745 100644
--- a/arch/arm/mach-at91/include/mach/io.h
+++ b/arch/arm/mach-at91/include/mach/io.h
@@ -21,11 +21,7 @@
21#ifndef __ASM_ARCH_IO_H 21#ifndef __ASM_ARCH_IO_H
22#define __ASM_ARCH_IO_H 22#define __ASM_ARCH_IO_H
23 23
24#include <mach/hardware.h>
25
26#define IO_SPACE_LIMIT 0xFFFFFFFF 24#define IO_SPACE_LIMIT 0xFFFFFFFF
27 25#define __io(a) __typesafe_io(a)
28#define __io(a) __typesafe_io(a)
29#define __mem_pci(a) (a)
30 26
31#endif 27#endif
diff --git a/arch/arm/mach-at91/include/mach/system_rev.h b/arch/arm/mach-at91/include/mach/system_rev.h
index ec164a4124c9..ef79a9aafc08 100644
--- a/arch/arm/mach-at91/include/mach/system_rev.h
+++ b/arch/arm/mach-at91/include/mach/system_rev.h
@@ -7,6 +7,8 @@
7#ifndef __ARCH_SYSTEM_REV_H__ 7#ifndef __ARCH_SYSTEM_REV_H__
8#define __ARCH_SYSTEM_REV_H__ 8#define __ARCH_SYSTEM_REV_H__
9 9
10#include <asm/system_info.h>
11
10/* 12/*
11 * board revision encoding 13 * board revision encoding
12 * mach specific 14 * mach specific
diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h
index 0234fd9d20d6..4218647c1fcd 100644
--- a/arch/arm/mach-at91/include/mach/uncompress.h
+++ b/arch/arm/mach-at91/include/mach/uncompress.h
@@ -23,6 +23,7 @@
23 23
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/atmel_serial.h> 25#include <linux/atmel_serial.h>
26#include <mach/hardware.h>
26 27
27#if defined(CONFIG_AT91_EARLY_DBGU0) 28#if defined(CONFIG_AT91_EARLY_DBGU0)
28#define UART_OFFSET AT91_BASE_DBGU0 29#define UART_OFFSET AT91_BASE_DBGU0
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 6c9d5e69ac28..f630250c6b87 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -197,19 +197,6 @@ extern void at91_slow_clock(void __iomem *pmc, void __iomem *ramc0,
197extern u32 at91_slow_clock_sz; 197extern u32 at91_slow_clock_sz;
198#endif 198#endif
199 199
200void __iomem *at91_ramc_base[2];
201
202void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
203{
204 if (id < 0 || id > 1) {
205 pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id);
206 BUG();
207 }
208 at91_ramc_base[id] = ioremap(addr, size);
209 if (!at91_ramc_base[id])
210 panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr);
211}
212
213static int at91_pm_enter(suspend_state_t state) 200static int at91_pm_enter(suspend_state_t state)
214{ 201{
215 at91_gpio_suspend(); 202 at91_gpio_suspend();
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 372396c2ecb6..97cc04dc8073 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -9,7 +9,9 @@
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/of_address.h>
12 13
14#include <asm/system_misc.h>
13#include <asm/mach/map.h> 15#include <asm/mach/map.h>
14 16
15#include <mach/hardware.h> 17#include <mach/hardware.h>
@@ -51,6 +53,19 @@ void __init at91_init_interrupts(unsigned int *priority)
51 at91_gpio_irq_setup(); 53 at91_gpio_irq_setup();
52} 54}
53 55
56void __iomem *at91_ramc_base[2];
57
58void __init at91_ioremap_ramc(int id, u32 addr, u32 size)
59{
60 if (id < 0 || id > 1) {
61 pr_emerg("Wrong RAM controller id (%d), cannot continue\n", id);
62 BUG();
63 }
64 at91_ramc_base[id] = ioremap(addr, size);
65 if (!at91_ramc_base[id])
66 panic("Impossible to ioremap ramc.%d 0x%x\n", id, addr);
67}
68
54static struct map_desc sram_desc[2] __initdata; 69static struct map_desc sram_desc[2] __initdata;
55 70
56void __init at91_init_sram(int bank, unsigned long base, unsigned int length) 71void __init at91_init_sram(int bank, unsigned long base, unsigned int length)
@@ -285,6 +300,150 @@ void __init at91_ioremap_matrix(u32 base_addr)
285 panic("Impossible to ioremap at91_matrix_base\n"); 300 panic("Impossible to ioremap at91_matrix_base\n");
286} 301}
287 302
303#if defined(CONFIG_OF)
304static struct of_device_id rstc_ids[] = {
305 { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9_alt_restart },
306 { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
307 { /*sentinel*/ }
308};
309
310static void at91_dt_rstc(void)
311{
312 struct device_node *np;
313 const struct of_device_id *of_id;
314
315 np = of_find_matching_node(NULL, rstc_ids);
316 if (!np)
317 panic("unable to find compatible rstc node in dtb\n");
318
319 at91_rstc_base = of_iomap(np, 0);
320 if (!at91_rstc_base)
321 panic("unable to map rstc cpu registers\n");
322
323 of_id = of_match_node(rstc_ids, np);
324 if (!of_id)
325 panic("AT91: rtsc no restart function availlable\n");
326
327 arm_pm_restart = of_id->data;
328
329 of_node_put(np);
330}
331
332static struct of_device_id ramc_ids[] = {
333 { .compatible = "atmel,at91sam9260-sdramc" },
334 { .compatible = "atmel,at91sam9g45-ddramc" },
335 { /*sentinel*/ }
336};
337
338static void at91_dt_ramc(void)
339{
340 struct device_node *np;
341
342 np = of_find_matching_node(NULL, ramc_ids);
343 if (!np)
344 panic("unable to find compatible ram conroller node in dtb\n");
345
346 at91_ramc_base[0] = of_iomap(np, 0);
347 if (!at91_ramc_base[0])
348 panic("unable to map ramc[0] cpu registers\n");
349 /* the controller may have 2 banks */
350 at91_ramc_base[1] = of_iomap(np, 1);
351
352 of_node_put(np);
353}
354
355static struct of_device_id shdwc_ids[] = {
356 { .compatible = "atmel,at91sam9260-shdwc", },
357 { .compatible = "atmel,at91sam9rl-shdwc", },
358 { .compatible = "atmel,at91sam9x5-shdwc", },
359 { /*sentinel*/ }
360};
361
362static const char *shdwc_wakeup_modes[] = {
363 [AT91_SHDW_WKMODE0_NONE] = "none",
364 [AT91_SHDW_WKMODE0_HIGH] = "high",
365 [AT91_SHDW_WKMODE0_LOW] = "low",
366 [AT91_SHDW_WKMODE0_ANYLEVEL] = "any",
367};
368
369const int at91_dtget_shdwc_wakeup_mode(struct device_node *np)
370{
371 const char *pm;
372 int err, i;
373
374 err = of_property_read_string(np, "atmel,wakeup-mode", &pm);
375 if (err < 0)
376 return AT91_SHDW_WKMODE0_ANYLEVEL;
377
378 for (i = 0; i < ARRAY_SIZE(shdwc_wakeup_modes); i++)
379 if (!strcasecmp(pm, shdwc_wakeup_modes[i]))
380 return i;
381
382 return -ENODEV;
383}
384
385static void at91_dt_shdwc(void)
386{
387 struct device_node *np;
388 int wakeup_mode;
389 u32 reg;
390 u32 mode = 0;
391
392 np = of_find_matching_node(NULL, shdwc_ids);
393 if (!np) {
394 pr_debug("AT91: unable to find compatible shutdown (shdwc) conroller node in dtb\n");
395 return;
396 }
397
398 at91_shdwc_base = of_iomap(np, 0);
399 if (!at91_shdwc_base)
400 panic("AT91: unable to map shdwc cpu registers\n");
401
402 wakeup_mode = at91_dtget_shdwc_wakeup_mode(np);
403 if (wakeup_mode < 0) {
404 pr_warn("AT91: shdwc unknown wakeup mode\n");
405 goto end;
406 }
407
408 if (!of_property_read_u32(np, "atmel,wakeup-counter", &reg)) {
409 if (reg > AT91_SHDW_CPTWK0_MAX) {
410 pr_warn("AT91: shdwc wakeup conter 0x%x > 0x%x reduce it to 0x%x\n",
411 reg, AT91_SHDW_CPTWK0_MAX, AT91_SHDW_CPTWK0_MAX);
412 reg = AT91_SHDW_CPTWK0_MAX;
413 }
414 mode |= AT91_SHDW_CPTWK0_(reg);
415 }
416
417 if (of_property_read_bool(np, "atmel,wakeup-rtc-timer"))
418 mode |= AT91_SHDW_RTCWKEN;
419
420 if (of_property_read_bool(np, "atmel,wakeup-rtt-timer"))
421 mode |= AT91_SHDW_RTTWKEN;
422
423 at91_shdwc_write(AT91_SHDW_MR, wakeup_mode | mode);
424
425end:
426 pm_power_off = at91sam9_poweroff;
427
428 of_node_put(np);
429}
430
431void __init at91_dt_initialize(void)
432{
433 at91_dt_rstc();
434 at91_dt_ramc();
435 at91_dt_shdwc();
436
437 /* Init clock subsystem */
438 at91_dt_clock_init();
439
440 /* Register the processor-specific clocks */
441 at91_boot_soc.register_clocks();
442
443 at91_boot_soc.init();
444}
445#endif
446
288void __init at91_initialize(unsigned long main_clock) 447void __init at91_initialize(unsigned long main_clock)
289{ 448{
290 at91_boot_soc.ioremap_registers(); 449 at91_boot_soc.ioremap_registers();
diff --git a/arch/arm/mach-bcmring/include/mach/io.h b/arch/arm/mach-bcmring/include/mach/io.h
deleted file mode 100644
index dae5e9b166ea..000000000000
--- a/arch/arm/mach-bcmring/include/mach/io.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 *
3 * Copyright (C) 1999 ARM 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
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __ASM_ARM_ARCH_IO_H
20#define __ASM_ARM_ARCH_IO_H
21
22#include <mach/hardware.h>
23
24#define IO_SPACE_LIMIT 0xffffffff
25
26/*
27 * We don't actually have real ISA nor PCI buses, but there is so many
28 * drivers out there that might just work if we fake them...
29 */
30#define __io(a) __typesafe_io(a)
31#define __mem_pci(a) (a)
32
33#endif
diff --git a/arch/arm/mach-clps711x/common.c b/arch/arm/mach-clps711x/common.c
index 8736c1acc166..3c5b5bbf24e5 100644
--- a/arch/arm/mach-clps711x/common.c
+++ b/arch/arm/mach-clps711x/common.c
@@ -37,6 +37,7 @@
37#include <asm/mach/map.h> 37#include <asm/mach/map.h>
38#include <asm/mach/time.h> 38#include <asm/mach/time.h>
39#include <asm/hardware/clps7111.h> 39#include <asm/hardware/clps7111.h>
40#include <asm/system_misc.h>
40 41
41/* 42/*
42 * This maps the generic CLPS711x registers 43 * This maps the generic CLPS711x registers
diff --git a/arch/arm/mach-clps711x/edb7211-mm.c b/arch/arm/mach-clps711x/edb7211-mm.c
index 0bea1454ae03..4372f06c9929 100644
--- a/arch/arm/mach-clps711x/edb7211-mm.c
+++ b/arch/arm/mach-clps711x/edb7211-mm.c
@@ -21,6 +21,7 @@
21 */ 21 */
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/bug.h>
24 25
25#include <mach/hardware.h> 26#include <mach/hardware.h>
26#include <asm/page.h> 27#include <asm/page.h>
diff --git a/arch/arm/mach-clps711x/include/mach/io.h b/arch/arm/mach-clps711x/include/mach/io.h
deleted file mode 100644
index 2e0b3ced8f07..000000000000
--- a/arch/arm/mach-clps711x/include/mach/io.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/arm/mach-clps711x/include/mach/io.h
3 *
4 * Copyright (C) 1999 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a)
27
28/*
29 * We don't support ins[lb]/outs[lb]. Make them fault.
30 */
31#define __raw_readsb(p,d,l) do { *(int *)0 = 0; } while (0)
32#define __raw_readsl(p,d,l) do { *(int *)0 = 0; } while (0)
33#define __raw_writesb(p,d,l) do { *(int *)0 = 0; } while (0)
34#define __raw_writesl(p,d,l) do { *(int *)0 = 0; } while (0)
35
36#endif
diff --git a/arch/arm/mach-clps711x/include/mach/uncompress.h b/arch/arm/mach-clps711x/include/mach/uncompress.h
index 7164310dea7c..35ed731b9f16 100644
--- a/arch/arm/mach-clps711x/include/mach/uncompress.h
+++ b/arch/arm/mach-clps711x/include/mach/uncompress.h
@@ -17,7 +17,6 @@
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#include <mach/io.h>
21#include <mach/hardware.h> 20#include <mach/hardware.h>
22#include <asm/hardware/clps7111.h> 21#include <asm/hardware/clps7111.h>
23 22
diff --git a/arch/arm/mach-clps711x/p720t-leds.c b/arch/arm/mach-clps711x/p720t-leds.c
index 15121446efc8..dd9a6cdbeb02 100644
--- a/arch/arm/mach-clps711x/p720t-leds.c
+++ b/arch/arm/mach-clps711x/p720t-leds.c
@@ -25,7 +25,6 @@
25 25
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <asm/leds.h> 27#include <asm/leds.h>
28#include <asm/system.h>
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30 29
31#include <asm/hardware/clps7111.h> 30#include <asm/hardware/clps7111.h>
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index 941a308e1253..031805b1428d 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -72,13 +72,13 @@ void __init cns3xxx_map_io(void)
72/* used by entry-macro.S */ 72/* used by entry-macro.S */
73void __init cns3xxx_init_irq(void) 73void __init cns3xxx_init_irq(void)
74{ 74{
75 gic_init(0, 29, __io(CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT), 75 gic_init(0, 29, IOMEM(CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT),
76 __io(CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT)); 76 IOMEM(CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT));
77} 77}
78 78
79void cns3xxx_power_off(void) 79void cns3xxx_power_off(void)
80{ 80{
81 u32 __iomem *pm_base = __io(CNS3XXX_PM_BASE_VIRT); 81 u32 __iomem *pm_base = IOMEM(CNS3XXX_PM_BASE_VIRT);
82 u32 clkctrl; 82 u32 clkctrl;
83 83
84 printk(KERN_INFO "powering system down...\n"); 84 printk(KERN_INFO "powering system down...\n");
@@ -237,7 +237,7 @@ static void __init __cns3xxx_timer_init(unsigned int timer_irq)
237 237
238static void __init cns3xxx_timer_init(void) 238static void __init cns3xxx_timer_init(void)
239{ 239{
240 cns3xxx_tmr1 = __io(CNS3XXX_TIMER1_2_3_BASE_VIRT); 240 cns3xxx_tmr1 = IOMEM(CNS3XXX_TIMER1_2_3_BASE_VIRT);
241 241
242 __cns3xxx_timer_init(IRQ_CNS3XXX_TIMER0); 242 __cns3xxx_timer_init(IRQ_CNS3XXX_TIMER0);
243} 243}
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c
index 79d1fb02c23f..1e40c99b015f 100644
--- a/arch/arm/mach-cns3xxx/devices.c
+++ b/arch/arm/mach-cns3xxx/devices.c
@@ -98,7 +98,7 @@ static struct platform_device cns3xxx_sdhci_pdev = {
98 98
99void __init cns3xxx_sdhci_init(void) 99void __init cns3xxx_sdhci_init(void)
100{ 100{
101 u32 __iomem *gpioa = __io(CNS3XXX_MISC_BASE_VIRT + 0x0014); 101 u32 __iomem *gpioa = IOMEM(CNS3XXX_MISC_BASE_VIRT + 0x0014);
102 u32 gpioa_pins = __raw_readl(gpioa); 102 u32 gpioa_pins = __raw_readl(gpioa);
103 103
104 /* MMC/SD pins share with GPIOA */ 104 /* MMC/SD pins share with GPIOA */
diff --git a/arch/arm/mach-cns3xxx/include/mach/io.h b/arch/arm/mach-cns3xxx/include/mach/io.h
deleted file mode 100644
index 33b6fc1ece7c..000000000000
--- a/arch/arm/mach-cns3xxx/include/mach/io.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright 2008 Cavium Networks
3 * Copyright 2003 ARM Limited
4 *
5 * This file is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License, Version 2, as
7 * published by the Free Software Foundation.
8 */
9#ifndef __MACH_IO_H
10#define __MACH_IO_H
11
12#define IO_SPACE_LIMIT 0xffffffff
13
14#define __io(a) __typesafe_io(a)
15#define __mem_pci(a) (a)
16
17#endif
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index d5088900af6c..a70de24d1cbc 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -36,6 +36,7 @@
36 36
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/system_info.h>
39 40
40#include <mach/cp_intc.h> 41#include <mach/cp_intc.h>
41#include <mach/da8xx.h> 42#include <mach/da8xx.h>
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 864f676eccac..3683306e0245 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -613,6 +613,113 @@ static void __init evm_init_i2c(void)
613 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); 613 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
614} 614}
615 615
616#define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
617
618/* venc standard timings */
619static struct vpbe_enc_mode_info dm644xevm_enc_std_timing[] = {
620 {
621 .name = "ntsc",
622 .timings_type = VPBE_ENC_STD,
623 .timings = {V4L2_STD_525_60},
624 .interlaced = 1,
625 .xres = 720,
626 .yres = 480,
627 .aspect = {11, 10},
628 .fps = {30000, 1001},
629 .left_margin = 0x79,
630 .upper_margin = 0x10,
631 },
632 {
633 .name = "pal",
634 .timings_type = VPBE_ENC_STD,
635 .timings = {V4L2_STD_625_50},
636 .interlaced = 1,
637 .xres = 720,
638 .yres = 576,
639 .aspect = {54, 59},
640 .fps = {25, 1},
641 .left_margin = 0x7e,
642 .upper_margin = 0x16,
643 },
644};
645
646/* venc dv preset timings */
647static struct vpbe_enc_mode_info dm644xevm_enc_preset_timing[] = {
648 {
649 .name = "480p59_94",
650 .timings_type = VPBE_ENC_DV_PRESET,
651 .timings = {V4L2_DV_480P59_94},
652 .interlaced = 0,
653 .xres = 720,
654 .yres = 480,
655 .aspect = {1, 1},
656 .fps = {5994, 100},
657 .left_margin = 0x80,
658 .upper_margin = 0x20,
659 },
660 {
661 .name = "576p50",
662 .timings_type = VPBE_ENC_DV_PRESET,
663 .timings = {V4L2_DV_576P50},
664 .interlaced = 0,
665 .xres = 720,
666 .yres = 576,
667 .aspect = {1, 1},
668 .fps = {50, 1},
669 .left_margin = 0x7e,
670 .upper_margin = 0x30,
671 },
672};
673
674/*
675 * The outputs available from VPBE + encoders. Keep the order same
676 * as that of encoders. First those from venc followed by that from
677 * encoders. Index in the output refers to index on a particular encoder.
678 * Driver uses this index to pass it to encoder when it supports more
679 * than one output. Userspace applications use index of the array to
680 * set an output.
681 */
682static struct vpbe_output dm644xevm_vpbe_outputs[] = {
683 {
684 .output = {
685 .index = 0,
686 .name = "Composite",
687 .type = V4L2_OUTPUT_TYPE_ANALOG,
688 .std = VENC_STD_ALL,
689 .capabilities = V4L2_OUT_CAP_STD,
690 },
691 .subdev_name = VPBE_VENC_SUBDEV_NAME,
692 .default_mode = "ntsc",
693 .num_modes = ARRAY_SIZE(dm644xevm_enc_std_timing),
694 .modes = dm644xevm_enc_std_timing,
695 },
696 {
697 .output = {
698 .index = 1,
699 .name = "Component",
700 .type = V4L2_OUTPUT_TYPE_ANALOG,
701 .capabilities = V4L2_OUT_CAP_PRESETS,
702 },
703 .subdev_name = VPBE_VENC_SUBDEV_NAME,
704 .default_mode = "480p59_94",
705 .num_modes = ARRAY_SIZE(dm644xevm_enc_preset_timing),
706 .modes = dm644xevm_enc_preset_timing,
707 },
708};
709
710static struct vpbe_config dm644xevm_display_cfg = {
711 .module_name = "dm644x-vpbe-display",
712 .i2c_adapter_id = 1,
713 .osd = {
714 .module_name = VPBE_OSD_SUBDEV_NAME,
715 },
716 .venc = {
717 .module_name = VPBE_VENC_SUBDEV_NAME,
718 },
719 .num_outputs = ARRAY_SIZE(dm644xevm_vpbe_outputs),
720 .outputs = dm644xevm_vpbe_outputs,
721};
722
616static struct platform_device *davinci_evm_devices[] __initdata = { 723static struct platform_device *davinci_evm_devices[] __initdata = {
617 &davinci_fb_device, 724 &davinci_fb_device,
618 &rtc_dev, 725 &rtc_dev,
@@ -696,7 +803,7 @@ static __init void davinci_evm_init(void)
696 evm_init_i2c(); 803 evm_init_i2c();
697 804
698 davinci_setup_mmc(0, &dm6446evm_mmc_config); 805 davinci_setup_mmc(0, &dm6446evm_mmc_config);
699 dm644x_init_video(&dm644xevm_capture_cfg); 806 dm644x_init_video(&dm644xevm_capture_cfg, &dm644xevm_display_cfg);
700 807
701 davinci_serial_init(&uart_config); 808 davinci_serial_init(&uart_config);
702 dm644x_init_asp(&dm644x_evm_snd_data); 809 dm644x_init_asp(&dm644x_evm_snd_data);
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
index a30c7c5a6d83..9107691adbdb 100644
--- a/arch/arm/mach-davinci/cpuidle.c
+++ b/arch/arm/mach-davinci/cpuidle.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/export.h> 19#include <linux/export.h>
20#include <asm/proc-fns.h> 20#include <asm/proc-fns.h>
21#include <asm/cpuidle.h>
21 22
22#include <mach/cpuidle.h> 23#include <mach/cpuidle.h>
23#include <mach/ddr2.h> 24#include <mach/ddr2.h>
@@ -30,12 +31,43 @@ struct davinci_ops {
30 u32 flags; 31 u32 flags;
31}; 32};
32 33
34/* Actual code that puts the SoC in different idle states */
35static int davinci_enter_idle(struct cpuidle_device *dev,
36 struct cpuidle_driver *drv,
37 int index)
38{
39 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
40 struct davinci_ops *ops = cpuidle_get_statedata(state_usage);
41
42 if (ops && ops->enter)
43 ops->enter(ops->flags);
44
45 index = cpuidle_wrap_enter(dev, drv, index,
46 arm_cpuidle_simple_enter);
47
48 if (ops && ops->exit)
49 ops->exit(ops->flags);
50
51 return index;
52}
53
33/* fields in davinci_ops.flags */ 54/* fields in davinci_ops.flags */
34#define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0) 55#define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0)
35 56
36static struct cpuidle_driver davinci_idle_driver = { 57static struct cpuidle_driver davinci_idle_driver = {
37 .name = "cpuidle-davinci", 58 .name = "cpuidle-davinci",
38 .owner = THIS_MODULE, 59 .owner = THIS_MODULE,
60 .en_core_tk_irqen = 1,
61 .states[0] = ARM_CPUIDLE_WFI_STATE,
62 .states[1] = {
63 .enter = davinci_enter_idle,
64 .exit_latency = 10,
65 .target_residency = 100000,
66 .flags = CPUIDLE_FLAG_TIME_VALID,
67 .name = "DDR SR",
68 .desc = "WFI and DDR Self Refresh",
69 },
70 .state_count = DAVINCI_CPUIDLE_MAX_STATES,
39}; 71};
40 72
41static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); 73static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device);
@@ -77,41 +109,10 @@ static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = {
77 }, 109 },
78}; 110};
79 111
80/* Actual code that puts the SoC in different idle states */
81static int davinci_enter_idle(struct cpuidle_device *dev,
82 struct cpuidle_driver *drv,
83 int index)
84{
85 struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
86 struct davinci_ops *ops = cpuidle_get_statedata(state_usage);
87 struct timeval before, after;
88 int idle_time;
89
90 local_irq_disable();
91 do_gettimeofday(&before);
92
93 if (ops && ops->enter)
94 ops->enter(ops->flags);
95 /* Wait for interrupt state */
96 cpu_do_idle();
97 if (ops && ops->exit)
98 ops->exit(ops->flags);
99
100 do_gettimeofday(&after);
101 local_irq_enable();
102 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
103 (after.tv_usec - before.tv_usec);
104
105 dev->last_residency = idle_time;
106
107 return index;
108}
109
110static int __init davinci_cpuidle_probe(struct platform_device *pdev) 112static int __init davinci_cpuidle_probe(struct platform_device *pdev)
111{ 113{
112 int ret; 114 int ret;
113 struct cpuidle_device *device; 115 struct cpuidle_device *device;
114 struct cpuidle_driver *driver = &davinci_idle_driver;
115 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; 116 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
116 117
117 device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); 118 device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
@@ -123,27 +124,11 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
123 124
124 ddr2_reg_base = pdata->ddr2_ctlr_base; 125 ddr2_reg_base = pdata->ddr2_ctlr_base;
125 126
126 /* Wait for interrupt state */
127 driver->states[0].enter = davinci_enter_idle;
128 driver->states[0].exit_latency = 1;
129 driver->states[0].target_residency = 10000;
130 driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
131 strcpy(driver->states[0].name, "WFI");
132 strcpy(driver->states[0].desc, "Wait for interrupt");
133
134 /* Wait for interrupt and DDR self refresh state */
135 driver->states[1].enter = davinci_enter_idle;
136 driver->states[1].exit_latency = 10;
137 driver->states[1].target_residency = 10000;
138 driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
139 strcpy(driver->states[1].name, "DDR SR");
140 strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
141 if (pdata->ddr2_pdown) 127 if (pdata->ddr2_pdown)
142 davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; 128 davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN;
143 cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]); 129 cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]);
144 130
145 device->state_count = DAVINCI_CPUIDLE_MAX_STATES; 131 device->state_count = DAVINCI_CPUIDLE_MAX_STATES;
146 driver->state_count = DAVINCI_CPUIDLE_MAX_STATES;
147 132
148 ret = cpuidle_register_driver(&davinci_idle_driver); 133 ret = cpuidle_register_driver(&davinci_idle_driver);
149 if (ret) { 134 if (ret) {
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 9d708034b57f..3e519dad5bb9 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -29,9 +29,15 @@
29 29
30#include <media/davinci/vpfe_capture.h> 30#include <media/davinci/vpfe_capture.h>
31#include <media/davinci/vpif_types.h> 31#include <media/davinci/vpif_types.h>
32#include <media/davinci/vpss.h>
33#include <media/davinci/vpbe_types.h>
34#include <media/davinci/vpbe_venc.h>
35#include <media/davinci/vpbe.h>
36#include <media/davinci/vpbe_osd.h>
32 37
33#define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000 38#define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000
34#define SYSMOD_VIDCLKCTL 0x38 39#define SYSMOD_VIDCLKCTL 0x38
40#define SYSMOD_VPSS_CLKCTL 0x44
35#define SYSMOD_VDD3P3VPWDN 0x48 41#define SYSMOD_VDD3P3VPWDN 0x48
36#define SYSMOD_VSCLKDIS 0x6c 42#define SYSMOD_VSCLKDIS 0x6c
37#define SYSMOD_PUPDCTL1 0x7c 43#define SYSMOD_PUPDCTL1 0x7c
@@ -83,7 +89,7 @@ void dm365_set_vpfe_config(struct vpfe_config *cfg);
83/* DM644x function declarations */ 89/* DM644x function declarations */
84void __init dm644x_init(void); 90void __init dm644x_init(void);
85void __init dm644x_init_asp(struct snd_platform_data *pdata); 91void __init dm644x_init_asp(struct snd_platform_data *pdata);
86int __init dm644x_init_video(struct vpfe_config *); 92int __init dm644x_init_video(struct vpfe_config *, struct vpbe_config *);
87 93
88/* DM646x function declarations */ 94/* DM646x function declarations */
89void __init dm646x_init(void); 95void __init dm646x_init(void);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 23e81cafba8d..c8b866657fcb 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -627,7 +627,7 @@ static struct resource dm644x_vpfe_resources[] = {
627 }, 627 },
628}; 628};
629 629
630static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32); 630static u64 dm644x_video_dma_mask = DMA_BIT_MASK(32);
631static struct resource dm644x_ccdc_resource[] = { 631static struct resource dm644x_ccdc_resource[] = {
632 /* CCDC Base address */ 632 /* CCDC Base address */
633 { 633 {
@@ -643,7 +643,7 @@ static struct platform_device dm644x_ccdc_dev = {
643 .num_resources = ARRAY_SIZE(dm644x_ccdc_resource), 643 .num_resources = ARRAY_SIZE(dm644x_ccdc_resource),
644 .resource = dm644x_ccdc_resource, 644 .resource = dm644x_ccdc_resource,
645 .dev = { 645 .dev = {
646 .dma_mask = &vpfe_capture_dma_mask, 646 .dma_mask = &dm644x_video_dma_mask,
647 .coherent_dma_mask = DMA_BIT_MASK(32), 647 .coherent_dma_mask = DMA_BIT_MASK(32),
648 }, 648 },
649}; 649};
@@ -654,7 +654,134 @@ static struct platform_device dm644x_vpfe_dev = {
654 .num_resources = ARRAY_SIZE(dm644x_vpfe_resources), 654 .num_resources = ARRAY_SIZE(dm644x_vpfe_resources),
655 .resource = dm644x_vpfe_resources, 655 .resource = dm644x_vpfe_resources,
656 .dev = { 656 .dev = {
657 .dma_mask = &vpfe_capture_dma_mask, 657 .dma_mask = &dm644x_video_dma_mask,
658 .coherent_dma_mask = DMA_BIT_MASK(32),
659 },
660};
661
662#define DM644X_OSD_BASE 0x01c72600
663
664static struct resource dm644x_osd_resources[] = {
665 {
666 .start = DM644X_OSD_BASE,
667 .end = DM644X_OSD_BASE + 0x1ff,
668 .flags = IORESOURCE_MEM,
669 },
670};
671
672static struct osd_platform_data dm644x_osd_data = {
673 .vpbe_type = VPBE_VERSION_1,
674};
675
676static struct platform_device dm644x_osd_dev = {
677 .name = VPBE_OSD_SUBDEV_NAME,
678 .id = -1,
679 .num_resources = ARRAY_SIZE(dm644x_osd_resources),
680 .resource = dm644x_osd_resources,
681 .dev = {
682 .dma_mask = &dm644x_video_dma_mask,
683 .coherent_dma_mask = DMA_BIT_MASK(32),
684 .platform_data = &dm644x_osd_data,
685 },
686};
687
688#define DM644X_VENC_BASE 0x01c72400
689
690static struct resource dm644x_venc_resources[] = {
691 {
692 .start = DM644X_VENC_BASE,
693 .end = DM644X_VENC_BASE + 0x17f,
694 .flags = IORESOURCE_MEM,
695 },
696};
697
698#define DM644X_VPSS_MUXSEL_PLL2_MODE BIT(0)
699#define DM644X_VPSS_MUXSEL_VPBECLK_MODE BIT(1)
700#define DM644X_VPSS_VENCLKEN BIT(3)
701#define DM644X_VPSS_DACCLKEN BIT(4)
702
703static int dm644x_venc_setup_clock(enum vpbe_enc_timings_type type,
704 unsigned int mode)
705{
706 int ret = 0;
707 u32 v = DM644X_VPSS_VENCLKEN;
708
709 switch (type) {
710 case VPBE_ENC_STD:
711 v |= DM644X_VPSS_DACCLKEN;
712 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
713 break;
714 case VPBE_ENC_DV_PRESET:
715 switch (mode) {
716 case V4L2_DV_480P59_94:
717 case V4L2_DV_576P50:
718 v |= DM644X_VPSS_MUXSEL_PLL2_MODE |
719 DM644X_VPSS_DACCLKEN;
720 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
721 break;
722 case V4L2_DV_720P60:
723 case V4L2_DV_1080I60:
724 case V4L2_DV_1080P30:
725 /*
726 * For HD, use external clock source since
727 * HD requires higher clock rate
728 */
729 v |= DM644X_VPSS_MUXSEL_VPBECLK_MODE;
730 writel(v, DAVINCI_SYSMOD_VIRT(SYSMOD_VPSS_CLKCTL));
731 break;
732 default:
733 ret = -EINVAL;
734 break;
735 }
736 break;
737 default:
738 ret = -EINVAL;
739 }
740
741 return ret;
742}
743
744static struct resource dm644x_v4l2_disp_resources[] = {
745 {
746 .start = IRQ_VENCINT,
747 .end = IRQ_VENCINT,
748 .flags = IORESOURCE_IRQ,
749 },
750};
751
752static struct platform_device dm644x_vpbe_display = {
753 .name = "vpbe-v4l2",
754 .id = -1,
755 .num_resources = ARRAY_SIZE(dm644x_v4l2_disp_resources),
756 .resource = dm644x_v4l2_disp_resources,
757 .dev = {
758 .dma_mask = &dm644x_video_dma_mask,
759 .coherent_dma_mask = DMA_BIT_MASK(32),
760 },
761};
762
763static struct venc_platform_data dm644x_venc_pdata = {
764 .venc_type = VPBE_VERSION_1,
765 .setup_clock = dm644x_venc_setup_clock,
766};
767
768static struct platform_device dm644x_venc_dev = {
769 .name = VPBE_VENC_SUBDEV_NAME,
770 .id = -1,
771 .num_resources = ARRAY_SIZE(dm644x_venc_resources),
772 .resource = dm644x_venc_resources,
773 .dev = {
774 .dma_mask = &dm644x_video_dma_mask,
775 .coherent_dma_mask = DMA_BIT_MASK(32),
776 .platform_data = &dm644x_venc_pdata,
777 },
778};
779
780static struct platform_device dm644x_vpbe_dev = {
781 .name = "vpbe_controller",
782 .id = -1,
783 .dev = {
784 .dma_mask = &dm644x_video_dma_mask,
658 .coherent_dma_mask = DMA_BIT_MASK(32), 785 .coherent_dma_mask = DMA_BIT_MASK(32),
659 }, 786 },
660}; 787};
@@ -786,17 +913,30 @@ void __init dm644x_init(void)
786 davinci_map_sysmod(); 913 davinci_map_sysmod();
787} 914}
788 915
789int __init dm644x_init_video(struct vpfe_config *vpfe_cfg) 916int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
917 struct vpbe_config *vpbe_cfg)
790{ 918{
791 dm644x_vpfe_dev.dev.platform_data = vpfe_cfg; 919 if (vpfe_cfg || vpbe_cfg)
792 920 platform_device_register(&dm644x_vpss_device);
793 /* Add ccdc clock aliases */ 921
794 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL); 922 if (vpfe_cfg) {
795 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL); 923 dm644x_vpfe_dev.dev.platform_data = vpfe_cfg;
796 924 platform_device_register(&dm644x_ccdc_dev);
797 platform_device_register(&dm644x_vpss_device); 925 platform_device_register(&dm644x_vpfe_dev);
798 platform_device_register(&dm644x_ccdc_dev); 926 /* Add ccdc clock aliases */
799 platform_device_register(&dm644x_vpfe_dev); 927 clk_add_alias("master", dm644x_ccdc_dev.name,
928 "vpss_master", NULL);
929 clk_add_alias("slave", dm644x_ccdc_dev.name,
930 "vpss_slave", NULL);
931 }
932
933 if (vpbe_cfg) {
934 dm644x_vpbe_dev.dev.platform_data = vpbe_cfg;
935 platform_device_register(&dm644x_osd_dev);
936 platform_device_register(&dm644x_venc_dev);
937 platform_device_register(&dm644x_vpbe_dev);
938 platform_device_register(&dm644x_vpbe_display);
939 }
800 940
801 return 0; 941 return 0;
802} 942}
diff --git a/arch/arm/mach-davinci/include/mach/entry-macro.S b/arch/arm/mach-davinci/include/mach/entry-macro.S
index c1661d2feca9..768b3c060214 100644
--- a/arch/arm/mach-davinci/include/mach/entry-macro.S
+++ b/arch/arm/mach-davinci/include/mach/entry-macro.S
@@ -8,7 +8,6 @@
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
10 */ 10 */
11#include <mach/io.h>
12#include <mach/irqs.h> 11#include <mach/irqs.h>
13 12
14 .macro get_irqnr_preamble, base, tmp 13 .macro get_irqnr_preamble, base, tmp
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
index 0209b1fc22a1..2184691ebc2f 100644
--- a/arch/arm/mach-davinci/include/mach/hardware.h
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -30,10 +30,4 @@
30#define __IO_ADDRESS(x) ((x) + IO_OFFSET) 30#define __IO_ADDRESS(x) ((x) + IO_OFFSET)
31#define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) 31#define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa))
32 32
33#ifdef __ASSEMBLER__
34#define IOMEM(x) x
35#else
36#define IOMEM(x) ((void __force __iomem *)(x))
37#endif
38
39#endif /* __ASM_ARCH_HARDWARE_H */ 33#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
deleted file mode 100644
index b2267d1e1a71..000000000000
--- a/arch/arm/mach-davinci/include/mach/io.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * DaVinci IO address definitions
3 *
4 * Copied from include/asm/arm/arch-omap/io.h
5 *
6 * 2007 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16/*
17 * We don't actually have real ISA nor PCI buses, but there is so many
18 * drivers out there that might just work if we fake them...
19 */
20#define __io(a) __typesafe_io(a)
21#define __mem_pci(a) (a)
22#define __mem_isa(a) (a)
23
24#endif /* __ASM_ARCH_IO_H */
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 9dc7cf9664fe..da2fb2c2155a 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -25,6 +25,8 @@
25 25
26#include <mach/serial.h> 26#include <mach/serial.h>
27 27
28#define IOMEM(x) ((void __force __iomem *)(x))
29
28u32 *uart; 30u32 *uart;
29 31
30/* PORT_16C550A, in polled non-fifo mode */ 32/* PORT_16C550A, in polled non-fifo mode */
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index e1969ce904dc..75da315b6587 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -19,11 +19,14 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21 21
22#include <mach/hardware.h> 22#include <asm/sched_clock.h>
23#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25
25#include <mach/cputype.h> 26#include <mach/cputype.h>
27#include <mach/hardware.h>
26#include <mach/time.h> 28#include <mach/time.h>
29
27#include "clock.h" 30#include "clock.h"
28 31
29static struct clock_event_device clockevent_davinci; 32static struct clock_event_device clockevent_davinci;
@@ -272,19 +275,9 @@ static cycle_t read_cycles(struct clocksource *cs)
272 return (cycles_t)timer32_read(t); 275 return (cycles_t)timer32_read(t);
273} 276}
274 277
275/*
276 * Kernel assumes that sched_clock can be called early but may not have
277 * things ready yet.
278 */
279static cycle_t read_dummy(struct clocksource *cs)
280{
281 return 0;
282}
283
284
285static struct clocksource clocksource_davinci = { 278static struct clocksource clocksource_davinci = {
286 .rating = 300, 279 .rating = 300,
287 .read = read_dummy, 280 .read = read_cycles,
288 .mask = CLOCKSOURCE_MASK(32), 281 .mask = CLOCKSOURCE_MASK(32),
289 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 282 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
290}; 283};
@@ -292,12 +285,9 @@ static struct clocksource clocksource_davinci = {
292/* 285/*
293 * Overwrite weak default sched_clock with something more precise 286 * Overwrite weak default sched_clock with something more precise
294 */ 287 */
295unsigned long long notrace sched_clock(void) 288static u32 notrace davinci_read_sched_clock(void)
296{ 289{
297 const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci); 290 return timer32_read(&timers[TID_CLOCKSOURCE]);
298
299 return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
300 clocksource_davinci.shift);
301} 291}
302 292
303/* 293/*
@@ -397,12 +387,14 @@ static void __init davinci_timer_init(void)
397 davinci_clock_tick_rate = clk_get_rate(timer_clk); 387 davinci_clock_tick_rate = clk_get_rate(timer_clk);
398 388
399 /* setup clocksource */ 389 /* setup clocksource */
400 clocksource_davinci.read = read_cycles;
401 clocksource_davinci.name = id_to_name[clocksource_id]; 390 clocksource_davinci.name = id_to_name[clocksource_id];
402 if (clocksource_register_hz(&clocksource_davinci, 391 if (clocksource_register_hz(&clocksource_davinci,
403 davinci_clock_tick_rate)) 392 davinci_clock_tick_rate))
404 printk(err, clocksource_davinci.name); 393 printk(err, clocksource_davinci.name);
405 394
395 setup_sched_clock(davinci_read_sched_clock, 32,
396 davinci_clock_tick_rate);
397
406 /* setup clockevent */ 398 /* setup clockevent */
407 clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; 399 clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id];
408 clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC, 400 clockevent_davinci.mult = div_sc(davinci_clock_tick_rate, NSEC_PER_SEC,
diff --git a/arch/arm/mach-dove/addr-map.c b/arch/arm/mach-dove/addr-map.c
index 98b8c83b09ab..2a06c0163418 100644
--- a/arch/arm/mach-dove/addr-map.c
+++ b/arch/arm/mach-dove/addr-map.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
16#include <asm/setup.h> 16#include <asm/setup.h>
17#include <mach/dove.h>
17#include <plat/addr-map.h> 18#include <plat/addr-map.h>
18#include "common.h" 19#include "common.h"
19 20
diff --git a/arch/arm/mach-dove/include/mach/io.h b/arch/arm/mach-dove/include/mach/io.h
index eb4936ff90ad..29c8b85355a5 100644
--- a/arch/arm/mach-dove/include/mach/io.h
+++ b/arch/arm/mach-dove/include/mach/io.h
@@ -15,6 +15,5 @@
15 15
16#define __io(a) ((void __iomem *)(((a) - DOVE_PCIE0_IO_BUS_BASE) + \ 16#define __io(a) ((void __iomem *)(((a) - DOVE_PCIE0_IO_BUS_BASE) + \
17 DOVE_PCIE0_IO_VIRT_BASE)) 17 DOVE_PCIE0_IO_VIRT_BASE))
18#define __mem_pci(a) (a)
19 18
20#endif 19#endif
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index 804c9122b7b3..6f8068692edf 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -22,7 +22,7 @@
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/system.h> 25#include <asm/system_misc.h>
26 26
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
@@ -30,10 +30,7 @@
30 30
31#include <asm/mach/time.h> 31#include <asm/mach/time.h>
32 32
33#define IRQ_MASK 0xfe000000 /* read */ 33#include "core.h"
34#define IRQ_MSET 0xfe000000 /* write */
35#define IRQ_STAT 0xff000000 /* read */
36#define IRQ_MCLR 0xff000000 /* write */
37 34
38static void ebsa110_mask_irq(struct irq_data *d) 35static void ebsa110_mask_irq(struct irq_data *d)
39{ 36{
@@ -79,22 +76,22 @@ static struct map_desc ebsa110_io_desc[] __initdata = {
79 { /* IRQ_STAT/IRQ_MCLR */ 76 { /* IRQ_STAT/IRQ_MCLR */
80 .virtual = IRQ_STAT, 77 .virtual = IRQ_STAT,
81 .pfn = __phys_to_pfn(TRICK4_PHYS), 78 .pfn = __phys_to_pfn(TRICK4_PHYS),
82 .length = PGDIR_SIZE, 79 .length = TRICK4_SIZE,
83 .type = MT_DEVICE 80 .type = MT_DEVICE
84 }, { /* IRQ_MASK/IRQ_MSET */ 81 }, { /* IRQ_MASK/IRQ_MSET */
85 .virtual = IRQ_MASK, 82 .virtual = IRQ_MASK,
86 .pfn = __phys_to_pfn(TRICK3_PHYS), 83 .pfn = __phys_to_pfn(TRICK3_PHYS),
87 .length = PGDIR_SIZE, 84 .length = TRICK3_SIZE,
88 .type = MT_DEVICE 85 .type = MT_DEVICE
89 }, { /* SOFT_BASE */ 86 }, { /* SOFT_BASE */
90 .virtual = SOFT_BASE, 87 .virtual = SOFT_BASE,
91 .pfn = __phys_to_pfn(TRICK1_PHYS), 88 .pfn = __phys_to_pfn(TRICK1_PHYS),
92 .length = PGDIR_SIZE, 89 .length = TRICK1_SIZE,
93 .type = MT_DEVICE 90 .type = MT_DEVICE
94 }, { /* PIT_BASE */ 91 }, { /* PIT_BASE */
95 .virtual = PIT_BASE, 92 .virtual = PIT_BASE,
96 .pfn = __phys_to_pfn(TRICK0_PHYS), 93 .pfn = __phys_to_pfn(TRICK0_PHYS),
97 .length = PGDIR_SIZE, 94 .length = TRICK0_SIZE,
98 .type = MT_DEVICE 95 .type = MT_DEVICE
99 }, 96 },
100 97
@@ -119,6 +116,20 @@ static void __init ebsa110_map_io(void)
119 iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc)); 116 iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc));
120} 117}
121 118
119static void __iomem *ebsa110_ioremap_caller(unsigned long cookie, size_t size,
120 unsigned int flags, void *caller)
121{
122 return (void __iomem *)cookie;
123}
124
125static void ebsa110_iounmap(volatile void __iomem *io_addr)
126{}
127
128static void __init ebsa110_init_early(void)
129{
130 arch_ioremap_caller = ebsa110_ioremap_caller;
131 arch_iounmap = ebsa110_iounmap;
132}
122 133
123#define PIT_CTRL (PIT_BASE + 0x0d) 134#define PIT_CTRL (PIT_BASE + 0x0d)
124#define PIT_T2 (PIT_BASE + 0x09) 135#define PIT_T2 (PIT_BASE + 0x09)
@@ -315,6 +326,7 @@ MACHINE_START(EBSA110, "EBSA110")
315 .reserve_lp2 = 1, 326 .reserve_lp2 = 1,
316 .restart_mode = 's', 327 .restart_mode = 's',
317 .map_io = ebsa110_map_io, 328 .map_io = ebsa110_map_io,
329 .init_early = ebsa110_init_early,
318 .init_irq = ebsa110_init_irq, 330 .init_irq = ebsa110_init_irq,
319 .timer = &ebsa110_timer, 331 .timer = &ebsa110_timer,
320 .restart = ebsa110_restart, 332 .restart = ebsa110_restart,
diff --git a/arch/arm/mach-ebsa110/core.h b/arch/arm/mach-ebsa110/core.h
new file mode 100644
index 000000000000..c93c9e43012d
--- /dev/null
+++ b/arch/arm/mach-ebsa110/core.h
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 1996-2000 Russell King.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This file contains the core hardware definitions of the EBSA-110.
9 */
10#ifndef CORE_H
11#define CORE_H
12
13/* Physical addresses/sizes */
14#define ISAMEM_PHYS 0xe0000000
15#define ISAMEM_SIZE 0x10000000
16
17#define ISAIO_PHYS 0xf0000000
18#define ISAIO_SIZE PGDIR_SIZE
19
20#define TRICK0_PHYS 0xf2000000
21#define TRICK0_SIZE PGDIR_SIZE
22#define TRICK1_PHYS 0xf2400000
23#define TRICK1_SIZE PGDIR_SIZE
24#define TRICK2_PHYS 0xf2800000
25#define TRICK3_PHYS 0xf2c00000
26#define TRICK3_SIZE PGDIR_SIZE
27#define TRICK4_PHYS 0xf3000000
28#define TRICK4_SIZE PGDIR_SIZE
29#define TRICK5_PHYS 0xf3400000
30#define TRICK6_PHYS 0xf3800000
31#define TRICK7_PHYS 0xf3c00000
32
33/* Virtual addresses */
34#define PIT_BASE 0xfc000000 /* trick 0 */
35#define SOFT_BASE 0xfd000000 /* trick 1 */
36#define IRQ_MASK 0xfe000000 /* trick 3 - read */
37#define IRQ_MSET 0xfe000000 /* trick 3 - write */
38#define IRQ_STAT 0xff000000 /* trick 4 - read */
39#define IRQ_MCLR 0xff000000 /* trick 4 - write */
40
41#endif
diff --git a/arch/arm/mach-ebsa110/include/mach/hardware.h b/arch/arm/mach-ebsa110/include/mach/hardware.h
index 4b2fb7743909..f4e5407bd004 100644
--- a/arch/arm/mach-ebsa110/include/mach/hardware.h
+++ b/arch/arm/mach-ebsa110/include/mach/hardware.h
@@ -12,48 +12,9 @@
12#ifndef __ASM_ARCH_HARDWARE_H 12#ifndef __ASM_ARCH_HARDWARE_H
13#define __ASM_ARCH_HARDWARE_H 13#define __ASM_ARCH_HARDWARE_H
14 14
15/*
16 * The EBSA110 has a weird "ISA IO" region:
17 *
18 * Region 0 (addr = 0xf0000000 + io << 2)
19 * --------------------------------------------------------
20 * Physical region IO region
21 * f0000fe0 - f0000ffc 3f8 - 3ff ttyS0
22 * f0000e60 - f0000e64 398 - 399
23 * f0000de0 - f0000dfc 378 - 37f lp0
24 * f0000be0 - f0000bfc 2f8 - 2ff ttyS1
25 *
26 * Region 1 (addr = 0xf0000000 + (io & ~1) << 1 + (io & 1))
27 * --------------------------------------------------------
28 * Physical region IO region
29 * f00014f1 a79 pnp write data
30 * f00007c0 - f00007c1 3e0 - 3e1 pcmcia
31 * f00004f1 279 pnp address
32 * f0000440 - f000046c 220 - 236 eth0
33 * f0000405 203 pnp read data
34 */
35
36#define ISAMEM_PHYS 0xe0000000
37#define ISAMEM_SIZE 0x10000000
38
39#define ISAIO_PHYS 0xf0000000
40#define ISAIO_SIZE PGDIR_SIZE
41
42#define TRICK0_PHYS 0xf2000000
43#define TRICK1_PHYS 0xf2400000
44#define TRICK2_PHYS 0xf2800000
45#define TRICK3_PHYS 0xf2c00000
46#define TRICK4_PHYS 0xf3000000
47#define TRICK5_PHYS 0xf3400000
48#define TRICK6_PHYS 0xf3800000
49#define TRICK7_PHYS 0xf3c00000
50
51#define ISAMEM_BASE 0xe0000000 15#define ISAMEM_BASE 0xe0000000
52#define ISAIO_BASE 0xf0000000 16#define ISAIO_BASE 0xf0000000
53 17
54#define PIT_BASE 0xfc000000
55#define SOFT_BASE 0xfd000000
56
57/* 18/*
58 * RAM definitions 19 * RAM definitions
59 */ 20 */
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
index 44679db672fb..11bb0799424b 100644
--- a/arch/arm/mach-ebsa110/include/mach/io.h
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -62,15 +62,6 @@ void __writel(u32 val, void __iomem *addr);
62#define writew(v,b) __writew(v,b) 62#define writew(v,b) __writew(v,b)
63#define writel(v,b) __writel(v,b) 63#define writel(v,b) __writel(v,b)
64 64
65static inline void __iomem *__arch_ioremap(unsigned long cookie, size_t size,
66 unsigned int flags)
67{
68 return (void __iomem *)cookie;
69}
70
71#define __arch_ioremap __arch_ioremap
72#define __arch_iounmap(cookie) do { } while (0)
73
74extern void insb(unsigned int port, void *buf, int sz); 65extern void insb(unsigned int port, void *buf, int sz);
75extern void insw(unsigned int port, void *buf, int sz); 66extern void insw(unsigned int port, void *buf, int sz);
76extern void insl(unsigned int port, void *buf, int sz); 67extern void insl(unsigned int port, void *buf, int sz);
diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
index c52e3047a7eb..756cc377a73d 100644
--- a/arch/arm/mach-ebsa110/io.c
+++ b/arch/arm/mach-ebsa110/io.c
@@ -177,6 +177,26 @@ void writesl(void __iomem *addr, const void *data, int len)
177} 177}
178EXPORT_SYMBOL(writesl); 178EXPORT_SYMBOL(writesl);
179 179
180/*
181 * The EBSA110 has a weird "ISA IO" region:
182 *
183 * Region 0 (addr = 0xf0000000 + io << 2)
184 * --------------------------------------------------------
185 * Physical region IO region
186 * f0000fe0 - f0000ffc 3f8 - 3ff ttyS0
187 * f0000e60 - f0000e64 398 - 399
188 * f0000de0 - f0000dfc 378 - 37f lp0
189 * f0000be0 - f0000bfc 2f8 - 2ff ttyS1
190 *
191 * Region 1 (addr = 0xf0000000 + (io & ~1) << 1 + (io & 1))
192 * --------------------------------------------------------
193 * Physical region IO region
194 * f00014f1 a79 pnp write data
195 * f00007c0 - f00007c1 3e0 - 3e1 pcmcia
196 * f00004f1 279 pnp address
197 * f0000440 - f000046c 220 - 236 eth0
198 * f0000405 203 pnp read data
199 */
180#define SUPERIO_PORT(p) \ 200#define SUPERIO_PORT(p) \
181 (((p) >> 3) == (0x3f8 >> 3) || \ 201 (((p) >> 3) == (0x3f8 >> 3) || \
182 ((p) >> 3) == (0x2f8 >> 3) || \ 202 ((p) >> 3) == (0x2f8 >> 3) || \
diff --git a/arch/arm/mach-ebsa110/leds.c b/arch/arm/mach-ebsa110/leds.c
index 6a6ea57c2a4e..99e14e362500 100644
--- a/arch/arm/mach-ebsa110/leds.c
+++ b/arch/arm/mach-ebsa110/leds.c
@@ -17,9 +17,10 @@
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <asm/leds.h> 19#include <asm/leds.h>
20#include <asm/system.h>
21#include <asm/mach-types.h> 20#include <asm/mach-types.h>
22 21
22#include "core.h"
23
23static spinlock_t leds_lock; 24static spinlock_t leds_lock;
24 25
25static void ebsa110_leds_event(led_event_t ledevt) 26static void ebsa110_leds_event(led_event_t ledevt)
diff --git a/arch/arm/mach-ep93xx/include/mach/io.h b/arch/arm/mach-ep93xx/include/mach/io.h
deleted file mode 100644
index 594b77f21054..000000000000
--- a/arch/arm/mach-ep93xx/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-ep93xx/include/mach/io.h
3 */
4
5#ifndef __ASM_MACH_IO_H
6#define __ASM_MACH_IO_H
7
8#define IO_SPACE_LIMIT 0xffffffff
9
10#define __io(p) __typesafe_io(p)
11#define __mem_pci(p) (p)
12
13/*
14 * A typesafe __io() variation for variable initialisers
15 */
16#ifdef __ASSEMBLER__
17#define IOMEM(p) p
18#else
19#define IOMEM(p) ((void __iomem __force *)(p))
20#endif
21
22#endif /* __ASM_MACH_IO_H */
diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index 2bf7d6e23989..0491ceef1cda 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -11,18 +11,19 @@ if ARCH_EXYNOS
11 11
12menu "SAMSUNG EXYNOS SoCs Support" 12menu "SAMSUNG EXYNOS SoCs Support"
13 13
14choice
15 prompt "EXYNOS System Type"
16 default ARCH_EXYNOS4
17
18config ARCH_EXYNOS4 14config ARCH_EXYNOS4
19 bool "SAMSUNG EXYNOS4" 15 bool "SAMSUNG EXYNOS4"
16 default y
20 select HAVE_SMP 17 select HAVE_SMP
21 select MIGHT_HAVE_CACHE_L2X0 18 select MIGHT_HAVE_CACHE_L2X0
22 help 19 help
23 Samsung EXYNOS4 SoCs based systems 20 Samsung EXYNOS4 SoCs based systems
24 21
25endchoice 22config ARCH_EXYNOS5
23 bool "SAMSUNG EXYNOS5"
24 select HAVE_SMP
25 help
26 Samsung EXYNOS5 (Cortex-A15) SoC based systems
26 27
27comment "EXYNOS SoCs" 28comment "EXYNOS SoCs"
28 29
@@ -56,6 +57,13 @@ config SOC_EXYNOS4412
56 help 57 help
57 Enable EXYNOS4412 SoC support 58 Enable EXYNOS4412 SoC support
58 59
60config SOC_EXYNOS5250
61 bool "SAMSUNG EXYNOS5250"
62 default y
63 depends on ARCH_EXYNOS5
64 help
65 Enable EXYNOS5250 SoC support
66
59config EXYNOS4_MCT 67config EXYNOS4_MCT
60 bool 68 bool
61 default y 69 default y
@@ -356,7 +364,7 @@ config MACH_SMDK4412
356 Machine support for Samsung SMDK4412 364 Machine support for Samsung SMDK4412
357endif 365endif
358 366
359comment "Flattened Device Tree based board for Exynos4 based SoC" 367comment "Flattened Device Tree based board for EXYNOS SoCs"
360 368
361config MACH_EXYNOS4_DT 369config MACH_EXYNOS4_DT
362 bool "Samsung Exynos4 Machine using device tree" 370 bool "Samsung Exynos4 Machine using device tree"
@@ -370,6 +378,15 @@ config MACH_EXYNOS4_DT
370 Note: This is under development and not all peripherals can be supported 378 Note: This is under development and not all peripherals can be supported
371 with this machine file. 379 with this machine file.
372 380
381config MACH_EXYNOS5_DT
382 bool "SAMSUNG EXYNOS5 Machine using device tree"
383 select SOC_EXYNOS5250
384 select USE_OF
385 select ARM_AMBA
386 help
387 Machine support for Samsung Exynos4 machine with device tree enabled.
388 Select this if a fdt blob is available for the EXYNOS4 SoC based board.
389
373if ARCH_EXYNOS4 390if ARCH_EXYNOS4
374 391
375comment "Configuration for HSMMC 8-bit bus width" 392comment "Configuration for HSMMC 8-bit bus width"
diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile
index 9a4c09896509..8631840d1b5e 100644
--- a/arch/arm/mach-exynos/Makefile
+++ b/arch/arm/mach-exynos/Makefile
@@ -14,6 +14,7 @@ obj- :=
14 14
15obj-$(CONFIG_ARCH_EXYNOS) += common.o 15obj-$(CONFIG_ARCH_EXYNOS) += common.o
16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o 16obj-$(CONFIG_ARCH_EXYNOS4) += clock-exynos4.o
17obj-$(CONFIG_ARCH_EXYNOS5) += clock-exynos5.o
17obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o 18obj-$(CONFIG_CPU_EXYNOS4210) += clock-exynos4210.o
18obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o 19obj-$(CONFIG_SOC_EXYNOS4212) += clock-exynos4212.o
19 20
@@ -42,9 +43,11 @@ obj-$(CONFIG_MACH_SMDK4212) += mach-smdk4x12.o
42obj-$(CONFIG_MACH_SMDK4412) += mach-smdk4x12.o 43obj-$(CONFIG_MACH_SMDK4412) += mach-smdk4x12.o
43 44
44obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o 45obj-$(CONFIG_MACH_EXYNOS4_DT) += mach-exynos4-dt.o
46obj-$(CONFIG_MACH_EXYNOS5_DT) += mach-exynos5-dt.o
45 47
46# device support 48# device support
47 49
50obj-y += dev-uart.o
48obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o 51obj-$(CONFIG_ARCH_EXYNOS4) += dev-audio.o
49obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o 52obj-$(CONFIG_EXYNOS4_DEV_AHCI) += dev-ahci.o
50obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o 53obj-$(CONFIG_EXYNOS4_DEV_SYSMMU) += dev-sysmmu.o
@@ -52,7 +55,7 @@ obj-$(CONFIG_EXYNOS4_DEV_DWMCI) += dev-dwmci.o
52obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o 55obj-$(CONFIG_EXYNOS4_DEV_DMA) += dma.o
53obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o 56obj-$(CONFIG_EXYNOS4_DEV_USB_OHCI) += dev-ohci.o
54 57
55obj-$(CONFIG_ARCH_EXYNOS4) += setup-i2c0.o 58obj-$(CONFIG_ARCH_EXYNOS) += setup-i2c0.o
56obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o 59obj-$(CONFIG_EXYNOS4_SETUP_FIMC) += setup-fimc.o
57obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o 60obj-$(CONFIG_EXYNOS4_SETUP_FIMD0) += setup-fimd0.o
58obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o 61obj-$(CONFIG_EXYNOS4_SETUP_I2C1) += setup-i2c1.o
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
index 200159dcb341..df54c2a92225 100644
--- a/arch/arm/mach-exynos/clock-exynos4.c
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -496,11 +496,6 @@ static struct clk exynos4_init_clocks_off[] = {
496 .enable = exynos4_clk_ip_cam_ctrl, 496 .enable = exynos4_clk_ip_cam_ctrl,
497 .ctrlbit = (1 << 3), 497 .ctrlbit = (1 << 3),
498 }, { 498 }, {
499 .name = "fimd",
500 .devname = "exynos4-fb.0",
501 .enable = exynos4_clk_ip_lcd0_ctrl,
502 .ctrlbit = (1 << 0),
503 }, {
504 .name = "hsmmc", 499 .name = "hsmmc",
505 .devname = "s3c-sdhci.0", 500 .devname = "s3c-sdhci.0",
506 .parent = &exynos4_clk_aclk_133.clk, 501 .parent = &exynos4_clk_aclk_133.clk,
@@ -796,6 +791,13 @@ static struct clk exynos4_clk_mdma1 = {
796 .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)), 791 .ctrlbit = ((1 << 8) | (1 << 5) | (1 << 2)),
797}; 792};
798 793
794static struct clk exynos4_clk_fimd0 = {
795 .name = "fimd",
796 .devname = "exynos4-fb.0",
797 .enable = exynos4_clk_ip_lcd0_ctrl,
798 .ctrlbit = (1 << 0),
799};
800
799struct clk *exynos4_clkset_group_list[] = { 801struct clk *exynos4_clkset_group_list[] = {
800 [0] = &clk_ext_xtal_mux, 802 [0] = &clk_ext_xtal_mux,
801 [1] = &clk_xusbxti, 803 [1] = &clk_xusbxti,
@@ -1315,6 +1317,7 @@ static struct clk *exynos4_clk_cdev[] = {
1315 &exynos4_clk_pdma0, 1317 &exynos4_clk_pdma0,
1316 &exynos4_clk_pdma1, 1318 &exynos4_clk_pdma1,
1317 &exynos4_clk_mdma1, 1319 &exynos4_clk_mdma1,
1320 &exynos4_clk_fimd0,
1318}; 1321};
1319 1322
1320static struct clksrc_clk *exynos4_clksrc_cdev[] = { 1323static struct clksrc_clk *exynos4_clksrc_cdev[] = {
@@ -1341,6 +1344,7 @@ static struct clk_lookup exynos4_clk_lookup[] = {
1341 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk), 1344 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos4_clk_sclk_mmc1.clk),
1342 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk), 1345 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos4_clk_sclk_mmc2.clk),
1343 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk), 1346 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos4_clk_sclk_mmc3.clk),
1347 CLKDEV_INIT("exynos4-fb.0", "lcd", &exynos4_clk_fimd0),
1344 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), 1348 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1345 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), 1349 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
1346 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), 1350 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
diff --git a/arch/arm/mach-exynos/clock-exynos5.c b/arch/arm/mach-exynos/clock-exynos5.c
new file mode 100644
index 000000000000..d013982d0f8e
--- /dev/null
+++ b/arch/arm/mach-exynos/clock-exynos5.c
@@ -0,0 +1,1247 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Clock support for EXYNOS5 SoCs
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/kernel.h>
13#include <linux/err.h>
14#include <linux/io.h>
15#include <linux/syscore_ops.h>
16
17#include <plat/cpu-freq.h>
18#include <plat/clock.h>
19#include <plat/cpu.h>
20#include <plat/pll.h>
21#include <plat/s5p-clock.h>
22#include <plat/clock-clksrc.h>
23#include <plat/pm.h>
24
25#include <mach/map.h>
26#include <mach/regs-clock.h>
27#include <mach/sysmmu.h>
28
29#include "common.h"
30
31#ifdef CONFIG_PM_SLEEP
32static struct sleep_save exynos5_clock_save[] = {
33 /* will be implemented */
34};
35#endif
36
37static struct clk exynos5_clk_sclk_dptxphy = {
38 .name = "sclk_dptx",
39};
40
41static struct clk exynos5_clk_sclk_hdmi24m = {
42 .name = "sclk_hdmi24m",
43 .rate = 24000000,
44};
45
46static struct clk exynos5_clk_sclk_hdmi27m = {
47 .name = "sclk_hdmi27m",
48 .rate = 27000000,
49};
50
51static struct clk exynos5_clk_sclk_hdmiphy = {
52 .name = "sclk_hdmiphy",
53};
54
55static struct clk exynos5_clk_sclk_usbphy = {
56 .name = "sclk_usbphy",
57 .rate = 48000000,
58};
59
60static int exynos5_clksrc_mask_top_ctrl(struct clk *clk, int enable)
61{
62 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_TOP, clk, enable);
63}
64
65static int exynos5_clksrc_mask_disp1_0_ctrl(struct clk *clk, int enable)
66{
67 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_DISP1_0, clk, enable);
68}
69
70static int exynos5_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
71{
72 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_FSYS, clk, enable);
73}
74
75static int exynos5_clksrc_mask_gscl_ctrl(struct clk *clk, int enable)
76{
77 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_GSCL, clk, enable);
78}
79
80static int exynos5_clksrc_mask_peric0_ctrl(struct clk *clk, int enable)
81{
82 return s5p_gatectrl(EXYNOS5_CLKSRC_MASK_PERIC0, clk, enable);
83}
84
85static int exynos5_clk_ip_core_ctrl(struct clk *clk, int enable)
86{
87 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_CORE, clk, enable);
88}
89
90static int exynos5_clk_ip_disp1_ctrl(struct clk *clk, int enable)
91{
92 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_DISP1, clk, enable);
93}
94
95static int exynos5_clk_ip_fsys_ctrl(struct clk *clk, int enable)
96{
97 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_FSYS, clk, enable);
98}
99
100static int exynos5_clk_block_ctrl(struct clk *clk, int enable)
101{
102 return s5p_gatectrl(EXYNOS5_CLKGATE_BLOCK, clk, enable);
103}
104
105static int exynos5_clk_ip_gen_ctrl(struct clk *clk, int enable)
106{
107 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GEN, clk, enable);
108}
109
110static int exynos5_clk_ip_gps_ctrl(struct clk *clk, int enable)
111{
112 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_GPS, clk, enable);
113}
114
115static int exynos5_clk_ip_mfc_ctrl(struct clk *clk, int enable)
116{
117 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_MFC, clk, enable);
118}
119
120static int exynos5_clk_ip_peric_ctrl(struct clk *clk, int enable)
121{
122 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIC, clk, enable);
123}
124
125static int exynos5_clk_ip_peris_ctrl(struct clk *clk, int enable)
126{
127 return s5p_gatectrl(EXYNOS5_CLKGATE_IP_PERIS, clk, enable);
128}
129
130/* Core list of CMU_CPU side */
131
132static struct clksrc_clk exynos5_clk_mout_apll = {
133 .clk = {
134 .name = "mout_apll",
135 },
136 .sources = &clk_src_apll,
137 .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 0, .size = 1 },
138};
139
140static struct clksrc_clk exynos5_clk_sclk_apll = {
141 .clk = {
142 .name = "sclk_apll",
143 .parent = &exynos5_clk_mout_apll.clk,
144 },
145 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 24, .size = 3 },
146};
147
148static struct clksrc_clk exynos5_clk_mout_bpll = {
149 .clk = {
150 .name = "mout_bpll",
151 },
152 .sources = &clk_src_bpll,
153 .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 0, .size = 1 },
154};
155
156static struct clk *exynos5_clk_src_bpll_user_list[] = {
157 [0] = &clk_fin_mpll,
158 [1] = &exynos5_clk_mout_bpll.clk,
159};
160
161static struct clksrc_sources exynos5_clk_src_bpll_user = {
162 .sources = exynos5_clk_src_bpll_user_list,
163 .nr_sources = ARRAY_SIZE(exynos5_clk_src_bpll_user_list),
164};
165
166static struct clksrc_clk exynos5_clk_mout_bpll_user = {
167 .clk = {
168 .name = "mout_bpll_user",
169 },
170 .sources = &exynos5_clk_src_bpll_user,
171 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 24, .size = 1 },
172};
173
174static struct clksrc_clk exynos5_clk_mout_cpll = {
175 .clk = {
176 .name = "mout_cpll",
177 },
178 .sources = &clk_src_cpll,
179 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 8, .size = 1 },
180};
181
182static struct clksrc_clk exynos5_clk_mout_epll = {
183 .clk = {
184 .name = "mout_epll",
185 },
186 .sources = &clk_src_epll,
187 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 12, .size = 1 },
188};
189
190struct clksrc_clk exynos5_clk_mout_mpll = {
191 .clk = {
192 .name = "mout_mpll",
193 },
194 .sources = &clk_src_mpll,
195 .reg_src = { .reg = EXYNOS5_CLKSRC_CORE1, .shift = 8, .size = 1 },
196};
197
198static struct clk *exynos_clkset_vpllsrc_list[] = {
199 [0] = &clk_fin_vpll,
200 [1] = &exynos5_clk_sclk_hdmi27m,
201};
202
203static struct clksrc_sources exynos5_clkset_vpllsrc = {
204 .sources = exynos_clkset_vpllsrc_list,
205 .nr_sources = ARRAY_SIZE(exynos_clkset_vpllsrc_list),
206};
207
208static struct clksrc_clk exynos5_clk_vpllsrc = {
209 .clk = {
210 .name = "vpll_src",
211 .enable = exynos5_clksrc_mask_top_ctrl,
212 .ctrlbit = (1 << 0),
213 },
214 .sources = &exynos5_clkset_vpllsrc,
215 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 0, .size = 1 },
216};
217
218static struct clk *exynos5_clkset_sclk_vpll_list[] = {
219 [0] = &exynos5_clk_vpllsrc.clk,
220 [1] = &clk_fout_vpll,
221};
222
223static struct clksrc_sources exynos5_clkset_sclk_vpll = {
224 .sources = exynos5_clkset_sclk_vpll_list,
225 .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_vpll_list),
226};
227
228static struct clksrc_clk exynos5_clk_sclk_vpll = {
229 .clk = {
230 .name = "sclk_vpll",
231 },
232 .sources = &exynos5_clkset_sclk_vpll,
233 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 16, .size = 1 },
234};
235
236static struct clksrc_clk exynos5_clk_sclk_pixel = {
237 .clk = {
238 .name = "sclk_pixel",
239 .parent = &exynos5_clk_sclk_vpll.clk,
240 },
241 .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 28, .size = 4 },
242};
243
244static struct clk *exynos5_clkset_sclk_hdmi_list[] = {
245 [0] = &exynos5_clk_sclk_pixel.clk,
246 [1] = &exynos5_clk_sclk_hdmiphy,
247};
248
249static struct clksrc_sources exynos5_clkset_sclk_hdmi = {
250 .sources = exynos5_clkset_sclk_hdmi_list,
251 .nr_sources = ARRAY_SIZE(exynos5_clkset_sclk_hdmi_list),
252};
253
254static struct clksrc_clk exynos5_clk_sclk_hdmi = {
255 .clk = {
256 .name = "sclk_hdmi",
257 .enable = exynos5_clksrc_mask_disp1_0_ctrl,
258 .ctrlbit = (1 << 20),
259 },
260 .sources = &exynos5_clkset_sclk_hdmi,
261 .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 20, .size = 1 },
262};
263
264static struct clksrc_clk *exynos5_sclk_tv[] = {
265 &exynos5_clk_sclk_pixel,
266 &exynos5_clk_sclk_hdmi,
267};
268
269static struct clk *exynos5_clk_src_mpll_user_list[] = {
270 [0] = &clk_fin_mpll,
271 [1] = &exynos5_clk_mout_mpll.clk,
272};
273
274static struct clksrc_sources exynos5_clk_src_mpll_user = {
275 .sources = exynos5_clk_src_mpll_user_list,
276 .nr_sources = ARRAY_SIZE(exynos5_clk_src_mpll_user_list),
277};
278
279static struct clksrc_clk exynos5_clk_mout_mpll_user = {
280 .clk = {
281 .name = "mout_mpll_user",
282 },
283 .sources = &exynos5_clk_src_mpll_user,
284 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP2, .shift = 20, .size = 1 },
285};
286
287static struct clk *exynos5_clkset_mout_cpu_list[] = {
288 [0] = &exynos5_clk_mout_apll.clk,
289 [1] = &exynos5_clk_mout_mpll.clk,
290};
291
292static struct clksrc_sources exynos5_clkset_mout_cpu = {
293 .sources = exynos5_clkset_mout_cpu_list,
294 .nr_sources = ARRAY_SIZE(exynos5_clkset_mout_cpu_list),
295};
296
297static struct clksrc_clk exynos5_clk_mout_cpu = {
298 .clk = {
299 .name = "mout_cpu",
300 },
301 .sources = &exynos5_clkset_mout_cpu,
302 .reg_src = { .reg = EXYNOS5_CLKSRC_CPU, .shift = 16, .size = 1 },
303};
304
305static struct clksrc_clk exynos5_clk_dout_armclk = {
306 .clk = {
307 .name = "dout_armclk",
308 .parent = &exynos5_clk_mout_cpu.clk,
309 },
310 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 0, .size = 3 },
311};
312
313static struct clksrc_clk exynos5_clk_dout_arm2clk = {
314 .clk = {
315 .name = "dout_arm2clk",
316 .parent = &exynos5_clk_dout_armclk.clk,
317 },
318 .reg_div = { .reg = EXYNOS5_CLKDIV_CPU0, .shift = 28, .size = 3 },
319};
320
321static struct clk exynos5_clk_armclk = {
322 .name = "armclk",
323 .parent = &exynos5_clk_dout_arm2clk.clk,
324};
325
326/* Core list of CMU_CDREX side */
327
328static struct clk *exynos5_clkset_cdrex_list[] = {
329 [0] = &exynos5_clk_mout_mpll.clk,
330 [1] = &exynos5_clk_mout_bpll.clk,
331};
332
333static struct clksrc_sources exynos5_clkset_cdrex = {
334 .sources = exynos5_clkset_cdrex_list,
335 .nr_sources = ARRAY_SIZE(exynos5_clkset_cdrex_list),
336};
337
338static struct clksrc_clk exynos5_clk_cdrex = {
339 .clk = {
340 .name = "clk_cdrex",
341 },
342 .sources = &exynos5_clkset_cdrex,
343 .reg_src = { .reg = EXYNOS5_CLKSRC_CDREX, .shift = 4, .size = 1 },
344 .reg_div = { .reg = EXYNOS5_CLKDIV_CDREX, .shift = 16, .size = 3 },
345};
346
347static struct clksrc_clk exynos5_clk_aclk_acp = {
348 .clk = {
349 .name = "aclk_acp",
350 .parent = &exynos5_clk_mout_mpll.clk,
351 },
352 .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 0, .size = 3 },
353};
354
355static struct clksrc_clk exynos5_clk_pclk_acp = {
356 .clk = {
357 .name = "pclk_acp",
358 .parent = &exynos5_clk_aclk_acp.clk,
359 },
360 .reg_div = { .reg = EXYNOS5_CLKDIV_ACP, .shift = 4, .size = 3 },
361};
362
363/* Core list of CMU_TOP side */
364
365struct clk *exynos5_clkset_aclk_top_list[] = {
366 [0] = &exynos5_clk_mout_mpll_user.clk,
367 [1] = &exynos5_clk_mout_bpll_user.clk,
368};
369
370struct clksrc_sources exynos5_clkset_aclk = {
371 .sources = exynos5_clkset_aclk_top_list,
372 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_top_list),
373};
374
375static struct clksrc_clk exynos5_clk_aclk_400 = {
376 .clk = {
377 .name = "aclk_400",
378 },
379 .sources = &exynos5_clkset_aclk,
380 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 },
381 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
382};
383
384struct clk *exynos5_clkset_aclk_333_166_list[] = {
385 [0] = &exynos5_clk_mout_cpll.clk,
386 [1] = &exynos5_clk_mout_mpll_user.clk,
387};
388
389struct clksrc_sources exynos5_clkset_aclk_333_166 = {
390 .sources = exynos5_clkset_aclk_333_166_list,
391 .nr_sources = ARRAY_SIZE(exynos5_clkset_aclk_333_166_list),
392};
393
394static struct clksrc_clk exynos5_clk_aclk_333 = {
395 .clk = {
396 .name = "aclk_333",
397 },
398 .sources = &exynos5_clkset_aclk_333_166,
399 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 16, .size = 1 },
400 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 20, .size = 3 },
401};
402
403static struct clksrc_clk exynos5_clk_aclk_166 = {
404 .clk = {
405 .name = "aclk_166",
406 },
407 .sources = &exynos5_clkset_aclk_333_166,
408 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 8, .size = 1 },
409 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 8, .size = 3 },
410};
411
412static struct clksrc_clk exynos5_clk_aclk_266 = {
413 .clk = {
414 .name = "aclk_266",
415 .parent = &exynos5_clk_mout_mpll_user.clk,
416 },
417 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 16, .size = 3 },
418};
419
420static struct clksrc_clk exynos5_clk_aclk_200 = {
421 .clk = {
422 .name = "aclk_200",
423 },
424 .sources = &exynos5_clkset_aclk,
425 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 12, .size = 1 },
426 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 12, .size = 3 },
427};
428
429static struct clksrc_clk exynos5_clk_aclk_66_pre = {
430 .clk = {
431 .name = "aclk_66_pre",
432 .parent = &exynos5_clk_mout_mpll_user.clk,
433 },
434 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP1, .shift = 24, .size = 3 },
435};
436
437static struct clksrc_clk exynos5_clk_aclk_66 = {
438 .clk = {
439 .name = "aclk_66",
440 .parent = &exynos5_clk_aclk_66_pre.clk,
441 },
442 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 0, .size = 3 },
443};
444
445static struct clk exynos5_init_clocks_off[] = {
446 {
447 .name = "timers",
448 .parent = &exynos5_clk_aclk_66.clk,
449 .enable = exynos5_clk_ip_peric_ctrl,
450 .ctrlbit = (1 << 24),
451 }, {
452 .name = "rtc",
453 .parent = &exynos5_clk_aclk_66.clk,
454 .enable = exynos5_clk_ip_peris_ctrl,
455 .ctrlbit = (1 << 20),
456 }, {
457 .name = "hsmmc",
458 .devname = "s3c-sdhci.0",
459 .parent = &exynos5_clk_aclk_200.clk,
460 .enable = exynos5_clk_ip_fsys_ctrl,
461 .ctrlbit = (1 << 12),
462 }, {
463 .name = "hsmmc",
464 .devname = "s3c-sdhci.1",
465 .parent = &exynos5_clk_aclk_200.clk,
466 .enable = exynos5_clk_ip_fsys_ctrl,
467 .ctrlbit = (1 << 13),
468 }, {
469 .name = "hsmmc",
470 .devname = "s3c-sdhci.2",
471 .parent = &exynos5_clk_aclk_200.clk,
472 .enable = exynos5_clk_ip_fsys_ctrl,
473 .ctrlbit = (1 << 14),
474 }, {
475 .name = "hsmmc",
476 .devname = "s3c-sdhci.3",
477 .parent = &exynos5_clk_aclk_200.clk,
478 .enable = exynos5_clk_ip_fsys_ctrl,
479 .ctrlbit = (1 << 15),
480 }, {
481 .name = "dwmci",
482 .parent = &exynos5_clk_aclk_200.clk,
483 .enable = exynos5_clk_ip_fsys_ctrl,
484 .ctrlbit = (1 << 16),
485 }, {
486 .name = "sata",
487 .devname = "ahci",
488 .enable = exynos5_clk_ip_fsys_ctrl,
489 .ctrlbit = (1 << 6),
490 }, {
491 .name = "sata_phy",
492 .enable = exynos5_clk_ip_fsys_ctrl,
493 .ctrlbit = (1 << 24),
494 }, {
495 .name = "sata_phy_i2c",
496 .enable = exynos5_clk_ip_fsys_ctrl,
497 .ctrlbit = (1 << 25),
498 }, {
499 .name = "mfc",
500 .devname = "s5p-mfc",
501 .enable = exynos5_clk_ip_mfc_ctrl,
502 .ctrlbit = (1 << 0),
503 }, {
504 .name = "hdmi",
505 .devname = "exynos4-hdmi",
506 .enable = exynos5_clk_ip_disp1_ctrl,
507 .ctrlbit = (1 << 6),
508 }, {
509 .name = "mixer",
510 .devname = "s5p-mixer",
511 .enable = exynos5_clk_ip_disp1_ctrl,
512 .ctrlbit = (1 << 5),
513 }, {
514 .name = "jpeg",
515 .enable = exynos5_clk_ip_gen_ctrl,
516 .ctrlbit = (1 << 2),
517 }, {
518 .name = "dsim0",
519 .enable = exynos5_clk_ip_disp1_ctrl,
520 .ctrlbit = (1 << 3),
521 }, {
522 .name = "iis",
523 .devname = "samsung-i2s.1",
524 .enable = exynos5_clk_ip_peric_ctrl,
525 .ctrlbit = (1 << 20),
526 }, {
527 .name = "iis",
528 .devname = "samsung-i2s.2",
529 .enable = exynos5_clk_ip_peric_ctrl,
530 .ctrlbit = (1 << 21),
531 }, {
532 .name = "pcm",
533 .devname = "samsung-pcm.1",
534 .enable = exynos5_clk_ip_peric_ctrl,
535 .ctrlbit = (1 << 22),
536 }, {
537 .name = "pcm",
538 .devname = "samsung-pcm.2",
539 .enable = exynos5_clk_ip_peric_ctrl,
540 .ctrlbit = (1 << 23),
541 }, {
542 .name = "spdif",
543 .devname = "samsung-spdif",
544 .enable = exynos5_clk_ip_peric_ctrl,
545 .ctrlbit = (1 << 26),
546 }, {
547 .name = "ac97",
548 .devname = "samsung-ac97",
549 .enable = exynos5_clk_ip_peric_ctrl,
550 .ctrlbit = (1 << 27),
551 }, {
552 .name = "usbhost",
553 .enable = exynos5_clk_ip_fsys_ctrl ,
554 .ctrlbit = (1 << 18),
555 }, {
556 .name = "usbotg",
557 .enable = exynos5_clk_ip_fsys_ctrl,
558 .ctrlbit = (1 << 7),
559 }, {
560 .name = "gps",
561 .enable = exynos5_clk_ip_gps_ctrl,
562 .ctrlbit = ((1 << 3) | (1 << 2) | (1 << 0)),
563 }, {
564 .name = "nfcon",
565 .enable = exynos5_clk_ip_fsys_ctrl,
566 .ctrlbit = (1 << 22),
567 }, {
568 .name = "iop",
569 .enable = exynos5_clk_ip_fsys_ctrl,
570 .ctrlbit = ((1 << 30) | (1 << 26) | (1 << 23)),
571 }, {
572 .name = "core_iop",
573 .enable = exynos5_clk_ip_core_ctrl,
574 .ctrlbit = ((1 << 21) | (1 << 3)),
575 }, {
576 .name = "mcu_iop",
577 .enable = exynos5_clk_ip_fsys_ctrl,
578 .ctrlbit = (1 << 0),
579 }, {
580 .name = "i2c",
581 .devname = "s3c2440-i2c.0",
582 .parent = &exynos5_clk_aclk_66.clk,
583 .enable = exynos5_clk_ip_peric_ctrl,
584 .ctrlbit = (1 << 6),
585 }, {
586 .name = "i2c",
587 .devname = "s3c2440-i2c.1",
588 .parent = &exynos5_clk_aclk_66.clk,
589 .enable = exynos5_clk_ip_peric_ctrl,
590 .ctrlbit = (1 << 7),
591 }, {
592 .name = "i2c",
593 .devname = "s3c2440-i2c.2",
594 .parent = &exynos5_clk_aclk_66.clk,
595 .enable = exynos5_clk_ip_peric_ctrl,
596 .ctrlbit = (1 << 8),
597 }, {
598 .name = "i2c",
599 .devname = "s3c2440-i2c.3",
600 .parent = &exynos5_clk_aclk_66.clk,
601 .enable = exynos5_clk_ip_peric_ctrl,
602 .ctrlbit = (1 << 9),
603 }, {
604 .name = "i2c",
605 .devname = "s3c2440-i2c.4",
606 .parent = &exynos5_clk_aclk_66.clk,
607 .enable = exynos5_clk_ip_peric_ctrl,
608 .ctrlbit = (1 << 10),
609 }, {
610 .name = "i2c",
611 .devname = "s3c2440-i2c.5",
612 .parent = &exynos5_clk_aclk_66.clk,
613 .enable = exynos5_clk_ip_peric_ctrl,
614 .ctrlbit = (1 << 11),
615 }, {
616 .name = "i2c",
617 .devname = "s3c2440-i2c.6",
618 .parent = &exynos5_clk_aclk_66.clk,
619 .enable = exynos5_clk_ip_peric_ctrl,
620 .ctrlbit = (1 << 12),
621 }, {
622 .name = "i2c",
623 .devname = "s3c2440-i2c.7",
624 .parent = &exynos5_clk_aclk_66.clk,
625 .enable = exynos5_clk_ip_peric_ctrl,
626 .ctrlbit = (1 << 13),
627 }, {
628 .name = "i2c",
629 .devname = "s3c2440-hdmiphy-i2c",
630 .parent = &exynos5_clk_aclk_66.clk,
631 .enable = exynos5_clk_ip_peric_ctrl,
632 .ctrlbit = (1 << 14),
633 }
634};
635
636static struct clk exynos5_init_clocks_on[] = {
637 {
638 .name = "uart",
639 .devname = "s5pv210-uart.0",
640 .enable = exynos5_clk_ip_peric_ctrl,
641 .ctrlbit = (1 << 0),
642 }, {
643 .name = "uart",
644 .devname = "s5pv210-uart.1",
645 .enable = exynos5_clk_ip_peric_ctrl,
646 .ctrlbit = (1 << 1),
647 }, {
648 .name = "uart",
649 .devname = "s5pv210-uart.2",
650 .enable = exynos5_clk_ip_peric_ctrl,
651 .ctrlbit = (1 << 2),
652 }, {
653 .name = "uart",
654 .devname = "s5pv210-uart.3",
655 .enable = exynos5_clk_ip_peric_ctrl,
656 .ctrlbit = (1 << 3),
657 }, {
658 .name = "uart",
659 .devname = "s5pv210-uart.4",
660 .enable = exynos5_clk_ip_peric_ctrl,
661 .ctrlbit = (1 << 4),
662 }, {
663 .name = "uart",
664 .devname = "s5pv210-uart.5",
665 .enable = exynos5_clk_ip_peric_ctrl,
666 .ctrlbit = (1 << 5),
667 }
668};
669
670static struct clk exynos5_clk_pdma0 = {
671 .name = "dma",
672 .devname = "dma-pl330.0",
673 .enable = exynos5_clk_ip_fsys_ctrl,
674 .ctrlbit = (1 << 1),
675};
676
677static struct clk exynos5_clk_pdma1 = {
678 .name = "dma",
679 .devname = "dma-pl330.1",
680 .enable = exynos5_clk_ip_fsys_ctrl,
681 .ctrlbit = (1 << 1),
682};
683
684static struct clk exynos5_clk_mdma1 = {
685 .name = "dma",
686 .devname = "dma-pl330.2",
687 .enable = exynos5_clk_ip_gen_ctrl,
688 .ctrlbit = (1 << 4),
689};
690
691struct clk *exynos5_clkset_group_list[] = {
692 [0] = &clk_ext_xtal_mux,
693 [1] = NULL,
694 [2] = &exynos5_clk_sclk_hdmi24m,
695 [3] = &exynos5_clk_sclk_dptxphy,
696 [4] = &exynos5_clk_sclk_usbphy,
697 [5] = &exynos5_clk_sclk_hdmiphy,
698 [6] = &exynos5_clk_mout_mpll_user.clk,
699 [7] = &exynos5_clk_mout_epll.clk,
700 [8] = &exynos5_clk_sclk_vpll.clk,
701 [9] = &exynos5_clk_mout_cpll.clk,
702};
703
704struct clksrc_sources exynos5_clkset_group = {
705 .sources = exynos5_clkset_group_list,
706 .nr_sources = ARRAY_SIZE(exynos5_clkset_group_list),
707};
708
709/* Possible clock sources for aclk_266_gscl_sub Mux */
710static struct clk *clk_src_gscl_266_list[] = {
711 [0] = &clk_ext_xtal_mux,
712 [1] = &exynos5_clk_aclk_266.clk,
713};
714
715static struct clksrc_sources clk_src_gscl_266 = {
716 .sources = clk_src_gscl_266_list,
717 .nr_sources = ARRAY_SIZE(clk_src_gscl_266_list),
718};
719
720static struct clksrc_clk exynos5_clk_dout_mmc0 = {
721 .clk = {
722 .name = "dout_mmc0",
723 },
724 .sources = &exynos5_clkset_group,
725 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 0, .size = 4 },
726 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 0, .size = 4 },
727};
728
729static struct clksrc_clk exynos5_clk_dout_mmc1 = {
730 .clk = {
731 .name = "dout_mmc1",
732 },
733 .sources = &exynos5_clkset_group,
734 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 4, .size = 4 },
735 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 16, .size = 4 },
736};
737
738static struct clksrc_clk exynos5_clk_dout_mmc2 = {
739 .clk = {
740 .name = "dout_mmc2",
741 },
742 .sources = &exynos5_clkset_group,
743 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 8, .size = 4 },
744 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 0, .size = 4 },
745};
746
747static struct clksrc_clk exynos5_clk_dout_mmc3 = {
748 .clk = {
749 .name = "dout_mmc3",
750 },
751 .sources = &exynos5_clkset_group,
752 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 12, .size = 4 },
753 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 16, .size = 4 },
754};
755
756static struct clksrc_clk exynos5_clk_dout_mmc4 = {
757 .clk = {
758 .name = "dout_mmc4",
759 },
760 .sources = &exynos5_clkset_group,
761 .reg_src = { .reg = EXYNOS5_CLKSRC_FSYS, .shift = 16, .size = 4 },
762 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 0, .size = 4 },
763};
764
765static struct clksrc_clk exynos5_clk_sclk_uart0 = {
766 .clk = {
767 .name = "uclk1",
768 .devname = "exynos4210-uart.0",
769 .enable = exynos5_clksrc_mask_peric0_ctrl,
770 .ctrlbit = (1 << 0),
771 },
772 .sources = &exynos5_clkset_group,
773 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 0, .size = 4 },
774 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 0, .size = 4 },
775};
776
777static struct clksrc_clk exynos5_clk_sclk_uart1 = {
778 .clk = {
779 .name = "uclk1",
780 .devname = "exynos4210-uart.1",
781 .enable = exynos5_clksrc_mask_peric0_ctrl,
782 .ctrlbit = (1 << 4),
783 },
784 .sources = &exynos5_clkset_group,
785 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 4, .size = 4 },
786 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 4, .size = 4 },
787};
788
789static struct clksrc_clk exynos5_clk_sclk_uart2 = {
790 .clk = {
791 .name = "uclk1",
792 .devname = "exynos4210-uart.2",
793 .enable = exynos5_clksrc_mask_peric0_ctrl,
794 .ctrlbit = (1 << 8),
795 },
796 .sources = &exynos5_clkset_group,
797 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 8, .size = 4 },
798 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 8, .size = 4 },
799};
800
801static struct clksrc_clk exynos5_clk_sclk_uart3 = {
802 .clk = {
803 .name = "uclk1",
804 .devname = "exynos4210-uart.3",
805 .enable = exynos5_clksrc_mask_peric0_ctrl,
806 .ctrlbit = (1 << 12),
807 },
808 .sources = &exynos5_clkset_group,
809 .reg_src = { .reg = EXYNOS5_CLKSRC_PERIC0, .shift = 12, .size = 4 },
810 .reg_div = { .reg = EXYNOS5_CLKDIV_PERIC0, .shift = 12, .size = 4 },
811};
812
813static struct clksrc_clk exynos5_clk_sclk_mmc0 = {
814 .clk = {
815 .name = "sclk_mmc",
816 .devname = "s3c-sdhci.0",
817 .parent = &exynos5_clk_dout_mmc0.clk,
818 .enable = exynos5_clksrc_mask_fsys_ctrl,
819 .ctrlbit = (1 << 0),
820 },
821 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 8, .size = 8 },
822};
823
824static struct clksrc_clk exynos5_clk_sclk_mmc1 = {
825 .clk = {
826 .name = "sclk_mmc",
827 .devname = "s3c-sdhci.1",
828 .parent = &exynos5_clk_dout_mmc1.clk,
829 .enable = exynos5_clksrc_mask_fsys_ctrl,
830 .ctrlbit = (1 << 4),
831 },
832 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS1, .shift = 24, .size = 8 },
833};
834
835static struct clksrc_clk exynos5_clk_sclk_mmc2 = {
836 .clk = {
837 .name = "sclk_mmc",
838 .devname = "s3c-sdhci.2",
839 .parent = &exynos5_clk_dout_mmc2.clk,
840 .enable = exynos5_clksrc_mask_fsys_ctrl,
841 .ctrlbit = (1 << 8),
842 },
843 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 8, .size = 8 },
844};
845
846static struct clksrc_clk exynos5_clk_sclk_mmc3 = {
847 .clk = {
848 .name = "sclk_mmc",
849 .devname = "s3c-sdhci.3",
850 .parent = &exynos5_clk_dout_mmc3.clk,
851 .enable = exynos5_clksrc_mask_fsys_ctrl,
852 .ctrlbit = (1 << 12),
853 },
854 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS2, .shift = 24, .size = 8 },
855};
856
857static struct clksrc_clk exynos5_clksrcs[] = {
858 {
859 .clk = {
860 .name = "sclk_dwmci",
861 .parent = &exynos5_clk_dout_mmc4.clk,
862 .enable = exynos5_clksrc_mask_fsys_ctrl,
863 .ctrlbit = (1 << 16),
864 },
865 .reg_div = { .reg = EXYNOS5_CLKDIV_FSYS3, .shift = 8, .size = 8 },
866 }, {
867 .clk = {
868 .name = "sclk_fimd",
869 .devname = "s3cfb.1",
870 .enable = exynos5_clksrc_mask_disp1_0_ctrl,
871 .ctrlbit = (1 << 0),
872 },
873 .sources = &exynos5_clkset_group,
874 .reg_src = { .reg = EXYNOS5_CLKSRC_DISP1_0, .shift = 0, .size = 4 },
875 .reg_div = { .reg = EXYNOS5_CLKDIV_DISP1_0, .shift = 0, .size = 4 },
876 }, {
877 .clk = {
878 .name = "aclk_266_gscl",
879 },
880 .sources = &clk_src_gscl_266,
881 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP3, .shift = 8, .size = 1 },
882 }, {
883 .clk = {
884 .name = "sclk_g3d",
885 .devname = "mali-t604.0",
886 .enable = exynos5_clk_block_ctrl,
887 .ctrlbit = (1 << 1),
888 },
889 .sources = &exynos5_clkset_aclk,
890 .reg_src = { .reg = EXYNOS5_CLKSRC_TOP0, .shift = 20, .size = 1 },
891 .reg_div = { .reg = EXYNOS5_CLKDIV_TOP0, .shift = 24, .size = 3 },
892 }, {
893 .clk = {
894 .name = "sclk_gscl_wrap",
895 .devname = "s5p-mipi-csis.0",
896 .enable = exynos5_clksrc_mask_gscl_ctrl,
897 .ctrlbit = (1 << 24),
898 },
899 .sources = &exynos5_clkset_group,
900 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 24, .size = 4 },
901 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 24, .size = 4 },
902 }, {
903 .clk = {
904 .name = "sclk_gscl_wrap",
905 .devname = "s5p-mipi-csis.1",
906 .enable = exynos5_clksrc_mask_gscl_ctrl,
907 .ctrlbit = (1 << 28),
908 },
909 .sources = &exynos5_clkset_group,
910 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 28, .size = 4 },
911 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 28, .size = 4 },
912 }, {
913 .clk = {
914 .name = "sclk_cam0",
915 .enable = exynos5_clksrc_mask_gscl_ctrl,
916 .ctrlbit = (1 << 16),
917 },
918 .sources = &exynos5_clkset_group,
919 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 16, .size = 4 },
920 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 16, .size = 4 },
921 }, {
922 .clk = {
923 .name = "sclk_cam1",
924 .enable = exynos5_clksrc_mask_gscl_ctrl,
925 .ctrlbit = (1 << 20),
926 },
927 .sources = &exynos5_clkset_group,
928 .reg_src = { .reg = EXYNOS5_CLKSRC_GSCL, .shift = 20, .size = 4 },
929 .reg_div = { .reg = EXYNOS5_CLKDIV_GSCL, .shift = 20, .size = 4 },
930 }, {
931 .clk = {
932 .name = "sclk_jpeg",
933 .parent = &exynos5_clk_mout_cpll.clk,
934 },
935 .reg_div = { .reg = EXYNOS5_CLKDIV_GEN, .shift = 4, .size = 3 },
936 },
937};
938
939/* Clock initialization code */
940static struct clksrc_clk *exynos5_sysclks[] = {
941 &exynos5_clk_mout_apll,
942 &exynos5_clk_sclk_apll,
943 &exynos5_clk_mout_bpll,
944 &exynos5_clk_mout_bpll_user,
945 &exynos5_clk_mout_cpll,
946 &exynos5_clk_mout_epll,
947 &exynos5_clk_mout_mpll,
948 &exynos5_clk_mout_mpll_user,
949 &exynos5_clk_vpllsrc,
950 &exynos5_clk_sclk_vpll,
951 &exynos5_clk_mout_cpu,
952 &exynos5_clk_dout_armclk,
953 &exynos5_clk_dout_arm2clk,
954 &exynos5_clk_cdrex,
955 &exynos5_clk_aclk_400,
956 &exynos5_clk_aclk_333,
957 &exynos5_clk_aclk_266,
958 &exynos5_clk_aclk_200,
959 &exynos5_clk_aclk_166,
960 &exynos5_clk_aclk_66_pre,
961 &exynos5_clk_aclk_66,
962 &exynos5_clk_dout_mmc0,
963 &exynos5_clk_dout_mmc1,
964 &exynos5_clk_dout_mmc2,
965 &exynos5_clk_dout_mmc3,
966 &exynos5_clk_dout_mmc4,
967 &exynos5_clk_aclk_acp,
968 &exynos5_clk_pclk_acp,
969};
970
971static struct clk *exynos5_clk_cdev[] = {
972 &exynos5_clk_pdma0,
973 &exynos5_clk_pdma1,
974 &exynos5_clk_mdma1,
975};
976
977static struct clksrc_clk *exynos5_clksrc_cdev[] = {
978 &exynos5_clk_sclk_uart0,
979 &exynos5_clk_sclk_uart1,
980 &exynos5_clk_sclk_uart2,
981 &exynos5_clk_sclk_uart3,
982 &exynos5_clk_sclk_mmc0,
983 &exynos5_clk_sclk_mmc1,
984 &exynos5_clk_sclk_mmc2,
985 &exynos5_clk_sclk_mmc3,
986};
987
988static struct clk_lookup exynos5_clk_lookup[] = {
989 CLKDEV_INIT("exynos4210-uart.0", "clk_uart_baud0", &exynos5_clk_sclk_uart0.clk),
990 CLKDEV_INIT("exynos4210-uart.1", "clk_uart_baud0", &exynos5_clk_sclk_uart1.clk),
991 CLKDEV_INIT("exynos4210-uart.2", "clk_uart_baud0", &exynos5_clk_sclk_uart2.clk),
992 CLKDEV_INIT("exynos4210-uart.3", "clk_uart_baud0", &exynos5_clk_sclk_uart3.clk),
993 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &exynos5_clk_sclk_mmc0.clk),
994 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &exynos5_clk_sclk_mmc1.clk),
995 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &exynos5_clk_sclk_mmc2.clk),
996 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &exynos5_clk_sclk_mmc3.clk),
997 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos5_clk_pdma0),
998 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos5_clk_pdma1),
999 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos5_clk_mdma1),
1000};
1001
1002static unsigned long exynos5_epll_get_rate(struct clk *clk)
1003{
1004 return clk->rate;
1005}
1006
1007static struct clk *exynos5_clks[] __initdata = {
1008 &exynos5_clk_sclk_hdmi27m,
1009 &exynos5_clk_sclk_hdmiphy,
1010 &clk_fout_bpll,
1011 &clk_fout_cpll,
1012 &exynos5_clk_armclk,
1013};
1014
1015static u32 epll_div[][6] = {
1016 { 192000000, 0, 48, 3, 1, 0 },
1017 { 180000000, 0, 45, 3, 1, 0 },
1018 { 73728000, 1, 73, 3, 3, 47710 },
1019 { 67737600, 1, 90, 4, 3, 20762 },
1020 { 49152000, 0, 49, 3, 3, 9961 },
1021 { 45158400, 0, 45, 3, 3, 10381 },
1022 { 180633600, 0, 45, 3, 1, 10381 },
1023};
1024
1025static int exynos5_epll_set_rate(struct clk *clk, unsigned long rate)
1026{
1027 unsigned int epll_con, epll_con_k;
1028 unsigned int i;
1029 unsigned int tmp;
1030 unsigned int epll_rate;
1031 unsigned int locktime;
1032 unsigned int lockcnt;
1033
1034 /* Return if nothing changed */
1035 if (clk->rate == rate)
1036 return 0;
1037
1038 if (clk->parent)
1039 epll_rate = clk_get_rate(clk->parent);
1040 else
1041 epll_rate = clk_ext_xtal_mux.rate;
1042
1043 if (epll_rate != 24000000) {
1044 pr_err("Invalid Clock : recommended clock is 24MHz.\n");
1045 return -EINVAL;
1046 }
1047
1048 epll_con = __raw_readl(EXYNOS5_EPLL_CON0);
1049 epll_con &= ~(0x1 << 27 | \
1050 PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT | \
1051 PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT | \
1052 PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1053
1054 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
1055 if (epll_div[i][0] == rate) {
1056 epll_con_k = epll_div[i][5] << 0;
1057 epll_con |= epll_div[i][1] << 27;
1058 epll_con |= epll_div[i][2] << PLL46XX_MDIV_SHIFT;
1059 epll_con |= epll_div[i][3] << PLL46XX_PDIV_SHIFT;
1060 epll_con |= epll_div[i][4] << PLL46XX_SDIV_SHIFT;
1061 break;
1062 }
1063 }
1064
1065 if (i == ARRAY_SIZE(epll_div)) {
1066 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n",
1067 __func__);
1068 return -EINVAL;
1069 }
1070
1071 epll_rate /= 1000000;
1072
1073 /* 3000 max_cycls : specification data */
1074 locktime = 3000 / epll_rate * epll_div[i][3];
1075 lockcnt = locktime * 10000 / (10000 / epll_rate);
1076
1077 __raw_writel(lockcnt, EXYNOS5_EPLL_LOCK);
1078
1079 __raw_writel(epll_con, EXYNOS5_EPLL_CON0);
1080 __raw_writel(epll_con_k, EXYNOS5_EPLL_CON1);
1081
1082 do {
1083 tmp = __raw_readl(EXYNOS5_EPLL_CON0);
1084 } while (!(tmp & 0x1 << EXYNOS5_EPLLCON0_LOCKED_SHIFT));
1085
1086 clk->rate = rate;
1087
1088 return 0;
1089}
1090
1091static struct clk_ops exynos5_epll_ops = {
1092 .get_rate = exynos5_epll_get_rate,
1093 .set_rate = exynos5_epll_set_rate,
1094};
1095
1096static int xtal_rate;
1097
1098static unsigned long exynos5_fout_apll_get_rate(struct clk *clk)
1099{
1100 return s5p_get_pll35xx(xtal_rate, __raw_readl(EXYNOS5_APLL_CON0));
1101}
1102
1103static struct clk_ops exynos5_fout_apll_ops = {
1104 .get_rate = exynos5_fout_apll_get_rate,
1105};
1106
1107#ifdef CONFIG_PM
1108static int exynos5_clock_suspend(void)
1109{
1110 s3c_pm_do_save(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save));
1111
1112 return 0;
1113}
1114
1115static void exynos5_clock_resume(void)
1116{
1117 s3c_pm_do_restore_core(exynos5_clock_save, ARRAY_SIZE(exynos5_clock_save));
1118}
1119#else
1120#define exynos5_clock_suspend NULL
1121#define exynos5_clock_resume NULL
1122#endif
1123
1124struct syscore_ops exynos5_clock_syscore_ops = {
1125 .suspend = exynos5_clock_suspend,
1126 .resume = exynos5_clock_resume,
1127};
1128
1129void __init_or_cpufreq exynos5_setup_clocks(void)
1130{
1131 struct clk *xtal_clk;
1132 unsigned long apll;
1133 unsigned long bpll;
1134 unsigned long cpll;
1135 unsigned long mpll;
1136 unsigned long epll;
1137 unsigned long vpll;
1138 unsigned long vpllsrc;
1139 unsigned long xtal;
1140 unsigned long armclk;
1141 unsigned long mout_cdrex;
1142 unsigned long aclk_400;
1143 unsigned long aclk_333;
1144 unsigned long aclk_266;
1145 unsigned long aclk_200;
1146 unsigned long aclk_166;
1147 unsigned long aclk_66;
1148 unsigned int ptr;
1149
1150 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
1151
1152 xtal_clk = clk_get(NULL, "xtal");
1153 BUG_ON(IS_ERR(xtal_clk));
1154
1155 xtal = clk_get_rate(xtal_clk);
1156
1157 xtal_rate = xtal;
1158
1159 clk_put(xtal_clk);
1160
1161 printk(KERN_DEBUG "%s: xtal is %ld\n", __func__, xtal);
1162
1163 apll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_APLL_CON0));
1164 bpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_BPLL_CON0));
1165 cpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_CPLL_CON0));
1166 mpll = s5p_get_pll35xx(xtal, __raw_readl(EXYNOS5_MPLL_CON0));
1167 epll = s5p_get_pll36xx(xtal, __raw_readl(EXYNOS5_EPLL_CON0),
1168 __raw_readl(EXYNOS5_EPLL_CON1));
1169
1170 vpllsrc = clk_get_rate(&exynos5_clk_vpllsrc.clk);
1171 vpll = s5p_get_pll36xx(vpllsrc, __raw_readl(EXYNOS5_VPLL_CON0),
1172 __raw_readl(EXYNOS5_VPLL_CON1));
1173
1174 clk_fout_apll.ops = &exynos5_fout_apll_ops;
1175 clk_fout_bpll.rate = bpll;
1176 clk_fout_cpll.rate = cpll;
1177 clk_fout_mpll.rate = mpll;
1178 clk_fout_epll.rate = epll;
1179 clk_fout_vpll.rate = vpll;
1180
1181 printk(KERN_INFO "EXYNOS5: PLL settings, A=%ld, B=%ld, C=%ld\n"
1182 "M=%ld, E=%ld V=%ld",
1183 apll, bpll, cpll, mpll, epll, vpll);
1184
1185 armclk = clk_get_rate(&exynos5_clk_armclk);
1186 mout_cdrex = clk_get_rate(&exynos5_clk_cdrex.clk);
1187
1188 aclk_400 = clk_get_rate(&exynos5_clk_aclk_400.clk);
1189 aclk_333 = clk_get_rate(&exynos5_clk_aclk_333.clk);
1190 aclk_266 = clk_get_rate(&exynos5_clk_aclk_266.clk);
1191 aclk_200 = clk_get_rate(&exynos5_clk_aclk_200.clk);
1192 aclk_166 = clk_get_rate(&exynos5_clk_aclk_166.clk);
1193 aclk_66 = clk_get_rate(&exynos5_clk_aclk_66.clk);
1194
1195 printk(KERN_INFO "EXYNOS5: ARMCLK=%ld, CDREX=%ld, ACLK400=%ld\n"
1196 "ACLK333=%ld, ACLK266=%ld, ACLK200=%ld\n"
1197 "ACLK166=%ld, ACLK66=%ld\n",
1198 armclk, mout_cdrex, aclk_400,
1199 aclk_333, aclk_266, aclk_200,
1200 aclk_166, aclk_66);
1201
1202
1203 clk_fout_epll.ops = &exynos5_epll_ops;
1204
1205 if (clk_set_parent(&exynos5_clk_mout_epll.clk, &clk_fout_epll))
1206 printk(KERN_ERR "Unable to set parent %s of clock %s.\n",
1207 clk_fout_epll.name, exynos5_clk_mout_epll.clk.name);
1208
1209 clk_set_rate(&exynos5_clk_sclk_apll.clk, 100000000);
1210 clk_set_rate(&exynos5_clk_aclk_266.clk, 300000000);
1211
1212 clk_set_rate(&exynos5_clk_aclk_acp.clk, 267000000);
1213 clk_set_rate(&exynos5_clk_pclk_acp.clk, 134000000);
1214
1215 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrcs); ptr++)
1216 s3c_set_clksrc(&exynos5_clksrcs[ptr], true);
1217}
1218
1219void __init exynos5_register_clocks(void)
1220{
1221 int ptr;
1222
1223 s3c24xx_register_clocks(exynos5_clks, ARRAY_SIZE(exynos5_clks));
1224
1225 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sysclks); ptr++)
1226 s3c_register_clksrc(exynos5_sysclks[ptr], 1);
1227
1228 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_sclk_tv); ptr++)
1229 s3c_register_clksrc(exynos5_sclk_tv[ptr], 1);
1230
1231 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clksrc_cdev); ptr++)
1232 s3c_register_clksrc(exynos5_clksrc_cdev[ptr], 1);
1233
1234 s3c_register_clksrc(exynos5_clksrcs, ARRAY_SIZE(exynos5_clksrcs));
1235 s3c_register_clocks(exynos5_init_clocks_on, ARRAY_SIZE(exynos5_init_clocks_on));
1236
1237 s3c24xx_register_clocks(exynos5_clk_cdev, ARRAY_SIZE(exynos5_clk_cdev));
1238 for (ptr = 0; ptr < ARRAY_SIZE(exynos5_clk_cdev); ptr++)
1239 s3c_disable_clocks(exynos5_clk_cdev[ptr], 1);
1240
1241 s3c_register_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off));
1242 s3c_disable_clocks(exynos5_init_clocks_off, ARRAY_SIZE(exynos5_init_clocks_off));
1243 clkdev_add_table(exynos5_clk_lookup, ARRAY_SIZE(exynos5_clk_lookup));
1244
1245 register_syscore_ops(&exynos5_clock_syscore_ops);
1246 s3c_pwmclk_init();
1247}
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 97ca2592ce83..8614aab47cc0 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -53,6 +53,14 @@
53static const char name_exynos4210[] = "EXYNOS4210"; 53static const char name_exynos4210[] = "EXYNOS4210";
54static const char name_exynos4212[] = "EXYNOS4212"; 54static const char name_exynos4212[] = "EXYNOS4212";
55static const char name_exynos4412[] = "EXYNOS4412"; 55static const char name_exynos4412[] = "EXYNOS4412";
56static const char name_exynos5250[] = "EXYNOS5250";
57
58static void exynos4_map_io(void);
59static void exynos5_map_io(void);
60static void exynos4_init_clocks(int xtal);
61static void exynos5_init_clocks(int xtal);
62static void exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no);
63static int exynos_init(void);
56 64
57static struct cpu_table cpu_ids[] __initdata = { 65static struct cpu_table cpu_ids[] __initdata = {
58 { 66 {
@@ -60,7 +68,7 @@ static struct cpu_table cpu_ids[] __initdata = {
60 .idmask = EXYNOS4_CPU_MASK, 68 .idmask = EXYNOS4_CPU_MASK,
61 .map_io = exynos4_map_io, 69 .map_io = exynos4_map_io,
62 .init_clocks = exynos4_init_clocks, 70 .init_clocks = exynos4_init_clocks,
63 .init_uarts = exynos4_init_uarts, 71 .init_uarts = exynos_init_uarts,
64 .init = exynos_init, 72 .init = exynos_init,
65 .name = name_exynos4210, 73 .name = name_exynos4210,
66 }, { 74 }, {
@@ -68,7 +76,7 @@ static struct cpu_table cpu_ids[] __initdata = {
68 .idmask = EXYNOS4_CPU_MASK, 76 .idmask = EXYNOS4_CPU_MASK,
69 .map_io = exynos4_map_io, 77 .map_io = exynos4_map_io,
70 .init_clocks = exynos4_init_clocks, 78 .init_clocks = exynos4_init_clocks,
71 .init_uarts = exynos4_init_uarts, 79 .init_uarts = exynos_init_uarts,
72 .init = exynos_init, 80 .init = exynos_init,
73 .name = name_exynos4212, 81 .name = name_exynos4212,
74 }, { 82 }, {
@@ -76,9 +84,17 @@ static struct cpu_table cpu_ids[] __initdata = {
76 .idmask = EXYNOS4_CPU_MASK, 84 .idmask = EXYNOS4_CPU_MASK,
77 .map_io = exynos4_map_io, 85 .map_io = exynos4_map_io,
78 .init_clocks = exynos4_init_clocks, 86 .init_clocks = exynos4_init_clocks,
79 .init_uarts = exynos4_init_uarts, 87 .init_uarts = exynos_init_uarts,
80 .init = exynos_init, 88 .init = exynos_init,
81 .name = name_exynos4412, 89 .name = name_exynos4412,
90 }, {
91 .idcode = EXYNOS5250_SOC_ID,
92 .idmask = EXYNOS5_SOC_MASK,
93 .map_io = exynos5_map_io,
94 .init_clocks = exynos5_init_clocks,
95 .init_uarts = exynos_init_uarts,
96 .init = exynos_init,
97 .name = name_exynos5250,
82 }, 98 },
83}; 99};
84 100
@@ -87,10 +103,14 @@ static struct cpu_table cpu_ids[] __initdata = {
87static struct map_desc exynos_iodesc[] __initdata = { 103static struct map_desc exynos_iodesc[] __initdata = {
88 { 104 {
89 .virtual = (unsigned long)S5P_VA_CHIPID, 105 .virtual = (unsigned long)S5P_VA_CHIPID,
90 .pfn = __phys_to_pfn(EXYNOS4_PA_CHIPID), 106 .pfn = __phys_to_pfn(EXYNOS_PA_CHIPID),
91 .length = SZ_4K, 107 .length = SZ_4K,
92 .type = MT_DEVICE, 108 .type = MT_DEVICE,
93 }, { 109 },
110};
111
112static struct map_desc exynos4_iodesc[] __initdata = {
113 {
94 .virtual = (unsigned long)S3C_VA_SYS, 114 .virtual = (unsigned long)S3C_VA_SYS,
95 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSCON), 115 .pfn = __phys_to_pfn(EXYNOS4_PA_SYSCON),
96 .length = SZ_64K, 116 .length = SZ_64K,
@@ -140,11 +160,7 @@ static struct map_desc exynos_iodesc[] __initdata = {
140 .pfn = __phys_to_pfn(EXYNOS4_PA_UART), 160 .pfn = __phys_to_pfn(EXYNOS4_PA_UART),
141 .length = SZ_512K, 161 .length = SZ_512K,
142 .type = MT_DEVICE, 162 .type = MT_DEVICE,
143 }, 163 }, {
144};
145
146static struct map_desc exynos4_iodesc[] __initdata = {
147 {
148 .virtual = (unsigned long)S5P_VA_CMU, 164 .virtual = (unsigned long)S5P_VA_CMU,
149 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU), 165 .pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
150 .length = SZ_128K, 166 .length = SZ_128K,
@@ -160,21 +176,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
160 .length = SZ_4K, 176 .length = SZ_4K,
161 .type = MT_DEVICE, 177 .type = MT_DEVICE,
162 }, { 178 }, {
163 .virtual = (unsigned long)S5P_VA_GPIO1,
164 .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO1),
165 .length = SZ_4K,
166 .type = MT_DEVICE,
167 }, {
168 .virtual = (unsigned long)S5P_VA_GPIO2,
169 .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO2),
170 .length = SZ_4K,
171 .type = MT_DEVICE,
172 }, {
173 .virtual = (unsigned long)S5P_VA_GPIO3,
174 .pfn = __phys_to_pfn(EXYNOS4_PA_GPIO3),
175 .length = SZ_256,
176 .type = MT_DEVICE,
177 }, {
178 .virtual = (unsigned long)S5P_VA_DMC0, 179 .virtual = (unsigned long)S5P_VA_DMC0,
179 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0), 180 .pfn = __phys_to_pfn(EXYNOS4_PA_DMC0),
180 .length = SZ_64K, 181 .length = SZ_64K,
@@ -210,11 +211,80 @@ static struct map_desc exynos4_iodesc1[] __initdata = {
210 }, 211 },
211}; 212};
212 213
214static struct map_desc exynos5_iodesc[] __initdata = {
215 {
216 .virtual = (unsigned long)S3C_VA_SYS,
217 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSCON),
218 .length = SZ_64K,
219 .type = MT_DEVICE,
220 }, {
221 .virtual = (unsigned long)S3C_VA_TIMER,
222 .pfn = __phys_to_pfn(EXYNOS5_PA_TIMER),
223 .length = SZ_16K,
224 .type = MT_DEVICE,
225 }, {
226 .virtual = (unsigned long)S3C_VA_WATCHDOG,
227 .pfn = __phys_to_pfn(EXYNOS5_PA_WATCHDOG),
228 .length = SZ_4K,
229 .type = MT_DEVICE,
230 }, {
231 .virtual = (unsigned long)S5P_VA_SROMC,
232 .pfn = __phys_to_pfn(EXYNOS5_PA_SROMC),
233 .length = SZ_4K,
234 .type = MT_DEVICE,
235 }, {
236 .virtual = (unsigned long)S5P_VA_SYSTIMER,
237 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSTIMER),
238 .length = SZ_4K,
239 .type = MT_DEVICE,
240 }, {
241 .virtual = (unsigned long)S5P_VA_SYSRAM,
242 .pfn = __phys_to_pfn(EXYNOS5_PA_SYSRAM),
243 .length = SZ_4K,
244 .type = MT_DEVICE,
245 }, {
246 .virtual = (unsigned long)S5P_VA_CMU,
247 .pfn = __phys_to_pfn(EXYNOS5_PA_CMU),
248 .length = 144 * SZ_1K,
249 .type = MT_DEVICE,
250 }, {
251 .virtual = (unsigned long)S5P_VA_PMU,
252 .pfn = __phys_to_pfn(EXYNOS5_PA_PMU),
253 .length = SZ_64K,
254 .type = MT_DEVICE,
255 }, {
256 .virtual = (unsigned long)S5P_VA_COMBINER_BASE,
257 .pfn = __phys_to_pfn(EXYNOS5_PA_COMBINER),
258 .length = SZ_4K,
259 .type = MT_DEVICE,
260 }, {
261 .virtual = (unsigned long)S3C_VA_UART,
262 .pfn = __phys_to_pfn(EXYNOS5_PA_UART),
263 .length = SZ_512K,
264 .type = MT_DEVICE,
265 }, {
266 .virtual = (unsigned long)S5P_VA_GIC_CPU,
267 .pfn = __phys_to_pfn(EXYNOS5_PA_GIC_CPU),
268 .length = SZ_64K,
269 .type = MT_DEVICE,
270 }, {
271 .virtual = (unsigned long)S5P_VA_GIC_DIST,
272 .pfn = __phys_to_pfn(EXYNOS5_PA_GIC_DIST),
273 .length = SZ_64K,
274 .type = MT_DEVICE,
275 },
276};
277
213void exynos4_restart(char mode, const char *cmd) 278void exynos4_restart(char mode, const char *cmd)
214{ 279{
215 __raw_writel(0x1, S5P_SWRESET); 280 __raw_writel(0x1, S5P_SWRESET);
216} 281}
217 282
283void exynos5_restart(char mode, const char *cmd)
284{
285 __raw_writel(0x1, EXYNOS_SWRESET);
286}
287
218/* 288/*
219 * exynos_map_io 289 * exynos_map_io
220 * 290 *
@@ -234,7 +304,7 @@ void __init exynos_init_io(struct map_desc *mach_desc, int size)
234 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); 304 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
235} 305}
236 306
237void __init exynos4_map_io(void) 307static void __init exynos4_map_io(void)
238{ 308{
239 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); 309 iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
240 310
@@ -265,7 +335,22 @@ void __init exynos4_map_io(void)
265 s5p_hdmi_setname("exynos4-hdmi"); 335 s5p_hdmi_setname("exynos4-hdmi");
266} 336}
267 337
268void __init exynos4_init_clocks(int xtal) 338static void __init exynos5_map_io(void)
339{
340 iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc));
341
342 s3c_device_i2c0.resource[0].start = EXYNOS5_PA_IIC(0);
343 s3c_device_i2c0.resource[0].end = EXYNOS5_PA_IIC(0) + SZ_4K - 1;
344 s3c_device_i2c0.resource[1].start = EXYNOS5_IRQ_IIC;
345 s3c_device_i2c0.resource[1].end = EXYNOS5_IRQ_IIC;
346
347 /* The I2C bus controllers are directly compatible with s3c2440 */
348 s3c_i2c0_setname("s3c2440-i2c");
349 s3c_i2c1_setname("s3c2440-i2c");
350 s3c_i2c2_setname("s3c2440-i2c");
351}
352
353static void __init exynos4_init_clocks(int xtal)
269{ 354{
270 printk(KERN_DEBUG "%s: initializing clocks\n", __func__); 355 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
271 356
@@ -281,6 +366,17 @@ void __init exynos4_init_clocks(int xtal)
281 exynos4_setup_clocks(); 366 exynos4_setup_clocks();
282} 367}
283 368
369static void __init exynos5_init_clocks(int xtal)
370{
371 printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
372
373 s3c24xx_register_baseclocks(xtal);
374 s5p_register_clocks(xtal);
375
376 exynos5_register_clocks();
377 exynos5_setup_clocks();
378}
379
284#define COMBINER_ENABLE_SET 0x0 380#define COMBINER_ENABLE_SET 0x0
285#define COMBINER_ENABLE_CLEAR 0x4 381#define COMBINER_ENABLE_CLEAR 0x4
286#define COMBINER_INT_STATUS 0xC 382#define COMBINER_INT_STATUS 0xC
@@ -354,7 +450,14 @@ static struct irq_chip combiner_chip = {
354 450
355static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq) 451static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq)
356{ 452{
357 if (combiner_nr >= MAX_COMBINER_NR) 453 unsigned int max_nr;
454
455 if (soc_is_exynos5250())
456 max_nr = EXYNOS5_MAX_COMBINER_NR;
457 else
458 max_nr = EXYNOS4_MAX_COMBINER_NR;
459
460 if (combiner_nr >= max_nr)
358 BUG(); 461 BUG();
359 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0) 462 if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0)
360 BUG(); 463 BUG();
@@ -365,8 +468,14 @@ static void __init combiner_init(unsigned int combiner_nr, void __iomem *base,
365 unsigned int irq_start) 468 unsigned int irq_start)
366{ 469{
367 unsigned int i; 470 unsigned int i;
471 unsigned int max_nr;
368 472
369 if (combiner_nr >= MAX_COMBINER_NR) 473 if (soc_is_exynos5250())
474 max_nr = EXYNOS5_MAX_COMBINER_NR;
475 else
476 max_nr = EXYNOS4_MAX_COMBINER_NR;
477
478 if (combiner_nr >= max_nr)
370 BUG(); 479 BUG();
371 480
372 combiner_data[combiner_nr].base = base; 481 combiner_data[combiner_nr].base = base;
@@ -409,7 +518,7 @@ void __init exynos4_init_irq(void)
409 of_irq_init(exynos4_dt_irq_match); 518 of_irq_init(exynos4_dt_irq_match);
410#endif 519#endif
411 520
412 for (irq = 0; irq < MAX_COMBINER_NR; irq++) { 521 for (irq = 0; irq < EXYNOS4_MAX_COMBINER_NR; irq++) {
413 522
414 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq), 523 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
415 COMBINER_IRQ(irq, 0)); 524 COMBINER_IRQ(irq, 0));
@@ -424,25 +533,61 @@ void __init exynos4_init_irq(void)
424 s5p_init_irq(NULL, 0); 533 s5p_init_irq(NULL, 0);
425} 534}
426 535
536void __init exynos5_init_irq(void)
537{
538 int irq;
539
540 gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
541
542 for (irq = 0; irq < EXYNOS5_MAX_COMBINER_NR; irq++) {
543 combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
544 COMBINER_IRQ(irq, 0));
545 combiner_cascade_irq(irq, IRQ_SPI(irq));
546 }
547
548 /*
549 * The parameters of s5p_init_irq() are for VIC init.
550 * Theses parameters should be NULL and 0 because EXYNOS4
551 * uses GIC instead of VIC.
552 */
553 s5p_init_irq(NULL, 0);
554}
555
427struct bus_type exynos4_subsys = { 556struct bus_type exynos4_subsys = {
428 .name = "exynos4-core", 557 .name = "exynos4-core",
429 .dev_name = "exynos4-core", 558 .dev_name = "exynos4-core",
430}; 559};
431 560
561struct bus_type exynos5_subsys = {
562 .name = "exynos5-core",
563 .dev_name = "exynos5-core",
564};
565
432static struct device exynos4_dev = { 566static struct device exynos4_dev = {
433 .bus = &exynos4_subsys, 567 .bus = &exynos4_subsys,
434}; 568};
435 569
436static int __init exynos4_core_init(void) 570static struct device exynos5_dev = {
571 .bus = &exynos5_subsys,
572};
573
574static int __init exynos_core_init(void)
437{ 575{
438 return subsys_system_register(&exynos4_subsys, NULL); 576 if (soc_is_exynos5250())
577 return subsys_system_register(&exynos5_subsys, NULL);
578 else
579 return subsys_system_register(&exynos4_subsys, NULL);
439} 580}
440core_initcall(exynos4_core_init); 581core_initcall(exynos_core_init);
441 582
442#ifdef CONFIG_CACHE_L2X0 583#ifdef CONFIG_CACHE_L2X0
443static int __init exynos4_l2x0_cache_init(void) 584static int __init exynos4_l2x0_cache_init(void)
444{ 585{
445 int ret; 586 int ret;
587
588 if (soc_is_exynos5250())
589 return 0;
590
446 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK); 591 ret = l2x0_of_init(L2_AUX_VAL, L2_AUX_MASK);
447 if (!ret) { 592 if (!ret) {
448 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs); 593 l2x0_regs_phys = virt_to_phys(&l2x0_saved_regs);
@@ -486,19 +631,47 @@ static int __init exynos4_l2x0_cache_init(void)
486 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK); 631 l2x0_init(S5P_VA_L2CC, L2_AUX_VAL, L2_AUX_MASK);
487 return 0; 632 return 0;
488} 633}
489
490early_initcall(exynos4_l2x0_cache_init); 634early_initcall(exynos4_l2x0_cache_init);
491#endif 635#endif
492 636
493int __init exynos_init(void) 637static int __init exynos5_l2_cache_init(void)
638{
639 unsigned int val;
640
641 if (!soc_is_exynos5250())
642 return 0;
643
644 asm volatile("mrc p15, 0, %0, c1, c0, 0\n"
645 "bic %0, %0, #(1 << 2)\n" /* cache disable */
646 "mcr p15, 0, %0, c1, c0, 0\n"
647 "mrc p15, 1, %0, c9, c0, 2\n"
648 : "=r"(val));
649
650 val |= (1 << 9) | (1 << 5) | (2 << 6) | (2 << 0);
651
652 asm volatile("mcr p15, 1, %0, c9, c0, 2\n" : : "r"(val));
653 asm volatile("mrc p15, 0, %0, c1, c0, 0\n"
654 "orr %0, %0, #(1 << 2)\n" /* cache enable */
655 "mcr p15, 0, %0, c1, c0, 0\n"
656 : : "r"(val));
657
658 return 0;
659}
660early_initcall(exynos5_l2_cache_init);
661
662static int __init exynos_init(void)
494{ 663{
495 printk(KERN_INFO "EXYNOS: Initializing architecture\n"); 664 printk(KERN_INFO "EXYNOS: Initializing architecture\n");
496 return device_register(&exynos4_dev); 665
666 if (soc_is_exynos5250())
667 return device_register(&exynos5_dev);
668 else
669 return device_register(&exynos4_dev);
497} 670}
498 671
499/* uart registration process */ 672/* uart registration process */
500 673
501void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no) 674static void __init exynos_init_uarts(struct s3c2410_uartcfg *cfg, int no)
502{ 675{
503 struct s3c2410_uartcfg *tcfg = cfg; 676 struct s3c2410_uartcfg *tcfg = cfg;
504 u32 ucnt; 677 u32 ucnt;
@@ -506,69 +679,138 @@ void __init exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no)
506 for (ucnt = 0; ucnt < no; ucnt++, tcfg++) 679 for (ucnt = 0; ucnt < no; ucnt++, tcfg++)
507 tcfg->has_fracval = 1; 680 tcfg->has_fracval = 1;
508 681
509 s3c24xx_init_uartdevs("exynos4210-uart", s5p_uart_resources, cfg, no); 682 if (soc_is_exynos5250())
683 s3c24xx_init_uartdevs("exynos4210-uart", exynos5_uart_resources, cfg, no);
684 else
685 s3c24xx_init_uartdevs("exynos4210-uart", exynos4_uart_resources, cfg, no);
510} 686}
511 687
688static void __iomem *exynos_eint_base;
689
512static DEFINE_SPINLOCK(eint_lock); 690static DEFINE_SPINLOCK(eint_lock);
513 691
514static unsigned int eint0_15_data[16]; 692static unsigned int eint0_15_data[16];
515 693
516static unsigned int exynos4_get_irq_nr(unsigned int number) 694static inline int exynos4_irq_to_gpio(unsigned int irq)
517{ 695{
518 u32 ret = 0; 696 if (irq < IRQ_EINT(0))
697 return -EINVAL;
519 698
520 switch (number) { 699 irq -= IRQ_EINT(0);
521 case 0 ... 3: 700 if (irq < 8)
522 ret = (number + IRQ_EINT0); 701 return EXYNOS4_GPX0(irq);
523 break; 702
524 case 4 ... 7: 703 irq -= 8;
525 ret = (number + (IRQ_EINT4 - 4)); 704 if (irq < 8)
526 break; 705 return EXYNOS4_GPX1(irq);
527 case 8 ... 15: 706
528 ret = (number + (IRQ_EINT8 - 8)); 707 irq -= 8;
529 break; 708 if (irq < 8)
530 default: 709 return EXYNOS4_GPX2(irq);
531 printk(KERN_ERR "number available : %d\n", number); 710
532 } 711 irq -= 8;
712 if (irq < 8)
713 return EXYNOS4_GPX3(irq);
714
715 return -EINVAL;
716}
533 717
534 return ret; 718static inline int exynos5_irq_to_gpio(unsigned int irq)
719{
720 if (irq < IRQ_EINT(0))
721 return -EINVAL;
722
723 irq -= IRQ_EINT(0);
724 if (irq < 8)
725 return EXYNOS5_GPX0(irq);
726
727 irq -= 8;
728 if (irq < 8)
729 return EXYNOS5_GPX1(irq);
730
731 irq -= 8;
732 if (irq < 8)
733 return EXYNOS5_GPX2(irq);
734
735 irq -= 8;
736 if (irq < 8)
737 return EXYNOS5_GPX3(irq);
738
739 return -EINVAL;
535} 740}
536 741
537static inline void exynos4_irq_eint_mask(struct irq_data *data) 742static unsigned int exynos4_eint0_15_src_int[16] = {
743 EXYNOS4_IRQ_EINT0,
744 EXYNOS4_IRQ_EINT1,
745 EXYNOS4_IRQ_EINT2,
746 EXYNOS4_IRQ_EINT3,
747 EXYNOS4_IRQ_EINT4,
748 EXYNOS4_IRQ_EINT5,
749 EXYNOS4_IRQ_EINT6,
750 EXYNOS4_IRQ_EINT7,
751 EXYNOS4_IRQ_EINT8,
752 EXYNOS4_IRQ_EINT9,
753 EXYNOS4_IRQ_EINT10,
754 EXYNOS4_IRQ_EINT11,
755 EXYNOS4_IRQ_EINT12,
756 EXYNOS4_IRQ_EINT13,
757 EXYNOS4_IRQ_EINT14,
758 EXYNOS4_IRQ_EINT15,
759};
760
761static unsigned int exynos5_eint0_15_src_int[16] = {
762 EXYNOS5_IRQ_EINT0,
763 EXYNOS5_IRQ_EINT1,
764 EXYNOS5_IRQ_EINT2,
765 EXYNOS5_IRQ_EINT3,
766 EXYNOS5_IRQ_EINT4,
767 EXYNOS5_IRQ_EINT5,
768 EXYNOS5_IRQ_EINT6,
769 EXYNOS5_IRQ_EINT7,
770 EXYNOS5_IRQ_EINT8,
771 EXYNOS5_IRQ_EINT9,
772 EXYNOS5_IRQ_EINT10,
773 EXYNOS5_IRQ_EINT11,
774 EXYNOS5_IRQ_EINT12,
775 EXYNOS5_IRQ_EINT13,
776 EXYNOS5_IRQ_EINT14,
777 EXYNOS5_IRQ_EINT15,
778};
779static inline void exynos_irq_eint_mask(struct irq_data *data)
538{ 780{
539 u32 mask; 781 u32 mask;
540 782
541 spin_lock(&eint_lock); 783 spin_lock(&eint_lock);
542 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq))); 784 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
543 mask |= eint_irq_to_bit(data->irq); 785 mask |= EINT_OFFSET_BIT(data->irq);
544 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq))); 786 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
545 spin_unlock(&eint_lock); 787 spin_unlock(&eint_lock);
546} 788}
547 789
548static void exynos4_irq_eint_unmask(struct irq_data *data) 790static void exynos_irq_eint_unmask(struct irq_data *data)
549{ 791{
550 u32 mask; 792 u32 mask;
551 793
552 spin_lock(&eint_lock); 794 spin_lock(&eint_lock);
553 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(data->irq))); 795 mask = __raw_readl(EINT_MASK(exynos_eint_base, data->irq));
554 mask &= ~(eint_irq_to_bit(data->irq)); 796 mask &= ~(EINT_OFFSET_BIT(data->irq));
555 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(data->irq))); 797 __raw_writel(mask, EINT_MASK(exynos_eint_base, data->irq));
556 spin_unlock(&eint_lock); 798 spin_unlock(&eint_lock);
557} 799}
558 800
559static inline void exynos4_irq_eint_ack(struct irq_data *data) 801static inline void exynos_irq_eint_ack(struct irq_data *data)
560{ 802{
561 __raw_writel(eint_irq_to_bit(data->irq), 803 __raw_writel(EINT_OFFSET_BIT(data->irq),
562 S5P_EINT_PEND(EINT_REG_NR(data->irq))); 804 EINT_PEND(exynos_eint_base, data->irq));
563} 805}
564 806
565static void exynos4_irq_eint_maskack(struct irq_data *data) 807static void exynos_irq_eint_maskack(struct irq_data *data)
566{ 808{
567 exynos4_irq_eint_mask(data); 809 exynos_irq_eint_mask(data);
568 exynos4_irq_eint_ack(data); 810 exynos_irq_eint_ack(data);
569} 811}
570 812
571static int exynos4_irq_eint_set_type(struct irq_data *data, unsigned int type) 813static int exynos_irq_eint_set_type(struct irq_data *data, unsigned int type)
572{ 814{
573 int offs = EINT_OFFSET(data->irq); 815 int offs = EINT_OFFSET(data->irq);
574 int shift; 816 int shift;
@@ -605,39 +847,27 @@ static int exynos4_irq_eint_set_type(struct irq_data *data, unsigned int type)
605 mask = 0x7 << shift; 847 mask = 0x7 << shift;
606 848
607 spin_lock(&eint_lock); 849 spin_lock(&eint_lock);
608 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(data->irq))); 850 ctrl = __raw_readl(EINT_CON(exynos_eint_base, data->irq));
609 ctrl &= ~mask; 851 ctrl &= ~mask;
610 ctrl |= newvalue << shift; 852 ctrl |= newvalue << shift;
611 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(data->irq))); 853 __raw_writel(ctrl, EINT_CON(exynos_eint_base, data->irq));
612 spin_unlock(&eint_lock); 854 spin_unlock(&eint_lock);
613 855
614 switch (offs) { 856 if (soc_is_exynos5250())
615 case 0 ... 7: 857 s3c_gpio_cfgpin(exynos5_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
616 s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE); 858 else
617 break; 859 s3c_gpio_cfgpin(exynos4_irq_to_gpio(data->irq), S3C_GPIO_SFN(0xf));
618 case 8 ... 15:
619 s3c_gpio_cfgpin(EINT_GPIO_1(offs & 0x7), EINT_MODE);
620 break;
621 case 16 ... 23:
622 s3c_gpio_cfgpin(EINT_GPIO_2(offs & 0x7), EINT_MODE);
623 break;
624 case 24 ... 31:
625 s3c_gpio_cfgpin(EINT_GPIO_3(offs & 0x7), EINT_MODE);
626 break;
627 default:
628 printk(KERN_ERR "No such irq number %d", offs);
629 }
630 860
631 return 0; 861 return 0;
632} 862}
633 863
634static struct irq_chip exynos4_irq_eint = { 864static struct irq_chip exynos_irq_eint = {
635 .name = "exynos4-eint", 865 .name = "exynos-eint",
636 .irq_mask = exynos4_irq_eint_mask, 866 .irq_mask = exynos_irq_eint_mask,
637 .irq_unmask = exynos4_irq_eint_unmask, 867 .irq_unmask = exynos_irq_eint_unmask,
638 .irq_mask_ack = exynos4_irq_eint_maskack, 868 .irq_mask_ack = exynos_irq_eint_maskack,
639 .irq_ack = exynos4_irq_eint_ack, 869 .irq_ack = exynos_irq_eint_ack,
640 .irq_set_type = exynos4_irq_eint_set_type, 870 .irq_set_type = exynos_irq_eint_set_type,
641#ifdef CONFIG_PM 871#ifdef CONFIG_PM
642 .irq_set_wake = s3c_irqext_wake, 872 .irq_set_wake = s3c_irqext_wake,
643#endif 873#endif
@@ -652,12 +882,12 @@ static struct irq_chip exynos4_irq_eint = {
652 * 882 *
653 * Each EINT pend/mask registers handle eight of them. 883 * Each EINT pend/mask registers handle eight of them.
654 */ 884 */
655static inline void exynos4_irq_demux_eint(unsigned int start) 885static inline void exynos_irq_demux_eint(unsigned int start)
656{ 886{
657 unsigned int irq; 887 unsigned int irq;
658 888
659 u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start))); 889 u32 status = __raw_readl(EINT_PEND(exynos_eint_base, start));
660 u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start))); 890 u32 mask = __raw_readl(EINT_MASK(exynos_eint_base, start));
661 891
662 status &= ~mask; 892 status &= ~mask;
663 status &= 0xff; 893 status &= 0xff;
@@ -669,16 +899,16 @@ static inline void exynos4_irq_demux_eint(unsigned int start)
669 } 899 }
670} 900}
671 901
672static void exynos4_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc) 902static void exynos_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
673{ 903{
674 struct irq_chip *chip = irq_get_chip(irq); 904 struct irq_chip *chip = irq_get_chip(irq);
675 chained_irq_enter(chip, desc); 905 chained_irq_enter(chip, desc);
676 exynos4_irq_demux_eint(IRQ_EINT(16)); 906 exynos_irq_demux_eint(IRQ_EINT(16));
677 exynos4_irq_demux_eint(IRQ_EINT(24)); 907 exynos_irq_demux_eint(IRQ_EINT(24));
678 chained_irq_exit(chip, desc); 908 chained_irq_exit(chip, desc);
679} 909}
680 910
681static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc) 911static void exynos_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
682{ 912{
683 u32 *irq_data = irq_get_handler_data(irq); 913 u32 *irq_data = irq_get_handler_data(irq);
684 struct irq_chip *chip = irq_get_chip(irq); 914 struct irq_chip *chip = irq_get_chip(irq);
@@ -695,27 +925,44 @@ static void exynos4_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
695 chained_irq_exit(chip, desc); 925 chained_irq_exit(chip, desc);
696} 926}
697 927
698static int __init exynos4_init_irq_eint(void) 928static int __init exynos_init_irq_eint(void)
699{ 929{
700 int irq; 930 int irq;
701 931
932 if (soc_is_exynos5250())
933 exynos_eint_base = ioremap(EXYNOS5_PA_GPIO1, SZ_4K);
934 else
935 exynos_eint_base = ioremap(EXYNOS4_PA_GPIO2, SZ_4K);
936
937 if (exynos_eint_base == NULL) {
938 pr_err("unable to ioremap for EINT base address\n");
939 return -ENOMEM;
940 }
941
702 for (irq = 0 ; irq <= 31 ; irq++) { 942 for (irq = 0 ; irq <= 31 ; irq++) {
703 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos4_irq_eint, 943 irq_set_chip_and_handler(IRQ_EINT(irq), &exynos_irq_eint,
704 handle_level_irq); 944 handle_level_irq);
705 set_irq_flags(IRQ_EINT(irq), IRQF_VALID); 945 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
706 } 946 }
707 947
708 irq_set_chained_handler(IRQ_EINT16_31, exynos4_irq_demux_eint16_31); 948 irq_set_chained_handler(EXYNOS_IRQ_EINT16_31, exynos_irq_demux_eint16_31);
709 949
710 for (irq = 0 ; irq <= 15 ; irq++) { 950 for (irq = 0 ; irq <= 15 ; irq++) {
711 eint0_15_data[irq] = IRQ_EINT(irq); 951 eint0_15_data[irq] = IRQ_EINT(irq);
712 952
713 irq_set_handler_data(exynos4_get_irq_nr(irq), 953 if (soc_is_exynos5250()) {
714 &eint0_15_data[irq]); 954 irq_set_handler_data(exynos5_eint0_15_src_int[irq],
715 irq_set_chained_handler(exynos4_get_irq_nr(irq), 955 &eint0_15_data[irq]);
716 exynos4_irq_eint0_15); 956 irq_set_chained_handler(exynos5_eint0_15_src_int[irq],
957 exynos_irq_eint0_15);
958 } else {
959 irq_set_handler_data(exynos4_eint0_15_src_int[irq],
960 &eint0_15_data[irq]);
961 irq_set_chained_handler(exynos4_eint0_15_src_int[irq],
962 exynos_irq_eint0_15);
963 }
717 } 964 }
718 965
719 return 0; 966 return 0;
720} 967}
721arch_initcall(exynos4_init_irq_eint); 968arch_initcall(exynos_init_irq_eint);
diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h
index 8c1efe692c20..677b5467df18 100644
--- a/arch/arm/mach-exynos/common.h
+++ b/arch/arm/mach-exynos/common.h
@@ -12,39 +12,44 @@
12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H 12#ifndef __ARCH_ARM_MACH_EXYNOS_COMMON_H
13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H 13#define __ARCH_ARM_MACH_EXYNOS_COMMON_H
14 14
15extern struct sys_timer exynos4_timer;
16
15void exynos_init_io(struct map_desc *mach_desc, int size); 17void exynos_init_io(struct map_desc *mach_desc, int size);
16void exynos4_init_irq(void); 18void exynos4_init_irq(void);
19void exynos5_init_irq(void);
20void exynos4_restart(char mode, const char *cmd);
21void exynos5_restart(char mode, const char *cmd);
17 22
18#ifdef CONFIG_ARCH_EXYNOS4 23#ifdef CONFIG_ARCH_EXYNOS4
19void exynos4_register_clocks(void); 24void exynos4_register_clocks(void);
20void exynos4_setup_clocks(void); 25void exynos4_setup_clocks(void);
21 26
22void exynos4210_register_clocks(void);
23void exynos4212_register_clocks(void);
24
25#else 27#else
26#define exynos4_register_clocks() 28#define exynos4_register_clocks()
27#define exynos4_setup_clocks() 29#define exynos4_setup_clocks()
30#endif
28 31
29#define exynos4210_register_clocks() 32#ifdef CONFIG_ARCH_EXYNOS5
30#define exynos4212_register_clocks() 33void exynos5_register_clocks(void);
34void exynos5_setup_clocks(void);
35
36#else
37#define exynos5_register_clocks()
38#define exynos5_setup_clocks()
31#endif 39#endif
32 40
33void exynos4_restart(char mode, const char *cmd); 41#ifdef CONFIG_CPU_EXYNOS4210
42void exynos4210_register_clocks(void);
34 43
35extern struct sys_timer exynos4_timer; 44#else
45#define exynos4210_register_clocks()
46#endif
36 47
37#ifdef CONFIG_ARCH_EXYNOS 48#ifdef CONFIG_SOC_EXYNOS4212
38extern int exynos_init(void); 49void exynos4212_register_clocks(void);
39extern void exynos4_map_io(void);
40extern void exynos4_init_clocks(int xtal);
41extern void exynos4_init_uarts(struct s3c2410_uartcfg *cfg, int no);
42 50
43#else 51#else
44#define exynos4_init_clocks NULL 52#define exynos4212_register_clocks()
45#define exynos4_init_uarts NULL
46#define exynos4_map_io NULL
47#define exynos_init NULL
48#endif 53#endif
49 54
50#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ 55#endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */
diff --git a/arch/arm/mach-exynos/dev-ahci.c b/arch/arm/mach-exynos/dev-ahci.c
index f57a3de8e1d2..50ce5b0adcf1 100644
--- a/arch/arm/mach-exynos/dev-ahci.c
+++ b/arch/arm/mach-exynos/dev-ahci.c
@@ -242,8 +242,8 @@ static struct resource exynos4_ahci_resource[] = {
242 .flags = IORESOURCE_MEM, 242 .flags = IORESOURCE_MEM,
243 }, 243 },
244 [1] = { 244 [1] = {
245 .start = IRQ_SATA, 245 .start = EXYNOS4_IRQ_SATA,
246 .end = IRQ_SATA, 246 .end = EXYNOS4_IRQ_SATA,
247 .flags = IORESOURCE_IRQ, 247 .flags = IORESOURCE_IRQ,
248 }, 248 },
249}; 249};
diff --git a/arch/arm/mach-exynos/dev-audio.c b/arch/arm/mach-exynos/dev-audio.c
index 5a9f9c2e53bf..7199e1ae79b4 100644
--- a/arch/arm/mach-exynos/dev-audio.c
+++ b/arch/arm/mach-exynos/dev-audio.c
@@ -304,8 +304,8 @@ static struct resource exynos4_ac97_resource[] = {
304 .flags = IORESOURCE_DMA, 304 .flags = IORESOURCE_DMA,
305 }, 305 },
306 [4] = { 306 [4] = {
307 .start = IRQ_AC97, 307 .start = EXYNOS4_IRQ_AC97,
308 .end = IRQ_AC97, 308 .end = EXYNOS4_IRQ_AC97,
309 .flags = IORESOURCE_IRQ, 309 .flags = IORESOURCE_IRQ,
310 }, 310 },
311}; 311};
diff --git a/arch/arm/mach-exynos/dev-uart.c b/arch/arm/mach-exynos/dev-uart.c
new file mode 100644
index 000000000000..2e85c022fd16
--- /dev/null
+++ b/arch/arm/mach-exynos/dev-uart.c
@@ -0,0 +1,78 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Base EXYNOS UART resource and device definitions
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/interrupt.h>
15#include <linux/list.h>
16#include <linux/ioport.h>
17#include <linux/platform_device.h>
18
19#include <asm/mach/arch.h>
20#include <asm/mach/irq.h>
21#include <mach/hardware.h>
22#include <mach/map.h>
23
24#include <plat/devs.h>
25
26#define EXYNOS_UART_RESOURCE(_series, _nr) \
27static struct resource exynos##_series##_uart##_nr##_resource[] = { \
28 [0] = DEFINE_RES_MEM(EXYNOS##_series##_PA_UART##_nr, EXYNOS##_series##_SZ_UART), \
29 [1] = DEFINE_RES_IRQ(EXYNOS##_series##_IRQ_UART##_nr), \
30};
31
32EXYNOS_UART_RESOURCE(4, 0)
33EXYNOS_UART_RESOURCE(4, 1)
34EXYNOS_UART_RESOURCE(4, 2)
35EXYNOS_UART_RESOURCE(4, 3)
36
37struct s3c24xx_uart_resources exynos4_uart_resources[] __initdata = {
38 [0] = {
39 .resources = exynos4_uart0_resource,
40 .nr_resources = ARRAY_SIZE(exynos4_uart0_resource),
41 },
42 [1] = {
43 .resources = exynos4_uart1_resource,
44 .nr_resources = ARRAY_SIZE(exynos4_uart1_resource),
45 },
46 [2] = {
47 .resources = exynos4_uart2_resource,
48 .nr_resources = ARRAY_SIZE(exynos4_uart2_resource),
49 },
50 [3] = {
51 .resources = exynos4_uart3_resource,
52 .nr_resources = ARRAY_SIZE(exynos4_uart3_resource),
53 },
54};
55
56EXYNOS_UART_RESOURCE(5, 0)
57EXYNOS_UART_RESOURCE(5, 1)
58EXYNOS_UART_RESOURCE(5, 2)
59EXYNOS_UART_RESOURCE(5, 3)
60
61struct s3c24xx_uart_resources exynos5_uart_resources[] __initdata = {
62 [0] = {
63 .resources = exynos5_uart0_resource,
64 .nr_resources = ARRAY_SIZE(exynos5_uart0_resource),
65 },
66 [1] = {
67 .resources = exynos5_uart1_resource,
68 .nr_resources = ARRAY_SIZE(exynos5_uart0_resource),
69 },
70 [2] = {
71 .resources = exynos5_uart2_resource,
72 .nr_resources = ARRAY_SIZE(exynos5_uart2_resource),
73 },
74 [3] = {
75 .resources = exynos5_uart3_resource,
76 .nr_resources = ARRAY_SIZE(exynos5_uart3_resource),
77 },
78};
diff --git a/arch/arm/mach-exynos/dma.c b/arch/arm/mach-exynos/dma.c
index 13607c4328b3..69aaa4503205 100644
--- a/arch/arm/mach-exynos/dma.c
+++ b/arch/arm/mach-exynos/dma.c
@@ -35,8 +35,6 @@
35#include <mach/irqs.h> 35#include <mach/irqs.h>
36#include <mach/dma.h> 36#include <mach/dma.h>
37 37
38static u64 dma_dmamask = DMA_BIT_MASK(32);
39
40static u8 exynos4210_pdma0_peri[] = { 38static u8 exynos4210_pdma0_peri[] = {
41 DMACH_PCM0_RX, 39 DMACH_PCM0_RX,
42 DMACH_PCM0_TX, 40 DMACH_PCM0_TX,
@@ -108,7 +106,7 @@ static u8 exynos4212_pdma0_peri[] = {
108struct dma_pl330_platdata exynos4_pdma0_pdata; 106struct dma_pl330_platdata exynos4_pdma0_pdata;
109 107
110static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330, 108static AMBA_AHB_DEVICE(exynos4_pdma0, "dma-pl330.0", 0x00041330,
111 EXYNOS4_PA_PDMA0, {IRQ_PDMA0}, &exynos4_pdma0_pdata); 109 EXYNOS4_PA_PDMA0, {EXYNOS4_IRQ_PDMA0}, &exynos4_pdma0_pdata);
112 110
113static u8 exynos4210_pdma1_peri[] = { 111static u8 exynos4210_pdma1_peri[] = {
114 DMACH_PCM0_RX, 112 DMACH_PCM0_RX,
@@ -174,7 +172,7 @@ static u8 exynos4212_pdma1_peri[] = {
174static struct dma_pl330_platdata exynos4_pdma1_pdata; 172static struct dma_pl330_platdata exynos4_pdma1_pdata;
175 173
176static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330, 174static AMBA_AHB_DEVICE(exynos4_pdma1, "dma-pl330.1", 0x00041330,
177 EXYNOS4_PA_PDMA1, {IRQ_PDMA1}, &exynos4_pdma1_pdata); 175 EXYNOS4_PA_PDMA1, {EXYNOS4_IRQ_PDMA1}, &exynos4_pdma1_pdata);
178 176
179static u8 mdma_peri[] = { 177static u8 mdma_peri[] = {
180 DMACH_MTOM_0, 178 DMACH_MTOM_0,
@@ -193,7 +191,7 @@ static struct dma_pl330_platdata exynos4_mdma1_pdata = {
193}; 191};
194 192
195static AMBA_AHB_DEVICE(exynos4_mdma1, "dma-pl330.2", 0x00041330, 193static AMBA_AHB_DEVICE(exynos4_mdma1, "dma-pl330.2", 0x00041330,
196 EXYNOS4_PA_MDMA1, {IRQ_MDMA1}, &exynos4_mdma1_pdata); 194 EXYNOS4_PA_MDMA1, {EXYNOS4_IRQ_MDMA1}, &exynos4_mdma1_pdata);
197 195
198static int __init exynos4_dma_init(void) 196static int __init exynos4_dma_init(void)
199{ 197{
diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c
index dd1ad55524c9..9c17a0a43858 100644
--- a/arch/arm/mach-exynos/hotplug.c
+++ b/arch/arm/mach-exynos/hotplug.c
@@ -16,6 +16,7 @@
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cp15.h>
19#include <asm/smp_plat.h> 20#include <asm/smp_plat.h>
20 21
21#include <mach/regs-pmu.h> 22#include <mach/regs-pmu.h>
diff --git a/arch/arm/mach-exynos/include/mach/debug-macro.S b/arch/arm/mach-exynos/include/mach/debug-macro.S
index 6cacf16a67a6..e0c86ea475e7 100644
--- a/arch/arm/mach-exynos/include/mach/debug-macro.S
+++ b/arch/arm/mach-exynos/include/mach/debug-macro.S
@@ -21,8 +21,12 @@
21 */ 21 */
22 22
23 .macro addruart, rp, rv, tmp 23 .macro addruart, rp, rv, tmp
24 ldr \rp, = S3C_PA_UART 24 mrc p15, 0, \tmp, c0, c0, 0
25 ldr \rv, = S3C_VA_UART 25 and \tmp, \tmp, #0xf0
26 teq \tmp, #0xf0 @@ A15
27 ldreq \rp, =EXYNOS5_PA_UART
28 movne \rp, #EXYNOS4_PA_UART @@ EXYNOS4
29 ldr \rv, =S3C_VA_UART
26#if CONFIG_DEBUG_S3C_UART != 0 30#if CONFIG_DEBUG_S3C_UART != 0
27 add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART) 31 add \rp, \rp, #(0x10000 * CONFIG_DEBUG_S3C_UART)
28 add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART) 32 add \rv, \rv, #(0x10000 * CONFIG_DEBUG_S3C_UART)
diff --git a/arch/arm/mach-exynos/include/mach/gpio.h b/arch/arm/mach-exynos/include/mach/gpio.h
index 80523ca9bb49..d7498afe036a 100644
--- a/arch/arm/mach-exynos/include/mach/gpio.h
+++ b/arch/arm/mach-exynos/include/mach/gpio.h
@@ -1,9 +1,8 @@
1/* linux/arch/arm/mach-exynos4/include/mach/gpio.h 1/*
2 * 2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * EXYNOS4 - GPIO lib support 5 * EXYNOS - GPIO lib support
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -13,9 +12,13 @@
13#ifndef __ASM_ARCH_GPIO_H 12#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 13#define __ASM_ARCH_GPIO_H __FILE__
15 14
16/* Practically, GPIO banks up to GPZ are the configurable gpio banks */ 15/* Macro for EXYNOS GPIO numbering */
16
17#define EXYNOS_GPIO_NEXT(__gpio) \
18 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
19
20/* EXYNOS4 GPIO bank sizes */
17 21
18/* GPIO bank sizes */
19#define EXYNOS4_GPIO_A0_NR (8) 22#define EXYNOS4_GPIO_A0_NR (8)
20#define EXYNOS4_GPIO_A1_NR (6) 23#define EXYNOS4_GPIO_A1_NR (6)
21#define EXYNOS4_GPIO_B_NR (8) 24#define EXYNOS4_GPIO_B_NR (8)
@@ -54,52 +57,50 @@
54#define EXYNOS4_GPIO_Y6_NR (8) 57#define EXYNOS4_GPIO_Y6_NR (8)
55#define EXYNOS4_GPIO_Z_NR (7) 58#define EXYNOS4_GPIO_Z_NR (7)
56 59
57/* GPIO bank numbers */ 60/* EXYNOS4 GPIO bank numbers */
58
59#define EXYNOS4_GPIO_NEXT(__gpio) \
60 ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
61 61
62enum s5p_gpio_number { 62enum exynos4_gpio_number {
63 EXYNOS4_GPIO_A0_START = 0, 63 EXYNOS4_GPIO_A0_START = 0,
64 EXYNOS4_GPIO_A1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A0), 64 EXYNOS4_GPIO_A1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_A0),
65 EXYNOS4_GPIO_B_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_A1), 65 EXYNOS4_GPIO_B_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_A1),
66 EXYNOS4_GPIO_C0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_B), 66 EXYNOS4_GPIO_C0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_B),
67 EXYNOS4_GPIO_C1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C0), 67 EXYNOS4_GPIO_C1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_C0),
68 EXYNOS4_GPIO_D0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_C1), 68 EXYNOS4_GPIO_D0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_C1),
69 EXYNOS4_GPIO_D1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D0), 69 EXYNOS4_GPIO_D1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_D0),
70 EXYNOS4_GPIO_E0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_D1), 70 EXYNOS4_GPIO_E0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_D1),
71 EXYNOS4_GPIO_E1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E0), 71 EXYNOS4_GPIO_E1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E0),
72 EXYNOS4_GPIO_E2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E1), 72 EXYNOS4_GPIO_E2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E1),
73 EXYNOS4_GPIO_E3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E2), 73 EXYNOS4_GPIO_E3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E2),
74 EXYNOS4_GPIO_E4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E3), 74 EXYNOS4_GPIO_E4_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E3),
75 EXYNOS4_GPIO_F0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_E4), 75 EXYNOS4_GPIO_F0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_E4),
76 EXYNOS4_GPIO_F1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F0), 76 EXYNOS4_GPIO_F1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F0),
77 EXYNOS4_GPIO_F2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F1), 77 EXYNOS4_GPIO_F2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F1),
78 EXYNOS4_GPIO_F3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F2), 78 EXYNOS4_GPIO_F3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F2),
79 EXYNOS4_GPIO_J0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_F3), 79 EXYNOS4_GPIO_J0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_F3),
80 EXYNOS4_GPIO_J1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J0), 80 EXYNOS4_GPIO_J1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_J0),
81 EXYNOS4_GPIO_K0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_J1), 81 EXYNOS4_GPIO_K0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_J1),
82 EXYNOS4_GPIO_K1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K0), 82 EXYNOS4_GPIO_K1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K0),
83 EXYNOS4_GPIO_K2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K1), 83 EXYNOS4_GPIO_K2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K1),
84 EXYNOS4_GPIO_K3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K2), 84 EXYNOS4_GPIO_K3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K2),
85 EXYNOS4_GPIO_L0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_K3), 85 EXYNOS4_GPIO_L0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_K3),
86 EXYNOS4_GPIO_L1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L0), 86 EXYNOS4_GPIO_L1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_L0),
87 EXYNOS4_GPIO_L2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L1), 87 EXYNOS4_GPIO_L2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_L1),
88 EXYNOS4_GPIO_X0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_L2), 88 EXYNOS4_GPIO_X0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_L2),
89 EXYNOS4_GPIO_X1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X0), 89 EXYNOS4_GPIO_X1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X0),
90 EXYNOS4_GPIO_X2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X1), 90 EXYNOS4_GPIO_X2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X1),
91 EXYNOS4_GPIO_X3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X2), 91 EXYNOS4_GPIO_X3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X2),
92 EXYNOS4_GPIO_Y0_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_X3), 92 EXYNOS4_GPIO_Y0_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_X3),
93 EXYNOS4_GPIO_Y1_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y0), 93 EXYNOS4_GPIO_Y1_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y0),
94 EXYNOS4_GPIO_Y2_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y1), 94 EXYNOS4_GPIO_Y2_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y1),
95 EXYNOS4_GPIO_Y3_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y2), 95 EXYNOS4_GPIO_Y3_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y2),
96 EXYNOS4_GPIO_Y4_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y3), 96 EXYNOS4_GPIO_Y4_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y3),
97 EXYNOS4_GPIO_Y5_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y4), 97 EXYNOS4_GPIO_Y5_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y4),
98 EXYNOS4_GPIO_Y6_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y5), 98 EXYNOS4_GPIO_Y6_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y5),
99 EXYNOS4_GPIO_Z_START = EXYNOS4_GPIO_NEXT(EXYNOS4_GPIO_Y6), 99 EXYNOS4_GPIO_Z_START = EXYNOS_GPIO_NEXT(EXYNOS4_GPIO_Y6),
100}; 100};
101 101
102/* EXYNOS4 GPIO number definitions */ 102/* EXYNOS4 GPIO number definitions */
103
103#define EXYNOS4_GPA0(_nr) (EXYNOS4_GPIO_A0_START + (_nr)) 104#define EXYNOS4_GPA0(_nr) (EXYNOS4_GPIO_A0_START + (_nr))
104#define EXYNOS4_GPA1(_nr) (EXYNOS4_GPIO_A1_START + (_nr)) 105#define EXYNOS4_GPA1(_nr) (EXYNOS4_GPIO_A1_START + (_nr))
105#define EXYNOS4_GPB(_nr) (EXYNOS4_GPIO_B_START + (_nr)) 106#define EXYNOS4_GPB(_nr) (EXYNOS4_GPIO_B_START + (_nr))
@@ -139,11 +140,147 @@ enum s5p_gpio_number {
139#define EXYNOS4_GPZ(_nr) (EXYNOS4_GPIO_Z_START + (_nr)) 140#define EXYNOS4_GPZ(_nr) (EXYNOS4_GPIO_Z_START + (_nr))
140 141
141/* the end of the EXYNOS4 specific gpios */ 142/* the end of the EXYNOS4 specific gpios */
143
142#define EXYNOS4_GPIO_END (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + 1) 144#define EXYNOS4_GPIO_END (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + 1)
143#define S3C_GPIO_END EXYNOS4_GPIO_END
144 145
145/* define the number of gpios we need to the one after the GPZ() range */ 146/* EXYNOS5 GPIO bank sizes */
146#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ 147
147 CONFIG_SAMSUNG_GPIO_EXTRA + 1) 148#define EXYNOS5_GPIO_A0_NR (8)
149#define EXYNOS5_GPIO_A1_NR (6)
150#define EXYNOS5_GPIO_A2_NR (8)
151#define EXYNOS5_GPIO_B0_NR (5)
152#define EXYNOS5_GPIO_B1_NR (5)
153#define EXYNOS5_GPIO_B2_NR (4)
154#define EXYNOS5_GPIO_B3_NR (4)
155#define EXYNOS5_GPIO_C0_NR (7)
156#define EXYNOS5_GPIO_C1_NR (7)
157#define EXYNOS5_GPIO_C2_NR (7)
158#define EXYNOS5_GPIO_C3_NR (7)
159#define EXYNOS5_GPIO_D0_NR (8)
160#define EXYNOS5_GPIO_D1_NR (8)
161#define EXYNOS5_GPIO_Y0_NR (6)
162#define EXYNOS5_GPIO_Y1_NR (4)
163#define EXYNOS5_GPIO_Y2_NR (6)
164#define EXYNOS5_GPIO_Y3_NR (8)
165#define EXYNOS5_GPIO_Y4_NR (8)
166#define EXYNOS5_GPIO_Y5_NR (8)
167#define EXYNOS5_GPIO_Y6_NR (8)
168#define EXYNOS5_GPIO_X0_NR (8)
169#define EXYNOS5_GPIO_X1_NR (8)
170#define EXYNOS5_GPIO_X2_NR (8)
171#define EXYNOS5_GPIO_X3_NR (8)
172#define EXYNOS5_GPIO_E0_NR (8)
173#define EXYNOS5_GPIO_E1_NR (2)
174#define EXYNOS5_GPIO_F0_NR (4)
175#define EXYNOS5_GPIO_F1_NR (4)
176#define EXYNOS5_GPIO_G0_NR (8)
177#define EXYNOS5_GPIO_G1_NR (8)
178#define EXYNOS5_GPIO_G2_NR (2)
179#define EXYNOS5_GPIO_H0_NR (4)
180#define EXYNOS5_GPIO_H1_NR (8)
181#define EXYNOS5_GPIO_V0_NR (8)
182#define EXYNOS5_GPIO_V1_NR (8)
183#define EXYNOS5_GPIO_V2_NR (8)
184#define EXYNOS5_GPIO_V3_NR (8)
185#define EXYNOS5_GPIO_V4_NR (2)
186#define EXYNOS5_GPIO_Z_NR (7)
187
188/* EXYNOS5 GPIO bank numbers */
189
190enum exynos5_gpio_number {
191 EXYNOS5_GPIO_A0_START = 0,
192 EXYNOS5_GPIO_A1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_A0),
193 EXYNOS5_GPIO_A2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_A1),
194 EXYNOS5_GPIO_B0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_A2),
195 EXYNOS5_GPIO_B1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B0),
196 EXYNOS5_GPIO_B2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B1),
197 EXYNOS5_GPIO_B3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B2),
198 EXYNOS5_GPIO_C0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_B3),
199 EXYNOS5_GPIO_C1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C0),
200 EXYNOS5_GPIO_C2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C1),
201 EXYNOS5_GPIO_C3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C2),
202 EXYNOS5_GPIO_D0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_C3),
203 EXYNOS5_GPIO_D1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_D0),
204 EXYNOS5_GPIO_Y0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_D1),
205 EXYNOS5_GPIO_Y1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y0),
206 EXYNOS5_GPIO_Y2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y1),
207 EXYNOS5_GPIO_Y3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y2),
208 EXYNOS5_GPIO_Y4_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y3),
209 EXYNOS5_GPIO_Y5_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y4),
210 EXYNOS5_GPIO_Y6_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y5),
211 EXYNOS5_GPIO_X0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_Y6),
212 EXYNOS5_GPIO_X1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X0),
213 EXYNOS5_GPIO_X2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X1),
214 EXYNOS5_GPIO_X3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X2),
215 EXYNOS5_GPIO_E0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_X3),
216 EXYNOS5_GPIO_E1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_E0),
217 EXYNOS5_GPIO_F0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_E1),
218 EXYNOS5_GPIO_F1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_F0),
219 EXYNOS5_GPIO_G0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_F1),
220 EXYNOS5_GPIO_G1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_G0),
221 EXYNOS5_GPIO_G2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_G1),
222 EXYNOS5_GPIO_H0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_G2),
223 EXYNOS5_GPIO_H1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_H0),
224 EXYNOS5_GPIO_V0_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_H1),
225 EXYNOS5_GPIO_V1_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V0),
226 EXYNOS5_GPIO_V2_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V1),
227 EXYNOS5_GPIO_V3_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V2),
228 EXYNOS5_GPIO_V4_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V3),
229 EXYNOS5_GPIO_Z_START = EXYNOS_GPIO_NEXT(EXYNOS5_GPIO_V4),
230};
231
232/* EXYNOS5 GPIO number definitions */
233
234#define EXYNOS5_GPA0(_nr) (EXYNOS5_GPIO_A0_START + (_nr))
235#define EXYNOS5_GPA1(_nr) (EXYNOS5_GPIO_A1_START + (_nr))
236#define EXYNOS5_GPA2(_nr) (EXYNOS5_GPIO_A2_START + (_nr))
237#define EXYNOS5_GPB0(_nr) (EXYNOS5_GPIO_B0_START + (_nr))
238#define EXYNOS5_GPB1(_nr) (EXYNOS5_GPIO_B1_START + (_nr))
239#define EXYNOS5_GPB2(_nr) (EXYNOS5_GPIO_B2_START + (_nr))
240#define EXYNOS5_GPB3(_nr) (EXYNOS5_GPIO_B3_START + (_nr))
241#define EXYNOS5_GPC0(_nr) (EXYNOS5_GPIO_C0_START + (_nr))
242#define EXYNOS5_GPC1(_nr) (EXYNOS5_GPIO_C1_START + (_nr))
243#define EXYNOS5_GPC2(_nr) (EXYNOS5_GPIO_C2_START + (_nr))
244#define EXYNOS5_GPC3(_nr) (EXYNOS5_GPIO_C3_START + (_nr))
245#define EXYNOS5_GPD0(_nr) (EXYNOS5_GPIO_D0_START + (_nr))
246#define EXYNOS5_GPD1(_nr) (EXYNOS5_GPIO_D1_START + (_nr))
247#define EXYNOS5_GPY0(_nr) (EXYNOS5_GPIO_Y0_START + (_nr))
248#define EXYNOS5_GPY1(_nr) (EXYNOS5_GPIO_Y1_START + (_nr))
249#define EXYNOS5_GPY2(_nr) (EXYNOS5_GPIO_Y2_START + (_nr))
250#define EXYNOS5_GPY3(_nr) (EXYNOS5_GPIO_Y3_START + (_nr))
251#define EXYNOS5_GPY4(_nr) (EXYNOS5_GPIO_Y4_START + (_nr))
252#define EXYNOS5_GPY5(_nr) (EXYNOS5_GPIO_Y5_START + (_nr))
253#define EXYNOS5_GPY6(_nr) (EXYNOS5_GPIO_Y6_START + (_nr))
254#define EXYNOS5_GPX0(_nr) (EXYNOS5_GPIO_X0_START + (_nr))
255#define EXYNOS5_GPX1(_nr) (EXYNOS5_GPIO_X1_START + (_nr))
256#define EXYNOS5_GPX2(_nr) (EXYNOS5_GPIO_X2_START + (_nr))
257#define EXYNOS5_GPX3(_nr) (EXYNOS5_GPIO_X3_START + (_nr))
258#define EXYNOS5_GPE0(_nr) (EXYNOS5_GPIO_E0_START + (_nr))
259#define EXYNOS5_GPE1(_nr) (EXYNOS5_GPIO_E1_START + (_nr))
260#define EXYNOS5_GPF0(_nr) (EXYNOS5_GPIO_F0_START + (_nr))
261#define EXYNOS5_GPF1(_nr) (EXYNOS5_GPIO_F1_START + (_nr))
262#define EXYNOS5_GPG0(_nr) (EXYNOS5_GPIO_G0_START + (_nr))
263#define EXYNOS5_GPG1(_nr) (EXYNOS5_GPIO_G1_START + (_nr))
264#define EXYNOS5_GPG2(_nr) (EXYNOS5_GPIO_G2_START + (_nr))
265#define EXYNOS5_GPH0(_nr) (EXYNOS5_GPIO_H0_START + (_nr))
266#define EXYNOS5_GPH1(_nr) (EXYNOS5_GPIO_H1_START + (_nr))
267#define EXYNOS5_GPV0(_nr) (EXYNOS5_GPIO_V0_START + (_nr))
268#define EXYNOS5_GPV1(_nr) (EXYNOS5_GPIO_V1_START + (_nr))
269#define EXYNOS5_GPV2(_nr) (EXYNOS5_GPIO_V2_START + (_nr))
270#define EXYNOS5_GPV3(_nr) (EXYNOS5_GPIO_V3_START + (_nr))
271#define EXYNOS5_GPV4(_nr) (EXYNOS5_GPIO_V4_START + (_nr))
272#define EXYNOS5_GPZ(_nr) (EXYNOS5_GPIO_Z_START + (_nr))
273
274/* the end of the EXYNOS5 specific gpios */
275
276#define EXYNOS5_GPIO_END (EXYNOS5_GPZ(EXYNOS5_GPIO_Z_NR) + 1)
277
278/* actually, EXYNOS5_GPIO_END is bigger than EXYNOS4 */
279
280#define S3C_GPIO_END (EXYNOS5_GPIO_END)
281
282/* define the number of gpios */
283
284#define ARCH_NR_GPIOS (CONFIG_SAMSUNG_GPIO_EXTRA + S3C_GPIO_END)
148 285
149#endif /* __ASM_ARCH_GPIO_H */ 286#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-exynos/include/mach/io.h b/arch/arm/mach-exynos/include/mach/io.h
deleted file mode 100644
index d5478d247535..000000000000
--- a/arch/arm/mach-exynos/include/mach/io.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/* linux/arch/arm/mach-exynos4/include/mach/io.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org>
7 *
8 * Based on arch/arm/mach-s5p6442/include/mach/io.h
9 *
10 * Default IO routines for EXYNOS4
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15*/
16
17#ifndef __ASM_ARM_ARCH_IO_H
18#define __ASM_ARM_ARCH_IO_H __FILE__
19
20/* No current ISA/PCI bus support. */
21#define __io(a) __typesafe_io(a)
22#define __mem_pci(a) (a)
23
24#define IO_SPACE_LIMIT (0xFFFFFFFF)
25
26#endif /* __ASM_ARM_ARCH_IO_H */
diff --git a/arch/arm/mach-exynos/include/mach/irqs.h b/arch/arm/mach-exynos/include/mach/irqs.h
index 1d401c957835..9bee8535d9e0 100644
--- a/arch/arm/mach-exynos/include/mach/irqs.h
+++ b/arch/arm/mach-exynos/include/mach/irqs.h
@@ -1,9 +1,8 @@
1/* linux/arch/arm/mach-exynos4/include/mach/irqs.h 1/*
2 * 2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * EXYNOS4 - IRQ definitions 5 * EXYNOS - IRQ definitions
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -17,160 +16,450 @@
17 16
18/* PPI: Private Peripheral Interrupt */ 17/* PPI: Private Peripheral Interrupt */
19 18
20#define IRQ_PPI(x) (x+16) 19#define IRQ_PPI(x) (x + 16)
21
22#define IRQ_MCT_LOCALTIMER IRQ_PPI(12)
23 20
24/* SPI: Shared Peripheral Interrupt */ 21/* SPI: Shared Peripheral Interrupt */
25 22
26#define IRQ_SPI(x) (x+32) 23#define IRQ_SPI(x) (x + 32)
27 24
28#define IRQ_EINT0 IRQ_SPI(16) 25/* COMBINER */
29#define IRQ_EINT1 IRQ_SPI(17) 26
30#define IRQ_EINT2 IRQ_SPI(18) 27#define MAX_IRQ_IN_COMBINER 8
31#define IRQ_EINT3 IRQ_SPI(19) 28#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128))
32#define IRQ_EINT4 IRQ_SPI(20) 29#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y)
33#define IRQ_EINT5 IRQ_SPI(21) 30
34#define IRQ_EINT6 IRQ_SPI(22) 31/* For EXYNOS4 and EXYNOS5 */
35#define IRQ_EINT7 IRQ_SPI(23) 32
36#define IRQ_EINT8 IRQ_SPI(24) 33#define EXYNOS_IRQ_MCT_LOCALTIMER IRQ_PPI(12)
37#define IRQ_EINT9 IRQ_SPI(25) 34
38#define IRQ_EINT10 IRQ_SPI(26) 35#define EXYNOS_IRQ_EINT16_31 IRQ_SPI(32)
39#define IRQ_EINT11 IRQ_SPI(27) 36
40#define IRQ_EINT12 IRQ_SPI(28) 37/* For EXYNOS4 SoCs */
41#define IRQ_EINT13 IRQ_SPI(29) 38
42#define IRQ_EINT14 IRQ_SPI(30) 39#define EXYNOS4_IRQ_EINT0 IRQ_SPI(16)
43#define IRQ_EINT15 IRQ_SPI(31) 40#define EXYNOS4_IRQ_EINT1 IRQ_SPI(17)
44#define IRQ_EINT16_31 IRQ_SPI(32) 41#define EXYNOS4_IRQ_EINT2 IRQ_SPI(18)
45 42#define EXYNOS4_IRQ_EINT3 IRQ_SPI(19)
46#define IRQ_MDMA0 IRQ_SPI(33) 43#define EXYNOS4_IRQ_EINT4 IRQ_SPI(20)
47#define IRQ_MDMA1 IRQ_SPI(34) 44#define EXYNOS4_IRQ_EINT5 IRQ_SPI(21)
48#define IRQ_PDMA0 IRQ_SPI(35) 45#define EXYNOS4_IRQ_EINT6 IRQ_SPI(22)
49#define IRQ_PDMA1 IRQ_SPI(36) 46#define EXYNOS4_IRQ_EINT7 IRQ_SPI(23)
50#define IRQ_TIMER0_VIC IRQ_SPI(37) 47#define EXYNOS4_IRQ_EINT8 IRQ_SPI(24)
51#define IRQ_TIMER1_VIC IRQ_SPI(38) 48#define EXYNOS4_IRQ_EINT9 IRQ_SPI(25)
52#define IRQ_TIMER2_VIC IRQ_SPI(39) 49#define EXYNOS4_IRQ_EINT10 IRQ_SPI(26)
53#define IRQ_TIMER3_VIC IRQ_SPI(40) 50#define EXYNOS4_IRQ_EINT11 IRQ_SPI(27)
54#define IRQ_TIMER4_VIC IRQ_SPI(41) 51#define EXYNOS4_IRQ_EINT12 IRQ_SPI(28)
55#define IRQ_MCT_L0 IRQ_SPI(42) 52#define EXYNOS4_IRQ_EINT13 IRQ_SPI(29)
56#define IRQ_WDT IRQ_SPI(43) 53#define EXYNOS4_IRQ_EINT14 IRQ_SPI(30)
57#define IRQ_RTC_ALARM IRQ_SPI(44) 54#define EXYNOS4_IRQ_EINT15 IRQ_SPI(31)
58#define IRQ_RTC_TIC IRQ_SPI(45) 55
59#define IRQ_GPIO_XB IRQ_SPI(46) 56#define EXYNOS4_IRQ_MDMA0 IRQ_SPI(33)
60#define IRQ_GPIO_XA IRQ_SPI(47) 57#define EXYNOS4_IRQ_MDMA1 IRQ_SPI(34)
61#define IRQ_MCT_L1 IRQ_SPI(48) 58#define EXYNOS4_IRQ_PDMA0 IRQ_SPI(35)
62 59#define EXYNOS4_IRQ_PDMA1 IRQ_SPI(36)
63#define IRQ_UART0 IRQ_SPI(52) 60#define EXYNOS4_IRQ_TIMER0_VIC IRQ_SPI(37)
64#define IRQ_UART1 IRQ_SPI(53) 61#define EXYNOS4_IRQ_TIMER1_VIC IRQ_SPI(38)
65#define IRQ_UART2 IRQ_SPI(54) 62#define EXYNOS4_IRQ_TIMER2_VIC IRQ_SPI(39)
66#define IRQ_UART3 IRQ_SPI(55) 63#define EXYNOS4_IRQ_TIMER3_VIC IRQ_SPI(40)
67#define IRQ_UART4 IRQ_SPI(56) 64#define EXYNOS4_IRQ_TIMER4_VIC IRQ_SPI(41)
68#define IRQ_MCT_G0 IRQ_SPI(57) 65#define EXYNOS4_IRQ_MCT_L0 IRQ_SPI(42)
69#define IRQ_IIC IRQ_SPI(58) 66#define EXYNOS4_IRQ_WDT IRQ_SPI(43)
70#define IRQ_IIC1 IRQ_SPI(59) 67#define EXYNOS4_IRQ_RTC_ALARM IRQ_SPI(44)
71#define IRQ_IIC2 IRQ_SPI(60) 68#define EXYNOS4_IRQ_RTC_TIC IRQ_SPI(45)
72#define IRQ_IIC3 IRQ_SPI(61) 69#define EXYNOS4_IRQ_GPIO_XB IRQ_SPI(46)
73#define IRQ_IIC4 IRQ_SPI(62) 70#define EXYNOS4_IRQ_GPIO_XA IRQ_SPI(47)
74#define IRQ_IIC5 IRQ_SPI(63) 71#define EXYNOS4_IRQ_MCT_L1 IRQ_SPI(48)
75#define IRQ_IIC6 IRQ_SPI(64) 72
76#define IRQ_IIC7 IRQ_SPI(65) 73#define EXYNOS4_IRQ_UART0 IRQ_SPI(52)
77#define IRQ_SPI0 IRQ_SPI(66) 74#define EXYNOS4_IRQ_UART1 IRQ_SPI(53)
78#define IRQ_SPI1 IRQ_SPI(67) 75#define EXYNOS4_IRQ_UART2 IRQ_SPI(54)
79#define IRQ_SPI2 IRQ_SPI(68) 76#define EXYNOS4_IRQ_UART3 IRQ_SPI(55)
80 77#define EXYNOS4_IRQ_UART4 IRQ_SPI(56)
81#define IRQ_USB_HOST IRQ_SPI(70) 78#define EXYNOS4_IRQ_MCT_G0 IRQ_SPI(57)
82#define IRQ_USB_HSOTG IRQ_SPI(71) 79#define EXYNOS4_IRQ_IIC IRQ_SPI(58)
83#define IRQ_MODEM_IF IRQ_SPI(72) 80#define EXYNOS4_IRQ_IIC1 IRQ_SPI(59)
84#define IRQ_HSMMC0 IRQ_SPI(73) 81#define EXYNOS4_IRQ_IIC2 IRQ_SPI(60)
85#define IRQ_HSMMC1 IRQ_SPI(74) 82#define EXYNOS4_IRQ_IIC3 IRQ_SPI(61)
86#define IRQ_HSMMC2 IRQ_SPI(75) 83#define EXYNOS4_IRQ_IIC4 IRQ_SPI(62)
87#define IRQ_HSMMC3 IRQ_SPI(76) 84#define EXYNOS4_IRQ_IIC5 IRQ_SPI(63)
88#define IRQ_DWMCI IRQ_SPI(77) 85#define EXYNOS4_IRQ_IIC6 IRQ_SPI(64)
89 86#define EXYNOS4_IRQ_IIC7 IRQ_SPI(65)
90#define IRQ_MIPI_CSIS0 IRQ_SPI(78) 87#define EXYNOS4_IRQ_SPI0 IRQ_SPI(66)
91#define IRQ_MIPI_CSIS1 IRQ_SPI(80) 88#define EXYNOS4_IRQ_SPI1 IRQ_SPI(67)
92 89#define EXYNOS4_IRQ_SPI2 IRQ_SPI(68)
93#define IRQ_ONENAND_AUDI IRQ_SPI(82) 90
94#define IRQ_ROTATOR IRQ_SPI(83) 91#define EXYNOS4_IRQ_USB_HOST IRQ_SPI(70)
95#define IRQ_FIMC0 IRQ_SPI(84) 92#define EXYNOS4_IRQ_USB_HSOTG IRQ_SPI(71)
96#define IRQ_FIMC1 IRQ_SPI(85) 93#define EXYNOS4_IRQ_MODEM_IF IRQ_SPI(72)
97#define IRQ_FIMC2 IRQ_SPI(86) 94#define EXYNOS4_IRQ_HSMMC0 IRQ_SPI(73)
98#define IRQ_FIMC3 IRQ_SPI(87) 95#define EXYNOS4_IRQ_HSMMC1 IRQ_SPI(74)
99#define IRQ_JPEG IRQ_SPI(88) 96#define EXYNOS4_IRQ_HSMMC2 IRQ_SPI(75)
100#define IRQ_2D IRQ_SPI(89) 97#define EXYNOS4_IRQ_HSMMC3 IRQ_SPI(76)
101#define IRQ_PCIE IRQ_SPI(90) 98#define EXYNOS4_IRQ_DWMCI IRQ_SPI(77)
102 99
103#define IRQ_MIXER IRQ_SPI(91) 100#define EXYNOS4_IRQ_MIPI_CSIS0 IRQ_SPI(78)
104#define IRQ_HDMI IRQ_SPI(92) 101#define EXYNOS4_IRQ_MIPI_CSIS1 IRQ_SPI(80)
105#define IRQ_IIC_HDMIPHY IRQ_SPI(93) 102
106#define IRQ_MFC IRQ_SPI(94) 103#define EXYNOS4_IRQ_ONENAND_AUDI IRQ_SPI(82)
107#define IRQ_SDO IRQ_SPI(95) 104#define EXYNOS4_IRQ_ROTATOR IRQ_SPI(83)
108 105#define EXYNOS4_IRQ_FIMC0 IRQ_SPI(84)
109#define IRQ_AUDIO_SS IRQ_SPI(96) 106#define EXYNOS4_IRQ_FIMC1 IRQ_SPI(85)
110#define IRQ_I2S0 IRQ_SPI(97) 107#define EXYNOS4_IRQ_FIMC2 IRQ_SPI(86)
111#define IRQ_I2S1 IRQ_SPI(98) 108#define EXYNOS4_IRQ_FIMC3 IRQ_SPI(87)
112#define IRQ_I2S2 IRQ_SPI(99) 109#define EXYNOS4_IRQ_JPEG IRQ_SPI(88)
113#define IRQ_AC97 IRQ_SPI(100) 110#define EXYNOS4_IRQ_2D IRQ_SPI(89)
114 111#define EXYNOS4_IRQ_PCIE IRQ_SPI(90)
115#define IRQ_SPDIF IRQ_SPI(104) 112
116#define IRQ_ADC0 IRQ_SPI(105) 113#define EXYNOS4_IRQ_MIXER IRQ_SPI(91)
117#define IRQ_PEN0 IRQ_SPI(106) 114#define EXYNOS4_IRQ_HDMI IRQ_SPI(92)
118#define IRQ_ADC1 IRQ_SPI(107) 115#define EXYNOS4_IRQ_IIC_HDMIPHY IRQ_SPI(93)
119#define IRQ_PEN1 IRQ_SPI(108) 116#define EXYNOS4_IRQ_MFC IRQ_SPI(94)
120#define IRQ_KEYPAD IRQ_SPI(109) 117#define EXYNOS4_IRQ_SDO IRQ_SPI(95)
121#define IRQ_PMU IRQ_SPI(110) 118
122#define IRQ_GPS IRQ_SPI(111) 119#define EXYNOS4_IRQ_AUDIO_SS IRQ_SPI(96)
123#define IRQ_INTFEEDCTRL_SSS IRQ_SPI(112) 120#define EXYNOS4_IRQ_I2S0 IRQ_SPI(97)
124#define IRQ_SLIMBUS IRQ_SPI(113) 121#define EXYNOS4_IRQ_I2S1 IRQ_SPI(98)
125 122#define EXYNOS4_IRQ_I2S2 IRQ_SPI(99)
126#define IRQ_TSI IRQ_SPI(115) 123#define EXYNOS4_IRQ_AC97 IRQ_SPI(100)
127#define IRQ_SATA IRQ_SPI(116) 124
128 125#define EXYNOS4_IRQ_SPDIF IRQ_SPI(104)
129#define MAX_IRQ_IN_COMBINER 8 126#define EXYNOS4_IRQ_ADC0 IRQ_SPI(105)
130#define COMBINER_GROUP(x) ((x) * MAX_IRQ_IN_COMBINER + IRQ_SPI(128)) 127#define EXYNOS4_IRQ_PEN0 IRQ_SPI(106)
131#define COMBINER_IRQ(x, y) (COMBINER_GROUP(x) + y) 128#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)
132 129#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)
133#define IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0) 130#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109)
134#define IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1) 131#define EXYNOS4_IRQ_PMU IRQ_SPI(110)
135#define IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2) 132#define EXYNOS4_IRQ_GPS IRQ_SPI(111)
136#define IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3) 133#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
137#define IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4) 134#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)
138#define IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5) 135
139#define IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6) 136#define EXYNOS4_IRQ_TSI IRQ_SPI(115)
140#define IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7) 137#define EXYNOS4_IRQ_SATA IRQ_SPI(116)
141 138
142#define IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0) 139#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)
143#define IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1) 140#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)
144#define IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2) 141#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)
145#define IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3) 142#define EXYNOS4_IRQ_SYSMMU_FIMC1_0 COMBINER_IRQ(4, 3)
146#define IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4) 143#define EXYNOS4_IRQ_SYSMMU_FIMC2_0 COMBINER_IRQ(4, 4)
147#define IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5) 144#define EXYNOS4_IRQ_SYSMMU_FIMC3_0 COMBINER_IRQ(4, 5)
148#define IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6) 145#define EXYNOS4_IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 6)
149#define IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7) 146#define EXYNOS4_IRQ_SYSMMU_2D_0 COMBINER_IRQ(4, 7)
150 147
151#define IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0) 148#define EXYNOS4_IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(5, 0)
152#define IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1) 149#define EXYNOS4_IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(5, 1)
153#define IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) 150#define EXYNOS4_IRQ_SYSMMU_LCD0_M0_0 COMBINER_IRQ(5, 2)
154 151#define EXYNOS4_IRQ_SYSMMU_LCD1_M1_0 COMBINER_IRQ(5, 3)
155#define MAX_COMBINER_NR 16 152#define EXYNOS4_IRQ_SYSMMU_TV_M0_0 COMBINER_IRQ(5, 4)
156 153#define EXYNOS4_IRQ_SYSMMU_MFC_M0_0 COMBINER_IRQ(5, 5)
157#define IRQ_ADC IRQ_ADC0 154#define EXYNOS4_IRQ_SYSMMU_MFC_M1_0 COMBINER_IRQ(5, 6)
158#define IRQ_TC IRQ_PEN0 155#define EXYNOS4_IRQ_SYSMMU_PCIE_0 COMBINER_IRQ(5, 7)
159 156
160#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0) 157#define EXYNOS4_IRQ_FIMD0_FIFO COMBINER_IRQ(11, 0)
161 158#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)
162#define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE + 0) 159#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2)
163#define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE + 16) 160
164 161#define EXYNOS4_MAX_COMBINER_NR 16
165/* optional GPIO interrupts */ 162
166#define S5P_GPIOINT_BASE (S5P_IRQ_EINT_BASE + 32) 163#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16
167#define IRQ_GPIO1_NR_GROUPS 16 164#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9
168#define IRQ_GPIO2_NR_GROUPS 9 165
169#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT) 166/*
170 167 * For Compatibility:
171#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64) 168 * the default is for EXYNOS4, and
169 * for exynos5, should be re-mapped at function
170 */
171
172#define IRQ_TIMER0_VIC EXYNOS4_IRQ_TIMER0_VIC
173#define IRQ_TIMER1_VIC EXYNOS4_IRQ_TIMER1_VIC
174#define IRQ_TIMER2_VIC EXYNOS4_IRQ_TIMER2_VIC
175#define IRQ_TIMER3_VIC EXYNOS4_IRQ_TIMER3_VIC
176#define IRQ_TIMER4_VIC EXYNOS4_IRQ_TIMER4_VIC
177
178#define IRQ_WDT EXYNOS4_IRQ_WDT
179#define IRQ_RTC_ALARM EXYNOS4_IRQ_RTC_ALARM
180#define IRQ_RTC_TIC EXYNOS4_IRQ_RTC_TIC
181#define IRQ_GPIO_XB EXYNOS4_IRQ_GPIO_XB
182#define IRQ_GPIO_XA EXYNOS4_IRQ_GPIO_XA
183
184#define IRQ_IIC EXYNOS4_IRQ_IIC
185#define IRQ_IIC1 EXYNOS4_IRQ_IIC1
186#define IRQ_IIC3 EXYNOS4_IRQ_IIC3
187#define IRQ_IIC5 EXYNOS4_IRQ_IIC5
188#define IRQ_IIC6 EXYNOS4_IRQ_IIC6
189#define IRQ_IIC7 EXYNOS4_IRQ_IIC7
190
191#define IRQ_USB_HOST EXYNOS4_IRQ_USB_HOST
192
193#define IRQ_HSMMC0 EXYNOS4_IRQ_HSMMC0
194#define IRQ_HSMMC1 EXYNOS4_IRQ_HSMMC1
195#define IRQ_HSMMC2 EXYNOS4_IRQ_HSMMC2
196#define IRQ_HSMMC3 EXYNOS4_IRQ_HSMMC3
197
198#define IRQ_MIPI_CSIS0 EXYNOS4_IRQ_MIPI_CSIS0
199
200#define IRQ_ONENAND_AUDI EXYNOS4_IRQ_ONENAND_AUDI
201
202#define IRQ_FIMC0 EXYNOS4_IRQ_FIMC0
203#define IRQ_FIMC1 EXYNOS4_IRQ_FIMC1
204#define IRQ_FIMC2 EXYNOS4_IRQ_FIMC2
205#define IRQ_FIMC3 EXYNOS4_IRQ_FIMC3
206#define IRQ_JPEG EXYNOS4_IRQ_JPEG
207#define IRQ_2D EXYNOS4_IRQ_2D
208
209#define IRQ_MIXER EXYNOS4_IRQ_MIXER
210#define IRQ_HDMI EXYNOS4_IRQ_HDMI
211#define IRQ_IIC_HDMIPHY EXYNOS4_IRQ_IIC_HDMIPHY
212#define IRQ_MFC EXYNOS4_IRQ_MFC
213#define IRQ_SDO EXYNOS4_IRQ_SDO
214
215#define IRQ_ADC EXYNOS4_IRQ_ADC0
216#define IRQ_TC EXYNOS4_IRQ_PEN0
217
218#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD
219#define IRQ_PMU EXYNOS4_IRQ_PMU
220
221#define IRQ_SYSMMU_MDMA0_0 EXYNOS4_IRQ_SYSMMU_MDMA0_0
222#define IRQ_SYSMMU_SSS_0 EXYNOS4_IRQ_SYSMMU_SSS_0
223#define IRQ_SYSMMU_FIMC0_0 EXYNOS4_IRQ_SYSMMU_FIMC0_0
224#define IRQ_SYSMMU_FIMC1_0 EXYNOS4_IRQ_SYSMMU_FIMC1_0
225#define IRQ_SYSMMU_FIMC2_0 EXYNOS4_IRQ_SYSMMU_FIMC2_0
226#define IRQ_SYSMMU_FIMC3_0 EXYNOS4_IRQ_SYSMMU_FIMC3_0
227#define IRQ_SYSMMU_JPEG_0 EXYNOS4_IRQ_SYSMMU_JPEG_0
228#define IRQ_SYSMMU_2D_0 EXYNOS4_IRQ_SYSMMU_2D_0
229
230#define IRQ_SYSMMU_ROTATOR_0 EXYNOS4_IRQ_SYSMMU_ROTATOR_0
231#define IRQ_SYSMMU_MDMA1_0 EXYNOS4_IRQ_SYSMMU_MDMA1_0
232#define IRQ_SYSMMU_LCD0_M0_0 EXYNOS4_IRQ_SYSMMU_LCD0_M0_0
233#define IRQ_SYSMMU_LCD1_M1_0 EXYNOS4_IRQ_SYSMMU_LCD1_M1_0
234#define IRQ_SYSMMU_TV_M0_0 EXYNOS4_IRQ_SYSMMU_TV_M0_0
235#define IRQ_SYSMMU_MFC_M0_0 EXYNOS4_IRQ_SYSMMU_MFC_M0_0
236#define IRQ_SYSMMU_MFC_M1_0 EXYNOS4_IRQ_SYSMMU_MFC_M1_0
237#define IRQ_SYSMMU_PCIE_0 EXYNOS4_IRQ_SYSMMU_PCIE_0
238
239#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO
240#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC
241#define IRQ_FIMD0_SYSTEM EXYNOS4_IRQ_FIMD0_SYSTEM
242
243#define IRQ_GPIO1_NR_GROUPS EXYNOS4_IRQ_GPIO1_NR_GROUPS
244#define IRQ_GPIO2_NR_GROUPS EXYNOS4_IRQ_GPIO2_NR_GROUPS
245
246/* For EXYNOS5 SoCs */
247
248#define EXYNOS5_IRQ_MDMA0 IRQ_SPI(33)
249#define EXYNOS5_IRQ_PDMA0 IRQ_SPI(34)
250#define EXYNOS5_IRQ_PDMA1 IRQ_SPI(35)
251#define EXYNOS5_IRQ_TIMER0_VIC IRQ_SPI(36)
252#define EXYNOS5_IRQ_TIMER1_VIC IRQ_SPI(37)
253#define EXYNOS5_IRQ_TIMER2_VIC IRQ_SPI(38)
254#define EXYNOS5_IRQ_TIMER3_VIC IRQ_SPI(39)
255#define EXYNOS5_IRQ_TIMER4_VIC IRQ_SPI(40)
256#define EXYNOS5_IRQ_RTIC IRQ_SPI(41)
257#define EXYNOS5_IRQ_WDT IRQ_SPI(42)
258#define EXYNOS5_IRQ_RTC_ALARM IRQ_SPI(43)
259#define EXYNOS5_IRQ_RTC_TIC IRQ_SPI(44)
260#define EXYNOS5_IRQ_GPIO_XB IRQ_SPI(45)
261#define EXYNOS5_IRQ_GPIO_XA IRQ_SPI(46)
262#define EXYNOS5_IRQ_GPIO IRQ_SPI(47)
263#define EXYNOS5_IRQ_IEM_IEC IRQ_SPI(48)
264#define EXYNOS5_IRQ_IEM_APC IRQ_SPI(49)
265#define EXYNOS5_IRQ_GPIO_C2C IRQ_SPI(50)
266#define EXYNOS5_IRQ_UART0 IRQ_SPI(51)
267#define EXYNOS5_IRQ_UART1 IRQ_SPI(52)
268#define EXYNOS5_IRQ_UART2 IRQ_SPI(53)
269#define EXYNOS5_IRQ_UART3 IRQ_SPI(54)
270#define EXYNOS5_IRQ_UART4 IRQ_SPI(55)
271#define EXYNOS5_IRQ_IIC IRQ_SPI(56)
272#define EXYNOS5_IRQ_IIC1 IRQ_SPI(57)
273#define EXYNOS5_IRQ_IIC2 IRQ_SPI(58)
274#define EXYNOS5_IRQ_IIC3 IRQ_SPI(59)
275#define EXYNOS5_IRQ_IIC4 IRQ_SPI(60)
276#define EXYNOS5_IRQ_IIC5 IRQ_SPI(61)
277#define EXYNOS5_IRQ_IIC6 IRQ_SPI(62)
278#define EXYNOS5_IRQ_IIC7 IRQ_SPI(63)
279#define EXYNOS5_IRQ_IIC_HDMIPHY IRQ_SPI(64)
280#define EXYNOS5_IRQ_TMU IRQ_SPI(65)
281#define EXYNOS5_IRQ_FIQ_0 IRQ_SPI(66)
282#define EXYNOS5_IRQ_FIQ_1 IRQ_SPI(67)
283#define EXYNOS5_IRQ_SPI0 IRQ_SPI(68)
284#define EXYNOS5_IRQ_SPI1 IRQ_SPI(69)
285#define EXYNOS5_IRQ_SPI2 IRQ_SPI(70)
286#define EXYNOS5_IRQ_USB_HOST IRQ_SPI(71)
287#define EXYNOS5_IRQ_USB3_DRD IRQ_SPI(72)
288#define EXYNOS5_IRQ_MIPI_HSI IRQ_SPI(73)
289#define EXYNOS5_IRQ_USB_HSOTG IRQ_SPI(74)
290#define EXYNOS5_IRQ_HSMMC0 IRQ_SPI(75)
291#define EXYNOS5_IRQ_HSMMC1 IRQ_SPI(76)
292#define EXYNOS5_IRQ_HSMMC2 IRQ_SPI(77)
293#define EXYNOS5_IRQ_HSMMC3 IRQ_SPI(78)
294#define EXYNOS5_IRQ_MIPICSI0 IRQ_SPI(79)
295#define EXYNOS5_IRQ_MIPICSI1 IRQ_SPI(80)
296#define EXYNOS5_IRQ_EFNFCON_DMA_ABORT IRQ_SPI(81)
297#define EXYNOS5_IRQ_MIPIDSI0 IRQ_SPI(82)
298#define EXYNOS5_IRQ_ROTATOR IRQ_SPI(84)
299#define EXYNOS5_IRQ_GSC0 IRQ_SPI(85)
300#define EXYNOS5_IRQ_GSC1 IRQ_SPI(86)
301#define EXYNOS5_IRQ_GSC2 IRQ_SPI(87)
302#define EXYNOS5_IRQ_GSC3 IRQ_SPI(88)
303#define EXYNOS5_IRQ_JPEG IRQ_SPI(89)
304#define EXYNOS5_IRQ_EFNFCON_DMA IRQ_SPI(90)
305#define EXYNOS5_IRQ_2D IRQ_SPI(91)
306#define EXYNOS5_IRQ_SFMC0 IRQ_SPI(92)
307#define EXYNOS5_IRQ_SFMC1 IRQ_SPI(93)
308#define EXYNOS5_IRQ_MIXER IRQ_SPI(94)
309#define EXYNOS5_IRQ_HDMI IRQ_SPI(95)
310#define EXYNOS5_IRQ_MFC IRQ_SPI(96)
311#define EXYNOS5_IRQ_AUDIO_SS IRQ_SPI(97)
312#define EXYNOS5_IRQ_I2S0 IRQ_SPI(98)
313#define EXYNOS5_IRQ_I2S1 IRQ_SPI(99)
314#define EXYNOS5_IRQ_I2S2 IRQ_SPI(100)
315#define EXYNOS5_IRQ_AC97 IRQ_SPI(101)
316#define EXYNOS5_IRQ_PCM0 IRQ_SPI(102)
317#define EXYNOS5_IRQ_PCM1 IRQ_SPI(103)
318#define EXYNOS5_IRQ_PCM2 IRQ_SPI(104)
319#define EXYNOS5_IRQ_SPDIF IRQ_SPI(105)
320#define EXYNOS5_IRQ_ADC0 IRQ_SPI(106)
321
322#define EXYNOS5_IRQ_SATA_PHY IRQ_SPI(108)
323#define EXYNOS5_IRQ_SATA_PMEMREQ IRQ_SPI(109)
324#define EXYNOS5_IRQ_CAM_C IRQ_SPI(110)
325#define EXYNOS5_IRQ_EAGLE_PMU IRQ_SPI(111)
326#define EXYNOS5_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)
327#define EXYNOS5_IRQ_DP1_INTP1 IRQ_SPI(113)
328#define EXYNOS5_IRQ_CEC IRQ_SPI(114)
329#define EXYNOS5_IRQ_SATA IRQ_SPI(115)
330#define EXYNOS5_IRQ_NFCON IRQ_SPI(116)
331
332#define EXYNOS5_IRQ_MMC44 IRQ_SPI(123)
333#define EXYNOS5_IRQ_MDMA1 IRQ_SPI(124)
334#define EXYNOS5_IRQ_FIMC_LITE0 IRQ_SPI(125)
335#define EXYNOS5_IRQ_FIMC_LITE1 IRQ_SPI(126)
336#define EXYNOS5_IRQ_RP_TIMER IRQ_SPI(127)
337
338#define EXYNOS5_IRQ_PMU COMBINER_IRQ(1, 2)
339#define EXYNOS5_IRQ_PMU_CPU1 COMBINER_IRQ(1, 6)
340
341#define EXYNOS5_IRQ_SYSMMU_GSC0_0 COMBINER_IRQ(2, 0)
342#define EXYNOS5_IRQ_SYSMMU_GSC0_1 COMBINER_IRQ(2, 1)
343#define EXYNOS5_IRQ_SYSMMU_GSC1_0 COMBINER_IRQ(2, 2)
344#define EXYNOS5_IRQ_SYSMMU_GSC1_1 COMBINER_IRQ(2, 3)
345#define EXYNOS5_IRQ_SYSMMU_GSC2_0 COMBINER_IRQ(2, 4)
346#define EXYNOS5_IRQ_SYSMMU_GSC2_1 COMBINER_IRQ(2, 5)
347#define EXYNOS5_IRQ_SYSMMU_GSC3_0 COMBINER_IRQ(2, 6)
348#define EXYNOS5_IRQ_SYSMMU_GSC3_1 COMBINER_IRQ(2, 7)
349
350#define EXYNOS5_IRQ_SYSMMU_FIMD1_0 COMBINER_IRQ(3, 2)
351#define EXYNOS5_IRQ_SYSMMU_FIMD1_1 COMBINER_IRQ(3, 3)
352#define EXYNOS5_IRQ_SYSMMU_LITE0_0 COMBINER_IRQ(3, 4)
353#define EXYNOS5_IRQ_SYSMMU_LITE0_1 COMBINER_IRQ(3, 5)
354#define EXYNOS5_IRQ_SYSMMU_SCALERPISP_0 COMBINER_IRQ(3, 6)
355#define EXYNOS5_IRQ_SYSMMU_SCALERPISP_1 COMBINER_IRQ(3, 7)
356
357#define EXYNOS5_IRQ_SYSMMU_ROTATOR_0 COMBINER_IRQ(4, 0)
358#define EXYNOS5_IRQ_SYSMMU_ROTATOR_1 COMBINER_IRQ(4, 1)
359#define EXYNOS5_IRQ_SYSMMU_JPEG_0 COMBINER_IRQ(4, 2)
360#define EXYNOS5_IRQ_SYSMMU_JPEG_1 COMBINER_IRQ(4, 3)
361
362#define EXYNOS5_IRQ_SYSMMU_FD_0 COMBINER_IRQ(5, 0)
363#define EXYNOS5_IRQ_SYSMMU_FD_1 COMBINER_IRQ(5, 1)
364#define EXYNOS5_IRQ_SYSMMU_SCALERCISP_0 COMBINER_IRQ(5, 2)
365#define EXYNOS5_IRQ_SYSMMU_SCALERCISP_1 COMBINER_IRQ(5, 3)
366#define EXYNOS5_IRQ_SYSMMU_MCUISP_0 COMBINER_IRQ(5, 4)
367#define EXYNOS5_IRQ_SYSMMU_MCUISP_1 COMBINER_IRQ(5, 5)
368#define EXYNOS5_IRQ_SYSMMU_3DNR_0 COMBINER_IRQ(5, 6)
369#define EXYNOS5_IRQ_SYSMMU_3DNR_1 COMBINER_IRQ(5, 7)
370
371#define EXYNOS5_IRQ_SYSMMU_ARM_0 COMBINER_IRQ(6, 0)
372#define EXYNOS5_IRQ_SYSMMU_ARM_1 COMBINER_IRQ(6, 1)
373#define EXYNOS5_IRQ_SYSMMU_MFC_L_0 COMBINER_IRQ(6, 2)
374#define EXYNOS5_IRQ_SYSMMU_MFC_L_1 COMBINER_IRQ(6, 3)
375#define EXYNOS5_IRQ_SYSMMU_RTIC_0 COMBINER_IRQ(6, 4)
376#define EXYNOS5_IRQ_SYSMMU_RTIC_1 COMBINER_IRQ(6, 5)
377#define EXYNOS5_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(6, 6)
378#define EXYNOS5_IRQ_SYSMMU_SSS_1 COMBINER_IRQ(6, 7)
379
380#define EXYNOS5_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(7, 0)
381#define EXYNOS5_IRQ_SYSMMU_MDMA0_1 COMBINER_IRQ(7, 1)
382#define EXYNOS5_IRQ_SYSMMU_MDMA1_0 COMBINER_IRQ(7, 2)
383#define EXYNOS5_IRQ_SYSMMU_MDMA1_1 COMBINER_IRQ(7, 3)
384#define EXYNOS5_IRQ_SYSMMU_TV_0 COMBINER_IRQ(7, 4)
385#define EXYNOS5_IRQ_SYSMMU_TV_1 COMBINER_IRQ(7, 5)
386#define EXYNOS5_IRQ_SYSMMU_GPSX_0 COMBINER_IRQ(7, 6)
387#define EXYNOS5_IRQ_SYSMMU_GPSX_1 COMBINER_IRQ(7, 7)
388
389#define EXYNOS5_IRQ_SYSMMU_MFC_R_0 COMBINER_IRQ(8, 5)
390#define EXYNOS5_IRQ_SYSMMU_MFC_R_1 COMBINER_IRQ(8, 6)
391
392#define EXYNOS5_IRQ_SYSMMU_DIS1_0 COMBINER_IRQ(9, 4)
393#define EXYNOS5_IRQ_SYSMMU_DIS1_1 COMBINER_IRQ(9, 5)
394
395#define EXYNOS5_IRQ_DP COMBINER_IRQ(10, 3)
396#define EXYNOS5_IRQ_SYSMMU_DIS0_0 COMBINER_IRQ(10, 4)
397#define EXYNOS5_IRQ_SYSMMU_DIS0_1 COMBINER_IRQ(10, 5)
398#define EXYNOS5_IRQ_SYSMMU_ISP_0 COMBINER_IRQ(10, 6)
399#define EXYNOS5_IRQ_SYSMMU_ISP_1 COMBINER_IRQ(10, 7)
400
401#define EXYNOS5_IRQ_SYSMMU_ODC_0 COMBINER_IRQ(11, 0)
402#define EXYNOS5_IRQ_SYSMMU_ODC_1 COMBINER_IRQ(11, 1)
403#define EXYNOS5_IRQ_SYSMMU_DRC_0 COMBINER_IRQ(11, 6)
404#define EXYNOS5_IRQ_SYSMMU_DRC_1 COMBINER_IRQ(11, 7)
405
406#define EXYNOS5_IRQ_FIMD1_FIFO COMBINER_IRQ(18, 4)
407#define EXYNOS5_IRQ_FIMD1_VSYNC COMBINER_IRQ(18, 5)
408#define EXYNOS5_IRQ_FIMD1_SYSTEM COMBINER_IRQ(18, 6)
409
410#define EXYNOS5_IRQ_EINT0 COMBINER_IRQ(23, 0)
411#define EXYNOS5_IRQ_MCT_L0 COMBINER_IRQ(23, 1)
412#define EXYNOS5_IRQ_MCT_L1 COMBINER_IRQ(23, 2)
413#define EXYNOS5_IRQ_MCT_G0 COMBINER_IRQ(23, 3)
414#define EXYNOS5_IRQ_MCT_G1 COMBINER_IRQ(23, 4)
415#define EXYNOS5_IRQ_MCT_G2 COMBINER_IRQ(23, 5)
416#define EXYNOS5_IRQ_MCT_G3 COMBINER_IRQ(23, 6)
417
418#define EXYNOS5_IRQ_EINT1 COMBINER_IRQ(24, 0)
419#define EXYNOS5_IRQ_SYSMMU_LITE1_0 COMBINER_IRQ(24, 1)
420#define EXYNOS5_IRQ_SYSMMU_LITE1_1 COMBINER_IRQ(24, 2)
421#define EXYNOS5_IRQ_SYSMMU_2D_0 COMBINER_IRQ(24, 5)
422#define EXYNOS5_IRQ_SYSMMU_2D_1 COMBINER_IRQ(24, 6)
423
424#define EXYNOS5_IRQ_EINT2 COMBINER_IRQ(25, 0)
425#define EXYNOS5_IRQ_EINT3 COMBINER_IRQ(25, 1)
426
427#define EXYNOS5_IRQ_EINT4 COMBINER_IRQ(26, 0)
428#define EXYNOS5_IRQ_EINT5 COMBINER_IRQ(26, 1)
429
430#define EXYNOS5_IRQ_EINT6 COMBINER_IRQ(27, 0)
431#define EXYNOS5_IRQ_EINT7 COMBINER_IRQ(27, 1)
432
433#define EXYNOS5_IRQ_EINT8 COMBINER_IRQ(28, 0)
434#define EXYNOS5_IRQ_EINT9 COMBINER_IRQ(28, 1)
435
436#define EXYNOS5_IRQ_EINT10 COMBINER_IRQ(29, 0)
437#define EXYNOS5_IRQ_EINT11 COMBINER_IRQ(29, 1)
438
439#define EXYNOS5_IRQ_EINT12 COMBINER_IRQ(30, 0)
440#define EXYNOS5_IRQ_EINT13 COMBINER_IRQ(30, 1)
441
442#define EXYNOS5_IRQ_EINT14 COMBINER_IRQ(31, 0)
443#define EXYNOS5_IRQ_EINT15 COMBINER_IRQ(31, 1)
444
445#define EXYNOS5_MAX_COMBINER_NR 32
446
447#define EXYNOS5_IRQ_GPIO1_NR_GROUPS 13
448#define EXYNOS5_IRQ_GPIO2_NR_GROUPS 9
449#define EXYNOS5_IRQ_GPIO3_NR_GROUPS 5
450#define EXYNOS5_IRQ_GPIO4_NR_GROUPS 1
451
452#define MAX_COMBINER_NR (EXYNOS4_MAX_COMBINER_NR > EXYNOS5_MAX_COMBINER_NR ? \
453 EXYNOS4_MAX_COMBINER_NR : EXYNOS5_MAX_COMBINER_NR)
454
455#define S5P_EINT_BASE1 COMBINER_IRQ(MAX_COMBINER_NR, 0)
456#define S5P_EINT_BASE2 (S5P_EINT_BASE1 + 16)
457#define S5P_GPIOINT_BASE (S5P_EINT_BASE1 + 32)
458#define IRQ_GPIO_END (S5P_GPIOINT_BASE + S5P_GPIOINT_COUNT)
459#define IRQ_TIMER_BASE (IRQ_GPIO_END + 64)
172 460
173/* Set the default NR_IRQS */ 461/* Set the default NR_IRQS */
174#define NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT) 462
463#define NR_IRQS (IRQ_TIMER_BASE + IRQ_TIMER_COUNT)
175 464
176#endif /* __ASM_ARCH_IRQS_H */ 465#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h
index 609127df9b02..024d38ff1718 100644
--- a/arch/arm/mach-exynos/include/mach/map.h
+++ b/arch/arm/mach-exynos/include/mach/map.h
@@ -25,6 +25,7 @@
25 25
26#define EXYNOS4_PA_SYSRAM0 0x02025000 26#define EXYNOS4_PA_SYSRAM0 0x02025000
27#define EXYNOS4_PA_SYSRAM1 0x02020000 27#define EXYNOS4_PA_SYSRAM1 0x02020000
28#define EXYNOS5_PA_SYSRAM 0x02020000
28 29
29#define EXYNOS4_PA_FIMC0 0x11800000 30#define EXYNOS4_PA_FIMC0 0x11800000
30#define EXYNOS4_PA_FIMC1 0x11810000 31#define EXYNOS4_PA_FIMC1 0x11810000
@@ -48,14 +49,23 @@
48#define EXYNOS4_PA_ONENAND 0x0C000000 49#define EXYNOS4_PA_ONENAND 0x0C000000
49#define EXYNOS4_PA_ONENAND_DMA 0x0C600000 50#define EXYNOS4_PA_ONENAND_DMA 0x0C600000
50 51
51#define EXYNOS4_PA_CHIPID 0x10000000 52#define EXYNOS_PA_CHIPID 0x10000000
52 53
53#define EXYNOS4_PA_SYSCON 0x10010000 54#define EXYNOS4_PA_SYSCON 0x10010000
55#define EXYNOS5_PA_SYSCON 0x10050100
56
54#define EXYNOS4_PA_PMU 0x10020000 57#define EXYNOS4_PA_PMU 0x10020000
58#define EXYNOS5_PA_PMU 0x10040000
59
55#define EXYNOS4_PA_CMU 0x10030000 60#define EXYNOS4_PA_CMU 0x10030000
61#define EXYNOS5_PA_CMU 0x10010000
56 62
57#define EXYNOS4_PA_SYSTIMER 0x10050000 63#define EXYNOS4_PA_SYSTIMER 0x10050000
64#define EXYNOS5_PA_SYSTIMER 0x101C0000
65
58#define EXYNOS4_PA_WATCHDOG 0x10060000 66#define EXYNOS4_PA_WATCHDOG 0x10060000
67#define EXYNOS5_PA_WATCHDOG 0x101D0000
68
59#define EXYNOS4_PA_RTC 0x10070000 69#define EXYNOS4_PA_RTC 0x10070000
60 70
61#define EXYNOS4_PA_KEYPAD 0x100A0000 71#define EXYNOS4_PA_KEYPAD 0x100A0000
@@ -64,9 +74,12 @@
64#define EXYNOS4_PA_DMC1 0x10410000 74#define EXYNOS4_PA_DMC1 0x10410000
65 75
66#define EXYNOS4_PA_COMBINER 0x10440000 76#define EXYNOS4_PA_COMBINER 0x10440000
77#define EXYNOS5_PA_COMBINER 0x10440000
67 78
68#define EXYNOS4_PA_GIC_CPU 0x10480000 79#define EXYNOS4_PA_GIC_CPU 0x10480000
69#define EXYNOS4_PA_GIC_DIST 0x10490000 80#define EXYNOS4_PA_GIC_DIST 0x10490000
81#define EXYNOS5_PA_GIC_CPU 0x10480000
82#define EXYNOS5_PA_GIC_DIST 0x10490000
70 83
71#define EXYNOS4_PA_COREPERI 0x10500000 84#define EXYNOS4_PA_COREPERI 0x10500000
72#define EXYNOS4_PA_TWD 0x10500600 85#define EXYNOS4_PA_TWD 0x10500600
@@ -97,10 +110,13 @@
97#define EXYNOS4_PA_SPI1 0x13930000 110#define EXYNOS4_PA_SPI1 0x13930000
98#define EXYNOS4_PA_SPI2 0x13940000 111#define EXYNOS4_PA_SPI2 0x13940000
99 112
100
101#define EXYNOS4_PA_GPIO1 0x11400000 113#define EXYNOS4_PA_GPIO1 0x11400000
102#define EXYNOS4_PA_GPIO2 0x11000000 114#define EXYNOS4_PA_GPIO2 0x11000000
103#define EXYNOS4_PA_GPIO3 0x03860000 115#define EXYNOS4_PA_GPIO3 0x03860000
116#define EXYNOS5_PA_GPIO1 0x11400000
117#define EXYNOS5_PA_GPIO2 0x13400000
118#define EXYNOS5_PA_GPIO3 0x10D10000
119#define EXYNOS5_PA_GPIO4 0x03860000
104 120
105#define EXYNOS4_PA_MIPI_CSIS0 0x11880000 121#define EXYNOS4_PA_MIPI_CSIS0 0x11880000
106#define EXYNOS4_PA_MIPI_CSIS1 0x11890000 122#define EXYNOS4_PA_MIPI_CSIS1 0x11890000
@@ -115,6 +131,7 @@
115#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000 131#define EXYNOS4_PA_SATAPHY_CTRL 0x126B0000
116 132
117#define EXYNOS4_PA_SROMC 0x12570000 133#define EXYNOS4_PA_SROMC 0x12570000
134#define EXYNOS5_PA_SROMC 0x12250000
118 135
119#define EXYNOS4_PA_EHCI 0x12580000 136#define EXYNOS4_PA_EHCI 0x12580000
120#define EXYNOS4_PA_OHCI 0x12590000 137#define EXYNOS4_PA_OHCI 0x12590000
@@ -122,6 +139,7 @@
122#define EXYNOS4_PA_MFC 0x13400000 139#define EXYNOS4_PA_MFC 0x13400000
123 140
124#define EXYNOS4_PA_UART 0x13800000 141#define EXYNOS4_PA_UART 0x13800000
142#define EXYNOS5_PA_UART 0x12C00000
125 143
126#define EXYNOS4_PA_VP 0x12C00000 144#define EXYNOS4_PA_VP 0x12C00000
127#define EXYNOS4_PA_MIXER 0x12C10000 145#define EXYNOS4_PA_MIXER 0x12C10000
@@ -130,6 +148,7 @@
130#define EXYNOS4_PA_IIC_HDMIPHY 0x138E0000 148#define EXYNOS4_PA_IIC_HDMIPHY 0x138E0000
131 149
132#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000)) 150#define EXYNOS4_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
151#define EXYNOS5_PA_IIC(x) (0x12C60000 + ((x) * 0x10000))
133 152
134#define EXYNOS4_PA_ADC 0x13910000 153#define EXYNOS4_PA_ADC 0x13910000
135#define EXYNOS4_PA_ADC1 0x13911000 154#define EXYNOS4_PA_ADC1 0x13911000
@@ -139,8 +158,10 @@
139#define EXYNOS4_PA_SPDIF 0x139B0000 158#define EXYNOS4_PA_SPDIF 0x139B0000
140 159
141#define EXYNOS4_PA_TIMER 0x139D0000 160#define EXYNOS4_PA_TIMER 0x139D0000
161#define EXYNOS5_PA_TIMER 0x12DD0000
142 162
143#define EXYNOS4_PA_SDRAM 0x40000000 163#define EXYNOS4_PA_SDRAM 0x40000000
164#define EXYNOS5_PA_SDRAM 0x40000000
144 165
145/* Compatibiltiy Defines */ 166/* Compatibiltiy Defines */
146 167
@@ -158,7 +179,6 @@
158#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7) 179#define S3C_PA_IIC7 EXYNOS4_PA_IIC(7)
159#define S3C_PA_RTC EXYNOS4_PA_RTC 180#define S3C_PA_RTC EXYNOS4_PA_RTC
160#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG 181#define S3C_PA_WDT EXYNOS4_PA_WATCHDOG
161#define S3C_PA_UART EXYNOS4_PA_UART
162#define S3C_PA_SPI0 EXYNOS4_PA_SPI0 182#define S3C_PA_SPI0 EXYNOS4_PA_SPI0
163#define S3C_PA_SPI1 EXYNOS4_PA_SPI1 183#define S3C_PA_SPI1 EXYNOS4_PA_SPI1
164#define S3C_PA_SPI2 EXYNOS4_PA_SPI2 184#define S3C_PA_SPI2 EXYNOS4_PA_SPI2
@@ -189,15 +209,18 @@
189 209
190/* Compatibility UART */ 210/* Compatibility UART */
191 211
192#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 212#define EXYNOS4_PA_UART0 0x13800000
213#define EXYNOS4_PA_UART1 0x13810000
214#define EXYNOS4_PA_UART2 0x13820000
215#define EXYNOS4_PA_UART3 0x13830000
216#define EXYNOS4_SZ_UART SZ_256
193 217
194#define S5P_PA_UART(x) (EXYNOS4_PA_UART + ((x) * S3C_UART_OFFSET)) 218#define EXYNOS5_PA_UART0 0x12C00000
195#define S5P_PA_UART0 S5P_PA_UART(0) 219#define EXYNOS5_PA_UART1 0x12C10000
196#define S5P_PA_UART1 S5P_PA_UART(1) 220#define EXYNOS5_PA_UART2 0x12C20000
197#define S5P_PA_UART2 S5P_PA_UART(2) 221#define EXYNOS5_PA_UART3 0x12C30000
198#define S5P_PA_UART3 S5P_PA_UART(3) 222#define EXYNOS5_SZ_UART SZ_256
199#define S5P_PA_UART4 S5P_PA_UART(4)
200 223
201#define S5P_SZ_UART SZ_256 224#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
202 225
203#endif /* __ASM_ARCH_MAP_H */ 226#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-clock.h b/arch/arm/mach-exynos/include/mach/regs-clock.h
index 1e4abd64a547..e141c1fd68d8 100644
--- a/arch/arm/mach-exynos/include/mach/regs-clock.h
+++ b/arch/arm/mach-exynos/include/mach/regs-clock.h
@@ -253,6 +253,68 @@
253#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0) 253#define EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT (0)
254#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT) 254#define EXYNOS4_CLKDIV_CAM1_JPEG_MASK (0xf << EXYNOS4_CLKDIV_CAM1_JPEG_SHIFT)
255 255
256/* For EXYNOS5250 */
257
258#define EXYNOS5_APLL_CON0 EXYNOS_CLKREG(0x00100)
259#define EXYNOS5_CLKSRC_CPU EXYNOS_CLKREG(0x00200)
260#define EXYNOS5_CLKDIV_CPU0 EXYNOS_CLKREG(0x00500)
261#define EXYNOS5_MPLL_CON0 EXYNOS_CLKREG(0x04100)
262#define EXYNOS5_CLKSRC_CORE1 EXYNOS_CLKREG(0x04204)
263
264#define EXYNOS5_CLKGATE_IP_CORE EXYNOS_CLKREG(0x04900)
265
266#define EXYNOS5_CLKDIV_ACP EXYNOS_CLKREG(0x08500)
267
268#define EXYNOS5_CLKSRC_TOP2 EXYNOS_CLKREG(0x10218)
269#define EXYNOS5_EPLL_CON0 EXYNOS_CLKREG(0x10130)
270#define EXYNOS5_EPLL_CON1 EXYNOS_CLKREG(0x10134)
271#define EXYNOS5_VPLL_CON0 EXYNOS_CLKREG(0x10140)
272#define EXYNOS5_VPLL_CON1 EXYNOS_CLKREG(0x10144)
273#define EXYNOS5_CPLL_CON0 EXYNOS_CLKREG(0x10120)
274
275#define EXYNOS5_CLKSRC_TOP0 EXYNOS_CLKREG(0x10210)
276#define EXYNOS5_CLKSRC_TOP3 EXYNOS_CLKREG(0x1021C)
277#define EXYNOS5_CLKSRC_GSCL EXYNOS_CLKREG(0x10220)
278#define EXYNOS5_CLKSRC_DISP1_0 EXYNOS_CLKREG(0x1022C)
279#define EXYNOS5_CLKSRC_FSYS EXYNOS_CLKREG(0x10244)
280#define EXYNOS5_CLKSRC_PERIC0 EXYNOS_CLKREG(0x10250)
281
282#define EXYNOS5_CLKSRC_MASK_TOP EXYNOS_CLKREG(0x10310)
283#define EXYNOS5_CLKSRC_MASK_GSCL EXYNOS_CLKREG(0x10320)
284#define EXYNOS5_CLKSRC_MASK_DISP1_0 EXYNOS_CLKREG(0x1032C)
285#define EXYNOS5_CLKSRC_MASK_FSYS EXYNOS_CLKREG(0x10340)
286#define EXYNOS5_CLKSRC_MASK_PERIC0 EXYNOS_CLKREG(0x10350)
287
288#define EXYNOS5_CLKDIV_TOP0 EXYNOS_CLKREG(0x10510)
289#define EXYNOS5_CLKDIV_TOP1 EXYNOS_CLKREG(0x10514)
290#define EXYNOS5_CLKDIV_GSCL EXYNOS_CLKREG(0x10520)
291#define EXYNOS5_CLKDIV_DISP1_0 EXYNOS_CLKREG(0x1052C)
292#define EXYNOS5_CLKDIV_GEN EXYNOS_CLKREG(0x1053C)
293#define EXYNOS5_CLKDIV_FSYS0 EXYNOS_CLKREG(0x10548)
294#define EXYNOS5_CLKDIV_FSYS1 EXYNOS_CLKREG(0x1054C)
295#define EXYNOS5_CLKDIV_FSYS2 EXYNOS_CLKREG(0x10550)
296#define EXYNOS5_CLKDIV_FSYS3 EXYNOS_CLKREG(0x10554)
297#define EXYNOS5_CLKDIV_PERIC0 EXYNOS_CLKREG(0x10558)
298
299#define EXYNOS5_CLKGATE_IP_ACP EXYNOS_CLKREG(0x08800)
300#define EXYNOS5_CLKGATE_IP_GSCL EXYNOS_CLKREG(0x10920)
301#define EXYNOS5_CLKGATE_IP_DISP1 EXYNOS_CLKREG(0x10928)
302#define EXYNOS5_CLKGATE_IP_MFC EXYNOS_CLKREG(0x1092C)
303#define EXYNOS5_CLKGATE_IP_GEN EXYNOS_CLKREG(0x10934)
304#define EXYNOS5_CLKGATE_IP_FSYS EXYNOS_CLKREG(0x10944)
305#define EXYNOS5_CLKGATE_IP_GPS EXYNOS_CLKREG(0x1094C)
306#define EXYNOS5_CLKGATE_IP_PERIC EXYNOS_CLKREG(0x10950)
307#define EXYNOS5_CLKGATE_IP_PERIS EXYNOS_CLKREG(0x10960)
308#define EXYNOS5_CLKGATE_BLOCK EXYNOS_CLKREG(0x10980)
309
310#define EXYNOS5_BPLL_CON0 EXYNOS_CLKREG(0x20110)
311#define EXYNOS5_CLKSRC_CDREX EXYNOS_CLKREG(0x20200)
312#define EXYNOS5_CLKDIV_CDREX EXYNOS_CLKREG(0x20500)
313
314#define EXYNOS5_EPLL_LOCK EXYNOS_CLKREG(0x10030)
315
316#define EXYNOS5_EPLLCON0_LOCKED_SHIFT (29)
317
256/* Compatibility defines and inclusion */ 318/* Compatibility defines and inclusion */
257 319
258#include <mach/regs-pmu.h> 320#include <mach/regs-pmu.h>
diff --git a/arch/arm/mach-exynos/include/mach/regs-gpio.h b/arch/arm/mach-exynos/include/mach/regs-gpio.h
index 1401b21663a5..e4b5b60dcb85 100644
--- a/arch/arm/mach-exynos/include/mach/regs-gpio.h
+++ b/arch/arm/mach-exynos/include/mach/regs-gpio.h
@@ -16,6 +16,15 @@
16#include <mach/map.h> 16#include <mach/map.h>
17#include <mach/irqs.h> 17#include <mach/irqs.h>
18 18
19#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
20#define EINT_CON(b, x) (b + 0xE00 + (EINT_REG_NR(x) * 4))
21#define EINT_FLTCON(b, x) (b + 0xE80 + (EINT_REG_NR(x) * 4))
22#define EINT_MASK(b, x) (b + 0xF00 + (EINT_REG_NR(x) * 4))
23#define EINT_PEND(b, x) (b + 0xF40 + (EINT_REG_NR(x) * 4))
24
25#define EINT_OFFSET_BIT(x) (1 << (EINT_OFFSET(x) & 0x7))
26
27/* compatibility for plat-s5p/irq-pm.c */
19#define EXYNOS4_EINT40CON (S5P_VA_GPIO2 + 0xE00) 28#define EXYNOS4_EINT40CON (S5P_VA_GPIO2 + 0xE00)
20#define S5P_EINT_CON(x) (EXYNOS4_EINT40CON + ((x) * 0x4)) 29#define S5P_EINT_CON(x) (EXYNOS4_EINT40CON + ((x) * 0x4))
21 30
@@ -28,15 +37,4 @@
28#define EXYNOS4_EINT40PEND (S5P_VA_GPIO2 + 0xF40) 37#define EXYNOS4_EINT40PEND (S5P_VA_GPIO2 + 0xF40)
29#define S5P_EINT_PEND(x) (EXYNOS4_EINT40PEND + ((x) * 0x4)) 38#define S5P_EINT_PEND(x) (EXYNOS4_EINT40PEND + ((x) * 0x4))
30 39
31#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
32
33#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
34
35#define EINT_MODE S3C_GPIO_SFN(0xf)
36
37#define EINT_GPIO_0(x) EXYNOS4_GPX0(x)
38#define EINT_GPIO_1(x) EXYNOS4_GPX1(x)
39#define EINT_GPIO_2(x) EXYNOS4_GPX2(x)
40#define EINT_GPIO_3(x) EXYNOS4_GPX3(x)
41
42#endif /* __ASM_ARCH_REGS_GPIO_H */ 40#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h
index 4fff8e938fec..4c53f38b5a9e 100644
--- a/arch/arm/mach-exynos/include/mach/regs-pmu.h
+++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h
@@ -31,6 +31,7 @@
31#define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26) 31#define S5P_USE_STANDBYWFE_ISP_ARM (1 << 26)
32 32
33#define S5P_SWRESET S5P_PMUREG(0x0400) 33#define S5P_SWRESET S5P_PMUREG(0x0400)
34#define EXYNOS_SWRESET S5P_PMUREG(0x0400)
34 35
35#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600) 36#define S5P_WAKEUP_STAT S5P_PMUREG(0x0600)
36#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604) 37#define S5P_EINT_WAKEUP_MASK S5P_PMUREG(0x0604)
diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h
index 21d97bcd9acb..2979995d5a6a 100644
--- a/arch/arm/mach-exynos/include/mach/uncompress.h
+++ b/arch/arm/mach-exynos/include/mach/uncompress.h
@@ -1,9 +1,8 @@
1/* linux/arch/arm/mach-exynos4/include/mach/uncompress.h 1/*
2 * 2 * Copyright (c) 2010-2012 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * EXYNOS4 - uncompress code 5 * EXYNOS - uncompress code
7 * 6 *
8 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -13,12 +12,35 @@
13#ifndef __ASM_ARCH_UNCOMPRESS_H 12#ifndef __ASM_ARCH_UNCOMPRESS_H
14#define __ASM_ARCH_UNCOMPRESS_H __FILE__ 13#define __ASM_ARCH_UNCOMPRESS_H __FILE__
15 14
15#include <asm/mach-types.h>
16
16#include <mach/map.h> 17#include <mach/map.h>
18
19volatile u8 *uart_base;
20
17#include <plat/uncompress.h> 21#include <plat/uncompress.h>
18 22
23static unsigned int __raw_readl(unsigned int ptr)
24{
25 return *((volatile unsigned int *)ptr);
26}
27
19static void arch_detect_cpu(void) 28static void arch_detect_cpu(void)
20{ 29{
21 /* we do not need to do any cpu detection here at the moment. */ 30 u32 chip_id = __raw_readl(EXYNOS_PA_CHIPID);
31
32 /*
33 * product_id is bits 31:12
34 * bits 23:20 describe the exynosX family
35 *
36 */
37 chip_id >>= 20;
38 chip_id &= 0xf;
39
40 if (chip_id == 0x5)
41 uart_base = (volatile u8 *)EXYNOS5_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
42 else
43 uart_base = (volatile u8 *)EXYNOS4_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
22 44
23 /* 45 /*
24 * For preventing FIFO overrun or infinite loop of UART console, 46 * For preventing FIFO overrun or infinite loop of UART console,
diff --git a/arch/arm/mach-exynos/mach-exynos4-dt.c b/arch/arm/mach-exynos/mach-exynos4-dt.c
index e6b02fdf1b09..8245f1c761d9 100644
--- a/arch/arm/mach-exynos/mach-exynos4-dt.c
+++ b/arch/arm/mach-exynos/mach-exynos4-dt.c
@@ -37,13 +37,13 @@
37 * data from the device tree. 37 * data from the device tree.
38 */ 38 */
39static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = { 39static const struct of_dev_auxdata exynos4210_auxdata_lookup[] __initconst = {
40 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART0, 40 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART0,
41 "exynos4210-uart.0", NULL), 41 "exynos4210-uart.0", NULL),
42 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART1, 42 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART1,
43 "exynos4210-uart.1", NULL), 43 "exynos4210-uart.1", NULL),
44 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART2, 44 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART2,
45 "exynos4210-uart.2", NULL), 45 "exynos4210-uart.2", NULL),
46 OF_DEV_AUXDATA("samsung,exynos4210-uart", S5P_PA_UART3, 46 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS4_PA_UART3,
47 "exynos4210-uart.3", NULL), 47 "exynos4210-uart.3", NULL),
48 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0), 48 OF_DEV_AUXDATA("samsung,exynos4210-sdhci", EXYNOS4_PA_HSMMC(0),
49 "exynos4-sdhci.0", NULL), 49 "exynos4-sdhci.0", NULL),
diff --git a/arch/arm/mach-exynos/mach-exynos5-dt.c b/arch/arm/mach-exynos/mach-exynos5-dt.c
new file mode 100644
index 000000000000..0d26f50081ad
--- /dev/null
+++ b/arch/arm/mach-exynos/mach-exynos5-dt.c
@@ -0,0 +1,78 @@
1/*
2 * SAMSUNG EXYNOS5250 Flattened Device Tree enabled machine
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10*/
11
12#include <linux/of_platform.h>
13#include <linux/serial_core.h>
14
15#include <asm/mach/arch.h>
16#include <asm/hardware/gic.h>
17#include <mach/map.h>
18
19#include <plat/cpu.h>
20#include <plat/regs-serial.h>
21
22#include "common.h"
23
24/*
25 * The following lookup table is used to override device names when devices
26 * are registered from device tree. This is temporarily added to enable
27 * device tree support addition for the EXYNOS5 architecture.
28 *
29 * For drivers that require platform data to be provided from the machine
30 * file, a platform data pointer can also be supplied along with the
31 * devices names. Usually, the platform data elements that cannot be parsed
32 * from the device tree by the drivers (example: function pointers) are
33 * supplied. But it should be noted that this is a temporary mechanism and
34 * at some point, the drivers should be capable of parsing all the platform
35 * data from the device tree.
36 */
37static const struct of_dev_auxdata exynos5250_auxdata_lookup[] __initconst = {
38 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART0,
39 "exynos4210-uart.0", NULL),
40 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART1,
41 "exynos4210-uart.1", NULL),
42 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART2,
43 "exynos4210-uart.2", NULL),
44 OF_DEV_AUXDATA("samsung,exynos4210-uart", EXYNOS5_PA_UART3,
45 "exynos4210-uart.3", NULL),
46 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA0, "dma-pl330.0", NULL),
47 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.1", NULL),
48 OF_DEV_AUXDATA("arm,pl330", EXYNOS5_PA_PDMA1, "dma-pl330.2", NULL),
49 {},
50};
51
52static void __init exynos5250_dt_map_io(void)
53{
54 exynos_init_io(NULL, 0);
55 s3c24xx_init_clocks(24000000);
56}
57
58static void __init exynos5250_dt_machine_init(void)
59{
60 of_platform_populate(NULL, of_default_bus_match_table,
61 exynos5250_auxdata_lookup, NULL);
62}
63
64static char const *exynos5250_dt_compat[] __initdata = {
65 "samsung,exynos5250",
66 NULL
67};
68
69DT_MACHINE_START(EXYNOS5_DT, "SAMSUNG EXYNOS5 (Flattened Device Tree)")
70 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
71 .init_irq = exynos5_init_irq,
72 .map_io = exynos5250_dt_map_io,
73 .handle_irq = gic_handle_irq,
74 .init_machine = exynos5250_dt_machine_init,
75 .timer = &exynos4_timer,
76 .dt_compat = exynos5250_dt_compat,
77 .restart = exynos5_restart,
78MACHINE_END
diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index 82ea6fccfb34..b3982c867c9c 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -111,7 +111,7 @@ static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
111 .max_width = 8, 111 .max_width = 8,
112 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 112 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
113 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 113 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
114 MMC_CAP_DISABLE | MMC_CAP_ERASE), 114 MMC_CAP_ERASE),
115 .cd_type = S3C_SDHCI_CD_PERMANENT, 115 .cd_type = S3C_SDHCI_CD_PERMANENT,
116 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 116 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
117}; 117};
@@ -150,8 +150,7 @@ static struct platform_device emmc_fixed_voltage = {
150static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = { 150static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
151 .max_width = 4, 151 .max_width = 4,
152 .host_caps = MMC_CAP_4_BIT_DATA | 152 .host_caps = MMC_CAP_4_BIT_DATA |
153 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 153 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
154 MMC_CAP_DISABLE,
155 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */ 154 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
156 .ext_cd_gpio_invert = 1, 155 .ext_cd_gpio_invert = 1,
157 .cd_type = S3C_SDHCI_CD_GPIO, 156 .cd_type = S3C_SDHCI_CD_GPIO,
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index 28658da9f423..6bb9dbdd73fd 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -745,8 +745,7 @@ static struct platform_device universal_gpio_keys = {
745static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = { 745static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
746 .max_width = 8, 746 .max_width = 8,
747 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA | 747 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
748 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 748 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
749 MMC_CAP_DISABLE),
750 .cd_type = S3C_SDHCI_CD_PERMANENT, 749 .cd_type = S3C_SDHCI_CD_PERMANENT,
751 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, 750 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
752}; 751};
@@ -784,8 +783,7 @@ static struct platform_device mmc0_fixed_voltage = {
784static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = { 783static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
785 .max_width = 4, 784 .max_width = 4,
786 .host_caps = MMC_CAP_4_BIT_DATA | 785 .host_caps = MMC_CAP_4_BIT_DATA |
787 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 786 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
788 MMC_CAP_DISABLE,
789 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */ 787 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
790 .ext_cd_gpio_invert = 1, 788 .ext_cd_gpio_invert = 1,
791 .cd_type = S3C_SDHCI_CD_GPIO, 789 .cd_type = S3C_SDHCI_CD_GPIO,
@@ -796,8 +794,7 @@ static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
796static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = { 794static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
797 .max_width = 4, 795 .max_width = 4,
798 .host_caps = MMC_CAP_4_BIT_DATA | 796 .host_caps = MMC_CAP_4_BIT_DATA |
799 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | 797 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
800 MMC_CAP_DISABLE,
801 .cd_type = S3C_SDHCI_CD_EXTERNAL, 798 .cd_type = S3C_SDHCI_CD_EXTERNAL,
802}; 799};
803 800
diff --git a/arch/arm/mach-exynos/mct.c b/arch/arm/mach-exynos/mct.c
index e8a1caaf1902..897d9a9cf226 100644
--- a/arch/arm/mach-exynos/mct.c
+++ b/arch/arm/mach-exynos/mct.c
@@ -261,7 +261,10 @@ static void exynos4_clockevent_init(void)
261 mct_comp_device.cpumask = cpumask_of(0); 261 mct_comp_device.cpumask = cpumask_of(0);
262 clockevents_register_device(&mct_comp_device); 262 clockevents_register_device(&mct_comp_device);
263 263
264 setup_irq(IRQ_MCT_G0, &mct_comp_event_irq); 264 if (soc_is_exynos5250())
265 setup_irq(EXYNOS5_IRQ_MCT_G0, &mct_comp_event_irq);
266 else
267 setup_irq(EXYNOS4_IRQ_MCT_G0, &mct_comp_event_irq);
265} 268}
266 269
267#ifdef CONFIG_LOCAL_TIMERS 270#ifdef CONFIG_LOCAL_TIMERS
@@ -412,16 +415,16 @@ static int __cpuinit exynos4_local_timer_setup(struct clock_event_device *evt)
412 if (mct_int_type == MCT_INT_SPI) { 415 if (mct_int_type == MCT_INT_SPI) {
413 if (cpu == 0) { 416 if (cpu == 0) {
414 mct_tick0_event_irq.dev_id = mevt; 417 mct_tick0_event_irq.dev_id = mevt;
415 evt->irq = IRQ_MCT_L0; 418 evt->irq = EXYNOS4_IRQ_MCT_L0;
416 setup_irq(IRQ_MCT_L0, &mct_tick0_event_irq); 419 setup_irq(EXYNOS4_IRQ_MCT_L0, &mct_tick0_event_irq);
417 } else { 420 } else {
418 mct_tick1_event_irq.dev_id = mevt; 421 mct_tick1_event_irq.dev_id = mevt;
419 evt->irq = IRQ_MCT_L1; 422 evt->irq = EXYNOS4_IRQ_MCT_L1;
420 setup_irq(IRQ_MCT_L1, &mct_tick1_event_irq); 423 setup_irq(EXYNOS4_IRQ_MCT_L1, &mct_tick1_event_irq);
421 irq_set_affinity(IRQ_MCT_L1, cpumask_of(1)); 424 irq_set_affinity(EXYNOS4_IRQ_MCT_L1, cpumask_of(1));
422 } 425 }
423 } else { 426 } else {
424 enable_percpu_irq(IRQ_MCT_LOCALTIMER, 0); 427 enable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER, 0);
425 } 428 }
426 429
427 return 0; 430 return 0;
@@ -437,7 +440,7 @@ static void exynos4_local_timer_stop(struct clock_event_device *evt)
437 else 440 else
438 remove_irq(evt->irq, &mct_tick1_event_irq); 441 remove_irq(evt->irq, &mct_tick1_event_irq);
439 else 442 else
440 disable_percpu_irq(IRQ_MCT_LOCALTIMER); 443 disable_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER);
441} 444}
442 445
443static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = { 446static struct local_timer_ops exynos4_mct_tick_ops __cpuinitdata = {
@@ -457,11 +460,11 @@ static void __init exynos4_timer_resources(void)
457 if (mct_int_type == MCT_INT_PPI) { 460 if (mct_int_type == MCT_INT_PPI) {
458 int err; 461 int err;
459 462
460 err = request_percpu_irq(IRQ_MCT_LOCALTIMER, 463 err = request_percpu_irq(EXYNOS_IRQ_MCT_LOCALTIMER,
461 exynos4_mct_tick_isr, "MCT", 464 exynos4_mct_tick_isr, "MCT",
462 &percpu_mct_tick); 465 &percpu_mct_tick);
463 WARN(err, "MCT: can't request IRQ %d (%d)\n", 466 WARN(err, "MCT: can't request IRQ %d (%d)\n",
464 IRQ_MCT_LOCALTIMER, err); 467 EXYNOS_IRQ_MCT_LOCALTIMER, err);
465 } 468 }
466 469
467 local_timer_register(&exynos4_mct_tick_ops); 470 local_timer_register(&exynos4_mct_tick_ops);
diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c
index 0f2035a1eb6e..36c3984aaa47 100644
--- a/arch/arm/mach-exynos/platsmp.c
+++ b/arch/arm/mach-exynos/platsmp.c
@@ -166,7 +166,10 @@ void __init smp_init_cpus(void)
166 void __iomem *scu_base = scu_base_addr(); 166 void __iomem *scu_base = scu_base_addr();
167 unsigned int i, ncores; 167 unsigned int i, ncores;
168 168
169 ncores = scu_base ? scu_get_core_count(scu_base) : 1; 169 if (soc_is_exynos5250())
170 ncores = 2;
171 else
172 ncores = scu_base ? scu_get_core_count(scu_base) : 1;
170 173
171 /* sanity check */ 174 /* sanity check */
172 if (ncores > nr_cpu_ids) { 175 if (ncores > nr_cpu_ids) {
@@ -183,8 +186,8 @@ void __init smp_init_cpus(void)
183 186
184void __init platform_smp_prepare_cpus(unsigned int max_cpus) 187void __init platform_smp_prepare_cpus(unsigned int max_cpus)
185{ 188{
186 189 if (!soc_is_exynos5250())
187 scu_enable(scu_base_addr()); 190 scu_enable(scu_base_addr());
188 191
189 /* 192 /*
190 * Write the address of secondary startup into the 193 * Write the address of secondary startup into the
diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c
index 0b04af2b13cc..13b306808b42 100644
--- a/arch/arm/mach-exynos/pm_domains.c
+++ b/arch/arm/mach-exynos/pm_domains.c
@@ -183,6 +183,12 @@ static __init int exynos4_pm_init_power_domain(void)
183#ifdef CONFIG_S5P_DEV_CSIS1 183#ifdef CONFIG_S5P_DEV_CSIS1
184 exynos_pm_add_dev_to_genpd(&s5p_device_mipi_csis1, &exynos4_pd_cam); 184 exynos_pm_add_dev_to_genpd(&s5p_device_mipi_csis1, &exynos4_pd_cam);
185#endif 185#endif
186#ifdef CONFIG_S5P_DEV_G2D
187 exynos_pm_add_dev_to_genpd(&s5p_device_g2d, &exynos4_pd_lcd0);
188#endif
189#ifdef CONFIG_S5P_DEV_JPEG
190 exynos_pm_add_dev_to_genpd(&s5p_device_jpeg, &exynos4_pd_cam);
191#endif
186 return 0; 192 return 0;
187} 193}
188arch_initcall(exynos4_pm_init_power_domain); 194arch_initcall(exynos4_pm_init_power_domain);
diff --git a/arch/arm/mach-exynos/setup-i2c0.c b/arch/arm/mach-exynos/setup-i2c0.c
index d395bd17c38b..b90d94c17f7c 100644
--- a/arch/arm/mach-exynos/setup-i2c0.c
+++ b/arch/arm/mach-exynos/setup-i2c0.c
@@ -1,7 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-exynos4/setup-i2c0.c 2 * Copyright (c) 2009-2012 Samsung Electronics Co., Ltd.
3 *
4 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/ 3 * http://www.samsung.com/
6 * 4 *
7 * I2C0 GPIO configuration. 5 * I2C0 GPIO configuration.
@@ -18,9 +16,14 @@ struct platform_device; /* don't need the contents */
18#include <linux/gpio.h> 16#include <linux/gpio.h>
19#include <plat/iic.h> 17#include <plat/iic.h>
20#include <plat/gpio-cfg.h> 18#include <plat/gpio-cfg.h>
19#include <plat/cpu.h>
21 20
22void s3c_i2c0_cfg_gpio(struct platform_device *dev) 21void s3c_i2c0_cfg_gpio(struct platform_device *dev)
23{ 22{
23 if (soc_is_exynos5250())
24 /* will be implemented with gpio function */
25 return;
26
24 s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2, 27 s3c_gpio_cfgall_range(EXYNOS4_GPD1(0), 2,
25 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); 28 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
26} 29}
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index 41978ee4f9d0..3e6aaa6361da 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -21,6 +21,7 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/system_misc.h>
24#include <asm/hardware/dec21285.h> 25#include <asm/hardware/dec21285.h>
25 26
26#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index 121ad1d4fa39..3b54196447c7 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/hardware/dec21285.h> 15#include <asm/hardware/dec21285.h>
16#include <asm/mach/time.h> 16#include <asm/mach/time.h>
17#include <asm/system_info.h>
17 18
18#include "common.h" 19#include "common.h"
19 20
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
index 3194d3f73503..e17e11de4f5e 100644
--- a/arch/arm/mach-footbridge/dc21285.c
+++ b/arch/arm/mach-footbridge/dc21285.c
@@ -21,7 +21,6 @@
21#include <video/vga.h> 21#include <video/vga.h>
22 22
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/system.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <asm/hardware/dec21285.h> 25#include <asm/hardware/dec21285.h>
27 26
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c
index 4e10090cd87f..5bd266754b95 100644
--- a/arch/arm/mach-footbridge/ebsa285-leds.c
+++ b/arch/arm/mach-footbridge/ebsa285-leds.c
@@ -24,7 +24,6 @@
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <asm/leds.h> 25#include <asm/leds.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/system.h>
28 27
29#define LED_STATE_ENABLED 1 28#define LED_STATE_ENABLED 1
30#define LED_STATE_CLAIMED 2 29#define LED_STATE_CLAIMED 2
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index 15a70396c27d..aba531eebbc6 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -27,18 +27,5 @@
27 * Translation of various region addresses to virtual addresses 27 * Translation of various region addresses to virtual addresses
28 */ 28 */
29#define __io(a) ((void __iomem *)(PCIO_BASE + (a))) 29#define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
30#if 1
31#define __mem_pci(a) (a)
32#else
33
34static inline void __iomem *___mem_pci(void __iomem *p)
35{
36 unsigned long a = (unsigned long)p;
37 BUG_ON(a <= 0xc0000000 || a >= 0xe0000000);
38 return p;
39}
40
41#define __mem_pci(a) ___mem_pci(a)
42#endif
43 30
44#endif 31#endif
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index 80a1c5cc9071..cac9f67e7da7 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -17,6 +17,7 @@
17#include <asm/leds.h> 17#include <asm/leds.h>
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19#include <asm/setup.h> 19#include <asm/setup.h>
20#include <asm/system_misc.h>
20 21
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
22 23
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
index e57102e871fc..5a2bd89cbdca 100644
--- a/arch/arm/mach-footbridge/netwinder-leds.c
+++ b/arch/arm/mach-footbridge/netwinder-leds.c
@@ -24,7 +24,6 @@
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <asm/leds.h> 25#include <asm/leds.h>
26#include <asm/mach-types.h> 26#include <asm/mach-types.h>
27#include <asm/system.h>
28 27
29#define LED_STATE_ENABLED 1 28#define LED_STATE_ENABLED 1
30#define LED_STATE_CLAIMED 2 29#define LED_STATE_CLAIMED 2
diff --git a/arch/arm/mach-gemini/include/mach/io.h b/arch/arm/mach-gemini/include/mach/io.h
deleted file mode 100644
index c548056b98b2..000000000000
--- a/arch/arm/mach-gemini/include/mach/io.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * Copyright (C) 2001-2006 Storlink, Corp.
3 * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
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#ifndef __MACH_IO_H
11#define __MACH_IO_H
12
13#define IO_SPACE_LIMIT 0xffffffff
14
15#define __io(a) __typesafe_io(a)
16#define __mem_pci(a) (a)
17
18#endif /* __MACH_IO_H */
diff --git a/arch/arm/mach-h720x/common.c b/arch/arm/mach-h720x/common.c
index e756d1ac00c2..aa1331e86bcf 100644
--- a/arch/arm/mach-h720x/common.c
+++ b/arch/arm/mach-h720x/common.c
@@ -24,6 +24,7 @@
24#include <asm/dma.h> 24#include <asm/dma.h>
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/system_misc.h>
27#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29#include <mach/irqs.h> 30#include <mach/irqs.h>
diff --git a/arch/arm/mach-h720x/include/mach/io.h b/arch/arm/mach-h720x/include/mach/io.h
deleted file mode 100644
index 2c8659c21a93..000000000000
--- a/arch/arm/mach-h720x/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-h720x/include/mach/io.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 *
8 * 09-19-2001 JJKIM
9 * Created from arch/arm/mach-l7200/include/mach/io.h
10 *
11 * 03-27-2003 Robert Schwebel <r.schwebel@pengutronix.de>:
12 * re-unified header files for h720x
13 */
14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H
16
17#define IO_SPACE_LIMIT 0xffffffff
18
19#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a)
21
22#endif
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 808b055289b2..410a112bb52e 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -35,7 +35,6 @@
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
36#include <asm/mach/map.h> 36#include <asm/mach/map.h>
37#include <asm/mach/time.h> 37#include <asm/mach/time.h>
38#include <mach/irqs.h>
39 38
40#include "core.h" 39#include "core.h"
41#include "sysregs.h" 40#include "sysregs.h"
diff --git a/arch/arm/mach-highbank/include/mach/io.h b/arch/arm/mach-highbank/include/mach/io.h
deleted file mode 100644
index 70cfa3ba7697..000000000000
--- a/arch/arm/mach-highbank/include/mach/io.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __MACH_IO_H
2#define __MACH_IO_H
3
4#define __io(a) ({ (void)(a); __typesafe_io(0); })
5#define __mem_pci(a) (a)
6
7#endif
diff --git a/arch/arm/mach-highbank/include/mach/irqs.h b/arch/arm/mach-highbank/include/mach/irqs.h
deleted file mode 100644
index 9746aab14e9a..000000000000
--- a/arch/arm/mach-highbank/include/mach/irqs.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __MACH_IRQS_H
2#define __MACH_IRQS_H
3
4#define NR_IRQS 192
5
6#endif
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 52359f80c42d..7561eca131b0 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,6 +1,3 @@
1config IMX_HAVE_DMA_V1
2 bool
3
4config HAVE_IMX_GPC 1config HAVE_IMX_GPC
5 bool 2 bool
6 3
@@ -38,7 +35,6 @@ config SOC_IMX1
38 bool 35 bool
39 select ARCH_MX1 36 select ARCH_MX1
40 select CPU_ARM920T 37 select CPU_ARM920T
41 select IMX_HAVE_DMA_V1
42 select IMX_HAVE_IOMUX_V1 38 select IMX_HAVE_IOMUX_V1
43 select MXC_AVIC 39 select MXC_AVIC
44 40
@@ -46,7 +42,6 @@ config SOC_IMX21
46 bool 42 bool
47 select MACH_MX21 43 select MACH_MX21
48 select CPU_ARM926T 44 select CPU_ARM926T
49 select IMX_HAVE_DMA_V1
50 select IMX_HAVE_IOMUX_V1 45 select IMX_HAVE_IOMUX_V1
51 select MXC_AVIC 46 select MXC_AVIC
52 47
@@ -61,7 +56,6 @@ config SOC_IMX27
61 bool 56 bool
62 select MACH_MX27 57 select MACH_MX27
63 select CPU_ARM926T 58 select CPU_ARM926T
64 select IMX_HAVE_DMA_V1
65 select IMX_HAVE_IOMUX_V1 59 select IMX_HAVE_IOMUX_V1
66 select MXC_AVIC 60 select MXC_AVIC
67 61
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 35fc450fa263..ab939c5046c3 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -1,5 +1,3 @@
1obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o
2
3obj-$(CONFIG_SOC_IMX1) += clock-imx1.o mm-imx1.o 1obj-$(CONFIG_SOC_IMX1) += clock-imx1.o mm-imx1.o
4obj-$(CONFIG_SOC_IMX21) += clock-imx21.o mm-imx21.o 2obj-$(CONFIG_SOC_IMX21) += clock-imx21.o mm-imx21.o
5 3
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c
index b9a95ed75553..98e04f5a87dd 100644
--- a/arch/arm/mach-imx/clock-imx27.c
+++ b/arch/arm/mach-imx/clock-imx27.c
@@ -662,6 +662,7 @@ static struct clk_lookup lookups[] = {
662 _REGISTER_CLOCK(NULL, "dma", dma_clk) 662 _REGISTER_CLOCK(NULL, "dma", dma_clk)
663 _REGISTER_CLOCK(NULL, "rtic", rtic_clk) 663 _REGISTER_CLOCK(NULL, "rtic", rtic_clk)
664 _REGISTER_CLOCK(NULL, "brom", brom_clk) 664 _REGISTER_CLOCK(NULL, "brom", brom_clk)
665 _REGISTER_CLOCK(NULL, "emma", emma_clk)
665 _REGISTER_CLOCK("m2m-emmaprp.0", NULL, emma_clk) 666 _REGISTER_CLOCK("m2m-emmaprp.0", NULL, emma_clk)
666 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk) 667 _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
667 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) 668 _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
index 1e279af656ad..e56c1a83eee3 100644
--- a/arch/arm/mach-imx/clock-imx35.c
+++ b/arch/arm/mach-imx/clock-imx35.c
@@ -483,7 +483,7 @@ static struct clk_lookup lookups[] = {
483 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk) 483 _REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk)
484 _REGISTER_CLOCK(NULL, "max", max_clk) 484 _REGISTER_CLOCK(NULL, "max", max_clk)
485 _REGISTER_CLOCK(NULL, "audmux", audmux_clk) 485 _REGISTER_CLOCK(NULL, "audmux", audmux_clk)
486 _REGISTER_CLOCK(NULL, "csi", csi_clk) 486 _REGISTER_CLOCK("mx3-camera.0", NULL, csi_clk)
487 _REGISTER_CLOCK(NULL, "iim", iim_clk) 487 _REGISTER_CLOCK(NULL, "iim", iim_clk)
488 _REGISTER_CLOCK(NULL, "gpu2d", gpu2d_clk) 488 _REGISTER_CLOCK(NULL, "gpu2d", gpu2d_clk)
489 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk) 489 _REGISTER_CLOCK("mxc_nand.0", NULL, nfc_clk)
diff --git a/arch/arm/mach-imx/dma-v1.c b/arch/arm/mach-imx/dma-v1.c
deleted file mode 100644
index 42afc29a7da8..000000000000
--- a/arch/arm/mach-imx/dma-v1.c
+++ /dev/null
@@ -1,846 +0,0 @@
1/*
2 * linux/arch/arm/plat-mxc/dma-v1.c
3 *
4 * i.MX DMA registration and IRQ dispatching
5 *
6 * Copyright 2006 Pavel Pisa <pisa@cmp.felk.cvut.cz>
7 * Copyright 2008 Juergen Beisert, <kernel@pengutronix.de>
8 * Copyright 2008 Sascha Hauer, <s.hauer@pengutronix.de>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301, USA.
23 */
24
25#include <linux/module.h>
26#include <linux/init.h>
27#include <linux/kernel.h>
28#include <linux/interrupt.h>
29#include <linux/err.h>
30#include <linux/errno.h>
31#include <linux/clk.h>
32#include <linux/scatterlist.h>
33#include <linux/io.h>
34
35#include <asm/system.h>
36#include <asm/irq.h>
37#include <mach/hardware.h>
38#include <mach/dma-v1.h>
39
40#define DMA_DCR 0x00 /* Control Register */
41#define DMA_DISR 0x04 /* Interrupt status Register */
42#define DMA_DIMR 0x08 /* Interrupt mask Register */
43#define DMA_DBTOSR 0x0c /* Burst timeout status Register */
44#define DMA_DRTOSR 0x10 /* Request timeout Register */
45#define DMA_DSESR 0x14 /* Transfer Error Status Register */
46#define DMA_DBOSR 0x18 /* Buffer overflow status Register */
47#define DMA_DBTOCR 0x1c /* Burst timeout control Register */
48#define DMA_WSRA 0x40 /* W-Size Register A */
49#define DMA_XSRA 0x44 /* X-Size Register A */
50#define DMA_YSRA 0x48 /* Y-Size Register A */
51#define DMA_WSRB 0x4c /* W-Size Register B */
52#define DMA_XSRB 0x50 /* X-Size Register B */
53#define DMA_YSRB 0x54 /* Y-Size Register B */
54#define DMA_SAR(x) (0x80 + ((x) << 6)) /* Source Address Registers */
55#define DMA_DAR(x) (0x84 + ((x) << 6)) /* Destination Address Registers */
56#define DMA_CNTR(x) (0x88 + ((x) << 6)) /* Count Registers */
57#define DMA_CCR(x) (0x8c + ((x) << 6)) /* Control Registers */
58#define DMA_RSSR(x) (0x90 + ((x) << 6)) /* Request source select Registers */
59#define DMA_BLR(x) (0x94 + ((x) << 6)) /* Burst length Registers */
60#define DMA_RTOR(x) (0x98 + ((x) << 6)) /* Request timeout Registers */
61#define DMA_BUCR(x) (0x98 + ((x) << 6)) /* Bus Utilization Registers */
62#define DMA_CCNR(x) (0x9C + ((x) << 6)) /* Channel counter Registers */
63
64#define DCR_DRST (1<<1)
65#define DCR_DEN (1<<0)
66#define DBTOCR_EN (1<<15)
67#define DBTOCR_CNT(x) ((x) & 0x7fff)
68#define CNTR_CNT(x) ((x) & 0xffffff)
69#define CCR_ACRPT (1<<14)
70#define CCR_DMOD_LINEAR (0x0 << 12)
71#define CCR_DMOD_2D (0x1 << 12)
72#define CCR_DMOD_FIFO (0x2 << 12)
73#define CCR_DMOD_EOBFIFO (0x3 << 12)
74#define CCR_SMOD_LINEAR (0x0 << 10)
75#define CCR_SMOD_2D (0x1 << 10)
76#define CCR_SMOD_FIFO (0x2 << 10)
77#define CCR_SMOD_EOBFIFO (0x3 << 10)
78#define CCR_MDIR_DEC (1<<9)
79#define CCR_MSEL_B (1<<8)
80#define CCR_DSIZ_32 (0x0 << 6)
81#define CCR_DSIZ_8 (0x1 << 6)
82#define CCR_DSIZ_16 (0x2 << 6)
83#define CCR_SSIZ_32 (0x0 << 4)
84#define CCR_SSIZ_8 (0x1 << 4)
85#define CCR_SSIZ_16 (0x2 << 4)
86#define CCR_REN (1<<3)
87#define CCR_RPT (1<<2)
88#define CCR_FRC (1<<1)
89#define CCR_CEN (1<<0)
90#define RTOR_EN (1<<15)
91#define RTOR_CLK (1<<14)
92#define RTOR_PSC (1<<13)
93
94/*
95 * struct imx_dma_channel - i.MX specific DMA extension
96 * @name: name specified by DMA client
97 * @irq_handler: client callback for end of transfer
98 * @err_handler: client callback for error condition
99 * @data: clients context data for callbacks
100 * @dma_mode: direction of the transfer %DMA_MODE_READ or %DMA_MODE_WRITE
101 * @sg: pointer to the actual read/written chunk for scatter-gather emulation
102 * @resbytes: total residual number of bytes to transfer
103 * (it can be lower or same as sum of SG mapped chunk sizes)
104 * @sgcount: number of chunks to be read/written
105 *
106 * Structure is used for IMX DMA processing. It would be probably good
107 * @struct dma_struct in the future for external interfacing and use
108 * @struct imx_dma_channel only as extension to it.
109 */
110
111struct imx_dma_channel {
112 const char *name;
113 void (*irq_handler) (int, void *);
114 void (*err_handler) (int, void *, int errcode);
115 void (*prog_handler) (int, void *, struct scatterlist *);
116 void *data;
117 unsigned int dma_mode;
118 struct scatterlist *sg;
119 unsigned int resbytes;
120 int dma_num;
121
122 int in_use;
123
124 u32 ccr_from_device;
125 u32 ccr_to_device;
126
127 struct timer_list watchdog;
128
129 int hw_chaining;
130};
131
132static void __iomem *imx_dmav1_baseaddr;
133
134static void imx_dmav1_writel(unsigned val, unsigned offset)
135{
136 __raw_writel(val, imx_dmav1_baseaddr + offset);
137}
138
139static unsigned imx_dmav1_readl(unsigned offset)
140{
141 return __raw_readl(imx_dmav1_baseaddr + offset);
142}
143
144static struct imx_dma_channel imx_dma_channels[IMX_DMA_CHANNELS];
145
146static struct clk *dma_clk;
147
148static int imx_dma_hw_chain(struct imx_dma_channel *imxdma)
149{
150 if (cpu_is_mx27())
151 return imxdma->hw_chaining;
152 else
153 return 0;
154}
155
156/*
157 * imx_dma_sg_next - prepare next chunk for scatter-gather DMA emulation
158 */
159static inline int imx_dma_sg_next(int channel, struct scatterlist *sg)
160{
161 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
162 unsigned long now;
163
164 if (!imxdma->name) {
165 printk(KERN_CRIT "%s: called for not allocated channel %d\n",
166 __func__, channel);
167 return 0;
168 }
169
170 now = min(imxdma->resbytes, sg->length);
171 if (imxdma->resbytes != IMX_DMA_LENGTH_LOOP)
172 imxdma->resbytes -= now;
173
174 if ((imxdma->dma_mode & DMA_MODE_MASK) == DMA_MODE_READ)
175 imx_dmav1_writel(sg->dma_address, DMA_DAR(channel));
176 else
177 imx_dmav1_writel(sg->dma_address, DMA_SAR(channel));
178
179 imx_dmav1_writel(now, DMA_CNTR(channel));
180
181 pr_debug("imxdma%d: next sg chunk dst 0x%08x, src 0x%08x, "
182 "size 0x%08x\n", channel,
183 imx_dmav1_readl(DMA_DAR(channel)),
184 imx_dmav1_readl(DMA_SAR(channel)),
185 imx_dmav1_readl(DMA_CNTR(channel)));
186
187 return now;
188}
189
190/**
191 * imx_dma_setup_single - setup i.MX DMA channel for linear memory to/from
192 * device transfer
193 *
194 * @channel: i.MX DMA channel number
195 * @dma_address: the DMA/physical memory address of the linear data block
196 * to transfer
197 * @dma_length: length of the data block in bytes
198 * @dev_addr: physical device port address
199 * @dmamode: DMA transfer mode, %DMA_MODE_READ from the device to the memory
200 * or %DMA_MODE_WRITE from memory to the device
201 *
202 * Return value: if incorrect parameters are provided -%EINVAL.
203 * Zero indicates success.
204 */
205int
206imx_dma_setup_single(int channel, dma_addr_t dma_address,
207 unsigned int dma_length, unsigned int dev_addr,
208 unsigned int dmamode)
209{
210 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
211
212 imxdma->sg = NULL;
213 imxdma->dma_mode = dmamode;
214
215 if (!dma_address) {
216 printk(KERN_ERR "imxdma%d: imx_dma_setup_single null address\n",
217 channel);
218 return -EINVAL;
219 }
220
221 if (!dma_length) {
222 printk(KERN_ERR "imxdma%d: imx_dma_setup_single zero length\n",
223 channel);
224 return -EINVAL;
225 }
226
227 if ((dmamode & DMA_MODE_MASK) == DMA_MODE_READ) {
228 pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d "
229 "dev_addr=0x%08x for read\n",
230 channel, __func__, (unsigned int)dma_address,
231 dma_length, dev_addr);
232
233 imx_dmav1_writel(dev_addr, DMA_SAR(channel));
234 imx_dmav1_writel(dma_address, DMA_DAR(channel));
235 imx_dmav1_writel(imxdma->ccr_from_device, DMA_CCR(channel));
236 } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) {
237 pr_debug("imxdma%d: %s dma_addressg=0x%08x dma_length=%d "
238 "dev_addr=0x%08x for write\n",
239 channel, __func__, (unsigned int)dma_address,
240 dma_length, dev_addr);
241
242 imx_dmav1_writel(dma_address, DMA_SAR(channel));
243 imx_dmav1_writel(dev_addr, DMA_DAR(channel));
244 imx_dmav1_writel(imxdma->ccr_to_device,
245 DMA_CCR(channel));
246 } else {
247 printk(KERN_ERR "imxdma%d: imx_dma_setup_single bad dmamode\n",
248 channel);
249 return -EINVAL;
250 }
251
252 imx_dmav1_writel(dma_length, DMA_CNTR(channel));
253
254 return 0;
255}
256EXPORT_SYMBOL(imx_dma_setup_single);
257
258/**
259 * imx_dma_setup_sg - setup i.MX DMA channel SG list to/from device transfer
260 * @channel: i.MX DMA channel number
261 * @sg: pointer to the scatter-gather list/vector
262 * @sgcount: scatter-gather list hungs count
263 * @dma_length: total length of the transfer request in bytes
264 * @dev_addr: physical device port address
265 * @dmamode: DMA transfer mode, %DMA_MODE_READ from the device to the memory
266 * or %DMA_MODE_WRITE from memory to the device
267 *
268 * The function sets up DMA channel state and registers to be ready for
269 * transfer specified by provided parameters. The scatter-gather emulation
270 * is set up according to the parameters.
271 *
272 * The full preparation of the transfer requires setup of more register
273 * by the caller before imx_dma_enable() can be called.
274 *
275 * %BLR(channel) holds transfer burst length in bytes, 0 means 64 bytes
276 *
277 * %RSSR(channel) has to be set to the DMA request line source %DMA_REQ_xxx
278 *
279 * %CCR(channel) has to specify transfer parameters, the next settings is
280 * typical for linear or simple scatter-gather transfers if %DMA_MODE_READ is
281 * specified
282 *
283 * %CCR_DMOD_LINEAR | %CCR_DSIZ_32 | %CCR_SMOD_FIFO | %CCR_SSIZ_x
284 *
285 * The typical setup for %DMA_MODE_WRITE is specified by next options
286 * combination
287 *
288 * %CCR_SMOD_LINEAR | %CCR_SSIZ_32 | %CCR_DMOD_FIFO | %CCR_DSIZ_x
289 *
290 * Be careful here and do not mistakenly mix source and target device
291 * port sizes constants, they are really different:
292 * %CCR_SSIZ_8, %CCR_SSIZ_16, %CCR_SSIZ_32,
293 * %CCR_DSIZ_8, %CCR_DSIZ_16, %CCR_DSIZ_32
294 *
295 * Return value: if incorrect parameters are provided -%EINVAL.
296 * Zero indicates success.
297 */
298int
299imx_dma_setup_sg(int channel,
300 struct scatterlist *sg, unsigned int sgcount,
301 unsigned int dma_length, unsigned int dev_addr,
302 unsigned int dmamode)
303{
304 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
305
306 if (imxdma->in_use)
307 return -EBUSY;
308
309 imxdma->sg = sg;
310 imxdma->dma_mode = dmamode;
311 imxdma->resbytes = dma_length;
312
313 if (!sg || !sgcount) {
314 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg empty sg list\n",
315 channel);
316 return -EINVAL;
317 }
318
319 if (!sg->length) {
320 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg zero length\n",
321 channel);
322 return -EINVAL;
323 }
324
325 if ((dmamode & DMA_MODE_MASK) == DMA_MODE_READ) {
326 pr_debug("imxdma%d: %s sg=%p sgcount=%d total length=%d "
327 "dev_addr=0x%08x for read\n",
328 channel, __func__, sg, sgcount, dma_length, dev_addr);
329
330 imx_dmav1_writel(dev_addr, DMA_SAR(channel));
331 imx_dmav1_writel(imxdma->ccr_from_device, DMA_CCR(channel));
332 } else if ((dmamode & DMA_MODE_MASK) == DMA_MODE_WRITE) {
333 pr_debug("imxdma%d: %s sg=%p sgcount=%d total length=%d "
334 "dev_addr=0x%08x for write\n",
335 channel, __func__, sg, sgcount, dma_length, dev_addr);
336
337 imx_dmav1_writel(dev_addr, DMA_DAR(channel));
338 imx_dmav1_writel(imxdma->ccr_to_device, DMA_CCR(channel));
339 } else {
340 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg bad dmamode\n",
341 channel);
342 return -EINVAL;
343 }
344
345 imx_dma_sg_next(channel, sg);
346
347 return 0;
348}
349EXPORT_SYMBOL(imx_dma_setup_sg);
350
351int
352imx_dma_config_channel(int channel, unsigned int config_port,
353 unsigned int config_mem, unsigned int dmareq, int hw_chaining)
354{
355 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
356 u32 dreq = 0;
357
358 imxdma->hw_chaining = 0;
359
360 if (hw_chaining) {
361 imxdma->hw_chaining = 1;
362 if (!imx_dma_hw_chain(imxdma))
363 return -EINVAL;
364 }
365
366 if (dmareq)
367 dreq = CCR_REN;
368
369 imxdma->ccr_from_device = config_port | (config_mem << 2) | dreq;
370 imxdma->ccr_to_device = config_mem | (config_port << 2) | dreq;
371
372 imx_dmav1_writel(dmareq, DMA_RSSR(channel));
373
374 return 0;
375}
376EXPORT_SYMBOL(imx_dma_config_channel);
377
378void imx_dma_config_burstlen(int channel, unsigned int burstlen)
379{
380 imx_dmav1_writel(burstlen, DMA_BLR(channel));
381}
382EXPORT_SYMBOL(imx_dma_config_burstlen);
383
384/**
385 * imx_dma_setup_handlers - setup i.MX DMA channel end and error notification
386 * handlers
387 * @channel: i.MX DMA channel number
388 * @irq_handler: the pointer to the function called if the transfer
389 * ends successfully
390 * @err_handler: the pointer to the function called if the premature
391 * end caused by error occurs
392 * @data: user specified value to be passed to the handlers
393 */
394int
395imx_dma_setup_handlers(int channel,
396 void (*irq_handler) (int, void *),
397 void (*err_handler) (int, void *, int),
398 void *data)
399{
400 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
401 unsigned long flags;
402
403 if (!imxdma->name) {
404 printk(KERN_CRIT "%s: called for not allocated channel %d\n",
405 __func__, channel);
406 return -ENODEV;
407 }
408
409 local_irq_save(flags);
410 imx_dmav1_writel(1 << channel, DMA_DISR);
411 imxdma->irq_handler = irq_handler;
412 imxdma->err_handler = err_handler;
413 imxdma->data = data;
414 local_irq_restore(flags);
415 return 0;
416}
417EXPORT_SYMBOL(imx_dma_setup_handlers);
418
419/**
420 * imx_dma_setup_progression_handler - setup i.MX DMA channel progression
421 * handlers
422 * @channel: i.MX DMA channel number
423 * @prog_handler: the pointer to the function called if the transfer progresses
424 */
425int
426imx_dma_setup_progression_handler(int channel,
427 void (*prog_handler) (int, void*, struct scatterlist*))
428{
429 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
430 unsigned long flags;
431
432 if (!imxdma->name) {
433 printk(KERN_CRIT "%s: called for not allocated channel %d\n",
434 __func__, channel);
435 return -ENODEV;
436 }
437
438 local_irq_save(flags);
439 imxdma->prog_handler = prog_handler;
440 local_irq_restore(flags);
441 return 0;
442}
443EXPORT_SYMBOL(imx_dma_setup_progression_handler);
444
445/**
446 * imx_dma_enable - function to start i.MX DMA channel operation
447 * @channel: i.MX DMA channel number
448 *
449 * The channel has to be allocated by driver through imx_dma_request()
450 * or imx_dma_request_by_prio() function.
451 * The transfer parameters has to be set to the channel registers through
452 * call of the imx_dma_setup_single() or imx_dma_setup_sg() function
453 * and registers %BLR(channel), %RSSR(channel) and %CCR(channel) has to
454 * be set prior this function call by the channel user.
455 */
456void imx_dma_enable(int channel)
457{
458 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
459 unsigned long flags;
460
461 pr_debug("imxdma%d: imx_dma_enable\n", channel);
462
463 if (!imxdma->name) {
464 printk(KERN_CRIT "%s: called for not allocated channel %d\n",
465 __func__, channel);
466 return;
467 }
468
469 if (imxdma->in_use)
470 return;
471
472 local_irq_save(flags);
473
474 imx_dmav1_writel(1 << channel, DMA_DISR);
475 imx_dmav1_writel(imx_dmav1_readl(DMA_DIMR) & ~(1 << channel), DMA_DIMR);
476 imx_dmav1_writel(imx_dmav1_readl(DMA_CCR(channel)) | CCR_CEN |
477 CCR_ACRPT, DMA_CCR(channel));
478
479 if ((cpu_is_mx21() || cpu_is_mx27()) &&
480 imxdma->sg && imx_dma_hw_chain(imxdma)) {
481 imxdma->sg = sg_next(imxdma->sg);
482 if (imxdma->sg) {
483 u32 tmp;
484 imx_dma_sg_next(channel, imxdma->sg);
485 tmp = imx_dmav1_readl(DMA_CCR(channel));
486 imx_dmav1_writel(tmp | CCR_RPT | CCR_ACRPT,
487 DMA_CCR(channel));
488 }
489 }
490 imxdma->in_use = 1;
491
492 local_irq_restore(flags);
493}
494EXPORT_SYMBOL(imx_dma_enable);
495
496/**
497 * imx_dma_disable - stop, finish i.MX DMA channel operatin
498 * @channel: i.MX DMA channel number
499 */
500void imx_dma_disable(int channel)
501{
502 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
503 unsigned long flags;
504
505 pr_debug("imxdma%d: imx_dma_disable\n", channel);
506
507 if (imx_dma_hw_chain(imxdma))
508 del_timer(&imxdma->watchdog);
509
510 local_irq_save(flags);
511 imx_dmav1_writel(imx_dmav1_readl(DMA_DIMR) | (1 << channel), DMA_DIMR);
512 imx_dmav1_writel(imx_dmav1_readl(DMA_CCR(channel)) & ~CCR_CEN,
513 DMA_CCR(channel));
514 imx_dmav1_writel(1 << channel, DMA_DISR);
515 imxdma->in_use = 0;
516 local_irq_restore(flags);
517}
518EXPORT_SYMBOL(imx_dma_disable);
519
520static void imx_dma_watchdog(unsigned long chno)
521{
522 struct imx_dma_channel *imxdma = &imx_dma_channels[chno];
523
524 imx_dmav1_writel(0, DMA_CCR(chno));
525 imxdma->in_use = 0;
526 imxdma->sg = NULL;
527
528 if (imxdma->err_handler)
529 imxdma->err_handler(chno, imxdma->data, IMX_DMA_ERR_TIMEOUT);
530}
531
532static irqreturn_t dma_err_handler(int irq, void *dev_id)
533{
534 int i, disr;
535 struct imx_dma_channel *imxdma;
536 unsigned int err_mask;
537 int errcode;
538
539 disr = imx_dmav1_readl(DMA_DISR);
540
541 err_mask = imx_dmav1_readl(DMA_DBTOSR) |
542 imx_dmav1_readl(DMA_DRTOSR) |
543 imx_dmav1_readl(DMA_DSESR) |
544 imx_dmav1_readl(DMA_DBOSR);
545
546 if (!err_mask)
547 return IRQ_HANDLED;
548
549 imx_dmav1_writel(disr & err_mask, DMA_DISR);
550
551 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
552 if (!(err_mask & (1 << i)))
553 continue;
554 imxdma = &imx_dma_channels[i];
555 errcode = 0;
556
557 if (imx_dmav1_readl(DMA_DBTOSR) & (1 << i)) {
558 imx_dmav1_writel(1 << i, DMA_DBTOSR);
559 errcode |= IMX_DMA_ERR_BURST;
560 }
561 if (imx_dmav1_readl(DMA_DRTOSR) & (1 << i)) {
562 imx_dmav1_writel(1 << i, DMA_DRTOSR);
563 errcode |= IMX_DMA_ERR_REQUEST;
564 }
565 if (imx_dmav1_readl(DMA_DSESR) & (1 << i)) {
566 imx_dmav1_writel(1 << i, DMA_DSESR);
567 errcode |= IMX_DMA_ERR_TRANSFER;
568 }
569 if (imx_dmav1_readl(DMA_DBOSR) & (1 << i)) {
570 imx_dmav1_writel(1 << i, DMA_DBOSR);
571 errcode |= IMX_DMA_ERR_BUFFER;
572 }
573 if (imxdma->name && imxdma->err_handler) {
574 imxdma->err_handler(i, imxdma->data, errcode);
575 continue;
576 }
577
578 imx_dma_channels[i].sg = NULL;
579
580 printk(KERN_WARNING
581 "DMA timeout on channel %d (%s) -%s%s%s%s\n",
582 i, imxdma->name,
583 errcode & IMX_DMA_ERR_BURST ? " burst" : "",
584 errcode & IMX_DMA_ERR_REQUEST ? " request" : "",
585 errcode & IMX_DMA_ERR_TRANSFER ? " transfer" : "",
586 errcode & IMX_DMA_ERR_BUFFER ? " buffer" : "");
587 }
588 return IRQ_HANDLED;
589}
590
591static void dma_irq_handle_channel(int chno)
592{
593 struct imx_dma_channel *imxdma = &imx_dma_channels[chno];
594
595 if (!imxdma->name) {
596 /*
597 * IRQ for an unregistered DMA channel:
598 * let's clear the interrupts and disable it.
599 */
600 printk(KERN_WARNING
601 "spurious IRQ for DMA channel %d\n", chno);
602 return;
603 }
604
605 if (imxdma->sg) {
606 u32 tmp;
607 struct scatterlist *current_sg = imxdma->sg;
608 imxdma->sg = sg_next(imxdma->sg);
609
610 if (imxdma->sg) {
611 imx_dma_sg_next(chno, imxdma->sg);
612
613 tmp = imx_dmav1_readl(DMA_CCR(chno));
614
615 if (imx_dma_hw_chain(imxdma)) {
616 /* FIXME: The timeout should probably be
617 * configurable
618 */
619 mod_timer(&imxdma->watchdog,
620 jiffies + msecs_to_jiffies(500));
621
622 tmp |= CCR_CEN | CCR_RPT | CCR_ACRPT;
623 imx_dmav1_writel(tmp, DMA_CCR(chno));
624 } else {
625 imx_dmav1_writel(tmp & ~CCR_CEN, DMA_CCR(chno));
626 tmp |= CCR_CEN;
627 }
628
629 imx_dmav1_writel(tmp, DMA_CCR(chno));
630
631 if (imxdma->prog_handler)
632 imxdma->prog_handler(chno, imxdma->data,
633 current_sg);
634
635 return;
636 }
637
638 if (imx_dma_hw_chain(imxdma)) {
639 del_timer(&imxdma->watchdog);
640 return;
641 }
642 }
643
644 imx_dmav1_writel(0, DMA_CCR(chno));
645 imxdma->in_use = 0;
646 if (imxdma->irq_handler)
647 imxdma->irq_handler(chno, imxdma->data);
648}
649
650static irqreturn_t dma_irq_handler(int irq, void *dev_id)
651{
652 int i, disr;
653
654 if (cpu_is_mx21() || cpu_is_mx27())
655 dma_err_handler(irq, dev_id);
656
657 disr = imx_dmav1_readl(DMA_DISR);
658
659 pr_debug("imxdma: dma_irq_handler called, disr=0x%08x\n",
660 disr);
661
662 imx_dmav1_writel(disr, DMA_DISR);
663 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
664 if (disr & (1 << i))
665 dma_irq_handle_channel(i);
666 }
667
668 return IRQ_HANDLED;
669}
670
671/**
672 * imx_dma_request - request/allocate specified channel number
673 * @channel: i.MX DMA channel number
674 * @name: the driver/caller own non-%NULL identification
675 */
676int imx_dma_request(int channel, const char *name)
677{
678 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
679 unsigned long flags;
680 int ret = 0;
681
682 /* basic sanity checks */
683 if (!name)
684 return -EINVAL;
685
686 if (channel >= IMX_DMA_CHANNELS) {
687 printk(KERN_CRIT "%s: called for non-existed channel %d\n",
688 __func__, channel);
689 return -EINVAL;
690 }
691
692 local_irq_save(flags);
693 if (imxdma->name) {
694 local_irq_restore(flags);
695 return -EBUSY;
696 }
697 memset(imxdma, 0, sizeof(*imxdma));
698 imxdma->name = name;
699 local_irq_restore(flags); /* request_irq() can block */
700
701 if (cpu_is_mx21() || cpu_is_mx27()) {
702 ret = request_irq(MX2x_INT_DMACH0 + channel,
703 dma_irq_handler, 0, "DMA", NULL);
704 if (ret) {
705 imxdma->name = NULL;
706 pr_crit("Can't register IRQ %d for DMA channel %d\n",
707 MX2x_INT_DMACH0 + channel, channel);
708 return ret;
709 }
710 init_timer(&imxdma->watchdog);
711 imxdma->watchdog.function = &imx_dma_watchdog;
712 imxdma->watchdog.data = channel;
713 }
714
715 return ret;
716}
717EXPORT_SYMBOL(imx_dma_request);
718
719/**
720 * imx_dma_free - release previously acquired channel
721 * @channel: i.MX DMA channel number
722 */
723void imx_dma_free(int channel)
724{
725 unsigned long flags;
726 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
727
728 if (!imxdma->name) {
729 printk(KERN_CRIT
730 "%s: trying to free free channel %d\n",
731 __func__, channel);
732 return;
733 }
734
735 local_irq_save(flags);
736 /* Disable interrupts */
737 imx_dma_disable(channel);
738 imxdma->name = NULL;
739
740 if (cpu_is_mx21() || cpu_is_mx27())
741 free_irq(MX2x_INT_DMACH0 + channel, NULL);
742
743 local_irq_restore(flags);
744}
745EXPORT_SYMBOL(imx_dma_free);
746
747/**
748 * imx_dma_request_by_prio - find and request some of free channels best
749 * suiting requested priority
750 * @channel: i.MX DMA channel number
751 * @name: the driver/caller own non-%NULL identification
752 *
753 * This function tries to find a free channel in the specified priority group
754 * if the priority cannot be achieved it tries to look for free channel
755 * in the higher and then even lower priority groups.
756 *
757 * Return value: If there is no free channel to allocate, -%ENODEV is returned.
758 * On successful allocation channel is returned.
759 */
760int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio)
761{
762 int i;
763 int best;
764
765 switch (prio) {
766 case (DMA_PRIO_HIGH):
767 best = 8;
768 break;
769 case (DMA_PRIO_MEDIUM):
770 best = 4;
771 break;
772 case (DMA_PRIO_LOW):
773 default:
774 best = 0;
775 break;
776 }
777
778 for (i = best; i < IMX_DMA_CHANNELS; i++)
779 if (!imx_dma_request(i, name))
780 return i;
781
782 for (i = best - 1; i >= 0; i--)
783 if (!imx_dma_request(i, name))
784 return i;
785
786 printk(KERN_ERR "%s: no free DMA channel found\n", __func__);
787
788 return -ENODEV;
789}
790EXPORT_SYMBOL(imx_dma_request_by_prio);
791
792static int __init imx_dma_init(void)
793{
794 int ret = 0;
795 int i;
796
797 if (cpu_is_mx1())
798 imx_dmav1_baseaddr = MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR);
799 else if (cpu_is_mx21())
800 imx_dmav1_baseaddr = MX21_IO_ADDRESS(MX21_DMA_BASE_ADDR);
801 else if (cpu_is_mx27())
802 imx_dmav1_baseaddr = MX27_IO_ADDRESS(MX27_DMA_BASE_ADDR);
803 else
804 return 0;
805
806 dma_clk = clk_get(NULL, "dma");
807 if (IS_ERR(dma_clk))
808 return PTR_ERR(dma_clk);
809 clk_enable(dma_clk);
810
811 /* reset DMA module */
812 imx_dmav1_writel(DCR_DRST, DMA_DCR);
813
814 if (cpu_is_mx1()) {
815 ret = request_irq(MX1_DMA_INT, dma_irq_handler, 0, "DMA", NULL);
816 if (ret) {
817 pr_crit("Wow! Can't register IRQ for DMA\n");
818 return ret;
819 }
820
821 ret = request_irq(MX1_DMA_ERR, dma_err_handler, 0, "DMA", NULL);
822 if (ret) {
823 pr_crit("Wow! Can't register ERRIRQ for DMA\n");
824 free_irq(MX1_DMA_INT, NULL);
825 return ret;
826 }
827 }
828
829 /* enable DMA module */
830 imx_dmav1_writel(DCR_DEN, DMA_DCR);
831
832 /* clear all interrupts */
833 imx_dmav1_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_DISR);
834
835 /* disable interrupts */
836 imx_dmav1_writel((1 << IMX_DMA_CHANNELS) - 1, DMA_DIMR);
837
838 for (i = 0; i < IMX_DMA_CHANNELS; i++) {
839 imx_dma_channels[i].sg = NULL;
840 imx_dma_channels[i].dma_num = i;
841 }
842
843 return ret;
844}
845
846arch_initcall(imx_dma_init);
diff --git a/arch/arm/mach-imx/include/mach/dma-v1.h b/arch/arm/mach-imx/include/mach/dma-v1.h
deleted file mode 100644
index ac6fd713828a..000000000000
--- a/arch/arm/mach-imx/include/mach/dma-v1.h
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * linux/arch/arm/mach-imx/include/mach/dma-v1.h
3 *
4 * i.MX DMA registration and IRQ dispatching
5 *
6 * Copyright 2006 Pavel Pisa <pisa@cmp.felk.cvut.cz>
7 * Copyright 2008 Juergen Beisert, <kernel@pengutronix.de>
8 * Copyright 2008 Sascha Hauer, <s.hauer@pengutronix.de>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301, USA.
23 */
24
25#ifndef __MACH_DMA_V1_H__
26#define __MACH_DMA_V1_H__
27
28#define imx_has_dma_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())
29
30#include <mach/dma.h>
31
32#define IMX_DMA_CHANNELS 16
33
34#define DMA_MODE_READ 0
35#define DMA_MODE_WRITE 1
36#define DMA_MODE_MASK 1
37
38#define MX1_DMA_REG(offset) MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR + (offset))
39
40/* DMA Interrupt Mask Register */
41#define MX1_DMA_DIMR MX1_DMA_REG(0x08)
42
43/* Channel Control Register */
44#define MX1_DMA_CCR(x) MX1_DMA_REG(0x8c + ((x) << 6))
45
46#define IMX_DMA_MEMSIZE_32 (0 << 4)
47#define IMX_DMA_MEMSIZE_8 (1 << 4)
48#define IMX_DMA_MEMSIZE_16 (2 << 4)
49#define IMX_DMA_TYPE_LINEAR (0 << 10)
50#define IMX_DMA_TYPE_2D (1 << 10)
51#define IMX_DMA_TYPE_FIFO (2 << 10)
52
53#define IMX_DMA_ERR_BURST (1 << 0)
54#define IMX_DMA_ERR_REQUEST (1 << 1)
55#define IMX_DMA_ERR_TRANSFER (1 << 2)
56#define IMX_DMA_ERR_BUFFER (1 << 3)
57#define IMX_DMA_ERR_TIMEOUT (1 << 4)
58
59int
60imx_dma_config_channel(int channel, unsigned int config_port,
61 unsigned int config_mem, unsigned int dmareq, int hw_chaining);
62
63void
64imx_dma_config_burstlen(int channel, unsigned int burstlen);
65
66int
67imx_dma_setup_single(int channel, dma_addr_t dma_address,
68 unsigned int dma_length, unsigned int dev_addr,
69 unsigned int dmamode);
70
71
72/*
73 * Use this flag as the dma_length argument to imx_dma_setup_sg()
74 * to create an endless running dma loop. The end of the scatterlist
75 * must be linked to the beginning for this to work.
76 */
77#define IMX_DMA_LENGTH_LOOP ((unsigned int)-1)
78
79int
80imx_dma_setup_sg(int channel, struct scatterlist *sg,
81 unsigned int sgcount, unsigned int dma_length,
82 unsigned int dev_addr, unsigned int dmamode);
83
84int
85imx_dma_setup_handlers(int channel,
86 void (*irq_handler) (int, void *),
87 void (*err_handler) (int, void *, int), void *data);
88
89int
90imx_dma_setup_progression_handler(int channel,
91 void (*prog_handler) (int, void*, struct scatterlist*));
92
93void imx_dma_enable(int channel);
94
95void imx_dma_disable(int channel);
96
97int imx_dma_request(int channel, const char *name);
98
99void imx_dma_free(int channel);
100
101int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio);
102
103#endif /* __MACH_DMA_V1_H__ */
diff --git a/arch/arm/mach-imx/mach-armadillo5x0.c b/arch/arm/mach-imx/mach-armadillo5x0.c
index 27bc27e6ea41..c650145d1646 100644
--- a/arch/arm/mach-imx/mach-armadillo5x0.c
+++ b/arch/arm/mach-imx/mach-armadillo5x0.c
@@ -38,6 +38,8 @@
38#include <linux/usb/otg.h> 38#include <linux/usb/otg.h>
39#include <linux/usb/ulpi.h> 39#include <linux/usb/ulpi.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/regulator/machine.h>
42#include <linux/regulator/fixed.h>
41 43
42#include <mach/hardware.h> 44#include <mach/hardware.h>
43#include <asm/mach-types.h> 45#include <asm/mach-types.h>
@@ -479,6 +481,11 @@ static struct platform_device *devices[] __initdata = {
479 &armadillo5x0_smc911x_device, 481 &armadillo5x0_smc911x_device,
480}; 482};
481 483
484static struct regulator_consumer_supply dummy_supplies[] = {
485 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
486 REGULATOR_SUPPLY("vddvario", "smsc911x"),
487};
488
482/* 489/*
483 * Perform board specific initializations 490 * Perform board specific initializations
484 */ 491 */
@@ -489,6 +496,8 @@ static void __init armadillo5x0_init(void)
489 mxc_iomux_setup_multiple_pins(armadillo5x0_pins, 496 mxc_iomux_setup_multiple_pins(armadillo5x0_pins,
490 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); 497 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
491 498
499 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
500
492 platform_add_devices(devices, ARRAY_SIZE(devices)); 501 platform_add_devices(devices, ARRAY_SIZE(devices));
493 imx_add_gpio_keys(&armadillo5x0_button_data); 502 imx_add_gpio_keys(&armadillo5x0_button_data);
494 imx31_add_imx_i2c1(NULL); 503 imx31_add_imx_i2c1(NULL);
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 7696dfa2bdba..da6c1d9af768 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -26,6 +26,7 @@
26#include <asm/hardware/gic.h> 26#include <asm/hardware/gic.h>
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <asm/system_misc.h>
29#include <mach/common.h> 30#include <mach/common.h>
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31 32
diff --git a/arch/arm/mach-imx/mach-kzm_arm11_01.c b/arch/arm/mach-imx/mach-kzm_arm11_01.c
index fc78e8071cd1..15a26e908260 100644
--- a/arch/arm/mach-imx/mach-kzm_arm11_01.c
+++ b/arch/arm/mach-imx/mach-kzm_arm11_01.c
@@ -24,6 +24,8 @@
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25#include <linux/smsc911x.h> 25#include <linux/smsc911x.h>
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/regulator/machine.h>
28#include <linux/regulator/fixed.h>
27 29
28#include <asm/irq.h> 30#include <asm/irq.h>
29#include <asm/mach-types.h> 31#include <asm/mach-types.h>
@@ -166,6 +168,11 @@ static struct platform_device kzm_smsc9118_device = {
166 }, 168 },
167}; 169};
168 170
171static struct regulator_consumer_supply dummy_supplies[] = {
172 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
173 REGULATOR_SUPPLY("vddvario", "smsc911x"),
174};
175
169static int __init kzm_init_smsc9118(void) 176static int __init kzm_init_smsc9118(void)
170{ 177{
171 /* 178 /*
@@ -175,6 +182,8 @@ static int __init kzm_init_smsc9118(void)
175 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int"); 182 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2), "smsc9118-int");
176 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2)); 183 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_2));
177 184
185 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
186
178 return platform_device_register(&kzm_smsc9118_device); 187 return platform_device_register(&kzm_smsc9118_device);
179} 188}
180#else 189#else
diff --git a/arch/arm/mach-imx/mach-mx31lilly.c b/arch/arm/mach-imx/mach-mx31lilly.c
index 02401bbd6d53..83714b0cc290 100644
--- a/arch/arm/mach-imx/mach-mx31lilly.c
+++ b/arch/arm/mach-imx/mach-mx31lilly.c
@@ -34,6 +34,8 @@
34#include <linux/mfd/mc13783.h> 34#include <linux/mfd/mc13783.h>
35#include <linux/usb/otg.h> 35#include <linux/usb/otg.h>
36#include <linux/usb/ulpi.h> 36#include <linux/usb/ulpi.h>
37#include <linux/regulator/machine.h>
38#include <linux/regulator/fixed.h>
37 39
38#include <asm/mach-types.h> 40#include <asm/mach-types.h>
39#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
@@ -242,6 +244,11 @@ static struct platform_device *devices[] __initdata = {
242static int mx31lilly_baseboard; 244static int mx31lilly_baseboard;
243core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444); 245core_param(mx31lilly_baseboard, mx31lilly_baseboard, int, 0444);
244 246
247static struct regulator_consumer_supply dummy_supplies[] = {
248 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
249 REGULATOR_SUPPLY("vddvario", "smsc911x"),
250};
251
245static void __init mx31lilly_board_init(void) 252static void __init mx31lilly_board_init(void)
246{ 253{
247 imx31_soc_init(); 254 imx31_soc_init();
@@ -280,6 +287,8 @@ static void __init mx31lilly_board_init(void)
280 imx31_add_spi_imx1(&spi1_pdata); 287 imx31_add_spi_imx1(&spi1_pdata);
281 spi_register_board_info(&mc13783_dev, 1); 288 spi_register_board_info(&mc13783_dev, 1);
282 289
290 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
291
283 platform_add_devices(devices, ARRAY_SIZE(devices)); 292 platform_add_devices(devices, ARRAY_SIZE(devices));
284 293
285 /* USB */ 294 /* USB */
diff --git a/arch/arm/mach-imx/mach-mx31lite.c b/arch/arm/mach-imx/mach-mx31lite.c
index ef80751712e7..0abef5f13df5 100644
--- a/arch/arm/mach-imx/mach-mx31lite.c
+++ b/arch/arm/mach-imx/mach-mx31lite.c
@@ -29,6 +29,8 @@
29#include <linux/usb/ulpi.h> 29#include <linux/usb/ulpi.h>
30#include <linux/mtd/physmap.h> 30#include <linux/mtd/physmap.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/regulator/machine.h>
33#include <linux/regulator/fixed.h>
32 34
33#include <asm/mach-types.h> 35#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
@@ -226,6 +228,11 @@ void __init mx31lite_map_io(void)
226static int mx31lite_baseboard; 228static int mx31lite_baseboard;
227core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444); 229core_param(mx31lite_baseboard, mx31lite_baseboard, int, 0444);
228 230
231static struct regulator_consumer_supply dummy_supplies[] = {
232 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
233 REGULATOR_SUPPLY("vddvario", "smsc911x"),
234};
235
229static void __init mx31lite_init(void) 236static void __init mx31lite_init(void)
230{ 237{
231 int ret; 238 int ret;
@@ -259,6 +266,8 @@ static void __init mx31lite_init(void)
259 if (usbh2_pdata.otg) 266 if (usbh2_pdata.otg)
260 imx31_add_mxc_ehci_hs(2, &usbh2_pdata); 267 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
261 268
269 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
270
262 /* SMSC9117 IRQ pin */ 271 /* SMSC9117 IRQ pin */
263 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); 272 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
264 if (ret) 273 if (ret)
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index e14291d89e4f..6ae51c6b95b7 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -97,7 +97,7 @@ static struct i2c_board_info __initdata i2c_devices_3ds[] = {
97static int lcd_power_gpio = -ENXIO; 97static int lcd_power_gpio = -ENXIO;
98 98
99static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip, 99static int mc9s08dz60_gpiochip_match(struct gpio_chip *chip,
100 void *data) 100 const void *data)
101{ 101{
102 return !strcmp(chip->label, data); 102 return !strcmp(chip->label, data);
103} 103}
diff --git a/arch/arm/mach-imx/mach-mx51_efikamx.c b/arch/arm/mach-imx/mach-mx51_efikamx.c
index 3a5ed2dd885a..586e9f822124 100644
--- a/arch/arm/mach-imx/mach-mx51_efikamx.c
+++ b/arch/arm/mach-imx/mach-mx51_efikamx.c
@@ -33,6 +33,7 @@
33#include <mach/iomux-mx51.h> 33#include <mach/iomux-mx51.h>
34 34
35#include <asm/setup.h> 35#include <asm/setup.h>
36#include <asm/system_info.h>
36#include <asm/mach-types.h> 37#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
38#include <asm/mach/time.h> 39#include <asm/mach/time.h>
diff --git a/arch/arm/mach-imx/mach-mx51_efikasb.c b/arch/arm/mach-imx/mach-mx51_efikasb.c
index ea5f65b0381a..24aded9e109f 100644
--- a/arch/arm/mach-imx/mach-mx51_efikasb.c
+++ b/arch/arm/mach-imx/mach-mx51_efikasb.c
@@ -36,6 +36,7 @@
36#include <mach/iomux-mx51.h> 36#include <mach/iomux-mx51.h>
37 37
38#include <asm/setup.h> 38#include <asm/setup.h>
39#include <asm/system_info.h>
39#include <asm/mach-types.h> 40#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
41#include <asm/mach/time.h> 42#include <asm/mach/time.h>
diff --git a/arch/arm/mach-imx/mach-mx53_ard.c b/arch/arm/mach-imx/mach-mx53_ard.c
index 753f4fc9ec04..05641980dc5e 100644
--- a/arch/arm/mach-imx/mach-mx53_ard.c
+++ b/arch/arm/mach-imx/mach-mx53_ard.c
@@ -23,6 +23,8 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/smsc911x.h> 25#include <linux/smsc911x.h>
26#include <linux/regulator/machine.h>
27#include <linux/regulator/fixed.h>
26 28
27#include <mach/common.h> 29#include <mach/common.h>
28#include <mach/hardware.h> 30#include <mach/hardware.h>
@@ -214,6 +216,11 @@ static int weim_cs_config(void)
214 return 0; 216 return 0;
215} 217}
216 218
219static struct regulator_consumer_supply dummy_supplies[] = {
220 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
221 REGULATOR_SUPPLY("vddvario", "smsc911x"),
222};
223
217void __init imx53_ard_common_init(void) 224void __init imx53_ard_common_init(void)
218{ 225{
219 mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads, 226 mxc_iomux_v3_setup_multiple_pads(mx53_ard_pads,
@@ -232,6 +239,7 @@ static void __init mx53_ard_board_init(void)
232 239
233 imx53_ard_common_init(); 240 imx53_ard_common_init();
234 mx53_ard_io_init(); 241 mx53_ard_io_init();
242 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
235 platform_add_devices(devices, ARRAY_SIZE(devices)); 243 platform_add_devices(devices, ARRAY_SIZE(devices));
236 244
237 imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data); 245 imx53_add_sdhci_esdhc_imx(0, &mx53_ard_sd1_data);
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index f8ca96c354f2..74127389e7ab 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -21,6 +21,7 @@
21#include <linux/err.h> 21#include <linux/err.h>
22 22
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/system_misc.h>
24#include <asm/hardware/cache-l2x0.h> 25#include <asm/hardware/cache-l2x0.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26 27
@@ -61,8 +62,8 @@ static void imx3_idle(void)
61 : "=r" (reg)); 62 : "=r" (reg));
62} 63}
63 64
64static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size, 65static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size,
65 unsigned int mtype) 66 unsigned int mtype, void *caller)
66{ 67{
67 if (mtype == MT_DEVICE) { 68 if (mtype == MT_DEVICE) {
68 /* 69 /*
@@ -75,7 +76,7 @@ static void __iomem *imx3_ioremap(unsigned long phys_addr, size_t size,
75 mtype = MT_DEVICE_NONSHARED; 76 mtype = MT_DEVICE_NONSHARED;
76 } 77 }
77 78
78 return __arm_ioremap(phys_addr, size, mtype); 79 return __arm_ioremap_caller(phys_addr, size, mtype, caller);
79} 80}
80 81
81void __init imx3_init_l2x0(void) 82void __init imx3_init_l2x0(void)
@@ -134,7 +135,7 @@ void __init imx31_init_early(void)
134{ 135{
135 mxc_set_cpu_type(MXC_CPU_MX31); 136 mxc_set_cpu_type(MXC_CPU_MX31);
136 mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR)); 137 mxc_arch_reset_init(MX31_IO_ADDRESS(MX31_WDOG_BASE_ADDR));
137 imx_ioremap = imx3_ioremap; 138 arch_ioremap_caller = imx3_ioremap_caller;
138 arm_pm_idle = imx3_idle; 139 arm_pm_idle = imx3_idle;
139} 140}
140 141
@@ -208,7 +209,7 @@ void __init imx35_init_early(void)
208 mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR)); 209 mxc_iomux_v3_init(MX35_IO_ADDRESS(MX35_IOMUXC_BASE_ADDR));
209 mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR)); 210 mxc_arch_reset_init(MX35_IO_ADDRESS(MX35_WDOG_BASE_ADDR));
210 arm_pm_idle = imx3_idle; 211 arm_pm_idle = imx3_idle;
211 imx_ioremap = imx3_ioremap; 212 arch_ioremap_caller = imx3_ioremap_caller;
212} 213}
213 214
214void __init mx35_init_irq(void) 215void __init mx35_init_irq(void)
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index 51af9fa56944..05250aed61fb 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17 17
18#include <asm/system_misc.h>
18#include <asm/mach/map.h> 19#include <asm/mach/map.h>
19 20
20#include <mach/hardware.h> 21#include <mach/hardware.h>
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 15b87f26ac96..eaf6c6366ffa 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -25,9 +25,9 @@
25 25
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/platform.h> 27#include <mach/platform.h>
28#include <asm/irq.h>
29#include <mach/cm.h> 28#include <mach/cm.h>
30#include <asm/system.h> 29#include <mach/irqs.h>
30
31#include <asm/leds.h> 31#include <asm/leds.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h
index 37beed3fa3ed..8de70de3dd0a 100644
--- a/arch/arm/mach-integrator/include/mach/io.h
+++ b/arch/arm/mach-integrator/include/mach/io.h
@@ -29,6 +29,5 @@
29#define PCI_IO_VADDR 0xee000000 29#define PCI_IO_VADDR 0xee000000
30 30
31#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a))) 31#define __io(a) ((void __iomem *)(PCI_IO_VADDR + (a)))
32#define __mem_pci(a) (a)
33 32
34#endif 33#endif
diff --git a/arch/arm/mach-integrator/include/mach/irqs.h b/arch/arm/mach-integrator/include/mach/irqs.h
index 1fbe6d190222..a19a1a2fcf6b 100644
--- a/arch/arm/mach-integrator/include/mach/irqs.h
+++ b/arch/arm/mach-integrator/include/mach/irqs.h
@@ -78,5 +78,6 @@
78#define IRQ_SIC_CP_LMINT7 46 78#define IRQ_SIC_CP_LMINT7 46
79#define IRQ_SIC_END 46 79#define IRQ_SIC_END 46
80 80
81#define NR_IRQS 47 81#define NR_IRQS_INTEGRATOR_AP 34
82#define NR_IRQS_INTEGRATOR_CP 47
82 83
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 21a1d6cbef40..871f148ffd72 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -38,12 +38,13 @@
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/platform.h> 39#include <mach/platform.h>
40#include <asm/hardware/arm_timer.h> 40#include <asm/hardware/arm_timer.h>
41#include <asm/irq.h>
42#include <asm/setup.h> 41#include <asm/setup.h>
43#include <asm/param.h> /* HZ */ 42#include <asm/param.h> /* HZ */
44#include <asm/mach-types.h> 43#include <asm/mach-types.h>
44#include <asm/sched_clock.h>
45 45
46#include <mach/lm.h> 46#include <mach/lm.h>
47#include <mach/irqs.h>
47 48
48#include <asm/mach/arch.h> 49#include <asm/mach/arch.h>
49#include <asm/mach/irq.h> 50#include <asm/mach/irq.h>
@@ -325,6 +326,11 @@ static void __init ap_init(void)
325 326
326static unsigned long timer_reload; 327static unsigned long timer_reload;
327 328
329static u32 notrace integrator_read_sched_clock(void)
330{
331 return -readl((void __iomem *) TIMER2_VA_BASE + TIMER_VALUE);
332}
333
328static void integrator_clocksource_init(unsigned long inrate) 334static void integrator_clocksource_init(unsigned long inrate)
329{ 335{
330 void __iomem *base = (void __iomem *)TIMER2_VA_BASE; 336 void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
@@ -341,6 +347,7 @@ static void integrator_clocksource_init(unsigned long inrate)
341 347
342 clocksource_mmio_init(base + TIMER_VALUE, "timer2", 348 clocksource_mmio_init(base + TIMER_VALUE, "timer2",
343 rate, 200, 16, clocksource_mmio_readl_down); 349 rate, 200, 16, clocksource_mmio_readl_down);
350 setup_sched_clock(integrator_read_sched_clock, 16, rate);
344} 351}
345 352
346static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; 353static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE;
@@ -468,6 +475,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
468 .atag_offset = 0x100, 475 .atag_offset = 0x100,
469 .reserve = integrator_reserve, 476 .reserve = integrator_reserve,
470 .map_io = ap_map_io, 477 .map_io = ap_map_io,
478 .nr_irqs = NR_IRQS_INTEGRATOR_AP,
471 .init_early = integrator_init_early, 479 .init_early = integrator_init_early,
472 .init_irq = ap_init_irq, 480 .init_irq = ap_init_irq,
473 .timer = &ap_timer, 481 .timer = &ap_timer,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index be9ead4a3bcc..48a115a91d9d 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -26,7 +26,6 @@
26 26
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/platform.h> 28#include <mach/platform.h>
29#include <asm/irq.h>
30#include <asm/setup.h> 29#include <asm/setup.h>
31#include <asm/mach-types.h> 30#include <asm/mach-types.h>
32#include <asm/hardware/arm_timer.h> 31#include <asm/hardware/arm_timer.h>
@@ -34,6 +33,7 @@
34 33
35#include <mach/cm.h> 34#include <mach/cm.h>
36#include <mach/lm.h> 35#include <mach/lm.h>
36#include <mach/irqs.h>
37 37
38#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
39#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
@@ -464,6 +464,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
464 .atag_offset = 0x100, 464 .atag_offset = 0x100,
465 .reserve = integrator_reserve, 465 .reserve = integrator_reserve,
466 .map_io = intcp_map_io, 466 .map_io = intcp_map_io,
467 .nr_irqs = NR_IRQS_INTEGRATOR_CP,
467 .init_early = intcp_init_early, 468 .init_early = intcp_init_early,
468 .init_irq = intcp_init_irq, 469 .init_irq = intcp_init_irq,
469 .timer = &cp_timer, 470 .timer = &cp_timer,
diff --git a/arch/arm/mach-integrator/leds.c b/arch/arm/mach-integrator/leds.c
index 28be186adb89..466defa97842 100644
--- a/arch/arm/mach-integrator/leds.c
+++ b/arch/arm/mach-integrator/leds.c
@@ -29,7 +29,6 @@
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/platform.h> 30#include <mach/platform.h>
31#include <asm/leds.h> 31#include <asm/leds.h>
32#include <asm/system.h>
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
34#include <mach/cm.h> 33#include <mach/cm.h>
35 34
diff --git a/arch/arm/mach-integrator/pci.c b/arch/arm/mach-integrator/pci.c
index 520b6bf81bb1..f1ca9c122861 100644
--- a/arch/arm/mach-integrator/pci.c
+++ b/arch/arm/mach-integrator/pci.c
@@ -26,11 +26,11 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/init.h> 27#include <linux/init.h>
28 28
29#include <asm/irq.h>
30#include <asm/system.h>
31#include <asm/mach/pci.h> 29#include <asm/mach/pci.h>
32#include <asm/mach-types.h> 30#include <asm/mach-types.h>
33 31
32#include <mach/irqs.h>
33
34/* 34/*
35 * A small note about bridges and interrupts. The DECchip 21050 (and 35 * A small note about bridges and interrupts. The DECchip 21050 (and
36 * later) adheres to the PCI-PCI bridge specification. This says that 36 * later) adheres to the PCI-PCI bridge specification. This says that
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 015be770c1d8..67e6f9a9d1a0 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -30,9 +30,9 @@
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/platform.h> 32#include <mach/platform.h>
33#include <asm/irq.h> 33#include <mach/irqs.h>
34
34#include <asm/signal.h> 35#include <asm/signal.h>
35#include <asm/system.h>
36#include <asm/mach/pci.h> 36#include <asm/mach/pci.h>
37#include <asm/irq_regs.h> 37#include <asm/irq_regs.h>
38 38
diff --git a/arch/arm/mach-iop13xx/include/mach/io.h b/arch/arm/mach-iop13xx/include/mach/io.h
index dffb234bb967..f13188518025 100644
--- a/arch/arm/mach-iop13xx/include/mach/io.h
+++ b/arch/arm/mach-iop13xx/include/mach/io.h
@@ -22,20 +22,7 @@
22#define IO_SPACE_LIMIT 0xffffffff 22#define IO_SPACE_LIMIT 0xffffffff
23 23
24#define __io(a) __iop13xx_io(a) 24#define __io(a) __iop13xx_io(a)
25#define __mem_pci(a) (a)
26#define __mem_isa(a) (a)
27 25
28extern void __iomem * __iop13xx_io(unsigned long io_addr); 26extern void __iomem * __iop13xx_io(unsigned long io_addr);
29extern void __iomem *__iop13xx_ioremap(unsigned long cookie, size_t size,
30 unsigned int mtype);
31extern void __iop13xx_iounmap(void __iomem *addr);
32
33extern u32 iop13xx_atue_mem_base;
34extern u32 iop13xx_atux_mem_base;
35extern size_t iop13xx_atue_mem_size;
36extern size_t iop13xx_atux_mem_size;
37
38#define __arch_ioremap __iop13xx_ioremap
39#define __arch_iounmap __iop13xx_iounmap
40 27
41#endif 28#endif
diff --git a/arch/arm/mach-iop13xx/include/mach/iop13xx.h b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
index 07e9ff7adafb..e190dcd7d72d 100644
--- a/arch/arm/mach-iop13xx/include/mach/iop13xx.h
+++ b/arch/arm/mach-iop13xx/include/mach/iop13xx.h
@@ -5,6 +5,7 @@
5/* The ATU offsets can change based on the strapping */ 5/* The ATU offsets can change based on the strapping */
6extern u32 iop13xx_atux_pmmr_offset; 6extern u32 iop13xx_atux_pmmr_offset;
7extern u32 iop13xx_atue_pmmr_offset; 7extern u32 iop13xx_atue_pmmr_offset;
8void iop13xx_init_early(void);
8void iop13xx_init_irq(void); 9void iop13xx_init_irq(void);
9void iop13xx_map_io(void); 10void iop13xx_map_io(void);
10void iop13xx_platform_init(void); 11void iop13xx_platform_init(void);
diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c
index 48642e66c566..3c364198db9c 100644
--- a/arch/arm/mach-iop13xx/io.c
+++ b/arch/arm/mach-iop13xx/io.c
@@ -21,6 +21,8 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <mach/hardware.h> 22#include <mach/hardware.h>
23 23
24#include "pci.h"
25
24void * __iomem __iop13xx_io(unsigned long io_addr) 26void * __iomem __iop13xx_io(unsigned long io_addr)
25{ 27{
26 void __iomem * io_virt; 28 void __iomem * io_virt;
@@ -40,8 +42,8 @@ void * __iomem __iop13xx_io(unsigned long io_addr)
40} 42}
41EXPORT_SYMBOL(__iop13xx_io); 43EXPORT_SYMBOL(__iop13xx_io);
42 44
43void * __iomem __iop13xx_ioremap(unsigned long cookie, size_t size, 45static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie,
44 unsigned int mtype) 46 size_t size, unsigned int mtype, void *caller)
45{ 47{
46 void __iomem * retval; 48 void __iomem * retval;
47 49
@@ -76,17 +78,14 @@ void * __iomem __iop13xx_ioremap(unsigned long cookie, size_t size,
76 break; 78 break;
77 default: 79 default:
78 retval = __arm_ioremap_caller(cookie, size, mtype, 80 retval = __arm_ioremap_caller(cookie, size, mtype,
79 __builtin_return_address(0)); 81 caller);
80 } 82 }
81 83
82 return retval; 84 return retval;
83} 85}
84EXPORT_SYMBOL(__iop13xx_ioremap);
85 86
86void __iop13xx_iounmap(void __iomem *addr) 87static void __iop13xx_iounmap(volatile void __iomem *addr)
87{ 88{
88 extern void __iounmap(volatile void __iomem *addr);
89
90 if (iop13xx_atue_mem_base) 89 if (iop13xx_atue_mem_base)
91 if (addr >= (void __iomem *) iop13xx_atue_mem_base && 90 if (addr >= (void __iomem *) iop13xx_atue_mem_base &&
92 addr < (void __iomem *) (iop13xx_atue_mem_base + 91 addr < (void __iomem *) (iop13xx_atue_mem_base +
@@ -110,4 +109,9 @@ void __iop13xx_iounmap(void __iomem *addr)
110skip: 109skip:
111 return; 110 return;
112} 111}
113EXPORT_SYMBOL(__iop13xx_iounmap); 112
113void __init iop13xx_init_early(void)
114{
115 arch_ioremap_caller = __iop13xx_ioremap_caller;
116 arch_iounmap = __iop13xx_iounmap;
117}
diff --git a/arch/arm/mach-iop13xx/iq81340mc.c b/arch/arm/mach-iop13xx/iq81340mc.c
index abaee8833588..5c96b73e6964 100644
--- a/arch/arm/mach-iop13xx/iq81340mc.c
+++ b/arch/arm/mach-iop13xx/iq81340mc.c
@@ -92,6 +92,7 @@ static struct sys_timer iq81340mc_timer = {
92MACHINE_START(IQ81340MC, "Intel IQ81340MC") 92MACHINE_START(IQ81340MC, "Intel IQ81340MC")
93 /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ 93 /* Maintainer: Dan Williams <dan.j.williams@intel.com> */
94 .atag_offset = 0x100, 94 .atag_offset = 0x100,
95 .init_early = iop13xx_init_early,
95 .map_io = iop13xx_map_io, 96 .map_io = iop13xx_map_io,
96 .init_irq = iop13xx_init_irq, 97 .init_irq = iop13xx_init_irq,
97 .timer = &iq81340mc_timer, 98 .timer = &iq81340mc_timer,
diff --git a/arch/arm/mach-iop13xx/iq81340sc.c b/arch/arm/mach-iop13xx/iq81340sc.c
index 690916a09dc6..aa4dd750135a 100644
--- a/arch/arm/mach-iop13xx/iq81340sc.c
+++ b/arch/arm/mach-iop13xx/iq81340sc.c
@@ -94,6 +94,7 @@ static struct sys_timer iq81340sc_timer = {
94MACHINE_START(IQ81340SC, "Intel IQ81340SC") 94MACHINE_START(IQ81340SC, "Intel IQ81340SC")
95 /* Maintainer: Dan Williams <dan.j.williams@intel.com> */ 95 /* Maintainer: Dan Williams <dan.j.williams@intel.com> */
96 .atag_offset = 0x100, 96 .atag_offset = 0x100,
97 .init_early = iop13xx_init_early,
97 .map_io = iop13xx_map_io, 98 .map_io = iop13xx_map_io,
98 .init_irq = iop13xx_init_irq, 99 .init_irq = iop13xx_init_irq,
99 .timer = &iq81340sc_timer, 100 .timer = &iq81340sc_timer,
diff --git a/arch/arm/mach-iop13xx/pci.h b/arch/arm/mach-iop13xx/pci.h
new file mode 100644
index 000000000000..c70cf5b41e31
--- /dev/null
+++ b/arch/arm/mach-iop13xx/pci.h
@@ -0,0 +1,6 @@
1#include <linux/types.h>
2
3extern u32 iop13xx_atue_mem_base;
4extern u32 iop13xx_atux_mem_base;
5extern size_t iop13xx_atue_mem_size;
6extern size_t iop13xx_atux_mem_size;
diff --git a/arch/arm/mach-iop32x/include/mach/io.h b/arch/arm/mach-iop32x/include/mach/io.h
index 2d88264b9863..e2ada265bb8d 100644
--- a/arch/arm/mach-iop32x/include/mach/io.h
+++ b/arch/arm/mach-iop32x/include/mach/io.h
@@ -15,6 +15,5 @@
15 15
16#define IO_SPACE_LIMIT 0xffffffff 16#define IO_SPACE_LIMIT 0xffffffff
17#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) 17#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
18#define __mem_pci(a) (a)
19 18
20#endif 19#endif
diff --git a/arch/arm/mach-iop33x/include/mach/io.h b/arch/arm/mach-iop33x/include/mach/io.h
index a8a66fc8fbdb..f7c1b6595660 100644
--- a/arch/arm/mach-iop33x/include/mach/io.h
+++ b/arch/arm/mach-iop33x/include/mach/io.h
@@ -15,6 +15,5 @@
15 15
16#define IO_SPACE_LIMIT 0xffffffff 16#define IO_SPACE_LIMIT 0xffffffff
17#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p)) 17#define __io(p) ((void __iomem *)IOP3XX_PCI_IO_PHYS_TO_VIRT(p))
18#define __mem_pci(a) (a)
19 18
20#endif 19#endif
diff --git a/arch/arm/mach-iop33x/uart.c b/arch/arm/mach-iop33x/uart.c
index cdae24e46eea..bbf54d794ce8 100644
--- a/arch/arm/mach-iop33x/uart.c
+++ b/arch/arm/mach-iop33x/uart.c
@@ -22,7 +22,6 @@
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25#include <asm/system.h>
26#include <asm/memory.h> 25#include <asm/memory.h>
27#include <mach/hardware.h> 26#include <mach/hardware.h>
28#include <asm/hardware/iop3xx.h> 27#include <asm/hardware/iop3xx.h>
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 81c45370a4e6..f214cdff01cb 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -32,7 +32,6 @@
32#include <asm/memory.h> 32#include <asm/memory.h>
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/system.h>
36#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
37#include <asm/pgtable.h> 36#include <asm/pgtable.h>
38 37
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index e872d238cd0f..4867f408617c 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -36,7 +36,6 @@
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/pgtable.h> 37#include <asm/pgtable.h>
38#include <asm/page.h> 38#include <asm/page.h>
39#include <asm/system.h>
40#include <mach/hardware.h> 39#include <mach/hardware.h>
41#include <asm/mach-types.h> 40#include <asm/mach-types.h>
42 41
diff --git a/arch/arm/mach-ixp2000/include/mach/io.h b/arch/arm/mach-ixp2000/include/mach/io.h
index 859e584914d9..f6552d6f35ab 100644
--- a/arch/arm/mach-ixp2000/include/mach/io.h
+++ b/arch/arm/mach-ixp2000/include/mach/io.h
@@ -18,7 +18,6 @@
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
20#define IO_SPACE_LIMIT 0xffffffff 20#define IO_SPACE_LIMIT 0xffffffff
21#define __mem_pci(a) (a)
22 21
23/* 22/*
24 * The A? revisions of the IXP2000s assert byte lanes for PCI I/O 23 * The A? revisions of the IXP2000s assert byte lanes for PCI I/O
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index d519944653ad..915ad49e3b8f 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -29,7 +29,6 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/pgtable.h> 30#include <asm/pgtable.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/system.h>
33#include <mach/hardware.h> 32#include <mach/hardware.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35 34
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index b415febd2025..a9f1819ea049 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -29,7 +29,6 @@
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/pgtable.h> 30#include <asm/pgtable.h>
31#include <asm/page.h> 31#include <asm/page.h>
32#include <asm/system.h>
33#include <mach/hardware.h> 32#include <mach/hardware.h>
34#include <asm/mach-types.h> 33#include <asm/mach-types.h>
35 34
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index dd9838299068..421e38dc0fac 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -30,7 +30,6 @@
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/pgtable.h> 31#include <asm/pgtable.h>
32#include <asm/page.h> 32#include <asm/page.h>
33#include <asm/system.h>
34#include <mach/hardware.h> 33#include <mach/hardware.h>
35#include <asm/mach-types.h> 34#include <asm/mach-types.h>
36 35
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index 7632beadabf6..5196c39cdba4 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -34,7 +34,6 @@
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/page.h> 36#include <asm/page.h>
37#include <asm/system.h>
38#include <mach/hardware.h> 37#include <mach/hardware.h>
39#include <asm/mach-types.h> 38#include <asm/mach-types.h>
40 39
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
index 49c36f3cd602..9c02de932fac 100644
--- a/arch/arm/mach-ixp2000/pci.c
+++ b/arch/arm/mach-ixp2000/pci.c
@@ -26,7 +26,6 @@
26#include <linux/io.h> 26#include <linux/io.h>
27 27
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/system.h>
30#include <mach/hardware.h> 29#include <mach/hardware.h>
31 30
32#include <asm/mach/pci.h> 31#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
index 7c1495e4fe7a..d34542425990 100644
--- a/arch/arm/mach-ixp23xx/core.c
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -34,9 +34,9 @@
34#include <asm/memory.h> 34#include <asm/memory.h>
35#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/system.h>
38#include <asm/tlbflush.h> 37#include <asm/tlbflush.h>
39#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/system_misc.h>
40 40
41#include <asm/mach/map.h> 41#include <asm/mach/map.h>
42#include <asm/mach/time.h> 42#include <asm/mach/time.h>
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
index 8f2487e1fc4e..d142d45dea12 100644
--- a/arch/arm/mach-ixp23xx/espresso.c
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -32,7 +32,6 @@
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/irq.h> 34#include <asm/irq.h>
35#include <asm/system.h>
36#include <asm/tlbflush.h> 35#include <asm/tlbflush.h>
37#include <asm/pgtable.h> 36#include <asm/pgtable.h>
38 37
diff --git a/arch/arm/mach-ixp23xx/include/mach/io.h b/arch/arm/mach-ixp23xx/include/mach/io.h
index 4ce4353b9f72..a7aceb55c130 100644
--- a/arch/arm/mach-ixp23xx/include/mach/io.h
+++ b/arch/arm/mach-ixp23xx/include/mach/io.h
@@ -18,6 +18,5 @@
18#define IO_SPACE_LIMIT 0xffffffff 18#define IO_SPACE_LIMIT 0xffffffff
19 19
20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT)) 20#define __io(p) ((void __iomem*)((p) + IXP23XX_PCI_IO_VIRT))
21#define __mem_pci(a) (a)
22 21
23#endif 22#endif
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
index 5d5dd3e8d069..b0e07db5ceaf 100644
--- a/arch/arm/mach-ixp23xx/ixdp2351.c
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -36,7 +36,6 @@
36#include <asm/memory.h> 36#include <asm/memory.h>
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <asm/mach-types.h> 38#include <asm/mach-types.h>
39#include <asm/system.h>
40#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
41#include <asm/pgtable.h> 40#include <asm/pgtable.h>
42 41
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
index 3cbbd3208fa8..911f5a58e006 100644
--- a/arch/arm/mach-ixp23xx/pci.c
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -28,7 +28,6 @@
28 28
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/sizes.h> 30#include <asm/sizes.h>
31#include <asm/system.h>
32#include <asm/mach/pci.h> 31#include <asm/mach/pci.h>
33#include <mach/hardware.h> 32#include <mach/hardware.h>
34 33
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
index 377283fc658c..eaaa3fa9fd05 100644
--- a/arch/arm/mach-ixp23xx/roadrunner.c
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -36,7 +36,6 @@
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <asm/mach-types.h> 37#include <asm/mach-types.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/system.h>
40#include <asm/tlbflush.h> 39#include <asm/tlbflush.h>
41#include <asm/pgtable.h> 40#include <asm/pgtable.h>
42 41
diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c
index a7277ad470a5..90e42e9982cb 100644
--- a/arch/arm/mach-ixp4xx/avila-setup.c
+++ b/arch/arm/mach-ixp4xx/avila-setup.c
@@ -165,6 +165,7 @@ static void __init avila_init(void)
165MACHINE_START(AVILA, "Gateworks Avila Network Platform") 165MACHINE_START(AVILA, "Gateworks Avila Network Platform")
166 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ 166 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
167 .map_io = ixp4xx_map_io, 167 .map_io = ixp4xx_map_io,
168 .init_early = ixp4xx_init_early,
168 .init_irq = ixp4xx_init_irq, 169 .init_irq = ixp4xx_init_irq,
169 .timer = &ixp4xx_timer, 170 .timer = &ixp4xx_timer,
170 .atag_offset = 0x100, 171 .atag_offset = 0x100,
@@ -184,6 +185,7 @@ MACHINE_END
184MACHINE_START(LOFT, "Giant Shoulder Inc Loft board") 185MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
185 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */ 186 /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
186 .map_io = ixp4xx_map_io, 187 .map_io = ixp4xx_map_io,
188 .init_early = ixp4xx_init_early,
187 .init_irq = ixp4xx_init_irq, 189 .init_irq = ixp4xx_init_irq,
188 .timer = &ixp4xx_timer, 190 .timer = &ixp4xx_timer,
189 .atag_offset = 0x100, 191 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 8508882b13f0..d5719eb42591 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -32,7 +32,6 @@
32#include <asm/cputype.h> 32#include <asm/cputype.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/sizes.h> 34#include <asm/sizes.h>
35#include <asm/system.h>
36#include <asm/mach/pci.h> 35#include <asm/mach/pci.h>
37#include <mach/hardware.h> 36#include <mach/hardware.h>
38 37
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index a6329a0a8ec4..ebbd7fc90eb4 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -31,11 +31,13 @@
31 31
32#include <mach/udc.h> 32#include <mach/udc.h>
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <mach/io.h>
34#include <asm/uaccess.h> 35#include <asm/uaccess.h>
35#include <asm/pgtable.h> 36#include <asm/pgtable.h>
36#include <asm/page.h> 37#include <asm/page.h>
37#include <asm/irq.h> 38#include <asm/irq.h>
38#include <asm/sched_clock.h> 39#include <asm/sched_clock.h>
40#include <asm/system_misc.h>
39 41
40#include <asm/mach/map.h> 42#include <asm/mach/map.h>
41#include <asm/mach/irq.h> 43#include <asm/mach/irq.h>
@@ -517,3 +519,35 @@ void ixp4xx_restart(char mode, const char *cmd)
517 *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE; 519 *IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE;
518 } 520 }
519} 521}
522
523#ifdef CONFIG_IXP4XX_INDIRECT_PCI
524/*
525 * In the case of using indirect PCI, we simply return the actual PCI
526 * address and our read/write implementation use that to drive the
527 * access registers. If something outside of PCI is ioremap'd, we
528 * fallback to the default.
529 */
530
531static void __iomem *ixp4xx_ioremap_caller(unsigned long addr, size_t size,
532 unsigned int mtype, void *caller)
533{
534 if (!is_pci_memory(addr))
535 return __arm_ioremap_caller(addr, size, mtype, caller);
536
537 return (void __iomem *)addr;
538}
539
540static void ixp4xx_iounmap(void __iomem *addr)
541{
542 if (!is_pci_memory((__force u32)addr))
543 __iounmap(addr);
544}
545
546void __init ixp4xx_init_early(void)
547{
548 arch_ioremap_caller = ixp4xx_ioremap_caller;
549 arch_iounmap = ixp4xx_iounmap;
550}
551#else
552void __init ixp4xx_init_early(void) {}
553#endif
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index a74f86ce8bcc..1b83110028d6 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -110,6 +110,7 @@ static void __init coyote_init(void)
110MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") 110MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
111 /* Maintainer: MontaVista Software, Inc. */ 111 /* Maintainer: MontaVista Software, Inc. */
112 .map_io = ixp4xx_map_io, 112 .map_io = ixp4xx_map_io,
113 .init_early = ixp4xx_init_early,
113 .init_irq = ixp4xx_init_irq, 114 .init_irq = ixp4xx_init_irq,
114 .timer = &ixp4xx_timer, 115 .timer = &ixp4xx_timer,
115 .atag_offset = 0x100, 116 .atag_offset = 0x100,
@@ -129,6 +130,7 @@ MACHINE_END
129MACHINE_START(IXDPG425, "Intel IXDPG425") 130MACHINE_START(IXDPG425, "Intel IXDPG425")
130 /* Maintainer: MontaVista Software, Inc. */ 131 /* Maintainer: MontaVista Software, Inc. */
131 .map_io = ixp4xx_map_io, 132 .map_io = ixp4xx_map_io,
133 .init_early = ixp4xx_init_early,
132 .init_irq = ixp4xx_init_irq, 134 .init_irq = ixp4xx_init_irq,
133 .timer = &ixp4xx_timer, 135 .timer = &ixp4xx_timer,
134 .atag_offset = 0x100, 136 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 67be177b336a..97a0af8f1955 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -280,6 +280,7 @@ MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")
280 /* Maintainer: www.nslu2-linux.org */ 280 /* Maintainer: www.nslu2-linux.org */
281 .atag_offset = 0x100, 281 .atag_offset = 0x100,
282 .map_io = ixp4xx_map_io, 282 .map_io = ixp4xx_map_io,
283 .init_early = ixp4xx_init_early,
283 .init_irq = ixp4xx_init_irq, 284 .init_irq = ixp4xx_init_irq,
284 .timer = &dsmg600_timer, 285 .timer = &dsmg600_timer,
285 .init_machine = dsmg600_init, 286 .init_machine = dsmg600_init,
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 6d5818285af8..9175a25a7511 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -270,6 +270,7 @@ static void __init fsg_init(void)
270MACHINE_START(FSG, "Freecom FSG-3") 270MACHINE_START(FSG, "Freecom FSG-3")
271 /* Maintainer: www.nslu2-linux.org */ 271 /* Maintainer: www.nslu2-linux.org */
272 .map_io = ixp4xx_map_io, 272 .map_io = ixp4xx_map_io,
273 .init_early = ixp4xx_init_early,
273 .init_irq = ixp4xx_init_irq, 274 .init_irq = ixp4xx_init_irq,
274 .timer = &ixp4xx_timer, 275 .timer = &ixp4xx_timer,
275 .atag_offset = 0x100, 276 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c
index 7ecf9b28f1c0..033c71758953 100644
--- a/arch/arm/mach-ixp4xx/gateway7001-setup.c
+++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c
@@ -97,6 +97,7 @@ static void __init gateway7001_init(void)
97MACHINE_START(GATEWAY7001, "Gateway 7001 AP") 97MACHINE_START(GATEWAY7001, "Gateway 7001 AP")
98 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ 98 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
99 .map_io = ixp4xx_map_io, 99 .map_io = ixp4xx_map_io,
100 .init_early = ixp4xx_init_early,
100 .init_irq = ixp4xx_init_irq, 101 .init_irq = ixp4xx_init_irq,
101 .timer = &ixp4xx_timer, 102 .timer = &ixp4xx_timer,
102 .atag_offset = 0x100, 103 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index c0e3d69a8aec..46bb924962ee 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -12,7 +12,6 @@
12#include <linux/pci.h> 12#include <linux/pci.h>
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <asm/mach-types.h> 14#include <asm/mach-types.h>
15#include <asm/system.h>
16#include <asm/mach/arch.h> 15#include <asm/mach/arch.h>
17#include <asm/mach/flash.h> 16#include <asm/mach/flash.h>
18#include <asm/mach/pci.h> 17#include <asm/mach/pci.h>
@@ -497,6 +496,7 @@ subsys_initcall(gmlr_pci_init);
497MACHINE_START(GORAMO_MLR, "MultiLink") 496MACHINE_START(GORAMO_MLR, "MultiLink")
498 /* Maintainer: Krzysztof Halasa */ 497 /* Maintainer: Krzysztof Halasa */
499 .map_io = ixp4xx_map_io, 498 .map_io = ixp4xx_map_io,
499 .init_early = ixp4xx_init_early,
500 .init_irq = ixp4xx_init_irq, 500 .init_irq = ixp4xx_init_irq,
501 .timer = &ixp4xx_timer, 501 .timer = &ixp4xx_timer,
502 .atag_offset = 0x100, 502 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index a23f89391458..18ebc6be7969 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -165,6 +165,7 @@ static void __init gtwx5715_init(void)
165MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") 165MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
166 /* Maintainer: George Joseph */ 166 /* Maintainer: George Joseph */
167 .map_io = ixp4xx_map_io, 167 .map_io = ixp4xx_map_io,
168 .init_early = ixp4xx_init_early,
168 .init_irq = ixp4xx_init_irq, 169 .init_irq = ixp4xx_init_irq,
169 .timer = &ixp4xx_timer, 170 .timer = &ixp4xx_timer,
170 .atag_offset = 0x100, 171 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h
index c30e7e923a73..034bb2a1b805 100644
--- a/arch/arm/mach-ixp4xx/include/mach/hardware.h
+++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h
@@ -23,8 +23,6 @@
23#define PCIBIOS_MAX_MEM 0x4BFFFFFF 23#define PCIBIOS_MAX_MEM 0x4BFFFFFF
24#endif 24#endif
25 25
26#define ARCH_HAS_DMA_SET_COHERENT_MASK
27
28/* Register locations and bits */ 26/* Register locations and bits */
29#include "ixp4xx-regs.h" 27#include "ixp4xx-regs.h"
30 28
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index ffb9d6afb89f..5cf30d1b78d2 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -39,11 +39,7 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
39 * but in some cases the performance hit is acceptable. In addition, you 39 * but in some cases the performance hit is acceptable. In addition, you
40 * cannot mmap() PCI devices in this case. 40 * cannot mmap() PCI devices in this case.
41 */ 41 */
42#ifndef CONFIG_IXP4XX_INDIRECT_PCI 42#ifdef CONFIG_IXP4XX_INDIRECT_PCI
43
44#define __mem_pci(a) (a)
45
46#else
47 43
48/* 44/*
49 * In the case of using indirect PCI, we simply return the actual PCI 45 * In the case of using indirect PCI, we simply return the actual PCI
@@ -57,24 +53,6 @@ static inline int is_pci_memory(u32 addr)
57 return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF); 53 return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF);
58} 54}
59 55
60static inline void __iomem * __indirect_ioremap(unsigned long addr, size_t size,
61 unsigned int mtype)
62{
63 if (!is_pci_memory(addr))
64 return __arm_ioremap(addr, size, mtype);
65
66 return (void __iomem *)addr;
67}
68
69static inline void __indirect_iounmap(void __iomem *addr)
70{
71 if (!is_pci_memory((__force u32)addr))
72 __iounmap(addr);
73}
74
75#define __arch_ioremap __indirect_ioremap
76#define __arch_iounmap __indirect_iounmap
77
78#define writeb(v, p) __indirect_writeb(v, p) 56#define writeb(v, p) __indirect_writeb(v, p)
79#define writew(v, p) __indirect_writew(v, p) 57#define writew(v, p) __indirect_writew(v, p)
80#define writel(v, p) __indirect_writel(v, p) 58#define writel(v, p) __indirect_writel(v, p)
diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h
index df9250bbf13d..b66bedc64de1 100644
--- a/arch/arm/mach-ixp4xx/include/mach/platform.h
+++ b/arch/arm/mach-ixp4xx/include/mach/platform.h
@@ -121,6 +121,7 @@ extern unsigned long ixp4xx_timer_freq;
121 * Functions used by platform-level setup code 121 * Functions used by platform-level setup code
122 */ 122 */
123extern void ixp4xx_map_io(void); 123extern void ixp4xx_map_io(void);
124extern void ixp4xx_init_early(void);
124extern void ixp4xx_init_irq(void); 125extern void ixp4xx_init_irq(void);
125extern void ixp4xx_sys_init(void); 126extern void ixp4xx_sys_init(void);
126extern void ixp4xx_timer_init(void); 127extern void ixp4xx_timer_init(void);
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 8a38b39999f8..3d742aee1773 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -254,6 +254,7 @@ static void __init ixdp425_init(void)
254MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") 254MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
255 /* Maintainer: MontaVista Software, Inc. */ 255 /* Maintainer: MontaVista Software, Inc. */
256 .map_io = ixp4xx_map_io, 256 .map_io = ixp4xx_map_io,
257 .init_early = ixp4xx_init_early,
257 .init_irq = ixp4xx_init_irq, 258 .init_irq = ixp4xx_init_irq,
258 .timer = &ixp4xx_timer, 259 .timer = &ixp4xx_timer,
259 .atag_offset = 0x100, 260 .atag_offset = 0x100,
@@ -269,6 +270,7 @@ MACHINE_END
269MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") 270MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
270 /* Maintainer: MontaVista Software, Inc. */ 271 /* Maintainer: MontaVista Software, Inc. */
271 .map_io = ixp4xx_map_io, 272 .map_io = ixp4xx_map_io,
273 .init_early = ixp4xx_init_early,
272 .init_irq = ixp4xx_init_irq, 274 .init_irq = ixp4xx_init_irq,
273 .timer = &ixp4xx_timer, 275 .timer = &ixp4xx_timer,
274 .atag_offset = 0x100, 276 .atag_offset = 0x100,
@@ -283,6 +285,7 @@ MACHINE_END
283MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") 285MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
284 /* Maintainer: MontaVista Software, Inc. */ 286 /* Maintainer: MontaVista Software, Inc. */
285 .map_io = ixp4xx_map_io, 287 .map_io = ixp4xx_map_io,
288 .init_early = ixp4xx_init_early,
286 .init_irq = ixp4xx_init_irq, 289 .init_irq = ixp4xx_init_irq,
287 .timer = &ixp4xx_timer, 290 .timer = &ixp4xx_timer,
288 .atag_offset = 0x100, 291 .atag_offset = 0x100,
@@ -297,6 +300,7 @@ MACHINE_END
297MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform") 300MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")
298 /* Maintainer: MontaVista Software, Inc. */ 301 /* Maintainer: MontaVista Software, Inc. */
299 .map_io = ixp4xx_map_io, 302 .map_io = ixp4xx_map_io,
303 .init_early = ixp4xx_init_early,
300 .init_irq = ixp4xx_init_irq, 304 .init_irq = ixp4xx_init_irq,
301 .timer = &ixp4xx_timer, 305 .timer = &ixp4xx_timer,
302 .atag_offset = 0x100, 306 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 1010eb7b0083..33cb0955b6bf 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -315,6 +315,7 @@ MACHINE_START(NAS100D, "Iomega NAS 100d")
315 /* Maintainer: www.nslu2-linux.org */ 315 /* Maintainer: www.nslu2-linux.org */
316 .atag_offset = 0x100, 316 .atag_offset = 0x100,
317 .map_io = ixp4xx_map_io, 317 .map_io = ixp4xx_map_io,
318 .init_early = ixp4xx_init_early,
318 .init_irq = ixp4xx_init_irq, 319 .init_irq = ixp4xx_init_irq,
319 .timer = &ixp4xx_timer, 320 .timer = &ixp4xx_timer,
320 .init_machine = nas100d_init, 321 .init_machine = nas100d_init,
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index aa355c360d57..e2903faaebb3 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -301,6 +301,7 @@ MACHINE_START(NSLU2, "Linksys NSLU2")
301 /* Maintainer: www.nslu2-linux.org */ 301 /* Maintainer: www.nslu2-linux.org */
302 .atag_offset = 0x100, 302 .atag_offset = 0x100,
303 .map_io = ixp4xx_map_io, 303 .map_io = ixp4xx_map_io,
304 .init_early = ixp4xx_init_early,
304 .init_irq = ixp4xx_init_irq, 305 .init_irq = ixp4xx_init_irq,
305 .timer = &nslu2_timer, 306 .timer = &nslu2_timer,
306 .init_machine = nslu2_init, 307 .init_machine = nslu2_init,
diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c
index 0940869fcfdd..158ddb79821d 100644
--- a/arch/arm/mach-ixp4xx/omixp-setup.c
+++ b/arch/arm/mach-ixp4xx/omixp-setup.c
@@ -243,6 +243,7 @@ static void __init omixp_init(void)
243MACHINE_START(DEVIXP, "Omicron DEVIXP") 243MACHINE_START(DEVIXP, "Omicron DEVIXP")
244 .atag_offset = 0x100, 244 .atag_offset = 0x100,
245 .map_io = ixp4xx_map_io, 245 .map_io = ixp4xx_map_io,
246 .init_early = ixp4xx_init_early,
246 .init_irq = ixp4xx_init_irq, 247 .init_irq = ixp4xx_init_irq,
247 .timer = &ixp4xx_timer, 248 .timer = &ixp4xx_timer,
248 .init_machine = omixp_init, 249 .init_machine = omixp_init,
@@ -254,6 +255,7 @@ MACHINE_END
254MACHINE_START(MICCPT, "Omicron MICCPT") 255MACHINE_START(MICCPT, "Omicron MICCPT")
255 .atag_offset = 0x100, 256 .atag_offset = 0x100,
256 .map_io = ixp4xx_map_io, 257 .map_io = ixp4xx_map_io,
258 .init_early = ixp4xx_init_early,
257 .init_irq = ixp4xx_init_irq, 259 .init_irq = ixp4xx_init_irq,
258 .timer = &ixp4xx_timer, 260 .timer = &ixp4xx_timer,
259 .init_machine = omixp_init, 261 .init_machine = omixp_init,
@@ -268,6 +270,7 @@ MACHINE_END
268MACHINE_START(MIC256, "Omicron MIC256") 270MACHINE_START(MIC256, "Omicron MIC256")
269 .atag_offset = 0x100, 271 .atag_offset = 0x100,
270 .map_io = ixp4xx_map_io, 272 .map_io = ixp4xx_map_io,
273 .init_early = ixp4xx_init_early,
271 .init_irq = ixp4xx_init_irq, 274 .init_irq = ixp4xx_init_irq,
272 .timer = &ixp4xx_timer, 275 .timer = &ixp4xx_timer,
273 .init_machine = omixp_init, 276 .init_machine = omixp_init,
diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c
index 9dec20683291..2798f435aaf4 100644
--- a/arch/arm/mach-ixp4xx/vulcan-setup.c
+++ b/arch/arm/mach-ixp4xx/vulcan-setup.c
@@ -237,6 +237,7 @@ static void __init vulcan_init(void)
237MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan") 237MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan")
238 /* Maintainer: Marc Zyngier <maz@misterjones.org> */ 238 /* Maintainer: Marc Zyngier <maz@misterjones.org> */
239 .map_io = ixp4xx_map_io, 239 .map_io = ixp4xx_map_io,
240 .init_early = ixp4xx_init_early,
240 .init_irq = ixp4xx_init_irq, 241 .init_irq = ixp4xx_init_irq,
241 .timer = &ixp4xx_timer, 242 .timer = &ixp4xx_timer,
242 .atag_offset = 0x100, 243 .atag_offset = 0x100,
diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c
index 5ac0f0a0fd8c..a785175b115b 100644
--- a/arch/arm/mach-ixp4xx/wg302v2-setup.c
+++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c
@@ -98,6 +98,7 @@ static void __init wg302v2_init(void)
98MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2") 98MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")
99 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */ 99 /* Maintainer: Imre Kaloz <kaloz@openwrt.org> */
100 .map_io = ixp4xx_map_io, 100 .map_io = ixp4xx_map_io,
101 .init_early = ixp4xx_init_early,
101 .init_irq = ixp4xx_init_irq, 102 .init_irq = ixp4xx_init_irq,
102 .timer = &ixp4xx_timer, 103 .timer = &ixp4xx_timer,
103 .atag_offset = 0x100, 104 .atag_offset = 0x100,
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index acbc5e1db06f..e299a9576bf0 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_MACH_T5325) += t5325-setup.o
21 21
22obj-$(CONFIG_CPU_IDLE) += cpuidle.o 22obj-$(CONFIG_CPU_IDLE) += cpuidle.o
23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o 23obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
24obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o
diff --git a/arch/arm/mach-kirkwood/board-dreamplug.c b/arch/arm/mach-kirkwood/board-dreamplug.c
new file mode 100644
index 000000000000..985453994dd3
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dreamplug.c
@@ -0,0 +1,152 @@
1/*
2 * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net>
3 *
4 * arch/arm/mach-kirkwood/board-dreamplug.c
5 *
6 * Marvell DreamPlug Reference Board Init for drivers not converted to
7 * flattened device tree yet.
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/mtd/partitions.h>
18#include <linux/ata_platform.h>
19#include <linux/mv643xx_eth.h>
20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/of_fdt.h>
23#include <linux/of_irq.h>
24#include <linux/of_platform.h>
25#include <linux/gpio.h>
26#include <linux/leds.h>
27#include <linux/mtd/physmap.h>
28#include <linux/spi/flash.h>
29#include <linux/spi/spi.h>
30#include <linux/spi/orion_spi.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34#include <mach/kirkwood.h>
35#include <mach/bridge-regs.h>
36#include <plat/mvsdio.h>
37#include "common.h"
38#include "mpp.h"
39
40struct mtd_partition dreamplug_partitions[] = {
41 {
42 .name = "u-boot",
43 .size = SZ_512K,
44 .offset = 0,
45 },
46 {
47 .name = "u-boot env",
48 .size = SZ_64K,
49 .offset = SZ_512K + SZ_512K,
50 },
51 {
52 .name = "dtb",
53 .size = SZ_64K,
54 .offset = SZ_512K + SZ_512K + SZ_512K,
55 },
56};
57
58static const struct flash_platform_data dreamplug_spi_slave_data = {
59 .type = "mx25l1606e",
60 .name = "spi_flash",
61 .parts = dreamplug_partitions,
62 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
63};
64
65static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
66 {
67 .modalias = "m25p80",
68 .platform_data = &dreamplug_spi_slave_data,
69 .irq = -1,
70 .max_speed_hz = 50000000,
71 .bus_num = 0,
72 .chip_select = 0,
73 },
74};
75
76static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
77 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
78};
79
80static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
81 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
82};
83
84static struct mv_sata_platform_data dreamplug_sata_data = {
85 .n_ports = 1,
86};
87
88static struct mvsdio_platform_data dreamplug_mvsdio_data = {
89 /* unfortunately the CD signal has not been connected */
90};
91
92static struct gpio_led dreamplug_led_pins[] = {
93 {
94 .name = "dreamplug:blue:bluetooth",
95 .gpio = 47,
96 .active_low = 1,
97 },
98 {
99 .name = "dreamplug:green:wifi",
100 .gpio = 48,
101 .active_low = 1,
102 },
103 {
104 .name = "dreamplug:green:wifi_ap",
105 .gpio = 49,
106 .active_low = 1,
107 },
108};
109
110static struct gpio_led_platform_data dreamplug_led_data = {
111 .leds = dreamplug_led_pins,
112 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
113};
114
115static struct platform_device dreamplug_leds = {
116 .name = "leds-gpio",
117 .id = -1,
118 .dev = {
119 .platform_data = &dreamplug_led_data,
120 }
121};
122
123static unsigned int dreamplug_mpp_config[] __initdata = {
124 MPP0_SPI_SCn,
125 MPP1_SPI_MOSI,
126 MPP2_SPI_SCK,
127 MPP3_SPI_MISO,
128 MPP47_GPIO, /* Bluetooth LED */
129 MPP48_GPIO, /* Wifi LED */
130 MPP49_GPIO, /* Wifi AP LED */
131 0
132};
133
134void __init dreamplug_init(void)
135{
136 /*
137 * Basic setup. Needs to be called early.
138 */
139 kirkwood_mpp_conf(dreamplug_mpp_config);
140
141 spi_register_board_info(dreamplug_spi_slave_info,
142 ARRAY_SIZE(dreamplug_spi_slave_info));
143 kirkwood_spi_init();
144
145 kirkwood_ehci_init();
146 kirkwood_ge00_init(&dreamplug_ge00_data);
147 kirkwood_ge01_init(&dreamplug_ge01_data);
148 kirkwood_sata_init(&dreamplug_sata_data);
149 kirkwood_sdio_init(&dreamplug_mvsdio_data);
150
151 platform_device_register(&dreamplug_leds);
152}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index fbe6405602ed..1c672d9e6656 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * arch/arm/mach-kirkwood/board-dt.c 4 * arch/arm/mach-kirkwood/board-dt.c
5 * 5 *
6 * Marvell DreamPlug Reference Board Setup 6 * Flattened Device Tree board initialization
7 * 7 *
8 * This file is licensed under the terms of the GNU General Public 8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
@@ -12,150 +12,45 @@
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/partitions.h>
17#include <linux/ata_platform.h>
18#include <linux/mv643xx_eth.h>
19#include <linux/of.h> 15#include <linux/of.h>
20#include <linux/of_address.h>
21#include <linux/of_fdt.h>
22#include <linux/of_irq.h>
23#include <linux/of_platform.h> 16#include <linux/of_platform.h>
24#include <linux/gpio.h>
25#include <linux/leds.h>
26#include <linux/mtd/physmap.h>
27#include <linux/spi/flash.h>
28#include <linux/spi/spi.h>
29#include <linux/spi/orion_spi.h>
30#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
32#include <mach/kirkwood.h> 18#include <asm/mach/map.h>
33#include <plat/mvsdio.h> 19#include <mach/bridge-regs.h>
34#include "common.h" 20#include "common.h"
35#include "mpp.h"
36 21
37static struct of_device_id kirkwood_dt_match_table[] __initdata = { 22static struct of_device_id kirkwood_dt_match_table[] __initdata = {
38 { .compatible = "simple-bus", }, 23 { .compatible = "simple-bus", },
39 { } 24 { }
40}; 25};
41 26
42struct mtd_partition dreamplug_partitions[] = { 27static void __init kirkwood_dt_init(void)
43 {
44 .name = "u-boot",
45 .size = SZ_512K,
46 .offset = 0,
47 },
48 {
49 .name = "u-boot env",
50 .size = SZ_64K,
51 .offset = SZ_512K + SZ_512K,
52 },
53 {
54 .name = "dtb",
55 .size = SZ_64K,
56 .offset = SZ_512K + SZ_512K + SZ_512K,
57 },
58};
59
60static const struct flash_platform_data dreamplug_spi_slave_data = {
61 .type = "mx25l1606e",
62 .name = "spi_flash",
63 .parts = dreamplug_partitions,
64 .nr_parts = ARRAY_SIZE(dreamplug_partitions),
65};
66
67static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
68 {
69 .modalias = "m25p80",
70 .platform_data = &dreamplug_spi_slave_data,
71 .irq = -1,
72 .max_speed_hz = 50000000,
73 .bus_num = 0,
74 .chip_select = 0,
75 },
76};
77
78static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
79 .phy_addr = MV643XX_ETH_PHY_ADDR(0),
80};
81
82static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
83 .phy_addr = MV643XX_ETH_PHY_ADDR(1),
84};
85
86static struct mv_sata_platform_data dreamplug_sata_data = {
87 .n_ports = 1,
88};
89
90static struct mvsdio_platform_data dreamplug_mvsdio_data = {
91 /* unfortunately the CD signal has not been connected */
92};
93
94static struct gpio_led dreamplug_led_pins[] = {
95 {
96 .name = "dreamplug:blue:bluetooth",
97 .gpio = 47,
98 .active_low = 1,
99 },
100 {
101 .name = "dreamplug:green:wifi",
102 .gpio = 48,
103 .active_low = 1,
104 },
105 {
106 .name = "dreamplug:green:wifi_ap",
107 .gpio = 49,
108 .active_low = 1,
109 },
110};
111
112static struct gpio_led_platform_data dreamplug_led_data = {
113 .leds = dreamplug_led_pins,
114 .num_leds = ARRAY_SIZE(dreamplug_led_pins),
115};
116
117static struct platform_device dreamplug_leds = {
118 .name = "leds-gpio",
119 .id = -1,
120 .dev = {
121 .platform_data = &dreamplug_led_data,
122 }
123};
124
125static unsigned int dreamplug_mpp_config[] __initdata = {
126 MPP0_SPI_SCn,
127 MPP1_SPI_MOSI,
128 MPP2_SPI_SCK,
129 MPP3_SPI_MISO,
130 MPP47_GPIO, /* Bluetooth LED */
131 MPP48_GPIO, /* Wifi LED */
132 MPP49_GPIO, /* Wifi AP LED */
133 0
134};
135
136static void __init dreamplug_init(void)
137{ 28{
29 pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
30
138 /* 31 /*
139 * Basic setup. Needs to be called early. 32 * Disable propagation of mbus errors to the CPU local bus,
33 * as this causes mbus errors (which can occur for example
34 * for PCI aborts) to throw CPU aborts, which we're not set
35 * up to deal with.
140 */ 36 */
141 kirkwood_mpp_conf(dreamplug_mpp_config); 37 writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG);
142 38
143 spi_register_board_info(dreamplug_spi_slave_info, 39 kirkwood_setup_cpu_mbus();
144 ARRAY_SIZE(dreamplug_spi_slave_info));
145 kirkwood_spi_init();
146 40
147 kirkwood_ehci_init(); 41#ifdef CONFIG_CACHE_FEROCEON_L2
148 kirkwood_ge00_init(&dreamplug_ge00_data); 42 kirkwood_l2_init();
149 kirkwood_ge01_init(&dreamplug_ge01_data); 43#endif
150 kirkwood_sata_init(&dreamplug_sata_data);
151 kirkwood_sdio_init(&dreamplug_mvsdio_data);
152 44
153 platform_device_register(&dreamplug_leds); 45 /* internal devices that every board has */
154} 46 kirkwood_wdt_init();
47 kirkwood_xor0_init();
48 kirkwood_xor1_init();
49 kirkwood_crypto_init();
155 50
156static void __init kirkwood_dt_init(void) 51#ifdef CONFIG_KEXEC
157{ 52 kexec_reinit = kirkwood_enable_pcie;
158 kirkwood_init(); 53#endif
159 54
160 if (of_machine_is_compatible("globalscale,dreamplug")) 55 if (of_machine_is_compatible("globalscale,dreamplug"))
161 dreamplug_init(); 56 dreamplug_init();
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 77d4852e19f2..a02cae881f2f 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -279,7 +279,7 @@ void __init kirkwood_crypto_init(void)
279/***************************************************************************** 279/*****************************************************************************
280 * XOR0 280 * XOR0
281 ****************************************************************************/ 281 ****************************************************************************/
282static void __init kirkwood_xor0_init(void) 282void __init kirkwood_xor0_init(void)
283{ 283{
284 kirkwood_clk_ctrl |= CGC_XOR0; 284 kirkwood_clk_ctrl |= CGC_XOR0;
285 285
@@ -291,7 +291,7 @@ static void __init kirkwood_xor0_init(void)
291/***************************************************************************** 291/*****************************************************************************
292 * XOR1 292 * XOR1
293 ****************************************************************************/ 293 ****************************************************************************/
294static void __init kirkwood_xor1_init(void) 294void __init kirkwood_xor1_init(void)
295{ 295{
296 kirkwood_clk_ctrl |= CGC_XOR1; 296 kirkwood_clk_ctrl |= CGC_XOR1;
297 297
@@ -303,7 +303,7 @@ static void __init kirkwood_xor1_init(void)
303/***************************************************************************** 303/*****************************************************************************
304 * Watchdog 304 * Watchdog
305 ****************************************************************************/ 305 ****************************************************************************/
306static void __init kirkwood_wdt_init(void) 306void __init kirkwood_wdt_init(void)
307{ 307{
308 orion_wdt_init(kirkwood_tclk); 308 orion_wdt_init(kirkwood_tclk);
309} 309}
@@ -392,7 +392,7 @@ void __init kirkwood_audio_init(void)
392/* 392/*
393 * Identify device ID and revision. 393 * Identify device ID and revision.
394 */ 394 */
395static char * __init kirkwood_id(void) 395char * __init kirkwood_id(void)
396{ 396{
397 u32 dev, rev; 397 u32 dev, rev;
398 398
@@ -435,7 +435,7 @@ static char * __init kirkwood_id(void)
435 } 435 }
436} 436}
437 437
438static void __init kirkwood_l2_init(void) 438void __init kirkwood_l2_init(void)
439{ 439{
440#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH 440#ifdef CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH
441 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG); 441 writel(readl(L2_CONFIG_REG) | L2_WRITETHROUGH, L2_CONFIG_REG);
@@ -450,7 +450,6 @@ void __init kirkwood_init(void)
450{ 450{
451 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n", 451 printk(KERN_INFO "Kirkwood: %s, TCLK=%d.\n",
452 kirkwood_id(), kirkwood_tclk); 452 kirkwood_id(), kirkwood_tclk);
453 kirkwood_i2s_data.tclk = kirkwood_tclk;
454 453
455 /* 454 /*
456 * Disable propagation of mbus errors to the CPU local bus, 455 * Disable propagation of mbus errors to the CPU local bus,
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 9071a397136d..fa8e7689c436 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -51,6 +51,21 @@ void kirkwood_nand_init_rnb(struct mtd_partition *parts, int nr_parts, int (*dev
51void kirkwood_audio_init(void); 51void kirkwood_audio_init(void);
52void kirkwood_restart(char, const char *); 52void kirkwood_restart(char, const char *);
53 53
54/* board init functions for boards not fully converted to fdt */
55#ifdef CONFIG_MACH_DREAMPLUG_DT
56void dreamplug_init(void);
57#else
58static inline void dreamplug_init(void) {};
59#endif
60
61/* early init functions not converted to fdt yet */
62char *kirkwood_id(void);
63void kirkwood_l2_init(void);
64void kirkwood_wdt_init(void);
65void kirkwood_xor0_init(void);
66void kirkwood_xor1_init(void);
67void kirkwood_crypto_init(void);
68
54extern int kirkwood_tclk; 69extern int kirkwood_tclk;
55extern struct sys_timer kirkwood_timer; 70extern struct sys_timer kirkwood_timer;
56 71
diff --git a/arch/arm/mach-kirkwood/cpuidle.c b/arch/arm/mach-kirkwood/cpuidle.c
index 7088180b018b..0f1710941878 100644
--- a/arch/arm/mach-kirkwood/cpuidle.c
+++ b/arch/arm/mach-kirkwood/cpuidle.c
@@ -20,77 +20,47 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/export.h> 21#include <linux/export.h>
22#include <asm/proc-fns.h> 22#include <asm/proc-fns.h>
23#include <asm/cpuidle.h>
23#include <mach/kirkwood.h> 24#include <mach/kirkwood.h>
24 25
25#define KIRKWOOD_MAX_STATES 2 26#define KIRKWOOD_MAX_STATES 2
26 27
27static struct cpuidle_driver kirkwood_idle_driver = {
28 .name = "kirkwood_idle",
29 .owner = THIS_MODULE,
30};
31
32static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
33
34/* Actual code that puts the SoC in different idle states */ 28/* Actual code that puts the SoC in different idle states */
35static int kirkwood_enter_idle(struct cpuidle_device *dev, 29static int kirkwood_enter_idle(struct cpuidle_device *dev,
36 struct cpuidle_driver *drv, 30 struct cpuidle_driver *drv,
37 int index) 31 int index)
38{ 32{
39 struct timeval before, after; 33 writel(0x7, DDR_OPERATION_BASE);
40 int idle_time; 34 cpu_do_idle();
41
42 local_irq_disable();
43 do_gettimeofday(&before);
44 if (index == 0)
45 /* Wait for interrupt state */
46 cpu_do_idle();
47 else if (index == 1) {
48 /*
49 * Following write will put DDR in self refresh.
50 * Note that we have 256 cycles before DDR puts it
51 * self in self-refresh, so the wait-for-interrupt
52 * call afterwards won't get the DDR from self refresh
53 * mode.
54 */
55 writel(0x7, DDR_OPERATION_BASE);
56 cpu_do_idle();
57 }
58 do_gettimeofday(&after);
59 local_irq_enable();
60 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
61 (after.tv_usec - before.tv_usec);
62
63 /* Update last residency */
64 dev->last_residency = idle_time;
65 35
66 return index; 36 return index;
67} 37}
68 38
39static struct cpuidle_driver kirkwood_idle_driver = {
40 .name = "kirkwood_idle",
41 .owner = THIS_MODULE,
42 .en_core_tk_irqen = 1,
43 .states[0] = ARM_CPUIDLE_WFI_STATE,
44 .states[1] = {
45 .enter = kirkwood_enter_idle,
46 .exit_latency = 10,
47 .target_residency = 100000,
48 .flags = CPUIDLE_FLAG_TIME_VALID,
49 .name = "DDR SR",
50 .desc = "WFI and DDR Self Refresh",
51 },
52 .state_count = KIRKWOOD_MAX_STATES,
53};
54
55static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
56
69/* Initialize CPU idle by registering the idle states */ 57/* Initialize CPU idle by registering the idle states */
70static int kirkwood_init_cpuidle(void) 58static int kirkwood_init_cpuidle(void)
71{ 59{
72 struct cpuidle_device *device; 60 struct cpuidle_device *device;
73 struct cpuidle_driver *driver = &kirkwood_idle_driver;
74 61
75 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id()); 62 device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
76 device->state_count = KIRKWOOD_MAX_STATES; 63 device->state_count = KIRKWOOD_MAX_STATES;
77 driver->state_count = KIRKWOOD_MAX_STATES;
78
79 /* Wait for interrupt state */
80 driver->states[0].enter = kirkwood_enter_idle;
81 driver->states[0].exit_latency = 1;
82 driver->states[0].target_residency = 10000;
83 driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
84 strcpy(driver->states[0].name, "WFI");
85 strcpy(driver->states[0].desc, "Wait for interrupt");
86
87 /* Wait for interrupt and DDR self refresh state */
88 driver->states[1].enter = kirkwood_enter_idle;
89 driver->states[1].exit_latency = 10;
90 driver->states[1].target_residency = 10000;
91 driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
92 strcpy(driver->states[1].name, "DDR SR");
93 strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
94 64
95 cpuidle_register_driver(&kirkwood_idle_driver); 65 cpuidle_register_driver(&kirkwood_idle_driver);
96 if (cpuidle_register_device(device)) { 66 if (cpuidle_register_device(device)) {
diff --git a/arch/arm/mach-kirkwood/include/mach/io.h b/arch/arm/mach-kirkwood/include/mach/io.h
index 49dd0cb5e166..5d0ab61700d2 100644
--- a/arch/arm/mach-kirkwood/include/mach/io.h
+++ b/arch/arm/mach-kirkwood/include/mach/io.h
@@ -20,7 +20,5 @@ static inline void __iomem *__io(unsigned long addr)
20} 20}
21 21
22#define __io(a) __io(a) 22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25 23
26#endif 24#endif
diff --git a/arch/arm/mach-ks8695/include/mach/io.h b/arch/arm/mach-ks8695/include/mach/io.h
deleted file mode 100644
index a7a63ac3ba4e..000000000000
--- a/arch/arm/mach-ks8695/include/mach/io.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-ks8695/include/mach/io.h
3 *
4 * Copyright (C) 2006 Andrew Victor
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#define IO_SPACE_LIMIT 0xffffffff
15
16#define __io(a) __typesafe_io(a)
17#define __mem_pci(a) (a)
18
19#endif
diff --git a/arch/arm/mach-ks8695/time.c b/arch/arm/mach-ks8695/time.c
index 37dfcd5bd2ad..ec783a3070ae 100644
--- a/arch/arm/mach-ks8695/time.c
+++ b/arch/arm/mach-ks8695/time.c
@@ -27,6 +27,7 @@
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <asm/mach/time.h> 29#include <asm/mach/time.h>
30#include <asm/system_misc.h>
30 31
31#include <mach/regs-timer.h> 32#include <mach/regs-timer.h>
32#include <mach/regs-irq.h> 33#include <mach/regs-irq.h>
diff --git a/arch/arm/mach-lpc32xx/Kconfig b/arch/arm/mach-lpc32xx/Kconfig
index fde663508696..75946ac89ee9 100644
--- a/arch/arm/mach-lpc32xx/Kconfig
+++ b/arch/arm/mach-lpc32xx/Kconfig
@@ -29,5 +29,30 @@ config ARCH_LPC32XX_UART6_SELECT
29 29
30endmenu 30endmenu
31 31
32menu "LPC32XX chip components"
33
34config ARCH_LPC32XX_IRAM_FOR_NET
35 bool "Use IRAM for network buffers"
36 default y
37 help
38 Say Y here to use the LPC internal fast IRAM (i.e. 256KB SRAM) as
39 network buffer. If the total combined required buffer sizes is
40 larger than the size of IRAM, then SDRAM will be used instead.
41
42 This can be enabled safely if the IRAM is not intended for other
43 uses.
44
45config ARCH_LPC32XX_MII_SUPPORT
46 bool "Check to enable MII support or leave disabled for RMII support"
47 help
48 Say Y here to enable MII support, or N for RMII support. Regardless of
49 which support is selected, the ethernet interface driver needs to be
50 selected in the device driver networking section.
51
52 The PHY3250 reference board uses RMII, so users of this board should
53 say N.
54
55endmenu
56
32endif 57endif
33 58
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
index f55c772d1816..2fc24ca12054 100644
--- a/arch/arm/mach-lpc32xx/clock.c
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -87,6 +87,7 @@
87#include <linux/list.h> 87#include <linux/list.h>
88#include <linux/errno.h> 88#include <linux/errno.h>
89#include <linux/device.h> 89#include <linux/device.h>
90#include <linux/delay.h>
90#include <linux/err.h> 91#include <linux/err.h>
91#include <linux/clk.h> 92#include <linux/clk.h>
92#include <linux/amba/bus.h> 93#include <linux/amba/bus.h>
@@ -100,6 +101,8 @@
100 101
101static DEFINE_SPINLOCK(global_clkregs_lock); 102static DEFINE_SPINLOCK(global_clkregs_lock);
102 103
104static int usb_pll_enable, usb_pll_valid;
105
103static struct clk clk_armpll; 106static struct clk clk_armpll;
104static struct clk clk_usbpll; 107static struct clk clk_usbpll;
105 108
@@ -384,30 +387,62 @@ static u32 local_clk_usbpll_setup(struct clk_pll_setup *pHCLKPllSetup)
384static int local_usbpll_enable(struct clk *clk, int enable) 387static int local_usbpll_enable(struct clk *clk, int enable)
385{ 388{
386 u32 reg; 389 u32 reg;
387 int ret = -ENODEV; 390 int ret = 0;
388 unsigned long timeout = jiffies + msecs_to_jiffies(10); 391 unsigned long timeout = jiffies + msecs_to_jiffies(20);
389 392
390 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL); 393 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
391 394
392 if (enable == 0) { 395 __raw_writel(reg & ~(LPC32XX_CLKPWR_USBCTRL_CLK_EN2 |
393 reg &= ~(LPC32XX_CLKPWR_USBCTRL_CLK_EN1 | 396 LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP),
394 LPC32XX_CLKPWR_USBCTRL_CLK_EN2); 397 LPC32XX_CLKPWR_USB_CTRL);
395 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL); 398 __raw_writel(reg & ~LPC32XX_CLKPWR_USBCTRL_CLK_EN1,
396 } else if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP) { 399 LPC32XX_CLKPWR_USB_CTRL);
400
401 if (enable && usb_pll_valid && usb_pll_enable) {
402 ret = -ENODEV;
403 /*
404 * If the PLL rate has been previously set, then the rate
405 * in the PLL register is valid and can be enabled here.
406 * Otherwise, it needs to be enabled as part of setrate.
407 */
408
409 /*
410 * Gate clock into PLL
411 */
397 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN1; 412 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN1;
398 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL); 413 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
399 414
400 /* Wait for PLL lock */ 415 /*
416 * Enable PLL
417 */
418 reg |= LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP;
419 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
420
421 /*
422 * Wait for PLL to lock
423 */
401 while (time_before(jiffies, timeout) && (ret == -ENODEV)) { 424 while (time_before(jiffies, timeout) && (ret == -ENODEV)) {
402 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL); 425 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
403 if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_STS) 426 if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_STS)
404 ret = 0; 427 ret = 0;
428 else
429 udelay(10);
405 } 430 }
406 431
432 /*
433 * Gate clock from PLL if PLL is locked
434 */
407 if (ret == 0) { 435 if (ret == 0) {
408 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN2; 436 __raw_writel(reg | LPC32XX_CLKPWR_USBCTRL_CLK_EN2,
409 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL); 437 LPC32XX_CLKPWR_USB_CTRL);
438 } else {
439 __raw_writel(reg & ~(LPC32XX_CLKPWR_USBCTRL_CLK_EN1 |
440 LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP),
441 LPC32XX_CLKPWR_USB_CTRL);
410 } 442 }
443 } else if ((enable == 0) && usb_pll_valid && usb_pll_enable) {
444 usb_pll_valid = 0;
445 usb_pll_enable = 0;
411 } 446 }
412 447
413 return ret; 448 return ret;
@@ -425,7 +460,7 @@ static unsigned long local_usbpll_round_rate(struct clk *clk,
425 */ 460 */
426 rate = rate * 1000; 461 rate = rate * 1000;
427 462
428 clkin = clk->parent->rate; 463 clkin = clk->get_rate(clk);
429 usbdiv = (__raw_readl(LPC32XX_CLKPWR_USBCLK_PDIV) & 464 usbdiv = (__raw_readl(LPC32XX_CLKPWR_USBCLK_PDIV) &
430 LPC32XX_CLKPWR_USBPDIV_PLL_MASK) + 1; 465 LPC32XX_CLKPWR_USBPDIV_PLL_MASK) + 1;
431 clkin = clkin / usbdiv; 466 clkin = clkin / usbdiv;
@@ -439,7 +474,8 @@ static unsigned long local_usbpll_round_rate(struct clk *clk,
439 474
440static int local_usbpll_set_rate(struct clk *clk, unsigned long rate) 475static int local_usbpll_set_rate(struct clk *clk, unsigned long rate)
441{ 476{
442 u32 clkin, reg, usbdiv; 477 int ret = -ENODEV;
478 u32 clkin, usbdiv;
443 struct clk_pll_setup pllsetup; 479 struct clk_pll_setup pllsetup;
444 480
445 /* 481 /*
@@ -448,7 +484,7 @@ static int local_usbpll_set_rate(struct clk *clk, unsigned long rate)
448 */ 484 */
449 rate = rate * 1000; 485 rate = rate * 1000;
450 486
451 clkin = clk->get_rate(clk); 487 clkin = clk->get_rate(clk->parent);
452 usbdiv = (__raw_readl(LPC32XX_CLKPWR_USBCLK_PDIV) & 488 usbdiv = (__raw_readl(LPC32XX_CLKPWR_USBCLK_PDIV) &
453 LPC32XX_CLKPWR_USBPDIV_PLL_MASK) + 1; 489 LPC32XX_CLKPWR_USBPDIV_PLL_MASK) + 1;
454 clkin = clkin / usbdiv; 490 clkin = clkin / usbdiv;
@@ -457,22 +493,25 @@ static int local_usbpll_set_rate(struct clk *clk, unsigned long rate)
457 if (local_clk_find_pll_cfg(clkin, rate, &pllsetup) == 0) 493 if (local_clk_find_pll_cfg(clkin, rate, &pllsetup) == 0)
458 return -EINVAL; 494 return -EINVAL;
459 495
496 /*
497 * Disable PLL clocks during PLL change
498 */
460 local_usbpll_enable(clk, 0); 499 local_usbpll_enable(clk, 0);
461 500 pllsetup.analog_on = 0;
462 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
463 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN1;
464 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
465
466 pllsetup.analog_on = 1;
467 local_clk_usbpll_setup(&pllsetup); 501 local_clk_usbpll_setup(&pllsetup);
468 502
469 clk->rate = clk_check_pll_setup(clkin, &pllsetup); 503 /*
504 * Start USB PLL and check PLL status
505 */
506
507 usb_pll_valid = 1;
508 usb_pll_enable = 1;
470 509
471 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL); 510 ret = local_usbpll_enable(clk, 1);
472 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN2; 511 if (ret >= 0)
473 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL); 512 clk->rate = clk_check_pll_setup(clkin, &pllsetup);
474 513
475 return 0; 514 return ret;
476} 515}
477 516
478static struct clk clk_usbpll = { 517static struct clk clk_usbpll = {
@@ -1095,7 +1134,7 @@ static struct clk_lookup lookups[] = {
1095 _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) 1134 _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1)
1096 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc) 1135 _REGISTER_CLOCK("ts-lpc32xx", NULL, clk_tsc)
1097 _REGISTER_CLOCK("dev:mmc0", NULL, clk_mmc) 1136 _REGISTER_CLOCK("dev:mmc0", NULL, clk_mmc)
1098 _REGISTER_CLOCK("lpc-net.0", NULL, clk_net) 1137 _REGISTER_CLOCK("lpc-eth.0", NULL, clk_net)
1099 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd) 1138 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd)
1100 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd) 1139 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd)
1101 _REGISTER_CLOCK("lpc32xx_rtc", NULL, clk_rtc) 1140 _REGISTER_CLOCK("lpc32xx_rtc", NULL, clk_rtc)
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
index 6c76bb36559b..bbbf063a74c2 100644
--- a/arch/arm/mach-lpc32xx/common.c
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -160,6 +160,53 @@ struct platform_device lpc32xx_adc_device = {
160}; 160};
161 161
162/* 162/*
163 * USB support
164 */
165/* The dmamask must be set for OHCI to work */
166static u64 ohci_dmamask = ~(u32) 0;
167static struct resource ohci_resources[] = {
168 {
169 .start = IO_ADDRESS(LPC32XX_USB_BASE),
170 .end = IO_ADDRESS(LPC32XX_USB_BASE + 0x100 - 1),
171 .flags = IORESOURCE_MEM,
172 }, {
173 .start = IRQ_LPC32XX_USB_HOST,
174 .flags = IORESOURCE_IRQ,
175 },
176};
177struct platform_device lpc32xx_ohci_device = {
178 .name = "usb-ohci",
179 .id = -1,
180 .dev = {
181 .dma_mask = &ohci_dmamask,
182 .coherent_dma_mask = 0xFFFFFFFF,
183 },
184 .num_resources = ARRAY_SIZE(ohci_resources),
185 .resource = ohci_resources,
186};
187
188/*
189 * Network Support
190 */
191static struct resource net_resources[] = {
192 [0] = DEFINE_RES_MEM(LPC32XX_ETHERNET_BASE, SZ_4K),
193 [1] = DEFINE_RES_MEM(LPC32XX_IRAM_BASE, SZ_128K),
194 [2] = DEFINE_RES_IRQ(IRQ_LPC32XX_ETHERNET),
195};
196
197static u64 lpc32xx_mac_dma_mask = 0xffffffffUL;
198struct platform_device lpc32xx_net_device = {
199 .name = "lpc-eth",
200 .id = 0,
201 .dev = {
202 .dma_mask = &lpc32xx_mac_dma_mask,
203 .coherent_dma_mask = 0xffffffffUL,
204 },
205 .num_resources = ARRAY_SIZE(net_resources),
206 .resource = net_resources,
207};
208
209/*
163 * Returns the unique ID for the device 210 * Returns the unique ID for the device
164 */ 211 */
165void lpc32xx_get_uid(u32 devid[4]) 212void lpc32xx_get_uid(u32 devid[4])
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
index 68f2e46d98ad..68e45e8c9486 100644
--- a/arch/arm/mach-lpc32xx/common.h
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -19,6 +19,7 @@
19#ifndef __LPC32XX_COMMON_H 19#ifndef __LPC32XX_COMMON_H
20#define __LPC32XX_COMMON_H 20#define __LPC32XX_COMMON_H
21 21
22#include <mach/board.h>
22#include <linux/platform_device.h> 23#include <linux/platform_device.h>
23 24
24/* 25/*
@@ -31,6 +32,8 @@ extern struct platform_device lpc32xx_i2c2_device;
31extern struct platform_device lpc32xx_tsc_device; 32extern struct platform_device lpc32xx_tsc_device;
32extern struct platform_device lpc32xx_adc_device; 33extern struct platform_device lpc32xx_adc_device;
33extern struct platform_device lpc32xx_rtc_device; 34extern struct platform_device lpc32xx_rtc_device;
35extern struct platform_device lpc32xx_ohci_device;
36extern struct platform_device lpc32xx_net_device;
34 37
35/* 38/*
36 * Other arch specific structures and functions 39 * Other arch specific structures and functions
@@ -67,7 +70,6 @@ extern u32 clk_get_pclk_div(void);
67extern void lpc32xx_get_uid(u32 devid[4]); 70extern void lpc32xx_get_uid(u32 devid[4]);
68 71
69extern u32 lpc32xx_return_iram_size(void); 72extern u32 lpc32xx_return_iram_size(void);
70
71/* 73/*
72 * Pointers used for sizing and copying suspend function data 74 * Pointers used for sizing and copying suspend function data
73 */ 75 */
diff --git a/arch/arm/mach-lpc32xx/include/mach/io.h b/arch/arm/mach-lpc32xx/include/mach/board.h
index 9b59ab5cef89..52531ca7bd1d 100644
--- a/arch/arm/mach-lpc32xx/include/mach/io.h
+++ b/arch/arm/mach-lpc32xx/include/mach/board.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-lpc32xx/include/mach/io.h 2 * arm/arch/mach-lpc32xx/include/mach/board.h
3 * 3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com> 4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 * 5 *
@@ -16,12 +16,9 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 */ 17 */
18 18
19#ifndef __ASM_ARM_ARCH_IO_H 19#ifndef __ASM_ARCH_BOARD_H
20#define __ASM_ARM_ARCH_IO_H 20#define __ASM_ARCH_BOARD_H
21 21
22#define IO_SPACE_LIMIT 0xffffffff 22extern u32 lpc32xx_return_iram_size(void);
23 23
24#define __io(a) __typesafe_io(a) 24#endif /* __ASM_ARCH_BOARD_H */
25#define __mem_pci(a) (a)
26
27#endif
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
index c74de01ab5b6..d080cb1123dd 100644
--- a/arch/arm/mach-lpc32xx/irq.c
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -150,6 +150,10 @@ static const struct lpc32xx_event_info lpc32xx_events[NR_IRQS] = {
150 .event_group = &lpc32xx_event_int_regs, 150 .event_group = &lpc32xx_event_int_regs,
151 .mask = LPC32XX_CLKPWR_INTSRC_KEY_BIT, 151 .mask = LPC32XX_CLKPWR_INTSRC_KEY_BIT,
152 }, 152 },
153 [IRQ_LPC32XX_ETHERNET] = {
154 .event_group = &lpc32xx_event_int_regs,
155 .mask = LPC32XX_CLKPWR_INTSRC_MAC_BIT,
156 },
153 [IRQ_LPC32XX_USB_OTG_ATX] = { 157 [IRQ_LPC32XX_USB_OTG_ATX] = {
154 .event_group = &lpc32xx_event_int_regs, 158 .event_group = &lpc32xx_event_int_regs,
155 .mask = LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT, 159 .mask = LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT,
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 0d79a3f8a5e0..7f7401ec7487 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -37,6 +37,7 @@
37 37
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/platform.h> 39#include <mach/platform.h>
40#include <mach/board.h>
40#include <mach/gpio-lpc32xx.h> 41#include <mach/gpio-lpc32xx.h>
41#include "common.h" 42#include "common.h"
42 43
@@ -255,6 +256,8 @@ static struct platform_device *phy3250_devs[] __initdata = {
255 &lpc32xx_watchdog_device, 256 &lpc32xx_watchdog_device,
256 &lpc32xx_gpio_led_device, 257 &lpc32xx_gpio_led_device,
257 &lpc32xx_adc_device, 258 &lpc32xx_adc_device,
259 &lpc32xx_ohci_device,
260 &lpc32xx_net_device,
258}; 261};
259 262
260static struct amba_device *amba_devs[] __initdata = { 263static struct amba_device *amba_devs[] __initdata = {
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 3588a5584153..bf5d8e195c3e 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -23,6 +23,7 @@
23#include <mach/addr-map.h> 23#include <mach/addr-map.h>
24#include <mach/mfp-pxa168.h> 24#include <mach/mfp-pxa168.h>
25#include <mach/pxa168.h> 25#include <mach/pxa168.h>
26#include <mach/irqs.h>
26#include <video/pxa168fb.h> 27#include <video/pxa168fb.h>
27#include <linux/input.h> 28#include <linux/input.h>
28#include <plat/pxa27x_keypad.h> 29#include <plat/pxa27x_keypad.h>
@@ -239,7 +240,7 @@ static void __init common_init(void)
239 240
240MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform") 241MACHINE_START(ASPENITE, "PXA168-based Aspenite Development Platform")
241 .map_io = mmp_map_io, 242 .map_io = mmp_map_io,
242 .nr_irqs = IRQ_BOARD_START, 243 .nr_irqs = MMP_NR_IRQS,
243 .init_irq = pxa168_init_irq, 244 .init_irq = pxa168_init_irq,
244 .timer = &pxa168_timer, 245 .timer = &pxa168_timer,
245 .init_machine = common_init, 246 .init_machine = common_init,
@@ -248,7 +249,7 @@ MACHINE_END
248 249
249MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform") 250MACHINE_START(ZYLONITE2, "PXA168-based Zylonite2 Development Platform")
250 .map_io = mmp_map_io, 251 .map_io = mmp_map_io,
251 .nr_irqs = IRQ_BOARD_START, 252 .nr_irqs = MMP_NR_IRQS,
252 .init_irq = pxa168_init_irq, 253 .init_irq = pxa168_init_irq,
253 .timer = &pxa168_timer, 254 .timer = &pxa168_timer,
254 .init_machine = common_init, 255 .init_machine = common_init,
diff --git a/arch/arm/mach-mmp/avengers_lite.c b/arch/arm/mach-mmp/avengers_lite.c
index b148a9dc5a44..603542ae6fbd 100644
--- a/arch/arm/mach-mmp/avengers_lite.c
+++ b/arch/arm/mach-mmp/avengers_lite.c
@@ -43,6 +43,7 @@ static void __init avengers_lite_init(void)
43 43
44MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform") 44MACHINE_START(AVENGERS_LITE, "PXA168 Avengers lite Development Platform")
45 .map_io = mmp_map_io, 45 .map_io = mmp_map_io,
46 .nr_irqs = MMP_NR_IRQS,
46 .init_irq = pxa168_init_irq, 47 .init_irq = pxa168_init_irq,
47 .timer = &pxa168_timer, 48 .timer = &pxa168_timer,
48 .init_machine = avengers_lite_init, 49 .init_machine = avengers_lite_init,
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index d839fe6421e6..5cb769cd26d9 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -28,7 +28,7 @@
28 28
29#include "common.h" 29#include "common.h"
30 30
31#define BROWNSTONE_NR_IRQS (IRQ_BOARD_START + 40) 31#define BROWNSTONE_NR_IRQS (MMP_NR_IRQS + 40)
32 32
33#define GPIO_5V_ENABLE (89) 33#define GPIO_5V_ENABLE (89)
34 34
@@ -158,7 +158,7 @@ static struct platform_device brownstone_v_5vp_device = {
158}; 158};
159 159
160static struct max8925_platform_data brownstone_max8925_info = { 160static struct max8925_platform_data brownstone_max8925_info = {
161 .irq_base = IRQ_BOARD_START, 161 .irq_base = MMP_NR_IRQS,
162}; 162};
163 163
164static struct i2c_board_info brownstone_twsi1_info[] = { 164static struct i2c_board_info brownstone_twsi1_info[] = {
diff --git a/arch/arm/mach-mmp/common.c b/arch/arm/mach-mmp/common.c
index 062b5b93c50e..9292b7966e3b 100644
--- a/arch/arm/mach-mmp/common.c
+++ b/arch/arm/mach-mmp/common.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm/mach/map.h> 16#include <asm/mach/map.h>
17#include <asm/system_misc.h>
17#include <mach/addr-map.h> 18#include <mach/addr-map.h>
18#include <mach/cputype.h> 19#include <mach/cputype.h>
19 20
diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
index 2ee8cd7829dd..8059cc0905c6 100644
--- a/arch/arm/mach-mmp/flint.c
+++ b/arch/arm/mach-mmp/flint.c
@@ -23,10 +23,11 @@
23#include <mach/addr-map.h> 23#include <mach/addr-map.h>
24#include <mach/mfp-mmp2.h> 24#include <mach/mfp-mmp2.h>
25#include <mach/mmp2.h> 25#include <mach/mmp2.h>
26#include <mach/irqs.h>
26 27
27#include "common.h" 28#include "common.h"
28 29
29#define FLINT_NR_IRQS (IRQ_BOARD_START + 48) 30#define FLINT_NR_IRQS (MMP_NR_IRQS + 48)
30 31
31static unsigned long flint_pin_config[] __initdata = { 32static unsigned long flint_pin_config[] __initdata = {
32 /* UART1 */ 33 /* UART1 */
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index 87765467de63..f516e74ce0d5 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -191,7 +191,7 @@ static void __init gplugd_init(void)
191 191
192MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform") 192MACHINE_START(GPLUGD, "PXA168-based GuruPlug Display (gplugD) Platform")
193 .map_io = mmp_map_io, 193 .map_io = mmp_map_io,
194 .nr_irqs = IRQ_BOARD_START, 194 .nr_irqs = MMP_NR_IRQS,
195 .init_irq = pxa168_init_irq, 195 .init_irq = pxa168_init_irq,
196 .timer = &pxa168_timer, 196 .timer = &pxa168_timer,
197 .init_machine = gplugd_init, 197 .init_machine = gplugd_init,
diff --git a/arch/arm/mach-mmp/include/mach/addr-map.h b/arch/arm/mach-mmp/include/mach/addr-map.h
index 3e404acd6ff4..b1ece08174e8 100644
--- a/arch/arm/mach-mmp/include/mach/addr-map.h
+++ b/arch/arm/mach-mmp/include/mach/addr-map.h
@@ -11,12 +11,6 @@
11#ifndef __ASM_MACH_ADDR_MAP_H 11#ifndef __ASM_MACH_ADDR_MAP_H
12#define __ASM_MACH_ADDR_MAP_H 12#define __ASM_MACH_ADDR_MAP_H
13 13
14#ifndef __ASSEMBLER__
15#define IOMEM(x) ((void __iomem *)(x))
16#else
17#define IOMEM(x) (x)
18#endif
19
20/* APB - Application Subsystem Peripheral Bus 14/* APB - Application Subsystem Peripheral Bus
21 * 15 *
22 * NOTE: the DMA controller registers are actually on the AXI fabric #1 16 * NOTE: the DMA controller registers are actually on the AXI fabric #1
diff --git a/arch/arm/mach-mmp/include/mach/io.h b/arch/arm/mach-mmp/include/mach/io.h
deleted file mode 100644
index e7adf3d012c1..000000000000
--- a/arch/arm/mach-mmp/include/mach/io.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * linux/arch/arm/mach-mmp/include/mach/io.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_MACH_IO_H
10#define __ASM_MACH_IO_H
11
12#define IO_SPACE_LIMIT 0xffffffff
13
14/*
15 * We don't actually have real ISA nor PCI buses, but there is so many
16 * drivers out there that might just work if we fake them...
17 */
18#define __io(a) __typesafe_io(a)
19#define __mem_pci(a) (a)
20
21#endif /* __ASM_MACH_IO_H */
diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
index 34635a0bbb59..d0e746626a3d 100644
--- a/arch/arm/mach-mmp/include/mach/irqs.h
+++ b/arch/arm/mach-mmp/include/mach/irqs.h
@@ -223,7 +223,6 @@
223#define MMP_GPIO_TO_IRQ(gpio) (IRQ_GPIO_START + (gpio)) 223#define MMP_GPIO_TO_IRQ(gpio) (IRQ_GPIO_START + (gpio))
224 224
225#define IRQ_BOARD_START (IRQ_GPIO_START + MMP_NR_BUILTIN_GPIO) 225#define IRQ_BOARD_START (IRQ_GPIO_START + MMP_NR_BUILTIN_GPIO)
226 226#define MMP_NR_IRQS IRQ_BOARD_START
227#define NR_IRQS (IRQ_BOARD_START)
228 227
229#endif /* __ASM_MACH_IRQS_H */ 228#endif /* __ASM_MACH_IRQS_H */
diff --git a/arch/arm/mach-mmp/irq-mmp2.c b/arch/arm/mach-mmp/irq-mmp2.c
index d21c5441a3d0..7895d277421e 100644
--- a/arch/arm/mach-mmp/irq-mmp2.c
+++ b/arch/arm/mach-mmp/irq-mmp2.c
@@ -15,6 +15,7 @@
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <mach/irqs.h>
18#include <mach/regs-icu.h> 19#include <mach/regs-icu.h>
19#include <mach/mmp2.h> 20#include <mach/mmp2.h>
20 21
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c
index 96cf5c8fe47d..ff73249884d0 100644
--- a/arch/arm/mach-mmp/jasper.c
+++ b/arch/arm/mach-mmp/jasper.c
@@ -19,6 +19,7 @@
19#include <linux/mfd/max8925.h> 19#include <linux/mfd/max8925.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21 21
22#include <mach/irqs.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24#include <mach/addr-map.h> 25#include <mach/addr-map.h>
@@ -27,7 +28,7 @@
27 28
28#include "common.h" 29#include "common.h"
29 30
30#define JASPER_NR_IRQS (IRQ_BOARD_START + 48) 31#define JASPER_NR_IRQS (MMP_NR_IRQS + 48)
31 32
32static unsigned long jasper_pin_config[] __initdata = { 33static unsigned long jasper_pin_config[] __initdata = {
33 /* UART1 */ 34 /* UART1 */
@@ -135,7 +136,7 @@ static struct max8925_power_pdata jasper_power_data = {
135static struct max8925_platform_data jasper_max8925_info = { 136static struct max8925_platform_data jasper_max8925_info = {
136 .backlight = &jasper_backlight_data, 137 .backlight = &jasper_backlight_data,
137 .power = &jasper_power_data, 138 .power = &jasper_power_data,
138 .irq_base = IRQ_BOARD_START, 139 .irq_base = MMP_NR_IRQS,
139}; 140};
140 141
141static struct i2c_board_info jasper_twsi1_info[] = { 142static struct i2c_board_info jasper_twsi1_info[] = {
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index f7d59c03fc67..b24d2c32cba9 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <asm/mach/time.h> 18#include <asm/mach/time.h>
19#include <asm/system_misc.h>
19#include <mach/addr-map.h> 20#include <mach/addr-map.h>
20#include <mach/cputype.h> 21#include <mach/cputype.h>
21#include <mach/regs-apbc.h> 22#include <mach/regs-apbc.h>
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index bc97170125bf..b28f9084dfff 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -101,6 +101,7 @@ static void __init tavorevb_init(void)
101 101
102MACHINE_START(TAVOREVB, "PXA910 Evaluation Board (aka TavorEVB)") 102MACHINE_START(TAVOREVB, "PXA910 Evaluation Board (aka TavorEVB)")
103 .map_io = mmp_map_io, 103 .map_io = mmp_map_io,
104 .nr_irqs = MMP_NR_IRQS,
104 .init_irq = pxa910_init_irq, 105 .init_irq = pxa910_init_irq,
105 .timer = &pxa910_timer, 106 .timer = &pxa910_timer,
106 .init_machine = tavorevb_init, 107 .init_machine = tavorevb_init,
diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
index 0523e422990e..42bef6674ecf 100644
--- a/arch/arm/mach-mmp/teton_bga.c
+++ b/arch/arm/mach-mmp/teton_bga.c
@@ -26,6 +26,7 @@
26#include <mach/mfp-pxa168.h> 26#include <mach/mfp-pxa168.h>
27#include <mach/pxa168.h> 27#include <mach/pxa168.h>
28#include <mach/teton_bga.h> 28#include <mach/teton_bga.h>
29#include <mach/irqs.h>
29 30
30#include "common.h" 31#include "common.h"
31 32
@@ -83,7 +84,7 @@ static void __init teton_bga_init(void)
83 84
84MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform") 85MACHINE_START(TETON_BGA, "PXA168-based Teton BGA Development Platform")
85 .map_io = mmp_map_io, 86 .map_io = mmp_map_io,
86 .nr_irqs = IRQ_BOARD_START, 87 .nr_irqs = MMP_NR_IRQS,
87 .init_irq = pxa168_init_irq, 88 .init_irq = pxa168_init_irq,
88 .timer = &pxa168_timer, 89 .timer = &pxa168_timer,
89 .init_machine = teton_bga_init, 90 .init_machine = teton_bga_init,
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index e72c709da44f..3fc9ed21f97d 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -38,7 +38,7 @@
38 * 16 board interrupts -- PCA9575 GPIO expander 38 * 16 board interrupts -- PCA9575 GPIO expander
39 * 24 board interrupts -- 88PM860x PMIC 39 * 24 board interrupts -- 88PM860x PMIC
40 */ 40 */
41#define TTCDKB_NR_IRQS (IRQ_BOARD_START + 16 + 16 + 24) 41#define TTCDKB_NR_IRQS (MMP_NR_IRQS + 16 + 16 + 24)
42 42
43static unsigned long ttc_dkb_pin_config[] __initdata = { 43static unsigned long ttc_dkb_pin_config[] __initdata = {
44 /* UART2 */ 44 /* UART2 */
@@ -131,7 +131,7 @@ static struct platform_device *ttc_dkb_devices[] = {
131static struct pca953x_platform_data max7312_data[] = { 131static struct pca953x_platform_data max7312_data[] = {
132 { 132 {
133 .gpio_base = TTCDKB_GPIO_EXT0(0), 133 .gpio_base = TTCDKB_GPIO_EXT0(0),
134 .irq_base = IRQ_BOARD_START, 134 .irq_base = MMP_NR_IRQS,
135 }, 135 },
136}; 136};
137 137
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index a60ab6d04ec5..3698a370d636 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -68,6 +68,11 @@ static struct platform_device *devices[] __initdata = {
68 68
69extern struct sys_timer msm_timer; 69extern struct sys_timer msm_timer;
70 70
71static void __init halibut_init_early(void)
72{
73 arch_ioremap_caller = __msm_ioremap_caller;
74}
75
71static void __init halibut_init_irq(void) 76static void __init halibut_init_irq(void)
72{ 77{
73 msm_init_irq(); 78 msm_init_irq();
@@ -96,6 +101,7 @@ MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
96 .atag_offset = 0x100, 101 .atag_offset = 0x100,
97 .fixup = halibut_fixup, 102 .fixup = halibut_fixup,
98 .map_io = halibut_map_io, 103 .map_io = halibut_map_io,
104 .init_early = halibut_init_early,
99 .init_irq = halibut_init_irq, 105 .init_irq = halibut_init_irq,
100 .init_machine = halibut_init, 106 .init_machine = halibut_init,
101 .timer = &msm_timer, 107 .timer = &msm_timer,
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index 97b8191d9d38..4a8ea0d40b6f 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -27,7 +27,6 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/system.h>
31#include <mach/system.h> 30#include <mach/system.h>
32#include <mach/vreg.h> 31#include <mach/vreg.h>
33#include <mach/board.h> 32#include <mach/board.h>
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 6b9b227c87c5..5414f76ec0a9 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -43,6 +43,11 @@ static struct platform_device *devices[] __initdata = {
43 43
44extern struct sys_timer msm_timer; 44extern struct sys_timer msm_timer;
45 45
46static void __init trout_init_early(void)
47{
48 arch_ioremap_caller = __msm_ioremap_caller;
49}
50
46static void __init trout_init_irq(void) 51static void __init trout_init_irq(void)
47{ 52{
48 msm_init_irq(); 53 msm_init_irq();
@@ -96,6 +101,7 @@ MACHINE_START(TROUT, "HTC Dream")
96 .atag_offset = 0x100, 101 .atag_offset = 0x100,
97 .fixup = trout_fixup, 102 .fixup = trout_fixup,
98 .map_io = trout_map_io, 103 .map_io = trout_map_io,
104 .init_early = trout_init_early,
99 .init_irq = trout_init_irq, 105 .init_irq = trout_init_irq,
100 .init_machine = trout_init, 106 .init_machine = trout_init,
101 .timer = &msm_timer, 107 .timer = &msm_timer,
diff --git a/arch/arm/mach-msm/include/mach/io.h b/arch/arm/mach-msm/include/mach/io.h
deleted file mode 100644
index dc1b928745e9..000000000000
--- a/arch/arm/mach-msm/include/mach/io.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/* arch/arm/mach-msm/include/mach/io.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __ASM_ARM_ARCH_IO_H
17#define __ASM_ARM_ARCH_IO_H
18
19#define IO_SPACE_LIMIT 0xffffffff
20
21#define __arch_ioremap __msm_ioremap
22#define __arch_iounmap __iounmap
23
24void __iomem *__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype);
25
26#define __io(a) __typesafe_io(a)
27#define __mem_pci(a) (a)
28
29void msm_map_qsd8x50_io(void);
30void msm_map_msm7x30_io(void);
31void msm_map_msm8x60_io(void);
32void msm_map_msm8960_io(void);
33
34extern unsigned int msm_shared_ram_phys;
35
36#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
index 8af46123dab6..6c4046c21296 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x00.h
@@ -38,12 +38,6 @@
38 * 38 *
39 */ 39 */
40 40
41#ifdef __ASSEMBLY__
42#define IOMEM(x) x
43#else
44#define IOMEM(x) ((void __force __iomem *)(x))
45#endif
46
47#define MSM_VIC_BASE IOMEM(0xE0000000) 41#define MSM_VIC_BASE IOMEM(0xE0000000)
48#define MSM_VIC_PHYS 0xC0000000 42#define MSM_VIC_PHYS 0xC0000000
49#define MSM_VIC_SIZE SZ_4K 43#define MSM_VIC_SIZE SZ_4K
@@ -111,5 +105,11 @@
111#define MSM_AD5_PHYS 0xAC000000 105#define MSM_AD5_PHYS 0xAC000000
112#define MSM_AD5_SIZE (SZ_1M*13) 106#define MSM_AD5_SIZE (SZ_1M*13)
113 107
108#ifndef __ASSEMBLY__
109
110extern void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size,
111 unsigned int mtype, void *caller);
112
113#endif
114 114
115#endif 115#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
index 198202c267c8..f944fe65a657 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-7x30.h
@@ -100,4 +100,8 @@
100#define MSM_HSUSB_PHYS 0xA3600000 100#define MSM_HSUSB_PHYS 0xA3600000
101#define MSM_HSUSB_SIZE SZ_1K 101#define MSM_HSUSB_SIZE SZ_1K
102 102
103#ifndef __ASSEMBLY__
104extern void msm_map_msm7x30_io(void);
105#endif
106
103#endif 107#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
index 800b55767e6b..a1752c0284fc 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8960.h
@@ -50,4 +50,8 @@
50#define MSM_DEBUG_UART_PHYS 0x16440000 50#define MSM_DEBUG_UART_PHYS 0x16440000
51#endif 51#endif
52 52
53#ifndef __ASSEMBLY__
54extern void msm_map_msm8960_io(void);
55#endif
56
53#endif 57#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
index 0faa894729b7..da77cc1d545d 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x50.h
@@ -122,4 +122,8 @@
122#define MSM_SDC4_PHYS 0xA0600000 122#define MSM_SDC4_PHYS 0xA0600000
123#define MSM_SDC4_SIZE SZ_4K 123#define MSM_SDC4_SIZE SZ_4K
124 124
125#ifndef __ASSEMBLY__
126extern void msm_map_qsd8x50_io(void);
127#endif
128
125#endif 129#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
index 54e12caa8d86..5aed57dc808c 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap-8x60.h
@@ -67,4 +67,8 @@
67#define MSM_DEBUG_UART_PHYS 0x19C40000 67#define MSM_DEBUG_UART_PHYS 0x19C40000
68#endif 68#endif
69 69
70#ifndef __ASSEMBLY__
71extern void msm_map_msm8x60_io(void);
72#endif
73
70#endif 74#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index 90682f4599d3..00afdfb8c38f 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -37,12 +37,6 @@
37 * 37 *
38 */ 38 */
39 39
40#ifdef __ASSEMBLY__
41#define IOMEM(x) x
42#else
43#define IOMEM(x) ((void __force __iomem *)(x))
44#endif
45
46#if defined(CONFIG_ARCH_MSM7X30) 40#if defined(CONFIG_ARCH_MSM7X30)
47#include "msm_iomap-7x30.h" 41#include "msm_iomap-7x30.h"
48#elif defined(CONFIG_ARCH_QSD8X50) 42#elif defined(CONFIG_ARCH_QSD8X50)
diff --git a/arch/arm/mach-msm/include/mach/uncompress.h b/arch/arm/mach-msm/include/mach/uncompress.h
index 169a84007456..c14011fe832d 100644
--- a/arch/arm/mach-msm/include/mach/uncompress.h
+++ b/arch/arm/mach-msm/include/mach/uncompress.h
@@ -16,6 +16,7 @@
16#ifndef __ASM_ARCH_MSM_UNCOMPRESS_H 16#ifndef __ASM_ARCH_MSM_UNCOMPRESS_H
17#define __ASM_ARCH_MSM_UNCOMPRESS_H 17#define __ASM_ARCH_MSM_UNCOMPRESS_H
18 18
19#include <asm/barrier.h>
19#include <asm/processor.h> 20#include <asm/processor.h>
20#include <mach/msm_iomap.h> 21#include <mach/msm_iomap.h>
21 22
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index 578b04e42deb..a1e7b1168850 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -172,8 +172,8 @@ void __init msm_map_msm7x30_io(void)
172} 172}
173#endif /* CONFIG_ARCH_MSM7X30 */ 173#endif /* CONFIG_ARCH_MSM7X30 */
174 174
175void __iomem * 175void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size,
176__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) 176 unsigned int mtype, void *caller)
177{ 177{
178 if (mtype == MT_DEVICE) { 178 if (mtype == MT_DEVICE) {
179 /* The peripherals in the 88000000 - D0000000 range 179 /* The peripherals in the 88000000 - D0000000 range
@@ -184,7 +184,5 @@ __msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
184 mtype = MT_DEVICE_NONSHARED; 184 mtype = MT_DEVICE_NONSHARED;
185 } 185 }
186 186
187 return __arm_ioremap_caller(phys_addr, size, mtype, 187 return __arm_ioremap_caller(phys_addr, size, mtype, caller);
188 __builtin_return_address(0));
189} 188}
190EXPORT_SYMBOL(__msm_ioremap);
diff --git a/arch/arm/mach-msm/smd_debug.c b/arch/arm/mach-msm/smd_debug.c
index 0c56a5aaf588..c56df9e932ae 100644
--- a/arch/arm/mach-msm/smd_debug.c
+++ b/arch/arm/mach-msm/smd_debug.c
@@ -203,15 +203,9 @@ static ssize_t debug_read(struct file *file, char __user *buf,
203 return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize); 203 return simple_read_from_buffer(buf, count, ppos, debug_buffer, bsize);
204} 204}
205 205
206static int debug_open(struct inode *inode, struct file *file)
207{
208 file->private_data = inode->i_private;
209 return 0;
210}
211
212static const struct file_operations debug_ops = { 206static const struct file_operations debug_ops = {
213 .read = debug_read, 207 .read = debug_read,
214 .open = debug_open, 208 .open = simple_open,
215 .llseek = default_llseek, 209 .llseek = default_llseek,
216}; 210};
217 211
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 75f4be40b3e5..812808254936 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -24,6 +24,7 @@
24#include <asm/mach/time.h> 24#include <asm/mach/time.h>
25#include <asm/hardware/gic.h> 25#include <asm/hardware/gic.h>
26#include <asm/localtimer.h> 26#include <asm/localtimer.h>
27#include <asm/sched_clock.h>
27 28
28#include <mach/msm_iomap.h> 29#include <mach/msm_iomap.h>
29#include <mach/cpu.h> 30#include <mach/cpu.h>
@@ -105,12 +106,12 @@ static union {
105 106
106static void __iomem *source_base; 107static void __iomem *source_base;
107 108
108static cycle_t msm_read_timer_count(struct clocksource *cs) 109static notrace cycle_t msm_read_timer_count(struct clocksource *cs)
109{ 110{
110 return readl_relaxed(source_base + TIMER_COUNT_VAL); 111 return readl_relaxed(source_base + TIMER_COUNT_VAL);
111} 112}
112 113
113static cycle_t msm_read_timer_count_shift(struct clocksource *cs) 114static notrace cycle_t msm_read_timer_count_shift(struct clocksource *cs)
114{ 115{
115 /* 116 /*
116 * Shift timer count down by a constant due to unreliable lower bits 117 * Shift timer count down by a constant due to unreliable lower bits
@@ -166,6 +167,11 @@ static struct local_timer_ops msm_local_timer_ops __cpuinitdata = {
166}; 167};
167#endif /* CONFIG_LOCAL_TIMERS */ 168#endif /* CONFIG_LOCAL_TIMERS */
168 169
170static notrace u32 msm_sched_clock_read(void)
171{
172 return msm_clocksource.read(&msm_clocksource);
173}
174
169static void __init msm_timer_init(void) 175static void __init msm_timer_init(void)
170{ 176{
171 struct clock_event_device *ce = &msm_clockevent; 177 struct clock_event_device *ce = &msm_clockevent;
@@ -232,6 +238,8 @@ err:
232 res = clocksource_register_hz(cs, dgt_hz); 238 res = clocksource_register_hz(cs, dgt_hz);
233 if (res) 239 if (res)
234 pr_err("clocksource_register failed\n"); 240 pr_err("clocksource_register failed\n");
241 setup_sched_clock(msm_sched_clock_read,
242 cpu_is_msm7x01() ? 32 - MSM_DGT_SHIFT : 32, dgt_hz);
235} 243}
236 244
237struct sys_timer msm_timer = { 245struct sys_timer msm_timer = {
diff --git a/arch/arm/mach-mv78xx0/include/mach/io.h b/arch/arm/mach-mv78xx0/include/mach/io.h
index 450e0e1ad092..c7d9d00d8fc1 100644
--- a/arch/arm/mach-mv78xx0/include/mach/io.h
+++ b/arch/arm/mach-mv78xx0/include/mach/io.h
@@ -20,7 +20,5 @@ static inline void __iomem *__io(unsigned long addr)
20} 20}
21 21
22#define __io(a) __io(a) 22#define __io(a) __io(a)
23#define __mem_pci(a) (a)
24
25 23
26#endif 24#endif
diff --git a/arch/arm/mach-mxs/include/mach/dma.h b/arch/arm/mach-mxs/include/mach/dma.h
deleted file mode 100644
index 203d7c4a3e11..000000000000
--- a/arch/arm/mach-mxs/include/mach/dma.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_MXS_DMA_H__
10#define __MACH_MXS_DMA_H__
11
12#include <linux/dmaengine.h>
13
14struct mxs_dma_data {
15 int chan_irq;
16};
17
18static inline int mxs_dma_is_apbh(struct dma_chan *chan)
19{
20 return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbh");
21}
22
23static inline int mxs_dma_is_apbx(struct dma_chan *chan)
24{
25 return !strcmp(dev_name(chan->device->dev), "mxs-dma-apbx");
26}
27
28#endif /* __MACH_MXS_DMA_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/hardware.h b/arch/arm/mach-mxs/include/mach/hardware.h
index 53e89a09bf0d..4c0e8a64d8c7 100644
--- a/arch/arm/mach-mxs/include/mach/hardware.h
+++ b/arch/arm/mach-mxs/include/mach/hardware.h
@@ -20,10 +20,4 @@
20#ifndef __MACH_MXS_HARDWARE_H__ 20#ifndef __MACH_MXS_HARDWARE_H__
21#define __MACH_MXS_HARDWARE_H__ 21#define __MACH_MXS_HARDWARE_H__
22 22
23#ifdef __ASSEMBLER__
24#define IOMEM(addr) (addr)
25#else
26#define IOMEM(addr) ((void __force __iomem *)(addr))
27#endif
28
29#endif /* __MACH_MXS_HARDWARE_H__ */ 23#endif /* __MACH_MXS_HARDWARE_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/io.h b/arch/arm/mach-mxs/include/mach/io.h
deleted file mode 100644
index 289b7227e072..000000000000
--- a/arch/arm/mach-mxs/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
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#ifndef __MACH_MXS_IO_H__
12#define __MACH_MXS_IO_H__
13
14/* Allow IO space to be anywhere in the memory */
15#define IO_SPACE_LIMIT 0xffffffff
16
17/* io address mapping macro */
18#define __io(a) __typesafe_io(a)
19
20#define __mem_pci(a) (a)
21
22#endif /* __MACH_MXS_IO_H__ */
diff --git a/arch/arm/mach-mxs/system.c b/arch/arm/mach-mxs/system.c
index 7aa5ac5d78bf..80ac1fca8a00 100644
--- a/arch/arm/mach-mxs/system.c
+++ b/arch/arm/mach-mxs/system.c
@@ -25,7 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26 26
27#include <asm/proc-fns.h> 27#include <asm/proc-fns.h>
28#include <asm/system.h> 28#include <asm/system_misc.h>
29 29
30#include <mach/mxs.h> 30#include <mach/mxs.h>
31#include <mach/common.h> 31#include <mach/common.h>
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
index 59e67979f197..aa627465d914 100644
--- a/arch/arm/mach-netx/generic.c
+++ b/arch/arm/mach-netx/generic.c
@@ -168,7 +168,7 @@ void __init netx_init_irq(void)
168{ 168{
169 int irq; 169 int irq;
170 170
171 vic_init(__io(io_p2v(NETX_PA_VIC)), 0, ~0, 0); 171 vic_init(io_p2v(NETX_PA_VIC), 0, ~0, 0);
172 172
173 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) { 173 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) {
174 irq_set_chip_and_handler(irq, &netx_hif_chip, 174 irq_set_chip_and_handler(irq, &netx_hif_chip,
diff --git a/arch/arm/mach-netx/include/mach/hardware.h b/arch/arm/mach-netx/include/mach/hardware.h
index 517a2bd37842..b661af2f2145 100644
--- a/arch/arm/mach-netx/include/mach/hardware.h
+++ b/arch/arm/mach-netx/include/mach/hardware.h
@@ -33,7 +33,7 @@
33#define XMAC_MEM_SIZE 0x1000 33#define XMAC_MEM_SIZE 0x1000
34#define SRAM_MEM_SIZE 0x8000 34#define SRAM_MEM_SIZE 0x8000
35 35
36#define io_p2v(x) ((x) - NETX_IO_PHYS + NETX_IO_VIRT) 36#define io_p2v(x) IOMEM((x) - NETX_IO_PHYS + NETX_IO_VIRT)
37#define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS) 37#define io_v2p(x) ((x) - NETX_IO_VIRT + NETX_IO_PHYS)
38 38
39#endif 39#endif
diff --git a/arch/arm/mach-netx/include/mach/io.h b/arch/arm/mach-netx/include/mach/io.h
deleted file mode 100644
index c3921cb3b6a6..000000000000
--- a/arch/arm/mach-netx/include/mach/io.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * arch/arm/mach-netx/include/mach/io.h
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
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
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a)
27
28#endif
diff --git a/arch/arm/mach-netx/include/mach/netx-regs.h b/arch/arm/mach-netx/include/mach/netx-regs.h
index 5a03e7ccb01a..fdde22b58ac3 100644
--- a/arch/arm/mach-netx/include/mach/netx-regs.h
+++ b/arch/arm/mach-netx/include/mach/netx-regs.h
@@ -115,7 +115,7 @@
115 *********************************/ 115 *********************************/
116 116
117/* Registers */ 117/* Registers */
118#define NETX_SYSTEM_REG(ofs) __io(NETX_VA_SYSTEM + (ofs)) 118#define NETX_SYSTEM_REG(ofs) IOMEM(NETX_VA_SYSTEM + (ofs))
119#define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00) 119#define NETX_SYSTEM_BOO_SR NETX_SYSTEM_REG(0x00)
120#define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04) 120#define NETX_SYSTEM_IOC_CR NETX_SYSTEM_REG(0x04)
121#define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08) 121#define NETX_SYSTEM_IOC_MR NETX_SYSTEM_REG(0x08)
@@ -185,7 +185,7 @@
185 *******************************/ 185 *******************************/
186 186
187/* Registers */ 187/* Registers */
188#define NETX_GPIO_REG(ofs) __io(NETX_VA_GPIO + (ofs)) 188#define NETX_GPIO_REG(ofs) IOMEM(NETX_VA_GPIO + (ofs))
189#define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2)) 189#define NETX_GPIO_CFG(gpio) NETX_GPIO_REG(0x0 + ((gpio)<<2))
190#define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2)) 190#define NETX_GPIO_THRESHOLD_CAPTURE(gpio) NETX_GPIO_REG(0x40 + ((gpio)<<2))
191#define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2)) 191#define NETX_GPIO_COUNTER_CTRL(counter) NETX_GPIO_REG(0x80 + ((counter)<<2))
@@ -230,7 +230,7 @@
230 *******************************/ 230 *******************************/
231 231
232/* Registers */ 232/* Registers */
233#define NETX_PIO_REG(ofs) __io(NETX_VA_PIO + (ofs)) 233#define NETX_PIO_REG(ofs) IOMEM(NETX_VA_PIO + (ofs))
234#define NETX_PIO_INPIO NETX_PIO_REG(0x0) 234#define NETX_PIO_INPIO NETX_PIO_REG(0x0)
235#define NETX_PIO_OUTPIO NETX_PIO_REG(0x4) 235#define NETX_PIO_OUTPIO NETX_PIO_REG(0x4)
236#define NETX_PIO_OEPIO NETX_PIO_REG(0x8) 236#define NETX_PIO_OEPIO NETX_PIO_REG(0x8)
@@ -240,7 +240,7 @@
240 *******************************/ 240 *******************************/
241 241
242/* Registers */ 242/* Registers */
243#define NETX_MIIMU __io(NETX_VA_MIIMU) 243#define NETX_MIIMU IOMEM(NETX_VA_MIIMU)
244 244
245/* Bits */ 245/* Bits */
246#define MIIMU_SNRDY (1<<0) 246#define MIIMU_SNRDY (1<<0)
@@ -317,7 +317,7 @@
317 *******************************/ 317 *******************************/
318 318
319/* Registers */ 319/* Registers */
320#define NETX_PFIFO_REG(ofs) __io(NETX_VA_PFIFO + (ofs)) 320#define NETX_PFIFO_REG(ofs) IOMEM(NETX_VA_PFIFO + (ofs))
321#define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2)) 321#define NETX_PFIFO_BASE(pfifo) NETX_PFIFO_REG(0x00 + ((pfifo)<<2))
322#define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2)) 322#define NETX_PFIFO_BORDER_BASE(pfifo) NETX_PFIFO_REG(0x80 + ((pfifo)<<2))
323#define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100) 323#define NETX_PFIFO_RESET NETX_PFIFO_REG(0x100)
@@ -334,7 +334,7 @@
334 *******************************/ 334 *******************************/
335 335
336/* Registers */ 336/* Registers */
337#define NETX_MEMCR_REG(ofs) __io(NETX_VA_MEMCR + (ofs)) 337#define NETX_MEMCR_REG(ofs) IOMEM(NETX_VA_MEMCR + (ofs))
338#define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */ 338#define NETX_MEMCR_SRAM_CTRL(cs) NETX_MEMCR_REG(0x0 + 4 * (cs)) /* SRAM for CS 0..2 */
339#define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40) 339#define NETX_MEMCR_SDRAM_CFG_CTRL NETX_MEMCR_REG(0x40)
340#define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44) 340#define NETX_MEMCR_SDRAM_TIMING_CTRL NETX_MEMCR_REG(0x44)
@@ -355,7 +355,7 @@
355 *******************************/ 355 *******************************/
356 356
357/* Registers */ 357/* Registers */
358#define NETX_DPMAS_REG(ofs) __io(NETX_VA_DPMAS + (ofs)) 358#define NETX_DPMAS_REG(ofs) IOMEM(NETX_VA_DPMAS + (ofs))
359#define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8) 359#define NETX_DPMAS_SYS_STAT NETX_DPMAS_REG(0x4d8)
360#define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0) 360#define NETX_DPMAS_INT_STAT NETX_DPMAS_REG(0x4e0)
361#define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0) 361#define NETX_DPMAS_INT_EN NETX_DPMAS_REG(0x4f0)
@@ -425,7 +425,7 @@
425/******************************* 425/*******************************
426 * I2C * 426 * I2C *
427 *******************************/ 427 *******************************/
428#define NETX_I2C_REG(ofs) __io(NETX_VA_I2C, (ofs)) 428#define NETX_I2C_REG(ofs) IOMEM(NETX_VA_I2C, (ofs))
429#define NETX_I2C_CTRL NETX_I2C_REG(0x0) 429#define NETX_I2C_CTRL NETX_I2C_REG(0x0)
430#define NETX_I2C_DATA NETX_I2C_REG(0x4) 430#define NETX_I2C_DATA NETX_I2C_REG(0x4)
431 431
diff --git a/arch/arm/mach-nomadik/include/mach/io.h b/arch/arm/mach-nomadik/include/mach/io.h
deleted file mode 100644
index 2e1eca1b8243..000000000000
--- a/arch/arm/mach-nomadik/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-nomadik/include/mach/io.h (copied from mach-sa1100)
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * Modifications:
7 * 06-12-1997 RMK Created.
8 * 07-04-1999 RMK Major cleanup
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13#define IO_SPACE_LIMIT 0xffffffff
14
15/*
16 * We don't actually have real ISA nor PCI buses, but there is so many
17 * drivers out there that might just work if we fake them...
18 */
19#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a)
21
22#endif
diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
index 399c4c49722f..a051cb8ae57f 100644
--- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S
+++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <asm/assembler.h>
17 18
18#include <plat/board-ams-delta.h> 19#include <plat/board-ams-delta.h>
19 20
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index c3068622fdcb..553a2e535764 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -245,8 +245,6 @@ static struct resource h2_smc91x_resources[] = {
245 .flags = IORESOURCE_MEM, 245 .flags = IORESOURCE_MEM,
246 }, 246 },
247 [1] = { 247 [1] = {
248 .start = OMAP_GPIO_IRQ(0),
249 .end = OMAP_GPIO_IRQ(0),
250 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 248 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
251 }, 249 },
252}; 250};
@@ -359,11 +357,9 @@ static struct tps65010_board tps_board = {
359static struct i2c_board_info __initdata h2_i2c_board_info[] = { 357static struct i2c_board_info __initdata h2_i2c_board_info[] = {
360 { 358 {
361 I2C_BOARD_INFO("tps65010", 0x48), 359 I2C_BOARD_INFO("tps65010", 0x48),
362 .irq = OMAP_GPIO_IRQ(58),
363 .platform_data = &tps_board, 360 .platform_data = &tps_board,
364 }, { 361 }, {
365 I2C_BOARD_INFO("isp1301_omap", 0x2d), 362 I2C_BOARD_INFO("isp1301_omap", 0x2d),
366 .irq = OMAP_GPIO_IRQ(2),
367 }, 363 },
368}; 364};
369 365
@@ -428,8 +424,12 @@ static void __init h2_init(void)
428 omap_cfg_reg(E19_1610_KBR4); 424 omap_cfg_reg(E19_1610_KBR4);
429 omap_cfg_reg(N19_1610_KBR5); 425 omap_cfg_reg(N19_1610_KBR5);
430 426
427 h2_smc91x_resources[1].start = gpio_to_irq(0);
428 h2_smc91x_resources[1].end = gpio_to_irq(0);
431 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices)); 429 platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
432 omap_serial_init(); 430 omap_serial_init();
431 h2_i2c_board_info[0].irq = gpio_to_irq(58);
432 h2_i2c_board_info[1].irq = gpio_to_irq(2);
433 omap_register_i2c_bus(1, 100, h2_i2c_board_info, 433 omap_register_i2c_bus(1, 100, h2_i2c_board_info,
434 ARRAY_SIZE(h2_i2c_board_info)); 434 ARRAY_SIZE(h2_i2c_board_info));
435 omap1_usb_init(&h2_usb_config); 435 omap1_usb_init(&h2_usb_config);
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 64b8584f64ce..4c19f4c06851 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -247,8 +247,6 @@ static struct resource smc91x_resources[] = {
247 .flags = IORESOURCE_MEM, 247 .flags = IORESOURCE_MEM,
248 }, 248 },
249 [1] = { 249 [1] = {
250 .start = OMAP_GPIO_IRQ(40),
251 .end = OMAP_GPIO_IRQ(40),
252 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 250 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
253 }, 251 },
254}; 252};
@@ -338,7 +336,6 @@ static struct spi_board_info h3_spi_board_info[] __initdata = {
338 .modalias = "tsc2101", 336 .modalias = "tsc2101",
339 .bus_num = 2, 337 .bus_num = 2,
340 .chip_select = 0, 338 .chip_select = 0,
341 .irq = OMAP_GPIO_IRQ(H3_TS_GPIO),
342 .max_speed_hz = 16000000, 339 .max_speed_hz = 16000000,
343 /* .platform_data = &tsc_platform_data, */ 340 /* .platform_data = &tsc_platform_data, */
344 }, 341 },
@@ -374,11 +371,9 @@ static struct omap_lcd_config h3_lcd_config __initdata = {
374static struct i2c_board_info __initdata h3_i2c_board_info[] = { 371static struct i2c_board_info __initdata h3_i2c_board_info[] = {
375 { 372 {
376 I2C_BOARD_INFO("tps65013", 0x48), 373 I2C_BOARD_INFO("tps65013", 0x48),
377 /* .irq = OMAP_GPIO_IRQ(??), */
378 }, 374 },
379 { 375 {
380 I2C_BOARD_INFO("isp1301_omap", 0x2d), 376 I2C_BOARD_INFO("isp1301_omap", 0x2d),
381 .irq = OMAP_GPIO_IRQ(14),
382 }, 377 },
383}; 378};
384 379
@@ -420,10 +415,14 @@ static void __init h3_init(void)
420 omap_cfg_reg(E19_1610_KBR4); 415 omap_cfg_reg(E19_1610_KBR4);
421 omap_cfg_reg(N19_1610_KBR5); 416 omap_cfg_reg(N19_1610_KBR5);
422 417
418 smc91x_resources[1].start = gpio_to_irq(40);
419 smc91x_resources[1].end = gpio_to_irq(40);
423 platform_add_devices(devices, ARRAY_SIZE(devices)); 420 platform_add_devices(devices, ARRAY_SIZE(devices));
421 h3_spi_board_info[0].irq = gpio_to_irq(H3_TS_GPIO);
424 spi_register_board_info(h3_spi_board_info, 422 spi_register_board_info(h3_spi_board_info,
425 ARRAY_SIZE(h3_spi_board_info)); 423 ARRAY_SIZE(h3_spi_board_info));
426 omap_serial_init(); 424 omap_serial_init();
425 h3_i2c_board_info[1].irq = gpio_to_irq(14);
427 omap_register_i2c_bus(1, 100, h3_i2c_board_info, 426 omap_register_i2c_bus(1, 100, h3_i2c_board_info,
428 ARRAY_SIZE(h3_i2c_board_info)); 427 ARRAY_SIZE(h3_i2c_board_info));
429 omap1_usb_init(&h3_usb_config); 428 omap1_usb_init(&h3_usb_config);
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 827d83a96af8..60c06ee23855 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -324,8 +324,6 @@ static struct platform_device gpio_leds_device = {
324 324
325static struct resource htcpld_resources[] = { 325static struct resource htcpld_resources[] = {
326 [0] = { 326 [0] = {
327 .start = OMAP_GPIO_IRQ(HTCHERALD_GIRQ_BTNS),
328 .end = OMAP_GPIO_IRQ(HTCHERALD_GIRQ_BTNS),
329 .flags = IORESOURCE_IRQ, 327 .flags = IORESOURCE_IRQ,
330 }, 328 },
331}; 329};
@@ -450,7 +448,6 @@ static struct spi_board_info __initdata htcherald_spi_board_info[] = {
450 { 448 {
451 .modalias = "ads7846", 449 .modalias = "ads7846",
452 .platform_data = &htcherald_ts_platform_data, 450 .platform_data = &htcherald_ts_platform_data,
453 .irq = OMAP_GPIO_IRQ(HTCHERALD_GPIO_TS),
454 .max_speed_hz = 2500000, 451 .max_speed_hz = 2500000,
455 .bus_num = 2, 452 .bus_num = 2,
456 .chip_select = 1, 453 .chip_select = 1,
@@ -576,6 +573,8 @@ static void __init htcherald_init(void)
576 printk(KERN_INFO "HTC Herald init.\n"); 573 printk(KERN_INFO "HTC Herald init.\n");
577 574
578 /* Do board initialization before we register all the devices */ 575 /* Do board initialization before we register all the devices */
576 htcpld_resources[0].start = gpio_to_irq(HTCHERALD_GIRQ_BTNS);
577 htcpld_resources[0].end = gpio_to_irq(HTCHERALD_GIRQ_BTNS);
579 platform_add_devices(devices, ARRAY_SIZE(devices)); 578 platform_add_devices(devices, ARRAY_SIZE(devices));
580 579
581 htcherald_disable_watchdog(); 580 htcherald_disable_watchdog();
@@ -583,6 +582,7 @@ static void __init htcherald_init(void)
583 htcherald_usb_enable(); 582 htcherald_usb_enable();
584 omap1_usb_init(&htcherald_usb_config); 583 omap1_usb_init(&htcherald_usb_config);
585 584
585 htcherald_spi_board_info[0].irq = gpio_to_irq(HTCHERALD_GPIO_TS);
586 spi_register_board_info(htcherald_spi_board_info, 586 spi_register_board_info(htcherald_spi_board_info,
587 ARRAY_SIZE(htcherald_spi_board_info)); 587 ARRAY_SIZE(htcherald_spi_board_info));
588 588
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 61219182d16a..67d7fd57a692 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -248,8 +248,6 @@ static struct resource innovator1610_smc91x_resources[] = {
248 .flags = IORESOURCE_MEM, 248 .flags = IORESOURCE_MEM,
249 }, 249 },
250 [1] = { 250 [1] = {
251 .start = OMAP_GPIO_IRQ(0),
252 .end = OMAP_GPIO_IRQ(0),
253 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 251 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
254 }, 252 },
255}; 253};
@@ -409,6 +407,8 @@ static void __init innovator_init(void)
409#endif 407#endif
410#ifdef CONFIG_ARCH_OMAP16XX 408#ifdef CONFIG_ARCH_OMAP16XX
411 if (!cpu_is_omap1510()) { 409 if (!cpu_is_omap1510()) {
410 innovator1610_smc91x_resources[1].start = gpio_to_irq(0);
411 innovator1610_smc91x_resources[1].end = gpio_to_irq(0);
412 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices)); 412 platform_add_devices(innovator1610_devices, ARRAY_SIZE(innovator1610_devices));
413 } 413 }
414#endif 414#endif
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index fe95ec5f6f03..d21dcc2fbc5a 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -147,7 +147,6 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = {
147 .bus_num = 2, 147 .bus_num = 2,
148 .chip_select = 0, 148 .chip_select = 0,
149 .max_speed_hz = 2500000, 149 .max_speed_hz = 2500000,
150 .irq = OMAP_GPIO_IRQ(15),
151 .platform_data = &nokia770_ads7846_platform_data, 150 .platform_data = &nokia770_ads7846_platform_data,
152 }, 151 },
153}; 152};
@@ -237,6 +236,7 @@ static void __init omap_nokia770_init(void)
237 omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004); 236 omap_writew((omap_readw(0xfffb5004) & ~2), 0xfffb5004);
238 237
239 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); 238 platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices));
239 nokia770_spi_board_info[1].irq = gpio_to_irq(15);
240 spi_register_board_info(nokia770_spi_board_info, 240 spi_register_board_info(nokia770_spi_board_info,
241 ARRAY_SIZE(nokia770_spi_board_info)); 241 ARRAY_SIZE(nokia770_spi_board_info));
242 omap_serial_init(); 242 omap_serial_init();
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 1fe347396f4d..a5f85dda3f69 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -129,8 +129,6 @@ static struct resource osk5912_smc91x_resources[] = {
129 .flags = IORESOURCE_MEM, 129 .flags = IORESOURCE_MEM,
130 }, 130 },
131 [1] = { 131 [1] = {
132 .start = OMAP_GPIO_IRQ(0),
133 .end = OMAP_GPIO_IRQ(0),
134 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 132 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
135 }, 133 },
136}; 134};
@@ -147,8 +145,6 @@ static struct platform_device osk5912_smc91x_device = {
147 145
148static struct resource osk5912_cf_resources[] = { 146static struct resource osk5912_cf_resources[] = {
149 [0] = { 147 [0] = {
150 .start = OMAP_GPIO_IRQ(62),
151 .end = OMAP_GPIO_IRQ(62),
152 .flags = IORESOURCE_IRQ, 148 .flags = IORESOURCE_IRQ,
153 }, 149 },
154}; 150};
@@ -240,7 +236,6 @@ static struct tps65010_board tps_board = {
240static struct i2c_board_info __initdata osk_i2c_board_info[] = { 236static struct i2c_board_info __initdata osk_i2c_board_info[] = {
241 { 237 {
242 I2C_BOARD_INFO("tps65010", 0x48), 238 I2C_BOARD_INFO("tps65010", 0x48),
243 .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)),
244 .platform_data = &tps_board, 239 .platform_data = &tps_board,
245 240
246 }, 241 },
@@ -408,7 +403,6 @@ static struct spi_board_info __initdata mistral_boardinfo[] = { {
408 /* MicroWire (bus 2) CS0 has an ads7846e */ 403 /* MicroWire (bus 2) CS0 has an ads7846e */
409 .modalias = "ads7846", 404 .modalias = "ads7846",
410 .platform_data = &mistral_ts_info, 405 .platform_data = &mistral_ts_info,
411 .irq = OMAP_GPIO_IRQ(4),
412 .max_speed_hz = 120000 /* max sample rate at 3V */ 406 .max_speed_hz = 120000 /* max sample rate at 3V */
413 * 26 /* command + data + overhead */, 407 * 26 /* command + data + overhead */,
414 .bus_num = 2, 408 .bus_num = 2,
@@ -471,6 +465,7 @@ static void __init osk_mistral_init(void)
471 gpio_direction_input(4); 465 gpio_direction_input(4);
472 irq_set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING); 466 irq_set_irq_type(gpio_to_irq(4), IRQ_TYPE_EDGE_FALLING);
473 467
468 mistral_boardinfo[0].irq = gpio_to_irq(4);
474 spi_register_board_info(mistral_boardinfo, 469 spi_register_board_info(mistral_boardinfo,
475 ARRAY_SIZE(mistral_boardinfo)); 470 ARRAY_SIZE(mistral_boardinfo));
476 471
@@ -542,6 +537,10 @@ static void __init osk_init(void)
542 537
543 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys(); 538 osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
544 osk_flash_resource.end += SZ_32M - 1; 539 osk_flash_resource.end += SZ_32M - 1;
540 osk5912_smc91x_resources[1].start = gpio_to_irq(0);
541 osk5912_smc91x_resources[1].end = gpio_to_irq(0);
542 osk5912_cf_resources[0].start = gpio_to_irq(62);
543 osk5912_cf_resources[0].end = gpio_to_irq(62);
545 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices)); 544 platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
546 545
547 l = omap_readl(USB_TRANSCEIVER_CTRL); 546 l = omap_readl(USB_TRANSCEIVER_CTRL);
@@ -556,6 +555,7 @@ static void __init osk_init(void)
556 gpio_direction_input(OMAP_MPUIO(1)); 555 gpio_direction_input(OMAP_MPUIO(1));
557 556
558 omap_serial_init(); 557 omap_serial_init();
558 osk_i2c_board_info[0].irq = gpio_to_irq(OMAP_MPUIO(1));
559 omap_register_i2c_bus(1, 400, osk_i2c_board_info, 559 omap_register_i2c_bus(1, 400, osk_i2c_board_info,
560 ARRAY_SIZE(osk_i2c_board_info)); 560 ARRAY_SIZE(osk_i2c_board_info));
561 osk_mistral_init(); 561 osk_mistral_init();
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 0863d8e2bdf1..a60e6c22f816 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -217,7 +217,6 @@ static struct spi_board_info palmte_spi_info[] __initdata = {
217 .modalias = "tsc2102", 217 .modalias = "tsc2102",
218 .bus_num = 2, /* uWire (officially) */ 218 .bus_num = 2, /* uWire (officially) */
219 .chip_select = 0, /* As opposed to 3 */ 219 .chip_select = 0, /* As opposed to 3 */
220 .irq = OMAP_GPIO_IRQ(PALMTE_PINTDAV_GPIO),
221 .max_speed_hz = 8000000, 220 .max_speed_hz = 8000000,
222 }, 221 },
223}; 222};
@@ -251,6 +250,7 @@ static void __init omap_palmte_init(void)
251 250
252 platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices)); 251 platform_add_devices(palmte_devices, ARRAY_SIZE(palmte_devices));
253 252
253 palmte_spi_info[0].irq = gpio_to_irq(PALMTE_PINTDAV_GPIO);
254 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info)); 254 spi_register_board_info(palmte_spi_info, ARRAY_SIZE(palmte_spi_info));
255 palmte_misc_gpio_setup(); 255 palmte_misc_gpio_setup();
256 omap_serial_init(); 256 omap_serial_init();
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 4ff699c509c0..8d854878547b 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -257,7 +257,6 @@ static struct spi_board_info __initdata palmtt_boardinfo[] = {
257 /* MicroWire (bus 2) CS0 has an ads7846e */ 257 /* MicroWire (bus 2) CS0 has an ads7846e */
258 .modalias = "ads7846", 258 .modalias = "ads7846",
259 .platform_data = &palmtt_ts_info, 259 .platform_data = &palmtt_ts_info,
260 .irq = OMAP_GPIO_IRQ(6),
261 .max_speed_hz = 120000 /* max sample rate at 3V */ 260 .max_speed_hz = 120000 /* max sample rate at 3V */
262 * 26 /* command + data + overhead */, 261 * 26 /* command + data + overhead */,
263 .bus_num = 2, 262 .bus_num = 2,
@@ -298,6 +297,7 @@ static void __init omap_palmtt_init(void)
298 297
299 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices)); 298 platform_add_devices(palmtt_devices, ARRAY_SIZE(palmtt_devices));
300 299
300 palmtt_boardinfo[0].irq = gpio_to_irq(6);
301 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo)); 301 spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
302 omap_serial_init(); 302 omap_serial_init();
303 omap1_usb_init(&palmtt_usb_config); 303 omap1_usb_init(&palmtt_usb_config);
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index abcbbd339aeb..a2c5abcd7c84 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -224,7 +224,6 @@ static struct spi_board_info __initdata palmz71_boardinfo[] = { {
224 /* MicroWire (bus 2) CS0 has an ads7846e */ 224 /* MicroWire (bus 2) CS0 has an ads7846e */
225 .modalias = "ads7846", 225 .modalias = "ads7846",
226 .platform_data = &palmz71_ts_info, 226 .platform_data = &palmz71_ts_info,
227 .irq = OMAP_GPIO_IRQ(PALMZ71_PENIRQ_GPIO),
228 .max_speed_hz = 120000 /* max sample rate at 3V */ 227 .max_speed_hz = 120000 /* max sample rate at 3V */
229 * 26 /* command + data + overhead */, 228 * 26 /* command + data + overhead */,
230 .bus_num = 2, 229 .bus_num = 2,
@@ -313,6 +312,7 @@ omap_palmz71_init(void)
313 312
314 platform_add_devices(devices, ARRAY_SIZE(devices)); 313 platform_add_devices(devices, ARRAY_SIZE(devices));
315 314
315 palmz71_boardinfo[0].irq = gpio_to_irq(PALMZ71_PENIRQ_GPIO);
316 spi_register_board_info(palmz71_boardinfo, 316 spi_register_board_info(palmz71_boardinfo,
317 ARRAY_SIZE(palmz71_boardinfo)); 317 ARRAY_SIZE(palmz71_boardinfo));
318 omap1_usb_init(&palmz71_usb_config); 318 omap1_usb_init(&palmz71_usb_config);
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 659d0f75de2c..37232d04233f 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -44,7 +44,6 @@
44static struct plat_serial8250_port voiceblue_ports[] = { 44static struct plat_serial8250_port voiceblue_ports[] = {
45 { 45 {
46 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x40000), 46 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x40000),
47 .irq = OMAP_GPIO_IRQ(12),
48 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 47 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
49 .iotype = UPIO_MEM, 48 .iotype = UPIO_MEM,
50 .regshift = 1, 49 .regshift = 1,
@@ -52,7 +51,6 @@ static struct plat_serial8250_port voiceblue_ports[] = {
52 }, 51 },
53 { 52 {
54 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x50000), 53 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x50000),
55 .irq = OMAP_GPIO_IRQ(13),
56 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 54 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
57 .iotype = UPIO_MEM, 55 .iotype = UPIO_MEM,
58 .regshift = 1, 56 .regshift = 1,
@@ -60,7 +58,6 @@ static struct plat_serial8250_port voiceblue_ports[] = {
60 }, 58 },
61 { 59 {
62 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x60000), 60 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x60000),
63 .irq = OMAP_GPIO_IRQ(14),
64 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 61 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
65 .iotype = UPIO_MEM, 62 .iotype = UPIO_MEM,
66 .regshift = 1, 63 .regshift = 1,
@@ -68,7 +65,6 @@ static struct plat_serial8250_port voiceblue_ports[] = {
68 }, 65 },
69 { 66 {
70 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x70000), 67 .mapbase = (unsigned long)(OMAP_CS1_PHYS + 0x70000),
71 .irq = OMAP_GPIO_IRQ(15),
72 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, 68 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
73 .iotype = UPIO_MEM, 69 .iotype = UPIO_MEM,
74 .regshift = 1, 70 .regshift = 1,
@@ -80,9 +76,6 @@ static struct plat_serial8250_port voiceblue_ports[] = {
80static struct platform_device serial_device = { 76static struct platform_device serial_device = {
81 .name = "serial8250", 77 .name = "serial8250",
82 .id = PLAT8250_DEV_PLATFORM1, 78 .id = PLAT8250_DEV_PLATFORM1,
83 .dev = {
84 .platform_data = voiceblue_ports,
85 },
86}; 79};
87 80
88static int __init ext_uart_init(void) 81static int __init ext_uart_init(void)
@@ -90,6 +83,11 @@ static int __init ext_uart_init(void)
90 if (!machine_is_voiceblue()) 83 if (!machine_is_voiceblue())
91 return -ENODEV; 84 return -ENODEV;
92 85
86 voiceblue_ports[0].irq = gpio_to_irq(12);
87 voiceblue_ports[1].irq = gpio_to_irq(13);
88 voiceblue_ports[2].irq = gpio_to_irq(14);
89 voiceblue_ports[3].irq = gpio_to_irq(15);
90 serial_device.dev.platform_data = voiceblue_ports;
93 return platform_device_register(&serial_device); 91 return platform_device_register(&serial_device);
94} 92}
95arch_initcall(ext_uart_init); 93arch_initcall(ext_uart_init);
@@ -128,8 +126,6 @@ static struct resource voiceblue_smc91x_resources[] = {
128 .flags = IORESOURCE_MEM, 126 .flags = IORESOURCE_MEM,
129 }, 127 },
130 [1] = { 128 [1] = {
131 .start = OMAP_GPIO_IRQ(8),
132 .end = OMAP_GPIO_IRQ(8),
133 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 129 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
134 }, 130 },
135}; 131};
@@ -275,6 +271,8 @@ static void __init voiceblue_init(void)
275 irq_set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING); 271 irq_set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING);
276 irq_set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING); 272 irq_set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING);
277 273
274 voiceblue_smc91x_resources[1].start = gpio_to_irq(8);
275 voiceblue_smc91x_resources[1].end = gpio_to_irq(8);
278 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices)); 276 platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
279 omap_board_config = voiceblue_config; 277 omap_board_config = voiceblue_config;
280 omap_board_config_size = ARRAY_SIZE(voiceblue_config); 278 omap_board_config_size = ARRAY_SIZE(voiceblue_config);
diff --git a/arch/arm/mach-omap1/flash.c b/arch/arm/mach-omap1/flash.c
index f9bf78d4fdfb..401eb3c080c2 100644
--- a/arch/arm/mach-omap1/flash.c
+++ b/arch/arm/mach-omap1/flash.c
@@ -17,20 +17,12 @@
17 17
18void omap1_set_vpp(struct platform_device *pdev, int enable) 18void omap1_set_vpp(struct platform_device *pdev, int enable)
19{ 19{
20 static int count;
21 u32 l; 20 u32 l;
22 21
23 if (enable) { 22 l = omap_readl(EMIFS_CONFIG);
24 if (count++ == 0) { 23 if (enable)
25 l = omap_readl(EMIFS_CONFIG); 24 l |= OMAP_EMIFS_CONFIG_WP;
26 l |= OMAP_EMIFS_CONFIG_WP; 25 else
27 omap_writel(l, EMIFS_CONFIG); 26 l &= ~OMAP_EMIFS_CONFIG_WP;
28 } 27 omap_writel(l, EMIFS_CONFIG);
29 } else {
30 if (count && (--count == 0)) {
31 l = omap_readl(EMIFS_CONFIG);
32 l &= ~OMAP_EMIFS_CONFIG_WP;
33 omap_writel(l, EMIFS_CONFIG);
34 }
35 }
36} 28}
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
index f24c1e2c5044..2b28e1da14b0 100644
--- a/arch/arm/mach-omap1/id.c
+++ b/arch/arm/mach-omap1/id.c
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <asm/system_info.h>
18 19
19#include <plat/cpu.h> 20#include <plat/cpu.h>
20 21
diff --git a/arch/arm/mach-omap1/include/mach/entry-macro.S b/arch/arm/mach-omap1/include/mach/entry-macro.S
index fa0f32a686aa..88f08cab1717 100644
--- a/arch/arm/mach-omap1/include/mach/entry-macro.S
+++ b/arch/arm/mach-omap1/include/mach/entry-macro.S
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14#include <mach/io.h>
15#include <mach/irqs.h> 14#include <mach/irqs.h>
16 15
17#include "../../iomap.h" 16#include "../../iomap.h"
diff --git a/arch/arm/mach-omap1/include/mach/io.h b/arch/arm/mach-omap1/include/mach/io.h
index 37b12e1fd022..ce4f8005b26f 100644
--- a/arch/arm/mach-omap1/include/mach/io.h
+++ b/arch/arm/mach-omap1/include/mach/io.h
@@ -41,6 +41,5 @@
41 * drivers out there that might just work if we fake them... 41 * drivers out there that might just work if we fake them...
42 */ 42 */
43#define __io(a) __typesafe_io(a) 43#define __io(a) __typesafe_io(a)
44#define __mem_pci(a) (a)
45 44
46#endif 45#endif
diff --git a/arch/arm/mach-omap1/iomap.h b/arch/arm/mach-omap1/iomap.h
index d68175761c3d..330c4716b028 100644
--- a/arch/arm/mach-omap1/iomap.h
+++ b/arch/arm/mach-omap1/iomap.h
@@ -22,12 +22,6 @@
22 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25#ifdef __ASSEMBLER__
26#define IOMEM(x) (x)
27#else
28#define IOMEM(x) ((void __force __iomem *)(x))
29#endif
30
31#define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */ 25#define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
32#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET) 26#define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
33 27
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index 4b818eb9f911..f6b14a14a957 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -17,7 +17,6 @@
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <asm/leds.h> 19#include <asm/leds.h>
20#include <asm/system.h>
21#include <asm/mach-types.h> 20#include <asm/mach-types.h>
22 21
23#include <plat/fpga.h> 22#include <plat/fpga.h>
diff --git a/arch/arm/mach-omap1/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index 9b99c2894623..3a066ee8d02c 100644
--- a/arch/arm/mach-omap1/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
@@ -5,7 +5,6 @@
5 5
6#include <mach/hardware.h> 6#include <mach/hardware.h>
7#include <asm/leds.h> 7#include <asm/leds.h>
8#include <asm/system.h>
9 8
10#include "leds.h" 9#include "leds.h"
11 10
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index da09f4364979..936ed426b84f 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -8,7 +8,6 @@
8 8
9#include <mach/hardware.h> 9#include <mach/hardware.h>
10#include <asm/leds.h> 10#include <asm/leds.h>
11#include <asm/system.h>
12 11
13#include "leds.h" 12#include "leds.h"
14 13
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 5fdef7a34828..087dba0df47e 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -27,7 +27,6 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29 29
30#include <asm/system.h>
31 30
32#include <plat/mux.h> 31#include <plat/mux.h>
33 32
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 306beaca14c5..f66c32912b22 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -44,6 +44,7 @@
44#include <linux/io.h> 44#include <linux/io.h>
45#include <linux/atomic.h> 45#include <linux/atomic.h>
46 46
47#include <asm/system_misc.h>
47#include <asm/irq.h> 48#include <asm/irq.h>
48#include <asm/mach/time.h> 49#include <asm/mach/time.h>
49#include <asm/mach/irq.h> 50#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S
index 0779db150da7..0e628743bd03 100644
--- a/arch/arm/mach-omap1/sleep.S
+++ b/arch/arm/mach-omap1/sleep.S
@@ -36,8 +36,6 @@
36 36
37#include <asm/assembler.h> 37#include <asm/assembler.h>
38 38
39#include <mach/io.h>
40
41#include "iomap.h" 39#include "iomap.h"
42#include "pm.h" 40#include "pm.h"
43 41
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S
index 2ce0b9ab20e5..00e9d9e9adf1 100644
--- a/arch/arm/mach-omap1/sram.S
+++ b/arch/arm/mach-omap1/sram.S
@@ -12,7 +12,6 @@
12 12
13#include <asm/assembler.h> 13#include <asm/assembler.h>
14 14
15#include <mach/io.h>
16#include <mach/hardware.h> 15#include <mach/hardware.h>
17 16
18#include "iomap.h" 17#include "iomap.h"
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index 2fae6a2740f1..4d8dd9a1b04c 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -44,7 +44,6 @@
44#include <linux/clockchips.h> 44#include <linux/clockchips.h>
45#include <linux/io.h> 45#include <linux/io.h>
46 46
47#include <asm/system.h>
48#include <asm/leds.h> 47#include <asm/leds.h>
49#include <asm/irq.h> 48#include <asm/irq.h>
50#include <asm/sched_clock.h> 49#include <asm/sched_clock.h>
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c
index a2e6d0709df2..325b9a0aa4a0 100644
--- a/arch/arm/mach-omap1/timer32k.c
+++ b/arch/arm/mach-omap1/timer32k.c
@@ -46,7 +46,6 @@
46#include <linux/clockchips.h> 46#include <linux/clockchips.h>
47#include <linux/io.h> 47#include <linux/io.h>
48 48
49#include <asm/system.h>
50#include <asm/leds.h> 49#include <asm/leds.h>
51#include <asm/irq.h> 50#include <asm/irq.h>
52#include <asm/mach/irq.h> 51#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index c8bda62900d8..e658f835d0de 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -230,12 +230,12 @@ static struct i2c_board_info __initdata sdp2430_i2c1_boardinfo[] = {
230 { 230 {
231 I2C_BOARD_INFO("isp1301_omap", 0x2D), 231 I2C_BOARD_INFO("isp1301_omap", 0x2D),
232 .flags = I2C_CLIENT_WAKE, 232 .flags = I2C_CLIENT_WAKE,
233 .irq = OMAP_GPIO_IRQ(78),
234 }, 233 },
235}; 234};
236 235
237static int __init omap2430_i2c_init(void) 236static int __init omap2430_i2c_init(void)
238{ 237{
238 sdp2430_i2c1_boardinfo[0].irq = gpio_to_irq(78);
239 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo, 239 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
240 ARRAY_SIZE(sdp2430_i2c1_boardinfo)); 240 ARRAY_SIZE(sdp2430_i2c1_boardinfo));
241 omap_pmic_init(2, 100, "twl4030", INT_24XX_SYS_NIRQ, 241 omap_pmic_init(2, 100, "twl4030", INT_24XX_SYS_NIRQ,
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 30768c2f53fd..a39fc4bbd2b8 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -490,21 +490,22 @@ static struct platform_device omap_vwlan_device = {
490 490
491static int omap4_twl6030_hsmmc_late_init(struct device *dev) 491static int omap4_twl6030_hsmmc_late_init(struct device *dev)
492{ 492{
493 int ret = 0; 493 int irq = 0;
494 struct platform_device *pdev = container_of(dev, 494 struct platform_device *pdev = container_of(dev,
495 struct platform_device, dev); 495 struct platform_device, dev);
496 struct omap_mmc_platform_data *pdata = dev->platform_data; 496 struct omap_mmc_platform_data *pdata = dev->platform_data;
497 497
498 /* Setting MMC1 Card detect Irq */ 498 /* Setting MMC1 Card detect Irq */
499 if (pdev->id == 0) { 499 if (pdev->id == 0) {
500 ret = twl6030_mmc_card_detect_config(); 500 irq = twl6030_mmc_card_detect_config();
501 if (ret) 501 if (irq < 0) {
502 pr_err("Failed configuring MMC1 card detect\n"); 502 pr_err("Failed configuring MMC1 card detect\n");
503 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + 503 return irq;
504 MMCDETECT_INTR_OFFSET; 504 }
505 pdata->slots[0].card_detect_irq = irq;
505 pdata->slots[0].card_detect = twl6030_mmc_card_detect; 506 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
506 } 507 }
507 return ret; 508 return 0;
508} 509}
509 510
510static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) 511static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
@@ -906,7 +907,6 @@ static void __init omap4_sdp4430_wifi_mux_init(void)
906} 907}
907 908
908static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = { 909static struct wl12xx_platform_data omap4_sdp4430_wlan_data __initdata = {
909 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
910 .board_ref_clock = WL12XX_REFCLOCK_26, 910 .board_ref_clock = WL12XX_REFCLOCK_26,
911 .board_tcxo_clock = WL12XX_TCXOCLOCK_26, 911 .board_tcxo_clock = WL12XX_TCXOCLOCK_26,
912}; 912};
@@ -916,6 +916,7 @@ static void __init omap4_sdp4430_wifi_init(void)
916 int ret; 916 int ret;
917 917
918 omap4_sdp4430_wifi_mux_init(); 918 omap4_sdp4430_wifi_mux_init();
919 omap4_sdp4430_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ);
919 ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data); 920 ret = wl12xx_set_platform_data(&omap4_sdp4430_wlan_data);
920 if (ret) 921 if (ret)
921 pr_err("Error setting wl12xx data: %d\n", ret); 922 pr_err("Error setting wl12xx data: %d\n", ret);
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index ac773829941f..768ece2e9c3b 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -136,8 +136,6 @@ static struct resource apollon_smc91x_resources[] = {
136 .flags = IORESOURCE_MEM, 136 .flags = IORESOURCE_MEM,
137 }, 137 },
138 [1] = { 138 [1] = {
139 .start = OMAP_GPIO_IRQ(APOLLON_ETHR_GPIO_IRQ),
140 .end = OMAP_GPIO_IRQ(APOLLON_ETHR_GPIO_IRQ),
141 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, 139 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
142 }, 140 },
143}; 141};
@@ -341,6 +339,8 @@ static void __init omap_apollon_init(void)
341 * You have to mux them off in device drivers later on 339 * You have to mux them off in device drivers later on
342 * if not needed. 340 * if not needed.
343 */ 341 */
342 apollon_smc91x_resources[1].start = gpio_to_irq(APOLLON_ETHR_GPIO_IRQ);
343 apollon_smc91x_resources[1].end = gpio_to_irq(APOLLON_ETHR_GPIO_IRQ);
344 platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices)); 344 platform_add_devices(apollon_devices, ARRAY_SIZE(apollon_devices));
345 omap_serial_init(); 345 omap_serial_init();
346 omap_sdrc_init(NULL, NULL); 346 omap_sdrc_init(NULL, NULL);
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 41b0a2fe0b04..909a8b91b564 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -26,6 +26,7 @@
26 26
27#include <linux/i2c/at24.h> 27#include <linux/i2c/at24.h>
28#include <linux/i2c/twl.h> 28#include <linux/i2c/twl.h>
29#include <linux/regulator/fixed.h>
29#include <linux/regulator/machine.h> 30#include <linux/regulator/machine.h>
30#include <linux/mmc/host.h> 31#include <linux/mmc/host.h>
31 32
@@ -81,8 +82,23 @@ static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
81 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, 82 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
82}; 83};
83 84
85static struct regulator_consumer_supply cm_t35_smsc911x_supplies[] = {
86 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
87 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
88};
89
90static struct regulator_consumer_supply sb_t35_smsc911x_supplies[] = {
91 REGULATOR_SUPPLY("vddvario", "smsc911x.1"),
92 REGULATOR_SUPPLY("vdd33a", "smsc911x.1"),
93};
94
84static void __init cm_t35_init_ethernet(void) 95static void __init cm_t35_init_ethernet(void)
85{ 96{
97 regulator_register_fixed(0, cm_t35_smsc911x_supplies,
98 ARRAY_SIZE(cm_t35_smsc911x_supplies));
99 regulator_register_fixed(1, sb_t35_smsc911x_supplies,
100 ARRAY_SIZE(sb_t35_smsc911x_supplies));
101
86 gpmc_smsc911x_init(&cm_t35_smsc911x_cfg); 102 gpmc_smsc911x_init(&cm_t35_smsc911x_cfg);
87 gpmc_smsc911x_init(&sb_t35_smsc911x_cfg); 103 gpmc_smsc911x_init(&sb_t35_smsc911x_cfg);
88} 104}
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 11cd2a806093..a2010f07de31 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -411,7 +411,6 @@ static struct resource omap_dm9000_resources[] = {
411 .flags = IORESOURCE_MEM, 411 .flags = IORESOURCE_MEM,
412 }, 412 },
413 [2] = { 413 [2] = {
414 .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ),
415 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 414 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
416 }, 415 },
417}; 416};
@@ -639,6 +638,7 @@ static void __init devkit8000_init(void)
639 638
640 omap_hsmmc_init(mmc); 639 omap_hsmmc_init(mmc);
641 devkit8000_i2c_init(); 640 devkit8000_i2c_init();
641 omap_dm9000_resources[2].start = gpio_to_irq(OMAP_DM9000_GPIO_IRQ);
642 platform_add_devices(devkit8000_devices, 642 platform_add_devices(devkit8000_devices,
643 ARRAY_SIZE(devkit8000_devices)); 643 ARRAY_SIZE(devkit8000_devices));
644 644
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 54af800d143c..0bbbabe28fcc 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -348,7 +348,6 @@ static struct at24_platform_data m24c01 = {
348static struct i2c_board_info __initdata h4_i2c_board_info[] = { 348static struct i2c_board_info __initdata h4_i2c_board_info[] = {
349 { 349 {
350 I2C_BOARD_INFO("isp1301_omap", 0x2d), 350 I2C_BOARD_INFO("isp1301_omap", 0x2d),
351 .irq = OMAP_GPIO_IRQ(125),
352 }, 351 },
353 { /* EEPROM on mainboard */ 352 { /* EEPROM on mainboard */
354 I2C_BOARD_INFO("24c01", 0x52), 353 I2C_BOARD_INFO("24c01", 0x52),
@@ -377,6 +376,7 @@ static void __init omap_h4_init(void)
377 */ 376 */
378 377
379 board_mkp_init(); 378 board_mkp_init();
379 h4_i2c_board_info[0].irq = gpio_to_irq(125);
380 i2c_register_board_info(1, h4_i2c_board_info, 380 i2c_register_board_info(1, h4_i2c_board_info,
381 ARRAY_SIZE(h4_i2c_board_info)); 381 ARRAY_SIZE(h4_i2c_board_info));
382 382
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index e558800adfdf..930c0d380435 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -634,8 +634,14 @@ static void __init igep_wlan_bt_init(void)
634static inline void __init igep_wlan_bt_init(void) { } 634static inline void __init igep_wlan_bt_init(void) { }
635#endif 635#endif
636 636
637static struct regulator_consumer_supply dummy_supplies[] = {
638 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
639 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
640};
641
637static void __init igep_init(void) 642static void __init igep_init(void)
638{ 643{
644 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
639 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 645 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
640 646
641 /* Get IGEP2 hardware revision */ 647 /* Get IGEP2 hardware revision */
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d50a562adfa0..1b6049567ab4 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -22,6 +22,7 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/regulator/fixed.h>
25#include <linux/regulator/machine.h> 26#include <linux/regulator/machine.h>
26#include <linux/i2c/twl.h> 27#include <linux/i2c/twl.h>
27#include <linux/io.h> 28#include <linux/io.h>
@@ -410,8 +411,14 @@ static struct mtd_partition ldp_nand_partitions[] = {
410 411
411}; 412};
412 413
414static struct regulator_consumer_supply dummy_supplies[] = {
415 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
416 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
417};
418
413static void __init omap_ldp_init(void) 419static void __init omap_ldp_init(void)
414{ 420{
421 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
415 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 422 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
416 ldp_init_smsc911x(); 423 ldp_init_smsc911x();
417 omap_i2c_init(); 424 omap_i2c_init();
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index a659e198892b..49df12735b41 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -114,15 +114,6 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
114 114
115static inline void __init omap3evm_init_smsc911x(void) 115static inline void __init omap3evm_init_smsc911x(void)
116{ 116{
117 struct clk *l3ck;
118 unsigned int rate;
119
120 l3ck = clk_get(NULL, "l3_ck");
121 if (IS_ERR(l3ck))
122 rate = 100000000;
123 else
124 rate = clk_get_rate(l3ck);
125
126 /* Configure ethernet controller reset gpio */ 117 /* Configure ethernet controller reset gpio */
127 if (cpu_is_omap3430()) { 118 if (cpu_is_omap3430()) {
128 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) 119 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
@@ -487,7 +478,6 @@ static struct platform_device omap3evm_wlan_regulator = {
487}; 478};
488 479
489struct wl12xx_platform_data omap3evm_wlan_data __initdata = { 480struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
490 .irq = OMAP_GPIO_IRQ(OMAP3EVM_WLAN_IRQ_GPIO),
491 .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */ 481 .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
492}; 482};
493#endif 483#endif
@@ -623,6 +613,7 @@ static void __init omap3_evm_wl12xx_init(void)
623 int ret; 613 int ret;
624 614
625 /* WL12xx WLAN Init */ 615 /* WL12xx WLAN Init */
616 omap3evm_wlan_data.irq = gpio_to_irq(OMAP3EVM_WLAN_IRQ_GPIO);
626 ret = wl12xx_set_platform_data(&omap3evm_wlan_data); 617 ret = wl12xx_set_platform_data(&omap3evm_wlan_data);
627 if (ret) 618 if (ret)
628 pr_err("error setting wl12xx data: %d\n", ret); 619 pr_err("error setting wl12xx data: %d\n", ret);
@@ -632,9 +623,15 @@ static void __init omap3_evm_wl12xx_init(void)
632#endif 623#endif
633} 624}
634 625
626static struct regulator_consumer_supply dummy_supplies[] = {
627 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
628 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
629};
630
635static void __init omap3_evm_init(void) 631static void __init omap3_evm_init(void)
636{ 632{
637 omap3_evm_get_revision(); 633 omap3_evm_get_revision();
634 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
638 635
639 if (cpu_is_omap3630()) 636 if (cpu_is_omap3630())
640 omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB); 637 omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB);
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 4a7d8c8a75da..9b3c141ff51b 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -23,6 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25 25
26#include <linux/regulator/fixed.h>
26#include <linux/regulator/machine.h> 27#include <linux/regulator/machine.h>
27 28
28#include <linux/i2c/twl.h> 29#include <linux/i2c/twl.h>
@@ -188,8 +189,14 @@ static struct omap_board_mux board_mux[] __initdata = {
188}; 189};
189#endif 190#endif
190 191
192static struct regulator_consumer_supply dummy_supplies[] = {
193 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
194 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
195};
196
191static void __init omap3logic_init(void) 197static void __init omap3logic_init(void)
192{ 198{
199 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
193 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 200 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
194 omap3torpedo_fix_pbias_voltage(); 201 omap3torpedo_fix_pbias_voltage();
195 omap3logic_i2c_init(); 202 omap3logic_i2c_init();
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index 641004380795..4dffc95bddd2 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -24,6 +24,7 @@
24#include <linux/input.h> 24#include <linux/input.h>
25#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
26 26
27#include <linux/regulator/fixed.h>
27#include <linux/regulator/machine.h> 28#include <linux/regulator/machine.h>
28#include <linux/i2c/twl.h> 29#include <linux/i2c/twl.h>
29#include <linux/mmc/host.h> 30#include <linux/mmc/host.h>
@@ -72,15 +73,6 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
72 73
73static inline void __init omap3stalker_init_eth(void) 74static inline void __init omap3stalker_init_eth(void)
74{ 75{
75 struct clk *l3ck;
76 unsigned int rate;
77
78 l3ck = clk_get(NULL, "l3_ck");
79 if (IS_ERR(l3ck))
80 rate = 100000000;
81 else
82 rate = clk_get_rate(l3ck);
83
84 omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP); 76 omap_mux_init_gpio(19, OMAP_PIN_INPUT_PULLUP);
85 gpmc_smsc911x_init(&smsc911x_cfg); 77 gpmc_smsc911x_init(&smsc911x_cfg);
86} 78}
@@ -419,8 +411,14 @@ static struct omap_board_mux board_mux[] __initdata = {
419}; 411};
420#endif 412#endif
421 413
414static struct regulator_consumer_supply dummy_supplies[] = {
415 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
416 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
417};
418
422static void __init omap3_stalker_init(void) 419static void __init omap3_stalker_init(void)
423{ 420{
421 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
424 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS); 422 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
425 omap_board_config = omap3_stalker_config; 423 omap_board_config = omap3_stalker_config;
426 omap_board_config_size = ARRAY_SIZE(omap3_stalker_config); 424 omap_board_config_size = ARRAY_SIZE(omap3_stalker_config);
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 8842e04aef01..ae2251fa4a69 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -42,6 +42,7 @@
42#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
43#include <asm/mach/map.h> 43#include <asm/mach/map.h>
44#include <asm/mach/flash.h> 44#include <asm/mach/flash.h>
45#include <asm/system_info.h>
45 46
46#include <plat/board.h> 47#include <plat/board.h>
47#include "common.h" 48#include "common.h"
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index e9071a57c37b..d8c0e89f0126 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -231,14 +231,13 @@ static struct platform_device omap_vwlan_device = {
231}; 231};
232 232
233struct wl12xx_platform_data omap_panda_wlan_data __initdata = { 233struct wl12xx_platform_data omap_panda_wlan_data __initdata = {
234 .irq = OMAP_GPIO_IRQ(GPIO_WIFI_IRQ),
235 /* PANDA ref clock is 38.4 MHz */ 234 /* PANDA ref clock is 38.4 MHz */
236 .board_ref_clock = 2, 235 .board_ref_clock = 2,
237}; 236};
238 237
239static int omap4_twl6030_hsmmc_late_init(struct device *dev) 238static int omap4_twl6030_hsmmc_late_init(struct device *dev)
240{ 239{
241 int ret = 0; 240 int irq = 0;
242 struct platform_device *pdev = container_of(dev, 241 struct platform_device *pdev = container_of(dev,
243 struct platform_device, dev); 242 struct platform_device, dev);
244 struct omap_mmc_platform_data *pdata = dev->platform_data; 243 struct omap_mmc_platform_data *pdata = dev->platform_data;
@@ -249,14 +248,15 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev)
249 } 248 }
250 /* Setting MMC1 Card detect Irq */ 249 /* Setting MMC1 Card detect Irq */
251 if (pdev->id == 0) { 250 if (pdev->id == 0) {
252 ret = twl6030_mmc_card_detect_config(); 251 irq = twl6030_mmc_card_detect_config();
253 if (ret) 252 if (irq < 0) {
254 dev_err(dev, "%s: Error card detect config(%d)\n", 253 dev_err(dev, "%s: Error card detect config(%d)\n",
255 __func__, ret); 254 __func__, irq);
256 else 255 return irq;
257 pdata->slots[0].card_detect = twl6030_mmc_card_detect; 256 }
257 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
258 } 258 }
259 return ret; 259 return 0;
260} 260}
261 261
262static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) 262static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
@@ -557,6 +557,7 @@ static void __init omap4_panda_init(void)
557 package = OMAP_PACKAGE_CBL; 557 package = OMAP_PACKAGE_CBL;
558 omap4_mux_init(board_mux, NULL, package); 558 omap4_mux_init(board_mux, NULL, package);
559 559
560 omap_panda_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ);
560 ret = wl12xx_set_platform_data(&omap_panda_wlan_data); 561 ret = wl12xx_set_platform_data(&omap_panda_wlan_data);
561 if (ret) 562 if (ret)
562 pr_err("error setting wl12xx data: %d\n", ret); 563 pr_err("error setting wl12xx data: %d\n", ret);
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 668533e2a379..33aa3910b09e 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -498,10 +498,18 @@ static struct gpio overo_bt_gpios[] __initdata = {
498 { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" }, 498 { OVERO_GPIO_BT_NRESET, GPIOF_OUT_INIT_HIGH, "lcd bl enable" },
499}; 499};
500 500
501static struct regulator_consumer_supply dummy_supplies[] = {
502 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
503 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
504 REGULATOR_SUPPLY("vddvario", "smsc911x.1"),
505 REGULATOR_SUPPLY("vdd33a", "smsc911x.1"),
506};
507
501static void __init overo_init(void) 508static void __init overo_init(void)
502{ 509{
503 int ret; 510 int ret;
504 511
512 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
505 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 513 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
506 omap_hsmmc_init(mmc); 514 omap_hsmmc_init(mmc);
507 overo_i2c_init(); 515 overo_i2c_init();
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 16aebfb8a7ec..d87ee0612098 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -25,6 +25,7 @@
25#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
26#include <linux/mmc/host.h> 26#include <linux/mmc/host.h>
27#include <linux/power/isp1704_charger.h> 27#include <linux/power/isp1704_charger.h>
28#include <asm/system_info.h>
28 29
29#include <plat/mcspi.h> 30#include <plat/mcspi.h>
30#include <plat/board.h> 31#include <plat/board.h>
@@ -169,7 +170,6 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
169 .modalias = "tsc2005", 170 .modalias = "tsc2005",
170 .bus_num = 1, 171 .bus_num = 1,
171 .chip_select = 0, 172 .chip_select = 0,
172 .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
173 .max_speed_hz = 6000000, 173 .max_speed_hz = 6000000,
174 .controller_data = &tsc2005_mcspi_config, 174 .controller_data = &tsc2005_mcspi_config,
175 .platform_data = &tsc2005_pdata, 175 .platform_data = &tsc2005_pdata,
@@ -1128,6 +1128,8 @@ static void __init rx51_init_tsc2005(void)
1128 } 1128 }
1129 1129
1130 tsc2005_pdata.set_reset = rx51_tsc2005_set_reset; 1130 tsc2005_pdata.set_reset = rx51_tsc2005_set_reset;
1131 rx51_peripherals_spi_board_info[RX51_SPI_TSC2005].irq =
1132 gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
1131} 1133}
1132 1134
1133void __init rx51_peripherals_init(void) 1135void __init rx51_peripherals_init(void)
diff --git a/arch/arm/mach-omap2/board-zoom-debugboard.c b/arch/arm/mach-omap2/board-zoom-debugboard.c
index 369c2eb7715b..f64f44173061 100644
--- a/arch/arm/mach-omap2/board-zoom-debugboard.c
+++ b/arch/arm/mach-omap2/board-zoom-debugboard.c
@@ -14,6 +14,9 @@
14#include <linux/smsc911x.h> 14#include <linux/smsc911x.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16 16
17#include <linux/regulator/fixed.h>
18#include <linux/regulator/machine.h>
19
17#include <plat/gpmc.h> 20#include <plat/gpmc.h>
18#include <plat/gpmc-smsc911x.h> 21#include <plat/gpmc-smsc911x.h>
19 22
@@ -43,7 +46,6 @@ static inline void __init zoom_init_smsc911x(void)
43static struct plat_serial8250_port serial_platform_data[] = { 46static struct plat_serial8250_port serial_platform_data[] = {
44 { 47 {
45 .mapbase = ZOOM_UART_BASE, 48 .mapbase = ZOOM_UART_BASE,
46 .irq = OMAP_GPIO_IRQ(102),
47 .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ, 49 .flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,
48 .irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING, 50 .irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING,
49 .iotype = UPIO_MEM, 51 .iotype = UPIO_MEM,
@@ -89,6 +91,8 @@ static inline void __init zoom_init_quaduart(void)
89 if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0) 91 if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0)
90 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n", 92 printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",
91 quart_gpio); 93 quart_gpio);
94
95 serial_platform_data[0].irq = gpio_to_irq(102);
92} 96}
93 97
94static inline int omap_zoom_debugboard_detect(void) 98static inline int omap_zoom_debugboard_detect(void)
@@ -116,11 +120,17 @@ static struct platform_device *zoom_devices[] __initdata = {
116 &zoom_debugboard_serial_device, 120 &zoom_debugboard_serial_device,
117}; 121};
118 122
123static struct regulator_consumer_supply dummy_supplies[] = {
124 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
125 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
126};
127
119int __init zoom_debugboard_init(void) 128int __init zoom_debugboard_init(void)
120{ 129{
121 if (!omap_zoom_debugboard_detect()) 130 if (!omap_zoom_debugboard_detect())
122 return 0; 131 return 0;
123 132
133 regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies));
124 zoom_init_smsc911x(); 134 zoom_init_smsc911x();
125 zoom_init_quaduart(); 135 zoom_init_quaduart();
126 return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices)); 136 return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 3d39cdb2e250..b797cb279618 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -193,7 +193,6 @@ static struct platform_device omap_vwlan_device = {
193}; 193};
194 194
195static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = { 195static struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
196 .irq = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
197 /* ZOOM ref clock is 26 MHz */ 196 /* ZOOM ref clock is 26 MHz */
198 .board_ref_clock = 1, 197 .board_ref_clock = 1,
199}; 198};
@@ -297,7 +296,10 @@ static void enable_board_wakeup_source(void)
297 296
298void __init zoom_peripherals_init(void) 297void __init zoom_peripherals_init(void)
299{ 298{
300 int ret = wl12xx_set_platform_data(&omap_zoom_wlan_data); 299 int ret;
300
301 omap_zoom_wlan_data.irq = gpio_to_irq(OMAP_ZOOM_WLAN_IRQ_GPIO);
302 ret = wl12xx_set_platform_data(&omap_zoom_wlan_data);
301 303
302 if (ret) 304 if (ret)
303 pr_err("error setting wl12xx data: %d\n", ret); 305 pr_err("error setting wl12xx data: %d\n", ret);
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 981b9f9111a4..f4a626f7c79e 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/clk.h> 20#include <linux/clk.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/io.h>
22 23
23#include <plat/hardware.h> 24#include <plat/hardware.h>
24#include <plat/clkdev_omap.h> 25#include <plat/clkdev_omap.h>
@@ -746,7 +747,7 @@ static struct clk dpll4_m3_ck = {
746 .parent = &dpll4_ck, 747 .parent = &dpll4_ck,
747 .init = &omap2_init_clksel_parent, 748 .init = &omap2_init_clksel_parent,
748 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), 749 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
749 .clksel_mask = OMAP3430_CLKSEL_TV_MASK, 750 .clksel_mask = OMAP3630_CLKSEL_TV_MASK,
750 .clksel = dpll4_clksel, 751 .clksel = dpll4_clksel,
751 .clkdm_name = "dpll4_clkdm", 752 .clkdm_name = "dpll4_clkdm",
752 .recalc = &omap2_clksel_recalc, 753 .recalc = &omap2_clksel_recalc,
@@ -831,7 +832,7 @@ static struct clk dpll4_m4_ck = {
831 .parent = &dpll4_ck, 832 .parent = &dpll4_ck,
832 .init = &omap2_init_clksel_parent, 833 .init = &omap2_init_clksel_parent,
833 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL), 834 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
834 .clksel_mask = OMAP3430_CLKSEL_DSS1_MASK, 835 .clksel_mask = OMAP3630_CLKSEL_DSS1_MASK,
835 .clksel = dpll4_clksel, 836 .clksel = dpll4_clksel,
836 .clkdm_name = "dpll4_clkdm", 837 .clkdm_name = "dpll4_clkdm",
837 .recalc = &omap2_clksel_recalc, 838 .recalc = &omap2_clksel_recalc,
@@ -858,7 +859,7 @@ static struct clk dpll4_m5_ck = {
858 .parent = &dpll4_ck, 859 .parent = &dpll4_ck,
859 .init = &omap2_init_clksel_parent, 860 .init = &omap2_init_clksel_parent,
860 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL), 861 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
861 .clksel_mask = OMAP3430_CLKSEL_CAM_MASK, 862 .clksel_mask = OMAP3630_CLKSEL_CAM_MASK,
862 .clksel = dpll4_clksel, 863 .clksel = dpll4_clksel,
863 .clkdm_name = "dpll4_clkdm", 864 .clkdm_name = "dpll4_clkdm",
864 .set_rate = &omap2_clksel_set_rate, 865 .set_rate = &omap2_clksel_set_rate,
@@ -885,7 +886,7 @@ static struct clk dpll4_m6_ck = {
885 .parent = &dpll4_ck, 886 .parent = &dpll4_ck,
886 .init = &omap2_init_clksel_parent, 887 .init = &omap2_init_clksel_parent,
887 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1), 888 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
888 .clksel_mask = OMAP3430_DIV_DPLL4_MASK, 889 .clksel_mask = OMAP3630_DIV_DPLL4_MASK,
889 .clksel = dpll4_clksel, 890 .clksel = dpll4_clksel,
890 .clkdm_name = "dpll4_clkdm", 891 .clkdm_name = "dpll4_clkdm",
891 .recalc = &omap2_clksel_recalc, 892 .recalc = &omap2_clksel_recalc,
@@ -1393,6 +1394,7 @@ static struct clk cpefuse_fck = {
1393 .name = "cpefuse_fck", 1394 .name = "cpefuse_fck",
1394 .ops = &clkops_omap2_dflt, 1395 .ops = &clkops_omap2_dflt,
1395 .parent = &sys_ck, 1396 .parent = &sys_ck,
1397 .clkdm_name = "core_l4_clkdm",
1396 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), 1398 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1397 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT, 1399 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
1398 .recalc = &followparent_recalc, 1400 .recalc = &followparent_recalc,
@@ -1402,6 +1404,7 @@ static struct clk ts_fck = {
1402 .name = "ts_fck", 1404 .name = "ts_fck",
1403 .ops = &clkops_omap2_dflt, 1405 .ops = &clkops_omap2_dflt,
1404 .parent = &omap_32k_fck, 1406 .parent = &omap_32k_fck,
1407 .clkdm_name = "core_l4_clkdm",
1405 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), 1408 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1406 .enable_bit = OMAP3430ES2_EN_TS_SHIFT, 1409 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
1407 .recalc = &followparent_recalc, 1410 .recalc = &followparent_recalc,
@@ -1411,6 +1414,7 @@ static struct clk usbtll_fck = {
1411 .name = "usbtll_fck", 1414 .name = "usbtll_fck",
1412 .ops = &clkops_omap2_dflt_wait, 1415 .ops = &clkops_omap2_dflt_wait,
1413 .parent = &dpll5_m2_ck, 1416 .parent = &dpll5_m2_ck,
1417 .clkdm_name = "core_l4_clkdm",
1414 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3), 1418 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1415 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT, 1419 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1416 .recalc = &followparent_recalc, 1420 .recalc = &followparent_recalc,
@@ -1616,6 +1620,7 @@ static struct clk fshostusb_fck = {
1616 .name = "fshostusb_fck", 1620 .name = "fshostusb_fck",
1617 .ops = &clkops_omap2_dflt_wait, 1621 .ops = &clkops_omap2_dflt_wait,
1618 .parent = &core_48m_fck, 1622 .parent = &core_48m_fck,
1623 .clkdm_name = "core_l4_clkdm",
1619 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), 1624 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1620 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT, 1625 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1621 .recalc = &followparent_recalc, 1626 .recalc = &followparent_recalc,
@@ -2042,6 +2047,7 @@ static struct clk omapctrl_ick = {
2042 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), 2047 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2043 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT, 2048 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2044 .flags = ENABLE_ON_INIT, 2049 .flags = ENABLE_ON_INIT,
2050 .clkdm_name = "core_l4_clkdm",
2045 .recalc = &followparent_recalc, 2051 .recalc = &followparent_recalc,
2046}; 2052};
2047 2053
@@ -2093,6 +2099,7 @@ static struct clk usb_l4_ick = {
2093 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL), 2099 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2094 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK, 2100 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2095 .clksel = usb_l4_clksel, 2101 .clksel = usb_l4_clksel,
2102 .clkdm_name = "core_l4_clkdm",
2096 .recalc = &omap2_clksel_recalc, 2103 .recalc = &omap2_clksel_recalc,
2097}; 2104};
2098 2105
@@ -3466,8 +3473,8 @@ static struct omap_clk omap3xxx_clks[] = {
3466 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), 3473 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3467 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), 3474 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3468 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), 3475 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3469 CLK("davinci_emac", "emac_clk", &emac_ick, CK_AM35XX), 3476 CLK("davinci_emac", NULL, &emac_ick, CK_AM35XX),
3470 CLK("davinci_emac", "phy_clk", &emac_fck, CK_AM35XX), 3477 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3471 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), 3478 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3472 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), 3479 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3473 CLK("musb-am35x", "ick", &hsotgusb_ick_am35xx, CK_AM35XX), 3480 CLK("musb-am35x", "ick", &hsotgusb_ick_am35xx, CK_AM35XX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 79b98f22f207..fa6ea65ad44b 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/io.h>
29 30
30#include <plat/hardware.h> 31#include <plat/hardware.h>
31#include <plat/clkdev_omap.h> 32#include <plat/clkdev_omap.h>
@@ -956,8 +957,8 @@ static struct dpll_data dpll_usb_dd = {
956 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED), 957 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
957 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB, 958 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
958 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB, 959 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
959 .mult_mask = OMAP4430_DPLL_MULT_MASK, 960 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
960 .div1_mask = OMAP4430_DPLL_DIV_MASK, 961 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
961 .enable_mask = OMAP4430_DPLL_EN_MASK, 962 .enable_mask = OMAP4430_DPLL_EN_MASK,
962 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK, 963 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
963 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK, 964 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
@@ -977,6 +978,7 @@ static struct clk dpll_usb_ck = {
977 .recalc = &omap3_dpll_recalc, 978 .recalc = &omap3_dpll_recalc,
978 .round_rate = &omap2_dpll_round_rate, 979 .round_rate = &omap2_dpll_round_rate,
979 .set_rate = &omap3_noncore_dpll_set_rate, 980 .set_rate = &omap3_noncore_dpll_set_rate,
981 .clkdm_name = "l3_init_clkdm",
980}; 982};
981 983
982static struct clk dpll_usb_clkdcoldo_ck = { 984static struct clk dpll_usb_clkdcoldo_ck = {
diff --git a/arch/arm/mach-omap2/clockdomains44xx_data.c b/arch/arm/mach-omap2/clockdomains44xx_data.c
index 9299ac291d28..bd7ed13515cc 100644
--- a/arch/arm/mach-omap2/clockdomains44xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains44xx_data.c
@@ -390,7 +390,7 @@ static struct clockdomain emu_sys_44xx_clkdm = {
390 .prcm_partition = OMAP4430_PRM_PARTITION, 390 .prcm_partition = OMAP4430_PRM_PARTITION,
391 .cm_inst = OMAP4430_PRM_EMU_CM_INST, 391 .cm_inst = OMAP4430_PRM_EMU_CM_INST,
392 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS, 392 .clkdm_offs = OMAP4430_PRM_EMU_CM_EMU_CDOFFS,
393 .flags = CLKDM_CAN_HWSUP, 393 .flags = CLKDM_CAN_ENABLE_AUTO | CLKDM_CAN_FORCE_WAKEUP,
394}; 394};
395 395
396static struct clockdomain l3_dma_44xx_clkdm = { 396static struct clockdomain l3_dma_44xx_clkdm = {
diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
index 9498b0f5fbd0..1706ebcec08d 100644
--- a/arch/arm/mach-omap2/common-board-devices.c
+++ b/arch/arm/mach-omap2/common-board-devices.c
@@ -76,7 +76,7 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
76 } 76 }
77 77
78 spi_bi->bus_num = bus_num; 78 spi_bi->bus_num = bus_num;
79 spi_bi->irq = OMAP_GPIO_IRQ(gpio_pendown); 79 spi_bi->irq = gpio_to_irq(gpio_pendown);
80 80
81 if (board_pdata) { 81 if (board_pdata) {
82 board_pdata->gpio_pendown = gpio_pendown; 82 board_pdata->gpio_pendown = gpio_pendown;
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index 464cffde58fe..535866489ce3 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -87,29 +87,14 @@ static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
87 return 0; 87 return 0;
88} 88}
89 89
90/** 90static int __omap3_enter_idle(struct cpuidle_device *dev,
91 * omap3_enter_idle - Programs OMAP3 to enter the specified state
92 * @dev: cpuidle device
93 * @drv: cpuidle driver
94 * @index: the index of state to be entered
95 *
96 * Called from the CPUidle framework to program the device to the
97 * specified target state selected by the governor.
98 */
99static int omap3_enter_idle(struct cpuidle_device *dev,
100 struct cpuidle_driver *drv, 91 struct cpuidle_driver *drv,
101 int index) 92 int index)
102{ 93{
103 struct omap3_idle_statedata *cx = 94 struct omap3_idle_statedata *cx =
104 cpuidle_get_statedata(&dev->states_usage[index]); 95 cpuidle_get_statedata(&dev->states_usage[index]);
105 struct timespec ts_preidle, ts_postidle, ts_idle;
106 u32 mpu_state = cx->mpu_state, core_state = cx->core_state; 96 u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
107 int idle_time;
108
109 /* Used to keep track of the total time in idle */
110 getnstimeofday(&ts_preidle);
111 97
112 local_irq_disable();
113 local_fiq_disable(); 98 local_fiq_disable();
114 99
115 pwrdm_set_next_pwrst(mpu_pd, mpu_state); 100 pwrdm_set_next_pwrst(mpu_pd, mpu_state);
@@ -148,22 +133,29 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
148 } 133 }
149 134
150return_sleep_time: 135return_sleep_time:
151 getnstimeofday(&ts_postidle);
152 ts_idle = timespec_sub(ts_postidle, ts_preidle);
153 136
154 local_irq_enable();
155 local_fiq_enable(); 137 local_fiq_enable();
156 138
157 idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \
158 USEC_PER_SEC;
159
160 /* Update cpuidle counters */
161 dev->last_residency = idle_time;
162
163 return index; 139 return index;
164} 140}
165 141
166/** 142/**
143 * omap3_enter_idle - Programs OMAP3 to enter the specified state
144 * @dev: cpuidle device
145 * @drv: cpuidle driver
146 * @index: the index of state to be entered
147 *
148 * Called from the CPUidle framework to program the device to the
149 * specified target state selected by the governor.
150 */
151static inline int omap3_enter_idle(struct cpuidle_device *dev,
152 struct cpuidle_driver *drv,
153 int index)
154{
155 return cpuidle_wrap_enter(dev, drv, index, __omap3_enter_idle);
156}
157
158/**
167 * next_valid_state - Find next valid C-state 159 * next_valid_state - Find next valid C-state
168 * @dev: cpuidle device 160 * @dev: cpuidle device
169 * @drv: cpuidle driver 161 * @drv: cpuidle driver
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
index 72e018b9b260..f386cbe9c889 100644
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ b/arch/arm/mach-omap2/cpuidle44xx.c
@@ -62,15 +62,9 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
62{ 62{
63 struct omap4_idle_statedata *cx = 63 struct omap4_idle_statedata *cx =
64 cpuidle_get_statedata(&dev->states_usage[index]); 64 cpuidle_get_statedata(&dev->states_usage[index]);
65 struct timespec ts_preidle, ts_postidle, ts_idle;
66 u32 cpu1_state; 65 u32 cpu1_state;
67 int idle_time;
68 int cpu_id = smp_processor_id(); 66 int cpu_id = smp_processor_id();
69 67
70 /* Used to keep track of the total time in idle */
71 getnstimeofday(&ts_preidle);
72
73 local_irq_disable();
74 local_fiq_disable(); 68 local_fiq_disable();
75 69
76 /* 70 /*
@@ -128,26 +122,17 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
128 if (index > 0) 122 if (index > 0)
129 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id); 123 clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);
130 124
131 getnstimeofday(&ts_postidle);
132 ts_idle = timespec_sub(ts_postidle, ts_preidle);
133
134 local_irq_enable();
135 local_fiq_enable(); 125 local_fiq_enable();
136 126
137 idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \
138 USEC_PER_SEC;
139
140 /* Update cpuidle counters */
141 dev->last_residency = idle_time;
142
143 return index; 127 return index;
144} 128}
145 129
146DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev); 130DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev);
147 131
148struct cpuidle_driver omap4_idle_driver = { 132struct cpuidle_driver omap4_idle_driver = {
149 .name = "omap4_idle", 133 .name = "omap4_idle",
150 .owner = THIS_MODULE, 134 .owner = THIS_MODULE,
135 .en_core_tk_irqen = 1,
151}; 136};
152 137
153static inline void _fill_cstate(struct cpuidle_driver *drv, 138static inline void _fill_cstate(struct cpuidle_driver *drv,
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 9706c648bc19..db5a88a36c63 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -99,7 +99,7 @@ static const struct omap_dss_hwmod_data omap4_dss_hwmod_data[] __initdata = {
99 { "dss_hdmi", "omapdss_hdmi", -1 }, 99 { "dss_hdmi", "omapdss_hdmi", -1 },
100}; 100};
101 101
102static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags) 102static void __init omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
103{ 103{
104 u32 reg; 104 u32 reg;
105 u16 control_i2c_1; 105 u16 control_i2c_1;
@@ -125,7 +125,7 @@ static void omap4_hdmi_mux_pads(enum omap_hdmi_flags flags)
125 } 125 }
126} 126}
127 127
128static int __init omap4_dsi_mux_pads(int dsi_id, unsigned lanes) 128static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
129{ 129{
130 u32 enable_mask, enable_shift; 130 u32 enable_mask, enable_shift;
131 u32 pipd_mask, pipd_shift; 131 u32 pipd_mask, pipd_shift;
@@ -166,7 +166,7 @@ int __init omap_hdmi_init(enum omap_hdmi_flags flags)
166 return 0; 166 return 0;
167} 167}
168 168
169static int __init omap_dsi_enable_pads(int dsi_id, unsigned lane_mask) 169static int omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
170{ 170{
171 if (cpu_is_omap44xx()) 171 if (cpu_is_omap44xx())
172 return omap4_dsi_mux_pads(dsi_id, lane_mask); 172 return omap4_dsi_mux_pads(dsi_id, lane_mask);
@@ -174,7 +174,7 @@ static int __init omap_dsi_enable_pads(int dsi_id, unsigned lane_mask)
174 return 0; 174 return 0;
175} 175}
176 176
177static void __init omap_dsi_disable_pads(int dsi_id, unsigned lane_mask) 177static void omap_dsi_disable_pads(int dsi_id, unsigned lane_mask)
178{ 178{
179 if (cpu_is_omap44xx()) 179 if (cpu_is_omap44xx())
180 omap4_dsi_mux_pads(dsi_id, 0); 180 omap4_dsi_mux_pads(dsi_id, 0);
diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
index 5e5880d6d099..b6c77be3e8f7 100644
--- a/arch/arm/mach-omap2/gpmc-smsc911x.c
+++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
@@ -19,15 +19,11 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/smsc911x.h> 21#include <linux/smsc911x.h>
22#include <linux/regulator/fixed.h>
23#include <linux/regulator/machine.h>
24 22
25#include <plat/board.h> 23#include <plat/board.h>
26#include <plat/gpmc.h> 24#include <plat/gpmc.h>
27#include <plat/gpmc-smsc911x.h> 25#include <plat/gpmc-smsc911x.h>
28 26
29static struct omap_smsc911x_platform_data *gpmc_cfg;
30
31static struct resource gpmc_smsc911x_resources[] = { 27static struct resource gpmc_smsc911x_resources[] = {
32 [0] = { 28 [0] = {
33 .flags = IORESOURCE_MEM, 29 .flags = IORESOURCE_MEM,
@@ -41,51 +37,6 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = {
41 .phy_interface = PHY_INTERFACE_MODE_MII, 37 .phy_interface = PHY_INTERFACE_MODE_MII,
42 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 38 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
43 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 39 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
44 .flags = SMSC911X_USE_16BIT,
45};
46
47static struct regulator_consumer_supply gpmc_smsc911x_supply[] = {
48 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
49 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
50};
51
52/* Generic regulator definition to satisfy smsc911x */
53static struct regulator_init_data gpmc_smsc911x_reg_init_data = {
54 .constraints = {
55 .min_uV = 3300000,
56 .max_uV = 3300000,
57 .valid_modes_mask = REGULATOR_MODE_NORMAL
58 | REGULATOR_MODE_STANDBY,
59 .valid_ops_mask = REGULATOR_CHANGE_MODE
60 | REGULATOR_CHANGE_STATUS,
61 },
62 .num_consumer_supplies = ARRAY_SIZE(gpmc_smsc911x_supply),
63 .consumer_supplies = gpmc_smsc911x_supply,
64};
65
66static struct fixed_voltage_config gpmc_smsc911x_fixed_reg_data = {
67 .supply_name = "gpmc_smsc911x",
68 .microvolts = 3300000,
69 .gpio = -EINVAL,
70 .startup_delay = 0,
71 .enable_high = 0,
72 .enabled_at_boot = 1,
73 .init_data = &gpmc_smsc911x_reg_init_data,
74};
75
76/*
77 * Platform device id of 42 is a temporary fix to avoid conflicts
78 * with other reg-fixed-voltage devices. The real fix should
79 * involve the driver core providing a way of dynamically
80 * assigning a unique id on registration for platform devices
81 * in the same name space.
82 */
83static struct platform_device gpmc_smsc911x_regulator = {
84 .name = "reg-fixed-voltage",
85 .id = 42,
86 .dev = {
87 .platform_data = &gpmc_smsc911x_fixed_reg_data,
88 },
89}; 40};
90 41
91/* 42/*
@@ -93,23 +44,12 @@ static struct platform_device gpmc_smsc911x_regulator = {
93 * assume that pin multiplexing is done in the board-*.c file, 44 * assume that pin multiplexing is done in the board-*.c file,
94 * or in the bootloader. 45 * or in the bootloader.
95 */ 46 */
96void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data) 47void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg)
97{ 48{
98 struct platform_device *pdev; 49 struct platform_device *pdev;
99 unsigned long cs_mem_base; 50 unsigned long cs_mem_base;
100 int ret; 51 int ret;
101 52
102 gpmc_cfg = board_data;
103
104 if (!gpmc_cfg->id) {
105 ret = platform_device_register(&gpmc_smsc911x_regulator);
106 if (ret < 0) {
107 pr_err("Unable to register smsc911x regulators: %d\n",
108 ret);
109 return;
110 }
111 }
112
113 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { 53 if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) {
114 pr_err("Failed to request GPMC mem region\n"); 54 pr_err("Failed to request GPMC mem region\n");
115 return; 55 return;
@@ -139,8 +79,7 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
139 gpio_set_value(gpmc_cfg->gpio_reset, 1); 79 gpio_set_value(gpmc_cfg->gpio_reset, 1);
140 } 80 }
141 81
142 if (gpmc_cfg->flags) 82 gpmc_smsc911x_config.flags = gpmc_cfg->flags ? : SMSC911X_USE_16BIT;
143 gpmc_smsc911x_config.flags = gpmc_cfg->flags;
144 83
145 pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, 84 pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
146 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), 85 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 8121720e942f..b0268eaffe13 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -316,6 +316,7 @@ static int __init omap_hsmmc_pdata_init(struct omap2_hsmmc_info *c,
316 mmc->slots[0].pm_caps = c->pm_caps; 316 mmc->slots[0].pm_caps = c->pm_caps;
317 mmc->slots[0].internal_clock = !c->ext_clock; 317 mmc->slots[0].internal_clock = !c->ext_clock;
318 mmc->dma_mask = 0xffffffff; 318 mmc->dma_mask = 0xffffffff;
319 mmc->max_freq = c->max_freq;
319 if (cpu_is_omap44xx()) 320 if (cpu_is_omap44xx())
320 mmc->reg_offset = OMAP4_MMC_REG_OFFSET; 321 mmc->reg_offset = OMAP4_MMC_REG_OFFSET;
321 else 322 else
@@ -505,6 +506,13 @@ static void __init omap_hsmmc_init_one(struct omap2_hsmmc_info *hsmmcinfo,
505 if (oh->dev_attr != NULL) { 506 if (oh->dev_attr != NULL) {
506 mmc_dev_attr = oh->dev_attr; 507 mmc_dev_attr = oh->dev_attr;
507 mmc_data->controller_flags = mmc_dev_attr->flags; 508 mmc_data->controller_flags = mmc_dev_attr->flags;
509 /*
510 * erratum 2.1.1.128 doesn't apply if board has
511 * a transceiver is attached
512 */
513 if (hsmmcinfo->transceiver)
514 mmc_data->controller_flags &=
515 ~OMAP_HSMMC_BROKEN_MULTIBLOCK_READ;
508 } 516 }
509 517
510 pdev = platform_device_alloc(name, ctrl_nr - 1); 518 pdev = platform_device_alloc(name, ctrl_nr - 1);
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index 07831cc3c171..7f2e790e0929 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -27,6 +27,8 @@ struct omap2_hsmmc_info {
27 char *name; /* or NULL for default */ 27 char *name; /* or NULL for default */
28 struct platform_device *pdev; /* mmc controller instance */ 28 struct platform_device *pdev; /* mmc controller instance */
29 int ocr_mask; /* temporary HACK */ 29 int ocr_mask; /* temporary HACK */
30 int max_freq; /* maximum clock, if constrained by external
31 * circuitry, or 0 for default */
30 /* Remux (pad configuration) when powering on/off */ 32 /* Remux (pad configuration) when powering on/off */
31 void (*remux)(struct device *dev, int slot, int power_on); 33 void (*remux)(struct device *dev, int slot, int power_on);
32 /* init some special card */ 34 /* init some special card */
diff --git a/arch/arm/mach-omap2/include/mach/barriers.h b/arch/arm/mach-omap2/include/mach/barriers.h
index 4fa72c7cc7cd..1c582a8592b9 100644
--- a/arch/arm/mach-omap2/include/mach/barriers.h
+++ b/arch/arm/mach-omap2/include/mach/barriers.h
@@ -22,6 +22,8 @@
22#ifndef __MACH_BARRIERS_H 22#ifndef __MACH_BARRIERS_H
23#define __MACH_BARRIERS_H 23#define __MACH_BARRIERS_H
24 24
25#include <asm/outercache.h>
26
25extern void omap_bus_sync(void); 27extern void omap_bus_sync(void);
26 28
27#define rmb() dsb() 29#define rmb() dsb()
diff --git a/arch/arm/mach-omap2/include/mach/io.h b/arch/arm/mach-omap2/include/mach/io.h
deleted file mode 100644
index b8758c8a9394..000000000000
--- a/arch/arm/mach-omap2/include/mach/io.h
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * arch/arm/mach-omap2/include/mach/io.h
3 *
4 * IO definitions for TI OMAP processors and boards
5 *
6 * Copied from arch/arm/mach-sa1100/include/mach/io.h
7 * Copyright (C) 1997-1999 Russell King
8 *
9 * Copyright (C) 2009 Texas Instruments
10 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 *
32 * Modifications:
33 * 06-12-1997 RMK Created.
34 * 07-04-1999 RMK Major cleanup
35 */
36
37#ifndef __ASM_ARM_ARCH_IO_H
38#define __ASM_ARM_ARCH_IO_H
39
40#define IO_SPACE_LIMIT 0xffffffff
41
42/*
43 * We don't actually have real ISA nor PCI buses, but there is so many
44 * drivers out there that might just work if we fake them...
45 */
46#define __io(a) __typesafe_io(a)
47#define __mem_pci(a) (a)
48
49#endif
diff --git a/arch/arm/mach-omap2/iomap.h b/arch/arm/mach-omap2/iomap.h
index e6f958165296..0812b154f5b5 100644
--- a/arch/arm/mach-omap2/iomap.h
+++ b/arch/arm/mach-omap2/iomap.h
@@ -22,12 +22,6 @@
22 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25#ifdef __ASSEMBLER__
26#define IOMEM(x) (x)
27#else
28#define IOMEM(x) ((void __force __iomem *)(x))
29#endif
30
31#define OMAP2_L3_IO_OFFSET 0x90000000 25#define OMAP2_L3_IO_OFFSET 0x90000000
32#define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */ 26#define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */
33 27
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index f26b2faa1694..65c33911341f 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -35,7 +35,6 @@
35#include <linux/irq.h> 35#include <linux/irq.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37 37
38#include <asm/system.h>
39 38
40#include <plat/omap_hwmod.h> 39#include <plat/omap_hwmod.h>
41 40
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index 63ab686834c1..13670aa84e58 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -46,7 +46,6 @@
46#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
47#include <asm/tlbflush.h> 47#include <asm/tlbflush.h>
48#include <asm/smp_scu.h> 48#include <asm/smp_scu.h>
49#include <asm/system.h>
50#include <asm/pgalloc.h> 49#include <asm/pgalloc.h>
51#include <asm/suspend.h> 50#include <asm/suspend.h>
52#include <asm/hardware/cache-l2x0.h> 51#include <asm/hardware/cache-l2x0.h>
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index eba6cd3816f5..2c27fdb61e66 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -1395,7 +1395,7 @@ static int _read_hardreset(struct omap_hwmod *oh, const char *name)
1395 */ 1395 */
1396static int _ocp_softreset(struct omap_hwmod *oh) 1396static int _ocp_softreset(struct omap_hwmod *oh)
1397{ 1397{
1398 u32 v; 1398 u32 v, softrst_mask;
1399 int c = 0; 1399 int c = 0;
1400 int ret = 0; 1400 int ret = 0;
1401 1401
@@ -1427,11 +1427,13 @@ static int _ocp_softreset(struct omap_hwmod *oh)
1427 oh->class->sysc->syss_offs) 1427 oh->class->sysc->syss_offs)
1428 & SYSS_RESETDONE_MASK), 1428 & SYSS_RESETDONE_MASK),
1429 MAX_MODULE_SOFTRESET_WAIT, c); 1429 MAX_MODULE_SOFTRESET_WAIT, c);
1430 else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) 1430 else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
1431 softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
1431 omap_test_timeout(!(omap_hwmod_read(oh, 1432 omap_test_timeout(!(omap_hwmod_read(oh,
1432 oh->class->sysc->sysc_offs) 1433 oh->class->sysc->sysc_offs)
1433 & SYSC_TYPE2_SOFTRESET_MASK), 1434 & softrst_mask),
1434 MAX_MODULE_SOFTRESET_WAIT, c); 1435 MAX_MODULE_SOFTRESET_WAIT, c);
1436 }
1435 1437
1436 if (c == MAX_MODULE_SOFTRESET_WAIT) 1438 if (c == MAX_MODULE_SOFTRESET_WAIT)
1437 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n", 1439 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",
@@ -1477,6 +1479,11 @@ static int _reset(struct omap_hwmod *oh)
1477 1479
1478 ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh); 1480 ret = (oh->class->reset) ? oh->class->reset(oh) : _ocp_softreset(oh);
1479 1481
1482 if (oh->class->sysc) {
1483 _update_sysc_cache(oh);
1484 _enable_sysc(oh);
1485 }
1486
1480 return ret; 1487 return ret;
1481} 1488}
1482 1489
@@ -1786,20 +1793,9 @@ static int _setup(struct omap_hwmod *oh, void *data)
1786 return 0; 1793 return 0;
1787 } 1794 }
1788 1795
1789 if (!(oh->flags & HWMOD_INIT_NO_RESET)) { 1796 if (!(oh->flags & HWMOD_INIT_NO_RESET))
1790 _reset(oh); 1797 _reset(oh);
1791 1798
1792 /*
1793 * OCP_SYSCONFIG bits need to be reprogrammed after a softreset.
1794 * The _enable() function should be split to
1795 * avoid the rewrite of the OCP_SYSCONFIG register.
1796 */
1797 if (oh->class->sysc) {
1798 _update_sysc_cache(oh);
1799 _enable_sysc(oh);
1800 }
1801 }
1802
1803 postsetup_state = oh->_postsetup_state; 1799 postsetup_state = oh->_postsetup_state;
1804 if (postsetup_state == _HWMOD_STATE_UNKNOWN) 1800 if (postsetup_state == _HWMOD_STATE_UNKNOWN)
1805 postsetup_state = _HWMOD_STATE_ENABLED; 1801 postsetup_state = _HWMOD_STATE_ENABLED;
@@ -1907,20 +1903,10 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs)
1907 */ 1903 */
1908int omap_hwmod_softreset(struct omap_hwmod *oh) 1904int omap_hwmod_softreset(struct omap_hwmod *oh)
1909{ 1905{
1910 u32 v; 1906 if (!oh)
1911 int ret;
1912
1913 if (!oh || !(oh->_sysc_cache))
1914 return -EINVAL; 1907 return -EINVAL;
1915 1908
1916 v = oh->_sysc_cache; 1909 return _ocp_softreset(oh);
1917 ret = _set_softreset(oh, &v);
1918 if (ret)
1919 goto error;
1920 _write_sysconfig(v, oh);
1921
1922error:
1923 return ret;
1924} 1910}
1925 1911
1926/** 1912/**
@@ -2463,26 +2449,28 @@ int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh,
2463 * @oh: struct omap_hwmod * 2449 * @oh: struct omap_hwmod *
2464 * 2450 *
2465 * Sets the module OCP socket ENAWAKEUP bit to allow the module to 2451 * Sets the module OCP socket ENAWAKEUP bit to allow the module to
2466 * send wakeups to the PRCM. Eventually this should sets PRCM wakeup 2452 * send wakeups to the PRCM, and enable I/O ring wakeup events for
2467 * registers to cause the PRCM to receive wakeup events from the 2453 * this IP block if it has dynamic mux entries. Eventually this
2468 * module. Does not set any wakeup routing registers beyond this 2454 * should set PRCM wakeup registers to cause the PRCM to receive
2469 * point - if the module is to wake up any other module or subsystem, 2455 * wakeup events from the module. Does not set any wakeup routing
2470 * that must be set separately. Called by omap_device code. Returns 2456 * registers beyond this point - if the module is to wake up any other
2471 * -EINVAL on error or 0 upon success. 2457 * module or subsystem, that must be set separately. Called by
2458 * omap_device code. Returns -EINVAL on error or 0 upon success.
2472 */ 2459 */
2473int omap_hwmod_enable_wakeup(struct omap_hwmod *oh) 2460int omap_hwmod_enable_wakeup(struct omap_hwmod *oh)
2474{ 2461{
2475 unsigned long flags; 2462 unsigned long flags;
2476 u32 v; 2463 u32 v;
2477 2464
2478 if (!oh->class->sysc ||
2479 !(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP))
2480 return -EINVAL;
2481
2482 spin_lock_irqsave(&oh->_lock, flags); 2465 spin_lock_irqsave(&oh->_lock, flags);
2483 v = oh->_sysc_cache; 2466
2484 _enable_wakeup(oh, &v); 2467 if (oh->class->sysc &&
2485 _write_sysconfig(v, oh); 2468 (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) {
2469 v = oh->_sysc_cache;
2470 _enable_wakeup(oh, &v);
2471 _write_sysconfig(v, oh);
2472 }
2473
2486 _set_idle_ioring_wakeup(oh, true); 2474 _set_idle_ioring_wakeup(oh, true);
2487 spin_unlock_irqrestore(&oh->_lock, flags); 2475 spin_unlock_irqrestore(&oh->_lock, flags);
2488 2476
@@ -2494,26 +2482,28 @@ int omap_hwmod_enable_wakeup(struct omap_hwmod *oh)
2494 * @oh: struct omap_hwmod * 2482 * @oh: struct omap_hwmod *
2495 * 2483 *
2496 * Clears the module OCP socket ENAWAKEUP bit to prevent the module 2484 * Clears the module OCP socket ENAWAKEUP bit to prevent the module
2497 * from sending wakeups to the PRCM. Eventually this should clear 2485 * from sending wakeups to the PRCM, and disable I/O ring wakeup
2498 * PRCM wakeup registers to cause the PRCM to ignore wakeup events 2486 * events for this IP block if it has dynamic mux entries. Eventually
2499 * from the module. Does not set any wakeup routing registers beyond 2487 * this should clear PRCM wakeup registers to cause the PRCM to ignore
2500 * this point - if the module is to wake up any other module or 2488 * wakeup events from the module. Does not set any wakeup routing
2501 * subsystem, that must be set separately. Called by omap_device 2489 * registers beyond this point - if the module is to wake up any other
2502 * code. Returns -EINVAL on error or 0 upon success. 2490 * module or subsystem, that must be set separately. Called by
2491 * omap_device code. Returns -EINVAL on error or 0 upon success.
2503 */ 2492 */
2504int omap_hwmod_disable_wakeup(struct omap_hwmod *oh) 2493int omap_hwmod_disable_wakeup(struct omap_hwmod *oh)
2505{ 2494{
2506 unsigned long flags; 2495 unsigned long flags;
2507 u32 v; 2496 u32 v;
2508 2497
2509 if (!oh->class->sysc ||
2510 !(oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP))
2511 return -EINVAL;
2512
2513 spin_lock_irqsave(&oh->_lock, flags); 2498 spin_lock_irqsave(&oh->_lock, flags);
2514 v = oh->_sysc_cache; 2499
2515 _disable_wakeup(oh, &v); 2500 if (oh->class->sysc &&
2516 _write_sysconfig(v, oh); 2501 (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)) {
2502 v = oh->_sysc_cache;
2503 _disable_wakeup(oh, &v);
2504 _write_sysconfig(v, oh);
2505 }
2506
2517 _set_idle_ioring_wakeup(oh, false); 2507 _set_idle_ioring_wakeup(oh, false);
2518 spin_unlock_irqrestore(&oh->_lock, flags); 2508 spin_unlock_irqrestore(&oh->_lock, flags);
2519 2509
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 08daa5e0eb5f..cc9bd106a854 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -2996,6 +2996,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp1_slaves[] = {
2996 &omap44xx_l4_abe__mcbsp1_dma, 2996 &omap44xx_l4_abe__mcbsp1_dma,
2997}; 2997};
2998 2998
2999static struct omap_hwmod_opt_clk mcbsp1_opt_clks[] = {
3000 { .role = "pad_fck", .clk = "pad_clks_ck" },
3001 { .role = "prcm_clk", .clk = "mcbsp1_sync_mux_ck" },
3002};
3003
2999static struct omap_hwmod omap44xx_mcbsp1_hwmod = { 3004static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
3000 .name = "mcbsp1", 3005 .name = "mcbsp1",
3001 .class = &omap44xx_mcbsp_hwmod_class, 3006 .class = &omap44xx_mcbsp_hwmod_class,
@@ -3012,6 +3017,8 @@ static struct omap_hwmod omap44xx_mcbsp1_hwmod = {
3012 }, 3017 },
3013 .slaves = omap44xx_mcbsp1_slaves, 3018 .slaves = omap44xx_mcbsp1_slaves,
3014 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves), 3019 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp1_slaves),
3020 .opt_clks = mcbsp1_opt_clks,
3021 .opt_clks_cnt = ARRAY_SIZE(mcbsp1_opt_clks),
3015}; 3022};
3016 3023
3017/* mcbsp2 */ 3024/* mcbsp2 */
@@ -3071,6 +3078,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp2_slaves[] = {
3071 &omap44xx_l4_abe__mcbsp2_dma, 3078 &omap44xx_l4_abe__mcbsp2_dma,
3072}; 3079};
3073 3080
3081static struct omap_hwmod_opt_clk mcbsp2_opt_clks[] = {
3082 { .role = "pad_fck", .clk = "pad_clks_ck" },
3083 { .role = "prcm_clk", .clk = "mcbsp2_sync_mux_ck" },
3084};
3085
3074static struct omap_hwmod omap44xx_mcbsp2_hwmod = { 3086static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
3075 .name = "mcbsp2", 3087 .name = "mcbsp2",
3076 .class = &omap44xx_mcbsp_hwmod_class, 3088 .class = &omap44xx_mcbsp_hwmod_class,
@@ -3087,6 +3099,8 @@ static struct omap_hwmod omap44xx_mcbsp2_hwmod = {
3087 }, 3099 },
3088 .slaves = omap44xx_mcbsp2_slaves, 3100 .slaves = omap44xx_mcbsp2_slaves,
3089 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves), 3101 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp2_slaves),
3102 .opt_clks = mcbsp2_opt_clks,
3103 .opt_clks_cnt = ARRAY_SIZE(mcbsp2_opt_clks),
3090}; 3104};
3091 3105
3092/* mcbsp3 */ 3106/* mcbsp3 */
@@ -3146,6 +3160,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp3_slaves[] = {
3146 &omap44xx_l4_abe__mcbsp3_dma, 3160 &omap44xx_l4_abe__mcbsp3_dma,
3147}; 3161};
3148 3162
3163static struct omap_hwmod_opt_clk mcbsp3_opt_clks[] = {
3164 { .role = "pad_fck", .clk = "pad_clks_ck" },
3165 { .role = "prcm_clk", .clk = "mcbsp3_sync_mux_ck" },
3166};
3167
3149static struct omap_hwmod omap44xx_mcbsp3_hwmod = { 3168static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
3150 .name = "mcbsp3", 3169 .name = "mcbsp3",
3151 .class = &omap44xx_mcbsp_hwmod_class, 3170 .class = &omap44xx_mcbsp_hwmod_class,
@@ -3162,6 +3181,8 @@ static struct omap_hwmod omap44xx_mcbsp3_hwmod = {
3162 }, 3181 },
3163 .slaves = omap44xx_mcbsp3_slaves, 3182 .slaves = omap44xx_mcbsp3_slaves,
3164 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves), 3183 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp3_slaves),
3184 .opt_clks = mcbsp3_opt_clks,
3185 .opt_clks_cnt = ARRAY_SIZE(mcbsp3_opt_clks),
3165}; 3186};
3166 3187
3167/* mcbsp4 */ 3188/* mcbsp4 */
@@ -3200,6 +3221,11 @@ static struct omap_hwmod_ocp_if *omap44xx_mcbsp4_slaves[] = {
3200 &omap44xx_l4_per__mcbsp4, 3221 &omap44xx_l4_per__mcbsp4,
3201}; 3222};
3202 3223
3224static struct omap_hwmod_opt_clk mcbsp4_opt_clks[] = {
3225 { .role = "pad_fck", .clk = "pad_clks_ck" },
3226 { .role = "prcm_clk", .clk = "mcbsp4_sync_mux_ck" },
3227};
3228
3203static struct omap_hwmod omap44xx_mcbsp4_hwmod = { 3229static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
3204 .name = "mcbsp4", 3230 .name = "mcbsp4",
3205 .class = &omap44xx_mcbsp_hwmod_class, 3231 .class = &omap44xx_mcbsp_hwmod_class,
@@ -3216,6 +3242,8 @@ static struct omap_hwmod omap44xx_mcbsp4_hwmod = {
3216 }, 3242 },
3217 .slaves = omap44xx_mcbsp4_slaves, 3243 .slaves = omap44xx_mcbsp4_slaves,
3218 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves), 3244 .slaves_cnt = ARRAY_SIZE(omap44xx_mcbsp4_slaves),
3245 .opt_clks = mcbsp4_opt_clks,
3246 .opt_clks_cnt = ARRAY_SIZE(mcbsp4_opt_clks),
3219}; 3247};
3220 3248
3221/* 3249/*
diff --git a/arch/arm/mach-omap2/opp.c b/arch/arm/mach-omap2/opp.c
index 9262a6b47702..de6d46451746 100644
--- a/arch/arm/mach-omap2/opp.c
+++ b/arch/arm/mach-omap2/opp.c
@@ -64,10 +64,10 @@ int __init omap_init_opp_table(struct omap_opp_def *opp_def,
64 } 64 }
65 oh = omap_hwmod_lookup(opp_def->hwmod_name); 65 oh = omap_hwmod_lookup(opp_def->hwmod_name);
66 if (!oh || !oh->od) { 66 if (!oh || !oh->od) {
67 pr_warn("%s: no hwmod or odev for %s, [%d] " 67 pr_debug("%s: no hwmod or odev for %s, [%d] "
68 "cannot add OPPs.\n", __func__, 68 "cannot add OPPs.\n", __func__,
69 opp_def->hwmod_name, i); 69 opp_def->hwmod_name, i);
70 return -EINVAL; 70 continue;
71 } 71 }
72 dev = &oh->od->pdev->dev; 72 dev = &oh->od->pdev->dev;
73 73
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index a7bdec69a2b3..d0c1c9695996 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -17,6 +17,8 @@
17#include <linux/export.h> 17#include <linux/export.h>
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19 19
20#include <asm/system_misc.h>
21
20#include <plat/omap-pm.h> 22#include <plat/omap-pm.h>
21#include <plat/omap_device.h> 23#include <plat/omap_device.h>
22#include "common.h" 24#include "common.h"
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 5ca45ca76946..95442b69ae27 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -33,6 +33,7 @@
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36#include <asm/system_misc.h>
36 37
37#include <plat/clock.h> 38#include <plat/clock.h>
38#include <plat/sram.h> 39#include <plat/sram.h>
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 027a537d72b2..703bd1099259 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -31,6 +31,7 @@
31#include <trace/events/power.h> 31#include <trace/events/power.h>
32 32
33#include <asm/suspend.h> 33#include <asm/suspend.h>
34#include <asm/system_misc.h>
34 35
35#include <plat/sram.h> 36#include <plat/sram.h>
36#include "clockdomain.h" 37#include "clockdomain.h"
@@ -152,8 +153,7 @@ static void omap3_save_secure_ram_context(void)
152 pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state); 153 pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state);
153 /* Following is for error tracking, it should not happen */ 154 /* Following is for error tracking, it should not happen */
154 if (ret) { 155 if (ret) {
155 printk(KERN_ERR "save_secure_sram() returns %08x\n", 156 pr_err("save_secure_sram() returns %08x\n", ret);
156 ret);
157 while (1) 157 while (1)
158 ; 158 ;
159 } 159 }
@@ -288,7 +288,7 @@ void omap_sram_idle(void)
288 break; 288 break;
289 default: 289 default:
290 /* Invalid state */ 290 /* Invalid state */
291 printk(KERN_ERR "Invalid mpu state in sram_idle\n"); 291 pr_err("Invalid mpu state in sram_idle\n");
292 return; 292 return;
293 } 293 }
294 294
@@ -438,18 +438,17 @@ restore:
438 list_for_each_entry(pwrst, &pwrst_list, node) { 438 list_for_each_entry(pwrst, &pwrst_list, node) {
439 state = pwrdm_read_prev_pwrst(pwrst->pwrdm); 439 state = pwrdm_read_prev_pwrst(pwrst->pwrdm);
440 if (state > pwrst->next_state) { 440 if (state > pwrst->next_state) {
441 printk(KERN_INFO "Powerdomain (%s) didn't enter " 441 pr_info("Powerdomain (%s) didn't enter "
442 "target state %d\n", 442 "target state %d\n",
443 pwrst->pwrdm->name, pwrst->next_state); 443 pwrst->pwrdm->name, pwrst->next_state);
444 ret = -1; 444 ret = -1;
445 } 445 }
446 omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); 446 omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
447 } 447 }
448 if (ret) 448 if (ret)
449 printk(KERN_ERR "Could not enter target state in pm_suspend\n"); 449 pr_err("Could not enter target state in pm_suspend\n");
450 else 450 else
451 printk(KERN_INFO "Successfully put all powerdomains " 451 pr_info("Successfully put all powerdomains to target state\n");
452 "to target state\n");
453 452
454 return ret; 453 return ret;
455} 454}
@@ -733,21 +732,22 @@ static int __init omap3_pm_init(void)
733 732
734 if (ret) { 733 if (ret) {
735 pr_err("pm: Failed to request pm_io irq\n"); 734 pr_err("pm: Failed to request pm_io irq\n");
736 goto err1; 735 goto err2;
737 } 736 }
738 737
739 ret = pwrdm_for_each(pwrdms_setup, NULL); 738 ret = pwrdm_for_each(pwrdms_setup, NULL);
740 if (ret) { 739 if (ret) {
741 printk(KERN_ERR "Failed to setup powerdomains\n"); 740 pr_err("Failed to setup powerdomains\n");
742 goto err2; 741 goto err3;
743 } 742 }
744 743
745 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL); 744 (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
746 745
747 mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); 746 mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
748 if (mpu_pwrdm == NULL) { 747 if (mpu_pwrdm == NULL) {
749 printk(KERN_ERR "Failed to get mpu_pwrdm\n"); 748 pr_err("Failed to get mpu_pwrdm\n");
750 goto err2; 749 ret = -EINVAL;
750 goto err3;
751 } 751 }
752 752
753 neon_pwrdm = pwrdm_lookup("neon_pwrdm"); 753 neon_pwrdm = pwrdm_lookup("neon_pwrdm");
@@ -780,8 +780,8 @@ static int __init omap3_pm_init(void)
780 omap3_secure_ram_storage = 780 omap3_secure_ram_storage =
781 kmalloc(0x803F, GFP_KERNEL); 781 kmalloc(0x803F, GFP_KERNEL);
782 if (!omap3_secure_ram_storage) 782 if (!omap3_secure_ram_storage)
783 printk(KERN_ERR "Memory allocation failed when" 783 pr_err("Memory allocation failed when "
784 "allocating for secure sram context\n"); 784 "allocating for secure sram context\n");
785 785
786 local_irq_disable(); 786 local_irq_disable();
787 local_fiq_disable(); 787 local_fiq_disable();
@@ -795,14 +795,17 @@ static int __init omap3_pm_init(void)
795 } 795 }
796 796
797 omap3_save_scratchpad_contents(); 797 omap3_save_scratchpad_contents();
798err1:
799 return ret; 798 return ret;
800err2: 799
801 free_irq(INT_34XX_PRCM_MPU_IRQ, NULL); 800err3:
802 list_for_each_entry_safe(pwrst, tmp, &pwrst_list, node) { 801 list_for_each_entry_safe(pwrst, tmp, &pwrst_list, node) {
803 list_del(&pwrst->node); 802 list_del(&pwrst->node);
804 kfree(pwrst); 803 kfree(pwrst);
805 } 804 }
805 free_irq(omap_prcm_event_to_irq("io"), omap3_pm_init);
806err2:
807 free_irq(omap_prcm_event_to_irq("wkup"), NULL);
808err1:
806 return ret; 809 return ret;
807} 810}
808 811
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 91e0b1c9b76c..885625352429 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -16,6 +16,7 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/err.h> 17#include <linux/err.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <asm/system_misc.h>
19 20
20#include "common.h" 21#include "common.h"
21#include "clockdomain.h" 22#include "clockdomain.h"
@@ -143,7 +144,7 @@ static void omap_default_idle(void)
143static int __init omap4_pm_init(void) 144static int __init omap4_pm_init(void)
144{ 145{
145 int ret; 146 int ret;
146 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm; 147 struct clockdomain *emif_clkdm, *mpuss_clkdm, *l3_1_clkdm, *l4wkup;
147 struct clockdomain *ducati_clkdm, *l3_2_clkdm, *l4_per_clkdm; 148 struct clockdomain *ducati_clkdm, *l3_2_clkdm, *l4_per_clkdm;
148 149
149 if (!cpu_is_omap44xx()) 150 if (!cpu_is_omap44xx())
@@ -167,14 +168,19 @@ static int __init omap4_pm_init(void)
167 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as 168 * MPUSS -> L4_PER/L3_* and DUCATI -> L3_* doesn't work as
168 * expected. The hardware recommendation is to enable static 169 * expected. The hardware recommendation is to enable static
169 * dependencies for these to avoid system lock ups or random crashes. 170 * dependencies for these to avoid system lock ups or random crashes.
171 * The L4 wakeup depedency is added to workaround the OCP sync hardware
172 * BUG with 32K synctimer which lead to incorrect timer value read
173 * from the 32K counter. The BUG applies for GPTIMER1 and WDT2 which
174 * are part of L4 wakeup clockdomain.
170 */ 175 */
171 mpuss_clkdm = clkdm_lookup("mpuss_clkdm"); 176 mpuss_clkdm = clkdm_lookup("mpuss_clkdm");
172 emif_clkdm = clkdm_lookup("l3_emif_clkdm"); 177 emif_clkdm = clkdm_lookup("l3_emif_clkdm");
173 l3_1_clkdm = clkdm_lookup("l3_1_clkdm"); 178 l3_1_clkdm = clkdm_lookup("l3_1_clkdm");
174 l3_2_clkdm = clkdm_lookup("l3_2_clkdm"); 179 l3_2_clkdm = clkdm_lookup("l3_2_clkdm");
175 l4_per_clkdm = clkdm_lookup("l4_per_clkdm"); 180 l4_per_clkdm = clkdm_lookup("l4_per_clkdm");
181 l4wkup = clkdm_lookup("l4_wkup_clkdm");
176 ducati_clkdm = clkdm_lookup("ducati_clkdm"); 182 ducati_clkdm = clkdm_lookup("ducati_clkdm");
177 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) || 183 if ((!mpuss_clkdm) || (!emif_clkdm) || (!l3_1_clkdm) || (!l4wkup) ||
178 (!l3_2_clkdm) || (!ducati_clkdm) || (!l4_per_clkdm)) 184 (!l3_2_clkdm) || (!ducati_clkdm) || (!l4_per_clkdm))
179 goto err2; 185 goto err2;
180 186
@@ -182,6 +188,7 @@ static int __init omap4_pm_init(void)
182 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm); 188 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_1_clkdm);
183 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm); 189 ret |= clkdm_add_wkdep(mpuss_clkdm, l3_2_clkdm);
184 ret |= clkdm_add_wkdep(mpuss_clkdm, l4_per_clkdm); 190 ret |= clkdm_add_wkdep(mpuss_clkdm, l4_per_clkdm);
191 ret |= clkdm_add_wkdep(mpuss_clkdm, l4wkup);
185 ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm); 192 ret |= clkdm_add_wkdep(ducati_clkdm, l3_1_clkdm);
186 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm); 193 ret |= clkdm_add_wkdep(ducati_clkdm, l3_2_clkdm);
187 if (ret) { 194 if (ret) {
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 8a18d1bd61c8..96ad3dbeac34 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -972,7 +972,13 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm)
972 972
973int pwrdm_state_switch(struct powerdomain *pwrdm) 973int pwrdm_state_switch(struct powerdomain *pwrdm)
974{ 974{
975 return _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW); 975 int ret;
976
977 ret = pwrdm_wait_transition(pwrdm);
978 if (!ret)
979 ret = _pwrdm_state_switch(pwrdm, PWRDM_STATE_NOW);
980
981 return ret;
976} 982}
977 983
978int pwrdm_clkdm_state_switch(struct clockdomain *clkdm) 984int pwrdm_clkdm_state_switch(struct clockdomain *clkdm)
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index eac623c7c3d8..f106d21ff581 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -147,8 +147,9 @@ static inline u32 _read_pending_irq_reg(u16 irqen_offs, u16 irqst_offs)
147 u32 mask, st; 147 u32 mask, st;
148 148
149 /* XXX read mask from RAM? */ 149 /* XXX read mask from RAM? */
150 mask = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, irqen_offs); 150 mask = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
151 st = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, irqst_offs); 151 irqen_offs);
152 st = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, irqst_offs);
152 153
153 return mask & st; 154 return mask & st;
154} 155}
@@ -180,7 +181,7 @@ void omap44xx_prm_read_pending_irqs(unsigned long *events)
180 */ 181 */
181void omap44xx_prm_ocp_barrier(void) 182void omap44xx_prm_ocp_barrier(void)
182{ 183{
183 omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 184 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
184 OMAP4_REVISION_PRM_OFFSET); 185 OMAP4_REVISION_PRM_OFFSET);
185} 186}
186 187
@@ -198,19 +199,19 @@ void omap44xx_prm_ocp_barrier(void)
198void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask) 199void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask)
199{ 200{
200 saved_mask[0] = 201 saved_mask[0] =
201 omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 202 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
202 OMAP4_PRM_IRQSTATUS_MPU_OFFSET); 203 OMAP4_PRM_IRQSTATUS_MPU_OFFSET);
203 saved_mask[1] = 204 saved_mask[1] =
204 omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 205 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
205 OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET); 206 OMAP4_PRM_IRQSTATUS_MPU_2_OFFSET);
206 207
207 omap4_prm_write_inst_reg(0, OMAP4430_PRM_DEVICE_INST, 208 omap4_prm_write_inst_reg(0, OMAP4430_PRM_OCP_SOCKET_INST,
208 OMAP4_PRM_IRQENABLE_MPU_OFFSET); 209 OMAP4_PRM_IRQENABLE_MPU_OFFSET);
209 omap4_prm_write_inst_reg(0, OMAP4430_PRM_DEVICE_INST, 210 omap4_prm_write_inst_reg(0, OMAP4430_PRM_OCP_SOCKET_INST,
210 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); 211 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET);
211 212
212 /* OCP barrier */ 213 /* OCP barrier */
213 omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, 214 omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
214 OMAP4_REVISION_PRM_OFFSET); 215 OMAP4_REVISION_PRM_OFFSET);
215} 216}
216 217
@@ -226,9 +227,9 @@ void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask)
226 */ 227 */
227void omap44xx_prm_restore_irqen(u32 *saved_mask) 228void omap44xx_prm_restore_irqen(u32 *saved_mask)
228{ 229{
229 omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_DEVICE_INST, 230 omap4_prm_write_inst_reg(saved_mask[0], OMAP4430_PRM_OCP_SOCKET_INST,
230 OMAP4_PRM_IRQENABLE_MPU_OFFSET); 231 OMAP4_PRM_IRQENABLE_MPU_OFFSET);
231 omap4_prm_write_inst_reg(saved_mask[1], OMAP4430_PRM_DEVICE_INST, 232 omap4_prm_write_inst_reg(saved_mask[1], OMAP4430_PRM_OCP_SOCKET_INST,
232 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET); 233 OMAP4_PRM_IRQENABLE_MPU_2_OFFSET);
233} 234}
234 235
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 873b51d494ea..d28f848897d6 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -290,7 +290,7 @@ int omap_prcm_register_chain_handler(struct omap_prcm_irq_setup *irq_setup)
290 goto err; 290 goto err;
291 } 291 }
292 292
293 for (i = 0; i <= irq_setup->nr_regs; i++) { 293 for (i = 0; i < irq_setup->nr_regs; i++) {
294 gc = irq_alloc_generic_chip("PRCM", 1, 294 gc = irq_alloc_generic_chip("PRCM", 1,
295 irq_setup->base_irq + i * 32, prm_base, 295 irq_setup->base_irq + i * 32, prm_base,
296 handle_level_irq); 296 handle_level_irq);
diff --git a/arch/arm/mach-omap2/sleep44xx.S b/arch/arm/mach-omap2/sleep44xx.S
index abd283400490..9f6b83d1b193 100644
--- a/arch/arm/mach-omap2/sleep44xx.S
+++ b/arch/arm/mach-omap2/sleep44xx.S
@@ -10,7 +10,6 @@
10 */ 10 */
11 11
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <asm/system.h>
14#include <asm/smp_scu.h> 13#include <asm/smp_scu.h>
15#include <asm/memory.h> 14#include <asm/memory.h>
16#include <asm/hardware/cache-l2x0.h> 15#include <asm/hardware/cache-l2x0.h>
diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index f51348dafafd..dde8a11f47d5 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -54,7 +54,7 @@ static struct omap_device_pm_latency omap_uhhtll_latency[] = {
54/* 54/*
55 * setup_ehci_io_mux - initialize IO pad mux for USBHOST 55 * setup_ehci_io_mux - initialize IO pad mux for USBHOST
56 */ 56 */
57static void setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) 57static void __init setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
58{ 58{
59 switch (port_mode[0]) { 59 switch (port_mode[0]) {
60 case OMAP_EHCI_PORT_MODE_PHY: 60 case OMAP_EHCI_PORT_MODE_PHY:
@@ -197,7 +197,8 @@ static void setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
197 return; 197 return;
198} 198}
199 199
200static void setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) 200static
201void __init setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
201{ 202{
202 switch (port_mode[0]) { 203 switch (port_mode[0]) {
203 case OMAP_EHCI_PORT_MODE_PHY: 204 case OMAP_EHCI_PORT_MODE_PHY:
@@ -315,7 +316,7 @@ static void setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode)
315 } 316 }
316} 317}
317 318
318static void setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) 319static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
319{ 320{
320 switch (port_mode[0]) { 321 switch (port_mode[0]) {
321 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: 322 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
@@ -412,7 +413,8 @@ static void setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
412 } 413 }
413} 414}
414 415
415static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) 416static
417void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
416{ 418{
417 switch (port_mode[0]) { 419 switch (port_mode[0]) {
418 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: 420 case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 5dad38ec00ea..24481666d2cd 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -21,6 +21,7 @@
21#include <net/dsa.h> 21#include <net/dsa.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/setup.h> 23#include <asm/setup.h>
24#include <asm/system_misc.h>
24#include <asm/timex.h> 25#include <asm/timex.h>
25#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 27#include <asm/mach/map.h>
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index d2513ac79ff5..2e6454c8d4ba 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -57,5 +57,14 @@ struct meminfo;
57struct tag; 57struct tag;
58extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); 58extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *);
59 59
60/*****************************************************************************
61 * Helpers to access Orion registers
62 ****************************************************************************/
63/*
64 * These are not preempt-safe. Locks, if needed, must be taken
65 * care of by the caller.
66 */
67#define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r))
68#define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r))
60 69
61#endif 70#endif
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 91b0f4788597..c3ed15b8ea25 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -32,6 +32,7 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/pci.h> 34#include <asm/mach/pci.h>
35#include <asm/system_info.h>
35#include <mach/orion5x.h> 36#include <mach/orion5x.h>
36#include "common.h" 37#include "common.h"
37#include "mpp.h" 38#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/include/mach/io.h b/arch/arm/mach-orion5x/include/mach/io.h
deleted file mode 100644
index e9d9afdc2659..000000000000
--- a/arch/arm/mach-orion5x/include/mach/io.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-orion5x/include/mach/io.h
3 *
4 * Tzachi Perelstein <tzachi@marvell.com>
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __ASM_ARCH_IO_H
12#define __ASM_ARCH_IO_H
13
14#include "orion5x.h"
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18#define __io(a) __typesafe_io(a)
19#define __mem_pci(a) (a)
20
21
22/*****************************************************************************
23 * Helpers to access Orion registers
24 ****************************************************************************/
25/*
26 * These are not preempt-safe. Locks, if needed, must be taken
27 * care of by the caller.
28 */
29#define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r))
30#define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r))
31
32
33#endif
diff --git a/arch/arm/mach-orion5x/ls-chl-setup.c b/arch/arm/mach-orion5x/ls-chl-setup.c
index 527213169db0..0c9e413b5805 100644
--- a/arch/arm/mach-orion5x/ls-chl-setup.c
+++ b/arch/arm/mach-orion5x/ls-chl-setup.c
@@ -22,7 +22,6 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
25#include <asm/system.h>
26#include <mach/orion5x.h> 25#include <mach/orion5x.h>
27#include "common.h" 26#include "common.h"
28#include "mpp.h" 27#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/ls_hgl-setup.c b/arch/arm/mach-orion5x/ls_hgl-setup.c
index 9a8697b97dd7..c1b5d8a58037 100644
--- a/arch/arm/mach-orion5x/ls_hgl-setup.c
+++ b/arch/arm/mach-orion5x/ls_hgl-setup.c
@@ -21,7 +21,6 @@
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/system.h>
25#include <mach/orion5x.h> 24#include <mach/orion5x.h>
26#include "common.h" 25#include "common.h"
27#include "mpp.h" 26#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/lsmini-setup.c b/arch/arm/mach-orion5x/lsmini-setup.c
index 09c73659f467..949eaa8f12e3 100644
--- a/arch/arm/mach-orion5x/lsmini-setup.c
+++ b/arch/arm/mach-orion5x/lsmini-setup.c
@@ -21,7 +21,6 @@
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
24#include <asm/system.h>
25#include <mach/orion5x.h> 24#include <mach/orion5x.h>
26#include "common.h" 25#include "common.h"
27#include "mpp.h" 26#include "mpp.h"
diff --git a/arch/arm/mach-orion5x/pci.c b/arch/arm/mach-orion5x/pci.c
index d6a91948e4dc..cb19e1661bb3 100644
--- a/arch/arm/mach-orion5x/pci.c
+++ b/arch/arm/mach-orion5x/pci.c
@@ -19,6 +19,7 @@
19#include <asm/mach/pci.h> 19#include <asm/mach/pci.h>
20#include <plat/pcie.h> 20#include <plat/pcie.h>
21#include <plat/addr-map.h> 21#include <plat/addr-map.h>
22#include <mach/orion5x.h>
22#include "common.h" 23#include "common.h"
23 24
24/***************************************************************************** 25/*****************************************************************************
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c
index c9abb8fbfa70..7189827d641d 100644
--- a/arch/arm/mach-orion5x/tsx09-common.c
+++ b/arch/arm/mach-orion5x/tsx09-common.c
@@ -15,6 +15,7 @@
15#include <linux/mv643xx_eth.h> 15#include <linux/mv643xx_eth.h>
16#include <linux/timex.h> 16#include <linux/timex.h>
17#include <linux/serial_reg.h> 17#include <linux/serial_reg.h>
18#include <mach/orion5x.h>
18#include "tsx09-common.h" 19#include "tsx09-common.h"
19#include "common.h" 20#include "common.h"
20 21
diff --git a/arch/arm/mach-picoxcell/include/mach/io.h b/arch/arm/mach-picoxcell/include/mach/io.h
deleted file mode 100644
index 7573ec7d10a3..000000000000
--- a/arch/arm/mach-picoxcell/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright (c) 2011 Picochip Ltd., Jamie Iles
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H
16
17/* No ioports, but needed for driver compatibility. */
18#define __io(a) __typesafe_io(a)
19/* No PCI possible on picoxcell. */
20#define __mem_pci(a) (a)
21
22#endif /* __ASM_ARM_ARCH_IO_H */
diff --git a/arch/arm/mach-picoxcell/include/mach/irqs.h b/arch/arm/mach-picoxcell/include/mach/irqs.h
deleted file mode 100644
index 59eac1ee2820..000000000000
--- a/arch/arm/mach-picoxcell/include/mach/irqs.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * Copyright (c) 2011 Picochip Ltd., Jamie Iles
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef __MACH_IRQS_H
15#define __MACH_IRQS_H
16
17/* We dynamically allocate our irq_desc's. */
18#define NR_IRQS 0
19
20#endif /* __MACH_IRQS_H */
diff --git a/arch/arm/mach-pnx4008/core.c b/arch/arm/mach-pnx4008/core.c
index 4cfb40b2ec19..be4c92858509 100644
--- a/arch/arm/mach-pnx4008/core.c
+++ b/arch/arm/mach-pnx4008/core.c
@@ -32,7 +32,7 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <asm/page.h> 34#include <asm/page.h>
35#include <asm/system.h> 35#include <asm/system_misc.h>
36 36
37#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
diff --git a/arch/arm/mach-pnx4008/dma.c b/arch/arm/mach-pnx4008/dma.c
index 7fa4bf2e2125..a4739e9fb2fb 100644
--- a/arch/arm/mach-pnx4008/dma.c
+++ b/arch/arm/mach-pnx4008/dma.c
@@ -24,7 +24,6 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/gfp.h> 25#include <linux/gfp.h>
26 26
27#include <asm/system.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29#include <mach/dma.h> 28#include <mach/dma.h>
30#include <asm/dma-mapping.h> 29#include <asm/dma-mapping.h>
diff --git a/arch/arm/mach-pnx4008/include/mach/io.h b/arch/arm/mach-pnx4008/include/mach/io.h
deleted file mode 100644
index cbf0904540ea..000000000000
--- a/arch/arm/mach-pnx4008/include/mach/io.h
+++ /dev/null
@@ -1,21 +0,0 @@
1
2/*
3 * arch/arm/mach-pnx4008/include/mach/io.h
4 *
5 * Author: Dmitry Chigirev <chigirev@ru.mvista.com>
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H
15
16#define IO_SPACE_LIMIT 0xffffffff
17
18#define __io(a) __typesafe_io(a)
19#define __mem_pci(a) (a)
20
21#endif
diff --git a/arch/arm/mach-pnx4008/irq.c b/arch/arm/mach-pnx4008/irq.c
index 7608c7a288cf..41e4201972d5 100644
--- a/arch/arm/mach-pnx4008/irq.c
+++ b/arch/arm/mach-pnx4008/irq.c
@@ -28,7 +28,6 @@
28#include <asm/setup.h> 28#include <asm/setup.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/page.h> 30#include <asm/page.h>
31#include <asm/system.h>
32#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
33#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
34#include <asm/mach/map.h> 33#include <asm/mach/map.h>
diff --git a/arch/arm/mach-pnx4008/time.c b/arch/arm/mach-pnx4008/time.c
index 0c8aad4bb0dc..0cfe8af3d3be 100644
--- a/arch/arm/mach-pnx4008/time.c
+++ b/arch/arm/mach-pnx4008/time.c
@@ -24,7 +24,6 @@
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <asm/system.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29#include <asm/leds.h> 28#include <asm/leds.h>
30#include <asm/mach/time.h> 29#include <asm/mach/time.h>
diff --git a/arch/arm/mach-prima2/include/mach/io.h b/arch/arm/mach-prima2/include/mach/io.h
deleted file mode 100644
index 6c31e9ec279e..000000000000
--- a/arch/arm/mach-prima2/include/mach/io.h
+++ /dev/null
@@ -1,16 +0,0 @@
1/*
2 * arch/arm/mach-prima2/include/mach/io.h
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#ifndef __MACH_PRIMA2_IO_H
10#define __MACH_PRIMA2_IO_H
11
12#define IO_SPACE_LIMIT ((resource_size_t)0)
13
14#define __mem_pci(a) (a)
15
16#endif
diff --git a/arch/arm/mach-prima2/timer.c b/arch/arm/mach-prima2/timer.c
index b7a6091ce791..0d024b1e916d 100644
--- a/arch/arm/mach-prima2/timer.c
+++ b/arch/arm/mach-prima2/timer.c
@@ -18,6 +18,7 @@
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/of_address.h> 19#include <linux/of_address.h>
20#include <mach/map.h> 20#include <mach/map.h>
21#include <asm/sched_clock.h>
21#include <asm/mach/time.h> 22#include <asm/mach/time.h>
22 23
23#define SIRFSOC_TIMER_COUNTER_LO 0x0000 24#define SIRFSOC_TIMER_COUNTER_LO 0x0000
@@ -165,21 +166,9 @@ static struct irqaction sirfsoc_timer_irq = {
165}; 166};
166 167
167/* Overwrite weak default sched_clock with more precise one */ 168/* Overwrite weak default sched_clock with more precise one */
168unsigned long long notrace sched_clock(void) 169static u32 notrace sirfsoc_read_sched_clock(void)
169{ 170{
170 static int is_mapped; 171 return (u32)(sirfsoc_timer_read(NULL) & 0xffffffff);
171
172 /*
173 * sched_clock is called earlier than .init of sys_timer
174 * if we map timer memory in .init of sys_timer, system
175 * will panic due to illegal memory access
176 */
177 if (!is_mapped) {
178 sirfsoc_of_timer_map();
179 is_mapped = 1;
180 }
181
182 return sirfsoc_timer_read(NULL) * (NSEC_PER_SEC / CLOCK_TICK_RATE);
183} 172}
184 173
185static void __init sirfsoc_clockevent_init(void) 174static void __init sirfsoc_clockevent_init(void)
@@ -210,6 +199,8 @@ static void __init sirfsoc_timer_init(void)
210 BUG_ON(rate < CLOCK_TICK_RATE); 199 BUG_ON(rate < CLOCK_TICK_RATE);
211 BUG_ON(rate % CLOCK_TICK_RATE); 200 BUG_ON(rate % CLOCK_TICK_RATE);
212 201
202 sirfsoc_of_timer_map();
203
213 writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV); 204 writel_relaxed(rate / CLOCK_TICK_RATE / 2 - 1, sirfsoc_timer_base + SIRFSOC_TIMER_DIV);
214 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO); 205 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_LO);
215 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI); 206 writel_relaxed(0, sirfsoc_timer_base + SIRFSOC_TIMER_COUNTER_HI);
@@ -217,6 +208,8 @@ static void __init sirfsoc_timer_init(void)
217 208
218 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE)); 209 BUG_ON(clocksource_register_hz(&sirfsoc_clocksource, CLOCK_TICK_RATE));
219 210
211 setup_sched_clock(sirfsoc_read_sched_clock, 32, CLOCK_TICK_RATE);
212
220 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq)); 213 BUG_ON(setup_irq(sirfsoc_timer_irq.irq, &sirfsoc_timer_irq));
221 214
222 sirfsoc_clockevent_init(); 215 sirfsoc_clockevent_init();
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 61d3c72ded84..fe2d1f80ef50 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -108,10 +108,12 @@ config CSB726_CSB701
108 108
109config MACH_ARMCORE 109config MACH_ARMCORE
110 bool "CompuLab CM-X255/CM-X270 modules" 110 bool "CompuLab CM-X255/CM-X270 modules"
111 select ARCH_HAS_DMA_SET_COHERENT_MASK if PCI
111 select PXA27x 112 select PXA27x
112 select IWMMXT 113 select IWMMXT
113 select PXA25x 114 select PXA25x
114 select MIGHT_HAVE_PCI 115 select MIGHT_HAVE_PCI
116 select NEED_MACH_IO_H if PCI
115 117
116config MACH_EM_X270 118config MACH_EM_X270
117 bool "CompuLab EM-x270 platform" 119 bool "CompuLab EM-x270 platform"
diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c
index c91727d1fe09..9a8760b72913 100644
--- a/arch/arm/mach-pxa/capc7117.c
+++ b/arch/arm/mach-pxa/capc7117.c
@@ -150,6 +150,7 @@ MACHINE_START(CAPC7117,
150 "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM") 150 "Embedian CAPC-7117 evaluation kit based on the MXM-8x10 CoM")
151 .atag_offset = 0x100, 151 .atag_offset = 0x100,
152 .map_io = pxa3xx_map_io, 152 .map_io = pxa3xx_map_io,
153 .nr_irqs = PXA_NR_IRQS,
153 .init_irq = pxa3xx_init_irq, 154 .init_irq = pxa3xx_init_irq,
154 .handle_irq = pxa3xx_handle_irq, 155 .handle_irq = pxa3xx_handle_irq,
155 .timer = &pxa_timer, 156 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/clock-pxa2xx.c b/arch/arm/mach-pxa/clock-pxa2xx.c
index 1d5859d9a0e3..9ee2ad6a0a07 100644
--- a/arch/arm/mach-pxa/clock-pxa2xx.c
+++ b/arch/arm/mach-pxa/clock-pxa2xx.c
@@ -9,6 +9,7 @@
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/io.h>
12#include <linux/syscore_ops.h> 13#include <linux/syscore_ops.h>
13 14
14#include <mach/pxa2xx-regs.h> 15#include <mach/pxa2xx-regs.h>
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 4b981b82d2a5..313274016277 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -44,6 +44,7 @@
44#include <asm/mach-types.h> 44#include <asm/mach-types.h>
45#include <asm/mach/arch.h> 45#include <asm/mach/arch.h>
46#include <asm/setup.h> 46#include <asm/setup.h>
47#include <asm/system_info.h>
47 48
48#include <mach/pxa300.h> 49#include <mach/pxa300.h>
49#include <mach/pxa27x-udc.h> 50#include <mach/pxa27x-udc.h>
@@ -713,7 +714,6 @@ struct da9030_battery_info cm_x300_battery_info = {
713 714
714static struct regulator_consumer_supply buck2_consumers[] = { 715static struct regulator_consumer_supply buck2_consumers[] = {
715 { 716 {
716 .dev = NULL,
717 .supply = "vcc_core", 717 .supply = "vcc_core",
718 }, 718 },
719}; 719};
@@ -853,6 +853,7 @@ static void __init cm_x300_fixup(struct tag *tags, char **cmdline,
853MACHINE_START(CM_X300, "CM-X300 module") 853MACHINE_START(CM_X300, "CM-X300 module")
854 .atag_offset = 0x100, 854 .atag_offset = 0x100,
855 .map_io = pxa3xx_map_io, 855 .map_io = pxa3xx_map_io,
856 .nr_irqs = PXA_NR_IRQS,
856 .init_irq = pxa3xx_init_irq, 857 .init_irq = pxa3xx_init_irq,
857 .handle_irq = pxa3xx_handle_irq, 858 .handle_irq = pxa3xx_handle_irq,
858 .timer = &pxa_timer, 859 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c
index 29d5d541f602..b2f227d36125 100644
--- a/arch/arm/mach-pxa/colibri-pxa270.c
+++ b/arch/arm/mach-pxa/colibri-pxa270.c
@@ -310,6 +310,7 @@ MACHINE_START(COLIBRI, "Toradex Colibri PXA270")
310 .atag_offset = 0x100, 310 .atag_offset = 0x100,
311 .init_machine = colibri_pxa270_init, 311 .init_machine = colibri_pxa270_init,
312 .map_io = pxa27x_map_io, 312 .map_io = pxa27x_map_io,
313 .nr_irqs = PXA_NR_IRQS,
313 .init_irq = pxa27x_init_irq, 314 .init_irq = pxa27x_init_irq,
314 .handle_irq = pxa27x_handle_irq, 315 .handle_irq = pxa27x_handle_irq,
315 .timer = &pxa_timer, 316 .timer = &pxa_timer,
@@ -320,6 +321,7 @@ MACHINE_START(INCOME, "Income s.r.o. SH-Dmaster PXA270 SBC")
320 .atag_offset = 0x100, 321 .atag_offset = 0x100,
321 .init_machine = colibri_pxa270_income_init, 322 .init_machine = colibri_pxa270_income_init,
322 .map_io = pxa27x_map_io, 323 .map_io = pxa27x_map_io,
324 .nr_irqs = PXA_NR_IRQS,
323 .init_irq = pxa27x_init_irq, 325 .init_irq = pxa27x_init_irq,
324 .handle_irq = pxa27x_handle_irq, 326 .handle_irq = pxa27x_handle_irq,
325 .timer = &pxa_timer, 327 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index 0846d210cb05..bb6def8ec979 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -186,6 +186,7 @@ MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
186 .atag_offset = 0x100, 186 .atag_offset = 0x100,
187 .init_machine = colibri_pxa300_init, 187 .init_machine = colibri_pxa300_init,
188 .map_io = pxa3xx_map_io, 188 .map_io = pxa3xx_map_io,
189 .nr_irqs = PXA_NR_IRQS,
189 .init_irq = pxa3xx_init_irq, 190 .init_irq = pxa3xx_init_irq,
190 .handle_irq = pxa3xx_handle_irq, 191 .handle_irq = pxa3xx_handle_irq,
191 .timer = &pxa_timer, 192 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
index 6ad3359063af..d88e7b37f1da 100644
--- a/arch/arm/mach-pxa/colibri-pxa320.c
+++ b/arch/arm/mach-pxa/colibri-pxa320.c
@@ -256,6 +256,7 @@ MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
256 .atag_offset = 0x100, 256 .atag_offset = 0x100,
257 .init_machine = colibri_pxa320_init, 257 .init_machine = colibri_pxa320_init,
258 .map_io = pxa3xx_map_io, 258 .map_io = pxa3xx_map_io,
259 .nr_irqs = PXA_NR_IRQS,
259 .init_irq = pxa3xx_init_irq, 260 .init_irq = pxa3xx_init_irq,
260 .handle_irq = pxa3xx_handle_irq, 261 .handle_irq = pxa3xx_handle_irq,
261 .timer = &pxa_timer, 262 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c
index 2b8ca0de8a3d..68cc75fac219 100644
--- a/arch/arm/mach-pxa/colibri-pxa3xx.c
+++ b/arch/arm/mach-pxa/colibri-pxa3xx.c
@@ -18,6 +18,7 @@
18#include <asm/mach-types.h> 18#include <asm/mach-types.h>
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <asm/sizes.h> 20#include <asm/sizes.h>
21#include <asm/system_info.h>
21#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
22#include <asm/mach/irq.h> 23#include <asm/mach/irq.h>
23#include <mach/pxa3xx-regs.h> 24#include <mach/pxa3xx-regs.h>
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 11f1e735966e..c1fe32db4755 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -40,7 +40,6 @@
40#include <asm/mach-types.h> 40#include <asm/mach-types.h>
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/system.h>
44 43
45#include <asm/mach/arch.h> 44#include <asm/mach/arch.h>
46#include <asm/mach/map.h> 45#include <asm/mach/map.h>
@@ -730,6 +729,7 @@ static void __init fixup_corgi(struct tag *tags, char **cmdline,
730MACHINE_START(CORGI, "SHARP Corgi") 729MACHINE_START(CORGI, "SHARP Corgi")
731 .fixup = fixup_corgi, 730 .fixup = fixup_corgi,
732 .map_io = pxa25x_map_io, 731 .map_io = pxa25x_map_io,
732 .nr_irqs = PXA_NR_IRQS,
733 .init_irq = pxa25x_init_irq, 733 .init_irq = pxa25x_init_irq,
734 .handle_irq = pxa25x_handle_irq, 734 .handle_irq = pxa25x_handle_irq,
735 .init_machine = corgi_init, 735 .init_machine = corgi_init,
@@ -742,6 +742,7 @@ MACHINE_END
742MACHINE_START(SHEPHERD, "SHARP Shepherd") 742MACHINE_START(SHEPHERD, "SHARP Shepherd")
743 .fixup = fixup_corgi, 743 .fixup = fixup_corgi,
744 .map_io = pxa25x_map_io, 744 .map_io = pxa25x_map_io,
745 .nr_irqs = PXA_NR_IRQS,
745 .init_irq = pxa25x_init_irq, 746 .init_irq = pxa25x_init_irq,
746 .handle_irq = pxa25x_handle_irq, 747 .handle_irq = pxa25x_handle_irq,
747 .init_machine = corgi_init, 748 .init_machine = corgi_init,
@@ -754,6 +755,7 @@ MACHINE_END
754MACHINE_START(HUSKY, "SHARP Husky") 755MACHINE_START(HUSKY, "SHARP Husky")
755 .fixup = fixup_corgi, 756 .fixup = fixup_corgi,
756 .map_io = pxa25x_map_io, 757 .map_io = pxa25x_map_io,
758 .nr_irqs = PXA_NR_IRQS,
757 .init_irq = pxa25x_init_irq, 759 .init_irq = pxa25x_init_irq,
758 .handle_irq = pxa25x_handle_irq, 760 .handle_irq = pxa25x_handle_irq,
759 .init_machine = corgi_init, 761 .init_machine = corgi_init,
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 39e265cfc86d..048c4299473c 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -19,6 +19,7 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/apm-emulation.h> 21#include <linux/apm-emulation.h>
22#include <linux/io.h>
22 23
23#include <asm/irq.h> 24#include <asm/irq.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
diff --git a/arch/arm/mach-pxa/cpufreq-pxa3xx.c b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
index 88fbec05ec50..b85b4ab7aac6 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa3xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa3xx.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/cpufreq.h> 16#include <linux/cpufreq.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/io.h>
18 19
19#include <mach/pxa3xx-regs.h> 20#include <mach/pxa3xx-regs.h>
20 21
diff --git a/arch/arm/mach-pxa/csb726.c b/arch/arm/mach-pxa/csb726.c
index fb5a51d834e5..67f0de37f46e 100644
--- a/arch/arm/mach-pxa/csb726.c
+++ b/arch/arm/mach-pxa/csb726.c
@@ -274,6 +274,7 @@ static void __init csb726_init(void)
274MACHINE_START(CSB726, "Cogent CSB726") 274MACHINE_START(CSB726, "Cogent CSB726")
275 .atag_offset = 0x100, 275 .atag_offset = 0x100,
276 .map_io = pxa27x_map_io, 276 .map_io = pxa27x_map_io,
277 .nr_irqs = PXA_NR_IRQS,
277 .init_irq = pxa27x_init_irq, 278 .init_irq = pxa27x_init_irq,
278 .handle_irq = pxa27x_handle_irq, 279 .handle_irq = pxa27x_handle_irq,
279 .init_machine = csb726_init, 280 .init_machine = csb726_init,
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 84f2d7015cfe..166eee5b8a70 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -12,6 +12,7 @@
12#include <mach/pxafb.h> 12#include <mach/pxafb.h>
13#include <mach/mmc.h> 13#include <mach/mmc.h>
14#include <mach/irda.h> 14#include <mach/irda.h>
15#include <mach/irqs.h>
15#include <mach/ohci.h> 16#include <mach/ohci.h>
16#include <plat/pxa27x_keypad.h> 17#include <plat/pxa27x_keypad.h>
17#include <mach/camera.h> 18#include <mach/camera.h>
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index d80c0ba9a095..16ec557b8e43 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1083,19 +1083,19 @@ static void __init em_x270_userspace_consumers_init(void)
1083} 1083}
1084 1084
1085/* DA9030 related initializations */ 1085/* DA9030 related initializations */
1086#define REGULATOR_CONSUMER(_name, _dev, _supply) \ 1086#define REGULATOR_CONSUMER(_name, _dev_name, _supply) \
1087 static struct regulator_consumer_supply _name##_consumers[] = { \ 1087 static struct regulator_consumer_supply _name##_consumers[] = { \
1088 { \ 1088 { \
1089 .dev = _dev, \ 1089 .dev_name = _dev_name, \
1090 .supply = _supply, \ 1090 .supply = _supply, \
1091 }, \ 1091 }, \
1092 } 1092 }
1093 1093
1094REGULATOR_CONSUMER(ldo3, &em_x270_gps_userspace_consumer.dev, "vcc gps"); 1094REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
1095REGULATOR_CONSUMER(ldo5, NULL, "vcc cam"); 1095REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
1096REGULATOR_CONSUMER(ldo10, &pxa_device_mci.dev, "vcc sdio"); 1096REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
1097REGULATOR_CONSUMER(ldo12, NULL, "vcc usb"); 1097REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
1098REGULATOR_CONSUMER(ldo19, &em_x270_gprs_userspace_consumer.dev, "vcc gprs"); 1098REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");
1099REGULATOR_CONSUMER(buck2, NULL, "vcc_core"); 1099REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
1100 1100
1101#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \ 1101#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
@@ -1301,6 +1301,7 @@ static void __init em_x270_init(void)
1301MACHINE_START(EM_X270, "Compulab EM-X270") 1301MACHINE_START(EM_X270, "Compulab EM-X270")
1302 .atag_offset = 0x100, 1302 .atag_offset = 0x100,
1303 .map_io = pxa27x_map_io, 1303 .map_io = pxa27x_map_io,
1304 .nr_irqs = PXA_NR_IRQS,
1304 .init_irq = pxa27x_init_irq, 1305 .init_irq = pxa27x_init_irq,
1305 .handle_irq = pxa27x_handle_irq, 1306 .handle_irq = pxa27x_handle_irq,
1306 .timer = &pxa_timer, 1307 .timer = &pxa_timer,
@@ -1311,6 +1312,7 @@ MACHINE_END
1311MACHINE_START(EXEDA, "Compulab eXeda") 1312MACHINE_START(EXEDA, "Compulab eXeda")
1312 .atag_offset = 0x100, 1313 .atag_offset = 0x100,
1313 .map_io = pxa27x_map_io, 1314 .map_io = pxa27x_map_io,
1315 .nr_irqs = PXA_NR_IRQS,
1314 .init_irq = pxa27x_init_irq, 1316 .init_irq = pxa27x_init_irq,
1315 .handle_irq = pxa27x_handle_irq, 1317 .handle_irq = pxa27x_handle_irq,
1316 .timer = &pxa_timer, 1318 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 5432ecb15def..42254175fcf4 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -22,7 +22,6 @@
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <asm/system.h>
26#include <asm/mach/map.h> 25#include <asm/mach/map.h>
27#include <asm/mach-types.h> 26#include <asm/mach-types.h>
28 27
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index ac3b1cef4751..e529a35a44ce 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -235,6 +235,7 @@ static void __init gumstix_init(void)
235MACHINE_START(GUMSTIX, "Gumstix") 235MACHINE_START(GUMSTIX, "Gumstix")
236 .atag_offset = 0x100, /* match u-boot bi_boot_params */ 236 .atag_offset = 0x100, /* match u-boot bi_boot_params */
237 .map_io = pxa25x_map_io, 237 .map_io = pxa25x_map_io,
238 .nr_irqs = PXA_NR_IRQS,
238 .init_irq = pxa25x_init_irq, 239 .init_irq = pxa25x_init_irq,
239 .handle_irq = pxa25x_handle_irq, 240 .handle_irq = pxa25x_handle_irq,
240 .timer = &pxa_timer, 241 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/h5000.c b/arch/arm/mach-pxa/h5000.c
index fde6b4c873c4..e7dec589f014 100644
--- a/arch/arm/mach-pxa/h5000.c
+++ b/arch/arm/mach-pxa/h5000.c
@@ -205,6 +205,7 @@ static void __init h5000_init(void)
205MACHINE_START(H5400, "HP iPAQ H5000") 205MACHINE_START(H5400, "HP iPAQ H5000")
206 .atag_offset = 0x100, 206 .atag_offset = 0x100,
207 .map_io = pxa25x_map_io, 207 .map_io = pxa25x_map_io,
208 .nr_irqs = PXA_NR_IRQS,
208 .init_irq = pxa25x_init_irq, 209 .init_irq = pxa25x_init_irq,
209 .handle_irq = pxa25x_handle_irq, 210 .handle_irq = pxa25x_handle_irq,
210 .timer = &pxa_timer, 211 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c
index 26d069a9f900..2962de898da9 100644
--- a/arch/arm/mach-pxa/himalaya.c
+++ b/arch/arm/mach-pxa/himalaya.c
@@ -160,6 +160,7 @@ static void __init himalaya_init(void)
160MACHINE_START(HIMALAYA, "HTC Himalaya") 160MACHINE_START(HIMALAYA, "HTC Himalaya")
161 .atag_offset = 0x100, 161 .atag_offset = 0x100,
162 .map_io = pxa25x_map_io, 162 .map_io = pxa25x_map_io,
163 .nr_irqs = PXA_NR_IRQS,
163 .init_irq = pxa25x_init_irq, 164 .init_irq = pxa25x_init_irq,
164 .handle_irq = pxa25x_handle_irq, 165 .handle_irq = pxa25x_handle_irq,
165 .init_machine = himalaya_init, 166 .init_machine = himalaya_init,
diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
index 3fa929d4a4f5..b83b95a29503 100644
--- a/arch/arm/mach-pxa/hx4700.c
+++ b/arch/arm/mach-pxa/hx4700.c
@@ -681,11 +681,9 @@ static struct platform_device power_supply = {
681 681
682static struct regulator_consumer_supply bq24022_consumers[] = { 682static struct regulator_consumer_supply bq24022_consumers[] = {
683 { 683 {
684 .dev = &gpio_vbus.dev,
685 .supply = "vbus_draw", 684 .supply = "vbus_draw",
686 }, 685 },
687 { 686 {
688 .dev = &power_supply.dev,
689 .supply = "ac_draw", 687 .supply = "ac_draw",
690 }, 688 },
691}; 689};
diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c
index 67400192ed3b..1d02eabc9c65 100644
--- a/arch/arm/mach-pxa/icontrol.c
+++ b/arch/arm/mach-pxa/icontrol.c
@@ -193,6 +193,7 @@ static void __init icontrol_init(void)
193MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM") 193MACHINE_START(ICONTROL, "iControl/SafeTcam boards using Embedian MXM-8x10 CoM")
194 .atag_offset = 0x100, 194 .atag_offset = 0x100,
195 .map_io = pxa3xx_map_io, 195 .map_io = pxa3xx_map_io,
196 .nr_irqs = PXA_NR_IRQS,
196 .init_irq = pxa3xx_init_irq, 197 .init_irq = pxa3xx_init_irq,
197 .handle_irq = pxa3xx_handle_irq, 198 .handle_irq = pxa3xx_handle_irq,
198 .timer = &pxa_timer, 199 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index 8af1840e12cc..6ff466bd43e8 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -195,6 +195,7 @@ static void __init idp_map_io(void)
195MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") 195MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
196 /* Maintainer: Vibren Technologies */ 196 /* Maintainer: Vibren Technologies */
197 .map_io = idp_map_io, 197 .map_io = idp_map_io,
198 .nr_irqs = PXA_NR_IRQS,
198 .init_irq = pxa25x_init_irq, 199 .init_irq = pxa25x_init_irq,
199 .handle_irq = pxa25x_handle_irq, 200 .handle_irq = pxa25x_handle_irq,
200 .timer = &pxa_timer, 201 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h
index 8184669dde28..56d92e5cad85 100644
--- a/arch/arm/mach-pxa/include/mach/hardware.h
+++ b/arch/arm/mach-pxa/include/mach/hardware.h
@@ -40,7 +40,6 @@
40#define io_p2v(x) IOMEM(0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1)) 40#define io_p2v(x) IOMEM(0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1))
41 41
42#ifndef __ASSEMBLY__ 42#ifndef __ASSEMBLY__
43# define IOMEM(x) ((void __iomem *)(x))
44# define __REG(x) (*((volatile u32 __iomem *)io_p2v(x))) 43# define __REG(x) (*((volatile u32 __iomem *)io_p2v(x)))
45 44
46/* With indexed regs we don't want to feed the index through io_p2v() 45/* With indexed regs we don't want to feed the index through io_p2v()
@@ -52,7 +51,6 @@
52 51
53#else 52#else
54 53
55# define IOMEM(x) x
56# define __REG(x) io_p2v(x) 54# define __REG(x) io_p2v(x)
57# define __PREG(x) io_v2p(x) 55# define __PREG(x) io_v2p(x)
58 56
@@ -337,8 +335,4 @@ extern unsigned int get_memclk_frequency_10khz(void);
337extern unsigned long get_clock_tick_rate(void); 335extern unsigned long get_clock_tick_rate(void);
338#endif 336#endif
339 337
340#if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
341#define ARCH_HAS_DMA_SET_COHERENT_MASK
342#endif
343
344#endif /* _ASM_ARCH_HARDWARE_H */ 338#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h
index fdca3be47d9b..cd78b7fe3567 100644
--- a/arch/arm/mach-pxa/include/mach/io.h
+++ b/arch/arm/mach-pxa/include/mach/io.h
@@ -6,8 +6,6 @@
6#ifndef __ASM_ARM_ARCH_IO_H 6#ifndef __ASM_ARM_ARCH_IO_H
7#define __ASM_ARM_ARCH_IO_H 7#define __ASM_ARM_ARCH_IO_H
8 8
9#include <mach/hardware.h>
10
11#define IO_SPACE_LIMIT 0xffffffff 9#define IO_SPACE_LIMIT 0xffffffff
12 10
13/* 11/*
@@ -15,6 +13,5 @@
15 * drivers out there that might just work if we fake them... 13 * drivers out there that might just work if we fake them...
16 */ 14 */
17#define __io(a) __typesafe_io(a) 15#define __io(a) __typesafe_io(a)
18#define __mem_pci(a) (a)
19 16
20#endif 17#endif
diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
index 32975adf3ca4..8765782dd955 100644
--- a/arch/arm/mach-pxa/include/mach/irqs.h
+++ b/arch/arm/mach-pxa/include/mach/irqs.h
@@ -100,7 +100,7 @@
100 */ 100 */
101#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_NR_BUILTIN_GPIO) 101#define IRQ_BOARD_START (PXA_GPIO_IRQ_BASE + PXA_NR_BUILTIN_GPIO)
102 102
103#define NR_IRQS (IRQ_BOARD_START) 103#define PXA_NR_IRQS (IRQ_BOARD_START)
104 104
105#ifndef __ASSEMBLY__ 105#ifndef __ASSEMBLY__
106struct irq_data; 106struct irq_data;
diff --git a/arch/arm/mach-pxa/include/mach/mainstone.h b/arch/arm/mach-pxa/include/mach/mainstone.h
index 4c2d11cd824d..1bfc4e822a41 100644
--- a/arch/arm/mach-pxa/include/mach/mainstone.h
+++ b/arch/arm/mach-pxa/include/mach/mainstone.h
@@ -13,6 +13,8 @@
13#ifndef ASM_ARCH_MAINSTONE_H 13#ifndef ASM_ARCH_MAINSTONE_H
14#define ASM_ARCH_MAINSTONE_H 14#define ASM_ARCH_MAINSTONE_H
15 15
16#include <mach/irqs.h>
17
16#define MST_ETH_PHYS PXA_CS4_PHYS 18#define MST_ETH_PHYS PXA_CS4_PHYS
17 19
18#define MST_FPGA_PHYS PXA_CS2_PHYS 20#define MST_FPGA_PHYS PXA_CS2_PHYS
diff --git a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c
index 8b9c17142d5a..06b060025d11 100644
--- a/arch/arm/mach-pxa/leds-idp.c
+++ b/arch/arm/mach-pxa/leds-idp.c
@@ -16,7 +16,6 @@
16 16
17#include <mach/hardware.h> 17#include <mach/hardware.h>
18#include <asm/leds.h> 18#include <asm/leds.h>
19#include <asm/system.h>
20 19
21#include <mach/pxa25x.h> 20#include <mach/pxa25x.h>
22#include <mach/idp.h> 21#include <mach/idp.h>
diff --git a/arch/arm/mach-pxa/leds-lubbock.c b/arch/arm/mach-pxa/leds-lubbock.c
index e26d5efe1969..0bd85c884a7c 100644
--- a/arch/arm/mach-pxa/leds-lubbock.c
+++ b/arch/arm/mach-pxa/leds-lubbock.c
@@ -15,7 +15,6 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <asm/leds.h> 17#include <asm/leds.h>
18#include <asm/system.h>
19#include <mach/pxa25x.h> 18#include <mach/pxa25x.h>
20#include <mach/lubbock.h> 19#include <mach/lubbock.h>
21 20
diff --git a/arch/arm/mach-pxa/leds-mainstone.c b/arch/arm/mach-pxa/leds-mainstone.c
index db4af5eee8b2..4058ab340fe6 100644
--- a/arch/arm/mach-pxa/leds-mainstone.c
+++ b/arch/arm/mach-pxa/leds-mainstone.c
@@ -14,7 +14,6 @@
14 14
15#include <mach/hardware.h> 15#include <mach/hardware.h>
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/system.h>
18 17
19#include <mach/pxa27x.h> 18#include <mach/pxa27x.h>
20#include <mach/mainstone.h> 19#include <mach/mainstone.h>
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 6ebd276aebeb..6bb3f47b1f14 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -223,6 +223,7 @@ static struct resource sa1111_resources[] = {
223 223
224static struct sa1111_platform_data sa1111_info = { 224static struct sa1111_platform_data sa1111_info = {
225 .irq_base = LUBBOCK_SA1111_IRQ_BASE, 225 .irq_base = LUBBOCK_SA1111_IRQ_BASE,
226 .disable_devs = SA1111_DEVID_SAC,
226}; 227};
227 228
228static struct platform_device sa1111_device = { 229static struct platform_device sa1111_device = {
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
index 5e26f3e93fdd..8de0651d7efb 100644
--- a/arch/arm/mach-pxa/magician.c
+++ b/arch/arm/mach-pxa/magician.c
@@ -34,6 +34,7 @@
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
37#include <asm/system_info.h>
37 38
38#include <mach/pxa27x.h> 39#include <mach/pxa27x.h>
39#include <mach/magician.h> 40#include <mach/magician.h>
@@ -579,11 +580,9 @@ static struct platform_device power_supply = {
579 580
580static struct regulator_consumer_supply bq24022_consumers[] = { 581static struct regulator_consumer_supply bq24022_consumers[] = {
581 { 582 {
582 .dev = &gpio_vbus.dev,
583 .supply = "vbus_draw", 583 .supply = "vbus_draw",
584 }, 584 },
585 { 585 {
586 .dev = &power_supply.dev,
587 .supply = "ac_draw", 586 .supply = "ac_draw",
588 }, 587 },
589}; 588};
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 29b62afc6f7c..b0a842887780 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h>
20#include <linux/syscore_ops.h> 21#include <linux/syscore_ops.h>
21 22
22#include <mach/pxa2xx-regs.h> 23#include <mach/pxa2xx-regs.h>
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index e80a3db735c2..061d57009cee 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -758,6 +758,7 @@ MACHINE_START(MIOA701, "MIO A701")
758 .atag_offset = 0x100, 758 .atag_offset = 0x100,
759 .restart_mode = 's', 759 .restart_mode = 's',
760 .map_io = &pxa27x_map_io, 760 .map_io = &pxa27x_map_io,
761 .nr_irqs = PXA_NR_IRQS,
761 .init_irq = &pxa27x_init_irq, 762 .init_irq = &pxa27x_init_irq,
762 .handle_irq = &pxa27x_handle_irq, 763 .handle_irq = &pxa27x_handle_irq,
763 .init_machine = mioa701_machine_init, 764 .init_machine = mioa701_machine_init,
diff --git a/arch/arm/mach-pxa/mp900.c b/arch/arm/mach-pxa/mp900.c
index 169bf8f97af0..152efbf093f6 100644
--- a/arch/arm/mach-pxa/mp900.c
+++ b/arch/arm/mach-pxa/mp900.c
@@ -95,6 +95,7 @@ MACHINE_START(NEC_MP900, "MobilePro900/C")
95 .atag_offset = 0x220100, 95 .atag_offset = 0x220100,
96 .timer = &pxa_timer, 96 .timer = &pxa_timer,
97 .map_io = pxa25x_map_io, 97 .map_io = pxa25x_map_io,
98 .nr_irqs = PXA_NR_IRQS,
98 .init_irq = pxa25x_init_irq, 99 .init_irq = pxa25x_init_irq,
99 .handle_irq = pxa25x_handle_irq, 100 .handle_irq = pxa25x_handle_irq,
100 .init_machine = mp900c_init, 101 .init_machine = mp900c_init,
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c
index 1fa80f4f80c8..31e0433d83ba 100644
--- a/arch/arm/mach-pxa/palmld.c
+++ b/arch/arm/mach-pxa/palmld.c
@@ -344,6 +344,7 @@ static void __init palmld_init(void)
344MACHINE_START(PALMLD, "Palm LifeDrive") 344MACHINE_START(PALMLD, "Palm LifeDrive")
345 .atag_offset = 0x100, 345 .atag_offset = 0x100,
346 .map_io = palmld_map_io, 346 .map_io = palmld_map_io,
347 .nr_irqs = PXA_NR_IRQS,
347 .init_irq = pxa27x_init_irq, 348 .init_irq = pxa27x_init_irq,
348 .handle_irq = pxa27x_handle_irq, 349 .handle_irq = pxa27x_handle_irq,
349 .timer = &pxa_timer, 350 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 5ba14316bd9c..0f6bd4fcfa3b 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -205,6 +205,7 @@ MACHINE_START(PALMT5, "Palm Tungsten|T5")
205 .atag_offset = 0x100, 205 .atag_offset = 0x100,
206 .map_io = pxa27x_map_io, 206 .map_io = pxa27x_map_io,
207 .reserve = palmt5_reserve, 207 .reserve = palmt5_reserve,
208 .nr_irqs = PXA_NR_IRQS,
208 .init_irq = pxa27x_init_irq, 209 .init_irq = pxa27x_init_irq,
209 .handle_irq = pxa27x_handle_irq, 210 .handle_irq = pxa27x_handle_irq,
210 .timer = &pxa_timer, 211 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c
index 29b51b40f09d..e2d97eed07a7 100644
--- a/arch/arm/mach-pxa/palmtc.c
+++ b/arch/arm/mach-pxa/palmtc.c
@@ -539,6 +539,7 @@ static void __init palmtc_init(void)
539MACHINE_START(PALMTC, "Palm Tungsten|C") 539MACHINE_START(PALMTC, "Palm Tungsten|C")
540 .atag_offset = 0x100, 540 .atag_offset = 0x100,
541 .map_io = pxa25x_map_io, 541 .map_io = pxa25x_map_io,
542 .nr_irqs = PXA_NR_IRQS,
542 .init_irq = pxa25x_init_irq, 543 .init_irq = pxa25x_init_irq,
543 .handle_irq = pxa25x_handle_irq, 544 .handle_irq = pxa25x_handle_irq,
544 .timer = &pxa_timer, 545 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c
index 5ebf49acb827..c054827c567f 100644
--- a/arch/arm/mach-pxa/palmte2.c
+++ b/arch/arm/mach-pxa/palmte2.c
@@ -358,6 +358,7 @@ static void __init palmte2_init(void)
358MACHINE_START(PALMTE2, "Palm Tungsten|E2") 358MACHINE_START(PALMTE2, "Palm Tungsten|E2")
359 .atag_offset = 0x100, 359 .atag_offset = 0x100,
360 .map_io = pxa25x_map_io, 360 .map_io = pxa25x_map_io,
361 .nr_irqs = PXA_NR_IRQS,
361 .init_irq = pxa25x_init_irq, 362 .init_irq = pxa25x_init_irq,
362 .handle_irq = pxa25x_handle_irq, 363 .handle_irq = pxa25x_handle_irq,
363 .timer = &pxa_timer, 364 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index ec8249156c08..fbdebee39a53 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -448,6 +448,7 @@ MACHINE_START(TREO680, "Palm Treo 680")
448 .atag_offset = 0x100, 448 .atag_offset = 0x100,
449 .map_io = pxa27x_map_io, 449 .map_io = pxa27x_map_io,
450 .reserve = treo_reserve, 450 .reserve = treo_reserve,
451 .nr_irqs = PXA_NR_IRQS,
451 .init_irq = pxa27x_init_irq, 452 .init_irq = pxa27x_init_irq,
452 .handle_irq = pxa27x_handle_irq, 453 .handle_irq = pxa27x_handle_irq,
453 .timer = &pxa_timer, 454 .timer = &pxa_timer,
@@ -461,6 +462,7 @@ MACHINE_START(CENTRO, "Palm Centro 685")
461 .atag_offset = 0x100, 462 .atag_offset = 0x100,
462 .map_io = pxa27x_map_io, 463 .map_io = pxa27x_map_io,
463 .reserve = treo_reserve, 464 .reserve = treo_reserve,
465 .nr_irqs = PXA_NR_IRQS,
464 .init_irq = pxa27x_init_irq, 466 .init_irq = pxa27x_init_irq,
465 .handle_irq = pxa27x_handle_irq, 467 .handle_irq = pxa27x_handle_irq,
466 .timer = &pxa_timer, 468 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c
index 6170d76dfba8..9507605ed547 100644
--- a/arch/arm/mach-pxa/palmtx.c
+++ b/arch/arm/mach-pxa/palmtx.c
@@ -366,6 +366,7 @@ static void __init palmtx_init(void)
366MACHINE_START(PALMTX, "Palm T|X") 366MACHINE_START(PALMTX, "Palm T|X")
367 .atag_offset = 0x100, 367 .atag_offset = 0x100,
368 .map_io = palmtx_map_io, 368 .map_io = palmtx_map_io,
369 .nr_irqs = PXA_NR_IRQS,
369 .init_irq = pxa27x_init_irq, 370 .init_irq = pxa27x_init_irq,
370 .handle_irq = pxa27x_handle_irq, 371 .handle_irq = pxa27x_handle_irq,
371 .timer = &pxa_timer, 372 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index b2dff9d415eb..a97b59965bb9 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -401,6 +401,7 @@ static void __init palmz72_init(void)
401MACHINE_START(PALMZ72, "Palm Zire72") 401MACHINE_START(PALMZ72, "Palm Zire72")
402 .atag_offset = 0x100, 402 .atag_offset = 0x100,
403 .map_io = pxa27x_map_io, 403 .map_io = pxa27x_map_io,
404 .nr_irqs = PXA_NR_IRQS,
404 .init_irq = pxa27x_init_irq, 405 .init_irq = pxa27x_init_irq,
405 .handle_irq = pxa27x_handle_irq, 406 .handle_irq = pxa27x_handle_irq,
406 .timer = &pxa_timer, 407 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index 744baee12c0c..89d98c832189 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -34,7 +34,6 @@
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <asm/setup.h> 36#include <asm/setup.h>
37#include <asm/system.h>
38 37
39#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
40#include <asm/mach/map.h> 39#include <asm/mach/map.h>
diff --git a/arch/arm/mach-pxa/pxa2xx.c b/arch/arm/mach-pxa/pxa2xx.c
index 868270421b8c..f8ec85450c42 100644
--- a/arch/arm/mach-pxa/pxa2xx.c
+++ b/arch/arm/mach-pxa/pxa2xx.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/device.h> 15#include <linux/device.h>
16#include <linux/io.h>
16 17
17#include <mach/hardware.h> 18#include <mach/hardware.h>
18#include <mach/pxa2xx-regs.h> 19#include <mach/pxa2xx-regs.h>
diff --git a/arch/arm/mach-pxa/pxa300.c b/arch/arm/mach-pxa/pxa300.c
index 40bb16501d86..17cbc0c7bdb8 100644
--- a/arch/arm/mach-pxa/pxa300.c
+++ b/arch/arm/mach-pxa/pxa300.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/io.h>
19 20
20#include <mach/pxa300.h> 21#include <mach/pxa300.h>
21 22
diff --git a/arch/arm/mach-pxa/pxa320.c b/arch/arm/mach-pxa/pxa320.c
index 8d614ecd8e99..6dc99d4f2dc6 100644
--- a/arch/arm/mach-pxa/pxa320.c
+++ b/arch/arm/mach-pxa/pxa320.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/io.h>
19 20
20#include <mach/pxa320.h> 21#include <mach/pxa320.h>
21 22
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 1570d457fea3..dffb7e813d98 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -31,6 +31,7 @@
31#include <mach/pm.h> 31#include <mach/pm.h>
32#include <mach/dma.h> 32#include <mach/dma.h>
33#include <mach/smemc.h> 33#include <mach/smemc.h>
34#include <mach/irqs.h>
34 35
35#include "generic.h" 36#include "generic.h"
36#include "devices.h" 37#include "devices.h"
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index 22818c7694a8..5905ed130e94 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -43,6 +43,8 @@
43#include <linux/regulator/consumer.h> 43#include <linux/regulator/consumer.h>
44#include <linux/delay.h> 44#include <linux/delay.h>
45 45
46#include <asm/system_info.h>
47
46#include <asm/mach-types.h> 48#include <asm/mach-types.h>
47#include <asm/mach/arch.h> 49#include <asm/mach/arch.h>
48 50
@@ -1090,6 +1092,7 @@ MACHINE_START(RAUMFELD_RC, "Raumfeld Controller")
1090 .atag_offset = 0x100, 1092 .atag_offset = 0x100,
1091 .init_machine = raumfeld_controller_init, 1093 .init_machine = raumfeld_controller_init,
1092 .map_io = pxa3xx_map_io, 1094 .map_io = pxa3xx_map_io,
1095 .nr_irqs = PXA_NR_IRQS,
1093 .init_irq = pxa3xx_init_irq, 1096 .init_irq = pxa3xx_init_irq,
1094 .handle_irq = pxa3xx_handle_irq, 1097 .handle_irq = pxa3xx_handle_irq,
1095 .timer = &pxa_timer, 1098 .timer = &pxa_timer,
@@ -1102,6 +1105,7 @@ MACHINE_START(RAUMFELD_CONNECTOR, "Raumfeld Connector")
1102 .atag_offset = 0x100, 1105 .atag_offset = 0x100,
1103 .init_machine = raumfeld_connector_init, 1106 .init_machine = raumfeld_connector_init,
1104 .map_io = pxa3xx_map_io, 1107 .map_io = pxa3xx_map_io,
1108 .nr_irqs = PXA_NR_IRQS,
1105 .init_irq = pxa3xx_init_irq, 1109 .init_irq = pxa3xx_init_irq,
1106 .handle_irq = pxa3xx_handle_irq, 1110 .handle_irq = pxa3xx_handle_irq,
1107 .timer = &pxa_timer, 1111 .timer = &pxa_timer,
@@ -1114,6 +1118,7 @@ MACHINE_START(RAUMFELD_SPEAKER, "Raumfeld Speaker")
1114 .atag_offset = 0x100, 1118 .atag_offset = 0x100,
1115 .init_machine = raumfeld_speaker_init, 1119 .init_machine = raumfeld_speaker_init,
1116 .map_io = pxa3xx_map_io, 1120 .map_io = pxa3xx_map_io,
1121 .nr_irqs = PXA_NR_IRQS,
1117 .init_irq = pxa3xx_init_irq, 1122 .init_irq = pxa3xx_init_irq,
1118 .handle_irq = pxa3xx_handle_irq, 1123 .handle_irq = pxa3xx_handle_irq,
1119 .timer = &pxa_timer, 1124 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/reset.c b/arch/arm/mach-pxa/reset.c
index c8497b00cdfe..b4528899ef08 100644
--- a/arch/arm/mach-pxa/reset.c
+++ b/arch/arm/mach-pxa/reset.c
@@ -9,6 +9,7 @@
9#include <linux/gpio.h> 9#include <linux/gpio.h>
10#include <linux/io.h> 10#include <linux/io.h>
11#include <asm/proc-fns.h> 11#include <asm/proc-fns.h>
12#include <asm/system_misc.h>
12 13
13#include <mach/regs-ost.h> 14#include <mach/regs-ost.h>
14#include <mach/reset.h> 15#include <mach/reset.h>
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index 0fe354efb931..86c95a5d8533 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -598,6 +598,7 @@ MACHINE_START(SAAR, "PXA930 Handheld Platform (aka SAAR)")
598 /* Maintainer: Eric Miao <eric.miao@marvell.com> */ 598 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
599 .atag_offset = 0x100, 599 .atag_offset = 0x100,
600 .map_io = pxa3xx_map_io, 600 .map_io = pxa3xx_map_io,
601 .nr_irqs = PXA_NR_IRQS,
601 .init_irq = pxa3xx_init_irq, 602 .init_irq = pxa3xx_init_irq,
602 .handle_irq = pxa3xx_handle_irq, 603 .handle_irq = pxa3xx_handle_irq,
603 .timer = &pxa_timer, 604 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index 30989baf7f2a..bdf4cb88ca0a 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -24,6 +24,7 @@
24#include <linux/leds.h> 24#include <linux/leds.h>
25#include <linux/suspend.h> 25#include <linux/suspend.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/io.h>
27 28
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <mach/pm.h> 30#include <mach/pm.h>
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index abf355d0c92f..df2ab0fb2ace 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -984,6 +984,7 @@ MACHINE_START(SPITZ, "SHARP Spitz")
984 .restart_mode = 'g', 984 .restart_mode = 'g',
985 .fixup = spitz_fixup, 985 .fixup = spitz_fixup,
986 .map_io = pxa27x_map_io, 986 .map_io = pxa27x_map_io,
987 .nr_irqs = PXA_NR_IRQS,
987 .init_irq = pxa27x_init_irq, 988 .init_irq = pxa27x_init_irq,
988 .handle_irq = pxa27x_handle_irq, 989 .handle_irq = pxa27x_handle_irq,
989 .init_machine = spitz_init, 990 .init_machine = spitz_init,
@@ -997,6 +998,7 @@ MACHINE_START(BORZOI, "SHARP Borzoi")
997 .restart_mode = 'g', 998 .restart_mode = 'g',
998 .fixup = spitz_fixup, 999 .fixup = spitz_fixup,
999 .map_io = pxa27x_map_io, 1000 .map_io = pxa27x_map_io,
1001 .nr_irqs = PXA_NR_IRQS,
1000 .init_irq = pxa27x_init_irq, 1002 .init_irq = pxa27x_init_irq,
1001 .handle_irq = pxa27x_handle_irq, 1003 .handle_irq = pxa27x_handle_irq,
1002 .init_machine = spitz_init, 1004 .init_machine = spitz_init,
@@ -1010,6 +1012,7 @@ MACHINE_START(AKITA, "SHARP Akita")
1010 .restart_mode = 'g', 1012 .restart_mode = 'g',
1011 .fixup = spitz_fixup, 1013 .fixup = spitz_fixup,
1012 .map_io = pxa27x_map_io, 1014 .map_io = pxa27x_map_io,
1015 .nr_irqs = PXA_NR_IRQS,
1013 .init_irq = pxa27x_init_irq, 1016 .init_irq = pxa27x_init_irq,
1014 .handle_irq = pxa27x_handle_irq, 1017 .handle_irq = pxa27x_handle_irq,
1015 .init_machine = spitz_init, 1018 .init_machine = spitz_init,
diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
index b0656e158d90..4cd645e29b64 100644
--- a/arch/arm/mach-pxa/stargate2.c
+++ b/arch/arm/mach-pxa/stargate2.c
@@ -152,7 +152,7 @@ static struct platform_device sht15 = {
152 152
153static struct regulator_consumer_supply stargate2_sensor_3_con[] = { 153static struct regulator_consumer_supply stargate2_sensor_3_con[] = {
154 { 154 {
155 .dev = &sht15.dev, 155 .dev_name = "sht15",
156 .supply = "vcc", 156 .supply = "vcc",
157 }, 157 },
158}; 158};
@@ -1006,6 +1006,7 @@ static void __init stargate2_init(void)
1006#ifdef CONFIG_MACH_INTELMOTE2 1006#ifdef CONFIG_MACH_INTELMOTE2
1007MACHINE_START(INTELMOTE2, "IMOTE 2") 1007MACHINE_START(INTELMOTE2, "IMOTE 2")
1008 .map_io = pxa27x_map_io, 1008 .map_io = pxa27x_map_io,
1009 .nr_irqs = PXA_NR_IRQS,
1009 .init_irq = pxa27x_init_irq, 1010 .init_irq = pxa27x_init_irq,
1010 .handle_irq = pxa27x_handle_irq, 1011 .handle_irq = pxa27x_handle_irq,
1011 .timer = &pxa_timer, 1012 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
index 9fb38e80e076..736bfdc50ee6 100644
--- a/arch/arm/mach-pxa/tavorevb.c
+++ b/arch/arm/mach-pxa/tavorevb.c
@@ -491,6 +491,7 @@ MACHINE_START(TAVOREVB, "PXA930 Evaluation Board (aka TavorEVB)")
491 /* Maintainer: Eric Miao <eric.miao@marvell.com> */ 491 /* Maintainer: Eric Miao <eric.miao@marvell.com> */
492 .atag_offset = 0x100, 492 .atag_offset = 0x100,
493 .map_io = pxa3xx_map_io, 493 .map_io = pxa3xx_map_io,
494 .nr_irqs = PXA_NR_IRQS,
494 .init_irq = pxa3xx_init_irq, 495 .init_irq = pxa3xx_init_irq,
495 .handle_irq = pxa3xx_handle_irq, 496 .handle_irq = pxa3xx_handle_irq,
496 .timer = &pxa_timer, 497 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/time.c b/arch/arm/mach-pxa/time.c
index b503049d6d26..3d6c9bd90de6 100644
--- a/arch/arm/mach-pxa/time.c
+++ b/arch/arm/mach-pxa/time.c
@@ -22,6 +22,7 @@
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <asm/sched_clock.h> 23#include <asm/sched_clock.h>
24#include <mach/regs-ost.h> 24#include <mach/regs-ost.h>
25#include <mach/irqs.h>
25 26
26/* 27/*
27 * This is PXA's sched_clock implementation. This has a resolution 28 * This is PXA's sched_clock implementation. This has a resolution
diff --git a/arch/arm/mach-pxa/trizeps4.c b/arch/arm/mach-pxa/trizeps4.c
index 0f30af617d8f..2b6ac00b2cd9 100644
--- a/arch/arm/mach-pxa/trizeps4.c
+++ b/arch/arm/mach-pxa/trizeps4.c
@@ -558,6 +558,7 @@ MACHINE_START(TRIZEPS4, "Keith und Koep Trizeps IV module")
558 .atag_offset = 0x100, 558 .atag_offset = 0x100,
559 .init_machine = trizeps4_init, 559 .init_machine = trizeps4_init,
560 .map_io = trizeps4_map_io, 560 .map_io = trizeps4_map_io,
561 .nr_irqs = PXA_NR_IRQS,
561 .init_irq = pxa27x_init_irq, 562 .init_irq = pxa27x_init_irq,
562 .handle_irq = pxa27x_handle_irq, 563 .handle_irq = pxa27x_handle_irq,
563 .timer = &pxa_timer, 564 .timer = &pxa_timer,
@@ -569,6 +570,7 @@ MACHINE_START(TRIZEPS4WL, "Keith und Koep Trizeps IV-WL module")
569 .atag_offset = 0x100, 570 .atag_offset = 0x100,
570 .init_machine = trizeps4_init, 571 .init_machine = trizeps4_init,
571 .map_io = trizeps4_map_io, 572 .map_io = trizeps4_map_io,
573 .nr_irqs = PXA_NR_IRQS,
572 .init_irq = pxa27x_init_irq, 574 .init_irq = pxa27x_init_irq,
573 .handle_irq = pxa27x_handle_irq, 575 .handle_irq = pxa27x_handle_irq,
574 .timer = &pxa_timer, 576 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index 023d6ca789de..130379fb9d0f 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -57,6 +57,7 @@
57#include <asm/mach-types.h> 57#include <asm/mach-types.h>
58#include <asm/irq.h> 58#include <asm/irq.h>
59#include <asm/sizes.h> 59#include <asm/sizes.h>
60#include <asm/system_info.h>
60 61
61#include <asm/mach/arch.h> 62#include <asm/mach/arch.h>
62#include <asm/mach/map.h> 63#include <asm/mach/map.h>
@@ -994,6 +995,7 @@ MACHINE_START(VIPER, "Arcom/Eurotech VIPER SBC")
994 /* Maintainer: Marc Zyngier <maz@misterjones.org> */ 995 /* Maintainer: Marc Zyngier <maz@misterjones.org> */
995 .atag_offset = 0x100, 996 .atag_offset = 0x100,
996 .map_io = viper_map_io, 997 .map_io = viper_map_io,
998 .nr_irqs = PXA_NR_IRQS,
997 .init_irq = viper_init_irq, 999 .init_irq = viper_init_irq,
998 .handle_irq = pxa25x_handle_irq, 1000 .handle_irq = pxa25x_handle_irq,
999 .timer = &pxa_timer, 1001 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
index 1f5cfa96f6d6..c57ab636ea9c 100644
--- a/arch/arm/mach-pxa/vpac270.c
+++ b/arch/arm/mach-pxa/vpac270.c
@@ -718,6 +718,7 @@ static void __init vpac270_init(void)
718MACHINE_START(VPAC270, "Voipac PXA270") 718MACHINE_START(VPAC270, "Voipac PXA270")
719 .atag_offset = 0x100, 719 .atag_offset = 0x100,
720 .map_io = pxa27x_map_io, 720 .map_io = pxa27x_map_io,
721 .nr_irqs = PXA_NR_IRQS,
721 .init_irq = pxa27x_init_irq, 722 .init_irq = pxa27x_init_irq,
722 .handle_irq = pxa27x_handle_irq, 723 .handle_irq = pxa27x_handle_irq,
723 .timer = &pxa_timer, 724 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c
index 4bbe9a36fe74..4275713ccd10 100644
--- a/arch/arm/mach-pxa/xcep.c
+++ b/arch/arm/mach-pxa/xcep.c
@@ -182,6 +182,7 @@ MACHINE_START(XCEP, "Iskratel XCEP")
182 .atag_offset = 0x100, 182 .atag_offset = 0x100,
183 .init_machine = xcep_init, 183 .init_machine = xcep_init,
184 .map_io = pxa25x_map_io, 184 .map_io = pxa25x_map_io,
185 .nr_irqs = PXA_NR_IRQS,
185 .init_irq = pxa25x_init_irq, 186 .init_irq = pxa25x_init_irq,
186 .handle_irq = pxa25x_handle_irq, 187 .handle_irq = pxa25x_handle_irq,
187 .timer = &pxa_timer, 188 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
index b6476848b561..fa8619970841 100644
--- a/arch/arm/mach-pxa/z2.c
+++ b/arch/arm/mach-pxa/z2.c
@@ -721,6 +721,7 @@ static void __init z2_init(void)
721MACHINE_START(ZIPIT2, "Zipit Z2") 721MACHINE_START(ZIPIT2, "Zipit Z2")
722 .atag_offset = 0x100, 722 .atag_offset = 0x100,
723 .map_io = pxa27x_map_io, 723 .map_io = pxa27x_map_io,
724 .nr_irqs = PXA_NR_IRQS,
724 .init_irq = pxa27x_init_irq, 725 .init_irq = pxa27x_init_irq,
725 .handle_irq = pxa27x_handle_irq, 726 .handle_irq = pxa27x_handle_irq,
726 .timer = &pxa_timer, 727 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index a4dd1c347050..af3d4f7646d7 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -32,6 +32,7 @@
32 32
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <asm/suspend.h> 34#include <asm/suspend.h>
35#include <asm/system_info.h>
35#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
36#include <asm/mach/map.h> 37#include <asm/mach/map.h>
37 38
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index acd329afc3ac..45868bb43cbd 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -33,7 +33,6 @@
33#include <linux/clkdev.h> 33#include <linux/clkdev.h>
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35 35
36#include <asm/system.h>
37#include <mach/hardware.h> 36#include <mach/hardware.h>
38#include <asm/irq.h> 37#include <asm/irq.h>
39#include <asm/leds.h> 38#include <asm/leds.h>
diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c
index eb55f05bef3a..57d9efba2956 100644
--- a/arch/arm/mach-realview/hotplug.c
+++ b/arch/arm/mach-realview/hotplug.c
@@ -13,6 +13,7 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/cp15.h>
16#include <asm/smp_plat.h> 17#include <asm/smp_plat.h>
17 18
18extern volatile int pen_release; 19extern volatile int pen_release;
diff --git a/arch/arm/mach-realview/include/mach/hardware.h b/arch/arm/mach-realview/include/mach/hardware.h
index 8a638d15797f..281e71c97525 100644
--- a/arch/arm/mach-realview/include/mach/hardware.h
+++ b/arch/arm/mach-realview/include/mach/hardware.h
@@ -37,6 +37,6 @@
37#else 37#else
38#define IO_ADDRESS(x) (x) 38#define IO_ADDRESS(x) (x)
39#endif 39#endif
40#define __io_address(n) __io(IO_ADDRESS(n)) 40#define __io_address(n) IOMEM(IO_ADDRESS(n))
41 41
42#endif 42#endif
diff --git a/arch/arm/mach-realview/include/mach/io.h b/arch/arm/mach-realview/include/mach/io.h
deleted file mode 100644
index f05bcdf605d8..000000000000
--- a/arch/arm/mach-realview/include/mach/io.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * arch/arm/mach-realview/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a)
27
28#endif
diff --git a/arch/arm/mach-rpc/Makefile b/arch/arm/mach-rpc/Makefile
index dfa405c0cfde..992e28b4ae9a 100644
--- a/arch/arm/mach-rpc/Makefile
+++ b/arch/arm/mach-rpc/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := dma.o fiq.o irq.o riscpc.o 7obj-y := dma.o ecard.o fiq.o irq.o riscpc.o time.o
8obj-m := 8obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/mach-rpc/ecard.c
index 1651d4950744..b91bc87b3dcf 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -42,6 +42,7 @@
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/mutex.h> 43#include <linux/mutex.h>
44#include <linux/kthread.h> 44#include <linux/kthread.h>
45#include <linux/irq.h>
45#include <linux/io.h> 46#include <linux/io.h>
46 47
47#include <asm/dma.h> 48#include <asm/dma.h>
@@ -54,10 +55,6 @@
54 55
55#include "ecard.h" 56#include "ecard.h"
56 57
57#ifndef CONFIG_ARCH_RPC
58#define HAVE_EXPMASK
59#endif
60
61struct ecard_request { 58struct ecard_request {
62 void (*fn)(struct ecard_request *); 59 void (*fn)(struct ecard_request *);
63 ecard_t *ec; 60 ecard_t *ec;
@@ -77,9 +74,6 @@ struct expcard_blacklist {
77static ecard_t *cards; 74static ecard_t *cards;
78static ecard_t *slot_to_expcard[MAX_ECARDS]; 75static ecard_t *slot_to_expcard[MAX_ECARDS];
79static unsigned int ectcr; 76static unsigned int ectcr;
80#ifdef HAS_EXPMASK
81static unsigned int have_expmask;
82#endif
83 77
84/* List of descriptions of cards which don't have an extended 78/* List of descriptions of cards which don't have an extended
85 * identification, or chunk directories containing a description. 79 * identification, or chunk directories containing a description.
@@ -391,22 +385,10 @@ int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
391 385
392static void ecard_def_irq_enable(ecard_t *ec, int irqnr) 386static void ecard_def_irq_enable(ecard_t *ec, int irqnr)
393{ 387{
394#ifdef HAS_EXPMASK
395 if (irqnr < 4 && have_expmask) {
396 have_expmask |= 1 << irqnr;
397 __raw_writeb(have_expmask, EXPMASK_ENABLE);
398 }
399#endif
400} 388}
401 389
402static void ecard_def_irq_disable(ecard_t *ec, int irqnr) 390static void ecard_def_irq_disable(ecard_t *ec, int irqnr)
403{ 391{
404#ifdef HAS_EXPMASK
405 if (irqnr < 4 && have_expmask) {
406 have_expmask &= ~(1 << irqnr);
407 __raw_writeb(have_expmask, EXPMASK_ENABLE);
408 }
409#endif
410} 392}
411 393
412static int ecard_def_irq_pending(ecard_t *ec) 394static int ecard_def_irq_pending(ecard_t *ec)
@@ -446,7 +428,7 @@ static expansioncard_ops_t ecard_default_ops = {
446 */ 428 */
447static void ecard_irq_unmask(struct irq_data *d) 429static void ecard_irq_unmask(struct irq_data *d)
448{ 430{
449 ecard_t *ec = slot_to_ecard(d->irq - 32); 431 ecard_t *ec = irq_data_get_irq_chip_data(d);
450 432
451 if (ec) { 433 if (ec) {
452 if (!ec->ops) 434 if (!ec->ops)
@@ -462,7 +444,7 @@ static void ecard_irq_unmask(struct irq_data *d)
462 444
463static void ecard_irq_mask(struct irq_data *d) 445static void ecard_irq_mask(struct irq_data *d)
464{ 446{
465 ecard_t *ec = slot_to_ecard(d->irq - 32); 447 ecard_t *ec = irq_data_get_irq_chip_data(d);
466 448
467 if (ec) { 449 if (ec) {
468 if (!ec->ops) 450 if (!ec->ops)
@@ -579,7 +561,7 @@ ecard_irq_handler(unsigned int irq, struct irq_desc *desc)
579 for (ec = cards; ec; ec = ec->next) { 561 for (ec = cards; ec; ec = ec->next) {
580 int pending; 562 int pending;
581 563
582 if (!ec->claimed || ec->irq == NO_IRQ || ec->slot_no == 8) 564 if (!ec->claimed || !ec->irq || ec->slot_no == 8)
583 continue; 565 continue;
584 566
585 if (ec->ops && ec->ops->irqpending) 567 if (ec->ops && ec->ops->irqpending)
@@ -598,83 +580,6 @@ ecard_irq_handler(unsigned int irq, struct irq_desc *desc)
598 ecard_check_lockup(desc); 580 ecard_check_lockup(desc);
599} 581}
600 582
601#ifdef HAS_EXPMASK
602static unsigned char priority_masks[] =
603{
604 0xf0, 0xf1, 0xf3, 0xf7, 0xff, 0xff, 0xff, 0xff
605};
606
607static unsigned char first_set[] =
608{
609 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00,
610 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00
611};
612
613static void
614ecard_irqexp_handler(unsigned int irq, struct irq_desc *desc)
615{
616 const unsigned int statusmask = 15;
617 unsigned int status;
618
619 status = __raw_readb(EXPMASK_STATUS) & statusmask;
620 if (status) {
621 unsigned int slot = first_set[status];
622 ecard_t *ec = slot_to_ecard(slot);
623
624 if (ec->claimed) {
625 /*
626 * this ugly code is so that we can operate a
627 * prioritorising system:
628 *
629 * Card 0 highest priority
630 * Card 1
631 * Card 2
632 * Card 3 lowest priority
633 *
634 * Serial cards should go in 0/1, ethernet/scsi in 2/3
635 * otherwise you will lose serial data at high speeds!
636 */
637 generic_handle_irq(ec->irq);
638 } else {
639 printk(KERN_WARNING "card%d: interrupt from unclaimed "
640 "card???\n", slot);
641 have_expmask &= ~(1 << slot);
642 __raw_writeb(have_expmask, EXPMASK_ENABLE);
643 }
644 } else
645 printk(KERN_WARNING "Wild interrupt from backplane (masks)\n");
646}
647
648static int __init ecard_probeirqhw(void)
649{
650 ecard_t *ec;
651 int found;
652
653 __raw_writeb(0x00, EXPMASK_ENABLE);
654 __raw_writeb(0xff, EXPMASK_STATUS);
655 found = (__raw_readb(EXPMASK_STATUS) & 15) == 0;
656 __raw_writeb(0xff, EXPMASK_ENABLE);
657
658 if (found) {
659 printk(KERN_DEBUG "Expansion card interrupt "
660 "management hardware found\n");
661
662 /* for each card present, set a bit to '1' */
663 have_expmask = 0x80000000;
664
665 for (ec = cards; ec; ec = ec->next)
666 have_expmask |= 1 << ec->slot_no;
667
668 __raw_writeb(have_expmask, EXPMASK_ENABLE);
669 }
670
671 return found;
672}
673#else
674#define ecard_irqexp_handler NULL
675#define ecard_probeirqhw() (0)
676#endif
677
678static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed) 583static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
679{ 584{
680 void __iomem *address = NULL; 585 void __iomem *address = NULL;
@@ -806,8 +711,8 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)
806 711
807 ec->slot_no = slot; 712 ec->slot_no = slot;
808 ec->easi = type == ECARD_EASI; 713 ec->easi = type == ECARD_EASI;
809 ec->irq = NO_IRQ; 714 ec->irq = 0;
810 ec->fiq = NO_IRQ; 715 ec->fiq = 0;
811 ec->dma = NO_DMA; 716 ec->dma = NO_DMA;
812 ec->ops = &ecard_default_ops; 717 ec->ops = &ecard_default_ops;
813 718
@@ -978,8 +883,7 @@ EXPORT_SYMBOL(ecardm_iomap);
978 * If bit 1 of the first byte of the card is set, then the 883 * If bit 1 of the first byte of the card is set, then the
979 * card does not exist. 884 * card does not exist.
980 */ 885 */
981static int __init 886static int __init ecard_probe(int slot, unsigned irq, card_type_t type)
982ecard_probe(int slot, card_type_t type)
983{ 887{
984 ecard_t **ecp; 888 ecard_t **ecp;
985 ecard_t *ec; 889 ecard_t *ec;
@@ -1033,18 +937,18 @@ ecard_probe(int slot, card_type_t type)
1033 break; 937 break;
1034 } 938 }
1035 939
940 ec->irq = irq;
941
1036 /* 942 /*
1037 * hook the interrupt handlers 943 * hook the interrupt handlers
1038 */ 944 */
1039 if (slot < 8) { 945 if (slot < 8) {
1040 ec->irq = 32 + slot;
1041 irq_set_chip_and_handler(ec->irq, &ecard_chip, 946 irq_set_chip_and_handler(ec->irq, &ecard_chip,
1042 handle_level_irq); 947 handle_level_irq);
948 irq_set_chip_data(ec->irq, ec);
1043 set_irq_flags(ec->irq, IRQF_VALID); 949 set_irq_flags(ec->irq, IRQF_VALID);
1044 } 950 }
1045 951
1046 if (slot == 8)
1047 ec->irq = 11;
1048#ifdef CONFIG_ARCH_RPC 952#ifdef CONFIG_ARCH_RPC
1049 /* On RiscPC, only first two slots have DMA capability */ 953 /* On RiscPC, only first two slots have DMA capability */
1050 if (slot < 2) 954 if (slot < 2)
@@ -1074,28 +978,30 @@ ecard_probe(int slot, card_type_t type)
1074static int __init ecard_init(void) 978static int __init ecard_init(void)
1075{ 979{
1076 struct task_struct *task; 980 struct task_struct *task;
1077 int slot, irqhw; 981 int slot, irqbase;
982
983 irqbase = irq_alloc_descs(-1, 0, 8, -1);
984 if (irqbase < 0)
985 return irqbase;
1078 986
1079 task = kthread_run(ecard_task, NULL, "kecardd"); 987 task = kthread_run(ecard_task, NULL, "kecardd");
1080 if (IS_ERR(task)) { 988 if (IS_ERR(task)) {
1081 printk(KERN_ERR "Ecard: unable to create kernel thread: %ld\n", 989 printk(KERN_ERR "Ecard: unable to create kernel thread: %ld\n",
1082 PTR_ERR(task)); 990 PTR_ERR(task));
991 irq_free_descs(irqbase, 8);
1083 return PTR_ERR(task); 992 return PTR_ERR(task);
1084 } 993 }
1085 994
1086 printk("Probing expansion cards\n"); 995 printk("Probing expansion cards\n");
1087 996
1088 for (slot = 0; slot < 8; slot ++) { 997 for (slot = 0; slot < 8; slot ++) {
1089 if (ecard_probe(slot, ECARD_EASI) == -ENODEV) 998 if (ecard_probe(slot, irqbase + slot, ECARD_EASI) == -ENODEV)
1090 ecard_probe(slot, ECARD_IOC); 999 ecard_probe(slot, irqbase + slot, ECARD_IOC);
1091 } 1000 }
1092 1001
1093 ecard_probe(8, ECARD_IOC); 1002 ecard_probe(8, 11, ECARD_IOC);
1094
1095 irqhw = ecard_probeirqhw();
1096 1003
1097 irq_set_chained_handler(IRQ_EXPANSIONCARD, 1004 irq_set_chained_handler(IRQ_EXPANSIONCARD, ecard_irq_handler);
1098 irqhw ? ecard_irqexp_handler : ecard_irq_handler);
1099 1005
1100 ecard_proc_init(); 1006 ecard_proc_init();
1101 1007
diff --git a/arch/arm/kernel/ecard.h b/arch/arm/mach-rpc/ecard.h
index 4642d436be2a..4642d436be2a 100644
--- a/arch/arm/kernel/ecard.h
+++ b/arch/arm/mach-rpc/ecard.h
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
index 050d63c74cc1..257166b21f3d 100644
--- a/arch/arm/mach-rpc/include/mach/hardware.h
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -14,12 +14,6 @@
14 14
15#include <mach/memory.h> 15#include <mach/memory.h>
16 16
17#ifndef __ASSEMBLY__
18#define IOMEM(x) ((void __iomem *)(unsigned long)(x))
19#else
20#define IOMEM(x) x
21#endif /* __ASSEMBLY__ */
22
23/* 17/*
24 * What hardware must be present 18 * What hardware must be present
25 */ 19 */
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
index 695f4ed2e11b..707071a7ea4e 100644
--- a/arch/arm/mach-rpc/include/mach/io.h
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -28,9 +28,4 @@
28 */ 28 */
29#define __io(a) (PCIO_BASE + ((a) << 2)) 29#define __io(a) (PCIO_BASE + ((a) << 2))
30 30
31/*
32 * 1:1 mapping for ioremapped regions.
33 */
34#define __mem_pci(x) (x)
35
36#endif 31#endif
diff --git a/arch/arm/mach-rpc/include/mach/irqs.h b/arch/arm/mach-rpc/include/mach/irqs.h
index 3d2037496e38..6868e178274d 100644
--- a/arch/arm/mach-rpc/include/mach/irqs.h
+++ b/arch/arm/mach-rpc/include/mach/irqs.h
@@ -42,6 +42,4 @@
42 */ 42 */
43#define FIQ_START 64 43#define FIQ_START 64
44 44
45#define IRQ_TIMER IRQ_TIMER0
46
47#define NR_IRQS 128 45#define NR_IRQS 128
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index 3d44a59fc0df..f3fa259ce01f 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -28,6 +28,7 @@
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/domain.h> 29#include <asm/domain.h>
30#include <asm/setup.h> 30#include <asm/setup.h>
31#include <asm/system_misc.h>
31 32
32#include <asm/mach/map.h> 33#include <asm/mach/map.h>
33#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
@@ -98,15 +99,9 @@ static void __init rpc_map_io(void)
98} 99}
99 100
100static struct resource acornfb_resources[] = { 101static struct resource acornfb_resources[] = {
101 { /* VIDC */ 102 /* VIDC */
102 .start = 0x03400000, 103 DEFINE_RES_MEM(0x03400000, 0x00200000),
103 .end = 0x035fffff, 104 DEFINE_RES_IRQ(IRQ_VSYNCPULSE),
104 .flags = IORESOURCE_MEM,
105 }, {
106 .start = IRQ_VSYNCPULSE,
107 .end = IRQ_VSYNCPULSE,
108 .flags = IORESOURCE_IRQ,
109 },
110}; 105};
111 106
112static struct platform_device acornfb_device = { 107static struct platform_device acornfb_device = {
@@ -120,11 +115,7 @@ static struct platform_device acornfb_device = {
120}; 115};
121 116
122static struct resource iomd_resources[] = { 117static struct resource iomd_resources[] = {
123 { 118 DEFINE_RES_MEM(0x03200000, 0x10000),
124 .start = 0x03200000,
125 .end = 0x0320ffff,
126 .flags = IORESOURCE_MEM,
127 },
128}; 119};
129 120
130static struct platform_device iomd_device = { 121static struct platform_device iomd_device = {
@@ -134,18 +125,25 @@ static struct platform_device iomd_device = {
134 .resource = iomd_resources, 125 .resource = iomd_resources,
135}; 126};
136 127
128static struct resource iomd_kart_resources[] = {
129 DEFINE_RES_IRQ(IRQ_KEYBOARDRX),
130 DEFINE_RES_IRQ(IRQ_KEYBOARDTX),
131};
132
137static struct platform_device kbd_device = { 133static struct platform_device kbd_device = {
138 .name = "kart", 134 .name = "kart",
139 .id = -1, 135 .id = -1,
140 .dev = { 136 .dev = {
141 .parent = &iomd_device.dev, 137 .parent = &iomd_device.dev,
142 }, 138 },
139 .num_resources = ARRAY_SIZE(iomd_kart_resources),
140 .resource = iomd_kart_resources,
143}; 141};
144 142
145static struct plat_serial8250_port serial_platform_data[] = { 143static struct plat_serial8250_port serial_platform_data[] = {
146 { 144 {
147 .mapbase = 0x03010fe0, 145 .mapbase = 0x03010fe0,
148 .irq = 10, 146 .irq = IRQ_SERIALPORT,
149 .uartclk = 1843200, 147 .uartclk = 1843200,
150 .regshift = 2, 148 .regshift = 2,
151 .iotype = UPIO_MEM, 149 .iotype = UPIO_MEM,
@@ -167,21 +165,9 @@ static struct pata_platform_info pata_platform_data = {
167}; 165};
168 166
169static struct resource pata_resources[] = { 167static struct resource pata_resources[] = {
170 [0] = { 168 DEFINE_RES_MEM(0x030107c0, 0x20),
171 .start = 0x030107c0, 169 DEFINE_RES_MEM(0x03010fd8, 0x04),
172 .end = 0x030107df, 170 DEFINE_RES_IRQ(IRQ_HARDDISK),
173 .flags = IORESOURCE_MEM,
174 },
175 [1] = {
176 .start = 0x03010fd8,
177 .end = 0x03010fdb,
178 .flags = IORESOURCE_MEM,
179 },
180 [2] = {
181 .start = IRQ_HARDDISK,
182 .end = IRQ_HARDDISK,
183 .flags = IORESOURCE_IRQ,
184 },
185}; 171};
186 172
187static struct platform_device pata_device = { 173static struct platform_device pata_device = {
diff --git a/arch/arm/common/time-acorn.c b/arch/arm/mach-rpc/time.c
index deeed561b168..581fca934bb3 100644
--- a/arch/arm/common/time-acorn.c
+++ b/arch/arm/mach-rpc/time.c
@@ -85,7 +85,7 @@ static struct irqaction ioc_timer_irq = {
85static void __init ioc_timer_init(void) 85static void __init ioc_timer_init(void)
86{ 86{
87 ioctime_init(); 87 ioctime_init();
88 setup_irq(IRQ_TIMER, &ioc_timer_irq); 88 setup_irq(IRQ_TIMER0, &ioc_timer_irq);
89} 89}
90 90
91struct sys_timer ioc_timer = { 91struct sys_timer ioc_timer = {
diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h
new file mode 100644
index 000000000000..c2f596e7bc2d
--- /dev/null
+++ b/arch/arm/mach-s3c24xx/common.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S3C24XX SoCs
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S3C24XX_COMMON_H
13#define __ARCH_ARM_MACH_S3C24XX_COMMON_H __FILE__
14
15void s3c2410_restart(char mode, const char *cmd);
16void s3c244x_restart(char mode, const char *cmd);
17
18#endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */
diff --git a/arch/arm/mach-s3c24xx/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h
index 118749f37c4c..5dd1db4e2677 100644
--- a/arch/arm/mach-s3c24xx/include/mach/io.h
+++ b/arch/arm/mach-s3c24xx/include/mach/io.h
@@ -208,9 +208,4 @@ DECLARE_IO(int,l,"")
208#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l) 208#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
209#define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l) 209#define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l)
210 210
211/*
212 * 1:1 mapping for ioremapped regions.
213 */
214#define __mem_pci(x) (x)
215
216#endif 211#endif
diff --git a/arch/arm/mach-s3c24xx/s3c2410.c b/arch/arm/mach-s3c24xx/s3c2410.c
index 061b6bb1a557..a3c5cb086ee2 100644
--- a/arch/arm/mach-s3c24xx/s3c2410.c
+++ b/arch/arm/mach-s3c24xx/s3c2410.c
@@ -30,6 +30,7 @@
30 30
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <asm/irq.h> 32#include <asm/irq.h>
33#include <asm/system_misc.h>
33 34
34#include <plat/cpu-freq.h> 35#include <plat/cpu-freq.h>
35 36
diff --git a/arch/arm/mach-s3c24xx/s3c2412.c b/arch/arm/mach-s3c24xx/s3c2412.c
index c6eac9871093..d4bc7f960bbb 100644
--- a/arch/arm/mach-s3c24xx/s3c2412.c
+++ b/arch/arm/mach-s3c24xx/s3c2412.c
@@ -31,6 +31,7 @@
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <asm/proc-fns.h> 32#include <asm/proc-fns.h>
33#include <asm/irq.h> 33#include <asm/irq.h>
34#include <asm/system_misc.h>
34 35
35#include <plat/cpu-freq.h> 36#include <plat/cpu-freq.h>
36 37
diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
index 0e9a71c90ed7..7743fade50df 100644
--- a/arch/arm/mach-s3c24xx/s3c2416.c
+++ b/arch/arm/mach-s3c24xx/s3c2416.c
@@ -43,6 +43,7 @@
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <asm/proc-fns.h> 44#include <asm/proc-fns.h>
45#include <asm/irq.h> 45#include <asm/irq.h>
46#include <asm/system_misc.h>
46 47
47#include <mach/regs-s3c2443-clock.h> 48#include <mach/regs-s3c2443-clock.h>
48 49
diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
index b7778a9dafaf..ab648ad8fa50 100644
--- a/arch/arm/mach-s3c24xx/s3c2443.c
+++ b/arch/arm/mach-s3c24xx/s3c2443.c
@@ -29,6 +29,7 @@
29 29
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <asm/irq.h> 31#include <asm/irq.h>
32#include <asm/system_misc.h>
32 33
33#include <mach/regs-s3c2443-clock.h> 34#include <mach/regs-s3c2443-clock.h>
34 35
diff --git a/arch/arm/mach-s3c24xx/s3c244x.c b/arch/arm/mach-s3c24xx/s3c244x.c
index d15852f642b7..6f74118f60c6 100644
--- a/arch/arm/mach-s3c24xx/s3c244x.c
+++ b/arch/arm/mach-s3c24xx/s3c244x.c
@@ -23,6 +23,7 @@
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25 25
26#include <asm/system_misc.h>
26#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 28#include <asm/mach/map.h>
28#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-s3c24xx/simtec-nor.c b/arch/arm/mach-s3c24xx/simtec-nor.c
index 2119ca6a73bc..b9d6d4f92c03 100644
--- a/arch/arm/mach-s3c24xx/simtec-nor.c
+++ b/arch/arm/mach-s3c24xx/simtec-nor.c
@@ -35,9 +35,7 @@
35static void simtec_nor_vpp(struct platform_device *pdev, int vpp) 35static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
36{ 36{
37 unsigned int val; 37 unsigned int val;
38 unsigned long flags;
39 38
40 local_irq_save(flags);
41 val = __raw_readb(BAST_VA_CTRL3); 39 val = __raw_readb(BAST_VA_CTRL3);
42 40
43 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp); 41 printk(KERN_DEBUG "%s(%d)\n", __func__, vpp);
@@ -48,7 +46,6 @@ static void simtec_nor_vpp(struct platform_device *pdev, int vpp)
48 val &= ~BAST_CPLD_CTRL3_ROMWEN; 46 val &= ~BAST_CPLD_CTRL3_ROMWEN;
49 47
50 __raw_writeb(val, BAST_VA_CTRL3); 48 __raw_writeb(val, BAST_VA_CTRL3);
51 local_irq_restore(flags);
52} 49}
53 50
54static struct physmap_flash_data simtec_nor_pdata = { 51static struct physmap_flash_data simtec_nor_pdata = {
diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c
index bee7dcd4df7c..b313380342a5 100644
--- a/arch/arm/mach-s3c64xx/common.c
+++ b/arch/arm/mach-s3c64xx/common.c
@@ -29,6 +29,7 @@
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31#include <asm/hardware/vic.h> 31#include <asm/hardware/vic.h>
32#include <asm/system_misc.h>
32 33
33#include <mach/map.h> 34#include <mach/map.h>
34#include <mach/hardware.h> 35#include <mach/hardware.h>
diff --git a/arch/arm/mach-s3c64xx/include/mach/io.h b/arch/arm/mach-s3c64xx/include/mach/io.h
deleted file mode 100644
index de5716dbbd65..000000000000
--- a/arch/arm/mach-s3c64xx/include/mach/io.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* arch/arm/mach-s3c64xxinclude/mach/io.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben-linux@fluff.org>
5 *
6 * Default IO routines for S3C64XX based
7 */
8
9#ifndef __ASM_ARM_ARCH_IO_H
10#define __ASM_ARM_ARCH_IO_H
11
12/* No current ISA/PCI bus support. */
13#define __io(a) __typesafe_io(a)
14#define __mem_pci(a) (a)
15
16#define IO_SPACE_LIMIT (0xFFFFFFFF)
17
18#endif
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
index b6a67728cc88..0ace108c3e3d 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c
@@ -17,6 +17,8 @@
17#include <linux/mfd/wm831x/gpio.h> 17#include <linux/mfd/wm831x/gpio.h>
18#include <linux/mfd/wm8994/pdata.h> 18#include <linux/mfd/wm8994/pdata.h>
19 19
20#include <linux/regulator/machine.h>
21
20#include <sound/wm5100.h> 22#include <sound/wm5100.h>
21#include <sound/wm8996.h> 23#include <sound/wm8996.h>
22#include <sound/wm8962.h> 24#include <sound/wm8962.h>
@@ -153,6 +155,14 @@ static const struct i2c_board_info wm1259_devs[] = {
153 }, 155 },
154}; 156};
155 157
158static struct regulator_init_data wm8994_ldo1 = {
159 .supply_regulator = "WALLVDD",
160};
161
162static struct regulator_init_data wm8994_ldo2 = {
163 .supply_regulator = "WALLVDD",
164};
165
156static struct wm8994_pdata wm8994_pdata = { 166static struct wm8994_pdata wm8994_pdata = {
157 .gpio_base = CODEC_GPIO_BASE, 167 .gpio_base = CODEC_GPIO_BASE,
158 .gpio_defaults = { 168 .gpio_defaults = {
@@ -160,8 +170,8 @@ static struct wm8994_pdata wm8994_pdata = {
160 }, 170 },
161 .irq_base = CODEC_IRQ_BASE, 171 .irq_base = CODEC_IRQ_BASE,
162 .ldo = { 172 .ldo = {
163 { .supply = "WALLVDD" }, 173 { .init_data = &wm8994_ldo1, },
164 { .supply = "WALLVDD" }, 174 { .init_data = &wm8994_ldo2, },
165 }, 175 },
166}; 176};
167 177
diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
index 9143f8b19962..6e6a0a9d6778 100644
--- a/arch/arm/mach-s5p64x0/common.c
+++ b/arch/arm/mach-s5p64x0/common.c
@@ -27,6 +27,7 @@
27 27
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/proc-fns.h> 29#include <asm/proc-fns.h>
30#include <asm/system_misc.h>
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 32#include <asm/mach/map.h>
32#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-s5p64x0/include/mach/io.h b/arch/arm/mach-s5p64x0/include/mach/io.h
deleted file mode 100644
index a3e095c02fb5..000000000000
--- a/arch/arm/mach-s5p64x0/include/mach/io.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/io.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright 2008 Simtec Electronics
7 * Ben Dooks <ben-linux@fluff.org>
8 *
9 * Default IO routines for S5P64X0 based
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#ifndef __ASM_ARM_ARCH_IO_H
17#define __ASM_ARM_ARCH_IO_H
18
19/* No current ISA/PCI bus support. */
20#define __io(a) __typesafe_io(a)
21#define __mem_pci(a) (a)
22
23#define IO_SPACE_LIMIT (0xFFFFFFFF)
24
25#endif
diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
index ff71e2d467c6..621908658861 100644
--- a/arch/arm/mach-s5pc100/common.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -27,6 +27,7 @@
27 27
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/proc-fns.h> 29#include <asm/proc-fns.h>
30#include <asm/system_misc.h>
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 32#include <asm/mach/map.h>
32#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-s5pc100/include/mach/io.h b/arch/arm/mach-s5pc100/include/mach/io.h
deleted file mode 100644
index 819acf5eaf89..000000000000
--- a/arch/arm/mach-s5pc100/include/mach/io.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/* arch/arm/mach-s5pc100/include/mach/io.h
2 *
3 * Copyright 2008 Simtec Electronics
4 * Ben Dooks <ben-linux@fluff.org>
5 *
6 * Default IO routines for S5PC100 systems
7 */
8
9#ifndef __ASM_ARM_ARCH_IO_H
10#define __ASM_ARM_ARCH_IO_H
11
12/* No current ISA/PCI bus support. */
13#define __io(a) __typesafe_io(a)
14#define __mem_pci(a) (a)
15
16#define IO_SPACE_LIMIT (0xFFFFFFFF)
17
18#endif
diff --git a/arch/arm/mach-s5pv210/include/mach/io.h b/arch/arm/mach-s5pv210/include/mach/io.h
deleted file mode 100644
index 5ab9d560bc86..000000000000
--- a/arch/arm/mach-s5pv210/include/mach/io.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/io.h
2 *
3 * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org>
4 *
5 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 *
8 * Based on arch/arm/mach-s5p6442/include/mach/io.h
9 *
10 * Default IO routines for S5PV210
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15*/
16
17#ifndef __ASM_ARM_ARCH_IO_H
18#define __ASM_ARM_ARCH_IO_H __FILE__
19
20/* No current ISA/PCI bus support. */
21#define __io(a) __typesafe_io(a)
22#define __mem_pci(a) (a)
23
24#define IO_SPACE_LIMIT (0xFFFFFFFF)
25
26#endif /* __ASM_ARM_ARCH_IO_H */
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index ed7408d3216c..60b97ec01676 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o 6obj-y := clock.o generic.o irq.o time.o #nmi-oopser.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 0c4b76ab4d8e..375d3f779a88 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -15,14 +15,16 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/serial_core.h> 17#include <linux/serial_core.h>
18#include <linux/mfd/ucb1x00.h>
18#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/mm.h> 22#include <linux/mm.h>
22 23
24#include <video/sa1100fb.h>
25
23#include <mach/hardware.h> 26#include <mach/hardware.h>
24#include <asm/mach-types.h> 27#include <asm/mach-types.h>
25#include <asm/irq.h>
26#include <asm/setup.h> 28#include <asm/setup.h>
27#include <asm/page.h> 29#include <asm/page.h>
28#include <asm/pgtable-hwdef.h> 30#include <asm/pgtable-hwdef.h>
@@ -36,17 +38,18 @@
36#include <asm/mach/serial_sa1100.h> 38#include <asm/mach/serial_sa1100.h>
37#include <mach/assabet.h> 39#include <mach/assabet.h>
38#include <mach/mcp.h> 40#include <mach/mcp.h>
41#include <mach/irqs.h>
39 42
40#include "generic.h" 43#include "generic.h"
41 44
42#define ASSABET_BCR_DB1110 \ 45#define ASSABET_BCR_DB1110 \
43 (ASSABET_BCR_SPK_OFF | ASSABET_BCR_QMUTE | \ 46 (ASSABET_BCR_SPK_OFF | \
44 ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ 47 ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \
45 ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ 48 ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \
46 ASSABET_BCR_IRDA_MD0) 49 ASSABET_BCR_IRDA_MD0)
47 50
48#define ASSABET_BCR_DB1111 \ 51#define ASSABET_BCR_DB1111 \
49 (ASSABET_BCR_SPK_OFF | ASSABET_BCR_QMUTE | \ 52 (ASSABET_BCR_SPK_OFF | \
50 ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ 53 ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \
51 ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ 54 ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \
52 ASSABET_BCR_CF_BUS_OFF | ASSABET_BCR_STEREO_LB | \ 55 ASSABET_BCR_CF_BUS_OFF | ASSABET_BCR_STEREO_LB | \
@@ -69,31 +72,10 @@ void ASSABET_BCR_frob(unsigned int mask, unsigned int val)
69 72
70EXPORT_SYMBOL(ASSABET_BCR_frob); 73EXPORT_SYMBOL(ASSABET_BCR_frob);
71 74
72static void assabet_backlight_power(int on) 75static void assabet_ucb1x00_reset(enum ucb1x00_reset state)
73{
74#ifndef ASSABET_PAL_VIDEO
75 if (on)
76 ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON);
77 else
78#endif
79 ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON);
80}
81
82/*
83 * Turn on/off the backlight. When turning the backlight on,
84 * we wait 500us after turning it on so we don't cause the
85 * supplies to droop when we enable the LCD controller (and
86 * cause a hard reset.)
87 */
88static void assabet_lcd_power(int on)
89{ 76{
90#ifndef ASSABET_PAL_VIDEO 77 if (state == UCB_RST_PROBE)
91 if (on) { 78 ASSABET_BCR_set(ASSABET_BCR_CODEC_RST);
92 ASSABET_BCR_set(ASSABET_BCR_LCD_ON);
93 udelay(500);
94 } else
95#endif
96 ASSABET_BCR_clear(ASSABET_BCR_LCD_ON);
97} 79}
98 80
99 81
@@ -152,15 +134,8 @@ static struct flash_platform_data assabet_flash_data = {
152}; 134};
153 135
154static struct resource assabet_flash_resources[] = { 136static struct resource assabet_flash_resources[] = {
155 { 137 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M),
156 .start = SA1100_CS0_PHYS, 138 DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_32M),
157 .end = SA1100_CS0_PHYS + SZ_32M - 1,
158 .flags = IORESOURCE_MEM,
159 }, {
160 .start = SA1100_CS1_PHYS,
161 .end = SA1100_CS1_PHYS + SZ_32M - 1,
162 .flags = IORESOURCE_MEM,
163 }
164}; 139};
165 140
166 141
@@ -199,18 +174,126 @@ static struct irda_platform_data assabet_irda_data = {
199 .set_speed = assabet_irda_set_speed, 174 .set_speed = assabet_irda_set_speed,
200}; 175};
201 176
177static struct ucb1x00_plat_data assabet_ucb1x00_data = {
178 .reset = assabet_ucb1x00_reset,
179 .gpio_base = -1,
180};
181
202static struct mcp_plat_data assabet_mcp_data = { 182static struct mcp_plat_data assabet_mcp_data = {
203 .mccr0 = MCCR0_ADM, 183 .mccr0 = MCCR0_ADM,
204 .sclk_rate = 11981000, 184 .sclk_rate = 11981000,
185 .codec_pdata = &assabet_ucb1x00_data,
186};
187
188static void assabet_lcd_set_visual(u32 visual)
189{
190 u_int is_true_color = visual == FB_VISUAL_TRUECOLOR;
191
192 if (machine_is_assabet()) {
193#if 1 // phase 4 or newer Assabet's
194 if (is_true_color)
195 ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB);
196 else
197 ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB);
198#else
199 // older Assabet's
200 if (is_true_color)
201 ASSABET_BCR_clear(ASSABET_BCR_LCD_12RGB);
202 else
203 ASSABET_BCR_set(ASSABET_BCR_LCD_12RGB);
204#endif
205 }
206}
207
208#ifndef ASSABET_PAL_VIDEO
209static void assabet_lcd_backlight_power(int on)
210{
211 if (on)
212 ASSABET_BCR_set(ASSABET_BCR_LIGHT_ON);
213 else
214 ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON);
215}
216
217/*
218 * Turn on/off the backlight. When turning the backlight on, we wait
219 * 500us after turning it on so we don't cause the supplies to droop
220 * when we enable the LCD controller (and cause a hard reset.)
221 */
222static void assabet_lcd_power(int on)
223{
224 if (on) {
225 ASSABET_BCR_set(ASSABET_BCR_LCD_ON);
226 udelay(500);
227 } else
228 ASSABET_BCR_clear(ASSABET_BCR_LCD_ON);
229}
230
231/*
232 * The assabet uses a sharp LQ039Q2DS54 LCD module. It is actually
233 * takes an RGB666 signal, but we provide it with an RGB565 signal
234 * instead (def_rgb_16).
235 */
236static struct sa1100fb_mach_info lq039q2ds54_info = {
237 .pixclock = 171521, .bpp = 16,
238 .xres = 320, .yres = 240,
239
240 .hsync_len = 5, .vsync_len = 1,
241 .left_margin = 61, .upper_margin = 3,
242 .right_margin = 9, .lower_margin = 0,
243
244 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
245
246 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
247 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
248
249 .backlight_power = assabet_lcd_backlight_power,
250 .lcd_power = assabet_lcd_power,
251 .set_visual = assabet_lcd_set_visual,
252};
253#else
254static void assabet_pal_backlight_power(int on)
255{
256 ASSABET_BCR_clear(ASSABET_BCR_LIGHT_ON);
257}
258
259static void assabet_pal_power(int on)
260{
261 ASSABET_BCR_clear(ASSABET_BCR_LCD_ON);
262}
263
264static struct sa1100fb_mach_info pal_info = {
265 .pixclock = 67797, .bpp = 16,
266 .xres = 640, .yres = 512,
267
268 .hsync_len = 64, .vsync_len = 6,
269 .left_margin = 125, .upper_margin = 70,
270 .right_margin = 115, .lower_margin = 36,
271
272 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
273 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),
274
275 .backlight_power = assabet_pal_backlight_power,
276 .lcd_power = assabet_pal_power,
277 .set_visual = assabet_lcd_set_visual,
205}; 278};
279#endif
280
281#ifdef CONFIG_ASSABET_NEPONSET
282static struct resource neponset_resources[] = {
283 DEFINE_RES_MEM(0x10000000, 0x08000000),
284 DEFINE_RES_MEM(0x18000000, 0x04000000),
285 DEFINE_RES_MEM(0x40000000, SZ_8K),
286 DEFINE_RES_IRQ(IRQ_GPIO25),
287};
288#endif
206 289
207static void __init assabet_init(void) 290static void __init assabet_init(void)
208{ 291{
209 /* 292 /*
210 * Ensure that the power supply is in "high power" mode. 293 * Ensure that the power supply is in "high power" mode.
211 */ 294 */
212 GPDR |= GPIO_GPIO16;
213 GPSR = GPIO_GPIO16; 295 GPSR = GPIO_GPIO16;
296 GPDR |= GPIO_GPIO16;
214 297
215 /* 298 /*
216 * Ensure that these pins are set as outputs and are driving 299 * Ensure that these pins are set as outputs and are driving
@@ -218,8 +301,16 @@ static void __init assabet_init(void)
218 * the WS latch in the CPLD, and we don't float causing 301 * the WS latch in the CPLD, and we don't float causing
219 * excessive power drain. --rmk 302 * excessive power drain. --rmk
220 */ 303 */
221 GPDR |= GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM;
222 GPCR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM; 304 GPCR = GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM;
305 GPDR |= GPIO_SSP_TXD | GPIO_SSP_SCLK | GPIO_SSP_SFRM;
306
307 /*
308 * Also set GPIO27 as an output; this is used to clock UART3
309 * via the FPGA and as otherwise has no pullups or pulldowns,
310 * so stop it floating.
311 */
312 GPCR = GPIO_GPIO27;
313 GPDR |= GPIO_GPIO27;
223 314
224 /* 315 /*
225 * Set up registers for sleep mode. 316 * Set up registers for sleep mode.
@@ -231,8 +322,7 @@ static void __init assabet_init(void)
231 PPDR |= PPC_TXD3 | PPC_TXD1; 322 PPDR |= PPC_TXD3 | PPC_TXD1;
232 PPSR |= PPC_TXD3 | PPC_TXD1; 323 PPSR |= PPC_TXD3 | PPC_TXD1;
233 324
234 sa1100fb_lcd_power = assabet_lcd_power; 325 sa11x0_ppc_configure_mcp();
235 sa1100fb_backlight_power = assabet_backlight_power;
236 326
237 if (machine_has_neponset()) { 327 if (machine_has_neponset()) {
238 /* 328 /*
@@ -246,9 +336,17 @@ static void __init assabet_init(void)
246#ifndef CONFIG_ASSABET_NEPONSET 336#ifndef CONFIG_ASSABET_NEPONSET
247 printk( "Warning: Neponset detected but full support " 337 printk( "Warning: Neponset detected but full support "
248 "hasn't been configured in the kernel\n" ); 338 "hasn't been configured in the kernel\n" );
339#else
340 platform_device_register_simple("neponset", 0,
341 neponset_resources, ARRAY_SIZE(neponset_resources));
249#endif 342#endif
250 } 343 }
251 344
345#ifndef ASSABET_PAL_VIDEO
346 sa11x0_register_lcd(&lq039q2ds54_info);
347#else
348 sa11x0_register_lcd(&pal_video);
349#endif
252 sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources, 350 sa11x0_register_mtd(&assabet_flash_data, assabet_flash_resources,
253 ARRAY_SIZE(assabet_flash_resources)); 351 ARRAY_SIZE(assabet_flash_resources));
254 sa11x0_register_irda(&assabet_irda_data); 352 sa11x0_register_irda(&assabet_irda_data);
@@ -412,21 +510,8 @@ static void __init assabet_map_io(void)
412 */ 510 */
413 Ser1SDCR0 |= SDCR0_SUS; 511 Ser1SDCR0 |= SDCR0_SUS;
414 512
415 if (machine_has_neponset()) { 513 if (!machine_has_neponset())
416#ifdef CONFIG_ASSABET_NEPONSET
417 extern void neponset_map_io(void);
418
419 /*
420 * We map Neponset registers even if it isn't present since
421 * many drivers will try to probe their stuff (and fail).
422 * This is still more friendly than a kernel paging request
423 * crash.
424 */
425 neponset_map_io();
426#endif
427 } else {
428 sa1100_register_uart_fns(&assabet_port_fns); 514 sa1100_register_uart_fns(&assabet_port_fns);
429 }
430 515
431 /* 516 /*
432 * When Neponset is attached, the first UART should be 517 * When Neponset is attached, the first UART should be
@@ -449,6 +534,7 @@ MACHINE_START(ASSABET, "Intel-Assabet")
449 .atag_offset = 0x100, 534 .atag_offset = 0x100,
450 .fixup = fixup_assabet, 535 .fixup = fixup_assabet,
451 .map_io = assabet_map_io, 536 .map_io = assabet_map_io,
537 .nr_irqs = SA1100_NR_IRQS,
452 .init_irq = sa1100_init_irq, 538 .init_irq = sa1100_init_irq,
453 .timer = &sa1100_timer, 539 .timer = &sa1100_timer,
454 .init_machine = assabet_init, 540 .init_machine = assabet_init,
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index b07a2c024cb7..e0f0c030258c 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -39,20 +39,27 @@
39#include "generic.h" 39#include "generic.h"
40 40
41static struct resource sa1111_resources[] = { 41static struct resource sa1111_resources[] = {
42 [0] = { 42 [0] = DEFINE_RES_MEM(BADGE4_SA1111_BASE, 0x2000),
43 .start = BADGE4_SA1111_BASE, 43 [1] = DEFINE_RES_IRQ(BADGE4_IRQ_GPIO_SA1111),
44 .end = BADGE4_SA1111_BASE + 0x00001fff,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
48 .start = BADGE4_IRQ_GPIO_SA1111,
49 .end = BADGE4_IRQ_GPIO_SA1111,
50 .flags = IORESOURCE_IRQ,
51 },
52}; 44};
53 45
46static int badge4_sa1111_enable(void *data, unsigned devid)
47{
48 if (devid == SA1111_DEVID_USB)
49 badge4_set_5V(BADGE4_5V_USB, 1);
50 return 0;
51}
52
53static void badge4_sa1111_disable(void *data, unsigned devid)
54{
55 if (devid == SA1111_DEVID_USB)
56 badge4_set_5V(BADGE4_5V_USB, 0);
57}
58
54static struct sa1111_platform_data sa1111_info = { 59static struct sa1111_platform_data sa1111_info = {
55 .irq_base = IRQ_BOARD_END, 60 .disable_devs = SA1111_DEVID_PS2_MSE,
61 .enable = badge4_sa1111_enable,
62 .disable = badge4_sa1111_disable,
56}; 63};
57 64
58static u64 sa1111_dmamask = 0xffffffffUL; 65static u64 sa1111_dmamask = 0xffffffffUL;
@@ -121,11 +128,8 @@ static struct flash_platform_data badge4_flash_data = {
121 .nr_parts = ARRAY_SIZE(badge4_partitions), 128 .nr_parts = ARRAY_SIZE(badge4_partitions),
122}; 129};
123 130
124static struct resource badge4_flash_resource = { 131static struct resource badge4_flash_resource =
125 .start = SA1100_CS0_PHYS, 132 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_64M);
126 .end = SA1100_CS0_PHYS + SZ_64M - 1,
127 .flags = IORESOURCE_MEM,
128};
129 133
130static int five_v_on __initdata = 0; 134static int five_v_on __initdata = 0;
131 135
@@ -269,11 +273,6 @@ static struct map_desc badge4_io_desc[] __initdata = {
269 .pfn = __phys_to_pfn(0x10000000), 273 .pfn = __phys_to_pfn(0x10000000),
270 .length = 0x00100000, 274 .length = 0x00100000,
271 .type = MT_DEVICE 275 .type = MT_DEVICE
272 }, { /* SA-1111 */
273 .virtual = 0xf4000000,
274 .pfn = __phys_to_pfn(0x48000000),
275 .length = 0x00100000,
276 .type = MT_DEVICE
277 } 276 }
278}; 277};
279 278
@@ -304,6 +303,7 @@ static void __init badge4_map_io(void)
304MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") 303MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
305 .atag_offset = 0x100, 304 .atag_offset = 0x100,
306 .map_io = badge4_map_io, 305 .map_io = badge4_map_io,
306 .nr_irqs = SA1100_NR_IRQS,
307 .init_irq = sa1100_init_irq, 307 .init_irq = sa1100_init_irq,
308 .timer = &sa1100_timer, 308 .timer = &sa1100_timer,
309#ifdef CONFIG_SA1111 309#ifdef CONFIG_SA1111
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index 11bb6d0b9be3..4a61f60e0502 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -18,7 +18,6 @@
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20 20
21#include <asm/irq.h>
22#include <mach/hardware.h> 21#include <mach/hardware.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
24 23
@@ -30,14 +29,11 @@
30 29
31#include <mach/cerf.h> 30#include <mach/cerf.h>
32#include <mach/mcp.h> 31#include <mach/mcp.h>
32#include <mach/irqs.h>
33#include "generic.h" 33#include "generic.h"
34 34
35static struct resource cerfuart2_resources[] = { 35static struct resource cerfuart2_resources[] = {
36 [0] = { 36 [0] = DEFINE_RES_MEM(0x80030000, SZ_64K),
37 .start = 0x80030000,
38 .end = 0x8003ffff,
39 .flags = IORESOURCE_MEM,
40 },
41}; 37};
42 38
43static struct platform_device cerfuart2_device = { 39static struct platform_device cerfuart2_device = {
@@ -87,11 +83,8 @@ static struct flash_platform_data cerf_flash_data = {
87 .nr_parts = ARRAY_SIZE(cerf_partitions), 83 .nr_parts = ARRAY_SIZE(cerf_partitions),
88}; 84};
89 85
90static struct resource cerf_flash_resource = { 86static struct resource cerf_flash_resource =
91 .start = SA1100_CS0_PHYS, 87 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
92 .end = SA1100_CS0_PHYS + SZ_32M - 1,
93 .flags = IORESOURCE_MEM,
94};
95 88
96static void __init cerf_init_irq(void) 89static void __init cerf_init_irq(void)
97{ 90{
@@ -128,6 +121,7 @@ static struct mcp_plat_data cerf_mcp_data = {
128 121
129static void __init cerf_init(void) 122static void __init cerf_init(void)
130{ 123{
124 sa11x0_ppc_configure_mcp();
131 platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices)); 125 platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
132 sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1); 126 sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
133 sa11x0_register_mcp(&cerf_mcp_data); 127 sa11x0_register_mcp(&cerf_mcp_data);
@@ -136,6 +130,7 @@ static void __init cerf_init(void)
136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") 130MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
137 /* Maintainer: support@intrinsyc.com */ 131 /* Maintainer: support@intrinsyc.com */
138 .map_io = cerf_map_io, 132 .map_io = cerf_map_io,
133 .nr_irqs = SA1100_NR_IRQS,
139 .init_irq = cerf_init_irq, 134 .init_irq = cerf_init_irq,
140 .timer = &sa1100_timer, 135 .timer = &sa1100_timer,
141 .init_machine = cerf_init, 136 .init_machine = cerf_init,
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index fd5652118ed1..c7f418b0cde9 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -22,15 +22,17 @@
22#include <linux/tty.h> 22#include <linux/tty.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/mfd/ucb1x00.h>
25#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
26#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
27#include <linux/timer.h> 28#include <linux/timer.h>
28#include <linux/gpio.h> 29#include <linux/gpio.h>
29#include <linux/pda_power.h> 30#include <linux/pda_power.h>
30 31
32#include <video/sa1100fb.h>
33
31#include <mach/hardware.h> 34#include <mach/hardware.h>
32#include <asm/mach-types.h> 35#include <asm/mach-types.h>
33#include <asm/irq.h>
34#include <asm/page.h> 36#include <asm/page.h>
35#include <asm/setup.h> 37#include <asm/setup.h>
36#include <mach/collie.h> 38#include <mach/collie.h>
@@ -44,15 +46,12 @@
44#include <asm/mach/sharpsl_param.h> 46#include <asm/mach/sharpsl_param.h>
45#include <asm/hardware/locomo.h> 47#include <asm/hardware/locomo.h>
46#include <mach/mcp.h> 48#include <mach/mcp.h>
49#include <mach/irqs.h>
47 50
48#include "generic.h" 51#include "generic.h"
49 52
50static struct resource collie_scoop_resources[] = { 53static struct resource collie_scoop_resources[] = {
51 [0] = { 54 [0] = DEFINE_RES_MEM(0x40800000, SZ_4K),
52 .start = 0x40800000,
53 .end = 0x40800fff,
54 .flags = IORESOURCE_MEM,
55 },
56}; 55};
57 56
58static struct scoop_config collie_scoop_setup = { 57static struct scoop_config collie_scoop_setup = {
@@ -85,10 +84,14 @@ static struct scoop_pcmcia_config collie_pcmcia_config = {
85 .num_devs = 1, 84 .num_devs = 1,
86}; 85};
87 86
87static struct ucb1x00_plat_data collie_ucb1x00_data = {
88 .gpio_base = COLLIE_TC35143_GPIO_BASE,
89};
90
88static struct mcp_plat_data collie_mcp_data = { 91static struct mcp_plat_data collie_mcp_data = {
89 .mccr0 = MCCR0_ADM | MCCR0_ExtClk, 92 .mccr0 = MCCR0_ADM | MCCR0_ExtClk,
90 .sclk_rate = 9216000, 93 .sclk_rate = 9216000,
91 .gpio_base = COLLIE_TC35143_GPIO_BASE, 94 .codec_pdata = &collie_ucb1x00_data,
92}; 95};
93 96
94/* 97/*
@@ -221,16 +224,8 @@ device_initcall(collie_uart_init);
221 224
222 225
223static struct resource locomo_resources[] = { 226static struct resource locomo_resources[] = {
224 [0] = { 227 [0] = DEFINE_RES_MEM(0x40000000, SZ_8K),
225 .start = 0x40000000, 228 [1] = DEFINE_RES_IRQ(IRQ_GPIO25),
226 .end = 0x40001fff,
227 .flags = IORESOURCE_MEM,
228 },
229 [1] = {
230 .start = IRQ_GPIO25,
231 .end = IRQ_GPIO25,
232 .flags = IORESOURCE_IRQ,
233 },
234}; 229};
235 230
236static struct locomo_platform_data locomo_info = { 231static struct locomo_platform_data locomo_info = {
@@ -303,11 +298,25 @@ static struct flash_platform_data collie_flash_data = {
303}; 298};
304 299
305static struct resource collie_flash_resources[] = { 300static struct resource collie_flash_resources[] = {
306 { 301 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M),
307 .start = SA1100_CS0_PHYS, 302};
308 .end = SA1100_CS0_PHYS + SZ_32M - 1, 303
309 .flags = IORESOURCE_MEM, 304static struct sa1100fb_mach_info collie_lcd_info = {
310 } 305 .pixclock = 171521, .bpp = 16,
306 .xres = 320, .yres = 240,
307
308 .hsync_len = 5, .vsync_len = 1,
309 .left_margin = 11, .upper_margin = 2,
310 .right_margin = 30, .lower_margin = 0,
311
312 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
313
314 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
315 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
316
317#ifdef CONFIG_BACKLIGHT_LOCOMO
318 .lcd_power = locomolcd_power
319#endif
311}; 320};
312 321
313static void __init collie_init(void) 322static void __init collie_init(void)
@@ -341,6 +350,10 @@ static void __init collie_init(void)
341 350
342 collie_power_resource[0].start = gpio_to_irq(COLLIE_GPIO_AC_IN); 351 collie_power_resource[0].start = gpio_to_irq(COLLIE_GPIO_AC_IN);
343 collie_power_resource[0].end = gpio_to_irq(COLLIE_GPIO_AC_IN); 352 collie_power_resource[0].end = gpio_to_irq(COLLIE_GPIO_AC_IN);
353
354 sa11x0_ppc_configure_mcp();
355
356
344 platform_scoop_config = &collie_pcmcia_config; 357 platform_scoop_config = &collie_pcmcia_config;
345 358
346 ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 359 ret = platform_add_devices(devices, ARRAY_SIZE(devices));
@@ -348,6 +361,7 @@ static void __init collie_init(void)
348 printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); 361 printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
349 } 362 }
350 363
364 sa11x0_register_lcd(&collie_lcd_info);
351 sa11x0_register_mtd(&collie_flash_data, collie_flash_resources, 365 sa11x0_register_mtd(&collie_flash_data, collie_flash_resources,
352 ARRAY_SIZE(collie_flash_resources)); 366 ARRAY_SIZE(collie_flash_resources));
353 sa11x0_register_mcp(&collie_mcp_data); 367 sa11x0_register_mcp(&collie_mcp_data);
@@ -383,6 +397,7 @@ static void __init collie_map_io(void)
383 397
384MACHINE_START(COLLIE, "Sharp-Collie") 398MACHINE_START(COLLIE, "Sharp-Collie")
385 .map_io = collie_map_io, 399 .map_io = collie_map_io,
400 .nr_irqs = SA1100_NR_IRQS,
386 .init_irq = sa1100_init_irq, 401 .init_irq = sa1100_init_irq,
387 .timer = &sa1100_timer, 402 .timer = &sa1100_timer,
388 .init_machine = collie_init, 403 .init_machine = collie_init,
diff --git a/arch/arm/mach-sa1100/dma.c b/arch/arm/mach-sa1100/dma.c
deleted file mode 100644
index ad660350c296..000000000000
--- a/arch/arm/mach-sa1100/dma.c
+++ /dev/null
@@ -1,348 +0,0 @@
1/*
2 * arch/arm/mach-sa1100/dma.c
3 *
4 * Support functions for the SA11x0 internal DMA channels.
5 *
6 * Copyright (C) 2000, 2001 by Nicolas Pitre
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/interrupt.h>
15#include <linux/init.h>
16#include <linux/spinlock.h>
17#include <linux/errno.h>
18
19#include <asm/system.h>
20#include <asm/irq.h>
21#include <mach/hardware.h>
22#include <mach/dma.h>
23
24
25#undef DEBUG
26#ifdef DEBUG
27#define DPRINTK( s, arg... ) printk( "dma<%p>: " s, regs , ##arg )
28#else
29#define DPRINTK( x... )
30#endif
31
32
33typedef struct {
34 const char *device_id; /* device name */
35 u_long device; /* this channel device, 0 if unused*/
36 dma_callback_t callback; /* to call when DMA completes */
37 void *data; /* ... with private data ptr */
38} sa1100_dma_t;
39
40static sa1100_dma_t dma_chan[SA1100_DMA_CHANNELS];
41
42static DEFINE_SPINLOCK(dma_list_lock);
43
44
45static irqreturn_t dma_irq_handler(int irq, void *dev_id)
46{
47 dma_regs_t *dma_regs = dev_id;
48 sa1100_dma_t *dma = dma_chan + (((u_int)dma_regs >> 5) & 7);
49 int status = dma_regs->RdDCSR;
50
51 if (status & (DCSR_ERROR)) {
52 printk(KERN_CRIT "DMA on \"%s\" caused an error\n", dma->device_id);
53 dma_regs->ClrDCSR = DCSR_ERROR;
54 }
55
56 dma_regs->ClrDCSR = status & (DCSR_DONEA | DCSR_DONEB);
57 if (dma->callback) {
58 if (status & DCSR_DONEA)
59 dma->callback(dma->data);
60 if (status & DCSR_DONEB)
61 dma->callback(dma->data);
62 }
63 return IRQ_HANDLED;
64}
65
66
67/**
68 * sa1100_request_dma - allocate one of the SA11x0's DMA channels
69 * @device: The SA11x0 peripheral targeted by this request
70 * @device_id: An ascii name for the claiming device
71 * @callback: Function to be called when the DMA completes
72 * @data: A cookie passed back to the callback function
73 * @dma_regs: Pointer to the location of the allocated channel's identifier
74 *
75 * This function will search for a free DMA channel and returns the
76 * address of the hardware registers for that channel as the channel
77 * identifier. This identifier is written to the location pointed by
78 * @dma_regs. The list of possible values for @device are listed into
79 * arch/arm/mach-sa1100/include/mach/dma.h as a dma_device_t enum.
80 *
81 * Note that reading from a port and writing to the same port are
82 * actually considered as two different streams requiring separate
83 * DMA registrations.
84 *
85 * The @callback function is called from interrupt context when one
86 * of the two possible DMA buffers in flight has terminated. That
87 * function has to be small and efficient while posponing more complex
88 * processing to a lower priority execution context.
89 *
90 * If no channels are available, or if the desired @device is already in
91 * use by another DMA channel, then an error code is returned. This
92 * function must be called before any other DMA calls.
93 **/
94
95int sa1100_request_dma (dma_device_t device, const char *device_id,
96 dma_callback_t callback, void *data,
97 dma_regs_t **dma_regs)
98{
99 sa1100_dma_t *dma = NULL;
100 dma_regs_t *regs;
101 int i, err;
102
103 *dma_regs = NULL;
104
105 err = 0;
106 spin_lock(&dma_list_lock);
107 for (i = 0; i < SA1100_DMA_CHANNELS; i++) {
108 if (dma_chan[i].device == device) {
109 err = -EBUSY;
110 break;
111 } else if (!dma_chan[i].device && !dma) {
112 dma = &dma_chan[i];
113 }
114 }
115 if (!err) {
116 if (dma)
117 dma->device = device;
118 else
119 err = -ENOSR;
120 }
121 spin_unlock(&dma_list_lock);
122 if (err)
123 return err;
124
125 i = dma - dma_chan;
126 regs = (dma_regs_t *)&DDAR(i);
127 err = request_irq(IRQ_DMA0 + i, dma_irq_handler, IRQF_DISABLED,
128 device_id, regs);
129 if (err) {
130 printk(KERN_ERR
131 "%s: unable to request IRQ %d for %s\n",
132 __func__, IRQ_DMA0 + i, device_id);
133 dma->device = 0;
134 return err;
135 }
136
137 *dma_regs = regs;
138 dma->device_id = device_id;
139 dma->callback = callback;
140 dma->data = data;
141
142 regs->ClrDCSR =
143 (DCSR_DONEA | DCSR_DONEB | DCSR_STRTA | DCSR_STRTB |
144 DCSR_IE | DCSR_ERROR | DCSR_RUN);
145 regs->DDAR = device;
146
147 return 0;
148}
149
150
151/**
152 * sa1100_free_dma - free a SA11x0 DMA channel
153 * @regs: identifier for the channel to free
154 *
155 * This clears all activities on a given DMA channel and releases it
156 * for future requests. The @regs identifier is provided by a
157 * successful call to sa1100_request_dma().
158 **/
159
160void sa1100_free_dma(dma_regs_t *regs)
161{
162 int i;
163
164 for (i = 0; i < SA1100_DMA_CHANNELS; i++)
165 if (regs == (dma_regs_t *)&DDAR(i))
166 break;
167 if (i >= SA1100_DMA_CHANNELS) {
168 printk(KERN_ERR "%s: bad DMA identifier\n", __func__);
169 return;
170 }
171
172 if (!dma_chan[i].device) {
173 printk(KERN_ERR "%s: Trying to free free DMA\n", __func__);
174 return;
175 }
176
177 regs->ClrDCSR =
178 (DCSR_DONEA | DCSR_DONEB | DCSR_STRTA | DCSR_STRTB |
179 DCSR_IE | DCSR_ERROR | DCSR_RUN);
180 free_irq(IRQ_DMA0 + i, regs);
181 dma_chan[i].device = 0;
182}
183
184
185/**
186 * sa1100_start_dma - submit a data buffer for DMA
187 * @regs: identifier for the channel to use
188 * @dma_ptr: buffer physical (or bus) start address
189 * @size: buffer size
190 *
191 * This function hands the given data buffer to the hardware for DMA
192 * access. If another buffer is already in flight then this buffer
193 * will be queued so the DMA engine will switch to it automatically
194 * when the previous one is done. The DMA engine is actually toggling
195 * between two buffers so at most 2 successful calls can be made before
196 * one of them terminates and the callback function is called.
197 *
198 * The @regs identifier is provided by a successful call to
199 * sa1100_request_dma().
200 *
201 * The @size must not be larger than %MAX_DMA_SIZE. If a given buffer
202 * is larger than that then it's the caller's responsibility to split
203 * it into smaller chunks and submit them separately. If this is the
204 * case then a @size of %CUT_DMA_SIZE is recommended to avoid ending
205 * up with too small chunks. The callback function can be used to chain
206 * submissions of buffer chunks.
207 *
208 * Error return values:
209 * %-EOVERFLOW: Given buffer size is too big.
210 * %-EBUSY: Both DMA buffers are already in use.
211 * %-EAGAIN: Both buffers were busy but one of them just completed
212 * but the interrupt handler has to execute first.
213 *
214 * This function returs 0 on success.
215 **/
216
217int sa1100_start_dma(dma_regs_t *regs, dma_addr_t dma_ptr, u_int size)
218{
219 unsigned long flags;
220 u_long status;
221 int ret;
222
223 if (dma_ptr & 3)
224 printk(KERN_WARNING "DMA: unaligned start address (0x%08lx)\n",
225 (unsigned long)dma_ptr);
226
227 if (size > MAX_DMA_SIZE)
228 return -EOVERFLOW;
229
230 local_irq_save(flags);
231 status = regs->RdDCSR;
232
233 /* If both DMA buffers are started, there's nothing else we can do. */
234 if ((status & (DCSR_STRTA | DCSR_STRTB)) == (DCSR_STRTA | DCSR_STRTB)) {
235 DPRINTK("start: st %#x busy\n", status);
236 ret = -EBUSY;
237 goto out;
238 }
239
240 if (((status & DCSR_BIU) && (status & DCSR_STRTB)) ||
241 (!(status & DCSR_BIU) && !(status & DCSR_STRTA))) {
242 if (status & DCSR_DONEA) {
243 /* give a chance for the interrupt to be processed */
244 ret = -EAGAIN;
245 goto out;
246 }
247 regs->DBSA = dma_ptr;
248 regs->DBTA = size;
249 regs->SetDCSR = DCSR_STRTA | DCSR_IE | DCSR_RUN;
250 DPRINTK("start a=%#x s=%d on A\n", dma_ptr, size);
251 } else {
252 if (status & DCSR_DONEB) {
253 /* give a chance for the interrupt to be processed */
254 ret = -EAGAIN;
255 goto out;
256 }
257 regs->DBSB = dma_ptr;
258 regs->DBTB = size;
259 regs->SetDCSR = DCSR_STRTB | DCSR_IE | DCSR_RUN;
260 DPRINTK("start a=%#x s=%d on B\n", dma_ptr, size);
261 }
262 ret = 0;
263
264out:
265 local_irq_restore(flags);
266 return ret;
267}
268
269
270/**
271 * sa1100_get_dma_pos - return current DMA position
272 * @regs: identifier for the channel to use
273 *
274 * This function returns the current physical (or bus) address for the
275 * given DMA channel. If the channel is running i.e. not in a stopped
276 * state then the caller must disable interrupts prior calling this
277 * function and process the returned value before re-enabling them to
278 * prevent races with the completion interrupt handler and the callback
279 * function. The validation of the returned value is the caller's
280 * responsibility as well -- the hardware seems to return out of range
281 * values when the DMA engine completes a buffer.
282 *
283 * The @regs identifier is provided by a successful call to
284 * sa1100_request_dma().
285 **/
286
287dma_addr_t sa1100_get_dma_pos(dma_regs_t *regs)
288{
289 int status;
290
291 /*
292 * We must determine whether buffer A or B is active.
293 * Two possibilities: either we are in the middle of
294 * a buffer, or the DMA controller just switched to the
295 * next toggle but the interrupt hasn't been serviced yet.
296 * The former case is straight forward. In the later case,
297 * we'll do like if DMA is just at the end of the previous
298 * toggle since all registers haven't been reset yet.
299 * This goes around the edge case and since we're always
300 * a little behind anyways it shouldn't make a big difference.
301 * If DMA has been stopped prior calling this then the
302 * position is exact.
303 */
304 status = regs->RdDCSR;
305 if ((!(status & DCSR_BIU) && (status & DCSR_STRTA)) ||
306 ( (status & DCSR_BIU) && !(status & DCSR_STRTB)))
307 return regs->DBSA;
308 else
309 return regs->DBSB;
310}
311
312
313/**
314 * sa1100_reset_dma - reset a DMA channel
315 * @regs: identifier for the channel to use
316 *
317 * This function resets and reconfigure the given DMA channel. This is
318 * particularly useful after a sleep/wakeup event.
319 *
320 * The @regs identifier is provided by a successful call to
321 * sa1100_request_dma().
322 **/
323
324void sa1100_reset_dma(dma_regs_t *regs)
325{
326 int i;
327
328 for (i = 0; i < SA1100_DMA_CHANNELS; i++)
329 if (regs == (dma_regs_t *)&DDAR(i))
330 break;
331 if (i >= SA1100_DMA_CHANNELS) {
332 printk(KERN_ERR "%s: bad DMA identifier\n", __func__);
333 return;
334 }
335
336 regs->ClrDCSR =
337 (DCSR_DONEA | DCSR_DONEB | DCSR_STRTA | DCSR_STRTB |
338 DCSR_IE | DCSR_ERROR | DCSR_RUN);
339 regs->DDAR = dma_chan[i].device;
340}
341
342
343EXPORT_SYMBOL(sa1100_request_dma);
344EXPORT_SYMBOL(sa1100_free_dma);
345EXPORT_SYMBOL(sa1100_start_dma);
346EXPORT_SYMBOL(sa1100_get_dma_pos);
347EXPORT_SYMBOL(sa1100_reset_dma);
348
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 7c1ebf4a7920..7c524b4e415d 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -14,17 +14,22 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/dma-mapping.h>
17#include <linux/pm.h> 18#include <linux/pm.h>
18#include <linux/cpufreq.h> 19#include <linux/cpufreq.h>
19#include <linux/ioport.h> 20#include <linux/ioport.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
21 22
23#include <video/sa1100fb.h>
24
22#include <asm/div64.h> 25#include <asm/div64.h>
23#include <mach/hardware.h>
24#include <asm/system.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/mach/flash.h> 27#include <asm/mach/flash.h>
27#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm/system_misc.h>
30
31#include <mach/hardware.h>
32#include <mach/irqs.h>
28 33
29#include "generic.h" 34#include "generic.h"
30 35
@@ -149,16 +154,8 @@ static void sa11x0_register_device(struct platform_device *dev, void *data)
149 154
150 155
151static struct resource sa11x0udc_resources[] = { 156static struct resource sa11x0udc_resources[] = {
152 [0] = { 157 [0] = DEFINE_RES_MEM(__PREG(Ser0UDCCR), SZ_64K),
153 .start = __PREG(Ser0UDCCR), 158 [1] = DEFINE_RES_IRQ(IRQ_Ser0UDC),
154 .end = __PREG(Ser0UDCCR) + 0xffff,
155 .flags = IORESOURCE_MEM,
156 },
157 [1] = {
158 .start = IRQ_Ser0UDC,
159 .end = IRQ_Ser0UDC,
160 .flags = IORESOURCE_IRQ,
161 },
162}; 159};
163 160
164static u64 sa11x0udc_dma_mask = 0xffffffffUL; 161static u64 sa11x0udc_dma_mask = 0xffffffffUL;
@@ -175,16 +172,8 @@ static struct platform_device sa11x0udc_device = {
175}; 172};
176 173
177static struct resource sa11x0uart1_resources[] = { 174static struct resource sa11x0uart1_resources[] = {
178 [0] = { 175 [0] = DEFINE_RES_MEM(__PREG(Ser1UTCR0), SZ_64K),
179 .start = __PREG(Ser1UTCR0), 176 [1] = DEFINE_RES_IRQ(IRQ_Ser1UART),
180 .end = __PREG(Ser1UTCR0) + 0xffff,
181 .flags = IORESOURCE_MEM,
182 },
183 [1] = {
184 .start = IRQ_Ser1UART,
185 .end = IRQ_Ser1UART,
186 .flags = IORESOURCE_IRQ,
187 },
188}; 177};
189 178
190static struct platform_device sa11x0uart1_device = { 179static struct platform_device sa11x0uart1_device = {
@@ -195,16 +184,8 @@ static struct platform_device sa11x0uart1_device = {
195}; 184};
196 185
197static struct resource sa11x0uart3_resources[] = { 186static struct resource sa11x0uart3_resources[] = {
198 [0] = { 187 [0] = DEFINE_RES_MEM(__PREG(Ser3UTCR0), SZ_64K),
199 .start = __PREG(Ser3UTCR0), 188 [1] = DEFINE_RES_IRQ(IRQ_Ser3UART),
200 .end = __PREG(Ser3UTCR0) + 0xffff,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = IRQ_Ser3UART,
205 .end = IRQ_Ser3UART,
206 .flags = IORESOURCE_IRQ,
207 },
208}; 189};
209 190
210static struct platform_device sa11x0uart3_device = { 191static struct platform_device sa11x0uart3_device = {
@@ -215,16 +196,9 @@ static struct platform_device sa11x0uart3_device = {
215}; 196};
216 197
217static struct resource sa11x0mcp_resources[] = { 198static struct resource sa11x0mcp_resources[] = {
218 [0] = { 199 [0] = DEFINE_RES_MEM(__PREG(Ser4MCCR0), SZ_64K),
219 .start = __PREG(Ser4MCCR0), 200 [1] = DEFINE_RES_MEM(__PREG(Ser4MCCR1), 4),
220 .end = __PREG(Ser4MCCR0) + 0xffff, 201 [2] = DEFINE_RES_IRQ(IRQ_Ser4MCP),
221 .flags = IORESOURCE_MEM,
222 },
223 [1] = {
224 .start = IRQ_Ser4MCP,
225 .end = IRQ_Ser4MCP,
226 .flags = IORESOURCE_IRQ,
227 },
228}; 202};
229 203
230static u64 sa11x0mcp_dma_mask = 0xffffffffUL; 204static u64 sa11x0mcp_dma_mask = 0xffffffffUL;
@@ -240,22 +214,24 @@ static struct platform_device sa11x0mcp_device = {
240 .resource = sa11x0mcp_resources, 214 .resource = sa11x0mcp_resources,
241}; 215};
242 216
217void __init sa11x0_ppc_configure_mcp(void)
218{
219 /* Setup the PPC unit for the MCP */
220 PPDR &= ~PPC_RXD4;
221 PPDR |= PPC_TXD4 | PPC_SCLK | PPC_SFRM;
222 PSDR |= PPC_RXD4;
223 PSDR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
224 PPSR &= ~(PPC_TXD4 | PPC_SCLK | PPC_SFRM);
225}
226
243void sa11x0_register_mcp(struct mcp_plat_data *data) 227void sa11x0_register_mcp(struct mcp_plat_data *data)
244{ 228{
245 sa11x0_register_device(&sa11x0mcp_device, data); 229 sa11x0_register_device(&sa11x0mcp_device, data);
246} 230}
247 231
248static struct resource sa11x0ssp_resources[] = { 232static struct resource sa11x0ssp_resources[] = {
249 [0] = { 233 [0] = DEFINE_RES_MEM(0x80070000, SZ_64K),
250 .start = 0x80070000, 234 [1] = DEFINE_RES_IRQ(IRQ_Ser4SSP),
251 .end = 0x8007ffff,
252 .flags = IORESOURCE_MEM,
253 },
254 [1] = {
255 .start = IRQ_Ser4SSP,
256 .end = IRQ_Ser4SSP,
257 .flags = IORESOURCE_IRQ,
258 },
259}; 235};
260 236
261static u64 sa11x0ssp_dma_mask = 0xffffffffUL; 237static u64 sa11x0ssp_dma_mask = 0xffffffffUL;
@@ -272,16 +248,8 @@ static struct platform_device sa11x0ssp_device = {
272}; 248};
273 249
274static struct resource sa11x0fb_resources[] = { 250static struct resource sa11x0fb_resources[] = {
275 [0] = { 251 [0] = DEFINE_RES_MEM(0xb0100000, SZ_64K),
276 .start = 0xb0100000, 252 [1] = DEFINE_RES_IRQ(IRQ_LCD),
277 .end = 0xb010ffff,
278 .flags = IORESOURCE_MEM,
279 },
280 [1] = {
281 .start = IRQ_LCD,
282 .end = IRQ_LCD,
283 .flags = IORESOURCE_IRQ,
284 },
285}; 253};
286 254
287static struct platform_device sa11x0fb_device = { 255static struct platform_device sa11x0fb_device = {
@@ -294,6 +262,11 @@ static struct platform_device sa11x0fb_device = {
294 .resource = sa11x0fb_resources, 262 .resource = sa11x0fb_resources,
295}; 263};
296 264
265void sa11x0_register_lcd(struct sa1100fb_mach_info *inf)
266{
267 sa11x0_register_device(&sa11x0fb_device, inf);
268}
269
297static struct platform_device sa11x0pcmcia_device = { 270static struct platform_device sa11x0pcmcia_device = {
298 .name = "sa11x0-pcmcia", 271 .name = "sa11x0-pcmcia",
299 .id = -1, 272 .id = -1,
@@ -314,23 +287,10 @@ void sa11x0_register_mtd(struct flash_platform_data *flash,
314} 287}
315 288
316static struct resource sa11x0ir_resources[] = { 289static struct resource sa11x0ir_resources[] = {
317 { 290 DEFINE_RES_MEM(__PREG(Ser2UTCR0), 0x24),
318 .start = __PREG(Ser2UTCR0), 291 DEFINE_RES_MEM(__PREG(Ser2HSCR0), 0x1c),
319 .end = __PREG(Ser2UTCR0) + 0x24 - 1, 292 DEFINE_RES_MEM(__PREG(Ser2HSCR2), 0x04),
320 .flags = IORESOURCE_MEM, 293 DEFINE_RES_IRQ(IRQ_Ser2ICP),
321 }, {
322 .start = __PREG(Ser2HSCR0),
323 .end = __PREG(Ser2HSCR0) + 0x1c - 1,
324 .flags = IORESOURCE_MEM,
325 }, {
326 .start = __PREG(Ser2HSCR2),
327 .end = __PREG(Ser2HSCR2) + 0x04 - 1,
328 .flags = IORESOURCE_MEM,
329 }, {
330 .start = IRQ_Ser2ICP,
331 .end = IRQ_Ser2ICP,
332 .flags = IORESOURCE_IRQ,
333 }
334}; 294};
335 295
336static struct platform_device sa11x0ir_device = { 296static struct platform_device sa11x0ir_device = {
@@ -358,14 +318,37 @@ static struct platform_device sa11x0rtc_device = {
358 .resource = sa1100_rtc_resources, 318 .resource = sa1100_rtc_resources,
359}; 319};
360 320
321static struct resource sa11x0dma_resources[] = {
322 DEFINE_RES_MEM(DMA_PHYS, DMA_SIZE),
323 DEFINE_RES_IRQ(IRQ_DMA0),
324 DEFINE_RES_IRQ(IRQ_DMA1),
325 DEFINE_RES_IRQ(IRQ_DMA2),
326 DEFINE_RES_IRQ(IRQ_DMA3),
327 DEFINE_RES_IRQ(IRQ_DMA4),
328 DEFINE_RES_IRQ(IRQ_DMA5),
329};
330
331static u64 sa11x0dma_dma_mask = DMA_BIT_MASK(32);
332
333static struct platform_device sa11x0dma_device = {
334 .name = "sa11x0-dma",
335 .id = -1,
336 .dev = {
337 .dma_mask = &sa11x0dma_dma_mask,
338 .coherent_dma_mask = 0xffffffff,
339 },
340 .num_resources = ARRAY_SIZE(sa11x0dma_resources),
341 .resource = sa11x0dma_resources,
342};
343
361static struct platform_device *sa11x0_devices[] __initdata = { 344static struct platform_device *sa11x0_devices[] __initdata = {
362 &sa11x0udc_device, 345 &sa11x0udc_device,
363 &sa11x0uart1_device, 346 &sa11x0uart1_device,
364 &sa11x0uart3_device, 347 &sa11x0uart3_device,
365 &sa11x0ssp_device, 348 &sa11x0ssp_device,
366 &sa11x0pcmcia_device, 349 &sa11x0pcmcia_device,
367 &sa11x0fb_device,
368 &sa11x0rtc_device, 350 &sa11x0rtc_device,
351 &sa11x0dma_device,
369}; 352};
370 353
371static int __init sa1100_init(void) 354static int __init sa1100_init(void)
@@ -376,12 +359,6 @@ static int __init sa1100_init(void)
376 359
377arch_initcall(sa1100_init); 360arch_initcall(sa1100_init);
378 361
379void (*sa1100fb_backlight_power)(int on);
380void (*sa1100fb_lcd_power)(int on);
381
382EXPORT_SYMBOL(sa1100fb_backlight_power);
383EXPORT_SYMBOL(sa1100fb_lcd_power);
384
385 362
386/* 363/*
387 * Common I/O mapping: 364 * Common I/O mapping:
@@ -436,7 +413,7 @@ void __init sa1100_map_io(void)
436 * the MBGNT signal false to ensure the SA1111 doesn't own the 413 * the MBGNT signal false to ensure the SA1111 doesn't own the
437 * SDRAM bus. 414 * SDRAM bus.
438 */ 415 */
439void __init sa1110_mb_disable(void) 416void sa1110_mb_disable(void)
440{ 417{
441 unsigned long flags; 418 unsigned long flags;
442 419
@@ -455,7 +432,7 @@ void __init sa1110_mb_disable(void)
455 * If the system is going to use the SA-1111 DMA engines, set up 432 * If the system is going to use the SA-1111 DMA engines, set up
456 * the memory bus request/grant pins. 433 * the memory bus request/grant pins.
457 */ 434 */
458void __devinit sa1110_mb_enable(void) 435void sa1110_mb_enable(void)
459{ 436{
460 unsigned long flags; 437 unsigned long flags;
461 438
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index 33268cf6be36..9eb3b3cd5a63 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -16,9 +16,6 @@ extern void sa11x0_restart(char, const char *);
16 mi->bank[__nr].start = (__start), \ 16 mi->bank[__nr].start = (__start), \
17 mi->bank[__nr].size = (__size) 17 mi->bank[__nr].size = (__size)
18 18
19extern void (*sa1100fb_backlight_power)(int on);
20extern void (*sa1100fb_lcd_power)(int on);
21
22extern void sa1110_mb_enable(void); 19extern void sa1110_mb_enable(void);
23extern void sa1110_mb_disable(void); 20extern void sa1110_mb_disable(void);
24 21
@@ -39,4 +36,8 @@ struct irda_platform_data;
39void sa11x0_register_irda(struct irda_platform_data *irda); 36void sa11x0_register_irda(struct irda_platform_data *irda);
40 37
41struct mcp_plat_data; 38struct mcp_plat_data;
39void sa11x0_ppc_configure_mcp(void);
42void sa11x0_register_mcp(struct mcp_plat_data *data); 40void sa11x0_register_mcp(struct mcp_plat_data *data);
41
42struct sa1100fb_mach_info;
43void sa11x0_register_lcd(struct sa1100fb_mach_info *inf);
diff --git a/arch/arm/mach-sa1100/h3100.c b/arch/arm/mach-sa1100/h3100.c
index 1e6b3c105ba6..b2e8d0f418e0 100644
--- a/arch/arm/mach-sa1100/h3100.c
+++ b/arch/arm/mach-sa1100/h3100.c
@@ -14,11 +14,14 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16 16
17#include <video/sa1100fb.h>
18
17#include <asm/mach-types.h> 19#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
19#include <asm/mach/irda.h> 21#include <asm/mach/irda.h>
20 22
21#include <mach/h3xxx.h> 23#include <mach/h3xxx.h>
24#include <mach/irqs.h>
22 25
23#include "generic.h" 26#include "generic.h"
24 27
@@ -36,13 +39,28 @@ static void h3100_lcd_power(int enable)
36 } 39 }
37} 40}
38 41
42static struct sa1100fb_mach_info h3100_lcd_info = {
43 .pixclock = 406977, .bpp = 4,
44 .xres = 320, .yres = 240,
45
46 .hsync_len = 26, .vsync_len = 41,
47 .left_margin = 4, .upper_margin = 0,
48 .right_margin = 4, .lower_margin = 0,
49
50 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
51 .cmap_greyscale = 1,
52 .cmap_inverse = 1,
53
54 .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas,
55 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
56
57 .lcd_power = h3100_lcd_power,
58};
39 59
40static void __init h3100_map_io(void) 60static void __init h3100_map_io(void)
41{ 61{
42 h3xxx_map_io(); 62 h3xxx_map_io();
43 63
44 sa1100fb_lcd_power = h3100_lcd_power;
45
46 /* Older bootldrs put GPIO2-9 in alternate mode on the 64 /* Older bootldrs put GPIO2-9 in alternate mode on the
47 assumption that they are used for video */ 65 assumption that they are used for video */
48 GAFR &= ~0x000001fb; 66 GAFR &= ~0x000001fb;
@@ -80,12 +98,15 @@ static void __init h3100_mach_init(void)
80{ 98{
81 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio)); 99 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
82 h3xxx_mach_init(); 100 h3xxx_mach_init();
101
102 sa11x0_register_lcd(&h3100_lcd_info);
83 sa11x0_register_irda(&h3100_irda_data); 103 sa11x0_register_irda(&h3100_irda_data);
84} 104}
85 105
86MACHINE_START(H3100, "Compaq iPAQ H3100") 106MACHINE_START(H3100, "Compaq iPAQ H3100")
87 .atag_offset = 0x100, 107 .atag_offset = 0x100,
88 .map_io = h3100_map_io, 108 .map_io = h3100_map_io,
109 .nr_irqs = SA1100_NR_IRQS,
89 .init_irq = sa1100_init_irq, 110 .init_irq = sa1100_init_irq,
90 .timer = &sa1100_timer, 111 .timer = &sa1100_timer,
91 .init_machine = h3100_mach_init, 112 .init_machine = h3100_mach_init,
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index 6b58e7460ecf..cb6659f294fe 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -14,11 +14,14 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/gpio.h> 15#include <linux/gpio.h>
16 16
17#include <video/sa1100fb.h>
18
17#include <asm/mach-types.h> 19#include <asm/mach-types.h>
18#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
19#include <asm/mach/irda.h> 21#include <asm/mach/irda.h>
20 22
21#include <mach/h3xxx.h> 23#include <mach/h3xxx.h>
24#include <mach/irqs.h>
22 25
23#include "generic.h" 26#include "generic.h"
24 27
@@ -56,11 +59,35 @@ err2: gpio_free(H3XXX_EGPIO_LCD_ON);
56err1: return; 59err1: return;
57} 60}
58 61
62static const struct sa1100fb_rgb h3600_rgb_16 = {
63 .red = { .offset = 12, .length = 4, },
64 .green = { .offset = 7, .length = 4, },
65 .blue = { .offset = 1, .length = 4, },
66 .transp = { .offset = 0, .length = 0, },
67};
68
69static struct sa1100fb_mach_info h3600_lcd_info = {
70 .pixclock = 174757, .bpp = 16,
71 .xres = 320, .yres = 240,
72
73 .hsync_len = 3, .vsync_len = 3,
74 .left_margin = 12, .upper_margin = 10,
75 .right_margin = 17, .lower_margin = 1,
76
77 .cmap_static = 1,
78
79 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
80 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
81
82 .rgb[RGB_16] = &h3600_rgb_16,
83
84 .lcd_power = h3600_lcd_power,
85};
86
87
59static void __init h3600_map_io(void) 88static void __init h3600_map_io(void)
60{ 89{
61 h3xxx_map_io(); 90 h3xxx_map_io();
62
63 sa1100fb_lcd_power = h3600_lcd_power;
64} 91}
65 92
66/* 93/*
@@ -121,12 +148,15 @@ static void __init h3600_mach_init(void)
121{ 148{
122 h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); 149 h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio));
123 h3xxx_mach_init(); 150 h3xxx_mach_init();
151
152 sa11x0_register_lcd(&h3600_lcd_info);
124 sa11x0_register_irda(&h3600_irda_data); 153 sa11x0_register_irda(&h3600_irda_data);
125} 154}
126 155
127MACHINE_START(H3600, "Compaq iPAQ H3600") 156MACHINE_START(H3600, "Compaq iPAQ H3600")
128 .atag_offset = 0x100, 157 .atag_offset = 0x100,
129 .map_io = h3600_map_io, 158 .map_io = h3600_map_io,
159 .nr_irqs = SA1100_NR_IRQS,
130 .init_irq = sa1100_init_irq, 160 .init_irq = sa1100_init_irq,
131 .timer = &sa1100_timer, 161 .timer = &sa1100_timer,
132 .init_machine = h3600_mach_init, 162 .init_machine = h3600_mach_init,
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
index b0784c974c2d..63150e1ffe9e 100644
--- a/arch/arm/mach-sa1100/h3xxx.c
+++ b/arch/arm/mach-sa1100/h3xxx.c
@@ -109,11 +109,8 @@ static struct flash_platform_data h3xxx_flash_data = {
109 .nr_parts = ARRAY_SIZE(h3xxx_partitions), 109 .nr_parts = ARRAY_SIZE(h3xxx_partitions),
110}; 110};
111 111
112static struct resource h3xxx_flash_resource = { 112static struct resource h3xxx_flash_resource =
113 .start = SA1100_CS0_PHYS, 113 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
114 .end = SA1100_CS0_PHYS + SZ_32M - 1,
115 .flags = IORESOURCE_MEM,
116};
117 114
118 115
119/* 116/*
@@ -186,11 +183,7 @@ static struct sa1100_port_fns h3xxx_port_fns __initdata = {
186 */ 183 */
187 184
188static struct resource egpio_resources[] = { 185static struct resource egpio_resources[] = {
189 [0] = { 186 [0] = DEFINE_RES_MEM(H3600_EGPIO_PHYS, 0x4),
190 .start = H3600_EGPIO_PHYS,
191 .end = H3600_EGPIO_PHYS + 0x4 - 1,
192 .flags = IORESOURCE_MEM,
193 },
194}; 187};
195 188
196static struct htc_egpio_chip egpio_chips[] = { 189static struct htc_egpio_chip egpio_chips[] = {
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index c01bb36db940..5535475bf583 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -22,12 +22,10 @@
22#include <linux/mtd/mtd.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24 24
25#include <mach/hardware.h>
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
27#include <asm/setup.h> 26#include <asm/setup.h>
28#include <asm/page.h> 27#include <asm/page.h>
29#include <asm/pgtable.h> 28#include <asm/pgtable.h>
30#include <asm/irq.h>
31 29
32#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
33#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
@@ -35,6 +33,9 @@
35#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
36#include <asm/mach/serial_sa1100.h> 34#include <asm/mach/serial_sa1100.h>
37 35
36#include <mach/hardware.h>
37#include <mach/irqs.h>
38
38#include "generic.h" 39#include "generic.h"
39 40
40/********************************************************************** 41/**********************************************************************
@@ -179,11 +180,8 @@ static struct flash_platform_data hackkit_flash_data = {
179 .nr_parts = ARRAY_SIZE(hackkit_partitions), 180 .nr_parts = ARRAY_SIZE(hackkit_partitions),
180}; 181};
181 182
182static struct resource hackkit_flash_resource = { 183static struct resource hackkit_flash_resource =
183 .start = SA1100_CS0_PHYS, 184 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
184 .end = SA1100_CS0_PHYS + SZ_32M,
185 .flags = IORESOURCE_MEM,
186};
187 185
188static void __init hackkit_init(void) 186static void __init hackkit_init(void)
189{ 187{
@@ -197,6 +195,7 @@ static void __init hackkit_init(void)
197MACHINE_START(HACKKIT, "HackKit Cpu Board") 195MACHINE_START(HACKKIT, "HackKit Cpu Board")
198 .atag_offset = 0x100, 196 .atag_offset = 0x100,
199 .map_io = hackkit_map_io, 197 .map_io = hackkit_map_io,
198 .nr_irqs = SA1100_NR_IRQS,
200 .init_irq = sa1100_init_irq, 199 .init_irq = sa1100_init_irq,
201 .timer = &sa1100_timer, 200 .timer = &sa1100_timer,
202 .init_machine = hackkit_init, 201 .init_machine = hackkit_init,
diff --git a/arch/arm/mach-sa1100/include/mach/SA-1100.h b/arch/arm/mach-sa1100/include/mach/SA-1100.h
index bae8296f5dbf..3f2d1b60188c 100644
--- a/arch/arm/mach-sa1100/include/mach/SA-1100.h
+++ b/arch/arm/mach-sa1100/include/mach/SA-1100.h
@@ -1590,224 +1590,9 @@
1590 1590
1591/* 1591/*
1592 * Direct Memory Access (DMA) control registers 1592 * Direct Memory Access (DMA) control registers
1593 *
1594 * Registers
1595 * DDAR0 Direct Memory Access (DMA) Device Address Register
1596 * channel 0 (read/write).
1597 * DCSR0 Direct Memory Access (DMA) Control and Status
1598 * Register channel 0 (read/write).
1599 * DBSA0 Direct Memory Access (DMA) Buffer Start address
1600 * register A channel 0 (read/write).
1601 * DBTA0 Direct Memory Access (DMA) Buffer Transfer count
1602 * register A channel 0 (read/write).
1603 * DBSB0 Direct Memory Access (DMA) Buffer Start address
1604 * register B channel 0 (read/write).
1605 * DBTB0 Direct Memory Access (DMA) Buffer Transfer count
1606 * register B channel 0 (read/write).
1607 *
1608 * DDAR1 Direct Memory Access (DMA) Device Address Register
1609 * channel 1 (read/write).
1610 * DCSR1 Direct Memory Access (DMA) Control and Status
1611 * Register channel 1 (read/write).
1612 * DBSA1 Direct Memory Access (DMA) Buffer Start address
1613 * register A channel 1 (read/write).
1614 * DBTA1 Direct Memory Access (DMA) Buffer Transfer count
1615 * register A channel 1 (read/write).
1616 * DBSB1 Direct Memory Access (DMA) Buffer Start address
1617 * register B channel 1 (read/write).
1618 * DBTB1 Direct Memory Access (DMA) Buffer Transfer count
1619 * register B channel 1 (read/write).
1620 *
1621 * DDAR2 Direct Memory Access (DMA) Device Address Register
1622 * channel 2 (read/write).
1623 * DCSR2 Direct Memory Access (DMA) Control and Status
1624 * Register channel 2 (read/write).
1625 * DBSA2 Direct Memory Access (DMA) Buffer Start address
1626 * register A channel 2 (read/write).
1627 * DBTA2 Direct Memory Access (DMA) Buffer Transfer count
1628 * register A channel 2 (read/write).
1629 * DBSB2 Direct Memory Access (DMA) Buffer Start address
1630 * register B channel 2 (read/write).
1631 * DBTB2 Direct Memory Access (DMA) Buffer Transfer count
1632 * register B channel 2 (read/write).
1633 *
1634 * DDAR3 Direct Memory Access (DMA) Device Address Register
1635 * channel 3 (read/write).
1636 * DCSR3 Direct Memory Access (DMA) Control and Status
1637 * Register channel 3 (read/write).
1638 * DBSA3 Direct Memory Access (DMA) Buffer Start address
1639 * register A channel 3 (read/write).
1640 * DBTA3 Direct Memory Access (DMA) Buffer Transfer count
1641 * register A channel 3 (read/write).
1642 * DBSB3 Direct Memory Access (DMA) Buffer Start address
1643 * register B channel 3 (read/write).
1644 * DBTB3 Direct Memory Access (DMA) Buffer Transfer count
1645 * register B channel 3 (read/write).
1646 *
1647 * DDAR4 Direct Memory Access (DMA) Device Address Register
1648 * channel 4 (read/write).
1649 * DCSR4 Direct Memory Access (DMA) Control and Status
1650 * Register channel 4 (read/write).
1651 * DBSA4 Direct Memory Access (DMA) Buffer Start address
1652 * register A channel 4 (read/write).
1653 * DBTA4 Direct Memory Access (DMA) Buffer Transfer count
1654 * register A channel 4 (read/write).
1655 * DBSB4 Direct Memory Access (DMA) Buffer Start address
1656 * register B channel 4 (read/write).
1657 * DBTB4 Direct Memory Access (DMA) Buffer Transfer count
1658 * register B channel 4 (read/write).
1659 *
1660 * DDAR5 Direct Memory Access (DMA) Device Address Register
1661 * channel 5 (read/write).
1662 * DCSR5 Direct Memory Access (DMA) Control and Status
1663 * Register channel 5 (read/write).
1664 * DBSA5 Direct Memory Access (DMA) Buffer Start address
1665 * register A channel 5 (read/write).
1666 * DBTA5 Direct Memory Access (DMA) Buffer Transfer count
1667 * register A channel 5 (read/write).
1668 * DBSB5 Direct Memory Access (DMA) Buffer Start address
1669 * register B channel 5 (read/write).
1670 * DBTB5 Direct Memory Access (DMA) Buffer Transfer count
1671 * register B channel 5 (read/write).
1672 */ 1593 */
1673 1594#define DMA_SIZE (6 * 0x20)
1674#define DMASp 0x00000020 /* DMA control reg. Space [byte] */ 1595#define DMA_PHYS 0xb0000000
1675
1676#define DDAR(Nb) __REG(0xB0000000 + (Nb)*DMASp) /* DMA Device Address Reg. channel [0..5] */
1677#define SetDCSR(Nb) __REG(0xB0000004 + (Nb)*DMASp) /* Set DMA Control & Status Reg. channel [0..5] (write) */
1678#define ClrDCSR(Nb) __REG(0xB0000008 + (Nb)*DMASp) /* Clear DMA Control & Status Reg. channel [0..5] (write) */
1679#define RdDCSR(Nb) __REG(0xB000000C + (Nb)*DMASp) /* Read DMA Control & Status Reg. channel [0..5] (read) */
1680#define DBSA(Nb) __REG(0xB0000010 + (Nb)*DMASp) /* DMA Buffer Start address reg. A channel [0..5] */
1681#define DBTA(Nb) __REG(0xB0000014 + (Nb)*DMASp) /* DMA Buffer Transfer count reg. A channel [0..5] */
1682#define DBSB(Nb) __REG(0xB0000018 + (Nb)*DMASp) /* DMA Buffer Start address reg. B channel [0..5] */
1683#define DBTB(Nb) __REG(0xB000001C + (Nb)*DMASp) /* DMA Buffer Transfer count reg. B channel [0..5] */
1684
1685#define DDAR_RW 0x00000001 /* device data Read/Write */
1686#define DDAR_DevWr (DDAR_RW*0) /* Device data Write */
1687 /* (memory -> device) */
1688#define DDAR_DevRd (DDAR_RW*1) /* Device data Read */
1689 /* (device -> memory) */
1690#define DDAR_E 0x00000002 /* big/little Endian device */
1691#define DDAR_LtlEnd (DDAR_E*0) /* Little Endian device */
1692#define DDAR_BigEnd (DDAR_E*1) /* Big Endian device */
1693#define DDAR_BS 0x00000004 /* device Burst Size */
1694#define DDAR_Brst4 (DDAR_BS*0) /* Burst-of-4 device */
1695#define DDAR_Brst8 (DDAR_BS*1) /* Burst-of-8 device */
1696#define DDAR_DW 0x00000008 /* device Data Width */
1697#define DDAR_8BitDev (DDAR_DW*0) /* 8-Bit Device */
1698#define DDAR_16BitDev (DDAR_DW*1) /* 16-Bit Device */
1699#define DDAR_DS Fld (4, 4) /* Device Select */
1700#define DDAR_Ser0UDCTr /* Ser. port 0 UDC Transmit */ \
1701 (0x0 << FShft (DDAR_DS))
1702#define DDAR_Ser0UDCRc /* Ser. port 0 UDC Receive */ \
1703 (0x1 << FShft (DDAR_DS))
1704#define DDAR_Ser1SDLCTr /* Ser. port 1 SDLC Transmit */ \
1705 (0x2 << FShft (DDAR_DS))
1706#define DDAR_Ser1SDLCRc /* Ser. port 1 SDLC Receive */ \
1707 (0x3 << FShft (DDAR_DS))
1708#define DDAR_Ser1UARTTr /* Ser. port 1 UART Transmit */ \
1709 (0x4 << FShft (DDAR_DS))
1710#define DDAR_Ser1UARTRc /* Ser. port 1 UART Receive */ \
1711 (0x5 << FShft (DDAR_DS))
1712#define DDAR_Ser2ICPTr /* Ser. port 2 ICP Transmit */ \
1713 (0x6 << FShft (DDAR_DS))
1714#define DDAR_Ser2ICPRc /* Ser. port 2 ICP Receive */ \
1715 (0x7 << FShft (DDAR_DS))
1716#define DDAR_Ser3UARTTr /* Ser. port 3 UART Transmit */ \
1717 (0x8 << FShft (DDAR_DS))
1718#define DDAR_Ser3UARTRc /* Ser. port 3 UART Receive */ \
1719 (0x9 << FShft (DDAR_DS))
1720#define DDAR_Ser4MCP0Tr /* Ser. port 4 MCP 0 Transmit */ \
1721 /* (audio) */ \
1722 (0xA << FShft (DDAR_DS))
1723#define DDAR_Ser4MCP0Rc /* Ser. port 4 MCP 0 Receive */ \
1724 /* (audio) */ \
1725 (0xB << FShft (DDAR_DS))
1726#define DDAR_Ser4MCP1Tr /* Ser. port 4 MCP 1 Transmit */ \
1727 /* (telecom) */ \
1728 (0xC << FShft (DDAR_DS))
1729#define DDAR_Ser4MCP1Rc /* Ser. port 4 MCP 1 Receive */ \
1730 /* (telecom) */ \
1731 (0xD << FShft (DDAR_DS))
1732#define DDAR_Ser4SSPTr /* Ser. port 4 SSP Transmit */ \
1733 (0xE << FShft (DDAR_DS))
1734#define DDAR_Ser4SSPRc /* Ser. port 4 SSP Receive */ \
1735 (0xF << FShft (DDAR_DS))
1736#define DDAR_DA Fld (24, 8) /* Device Address */
1737#define DDAR_DevAdd(Add) /* Device Address */ \
1738 (((Add) & 0xF0000000) | \
1739 (((Add) & 0X003FFFFC) << (FShft (DDAR_DA) - 2)))
1740#define DDAR_Ser0UDCWr /* Ser. port 0 UDC Write */ \
1741 (DDAR_DevWr + DDAR_Brst8 + DDAR_8BitDev + \
1742 DDAR_Ser0UDCTr + DDAR_DevAdd (__PREG(Ser0UDCDR)))
1743#define DDAR_Ser0UDCRd /* Ser. port 0 UDC Read */ \
1744 (DDAR_DevRd + DDAR_Brst8 + DDAR_8BitDev + \
1745 DDAR_Ser0UDCRc + DDAR_DevAdd (__PREG(Ser0UDCDR)))
1746#define DDAR_Ser1UARTWr /* Ser. port 1 UART Write */ \
1747 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1748 DDAR_Ser1UARTTr + DDAR_DevAdd (__PREG(Ser1UTDR)))
1749#define DDAR_Ser1UARTRd /* Ser. port 1 UART Read */ \
1750 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1751 DDAR_Ser1UARTRc + DDAR_DevAdd (__PREG(Ser1UTDR)))
1752#define DDAR_Ser1SDLCWr /* Ser. port 1 SDLC Write */ \
1753 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1754 DDAR_Ser1SDLCTr + DDAR_DevAdd (__PREG(Ser1SDDR)))
1755#define DDAR_Ser1SDLCRd /* Ser. port 1 SDLC Read */ \
1756 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1757 DDAR_Ser1SDLCRc + DDAR_DevAdd (__PREG(Ser1SDDR)))
1758#define DDAR_Ser2UARTWr /* Ser. port 2 UART Write */ \
1759 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1760 DDAR_Ser2ICPTr + DDAR_DevAdd (__PREG(Ser2UTDR)))
1761#define DDAR_Ser2UARTRd /* Ser. port 2 UART Read */ \
1762 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1763 DDAR_Ser2ICPRc + DDAR_DevAdd (__PREG(Ser2UTDR)))
1764#define DDAR_Ser2HSSPWr /* Ser. port 2 HSSP Write */ \
1765 (DDAR_DevWr + DDAR_Brst8 + DDAR_8BitDev + \
1766 DDAR_Ser2ICPTr + DDAR_DevAdd (__PREG(Ser2HSDR)))
1767#define DDAR_Ser2HSSPRd /* Ser. port 2 HSSP Read */ \
1768 (DDAR_DevRd + DDAR_Brst8 + DDAR_8BitDev + \
1769 DDAR_Ser2ICPRc + DDAR_DevAdd (__PREG(Ser2HSDR)))
1770#define DDAR_Ser3UARTWr /* Ser. port 3 UART Write */ \
1771 (DDAR_DevWr + DDAR_Brst4 + DDAR_8BitDev + \
1772 DDAR_Ser3UARTTr + DDAR_DevAdd (__PREG(Ser3UTDR)))
1773#define DDAR_Ser3UARTRd /* Ser. port 3 UART Read */ \
1774 (DDAR_DevRd + DDAR_Brst4 + DDAR_8BitDev + \
1775 DDAR_Ser3UARTRc + DDAR_DevAdd (__PREG(Ser3UTDR)))
1776#define DDAR_Ser4MCP0Wr /* Ser. port 4 MCP 0 Write (audio) */ \
1777 (DDAR_DevWr + DDAR_Brst4 + DDAR_16BitDev + \
1778 DDAR_Ser4MCP0Tr + DDAR_DevAdd (__PREG(Ser4MCDR0)))
1779#define DDAR_Ser4MCP0Rd /* Ser. port 4 MCP 0 Read (audio) */ \
1780 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1781 DDAR_Ser4MCP0Rc + DDAR_DevAdd (__PREG(Ser4MCDR0)))
1782#define DDAR_Ser4MCP1Wr /* Ser. port 4 MCP 1 Write */ \
1783 /* (telecom) */ \
1784 (DDAR_DevWr + DDAR_Brst4 + DDAR_16BitDev + \
1785 DDAR_Ser4MCP1Tr + DDAR_DevAdd (__PREG(Ser4MCDR1)))
1786#define DDAR_Ser4MCP1Rd /* Ser. port 4 MCP 1 Read */ \
1787 /* (telecom) */ \
1788 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1789 DDAR_Ser4MCP1Rc + DDAR_DevAdd (__PREG(Ser4MCDR1)))
1790#define DDAR_Ser4SSPWr /* Ser. port 4 SSP Write (16 bits) */ \
1791 (DDAR_DevWr + DDAR_Brst4 + DDAR_16BitDev + \
1792 DDAR_Ser4SSPTr + DDAR_DevAdd (__PREG(Ser4SSDR)))
1793#define DDAR_Ser4SSPRd /* Ser. port 4 SSP Read (16 bits) */ \
1794 (DDAR_DevRd + DDAR_Brst4 + DDAR_16BitDev + \
1795 DDAR_Ser4SSPRc + DDAR_DevAdd (__PREG(Ser4SSDR)))
1796
1797#define DCSR_RUN 0x00000001 /* DMA running */
1798#define DCSR_IE 0x00000002 /* DMA Interrupt Enable */
1799#define DCSR_ERROR 0x00000004 /* DMA ERROR */
1800#define DCSR_DONEA 0x00000008 /* DONE DMA transfer buffer A */
1801#define DCSR_STRTA 0x00000010 /* STaRTed DMA transfer buffer A */
1802#define DCSR_DONEB 0x00000020 /* DONE DMA transfer buffer B */
1803#define DCSR_STRTB 0x00000040 /* STaRTed DMA transfer buffer B */
1804#define DCSR_BIU 0x00000080 /* DMA Buffer In Use */
1805#define DCSR_BufA (DCSR_BIU*0) /* DMA Buffer A in use */
1806#define DCSR_BufB (DCSR_BIU*1) /* DMA Buffer B in use */
1807
1808#define DBT_TC Fld (13, 0) /* Transfer Count */
1809#define DBTA_TCA DBT_TC /* Transfer Count buffer A */
1810#define DBTB_TCB DBT_TC /* Transfer Count buffer B */
1811 1596
1812 1597
1813/* 1598/*
@@ -1903,16 +1688,6 @@
1903#define LCD_Int100_0A 0xF /* LCD Intensity = 100.0% = 1 */ 1688#define LCD_Int100_0A 0xF /* LCD Intensity = 100.0% = 1 */
1904 /* (Alternative) */ 1689 /* (Alternative) */
1905 1690
1906#define LCCR0 __REG(0xB0100000) /* LCD Control Reg. 0 */
1907#define LCSR __REG(0xB0100004) /* LCD Status Reg. */
1908#define DBAR1 __REG(0xB0100010) /* LCD DMA Base Address Reg. channel 1 */
1909#define DCAR1 __REG(0xB0100014) /* LCD DMA Current Address Reg. channel 1 */
1910#define DBAR2 __REG(0xB0100018) /* LCD DMA Base Address Reg. channel 2 */
1911#define DCAR2 __REG(0xB010001C) /* LCD DMA Current Address Reg. channel 2 */
1912#define LCCR1 __REG(0xB0100020) /* LCD Control Reg. 1 */
1913#define LCCR2 __REG(0xB0100024) /* LCD Control Reg. 2 */
1914#define LCCR3 __REG(0xB0100028) /* LCD Control Reg. 3 */
1915
1916#define LCCR0_LEN 0x00000001 /* LCD ENable */ 1691#define LCCR0_LEN 0x00000001 /* LCD ENable */
1917#define LCCR0_CMS 0x00000002 /* Color/Monochrome display Select */ 1692#define LCCR0_CMS 0x00000002 /* Color/Monochrome display Select */
1918#define LCCR0_Color (LCCR0_CMS*0) /* Color display */ 1693#define LCCR0_Color (LCCR0_CMS*0) /* Color display */
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h
index 52acda7061b7..f33679d2d3ee 100644
--- a/arch/arm/mach-sa1100/include/mach/collie.h
+++ b/arch/arm/mach-sa1100/include/mach/collie.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/arm/mach-sa1100/include/mach/collie.h 2 * arch/arm/mach-sa1100/include/mach/collie.h
3 * 3 *
4 * This file contains the hardware specific definitions for Assabet 4 * This file contains the hardware specific definitions for Collie
5 * Only include this file from SA1100-specific files. 5 * Only include this file from SA1100-specific files.
6 * 6 *
7 * ChangeLog: 7 * ChangeLog:
@@ -13,6 +13,7 @@
13#ifndef __ASM_ARCH_COLLIE_H 13#ifndef __ASM_ARCH_COLLIE_H
14#define __ASM_ARCH_COLLIE_H 14#define __ASM_ARCH_COLLIE_H
15 15
16extern void locomolcd_power(int on);
16 17
17#define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1) 18#define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1)
18#define COLLIE_GPIO_CHARGE_ON (COLLIE_SCOOP_GPIO_BASE + 0) 19#define COLLIE_GPIO_CHARGE_ON (COLLIE_SCOOP_GPIO_BASE + 0)
diff --git a/arch/arm/mach-sa1100/include/mach/dma.h b/arch/arm/mach-sa1100/include/mach/dma.h
deleted file mode 100644
index dda1b351310d..000000000000
--- a/arch/arm/mach-sa1100/include/mach/dma.h
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/dma.h
3 *
4 * Generic SA1100 DMA support
5 *
6 * Copyright (C) 2000 Nicolas Pitre
7 *
8 */
9
10#ifndef __ASM_ARCH_DMA_H
11#define __ASM_ARCH_DMA_H
12
13#include "hardware.h"
14
15
16/*
17 * The SA1100 has six internal DMA channels.
18 */
19#define SA1100_DMA_CHANNELS 6
20
21/*
22 * Maximum physical DMA buffer size
23 */
24#define MAX_DMA_SIZE 0x1fff
25#define CUT_DMA_SIZE 0x1000
26
27/*
28 * All possible SA1100 devices a DMA channel can be attached to.
29 */
30typedef enum {
31 DMA_Ser0UDCWr = DDAR_Ser0UDCWr, /* Ser. port 0 UDC Write */
32 DMA_Ser0UDCRd = DDAR_Ser0UDCRd, /* Ser. port 0 UDC Read */
33 DMA_Ser1UARTWr = DDAR_Ser1UARTWr, /* Ser. port 1 UART Write */
34 DMA_Ser1UARTRd = DDAR_Ser1UARTRd, /* Ser. port 1 UART Read */
35 DMA_Ser1SDLCWr = DDAR_Ser1SDLCWr, /* Ser. port 1 SDLC Write */
36 DMA_Ser1SDLCRd = DDAR_Ser1SDLCRd, /* Ser. port 1 SDLC Read */
37 DMA_Ser2UARTWr = DDAR_Ser2UARTWr, /* Ser. port 2 UART Write */
38 DMA_Ser2UARTRd = DDAR_Ser2UARTRd, /* Ser. port 2 UART Read */
39 DMA_Ser2HSSPWr = DDAR_Ser2HSSPWr, /* Ser. port 2 HSSP Write */
40 DMA_Ser2HSSPRd = DDAR_Ser2HSSPRd, /* Ser. port 2 HSSP Read */
41 DMA_Ser3UARTWr = DDAR_Ser3UARTWr, /* Ser. port 3 UART Write */
42 DMA_Ser3UARTRd = DDAR_Ser3UARTRd, /* Ser. port 3 UART Read */
43 DMA_Ser4MCP0Wr = DDAR_Ser4MCP0Wr, /* Ser. port 4 MCP 0 Write (audio) */
44 DMA_Ser4MCP0Rd = DDAR_Ser4MCP0Rd, /* Ser. port 4 MCP 0 Read (audio) */
45 DMA_Ser4MCP1Wr = DDAR_Ser4MCP1Wr, /* Ser. port 4 MCP 1 Write */
46 DMA_Ser4MCP1Rd = DDAR_Ser4MCP1Rd, /* Ser. port 4 MCP 1 Read */
47 DMA_Ser4SSPWr = DDAR_Ser4SSPWr, /* Ser. port 4 SSP Write (16 bits) */
48 DMA_Ser4SSPRd = DDAR_Ser4SSPRd /* Ser. port 4 SSP Read (16 bits) */
49} dma_device_t;
50
51typedef struct {
52 volatile u_long DDAR;
53 volatile u_long SetDCSR;
54 volatile u_long ClrDCSR;
55 volatile u_long RdDCSR;
56 volatile dma_addr_t DBSA;
57 volatile u_long DBTA;
58 volatile dma_addr_t DBSB;
59 volatile u_long DBTB;
60} dma_regs_t;
61
62typedef void (*dma_callback_t)(void *data);
63
64/*
65 * DMA function prototypes
66 */
67
68extern int sa1100_request_dma( dma_device_t device, const char *device_id,
69 dma_callback_t callback, void *data,
70 dma_regs_t **regs );
71extern void sa1100_free_dma( dma_regs_t *regs );
72extern int sa1100_start_dma( dma_regs_t *regs, dma_addr_t dma_ptr, u_int size );
73extern dma_addr_t sa1100_get_dma_pos(dma_regs_t *regs);
74extern void sa1100_reset_dma(dma_regs_t *regs);
75
76/**
77 * sa1100_stop_dma - stop DMA in progress
78 * @regs: identifier for the channel to use
79 *
80 * This stops DMA without clearing buffer pointers. Unlike
81 * sa1100_clear_dma() this allows subsequent use of sa1100_resume_dma()
82 * or sa1100_get_dma_pos().
83 *
84 * The @regs identifier is provided by a successful call to
85 * sa1100_request_dma().
86 **/
87
88#define sa1100_stop_dma(regs) ((regs)->ClrDCSR = DCSR_IE|DCSR_RUN)
89
90/**
91 * sa1100_resume_dma - resume DMA on a stopped channel
92 * @regs: identifier for the channel to use
93 *
94 * This resumes DMA on a channel previously stopped with
95 * sa1100_stop_dma().
96 *
97 * The @regs identifier is provided by a successful call to
98 * sa1100_request_dma().
99 **/
100
101#define sa1100_resume_dma(regs) ((regs)->SetDCSR = DCSR_IE|DCSR_RUN)
102
103/**
104 * sa1100_clear_dma - clear DMA pointers
105 * @regs: identifier for the channel to use
106 *
107 * This clear any DMA state so the DMA engine is ready to restart
108 * with new buffers through sa1100_start_dma(). Any buffers in flight
109 * are discarded.
110 *
111 * The @regs identifier is provided by a successful call to
112 * sa1100_request_dma().
113 **/
114
115#define sa1100_clear_dma(regs) ((regs)->ClrDCSR = DCSR_IE|DCSR_RUN|DCSR_STRTA|DCSR_STRTB)
116
117#endif /* _ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h
deleted file mode 100644
index dfc27ff08344..000000000000
--- a/arch/arm/mach-sa1100/include/mach/io.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/mach-sa1100/include/mach/io.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * Modifications:
7 * 06-12-1997 RMK Created.
8 * 07-04-1999 RMK Major cleanup
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13/*
14 * __io() is required to be an equivalent mapping to __mem_pci() for
15 * SOC_COMMON to work.
16 */
17#define __io(a) __typesafe_io(a)
18#define __mem_pci(a) (a)
19
20#endif
diff --git a/arch/arm/mach-sa1100/include/mach/irqs.h b/arch/arm/mach-sa1100/include/mach/irqs.h
index d18f21abef80..3790298b7142 100644
--- a/arch/arm/mach-sa1100/include/mach/irqs.h
+++ b/arch/arm/mach-sa1100/include/mach/irqs.h
@@ -71,22 +71,19 @@
71/* 71/*
72 * Figure out the MAX IRQ number. 72 * Figure out the MAX IRQ number.
73 * 73 *
74 * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1. 74 * Neponset, SA1111 and UCB1x00 are sparse IRQ aware, so can dynamically
75 * If we have an LoCoMo, the max IRQ is IRQ_BOARD_START + 4 75 * allocate their IRQs above NR_IRQS.
76 * Otherwise, we have the standard IRQs only. 76 *
77 * LoCoMo has 4 additional IRQs, but is not sparse IRQ aware, and so has
78 * to be included in the NR_IRQS calculation.
77 */ 79 */
78#ifdef CONFIG_SA1111 80#ifdef CONFIG_SHARP_LOCOMO
79#define NR_IRQS (IRQ_BOARD_END + 55) 81#define NR_IRQS_LOCOMO 4
80#elif defined(CONFIG_SHARP_LOCOMO)
81#define NR_IRQS (IRQ_BOARD_START + 4)
82#else 82#else
83#define NR_IRQS (IRQ_BOARD_START) 83#define NR_IRQS_LOCOMO 0
84#endif 84#endif
85 85
86/* 86#ifndef NR_IRQS
87 * Board specific IRQs. Define them here. 87#define NR_IRQS (IRQ_BOARD_START + NR_IRQS_LOCOMO)
88 * Do not surround them with ifdefs. 88#endif
89 */ 89#define SA1100_NR_IRQS (IRQ_BOARD_START + NR_IRQS_LOCOMO)
90#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0)
91#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1)
92#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2)
diff --git a/arch/arm/mach-sa1100/include/mach/mcp.h b/arch/arm/mach-sa1100/include/mach/mcp.h
index ed1a331508a7..4b2860ae3828 100644
--- a/arch/arm/mach-sa1100/include/mach/mcp.h
+++ b/arch/arm/mach-sa1100/include/mach/mcp.h
@@ -16,7 +16,7 @@ struct mcp_plat_data {
16 u32 mccr0; 16 u32 mccr0;
17 u32 mccr1; 17 u32 mccr1;
18 unsigned int sclk_rate; 18 unsigned int sclk_rate;
19 int gpio_base; 19 void *codec_pdata;
20}; 20};
21 21
22#endif 22#endif
diff --git a/arch/arm/mach-sa1100/include/mach/neponset.h b/arch/arm/mach-sa1100/include/mach/neponset.h
index ffe2bc45eed0..5516a52a329d 100644
--- a/arch/arm/mach-sa1100/include/mach/neponset.h
+++ b/arch/arm/mach-sa1100/include/mach/neponset.h
@@ -15,54 +15,6 @@
15/* 15/*
16 * Neponset definitions: 16 * Neponset definitions:
17 */ 17 */
18
19#define NEPONSET_CPLD_BASE (0x10000000)
20#define Nep_p2v( x ) ((x) - NEPONSET_CPLD_BASE + 0xf3000000)
21#define Nep_v2p( x ) ((x) - 0xf3000000 + NEPONSET_CPLD_BASE)
22
23#define _IRR 0x10000024 /* Interrupt Reason Register */
24#define _AUD_CTL 0x100000c0 /* Audio controls (RW) */
25#define _MDM_CTL_0 0x100000b0 /* Modem control 0 (RW) */
26#define _MDM_CTL_1 0x100000b4 /* Modem control 1 (RW) */
27#define _NCR_0 0x100000a0 /* Control Register (RW) */
28#define _KP_X_OUT 0x10000090 /* Keypad row write (RW) */
29#define _KP_Y_IN 0x10000080 /* Keypad column read (RO) */
30#define _SWPK 0x10000020 /* Switch pack (RO) */
31#define _WHOAMI 0x10000000 /* System ID Register (RO) */
32
33#define _LEDS 0x10000010 /* LEDs [31:0] (WO) */
34
35#define IRR (*((volatile u_char *) Nep_p2v(_IRR)))
36#define AUD_CTL (*((volatile u_char *) Nep_p2v(_AUD_CTL)))
37#define MDM_CTL_0 (*((volatile u_char *) Nep_p2v(_MDM_CTL_0)))
38#define MDM_CTL_1 (*((volatile u_char *) Nep_p2v(_MDM_CTL_1)))
39#define NCR_0 (*((volatile u_char *) Nep_p2v(_NCR_0)))
40#define KP_X_OUT (*((volatile u_char *) Nep_p2v(_KP_X_OUT)))
41#define KP_Y_IN (*((volatile u_char *) Nep_p2v(_KP_Y_IN)))
42#define SWPK (*((volatile u_char *) Nep_p2v(_SWPK)))
43#define WHOAMI (*((volatile u_char *) Nep_p2v(_WHOAMI)))
44
45#define LEDS (*((volatile Word *) Nep_p2v(_LEDS)))
46
47#define IRR_ETHERNET (1<<0)
48#define IRR_USAR (1<<1)
49#define IRR_SA1111 (1<<2)
50
51#define AUD_SEL_1341 (1<<0)
52#define AUD_MUTE_1341 (1<<1)
53
54#define MDM_CTL0_RTS1 (1 << 0)
55#define MDM_CTL0_DTR1 (1 << 1)
56#define MDM_CTL0_RTS2 (1 << 2)
57#define MDM_CTL0_DTR2 (1 << 3)
58
59#define MDM_CTL1_CTS1 (1 << 0)
60#define MDM_CTL1_DSR1 (1 << 1)
61#define MDM_CTL1_DCD1 (1 << 2)
62#define MDM_CTL1_CTS2 (1 << 3)
63#define MDM_CTL1_DSR2 (1 << 4)
64#define MDM_CTL1_DCD2 (1 << 5)
65
66#define NCR_GP01_OFF (1<<0) 18#define NCR_GP01_OFF (1<<0)
67#define NCR_TP_PWR_EN (1<<1) 19#define NCR_TP_PWR_EN (1<<1)
68#define NCR_MS_PWR_EN (1<<2) 20#define NCR_MS_PWR_EN (1<<2)
@@ -71,4 +23,8 @@
71#define NCR_A0VPP (1<<5) 23#define NCR_A0VPP (1<<5)
72#define NCR_A1VPP (1<<6) 24#define NCR_A1VPP (1<<6)
73 25
26void neponset_ncr_frob(unsigned int, unsigned int);
27#define neponset_ncr_set(v) neponset_ncr_frob(0, v)
28#define neponset_ncr_clear(v) neponset_ncr_frob(v, 0)
29
74#endif 30#endif
diff --git a/arch/arm/mach-sa1100/include/mach/shannon.h b/arch/arm/mach-sa1100/include/mach/shannon.h
index 019f857a7938..fff39e02b496 100644
--- a/arch/arm/mach-sa1100/include/mach/shannon.h
+++ b/arch/arm/mach-sa1100/include/mach/shannon.h
@@ -21,7 +21,7 @@
21#define SHANNON_GPIO_U3_RTS GPIO_GPIO (19) /* ?? */ 21#define SHANNON_GPIO_U3_RTS GPIO_GPIO (19) /* ?? */
22#define SHANNON_GPIO_U3_CTS GPIO_GPIO (20) /* ?? */ 22#define SHANNON_GPIO_U3_CTS GPIO_GPIO (20) /* ?? */
23#define SHANNON_GPIO_SENSE_12V GPIO_GPIO (21) /* Input, 12v flash unprotect detected */ 23#define SHANNON_GPIO_SENSE_12V GPIO_GPIO (21) /* Input, 12v flash unprotect detected */
24#define SHANNON_GPIO_DISP_EN GPIO_GPIO (22) /* out */ 24#define SHANNON_GPIO_DISP_EN 22 /* out */
25/* XXX GPIO 23 unaccounted for */ 25/* XXX GPIO 23 unaccounted for */
26#define SHANNON_GPIO_EJECT_0 24 /* in */ 26#define SHANNON_GPIO_EJECT_0 24 /* in */
27#define SHANNON_GPIO_EJECT_1 25 /* in */ 27#define SHANNON_GPIO_EJECT_1 25 /* in */
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index dfbf824a69fa..516ccc25d7fd 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -17,6 +17,7 @@
17#include <linux/syscore_ops.h> 17#include <linux/syscore_ops.h>
18 18
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <mach/irqs.h>
20#include <asm/mach/irq.h> 21#include <asm/mach/irq.h>
21 22
22#include "generic.h" 23#include "generic.h"
@@ -221,11 +222,8 @@ static struct irq_chip sa1100_normal_chip = {
221 .irq_set_wake = sa1100_set_wake, 222 .irq_set_wake = sa1100_set_wake,
222}; 223};
223 224
224static struct resource irq_resource = { 225static struct resource irq_resource =
225 .name = "irqs", 226 DEFINE_RES_MEM_NAMED(0x90050000, SZ_64K, "irqs");
226 .start = 0x90050000,
227 .end = 0x9005ffff,
228};
229 227
230static struct sa1100irq_state { 228static struct sa1100irq_state {
231 unsigned int saved; 229 unsigned int saved;
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index ee121d6f0480..ca7a7e834720 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -23,9 +23,7 @@
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <video/s1d13xxxfb.h> 24#include <video/s1d13xxxfb.h>
25 25
26#include <mach/hardware.h>
27#include <asm/hardware/sa1111.h> 26#include <asm/hardware/sa1111.h>
28#include <asm/irq.h>
29#include <asm/page.h> 27#include <asm/page.h>
30#include <asm/mach-types.h> 28#include <asm/mach-types.h>
31#include <asm/setup.h> 29#include <asm/setup.h>
@@ -34,6 +32,9 @@
34#include <asm/mach/map.h> 32#include <asm/mach/map.h>
35#include <asm/mach/serial_sa1100.h> 33#include <asm/mach/serial_sa1100.h>
36 34
35#include <mach/hardware.h>
36#include <mach/irqs.h>
37
37#include "generic.h" 38#include "generic.h"
38 39
39/* 40/*
@@ -46,7 +47,7 @@
46 47
47/* memory space (line 52 of HP's doc) */ 48/* memory space (line 52 of HP's doc) */
48#define SA1111REGSTART 0x40000000 49#define SA1111REGSTART 0x40000000
49#define SA1111REGLEN 0x00001fff 50#define SA1111REGLEN 0x00002000
50#define EPSONREGSTART 0x48000000 51#define EPSONREGSTART 0x48000000
51#define EPSONREGLEN 0x00100000 52#define EPSONREGLEN 0x00100000
52#define EPSONFBSTART 0x48200000 53#define EPSONFBSTART 0x48200000
@@ -174,16 +175,8 @@ static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
174}; 175};
175 176
176static struct resource s1d13xxxfb_resources[] = { 177static struct resource s1d13xxxfb_resources[] = {
177 [0] = { 178 [0] = DEFINE_RES_MEM(EPSONFBSTART, EPSONFBLEN),
178 .start = EPSONFBSTART, 179 [1] = DEFINE_RES_MEM(EPSONREGSTART, EPSONREGLEN),
179 .end = EPSONFBSTART + EPSONFBLEN,
180 .flags = IORESOURCE_MEM,
181 },
182 [1] = {
183 .start = EPSONREGSTART,
184 .end = EPSONREGSTART + EPSONREGLEN,
185 .flags = IORESOURCE_MEM,
186 }
187}; 180};
188 181
189static struct platform_device s1d13xxxfb_device = { 182static struct platform_device s1d13xxxfb_device = {
@@ -197,20 +190,12 @@ static struct platform_device s1d13xxxfb_device = {
197}; 190};
198 191
199static struct resource sa1111_resources[] = { 192static struct resource sa1111_resources[] = {
200 [0] = { 193 [0] = DEFINE_RES_MEM(SA1111REGSTART, SA1111REGLEN),
201 .start = SA1111REGSTART, 194 [1] = DEFINE_RES_IRQ(IRQ_GPIO1),
202 .end = SA1111REGSTART + SA1111REGLEN,
203 .flags = IORESOURCE_MEM,
204 },
205 [1] = {
206 .start = IRQ_GPIO1,
207 .end = IRQ_GPIO1,
208 .flags = IORESOURCE_IRQ,
209 },
210}; 195};
211 196
212static struct sa1111_platform_data sa1111_info = { 197static struct sa1111_platform_data sa1111_info = {
213 .irq_base = IRQ_BOARD_END, 198 .disable_devs = SA1111_DEVID_PS2_MSE,
214}; 199};
215 200
216static u64 sa1111_dmamask = 0xffffffffUL; 201static u64 sa1111_dmamask = 0xffffffffUL;
@@ -284,11 +269,6 @@ static struct map_desc jornada720_io_desc[] __initdata = {
284 .pfn = __phys_to_pfn(EPSONFBSTART), 269 .pfn = __phys_to_pfn(EPSONFBSTART),
285 .length = EPSONFBLEN, 270 .length = EPSONFBLEN,
286 .type = MT_DEVICE 271 .type = MT_DEVICE
287 }, { /* SA-1111 */
288 .virtual = 0xf4000000,
289 .pfn = __phys_to_pfn(SA1111REGSTART),
290 .length = SA1111REGLEN,
291 .type = MT_DEVICE
292 } 272 }
293}; 273};
294 274
@@ -352,11 +332,8 @@ static struct flash_platform_data jornada720_flash_data = {
352 .nr_parts = ARRAY_SIZE(jornada720_partitions), 332 .nr_parts = ARRAY_SIZE(jornada720_partitions),
353}; 333};
354 334
355static struct resource jornada720_flash_resource = { 335static struct resource jornada720_flash_resource =
356 .start = SA1100_CS0_PHYS, 336 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
357 .end = SA1100_CS0_PHYS + SZ_32M - 1,
358 .flags = IORESOURCE_MEM,
359};
360 337
361static void __init jornada720_mach_init(void) 338static void __init jornada720_mach_init(void)
362{ 339{
@@ -367,6 +344,7 @@ MACHINE_START(JORNADA720, "HP Jornada 720")
367 /* Maintainer: Kristoffer Ericson <Kristoffer.Ericson@gmail.com> */ 344 /* Maintainer: Kristoffer Ericson <Kristoffer.Ericson@gmail.com> */
368 .atag_offset = 0x100, 345 .atag_offset = 0x100,
369 .map_io = jornada720_map_io, 346 .map_io = jornada720_map_io,
347 .nr_irqs = SA1100_NR_IRQS,
370 .init_irq = sa1100_init_irq, 348 .init_irq = sa1100_init_irq,
371 .timer = &sa1100_timer, 349 .timer = &sa1100_timer,
372 .init_machine = jornada720_mach_init, 350 .init_machine = jornada720_mach_init,
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index af4e2761f3db..eb6534e0b0d0 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -6,6 +6,8 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/tty.h> 7#include <linux/tty.h>
8 8
9#include <video/sa1100fb.h>
10
9#include <mach/hardware.h> 11#include <mach/hardware.h>
10#include <asm/setup.h> 12#include <asm/setup.h>
11#include <asm/mach-types.h> 13#include <asm/mach-types.h>
@@ -15,6 +17,7 @@
15#include <asm/mach/map.h> 17#include <asm/mach/map.h>
16#include <asm/mach/serial_sa1100.h> 18#include <asm/mach/serial_sa1100.h>
17#include <mach/mcp.h> 19#include <mach/mcp.h>
20#include <mach/irqs.h>
18 21
19#include "generic.h" 22#include "generic.h"
20 23
@@ -26,8 +29,86 @@ static struct mcp_plat_data lart_mcp_data = {
26 .sclk_rate = 11981000, 29 .sclk_rate = 11981000,
27}; 30};
28 31
32#ifdef LART_GREY_LCD
33static struct sa1100fb_mach_info lart_grey_info = {
34 .pixclock = 150000, .bpp = 4,
35 .xres = 320, .yres = 240,
36
37 .hsync_len = 1, .vsync_len = 1,
38 .left_margin = 4, .upper_margin = 0,
39 .right_margin = 2, .lower_margin = 0,
40
41 .cmap_greyscale = 1,
42 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
43
44 .lccr0 = LCCR0_Mono | LCCR0_Sngl | LCCR0_Pas | LCCR0_4PixMono,
45 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(512),
46};
47#endif
48#ifdef LART_COLOR_LCD
49static struct sa1100fb_mach_info lart_color_info = {
50 .pixclock = 150000, .bpp = 16,
51 .xres = 320, .yres = 240,
52
53 .hsync_len = 2, .vsync_len = 3,
54 .left_margin = 69, .upper_margin = 14,
55 .right_margin = 8, .lower_margin = 4,
56
57 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
58 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
59};
60#endif
61#ifdef LART_VIDEO_OUT
62static struct sa1100fb_mach_info lart_video_info = {
63 .pixclock = 39721, .bpp = 16,
64 .xres = 640, .yres = 480,
65
66 .hsync_len = 95, .vsync_len = 2,
67 .left_margin = 40, .upper_margin = 32,
68 .right_margin = 24, .lower_margin = 11,
69
70 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
71
72 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
73 .lccr3 = LCCR3_OutEnL | LCCR3_PixFlEdg | LCCR3_ACBsDiv(512),
74};
75#endif
76
77#ifdef LART_KIT01_LCD
78static struct sa1100fb_mach_info lart_kit01_info = {
79 .pixclock = 63291, .bpp = 16,
80 .xres = 640, .yres = 480,
81
82 .hsync_len = 64, .vsync_len = 3,
83 .left_margin = 122, .upper_margin = 45,
84 .right_margin = 10, .lower_margin = 10,
85
86 .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act,
87 .lccr3 = LCCR3_OutEnH | LCCR3_PixFlEdg
88};
89#endif
90
29static void __init lart_init(void) 91static void __init lart_init(void)
30{ 92{
93 struct sa1100fb_mach_info *inf = NULL;
94
95#ifdef LART_GREY_LCD
96 inf = &lart_grey_info;
97#endif
98#ifdef LART_COLOR_LCD
99 inf = &lart_color_info;
100#endif
101#ifdef LART_VIDEO_OUT
102 inf = &lart_video_info;
103#endif
104#ifdef LART_KIT01_LCD
105 inf = &lart_kit01_info;
106#endif
107
108 if (inf)
109 sa11x0_register_lcd(inf);
110
111 sa11x0_ppc_configure_mcp();
31 sa11x0_register_mcp(&lart_mcp_data); 112 sa11x0_register_mcp(&lart_mcp_data);
32} 113}
33 114
@@ -63,6 +144,7 @@ static void __init lart_map_io(void)
63MACHINE_START(LART, "LART") 144MACHINE_START(LART, "LART")
64 .atag_offset = 0x100, 145 .atag_offset = 0x100,
65 .map_io = lart_map_io, 146 .map_io = lart_map_io,
147 .nr_irqs = SA1100_NR_IRQS,
66 .init_irq = sa1100_init_irq, 148 .init_irq = sa1100_init_irq,
67 .init_machine = lart_init, 149 .init_machine = lart_init,
68 .timer = &sa1100_timer, 150 .timer = &sa1100_timer,
diff --git a/arch/arm/mach-sa1100/leds-assabet.c b/arch/arm/mach-sa1100/leds-assabet.c
index 64e9b4b11b54..3699176bca94 100644
--- a/arch/arm/mach-sa1100/leds-assabet.c
+++ b/arch/arm/mach-sa1100/leds-assabet.c
@@ -13,7 +13,6 @@
13 13
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <asm/leds.h> 15#include <asm/leds.h>
16#include <asm/system.h>
17#include <mach/assabet.h> 16#include <mach/assabet.h>
18 17
19#include "leds.h" 18#include "leds.h"
diff --git a/arch/arm/mach-sa1100/leds-badge4.c b/arch/arm/mach-sa1100/leds-badge4.c
index cf1e38458b81..f99fac3eedb6 100644
--- a/arch/arm/mach-sa1100/leds-badge4.c
+++ b/arch/arm/mach-sa1100/leds-badge4.c
@@ -14,7 +14,6 @@
14 14
15#include <mach/hardware.h> 15#include <mach/hardware.h>
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/system.h>
18 17
19#include "leds.h" 18#include "leds.h"
20 19
diff --git a/arch/arm/mach-sa1100/leds-cerf.c b/arch/arm/mach-sa1100/leds-cerf.c
index 259b48e0be89..040540fb7d8a 100644
--- a/arch/arm/mach-sa1100/leds-cerf.c
+++ b/arch/arm/mach-sa1100/leds-cerf.c
@@ -7,7 +7,6 @@
7 7
8#include <mach/hardware.h> 8#include <mach/hardware.h>
9#include <asm/leds.h> 9#include <asm/leds.h>
10#include <asm/system.h>
11 10
12#include "leds.h" 11#include "leds.h"
13 12
diff --git a/arch/arm/mach-sa1100/leds-hackkit.c b/arch/arm/mach-sa1100/leds-hackkit.c
index 2bce137462e4..6a2352436e62 100644
--- a/arch/arm/mach-sa1100/leds-hackkit.c
+++ b/arch/arm/mach-sa1100/leds-hackkit.c
@@ -13,7 +13,6 @@
13 13
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <asm/leds.h> 15#include <asm/leds.h>
16#include <asm/system.h>
17 16
18#include "leds.h" 17#include "leds.h"
19 18
diff --git a/arch/arm/mach-sa1100/leds-lart.c b/arch/arm/mach-sa1100/leds-lart.c
index 0505a1fdcdb2..a51830c60e53 100644
--- a/arch/arm/mach-sa1100/leds-lart.c
+++ b/arch/arm/mach-sa1100/leds-lart.c
@@ -13,7 +13,6 @@
13 13
14#include <mach/hardware.h> 14#include <mach/hardware.h>
15#include <asm/leds.h> 15#include <asm/leds.h>
16#include <asm/system.h>
17 16
18#include "leds.h" 17#include "leds.h"
19 18
diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c
index 85f6ee672225..8f6446b9f025 100644
--- a/arch/arm/mach-sa1100/nanoengine.c
+++ b/arch/arm/mach-sa1100/nanoengine.c
@@ -28,6 +28,7 @@
28 28
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30#include <mach/nanoengine.h> 30#include <mach/nanoengine.h>
31#include <mach/irqs.h>
31 32
32#include "generic.h" 33#include "generic.h"
33 34
@@ -58,15 +59,8 @@ static struct flash_platform_data nanoengine_flash_data = {
58}; 59};
59 60
60static struct resource nanoengine_flash_resources[] = { 61static struct resource nanoengine_flash_resources[] = {
61 { 62 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M),
62 .start = SA1100_CS0_PHYS, 63 DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_32M),
63 .end = SA1100_CS0_PHYS + SZ_32M - 1,
64 .flags = IORESOURCE_MEM,
65 }, {
66 .start = SA1100_CS1_PHYS,
67 .end = SA1100_CS1_PHYS + SZ_32M - 1,
68 .flags = IORESOURCE_MEM,
69 }
70}; 64};
71 65
72static struct map_desc nanoengine_io_desc[] __initdata = { 66static struct map_desc nanoengine_io_desc[] __initdata = {
@@ -114,6 +108,7 @@ static void __init nanoengine_init(void)
114MACHINE_START(NANOENGINE, "BSE nanoEngine") 108MACHINE_START(NANOENGINE, "BSE nanoEngine")
115 .atag_offset = 0x100, 109 .atag_offset = 0x100,
116 .map_io = nanoengine_map_io, 110 .map_io = nanoengine_map_io,
111 .nr_irqs = SA1100_NR_IRQS,
117 .init_irq = sa1100_init_irq, 112 .init_irq = sa1100_init_irq,
118 .timer = &sa1100_timer, 113 .timer = &sa1100_timer,
119 .init_machine = nanoengine_init, 114 .init_machine = nanoengine_init,
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index b4fa53a1427e..6c58f01b358a 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -1,89 +1,104 @@
1/* 1/*
2 * linux/arch/arm/mach-sa1100/neponset.c 2 * linux/arch/arm/mach-sa1100/neponset.c
3 *
4 */ 3 */
5#include <linux/kernel.h> 4#include <linux/err.h>
6#include <linux/init.h> 5#include <linux/init.h>
7#include <linux/tty.h>
8#include <linux/ioport.h> 6#include <linux/ioport.h>
9#include <linux/serial_core.h> 7#include <linux/irq.h>
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/platform_device.h> 10#include <linux/platform_device.h>
11#include <linux/pm.h>
12#include <linux/serial_core.h>
13#include <linux/slab.h>
11 14
12#include <mach/hardware.h>
13#include <asm/mach-types.h> 15#include <asm/mach-types.h>
14#include <asm/irq.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
16#include <asm/mach/irq.h>
17#include <asm/mach/serial_sa1100.h> 17#include <asm/mach/serial_sa1100.h>
18#include <mach/assabet.h>
19#include <mach/neponset.h>
20#include <asm/hardware/sa1111.h> 18#include <asm/hardware/sa1111.h>
21#include <asm/sizes.h> 19#include <asm/sizes.h>
22 20
23/* 21#include <mach/hardware.h>
24 * Install handler for Neponset IRQ. Note that we have to loop here 22#include <mach/assabet.h>
25 * since the ETHERNET and USAR IRQs are level based, and we need to 23#include <mach/neponset.h>
26 * ensure that the IRQ signal is deasserted before returning. This 24#include <mach/irqs.h>
27 * is rather unfortunate. 25
28 */ 26#define NEP_IRQ_SMC91X 0
29static void 27#define NEP_IRQ_USAR 1
30neponset_irq_handler(unsigned int irq, struct irq_desc *desc) 28#define NEP_IRQ_SA1111 2
31{ 29#define NEP_IRQ_NR 3
32 unsigned int irr; 30
33 31#define WHOAMI 0x00
34 while (1) { 32#define LEDS 0x10
35 /* 33#define SWPK 0x20
36 * Acknowledge the parent IRQ. 34#define IRR 0x24
37 */ 35#define KP_Y_IN 0x80
38 desc->irq_data.chip->irq_ack(&desc->irq_data); 36#define KP_X_OUT 0x90
39 37#define NCR_0 0xa0
40 /* 38#define MDM_CTL_0 0xb0
41 * Read the interrupt reason register. Let's have all 39#define MDM_CTL_1 0xb4
42 * active IRQ bits high. Note: there is a typo in the 40#define AUD_CTL 0xc0
43 * Neponset user's guide for the SA1111 IRR level. 41
44 */ 42#define IRR_ETHERNET (1 << 0)
45 irr = IRR ^ (IRR_ETHERNET | IRR_USAR); 43#define IRR_USAR (1 << 1)
46 44#define IRR_SA1111 (1 << 2)
47 if ((irr & (IRR_ETHERNET | IRR_USAR | IRR_SA1111)) == 0) 45
48 break; 46#define MDM_CTL0_RTS1 (1 << 0)
49 47#define MDM_CTL0_DTR1 (1 << 1)
50 /* 48#define MDM_CTL0_RTS2 (1 << 2)
51 * Since there is no individual mask, we have to 49#define MDM_CTL0_DTR2 (1 << 3)
52 * mask the parent IRQ. This is safe, since we'll 50
53 * recheck the register for any pending IRQs. 51#define MDM_CTL1_CTS1 (1 << 0)
54 */ 52#define MDM_CTL1_DSR1 (1 << 1)
55 if (irr & (IRR_ETHERNET | IRR_USAR)) { 53#define MDM_CTL1_DCD1 (1 << 2)
56 desc->irq_data.chip->irq_mask(&desc->irq_data); 54#define MDM_CTL1_CTS2 (1 << 3)
57 55#define MDM_CTL1_DSR2 (1 << 4)
58 /* 56#define MDM_CTL1_DCD2 (1 << 5)
59 * Ack the interrupt now to prevent re-entering 57
60 * this neponset handler. Again, this is safe 58#define AUD_SEL_1341 (1 << 0)
61 * since we'll check the IRR register prior to 59#define AUD_MUTE_1341 (1 << 1)
62 * leaving.
63 */
64 desc->irq_data.chip->irq_ack(&desc->irq_data);
65 60
66 if (irr & IRR_ETHERNET) { 61extern void sa1110_mb_disable(void);
67 generic_handle_irq(IRQ_NEPONSET_SMC9196);
68 }
69 62
70 if (irr & IRR_USAR) { 63struct neponset_drvdata {
71 generic_handle_irq(IRQ_NEPONSET_USAR); 64 void __iomem *base;
72 } 65 struct platform_device *sa1111;
66 struct platform_device *smc91x;
67 unsigned irq_base;
68#ifdef CONFIG_PM_SLEEP
69 u32 ncr0;
70 u32 mdm_ctl_0;
71#endif
72};
73 73
74 desc->irq_data.chip->irq_unmask(&desc->irq_data); 74static void __iomem *nep_base;
75 }
76 75
77 if (irr & IRR_SA1111) { 76void neponset_ncr_frob(unsigned int mask, unsigned int val)
78 generic_handle_irq(IRQ_NEPONSET_SA1111); 77{
79 } 78 void __iomem *base = nep_base;
79
80 if (base) {
81 unsigned long flags;
82 unsigned v;
83
84 local_irq_save(flags);
85 v = readb_relaxed(base + NCR_0);
86 writeb_relaxed((v & ~mask) | val, base + NCR_0);
87 local_irq_restore(flags);
88 } else {
89 WARN(1, "nep_base unset\n");
80 } 90 }
81} 91}
82 92
83static void neponset_set_mctrl(struct uart_port *port, u_int mctrl) 93static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
84{ 94{
85 u_int mdm_ctl0 = MDM_CTL_0; 95 void __iomem *base = nep_base;
96 u_int mdm_ctl0;
86 97
98 if (!base)
99 return;
100
101 mdm_ctl0 = readb_relaxed(base + MDM_CTL_0);
87 if (port->mapbase == _Ser1UTCR0) { 102 if (port->mapbase == _Ser1UTCR0) {
88 if (mctrl & TIOCM_RTS) 103 if (mctrl & TIOCM_RTS)
89 mdm_ctl0 &= ~MDM_CTL0_RTS2; 104 mdm_ctl0 &= ~MDM_CTL0_RTS2;
@@ -106,14 +121,19 @@ static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
106 mdm_ctl0 |= MDM_CTL0_DTR1; 121 mdm_ctl0 |= MDM_CTL0_DTR1;
107 } 122 }
108 123
109 MDM_CTL_0 = mdm_ctl0; 124 writeb_relaxed(mdm_ctl0, base + MDM_CTL_0);
110} 125}
111 126
112static u_int neponset_get_mctrl(struct uart_port *port) 127static u_int neponset_get_mctrl(struct uart_port *port)
113{ 128{
129 void __iomem *base = nep_base;
114 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR; 130 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
115 u_int mdm_ctl1 = MDM_CTL_1; 131 u_int mdm_ctl1;
132
133 if (!base)
134 return ret;
116 135
136 mdm_ctl1 = readb_relaxed(base + MDM_CTL_1);
117 if (port->mapbase == _Ser1UTCR0) { 137 if (port->mapbase == _Ser1UTCR0) {
118 if (mdm_ctl1 & MDM_CTL1_DCD2) 138 if (mdm_ctl1 & MDM_CTL1_DCD2)
119 ret &= ~TIOCM_CD; 139 ret &= ~TIOCM_CD;
@@ -138,209 +158,278 @@ static struct sa1100_port_fns neponset_port_fns __devinitdata = {
138 .get_mctrl = neponset_get_mctrl, 158 .get_mctrl = neponset_get_mctrl,
139}; 159};
140 160
141static int __devinit neponset_probe(struct platform_device *dev) 161/*
162 * Install handler for Neponset IRQ. Note that we have to loop here
163 * since the ETHERNET and USAR IRQs are level based, and we need to
164 * ensure that the IRQ signal is deasserted before returning. This
165 * is rather unfortunate.
166 */
167static void neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
142{ 168{
143 sa1100_register_uart_fns(&neponset_port_fns); 169 struct neponset_drvdata *d = irq_desc_get_handler_data(desc);
170 unsigned int irr;
144 171
145 /* 172 while (1) {
146 * Install handler for GPIO25. 173 /*
147 */ 174 * Acknowledge the parent IRQ.
148 irq_set_irq_type(IRQ_GPIO25, IRQ_TYPE_EDGE_RISING); 175 */
149 irq_set_chained_handler(IRQ_GPIO25, neponset_irq_handler); 176 desc->irq_data.chip->irq_ack(&desc->irq_data);
150 177
151 /* 178 /*
152 * We would set IRQ_GPIO25 to be a wake-up IRQ, but 179 * Read the interrupt reason register. Let's have all
153 * unfortunately something on the Neponset activates 180 * active IRQ bits high. Note: there is a typo in the
154 * this IRQ on sleep (ethernet?) 181 * Neponset user's guide for the SA1111 IRR level.
155 */ 182 */
156#if 0 183 irr = readb_relaxed(d->base + IRR);
157 enable_irq_wake(IRQ_GPIO25); 184 irr ^= IRR_ETHERNET | IRR_USAR;
158#endif
159 185
160 /* 186 if ((irr & (IRR_ETHERNET | IRR_USAR | IRR_SA1111)) == 0)
161 * Setup other Neponset IRQs. SA1111 will be done by the 187 break;
162 * generic SA1111 code.
163 */
164 irq_set_handler(IRQ_NEPONSET_SMC9196, handle_simple_irq);
165 set_irq_flags(IRQ_NEPONSET_SMC9196, IRQF_VALID | IRQF_PROBE);
166 irq_set_handler(IRQ_NEPONSET_USAR, handle_simple_irq);
167 set_irq_flags(IRQ_NEPONSET_USAR, IRQF_VALID | IRQF_PROBE);
168 188
169 /* 189 /*
170 * Disable GPIO 0/1 drivers so the buttons work on the module. 190 * Since there is no individual mask, we have to
171 */ 191 * mask the parent IRQ. This is safe, since we'll
172 NCR_0 = NCR_GP01_OFF; 192 * recheck the register for any pending IRQs.
193 */
194 if (irr & (IRR_ETHERNET | IRR_USAR)) {
195 desc->irq_data.chip->irq_mask(&desc->irq_data);
173 196
174 return 0; 197 /*
175} 198 * Ack the interrupt now to prevent re-entering
199 * this neponset handler. Again, this is safe
200 * since we'll check the IRR register prior to
201 * leaving.
202 */
203 desc->irq_data.chip->irq_ack(&desc->irq_data);
176 204
177#ifdef CONFIG_PM 205 if (irr & IRR_ETHERNET)
206 generic_handle_irq(d->irq_base + NEP_IRQ_SMC91X);
178 207
179/* 208 if (irr & IRR_USAR)
180 * LDM power management. 209 generic_handle_irq(d->irq_base + NEP_IRQ_USAR);
181 */
182static unsigned int neponset_saved_state;
183 210
184static int neponset_suspend(struct platform_device *dev, pm_message_t state) 211 desc->irq_data.chip->irq_unmask(&desc->irq_data);
185{ 212 }
186 /*
187 * Save state.
188 */
189 neponset_saved_state = NCR_0;
190 213
191 return 0; 214 if (irr & IRR_SA1111)
215 generic_handle_irq(d->irq_base + NEP_IRQ_SA1111);
216 }
192} 217}
193 218
194static int neponset_resume(struct platform_device *dev) 219/* Yes, we really do not have any kind of masking or unmasking */
220static void nochip_noop(struct irq_data *irq)
195{ 221{
196 NCR_0 = neponset_saved_state;
197
198 return 0;
199} 222}
200 223
201#else 224static struct irq_chip nochip = {
202#define neponset_suspend NULL 225 .name = "neponset",
203#define neponset_resume NULL 226 .irq_ack = nochip_noop,
204#endif 227 .irq_mask = nochip_noop,
205 228 .irq_unmask = nochip_noop,
206static struct platform_driver neponset_device_driver = {
207 .probe = neponset_probe,
208 .suspend = neponset_suspend,
209 .resume = neponset_resume,
210 .driver = {
211 .name = "neponset",
212 },
213};
214
215static struct resource neponset_resources[] = {
216 [0] = {
217 .start = 0x10000000,
218 .end = 0x17ffffff,
219 .flags = IORESOURCE_MEM,
220 },
221};
222
223static struct platform_device neponset_device = {
224 .name = "neponset",
225 .id = 0,
226 .num_resources = ARRAY_SIZE(neponset_resources),
227 .resource = neponset_resources,
228};
229
230static struct resource sa1111_resources[] = {
231 [0] = {
232 .start = 0x40000000,
233 .end = 0x40001fff,
234 .flags = IORESOURCE_MEM,
235 },
236 [1] = {
237 .start = IRQ_NEPONSET_SA1111,
238 .end = IRQ_NEPONSET_SA1111,
239 .flags = IORESOURCE_IRQ,
240 },
241}; 229};
242 230
243static struct sa1111_platform_data sa1111_info = { 231static struct sa1111_platform_data sa1111_info = {
244 .irq_base = IRQ_BOARD_END, 232 .disable_devs = SA1111_DEVID_PS2_MSE,
245}; 233};
246 234
247static u64 sa1111_dmamask = 0xffffffffUL; 235static int __devinit neponset_probe(struct platform_device *dev)
236{
237 struct neponset_drvdata *d;
238 struct resource *nep_res, *sa1111_res, *smc91x_res;
239 struct resource sa1111_resources[] = {
240 DEFINE_RES_MEM(0x40000000, SZ_8K),
241 { .flags = IORESOURCE_IRQ },
242 };
243 struct platform_device_info sa1111_devinfo = {
244 .parent = &dev->dev,
245 .name = "sa1111",
246 .id = 0,
247 .res = sa1111_resources,
248 .num_res = ARRAY_SIZE(sa1111_resources),
249 .data = &sa1111_info,
250 .size_data = sizeof(sa1111_info),
251 .dma_mask = 0xffffffffUL,
252 };
253 struct resource smc91x_resources[] = {
254 DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS,
255 0x02000000, "smc91x-regs"),
256 DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS + 0x02000000,
257 0x02000000, "smc91x-attrib"),
258 { .flags = IORESOURCE_IRQ },
259 };
260 struct platform_device_info smc91x_devinfo = {
261 .parent = &dev->dev,
262 .name = "smc91x",
263 .id = 0,
264 .res = smc91x_resources,
265 .num_res = ARRAY_SIZE(smc91x_resources),
266 };
267 int ret, irq;
268
269 if (nep_base)
270 return -EBUSY;
271
272 irq = ret = platform_get_irq(dev, 0);
273 if (ret < 0)
274 goto err_alloc;
275
276 nep_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
277 smc91x_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
278 sa1111_res = platform_get_resource(dev, IORESOURCE_MEM, 2);
279 if (!nep_res || !smc91x_res || !sa1111_res) {
280 ret = -ENXIO;
281 goto err_alloc;
282 }
248 283
249static struct platform_device sa1111_device = { 284 d = kzalloc(sizeof(*d), GFP_KERNEL);
250 .name = "sa1111", 285 if (!d) {
251 .id = 0, 286 ret = -ENOMEM;
252 .dev = { 287 goto err_alloc;
253 .dma_mask = &sa1111_dmamask, 288 }
254 .coherent_dma_mask = 0xffffffff,
255 .platform_data = &sa1111_info,
256 },
257 .num_resources = ARRAY_SIZE(sa1111_resources),
258 .resource = sa1111_resources,
259};
260 289
261static struct resource smc91x_resources[] = { 290 d->base = ioremap(nep_res->start, SZ_4K);
262 [0] = { 291 if (!d->base) {
263 .name = "smc91x-regs", 292 ret = -ENOMEM;
264 .start = SA1100_CS3_PHYS, 293 goto err_ioremap;
265 .end = SA1100_CS3_PHYS + 0x01ffffff, 294 }
266 .flags = IORESOURCE_MEM,
267 },
268 [1] = {
269 .start = IRQ_NEPONSET_SMC9196,
270 .end = IRQ_NEPONSET_SMC9196,
271 .flags = IORESOURCE_IRQ,
272 },
273 [2] = {
274 .name = "smc91x-attrib",
275 .start = SA1100_CS3_PHYS + 0x02000000,
276 .end = SA1100_CS3_PHYS + 0x03ffffff,
277 .flags = IORESOURCE_MEM,
278 },
279};
280 295
281static struct platform_device smc91x_device = { 296 if (readb_relaxed(d->base + WHOAMI) != 0x11) {
282 .name = "smc91x", 297 dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
283 .id = 0, 298 readb_relaxed(d->base + WHOAMI));
284 .num_resources = ARRAY_SIZE(smc91x_resources), 299 ret = -ENODEV;
285 .resource = smc91x_resources, 300 goto err_id;
286}; 301 }
287 302
288static struct platform_device *devices[] __initdata = { 303 ret = irq_alloc_descs(-1, IRQ_BOARD_START, NEP_IRQ_NR, -1);
289 &neponset_device, 304 if (ret <= 0) {
290 &sa1111_device, 305 dev_err(&dev->dev, "unable to allocate %u irqs: %d\n",
291 &smc91x_device, 306 NEP_IRQ_NR, ret);
292}; 307 if (ret == 0)
308 ret = -ENOMEM;
309 goto err_irq_alloc;
310 }
293 311
294extern void sa1110_mb_disable(void); 312 d->irq_base = ret;
295 313
296static int __init neponset_init(void) 314 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip,
297{ 315 handle_simple_irq);
298 platform_driver_register(&neponset_device_driver); 316 set_irq_flags(d->irq_base + NEP_IRQ_SMC91X, IRQF_VALID | IRQF_PROBE);
317 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip,
318 handle_simple_irq);
319 set_irq_flags(d->irq_base + NEP_IRQ_USAR, IRQF_VALID | IRQF_PROBE);
320 irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip);
299 321
300 /* 322 irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
301 * The Neponset is only present on the Assabet machine type. 323 irq_set_handler_data(irq, d);
302 */ 324 irq_set_chained_handler(irq, neponset_irq_handler);
303 if (!machine_is_assabet())
304 return -ENODEV;
305 325
306 /* 326 /*
307 * Ensure that the memory bus request/grant signals are setup, 327 * We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately
308 * and the grant is held in its inactive state, whether or not 328 * something on the Neponset activates this IRQ on sleep (eth?)
309 * we actually have a Neponset attached.
310 */ 329 */
330#if 0
331 enable_irq_wake(irq);
332#endif
333
334 dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
335 d->irq_base, d->irq_base + NEP_IRQ_NR - 1);
336 nep_base = d->base;
337
338 sa1100_register_uart_fns(&neponset_port_fns);
339
340 /* Ensure that the memory bus request/grant signals are setup */
311 sa1110_mb_disable(); 341 sa1110_mb_disable();
312 342
313 if (!machine_has_neponset()) { 343 /* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
314 printk(KERN_DEBUG "Neponset expansion board not present\n"); 344 writeb_relaxed(NCR_GP01_OFF, d->base + NCR_0);
315 return -ENODEV;
316 }
317 345
318 if (WHOAMI != 0x11) { 346 sa1111_resources[0].parent = sa1111_res;
319 printk(KERN_WARNING "Neponset board detected, but " 347 sa1111_resources[1].start = d->irq_base + NEP_IRQ_SA1111;
320 "wrong ID: %02x\n", WHOAMI); 348 sa1111_resources[1].end = d->irq_base + NEP_IRQ_SA1111;
321 return -ENODEV; 349 d->sa1111 = platform_device_register_full(&sa1111_devinfo);
322 } 350
351 smc91x_resources[0].parent = smc91x_res;
352 smc91x_resources[1].parent = smc91x_res;
353 smc91x_resources[2].start = d->irq_base + NEP_IRQ_SMC91X;
354 smc91x_resources[2].end = d->irq_base + NEP_IRQ_SMC91X;
355 d->smc91x = platform_device_register_full(&smc91x_devinfo);
356
357 platform_set_drvdata(dev, d);
323 358
324 return platform_add_devices(devices, ARRAY_SIZE(devices)); 359 return 0;
360
361 err_irq_alloc:
362 err_id:
363 iounmap(d->base);
364 err_ioremap:
365 kfree(d);
366 err_alloc:
367 return ret;
325} 368}
326 369
327subsys_initcall(neponset_init); 370static int __devexit neponset_remove(struct platform_device *dev)
371{
372 struct neponset_drvdata *d = platform_get_drvdata(dev);
373 int irq = platform_get_irq(dev, 0);
374
375 if (!IS_ERR(d->sa1111))
376 platform_device_unregister(d->sa1111);
377 if (!IS_ERR(d->smc91x))
378 platform_device_unregister(d->smc91x);
379 irq_set_chained_handler(irq, NULL);
380 irq_free_descs(d->irq_base, NEP_IRQ_NR);
381 nep_base = NULL;
382 iounmap(d->base);
383 kfree(d);
328 384
329static struct map_desc neponset_io_desc[] __initdata = { 385 return 0;
330 { /* System Registers */ 386}
331 .virtual = 0xf3000000, 387
332 .pfn = __phys_to_pfn(0x10000000), 388#ifdef CONFIG_PM_SLEEP
333 .length = SZ_1M, 389static int neponset_suspend(struct device *dev)
334 .type = MT_DEVICE 390{
335 }, { /* SA-1111 */ 391 struct neponset_drvdata *d = dev_get_drvdata(dev);
336 .virtual = 0xf4000000, 392
337 .pfn = __phys_to_pfn(0x40000000), 393 d->ncr0 = readb_relaxed(d->base + NCR_0);
338 .length = SZ_1M, 394 d->mdm_ctl_0 = readb_relaxed(d->base + MDM_CTL_0);
339 .type = MT_DEVICE 395
340 } 396 return 0;
397}
398
399static int neponset_resume(struct device *dev)
400{
401 struct neponset_drvdata *d = dev_get_drvdata(dev);
402
403 writeb_relaxed(d->ncr0, d->base + NCR_0);
404 writeb_relaxed(d->mdm_ctl_0, d->base + MDM_CTL_0);
405
406 return 0;
407}
408
409static const struct dev_pm_ops neponset_pm_ops = {
410 .suspend_noirq = neponset_suspend,
411 .resume_noirq = neponset_resume,
412 .freeze_noirq = neponset_suspend,
413 .restore_noirq = neponset_resume,
414};
415#define PM_OPS &neponset_pm_ops
416#else
417#define PM_OPS NULL
418#endif
419
420static struct platform_driver neponset_device_driver = {
421 .probe = neponset_probe,
422 .remove = __devexit_p(neponset_remove),
423 .driver = {
424 .name = "neponset",
425 .owner = THIS_MODULE,
426 .pm = PM_OPS,
427 },
341}; 428};
342 429
343void __init neponset_map_io(void) 430static int __init neponset_init(void)
344{ 431{
345 iotable_init(neponset_io_desc, ARRAY_SIZE(neponset_io_desc)); 432 return platform_driver_register(&neponset_device_driver);
346} 433}
434
435subsys_initcall(neponset_init);
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index b466bca9c651..b49108b890a8 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -135,12 +135,8 @@ struct pci_bus * __init pci_nanoengine_scan_bus(int nr, struct pci_sys_data *sys
135 &sys->resources); 135 &sys->resources);
136} 136}
137 137
138static struct resource pci_io_ports = { 138static struct resource pci_io_ports =
139 .name = "PCI IO", 139 DEFINE_RES_IO_NAMED(0x400, 0x400, "PCI IO");
140 .start = 0x400,
141 .end = 0x7FF,
142 .flags = IORESOURCE_IO,
143};
144 140
145static struct resource pci_non_prefetchable_memory = { 141static struct resource pci_non_prefetchable_memory = {
146 .name = "PCI non-prefetchable", 142 .name = "PCI non-prefetchable",
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 9307df053533..1602575a0d5c 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -37,17 +37,9 @@
37#define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21 37#define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21
38 38
39static struct resource smc91x_resources[] = { 39static struct resource smc91x_resources[] = {
40 [0] = { 40 [0] = DEFINE_RES_MEM(PLEB_ETH0_P, 0x04000000),
41 .start = PLEB_ETH0_P,
42 .end = PLEB_ETH0_P | 0x03ffffff,
43 .flags = IORESOURCE_MEM,
44 },
45#if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */ 41#if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */
46 [1] = { 42 [1] = DEFINE_RES_IRQ(IRQ_GPIO_ETH0_IRQ),
47 .start = IRQ_GPIO_ETH0_IRQ,
48 .end = IRQ_GPIO_ETH0_IRQ,
49 .flags = IORESOURCE_IRQ,
50 },
51#endif 43#endif
52}; 44};
53 45
@@ -70,16 +62,8 @@ static struct platform_device *devices[] __initdata = {
70 * the two SA1100 lowest chip select outputs. 62 * the two SA1100 lowest chip select outputs.
71 */ 63 */
72static struct resource pleb_flash_resources[] = { 64static struct resource pleb_flash_resources[] = {
73 [0] = { 65 [0] = DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_8M),
74 .start = SA1100_CS0_PHYS, 66 [1] = DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_8M),
75 .end = SA1100_CS0_PHYS + SZ_8M - 1,
76 .flags = IORESOURCE_MEM,
77 },
78 [1] = {
79 .start = SA1100_CS1_PHYS,
80 .end = SA1100_CS1_PHYS + SZ_8M - 1,
81 .flags = IORESOURCE_MEM,
82 }
83}; 67};
84 68
85 69
@@ -147,6 +131,7 @@ static void __init pleb_map_io(void)
147 131
148MACHINE_START(PLEB, "PLEB") 132MACHINE_START(PLEB, "PLEB")
149 .map_io = pleb_map_io, 133 .map_io = pleb_map_io,
134 .nr_irqs = SA1100_NR_IRQS,
150 .init_irq = sa1100_init_irq, 135 .init_irq = sa1100_init_irq,
151 .timer = &sa1100_timer, 136 .timer = &sa1100_timer,
152 .init_machine = pleb_init, 137 .init_machine = pleb_init,
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index bf85b8b259d5..2fa499ec6afe 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -30,7 +30,6 @@
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/suspend.h> 32#include <asm/suspend.h>
33#include <asm/system.h>
34#include <asm/mach/time.h> 33#include <asm/mach/time.h>
35 34
36extern int sa1100_finish_suspend(unsigned long); 35extern int sa1100_finish_suspend(unsigned long);
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 318b2b766a0b..ca8bf59b9047 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -9,6 +9,8 @@
9#include <linux/mtd/mtd.h> 9#include <linux/mtd/mtd.h>
10#include <linux/mtd/partitions.h> 10#include <linux/mtd/partitions.h>
11 11
12#include <video/sa1100fb.h>
13
12#include <mach/hardware.h> 14#include <mach/hardware.h>
13#include <asm/mach-types.h> 15#include <asm/mach-types.h>
14#include <asm/setup.h> 16#include <asm/setup.h>
@@ -19,6 +21,7 @@
19#include <asm/mach/serial_sa1100.h> 21#include <asm/mach/serial_sa1100.h>
20#include <mach/mcp.h> 22#include <mach/mcp.h>
21#include <mach/shannon.h> 23#include <mach/shannon.h>
24#include <mach/irqs.h>
22 25
23#include "generic.h" 26#include "generic.h"
24 27
@@ -46,19 +49,32 @@ static struct flash_platform_data shannon_flash_data = {
46 .nr_parts = ARRAY_SIZE(shannon_partitions), 49 .nr_parts = ARRAY_SIZE(shannon_partitions),
47}; 50};
48 51
49static struct resource shannon_flash_resource = { 52static struct resource shannon_flash_resource =
50 .start = SA1100_CS0_PHYS, 53 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_4M);
51 .end = SA1100_CS0_PHYS + SZ_4M - 1,
52 .flags = IORESOURCE_MEM,
53};
54 54
55static struct mcp_plat_data shannon_mcp_data = { 55static struct mcp_plat_data shannon_mcp_data = {
56 .mccr0 = MCCR0_ADM, 56 .mccr0 = MCCR0_ADM,
57 .sclk_rate = 11981000, 57 .sclk_rate = 11981000,
58}; 58};
59 59
60static struct sa1100fb_mach_info shannon_lcd_info = {
61 .pixclock = 152500, .bpp = 8,
62 .xres = 640, .yres = 480,
63
64 .hsync_len = 4, .vsync_len = 3,
65 .left_margin = 2, .upper_margin = 0,
66 .right_margin = 1, .lower_margin = 0,
67
68 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
69
70 .lccr0 = LCCR0_Color | LCCR0_Dual | LCCR0_Pas,
71 .lccr3 = LCCR3_ACBsDiv(512),
72};
73
60static void __init shannon_init(void) 74static void __init shannon_init(void)
61{ 75{
76 sa11x0_ppc_configure_mcp();
77 sa11x0_register_lcd(&shannon_lcd_info);
62 sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1); 78 sa11x0_register_mtd(&shannon_flash_data, &shannon_flash_resource, 1);
63 sa11x0_register_mcp(&shannon_mcp_data); 79 sa11x0_register_mcp(&shannon_mcp_data);
64} 80}
@@ -84,6 +100,7 @@ static void __init shannon_map_io(void)
84MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") 100MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
85 .atag_offset = 0x100, 101 .atag_offset = 0x100,
86 .map_io = shannon_map_io, 102 .map_io = shannon_map_io,
103 .nr_irqs = SA1100_NR_IRQS,
87 .init_irq = sa1100_init_irq, 104 .init_irq = sa1100_init_irq,
88 .timer = &sa1100_timer, 105 .timer = &sa1100_timer,
89 .init_machine = shannon_init, 106 .init_machine = shannon_init,
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index e17c04d6e324..3efae03cb3d7 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -7,15 +7,15 @@
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/tty.h> 8#include <linux/tty.h>
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/string.h> 10#include <linux/string.h>
11#include <linux/pm.h> 11#include <linux/pm.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/mfd/ucb1x00.h>
13#include <linux/mtd/mtd.h> 14#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 15#include <linux/mtd/partitions.h>
15#include <linux/io.h> 16#include <linux/io.h>
16#include <linux/gpio.h> 17#include <linux/gpio.h>
17 18
18#include <asm/irq.h>
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <asm/setup.h> 20#include <asm/setup.h>
21 21
@@ -26,6 +26,7 @@
26#include <asm/mach/serial_sa1100.h> 26#include <asm/mach/serial_sa1100.h>
27#include <mach/mcp.h> 27#include <mach/mcp.h>
28#include <mach/simpad.h> 28#include <mach/simpad.h>
29#include <mach/irqs.h>
29 30
30#include <linux/serial_core.h> 31#include <linux/serial_core.h>
31#include <linux/ioport.h> 32#include <linux/ioport.h>
@@ -176,21 +177,18 @@ static struct flash_platform_data simpad_flash_data = {
176 177
177 178
178static struct resource simpad_flash_resources [] = { 179static struct resource simpad_flash_resources [] = {
179 { 180 DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_16M),
180 .start = SA1100_CS0_PHYS, 181 DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_16M),
181 .end = SA1100_CS0_PHYS + SZ_16M -1, 182};
182 .flags = IORESOURCE_MEM, 183
183 }, { 184static struct ucb1x00_plat_data simpad_ucb1x00_data = {
184 .start = SA1100_CS1_PHYS, 185 .gpio_base = SIMPAD_UCB1X00_GPIO_BASE,
185 .end = SA1100_CS1_PHYS + SZ_16M -1,
186 .flags = IORESOURCE_MEM,
187 }
188}; 186};
189 187
190static struct mcp_plat_data simpad_mcp_data = { 188static struct mcp_plat_data simpad_mcp_data = {
191 .mccr0 = MCCR0_ADM, 189 .mccr0 = MCCR0_ADM,
192 .sclk_rate = 11981000, 190 .sclk_rate = 11981000,
193 .gpio_base = SIMPAD_UCB1X00_GPIO_BASE, 191 .codec_pdata = &simpad_ucb1x00_data,
194}; 192};
195 193
196 194
@@ -376,6 +374,7 @@ static int __init simpad_init(void)
376 374
377 pm_power_off = simpad_power_off; 375 pm_power_off = simpad_power_off;
378 376
377 sa11x0_ppc_configure_mcp();
379 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources, 378 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
380 ARRAY_SIZE(simpad_flash_resources)); 379 ARRAY_SIZE(simpad_flash_resources));
381 sa11x0_register_mcp(&simpad_mcp_data); 380 sa11x0_register_mcp(&simpad_mcp_data);
@@ -394,6 +393,7 @@ MACHINE_START(SIMPAD, "Simpad")
394 /* Maintainer: Holger Freyther */ 393 /* Maintainer: Holger Freyther */
395 .atag_offset = 0x100, 394 .atag_offset = 0x100,
396 .map_io = simpad_map_io, 395 .map_io = simpad_map_io,
396 .nr_irqs = SA1100_NR_IRQS,
397 .init_irq = sa1100_init_irq, 397 .init_irq = sa1100_init_irq,
398 .timer = &sa1100_timer, 398 .timer = &sa1100_timer,
399 .restart = sa11x0_restart, 399 .restart = sa11x0_restart,
diff --git a/arch/arm/mach-sa1100/sleep.S b/arch/arm/mach-sa1100/sleep.S
index e8223315b442..30cc6721665b 100644
--- a/arch/arm/mach-sa1100/sleep.S
+++ b/arch/arm/mach-sa1100/sleep.S
@@ -26,27 +26,36 @@
26 * 26 *
27 * Causes sa11x0 to enter sleep state 27 * Causes sa11x0 to enter sleep state
28 * 28 *
29 * Must be aligned to a cacheline.
29 */ 30 */
30 31 .balign 32
31ENTRY(sa1100_finish_suspend) 32ENTRY(sa1100_finish_suspend)
32 @ disable clock switching 33 @ disable clock switching
33 mcr p15, 0, r1, c15, c2, 2 34 mcr p15, 0, r1, c15, c2, 2
34 35
35 @ Adjust memory timing before lowering CPU clock 36 ldr r6, =MDREFR
36 @ Clock speed adjustment without changing memory timing makes 37 ldr r4, [r6]
37 @ CPU hang in some cases 38 orr r4, r4, #MDREFR_K1DB2
38 ldr r0, =MDREFR 39 ldr r5, =PPCR
39 ldr r1, [r0] 40
40 orr r1, r1, #MDREFR_K1DB2 41 @ Pre-load __udelay into the I-cache
41 str r1, [r0] 42 mov r0, #1
43 bl __udelay
44 mov r0, r0
45
46 @ The following must all exist in a single cache line to
47 @ avoid accessing memory until this sequence is complete,
48 @ otherwise we occasionally hang.
49
50 @ Adjust memory timing before lowering CPU clock
51 str r4, [r6]
42 52
43 @ delay 90us and set CPU PLL to lowest speed 53 @ delay 90us and set CPU PLL to lowest speed
44 @ fixes resume problem on high speed SA1110 54 @ fixes resume problem on high speed SA1110
45 mov r0, #90 55 mov r0, #90
46 bl __udelay 56 bl __udelay
47 ldr r0, =PPCR
48 mov r1, #0 57 mov r1, #0
49 str r1, [r0] 58 str r1, [r5]
50 mov r0, #90 59 mov r0, #90
51 bl __udelay 60 bl __udelay
52 61
@@ -85,12 +94,10 @@ ENTRY(sa1100_finish_suspend)
85 bic r5, r5, #FMsk(MSC_RT) 94 bic r5, r5, #FMsk(MSC_RT)
86 bic r5, r5, #FMsk(MSC_RT)<<16 95 bic r5, r5, #FMsk(MSC_RT)<<16
87 96
88 ldr r6, =MDREFR
89
90 ldr r7, [r6] 97 ldr r7, [r6]
91bic r7, r7, #0x0000FF00 98 bic r7, r7, #0x0000FF00
92bic r7, r7, #0x000000F0 99 bic r7, r7, #0x000000F0
93orr r8, r7, #MDREFR_SLFRSH 100 orr r8, r7, #MDREFR_SLFRSH
94 101
95 ldr r9, =MDCNFG 102 ldr r9, =MDCNFG
96 ldr r10, [r9] 103 ldr r10, [r9]
diff --git a/arch/arm/mach-sa1100/ssp.c b/arch/arm/mach-sa1100/ssp.c
index b20ff93b84a5..e22fca9ad5ec 100644
--- a/arch/arm/mach-sa1100/ssp.c
+++ b/arch/arm/mach-sa1100/ssp.c
@@ -19,8 +19,8 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/irq.h>
23#include <mach/hardware.h> 22#include <mach/hardware.h>
23#include <mach/irqs.h>
24#include <asm/hardware/ssp.h> 24#include <asm/hardware/ssp.h>
25 25
26#define TIMEOUT 100000 26#define TIMEOUT 100000
diff --git a/arch/arm/mach-sa1100/time.c b/arch/arm/mach-sa1100/time.c
index 69e33535dee6..6af26e8d55e6 100644
--- a/arch/arm/mach-sa1100/time.c
+++ b/arch/arm/mach-sa1100/time.c
@@ -18,6 +18,7 @@
18#include <asm/mach/time.h> 18#include <asm/mach/time.h>
19#include <asm/sched_clock.h> 19#include <asm/sched_clock.h>
20#include <mach/hardware.h> 20#include <mach/hardware.h>
21#include <mach/irqs.h>
21 22
22static u32 notrace sa1100_read_sched_clock(void) 23static u32 notrace sa1100_read_sched_clock(void)
23{ 24{
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index 6a2a7f2c2557..2704bcd869cd 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -15,6 +15,7 @@
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <asm/leds.h> 16#include <asm/leds.h>
17#include <asm/param.h> 17#include <asm/param.h>
18#include <asm/system_misc.h>
18 19
19#include <asm/mach/map.h> 20#include <asm/mach/map.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-shark/include/mach/io.h b/arch/arm/mach-shark/include/mach/io.h
index 9ccbcecc430b..1a45fc01ff1d 100644
--- a/arch/arm/mach-shark/include/mach/io.h
+++ b/arch/arm/mach-shark/include/mach/io.h
@@ -15,6 +15,4 @@
15 15
16#define __io(a) ((void __iomem *)(0xe0000000 + (a))) 16#define __io(a) ((void __iomem *)(0xe0000000 + (a)))
17 17
18#define __mem_pci(addr) (addr)
19
20#endif 18#endif
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
index ccd49189bbd0..25609076921f 100644
--- a/arch/arm/mach-shark/leds.c
+++ b/arch/arm/mach-shark/leds.c
@@ -23,7 +23,6 @@
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include <asm/leds.h> 25#include <asm/leds.h>
26#include <asm/system.h>
27 26
28#define LED_STATE_ENABLED 1 27#define LED_STATE_ENABLED 1
29#define LED_STATE_CLAIMED 2 28#define LED_STATE_CLAIMED 2
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 060e5644c49c..34560cab45d9 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -100,6 +100,10 @@ config MACH_MARZEN
100 100
101comment "SH-Mobile System Configuration" 101comment "SH-Mobile System Configuration"
102 102
103config CPU_HAS_INTEVT
104 bool
105 default y
106
103menu "Memory configuration" 107menu "Memory configuration"
104 108
105config MEMORY_START 109config MEMORY_START
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index f50d7c8b1221..cb224a344af0 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -43,6 +43,7 @@
43#include <video/sh_mipi_dsi.h> 43#include <video/sh_mipi_dsi.h>
44#include <sound/sh_fsi.h> 44#include <sound/sh_fsi.h>
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <mach/irqs.h>
46#include <mach/sh73a0.h> 47#include <mach/sh73a0.h>
47#include <mach/common.h> 48#include <mach/common.h>
48#include <asm/mach-types.h> 49#include <asm/mach-types.h>
@@ -584,7 +585,7 @@ static void __init ag5evm_init(void)
584 585
585#ifdef CONFIG_CACHE_L2X0 586#ifdef CONFIG_CACHE_L2X0
586 /* Shared attribute override enable, 64K*8way */ 587 /* Shared attribute override enable, 64K*8way */
587 l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); 588 l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
588#endif 589#endif
589 sh73a0_add_standard_devices(); 590 sh73a0_add_standard_devices();
590 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices)); 591 platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 262f8def5577..b56dde2732bb 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -1186,6 +1186,7 @@ static struct i2c_board_info i2c1_devices[] = {
1186 }, 1186 },
1187}; 1187};
1188 1188
1189
1189#define GPIO_PORT9CR 0xE6051009 1190#define GPIO_PORT9CR 0xE6051009
1190#define GPIO_PORT10CR 0xE605100A 1191#define GPIO_PORT10CR 0xE605100A
1191#define USCCR1 0xE6058144 1192#define USCCR1 0xE6058144
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index 8b2124da245d..81fd95f7f52a 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -35,6 +35,7 @@
35#include <asm/mach/time.h> 35#include <asm/mach/time.h>
36#include <asm/hardware/cache-l2x0.h> 36#include <asm/hardware/cache-l2x0.h>
37#include <mach/r8a7740.h> 37#include <mach/r8a7740.h>
38#include <mach/irqs.h>
38#include <video/sh_mobile_lcdc.h> 39#include <video/sh_mobile_lcdc.h>
39 40
40/* 41/*
@@ -370,7 +371,7 @@ static void __init bonito_init(void)
370 371
371#ifdef CONFIG_CACHE_L2X0 372#ifdef CONFIG_CACHE_L2X0
372 /* Early BRESP enable, Shared attribute override enable, 32K*8way */ 373 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
373 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff); 374 l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
374#endif 375#endif
375 376
376 r8a7740_add_standard_devices(); 377 r8a7740_add_standard_devices();
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
index b627e89037f5..39b6cf85ced6 100644
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -33,6 +33,7 @@
33#include <linux/input.h> 33#include <linux/input.h>
34#include <linux/input/sh_keysc.h> 34#include <linux/input/sh_keysc.h>
35#include <linux/dma-mapping.h> 35#include <linux/dma-mapping.h>
36#include <mach/irqs.h>
36#include <mach/sh7367.h> 37#include <mach/sh7367.h>
37#include <mach/common.h> 38#include <mach/common.h>
38#include <asm/mach-types.h> 39#include <asm/mach-types.h>
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index 46d757d2759d..0e5a39c670bc 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -34,6 +34,7 @@
34#include <linux/mmc/sh_mobile_sdhi.h> 34#include <linux/mmc/sh_mobile_sdhi.h>
35#include <linux/gpio.h> 35#include <linux/gpio.h>
36#include <linux/dma-mapping.h> 36#include <linux/dma-mapping.h>
37#include <mach/irqs.h>
37#include <mach/sh7377.h> 38#include <mach/sh7377.h>
38#include <mach/common.h> 39#include <mach/common.h>
39#include <asm/mach-types.h> 40#include <asm/mach-types.h>
diff --git a/arch/arm/mach-shmobile/board-kota2.c b/arch/arm/mach-shmobile/board-kota2.c
index 61c067294660..200dcd42a3a0 100644
--- a/arch/arm/mach-shmobile/board-kota2.c
+++ b/arch/arm/mach-shmobile/board-kota2.c
@@ -39,6 +39,7 @@
39#include <linux/mfd/tmio.h> 39#include <linux/mfd/tmio.h>
40#include <linux/mmc/sh_mobile_sdhi.h> 40#include <linux/mmc/sh_mobile_sdhi.h>
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/irqs.h>
42#include <mach/sh73a0.h> 43#include <mach/sh73a0.h>
43#include <mach/common.h> 44#include <mach/common.h>
44#include <asm/mach-types.h> 45#include <asm/mach-types.h>
@@ -507,7 +508,7 @@ static void __init kota2_init(void)
507 508
508#ifdef CONFIG_CACHE_L2X0 509#ifdef CONFIG_CACHE_L2X0
509 /* Early BRESP enable, Shared attribute override enable, 64K*8way */ 510 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
510 l2x0_init(__io(0xf0100000), 0x40460000, 0x82000fff); 511 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
511#endif 512#endif
512 sh73a0_add_standard_devices(); 513 sh73a0_add_standard_devices();
513 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices)); 514 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices));
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index bd4253ba05b6..f49e28abe0ab 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -39,6 +39,7 @@
39#include <linux/mtd/mtd.h> 39#include <linux/mtd/mtd.h>
40#include <linux/mtd/partitions.h> 40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/mtd/sh_flctl.h>
42#include <linux/pm_clock.h> 43#include <linux/pm_clock.h>
43#include <linux/smsc911x.h> 44#include <linux/smsc911x.h>
44#include <linux/sh_intc.h> 45#include <linux/sh_intc.h>
@@ -54,6 +55,7 @@
54#include <sound/sh_fsi.h> 55#include <sound/sh_fsi.h>
55 56
56#include <mach/common.h> 57#include <mach/common.h>
58#include <mach/irqs.h>
57#include <mach/sh7372.h> 59#include <mach/sh7372.h>
58 60
59#include <asm/mach/arch.h> 61#include <asm/mach/arch.h>
@@ -955,6 +957,50 @@ static struct platform_device fsi_ak4643_device = {
955 }, 957 },
956}; 958};
957 959
960/* FLCTL */
961static struct mtd_partition nand_partition_info[] = {
962 {
963 .name = "system",
964 .offset = 0,
965 .size = 128 * 1024 * 1024,
966 },
967 {
968 .name = "userdata",
969 .offset = MTDPART_OFS_APPEND,
970 .size = 256 * 1024 * 1024,
971 },
972 {
973 .name = "cache",
974 .offset = MTDPART_OFS_APPEND,
975 .size = 128 * 1024 * 1024,
976 },
977};
978
979static struct resource nand_flash_resources[] = {
980 [0] = {
981 .start = 0xe6a30000,
982 .end = 0xe6a3009b,
983 .flags = IORESOURCE_MEM,
984 }
985};
986
987static struct sh_flctl_platform_data nand_flash_data = {
988 .parts = nand_partition_info,
989 .nr_parts = ARRAY_SIZE(nand_partition_info),
990 .flcmncr_val = CLK_16B_12L_4H | TYPESEL_SET
991 | SHBUSSEL | SEL_16BIT | SNAND_E,
992 .use_holden = 1,
993};
994
995static struct platform_device nand_flash_device = {
996 .name = "sh_flctl",
997 .resource = nand_flash_resources,
998 .num_resources = ARRAY_SIZE(nand_flash_resources),
999 .dev = {
1000 .platform_data = &nand_flash_data,
1001 },
1002};
1003
958/* 1004/*
959 * The card detect pin of the top SD/MMC slot (CN7) is active low and is 1005 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
960 * connected to GPIO A22 of SH7372 (GPIO_PORT41). 1006 * connected to GPIO A22 of SH7372 (GPIO_PORT41).
@@ -1258,6 +1304,7 @@ static struct platform_device *mackerel_devices[] __initdata = {
1258 &fsi_device, 1304 &fsi_device,
1259 &fsi_ak4643_device, 1305 &fsi_ak4643_device,
1260 &fsi_hdmi_device, 1306 &fsi_hdmi_device,
1307 &nand_flash_device,
1261 &sdhi0_device, 1308 &sdhi0_device,
1262#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 1309#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1263 &sdhi1_device, 1310 &sdhi1_device,
@@ -1327,15 +1374,6 @@ static struct i2c_board_info i2c1_devices[] = {
1327 }, 1374 },
1328}; 1375};
1329 1376
1330static void __init mackerel_map_io(void)
1331{
1332 sh7372_map_io();
1333 /* DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
1334 * enough to allocate the frame buffer memory.
1335 */
1336 init_consistent_dma_size(12 << 20);
1337}
1338
1339#define GPIO_PORT9CR 0xE6051009 1377#define GPIO_PORT9CR 0xE6051009
1340#define GPIO_PORT10CR 0xE605100A 1378#define GPIO_PORT10CR 0xE605100A
1341#define GPIO_PORT167CR 0xE60520A7 1379#define GPIO_PORT167CR 0xE60520A7
@@ -1496,6 +1534,30 @@ static void __init mackerel_init(void)
1496 gpio_request(GPIO_FN_MMCCMD0, NULL); 1534 gpio_request(GPIO_FN_MMCCMD0, NULL);
1497 gpio_request(GPIO_FN_MMCCLK0, NULL); 1535 gpio_request(GPIO_FN_MMCCLK0, NULL);
1498 1536
1537 /* FLCTL */
1538 gpio_request(GPIO_FN_D0_NAF0, NULL);
1539 gpio_request(GPIO_FN_D1_NAF1, NULL);
1540 gpio_request(GPIO_FN_D2_NAF2, NULL);
1541 gpio_request(GPIO_FN_D3_NAF3, NULL);
1542 gpio_request(GPIO_FN_D4_NAF4, NULL);
1543 gpio_request(GPIO_FN_D5_NAF5, NULL);
1544 gpio_request(GPIO_FN_D6_NAF6, NULL);
1545 gpio_request(GPIO_FN_D7_NAF7, NULL);
1546 gpio_request(GPIO_FN_D8_NAF8, NULL);
1547 gpio_request(GPIO_FN_D9_NAF9, NULL);
1548 gpio_request(GPIO_FN_D10_NAF10, NULL);
1549 gpio_request(GPIO_FN_D11_NAF11, NULL);
1550 gpio_request(GPIO_FN_D12_NAF12, NULL);
1551 gpio_request(GPIO_FN_D13_NAF13, NULL);
1552 gpio_request(GPIO_FN_D14_NAF14, NULL);
1553 gpio_request(GPIO_FN_D15_NAF15, NULL);
1554 gpio_request(GPIO_FN_FCE0, NULL);
1555 gpio_request(GPIO_FN_WE0_FWE, NULL);
1556 gpio_request(GPIO_FN_FRB, NULL);
1557 gpio_request(GPIO_FN_A4_FOE, NULL);
1558 gpio_request(GPIO_FN_A5_FCDE, NULL);
1559 gpio_request(GPIO_FN_RD_FSC, NULL);
1560
1499 /* enable GPS module (GT-720F) */ 1561 /* enable GPS module (GT-720F) */
1500 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL); 1562 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
1501 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL); 1563 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
@@ -1540,6 +1602,7 @@ static void __init mackerel_init(void)
1540 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device); 1602 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
1541 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs0_device); 1603 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs0_device);
1542 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs1_device); 1604 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs1_device);
1605 sh7372_add_device_to_domain(&sh7372_a3sp, &nand_flash_device);
1543 sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device); 1606 sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
1544 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device); 1607 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
1545#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 1608#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
@@ -1555,7 +1618,7 @@ static void __init mackerel_init(void)
1555} 1618}
1556 1619
1557MACHINE_START(MACKEREL, "mackerel") 1620MACHINE_START(MACKEREL, "mackerel")
1558 .map_io = mackerel_map_io, 1621 .map_io = sh7372_map_io,
1559 .init_early = sh7372_add_early_devices, 1622 .init_early = sh7372_add_early_devices,
1560 .init_irq = sh7372_init_irq, 1623 .init_irq = sh7372_init_irq,
1561 .handle_irq = shmobile_handle_irq_intc, 1624 .handle_irq = shmobile_handle_irq_intc,
diff --git a/arch/arm/mach-shmobile/board-marzen.c b/arch/arm/mach-shmobile/board-marzen.c
index cbd5e4cd06d2..ef0e13bf0b3a 100644
--- a/arch/arm/mach-shmobile/board-marzen.c
+++ b/arch/arm/mach-shmobile/board-marzen.c
@@ -31,6 +31,7 @@
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/r8a7779.h> 32#include <mach/r8a7779.h>
33#include <mach/common.h> 33#include <mach/common.h>
34#include <mach/irqs.h>
34#include <asm/mach-types.h> 35#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
36#include <asm/hardware/gic.h> 37#include <asm/hardware/gic.h>
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index de243e3c8392..94d1f88246d3 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -511,7 +511,7 @@ enum { MSTP001, MSTP000,
511 MSTP223, 511 MSTP223,
512 MSTP218, MSTP217, MSTP216, MSTP214, MSTP208, MSTP207, 512 MSTP218, MSTP217, MSTP216, MSTP214, MSTP208, MSTP207,
513 MSTP206, MSTP205, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 513 MSTP206, MSTP205, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
514 MSTP328, MSTP323, MSTP322, MSTP314, MSTP313, MSTP312, 514 MSTP328, MSTP323, MSTP322, MSTP315, MSTP314, MSTP313, MSTP312,
515 MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP407, MSTP406, 515 MSTP423, MSTP415, MSTP413, MSTP411, MSTP410, MSTP407, MSTP406,
516 MSTP405, MSTP404, MSTP403, MSTP400, 516 MSTP405, MSTP404, MSTP403, MSTP400,
517 MSTP_NR }; 517 MSTP_NR };
@@ -553,6 +553,7 @@ static struct clk mstp_clks[MSTP_NR] = {
553 [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSI2 */ 553 [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSI2 */
554 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */ 554 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
555 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */ 555 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */
556 [MSTP315] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 15, 0), /* FLCTL*/
556 [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */ 557 [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
557 [MSTP313] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */ 558 [MSTP313] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 13, 0), /* SDHI1 */
558 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */ 559 [MSTP312] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 12, 0), /* MMC */
@@ -653,6 +654,7 @@ static struct clk_lookup lookups[] = {
653 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */ 654 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USB0 */
654 CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[MSTP322]), /* USB0 */ 655 CLKDEV_DEV_ID("r8a66597_udc.0", &mstp_clks[MSTP322]), /* USB0 */
655 CLKDEV_DEV_ID("renesas_usbhs.0", &mstp_clks[MSTP322]), /* USB0 */ 656 CLKDEV_DEV_ID("renesas_usbhs.0", &mstp_clks[MSTP322]), /* USB0 */
657 CLKDEV_DEV_ID("sh_flctl.0", &mstp_clks[MSTP315]), /* FLCTL */
656 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */ 658 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
657 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */ 659 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
658 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */ 660 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMC */
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
index 1b2334277e85..7e6559105d40 100644
--- a/arch/arm/mach-shmobile/cpuidle.c
+++ b/arch/arm/mach-shmobile/cpuidle.c
@@ -13,7 +13,7 @@
13#include <linux/suspend.h> 13#include <linux/suspend.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <asm/system.h> 16#include <asm/cpuidle.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19static void shmobile_enter_wfi(void) 19static void shmobile_enter_wfi(void)
@@ -29,37 +29,19 @@ static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
29 struct cpuidle_driver *drv, 29 struct cpuidle_driver *drv,
30 int index) 30 int index)
31{ 31{
32 ktime_t before, after;
33
34 before = ktime_get();
35
36 local_irq_disable();
37 local_fiq_disable();
38
39 shmobile_cpuidle_modes[index](); 32 shmobile_cpuidle_modes[index]();
40 33
41 local_irq_enable();
42 local_fiq_enable();
43
44 after = ktime_get();
45 dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10;
46
47 return index; 34 return index;
48} 35}
49 36
50static struct cpuidle_device shmobile_cpuidle_dev; 37static struct cpuidle_device shmobile_cpuidle_dev;
51static struct cpuidle_driver shmobile_cpuidle_driver = { 38static struct cpuidle_driver shmobile_cpuidle_driver = {
52 .name = "shmobile_cpuidle", 39 .name = "shmobile_cpuidle",
53 .owner = THIS_MODULE, 40 .owner = THIS_MODULE,
54 .states[0] = { 41 .en_core_tk_irqen = 1,
55 .name = "C1", 42 .states[0] = ARM_CPUIDLE_WFI_STATE,
56 .desc = "WFI", 43 .safe_state_index = 0, /* C1 */
57 .exit_latency = 1, 44 .state_count = 1,
58 .target_residency = 1 * 2,
59 .flags = CPUIDLE_FLAG_TIME_VALID,
60 },
61 .safe_state_index = 0, /* C1 */
62 .state_count = 1,
63}; 45};
64 46
65void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); 47void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
diff --git a/arch/arm/mach-shmobile/include/mach/io.h b/arch/arm/mach-shmobile/include/mach/io.h
deleted file mode 100644
index 7339fe46cb7c..000000000000
--- a/arch/arm/mach-shmobile/include/mach/io.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef __ASM_MACH_IO_H
2#define __ASM_MACH_IO_H
3
4#define IO_SPACE_LIMIT 0xffffffff
5
6#define __io(a) ((void __iomem *)(a))
7#define __mem_pci(a) (a)
8
9#endif /* __ASM_MACH_IO_H */
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index dcb714f4d75a..4e686cc201fc 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -1,15 +1,11 @@
1#ifndef __ASM_MACH_IRQS_H 1#ifndef __ASM_MACH_IRQS_H
2#define __ASM_MACH_IRQS_H 2#define __ASM_MACH_IRQS_H
3 3
4#define NR_IRQS 1024 4#include <linux/sh_intc.h>
5 5
6/* GIC */ 6/* GIC */
7#define gic_spi(nr) ((nr) + 32) 7#define gic_spi(nr) ((nr) + 32)
8 8
9/* INTCA */
10#define evt2irq(evt) (((evt) >> 5) - 16)
11#define irq2evt(irq) (((irq) + 16) << 5)
12
13/* INTCS */ 9/* INTCS */
14#define INTCS_VECT_BASE 0x2200 10#define INTCS_VECT_BASE 0x2200
15#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect)) 11#define INTCS_VECT(n, vect) INTC_VECT((n), INTCS_VECT_BASE + (vect))
diff --git a/arch/arm/mach-shmobile/include/mach/system.h b/arch/arm/mach-shmobile/include/mach/system.h
index 3bbcb3fa0775..540eaff08f34 100644
--- a/arch/arm/mach-shmobile/include/mach/system.h
+++ b/arch/arm/mach-shmobile/include/mach/system.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_ARCH_SYSTEM_H 1#ifndef __ASM_ARCH_SYSTEM_H
2#define __ASM_ARCH_SYSTEM_H 2#define __ASM_ARCH_SYSTEM_H
3 3
4#include <asm/system_misc.h>
5
4static inline void arch_reset(char mode, const char *cmd) 6static inline void arch_reset(char mode, const char *cmd)
5{ 7{
6 soft_restart(0); 8 soft_restart(0);
diff --git a/arch/arm/mach-shmobile/intc-r8a7740.c b/arch/arm/mach-shmobile/intc-r8a7740.c
index 272c84c20c83..09c42afcb22d 100644
--- a/arch/arm/mach-shmobile/intc-r8a7740.c
+++ b/arch/arm/mach-shmobile/intc-r8a7740.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/sh_intc.h> 26#include <linux/sh_intc.h>
27#include <mach/intc.h> 27#include <mach/intc.h>
28#include <mach/irqs.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
30 31
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 5d92fcde2bc3..550b23df4fd4 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -42,8 +42,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
42 42
43void __init r8a7779_init_irq(void) 43void __init r8a7779_init_irq(void)
44{ 44{
45 void __iomem *gic_dist_base = __io(0xf0001000); 45 void __iomem *gic_dist_base = IOMEM(0xf0001000);
46 void __iomem *gic_cpu_base = __io(0xf0000100); 46 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
47 47
48 /* use GIC to handle interrupts */ 48 /* use GIC to handle interrupts */
49 gic_init(0, 29, gic_dist_base, gic_cpu_base); 49 gic_init(0, 29, gic_dist_base, gic_cpu_base);
diff --git a/arch/arm/mach-shmobile/intc-sh7367.c b/arch/arm/mach-shmobile/intc-sh7367.c
index cfde9bfc3669..5bf776495b75 100644
--- a/arch/arm/mach-shmobile/intc-sh7367.c
+++ b/arch/arm/mach-shmobile/intc-sh7367.c
@@ -23,6 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sh_intc.h> 24#include <linux/sh_intc.h>
25#include <mach/intc.h> 25#include <mach/intc.h>
26#include <mach/irqs.h>
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28 29
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 89afcaba99a1..6447e0af52d4 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -23,6 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sh_intc.h> 24#include <linux/sh_intc.h>
25#include <mach/intc.h> 25#include <mach/intc.h>
26#include <mach/irqs.h>
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28 29
diff --git a/arch/arm/mach-shmobile/intc-sh7377.c b/arch/arm/mach-shmobile/intc-sh7377.c
index 2af4e6e9bc5b..b84a460a3405 100644
--- a/arch/arm/mach-shmobile/intc-sh7377.c
+++ b/arch/arm/mach-shmobile/intc-sh7377.c
@@ -23,6 +23,7 @@
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/sh_intc.h> 24#include <linux/sh_intc.h>
25#include <mach/intc.h> 25#include <mach/intc.h>
26#include <mach/irqs.h>
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28 29
diff --git a/arch/arm/mach-shmobile/intc-sh73a0.c b/arch/arm/mach-shmobile/intc-sh73a0.c
index 9857595eaa79..ee447404c857 100644
--- a/arch/arm/mach-shmobile/intc-sh73a0.c
+++ b/arch/arm/mach-shmobile/intc-sh73a0.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/sh_intc.h> 25#include <linux/sh_intc.h>
26#include <mach/intc.h> 26#include <mach/intc.h>
27#include <mach/irqs.h>
27#include <mach/sh73a0.h> 28#include <mach/sh73a0.h>
28#include <asm/hardware/gic.h> 29#include <asm/hardware/gic.h>
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
@@ -420,8 +421,8 @@ static irqreturn_t sh73a0_pint1_demux(int irq, void *dev_id)
420 421
421void __init sh73a0_init_irq(void) 422void __init sh73a0_init_irq(void)
422{ 423{
423 void __iomem *gic_dist_base = __io(0xf0001000); 424 void __iomem *gic_dist_base = IOMEM(0xf0001000);
424 void __iomem *gic_cpu_base = __io(0xf0000100); 425 void __iomem *gic_cpu_base = IOMEM(0xf0000100);
425 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); 426 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE);
426 int k, n; 427 int k, n;
427 428
diff --git a/arch/arm/mach-shmobile/pm-r8a7779.c b/arch/arm/mach-shmobile/pm-r8a7779.c
index c38ba7b43ef8..a18a4ae16d2b 100644
--- a/arch/arm/mach-shmobile/pm-r8a7779.c
+++ b/arch/arm/mach-shmobile/pm-r8a7779.c
@@ -18,7 +18,6 @@
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/console.h> 20#include <linux/console.h>
21#include <asm/system.h>
22#include <asm/io.h> 21#include <asm/io.h>
23#include <mach/common.h> 22#include <mach/common.h>
24#include <mach/r8a7779.h> 23#include <mach/r8a7779.h>
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index fcf8b1761aef..a3bdb12acde9 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -21,7 +21,6 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/bitrev.h> 22#include <linux/bitrev.h>
23#include <linux/console.h> 23#include <linux/console.h>
24#include <asm/system.h>
25#include <asm/io.h> 24#include <asm/io.h>
26#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
27#include <asm/suspend.h> 26#include <asm/suspend.h>
diff --git a/arch/arm/mach-shmobile/setup-r8a7740.c b/arch/arm/mach-shmobile/setup-r8a7740.c
index 74e52341dd1b..14edb5cffa7f 100644
--- a/arch/arm/mach-shmobile/setup-r8a7740.c
+++ b/arch/arm/mach-shmobile/setup-r8a7740.c
@@ -26,6 +26,7 @@
26#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
27#include <mach/r8a7740.h> 27#include <mach/r8a7740.h>
28#include <mach/common.h> 28#include <mach/common.h>
29#include <mach/irqs.h>
29#include <asm/mach-types.h> 30#include <asm/mach-types.h>
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index 6820d785493d..12c6f529ab89 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -29,6 +29,7 @@
29#include <linux/sh_intc.h> 29#include <linux/sh_intc.h>
30#include <linux/sh_timer.h> 30#include <linux/sh_timer.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/irqs.h>
32#include <mach/r8a7779.h> 33#include <mach/r8a7779.h>
33#include <mach/common.h> 34#include <mach/common.h>
34#include <asm/mach-types.h> 35#include <asm/mach-types.h>
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
index a51e1a1e6996..2e3074ab75b3 100644
--- a/arch/arm/mach-shmobile/setup-sh7367.c
+++ b/arch/arm/mach-shmobile/setup-sh7367.c
@@ -30,6 +30,7 @@
30#include <linux/sh_timer.h> 30#include <linux/sh_timer.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/common.h> 32#include <mach/common.h>
33#include <mach/irqs.h>
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
35#include <asm/mach/map.h> 36#include <asm/mach/map.h>
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 5375325d7ca7..2fe8f83ca124 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -31,7 +31,9 @@
31#include <linux/sh_intc.h> 31#include <linux/sh_intc.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/pm_domain.h> 33#include <linux/pm_domain.h>
34#include <linux/dma-mapping.h>
34#include <mach/hardware.h> 35#include <mach/hardware.h>
36#include <mach/irqs.h>
35#include <mach/sh7372.h> 37#include <mach/sh7372.h>
36#include <mach/common.h> 38#include <mach/common.h>
37#include <asm/mach/map.h> 39#include <asm/mach/map.h>
@@ -54,6 +56,12 @@ static struct map_desc sh7372_io_desc[] __initdata = {
54void __init sh7372_map_io(void) 56void __init sh7372_map_io(void)
55{ 57{
56 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc)); 58 iotable_init(sh7372_io_desc, ARRAY_SIZE(sh7372_io_desc));
59
60 /*
61 * DMA memory at 0xff200000 - 0xffdfffff. The default 2MB size isn't
62 * enough to allocate the frame buffer memory.
63 */
64 init_consistent_dma_size(12 << 20);
57} 65}
58 66
59/* SCIFA0 */ 67/* SCIFA0 */
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c
index 9f146095098b..d576a6abbade 100644
--- a/arch/arm/mach-shmobile/setup-sh7377.c
+++ b/arch/arm/mach-shmobile/setup-sh7377.c
@@ -32,6 +32,7 @@
32#include <mach/hardware.h> 32#include <mach/hardware.h>
33#include <mach/common.h> 33#include <mach/common.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35#include <mach/irqs.h>
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
37#include <asm/mach/time.h> 38#include <asm/mach/time.h>
diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c
index b6a0734a738e..5bebffc10455 100644
--- a/arch/arm/mach-shmobile/setup-sh73a0.c
+++ b/arch/arm/mach-shmobile/setup-sh73a0.c
@@ -31,6 +31,7 @@
31#include <linux/sh_intc.h> 31#include <linux/sh_intc.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <mach/hardware.h> 33#include <mach/hardware.h>
34#include <mach/irqs.h>
34#include <mach/sh73a0.h> 35#include <mach/sh73a0.h>
35#include <mach/common.h> 36#include <mach/common.h>
36#include <asm/mach-types.h> 37#include <asm/mach-types.h>
diff --git a/arch/arm/mach-shmobile/smp-r8a7779.c b/arch/arm/mach-shmobile/smp-r8a7779.c
index 9bb7b8575a1f..b62e19d4c9af 100644
--- a/arch/arm/mach-shmobile/smp-r8a7779.c
+++ b/arch/arm/mach-shmobile/smp-r8a7779.c
@@ -30,7 +30,7 @@
30#include <asm/smp_twd.h> 30#include <asm/smp_twd.h>
31#include <asm/hardware/gic.h> 31#include <asm/hardware/gic.h>
32 32
33#define AVECR 0xfe700040 33#define AVECR IOMEM(0xfe700040)
34 34
35static struct r8a7779_pm_ch r8a7779_ch_cpu1 = { 35static struct r8a7779_pm_ch r8a7779_ch_cpu1 = {
36 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 36 .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */
@@ -138,7 +138,7 @@ void __init r8a7779_smp_prepare_cpus(void)
138 scu_enable(scu_base_addr()); 138 scu_enable(scu_base_addr());
139 139
140 /* Map the reset vector (in headsmp.S) */ 140 /* Map the reset vector (in headsmp.S) */
141 __raw_writel(__pa(shmobile_secondary_vector), __io(AVECR)); 141 __raw_writel(__pa(shmobile_secondary_vector), AVECR);
142 142
143 /* enable cache coherency on CPU0 */ 143 /* enable cache coherency on CPU0 */
144 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 144 modify_scu_cpu_psr(0, 3 << (cpu * 8));
diff --git a/arch/arm/mach-shmobile/smp-sh73a0.c b/arch/arm/mach-shmobile/smp-sh73a0.c
index c0a9093ba3a8..14ad8b052f1a 100644
--- a/arch/arm/mach-shmobile/smp-sh73a0.c
+++ b/arch/arm/mach-shmobile/smp-sh73a0.c
@@ -28,11 +28,11 @@
28#include <asm/smp_twd.h> 28#include <asm/smp_twd.h>
29#include <asm/hardware/gic.h> 29#include <asm/hardware/gic.h>
30 30
31#define WUPCR 0xe6151010 31#define WUPCR IOMEM(0xe6151010)
32#define SRESCR 0xe6151018 32#define SRESCR IOMEM(0xe6151018)
33#define PSTR 0xe6151040 33#define PSTR IOMEM(0xe6151040)
34#define SBAR 0xe6180020 34#define SBAR IOMEM(0xe6180020)
35#define APARMBAREA 0xe6f10020 35#define APARMBAREA IOMEM(0xe6f10020)
36 36
37static void __iomem *scu_base_addr(void) 37static void __iomem *scu_base_addr(void)
38{ 38{
@@ -78,10 +78,10 @@ int __cpuinit sh73a0_boot_secondary(unsigned int cpu)
78 /* enable cache coherency */ 78 /* enable cache coherency */
79 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 79 modify_scu_cpu_psr(0, 3 << (cpu * 8));
80 80
81 if (((__raw_readl(__io(PSTR)) >> (4 * cpu)) & 3) == 3) 81 if (((__raw_readl(PSTR) >> (4 * cpu)) & 3) == 3)
82 __raw_writel(1 << cpu, __io(WUPCR)); /* wake up */ 82 __raw_writel(1 << cpu, WUPCR); /* wake up */
83 else 83 else
84 __raw_writel(1 << cpu, __io(SRESCR)); /* reset */ 84 __raw_writel(1 << cpu, SRESCR); /* reset */
85 85
86 return 0; 86 return 0;
87} 87}
@@ -93,8 +93,8 @@ void __init sh73a0_smp_prepare_cpus(void)
93 scu_enable(scu_base_addr()); 93 scu_enable(scu_base_addr());
94 94
95 /* Map the reset vector (in headsmp.S) */ 95 /* Map the reset vector (in headsmp.S) */
96 __raw_writel(0, __io(APARMBAREA)); /* 4k */ 96 __raw_writel(0, APARMBAREA); /* 4k */
97 __raw_writel(__pa(shmobile_secondary_vector), __io(SBAR)); 97 __raw_writel(__pa(shmobile_secondary_vector), SBAR);
98 98
99 /* enable cache coherency on CPU0 */ 99 /* enable cache coherency on CPU0 */
100 modify_scu_cpu_psr(0, 3 << (cpu * 8)); 100 modify_scu_cpu_psr(0, 3 << (cpu * 8));
diff --git a/arch/arm/mach-shmobile/suspend.c b/arch/arm/mach-shmobile/suspend.c
index c1febe13f709..4d1b86a49923 100644
--- a/arch/arm/mach-shmobile/suspend.c
+++ b/arch/arm/mach-shmobile/suspend.c
@@ -12,8 +12,8 @@
12#include <linux/suspend.h> 12#include <linux/suspend.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/err.h> 14#include <linux/err.h>
15#include <asm/system.h>
16#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/system_misc.h>
17 17
18static int shmobile_suspend_default_enter(suspend_state_t suspend_state) 18static int shmobile_suspend_default_enter(suspend_state_t suspend_state)
19{ 19{
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index f67860cd649f..6c4841f55223 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <asm/mach-types.h> 17#include <asm/mach-types.h>
17#include <plat/clock.h> 18#include <plat/clock.h>
diff --git a/arch/arm/mach-spear3xx/include/mach/io.h b/arch/arm/mach-spear3xx/include/mach/io.h
deleted file mode 100644
index 30cff8a1f6b5..000000000000
--- a/arch/arm/mach-spear3xx/include/mach/io.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * arch/arm/mach-spear3xx/include/mach/io.h
3 *
4 * IO definitions for SPEAr3xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_IO_H
15#define __MACH_IO_H
16
17#include <plat/io.h>
18
19#endif /* __MACH_IO_H */
diff --git a/arch/arm/mach-spear6xx/Kconfig b/arch/arm/mach-spear6xx/Kconfig
index ff4ae5ba00f1..fbe298bd1d92 100644
--- a/arch/arm/mach-spear6xx/Kconfig
+++ b/arch/arm/mach-spear6xx/Kconfig
@@ -5,11 +5,12 @@
5if ARCH_SPEAR6XX 5if ARCH_SPEAR6XX
6 6
7menu "SPEAr6xx Implementations" 7menu "SPEAr6xx Implementations"
8config BOARD_SPEAR600_EVB 8config BOARD_SPEAR600_DT
9 bool "SPEAr600 Evaluation Board" 9 bool "SPEAr600 generic board configured via device-tree"
10 select MACH_SPEAR600 10 select MACH_SPEAR600
11 select USE_OF
11 help 12 help
12 Supports ST SPEAr600 Evaluation Board 13 Supports ST SPEAr600 boards configured via the device-tree
13 14
14endmenu 15endmenu
15 16
diff --git a/arch/arm/mach-spear6xx/Makefile b/arch/arm/mach-spear6xx/Makefile
index cc1a4d82d459..76e5750552fc 100644
--- a/arch/arm/mach-spear6xx/Makefile
+++ b/arch/arm/mach-spear6xx/Makefile
@@ -4,9 +4,3 @@
4 4
5# common files 5# common files
6obj-y += clock.o spear6xx.o 6obj-y += clock.o spear6xx.o
7
8# spear600 specific files
9obj-$(CONFIG_MACH_SPEAR600) += spear600.o
10
11# spear600 boards files
12obj-$(CONFIG_BOARD_SPEAR600_EVB) += spear600_evb.o
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c
index ac70e0d88fef..a86499a8a15f 100644
--- a/arch/arm/mach-spear6xx/clock.c
+++ b/arch/arm/mach-spear6xx/clock.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <plat/clock.h> 17#include <plat/clock.h>
17#include <mach/misc_regs.h> 18#include <mach/misc_regs.h>
@@ -641,8 +642,8 @@ static struct clk_lookup spear_clk_lookups[] = {
641 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk}, 642 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk},
642 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk}, 643 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk},
643 { .con_id = "gpt3_synth_clk", .clk = &gpt3_synth_clk}, 644 { .con_id = "gpt3_synth_clk", .clk = &gpt3_synth_clk},
644 { .dev_id = "uart0", .clk = &uart0_clk}, 645 { .dev_id = "d0000000.serial", .clk = &uart0_clk},
645 { .dev_id = "uart1", .clk = &uart1_clk}, 646 { .dev_id = "d0080000.serial", .clk = &uart1_clk},
646 { .dev_id = "firda", .clk = &firda_clk}, 647 { .dev_id = "firda", .clk = &firda_clk},
647 { .dev_id = "clcd", .clk = &clcd_clk}, 648 { .dev_id = "clcd", .clk = &clcd_clk},
648 { .dev_id = "gpt0", .clk = &gpt0_clk}, 649 { .dev_id = "gpt0", .clk = &gpt0_clk},
@@ -655,20 +656,20 @@ static struct clk_lookup spear_clk_lookups[] = {
655 { .con_id = "usbh.1_clk", .clk = &usbh1_clk}, 656 { .con_id = "usbh.1_clk", .clk = &usbh1_clk},
656 /* clock derived from ahb clk */ 657 /* clock derived from ahb clk */
657 { .con_id = "apb_clk", .clk = &apb_clk}, 658 { .con_id = "apb_clk", .clk = &apb_clk},
658 { .dev_id = "i2c_designware.0", .clk = &i2c_clk}, 659 { .dev_id = "d0200000.i2c", .clk = &i2c_clk},
659 { .dev_id = "dma", .clk = &dma_clk}, 660 { .dev_id = "dma", .clk = &dma_clk},
660 { .dev_id = "jpeg", .clk = &jpeg_clk}, 661 { .dev_id = "jpeg", .clk = &jpeg_clk},
661 { .dev_id = "gmac", .clk = &gmac_clk}, 662 { .dev_id = "gmac", .clk = &gmac_clk},
662 { .dev_id = "smi", .clk = &smi_clk}, 663 { .dev_id = "smi", .clk = &smi_clk},
663 { .con_id = "fsmc", .clk = &fsmc_clk}, 664 { .dev_id = "fsmc-nand", .clk = &fsmc_clk},
664 /* clock derived from apb clk */ 665 /* clock derived from apb clk */
665 { .dev_id = "adc", .clk = &adc_clk}, 666 { .dev_id = "adc", .clk = &adc_clk},
666 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk}, 667 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk},
667 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk}, 668 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk},
668 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk}, 669 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk},
669 { .dev_id = "gpio0", .clk = &gpio0_clk}, 670 { .dev_id = "f0100000.gpio", .clk = &gpio0_clk},
670 { .dev_id = "gpio1", .clk = &gpio1_clk}, 671 { .dev_id = "fc980000.gpio", .clk = &gpio1_clk},
671 { .dev_id = "gpio2", .clk = &gpio2_clk}, 672 { .dev_id = "d8100000.gpio", .clk = &gpio2_clk},
672}; 673};
673 674
674void __init spear6xx_clk_init(void) 675void __init spear6xx_clk_init(void)
diff --git a/arch/arm/mach-spear6xx/include/mach/io.h b/arch/arm/mach-spear6xx/include/mach/io.h
deleted file mode 100644
index fb7c106cea94..000000000000
--- a/arch/arm/mach-spear6xx/include/mach/io.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/include/mach/io.h
3 *
4 * IO definitions for SPEAr6xx machine family
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __MACH_IO_H
15#define __MACH_IO_H
16
17#include <plat/io.h>
18
19#endif /* __MACH_IO_H */
20
diff --git a/arch/arm/mach-spear6xx/spear600.c b/arch/arm/mach-spear6xx/spear600.c
deleted file mode 100644
index d0e6eeae9b04..000000000000
--- a/arch/arm/mach-spear6xx/spear600.c
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/spear600.c
3 *
4 * SPEAr600 machine source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <linux/ptrace.h>
15#include <asm/irq.h>
16#include <mach/generic.h>
17#include <mach/hardware.h>
18
19/* Add spear600 specific devices here */
20
21void __init spear600_init(void)
22{
23 /* call spear6xx family common init function */
24 spear6xx_init();
25}
diff --git a/arch/arm/mach-spear6xx/spear600_evb.c b/arch/arm/mach-spear6xx/spear600_evb.c
deleted file mode 100644
index c6e4254741cc..000000000000
--- a/arch/arm/mach-spear6xx/spear600_evb.c
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * arch/arm/mach-spear6xx/spear600_evb.c
3 *
4 * SPEAr600 evaluation board source file
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#include <asm/hardware/vic.h>
15#include <asm/mach/arch.h>
16#include <asm/mach-types.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19
20static struct amba_device *amba_devs[] __initdata = {
21 &gpio_device[0],
22 &gpio_device[1],
23 &gpio_device[2],
24 &uart_device[0],
25 &uart_device[1],
26};
27
28static struct platform_device *plat_devs[] __initdata = {
29};
30
31static void __init spear600_evb_init(void)
32{
33 unsigned int i;
34
35 /* call spear600 machine init function */
36 spear600_init();
37
38 /* Add Platform Devices */
39 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
40
41 /* Add Amba Devices */
42 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
43 amba_device_register(amba_devs[i], &iomem_resource);
44}
45
46MACHINE_START(SPEAR600, "ST-SPEAR600-EVB")
47 .atag_offset = 0x100,
48 .map_io = spear6xx_map_io,
49 .init_irq = spear6xx_init_irq,
50 .handle_irq = vic_handle_irq,
51 .timer = &spear6xx_timer,
52 .init_machine = spear600_evb_init,
53 .restart = spear_restart,
54MACHINE_END
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c
index b997b1b10ba0..2ed8b14c82c8 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear6xx/spear6xx.c
@@ -6,111 +6,21 @@
6 * Copyright (C) 2009 ST Microelectronics 6 * Copyright (C) 2009 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar<rajeev-dlh.kumar@st.com>
8 * 8 *
9 * Copyright 2012 Stefan Roese <sr@denx.de>
10 *
9 * This file is licensed under the terms of the GNU General Public 11 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 12 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied. 13 * warranty of any kind, whether express or implied.
12 */ 14 */
13 15
14#include <linux/types.h> 16#include <linux/of.h>
15#include <linux/amba/pl061.h> 17#include <linux/of_address.h>
16#include <linux/ptrace.h> 18#include <linux/of_irq.h>
17#include <linux/io.h> 19#include <linux/of_platform.h>
18#include <asm/hardware/vic.h> 20#include <asm/hardware/vic.h>
19#include <asm/irq.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
21#include <mach/generic.h> 22#include <mach/generic.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/irqs.h>
24
25/* Add spear6xx machines common devices here */
26/* uart device registration */
27struct amba_device uart_device[] = {
28 {
29 .dev = {
30 .init_name = "uart0",
31 },
32 .res = {
33 .start = SPEAR6XX_ICM1_UART0_BASE,
34 .end = SPEAR6XX_ICM1_UART0_BASE + SZ_4K - 1,
35 .flags = IORESOURCE_MEM,
36 },
37 .irq = {IRQ_UART_0},
38 }, {
39 .dev = {
40 .init_name = "uart1",
41 },
42 .res = {
43 .start = SPEAR6XX_ICM1_UART1_BASE,
44 .end = SPEAR6XX_ICM1_UART1_BASE + SZ_4K - 1,
45 .flags = IORESOURCE_MEM,
46 },
47 .irq = {IRQ_UART_1},
48 }
49};
50
51/* gpio device registration */
52static struct pl061_platform_data gpio_plat_data[] = {
53 {
54 .gpio_base = 0,
55 .irq_base = SPEAR_GPIO0_INT_BASE,
56 }, {
57 .gpio_base = 8,
58 .irq_base = SPEAR_GPIO1_INT_BASE,
59 }, {
60 .gpio_base = 16,
61 .irq_base = SPEAR_GPIO2_INT_BASE,
62 },
63};
64
65struct amba_device gpio_device[] = {
66 {
67 .dev = {
68 .init_name = "gpio0",
69 .platform_data = &gpio_plat_data[0],
70 },
71 .res = {
72 .start = SPEAR6XX_CPU_GPIO_BASE,
73 .end = SPEAR6XX_CPU_GPIO_BASE + SZ_4K - 1,
74 .flags = IORESOURCE_MEM,
75 },
76 .irq = {IRQ_LOCAL_GPIO},
77 }, {
78 .dev = {
79 .init_name = "gpio1",
80 .platform_data = &gpio_plat_data[1],
81 },
82 .res = {
83 .start = SPEAR6XX_ICM3_GPIO_BASE,
84 .end = SPEAR6XX_ICM3_GPIO_BASE + SZ_4K - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 .irq = {IRQ_BASIC_GPIO},
88 }, {
89 .dev = {
90 .init_name = "gpio2",
91 .platform_data = &gpio_plat_data[2],
92 },
93 .res = {
94 .start = SPEAR6XX_ICM2_GPIO_BASE,
95 .end = SPEAR6XX_ICM2_GPIO_BASE + SZ_4K - 1,
96 .flags = IORESOURCE_MEM,
97 },
98 .irq = {IRQ_APPL_GPIO},
99 }
100};
101
102/* This will add devices, and do machine specific tasks */
103void __init spear6xx_init(void)
104{
105 /* nothing to do for now */
106}
107
108/* This will initialize vic */
109void __init spear6xx_init_irq(void)
110{
111 vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_PRI_BASE, 0, ~0, 0);
112 vic_init((void __iomem *)VA_SPEAR6XX_CPU_VIC_SEC_BASE, 32, ~0, 0);
113}
114 24
115/* Following will create static virtual/physical mappings */ 25/* Following will create static virtual/physical mappings */
116static struct map_desc spear6xx_io_desc[] __initdata = { 26static struct map_desc spear6xx_io_desc[] __initdata = {
@@ -181,3 +91,33 @@ static void __init spear6xx_timer_init(void)
181struct sys_timer spear6xx_timer = { 91struct sys_timer spear6xx_timer = {
182 .init = spear6xx_timer_init, 92 .init = spear6xx_timer_init,
183}; 93};
94
95static void __init spear600_dt_init(void)
96{
97 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
98}
99
100static const char *spear600_dt_board_compat[] = {
101 "st,spear600",
102 NULL
103};
104
105static const struct of_device_id vic_of_match[] __initconst = {
106 { .compatible = "arm,pl190-vic", .data = vic_of_init, },
107 { /* Sentinel */ }
108};
109
110static void __init spear6xx_dt_init_irq(void)
111{
112 of_irq_init(vic_of_match);
113}
114
115DT_MACHINE_START(SPEAR600_DT, "ST SPEAr600 (Flattened Device Tree)")
116 .map_io = spear6xx_map_io,
117 .init_irq = spear6xx_dt_init_irq,
118 .handle_irq = vic_handle_irq,
119 .timer = &spear6xx_timer,
120 .init_machine = spear600_dt_init,
121 .restart = spear_restart,
122 .dt_compat = spear600_dt_board_compat,
123MACHINE_END
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 1dd2726986cf..d87d968115ec 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -8,6 +8,7 @@ obj-y += timer.o
8obj-y += pinmux.o 8obj-y += pinmux.o
9obj-y += fuse.o 9obj-y += fuse.o
10obj-y += pmc.o 10obj-y += pmc.o
11obj-y += flowctrl.o
11obj-$(CONFIG_CPU_IDLE) += cpuidle.o 12obj-$(CONFIG_CPU_IDLE) += cpuidle.o
12obj-$(CONFIG_CPU_IDLE) += sleep.o 13obj-$(CONFIG_CPU_IDLE) += sleep.o
13obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o 14obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += powergate.o
@@ -18,6 +19,7 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += pinmux-tegra30-tables.o
18obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o 19obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += board-dt-tegra30.o
19obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o 20obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += tegra30_clocks.o
20obj-$(CONFIG_SMP) += platsmp.o headsmp.o 21obj-$(CONFIG_SMP) += platsmp.o headsmp.o
22obj-$(CONFIG_SMP) += reset.o
21obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 23obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
22obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o apbio.o 24obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o apbio.o
23obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o 25obj-$(CONFIG_CPU_FREQ) += cpu-tegra.o
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index e20b419d5983..0952494f481a 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -68,11 +68,11 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
68 OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S2_BASE, "tegra-i2s.1", NULL), 68 OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S2_BASE, "tegra-i2s.1", NULL),
69 OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL), 69 OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL),
70 OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB_BASE, "tegra-ehci.0", 70 OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB_BASE, "tegra-ehci.0",
71 &tegra_ehci1_device.dev.platform_data), 71 &tegra_ehci1_pdata),
72 OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB2_BASE, "tegra-ehci.1", 72 OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB2_BASE, "tegra-ehci.1",
73 &tegra_ehci2_device.dev.platform_data), 73 &tegra_ehci2_pdata),
74 OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB3_BASE, "tegra-ehci.2", 74 OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB3_BASE, "tegra-ehci.2",
75 &tegra_ehci3_device.dev.platform_data), 75 &tegra_ehci3_pdata),
76 {} 76 {}
77}; 77};
78 78
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index 96f6c0d030bd..5f7c03e972f3 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -56,7 +56,7 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
56 56
57static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = { 57static __initdata struct tegra_clk_init_table tegra_dt_clk_init_table[] = {
58 /* name parent rate enabled */ 58 /* name parent rate enabled */
59 { "uartd", "pll_p", 408000000, true }, 59 { "uarta", "pll_p", 408000000, true },
60 { NULL, NULL, 0, 0}, 60 { NULL, NULL, 0, 0},
61}; 61};
62 62
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 2f86fcca64a6..22df10fb9972 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -27,6 +27,7 @@
27#include <asm/hardware/gic.h> 27#include <asm/hardware/gic.h>
28 28
29#include <mach/iomap.h> 29#include <mach/iomap.h>
30#include <mach/powergate.h>
30 31
31#include "board.h" 32#include "board.h"
32#include "clock.h" 33#include "clock.h"
@@ -118,13 +119,16 @@ void __init tegra20_init_early(void)
118 tegra_clk_init_from_table(tegra20_clk_init_table); 119 tegra_clk_init_from_table(tegra20_clk_init_table);
119 tegra_init_cache(0x331, 0x441); 120 tegra_init_cache(0x331, 0x441);
120 tegra_pmc_init(); 121 tegra_pmc_init();
122 tegra_powergate_init();
121} 123}
122#endif 124#endif
123#ifdef CONFIG_ARCH_TEGRA_3x_SOC 125#ifdef CONFIG_ARCH_TEGRA_3x_SOC
124void __init tegra30_init_early(void) 126void __init tegra30_init_early(void)
125{ 127{
128 tegra_init_fuse();
126 tegra30_init_clocks(); 129 tegra30_init_clocks();
127 tegra_init_cache(0x441, 0x551); 130 tegra_init_cache(0x441, 0x551);
128 tegra_pmc_init(); 131 tegra_pmc_init();
132 tegra_powergate_init();
129} 133}
130#endif 134#endif
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index bb5ce39b733b..7a065f0cf633 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -30,7 +30,6 @@
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/suspend.h> 31#include <linux/suspend.h>
32 32
33#include <asm/system.h>
34 33
35#include <mach/clk.h> 34#include <mach/clk.h>
36 35
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 7a2a02dbd632..5f6b867e20b4 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -23,7 +23,6 @@
23#include <linux/fsl_devices.h> 23#include <linux/fsl_devices.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25#include <linux/i2c-tegra.h> 25#include <linux/i2c-tegra.h>
26#include <linux/platform_data/tegra_usb.h>
27#include <asm/pmu.h> 26#include <asm/pmu.h>
28#include <mach/irqs.h> 27#include <mach/irqs.h>
29#include <mach/iomap.h> 28#include <mach/iomap.h>
@@ -446,18 +445,18 @@ static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
446 .clk = "cdev2", 445 .clk = "cdev2",
447}; 446};
448 447
449static struct tegra_ehci_platform_data tegra_ehci1_pdata = { 448struct tegra_ehci_platform_data tegra_ehci1_pdata = {
450 .operating_mode = TEGRA_USB_OTG, 449 .operating_mode = TEGRA_USB_OTG,
451 .power_down_on_bus_suspend = 1, 450 .power_down_on_bus_suspend = 1,
452}; 451};
453 452
454static struct tegra_ehci_platform_data tegra_ehci2_pdata = { 453struct tegra_ehci_platform_data tegra_ehci2_pdata = {
455 .phy_config = &tegra_ehci2_ulpi_phy_config, 454 .phy_config = &tegra_ehci2_ulpi_phy_config,
456 .operating_mode = TEGRA_USB_HOST, 455 .operating_mode = TEGRA_USB_HOST,
457 .power_down_on_bus_suspend = 1, 456 .power_down_on_bus_suspend = 1,
458}; 457};
459 458
460static struct tegra_ehci_platform_data tegra_ehci3_pdata = { 459struct tegra_ehci_platform_data tegra_ehci3_pdata = {
461 .operating_mode = TEGRA_USB_HOST, 460 .operating_mode = TEGRA_USB_HOST,
462 .power_down_on_bus_suspend = 1, 461 .power_down_on_bus_suspend = 1,
463}; 462};
diff --git a/arch/arm/mach-tegra/devices.h b/arch/arm/mach-tegra/devices.h
index 873ecb2f8ae6..ec455679b219 100644
--- a/arch/arm/mach-tegra/devices.h
+++ b/arch/arm/mach-tegra/devices.h
@@ -20,6 +20,11 @@
20#define __MACH_TEGRA_DEVICES_H 20#define __MACH_TEGRA_DEVICES_H
21 21
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/platform_data/tegra_usb.h>
24
25extern struct tegra_ehci_platform_data tegra_ehci1_pdata;
26extern struct tegra_ehci_platform_data tegra_ehci2_pdata;
27extern struct tegra_ehci_platform_data tegra_ehci3_pdata;
23 28
24extern struct platform_device tegra_gpio_device; 29extern struct platform_device tegra_gpio_device;
25extern struct platform_device tegra_pinmux_device; 30extern struct platform_device tegra_pinmux_device;
diff --git a/arch/arm/mach-tegra/flowctrl.c b/arch/arm/mach-tegra/flowctrl.c
new file mode 100644
index 000000000000..fef66a7486ed
--- /dev/null
+++ b/arch/arm/mach-tegra/flowctrl.c
@@ -0,0 +1,62 @@
1/*
2 * arch/arm/mach-tegra/flowctrl.c
3 *
4 * functions and macros to control the flowcontroller
5 *
6 * Copyright (c) 2010-2012, NVIDIA Corporation. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/io.h>
24
25#include <mach/iomap.h>
26
27#include "flowctrl.h"
28
29u8 flowctrl_offset_halt_cpu[] = {
30 FLOW_CTRL_HALT_CPU0_EVENTS,
31 FLOW_CTRL_HALT_CPU1_EVENTS,
32 FLOW_CTRL_HALT_CPU1_EVENTS + 8,
33 FLOW_CTRL_HALT_CPU1_EVENTS + 16,
34};
35
36u8 flowctrl_offset_cpu_csr[] = {
37 FLOW_CTRL_CPU0_CSR,
38 FLOW_CTRL_CPU1_CSR,
39 FLOW_CTRL_CPU1_CSR + 8,
40 FLOW_CTRL_CPU1_CSR + 16,
41};
42
43static void flowctrl_update(u8 offset, u32 value)
44{
45 void __iomem *addr = IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + offset;
46
47 writel(value, addr);
48
49 /* ensure the update has reached the flow controller */
50 wmb();
51 readl_relaxed(addr);
52}
53
54void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value)
55{
56 return flowctrl_update(flowctrl_offset_halt_cpu[cpuid], value);
57}
58
59void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value)
60{
61 return flowctrl_update(flowctrl_offset_cpu_csr[cpuid], value);
62}
diff --git a/arch/arm/mach-tegra/flowctrl.h b/arch/arm/mach-tegra/flowctrl.h
index 74c6efbe52fa..19428173855e 100644
--- a/arch/arm/mach-tegra/flowctrl.h
+++ b/arch/arm/mach-tegra/flowctrl.h
@@ -34,4 +34,9 @@
34#define FLOW_CTRL_HALT_CPU1_EVENTS 0x14 34#define FLOW_CTRL_HALT_CPU1_EVENTS 0x14
35#define FLOW_CTRL_CPU1_CSR 0x18 35#define FLOW_CTRL_CPU1_CSR 0x18
36 36
37#ifndef __ASSEMBLY__
38void flowctrl_write_cpu_csr(unsigned int cpuid, u32 value);
39void flowctrl_write_cpu_halt(unsigned int cpuid, u32 value);
40#endif
41
37#endif 42#endif
diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index c1afb2738769..f946d129423c 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -34,6 +34,7 @@
34int tegra_sku_id; 34int tegra_sku_id;
35int tegra_cpu_process_id; 35int tegra_cpu_process_id;
36int tegra_core_process_id; 36int tegra_core_process_id;
37int tegra_chip_id;
37enum tegra_revision tegra_revision; 38enum tegra_revision tegra_revision;
38 39
39/* The BCT to use at boot is specified by board straps that can be read 40/* The BCT to use at boot is specified by board straps that can be read
@@ -66,12 +67,9 @@ static inline bool get_spare_fuse(int bit)
66 return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4); 67 return tegra_fuse_readl(FUSE_SPARE_BIT + bit * 4);
67} 68}
68 69
69static enum tegra_revision tegra_get_revision(void) 70static enum tegra_revision tegra_get_revision(u32 id)
70{ 71{
71 void __iomem *chip_id = IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804;
72 u32 id = readl(chip_id);
73 u32 minor_rev = (id >> 16) & 0xf; 72 u32 minor_rev = (id >> 16) & 0xf;
74 u32 chipid = (id >> 8) & 0xff;
75 73
76 switch (minor_rev) { 74 switch (minor_rev) {
77 case 1: 75 case 1:
@@ -79,7 +77,8 @@ static enum tegra_revision tegra_get_revision(void)
79 case 2: 77 case 2:
80 return TEGRA_REVISION_A02; 78 return TEGRA_REVISION_A02;
81 case 3: 79 case 3:
82 if (chipid == 0x20 && (get_spare_fuse(18) || get_spare_fuse(19))) 80 if (tegra_chip_id == TEGRA20 &&
81 (get_spare_fuse(18) || get_spare_fuse(19)))
83 return TEGRA_REVISION_A03p; 82 return TEGRA_REVISION_A03p;
84 else 83 else
85 return TEGRA_REVISION_A03; 84 return TEGRA_REVISION_A03;
@@ -92,6 +91,8 @@ static enum tegra_revision tegra_get_revision(void)
92 91
93void tegra_init_fuse(void) 92void tegra_init_fuse(void)
94{ 93{
94 u32 id;
95
95 u32 reg = readl(IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); 96 u32 reg = readl(IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
96 reg |= 1 << 28; 97 reg |= 1 << 28;
97 writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48)); 98 writel(reg, IO_TO_VIRT(TEGRA_CLK_RESET_BASE + 0x48));
@@ -108,10 +109,13 @@ void tegra_init_fuse(void)
108 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT); 109 reg = tegra_apb_readl(TEGRA_APB_MISC_BASE + STRAP_OPT);
109 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT; 110 tegra_bct_strapping = (reg & RAM_ID_MASK) >> RAM_CODE_SHIFT;
110 111
111 tegra_revision = tegra_get_revision(); 112 id = readl_relaxed(IO_ADDRESS(TEGRA_APB_MISC_BASE) + 0x804);
113 tegra_chip_id = (id >> 8) & 0xff;
114
115 tegra_revision = tegra_get_revision(id);
112 116
113 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n", 117 pr_info("Tegra Revision: %s SKU: %d CPU Process: %d Core Process: %d\n",
114 tegra_revision_name[tegra_get_revision()], 118 tegra_revision_name[tegra_revision],
115 tegra_sku_id, tegra_cpu_process_id, 119 tegra_sku_id, tegra_cpu_process_id,
116 tegra_core_process_id); 120 tegra_core_process_id);
117} 121}
diff --git a/arch/arm/mach-tegra/fuse.h b/arch/arm/mach-tegra/fuse.h
index d65d2abf803b..d2107b2cb85a 100644
--- a/arch/arm/mach-tegra/fuse.h
+++ b/arch/arm/mach-tegra/fuse.h
@@ -35,9 +35,13 @@ enum tegra_revision {
35#define SKU_ID_AP25E 27 35#define SKU_ID_AP25E 27
36#define SKU_ID_T25E 28 36#define SKU_ID_T25E 28
37 37
38#define TEGRA20 0x20
39#define TEGRA30 0x30
40
38extern int tegra_sku_id; 41extern int tegra_sku_id;
39extern int tegra_cpu_process_id; 42extern int tegra_cpu_process_id;
40extern int tegra_core_process_id; 43extern int tegra_core_process_id;
44extern int tegra_chip_id;
41extern enum tegra_revision tegra_revision; 45extern enum tegra_revision tegra_revision;
42 46
43extern int tegra_bct_strapping; 47extern int tegra_bct_strapping;
diff --git a/arch/arm/mach-tegra/headsmp.S b/arch/arm/mach-tegra/headsmp.S
index b5349b2f13d2..fef9c2c51370 100644
--- a/arch/arm/mach-tegra/headsmp.S
+++ b/arch/arm/mach-tegra/headsmp.S
@@ -1,6 +1,23 @@
1#include <linux/linkage.h> 1#include <linux/linkage.h>
2#include <linux/init.h> 2#include <linux/init.h>
3 3
4#include <asm/cache.h>
5
6#include <mach/iomap.h>
7
8#include "flowctrl.h"
9#include "reset.h"
10
11#define APB_MISC_GP_HIDREV 0x804
12#define PMC_SCRATCH41 0x140
13
14#define RESET_DATA(x) ((TEGRA_RESET_##x)*4)
15
16 .macro mov32, reg, val
17 movw \reg, #:lower16:\val
18 movt \reg, #:upper16:\val
19 .endm
20
4 .section ".text.head", "ax" 21 .section ".text.head", "ax"
5 __CPUINIT 22 __CPUINIT
6 23
@@ -47,15 +64,149 @@ ENTRY(v7_invalidate_l1)
47 mov pc, lr 64 mov pc, lr
48ENDPROC(v7_invalidate_l1) 65ENDPROC(v7_invalidate_l1)
49 66
67
50ENTRY(tegra_secondary_startup) 68ENTRY(tegra_secondary_startup)
51 msr cpsr_fsxc, #0xd3
52 bl v7_invalidate_l1 69 bl v7_invalidate_l1
53 mrc p15, 0, r0, c0, c0, 5 70 /* Enable coresight */
54 and r0, r0, #15 71 mov32 r0, 0xC5ACCE55
55 ldr r1, =0x6000f100 72 mcr p14, 0, r0, c7, c12, 6
56 str r0, [r1]
571: ldr r2, [r1]
58 cmp r0, r2
59 beq 1b
60 b secondary_startup 73 b secondary_startup
61ENDPROC(tegra_secondary_startup) 74ENDPROC(tegra_secondary_startup)
75
76 .align L1_CACHE_SHIFT
77ENTRY(__tegra_cpu_reset_handler_start)
78
79/*
80 * __tegra_cpu_reset_handler:
81 *
82 * Common handler for all CPU reset events.
83 *
84 * Register usage within the reset handler:
85 *
86 * R7 = CPU present (to the OS) mask
87 * R8 = CPU in LP1 state mask
88 * R9 = CPU in LP2 state mask
89 * R10 = CPU number
90 * R11 = CPU mask
91 * R12 = pointer to reset handler data
92 *
93 * NOTE: This code is copied to IRAM. All code and data accesses
94 * must be position-independent.
95 */
96
97 .align L1_CACHE_SHIFT
98ENTRY(__tegra_cpu_reset_handler)
99
100 cpsid aif, 0x13 @ SVC mode, interrupts disabled
101 mrc p15, 0, r10, c0, c0, 5 @ MPIDR
102 and r10, r10, #0x3 @ R10 = CPU number
103 mov r11, #1
104 mov r11, r11, lsl r10 @ R11 = CPU mask
105 adr r12, __tegra_cpu_reset_handler_data
106
107#ifdef CONFIG_SMP
108 /* Does the OS know about this CPU? */
109 ldr r7, [r12, #RESET_DATA(MASK_PRESENT)]
110 tst r7, r11 @ if !present
111 bleq __die @ CPU not present (to OS)
112#endif
113
114#ifdef CONFIG_ARCH_TEGRA_2x_SOC
115 /* Are we on Tegra20? */
116 mov32 r6, TEGRA_APB_MISC_BASE
117 ldr r0, [r6, #APB_MISC_GP_HIDREV]
118 and r0, r0, #0xff00
119 cmp r0, #(0x20 << 8)
120 bne 1f
121 /* If not CPU0, don't let CPU0 reset CPU1 now that CPU1 is coming up. */
122 mov32 r6, TEGRA_PMC_BASE
123 mov r0, #0
124 cmp r10, #0
125 strne r0, [r6, #PMC_SCRATCH41]
1261:
127#endif
128
129#ifdef CONFIG_SMP
130 /*
131 * Can only be secondary boot (initial or hotplug) but CPU 0
132 * cannot be here.
133 */
134 cmp r10, #0
135 bleq __die @ CPU0 cannot be here
136 ldr lr, [r12, #RESET_DATA(STARTUP_SECONDARY)]
137 cmp lr, #0
138 bleq __die @ no secondary startup handler
139 bx lr
140#endif
141
142/*
143 * We don't know why the CPU reset. Just kill it.
144 * The LR register will contain the address we died at + 4.
145 */
146
147__die:
148 sub lr, lr, #4
149 mov32 r7, TEGRA_PMC_BASE
150 str lr, [r7, #PMC_SCRATCH41]
151
152 mov32 r7, TEGRA_CLK_RESET_BASE
153
154 /* Are we on Tegra20? */
155 mov32 r6, TEGRA_APB_MISC_BASE
156 ldr r0, [r6, #APB_MISC_GP_HIDREV]
157 and r0, r0, #0xff00
158 cmp r0, #(0x20 << 8)
159 bne 1f
160
161#ifdef CONFIG_ARCH_TEGRA_2x_SOC
162 mov32 r0, 0x1111
163 mov r1, r0, lsl r10
164 str r1, [r7, #0x340] @ CLK_RST_CPU_CMPLX_SET
165#endif
1661:
167#ifdef CONFIG_ARCH_TEGRA_3x_SOC
168 mov32 r6, TEGRA_FLOW_CTRL_BASE
169
170 cmp r10, #0
171 moveq r1, #FLOW_CTRL_HALT_CPU0_EVENTS
172 moveq r2, #FLOW_CTRL_CPU0_CSR
173 movne r1, r10, lsl #3
174 addne r2, r1, #(FLOW_CTRL_CPU1_CSR-8)
175 addne r1, r1, #(FLOW_CTRL_HALT_CPU1_EVENTS-8)
176
177 /* Clear CPU "event" and "interrupt" flags and power gate
178 it when halting but not before it is in the "WFI" state. */
179 ldr r0, [r6, +r2]
180 orr r0, r0, #FLOW_CTRL_CSR_INTR_FLAG | FLOW_CTRL_CSR_EVENT_FLAG
181 orr r0, r0, #FLOW_CTRL_CSR_ENABLE
182 str r0, [r6, +r2]
183
184 /* Unconditionally halt this CPU */
185 mov r0, #FLOW_CTRL_WAITEVENT
186 str r0, [r6, +r1]
187 ldr r0, [r6, +r1] @ memory barrier
188
189 dsb
190 isb
191 wfi @ CPU should be power gated here
192
193 /* If the CPU didn't power gate above just kill it's clock. */
194
195 mov r0, r11, lsl #8
196 str r0, [r7, #348] @ CLK_CPU_CMPLX_SET
197#endif
198
199 /* If the CPU still isn't dead, just spin here. */
200 b .
201ENDPROC(__tegra_cpu_reset_handler)
202
203 .align L1_CACHE_SHIFT
204 .type __tegra_cpu_reset_handler_data, %object
205 .globl __tegra_cpu_reset_handler_data
206__tegra_cpu_reset_handler_data:
207 .rept TEGRA_RESET_DATA_SIZE
208 .long 0
209 .endr
210 .align L1_CACHE_SHIFT
211
212ENTRY(__tegra_cpu_reset_handler_end)
diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c
index f3294040d357..d8dc9ddd6d18 100644
--- a/arch/arm/mach-tegra/hotplug.c
+++ b/arch/arm/mach-tegra/hotplug.c
@@ -13,6 +13,7 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/cp15.h>
16 17
17static inline void cpu_enter_lowpower(void) 18static inline void cpu_enter_lowpower(void)
18{ 19{
diff --git a/arch/arm/mach-tegra/include/mach/debug-macro.S b/arch/arm/mach-tegra/include/mach/debug-macro.S
index 90069abd37bd..8ce0661b8a3d 100644
--- a/arch/arm/mach-tegra/include/mach/debug-macro.S
+++ b/arch/arm/mach-tegra/include/mach/debug-macro.S
@@ -26,7 +26,6 @@
26 26
27#include <linux/serial_reg.h> 27#include <linux/serial_reg.h>
28 28
29#include <mach/io.h>
30#include <mach/iomap.h> 29#include <mach/iomap.h>
31#include <mach/irammap.h> 30#include <mach/irammap.h>
32 31
diff --git a/arch/arm/mach-tegra/include/mach/io.h b/arch/arm/mach-tegra/include/mach/io.h
index f15defffb5d2..fe700f9ce7dc 100644
--- a/arch/arm/mach-tegra/include/mach/io.h
+++ b/arch/arm/mach-tegra/include/mach/io.h
@@ -23,56 +23,8 @@
23 23
24#define IO_SPACE_LIMIT 0xffff 24#define IO_SPACE_LIMIT 0xffff
25 25
26/* On TEGRA, many peripherals are very closely packed in
27 * two 256MB io windows (that actually only use about 64KB
28 * at the start of each).
29 *
30 * We will just map the first 1MB of each window (to minimize
31 * pt entries needed) and provide a macro to transform physical
32 * io addresses to an appropriate void __iomem *.
33 *
34 */
35
36#ifdef __ASSEMBLY__
37#define IOMEM(x) (x)
38#else
39#define IOMEM(x) ((void __force __iomem *)(x))
40#endif
41
42#define IO_IRAM_PHYS 0x40000000
43#define IO_IRAM_VIRT IOMEM(0xFE400000)
44#define IO_IRAM_SIZE SZ_256K
45
46#define IO_CPU_PHYS 0x50040000
47#define IO_CPU_VIRT IOMEM(0xFE000000)
48#define IO_CPU_SIZE SZ_16K
49
50#define IO_PPSB_PHYS 0x60000000
51#define IO_PPSB_VIRT IOMEM(0xFE200000)
52#define IO_PPSB_SIZE SZ_1M
53
54#define IO_APB_PHYS 0x70000000
55#define IO_APB_VIRT IOMEM(0xFE300000)
56#define IO_APB_SIZE SZ_1M
57
58#define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
59#define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst)))
60
61#define IO_TO_VIRT(n) ( \
62 IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \
63 IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \
64 IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \
65 IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \
66 IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \
67 IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \
68 IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \
69 IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \
70 NULL)
71
72#ifndef __ASSEMBLER__ 26#ifndef __ASSEMBLER__
73 27
74#define IO_ADDRESS(n) (IO_TO_VIRT(n))
75
76#ifdef CONFIG_TEGRA_PCI 28#ifdef CONFIG_TEGRA_PCI
77extern void __iomem *tegra_pcie_io_base; 29extern void __iomem *tegra_pcie_io_base;
78 30
@@ -88,7 +40,6 @@ static inline void __iomem *__io(unsigned long addr)
88#endif 40#endif
89 41
90#define __io(a) __io(a) 42#define __io(a) __io(a)
91#define __mem_pci(a) (a)
92 43
93#endif 44#endif
94 45
diff --git a/arch/arm/mach-tegra/include/mach/iomap.h b/arch/arm/mach-tegra/include/mach/iomap.h
index 67644c905d8e..7e76da73121c 100644
--- a/arch/arm/mach-tegra/include/mach/iomap.h
+++ b/arch/arm/mach-tegra/include/mach/iomap.h
@@ -113,6 +113,9 @@
113#define TEGRA_AHB_GIZMO_BASE 0x6000C004 113#define TEGRA_AHB_GIZMO_BASE 0x6000C004
114#define TEGRA_AHB_GIZMO_SIZE 0x10C 114#define TEGRA_AHB_GIZMO_SIZE 0x10C
115 115
116#define TEGRA_SB_BASE 0x6000C200
117#define TEGRA_SB_SIZE 256
118
116#define TEGRA_STATMON_BASE 0x6000C400 119#define TEGRA_STATMON_BASE 0x6000C400
117#define TEGRA_STATMON_SIZE SZ_1K 120#define TEGRA_STATMON_SIZE SZ_1K
118 121
@@ -274,4 +277,46 @@
274# define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE 277# define TEGRA_DEBUG_UART_BASE TEGRA_UARTE_BASE
275#endif 278#endif
276 279
280/* On TEGRA, many peripherals are very closely packed in
281 * two 256MB io windows (that actually only use about 64KB
282 * at the start of each).
283 *
284 * We will just map the first 1MB of each window (to minimize
285 * pt entries needed) and provide a macro to transform physical
286 * io addresses to an appropriate void __iomem *.
287 *
288 */
289
290#define IO_IRAM_PHYS 0x40000000
291#define IO_IRAM_VIRT IOMEM(0xFE400000)
292#define IO_IRAM_SIZE SZ_256K
293
294#define IO_CPU_PHYS 0x50040000
295#define IO_CPU_VIRT IOMEM(0xFE000000)
296#define IO_CPU_SIZE SZ_16K
297
298#define IO_PPSB_PHYS 0x60000000
299#define IO_PPSB_VIRT IOMEM(0xFE200000)
300#define IO_PPSB_SIZE SZ_1M
301
302#define IO_APB_PHYS 0x70000000
303#define IO_APB_VIRT IOMEM(0xFE300000)
304#define IO_APB_SIZE SZ_1M
305
306#define IO_TO_VIRT_BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
307#define IO_TO_VIRT_XLATE(p, pst, vst) (((p) - (pst) + (vst)))
308
309#define IO_TO_VIRT(n) ( \
310 IO_TO_VIRT_BETWEEN((n), IO_PPSB_PHYS, IO_PPSB_SIZE) ? \
311 IO_TO_VIRT_XLATE((n), IO_PPSB_PHYS, IO_PPSB_VIRT) : \
312 IO_TO_VIRT_BETWEEN((n), IO_APB_PHYS, IO_APB_SIZE) ? \
313 IO_TO_VIRT_XLATE((n), IO_APB_PHYS, IO_APB_VIRT) : \
314 IO_TO_VIRT_BETWEEN((n), IO_CPU_PHYS, IO_CPU_SIZE) ? \
315 IO_TO_VIRT_XLATE((n), IO_CPU_PHYS, IO_CPU_VIRT) : \
316 IO_TO_VIRT_BETWEEN((n), IO_IRAM_PHYS, IO_IRAM_SIZE) ? \
317 IO_TO_VIRT_XLATE((n), IO_IRAM_PHYS, IO_IRAM_VIRT) : \
318 NULL)
319
320#define IO_ADDRESS(n) (IO_TO_VIRT(n))
321
277#endif 322#endif
diff --git a/arch/arm/mach-tegra/include/mach/powergate.h b/arch/arm/mach-tegra/include/mach/powergate.h
index 39c396d2ddb0..4752b1a68f35 100644
--- a/arch/arm/mach-tegra/include/mach/powergate.h
+++ b/arch/arm/mach-tegra/include/mach/powergate.h
@@ -27,8 +27,21 @@
27#define TEGRA_POWERGATE_VDEC 4 27#define TEGRA_POWERGATE_VDEC 4
28#define TEGRA_POWERGATE_L2 5 28#define TEGRA_POWERGATE_L2 5
29#define TEGRA_POWERGATE_MPE 6 29#define TEGRA_POWERGATE_MPE 6
30#define TEGRA_NUM_POWERGATE 7 30#define TEGRA_POWERGATE_HEG 7
31#define TEGRA_POWERGATE_SATA 8
32#define TEGRA_POWERGATE_CPU1 9
33#define TEGRA_POWERGATE_CPU2 10
34#define TEGRA_POWERGATE_CPU3 11
35#define TEGRA_POWERGATE_CELP 12
36#define TEGRA_POWERGATE_3D1 13
31 37
38#define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU
39#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
40
41int __init tegra_powergate_init(void);
42
43int tegra_cpu_powergate_id(int cpuid);
44int tegra_powergate_is_powered(int id);
32int tegra_powergate_power_on(int id); 45int tegra_powergate_power_on(int id);
33int tegra_powergate_power_off(int id); 46int tegra_powergate_power_off(int id);
34int tegra_powergate_remove_clamping(int id); 47int tegra_powergate_remove_clamping(int id);
diff --git a/arch/arm/mach-tegra/io.c b/arch/arm/mach-tegra/io.c
index d23ee2db2827..58b4baf9c483 100644
--- a/arch/arm/mach-tegra/io.c
+++ b/arch/arm/mach-tegra/io.c
@@ -26,6 +26,7 @@
26 26
27#include <asm/page.h> 27#include <asm/page.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <mach/iomap.h>
29 30
30#include "board.h" 31#include "board.h"
31 32
diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c
index 7d2b5d03c1df..1a208dbf682f 100644
--- a/arch/arm/mach-tegra/platsmp.c
+++ b/arch/arm/mach-tegra/platsmp.c
@@ -24,19 +24,31 @@
24#include <asm/mach-types.h> 24#include <asm/mach-types.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26 26
27#include <mach/clk.h>
27#include <mach/iomap.h> 28#include <mach/iomap.h>
29#include <mach/powergate.h>
30
31#include "fuse.h"
32#include "flowctrl.h"
33#include "reset.h"
28 34
29extern void tegra_secondary_startup(void); 35extern void tegra_secondary_startup(void);
30 36
31static DEFINE_SPINLOCK(boot_lock);
32static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE); 37static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
33 38
34#define EVP_CPU_RESET_VECTOR \ 39#define EVP_CPU_RESET_VECTOR \
35 (IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x100) 40 (IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x100)
36#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX \ 41#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX \
37 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x4c) 42 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x4c)
43#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET \
44 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x340)
38#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \ 45#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
39 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344) 46 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
47#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR \
48 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x34c)
49
50#define CPU_CLOCK(cpu) (0x1<<(8+cpu))
51#define CPU_RESET(cpu) (0x1111ul<<(cpu))
40 52
41void __cpuinit platform_secondary_init(unsigned int cpu) 53void __cpuinit platform_secondary_init(unsigned int cpu)
42{ 54{
@@ -47,63 +59,106 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
47 */ 59 */
48 gic_secondary_init(0); 60 gic_secondary_init(0);
49 61
50 /*
51 * Synchronise with the boot thread.
52 */
53 spin_lock(&boot_lock);
54 spin_unlock(&boot_lock);
55} 62}
56 63
57int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 64static int tegra20_power_up_cpu(unsigned int cpu)
58{ 65{
59 unsigned long old_boot_vector;
60 unsigned long boot_vector;
61 unsigned long timeout;
62 u32 reg; 66 u32 reg;
63 67
64 /* 68 /* Enable the CPU clock. */
65 * set synchronisation state between this boot processor 69 reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
66 * and the secondary one 70 writel(reg & ~CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
67 */ 71 barrier();
68 spin_lock(&boot_lock); 72 reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
69 73
74 /* Clear flow controller CSR. */
75 flowctrl_write_cpu_csr(cpu, 0);
70 76
71 /* set the reset vector to point to the secondary_startup routine */ 77 return 0;
78}
72 79
73 boot_vector = virt_to_phys(tegra_secondary_startup); 80static int tegra30_power_up_cpu(unsigned int cpu)
74 old_boot_vector = readl(EVP_CPU_RESET_VECTOR); 81{
75 writel(boot_vector, EVP_CPU_RESET_VECTOR); 82 u32 reg;
83 int ret, pwrgateid;
84 unsigned long timeout;
76 85
77 /* enable cpu clock on cpu1 */ 86 pwrgateid = tegra_cpu_powergate_id(cpu);
78 reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX); 87 if (pwrgateid < 0)
79 writel(reg & ~(1<<9), CLK_RST_CONTROLLER_CLK_CPU_CMPLX); 88 return pwrgateid;
89
90 /* If this is the first boot, toggle powergates directly. */
91 if (!tegra_powergate_is_powered(pwrgateid)) {
92 ret = tegra_powergate_power_on(pwrgateid);
93 if (ret)
94 return ret;
95
96 /* Wait for the power to come up. */
97 timeout = jiffies + 10*HZ;
98 while (tegra_powergate_is_powered(pwrgateid)) {
99 if (time_after(jiffies, timeout))
100 return -ETIMEDOUT;
101 udelay(10);
102 }
103 }
80 104
81 reg = (1<<13) | (1<<9) | (1<<5) | (1<<1); 105 /* CPU partition is powered. Enable the CPU clock. */
82 writel(reg, CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR); 106 writel(CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
107 reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
108 udelay(10);
83 109
84 smp_wmb(); 110 /* Remove I/O clamps. */
85 flush_cache_all(); 111 ret = tegra_powergate_remove_clamping(pwrgateid);
112 udelay(10);
86 113
87 /* unhalt the cpu */ 114 /* Clear flow controller CSR. */
88 writel(0, IO_ADDRESS(TEGRA_FLOW_CTRL_BASE) + 0x14); 115 flowctrl_write_cpu_csr(cpu, 0);
89 116
90 timeout = jiffies + (1 * HZ); 117 return 0;
91 while (time_before(jiffies, timeout)) { 118}
92 if (readl(EVP_CPU_RESET_VECTOR) != boot_vector) 119
93 break; 120int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
94 udelay(10); 121{
95 } 122 int status;
96 123
97 /* put the old boot vector back */ 124 /*
98 writel(old_boot_vector, EVP_CPU_RESET_VECTOR); 125 * Force the CPU into reset. The CPU must remain in reset when the
126 * flow controller state is cleared (which will cause the flow
127 * controller to stop driving reset if the CPU has been power-gated
128 * via the flow controller). This will have no effect on first boot
129 * of the CPU since it should already be in reset.
130 */
131 writel(CPU_RESET(cpu), CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET);
132 dmb();
99 133
100 /* 134 /*
101 * now the secondary core is starting up let it run its 135 * Unhalt the CPU. If the flow controller was used to power-gate the
102 * calibrations, then wait for it to finish 136 * CPU this will cause the flow controller to stop driving reset.
137 * The CPU will remain in reset because the clock and reset block
138 * is now driving reset.
103 */ 139 */
104 spin_unlock(&boot_lock); 140 flowctrl_write_cpu_halt(cpu, 0);
141
142 switch (tegra_chip_id) {
143 case TEGRA20:
144 status = tegra20_power_up_cpu(cpu);
145 break;
146 case TEGRA30:
147 status = tegra30_power_up_cpu(cpu);
148 break;
149 default:
150 status = -EINVAL;
151 break;
152 }
105 153
106 return 0; 154 if (status)
155 goto done;
156
157 /* Take the CPU out of reset. */
158 writel(CPU_RESET(cpu), CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR);
159 wmb();
160done:
161 return status;
107} 162}
108 163
109/* 164/*
@@ -128,6 +183,6 @@ void __init smp_init_cpus(void)
128 183
129void __init platform_smp_prepare_cpus(unsigned int max_cpus) 184void __init platform_smp_prepare_cpus(unsigned int max_cpus)
130{ 185{
131 186 tegra_cpu_reset_handler_init();
132 scu_enable(scu_base); 187 scu_enable(scu_base);
133} 188}
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 948306491a59..c238699ae86f 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -31,6 +31,8 @@
31#include <mach/iomap.h> 31#include <mach/iomap.h>
32#include <mach/powergate.h> 32#include <mach/powergate.h>
33 33
34#include "fuse.h"
35
34#define PWRGATE_TOGGLE 0x30 36#define PWRGATE_TOGGLE 0x30
35#define PWRGATE_TOGGLE_START (1 << 8) 37#define PWRGATE_TOGGLE_START (1 << 8)
36 38
@@ -38,6 +40,16 @@
38 40
39#define PWRGATE_STATUS 0x38 41#define PWRGATE_STATUS 0x38
40 42
43static int tegra_num_powerdomains;
44static int tegra_num_cpu_domains;
45static u8 *tegra_cpu_domains;
46static u8 tegra30_cpu_domains[] = {
47 TEGRA_POWERGATE_CPU0,
48 TEGRA_POWERGATE_CPU1,
49 TEGRA_POWERGATE_CPU2,
50 TEGRA_POWERGATE_CPU3,
51};
52
41static DEFINE_SPINLOCK(tegra_powergate_lock); 53static DEFINE_SPINLOCK(tegra_powergate_lock);
42 54
43static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE); 55static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
@@ -75,7 +87,7 @@ static int tegra_powergate_set(int id, bool new_state)
75 87
76int tegra_powergate_power_on(int id) 88int tegra_powergate_power_on(int id)
77{ 89{
78 if (id < 0 || id >= TEGRA_NUM_POWERGATE) 90 if (id < 0 || id >= tegra_num_powerdomains)
79 return -EINVAL; 91 return -EINVAL;
80 92
81 return tegra_powergate_set(id, true); 93 return tegra_powergate_set(id, true);
@@ -83,17 +95,18 @@ int tegra_powergate_power_on(int id)
83 95
84int tegra_powergate_power_off(int id) 96int tegra_powergate_power_off(int id)
85{ 97{
86 if (id < 0 || id >= TEGRA_NUM_POWERGATE) 98 if (id < 0 || id >= tegra_num_powerdomains)
87 return -EINVAL; 99 return -EINVAL;
88 100
89 return tegra_powergate_set(id, false); 101 return tegra_powergate_set(id, false);
90} 102}
91 103
92static bool tegra_powergate_is_powered(int id) 104int tegra_powergate_is_powered(int id)
93{ 105{
94 u32 status; 106 u32 status;
95 107
96 WARN_ON(id < 0 || id >= TEGRA_NUM_POWERGATE); 108 if (id < 0 || id >= tegra_num_powerdomains)
109 return -EINVAL;
97 110
98 status = pmc_read(PWRGATE_STATUS) & (1 << id); 111 status = pmc_read(PWRGATE_STATUS) & (1 << id);
99 return !!status; 112 return !!status;
@@ -103,7 +116,7 @@ int tegra_powergate_remove_clamping(int id)
103{ 116{
104 u32 mask; 117 u32 mask;
105 118
106 if (id < 0 || id >= TEGRA_NUM_POWERGATE) 119 if (id < 0 || id >= tegra_num_powerdomains)
107 return -EINVAL; 120 return -EINVAL;
108 121
109 /* 122 /*
@@ -156,6 +169,34 @@ err_power:
156 return ret; 169 return ret;
157} 170}
158 171
172int tegra_cpu_powergate_id(int cpuid)
173{
174 if (cpuid > 0 && cpuid < tegra_num_cpu_domains)
175 return tegra_cpu_domains[cpuid];
176
177 return -EINVAL;
178}
179
180int __init tegra_powergate_init(void)
181{
182 switch (tegra_chip_id) {
183 case TEGRA20:
184 tegra_num_powerdomains = 7;
185 break;
186 case TEGRA30:
187 tegra_num_powerdomains = 14;
188 tegra_num_cpu_domains = 4;
189 tegra_cpu_domains = tegra30_cpu_domains;
190 break;
191 default:
192 /* Unknown Tegra variant. Disable powergating */
193 tegra_num_powerdomains = 0;
194 break;
195 }
196
197 return 0;
198}
199
159#ifdef CONFIG_DEBUG_FS 200#ifdef CONFIG_DEBUG_FS
160 201
161static const char * const powergate_name[] = { 202static const char * const powergate_name[] = {
@@ -175,7 +216,7 @@ static int powergate_show(struct seq_file *s, void *data)
175 seq_printf(s, " powergate powered\n"); 216 seq_printf(s, " powergate powered\n");
176 seq_printf(s, "------------------\n"); 217 seq_printf(s, "------------------\n");
177 218
178 for (i = 0; i < TEGRA_NUM_POWERGATE; i++) 219 for (i = 0; i < tegra_num_powerdomains; i++)
179 seq_printf(s, " %9s %7s\n", powergate_name[i], 220 seq_printf(s, " %9s %7s\n", powergate_name[i],
180 tegra_powergate_is_powered(i) ? "yes" : "no"); 221 tegra_powergate_is_powered(i) ? "yes" : "no");
181 return 0; 222 return 0;
diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c
new file mode 100644
index 000000000000..4d6a2ee99c3b
--- /dev/null
+++ b/arch/arm/mach-tegra/reset.c
@@ -0,0 +1,84 @@
1/*
2 * arch/arm/mach-tegra/reset.c
3 *
4 * Copyright (C) 2011,2012 NVIDIA Corporation.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/init.h>
18#include <linux/io.h>
19#include <linux/cpumask.h>
20#include <linux/bitops.h>
21
22#include <asm/cacheflush.h>
23#include <asm/hardware/cache-l2x0.h>
24
25#include <mach/iomap.h>
26#include <mach/irammap.h>
27
28#include "reset.h"
29#include "fuse.h"
30
31#define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \
32 TEGRA_IRAM_RESET_HANDLER_OFFSET)
33
34static bool is_enabled;
35
36static void tegra_cpu_reset_handler_enable(void)
37{
38 void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
39 void __iomem *evp_cpu_reset =
40 IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100);
41 void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE);
42 u32 reg;
43
44 BUG_ON(is_enabled);
45 BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
46
47 memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
48 tegra_cpu_reset_handler_size);
49
50 /*
51 * NOTE: This must be the one and only write to the EVP CPU reset
52 * vector in the entire system.
53 */
54 writel(TEGRA_IRAM_RESET_BASE + tegra_cpu_reset_handler_offset,
55 evp_cpu_reset);
56 wmb();
57 reg = readl(evp_cpu_reset);
58
59 /*
60 * Prevent further modifications to the physical reset vector.
61 * NOTE: Has no effect on chips prior to Tegra30.
62 */
63 if (tegra_chip_id != TEGRA20) {
64 reg = readl(sb_ctrl);
65 reg |= 2;
66 writel(reg, sb_ctrl);
67 wmb();
68 }
69
70 is_enabled = true;
71}
72
73void __init tegra_cpu_reset_handler_init(void)
74{
75
76#ifdef CONFIG_SMP
77 __tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
78 *((u32 *)cpu_present_mask);
79 __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] =
80 virt_to_phys((void *)tegra_secondary_startup);
81#endif
82
83 tegra_cpu_reset_handler_enable();
84}
diff --git a/arch/arm/mach-tegra/reset.h b/arch/arm/mach-tegra/reset.h
new file mode 100644
index 000000000000..de88bf851dd3
--- /dev/null
+++ b/arch/arm/mach-tegra/reset.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-tegra/reset.h
3 *
4 * CPU reset dispatcher.
5 *
6 * Copyright (c) 2011, NVIDIA Corporation.
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 */
18
19#ifndef __MACH_TEGRA_RESET_H
20#define __MACH_TEGRA_RESET_H
21
22#define TEGRA_RESET_MASK_PRESENT 0
23#define TEGRA_RESET_MASK_LP1 1
24#define TEGRA_RESET_MASK_LP2 2
25#define TEGRA_RESET_STARTUP_SECONDARY 3
26#define TEGRA_RESET_STARTUP_LP2 4
27#define TEGRA_RESET_STARTUP_LP1 5
28#define TEGRA_RESET_DATA_SIZE 6
29
30#ifndef __ASSEMBLY__
31
32extern unsigned long __tegra_cpu_reset_handler_data[TEGRA_RESET_DATA_SIZE];
33
34void __tegra_cpu_reset_handler_start(void);
35void __tegra_cpu_reset_handler(void);
36void __tegra_cpu_reset_handler_end(void);
37void tegra_secondary_startup(void);
38
39#define tegra_cpu_reset_handler_offset \
40 ((u32)__tegra_cpu_reset_handler - \
41 (u32)__tegra_cpu_reset_handler_start)
42
43#define tegra_cpu_reset_handler_size \
44 (__tegra_cpu_reset_handler_end - \
45 __tegra_cpu_reset_handler_start)
46
47void __init tegra_cpu_reset_handler_init(void);
48
49#endif
50#endif
diff --git a/arch/arm/mach-tegra/sleep.S b/arch/arm/mach-tegra/sleep.S
index 8f9fde161c34..5b20197bae7f 100644
--- a/arch/arm/mach-tegra/sleep.S
+++ b/arch/arm/mach-tegra/sleep.S
@@ -23,7 +23,9 @@
23 */ 23 */
24 24
25#include <linux/linkage.h> 25#include <linux/linkage.h>
26#include <mach/io.h> 26
27#include <asm/assembler.h>
28
27#include <mach/iomap.h> 29#include <mach/iomap.h>
28 30
29#include "flowctrl.h" 31#include "flowctrl.h"
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 8b90c44d237f..1621ad07d284 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1544,6 +1544,8 @@ static struct fsmc_nand_platform_data nand_platform_data = {
1544 .nr_partitions = ARRAY_SIZE(u300_partitions), 1544 .nr_partitions = ARRAY_SIZE(u300_partitions),
1545 .options = NAND_SKIP_BBTSCAN, 1545 .options = NAND_SKIP_BBTSCAN,
1546 .width = FSMC_NAND_BW8, 1546 .width = FSMC_NAND_BW8,
1547 .ale_off = PLAT_NAND_ALE,
1548 .cle_off = PLAT_NAND_CLE,
1547}; 1549};
1548 1550
1549static struct platform_device nand_device = { 1551static struct platform_device nand_device = {
diff --git a/arch/arm/mach-u300/include/mach/io.h b/arch/arm/mach-u300/include/mach/io.h
deleted file mode 100644
index 5d6b4c13b3a0..000000000000
--- a/arch/arm/mach-u300/include/mach/io.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/io.h
4 *
5 *
6 * Copyright (C) 2006-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * Dummy IO map for being able to use writew()/readw(),
9 * writel()/readw() and similar accessor functions.
10 * Author: Linus Walleij <linus.walleij@stericsson.com>
11 */
12#ifndef __MACH_IO_H
13#define __MACH_IO_H
14
15#define IO_SPACE_LIMIT 0xffffffff
16
17#define __io(a) __typesafe_io(a)
18#define __mem_pci(a) (a)
19
20#endif
diff --git a/arch/arm/mach-u300/include/mach/u300-regs.h b/arch/arm/mach-u300/include/mach/u300-regs.h
index 035fdc9dbdb0..65f87c523892 100644
--- a/arch/arm/mach-u300/include/mach/u300-regs.h
+++ b/arch/arm/mach-u300/include/mach/u300-regs.h
@@ -18,18 +18,17 @@
18 * the defines are used for setting up the I/O memory mapping. 18 * the defines are used for setting up the I/O memory mapping.
19 */ 19 */
20 20
21#ifdef __ASSEMBLER__
22#define IOMEM(a) (a)
23#else
24#define IOMEM(a) (void __iomem *) a
25#endif
26
27/* NAND Flash CS0 */ 21/* NAND Flash CS0 */
28#define U300_NAND_CS0_PHYS_BASE 0x80000000 22#define U300_NAND_CS0_PHYS_BASE 0x80000000
29 23
30/* NFIF */ 24/* NFIF */
31#define U300_NAND_IF_PHYS_BASE 0x9f800000 25#define U300_NAND_IF_PHYS_BASE 0x9f800000
32 26
27/* ALE, CLE offset for FSMC NAND */
28#define PLAT_NAND_CLE (1 << 16)
29#define PLAT_NAND_ALE (1 << 17)
30
31
33/* AHB Peripherals */ 32/* AHB Peripherals */
34#define U300_AHB_PER_PHYS_BASE 0xa0000000 33#define U300_AHB_PER_PHYS_BASE 0xa0000000
35#define U300_AHB_PER_VIRT_BASE 0xff010000 34#define U300_AHB_PER_VIRT_BASE 0xff010000
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 9ec635812349..880d02ec89d4 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -27,6 +27,7 @@ config MACH_MOP500
27 select UX500_SOC_DB8500 27 select UX500_SOC_DB8500
28 select I2C 28 select I2C
29 select I2C_NOMADIK 29 select I2C_NOMADIK
30 select SOC_BUS
30 help 31 help
31 Include support for the MOP500 development platform. 32 Include support for the MOP500 development platform.
32 33
@@ -57,6 +58,12 @@ config UX500_AUTO_PLATFORM
57 At least one platform needs to be selected in order to build 58 At least one platform needs to be selected in order to build
58 a working kernel. If everything else is disabled, this 59 a working kernel. If everything else is disabled, this
59 automatically enables MACH_MOP500. 60 automatically enables MACH_MOP500.
61
62config MACH_UX500_DT
63 bool "Generic U8500 support using device tree"
64 depends on MACH_MOP500
65 select USE_OF
66
60endmenu 67endmenu
61 68
62config UX500_DEBUG_UART 69config UX500_DEBUG_UART
diff --git a/arch/arm/mach-ux500/Makefile.boot b/arch/arm/mach-ux500/Makefile.boot
index ff0a4b5b0a82..dd5cd00e2554 100644
--- a/arch/arm/mach-ux500/Makefile.boot
+++ b/arch/arm/mach-ux500/Makefile.boot
@@ -2,3 +2,4 @@
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
5dtb-$(CONFIG_MACH_SNOWBALL) += snowball.dtb
diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
index 1daead3e583e..920251cf834c 100644
--- a/arch/arm/mach-ux500/board-mop500-sdi.c
+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
@@ -99,7 +99,7 @@ static struct mmci_platform_data mop500_sdi0_data = {
99#endif 99#endif
100}; 100};
101 101
102static void sdi0_configure(void) 102static void sdi0_configure(struct device *parent)
103{ 103{
104 int ret; 104 int ret;
105 105
@@ -118,15 +118,15 @@ static void sdi0_configure(void)
118 gpio_direction_output(sdi0_en, 1); 118 gpio_direction_output(sdi0_en, 1);
119 119
120 /* Add the device, force v2 to subrevision 1 */ 120 /* Add the device, force v2 to subrevision 1 */
121 db8500_add_sdi0(&mop500_sdi0_data, U8500_SDI_V2_PERIPHID); 121 db8500_add_sdi0(parent, &mop500_sdi0_data, U8500_SDI_V2_PERIPHID);
122} 122}
123 123
124void mop500_sdi_tc35892_init(void) 124void mop500_sdi_tc35892_init(struct device *parent)
125{ 125{
126 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD; 126 mop500_sdi0_data.gpio_cd = GPIO_SDMMC_CD;
127 sdi0_en = GPIO_SDMMC_EN; 127 sdi0_en = GPIO_SDMMC_EN;
128 sdi0_vsel = GPIO_SDMMC_1V8_3V_SEL; 128 sdi0_vsel = GPIO_SDMMC_1V8_3V_SEL;
129 sdi0_configure(); 129 sdi0_configure(parent);
130} 130}
131 131
132/* 132/*
@@ -241,12 +241,13 @@ static struct mmci_platform_data mop500_sdi4_data = {
241#endif 241#endif
242}; 242};
243 243
244void __init mop500_sdi_init(void) 244void __init mop500_sdi_init(struct device *parent)
245{ 245{
246 /* PoP:ed eMMC */ 246 /* PoP:ed eMMC */
247 db8500_add_sdi2(&mop500_sdi2_data, U8500_SDI_V2_PERIPHID); 247 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
248 /* On-board eMMC */ 248 /* On-board eMMC */
249 db8500_add_sdi4(&mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 249 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
250
250 /* 251 /*
251 * On boards with the TC35892 GPIO expander, sdi0 will finally 252 * On boards with the TC35892 GPIO expander, sdi0 will finally
252 * be added when the TC35892 initializes and calls 253 * be added when the TC35892 initializes and calls
@@ -254,31 +255,31 @@ void __init mop500_sdi_init(void)
254 */ 255 */
255} 256}
256 257
257void __init snowball_sdi_init(void) 258void __init snowball_sdi_init(struct device *parent)
258{ 259{
259 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */ 260 /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported (Hardware issue?) */
260 mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED; 261 mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
261 /* On-board eMMC */ 262 /* On-board eMMC */
262 db8500_add_sdi4(&mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 263 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
263 /* External Micro SD slot */ 264 /* External Micro SD slot */
264 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO; 265 mop500_sdi0_data.gpio_cd = SNOWBALL_SDMMC_CD_GPIO;
265 mop500_sdi0_data.cd_invert = true; 266 mop500_sdi0_data.cd_invert = true;
266 sdi0_en = SNOWBALL_SDMMC_EN_GPIO; 267 sdi0_en = SNOWBALL_SDMMC_EN_GPIO;
267 sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO; 268 sdi0_vsel = SNOWBALL_SDMMC_1V8_3V_GPIO;
268 sdi0_configure(); 269 sdi0_configure(parent);
269} 270}
270 271
271void __init hrefv60_sdi_init(void) 272void __init hrefv60_sdi_init(struct device *parent)
272{ 273{
273 /* PoP:ed eMMC */ 274 /* PoP:ed eMMC */
274 db8500_add_sdi2(&mop500_sdi2_data, U8500_SDI_V2_PERIPHID); 275 db8500_add_sdi2(parent, &mop500_sdi2_data, U8500_SDI_V2_PERIPHID);
275 /* On-board eMMC */ 276 /* On-board eMMC */
276 db8500_add_sdi4(&mop500_sdi4_data, U8500_SDI_V2_PERIPHID); 277 db8500_add_sdi4(parent, &mop500_sdi4_data, U8500_SDI_V2_PERIPHID);
277 /* External Micro SD slot */ 278 /* External Micro SD slot */
278 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO; 279 mop500_sdi0_data.gpio_cd = HREFV60_SDMMC_CD_GPIO;
279 sdi0_en = HREFV60_SDMMC_EN_GPIO; 280 sdi0_en = HREFV60_SDMMC_EN_GPIO;
280 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO; 281 sdi0_vsel = HREFV60_SDMMC_1V8_3V_GPIO;
281 sdi0_configure(); 282 sdi0_configure(parent);
282 /* WLAN SDIO channel */ 283 /* WLAN SDIO channel */
283 db8500_add_sdi1(&mop500_sdi1_data, U8500_SDI_V2_PERIPHID); 284 db8500_add_sdi1(parent, &mop500_sdi1_data, U8500_SDI_V2_PERIPHID);
284} 285}
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 6d672a556df8..77d03c1fbd04 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -30,6 +30,9 @@
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32 32
33#include <linux/of.h>
34#include <linux/of_platform.h>
35
33#include <linux/leds.h> 36#include <linux/leds.h>
34#include <asm/mach-types.h> 37#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
@@ -226,7 +229,12 @@ static struct tps6105x_platform_data mop500_tps61052_data = {
226 229
227static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base) 230static void mop500_tc35892_init(struct tc3589x *tc3589x, unsigned int base)
228{ 231{
229 mop500_sdi_tc35892_init(); 232 struct device *parent = NULL;
233#if 0
234 /* FIXME: Is the sdi actually part of tc3589x? */
235 parent = tc3589x->dev;
236#endif
237 mop500_sdi_tc35892_init(parent);
230} 238}
231 239
232static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = { 240static struct tc3589x_gpio_platform_data mop500_tc35892_gpio_data = {
@@ -353,12 +361,12 @@ U8500_I2C_CONTROLLER(1, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
353U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); 361U8500_I2C_CONTROLLER(2, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
354U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST); 362U8500_I2C_CONTROLLER(3, 0xe, 1, 8, 100000, 200, I2C_FREQ_MODE_FAST);
355 363
356static void __init mop500_i2c_init(void) 364static void __init mop500_i2c_init(struct device *parent)
357{ 365{
358 db8500_add_i2c0(&u8500_i2c0_data); 366 db8500_add_i2c0(parent, &u8500_i2c0_data);
359 db8500_add_i2c1(&u8500_i2c1_data); 367 db8500_add_i2c1(parent, &u8500_i2c1_data);
360 db8500_add_i2c2(&u8500_i2c2_data); 368 db8500_add_i2c2(parent, &u8500_i2c2_data);
361 db8500_add_i2c3(&u8500_i2c3_data); 369 db8500_add_i2c3(parent, &u8500_i2c3_data);
362} 370}
363 371
364static struct gpio_keys_button mop500_gpio_keys[] = { 372static struct gpio_keys_button mop500_gpio_keys[] = {
@@ -435,7 +443,7 @@ static struct stedma40_chan_cfg ssp0_dma_cfg_tx = {
435}; 443};
436#endif 444#endif
437 445
438static struct pl022_ssp_controller ssp0_platform_data = { 446static struct pl022_ssp_controller ssp0_plat = {
439 .bus_id = 0, 447 .bus_id = 0,
440#ifdef CONFIG_STE_DMA40 448#ifdef CONFIG_STE_DMA40
441 .enable_dma = 1, 449 .enable_dma = 1,
@@ -451,9 +459,9 @@ static struct pl022_ssp_controller ssp0_platform_data = {
451 .num_chipselect = 5, 459 .num_chipselect = 5,
452}; 460};
453 461
454static void __init mop500_spi_init(void) 462static void __init mop500_spi_init(struct device *parent)
455{ 463{
456 db8500_add_ssp0(&ssp0_platform_data); 464 db8500_add_ssp0(parent, &ssp0_plat);
457} 465}
458 466
459#ifdef CONFIG_STE_DMA40 467#ifdef CONFIG_STE_DMA40
@@ -587,11 +595,11 @@ static struct amba_pl011_data uart2_plat = {
587#endif 595#endif
588}; 596};
589 597
590static void __init mop500_uart_init(void) 598static void __init mop500_uart_init(struct device *parent)
591{ 599{
592 db8500_add_uart0(&uart0_plat); 600 db8500_add_uart0(parent, &uart0_plat);
593 db8500_add_uart1(&uart1_plat); 601 db8500_add_uart1(parent, &uart1_plat);
594 db8500_add_uart2(&uart2_plat); 602 db8500_add_uart2(parent, &uart2_plat);
595} 603}
596 604
597static struct platform_device *snowball_platform_devs[] __initdata = { 605static struct platform_device *snowball_platform_devs[] __initdata = {
@@ -603,21 +611,27 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
603 611
604static void __init mop500_init_machine(void) 612static void __init mop500_init_machine(void)
605{ 613{
614 struct device *parent = NULL;
606 int i2c0_devs; 615 int i2c0_devs;
616 int i;
607 617
608 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 618 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
609 619
610 u8500_init_devices(); 620 parent = u8500_init_devices();
611 621
612 mop500_pins_init(); 622 mop500_pins_init();
613 623
624 /* FIXME: parent of ab8500 should be prcmu */
625 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
626 mop500_platform_devs[i]->dev.parent = parent;
627
614 platform_add_devices(mop500_platform_devs, 628 platform_add_devices(mop500_platform_devs,
615 ARRAY_SIZE(mop500_platform_devs)); 629 ARRAY_SIZE(mop500_platform_devs));
616 630
617 mop500_i2c_init(); 631 mop500_i2c_init(parent);
618 mop500_sdi_init(); 632 mop500_sdi_init(parent);
619 mop500_spi_init(); 633 mop500_spi_init(parent);
620 mop500_uart_init(); 634 mop500_uart_init(parent);
621 635
622 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 636 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
623 637
@@ -631,19 +645,24 @@ static void __init mop500_init_machine(void)
631 645
632static void __init snowball_init_machine(void) 646static void __init snowball_init_machine(void)
633{ 647{
648 struct device *parent = NULL;
634 int i2c0_devs; 649 int i2c0_devs;
650 int i;
635 651
636 u8500_init_devices(); 652 parent = u8500_init_devices();
637 653
638 snowball_pins_init(); 654 snowball_pins_init();
639 655
656 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
657 snowball_platform_devs[i]->dev.parent = parent;
658
640 platform_add_devices(snowball_platform_devs, 659 platform_add_devices(snowball_platform_devs,
641 ARRAY_SIZE(snowball_platform_devs)); 660 ARRAY_SIZE(snowball_platform_devs));
642 661
643 mop500_i2c_init(); 662 mop500_i2c_init(parent);
644 snowball_sdi_init(); 663 snowball_sdi_init(parent);
645 mop500_spi_init(); 664 mop500_spi_init(parent);
646 mop500_uart_init(); 665 mop500_uart_init(parent);
647 666
648 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 667 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
649 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs); 668 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
@@ -656,7 +675,9 @@ static void __init snowball_init_machine(void)
656 675
657static void __init hrefv60_init_machine(void) 676static void __init hrefv60_init_machine(void)
658{ 677{
678 struct device *parent = NULL;
659 int i2c0_devs; 679 int i2c0_devs;
680 int i;
660 681
661 /* 682 /*
662 * The HREFv60 board removed a GPIO expander and routed 683 * The HREFv60 board removed a GPIO expander and routed
@@ -665,17 +686,20 @@ static void __init hrefv60_init_machine(void)
665 */ 686 */
666 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 687 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
667 688
668 u8500_init_devices(); 689 parent = u8500_init_devices();
669 690
670 hrefv60_pins_init(); 691 hrefv60_pins_init();
671 692
693 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
694 mop500_platform_devs[i]->dev.parent = parent;
695
672 platform_add_devices(mop500_platform_devs, 696 platform_add_devices(mop500_platform_devs,
673 ARRAY_SIZE(mop500_platform_devs)); 697 ARRAY_SIZE(mop500_platform_devs));
674 698
675 mop500_i2c_init(); 699 mop500_i2c_init(parent);
676 hrefv60_sdi_init(); 700 hrefv60_sdi_init(parent);
677 mop500_spi_init(); 701 mop500_spi_init(parent);
678 mop500_uart_init(); 702 mop500_uart_init(parent);
679 703
680 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices); 704 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
681 705
@@ -718,3 +742,94 @@ MACHINE_START(SNOWBALL, "Calao Systems Snowball platform")
718 .handle_irq = gic_handle_irq, 742 .handle_irq = gic_handle_irq,
719 .init_machine = snowball_init_machine, 743 .init_machine = snowball_init_machine,
720MACHINE_END 744MACHINE_END
745
746#ifdef CONFIG_MACH_UX500_DT
747
748struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {
749 OF_DEV_AUXDATA("arm,pl011", 0x80120000, "uart0", &uart0_plat),
750 OF_DEV_AUXDATA("arm,pl011", 0x80121000, "uart1", &uart1_plat),
751 OF_DEV_AUXDATA("arm,pl011", 0x80007000, "uart2", &uart2_plat),
752 OF_DEV_AUXDATA("arm,pl022", 0x80002000, "ssp0", &ssp0_plat),
753 {},
754};
755
756static const struct of_device_id u8500_soc_node[] = {
757 /* only create devices below soc node */
758 { .compatible = "stericsson,db8500", },
759 { },
760};
761
762static void __init u8500_init_machine(void)
763{
764 struct device *parent = NULL;
765 int i2c0_devs;
766 int i;
767
768 parent = u8500_init_devices();
769 i2c0_devs = ARRAY_SIZE(mop500_i2c0_devices);
770
771 for (i = 0; i < ARRAY_SIZE(mop500_platform_devs); i++)
772 mop500_platform_devs[i]->dev.parent = parent;
773 for (i = 0; i < ARRAY_SIZE(snowball_platform_devs); i++)
774 snowball_platform_devs[i]->dev.parent = parent;
775
776 /* automatically probe child nodes of db8500 device */
777 of_platform_populate(NULL, u8500_soc_node, u8500_auxdata_lookup, parent);
778
779 if (of_machine_is_compatible("st-ericsson,mop500")) {
780 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
781 mop500_pins_init();
782
783 platform_add_devices(mop500_platform_devs,
784 ARRAY_SIZE(mop500_platform_devs));
785
786 mop500_sdi_init(parent);
787 } else if (of_machine_is_compatible("calaosystems,snowball-a9500")) {
788 snowball_pins_init();
789 platform_add_devices(snowball_platform_devs,
790 ARRAY_SIZE(snowball_platform_devs));
791
792 snowball_sdi_init(parent);
793 } else if (of_machine_is_compatible("st-ericsson,hrefv60+")) {
794 /*
795 * The HREFv60 board removed a GPIO expander and routed
796 * all these GPIO pins to the internal GPIO controller
797 * instead.
798 */
799 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
800 i2c0_devs -= NUM_PRE_V60_I2C0_DEVICES;
801 hrefv60_pins_init();
802 platform_add_devices(mop500_platform_devs,
803 ARRAY_SIZE(mop500_platform_devs));
804
805 hrefv60_sdi_init(parent);
806 }
807 mop500_i2c_init(parent);
808
809 i2c_register_board_info(0, mop500_i2c0_devices, i2c0_devs);
810 i2c_register_board_info(2, mop500_i2c2_devices,
811 ARRAY_SIZE(mop500_i2c2_devices));
812
813 /* This board has full regulator constraints */
814 regulator_has_full_constraints();
815}
816
817static const char * u8500_dt_board_compat[] = {
818 "calaosystems,snowball-a9500",
819 "st-ericsson,hrefv60+",
820 "st-ericsson,u8500",
821 "st-ericsson,mop500",
822 NULL,
823};
824
825
826DT_MACHINE_START(U8500_DT, "ST-Ericsson U8500 platform (Device Tree Support)")
827 .map_io = u8500_map_io,
828 .init_irq = ux500_init_irq,
829 /* we re-use nomadik timer here */
830 .timer = &ux500_timer,
831 .handle_irq = gic_handle_irq,
832 .init_machine = u8500_init_machine,
833 .dt_compat = u8500_dt_board_compat,
834MACHINE_END
835#endif
diff --git a/arch/arm/mach-ux500/board-mop500.h b/arch/arm/mach-ux500/board-mop500.h
index 7ff6cbffc104..fdcfa8721bb4 100644
--- a/arch/arm/mach-ux500/board-mop500.h
+++ b/arch/arm/mach-ux500/board-mop500.h
@@ -75,10 +75,10 @@
75 75
76struct i2c_board_info; 76struct i2c_board_info;
77 77
78extern void mop500_sdi_init(void); 78extern void mop500_sdi_init(struct device *parent);
79extern void snowball_sdi_init(void); 79extern void snowball_sdi_init(struct device *parent);
80extern void hrefv60_sdi_init(void); 80extern void hrefv60_sdi_init(struct device *parent);
81extern void mop500_sdi_tc35892_init(void); 81extern void mop500_sdi_tc35892_init(struct device *parent);
82void __init mop500_u8500uib_init(void); 82void __init mop500_u8500uib_init(void);
83void __init mop500_stuib_init(void); 83void __init mop500_stuib_init(void);
84void __init mop500_pins_init(void); 84void __init mop500_pins_init(void);
diff --git a/arch/arm/mach-ux500/board-u5500-sdi.c b/arch/arm/mach-ux500/board-u5500-sdi.c
index 63c3f8058ffc..836112eedde7 100644
--- a/arch/arm/mach-ux500/board-u5500-sdi.c
+++ b/arch/arm/mach-ux500/board-u5500-sdi.c
@@ -66,9 +66,9 @@ static struct mmci_platform_data u5500_sdi0_data = {
66#endif 66#endif
67}; 67};
68 68
69void __init u5500_sdi_init(void) 69void __init u5500_sdi_init(struct device *parent)
70{ 70{
71 nmk_config_pins(u5500_sdi_pins, ARRAY_SIZE(u5500_sdi_pins)); 71 nmk_config_pins(u5500_sdi_pins, ARRAY_SIZE(u5500_sdi_pins));
72 72
73 db5500_add_sdi0(&u5500_sdi0_data); 73 db5500_add_sdi0(parent, &u5500_sdi0_data);
74} 74}
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index 9de9e9c4dbbb..0ff4be72a809 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -97,9 +97,9 @@ static struct i2c_board_info __initdata u5500_i2c2_devices[] = {
97 }, 97 },
98}; 98};
99 99
100static void __init u5500_i2c_init(void) 100static void __init u5500_i2c_init(struct device *parent)
101{ 101{
102 db5500_add_i2c2(&u5500_i2c2_data); 102 db5500_add_i2c2(parent, &u5500_i2c2_data);
103 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices)); 103 i2c_register_board_info(2, ARRAY_AND_SIZE(u5500_i2c2_devices));
104} 104}
105 105
@@ -126,20 +126,27 @@ static struct platform_device *u5500_platform_devices[] __initdata = {
126 &ab5500_device, 126 &ab5500_device,
127}; 127};
128 128
129static void __init u5500_uart_init(void) 129static void __init u5500_uart_init(struct device *parent)
130{ 130{
131 db5500_add_uart0(NULL); 131 db5500_add_uart0(parent, NULL);
132 db5500_add_uart1(NULL); 132 db5500_add_uart1(parent, NULL);
133 db5500_add_uart2(NULL); 133 db5500_add_uart2(parent, NULL);
134} 134}
135 135
136static void __init u5500_init_machine(void) 136static void __init u5500_init_machine(void)
137{ 137{
138 u5500_init_devices(); 138 struct device *parent = NULL;
139 int i;
140
141 parent = u5500_init_devices();
139 nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins)); 142 nmk_config_pins(u5500_pins, ARRAY_SIZE(u5500_pins));
140 u5500_i2c_init(); 143
141 u5500_sdi_init(); 144 u5500_i2c_init(parent);
142 u5500_uart_init(); 145 u5500_sdi_init(parent);
146 u5500_uart_init(parent);
147
148 for (i = 0; i < ARRAY_SIZE(u5500_platform_devices); i++)
149 u5500_platform_devices[i]->dev.parent = parent;
143 150
144 platform_add_devices(u5500_platform_devices, 151 platform_add_devices(u5500_platform_devices,
145 ARRAY_SIZE(u5500_platform_devices)); 152 ARRAY_SIZE(u5500_platform_devices));
diff --git a/arch/arm/mach-ux500/cache-l2x0.c b/arch/arm/mach-ux500/cache-l2x0.c
index da5569d83d58..77a75ed0df67 100644
--- a/arch/arm/mach-ux500/cache-l2x0.c
+++ b/arch/arm/mach-ux500/cache-l2x0.c
@@ -5,6 +5,8 @@
5 */ 5 */
6 6
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/of.h>
9
8#include <asm/cacheflush.h> 10#include <asm/cacheflush.h>
9#include <asm/hardware/cache-l2x0.h> 11#include <asm/hardware/cache-l2x0.h>
10#include <mach/hardware.h> 12#include <mach/hardware.h>
@@ -45,7 +47,10 @@ static int __init ux500_l2x0_init(void)
45 ux500_l2x0_unlock(); 47 ux500_l2x0_unlock();
46 48
47 /* 64KB way size, 8 way associativity, force WA */ 49 /* 64KB way size, 8 way associativity, force WA */
48 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff); 50 if (of_have_populated_dt())
51 l2x0_of_init(0x3e060000, 0xc0000fff);
52 else
53 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff);
49 54
50 /* 55 /*
51 * We can't disable l2 as we are in non secure mode, currently 56 * We can't disable l2 as we are in non secure mode, currently
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index 18aa5c05c69e..bca47f32082f 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -147,13 +147,13 @@ static resource_size_t __initdata db5500_gpio_base[] = {
147 U5500_GPIOBANK7_BASE, 147 U5500_GPIOBANK7_BASE,
148}; 148};
149 149
150static void __init db5500_add_gpios(void) 150static void __init db5500_add_gpios(struct device *parent)
151{ 151{
152 struct nmk_gpio_platform_data pdata = { 152 struct nmk_gpio_platform_data pdata = {
153 /* No custom data yet */ 153 /* No custom data yet */
154 }; 154 };
155 155
156 dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base), 156 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db5500_gpio_base),
157 IRQ_DB5500_GPIO0, &pdata); 157 IRQ_DB5500_GPIO0, &pdata);
158} 158}
159 159
@@ -212,14 +212,36 @@ static int usb_db5500_tx_dma_cfg[] = {
212 DB5500_DMA_DEV38_USB_OTG_OEP_8 212 DB5500_DMA_DEV38_USB_OTG_OEP_8
213}; 213};
214 214
215void __init u5500_init_devices(void) 215static const char *db5500_read_soc_id(void)
216{ 216{
217 db5500_add_gpios(); 217 return kasprintf(GFP_KERNEL, "u5500 currently unsupported\n");
218}
219
220static struct device * __init db5500_soc_device_init(void)
221{
222 const char *soc_id = db5500_read_soc_id();
223
224 return ux500_soc_device_init(soc_id);
225}
226
227struct device * __init u5500_init_devices(void)
228{
229 struct device *parent;
230 int i;
231
232 parent = db5500_soc_device_init();
233
234 db5500_add_gpios(parent);
218 db5500_pmu_init(); 235 db5500_pmu_init();
219 db5500_dma_init(); 236 db5500_dma_init(parent);
220 db5500_add_rtc(); 237 db5500_add_rtc(parent);
221 db5500_add_usb(usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg); 238 db5500_add_usb(parent, usb_db5500_rx_dma_cfg, usb_db5500_tx_dma_cfg);
239
240 for (i = 0; i < ARRAY_SIZE(db5500_platform_devs); i++)
241 db5500_platform_devs[i]->dev.parent = parent;
222 242
223 platform_add_devices(db5500_platform_devs, 243 platform_add_devices(db5500_platform_devs,
224 ARRAY_SIZE(db5500_platform_devs)); 244 ARRAY_SIZE(db5500_platform_devs));
245
246 return parent;
225} 247}
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 7176ee7491ab..9bd8163896cf 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -24,6 +24,7 @@
24#include <mach/setup.h> 24#include <mach/setup.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
26#include <mach/usb.h> 26#include <mach/usb.h>
27#include <mach/db8500-regs.h>
27 28
28#include "devices-db8500.h" 29#include "devices-db8500.h"
29#include "ste-dma40-db8500.h" 30#include "ste-dma40-db8500.h"
@@ -132,13 +133,13 @@ static resource_size_t __initdata db8500_gpio_base[] = {
132 U8500_GPIOBANK8_BASE, 133 U8500_GPIOBANK8_BASE,
133}; 134};
134 135
135static void __init db8500_add_gpios(void) 136static void __init db8500_add_gpios(struct device *parent)
136{ 137{
137 struct nmk_gpio_platform_data pdata = { 138 struct nmk_gpio_platform_data pdata = {
138 .supports_sleepmode = true, 139 .supports_sleepmode = true,
139 }; 140 };
140 141
141 dbx500_add_gpios(ARRAY_AND_SIZE(db8500_gpio_base), 142 dbx500_add_gpios(parent, ARRAY_AND_SIZE(db8500_gpio_base),
142 IRQ_DB8500_GPIO0, &pdata); 143 IRQ_DB8500_GPIO0, &pdata);
143} 144}
144 145
@@ -164,17 +165,44 @@ static int usb_db8500_tx_dma_cfg[] = {
164 DB8500_DMA_DEV39_USB_OTG_OEP_8 165 DB8500_DMA_DEV39_USB_OTG_OEP_8
165}; 166};
166 167
168static const char *db8500_read_soc_id(void)
169{
170 void __iomem *uid = __io_address(U8500_BB_UID_BASE);
171
172 return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x",
173 readl((u32 *)uid+1),
174 readl((u32 *)uid+1), readl((u32 *)uid+2),
175 readl((u32 *)uid+3), readl((u32 *)uid+4));
176}
177
178static struct device * __init db8500_soc_device_init(void)
179{
180 const char *soc_id = db8500_read_soc_id();
181
182 return ux500_soc_device_init(soc_id);
183}
184
167/* 185/*
168 * This function is called from the board init 186 * This function is called from the board init
169 */ 187 */
170void __init u8500_init_devices(void) 188struct device * __init u8500_init_devices(void)
171{ 189{
172 db8500_add_rtc(); 190 struct device *parent;
173 db8500_add_gpios(); 191 int i;
174 db8500_add_usb(usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg); 192
193 parent = db8500_soc_device_init();
194
195 db8500_add_rtc(parent);
196 db8500_add_gpios(parent);
197 db8500_add_usb(parent, usb_db8500_rx_dma_cfg, usb_db8500_tx_dma_cfg);
198
199 platform_device_register_data(parent,
200 "cpufreq-u8500", -1, NULL, 0);
201
202 for (i = 0; i < ARRAY_SIZE(platform_devs); i++)
203 platform_devs[i]->dev.parent = parent;
175 204
176 platform_device_register_simple("cpufreq-u8500", -1, NULL, 0);
177 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs)); 205 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
178 206
179 return ; 207 return parent;
180} 208}
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index 851308bf6424..d11f3892a27d 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -2,6 +2,7 @@
2 * Copyright (C) ST-Ericsson SA 2010 2 * Copyright (C) ST-Ericsson SA 2010
3 * 3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2 6 * License terms: GNU General Public License (GPL) version 2
6 */ 7 */
7 8
@@ -11,6 +12,12 @@
11#include <linux/mfd/db8500-prcmu.h> 12#include <linux/mfd/db8500-prcmu.h>
12#include <linux/mfd/db5500-prcmu.h> 13#include <linux/mfd/db5500-prcmu.h>
13#include <linux/clksrc-dbx500-prcmu.h> 14#include <linux/clksrc-dbx500-prcmu.h>
15#include <linux/sys_soc.h>
16#include <linux/err.h>
17#include <linux/slab.h>
18#include <linux/stat.h>
19#include <linux/of.h>
20#include <linux/of_irq.h>
14 21
15#include <asm/hardware/gic.h> 22#include <asm/hardware/gic.h>
16#include <asm/mach/map.h> 23#include <asm/mach/map.h>
@@ -23,6 +30,11 @@
23 30
24void __iomem *_PRCMU_BASE; 31void __iomem *_PRCMU_BASE;
25 32
33static const struct of_device_id ux500_dt_irq_match[] = {
34 { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
35 {},
36};
37
26void __init ux500_init_irq(void) 38void __init ux500_init_irq(void)
27{ 39{
28 void __iomem *dist_base; 40 void __iomem *dist_base;
@@ -37,7 +49,12 @@ void __init ux500_init_irq(void)
37 } else 49 } else
38 ux500_unknown_soc(); 50 ux500_unknown_soc();
39 51
40 gic_init(0, 29, dist_base, cpu_base); 52#ifdef CONFIG_OF
53 if (of_have_populated_dt())
54 of_irq_init(ux500_dt_irq_match);
55 else
56#endif
57 gic_init(0, 29, dist_base, cpu_base);
41 58
42 /* 59 /*
43 * Init clocks here so that they are available for system timer 60 * Init clocks here so that they are available for system timer
@@ -49,3 +66,73 @@ void __init ux500_init_irq(void)
49 db8500_prcmu_early_init(); 66 db8500_prcmu_early_init();
50 clk_init(); 67 clk_init();
51} 68}
69
70static const char * __init ux500_get_machine(void)
71{
72 return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber());
73}
74
75static const char * __init ux500_get_family(void)
76{
77 return kasprintf(GFP_KERNEL, "ux500");
78}
79
80static const char * __init ux500_get_revision(void)
81{
82 unsigned int rev = dbx500_revision();
83
84 if (rev == 0x01)
85 return kasprintf(GFP_KERNEL, "%s", "ED");
86 else if (rev >= 0xA0)
87 return kasprintf(GFP_KERNEL, "%d.%d",
88 (rev >> 4) - 0xA + 1, rev & 0xf);
89
90 return kasprintf(GFP_KERNEL, "%s", "Unknown");
91}
92
93static ssize_t ux500_get_process(struct device *dev,
94 struct device_attribute *attr,
95 char *buf)
96{
97 if (dbx500_id.process == 0x00)
98 return sprintf(buf, "Standard\n");
99
100 return sprintf(buf, "%02xnm\n", dbx500_id.process);
101}
102
103static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr,
104 const char *soc_id)
105{
106 soc_dev_attr->soc_id = soc_id;
107 soc_dev_attr->machine = ux500_get_machine();
108 soc_dev_attr->family = ux500_get_family();
109 soc_dev_attr->revision = ux500_get_revision();
110}
111
112struct device_attribute ux500_soc_attr =
113 __ATTR(process, S_IRUGO, ux500_get_process, NULL);
114
115struct device * __init ux500_soc_device_init(const char *soc_id)
116{
117 struct device *parent;
118 struct soc_device *soc_dev;
119 struct soc_device_attribute *soc_dev_attr;
120
121 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
122 if (!soc_dev_attr)
123 return ERR_PTR(-ENOMEM);
124
125 soc_info_populate(soc_dev_attr, soc_id);
126
127 soc_dev = soc_device_register(soc_dev_attr);
128 if (IS_ERR_OR_NULL(soc_dev)) {
129 kfree(soc_dev_attr);
130 return NULL;
131 }
132
133 parent = soc_device_to_device(soc_dev);
134 if (!IS_ERR_OR_NULL(parent))
135 device_create_file(parent, &ux500_soc_attr);
136
137 return parent;
138}
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 898a64517b09..c5312a4b49f5 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -20,8 +20,9 @@
20#include "devices-common.h" 20#include "devices-common.h"
21 21
22struct amba_device * 22struct amba_device *
23dbx500_add_amba_device(const char *name, resource_size_t base, 23dbx500_add_amba_device(struct device *parent, const char *name,
24 int irq, void *pdata, unsigned int periphid) 24 resource_size_t base, int irq, void *pdata,
25 unsigned int periphid)
25{ 26{
26 struct amba_device *dev; 27 struct amba_device *dev;
27 int ret; 28 int ret;
@@ -39,6 +40,8 @@ dbx500_add_amba_device(const char *name, resource_size_t base,
39 40
40 dev->dev.platform_data = pdata; 41 dev->dev.platform_data = pdata;
41 42
43 dev->dev.parent = parent;
44
42 ret = amba_device_add(dev, &iomem_resource); 45 ret = amba_device_add(dev, &iomem_resource);
43 if (ret) { 46 if (ret) {
44 amba_device_put(dev); 47 amba_device_put(dev);
@@ -49,60 +52,7 @@ dbx500_add_amba_device(const char *name, resource_size_t base,
49} 52}
50 53
51static struct platform_device * 54static struct platform_device *
52dbx500_add_platform_device(const char *name, int id, void *pdata, 55dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq,
53 struct resource *res, int resnum)
54{
55 struct platform_device *dev;
56 int ret;
57
58 dev = platform_device_alloc(name, id);
59 if (!dev)
60 return ERR_PTR(-ENOMEM);
61
62 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
63 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
64
65 ret = platform_device_add_resources(dev, res, resnum);
66 if (ret)
67 goto out_free;
68
69 dev->dev.platform_data = pdata;
70
71 ret = platform_device_add(dev);
72 if (ret)
73 goto out_free;
74
75 return dev;
76
77out_free:
78 platform_device_put(dev);
79 return ERR_PTR(ret);
80}
81
82struct platform_device *
83dbx500_add_platform_device_4k1irq(const char *name, int id,
84 resource_size_t base,
85 int irq, void *pdata)
86{
87 struct resource resources[] = {
88 [0] = {
89 .start = base,
90 .end = base + SZ_4K - 1,
91 .flags = IORESOURCE_MEM,
92 },
93 [1] = {
94 .start = irq,
95 .end = irq,
96 .flags = IORESOURCE_IRQ,
97 }
98 };
99
100 return dbx500_add_platform_device(name, id, pdata, resources,
101 ARRAY_SIZE(resources));
102}
103
104static struct platform_device *
105dbx500_add_gpio(int id, resource_size_t addr, int irq,
106 struct nmk_gpio_platform_data *pdata) 56 struct nmk_gpio_platform_data *pdata)
107{ 57{
108 struct resource resources[] = { 58 struct resource resources[] = {
@@ -118,13 +68,18 @@ dbx500_add_gpio(int id, resource_size_t addr, int irq,
118 } 68 }
119 }; 69 };
120 70
121 return platform_device_register_resndata(NULL, "gpio", id, 71 return platform_device_register_resndata(
122 resources, ARRAY_SIZE(resources), 72 parent,
123 pdata, sizeof(*pdata)); 73 "gpio",
74 id,
75 resources,
76 ARRAY_SIZE(resources),
77 pdata,
78 sizeof(*pdata));
124} 79}
125 80
126void dbx500_add_gpios(resource_size_t *base, int num, int irq, 81void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
127 struct nmk_gpio_platform_data *pdata) 82 int irq, struct nmk_gpio_platform_data *pdata)
128{ 83{
129 int first = 0; 84 int first = 0;
130 int i; 85 int i;
@@ -134,6 +89,6 @@ void dbx500_add_gpios(resource_size_t *base, int num, int irq,
134 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first); 89 pdata->first_irq = NOMADIK_GPIO_TO_IRQ(first);
135 pdata->num_gpio = 32; 90 pdata->num_gpio = 32;
136 91
137 dbx500_add_gpio(i, base[i], irq, pdata); 92 dbx500_add_gpio(parent, i, base[i], irq, pdata);
138 } 93 }
139} 94}
diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h
index 7825705033bf..39c74ec82add 100644
--- a/arch/arm/mach-ux500/devices-common.h
+++ b/arch/arm/mach-ux500/devices-common.h
@@ -8,80 +8,89 @@
8#ifndef __DEVICES_COMMON_H 8#ifndef __DEVICES_COMMON_H
9#define __DEVICES_COMMON_H 9#define __DEVICES_COMMON_H
10 10
11extern struct amba_device * 11#include <linux/platform_device.h>
12dbx500_add_amba_device(const char *name, resource_size_t base, 12#include <linux/dma-mapping.h>
13 int irq, void *pdata, unsigned int periphid); 13#include <linux/sys_soc.h>
14#include <plat/i2c.h>
14 15
15extern struct platform_device * 16extern struct amba_device *
16dbx500_add_platform_device_4k1irq(const char *name, int id, 17dbx500_add_amba_device(struct device *parent, const char *name,
17 resource_size_t base, 18 resource_size_t base, int irq, void *pdata,
18 int irq, void *pdata); 19 unsigned int periphid);
19 20
20struct spi_master_cntlr; 21struct spi_master_cntlr;
21 22
22static inline struct amba_device * 23static inline struct amba_device *
23dbx500_add_msp_spi(const char *name, resource_size_t base, int irq, 24dbx500_add_msp_spi(struct device *parent, const char *name,
25 resource_size_t base, int irq,
24 struct spi_master_cntlr *pdata) 26 struct spi_master_cntlr *pdata)
25{ 27{
26 return dbx500_add_amba_device(name, base, irq, pdata, 0); 28 return dbx500_add_amba_device(parent, name, base, irq,
29 pdata, 0);
27} 30}
28 31
29static inline struct amba_device * 32static inline struct amba_device *
30dbx500_add_spi(const char *name, resource_size_t base, int irq, 33dbx500_add_spi(struct device *parent, const char *name, resource_size_t base,
31 struct spi_master_cntlr *pdata, 34 int irq, struct spi_master_cntlr *pdata,
32 u32 periphid) 35 u32 periphid)
33{ 36{
34 return dbx500_add_amba_device(name, base, irq, pdata, periphid); 37 return dbx500_add_amba_device(parent, name, base, irq,
38 pdata, periphid);
35} 39}
36 40
37struct mmci_platform_data; 41struct mmci_platform_data;
38 42
39static inline struct amba_device * 43static inline struct amba_device *
40dbx500_add_sdi(const char *name, resource_size_t base, int irq, 44dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base,
41 struct mmci_platform_data *pdata, 45 int irq, struct mmci_platform_data *pdata, u32 periphid)
42 u32 periphid)
43{ 46{
44 return dbx500_add_amba_device(name, base, irq, pdata, periphid); 47 return dbx500_add_amba_device(parent, name, base, irq,
48 pdata, periphid);
45} 49}
46 50
47struct amba_pl011_data; 51struct amba_pl011_data;
48 52
49static inline struct amba_device * 53static inline struct amba_device *
50dbx500_add_uart(const char *name, resource_size_t base, int irq, 54dbx500_add_uart(struct device *parent, const char *name, resource_size_t base,
51 struct amba_pl011_data *pdata) 55 int irq, struct amba_pl011_data *pdata)
52{ 56{
53 return dbx500_add_amba_device(name, base, irq, pdata, 0); 57 return dbx500_add_amba_device(parent, name, base, irq, pdata, 0);
54} 58}
55 59
56struct nmk_i2c_controller; 60struct nmk_i2c_controller;
57 61
58static inline struct platform_device * 62static inline struct platform_device *
59dbx500_add_i2c(int id, resource_size_t base, int irq, 63dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq,
60 struct nmk_i2c_controller *pdata) 64 struct nmk_i2c_controller *data)
61{
62 return dbx500_add_platform_device_4k1irq("nmk-i2c", id, base, irq,
63 pdata);
64}
65
66struct msp_i2s_platform_data;
67
68static inline struct platform_device *
69dbx500_add_msp_i2s(int id, resource_size_t base, int irq,
70 struct msp_i2s_platform_data *pdata)
71{ 65{
72 return dbx500_add_platform_device_4k1irq("MSP_I2S", id, base, irq, 66 struct resource res[] = {
73 pdata); 67 DEFINE_RES_MEM(base, SZ_4K),
68 DEFINE_RES_IRQ(irq),
69 };
70
71 struct platform_device_info pdevinfo = {
72 .parent = parent,
73 .name = "nmk-i2c",
74 .id = id,
75 .res = res,
76 .num_res = ARRAY_SIZE(res),
77 .data = data,
78 .size_data = sizeof(*data),
79 .dma_mask = DMA_BIT_MASK(32),
80 };
81
82 return platform_device_register_full(&pdevinfo);
74} 83}
75 84
76static inline struct amba_device * 85static inline struct amba_device *
77dbx500_add_rtc(resource_size_t base, int irq) 86dbx500_add_rtc(struct device *parent, resource_size_t base, int irq)
78{ 87{
79 return dbx500_add_amba_device("rtc-pl031", base, irq, NULL, 0); 88 return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0);
80} 89}
81 90
82struct nmk_gpio_platform_data; 91struct nmk_gpio_platform_data;
83 92
84void dbx500_add_gpios(resource_size_t *base, int num, int irq, 93void dbx500_add_gpios(struct device *parent, resource_size_t *base, int num,
85 struct nmk_gpio_platform_data *pdata); 94 int irq, struct nmk_gpio_platform_data *pdata);
86 95
87#endif 96#endif
diff --git a/arch/arm/mach-ux500/devices-db5500.h b/arch/arm/mach-ux500/devices-db5500.h
index 0c4bccd02b90..e70955502c35 100644
--- a/arch/arm/mach-ux500/devices-db5500.h
+++ b/arch/arm/mach-ux500/devices-db5500.h
@@ -10,70 +10,90 @@
10 10
11#include "devices-common.h" 11#include "devices-common.h"
12 12
13#define db5500_add_i2c1(pdata) \ 13#define db5500_add_i2c1(parent, pdata) \
14 dbx500_add_i2c(1, U5500_I2C1_BASE, IRQ_DB5500_I2C1, pdata) 14 dbx500_add_i2c(parent, 1, U5500_I2C1_BASE, IRQ_DB5500_I2C1, pdata)
15#define db5500_add_i2c2(pdata) \ 15#define db5500_add_i2c2(parent, pdata) \
16 dbx500_add_i2c(2, U5500_I2C2_BASE, IRQ_DB5500_I2C2, pdata) 16 dbx500_add_i2c(parent, 2, U5500_I2C2_BASE, IRQ_DB5500_I2C2, pdata)
17#define db5500_add_i2c3(pdata) \ 17#define db5500_add_i2c3(parent, pdata) \
18 dbx500_add_i2c(3, U5500_I2C3_BASE, IRQ_DB5500_I2C3, pdata) 18 dbx500_add_i2c(parent, 3, U5500_I2C3_BASE, IRQ_DB5500_I2C3, pdata)
19 19
20#define db5500_add_msp0_i2s(pdata) \ 20#define db5500_add_msp0_spi(parent, pdata) \
21 dbx500_add_msp_i2s(0, U5500_MSP0_BASE, IRQ_DB5500_MSP0, pdata) 21 dbx500_add_msp_spi(parent, "msp0", U5500_MSP0_BASE, \
22#define db5500_add_msp1_i2s(pdata) \ 22 IRQ_DB5500_MSP0, pdata)
23 dbx500_add_msp_i2s(1, U5500_MSP1_BASE, IRQ_DB5500_MSP1, pdata) 23#define db5500_add_msp1_spi(parent, pdata) \
24#define db5500_add_msp2_i2s(pdata) \ 24 dbx500_add_msp_spi(parent, "msp1", U5500_MSP1_BASE, \
25 dbx500_add_msp_i2s(2, U5500_MSP2_BASE, IRQ_DB5500_MSP2, pdata) 25 IRQ_DB5500_MSP1, pdata)
26#define db5500_add_msp2_spi(parent, pdata) \
27 dbx500_add_msp_spi(parent, "msp2", U5500_MSP2_BASE, \
28 IRQ_DB5500_MSP2, pdata)
26 29
27#define db5500_add_msp0_spi(pdata) \ 30#define db5500_add_msp0_spi(parent, pdata) \
28 dbx500_add_msp_spi("msp0", U5500_MSP0_BASE, IRQ_DB5500_MSP0, pdata) 31 dbx500_add_msp_spi(parent, "msp0", U5500_MSP0_BASE, \
29#define db5500_add_msp1_spi(pdata) \ 32 IRQ_DB5500_MSP0, pdata)
30 dbx500_add_msp_spi("msp1", U5500_MSP1_BASE, IRQ_DB5500_MSP1, pdata) 33#define db5500_add_msp1_spi(parent, pdata) \
31#define db5500_add_msp2_spi(pdata) \ 34 dbx500_add_msp_spi(parent, "msp1", U5500_MSP1_BASE, \
32 dbx500_add_msp_spi("msp2", U5500_MSP2_BASE, IRQ_DB5500_MSP2, pdata) 35 IRQ_DB5500_MSP1, pdata)
36#define db5500_add_msp2_spi(parent, pdata) \
37 dbx500_add_msp_spi(parent, "msp2", U5500_MSP2_BASE, \
38 IRQ_DB5500_MSP2, pdata)
33 39
34#define db5500_add_rtc() \ 40#define db5500_add_rtc(parent) \
35 dbx500_add_rtc(U5500_RTC_BASE, IRQ_DB5500_RTC); 41 dbx500_add_rtc(parent, U5500_RTC_BASE, IRQ_DB5500_RTC);
36 42
37#define db5500_add_usb(rx_cfg, tx_cfg) \ 43#define db5500_add_usb(parent, rx_cfg, tx_cfg) \
38 ux500_add_usb(U5500_USBOTG_BASE, IRQ_DB5500_USBOTG, rx_cfg, tx_cfg) 44 ux500_add_usb(parent, U5500_USBOTG_BASE, \
45 IRQ_DB5500_USBOTG, rx_cfg, tx_cfg)
39 46
40#define db5500_add_sdi0(pdata) \ 47#define db5500_add_sdi0(parent, pdata) \
41 dbx500_add_sdi("sdi0", U5500_SDI0_BASE, IRQ_DB5500_SDMMC0, pdata, \ 48 dbx500_add_sdi(parent, "sdi0", U5500_SDI0_BASE, \
49 IRQ_DB5500_SDMMC0, pdata, \
42 0x10480180) 50 0x10480180)
43#define db5500_add_sdi1(pdata) \ 51#define db5500_add_sdi1(parent, pdata) \
44 dbx500_add_sdi("sdi1", U5500_SDI1_BASE, IRQ_DB5500_SDMMC1, pdata, \ 52 dbx500_add_sdi(parent, "sdi1", U5500_SDI1_BASE, \
53 IRQ_DB5500_SDMMC1, pdata, \
45 0x10480180) 54 0x10480180)
46#define db5500_add_sdi2(pdata) \ 55#define db5500_add_sdi2(parent, pdata) \
47 dbx500_add_sdi("sdi2", U5500_SDI2_BASE, IRQ_DB5500_SDMMC2, pdata \ 56 dbx500_add_sdi(parent, "sdi2", U5500_SDI2_BASE, \
57 IRQ_DB5500_SDMMC2, pdata \
48 0x10480180) 58 0x10480180)
49#define db5500_add_sdi3(pdata) \ 59#define db5500_add_sdi3(parent, pdata) \
50 dbx500_add_sdi("sdi3", U5500_SDI3_BASE, IRQ_DB5500_SDMMC3, pdata \ 60 dbx500_add_sdi(parent, "sdi3", U5500_SDI3_BASE, \
61 IRQ_DB5500_SDMMC3, pdata \
51 0x10480180) 62 0x10480180)
52#define db5500_add_sdi4(pdata) \ 63#define db5500_add_sdi4(parent, pdata) \
53 dbx500_add_sdi("sdi4", U5500_SDI4_BASE, IRQ_DB5500_SDMMC4, pdata \ 64 dbx500_add_sdi(parent, "sdi4", U5500_SDI4_BASE, \
65 IRQ_DB5500_SDMMC4, pdata \
54 0x10480180) 66 0x10480180)
55 67
56/* This one has a bad peripheral ID in the U5500 silicon */ 68/* This one has a bad peripheral ID in the U5500 silicon */
57#define db5500_add_spi0(pdata) \ 69#define db5500_add_spi0(parent, pdata) \
58 dbx500_add_spi("spi0", U5500_SPI0_BASE, IRQ_DB5500_SPI0, pdata, \ 70 dbx500_add_spi(parent, "spi0", U5500_SPI0_BASE, \
71 IRQ_DB5500_SPI0, pdata, \
59 0x10080023) 72 0x10080023)
60#define db5500_add_spi1(pdata) \ 73#define db5500_add_spi1(parent, pdata) \
61 dbx500_add_spi("spi1", U5500_SPI1_BASE, IRQ_DB5500_SPI1, pdata, \ 74 dbx500_add_spi(parent, "spi1", U5500_SPI1_BASE, \
75 IRQ_DB5500_SPI1, pdata, \
62 0x10080023) 76 0x10080023)
63#define db5500_add_spi2(pdata) \ 77#define db5500_add_spi2(parent, pdata) \
64 dbx500_add_spi("spi2", U5500_SPI2_BASE, IRQ_DB5500_SPI2, pdata \ 78 dbx500_add_spi(parent, "spi2", U5500_SPI2_BASE, \
79 IRQ_DB5500_SPI2, pdata \
65 0x10080023) 80 0x10080023)
66#define db5500_add_spi3(pdata) \ 81#define db5500_add_spi3(parent, pdata) \
67 dbx500_add_spi("spi3", U5500_SPI3_BASE, IRQ_DB5500_SPI3, pdata \ 82 dbx500_add_spi(parent, "spi3", U5500_SPI3_BASE, \
83 IRQ_DB5500_SPI3, pdata \
68 0x10080023) 84 0x10080023)
69 85
70#define db5500_add_uart0(plat) \ 86#define db5500_add_uart0(parent, plat) \
71 dbx500_add_uart("uart0", U5500_UART0_BASE, IRQ_DB5500_UART0, plat) 87 dbx500_add_uart(parent, "uart0", U5500_UART0_BASE, \
72#define db5500_add_uart1(plat) \ 88 IRQ_DB5500_UART0, plat)
73 dbx500_add_uart("uart1", U5500_UART1_BASE, IRQ_DB5500_UART1, plat) 89#define db5500_add_uart1(parent, plat) \
74#define db5500_add_uart2(plat) \ 90 dbx500_add_uart(parent, "uart1", U5500_UART1_BASE, \
75 dbx500_add_uart("uart2", U5500_UART2_BASE, IRQ_DB5500_UART2, plat) 91 IRQ_DB5500_UART1, plat)
76#define db5500_add_uart3(plat) \ 92#define db5500_add_uart2(parent, plat) \
77 dbx500_add_uart("uart3", U5500_UART3_BASE, IRQ_DB5500_UART3, plat) 93 dbx500_add_uart(parent, "uart2", U5500_UART2_BASE, \
94 IRQ_DB5500_UART2, plat)
95#define db5500_add_uart3(parent, plat) \
96 dbx500_add_uart(parent, "uart3", U5500_UART3_BASE, \
97 IRQ_DB5500_UART3, plat)
78 98
79#endif 99#endif
diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h
index cbd4a9ae8109..9fd93e9da529 100644
--- a/arch/arm/mach-ux500/devices-db8500.h
+++ b/arch/arm/mach-ux500/devices-db8500.h
@@ -14,88 +14,114 @@ struct ske_keypad_platform_data;
14struct pl022_ssp_controller; 14struct pl022_ssp_controller;
15 15
16static inline struct platform_device * 16static inline struct platform_device *
17db8500_add_ske_keypad(struct ske_keypad_platform_data *pdata) 17db8500_add_ske_keypad(struct device *parent,
18 struct ske_keypad_platform_data *pdata,
19 size_t size)
18{ 20{
19 return dbx500_add_platform_device_4k1irq("nmk-ske-keypad", -1, 21 struct resource resources[] = {
20 U8500_SKE_BASE, 22 DEFINE_RES_MEM(U8500_SKE_BASE, SZ_4K),
21 IRQ_DB8500_KB, pdata); 23 DEFINE_RES_IRQ(IRQ_DB8500_KB),
24 };
25
26 return platform_device_register_resndata(parent, "nmk-ske-keypad", -1,
27 resources, 2, pdata, size);
22} 28}
23 29
24static inline struct amba_device * 30static inline struct amba_device *
25db8500_add_ssp(const char *name, resource_size_t base, int irq, 31db8500_add_ssp(struct device *parent, const char *name, resource_size_t base,
26 struct pl022_ssp_controller *pdata) 32 int irq, struct pl022_ssp_controller *pdata)
27{ 33{
28 return dbx500_add_amba_device(name, base, irq, pdata, 0); 34 return dbx500_add_amba_device(parent, name, base, irq, pdata, 0);
29} 35}
30 36
31 37
32#define db8500_add_i2c0(pdata) \ 38#define db8500_add_i2c0(parent, pdata) \
33 dbx500_add_i2c(0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata) 39 dbx500_add_i2c(parent, 0, U8500_I2C0_BASE, IRQ_DB8500_I2C0, pdata)
34#define db8500_add_i2c1(pdata) \ 40#define db8500_add_i2c1(parent, pdata) \
35 dbx500_add_i2c(1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata) 41 dbx500_add_i2c(parent, 1, U8500_I2C1_BASE, IRQ_DB8500_I2C1, pdata)
36#define db8500_add_i2c2(pdata) \ 42#define db8500_add_i2c2(parent, pdata) \
37 dbx500_add_i2c(2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata) 43 dbx500_add_i2c(parent, 2, U8500_I2C2_BASE, IRQ_DB8500_I2C2, pdata)
38#define db8500_add_i2c3(pdata) \ 44#define db8500_add_i2c3(parent, pdata) \
39 dbx500_add_i2c(3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata) 45 dbx500_add_i2c(parent, 3, U8500_I2C3_BASE, IRQ_DB8500_I2C3, pdata)
40#define db8500_add_i2c4(pdata) \ 46#define db8500_add_i2c4(parent, pdata) \
41 dbx500_add_i2c(4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata) 47 dbx500_add_i2c(parent, 4, U8500_I2C4_BASE, IRQ_DB8500_I2C4, pdata)
42 48
43#define db8500_add_msp0_i2s(pdata) \ 49#define db8500_add_msp0_i2s(parent, pdata) \
44 dbx500_add_msp_i2s(0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata) 50 dbx500_add_msp_i2s(parent, 0, U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata)
45#define db8500_add_msp1_i2s(pdata) \ 51#define db8500_add_msp1_i2s(parent, pdata) \
46 dbx500_add_msp_i2s(1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata) 52 dbx500_add_msp_i2s(parent, 1, U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata)
47#define db8500_add_msp2_i2s(pdata) \ 53#define db8500_add_msp2_i2s(parent, pdata) \
48 dbx500_add_msp_i2s(2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata) 54 dbx500_add_msp_i2s(parent, 2, U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata)
49#define db8500_add_msp3_i2s(pdata) \ 55#define db8500_add_msp3_i2s(parent, pdata) \
50 dbx500_add_msp_i2s(3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata) 56 dbx500_add_msp_i2s(parent, 3, U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata)
51 57
52#define db8500_add_msp0_spi(pdata) \ 58#define db8500_add_msp0_spi(parent, pdata) \
53 dbx500_add_msp_spi("msp0", U8500_MSP0_BASE, IRQ_DB8500_MSP0, pdata) 59 dbx500_add_msp_spi(parent, "msp0", U8500_MSP0_BASE, \
54#define db8500_add_msp1_spi(pdata) \ 60 IRQ_DB8500_MSP0, pdata)
55 dbx500_add_msp_spi("msp1", U8500_MSP1_BASE, IRQ_DB8500_MSP1, pdata) 61#define db8500_add_msp1_spi(parent, pdata) \
56#define db8500_add_msp2_spi(pdata) \ 62 dbx500_add_msp_spi(parent, "msp1", U8500_MSP1_BASE, \
57 dbx500_add_msp_spi("msp2", U8500_MSP2_BASE, IRQ_DB8500_MSP2, pdata) 63 IRQ_DB8500_MSP1, pdata)
58#define db8500_add_msp3_spi(pdata) \ 64#define db8500_add_msp2_spi(parent, pdata) \
59 dbx500_add_msp_spi("msp3", U8500_MSP3_BASE, IRQ_DB8500_MSP1, pdata) 65 dbx500_add_msp_spi(parent, "msp2", U8500_MSP2_BASE, \
60 66 IRQ_DB8500_MSP2, pdata)
61#define db8500_add_rtc() \ 67#define db8500_add_msp3_spi(parent, pdata) \
62 dbx500_add_rtc(U8500_RTC_BASE, IRQ_DB8500_RTC); 68 dbx500_add_msp_spi(parent, "msp3", U8500_MSP3_BASE, \
63 69 IRQ_DB8500_MSP1, pdata)
64#define db8500_add_usb(rx_cfg, tx_cfg) \ 70
65 ux500_add_usb(U8500_USBOTG_BASE, IRQ_DB8500_USBOTG, rx_cfg, tx_cfg) 71#define db8500_add_rtc(parent) \
66 72 dbx500_add_rtc(parent, U8500_RTC_BASE, IRQ_DB8500_RTC);
67#define db8500_add_sdi0(pdata, pid) \ 73
68 dbx500_add_sdi("sdi0", U8500_SDI0_BASE, IRQ_DB8500_SDMMC0, pdata, pid) 74#define db8500_add_usb(parent, rx_cfg, tx_cfg) \
69#define db8500_add_sdi1(pdata, pid) \ 75 ux500_add_usb(parent, U8500_USBOTG_BASE, \
70 dbx500_add_sdi("sdi1", U8500_SDI1_BASE, IRQ_DB8500_SDMMC1, pdata, pid) 76 IRQ_DB8500_USBOTG, rx_cfg, tx_cfg)
71#define db8500_add_sdi2(pdata, pid) \ 77
72 dbx500_add_sdi("sdi2", U8500_SDI2_BASE, IRQ_DB8500_SDMMC2, pdata, pid) 78#define db8500_add_sdi0(parent, pdata, pid) \
73#define db8500_add_sdi3(pdata, pid) \ 79 dbx500_add_sdi(parent, "sdi0", U8500_SDI0_BASE, \
74 dbx500_add_sdi("sdi3", U8500_SDI3_BASE, IRQ_DB8500_SDMMC3, pdata, pid) 80 IRQ_DB8500_SDMMC0, pdata, pid)
75#define db8500_add_sdi4(pdata, pid) \ 81#define db8500_add_sdi1(parent, pdata, pid) \
76 dbx500_add_sdi("sdi4", U8500_SDI4_BASE, IRQ_DB8500_SDMMC4, pdata, pid) 82 dbx500_add_sdi(parent, "sdi1", U8500_SDI1_BASE, \
77#define db8500_add_sdi5(pdata, pid) \ 83 IRQ_DB8500_SDMMC1, pdata, pid)
78 dbx500_add_sdi("sdi5", U8500_SDI5_BASE, IRQ_DB8500_SDMMC5, pdata, pid) 84#define db8500_add_sdi2(parent, pdata, pid) \
79 85 dbx500_add_sdi(parent, "sdi2", U8500_SDI2_BASE, \
80#define db8500_add_ssp0(pdata) \ 86 IRQ_DB8500_SDMMC2, pdata, pid)
81 db8500_add_ssp("ssp0", U8500_SSP0_BASE, IRQ_DB8500_SSP0, pdata) 87#define db8500_add_sdi3(parent, pdata, pid) \
82#define db8500_add_ssp1(pdata) \ 88 dbx500_add_sdi(parent, "sdi3", U8500_SDI3_BASE, \
83 db8500_add_ssp("ssp1", U8500_SSP1_BASE, IRQ_DB8500_SSP1, pdata) 89 IRQ_DB8500_SDMMC3, pdata, pid)
84 90#define db8500_add_sdi4(parent, pdata, pid) \
85#define db8500_add_spi0(pdata) \ 91 dbx500_add_sdi(parent, "sdi4", U8500_SDI4_BASE, \
86 dbx500_add_spi("spi0", U8500_SPI0_BASE, IRQ_DB8500_SPI0, pdata, 0) 92 IRQ_DB8500_SDMMC4, pdata, pid)
87#define db8500_add_spi1(pdata) \ 93#define db8500_add_sdi5(parent, pdata, pid) \
88 dbx500_add_spi("spi1", U8500_SPI1_BASE, IRQ_DB8500_SPI1, pdata, 0) 94 dbx500_add_sdi(parent, "sdi5", U8500_SDI5_BASE, \
89#define db8500_add_spi2(pdata) \ 95 IRQ_DB8500_SDMMC5, pdata, pid)
90 dbx500_add_spi("spi2", U8500_SPI2_BASE, IRQ_DB8500_SPI2, pdata, 0) 96
91#define db8500_add_spi3(pdata) \ 97#define db8500_add_ssp0(parent, pdata) \
92 dbx500_add_spi("spi3", U8500_SPI3_BASE, IRQ_DB8500_SPI3, pdata, 0) 98 db8500_add_ssp(parent, "ssp0", U8500_SSP0_BASE, \
93 99 IRQ_DB8500_SSP0, pdata)
94#define db8500_add_uart0(pdata) \ 100#define db8500_add_ssp1(parent, pdata) \
95 dbx500_add_uart("uart0", U8500_UART0_BASE, IRQ_DB8500_UART0, pdata) 101 db8500_add_ssp(parent, "ssp1", U8500_SSP1_BASE, \
96#define db8500_add_uart1(pdata) \ 102 IRQ_DB8500_SSP1, pdata)
97 dbx500_add_uart("uart1", U8500_UART1_BASE, IRQ_DB8500_UART1, pdata) 103
98#define db8500_add_uart2(pdata) \ 104#define db8500_add_spi0(parent, pdata) \
99 dbx500_add_uart("uart2", U8500_UART2_BASE, IRQ_DB8500_UART2, pdata) 105 dbx500_add_spi(parent, "spi0", U8500_SPI0_BASE, \
106 IRQ_DB8500_SPI0, pdata, 0)
107#define db8500_add_spi1(parent, pdata) \
108 dbx500_add_spi(parent, "spi1", U8500_SPI1_BASE, \
109 IRQ_DB8500_SPI1, pdata, 0)
110#define db8500_add_spi2(parent, pdata) \
111 dbx500_add_spi(parent, "spi2", U8500_SPI2_BASE, \
112 IRQ_DB8500_SPI2, pdata, 0)
113#define db8500_add_spi3(parent, pdata) \
114 dbx500_add_spi(parent, "spi3", U8500_SPI3_BASE, \
115 IRQ_DB8500_SPI3, pdata, 0)
116
117#define db8500_add_uart0(parent, pdata) \
118 dbx500_add_uart(parent, "uart0", U8500_UART0_BASE, \
119 IRQ_DB8500_UART0, pdata)
120#define db8500_add_uart1(parent, pdata) \
121 dbx500_add_uart(parent, "uart1", U8500_UART1_BASE, \
122 IRQ_DB8500_UART1, pdata)
123#define db8500_add_uart2(parent, pdata) \
124 dbx500_add_uart(parent, "uart2", U8500_UART2_BASE, \
125 IRQ_DB8500_UART2, pdata)
100 126
101#endif 127#endif
diff --git a/arch/arm/mach-ux500/dma-db5500.c b/arch/arm/mach-ux500/dma-db5500.c
index 1cfab68ae417..41e9470fa0e6 100644
--- a/arch/arm/mach-ux500/dma-db5500.c
+++ b/arch/arm/mach-ux500/dma-db5500.c
@@ -125,10 +125,11 @@ static struct platform_device dma40_device = {
125 .resource = dma40_resources 125 .resource = dma40_resources
126}; 126};
127 127
128void __init db5500_dma_init(void) 128void __init db5500_dma_init(struct device *parent)
129{ 129{
130 int ret; 130 int ret;
131 131
132 dma40_device.dev.parent = parent;
132 ret = platform_device_register(&dma40_device); 133 ret = platform_device_register(&dma40_device);
133 if (ret) 134 if (ret)
134 dev_err(&dma40_device.dev, "unable to register device: %d\n", ret); 135 dev_err(&dma40_device.dev, "unable to register device: %d\n", ret);
diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h
index 80e10f50282e..9ec20b96d8f2 100644
--- a/arch/arm/mach-ux500/include/mach/db8500-regs.h
+++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h
@@ -161,4 +161,7 @@
161#define U8500_MODEM_BASE 0xe000000 161#define U8500_MODEM_BASE 0xe000000
162#define U8500_APE_BASE 0x6000000 162#define U8500_APE_BASE 0x6000000
163 163
164/* SoC identification number information */
165#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0)
166
164#endif 167#endif
diff --git a/arch/arm/mach-ux500/include/mach/hardware.h b/arch/arm/mach-ux500/include/mach/hardware.h
index d93d6dbef25b..f84698936d36 100644
--- a/arch/arm/mach-ux500/include/mach/hardware.h
+++ b/arch/arm/mach-ux500/include/mach/hardware.h
@@ -23,7 +23,7 @@
23 (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL) 23 (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL)
24 24
25/* typesafe io address */ 25/* typesafe io address */
26#define __io_address(n) __io(IO_ADDRESS(n)) 26#define __io_address(n) IOMEM(IO_ADDRESS(n))
27/* Used by some plat-nomadik code */ 27/* Used by some plat-nomadik code */
28#define io_p2v(n) __io_address(n) 28#define io_p2v(n) __io_address(n)
29 29
diff --git a/arch/arm/mach-ux500/include/mach/io.h b/arch/arm/mach-ux500/include/mach/io.h
deleted file mode 100644
index 1cf3f44ce5b2..000000000000
--- a/arch/arm/mach-ux500/include/mach/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/mach-u8500/include/mach/io.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 *
6 * Modifications:
7 * 06-12-1997 RMK Created.
8 * 07-04-1999 RMK Major cleanup
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13#define IO_SPACE_LIMIT 0xffffffff
14
15/*
16 * We don't actually have real ISA nor PCI buses, but there is so many
17 * drivers out there that might just work if we fake them...
18 */
19#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a)
21
22#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
index d2d4131435a6..7d34c52798b5 100644
--- a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
+++ b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
@@ -13,7 +13,7 @@
13 13
14#define MOP500_AB8500_IRQ_BASE IRQ_BOARD_START 14#define MOP500_AB8500_IRQ_BASE IRQ_BOARD_START
15#define MOP500_AB8500_IRQ_END (MOP500_AB8500_IRQ_BASE \ 15#define MOP500_AB8500_IRQ_END (MOP500_AB8500_IRQ_BASE \
16 + AB8500_NR_IRQS) 16 + AB8500_MAX_NR_IRQS)
17 17
18/* TC35892 */ 18/* TC35892 */
19#define TC35892_NR_INTERNAL_IRQS 8 19#define TC35892_NR_INTERNAL_IRQS 8
diff --git a/arch/arm/mach-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
index 93d403955eaa..3dc00ffa7bfa 100644
--- a/arch/arm/mach-ux500/include/mach/setup.h
+++ b/arch/arm/mach-ux500/include/mach/setup.h
@@ -18,14 +18,16 @@ void __init ux500_map_io(void);
18extern void __init u5500_map_io(void); 18extern void __init u5500_map_io(void);
19extern void __init u8500_map_io(void); 19extern void __init u8500_map_io(void);
20 20
21extern void __init u5500_init_devices(void); 21extern struct device * __init u5500_init_devices(void);
22extern void __init u8500_init_devices(void); 22extern struct device * __init u8500_init_devices(void);
23 23
24extern void __init ux500_init_irq(void); 24extern void __init ux500_init_irq(void);
25 25
26extern void __init u5500_sdi_init(void); 26extern void __init u5500_sdi_init(struct device *parent);
27 27
28extern void __init db5500_dma_init(void); 28extern void __init db5500_dma_init(struct device *parent);
29
30extern struct device *ux500_soc_device_init(const char *soc_id);
29 31
30struct amba_device; 32struct amba_device;
31extern void __init amba_add_devices(struct amba_device *devs[], int num); 33extern void __init amba_add_devices(struct amba_device *devs[], int num);
diff --git a/arch/arm/mach-ux500/include/mach/usb.h b/arch/arm/mach-ux500/include/mach/usb.h
index d3739d418813..4c1cc50a595a 100644
--- a/arch/arm/mach-ux500/include/mach/usb.h
+++ b/arch/arm/mach-ux500/include/mach/usb.h
@@ -20,6 +20,6 @@ struct ux500_musb_board_data {
20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 20 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
21}; 21};
22 22
23void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg, 23void ux500_add_usb(struct device *parent, resource_size_t base,
24 int *dma_tx_cfg); 24 int irq, int *dma_rx_cfg, int *dma_tx_cfg);
25#endif 25#endif
diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c
index e9d580702fbb..d37df98b5c32 100644
--- a/arch/arm/mach-ux500/timer.c
+++ b/arch/arm/mach-ux500/timer.c
@@ -7,6 +7,7 @@
7#include <linux/io.h> 7#include <linux/io.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/clksrc-dbx500-prcmu.h> 9#include <linux/clksrc-dbx500-prcmu.h>
10#include <linux/of.h>
10 11
11#include <asm/smp_twd.h> 12#include <asm/smp_twd.h>
12 13
@@ -30,9 +31,13 @@ static void __init ux500_twd_init(void)
30 twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer : 31 twd_local_timer = cpu_is_u5500() ? &u5500_twd_local_timer :
31 &u8500_twd_local_timer; 32 &u8500_twd_local_timer;
32 33
33 err = twd_local_timer_register(twd_local_timer); 34 if (of_have_populated_dt())
34 if (err) 35 twd_local_timer_of_register();
35 pr_err("twd_local_timer_register failed %d\n", err); 36 else {
37 err = twd_local_timer_register(twd_local_timer);
38 if (err)
39 pr_err("twd_local_timer_register failed %d\n", err);
40 }
36} 41}
37#else 42#else
38#define ux500_twd_init() do { } while(0) 43#define ux500_twd_init() do { } while(0)
diff --git a/arch/arm/mach-ux500/usb.c b/arch/arm/mach-ux500/usb.c
index 9f9e1c203061..a74af389bc63 100644
--- a/arch/arm/mach-ux500/usb.c
+++ b/arch/arm/mach-ux500/usb.c
@@ -7,6 +7,7 @@
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
8#include <linux/usb/musb.h> 8#include <linux/usb/musb.h>
9#include <linux/dma-mapping.h> 9#include <linux/dma-mapping.h>
10
10#include <plat/ste_dma40.h> 11#include <plat/ste_dma40.h>
11#include <mach/hardware.h> 12#include <mach/hardware.h>
12#include <mach/usb.h> 13#include <mach/usb.h>
@@ -140,8 +141,8 @@ static inline void ux500_usb_dma_update_tx_ch_config(int *dst_dev_type)
140 musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx]; 141 musb_dma_tx_ch[idx].dst_dev_type = dst_dev_type[idx];
141} 142}
142 143
143void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg, 144void ux500_add_usb(struct device *parent, resource_size_t base, int irq,
144 int *dma_tx_cfg) 145 int *dma_rx_cfg, int *dma_tx_cfg)
145{ 146{
146 ux500_musb_device.resource[0].start = base; 147 ux500_musb_device.resource[0].start = base;
147 ux500_musb_device.resource[0].end = base + SZ_64K - 1; 148 ux500_musb_device.resource[0].end = base + SZ_64K - 1;
@@ -151,5 +152,7 @@ void ux500_add_usb(resource_size_t base, int irq, int *dma_rx_cfg,
151 ux500_usb_dma_update_rx_ch_config(dma_rx_cfg); 152 ux500_usb_dma_update_rx_ch_config(dma_rx_cfg);
152 ux500_usb_dma_update_tx_ch_config(dma_tx_cfg); 153 ux500_usb_dma_update_tx_ch_config(dma_tx_cfg);
153 154
155 ux500_musb_device.dev.parent = parent;
156
154 platform_device_register(&ux500_musb_device); 157 platform_device_register(&ux500_musb_device);
155} 158}
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 0968772aedbe..6bbd74e950ab 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -36,7 +36,6 @@
36#include <linux/clkdev.h> 36#include <linux/clkdev.h>
37#include <linux/mtd/physmap.h> 37#include <linux/mtd/physmap.h>
38 38
39#include <asm/system.h>
40#include <asm/irq.h> 39#include <asm/irq.h>
41#include <asm/leds.h> 40#include <asm/leds.h>
42#include <asm/hardware/arm_timer.h> 41#include <asm/hardware/arm_timer.h>
diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h
deleted file mode 100644
index f067c14c7182..000000000000
--- a/arch/arm/mach-versatile/include/mach/io.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * arch/arm/mach-versatile/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a)
27
28#endif
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 51733b022d04..d2268be8c34c 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -24,7 +24,6 @@
24 24
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <asm/irq.h> 26#include <asm/irq.h>
27#include <asm/system.h>
28#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
29 28
30/* 29/*
@@ -191,7 +190,7 @@ static struct resource pre_mem = {
191 .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH, 190 .flags = IORESOURCE_MEM | IORESOURCE_PREFETCH,
192}; 191};
193 192
194static int __init pci_versatile_setup_resources(struct list_head *resources) 193static int __init pci_versatile_setup_resources(struct pci_sys_data *sys)
195{ 194{
196 int ret = 0; 195 int ret = 0;
197 196
@@ -219,9 +218,9 @@ static int __init pci_versatile_setup_resources(struct list_head *resources)
219 * the mem resource for this bus 218 * the mem resource for this bus
220 * the prefetch mem resource for this bus 219 * the prefetch mem resource for this bus
221 */ 220 */
222 pci_add_resource_offset(resources, &io_mem, sys->io_offset); 221 pci_add_resource_offset(&sys->resources, &io_mem, sys->io_offset);
223 pci_add_resource_offset(resources, &non_mem, sys->mem_offset); 222 pci_add_resource_offset(&sys->resources, &non_mem, sys->mem_offset);
224 pci_add_resource_offset(resources, &pre_mem, sys->mem_offset); 223 pci_add_resource_offset(&sys->resources, &pre_mem, sys->mem_offset);
225 224
226 goto out; 225 goto out;
227 226
@@ -250,7 +249,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
250 249
251 if (nr == 0) { 250 if (nr == 0) {
252 sys->mem_offset = 0; 251 sys->mem_offset = 0;
253 ret = pci_versatile_setup_resources(&sys->resources); 252 ret = pci_versatile_setup_resources(sys);
254 if (ret < 0) { 253 if (ret < 0) {
255 printk("pci_versatile_setup: resources... oops?\n"); 254 printk("pci_versatile_setup: resources... oops?\n");
256 goto out; 255 goto out;
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index 3034a4dab4a1..c504a72b94d6 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/smp_plat.h> 16#include <asm/smp_plat.h>
17#include <asm/system.h> 17#include <asm/cp15.h>
18 18
19extern volatile int pen_release; 19extern volatile int pen_release;
20 20
diff --git a/arch/arm/mach-vexpress/include/mach/io.h b/arch/arm/mach-vexpress/include/mach/io.h
deleted file mode 100644
index 13522d86685e..000000000000
--- a/arch/arm/mach-vexpress/include/mach/io.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-vexpress/include/mach/io.h
3 *
4 * Copyright (C) 2003 ARM Limited
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define __io(a) __typesafe_io(a)
24#define __mem_pci(a) (a)
25
26#endif
diff --git a/arch/arm/mach-vt8500/include/mach/io.h b/arch/arm/mach-vt8500/include/mach/io.h
deleted file mode 100644
index 46181eecf273..000000000000
--- a/arch/arm/mach-vt8500/include/mach/io.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/io.h
3 *
4 * Copyright (C) 2010 Alexey Charkov
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H
22
23#define __io(a) __typesafe_io((a) + 0xf0000000)
24#define __mem_pci(a) (a)
25
26#endif
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 9a0661992909..9e4dd8b63c4a 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -28,6 +28,7 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31#include <asm/system_misc.h>
31 32
32#include <mach/hardware.h> 33#include <mach/hardware.h>
33#include <mach/regs-serial.h> 34#include <mach/regs-serial.h>
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index db82568a998a..48f5b9fdfb7f 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -27,6 +27,7 @@
27#include <linux/spi/spi.h> 27#include <linux/spi/spi.h>
28#include <linux/spi/flash.h> 28#include <linux/spi/flash.h>
29 29
30#include <asm/system_misc.h>
30#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
31#include <asm/mach/map.h> 32#include <asm/mach/map.h>
32#include <asm/mach/irq.h> 33#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-w90x900/include/mach/io.h b/arch/arm/mach-w90x900/include/mach/io.h
deleted file mode 100644
index d96ab99df05b..000000000000
--- a/arch/arm/mach-w90x900/include/mach/io.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/io.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/io.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARM_ARCH_IO_H
19#define __ASM_ARM_ARCH_IO_H
20
21#define IO_SPACE_LIMIT 0xffffffff
22
23/*
24 * 1:1 mapping for ioremapped regions.
25 */
26
27#define __mem_pci(a) (a)
28#define __io(a) __typesafe_io(a)
29
30#endif
diff --git a/arch/arm/mach-zynq/include/mach/io.h b/arch/arm/mach-zynq/include/mach/io.h
deleted file mode 100644
index 39d9885e0e9a..000000000000
--- a/arch/arm/mach-zynq/include/mach/io.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* arch/arm/mach-zynq/include/mach/io.h
2 *
3 * Copyright (C) 2011 Xilinx
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#ifndef __MACH_IO_H__
16#define __MACH_IO_H__
17
18/* Allow IO space to be anywhere in the memory */
19
20#define IO_SPACE_LIMIT 0xffff
21
22/* IO address mapping macros, nothing special at this time but required */
23
24#ifdef __ASSEMBLER__
25#define IOMEM(x) (x)
26#else
27#define IOMEM(x) ((void __force __iomem *)(x))
28#endif
29
30#define __io(a) __typesafe_io(a)
31#define __mem_pci(a) (a)
32
33#endif
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index caf14dc059e5..9107231aacc5 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -22,7 +22,8 @@
22#include <linux/sched.h> 22#include <linux/sched.h>
23#include <linux/uaccess.h> 23#include <linux/uaccess.h>
24 24
25#include <asm/system.h> 25#include <asm/cp15.h>
26#include <asm/system_info.h>
26#include <asm/unaligned.h> 27#include <asm/unaligned.h>
27 28
28#include "fault.h" 29#include "fault.h"
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
index e0b0e7a4ec68..dd3d59122cc3 100644
--- a/arch/arm/mm/cache-feroceon-l2.c
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/highmem.h> 16#include <linux/highmem.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18#include <asm/cp15.h>
18#include <plat/cache-feroceon-l2.h> 19#include <plat/cache-feroceon-l2.h>
19 20
20/* 21/*
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index b1e192ba8c24..a53fd2aaa2f4 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -30,13 +30,13 @@
30 30
31static void __iomem *l2x0_base; 31static void __iomem *l2x0_base;
32static DEFINE_RAW_SPINLOCK(l2x0_lock); 32static DEFINE_RAW_SPINLOCK(l2x0_lock);
33static uint32_t l2x0_way_mask; /* Bitmask of active ways */ 33static u32 l2x0_way_mask; /* Bitmask of active ways */
34static uint32_t l2x0_size; 34static u32 l2x0_size;
35 35
36struct l2x0_regs l2x0_saved_regs; 36struct l2x0_regs l2x0_saved_regs;
37 37
38struct l2x0_of_data { 38struct l2x0_of_data {
39 void (*setup)(const struct device_node *, __u32 *, __u32 *); 39 void (*setup)(const struct device_node *, u32 *, u32 *);
40 void (*save)(void); 40 void (*save)(void);
41 void (*resume)(void); 41 void (*resume)(void);
42}; 42};
@@ -288,7 +288,7 @@ static void l2x0_disable(void)
288 raw_spin_unlock_irqrestore(&l2x0_lock, flags); 288 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
289} 289}
290 290
291static void l2x0_unlock(__u32 cache_id) 291static void l2x0_unlock(u32 cache_id)
292{ 292{
293 int lockregs; 293 int lockregs;
294 int i; 294 int i;
@@ -307,11 +307,11 @@ static void l2x0_unlock(__u32 cache_id)
307 } 307 }
308} 308}
309 309
310void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) 310void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)
311{ 311{
312 __u32 aux; 312 u32 aux;
313 __u32 cache_id; 313 u32 cache_id;
314 __u32 way_size = 0; 314 u32 way_size = 0;
315 int ways; 315 int ways;
316 const char *type; 316 const char *type;
317 317
@@ -388,7 +388,7 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
388 388
389#ifdef CONFIG_OF 389#ifdef CONFIG_OF
390static void __init l2x0_of_setup(const struct device_node *np, 390static void __init l2x0_of_setup(const struct device_node *np,
391 __u32 *aux_val, __u32 *aux_mask) 391 u32 *aux_val, u32 *aux_mask)
392{ 392{
393 u32 data[2] = { 0, 0 }; 393 u32 data[2] = { 0, 0 };
394 u32 tag = 0; 394 u32 tag = 0;
@@ -422,7 +422,7 @@ static void __init l2x0_of_setup(const struct device_node *np,
422} 422}
423 423
424static void __init pl310_of_setup(const struct device_node *np, 424static void __init pl310_of_setup(const struct device_node *np,
425 __u32 *aux_val, __u32 *aux_mask) 425 u32 *aux_val, u32 *aux_mask)
426{ 426{
427 u32 data[3] = { 0, 0, 0 }; 427 u32 data[3] = { 0, 0, 0 };
428 u32 tag[3] = { 0, 0, 0 }; 428 u32 tag[3] = { 0, 0, 0 };
@@ -548,7 +548,7 @@ static const struct of_device_id l2x0_ids[] __initconst = {
548 {} 548 {}
549}; 549};
550 550
551int __init l2x0_of_init(__u32 aux_val, __u32 aux_mask) 551int __init l2x0_of_init(u32 aux_val, u32 aux_mask)
552{ 552{
553 struct device_node *np; 553 struct device_node *np;
554 struct l2x0_of_data *data; 554 struct l2x0_of_data *data;
diff --git a/arch/arm/mm/cache-tauros2.c b/arch/arm/mm/cache-tauros2.c
index 50868651890f..1fbca05fe906 100644
--- a/arch/arm/mm/cache-tauros2.c
+++ b/arch/arm/mm/cache-tauros2.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <asm/cacheflush.h> 18#include <asm/cacheflush.h>
19#include <asm/cp15.h>
19#include <asm/hardware/cache-tauros2.h> 20#include <asm/hardware/cache-tauros2.h>
20 21
21 22
diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
index 5a32020471e3..6c3edeb66e74 100644
--- a/arch/arm/mm/cache-xsc3l2.c
+++ b/arch/arm/mm/cache-xsc3l2.c
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/highmem.h> 20#include <linux/highmem.h>
21#include <asm/system.h> 21#include <asm/cp15.h>
22#include <asm/cputype.h> 22#include <asm/cputype.h>
23#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
24 24
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c
index ec8c3befb9c8..1267e64133b9 100644
--- a/arch/arm/mm/copypage-v4mc.c
+++ b/arch/arm/mm/copypage-v4mc.c
@@ -23,10 +23,6 @@
23 23
24#include "mm.h" 24#include "mm.h"
25 25
26/*
27 * 0xffff8000 to 0xffffffff is reserved for any ARM architecture
28 * specific hacks for copying pages efficiently.
29 */
30#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ 26#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
31 L_PTE_MT_MINICACHE) 27 L_PTE_MT_MINICACHE)
32 28
@@ -78,10 +74,9 @@ void v4_mc_copy_user_highpage(struct page *to, struct page *from,
78 74
79 raw_spin_lock(&minicache_lock); 75 raw_spin_lock(&minicache_lock);
80 76
81 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); 77 set_top_pte(COPYPAGE_MINICACHE, mk_pte(from, minicache_pgprot));
82 flush_tlb_kernel_page(0xffff8000);
83 78
84 mc_copy_user_page((void *)0xffff8000, kto); 79 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
85 80
86 raw_spin_unlock(&minicache_lock); 81 raw_spin_unlock(&minicache_lock);
87 82
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c
index 8b03a5814d00..b9bcc9d79176 100644
--- a/arch/arm/mm/copypage-v6.c
+++ b/arch/arm/mm/copypage-v6.c
@@ -24,9 +24,6 @@
24#error FIX ME 24#error FIX ME
25#endif 25#endif
26 26
27#define from_address (0xffff8000)
28#define to_address (0xffffc000)
29
30static DEFINE_RAW_SPINLOCK(v6_lock); 27static DEFINE_RAW_SPINLOCK(v6_lock);
31 28
32/* 29/*
@@ -90,14 +87,11 @@ static void v6_copy_user_highpage_aliasing(struct page *to,
90 */ 87 */
91 raw_spin_lock(&v6_lock); 88 raw_spin_lock(&v6_lock);
92 89
93 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); 90 kfrom = COPYPAGE_V6_FROM + (offset << PAGE_SHIFT);
94 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); 91 kto = COPYPAGE_V6_TO + (offset << PAGE_SHIFT);
95
96 kfrom = from_address + (offset << PAGE_SHIFT);
97 kto = to_address + (offset << PAGE_SHIFT);
98 92
99 flush_tlb_kernel_page(kfrom); 93 set_top_pte(kfrom, mk_pte(from, PAGE_KERNEL));
100 flush_tlb_kernel_page(kto); 94 set_top_pte(kto, mk_pte(to, PAGE_KERNEL));
101 95
102 copy_page((void *)kto, (void *)kfrom); 96 copy_page((void *)kto, (void *)kfrom);
103 97
@@ -111,8 +105,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to,
111 */ 105 */
112static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr) 106static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vaddr)
113{ 107{
114 unsigned int offset = CACHE_COLOUR(vaddr); 108 unsigned long to = COPYPAGE_V6_TO + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
115 unsigned long to = to_address + (offset << PAGE_SHIFT);
116 109
117 /* FIXME: not highmem safe */ 110 /* FIXME: not highmem safe */
118 discard_old_kernel_data(page_address(page)); 111 discard_old_kernel_data(page_address(page));
@@ -123,8 +116,7 @@ static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vad
123 */ 116 */
124 raw_spin_lock(&v6_lock); 117 raw_spin_lock(&v6_lock);
125 118
126 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); 119 set_top_pte(to, mk_pte(page, PAGE_KERNEL));
127 flush_tlb_kernel_page(to);
128 clear_page((void *)to); 120 clear_page((void *)to);
129 121
130 raw_spin_unlock(&v6_lock); 122 raw_spin_unlock(&v6_lock);
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c
index 439d106ae638..0fb85025344d 100644
--- a/arch/arm/mm/copypage-xscale.c
+++ b/arch/arm/mm/copypage-xscale.c
@@ -23,12 +23,6 @@
23 23
24#include "mm.h" 24#include "mm.h"
25 25
26/*
27 * 0xffff8000 to 0xffffffff is reserved for any ARM architecture
28 * specific hacks for copying pages efficiently.
29 */
30#define COPYPAGE_MINICACHE 0xffff8000
31
32#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ 26#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
33 L_PTE_MT_MINICACHE) 27 L_PTE_MT_MINICACHE)
34 28
@@ -100,8 +94,7 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from,
100 94
101 raw_spin_lock(&minicache_lock); 95 raw_spin_lock(&minicache_lock);
102 96
103 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); 97 set_top_pte(COPYPAGE_MINICACHE, mk_pte(from, minicache_pgprot));
104 flush_tlb_kernel_page(COPYPAGE_MINICACHE);
105 98
106 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); 99 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
107 100
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 1aa664a1999f..db23ae4aaaab 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -214,7 +214,8 @@ static int __init consistent_init(void)
214core_initcall(consistent_init); 214core_initcall(consistent_init);
215 215
216static void * 216static void *
217__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) 217__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot,
218 const void *caller)
218{ 219{
219 struct arm_vmregion *c; 220 struct arm_vmregion *c;
220 size_t align; 221 size_t align;
@@ -241,7 +242,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
241 * Allocate a virtual address in the consistent mapping region. 242 * Allocate a virtual address in the consistent mapping region.
242 */ 243 */
243 c = arm_vmregion_alloc(&consistent_head, align, size, 244 c = arm_vmregion_alloc(&consistent_head, align, size,
244 gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); 245 gfp & ~(__GFP_DMA | __GFP_HIGHMEM), caller);
245 if (c) { 246 if (c) {
246 pte_t *pte; 247 pte_t *pte;
247 int idx = CONSISTENT_PTE_INDEX(c->vm_start); 248 int idx = CONSISTENT_PTE_INDEX(c->vm_start);
@@ -320,14 +321,14 @@ static void __dma_free_remap(void *cpu_addr, size_t size)
320 321
321#else /* !CONFIG_MMU */ 322#else /* !CONFIG_MMU */
322 323
323#define __dma_alloc_remap(page, size, gfp, prot) page_address(page) 324#define __dma_alloc_remap(page, size, gfp, prot, c) page_address(page)
324#define __dma_free_remap(addr, size) do { } while (0) 325#define __dma_free_remap(addr, size) do { } while (0)
325 326
326#endif /* CONFIG_MMU */ 327#endif /* CONFIG_MMU */
327 328
328static void * 329static void *
329__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, 330__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
330 pgprot_t prot) 331 pgprot_t prot, const void *caller)
331{ 332{
332 struct page *page; 333 struct page *page;
333 void *addr; 334 void *addr;
@@ -349,7 +350,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
349 return NULL; 350 return NULL;
350 351
351 if (!arch_is_coherent()) 352 if (!arch_is_coherent())
352 addr = __dma_alloc_remap(page, size, gfp, prot); 353 addr = __dma_alloc_remap(page, size, gfp, prot, caller);
353 else 354 else
354 addr = page_address(page); 355 addr = page_address(page);
355 356
@@ -374,7 +375,8 @@ dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gf
374 return memory; 375 return memory;
375 376
376 return __dma_alloc(dev, size, handle, gfp, 377 return __dma_alloc(dev, size, handle, gfp,
377 pgprot_dmacoherent(pgprot_kernel)); 378 pgprot_dmacoherent(pgprot_kernel),
379 __builtin_return_address(0));
378} 380}
379EXPORT_SYMBOL(dma_alloc_coherent); 381EXPORT_SYMBOL(dma_alloc_coherent);
380 382
@@ -386,7 +388,8 @@ void *
386dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp) 388dma_alloc_writecombine(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp)
387{ 389{
388 return __dma_alloc(dev, size, handle, gfp, 390 return __dma_alloc(dev, size, handle, gfp,
389 pgprot_writecombine(pgprot_kernel)); 391 pgprot_writecombine(pgprot_kernel),
392 __builtin_return_address(0));
390} 393}
391EXPORT_SYMBOL(dma_alloc_writecombine); 394EXPORT_SYMBOL(dma_alloc_writecombine);
392 395
@@ -723,6 +726,9 @@ EXPORT_SYMBOL(dma_set_mask);
723 726
724static int __init dma_debug_do_init(void) 727static int __init dma_debug_do_init(void)
725{ 728{
729#ifdef CONFIG_MMU
730 arm_vmregion_create_proc("dma-mappings", &consistent_head);
731#endif
726 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); 732 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
727 return 0; 733 return 0;
728} 734}
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index bb7eac381a8e..9055b5a84ec5 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -21,8 +21,9 @@
21#include <linux/perf_event.h> 21#include <linux/perf_event.h>
22 22
23#include <asm/exception.h> 23#include <asm/exception.h>
24#include <asm/system.h>
25#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/system_misc.h>
26#include <asm/system_info.h>
26#include <asm/tlbflush.h> 27#include <asm/tlbflush.h>
27 28
28#include "fault.h" 29#include "fault.h"
@@ -164,7 +165,8 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
164 struct siginfo si; 165 struct siginfo si;
165 166
166#ifdef CONFIG_DEBUG_USER 167#ifdef CONFIG_DEBUG_USER
167 if (user_debug & UDBG_SEGV) { 168 if (((user_debug & UDBG_SEGV) && (sig == SIGSEGV)) ||
169 ((user_debug & UDBG_BUS) && (sig == SIGBUS))) {
168 printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n", 170 printk(KERN_DEBUG "%s: unhandled page fault (%d) at 0x%08lx, code 0x%03x\n",
169 tsk->comm, sig, addr, fsr); 171 tsk->comm, sig, addr, fsr);
170 show_pte(tsk->mm, addr); 172 show_pte(tsk->mm, addr);
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 1a8d4aa821be..77458548e031 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -16,22 +16,18 @@
16#include <asm/cachetype.h> 16#include <asm/cachetype.h>
17#include <asm/highmem.h> 17#include <asm/highmem.h>
18#include <asm/smp_plat.h> 18#include <asm/smp_plat.h>
19#include <asm/system.h>
20#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
21 20
22#include "mm.h" 21#include "mm.h"
23 22
24#ifdef CONFIG_CPU_CACHE_VIPT 23#ifdef CONFIG_CPU_CACHE_VIPT
25 24
26#define ALIAS_FLUSH_START 0xffff4000
27
28static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr) 25static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
29{ 26{
30 unsigned long to = ALIAS_FLUSH_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT); 27 unsigned long to = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
31 const int zero = 0; 28 const int zero = 0;
32 29
33 set_pte_ext(TOP_PTE(to), pfn_pte(pfn, PAGE_KERNEL), 0); 30 set_top_pte(to, pfn_pte(pfn, PAGE_KERNEL));
34 flush_tlb_kernel_page(to);
35 31
36 asm( "mcrr p15, 0, %1, %0, c14\n" 32 asm( "mcrr p15, 0, %1, %0, c14\n"
37 " mcr p15, 0, %2, c7, c10, 4" 33 " mcr p15, 0, %2, c7, c10, 4"
@@ -42,13 +38,12 @@ static void flush_pfn_alias(unsigned long pfn, unsigned long vaddr)
42 38
43static void flush_icache_alias(unsigned long pfn, unsigned long vaddr, unsigned long len) 39static void flush_icache_alias(unsigned long pfn, unsigned long vaddr, unsigned long len)
44{ 40{
45 unsigned long colour = CACHE_COLOUR(vaddr); 41 unsigned long va = FLUSH_ALIAS_START + (CACHE_COLOUR(vaddr) << PAGE_SHIFT);
46 unsigned long offset = vaddr & (PAGE_SIZE - 1); 42 unsigned long offset = vaddr & (PAGE_SIZE - 1);
47 unsigned long to; 43 unsigned long to;
48 44
49 set_pte_ext(TOP_PTE(ALIAS_FLUSH_START) + colour, pfn_pte(pfn, PAGE_KERNEL), 0); 45 set_top_pte(va, pfn_pte(pfn, PAGE_KERNEL));
50 to = ALIAS_FLUSH_START + (colour << PAGE_SHIFT) + offset; 46 to = va + offset;
51 flush_tlb_kernel_page(to);
52 flush_icache_range(to, to + len); 47 flush_icache_range(to, to + len);
53} 48}
54 49
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index 5a21505d7550..21b9e1bf9b77 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -69,15 +69,14 @@ void *kmap_atomic(struct page *page)
69 * With debugging enabled, kunmap_atomic forces that entry to 0. 69 * With debugging enabled, kunmap_atomic forces that entry to 0.
70 * Make sure it was indeed properly unmapped. 70 * Make sure it was indeed properly unmapped.
71 */ 71 */
72 BUG_ON(!pte_none(*(TOP_PTE(vaddr)))); 72 BUG_ON(!pte_none(get_top_pte(vaddr)));
73#endif 73#endif
74 set_pte_ext(TOP_PTE(vaddr), mk_pte(page, kmap_prot), 0);
75 /* 74 /*
76 * When debugging is off, kunmap_atomic leaves the previous mapping 75 * When debugging is off, kunmap_atomic leaves the previous mapping
77 * in place, so this TLB flush ensures the TLB is updated with the 76 * in place, so the contained TLB flush ensures the TLB is updated
78 * new mapping. 77 * with the new mapping.
79 */ 78 */
80 local_flush_tlb_kernel_page(vaddr); 79 set_top_pte(vaddr, mk_pte(page, kmap_prot));
81 80
82 return (void *)vaddr; 81 return (void *)vaddr;
83} 82}
@@ -96,8 +95,7 @@ void __kunmap_atomic(void *kvaddr)
96 __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE); 95 __cpuc_flush_dcache_area((void *)vaddr, PAGE_SIZE);
97#ifdef CONFIG_DEBUG_HIGHMEM 96#ifdef CONFIG_DEBUG_HIGHMEM
98 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)); 97 BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
99 set_pte_ext(TOP_PTE(vaddr), __pte(0), 0); 98 set_top_pte(vaddr, __pte(0));
100 local_flush_tlb_kernel_page(vaddr);
101#else 99#else
102 (void) idx; /* to kill a warning */ 100 (void) idx; /* to kill a warning */
103#endif 101#endif
@@ -121,10 +119,9 @@ void *kmap_atomic_pfn(unsigned long pfn)
121 idx = type + KM_TYPE_NR * smp_processor_id(); 119 idx = type + KM_TYPE_NR * smp_processor_id();
122 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 120 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
123#ifdef CONFIG_DEBUG_HIGHMEM 121#ifdef CONFIG_DEBUG_HIGHMEM
124 BUG_ON(!pte_none(*(TOP_PTE(vaddr)))); 122 BUG_ON(!pte_none(get_top_pte(vaddr)));
125#endif 123#endif
126 set_pte_ext(TOP_PTE(vaddr), pfn_pte(pfn, kmap_prot), 0); 124 set_top_pte(vaddr, pfn_pte(pfn, kmap_prot));
127 local_flush_tlb_kernel_page(vaddr);
128 125
129 return (void *)vaddr; 126 return (void *)vaddr;
130} 127}
@@ -132,11 +129,9 @@ void *kmap_atomic_pfn(unsigned long pfn)
132struct page *kmap_atomic_to_page(const void *ptr) 129struct page *kmap_atomic_to_page(const void *ptr)
133{ 130{
134 unsigned long vaddr = (unsigned long)ptr; 131 unsigned long vaddr = (unsigned long)ptr;
135 pte_t *pte;
136 132
137 if (vaddr < FIXADDR_START) 133 if (vaddr < FIXADDR_START)
138 return virt_to_page(ptr); 134 return virt_to_page(ptr);
139 135
140 pte = TOP_PTE(vaddr); 136 return pte_page(get_top_pte(vaddr));
141 return pte_page(*pte);
142} 137}
diff --git a/arch/arm/mm/idmap.c b/arch/arm/mm/idmap.c
index feacf4c76712..ab88ed4f8e08 100644
--- a/arch/arm/mm/idmap.c
+++ b/arch/arm/mm/idmap.c
@@ -5,6 +5,7 @@
5#include <asm/pgalloc.h> 5#include <asm/pgalloc.h>
6#include <asm/pgtable.h> 6#include <asm/pgtable.h>
7#include <asm/sections.h> 7#include <asm/sections.h>
8#include <asm/system_info.h>
8 9
9pgd_t *idmap_pgd; 10pgd_t *idmap_pgd;
10 11
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 245a55a0a5bb..595079fa9d1d 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -658,7 +658,9 @@ void __init mem_init(void)
658#ifdef CONFIG_HIGHMEM 658#ifdef CONFIG_HIGHMEM
659 " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" 659 " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n"
660#endif 660#endif
661#ifdef CONFIG_MODULES
661 " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" 662 " modules : 0x%08lx - 0x%08lx (%4ld MB)\n"
663#endif
662 " .text : 0x%p" " - 0x%p" " (%4d kB)\n" 664 " .text : 0x%p" " - 0x%p" " (%4d kB)\n"
663 " .init : 0x%p" " - 0x%p" " (%4d kB)\n" 665 " .init : 0x%p" " - 0x%p" " (%4d kB)\n"
664 " .data : 0x%p" " - 0x%p" " (%4d kB)\n" 666 " .data : 0x%p" " - 0x%p" " (%4d kB)\n"
@@ -677,7 +679,9 @@ void __init mem_init(void)
677 MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) * 679 MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) *
678 (PAGE_SIZE)), 680 (PAGE_SIZE)),
679#endif 681#endif
682#ifdef CONFIG_MODULES
680 MLM(MODULES_VADDR, MODULES_END), 683 MLM(MODULES_VADDR, MODULES_END),
684#endif
681 685
682 MLK_ROUNDUP(_text, _etext), 686 MLK_ROUNDUP(_text, _etext),
683 MLK_ROUNDUP(__init_begin, __init_end), 687 MLK_ROUNDUP(__init_begin, __init_end),
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 80632e8d7538..4f55f5062ab7 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -26,12 +26,14 @@
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/io.h> 27#include <linux/io.h>
28 28
29#include <asm/cp15.h>
29#include <asm/cputype.h> 30#include <asm/cputype.h>
30#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
31#include <asm/mmu_context.h> 32#include <asm/mmu_context.h>
32#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
33#include <asm/tlbflush.h> 34#include <asm/tlbflush.h>
34#include <asm/sizes.h> 35#include <asm/sizes.h>
36#include <asm/system_info.h>
35 37
36#include <asm/mach/map.h> 38#include <asm/mach/map.h>
37#include "mm.h" 39#include "mm.h"
@@ -306,11 +308,15 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
306} 308}
307EXPORT_SYMBOL(__arm_ioremap_pfn); 309EXPORT_SYMBOL(__arm_ioremap_pfn);
308 310
311void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
312 unsigned int, void *) =
313 __arm_ioremap_caller;
314
309void __iomem * 315void __iomem *
310__arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype) 316__arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
311{ 317{
312 return __arm_ioremap_caller(phys_addr, size, mtype, 318 return arch_ioremap_caller(phys_addr, size, mtype,
313 __builtin_return_address(0)); 319 __builtin_return_address(0));
314} 320}
315EXPORT_SYMBOL(__arm_ioremap); 321EXPORT_SYMBOL(__arm_ioremap);
316 322
@@ -369,4 +375,11 @@ void __iounmap(volatile void __iomem *io_addr)
369 375
370 vunmap(addr); 376 vunmap(addr);
371} 377}
372EXPORT_SYMBOL(__iounmap); 378
379void (*arch_iounmap)(volatile void __iomem *) = __iounmap;
380
381void __arm_iounmap(volatile void __iomem *io_addr)
382{
383 arch_iounmap(io_addr);
384}
385EXPORT_SYMBOL(__arm_iounmap);
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 70f6d3ea4834..27f4a619b35d 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -3,7 +3,31 @@
3/* the upper-most page table pointer */ 3/* the upper-most page table pointer */
4extern pmd_t *top_pmd; 4extern pmd_t *top_pmd;
5 5
6#define TOP_PTE(x) pte_offset_kernel(top_pmd, x) 6/*
7 * 0xffff8000 to 0xffffffff is reserved for any ARM architecture
8 * specific hacks for copying pages efficiently, while 0xffff4000
9 * is reserved for VIPT aliasing flushing by generic code.
10 *
11 * Note that we don't allow VIPT aliasing caches with SMP.
12 */
13#define COPYPAGE_MINICACHE 0xffff8000
14#define COPYPAGE_V6_FROM 0xffff8000
15#define COPYPAGE_V6_TO 0xffffc000
16/* PFN alias flushing, for VIPT caches */
17#define FLUSH_ALIAS_START 0xffff4000
18
19static inline void set_top_pte(unsigned long va, pte_t pte)
20{
21 pte_t *ptep = pte_offset_kernel(top_pmd, va);
22 set_pte_ext(ptep, pte, 0);
23 local_flush_tlb_kernel_page(va);
24}
25
26static inline pte_t get_top_pte(unsigned long va)
27{
28 pte_t *ptep = pte_offset_kernel(top_pmd, va);
29 return *ptep;
30}
7 31
8static inline pmd_t *pmd_off_k(unsigned long virt) 32static inline pmd_t *pmd_off_k(unsigned long virt)
9{ 33{
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 94c5a0c94f5e..b86f8933ff91 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -17,6 +17,7 @@
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/vmalloc.h> 18#include <linux/vmalloc.h>
19 19
20#include <asm/cp15.h>
20#include <asm/cputype.h> 21#include <asm/cputype.h>
21#include <asm/sections.h> 22#include <asm/sections.h>
22#include <asm/cachetype.h> 23#include <asm/cachetype.h>
@@ -25,6 +26,7 @@
25#include <asm/smp_plat.h> 26#include <asm/smp_plat.h>
26#include <asm/tlb.h> 27#include <asm/tlb.h>
27#include <asm/highmem.h> 28#include <asm/highmem.h>
29#include <asm/system_info.h>
28#include <asm/traps.h> 30#include <asm/traps.h>
29 31
30#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
@@ -997,11 +999,14 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
997{ 999{
998 struct map_desc map; 1000 struct map_desc map;
999 unsigned long addr; 1001 unsigned long addr;
1002 void *vectors;
1000 1003
1001 /* 1004 /*
1002 * Allocate the vector page early. 1005 * Allocate the vector page early.
1003 */ 1006 */
1004 vectors_page = early_alloc(PAGE_SIZE); 1007 vectors = early_alloc(PAGE_SIZE);
1008
1009 early_trap_init(vectors);
1005 1010
1006 for (addr = VMALLOC_START; addr; addr += PMD_SIZE) 1011 for (addr = VMALLOC_START; addr; addr += PMD_SIZE)
1007 pmd_clear(pmd_off_k(addr)); 1012 pmd_clear(pmd_off_k(addr));
@@ -1041,7 +1046,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
1041 * location (0xffff0000). If we aren't using high-vectors, also 1046 * location (0xffff0000). If we aren't using high-vectors, also
1042 * create a mapping at the low-vectors virtual address. 1047 * create a mapping at the low-vectors virtual address.
1043 */ 1048 */
1044 map.pfn = __phys_to_pfn(virt_to_phys(vectors_page)); 1049 map.pfn = __phys_to_pfn(virt_to_phys(vectors));
1045 map.virtual = 0xffff0000; 1050 map.virtual = 0xffff0000;
1046 map.length = PAGE_SIZE; 1051 map.length = PAGE_SIZE;
1047 map.type = MT_HIGH_VECTORS; 1052 map.type = MT_HIGH_VECTORS;
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 4fc6794cca4b..6486d2f253cd 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -86,13 +86,17 @@ void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
86} 86}
87EXPORT_SYMBOL(__arm_ioremap); 87EXPORT_SYMBOL(__arm_ioremap);
88 88
89void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *);
90
89void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size, 91void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
90 unsigned int mtype, void *caller) 92 unsigned int mtype, void *caller)
91{ 93{
92 return __arm_ioremap(phys_addr, size, mtype); 94 return __arm_ioremap(phys_addr, size, mtype);
93} 95}
94 96
95void __iounmap(volatile void __iomem *addr) 97void (*arch_iounmap)(volatile void __iomem *);
98
99void __arm_iounmap(volatile void __iomem *addr)
96{ 100{
97} 101}
98EXPORT_SYMBOL(__iounmap); 102EXPORT_SYMBOL(__arm_iounmap);
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index a3e78ccabd65..0acb089d0f70 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -12,6 +12,7 @@
12#include <linux/highmem.h> 12#include <linux/highmem.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14 14
15#include <asm/cp15.h>
15#include <asm/pgalloc.h> 16#include <asm/pgalloc.h>
16#include <asm/page.h> 17#include <asm/page.h>
17#include <asm/tlbflush.h> 18#include <asm/tlbflush.h>
diff --git a/arch/arm/mm/proc-fa526.S b/arch/arm/mm/proc-fa526.S
index 272558a133a3..d217e9795d74 100644
--- a/arch/arm/mm/proc-fa526.S
+++ b/arch/arm/mm/proc-fa526.S
@@ -22,7 +22,6 @@
22#include <asm/pgtable.h> 22#include <asm/pgtable.h>
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/ptrace.h> 24#include <asm/ptrace.h>
25#include <asm/system.h>
26 25
27#include "proc-macros.S" 26#include "proc-macros.S"
28 27
diff --git a/arch/arm/mm/vmregion.c b/arch/arm/mm/vmregion.c
index 036fdbfdd62f..a631016e1f8f 100644
--- a/arch/arm/mm/vmregion.c
+++ b/arch/arm/mm/vmregion.c
@@ -1,5 +1,8 @@
1#include <linux/fs.h>
1#include <linux/spinlock.h> 2#include <linux/spinlock.h>
2#include <linux/list.h> 3#include <linux/list.h>
4#include <linux/proc_fs.h>
5#include <linux/seq_file.h>
3#include <linux/slab.h> 6#include <linux/slab.h>
4 7
5#include "vmregion.h" 8#include "vmregion.h"
@@ -36,7 +39,7 @@
36 39
37struct arm_vmregion * 40struct arm_vmregion *
38arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align, 41arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align,
39 size_t size, gfp_t gfp) 42 size_t size, gfp_t gfp, const void *caller)
40{ 43{
41 unsigned long start = head->vm_start, addr = head->vm_end; 44 unsigned long start = head->vm_start, addr = head->vm_end;
42 unsigned long flags; 45 unsigned long flags;
@@ -52,6 +55,8 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align,
52 if (!new) 55 if (!new)
53 goto out; 56 goto out;
54 57
58 new->caller = caller;
59
55 spin_lock_irqsave(&head->vm_lock, flags); 60 spin_lock_irqsave(&head->vm_lock, flags);
56 61
57 addr = rounddown(addr - size, align); 62 addr = rounddown(addr - size, align);
@@ -129,3 +134,72 @@ void arm_vmregion_free(struct arm_vmregion_head *head, struct arm_vmregion *c)
129 134
130 kfree(c); 135 kfree(c);
131} 136}
137
138#ifdef CONFIG_PROC_FS
139static int arm_vmregion_show(struct seq_file *m, void *p)
140{
141 struct arm_vmregion *c = list_entry(p, struct arm_vmregion, vm_list);
142
143 seq_printf(m, "0x%08lx-0x%08lx %7lu", c->vm_start, c->vm_end,
144 c->vm_end - c->vm_start);
145 if (c->caller)
146 seq_printf(m, " %pS", (void *)c->caller);
147 seq_putc(m, '\n');
148 return 0;
149}
150
151static void *arm_vmregion_start(struct seq_file *m, loff_t *pos)
152{
153 struct arm_vmregion_head *h = m->private;
154 spin_lock_irq(&h->vm_lock);
155 return seq_list_start(&h->vm_list, *pos);
156}
157
158static void *arm_vmregion_next(struct seq_file *m, void *p, loff_t *pos)
159{
160 struct arm_vmregion_head *h = m->private;
161 return seq_list_next(p, &h->vm_list, pos);
162}
163
164static void arm_vmregion_stop(struct seq_file *m, void *p)
165{
166 struct arm_vmregion_head *h = m->private;
167 spin_unlock_irq(&h->vm_lock);
168}
169
170static const struct seq_operations arm_vmregion_ops = {
171 .start = arm_vmregion_start,
172 .stop = arm_vmregion_stop,
173 .next = arm_vmregion_next,
174 .show = arm_vmregion_show,
175};
176
177static int arm_vmregion_open(struct inode *inode, struct file *file)
178{
179 struct arm_vmregion_head *h = PDE(inode)->data;
180 int ret = seq_open(file, &arm_vmregion_ops);
181 if (!ret) {
182 struct seq_file *m = file->private_data;
183 m->private = h;
184 }
185 return ret;
186}
187
188static const struct file_operations arm_vmregion_fops = {
189 .open = arm_vmregion_open,
190 .read = seq_read,
191 .llseek = seq_lseek,
192 .release = seq_release,
193};
194
195int arm_vmregion_create_proc(const char *path, struct arm_vmregion_head *h)
196{
197 proc_create_data(path, S_IRUSR, NULL, &arm_vmregion_fops, h);
198 return 0;
199}
200#else
201int arm_vmregion_create_proc(const char *path, struct arm_vmregion_head *h)
202{
203 return 0;
204}
205#endif
diff --git a/arch/arm/mm/vmregion.h b/arch/arm/mm/vmregion.h
index 15e9f044db9f..162be662c088 100644
--- a/arch/arm/mm/vmregion.h
+++ b/arch/arm/mm/vmregion.h
@@ -19,11 +19,14 @@ struct arm_vmregion {
19 unsigned long vm_end; 19 unsigned long vm_end;
20 struct page *vm_pages; 20 struct page *vm_pages;
21 int vm_active; 21 int vm_active;
22 const void *caller;
22}; 23};
23 24
24struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, size_t, gfp_t); 25struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, size_t, gfp_t, const void *);
25struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long); 26struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long);
26struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long); 27struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long);
27void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *); 28void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *);
28 29
30int arm_vmregion_create_proc(const char *, struct arm_vmregion_head *);
31
29#endif 32#endif
diff --git a/arch/arm/net/Makefile b/arch/arm/net/Makefile
new file mode 100644
index 000000000000..c2c10841b6be
--- /dev/null
+++ b/arch/arm/net/Makefile
@@ -0,0 +1,3 @@
1# ARM-specific networking code
2
3obj-$(CONFIG_BPF_JIT) += bpf_jit_32.o
diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
new file mode 100644
index 000000000000..62135849f48b
--- /dev/null
+++ b/arch/arm/net/bpf_jit_32.c
@@ -0,0 +1,915 @@
1/*
2 * Just-In-Time compiler for BPF filters on 32bit ARM
3 *
4 * Copyright (c) 2011 Mircea Gherzan <mgherzan@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; version 2 of the License.
9 */
10
11#include <linux/bitops.h>
12#include <linux/compiler.h>
13#include <linux/errno.h>
14#include <linux/filter.h>
15#include <linux/moduleloader.h>
16#include <linux/netdevice.h>
17#include <linux/string.h>
18#include <linux/slab.h>
19#include <asm/cacheflush.h>
20#include <asm/hwcap.h>
21
22#include "bpf_jit_32.h"
23
24/*
25 * ABI:
26 *
27 * r0 scratch register
28 * r4 BPF register A
29 * r5 BPF register X
30 * r6 pointer to the skb
31 * r7 skb->data
32 * r8 skb_headlen(skb)
33 */
34
35#define r_scratch ARM_R0
36/* r1-r3 are (also) used for the unaligned loads on the non-ARMv7 slowpath */
37#define r_off ARM_R1
38#define r_A ARM_R4
39#define r_X ARM_R5
40#define r_skb ARM_R6
41#define r_skb_data ARM_R7
42#define r_skb_hl ARM_R8
43
44#define SCRATCH_SP_OFFSET 0
45#define SCRATCH_OFF(k) (SCRATCH_SP_OFFSET + (k))
46
47#define SEEN_MEM ((1 << BPF_MEMWORDS) - 1)
48#define SEEN_MEM_WORD(k) (1 << (k))
49#define SEEN_X (1 << BPF_MEMWORDS)
50#define SEEN_CALL (1 << (BPF_MEMWORDS + 1))
51#define SEEN_SKB (1 << (BPF_MEMWORDS + 2))
52#define SEEN_DATA (1 << (BPF_MEMWORDS + 3))
53
54#define FLAG_NEED_X_RESET (1 << 0)
55
56struct jit_ctx {
57 const struct sk_filter *skf;
58 unsigned idx;
59 unsigned prologue_bytes;
60 int ret0_fp_idx;
61 u32 seen;
62 u32 flags;
63 u32 *offsets;
64 u32 *target;
65#if __LINUX_ARM_ARCH__ < 7
66 u16 epilogue_bytes;
67 u16 imm_count;
68 u32 *imms;
69#endif
70};
71
72int bpf_jit_enable __read_mostly;
73
74static u64 jit_get_skb_b(struct sk_buff *skb, unsigned offset)
75{
76 u8 ret;
77 int err;
78
79 err = skb_copy_bits(skb, offset, &ret, 1);
80
81 return (u64)err << 32 | ret;
82}
83
84static u64 jit_get_skb_h(struct sk_buff *skb, unsigned offset)
85{
86 u16 ret;
87 int err;
88
89 err = skb_copy_bits(skb, offset, &ret, 2);
90
91 return (u64)err << 32 | ntohs(ret);
92}
93
94static u64 jit_get_skb_w(struct sk_buff *skb, unsigned offset)
95{
96 u32 ret;
97 int err;
98
99 err = skb_copy_bits(skb, offset, &ret, 4);
100
101 return (u64)err << 32 | ntohl(ret);
102}
103
104/*
105 * Wrapper that handles both OABI and EABI and assures Thumb2 interworking
106 * (where the assembly routines like __aeabi_uidiv could cause problems).
107 */
108static u32 jit_udiv(u32 dividend, u32 divisor)
109{
110 return dividend / divisor;
111}
112
113static inline void _emit(int cond, u32 inst, struct jit_ctx *ctx)
114{
115 if (ctx->target != NULL)
116 ctx->target[ctx->idx] = inst | (cond << 28);
117
118 ctx->idx++;
119}
120
121/*
122 * Emit an instruction that will be executed unconditionally.
123 */
124static inline void emit(u32 inst, struct jit_ctx *ctx)
125{
126 _emit(ARM_COND_AL, inst, ctx);
127}
128
129static u16 saved_regs(struct jit_ctx *ctx)
130{
131 u16 ret = 0;
132
133 if ((ctx->skf->len > 1) ||
134 (ctx->skf->insns[0].code == BPF_S_RET_A))
135 ret |= 1 << r_A;
136
137#ifdef CONFIG_FRAME_POINTER
138 ret |= (1 << ARM_FP) | (1 << ARM_IP) | (1 << ARM_LR) | (1 << ARM_PC);
139#else
140 if (ctx->seen & SEEN_CALL)
141 ret |= 1 << ARM_LR;
142#endif
143 if (ctx->seen & (SEEN_DATA | SEEN_SKB))
144 ret |= 1 << r_skb;
145 if (ctx->seen & SEEN_DATA)
146 ret |= (1 << r_skb_data) | (1 << r_skb_hl);
147 if (ctx->seen & SEEN_X)
148 ret |= 1 << r_X;
149
150 return ret;
151}
152
153static inline int mem_words_used(struct jit_ctx *ctx)
154{
155 /* yes, we do waste some stack space IF there are "holes" in the set" */
156 return fls(ctx->seen & SEEN_MEM);
157}
158
159static inline bool is_load_to_a(u16 inst)
160{
161 switch (inst) {
162 case BPF_S_LD_W_LEN:
163 case BPF_S_LD_W_ABS:
164 case BPF_S_LD_H_ABS:
165 case BPF_S_LD_B_ABS:
166 case BPF_S_ANC_CPU:
167 case BPF_S_ANC_IFINDEX:
168 case BPF_S_ANC_MARK:
169 case BPF_S_ANC_PROTOCOL:
170 case BPF_S_ANC_RXHASH:
171 case BPF_S_ANC_QUEUE:
172 return true;
173 default:
174 return false;
175 }
176}
177
178static void build_prologue(struct jit_ctx *ctx)
179{
180 u16 reg_set = saved_regs(ctx);
181 u16 first_inst = ctx->skf->insns[0].code;
182 u16 off;
183
184#ifdef CONFIG_FRAME_POINTER
185 emit(ARM_MOV_R(ARM_IP, ARM_SP), ctx);
186 emit(ARM_PUSH(reg_set), ctx);
187 emit(ARM_SUB_I(ARM_FP, ARM_IP, 4), ctx);
188#else
189 if (reg_set)
190 emit(ARM_PUSH(reg_set), ctx);
191#endif
192
193 if (ctx->seen & (SEEN_DATA | SEEN_SKB))
194 emit(ARM_MOV_R(r_skb, ARM_R0), ctx);
195
196 if (ctx->seen & SEEN_DATA) {
197 off = offsetof(struct sk_buff, data);
198 emit(ARM_LDR_I(r_skb_data, r_skb, off), ctx);
199 /* headlen = len - data_len */
200 off = offsetof(struct sk_buff, len);
201 emit(ARM_LDR_I(r_skb_hl, r_skb, off), ctx);
202 off = offsetof(struct sk_buff, data_len);
203 emit(ARM_LDR_I(r_scratch, r_skb, off), ctx);
204 emit(ARM_SUB_R(r_skb_hl, r_skb_hl, r_scratch), ctx);
205 }
206
207 if (ctx->flags & FLAG_NEED_X_RESET)
208 emit(ARM_MOV_I(r_X, 0), ctx);
209
210 /* do not leak kernel data to userspace */
211 if ((first_inst != BPF_S_RET_K) && !(is_load_to_a(first_inst)))
212 emit(ARM_MOV_I(r_A, 0), ctx);
213
214 /* stack space for the BPF_MEM words */
215 if (ctx->seen & SEEN_MEM)
216 emit(ARM_SUB_I(ARM_SP, ARM_SP, mem_words_used(ctx) * 4), ctx);
217}
218
219static void build_epilogue(struct jit_ctx *ctx)
220{
221 u16 reg_set = saved_regs(ctx);
222
223 if (ctx->seen & SEEN_MEM)
224 emit(ARM_ADD_I(ARM_SP, ARM_SP, mem_words_used(ctx) * 4), ctx);
225
226 reg_set &= ~(1 << ARM_LR);
227
228#ifdef CONFIG_FRAME_POINTER
229 /* the first instruction of the prologue was: mov ip, sp */
230 reg_set &= ~(1 << ARM_IP);
231 reg_set |= (1 << ARM_SP);
232 emit(ARM_LDM(ARM_SP, reg_set), ctx);
233#else
234 if (reg_set) {
235 if (ctx->seen & SEEN_CALL)
236 reg_set |= 1 << ARM_PC;
237 emit(ARM_POP(reg_set), ctx);
238 }
239
240 if (!(ctx->seen & SEEN_CALL))
241 emit(ARM_BX(ARM_LR), ctx);
242#endif
243}
244
245static int16_t imm8m(u32 x)
246{
247 u32 rot;
248
249 for (rot = 0; rot < 16; rot++)
250 if ((x & ~ror32(0xff, 2 * rot)) == 0)
251 return rol32(x, 2 * rot) | (rot << 8);
252
253 return -1;
254}
255
256#if __LINUX_ARM_ARCH__ < 7
257
258static u16 imm_offset(u32 k, struct jit_ctx *ctx)
259{
260 unsigned i = 0, offset;
261 u16 imm;
262
263 /* on the "fake" run we just count them (duplicates included) */
264 if (ctx->target == NULL) {
265 ctx->imm_count++;
266 return 0;
267 }
268
269 while ((i < ctx->imm_count) && ctx->imms[i]) {
270 if (ctx->imms[i] == k)
271 break;
272 i++;
273 }
274
275 if (ctx->imms[i] == 0)
276 ctx->imms[i] = k;
277
278 /* constants go just after the epilogue */
279 offset = ctx->offsets[ctx->skf->len];
280 offset += ctx->prologue_bytes;
281 offset += ctx->epilogue_bytes;
282 offset += i * 4;
283
284 ctx->target[offset / 4] = k;
285
286 /* PC in ARM mode == address of the instruction + 8 */
287 imm = offset - (8 + ctx->idx * 4);
288
289 return imm;
290}
291
292#endif /* __LINUX_ARM_ARCH__ */
293
294/*
295 * Move an immediate that's not an imm8m to a core register.
296 */
297static inline void emit_mov_i_no8m(int rd, u32 val, struct jit_ctx *ctx)
298{
299#if __LINUX_ARM_ARCH__ < 7
300 emit(ARM_LDR_I(rd, ARM_PC, imm_offset(val, ctx)), ctx);
301#else
302 emit(ARM_MOVW(rd, val & 0xffff), ctx);
303 if (val > 0xffff)
304 emit(ARM_MOVT(rd, val >> 16), ctx);
305#endif
306}
307
308static inline void emit_mov_i(int rd, u32 val, struct jit_ctx *ctx)
309{
310 int imm12 = imm8m(val);
311
312 if (imm12 >= 0)
313 emit(ARM_MOV_I(rd, imm12), ctx);
314 else
315 emit_mov_i_no8m(rd, val, ctx);
316}
317
318#if __LINUX_ARM_ARCH__ < 6
319
320static void emit_load_be32(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx)
321{
322 _emit(cond, ARM_LDRB_I(ARM_R3, r_addr, 1), ctx);
323 _emit(cond, ARM_LDRB_I(ARM_R1, r_addr, 0), ctx);
324 _emit(cond, ARM_LDRB_I(ARM_R2, r_addr, 3), ctx);
325 _emit(cond, ARM_LSL_I(ARM_R3, ARM_R3, 16), ctx);
326 _emit(cond, ARM_LDRB_I(ARM_R0, r_addr, 2), ctx);
327 _emit(cond, ARM_ORR_S(ARM_R3, ARM_R3, ARM_R1, SRTYPE_LSL, 24), ctx);
328 _emit(cond, ARM_ORR_R(ARM_R3, ARM_R3, ARM_R2), ctx);
329 _emit(cond, ARM_ORR_S(r_res, ARM_R3, ARM_R0, SRTYPE_LSL, 8), ctx);
330}
331
332static void emit_load_be16(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx)
333{
334 _emit(cond, ARM_LDRB_I(ARM_R1, r_addr, 0), ctx);
335 _emit(cond, ARM_LDRB_I(ARM_R2, r_addr, 1), ctx);
336 _emit(cond, ARM_ORR_S(r_res, ARM_R2, ARM_R1, SRTYPE_LSL, 8), ctx);
337}
338
339static inline void emit_swap16(u8 r_dst, u8 r_src, struct jit_ctx *ctx)
340{
341 emit(ARM_LSL_R(ARM_R1, r_src, 8), ctx);
342 emit(ARM_ORR_S(r_dst, ARM_R1, r_src, SRTYPE_LSL, 8), ctx);
343 emit(ARM_LSL_I(r_dst, r_dst, 8), ctx);
344 emit(ARM_LSL_R(r_dst, r_dst, 8), ctx);
345}
346
347#else /* ARMv6+ */
348
349static void emit_load_be32(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx)
350{
351 _emit(cond, ARM_LDR_I(r_res, r_addr, 0), ctx);
352#ifdef __LITTLE_ENDIAN
353 _emit(cond, ARM_REV(r_res, r_res), ctx);
354#endif
355}
356
357static void emit_load_be16(u8 cond, u8 r_res, u8 r_addr, struct jit_ctx *ctx)
358{
359 _emit(cond, ARM_LDRH_I(r_res, r_addr, 0), ctx);
360#ifdef __LITTLE_ENDIAN
361 _emit(cond, ARM_REV16(r_res, r_res), ctx);
362#endif
363}
364
365static inline void emit_swap16(u8 r_dst __maybe_unused,
366 u8 r_src __maybe_unused,
367 struct jit_ctx *ctx __maybe_unused)
368{
369#ifdef __LITTLE_ENDIAN
370 emit(ARM_REV16(r_dst, r_src), ctx);
371#endif
372}
373
374#endif /* __LINUX_ARM_ARCH__ < 6 */
375
376
377/* Compute the immediate value for a PC-relative branch. */
378static inline u32 b_imm(unsigned tgt, struct jit_ctx *ctx)
379{
380 u32 imm;
381
382 if (ctx->target == NULL)
383 return 0;
384 /*
385 * BPF allows only forward jumps and the offset of the target is
386 * still the one computed during the first pass.
387 */
388 imm = ctx->offsets[tgt] + ctx->prologue_bytes - (ctx->idx * 4 + 8);
389
390 return imm >> 2;
391}
392
393#define OP_IMM3(op, r1, r2, imm_val, ctx) \
394 do { \
395 imm12 = imm8m(imm_val); \
396 if (imm12 < 0) { \
397 emit_mov_i_no8m(r_scratch, imm_val, ctx); \
398 emit(op ## _R((r1), (r2), r_scratch), ctx); \
399 } else { \
400 emit(op ## _I((r1), (r2), imm12), ctx); \
401 } \
402 } while (0)
403
404static inline void emit_err_ret(u8 cond, struct jit_ctx *ctx)
405{
406 if (ctx->ret0_fp_idx >= 0) {
407 _emit(cond, ARM_B(b_imm(ctx->ret0_fp_idx, ctx)), ctx);
408 /* NOP to keep the size constant between passes */
409 emit(ARM_MOV_R(ARM_R0, ARM_R0), ctx);
410 } else {
411 _emit(cond, ARM_MOV_I(ARM_R0, 0), ctx);
412 _emit(cond, ARM_B(b_imm(ctx->skf->len, ctx)), ctx);
413 }
414}
415
416static inline void emit_blx_r(u8 tgt_reg, struct jit_ctx *ctx)
417{
418#if __LINUX_ARM_ARCH__ < 5
419 emit(ARM_MOV_R(ARM_LR, ARM_PC), ctx);
420
421 if (elf_hwcap & HWCAP_THUMB)
422 emit(ARM_BX(tgt_reg), ctx);
423 else
424 emit(ARM_MOV_R(ARM_PC, tgt_reg), ctx);
425#else
426 emit(ARM_BLX_R(tgt_reg), ctx);
427#endif
428}
429
430static inline void emit_udiv(u8 rd, u8 rm, u8 rn, struct jit_ctx *ctx)
431{
432#if __LINUX_ARM_ARCH__ == 7
433 if (elf_hwcap & HWCAP_IDIVA) {
434 emit(ARM_UDIV(rd, rm, rn), ctx);
435 return;
436 }
437#endif
438 if (rm != ARM_R0)
439 emit(ARM_MOV_R(ARM_R0, rm), ctx);
440 if (rn != ARM_R1)
441 emit(ARM_MOV_R(ARM_R1, rn), ctx);
442
443 ctx->seen |= SEEN_CALL;
444 emit_mov_i(ARM_R3, (u32)jit_udiv, ctx);
445 emit_blx_r(ARM_R3, ctx);
446
447 if (rd != ARM_R0)
448 emit(ARM_MOV_R(rd, ARM_R0), ctx);
449}
450
451static inline void update_on_xread(struct jit_ctx *ctx)
452{
453 if (!(ctx->seen & SEEN_X))
454 ctx->flags |= FLAG_NEED_X_RESET;
455
456 ctx->seen |= SEEN_X;
457}
458
459static int build_body(struct jit_ctx *ctx)
460{
461 void *load_func[] = {jit_get_skb_b, jit_get_skb_h, jit_get_skb_w};
462 const struct sk_filter *prog = ctx->skf;
463 const struct sock_filter *inst;
464 unsigned i, load_order, off, condt;
465 int imm12;
466 u32 k;
467
468 for (i = 0; i < prog->len; i++) {
469 inst = &(prog->insns[i]);
470 /* K as an immediate value operand */
471 k = inst->k;
472
473 /* compute offsets only in the fake pass */
474 if (ctx->target == NULL)
475 ctx->offsets[i] = ctx->idx * 4;
476
477 switch (inst->code) {
478 case BPF_S_LD_IMM:
479 emit_mov_i(r_A, k, ctx);
480 break;
481 case BPF_S_LD_W_LEN:
482 ctx->seen |= SEEN_SKB;
483 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, len) != 4);
484 emit(ARM_LDR_I(r_A, r_skb,
485 offsetof(struct sk_buff, len)), ctx);
486 break;
487 case BPF_S_LD_MEM:
488 /* A = scratch[k] */
489 ctx->seen |= SEEN_MEM_WORD(k);
490 emit(ARM_LDR_I(r_A, ARM_SP, SCRATCH_OFF(k)), ctx);
491 break;
492 case BPF_S_LD_W_ABS:
493 load_order = 2;
494 goto load;
495 case BPF_S_LD_H_ABS:
496 load_order = 1;
497 goto load;
498 case BPF_S_LD_B_ABS:
499 load_order = 0;
500load:
501 /* the interpreter will deal with the negative K */
502 if ((int)k < 0)
503 return -ENOTSUPP;
504 emit_mov_i(r_off, k, ctx);
505load_common:
506 ctx->seen |= SEEN_DATA | SEEN_CALL;
507
508 if (load_order > 0) {
509 emit(ARM_SUB_I(r_scratch, r_skb_hl,
510 1 << load_order), ctx);
511 emit(ARM_CMP_R(r_scratch, r_off), ctx);
512 condt = ARM_COND_HS;
513 } else {
514 emit(ARM_CMP_R(r_skb_hl, r_off), ctx);
515 condt = ARM_COND_HI;
516 }
517
518 _emit(condt, ARM_ADD_R(r_scratch, r_off, r_skb_data),
519 ctx);
520
521 if (load_order == 0)
522 _emit(condt, ARM_LDRB_I(r_A, r_scratch, 0),
523 ctx);
524 else if (load_order == 1)
525 emit_load_be16(condt, r_A, r_scratch, ctx);
526 else if (load_order == 2)
527 emit_load_be32(condt, r_A, r_scratch, ctx);
528
529 _emit(condt, ARM_B(b_imm(i + 1, ctx)), ctx);
530
531 /* the slowpath */
532 emit_mov_i(ARM_R3, (u32)load_func[load_order], ctx);
533 emit(ARM_MOV_R(ARM_R0, r_skb), ctx);
534 /* the offset is already in R1 */
535 emit_blx_r(ARM_R3, ctx);
536 /* check the result of skb_copy_bits */
537 emit(ARM_CMP_I(ARM_R1, 0), ctx);
538 emit_err_ret(ARM_COND_NE, ctx);
539 emit(ARM_MOV_R(r_A, ARM_R0), ctx);
540 break;
541 case BPF_S_LD_W_IND:
542 load_order = 2;
543 goto load_ind;
544 case BPF_S_LD_H_IND:
545 load_order = 1;
546 goto load_ind;
547 case BPF_S_LD_B_IND:
548 load_order = 0;
549load_ind:
550 OP_IMM3(ARM_ADD, r_off, r_X, k, ctx);
551 goto load_common;
552 case BPF_S_LDX_IMM:
553 ctx->seen |= SEEN_X;
554 emit_mov_i(r_X, k, ctx);
555 break;
556 case BPF_S_LDX_W_LEN:
557 ctx->seen |= SEEN_X | SEEN_SKB;
558 emit(ARM_LDR_I(r_X, r_skb,
559 offsetof(struct sk_buff, len)), ctx);
560 break;
561 case BPF_S_LDX_MEM:
562 ctx->seen |= SEEN_X | SEEN_MEM_WORD(k);
563 emit(ARM_LDR_I(r_X, ARM_SP, SCRATCH_OFF(k)), ctx);
564 break;
565 case BPF_S_LDX_B_MSH:
566 /* x = ((*(frame + k)) & 0xf) << 2; */
567 ctx->seen |= SEEN_X | SEEN_DATA | SEEN_CALL;
568 /* the interpreter should deal with the negative K */
569 if (k < 0)
570 return -1;
571 /* offset in r1: we might have to take the slow path */
572 emit_mov_i(r_off, k, ctx);
573 emit(ARM_CMP_R(r_skb_hl, r_off), ctx);
574
575 /* load in r0: common with the slowpath */
576 _emit(ARM_COND_HI, ARM_LDRB_R(ARM_R0, r_skb_data,
577 ARM_R1), ctx);
578 /*
579 * emit_mov_i() might generate one or two instructions,
580 * the same holds for emit_blx_r()
581 */
582 _emit(ARM_COND_HI, ARM_B(b_imm(i + 1, ctx) - 2), ctx);
583
584 emit(ARM_MOV_R(ARM_R0, r_skb), ctx);
585 /* r_off is r1 */
586 emit_mov_i(ARM_R3, (u32)jit_get_skb_b, ctx);
587 emit_blx_r(ARM_R3, ctx);
588 /* check the return value of skb_copy_bits */
589 emit(ARM_CMP_I(ARM_R1, 0), ctx);
590 emit_err_ret(ARM_COND_NE, ctx);
591
592 emit(ARM_AND_I(r_X, ARM_R0, 0x00f), ctx);
593 emit(ARM_LSL_I(r_X, r_X, 2), ctx);
594 break;
595 case BPF_S_ST:
596 ctx->seen |= SEEN_MEM_WORD(k);
597 emit(ARM_STR_I(r_A, ARM_SP, SCRATCH_OFF(k)), ctx);
598 break;
599 case BPF_S_STX:
600 update_on_xread(ctx);
601 ctx->seen |= SEEN_MEM_WORD(k);
602 emit(ARM_STR_I(r_X, ARM_SP, SCRATCH_OFF(k)), ctx);
603 break;
604 case BPF_S_ALU_ADD_K:
605 /* A += K */
606 OP_IMM3(ARM_ADD, r_A, r_A, k, ctx);
607 break;
608 case BPF_S_ALU_ADD_X:
609 update_on_xread(ctx);
610 emit(ARM_ADD_R(r_A, r_A, r_X), ctx);
611 break;
612 case BPF_S_ALU_SUB_K:
613 /* A -= K */
614 OP_IMM3(ARM_SUB, r_A, r_A, k, ctx);
615 break;
616 case BPF_S_ALU_SUB_X:
617 update_on_xread(ctx);
618 emit(ARM_SUB_R(r_A, r_A, r_X), ctx);
619 break;
620 case BPF_S_ALU_MUL_K:
621 /* A *= K */
622 emit_mov_i(r_scratch, k, ctx);
623 emit(ARM_MUL(r_A, r_A, r_scratch), ctx);
624 break;
625 case BPF_S_ALU_MUL_X:
626 update_on_xread(ctx);
627 emit(ARM_MUL(r_A, r_A, r_X), ctx);
628 break;
629 case BPF_S_ALU_DIV_K:
630 /* current k == reciprocal_value(userspace k) */
631 emit_mov_i(r_scratch, k, ctx);
632 /* A = top 32 bits of the product */
633 emit(ARM_UMULL(r_scratch, r_A, r_A, r_scratch), ctx);
634 break;
635 case BPF_S_ALU_DIV_X:
636 update_on_xread(ctx);
637 emit(ARM_CMP_I(r_X, 0), ctx);
638 emit_err_ret(ARM_COND_EQ, ctx);
639 emit_udiv(r_A, r_A, r_X, ctx);
640 break;
641 case BPF_S_ALU_OR_K:
642 /* A |= K */
643 OP_IMM3(ARM_ORR, r_A, r_A, k, ctx);
644 break;
645 case BPF_S_ALU_OR_X:
646 update_on_xread(ctx);
647 emit(ARM_ORR_R(r_A, r_A, r_X), ctx);
648 break;
649 case BPF_S_ALU_AND_K:
650 /* A &= K */
651 OP_IMM3(ARM_AND, r_A, r_A, k, ctx);
652 break;
653 case BPF_S_ALU_AND_X:
654 update_on_xread(ctx);
655 emit(ARM_AND_R(r_A, r_A, r_X), ctx);
656 break;
657 case BPF_S_ALU_LSH_K:
658 if (unlikely(k > 31))
659 return -1;
660 emit(ARM_LSL_I(r_A, r_A, k), ctx);
661 break;
662 case BPF_S_ALU_LSH_X:
663 update_on_xread(ctx);
664 emit(ARM_LSL_R(r_A, r_A, r_X), ctx);
665 break;
666 case BPF_S_ALU_RSH_K:
667 if (unlikely(k > 31))
668 return -1;
669 emit(ARM_LSR_I(r_A, r_A, k), ctx);
670 break;
671 case BPF_S_ALU_RSH_X:
672 update_on_xread(ctx);
673 emit(ARM_LSR_R(r_A, r_A, r_X), ctx);
674 break;
675 case BPF_S_ALU_NEG:
676 /* A = -A */
677 emit(ARM_RSB_I(r_A, r_A, 0), ctx);
678 break;
679 case BPF_S_JMP_JA:
680 /* pc += K */
681 emit(ARM_B(b_imm(i + k + 1, ctx)), ctx);
682 break;
683 case BPF_S_JMP_JEQ_K:
684 /* pc += (A == K) ? pc->jt : pc->jf */
685 condt = ARM_COND_EQ;
686 goto cmp_imm;
687 case BPF_S_JMP_JGT_K:
688 /* pc += (A > K) ? pc->jt : pc->jf */
689 condt = ARM_COND_HI;
690 goto cmp_imm;
691 case BPF_S_JMP_JGE_K:
692 /* pc += (A >= K) ? pc->jt : pc->jf */
693 condt = ARM_COND_HS;
694cmp_imm:
695 imm12 = imm8m(k);
696 if (imm12 < 0) {
697 emit_mov_i_no8m(r_scratch, k, ctx);
698 emit(ARM_CMP_R(r_A, r_scratch), ctx);
699 } else {
700 emit(ARM_CMP_I(r_A, imm12), ctx);
701 }
702cond_jump:
703 if (inst->jt)
704 _emit(condt, ARM_B(b_imm(i + inst->jt + 1,
705 ctx)), ctx);
706 if (inst->jf)
707 _emit(condt ^ 1, ARM_B(b_imm(i + inst->jf + 1,
708 ctx)), ctx);
709 break;
710 case BPF_S_JMP_JEQ_X:
711 /* pc += (A == X) ? pc->jt : pc->jf */
712 condt = ARM_COND_EQ;
713 goto cmp_x;
714 case BPF_S_JMP_JGT_X:
715 /* pc += (A > X) ? pc->jt : pc->jf */
716 condt = ARM_COND_HI;
717 goto cmp_x;
718 case BPF_S_JMP_JGE_X:
719 /* pc += (A >= X) ? pc->jt : pc->jf */
720 condt = ARM_COND_CS;
721cmp_x:
722 update_on_xread(ctx);
723 emit(ARM_CMP_R(r_A, r_X), ctx);
724 goto cond_jump;
725 case BPF_S_JMP_JSET_K:
726 /* pc += (A & K) ? pc->jt : pc->jf */
727 condt = ARM_COND_NE;
728 /* not set iff all zeroes iff Z==1 iff EQ */
729
730 imm12 = imm8m(k);
731 if (imm12 < 0) {
732 emit_mov_i_no8m(r_scratch, k, ctx);
733 emit(ARM_TST_R(r_A, r_scratch), ctx);
734 } else {
735 emit(ARM_TST_I(r_A, imm12), ctx);
736 }
737 goto cond_jump;
738 case BPF_S_JMP_JSET_X:
739 /* pc += (A & X) ? pc->jt : pc->jf */
740 update_on_xread(ctx);
741 condt = ARM_COND_NE;
742 emit(ARM_TST_R(r_A, r_X), ctx);
743 goto cond_jump;
744 case BPF_S_RET_A:
745 emit(ARM_MOV_R(ARM_R0, r_A), ctx);
746 goto b_epilogue;
747 case BPF_S_RET_K:
748 if ((k == 0) && (ctx->ret0_fp_idx < 0))
749 ctx->ret0_fp_idx = i;
750 emit_mov_i(ARM_R0, k, ctx);
751b_epilogue:
752 if (i != ctx->skf->len - 1)
753 emit(ARM_B(b_imm(prog->len, ctx)), ctx);
754 break;
755 case BPF_S_MISC_TAX:
756 /* X = A */
757 ctx->seen |= SEEN_X;
758 emit(ARM_MOV_R(r_X, r_A), ctx);
759 break;
760 case BPF_S_MISC_TXA:
761 /* A = X */
762 update_on_xread(ctx);
763 emit(ARM_MOV_R(r_A, r_X), ctx);
764 break;
765 case BPF_S_ANC_PROTOCOL:
766 /* A = ntohs(skb->protocol) */
767 ctx->seen |= SEEN_SKB;
768 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
769 protocol) != 2);
770 off = offsetof(struct sk_buff, protocol);
771 emit(ARM_LDRH_I(r_scratch, r_skb, off), ctx);
772 emit_swap16(r_A, r_scratch, ctx);
773 break;
774 case BPF_S_ANC_CPU:
775 /* r_scratch = current_thread_info() */
776 OP_IMM3(ARM_BIC, r_scratch, ARM_SP, THREAD_SIZE - 1, ctx);
777 /* A = current_thread_info()->cpu */
778 BUILD_BUG_ON(FIELD_SIZEOF(struct thread_info, cpu) != 4);
779 off = offsetof(struct thread_info, cpu);
780 emit(ARM_LDR_I(r_A, r_scratch, off), ctx);
781 break;
782 case BPF_S_ANC_IFINDEX:
783 /* A = skb->dev->ifindex */
784 ctx->seen |= SEEN_SKB;
785 off = offsetof(struct sk_buff, dev);
786 emit(ARM_LDR_I(r_scratch, r_skb, off), ctx);
787
788 emit(ARM_CMP_I(r_scratch, 0), ctx);
789 emit_err_ret(ARM_COND_EQ, ctx);
790
791 BUILD_BUG_ON(FIELD_SIZEOF(struct net_device,
792 ifindex) != 4);
793 off = offsetof(struct net_device, ifindex);
794 emit(ARM_LDR_I(r_A, r_scratch, off), ctx);
795 break;
796 case BPF_S_ANC_MARK:
797 ctx->seen |= SEEN_SKB;
798 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, mark) != 4);
799 off = offsetof(struct sk_buff, mark);
800 emit(ARM_LDR_I(r_A, r_skb, off), ctx);
801 break;
802 case BPF_S_ANC_RXHASH:
803 ctx->seen |= SEEN_SKB;
804 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, rxhash) != 4);
805 off = offsetof(struct sk_buff, rxhash);
806 emit(ARM_LDR_I(r_A, r_skb, off), ctx);
807 break;
808 case BPF_S_ANC_QUEUE:
809 ctx->seen |= SEEN_SKB;
810 BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff,
811 queue_mapping) != 2);
812 BUILD_BUG_ON(offsetof(struct sk_buff,
813 queue_mapping) > 0xff);
814 off = offsetof(struct sk_buff, queue_mapping);
815 emit(ARM_LDRH_I(r_A, r_skb, off), ctx);
816 break;
817 default:
818 return -1;
819 }
820 }
821
822 /* compute offsets only during the first pass */
823 if (ctx->target == NULL)
824 ctx->offsets[i] = ctx->idx * 4;
825
826 return 0;
827}
828
829
830void bpf_jit_compile(struct sk_filter *fp)
831{
832 struct jit_ctx ctx;
833 unsigned tmp_idx;
834 unsigned alloc_size;
835
836 if (!bpf_jit_enable)
837 return;
838
839 memset(&ctx, 0, sizeof(ctx));
840 ctx.skf = fp;
841 ctx.ret0_fp_idx = -1;
842
843 ctx.offsets = kzalloc(GFP_KERNEL, 4 * (ctx.skf->len + 1));
844 if (ctx.offsets == NULL)
845 return;
846
847 /* fake pass to fill in the ctx->seen */
848 if (unlikely(build_body(&ctx)))
849 goto out;
850
851 tmp_idx = ctx.idx;
852 build_prologue(&ctx);
853 ctx.prologue_bytes = (ctx.idx - tmp_idx) * 4;
854
855#if __LINUX_ARM_ARCH__ < 7
856 tmp_idx = ctx.idx;
857 build_epilogue(&ctx);
858 ctx.epilogue_bytes = (ctx.idx - tmp_idx) * 4;
859
860 ctx.idx += ctx.imm_count;
861 if (ctx.imm_count) {
862 ctx.imms = kzalloc(GFP_KERNEL, 4 * ctx.imm_count);
863 if (ctx.imms == NULL)
864 goto out;
865 }
866#else
867 /* there's nothing after the epilogue on ARMv7 */
868 build_epilogue(&ctx);
869#endif
870
871 alloc_size = 4 * ctx.idx;
872 ctx.target = module_alloc(max(sizeof(struct work_struct),
873 alloc_size));
874 if (unlikely(ctx.target == NULL))
875 goto out;
876
877 ctx.idx = 0;
878 build_prologue(&ctx);
879 build_body(&ctx);
880 build_epilogue(&ctx);
881
882 flush_icache_range((u32)ctx.target, (u32)(ctx.target + ctx.idx));
883
884#if __LINUX_ARM_ARCH__ < 7
885 if (ctx.imm_count)
886 kfree(ctx.imms);
887#endif
888
889 if (bpf_jit_enable > 1)
890 print_hex_dump(KERN_INFO, "BPF JIT code: ",
891 DUMP_PREFIX_ADDRESS, 16, 4, ctx.target,
892 alloc_size, false);
893
894 fp->bpf_func = (void *)ctx.target;
895out:
896 kfree(ctx.offsets);
897 return;
898}
899
900static void bpf_jit_free_worker(struct work_struct *work)
901{
902 module_free(NULL, work);
903}
904
905void bpf_jit_free(struct sk_filter *fp)
906{
907 struct work_struct *work;
908
909 if (fp->bpf_func != sk_run_filter) {
910 work = (struct work_struct *)fp->bpf_func;
911
912 INIT_WORK(work, bpf_jit_free_worker);
913 schedule_work(work);
914 }
915}
diff --git a/arch/arm/net/bpf_jit_32.h b/arch/arm/net/bpf_jit_32.h
new file mode 100644
index 000000000000..99ae5e3f46d2
--- /dev/null
+++ b/arch/arm/net/bpf_jit_32.h
@@ -0,0 +1,190 @@
1/*
2 * Just-In-Time compiler for BPF filters on 32bit ARM
3 *
4 * Copyright (c) 2011 Mircea Gherzan <mgherzan@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; version 2 of the License.
9 */
10
11#ifndef PFILTER_OPCODES_ARM_H
12#define PFILTER_OPCODES_ARM_H
13
14#define ARM_R0 0
15#define ARM_R1 1
16#define ARM_R2 2
17#define ARM_R3 3
18#define ARM_R4 4
19#define ARM_R5 5
20#define ARM_R6 6
21#define ARM_R7 7
22#define ARM_R8 8
23#define ARM_R9 9
24#define ARM_R10 10
25#define ARM_FP 11
26#define ARM_IP 12
27#define ARM_SP 13
28#define ARM_LR 14
29#define ARM_PC 15
30
31#define ARM_COND_EQ 0x0
32#define ARM_COND_NE 0x1
33#define ARM_COND_CS 0x2
34#define ARM_COND_HS ARM_COND_CS
35#define ARM_COND_CC 0x3
36#define ARM_COND_LO ARM_COND_CC
37#define ARM_COND_MI 0x4
38#define ARM_COND_PL 0x5
39#define ARM_COND_VS 0x6
40#define ARM_COND_VC 0x7
41#define ARM_COND_HI 0x8
42#define ARM_COND_LS 0x9
43#define ARM_COND_GE 0xa
44#define ARM_COND_LT 0xb
45#define ARM_COND_GT 0xc
46#define ARM_COND_LE 0xd
47#define ARM_COND_AL 0xe
48
49/* register shift types */
50#define SRTYPE_LSL 0
51#define SRTYPE_LSR 1
52#define SRTYPE_ASR 2
53#define SRTYPE_ROR 3
54
55#define ARM_INST_ADD_R 0x00800000
56#define ARM_INST_ADD_I 0x02800000
57
58#define ARM_INST_AND_R 0x00000000
59#define ARM_INST_AND_I 0x02000000
60
61#define ARM_INST_BIC_R 0x01c00000
62#define ARM_INST_BIC_I 0x03c00000
63
64#define ARM_INST_B 0x0a000000
65#define ARM_INST_BX 0x012FFF10
66#define ARM_INST_BLX_R 0x012fff30
67
68#define ARM_INST_CMP_R 0x01500000
69#define ARM_INST_CMP_I 0x03500000
70
71#define ARM_INST_LDRB_I 0x05d00000
72#define ARM_INST_LDRB_R 0x07d00000
73#define ARM_INST_LDRH_I 0x01d000b0
74#define ARM_INST_LDR_I 0x05900000
75
76#define ARM_INST_LDM 0x08900000
77
78#define ARM_INST_LSL_I 0x01a00000
79#define ARM_INST_LSL_R 0x01a00010
80
81#define ARM_INST_LSR_I 0x01a00020
82#define ARM_INST_LSR_R 0x01a00030
83
84#define ARM_INST_MOV_R 0x01a00000
85#define ARM_INST_MOV_I 0x03a00000
86#define ARM_INST_MOVW 0x03000000
87#define ARM_INST_MOVT 0x03400000
88
89#define ARM_INST_MUL 0x00000090
90
91#define ARM_INST_POP 0x08bd0000
92#define ARM_INST_PUSH 0x092d0000
93
94#define ARM_INST_ORR_R 0x01800000
95#define ARM_INST_ORR_I 0x03800000
96
97#define ARM_INST_REV 0x06bf0f30
98#define ARM_INST_REV16 0x06bf0fb0
99
100#define ARM_INST_RSB_I 0x02600000
101
102#define ARM_INST_SUB_R 0x00400000
103#define ARM_INST_SUB_I 0x02400000
104
105#define ARM_INST_STR_I 0x05800000
106
107#define ARM_INST_TST_R 0x01100000
108#define ARM_INST_TST_I 0x03100000
109
110#define ARM_INST_UDIV 0x0730f010
111
112#define ARM_INST_UMULL 0x00800090
113
114/* register */
115#define _AL3_R(op, rd, rn, rm) ((op ## _R) | (rd) << 12 | (rn) << 16 | (rm))
116/* immediate */
117#define _AL3_I(op, rd, rn, imm) ((op ## _I) | (rd) << 12 | (rn) << 16 | (imm))
118
119#define ARM_ADD_R(rd, rn, rm) _AL3_R(ARM_INST_ADD, rd, rn, rm)
120#define ARM_ADD_I(rd, rn, imm) _AL3_I(ARM_INST_ADD, rd, rn, imm)
121
122#define ARM_AND_R(rd, rn, rm) _AL3_R(ARM_INST_AND, rd, rn, rm)
123#define ARM_AND_I(rd, rn, imm) _AL3_I(ARM_INST_AND, rd, rn, imm)
124
125#define ARM_BIC_R(rd, rn, rm) _AL3_R(ARM_INST_BIC, rd, rn, rm)
126#define ARM_BIC_I(rd, rn, imm) _AL3_I(ARM_INST_BIC, rd, rn, imm)
127
128#define ARM_B(imm24) (ARM_INST_B | ((imm24) & 0xffffff))
129#define ARM_BX(rm) (ARM_INST_BX | (rm))
130#define ARM_BLX_R(rm) (ARM_INST_BLX_R | (rm))
131
132#define ARM_CMP_R(rn, rm) _AL3_R(ARM_INST_CMP, 0, rn, rm)
133#define ARM_CMP_I(rn, imm) _AL3_I(ARM_INST_CMP, 0, rn, imm)
134
135#define ARM_LDR_I(rt, rn, off) (ARM_INST_LDR_I | (rt) << 12 | (rn) << 16 \
136 | (off))
137#define ARM_LDRB_I(rt, rn, off) (ARM_INST_LDRB_I | (rt) << 12 | (rn) << 16 \
138 | (off))
139#define ARM_LDRB_R(rt, rn, rm) (ARM_INST_LDRB_R | (rt) << 12 | (rn) << 16 \
140 | (rm))
141#define ARM_LDRH_I(rt, rn, off) (ARM_INST_LDRH_I | (rt) << 12 | (rn) << 16 \
142 | (((off) & 0xf0) << 4) | ((off) & 0xf))
143
144#define ARM_LDM(rn, regs) (ARM_INST_LDM | (rn) << 16 | (regs))
145
146#define ARM_LSL_R(rd, rn, rm) (_AL3_R(ARM_INST_LSL, rd, 0, rn) | (rm) << 8)
147#define ARM_LSL_I(rd, rn, imm) (_AL3_I(ARM_INST_LSL, rd, 0, rn) | (imm) << 7)
148
149#define ARM_LSR_R(rd, rn, rm) (_AL3_R(ARM_INST_LSR, rd, 0, rn) | (rm) << 8)
150#define ARM_LSR_I(rd, rn, imm) (_AL3_I(ARM_INST_LSR, rd, 0, rn) | (imm) << 7)
151
152#define ARM_MOV_R(rd, rm) _AL3_R(ARM_INST_MOV, rd, 0, rm)
153#define ARM_MOV_I(rd, imm) _AL3_I(ARM_INST_MOV, rd, 0, imm)
154
155#define ARM_MOVW(rd, imm) \
156 (ARM_INST_MOVW | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff))
157
158#define ARM_MOVT(rd, imm) \
159 (ARM_INST_MOVT | ((imm) >> 12) << 16 | (rd) << 12 | ((imm) & 0x0fff))
160
161#define ARM_MUL(rd, rm, rn) (ARM_INST_MUL | (rd) << 16 | (rm) << 8 | (rn))
162
163#define ARM_POP(regs) (ARM_INST_POP | (regs))
164#define ARM_PUSH(regs) (ARM_INST_PUSH | (regs))
165
166#define ARM_ORR_R(rd, rn, rm) _AL3_R(ARM_INST_ORR, rd, rn, rm)
167#define ARM_ORR_I(rd, rn, imm) _AL3_I(ARM_INST_ORR, rd, rn, imm)
168#define ARM_ORR_S(rd, rn, rm, type, rs) \
169 (ARM_ORR_R(rd, rn, rm) | (type) << 5 | (rs) << 7)
170
171#define ARM_REV(rd, rm) (ARM_INST_REV | (rd) << 12 | (rm))
172#define ARM_REV16(rd, rm) (ARM_INST_REV16 | (rd) << 12 | (rm))
173
174#define ARM_RSB_I(rd, rn, imm) _AL3_I(ARM_INST_RSB, rd, rn, imm)
175
176#define ARM_SUB_R(rd, rn, rm) _AL3_R(ARM_INST_SUB, rd, rn, rm)
177#define ARM_SUB_I(rd, rn, imm) _AL3_I(ARM_INST_SUB, rd, rn, imm)
178
179#define ARM_STR_I(rt, rn, off) (ARM_INST_STR_I | (rt) << 12 | (rn) << 16 \
180 | (off))
181
182#define ARM_TST_R(rn, rm) _AL3_R(ARM_INST_TST, 0, rn, rm)
183#define ARM_TST_I(rn, imm) _AL3_I(ARM_INST_TST, 0, rn, imm)
184
185#define ARM_UDIV(rd, rn, rm) (ARM_INST_UDIV | (rd) << 16 | (rn) | (rm) << 8)
186
187#define ARM_UMULL(rd_lo, rd_hi, rn, rm) (ARM_INST_UMULL | (rd_hi) << 16 \
188 | (rd_lo) << 12 | (rm) << 8 | rn)
189
190#endif /* PFILTER_OPCODES_ARM_H */
diff --git a/arch/arm/nwfpe/fpa11.c b/arch/arm/nwfpe/fpa11.c
index cc60acde84d9..2782ebcc2ed3 100644
--- a/arch/arm/nwfpe/fpa11.c
+++ b/arch/arm/nwfpe/fpa11.c
@@ -28,7 +28,6 @@
28 28
29#include <linux/compiler.h> 29#include <linux/compiler.h>
30#include <linux/string.h> 30#include <linux/string.h>
31#include <asm/system.h>
32 31
33/* Reset the FPA11 chip. Called to initialize and reset the emulator. */ 32/* Reset the FPA11 chip. Called to initialize and reset the emulator. */
34static void resetFPA11(void) 33static void resetFPA11(void)
diff --git a/arch/arm/plat-iop/i2c.c b/arch/arm/plat-iop/i2c.c
index 4efe392859ee..88215ad031a2 100644
--- a/arch/arm/plat-iop/i2c.c
+++ b/arch/arm/plat-iop/i2c.c
@@ -23,7 +23,6 @@
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/mach/map.h> 24#include <asm/mach/map.h>
25#include <asm/setup.h> 25#include <asm/setup.h>
26#include <asm/system.h>
27#include <asm/memory.h> 26#include <asm/memory.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29#include <asm/hardware/iop3xx.h> 28#include <asm/hardware/iop3xx.h>
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index 72768356447a..0da42058a20f 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -20,7 +20,6 @@
20#include <linux/io.h> 20#include <linux/io.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/signal.h> 22#include <asm/signal.h>
23#include <asm/system.h>
24#include <mach/hardware.h> 23#include <mach/hardware.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <asm/hardware/iop3xx.h> 25#include <asm/hardware/iop3xx.h>
diff --git a/arch/arm/plat-iop/restart.c b/arch/arm/plat-iop/restart.c
index 6a85a0c502e6..33fa699a4d28 100644
--- a/arch/arm/plat-iop/restart.c
+++ b/arch/arm/plat-iop/restart.c
@@ -8,6 +8,7 @@
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <asm/hardware/iop3xx.h> 10#include <asm/hardware/iop3xx.h>
11#include <asm/system_misc.h>
11#include <mach/hardware.h> 12#include <mach/hardware.h>
12 13
13void iop3xx_restart(char mode, const char *cmd) 14void iop3xx_restart(char mode, const char *cmd)
diff --git a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c
index d1e31fa1b0c3..5cac2c540f4f 100644
--- a/arch/arm/plat-mxc/3ds_debugboard.c
+++ b/arch/arm/plat-mxc/3ds_debugboard.c
@@ -80,7 +80,7 @@ static struct smsc911x_platform_config smsc911x_config = {
80 80
81static struct platform_device smsc_lan9217_device = { 81static struct platform_device smsc_lan9217_device = {
82 .name = "smsc911x", 82 .name = "smsc911x",
83 .id = 0, 83 .id = -1,
84 .dev = { 84 .dev = {
85 .platform_data = &smsc911x_config, 85 .platform_data = &smsc911x_config,
86 }, 86 },
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
index a599f01f8b92..0630513554de 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -22,11 +22,8 @@
22 22
23#include <asm/sizes.h> 23#include <asm/sizes.h>
24 24
25#ifdef __ASSEMBLER__ 25#define addr_in_module(addr, mod) \
26#define IOMEM(addr) (addr) 26 ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
27#else
28#define IOMEM(addr) ((void __force __iomem *)(addr))
29#endif
30 27
31#define IMX_IO_P2V_MODULE(addr, module) \ 28#define IMX_IO_P2V_MODULE(addr, module) \
32 (((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \ 29 (((addr) - module ## _BASE_ADDR) < module ## _SIZE ? \
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h
deleted file mode 100644
index 338300b18b00..000000000000
--- a/arch/arm/plat-mxc/include/mach/io.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
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#ifndef __ASM_ARCH_MXC_IO_H__
12#define __ASM_ARCH_MXC_IO_H__
13
14/* Allow IO space to be anywhere in the memory */
15#define IO_SPACE_LIMIT 0xffffffff
16
17#define __arch_ioremap __imx_ioremap
18#define __arch_iounmap __iounmap
19
20#define addr_in_module(addr, mod) \
21 ((unsigned long)(addr) - mod ## _BASE_ADDR < mod ## _SIZE)
22
23extern void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int);
24
25static inline void __iomem *
26__imx_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
27{
28 if (imx_ioremap != NULL)
29 return imx_ioremap(phys_addr, size, mtype);
30 else
31 return __arm_ioremap(phys_addr, size, mtype);
32}
33
34/* io address mapping macro */
35#define __io(a) __typesafe_io(a)
36
37#define __mem_pci(a) (a)
38
39#endif
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index f30dcacbbd0a..1996c3e3b8fe 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -25,8 +25,8 @@
25 25
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/common.h> 27#include <mach/common.h>
28#include <asm/system_misc.h>
28#include <asm/proc-fns.h> 29#include <asm/proc-fns.h>
29#include <asm/system.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31 31
32void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int) = NULL; 32void __iomem *(*imx_ioremap)(unsigned long, size_t, unsigned int) = NULL;
diff --git a/arch/arm/plat-nomadik/Kconfig b/arch/arm/plat-nomadik/Kconfig
index bca4914b4b9d..4c48c8b60b54 100644
--- a/arch/arm/plat-nomadik/Kconfig
+++ b/arch/arm/plat-nomadik/Kconfig
@@ -23,7 +23,6 @@ config HAS_MTU
23config NOMADIK_MTU_SCHED_CLOCK 23config NOMADIK_MTU_SCHED_CLOCK
24 bool 24 bool
25 depends on HAS_MTU 25 depends on HAS_MTU
26 select HAVE_SCHED_CLOCK
27 help 26 help
28 Use the Multi Timer Unit as the sched_clock. 27 Use the Multi Timer Unit as the sched_clock.
29 28
diff --git a/arch/arm/plat-nomadik/include/plat/ste_dma40.h b/arch/arm/plat-nomadik/include/plat/ste_dma40.h
index fd0ee84c45d1..9ff93b065686 100644
--- a/arch/arm/plat-nomadik/include/plat/ste_dma40.h
+++ b/arch/arm/plat-nomadik/include/plat/ste_dma40.h
@@ -200,8 +200,7 @@ dma_async_tx_descriptor *stedma40_slave_mem(struct dma_chan *chan,
200 sg.dma_address = addr; 200 sg.dma_address = addr;
201 sg.length = size; 201 sg.length = size;
202 202
203 return chan->device->device_prep_slave_sg(chan, &sg, 1, 203 return dmaengine_prep_slave_sg(chan, &sg, 1, direction, flags);
204 direction, flags);
205} 204}
206 205
207#else 206#else
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index ce1e9b96ba1a..ad95c7a5d009 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -17,6 +17,7 @@ config ARCH_OMAP1
17 select IRQ_DOMAIN 17 select IRQ_DOMAIN
18 select HAVE_IDE 18 select HAVE_IDE
19 select NEED_MACH_MEMORY_H 19 select NEED_MACH_MEMORY_H
20 select NEED_MACH_IO_H if PCCARD
20 help 21 help
21 "Systems based on omap7xx, omap15xx or omap16xx" 22 "Systems based on omap7xx, omap15xx or omap16xx"
22 23
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 56b6f8b7053e..8506cbb7fea4 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -441,6 +441,8 @@ static int __init clk_disable_unused(void)
441 return 0; 441 return 0;
442 442
443 pr_info("clock: disabling unused clocks to save power\n"); 443 pr_info("clock: disabling unused clocks to save power\n");
444
445 spin_lock_irqsave(&clockfw_lock, flags);
444 list_for_each_entry(ck, &clocks, node) { 446 list_for_each_entry(ck, &clocks, node) {
445 if (ck->ops == &clkops_null) 447 if (ck->ops == &clkops_null)
446 continue; 448 continue;
@@ -448,10 +450,9 @@ static int __init clk_disable_unused(void)
448 if (ck->usecount > 0 || !ck->enable_reg) 450 if (ck->usecount > 0 || !ck->enable_reg)
449 continue; 451 continue;
450 452
451 spin_lock_irqsave(&clockfw_lock, flags);
452 arch_clock->clk_disable_unused(ck); 453 arch_clock->clk_disable_unused(ck);
453 spin_unlock_irqrestore(&clockfw_lock, flags);
454 } 454 }
455 spin_unlock_irqrestore(&clockfw_lock, flags);
455 456
456 return 0; 457 return 0;
457} 458}
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index 61a1ec2a6af4..39407cbe34c6 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -15,7 +15,6 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <asm/leds.h> 17#include <asm/leds.h>
18#include <asm/system.h>
19#include <asm/mach-types.h> 18#include <asm/mach-types.h>
20 19
21#include <plat/fpga.h> 20#include <plat/fpga.h>
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 74300ae29b71..ecdb3da0dea9 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -36,7 +36,6 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38 38
39#include <asm/system.h>
40#include <mach/hardware.h> 39#include <mach/hardware.h>
41#include <plat/dma.h> 40#include <plat/dma.h>
42 41
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index cb75b657b04b..2f6e9924a814 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -158,10 +158,6 @@
158#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr)) 158#define OMAP_MPUIO(nr) (OMAP_MAX_GPIO_LINES + (nr))
159#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES) 159#define OMAP_GPIO_IS_MPUIO(nr) ((nr) >= OMAP_MAX_GPIO_LINES)
160 160
161#define OMAP_GPIO_IRQ(nr) (OMAP_GPIO_IS_MPUIO(nr) ? \
162 IH_MPUIO_BASE + ((nr) & 0x0f) : \
163 IH_GPIO_BASE + (nr))
164
165struct omap_gpio_dev_attr { 161struct omap_gpio_dev_attr {
166 int bank_width; /* GPIO bank width */ 162 int bank_width; /* GPIO bank width */
167 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ 163 bool dbck_flag; /* dbck required or not - True for OMAP3&4 */
@@ -218,30 +214,14 @@ extern void omap_set_gpio_debounce(int gpio, int enable);
218extern void omap_set_gpio_debounce_time(int gpio, int enable); 214extern void omap_set_gpio_debounce_time(int gpio, int enable);
219/*-------------------------------------------------------------------------*/ 215/*-------------------------------------------------------------------------*/
220 216
221/* Wrappers for "new style" GPIO calls, using the new infrastructure 217/*
218 * Wrappers for "new style" GPIO calls, using the new infrastructure
222 * which lets us plug in FPGA, I2C, and other implementations. 219 * which lets us plug in FPGA, I2C, and other implementations.
223 * * 220 *
224 * The original OMAP-specific calls should eventually be removed. 221 * The original OMAP-specific calls should eventually be removed.
225 */ 222 */
226 223
227#include <linux/errno.h> 224#include <linux/errno.h>
228#include <asm-generic/gpio.h> 225#include <asm-generic/gpio.h>
229 226
230static inline int irq_to_gpio(unsigned irq)
231{
232 int tmp;
233
234 /* omap1 SOC mpuio */
235 if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16)))
236 return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES;
237
238 /* SOC gpio */
239 tmp = irq - IH_GPIO_BASE;
240 if (tmp < OMAP_MAX_GPIO_LINES)
241 return tmp;
242
243 /* we don't supply reverse mappings for non-SOC gpios */
244 return -EIO;
245}
246
247#endif 227#endif
diff --git a/arch/arm/plat-omap/include/plat/hardware.h b/arch/arm/plat-omap/include/plat/hardware.h
index 537b05ae1f51..e897978371c2 100644
--- a/arch/arm/plat-omap/include/plat/hardware.h
+++ b/arch/arm/plat-omap/include/plat/hardware.h
@@ -43,12 +43,6 @@
43#endif 43#endif
44#include <plat/serial.h> 44#include <plat/serial.h>
45 45
46#ifdef __ASSEMBLER__
47#define IOMEM(x) (x)
48#else
49#define IOMEM(x) ((void __force __iomem *)(x))
50#endif
51
52/* 46/*
53 * --------------------------------------------------------------------------- 47 * ---------------------------------------------------------------------------
54 * Common definitions for all OMAP processors 48 * Common definitions for all OMAP processors
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index f75946c3293d..7a38750c0079 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -137,8 +137,6 @@ struct omap_mmc_platform_data {
137 int (*set_power)(struct device *dev, int slot, 137 int (*set_power)(struct device *dev, int slot,
138 int power_on, int vdd); 138 int power_on, int vdd);
139 int (*get_ro)(struct device *dev, int slot); 139 int (*get_ro)(struct device *dev, int slot);
140 int (*set_sleep)(struct device *dev, int slot, int sleep,
141 int vdd, int cardsleep);
142 void (*remux)(struct device *dev, int slot, int power_on); 140 void (*remux)(struct device *dev, int slot, int power_on);
143 /* Call back before enabling / disabling regulators */ 141 /* Call back before enabling / disabling regulators */
144 void (*before_set_reg)(struct device *dev, int slot, 142 void (*before_set_reg)(struct device *dev, int slot,
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 9e8e63d52aab..8070145ccb98 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -47,17 +47,17 @@ extern struct omap_hwmod_sysc_fields omap_hwmod_sysc_type2;
47 * with the original PRCM protocol defined for OMAP2420 47 * with the original PRCM protocol defined for OMAP2420
48 */ 48 */
49#define SYSC_TYPE1_MIDLEMODE_SHIFT 12 49#define SYSC_TYPE1_MIDLEMODE_SHIFT 12
50#define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_MIDLEMODE_SHIFT) 50#define SYSC_TYPE1_MIDLEMODE_MASK (0x3 << SYSC_TYPE1_MIDLEMODE_SHIFT)
51#define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8 51#define SYSC_TYPE1_CLOCKACTIVITY_SHIFT 8
52#define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_CLOCKACTIVITY_SHIFT) 52#define SYSC_TYPE1_CLOCKACTIVITY_MASK (0x3 << SYSC_TYPE1_CLOCKACTIVITY_SHIFT)
53#define SYSC_TYPE1_SIDLEMODE_SHIFT 3 53#define SYSC_TYPE1_SIDLEMODE_SHIFT 3
54#define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_SIDLEMODE_SHIFT) 54#define SYSC_TYPE1_SIDLEMODE_MASK (0x3 << SYSC_TYPE1_SIDLEMODE_SHIFT)
55#define SYSC_TYPE1_ENAWAKEUP_SHIFT 2 55#define SYSC_TYPE1_ENAWAKEUP_SHIFT 2
56#define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT) 56#define SYSC_TYPE1_ENAWAKEUP_MASK (1 << SYSC_TYPE1_ENAWAKEUP_SHIFT)
57#define SYSC_TYPE1_SOFTRESET_SHIFT 1 57#define SYSC_TYPE1_SOFTRESET_SHIFT 1
58#define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT) 58#define SYSC_TYPE1_SOFTRESET_MASK (1 << SYSC_TYPE1_SOFTRESET_SHIFT)
59#define SYSC_TYPE1_AUTOIDLE_SHIFT 0 59#define SYSC_TYPE1_AUTOIDLE_SHIFT 0
60#define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT) 60#define SYSC_TYPE1_AUTOIDLE_MASK (1 << SYSC_TYPE1_AUTOIDLE_SHIFT)
61 61
62/* 62/*
63 * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant 63 * OCP SYSCONFIG bit shifts/masks TYPE2. These are for IPs compliant
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
index 925b12b500dc..9bb978ecd884 100644
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ b/arch/arm/plat-omap/include/plat/sdrc.h
@@ -16,7 +16,6 @@
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18
19#include <mach/io.h>
20 19
21/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */ 20/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
22 21
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h
index d0fc9f4dc155..762eeb0626c1 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -112,7 +112,6 @@ extern int omap4430_phy_suspend(struct device *dev, int suspend);
112 */ 112 */
113 113
114#define OMAP2_L4_IO_OFFSET 0xb2000000 114#define OMAP2_L4_IO_OFFSET 0xb2000000
115#define IOMEM(x) ((void __force __iomem *)(x))
116#define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) 115#define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET)
117 116
118static inline u8 omap_readb(u32 pa) 117static inline u8 omap_readb(u32 pa)
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index 089899a7db72..74daf5ed1432 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -21,6 +21,7 @@
21#include <plat/orion_wdt.h> 21#include <plat/orion_wdt.h>
22#include <plat/mv_xor.h> 22#include <plat/mv_xor.h>
23#include <plat/ehci-orion.h> 23#include <plat/ehci-orion.h>
24#include <mach/bridge-regs.h>
24 25
25/* Fill in the resources structure and link it into the platform 26/* Fill in the resources structure and link it into the platform
26 device structure. There is always a memory region, and nearly 27 device structure. There is always a memory region, and nearly
@@ -568,13 +569,17 @@ void __init orion_spi_1_init(unsigned long mapbase,
568 ****************************************************************************/ 569 ****************************************************************************/
569static struct orion_wdt_platform_data orion_wdt_data; 570static struct orion_wdt_platform_data orion_wdt_data;
570 571
572static struct resource orion_wdt_resource =
573 DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);
574
571static struct platform_device orion_wdt_device = { 575static struct platform_device orion_wdt_device = {
572 .name = "orion_wdt", 576 .name = "orion_wdt",
573 .id = -1, 577 .id = -1,
574 .dev = { 578 .dev = {
575 .platform_data = &orion_wdt_data, 579 .platform_data = &orion_wdt_data,
576 }, 580 },
577 .num_resources = 0, 581 .resource = &orion_wdt_resource,
582 .num_resources = 1,
578}; 583};
579 584
580void __init orion_wdt_init(unsigned long tclk) 585void __init orion_wdt_init(unsigned long tclk)
diff --git a/arch/arm/plat-orion/include/plat/audio.h b/arch/arm/plat-orion/include/plat/audio.h
index 885f8abd927b..d6a55bd2e578 100644
--- a/arch/arm/plat-orion/include/plat/audio.h
+++ b/arch/arm/plat-orion/include/plat/audio.h
@@ -2,7 +2,6 @@
2#define __PLAT_AUDIO_H 2#define __PLAT_AUDIO_H
3 3
4struct kirkwood_asoc_platform_data { 4struct kirkwood_asoc_platform_data {
5 u32 tclk;
6 int burst; 5 int burst;
7}; 6};
8#endif 7#endif
diff --git a/arch/arm/plat-pxa/dma.c b/arch/arm/plat-pxa/dma.c
index 2d3c19d7c7b1..79ef102e3b2b 100644
--- a/arch/arm/plat-pxa/dma.c
+++ b/arch/arm/plat-pxa/dma.c
@@ -20,7 +20,6 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/dma-mapping.h> 21#include <linux/dma-mapping.h>
22 22
23#include <asm/system.h>
24#include <asm/irq.h> 23#include <asm/irq.h>
25#include <asm/memory.h> 24#include <asm/memory.h>
26#include <mach/hardware.h> 25#include <mach/hardware.h>
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index 32a09931350c..290942d9adda 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -35,6 +35,8 @@
35#include <mach/regs-clock.h> 35#include <mach/regs-clock.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/cacheflush.h> 37#include <asm/cacheflush.h>
38#include <asm/system_info.h>
39#include <asm/system_misc.h>
38 40
39#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
40#include <asm/mach/map.h> 42#include <asm/mach/map.h>
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 2bab4c99a234..28f898f75380 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -27,7 +27,6 @@
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/io.h> 28#include <linux/io.h>
29 29
30#include <asm/system.h>
31#include <asm/irq.h> 30#include <asm/irq.h>
32#include <mach/hardware.h> 31#include <mach/hardware.h>
33#include <mach/dma.h> 32#include <mach/dma.h>
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 7a308699f816..96bea3202304 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -9,8 +9,8 @@ config PLAT_S5P
9 bool 9 bool
10 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS) 10 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210 || ARCH_EXYNOS)
11 default y 11 default y
12 select ARM_VIC if !ARCH_EXYNOS4 12 select ARM_VIC if !ARCH_EXYNOS
13 select ARM_GIC if ARCH_EXYNOS4 13 select ARM_GIC if ARCH_EXYNOS
14 select GIC_NON_BANKED if ARCH_EXYNOS4 14 select GIC_NON_BANKED if ARCH_EXYNOS4
15 select NO_IOPORT 15 select NO_IOPORT
16 select ARCH_REQUIRE_GPIOLIB 16 select ARCH_REQUIRE_GPIOLIB
@@ -40,6 +40,10 @@ config S5P_HRT
40 help 40 help
41 Use the High Resolution timer support 41 Use the High Resolution timer support
42 42
43config S5P_DEV_UART
44 def_bool y
45 depends on (ARCH_S5P64X0 || ARCH_S5PC100 || ARCH_S5PV210)
46
43config S5P_PM 47config S5P_PM
44 bool 48 bool
45 help 49 help
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index 30d8c3016e6b..4bd824136659 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -12,7 +12,6 @@ obj- :=
12 12
13# Core files 13# Core files
14 14
15obj-y += dev-uart.o
16obj-y += clock.o 15obj-y += clock.o
17obj-y += irq.o 16obj-y += irq.o
18obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o 17obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o
@@ -23,5 +22,7 @@ obj-$(CONFIG_S5P_SLEEP) += sleep.o
23obj-$(CONFIG_S5P_HRT) += s5p-time.o 22obj-$(CONFIG_S5P_HRT) += s5p-time.o
24 23
25# devices 24# devices
25
26obj-$(CONFIG_S5P_DEV_UART) += dev-uart.o
26obj-$(CONFIG_S5P_DEV_MFC) += dev-mfc.o 27obj-$(CONFIG_S5P_DEV_MFC) += dev-mfc.o
27obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o 28obj-$(CONFIG_S5P_SETUP_MIPIPHY) += setup-mipiphy.o
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index 963edea7f7e7..f68a9bb11948 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -61,6 +61,20 @@ struct clk clk_fout_apll = {
61 .id = -1, 61 .id = -1,
62}; 62};
63 63
64/* BPLL clock output */
65
66struct clk clk_fout_bpll = {
67 .name = "fout_bpll",
68 .id = -1,
69};
70
71/* CPLL clock output */
72
73struct clk clk_fout_cpll = {
74 .name = "fout_cpll",
75 .id = -1,
76};
77
64/* MPLL clock output 78/* MPLL clock output
65 * No need .ctrlbit, this is always on 79 * No need .ctrlbit, this is always on
66*/ 80*/
@@ -101,6 +115,28 @@ struct clksrc_sources clk_src_apll = {
101 .nr_sources = ARRAY_SIZE(clk_src_apll_list), 115 .nr_sources = ARRAY_SIZE(clk_src_apll_list),
102}; 116};
103 117
118/* Possible clock sources for BPLL Mux */
119static struct clk *clk_src_bpll_list[] = {
120 [0] = &clk_fin_bpll,
121 [1] = &clk_fout_bpll,
122};
123
124struct clksrc_sources clk_src_bpll = {
125 .sources = clk_src_bpll_list,
126 .nr_sources = ARRAY_SIZE(clk_src_bpll_list),
127};
128
129/* Possible clock sources for CPLL Mux */
130static struct clk *clk_src_cpll_list[] = {
131 [0] = &clk_fin_cpll,
132 [1] = &clk_fout_cpll,
133};
134
135struct clksrc_sources clk_src_cpll = {
136 .sources = clk_src_cpll_list,
137 .nr_sources = ARRAY_SIZE(clk_src_cpll_list),
138};
139
104/* Possible clock sources for MPLL Mux */ 140/* Possible clock sources for MPLL Mux */
105static struct clk *clk_src_mpll_list[] = { 141static struct clk *clk_src_mpll_list[] = {
106 [0] = &clk_fin_mpll, 142 [0] = &clk_fin_mpll,
diff --git a/arch/arm/plat-s5p/irq-pm.c b/arch/arm/plat-s5p/irq-pm.c
index 327acb3a4464..d1bfecae6c9f 100644
--- a/arch/arm/plat-s5p/irq-pm.c
+++ b/arch/arm/plat-s5p/irq-pm.c
@@ -39,19 +39,32 @@ unsigned long s3c_irqwake_eintallow = 0xffffffffL;
39int s3c_irq_wake(struct irq_data *data, unsigned int state) 39int s3c_irq_wake(struct irq_data *data, unsigned int state)
40{ 40{
41 unsigned long irqbit; 41 unsigned long irqbit;
42 unsigned int irq_rtc_tic, irq_rtc_alarm;
43
44#ifdef CONFIG_ARCH_EXYNOS
45 if (soc_is_exynos5250()) {
46 irq_rtc_tic = EXYNOS5_IRQ_RTC_TIC;
47 irq_rtc_alarm = EXYNOS5_IRQ_RTC_ALARM;
48 } else {
49 irq_rtc_tic = EXYNOS4_IRQ_RTC_TIC;
50 irq_rtc_alarm = EXYNOS4_IRQ_RTC_ALARM;
51 }
52#else
53 irq_rtc_tic = IRQ_RTC_TIC;
54 irq_rtc_alarm = IRQ_RTC_ALARM;
55#endif
56
57 if (data->irq == irq_rtc_tic || data->irq == irq_rtc_alarm) {
58 irqbit = 1 << (data->irq + 1 - irq_rtc_alarm);
42 59
43 switch (data->irq) {
44 case IRQ_RTC_TIC:
45 case IRQ_RTC_ALARM:
46 irqbit = 1 << (data->irq + 1 - IRQ_RTC_ALARM);
47 if (!state) 60 if (!state)
48 s3c_irqwake_intmask |= irqbit; 61 s3c_irqwake_intmask |= irqbit;
49 else 62 else
50 s3c_irqwake_intmask &= ~irqbit; 63 s3c_irqwake_intmask &= ~irqbit;
51 break; 64 } else {
52 default:
53 return -ENOENT; 65 return -ENOENT;
54 } 66 }
67
55 return 0; 68 return 0;
56} 69}
57 70
diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c
index 81c06d44c11e..46b426e8aff5 100644
--- a/arch/arm/plat-samsung/cpu.c
+++ b/arch/arm/plat-samsung/cpu.c
@@ -15,7 +15,6 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/io.h> 16#include <linux/io.h>
17 17
18#include <asm/system.h>
19 18
20#include <mach/map.h> 19#include <mach/map.h>
21#include <plat/cpu.h> 20#include <plat/cpu.h>
diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c
index 301d9c319d0b..eb9f4f534006 100644
--- a/arch/arm/plat-samsung/dma-ops.c
+++ b/arch/arm/plat-samsung/dma-ops.c
@@ -79,11 +79,11 @@ static int samsung_dmadev_prepare(unsigned ch,
79 info->len, offset_in_page(info->buf)); 79 info->len, offset_in_page(info->buf));
80 sg_dma_address(&sg) = info->buf; 80 sg_dma_address(&sg) = info->buf;
81 81
82 desc = chan->device->device_prep_slave_sg(chan, 82 desc = dmaengine_prep_slave_sg(chan,
83 &sg, 1, info->direction, DMA_PREP_INTERRUPT); 83 &sg, 1, info->direction, DMA_PREP_INTERRUPT);
84 break; 84 break;
85 case DMA_CYCLIC: 85 case DMA_CYCLIC:
86 desc = chan->device->device_prep_dma_cyclic(chan, 86 desc = dmaengine_prep_dma_cyclic(chan,
87 info->buf, info->len, info->period, info->direction); 87 info->buf, info->len, info->period, info->direction);
88 break; 88 break;
89 default: 89 default:
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 73cb3cfd0685..787ceaca0be8 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -42,6 +42,9 @@ extern unsigned long samsung_cpu_id;
42#define EXYNOS4412_CPU_ID 0xE4412200 42#define EXYNOS4412_CPU_ID 0xE4412200
43#define EXYNOS4_CPU_MASK 0xFFFE0000 43#define EXYNOS4_CPU_MASK 0xFFFE0000
44 44
45#define EXYNOS5250_SOC_ID 0x43520000
46#define EXYNOS5_SOC_MASK 0xFFFFF000
47
45#define IS_SAMSUNG_CPU(name, id, mask) \ 48#define IS_SAMSUNG_CPU(name, id, mask) \
46static inline int is_samsung_##name(void) \ 49static inline int is_samsung_##name(void) \
47{ \ 50{ \
@@ -58,6 +61,7 @@ IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
58IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK) 61IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
59IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK) 62IS_SAMSUNG_CPU(exynos4212, EXYNOS4212_CPU_ID, EXYNOS4_CPU_MASK)
60IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK) 63IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
64IS_SAMSUNG_CPU(exynos5250, EXYNOS5250_SOC_ID, EXYNOS5_SOC_MASK)
61 65
62#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \ 66#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
63 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \ 67 defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
@@ -120,6 +124,12 @@ IS_SAMSUNG_CPU(exynos4412, EXYNOS4412_CPU_ID, EXYNOS4_CPU_MASK)
120#define EXYNOS4210_REV_1_0 (0x10) 124#define EXYNOS4210_REV_1_0 (0x10)
121#define EXYNOS4210_REV_1_1 (0x11) 125#define EXYNOS4210_REV_1_1 (0x11)
122 126
127#if defined(CONFIG_SOC_EXYNOS5250)
128# define soc_is_exynos5250() is_samsung_exynos5250()
129#else
130# define soc_is_exynos5250() 0
131#endif
132
123#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE } 133#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
124 134
125#ifndef MHZ 135#ifndef MHZ
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 5e7972de3ed5..2155d4af62a3 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -26,6 +26,8 @@ struct s3c24xx_uart_resources {
26extern struct s3c24xx_uart_resources s3c2410_uart_resources[]; 26extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
27extern struct s3c24xx_uart_resources s3c64xx_uart_resources[]; 27extern struct s3c24xx_uart_resources s3c64xx_uart_resources[];
28extern struct s3c24xx_uart_resources s5p_uart_resources[]; 28extern struct s3c24xx_uart_resources s5p_uart_resources[];
29extern struct s3c24xx_uart_resources exynos4_uart_resources[];
30extern struct s3c24xx_uart_resources exynos5_uart_resources[];
29 31
30extern struct platform_device *s3c24xx_uart_devs[]; 32extern struct platform_device *s3c24xx_uart_devs[];
31extern struct platform_device *s3c24xx_uart_src[]; 33extern struct platform_device *s3c24xx_uart_src[];
diff --git a/arch/arm/plat-samsung/include/plat/s5p-clock.h b/arch/arm/plat-samsung/include/plat/s5p-clock.h
index 984bf9e7bc89..1de4b32f98e9 100644
--- a/arch/arm/plat-samsung/include/plat/s5p-clock.h
+++ b/arch/arm/plat-samsung/include/plat/s5p-clock.h
@@ -18,6 +18,8 @@
18#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) 18#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
19 19
20#define clk_fin_apll clk_ext_xtal_mux 20#define clk_fin_apll clk_ext_xtal_mux
21#define clk_fin_bpll clk_ext_xtal_mux
22#define clk_fin_cpll clk_ext_xtal_mux
21#define clk_fin_mpll clk_ext_xtal_mux 23#define clk_fin_mpll clk_ext_xtal_mux
22#define clk_fin_epll clk_ext_xtal_mux 24#define clk_fin_epll clk_ext_xtal_mux
23#define clk_fin_dpll clk_ext_xtal_mux 25#define clk_fin_dpll clk_ext_xtal_mux
@@ -29,6 +31,8 @@ extern struct clk clk_xusbxti;
29extern struct clk clk_48m; 31extern struct clk clk_48m;
30extern struct clk s5p_clk_27m; 32extern struct clk s5p_clk_27m;
31extern struct clk clk_fout_apll; 33extern struct clk clk_fout_apll;
34extern struct clk clk_fout_bpll;
35extern struct clk clk_fout_cpll;
32extern struct clk clk_fout_mpll; 36extern struct clk clk_fout_mpll;
33extern struct clk clk_fout_epll; 37extern struct clk clk_fout_epll;
34extern struct clk clk_fout_dpll; 38extern struct clk clk_fout_dpll;
@@ -37,6 +41,8 @@ extern struct clk clk_arm;
37extern struct clk clk_vpll; 41extern struct clk clk_vpll;
38 42
39extern struct clksrc_sources clk_src_apll; 43extern struct clksrc_sources clk_src_apll;
44extern struct clksrc_sources clk_src_bpll;
45extern struct clksrc_sources clk_src_cpll;
40extern struct clksrc_sources clk_src_mpll; 46extern struct clksrc_sources clk_src_mpll;
41extern struct clksrc_sources clk_src_epll; 47extern struct clksrc_sources clk_src_epll;
42extern struct clksrc_sources clk_src_dpll; 48extern struct clksrc_sources clk_src_dpll;
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index ee48e12a1e72..7e068d182c3d 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -37,7 +37,9 @@ static void arch_detect_cpu(void);
37/* how many bytes we allow into the FIFO at a time in FIFO mode */ 37/* how many bytes we allow into the FIFO at a time in FIFO mode */
38#define FIFO_MAX (14) 38#define FIFO_MAX (14)
39 39
40#ifdef S3C_PA_UART
40#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT) 41#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT)
42#endif
41 43
42static __inline__ void 44static __inline__ void
43uart_wr(unsigned int reg, unsigned int val) 45uart_wr(unsigned int reg, unsigned int val)
diff --git a/arch/arm/plat-samsung/irq-vic-timer.c b/arch/arm/plat-samsung/irq-vic-timer.c
index 51583cd30164..f980cf3d2baa 100644
--- a/arch/arm/plat-samsung/irq-vic-timer.c
+++ b/arch/arm/plat-samsung/irq-vic-timer.c
@@ -19,6 +19,7 @@
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <mach/map.h> 21#include <mach/map.h>
22#include <plat/cpu.h>
22#include <plat/irq-vic-timer.h> 23#include <plat/irq-vic-timer.h>
23#include <plat/regs-timer.h> 24#include <plat/regs-timer.h>
24 25
@@ -57,6 +58,21 @@ void __init s3c_init_vic_timer_irq(unsigned int num, unsigned int timer_irq)
57 struct irq_chip_type *ct; 58 struct irq_chip_type *ct;
58 unsigned int i; 59 unsigned int i;
59 60
61#ifdef CONFIG_ARCH_EXYNOS
62 if (soc_is_exynos5250()) {
63 pirq[0] = EXYNOS5_IRQ_TIMER0_VIC;
64 pirq[1] = EXYNOS5_IRQ_TIMER1_VIC;
65 pirq[2] = EXYNOS5_IRQ_TIMER2_VIC;
66 pirq[3] = EXYNOS5_IRQ_TIMER3_VIC;
67 pirq[4] = EXYNOS5_IRQ_TIMER4_VIC;
68 } else {
69 pirq[0] = EXYNOS4_IRQ_TIMER0_VIC;
70 pirq[1] = EXYNOS4_IRQ_TIMER1_VIC;
71 pirq[2] = EXYNOS4_IRQ_TIMER2_VIC;
72 pirq[3] = EXYNOS4_IRQ_TIMER3_VIC;
73 pirq[4] = EXYNOS4_IRQ_TIMER4_VIC;
74 }
75#endif
60 s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq, 76 s3c_tgc = irq_alloc_generic_chip("s3c-timer", 1, timer_irq,
61 S3C64XX_TINT_CSTAT, handle_level_irq); 77 S3C64XX_TINT_CSTAT, handle_level_irq);
62 78
diff --git a/arch/arm/plat-samsung/time.c b/arch/arm/plat-samsung/time.c
index e3bb806bbafe..4dcb11c3d894 100644
--- a/arch/arm/plat-samsung/time.c
+++ b/arch/arm/plat-samsung/time.c
@@ -28,7 +28,6 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30 30
31#include <asm/system.h>
32#include <asm/leds.h> 31#include <asm/leds.h>
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
34 33
diff --git a/arch/arm/plat-spear/include/plat/hardware.h b/arch/arm/plat-spear/include/plat/hardware.h
index 66d677225d15..70187d763e26 100644
--- a/arch/arm/plat-spear/include/plat/hardware.h
+++ b/arch/arm/plat-spear/include/plat/hardware.h
@@ -14,10 +14,4 @@
14#ifndef __PLAT_HARDWARE_H 14#ifndef __PLAT_HARDWARE_H
15#define __PLAT_HARDWARE_H 15#define __PLAT_HARDWARE_H
16 16
17#ifndef __ASSEMBLY__
18#define IOMEM(x) ((void __iomem __force *)(x))
19#else
20#define IOMEM(x) (x)
21#endif
22
23#endif /* __PLAT_HARDWARE_H */ 17#endif /* __PLAT_HARDWARE_H */
diff --git a/arch/arm/plat-spear/include/plat/io.h b/arch/arm/plat-spear/include/plat/io.h
deleted file mode 100644
index 4d4ba822b3eb..000000000000
--- a/arch/arm/plat-spear/include/plat/io.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * arch/arm/plat-spear/include/plat/io.h
3 *
4 * IO definitions for SPEAr platform
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_IO_H
15#define __PLAT_IO_H
16
17#define IO_SPACE_LIMIT 0xFFFFFFFF
18
19#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a)
21
22#endif /* __PLAT_IO_H */
diff --git a/arch/arm/plat-spear/include/plat/keyboard.h b/arch/arm/plat-spear/include/plat/keyboard.h
index c16cc31ecbed..0562f134621d 100644
--- a/arch/arm/plat-spear/include/plat/keyboard.h
+++ b/arch/arm/plat-spear/include/plat/keyboard.h
@@ -159,11 +159,4 @@ struct kbd_platform_data {
159 unsigned int mode; 159 unsigned int mode;
160}; 160};
161 161
162/* This function is used to set platform data field of pdev->dev */
163static inline void
164kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data)
165{
166 pdev->dev.platform_data = data;
167}
168
169#endif /* __PLAT_KEYBOARD_H */ 162#endif /* __PLAT_KEYBOARD_H */
diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/plat-spear/restart.c
index 2b4e3d82957c..16f203e78d89 100644
--- a/arch/arm/plat-spear/restart.c
+++ b/arch/arm/plat-spear/restart.c
@@ -11,6 +11,7 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13#include <linux/io.h> 13#include <linux/io.h>
14#include <asm/system_misc.h>
14#include <asm/hardware/sp810.h> 15#include <asm/hardware/sp810.h>
15#include <mach/hardware.h> 16#include <mach/hardware.h>
16#include <mach/generic.h> 17#include <mach/generic.h>
diff --git a/arch/arm/plat-versatile/Kconfig b/arch/arm/plat-versatile/Kconfig
index 52353beb369d..043f7b02a9e7 100644
--- a/arch/arm/plat-versatile/Kconfig
+++ b/arch/arm/plat-versatile/Kconfig
@@ -11,7 +11,6 @@ config PLAT_VERSATILE_LEDS
11 depends on ARCH_REALVIEW || ARCH_VERSATILE 11 depends on ARCH_REALVIEW || ARCH_VERSATILE
12 12
13config PLAT_VERSATILE_SCHED_CLOCK 13config PLAT_VERSATILE_SCHED_CLOCK
14 def_bool y if !ARCH_INTEGRATOR_AP 14 def_bool y
15 select HAVE_SCHED_CLOCK
16 15
17endif 16endif
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 8f3ccddbdafd..858748eaa144 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -18,7 +18,9 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/init.h> 19#include <linux/init.h>
20 20
21#include <asm/cp15.h>
21#include <asm/cputype.h> 22#include <asm/cputype.h>
23#include <asm/system_info.h>
22#include <asm/thread_notify.h> 24#include <asm/thread_notify.h>
23#include <asm/vfp.h> 25#include <asm/vfp.h>
24 26