aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig1
-rw-r--r--arch/alpha/kernel/irq.c13
-rw-r--r--arch/alpha/kernel/irq_alpha.c11
-rw-r--r--arch/alpha/kernel/irq_i8259.c18
-rw-r--r--arch/alpha/kernel/irq_impl.h8
-rw-r--r--arch/alpha/kernel/irq_pyxis.c20
-rw-r--r--arch/alpha/kernel/irq_srm.c16
-rw-r--r--arch/alpha/kernel/sys_alcor.c28
-rw-r--r--arch/alpha/kernel/sys_cabriolet.c16
-rw-r--r--arch/alpha/kernel/sys_dp264.c52
-rw-r--r--arch/alpha/kernel/sys_eb64p.c18
-rw-r--r--arch/alpha/kernel/sys_eiger.c14
-rw-r--r--arch/alpha/kernel/sys_jensen.c24
-rw-r--r--arch/alpha/kernel/sys_marvel.c42
-rw-r--r--arch/alpha/kernel/sys_mikasa.c16
-rw-r--r--arch/alpha/kernel/sys_noritake.c16
-rw-r--r--arch/alpha/kernel/sys_rawhide.c17
-rw-r--r--arch/alpha/kernel/sys_rx164.c16
-rw-r--r--arch/alpha/kernel/sys_sable.c20
-rw-r--r--arch/alpha/kernel/sys_takara.c14
-rw-r--r--arch/alpha/kernel/sys_titan.c21
-rw-r--r--arch/alpha/kernel/sys_wildfire.c32
-rw-r--r--arch/arm/Kconfig145
-rw-r--r--arch/arm/Makefile11
-rw-r--r--arch/arm/boot/Makefile4
-rw-r--r--arch/arm/boot/compressed/.gitignore6
-rw-r--r--arch/arm/boot/compressed/Makefile21
-rw-r--r--arch/arm/boot/compressed/head-shmobile.S30
-rw-r--r--arch/arm/boot/compressed/head-vt8500.S46
-rw-r--r--arch/arm/boot/compressed/head.S251
-rw-r--r--arch/arm/boot/compressed/misc.c2
-rw-r--r--arch/arm/boot/compressed/mmcif-sh7372.c87
-rw-r--r--arch/arm/boot/compressed/vmlinux.lds.in3
-rw-r--r--arch/arm/common/Kconfig2
-rw-r--r--arch/arm/common/gic.c72
-rw-r--r--arch/arm/include/asm/a.out-core.h6
-rw-r--r--arch/arm/include/asm/bitops.h60
-rw-r--r--arch/arm/include/asm/cacheflush.h136
-rw-r--r--arch/arm/include/asm/cpu-multi32.h69
-rw-r--r--arch/arm/include/asm/cpu-single.h44
-rw-r--r--arch/arm/include/asm/cputype.h3
-rw-r--r--arch/arm/include/asm/fncpy.h94
-rw-r--r--arch/arm/include/asm/glue-cache.h146
-rw-r--r--arch/arm/include/asm/glue-df.h110
-rw-r--r--arch/arm/include/asm/glue-pf.h57
-rw-r--r--arch/arm/include/asm/glue-proc.h264
-rw-r--r--arch/arm/include/asm/glue.h138
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h1
-rw-r--r--arch/arm/include/asm/hardware/gic.h1
-rw-r--r--arch/arm/include/asm/hardware/sp810.h3
-rw-r--r--arch/arm/include/asm/highmem.h29
-rw-r--r--arch/arm/include/asm/mach/arch.h4
-rw-r--r--arch/arm/include/asm/mach/irq.h31
-rw-r--r--arch/arm/include/asm/outercache.h1
-rw-r--r--arch/arm/include/asm/pgalloc.h2
-rw-r--r--arch/arm/include/asm/proc-fns.h306
-rw-r--r--arch/arm/include/asm/processor.h14
-rw-r--r--arch/arm/include/asm/ptrace.h2
-rw-r--r--arch/arm/include/asm/smp_scu.h7
-rw-r--r--arch/arm/include/asm/spinlock.h53
-rw-r--r--arch/arm/include/asm/system.h17
-rw-r--r--arch/arm/include/asm/tlb.h105
-rw-r--r--arch/arm/include/asm/tlbflush.h7
-rw-r--r--arch/arm/include/asm/tls.h11
-rw-r--r--arch/arm/include/asm/traps.h1
-rw-r--r--arch/arm/include/asm/user.h2
-rw-r--r--arch/arm/kernel/Makefile1
-rw-r--r--arch/arm/kernel/armksyms.c18
-rw-r--r--arch/arm/kernel/asm-offsets.c11
-rw-r--r--arch/arm/kernel/bios32.c5
-rw-r--r--arch/arm/kernel/debug.S2
-rw-r--r--arch/arm/kernel/entry-armv.S3
-rw-r--r--arch/arm/kernel/entry-header.S14
-rw-r--r--arch/arm/kernel/head.S38
-rw-r--r--arch/arm/kernel/hw_breakpoint.c68
-rw-r--r--arch/arm/kernel/irq.c50
-rw-r--r--arch/arm/kernel/kprobes-decode.c2
-rw-r--r--arch/arm/kernel/module.c32
-rw-r--r--arch/arm/kernel/perf_event.c2
-rw-r--r--arch/arm/kernel/perf_event_v6.c4
-rw-r--r--arch/arm/kernel/pmu.c22
-rw-r--r--arch/arm/kernel/ptrace.c389
-rw-r--r--arch/arm/kernel/ptrace.h37
-rw-r--r--arch/arm/kernel/return_address.c1
-rw-r--r--arch/arm/kernel/setup.c4
-rw-r--r--arch/arm/kernel/signal.c13
-rw-r--r--arch/arm/kernel/sleep.S134
-rw-r--r--arch/arm/kernel/smp_scu.c23
-rw-r--r--arch/arm/kernel/traps.c4
-rw-r--r--arch/arm/kernel/vmlinux.lds.S11
-rw-r--r--arch/arm/lib/bitops.h50
-rw-r--r--arch/arm/lib/changebit.S10
-rw-r--r--arch/arm/lib/clearbit.S11
-rw-r--r--arch/arm/lib/setbit.S11
-rw-r--r--arch/arm/lib/testchangebit.S9
-rw-r--r--arch/arm/lib/testclearbit.S9
-rw-r--r--arch/arm/lib/testsetbit.S9
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c1
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h11
-rw-r--r--arch/arm/mach-davinci/cpufreq.c2
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c7
-rw-r--r--arch/arm/mach-davinci/gpio-tnetv107x.c18
-rw-r--r--arch/arm/mach-davinci/include/mach/clkdev.h2
-rw-r--r--arch/arm/mach-dove/Kconfig2
-rw-r--r--arch/arm/mach-ep93xx/core.c2
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c116
-rw-r--r--arch/arm/mach-ep93xx/gpio.c33
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-footbridge/dc21285-timer.c84
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h21
-rw-r--r--arch/arm/mach-footbridge/include/mach/io.h10
-rw-r--r--arch/arm/mach-footbridge/isa-timer.c129
-rw-r--r--arch/arm/mach-gemini/board-nas4220b.c1
-rw-r--r--arch/arm/mach-gemini/board-rut1xx.c1
-rw-r--r--arch/arm/mach-gemini/board-wbd111.c1
-rw-r--r--arch/arm/mach-gemini/board-wbd222.c1
-rw-r--r--arch/arm/mach-gemini/common.h1
-rw-r--r--arch/arm/mach-gemini/devices.c26
-rw-r--r--arch/arm/mach-imx/mach-mx25_3ds.c2
-rw-r--r--arch/arm/mach-ixp4xx/common.c4
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/timex.h5
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_qmgr.c9
-rw-r--r--arch/arm/mach-mxs/clock-mx23.c4
-rw-r--r--arch/arm/mach-mxs/clock-mx28.c7
-rw-r--r--arch/arm/mach-mxs/clock.c2
-rw-r--r--arch/arm/mach-mxs/gpio.c32
-rw-r--r--arch/arm/mach-mxs/icoll.c16
-rw-r--r--arch/arm/mach-mxs/include/mach/clock.h2
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c24
-rw-r--r--arch/arm/mach-omap1/pm.h6
-rw-r--r--arch/arm/mach-omap1/sleep.S3
-rw-r--r--arch/arm/mach-omap1/sram.S1
-rw-r--r--arch/arm/mach-omap1/time.c1
-rw-r--r--arch/arm/mach-omap2/Kconfig1
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c27
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c2
-rw-r--r--arch/arm/mach-omap2/board-rm680.c3
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c2
-rw-r--r--arch/arm/mach-omap2/mailbox.c12
-rw-r--r--arch/arm/mach-omap2/mux.c3
-rw-r--r--arch/arm/mach-omap2/omap4-common.c7
-rw-r--r--arch/arm/mach-omap2/pm-debug.c8
-rw-r--r--arch/arm/mach-omap2/pm.h2
-rw-r--r--arch/arm/mach-omap2/pm34xx.c7
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h4
-rw-r--r--arch/arm/mach-omap2/sleep24xx.S2
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S2
-rw-r--r--arch/arm/mach-omap2/smartreflex.c48
-rw-r--r--arch/arm/mach-omap2/sram242x.S3
-rw-r--r--arch/arm/mach-omap2/sram243x.S3
-rw-r--r--arch/arm/mach-omap2/sram34xx.S1
-rw-r--r--arch/arm/mach-omap2/timer-gp.c13
-rw-r--r--arch/arm/mach-omap2/voltage.c1
-rw-r--r--arch/arm/mach-pxa/colibri-evalboard.c2
-rw-r--r--arch/arm/mach-pxa/colibri-pxa300.c2
-rw-r--r--arch/arm/mach-pxa/include/mach/colibri.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/pm.h5
-rw-r--r--arch/arm/mach-pxa/palm27x.c2
-rw-r--r--arch/arm/mach-pxa/palmz72.c2
-rw-r--r--arch/arm/mach-pxa/pm.c9
-rw-r--r--arch/arm/mach-pxa/pxa25x.c5
-rw-r--r--arch/arm/mach-pxa/pxa27x.c4
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c7
-rw-r--r--arch/arm/mach-pxa/sleep.S191
-rw-r--r--arch/arm/mach-pxa/tosa-bt.c2
-rw-r--r--arch/arm/mach-pxa/tosa.c6
-rw-r--r--arch/arm/mach-pxa/zeus.c2
-rw-r--r--arch/arm/mach-realview/Kconfig5
-rw-r--r--arch/arm/mach-s3c2440/Kconfig1
-rw-r--r--arch/arm/mach-s3c2440/include/mach/gta02.h26
-rw-r--r--arch/arm/mach-s3c64xx/clock.c6
-rw-r--r--arch/arm/mach-s3c64xx/dma.c11
-rw-r--r--arch/arm/mach-s3c64xx/gpiolib.c4
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c13
-rw-r--r--arch/arm/mach-s3c64xx/setup-keypad.c2
-rw-r--r--arch/arm/mach-s3c64xx/setup-sdhci.c2
-rw-r--r--arch/arm/mach-s3c64xx/sleep.S63
-rw-r--r--arch/arm/mach-s5p6442/include/mach/map.h69
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/gpio.h4
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/map.h83
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h193
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h168
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c15
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c15
-rw-r--r--arch/arm/mach-s5pv210/sleep.S105
-rw-r--r--arch/arm/mach-s5pv310/Kconfig1
-rw-r--r--arch/arm/mach-s5pv310/include/mach/map.h151
-rw-r--r--arch/arm/mach-s5pv310/include/mach/sysmmu.h5
-rw-r--r--arch/arm/mach-sa1100/collie.c3
-rw-r--r--arch/arm/mach-sa1100/pm.c12
-rw-r--r--arch/arm/mach-sa1100/sleep.S72
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c1
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c2
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c2
-rw-r--r--arch/arm/mach-shmobile/clock-sh73a0.c17
-rw-r--r--arch/arm/mach-shmobile/include/mach/head-ap4evb.txt10
-rw-r--r--arch/arm/mach-shmobile/include/mach/head-mackerel.txt10
-rw-r--r--arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h29
-rw-r--r--arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h39
-rw-r--r--arch/arm/mach-shmobile/include/mach/mmcif.h18
-rw-r--r--arch/arm/mach-spear3xx/clock.c479
-rw-r--r--arch/arm/mach-spear3xx/include/mach/entry-macro.S3
-rw-r--r--arch/arm/mach-spear3xx/include/mach/generic.h22
-rw-r--r--arch/arm/mach-spear3xx/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-spear3xx/include/mach/irqs.h4
-rw-r--r--arch/arm/mach-spear3xx/include/mach/misc_regs.h143
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear.h135
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear300.h59
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear310.h34
-rw-r--r--arch/arm/mach-spear3xx/include/mach/spear320.h67
-rw-r--r--arch/arm/mach-spear3xx/spear300.c82
-rw-r--r--arch/arm/mach-spear3xx/spear300_evb.c15
-rw-r--r--arch/arm/mach-spear3xx/spear310.c21
-rw-r--r--arch/arm/mach-spear3xx/spear310_evb.c13
-rw-r--r--arch/arm/mach-spear3xx/spear320.c41
-rw-r--r--arch/arm/mach-spear3xx/spear320_evb.c15
-rw-r--r--arch/arm/mach-spear3xx/spear3xx.c55
-rw-r--r--arch/arm/mach-spear6xx/clock.c356
-rw-r--r--arch/arm/mach-spear6xx/include/mach/entry-macro.S3
-rw-r--r--arch/arm/mach-spear6xx/include/mach/generic.h7
-rw-r--r--arch/arm/mach-spear6xx/include/mach/hardware.h4
-rw-r--r--arch/arm/mach-spear6xx/include/mach/misc_regs.h143
-rw-r--r--arch/arm/mach-spear6xx/include/mach/spear.h175
-rw-r--r--arch/arm/mach-spear6xx/spear600.c2
-rw-r--r--arch/arm/mach-spear6xx/spear600_evb.c4
-rw-r--r--arch/arm/mach-spear6xx/spear6xx.c60
-rw-r--r--arch/arm/mach-tegra/include/mach/kbc.h1
-rw-r--r--arch/arm/mach-ux500/Kconfig1
-rw-r--r--arch/arm/mach-vt8500/Kconfig73
-rw-r--r--arch/arm/mach-vt8500/Makefile9
-rw-r--r--arch/arm/mach-vt8500/Makefile.boot3
-rw-r--r--arch/arm/mach-vt8500/bv07.c77
-rw-r--r--arch/arm/mach-vt8500/devices-vt8500.c91
-rw-r--r--arch/arm/mach-vt8500/devices-wm8505.c99
-rw-r--r--arch/arm/mach-vt8500/devices.c270
-rw-r--r--arch/arm/mach-vt8500/devices.h88
-rw-r--r--arch/arm/mach-vt8500/gpio.c240
-rw-r--r--arch/arm/mach-vt8500/include/mach/debug-macro.S31
-rw-r--r--arch/arm/mach-vt8500/include/mach/entry-macro.S32
-rw-r--r--arch/arm/mach-vt8500/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-vt8500/include/mach/hardware.h12
-rw-r--r--arch/arm/mach-vt8500/include/mach/i8042.h18
-rw-r--r--arch/arm/mach-vt8500/include/mach/io.h28
-rw-r--r--arch/arm/mach-vt8500/include/mach/irqs.h22
-rw-r--r--arch/arm/mach-vt8500/include/mach/memory.h28
-rw-r--r--arch/arm/mach-vt8500/include/mach/system.h18
-rw-r--r--arch/arm/mach-vt8500/include/mach/timex.h26
-rw-r--r--arch/arm/mach-vt8500/include/mach/uncompress.h37
-rw-r--r--arch/arm/mach-vt8500/include/mach/vmalloc.h20
-rw-r--r--arch/arm/mach-vt8500/include/mach/vt8500_irqs.h88
-rw-r--r--arch/arm/mach-vt8500/include/mach/vt8500_regs.h79
-rw-r--r--arch/arm/mach-vt8500/include/mach/vt8500fb.h31
-rw-r--r--arch/arm/mach-vt8500/include/mach/wm8505_irqs.h115
-rw-r--r--arch/arm/mach-vt8500/include/mach/wm8505_regs.h78
-rw-r--r--arch/arm/mach-vt8500/irq.c177
-rw-r--r--arch/arm/mach-vt8500/pwm.c265
-rw-r--r--arch/arm/mach-vt8500/timer.c155
-rw-r--r--arch/arm/mach-vt8500/wm8505_7in.c77
-rw-r--r--arch/arm/mm/Kconfig57
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/abort-ev6.S6
-rw-r--r--arch/arm/mm/cache-l2x0.c38
-rw-r--r--arch/arm/mm/mmap.c2
-rw-r--r--arch/arm/mm/mmu.c10
-rw-r--r--arch/arm/mm/proc-arm1020.S3
-rw-r--r--arch/arm/mm/proc-arm1020e.S3
-rw-r--r--arch/arm/mm/proc-arm1022.S3
-rw-r--r--arch/arm/mm/proc-arm1026.S3
-rw-r--r--arch/arm/mm/proc-arm6_7.S6
-rw-r--r--arch/arm/mm/proc-arm720.S3
-rw-r--r--arch/arm/mm/proc-arm740.S3
-rw-r--r--arch/arm/mm/proc-arm7tdmi.S3
-rw-r--r--arch/arm/mm/proc-arm920.S37
-rw-r--r--arch/arm/mm/proc-arm922.S3
-rw-r--r--arch/arm/mm/proc-arm925.S3
-rw-r--r--arch/arm/mm/proc-arm926.S37
-rw-r--r--arch/arm/mm/proc-arm940.S3
-rw-r--r--arch/arm/mm/proc-arm946.S3
-rw-r--r--arch/arm/mm/proc-arm9tdmi.S3
-rw-r--r--arch/arm/mm/proc-fa526.S3
-rw-r--r--arch/arm/mm/proc-feroceon.S3
-rw-r--r--arch/arm/mm/proc-mohawk.S3
-rw-r--r--arch/arm/mm/proc-sa110.S3
-rw-r--r--arch/arm/mm/proc-sa1100.S39
-rw-r--r--arch/arm/mm/proc-v6.S50
-rw-r--r--arch/arm/mm/proc-v7.S128
-rw-r--r--arch/arm/mm/proc-xsc3.S48
-rw-r--r--arch/arm/mm/proc-xscale.S45
-rw-r--r--arch/arm/mm/vmregion.c17
-rw-r--r--arch/arm/oprofile/common.c14
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h2
-rw-r--r--arch/arm/plat-omap/include/plat/sram.h14
-rw-r--r--arch/arm/plat-omap/mailbox.c11
-rw-r--r--arch/arm/plat-omap/sram.c14
-rw-r--r--arch/arm/plat-pxa/mfp.c8
-rw-r--r--arch/arm/plat-s3c24xx/sleep.S57
-rw-r--r--arch/arm/plat-s5p/Kconfig24
-rw-r--r--arch/arm/plat-s5p/Makefile2
-rw-r--r--arch/arm/plat-s5p/dev-uart.c12
-rw-r--r--arch/arm/plat-s5p/include/plat/sysmmu.h23
-rw-r--r--arch/arm/plat-s5p/sysmmu.c4
-rw-r--r--arch/arm/plat-samsung/dev-ts.c1
-rw-r--r--arch/arm/plat-samsung/dev-uart.c2
-rw-r--r--arch/arm/plat-samsung/include/plat/pm.h14
-rw-r--r--arch/arm/plat-samsung/pm.c16
-rw-r--r--arch/arm/plat-spear/Makefile4
-rw-r--r--arch/arm/plat-spear/clock.c844
-rw-r--r--arch/arm/plat-spear/include/plat/clock.h166
-rw-r--r--arch/arm/plat-spear/include/plat/debug-macro.S2
-rw-r--r--arch/arm/plat-spear/include/plat/hardware.h23
-rw-r--r--arch/arm/plat-spear/include/plat/system.h4
-rw-r--r--arch/arm/plat-spear/include/plat/uncompress.h6
-rw-r--r--arch/arm/plat-spear/include/plat/vmalloc.h2
-rw-r--r--arch/arm/plat-spear/time.c26
-rw-r--r--arch/arm/tools/mach-types105
-rw-r--r--arch/arm/vfp/vfpmodule.c9
-rw-r--r--arch/blackfin/include/asm/bfin_serial.h2
-rw-r--r--arch/blackfin/lib/outs.S16
-rw-r--r--arch/blackfin/mach-common/cache.S2
-rw-r--r--arch/cris/kernel/vmlinux.lds.S5
-rw-r--r--arch/m32r/kernel/irq.c2
-rw-r--r--arch/m68k/include/asm/string.h4
-rw-r--r--arch/m68k/lib/string.c11
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S6
-rw-r--r--arch/m68knommu/lib/Makefile2
-rw-r--r--arch/m68knommu/lib/memmove.c105
-rw-r--r--arch/m68knommu/platform/5249/intc2.c4
-rw-r--r--arch/m68knommu/platform/68328/entry.S1
-rw-r--r--arch/m68knommu/platform/68360/commproc.c2
-rw-r--r--arch/m68knommu/platform/68360/config.c2
-rw-r--r--arch/m68knommu/platform/68360/entry.S1
-rw-r--r--arch/m68knommu/platform/68360/ints.c4
-rw-r--r--arch/m68knommu/platform/coldfire/entry.S1
-rw-r--r--arch/microblaze/include/asm/irqflags.h2
-rw-r--r--arch/microblaze/include/asm/pgtable.h27
-rw-r--r--arch/microblaze/kernel/cpu/pvr.c4
-rw-r--r--arch/microblaze/kernel/head.S29
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S4
-rw-r--r--arch/microblaze/kernel/setup.c4
-rw-r--r--arch/microblaze/lib/fastcopy.S4
-rw-r--r--arch/powerpc/include/asm/machdep.h6
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h8
-rw-r--r--arch/powerpc/include/asm/page.h2
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S40
-rw-r--r--arch/powerpc/kernel/cputable.c4
-rw-r--r--arch/powerpc/kernel/machine_kexec.c5
-rw-r--r--arch/powerpc/kernel/process.c8
-rw-r--r--arch/powerpc/mm/numa.c55
-rw-r--r--arch/powerpc/mm/tlb_hash64.c6
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c37
-rw-r--r--arch/s390/Kconfig2
-rw-r--r--arch/s390/boot/compressed/misc.c5
-rw-r--r--arch/s390/crypto/sha_common.c1
-rw-r--r--arch/s390/include/asm/atomic.h26
-rw-r--r--arch/s390/include/asm/cache.h1
-rw-r--r--arch/s390/include/asm/cacheflush.h23
-rw-r--r--arch/s390/include/asm/processor.h5
-rw-r--r--arch/s390/include/asm/tlb.h1
-rw-r--r--arch/s390/kernel/traps.c37
-rw-r--r--arch/s390/lib/uaccess_std.c10
-rw-r--r--arch/s390/mm/pgtable.c3
-rw-r--r--arch/sh/include/asm/sections.h2
-rw-r--r--arch/sh/kernel/cpu/sh4/setup-sh7750.c13
-rw-r--r--arch/sh/lib/delay.c10
-rw-r--r--arch/sh/mm/cache.c3
-rw-r--r--arch/sparc/include/asm/pcr.h2
-rw-r--r--arch/sparc/kernel/iommu.c5
-rw-r--r--arch/sparc/kernel/pcr.c2
-rw-r--r--arch/sparc/kernel/smp_64.c2
-rw-r--r--arch/sparc/kernel/una_asm_32.S4
-rw-r--r--arch/sparc/lib/bitext.c5
-rw-r--r--arch/x86/include/asm/acpi.h1
-rw-r--r--arch/x86/include/asm/apic.h1
-rw-r--r--arch/x86/include/asm/cpu.h2
-rw-r--r--arch/x86/include/asm/mmu_context.h5
-rw-r--r--arch/x86/include/asm/msr-index.h5
-rw-r--r--arch/x86/include/asm/perf_event_p4.h1
-rw-r--r--arch/x86/include/asm/smp.h5
-rw-r--r--arch/x86/include/asm/smpboot_hooks.h2
-rw-r--r--arch/x86/kernel/acpi/boot.c14
-rw-r--r--arch/x86/kernel/acpi/sleep.c15
-rw-r--r--arch/x86/kernel/alternative.c2
-rw-r--r--arch/x86/kernel/apb_timer.c2
-rw-r--r--arch/x86/kernel/apic/apic.c9
-rw-r--r--arch/x86/kernel/apic/io_apic.c3
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c13
-rw-r--r--arch/x86/kernel/cpu/mtrr/main.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c23
-rw-r--r--arch/x86/kernel/early-quirks.c16
-rw-r--r--arch/x86/kernel/head_32.S30
-rw-r--r--arch/x86/kernel/irq.c3
-rw-r--r--arch/x86/kernel/process.c24
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kernel/smpboot.c8
-rw-r--r--arch/x86/kvm/svm.c4
-rw-r--r--arch/x86/mm/pageattr.c8
-rw-r--r--arch/x86/platform/olpc/olpc_dt.c3
398 files changed, 8694 insertions, 4296 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 47f63d480141..cc31bec2e316 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -11,6 +11,7 @@ config ALPHA
11 select HAVE_GENERIC_HARDIRQS 11 select HAVE_GENERIC_HARDIRQS
12 select GENERIC_IRQ_PROBE 12 select GENERIC_IRQ_PROBE
13 select AUTO_IRQ_AFFINITY if SMP 13 select AUTO_IRQ_AFFINITY if SMP
14 select GENERIC_HARDIRQS_NO_DEPRECATED
14 help 15 help
15 The Alpha is a 64-bit general-purpose processor designed and 16 The Alpha is a 64-bit general-purpose processor designed and
16 marketed by the Digital Equipment Corporation of blessed memory, 17 marketed by the Digital Equipment Corporation of blessed memory,
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index 9ab234f48dd8..a19d60082299 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -44,11 +44,16 @@ static char irq_user_affinity[NR_IRQS];
44 44
45int irq_select_affinity(unsigned int irq) 45int irq_select_affinity(unsigned int irq)
46{ 46{
47 struct irq_desc *desc = irq_to_desc[irq]; 47 struct irq_data *data = irq_get_irq_data(irq);
48 struct irq_chip *chip;
48 static int last_cpu; 49 static int last_cpu;
49 int cpu = last_cpu + 1; 50 int cpu = last_cpu + 1;
50 51
51 if (!desc || !get_irq_desc_chip(desc)->set_affinity || irq_user_affinity[irq]) 52 if (!data)
53 return 1;
54 chip = irq_data_get_irq_chip(data);
55
56 if (!chip->irq_set_affinity || irq_user_affinity[irq])
52 return 1; 57 return 1;
53 58
54 while (!cpu_possible(cpu) || 59 while (!cpu_possible(cpu) ||
@@ -56,8 +61,8 @@ int irq_select_affinity(unsigned int irq)
56 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); 61 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0);
57 last_cpu = cpu; 62 last_cpu = cpu;
58 63
59 cpumask_copy(desc->affinity, cpumask_of(cpu)); 64 cpumask_copy(data->affinity, cpumask_of(cpu));
60 get_irq_desc_chip(desc)->set_affinity(irq, cpumask_of(cpu)); 65 chip->irq_set_affinity(data, cpumask_of(cpu), false);
61 return 0; 66 return 0;
62} 67}
63#endif /* CONFIG_SMP */ 68#endif /* CONFIG_SMP */
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c
index 2d0679b60939..411ca11d0a18 100644
--- a/arch/alpha/kernel/irq_alpha.c
+++ b/arch/alpha/kernel/irq_alpha.c
@@ -228,14 +228,9 @@ struct irqaction timer_irqaction = {
228void __init 228void __init
229init_rtc_irq(void) 229init_rtc_irq(void)
230{ 230{
231 struct irq_desc *desc = irq_to_desc(RTC_IRQ); 231 set_irq_chip_and_handler_name(RTC_IRQ, &no_irq_chip,
232 232 handle_simple_irq, "RTC");
233 if (desc) { 233 setup_irq(RTC_IRQ, &timer_irqaction);
234 desc->status |= IRQ_DISABLED;
235 set_irq_chip_and_handler_name(RTC_IRQ, &no_irq_chip,
236 handle_simple_irq, "RTC");
237 setup_irq(RTC_IRQ, &timer_irqaction);
238 }
239} 234}
240 235
241/* Dummy irqactions. */ 236/* Dummy irqactions. */
diff --git a/arch/alpha/kernel/irq_i8259.c b/arch/alpha/kernel/irq_i8259.c
index 956ea0ed1694..c7cc9813e45f 100644
--- a/arch/alpha/kernel/irq_i8259.c
+++ b/arch/alpha/kernel/irq_i8259.c
@@ -33,10 +33,10 @@ i8259_update_irq_hw(unsigned int irq, unsigned long mask)
33} 33}
34 34
35inline void 35inline void
36i8259a_enable_irq(unsigned int irq) 36i8259a_enable_irq(struct irq_data *d)
37{ 37{
38 spin_lock(&i8259_irq_lock); 38 spin_lock(&i8259_irq_lock);
39 i8259_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq)); 39 i8259_update_irq_hw(d->irq, cached_irq_mask &= ~(1 << d->irq));
40 spin_unlock(&i8259_irq_lock); 40 spin_unlock(&i8259_irq_lock);
41} 41}
42 42
@@ -47,16 +47,18 @@ __i8259a_disable_irq(unsigned int irq)
47} 47}
48 48
49void 49void
50i8259a_disable_irq(unsigned int irq) 50i8259a_disable_irq(struct irq_data *d)
51{ 51{
52 spin_lock(&i8259_irq_lock); 52 spin_lock(&i8259_irq_lock);
53 __i8259a_disable_irq(irq); 53 __i8259a_disable_irq(d->irq);
54 spin_unlock(&i8259_irq_lock); 54 spin_unlock(&i8259_irq_lock);
55} 55}
56 56
57void 57void
58i8259a_mask_and_ack_irq(unsigned int irq) 58i8259a_mask_and_ack_irq(struct irq_data *d)
59{ 59{
60 unsigned int irq = d->irq;
61
60 spin_lock(&i8259_irq_lock); 62 spin_lock(&i8259_irq_lock);
61 __i8259a_disable_irq(irq); 63 __i8259a_disable_irq(irq);
62 64
@@ -71,9 +73,9 @@ i8259a_mask_and_ack_irq(unsigned int irq)
71 73
72struct irq_chip i8259a_irq_type = { 74struct irq_chip i8259a_irq_type = {
73 .name = "XT-PIC", 75 .name = "XT-PIC",
74 .unmask = i8259a_enable_irq, 76 .irq_unmask = i8259a_enable_irq,
75 .mask = i8259a_disable_irq, 77 .irq_mask = i8259a_disable_irq,
76 .mask_ack = i8259a_mask_and_ack_irq, 78 .irq_mask_ack = i8259a_mask_and_ack_irq,
77}; 79};
78 80
79void __init 81void __init
diff --git a/arch/alpha/kernel/irq_impl.h b/arch/alpha/kernel/irq_impl.h
index b63ccd7386f1..d507a234b05d 100644
--- a/arch/alpha/kernel/irq_impl.h
+++ b/arch/alpha/kernel/irq_impl.h
@@ -31,11 +31,9 @@ extern void init_rtc_irq(void);
31 31
32extern void common_init_isa_dma(void); 32extern void common_init_isa_dma(void);
33 33
34extern void i8259a_enable_irq(unsigned int); 34extern void i8259a_enable_irq(struct irq_data *d);
35extern void i8259a_disable_irq(unsigned int); 35extern void i8259a_disable_irq(struct irq_data *d);
36extern void i8259a_mask_and_ack_irq(unsigned int); 36extern void i8259a_mask_and_ack_irq(struct irq_data *d);
37extern unsigned int i8259a_startup_irq(unsigned int);
38extern void i8259a_end_irq(unsigned int);
39extern struct irq_chip i8259a_irq_type; 37extern struct irq_chip i8259a_irq_type;
40extern void init_i8259a_irqs(void); 38extern void init_i8259a_irqs(void);
41 39
diff --git a/arch/alpha/kernel/irq_pyxis.c b/arch/alpha/kernel/irq_pyxis.c
index 2863458c853e..b30227fa7f5f 100644
--- a/arch/alpha/kernel/irq_pyxis.c
+++ b/arch/alpha/kernel/irq_pyxis.c
@@ -29,21 +29,21 @@ pyxis_update_irq_hw(unsigned long mask)
29} 29}
30 30
31static inline void 31static inline void
32pyxis_enable_irq(unsigned int irq) 32pyxis_enable_irq(struct irq_data *d)
33{ 33{
34 pyxis_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16)); 34 pyxis_update_irq_hw(cached_irq_mask |= 1UL << (d->irq - 16));
35} 35}
36 36
37static void 37static void
38pyxis_disable_irq(unsigned int irq) 38pyxis_disable_irq(struct irq_data *d)
39{ 39{
40 pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16))); 40 pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (d->irq - 16)));
41} 41}
42 42
43static void 43static void
44pyxis_mask_and_ack_irq(unsigned int irq) 44pyxis_mask_and_ack_irq(struct irq_data *d)
45{ 45{
46 unsigned long bit = 1UL << (irq - 16); 46 unsigned long bit = 1UL << (d->irq - 16);
47 unsigned long mask = cached_irq_mask &= ~bit; 47 unsigned long mask = cached_irq_mask &= ~bit;
48 48
49 /* Disable the interrupt. */ 49 /* Disable the interrupt. */
@@ -58,9 +58,9 @@ pyxis_mask_and_ack_irq(unsigned int irq)
58 58
59static struct irq_chip pyxis_irq_type = { 59static struct irq_chip pyxis_irq_type = {
60 .name = "PYXIS", 60 .name = "PYXIS",
61 .mask_ack = pyxis_mask_and_ack_irq, 61 .irq_mask_ack = pyxis_mask_and_ack_irq,
62 .mask = pyxis_disable_irq, 62 .irq_mask = pyxis_disable_irq,
63 .unmask = pyxis_enable_irq, 63 .irq_unmask = pyxis_enable_irq,
64}; 64};
65 65
66void 66void
@@ -103,7 +103,7 @@ init_pyxis_irqs(unsigned long ignore_mask)
103 if ((ignore_mask >> i) & 1) 103 if ((ignore_mask >> i) & 1)
104 continue; 104 continue;
105 set_irq_chip_and_handler(i, &pyxis_irq_type, handle_level_irq); 105 set_irq_chip_and_handler(i, &pyxis_irq_type, handle_level_irq);
106 irq_to_desc(i)->status |= IRQ_LEVEL; 106 irq_set_status_flags(i, IRQ_LEVEL);
107 } 107 }
108 108
109 setup_irq(16+7, &isa_cascade_irqaction); 109 setup_irq(16+7, &isa_cascade_irqaction);
diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c
index 0e57e828b413..82a47bba41c4 100644
--- a/arch/alpha/kernel/irq_srm.c
+++ b/arch/alpha/kernel/irq_srm.c
@@ -18,27 +18,27 @@
18DEFINE_SPINLOCK(srm_irq_lock); 18DEFINE_SPINLOCK(srm_irq_lock);
19 19
20static inline void 20static inline void
21srm_enable_irq(unsigned int irq) 21srm_enable_irq(struct irq_data *d)
22{ 22{
23 spin_lock(&srm_irq_lock); 23 spin_lock(&srm_irq_lock);
24 cserve_ena(irq - 16); 24 cserve_ena(d->irq - 16);
25 spin_unlock(&srm_irq_lock); 25 spin_unlock(&srm_irq_lock);
26} 26}
27 27
28static void 28static void
29srm_disable_irq(unsigned int irq) 29srm_disable_irq(struct irq_data *d)
30{ 30{
31 spin_lock(&srm_irq_lock); 31 spin_lock(&srm_irq_lock);
32 cserve_dis(irq - 16); 32 cserve_dis(d->irq - 16);
33 spin_unlock(&srm_irq_lock); 33 spin_unlock(&srm_irq_lock);
34} 34}
35 35
36/* Handle interrupts from the SRM, assuming no additional weirdness. */ 36/* Handle interrupts from the SRM, assuming no additional weirdness. */
37static struct irq_chip srm_irq_type = { 37static struct irq_chip srm_irq_type = {
38 .name = "SRM", 38 .name = "SRM",
39 .unmask = srm_enable_irq, 39 .irq_unmask = srm_enable_irq,
40 .mask = srm_disable_irq, 40 .irq_mask = srm_disable_irq,
41 .mask_ack = srm_disable_irq, 41 .irq_mask_ack = srm_disable_irq,
42}; 42};
43 43
44void __init 44void __init
@@ -52,7 +52,7 @@ init_srm_irqs(long max, unsigned long ignore_mask)
52 if (i < 64 && ((ignore_mask >> i) & 1)) 52 if (i < 64 && ((ignore_mask >> i) & 1))
53 continue; 53 continue;
54 set_irq_chip_and_handler(i, &srm_irq_type, handle_level_irq); 54 set_irq_chip_and_handler(i, &srm_irq_type, handle_level_irq);
55 irq_to_desc(i)->status |= IRQ_LEVEL; 55 irq_set_status_flags(i, IRQ_LEVEL);
56 } 56 }
57} 57}
58 58
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index 7bef61768236..88d95e872f55 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -44,31 +44,31 @@ alcor_update_irq_hw(unsigned long mask)
44} 44}
45 45
46static inline void 46static inline void
47alcor_enable_irq(unsigned int irq) 47alcor_enable_irq(struct irq_data *d)
48{ 48{
49 alcor_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16)); 49 alcor_update_irq_hw(cached_irq_mask |= 1UL << (d->irq - 16));
50} 50}
51 51
52static void 52static void
53alcor_disable_irq(unsigned int irq) 53alcor_disable_irq(struct irq_data *d)
54{ 54{
55 alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16))); 55 alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (d->irq - 16)));
56} 56}
57 57
58static void 58static void
59alcor_mask_and_ack_irq(unsigned int irq) 59alcor_mask_and_ack_irq(struct irq_data *d)
60{ 60{
61 alcor_disable_irq(irq); 61 alcor_disable_irq(d);
62 62
63 /* On ALCOR/XLT, need to dismiss interrupt via GRU. */ 63 /* On ALCOR/XLT, need to dismiss interrupt via GRU. */
64 *(vuip)GRU_INT_CLEAR = 1 << (irq - 16); mb(); 64 *(vuip)GRU_INT_CLEAR = 1 << (d->irq - 16); mb();
65 *(vuip)GRU_INT_CLEAR = 0; mb(); 65 *(vuip)GRU_INT_CLEAR = 0; mb();
66} 66}
67 67
68static void 68static void
69alcor_isa_mask_and_ack_irq(unsigned int irq) 69alcor_isa_mask_and_ack_irq(struct irq_data *d)
70{ 70{
71 i8259a_mask_and_ack_irq(irq); 71 i8259a_mask_and_ack_irq(d);
72 72
73 /* On ALCOR/XLT, need to dismiss interrupt via GRU. */ 73 /* On ALCOR/XLT, need to dismiss interrupt via GRU. */
74 *(vuip)GRU_INT_CLEAR = 0x80000000; mb(); 74 *(vuip)GRU_INT_CLEAR = 0x80000000; mb();
@@ -77,9 +77,9 @@ alcor_isa_mask_and_ack_irq(unsigned int irq)
77 77
78static struct irq_chip alcor_irq_type = { 78static struct irq_chip alcor_irq_type = {
79 .name = "ALCOR", 79 .name = "ALCOR",
80 .unmask = alcor_enable_irq, 80 .irq_unmask = alcor_enable_irq,
81 .mask = alcor_disable_irq, 81 .irq_mask = alcor_disable_irq,
82 .mask_ack = alcor_mask_and_ack_irq, 82 .irq_mask_ack = alcor_mask_and_ack_irq,
83}; 83};
84 84
85static void 85static void
@@ -126,9 +126,9 @@ alcor_init_irq(void)
126 if (i >= 16+20 && i <= 16+30) 126 if (i >= 16+20 && i <= 16+30)
127 continue; 127 continue;
128 set_irq_chip_and_handler(i, &alcor_irq_type, handle_level_irq); 128 set_irq_chip_and_handler(i, &alcor_irq_type, handle_level_irq);
129 irq_to_desc(i)->status |= IRQ_LEVEL; 129 irq_set_status_flags(i, IRQ_LEVEL);
130 } 130 }
131 i8259a_irq_type.ack = alcor_isa_mask_and_ack_irq; 131 i8259a_irq_type.irq_ack = alcor_isa_mask_and_ack_irq;
132 132
133 init_i8259a_irqs(); 133 init_i8259a_irqs();
134 common_init_isa_dma(); 134 common_init_isa_dma();
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c
index b0c916493aea..57eb6307bc27 100644
--- a/arch/alpha/kernel/sys_cabriolet.c
+++ b/arch/alpha/kernel/sys_cabriolet.c
@@ -46,22 +46,22 @@ cabriolet_update_irq_hw(unsigned int irq, unsigned long mask)
46} 46}
47 47
48static inline void 48static inline void
49cabriolet_enable_irq(unsigned int irq) 49cabriolet_enable_irq(struct irq_data *d)
50{ 50{
51 cabriolet_update_irq_hw(irq, cached_irq_mask &= ~(1UL << irq)); 51 cabriolet_update_irq_hw(d->irq, cached_irq_mask &= ~(1UL << d->irq));
52} 52}
53 53
54static void 54static void
55cabriolet_disable_irq(unsigned int irq) 55cabriolet_disable_irq(struct irq_data *d)
56{ 56{
57 cabriolet_update_irq_hw(irq, cached_irq_mask |= 1UL << irq); 57 cabriolet_update_irq_hw(d->irq, cached_irq_mask |= 1UL << d->irq);
58} 58}
59 59
60static struct irq_chip cabriolet_irq_type = { 60static struct irq_chip cabriolet_irq_type = {
61 .name = "CABRIOLET", 61 .name = "CABRIOLET",
62 .unmask = cabriolet_enable_irq, 62 .irq_unmask = cabriolet_enable_irq,
63 .mask = cabriolet_disable_irq, 63 .irq_mask = cabriolet_disable_irq,
64 .mask_ack = cabriolet_disable_irq, 64 .irq_mask_ack = cabriolet_disable_irq,
65}; 65};
66 66
67static void 67static void
@@ -107,7 +107,7 @@ common_init_irq(void (*srm_dev_int)(unsigned long v))
107 for (i = 16; i < 35; ++i) { 107 for (i = 16; i < 35; ++i) {
108 set_irq_chip_and_handler(i, &cabriolet_irq_type, 108 set_irq_chip_and_handler(i, &cabriolet_irq_type,
109 handle_level_irq); 109 handle_level_irq);
110 irq_to_desc(i)->status |= IRQ_LEVEL; 110 irq_set_status_flags(i, IRQ_LEVEL);
111 } 111 }
112 } 112 }
113 113
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c
index edad5f759ccd..481df4ecb651 100644
--- a/arch/alpha/kernel/sys_dp264.c
+++ b/arch/alpha/kernel/sys_dp264.c
@@ -98,37 +98,37 @@ tsunami_update_irq_hw(unsigned long mask)
98} 98}
99 99
100static void 100static void
101dp264_enable_irq(unsigned int irq) 101dp264_enable_irq(struct irq_data *d)
102{ 102{
103 spin_lock(&dp264_irq_lock); 103 spin_lock(&dp264_irq_lock);
104 cached_irq_mask |= 1UL << irq; 104 cached_irq_mask |= 1UL << d->irq;
105 tsunami_update_irq_hw(cached_irq_mask); 105 tsunami_update_irq_hw(cached_irq_mask);
106 spin_unlock(&dp264_irq_lock); 106 spin_unlock(&dp264_irq_lock);
107} 107}
108 108
109static void 109static void
110dp264_disable_irq(unsigned int irq) 110dp264_disable_irq(struct irq_data *d)
111{ 111{
112 spin_lock(&dp264_irq_lock); 112 spin_lock(&dp264_irq_lock);
113 cached_irq_mask &= ~(1UL << irq); 113 cached_irq_mask &= ~(1UL << d->irq);
114 tsunami_update_irq_hw(cached_irq_mask); 114 tsunami_update_irq_hw(cached_irq_mask);
115 spin_unlock(&dp264_irq_lock); 115 spin_unlock(&dp264_irq_lock);
116} 116}
117 117
118static void 118static void
119clipper_enable_irq(unsigned int irq) 119clipper_enable_irq(struct irq_data *d)
120{ 120{
121 spin_lock(&dp264_irq_lock); 121 spin_lock(&dp264_irq_lock);
122 cached_irq_mask |= 1UL << (irq - 16); 122 cached_irq_mask |= 1UL << (d->irq - 16);
123 tsunami_update_irq_hw(cached_irq_mask); 123 tsunami_update_irq_hw(cached_irq_mask);
124 spin_unlock(&dp264_irq_lock); 124 spin_unlock(&dp264_irq_lock);
125} 125}
126 126
127static void 127static void
128clipper_disable_irq(unsigned int irq) 128clipper_disable_irq(struct irq_data *d)
129{ 129{
130 spin_lock(&dp264_irq_lock); 130 spin_lock(&dp264_irq_lock);
131 cached_irq_mask &= ~(1UL << (irq - 16)); 131 cached_irq_mask &= ~(1UL << (d->irq - 16));
132 tsunami_update_irq_hw(cached_irq_mask); 132 tsunami_update_irq_hw(cached_irq_mask);
133 spin_unlock(&dp264_irq_lock); 133 spin_unlock(&dp264_irq_lock);
134} 134}
@@ -149,10 +149,11 @@ cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity)
149} 149}
150 150
151static int 151static int
152dp264_set_affinity(unsigned int irq, const struct cpumask *affinity) 152dp264_set_affinity(struct irq_data *d, const struct cpumask *affinity,
153{ 153 bool force)
154{
154 spin_lock(&dp264_irq_lock); 155 spin_lock(&dp264_irq_lock);
155 cpu_set_irq_affinity(irq, *affinity); 156 cpu_set_irq_affinity(d->irq, *affinity);
156 tsunami_update_irq_hw(cached_irq_mask); 157 tsunami_update_irq_hw(cached_irq_mask);
157 spin_unlock(&dp264_irq_lock); 158 spin_unlock(&dp264_irq_lock);
158 159
@@ -160,10 +161,11 @@ dp264_set_affinity(unsigned int irq, const struct cpumask *affinity)
160} 161}
161 162
162static int 163static int
163clipper_set_affinity(unsigned int irq, const struct cpumask *affinity) 164clipper_set_affinity(struct irq_data *d, const struct cpumask *affinity,
164{ 165 bool force)
166{
165 spin_lock(&dp264_irq_lock); 167 spin_lock(&dp264_irq_lock);
166 cpu_set_irq_affinity(irq - 16, *affinity); 168 cpu_set_irq_affinity(d->irq - 16, *affinity);
167 tsunami_update_irq_hw(cached_irq_mask); 169 tsunami_update_irq_hw(cached_irq_mask);
168 spin_unlock(&dp264_irq_lock); 170 spin_unlock(&dp264_irq_lock);
169 171
@@ -171,19 +173,19 @@ clipper_set_affinity(unsigned int irq, const struct cpumask *affinity)
171} 173}
172 174
173static struct irq_chip dp264_irq_type = { 175static struct irq_chip dp264_irq_type = {
174 .name = "DP264", 176 .name = "DP264",
175 .unmask = dp264_enable_irq, 177 .irq_unmask = dp264_enable_irq,
176 .mask = dp264_disable_irq, 178 .irq_mask = dp264_disable_irq,
177 .mask_ack = dp264_disable_irq, 179 .irq_mask_ack = dp264_disable_irq,
178 .set_affinity = dp264_set_affinity, 180 .irq_set_affinity = dp264_set_affinity,
179}; 181};
180 182
181static struct irq_chip clipper_irq_type = { 183static struct irq_chip clipper_irq_type = {
182 .name = "CLIPPER", 184 .name = "CLIPPER",
183 .unmask = clipper_enable_irq, 185 .irq_unmask = clipper_enable_irq,
184 .mask = clipper_disable_irq, 186 .irq_mask = clipper_disable_irq,
185 .mask_ack = clipper_disable_irq, 187 .irq_mask_ack = clipper_disable_irq,
186 .set_affinity = clipper_set_affinity, 188 .irq_set_affinity = clipper_set_affinity,
187}; 189};
188 190
189static void 191static void
@@ -268,8 +270,8 @@ init_tsunami_irqs(struct irq_chip * ops, int imin, int imax)
268{ 270{
269 long i; 271 long i;
270 for (i = imin; i <= imax; ++i) { 272 for (i = imin; i <= imax; ++i) {
271 irq_to_desc(i)->status |= IRQ_LEVEL;
272 set_irq_chip_and_handler(i, ops, handle_level_irq); 273 set_irq_chip_and_handler(i, ops, handle_level_irq);
274 irq_set_status_flags(i, IRQ_LEVEL);
273 } 275 }
274} 276}
275 277
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c
index ae5f29d127b0..402e908ffb3e 100644
--- a/arch/alpha/kernel/sys_eb64p.c
+++ b/arch/alpha/kernel/sys_eb64p.c
@@ -44,22 +44,22 @@ eb64p_update_irq_hw(unsigned int irq, unsigned long mask)
44} 44}
45 45
46static inline void 46static inline void
47eb64p_enable_irq(unsigned int irq) 47eb64p_enable_irq(struct irq_data *d)
48{ 48{
49 eb64p_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq)); 49 eb64p_update_irq_hw(d->irq, cached_irq_mask &= ~(1 << d->irq));
50} 50}
51 51
52static void 52static void
53eb64p_disable_irq(unsigned int irq) 53eb64p_disable_irq(struct irq_data *d)
54{ 54{
55 eb64p_update_irq_hw(irq, cached_irq_mask |= 1 << irq); 55 eb64p_update_irq_hw(d->irq, cached_irq_mask |= 1 << d->irq);
56} 56}
57 57
58static struct irq_chip eb64p_irq_type = { 58static struct irq_chip eb64p_irq_type = {
59 .name = "EB64P", 59 .name = "EB64P",
60 .unmask = eb64p_enable_irq, 60 .irq_unmask = eb64p_enable_irq,
61 .mask = eb64p_disable_irq, 61 .irq_mask = eb64p_disable_irq,
62 .mask_ack = eb64p_disable_irq, 62 .irq_mask_ack = eb64p_disable_irq,
63}; 63};
64 64
65static void 65static void
@@ -118,9 +118,9 @@ eb64p_init_irq(void)
118 init_i8259a_irqs(); 118 init_i8259a_irqs();
119 119
120 for (i = 16; i < 32; ++i) { 120 for (i = 16; i < 32; ++i) {
121 irq_to_desc(i)->status |= IRQ_LEVEL;
122 set_irq_chip_and_handler(i, &eb64p_irq_type, handle_level_irq); 121 set_irq_chip_and_handler(i, &eb64p_irq_type, handle_level_irq);
123 } 122 irq_set_status_flags(i, IRQ_LEVEL);
123 }
124 124
125 common_init_isa_dma(); 125 common_init_isa_dma();
126 setup_irq(16+5, &isa_cascade_irqaction); 126 setup_irq(16+5, &isa_cascade_irqaction);
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c
index 1121bc5c6c6c..0b44a54c1522 100644
--- a/arch/alpha/kernel/sys_eiger.c
+++ b/arch/alpha/kernel/sys_eiger.c
@@ -51,16 +51,18 @@ eiger_update_irq_hw(unsigned long irq, unsigned long mask)
51} 51}
52 52
53static inline void 53static inline void
54eiger_enable_irq(unsigned int irq) 54eiger_enable_irq(struct irq_data *d)
55{ 55{
56 unsigned int irq = d->irq;
56 unsigned long mask; 57 unsigned long mask;
57 mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63))); 58 mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63)));
58 eiger_update_irq_hw(irq, mask); 59 eiger_update_irq_hw(irq, mask);
59} 60}
60 61
61static void 62static void
62eiger_disable_irq(unsigned int irq) 63eiger_disable_irq(struct irq_data *d)
63{ 64{
65 unsigned int irq = d->irq;
64 unsigned long mask; 66 unsigned long mask;
65 mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63)); 67 mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63));
66 eiger_update_irq_hw(irq, mask); 68 eiger_update_irq_hw(irq, mask);
@@ -68,9 +70,9 @@ eiger_disable_irq(unsigned int irq)
68 70
69static struct irq_chip eiger_irq_type = { 71static struct irq_chip eiger_irq_type = {
70 .name = "EIGER", 72 .name = "EIGER",
71 .unmask = eiger_enable_irq, 73 .irq_unmask = eiger_enable_irq,
72 .mask = eiger_disable_irq, 74 .irq_mask = eiger_disable_irq,
73 .mask_ack = eiger_disable_irq, 75 .irq_mask_ack = eiger_disable_irq,
74}; 76};
75 77
76static void 78static void
@@ -136,8 +138,8 @@ eiger_init_irq(void)
136 init_i8259a_irqs(); 138 init_i8259a_irqs();
137 139
138 for (i = 16; i < 128; ++i) { 140 for (i = 16; i < 128; ++i) {
139 irq_to_desc(i)->status |= IRQ_LEVEL;
140 set_irq_chip_and_handler(i, &eiger_irq_type, handle_level_irq); 141 set_irq_chip_and_handler(i, &eiger_irq_type, handle_level_irq);
142 irq_set_status_flags(i, IRQ_LEVEL);
141 } 143 }
142} 144}
143 145
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c
index 34f55e03d331..00341b75c8b2 100644
--- a/arch/alpha/kernel/sys_jensen.c
+++ b/arch/alpha/kernel/sys_jensen.c
@@ -63,34 +63,34 @@
63 */ 63 */
64 64
65static void 65static void
66jensen_local_enable(unsigned int irq) 66jensen_local_enable(struct irq_data *d)
67{ 67{
68 /* the parport is really hw IRQ 1, silly Jensen. */ 68 /* the parport is really hw IRQ 1, silly Jensen. */
69 if (irq == 7) 69 if (d->irq == 7)
70 i8259a_enable_irq(1); 70 i8259a_enable_irq(d);
71} 71}
72 72
73static void 73static void
74jensen_local_disable(unsigned int irq) 74jensen_local_disable(struct irq_data *d)
75{ 75{
76 /* the parport is really hw IRQ 1, silly Jensen. */ 76 /* the parport is really hw IRQ 1, silly Jensen. */
77 if (irq == 7) 77 if (d->irq == 7)
78 i8259a_disable_irq(1); 78 i8259a_disable_irq(d);
79} 79}
80 80
81static void 81static void
82jensen_local_mask_ack(unsigned int irq) 82jensen_local_mask_ack(struct irq_data *d)
83{ 83{
84 /* the parport is really hw IRQ 1, silly Jensen. */ 84 /* the parport is really hw IRQ 1, silly Jensen. */
85 if (irq == 7) 85 if (d->irq == 7)
86 i8259a_mask_and_ack_irq(1); 86 i8259a_mask_and_ack_irq(d);
87} 87}
88 88
89static struct irq_chip jensen_local_irq_type = { 89static struct irq_chip jensen_local_irq_type = {
90 .name = "LOCAL", 90 .name = "LOCAL",
91 .unmask = jensen_local_enable, 91 .irq_unmask = jensen_local_enable,
92 .mask = jensen_local_disable, 92 .irq_mask = jensen_local_disable,
93 .mask_ack = jensen_local_mask_ack, 93 .irq_mask_ack = jensen_local_mask_ack,
94}; 94};
95 95
96static void 96static void
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c
index 2bfc9f1b1ddc..e61910734e41 100644
--- a/arch/alpha/kernel/sys_marvel.c
+++ b/arch/alpha/kernel/sys_marvel.c
@@ -104,9 +104,10 @@ io7_get_irq_ctl(unsigned int irq, struct io7 **pio7)
104} 104}
105 105
106static void 106static void
107io7_enable_irq(unsigned int irq) 107io7_enable_irq(struct irq_data *d)
108{ 108{
109 volatile unsigned long *ctl; 109 volatile unsigned long *ctl;
110 unsigned int irq = d->irq;
110 struct io7 *io7; 111 struct io7 *io7;
111 112
112 ctl = io7_get_irq_ctl(irq, &io7); 113 ctl = io7_get_irq_ctl(irq, &io7);
@@ -115,7 +116,7 @@ io7_enable_irq(unsigned int irq)
115 __func__, irq); 116 __func__, irq);
116 return; 117 return;
117 } 118 }
118 119
119 spin_lock(&io7->irq_lock); 120 spin_lock(&io7->irq_lock);
120 *ctl |= 1UL << 24; 121 *ctl |= 1UL << 24;
121 mb(); 122 mb();
@@ -124,9 +125,10 @@ io7_enable_irq(unsigned int irq)
124} 125}
125 126
126static void 127static void
127io7_disable_irq(unsigned int irq) 128io7_disable_irq(struct irq_data *d)
128{ 129{
129 volatile unsigned long *ctl; 130 volatile unsigned long *ctl;
131 unsigned int irq = d->irq;
130 struct io7 *io7; 132 struct io7 *io7;
131 133
132 ctl = io7_get_irq_ctl(irq, &io7); 134 ctl = io7_get_irq_ctl(irq, &io7);
@@ -135,7 +137,7 @@ io7_disable_irq(unsigned int irq)
135 __func__, irq); 137 __func__, irq);
136 return; 138 return;
137 } 139 }
138 140
139 spin_lock(&io7->irq_lock); 141 spin_lock(&io7->irq_lock);
140 *ctl &= ~(1UL << 24); 142 *ctl &= ~(1UL << 24);
141 mb(); 143 mb();
@@ -144,35 +146,29 @@ io7_disable_irq(unsigned int irq)
144} 146}
145 147
146static void 148static void
147marvel_irq_noop(unsigned int irq) 149marvel_irq_noop(struct irq_data *d)
148{ 150{
149 return; 151 return;
150}
151
152static unsigned int
153marvel_irq_noop_return(unsigned int irq)
154{
155 return 0;
156} 152}
157 153
158static struct irq_chip marvel_legacy_irq_type = { 154static struct irq_chip marvel_legacy_irq_type = {
159 .name = "LEGACY", 155 .name = "LEGACY",
160 .mask = marvel_irq_noop, 156 .irq_mask = marvel_irq_noop,
161 .unmask = marvel_irq_noop, 157 .irq_unmask = marvel_irq_noop,
162}; 158};
163 159
164static struct irq_chip io7_lsi_irq_type = { 160static struct irq_chip io7_lsi_irq_type = {
165 .name = "LSI", 161 .name = "LSI",
166 .unmask = io7_enable_irq, 162 .irq_unmask = io7_enable_irq,
167 .mask = io7_disable_irq, 163 .irq_mask = io7_disable_irq,
168 .mask_ack = io7_disable_irq, 164 .irq_mask_ack = io7_disable_irq,
169}; 165};
170 166
171static struct irq_chip io7_msi_irq_type = { 167static struct irq_chip io7_msi_irq_type = {
172 .name = "MSI", 168 .name = "MSI",
173 .unmask = io7_enable_irq, 169 .irq_unmask = io7_enable_irq,
174 .mask = io7_disable_irq, 170 .irq_mask = io7_disable_irq,
175 .ack = marvel_irq_noop, 171 .irq_ack = marvel_irq_noop,
176}; 172};
177 173
178static void 174static void
@@ -280,8 +276,8 @@ init_io7_irqs(struct io7 *io7,
280 276
281 /* Set up the lsi irqs. */ 277 /* Set up the lsi irqs. */
282 for (i = 0; i < 128; ++i) { 278 for (i = 0; i < 128; ++i) {
283 irq_to_desc(base + i)->status |= IRQ_LEVEL;
284 set_irq_chip_and_handler(base + i, lsi_ops, handle_level_irq); 279 set_irq_chip_and_handler(base + i, lsi_ops, handle_level_irq);
280 irq_set_status_flags(i, IRQ_LEVEL);
285 } 281 }
286 282
287 /* Disable the implemented irqs in hardware. */ 283 /* Disable the implemented irqs in hardware. */
@@ -294,8 +290,8 @@ init_io7_irqs(struct io7 *io7,
294 290
295 /* Set up the msi irqs. */ 291 /* Set up the msi irqs. */
296 for (i = 128; i < (128 + 512); ++i) { 292 for (i = 128; i < (128 + 512); ++i) {
297 irq_to_desc(base + i)->status |= IRQ_LEVEL;
298 set_irq_chip_and_handler(base + i, msi_ops, handle_level_irq); 293 set_irq_chip_and_handler(base + i, msi_ops, handle_level_irq);
294 irq_set_status_flags(i, IRQ_LEVEL);
299 } 295 }
300 296
301 for (i = 0; i < 16; ++i) 297 for (i = 0; i < 16; ++i)
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c
index bcc1639e8efb..cf7f43dd3147 100644
--- a/arch/alpha/kernel/sys_mikasa.c
+++ b/arch/alpha/kernel/sys_mikasa.c
@@ -43,22 +43,22 @@ mikasa_update_irq_hw(int mask)
43} 43}
44 44
45static inline void 45static inline void
46mikasa_enable_irq(unsigned int irq) 46mikasa_enable_irq(struct irq_data *d)
47{ 47{
48 mikasa_update_irq_hw(cached_irq_mask |= 1 << (irq - 16)); 48 mikasa_update_irq_hw(cached_irq_mask |= 1 << (d->irq - 16));
49} 49}
50 50
51static void 51static void
52mikasa_disable_irq(unsigned int irq) 52mikasa_disable_irq(struct irq_data *d)
53{ 53{
54 mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (irq - 16))); 54 mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (d->irq - 16)));
55} 55}
56 56
57static struct irq_chip mikasa_irq_type = { 57static struct irq_chip mikasa_irq_type = {
58 .name = "MIKASA", 58 .name = "MIKASA",
59 .unmask = mikasa_enable_irq, 59 .irq_unmask = mikasa_enable_irq,
60 .mask = mikasa_disable_irq, 60 .irq_mask = mikasa_disable_irq,
61 .mask_ack = mikasa_disable_irq, 61 .irq_mask_ack = mikasa_disable_irq,
62}; 62};
63 63
64static void 64static void
@@ -98,8 +98,8 @@ mikasa_init_irq(void)
98 mikasa_update_irq_hw(0); 98 mikasa_update_irq_hw(0);
99 99
100 for (i = 16; i < 32; ++i) { 100 for (i = 16; i < 32; ++i) {
101 irq_to_desc(i)->status |= IRQ_LEVEL;
102 set_irq_chip_and_handler(i, &mikasa_irq_type, handle_level_irq); 101 set_irq_chip_and_handler(i, &mikasa_irq_type, handle_level_irq);
102 irq_set_status_flags(i, IRQ_LEVEL);
103 } 103 }
104 104
105 init_i8259a_irqs(); 105 init_i8259a_irqs();
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c
index e88f4ae1260e..92bc188e94a9 100644
--- a/arch/alpha/kernel/sys_noritake.c
+++ b/arch/alpha/kernel/sys_noritake.c
@@ -48,22 +48,22 @@ noritake_update_irq_hw(int irq, int mask)
48} 48}
49 49
50static void 50static void
51noritake_enable_irq(unsigned int irq) 51noritake_enable_irq(struct irq_data *d)
52{ 52{
53 noritake_update_irq_hw(irq, cached_irq_mask |= 1 << (irq - 16)); 53 noritake_update_irq_hw(d->irq, cached_irq_mask |= 1 << (d->irq - 16));
54} 54}
55 55
56static void 56static void
57noritake_disable_irq(unsigned int irq) 57noritake_disable_irq(struct irq_data *d)
58{ 58{
59 noritake_update_irq_hw(irq, cached_irq_mask &= ~(1 << (irq - 16))); 59 noritake_update_irq_hw(d->irq, cached_irq_mask &= ~(1 << (d->irq - 16)));
60} 60}
61 61
62static struct irq_chip noritake_irq_type = { 62static struct irq_chip noritake_irq_type = {
63 .name = "NORITAKE", 63 .name = "NORITAKE",
64 .unmask = noritake_enable_irq, 64 .irq_unmask = noritake_enable_irq,
65 .mask = noritake_disable_irq, 65 .irq_mask = noritake_disable_irq,
66 .mask_ack = noritake_disable_irq, 66 .irq_mask_ack = noritake_disable_irq,
67}; 67};
68 68
69static void 69static void
@@ -127,8 +127,8 @@ noritake_init_irq(void)
127 outw(0, 0x54c); 127 outw(0, 0x54c);
128 128
129 for (i = 16; i < 48; ++i) { 129 for (i = 16; i < 48; ++i) {
130 irq_to_desc(i)->status |= IRQ_LEVEL;
131 set_irq_chip_and_handler(i, &noritake_irq_type, handle_level_irq); 130 set_irq_chip_and_handler(i, &noritake_irq_type, handle_level_irq);
131 irq_set_status_flags(i, IRQ_LEVEL);
132 } 132 }
133 133
134 init_i8259a_irqs(); 134 init_i8259a_irqs();
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c
index 6a51364dd1cc..936d4140ed5f 100644
--- a/arch/alpha/kernel/sys_rawhide.c
+++ b/arch/alpha/kernel/sys_rawhide.c
@@ -56,9 +56,10 @@ rawhide_update_irq_hw(int hose, int mask)
56 (((h) < MCPCIA_MAX_HOSES) && (cached_irq_masks[(h)] != 0)) 56 (((h) < MCPCIA_MAX_HOSES) && (cached_irq_masks[(h)] != 0))
57 57
58static inline void 58static inline void
59rawhide_enable_irq(unsigned int irq) 59rawhide_enable_irq(struct irq_data *d)
60{ 60{
61 unsigned int mask, hose; 61 unsigned int mask, hose;
62 unsigned int irq = d->irq;
62 63
63 irq -= 16; 64 irq -= 16;
64 hose = irq / 24; 65 hose = irq / 24;
@@ -76,9 +77,10 @@ rawhide_enable_irq(unsigned int irq)
76} 77}
77 78
78static void 79static void
79rawhide_disable_irq(unsigned int irq) 80rawhide_disable_irq(struct irq_data *d)
80{ 81{
81 unsigned int mask, hose; 82 unsigned int mask, hose;
83 unsigned int irq = d->irq;
82 84
83 irq -= 16; 85 irq -= 16;
84 hose = irq / 24; 86 hose = irq / 24;
@@ -96,9 +98,10 @@ rawhide_disable_irq(unsigned int irq)
96} 98}
97 99
98static void 100static void
99rawhide_mask_and_ack_irq(unsigned int irq) 101rawhide_mask_and_ack_irq(struct irq_data *d)
100{ 102{
101 unsigned int mask, mask1, hose; 103 unsigned int mask, mask1, hose;
104 unsigned int irq = d->irq;
102 105
103 irq -= 16; 106 irq -= 16;
104 hose = irq / 24; 107 hose = irq / 24;
@@ -123,9 +126,9 @@ rawhide_mask_and_ack_irq(unsigned int irq)
123 126
124static struct irq_chip rawhide_irq_type = { 127static struct irq_chip rawhide_irq_type = {
125 .name = "RAWHIDE", 128 .name = "RAWHIDE",
126 .unmask = rawhide_enable_irq, 129 .irq_unmask = rawhide_enable_irq,
127 .mask = rawhide_disable_irq, 130 .irq_mask = rawhide_disable_irq,
128 .mask_ack = rawhide_mask_and_ack_irq, 131 .irq_mask_ack = rawhide_mask_and_ack_irq,
129}; 132};
130 133
131static void 134static void
@@ -177,8 +180,8 @@ rawhide_init_irq(void)
177 } 180 }
178 181
179 for (i = 16; i < 128; ++i) { 182 for (i = 16; i < 128; ++i) {
180 irq_to_desc(i)->status |= IRQ_LEVEL;
181 set_irq_chip_and_handler(i, &rawhide_irq_type, handle_level_irq); 183 set_irq_chip_and_handler(i, &rawhide_irq_type, handle_level_irq);
184 irq_set_status_flags(i, IRQ_LEVEL);
182 } 185 }
183 186
184 init_i8259a_irqs(); 187 init_i8259a_irqs();
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c
index 89e7e37ec84c..cea22a62913b 100644
--- a/arch/alpha/kernel/sys_rx164.c
+++ b/arch/alpha/kernel/sys_rx164.c
@@ -47,22 +47,22 @@ rx164_update_irq_hw(unsigned long mask)
47} 47}
48 48
49static inline void 49static inline void
50rx164_enable_irq(unsigned int irq) 50rx164_enable_irq(struct irq_data *d)
51{ 51{
52 rx164_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16)); 52 rx164_update_irq_hw(cached_irq_mask |= 1UL << (d->irq - 16));
53} 53}
54 54
55static void 55static void
56rx164_disable_irq(unsigned int irq) 56rx164_disable_irq(struct irq_data *d)
57{ 57{
58 rx164_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16))); 58 rx164_update_irq_hw(cached_irq_mask &= ~(1UL << (d->irq - 16)));
59} 59}
60 60
61static struct irq_chip rx164_irq_type = { 61static struct irq_chip rx164_irq_type = {
62 .name = "RX164", 62 .name = "RX164",
63 .unmask = rx164_enable_irq, 63 .irq_unmask = rx164_enable_irq,
64 .mask = rx164_disable_irq, 64 .irq_mask = rx164_disable_irq,
65 .mask_ack = rx164_disable_irq, 65 .irq_mask_ack = rx164_disable_irq,
66}; 66};
67 67
68static void 68static void
@@ -99,8 +99,8 @@ rx164_init_irq(void)
99 99
100 rx164_update_irq_hw(0); 100 rx164_update_irq_hw(0);
101 for (i = 16; i < 40; ++i) { 101 for (i = 16; i < 40; ++i) {
102 irq_to_desc(i)->status |= IRQ_LEVEL;
103 set_irq_chip_and_handler(i, &rx164_irq_type, handle_level_irq); 102 set_irq_chip_and_handler(i, &rx164_irq_type, handle_level_irq);
103 irq_set_status_flags(i, IRQ_LEVEL);
104 } 104 }
105 105
106 init_i8259a_irqs(); 106 init_i8259a_irqs();
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c
index 5c4423d1b06c..a349538aabc9 100644
--- a/arch/alpha/kernel/sys_sable.c
+++ b/arch/alpha/kernel/sys_sable.c
@@ -443,11 +443,11 @@ lynx_swizzle(struct pci_dev *dev, u8 *pinp)
443/* GENERIC irq routines */ 443/* GENERIC irq routines */
444 444
445static inline void 445static inline void
446sable_lynx_enable_irq(unsigned int irq) 446sable_lynx_enable_irq(struct irq_data *d)
447{ 447{
448 unsigned long bit, mask; 448 unsigned long bit, mask;
449 449
450 bit = sable_lynx_irq_swizzle->irq_to_mask[irq]; 450 bit = sable_lynx_irq_swizzle->irq_to_mask[d->irq];
451 spin_lock(&sable_lynx_irq_lock); 451 spin_lock(&sable_lynx_irq_lock);
452 mask = sable_lynx_irq_swizzle->shadow_mask &= ~(1UL << bit); 452 mask = sable_lynx_irq_swizzle->shadow_mask &= ~(1UL << bit);
453 sable_lynx_irq_swizzle->update_irq_hw(bit, mask); 453 sable_lynx_irq_swizzle->update_irq_hw(bit, mask);
@@ -459,11 +459,11 @@ sable_lynx_enable_irq(unsigned int irq)
459} 459}
460 460
461static void 461static void
462sable_lynx_disable_irq(unsigned int irq) 462sable_lynx_disable_irq(struct irq_data *d)
463{ 463{
464 unsigned long bit, mask; 464 unsigned long bit, mask;
465 465
466 bit = sable_lynx_irq_swizzle->irq_to_mask[irq]; 466 bit = sable_lynx_irq_swizzle->irq_to_mask[d->irq];
467 spin_lock(&sable_lynx_irq_lock); 467 spin_lock(&sable_lynx_irq_lock);
468 mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit; 468 mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit;
469 sable_lynx_irq_swizzle->update_irq_hw(bit, mask); 469 sable_lynx_irq_swizzle->update_irq_hw(bit, mask);
@@ -475,11 +475,11 @@ sable_lynx_disable_irq(unsigned int irq)
475} 475}
476 476
477static void 477static void
478sable_lynx_mask_and_ack_irq(unsigned int irq) 478sable_lynx_mask_and_ack_irq(struct irq_data *d)
479{ 479{
480 unsigned long bit, mask; 480 unsigned long bit, mask;
481 481
482 bit = sable_lynx_irq_swizzle->irq_to_mask[irq]; 482 bit = sable_lynx_irq_swizzle->irq_to_mask[d->irq];
483 spin_lock(&sable_lynx_irq_lock); 483 spin_lock(&sable_lynx_irq_lock);
484 mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit; 484 mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit;
485 sable_lynx_irq_swizzle->update_irq_hw(bit, mask); 485 sable_lynx_irq_swizzle->update_irq_hw(bit, mask);
@@ -489,9 +489,9 @@ sable_lynx_mask_and_ack_irq(unsigned int irq)
489 489
490static struct irq_chip sable_lynx_irq_type = { 490static struct irq_chip sable_lynx_irq_type = {
491 .name = "SABLE/LYNX", 491 .name = "SABLE/LYNX",
492 .unmask = sable_lynx_enable_irq, 492 .irq_unmask = sable_lynx_enable_irq,
493 .mask = sable_lynx_disable_irq, 493 .irq_mask = sable_lynx_disable_irq,
494 .mask_ack = sable_lynx_mask_and_ack_irq, 494 .irq_mask_ack = sable_lynx_mask_and_ack_irq,
495}; 495};
496 496
497static void 497static void
@@ -518,9 +518,9 @@ sable_lynx_init_irq(int nr_of_irqs)
518 long i; 518 long i;
519 519
520 for (i = 0; i < nr_of_irqs; ++i) { 520 for (i = 0; i < nr_of_irqs; ++i) {
521 irq_to_desc(i)->status |= IRQ_LEVEL;
522 set_irq_chip_and_handler(i, &sable_lynx_irq_type, 521 set_irq_chip_and_handler(i, &sable_lynx_irq_type,
523 handle_level_irq); 522 handle_level_irq);
523 irq_set_status_flags(i, IRQ_LEVEL);
524 } 524 }
525 525
526 common_init_isa_dma(); 526 common_init_isa_dma();
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c
index f8a1e8a862fb..42a5331f13c4 100644
--- a/arch/alpha/kernel/sys_takara.c
+++ b/arch/alpha/kernel/sys_takara.c
@@ -45,16 +45,18 @@ takara_update_irq_hw(unsigned long irq, unsigned long mask)
45} 45}
46 46
47static inline void 47static inline void
48takara_enable_irq(unsigned int irq) 48takara_enable_irq(struct irq_data *d)
49{ 49{
50 unsigned int irq = d->irq;
50 unsigned long mask; 51 unsigned long mask;
51 mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63))); 52 mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63)));
52 takara_update_irq_hw(irq, mask); 53 takara_update_irq_hw(irq, mask);
53} 54}
54 55
55static void 56static void
56takara_disable_irq(unsigned int irq) 57takara_disable_irq(struct irq_data *d)
57{ 58{
59 unsigned int irq = d->irq;
58 unsigned long mask; 60 unsigned long mask;
59 mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63)); 61 mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63));
60 takara_update_irq_hw(irq, mask); 62 takara_update_irq_hw(irq, mask);
@@ -62,9 +64,9 @@ takara_disable_irq(unsigned int irq)
62 64
63static struct irq_chip takara_irq_type = { 65static struct irq_chip takara_irq_type = {
64 .name = "TAKARA", 66 .name = "TAKARA",
65 .unmask = takara_enable_irq, 67 .irq_unmask = takara_enable_irq,
66 .mask = takara_disable_irq, 68 .irq_mask = takara_disable_irq,
67 .mask_ack = takara_disable_irq, 69 .irq_mask_ack = takara_disable_irq,
68}; 70};
69 71
70static void 72static void
@@ -136,8 +138,8 @@ takara_init_irq(void)
136 takara_update_irq_hw(i, -1); 138 takara_update_irq_hw(i, -1);
137 139
138 for (i = 16; i < 128; ++i) { 140 for (i = 16; i < 128; ++i) {
139 irq_to_desc(i)->status |= IRQ_LEVEL;
140 set_irq_chip_and_handler(i, &takara_irq_type, handle_level_irq); 141 set_irq_chip_and_handler(i, &takara_irq_type, handle_level_irq);
142 irq_set_status_flags(i, IRQ_LEVEL);
141 } 143 }
142 144
143 common_init_isa_dma(); 145 common_init_isa_dma();
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
index e02494bf5ef3..f6c108a3d673 100644
--- a/arch/alpha/kernel/sys_titan.c
+++ b/arch/alpha/kernel/sys_titan.c
@@ -112,8 +112,9 @@ titan_update_irq_hw(unsigned long mask)
112} 112}
113 113
114static inline void 114static inline void
115titan_enable_irq(unsigned int irq) 115titan_enable_irq(struct irq_data *d)
116{ 116{
117 unsigned int irq = d->irq;
117 spin_lock(&titan_irq_lock); 118 spin_lock(&titan_irq_lock);
118 titan_cached_irq_mask |= 1UL << (irq - 16); 119 titan_cached_irq_mask |= 1UL << (irq - 16);
119 titan_update_irq_hw(titan_cached_irq_mask); 120 titan_update_irq_hw(titan_cached_irq_mask);
@@ -121,8 +122,9 @@ titan_enable_irq(unsigned int irq)
121} 122}
122 123
123static inline void 124static inline void
124titan_disable_irq(unsigned int irq) 125titan_disable_irq(struct irq_data *d)
125{ 126{
127 unsigned int irq = d->irq;
126 spin_lock(&titan_irq_lock); 128 spin_lock(&titan_irq_lock);
127 titan_cached_irq_mask &= ~(1UL << (irq - 16)); 129 titan_cached_irq_mask &= ~(1UL << (irq - 16));
128 titan_update_irq_hw(titan_cached_irq_mask); 130 titan_update_irq_hw(titan_cached_irq_mask);
@@ -144,7 +146,8 @@ titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity)
144} 146}
145 147
146static int 148static int
147titan_set_irq_affinity(unsigned int irq, const struct cpumask *affinity) 149titan_set_irq_affinity(struct irq_data *d, const struct cpumask *affinity,
150 bool force)
148{ 151{
149 spin_lock(&titan_irq_lock); 152 spin_lock(&titan_irq_lock);
150 titan_cpu_set_irq_affinity(irq - 16, *affinity); 153 titan_cpu_set_irq_affinity(irq - 16, *affinity);
@@ -175,17 +178,17 @@ init_titan_irqs(struct irq_chip * ops, int imin, int imax)
175{ 178{
176 long i; 179 long i;
177 for (i = imin; i <= imax; ++i) { 180 for (i = imin; i <= imax; ++i) {
178 irq_to_desc(i)->status |= IRQ_LEVEL;
179 set_irq_chip_and_handler(i, ops, handle_level_irq); 181 set_irq_chip_and_handler(i, ops, handle_level_irq);
182 irq_set_status_flags(i, IRQ_LEVEL);
180 } 183 }
181} 184}
182 185
183static struct irq_chip titan_irq_type = { 186static struct irq_chip titan_irq_type = {
184 .name = "TITAN", 187 .name = "TITAN",
185 .unmask = titan_enable_irq, 188 .irq_unmask = titan_enable_irq,
186 .mask = titan_disable_irq, 189 .irq_mask = titan_disable_irq,
187 .mask_ack = titan_disable_irq, 190 .irq_mask_ack = titan_disable_irq,
188 .set_affinity = titan_set_irq_affinity, 191 .irq_set_affinity = titan_set_irq_affinity,
189}; 192};
190 193
191static irqreturn_t 194static irqreturn_t
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c
index eec52594d410..ca60a387ef0a 100644
--- a/arch/alpha/kernel/sys_wildfire.c
+++ b/arch/alpha/kernel/sys_wildfire.c
@@ -104,10 +104,12 @@ wildfire_init_irq_hw(void)
104} 104}
105 105
106static void 106static void
107wildfire_enable_irq(unsigned int irq) 107wildfire_enable_irq(struct irq_data *d)
108{ 108{
109 unsigned int irq = d->irq;
110
109 if (irq < 16) 111 if (irq < 16)
110 i8259a_enable_irq(irq); 112 i8259a_enable_irq(d);
111 113
112 spin_lock(&wildfire_irq_lock); 114 spin_lock(&wildfire_irq_lock);
113 set_bit(irq, &cached_irq_mask); 115 set_bit(irq, &cached_irq_mask);
@@ -116,10 +118,12 @@ wildfire_enable_irq(unsigned int irq)
116} 118}
117 119
118static void 120static void
119wildfire_disable_irq(unsigned int irq) 121wildfire_disable_irq(struct irq_data *d)
120{ 122{
123 unsigned int irq = d->irq;
124
121 if (irq < 16) 125 if (irq < 16)
122 i8259a_disable_irq(irq); 126 i8259a_disable_irq(d);
123 127
124 spin_lock(&wildfire_irq_lock); 128 spin_lock(&wildfire_irq_lock);
125 clear_bit(irq, &cached_irq_mask); 129 clear_bit(irq, &cached_irq_mask);
@@ -128,10 +132,12 @@ wildfire_disable_irq(unsigned int irq)
128} 132}
129 133
130static void 134static void
131wildfire_mask_and_ack_irq(unsigned int irq) 135wildfire_mask_and_ack_irq(struct irq_data *d)
132{ 136{
137 unsigned int irq = d->irq;
138
133 if (irq < 16) 139 if (irq < 16)
134 i8259a_mask_and_ack_irq(irq); 140 i8259a_mask_and_ack_irq(d);
135 141
136 spin_lock(&wildfire_irq_lock); 142 spin_lock(&wildfire_irq_lock);
137 clear_bit(irq, &cached_irq_mask); 143 clear_bit(irq, &cached_irq_mask);
@@ -141,9 +147,9 @@ wildfire_mask_and_ack_irq(unsigned int irq)
141 147
142static struct irq_chip wildfire_irq_type = { 148static struct irq_chip wildfire_irq_type = {
143 .name = "WILDFIRE", 149 .name = "WILDFIRE",
144 .unmask = wildfire_enable_irq, 150 .irq_unmask = wildfire_enable_irq,
145 .mask = wildfire_disable_irq, 151 .irq_mask = wildfire_disable_irq,
146 .mask_ack = wildfire_mask_and_ack_irq, 152 .irq_mask_ack = wildfire_mask_and_ack_irq,
147}; 153};
148 154
149static void __init 155static void __init
@@ -177,21 +183,21 @@ wildfire_init_irq_per_pca(int qbbno, int pcano)
177 for (i = 0; i < 16; ++i) { 183 for (i = 0; i < 16; ++i) {
178 if (i == 2) 184 if (i == 2)
179 continue; 185 continue;
180 irq_to_desc(i+irq_bias)->status |= IRQ_LEVEL;
181 set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, 186 set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type,
182 handle_level_irq); 187 handle_level_irq);
188 irq_set_status_flags(i + irq_bias, IRQ_LEVEL);
183 } 189 }
184 190
185 irq_to_desc(36+irq_bias)->status |= IRQ_LEVEL;
186 set_irq_chip_and_handler(36+irq_bias, &wildfire_irq_type, 191 set_irq_chip_and_handler(36+irq_bias, &wildfire_irq_type,
187 handle_level_irq); 192 handle_level_irq);
193 irq_set_status_flags(36 + irq_bias, IRQ_LEVEL);
188 for (i = 40; i < 64; ++i) { 194 for (i = 40; i < 64; ++i) {
189 irq_to_desc(i+irq_bias)->status |= IRQ_LEVEL;
190 set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, 195 set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type,
191 handle_level_irq); 196 handle_level_irq);
197 irq_set_status_flags(i + irq_bias, IRQ_LEVEL);
192 } 198 }
193 199
194 setup_irq(32+irq_bias, &isa_enable); 200 setup_irq(32+irq_bias, &isa_enable);
195} 201}
196 202
197static void __init 203static void __init
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0233c8ff1f19..48a0628d93e8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,7 +7,7 @@ config ARM
7 select HAVE_MEMBLOCK 7 select HAVE_MEMBLOCK
8 select RTC_LIB 8 select RTC_LIB
9 select SYS_SUPPORTS_APM_EMULATION 9 select SYS_SUPPORTS_APM_EMULATION
10 select GENERIC_ATOMIC64 if (!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_KGDB 12 select HAVE_ARCH_KGDB
13 select HAVE_KPROBES if (!XIP_KERNEL && !THUMB2_KERNEL) 13 select HAVE_KPROBES if (!XIP_KERNEL && !THUMB2_KERNEL)
@@ -24,7 +24,7 @@ config ARM
24 select HAVE_PERF_EVENTS 24 select HAVE_PERF_EVENTS
25 select PERF_USE_VMALLOC 25 select PERF_USE_VMALLOC
26 select HAVE_REGS_AND_STACK_ACCESS_API 26 select HAVE_REGS_AND_STACK_ACCESS_API
27 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7)) 27 select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7))
28 select HAVE_C_RECORDMCOUNT 28 select HAVE_C_RECORDMCOUNT
29 select HAVE_GENERIC_HARDIRQS 29 select HAVE_GENERIC_HARDIRQS
30 select HAVE_SPARSE_IRQ 30 select HAVE_SPARSE_IRQ
@@ -63,6 +63,10 @@ config GENERIC_CLOCKEVENTS_BROADCAST
63 depends on GENERIC_CLOCKEVENTS 63 depends on GENERIC_CLOCKEVENTS
64 default y if SMP 64 default y if SMP
65 65
66config KTIME_SCALAR
67 bool
68 default y
69
66config HAVE_TCM 70config HAVE_TCM
67 bool 71 bool
68 select GENERIC_ALLOCATOR 72 select GENERIC_ALLOCATOR
@@ -178,11 +182,6 @@ config FIQ
178config ARCH_MTD_XIP 182config ARCH_MTD_XIP
179 bool 183 bool
180 184
181config ARM_L1_CACHE_SHIFT_6
182 bool
183 help
184 Setting ARM L1 cache line size to 64 Bytes.
185
186config VECTORS_BASE 185config VECTORS_BASE
187 hex 186 hex
188 default 0xffff0000 if MMU || CPU_HIGH_VECTOR 187 default 0xffff0000 if MMU || CPU_HIGH_VECTOR
@@ -362,7 +361,7 @@ config ARCH_FOOTBRIDGE
362 bool "FootBridge" 361 bool "FootBridge"
363 select CPU_SA110 362 select CPU_SA110
364 select FOOTBRIDGE 363 select FOOTBRIDGE
365 select ARCH_USES_GETTIMEOFFSET 364 select GENERIC_CLOCKEVENTS
366 help 365 help
367 Support for systems based on the DC21285 companion chip 366 Support for systems based on the DC21285 companion chip
368 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder. 367 ("FootBridge"), such as the Simtec CATS and the Rebel NetWinder.
@@ -473,6 +472,7 @@ config ARCH_IXP4XX
473 472
474config ARCH_DOVE 473config ARCH_DOVE
475 bool "Marvell Dove" 474 bool "Marvell Dove"
475 select CPU_V6K
476 select PCI 476 select PCI
477 select ARCH_REQUIRE_GPIOLIB 477 select ARCH_REQUIRE_GPIOLIB
478 select GENERIC_CLOCKEVENTS 478 select GENERIC_CLOCKEVENTS
@@ -891,6 +891,16 @@ config PLAT_SPEAR
891 help 891 help
892 Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx). 892 Support for ST's SPEAr platform (SPEAr3xx, SPEAr6xx and SPEAr13xx).
893 893
894config ARCH_VT8500
895 bool "VIA/WonderMedia 85xx"
896 select CPU_ARM926T
897 select GENERIC_GPIO
898 select ARCH_HAS_CPUFREQ
899 select GENERIC_CLOCKEVENTS
900 select ARCH_REQUIRE_GPIOLIB
901 select HAVE_PWM
902 help
903 Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
894endchoice 904endchoice
895 905
896# 906#
@@ -1023,6 +1033,8 @@ source "arch/arm/mach-versatile/Kconfig"
1023 1033
1024source "arch/arm/mach-vexpress/Kconfig" 1034source "arch/arm/mach-vexpress/Kconfig"
1025 1035
1036source "arch/arm/mach-vt8500/Kconfig"
1037
1026source "arch/arm/mach-w90x900/Kconfig" 1038source "arch/arm/mach-w90x900/Kconfig"
1027 1039
1028# Definitions to make life easier 1040# Definitions to make life easier
@@ -1064,7 +1076,7 @@ config XSCALE_PMU
1064 default y 1076 default y
1065 1077
1066config CPU_HAS_PMU 1078config CPU_HAS_PMU
1067 depends on (CPU_V6 || CPU_V7 || XSCALE_PMU) && \ 1079 depends on (CPU_V6 || CPU_V6K || CPU_V7 || XSCALE_PMU) && \
1068 (!ARCH_OMAP3 || OMAP3_EMU) 1080 (!ARCH_OMAP3 || OMAP3_EMU)
1069 default y 1081 default y
1070 bool 1082 bool
@@ -1080,7 +1092,7 @@ endif
1080 1092
1081config ARM_ERRATA_411920 1093config ARM_ERRATA_411920
1082 bool "ARM errata: Invalidation of the Instruction Cache operation can fail" 1094 bool "ARM errata: Invalidation of the Instruction Cache operation can fail"
1083 depends on CPU_V6 1095 depends on CPU_V6 || CPU_V6K
1084 help 1096 help
1085 Invalidation of the Instruction Cache operation can 1097 Invalidation of the Instruction Cache operation can
1086 fail. This erratum is present in 1136 (before r1p4), 1156 and 1176. 1098 fail. This erratum is present in 1136 (before r1p4), 1156 and 1176.
@@ -1156,7 +1168,7 @@ config ARM_ERRATA_742231
1156 1168
1157config PL310_ERRATA_588369 1169config PL310_ERRATA_588369
1158 bool "Clean & Invalidate maintenance operations do not invalidate clean lines" 1170 bool "Clean & Invalidate maintenance operations do not invalidate clean lines"
1159 depends on CACHE_L2X0 && ARCH_OMAP4 1171 depends on CACHE_L2X0
1160 help 1172 help
1161 The PL310 L2 cache controller implements three types of Clean & 1173 The PL310 L2 cache controller implements three types of Clean &
1162 Invalidate maintenance operations: by Physical Address 1174 Invalidate maintenance operations: by Physical Address
@@ -1165,8 +1177,7 @@ config PL310_ERRATA_588369
1165 clean operation followed immediately by an invalidate operation, 1177 clean operation followed immediately by an invalidate operation,
1166 both performing to the same memory location. This functionality 1178 both performing to the same memory location. This functionality
1167 is not correctly implemented in PL310 as clean lines are not 1179 is not correctly implemented in PL310 as clean lines are not
1168 invalidated as a result of these operations. Note that this errata 1180 invalidated as a result of these operations.
1169 uses Texas Instrument's secure monitor api.
1170 1181
1171config ARM_ERRATA_720789 1182config ARM_ERRATA_720789
1172 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID" 1183 bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID"
@@ -1180,6 +1191,17 @@ config ARM_ERRATA_720789
1180 tables. The workaround changes the TLB flushing routines to invalidate 1191 tables. The workaround changes the TLB flushing routines to invalidate
1181 entries regardless of the ASID. 1192 entries regardless of the ASID.
1182 1193
1194config PL310_ERRATA_727915
1195 bool "Background Clean & Invalidate by Way operation can cause data corruption"
1196 depends on CACHE_L2X0
1197 help
1198 PL310 implements the Clean & Invalidate by Way L2 cache maintenance
1199 operation (offset 0x7FC). This operation runs in background so that
1200 PL310 can handle normal accesses while it is in progress. Under very
1201 rare circumstances, due to this erratum, write data can be lost when
1202 PL310 treats a cacheable write transaction during a Clean &
1203 Invalidate by Way operation.
1204
1183config ARM_ERRATA_743622 1205config ARM_ERRATA_743622
1184 bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption" 1206 bool "ARM errata: Faulty hazard checking in the Store Buffer may lead to data corruption"
1185 depends on CPU_V7 1207 depends on CPU_V7
@@ -1193,6 +1215,53 @@ config ARM_ERRATA_743622
1193 visible impact on the overall performance or power consumption of the 1215 visible impact on the overall performance or power consumption of the
1194 processor. 1216 processor.
1195 1217
1218config ARM_ERRATA_751472
1219 bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation"
1220 depends on CPU_V7 && SMP
1221 help
1222 This option enables the workaround for the 751472 Cortex-A9 (prior
1223 to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the
1224 completion of a following broadcasted operation if the second
1225 operation is received by a CPU before the ICIALLUIS has completed,
1226 potentially leading to corrupted entries in the cache or TLB.
1227
1228config ARM_ERRATA_753970
1229 bool "ARM errata: cache sync operation may be faulty"
1230 depends on CACHE_PL310
1231 help
1232 This option enables the workaround for the 753970 PL310 (r3p0) erratum.
1233
1234 Under some condition the effect of cache sync operation on
1235 the store buffer still remains when the operation completes.
1236 This means that the store buffer is always asked to drain and
1237 this prevents it from merging any further writes. The workaround
1238 is to replace the normal offset of cache sync operation (0x730)
1239 by another offset targeting an unmapped PL310 register 0x740.
1240 This has the same effect as the cache sync operation: store buffer
1241 drain and waiting for all buffers empty.
1242
1243config ARM_ERRATA_754322
1244 bool "ARM errata: possible faulty MMU translations following an ASID switch"
1245 depends on CPU_V7
1246 help
1247 This option enables the workaround for the 754322 Cortex-A9 (r2p*,
1248 r3p*) erratum. A speculative memory access may cause a page table walk
1249 which starts prior to an ASID switch but completes afterwards. This
1250 can populate the micro-TLB with a stale entry which may be hit with
1251 the new ASID. This workaround places two dsb instructions in the mm
1252 switching code so that no page table walks can cross the ASID switch.
1253
1254config ARM_ERRATA_754327
1255 bool "ARM errata: no automatic Store Buffer drain"
1256 depends on CPU_V7 && SMP
1257 help
1258 This option enables the workaround for the 754327 Cortex-A9 (prior to
1259 r2p0) erratum. The Store Buffer does not have any automatic draining
1260 mechanism and therefore a livelock may occur if an external agent
1261 continuously polls a memory location waiting to observe an update.
1262 This workaround defines cpu_relax() as smp_mb(), preventing correctly
1263 written polling loops from denying visibility of updates to memory.
1264
1196endmenu 1265endmenu
1197 1266
1198source "arch/arm/common/Kconfig" 1267source "arch/arm/common/Kconfig"
@@ -1266,6 +1335,7 @@ source "kernel/time/Kconfig"
1266config SMP 1335config SMP
1267 bool "Symmetric Multi-Processing (EXPERIMENTAL)" 1336 bool "Symmetric Multi-Processing (EXPERIMENTAL)"
1268 depends on EXPERIMENTAL 1337 depends on EXPERIMENTAL
1338 depends on CPU_V6K || CPU_V7
1269 depends on GENERIC_CLOCKEVENTS 1339 depends on GENERIC_CLOCKEVENTS
1270 depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \ 1340 depends on REALVIEW_EB_ARM11MP || REALVIEW_EB_A9MP || \
1271 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \ 1341 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
@@ -1377,7 +1447,7 @@ config HZ
1377 1447
1378config THUMB2_KERNEL 1448config THUMB2_KERNEL
1379 bool "Compile the kernel in Thumb-2 mode (EXPERIMENTAL)" 1449 bool "Compile the kernel in Thumb-2 mode (EXPERIMENTAL)"
1380 depends on CPU_V7 && !CPU_V6 && EXPERIMENTAL 1450 depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL
1381 select AEABI 1451 select AEABI
1382 select ARM_ASM_UNIFIED 1452 select ARM_ASM_UNIFIED
1383 help 1453 help
@@ -1387,6 +1457,37 @@ config THUMB2_KERNEL
1387 1457
1388 If unsure, say N. 1458 If unsure, say N.
1389 1459
1460config THUMB2_AVOID_R_ARM_THM_JUMP11
1461 bool "Work around buggy Thumb-2 short branch relocations in gas"
1462 depends on THUMB2_KERNEL && MODULES
1463 default y
1464 help
1465 Various binutils versions can resolve Thumb-2 branches to
1466 locally-defined, preemptible global symbols as short-range "b.n"
1467 branch instructions.
1468
1469 This is a problem, because there's no guarantee the final
1470 destination of the symbol, or any candidate locations for a
1471 trampoline, are within range of the branch. For this reason, the
1472 kernel does not support fixing up the R_ARM_THM_JUMP11 (102)
1473 relocation in modules at all, and it makes little sense to add
1474 support.
1475
1476 The symptom is that the kernel fails with an "unsupported
1477 relocation" error when loading some modules.
1478
1479 Until fixed tools are available, passing
1480 -fno-optimize-sibling-calls to gcc should prevent gcc generating
1481 code which hits this problem, at the cost of a bit of extra runtime
1482 stack usage in some cases.
1483
1484 The problem is described in more detail at:
1485 https://bugs.launchpad.net/binutils-linaro/+bug/725126
1486
1487 Only Thumb-2 kernels are affected.
1488
1489 Unless you are sure your tools don't have this problem, say Y.
1490
1390config ARM_ASM_UNIFIED 1491config ARM_ASM_UNIFIED
1391 bool 1492 bool
1392 1493
@@ -1407,7 +1508,7 @@ config AEABI
1407 1508
1408config OABI_COMPAT 1509config OABI_COMPAT
1409 bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)" 1510 bool "Allow old ABI binaries to run with this kernel (EXPERIMENTAL)"
1410 depends on AEABI && EXPERIMENTAL 1511 depends on AEABI && EXPERIMENTAL && !THUMB2_KERNEL
1411 default y 1512 default y
1412 help 1513 help
1413 This option preserves the old syscall interface along with the 1514 This option preserves the old syscall interface along with the
@@ -1635,6 +1736,18 @@ config ZBOOT_ROM
1635 Say Y here if you intend to execute your compressed kernel image 1736 Say Y here if you intend to execute your compressed kernel image
1636 (zImage) directly from ROM or flash. If unsure, say N. 1737 (zImage) directly from ROM or flash. If unsure, say N.
1637 1738
1739config ZBOOT_ROM_MMCIF
1740 bool "Include MMCIF loader in zImage (EXPERIMENTAL)"
1741 depends on ZBOOT_ROM && ARCH_SH7372 && EXPERIMENTAL
1742 help
1743 Say Y here to include experimental MMCIF loading code in the
1744 ROM-able zImage. With this enabled it is possible to write the
1745 the ROM-able zImage kernel image to an MMC card and boot the
1746 kernel straight from the reset vector. At reset the processor
1747 Mask ROM will load the first part of the the ROM-able zImage
1748 which in turn loads the rest the kernel image to RAM using the
1749 MMCIF hardware block.
1750
1638config CMDLINE 1751config CMDLINE
1639 string "Default kernel command string" 1752 string "Default kernel command string"
1640 default "" 1753 default ""
@@ -1868,7 +1981,7 @@ config FPE_FASTFPE
1868 1981
1869config VFP 1982config VFP
1870 bool "VFP-format floating point maths" 1983 bool "VFP-format floating point maths"
1871 depends on CPU_V6 || CPU_ARM926T || CPU_V7 || CPU_FEROCEON 1984 depends on CPU_V6 || CPU_V6K || CPU_ARM926T || CPU_V7 || CPU_FEROCEON
1872 help 1985 help
1873 Say Y to include VFP support code in the kernel. This is needed 1986 Say Y to include VFP support code in the kernel. This is needed
1874 if your hardware includes a VFP unit. 1987 if your hardware includes a VFP unit.
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c22c1adfedd6..1e20c414d5cf 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -15,7 +15,7 @@ ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
15LDFLAGS_vmlinux += --be8 15LDFLAGS_vmlinux += --be8
16endif 16endif
17 17
18OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S 18OBJCOPYFLAGS :=-O binary -R .comment -S
19GZFLAGS :=-9 19GZFLAGS :=-9
20#KBUILD_CFLAGS +=-pipe 20#KBUILD_CFLAGS +=-pipe
21# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: 21# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
@@ -89,6 +89,7 @@ tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110)
89tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 89tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
90tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale) 90tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
91tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 91tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
92tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
92 93
93ifeq ($(CONFIG_AEABI),y) 94ifeq ($(CONFIG_AEABI),y)
94CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork 95CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
@@ -105,6 +106,10 @@ AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mau
105AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W) 106AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
106CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN) 107CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
107AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb 108AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb
109# Work around buggy relocation from gas if requested:
110ifeq ($(CONFIG_THUMB2_AVOID_R_ARM_THM_JUMP11),y)
111CFLAGS_MODULE +=-fno-optimize-sibling-calls
112endif
108endif 113endif
109 114
110# Need -Uarm for gcc < 3.x 115# Need -Uarm for gcc < 3.x
@@ -190,6 +195,7 @@ machine-$(CONFIG_ARCH_U300) := u300
190machine-$(CONFIG_ARCH_U8500) := ux500 195machine-$(CONFIG_ARCH_U8500) := ux500
191machine-$(CONFIG_ARCH_VERSATILE) := versatile 196machine-$(CONFIG_ARCH_VERSATILE) := versatile
192machine-$(CONFIG_ARCH_VEXPRESS) := vexpress 197machine-$(CONFIG_ARCH_VEXPRESS) := vexpress
198machine-$(CONFIG_ARCH_VT8500) := vt8500
193machine-$(CONFIG_ARCH_W90X900) := w90x900 199machine-$(CONFIG_ARCH_W90X900) := w90x900
194machine-$(CONFIG_ARCH_NUC93X) := nuc93x 200machine-$(CONFIG_ARCH_NUC93X) := nuc93x
195machine-$(CONFIG_FOOTBRIDGE) := footbridge 201machine-$(CONFIG_FOOTBRIDGE) := footbridge
@@ -280,7 +286,7 @@ bzImage: zImage
280zImage Image xipImage bootpImage uImage: vmlinux 286zImage Image xipImage bootpImage uImage: vmlinux
281 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ 287 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
282 288
283zinstall install: vmlinux 289zinstall uinstall install: vmlinux
284 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ 290 $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
285 291
286# We use MRPROPER_FILES and CLEAN_FILES now 292# We use MRPROPER_FILES and CLEAN_FILES now
@@ -301,6 +307,7 @@ define archhelp
301 echo ' (supply initrd image via make variable INITRD=<path>)' 307 echo ' (supply initrd image via make variable INITRD=<path>)'
302 echo ' install - Install uncompressed kernel' 308 echo ' install - Install uncompressed kernel'
303 echo ' zinstall - Install compressed kernel' 309 echo ' zinstall - Install compressed kernel'
310 echo ' uinstall - Install U-Boot wrapped compressed kernel'
304 echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or' 311 echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
305 echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 312 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
306 echo ' install to $$(INSTALL_PATH) and run lilo' 313 echo ' install to $$(INSTALL_PATH) and run lilo'
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 4d26f2c52a75..9128fddf1109 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -99,6 +99,10 @@ zinstall: $(obj)/zImage
99 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 99 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
100 $(obj)/zImage System.map "$(INSTALL_PATH)" 100 $(obj)/zImage System.map "$(INSTALL_PATH)"
101 101
102uinstall: $(obj)/uImage
103 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
104 $(obj)/uImage System.map "$(INSTALL_PATH)"
105
102zi: 106zi:
103 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ 107 $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
104 $(obj)/zImage System.map "$(INSTALL_PATH)" 108 $(obj)/zImage System.map "$(INSTALL_PATH)"
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore
index ab204db594d3..c6028967d336 100644
--- a/arch/arm/boot/compressed/.gitignore
+++ b/arch/arm/boot/compressed/.gitignore
@@ -1,3 +1,7 @@
1font.c 1font.c
2piggy.gz 2lib1funcs.S
3piggy.gzip
4piggy.lzo
5piggy.lzma
6vmlinux
3vmlinux.lds 7vmlinux.lds
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 0a8f748e506a..f9f77c65dff3 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -4,9 +4,20 @@
4# create a compressed vmlinuz image from the original vmlinux 4# create a compressed vmlinuz image from the original vmlinux
5# 5#
6 6
7OBJS =
8
9# Ensure that mmcif loader code appears early in the image
10# to minimise that number of bocks that have to be read in
11# order to load it.
12ifeq ($(CONFIG_ZBOOT_ROM_MMCIF),y)
13ifeq ($(CONFIG_ARCH_SH7372),y)
14OBJS += mmcif-sh7372.o
15endif
16endif
17
7AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET) 18AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
8HEAD = head.o 19HEAD = head.o
9OBJS = misc.o decompress.o 20OBJS += misc.o decompress.o
10FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 21FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
11 22
12# 23#
@@ -29,6 +40,10 @@ ifeq ($(CONFIG_ARCH_SA1100),y)
29OBJS += head-sa1100.o 40OBJS += head-sa1100.o
30endif 41endif
31 42
43ifeq ($(CONFIG_ARCH_VT8500),y)
44OBJS += head-vt8500.o
45endif
46
32ifeq ($(CONFIG_CPU_XSCALE),y) 47ifeq ($(CONFIG_CPU_XSCALE),y)
33OBJS += head-xscale.o 48OBJS += head-xscale.o
34endif 49endif
@@ -83,9 +98,11 @@ endif
83EXTRA_CFLAGS := -fpic -fno-builtin 98EXTRA_CFLAGS := -fpic -fno-builtin
84EXTRA_AFLAGS := -Wa,-march=all 99EXTRA_AFLAGS := -Wa,-march=all
85 100
101# Provide size of uncompressed kernel to the decompressor via a linker symbol.
102LDFLAGS_vmlinux = --defsym _image_size=$(shell stat -c "%s" $(obj)/../Image)
86# Supply ZRELADDR to the decompressor via a linker symbol. 103# Supply ZRELADDR to the decompressor via a linker symbol.
87ifneq ($(CONFIG_AUTO_ZRELADDR),y) 104ifneq ($(CONFIG_AUTO_ZRELADDR),y)
88LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR) 105LDFLAGS_vmlinux += --defsym zreladdr=$(ZRELADDR)
89endif 106endif
90ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 107ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
91LDFLAGS_vmlinux += --be8 108LDFLAGS_vmlinux += --be8
diff --git a/arch/arm/boot/compressed/head-shmobile.S b/arch/arm/boot/compressed/head-shmobile.S
index 30973b76e6ae..c943d2e7da9d 100644
--- a/arch/arm/boot/compressed/head-shmobile.S
+++ b/arch/arm/boot/compressed/head-shmobile.S
@@ -25,6 +25,36 @@
25 /* load board-specific initialization code */ 25 /* load board-specific initialization code */
26#include <mach/zboot.h> 26#include <mach/zboot.h>
27 27
28#ifdef CONFIG_ZBOOT_ROM_MMCIF
29 /* Load image from MMC */
30 adr sp, __tmp_stack + 128
31 ldr r0, __image_start
32 ldr r1, __image_end
33 subs r1, r1, r0
34 ldr r0, __load_base
35 bl mmcif_loader
36
37 /* Jump to loaded code */
38 ldr r0, __loaded
39 ldr r1, __image_start
40 sub r0, r0, r1
41 ldr r1, __load_base
42 add pc, r0, r1
43
44__image_start:
45 .long _start
46__image_end:
47 .long _got_end
48__load_base:
49 .long CONFIG_MEMORY_START + 0x02000000 @ Load at 32Mb into SDRAM
50__loaded:
51 .long __continue
52 .align
53__tmp_stack:
54 .space 128
55__continue:
56#endif /* CONFIG_ZBOOT_ROM_MMCIF */
57
28 b 1f 58 b 1f
29__atags:@ tag #1 59__atags:@ tag #1
30 .long 12 @ tag->hdr.size = tag_size(tag_core); 60 .long 12 @ tag->hdr.size = tag_size(tag_core);
diff --git a/arch/arm/boot/compressed/head-vt8500.S b/arch/arm/boot/compressed/head-vt8500.S
new file mode 100644
index 000000000000..1dc1e21a3be3
--- /dev/null
+++ b/arch/arm/boot/compressed/head-vt8500.S
@@ -0,0 +1,46 @@
1/*
2 * linux/arch/arm/boot/compressed/head-vt8500.S
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
5 *
6 * VIA VT8500 specific tweaks. This is merged into head.S by the linker.
7 *
8 */
9
10#include <linux/linkage.h>
11#include <asm/mach-types.h>
12
13 .section ".start", "ax"
14
15__VT8500_start:
16 @ Compare the SCC ID register against a list of known values
17 ldr r1, .SCCID
18 ldr r3, [r1]
19
20 @ VT8500 override
21 ldr r4, .VT8500SCC
22 cmp r3, r4
23 ldreq r7, .ID_BV07
24 beq .Lendvt8500
25
26 @ WM8505 override
27 ldr r4, .WM8505SCC
28 cmp r3, r4
29 ldreq r7, .ID_8505
30 beq .Lendvt8500
31
32 @ Otherwise, leave the bootloader's machine id untouched
33
34.SCCID:
35 .word 0xd8120000
36.VT8500SCC:
37 .word 0x34000102
38.WM8505SCC:
39 .word 0x34260103
40
41.ID_BV07:
42 .word MACH_TYPE_BV07
43.ID_8505:
44 .word MACH_TYPE_WM8505_7IN_NETBOOK
45
46.Lendvt8500:
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 7193884ed8b0..84ac4d656310 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -21,7 +21,7 @@
21 21
22#if defined(CONFIG_DEBUG_ICEDCC) 22#if defined(CONFIG_DEBUG_ICEDCC)
23 23
24#ifdef CONFIG_CPU_V6 24#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
25 .macro loadsp, rb, tmp 25 .macro loadsp, rb, tmp
26 .endm 26 .endm
27 .macro writeb, ch, rb 27 .macro writeb, ch, rb
@@ -128,14 +128,14 @@ wait: mrc p14, 0, pc, c0, c1, 0
128 .arm @ Always enter in ARM state 128 .arm @ Always enter in ARM state
129start: 129start:
130 .type start,#function 130 .type start,#function
131 THUMB( adr r12, BSYM(1f) ) 131 .rept 7
132 THUMB( bx r12 )
133 THUMB( .rept 6 )
134 ARM( .rept 8 )
135 mov r0, r0 132 mov r0, r0
136 .endr 133 .endr
134 ARM( mov r0, r0 )
135 ARM( b 1f )
136 THUMB( adr r12, BSYM(1f) )
137 THUMB( bx r12 )
137 138
138 b 1f
139 .word 0x016f2818 @ Magic numbers to help the loader 139 .word 0x016f2818 @ Magic numbers to help the loader
140 .word start @ absolute load/run zImage address 140 .word start @ absolute load/run zImage address
141 .word _edata @ zImage end address 141 .word _edata @ zImage end address
@@ -174,9 +174,7 @@ not_angel:
174 */ 174 */
175 175
176 .text 176 .text
177 adr r0, LC0 177
178 ldmia r0, {r1, r2, r3, r5, r6, r11, ip}
179 ldr sp, [r0, #28]
180#ifdef CONFIG_AUTO_ZRELADDR 178#ifdef CONFIG_AUTO_ZRELADDR
181 @ determine final kernel image address 179 @ determine final kernel image address
182 mov r4, pc 180 mov r4, pc
@@ -185,35 +183,108 @@ not_angel:
185#else 183#else
186 ldr r4, =zreladdr 184 ldr r4, =zreladdr
187#endif 185#endif
188 subs r0, r0, r1 @ calculate the delta offset
189 186
190 @ if delta is zero, we are 187 bl cache_on
191 beq not_relocated @ running at the address we 188
192 @ were linked at. 189restart: adr r0, LC0
190 ldmia r0, {r1, r2, r3, r5, r6, r9, r11, r12}
191 ldr sp, [r0, #32]
192
193 /*
194 * We might be running at a different address. We need
195 * to fix up various pointers.
196 */
197 sub r0, r0, r1 @ calculate the delta offset
198 add r5, r5, r0 @ _start
199 add r6, r6, r0 @ _edata
193 200
201#ifndef CONFIG_ZBOOT_ROM
202 /* malloc space is above the relocated stack (64k max) */
203 add sp, sp, r0
204 add r10, sp, #0x10000
205#else
194 /* 206 /*
195 * We're running at a different address. We need to fix 207 * With ZBOOT_ROM the bss/stack is non relocatable,
196 * up various pointers: 208 * but someone could still run this code from RAM,
197 * r5 - zImage base address (_start) 209 * in which case our reference is _edata.
198 * r6 - size of decompressed image
199 * r11 - GOT start
200 * ip - GOT end
201 */ 210 */
202 add r5, r5, r0 211 mov r10, r6
212#endif
213
214/*
215 * Check to see if we will overwrite ourselves.
216 * r4 = final kernel address
217 * r5 = start of this image
218 * r9 = size of decompressed image
219 * r10 = end of this image, including bss/stack/malloc space if non XIP
220 * We basically want:
221 * r4 >= r10 -> OK
222 * r4 + image length <= r5 -> OK
223 */
224 cmp r4, r10
225 bhs wont_overwrite
226 add r10, r4, r9
227 cmp r10, r5
228 bls wont_overwrite
229
230/*
231 * Relocate ourselves past the end of the decompressed kernel.
232 * r5 = start of this image
233 * r6 = _edata
234 * r10 = end of the decompressed kernel
235 * Because we always copy ahead, we need to do it from the end and go
236 * backward in case the source and destination overlap.
237 */
238 /* Round up to next 256-byte boundary. */
239 add r10, r10, #256
240 bic r10, r10, #255
241
242 sub r9, r6, r5 @ size to copy
243 add r9, r9, #31 @ rounded up to a multiple
244 bic r9, r9, #31 @ ... of 32 bytes
245 add r6, r9, r5
246 add r9, r9, r10
247
2481: ldmdb r6!, {r0 - r3, r10 - r12, lr}
249 cmp r6, r5
250 stmdb r9!, {r0 - r3, r10 - r12, lr}
251 bhi 1b
252
253 /* Preserve offset to relocated code. */
254 sub r6, r9, r6
255
256 bl cache_clean_flush
257
258 adr r0, BSYM(restart)
259 add r0, r0, r6
260 mov pc, r0
261
262wont_overwrite:
263/*
264 * If delta is zero, we are running at the address we were linked at.
265 * r0 = delta
266 * r2 = BSS start
267 * r3 = BSS end
268 * r4 = kernel execution address
269 * r7 = architecture ID
270 * r8 = atags pointer
271 * r11 = GOT start
272 * r12 = GOT end
273 * sp = stack pointer
274 */
275 teq r0, #0
276 beq not_relocated
203 add r11, r11, r0 277 add r11, r11, r0
204 add ip, ip, r0 278 add r12, r12, r0
205 279
206#ifndef CONFIG_ZBOOT_ROM 280#ifndef CONFIG_ZBOOT_ROM
207 /* 281 /*
208 * If we're running fully PIC === CONFIG_ZBOOT_ROM = n, 282 * If we're running fully PIC === CONFIG_ZBOOT_ROM = n,
209 * we need to fix up pointers into the BSS region. 283 * we need to fix up pointers into the BSS region.
210 * r2 - BSS start 284 * Note that the stack pointer has already been fixed up.
211 * r3 - BSS end
212 * sp - stack pointer
213 */ 285 */
214 add r2, r2, r0 286 add r2, r2, r0
215 add r3, r3, r0 287 add r3, r3, r0
216 add sp, sp, r0
217 288
218 /* 289 /*
219 * Relocate all entries in the GOT table. 290 * Relocate all entries in the GOT table.
@@ -221,7 +292,7 @@ not_angel:
2211: ldr r1, [r11, #0] @ relocate entries in the GOT 2921: ldr r1, [r11, #0] @ relocate entries in the GOT
222 add r1, r1, r0 @ table. This fixes up the 293 add r1, r1, r0 @ table. This fixes up the
223 str r1, [r11], #4 @ C references. 294 str r1, [r11], #4 @ C references.
224 cmp r11, ip 295 cmp r11, r12
225 blo 1b 296 blo 1b
226#else 297#else
227 298
@@ -234,7 +305,7 @@ not_angel:
234 cmphs r3, r1 @ _end < entry 305 cmphs r3, r1 @ _end < entry
235 addlo r1, r1, r0 @ table. This fixes up the 306 addlo r1, r1, r0 @ table. This fixes up the
236 str r1, [r11], #4 @ C references. 307 str r1, [r11], #4 @ C references.
237 cmp r11, ip 308 cmp r11, r12
238 blo 1b 309 blo 1b
239#endif 310#endif
240 311
@@ -246,76 +317,24 @@ not_relocated: mov r0, #0
246 cmp r2, r3 317 cmp r2, r3
247 blo 1b 318 blo 1b
248 319
249 /*
250 * The C runtime environment should now be setup
251 * sufficiently. Turn the cache on, set up some
252 * pointers, and start decompressing.
253 */
254 bl cache_on
255
256 mov r1, sp @ malloc space above stack
257 add r2, sp, #0x10000 @ 64k max
258
259/* 320/*
260 * Check to see if we will overwrite ourselves. 321 * The C runtime environment should now be setup sufficiently.
261 * r4 = final kernel address 322 * Set up some pointers, and start decompressing.
262 * r5 = start of this image 323 * r4 = kernel execution address
263 * r6 = size of decompressed image 324 * r7 = architecture ID
264 * r2 = end of malloc space (and therefore this image) 325 * r8 = atags pointer
265 * We basically want:
266 * r4 >= r2 -> OK
267 * r4 + image length <= r5 -> OK
268 */ 326 */
269 cmp r4, r2 327 mov r0, r4
270 bhs wont_overwrite 328 mov r1, sp @ malloc space above stack
271 add r0, r4, r6 329 add r2, sp, #0x10000 @ 64k max
272 cmp r0, r5
273 bls wont_overwrite
274
275 mov r5, r2 @ decompress after malloc space
276 mov r0, r5
277 mov r3, r7 330 mov r3, r7
278 bl decompress_kernel 331 bl decompress_kernel
279
280 add r0, r0, #127 + 128 @ alignment + stack
281 bic r0, r0, #127 @ align the kernel length
282/*
283 * r0 = decompressed kernel length
284 * r1-r3 = unused
285 * r4 = kernel execution address
286 * r5 = decompressed kernel start
287 * r7 = architecture ID
288 * r8 = atags pointer
289 * r9-r12,r14 = corrupted
290 */
291 add r1, r5, r0 @ end of decompressed kernel
292 adr r2, reloc_start
293 ldr r3, LC1
294 add r3, r2, r3
2951: ldmia r2!, {r9 - r12, r14} @ copy relocation code
296 stmia r1!, {r9 - r12, r14}
297 ldmia r2!, {r9 - r12, r14}
298 stmia r1!, {r9 - r12, r14}
299 cmp r2, r3
300 blo 1b
301 mov sp, r1
302 add sp, sp, #128 @ relocate the stack
303
304 bl cache_clean_flush 332 bl cache_clean_flush
305 ARM( add pc, r5, r0 ) @ call relocation code 333 bl cache_off
306 THUMB( add r12, r5, r0 ) 334 mov r0, #0 @ must be zero
307 THUMB( mov pc, r12 ) @ call relocation code 335 mov r1, r7 @ restore architecture number
308 336 mov r2, r8 @ restore atags pointer
309/* 337 mov pc, r4 @ call kernel
310 * We're not in danger of overwriting ourselves. Do this the simple way.
311 *
312 * r4 = kernel execution address
313 * r7 = architecture ID
314 */
315wont_overwrite: mov r0, r4
316 mov r3, r7
317 bl decompress_kernel
318 b call_kernel
319 338
320 .align 2 339 .align 2
321 .type LC0, #object 340 .type LC0, #object
@@ -323,11 +342,11 @@ LC0: .word LC0 @ r1
323 .word __bss_start @ r2 342 .word __bss_start @ r2
324 .word _end @ r3 343 .word _end @ r3
325 .word _start @ r5 344 .word _start @ r5
326 .word _image_size @ r6 345 .word _edata @ r6
346 .word _image_size @ r9
327 .word _got_start @ r11 347 .word _got_start @ r11
328 .word _got_end @ ip 348 .word _got_end @ ip
329 .word user_stack_end @ sp 349 .word user_stack_end @ sp
330LC1: .word reloc_end - reloc_start
331 .size LC0, . - LC0 350 .size LC0, . - LC0
332 351
333#ifdef CONFIG_ARCH_RPC 352#ifdef CONFIG_ARCH_RPC
@@ -353,7 +372,7 @@ params: ldr r0, =0x10000100 @ params_phys for RPC
353 * On exit, 372 * On exit,
354 * r0, r1, r2, r3, r9, r10, r12 corrupted 373 * r0, r1, r2, r3, r9, r10, r12 corrupted
355 * This routine must preserve: 374 * This routine must preserve:
356 * r4, r5, r6, r7, r8 375 * r4, r7, r8
357 */ 376 */
358 .align 5 377 .align 5
359cache_on: mov r3, #8 @ cache_on function 378cache_on: mov r3, #8 @ cache_on function
@@ -551,43 +570,6 @@ __common_mmu_cache_on:
551#endif 570#endif
552 571
553/* 572/*
554 * All code following this line is relocatable. It is relocated by
555 * the above code to the end of the decompressed kernel image and
556 * executed there. During this time, we have no stacks.
557 *
558 * r0 = decompressed kernel length
559 * r1-r3 = unused
560 * r4 = kernel execution address
561 * r5 = decompressed kernel start
562 * r7 = architecture ID
563 * r8 = atags pointer
564 * r9-r12,r14 = corrupted
565 */
566 .align 5
567reloc_start: add r9, r5, r0
568 sub r9, r9, #128 @ do not copy the stack
569 debug_reloc_start
570 mov r1, r4
5711:
572 .rept 4
573 ldmia r5!, {r0, r2, r3, r10 - r12, r14} @ relocate kernel
574 stmia r1!, {r0, r2, r3, r10 - r12, r14}
575 .endr
576
577 cmp r5, r9
578 blo 1b
579 mov sp, r1
580 add sp, sp, #128 @ relocate the stack
581 debug_reloc_end
582
583call_kernel: bl cache_clean_flush
584 bl cache_off
585 mov r0, #0 @ must be zero
586 mov r1, r7 @ restore architecture number
587 mov r2, r8 @ restore atags pointer
588 mov pc, r4 @ call kernel
589
590/*
591 * Here follow the relocatable cache support functions for the 573 * Here follow the relocatable cache support functions for the
592 * various processors. This is a generic hook for locating an 574 * various processors. This is a generic hook for locating an
593 * entry and jumping to an instruction at the specified offset 575 * entry and jumping to an instruction at the specified offset
@@ -791,7 +773,7 @@ proc_types:
791 * On exit, 773 * On exit,
792 * r0, r1, r2, r3, r9, r12 corrupted 774 * r0, r1, r2, r3, r9, r12 corrupted
793 * This routine must preserve: 775 * This routine must preserve:
794 * r4, r6, r7 776 * r4, r7, r8
795 */ 777 */
796 .align 5 778 .align 5
797cache_off: mov r3, #12 @ cache_off function 779cache_off: mov r3, #12 @ cache_off function
@@ -866,7 +848,7 @@ __armv3_mmu_cache_off:
866 * On exit, 848 * On exit,
867 * r1, r2, r3, r9, r10, r11, r12 corrupted 849 * r1, r2, r3, r9, r10, r11, r12 corrupted
868 * This routine must preserve: 850 * This routine must preserve:
869 * r0, r4, r5, r6, r7 851 * r4, r6, r7, r8
870 */ 852 */
871 .align 5 853 .align 5
872cache_clean_flush: 854cache_clean_flush:
@@ -1088,7 +1070,6 @@ memdump: mov r12, r0
1088#endif 1070#endif
1089 1071
1090 .ltorg 1072 .ltorg
1091reloc_end:
1092 1073
1093 .align 1074 .align
1094 .section ".stack", "aw", %nobits 1075 .section ".stack", "aw", %nobits
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index e653a6d3c8d9..4657e877bf8f 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -36,7 +36,7 @@ extern void error(char *x);
36 36
37#ifdef CONFIG_DEBUG_ICEDCC 37#ifdef CONFIG_DEBUG_ICEDCC
38 38
39#ifdef CONFIG_CPU_V6 39#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
40 40
41static void icedcc_putc(int ch) 41static void icedcc_putc(int ch)
42{ 42{
diff --git a/arch/arm/boot/compressed/mmcif-sh7372.c b/arch/arm/boot/compressed/mmcif-sh7372.c
new file mode 100644
index 000000000000..e6180af241f6
--- /dev/null
+++ b/arch/arm/boot/compressed/mmcif-sh7372.c
@@ -0,0 +1,87 @@
1/*
2 * sh7372 MMCIF loader
3 *
4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2010 Simon Horman
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/mmc/sh_mmcif.h>
13#include <mach/mmcif.h>
14
15#define MMCIF_BASE (void __iomem *)0xe6bd0000
16
17#define PORT84CR (void __iomem *)0xe6050054
18#define PORT85CR (void __iomem *)0xe6050055
19#define PORT86CR (void __iomem *)0xe6050056
20#define PORT87CR (void __iomem *)0xe6050057
21#define PORT88CR (void __iomem *)0xe6050058
22#define PORT89CR (void __iomem *)0xe6050059
23#define PORT90CR (void __iomem *)0xe605005a
24#define PORT91CR (void __iomem *)0xe605005b
25#define PORT92CR (void __iomem *)0xe605005c
26#define PORT99CR (void __iomem *)0xe6050063
27
28#define SMSTPCR3 (void __iomem *)0xe615013c
29
30/* SH7372 specific MMCIF loader
31 *
32 * loads the zImage from an MMC card starting from block 1.
33 *
34 * The image must be start with a vrl4 header and
35 * the zImage must start at offset 512 of the image. That is,
36 * at block 2 (=byte 1024) on the media
37 *
38 * Use the following line to write the vrl4 formated zImage
39 * to an MMC card
40 * # dd if=vrl4.out of=/dev/sdx bs=512 seek=1
41 */
42asmlinkage void mmcif_loader(unsigned char *buf, unsigned long len)
43{
44 mmcif_init_progress();
45 mmcif_update_progress(MMCIF_PROGRESS_ENTER);
46
47 /* Initialise MMC
48 * registers: PORT84CR-PORT92CR
49 * (MMCD0_0-MMCD0_7,MMCCMD0 Control)
50 * value: 0x04 - select function 4
51 */
52 __raw_writeb(0x04, PORT84CR);
53 __raw_writeb(0x04, PORT85CR);
54 __raw_writeb(0x04, PORT86CR);
55 __raw_writeb(0x04, PORT87CR);
56 __raw_writeb(0x04, PORT88CR);
57 __raw_writeb(0x04, PORT89CR);
58 __raw_writeb(0x04, PORT90CR);
59 __raw_writeb(0x04, PORT91CR);
60 __raw_writeb(0x04, PORT92CR);
61
62 /* Initialise MMC
63 * registers: PORT99CR (MMCCLK0 Control)
64 * value: 0x10 | 0x04 - enable output | select function 4
65 */
66 __raw_writeb(0x14, PORT99CR);
67
68 /* Enable clock to MMC hardware block */
69 __raw_writel(__raw_readl(SMSTPCR3) & ~(1 << 12), SMSTPCR3);
70
71 mmcif_update_progress(MMCIF_PROGRESS_INIT);
72
73 /* setup MMCIF hardware */
74 sh_mmcif_boot_init(MMCIF_BASE);
75
76 mmcif_update_progress(MMCIF_PROGRESS_LOAD);
77
78 /* load kernel via MMCIF interface */
79 sh_mmcif_boot_do_read(MMCIF_BASE, 2, /* Kernel is at block 2 */
80 (len + SH_MMCIF_BBS - 1) / SH_MMCIF_BBS, buf);
81
82
83 /* Disable clock to MMC hardware block */
84 __raw_writel(__raw_readl(SMSTPCR3) & (1 << 12), SMSTPCR3);
85
86 mmcif_update_progress(MMCIF_PROGRESS_DONE);
87}
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in
index 366a924019ac..5309909d7282 100644
--- a/arch/arm/boot/compressed/vmlinux.lds.in
+++ b/arch/arm/boot/compressed/vmlinux.lds.in
@@ -43,9 +43,6 @@ SECTIONS
43 43
44 _etext = .; 44 _etext = .;
45 45
46 /* Assume size of decompressed image is 4x the compressed image */
47 _image_size = (_etext - _text) * 4;
48
49 _got_start = .; 46 _got_start = .;
50 .got : { *(.got) } 47 .got : { *(.got) }
51 _got_end = .; 48 _got_end = .;
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 778655f0257a..ea5ee4d067f3 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -6,6 +6,8 @@ config ARM_VIC
6 6
7config ARM_VIC_NR 7config ARM_VIC_NR
8 int 8 int
9 default 4 if ARCH_S5PV210
10 default 3 if ARCH_S5P6442 || ARCH_S5PC100
9 default 2 11 default 2
10 depends on ARM_VIC 12 depends on ARM_VIC
11 help 13 help
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 224377211151..cb6b041c39d2 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -44,6 +44,19 @@ struct gic_chip_data {
44 void __iomem *cpu_base; 44 void __iomem *cpu_base;
45}; 45};
46 46
47/*
48 * Supported arch specific GIC irq extension.
49 * Default make them NULL.
50 */
51struct irq_chip gic_arch_extn = {
52 .irq_ack = NULL,
53 .irq_mask = NULL,
54 .irq_unmask = NULL,
55 .irq_retrigger = NULL,
56 .irq_set_type = NULL,
57 .irq_set_wake = NULL,
58};
59
47#ifndef MAX_GIC_NR 60#ifndef MAX_GIC_NR
48#define MAX_GIC_NR 1 61#define MAX_GIC_NR 1
49#endif 62#endif
@@ -74,6 +87,8 @@ static inline unsigned int gic_irq(struct irq_data *d)
74static void gic_ack_irq(struct irq_data *d) 87static void gic_ack_irq(struct irq_data *d)
75{ 88{
76 spin_lock(&irq_controller_lock); 89 spin_lock(&irq_controller_lock);
90 if (gic_arch_extn.irq_ack)
91 gic_arch_extn.irq_ack(d);
77 writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI); 92 writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
78 spin_unlock(&irq_controller_lock); 93 spin_unlock(&irq_controller_lock);
79} 94}
@@ -84,6 +99,8 @@ static void gic_mask_irq(struct irq_data *d)
84 99
85 spin_lock(&irq_controller_lock); 100 spin_lock(&irq_controller_lock);
86 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4); 101 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
102 if (gic_arch_extn.irq_mask)
103 gic_arch_extn.irq_mask(d);
87 spin_unlock(&irq_controller_lock); 104 spin_unlock(&irq_controller_lock);
88} 105}
89 106
@@ -92,6 +109,8 @@ static void gic_unmask_irq(struct irq_data *d)
92 u32 mask = 1 << (d->irq % 32); 109 u32 mask = 1 << (d->irq % 32);
93 110
94 spin_lock(&irq_controller_lock); 111 spin_lock(&irq_controller_lock);
112 if (gic_arch_extn.irq_unmask)
113 gic_arch_extn.irq_unmask(d);
95 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4); 114 writel(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
96 spin_unlock(&irq_controller_lock); 115 spin_unlock(&irq_controller_lock);
97} 116}
@@ -116,6 +135,9 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
116 135
117 spin_lock(&irq_controller_lock); 136 spin_lock(&irq_controller_lock);
118 137
138 if (gic_arch_extn.irq_set_type)
139 gic_arch_extn.irq_set_type(d, type);
140
119 val = readl(base + GIC_DIST_CONFIG + confoff); 141 val = readl(base + GIC_DIST_CONFIG + confoff);
120 if (type == IRQ_TYPE_LEVEL_HIGH) 142 if (type == IRQ_TYPE_LEVEL_HIGH)
121 val &= ~confmask; 143 val &= ~confmask;
@@ -141,32 +163,54 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
141 return 0; 163 return 0;
142} 164}
143 165
166static int gic_retrigger(struct irq_data *d)
167{
168 if (gic_arch_extn.irq_retrigger)
169 return gic_arch_extn.irq_retrigger(d);
170
171 return -ENXIO;
172}
173
144#ifdef CONFIG_SMP 174#ifdef CONFIG_SMP
145static int 175static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
146gic_set_cpu(struct irq_data *d, const struct cpumask *mask_val, bool force) 176 bool force)
147{ 177{
148 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3); 178 void __iomem *reg = gic_dist_base(d) + GIC_DIST_TARGET + (gic_irq(d) & ~3);
149 unsigned int shift = (d->irq % 4) * 8; 179 unsigned int shift = (d->irq % 4) * 8;
150 unsigned int cpu = cpumask_first(mask_val); 180 unsigned int cpu = cpumask_first(mask_val);
151 u32 val; 181 u32 val, mask, bit;
152 struct irq_desc *desc;
153 182
154 spin_lock(&irq_controller_lock); 183 if (cpu >= 8)
155 desc = irq_to_desc(d->irq);
156 if (desc == NULL) {
157 spin_unlock(&irq_controller_lock);
158 return -EINVAL; 184 return -EINVAL;
159 } 185
186 mask = 0xff << shift;
187 bit = 1 << (cpu + shift);
188
189 spin_lock(&irq_controller_lock);
160 d->node = cpu; 190 d->node = cpu;
161 val = readl(reg) & ~(0xff << shift); 191 val = readl(reg) & ~mask;
162 val |= 1 << (cpu + shift); 192 writel(val | bit, reg);
163 writel(val, reg);
164 spin_unlock(&irq_controller_lock); 193 spin_unlock(&irq_controller_lock);
165 194
166 return 0; 195 return 0;
167} 196}
168#endif 197#endif
169 198
199#ifdef CONFIG_PM
200static int gic_set_wake(struct irq_data *d, unsigned int on)
201{
202 int ret = -ENXIO;
203
204 if (gic_arch_extn.irq_set_wake)
205 ret = gic_arch_extn.irq_set_wake(d, on);
206
207 return ret;
208}
209
210#else
211#define gic_set_wake NULL
212#endif
213
170static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) 214static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
171{ 215{
172 struct gic_chip_data *chip_data = get_irq_data(irq); 216 struct gic_chip_data *chip_data = get_irq_data(irq);
@@ -202,9 +246,11 @@ static struct irq_chip gic_chip = {
202 .irq_mask = gic_mask_irq, 246 .irq_mask = gic_mask_irq,
203 .irq_unmask = gic_unmask_irq, 247 .irq_unmask = gic_unmask_irq,
204 .irq_set_type = gic_set_type, 248 .irq_set_type = gic_set_type,
249 .irq_retrigger = gic_retrigger,
205#ifdef CONFIG_SMP 250#ifdef CONFIG_SMP
206 .irq_set_affinity = gic_set_cpu, 251 .irq_set_affinity = gic_set_affinity,
207#endif 252#endif
253 .irq_set_wake = gic_set_wake,
208}; 254};
209 255
210void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) 256void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
diff --git a/arch/arm/include/asm/a.out-core.h b/arch/arm/include/asm/a.out-core.h
index 93d04acaa31f..92f10cb5c70c 100644
--- a/arch/arm/include/asm/a.out-core.h
+++ b/arch/arm/include/asm/a.out-core.h
@@ -32,11 +32,7 @@ static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
32 dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT; 32 dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
33 dump->u_ssize = 0; 33 dump->u_ssize = 0;
34 34
35 dump->u_debugreg[0] = tsk->thread.debug.bp[0].address; 35 memset(dump->u_debugreg, 0, sizeof(dump->u_debugreg));
36 dump->u_debugreg[1] = tsk->thread.debug.bp[1].address;
37 dump->u_debugreg[2] = tsk->thread.debug.bp[0].insn.arm;
38 dump->u_debugreg[3] = tsk->thread.debug.bp[1].insn.arm;
39 dump->u_debugreg[4] = tsk->thread.debug.nsaved;
40 36
41 if (dump->start_stack < 0x04000000) 37 if (dump->start_stack < 0x04000000)
42 dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT; 38 dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT;
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index 7b1bb2bbaf88..af54ed102f5f 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -149,14 +149,18 @@ ____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
149 */ 149 */
150 150
151/* 151/*
152 * Native endian assembly bitops. nr = 0 -> word 0 bit 0.
153 */
154extern void _set_bit(int nr, volatile unsigned long * p);
155extern void _clear_bit(int nr, volatile unsigned long * p);
156extern void _change_bit(int nr, volatile unsigned long * p);
157extern int _test_and_set_bit(int nr, volatile unsigned long * p);
158extern int _test_and_clear_bit(int nr, volatile unsigned long * p);
159extern int _test_and_change_bit(int nr, volatile unsigned long * p);
160
161/*
152 * Little endian assembly bitops. nr = 0 -> byte 0 bit 0. 162 * Little endian assembly bitops. nr = 0 -> byte 0 bit 0.
153 */ 163 */
154extern void _set_bit_le(int nr, volatile unsigned long * p);
155extern void _clear_bit_le(int nr, volatile unsigned long * p);
156extern void _change_bit_le(int nr, volatile unsigned long * p);
157extern int _test_and_set_bit_le(int nr, volatile unsigned long * p);
158extern int _test_and_clear_bit_le(int nr, volatile unsigned long * p);
159extern int _test_and_change_bit_le(int nr, volatile unsigned long * p);
160extern int _find_first_zero_bit_le(const void * p, unsigned size); 164extern int _find_first_zero_bit_le(const void * p, unsigned size);
161extern int _find_next_zero_bit_le(const void * p, int size, int offset); 165extern int _find_next_zero_bit_le(const void * p, int size, int offset);
162extern int _find_first_bit_le(const unsigned long *p, unsigned size); 166extern int _find_first_bit_le(const unsigned long *p, unsigned size);
@@ -165,12 +169,6 @@ extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
165/* 169/*
166 * Big endian assembly bitops. nr = 0 -> byte 3 bit 0. 170 * Big endian assembly bitops. nr = 0 -> byte 3 bit 0.
167 */ 171 */
168extern void _set_bit_be(int nr, volatile unsigned long * p);
169extern void _clear_bit_be(int nr, volatile unsigned long * p);
170extern void _change_bit_be(int nr, volatile unsigned long * p);
171extern int _test_and_set_bit_be(int nr, volatile unsigned long * p);
172extern int _test_and_clear_bit_be(int nr, volatile unsigned long * p);
173extern int _test_and_change_bit_be(int nr, volatile unsigned long * p);
174extern int _find_first_zero_bit_be(const void * p, unsigned size); 172extern int _find_first_zero_bit_be(const void * p, unsigned size);
175extern int _find_next_zero_bit_be(const void * p, int size, int offset); 173extern int _find_next_zero_bit_be(const void * p, int size, int offset);
176extern int _find_first_bit_be(const unsigned long *p, unsigned size); 174extern int _find_first_bit_be(const unsigned long *p, unsigned size);
@@ -180,33 +178,26 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
180/* 178/*
181 * The __* form of bitops are non-atomic and may be reordered. 179 * The __* form of bitops are non-atomic and may be reordered.
182 */ 180 */
183#define ATOMIC_BITOP_LE(name,nr,p) \ 181#define ATOMIC_BITOP(name,nr,p) \
184 (__builtin_constant_p(nr) ? \ 182 (__builtin_constant_p(nr) ? ____atomic_##name(nr, p) : _##name(nr,p))
185 ____atomic_##name(nr, p) : \
186 _##name##_le(nr,p))
187
188#define ATOMIC_BITOP_BE(name,nr,p) \
189 (__builtin_constant_p(nr) ? \
190 ____atomic_##name(nr, p) : \
191 _##name##_be(nr,p))
192#else 183#else
193#define ATOMIC_BITOP_LE(name,nr,p) _##name##_le(nr,p) 184#define ATOMIC_BITOP(name,nr,p) _##name(nr,p)
194#define ATOMIC_BITOP_BE(name,nr,p) _##name##_be(nr,p)
195#endif 185#endif
196 186
197#define NONATOMIC_BITOP(name,nr,p) \ 187/*
198 (____nonatomic_##name(nr, p)) 188 * Native endian atomic definitions.
189 */
190#define set_bit(nr,p) ATOMIC_BITOP(set_bit,nr,p)
191#define clear_bit(nr,p) ATOMIC_BITOP(clear_bit,nr,p)
192#define change_bit(nr,p) ATOMIC_BITOP(change_bit,nr,p)
193#define test_and_set_bit(nr,p) ATOMIC_BITOP(test_and_set_bit,nr,p)
194#define test_and_clear_bit(nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p)
195#define test_and_change_bit(nr,p) ATOMIC_BITOP(test_and_change_bit,nr,p)
199 196
200#ifndef __ARMEB__ 197#ifndef __ARMEB__
201/* 198/*
202 * These are the little endian, atomic definitions. 199 * These are the little endian, atomic definitions.
203 */ 200 */
204#define set_bit(nr,p) ATOMIC_BITOP_LE(set_bit,nr,p)
205#define clear_bit(nr,p) ATOMIC_BITOP_LE(clear_bit,nr,p)
206#define change_bit(nr,p) ATOMIC_BITOP_LE(change_bit,nr,p)
207#define test_and_set_bit(nr,p) ATOMIC_BITOP_LE(test_and_set_bit,nr,p)
208#define test_and_clear_bit(nr,p) ATOMIC_BITOP_LE(test_and_clear_bit,nr,p)
209#define test_and_change_bit(nr,p) ATOMIC_BITOP_LE(test_and_change_bit,nr,p)
210#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) 201#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz)
211#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) 202#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off)
212#define find_first_bit(p,sz) _find_first_bit_le(p,sz) 203#define find_first_bit(p,sz) _find_first_bit_le(p,sz)
@@ -215,16 +206,9 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset);
215#define WORD_BITOFF_TO_LE(x) ((x)) 206#define WORD_BITOFF_TO_LE(x) ((x))
216 207
217#else 208#else
218
219/* 209/*
220 * These are the big endian, atomic definitions. 210 * These are the big endian, atomic definitions.
221 */ 211 */
222#define set_bit(nr,p) ATOMIC_BITOP_BE(set_bit,nr,p)
223#define clear_bit(nr,p) ATOMIC_BITOP_BE(clear_bit,nr,p)
224#define change_bit(nr,p) ATOMIC_BITOP_BE(change_bit,nr,p)
225#define test_and_set_bit(nr,p) ATOMIC_BITOP_BE(test_and_set_bit,nr,p)
226#define test_and_clear_bit(nr,p) ATOMIC_BITOP_BE(test_and_clear_bit,nr,p)
227#define test_and_change_bit(nr,p) ATOMIC_BITOP_BE(test_and_change_bit,nr,p)
228#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz) 212#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz)
229#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off) 213#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off)
230#define find_first_bit(p,sz) _find_first_bit_be(p,sz) 214#define find_first_bit(p,sz) _find_first_bit_be(p,sz)
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index 3acd8fa25e34..d5d8d5c72682 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -12,7 +12,7 @@
12 12
13#include <linux/mm.h> 13#include <linux/mm.h>
14 14
15#include <asm/glue.h> 15#include <asm/glue-cache.h>
16#include <asm/shmparam.h> 16#include <asm/shmparam.h>
17#include <asm/cachetype.h> 17#include <asm/cachetype.h>
18#include <asm/outercache.h> 18#include <asm/outercache.h>
@@ -20,123 +20,6 @@
20#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT) 20#define CACHE_COLOUR(vaddr) ((vaddr & (SHMLBA - 1)) >> PAGE_SHIFT)
21 21
22/* 22/*
23 * Cache Model
24 * ===========
25 */
26#undef _CACHE
27#undef MULTI_CACHE
28
29#if defined(CONFIG_CPU_CACHE_V3)
30# ifdef _CACHE
31# define MULTI_CACHE 1
32# else
33# define _CACHE v3
34# endif
35#endif
36
37#if defined(CONFIG_CPU_CACHE_V4)
38# ifdef _CACHE
39# define MULTI_CACHE 1
40# else
41# define _CACHE v4
42# endif
43#endif
44
45#if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
46 defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) || \
47 defined(CONFIG_CPU_ARM1026)
48# define MULTI_CACHE 1
49#endif
50
51#if defined(CONFIG_CPU_FA526)
52# ifdef _CACHE
53# define MULTI_CACHE 1
54# else
55# define _CACHE fa
56# endif
57#endif
58
59#if defined(CONFIG_CPU_ARM926T)
60# ifdef _CACHE
61# define MULTI_CACHE 1
62# else
63# define _CACHE arm926
64# endif
65#endif
66
67#if defined(CONFIG_CPU_ARM940T)
68# ifdef _CACHE
69# define MULTI_CACHE 1
70# else
71# define _CACHE arm940
72# endif
73#endif
74
75#if defined(CONFIG_CPU_ARM946E)
76# ifdef _CACHE
77# define MULTI_CACHE 1
78# else
79# define _CACHE arm946
80# endif
81#endif
82
83#if defined(CONFIG_CPU_CACHE_V4WB)
84# ifdef _CACHE
85# define MULTI_CACHE 1
86# else
87# define _CACHE v4wb
88# endif
89#endif
90
91#if defined(CONFIG_CPU_XSCALE)
92# ifdef _CACHE
93# define MULTI_CACHE 1
94# else
95# define _CACHE xscale
96# endif
97#endif
98
99#if defined(CONFIG_CPU_XSC3)
100# ifdef _CACHE
101# define MULTI_CACHE 1
102# else
103# define _CACHE xsc3
104# endif
105#endif
106
107#if defined(CONFIG_CPU_MOHAWK)
108# ifdef _CACHE
109# define MULTI_CACHE 1
110# else
111# define _CACHE mohawk
112# endif
113#endif
114
115#if defined(CONFIG_CPU_FEROCEON)
116# define MULTI_CACHE 1
117#endif
118
119#if defined(CONFIG_CPU_V6)
120//# ifdef _CACHE
121# define MULTI_CACHE 1
122//# else
123//# define _CACHE v6
124//# endif
125#endif
126
127#if defined(CONFIG_CPU_V7)
128//# ifdef _CACHE
129# define MULTI_CACHE 1
130//# else
131//# define _CACHE v7
132//# endif
133#endif
134
135#if !defined(_CACHE) && !defined(MULTI_CACHE)
136#error Unknown cache maintainence model
137#endif
138
139/*
140 * This flag is used to indicate that the page pointed to by a pte is clean 23 * This flag is used to indicate that the page pointed to by a pte is clean
141 * and does not require cleaning before returning it to the user. 24 * and does not require cleaning before returning it to the user.
142 */ 25 */
@@ -249,19 +132,11 @@ extern struct cpu_cache_fns cpu_cache;
249 * visible to the CPU. 132 * visible to the CPU.
250 */ 133 */
251#define dmac_map_area cpu_cache.dma_map_area 134#define dmac_map_area cpu_cache.dma_map_area
252#define dmac_unmap_area cpu_cache.dma_unmap_area 135#define dmac_unmap_area cpu_cache.dma_unmap_area
253#define dmac_flush_range cpu_cache.dma_flush_range 136#define dmac_flush_range cpu_cache.dma_flush_range
254 137
255#else 138#else
256 139
257#define __cpuc_flush_icache_all __glue(_CACHE,_flush_icache_all)
258#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
259#define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
260#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
261#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
262#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
263#define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
264
265extern void __cpuc_flush_icache_all(void); 140extern void __cpuc_flush_icache_all(void);
266extern void __cpuc_flush_kern_all(void); 141extern void __cpuc_flush_kern_all(void);
267extern void __cpuc_flush_user_all(void); 142extern void __cpuc_flush_user_all(void);
@@ -276,10 +151,6 @@ extern void __cpuc_flush_dcache_area(void *, size_t);
276 * is visible to DMA, or data written by DMA to system memory is 151 * is visible to DMA, or data written by DMA to system memory is
277 * visible to the CPU. 152 * visible to the CPU.
278 */ 153 */
279#define dmac_map_area __glue(_CACHE,_dma_map_area)
280#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area)
281#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
282
283extern void dmac_map_area(const void *, size_t, int); 154extern void dmac_map_area(const void *, size_t, int);
284extern void dmac_unmap_area(const void *, size_t, int); 155extern void dmac_unmap_area(const void *, size_t, int);
285extern void dmac_flush_range(const void *, const void *); 156extern void dmac_flush_range(const void *, const void *);
@@ -316,7 +187,8 @@ extern void copy_to_user_page(struct vm_area_struct *, struct page *,
316 * Optimized __flush_icache_all for the common cases. Note that UP ARMv7 187 * Optimized __flush_icache_all for the common cases. Note that UP ARMv7
317 * will fall through to use __flush_icache_all_generic. 188 * will fall through to use __flush_icache_all_generic.
318 */ 189 */
319#if (defined(CONFIG_CPU_V7) && defined(CONFIG_CPU_V6)) || \ 190#if (defined(CONFIG_CPU_V7) && \
191 (defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K))) || \
320 defined(CONFIG_SMP_ON_UP) 192 defined(CONFIG_SMP_ON_UP)
321#define __flush_icache_preferred __cpuc_flush_icache_all 193#define __flush_icache_preferred __cpuc_flush_icache_all
322#elif __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP) 194#elif __LINUX_ARM_ARCH__ >= 7 && defined(CONFIG_SMP)
diff --git a/arch/arm/include/asm/cpu-multi32.h b/arch/arm/include/asm/cpu-multi32.h
deleted file mode 100644
index e2b5b0b2116a..000000000000
--- a/arch/arm/include/asm/cpu-multi32.h
+++ /dev/null
@@ -1,69 +0,0 @@
1/*
2 * arch/arm/include/asm/cpu-multi32.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <asm/page.h>
11
12struct mm_struct;
13
14/*
15 * Don't change this structure - ASM code
16 * relies on it.
17 */
18extern struct processor {
19 /* MISC
20 * get data abort address/flags
21 */
22 void (*_data_abort)(unsigned long pc);
23 /*
24 * Retrieve prefetch fault address
25 */
26 unsigned long (*_prefetch_abort)(unsigned long lr);
27 /*
28 * Set up any processor specifics
29 */
30 void (*_proc_init)(void);
31 /*
32 * Disable any processor specifics
33 */
34 void (*_proc_fin)(void);
35 /*
36 * Special stuff for a reset
37 */
38 void (*reset)(unsigned long addr) __attribute__((noreturn));
39 /*
40 * Idle the processor
41 */
42 int (*_do_idle)(void);
43 /*
44 * Processor architecture specific
45 */
46 /*
47 * clean a virtual address range from the
48 * D-cache without flushing the cache.
49 */
50 void (*dcache_clean_area)(void *addr, int size);
51
52 /*
53 * Set the page table
54 */
55 void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
56 /*
57 * Set a possibly extended PTE. Non-extended PTEs should
58 * ignore 'ext'.
59 */
60 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
61} processor;
62
63#define cpu_proc_init() processor._proc_init()
64#define cpu_proc_fin() processor._proc_fin()
65#define cpu_reset(addr) processor.reset(addr)
66#define cpu_do_idle() processor._do_idle()
67#define cpu_dcache_clean_area(addr,sz) processor.dcache_clean_area(addr,sz)
68#define cpu_set_pte_ext(ptep,pte,ext) processor.set_pte_ext(ptep,pte,ext)
69#define cpu_do_switch_mm(pgd,mm) processor.switch_mm(pgd,mm)
diff --git a/arch/arm/include/asm/cpu-single.h b/arch/arm/include/asm/cpu-single.h
deleted file mode 100644
index f073a6d2a406..000000000000
--- a/arch/arm/include/asm/cpu-single.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * arch/arm/include/asm/cpu-single.h
3 *
4 * Copyright (C) 2000 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10/*
11 * Single CPU
12 */
13#ifdef __STDC__
14#define __catify_fn(name,x) name##x
15#else
16#define __catify_fn(name,x) name/**/x
17#endif
18#define __cpu_fn(name,x) __catify_fn(name,x)
19
20/*
21 * If we are supporting multiple CPUs, then we must use a table of
22 * function pointers for this lot. Otherwise, we can optimise the
23 * table away.
24 */
25#define cpu_proc_init __cpu_fn(CPU_NAME,_proc_init)
26#define cpu_proc_fin __cpu_fn(CPU_NAME,_proc_fin)
27#define cpu_reset __cpu_fn(CPU_NAME,_reset)
28#define cpu_do_idle __cpu_fn(CPU_NAME,_do_idle)
29#define cpu_dcache_clean_area __cpu_fn(CPU_NAME,_dcache_clean_area)
30#define cpu_do_switch_mm __cpu_fn(CPU_NAME,_switch_mm)
31#define cpu_set_pte_ext __cpu_fn(CPU_NAME,_set_pte_ext)
32
33#include <asm/page.h>
34
35struct mm_struct;
36
37/* declare all the functions as extern */
38extern void cpu_proc_init(void);
39extern void cpu_proc_fin(void);
40extern int cpu_do_idle(void);
41extern void cpu_dcache_clean_area(void *, int);
42extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
43extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
44extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
index 20ae96cc0020..ed5bc9e05a4e 100644
--- a/arch/arm/include/asm/cputype.h
+++ b/arch/arm/include/asm/cputype.h
@@ -23,6 +23,8 @@
23#define CPUID_EXT_ISAR4 "c2, 4" 23#define CPUID_EXT_ISAR4 "c2, 4"
24#define CPUID_EXT_ISAR5 "c2, 5" 24#define CPUID_EXT_ISAR5 "c2, 5"
25 25
26extern unsigned int processor_id;
27
26#ifdef CONFIG_CPU_CP15 28#ifdef CONFIG_CPU_CP15
27#define read_cpuid(reg) \ 29#define read_cpuid(reg) \
28 ({ \ 30 ({ \
@@ -43,7 +45,6 @@
43 __val; \ 45 __val; \
44 }) 46 })
45#else 47#else
46extern unsigned int processor_id;
47#define read_cpuid(reg) (processor_id) 48#define read_cpuid(reg) (processor_id)
48#define read_cpuid_ext(reg) 0 49#define read_cpuid_ext(reg) 0
49#endif 50#endif
diff --git a/arch/arm/include/asm/fncpy.h b/arch/arm/include/asm/fncpy.h
new file mode 100644
index 000000000000..de5354746924
--- /dev/null
+++ b/arch/arm/include/asm/fncpy.h
@@ -0,0 +1,94 @@
1/*
2 * arch/arm/include/asm/fncpy.h - helper macros for function body copying
3 *
4 * Copyright (C) 2011 Linaro 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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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/*
21 * These macros are intended for use when there is a need to copy a low-level
22 * function body into special memory.
23 *
24 * For example, when reconfiguring the SDRAM controller, the code doing the
25 * reconfiguration may need to run from SRAM.
26 *
27 * NOTE: that the copied function body must be entirely self-contained and
28 * position-independent in order for this to work properly.
29 *
30 * NOTE: in order for embedded literals and data to get referenced correctly,
31 * the alignment of functions must be preserved when copying. To ensure this,
32 * the source and destination addresses for fncpy() must be aligned to a
33 * multiple of 8 bytes: you will be get a BUG() if this condition is not met.
34 * You will typically need a ".align 3" directive in the assembler where the
35 * function to be copied is defined, and ensure that your allocator for the
36 * destination buffer returns 8-byte-aligned pointers.
37 *
38 * Typical usage example:
39 *
40 * extern int f(args);
41 * extern uint32_t size_of_f;
42 * int (*copied_f)(args);
43 * void *sram_buffer;
44 *
45 * copied_f = fncpy(sram_buffer, &f, size_of_f);
46 *
47 * ... later, call the function: ...
48 *
49 * copied_f(args);
50 *
51 * The size of the function to be copied can't be determined from C:
52 * this must be determined by other means, such as adding assmbler directives
53 * in the file where f is defined.
54 */
55
56#ifndef __ASM_FNCPY_H
57#define __ASM_FNCPY_H
58
59#include <linux/types.h>
60#include <linux/string.h>
61
62#include <asm/bug.h>
63#include <asm/cacheflush.h>
64
65/*
66 * Minimum alignment requirement for the source and destination addresses
67 * for function copying.
68 */
69#define FNCPY_ALIGN 8
70
71#define fncpy(dest_buf, funcp, size) ({ \
72 uintptr_t __funcp_address; \
73 typeof(funcp) __result; \
74 \
75 asm("" : "=r" (__funcp_address) : "0" (funcp)); \
76 \
77 /* \
78 * Ensure alignment of source and destination addresses, \
79 * disregarding the function's Thumb bit: \
80 */ \
81 BUG_ON((uintptr_t)(dest_buf) & (FNCPY_ALIGN - 1) || \
82 (__funcp_address & ~(uintptr_t)1 & (FNCPY_ALIGN - 1))); \
83 \
84 memcpy(dest_buf, (void const *)(__funcp_address & ~1), size); \
85 flush_icache_range((unsigned long)(dest_buf), \
86 (unsigned long)(dest_buf) + (size)); \
87 \
88 asm("" : "=r" (__result) \
89 : "0" ((uintptr_t)(dest_buf) | (__funcp_address & 1))); \
90 \
91 __result; \
92})
93
94#endif /* !__ASM_FNCPY_H */
diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h
new file mode 100644
index 000000000000..c7afbc552c7f
--- /dev/null
+++ b/arch/arm/include/asm/glue-cache.h
@@ -0,0 +1,146 @@
1/*
2 * arch/arm/include/asm/glue-cache.h
3 *
4 * Copyright (C) 1999-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef ASM_GLUE_CACHE_H
11#define ASM_GLUE_CACHE_H
12
13#include <asm/glue.h>
14
15/*
16 * Cache Model
17 * ===========
18 */
19#undef _CACHE
20#undef MULTI_CACHE
21
22#if defined(CONFIG_CPU_CACHE_V3)
23# ifdef _CACHE
24# define MULTI_CACHE 1
25# else
26# define _CACHE v3
27# endif
28#endif
29
30#if defined(CONFIG_CPU_CACHE_V4)
31# ifdef _CACHE
32# define MULTI_CACHE 1
33# else
34# define _CACHE v4
35# endif
36#endif
37
38#if defined(CONFIG_CPU_ARM920T) || defined(CONFIG_CPU_ARM922T) || \
39 defined(CONFIG_CPU_ARM925T) || defined(CONFIG_CPU_ARM1020) || \
40 defined(CONFIG_CPU_ARM1026)
41# define MULTI_CACHE 1
42#endif
43
44#if defined(CONFIG_CPU_FA526)
45# ifdef _CACHE
46# define MULTI_CACHE 1
47# else
48# define _CACHE fa
49# endif
50#endif
51
52#if defined(CONFIG_CPU_ARM926T)
53# ifdef _CACHE
54# define MULTI_CACHE 1
55# else
56# define _CACHE arm926
57# endif
58#endif
59
60#if defined(CONFIG_CPU_ARM940T)
61# ifdef _CACHE
62# define MULTI_CACHE 1
63# else
64# define _CACHE arm940
65# endif
66#endif
67
68#if defined(CONFIG_CPU_ARM946E)
69# ifdef _CACHE
70# define MULTI_CACHE 1
71# else
72# define _CACHE arm946
73# endif
74#endif
75
76#if defined(CONFIG_CPU_CACHE_V4WB)
77# ifdef _CACHE
78# define MULTI_CACHE 1
79# else
80# define _CACHE v4wb
81# endif
82#endif
83
84#if defined(CONFIG_CPU_XSCALE)
85# ifdef _CACHE
86# define MULTI_CACHE 1
87# else
88# define _CACHE xscale
89# endif
90#endif
91
92#if defined(CONFIG_CPU_XSC3)
93# ifdef _CACHE
94# define MULTI_CACHE 1
95# else
96# define _CACHE xsc3
97# endif
98#endif
99
100#if defined(CONFIG_CPU_MOHAWK)
101# ifdef _CACHE
102# define MULTI_CACHE 1
103# else
104# define _CACHE mohawk
105# endif
106#endif
107
108#if defined(CONFIG_CPU_FEROCEON)
109# define MULTI_CACHE 1
110#endif
111
112#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
113//# ifdef _CACHE
114# define MULTI_CACHE 1
115//# else
116//# define _CACHE v6
117//# endif
118#endif
119
120#if defined(CONFIG_CPU_V7)
121//# ifdef _CACHE
122# define MULTI_CACHE 1
123//# else
124//# define _CACHE v7
125//# endif
126#endif
127
128#if !defined(_CACHE) && !defined(MULTI_CACHE)
129#error Unknown cache maintainence model
130#endif
131
132#ifndef MULTI_CACHE
133#define __cpuc_flush_icache_all __glue(_CACHE,_flush_icache_all)
134#define __cpuc_flush_kern_all __glue(_CACHE,_flush_kern_cache_all)
135#define __cpuc_flush_user_all __glue(_CACHE,_flush_user_cache_all)
136#define __cpuc_flush_user_range __glue(_CACHE,_flush_user_cache_range)
137#define __cpuc_coherent_kern_range __glue(_CACHE,_coherent_kern_range)
138#define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range)
139#define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area)
140
141#define dmac_map_area __glue(_CACHE,_dma_map_area)
142#define dmac_unmap_area __glue(_CACHE,_dma_unmap_area)
143#define dmac_flush_range __glue(_CACHE,_dma_flush_range)
144#endif
145
146#endif
diff --git a/arch/arm/include/asm/glue-df.h b/arch/arm/include/asm/glue-df.h
new file mode 100644
index 000000000000..354d571e8bcc
--- /dev/null
+++ b/arch/arm/include/asm/glue-df.h
@@ -0,0 +1,110 @@
1/*
2 * arch/arm/include/asm/glue-df.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000-2002 Deep Blue Solutions Ltd.
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#ifndef ASM_GLUE_DF_H
12#define ASM_GLUE_DF_H
13
14#include <asm/glue.h>
15
16/*
17 * Data Abort Model
18 * ================
19 *
20 * We have the following to choose from:
21 * arm6 - ARM6 style
22 * arm7 - ARM7 style
23 * v4_early - ARMv4 without Thumb early abort handler
24 * v4t_late - ARMv4 with Thumb late abort handler
25 * v4t_early - ARMv4 with Thumb early abort handler
26 * v5tej_early - ARMv5 with Thumb and Java early abort handler
27 * xscale - ARMv5 with Thumb with Xscale extensions
28 * v6_early - ARMv6 generic early abort handler
29 * v7_early - ARMv7 generic early abort handler
30 */
31#undef CPU_DABORT_HANDLER
32#undef MULTI_DABORT
33
34#if defined(CONFIG_CPU_ARM610)
35# ifdef CPU_DABORT_HANDLER
36# define MULTI_DABORT 1
37# else
38# define CPU_DABORT_HANDLER cpu_arm6_data_abort
39# endif
40#endif
41
42#if defined(CONFIG_CPU_ARM710)
43# ifdef CPU_DABORT_HANDLER
44# define MULTI_DABORT 1
45# else
46# define CPU_DABORT_HANDLER cpu_arm7_data_abort
47# endif
48#endif
49
50#ifdef CONFIG_CPU_ABRT_LV4T
51# ifdef CPU_DABORT_HANDLER
52# define MULTI_DABORT 1
53# else
54# define CPU_DABORT_HANDLER v4t_late_abort
55# endif
56#endif
57
58#ifdef CONFIG_CPU_ABRT_EV4
59# ifdef CPU_DABORT_HANDLER
60# define MULTI_DABORT 1
61# else
62# define CPU_DABORT_HANDLER v4_early_abort
63# endif
64#endif
65
66#ifdef CONFIG_CPU_ABRT_EV4T
67# ifdef CPU_DABORT_HANDLER
68# define MULTI_DABORT 1
69# else
70# define CPU_DABORT_HANDLER v4t_early_abort
71# endif
72#endif
73
74#ifdef CONFIG_CPU_ABRT_EV5TJ
75# ifdef CPU_DABORT_HANDLER
76# define MULTI_DABORT 1
77# else
78# define CPU_DABORT_HANDLER v5tj_early_abort
79# endif
80#endif
81
82#ifdef CONFIG_CPU_ABRT_EV5T
83# ifdef CPU_DABORT_HANDLER
84# define MULTI_DABORT 1
85# else
86# define CPU_DABORT_HANDLER v5t_early_abort
87# endif
88#endif
89
90#ifdef CONFIG_CPU_ABRT_EV6
91# ifdef CPU_DABORT_HANDLER
92# define MULTI_DABORT 1
93# else
94# define CPU_DABORT_HANDLER v6_early_abort
95# endif
96#endif
97
98#ifdef CONFIG_CPU_ABRT_EV7
99# ifdef CPU_DABORT_HANDLER
100# define MULTI_DABORT 1
101# else
102# define CPU_DABORT_HANDLER v7_early_abort
103# endif
104#endif
105
106#ifndef CPU_DABORT_HANDLER
107#error Unknown data abort handler type
108#endif
109
110#endif
diff --git a/arch/arm/include/asm/glue-pf.h b/arch/arm/include/asm/glue-pf.h
new file mode 100644
index 000000000000..d385f37c13f0
--- /dev/null
+++ b/arch/arm/include/asm/glue-pf.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/include/asm/glue-pf.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000-2002 Deep Blue Solutions Ltd.
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#ifndef ASM_GLUE_PF_H
12#define ASM_GLUE_PF_H
13
14#include <asm/glue.h>
15
16/*
17 * Prefetch Abort Model
18 * ================
19 *
20 * We have the following to choose from:
21 * legacy - no IFSR, no IFAR
22 * v6 - ARMv6: IFSR, no IFAR
23 * v7 - ARMv7: IFSR and IFAR
24 */
25
26#undef CPU_PABORT_HANDLER
27#undef MULTI_PABORT
28
29#ifdef CONFIG_CPU_PABRT_LEGACY
30# ifdef CPU_PABORT_HANDLER
31# define MULTI_PABORT 1
32# else
33# define CPU_PABORT_HANDLER legacy_pabort
34# endif
35#endif
36
37#ifdef CONFIG_CPU_PABRT_V6
38# ifdef CPU_PABORT_HANDLER
39# define MULTI_PABORT 1
40# else
41# define CPU_PABORT_HANDLER v6_pabort
42# endif
43#endif
44
45#ifdef CONFIG_CPU_PABRT_V7
46# ifdef CPU_PABORT_HANDLER
47# define MULTI_PABORT 1
48# else
49# define CPU_PABORT_HANDLER v7_pabort
50# endif
51#endif
52
53#ifndef CPU_PABORT_HANDLER
54#error Unknown prefetch abort handler type
55#endif
56
57#endif
diff --git a/arch/arm/include/asm/glue-proc.h b/arch/arm/include/asm/glue-proc.h
new file mode 100644
index 000000000000..e2be7f142668
--- /dev/null
+++ b/arch/arm/include/asm/glue-proc.h
@@ -0,0 +1,264 @@
1/*
2 * arch/arm/include/asm/glue-proc.h
3 *
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
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#ifndef ASM_GLUE_PROC_H
12#define ASM_GLUE_PROC_H
13
14#include <asm/glue.h>
15
16/*
17 * Work out if we need multiple CPU support
18 */
19#undef MULTI_CPU
20#undef CPU_NAME
21
22/*
23 * CPU_NAME - the prefix for CPU related functions
24 */
25
26#ifdef CONFIG_CPU_ARM610
27# ifdef CPU_NAME
28# undef MULTI_CPU
29# define MULTI_CPU
30# else
31# define CPU_NAME cpu_arm6
32# endif
33#endif
34
35#ifdef CONFIG_CPU_ARM7TDMI
36# ifdef CPU_NAME
37# undef MULTI_CPU
38# define MULTI_CPU
39# else
40# define CPU_NAME cpu_arm7tdmi
41# endif
42#endif
43
44#ifdef CONFIG_CPU_ARM710
45# ifdef CPU_NAME
46# undef MULTI_CPU
47# define MULTI_CPU
48# else
49# define CPU_NAME cpu_arm7
50# endif
51#endif
52
53#ifdef CONFIG_CPU_ARM720T
54# ifdef CPU_NAME
55# undef MULTI_CPU
56# define MULTI_CPU
57# else
58# define CPU_NAME cpu_arm720
59# endif
60#endif
61
62#ifdef CONFIG_CPU_ARM740T
63# ifdef CPU_NAME
64# undef MULTI_CPU
65# define MULTI_CPU
66# else
67# define CPU_NAME cpu_arm740
68# endif
69#endif
70
71#ifdef CONFIG_CPU_ARM9TDMI
72# ifdef CPU_NAME
73# undef MULTI_CPU
74# define MULTI_CPU
75# else
76# define CPU_NAME cpu_arm9tdmi
77# endif
78#endif
79
80#ifdef CONFIG_CPU_ARM920T
81# ifdef CPU_NAME
82# undef MULTI_CPU
83# define MULTI_CPU
84# else
85# define CPU_NAME cpu_arm920
86# endif
87#endif
88
89#ifdef CONFIG_CPU_ARM922T
90# ifdef CPU_NAME
91# undef MULTI_CPU
92# define MULTI_CPU
93# else
94# define CPU_NAME cpu_arm922
95# endif
96#endif
97
98#ifdef CONFIG_CPU_FA526
99# ifdef CPU_NAME
100# undef MULTI_CPU
101# define MULTI_CPU
102# else
103# define CPU_NAME cpu_fa526
104# endif
105#endif
106
107#ifdef CONFIG_CPU_ARM925T
108# ifdef CPU_NAME
109# undef MULTI_CPU
110# define MULTI_CPU
111# else
112# define CPU_NAME cpu_arm925
113# endif
114#endif
115
116#ifdef CONFIG_CPU_ARM926T
117# ifdef CPU_NAME
118# undef MULTI_CPU
119# define MULTI_CPU
120# else
121# define CPU_NAME cpu_arm926
122# endif
123#endif
124
125#ifdef CONFIG_CPU_ARM940T
126# ifdef CPU_NAME
127# undef MULTI_CPU
128# define MULTI_CPU
129# else
130# define CPU_NAME cpu_arm940
131# endif
132#endif
133
134#ifdef CONFIG_CPU_ARM946E
135# ifdef CPU_NAME
136# undef MULTI_CPU
137# define MULTI_CPU
138# else
139# define CPU_NAME cpu_arm946
140# endif
141#endif
142
143#ifdef CONFIG_CPU_SA110
144# ifdef CPU_NAME
145# undef MULTI_CPU
146# define MULTI_CPU
147# else
148# define CPU_NAME cpu_sa110
149# endif
150#endif
151
152#ifdef CONFIG_CPU_SA1100
153# ifdef CPU_NAME
154# undef MULTI_CPU
155# define MULTI_CPU
156# else
157# define CPU_NAME cpu_sa1100
158# endif
159#endif
160
161#ifdef CONFIG_CPU_ARM1020
162# ifdef CPU_NAME
163# undef MULTI_CPU
164# define MULTI_CPU
165# else
166# define CPU_NAME cpu_arm1020
167# endif
168#endif
169
170#ifdef CONFIG_CPU_ARM1020E
171# ifdef CPU_NAME
172# undef MULTI_CPU
173# define MULTI_CPU
174# else
175# define CPU_NAME cpu_arm1020e
176# endif
177#endif
178
179#ifdef CONFIG_CPU_ARM1022
180# ifdef CPU_NAME
181# undef MULTI_CPU
182# define MULTI_CPU
183# else
184# define CPU_NAME cpu_arm1022
185# endif
186#endif
187
188#ifdef CONFIG_CPU_ARM1026
189# ifdef CPU_NAME
190# undef MULTI_CPU
191# define MULTI_CPU
192# else
193# define CPU_NAME cpu_arm1026
194# endif
195#endif
196
197#ifdef CONFIG_CPU_XSCALE
198# ifdef CPU_NAME
199# undef MULTI_CPU
200# define MULTI_CPU
201# else
202# define CPU_NAME cpu_xscale
203# endif
204#endif
205
206#ifdef CONFIG_CPU_XSC3
207# ifdef CPU_NAME
208# undef MULTI_CPU
209# define MULTI_CPU
210# else
211# define CPU_NAME cpu_xsc3
212# endif
213#endif
214
215#ifdef CONFIG_CPU_MOHAWK
216# ifdef CPU_NAME
217# undef MULTI_CPU
218# define MULTI_CPU
219# else
220# define CPU_NAME cpu_mohawk
221# endif
222#endif
223
224#ifdef CONFIG_CPU_FEROCEON
225# ifdef CPU_NAME
226# undef MULTI_CPU
227# define MULTI_CPU
228# else
229# define CPU_NAME cpu_feroceon
230# endif
231#endif
232
233#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
234# ifdef CPU_NAME
235# undef MULTI_CPU
236# define MULTI_CPU
237# else
238# define CPU_NAME cpu_v6
239# endif
240#endif
241
242#ifdef CONFIG_CPU_V7
243# ifdef CPU_NAME
244# undef MULTI_CPU
245# define MULTI_CPU
246# else
247# define CPU_NAME cpu_v7
248# endif
249#endif
250
251#ifndef MULTI_CPU
252#define cpu_proc_init __glue(CPU_NAME,_proc_init)
253#define cpu_proc_fin __glue(CPU_NAME,_proc_fin)
254#define cpu_reset __glue(CPU_NAME,_reset)
255#define cpu_do_idle __glue(CPU_NAME,_do_idle)
256#define cpu_dcache_clean_area __glue(CPU_NAME,_dcache_clean_area)
257#define cpu_do_switch_mm __glue(CPU_NAME,_switch_mm)
258#define cpu_set_pte_ext __glue(CPU_NAME,_set_pte_ext)
259#define cpu_suspend_size __glue(CPU_NAME,_suspend_size)
260#define cpu_do_suspend __glue(CPU_NAME,_do_suspend)
261#define cpu_do_resume __glue(CPU_NAME,_do_resume)
262#endif
263
264#endif
diff --git a/arch/arm/include/asm/glue.h b/arch/arm/include/asm/glue.h
index 234a3fc1c78e..0ec35d1698aa 100644
--- a/arch/arm/include/asm/glue.h
+++ b/arch/arm/include/asm/glue.h
@@ -15,7 +15,6 @@
15 */ 15 */
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17 17
18
19#ifdef __STDC__ 18#ifdef __STDC__
20#define ____glue(name,fn) name##fn 19#define ____glue(name,fn) name##fn
21#else 20#else
@@ -23,141 +22,4 @@
23#endif 22#endif
24#define __glue(name,fn) ____glue(name,fn) 23#define __glue(name,fn) ____glue(name,fn)
25 24
26
27
28/*
29 * Data Abort Model
30 * ================
31 *
32 * We have the following to choose from:
33 * arm6 - ARM6 style
34 * arm7 - ARM7 style
35 * v4_early - ARMv4 without Thumb early abort handler
36 * v4t_late - ARMv4 with Thumb late abort handler
37 * v4t_early - ARMv4 with Thumb early abort handler
38 * v5tej_early - ARMv5 with Thumb and Java early abort handler
39 * xscale - ARMv5 with Thumb with Xscale extensions
40 * v6_early - ARMv6 generic early abort handler
41 * v7_early - ARMv7 generic early abort handler
42 */
43#undef CPU_DABORT_HANDLER
44#undef MULTI_DABORT
45
46#if defined(CONFIG_CPU_ARM610)
47# ifdef CPU_DABORT_HANDLER
48# define MULTI_DABORT 1
49# else
50# define CPU_DABORT_HANDLER cpu_arm6_data_abort
51# endif
52#endif
53
54#if defined(CONFIG_CPU_ARM710)
55# ifdef CPU_DABORT_HANDLER
56# define MULTI_DABORT 1
57# else
58# define CPU_DABORT_HANDLER cpu_arm7_data_abort
59# endif
60#endif
61
62#ifdef CONFIG_CPU_ABRT_LV4T
63# ifdef CPU_DABORT_HANDLER
64# define MULTI_DABORT 1
65# else
66# define CPU_DABORT_HANDLER v4t_late_abort
67# endif
68#endif
69
70#ifdef CONFIG_CPU_ABRT_EV4
71# ifdef CPU_DABORT_HANDLER
72# define MULTI_DABORT 1
73# else
74# define CPU_DABORT_HANDLER v4_early_abort
75# endif
76#endif
77
78#ifdef CONFIG_CPU_ABRT_EV4T
79# ifdef CPU_DABORT_HANDLER
80# define MULTI_DABORT 1
81# else
82# define CPU_DABORT_HANDLER v4t_early_abort
83# endif
84#endif
85
86#ifdef CONFIG_CPU_ABRT_EV5TJ
87# ifdef CPU_DABORT_HANDLER
88# define MULTI_DABORT 1
89# else
90# define CPU_DABORT_HANDLER v5tj_early_abort
91# endif
92#endif
93
94#ifdef CONFIG_CPU_ABRT_EV5T
95# ifdef CPU_DABORT_HANDLER
96# define MULTI_DABORT 1
97# else
98# define CPU_DABORT_HANDLER v5t_early_abort
99# endif
100#endif
101
102#ifdef CONFIG_CPU_ABRT_EV6
103# ifdef CPU_DABORT_HANDLER
104# define MULTI_DABORT 1
105# else
106# define CPU_DABORT_HANDLER v6_early_abort
107# endif
108#endif
109
110#ifdef CONFIG_CPU_ABRT_EV7
111# ifdef CPU_DABORT_HANDLER
112# define MULTI_DABORT 1
113# else
114# define CPU_DABORT_HANDLER v7_early_abort
115# endif
116#endif
117
118#ifndef CPU_DABORT_HANDLER
119#error Unknown data abort handler type
120#endif
121
122/*
123 * Prefetch Abort Model
124 * ================
125 *
126 * We have the following to choose from:
127 * legacy - no IFSR, no IFAR
128 * v6 - ARMv6: IFSR, no IFAR
129 * v7 - ARMv7: IFSR and IFAR
130 */
131
132#undef CPU_PABORT_HANDLER
133#undef MULTI_PABORT
134
135#ifdef CONFIG_CPU_PABRT_LEGACY
136# ifdef CPU_PABORT_HANDLER
137# define MULTI_PABORT 1
138# else
139# define CPU_PABORT_HANDLER legacy_pabort
140# endif
141#endif
142
143#ifdef CONFIG_CPU_PABRT_V6
144# ifdef CPU_PABORT_HANDLER
145# define MULTI_PABORT 1
146# else
147# define CPU_PABORT_HANDLER v6_pabort
148# endif
149#endif
150
151#ifdef CONFIG_CPU_PABRT_V7
152# ifdef CPU_PABORT_HANDLER
153# define MULTI_PABORT 1
154# else
155# define CPU_PABORT_HANDLER v7_pabort
156# endif
157#endif
158
159#ifndef CPU_PABORT_HANDLER
160#error Unknown prefetch abort handler type
161#endif
162
163#endif 25#endif
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 5aeec1e1735c..16bd48031583 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -36,6 +36,7 @@
36#define L2X0_RAW_INTR_STAT 0x21C 36#define L2X0_RAW_INTR_STAT 0x21C
37#define L2X0_INTR_CLEAR 0x220 37#define L2X0_INTR_CLEAR 0x220
38#define L2X0_CACHE_SYNC 0x730 38#define L2X0_CACHE_SYNC 0x730
39#define L2X0_DUMMY_REG 0x740
39#define L2X0_INV_LINE_PA 0x770 40#define L2X0_INV_LINE_PA 0x770
40#define L2X0_INV_WAY 0x77C 41#define L2X0_INV_WAY 0x77C
41#define L2X0_CLEAN_LINE_PA 0x7B0 42#define L2X0_CLEAN_LINE_PA 0x7B0
diff --git a/arch/arm/include/asm/hardware/gic.h b/arch/arm/include/asm/hardware/gic.h
index 84557d321001..0691f9dcc500 100644
--- a/arch/arm/include/asm/hardware/gic.h
+++ b/arch/arm/include/asm/hardware/gic.h
@@ -34,6 +34,7 @@
34 34
35#ifndef __ASSEMBLY__ 35#ifndef __ASSEMBLY__
36extern void __iomem *gic_cpu_base_addr; 36extern void __iomem *gic_cpu_base_addr;
37extern struct irq_chip gic_arch_extn;
37 38
38void gic_init(unsigned int, unsigned int, void __iomem *, void __iomem *); 39void gic_init(unsigned int, unsigned int, void __iomem *, void __iomem *);
39void gic_secondary_init(unsigned int); 40void gic_secondary_init(unsigned int);
diff --git a/arch/arm/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h
index 721847dc68ab..e0d1c0cfa548 100644
--- a/arch/arm/include/asm/hardware/sp810.h
+++ b/arch/arm/include/asm/hardware/sp810.h
@@ -58,6 +58,9 @@
58 58
59static inline void sysctl_soft_reset(void __iomem *base) 59static inline void sysctl_soft_reset(void __iomem *base)
60{ 60{
61 /* switch to slow mode */
62 writel(0x2, base + SCCTRL);
63
61 /* writing any value to SCSYSSTAT reg will reset system */ 64 /* writing any value to SCSYSSTAT reg will reset system */
62 writel(0, base + SCSYSSTAT); 65 writel(0, base + SCSYSSTAT);
63} 66}
diff --git a/arch/arm/include/asm/highmem.h b/arch/arm/include/asm/highmem.h
index 7080e2c8fa62..a4edd19dd3d6 100644
--- a/arch/arm/include/asm/highmem.h
+++ b/arch/arm/include/asm/highmem.h
@@ -19,11 +19,36 @@
19 19
20extern pte_t *pkmap_page_table; 20extern pte_t *pkmap_page_table;
21 21
22extern void *kmap_high(struct page *page);
23extern void kunmap_high(struct page *page);
24
25/*
26 * The reason for kmap_high_get() is to ensure that the currently kmap'd
27 * page usage count does not decrease to zero while we're using its
28 * existing virtual mapping in an atomic context. With a VIVT cache this
29 * is essential to do, but with a VIPT cache this is only an optimization
30 * so not to pay the price of establishing a second mapping if an existing
31 * one can be used. However, on platforms without hardware TLB maintenance
32 * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
33 * the locking involved must also disable IRQs which is incompatible with
34 * the IPI mechanism used by global TLB operations.
35 */
22#define ARCH_NEEDS_KMAP_HIGH_GET 36#define ARCH_NEEDS_KMAP_HIGH_GET
37#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
38#undef ARCH_NEEDS_KMAP_HIGH_GET
39#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
40#error "The sum of features in your kernel config cannot be supported together"
41#endif
42#endif
23 43
24extern void *kmap_high(struct page *page); 44#ifdef ARCH_NEEDS_KMAP_HIGH_GET
25extern void *kmap_high_get(struct page *page); 45extern void *kmap_high_get(struct page *page);
26extern void kunmap_high(struct page *page); 46#else
47static inline void *kmap_high_get(struct page *page)
48{
49 return NULL;
50}
51#endif
27 52
28/* 53/*
29 * The following functions are already defined by <linux/highmem.h> 54 * The following functions are already defined by <linux/highmem.h>
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 3a0893a76a3b..bf13b814c1b8 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -15,10 +15,6 @@ struct meminfo;
15struct sys_timer; 15struct sys_timer;
16 16
17struct machine_desc { 17struct machine_desc {
18 /*
19 * Note! The first two elements are used
20 * by assembler code in head.S, head-common.S
21 */
22 unsigned int nr; /* architecture number */ 18 unsigned int nr; /* architecture number */
23 const char *name; /* architecture name */ 19 const char *name; /* architecture name */
24 unsigned long boot_params; /* tagged list */ 20 unsigned long boot_params; /* tagged list */
diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h
index 22ac140edd9e..febe495d0c6e 100644
--- a/arch/arm/include/asm/mach/irq.h
+++ b/arch/arm/include/asm/mach/irq.h
@@ -34,4 +34,35 @@ do { \
34 raw_spin_unlock(&desc->lock); \ 34 raw_spin_unlock(&desc->lock); \
35} while(0) 35} while(0)
36 36
37#ifndef __ASSEMBLY__
38/*
39 * Entry/exit functions for chained handlers where the primary IRQ chip
40 * may implement either fasteoi or level-trigger flow control.
41 */
42static inline void chained_irq_enter(struct irq_chip *chip,
43 struct irq_desc *desc)
44{
45 /* FastEOI controllers require no action on entry. */
46 if (chip->irq_eoi)
47 return;
48
49 if (chip->irq_mask_ack) {
50 chip->irq_mask_ack(&desc->irq_data);
51 } else {
52 chip->irq_mask(&desc->irq_data);
53 if (chip->irq_ack)
54 chip->irq_ack(&desc->irq_data);
55 }
56}
57
58static inline void chained_irq_exit(struct irq_chip *chip,
59 struct irq_desc *desc)
60{
61 if (chip->irq_eoi)
62 chip->irq_eoi(&desc->irq_data);
63 else
64 chip->irq_unmask(&desc->irq_data);
65}
66#endif
67
37#endif 68#endif
diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h
index fc1900925275..348d513afa92 100644
--- a/arch/arm/include/asm/outercache.h
+++ b/arch/arm/include/asm/outercache.h
@@ -31,6 +31,7 @@ struct outer_cache_fns {
31#ifdef CONFIG_OUTER_CACHE_SYNC 31#ifdef CONFIG_OUTER_CACHE_SYNC
32 void (*sync)(void); 32 void (*sync)(void);
33#endif 33#endif
34 void (*set_debug)(unsigned long);
34}; 35};
35 36
36#ifdef CONFIG_OUTER_CACHE 37#ifdef CONFIG_OUTER_CACHE
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
index 9763be04f77e..22de005f159c 100644
--- a/arch/arm/include/asm/pgalloc.h
+++ b/arch/arm/include/asm/pgalloc.h
@@ -10,6 +10,8 @@
10#ifndef _ASMARM_PGALLOC_H 10#ifndef _ASMARM_PGALLOC_H
11#define _ASMARM_PGALLOC_H 11#define _ASMARM_PGALLOC_H
12 12
13#include <linux/pagemap.h>
14
13#include <asm/domain.h> 15#include <asm/domain.h>
14#include <asm/pgtable-hwdef.h> 16#include <asm/pgtable-hwdef.h>
15#include <asm/processor.h> 17#include <asm/processor.h>
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
index 8fdae9bc9abb..8ec535e11fd7 100644
--- a/arch/arm/include/asm/proc-fns.h
+++ b/arch/arm/include/asm/proc-fns.h
@@ -13,250 +13,86 @@
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15 15
16#include <asm/glue-proc.h>
17#include <asm/page.h>
16 18
17/* 19#ifndef __ASSEMBLY__
18 * Work out if we need multiple CPU support 20
19 */ 21struct mm_struct;
20#undef MULTI_CPU
21#undef CPU_NAME
22 22
23/* 23/*
24 * CPU_NAME - the prefix for CPU related functions 24 * Don't change this structure - ASM code relies on it.
25 */ 25 */
26 26extern struct processor {
27#ifdef CONFIG_CPU_ARM610 27 /* MISC
28# ifdef CPU_NAME 28 * get data abort address/flags
29# undef MULTI_CPU 29 */
30# define MULTI_CPU 30 void (*_data_abort)(unsigned long pc);
31# else 31 /*
32# define CPU_NAME cpu_arm6 32 * Retrieve prefetch fault address
33# endif 33 */
34#endif 34 unsigned long (*_prefetch_abort)(unsigned long lr);
35 35 /*
36#ifdef CONFIG_CPU_ARM7TDMI 36 * Set up any processor specifics
37# ifdef CPU_NAME 37 */
38# undef MULTI_CPU 38 void (*_proc_init)(void);
39# define MULTI_CPU 39 /*
40# else 40 * Disable any processor specifics
41# define CPU_NAME cpu_arm7tdmi 41 */
42# endif 42 void (*_proc_fin)(void);
43#endif 43 /*
44 44 * Special stuff for a reset
45#ifdef CONFIG_CPU_ARM710 45 */
46# ifdef CPU_NAME 46 void (*reset)(unsigned long addr) __attribute__((noreturn));
47# undef MULTI_CPU 47 /*
48# define MULTI_CPU 48 * Idle the processor
49# else 49 */
50# define CPU_NAME cpu_arm7 50 int (*_do_idle)(void);
51# endif 51 /*
52#endif 52 * Processor architecture specific
53 53 */
54#ifdef CONFIG_CPU_ARM720T 54 /*
55# ifdef CPU_NAME 55 * clean a virtual address range from the
56# undef MULTI_CPU 56 * D-cache without flushing the cache.
57# define MULTI_CPU 57 */
58# else 58 void (*dcache_clean_area)(void *addr, int size);
59# define CPU_NAME cpu_arm720 59
60# endif 60 /*
61#endif 61 * Set the page table
62 62 */
63#ifdef CONFIG_CPU_ARM740T 63 void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
64# ifdef CPU_NAME 64 /*
65# undef MULTI_CPU 65 * Set a possibly extended PTE. Non-extended PTEs should
66# define MULTI_CPU 66 * ignore 'ext'.
67# else 67 */
68# define CPU_NAME cpu_arm740 68 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
69# endif 69
70#endif 70 /* Suspend/resume */
71 71 unsigned int suspend_size;
72#ifdef CONFIG_CPU_ARM9TDMI 72 void (*do_suspend)(void *);
73# ifdef CPU_NAME 73 void (*do_resume)(void *);
74# undef MULTI_CPU 74} processor;
75# define MULTI_CPU
76# else
77# define CPU_NAME cpu_arm9tdmi
78# endif
79#endif
80
81#ifdef CONFIG_CPU_ARM920T
82# ifdef CPU_NAME
83# undef MULTI_CPU
84# define MULTI_CPU
85# else
86# define CPU_NAME cpu_arm920
87# endif
88#endif
89
90#ifdef CONFIG_CPU_ARM922T
91# ifdef CPU_NAME
92# undef MULTI_CPU
93# define MULTI_CPU
94# else
95# define CPU_NAME cpu_arm922
96# endif
97#endif
98
99#ifdef CONFIG_CPU_FA526
100# ifdef CPU_NAME
101# undef MULTI_CPU
102# define MULTI_CPU
103# else
104# define CPU_NAME cpu_fa526
105# endif
106#endif
107
108#ifdef CONFIG_CPU_ARM925T
109# ifdef CPU_NAME
110# undef MULTI_CPU
111# define MULTI_CPU
112# else
113# define CPU_NAME cpu_arm925
114# endif
115#endif
116
117#ifdef CONFIG_CPU_ARM926T
118# ifdef CPU_NAME
119# undef MULTI_CPU
120# define MULTI_CPU
121# else
122# define CPU_NAME cpu_arm926
123# endif
124#endif
125
126#ifdef CONFIG_CPU_ARM940T
127# ifdef CPU_NAME
128# undef MULTI_CPU
129# define MULTI_CPU
130# else
131# define CPU_NAME cpu_arm940
132# endif
133#endif
134
135#ifdef CONFIG_CPU_ARM946E
136# ifdef CPU_NAME
137# undef MULTI_CPU
138# define MULTI_CPU
139# else
140# define CPU_NAME cpu_arm946
141# endif
142#endif
143
144#ifdef CONFIG_CPU_SA110
145# ifdef CPU_NAME
146# undef MULTI_CPU
147# define MULTI_CPU
148# else
149# define CPU_NAME cpu_sa110
150# endif
151#endif
152
153#ifdef CONFIG_CPU_SA1100
154# ifdef CPU_NAME
155# undef MULTI_CPU
156# define MULTI_CPU
157# else
158# define CPU_NAME cpu_sa1100
159# endif
160#endif
161
162#ifdef CONFIG_CPU_ARM1020
163# ifdef CPU_NAME
164# undef MULTI_CPU
165# define MULTI_CPU
166# else
167# define CPU_NAME cpu_arm1020
168# endif
169#endif
170
171#ifdef CONFIG_CPU_ARM1020E
172# ifdef CPU_NAME
173# undef MULTI_CPU
174# define MULTI_CPU
175# else
176# define CPU_NAME cpu_arm1020e
177# endif
178#endif
179
180#ifdef CONFIG_CPU_ARM1022
181# ifdef CPU_NAME
182# undef MULTI_CPU
183# define MULTI_CPU
184# else
185# define CPU_NAME cpu_arm1022
186# endif
187#endif
188
189#ifdef CONFIG_CPU_ARM1026
190# ifdef CPU_NAME
191# undef MULTI_CPU
192# define MULTI_CPU
193# else
194# define CPU_NAME cpu_arm1026
195# endif
196#endif
197
198#ifdef CONFIG_CPU_XSCALE
199# ifdef CPU_NAME
200# undef MULTI_CPU
201# define MULTI_CPU
202# else
203# define CPU_NAME cpu_xscale
204# endif
205#endif
206
207#ifdef CONFIG_CPU_XSC3
208# ifdef CPU_NAME
209# undef MULTI_CPU
210# define MULTI_CPU
211# else
212# define CPU_NAME cpu_xsc3
213# endif
214#endif
215
216#ifdef CONFIG_CPU_MOHAWK
217# ifdef CPU_NAME
218# undef MULTI_CPU
219# define MULTI_CPU
220# else
221# define CPU_NAME cpu_mohawk
222# endif
223#endif
224
225#ifdef CONFIG_CPU_FEROCEON
226# ifdef CPU_NAME
227# undef MULTI_CPU
228# define MULTI_CPU
229# else
230# define CPU_NAME cpu_feroceon
231# endif
232#endif
233
234#ifdef CONFIG_CPU_V6
235# ifdef CPU_NAME
236# undef MULTI_CPU
237# define MULTI_CPU
238# else
239# define CPU_NAME cpu_v6
240# endif
241#endif
242
243#ifdef CONFIG_CPU_V7
244# ifdef CPU_NAME
245# undef MULTI_CPU
246# define MULTI_CPU
247# else
248# define CPU_NAME cpu_v7
249# endif
250#endif
251
252#ifndef __ASSEMBLY__
253 75
254#ifndef MULTI_CPU 76#ifndef MULTI_CPU
255#include <asm/cpu-single.h> 77extern void cpu_proc_init(void);
78extern void cpu_proc_fin(void);
79extern int cpu_do_idle(void);
80extern void cpu_dcache_clean_area(void *, int);
81extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
82extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
83extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
256#else 84#else
257#include <asm/cpu-multi32.h> 85#define cpu_proc_init() processor._proc_init()
86#define cpu_proc_fin() processor._proc_fin()
87#define cpu_reset(addr) processor.reset(addr)
88#define cpu_do_idle() processor._do_idle()
89#define cpu_dcache_clean_area(addr,sz) processor.dcache_clean_area(addr,sz)
90#define cpu_set_pte_ext(ptep,pte,ext) processor.set_pte_ext(ptep,pte,ext)
91#define cpu_do_switch_mm(pgd,mm) processor.switch_mm(pgd,mm)
258#endif 92#endif
259 93
94extern void cpu_resume(void);
95
260#include <asm/memory.h> 96#include <asm/memory.h>
261 97
262#ifdef CONFIG_MMU 98#ifdef CONFIG_MMU
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 67357baaeeeb..b2d9df5667af 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -29,19 +29,7 @@
29#define STACK_TOP_MAX TASK_SIZE 29#define STACK_TOP_MAX TASK_SIZE
30#endif 30#endif
31 31
32union debug_insn {
33 u32 arm;
34 u16 thumb;
35};
36
37struct debug_entry {
38 u32 address;
39 union debug_insn insn;
40};
41
42struct debug_info { 32struct debug_info {
43 int nsaved;
44 struct debug_entry bp[2];
45#ifdef CONFIG_HAVE_HW_BREAKPOINT 33#ifdef CONFIG_HAVE_HW_BREAKPOINT
46 struct perf_event *hbp[ARM_MAX_HBP_SLOTS]; 34 struct perf_event *hbp[ARM_MAX_HBP_SLOTS];
47#endif 35#endif
@@ -95,7 +83,7 @@ extern void release_thread(struct task_struct *);
95 83
96unsigned long get_wchan(struct task_struct *p); 84unsigned long get_wchan(struct task_struct *p);
97 85
98#if __LINUX_ARM_ARCH__ == 6 86#if __LINUX_ARM_ARCH__ == 6 || defined(CONFIG_ARM_ERRATA_754327)
99#define cpu_relax() smp_mb() 87#define cpu_relax() smp_mb()
100#else 88#else
101#define cpu_relax() barrier() 89#define cpu_relax() barrier()
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 783d50f32618..a8ff22b2a391 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -130,8 +130,6 @@ struct pt_regs {
130 130
131#ifdef __KERNEL__ 131#ifdef __KERNEL__
132 132
133#define arch_has_single_step() (1)
134
135#define user_mode(regs) \ 133#define user_mode(regs) \
136 (((regs)->ARM_cpsr & 0xf) == 0) 134 (((regs)->ARM_cpsr & 0xf) == 0)
137 135
diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h
index 2376835015d6..4eb6d005ffaa 100644
--- a/arch/arm/include/asm/smp_scu.h
+++ b/arch/arm/include/asm/smp_scu.h
@@ -1,7 +1,14 @@
1#ifndef __ASMARM_ARCH_SCU_H 1#ifndef __ASMARM_ARCH_SCU_H
2#define __ASMARM_ARCH_SCU_H 2#define __ASMARM_ARCH_SCU_H
3 3
4#define SCU_PM_NORMAL 0
5#define SCU_PM_DORMANT 2
6#define SCU_PM_POWEROFF 3
7
8#ifndef __ASSEMBLER__
4unsigned int scu_get_core_count(void __iomem *); 9unsigned int scu_get_core_count(void __iomem *);
5void scu_enable(void __iomem *); 10void scu_enable(void __iomem *);
11int scu_power_mode(void __iomem *, unsigned int);
12#endif
6 13
7#endif 14#endif
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 17eb355707dd..fdd3820edff8 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -5,17 +5,52 @@
5#error SMP not supported on pre-ARMv6 CPUs 5#error SMP not supported on pre-ARMv6 CPUs
6#endif 6#endif
7 7
8/*
9 * sev and wfe are ARMv6K extensions. Uniprocessor ARMv6 may not have the K
10 * extensions, so when running on UP, we have to patch these instructions away.
11 */
12#define ALT_SMP(smp, up) \
13 "9998: " smp "\n" \
14 " .pushsection \".alt.smp.init\", \"a\"\n" \
15 " .long 9998b\n" \
16 " " up "\n" \
17 " .popsection\n"
18
19#ifdef CONFIG_THUMB2_KERNEL
20#define SEV ALT_SMP("sev.w", "nop.w")
21/*
22 * For Thumb-2, special care is needed to ensure that the conditional WFE
23 * instruction really does assemble to exactly 4 bytes (as required by
24 * the SMP_ON_UP fixup code). By itself "wfene" might cause the
25 * assembler to insert a extra (16-bit) IT instruction, depending on the
26 * presence or absence of neighbouring conditional instructions.
27 *
28 * To avoid this unpredictableness, an approprite IT is inserted explicitly:
29 * the assembler won't change IT instructions which are explicitly present
30 * in the input.
31 */
32#define WFE(cond) ALT_SMP( \
33 "it " cond "\n\t" \
34 "wfe" cond ".n", \
35 \
36 "nop.w" \
37)
38#else
39#define SEV ALT_SMP("sev", "nop")
40#define WFE(cond) ALT_SMP("wfe" cond, "nop")
41#endif
42
8static inline void dsb_sev(void) 43static inline void dsb_sev(void)
9{ 44{
10#if __LINUX_ARM_ARCH__ >= 7 45#if __LINUX_ARM_ARCH__ >= 7
11 __asm__ __volatile__ ( 46 __asm__ __volatile__ (
12 "dsb\n" 47 "dsb\n"
13 "sev" 48 SEV
14 ); 49 );
15#elif defined(CONFIG_CPU_32v6K) 50#else
16 __asm__ __volatile__ ( 51 __asm__ __volatile__ (
17 "mcr p15, 0, %0, c7, c10, 4\n" 52 "mcr p15, 0, %0, c7, c10, 4\n"
18 "sev" 53 SEV
19 : : "r" (0) 54 : : "r" (0)
20 ); 55 );
21#endif 56#endif
@@ -46,9 +81,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
46 __asm__ __volatile__( 81 __asm__ __volatile__(
47"1: ldrex %0, [%1]\n" 82"1: ldrex %0, [%1]\n"
48" teq %0, #0\n" 83" teq %0, #0\n"
49#ifdef CONFIG_CPU_32v6K 84 WFE("ne")
50" wfene\n"
51#endif
52" strexeq %0, %2, [%1]\n" 85" strexeq %0, %2, [%1]\n"
53" teqeq %0, #0\n" 86" teqeq %0, #0\n"
54" bne 1b" 87" bne 1b"
@@ -107,9 +140,7 @@ static inline void arch_write_lock(arch_rwlock_t *rw)
107 __asm__ __volatile__( 140 __asm__ __volatile__(
108"1: ldrex %0, [%1]\n" 141"1: ldrex %0, [%1]\n"
109" teq %0, #0\n" 142" teq %0, #0\n"
110#ifdef CONFIG_CPU_32v6K 143 WFE("ne")
111" wfene\n"
112#endif
113" strexeq %0, %2, [%1]\n" 144" strexeq %0, %2, [%1]\n"
114" teq %0, #0\n" 145" teq %0, #0\n"
115" bne 1b" 146" bne 1b"
@@ -176,9 +207,7 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
176"1: ldrex %0, [%2]\n" 207"1: ldrex %0, [%2]\n"
177" adds %0, %0, #1\n" 208" adds %0, %0, #1\n"
178" strexpl %1, %0, [%2]\n" 209" strexpl %1, %0, [%2]\n"
179#ifdef CONFIG_CPU_32v6K 210 WFE("mi")
180" wfemi\n"
181#endif
182" rsbpls %0, %1, #0\n" 211" rsbpls %0, %1, #0\n"
183" bmi 1b" 212" bmi 1b"
184 : "=&r" (tmp), "=&r" (tmp2) 213 : "=&r" (tmp), "=&r" (tmp2)
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 97f6d60297d5..9a87823642d0 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -347,6 +347,7 @@ void cpu_idle_wait(void);
347#include <asm-generic/cmpxchg-local.h> 347#include <asm-generic/cmpxchg-local.h>
348 348
349#if __LINUX_ARM_ARCH__ < 6 349#if __LINUX_ARM_ARCH__ < 6
350/* min ARCH < ARMv6 */
350 351
351#ifdef CONFIG_SMP 352#ifdef CONFIG_SMP
352#error "SMP is not supported on this platform" 353#error "SMP is not supported on this platform"
@@ -365,7 +366,7 @@ void cpu_idle_wait(void);
365#include <asm-generic/cmpxchg.h> 366#include <asm-generic/cmpxchg.h>
366#endif 367#endif
367 368
368#else /* __LINUX_ARM_ARCH__ >= 6 */ 369#else /* min ARCH >= ARMv6 */
369 370
370extern void __bad_cmpxchg(volatile void *ptr, int size); 371extern void __bad_cmpxchg(volatile void *ptr, int size);
371 372
@@ -379,7 +380,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
379 unsigned long oldval, res; 380 unsigned long oldval, res;
380 381
381 switch (size) { 382 switch (size) {
382#ifdef CONFIG_CPU_32v6K 383#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
383 case 1: 384 case 1:
384 do { 385 do {
385 asm volatile("@ __cmpxchg1\n" 386 asm volatile("@ __cmpxchg1\n"
@@ -404,7 +405,7 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
404 : "memory", "cc"); 405 : "memory", "cc");
405 } while (res); 406 } while (res);
406 break; 407 break;
407#endif /* CONFIG_CPU_32v6K */ 408#endif
408 case 4: 409 case 4:
409 do { 410 do {
410 asm volatile("@ __cmpxchg4\n" 411 asm volatile("@ __cmpxchg4\n"
@@ -450,12 +451,12 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
450 unsigned long ret; 451 unsigned long ret;
451 452
452 switch (size) { 453 switch (size) {
453#ifndef CONFIG_CPU_32v6K 454#ifdef CONFIG_CPU_V6 /* min ARCH == ARMv6 */
454 case 1: 455 case 1:
455 case 2: 456 case 2:
456 ret = __cmpxchg_local_generic(ptr, old, new, size); 457 ret = __cmpxchg_local_generic(ptr, old, new, size);
457 break; 458 break;
458#endif /* !CONFIG_CPU_32v6K */ 459#endif
459 default: 460 default:
460 ret = __cmpxchg(ptr, old, new, size); 461 ret = __cmpxchg(ptr, old, new, size);
461 } 462 }
@@ -469,7 +470,7 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
469 (unsigned long)(n), \ 470 (unsigned long)(n), \
470 sizeof(*(ptr)))) 471 sizeof(*(ptr))))
471 472
472#ifdef CONFIG_CPU_32v6K 473#ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */
473 474
474/* 475/*
475 * Note : ARMv7-M (currently unsupported by Linux) does not support 476 * Note : ARMv7-M (currently unsupported by Linux) does not support
@@ -524,11 +525,11 @@ static inline unsigned long long __cmpxchg64_mb(volatile void *ptr,
524 (unsigned long long)(o), \ 525 (unsigned long long)(o), \
525 (unsigned long long)(n))) 526 (unsigned long long)(n)))
526 527
527#else /* !CONFIG_CPU_32v6K */ 528#else /* min ARCH = ARMv6 */
528 529
529#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 530#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
530 531
531#endif /* CONFIG_CPU_32v6K */ 532#endif
532 533
533#endif /* __LINUX_ARM_ARCH__ >= 6 */ 534#endif /* __LINUX_ARM_ARCH__ >= 6 */
534 535
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
index f41a6f57cd12..82dfe5d0c41e 100644
--- a/arch/arm/include/asm/tlb.h
+++ b/arch/arm/include/asm/tlb.h
@@ -18,16 +18,34 @@
18#define __ASMARM_TLB_H 18#define __ASMARM_TLB_H
19 19
20#include <asm/cacheflush.h> 20#include <asm/cacheflush.h>
21#include <asm/tlbflush.h>
22 21
23#ifndef CONFIG_MMU 22#ifndef CONFIG_MMU
24 23
25#include <linux/pagemap.h> 24#include <linux/pagemap.h>
25
26#define tlb_flush(tlb) ((void) tlb)
27
26#include <asm-generic/tlb.h> 28#include <asm-generic/tlb.h>
27 29
28#else /* !CONFIG_MMU */ 30#else /* !CONFIG_MMU */
29 31
32#include <linux/swap.h>
30#include <asm/pgalloc.h> 33#include <asm/pgalloc.h>
34#include <asm/tlbflush.h>
35
36/*
37 * We need to delay page freeing for SMP as other CPUs can access pages
38 * which have been removed but not yet had their TLB entries invalidated.
39 * Also, as ARMv7 speculative prefetch can drag new entries into the TLB,
40 * we need to apply this same delaying tactic to ensure correct operation.
41 */
42#if defined(CONFIG_SMP) || defined(CONFIG_CPU_32v7)
43#define tlb_fast_mode(tlb) 0
44#define FREE_PTE_NR 500
45#else
46#define tlb_fast_mode(tlb) 1
47#define FREE_PTE_NR 0
48#endif
31 49
32/* 50/*
33 * TLB handling. This allows us to remove pages from the page 51 * TLB handling. This allows us to remove pages from the page
@@ -36,12 +54,58 @@
36struct mmu_gather { 54struct mmu_gather {
37 struct mm_struct *mm; 55 struct mm_struct *mm;
38 unsigned int fullmm; 56 unsigned int fullmm;
57 struct vm_area_struct *vma;
39 unsigned long range_start; 58 unsigned long range_start;
40 unsigned long range_end; 59 unsigned long range_end;
60 unsigned int nr;
61 struct page *pages[FREE_PTE_NR];
41}; 62};
42 63
43DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); 64DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
44 65
66/*
67 * This is unnecessarily complex. There's three ways the TLB shootdown
68 * code is used:
69 * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region().
70 * tlb->fullmm = 0, and tlb_start_vma/tlb_end_vma will be called.
71 * tlb->vma will be non-NULL.
72 * 2. Unmapping all vmas. See exit_mmap().
73 * tlb->fullmm = 1, and tlb_start_vma/tlb_end_vma will be called.
74 * tlb->vma will be non-NULL. Additionally, page tables will be freed.
75 * 3. Unmapping argument pages. See shift_arg_pages().
76 * tlb->fullmm = 0, but tlb_start_vma/tlb_end_vma will not be called.
77 * tlb->vma will be NULL.
78 */
79static inline void tlb_flush(struct mmu_gather *tlb)
80{
81 if (tlb->fullmm || !tlb->vma)
82 flush_tlb_mm(tlb->mm);
83 else if (tlb->range_end > 0) {
84 flush_tlb_range(tlb->vma, tlb->range_start, tlb->range_end);
85 tlb->range_start = TASK_SIZE;
86 tlb->range_end = 0;
87 }
88}
89
90static inline void tlb_add_flush(struct mmu_gather *tlb, unsigned long addr)
91{
92 if (!tlb->fullmm) {
93 if (addr < tlb->range_start)
94 tlb->range_start = addr;
95 if (addr + PAGE_SIZE > tlb->range_end)
96 tlb->range_end = addr + PAGE_SIZE;
97 }
98}
99
100static inline void tlb_flush_mmu(struct mmu_gather *tlb)
101{
102 tlb_flush(tlb);
103 if (!tlb_fast_mode(tlb)) {
104 free_pages_and_swap_cache(tlb->pages, tlb->nr);
105 tlb->nr = 0;
106 }
107}
108
45static inline struct mmu_gather * 109static inline struct mmu_gather *
46tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) 110tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
47{ 111{
@@ -49,6 +113,8 @@ tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
49 113
50 tlb->mm = mm; 114 tlb->mm = mm;
51 tlb->fullmm = full_mm_flush; 115 tlb->fullmm = full_mm_flush;
116 tlb->vma = NULL;
117 tlb->nr = 0;
52 118
53 return tlb; 119 return tlb;
54} 120}
@@ -56,8 +122,7 @@ tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
56static inline void 122static inline void
57tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) 123tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
58{ 124{
59 if (tlb->fullmm) 125 tlb_flush_mmu(tlb);
60 flush_tlb_mm(tlb->mm);
61 126
62 /* keep the page table cache within bounds */ 127 /* keep the page table cache within bounds */
63 check_pgt_cache(); 128 check_pgt_cache();
@@ -71,12 +136,7 @@ tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
71static inline void 136static inline void
72tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr) 137tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr)
73{ 138{
74 if (!tlb->fullmm) { 139 tlb_add_flush(tlb, addr);
75 if (addr < tlb->range_start)
76 tlb->range_start = addr;
77 if (addr + PAGE_SIZE > tlb->range_end)
78 tlb->range_end = addr + PAGE_SIZE;
79 }
80} 140}
81 141
82/* 142/*
@@ -89,6 +149,7 @@ tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
89{ 149{
90 if (!tlb->fullmm) { 150 if (!tlb->fullmm) {
91 flush_cache_range(vma, vma->vm_start, vma->vm_end); 151 flush_cache_range(vma, vma->vm_start, vma->vm_end);
152 tlb->vma = vma;
92 tlb->range_start = TASK_SIZE; 153 tlb->range_start = TASK_SIZE;
93 tlb->range_end = 0; 154 tlb->range_end = 0;
94 } 155 }
@@ -97,12 +158,30 @@ tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
97static inline void 158static inline void
98tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) 159tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
99{ 160{
100 if (!tlb->fullmm && tlb->range_end > 0) 161 if (!tlb->fullmm)
101 flush_tlb_range(vma, tlb->range_start, tlb->range_end); 162 tlb_flush(tlb);
163}
164
165static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page)
166{
167 if (tlb_fast_mode(tlb)) {
168 free_page_and_swap_cache(page);
169 } else {
170 tlb->pages[tlb->nr++] = page;
171 if (tlb->nr >= FREE_PTE_NR)
172 tlb_flush_mmu(tlb);
173 }
174}
175
176static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte,
177 unsigned long addr)
178{
179 pgtable_page_dtor(pte);
180 tlb_add_flush(tlb, addr);
181 tlb_remove_page(tlb, pte);
102} 182}
103 183
104#define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) 184#define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr)
105#define pte_free_tlb(tlb, ptep, addr) pte_free((tlb)->mm, ptep)
106#define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp) 185#define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp)
107 186
108#define tlb_migrate_finish(mm) do { } while (0) 187#define tlb_migrate_finish(mm) do { } while (0)
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index ce7378ea15a2..d2005de383b8 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -10,12 +10,7 @@
10#ifndef _ASMARM_TLBFLUSH_H 10#ifndef _ASMARM_TLBFLUSH_H
11#define _ASMARM_TLBFLUSH_H 11#define _ASMARM_TLBFLUSH_H
12 12
13 13#ifdef CONFIG_MMU
14#ifndef CONFIG_MMU
15
16#define tlb_flush(tlb) ((void) tlb)
17
18#else /* CONFIG_MMU */
19 14
20#include <asm/glue.h> 15#include <asm/glue.h>
21 16
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
index e71d6ff8d104..60843eb0f61c 100644
--- a/arch/arm/include/asm/tls.h
+++ b/arch/arm/include/asm/tls.h
@@ -28,15 +28,14 @@
28#define tls_emu 1 28#define tls_emu 1
29#define has_tls_reg 1 29#define has_tls_reg 1
30#define set_tls set_tls_none 30#define set_tls set_tls_none
31#elif __LINUX_ARM_ARCH__ >= 7 || \ 31#elif defined(CONFIG_CPU_V6)
32 (__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
33#define tls_emu 0
34#define has_tls_reg 1
35#define set_tls set_tls_v6k
36#elif __LINUX_ARM_ARCH__ == 6
37#define tls_emu 0 32#define tls_emu 0
38#define has_tls_reg (elf_hwcap & HWCAP_TLS) 33#define has_tls_reg (elf_hwcap & HWCAP_TLS)
39#define set_tls set_tls_v6 34#define set_tls set_tls_v6
35#elif defined(CONFIG_CPU_32v6K)
36#define tls_emu 0
37#define has_tls_reg 1
38#define set_tls set_tls_v6k
40#else 39#else
41#define tls_emu 0 40#define tls_emu 0
42#define has_tls_reg 0 41#define has_tls_reg 0
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index 1b960d5ef6a5..f90756dc16dc 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -45,6 +45,7 @@ static inline int in_exception_text(unsigned long ptr)
45 45
46extern void __init early_trap_init(void); 46extern void __init early_trap_init(void);
47extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame); 47extern void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame);
48extern void ptrace_break(struct task_struct *tsk, struct pt_regs *regs);
48 49
49extern void *vectors_page; 50extern void *vectors_page;
50 51
diff --git a/arch/arm/include/asm/user.h b/arch/arm/include/asm/user.h
index 05ac4b06876a..35917b3a97f9 100644
--- a/arch/arm/include/asm/user.h
+++ b/arch/arm/include/asm/user.h
@@ -71,7 +71,7 @@ struct user{
71 /* the registers. */ 71 /* the registers. */
72 unsigned long magic; /* To uniquely identify a core file */ 72 unsigned long magic; /* To uniquely identify a core file */
73 char u_comm[32]; /* User command that was responsible */ 73 char u_comm[32]; /* User command that was responsible */
74 int u_debugreg[8]; 74 int u_debugreg[8]; /* No longer used */
75 struct user_fp u_fp; /* FP state */ 75 struct user_fp u_fp; /* FP state */
76 struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */ 76 struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */
77 /* the FP registers. */ 77 /* the FP registers. */
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 185ee822c935..74554f1742d7 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_MODULES) += armksyms.o module.o
29obj-$(CONFIG_ARTHUR) += arthur.o 29obj-$(CONFIG_ARTHUR) += arthur.o
30obj-$(CONFIG_ISA_DMA) += dma-isa.o 30obj-$(CONFIG_ISA_DMA) += dma-isa.o
31obj-$(CONFIG_PCI) += bios32.o isa.o 31obj-$(CONFIG_PCI) += bios32.o isa.o
32obj-$(CONFIG_PM) += sleep.o
32obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o 33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
33obj-$(CONFIG_SMP) += smp.o smp_tlb.o 34obj-$(CONFIG_SMP) += smp.o smp_tlb.o
34obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 9615423c37dd..acca35aebe28 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -140,24 +140,18 @@ EXPORT_SYMBOL(__aeabi_ulcmp);
140#endif 140#endif
141 141
142 /* bitops */ 142 /* bitops */
143EXPORT_SYMBOL(_set_bit_le); 143EXPORT_SYMBOL(_set_bit);
144EXPORT_SYMBOL(_test_and_set_bit_le); 144EXPORT_SYMBOL(_test_and_set_bit);
145EXPORT_SYMBOL(_clear_bit_le); 145EXPORT_SYMBOL(_clear_bit);
146EXPORT_SYMBOL(_test_and_clear_bit_le); 146EXPORT_SYMBOL(_test_and_clear_bit);
147EXPORT_SYMBOL(_change_bit_le); 147EXPORT_SYMBOL(_change_bit);
148EXPORT_SYMBOL(_test_and_change_bit_le); 148EXPORT_SYMBOL(_test_and_change_bit);
149EXPORT_SYMBOL(_find_first_zero_bit_le); 149EXPORT_SYMBOL(_find_first_zero_bit_le);
150EXPORT_SYMBOL(_find_next_zero_bit_le); 150EXPORT_SYMBOL(_find_next_zero_bit_le);
151EXPORT_SYMBOL(_find_first_bit_le); 151EXPORT_SYMBOL(_find_first_bit_le);
152EXPORT_SYMBOL(_find_next_bit_le); 152EXPORT_SYMBOL(_find_next_bit_le);
153 153
154#ifdef __ARMEB__ 154#ifdef __ARMEB__
155EXPORT_SYMBOL(_set_bit_be);
156EXPORT_SYMBOL(_test_and_set_bit_be);
157EXPORT_SYMBOL(_clear_bit_be);
158EXPORT_SYMBOL(_test_and_clear_bit_be);
159EXPORT_SYMBOL(_change_bit_be);
160EXPORT_SYMBOL(_test_and_change_bit_be);
161EXPORT_SYMBOL(_find_first_zero_bit_be); 155EXPORT_SYMBOL(_find_first_zero_bit_be);
162EXPORT_SYMBOL(_find_next_zero_bit_be); 156EXPORT_SYMBOL(_find_next_zero_bit_be);
163EXPORT_SYMBOL(_find_first_bit_be); 157EXPORT_SYMBOL(_find_first_bit_be);
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 82da66172132..927522cfc12e 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -13,6 +13,9 @@
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <asm/cacheflush.h>
17#include <asm/glue-df.h>
18#include <asm/glue-pf.h>
16#include <asm/mach/arch.h> 19#include <asm/mach/arch.h>
17#include <asm/thread_info.h> 20#include <asm/thread_info.h>
18#include <asm/memory.h> 21#include <asm/memory.h>
@@ -114,6 +117,14 @@ int main(void)
114#ifdef MULTI_PABORT 117#ifdef MULTI_PABORT
115 DEFINE(PROCESSOR_PABT_FUNC, offsetof(struct processor, _prefetch_abort)); 118 DEFINE(PROCESSOR_PABT_FUNC, offsetof(struct processor, _prefetch_abort));
116#endif 119#endif
120#ifdef MULTI_CPU
121 DEFINE(CPU_SLEEP_SIZE, offsetof(struct processor, suspend_size));
122 DEFINE(CPU_DO_SUSPEND, offsetof(struct processor, do_suspend));
123 DEFINE(CPU_DO_RESUME, offsetof(struct processor, do_resume));
124#endif
125#ifdef MULTI_CACHE
126 DEFINE(CACHE_FLUSH_KERN_ALL, offsetof(struct cpu_cache_fns, flush_kern_all));
127#endif
117 BLANK(); 128 BLANK();
118 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL); 129 DEFINE(DMA_BIDIRECTIONAL, DMA_BIDIRECTIONAL);
119 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE); 130 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE);
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index c6273a3bfc25..d86fcd44b220 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -583,6 +583,11 @@ void __init pci_common_init(struct hw_pci *hw)
583 * Assign resources. 583 * Assign resources.
584 */ 584 */
585 pci_bus_assign_resources(bus); 585 pci_bus_assign_resources(bus);
586
587 /*
588 * Enable bridges
589 */
590 pci_enable_bridges(bus);
586 } 591 }
587 592
588 /* 593 /*
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index a0f07521ca8a..d2d983be096d 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -25,7 +25,7 @@
25 .macro addruart, rp, rv 25 .macro addruart, rp, rv
26 .endm 26 .endm
27 27
28#if defined(CONFIG_CPU_V6) 28#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
29 29
30 .macro senduart, rd, rx 30 .macro senduart, rd, rx
31 mcr p14, 0, \rd, c0, c5, 0 31 mcr p14, 0, \rd, c0, c5, 0
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 2b46fea36c9f..e8d885676807 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -16,7 +16,8 @@
16 */ 16 */
17 17
18#include <asm/memory.h> 18#include <asm/memory.h>
19#include <asm/glue.h> 19#include <asm/glue-df.h>
20#include <asm/glue-pf.h>
20#include <asm/vfpmacros.h> 21#include <asm/vfpmacros.h>
21#include <mach/entry-macro.S> 22#include <mach/entry-macro.S>
22#include <asm/thread_notify.h> 23#include <asm/thread_notify.h>
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index ae9464900168..051166c2a932 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -76,13 +76,13 @@
76#ifndef CONFIG_THUMB2_KERNEL 76#ifndef CONFIG_THUMB2_KERNEL
77 .macro svc_exit, rpsr 77 .macro svc_exit, rpsr
78 msr spsr_cxsf, \rpsr 78 msr spsr_cxsf, \rpsr
79#if defined(CONFIG_CPU_32v6K) 79#if defined(CONFIG_CPU_V6)
80 clrex @ clear the exclusive monitor
81 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
82#elif defined (CONFIG_CPU_V6)
83 ldr r0, [sp] 80 ldr r0, [sp]
84 strex r1, r2, [sp] @ clear the exclusive monitor 81 strex r1, r2, [sp] @ clear the exclusive monitor
85 ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr 82 ldmib sp, {r1 - pc}^ @ load r1 - pc, cpsr
83#elif defined(CONFIG_CPU_32v6K)
84 clrex @ clear the exclusive monitor
85 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
86#else 86#else
87 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr 87 ldmia sp, {r0 - pc}^ @ load r0 - pc, cpsr
88#endif 88#endif
@@ -92,10 +92,10 @@
92 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr 92 ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr
93 ldr lr, [sp, #\offset + S_PC]! @ get pc 93 ldr lr, [sp, #\offset + S_PC]! @ get pc
94 msr spsr_cxsf, r1 @ save in spsr_svc 94 msr spsr_cxsf, r1 @ save in spsr_svc
95#if defined(CONFIG_CPU_32v6K) 95#if defined(CONFIG_CPU_V6)
96 clrex @ clear the exclusive monitor
97#elif defined (CONFIG_CPU_V6)
98 strex r1, r2, [sp] @ clear the exclusive monitor 96 strex r1, r2, [sp] @ clear the exclusive monitor
97#elif defined(CONFIG_CPU_32v6K)
98 clrex @ clear the exclusive monitor
99#endif 99#endif
100 .if \fast 100 .if \fast
101 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr 101 ldmdb sp, {r1 - lr}^ @ get calling r1 - lr
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 6a87261e1b1e..c9173cfbbc74 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -395,6 +395,7 @@ ENDPROC(__turn_mmu_on)
395 395
396 396
397#ifdef CONFIG_SMP_ON_UP 397#ifdef CONFIG_SMP_ON_UP
398 __INIT
398__fixup_smp: 399__fixup_smp:
399 and r3, r9, #0x000f0000 @ architecture version 400 and r3, r9, #0x000f0000 @ architecture version
400 teq r3, #0x000f0000 @ CPU ID supported? 401 teq r3, #0x000f0000 @ CPU ID supported?
@@ -419,18 +420,7 @@ __fixup_smp_on_up:
419 sub r3, r0, r3 420 sub r3, r0, r3
420 add r4, r4, r3 421 add r4, r4, r3
421 add r5, r5, r3 422 add r5, r5, r3
4222: cmp r4, r5 423 b __do_fixup_smp_on_up
423 movhs pc, lr
424 ldmia r4!, {r0, r6}
425 ARM( str r6, [r0, r3] )
426 THUMB( add r0, r0, r3 )
427#ifdef __ARMEB__
428 THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian.
429#endif
430 THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords
431 THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3.
432 THUMB( strh r6, [r0] )
433 b 2b
434ENDPROC(__fixup_smp) 424ENDPROC(__fixup_smp)
435 425
436 .align 426 .align
@@ -444,8 +434,32 @@ smp_on_up:
444 ALT_SMP(.long 1) 434 ALT_SMP(.long 1)
445 ALT_UP(.long 0) 435 ALT_UP(.long 0)
446 .popsection 436 .popsection
437#endif
447 438
439 .text
440__do_fixup_smp_on_up:
441 cmp r4, r5
442 movhs pc, lr
443 ldmia r4!, {r0, r6}
444 ARM( str r6, [r0, r3] )
445 THUMB( add r0, r0, r3 )
446#ifdef __ARMEB__
447 THUMB( mov r6, r6, ror #16 ) @ Convert word order for big-endian.
448#endif 448#endif
449 THUMB( strh r6, [r0], #2 ) @ For Thumb-2, store as two halfwords
450 THUMB( mov r6, r6, lsr #16 ) @ to be robust against misaligned r3.
451 THUMB( strh r6, [r0] )
452 b __do_fixup_smp_on_up
453ENDPROC(__do_fixup_smp_on_up)
454
455ENTRY(fixup_smp)
456 stmfd sp!, {r4 - r6, lr}
457 mov r4, r0
458 add r5, r0, r1
459 mov r3, #0
460 bl __do_fixup_smp_on_up
461 ldmfd sp!, {r4 - r6, pc}
462ENDPROC(fixup_smp)
449 463
450#ifdef CONFIG_ARM_PATCH_PHYS_VIRT 464#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
451 465
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index c9f3f0467570..44b84fe6e1b0 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -137,11 +137,10 @@ static u8 get_debug_arch(void)
137 u32 didr; 137 u32 didr;
138 138
139 /* Do we implement the extended CPUID interface? */ 139 /* Do we implement the extended CPUID interface? */
140 if (((read_cpuid_id() >> 16) & 0xf) != 0xf) { 140 if (WARN_ONCE((((read_cpuid_id() >> 16) & 0xf) != 0xf),
141 pr_warning("CPUID feature registers not supported. " 141 "CPUID feature registers not supported. "
142 "Assuming v6 debug is present.\n"); 142 "Assuming v6 debug is present.\n"))
143 return ARM_DEBUG_ARCH_V6; 143 return ARM_DEBUG_ARCH_V6;
144 }
145 144
146 ARM_DBG_READ(c0, 0, didr); 145 ARM_DBG_READ(c0, 0, didr);
147 return (didr >> 16) & 0xf; 146 return (didr >> 16) & 0xf;
@@ -152,6 +151,12 @@ u8 arch_get_debug_arch(void)
152 return debug_arch; 151 return debug_arch;
153} 152}
154 153
154static int debug_arch_supported(void)
155{
156 u8 arch = get_debug_arch();
157 return arch >= ARM_DEBUG_ARCH_V6 && arch <= ARM_DEBUG_ARCH_V7_ECP14;
158}
159
155/* Determine number of BRP register available. */ 160/* Determine number of BRP register available. */
156static int get_num_brp_resources(void) 161static int get_num_brp_resources(void)
157{ 162{
@@ -268,6 +273,9 @@ out:
268 273
269int hw_breakpoint_slots(int type) 274int hw_breakpoint_slots(int type)
270{ 275{
276 if (!debug_arch_supported())
277 return 0;
278
271 /* 279 /*
272 * We can be called early, so don't rely on 280 * We can be called early, so don't rely on
273 * our static variables being initialised. 281 * our static variables being initialised.
@@ -828,20 +836,33 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
828/* 836/*
829 * One-time initialisation. 837 * One-time initialisation.
830 */ 838 */
831static void reset_ctrl_regs(void *unused) 839static void reset_ctrl_regs(void *info)
832{ 840{
833 int i; 841 int i, cpu = smp_processor_id();
842 u32 dbg_power;
843 cpumask_t *cpumask = info;
834 844
835 /* 845 /*
836 * v7 debug contains save and restore registers so that debug state 846 * v7 debug contains save and restore registers so that debug state
837 * can be maintained across low-power modes without leaving 847 * can be maintained across low-power modes without leaving the debug
838 * the debug logic powered up. It is IMPLEMENTATION DEFINED whether 848 * logic powered up. It is IMPLEMENTATION DEFINED whether we can access
839 * we can write to the debug registers out of reset, so we must 849 * the debug registers out of reset, so we must unlock the OS Lock
840 * unlock the OS Lock Access Register to avoid taking undefined 850 * Access Register to avoid taking undefined instruction exceptions
841 * instruction exceptions later on. 851 * later on.
842 */ 852 */
843 if (debug_arch >= ARM_DEBUG_ARCH_V7_ECP14) { 853 if (debug_arch >= ARM_DEBUG_ARCH_V7_ECP14) {
844 /* 854 /*
855 * Ensure sticky power-down is clear (i.e. debug logic is
856 * powered up).
857 */
858 asm volatile("mrc p14, 0, %0, c1, c5, 4" : "=r" (dbg_power));
859 if ((dbg_power & 0x1) == 0) {
860 pr_warning("CPU %d debug is powered down!\n", cpu);
861 cpumask_or(cpumask, cpumask, cpumask_of(cpu));
862 return;
863 }
864
865 /*
845 * Unconditionally clear the lock by writing a value 866 * Unconditionally clear the lock by writing a value
846 * other than 0xC5ACCE55 to the access register. 867 * other than 0xC5ACCE55 to the access register.
847 */ 868 */
@@ -879,10 +900,11 @@ static struct notifier_block __cpuinitdata dbg_reset_nb = {
879static int __init arch_hw_breakpoint_init(void) 900static int __init arch_hw_breakpoint_init(void)
880{ 901{
881 u32 dscr; 902 u32 dscr;
903 cpumask_t cpumask = { CPU_BITS_NONE };
882 904
883 debug_arch = get_debug_arch(); 905 debug_arch = get_debug_arch();
884 906
885 if (debug_arch > ARM_DEBUG_ARCH_V7_ECP14) { 907 if (!debug_arch_supported()) {
886 pr_info("debug architecture 0x%x unsupported.\n", debug_arch); 908 pr_info("debug architecture 0x%x unsupported.\n", debug_arch);
887 return 0; 909 return 0;
888 } 910 }
@@ -899,18 +921,24 @@ static int __init arch_hw_breakpoint_init(void)
899 pr_info("%d breakpoint(s) reserved for watchpoint " 921 pr_info("%d breakpoint(s) reserved for watchpoint "
900 "single-step.\n", core_num_reserved_brps); 922 "single-step.\n", core_num_reserved_brps);
901 923
924 /*
925 * Reset the breakpoint resources. We assume that a halting
926 * debugger will leave the world in a nice state for us.
927 */
928 on_each_cpu(reset_ctrl_regs, &cpumask, 1);
929 if (!cpumask_empty(&cpumask)) {
930 core_num_brps = 0;
931 core_num_reserved_brps = 0;
932 core_num_wrps = 0;
933 return 0;
934 }
935
902 ARM_DBG_READ(c1, 0, dscr); 936 ARM_DBG_READ(c1, 0, dscr);
903 if (dscr & ARM_DSCR_HDBGEN) { 937 if (dscr & ARM_DSCR_HDBGEN) {
938 max_watchpoint_len = 4;
904 pr_warning("halting debug mode enabled. Assuming maximum " 939 pr_warning("halting debug mode enabled. Assuming maximum "
905 "watchpoint size of 4 bytes."); 940 "watchpoint size of %u bytes.", max_watchpoint_len);
906 } else { 941 } else {
907 /*
908 * Reset the breakpoint resources. We assume that a halting
909 * debugger will leave the world in a nice state for us.
910 */
911 smp_call_function(reset_ctrl_regs, NULL, 1);
912 reset_ctrl_regs(NULL);
913
914 /* Work out the maximum supported watchpoint length. */ 942 /* Work out the maximum supported watchpoint length. */
915 max_watchpoint_len = get_max_wp_len(); 943 max_watchpoint_len = get_max_wp_len();
916 pr_info("maximum watchpoint size is %u bytes.\n", 944 pr_info("maximum watchpoint size is %u bytes.\n",
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 28536e352deb..3535d3793e65 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -179,14 +179,21 @@ int __init arch_probe_nr_irqs(void)
179 179
180#ifdef CONFIG_HOTPLUG_CPU 180#ifdef CONFIG_HOTPLUG_CPU
181 181
182static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu) 182static bool migrate_one_irq(struct irq_data *d)
183{ 183{
184 pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", irq, desc->irq_data.node, cpu); 184 unsigned int cpu = cpumask_any_and(d->affinity, cpu_online_mask);
185 bool ret = false;
185 186
186 raw_spin_lock_irq(&desc->lock); 187 if (cpu >= nr_cpu_ids) {
187 desc->irq_data.chip->irq_set_affinity(&desc->irq_data, 188 cpu = cpumask_any(cpu_online_mask);
188 cpumask_of(cpu), false); 189 ret = true;
189 raw_spin_unlock_irq(&desc->lock); 190 }
191
192 pr_debug("IRQ%u: moving from cpu%u to cpu%u\n", d->irq, d->node, cpu);
193
194 d->chip->irq_set_affinity(d, cpumask_of(cpu), true);
195
196 return ret;
190} 197}
191 198
192/* 199/*
@@ -198,25 +205,30 @@ void migrate_irqs(void)
198{ 205{
199 unsigned int i, cpu = smp_processor_id(); 206 unsigned int i, cpu = smp_processor_id();
200 struct irq_desc *desc; 207 struct irq_desc *desc;
208 unsigned long flags;
209
210 local_irq_save(flags);
201 211
202 for_each_irq_desc(i, desc) { 212 for_each_irq_desc(i, desc) {
203 struct irq_data *d = &desc->irq_data; 213 struct irq_data *d = &desc->irq_data;
214 bool affinity_broken = false;
204 215
205 if (d->node == cpu) { 216 raw_spin_lock(&desc->lock);
206 unsigned int newcpu = cpumask_any_and(d->affinity, 217 do {
207 cpu_online_mask); 218 if (desc->action == NULL)
208 if (newcpu >= nr_cpu_ids) { 219 break;
209 if (printk_ratelimit())
210 printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n",
211 i, cpu);
212 220
213 cpumask_setall(d->affinity); 221 if (d->node != cpu)
214 newcpu = cpumask_any_and(d->affinity, 222 break;
215 cpu_online_mask);
216 }
217 223
218 route_irq(desc, i, newcpu); 224 affinity_broken = migrate_one_irq(d);
219 } 225 } while (0);
226 raw_spin_unlock(&desc->lock);
227
228 if (affinity_broken && printk_ratelimit())
229 pr_warning("IRQ%u no longer affine to CPU%u\n", i, cpu);
220 } 230 }
231
232 local_irq_restore(flags);
221} 233}
222#endif /* CONFIG_HOTPLUG_CPU */ 234#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
index 2c1f0050c9c4..8f6ed43861f1 100644
--- a/arch/arm/kernel/kprobes-decode.c
+++ b/arch/arm/kernel/kprobes-decode.c
@@ -1437,7 +1437,7 @@ arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi)
1437 1437
1438 return space_cccc_1100_010x(insn, asi); 1438 return space_cccc_1100_010x(insn, asi);
1439 1439
1440 } else if ((insn & 0x0e000000) == 0x0c400000) { 1440 } else if ((insn & 0x0e000000) == 0x0c000000) {
1441 1441
1442 return space_cccc_110x(insn, asi); 1442 return space_cccc_110x(insn, asi);
1443 1443
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index c5679f6d9f64..fee7c36349eb 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -22,6 +22,7 @@
22 22
23#include <asm/pgtable.h> 23#include <asm/pgtable.h>
24#include <asm/sections.h> 24#include <asm/sections.h>
25#include <asm/smp_plat.h>
25#include <asm/unwind.h> 26#include <asm/unwind.h>
26 27
27#ifdef CONFIG_XIP_KERNEL 28#ifdef CONFIG_XIP_KERNEL
@@ -75,6 +76,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
75 for (i = 0; i < relsec->sh_size / sizeof(Elf32_Rel); i++, rel++) { 76 for (i = 0; i < relsec->sh_size / sizeof(Elf32_Rel); i++, rel++) {
76 unsigned long loc; 77 unsigned long loc;
77 Elf32_Sym *sym; 78 Elf32_Sym *sym;
79 const char *symname;
78 s32 offset; 80 s32 offset;
79#ifdef CONFIG_THUMB2_KERNEL 81#ifdef CONFIG_THUMB2_KERNEL
80 u32 upper, lower, sign, j1, j2; 82 u32 upper, lower, sign, j1, j2;
@@ -82,18 +84,18 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
82 84
83 offset = ELF32_R_SYM(rel->r_info); 85 offset = ELF32_R_SYM(rel->r_info);
84 if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) { 86 if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) {
85 printk(KERN_ERR "%s: bad relocation, section %d reloc %d\n", 87 pr_err("%s: section %u reloc %u: bad relocation sym offset\n",
86 module->name, relindex, i); 88 module->name, relindex, i);
87 return -ENOEXEC; 89 return -ENOEXEC;
88 } 90 }
89 91
90 sym = ((Elf32_Sym *)symsec->sh_addr) + offset; 92 sym = ((Elf32_Sym *)symsec->sh_addr) + offset;
93 symname = strtab + sym->st_name;
91 94
92 if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) { 95 if (rel->r_offset < 0 || rel->r_offset > dstsec->sh_size - sizeof(u32)) {
93 printk(KERN_ERR "%s: out of bounds relocation, " 96 pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n",
94 "section %d reloc %d offset %d size %d\n", 97 module->name, relindex, i, symname,
95 module->name, relindex, i, rel->r_offset, 98 rel->r_offset, dstsec->sh_size);
96 dstsec->sh_size);
97 return -ENOEXEC; 99 return -ENOEXEC;
98 } 100 }
99 101
@@ -119,10 +121,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
119 if (offset & 3 || 121 if (offset & 3 ||
120 offset <= (s32)0xfe000000 || 122 offset <= (s32)0xfe000000 ||
121 offset >= (s32)0x02000000) { 123 offset >= (s32)0x02000000) {
122 printk(KERN_ERR 124 pr_err("%s: section %u reloc %u sym '%s': relocation %u out of range (%#lx -> %#x)\n",
123 "%s: relocation out of range, section " 125 module->name, relindex, i, symname,
124 "%d reloc %d sym '%s'\n", module->name, 126 ELF32_R_TYPE(rel->r_info), loc,
125 relindex, i, strtab + sym->st_name); 127 sym->st_value);
126 return -ENOEXEC; 128 return -ENOEXEC;
127 } 129 }
128 130
@@ -195,10 +197,10 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
195 if (!(offset & 1) || 197 if (!(offset & 1) ||
196 offset <= (s32)0xff000000 || 198 offset <= (s32)0xff000000 ||
197 offset >= (s32)0x01000000) { 199 offset >= (s32)0x01000000) {
198 printk(KERN_ERR 200 pr_err("%s: section %u reloc %u sym '%s': relocation %u out of range (%#lx -> %#x)\n",
199 "%s: relocation out of range, section " 201 module->name, relindex, i, symname,
200 "%d reloc %d sym '%s'\n", module->name, 202 ELF32_R_TYPE(rel->r_info), loc,
201 relindex, i, strtab + sym->st_name); 203 sym->st_value);
202 return -ENOEXEC; 204 return -ENOEXEC;
203 } 205 }
204 206
@@ -282,6 +284,7 @@ static const Elf_Shdr *find_mod_section(const Elf32_Ehdr *hdr,
282} 284}
283 285
284extern void fixup_pv_table(const void *, unsigned long); 286extern void fixup_pv_table(const void *, unsigned long);
287extern void fixup_smp(const void *, unsigned long);
285 288
286int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs, 289int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
287 struct module *mod) 290 struct module *mod)
@@ -336,6 +339,9 @@ int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
336 if (s) 339 if (s)
337 fixup_pv_table((void *)s->sh_addr, s->sh_size); 340 fixup_pv_table((void *)s->sh_addr, s->sh_size);
338#endif 341#endif
342 s = find_mod_section(hdr, sechdrs, ".alt.smp.init");
343 if (s && !is_smp())
344 fixup_smp((void *)s->sh_addr, s->sh_size);
339 return 0; 345 return 0;
340} 346}
341 347
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 5efa2647a2fb..d150ad1ccb5d 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -700,7 +700,7 @@ user_backtrace(struct frame_tail __user *tail,
700 * Frame pointers should strictly progress back up the stack 700 * Frame pointers should strictly progress back up the stack
701 * (towards higher addresses). 701 * (towards higher addresses).
702 */ 702 */
703 if (tail >= buftail.fp) 703 if (tail + 1 >= buftail.fp)
704 return NULL; 704 return NULL;
705 705
706 return buftail.fp - 1; 706 return buftail.fp - 1;
diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c
index c058bfc8532b..6fc2d228db55 100644
--- a/arch/arm/kernel/perf_event_v6.c
+++ b/arch/arm/kernel/perf_event_v6.c
@@ -30,7 +30,7 @@
30 * enable the interrupt. 30 * enable the interrupt.
31 */ 31 */
32 32
33#ifdef CONFIG_CPU_V6 33#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
34enum armv6_perf_types { 34enum armv6_perf_types {
35 ARMV6_PERFCTR_ICACHE_MISS = 0x0, 35 ARMV6_PERFCTR_ICACHE_MISS = 0x0,
36 ARMV6_PERFCTR_IBUF_STALL = 0x1, 36 ARMV6_PERFCTR_IBUF_STALL = 0x1,
@@ -669,4 +669,4 @@ static const struct arm_pmu *__init armv6mpcore_pmu_init(void)
669{ 669{
670 return NULL; 670 return NULL;
671} 671}
672#endif /* CONFIG_CPU_V6 */ 672#endif /* CONFIG_CPU_V6 || CONFIG_CPU_V6K */
diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c
index b8af96ea62e6..2c79eec19262 100644
--- a/arch/arm/kernel/pmu.c
+++ b/arch/arm/kernel/pmu.c
@@ -97,28 +97,34 @@ set_irq_affinity(int irq,
97 irq, cpu); 97 irq, cpu);
98 return err; 98 return err;
99#else 99#else
100 return 0; 100 return -EINVAL;
101#endif 101#endif
102} 102}
103 103
104static int 104static int
105init_cpu_pmu(void) 105init_cpu_pmu(void)
106{ 106{
107 int i, err = 0; 107 int i, irqs, err = 0;
108 struct platform_device *pdev = pmu_devices[ARM_PMU_DEVICE_CPU]; 108 struct platform_device *pdev = pmu_devices[ARM_PMU_DEVICE_CPU];
109 109
110 if (!pdev) { 110 if (!pdev)
111 err = -ENODEV; 111 return -ENODEV;
112 goto out; 112
113 } 113 irqs = pdev->num_resources;
114
115 /*
116 * If we have a single PMU interrupt that we can't shift, assume that
117 * we're running on a uniprocessor machine and continue.
118 */
119 if (irqs == 1 && !irq_can_set_affinity(platform_get_irq(pdev, 0)))
120 return 0;
114 121
115 for (i = 0; i < pdev->num_resources; ++i) { 122 for (i = 0; i < irqs; ++i) {
116 err = set_irq_affinity(platform_get_irq(pdev, i), i); 123 err = set_irq_affinity(platform_get_irq(pdev, i), i);
117 if (err) 124 if (err)
118 break; 125 break;
119 } 126 }
120 127
121out:
122 return err; 128 return err;
123} 129}
124 130
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 19c6816db61e..2bf27f364d09 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -26,8 +26,6 @@
26#include <asm/system.h> 26#include <asm/system.h>
27#include <asm/traps.h> 27#include <asm/traps.h>
28 28
29#include "ptrace.h"
30
31#define REG_PC 15 29#define REG_PC 15
32#define REG_PSR 16 30#define REG_PSR 16
33/* 31/*
@@ -184,389 +182,12 @@ put_user_reg(struct task_struct *task, int offset, long data)
184 return ret; 182 return ret;
185} 183}
186 184
187static inline int
188read_u32(struct task_struct *task, unsigned long addr, u32 *res)
189{
190 int ret;
191
192 ret = access_process_vm(task, addr, res, sizeof(*res), 0);
193
194 return ret == sizeof(*res) ? 0 : -EIO;
195}
196
197static inline int
198read_instr(struct task_struct *task, unsigned long addr, u32 *res)
199{
200 int ret;
201
202 if (addr & 1) {
203 u16 val;
204 ret = access_process_vm(task, addr & ~1, &val, sizeof(val), 0);
205 ret = ret == sizeof(val) ? 0 : -EIO;
206 *res = val;
207 } else {
208 u32 val;
209 ret = access_process_vm(task, addr & ~3, &val, sizeof(val), 0);
210 ret = ret == sizeof(val) ? 0 : -EIO;
211 *res = val;
212 }
213 return ret;
214}
215
216/*
217 * Get value of register `rn' (in the instruction)
218 */
219static unsigned long
220ptrace_getrn(struct task_struct *child, unsigned long insn)
221{
222 unsigned int reg = (insn >> 16) & 15;
223 unsigned long val;
224
225 val = get_user_reg(child, reg);
226 if (reg == 15)
227 val += 8;
228
229 return val;
230}
231
232/*
233 * Get value of operand 2 (in an ALU instruction)
234 */
235static unsigned long
236ptrace_getaluop2(struct task_struct *child, unsigned long insn)
237{
238 unsigned long val;
239 int shift;
240 int type;
241
242 if (insn & 1 << 25) {
243 val = insn & 255;
244 shift = (insn >> 8) & 15;
245 type = 3;
246 } else {
247 val = get_user_reg (child, insn & 15);
248
249 if (insn & (1 << 4))
250 shift = (int)get_user_reg (child, (insn >> 8) & 15);
251 else
252 shift = (insn >> 7) & 31;
253
254 type = (insn >> 5) & 3;
255 }
256
257 switch (type) {
258 case 0: val <<= shift; break;
259 case 1: val >>= shift; break;
260 case 2:
261 val = (((signed long)val) >> shift);
262 break;
263 case 3:
264 val = (val >> shift) | (val << (32 - shift));
265 break;
266 }
267 return val;
268}
269
270/*
271 * Get value of operand 2 (in a LDR instruction)
272 */
273static unsigned long
274ptrace_getldrop2(struct task_struct *child, unsigned long insn)
275{
276 unsigned long val;
277 int shift;
278 int type;
279
280 val = get_user_reg(child, insn & 15);
281 shift = (insn >> 7) & 31;
282 type = (insn >> 5) & 3;
283
284 switch (type) {
285 case 0: val <<= shift; break;
286 case 1: val >>= shift; break;
287 case 2:
288 val = (((signed long)val) >> shift);
289 break;
290 case 3:
291 val = (val >> shift) | (val << (32 - shift));
292 break;
293 }
294 return val;
295}
296
297#define OP_MASK 0x01e00000
298#define OP_AND 0x00000000
299#define OP_EOR 0x00200000
300#define OP_SUB 0x00400000
301#define OP_RSB 0x00600000
302#define OP_ADD 0x00800000
303#define OP_ADC 0x00a00000
304#define OP_SBC 0x00c00000
305#define OP_RSC 0x00e00000
306#define OP_ORR 0x01800000
307#define OP_MOV 0x01a00000
308#define OP_BIC 0x01c00000
309#define OP_MVN 0x01e00000
310
311static unsigned long
312get_branch_address(struct task_struct *child, unsigned long pc, unsigned long insn)
313{
314 u32 alt = 0;
315
316 switch (insn & 0x0e000000) {
317 case 0x00000000:
318 case 0x02000000: {
319 /*
320 * data processing
321 */
322 long aluop1, aluop2, ccbit;
323
324 if ((insn & 0x0fffffd0) == 0x012fff10) {
325 /*
326 * bx or blx
327 */
328 alt = get_user_reg(child, insn & 15);
329 break;
330 }
331
332
333 if ((insn & 0xf000) != 0xf000)
334 break;
335
336 aluop1 = ptrace_getrn(child, insn);
337 aluop2 = ptrace_getaluop2(child, insn);
338 ccbit = get_user_reg(child, REG_PSR) & PSR_C_BIT ? 1 : 0;
339
340 switch (insn & OP_MASK) {
341 case OP_AND: alt = aluop1 & aluop2; break;
342 case OP_EOR: alt = aluop1 ^ aluop2; break;
343 case OP_SUB: alt = aluop1 - aluop2; break;
344 case OP_RSB: alt = aluop2 - aluop1; break;
345 case OP_ADD: alt = aluop1 + aluop2; break;
346 case OP_ADC: alt = aluop1 + aluop2 + ccbit; break;
347 case OP_SBC: alt = aluop1 - aluop2 + ccbit; break;
348 case OP_RSC: alt = aluop2 - aluop1 + ccbit; break;
349 case OP_ORR: alt = aluop1 | aluop2; break;
350 case OP_MOV: alt = aluop2; break;
351 case OP_BIC: alt = aluop1 & ~aluop2; break;
352 case OP_MVN: alt = ~aluop2; break;
353 }
354 break;
355 }
356
357 case 0x04000000:
358 case 0x06000000:
359 /*
360 * ldr
361 */
362 if ((insn & 0x0010f000) == 0x0010f000) {
363 unsigned long base;
364
365 base = ptrace_getrn(child, insn);
366 if (insn & 1 << 24) {
367 long aluop2;
368
369 if (insn & 0x02000000)
370 aluop2 = ptrace_getldrop2(child, insn);
371 else
372 aluop2 = insn & 0xfff;
373
374 if (insn & 1 << 23)
375 base += aluop2;
376 else
377 base -= aluop2;
378 }
379 read_u32(child, base, &alt);
380 }
381 break;
382
383 case 0x08000000:
384 /*
385 * ldm
386 */
387 if ((insn & 0x00108000) == 0x00108000) {
388 unsigned long base;
389 unsigned int nr_regs;
390
391 if (insn & (1 << 23)) {
392 nr_regs = hweight16(insn & 65535) << 2;
393
394 if (!(insn & (1 << 24)))
395 nr_regs -= 4;
396 } else {
397 if (insn & (1 << 24))
398 nr_regs = -4;
399 else
400 nr_regs = 0;
401 }
402
403 base = ptrace_getrn(child, insn);
404
405 read_u32(child, base + nr_regs, &alt);
406 break;
407 }
408 break;
409
410 case 0x0a000000: {
411 /*
412 * bl or b
413 */
414 signed long displ;
415 /* It's a branch/branch link: instead of trying to
416 * figure out whether the branch will be taken or not,
417 * we'll put a breakpoint at both locations. This is
418 * simpler, more reliable, and probably not a whole lot
419 * slower than the alternative approach of emulating the
420 * branch.
421 */
422 displ = (insn & 0x00ffffff) << 8;
423 displ = (displ >> 6) + 8;
424 if (displ != 0 && displ != 4)
425 alt = pc + displ;
426 }
427 break;
428 }
429
430 return alt;
431}
432
433static int
434swap_insn(struct task_struct *task, unsigned long addr,
435 void *old_insn, void *new_insn, int size)
436{
437 int ret;
438
439 ret = access_process_vm(task, addr, old_insn, size, 0);
440 if (ret == size)
441 ret = access_process_vm(task, addr, new_insn, size, 1);
442 return ret;
443}
444
445static void
446add_breakpoint(struct task_struct *task, struct debug_info *dbg, unsigned long addr)
447{
448 int nr = dbg->nsaved;
449
450 if (nr < 2) {
451 u32 new_insn = BREAKINST_ARM;
452 int res;
453
454 res = swap_insn(task, addr, &dbg->bp[nr].insn, &new_insn, 4);
455
456 if (res == 4) {
457 dbg->bp[nr].address = addr;
458 dbg->nsaved += 1;
459 }
460 } else
461 printk(KERN_ERR "ptrace: too many breakpoints\n");
462}
463
464/*
465 * Clear one breakpoint in the user program. We copy what the hardware
466 * does and use bit 0 of the address to indicate whether this is a Thumb
467 * breakpoint or an ARM breakpoint.
468 */
469static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)
470{
471 unsigned long addr = bp->address;
472 union debug_insn old_insn;
473 int ret;
474
475 if (addr & 1) {
476 ret = swap_insn(task, addr & ~1, &old_insn.thumb,
477 &bp->insn.thumb, 2);
478
479 if (ret != 2 || old_insn.thumb != BREAKINST_THUMB)
480 printk(KERN_ERR "%s:%d: corrupted Thumb breakpoint at "
481 "0x%08lx (0x%04x)\n", task->comm,
482 task_pid_nr(task), addr, old_insn.thumb);
483 } else {
484 ret = swap_insn(task, addr & ~3, &old_insn.arm,
485 &bp->insn.arm, 4);
486
487 if (ret != 4 || old_insn.arm != BREAKINST_ARM)
488 printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
489 "0x%08lx (0x%08x)\n", task->comm,
490 task_pid_nr(task), addr, old_insn.arm);
491 }
492}
493
494void ptrace_set_bpt(struct task_struct *child)
495{
496 struct pt_regs *regs;
497 unsigned long pc;
498 u32 insn;
499 int res;
500
501 regs = task_pt_regs(child);
502 pc = instruction_pointer(regs);
503
504 if (thumb_mode(regs)) {
505 printk(KERN_WARNING "ptrace: can't handle thumb mode\n");
506 return;
507 }
508
509 res = read_instr(child, pc, &insn);
510 if (!res) {
511 struct debug_info *dbg = &child->thread.debug;
512 unsigned long alt;
513
514 dbg->nsaved = 0;
515
516 alt = get_branch_address(child, pc, insn);
517 if (alt)
518 add_breakpoint(child, dbg, alt);
519
520 /*
521 * Note that we ignore the result of setting the above
522 * breakpoint since it may fail. When it does, this is
523 * not so much an error, but a forewarning that we may
524 * be receiving a prefetch abort shortly.
525 *
526 * If we don't set this breakpoint here, then we can
527 * lose control of the thread during single stepping.
528 */
529 if (!alt || predicate(insn) != PREDICATE_ALWAYS)
530 add_breakpoint(child, dbg, pc + 4);
531 }
532}
533
534/*
535 * Ensure no single-step breakpoint is pending. Returns non-zero
536 * value if child was being single-stepped.
537 */
538void ptrace_cancel_bpt(struct task_struct *child)
539{
540 int i, nsaved = child->thread.debug.nsaved;
541
542 child->thread.debug.nsaved = 0;
543
544 if (nsaved > 2) {
545 printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
546 nsaved = 2;
547 }
548
549 for (i = 0; i < nsaved; i++)
550 clear_breakpoint(child, &child->thread.debug.bp[i]);
551}
552
553void user_disable_single_step(struct task_struct *task)
554{
555 task->ptrace &= ~PT_SINGLESTEP;
556 ptrace_cancel_bpt(task);
557}
558
559void user_enable_single_step(struct task_struct *task)
560{
561 task->ptrace |= PT_SINGLESTEP;
562}
563
564/* 185/*
565 * Called by kernel/ptrace.c when detaching.. 186 * Called by kernel/ptrace.c when detaching..
566 */ 187 */
567void ptrace_disable(struct task_struct *child) 188void ptrace_disable(struct task_struct *child)
568{ 189{
569 user_disable_single_step(child); 190 /* Nothing to do. */
570} 191}
571 192
572/* 193/*
@@ -576,8 +197,6 @@ void ptrace_break(struct task_struct *tsk, struct pt_regs *regs)
576{ 197{
577 siginfo_t info; 198 siginfo_t info;
578 199
579 ptrace_cancel_bpt(tsk);
580
581 info.si_signo = SIGTRAP; 200 info.si_signo = SIGTRAP;
582 info.si_errno = 0; 201 info.si_errno = 0;
583 info.si_code = TRAP_BRKPT; 202 info.si_code = TRAP_BRKPT;
@@ -996,10 +615,10 @@ static int ptrace_gethbpregs(struct task_struct *tsk, long num,
996 while (!(arch_ctrl.len & 0x1)) 615 while (!(arch_ctrl.len & 0x1))
997 arch_ctrl.len >>= 1; 616 arch_ctrl.len >>= 1;
998 617
999 if (idx & 0x1) 618 if (num & 0x1)
1000 reg = encode_ctrl_reg(arch_ctrl);
1001 else
1002 reg = bp->attr.bp_addr; 619 reg = bp->attr.bp_addr;
620 else
621 reg = encode_ctrl_reg(arch_ctrl);
1003 } 622 }
1004 623
1005put: 624put:
diff --git a/arch/arm/kernel/ptrace.h b/arch/arm/kernel/ptrace.h
deleted file mode 100644
index 3926605b82ea..000000000000
--- a/arch/arm/kernel/ptrace.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * linux/arch/arm/kernel/ptrace.h
3 *
4 * Copyright (C) 2000-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/ptrace.h>
11
12extern void ptrace_cancel_bpt(struct task_struct *);
13extern void ptrace_set_bpt(struct task_struct *);
14extern void ptrace_break(struct task_struct *, struct pt_regs *);
15
16/*
17 * Send SIGTRAP if we're single-stepping
18 */
19static inline void single_step_trap(struct task_struct *task)
20{
21 if (task->ptrace & PT_SINGLESTEP) {
22 ptrace_cancel_bpt(task);
23 send_sig(SIGTRAP, task, 1);
24 }
25}
26
27static inline void single_step_clear(struct task_struct *task)
28{
29 if (task->ptrace & PT_SINGLESTEP)
30 ptrace_cancel_bpt(task);
31}
32
33static inline void single_step_set(struct task_struct *task)
34{
35 if (task->ptrace & PT_SINGLESTEP)
36 ptrace_set_bpt(task);
37}
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index df246da4ceca..0b13a72f855d 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -9,6 +9,7 @@
9 * the Free Software Foundation. 9 * the Free Software Foundation.
10 */ 10 */
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/ftrace.h>
12 13
13#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) 14#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
14#include <linux/sched.h> 15#include <linux/sched.h>
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index f43f041a0977..d1da92174277 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -226,8 +226,8 @@ int cpu_architecture(void)
226 * Register 0 and check for VMSAv7 or PMSAv7 */ 226 * Register 0 and check for VMSAv7 or PMSAv7 */
227 asm("mrc p15, 0, %0, c0, c1, 4" 227 asm("mrc p15, 0, %0, c0, c1, 4"
228 : "=r" (mmfr0)); 228 : "=r" (mmfr0));
229 if ((mmfr0 & 0x0000000f) == 0x00000003 || 229 if ((mmfr0 & 0x0000000f) >= 0x00000003 ||
230 (mmfr0 & 0x000000f0) == 0x00000030) 230 (mmfr0 & 0x000000f0) >= 0x00000030)
231 cpu_arch = CPU_ARCH_ARMv7; 231 cpu_arch = CPU_ARCH_ARMv7;
232 else if ((mmfr0 & 0x0000000f) == 0x00000002 || 232 else if ((mmfr0 & 0x0000000f) == 0x00000002 ||
233 (mmfr0 & 0x000000f0) == 0x00000020) 233 (mmfr0 & 0x000000f0) == 0x00000020)
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 907d5a620bca..cb8398317644 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -20,7 +20,6 @@
20#include <asm/unistd.h> 20#include <asm/unistd.h>
21#include <asm/vfp.h> 21#include <asm/vfp.h>
22 22
23#include "ptrace.h"
24#include "signal.h" 23#include "signal.h"
25 24
26#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 25#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
@@ -348,8 +347,6 @@ asmlinkage int sys_sigreturn(struct pt_regs *regs)
348 if (restore_sigframe(regs, frame)) 347 if (restore_sigframe(regs, frame))
349 goto badframe; 348 goto badframe;
350 349
351 single_step_trap(current);
352
353 return regs->ARM_r0; 350 return regs->ARM_r0;
354 351
355badframe: 352badframe:
@@ -383,8 +380,6 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
383 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT) 380 if (do_sigaltstack(&frame->sig.uc.uc_stack, NULL, regs->ARM_sp) == -EFAULT)
384 goto badframe; 381 goto badframe;
385 382
386 single_step_trap(current);
387
388 return regs->ARM_r0; 383 return regs->ARM_r0;
389 384
390badframe: 385badframe:
@@ -474,7 +469,9 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
474 unsigned long handler = (unsigned long)ka->sa.sa_handler; 469 unsigned long handler = (unsigned long)ka->sa.sa_handler;
475 unsigned long retcode; 470 unsigned long retcode;
476 int thumb = 0; 471 int thumb = 0;
477 unsigned long cpsr = regs->ARM_cpsr & ~PSR_f; 472 unsigned long cpsr = regs->ARM_cpsr & ~(PSR_f | PSR_E_BIT);
473
474 cpsr |= PSR_ENDSTATE;
478 475
479 /* 476 /*
480 * Maybe we need to deliver a 32-bit signal to a 26-bit task. 477 * Maybe we need to deliver a 32-bit signal to a 26-bit task.
@@ -704,8 +701,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
704 if (try_to_freeze()) 701 if (try_to_freeze())
705 goto no_signal; 702 goto no_signal;
706 703
707 single_step_clear(current);
708
709 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 704 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
710 if (signr > 0) { 705 if (signr > 0) {
711 sigset_t *oldset; 706 sigset_t *oldset;
@@ -724,7 +719,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
724 if (test_thread_flag(TIF_RESTORE_SIGMASK)) 719 if (test_thread_flag(TIF_RESTORE_SIGMASK))
725 clear_thread_flag(TIF_RESTORE_SIGMASK); 720 clear_thread_flag(TIF_RESTORE_SIGMASK);
726 } 721 }
727 single_step_set(current);
728 return; 722 return;
729 } 723 }
730 724
@@ -770,7 +764,6 @@ static void do_signal(struct pt_regs *regs, int syscall)
770 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 764 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
771 } 765 }
772 } 766 }
773 single_step_set(current);
774} 767}
775 768
776asmlinkage void 769asmlinkage void
diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S
new file mode 100644
index 000000000000..bfad698a02e7
--- /dev/null
+++ b/arch/arm/kernel/sleep.S
@@ -0,0 +1,134 @@
1#include <linux/linkage.h>
2#include <linux/threads.h>
3#include <asm/asm-offsets.h>
4#include <asm/assembler.h>
5#include <asm/glue-cache.h>
6#include <asm/glue-proc.h>
7#include <asm/system.h>
8 .text
9
10/*
11 * Save CPU state for a suspend
12 * r1 = v:p offset
13 * r3 = virtual return function
14 * Note: sp is decremented to allocate space for CPU state on stack
15 * r0-r3,r9,r10,lr corrupted
16 */
17ENTRY(cpu_suspend)
18 mov r9, lr
19#ifdef MULTI_CPU
20 ldr r10, =processor
21 mov r2, sp @ current virtual SP
22 ldr r0, [r10, #CPU_SLEEP_SIZE] @ size of CPU sleep state
23 ldr ip, [r10, #CPU_DO_RESUME] @ virtual resume function
24 sub sp, sp, r0 @ allocate CPU state on stack
25 mov r0, sp @ save pointer
26 add ip, ip, r1 @ convert resume fn to phys
27 stmfd sp!, {r1, r2, r3, ip} @ save v:p, virt SP, retfn, phys resume fn
28 ldr r3, =sleep_save_sp
29 add r2, sp, r1 @ convert SP to phys
30#ifdef CONFIG_SMP
31 ALT_SMP(mrc p15, 0, lr, c0, c0, 5)
32 ALT_UP(mov lr, #0)
33 and lr, lr, #15
34 str r2, [r3, lr, lsl #2] @ save phys SP
35#else
36 str r2, [r3] @ save phys SP
37#endif
38 mov lr, pc
39 ldr pc, [r10, #CPU_DO_SUSPEND] @ save CPU state
40#else
41 mov r2, sp @ current virtual SP
42 ldr r0, =cpu_suspend_size
43 sub sp, sp, r0 @ allocate CPU state on stack
44 mov r0, sp @ save pointer
45 stmfd sp!, {r1, r2, r3} @ save v:p, virt SP, return fn
46 ldr r3, =sleep_save_sp
47 add r2, sp, r1 @ convert SP to phys
48#ifdef CONFIG_SMP
49 ALT_SMP(mrc p15, 0, lr, c0, c0, 5)
50 ALT_UP(mov lr, #0)
51 and lr, lr, #15
52 str r2, [r3, lr, lsl #2] @ save phys SP
53#else
54 str r2, [r3] @ save phys SP
55#endif
56 bl cpu_do_suspend
57#endif
58
59 @ flush data cache
60#ifdef MULTI_CACHE
61 ldr r10, =cpu_cache
62 mov lr, r9
63 ldr pc, [r10, #CACHE_FLUSH_KERN_ALL]
64#else
65 mov lr, r9
66 b __cpuc_flush_kern_all
67#endif
68ENDPROC(cpu_suspend)
69 .ltorg
70
71/*
72 * r0 = control register value
73 * r1 = v:p offset (preserved by cpu_do_resume)
74 * r2 = phys page table base
75 * r3 = L1 section flags
76 */
77ENTRY(cpu_resume_mmu)
78 adr r4, cpu_resume_turn_mmu_on
79 mov r4, r4, lsr #20
80 orr r3, r3, r4, lsl #20
81 ldr r5, [r2, r4, lsl #2] @ save old mapping
82 str r3, [r2, r4, lsl #2] @ setup 1:1 mapping for mmu code
83 sub r2, r2, r1
84 ldr r3, =cpu_resume_after_mmu
85 bic r1, r0, #CR_C @ ensure D-cache is disabled
86 b cpu_resume_turn_mmu_on
87ENDPROC(cpu_resume_mmu)
88 .ltorg
89 .align 5
90cpu_resume_turn_mmu_on:
91 mcr p15, 0, r1, c1, c0, 0 @ turn on MMU, I-cache, etc
92 mrc p15, 0, r1, c0, c0, 0 @ read id reg
93 mov r1, r1
94 mov r1, r1
95 mov pc, r3 @ jump to virtual address
96ENDPROC(cpu_resume_turn_mmu_on)
97cpu_resume_after_mmu:
98 str r5, [r2, r4, lsl #2] @ restore old mapping
99 mcr p15, 0, r0, c1, c0, 0 @ turn on D-cache
100 mov pc, lr
101ENDPROC(cpu_resume_after_mmu)
102
103/*
104 * Note: Yes, part of the following code is located into the .data section.
105 * This is to allow sleep_save_sp to be accessed with a relative load
106 * while we can't rely on any MMU translation. We could have put
107 * sleep_save_sp in the .text section as well, but some setups might
108 * insist on it to be truly read-only.
109 */
110 .data
111 .align
112ENTRY(cpu_resume)
113#ifdef CONFIG_SMP
114 adr r0, sleep_save_sp
115 ALT_SMP(mrc p15, 0, r1, c0, c0, 5)
116 ALT_UP(mov r1, #0)
117 and r1, r1, #15
118 ldr r0, [r0, r1, lsl #2] @ stack phys addr
119#else
120 ldr r0, sleep_save_sp @ stack phys addr
121#endif
122 msr cpsr_c, #PSR_I_BIT | PSR_F_BIT | SVC_MODE @ set SVC, irqs off
123#ifdef MULTI_CPU
124 ldmia r0!, {r1, sp, lr, pc} @ load v:p, stack, return fn, resume fn
125#else
126 ldmia r0!, {r1, sp, lr} @ load v:p, stack, return fn
127 b cpu_do_resume
128#endif
129ENDPROC(cpu_resume)
130
131sleep_save_sp:
132 .rept CONFIG_NR_CPUS
133 .long 0 @ preserve stack phys ptr here
134 .endr
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 9ab4149bd983..a1e757c3439b 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -50,3 +50,26 @@ void __init scu_enable(void __iomem *scu_base)
50 */ 50 */
51 flush_cache_all(); 51 flush_cache_all();
52} 52}
53
54/*
55 * Set the executing CPUs power mode as defined. This will be in
56 * preparation for it executing a WFI instruction.
57 *
58 * This function must be called with preemption disabled, and as it
59 * has the side effect of disabling coherency, caches must have been
60 * flushed. Interrupts must also have been disabled.
61 */
62int scu_power_mode(void __iomem *scu_base, unsigned int mode)
63{
64 unsigned int val;
65 int cpu = smp_processor_id();
66
67 if (mode > 3 || mode == 1 || cpu > 3)
68 return -EINVAL;
69
70 val = __raw_readb(scu_base + SCU_CPU_STATUS + cpu) & ~0x03;
71 val |= mode;
72 __raw_writeb(val, scu_base + SCU_CPU_STATUS + cpu);
73
74 return 0;
75}
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index ee57640ba2bb..21ac43f1c2d0 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -23,6 +23,7 @@
23#include <linux/kexec.h> 23#include <linux/kexec.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/sched.h>
26 27
27#include <asm/atomic.h> 28#include <asm/atomic.h>
28#include <asm/cacheflush.h> 29#include <asm/cacheflush.h>
@@ -32,7 +33,6 @@
32#include <asm/unwind.h> 33#include <asm/unwind.h>
33#include <asm/tls.h> 34#include <asm/tls.h>
34 35
35#include "ptrace.h"
36#include "signal.h" 36#include "signal.h"
37 37
38static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" }; 38static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" };
@@ -256,7 +256,7 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
256 return ret; 256 return ret;
257} 257}
258 258
259DEFINE_SPINLOCK(die_lock); 259static DEFINE_SPINLOCK(die_lock);
260 260
261/* 261/*
262 * This function is protected against re-entrancy. 262 * This function is protected against re-entrancy.
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 45b5651777ee..dfbb377e251d 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -21,6 +21,12 @@
21#define ARM_CPU_KEEP(x) 21#define ARM_CPU_KEEP(x)
22#endif 22#endif
23 23
24#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)
25#define ARM_EXIT_KEEP(x) x
26#else
27#define ARM_EXIT_KEEP(x)
28#endif
29
24OUTPUT_ARCH(arm) 30OUTPUT_ARCH(arm)
25ENTRY(stext) 31ENTRY(stext)
26 32
@@ -43,6 +49,7 @@ SECTIONS
43 _sinittext = .; 49 _sinittext = .;
44 HEAD_TEXT 50 HEAD_TEXT
45 INIT_TEXT 51 INIT_TEXT
52 ARM_EXIT_KEEP(EXIT_TEXT)
46 _einittext = .; 53 _einittext = .;
47 ARM_CPU_DISCARD(PROC_INFO) 54 ARM_CPU_DISCARD(PROC_INFO)
48 __arch_info_begin = .; 55 __arch_info_begin = .;
@@ -71,6 +78,7 @@ SECTIONS
71#ifndef CONFIG_XIP_KERNEL 78#ifndef CONFIG_XIP_KERNEL
72 __init_begin = _stext; 79 __init_begin = _stext;
73 INIT_DATA 80 INIT_DATA
81 ARM_EXIT_KEEP(EXIT_DATA)
74#endif 82#endif
75 } 83 }
76 84
@@ -166,6 +174,7 @@ SECTIONS
166 . = ALIGN(PAGE_SIZE); 174 . = ALIGN(PAGE_SIZE);
167 __init_begin = .; 175 __init_begin = .;
168 INIT_DATA 176 INIT_DATA
177 ARM_EXIT_KEEP(EXIT_DATA)
169 . = ALIGN(PAGE_SIZE); 178 . = ALIGN(PAGE_SIZE);
170 __init_end = .; 179 __init_end = .;
171#endif 180#endif
@@ -251,6 +260,8 @@ SECTIONS
251 } 260 }
252#endif 261#endif
253 262
263 NOTES
264
254 BSS_SECTION(0, 0, 0) 265 BSS_SECTION(0, 0, 0)
255 _end = .; 266 _end = .;
256 267
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index d42252918bfb..10d868a5a481 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -1,44 +1,52 @@
1 1#if __LINUX_ARM_ARCH__ >= 6
2#if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_CPU_32v6K)
3 .macro bitop, instr 2 .macro bitop, instr
3 ands ip, r1, #3
4 strneb r1, [ip] @ assert word-aligned
4 mov r2, #1 5 mov r2, #1
5 and r3, r0, #7 @ Get bit offset 6 and r3, r0, #31 @ Get bit offset
6 add r1, r1, r0, lsr #3 @ Get byte offset 7 mov r0, r0, lsr #5
8 add r1, r1, r0, lsl #2 @ Get word offset
7 mov r3, r2, lsl r3 9 mov r3, r2, lsl r3
81: ldrexb r2, [r1] 101: ldrex r2, [r1]
9 \instr r2, r2, r3 11 \instr r2, r2, r3
10 strexb r0, r2, [r1] 12 strex r0, r2, [r1]
11 cmp r0, #0 13 cmp r0, #0
12 bne 1b 14 bne 1b
13 mov pc, lr 15 bx lr
14 .endm 16 .endm
15 17
16 .macro testop, instr, store 18 .macro testop, instr, store
17 and r3, r0, #7 @ Get bit offset 19 ands ip, r1, #3
20 strneb r1, [ip] @ assert word-aligned
18 mov r2, #1 21 mov r2, #1
19 add r1, r1, r0, lsr #3 @ Get byte offset 22 and r3, r0, #31 @ Get bit offset
23 mov r0, r0, lsr #5
24 add r1, r1, r0, lsl #2 @ Get word offset
20 mov r3, r2, lsl r3 @ create mask 25 mov r3, r2, lsl r3 @ create mask
21 smp_dmb 26 smp_dmb
221: ldrexb r2, [r1] 271: ldrex r2, [r1]
23 ands r0, r2, r3 @ save old value of bit 28 ands r0, r2, r3 @ save old value of bit
24 \instr r2, r2, r3 @ toggle bit 29 \instr r2, r2, r3 @ toggle bit
25 strexb ip, r2, [r1] 30 strex ip, r2, [r1]
26 cmp ip, #0 31 cmp ip, #0
27 bne 1b 32 bne 1b
28 smp_dmb 33 smp_dmb
29 cmp r0, #0 34 cmp r0, #0
30 movne r0, #1 35 movne r0, #1
312: mov pc, lr 362: bx lr
32 .endm 37 .endm
33#else 38#else
34 .macro bitop, instr 39 .macro bitop, instr
35 and r2, r0, #7 40 ands ip, r1, #3
41 strneb r1, [ip] @ assert word-aligned
42 and r2, r0, #31
43 mov r0, r0, lsr #5
36 mov r3, #1 44 mov r3, #1
37 mov r3, r3, lsl r2 45 mov r3, r3, lsl r2
38 save_and_disable_irqs ip 46 save_and_disable_irqs ip
39 ldrb r2, [r1, r0, lsr #3] 47 ldr r2, [r1, r0, lsl #2]
40 \instr r2, r2, r3 48 \instr r2, r2, r3
41 strb r2, [r1, r0, lsr #3] 49 str r2, [r1, r0, lsl #2]
42 restore_irqs ip 50 restore_irqs ip
43 mov pc, lr 51 mov pc, lr
44 .endm 52 .endm
@@ -52,11 +60,13 @@
52 * to avoid dirtying the data cache. 60 * to avoid dirtying the data cache.
53 */ 61 */
54 .macro testop, instr, store 62 .macro testop, instr, store
55 add r1, r1, r0, lsr #3 63 ands ip, r1, #3
56 and r3, r0, #7 64 strneb r1, [ip] @ assert word-aligned
57 mov r0, #1 65 and r3, r0, #31
66 mov r0, r0, lsr #5
58 save_and_disable_irqs ip 67 save_and_disable_irqs ip
59 ldrb r2, [r1] 68 ldr r2, [r1, r0, lsl #2]!
69 mov r0, #1
60 tst r2, r0, lsl r3 70 tst r2, r0, lsl r3
61 \instr r2, r2, r0, lsl r3 71 \instr r2, r2, r0, lsl r3
62 \store r2, [r1] 72 \store r2, [r1]
diff --git a/arch/arm/lib/changebit.S b/arch/arm/lib/changebit.S
index 80f3115cbee2..68ed5b62e839 100644
--- a/arch/arm/lib/changebit.S
+++ b/arch/arm/lib/changebit.S
@@ -12,12 +12,6 @@
12#include "bitops.h" 12#include "bitops.h"
13 .text 13 .text
14 14
15/* Purpose : Function to change a bit 15ENTRY(_change_bit)
16 * Prototype: int change_bit(int bit, void *addr)
17 */
18ENTRY(_change_bit_be)
19 eor r0, r0, #0x18 @ big endian byte ordering
20ENTRY(_change_bit_le)
21 bitop eor 16 bitop eor
22ENDPROC(_change_bit_be) 17ENDPROC(_change_bit)
23ENDPROC(_change_bit_le)
diff --git a/arch/arm/lib/clearbit.S b/arch/arm/lib/clearbit.S
index 1a63e43a1df0..4c04c3b51eeb 100644
--- a/arch/arm/lib/clearbit.S
+++ b/arch/arm/lib/clearbit.S
@@ -12,13 +12,6 @@
12#include "bitops.h" 12#include "bitops.h"
13 .text 13 .text
14 14
15/* 15ENTRY(_clear_bit)
16 * Purpose : Function to clear a bit
17 * Prototype: int clear_bit(int bit, void *addr)
18 */
19ENTRY(_clear_bit_be)
20 eor r0, r0, #0x18 @ big endian byte ordering
21ENTRY(_clear_bit_le)
22 bitop bic 16 bitop bic
23ENDPROC(_clear_bit_be) 17ENDPROC(_clear_bit)
24ENDPROC(_clear_bit_le)
diff --git a/arch/arm/lib/setbit.S b/arch/arm/lib/setbit.S
index 1dd7176c4b2b..bbee5c66a23e 100644
--- a/arch/arm/lib/setbit.S
+++ b/arch/arm/lib/setbit.S
@@ -12,13 +12,6 @@
12#include "bitops.h" 12#include "bitops.h"
13 .text 13 .text
14 14
15/* 15ENTRY(_set_bit)
16 * Purpose : Function to set a bit
17 * Prototype: int set_bit(int bit, void *addr)
18 */
19ENTRY(_set_bit_be)
20 eor r0, r0, #0x18 @ big endian byte ordering
21ENTRY(_set_bit_le)
22 bitop orr 16 bitop orr
23ENDPROC(_set_bit_be) 17ENDPROC(_set_bit)
24ENDPROC(_set_bit_le)
diff --git a/arch/arm/lib/testchangebit.S b/arch/arm/lib/testchangebit.S
index 5c98dc567f0f..15a4d431f229 100644
--- a/arch/arm/lib/testchangebit.S
+++ b/arch/arm/lib/testchangebit.S
@@ -12,9 +12,6 @@
12#include "bitops.h" 12#include "bitops.h"
13 .text 13 .text
14 14
15ENTRY(_test_and_change_bit_be) 15ENTRY(_test_and_change_bit)
16 eor r0, r0, #0x18 @ big endian byte ordering 16 testop eor, str
17ENTRY(_test_and_change_bit_le) 17ENDPROC(_test_and_change_bit)
18 testop eor, strb
19ENDPROC(_test_and_change_bit_be)
20ENDPROC(_test_and_change_bit_le)
diff --git a/arch/arm/lib/testclearbit.S b/arch/arm/lib/testclearbit.S
index 543d7094d18e..521b66b5b95d 100644
--- a/arch/arm/lib/testclearbit.S
+++ b/arch/arm/lib/testclearbit.S
@@ -12,9 +12,6 @@
12#include "bitops.h" 12#include "bitops.h"
13 .text 13 .text
14 14
15ENTRY(_test_and_clear_bit_be) 15ENTRY(_test_and_clear_bit)
16 eor r0, r0, #0x18 @ big endian byte ordering 16 testop bicne, strne
17ENTRY(_test_and_clear_bit_le) 17ENDPROC(_test_and_clear_bit)
18 testop bicne, strneb
19ENDPROC(_test_and_clear_bit_be)
20ENDPROC(_test_and_clear_bit_le)
diff --git a/arch/arm/lib/testsetbit.S b/arch/arm/lib/testsetbit.S
index 0b3f390401ce..1c98cc2185bb 100644
--- a/arch/arm/lib/testsetbit.S
+++ b/arch/arm/lib/testsetbit.S
@@ -12,9 +12,6 @@
12#include "bitops.h" 12#include "bitops.h"
13 .text 13 .text
14 14
15ENTRY(_test_and_set_bit_be) 15ENTRY(_test_and_set_bit)
16 eor r0, r0, #0x18 @ big endian byte ordering 16 testop orreq, streq
17ENTRY(_test_and_set_bit_le) 17ENDPROC(_test_and_set_bit)
18 testop orreq, streqb
19ENDPROC(_test_and_set_bit_be)
20ENDPROC(_test_and_set_bit_le)
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
index 0a99b3cedd7a..17f7d9b32142 100644
--- a/arch/arm/mach-at91/board-snapper9260.c
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -153,6 +153,7 @@ static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
153 { 153 {
154 /* RTC */ 154 /* RTC */
155 I2C_BOARD_INFO("isl1208", 0x6f), 155 I2C_BOARD_INFO("isl1208", 0x6f),
156 .irq = gpio_to_irq(AT91_PIN_PA31),
156 }, 157 },
157}; 158};
158 159
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index bfdd8ab26dc8..ddeb64536756 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -220,15 +220,8 @@ extern void at91_gpio_resume(void);
220#define gpio_set_value __gpio_set_value 220#define gpio_set_value __gpio_set_value
221#define gpio_cansleep __gpio_cansleep 221#define gpio_cansleep __gpio_cansleep
222 222
223static inline int gpio_to_irq(unsigned gpio) 223#define gpio_to_irq(gpio) (gpio)
224{ 224#define irq_to_gpio(irq) (irq)
225 return gpio;
226}
227
228static inline int irq_to_gpio(unsigned irq)
229{
230 return irq;
231}
232 225
233#endif /* __ASSEMBLY__ */ 226#endif /* __ASSEMBLY__ */
234 227
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index 343de73161fa..4a68c2b1ec11 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -132,7 +132,7 @@ out:
132 return ret; 132 return ret;
133} 133}
134 134
135static int __init davinci_cpu_init(struct cpufreq_policy *policy) 135static int davinci_cpu_init(struct cpufreq_policy *policy)
136{ 136{
137 int result = 0; 137 int result = 0;
138 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; 138 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 9eec63070e0c..beda8a4133a0 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -480,8 +480,15 @@ static struct platform_device da850_mcasp_device = {
480 .resource = da850_mcasp_resources, 480 .resource = da850_mcasp_resources,
481}; 481};
482 482
483struct platform_device davinci_pcm_device = {
484 .name = "davinci-pcm-audio",
485 .id = -1,
486};
487
483void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) 488void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
484{ 489{
490 platform_device_register(&davinci_pcm_device);
491
485 /* DA830/OMAP-L137 has 3 instances of McASP */ 492 /* DA830/OMAP-L137 has 3 instances of McASP */
486 if (cpu_is_davinci_da830() && id == 1) { 493 if (cpu_is_davinci_da830() && id == 1) {
487 da830_mcasp1_device.dev.platform_data = pdata; 494 da830_mcasp1_device.dev.platform_data = pdata;
diff --git a/arch/arm/mach-davinci/gpio-tnetv107x.c b/arch/arm/mach-davinci/gpio-tnetv107x.c
index d10298620e2c..3fa3e2867e19 100644
--- a/arch/arm/mach-davinci/gpio-tnetv107x.c
+++ b/arch/arm/mach-davinci/gpio-tnetv107x.c
@@ -58,7 +58,7 @@ static int tnetv107x_gpio_request(struct gpio_chip *chip, unsigned offset)
58 58
59 spin_lock_irqsave(&ctlr->lock, flags); 59 spin_lock_irqsave(&ctlr->lock, flags);
60 60
61 gpio_reg_set_bit(&regs->enable, gpio); 61 gpio_reg_set_bit(regs->enable, gpio);
62 62
63 spin_unlock_irqrestore(&ctlr->lock, flags); 63 spin_unlock_irqrestore(&ctlr->lock, flags);
64 64
@@ -74,7 +74,7 @@ static void tnetv107x_gpio_free(struct gpio_chip *chip, unsigned offset)
74 74
75 spin_lock_irqsave(&ctlr->lock, flags); 75 spin_lock_irqsave(&ctlr->lock, flags);
76 76
77 gpio_reg_clear_bit(&regs->enable, gpio); 77 gpio_reg_clear_bit(regs->enable, gpio);
78 78
79 spin_unlock_irqrestore(&ctlr->lock, flags); 79 spin_unlock_irqrestore(&ctlr->lock, flags);
80} 80}
@@ -88,7 +88,7 @@ static int tnetv107x_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
88 88
89 spin_lock_irqsave(&ctlr->lock, flags); 89 spin_lock_irqsave(&ctlr->lock, flags);
90 90
91 gpio_reg_set_bit(&regs->direction, gpio); 91 gpio_reg_set_bit(regs->direction, gpio);
92 92
93 spin_unlock_irqrestore(&ctlr->lock, flags); 93 spin_unlock_irqrestore(&ctlr->lock, flags);
94 94
@@ -106,11 +106,11 @@ static int tnetv107x_gpio_dir_out(struct gpio_chip *chip,
106 spin_lock_irqsave(&ctlr->lock, flags); 106 spin_lock_irqsave(&ctlr->lock, flags);
107 107
108 if (value) 108 if (value)
109 gpio_reg_set_bit(&regs->data_out, gpio); 109 gpio_reg_set_bit(regs->data_out, gpio);
110 else 110 else
111 gpio_reg_clear_bit(&regs->data_out, gpio); 111 gpio_reg_clear_bit(regs->data_out, gpio);
112 112
113 gpio_reg_clear_bit(&regs->direction, gpio); 113 gpio_reg_clear_bit(regs->direction, gpio);
114 114
115 spin_unlock_irqrestore(&ctlr->lock, flags); 115 spin_unlock_irqrestore(&ctlr->lock, flags);
116 116
@@ -124,7 +124,7 @@ static int tnetv107x_gpio_get(struct gpio_chip *chip, unsigned offset)
124 unsigned gpio = chip->base + offset; 124 unsigned gpio = chip->base + offset;
125 int ret; 125 int ret;
126 126
127 ret = gpio_reg_get_bit(&regs->data_in, gpio); 127 ret = gpio_reg_get_bit(regs->data_in, gpio);
128 128
129 return ret ? 1 : 0; 129 return ret ? 1 : 0;
130} 130}
@@ -140,9 +140,9 @@ static void tnetv107x_gpio_set(struct gpio_chip *chip,
140 spin_lock_irqsave(&ctlr->lock, flags); 140 spin_lock_irqsave(&ctlr->lock, flags);
141 141
142 if (value) 142 if (value)
143 gpio_reg_set_bit(&regs->data_out, gpio); 143 gpio_reg_set_bit(regs->data_out, gpio);
144 else 144 else
145 gpio_reg_clear_bit(&regs->data_out, gpio); 145 gpio_reg_clear_bit(regs->data_out, gpio);
146 146
147 spin_unlock_irqrestore(&ctlr->lock, flags); 147 spin_unlock_irqrestore(&ctlr->lock, flags);
148} 148}
diff --git a/arch/arm/mach-davinci/include/mach/clkdev.h b/arch/arm/mach-davinci/include/mach/clkdev.h
index 730c49d1ebd8..14a504887189 100644
--- a/arch/arm/mach-davinci/include/mach/clkdev.h
+++ b/arch/arm/mach-davinci/include/mach/clkdev.h
@@ -1,6 +1,8 @@
1#ifndef __MACH_CLKDEV_H 1#ifndef __MACH_CLKDEV_H
2#define __MACH_CLKDEV_H 2#define __MACH_CLKDEV_H
3 3
4struct clk;
5
4static inline int __clk_get(struct clk *clk) 6static inline int __clk_get(struct clk *clk)
5{ 7{
6 return 1; 8 return 1;
diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index a4ed3900912a..dd937c526a45 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -9,7 +9,7 @@ config MACH_DOVE_DB
9 Say 'Y' here if you want your kernel to support the 9 Say 'Y' here if you want your kernel to support the
10 Marvell DB-MV88AP510 Development Board. 10 Marvell DB-MV88AP510 Development Board.
11 11
12 config MACH_CM_A510 12config MACH_CM_A510
13 bool "CompuLab CM-A510 Board" 13 bool "CompuLab CM-A510 Board"
14 help 14 help
15 Say 'Y' here if you want your kernel to support the 15 Say 'Y' here if you want your kernel to support the
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index ffdf87be2958..82079545adc4 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -838,7 +838,7 @@ EXPORT_SYMBOL(ep93xx_i2s_release);
838static struct resource ep93xx_ac97_resources[] = { 838static struct resource ep93xx_ac97_resources[] = {
839 { 839 {
840 .start = EP93XX_AAC_PHYS_BASE, 840 .start = EP93XX_AAC_PHYS_BASE,
841 .end = EP93XX_AAC_PHYS_BASE + 0xb0 - 1, 841 .end = EP93XX_AAC_PHYS_BASE + 0xac - 1,
842 .flags = IORESOURCE_MEM, 842 .flags = IORESOURCE_MEM,
843 }, 843 },
844 { 844 {
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 4b0431652131..9969bb115f60 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -30,8 +30,13 @@
30#include <linux/gpio.h> 30#include <linux/gpio.h>
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/i2c-gpio.h> 32#include <linux/i2c-gpio.h>
33#include <linux/spi/spi.h>
34
35#include <sound/cs4271.h>
33 36
34#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/fb.h>
39#include <mach/ep93xx_spi.h>
35 40
36#include <asm/mach-types.h> 41#include <asm/mach-types.h>
37#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
@@ -93,6 +98,83 @@ static void __init edb93xx_register_i2c(void)
93 98
94 99
95/************************************************************************* 100/*************************************************************************
101 * EDB93xx SPI peripheral handling
102 *************************************************************************/
103static struct cs4271_platform_data edb93xx_cs4271_data = {
104 .gpio_nreset = -EINVAL, /* filled in later */
105};
106
107static int edb93xx_cs4271_hw_setup(struct spi_device *spi)
108{
109 return gpio_request_one(EP93XX_GPIO_LINE_EGPIO6,
110 GPIOF_OUT_INIT_HIGH, spi->modalias);
111}
112
113static void edb93xx_cs4271_hw_cleanup(struct spi_device *spi)
114{
115 gpio_free(EP93XX_GPIO_LINE_EGPIO6);
116}
117
118static void edb93xx_cs4271_hw_cs_control(struct spi_device *spi, int value)
119{
120 gpio_set_value(EP93XX_GPIO_LINE_EGPIO6, value);
121}
122
123static struct ep93xx_spi_chip_ops edb93xx_cs4271_hw = {
124 .setup = edb93xx_cs4271_hw_setup,
125 .cleanup = edb93xx_cs4271_hw_cleanup,
126 .cs_control = edb93xx_cs4271_hw_cs_control,
127};
128
129static struct spi_board_info edb93xx_spi_board_info[] __initdata = {
130 {
131 .modalias = "cs4271",
132 .platform_data = &edb93xx_cs4271_data,
133 .controller_data = &edb93xx_cs4271_hw,
134 .max_speed_hz = 6000000,
135 .bus_num = 0,
136 .chip_select = 0,
137 .mode = SPI_MODE_3,
138 },
139};
140
141static struct ep93xx_spi_info edb93xx_spi_info __initdata = {
142 .num_chipselect = ARRAY_SIZE(edb93xx_spi_board_info),
143};
144
145static void __init edb93xx_register_spi(void)
146{
147 if (machine_is_edb9301() || machine_is_edb9302())
148 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1;
149 else if (machine_is_edb9302a() || machine_is_edb9307a())
150 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2);
151 else if (machine_is_edb9315a())
152 edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14;
153
154 ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info,
155 ARRAY_SIZE(edb93xx_spi_board_info));
156}
157
158
159/*************************************************************************
160 * EDB93xx I2S
161 *************************************************************************/
162static int __init edb93xx_has_audio(void)
163{
164 return (machine_is_edb9301() || machine_is_edb9302() ||
165 machine_is_edb9302a() || machine_is_edb9307a() ||
166 machine_is_edb9315a());
167}
168
169static void __init edb93xx_register_i2s(void)
170{
171 if (edb93xx_has_audio()) {
172 ep93xx_register_i2s();
173 }
174}
175
176
177/*************************************************************************
96 * EDB93xx pwm 178 * EDB93xx pwm
97 *************************************************************************/ 179 *************************************************************************/
98static void __init edb93xx_register_pwm(void) 180static void __init edb93xx_register_pwm(void)
@@ -111,13 +193,47 @@ static void __init edb93xx_register_pwm(void)
111} 193}
112 194
113 195
196/*************************************************************************
197 * EDB93xx framebuffer
198 *************************************************************************/
199static struct ep93xxfb_mach_info __initdata edb93xxfb_info = {
200 .num_modes = EP93XXFB_USE_MODEDB,
201 .bpp = 16,
202 .flags = 0,
203};
204
205static int __init edb93xx_has_fb(void)
206{
207 /* These platforms have an ep93xx with video capability */
208 return machine_is_edb9307() || machine_is_edb9307a() ||
209 machine_is_edb9312() || machine_is_edb9315() ||
210 machine_is_edb9315a();
211}
212
213static void __init edb93xx_register_fb(void)
214{
215 if (!edb93xx_has_fb())
216 return;
217
218 if (machine_is_edb9307a() || machine_is_edb9315a())
219 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0;
220 else
221 edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3;
222
223 ep93xx_register_fb(&edb93xxfb_info);
224}
225
226
114static void __init edb93xx_init_machine(void) 227static void __init edb93xx_init_machine(void)
115{ 228{
116 ep93xx_init_devices(); 229 ep93xx_init_devices();
117 edb93xx_register_flash(); 230 edb93xx_register_flash();
118 ep93xx_register_eth(&edb93xx_eth_data, 1); 231 ep93xx_register_eth(&edb93xx_eth_data, 1);
119 edb93xx_register_i2c(); 232 edb93xx_register_i2c();
233 edb93xx_register_spi();
234 edb93xx_register_i2s();
120 edb93xx_register_pwm(); 235 edb93xx_register_pwm();
236 edb93xx_register_fb();
121} 237}
122 238
123 239
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c
index bec34b834958..a889fa7c3ba1 100644
--- a/arch/arm/mach-ep93xx/gpio.c
+++ b/arch/arm/mach-ep93xx/gpio.c
@@ -61,7 +61,7 @@ static inline void ep93xx_gpio_int_mask(unsigned line)
61 gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7)); 61 gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7));
62} 62}
63 63
64void ep93xx_gpio_int_debounce(unsigned int irq, int enable) 64static void ep93xx_gpio_int_debounce(unsigned int irq, bool enable)
65{ 65{
66 int line = irq_to_gpio(irq); 66 int line = irq_to_gpio(irq);
67 int port = line >> 3; 67 int port = line >> 3;
@@ -75,7 +75,6 @@ void ep93xx_gpio_int_debounce(unsigned int irq, int enable)
75 __raw_writeb(gpio_int_debounce[port], 75 __raw_writeb(gpio_int_debounce[port],
76 EP93XX_GPIO_REG(int_debounce_register_offset[port])); 76 EP93XX_GPIO_REG(int_debounce_register_offset[port]));
77} 77}
78EXPORT_SYMBOL(ep93xx_gpio_int_debounce);
79 78
80static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc) 79static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc)
81{ 80{
@@ -335,6 +334,20 @@ static void ep93xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
335 local_irq_restore(flags); 334 local_irq_restore(flags);
336} 335}
337 336
337static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
338 unsigned offset, unsigned debounce)
339{
340 int gpio = chip->base + offset;
341 int irq = gpio_to_irq(gpio);
342
343 if (irq < 0)
344 return -EINVAL;
345
346 ep93xx_gpio_int_debounce(irq, debounce ? true : false);
347
348 return 0;
349}
350
338static void ep93xx_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) 351static void ep93xx_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
339{ 352{
340 struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip); 353 struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
@@ -434,6 +447,18 @@ void __init ep93xx_gpio_init(void)
434 EP93XX_SYSCON_DEVCFG_GONIDE | 447 EP93XX_SYSCON_DEVCFG_GONIDE |
435 EP93XX_SYSCON_DEVCFG_HONIDE); 448 EP93XX_SYSCON_DEVCFG_HONIDE);
436 449
437 for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) 450 for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) {
438 gpiochip_add(&ep93xx_gpio_banks[i].chip); 451 struct gpio_chip *chip = &ep93xx_gpio_banks[i].chip;
452
453 /*
454 * Ports A, B, and F support input debouncing when
455 * used as interrupts.
456 */
457 if (!strcmp(chip->label, "A") ||
458 !strcmp(chip->label, "B") ||
459 !strcmp(chip->label, "F"))
460 chip->set_debounce = ep93xx_gpio_set_debounce;
461
462 gpiochip_add(chip);
463 }
439} 464}
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h
index c991b149bdf2..c57152c231f1 100644
--- a/arch/arm/mach-ep93xx/include/mach/gpio.h
+++ b/arch/arm/mach-ep93xx/include/mach/gpio.h
@@ -99,8 +99,6 @@
99/* maximum value for irq capable line identifiers */ 99/* maximum value for irq capable line identifiers */
100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) 100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
101 101
102extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable);
103
104/* new generic GPIO API - see Documentation/gpio.txt */ 102/* new generic GPIO API - see Documentation/gpio.txt */
105 103
106#include <asm-generic/gpio.h> 104#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c
index bc5e83fb5819..a921fe92b858 100644
--- a/arch/arm/mach-footbridge/dc21285-timer.c
+++ b/arch/arm/mach-footbridge/dc21285-timer.c
@@ -4,10 +4,11 @@
4 * Copyright (C) 1998 Russell King. 4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell 5 * Copyright (C) 1998 Phil Blundell
6 */ 6 */
7#include <linux/clockchips.h>
8#include <linux/clocksource.h>
7#include <linux/init.h> 9#include <linux/init.h>
8#include <linux/interrupt.h> 10#include <linux/interrupt.h>
9#include <linux/irq.h> 11#include <linux/irq.h>
10#include <linux/spinlock.h>
11 12
12#include <asm/irq.h> 13#include <asm/irq.h>
13 14
@@ -16,32 +17,76 @@
16 17
17#include "common.h" 18#include "common.h"
18 19
19/* 20static cycle_t cksrc_dc21285_read(struct clocksource *cs)
20 * Footbridge timer 1 support. 21{
21 */ 22 return cs->mask - *CSR_TIMER2_VALUE;
22static unsigned long timer1_latch; 23}
23 24
24static unsigned long timer1_gettimeoffset (void) 25static int cksrc_dc21285_enable(struct clocksource *cs)
25{ 26{
26 unsigned long value = timer1_latch - *CSR_TIMER1_VALUE; 27 *CSR_TIMER2_LOAD = cs->mask;
28 *CSR_TIMER2_CLR = 0;
29 *CSR_TIMER2_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16;
30 return 0;
31}
27 32
28 return ((tick_nsec / 1000) * value) / timer1_latch; 33static int cksrc_dc21285_disable(struct clocksource *cs)
34{
35 *CSR_TIMER2_CNTL = 0;
29} 36}
30 37
31static irqreturn_t 38static struct clocksource cksrc_dc21285 = {
32timer1_interrupt(int irq, void *dev_id) 39 .name = "dc21285_timer2",
40 .rating = 200,
41 .read = cksrc_dc21285_read,
42 .enable = cksrc_dc21285_enable,
43 .disable = cksrc_dc21285_disable,
44 .mask = CLOCKSOURCE_MASK(24),
45 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
46};
47
48static void ckevt_dc21285_set_mode(enum clock_event_mode mode,
49 struct clock_event_device *c)
33{ 50{
51 switch (mode) {
52 case CLOCK_EVT_MODE_RESUME:
53 case CLOCK_EVT_MODE_PERIODIC:
54 *CSR_TIMER1_CLR = 0;
55 *CSR_TIMER1_LOAD = (mem_fclk_21285 + 8 * HZ) / (16 * HZ);
56 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD |
57 TIMER_CNTL_DIV16;
58 break;
59
60 default:
61 *CSR_TIMER1_CNTL = 0;
62 break;
63 }
64}
65
66static struct clock_event_device ckevt_dc21285 = {
67 .name = "dc21285_timer1",
68 .features = CLOCK_EVT_FEAT_PERIODIC,
69 .rating = 200,
70 .irq = IRQ_TIMER1,
71 .set_mode = ckevt_dc21285_set_mode,
72};
73
74static irqreturn_t timer1_interrupt(int irq, void *dev_id)
75{
76 struct clock_event_device *ce = dev_id;
77
34 *CSR_TIMER1_CLR = 0; 78 *CSR_TIMER1_CLR = 0;
35 79
36 timer_tick(); 80 ce->event_handler(ce);
37 81
38 return IRQ_HANDLED; 82 return IRQ_HANDLED;
39} 83}
40 84
41static struct irqaction footbridge_timer_irq = { 85static struct irqaction footbridge_timer_irq = {
42 .name = "Timer1 timer tick", 86 .name = "dc21285_timer1",
43 .handler = timer1_interrupt, 87 .handler = timer1_interrupt,
44 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 88 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
89 .dev_id = &ckevt_dc21285,
45}; 90};
46 91
47/* 92/*
@@ -49,16 +94,19 @@ static struct irqaction footbridge_timer_irq = {
49 */ 94 */
50static void __init footbridge_timer_init(void) 95static void __init footbridge_timer_init(void)
51{ 96{
52 timer1_latch = (mem_fclk_21285 + 8 * HZ) / (16 * HZ); 97 struct clock_event_device *ce = &ckevt_dc21285;
98
99 clocksource_register_hz(&cksrc_dc21285, (mem_fclk_21285 + 8) / 16);
100
101 setup_irq(ce->irq, &footbridge_timer_irq);
53 102
54 *CSR_TIMER1_CLR = 0; 103 clockevents_calc_mult_shift(ce, mem_fclk_21285, 5);
55 *CSR_TIMER1_LOAD = timer1_latch; 104 ce->max_delta_ns = clockevent_delta2ns(0xffffff, ce);
56 *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | TIMER_CNTL_DIV16; 105 ce->min_delta_ns = clockevent_delta2ns(0x000004, ce);
57 106
58 setup_irq(IRQ_TIMER1, &footbridge_timer_irq); 107 clockevents_register_device(ce);
59} 108}
60 109
61struct sys_timer footbridge_timer = { 110struct sys_timer footbridge_timer = {
62 .init = footbridge_timer_init, 111 .init = footbridge_timer_init,
63 .offset = timer1_gettimeoffset,
64}; 112};
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
index 51dd902043ad..b6fdf23ecf6c 100644
--- a/arch/arm/mach-footbridge/include/mach/hardware.h
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -23,26 +23,33 @@
23 * 0xf9000000 0x50000000 1MB Cache flush 23 * 0xf9000000 0x50000000 1MB Cache flush
24 * 0xf0000000 0x80000000 16MB ISA memory 24 * 0xf0000000 0x80000000 16MB ISA memory
25 */ 25 */
26
27#ifdef CONFIG_MMU
28#define MMU_IO(a, b) (a)
29#else
30#define MMU_IO(a, b) (b)
31#endif
32
26#define XBUS_SIZE 0x00100000 33#define XBUS_SIZE 0x00100000
27#define XBUS_BASE 0xff800000 34#define XBUS_BASE MMU_IO(0xff800000, 0x40000000)
28 35
29#define ARMCSR_SIZE 0x00100000 36#define ARMCSR_SIZE 0x00100000
30#define ARMCSR_BASE 0xfe000000 37#define ARMCSR_BASE MMU_IO(0xfe000000, 0x42000000)
31 38
32#define WFLUSH_SIZE 0x00100000 39#define WFLUSH_SIZE 0x00100000
33#define WFLUSH_BASE 0xfd000000 40#define WFLUSH_BASE MMU_IO(0xfd000000, 0x78000000)
34 41
35#define PCIIACK_SIZE 0x00100000 42#define PCIIACK_SIZE 0x00100000
36#define PCIIACK_BASE 0xfc000000 43#define PCIIACK_BASE MMU_IO(0xfc000000, 0x79000000)
37 44
38#define PCICFG1_SIZE 0x01000000 45#define PCICFG1_SIZE 0x01000000
39#define PCICFG1_BASE 0xfb000000 46#define PCICFG1_BASE MMU_IO(0xfb000000, 0x7a000000)
40 47
41#define PCICFG0_SIZE 0x01000000 48#define PCICFG0_SIZE 0x01000000
42#define PCICFG0_BASE 0xfa000000 49#define PCICFG0_BASE MMU_IO(0xfa000000, 0x7b000000)
43 50
44#define PCIMEM_SIZE 0x01000000 51#define PCIMEM_SIZE 0x01000000
45#define PCIMEM_BASE 0xf0000000 52#define PCIMEM_BASE MMU_IO(0xf0000000, 0x80000000)
46 53
47#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000)) 54#define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000))
48#define XBUS_LED_AMBER (1 << 0) 55#define XBUS_LED_AMBER (1 << 0)
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index 101a4fe90bde..32e4cc397c28 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -14,8 +14,14 @@
14#ifndef __ASM_ARM_ARCH_IO_H 14#ifndef __ASM_ARM_ARCH_IO_H
15#define __ASM_ARM_ARCH_IO_H 15#define __ASM_ARM_ARCH_IO_H
16 16
17#define PCIO_SIZE 0x00100000 17#ifdef CONFIG_MMU
18#define PCIO_BASE 0xff000000 18#define MMU_IO(a, b) (a)
19#else
20#define MMU_IO(a, b) (b)
21#endif
22
23#define PCIO_SIZE 0x00100000
24#define PCIO_BASE MMU_IO(0xff000000, 0x7c000000)
19 25
20#define IO_SPACE_LIMIT 0xffff 26#define IO_SPACE_LIMIT 0xffff
21 27
diff --git a/arch/arm/mach-footbridge/isa-timer.c b/arch/arm/mach-footbridge/isa-timer.c
index f488fa2082d7..441c6ce0d555 100644
--- a/arch/arm/mach-footbridge/isa-timer.c
+++ b/arch/arm/mach-footbridge/isa-timer.c
@@ -4,10 +4,13 @@
4 * Copyright (C) 1998 Russell King. 4 * Copyright (C) 1998 Russell King.
5 * Copyright (C) 1998 Phil Blundell 5 * Copyright (C) 1998 Phil Blundell
6 */ 6 */
7#include <linux/clockchips.h>
8#include <linux/clocksource.h>
7#include <linux/init.h> 9#include <linux/init.h>
8#include <linux/interrupt.h> 10#include <linux/interrupt.h>
9#include <linux/irq.h> 11#include <linux/irq.h>
10#include <linux/io.h> 12#include <linux/io.h>
13#include <linux/timex.h>
11 14
12#include <asm/irq.h> 15#include <asm/irq.h>
13 16
@@ -15,77 +18,115 @@
15 18
16#include "common.h" 19#include "common.h"
17 20
18/* 21#define PIT_MODE 0x43
19 * ISA timer tick support 22#define PIT_CH0 0x40
20 */ 23
21#define mSEC_10_from_14 ((14318180 + 100) / 200) 24#define PIT_LATCH ((PIT_TICK_RATE + HZ / 2) / HZ)
22 25
23static unsigned long isa_gettimeoffset(void) 26static cycle_t pit_read(struct clocksource *cs)
24{ 27{
28 unsigned long flags;
29 static int old_count;
30 static u32 old_jifs;
25 int count; 31 int count;
32 u32 jifs;
26 33
27 static int count_p = (mSEC_10_from_14/6); /* for the first call after boot */ 34 raw_local_irq_save(flags);
28 static unsigned long jiffies_p = 0;
29 35
30 /* 36 jifs = jiffies;
31 * cache volatile jiffies temporarily; we have IRQs turned off. 37 outb_p(0x00, PIT_MODE); /* latch the count */
32 */ 38 count = inb_p(PIT_CH0); /* read the latched count */
33 unsigned long jiffies_t; 39 count |= inb_p(PIT_CH0) << 8;
34 40
35 /* timer count may underflow right here */ 41 if (count > old_count && jifs == old_jifs)
36 outb_p(0x00, 0x43); /* latch the count ASAP */ 42 count = old_count;
37 43
38 count = inb_p(0x40); /* read the latched count */ 44 old_count = count;
45 old_jifs = jifs;
39 46
40 /* 47 raw_local_irq_restore(flags);
41 * We do this guaranteed double memory access instead of a _p
42 * postfix in the previous port access. Wheee, hackady hack
43 */
44 jiffies_t = jiffies;
45 48
46 count |= inb_p(0x40) << 8; 49 count = (PIT_LATCH - 1) - count;
47 50
48 /* Detect timer underflows. If we haven't had a timer tick since 51 return (cycle_t)(jifs * PIT_LATCH) + count;
49 the last time we were called, and time is apparently going 52}
50 backwards, the counter must have wrapped during this routine. */
51 if ((jiffies_t == jiffies_p) && (count > count_p))
52 count -= (mSEC_10_from_14/6);
53 else
54 jiffies_p = jiffies_t;
55 53
56 count_p = count; 54static struct clocksource pit_cs = {
55 .name = "pit",
56 .rating = 110,
57 .read = pit_read,
58 .mask = CLOCKSOURCE_MASK(32),
59};
57 60
58 count = (((mSEC_10_from_14/6)-1) - count) * (tick_nsec / 1000); 61static void pit_set_mode(enum clock_event_mode mode,
59 count = (count + (mSEC_10_from_14/6)/2) / (mSEC_10_from_14/6); 62 struct clock_event_device *evt)
63{
64 unsigned long flags;
65
66 raw_local_irq_save(flags);
67
68 switch (mode) {
69 case CLOCK_EVT_MODE_PERIODIC:
70 outb_p(0x34, PIT_MODE);
71 outb_p(PIT_LATCH & 0xff, PIT_CH0);
72 outb_p(PIT_LATCH >> 8, PIT_CH0);
73 break;
74
75 case CLOCK_EVT_MODE_SHUTDOWN:
76 case CLOCK_EVT_MODE_UNUSED:
77 outb_p(0x30, PIT_MODE);
78 outb_p(0, PIT_CH0);
79 outb_p(0, PIT_CH0);
80 break;
81
82 case CLOCK_EVT_MODE_ONESHOT:
83 case CLOCK_EVT_MODE_RESUME:
84 break;
85 }
86 local_irq_restore(flags);
87}
60 88
61 return count; 89static int pit_set_next_event(unsigned long delta,
90 struct clock_event_device *evt)
91{
92 return 0;
62} 93}
63 94
64static irqreturn_t 95static struct clock_event_device pit_ce = {
65isa_timer_interrupt(int irq, void *dev_id) 96 .name = "pit",
97 .features = CLOCK_EVT_FEAT_PERIODIC,
98 .set_mode = pit_set_mode,
99 .set_next_event = pit_set_next_event,
100 .shift = 32,
101};
102
103static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
66{ 104{
67 timer_tick(); 105 struct clock_event_device *ce = dev_id;
106 ce->event_handler(ce);
68 return IRQ_HANDLED; 107 return IRQ_HANDLED;
69} 108}
70 109
71static struct irqaction isa_timer_irq = { 110static struct irqaction pit_timer_irq = {
72 .name = "ISA timer tick", 111 .name = "pit",
73 .handler = isa_timer_interrupt, 112 .handler = pit_timer_interrupt,
74 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, 113 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
114 .dev_id = &pit_ce,
75}; 115};
76 116
77static void __init isa_timer_init(void) 117static void __init isa_timer_init(void)
78{ 118{
79 /* enable PIT timer */ 119 pit_ce.cpumask = cpumask_of(smp_processor_id());
80 /* set for periodic (4) and LSB/MSB write (0x30) */ 120 pit_ce.mult = div_sc(PIT_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
81 outb(0x34, 0x43); 121 pit_ce.max_delta_ns = clockevent_delta2ns(0x7fff, &pit_ce);
82 outb((mSEC_10_from_14/6) & 0xFF, 0x40); 122 pit_ce.min_delta_ns = clockevent_delta2ns(0x000f, &pit_ce);
83 outb((mSEC_10_from_14/6) >> 8, 0x40); 123
124 clocksource_register_hz(&pit_cs, PIT_TICK_RATE);
84 125
85 setup_irq(IRQ_ISA_TIMER, &isa_timer_irq); 126 setup_irq(pit_ce.irq, &pit_timer_irq);
127 clockevents_register_device(&pit_ce);
86} 128}
87 129
88struct sys_timer isa_timer = { 130struct sys_timer isa_timer = {
89 .init = isa_timer_init, 131 .init = isa_timer_init,
90 .offset = isa_gettimeoffset,
91}; 132};
diff --git a/arch/arm/mach-gemini/board-nas4220b.c b/arch/arm/mach-gemini/board-nas4220b.c
index 2ba096de0034..0cf7a07c3f3f 100644
--- a/arch/arm/mach-gemini/board-nas4220b.c
+++ b/arch/arm/mach-gemini/board-nas4220b.c
@@ -98,6 +98,7 @@ static void __init ib4220b_init(void)
98 platform_register_pflash(SZ_16M, NULL, 0); 98 platform_register_pflash(SZ_16M, NULL, 0);
99 platform_device_register(&ib4220b_led_device); 99 platform_device_register(&ib4220b_led_device);
100 platform_device_register(&ib4220b_key_device); 100 platform_device_register(&ib4220b_key_device);
101 platform_register_rtc();
101} 102}
102 103
103MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B") 104MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
diff --git a/arch/arm/mach-gemini/board-rut1xx.c b/arch/arm/mach-gemini/board-rut1xx.c
index a9a0d8b01942..4fa09af99495 100644
--- a/arch/arm/mach-gemini/board-rut1xx.c
+++ b/arch/arm/mach-gemini/board-rut1xx.c
@@ -82,6 +82,7 @@ static void __init rut1xx_init(void)
82 platform_register_pflash(SZ_8M, NULL, 0); 82 platform_register_pflash(SZ_8M, NULL, 0);
83 platform_device_register(&rut1xx_leds); 83 platform_device_register(&rut1xx_leds);
84 platform_device_register(&rut1xx_keys_device); 84 platform_device_register(&rut1xx_keys_device);
85 platform_register_rtc();
85} 86}
86 87
87MACHINE_START(RUT100, "Teltonika RUT100") 88MACHINE_START(RUT100, "Teltonika RUT100")
diff --git a/arch/arm/mach-gemini/board-wbd111.c b/arch/arm/mach-gemini/board-wbd111.c
index 8b88d50d4337..af7b68a6b258 100644
--- a/arch/arm/mach-gemini/board-wbd111.c
+++ b/arch/arm/mach-gemini/board-wbd111.c
@@ -130,6 +130,7 @@ static void __init wbd111_init(void)
130 wbd111_num_partitions); 130 wbd111_num_partitions);
131 platform_device_register(&wbd111_leds_device); 131 platform_device_register(&wbd111_leds_device);
132 platform_device_register(&wbd111_keys_device); 132 platform_device_register(&wbd111_keys_device);
133 platform_register_rtc();
133} 134}
134 135
135MACHINE_START(WBD111, "Wiliboard WBD-111") 136MACHINE_START(WBD111, "Wiliboard WBD-111")
diff --git a/arch/arm/mach-gemini/board-wbd222.c b/arch/arm/mach-gemini/board-wbd222.c
index 1eebcecd1c33..99e5bbecf923 100644
--- a/arch/arm/mach-gemini/board-wbd222.c
+++ b/arch/arm/mach-gemini/board-wbd222.c
@@ -130,6 +130,7 @@ static void __init wbd222_init(void)
130 wbd222_num_partitions); 130 wbd222_num_partitions);
131 platform_device_register(&wbd222_leds_device); 131 platform_device_register(&wbd222_leds_device);
132 platform_device_register(&wbd222_keys_device); 132 platform_device_register(&wbd222_keys_device);
133 platform_register_rtc();
133} 134}
134 135
135MACHINE_START(WBD222, "Wiliboard WBD-222") 136MACHINE_START(WBD222, "Wiliboard WBD-222")
diff --git a/arch/arm/mach-gemini/common.h b/arch/arm/mach-gemini/common.h
index 9392834a214f..7670c39acb2f 100644
--- a/arch/arm/mach-gemini/common.h
+++ b/arch/arm/mach-gemini/common.h
@@ -18,6 +18,7 @@ extern void gemini_map_io(void);
18extern void gemini_init_irq(void); 18extern void gemini_init_irq(void);
19extern void gemini_timer_init(void); 19extern void gemini_timer_init(void);
20extern void gemini_gpio_init(void); 20extern void gemini_gpio_init(void);
21extern void platform_register_rtc(void);
21 22
22/* Common platform devices registration functions */ 23/* Common platform devices registration functions */
23extern int platform_register_uart(void); 24extern int platform_register_uart(void);
diff --git a/arch/arm/mach-gemini/devices.c b/arch/arm/mach-gemini/devices.c
index 6b525253d027..5cff29818b73 100644
--- a/arch/arm/mach-gemini/devices.c
+++ b/arch/arm/mach-gemini/devices.c
@@ -90,3 +90,29 @@ int platform_register_pflash(unsigned int size, struct mtd_partition *parts,
90 90
91 return platform_device_register(&pflash_device); 91 return platform_device_register(&pflash_device);
92} 92}
93
94static struct resource gemini_rtc_resources[] = {
95 [0] = {
96 .start = GEMINI_RTC_BASE,
97 .end = GEMINI_RTC_BASE + 0x24,
98 .flags = IORESOURCE_MEM,
99 },
100 [1] = {
101 .start = IRQ_RTC,
102 .end = IRQ_RTC,
103 .flags = IORESOURCE_IRQ,
104 },
105};
106
107static struct platform_device gemini_rtc_device = {
108 .name = "rtc-gemini",
109 .id = 0,
110 .num_resources = ARRAY_SIZE(gemini_rtc_resources),
111 .resource = gemini_rtc_resources,
112};
113
114int __init platform_register_rtc(void)
115{
116 return platform_device_register(&gemini_rtc_device);
117}
118
diff --git a/arch/arm/mach-imx/mach-mx25_3ds.c b/arch/arm/mach-imx/mach-mx25_3ds.c
index aa76cfd9f348..8382e7902078 100644
--- a/arch/arm/mach-imx/mach-mx25_3ds.c
+++ b/arch/arm/mach-imx/mach-mx25_3ds.c
@@ -180,7 +180,7 @@ static const uint32_t mx25pdk_keymap[] = {
180 KEY(3, 3, KEY_POWER), 180 KEY(3, 3, KEY_POWER),
181}; 181};
182 182
183static const struct matrix_keymap_data mx25pdk_keymap_data __initdata = { 183static const struct matrix_keymap_data mx25pdk_keymap_data __initconst = {
184 .keymap = mx25pdk_keymap, 184 .keymap = mx25pdk_keymap,
185 .keymap_size = ARRAY_SIZE(mx25pdk_keymap), 185 .keymap_size = ARRAY_SIZE(mx25pdk_keymap),
186}; 186};
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index 4dc68d6bb6be..9fd894271d5d 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -432,7 +432,7 @@ static struct clocksource clocksource_ixp4xx = {
432 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 432 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
433}; 433};
434 434
435unsigned long ixp4xx_timer_freq = FREQ; 435unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ;
436EXPORT_SYMBOL(ixp4xx_timer_freq); 436EXPORT_SYMBOL(ixp4xx_timer_freq);
437static void __init ixp4xx_clocksource_init(void) 437static void __init ixp4xx_clocksource_init(void)
438{ 438{
@@ -496,7 +496,7 @@ static struct clock_event_device clockevent_ixp4xx = {
496 496
497static void __init ixp4xx_clockevent_init(void) 497static void __init ixp4xx_clockevent_init(void)
498{ 498{
499 clockevent_ixp4xx.mult = div_sc(FREQ, NSEC_PER_SEC, 499 clockevent_ixp4xx.mult = div_sc(IXP4XX_TIMER_FREQ, NSEC_PER_SEC,
500 clockevent_ixp4xx.shift); 500 clockevent_ixp4xx.shift);
501 clockevent_ixp4xx.max_delta_ns = 501 clockevent_ixp4xx.max_delta_ns =
502 clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx); 502 clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx);
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h
index 2c3f93c3eb79..c9e930f29339 100644
--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -10,6 +10,7 @@
10 * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the 10 * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
11 * timer register ignores the bottom 2 bits of the LATCH value. 11 * timer register ignores the bottom 2 bits of the LATCH value.
12 */ 12 */
13#define FREQ 66666000 13#define IXP4XX_TIMER_FREQ 66666000
14#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) 14#define CLOCK_TICK_RATE \
15 (((IXP4XX_TIMER_FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
15 16
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
index bfdbe4b5a3cc..852f7c9f87d0 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c
@@ -265,6 +265,11 @@ void qmgr_release_queue(unsigned int queue)
265 qmgr_queue_descs[queue], queue); 265 qmgr_queue_descs[queue], queue);
266 qmgr_queue_descs[queue][0] = '\x0'; 266 qmgr_queue_descs[queue][0] = '\x0';
267#endif 267#endif
268
269 while ((addr = qmgr_get_entry(queue)))
270 printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n",
271 queue, addr);
272
268 __raw_writel(0, &qmgr_regs->sram[queue]); 273 __raw_writel(0, &qmgr_regs->sram[queue]);
269 274
270 used_sram_bitmap[0] &= ~mask[0]; 275 used_sram_bitmap[0] &= ~mask[0];
@@ -275,10 +280,6 @@ void qmgr_release_queue(unsigned int queue)
275 spin_unlock_irq(&qmgr_lock); 280 spin_unlock_irq(&qmgr_lock);
276 281
277 module_put(THIS_MODULE); 282 module_put(THIS_MODULE);
278
279 while ((addr = qmgr_get_entry(queue)))
280 printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n",
281 queue, addr);
282} 283}
283 284
284static int qmgr_init(void) 285static int qmgr_init(void)
diff --git a/arch/arm/mach-mxs/clock-mx23.c b/arch/arm/mach-mxs/clock-mx23.c
index b1a362ebfded..ca72a05ed9c1 100644
--- a/arch/arm/mach-mxs/clock-mx23.c
+++ b/arch/arm/mach-mxs/clock-mx23.c
@@ -304,7 +304,7 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
304 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \ 304 reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \
305 reg &= ~BM_CLKCTRL_##dr##_DIV; \ 305 reg &= ~BM_CLKCTRL_##dr##_DIV; \
306 reg |= div << BP_CLKCTRL_##dr##_DIV; \ 306 reg |= div << BP_CLKCTRL_##dr##_DIV; \
307 if (reg | (1 << clk->enable_shift)) { \ 307 if (reg & (1 << clk->enable_shift)) { \
308 pr_err("%s: clock is gated\n", __func__); \ 308 pr_err("%s: clock is gated\n", __func__); \
309 return -EINVAL; \ 309 return -EINVAL; \
310 } \ 310 } \
@@ -347,7 +347,7 @@ static int name##_set_parent(struct clk *clk, struct clk *parent) \
347{ \ 347{ \
348 if (parent != clk->parent) { \ 348 if (parent != clk->parent) { \
349 __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \ 349 __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \
350 HW_CLKCTRL_CLKSEQ_TOG); \ 350 CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ_TOG); \
351 clk->parent = parent; \ 351 clk->parent = parent; \
352 } \ 352 } \
353 \ 353 \
diff --git a/arch/arm/mach-mxs/clock-mx28.c b/arch/arm/mach-mxs/clock-mx28.c
index 56312c092a9e..fd1c4c54b8e5 100644
--- a/arch/arm/mach-mxs/clock-mx28.c
+++ b/arch/arm/mach-mxs/clock-mx28.c
@@ -355,12 +355,12 @@ static int name##_set_rate(struct clk *clk, unsigned long rate) \
355 } else { \ 355 } else { \
356 reg &= ~BM_CLKCTRL_##dr##_DIV; \ 356 reg &= ~BM_CLKCTRL_##dr##_DIV; \
357 reg |= div << BP_CLKCTRL_##dr##_DIV; \ 357 reg |= div << BP_CLKCTRL_##dr##_DIV; \
358 if (reg | (1 << clk->enable_shift)) { \ 358 if (reg & (1 << clk->enable_shift)) { \
359 pr_err("%s: clock is gated\n", __func__); \ 359 pr_err("%s: clock is gated\n", __func__); \
360 return -EINVAL; \ 360 return -EINVAL; \
361 } \ 361 } \
362 } \ 362 } \
363 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_CPU); \ 363 __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##dr); \
364 \ 364 \
365 for (i = 10000; i; i--) \ 365 for (i = 10000; i; i--) \
366 if (!(__raw_readl(CLKCTRL_BASE_ADDR + \ 366 if (!(__raw_readl(CLKCTRL_BASE_ADDR + \
@@ -483,7 +483,7 @@ static int name##_set_parent(struct clk *clk, struct clk *parent) \
483{ \ 483{ \
484 if (parent != clk->parent) { \ 484 if (parent != clk->parent) { \
485 __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \ 485 __raw_writel(BM_CLKCTRL_CLKSEQ_BYPASS_##bit, \
486 HW_CLKCTRL_CLKSEQ_TOG); \ 486 CLKCTRL_BASE_ADDR + HW_CLKCTRL_CLKSEQ_TOG); \
487 clk->parent = parent; \ 487 clk->parent = parent; \
488 } \ 488 } \
489 \ 489 \
@@ -609,7 +609,6 @@ static struct clk_lookup lookups[] = {
609 _REGISTER_CLOCK("duart", NULL, uart_clk) 609 _REGISTER_CLOCK("duart", NULL, uart_clk)
610 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk) 610 _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
611 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk) 611 _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
612 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
613 _REGISTER_CLOCK("rtc", NULL, rtc_clk) 612 _REGISTER_CLOCK("rtc", NULL, rtc_clk)
614 _REGISTER_CLOCK("pll2", NULL, pll2_clk) 613 _REGISTER_CLOCK("pll2", NULL, pll2_clk)
615 _REGISTER_CLOCK(NULL, "hclk", hbus_clk) 614 _REGISTER_CLOCK(NULL, "hclk", hbus_clk)
diff --git a/arch/arm/mach-mxs/clock.c b/arch/arm/mach-mxs/clock.c
index e7d2269cf70e..a7093c88e6a6 100644
--- a/arch/arm/mach-mxs/clock.c
+++ b/arch/arm/mach-mxs/clock.c
@@ -57,7 +57,6 @@ static void __clk_disable(struct clk *clk)
57 if (clk->disable) 57 if (clk->disable)
58 clk->disable(clk); 58 clk->disable(clk);
59 __clk_disable(clk->parent); 59 __clk_disable(clk->parent);
60 __clk_disable(clk->secondary);
61 } 60 }
62} 61}
63 62
@@ -68,7 +67,6 @@ static int __clk_enable(struct clk *clk)
68 67
69 if (clk->usecount++ == 0) { 68 if (clk->usecount++ == 0) {
70 __clk_enable(clk->parent); 69 __clk_enable(clk->parent);
71 __clk_enable(clk->secondary);
72 70
73 if (clk->enable) 71 if (clk->enable)
74 clk->enable(clk); 72 clk->enable(clk);
diff --git a/arch/arm/mach-mxs/gpio.c b/arch/arm/mach-mxs/gpio.c
index d7ad7a61366d..61991e4dde44 100644
--- a/arch/arm/mach-mxs/gpio.c
+++ b/arch/arm/mach-mxs/gpio.c
@@ -68,29 +68,29 @@ static void set_gpio_irqenable(struct mxs_gpio_port *port, u32 index,
68 } 68 }
69} 69}
70 70
71static void mxs_gpio_ack_irq(u32 irq) 71static void mxs_gpio_ack_irq(struct irq_data *d)
72{ 72{
73 u32 gpio = irq_to_gpio(irq); 73 u32 gpio = irq_to_gpio(d->irq);
74 clear_gpio_irqstatus(&mxs_gpio_ports[gpio / 32], gpio & 0x1f); 74 clear_gpio_irqstatus(&mxs_gpio_ports[gpio / 32], gpio & 0x1f);
75} 75}
76 76
77static void mxs_gpio_mask_irq(u32 irq) 77static void mxs_gpio_mask_irq(struct irq_data *d)
78{ 78{
79 u32 gpio = irq_to_gpio(irq); 79 u32 gpio = irq_to_gpio(d->irq);
80 set_gpio_irqenable(&mxs_gpio_ports[gpio / 32], gpio & 0x1f, 0); 80 set_gpio_irqenable(&mxs_gpio_ports[gpio / 32], gpio & 0x1f, 0);
81} 81}
82 82
83static void mxs_gpio_unmask_irq(u32 irq) 83static void mxs_gpio_unmask_irq(struct irq_data *d)
84{ 84{
85 u32 gpio = irq_to_gpio(irq); 85 u32 gpio = irq_to_gpio(d->irq);
86 set_gpio_irqenable(&mxs_gpio_ports[gpio / 32], gpio & 0x1f, 1); 86 set_gpio_irqenable(&mxs_gpio_ports[gpio / 32], gpio & 0x1f, 1);
87} 87}
88 88
89static int mxs_gpio_get(struct gpio_chip *chip, unsigned offset); 89static int mxs_gpio_get(struct gpio_chip *chip, unsigned offset);
90 90
91static int mxs_gpio_set_irq_type(u32 irq, u32 type) 91static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type)
92{ 92{
93 u32 gpio = irq_to_gpio(irq); 93 u32 gpio = irq_to_gpio(d->irq);
94 u32 pin_mask = 1 << (gpio & 31); 94 u32 pin_mask = 1 << (gpio & 31);
95 struct mxs_gpio_port *port = &mxs_gpio_ports[gpio / 32]; 95 struct mxs_gpio_port *port = &mxs_gpio_ports[gpio / 32];
96 void __iomem *pin_addr; 96 void __iomem *pin_addr;
@@ -139,6 +139,8 @@ static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc)
139 struct mxs_gpio_port *port = (struct mxs_gpio_port *)get_irq_data(irq); 139 struct mxs_gpio_port *port = (struct mxs_gpio_port *)get_irq_data(irq);
140 u32 gpio_irq_no_base = port->virtual_irq_start; 140 u32 gpio_irq_no_base = port->virtual_irq_start;
141 141
142 desc->irq_data.chip->irq_ack(&desc->irq_data);
143
142 irq_stat = __raw_readl(port->base + PINCTRL_IRQSTAT(port->id)) & 144 irq_stat = __raw_readl(port->base + PINCTRL_IRQSTAT(port->id)) &
143 __raw_readl(port->base + PINCTRL_IRQEN(port->id)); 145 __raw_readl(port->base + PINCTRL_IRQEN(port->id));
144 146
@@ -158,9 +160,9 @@ static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc)
158 * @param enable enable as wake-up if equal to non-zero 160 * @param enable enable as wake-up if equal to non-zero
159 * @return This function returns 0 on success. 161 * @return This function returns 0 on success.
160 */ 162 */
161static int mxs_gpio_set_wake_irq(u32 irq, u32 enable) 163static int mxs_gpio_set_wake_irq(struct irq_data *d, unsigned int enable)
162{ 164{
163 u32 gpio = irq_to_gpio(irq); 165 u32 gpio = irq_to_gpio(d->irq);
164 u32 gpio_idx = gpio & 0x1f; 166 u32 gpio_idx = gpio & 0x1f;
165 struct mxs_gpio_port *port = &mxs_gpio_ports[gpio / 32]; 167 struct mxs_gpio_port *port = &mxs_gpio_ports[gpio / 32];
166 168
@@ -180,11 +182,11 @@ static int mxs_gpio_set_wake_irq(u32 irq, u32 enable)
180} 182}
181 183
182static struct irq_chip gpio_irq_chip = { 184static struct irq_chip gpio_irq_chip = {
183 .ack = mxs_gpio_ack_irq, 185 .irq_ack = mxs_gpio_ack_irq,
184 .mask = mxs_gpio_mask_irq, 186 .irq_mask = mxs_gpio_mask_irq,
185 .unmask = mxs_gpio_unmask_irq, 187 .irq_unmask = mxs_gpio_unmask_irq,
186 .set_type = mxs_gpio_set_irq_type, 188 .irq_set_type = mxs_gpio_set_irq_type,
187 .set_wake = mxs_gpio_set_wake_irq, 189 .irq_set_wake = mxs_gpio_set_wake_irq,
188}; 190};
189 191
190static void mxs_set_gpio_direction(struct gpio_chip *chip, unsigned offset, 192static void mxs_set_gpio_direction(struct gpio_chip *chip, unsigned offset,
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c
index 5dd43ba70058..0f4c120fc169 100644
--- a/arch/arm/mach-mxs/icoll.c
+++ b/arch/arm/mach-mxs/icoll.c
@@ -34,7 +34,7 @@
34 34
35static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR); 35static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR);
36 36
37static void icoll_ack_irq(unsigned int irq) 37static void icoll_ack_irq(struct irq_data *d)
38{ 38{
39 /* 39 /*
40 * The Interrupt Collector is able to prioritize irqs. 40 * The Interrupt Collector is able to prioritize irqs.
@@ -45,22 +45,22 @@ static void icoll_ack_irq(unsigned int irq)
45 icoll_base + HW_ICOLL_LEVELACK); 45 icoll_base + HW_ICOLL_LEVELACK);
46} 46}
47 47
48static void icoll_mask_irq(unsigned int irq) 48static void icoll_mask_irq(struct irq_data *d)
49{ 49{
50 __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, 50 __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
51 icoll_base + HW_ICOLL_INTERRUPTn_CLR(irq)); 51 icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->irq));
52} 52}
53 53
54static void icoll_unmask_irq(unsigned int irq) 54static void icoll_unmask_irq(struct irq_data *d)
55{ 55{
56 __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, 56 __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
57 icoll_base + HW_ICOLL_INTERRUPTn_SET(irq)); 57 icoll_base + HW_ICOLL_INTERRUPTn_SET(d->irq));
58} 58}
59 59
60static struct irq_chip mxs_icoll_chip = { 60static struct irq_chip mxs_icoll_chip = {
61 .ack = icoll_ack_irq, 61 .irq_ack = icoll_ack_irq,
62 .mask = icoll_mask_irq, 62 .irq_mask = icoll_mask_irq,
63 .unmask = icoll_unmask_irq, 63 .irq_unmask = icoll_unmask_irq,
64}; 64};
65 65
66void __init icoll_init_irq(void) 66void __init icoll_init_irq(void)
diff --git a/arch/arm/mach-mxs/include/mach/clock.h b/arch/arm/mach-mxs/include/mach/clock.h
index 041e276d8a32..592c9ab5d760 100644
--- a/arch/arm/mach-mxs/include/mach/clock.h
+++ b/arch/arm/mach-mxs/include/mach/clock.h
@@ -29,8 +29,6 @@ struct clk {
29 int id; 29 int id;
30 /* Source clock this clk depends on */ 30 /* Source clock this clk depends on */
31 struct clk *parent; 31 struct clk *parent;
32 /* Secondary clock to enable/disable with this clock */
33 struct clk *secondary;
34 /* Reference count of clock enable/disable */ 32 /* Reference count of clock enable/disable */
35 __s8 usecount; 33 __s8 usecount;
36 /* Register bit position for clock's enable/disable control. */ 34 /* Register bit position for clock's enable/disable control. */
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
index c9088d85da04..453809359ba6 100644
--- a/arch/arm/mach-omap1/lcd_dma.c
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -37,7 +37,7 @@ int omap_lcd_dma_running(void)
37 * On OMAP1510, internal LCD controller will start the transfer 37 * On OMAP1510, internal LCD controller will start the transfer
38 * when it gets enabled, so assume DMA running if LCD enabled. 38 * when it gets enabled, so assume DMA running if LCD enabled.
39 */ 39 */
40 if (cpu_is_omap1510()) 40 if (cpu_is_omap15xx())
41 if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN) 41 if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN)
42 return 1; 42 return 1;
43 43
@@ -95,7 +95,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
95 95
96void omap_set_lcd_dma_b1_rotation(int rotate) 96void omap_set_lcd_dma_b1_rotation(int rotate)
97{ 97{
98 if (cpu_is_omap1510()) { 98 if (cpu_is_omap15xx()) {
99 printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n"); 99 printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
100 BUG(); 100 BUG();
101 return; 101 return;
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
106 106
107void omap_set_lcd_dma_b1_mirror(int mirror) 107void omap_set_lcd_dma_b1_mirror(int mirror)
108{ 108{
109 if (cpu_is_omap1510()) { 109 if (cpu_is_omap15xx()) {
110 printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n"); 110 printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
111 BUG(); 111 BUG();
112 } 112 }
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
116 116
117void omap_set_lcd_dma_b1_vxres(unsigned long vxres) 117void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
118{ 118{
119 if (cpu_is_omap1510()) { 119 if (cpu_is_omap15xx()) {
120 printk(KERN_ERR "DMA virtual resulotion is not supported " 120 printk(KERN_ERR "DMA virtual resulotion is not supported "
121 "in 1510 mode\n"); 121 "in 1510 mode\n");
122 BUG(); 122 BUG();
@@ -127,7 +127,7 @@ EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
127 127
128void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale) 128void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
129{ 129{
130 if (cpu_is_omap1510()) { 130 if (cpu_is_omap15xx()) {
131 printk(KERN_ERR "DMA scale is not supported in 1510 mode\n"); 131 printk(KERN_ERR "DMA scale is not supported in 1510 mode\n");
132 BUG(); 132 BUG();
133 } 133 }
@@ -177,7 +177,7 @@ static void set_b1_regs(void)
177 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1); 177 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
178 /* 1510 DMA requires the bottom address to be 2 more 178 /* 1510 DMA requires the bottom address to be 2 more
179 * than the actual last memory access location. */ 179 * than the actual last memory access location. */
180 if (cpu_is_omap1510() && 180 if (cpu_is_omap15xx() &&
181 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32) 181 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
182 bottom += 2; 182 bottom += 2;
183 ei = PIXSTEP(0, 0, 1, 0); 183 ei = PIXSTEP(0, 0, 1, 0);
@@ -241,7 +241,7 @@ static void set_b1_regs(void)
241 return; /* Suppress warning about uninitialized vars */ 241 return; /* Suppress warning about uninitialized vars */
242 } 242 }
243 243
244 if (cpu_is_omap1510()) { 244 if (cpu_is_omap15xx()) {
245 omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U); 245 omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U);
246 omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L); 246 omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L);
247 omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U); 247 omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U);
@@ -343,7 +343,7 @@ void omap_free_lcd_dma(void)
343 BUG(); 343 BUG();
344 return; 344 return;
345 } 345 }
346 if (!cpu_is_omap1510()) 346 if (!cpu_is_omap15xx())
347 omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1, 347 omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1,
348 OMAP1610_DMA_LCD_CCR); 348 OMAP1610_DMA_LCD_CCR);
349 lcd_dma.reserved = 0; 349 lcd_dma.reserved = 0;
@@ -360,7 +360,7 @@ void omap_enable_lcd_dma(void)
360 * connected. Otherwise the OMAP internal controller will 360 * connected. Otherwise the OMAP internal controller will
361 * start the transfer when it gets enabled. 361 * start the transfer when it gets enabled.
362 */ 362 */
363 if (cpu_is_omap1510() || !lcd_dma.ext_ctrl) 363 if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl)
364 return; 364 return;
365 365
366 w = omap_readw(OMAP1610_DMA_LCD_CTRL); 366 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
@@ -378,14 +378,14 @@ EXPORT_SYMBOL(omap_enable_lcd_dma);
378void omap_setup_lcd_dma(void) 378void omap_setup_lcd_dma(void)
379{ 379{
380 BUG_ON(lcd_dma.active); 380 BUG_ON(lcd_dma.active);
381 if (!cpu_is_omap1510()) { 381 if (!cpu_is_omap15xx()) {
382 /* Set some reasonable defaults */ 382 /* Set some reasonable defaults */
383 omap_writew(0x5440, OMAP1610_DMA_LCD_CCR); 383 omap_writew(0x5440, OMAP1610_DMA_LCD_CCR);
384 omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP); 384 omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP);
385 omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL); 385 omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL);
386 } 386 }
387 set_b1_regs(); 387 set_b1_regs();
388 if (!cpu_is_omap1510()) { 388 if (!cpu_is_omap15xx()) {
389 u16 w; 389 u16 w;
390 390
391 w = omap_readw(OMAP1610_DMA_LCD_CCR); 391 w = omap_readw(OMAP1610_DMA_LCD_CCR);
@@ -407,7 +407,7 @@ void omap_stop_lcd_dma(void)
407 u16 w; 407 u16 w;
408 408
409 lcd_dma.active = 0; 409 lcd_dma.active = 0;
410 if (cpu_is_omap1510() || !lcd_dma.ext_ctrl) 410 if (cpu_is_omap15xx() || !lcd_dma.ext_ctrl)
411 return; 411 return;
412 412
413 w = omap_readw(OMAP1610_DMA_LCD_CCR); 413 w = omap_readw(OMAP1610_DMA_LCD_CCR);
diff --git a/arch/arm/mach-omap1/pm.h b/arch/arm/mach-omap1/pm.h
index 56a647986ae9..cd926dcb5e7f 100644
--- a/arch/arm/mach-omap1/pm.h
+++ b/arch/arm/mach-omap1/pm.h
@@ -123,9 +123,9 @@ extern void allow_idle_sleep(void);
123extern void omap1_pm_idle(void); 123extern void omap1_pm_idle(void);
124extern void omap1_pm_suspend(void); 124extern void omap1_pm_suspend(void);
125 125
126extern void omap7xx_cpu_suspend(unsigned short, unsigned short); 126extern void omap7xx_cpu_suspend(unsigned long, unsigned long);
127extern void omap1510_cpu_suspend(unsigned short, unsigned short); 127extern void omap1510_cpu_suspend(unsigned long, unsigned long);
128extern void omap1610_cpu_suspend(unsigned short, unsigned short); 128extern void omap1610_cpu_suspend(unsigned long, unsigned long);
129extern void omap7xx_idle_loop_suspend(void); 129extern void omap7xx_idle_loop_suspend(void);
130extern void omap1510_idle_loop_suspend(void); 130extern void omap1510_idle_loop_suspend(void);
131extern void omap1610_idle_loop_suspend(void); 131extern void omap1610_idle_loop_suspend(void);
diff --git a/arch/arm/mach-omap1/sleep.S b/arch/arm/mach-omap1/sleep.S
index ef771ce8b030..c875bdc902c5 100644
--- a/arch/arm/mach-omap1/sleep.S
+++ b/arch/arm/mach-omap1/sleep.S
@@ -58,6 +58,7 @@
58 */ 58 */
59 59
60#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850) 60#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
61 .align 3
61ENTRY(omap7xx_cpu_suspend) 62ENTRY(omap7xx_cpu_suspend)
62 63
63 @ save registers on stack 64 @ save registers on stack
@@ -137,6 +138,7 @@ ENTRY(omap7xx_cpu_suspend_sz)
137#endif /* CONFIG_ARCH_OMAP730 || CONFIG_ARCH_OMAP850 */ 138#endif /* CONFIG_ARCH_OMAP730 || CONFIG_ARCH_OMAP850 */
138 139
139#ifdef CONFIG_ARCH_OMAP15XX 140#ifdef CONFIG_ARCH_OMAP15XX
141 .align 3
140ENTRY(omap1510_cpu_suspend) 142ENTRY(omap1510_cpu_suspend)
141 143
142 @ save registers on stack 144 @ save registers on stack
@@ -211,6 +213,7 @@ ENTRY(omap1510_cpu_suspend_sz)
211#endif /* CONFIG_ARCH_OMAP15XX */ 213#endif /* CONFIG_ARCH_OMAP15XX */
212 214
213#if defined(CONFIG_ARCH_OMAP16XX) 215#if defined(CONFIG_ARCH_OMAP16XX)
216 .align 3
214ENTRY(omap1610_cpu_suspend) 217ENTRY(omap1610_cpu_suspend)
215 218
216 @ save registers on stack 219 @ save registers on stack
diff --git a/arch/arm/mach-omap1/sram.S b/arch/arm/mach-omap1/sram.S
index 7724e520d07c..692587d07ea5 100644
--- a/arch/arm/mach-omap1/sram.S
+++ b/arch/arm/mach-omap1/sram.S
@@ -18,6 +18,7 @@
18/* 18/*
19 * Reprograms ULPD and CKCTL. 19 * Reprograms ULPD and CKCTL.
20 */ 20 */
21 .align 3
21ENTRY(omap1_sram_reprogram_clock) 22ENTRY(omap1_sram_reprogram_clock)
22 stmfd sp!, {r0 - r12, lr} @ save registers on stack 23 stmfd sp!, {r0 - r12, lr} @ save registers on stack
23 24
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index f83fc335c613..6885d2fac183 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -44,7 +44,6 @@
44#include <linux/clocksource.h> 44#include <linux/clocksource.h>
45#include <linux/clockchips.h> 45#include <linux/clockchips.h>
46#include <linux/io.h> 46#include <linux/io.h>
47#include <linux/sched.h>
48 47
49#include <asm/system.h> 48#include <asm/system.h>
50#include <mach/hardware.h> 49#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 1a2cf6226a55..b69fa0a0299e 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -45,6 +45,7 @@ config ARCH_OMAP4
45 select CPU_V7 45 select CPU_V7
46 select ARM_GIC 46 select ARM_GIC
47 select PL310_ERRATA_588369 47 select PL310_ERRATA_588369
48 select PL310_ERRATA_727915
48 select ARM_ERRATA_720789 49 select ARM_ERRATA_720789
49 select ARCH_HAS_OPP 50 select ARCH_HAS_OPP
50 select PM_OPP if PM 51 select PM_OPP if PM
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index e906e05bb41b..9a2a31e011ce 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -115,9 +115,6 @@ static struct omap2_hsmmc_info mmc[] = {
115 115
116static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) 116static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev)
117{ 117{
118 twl_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80, REG_GPIODATADIR1);
119 twl_i2c_write_u8(TWL4030_MODULE_LED, 0x0, 0x0);
120
121 if (gpio_is_valid(dssdev->reset_gpio)) 118 if (gpio_is_valid(dssdev->reset_gpio))
122 gpio_set_value_cansleep(dssdev->reset_gpio, 1); 119 gpio_set_value_cansleep(dssdev->reset_gpio, 1);
123 return 0; 120 return 0;
@@ -247,6 +244,8 @@ static struct gpio_led gpio_leds[];
247static int devkit8000_twl_gpio_setup(struct device *dev, 244static int devkit8000_twl_gpio_setup(struct device *dev,
248 unsigned gpio, unsigned ngpio) 245 unsigned gpio, unsigned ngpio)
249{ 246{
247 int ret;
248
250 omap_mux_init_gpio(29, OMAP_PIN_INPUT); 249 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
251 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 250 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
252 mmc[0].gpio_cd = gpio + 0; 251 mmc[0].gpio_cd = gpio + 0;
@@ -255,17 +254,23 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
255 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 254 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
256 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 255 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
257 256
258 /* gpio + 1 is "LCD_PWREN" (out, active high) */ 257 /* TWL4030_GPIO_MAX + 0 is "LCD_PWREN" (out, active high) */
259 devkit8000_lcd_device.reset_gpio = gpio + 1; 258 devkit8000_lcd_device.reset_gpio = gpio + TWL4030_GPIO_MAX + 0;
260 gpio_request(devkit8000_lcd_device.reset_gpio, "LCD_PWREN"); 259 ret = gpio_request_one(devkit8000_lcd_device.reset_gpio,
261 /* Disable until needed */ 260 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "LCD_PWREN");
262 gpio_direction_output(devkit8000_lcd_device.reset_gpio, 0); 261 if (ret < 0) {
262 devkit8000_lcd_device.reset_gpio = -EINVAL;
263 printk(KERN_ERR "Failed to request GPIO for LCD_PWRN\n");
264 }
263 265
264 /* gpio + 7 is "DVI_PD" (out, active low) */ 266 /* gpio + 7 is "DVI_PD" (out, active low) */
265 devkit8000_dvi_device.reset_gpio = gpio + 7; 267 devkit8000_dvi_device.reset_gpio = gpio + 7;
266 gpio_request(devkit8000_dvi_device.reset_gpio, "DVI PowerDown"); 268 ret = gpio_request_one(devkit8000_dvi_device.reset_gpio,
267 /* Disable until needed */ 269 GPIOF_DIR_OUT | GPIOF_INIT_LOW, "DVI PowerDown");
268 gpio_direction_output(devkit8000_dvi_device.reset_gpio, 0); 270 if (ret < 0) {
271 devkit8000_dvi_device.reset_gpio = -EINVAL;
272 printk(KERN_ERR "Failed to request GPIO for DVI PowerDown\n");
273 }
269 274
270 return 0; 275 return 0;
271} 276}
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index e001a048dc0c..e944025d5ef8 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -409,8 +409,6 @@ static void __init omap4_panda_init(void)
409 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices)); 409 platform_add_devices(panda_devices, ARRAY_SIZE(panda_devices));
410 omap_serial_init(); 410 omap_serial_init();
411 omap4_twl6030_hsmmc_init(mmc); 411 omap4_twl6030_hsmmc_init(mmc);
412 /* OMAP4 Panda uses internal transceiver so register nop transceiver */
413 usb_nop_xceiv_register();
414 omap4_ehci_init(); 412 omap4_ehci_init();
415 usb_musb_init(&musb_board_data); 413 usb_musb_init(&musb_board_data);
416} 414}
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index cb77be7ac44f..39a71bb8a308 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -40,9 +40,6 @@ static struct regulator_consumer_supply rm680_vemmc_consumers[] = {
40static struct regulator_init_data rm680_vemmc = { 40static struct regulator_init_data rm680_vemmc = {
41 .constraints = { 41 .constraints = {
42 .name = "rm680_vemmc", 42 .name = "rm680_vemmc",
43 .min_uV = 2900000,
44 .max_uV = 2900000,
45 .apply_uV = 1,
46 .valid_modes_mask = REGULATOR_MODE_NORMAL 43 .valid_modes_mask = REGULATOR_MODE_NORMAL
47 | REGULATOR_MODE_STANDBY, 44 | REGULATOR_MODE_STANDBY,
48 .valid_ops_mask = REGULATOR_CHANGE_STATUS 45 .valid_ops_mask = REGULATOR_CHANGE_STATUS
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 337392c3f549..acb7ae5b0a25 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -77,7 +77,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
77 dd = clk->dpll_data; 77 dd = clk->dpll_data;
78 78
79 /* DPLL divider must result in a valid jitter correction val */ 79 /* DPLL divider must result in a valid jitter correction val */
80 fint = clk->parent->rate / (n + 1); 80 fint = clk->parent->rate / n;
81 if (fint < DPLL_FINT_BAND1_MIN) { 81 if (fint < DPLL_FINT_BAND1_MIN) {
82 82
83 pr_debug("rejecting n=%d due to Fint failure, " 83 pr_debug("rejecting n=%d due to Fint failure, "
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 394413dc7deb..24b88504df0f 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -193,10 +193,12 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox,
193 omap_mbox_type_t irq) 193 omap_mbox_type_t irq)
194{ 194{
195 struct omap_mbox2_priv *p = mbox->priv; 195 struct omap_mbox2_priv *p = mbox->priv;
196 u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; 196 u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit;
197 l = mbox_read_reg(p->irqdisable); 197
198 l &= ~bit; 198 if (!cpu_is_omap44xx())
199 mbox_write_reg(l, p->irqdisable); 199 bit = mbox_read_reg(p->irqdisable) & ~bit;
200
201 mbox_write_reg(bit, p->irqdisable);
200} 202}
201 203
202static void omap2_mbox_ack_irq(struct omap_mbox *mbox, 204static void omap2_mbox_ack_irq(struct omap_mbox *mbox,
@@ -334,7 +336,7 @@ static struct omap_mbox mbox_iva_info = {
334 .priv = &omap2_mbox_iva_priv, 336 .priv = &omap2_mbox_iva_priv,
335}; 337};
336 338
337struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL }; 339struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL };
338#endif 340#endif
339 341
340#if defined(CONFIG_ARCH_OMAP4) 342#if defined(CONFIG_ARCH_OMAP4)
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index fae49d12bc76..6c84659cf846 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -605,7 +605,7 @@ static void __init omap_mux_dbg_create_entry(
605 list_for_each_entry(e, &partition->muxmodes, node) { 605 list_for_each_entry(e, &partition->muxmodes, node) {
606 struct omap_mux *m = &e->mux; 606 struct omap_mux *m = &e->mux;
607 607
608 (void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir, 608 (void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir,
609 m, &omap_mux_dbg_signal_fops); 609 m, &omap_mux_dbg_signal_fops);
610 } 610 }
611} 611}
@@ -1000,6 +1000,7 @@ int __init omap_mux_init(const char *name, u32 flags,
1000 if (!partition->base) { 1000 if (!partition->base) {
1001 pr_err("%s: Could not ioremap mux partition at 0x%08x\n", 1001 pr_err("%s: Could not ioremap mux partition at 0x%08x\n",
1002 __func__, partition->phys); 1002 __func__, partition->phys);
1003 kfree(partition);
1003 return -ENODEV; 1004 return -ENODEV;
1004 } 1005 }
1005 1006
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 19268647ce36..9ef8c29dd817 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -52,6 +52,12 @@ static void omap4_l2x0_disable(void)
52 omap_smc1(0x102, 0x0); 52 omap_smc1(0x102, 0x0);
53} 53}
54 54
55static void omap4_l2x0_set_debug(unsigned long val)
56{
57 /* Program PL310 L2 Cache controller debug register */
58 omap_smc1(0x100, val);
59}
60
55static int __init omap_l2_cache_init(void) 61static int __init omap_l2_cache_init(void)
56{ 62{
57 u32 aux_ctrl = 0; 63 u32 aux_ctrl = 0;
@@ -99,6 +105,7 @@ static int __init omap_l2_cache_init(void)
99 * specific one 105 * specific one
100 */ 106 */
101 outer_cache.disable = omap4_l2x0_disable; 107 outer_cache.disable = omap4_l2x0_disable;
108 outer_cache.set_debug = omap4_l2x0_set_debug;
102 109
103 return 0; 110 return 0;
104} 111}
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 125f56591fb5..a5a83b358ddd 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -637,14 +637,14 @@ static int __init pm_dbg_init(void)
637 637
638 } 638 }
639 639
640 (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d, 640 (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d,
641 &enable_off_mode, &pm_dbg_option_fops); 641 &enable_off_mode, &pm_dbg_option_fops);
642 (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d, 642 (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUSR, d,
643 &sleep_while_idle, &pm_dbg_option_fops); 643 &sleep_while_idle, &pm_dbg_option_fops);
644 (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, 644 (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUSR, d,
645 &wakeup_timer_seconds, &pm_dbg_option_fops); 645 &wakeup_timer_seconds, &pm_dbg_option_fops);
646 (void) debugfs_create_file("wakeup_timer_milliseconds", 646 (void) debugfs_create_file("wakeup_timer_milliseconds",
647 S_IRUGO | S_IWUGO, d, &wakeup_timer_milliseconds, 647 S_IRUGO | S_IWUSR, d, &wakeup_timer_milliseconds,
648 &pm_dbg_option_fops); 648 &pm_dbg_option_fops);
649 pm_dbg_init_done = 1; 649 pm_dbg_init_done = 1;
650 650
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 1c1b0ab5b978..39580e6060e8 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -92,7 +92,7 @@ extern void omap24xx_idle_loop_suspend(void);
92extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl, 92extern void omap24xx_cpu_suspend(u32 dll_ctrl, void __iomem *sdrc_dlla_ctrl,
93 void __iomem *sdrc_power); 93 void __iomem *sdrc_power);
94extern void omap34xx_cpu_suspend(u32 *addr, int save_state); 94extern void omap34xx_cpu_suspend(u32 *addr, int save_state);
95extern void save_secure_ram_context(u32 *addr); 95extern int save_secure_ram_context(u32 *addr);
96extern void omap3_save_scratchpad_contents(void); 96extern void omap3_save_scratchpad_contents(void);
97 97
98extern unsigned int omap24xx_idle_loop_suspend_sz; 98extern unsigned int omap24xx_idle_loop_suspend_sz;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index a4aa1920a75c..2f864e4b085d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -168,9 +168,10 @@ static void omap3_core_restore_context(void)
168 * once during boot sequence, but this works as we are not using secure 168 * once during boot sequence, but this works as we are not using secure
169 * services. 169 * services.
170 */ 170 */
171static void omap3_save_secure_ram_context(u32 target_mpu_state) 171static void omap3_save_secure_ram_context(void)
172{ 172{
173 u32 ret; 173 u32 ret;
174 int mpu_next_state = pwrdm_read_next_pwrst(mpu_pwrdm);
174 175
175 if (omap_type() != OMAP2_DEVICE_TYPE_GP) { 176 if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
176 /* 177 /*
@@ -181,7 +182,7 @@ static void omap3_save_secure_ram_context(u32 target_mpu_state)
181 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON); 182 pwrdm_set_next_pwrst(mpu_pwrdm, PWRDM_POWER_ON);
182 ret = _omap_save_secure_sram((u32 *) 183 ret = _omap_save_secure_sram((u32 *)
183 __pa(omap3_secure_ram_storage)); 184 __pa(omap3_secure_ram_storage));
184 pwrdm_set_next_pwrst(mpu_pwrdm, target_mpu_state); 185 pwrdm_set_next_pwrst(mpu_pwrdm, mpu_next_state);
185 /* Following is for error tracking, it should not happen */ 186 /* Following is for error tracking, it should not happen */
186 if (ret) { 187 if (ret) {
187 printk(KERN_ERR "save_secure_sram() returns %08x\n", 188 printk(KERN_ERR "save_secure_sram() returns %08x\n",
@@ -1094,7 +1095,7 @@ static int __init omap3_pm_init(void)
1094 local_fiq_disable(); 1095 local_fiq_disable();
1095 1096
1096 omap_dma_global_context_save(); 1097 omap_dma_global_context_save();
1097 omap3_save_secure_ram_context(PWRDM_POWER_ON); 1098 omap3_save_secure_ram_context();
1098 omap_dma_global_context_restore(); 1099 omap_dma_global_context_restore();
1099 1100
1100 local_irq_enable(); 1101 local_irq_enable();
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 729a644ce852..3300ff6e3cfe 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -38,8 +38,8 @@
38#define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 38#define OMAP4430_PRCM_MPU_CPU1_INST 0x0800
39 39
40/* PRCM_MPU clockdomain register offsets (from instance start) */ 40/* PRCM_MPU clockdomain register offsets (from instance start) */
41#define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0000 41#define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0018
42#define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0000 42#define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0018
43 43
44 44
45/* 45/*
diff --git a/arch/arm/mach-omap2/sleep24xx.S b/arch/arm/mach-omap2/sleep24xx.S
index c7780cc8d919..b5071a47ec39 100644
--- a/arch/arm/mach-omap2/sleep24xx.S
+++ b/arch/arm/mach-omap2/sleep24xx.S
@@ -47,6 +47,7 @@
47 * Note: This code get's copied to internal SRAM at boot. When the OMAP 47 * Note: This code get's copied to internal SRAM at boot. When the OMAP
48 * wakes up it continues execution at the point it went to sleep. 48 * wakes up it continues execution at the point it went to sleep.
49 */ 49 */
50 .align 3
50ENTRY(omap24xx_idle_loop_suspend) 51ENTRY(omap24xx_idle_loop_suspend)
51 stmfd sp!, {r0, lr} @ save registers on stack 52 stmfd sp!, {r0, lr} @ save registers on stack
52 mov r0, #0 @ clear for mcr setup 53 mov r0, #0 @ clear for mcr setup
@@ -82,6 +83,7 @@ ENTRY(omap24xx_idle_loop_suspend_sz)
82 * The DLL load value is not kept in RETENTION or OFF. It needs to be restored 83 * The DLL load value is not kept in RETENTION or OFF. It needs to be restored
83 * at wake 84 * at wake
84 */ 85 */
86 .align 3
85ENTRY(omap24xx_cpu_suspend) 87ENTRY(omap24xx_cpu_suspend)
86 stmfd sp!, {r0 - r12, lr} @ save registers on stack 88 stmfd sp!, {r0 - r12, lr} @ save registers on stack
87 mov r3, #0x0 @ clear for mcr call 89 mov r3, #0x0 @ clear for mcr call
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 98d8232808b8..951a0be66cf7 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -118,6 +118,7 @@ ENTRY(enable_omap3630_toggle_l2_on_restore)
118 118
119 .text 119 .text
120/* Function to call rom code to save secure ram context */ 120/* Function to call rom code to save secure ram context */
121 .align 3
121ENTRY(save_secure_ram_context) 122ENTRY(save_secure_ram_context)
122 stmfd sp!, {r1-r12, lr} @ save registers on stack 123 stmfd sp!, {r1-r12, lr} @ save registers on stack
123 adr r3, api_params @ r3 points to parameters 124 adr r3, api_params @ r3 points to parameters
@@ -169,6 +170,7 @@ ENTRY(save_secure_ram_context_sz)
169 * depending on the low power mode (non-OFF vs OFF modes), 170 * depending on the low power mode (non-OFF vs OFF modes),
170 * cf. 'Resume path for xxx mode' comments. 171 * cf. 'Resume path for xxx mode' comments.
171 */ 172 */
173 .align 3
172ENTRY(omap34xx_cpu_suspend) 174ENTRY(omap34xx_cpu_suspend)
173 stmfd sp!, {r0-r12, lr} @ save registers on stack 175 stmfd sp!, {r0-r12, lr} @ save registers on stack
174 176
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 77ecebf3fae2..1a777e34d0c2 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -282,6 +282,7 @@ error:
282 dev_err(&sr_info->pdev->dev, "%s: ERROR in registering" 282 dev_err(&sr_info->pdev->dev, "%s: ERROR in registering"
283 "interrupt handler. Smartreflex will" 283 "interrupt handler. Smartreflex will"
284 "not function as desired\n", __func__); 284 "not function as desired\n", __func__);
285 kfree(name);
285 kfree(sr_info); 286 kfree(sr_info);
286 return ret; 287 return ret;
287} 288}
@@ -780,8 +781,7 @@ static int omap_sr_autocomp_show(void *data, u64 *val)
780 struct omap_sr *sr_info = (struct omap_sr *) data; 781 struct omap_sr *sr_info = (struct omap_sr *) data;
781 782
782 if (!sr_info) { 783 if (!sr_info) {
783 pr_warning("%s: omap_sr struct for sr_%s not found\n", 784 pr_warning("%s: omap_sr struct not found\n", __func__);
784 __func__, sr_info->voltdm->name);
785 return -EINVAL; 785 return -EINVAL;
786 } 786 }
787 787
@@ -795,8 +795,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
795 struct omap_sr *sr_info = (struct omap_sr *) data; 795 struct omap_sr *sr_info = (struct omap_sr *) data;
796 796
797 if (!sr_info) { 797 if (!sr_info) {
798 pr_warning("%s: omap_sr struct for sr_%s not found\n", 798 pr_warning("%s: omap_sr struct not found\n", __func__);
799 __func__, sr_info->voltdm->name);
800 return -EINVAL; 799 return -EINVAL;
801 } 800 }
802 801
@@ -834,7 +833,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
834 833
835 if (!pdata) { 834 if (!pdata) {
836 dev_err(&pdev->dev, "%s: platform data missing\n", __func__); 835 dev_err(&pdev->dev, "%s: platform data missing\n", __func__);
837 return -EINVAL; 836 ret = -EINVAL;
837 goto err_free_devinfo;
838 } 838 }
839 839
840 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 840 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -880,7 +880,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
880 ret = sr_late_init(sr_info); 880 ret = sr_late_init(sr_info);
881 if (ret) { 881 if (ret) {
882 pr_warning("%s: Error in SR late init\n", __func__); 882 pr_warning("%s: Error in SR late init\n", __func__);
883 return ret; 883 goto err_release_region;
884 } 884 }
885 } 885 }
886 886
@@ -891,17 +891,20 @@ static int __init omap_sr_probe(struct platform_device *pdev)
891 * not try to create rest of the debugfs entries. 891 * not try to create rest of the debugfs entries.
892 */ 892 */
893 vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); 893 vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
894 if (!vdd_dbg_dir) 894 if (!vdd_dbg_dir) {
895 return -EINVAL; 895 ret = -EINVAL;
896 goto err_release_region;
897 }
896 898
897 dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); 899 dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
898 if (IS_ERR(dbg_dir)) { 900 if (IS_ERR(dbg_dir)) {
899 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", 901 dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
900 __func__); 902 __func__);
901 return PTR_ERR(dbg_dir); 903 ret = PTR_ERR(dbg_dir);
904 goto err_release_region;
902 } 905 }
903 906
904 (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir, 907 (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, dbg_dir,
905 (void *)sr_info, &pm_sr_fops); 908 (void *)sr_info, &pm_sr_fops);
906 (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, 909 (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir,
907 &sr_info->err_weight); 910 &sr_info->err_weight);
@@ -914,7 +917,8 @@ static int __init omap_sr_probe(struct platform_device *pdev)
914 if (IS_ERR(nvalue_dir)) { 917 if (IS_ERR(nvalue_dir)) {
915 dev_err(&pdev->dev, "%s: Unable to create debugfs directory" 918 dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
916 "for n-values\n", __func__); 919 "for n-values\n", __func__);
917 return PTR_ERR(nvalue_dir); 920 ret = PTR_ERR(nvalue_dir);
921 goto err_release_region;
918 } 922 }
919 923
920 omap_voltage_get_volttable(sr_info->voltdm, &volt_data); 924 omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
@@ -923,24 +927,16 @@ static int __init omap_sr_probe(struct platform_device *pdev)
923 " corresponding vdd vdd_%s. Cannot create debugfs" 927 " corresponding vdd vdd_%s. Cannot create debugfs"
924 "entries for n-values\n", 928 "entries for n-values\n",
925 __func__, sr_info->voltdm->name); 929 __func__, sr_info->voltdm->name);
926 return -ENODATA; 930 ret = -ENODATA;
931 goto err_release_region;
927 } 932 }
928 933
929 for (i = 0; i < sr_info->nvalue_count; i++) { 934 for (i = 0; i < sr_info->nvalue_count; i++) {
930 char *name; 935 char name[NVALUE_NAME_LEN + 1];
931 char volt_name[32];
932
933 name = kzalloc(NVALUE_NAME_LEN + 1, GFP_KERNEL);
934 if (!name) {
935 dev_err(&pdev->dev, "%s: Unable to allocate memory"
936 " for n-value directory name\n", __func__);
937 return -ENOMEM;
938 }
939 936
940 strcpy(name, "volt_"); 937 snprintf(name, sizeof(name), "volt_%d",
941 sprintf(volt_name, "%d", volt_data[i].volt_nominal); 938 volt_data[i].volt_nominal);
942 strcat(name, volt_name); 939 (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
943 (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir,
944 &(sr_info->nvalue_table[i].nvalue)); 940 &(sr_info->nvalue_table[i].nvalue));
945 } 941 }
946 942
@@ -966,7 +962,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
966 } 962 }
967 963
968 sr_info = _sr_lookup(pdata->voltdm); 964 sr_info = _sr_lookup(pdata->voltdm);
969 if (!sr_info) { 965 if (IS_ERR(sr_info)) {
970 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n", 966 dev_warn(&pdev->dev, "%s: omap_sr struct not found\n",
971 __func__); 967 __func__);
972 return -EINVAL; 968 return -EINVAL;
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 055310cc77de..ff9b9dbcb30e 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -39,6 +39,7 @@
39 39
40 .text 40 .text
41 41
42 .align 3
42ENTRY(omap242x_sram_ddr_init) 43ENTRY(omap242x_sram_ddr_init)
43 stmfd sp!, {r0 - r12, lr} @ save registers on stack 44 stmfd sp!, {r0 - r12, lr} @ save registers on stack
44 45
@@ -143,6 +144,7 @@ ENTRY(omap242x_sram_ddr_init_sz)
143 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR] 144 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR]
144 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0 145 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0
145 */ 146 */
147 .align 3
146ENTRY(omap242x_sram_reprogram_sdrc) 148ENTRY(omap242x_sram_reprogram_sdrc)
147 stmfd sp!, {r0 - r10, lr} @ save registers on stack 149 stmfd sp!, {r0 - r10, lr} @ save registers on stack
148 mov r3, #0x0 @ clear for mrc call 150 mov r3, #0x0 @ clear for mrc call
@@ -238,6 +240,7 @@ ENTRY(omap242x_sram_reprogram_sdrc_sz)
238/* 240/*
239 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode. 241 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode.
240 */ 242 */
243 .align 3
241ENTRY(omap242x_sram_set_prcm) 244ENTRY(omap242x_sram_set_prcm)
242 stmfd sp!, {r0-r12, lr} @ regs to stack 245 stmfd sp!, {r0-r12, lr} @ regs to stack
243 adr r4, pbegin @ addr of preload start 246 adr r4, pbegin @ addr of preload start
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index f9007580aea3..76730209fa0e 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -39,6 +39,7 @@
39 39
40 .text 40 .text
41 41
42 .align 3
42ENTRY(omap243x_sram_ddr_init) 43ENTRY(omap243x_sram_ddr_init)
43 stmfd sp!, {r0 - r12, lr} @ save registers on stack 44 stmfd sp!, {r0 - r12, lr} @ save registers on stack
44 45
@@ -143,6 +144,7 @@ ENTRY(omap243x_sram_ddr_init_sz)
143 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR] 144 * r0 = [PRCM_FULL | PRCM_HALF] r1 = SDRC_DLLA_CTRL value r2 = [DDR | SDR]
144 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0 145 * PRCM_FULL = 2, PRCM_HALF = 1, DDR = 1, SDR = 0
145 */ 146 */
147 .align 3
146ENTRY(omap243x_sram_reprogram_sdrc) 148ENTRY(omap243x_sram_reprogram_sdrc)
147 stmfd sp!, {r0 - r10, lr} @ save registers on stack 149 stmfd sp!, {r0 - r10, lr} @ save registers on stack
148 mov r3, #0x0 @ clear for mrc call 150 mov r3, #0x0 @ clear for mrc call
@@ -238,6 +240,7 @@ ENTRY(omap243x_sram_reprogram_sdrc_sz)
238/* 240/*
239 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode. 241 * Set dividers and pll. Also recalculate DLL value for DDR and unlock mode.
240 */ 242 */
243 .align 3
241ENTRY(omap243x_sram_set_prcm) 244ENTRY(omap243x_sram_set_prcm)
242 stmfd sp!, {r0-r12, lr} @ regs to stack 245 stmfd sp!, {r0-r12, lr} @ regs to stack
243 adr r4, pbegin @ addr of preload start 246 adr r4, pbegin @ addr of preload start
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 7f893a29d500..25011ca2145d 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -111,6 +111,7 @@
111 * since it will cause the ARM MMU to attempt to walk the page tables. 111 * since it will cause the ARM MMU to attempt to walk the page tables.
112 * These crashes may be intermittent. 112 * These crashes may be intermittent.
113 */ 113 */
114 .align 3
114ENTRY(omap3_sram_configure_core_dpll) 115ENTRY(omap3_sram_configure_core_dpll)
115 stmfd sp!, {r1-r12, lr} @ store regs to stack 116 stmfd sp!, {r1-r12, lr} @ store regs to stack
116 117
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 7b7c2683ae7b..0fc550e7e482 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -39,6 +39,7 @@
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <plat/dmtimer.h> 40#include <plat/dmtimer.h>
41#include <asm/localtimer.h> 41#include <asm/localtimer.h>
42#include <asm/sched_clock.h>
42 43
43#include "timer-gp.h" 44#include "timer-gp.h"
44 45
@@ -190,6 +191,7 @@ static void __init omap2_gp_clocksource_init(void)
190/* 191/*
191 * clocksource 192 * clocksource
192 */ 193 */
194static DEFINE_CLOCK_DATA(cd);
193static struct omap_dm_timer *gpt_clocksource; 195static struct omap_dm_timer *gpt_clocksource;
194static cycle_t clocksource_read_cycles(struct clocksource *cs) 196static cycle_t clocksource_read_cycles(struct clocksource *cs)
195{ 197{
@@ -204,6 +206,15 @@ static struct clocksource clocksource_gpt = {
204 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 206 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
205}; 207};
206 208
209static void notrace dmtimer_update_sched_clock(void)
210{
211 u32 cyc;
212
213 cyc = omap_dm_timer_read_counter(gpt_clocksource);
214
215 update_sched_clock(&cd, cyc, (u32)~0);
216}
217
207/* Setup free-running counter for clocksource */ 218/* Setup free-running counter for clocksource */
208static void __init omap2_gp_clocksource_init(void) 219static void __init omap2_gp_clocksource_init(void)
209{ 220{
@@ -224,6 +235,8 @@ static void __init omap2_gp_clocksource_init(void)
224 235
225 omap_dm_timer_set_load_start(gpt, 1, 0); 236 omap_dm_timer_set_load_start(gpt, 1, 0);
226 237
238 init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
239
227 if (clocksource_register_hz(&clocksource_gpt, tick_rate)) 240 if (clocksource_register_hz(&clocksource_gpt, tick_rate))
228 printk(err2, clocksource_gpt.name); 241 printk(err2, clocksource_gpt.name);
229} 242}
diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
index ed6079c94c57..12be525b8df4 100644
--- a/arch/arm/mach-omap2/voltage.c
+++ b/arch/arm/mach-omap2/voltage.c
@@ -471,6 +471,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
471 strcat(name, vdd->voltdm.name); 471 strcat(name, vdd->voltdm.name);
472 472
473 vdd->debug_dir = debugfs_create_dir(name, voltage_dir); 473 vdd->debug_dir = debugfs_create_dir(name, voltage_dir);
474 kfree(name);
474 if (IS_ERR(vdd->debug_dir)) { 475 if (IS_ERR(vdd->debug_dir)) {
475 pr_warning("%s: Unable to create debugfs directory for" 476 pr_warning("%s: Unable to create debugfs directory for"
476 " vdd_%s\n", __func__, vdd->voltdm.name); 477 " vdd_%s\n", __func__, vdd->voltdm.name);
diff --git a/arch/arm/mach-pxa/colibri-evalboard.c b/arch/arm/mach-pxa/colibri-evalboard.c
index 6b2c800a1133..28f667e52ef9 100644
--- a/arch/arm/mach-pxa/colibri-evalboard.c
+++ b/arch/arm/mach-pxa/colibri-evalboard.c
@@ -50,7 +50,7 @@ static void __init colibri_mmc_init(void)
50 GPIO0_COLIBRI_PXA270_SD_DETECT; 50 GPIO0_COLIBRI_PXA270_SD_DETECT;
51 if (machine_is_colibri300()) /* PXA300 Colibri */ 51 if (machine_is_colibri300()) /* PXA300 Colibri */
52 colibri_mci_platform_data.gpio_card_detect = 52 colibri_mci_platform_data.gpio_card_detect =
53 GPIO39_COLIBRI_PXA300_SD_DETECT; 53 GPIO13_COLIBRI_PXA300_SD_DETECT;
54 else /* PXA320 Colibri */ 54 else /* PXA320 Colibri */
55 colibri_mci_platform_data.gpio_card_detect = 55 colibri_mci_platform_data.gpio_card_detect =
56 GPIO28_COLIBRI_PXA320_SD_DETECT; 56 GPIO28_COLIBRI_PXA320_SD_DETECT;
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
index fddb16d07eb0..66dd81cbc8a0 100644
--- a/arch/arm/mach-pxa/colibri-pxa300.c
+++ b/arch/arm/mach-pxa/colibri-pxa300.c
@@ -41,7 +41,7 @@ static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
41 GPIO4_MMC1_DAT1, 41 GPIO4_MMC1_DAT1,
42 GPIO5_MMC1_DAT2, 42 GPIO5_MMC1_DAT2,
43 GPIO6_MMC1_DAT3, 43 GPIO6_MMC1_DAT3,
44 GPIO39_GPIO, /* SD detect */ 44 GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
45 45
46 /* UHC */ 46 /* UHC */
47 GPIO0_2_USBH_PEN, 47 GPIO0_2_USBH_PEN,
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h
index 388a96f1ef93..cb4236e98a0f 100644
--- a/arch/arm/mach-pxa/include/mach/colibri.h
+++ b/arch/arm/mach-pxa/include/mach/colibri.h
@@ -60,7 +60,7 @@ static inline void colibri_pxa3xx_init_nand(void) {}
60#define GPIO113_COLIBRI_PXA270_TS_IRQ 113 60#define GPIO113_COLIBRI_PXA270_TS_IRQ 113
61 61
62/* GPIO definitions for Colibri PXA300/310 */ 62/* GPIO definitions for Colibri PXA300/310 */
63#define GPIO39_COLIBRI_PXA300_SD_DETECT 39 63#define GPIO13_COLIBRI_PXA300_SD_DETECT 13
64 64
65/* GPIO definitions for Colibri PXA320 */ 65/* GPIO definitions for Colibri PXA320 */
66#define GPIO28_COLIBRI_PXA320_SD_DETECT 28 66#define GPIO28_COLIBRI_PXA320_SD_DETECT 28
diff --git a/arch/arm/mach-pxa/include/mach/pm.h b/arch/arm/mach-pxa/include/mach/pm.h
index fd8360c6839d..f15afe012995 100644
--- a/arch/arm/mach-pxa/include/mach/pm.h
+++ b/arch/arm/mach-pxa/include/mach/pm.h
@@ -22,9 +22,8 @@ struct pxa_cpu_pm_fns {
22extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns; 22extern struct pxa_cpu_pm_fns *pxa_cpu_pm_fns;
23 23
24/* sleep.S */ 24/* sleep.S */
25extern void pxa25x_cpu_suspend(unsigned int); 25extern void pxa25x_cpu_suspend(unsigned int, long);
26extern void pxa27x_cpu_suspend(unsigned int); 26extern void pxa27x_cpu_suspend(unsigned int, long);
27extern void pxa_cpu_resume(void);
28 27
29extern int pxa_pm_enter(suspend_state_t state); 28extern int pxa_pm_enter(suspend_state_t state);
30extern int pxa_pm_prepare(void); 29extern int pxa_pm_prepare(void);
diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c
index 405b92a29793..35572c427fa8 100644
--- a/arch/arm/mach-pxa/palm27x.c
+++ b/arch/arm/mach-pxa/palm27x.c
@@ -323,7 +323,7 @@ static struct platform_pwm_backlight_data palm27x_backlight_data = {
323 .pwm_id = 0, 323 .pwm_id = 0,
324 .max_brightness = 0xfe, 324 .max_brightness = 0xfe,
325 .dft_brightness = 0x7e, 325 .dft_brightness = 0x7e,
326 .pwm_period_ns = 3500, 326 .pwm_period_ns = 3500 * 1024,
327 .init = palm27x_backlight_init, 327 .init = palm27x_backlight_init,
328 .notify = palm27x_backlight_notify, 328 .notify = palm27x_backlight_notify,
329 .exit = palm27x_backlight_exit, 329 .exit = palm27x_backlight_exit,
diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c
index 7bf4017326e3..3010193b081e 100644
--- a/arch/arm/mach-pxa/palmz72.c
+++ b/arch/arm/mach-pxa/palmz72.c
@@ -212,7 +212,7 @@ static unsigned long store_ptr;
212static int palmz72_pm_suspend(struct sys_device *dev, pm_message_t msg) 212static int palmz72_pm_suspend(struct sys_device *dev, pm_message_t msg)
213{ 213{
214 /* setup the resume_info struct for the original bootloader */ 214 /* setup the resume_info struct for the original bootloader */
215 palmz72_resume_info.resume_addr = (u32) pxa_cpu_resume; 215 palmz72_resume_info.resume_addr = (u32) cpu_resume;
216 216
217 /* Storing memory touched by ROM */ 217 /* Storing memory touched by ROM */
218 store_ptr = *PALMZ72_SAVE_DWORD; 218 store_ptr = *PALMZ72_SAVE_DWORD;
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index 978e1b289544..51e1583265b2 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -33,7 +33,7 @@ int pxa_pm_enter(suspend_state_t state)
33#endif 33#endif
34 34
35 /* skip registers saving for standby */ 35 /* skip registers saving for standby */
36 if (state != PM_SUSPEND_STANDBY) { 36 if (state != PM_SUSPEND_STANDBY && pxa_cpu_pm_fns->save) {
37 pxa_cpu_pm_fns->save(sleep_save); 37 pxa_cpu_pm_fns->save(sleep_save);
38 /* before sleeping, calculate and save a checksum */ 38 /* before sleeping, calculate and save a checksum */
39 for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) 39 for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++)
@@ -44,7 +44,7 @@ int pxa_pm_enter(suspend_state_t state)
44 pxa_cpu_pm_fns->enter(state); 44 pxa_cpu_pm_fns->enter(state);
45 cpu_init(); 45 cpu_init();
46 46
47 if (state != PM_SUSPEND_STANDBY) { 47 if (state != PM_SUSPEND_STANDBY && pxa_cpu_pm_fns->restore) {
48 /* after sleeping, validate the checksum */ 48 /* after sleeping, validate the checksum */
49 for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++) 49 for (i = 0; i < pxa_cpu_pm_fns->save_count - 1; i++)
50 checksum += sleep_save[i]; 50 checksum += sleep_save[i];
@@ -67,11 +67,6 @@ int pxa_pm_enter(suspend_state_t state)
67 67
68EXPORT_SYMBOL_GPL(pxa_pm_enter); 68EXPORT_SYMBOL_GPL(pxa_pm_enter);
69 69
70unsigned long sleep_phys_sp(void *sp)
71{
72 return virt_to_phys(sp);
73}
74
75static int pxa_pm_valid(suspend_state_t state) 70static int pxa_pm_valid(suspend_state_t state)
76{ 71{
77 if (pxa_cpu_pm_fns) 72 if (pxa_cpu_pm_fns)
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index fbc5b775f895..6bde5956358d 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -244,7 +244,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
244 244
245 switch (state) { 245 switch (state) {
246 case PM_SUSPEND_MEM: 246 case PM_SUSPEND_MEM:
247 pxa25x_cpu_suspend(PWRMODE_SLEEP); 247 pxa25x_cpu_suspend(PWRMODE_SLEEP, PLAT_PHYS_OFFSET - PAGE_OFFSET);
248 break; 248 break;
249 } 249 }
250} 250}
@@ -252,7 +252,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
252static int pxa25x_cpu_pm_prepare(void) 252static int pxa25x_cpu_pm_prepare(void)
253{ 253{
254 /* set resume return address */ 254 /* set resume return address */
255 PSPR = virt_to_phys(pxa_cpu_resume); 255 PSPR = virt_to_phys(cpu_resume);
256 return 0; 256 return 0;
257} 257}
258 258
@@ -347,6 +347,7 @@ static struct platform_device *pxa25x_devices[] __initdata = {
347 &pxa25x_device_assp, 347 &pxa25x_device_assp,
348 &pxa25x_device_pwm0, 348 &pxa25x_device_pwm0,
349 &pxa25x_device_pwm1, 349 &pxa25x_device_pwm1,
350 &pxa_device_asoc_platform,
350}; 351};
351 352
352static struct sys_device pxa25x_sysdev[] = { 353static struct sys_device pxa25x_sysdev[] = {
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 987301ff4c33..28b11be00b3f 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -300,7 +300,7 @@ void pxa27x_cpu_pm_enter(suspend_state_t state)
300 pxa_cpu_standby(); 300 pxa_cpu_standby();
301 break; 301 break;
302 case PM_SUSPEND_MEM: 302 case PM_SUSPEND_MEM:
303 pxa27x_cpu_suspend(pwrmode); 303 pxa27x_cpu_suspend(pwrmode, PLAT_PHYS_OFFSET - PAGE_OFFSET);
304 break; 304 break;
305 } 305 }
306} 306}
@@ -313,7 +313,7 @@ static int pxa27x_cpu_pm_valid(suspend_state_t state)
313static int pxa27x_cpu_pm_prepare(void) 313static int pxa27x_cpu_pm_prepare(void)
314{ 314{
315 /* set resume return address */ 315 /* set resume return address */
316 PSPR = virt_to_phys(pxa_cpu_resume); 316 PSPR = virt_to_phys(cpu_resume);
317 return 0; 317 return 0;
318} 318}
319 319
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index a7a19e1cd640..1230343d9c70 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -142,8 +142,7 @@ static void pxa3xx_cpu_pm_suspend(void)
142 volatile unsigned long *p = (volatile void *)0xc0000000; 142 volatile unsigned long *p = (volatile void *)0xc0000000;
143 unsigned long saved_data = *p; 143 unsigned long saved_data = *p;
144 144
145 extern void pxa3xx_cpu_suspend(void); 145 extern void pxa3xx_cpu_suspend(long);
146 extern void pxa3xx_cpu_resume(void);
147 146
148 /* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */ 147 /* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */
149 CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM); 148 CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM);
@@ -161,9 +160,9 @@ static void pxa3xx_cpu_pm_suspend(void)
161 PSPR = 0x5c014000; 160 PSPR = 0x5c014000;
162 161
163 /* overwrite with the resume address */ 162 /* overwrite with the resume address */
164 *p = virt_to_phys(pxa3xx_cpu_resume); 163 *p = virt_to_phys(cpu_resume);
165 164
166 pxa3xx_cpu_suspend(); 165 pxa3xx_cpu_suspend(PLAT_PHYS_OFFSET - PAGE_OFFSET);
167 166
168 *p = saved_data; 167 *p = saved_data;
169 168
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index c551da86baf6..6f5368899d84 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -22,133 +22,26 @@
22 22
23 .text 23 .text
24 24
25pxa_cpu_save_cp:
26 @ get coprocessor registers
27 mrc p14, 0, r3, c6, c0, 0 @ clock configuration, for turbo mode
28 mrc p15, 0, r4, c15, c1, 0 @ CP access reg
29 mrc p15, 0, r5, c13, c0, 0 @ PID
30 mrc p15, 0, r6, c3, c0, 0 @ domain ID
31 mrc p15, 0, r7, c2, c0, 0 @ translation table base addr
32 mrc p15, 0, r8, c1, c1, 0 @ auxiliary control reg
33 mrc p15, 0, r9, c1, c0, 0 @ control reg
34
35 bic r3, r3, #2 @ clear frequency change bit
36
37 @ store them plus current virtual stack ptr on stack
38 mov r10, sp
39 stmfd sp!, {r3 - r10}
40
41 mov pc, lr
42
43pxa_cpu_save_sp:
44 @ preserve phys address of stack
45 mov r0, sp
46 str lr, [sp, #-4]!
47 bl sleep_phys_sp
48 ldr r1, =sleep_save_sp
49 str r0, [r1]
50 ldr pc, [sp], #4
51
52#ifdef CONFIG_PXA3xx 25#ifdef CONFIG_PXA3xx
53/* 26/*
54 * pxa3xx_cpu_suspend() - forces CPU into sleep state (S2D3C4) 27 * pxa3xx_cpu_suspend() - forces CPU into sleep state (S2D3C4)
55 * 28 *
56 * NOTE: unfortunately, pxa_cpu_save_cp can not be reused here since 29 * r0 = v:p offset
57 * the auxiliary control register address is different between pxa3xx
58 * and pxa{25x,27x}
59 */ 30 */
60
61ENTRY(pxa3xx_cpu_suspend) 31ENTRY(pxa3xx_cpu_suspend)
62 32
63#ifndef CONFIG_IWMMXT 33#ifndef CONFIG_IWMMXT
64 mra r2, r3, acc0 34 mra r2, r3, acc0
65#endif 35#endif
66 stmfd sp!, {r2 - r12, lr} @ save registers on stack 36 stmfd sp!, {r2 - r12, lr} @ save registers on stack
67 37 mov r1, r0
68 mrc p14, 0, r3, c6, c0, 0 @ clock configuration, for turbo mode 38 ldr r3, =pxa_cpu_resume @ resume function
69 mrc p15, 0, r4, c15, c1, 0 @ CP access reg 39 bl cpu_suspend
70 mrc p15, 0, r5, c13, c0, 0 @ PID
71 mrc p15, 0, r6, c3, c0, 0 @ domain ID
72 mrc p15, 0, r7, c2, c0, 0 @ translation table base addr
73 mrc p15, 0, r8, c1, c0, 1 @ auxiliary control reg
74 mrc p15, 0, r9, c1, c0, 0 @ control reg
75
76 bic r3, r3, #2 @ clear frequency change bit
77
78 @ store them plus current virtual stack ptr on stack
79 mov r10, sp
80 stmfd sp!, {r3 - r10}
81
82 @ store physical address of stack pointer
83 mov r0, sp
84 bl sleep_phys_sp
85 ldr r1, =sleep_save_sp
86 str r0, [r1]
87
88 @ clean data cache
89 bl xsc3_flush_kern_cache_all
90 40
91 mov r0, #0x06 @ S2D3C4 mode 41 mov r0, #0x06 @ S2D3C4 mode
92 mcr p14, 0, r0, c7, c0, 0 @ enter sleep 42 mcr p14, 0, r0, c7, c0, 0 @ enter sleep
93 43
9420: b 20b @ waiting for sleep 4420: b 20b @ waiting for sleep
95
96 .data
97 .align 5
98/*
99 * pxa3xx_cpu_resume
100 */
101
102ENTRY(pxa3xx_cpu_resume)
103
104 mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE @ set SVC, irqs off
105 msr cpsr_c, r0
106
107 ldr r0, sleep_save_sp @ stack phys addr
108 ldmfd r0, {r3 - r9, sp} @ CP regs + virt stack ptr
109
110 mov r1, #0
111 mcr p15, 0, r1, c7, c7, 0 @ invalidate I & D caches, BTB
112 mcr p15, 0, r1, c7, c10, 4 @ drain write (&fill) buffer
113 mcr p15, 0, r1, c7, c5, 4 @ flush prefetch buffer
114 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
115
116 mcr p14, 0, r3, c6, c0, 0 @ clock configuration, turbo mode.
117 mcr p15, 0, r4, c15, c1, 0 @ CP access reg
118 mcr p15, 0, r5, c13, c0, 0 @ PID
119 mcr p15, 0, r6, c3, c0, 0 @ domain ID
120 mcr p15, 0, r7, c2, c0, 0 @ translation table base addr
121 mcr p15, 0, r8, c1, c0, 1 @ auxiliary control reg
122
123 @ temporarily map resume_turn_on_mmu into the page table,
124 @ otherwise prefetch abort occurs after MMU is turned on
125 mov r1, r7
126 bic r1, r1, #0x00ff
127 bic r1, r1, #0x3f00
128 ldr r2, =0x542e
129
130 adr r3, resume_turn_on_mmu
131 mov r3, r3, lsr #20
132 orr r4, r2, r3, lsl #20
133 ldr r5, [r1, r3, lsl #2]
134 str r4, [r1, r3, lsl #2]
135
136 @ Mapping page table address in the page table
137 mov r6, r1, lsr #20
138 orr r7, r2, r6, lsl #20
139 ldr r8, [r1, r6, lsl #2]
140 str r7, [r1, r6, lsl #2]
141
142 ldr r2, =pxa3xx_resume_after_mmu @ absolute virtual address
143 b resume_turn_on_mmu @ cache align execution
144
145 .text
146pxa3xx_resume_after_mmu:
147 /* restore the temporary mapping */
148 str r5, [r1, r3, lsl #2]
149 str r8, [r1, r6, lsl #2]
150 b resume_after_mmu
151
152#endif /* CONFIG_PXA3xx */ 45#endif /* CONFIG_PXA3xx */
153 46
154#ifdef CONFIG_PXA27x 47#ifdef CONFIG_PXA27x
@@ -158,28 +51,23 @@ pxa3xx_resume_after_mmu:
158 * Forces CPU into sleep state. 51 * Forces CPU into sleep state.
159 * 52 *
160 * r0 = value for PWRMODE M field for desired sleep state 53 * r0 = value for PWRMODE M field for desired sleep state
54 * r1 = v:p offset
161 */ 55 */
162
163ENTRY(pxa27x_cpu_suspend) 56ENTRY(pxa27x_cpu_suspend)
164 57
165#ifndef CONFIG_IWMMXT 58#ifndef CONFIG_IWMMXT
166 mra r2, r3, acc0 59 mra r2, r3, acc0
167#endif 60#endif
168 stmfd sp!, {r2 - r12, lr} @ save registers on stack 61 stmfd sp!, {r2 - r12, lr} @ save registers on stack
169 62 mov r4, r0 @ save sleep mode
170 bl pxa_cpu_save_cp 63 ldr r3, =pxa_cpu_resume @ resume function
171 64 bl cpu_suspend
172 mov r5, r0 @ save sleep mode
173 bl pxa_cpu_save_sp
174
175 @ clean data cache
176 bl xscale_flush_kern_cache_all
177 65
178 @ Put the processor to sleep 66 @ Put the processor to sleep
179 @ (also workaround for sighting 28071) 67 @ (also workaround for sighting 28071)
180 68
181 @ prepare value for sleep mode 69 @ prepare value for sleep mode
182 mov r1, r5 @ sleep mode 70 mov r1, r4 @ sleep mode
183 71
184 @ prepare pointer to physical address 0 (virtual mapping in generic.c) 72 @ prepare pointer to physical address 0 (virtual mapping in generic.c)
185 mov r2, #UNCACHED_PHYS_0 73 mov r2, #UNCACHED_PHYS_0
@@ -216,21 +104,16 @@ ENTRY(pxa27x_cpu_suspend)
216 * Forces CPU into sleep state. 104 * Forces CPU into sleep state.
217 * 105 *
218 * r0 = value for PWRMODE M field for desired sleep state 106 * r0 = value for PWRMODE M field for desired sleep state
107 * r1 = v:p offset
219 */ 108 */
220 109
221ENTRY(pxa25x_cpu_suspend) 110ENTRY(pxa25x_cpu_suspend)
222 stmfd sp!, {r2 - r12, lr} @ save registers on stack 111 stmfd sp!, {r2 - r12, lr} @ save registers on stack
223 112 mov r4, r0 @ save sleep mode
224 bl pxa_cpu_save_cp 113 ldr r3, =pxa_cpu_resume @ resume function
225 114 bl cpu_suspend
226 mov r5, r0 @ save sleep mode
227 bl pxa_cpu_save_sp
228
229 @ clean data cache
230 bl xscale_flush_kern_cache_all
231
232 @ prepare value for sleep mode 115 @ prepare value for sleep mode
233 mov r1, r5 @ sleep mode 116 mov r1, r4 @ sleep mode
234 117
235 @ prepare pointer to physical address 0 (virtual mapping in generic.c) 118 @ prepare pointer to physical address 0 (virtual mapping in generic.c)
236 mov r2, #UNCACHED_PHYS_0 119 mov r2, #UNCACHED_PHYS_0
@@ -317,53 +200,9 @@ pxa_cpu_do_suspend:
317 * pxa_cpu_resume() 200 * pxa_cpu_resume()
318 * 201 *
319 * entry point from bootloader into kernel during resume 202 * entry point from bootloader into kernel during resume
320 *
321 * Note: Yes, part of the following code is located into the .data section.
322 * This is to allow sleep_save_sp to be accessed with a relative load
323 * while we can't rely on any MMU translation. We could have put
324 * sleep_save_sp in the .text section as well, but some setups might
325 * insist on it to be truly read-only.
326 */ 203 */
327
328 .data
329 .align 5
330ENTRY(pxa_cpu_resume)
331 mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE @ set SVC, irqs off
332 msr cpsr_c, r0
333
334 ldr r0, sleep_save_sp @ stack phys addr
335 ldr r2, =resume_after_mmu @ its absolute virtual address
336 ldmfd r0, {r3 - r9, sp} @ CP regs + virt stack ptr
337
338 mov r1, #0
339 mcr p15, 0, r1, c8, c7, 0 @ invalidate I & D TLBs
340 mcr p15, 0, r1, c7, c7, 0 @ invalidate I & D caches, BTB
341
342 mcr p14, 0, r3, c6, c0, 0 @ clock configuration, turbo mode.
343 mcr p15, 0, r4, c15, c1, 0 @ CP access reg
344 mcr p15, 0, r5, c13, c0, 0 @ PID
345 mcr p15, 0, r6, c3, c0, 0 @ domain ID
346 mcr p15, 0, r7, c2, c0, 0 @ translation table base addr
347 mcr p15, 0, r8, c1, c1, 0 @ auxiliary control reg
348 b resume_turn_on_mmu @ cache align execution
349
350 .align 5 204 .align 5
351resume_turn_on_mmu: 205pxa_cpu_resume:
352 mcr p15, 0, r9, c1, c0, 0 @ turn on MMU, caches, etc.
353
354 @ Let us ensure we jump to resume_after_mmu only when the mcr above
355 @ actually took effect. They call it the "cpwait" operation.
356 mrc p15, 0, r0, c2, c0, 0 @ queue a dependency on CP15
357 sub pc, r2, r0, lsr #32 @ jump to virtual addr
358 nop
359 nop
360 nop
361
362sleep_save_sp:
363 .word 0 @ preserve stack phys ptr here
364
365 .text
366resume_after_mmu:
367 ldmfd sp!, {r2, r3} 206 ldmfd sp!, {r2, r3}
368#ifndef CONFIG_IWMMXT 207#ifndef CONFIG_IWMMXT
369 mar acc0, r2, r3 208 mar acc0, r2, r3
diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c
index c31e601eb49c..b9b1e5c2b290 100644
--- a/arch/arm/mach-pxa/tosa-bt.c
+++ b/arch/arm/mach-pxa/tosa-bt.c
@@ -81,8 +81,6 @@ static int tosa_bt_probe(struct platform_device *dev)
81 goto err_rfk_alloc; 81 goto err_rfk_alloc;
82 } 82 }
83 83
84 rfkill_set_led_trigger_name(rfk, "tosa-bt");
85
86 rc = rfkill_register(rfk); 84 rc = rfkill_register(rfk);
87 if (rc) 85 if (rc)
88 goto err_rfkill; 86 goto err_rfkill;
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index af152e70cfcf..f2582ec300d9 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -875,6 +875,11 @@ static struct platform_device sharpsl_rom_device = {
875 .dev.platform_data = &sharpsl_rom_data, 875 .dev.platform_data = &sharpsl_rom_data,
876}; 876};
877 877
878static struct platform_device wm9712_device = {
879 .name = "wm9712-codec",
880 .id = -1,
881};
882
878static struct platform_device *devices[] __initdata = { 883static struct platform_device *devices[] __initdata = {
879 &tosascoop_device, 884 &tosascoop_device,
880 &tosascoop_jc_device, 885 &tosascoop_jc_device,
@@ -885,6 +890,7 @@ static struct platform_device *devices[] __initdata = {
885 &tosaled_device, 890 &tosaled_device,
886 &tosa_bt_device, 891 &tosa_bt_device,
887 &sharpsl_rom_device, 892 &sharpsl_rom_device,
893 &wm9712_device,
888}; 894};
889 895
890static void tosa_poweroff(void) 896static void tosa_poweroff(void)
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
index f4b053b35815..b92aa3b8c4f7 100644
--- a/arch/arm/mach-pxa/zeus.c
+++ b/arch/arm/mach-pxa/zeus.c
@@ -676,7 +676,7 @@ static struct pxa2xx_udc_mach_info zeus_udc_info = {
676static void zeus_power_off(void) 676static void zeus_power_off(void)
677{ 677{
678 local_irq_disable(); 678 local_irq_disable();
679 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP); 679 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP, PLAT_PHYS_OFFSET - PAGE_OFFSET);
680} 680}
681#else 681#else
682#define zeus_power_off NULL 682#define zeus_power_off NULL
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index 7ca138a943a9..b9a9805e4828 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -19,7 +19,7 @@ config REALVIEW_EB_A9MP
19config REALVIEW_EB_ARM11MP 19config REALVIEW_EB_ARM11MP
20 bool "Support ARM11MPCore Tile" 20 bool "Support ARM11MPCore Tile"
21 depends on MACH_REALVIEW_EB 21 depends on MACH_REALVIEW_EB
22 select CPU_V6 22 select CPU_V6K
23 select ARCH_HAS_BARRIERS if SMP 23 select ARCH_HAS_BARRIERS if SMP
24 help 24 help
25 Enable support for the ARM11MPCore tile fitted to the Realview(R) 25 Enable support for the ARM11MPCore tile fitted to the Realview(R)
@@ -36,7 +36,7 @@ config REALVIEW_EB_ARM11MP_REVB
36 36
37config MACH_REALVIEW_PB11MP 37config MACH_REALVIEW_PB11MP
38 bool "Support RealView(R) Platform Baseboard for ARM11MPCore" 38 bool "Support RealView(R) Platform Baseboard for ARM11MPCore"
39 select CPU_V6 39 select CPU_V6K
40 select ARM_GIC 40 select ARM_GIC
41 select HAVE_PATA_PLATFORM 41 select HAVE_PATA_PLATFORM
42 select ARCH_HAS_BARRIERS if SMP 42 select ARCH_HAS_BARRIERS if SMP
@@ -45,6 +45,7 @@ config MACH_REALVIEW_PB11MP
45 the ARM11MPCore. This platform has an on-board ARM11MPCore and has 45 the ARM11MPCore. This platform has an on-board ARM11MPCore and has
46 support for PCI-E and Compact Flash. 46 support for PCI-E and Compact Flash.
47 47
48# ARMv6 CPU without K extensions, but does have the new exclusive ops
48config MACH_REALVIEW_PB1176 49config MACH_REALVIEW_PB1176
49 bool "Support RealView(R) Platform Baseboard for ARM1176JZF-S" 50 bool "Support RealView(R) Platform Baseboard for ARM1176JZF-S"
50 select CPU_V6 51 select CPU_V6
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index a0cb2581894f..50825a3f91cc 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -99,6 +99,7 @@ config MACH_NEO1973_GTA02
99 select POWER_SUPPLY 99 select POWER_SUPPLY
100 select MACH_NEO1973 100 select MACH_NEO1973
101 select S3C2410_PWM 101 select S3C2410_PWM
102 select S3C_DEV_USB_HOST
102 help 103 help
103 Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone 104 Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone
104 105
diff --git a/arch/arm/mach-s3c2440/include/mach/gta02.h b/arch/arm/mach-s3c2440/include/mach/gta02.h
index 953331d8d56a..3a56a229cac6 100644
--- a/arch/arm/mach-s3c2440/include/mach/gta02.h
+++ b/arch/arm/mach-s3c2440/include/mach/gta02.h
@@ -44,19 +44,19 @@
44#define GTA02v3_GPIO_nUSB_FLT S3C2410_GPG(10) /* v3 + v4 only */ 44#define GTA02v3_GPIO_nUSB_FLT S3C2410_GPG(10) /* v3 + v4 only */
45#define GTA02v3_GPIO_nGSM_OC S3C2410_GPG(11) /* v3 + v4 only */ 45#define GTA02v3_GPIO_nGSM_OC S3C2410_GPG(11) /* v3 + v4 only */
46 46
47#define GTA02_GPIO_AMP_SHUT S3C2440_GPJ1 /* v2 + v3 + v4 only */ 47#define GTA02_GPIO_AMP_SHUT S3C2410_GPJ(1) /* v2 + v3 + v4 only */
48#define GTA02v1_GPIO_WLAN_GPIO10 S3C2440_GPJ2 48#define GTA02v1_GPIO_WLAN_GPIO10 S3C2410_GPJ(2)
49#define GTA02_GPIO_HP_IN S3C2440_GPJ2 /* v2 + v3 + v4 only */ 49#define GTA02_GPIO_HP_IN S3C2410_GPJ(2) /* v2 + v3 + v4 only */
50#define GTA02_GPIO_INT0 S3C2440_GPJ3 /* v2 + v3 + v4 only */ 50#define GTA02_GPIO_INT0 S3C2410_GPJ(3) /* v2 + v3 + v4 only */
51#define GTA02_GPIO_nGSM_EN S3C2440_GPJ4 51#define GTA02_GPIO_nGSM_EN S3C2410_GPJ(4)
52#define GTA02_GPIO_3D_RESET S3C2440_GPJ5 52#define GTA02_GPIO_3D_RESET S3C2410_GPJ(5)
53#define GTA02_GPIO_nDL_GSM S3C2440_GPJ6 /* v4 + v5 only */ 53#define GTA02_GPIO_nDL_GSM S3C2410_GPJ(6) /* v4 + v5 only */
54#define GTA02_GPIO_WLAN_GPIO0 S3C2440_GPJ7 54#define GTA02_GPIO_WLAN_GPIO0 S3C2410_GPJ(7)
55#define GTA02v1_GPIO_BAT_ID S3C2440_GPJ8 55#define GTA02v1_GPIO_BAT_ID S3C2410_GPJ(8)
56#define GTA02_GPIO_KEEPACT S3C2440_GPJ8 56#define GTA02_GPIO_KEEPACT S3C2410_GPJ(8)
57#define GTA02v1_GPIO_HP_IN S3C2440_GPJ10 57#define GTA02v1_GPIO_HP_IN S3C2410_GPJ(10)
58#define GTA02_CHIP_PWD S3C2440_GPJ11 /* v2 + v3 + v4 only */ 58#define GTA02_CHIP_PWD S3C2410_GPJ(11) /* v2 + v3 + v4 only */
59#define GTA02_GPIO_nWLAN_RESET S3C2440_GPJ12 /* v2 + v3 + v4 only */ 59#define GTA02_GPIO_nWLAN_RESET S3C2410_GPJ(12) /* v2 + v3 + v4 only */
60 60
61#define GTA02_IRQ_GSENSOR_1 IRQ_EINT0 61#define GTA02_IRQ_GSENSOR_1 IRQ_EINT0
62#define GTA02_IRQ_MODEM IRQ_EINT1 62#define GTA02_IRQ_MODEM IRQ_EINT1
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index dd3782064508..fdfc4d5e37a1 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -151,6 +151,12 @@ static struct clk init_clocks_off[] = {
151 .enable = s3c64xx_pclk_ctrl, 151 .enable = s3c64xx_pclk_ctrl,
152 .ctrlbit = S3C_CLKCON_PCLK_IIC, 152 .ctrlbit = S3C_CLKCON_PCLK_IIC,
153 }, { 153 }, {
154 .name = "i2c",
155 .id = 1,
156 .parent = &clk_p,
157 .enable = s3c64xx_pclk_ctrl,
158 .ctrlbit = S3C6410_CLKCON_PCLK_I2C1,
159 }, {
154 .name = "iis", 160 .name = "iis",
155 .id = 0, 161 .id = 0,
156 .parent = &clk_p, 162 .parent = &clk_p,
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index 135db1b41252..c35585cf8c4f 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -690,12 +690,12 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
690 690
691 regptr = regs + PL080_Cx_BASE(0); 691 regptr = regs + PL080_Cx_BASE(0);
692 692
693 for (ch = 0; ch < 8; ch++, chno++, chptr++) { 693 for (ch = 0; ch < 8; ch++, chptr++) {
694 printk(KERN_INFO "%s: registering DMA %d (%p)\n", 694 pr_debug("%s: registering DMA %d (%p)\n",
695 __func__, chno, regptr); 695 __func__, chno + ch, regptr);
696 696
697 chptr->bit = 1 << ch; 697 chptr->bit = 1 << ch;
698 chptr->number = chno; 698 chptr->number = chno + ch;
699 chptr->dmac = dmac; 699 chptr->dmac = dmac;
700 chptr->regs = regptr; 700 chptr->regs = regptr;
701 regptr += PL080_Cx_STRIDE; 701 regptr += PL080_Cx_STRIDE;
@@ -704,7 +704,8 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase,
704 /* for the moment, permanently enable the controller */ 704 /* for the moment, permanently enable the controller */
705 writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG); 705 writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG);
706 706
707 printk(KERN_INFO "PL080: IRQ %d, at %p\n", irq, regs); 707 printk(KERN_INFO "PL080: IRQ %d, at %p, channels %d..%d\n",
708 irq, regs, chno, chno+8);
708 709
709 return 0; 710 return 0;
710 711
diff --git a/arch/arm/mach-s3c64xx/gpiolib.c b/arch/arm/mach-s3c64xx/gpiolib.c
index fd99a82e82c4..92b09085caaa 100644
--- a/arch/arm/mach-s3c64xx/gpiolib.c
+++ b/arch/arm/mach-s3c64xx/gpiolib.c
@@ -72,7 +72,7 @@ static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = {
72 .get_pull = s3c_gpio_getpull_updown, 72 .get_pull = s3c_gpio_getpull_updown,
73}; 73};
74 74
75int s3c64xx_gpio2int_gpm(struct gpio_chip *chip, unsigned pin) 75static int s3c64xx_gpio2int_gpm(struct gpio_chip *chip, unsigned pin)
76{ 76{
77 return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO; 77 return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO;
78} 78}
@@ -138,7 +138,7 @@ static struct s3c_gpio_chip gpio_4bit[] = {
138 }, 138 },
139}; 139};
140 140
141int s3c64xx_gpio2int_gpl(struct gpio_chip *chip, unsigned pin) 141static int s3c64xx_gpio2int_gpl(struct gpio_chip *chip, unsigned pin)
142{ 142{
143 return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO; 143 return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO;
144} 144}
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index e85192a86fbe..a80a3163dd30 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -28,6 +28,7 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/smsc911x.h> 29#include <linux/smsc911x.h>
30#include <linux/regulator/fixed.h> 30#include <linux/regulator/fixed.h>
31#include <linux/regulator/machine.h>
31 32
32#ifdef CONFIG_SMDK6410_WM1190_EV1 33#ifdef CONFIG_SMDK6410_WM1190_EV1
33#include <linux/mfd/wm8350/core.h> 34#include <linux/mfd/wm8350/core.h>
@@ -351,7 +352,7 @@ static struct regulator_init_data smdk6410_vddpll = {
351/* VDD_UH_MMC, LDO5 on J5 */ 352/* VDD_UH_MMC, LDO5 on J5 */
352static struct regulator_init_data smdk6410_vdduh_mmc = { 353static struct regulator_init_data smdk6410_vdduh_mmc = {
353 .constraints = { 354 .constraints = {
354 .name = "PVDD_UH/PVDD_MMC", 355 .name = "PVDD_UH+PVDD_MMC",
355 .always_on = 1, 356 .always_on = 1,
356 }, 357 },
357}; 358};
@@ -417,7 +418,7 @@ static struct regulator_init_data smdk6410_vddaudio = {
417/* S3C64xx internal logic & PLL */ 418/* S3C64xx internal logic & PLL */
418static struct regulator_init_data wm8350_dcdc1_data = { 419static struct regulator_init_data wm8350_dcdc1_data = {
419 .constraints = { 420 .constraints = {
420 .name = "PVDD_INT/PVDD_PLL", 421 .name = "PVDD_INT+PVDD_PLL",
421 .min_uV = 1200000, 422 .min_uV = 1200000,
422 .max_uV = 1200000, 423 .max_uV = 1200000,
423 .always_on = 1, 424 .always_on = 1,
@@ -452,7 +453,7 @@ static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = {
452 453
453static struct regulator_init_data wm8350_dcdc4_data = { 454static struct regulator_init_data wm8350_dcdc4_data = {
454 .constraints = { 455 .constraints = {
455 .name = "PVDD_HI/PVDD_EXT/PVDD_SYS/PVCCM2MTV", 456 .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV",
456 .min_uV = 3000000, 457 .min_uV = 3000000,
457 .max_uV = 3000000, 458 .max_uV = 3000000,
458 .always_on = 1, 459 .always_on = 1,
@@ -464,7 +465,7 @@ static struct regulator_init_data wm8350_dcdc4_data = {
464/* OTGi/1190-EV1 HPVDD & AVDD */ 465/* OTGi/1190-EV1 HPVDD & AVDD */
465static struct regulator_init_data wm8350_ldo4_data = { 466static struct regulator_init_data wm8350_ldo4_data = {
466 .constraints = { 467 .constraints = {
467 .name = "PVDD_OTGI/HPVDD/AVDD", 468 .name = "PVDD_OTGI+HPVDD+AVDD",
468 .min_uV = 1200000, 469 .min_uV = 1200000,
469 .max_uV = 1200000, 470 .max_uV = 1200000,
470 .apply_uV = 1, 471 .apply_uV = 1,
@@ -552,7 +553,7 @@ static struct wm831x_backlight_pdata wm1192_backlight_pdata = {
552 553
553static struct regulator_init_data wm1192_dcdc3 = { 554static struct regulator_init_data wm1192_dcdc3 = {
554 .constraints = { 555 .constraints = {
555 .name = "PVDD_MEM/PVDD_GPS", 556 .name = "PVDD_MEM+PVDD_GPS",
556 .always_on = 1, 557 .always_on = 1,
557 }, 558 },
558}; 559};
@@ -563,7 +564,7 @@ static struct regulator_consumer_supply wm1192_ldo1_consumers[] = {
563 564
564static struct regulator_init_data wm1192_ldo1 = { 565static struct regulator_init_data wm1192_ldo1 = {
565 .constraints = { 566 .constraints = {
566 .name = "PVDD_LCD/PVDD_EXT", 567 .name = "PVDD_LCD+PVDD_EXT",
567 .always_on = 1, 568 .always_on = 1,
568 }, 569 },
569 .consumer_supplies = wm1192_ldo1_consumers, 570 .consumer_supplies = wm1192_ldo1_consumers,
diff --git a/arch/arm/mach-s3c64xx/setup-keypad.c b/arch/arm/mach-s3c64xx/setup-keypad.c
index f8ed0d22db70..1d4d0ee9e870 100644
--- a/arch/arm/mach-s3c64xx/setup-keypad.c
+++ b/arch/arm/mach-s3c64xx/setup-keypad.c
@@ -17,7 +17,7 @@
17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) 17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
18{ 18{
19 /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */ 19 /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
20 s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), 8 + rows, S3C_GPIO_SFN(3)); 20 s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), rows, S3C_GPIO_SFN(3));
21 21
22 /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */ 22 /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
23 s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3)); 23 s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3));
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci.c b/arch/arm/mach-s3c64xx/setup-sdhci.c
index 1a942037c4ef..f344a222bc84 100644
--- a/arch/arm/mach-s3c64xx/setup-sdhci.c
+++ b/arch/arm/mach-s3c64xx/setup-sdhci.c
@@ -56,7 +56,7 @@ void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
56 else 56 else
57 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0); 57 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
58 58
59 printk(KERN_INFO "%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3); 59 pr_debug("%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3);
60 writel(ctrl2, r + S3C_SDHCI_CONTROL2); 60 writel(ctrl2, r + S3C_SDHCI_CONTROL2);
61 writel(ctrl3, r + S3C_SDHCI_CONTROL3); 61 writel(ctrl3, r + S3C_SDHCI_CONTROL3);
62} 62}
diff --git a/arch/arm/mach-s3c64xx/sleep.S b/arch/arm/mach-s3c64xx/sleep.S
index b2ef44317368..afe5a762f46e 100644
--- a/arch/arm/mach-s3c64xx/sleep.S
+++ b/arch/arm/mach-s3c64xx/sleep.S
@@ -32,25 +32,13 @@
32 * code after resume. 32 * code after resume.
33 * 33 *
34 * entry: 34 * entry:
35 * r0 = pointer to the save block 35 * r1 = v:p offset
36 */ 36 */
37 37
38ENTRY(s3c_cpu_save) 38ENTRY(s3c_cpu_save)
39 stmfd sp!, { r4 - r12, lr } 39 stmfd sp!, { r4 - r12, lr }
40 40 ldr r3, =resume_with_mmu
41 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 41 bl cpu_suspend
42 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
43 mrc p15, 0, r6, c2, c0, 0 @ Translation Table BASE0
44 mrc p15, 0, r7, c2, c0, 1 @ Translation Table BASE1
45 mrc p15, 0, r8, c2, c0, 2 @ Translation Table Control
46 mrc p15, 0, r9, c1, c0, 0 @ Control register
47 mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register
48 mrc p15, 0, r11, c1, c0, 2 @ Co-processor access controls
49
50 stmia r0, { r4 - r13 } @ Save CP registers and SP
51
52 @@ save our state to ram
53 bl s3c_pm_cb_flushcache
54 42
55 @@ call final suspend code 43 @@ call final suspend code
56 ldr r0, =pm_cpu_sleep 44 ldr r0, =pm_cpu_sleep
@@ -61,18 +49,6 @@ ENTRY(s3c_cpu_save)
61resume_with_mmu: 49resume_with_mmu:
62 ldmfd sp!, { r4 - r12, pc } @ return, from sp from s3c_cpu_save 50 ldmfd sp!, { r4 - r12, pc } @ return, from sp from s3c_cpu_save
63 51
64 .data
65
66 /* the next bit is code, but it requires easy access to the
67 * s3c_sleep_save_phys data before the MMU is switched on, so
68 * we store the code that needs this variable in the .data where
69 * the value can be written to (the .text segment is RO).
70 */
71
72 .global s3c_sleep_save_phys
73s3c_sleep_save_phys:
74 .word 0
75
76 /* Sleep magic, the word before the resume entry point so that the 52 /* Sleep magic, the word before the resume entry point so that the
77 * bootloader can check for a resumeable image. */ 53 * bootloader can check for a resumeable image. */
78 54
@@ -110,35 +86,4 @@ ENTRY(s3c_cpu_resume)
110 orr r0, r0, #1 << 15 @ GPN15 86 orr r0, r0, #1 << 15 @ GPN15
111 str r0, [ r3, #S3C64XX_GPNDAT ] 87 str r0, [ r3, #S3C64XX_GPNDAT ]
112#endif 88#endif
113 89 b cpu_resume
114 /* __v6_setup from arch/arm/mm/proc-v6.S, ensure that the caches
115 * are thoroughly cleaned just in case the bootloader didn't do it
116 * for us. */
117 mov r0, #0
118 mcr p15, 0, r0, c7, c14, 0 @ clean+invalidate D cache
119 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
120 mcr p15, 0, r0, c7, c15, 0 @ clean+invalidate cache
121 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
122 @@mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs
123 @@mcr p15, 0, r0, c7, c7, 0 @ Invalidate I + D caches
124
125 ldr r0, s3c_sleep_save_phys
126 ldmia r0, { r4 - r13 }
127
128 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
129 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
130 mcr p15, 0, r6, c2, c0, 0 @ Translation Table BASE0
131 mcr p15, 0, r7, c2, c0, 1 @ Translation Table BASE1
132 mcr p15, 0, r8, c2, c0, 2 @ Translation Table Control
133 mcr p15, 0, r10, c1, c0, 1 @ Auxiliary control register
134
135 mov r0, #0 @ restore copro access controls
136 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access controls
137 mcr p15, 0, r0, c7, c5, 4
138
139 ldr r2, =resume_with_mmu
140 mcr p15, 0, r9, c1, c0, 0 /* turn mmu back on */
141 nop
142 mov pc, r2 /* jump back */
143
144 .end
diff --git a/arch/arm/mach-s5p6442/include/mach/map.h b/arch/arm/mach-s5p6442/include/mach/map.h
index 203dd5a18bd5..058dab4482a1 100644
--- a/arch/arm/mach-s5p6442/include/mach/map.h
+++ b/arch/arm/mach-s5p6442/include/mach/map.h
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s5p6442/include/mach/map.h 1/* linux/arch/arm/mach-s5p6442/include/mach/map.h
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com/
5 * 5 *
6 * S5P6442 - Memory map definitions 6 * S5P6442 - Memory map definitions
@@ -16,56 +16,61 @@
16#include <plat/map-base.h> 16#include <plat/map-base.h>
17#include <plat/map-s5p.h> 17#include <plat/map-s5p.h>
18 18
19#define S5P6442_PA_CHIPID (0xE0000000) 19#define S5P6442_PA_SDRAM 0x20000000
20#define S5P_PA_CHIPID S5P6442_PA_CHIPID
21 20
22#define S5P6442_PA_SYSCON (0xE0100000) 21#define S5P6442_PA_I2S0 0xC0B00000
23#define S5P_PA_SYSCON S5P6442_PA_SYSCON 22#define S5P6442_PA_I2S1 0xF2200000
24 23
25#define S5P6442_PA_GPIO (0xE0200000) 24#define S5P6442_PA_CHIPID 0xE0000000
26 25
27#define S5P6442_PA_VIC0 (0xE4000000) 26#define S5P6442_PA_SYSCON 0xE0100000
28#define S5P6442_PA_VIC1 (0xE4100000)
29#define S5P6442_PA_VIC2 (0xE4200000)
30 27
31#define S5P6442_PA_SROMC (0xE7000000) 28#define S5P6442_PA_GPIO 0xE0200000
32#define S5P_PA_SROMC S5P6442_PA_SROMC
33 29
34#define S5P6442_PA_MDMA 0xE8000000 30#define S5P6442_PA_VIC0 0xE4000000
35#define S5P6442_PA_PDMA 0xE9000000 31#define S5P6442_PA_VIC1 0xE4100000
32#define S5P6442_PA_VIC2 0xE4200000
36 33
37#define S5P6442_PA_TIMER (0xEA000000) 34#define S5P6442_PA_SROMC 0xE7000000
38#define S5P_PA_TIMER S5P6442_PA_TIMER
39 35
40#define S5P6442_PA_SYSTIMER (0xEA100000) 36#define S5P6442_PA_MDMA 0xE8000000
37#define S5P6442_PA_PDMA 0xE9000000
41 38
42#define S5P6442_PA_WATCHDOG (0xEA200000) 39#define S5P6442_PA_TIMER 0xEA000000
43 40
44#define S5P6442_PA_UART (0xEC000000) 41#define S5P6442_PA_SYSTIMER 0xEA100000
45 42
46#define S5P_PA_UART0 (S5P6442_PA_UART + 0x0) 43#define S5P6442_PA_WATCHDOG 0xEA200000
47#define S5P_PA_UART1 (S5P6442_PA_UART + 0x400)
48#define S5P_PA_UART2 (S5P6442_PA_UART + 0x800)
49#define S5P_SZ_UART SZ_256
50 44
51#define S5P6442_PA_IIC0 (0xEC100000) 45#define S5P6442_PA_UART 0xEC000000
52 46
53#define S5P6442_PA_SDRAM (0x20000000) 47#define S5P6442_PA_IIC0 0xEC100000
54#define S5P_PA_SDRAM S5P6442_PA_SDRAM
55 48
56#define S5P6442_PA_SPI 0xEC300000 49#define S5P6442_PA_SPI 0xEC300000
57 50
58/* I2S */
59#define S5P6442_PA_I2S0 0xC0B00000
60#define S5P6442_PA_I2S1 0xF2200000
61
62/* PCM */
63#define S5P6442_PA_PCM0 0xF2400000 51#define S5P6442_PA_PCM0 0xF2400000
64#define S5P6442_PA_PCM1 0xF2500000 52#define S5P6442_PA_PCM1 0xF2500000
65 53
66/* compatibiltiy defines. */ 54/* Compatibiltiy Defines */
55
56#define S3C_PA_IIC S5P6442_PA_IIC0
67#define S3C_PA_WDT S5P6442_PA_WATCHDOG 57#define S3C_PA_WDT S5P6442_PA_WATCHDOG
58
59#define S5P_PA_CHIPID S5P6442_PA_CHIPID
60#define S5P_PA_SDRAM S5P6442_PA_SDRAM
61#define S5P_PA_SROMC S5P6442_PA_SROMC
62#define S5P_PA_SYSCON S5P6442_PA_SYSCON
63#define S5P_PA_TIMER S5P6442_PA_TIMER
64
65/* UART */
66
68#define S3C_PA_UART S5P6442_PA_UART 67#define S3C_PA_UART S5P6442_PA_UART
69#define S3C_PA_IIC S5P6442_PA_IIC0 68
69#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
70#define S5P_PA_UART0 S5P_PA_UART(0)
71#define S5P_PA_UART1 S5P_PA_UART(1)
72#define S5P_PA_UART2 S5P_PA_UART(2)
73
74#define S5P_SZ_UART SZ_256
70 75
71#endif /* __ASM_ARCH_MAP_H */ 76#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h
index 5486c8f01f1d..adb5f298ead8 100644
--- a/arch/arm/mach-s5p64x0/include/mach/gpio.h
+++ b/arch/arm/mach-s5p64x0/include/mach/gpio.h
@@ -23,7 +23,7 @@
23#define S5P6440_GPIO_A_NR (6) 23#define S5P6440_GPIO_A_NR (6)
24#define S5P6440_GPIO_B_NR (7) 24#define S5P6440_GPIO_B_NR (7)
25#define S5P6440_GPIO_C_NR (8) 25#define S5P6440_GPIO_C_NR (8)
26#define S5P6440_GPIO_F_NR (2) 26#define S5P6440_GPIO_F_NR (16)
27#define S5P6440_GPIO_G_NR (7) 27#define S5P6440_GPIO_G_NR (7)
28#define S5P6440_GPIO_H_NR (10) 28#define S5P6440_GPIO_H_NR (10)
29#define S5P6440_GPIO_I_NR (16) 29#define S5P6440_GPIO_I_NR (16)
@@ -36,7 +36,7 @@
36#define S5P6450_GPIO_B_NR (7) 36#define S5P6450_GPIO_B_NR (7)
37#define S5P6450_GPIO_C_NR (8) 37#define S5P6450_GPIO_C_NR (8)
38#define S5P6450_GPIO_D_NR (8) 38#define S5P6450_GPIO_D_NR (8)
39#define S5P6450_GPIO_F_NR (2) 39#define S5P6450_GPIO_F_NR (16)
40#define S5P6450_GPIO_G_NR (14) 40#define S5P6450_GPIO_G_NR (14)
41#define S5P6450_GPIO_H_NR (10) 41#define S5P6450_GPIO_H_NR (10)
42#define S5P6450_GPIO_I_NR (16) 42#define S5P6450_GPIO_I_NR (16)
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
index a9365e5ba614..95c91257c7ca 100644
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ b/arch/arm/mach-s5p64x0/include/mach/map.h
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s5p64x0/include/mach/map.h 1/* linux/arch/arm/mach-s5p64x0/include/mach/map.h
2 * 2 *
3 * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 4 * http://www.samsung.com
5 * 5 *
6 * S5P64X0 - Memory map definitions 6 * S5P64X0 - Memory map definitions
@@ -16,64 +16,46 @@
16#include <plat/map-base.h> 16#include <plat/map-base.h>
17#include <plat/map-s5p.h> 17#include <plat/map-s5p.h>
18 18
19#define S5P64X0_PA_SDRAM (0x20000000) 19#define S5P64X0_PA_SDRAM 0x20000000
20 20
21#define S5P64X0_PA_CHIPID (0xE0000000) 21#define S5P64X0_PA_CHIPID 0xE0000000
22#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
23
24#define S5P64X0_PA_SYSCON (0xE0100000)
25#define S5P_PA_SYSCON S5P64X0_PA_SYSCON
26
27#define S5P64X0_PA_GPIO (0xE0308000)
28
29#define S5P64X0_PA_VIC0 (0xE4000000)
30#define S5P64X0_PA_VIC1 (0xE4100000)
31 22
32#define S5P64X0_PA_SROMC (0xE7000000) 23#define S5P64X0_PA_SYSCON 0xE0100000
33#define S5P_PA_SROMC S5P64X0_PA_SROMC
34
35#define S5P64X0_PA_PDMA (0xE9000000)
36
37#define S5P64X0_PA_TIMER (0xEA000000)
38#define S5P_PA_TIMER S5P64X0_PA_TIMER
39 24
40#define S5P64X0_PA_RTC (0xEA100000) 25#define S5P64X0_PA_GPIO 0xE0308000
41 26
42#define S5P64X0_PA_WDT (0xEA200000) 27#define S5P64X0_PA_VIC0 0xE4000000
28#define S5P64X0_PA_VIC1 0xE4100000
43 29
44#define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET)) 30#define S5P64X0_PA_SROMC 0xE7000000
45#define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000))
46 31
47#define S5P_PA_UART0 S5P6450_PA_UART(0) 32#define S5P64X0_PA_PDMA 0xE9000000
48#define S5P_PA_UART1 S5P6450_PA_UART(1)
49#define S5P_PA_UART2 S5P6450_PA_UART(2)
50#define S5P_PA_UART3 S5P6450_PA_UART(3)
51#define S5P_PA_UART4 S5P6450_PA_UART(4)
52#define S5P_PA_UART5 S5P6450_PA_UART(5)
53 33
54#define S5P_SZ_UART SZ_256 34#define S5P64X0_PA_TIMER 0xEA000000
35#define S5P64X0_PA_RTC 0xEA100000
36#define S5P64X0_PA_WDT 0xEA200000
55 37
56#define S5P6440_PA_IIC0 (0xEC104000) 38#define S5P6440_PA_IIC0 0xEC104000
57#define S5P6440_PA_IIC1 (0xEC20F000) 39#define S5P6440_PA_IIC1 0xEC20F000
58#define S5P6450_PA_IIC0 (0xEC100000) 40#define S5P6450_PA_IIC0 0xEC100000
59#define S5P6450_PA_IIC1 (0xEC200000) 41#define S5P6450_PA_IIC1 0xEC200000
60 42
61#define S5P64X0_PA_SPI0 (0xEC400000) 43#define S5P64X0_PA_SPI0 0xEC400000
62#define S5P64X0_PA_SPI1 (0xEC500000) 44#define S5P64X0_PA_SPI1 0xEC500000
63 45
64#define S5P64X0_PA_HSOTG (0xED100000) 46#define S5P64X0_PA_HSOTG 0xED100000
65 47
66#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) 48#define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
67 49
68#define S5P64X0_PA_I2S (0xF2000000) 50#define S5P64X0_PA_I2S 0xF2000000
69#define S5P6450_PA_I2S1 0xF2800000 51#define S5P6450_PA_I2S1 0xF2800000
70#define S5P6450_PA_I2S2 0xF2900000 52#define S5P6450_PA_I2S2 0xF2900000
71 53
72#define S5P64X0_PA_PCM (0xF2100000) 54#define S5P64X0_PA_PCM 0xF2100000
73 55
74#define S5P64X0_PA_ADC (0xF3000000) 56#define S5P64X0_PA_ADC 0xF3000000
75 57
76/* compatibiltiy defines. */ 58/* Compatibiltiy Defines */
77 59
78#define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0) 60#define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0)
79#define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1) 61#define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1)
@@ -83,6 +65,25 @@
83#define S3C_PA_RTC S5P64X0_PA_RTC 65#define S3C_PA_RTC S5P64X0_PA_RTC
84#define S3C_PA_WDT S5P64X0_PA_WDT 66#define S3C_PA_WDT S5P64X0_PA_WDT
85 67
68#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
69#define S5P_PA_SROMC S5P64X0_PA_SROMC
70#define S5P_PA_SYSCON S5P64X0_PA_SYSCON
71#define S5P_PA_TIMER S5P64X0_PA_TIMER
72
86#define SAMSUNG_PA_ADC S5P64X0_PA_ADC 73#define SAMSUNG_PA_ADC S5P64X0_PA_ADC
87 74
75/* UART */
76
77#define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET))
78#define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000))
79
80#define S5P_PA_UART0 S5P6450_PA_UART(0)
81#define S5P_PA_UART1 S5P6450_PA_UART(1)
82#define S5P_PA_UART2 S5P6450_PA_UART(2)
83#define S5P_PA_UART3 S5P6450_PA_UART(3)
84#define S5P_PA_UART4 S5P6450_PA_UART(4)
85#define S5P_PA_UART5 S5P6450_PA_UART(5)
86
87#define S5P_SZ_UART SZ_256
88
88#endif /* __ASM_ARCH_MAP_H */ 89#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
index 328467b346aa..ccbe6b767f7d 100644
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -1,5 +1,8 @@
1/* linux/arch/arm/mach-s5pc100/include/mach/map.h 1/* linux/arch/arm/mach-s5pc100/include/mach/map.h
2 * 2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
3 * Copyright 2009 Samsung Electronics Co. 6 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com> 7 * Byungho Min <bhmin@samsung.com>
5 * 8 *
@@ -16,145 +19,115 @@
16#include <plat/map-base.h> 19#include <plat/map-base.h>
17#include <plat/map-s5p.h> 20#include <plat/map-s5p.h>
18 21
19/* 22#define S5PC100_PA_SDRAM 0x20000000
20 * map-base.h has already defined virtual memory address 23
21 * S3C_VA_IRQ S3C_ADDR(0x00000000) irq controller(s) 24#define S5PC100_PA_ONENAND 0xE7100000
22 * S3C_VA_SYS S3C_ADDR(0x00100000) system control 25#define S5PC100_PA_ONENAND_BUF 0xB0000000
23 * S3C_VA_MEM S3C_ADDR(0x00200000) system control (not used) 26
24 * S3C_VA_TIMER S3C_ADDR(0x00300000) timer block 27#define S5PC100_PA_CHIPID 0xE0000000
25 * S3C_VA_WATCHDOG S3C_ADDR(0x00400000) watchdog
26 * S3C_VA_UART S3C_ADDR(0x01000000) UART
27 *
28 * S5PC100 specific virtual memory address can be defined here
29 * S5PC1XX_VA_GPIO S3C_ADDR(0x00500000) GPIO
30 *
31 */
32 28
33#define S5PC100_PA_ONENAND_BUF (0xB0000000) 29#define S5PC100_PA_SYSCON 0xE0100000
34#define S5PC100_SZ_ONENAND_BUF (SZ_256M - SZ_32M)
35 30
36/* Chip ID */ 31#define S5PC100_PA_OTHERS 0xE0200000
37 32
38#define S5PC100_PA_CHIPID (0xE0000000) 33#define S5PC100_PA_GPIO 0xE0300000
39#define S5P_PA_CHIPID S5PC100_PA_CHIPID
40 34
41#define S5PC100_PA_SYSCON (0xE0100000) 35#define S5PC100_PA_VIC0 0xE4000000
42#define S5P_PA_SYSCON S5PC100_PA_SYSCON 36#define S5PC100_PA_VIC1 0xE4100000
37#define S5PC100_PA_VIC2 0xE4200000
43 38
44#define S5PC100_PA_OTHERS (0xE0200000) 39#define S5PC100_PA_SROMC 0xE7000000
45#define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000)
46 40
47#define S5PC100_PA_GPIO (0xE0300000) 41#define S5PC100_PA_CFCON 0xE7800000
48#define S5PC1XX_VA_GPIO S3C_ADDR(0x00500000)
49 42
50/* Interrupt */ 43#define S5PC100_PA_MDMA 0xE8100000
51#define S5PC100_PA_VIC0 (0xE4000000) 44#define S5PC100_PA_PDMA0 0xE9000000
52#define S5PC100_PA_VIC1 (0xE4100000) 45#define S5PC100_PA_PDMA1 0xE9200000
53#define S5PC100_PA_VIC2 (0xE4200000)
54#define S5PC100_VA_VIC S3C_VA_IRQ
55#define S5PC100_VA_VIC_OFFSET 0x10000
56#define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET))
57 46
58#define S5PC100_PA_SROMC (0xE7000000) 47#define S5PC100_PA_TIMER 0xEA000000
59#define S5P_PA_SROMC S5PC100_PA_SROMC 48#define S5PC100_PA_SYSTIMER 0xEA100000
49#define S5PC100_PA_WATCHDOG 0xEA200000
50#define S5PC100_PA_RTC 0xEA300000
60 51
61#define S5PC100_PA_ONENAND (0xE7100000) 52#define S5PC100_PA_UART 0xEC000000
62 53
63#define S5PC100_PA_CFCON (0xE7800000) 54#define S5PC100_PA_IIC0 0xEC100000
55#define S5PC100_PA_IIC1 0xEC200000
64 56
65/* DMA */ 57#define S5PC100_PA_SPI0 0xEC300000
66#define S5PC100_PA_MDMA (0xE8100000) 58#define S5PC100_PA_SPI1 0xEC400000
67#define S5PC100_PA_PDMA0 (0xE9000000) 59#define S5PC100_PA_SPI2 0xEC500000
68#define S5PC100_PA_PDMA1 (0xE9200000)
69 60
70/* Timer */ 61#define S5PC100_PA_USB_HSOTG 0xED200000
71#define S5PC100_PA_TIMER (0xEA000000) 62#define S5PC100_PA_USB_HSPHY 0xED300000
72#define S5P_PA_TIMER S5PC100_PA_TIMER
73 63
74#define S5PC100_PA_SYSTIMER (0xEA100000) 64#define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000))
75 65
76#define S5PC100_PA_WATCHDOG (0xEA200000) 66#define S5PC100_PA_FB 0xEE000000
77#define S5PC100_PA_RTC (0xEA300000)
78 67
79#define S5PC100_PA_UART (0xEC000000) 68#define S5PC100_PA_FIMC0 0xEE200000
69#define S5PC100_PA_FIMC1 0xEE300000
70#define S5PC100_PA_FIMC2 0xEE400000
80 71
81#define S5P_PA_UART0 (S5PC100_PA_UART + 0x0) 72#define S5PC100_PA_I2S0 0xF2000000
82#define S5P_PA_UART1 (S5PC100_PA_UART + 0x400) 73#define S5PC100_PA_I2S1 0xF2100000
83#define S5P_PA_UART2 (S5PC100_PA_UART + 0x800) 74#define S5PC100_PA_I2S2 0xF2200000
84#define S5P_PA_UART3 (S5PC100_PA_UART + 0xC00)
85#define S5P_SZ_UART SZ_256
86 75
87#define S5PC100_PA_IIC0 (0xEC100000) 76#define S5PC100_PA_AC97 0xF2300000
88#define S5PC100_PA_IIC1 (0xEC200000)
89 77
90/* SPI */ 78#define S5PC100_PA_PCM0 0xF2400000
91#define S5PC100_PA_SPI0 0xEC300000 79#define S5PC100_PA_PCM1 0xF2500000
92#define S5PC100_PA_SPI1 0xEC400000
93#define S5PC100_PA_SPI2 0xEC500000
94 80
95/* USB HS OTG */ 81#define S5PC100_PA_SPDIF 0xF2600000
96#define S5PC100_PA_USB_HSOTG (0xED200000)
97#define S5PC100_PA_USB_HSPHY (0xED300000)
98 82
99#define S5PC100_PA_FB (0xEE000000) 83#define S5PC100_PA_TSADC 0xF3000000
100 84
101#define S5PC100_PA_FIMC0 (0xEE200000) 85#define S5PC100_PA_KEYPAD 0xF3100000
102#define S5PC100_PA_FIMC1 (0xEE300000)
103#define S5PC100_PA_FIMC2 (0xEE400000)
104 86
105#define S5PC100_PA_I2S0 (0xF2000000) 87/* Compatibiltiy Defines */
106#define S5PC100_PA_I2S1 (0xF2100000)
107#define S5PC100_PA_I2S2 (0xF2200000)
108 88
109#define S5PC100_PA_AC97 0xF2300000 89#define S3C_PA_FB S5PC100_PA_FB
90#define S3C_PA_HSMMC0 S5PC100_PA_HSMMC(0)
91#define S3C_PA_HSMMC1 S5PC100_PA_HSMMC(1)
92#define S3C_PA_HSMMC2 S5PC100_PA_HSMMC(2)
93#define S3C_PA_IIC S5PC100_PA_IIC0
94#define S3C_PA_IIC1 S5PC100_PA_IIC1
95#define S3C_PA_KEYPAD S5PC100_PA_KEYPAD
96#define S3C_PA_ONENAND S5PC100_PA_ONENAND
97#define S3C_PA_ONENAND_BUF S5PC100_PA_ONENAND_BUF
98#define S3C_PA_RTC S5PC100_PA_RTC
99#define S3C_PA_TSADC S5PC100_PA_TSADC
100#define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG
101#define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY
102#define S3C_PA_WDT S5PC100_PA_WATCHDOG
110 103
111/* PCM */ 104#define S5P_PA_CHIPID S5PC100_PA_CHIPID
112#define S5PC100_PA_PCM0 0xF2400000 105#define S5P_PA_FIMC0 S5PC100_PA_FIMC0
113#define S5PC100_PA_PCM1 0xF2500000 106#define S5P_PA_FIMC1 S5PC100_PA_FIMC1
107#define S5P_PA_FIMC2 S5PC100_PA_FIMC2
108#define S5P_PA_SDRAM S5PC100_PA_SDRAM
109#define S5P_PA_SROMC S5PC100_PA_SROMC
110#define S5P_PA_SYSCON S5PC100_PA_SYSCON
111#define S5P_PA_TIMER S5PC100_PA_TIMER
114 112
115#define S5PC100_PA_SPDIF 0xF2600000 113#define SAMSUNG_PA_ADC S5PC100_PA_TSADC
114#define SAMSUNG_PA_CFCON S5PC100_PA_CFCON
115#define SAMSUNG_PA_KEYPAD S5PC100_PA_KEYPAD
116 116
117#define S5PC100_PA_TSADC (0xF3000000) 117#define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000)
118 118
119/* KEYPAD */ 119#define S3C_SZ_ONENAND_BUF (SZ_256M - SZ_32M)
120#define S5PC100_PA_KEYPAD (0xF3100000)
121 120
122#define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) 121/* UART */
123 122
124#define S5PC100_PA_SDRAM (0x20000000) 123#define S3C_PA_UART S5PC100_PA_UART
125#define S5P_PA_SDRAM S5PC100_PA_SDRAM
126 124
127/* compatibiltiy defines. */ 125#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
128#define S3C_PA_UART S5PC100_PA_UART 126#define S5P_PA_UART0 S5P_PA_UART(0)
129#define S3C_PA_IIC S5PC100_PA_IIC0 127#define S5P_PA_UART1 S5P_PA_UART(1)
130#define S3C_PA_IIC1 S5PC100_PA_IIC1 128#define S5P_PA_UART2 S5P_PA_UART(2)
131#define S3C_PA_FB S5PC100_PA_FB 129#define S5P_PA_UART3 S5P_PA_UART(3)
132#define S3C_PA_G2D S5PC100_PA_G2D
133#define S3C_PA_G3D S5PC100_PA_G3D
134#define S3C_PA_JPEG S5PC100_PA_JPEG
135#define S3C_PA_ROTATOR S5PC100_PA_ROTATOR
136#define S5P_VA_VIC0 S5PC1XX_VA_VIC(0)
137#define S5P_VA_VIC1 S5PC1XX_VA_VIC(1)
138#define S5P_VA_VIC2 S5PC1XX_VA_VIC(2)
139#define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG
140#define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY
141#define S3C_PA_HSMMC0 S5PC100_PA_HSMMC(0)
142#define S3C_PA_HSMMC1 S5PC100_PA_HSMMC(1)
143#define S3C_PA_HSMMC2 S5PC100_PA_HSMMC(2)
144#define S3C_PA_KEYPAD S5PC100_PA_KEYPAD
145#define S3C_PA_WDT S5PC100_PA_WATCHDOG
146#define S3C_PA_TSADC S5PC100_PA_TSADC
147#define S3C_PA_ONENAND S5PC100_PA_ONENAND
148#define S3C_PA_ONENAND_BUF S5PC100_PA_ONENAND_BUF
149#define S3C_SZ_ONENAND_BUF S5PC100_SZ_ONENAND_BUF
150#define S3C_PA_RTC S5PC100_PA_RTC
151
152#define SAMSUNG_PA_ADC S5PC100_PA_TSADC
153#define SAMSUNG_PA_CFCON S5PC100_PA_CFCON
154#define SAMSUNG_PA_KEYPAD S5PC100_PA_KEYPAD
155 130
156#define S5P_PA_FIMC0 S5PC100_PA_FIMC0 131#define S5P_SZ_UART SZ_256
157#define S5P_PA_FIMC1 S5PC100_PA_FIMC1
158#define S5P_PA_FIMC2 S5PC100_PA_FIMC2
159 132
160#endif /* __ASM_ARCH_C100_MAP_H */ 133#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index 3611492ad681..1dd58836fd4f 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/map.h 1/* linux/arch/arm/mach-s5pv210/include/mach/map.h
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com/
5 * 5 *
6 * S5PV210 - Memory map definitions 6 * S5PV210 - Memory map definitions
@@ -16,122 +16,120 @@
16#include <plat/map-base.h> 16#include <plat/map-base.h>
17#include <plat/map-s5p.h> 17#include <plat/map-s5p.h>
18 18
19#define S5PV210_PA_SROM_BANK5 (0xA8000000) 19#define S5PV210_PA_SDRAM 0x20000000
20 20
21#define S5PC110_PA_ONENAND (0xB0000000) 21#define S5PV210_PA_SROM_BANK5 0xA8000000
22#define S5P_PA_ONENAND S5PC110_PA_ONENAND
23 22
24#define S5PC110_PA_ONENAND_DMA (0xB0600000) 23#define S5PC110_PA_ONENAND 0xB0000000
25#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA 24#define S5PC110_PA_ONENAND_DMA 0xB0600000
26 25
27#define S5PV210_PA_CHIPID (0xE0000000) 26#define S5PV210_PA_CHIPID 0xE0000000
28#define S5P_PA_CHIPID S5PV210_PA_CHIPID
29 27
30#define S5PV210_PA_SYSCON (0xE0100000) 28#define S5PV210_PA_SYSCON 0xE0100000
31#define S5P_PA_SYSCON S5PV210_PA_SYSCON
32 29
33#define S5PV210_PA_GPIO (0xE0200000) 30#define S5PV210_PA_GPIO 0xE0200000
34 31
35/* SPI */ 32#define S5PV210_PA_SPDIF 0xE1100000
36#define S5PV210_PA_SPI0 0xE1300000
37#define S5PV210_PA_SPI1 0xE1400000
38 33
39#define S5PV210_PA_KEYPAD (0xE1600000) 34#define S5PV210_PA_SPI0 0xE1300000
35#define S5PV210_PA_SPI1 0xE1400000
40 36
41#define S5PV210_PA_IIC0 (0xE1800000) 37#define S5PV210_PA_KEYPAD 0xE1600000
42#define S5PV210_PA_IIC1 (0xFAB00000)
43#define S5PV210_PA_IIC2 (0xE1A00000)
44 38
45#define S5PV210_PA_TIMER (0xE2500000) 39#define S5PV210_PA_ADC 0xE1700000
46#define S5P_PA_TIMER S5PV210_PA_TIMER
47 40
48#define S5PV210_PA_SYSTIMER (0xE2600000) 41#define S5PV210_PA_IIC0 0xE1800000
42#define S5PV210_PA_IIC1 0xFAB00000
43#define S5PV210_PA_IIC2 0xE1A00000
49 44
50#define S5PV210_PA_WATCHDOG (0xE2700000) 45#define S5PV210_PA_AC97 0xE2200000
51 46
52#define S5PV210_PA_RTC (0xE2800000) 47#define S5PV210_PA_PCM0 0xE2300000
53#define S5PV210_PA_UART (0xE2900000) 48#define S5PV210_PA_PCM1 0xE1200000
49#define S5PV210_PA_PCM2 0xE2B00000
54 50
55#define S5P_PA_UART0 (S5PV210_PA_UART + 0x0) 51#define S5PV210_PA_TIMER 0xE2500000
56#define S5P_PA_UART1 (S5PV210_PA_UART + 0x400) 52#define S5PV210_PA_SYSTIMER 0xE2600000
57#define S5P_PA_UART2 (S5PV210_PA_UART + 0x800) 53#define S5PV210_PA_WATCHDOG 0xE2700000
58#define S5P_PA_UART3 (S5PV210_PA_UART + 0xC00) 54#define S5PV210_PA_RTC 0xE2800000
59 55
60#define S5P_SZ_UART SZ_256 56#define S5PV210_PA_UART 0xE2900000
61 57
62#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 58#define S5PV210_PA_SROMC 0xE8000000
63 59
64#define S5PV210_PA_SROMC (0xE8000000) 60#define S5PV210_PA_CFCON 0xE8200000
65#define S5P_PA_SROMC S5PV210_PA_SROMC
66 61
67#define S5PV210_PA_CFCON (0xE8200000) 62#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000))
68 63
69#define S5PV210_PA_MDMA 0xFA200000 64#define S5PV210_PA_HSOTG 0xEC000000
70#define S5PV210_PA_PDMA0 0xE0900000 65#define S5PV210_PA_HSPHY 0xEC100000
71#define S5PV210_PA_PDMA1 0xE0A00000
72 66
73#define S5PV210_PA_FB (0xF8000000) 67#define S5PV210_PA_IIS0 0xEEE30000
68#define S5PV210_PA_IIS1 0xE2100000
69#define S5PV210_PA_IIS2 0xE2A00000
74 70
75#define S5PV210_PA_FIMC0 (0xFB200000) 71#define S5PV210_PA_DMC0 0xF0000000
76#define S5PV210_PA_FIMC1 (0xFB300000) 72#define S5PV210_PA_DMC1 0xF1400000
77#define S5PV210_PA_FIMC2 (0xFB400000)
78 73
79#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) 74#define S5PV210_PA_VIC0 0xF2000000
75#define S5PV210_PA_VIC1 0xF2100000
76#define S5PV210_PA_VIC2 0xF2200000
77#define S5PV210_PA_VIC3 0xF2300000
80 78
81#define S5PV210_PA_HSOTG (0xEC000000) 79#define S5PV210_PA_FB 0xF8000000
82#define S5PV210_PA_HSPHY (0xEC100000)
83 80
84#define S5PV210_PA_VIC0 (0xF2000000) 81#define S5PV210_PA_MDMA 0xFA200000
85#define S5PV210_PA_VIC1 (0xF2100000) 82#define S5PV210_PA_PDMA0 0xE0900000
86#define S5PV210_PA_VIC2 (0xF2200000) 83#define S5PV210_PA_PDMA1 0xE0A00000
87#define S5PV210_PA_VIC3 (0xF2300000)
88 84
89#define S5PV210_PA_SDRAM (0x20000000) 85#define S5PV210_PA_MIPI_CSIS 0xFA600000
90#define S5P_PA_SDRAM S5PV210_PA_SDRAM
91 86
92/* S/PDIF */ 87#define S5PV210_PA_FIMC0 0xFB200000
93#define S5PV210_PA_SPDIF 0xE1100000 88#define S5PV210_PA_FIMC1 0xFB300000
89#define S5PV210_PA_FIMC2 0xFB400000
94 90
95/* I2S */ 91/* Compatibiltiy Defines */
96#define S5PV210_PA_IIS0 0xEEE30000
97#define S5PV210_PA_IIS1 0xE2100000
98#define S5PV210_PA_IIS2 0xE2A00000
99 92
100/* PCM */ 93#define S3C_PA_FB S5PV210_PA_FB
101#define S5PV210_PA_PCM0 0xE2300000 94#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0)
102#define S5PV210_PA_PCM1 0xE1200000 95#define S3C_PA_HSMMC1 S5PV210_PA_HSMMC(1)
103#define S5PV210_PA_PCM2 0xE2B00000 96#define S3C_PA_HSMMC2 S5PV210_PA_HSMMC(2)
97#define S3C_PA_HSMMC3 S5PV210_PA_HSMMC(3)
98#define S3C_PA_IIC S5PV210_PA_IIC0
99#define S3C_PA_IIC1 S5PV210_PA_IIC1
100#define S3C_PA_IIC2 S5PV210_PA_IIC2
101#define S3C_PA_RTC S5PV210_PA_RTC
102#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG
103#define S3C_PA_WDT S5PV210_PA_WATCHDOG
104 104
105/* AC97 */ 105#define S5P_PA_CHIPID S5PV210_PA_CHIPID
106#define S5PV210_PA_AC97 0xE2200000 106#define S5P_PA_FIMC0 S5PV210_PA_FIMC0
107#define S5P_PA_FIMC1 S5PV210_PA_FIMC1
108#define S5P_PA_FIMC2 S5PV210_PA_FIMC2
109#define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS
110#define S5P_PA_ONENAND S5PC110_PA_ONENAND
111#define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA
112#define S5P_PA_SDRAM S5PV210_PA_SDRAM
113#define S5P_PA_SROMC S5PV210_PA_SROMC
114#define S5P_PA_SYSCON S5PV210_PA_SYSCON
115#define S5P_PA_TIMER S5PV210_PA_TIMER
107 116
108#define S5PV210_PA_ADC (0xE1700000) 117#define SAMSUNG_PA_ADC S5PV210_PA_ADC
118#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON
119#define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD
109 120
110#define S5PV210_PA_DMC0 (0xF0000000) 121/* UART */
111#define S5PV210_PA_DMC1 (0xF1400000)
112 122
113#define S5PV210_PA_MIPI_CSIS 0xFA600000 123#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
114 124
115/* compatibiltiy defines. */ 125#define S3C_PA_UART S5PV210_PA_UART
116#define S3C_PA_UART S5PV210_PA_UART
117#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0)
118#define S3C_PA_HSMMC1 S5PV210_PA_HSMMC(1)
119#define S3C_PA_HSMMC2 S5PV210_PA_HSMMC(2)
120#define S3C_PA_HSMMC3 S5PV210_PA_HSMMC(3)
121#define S3C_PA_IIC S5PV210_PA_IIC0
122#define S3C_PA_IIC1 S5PV210_PA_IIC1
123#define S3C_PA_IIC2 S5PV210_PA_IIC2
124#define S3C_PA_FB S5PV210_PA_FB
125#define S3C_PA_RTC S5PV210_PA_RTC
126#define S3C_PA_WDT S5PV210_PA_WATCHDOG
127#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG
128#define S5P_PA_FIMC0 S5PV210_PA_FIMC0
129#define S5P_PA_FIMC1 S5PV210_PA_FIMC1
130#define S5P_PA_FIMC2 S5PV210_PA_FIMC2
131#define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS
132 126
133#define SAMSUNG_PA_ADC S5PV210_PA_ADC 127#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
134#define SAMSUNG_PA_CFCON S5PV210_PA_CFCON 128#define S5P_PA_UART0 S5P_PA_UART(0)
135#define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD 129#define S5P_PA_UART1 S5P_PA_UART(1)
130#define S5P_PA_UART2 S5P_PA_UART(2)
131#define S5P_PA_UART3 S5P_PA_UART(3)
132
133#define S5P_SZ_UART SZ_256
136 134
137#endif /* __ASM_ARCH_MAP_H */ 135#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 461aa035afc0..557add4fc56c 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -149,7 +149,7 @@ static struct regulator_init_data aquila_ldo2_data = {
149 149
150static struct regulator_init_data aquila_ldo3_data = { 150static struct regulator_init_data aquila_ldo3_data = {
151 .constraints = { 151 .constraints = {
152 .name = "VUSB/MIPI_1.1V", 152 .name = "VUSB+MIPI_1.1V",
153 .min_uV = 1100000, 153 .min_uV = 1100000,
154 .max_uV = 1100000, 154 .max_uV = 1100000,
155 .apply_uV = 1, 155 .apply_uV = 1,
@@ -197,7 +197,7 @@ static struct regulator_init_data aquila_ldo7_data = {
197 197
198static struct regulator_init_data aquila_ldo8_data = { 198static struct regulator_init_data aquila_ldo8_data = {
199 .constraints = { 199 .constraints = {
200 .name = "VUSB/VADC_3.3V", 200 .name = "VUSB+VADC_3.3V",
201 .min_uV = 3300000, 201 .min_uV = 3300000,
202 .max_uV = 3300000, 202 .max_uV = 3300000,
203 .apply_uV = 1, 203 .apply_uV = 1,
@@ -207,7 +207,7 @@ static struct regulator_init_data aquila_ldo8_data = {
207 207
208static struct regulator_init_data aquila_ldo9_data = { 208static struct regulator_init_data aquila_ldo9_data = {
209 .constraints = { 209 .constraints = {
210 .name = "VCC/VCAM_2.8V", 210 .name = "VCC+VCAM_2.8V",
211 .min_uV = 2800000, 211 .min_uV = 2800000,
212 .max_uV = 2800000, 212 .max_uV = 2800000,
213 .apply_uV = 1, 213 .apply_uV = 1,
@@ -381,9 +381,12 @@ static struct max8998_platform_data aquila_max8998_pdata = {
381 .buck1_set1 = S5PV210_GPH0(3), 381 .buck1_set1 = S5PV210_GPH0(3),
382 .buck1_set2 = S5PV210_GPH0(4), 382 .buck1_set2 = S5PV210_GPH0(4),
383 .buck2_set3 = S5PV210_GPH0(5), 383 .buck2_set3 = S5PV210_GPH0(5),
384 .buck1_max_voltage1 = 1200000, 384 .buck1_voltage1 = 1200000,
385 .buck1_max_voltage2 = 1200000, 385 .buck1_voltage2 = 1200000,
386 .buck2_max_voltage = 1200000, 386 .buck1_voltage3 = 1200000,
387 .buck1_voltage4 = 1200000,
388 .buck2_voltage1 = 1200000,
389 .buck2_voltage2 = 1200000,
387}; 390};
388#endif 391#endif
389 392
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index e22d5112fd44..056f5c769b0a 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -288,7 +288,7 @@ static struct regulator_init_data goni_ldo2_data = {
288 288
289static struct regulator_init_data goni_ldo3_data = { 289static struct regulator_init_data goni_ldo3_data = {
290 .constraints = { 290 .constraints = {
291 .name = "VUSB/MIPI_1.1V", 291 .name = "VUSB+MIPI_1.1V",
292 .min_uV = 1100000, 292 .min_uV = 1100000,
293 .max_uV = 1100000, 293 .max_uV = 1100000,
294 .apply_uV = 1, 294 .apply_uV = 1,
@@ -337,7 +337,7 @@ static struct regulator_init_data goni_ldo7_data = {
337 337
338static struct regulator_init_data goni_ldo8_data = { 338static struct regulator_init_data goni_ldo8_data = {
339 .constraints = { 339 .constraints = {
340 .name = "VUSB/VADC_3.3V", 340 .name = "VUSB+VADC_3.3V",
341 .min_uV = 3300000, 341 .min_uV = 3300000,
342 .max_uV = 3300000, 342 .max_uV = 3300000,
343 .apply_uV = 1, 343 .apply_uV = 1,
@@ -347,7 +347,7 @@ static struct regulator_init_data goni_ldo8_data = {
347 347
348static struct regulator_init_data goni_ldo9_data = { 348static struct regulator_init_data goni_ldo9_data = {
349 .constraints = { 349 .constraints = {
350 .name = "VCC/VCAM_2.8V", 350 .name = "VCC+VCAM_2.8V",
351 .min_uV = 2800000, 351 .min_uV = 2800000,
352 .max_uV = 2800000, 352 .max_uV = 2800000,
353 .apply_uV = 1, 353 .apply_uV = 1,
@@ -521,9 +521,12 @@ static struct max8998_platform_data goni_max8998_pdata = {
521 .buck1_set1 = S5PV210_GPH0(3), 521 .buck1_set1 = S5PV210_GPH0(3),
522 .buck1_set2 = S5PV210_GPH0(4), 522 .buck1_set2 = S5PV210_GPH0(4),
523 .buck2_set3 = S5PV210_GPH0(5), 523 .buck2_set3 = S5PV210_GPH0(5),
524 .buck1_max_voltage1 = 1200000, 524 .buck1_voltage1 = 1200000,
525 .buck1_max_voltage2 = 1200000, 525 .buck1_voltage2 = 1200000,
526 .buck2_max_voltage = 1200000, 526 .buck1_voltage3 = 1200000,
527 .buck1_voltage4 = 1200000,
528 .buck2_voltage1 = 1200000,
529 .buck2_voltage2 = 1200000,
527}; 530};
528#endif 531#endif
529 532
diff --git a/arch/arm/mach-s5pv210/sleep.S b/arch/arm/mach-s5pv210/sleep.S
index 27376223ea92..a3d649466fb1 100644
--- a/arch/arm/mach-s5pv210/sleep.S
+++ b/arch/arm/mach-s5pv210/sleep.S
@@ -35,50 +35,24 @@
35 /* s3c_cpu_save 35 /* s3c_cpu_save
36 * 36 *
37 * entry: 37 * entry:
38 * r0 = save address (virtual addr of s3c_sleep_save_phys) 38 * r1 = v:p offset
39 */ 39 */
40 40
41ENTRY(s3c_cpu_save) 41ENTRY(s3c_cpu_save)
42 42
43 stmfd sp!, { r3 - r12, lr } 43 stmfd sp!, { r3 - r12, lr }
44 44 ldr r3, =resume_with_mmu
45 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 45 bl cpu_suspend
46 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
47 mrc p15, 0, r6, c2, c0, 0 @ Translation Table BASE0
48 mrc p15, 0, r7, c2, c0, 1 @ Translation Table BASE1
49 mrc p15, 0, r8, c2, c0, 2 @ Translation Table Control
50 mrc p15, 0, r9, c1, c0, 0 @ Control register
51 mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register
52 mrc p15, 0, r11, c1, c0, 2 @ Co-processor access controls
53 mrc p15, 0, r12, c10, c2, 0 @ Read PRRR
54 mrc p15, 0, r3, c10, c2, 1 @ READ NMRR
55
56 stmia r0, { r3 - r13 }
57
58 bl s3c_pm_cb_flushcache
59 46
60 ldr r0, =pm_cpu_sleep 47 ldr r0, =pm_cpu_sleep
61 ldr r0, [ r0 ] 48 ldr r0, [ r0 ]
62 mov pc, r0 49 mov pc, r0
63 50
64resume_with_mmu: 51resume_with_mmu:
65 /*
66 * After MMU is turned on, restore the previous MMU table.
67 */
68 ldr r9 , =(PAGE_OFFSET - PLAT_PHYS_OFFSET)
69 add r4, r4, r9
70 str r12, [r4]
71
72 ldmfd sp!, { r3 - r12, pc } 52 ldmfd sp!, { r3 - r12, pc }
73 53
74 .ltorg 54 .ltorg
75 55
76 .data
77
78 .global s3c_sleep_save_phys
79s3c_sleep_save_phys:
80 .word 0
81
82 /* sleep magic, to allow the bootloader to check for an valid 56 /* sleep magic, to allow the bootloader to check for an valid
83 * image to resume to. Must be the first word before the 57 * image to resume to. Must be the first word before the
84 * s3c_cpu_resume entry. 58 * s3c_cpu_resume entry.
@@ -96,75 +70,4 @@ s3c_sleep_save_phys:
96 */ 70 */
97 71
98ENTRY(s3c_cpu_resume) 72ENTRY(s3c_cpu_resume)
99 mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE 73 b cpu_resume
100 msr cpsr_c, r0
101
102 mov r1, #0
103 mcr p15, 0, r1, c8, c7, 0 @ invalidate TLBs
104 mcr p15, 0, r1, c7, c5, 0 @ invalidate I Cache
105
106 ldr r0, s3c_sleep_save_phys @ address of restore block
107 ldmia r0, { r3 - r13 }
108
109 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
110 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
111
112 mcr p15, 0, r8, c2, c0, 2 @ Translation Table Control
113 mcr p15, 0, r7, c2, c0, 1 @ Translation Table BASE1
114 mcr p15, 0, r6, c2, c0, 0 @ Translation Table BASE0
115
116 mcr p15, 0, r10, c1, c0, 1 @ Auxiliary control register
117
118 mov r0, #0
119 mcr p15, 0, r0, c8, c7, 0 @ Invalidate I & D TLB
120
121 mov r0, #0 @ restore copro access
122 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access
123 mcr p15, 0, r0, c7, c5, 4
124
125 mcr p15, 0, r12, c10, c2, 0 @ write PRRR
126 mcr p15, 0, r3, c10, c2, 1 @ write NMRR
127
128 /*
129 * In Cortex-A8, when MMU is turned on, the pipeline is flushed.
130 * And there are no valid entries in the MMU table at this point.
131 * So before turning on the MMU, the MMU entry for the DRAM address
132 * range is added. After the MMU is turned on, the other entries
133 * in the MMU table will be restored.
134 */
135
136 /* r6 = Translation Table BASE0 */
137 mov r4, r6
138 mov r4, r4, LSR #14
139 mov r4, r4, LSL #14
140
141 /* Load address for adding to MMU table list */
142 ldr r11, =0xE010F000 @ INFORM0 reg.
143 ldr r10, [r11, #0]
144 mov r10, r10, LSR #18
145 bic r10, r10, #0x3
146 orr r4, r4, r10
147
148 /* Calculate MMU table entry */
149 mov r10, r10, LSL #18
150 ldr r5, =0x40E
151 orr r10, r10, r5
152
153 /* Back up originally data */
154 ldr r12, [r4]
155
156 /* Add calculated MMU table entry into MMU table list */
157 str r10, [r4]
158
159 ldr r2, =resume_with_mmu
160 mcr p15, 0, r9, c1, c0, 0 @ turn on MMU, etc
161
162 nop
163 nop
164 nop
165 nop
166 nop @ second-to-last before mmu
167
168 mov pc, r2 @ go back to virtual address
169
170 .ltorg
diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 09c4c21b70cc..b2a9acc5185f 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -122,6 +122,7 @@ config MACH_SMDKV310
122 select S3C_DEV_HSMMC2 122 select S3C_DEV_HSMMC2
123 select S3C_DEV_HSMMC3 123 select S3C_DEV_HSMMC3
124 select S5PV310_DEV_PD 124 select S5PV310_DEV_PD
125 select S5PV310_DEV_SYSMMU
125 select S5PV310_SETUP_I2C1 126 select S5PV310_SETUP_I2C1
126 select S5PV310_SETUP_SDHCI 127 select S5PV310_SETUP_SDHCI
127 help 128 help
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h b/arch/arm/mach-s5pv310/include/mach/map.h
index 74d400625a23..901657fa7a12 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -1,6 +1,6 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/map.h 1/* linux/arch/arm/mach-s5pv310/include/mach/map.h
2 * 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com/
5 * 5 *
6 * S5PV310 - Memory map definitions 6 * S5PV310 - Memory map definitions
@@ -23,90 +23,43 @@
23 23
24#include <plat/map-s5p.h> 24#include <plat/map-s5p.h>
25 25
26#define S5PV310_PA_SYSRAM (0x02025000) 26#define S5PV310_PA_SYSRAM 0x02025000
27 27
28#define S5PV310_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000)) 28#define S5PV310_PA_I2S0 0x03830000
29 29#define S5PV310_PA_I2S1 0xE3100000
30#define S5PC210_PA_ONENAND (0x0C000000) 30#define S5PV310_PA_I2S2 0xE2A00000
31#define S5P_PA_ONENAND S5PC210_PA_ONENAND
32
33#define S5PC210_PA_ONENAND_DMA (0x0C600000)
34#define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA
35
36#define S5PV310_PA_CHIPID (0x10000000)
37#define S5P_PA_CHIPID S5PV310_PA_CHIPID
38
39#define S5PV310_PA_SYSCON (0x10010000)
40#define S5P_PA_SYSCON S5PV310_PA_SYSCON
41 31
42#define S5PV310_PA_PMU (0x10020000) 32#define S5PV310_PA_PCM0 0x03840000
33#define S5PV310_PA_PCM1 0x13980000
34#define S5PV310_PA_PCM2 0x13990000
43 35
44#define S5PV310_PA_CMU (0x10030000) 36#define S5PV310_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000))
45
46#define S5PV310_PA_WATCHDOG (0x10060000)
47#define S5PV310_PA_RTC (0x10070000)
48
49#define S5PV310_PA_DMC0 (0x10400000)
50
51#define S5PV310_PA_COMBINER (0x10448000)
52
53#define S5PV310_PA_COREPERI (0x10500000)
54#define S5PV310_PA_GIC_CPU (0x10500100)
55#define S5PV310_PA_TWD (0x10500600)
56#define S5PV310_PA_GIC_DIST (0x10501000)
57#define S5PV310_PA_L2CC (0x10502000)
58
59/* DMA */
60#define S5PV310_PA_MDMA 0x10810000
61#define S5PV310_PA_PDMA0 0x12680000
62#define S5PV310_PA_PDMA1 0x12690000
63
64#define S5PV310_PA_GPIO1 (0x11400000)
65#define S5PV310_PA_GPIO2 (0x11000000)
66#define S5PV310_PA_GPIO3 (0x03860000)
67
68#define S5PV310_PA_MIPI_CSIS0 0x11880000
69#define S5PV310_PA_MIPI_CSIS1 0x11890000
70 37
71#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) 38#define S5PC210_PA_ONENAND 0x0C000000
39#define S5PC210_PA_ONENAND_DMA 0x0C600000
72 40
73#define S5PV310_PA_SROMC (0x12570000) 41#define S5PV310_PA_CHIPID 0x10000000
74#define S5P_PA_SROMC S5PV310_PA_SROMC
75 42
76/* S/PDIF */ 43#define S5PV310_PA_SYSCON 0x10010000
77#define S5PV310_PA_SPDIF 0xE1100000 44#define S5PV310_PA_PMU 0x10020000
45#define S5PV310_PA_CMU 0x10030000
78 46
79/* I2S */ 47#define S5PV310_PA_WATCHDOG 0x10060000
80#define S5PV310_PA_I2S0 0x03830000 48#define S5PV310_PA_RTC 0x10070000
81#define S5PV310_PA_I2S1 0xE3100000
82#define S5PV310_PA_I2S2 0xE2A00000
83 49
84/* PCM */ 50#define S5PV310_PA_DMC0 0x10400000
85#define S5PV310_PA_PCM0 0x03840000
86#define S5PV310_PA_PCM1 0x13980000
87#define S5PV310_PA_PCM2 0x13990000
88 51
89/* AC97 */ 52#define S5PV310_PA_COMBINER 0x10448000
90#define S5PV310_PA_AC97 0x139A0000
91 53
92#define S5PV310_PA_UART (0x13800000) 54#define S5PV310_PA_COREPERI 0x10500000
55#define S5PV310_PA_GIC_CPU 0x10500100
56#define S5PV310_PA_TWD 0x10500600
57#define S5PV310_PA_GIC_DIST 0x10501000
58#define S5PV310_PA_L2CC 0x10502000
93 59
94#define S5P_PA_UART(x) (S5PV310_PA_UART + ((x) * S3C_UART_OFFSET)) 60#define S5PV310_PA_MDMA 0x10810000
95#define S5P_PA_UART0 S5P_PA_UART(0) 61#define S5PV310_PA_PDMA0 0x12680000
96#define S5P_PA_UART1 S5P_PA_UART(1) 62#define S5PV310_PA_PDMA1 0x12690000
97#define S5P_PA_UART2 S5P_PA_UART(2)
98#define S5P_PA_UART3 S5P_PA_UART(3)
99#define S5P_PA_UART4 S5P_PA_UART(4)
100
101#define S5P_SZ_UART SZ_256
102
103#define S5PV310_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
104
105#define S5PV310_PA_TIMER (0x139D0000)
106#define S5P_PA_TIMER S5PV310_PA_TIMER
107
108#define S5PV310_PA_SDRAM (0x40000000)
109#define S5P_PA_SDRAM S5PV310_PA_SDRAM
110 63
111#define S5PV310_PA_SYSMMU_MDMA 0x10A40000 64#define S5PV310_PA_SYSMMU_MDMA 0x10A40000
112#define S5PV310_PA_SYSMMU_SSS 0x10A50000 65#define S5PV310_PA_SYSMMU_SSS 0x10A50000
@@ -124,11 +77,32 @@
124#define S5PV310_PA_SYSMMU_TV 0x12E20000 77#define S5PV310_PA_SYSMMU_TV 0x12E20000
125#define S5PV310_PA_SYSMMU_MFC_L 0x13620000 78#define S5PV310_PA_SYSMMU_MFC_L 0x13620000
126#define S5PV310_PA_SYSMMU_MFC_R 0x13630000 79#define S5PV310_PA_SYSMMU_MFC_R 0x13630000
127#define S5PV310_SYSMMU_TOTAL_IPNUM 16
128#define S5P_SYSMMU_TOTAL_IPNUM S5PV310_SYSMMU_TOTAL_IPNUM
129 80
130/* compatibiltiy defines. */ 81#define S5PV310_PA_GPIO1 0x11400000
131#define S3C_PA_UART S5PV310_PA_UART 82#define S5PV310_PA_GPIO2 0x11000000
83#define S5PV310_PA_GPIO3 0x03860000
84
85#define S5PV310_PA_MIPI_CSIS0 0x11880000
86#define S5PV310_PA_MIPI_CSIS1 0x11890000
87
88#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
89
90#define S5PV310_PA_SROMC 0x12570000
91
92#define S5PV310_PA_UART 0x13800000
93
94#define S5PV310_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
95
96#define S5PV310_PA_AC97 0x139A0000
97
98#define S5PV310_PA_TIMER 0x139D0000
99
100#define S5PV310_PA_SDRAM 0x40000000
101
102#define S5PV310_PA_SPDIF 0xE1100000
103
104/* Compatibiltiy Defines */
105
132#define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0) 106#define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0)
133#define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1) 107#define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1)
134#define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2) 108#define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2)
@@ -143,7 +117,28 @@
143#define S3C_PA_IIC7 S5PV310_PA_IIC(7) 117#define S3C_PA_IIC7 S5PV310_PA_IIC(7)
144#define S3C_PA_RTC S5PV310_PA_RTC 118#define S3C_PA_RTC S5PV310_PA_RTC
145#define S3C_PA_WDT S5PV310_PA_WATCHDOG 119#define S3C_PA_WDT S5PV310_PA_WATCHDOG
120
121#define S5P_PA_CHIPID S5PV310_PA_CHIPID
146#define S5P_PA_MIPI_CSIS0 S5PV310_PA_MIPI_CSIS0 122#define S5P_PA_MIPI_CSIS0 S5PV310_PA_MIPI_CSIS0
147#define S5P_PA_MIPI_CSIS1 S5PV310_PA_MIPI_CSIS1 123#define S5P_PA_MIPI_CSIS1 S5PV310_PA_MIPI_CSIS1
124#define S5P_PA_ONENAND S5PC210_PA_ONENAND
125#define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA
126#define S5P_PA_SDRAM S5PV310_PA_SDRAM
127#define S5P_PA_SROMC S5PV310_PA_SROMC
128#define S5P_PA_SYSCON S5PV310_PA_SYSCON
129#define S5P_PA_TIMER S5PV310_PA_TIMER
130
131/* UART */
132
133#define S3C_PA_UART S5PV310_PA_UART
134
135#define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET))
136#define S5P_PA_UART0 S5P_PA_UART(0)
137#define S5P_PA_UART1 S5P_PA_UART(1)
138#define S5P_PA_UART2 S5P_PA_UART(2)
139#define S5P_PA_UART3 S5P_PA_UART(3)
140#define S5P_PA_UART4 S5P_PA_UART(4)
141
142#define S5P_SZ_UART SZ_256
148 143
149#endif /* __ASM_ARCH_MAP_H */ 144#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/sysmmu.h b/arch/arm/mach-s5pv310/include/mach/sysmmu.h
index 662fe85ff4d5..598fc5c9211b 100644
--- a/arch/arm/mach-s5pv310/include/mach/sysmmu.h
+++ b/arch/arm/mach-s5pv310/include/mach/sysmmu.h
@@ -13,6 +13,9 @@
13#ifndef __ASM_ARM_ARCH_SYSMMU_H 13#ifndef __ASM_ARM_ARCH_SYSMMU_H
14#define __ASM_ARM_ARCH_SYSMMU_H __FILE__ 14#define __ASM_ARM_ARCH_SYSMMU_H __FILE__
15 15
16#define S5PV310_SYSMMU_TOTAL_IPNUM 16
17#define S5P_SYSMMU_TOTAL_IPNUM S5PV310_SYSMMU_TOTAL_IPNUM
18
16enum s5pv310_sysmmu_ips { 19enum s5pv310_sysmmu_ips {
17 SYSMMU_MDMA, 20 SYSMMU_MDMA,
18 SYSMMU_SSS, 21 SYSMMU_SSS,
@@ -32,7 +35,7 @@ enum s5pv310_sysmmu_ips {
32 SYSMMU_MFC_R, 35 SYSMMU_MFC_R,
33}; 36};
34 37
35static char *sysmmu_ips_name[S5P_SYSMMU_TOTAL_IPNUM] = { 38static char *sysmmu_ips_name[S5PV310_SYSMMU_TOTAL_IPNUM] = {
36 "SYSMMU_MDMA" , 39 "SYSMMU_MDMA" ,
37 "SYSMMU_SSS" , 40 "SYSMMU_SSS" ,
38 "SYSMMU_FIMC0" , 41 "SYSMMU_FIMC0" ,
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index d43c5ef58eb6..bd3e1bfdd6aa 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -241,6 +241,9 @@ static struct locomo_platform_data locomo_info = {
241struct platform_device collie_locomo_device = { 241struct platform_device collie_locomo_device = {
242 .name = "locomo", 242 .name = "locomo",
243 .id = 0, 243 .id = 0,
244 .dev = {
245 .platform_data = &locomo_info,
246 },
244 .num_resources = ARRAY_SIZE(locomo_resources), 247 .num_resources = ARRAY_SIZE(locomo_resources),
245 .resource = locomo_resources, 248 .resource = locomo_resources,
246}; 249};
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index ab9fc4470d36..c4661aab22fb 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -32,8 +32,7 @@
32#include <asm/system.h> 32#include <asm/system.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34 34
35extern void sa1100_cpu_suspend(void); 35extern void sa1100_cpu_suspend(long);
36extern void sa1100_cpu_resume(void);
37 36
38#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x 37#define SAVE(x) sleep_save[SLEEP_SAVE_##x] = x
39#define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x] 38#define RESTORE(x) x = sleep_save[SLEEP_SAVE_##x]
@@ -73,10 +72,10 @@ static int sa11x0_pm_enter(suspend_state_t state)
73 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR; 72 RCSR = RCSR_HWR | RCSR_SWR | RCSR_WDR | RCSR_SMR;
74 73
75 /* set resume return address */ 74 /* set resume return address */
76 PSPR = virt_to_phys(sa1100_cpu_resume); 75 PSPR = virt_to_phys(cpu_resume);
77 76
78 /* go zzz */ 77 /* go zzz */
79 sa1100_cpu_suspend(); 78 sa1100_cpu_suspend(PLAT_PHYS_OFFSET - PAGE_OFFSET);
80 79
81 cpu_init(); 80 cpu_init();
82 81
@@ -115,11 +114,6 @@ static int sa11x0_pm_enter(suspend_state_t state)
115 return 0; 114 return 0;
116} 115}
117 116
118unsigned long sleep_phys_sp(void *sp)
119{
120 return virt_to_phys(sp);
121}
122
123static const struct platform_suspend_ops sa11x0_pm_ops = { 117static const struct platform_suspend_ops sa11x0_pm_ops = {
124 .enter = sa11x0_pm_enter, 118 .enter = sa11x0_pm_enter,
125 .valid = suspend_valid_only_mem, 119 .valid = suspend_valid_only_mem,
diff --git a/arch/arm/mach-sa1100/sleep.S b/arch/arm/mach-sa1100/sleep.S
index 80f31bad707c..04f2a618d4ef 100644
--- a/arch/arm/mach-sa1100/sleep.S
+++ b/arch/arm/mach-sa1100/sleep.S
@@ -20,12 +20,7 @@
20#include <asm/assembler.h> 20#include <asm/assembler.h>
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22 22
23
24
25 .text 23 .text
26
27
28
29/* 24/*
30 * sa1100_cpu_suspend() 25 * sa1100_cpu_suspend()
31 * 26 *
@@ -34,27 +29,10 @@
34 */ 29 */
35 30
36ENTRY(sa1100_cpu_suspend) 31ENTRY(sa1100_cpu_suspend)
37
38 stmfd sp!, {r4 - r12, lr} @ save registers on stack 32 stmfd sp!, {r4 - r12, lr} @ save registers on stack
39 33 mov r1, r0
40 @ get coprocessor registers 34 ldr r3, =sa1100_cpu_resume @ return function
41 mrc p15, 0, r4, c3, c0, 0 @ domain ID 35 bl cpu_suspend
42 mrc p15, 0, r5, c2, c0, 0 @ translation table base addr
43 mrc p15, 0, r6, c13, c0, 0 @ PID
44 mrc p15, 0, r7, c1, c0, 0 @ control reg
45
46 @ store them plus current virtual stack ptr on stack
47 mov r8, sp
48 stmfd sp!, {r4 - r8}
49
50 @ preserve phys address of stack
51 mov r0, sp
52 bl sleep_phys_sp
53 ldr r1, =sleep_save_sp
54 str r0, [r1]
55
56 @ clean data cache and invalidate WB
57 bl v4wb_flush_kern_cache_all
58 36
59 @ disable clock switching 37 @ disable clock switching
60 mcr p15, 0, r1, c15, c2, 2 38 mcr p15, 0, r1, c15, c2, 2
@@ -166,50 +144,8 @@ sa1110_sdram_controller_fix:
166 * cpu_sa1100_resume() 144 * cpu_sa1100_resume()
167 * 145 *
168 * entry point from bootloader into kernel during resume 146 * entry point from bootloader into kernel during resume
169 *
170 * Note: Yes, part of the following code is located into the .data section.
171 * This is to allow sleep_save_sp to be accessed with a relative load
172 * while we can't rely on any MMU translation. We could have put
173 * sleep_save_sp in the .text section as well, but some setups might
174 * insist on it to be truly read-only.
175 */ 147 */
176
177 .data
178 .align 5
179ENTRY(sa1100_cpu_resume)
180 mov r0, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
181 msr cpsr_c, r0 @ set SVC, irqs off
182
183 ldr r0, sleep_save_sp @ stack phys addr
184 ldr r2, =resume_after_mmu @ its absolute virtual address
185 ldmfd r0, {r4 - r7, sp} @ CP regs + virt stack ptr
186
187 mov r1, #0
188 mcr p15, 0, r1, c8, c7, 0 @ flush I+D TLBs
189 mcr p15, 0, r1, c7, c7, 0 @ flush I&D cache
190 mcr p15, 0, r1, c9, c0, 0 @ invalidate RB
191 mcr p15, 0, r1, c9, c0, 5 @ allow user space to use RB
192
193 mcr p15, 0, r4, c3, c0, 0 @ domain ID
194 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr
195 mcr p15, 0, r6, c13, c0, 0 @ PID
196 b resume_turn_on_mmu @ cache align execution
197
198 .align 5 148 .align 5
199resume_turn_on_mmu: 149sa1100_cpu_resume:
200 mcr p15, 0, r7, c1, c0, 0 @ turn on MMU, caches, etc.
201 nop
202 mov pc, r2 @ jump to virtual addr
203 nop
204 nop
205 nop
206
207sleep_save_sp:
208 .word 0 @ preserve stack phys ptr here
209
210 .text
211resume_after_mmu:
212 mcr p15, 0, r1, c15, c1, 2 @ enable clock switching 150 mcr p15, 0, r1, c15, c1, 2 @ enable clock switching
213 ldmfd sp!, {r4 - r12, pc} @ return to caller 151 ldmfd sp!, {r4 - r12, pc} @ return to caller
214
215
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index 2123b96b5638..4303a86e6e38 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -454,6 +454,7 @@ static void __init ag5evm_init(void)
454 gpio_direction_output(GPIO_PORT217, 0); 454 gpio_direction_output(GPIO_PORT217, 0);
455 mdelay(1); 455 mdelay(1);
456 gpio_set_value(GPIO_PORT217, 1); 456 gpio_set_value(GPIO_PORT217, 1);
457 mdelay(100);
457 458
458 /* LCD backlight controller */ 459 /* LCD backlight controller */
459 gpio_request(GPIO_PORT235, NULL); /* RESET */ 460 gpio_request(GPIO_PORT235, NULL); /* RESET */
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 3cf0951caa2d..81d6536552a9 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -1303,7 +1303,7 @@ static void __init ap4evb_init(void)
1303 1303
1304 lcdc_info.clock_source = LCDC_CLK_BUS; 1304 lcdc_info.clock_source = LCDC_CLK_BUS;
1305 lcdc_info.ch[0].interface_type = RGB18; 1305 lcdc_info.ch[0].interface_type = RGB18;
1306 lcdc_info.ch[0].clock_divider = 2; 1306 lcdc_info.ch[0].clock_divider = 3;
1307 lcdc_info.ch[0].flags = 0; 1307 lcdc_info.ch[0].flags = 0;
1308 lcdc_info.ch[0].lcd_size_cfg.width = 152; 1308 lcdc_info.ch[0].lcd_size_cfg.width = 152;
1309 lcdc_info.ch[0].lcd_size_cfg.height = 91; 1309 lcdc_info.ch[0].lcd_size_cfg.height = 91;
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index fb4213a4e15a..1657eac5dde2 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -303,7 +303,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
303 .lcd_cfg = mackerel_lcdc_modes, 303 .lcd_cfg = mackerel_lcdc_modes,
304 .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), 304 .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
305 .interface_type = RGB24, 305 .interface_type = RGB24,
306 .clock_divider = 2, 306 .clock_divider = 3,
307 .flags = 0, 307 .flags = 0,
308 .lcd_size_cfg.width = 152, 308 .lcd_size_cfg.width = 152,
309 .lcd_size_cfg.height = 91, 309 .lcd_size_cfg.height = 91,
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c
index ddd4a1b775f0..7e58904c1c8c 100644
--- a/arch/arm/mach-shmobile/clock-sh73a0.c
+++ b/arch/arm/mach-shmobile/clock-sh73a0.c
@@ -263,7 +263,7 @@ static struct clk div6_clks[DIV6_NR] = {
263}; 263};
264 264
265enum { MSTP001, 265enum { MSTP001,
266 MSTP125, MSTP118, MSTP116, MSTP100, 266 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100,
267 MSTP219, 267 MSTP219,
268 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, 268 MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200,
269 MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, 269 MSTP331, MSTP329, MSTP325, MSTP323, MSTP312,
@@ -275,6 +275,10 @@ enum { MSTP001,
275 275
276static struct clk mstp_clks[MSTP_NR] = { 276static struct clk mstp_clks[MSTP_NR] = {
277 [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */ 277 [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */
278 [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* CEU1 */
279 [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* CSI2-RX1 */
280 [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU0 */
281 [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2-RX0 */
278 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ 282 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
279 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */ 283 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */
280 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ 284 [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */
@@ -306,6 +310,9 @@ static struct clk_lookup lookups[] = {
306 CLKDEV_CON_ID("r_clk", &r_clk), 310 CLKDEV_CON_ID("r_clk", &r_clk),
307 311
308 /* DIV6 clocks */ 312 /* DIV6 clocks */
313 CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]),
314 CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]),
315 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
309 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 316 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
310 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 317 CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
311 CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 318 CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
@@ -313,11 +320,15 @@ static struct clk_lookup lookups[] = {
313 320
314 /* MSTP32 clocks */ 321 /* MSTP32 clocks */
315 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ 322 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
316 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ 323 CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */
324 CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */
325 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */
326 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2-RX0 */
317 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ 327 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */
318 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ 328 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */
319 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
320 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ 329 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
330 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
331 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
321 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ 332 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
322 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ 333 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */
323 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ 334 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */
diff --git a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt
index efd3687ba190..3029aba38688 100644
--- a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt
+++ b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt
@@ -6,13 +6,10 @@ LIST "RWT Setting"
6EW 0xE6020004, 0xA500 6EW 0xE6020004, 0xA500
7EW 0xE6030004, 0xA500 7EW 0xE6030004, 0xA500
8 8
9DD 0x01001000, 0x01001000
10
11LIST "GPIO Setting" 9LIST "GPIO Setting"
12EB 0xE6051013, 0xA2 10EB 0xE6051013, 0xA2
13 11
14LIST "CPG" 12LIST "CPG"
15ED 0xE6150080, 0x00000180
16ED 0xE61500C0, 0x00000002 13ED 0xE61500C0, 0x00000002
17 14
18WAIT 1, 0xFE40009C 15WAIT 1, 0xFE40009C
@@ -37,6 +34,9 @@ ED 0xE615002C, 0x93000040
37 34
38WAIT 1, 0xFE40009C 35WAIT 1, 0xFE40009C
39 36
37LIST "SUB/USBClk"
38ED 0xE6150080, 0x00000180
39
40LIST "BSC" 40LIST "BSC"
41ED 0xFEC10000, 0x00E0001B 41ED 0xFEC10000, 0x00E0001B
42 42
@@ -53,7 +53,7 @@ ED 0xFE400048, 0x20C18505
53ED 0xFE40004C, 0x00110209 53ED 0xFE40004C, 0x00110209
54ED 0xFE400010, 0x00000087 54ED 0xFE400010, 0x00000087
55 55
56WAIT 10, 0xFE40009C 56WAIT 30, 0xFE40009C
57 57
58ED 0xFE400084, 0x0000003F 58ED 0xFE400084, 0x0000003F
59EB 0xFE500000, 0x00 59EB 0xFE500000, 0x00
@@ -84,7 +84,7 @@ ED 0xE6150004, 0x80331050
84 84
85WAIT 1, 0xFE40009C 85WAIT 1, 0xFE40009C
86 86
87ED 0xE6150354, 0x00000002 87ED 0xFE400354, 0x01AD8002
88 88
89LIST "SCIF0 - Serial port for earlyprintk" 89LIST "SCIF0 - Serial port for earlyprintk"
90EB 0xE6053098, 0x11 90EB 0xE6053098, 0x11
diff --git a/arch/arm/mach-shmobile/include/mach/head-mackerel.txt b/arch/arm/mach-shmobile/include/mach/head-mackerel.txt
index efd3687ba190..3029aba38688 100644
--- a/arch/arm/mach-shmobile/include/mach/head-mackerel.txt
+++ b/arch/arm/mach-shmobile/include/mach/head-mackerel.txt
@@ -6,13 +6,10 @@ LIST "RWT Setting"
6EW 0xE6020004, 0xA500 6EW 0xE6020004, 0xA500
7EW 0xE6030004, 0xA500 7EW 0xE6030004, 0xA500
8 8
9DD 0x01001000, 0x01001000
10
11LIST "GPIO Setting" 9LIST "GPIO Setting"
12EB 0xE6051013, 0xA2 10EB 0xE6051013, 0xA2
13 11
14LIST "CPG" 12LIST "CPG"
15ED 0xE6150080, 0x00000180
16ED 0xE61500C0, 0x00000002 13ED 0xE61500C0, 0x00000002
17 14
18WAIT 1, 0xFE40009C 15WAIT 1, 0xFE40009C
@@ -37,6 +34,9 @@ ED 0xE615002C, 0x93000040
37 34
38WAIT 1, 0xFE40009C 35WAIT 1, 0xFE40009C
39 36
37LIST "SUB/USBClk"
38ED 0xE6150080, 0x00000180
39
40LIST "BSC" 40LIST "BSC"
41ED 0xFEC10000, 0x00E0001B 41ED 0xFEC10000, 0x00E0001B
42 42
@@ -53,7 +53,7 @@ ED 0xFE400048, 0x20C18505
53ED 0xFE40004C, 0x00110209 53ED 0xFE40004C, 0x00110209
54ED 0xFE400010, 0x00000087 54ED 0xFE400010, 0x00000087
55 55
56WAIT 10, 0xFE40009C 56WAIT 30, 0xFE40009C
57 57
58ED 0xFE400084, 0x0000003F 58ED 0xFE400084, 0x0000003F
59EB 0xFE500000, 0x00 59EB 0xFE500000, 0x00
@@ -84,7 +84,7 @@ ED 0xE6150004, 0x80331050
84 84
85WAIT 1, 0xFE40009C 85WAIT 1, 0xFE40009C
86 86
87ED 0xE6150354, 0x00000002 87ED 0xFE400354, 0x01AD8002
88 88
89LIST "SCIF0 - Serial port for earlyprintk" 89LIST "SCIF0 - Serial port for earlyprintk"
90EB 0xE6053098, 0x11 90EB 0xE6053098, 0x11
diff --git a/arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h b/arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h
new file mode 100644
index 000000000000..a8d02be8d2b6
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/mmcif-ap4eb.h
@@ -0,0 +1,29 @@
1#ifndef MMCIF_AP4EB_H
2#define MMCIF_AP4EB_H
3
4#define PORT185CR (void __iomem *)0xe60520b9
5#define PORT186CR (void __iomem *)0xe60520ba
6#define PORT187CR (void __iomem *)0xe60520bb
7#define PORT188CR (void __iomem *)0xe60520bc
8
9#define PORTR191_160DR (void __iomem *)0xe6056014
10
11static inline void mmcif_init_progress(void)
12{
13 /* Initialise LEDS1-4
14 * registers: PORT185CR-PORT188CR (LED1-LED4 Control)
15 * value: 0x10 - enable output
16 */
17 __raw_writeb(0x10, PORT185CR);
18 __raw_writeb(0x10, PORT186CR);
19 __raw_writeb(0x10, PORT187CR);
20 __raw_writeb(0x10, PORT188CR);
21}
22
23static inline void mmcif_update_progress(int n)
24{
25 __raw_writel((__raw_readl(PORTR191_160DR) & ~(0xf << 25)) |
26 (1 << (25 + n)), PORTR191_160DR);
27}
28
29#endif /* MMCIF_AP4EB_H */
diff --git a/arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h b/arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h
new file mode 100644
index 000000000000..4b4f6949a868
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/mmcif-mackerel.h
@@ -0,0 +1,39 @@
1#ifndef MMCIF_MACKEREL_H
2#define MMCIF_MACKEREL_H
3
4#define PORT0CR (void __iomem *)0xe6051000
5#define PORT1CR (void __iomem *)0xe6051001
6#define PORT2CR (void __iomem *)0xe6051002
7#define PORT159CR (void __iomem *)0xe605009f
8
9#define PORTR031_000DR (void __iomem *)0xe6055000
10#define PORTL159_128DR (void __iomem *)0xe6054010
11
12static inline void mmcif_init_progress(void)
13{
14 /* Initialise LEDS0-3
15 * registers: PORT0CR-PORT2CR,PORT159CR (LED0-LED3 Control)
16 * value: 0x10 - enable output
17 */
18 __raw_writeb(0x10, PORT0CR);
19 __raw_writeb(0x10, PORT1CR);
20 __raw_writeb(0x10, PORT2CR);
21 __raw_writeb(0x10, PORT159CR);
22}
23
24static inline void mmcif_update_progress(int n)
25{
26 unsigned a = 0, b = 0;
27
28 if (n < 3)
29 a = 1 << n;
30 else
31 b = 1 << 31;
32
33 __raw_writel((__raw_readl(PORTR031_000DR) & ~0x7) | a,
34 PORTR031_000DR);
35 __raw_writel((__raw_readl(PORTL159_128DR) & ~(1 << 31)) | b,
36 PORTL159_128DR);
37}
38
39#endif /* MMCIF_MACKEREL_H */
diff --git a/arch/arm/mach-shmobile/include/mach/mmcif.h b/arch/arm/mach-shmobile/include/mach/mmcif.h
new file mode 100644
index 000000000000..f4dc3279cf03
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/mmcif.h
@@ -0,0 +1,18 @@
1#ifndef MMCIF_H
2#define MMCIF_H
3
4/**************************************************
5 *
6 * board specific settings
7 *
8 **************************************************/
9
10#ifdef CONFIG_MACH_AP4EVB
11#include "mach/mmcif-ap4eb.h"
12#elif CONFIG_MACH_MACKEREL
13#include "mach/mmcif-mackerel.h"
14#else
15#error "unsupported board."
16#endif
17
18#endif /* MMCIF_H */
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 18febf92f20a..98bc7edc95a6 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -13,8 +13,8 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <mach/misc_regs.h>
17#include <plat/clock.h> 16#include <plat/clock.h>
17#include <mach/misc_regs.h>
18 18
19/* root clks */ 19/* root clks */
20/* 32 KHz oscillator clock */ 20/* 32 KHz oscillator clock */
@@ -39,18 +39,43 @@ static struct clk rtc_clk = {
39}; 39};
40 40
41/* clock derived from 24 MHz osc clk */ 41/* clock derived from 24 MHz osc clk */
42/* pll masks structure */
43static struct pll_clk_masks pll1_masks = {
44 .mode_mask = PLL_MODE_MASK,
45 .mode_shift = PLL_MODE_SHIFT,
46 .norm_fdbk_m_mask = PLL_NORM_FDBK_M_MASK,
47 .norm_fdbk_m_shift = PLL_NORM_FDBK_M_SHIFT,
48 .dith_fdbk_m_mask = PLL_DITH_FDBK_M_MASK,
49 .dith_fdbk_m_shift = PLL_DITH_FDBK_M_SHIFT,
50 .div_p_mask = PLL_DIV_P_MASK,
51 .div_p_shift = PLL_DIV_P_SHIFT,
52 .div_n_mask = PLL_DIV_N_MASK,
53 .div_n_shift = PLL_DIV_N_SHIFT,
54};
55
42/* pll1 configuration structure */ 56/* pll1 configuration structure */
43static struct pll_clk_config pll1_config = { 57static struct pll_clk_config pll1_config = {
44 .mode_reg = PLL1_CTR, 58 .mode_reg = PLL1_CTR,
45 .cfg_reg = PLL1_FRQ, 59 .cfg_reg = PLL1_FRQ,
60 .masks = &pll1_masks,
61};
62
63/* pll rate configuration table, in ascending order of rates */
64struct pll_rate_tbl pll_rtbl[] = {
65 {.mode = 0, .m = 0x85, .n = 0x0C, .p = 0x1}, /* 266 MHz */
66 {.mode = 0, .m = 0xA6, .n = 0x0C, .p = 0x1}, /* 332 MHz */
46}; 67};
47 68
48/* PLL1 clock */ 69/* PLL1 clock */
49static struct clk pll1_clk = { 70static struct clk pll1_clk = {
71 .flags = ENABLED_ON_INIT,
50 .pclk = &osc_24m_clk, 72 .pclk = &osc_24m_clk,
51 .en_reg = PLL1_CTR, 73 .en_reg = PLL1_CTR,
52 .en_reg_bit = PLL_ENABLE, 74 .en_reg_bit = PLL_ENABLE,
53 .recalc = &pll1_clk_recalc, 75 .calc_rate = &pll_calc_rate,
76 .recalc = &pll_clk_recalc,
77 .set_rate = &pll_clk_set_rate,
78 .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1},
54 .private_data = &pll1_config, 79 .private_data = &pll1_config,
55}; 80};
56 81
@@ -76,36 +101,83 @@ static struct clk cpu_clk = {
76 .recalc = &follow_parent, 101 .recalc = &follow_parent,
77}; 102};
78 103
104/* ahb masks structure */
105static struct bus_clk_masks ahb_masks = {
106 .mask = PLL_HCLK_RATIO_MASK,
107 .shift = PLL_HCLK_RATIO_SHIFT,
108};
109
79/* ahb configuration structure */ 110/* ahb configuration structure */
80static struct bus_clk_config ahb_config = { 111static struct bus_clk_config ahb_config = {
81 .reg = CORE_CLK_CFG, 112 .reg = CORE_CLK_CFG,
82 .mask = PLL_HCLK_RATIO_MASK, 113 .masks = &ahb_masks,
83 .shift = PLL_HCLK_RATIO_SHIFT, 114};
115
116/* ahb rate configuration table, in ascending order of rates */
117struct bus_rate_tbl bus_rtbl[] = {
118 {.div = 3}, /* == parent divided by 4 */
119 {.div = 2}, /* == parent divided by 3 */
120 {.div = 1}, /* == parent divided by 2 */
121 {.div = 0}, /* == parent divided by 1 */
84}; 122};
85 123
86/* ahb clock */ 124/* ahb clock */
87static struct clk ahb_clk = { 125static struct clk ahb_clk = {
88 .flags = ALWAYS_ENABLED, 126 .flags = ALWAYS_ENABLED,
89 .pclk = &pll1_clk, 127 .pclk = &pll1_clk,
128 .calc_rate = &bus_calc_rate,
90 .recalc = &bus_clk_recalc, 129 .recalc = &bus_clk_recalc,
130 .set_rate = &bus_clk_set_rate,
131 .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2},
91 .private_data = &ahb_config, 132 .private_data = &ahb_config,
92}; 133};
93 134
94/* uart configurations */ 135/* auxiliary synthesizers masks */
95static struct aux_clk_config uart_config = { 136static struct aux_clk_masks aux_masks = {
137 .eq_sel_mask = AUX_EQ_SEL_MASK,
138 .eq_sel_shift = AUX_EQ_SEL_SHIFT,
139 .eq1_mask = AUX_EQ1_SEL,
140 .eq2_mask = AUX_EQ2_SEL,
141 .xscale_sel_mask = AUX_XSCALE_MASK,
142 .xscale_sel_shift = AUX_XSCALE_SHIFT,
143 .yscale_sel_mask = AUX_YSCALE_MASK,
144 .yscale_sel_shift = AUX_YSCALE_SHIFT,
145};
146
147/* uart synth configurations */
148static struct aux_clk_config uart_synth_config = {
96 .synth_reg = UART_CLK_SYNT, 149 .synth_reg = UART_CLK_SYNT,
150 .masks = &aux_masks,
151};
152
153/* aux rate configuration table, in ascending order of rates */
154struct aux_rate_tbl aux_rtbl[] = {
155 /* For PLL1 = 332 MHz */
156 {.xscale = 1, .yscale = 8, .eq = 1}, /* 41.5 MHz */
157 {.xscale = 1, .yscale = 4, .eq = 1}, /* 83 MHz */
158 {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */
159};
160
161/* uart synth clock */
162static struct clk uart_synth_clk = {
163 .en_reg = UART_CLK_SYNT,
164 .en_reg_bit = AUX_SYNT_ENB,
165 .pclk = &pll1_clk,
166 .calc_rate = &aux_calc_rate,
167 .recalc = &aux_clk_recalc,
168 .set_rate = &aux_clk_set_rate,
169 .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 1},
170 .private_data = &uart_synth_config,
97}; 171};
98 172
99/* uart parents */ 173/* uart parents */
100static struct pclk_info uart_pclk_info[] = { 174static struct pclk_info uart_pclk_info[] = {
101 { 175 {
102 .pclk = &pll1_clk, 176 .pclk = &uart_synth_clk,
103 .pclk_mask = AUX_CLK_PLL1_MASK, 177 .pclk_val = AUX_CLK_PLL1_VAL,
104 .scalable = 1,
105 }, { 178 }, {
106 .pclk = &pll3_48m_clk, 179 .pclk = &pll3_48m_clk,
107 .pclk_mask = AUX_CLK_PLL3_MASK, 180 .pclk_val = AUX_CLK_PLL3_VAL,
108 .scalable = 0,
109 }, 181 },
110}; 182};
111 183
@@ -123,25 +195,35 @@ static struct clk uart_clk = {
123 .en_reg_bit = UART_CLK_ENB, 195 .en_reg_bit = UART_CLK_ENB,
124 .pclk_sel = &uart_pclk_sel, 196 .pclk_sel = &uart_pclk_sel,
125 .pclk_sel_shift = UART_CLK_SHIFT, 197 .pclk_sel_shift = UART_CLK_SHIFT,
126 .recalc = &aux_clk_recalc, 198 .recalc = &follow_parent,
127 .private_data = &uart_config,
128}; 199};
129 200
130/* firda configurations */ 201/* firda configurations */
131static struct aux_clk_config firda_config = { 202static struct aux_clk_config firda_synth_config = {
132 .synth_reg = FIRDA_CLK_SYNT, 203 .synth_reg = FIRDA_CLK_SYNT,
204 .masks = &aux_masks,
205};
206
207/* firda synth clock */
208static struct clk firda_synth_clk = {
209 .en_reg = FIRDA_CLK_SYNT,
210 .en_reg_bit = AUX_SYNT_ENB,
211 .pclk = &pll1_clk,
212 .calc_rate = &aux_calc_rate,
213 .recalc = &aux_clk_recalc,
214 .set_rate = &aux_clk_set_rate,
215 .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 1},
216 .private_data = &firda_synth_config,
133}; 217};
134 218
135/* firda parents */ 219/* firda parents */
136static struct pclk_info firda_pclk_info[] = { 220static struct pclk_info firda_pclk_info[] = {
137 { 221 {
138 .pclk = &pll1_clk, 222 .pclk = &firda_synth_clk,
139 .pclk_mask = AUX_CLK_PLL1_MASK, 223 .pclk_val = AUX_CLK_PLL1_VAL,
140 .scalable = 1,
141 }, { 224 }, {
142 .pclk = &pll3_48m_clk, 225 .pclk = &pll3_48m_clk,
143 .pclk_mask = AUX_CLK_PLL3_MASK, 226 .pclk_val = AUX_CLK_PLL3_VAL,
144 .scalable = 0,
145 }, 227 },
146}; 228};
147 229
@@ -159,73 +241,155 @@ static struct clk firda_clk = {
159 .en_reg_bit = FIRDA_CLK_ENB, 241 .en_reg_bit = FIRDA_CLK_ENB,
160 .pclk_sel = &firda_pclk_sel, 242 .pclk_sel = &firda_pclk_sel,
161 .pclk_sel_shift = FIRDA_CLK_SHIFT, 243 .pclk_sel_shift = FIRDA_CLK_SHIFT,
162 .recalc = &aux_clk_recalc, 244 .recalc = &follow_parent,
163 .private_data = &firda_config, 245};
246
247/* gpt synthesizer masks */
248static struct gpt_clk_masks gpt_masks = {
249 .mscale_sel_mask = GPT_MSCALE_MASK,
250 .mscale_sel_shift = GPT_MSCALE_SHIFT,
251 .nscale_sel_mask = GPT_NSCALE_MASK,
252 .nscale_sel_shift = GPT_NSCALE_SHIFT,
253};
254
255/* gpt rate configuration table, in ascending order of rates */
256struct gpt_rate_tbl gpt_rtbl[] = {
257 /* For pll1 = 332 MHz */
258 {.mscale = 4, .nscale = 0}, /* 41.5 MHz */
259 {.mscale = 2, .nscale = 0}, /* 55.3 MHz */
260 {.mscale = 1, .nscale = 0}, /* 83 MHz */
261};
262
263/* gpt0 synth clk config*/
264static struct gpt_clk_config gpt0_synth_config = {
265 .synth_reg = PRSC1_CLK_CFG,
266 .masks = &gpt_masks,
267};
268
269/* gpt synth clock */
270static struct clk gpt0_synth_clk = {
271 .flags = ALWAYS_ENABLED,
272 .pclk = &pll1_clk,
273 .calc_rate = &gpt_calc_rate,
274 .recalc = &gpt_clk_recalc,
275 .set_rate = &gpt_clk_set_rate,
276 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
277 .private_data = &gpt0_synth_config,
164}; 278};
165 279
166/* gpt parents */ 280/* gpt parents */
167static struct pclk_info gpt_pclk_info[] = { 281static struct pclk_info gpt0_pclk_info[] = {
168 { 282 {
169 .pclk = &pll1_clk, 283 .pclk = &gpt0_synth_clk,
170 .pclk_mask = AUX_CLK_PLL1_MASK, 284 .pclk_val = AUX_CLK_PLL1_VAL,
171 .scalable = 1,
172 }, { 285 }, {
173 .pclk = &pll3_48m_clk, 286 .pclk = &pll3_48m_clk,
174 .pclk_mask = AUX_CLK_PLL3_MASK, 287 .pclk_val = AUX_CLK_PLL3_VAL,
175 .scalable = 0,
176 }, 288 },
177}; 289};
178 290
179/* gpt parent select structure */ 291/* gpt parent select structure */
180static struct pclk_sel gpt_pclk_sel = { 292static struct pclk_sel gpt0_pclk_sel = {
181 .pclk_info = gpt_pclk_info, 293 .pclk_info = gpt0_pclk_info,
182 .pclk_count = ARRAY_SIZE(gpt_pclk_info), 294 .pclk_count = ARRAY_SIZE(gpt0_pclk_info),
183 .pclk_sel_reg = PERIP_CLK_CFG, 295 .pclk_sel_reg = PERIP_CLK_CFG,
184 .pclk_sel_mask = GPT_CLK_MASK, 296 .pclk_sel_mask = GPT_CLK_MASK,
185}; 297};
186 298
187/* gpt0 configurations */
188static struct aux_clk_config gpt0_config = {
189 .synth_reg = PRSC1_CLK_CFG,
190};
191
192/* gpt0 timer clock */ 299/* gpt0 timer clock */
193static struct clk gpt0_clk = { 300static struct clk gpt0_clk = {
194 .flags = ALWAYS_ENABLED, 301 .flags = ALWAYS_ENABLED,
195 .pclk_sel = &gpt_pclk_sel, 302 .pclk_sel = &gpt0_pclk_sel,
196 .pclk_sel_shift = GPT0_CLK_SHIFT, 303 .pclk_sel_shift = GPT0_CLK_SHIFT,
197 .recalc = &gpt_clk_recalc, 304 .recalc = &follow_parent,
198 .private_data = &gpt0_config,
199}; 305};
200 306
201/* gpt1 configurations */ 307/* gpt1 synth clk configurations */
202static struct aux_clk_config gpt1_config = { 308static struct gpt_clk_config gpt1_synth_config = {
203 .synth_reg = PRSC2_CLK_CFG, 309 .synth_reg = PRSC2_CLK_CFG,
310 .masks = &gpt_masks,
311};
312
313/* gpt1 synth clock */
314static struct clk gpt1_synth_clk = {
315 .flags = ALWAYS_ENABLED,
316 .pclk = &pll1_clk,
317 .calc_rate = &gpt_calc_rate,
318 .recalc = &gpt_clk_recalc,
319 .set_rate = &gpt_clk_set_rate,
320 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
321 .private_data = &gpt1_synth_config,
322};
323
324static struct pclk_info gpt1_pclk_info[] = {
325 {
326 .pclk = &gpt1_synth_clk,
327 .pclk_val = AUX_CLK_PLL1_VAL,
328 }, {
329 .pclk = &pll3_48m_clk,
330 .pclk_val = AUX_CLK_PLL3_VAL,
331 },
332};
333
334/* gpt parent select structure */
335static struct pclk_sel gpt1_pclk_sel = {
336 .pclk_info = gpt1_pclk_info,
337 .pclk_count = ARRAY_SIZE(gpt1_pclk_info),
338 .pclk_sel_reg = PERIP_CLK_CFG,
339 .pclk_sel_mask = GPT_CLK_MASK,
204}; 340};
205 341
206/* gpt1 timer clock */ 342/* gpt1 timer clock */
207static struct clk gpt1_clk = { 343static struct clk gpt1_clk = {
208 .en_reg = PERIP1_CLK_ENB, 344 .en_reg = PERIP1_CLK_ENB,
209 .en_reg_bit = GPT1_CLK_ENB, 345 .en_reg_bit = GPT1_CLK_ENB,
210 .pclk_sel = &gpt_pclk_sel, 346 .pclk_sel = &gpt1_pclk_sel,
211 .pclk_sel_shift = GPT1_CLK_SHIFT, 347 .pclk_sel_shift = GPT1_CLK_SHIFT,
212 .recalc = &gpt_clk_recalc, 348 .recalc = &follow_parent,
213 .private_data = &gpt1_config,
214}; 349};
215 350
216/* gpt2 configurations */ 351/* gpt2 synth clk configurations */
217static struct aux_clk_config gpt2_config = { 352static struct gpt_clk_config gpt2_synth_config = {
218 .synth_reg = PRSC3_CLK_CFG, 353 .synth_reg = PRSC3_CLK_CFG,
354 .masks = &gpt_masks,
355};
356
357/* gpt1 synth clock */
358static struct clk gpt2_synth_clk = {
359 .flags = ALWAYS_ENABLED,
360 .pclk = &pll1_clk,
361 .calc_rate = &gpt_calc_rate,
362 .recalc = &gpt_clk_recalc,
363 .set_rate = &gpt_clk_set_rate,
364 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
365 .private_data = &gpt2_synth_config,
366};
367
368static struct pclk_info gpt2_pclk_info[] = {
369 {
370 .pclk = &gpt2_synth_clk,
371 .pclk_val = AUX_CLK_PLL1_VAL,
372 }, {
373 .pclk = &pll3_48m_clk,
374 .pclk_val = AUX_CLK_PLL3_VAL,
375 },
376};
377
378/* gpt parent select structure */
379static struct pclk_sel gpt2_pclk_sel = {
380 .pclk_info = gpt2_pclk_info,
381 .pclk_count = ARRAY_SIZE(gpt2_pclk_info),
382 .pclk_sel_reg = PERIP_CLK_CFG,
383 .pclk_sel_mask = GPT_CLK_MASK,
219}; 384};
220 385
221/* gpt2 timer clock */ 386/* gpt2 timer clock */
222static struct clk gpt2_clk = { 387static struct clk gpt2_clk = {
223 .en_reg = PERIP1_CLK_ENB, 388 .en_reg = PERIP1_CLK_ENB,
224 .en_reg_bit = GPT2_CLK_ENB, 389 .en_reg_bit = GPT2_CLK_ENB,
225 .pclk_sel = &gpt_pclk_sel, 390 .pclk_sel = &gpt2_pclk_sel,
226 .pclk_sel_shift = GPT2_CLK_SHIFT, 391 .pclk_sel_shift = GPT2_CLK_SHIFT,
227 .recalc = &gpt_clk_recalc, 392 .recalc = &follow_parent,
228 .private_data = &gpt2_config,
229}; 393};
230 394
231/* clock derived from pll3 clk */ 395/* clock derived from pll3 clk */
@@ -245,26 +409,27 @@ static struct clk usbd_clk = {
245 .recalc = &follow_parent, 409 .recalc = &follow_parent,
246}; 410};
247 411
248/* clcd clock */ 412/* clock derived from ahb clk */
249static struct clk clcd_clk = { 413/* apb masks structure */
250 .flags = ALWAYS_ENABLED, 414static struct bus_clk_masks apb_masks = {
251 .pclk = &pll3_48m_clk, 415 .mask = HCLK_PCLK_RATIO_MASK,
252 .recalc = &follow_parent, 416 .shift = HCLK_PCLK_RATIO_SHIFT,
253}; 417};
254 418
255/* clock derived from ahb clk */
256/* apb configuration structure */ 419/* apb configuration structure */
257static struct bus_clk_config apb_config = { 420static struct bus_clk_config apb_config = {
258 .reg = CORE_CLK_CFG, 421 .reg = CORE_CLK_CFG,
259 .mask = HCLK_PCLK_RATIO_MASK, 422 .masks = &apb_masks,
260 .shift = HCLK_PCLK_RATIO_SHIFT,
261}; 423};
262 424
263/* apb clock */ 425/* apb clock */
264static struct clk apb_clk = { 426static struct clk apb_clk = {
265 .flags = ALWAYS_ENABLED, 427 .flags = ALWAYS_ENABLED,
266 .pclk = &ahb_clk, 428 .pclk = &ahb_clk,
429 .calc_rate = &bus_calc_rate,
267 .recalc = &bus_clk_recalc, 430 .recalc = &bus_clk_recalc,
431 .set_rate = &bus_clk_set_rate,
432 .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2},
268 .private_data = &apb_config, 433 .private_data = &apb_config,
269}; 434};
270 435
@@ -325,8 +490,17 @@ static struct clk adc_clk = {
325 .recalc = &follow_parent, 490 .recalc = &follow_parent,
326}; 491};
327 492
493#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
494/* emi clock */
495static struct clk emi_clk = {
496 .flags = ALWAYS_ENABLED,
497 .pclk = &ahb_clk,
498 .recalc = &follow_parent,
499};
500#endif
501
328/* ssp clock */ 502/* ssp clock */
329static struct clk ssp_clk = { 503static struct clk ssp0_clk = {
330 .pclk = &apb_clk, 504 .pclk = &apb_clk,
331 .en_reg = PERIP1_CLK_ENB, 505 .en_reg = PERIP1_CLK_ENB,
332 .en_reg_bit = SSP_CLK_ENB, 506 .en_reg_bit = SSP_CLK_ENB,
@@ -343,14 +517,145 @@ static struct clk gpio_clk = {
343 517
344static struct clk dummy_apb_pclk; 518static struct clk dummy_apb_pclk;
345 519
520#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR310) || \
521 defined(CONFIG_MACH_SPEAR320)
522/* fsmc clock */
523static struct clk fsmc_clk = {
524 .flags = ALWAYS_ENABLED,
525 .pclk = &ahb_clk,
526 .recalc = &follow_parent,
527};
528#endif
529
530/* common clocks to spear310 and spear320 */
531#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
532/* uart1 clock */
533static struct clk uart1_clk = {
534 .flags = ALWAYS_ENABLED,
535 .pclk = &apb_clk,
536 .recalc = &follow_parent,
537};
538
539/* uart2 clock */
540static struct clk uart2_clk = {
541 .flags = ALWAYS_ENABLED,
542 .pclk = &apb_clk,
543 .recalc = &follow_parent,
544};
545#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
546
547/* common clocks to spear300 and spear320 */
548#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR320)
549/* clcd clock */
550static struct clk clcd_clk = {
551 .flags = ALWAYS_ENABLED,
552 .pclk = &pll3_48m_clk,
553 .recalc = &follow_parent,
554};
555
556/* sdhci clock */
557static struct clk sdhci_clk = {
558 .flags = ALWAYS_ENABLED,
559 .pclk = &ahb_clk,
560 .recalc = &follow_parent,
561};
562#endif /* CONFIG_MACH_SPEAR300 || CONFIG_MACH_SPEAR320 */
563
564/* spear300 machine specific clock structures */
565#ifdef CONFIG_MACH_SPEAR300
566/* gpio1 clock */
567static struct clk gpio1_clk = {
568 .flags = ALWAYS_ENABLED,
569 .pclk = &apb_clk,
570 .recalc = &follow_parent,
571};
572
573/* keyboard clock */
574static struct clk kbd_clk = {
575 .flags = ALWAYS_ENABLED,
576 .pclk = &apb_clk,
577 .recalc = &follow_parent,
578};
579
580#endif
581
582/* spear310 machine specific clock structures */
583#ifdef CONFIG_MACH_SPEAR310
584/* uart3 clock */
585static struct clk uart3_clk = {
586 .flags = ALWAYS_ENABLED,
587 .pclk = &apb_clk,
588 .recalc = &follow_parent,
589};
590
591/* uart4 clock */
592static struct clk uart4_clk = {
593 .flags = ALWAYS_ENABLED,
594 .pclk = &apb_clk,
595 .recalc = &follow_parent,
596};
597
598/* uart5 clock */
599static struct clk uart5_clk = {
600 .flags = ALWAYS_ENABLED,
601 .pclk = &apb_clk,
602 .recalc = &follow_parent,
603};
604#endif
605
606/* spear320 machine specific clock structures */
607#ifdef CONFIG_MACH_SPEAR320
608/* can0 clock */
609static struct clk can0_clk = {
610 .flags = ALWAYS_ENABLED,
611 .pclk = &apb_clk,
612 .recalc = &follow_parent,
613};
614
615/* can1 clock */
616static struct clk can1_clk = {
617 .flags = ALWAYS_ENABLED,
618 .pclk = &apb_clk,
619 .recalc = &follow_parent,
620};
621
622/* i2c1 clock */
623static struct clk i2c1_clk = {
624 .flags = ALWAYS_ENABLED,
625 .pclk = &ahb_clk,
626 .recalc = &follow_parent,
627};
628
629/* ssp1 clock */
630static struct clk ssp1_clk = {
631 .flags = ALWAYS_ENABLED,
632 .pclk = &apb_clk,
633 .recalc = &follow_parent,
634};
635
636/* ssp2 clock */
637static struct clk ssp2_clk = {
638 .flags = ALWAYS_ENABLED,
639 .pclk = &apb_clk,
640 .recalc = &follow_parent,
641};
642
643/* pwm clock */
644static struct clk pwm_clk = {
645 .flags = ALWAYS_ENABLED,
646 .pclk = &apb_clk,
647 .recalc = &follow_parent,
648};
649#endif
650
346/* array of all spear 3xx clock lookups */ 651/* array of all spear 3xx clock lookups */
347static struct clk_lookup spear_clk_lookups[] = { 652static struct clk_lookup spear_clk_lookups[] = {
348 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 653 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
349 /* root clks */ 654 /* root clks */
350 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 655 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
351 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk}, 656 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk},
352 /* clock derived from 32 KHz osc clk */ 657 /* clock derived from 32 KHz osc clk */
353 { .dev_id = "rtc", .clk = &rtc_clk}, 658 { .dev_id = "rtc-spear", .clk = &rtc_clk},
354 /* clock derived from 24 MHz osc clk */ 659 /* clock derived from 24 MHz osc clk */
355 { .con_id = "pll1_clk", .clk = &pll1_clk}, 660 { .con_id = "pll1_clk", .clk = &pll1_clk},
356 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 661 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk},
@@ -358,18 +663,22 @@ static struct clk_lookup spear_clk_lookups[] = {
358 /* clock derived from pll1 clk */ 663 /* clock derived from pll1 clk */
359 { .con_id = "cpu_clk", .clk = &cpu_clk}, 664 { .con_id = "cpu_clk", .clk = &cpu_clk},
360 { .con_id = "ahb_clk", .clk = &ahb_clk}, 665 { .con_id = "ahb_clk", .clk = &ahb_clk},
666 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk},
667 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk},
668 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk},
669 { .con_id = "gpt1_synth_clk", .clk = &gpt1_synth_clk},
670 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk},
361 { .dev_id = "uart", .clk = &uart_clk}, 671 { .dev_id = "uart", .clk = &uart_clk},
362 { .dev_id = "firda", .clk = &firda_clk}, 672 { .dev_id = "firda", .clk = &firda_clk},
363 { .dev_id = "gpt0", .clk = &gpt0_clk}, 673 { .dev_id = "gpt0", .clk = &gpt0_clk},
364 { .dev_id = "gpt1", .clk = &gpt1_clk}, 674 { .dev_id = "gpt1", .clk = &gpt1_clk},
365 { .dev_id = "gpt2", .clk = &gpt2_clk}, 675 { .dev_id = "gpt2", .clk = &gpt2_clk},
366 /* clock derived from pll3 clk */ 676 /* clock derived from pll3 clk */
367 { .dev_id = "usbh", .clk = &usbh_clk}, 677 { .dev_id = "designware_udc", .clk = &usbd_clk},
368 { .dev_id = "usbd", .clk = &usbd_clk}, 678 { .con_id = "usbh_clk", .clk = &usbh_clk},
369 { .dev_id = "clcd", .clk = &clcd_clk},
370 /* clock derived from ahb clk */ 679 /* clock derived from ahb clk */
371 { .con_id = "apb_clk", .clk = &apb_clk}, 680 { .con_id = "apb_clk", .clk = &apb_clk},
372 { .dev_id = "i2c", .clk = &i2c_clk}, 681 { .dev_id = "i2c_designware.0", .clk = &i2c_clk},
373 { .dev_id = "dma", .clk = &dma_clk}, 682 { .dev_id = "dma", .clk = &dma_clk},
374 { .dev_id = "jpeg", .clk = &jpeg_clk}, 683 { .dev_id = "jpeg", .clk = &jpeg_clk},
375 { .dev_id = "gmac", .clk = &gmac_clk}, 684 { .dev_id = "gmac", .clk = &gmac_clk},
@@ -377,8 +686,50 @@ static struct clk_lookup spear_clk_lookups[] = {
377 { .dev_id = "c3", .clk = &c3_clk}, 686 { .dev_id = "c3", .clk = &c3_clk},
378 /* clock derived from apb clk */ 687 /* clock derived from apb clk */
379 { .dev_id = "adc", .clk = &adc_clk}, 688 { .dev_id = "adc", .clk = &adc_clk},
380 { .dev_id = "ssp", .clk = &ssp_clk}, 689 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk},
381 { .dev_id = "gpio", .clk = &gpio_clk}, 690 { .dev_id = "gpio", .clk = &gpio_clk},
691#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
692 { .dev_id = "physmap-flash", .clk = &emi_clk},
693#endif
694#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR310) || \
695 defined(CONFIG_MACH_SPEAR320)
696 { .con_id = "fsmc", .clk = &fsmc_clk},
697#endif
698
699/* common clocks to spear310 and spear320 */
700#if defined(CONFIG_MACH_SPEAR310) || defined(CONFIG_MACH_SPEAR320)
701 { .dev_id = "uart1", .clk = &uart1_clk},
702 { .dev_id = "uart2", .clk = &uart2_clk},
703#endif
704
705 /* common clock to spear300 and spear320 */
706#if defined(CONFIG_MACH_SPEAR300) || defined(CONFIG_MACH_SPEAR320)
707 { .dev_id = "clcd", .clk = &clcd_clk},
708 { .dev_id = "sdhci", .clk = &sdhci_clk},
709#endif /* CONFIG_MACH_SPEAR300 || CONFIG_MACH_SPEAR320 */
710
711 /* spear300 machine specific clock structures */
712#ifdef CONFIG_MACH_SPEAR300
713 { .dev_id = "gpio1", .clk = &gpio1_clk},
714 { .dev_id = "keyboard", .clk = &kbd_clk},
715#endif
716
717 /* spear310 machine specific clock structures */
718#ifdef CONFIG_MACH_SPEAR310
719 { .dev_id = "uart3", .clk = &uart3_clk},
720 { .dev_id = "uart4", .clk = &uart4_clk},
721 { .dev_id = "uart5", .clk = &uart5_clk},
722
723#endif
724 /* spear320 machine specific clock structures */
725#ifdef CONFIG_MACH_SPEAR320
726 { .dev_id = "c_can_platform.0", .clk = &can0_clk},
727 { .dev_id = "c_can_platform.1", .clk = &can1_clk},
728 { .dev_id = "i2c_designware.1", .clk = &i2c1_clk},
729 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk},
730 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk},
731 { .dev_id = "pwm", .clk = &pwm_clk},
732#endif
382}; 733};
383 734
384void __init clk_init(void) 735void __init clk_init(void)
diff --git a/arch/arm/mach-spear3xx/include/mach/entry-macro.S b/arch/arm/mach-spear3xx/include/mach/entry-macro.S
index 947625d6b48d..53da4224ba3d 100644
--- a/arch/arm/mach-spear3xx/include/mach/entry-macro.S
+++ b/arch/arm/mach-spear3xx/include/mach/entry-macro.S
@@ -11,9 +11,8 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <mach/hardware.h>
15#include <mach/spear.h>
16#include <asm/hardware/vic.h> 14#include <asm/hardware/vic.h>
15#include <mach/hardware.h>
17 16
18 .macro disable_fiq 17 .macro disable_fiq
19 .endm 18 .endm
diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h
index af7e02c909a3..8e30636909ef 100644
--- a/arch/arm/mach-spear3xx/include/mach/generic.h
+++ b/arch/arm/mach-spear3xx/include/mach/generic.h
@@ -14,11 +14,11 @@
14#ifndef __MACH_GENERIC_H 14#ifndef __MACH_GENERIC_H
15#define __MACH_GENERIC_H 15#define __MACH_GENERIC_H
16 16
17#include <asm/mach/time.h>
18#include <asm/mach/map.h>
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/platform_device.h> 18#include <linux/platform_device.h>
21#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
20#include <asm/mach/time.h>
21#include <asm/mach/map.h>
22#include <plat/padmux.h> 22#include <plat/padmux.h>
23 23
24/* spear3xx declarations */ 24/* spear3xx declarations */
@@ -33,14 +33,14 @@
33/* Add spear3xx family device structure declarations here */ 33/* Add spear3xx family device structure declarations here */
34extern struct amba_device gpio_device; 34extern struct amba_device gpio_device;
35extern struct amba_device uart_device; 35extern struct amba_device uart_device;
36extern struct sys_timer spear_sys_timer; 36extern struct sys_timer spear3xx_timer;
37 37
38/* Add spear3xx family function declarations here */ 38/* Add spear3xx family function declarations here */
39void __init clk_init(void); 39void __init clk_init(void);
40void __init spear_setup_timer(void);
40void __init spear3xx_map_io(void); 41void __init spear3xx_map_io(void);
41void __init spear3xx_init_irq(void); 42void __init spear3xx_init_irq(void);
42void __init spear3xx_init(void); 43void __init spear3xx_init(void);
43void spear_pmx_init(struct pmx_driver *pmx_driver, uint base, uint size);
44 44
45/* pad mux declarations */ 45/* pad mux declarations */
46#define PMX_FIRDA_MASK (1 << 14) 46#define PMX_FIRDA_MASK (1 << 14)
@@ -129,12 +129,10 @@ extern struct pmx_dev pmx_telecom_camera;
129extern struct pmx_dev pmx_telecom_dac; 129extern struct pmx_dev pmx_telecom_dac;
130extern struct pmx_dev pmx_telecom_i2s; 130extern struct pmx_dev pmx_telecom_i2s;
131extern struct pmx_dev pmx_telecom_boot_pins; 131extern struct pmx_dev pmx_telecom_boot_pins;
132extern struct pmx_dev pmx_telecom_sdio_4bit; 132extern struct pmx_dev pmx_telecom_sdhci_4bit;
133extern struct pmx_dev pmx_telecom_sdio_8bit; 133extern struct pmx_dev pmx_telecom_sdhci_8bit;
134extern struct pmx_dev pmx_gpio1; 134extern struct pmx_dev pmx_gpio1;
135 135
136void spear300_pmx_init(void);
137
138/* Add spear300 machine function declarations here */ 136/* Add spear300 machine function declarations here */
139void __init spear300_init(void); 137void __init spear300_init(void);
140 138
@@ -154,8 +152,6 @@ extern struct pmx_dev pmx_fsmc;
154extern struct pmx_dev pmx_rs485_0_1; 152extern struct pmx_dev pmx_rs485_0_1;
155extern struct pmx_dev pmx_tdm0; 153extern struct pmx_dev pmx_tdm0;
156 154
157void spear310_pmx_init(void);
158
159/* Add spear310 machine function declarations here */ 155/* Add spear310 machine function declarations here */
160void __init spear310_init(void); 156void __init spear310_init(void);
161 157
@@ -176,14 +172,14 @@ extern struct pmx_dev pmx_clcd;
176extern struct pmx_dev pmx_emi; 172extern struct pmx_dev pmx_emi;
177extern struct pmx_dev pmx_fsmc; 173extern struct pmx_dev pmx_fsmc;
178extern struct pmx_dev pmx_spp; 174extern struct pmx_dev pmx_spp;
179extern struct pmx_dev pmx_sdio; 175extern struct pmx_dev pmx_sdhci;
180extern struct pmx_dev pmx_i2s; 176extern struct pmx_dev pmx_i2s;
181extern struct pmx_dev pmx_uart1; 177extern struct pmx_dev pmx_uart1;
182extern struct pmx_dev pmx_uart1_modem; 178extern struct pmx_dev pmx_uart1_modem;
183extern struct pmx_dev pmx_uart2; 179extern struct pmx_dev pmx_uart2;
184extern struct pmx_dev pmx_touchscreen; 180extern struct pmx_dev pmx_touchscreen;
185extern struct pmx_dev pmx_can; 181extern struct pmx_dev pmx_can;
186extern struct pmx_dev pmx_sdio_led; 182extern struct pmx_dev pmx_sdhci_led;
187extern struct pmx_dev pmx_pwm0; 183extern struct pmx_dev pmx_pwm0;
188extern struct pmx_dev pmx_pwm1; 184extern struct pmx_dev pmx_pwm1;
189extern struct pmx_dev pmx_pwm2; 185extern struct pmx_dev pmx_pwm2;
@@ -195,8 +191,6 @@ extern struct pmx_dev pmx_smii0;
195extern struct pmx_dev pmx_smii1; 191extern struct pmx_dev pmx_smii1;
196extern struct pmx_dev pmx_i2c1; 192extern struct pmx_dev pmx_i2c1;
197 193
198void spear320_pmx_init(void);
199
200/* Add spear320 machine function declarations here */ 194/* Add spear320 machine function declarations here */
201void __init spear320_init(void); 195void __init spear320_init(void);
202 196
diff --git a/arch/arm/mach-spear3xx/include/mach/hardware.h b/arch/arm/mach-spear3xx/include/mach/hardware.h
index 4a86e6a3c444..4660c0d8ec0d 100644
--- a/arch/arm/mach-spear3xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear3xx/include/mach/hardware.h
@@ -14,6 +14,9 @@
14#ifndef __MACH_HARDWARE_H 14#ifndef __MACH_HARDWARE_H
15#define __MACH_HARDWARE_H 15#define __MACH_HARDWARE_H
16 16
17#include <plat/hardware.h>
18#include <mach/spear.h>
19
17/* Vitual to physical translation of statically mapped space */ 20/* Vitual to physical translation of statically mapped space */
18#define IO_ADDRESS(x) (x | 0xF0000000) 21#define IO_ADDRESS(x) (x | 0xF0000000)
19 22
diff --git a/arch/arm/mach-spear3xx/include/mach/irqs.h b/arch/arm/mach-spear3xx/include/mach/irqs.h
index 7f940b818473..a1a7f481866d 100644
--- a/arch/arm/mach-spear3xx/include/mach/irqs.h
+++ b/arch/arm/mach-spear3xx/include/mach/irqs.h
@@ -69,7 +69,7 @@
69#define IRQ_CLCD IRQ_GEN_RAS_3 69#define IRQ_CLCD IRQ_GEN_RAS_3
70 70
71/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */ 71/* IRQs sharing IRQ_INTRCOMM_RAS_ARM */
72#define IRQ_SDIO IRQ_INTRCOMM_RAS_ARM 72#define IRQ_SDHCI IRQ_INTRCOMM_RAS_ARM
73 73
74/* GPIO pins virtual irqs */ 74/* GPIO pins virtual irqs */
75#define SPEAR_GPIO_INT_BASE (VIRQ_START + 9) 75#define SPEAR_GPIO_INT_BASE (VIRQ_START + 9)
@@ -115,7 +115,7 @@
115#define VIRQ_SPP (VIRQ_START + 2) 115#define VIRQ_SPP (VIRQ_START + 2)
116 116
117/* IRQs sharing IRQ_GEN_RAS_2 */ 117/* IRQs sharing IRQ_GEN_RAS_2 */
118#define IRQ_SDIO IRQ_GEN_RAS_2 118#define IRQ_SDHCI IRQ_GEN_RAS_2
119 119
120/* IRQs sharing IRQ_GEN_RAS_3 */ 120/* IRQs sharing IRQ_GEN_RAS_3 */
121#define VIRQ_PLGPIO (VIRQ_START + 3) 121#define VIRQ_PLGPIO (VIRQ_START + 3)
diff --git a/arch/arm/mach-spear3xx/include/mach/misc_regs.h b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
index 38d767a1aba0..5bd8cd8d4852 100644
--- a/arch/arm/mach-spear3xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear3xx/include/mach/misc_regs.h
@@ -14,16 +14,16 @@
14#ifndef __MACH_MISC_REGS_H 14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H 15#define __MACH_MISC_REGS_H
16 16
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19#define MISC_BASE VA_SPEAR3XX_ICM3_MISC_REG_BASE 19#define MISC_BASE IOMEM(VA_SPEAR3XX_ICM3_MISC_REG_BASE)
20 20
21#define SOC_CFG_CTR ((unsigned int *)(MISC_BASE + 0x000)) 21#define SOC_CFG_CTR (MISC_BASE + 0x000)
22#define DIAG_CFG_CTR ((unsigned int *)(MISC_BASE + 0x004)) 22#define DIAG_CFG_CTR (MISC_BASE + 0x004)
23#define PLL1_CTR ((unsigned int *)(MISC_BASE + 0x008)) 23#define PLL1_CTR (MISC_BASE + 0x008)
24#define PLL1_FRQ ((unsigned int *)(MISC_BASE + 0x00C)) 24#define PLL1_FRQ (MISC_BASE + 0x00C)
25#define PLL1_MOD ((unsigned int *)(MISC_BASE + 0x010)) 25#define PLL1_MOD (MISC_BASE + 0x010)
26#define PLL2_CTR ((unsigned int *)(MISC_BASE + 0x014)) 26#define PLL2_CTR (MISC_BASE + 0x014)
27/* PLL_CTR register masks */ 27/* PLL_CTR register masks */
28#define PLL_ENABLE 2 28#define PLL_ENABLE 2
29#define PLL_MODE_SHIFT 4 29#define PLL_MODE_SHIFT 4
@@ -33,7 +33,7 @@
33#define PLL_MODE_DITH_DSB 2 33#define PLL_MODE_DITH_DSB 2
34#define PLL_MODE_DITH_SSB 3 34#define PLL_MODE_DITH_SSB 3
35 35
36#define PLL2_FRQ ((unsigned int *)(MISC_BASE + 0x018)) 36#define PLL2_FRQ (MISC_BASE + 0x018)
37/* PLL FRQ register masks */ 37/* PLL FRQ register masks */
38#define PLL_DIV_N_SHIFT 0 38#define PLL_DIV_N_SHIFT 0
39#define PLL_DIV_N_MASK 0xFF 39#define PLL_DIV_N_MASK 0xFF
@@ -44,16 +44,16 @@
44#define PLL_DITH_FDBK_M_SHIFT 16 44#define PLL_DITH_FDBK_M_SHIFT 16
45#define PLL_DITH_FDBK_M_MASK 0xFFFF 45#define PLL_DITH_FDBK_M_MASK 0xFFFF
46 46
47#define PLL2_MOD ((unsigned int *)(MISC_BASE + 0x01C)) 47#define PLL2_MOD (MISC_BASE + 0x01C)
48#define PLL_CLK_CFG ((unsigned int *)(MISC_BASE + 0x020)) 48#define PLL_CLK_CFG (MISC_BASE + 0x020)
49#define CORE_CLK_CFG ((unsigned int *)(MISC_BASE + 0x024)) 49#define CORE_CLK_CFG (MISC_BASE + 0x024)
50/* CORE CLK CFG register masks */ 50/* CORE CLK CFG register masks */
51#define PLL_HCLK_RATIO_SHIFT 10 51#define PLL_HCLK_RATIO_SHIFT 10
52#define PLL_HCLK_RATIO_MASK 0x3 52#define PLL_HCLK_RATIO_MASK 0x3
53#define HCLK_PCLK_RATIO_SHIFT 8 53#define HCLK_PCLK_RATIO_SHIFT 8
54#define HCLK_PCLK_RATIO_MASK 0x3 54#define HCLK_PCLK_RATIO_MASK 0x3
55 55
56#define PERIP_CLK_CFG ((unsigned int *)(MISC_BASE + 0x028)) 56#define PERIP_CLK_CFG (MISC_BASE + 0x028)
57/* PERIP_CLK_CFG register masks */ 57/* PERIP_CLK_CFG register masks */
58#define UART_CLK_SHIFT 4 58#define UART_CLK_SHIFT 4
59#define UART_CLK_MASK 0x1 59#define UART_CLK_MASK 0x1
@@ -63,10 +63,10 @@
63#define GPT1_CLK_SHIFT 11 63#define GPT1_CLK_SHIFT 11
64#define GPT2_CLK_SHIFT 12 64#define GPT2_CLK_SHIFT 12
65#define GPT_CLK_MASK 0x1 65#define GPT_CLK_MASK 0x1
66#define AUX_CLK_PLL3_MASK 0 66#define AUX_CLK_PLL3_VAL 0
67#define AUX_CLK_PLL1_MASK 1 67#define AUX_CLK_PLL1_VAL 1
68 68
69#define PERIP1_CLK_ENB ((unsigned int *)(MISC_BASE + 0x02C)) 69#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
70/* PERIP1_CLK_ENB register masks */ 70/* PERIP1_CLK_ENB register masks */
71#define UART_CLK_ENB 3 71#define UART_CLK_ENB 3
72#define SSP_CLK_ENB 5 72#define SSP_CLK_ENB 5
@@ -85,34 +85,35 @@
85#define USBH_CLK_ENB 25 85#define USBH_CLK_ENB 25
86#define C3_CLK_ENB 31 86#define C3_CLK_ENB 31
87 87
88#define SOC_CORE_ID ((unsigned int *)(MISC_BASE + 0x030)) 88#define SOC_CORE_ID (MISC_BASE + 0x030)
89#define RAS_CLK_ENB ((unsigned int *)(MISC_BASE + 0x034)) 89#define RAS_CLK_ENB (MISC_BASE + 0x034)
90#define PERIP1_SOF_RST ((unsigned int *)(MISC_BASE + 0x038)) 90#define PERIP1_SOF_RST (MISC_BASE + 0x038)
91/* PERIP1_SOF_RST register masks */ 91/* PERIP1_SOF_RST register masks */
92#define JPEG_SOF_RST 8 92#define JPEG_SOF_RST 8
93 93
94#define SOC_USER_ID ((unsigned int *)(MISC_BASE + 0x03C)) 94#define SOC_USER_ID (MISC_BASE + 0x03C)
95#define RAS_SOF_RST ((unsigned int *)(MISC_BASE + 0x040)) 95#define RAS_SOF_RST (MISC_BASE + 0x040)
96#define PRSC1_CLK_CFG ((unsigned int *)(MISC_BASE + 0x044)) 96#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
97#define PRSC2_CLK_CFG ((unsigned int *)(MISC_BASE + 0x048)) 97#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
98#define PRSC3_CLK_CFG ((unsigned int *)(MISC_BASE + 0x04C)) 98#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
99/* gpt synthesizer register masks */ 99/* gpt synthesizer register masks */
100#define GPT_MSCALE_SHIFT 0 100#define GPT_MSCALE_SHIFT 0
101#define GPT_MSCALE_MASK 0xFFF 101#define GPT_MSCALE_MASK 0xFFF
102#define GPT_NSCALE_SHIFT 12 102#define GPT_NSCALE_SHIFT 12
103#define GPT_NSCALE_MASK 0xF 103#define GPT_NSCALE_MASK 0xF
104 104
105#define AMEM_CLK_CFG ((unsigned int *)(MISC_BASE + 0x050)) 105#define AMEM_CLK_CFG (MISC_BASE + 0x050)
106#define EXPI_CLK_CFG ((unsigned int *)(MISC_BASE + 0x054)) 106#define EXPI_CLK_CFG (MISC_BASE + 0x054)
107#define CLCD_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x05C)) 107#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
108#define FIRDA_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x060)) 108#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
109#define UART_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x064)) 109#define UART_CLK_SYNT (MISC_BASE + 0x064)
110#define GMAC_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x068)) 110#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
111#define RAS1_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x06C)) 111#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
112#define RAS2_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x070)) 112#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
113#define RAS3_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x074)) 113#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
114#define RAS4_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x078)) 114#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
115/* aux clk synthesiser register masks for irda to ras4 */ 115/* aux clk synthesiser register masks for irda to ras4 */
116#define AUX_SYNT_ENB 31
116#define AUX_EQ_SEL_SHIFT 30 117#define AUX_EQ_SEL_SHIFT 30
117#define AUX_EQ_SEL_MASK 1 118#define AUX_EQ_SEL_MASK 1
118#define AUX_EQ1_SEL 0 119#define AUX_EQ1_SEL 0
@@ -122,42 +123,42 @@
122#define AUX_YSCALE_SHIFT 0 123#define AUX_YSCALE_SHIFT 0
123#define AUX_YSCALE_MASK 0xFFF 124#define AUX_YSCALE_MASK 0xFFF
124 125
125#define ICM1_ARB_CFG ((unsigned int *)(MISC_BASE + 0x07C)) 126#define ICM1_ARB_CFG (MISC_BASE + 0x07C)
126#define ICM2_ARB_CFG ((unsigned int *)(MISC_BASE + 0x080)) 127#define ICM2_ARB_CFG (MISC_BASE + 0x080)
127#define ICM3_ARB_CFG ((unsigned int *)(MISC_BASE + 0x084)) 128#define ICM3_ARB_CFG (MISC_BASE + 0x084)
128#define ICM4_ARB_CFG ((unsigned int *)(MISC_BASE + 0x088)) 129#define ICM4_ARB_CFG (MISC_BASE + 0x088)
129#define ICM5_ARB_CFG ((unsigned int *)(MISC_BASE + 0x08C)) 130#define ICM5_ARB_CFG (MISC_BASE + 0x08C)
130#define ICM6_ARB_CFG ((unsigned int *)(MISC_BASE + 0x090)) 131#define ICM6_ARB_CFG (MISC_BASE + 0x090)
131#define ICM7_ARB_CFG ((unsigned int *)(MISC_BASE + 0x094)) 132#define ICM7_ARB_CFG (MISC_BASE + 0x094)
132#define ICM8_ARB_CFG ((unsigned int *)(MISC_BASE + 0x098)) 133#define ICM8_ARB_CFG (MISC_BASE + 0x098)
133#define ICM9_ARB_CFG ((unsigned int *)(MISC_BASE + 0x09C)) 134#define ICM9_ARB_CFG (MISC_BASE + 0x09C)
134#define DMA_CHN_CFG ((unsigned int *)(MISC_BASE + 0x0A0)) 135#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
135#define USB2_PHY_CFG ((unsigned int *)(MISC_BASE + 0x0A4)) 136#define USB2_PHY_CFG (MISC_BASE + 0x0A4)
136#define GMAC_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0A8)) 137#define GMAC_CFG_CTR (MISC_BASE + 0x0A8)
137#define EXPI_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0AC)) 138#define EXPI_CFG_CTR (MISC_BASE + 0x0AC)
138#define PRC1_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0C0)) 139#define PRC1_LOCK_CTR (MISC_BASE + 0x0C0)
139#define PRC2_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0C4)) 140#define PRC2_LOCK_CTR (MISC_BASE + 0x0C4)
140#define PRC3_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0C8)) 141#define PRC3_LOCK_CTR (MISC_BASE + 0x0C8)
141#define PRC4_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0CC)) 142#define PRC4_LOCK_CTR (MISC_BASE + 0x0CC)
142#define PRC1_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0D0)) 143#define PRC1_IRQ_CTR (MISC_BASE + 0x0D0)
143#define PRC2_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0D4)) 144#define PRC2_IRQ_CTR (MISC_BASE + 0x0D4)
144#define PRC3_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0D8)) 145#define PRC3_IRQ_CTR (MISC_BASE + 0x0D8)
145#define PRC4_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0DC)) 146#define PRC4_IRQ_CTR (MISC_BASE + 0x0DC)
146#define PWRDOWN_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0E0)) 147#define PWRDOWN_CFG_CTR (MISC_BASE + 0x0E0)
147#define COMPSSTL_1V8_CFG ((unsigned int *)(MISC_BASE + 0x0E4)) 148#define COMPSSTL_1V8_CFG (MISC_BASE + 0x0E4)
148#define COMPSSTL_2V5_CFG ((unsigned int *)(MISC_BASE + 0x0E8)) 149#define COMPSSTL_2V5_CFG (MISC_BASE + 0x0E8)
149#define COMPCOR_3V3_CFG ((unsigned int *)(MISC_BASE + 0x0EC)) 150#define COMPCOR_3V3_CFG (MISC_BASE + 0x0EC)
150#define SSTLPAD_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0F0)) 151#define SSTLPAD_CFG_CTR (MISC_BASE + 0x0F0)
151#define BIST1_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0F4)) 152#define BIST1_CFG_CTR (MISC_BASE + 0x0F4)
152#define BIST2_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0F8)) 153#define BIST2_CFG_CTR (MISC_BASE + 0x0F8)
153#define BIST3_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0FC)) 154#define BIST3_CFG_CTR (MISC_BASE + 0x0FC)
154#define BIST4_CFG_CTR ((unsigned int *)(MISC_BASE + 0x100)) 155#define BIST4_CFG_CTR (MISC_BASE + 0x100)
155#define BIST5_CFG_CTR ((unsigned int *)(MISC_BASE + 0x104)) 156#define BIST5_CFG_CTR (MISC_BASE + 0x104)
156#define BIST1_STS_RES ((unsigned int *)(MISC_BASE + 0x108)) 157#define BIST1_STS_RES (MISC_BASE + 0x108)
157#define BIST2_STS_RES ((unsigned int *)(MISC_BASE + 0x10C)) 158#define BIST2_STS_RES (MISC_BASE + 0x10C)
158#define BIST3_STS_RES ((unsigned int *)(MISC_BASE + 0x110)) 159#define BIST3_STS_RES (MISC_BASE + 0x110)
159#define BIST4_STS_RES ((unsigned int *)(MISC_BASE + 0x114)) 160#define BIST4_STS_RES (MISC_BASE + 0x114)
160#define BIST5_STS_RES ((unsigned int *)(MISC_BASE + 0x118)) 161#define BIST5_STS_RES (MISC_BASE + 0x118)
161#define SYSERR_CFG_CTR ((unsigned int *)(MISC_BASE + 0x11C)) 162#define SYSERR_CFG_CTR (MISC_BASE + 0x11C)
162 163
163#endif /* __MACH_MISC_REGS_H */ 164#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear3xx/include/mach/spear.h b/arch/arm/mach-spear3xx/include/mach/spear.h
index dcca8568a486..63fd98356919 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear.h
@@ -14,124 +14,61 @@
14#ifndef __MACH_SPEAR3XX_H 14#ifndef __MACH_SPEAR3XX_H
15#define __MACH_SPEAR3XX_H 15#define __MACH_SPEAR3XX_H
16 16
17#include <mach/hardware.h> 17#include <asm/memory.h>
18#include <mach/spear300.h> 18#include <mach/spear300.h>
19#include <mach/spear310.h> 19#include <mach/spear310.h>
20#include <mach/spear320.h> 20#include <mach/spear320.h>
21 21
22#define SPEAR3XX_ML_SDRAM_BASE 0x00000000 22#define SPEAR3XX_ML_SDRAM_BASE UL(0x00000000)
23#define SPEAR3XX_ML_SDRAM_SIZE 0x40000000
24 23
25#define SPEAR3XX_ICM9_BASE 0xC0000000 24#define SPEAR3XX_ICM9_BASE UL(0xC0000000)
26#define SPEAR3XX_ICM9_SIZE 0x10000000
27 25
28/* ICM1 - Low speed connection */ 26/* ICM1 - Low speed connection */
29#define SPEAR3XX_ICM1_2_BASE 0xD0000000 27#define SPEAR3XX_ICM1_2_BASE UL(0xD0000000)
30#define SPEAR3XX_ICM1_2_SIZE 0x10000000 28#define SPEAR3XX_ICM1_UART_BASE UL(0xD0000000)
31
32#define SPEAR3XX_ICM1_UART_BASE 0xD0000000
33#define VA_SPEAR3XX_ICM1_UART_BASE IO_ADDRESS(SPEAR3XX_ICM1_UART_BASE) 29#define VA_SPEAR3XX_ICM1_UART_BASE IO_ADDRESS(SPEAR3XX_ICM1_UART_BASE)
34#define SPEAR3XX_ICM1_UART_SIZE 0x00080000 30#define SPEAR3XX_ICM1_ADC_BASE UL(0xD0080000)
35 31#define SPEAR3XX_ICM1_SSP_BASE UL(0xD0100000)
36#define SPEAR3XX_ICM1_ADC_BASE 0xD0080000 32#define SPEAR3XX_ICM1_I2C_BASE UL(0xD0180000)
37#define SPEAR3XX_ICM1_ADC_SIZE 0x00080000 33#define SPEAR3XX_ICM1_JPEG_BASE UL(0xD0800000)
38 34#define SPEAR3XX_ICM1_IRDA_BASE UL(0xD1000000)
39#define SPEAR3XX_ICM1_SSP_BASE 0xD0100000 35#define SPEAR3XX_ICM1_SRAM_BASE UL(0xD2800000)
40#define SPEAR3XX_ICM1_SSP_SIZE 0x00080000
41
42#define SPEAR3XX_ICM1_I2C_BASE 0xD0180000
43#define SPEAR3XX_ICM1_I2C_SIZE 0x00080000
44
45#define SPEAR3XX_ICM1_JPEG_BASE 0xD0800000
46#define SPEAR3XX_ICM1_JPEG_SIZE 0x00800000
47
48#define SPEAR3XX_ICM1_IRDA_BASE 0xD1000000
49#define SPEAR3XX_ICM1_IRDA_SIZE 0x00080000
50
51#define SPEAR3XX_ICM1_SRAM_BASE 0xD2800000
52#define SPEAR3XX_ICM1_SRAM_SIZE 0x05800000
53 36
54/* ICM2 - Application Subsystem */ 37/* ICM2 - Application Subsystem */
55#define SPEAR3XX_ICM2_HWACCEL0_BASE 0xD8800000 38#define SPEAR3XX_ICM2_HWACCEL0_BASE UL(0xD8800000)
56#define SPEAR3XX_ICM2_HWACCEL0_SIZE 0x00800000 39#define SPEAR3XX_ICM2_HWACCEL1_BASE UL(0xD9000000)
57
58#define SPEAR3XX_ICM2_HWACCEL1_BASE 0xD9000000
59#define SPEAR3XX_ICM2_HWACCEL1_SIZE 0x00800000
60 40
61/* ICM4 - High Speed Connection */ 41/* ICM4 - High Speed Connection */
62#define SPEAR3XX_ICM4_BASE 0xE0000000 42#define SPEAR3XX_ICM4_BASE UL(0xE0000000)
63#define SPEAR3XX_ICM4_SIZE 0x08000000 43#define SPEAR3XX_ICM4_MII_BASE UL(0xE0800000)
64 44#define SPEAR3XX_ICM4_USBD_FIFO_BASE UL(0xE1000000)
65#define SPEAR3XX_ICM4_MII_BASE 0xE0800000 45#define SPEAR3XX_ICM4_USBD_CSR_BASE UL(0xE1100000)
66#define SPEAR3XX_ICM4_MII_SIZE 0x00800000 46#define SPEAR3XX_ICM4_USBD_PLDT_BASE UL(0xE1200000)
67 47#define SPEAR3XX_ICM4_USB_EHCI0_1_BASE UL(0xE1800000)
68#define SPEAR3XX_ICM4_USBD_FIFO_BASE 0xE1000000 48#define SPEAR3XX_ICM4_USB_OHCI0_BASE UL(0xE1900000)
69#define SPEAR3XX_ICM4_USBD_FIFO_SIZE 0x00100000 49#define SPEAR3XX_ICM4_USB_OHCI1_BASE UL(0xE2100000)
70 50#define SPEAR3XX_ICM4_USB_ARB_BASE UL(0xE2800000)
71#define SPEAR3XX_ICM4_USBD_CSR_BASE 0xE1100000
72#define SPEAR3XX_ICM4_USBD_CSR_SIZE 0x00100000
73
74#define SPEAR3XX_ICM4_USBD_PLDT_BASE 0xE1200000
75#define SPEAR3XX_ICM4_USBD_PLDT_SIZE 0x00100000
76
77#define SPEAR3XX_ICM4_USB_EHCI0_1_BASE 0xE1800000
78#define SPEAR3XX_ICM4_USB_EHCI0_1_SIZE 0x00100000
79
80#define SPEAR3XX_ICM4_USB_OHCI0_BASE 0xE1900000
81#define SPEAR3XX_ICM4_USB_OHCI0_SIZE 0x00100000
82
83#define SPEAR3XX_ICM4_USB_OHCI1_BASE 0xE2100000
84#define SPEAR3XX_ICM4_USB_OHCI1_SIZE 0x00100000
85
86#define SPEAR3XX_ICM4_USB_ARB_BASE 0xE2800000
87#define SPEAR3XX_ICM4_USB_ARB_SIZE 0x00010000
88 51
89/* ML1 - Multi Layer CPU Subsystem */ 52/* ML1 - Multi Layer CPU Subsystem */
90#define SPEAR3XX_ICM3_ML1_2_BASE 0xF0000000 53#define SPEAR3XX_ICM3_ML1_2_BASE UL(0xF0000000)
91#define SPEAR3XX_ICM3_ML1_2_SIZE 0x0F000000 54#define SPEAR3XX_ML1_TMR_BASE UL(0xF0000000)
92 55#define SPEAR3XX_ML1_VIC_BASE UL(0xF1100000)
93#define SPEAR3XX_ML1_TMR_BASE 0xF0000000
94#define SPEAR3XX_ML1_TMR_SIZE 0x00100000
95
96#define SPEAR3XX_ML1_VIC_BASE 0xF1100000
97#define VA_SPEAR3XX_ML1_VIC_BASE IO_ADDRESS(SPEAR3XX_ML1_VIC_BASE) 56#define VA_SPEAR3XX_ML1_VIC_BASE IO_ADDRESS(SPEAR3XX_ML1_VIC_BASE)
98#define SPEAR3XX_ML1_VIC_SIZE 0x00100000
99 57
100/* ICM3 - Basic Subsystem */ 58/* ICM3 - Basic Subsystem */
101#define SPEAR3XX_ICM3_SMEM_BASE 0xF8000000 59#define SPEAR3XX_ICM3_SMEM_BASE UL(0xF8000000)
102#define SPEAR3XX_ICM3_SMEM_SIZE 0x04000000 60#define SPEAR3XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
103 61#define SPEAR3XX_ICM3_DMA_BASE UL(0xFC400000)
104#define SPEAR3XX_ICM3_SMI_CTRL_BASE 0xFC000000 62#define SPEAR3XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
105#define SPEAR3XX_ICM3_SMI_CTRL_SIZE 0x00200000 63#define SPEAR3XX_ICM3_TMR0_BASE UL(0xFC800000)
106 64#define SPEAR3XX_ICM3_WDT_BASE UL(0xFC880000)
107#define SPEAR3XX_ICM3_DMA_BASE 0xFC400000 65#define SPEAR3XX_ICM3_RTC_BASE UL(0xFC900000)
108#define SPEAR3XX_ICM3_DMA_SIZE 0x00200000 66#define SPEAR3XX_ICM3_GPIO_BASE UL(0xFC980000)
109 67#define SPEAR3XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
110#define SPEAR3XX_ICM3_SDRAM_CTRL_BASE 0xFC600000
111#define SPEAR3XX_ICM3_SDRAM_CTRL_SIZE 0x00200000
112
113#define SPEAR3XX_ICM3_TMR0_BASE 0xFC800000
114#define SPEAR3XX_ICM3_TMR0_SIZE 0x00080000
115
116#define SPEAR3XX_ICM3_WDT_BASE 0xFC880000
117#define SPEAR3XX_ICM3_WDT_SIZE 0x00080000
118
119#define SPEAR3XX_ICM3_RTC_BASE 0xFC900000
120#define SPEAR3XX_ICM3_RTC_SIZE 0x00080000
121
122#define SPEAR3XX_ICM3_GPIO_BASE 0xFC980000
123#define SPEAR3XX_ICM3_GPIO_SIZE 0x00080000
124
125#define SPEAR3XX_ICM3_SYS_CTRL_BASE 0xFCA00000
126#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR3XX_ICM3_SYS_CTRL_BASE) 68#define VA_SPEAR3XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR3XX_ICM3_SYS_CTRL_BASE)
127#define SPEAR3XX_ICM3_SYS_CTRL_SIZE 0x00080000 69#define SPEAR3XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
128
129#define SPEAR3XX_ICM3_MISC_REG_BASE 0xFCA80000
130#define VA_SPEAR3XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR3XX_ICM3_MISC_REG_BASE) 70#define VA_SPEAR3XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR3XX_ICM3_MISC_REG_BASE)
131#define SPEAR3XX_ICM3_MISC_REG_SIZE 0x00080000 71#define SPEAR3XX_ICM3_TMR1_BASE UL(0xFCB00000)
132
133#define SPEAR3XX_ICM3_TMR1_BASE 0xFCB00000
134#define SPEAR3XX_ICM3_TMR1_SIZE 0x00080000
135 72
136/* Debug uart for linux, will be used for debug and uncompress messages */ 73/* Debug uart for linux, will be used for debug and uncompress messages */
137#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE 74#define SPEAR_DBG_UART_BASE SPEAR3XX_ICM1_UART_BASE
diff --git a/arch/arm/mach-spear3xx/include/mach/spear300.h b/arch/arm/mach-spear3xx/include/mach/spear300.h
index ccaa76522ee2..c723515f8853 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear300.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear300.h
@@ -17,11 +17,9 @@
17#define __MACH_SPEAR300_H 17#define __MACH_SPEAR300_H
18 18
19/* Base address of various IPs */ 19/* Base address of various IPs */
20#define SPEAR300_TELECOM_BASE 0x50000000 20#define SPEAR300_TELECOM_BASE UL(0x50000000)
21#define SPEAR300_TELECOM_SIZE 0x10000000
22 21
23/* Interrupt registers offsets and masks */ 22/* Interrupt registers offsets and masks */
24#define SPEAR300_TELECOM_REG_SIZE 0x00010000
25#define INT_ENB_MASK_REG 0x54 23#define INT_ENB_MASK_REG 0x54
26#define INT_STS_MASK_REG 0x58 24#define INT_STS_MASK_REG 0x58
27#define IT_PERS_S_IRQ_MASK (1 << 0) 25#define IT_PERS_S_IRQ_MASK (1 << 0)
@@ -36,47 +34,20 @@
36 34
37#define SHIRQ_RAS1_MASK 0x1FF 35#define SHIRQ_RAS1_MASK 0x1FF
38 36
39#define SPEAR300_CLCD_BASE 0x60000000 37#define SPEAR300_CLCD_BASE UL(0x60000000)
40#define SPEAR300_CLCD_SIZE 0x10000000 38#define SPEAR300_SDHCI_BASE UL(0x70000000)
41 39#define SPEAR300_NAND_0_BASE UL(0x80000000)
42#define SPEAR300_SDIO_BASE 0x70000000 40#define SPEAR300_NAND_1_BASE UL(0x84000000)
43#define SPEAR300_SDIO_SIZE 0x10000000 41#define SPEAR300_NAND_2_BASE UL(0x88000000)
44 42#define SPEAR300_NAND_3_BASE UL(0x8c000000)
45#define SPEAR300_NAND_0_BASE 0x80000000 43#define SPEAR300_NOR_0_BASE UL(0x90000000)
46#define SPEAR300_NAND_0_SIZE 0x04000000 44#define SPEAR300_NOR_1_BASE UL(0x91000000)
47 45#define SPEAR300_NOR_2_BASE UL(0x92000000)
48#define SPEAR300_NAND_1_BASE 0x84000000 46#define SPEAR300_NOR_3_BASE UL(0x93000000)
49#define SPEAR300_NAND_1_SIZE 0x04000000 47#define SPEAR300_FSMC_BASE UL(0x94000000)
50 48#define SPEAR300_SOC_CONFIG_BASE UL(0x99000000)
51#define SPEAR300_NAND_2_BASE 0x88000000 49#define SPEAR300_KEYBOARD_BASE UL(0xA0000000)
52#define SPEAR300_NAND_2_SIZE 0x04000000 50#define SPEAR300_GPIO_BASE UL(0xA9000000)
53
54#define SPEAR300_NAND_3_BASE 0x8c000000
55#define SPEAR300_NAND_3_SIZE 0x04000000
56
57#define SPEAR300_NOR_0_BASE 0x90000000
58#define SPEAR300_NOR_0_SIZE 0x01000000
59
60#define SPEAR300_NOR_1_BASE 0x91000000
61#define SPEAR300_NOR_1_SIZE 0x01000000
62
63#define SPEAR300_NOR_2_BASE 0x92000000
64#define SPEAR300_NOR_2_SIZE 0x01000000
65
66#define SPEAR300_NOR_3_BASE 0x93000000
67#define SPEAR300_NOR_3_SIZE 0x01000000
68
69#define SPEAR300_FSMC_BASE 0x94000000
70#define SPEAR300_FSMC_SIZE 0x05000000
71
72#define SPEAR300_SOC_CONFIG_BASE 0x99000000
73#define SPEAR300_SOC_CONFIG_SIZE 0x00000008
74
75#define SPEAR300_KEYBOARD_BASE 0xA0000000
76#define SPEAR300_KEYBOARD_SIZE 0x09000000
77
78#define SPEAR300_GPIO_BASE 0xA9000000
79#define SPEAR300_GPIO_SIZE 0x07000000
80 51
81#endif /* __MACH_SPEAR300_H */ 52#endif /* __MACH_SPEAR300_H */
82 53
diff --git a/arch/arm/mach-spear3xx/include/mach/spear310.h b/arch/arm/mach-spear3xx/include/mach/spear310.h
index b27bb8af3309..1e853479b8cd 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear310.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear310.h
@@ -16,30 +16,18 @@
16#ifndef __MACH_SPEAR310_H 16#ifndef __MACH_SPEAR310_H
17#define __MACH_SPEAR310_H 17#define __MACH_SPEAR310_H
18 18
19#define SPEAR310_NAND_BASE 0x40000000 19#define SPEAR310_NAND_BASE UL(0x40000000)
20#define SPEAR310_NAND_SIZE 0x04000000 20#define SPEAR310_FSMC_BASE UL(0x44000000)
21#define SPEAR310_UART1_BASE UL(0xB2000000)
22#define SPEAR310_UART2_BASE UL(0xB2080000)
23#define SPEAR310_UART3_BASE UL(0xB2100000)
24#define SPEAR310_UART4_BASE UL(0xB2180000)
25#define SPEAR310_UART5_BASE UL(0xB2200000)
26#define SPEAR310_HDLC_BASE UL(0xB2800000)
27#define SPEAR310_RS485_0_BASE UL(0xB3000000)
28#define SPEAR310_RS485_1_BASE UL(0xB3800000)
29#define SPEAR310_SOC_CONFIG_BASE UL(0xB4000000)
21 30
22#define SPEAR310_FSMC_BASE 0x44000000
23#define SPEAR310_FSMC_SIZE 0x01000000
24
25#define SPEAR310_UART1_BASE 0xB2000000
26#define SPEAR310_UART2_BASE 0xB2080000
27#define SPEAR310_UART3_BASE 0xB2100000
28#define SPEAR310_UART4_BASE 0xB2180000
29#define SPEAR310_UART5_BASE 0xB2200000
30#define SPEAR310_UART_SIZE 0x00080000
31
32#define SPEAR310_HDLC_BASE 0xB2800000
33#define SPEAR310_HDLC_SIZE 0x00800000
34
35#define SPEAR310_RS485_0_BASE 0xB3000000
36#define SPEAR310_RS485_0_SIZE 0x00800000
37
38#define SPEAR310_RS485_1_BASE 0xB3800000
39#define SPEAR310_RS485_1_SIZE 0x00800000
40
41#define SPEAR310_SOC_CONFIG_BASE 0xB4000000
42#define SPEAR310_SOC_CONFIG_SIZE 0x00000070
43/* Interrupt registers offsets and masks */ 31/* Interrupt registers offsets and masks */
44#define INT_STS_MASK_REG 0x04 32#define INT_STS_MASK_REG 0x04
45#define SMII0_IRQ_MASK (1 << 0) 33#define SMII0_IRQ_MASK (1 << 0)
diff --git a/arch/arm/mach-spear3xx/include/mach/spear320.h b/arch/arm/mach-spear3xx/include/mach/spear320.h
index cacf17a958cd..940f0d85d959 100644
--- a/arch/arm/mach-spear3xx/include/mach/spear320.h
+++ b/arch/arm/mach-spear3xx/include/mach/spear320.h
@@ -16,54 +16,25 @@
16#ifndef __MACH_SPEAR320_H 16#ifndef __MACH_SPEAR320_H
17#define __MACH_SPEAR320_H 17#define __MACH_SPEAR320_H
18 18
19#define SPEAR320_EMI_CTRL_BASE 0x40000000 19#define SPEAR320_EMI_CTRL_BASE UL(0x40000000)
20#define SPEAR320_EMI_CTRL_SIZE 0x08000000 20#define SPEAR320_FSMC_BASE UL(0x4C000000)
21#define SPEAR320_NAND_BASE UL(0x50000000)
22#define SPEAR320_I2S_BASE UL(0x60000000)
23#define SPEAR320_SDHCI_BASE UL(0x70000000)
24#define SPEAR320_CLCD_BASE UL(0x90000000)
25#define SPEAR320_PAR_PORT_BASE UL(0xA0000000)
26#define SPEAR320_CAN0_BASE UL(0xA1000000)
27#define SPEAR320_CAN1_BASE UL(0xA2000000)
28#define SPEAR320_UART1_BASE UL(0xA3000000)
29#define SPEAR320_UART2_BASE UL(0xA4000000)
30#define SPEAR320_SSP0_BASE UL(0xA5000000)
31#define SPEAR320_SSP1_BASE UL(0xA6000000)
32#define SPEAR320_I2C_BASE UL(0xA7000000)
33#define SPEAR320_PWM_BASE UL(0xA8000000)
34#define SPEAR320_SMII0_BASE UL(0xAA000000)
35#define SPEAR320_SMII1_BASE UL(0xAB000000)
36#define SPEAR320_SOC_CONFIG_BASE UL(0xB3000000)
21 37
22#define SPEAR320_FSMC_BASE 0x4C000000
23#define SPEAR320_FSMC_SIZE 0x01000000
24
25#define SPEAR320_I2S_BASE 0x60000000
26#define SPEAR320_I2S_SIZE 0x10000000
27
28#define SPEAR320_SDIO_BASE 0x70000000
29#define SPEAR320_SDIO_SIZE 0x10000000
30
31#define SPEAR320_CLCD_BASE 0x90000000
32#define SPEAR320_CLCD_SIZE 0x10000000
33
34#define SPEAR320_PAR_PORT_BASE 0xA0000000
35#define SPEAR320_PAR_PORT_SIZE 0x01000000
36
37#define SPEAR320_CAN0_BASE 0xA1000000
38#define SPEAR320_CAN0_SIZE 0x01000000
39
40#define SPEAR320_CAN1_BASE 0xA2000000
41#define SPEAR320_CAN1_SIZE 0x01000000
42
43#define SPEAR320_UART1_BASE 0xA3000000
44#define SPEAR320_UART2_BASE 0xA4000000
45#define SPEAR320_UART_SIZE 0x01000000
46
47#define SPEAR320_SSP0_BASE 0xA5000000
48#define SPEAR320_SSP0_SIZE 0x01000000
49
50#define SPEAR320_SSP1_BASE 0xA6000000
51#define SPEAR320_SSP1_SIZE 0x01000000
52
53#define SPEAR320_I2C_BASE 0xA7000000
54#define SPEAR320_I2C_SIZE 0x01000000
55
56#define SPEAR320_PWM_BASE 0xA8000000
57#define SPEAR320_PWM_SIZE 0x01000000
58
59#define SPEAR320_SMII0_BASE 0xAA000000
60#define SPEAR320_SMII0_SIZE 0x01000000
61
62#define SPEAR320_SMII1_BASE 0xAB000000
63#define SPEAR320_SMII1_SIZE 0x01000000
64
65#define SPEAR320_SOC_CONFIG_BASE 0xB4000000
66#define SPEAR320_SOC_CONFIG_SIZE 0x00000070
67/* Interrupt registers offsets and masks */ 38/* Interrupt registers offsets and masks */
68#define INT_STS_MASK_REG 0x04 39#define INT_STS_MASK_REG 0x04
69#define INT_CLR_MASK_REG 0x04 40#define INT_CLR_MASK_REG 0x04
@@ -74,7 +45,7 @@
74#define EMI_IRQ_MASK (1 << 7) 45#define EMI_IRQ_MASK (1 << 7)
75#define CLCD_IRQ_MASK (1 << 8) 46#define CLCD_IRQ_MASK (1 << 8)
76#define SPP_IRQ_MASK (1 << 9) 47#define SPP_IRQ_MASK (1 << 9)
77#define SDIO_IRQ_MASK (1 << 10) 48#define SDHCI_IRQ_MASK (1 << 10)
78#define CAN_U_IRQ_MASK (1 << 11) 49#define CAN_U_IRQ_MASK (1 << 11)
79#define CAN_L_IRQ_MASK (1 << 12) 50#define CAN_L_IRQ_MASK (1 << 12)
80#define UART1_IRQ_MASK (1 << 13) 51#define UART1_IRQ_MASK (1 << 13)
diff --git a/arch/arm/mach-spear3xx/spear300.c b/arch/arm/mach-spear3xx/spear300.c
index 5aa2d54ebfaa..2697e65adf86 100644
--- a/arch/arm/mach-spear3xx/spear300.c
+++ b/arch/arm/mach-spear3xx/spear300.c
@@ -15,9 +15,9 @@
15#include <linux/amba/pl061.h> 15#include <linux/amba/pl061.h>
16#include <linux/ptrace.h> 16#include <linux/ptrace.h>
17#include <asm/irq.h> 17#include <asm/irq.h>
18#include <mach/generic.h>
19#include <mach/spear.h>
20#include <plat/shirq.h> 18#include <plat/shirq.h>
19#include <mach/generic.h>
20#include <mach/hardware.h>
21 21
22/* pad multiplexing support */ 22/* pad multiplexing support */
23/* muxing registers */ 23/* muxing registers */
@@ -310,7 +310,7 @@ struct pmx_dev pmx_telecom_boot_pins = {
310 .enb_on_reset = 1, 310 .enb_on_reset = 1,
311}; 311};
312 312
313struct pmx_dev_mode pmx_telecom_sdio_4bit_modes[] = { 313struct pmx_dev_mode pmx_telecom_sdhci_4bit_modes[] = {
314 { 314 {
315 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE | 315 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
316 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE | 316 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
@@ -323,14 +323,14 @@ struct pmx_dev_mode pmx_telecom_sdio_4bit_modes[] = {
323 }, 323 },
324}; 324};
325 325
326struct pmx_dev pmx_telecom_sdio_4bit = { 326struct pmx_dev pmx_telecom_sdhci_4bit = {
327 .name = "telecom_sdio_4bit", 327 .name = "telecom_sdhci_4bit",
328 .modes = pmx_telecom_sdio_4bit_modes, 328 .modes = pmx_telecom_sdhci_4bit_modes,
329 .mode_count = ARRAY_SIZE(pmx_telecom_sdio_4bit_modes), 329 .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_4bit_modes),
330 .enb_on_reset = 1, 330 .enb_on_reset = 1,
331}; 331};
332 332
333struct pmx_dev_mode pmx_telecom_sdio_8bit_modes[] = { 333struct pmx_dev_mode pmx_telecom_sdhci_8bit_modes[] = {
334 { 334 {
335 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE | 335 .ids = PHOTO_FRAME_MODE | LEND_IP_PHONE_MODE |
336 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE | 336 HEND_IP_PHONE_MODE | LEND_WIFI_PHONE_MODE |
@@ -342,10 +342,10 @@ struct pmx_dev_mode pmx_telecom_sdio_8bit_modes[] = {
342 }, 342 },
343}; 343};
344 344
345struct pmx_dev pmx_telecom_sdio_8bit = { 345struct pmx_dev pmx_telecom_sdhci_8bit = {
346 .name = "telecom_sdio_8bit", 346 .name = "telecom_sdhci_8bit",
347 .modes = pmx_telecom_sdio_8bit_modes, 347 .modes = pmx_telecom_sdhci_8bit_modes,
348 .mode_count = ARRAY_SIZE(pmx_telecom_sdio_8bit_modes), 348 .mode_count = ARRAY_SIZE(pmx_telecom_sdhci_8bit_modes),
349 .enb_on_reset = 1, 349 .enb_on_reset = 1,
350}; 350};
351 351
@@ -370,26 +370,6 @@ struct pmx_driver pmx_driver = {
370 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff}, 370 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
371}; 371};
372 372
373/* Add spear300 specific devices here */
374/* arm gpio1 device registration */
375static struct pl061_platform_data gpio1_plat_data = {
376 .gpio_base = 8,
377 .irq_base = SPEAR_GPIO1_INT_BASE,
378};
379
380struct amba_device gpio1_device = {
381 .dev = {
382 .init_name = "gpio1",
383 .platform_data = &gpio1_plat_data,
384 },
385 .res = {
386 .start = SPEAR300_GPIO_BASE,
387 .end = SPEAR300_GPIO_BASE + SPEAR300_GPIO_SIZE - 1,
388 .flags = IORESOURCE_MEM,
389 },
390 .irq = {VIRQ_GPIO1, NO_IRQ},
391};
392
393/* spear3xx shared irq */ 373/* spear3xx shared irq */
394struct shirq_dev_config shirq_ras1_config[] = { 374struct shirq_dev_config shirq_ras1_config[] = {
395 { 375 {
@@ -443,6 +423,26 @@ struct spear_shirq shirq_ras1 = {
443 }, 423 },
444}; 424};
445 425
426/* Add spear300 specific devices here */
427/* arm gpio1 device registration */
428static struct pl061_platform_data gpio1_plat_data = {
429 .gpio_base = 8,
430 .irq_base = SPEAR_GPIO1_INT_BASE,
431};
432
433struct amba_device gpio1_device = {
434 .dev = {
435 .init_name = "gpio1",
436 .platform_data = &gpio1_plat_data,
437 },
438 .res = {
439 .start = SPEAR300_GPIO_BASE,
440 .end = SPEAR300_GPIO_BASE + SZ_4K - 1,
441 .flags = IORESOURCE_MEM,
442 },
443 .irq = {VIRQ_GPIO1, NO_IRQ},
444};
445
446/* spear300 routines */ 446/* spear300 routines */
447void __init spear300_init(void) 447void __init spear300_init(void)
448{ 448{
@@ -452,17 +452,21 @@ void __init spear300_init(void)
452 spear3xx_init(); 452 spear3xx_init();
453 453
454 /* shared irq registration */ 454 /* shared irq registration */
455 shirq_ras1.regs.base = 455 shirq_ras1.regs.base = ioremap(SPEAR300_TELECOM_BASE, SZ_4K);
456 ioremap(SPEAR300_TELECOM_BASE, SPEAR300_TELECOM_REG_SIZE);
457 if (shirq_ras1.regs.base) { 456 if (shirq_ras1.regs.base) {
458 ret = spear_shirq_register(&shirq_ras1); 457 ret = spear_shirq_register(&shirq_ras1);
459 if (ret) 458 if (ret)
460 printk(KERN_ERR "Error registering Shared IRQ\n"); 459 printk(KERN_ERR "Error registering Shared IRQ\n");
461 } 460 }
462}
463 461
464void spear300_pmx_init(void) 462 /* pmx initialization */
465{ 463 pmx_driver.base = ioremap(SPEAR300_SOC_CONFIG_BASE, SZ_4K);
466 spear_pmx_init(&pmx_driver, SPEAR300_SOC_CONFIG_BASE, 464 if (pmx_driver.base) {
467 SPEAR300_SOC_CONFIG_SIZE); 465 ret = pmx_register(&pmx_driver);
466 if (ret)
467 printk(KERN_ERR "padmux: registeration failed. err no"
468 ": %d\n", ret);
469 /* Free Mapping, device selection already done */
470 iounmap(pmx_driver.base);
471 }
468} 472}
diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c
index bb21db152a23..42d2253ef540 100644
--- a/arch/arm/mach-spear3xx/spear300_evb.c
+++ b/arch/arm/mach-spear3xx/spear300_evb.c
@@ -14,7 +14,7 @@
14#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <mach/generic.h> 16#include <mach/generic.h>
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19/* padmux devices to enable */ 19/* padmux devices to enable */
20static struct pmx_dev *pmx_devs[] = { 20static struct pmx_dev *pmx_devs[] = {
@@ -28,7 +28,7 @@ static struct pmx_dev *pmx_devs[] = {
28 /* spear300 specific devices */ 28 /* spear300 specific devices */
29 &pmx_fsmc_2_chips, 29 &pmx_fsmc_2_chips,
30 &pmx_clcd, 30 &pmx_clcd,
31 &pmx_telecom_sdio_4bit, 31 &pmx_telecom_sdhci_4bit,
32 &pmx_gpio1, 32 &pmx_gpio1,
33}; 33};
34 34
@@ -51,14 +51,13 @@ static void __init spear300_evb_init(void)
51{ 51{
52 unsigned int i; 52 unsigned int i;
53 53
54 /* call spear300 machine init function */ 54 /* padmux initialization, must be done before spear300_init */
55 spear300_init();
56
57 /* padmux initialization */
58 pmx_driver.mode = &photo_frame_mode; 55 pmx_driver.mode = &photo_frame_mode;
59 pmx_driver.devs = pmx_devs; 56 pmx_driver.devs = pmx_devs;
60 pmx_driver.devs_count = ARRAY_SIZE(pmx_devs); 57 pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
61 spear300_pmx_init(); 58
59 /* call spear300 machine init function */
60 spear300_init();
62 61
63 /* Add Platform Devices */ 62 /* Add Platform Devices */
64 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); 63 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
@@ -72,6 +71,6 @@ MACHINE_START(SPEAR300, "ST-SPEAR300-EVB")
72 .boot_params = 0x00000100, 71 .boot_params = 0x00000100,
73 .map_io = spear3xx_map_io, 72 .map_io = spear3xx_map_io,
74 .init_irq = spear3xx_init_irq, 73 .init_irq = spear3xx_init_irq,
75 .timer = &spear_sys_timer, 74 .timer = &spear3xx_timer,
76 .init_machine = spear300_evb_init, 75 .init_machine = spear300_evb_init,
77MACHINE_END 76MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear310.c b/arch/arm/mach-spear3xx/spear310.c
index 53b41b52d7ee..5c0a67b60c2a 100644
--- a/arch/arm/mach-spear3xx/spear310.c
+++ b/arch/arm/mach-spear3xx/spear310.c
@@ -13,9 +13,9 @@
13 13
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <mach/generic.h>
17#include <mach/spear.h>
18#include <plat/shirq.h> 16#include <plat/shirq.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19 19
20/* pad multiplexing support */ 20/* pad multiplexing support */
21/* muxing registers */ 21/* muxing registers */
@@ -139,8 +139,6 @@ struct pmx_driver pmx_driver = {
139 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff}, 139 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
140}; 140};
141 141
142/* Add spear310 specific devices here */
143
144/* spear3xx shared irq */ 142/* spear3xx shared irq */
145struct shirq_dev_config shirq_ras1_config[] = { 143struct shirq_dev_config shirq_ras1_config[] = {
146 { 144 {
@@ -257,6 +255,8 @@ struct spear_shirq shirq_intrcomm_ras = {
257 }, 255 },
258}; 256};
259 257
258/* Add spear310 specific devices here */
259
260/* spear310 routines */ 260/* spear310 routines */
261void __init spear310_init(void) 261void __init spear310_init(void)
262{ 262{
@@ -267,7 +267,7 @@ void __init spear310_init(void)
267 spear3xx_init(); 267 spear3xx_init();
268 268
269 /* shared irq registration */ 269 /* shared irq registration */
270 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SPEAR310_SOC_CONFIG_SIZE); 270 base = ioremap(SPEAR310_SOC_CONFIG_BASE, SZ_4K);
271 if (base) { 271 if (base) {
272 /* shirq 1 */ 272 /* shirq 1 */
273 shirq_ras1.regs.base = base; 273 shirq_ras1.regs.base = base;
@@ -293,10 +293,11 @@ void __init spear310_init(void)
293 if (ret) 293 if (ret)
294 printk(KERN_ERR "Error registering Shared IRQ 4\n"); 294 printk(KERN_ERR "Error registering Shared IRQ 4\n");
295 } 295 }
296}
297 296
298void spear310_pmx_init(void) 297 /* pmx initialization */
299{ 298 pmx_driver.base = base;
300 spear_pmx_init(&pmx_driver, SPEAR310_SOC_CONFIG_BASE, 299 ret = pmx_register(&pmx_driver);
301 SPEAR310_SOC_CONFIG_SIZE); 300 if (ret)
301 printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
302 ret);
302} 303}
diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c
index 7facf6643199..2d7f333bd67b 100644
--- a/arch/arm/mach-spear3xx/spear310_evb.c
+++ b/arch/arm/mach-spear3xx/spear310_evb.c
@@ -14,7 +14,7 @@
14#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <mach/generic.h> 16#include <mach/generic.h>
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19/* padmux devices to enable */ 19/* padmux devices to enable */
20static struct pmx_dev *pmx_devs[] = { 20static struct pmx_dev *pmx_devs[] = {
@@ -58,14 +58,13 @@ static void __init spear310_evb_init(void)
58{ 58{
59 unsigned int i; 59 unsigned int i;
60 60
61 /* call spear310 machine init function */ 61 /* padmux initialization, must be done before spear310_init */
62 spear310_init();
63
64 /* padmux initialization */
65 pmx_driver.mode = NULL; 62 pmx_driver.mode = NULL;
66 pmx_driver.devs = pmx_devs; 63 pmx_driver.devs = pmx_devs;
67 pmx_driver.devs_count = ARRAY_SIZE(pmx_devs); 64 pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
68 spear310_pmx_init(); 65
66 /* call spear310 machine init function */
67 spear310_init();
69 68
70 /* Add Platform Devices */ 69 /* Add Platform Devices */
71 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); 70 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
@@ -79,6 +78,6 @@ MACHINE_START(SPEAR310, "ST-SPEAR310-EVB")
79 .boot_params = 0x00000100, 78 .boot_params = 0x00000100,
80 .map_io = spear3xx_map_io, 79 .map_io = spear3xx_map_io,
81 .init_irq = spear3xx_init_irq, 80 .init_irq = spear3xx_init_irq,
82 .timer = &spear_sys_timer, 81 .timer = &spear3xx_timer,
83 .init_machine = spear310_evb_init, 82 .init_machine = spear310_evb_init,
84MACHINE_END 83MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear320.c b/arch/arm/mach-spear3xx/spear320.c
index 88b465284c36..741c1f414cbd 100644
--- a/arch/arm/mach-spear3xx/spear320.c
+++ b/arch/arm/mach-spear3xx/spear320.c
@@ -13,9 +13,9 @@
13 13
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <mach/generic.h>
17#include <mach/spear.h>
18#include <plat/shirq.h> 16#include <plat/shirq.h>
17#include <mach/generic.h>
18#include <mach/hardware.h>
19 19
20/* pad multiplexing support */ 20/* pad multiplexing support */
21/* muxing registers */ 21/* muxing registers */
@@ -110,7 +110,7 @@ struct pmx_dev pmx_spp = {
110 .enb_on_reset = 1, 110 .enb_on_reset = 1,
111}; 111};
112 112
113struct pmx_dev_mode pmx_sdio_modes[] = { 113struct pmx_dev_mode pmx_sdhci_modes[] = {
114 { 114 {
115 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE | 115 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE |
116 SMALL_PRINTERS_MODE, 116 SMALL_PRINTERS_MODE,
@@ -118,10 +118,10 @@ struct pmx_dev_mode pmx_sdio_modes[] = {
118 }, 118 },
119}; 119};
120 120
121struct pmx_dev pmx_sdio = { 121struct pmx_dev pmx_sdhci = {
122 .name = "sdio", 122 .name = "sdhci",
123 .modes = pmx_sdio_modes, 123 .modes = pmx_sdhci_modes,
124 .mode_count = ARRAY_SIZE(pmx_sdio_modes), 124 .mode_count = ARRAY_SIZE(pmx_sdhci_modes),
125 .enb_on_reset = 1, 125 .enb_on_reset = 1,
126}; 126};
127 127
@@ -215,17 +215,17 @@ struct pmx_dev pmx_can = {
215 .enb_on_reset = 1, 215 .enb_on_reset = 1,
216}; 216};
217 217
218struct pmx_dev_mode pmx_sdio_led_modes[] = { 218struct pmx_dev_mode pmx_sdhci_led_modes[] = {
219 { 219 {
220 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE, 220 .ids = AUTO_NET_SMII_MODE | AUTO_NET_MII_MODE,
221 .mask = PMX_SSP_CS_MASK, 221 .mask = PMX_SSP_CS_MASK,
222 }, 222 },
223}; 223};
224 224
225struct pmx_dev pmx_sdio_led = { 225struct pmx_dev pmx_sdhci_led = {
226 .name = "sdio_led", 226 .name = "sdhci_led",
227 .modes = pmx_sdio_led_modes, 227 .modes = pmx_sdhci_led_modes,
228 .mode_count = ARRAY_SIZE(pmx_sdio_led_modes), 228 .mode_count = ARRAY_SIZE(pmx_sdhci_led_modes),
229 .enb_on_reset = 1, 229 .enb_on_reset = 1,
230}; 230};
231 231
@@ -384,8 +384,6 @@ struct pmx_driver pmx_driver = {
384 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff}, 384 .mux_reg = {.offset = PAD_MUX_CONFIG_REG, .mask = 0x00007fff},
385}; 385};
386 386
387/* Add spear320 specific devices here */
388
389/* spear3xx shared irq */ 387/* spear3xx shared irq */
390struct shirq_dev_config shirq_ras1_config[] = { 388struct shirq_dev_config shirq_ras1_config[] = {
391 { 389 {
@@ -510,6 +508,8 @@ struct spear_shirq shirq_intrcomm_ras = {
510 }, 508 },
511}; 509};
512 510
511/* Add spear320 specific devices here */
512
513/* spear320 routines */ 513/* spear320 routines */
514void __init spear320_init(void) 514void __init spear320_init(void)
515{ 515{
@@ -520,7 +520,7 @@ void __init spear320_init(void)
520 spear3xx_init(); 520 spear3xx_init();
521 521
522 /* shared irq registration */ 522 /* shared irq registration */
523 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SPEAR320_SOC_CONFIG_SIZE); 523 base = ioremap(SPEAR320_SOC_CONFIG_BASE, SZ_4K);
524 if (base) { 524 if (base) {
525 /* shirq 1 */ 525 /* shirq 1 */
526 shirq_ras1.regs.base = base; 526 shirq_ras1.regs.base = base;
@@ -540,10 +540,11 @@ void __init spear320_init(void)
540 if (ret) 540 if (ret)
541 printk(KERN_ERR "Error registering Shared IRQ 4\n"); 541 printk(KERN_ERR "Error registering Shared IRQ 4\n");
542 } 542 }
543}
544 543
545void spear320_pmx_init(void) 544 /* pmx initialization */
546{ 545 pmx_driver.base = base;
547 spear_pmx_init(&pmx_driver, SPEAR320_SOC_CONFIG_BASE, 546 ret = pmx_register(&pmx_driver);
548 SPEAR320_SOC_CONFIG_SIZE); 547 if (ret)
548 printk(KERN_ERR "padmux: registeration failed. err no: %d\n",
549 ret);
549} 550}
diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c
index 62ac685a4135..8213e4b66c14 100644
--- a/arch/arm/mach-spear3xx/spear320_evb.c
+++ b/arch/arm/mach-spear3xx/spear320_evb.c
@@ -14,7 +14,7 @@
14#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <mach/generic.h> 16#include <mach/generic.h>
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19/* padmux devices to enable */ 19/* padmux devices to enable */
20static struct pmx_dev *pmx_devs[] = { 20static struct pmx_dev *pmx_devs[] = {
@@ -26,7 +26,7 @@ static struct pmx_dev *pmx_devs[] = {
26 26
27 /* spear320 specific devices */ 27 /* spear320 specific devices */
28 &pmx_fsmc, 28 &pmx_fsmc,
29 &pmx_sdio, 29 &pmx_sdhci,
30 &pmx_i2s, 30 &pmx_i2s,
31 &pmx_uart1, 31 &pmx_uart1,
32 &pmx_uart2, 32 &pmx_uart2,
@@ -55,14 +55,13 @@ static void __init spear320_evb_init(void)
55{ 55{
56 unsigned int i; 56 unsigned int i;
57 57
58 /* call spear320 machine init function */ 58 /* padmux initialization, must be done before spear320_init */
59 spear320_init();
60
61 /* padmux initialization */
62 pmx_driver.mode = &auto_net_mii_mode; 59 pmx_driver.mode = &auto_net_mii_mode;
63 pmx_driver.devs = pmx_devs; 60 pmx_driver.devs = pmx_devs;
64 pmx_driver.devs_count = ARRAY_SIZE(pmx_devs); 61 pmx_driver.devs_count = ARRAY_SIZE(pmx_devs);
65 spear320_pmx_init(); 62
63 /* call spear320 machine init function */
64 spear320_init();
66 65
67 /* Add Platform Devices */ 66 /* Add Platform Devices */
68 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs)); 67 platform_add_devices(plat_devs, ARRAY_SIZE(plat_devs));
@@ -76,6 +75,6 @@ MACHINE_START(SPEAR320, "ST-SPEAR320-EVB")
76 .boot_params = 0x00000100, 75 .boot_params = 0x00000100,
77 .map_io = spear3xx_map_io, 76 .map_io = spear3xx_map_io,
78 .init_irq = spear3xx_init_irq, 77 .init_irq = spear3xx_init_irq,
79 .timer = &spear_sys_timer, 78 .timer = &spear3xx_timer,
80 .init_machine = spear320_evb_init, 79 .init_machine = spear320_evb_init,
81MACHINE_END 80MACHINE_END
diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c
index 52f553c8c46d..d3ba8ca1bc59 100644
--- a/arch/arm/mach-spear3xx/spear3xx.c
+++ b/arch/arm/mach-spear3xx/spear3xx.c
@@ -19,7 +19,7 @@
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <mach/generic.h> 21#include <mach/generic.h>
22#include <mach/spear.h> 22#include <mach/hardware.h>
23 23
24/* Add spear3xx machines common devices here */ 24/* Add spear3xx machines common devices here */
25/* gpio device registration */ 25/* gpio device registration */
@@ -35,7 +35,7 @@ struct amba_device gpio_device = {
35 }, 35 },
36 .res = { 36 .res = {
37 .start = SPEAR3XX_ICM3_GPIO_BASE, 37 .start = SPEAR3XX_ICM3_GPIO_BASE,
38 .end = SPEAR3XX_ICM3_GPIO_BASE + SPEAR3XX_ICM3_GPIO_SIZE - 1, 38 .end = SPEAR3XX_ICM3_GPIO_BASE + SZ_4K - 1,
39 .flags = IORESOURCE_MEM, 39 .flags = IORESOURCE_MEM,
40 }, 40 },
41 .irq = {IRQ_BASIC_GPIO, NO_IRQ}, 41 .irq = {IRQ_BASIC_GPIO, NO_IRQ},
@@ -48,7 +48,7 @@ struct amba_device uart_device = {
48 }, 48 },
49 .res = { 49 .res = {
50 .start = SPEAR3XX_ICM1_UART_BASE, 50 .start = SPEAR3XX_ICM1_UART_BASE,
51 .end = SPEAR3XX_ICM1_UART_BASE + SPEAR3XX_ICM1_UART_SIZE - 1, 51 .end = SPEAR3XX_ICM1_UART_BASE + SZ_4K - 1,
52 .flags = IORESOURCE_MEM, 52 .flags = IORESOURCE_MEM,
53 }, 53 },
54 .irq = {IRQ_UART, NO_IRQ}, 54 .irq = {IRQ_UART, NO_IRQ},
@@ -71,22 +71,22 @@ struct map_desc spear3xx_io_desc[] __initdata = {
71 { 71 {
72 .virtual = VA_SPEAR3XX_ICM1_UART_BASE, 72 .virtual = VA_SPEAR3XX_ICM1_UART_BASE,
73 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE), 73 .pfn = __phys_to_pfn(SPEAR3XX_ICM1_UART_BASE),
74 .length = SPEAR3XX_ICM1_UART_SIZE, 74 .length = SZ_4K,
75 .type = MT_DEVICE 75 .type = MT_DEVICE
76 }, { 76 }, {
77 .virtual = VA_SPEAR3XX_ML1_VIC_BASE, 77 .virtual = VA_SPEAR3XX_ML1_VIC_BASE,
78 .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE), 78 .pfn = __phys_to_pfn(SPEAR3XX_ML1_VIC_BASE),
79 .length = SPEAR3XX_ML1_VIC_SIZE, 79 .length = SZ_4K,
80 .type = MT_DEVICE 80 .type = MT_DEVICE
81 }, { 81 }, {
82 .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE, 82 .virtual = VA_SPEAR3XX_ICM3_SYS_CTRL_BASE,
83 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE), 83 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_SYS_CTRL_BASE),
84 .length = SPEAR3XX_ICM3_SYS_CTRL_SIZE, 84 .length = SZ_4K,
85 .type = MT_DEVICE 85 .type = MT_DEVICE
86 }, { 86 }, {
87 .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE, 87 .virtual = VA_SPEAR3XX_ICM3_MISC_REG_BASE,
88 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE), 88 .pfn = __phys_to_pfn(SPEAR3XX_ICM3_MISC_REG_BASE),
89 .length = SPEAR3XX_ICM3_MISC_REG_SIZE, 89 .length = SZ_4K,
90 .type = MT_DEVICE 90 .type = MT_DEVICE
91 }, 91 },
92}; 92};
@@ -523,26 +523,35 @@ struct pmx_dev pmx_plgpio_45_46_49_50 = {
523 .mode_count = ARRAY_SIZE(pmx_plgpio_45_46_49_50_modes), 523 .mode_count = ARRAY_SIZE(pmx_plgpio_45_46_49_50_modes),
524 .enb_on_reset = 1, 524 .enb_on_reset = 1,
525}; 525};
526#endif /* CONFIG_MACH_SPEAR310 || CONFIG_MACH_SPEAR320 */
526 527
527#endif 528static void __init spear3xx_timer_init(void)
528
529/* spear padmux initialization function */
530void spear_pmx_init(struct pmx_driver *pmx_driver, uint base, uint size)
531{ 529{
532 int ret = 0; 530 char pclk_name[] = "pll3_48m_clk";
531 struct clk *gpt_clk, *pclk;
532
533 /* get the system timer clock */
534 gpt_clk = clk_get_sys("gpt0", NULL);
535 if (IS_ERR(gpt_clk)) {
536 pr_err("%s:couldn't get clk for gpt\n", __func__);
537 BUG();
538 }
533 539
534 /* pad mux initialization */ 540 /* get the suitable parent clock for timer*/
535 pmx_driver->base = ioremap(base, size); 541 pclk = clk_get(NULL, pclk_name);
536 if (!pmx_driver->base) { 542 if (IS_ERR(pclk)) {
537 ret = -ENOMEM; 543 pr_err("%s:couldn't get %s as parent for gpt\n",
538 goto pmx_fail; 544 __func__, pclk_name);
545 BUG();
539 } 546 }
540 547
541 ret = pmx_register(pmx_driver); 548 clk_set_parent(gpt_clk, pclk);
542 iounmap(pmx_driver->base); 549 clk_put(gpt_clk);
550 clk_put(pclk);
543 551
544pmx_fail: 552 spear_setup_timer();
545 if (ret)
546 printk(KERN_ERR "padmux: registration failed. err no: %d\n",
547 ret);
548} 553}
554
555struct sys_timer spear3xx_timer = {
556 .init = spear3xx_timer_init,
557};
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c
index 36ff056b7321..88b748b5be80 100644
--- a/arch/arm/mach-spear6xx/clock.c
+++ b/arch/arm/mach-spear6xx/clock.c
@@ -13,8 +13,8 @@
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <mach/misc_regs.h>
17#include <plat/clock.h> 16#include <plat/clock.h>
17#include <mach/misc_regs.h>
18 18
19/* root clks */ 19/* root clks */
20/* 32 KHz oscillator clock */ 20/* 32 KHz oscillator clock */
@@ -39,18 +39,43 @@ static struct clk rtc_clk = {
39}; 39};
40 40
41/* clock derived from 30 MHz osc clk */ 41/* clock derived from 30 MHz osc clk */
42/* pll masks structure */
43static struct pll_clk_masks pll1_masks = {
44 .mode_mask = PLL_MODE_MASK,
45 .mode_shift = PLL_MODE_SHIFT,
46 .norm_fdbk_m_mask = PLL_NORM_FDBK_M_MASK,
47 .norm_fdbk_m_shift = PLL_NORM_FDBK_M_SHIFT,
48 .dith_fdbk_m_mask = PLL_DITH_FDBK_M_MASK,
49 .dith_fdbk_m_shift = PLL_DITH_FDBK_M_SHIFT,
50 .div_p_mask = PLL_DIV_P_MASK,
51 .div_p_shift = PLL_DIV_P_SHIFT,
52 .div_n_mask = PLL_DIV_N_MASK,
53 .div_n_shift = PLL_DIV_N_SHIFT,
54};
55
42/* pll1 configuration structure */ 56/* pll1 configuration structure */
43static struct pll_clk_config pll1_config = { 57static struct pll_clk_config pll1_config = {
44 .mode_reg = PLL1_CTR, 58 .mode_reg = PLL1_CTR,
45 .cfg_reg = PLL1_FRQ, 59 .cfg_reg = PLL1_FRQ,
60 .masks = &pll1_masks,
61};
62
63/* pll rate configuration table, in ascending order of rates */
64struct pll_rate_tbl pll_rtbl[] = {
65 {.mode = 0, .m = 0x85, .n = 0x0C, .p = 0x1}, /* 266 MHz */
66 {.mode = 0, .m = 0xA6, .n = 0x0C, .p = 0x1}, /* 332 MHz */
46}; 67};
47 68
48/* PLL1 clock */ 69/* PLL1 clock */
49static struct clk pll1_clk = { 70static struct clk pll1_clk = {
71 .flags = ENABLED_ON_INIT,
50 .pclk = &osc_30m_clk, 72 .pclk = &osc_30m_clk,
51 .en_reg = PLL1_CTR, 73 .en_reg = PLL1_CTR,
52 .en_reg_bit = PLL_ENABLE, 74 .en_reg_bit = PLL_ENABLE,
53 .recalc = &pll1_clk_recalc, 75 .calc_rate = &pll_calc_rate,
76 .recalc = &pll_clk_recalc,
77 .set_rate = &pll_clk_set_rate,
78 .rate_config = {pll_rtbl, ARRAY_SIZE(pll_rtbl), 1},
54 .private_data = &pll1_config, 79 .private_data = &pll1_config,
55}; 80};
56 81
@@ -76,31 +101,83 @@ static struct clk cpu_clk = {
76 .recalc = &follow_parent, 101 .recalc = &follow_parent,
77}; 102};
78 103
104/* ahb masks structure */
105static struct bus_clk_masks ahb_masks = {
106 .mask = PLL_HCLK_RATIO_MASK,
107 .shift = PLL_HCLK_RATIO_SHIFT,
108};
109
79/* ahb configuration structure */ 110/* ahb configuration structure */
80static struct bus_clk_config ahb_config = { 111static struct bus_clk_config ahb_config = {
81 .reg = CORE_CLK_CFG, 112 .reg = CORE_CLK_CFG,
82 .mask = PLL_HCLK_RATIO_MASK, 113 .masks = &ahb_masks,
83 .shift = PLL_HCLK_RATIO_SHIFT, 114};
115
116/* ahb rate configuration table, in ascending order of rates */
117struct bus_rate_tbl bus_rtbl[] = {
118 {.div = 3}, /* == parent divided by 4 */
119 {.div = 2}, /* == parent divided by 3 */
120 {.div = 1}, /* == parent divided by 2 */
121 {.div = 0}, /* == parent divided by 1 */
84}; 122};
85 123
86/* ahb clock */ 124/* ahb clock */
87static struct clk ahb_clk = { 125static struct clk ahb_clk = {
88 .flags = ALWAYS_ENABLED, 126 .flags = ALWAYS_ENABLED,
89 .pclk = &pll1_clk, 127 .pclk = &pll1_clk,
128 .calc_rate = &bus_calc_rate,
90 .recalc = &bus_clk_recalc, 129 .recalc = &bus_clk_recalc,
130 .set_rate = &bus_clk_set_rate,
131 .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2},
91 .private_data = &ahb_config, 132 .private_data = &ahb_config,
92}; 133};
93 134
135/* auxiliary synthesizers masks */
136static struct aux_clk_masks aux_masks = {
137 .eq_sel_mask = AUX_EQ_SEL_MASK,
138 .eq_sel_shift = AUX_EQ_SEL_SHIFT,
139 .eq1_mask = AUX_EQ1_SEL,
140 .eq2_mask = AUX_EQ2_SEL,
141 .xscale_sel_mask = AUX_XSCALE_MASK,
142 .xscale_sel_shift = AUX_XSCALE_SHIFT,
143 .yscale_sel_mask = AUX_YSCALE_MASK,
144 .yscale_sel_shift = AUX_YSCALE_SHIFT,
145};
146
147/* uart configurations */
148static struct aux_clk_config uart_synth_config = {
149 .synth_reg = UART_CLK_SYNT,
150 .masks = &aux_masks,
151};
152
153/* aux rate configuration table, in ascending order of rates */
154struct aux_rate_tbl aux_rtbl[] = {
155 /* For PLL1 = 332 MHz */
156 {.xscale = 1, .yscale = 8, .eq = 1}, /* 41.5 MHz */
157 {.xscale = 1, .yscale = 4, .eq = 1}, /* 83 MHz */
158 {.xscale = 1, .yscale = 2, .eq = 1}, /* 166 MHz */
159};
160
161/* uart synth clock */
162static struct clk uart_synth_clk = {
163 .en_reg = UART_CLK_SYNT,
164 .en_reg_bit = AUX_SYNT_ENB,
165 .pclk = &pll1_clk,
166 .calc_rate = &aux_calc_rate,
167 .recalc = &aux_clk_recalc,
168 .set_rate = &aux_clk_set_rate,
169 .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 2},
170 .private_data = &uart_synth_config,
171};
172
94/* uart parents */ 173/* uart parents */
95static struct pclk_info uart_pclk_info[] = { 174static struct pclk_info uart_pclk_info[] = {
96 { 175 {
97 .pclk = &pll1_clk, 176 .pclk = &uart_synth_clk,
98 .pclk_mask = AUX_CLK_PLL1_MASK, 177 .pclk_val = AUX_CLK_PLL1_VAL,
99 .scalable = 1,
100 }, { 178 }, {
101 .pclk = &pll3_48m_clk, 179 .pclk = &pll3_48m_clk,
102 .pclk_mask = AUX_CLK_PLL3_MASK, 180 .pclk_val = AUX_CLK_PLL3_VAL,
103 .scalable = 0,
104 }, 181 },
105}; 182};
106 183
@@ -112,19 +189,13 @@ static struct pclk_sel uart_pclk_sel = {
112 .pclk_sel_mask = UART_CLK_MASK, 189 .pclk_sel_mask = UART_CLK_MASK,
113}; 190};
114 191
115/* uart configurations */
116static struct aux_clk_config uart_config = {
117 .synth_reg = UART_CLK_SYNT,
118};
119
120/* uart0 clock */ 192/* uart0 clock */
121static struct clk uart0_clk = { 193static struct clk uart0_clk = {
122 .en_reg = PERIP1_CLK_ENB, 194 .en_reg = PERIP1_CLK_ENB,
123 .en_reg_bit = UART0_CLK_ENB, 195 .en_reg_bit = UART0_CLK_ENB,
124 .pclk_sel = &uart_pclk_sel, 196 .pclk_sel = &uart_pclk_sel,
125 .pclk_sel_shift = UART_CLK_SHIFT, 197 .pclk_sel_shift = UART_CLK_SHIFT,
126 .recalc = &aux_clk_recalc, 198 .recalc = &follow_parent,
127 .private_data = &uart_config,
128}; 199};
129 200
130/* uart1 clock */ 201/* uart1 clock */
@@ -133,25 +204,35 @@ static struct clk uart1_clk = {
133 .en_reg_bit = UART1_CLK_ENB, 204 .en_reg_bit = UART1_CLK_ENB,
134 .pclk_sel = &uart_pclk_sel, 205 .pclk_sel = &uart_pclk_sel,
135 .pclk_sel_shift = UART_CLK_SHIFT, 206 .pclk_sel_shift = UART_CLK_SHIFT,
136 .recalc = &aux_clk_recalc, 207 .recalc = &follow_parent,
137 .private_data = &uart_config,
138}; 208};
139 209
140/* firda configurations */ 210/* firda configurations */
141static struct aux_clk_config firda_config = { 211static struct aux_clk_config firda_synth_config = {
142 .synth_reg = FIRDA_CLK_SYNT, 212 .synth_reg = FIRDA_CLK_SYNT,
213 .masks = &aux_masks,
214};
215
216/* firda synth clock */
217static struct clk firda_synth_clk = {
218 .en_reg = FIRDA_CLK_SYNT,
219 .en_reg_bit = AUX_SYNT_ENB,
220 .pclk = &pll1_clk,
221 .calc_rate = &aux_calc_rate,
222 .recalc = &aux_clk_recalc,
223 .set_rate = &aux_clk_set_rate,
224 .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 2},
225 .private_data = &firda_synth_config,
143}; 226};
144 227
145/* firda parents */ 228/* firda parents */
146static struct pclk_info firda_pclk_info[] = { 229static struct pclk_info firda_pclk_info[] = {
147 { 230 {
148 .pclk = &pll1_clk, 231 .pclk = &firda_synth_clk,
149 .pclk_mask = AUX_CLK_PLL1_MASK, 232 .pclk_val = AUX_CLK_PLL1_VAL,
150 .scalable = 1,
151 }, { 233 }, {
152 .pclk = &pll3_48m_clk, 234 .pclk = &pll3_48m_clk,
153 .pclk_mask = AUX_CLK_PLL3_MASK, 235 .pclk_val = AUX_CLK_PLL3_VAL,
154 .scalable = 0,
155 }, 236 },
156}; 237};
157 238
@@ -169,25 +250,35 @@ static struct clk firda_clk = {
169 .en_reg_bit = FIRDA_CLK_ENB, 250 .en_reg_bit = FIRDA_CLK_ENB,
170 .pclk_sel = &firda_pclk_sel, 251 .pclk_sel = &firda_pclk_sel,
171 .pclk_sel_shift = FIRDA_CLK_SHIFT, 252 .pclk_sel_shift = FIRDA_CLK_SHIFT,
172 .recalc = &aux_clk_recalc, 253 .recalc = &follow_parent,
173 .private_data = &firda_config,
174}; 254};
175 255
176/* clcd configurations */ 256/* clcd configurations */
177static struct aux_clk_config clcd_config = { 257static struct aux_clk_config clcd_synth_config = {
178 .synth_reg = CLCD_CLK_SYNT, 258 .synth_reg = CLCD_CLK_SYNT,
259 .masks = &aux_masks,
260};
261
262/* firda synth clock */
263static struct clk clcd_synth_clk = {
264 .en_reg = CLCD_CLK_SYNT,
265 .en_reg_bit = AUX_SYNT_ENB,
266 .pclk = &pll1_clk,
267 .calc_rate = &aux_calc_rate,
268 .recalc = &aux_clk_recalc,
269 .set_rate = &aux_clk_set_rate,
270 .rate_config = {aux_rtbl, ARRAY_SIZE(aux_rtbl), 2},
271 .private_data = &clcd_synth_config,
179}; 272};
180 273
181/* clcd parents */ 274/* clcd parents */
182static struct pclk_info clcd_pclk_info[] = { 275static struct pclk_info clcd_pclk_info[] = {
183 { 276 {
184 .pclk = &pll1_clk, 277 .pclk = &clcd_synth_clk,
185 .pclk_mask = AUX_CLK_PLL1_MASK, 278 .pclk_val = AUX_CLK_PLL1_VAL,
186 .scalable = 1,
187 }, { 279 }, {
188 .pclk = &pll3_48m_clk, 280 .pclk = &pll3_48m_clk,
189 .pclk_mask = AUX_CLK_PLL3_MASK, 281 .pclk_val = AUX_CLK_PLL3_VAL,
190 .scalable = 0,
191 }, 282 },
192}; 283};
193 284
@@ -205,82 +296,173 @@ static struct clk clcd_clk = {
205 .en_reg_bit = CLCD_CLK_ENB, 296 .en_reg_bit = CLCD_CLK_ENB,
206 .pclk_sel = &clcd_pclk_sel, 297 .pclk_sel = &clcd_pclk_sel,
207 .pclk_sel_shift = CLCD_CLK_SHIFT, 298 .pclk_sel_shift = CLCD_CLK_SHIFT,
208 .recalc = &aux_clk_recalc, 299 .recalc = &follow_parent,
209 .private_data = &clcd_config, 300};
301
302/* gpt synthesizer masks */
303static struct gpt_clk_masks gpt_masks = {
304 .mscale_sel_mask = GPT_MSCALE_MASK,
305 .mscale_sel_shift = GPT_MSCALE_SHIFT,
306 .nscale_sel_mask = GPT_NSCALE_MASK,
307 .nscale_sel_shift = GPT_NSCALE_SHIFT,
308};
309
310/* gpt rate configuration table, in ascending order of rates */
311struct gpt_rate_tbl gpt_rtbl[] = {
312 /* For pll1 = 332 MHz */
313 {.mscale = 4, .nscale = 0}, /* 41.5 MHz */
314 {.mscale = 2, .nscale = 0}, /* 55.3 MHz */
315 {.mscale = 1, .nscale = 0}, /* 83 MHz */
316};
317
318/* gpt0 synth clk config*/
319static struct gpt_clk_config gpt0_synth_config = {
320 .synth_reg = PRSC1_CLK_CFG,
321 .masks = &gpt_masks,
322};
323
324/* gpt synth clock */
325static struct clk gpt0_synth_clk = {
326 .flags = ALWAYS_ENABLED,
327 .pclk = &pll1_clk,
328 .calc_rate = &gpt_calc_rate,
329 .recalc = &gpt_clk_recalc,
330 .set_rate = &gpt_clk_set_rate,
331 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
332 .private_data = &gpt0_synth_config,
210}; 333};
211 334
212/* gpt parents */ 335/* gpt parents */
213static struct pclk_info gpt_pclk_info[] = { 336static struct pclk_info gpt0_pclk_info[] = {
214 { 337 {
215 .pclk = &pll1_clk, 338 .pclk = &gpt0_synth_clk,
216 .pclk_mask = AUX_CLK_PLL1_MASK, 339 .pclk_val = AUX_CLK_PLL1_VAL,
217 .scalable = 1,
218 }, { 340 }, {
219 .pclk = &pll3_48m_clk, 341 .pclk = &pll3_48m_clk,
220 .pclk_mask = AUX_CLK_PLL3_MASK, 342 .pclk_val = AUX_CLK_PLL3_VAL,
221 .scalable = 0,
222 }, 343 },
223}; 344};
224 345
225/* gpt parent select structure */ 346/* gpt parent select structure */
226static struct pclk_sel gpt_pclk_sel = { 347static struct pclk_sel gpt0_pclk_sel = {
227 .pclk_info = gpt_pclk_info, 348 .pclk_info = gpt0_pclk_info,
228 .pclk_count = ARRAY_SIZE(gpt_pclk_info), 349 .pclk_count = ARRAY_SIZE(gpt0_pclk_info),
229 .pclk_sel_reg = PERIP_CLK_CFG, 350 .pclk_sel_reg = PERIP_CLK_CFG,
230 .pclk_sel_mask = GPT_CLK_MASK, 351 .pclk_sel_mask = GPT_CLK_MASK,
231}; 352};
232 353
233/* gpt0_1 configurations */
234static struct aux_clk_config gpt0_1_config = {
235 .synth_reg = PRSC1_CLK_CFG,
236};
237
238/* gpt0 ARM1 subsystem timer clock */ 354/* gpt0 ARM1 subsystem timer clock */
239static struct clk gpt0_clk = { 355static struct clk gpt0_clk = {
240 .flags = ALWAYS_ENABLED, 356 .flags = ALWAYS_ENABLED,
241 .pclk_sel = &gpt_pclk_sel, 357 .pclk_sel = &gpt0_pclk_sel,
242 .pclk_sel_shift = GPT0_CLK_SHIFT, 358 .pclk_sel_shift = GPT0_CLK_SHIFT,
243 .recalc = &gpt_clk_recalc, 359 .recalc = &follow_parent,
244 .private_data = &gpt0_1_config, 360};
361
362
363/* Note: gpt0 and gpt1 share same parent clocks */
364/* gpt parent select structure */
365static struct pclk_sel gpt1_pclk_sel = {
366 .pclk_info = gpt0_pclk_info,
367 .pclk_count = ARRAY_SIZE(gpt0_pclk_info),
368 .pclk_sel_reg = PERIP_CLK_CFG,
369 .pclk_sel_mask = GPT_CLK_MASK,
245}; 370};
246 371
247/* gpt1 timer clock */ 372/* gpt1 timer clock */
248static struct clk gpt1_clk = { 373static struct clk gpt1_clk = {
249 .flags = ALWAYS_ENABLED, 374 .flags = ALWAYS_ENABLED,
250 .pclk_sel = &gpt_pclk_sel, 375 .pclk_sel = &gpt1_pclk_sel,
251 .pclk_sel_shift = GPT1_CLK_SHIFT, 376 .pclk_sel_shift = GPT1_CLK_SHIFT,
252 .recalc = &gpt_clk_recalc, 377 .recalc = &follow_parent,
253 .private_data = &gpt0_1_config,
254}; 378};
255 379
256/* gpt2 configurations */ 380/* gpt2 synth clk config*/
257static struct aux_clk_config gpt2_config = { 381static struct gpt_clk_config gpt2_synth_config = {
258 .synth_reg = PRSC2_CLK_CFG, 382 .synth_reg = PRSC2_CLK_CFG,
383 .masks = &gpt_masks,
384};
385
386/* gpt synth clock */
387static struct clk gpt2_synth_clk = {
388 .flags = ALWAYS_ENABLED,
389 .pclk = &pll1_clk,
390 .calc_rate = &gpt_calc_rate,
391 .recalc = &gpt_clk_recalc,
392 .set_rate = &gpt_clk_set_rate,
393 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
394 .private_data = &gpt2_synth_config,
395};
396
397/* gpt parents */
398static struct pclk_info gpt2_pclk_info[] = {
399 {
400 .pclk = &gpt2_synth_clk,
401 .pclk_val = AUX_CLK_PLL1_VAL,
402 }, {
403 .pclk = &pll3_48m_clk,
404 .pclk_val = AUX_CLK_PLL3_VAL,
405 },
406};
407
408/* gpt parent select structure */
409static struct pclk_sel gpt2_pclk_sel = {
410 .pclk_info = gpt2_pclk_info,
411 .pclk_count = ARRAY_SIZE(gpt2_pclk_info),
412 .pclk_sel_reg = PERIP_CLK_CFG,
413 .pclk_sel_mask = GPT_CLK_MASK,
259}; 414};
260 415
261/* gpt2 timer clock */ 416/* gpt2 timer clock */
262static struct clk gpt2_clk = { 417static struct clk gpt2_clk = {
263 .en_reg = PERIP1_CLK_ENB, 418 .flags = ALWAYS_ENABLED,
264 .en_reg_bit = GPT2_CLK_ENB, 419 .pclk_sel = &gpt2_pclk_sel,
265 .pclk_sel = &gpt_pclk_sel,
266 .pclk_sel_shift = GPT2_CLK_SHIFT, 420 .pclk_sel_shift = GPT2_CLK_SHIFT,
267 .recalc = &gpt_clk_recalc, 421 .recalc = &follow_parent,
268 .private_data = &gpt2_config,
269}; 422};
270 423
271/* gpt3 configurations */ 424/* gpt3 synth clk config*/
272static struct aux_clk_config gpt3_config = { 425static struct gpt_clk_config gpt3_synth_config = {
273 .synth_reg = PRSC3_CLK_CFG, 426 .synth_reg = PRSC3_CLK_CFG,
427 .masks = &gpt_masks,
428};
429
430/* gpt synth clock */
431static struct clk gpt3_synth_clk = {
432 .flags = ALWAYS_ENABLED,
433 .pclk = &pll1_clk,
434 .calc_rate = &gpt_calc_rate,
435 .recalc = &gpt_clk_recalc,
436 .set_rate = &gpt_clk_set_rate,
437 .rate_config = {gpt_rtbl, ARRAY_SIZE(gpt_rtbl), 2},
438 .private_data = &gpt3_synth_config,
439};
440
441/* gpt parents */
442static struct pclk_info gpt3_pclk_info[] = {
443 {
444 .pclk = &gpt3_synth_clk,
445 .pclk_val = AUX_CLK_PLL1_VAL,
446 }, {
447 .pclk = &pll3_48m_clk,
448 .pclk_val = AUX_CLK_PLL3_VAL,
449 },
450};
451
452/* gpt parent select structure */
453static struct pclk_sel gpt3_pclk_sel = {
454 .pclk_info = gpt3_pclk_info,
455 .pclk_count = ARRAY_SIZE(gpt3_pclk_info),
456 .pclk_sel_reg = PERIP_CLK_CFG,
457 .pclk_sel_mask = GPT_CLK_MASK,
274}; 458};
275 459
276/* gpt3 timer clock */ 460/* gpt3 timer clock */
277static struct clk gpt3_clk = { 461static struct clk gpt3_clk = {
278 .en_reg = PERIP1_CLK_ENB, 462 .flags = ALWAYS_ENABLED,
279 .en_reg_bit = GPT3_CLK_ENB, 463 .pclk_sel = &gpt3_pclk_sel,
280 .pclk_sel = &gpt_pclk_sel,
281 .pclk_sel_shift = GPT3_CLK_SHIFT, 464 .pclk_sel_shift = GPT3_CLK_SHIFT,
282 .recalc = &gpt_clk_recalc, 465 .recalc = &follow_parent,
283 .private_data = &gpt3_config,
284}; 466};
285 467
286/* clock derived from pll3 clk */ 468/* clock derived from pll3 clk */
@@ -309,18 +491,26 @@ static struct clk usbd_clk = {
309}; 491};
310 492
311/* clock derived from ahb clk */ 493/* clock derived from ahb clk */
494/* apb masks structure */
495static struct bus_clk_masks apb_masks = {
496 .mask = HCLK_PCLK_RATIO_MASK,
497 .shift = HCLK_PCLK_RATIO_SHIFT,
498};
499
312/* apb configuration structure */ 500/* apb configuration structure */
313static struct bus_clk_config apb_config = { 501static struct bus_clk_config apb_config = {
314 .reg = CORE_CLK_CFG, 502 .reg = CORE_CLK_CFG,
315 .mask = HCLK_PCLK_RATIO_MASK, 503 .masks = &apb_masks,
316 .shift = HCLK_PCLK_RATIO_SHIFT,
317}; 504};
318 505
319/* apb clock */ 506/* apb clock */
320static struct clk apb_clk = { 507static struct clk apb_clk = {
321 .flags = ALWAYS_ENABLED, 508 .flags = ALWAYS_ENABLED,
322 .pclk = &ahb_clk, 509 .pclk = &ahb_clk,
510 .calc_rate = &bus_calc_rate,
323 .recalc = &bus_clk_recalc, 511 .recalc = &bus_clk_recalc,
512 .set_rate = &bus_clk_set_rate,
513 .rate_config = {bus_rtbl, ARRAY_SIZE(bus_rtbl), 2},
324 .private_data = &apb_config, 514 .private_data = &apb_config,
325}; 515};
326 516
@@ -432,12 +622,12 @@ static struct clk dummy_apb_pclk;
432 622
433/* array of all spear 6xx clock lookups */ 623/* array of all spear 6xx clock lookups */
434static struct clk_lookup spear_clk_lookups[] = { 624static struct clk_lookup spear_clk_lookups[] = {
435 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk}, 625 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
436 /* root clks */ 626 /* root clks */
437 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 627 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
438 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, 628 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk},
439 /* clock derived from 32 KHz os clk */ 629 /* clock derived from 32 KHz os clk */
440 { .dev_id = "rtc", .clk = &rtc_clk}, 630 { .dev_id = "rtc-spear", .clk = &rtc_clk},
441 /* clock derived from 30 MHz os clk */ 631 /* clock derived from 30 MHz os clk */
442 { .con_id = "pll1_clk", .clk = &pll1_clk}, 632 { .con_id = "pll1_clk", .clk = &pll1_clk},
443 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk}, 633 { .con_id = "pll3_48m_clk", .clk = &pll3_48m_clk},
@@ -445,6 +635,12 @@ static struct clk_lookup spear_clk_lookups[] = {
445 /* clock derived from pll1 clk */ 635 /* clock derived from pll1 clk */
446 { .con_id = "cpu_clk", .clk = &cpu_clk}, 636 { .con_id = "cpu_clk", .clk = &cpu_clk},
447 { .con_id = "ahb_clk", .clk = &ahb_clk}, 637 { .con_id = "ahb_clk", .clk = &ahb_clk},
638 { .con_id = "uart_synth_clk", .clk = &uart_synth_clk},
639 { .con_id = "firda_synth_clk", .clk = &firda_synth_clk},
640 { .con_id = "clcd_synth_clk", .clk = &clcd_synth_clk},
641 { .con_id = "gpt0_synth_clk", .clk = &gpt0_synth_clk},
642 { .con_id = "gpt2_synth_clk", .clk = &gpt2_synth_clk},
643 { .con_id = "gpt3_synth_clk", .clk = &gpt3_synth_clk},
448 { .dev_id = "uart0", .clk = &uart0_clk}, 644 { .dev_id = "uart0", .clk = &uart0_clk},
449 { .dev_id = "uart1", .clk = &uart1_clk}, 645 { .dev_id = "uart1", .clk = &uart1_clk},
450 { .dev_id = "firda", .clk = &firda_clk}, 646 { .dev_id = "firda", .clk = &firda_clk},
@@ -454,22 +650,22 @@ static struct clk_lookup spear_clk_lookups[] = {
454 { .dev_id = "gpt2", .clk = &gpt2_clk}, 650 { .dev_id = "gpt2", .clk = &gpt2_clk},
455 { .dev_id = "gpt3", .clk = &gpt3_clk}, 651 { .dev_id = "gpt3", .clk = &gpt3_clk},
456 /* clock derived from pll3 clk */ 652 /* clock derived from pll3 clk */
457 { .dev_id = "usbh0", .clk = &usbh0_clk}, 653 { .dev_id = "designware_udc", .clk = &usbd_clk},
458 { .dev_id = "usbh1", .clk = &usbh1_clk}, 654 { .con_id = "usbh.0_clk", .clk = &usbh0_clk},
459 { .dev_id = "usbd", .clk = &usbd_clk}, 655 { .con_id = "usbh.1_clk", .clk = &usbh1_clk},
460 /* clock derived from ahb clk */ 656 /* clock derived from ahb clk */
461 { .con_id = "apb_clk", .clk = &apb_clk}, 657 { .con_id = "apb_clk", .clk = &apb_clk},
462 { .dev_id = "i2c", .clk = &i2c_clk}, 658 { .dev_id = "i2c_designware.0", .clk = &i2c_clk},
463 { .dev_id = "dma", .clk = &dma_clk}, 659 { .dev_id = "dma", .clk = &dma_clk},
464 { .dev_id = "jpeg", .clk = &jpeg_clk}, 660 { .dev_id = "jpeg", .clk = &jpeg_clk},
465 { .dev_id = "gmac", .clk = &gmac_clk}, 661 { .dev_id = "gmac", .clk = &gmac_clk},
466 { .dev_id = "smi", .clk = &smi_clk}, 662 { .dev_id = "smi", .clk = &smi_clk},
467 { .dev_id = "fsmc", .clk = &fsmc_clk}, 663 { .con_id = "fsmc", .clk = &fsmc_clk},
468 /* clock derived from apb clk */ 664 /* clock derived from apb clk */
469 { .dev_id = "adc", .clk = &adc_clk}, 665 { .dev_id = "adc", .clk = &adc_clk},
470 { .dev_id = "ssp0", .clk = &ssp0_clk}, 666 { .dev_id = "ssp-pl022.0", .clk = &ssp0_clk},
471 { .dev_id = "ssp1", .clk = &ssp1_clk}, 667 { .dev_id = "ssp-pl022.1", .clk = &ssp1_clk},
472 { .dev_id = "ssp2", .clk = &ssp2_clk}, 668 { .dev_id = "ssp-pl022.2", .clk = &ssp2_clk},
473 { .dev_id = "gpio0", .clk = &gpio0_clk}, 669 { .dev_id = "gpio0", .clk = &gpio0_clk},
474 { .dev_id = "gpio1", .clk = &gpio1_clk}, 670 { .dev_id = "gpio1", .clk = &gpio1_clk},
475 { .dev_id = "gpio2", .clk = &gpio2_clk}, 671 { .dev_id = "gpio2", .clk = &gpio2_clk},
diff --git a/arch/arm/mach-spear6xx/include/mach/entry-macro.S b/arch/arm/mach-spear6xx/include/mach/entry-macro.S
index 9eaecaeafcf0..8a0b0ed7b203 100644
--- a/arch/arm/mach-spear6xx/include/mach/entry-macro.S
+++ b/arch/arm/mach-spear6xx/include/mach/entry-macro.S
@@ -11,9 +11,8 @@
11 * warranty of any kind, whether express or implied. 11 * warranty of any kind, whether express or implied.
12 */ 12 */
13 13
14#include <mach/hardware.h>
15#include <mach/spear.h>
16#include <asm/hardware/vic.h> 14#include <asm/hardware/vic.h>
15#include <mach/hardware.h>
17 16
18 .macro disable_fiq 17 .macro disable_fiq
19 .endm 18 .endm
diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h
index 16205a538756..94cf4a648b57 100644
--- a/arch/arm/mach-spear6xx/include/mach/generic.h
+++ b/arch/arm/mach-spear6xx/include/mach/generic.h
@@ -14,11 +14,11 @@
14#ifndef __MACH_GENERIC_H 14#ifndef __MACH_GENERIC_H
15#define __MACH_GENERIC_H 15#define __MACH_GENERIC_H
16 16
17#include <asm/mach/time.h>
18#include <asm/mach/map.h>
19#include <linux/init.h> 17#include <linux/init.h>
20#include <linux/platform_device.h> 18#include <linux/platform_device.h>
21#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
20#include <asm/mach/time.h>
21#include <asm/mach/map.h>
22 22
23/* 23/*
24 * Each GPT has 2 timer channels 24 * Each GPT has 2 timer channels
@@ -31,9 +31,10 @@
31/* Add spear6xx family device structure declarations here */ 31/* Add spear6xx family device structure declarations here */
32extern struct amba_device gpio_device[]; 32extern struct amba_device gpio_device[];
33extern struct amba_device uart_device[]; 33extern struct amba_device uart_device[];
34extern struct sys_timer spear_sys_timer; 34extern struct sys_timer spear6xx_timer;
35 35
36/* Add spear6xx family function declarations here */ 36/* Add spear6xx family function declarations here */
37void __init spear_setup_timer(void);
37void __init spear6xx_map_io(void); 38void __init spear6xx_map_io(void);
38void __init spear6xx_init_irq(void); 39void __init spear6xx_init_irq(void);
39void __init spear6xx_init(void); 40void __init spear6xx_init(void);
diff --git a/arch/arm/mach-spear6xx/include/mach/hardware.h b/arch/arm/mach-spear6xx/include/mach/hardware.h
index 7545116deca9..0b3f96ae2848 100644
--- a/arch/arm/mach-spear6xx/include/mach/hardware.h
+++ b/arch/arm/mach-spear6xx/include/mach/hardware.h
@@ -14,8 +14,10 @@
14#ifndef __MACH_HARDWARE_H 14#ifndef __MACH_HARDWARE_H
15#define __MACH_HARDWARE_H 15#define __MACH_HARDWARE_H
16 16
17#include <plat/hardware.h>
18#include <mach/spear.h>
19
17/* Vitual to physical translation of statically mapped space */ 20/* Vitual to physical translation of statically mapped space */
18#define IO_ADDRESS(x) (x | 0xF0000000) 21#define IO_ADDRESS(x) (x | 0xF0000000)
19 22
20#endif /* __MACH_HARDWARE_H */ 23#endif /* __MACH_HARDWARE_H */
21
diff --git a/arch/arm/mach-spear6xx/include/mach/misc_regs.h b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
index 03908036b0d0..68c20a007b0d 100644
--- a/arch/arm/mach-spear6xx/include/mach/misc_regs.h
+++ b/arch/arm/mach-spear6xx/include/mach/misc_regs.h
@@ -14,16 +14,16 @@
14#ifndef __MACH_MISC_REGS_H 14#ifndef __MACH_MISC_REGS_H
15#define __MACH_MISC_REGS_H 15#define __MACH_MISC_REGS_H
16 16
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19#define MISC_BASE VA_SPEAR6XX_ICM3_MISC_REG_BASE 19#define MISC_BASE IOMEM(VA_SPEAR6XX_ICM3_MISC_REG_BASE)
20 20
21#define SOC_CFG_CTR ((unsigned int *)(MISC_BASE + 0x000)) 21#define SOC_CFG_CTR (MISC_BASE + 0x000)
22#define DIAG_CFG_CTR ((unsigned int *)(MISC_BASE + 0x004)) 22#define DIAG_CFG_CTR (MISC_BASE + 0x004)
23#define PLL1_CTR ((unsigned int *)(MISC_BASE + 0x008)) 23#define PLL1_CTR (MISC_BASE + 0x008)
24#define PLL1_FRQ ((unsigned int *)(MISC_BASE + 0x00C)) 24#define PLL1_FRQ (MISC_BASE + 0x00C)
25#define PLL1_MOD ((unsigned int *)(MISC_BASE + 0x010)) 25#define PLL1_MOD (MISC_BASE + 0x010)
26#define PLL2_CTR ((unsigned int *)(MISC_BASE + 0x014)) 26#define PLL2_CTR (MISC_BASE + 0x014)
27/* PLL_CTR register masks */ 27/* PLL_CTR register masks */
28#define PLL_ENABLE 2 28#define PLL_ENABLE 2
29#define PLL_MODE_SHIFT 4 29#define PLL_MODE_SHIFT 4
@@ -33,7 +33,7 @@
33#define PLL_MODE_DITH_DSB 2 33#define PLL_MODE_DITH_DSB 2
34#define PLL_MODE_DITH_SSB 3 34#define PLL_MODE_DITH_SSB 3
35 35
36#define PLL2_FRQ ((unsigned int *)(MISC_BASE + 0x018)) 36#define PLL2_FRQ (MISC_BASE + 0x018)
37/* PLL FRQ register masks */ 37/* PLL FRQ register masks */
38#define PLL_DIV_N_SHIFT 0 38#define PLL_DIV_N_SHIFT 0
39#define PLL_DIV_N_MASK 0xFF 39#define PLL_DIV_N_MASK 0xFF
@@ -44,16 +44,16 @@
44#define PLL_DITH_FDBK_M_SHIFT 16 44#define PLL_DITH_FDBK_M_SHIFT 16
45#define PLL_DITH_FDBK_M_MASK 0xFFFF 45#define PLL_DITH_FDBK_M_MASK 0xFFFF
46 46
47#define PLL2_MOD ((unsigned int *)(MISC_BASE + 0x01C)) 47#define PLL2_MOD (MISC_BASE + 0x01C)
48#define PLL_CLK_CFG ((unsigned int *)(MISC_BASE + 0x020)) 48#define PLL_CLK_CFG (MISC_BASE + 0x020)
49#define CORE_CLK_CFG ((unsigned int *)(MISC_BASE + 0x024)) 49#define CORE_CLK_CFG (MISC_BASE + 0x024)
50/* CORE CLK CFG register masks */ 50/* CORE CLK CFG register masks */
51#define PLL_HCLK_RATIO_SHIFT 10 51#define PLL_HCLK_RATIO_SHIFT 10
52#define PLL_HCLK_RATIO_MASK 0x3 52#define PLL_HCLK_RATIO_MASK 0x3
53#define HCLK_PCLK_RATIO_SHIFT 8 53#define HCLK_PCLK_RATIO_SHIFT 8
54#define HCLK_PCLK_RATIO_MASK 0x3 54#define HCLK_PCLK_RATIO_MASK 0x3
55 55
56#define PERIP_CLK_CFG ((unsigned int *)(MISC_BASE + 0x028)) 56#define PERIP_CLK_CFG (MISC_BASE + 0x028)
57/* PERIP_CLK_CFG register masks */ 57/* PERIP_CLK_CFG register masks */
58#define CLCD_CLK_SHIFT 2 58#define CLCD_CLK_SHIFT 2
59#define CLCD_CLK_MASK 0x3 59#define CLCD_CLK_MASK 0x3
@@ -66,10 +66,10 @@
66#define GPT2_CLK_SHIFT 11 66#define GPT2_CLK_SHIFT 11
67#define GPT3_CLK_SHIFT 12 67#define GPT3_CLK_SHIFT 12
68#define GPT_CLK_MASK 0x1 68#define GPT_CLK_MASK 0x1
69#define AUX_CLK_PLL3_MASK 0 69#define AUX_CLK_PLL3_VAL 0
70#define AUX_CLK_PLL1_MASK 1 70#define AUX_CLK_PLL1_VAL 1
71 71
72#define PERIP1_CLK_ENB ((unsigned int *)(MISC_BASE + 0x02C)) 72#define PERIP1_CLK_ENB (MISC_BASE + 0x02C)
73/* PERIP1_CLK_ENB register masks */ 73/* PERIP1_CLK_ENB register masks */
74#define UART0_CLK_ENB 3 74#define UART0_CLK_ENB 3
75#define UART1_CLK_ENB 4 75#define UART1_CLK_ENB 4
@@ -95,34 +95,35 @@
95#define USBH0_CLK_ENB 25 95#define USBH0_CLK_ENB 25
96#define USBH1_CLK_ENB 26 96#define USBH1_CLK_ENB 26
97 97
98#define SOC_CORE_ID ((unsigned int *)(MISC_BASE + 0x030)) 98#define SOC_CORE_ID (MISC_BASE + 0x030)
99#define RAS_CLK_ENB ((unsigned int *)(MISC_BASE + 0x034)) 99#define RAS_CLK_ENB (MISC_BASE + 0x034)
100#define PERIP1_SOF_RST ((unsigned int *)(MISC_BASE + 0x038)) 100#define PERIP1_SOF_RST (MISC_BASE + 0x038)
101/* PERIP1_SOF_RST register masks */ 101/* PERIP1_SOF_RST register masks */
102#define JPEG_SOF_RST 8 102#define JPEG_SOF_RST 8
103 103
104#define SOC_USER_ID ((unsigned int *)(MISC_BASE + 0x03C)) 104#define SOC_USER_ID (MISC_BASE + 0x03C)
105#define RAS_SOF_RST ((unsigned int *)(MISC_BASE + 0x040)) 105#define RAS_SOF_RST (MISC_BASE + 0x040)
106#define PRSC1_CLK_CFG ((unsigned int *)(MISC_BASE + 0x044)) 106#define PRSC1_CLK_CFG (MISC_BASE + 0x044)
107#define PRSC2_CLK_CFG ((unsigned int *)(MISC_BASE + 0x048)) 107#define PRSC2_CLK_CFG (MISC_BASE + 0x048)
108#define PRSC3_CLK_CFG ((unsigned int *)(MISC_BASE + 0x04C)) 108#define PRSC3_CLK_CFG (MISC_BASE + 0x04C)
109/* gpt synthesizer register masks */ 109/* gpt synthesizer register masks */
110#define GPT_MSCALE_SHIFT 0 110#define GPT_MSCALE_SHIFT 0
111#define GPT_MSCALE_MASK 0xFFF 111#define GPT_MSCALE_MASK 0xFFF
112#define GPT_NSCALE_SHIFT 12 112#define GPT_NSCALE_SHIFT 12
113#define GPT_NSCALE_MASK 0xF 113#define GPT_NSCALE_MASK 0xF
114 114
115#define AMEM_CLK_CFG ((unsigned int *)(MISC_BASE + 0x050)) 115#define AMEM_CLK_CFG (MISC_BASE + 0x050)
116#define EXPI_CLK_CFG ((unsigned int *)(MISC_BASE + 0x054)) 116#define EXPI_CLK_CFG (MISC_BASE + 0x054)
117#define CLCD_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x05C)) 117#define CLCD_CLK_SYNT (MISC_BASE + 0x05C)
118#define FIRDA_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x060)) 118#define FIRDA_CLK_SYNT (MISC_BASE + 0x060)
119#define UART_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x064)) 119#define UART_CLK_SYNT (MISC_BASE + 0x064)
120#define GMAC_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x068)) 120#define GMAC_CLK_SYNT (MISC_BASE + 0x068)
121#define RAS1_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x06C)) 121#define RAS1_CLK_SYNT (MISC_BASE + 0x06C)
122#define RAS2_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x070)) 122#define RAS2_CLK_SYNT (MISC_BASE + 0x070)
123#define RAS3_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x074)) 123#define RAS3_CLK_SYNT (MISC_BASE + 0x074)
124#define RAS4_CLK_SYNT ((unsigned int *)(MISC_BASE + 0x078)) 124#define RAS4_CLK_SYNT (MISC_BASE + 0x078)
125/* aux clk synthesiser register masks for irda to ras4 */ 125/* aux clk synthesiser register masks for irda to ras4 */
126#define AUX_SYNT_ENB 31
126#define AUX_EQ_SEL_SHIFT 30 127#define AUX_EQ_SEL_SHIFT 30
127#define AUX_EQ_SEL_MASK 1 128#define AUX_EQ_SEL_MASK 1
128#define AUX_EQ1_SEL 0 129#define AUX_EQ1_SEL 0
@@ -132,42 +133,42 @@
132#define AUX_YSCALE_SHIFT 0 133#define AUX_YSCALE_SHIFT 0
133#define AUX_YSCALE_MASK 0xFFF 134#define AUX_YSCALE_MASK 0xFFF
134 135
135#define ICM1_ARB_CFG ((unsigned int *)(MISC_BASE + 0x07C)) 136#define ICM1_ARB_CFG (MISC_BASE + 0x07C)
136#define ICM2_ARB_CFG ((unsigned int *)(MISC_BASE + 0x080)) 137#define ICM2_ARB_CFG (MISC_BASE + 0x080)
137#define ICM3_ARB_CFG ((unsigned int *)(MISC_BASE + 0x084)) 138#define ICM3_ARB_CFG (MISC_BASE + 0x084)
138#define ICM4_ARB_CFG ((unsigned int *)(MISC_BASE + 0x088)) 139#define ICM4_ARB_CFG (MISC_BASE + 0x088)
139#define ICM5_ARB_CFG ((unsigned int *)(MISC_BASE + 0x08C)) 140#define ICM5_ARB_CFG (MISC_BASE + 0x08C)
140#define ICM6_ARB_CFG ((unsigned int *)(MISC_BASE + 0x090)) 141#define ICM6_ARB_CFG (MISC_BASE + 0x090)
141#define ICM7_ARB_CFG ((unsigned int *)(MISC_BASE + 0x094)) 142#define ICM7_ARB_CFG (MISC_BASE + 0x094)
142#define ICM8_ARB_CFG ((unsigned int *)(MISC_BASE + 0x098)) 143#define ICM8_ARB_CFG (MISC_BASE + 0x098)
143#define ICM9_ARB_CFG ((unsigned int *)(MISC_BASE + 0x09C)) 144#define ICM9_ARB_CFG (MISC_BASE + 0x09C)
144#define DMA_CHN_CFG ((unsigned int *)(MISC_BASE + 0x0A0)) 145#define DMA_CHN_CFG (MISC_BASE + 0x0A0)
145#define USB2_PHY_CFG ((unsigned int *)(MISC_BASE + 0x0A4)) 146#define USB2_PHY_CFG (MISC_BASE + 0x0A4)
146#define GMAC_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0A8)) 147#define GMAC_CFG_CTR (MISC_BASE + 0x0A8)
147#define EXPI_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0AC)) 148#define EXPI_CFG_CTR (MISC_BASE + 0x0AC)
148#define PRC1_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0C0)) 149#define PRC1_LOCK_CTR (MISC_BASE + 0x0C0)
149#define PRC2_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0C4)) 150#define PRC2_LOCK_CTR (MISC_BASE + 0x0C4)
150#define PRC3_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0C8)) 151#define PRC3_LOCK_CTR (MISC_BASE + 0x0C8)
151#define PRC4_LOCK_CTR ((unsigned int *)(MISC_BASE + 0x0CC)) 152#define PRC4_LOCK_CTR (MISC_BASE + 0x0CC)
152#define PRC1_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0D0)) 153#define PRC1_IRQ_CTR (MISC_BASE + 0x0D0)
153#define PRC2_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0D4)) 154#define PRC2_IRQ_CTR (MISC_BASE + 0x0D4)
154#define PRC3_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0D8)) 155#define PRC3_IRQ_CTR (MISC_BASE + 0x0D8)
155#define PRC4_IRQ_CTR ((unsigned int *)(MISC_BASE + 0x0DC)) 156#define PRC4_IRQ_CTR (MISC_BASE + 0x0DC)
156#define PWRDOWN_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0E0)) 157#define PWRDOWN_CFG_CTR (MISC_BASE + 0x0E0)
157#define COMPSSTL_1V8_CFG ((unsigned int *)(MISC_BASE + 0x0E4)) 158#define COMPSSTL_1V8_CFG (MISC_BASE + 0x0E4)
158#define COMPSSTL_2V5_CFG ((unsigned int *)(MISC_BASE + 0x0E8)) 159#define COMPSSTL_2V5_CFG (MISC_BASE + 0x0E8)
159#define COMPCOR_3V3_CFG ((unsigned int *)(MISC_BASE + 0x0EC)) 160#define COMPCOR_3V3_CFG (MISC_BASE + 0x0EC)
160#define SSTLPAD_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0F0)) 161#define SSTLPAD_CFG_CTR (MISC_BASE + 0x0F0)
161#define BIST1_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0F4)) 162#define BIST1_CFG_CTR (MISC_BASE + 0x0F4)
162#define BIST2_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0F8)) 163#define BIST2_CFG_CTR (MISC_BASE + 0x0F8)
163#define BIST3_CFG_CTR ((unsigned int *)(MISC_BASE + 0x0FC)) 164#define BIST3_CFG_CTR (MISC_BASE + 0x0FC)
164#define BIST4_CFG_CTR ((unsigned int *)(MISC_BASE + 0x100)) 165#define BIST4_CFG_CTR (MISC_BASE + 0x100)
165#define BIST5_CFG_CTR ((unsigned int *)(MISC_BASE + 0x104)) 166#define BIST5_CFG_CTR (MISC_BASE + 0x104)
166#define BIST1_STS_RES ((unsigned int *)(MISC_BASE + 0x108)) 167#define BIST1_STS_RES (MISC_BASE + 0x108)
167#define BIST2_STS_RES ((unsigned int *)(MISC_BASE + 0x10C)) 168#define BIST2_STS_RES (MISC_BASE + 0x10C)
168#define BIST3_STS_RES ((unsigned int *)(MISC_BASE + 0x110)) 169#define BIST3_STS_RES (MISC_BASE + 0x110)
169#define BIST4_STS_RES ((unsigned int *)(MISC_BASE + 0x114)) 170#define BIST4_STS_RES (MISC_BASE + 0x114)
170#define BIST5_STS_RES ((unsigned int *)(MISC_BASE + 0x118)) 171#define BIST5_STS_RES (MISC_BASE + 0x118)
171#define SYSERR_CFG_CTR ((unsigned int *)(MISC_BASE + 0x11C)) 172#define SYSERR_CFG_CTR (MISC_BASE + 0x11C)
172 173
173#endif /* __MACH_MISC_REGS_H */ 174#endif /* __MACH_MISC_REGS_H */
diff --git a/arch/arm/mach-spear6xx/include/mach/spear.h b/arch/arm/mach-spear6xx/include/mach/spear.h
index a835f5b6b182..7fd621532def 100644
--- a/arch/arm/mach-spear6xx/include/mach/spear.h
+++ b/arch/arm/mach-spear6xx/include/mach/spear.h
@@ -14,153 +14,70 @@
14#ifndef __MACH_SPEAR6XX_H 14#ifndef __MACH_SPEAR6XX_H
15#define __MACH_SPEAR6XX_H 15#define __MACH_SPEAR6XX_H
16 16
17#include <mach/hardware.h> 17#include <asm/memory.h>
18#include <mach/spear600.h> 18#include <mach/spear600.h>
19 19
20#define SPEAR6XX_ML_SDRAM_BASE 0x00000000 20#define SPEAR6XX_ML_SDRAM_BASE UL(0x00000000)
21#define SPEAR6XX_ML_SDRAM_SIZE 0x40000000
22
23/* ICM1 - Low speed connection */ 21/* ICM1 - Low speed connection */
24#define SPEAR6XX_ICM1_BASE 0xD0000000 22#define SPEAR6XX_ICM1_BASE UL(0xD0000000)
25#define SPEAR6XX_ICM1_SIZE 0x08000000
26 23
27#define SPEAR6XX_ICM1_UART0_BASE 0xD0000000 24#define SPEAR6XX_ICM1_UART0_BASE UL(0xD0000000)
28#define VA_SPEAR6XX_ICM1_UART0_BASE IO_ADDRESS(SPEAR6XX_ICM1_UART0_BASE) 25#define VA_SPEAR6XX_ICM1_UART0_BASE IO_ADDRESS(SPEAR6XX_ICM1_UART0_BASE)
29#define SPEAR6XX_ICM1_UART0_SIZE 0x00080000
30
31#define SPEAR6XX_ICM1_UART1_BASE 0xD0080000
32#define SPEAR6XX_ICM1_UART1_SIZE 0x00080000
33
34#define SPEAR6XX_ICM1_SSP0_BASE 0xD0100000
35#define SPEAR6XX_ICM1_SSP0_SIZE 0x00080000
36
37#define SPEAR6XX_ICM1_SSP1_BASE 0xD0180000
38#define SPEAR6XX_ICM1_SSP1_SIZE 0x00080000
39
40#define SPEAR6XX_ICM1_I2C_BASE 0xD0200000
41#define SPEAR6XX_ICM1_I2C_SIZE 0x00080000
42 26
43#define SPEAR6XX_ICM1_JPEG_BASE 0xD0800000 27#define SPEAR6XX_ICM1_UART1_BASE UL(0xD0080000)
44#define SPEAR6XX_ICM1_JPEG_SIZE 0x00800000 28#define SPEAR6XX_ICM1_SSP0_BASE UL(0xD0100000)
45 29#define SPEAR6XX_ICM1_SSP1_BASE UL(0xD0180000)
46#define SPEAR6XX_ICM1_IRDA_BASE 0xD1000000 30#define SPEAR6XX_ICM1_I2C_BASE UL(0xD0200000)
47#define SPEAR6XX_ICM1_IRDA_SIZE 0x00800000 31#define SPEAR6XX_ICM1_JPEG_BASE UL(0xD0800000)
48 32#define SPEAR6XX_ICM1_IRDA_BASE UL(0xD1000000)
49#define SPEAR6XX_ICM1_FSMC_BASE 0xD1800000 33#define SPEAR6XX_ICM1_FSMC_BASE UL(0xD1800000)
50#define SPEAR6XX_ICM1_FSMC_SIZE 0x00800000 34#define SPEAR6XX_ICM1_NAND_BASE UL(0xD2000000)
51 35#define SPEAR6XX_ICM1_SRAM_BASE UL(0xD2800000)
52#define SPEAR6XX_ICM1_NAND_BASE 0xD2000000
53#define SPEAR6XX_ICM1_NAND_SIZE 0x00800000
54
55#define SPEAR6XX_ICM1_SRAM_BASE 0xD2800000
56#define SPEAR6XX_ICM1_SRAM_SIZE 0x00800000
57 36
58/* ICM2 - Application Subsystem */ 37/* ICM2 - Application Subsystem */
59#define SPEAR6XX_ICM2_BASE 0xD8000000 38#define SPEAR6XX_ICM2_BASE UL(0xD8000000)
60#define SPEAR6XX_ICM2_SIZE 0x08000000 39#define SPEAR6XX_ICM2_TMR0_BASE UL(0xD8000000)
61 40#define SPEAR6XX_ICM2_TMR1_BASE UL(0xD8080000)
62#define SPEAR6XX_ICM2_TMR0_BASE 0xD8000000 41#define SPEAR6XX_ICM2_GPIO_BASE UL(0xD8100000)
63#define SPEAR6XX_ICM2_TMR0_SIZE 0x00080000 42#define SPEAR6XX_ICM2_SSP2_BASE UL(0xD8180000)
64 43#define SPEAR6XX_ICM2_ADC_BASE UL(0xD8200000)
65#define SPEAR6XX_ICM2_TMR1_BASE 0xD8080000
66#define SPEAR6XX_ICM2_TMR1_SIZE 0x00080000
67
68#define SPEAR6XX_ICM2_GPIO_BASE 0xD8100000
69#define SPEAR6XX_ICM2_GPIO_SIZE 0x00080000
70
71#define SPEAR6XX_ICM2_SPI2_BASE 0xD8180000
72#define SPEAR6XX_ICM2_SPI2_SIZE 0x00080000
73
74#define SPEAR6XX_ICM2_ADC_BASE 0xD8200000
75#define SPEAR6XX_ICM2_ADC_SIZE 0x00080000
76 44
77/* ML-1, 2 - Multi Layer CPU Subsystem */ 45/* ML-1, 2 - Multi Layer CPU Subsystem */
78#define SPEAR6XX_ML_CPU_BASE 0xF0000000 46#define SPEAR6XX_ML_CPU_BASE UL(0xF0000000)
79#define SPEAR6XX_ML_CPU_SIZE 0x08000000 47#define SPEAR6XX_CPU_TMR_BASE UL(0xF0000000)
80 48#define SPEAR6XX_CPU_GPIO_BASE UL(0xF0100000)
81#define SPEAR6XX_CPU_TMR_BASE 0xF0000000 49#define SPEAR6XX_CPU_VIC_SEC_BASE UL(0xF1000000)
82#define SPEAR6XX_CPU_TMR_SIZE 0x00100000
83
84#define SPEAR6XX_CPU_GPIO_BASE 0xF0100000
85#define SPEAR6XX_CPU_GPIO_SIZE 0x00100000
86
87#define SPEAR6XX_CPU_VIC_SEC_BASE 0xF1000000
88#define VA_SPEAR6XX_CPU_VIC_SEC_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_SEC_BASE) 50#define VA_SPEAR6XX_CPU_VIC_SEC_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_SEC_BASE)
89#define SPEAR6XX_CPU_VIC_SEC_SIZE 0x00100000 51#define SPEAR6XX_CPU_VIC_PRI_BASE UL(0xF1100000)
90
91#define SPEAR6XX_CPU_VIC_PRI_BASE 0xF1100000
92#define VA_SPEAR6XX_CPU_VIC_PRI_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_PRI_BASE) 52#define VA_SPEAR6XX_CPU_VIC_PRI_BASE IO_ADDRESS(SPEAR6XX_CPU_VIC_PRI_BASE)
93#define SPEAR6XX_CPU_VIC_PRI_SIZE 0x00100000
94 53
95/* ICM3 - Basic Subsystem */ 54/* ICM3 - Basic Subsystem */
96#define SPEAR6XX_ICM3_BASE 0xF8000000 55#define SPEAR6XX_ICM3_BASE UL(0xF8000000)
97#define SPEAR6XX_ICM3_SIZE 0x08000000 56#define SPEAR6XX_ICM3_SMEM_BASE UL(0xF8000000)
98 57#define SPEAR6XX_ICM3_SMI_CTRL_BASE UL(0xFC000000)
99#define SPEAR6XX_ICM3_SMEM_BASE 0xF8000000 58#define SPEAR6XX_ICM3_CLCD_BASE UL(0xFC200000)
100#define SPEAR6XX_ICM3_SMEM_SIZE 0x04000000 59#define SPEAR6XX_ICM3_DMA_BASE UL(0xFC400000)
101 60#define SPEAR6XX_ICM3_SDRAM_CTRL_BASE UL(0xFC600000)
102#define SPEAR6XX_ICM3_SMI_CTRL_BASE 0xFC000000 61#define SPEAR6XX_ICM3_TMR_BASE UL(0xFC800000)
103#define SPEAR6XX_ICM3_SMI_CTRL_SIZE 0x00200000 62#define SPEAR6XX_ICM3_WDT_BASE UL(0xFC880000)
104 63#define SPEAR6XX_ICM3_RTC_BASE UL(0xFC900000)
105#define SPEAR6XX_ICM3_CLCD_BASE 0xFC200000 64#define SPEAR6XX_ICM3_GPIO_BASE UL(0xFC980000)
106#define SPEAR6XX_ICM3_CLCD_SIZE 0x00200000 65#define SPEAR6XX_ICM3_SYS_CTRL_BASE UL(0xFCA00000)
107
108#define SPEAR6XX_ICM3_DMA_BASE 0xFC400000
109#define SPEAR6XX_ICM3_DMA_SIZE 0x00200000
110
111#define SPEAR6XX_ICM3_SDRAM_CTRL_BASE 0xFC600000
112#define SPEAR6XX_ICM3_SDRAM_CTRL_SIZE 0x00200000
113
114#define SPEAR6XX_ICM3_TMR_BASE 0xFC800000
115#define SPEAR6XX_ICM3_TMR_SIZE 0x00080000
116
117#define SPEAR6XX_ICM3_WDT_BASE 0xFC880000
118#define SPEAR6XX_ICM3_WDT_SIZE 0x00080000
119
120#define SPEAR6XX_ICM3_RTC_BASE 0xFC900000
121#define SPEAR6XX_ICM3_RTC_SIZE 0x00080000
122
123#define SPEAR6XX_ICM3_GPIO_BASE 0xFC980000
124#define SPEAR6XX_ICM3_GPIO_SIZE 0x00080000
125
126#define SPEAR6XX_ICM3_SYS_CTRL_BASE 0xFCA00000
127#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR6XX_ICM3_SYS_CTRL_BASE) 66#define VA_SPEAR6XX_ICM3_SYS_CTRL_BASE IO_ADDRESS(SPEAR6XX_ICM3_SYS_CTRL_BASE)
128#define SPEAR6XX_ICM3_SYS_CTRL_SIZE 0x00080000 67#define SPEAR6XX_ICM3_MISC_REG_BASE UL(0xFCA80000)
129
130#define SPEAR6XX_ICM3_MISC_REG_BASE 0xFCA80000
131#define VA_SPEAR6XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR6XX_ICM3_MISC_REG_BASE) 68#define VA_SPEAR6XX_ICM3_MISC_REG_BASE IO_ADDRESS(SPEAR6XX_ICM3_MISC_REG_BASE)
132#define SPEAR6XX_ICM3_MISC_REG_SIZE 0x00080000
133 69
134/* ICM4 - High Speed Connection */ 70/* ICM4 - High Speed Connection */
135#define SPEAR6XX_ICM4_BASE 0xE0000000 71#define SPEAR6XX_ICM4_BASE UL(0xE0000000)
136#define SPEAR6XX_ICM4_SIZE 0x08000000 72#define SPEAR6XX_ICM4_GMAC_BASE UL(0xE0800000)
137 73#define SPEAR6XX_ICM4_USBD_FIFO_BASE UL(0xE1000000)
138#define SPEAR6XX_ICM4_GMAC_BASE 0xE0800000 74#define SPEAR6XX_ICM4_USBD_CSR_BASE UL(0xE1100000)
139#define SPEAR6XX_ICM4_GMAC_SIZE 0x00800000 75#define SPEAR6XX_ICM4_USBD_PLDT_BASE UL(0xE1200000)
140 76#define SPEAR6XX_ICM4_USB_EHCI0_BASE UL(0xE1800000)
141#define SPEAR6XX_ICM4_USBD_FIFO_BASE 0xE1000000 77#define SPEAR6XX_ICM4_USB_OHCI0_BASE UL(0xE1900000)
142#define SPEAR6XX_ICM4_USBD_FIFO_SIZE 0x00100000 78#define SPEAR6XX_ICM4_USB_EHCI1_BASE UL(0xE2000000)
143 79#define SPEAR6XX_ICM4_USB_OHCI1_BASE UL(0xE2100000)
144#define SPEAR6XX_ICM4_USBD_CSR_BASE 0xE1100000 80#define SPEAR6XX_ICM4_USB_ARB_BASE UL(0xE2800000)
145#define SPEAR6XX_ICM4_USBD_CSR_SIZE 0x00100000
146
147#define SPEAR6XX_ICM4_USBD_PLDT_BASE 0xE1200000
148#define SPEAR6XX_ICM4_USBD_PLDT_SIZE 0x00100000
149
150#define SPEAR6XX_ICM4_USB_EHCI0_BASE 0xE1800000
151#define SPEAR6XX_ICM4_USB_EHCI0_SIZE 0x00100000
152
153#define SPEAR6XX_ICM4_USB_OHCI0_BASE 0xE1900000
154#define SPEAR6XX_ICM4_USB_OHCI0_SIZE 0x00100000
155
156#define SPEAR6XX_ICM4_USB_EHCI1_BASE 0xE2000000
157#define SPEAR6XX_ICM4_USB_EHCI1_SIZE 0x00100000
158
159#define SPEAR6XX_ICM4_USB_OHCI1_BASE 0xE2100000
160#define SPEAR6XX_ICM4_USB_OHCI1_SIZE 0x00100000
161
162#define SPEAR6XX_ICM4_USB_ARB_BASE 0xE2800000
163#define SPEAR6XX_ICM4_USB_ARB_SIZE 0x00010000
164 81
165/* Debug uart for linux, will be used for debug and uncompress messages */ 82/* Debug uart for linux, will be used for debug and uncompress messages */
166#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE 83#define SPEAR_DBG_UART_BASE SPEAR6XX_ICM1_UART0_BASE
diff --git a/arch/arm/mach-spear6xx/spear600.c b/arch/arm/mach-spear6xx/spear600.c
index 5c484c433dc1..d0e6eeae9b04 100644
--- a/arch/arm/mach-spear6xx/spear600.c
+++ b/arch/arm/mach-spear6xx/spear600.c
@@ -14,7 +14,7 @@
14#include <linux/ptrace.h> 14#include <linux/ptrace.h>
15#include <asm/irq.h> 15#include <asm/irq.h>
16#include <mach/generic.h> 16#include <mach/generic.h>
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19/* Add spear600 specific devices here */ 19/* Add spear600 specific devices here */
20 20
diff --git a/arch/arm/mach-spear6xx/spear600_evb.c b/arch/arm/mach-spear6xx/spear600_evb.c
index daff8d04f7b6..f19cefe91a2b 100644
--- a/arch/arm/mach-spear6xx/spear600_evb.c
+++ b/arch/arm/mach-spear6xx/spear600_evb.c
@@ -14,7 +14,7 @@
14#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
15#include <asm/mach-types.h> 15#include <asm/mach-types.h>
16#include <mach/generic.h> 16#include <mach/generic.h>
17#include <mach/spear.h> 17#include <mach/hardware.h>
18 18
19static struct amba_device *amba_devs[] __initdata = { 19static struct amba_device *amba_devs[] __initdata = {
20 &gpio_device[0], 20 &gpio_device[0],
@@ -46,6 +46,6 @@ MACHINE_START(SPEAR600, "ST-SPEAR600-EVB")
46 .boot_params = 0x00000100, 46 .boot_params = 0x00000100,
47 .map_io = spear6xx_map_io, 47 .map_io = spear6xx_map_io,
48 .init_irq = spear6xx_init_irq, 48 .init_irq = spear6xx_init_irq,
49 .timer = &spear_sys_timer, 49 .timer = &spear6xx_timer,
50 .init_machine = spear600_evb_init, 50 .init_machine = spear600_evb_init,
51MACHINE_END 51MACHINE_END
diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c
index f2fe14e8471d..981812961ac7 100644
--- a/arch/arm/mach-spear6xx/spear6xx.c
+++ b/arch/arm/mach-spear6xx/spear6xx.c
@@ -18,9 +18,9 @@
18#include <asm/hardware/vic.h> 18#include <asm/hardware/vic.h>
19#include <asm/irq.h> 19#include <asm/irq.h>
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <mach/irqs.h>
22#include <mach/generic.h> 21#include <mach/generic.h>
23#include <mach/spear.h> 22#include <mach/hardware.h>
23#include <mach/irqs.h>
24 24
25/* Add spear6xx machines common devices here */ 25/* Add spear6xx machines common devices here */
26/* uart device registration */ 26/* uart device registration */
@@ -31,8 +31,7 @@ struct amba_device uart_device[] = {
31 }, 31 },
32 .res = { 32 .res = {
33 .start = SPEAR6XX_ICM1_UART0_BASE, 33 .start = SPEAR6XX_ICM1_UART0_BASE,
34 .end = SPEAR6XX_ICM1_UART0_BASE + 34 .end = SPEAR6XX_ICM1_UART0_BASE + SZ_4K - 1,
35 SPEAR6XX_ICM1_UART0_SIZE - 1,
36 .flags = IORESOURCE_MEM, 35 .flags = IORESOURCE_MEM,
37 }, 36 },
38 .irq = {IRQ_UART_0, NO_IRQ}, 37 .irq = {IRQ_UART_0, NO_IRQ},
@@ -42,8 +41,7 @@ struct amba_device uart_device[] = {
42 }, 41 },
43 .res = { 42 .res = {
44 .start = SPEAR6XX_ICM1_UART1_BASE, 43 .start = SPEAR6XX_ICM1_UART1_BASE,
45 .end = SPEAR6XX_ICM1_UART1_BASE + 44 .end = SPEAR6XX_ICM1_UART1_BASE + SZ_4K - 1,
46 SPEAR6XX_ICM1_UART1_SIZE - 1,
47 .flags = IORESOURCE_MEM, 45 .flags = IORESOURCE_MEM,
48 }, 46 },
49 .irq = {IRQ_UART_1, NO_IRQ}, 47 .irq = {IRQ_UART_1, NO_IRQ},
@@ -72,8 +70,7 @@ struct amba_device gpio_device[] = {
72 }, 70 },
73 .res = { 71 .res = {
74 .start = SPEAR6XX_CPU_GPIO_BASE, 72 .start = SPEAR6XX_CPU_GPIO_BASE,
75 .end = SPEAR6XX_CPU_GPIO_BASE + 73 .end = SPEAR6XX_CPU_GPIO_BASE + SZ_4K - 1,
76 SPEAR6XX_CPU_GPIO_SIZE - 1,
77 .flags = IORESOURCE_MEM, 74 .flags = IORESOURCE_MEM,
78 }, 75 },
79 .irq = {IRQ_LOCAL_GPIO, NO_IRQ}, 76 .irq = {IRQ_LOCAL_GPIO, NO_IRQ},
@@ -84,8 +81,7 @@ struct amba_device gpio_device[] = {
84 }, 81 },
85 .res = { 82 .res = {
86 .start = SPEAR6XX_ICM3_GPIO_BASE, 83 .start = SPEAR6XX_ICM3_GPIO_BASE,
87 .end = SPEAR6XX_ICM3_GPIO_BASE + 84 .end = SPEAR6XX_ICM3_GPIO_BASE + SZ_4K - 1,
88 SPEAR6XX_ICM3_GPIO_SIZE - 1,
89 .flags = IORESOURCE_MEM, 85 .flags = IORESOURCE_MEM,
90 }, 86 },
91 .irq = {IRQ_BASIC_GPIO, NO_IRQ}, 87 .irq = {IRQ_BASIC_GPIO, NO_IRQ},
@@ -96,8 +92,7 @@ struct amba_device gpio_device[] = {
96 }, 92 },
97 .res = { 93 .res = {
98 .start = SPEAR6XX_ICM2_GPIO_BASE, 94 .start = SPEAR6XX_ICM2_GPIO_BASE,
99 .end = SPEAR6XX_ICM2_GPIO_BASE + 95 .end = SPEAR6XX_ICM2_GPIO_BASE + SZ_4K - 1,
100 SPEAR6XX_ICM2_GPIO_SIZE - 1,
101 .flags = IORESOURCE_MEM, 96 .flags = IORESOURCE_MEM,
102 }, 97 },
103 .irq = {IRQ_APPL_GPIO, NO_IRQ}, 98 .irq = {IRQ_APPL_GPIO, NO_IRQ},
@@ -122,27 +117,27 @@ static struct map_desc spear6xx_io_desc[] __initdata = {
122 { 117 {
123 .virtual = VA_SPEAR6XX_ICM1_UART0_BASE, 118 .virtual = VA_SPEAR6XX_ICM1_UART0_BASE,
124 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE), 119 .pfn = __phys_to_pfn(SPEAR6XX_ICM1_UART0_BASE),
125 .length = SPEAR6XX_ICM1_UART0_SIZE, 120 .length = SZ_4K,
126 .type = MT_DEVICE 121 .type = MT_DEVICE
127 }, { 122 }, {
128 .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE, 123 .virtual = VA_SPEAR6XX_CPU_VIC_PRI_BASE,
129 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE), 124 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_PRI_BASE),
130 .length = SPEAR6XX_CPU_VIC_PRI_SIZE, 125 .length = SZ_4K,
131 .type = MT_DEVICE 126 .type = MT_DEVICE
132 }, { 127 }, {
133 .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE, 128 .virtual = VA_SPEAR6XX_CPU_VIC_SEC_BASE,
134 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE), 129 .pfn = __phys_to_pfn(SPEAR6XX_CPU_VIC_SEC_BASE),
135 .length = SPEAR6XX_CPU_VIC_SEC_SIZE, 130 .length = SZ_4K,
136 .type = MT_DEVICE 131 .type = MT_DEVICE
137 }, { 132 }, {
138 .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE, 133 .virtual = VA_SPEAR6XX_ICM3_SYS_CTRL_BASE,
139 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE), 134 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_SYS_CTRL_BASE),
140 .length = SPEAR6XX_ICM3_MISC_REG_BASE, 135 .length = SZ_4K,
141 .type = MT_DEVICE 136 .type = MT_DEVICE
142 }, { 137 }, {
143 .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE, 138 .virtual = VA_SPEAR6XX_ICM3_MISC_REG_BASE,
144 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE), 139 .pfn = __phys_to_pfn(SPEAR6XX_ICM3_MISC_REG_BASE),
145 .length = SPEAR6XX_ICM3_MISC_REG_SIZE, 140 .length = SZ_4K,
146 .type = MT_DEVICE 141 .type = MT_DEVICE
147 }, 142 },
148}; 143};
@@ -155,3 +150,34 @@ void __init spear6xx_map_io(void)
155 /* This will initialize clock framework */ 150 /* This will initialize clock framework */
156 clk_init(); 151 clk_init();
157} 152}
153
154static void __init spear6xx_timer_init(void)
155{
156 char pclk_name[] = "pll3_48m_clk";
157 struct clk *gpt_clk, *pclk;
158
159 /* get the system timer clock */
160 gpt_clk = clk_get_sys("gpt0", NULL);
161 if (IS_ERR(gpt_clk)) {
162 pr_err("%s:couldn't get clk for gpt\n", __func__);
163 BUG();
164 }
165
166 /* get the suitable parent clock for timer*/
167 pclk = clk_get(NULL, pclk_name);
168 if (IS_ERR(pclk)) {
169 pr_err("%s:couldn't get %s as parent for gpt\n",
170 __func__, pclk_name);
171 BUG();
172 }
173
174 clk_set_parent(gpt_clk, pclk);
175 clk_put(gpt_clk);
176 clk_put(pclk);
177
178 spear_setup_timer();
179}
180
181struct sys_timer spear6xx_timer = {
182 .init = spear6xx_timer_init,
183};
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h
index 66ad2760c621..04c779832c78 100644
--- a/arch/arm/mach-tegra/include/mach/kbc.h
+++ b/arch/arm/mach-tegra/include/mach/kbc.h
@@ -57,5 +57,6 @@ struct tegra_kbc_platform_data {
57 const struct matrix_keymap_data *keymap_data; 57 const struct matrix_keymap_data *keymap_data;
58 58
59 bool wakeup; 59 bool wakeup;
60 bool use_fn_map;
60}; 61};
61#endif 62#endif
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 247caa3400d0..203b986280f5 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -6,6 +6,7 @@ config UX500_SOC_COMMON
6 select ARM_GIC 6 select ARM_GIC
7 select HAS_MTU 7 select HAS_MTU
8 select NOMADIK_GPIO 8 select NOMADIK_GPIO
9 select ARM_ERRATA_753970
9 10
10menu "Ux500 SoC" 11menu "Ux500 SoC"
11 12
diff --git a/arch/arm/mach-vt8500/Kconfig b/arch/arm/mach-vt8500/Kconfig
new file mode 100644
index 000000000000..2c20a341c11a
--- /dev/null
+++ b/arch/arm/mach-vt8500/Kconfig
@@ -0,0 +1,73 @@
1if ARCH_VT8500
2
3config VTWM_VERSION_VT8500
4 bool
5
6config VTWM_VERSION_WM8505
7 bool
8
9config MACH_BV07
10 bool "Benign BV07-8500 Mini Netbook"
11 depends on ARCH_VT8500
12 select VTWM_VERSION_VT8500
13 help
14 Add support for the inexpensive 7-inch netbooks sold by many
15 Chinese distributors under various names. Note that there are
16 many hardware implementations in identical exterior, make sure
17 that yours is indeed based on a VIA VT8500 chip.
18
19config MACH_WM8505_7IN_NETBOOK
20 bool "WM8505 7-inch generic netbook"
21 depends on ARCH_VT8500
22 select VTWM_VERSION_WM8505
23 help
24 Add support for the inexpensive 7-inch netbooks sold by many
25 Chinese distributors under various names. Note that there are
26 many hardware implementations in identical exterior, make sure
27 that yours is indeed based on a WonderMedia WM8505 chip.
28
29comment "LCD panel size"
30
31config WMT_PANEL_800X480
32 bool "7-inch with 800x480 resolution"
33 depends on (FB_VT8500 || FB_WM8505)
34 default y
35 help
36 These are found in most of the netbooks in generic cases, as
37 well as in Eken M001 tablets and possibly elsewhere.
38
39 To select this panel at runtime, say y here and append
40 'panel=800x480' to your kernel command line. Otherwise, the
41 largest one available will be used.
42
43config WMT_PANEL_800X600
44 bool "8-inch with 800x600 resolution"
45 depends on (FB_VT8500 || FB_WM8505)
46 help
47 These are found in Eken M003 tablets and possibly elsewhere.
48
49 To select this panel at runtime, say y here and append
50 'panel=800x600' to your kernel command line. Otherwise, the
51 largest one available will be used.
52
53config WMT_PANEL_1024X576
54 bool "10-inch with 1024x576 resolution"
55 depends on (FB_VT8500 || FB_WM8505)
56 help
57 These are found in CherryPal netbooks and possibly elsewhere.
58
59 To select this panel at runtime, say y here and append
60 'panel=1024x576' to your kernel command line. Otherwise, the
61 largest one available will be used.
62
63config WMT_PANEL_1024X600
64 bool "10-inch with 1024x600 resolution"
65 depends on (FB_VT8500 || FB_WM8505)
66 help
67 These are found in Eken M006 tablets and possibly elsewhere.
68
69 To select this panel at runtime, say y here and append
70 'panel=1024x600' to your kernel command line. Otherwise, the
71 largest one available will be used.
72
73endif
diff --git a/arch/arm/mach-vt8500/Makefile b/arch/arm/mach-vt8500/Makefile
new file mode 100644
index 000000000000..81aedb7c893c
--- /dev/null
+++ b/arch/arm/mach-vt8500/Makefile
@@ -0,0 +1,9 @@
1obj-y += devices.o gpio.o irq.o timer.o
2
3obj-$(CONFIG_VTWM_VERSION_VT8500) += devices-vt8500.o
4obj-$(CONFIG_VTWM_VERSION_WM8505) += devices-wm8505.o
5
6obj-$(CONFIG_MACH_BV07) += bv07.o
7obj-$(CONFIG_MACH_WM8505_7IN_NETBOOK) += wm8505_7in.o
8
9obj-$(CONFIG_HAVE_PWM) += pwm.o
diff --git a/arch/arm/mach-vt8500/Makefile.boot b/arch/arm/mach-vt8500/Makefile.boot
new file mode 100644
index 000000000000..a8acc4e24902
--- /dev/null
+++ b/arch/arm/mach-vt8500/Makefile.boot
@@ -0,0 +1,3 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3initrd_phys-y := 0x01000000
diff --git a/arch/arm/mach-vt8500/bv07.c b/arch/arm/mach-vt8500/bv07.c
new file mode 100644
index 000000000000..94a261d86bf0
--- /dev/null
+++ b/arch/arm/mach-vt8500/bv07.c
@@ -0,0 +1,77 @@
1/*
2 * arch/arm/mach-vt8500/bv07.c
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/io.h>
22#include <linux/pm.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include "devices.h"
28
29static void __iomem *pmc_hiber;
30
31static struct platform_device *devices[] __initdata = {
32 &vt8500_device_uart0,
33 &vt8500_device_lcdc,
34 &vt8500_device_ehci,
35 &vt8500_device_ge_rops,
36 &vt8500_device_pwm,
37 &vt8500_device_pwmbl,
38 &vt8500_device_rtc,
39};
40
41static void vt8500_power_off(void)
42{
43 local_irq_disable();
44 writew(5, pmc_hiber);
45 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0));
46}
47
48void __init bv07_init(void)
49{
50#ifdef CONFIG_FB_VT8500
51 void __iomem *gpio_mux_reg = ioremap(wmt_gpio_base + 0x200, 4);
52 if (gpio_mux_reg) {
53 writel(readl(gpio_mux_reg) | 1, gpio_mux_reg);
54 iounmap(gpio_mux_reg);
55 } else {
56 printk(KERN_ERR "Could not remap the GPIO mux register, display may not work properly!\n");
57 }
58#endif
59 pmc_hiber = ioremap(wmt_pmc_base + 0x12, 2);
60 if (pmc_hiber)
61 pm_power_off = &vt8500_power_off;
62 else
63 printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n");
64
65 vt8500_set_resources();
66 platform_add_devices(devices, ARRAY_SIZE(devices));
67 vt8500_gpio_init();
68}
69
70MACHINE_START(BV07, "Benign BV07 Mini Netbook")
71 .boot_params = 0x00000100,
72 .reserve = vt8500_reserve_mem,
73 .map_io = vt8500_map_io,
74 .init_irq = vt8500_init_irq,
75 .timer = &vt8500_timer,
76 .init_machine = bv07_init,
77MACHINE_END
diff --git a/arch/arm/mach-vt8500/devices-vt8500.c b/arch/arm/mach-vt8500/devices-vt8500.c
new file mode 100644
index 000000000000..19519aeecf37
--- /dev/null
+++ b/arch/arm/mach-vt8500/devices-vt8500.c
@@ -0,0 +1,91 @@
1/* linux/arch/arm/mach-vt8500/devices-vt8500.c
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/platform_device.h>
17
18#include <mach/vt8500_regs.h>
19#include <mach/vt8500_irqs.h>
20#include <mach/i8042.h>
21#include "devices.h"
22
23void __init vt8500_set_resources(void)
24{
25 struct resource tmp[3];
26
27 tmp[0] = wmt_mmio_res(VT8500_LCDC_BASE, SZ_1K);
28 tmp[1] = wmt_irq_res(IRQ_LCDC);
29 wmt_res_add(&vt8500_device_lcdc, tmp, 2);
30
31 tmp[0] = wmt_mmio_res(VT8500_UART0_BASE, 0x1040);
32 tmp[1] = wmt_irq_res(IRQ_UART0);
33 wmt_res_add(&vt8500_device_uart0, tmp, 2);
34
35 tmp[0] = wmt_mmio_res(VT8500_UART1_BASE, 0x1040);
36 tmp[1] = wmt_irq_res(IRQ_UART1);
37 wmt_res_add(&vt8500_device_uart1, tmp, 2);
38
39 tmp[0] = wmt_mmio_res(VT8500_UART2_BASE, 0x1040);
40 tmp[1] = wmt_irq_res(IRQ_UART2);
41 wmt_res_add(&vt8500_device_uart2, tmp, 2);
42
43 tmp[0] = wmt_mmio_res(VT8500_UART3_BASE, 0x1040);
44 tmp[1] = wmt_irq_res(IRQ_UART3);
45 wmt_res_add(&vt8500_device_uart3, tmp, 2);
46
47 tmp[0] = wmt_mmio_res(VT8500_EHCI_BASE, SZ_512);
48 tmp[1] = wmt_irq_res(IRQ_EHCI);
49 wmt_res_add(&vt8500_device_ehci, tmp, 2);
50
51 tmp[0] = wmt_mmio_res(VT8500_GEGEA_BASE, SZ_256);
52 wmt_res_add(&vt8500_device_ge_rops, tmp, 1);
53
54 tmp[0] = wmt_mmio_res(VT8500_PWM_BASE, 0x44);
55 wmt_res_add(&vt8500_device_pwm, tmp, 1);
56
57 tmp[0] = wmt_mmio_res(VT8500_RTC_BASE, 0x2c);
58 tmp[1] = wmt_irq_res(IRQ_RTC);
59 tmp[2] = wmt_irq_res(IRQ_RTCSM);
60 wmt_res_add(&vt8500_device_rtc, tmp, 3);
61}
62
63static void __init vt8500_set_externs(void)
64{
65 /* Non-resource-aware stuff */
66 wmt_ic_base = VT8500_IC_BASE;
67 wmt_gpio_base = VT8500_GPIO_BASE;
68 wmt_pmc_base = VT8500_PMC_BASE;
69 wmt_i8042_base = VT8500_PS2_BASE;
70
71 wmt_nr_irqs = VT8500_NR_IRQS;
72 wmt_timer_irq = IRQ_PMCOS0;
73 wmt_gpio_ext_irq[0] = IRQ_EXT0;
74 wmt_gpio_ext_irq[1] = IRQ_EXT1;
75 wmt_gpio_ext_irq[2] = IRQ_EXT2;
76 wmt_gpio_ext_irq[3] = IRQ_EXT3;
77 wmt_gpio_ext_irq[4] = IRQ_EXT4;
78 wmt_gpio_ext_irq[5] = IRQ_EXT5;
79 wmt_gpio_ext_irq[6] = IRQ_EXT6;
80 wmt_gpio_ext_irq[7] = IRQ_EXT7;
81 wmt_i8042_kbd_irq = IRQ_PS2KBD;
82 wmt_i8042_aux_irq = IRQ_PS2MOUSE;
83}
84
85void __init vt8500_map_io(void)
86{
87 iotable_init(wmt_io_desc, ARRAY_SIZE(wmt_io_desc));
88
89 /* Should be done before interrupts and timers are initialized */
90 vt8500_set_externs();
91}
diff --git a/arch/arm/mach-vt8500/devices-wm8505.c b/arch/arm/mach-vt8500/devices-wm8505.c
new file mode 100644
index 000000000000..db4594e029f4
--- /dev/null
+++ b/arch/arm/mach-vt8500/devices-wm8505.c
@@ -0,0 +1,99 @@
1/* linux/arch/arm/mach-vt8500/devices-wm8505.c
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/platform_device.h>
17
18#include <mach/wm8505_regs.h>
19#include <mach/wm8505_irqs.h>
20#include <mach/i8042.h>
21#include "devices.h"
22
23void __init wm8505_set_resources(void)
24{
25 struct resource tmp[3];
26
27 tmp[0] = wmt_mmio_res(WM8505_GOVR_BASE, SZ_512);
28 wmt_res_add(&vt8500_device_wm8505_fb, tmp, 1);
29
30 tmp[0] = wmt_mmio_res(WM8505_UART0_BASE, 0x1040);
31 tmp[1] = wmt_irq_res(IRQ_UART0);
32 wmt_res_add(&vt8500_device_uart0, tmp, 2);
33
34 tmp[0] = wmt_mmio_res(WM8505_UART1_BASE, 0x1040);
35 tmp[1] = wmt_irq_res(IRQ_UART1);
36 wmt_res_add(&vt8500_device_uart1, tmp, 2);
37
38 tmp[0] = wmt_mmio_res(WM8505_UART2_BASE, 0x1040);
39 tmp[1] = wmt_irq_res(IRQ_UART2);
40 wmt_res_add(&vt8500_device_uart2, tmp, 2);
41
42 tmp[0] = wmt_mmio_res(WM8505_UART3_BASE, 0x1040);
43 tmp[1] = wmt_irq_res(IRQ_UART3);
44 wmt_res_add(&vt8500_device_uart3, tmp, 2);
45
46 tmp[0] = wmt_mmio_res(WM8505_UART4_BASE, 0x1040);
47 tmp[1] = wmt_irq_res(IRQ_UART4);
48 wmt_res_add(&vt8500_device_uart4, tmp, 2);
49
50 tmp[0] = wmt_mmio_res(WM8505_UART5_BASE, 0x1040);
51 tmp[1] = wmt_irq_res(IRQ_UART5);
52 wmt_res_add(&vt8500_device_uart5, tmp, 2);
53
54 tmp[0] = wmt_mmio_res(WM8505_EHCI_BASE, SZ_512);
55 tmp[1] = wmt_irq_res(IRQ_EHCI);
56 wmt_res_add(&vt8500_device_ehci, tmp, 2);
57
58 tmp[0] = wmt_mmio_res(WM8505_GEGEA_BASE, SZ_256);
59 wmt_res_add(&vt8500_device_ge_rops, tmp, 1);
60
61 tmp[0] = wmt_mmio_res(WM8505_PWM_BASE, 0x44);
62 wmt_res_add(&vt8500_device_pwm, tmp, 1);
63
64 tmp[0] = wmt_mmio_res(WM8505_RTC_BASE, 0x2c);
65 tmp[1] = wmt_irq_res(IRQ_RTC);
66 tmp[2] = wmt_irq_res(IRQ_RTCSM);
67 wmt_res_add(&vt8500_device_rtc, tmp, 3);
68}
69
70static void __init wm8505_set_externs(void)
71{
72 /* Non-resource-aware stuff */
73 wmt_ic_base = WM8505_IC_BASE;
74 wmt_sic_base = WM8505_SIC_BASE;
75 wmt_gpio_base = WM8505_GPIO_BASE;
76 wmt_pmc_base = WM8505_PMC_BASE;
77 wmt_i8042_base = WM8505_PS2_BASE;
78
79 wmt_nr_irqs = WM8505_NR_IRQS;
80 wmt_timer_irq = IRQ_PMCOS0;
81 wmt_gpio_ext_irq[0] = IRQ_EXT0;
82 wmt_gpio_ext_irq[1] = IRQ_EXT1;
83 wmt_gpio_ext_irq[2] = IRQ_EXT2;
84 wmt_gpio_ext_irq[3] = IRQ_EXT3;
85 wmt_gpio_ext_irq[4] = IRQ_EXT4;
86 wmt_gpio_ext_irq[5] = IRQ_EXT5;
87 wmt_gpio_ext_irq[6] = IRQ_EXT6;
88 wmt_gpio_ext_irq[7] = IRQ_EXT7;
89 wmt_i8042_kbd_irq = IRQ_PS2KBD;
90 wmt_i8042_aux_irq = IRQ_PS2MOUSE;
91}
92
93void __init wm8505_map_io(void)
94{
95 iotable_init(wmt_io_desc, ARRAY_SIZE(wmt_io_desc));
96
97 /* Should be done before interrupts and timers are initialized */
98 wm8505_set_externs();
99}
diff --git a/arch/arm/mach-vt8500/devices.c b/arch/arm/mach-vt8500/devices.c
new file mode 100644
index 000000000000..1fcdc36b358d
--- /dev/null
+++ b/arch/arm/mach-vt8500/devices.c
@@ -0,0 +1,270 @@
1/* linux/arch/arm/mach-vt8500/devices.c
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/device.h>
19#include <linux/dma-mapping.h>
20#include <linux/platform_device.h>
21#include <linux/pwm_backlight.h>
22#include <linux/memblock.h>
23
24#include <asm/mach/arch.h>
25
26#include <mach/vt8500fb.h>
27#include <mach/i8042.h>
28#include "devices.h"
29
30/* These can't use resources currently */
31unsigned long wmt_ic_base __initdata;
32unsigned long wmt_sic_base __initdata;
33unsigned long wmt_gpio_base __initdata;
34unsigned long wmt_pmc_base __initdata;
35unsigned long wmt_i8042_base __initdata;
36
37int wmt_nr_irqs __initdata;
38int wmt_timer_irq __initdata;
39int wmt_gpio_ext_irq[8] __initdata;
40
41/* Should remain accessible after init.
42 * i8042 driver desperately calls for attention...
43 */
44int wmt_i8042_kbd_irq;
45int wmt_i8042_aux_irq;
46
47static u64 fb_dma_mask = DMA_BIT_MASK(32);
48
49struct platform_device vt8500_device_lcdc = {
50 .name = "vt8500-lcd",
51 .id = 0,
52 .dev = {
53 .dma_mask = &fb_dma_mask,
54 .coherent_dma_mask = DMA_BIT_MASK(32),
55 },
56};
57
58struct platform_device vt8500_device_wm8505_fb = {
59 .name = "wm8505-fb",
60 .id = 0,
61};
62
63/* Smallest to largest */
64static struct vt8500fb_platform_data panels[] = {
65#ifdef CONFIG_WMT_PANEL_800X480
66{
67 .xres_virtual = 800,
68 .yres_virtual = 480 * 2,
69 .mode = {
70 .name = "800x480",
71 .xres = 800,
72 .yres = 480,
73 .left_margin = 88,
74 .right_margin = 40,
75 .upper_margin = 32,
76 .lower_margin = 11,
77 .hsync_len = 0,
78 .vsync_len = 1,
79 .vmode = FB_VMODE_NONINTERLACED,
80 },
81},
82#endif
83#ifdef CONFIG_WMT_PANEL_800X600
84{
85 .xres_virtual = 800,
86 .yres_virtual = 600 * 2,
87 .mode = {
88 .name = "800x600",
89 .xres = 800,
90 .yres = 600,
91 .left_margin = 88,
92 .right_margin = 40,
93 .upper_margin = 32,
94 .lower_margin = 11,
95 .hsync_len = 0,
96 .vsync_len = 1,
97 .vmode = FB_VMODE_NONINTERLACED,
98 },
99},
100#endif
101#ifdef CONFIG_WMT_PANEL_1024X576
102{
103 .xres_virtual = 1024,
104 .yres_virtual = 576 * 2,
105 .mode = {
106 .name = "1024x576",
107 .xres = 1024,
108 .yres = 576,
109 .left_margin = 40,
110 .right_margin = 24,
111 .upper_margin = 32,
112 .lower_margin = 11,
113 .hsync_len = 96,
114 .vsync_len = 2,
115 .vmode = FB_VMODE_NONINTERLACED,
116 },
117},
118#endif
119#ifdef CONFIG_WMT_PANEL_1024X600
120{
121 .xres_virtual = 1024,
122 .yres_virtual = 600 * 2,
123 .mode = {
124 .name = "1024x600",
125 .xres = 1024,
126 .yres = 600,
127 .left_margin = 66,
128 .right_margin = 2,
129 .upper_margin = 19,
130 .lower_margin = 1,
131 .hsync_len = 23,
132 .vsync_len = 8,
133 .vmode = FB_VMODE_NONINTERLACED,
134 },
135},
136#endif
137};
138
139static int current_panel_idx __initdata = ARRAY_SIZE(panels) - 1;
140
141static int __init panel_setup(char *str)
142{
143 int i;
144
145 for (i = 0; i < ARRAY_SIZE(panels); i++) {
146 if (strcmp(panels[i].mode.name, str) == 0) {
147 current_panel_idx = i;
148 break;
149 }
150 }
151 return 0;
152}
153
154early_param("panel", panel_setup);
155
156static inline void preallocate_fb(struct vt8500fb_platform_data *p,
157 unsigned long align) {
158 p->video_mem_len = (p->xres_virtual * p->yres_virtual * 4) >>
159 (p->bpp > 16 ? 0 : (p->bpp > 8 ? 1 :
160 (8 / p->bpp) + 1));
161 p->video_mem_phys = (unsigned long)memblock_alloc(p->video_mem_len,
162 align);
163 p->video_mem_virt = phys_to_virt(p->video_mem_phys);
164}
165
166struct platform_device vt8500_device_uart0 = {
167 .name = "vt8500_serial",
168 .id = 0,
169};
170
171struct platform_device vt8500_device_uart1 = {
172 .name = "vt8500_serial",
173 .id = 1,
174};
175
176struct platform_device vt8500_device_uart2 = {
177 .name = "vt8500_serial",
178 .id = 2,
179};
180
181struct platform_device vt8500_device_uart3 = {
182 .name = "vt8500_serial",
183 .id = 3,
184};
185
186struct platform_device vt8500_device_uart4 = {
187 .name = "vt8500_serial",
188 .id = 4,
189};
190
191struct platform_device vt8500_device_uart5 = {
192 .name = "vt8500_serial",
193 .id = 5,
194};
195
196static u64 ehci_dma_mask = DMA_BIT_MASK(32);
197
198struct platform_device vt8500_device_ehci = {
199 .name = "vt8500-ehci",
200 .id = 0,
201 .dev = {
202 .dma_mask = &ehci_dma_mask,
203 .coherent_dma_mask = DMA_BIT_MASK(32),
204 },
205};
206
207struct platform_device vt8500_device_ge_rops = {
208 .name = "wmt_ge_rops",
209 .id = -1,
210};
211
212struct platform_device vt8500_device_pwm = {
213 .name = "vt8500-pwm",
214 .id = 0,
215};
216
217static struct platform_pwm_backlight_data vt8500_pwmbl_data = {
218 .pwm_id = 0,
219 .max_brightness = 128,
220 .dft_brightness = 70,
221 .pwm_period_ns = 250000, /* revisit when clocks are implemented */
222};
223
224struct platform_device vt8500_device_pwmbl = {
225 .name = "pwm-backlight",
226 .id = 0,
227 .dev = {
228 .platform_data = &vt8500_pwmbl_data,
229 },
230};
231
232struct platform_device vt8500_device_rtc = {
233 .name = "vt8500-rtc",
234 .id = 0,
235};
236
237struct map_desc wmt_io_desc[] __initdata = {
238 /* SoC MMIO registers */
239 [0] = {
240 .virtual = 0xf8000000,
241 .pfn = __phys_to_pfn(0xd8000000),
242 .length = 0x00390000, /* max of all chip variants */
243 .type = MT_DEVICE
244 },
245 /* PCI I/O space, numbers tied to those in <mach/io.h> */
246 [1] = {
247 .virtual = 0xf0000000,
248 .pfn = __phys_to_pfn(0xc0000000),
249 .length = SZ_64K,
250 .type = MT_DEVICE
251 },
252};
253
254void __init vt8500_reserve_mem(void)
255{
256#ifdef CONFIG_FB_VT8500
257 panels[current_panel_idx].bpp = 16; /* Always use RGB565 */
258 preallocate_fb(&panels[current_panel_idx], SZ_4M);
259 vt8500_device_lcdc.dev.platform_data = &panels[current_panel_idx];
260#endif
261}
262
263void __init wm8505_reserve_mem(void)
264{
265#if defined CONFIG_FB_WM8505
266 panels[current_panel_idx].bpp = 32; /* Always use RGB888 */
267 preallocate_fb(&panels[current_panel_idx], 32);
268 vt8500_device_wm8505_fb.dev.platform_data = &panels[current_panel_idx];
269#endif
270}
diff --git a/arch/arm/mach-vt8500/devices.h b/arch/arm/mach-vt8500/devices.h
new file mode 100644
index 000000000000..188d4e17f35c
--- /dev/null
+++ b/arch/arm/mach-vt8500/devices.h
@@ -0,0 +1,88 @@
1/* linux/arch/arm/mach-vt8500/devices.h
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
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 __ARCH_ARM_MACH_VT8500_DEVICES_H
17#define __ARCH_ARM_MACH_VT8500_DEVICES_H
18
19#include <linux/platform_device.h>
20#include <asm/mach/map.h>
21
22void __init vt8500_init_irq(void);
23void __init wm8505_init_irq(void);
24void __init vt8500_map_io(void);
25void __init wm8505_map_io(void);
26void __init vt8500_reserve_mem(void);
27void __init wm8505_reserve_mem(void);
28void __init vt8500_gpio_init(void);
29void __init vt8500_set_resources(void);
30void __init wm8505_set_resources(void);
31
32extern unsigned long wmt_ic_base __initdata;
33extern unsigned long wmt_sic_base __initdata;
34extern unsigned long wmt_gpio_base __initdata;
35extern unsigned long wmt_pmc_base __initdata;
36
37extern int wmt_nr_irqs __initdata;
38extern int wmt_timer_irq __initdata;
39extern int wmt_gpio_ext_irq[8] __initdata;
40
41extern struct map_desc wmt_io_desc[2] __initdata;
42
43static inline struct resource wmt_mmio_res(u32 start, u32 size)
44{
45 struct resource tmp = {
46 .flags = IORESOURCE_MEM,
47 .start = start,
48 .end = start + size - 1,
49 };
50
51 return tmp;
52}
53
54static inline struct resource wmt_irq_res(int irq)
55{
56 struct resource tmp = {
57 .flags = IORESOURCE_IRQ,
58 .start = irq,
59 .end = irq,
60 };
61
62 return tmp;
63}
64
65static inline void wmt_res_add(struct platform_device *pdev,
66 const struct resource *res, unsigned int num)
67{
68 if (unlikely(platform_device_add_resources(pdev, res, num)))
69 pr_err("Failed to assign resources\n");
70}
71
72extern struct sys_timer vt8500_timer;
73
74extern struct platform_device vt8500_device_uart0;
75extern struct platform_device vt8500_device_uart1;
76extern struct platform_device vt8500_device_uart2;
77extern struct platform_device vt8500_device_uart3;
78extern struct platform_device vt8500_device_uart4;
79extern struct platform_device vt8500_device_uart5;
80
81extern struct platform_device vt8500_device_lcdc;
82extern struct platform_device vt8500_device_wm8505_fb;
83extern struct platform_device vt8500_device_ehci;
84extern struct platform_device vt8500_device_ge_rops;
85extern struct platform_device vt8500_device_pwm;
86extern struct platform_device vt8500_device_pwmbl;
87extern struct platform_device vt8500_device_rtc;
88#endif
diff --git a/arch/arm/mach-vt8500/gpio.c b/arch/arm/mach-vt8500/gpio.c
new file mode 100644
index 000000000000..2bcc0ec783df
--- /dev/null
+++ b/arch/arm/mach-vt8500/gpio.c
@@ -0,0 +1,240 @@
1/* linux/arch/arm/mach-vt8500/gpio.c
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#include <linux/gpio.h>
17#include <linux/init.h>
18#include <linux/irq.h>
19#include <linux/io.h>
20
21#include "devices.h"
22
23#define to_vt8500(__chip) container_of(__chip, struct vt8500_gpio_chip, chip)
24
25#define ENABLE_REGS 0x0
26#define DIRECTION_REGS 0x20
27#define OUTVALUE_REGS 0x40
28#define INVALUE_REGS 0x60
29
30#define EXT_REGOFF 0x1c
31
32static void __iomem *regbase;
33
34struct vt8500_gpio_chip {
35 struct gpio_chip chip;
36 unsigned int shift;
37 unsigned int regoff;
38};
39
40static int gpio_to_irq_map[8];
41
42static int vt8500_muxed_gpio_request(struct gpio_chip *chip,
43 unsigned offset)
44{
45 struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip);
46 unsigned val = readl(regbase + ENABLE_REGS + vt8500_chip->regoff);
47
48 val |= (1 << vt8500_chip->shift << offset);
49 writel(val, regbase + ENABLE_REGS + vt8500_chip->regoff);
50
51 return 0;
52}
53
54static void vt8500_muxed_gpio_free(struct gpio_chip *chip,
55 unsigned offset)
56{
57 struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip);
58 unsigned val = readl(regbase + ENABLE_REGS + vt8500_chip->regoff);
59
60 val &= ~(1 << vt8500_chip->shift << offset);
61 writel(val, regbase + ENABLE_REGS + vt8500_chip->regoff);
62}
63
64static int vt8500_muxed_gpio_direction_input(struct gpio_chip *chip,
65 unsigned offset)
66{
67 struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip);
68 unsigned val = readl(regbase + DIRECTION_REGS + vt8500_chip->regoff);
69
70 val &= ~(1 << vt8500_chip->shift << offset);
71 writel(val, regbase + DIRECTION_REGS + vt8500_chip->regoff);
72
73 return 0;
74}
75
76static int vt8500_muxed_gpio_direction_output(struct gpio_chip *chip,
77 unsigned offset, int value)
78{
79 struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip);
80 unsigned val = readl(regbase + DIRECTION_REGS + vt8500_chip->regoff);
81
82 val |= (1 << vt8500_chip->shift << offset);
83 writel(val, regbase + DIRECTION_REGS + vt8500_chip->regoff);
84
85 if (value) {
86 val = readl(regbase + OUTVALUE_REGS + vt8500_chip->regoff);
87 val |= (1 << vt8500_chip->shift << offset);
88 writel(val, regbase + OUTVALUE_REGS + vt8500_chip->regoff);
89 }
90 return 0;
91}
92
93static int vt8500_muxed_gpio_get_value(struct gpio_chip *chip,
94 unsigned offset)
95{
96 struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip);
97
98 return (readl(regbase + INVALUE_REGS + vt8500_chip->regoff)
99 >> vt8500_chip->shift >> offset) & 1;
100}
101
102static void vt8500_muxed_gpio_set_value(struct gpio_chip *chip,
103 unsigned offset, int value)
104{
105 struct vt8500_gpio_chip *vt8500_chip = to_vt8500(chip);
106 unsigned val = readl(regbase + INVALUE_REGS + vt8500_chip->regoff);
107
108 if (value)
109 val |= (1 << vt8500_chip->shift << offset);
110 else
111 val &= ~(1 << vt8500_chip->shift << offset);
112
113 writel(val, regbase + INVALUE_REGS + vt8500_chip->regoff);
114}
115
116#define VT8500_GPIO_BANK(__name, __shift, __off, __base, __num) \
117{ \
118 .chip = { \
119 .label = __name, \
120 .request = vt8500_muxed_gpio_request, \
121 .free = vt8500_muxed_gpio_free, \
122 .direction_input = vt8500_muxed_gpio_direction_input, \
123 .direction_output = vt8500_muxed_gpio_direction_output, \
124 .get = vt8500_muxed_gpio_get_value, \
125 .set = vt8500_muxed_gpio_set_value, \
126 .can_sleep = 0, \
127 .base = __base, \
128 .ngpio = __num, \
129 }, \
130 .shift = __shift, \
131 .regoff = __off, \
132}
133
134static struct vt8500_gpio_chip vt8500_muxed_gpios[] = {
135 VT8500_GPIO_BANK("uart0", 0, 0x0, 8, 4),
136 VT8500_GPIO_BANK("uart1", 4, 0x0, 12, 4),
137 VT8500_GPIO_BANK("spi0", 8, 0x0, 16, 4),
138 VT8500_GPIO_BANK("spi1", 12, 0x0, 20, 4),
139 VT8500_GPIO_BANK("spi2", 16, 0x0, 24, 4),
140 VT8500_GPIO_BANK("pwmout", 24, 0x0, 28, 2),
141
142 VT8500_GPIO_BANK("sdmmc", 0, 0x4, 30, 11),
143 VT8500_GPIO_BANK("ms", 16, 0x4, 41, 7),
144 VT8500_GPIO_BANK("i2c0", 24, 0x4, 48, 2),
145 VT8500_GPIO_BANK("i2c1", 26, 0x4, 50, 2),
146
147 VT8500_GPIO_BANK("mii", 0, 0x8, 52, 20),
148 VT8500_GPIO_BANK("see", 20, 0x8, 72, 4),
149 VT8500_GPIO_BANK("ide", 24, 0x8, 76, 7),
150
151 VT8500_GPIO_BANK("ccir", 0, 0xc, 83, 19),
152
153 VT8500_GPIO_BANK("ts", 8, 0x10, 102, 11),
154
155 VT8500_GPIO_BANK("lcd", 0, 0x14, 113, 23),
156};
157
158static int vt8500_gpio_direction_input(struct gpio_chip *chip,
159 unsigned offset)
160{
161 unsigned val = readl(regbase + DIRECTION_REGS + EXT_REGOFF);
162
163 val &= ~(1 << offset);
164 writel(val, regbase + DIRECTION_REGS + EXT_REGOFF);
165 return 0;
166}
167
168static int vt8500_gpio_direction_output(struct gpio_chip *chip,
169 unsigned offset, int value)
170{
171 unsigned val = readl(regbase + DIRECTION_REGS + EXT_REGOFF);
172
173 val |= (1 << offset);
174 writel(val, regbase + DIRECTION_REGS + EXT_REGOFF);
175
176 if (value) {
177 val = readl(regbase + OUTVALUE_REGS + EXT_REGOFF);
178 val |= (1 << offset);
179 writel(val, regbase + OUTVALUE_REGS + EXT_REGOFF);
180 }
181 return 0;
182}
183
184static int vt8500_gpio_get_value(struct gpio_chip *chip,
185 unsigned offset)
186{
187 return (readl(regbase + INVALUE_REGS + EXT_REGOFF) >> offset) & 1;
188}
189
190static void vt8500_gpio_set_value(struct gpio_chip *chip,
191 unsigned offset, int value)
192{
193 unsigned val = readl(regbase + OUTVALUE_REGS + EXT_REGOFF);
194
195 if (value)
196 val |= (1 << offset);
197 else
198 val &= ~(1 << offset);
199
200 writel(val, regbase + OUTVALUE_REGS + EXT_REGOFF);
201}
202
203static int vt8500_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
204{
205 if (offset > 7)
206 return -EINVAL;
207
208 return gpio_to_irq_map[offset];
209}
210
211static struct gpio_chip vt8500_external_gpios = {
212 .label = "extgpio",
213 .direction_input = vt8500_gpio_direction_input,
214 .direction_output = vt8500_gpio_direction_output,
215 .get = vt8500_gpio_get_value,
216 .set = vt8500_gpio_set_value,
217 .to_irq = vt8500_gpio_to_irq,
218 .can_sleep = 0,
219 .base = 0,
220 .ngpio = 8,
221};
222
223void __init vt8500_gpio_init(void)
224{
225 int i;
226
227 for (i = 0; i < 8; i++)
228 gpio_to_irq_map[i] = wmt_gpio_ext_irq[i];
229
230 regbase = ioremap(wmt_gpio_base, SZ_64K);
231 if (!regbase) {
232 printk(KERN_ERR "Failed to map MMIO registers for GPIO\n");
233 return;
234 }
235
236 gpiochip_add(&vt8500_external_gpios);
237
238 for (i = 0; i < ARRAY_SIZE(vt8500_muxed_gpios); i++)
239 gpiochip_add(&vt8500_muxed_gpios[i].chip);
240}
diff --git a/arch/arm/mach-vt8500/include/mach/debug-macro.S b/arch/arm/mach-vt8500/include/mach/debug-macro.S
new file mode 100644
index 000000000000..f1191626ad51
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/debug-macro.S
@@ -0,0 +1,31 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/debug-macro.S
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
5 *
6 * Debugging macro include header
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
14 .macro addruart, rp, rv
15 mov \rp, #0x00200000
16 orr \rv, \rp, #0xf8000000
17 orr \rp, \rp, #0xd8000000
18 .endm
19
20 .macro senduart,rd,rx
21 strb \rd, [\rx, #0]
22 .endm
23
24 .macro busyuart,rd,rx
251001: ldr \rd, [\rx, #0x1c]
26 ands \rd, \rd, #0x2
27 bne 1001b
28 .endm
29
30 .macro waituart,rd,rx
31 .endm
diff --git a/arch/arm/mach-vt8500/include/mach/entry-macro.S b/arch/arm/mach-vt8500/include/mach/entry-macro.S
new file mode 100644
index 000000000000..92684c7eaed3
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/entry-macro.S
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for VIA VT8500
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 .macro disable_fiq
12 .endm
13
14 .macro get_irqnr_preamble, base, tmp
15 @ physical 0xd8140000 is virtual 0xf8140000
16 mov \base, #0xf8000000
17 orr \base, \base, #0x00140000
18 .endm
19
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 ldr \irqnr, [\base]
25 cmp \irqnr, #63 @ may be false positive, check interrupt status
26 bne 1001f
27 ldr \irqstat, [\base, #0x84]
28 ands \irqstat, #0x80000000
29 moveq \irqnr, #0
301001:
31 .endm
32
diff --git a/arch/arm/mach-vt8500/include/mach/gpio.h b/arch/arm/mach-vt8500/include/mach/gpio.h
new file mode 100644
index 000000000000..94ff27678a46
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/gpio.h
@@ -0,0 +1,6 @@
1#include <asm-generic/gpio.h>
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-vt8500/include/mach/hardware.h b/arch/arm/mach-vt8500/include/mach/hardware.h
new file mode 100644
index 000000000000..db4163f72c39
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/hardware.h
@@ -0,0 +1,12 @@
1/* arch/arm/mach-vt8500/include/mach/hardware.h
2 *
3 * This software is licensed under the terms of the GNU General Public
4 * License version 2, as published by the Free Software Foundation, and
5 * may be copied, distributed, and modified under those terms.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
diff --git a/arch/arm/mach-vt8500/include/mach/i8042.h b/arch/arm/mach-vt8500/include/mach/i8042.h
new file mode 100644
index 000000000000..cd7143cad6f3
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/i8042.h
@@ -0,0 +1,18 @@
1/* arch/arm/mach-vt8500/include/mach/i8042.h
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
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
16extern unsigned long wmt_i8042_base __initdata;
17extern int wmt_i8042_kbd_irq;
18extern int wmt_i8042_aux_irq;
diff --git a/arch/arm/mach-vt8500/include/mach/io.h b/arch/arm/mach-vt8500/include/mach/io.h
new file mode 100644
index 000000000000..9077239f78c9
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/io.h
@@ -0,0 +1,28 @@
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_SPACE_LIMIT 0xffff
24
25#define __io(a) __typesafe_io((a) + 0xf0000000)
26#define __mem_pci(a) (a)
27
28#endif
diff --git a/arch/arm/mach-vt8500/include/mach/irqs.h b/arch/arm/mach-vt8500/include/mach/irqs.h
new file mode 100644
index 000000000000..a129fd1222fb
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/irqs.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/irqs.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/* This value is just to make the core happy, never used otherwise */
22#define NR_IRQS 128
diff --git a/arch/arm/mach-vt8500/include/mach/memory.h b/arch/arm/mach-vt8500/include/mach/memory.h
new file mode 100644
index 000000000000..175f914eff93
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/memory.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/memory.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_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H
22
23/*
24 * Physical DRAM offset.
25 */
26#define PHYS_OFFSET UL(0x00000000)
27
28#endif
diff --git a/arch/arm/mach-vt8500/include/mach/system.h b/arch/arm/mach-vt8500/include/mach/system.h
new file mode 100644
index 000000000000..d6c757eaf26b
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/system.h
@@ -0,0 +1,18 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/system.h
3 *
4 */
5#include <asm/io.h>
6
7/* PM Software Reset request register */
8#define VT8500_PMSR_VIRT 0xf8130060
9
10static inline void arch_idle(void)
11{
12 cpu_do_idle();
13}
14
15static inline void arch_reset(char mode, const char *cmd)
16{
17 writel(1, VT8500_PMSR_VIRT);
18}
diff --git a/arch/arm/mach-vt8500/include/mach/timex.h b/arch/arm/mach-vt8500/include/mach/timex.h
new file mode 100644
index 000000000000..8487e4c690b7
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/timex.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/timex.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#ifndef MACH_TIMEX_H
22#define MACH_TIMEX_H
23
24#define CLOCK_TICK_RATE (3000000)
25
26#endif /* MACH_TIMEX_H */
diff --git a/arch/arm/mach-vt8500/include/mach/uncompress.h b/arch/arm/mach-vt8500/include/mach/uncompress.h
new file mode 100644
index 000000000000..bb9e2d23fee3
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/uncompress.h
@@ -0,0 +1,37 @@
1/* arch/arm/mach-vt8500/include/mach/uncompress.h
2 *
3 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
4 *
5 * Based on arch/arm/mach-dove/include/mach/uncompress.h
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
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 */
17
18#define UART0_PHYS 0xd8200000
19#include <asm/io.h>
20
21static void putc(const char c)
22{
23 while (readb(UART0_PHYS + 0x1c) & 0x2)
24 /* Tx busy, wait and poll */;
25
26 writeb(c, UART0_PHYS);
27}
28
29static void flush(void)
30{
31}
32
33/*
34 * nothing to do
35 */
36#define arch_decomp_setup()
37#define arch_decomp_wdog()
diff --git a/arch/arm/mach-vt8500/include/mach/vmalloc.h b/arch/arm/mach-vt8500/include/mach/vmalloc.h
new file mode 100644
index 000000000000..4642290ce416
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/vmalloc.h
@@ -0,0 +1,20 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/vmalloc.h
3 *
4 * Copyright (C) 2000 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License 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#define VMALLOC_END 0xd0000000UL
diff --git a/arch/arm/mach-vt8500/include/mach/vt8500_irqs.h b/arch/arm/mach-vt8500/include/mach/vt8500_irqs.h
new file mode 100644
index 000000000000..ecfee9124711
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/vt8500_irqs.h
@@ -0,0 +1,88 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/vt8500_irqs.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/* VT8500 Interrupt Sources */
22
23#define IRQ_JPEGENC 0 /* JPEG Encoder */
24#define IRQ_JPEGDEC 1 /* JPEG Decoder */
25 /* Reserved */
26#define IRQ_PATA 3 /* PATA Controller */
27 /* Reserved */
28#define IRQ_DMA 5 /* DMA Controller */
29#define IRQ_EXT0 6 /* External Interrupt 0 */
30#define IRQ_EXT1 7 /* External Interrupt 1 */
31#define IRQ_GE 8 /* Graphic Engine */
32#define IRQ_GOV 9 /* Graphic Overlay Engine */
33#define IRQ_ETHER 10 /* Ethernet MAC */
34#define IRQ_MPEGTS 11 /* Transport Stream Interface */
35#define IRQ_LCDC 12 /* LCD Controller */
36#define IRQ_EXT2 13 /* External Interrupt 2 */
37#define IRQ_EXT3 14 /* External Interrupt 3 */
38#define IRQ_EXT4 15 /* External Interrupt 4 */
39#define IRQ_CIPHER 16 /* Cipher */
40#define IRQ_VPP 17 /* Video Post-Processor */
41#define IRQ_I2C1 18 /* I2C 1 */
42#define IRQ_I2C0 19 /* I2C 0 */
43#define IRQ_SDMMC 20 /* SD/MMC Controller */
44#define IRQ_SDMMC_DMA 21 /* SD/MMC Controller DMA */
45#define IRQ_PMC_WU 22 /* Power Management Controller Wakeup */
46 /* Reserved */
47#define IRQ_SPI0 24 /* SPI 0 */
48#define IRQ_SPI1 25 /* SPI 1 */
49#define IRQ_SPI2 26 /* SPI 2 */
50#define IRQ_LCDDF 27 /* LCD Data Formatter */
51#define IRQ_NAND 28 /* NAND Flash Controller */
52#define IRQ_NAND_DMA 29 /* NAND Flash Controller DMA */
53#define IRQ_MS 30 /* MemoryStick Controller */
54#define IRQ_MS_DMA 31 /* MemoryStick Controller DMA */
55#define IRQ_UART0 32 /* UART 0 */
56#define IRQ_UART1 33 /* UART 1 */
57#define IRQ_I2S 34 /* I2S */
58#define IRQ_PCM 35 /* PCM */
59#define IRQ_PMCOS0 36 /* PMC OS Timer 0 */
60#define IRQ_PMCOS1 37 /* PMC OS Timer 1 */
61#define IRQ_PMCOS2 38 /* PMC OS Timer 2 */
62#define IRQ_PMCOS3 39 /* PMC OS Timer 3 */
63#define IRQ_VPU 40 /* Video Processing Unit */
64#define IRQ_VID 41 /* Video Digital Input Interface */
65#define IRQ_AC97 42 /* AC97 Interface */
66#define IRQ_EHCI 43 /* USB */
67#define IRQ_NOR 44 /* NOR Flash Controller */
68#define IRQ_PS2MOUSE 45 /* PS/2 Mouse */
69#define IRQ_PS2KBD 46 /* PS/2 Keyboard */
70#define IRQ_UART2 47 /* UART 2 */
71#define IRQ_RTC 48 /* RTC Interrupt */
72#define IRQ_RTCSM 49 /* RTC Second/Minute Update Interrupt */
73#define IRQ_UART3 50 /* UART 3 */
74#define IRQ_ADC 51 /* ADC */
75#define IRQ_EXT5 52 /* External Interrupt 5 */
76#define IRQ_EXT6 53 /* External Interrupt 6 */
77#define IRQ_EXT7 54 /* External Interrupt 7 */
78#define IRQ_CIR 55 /* CIR */
79#define IRQ_DMA0 56 /* DMA Channel 0 */
80#define IRQ_DMA1 57 /* DMA Channel 1 */
81#define IRQ_DMA2 58 /* DMA Channel 2 */
82#define IRQ_DMA3 59 /* DMA Channel 3 */
83#define IRQ_DMA4 60 /* DMA Channel 4 */
84#define IRQ_DMA5 61 /* DMA Channel 5 */
85#define IRQ_DMA6 62 /* DMA Channel 6 */
86#define IRQ_DMA7 63 /* DMA Channel 7 */
87
88#define VT8500_NR_IRQS 64
diff --git a/arch/arm/mach-vt8500/include/mach/vt8500_regs.h b/arch/arm/mach-vt8500/include/mach/vt8500_regs.h
new file mode 100644
index 000000000000..29c63ecb2383
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/vt8500_regs.h
@@ -0,0 +1,79 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/vt8500_regs.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_VT8500_REGS_H
21#define __ASM_ARM_ARCH_VT8500_REGS_H
22
23/* VT8500 Registers Map */
24
25#define VT8500_REGS_START_PHYS 0xd8000000 /* Start of MMIO registers */
26#define VT8500_REGS_START_VIRT 0xf8000000 /* Virtual mapping start */
27
28#define VT8500_DDR_BASE 0xd8000000 /* 1k DDR/DDR2 Memory
29 Controller */
30#define VT8500_DMA_BASE 0xd8001000 /* 1k DMA Controller */
31#define VT8500_SFLASH_BASE 0xd8002000 /* 1k Serial Flash Memory
32 Controller */
33#define VT8500_ETHER_BASE 0xd8004000 /* 1k Ethernet MAC 0 */
34#define VT8500_CIPHER_BASE 0xd8006000 /* 4k Cipher */
35#define VT8500_USB_BASE 0xd8007800 /* 2k USB OTG */
36# define VT8500_EHCI_BASE 0xd8007900 /* EHCI */
37# define VT8500_UHCI_BASE 0xd8007b01 /* UHCI */
38#define VT8500_PATA_BASE 0xd8008000 /* 512 PATA */
39#define VT8500_PS2_BASE 0xd8008800 /* 1k PS/2 */
40#define VT8500_NAND_BASE 0xd8009000 /* 1k NAND Controller */
41#define VT8500_NOR_BASE 0xd8009400 /* 1k NOR Controller */
42#define VT8500_SDMMC_BASE 0xd800a000 /* 1k SD/MMC Controller */
43#define VT8500_MS_BASE 0xd800b000 /* 1k MS/MSPRO Controller */
44#define VT8500_LCDC_BASE 0xd800e400 /* 1k LCD Controller */
45#define VT8500_VPU_BASE 0xd8050000 /* 256 VPU */
46#define VT8500_GOV_BASE 0xd8050300 /* 256 GOV */
47#define VT8500_GEGEA_BASE 0xd8050400 /* 768 GE/GE Alpha Mixing */
48#define VT8500_LCDF_BASE 0xd8050900 /* 256 LCD Formatter */
49#define VT8500_VID_BASE 0xd8050a00 /* 256 VID */
50#define VT8500_VPP_BASE 0xd8050b00 /* 256 VPP */
51#define VT8500_TSBK_BASE 0xd80f4000 /* 4k TSBK */
52#define VT8500_JPEGDEC_BASE 0xd80fe000 /* 4k JPEG Decoder */
53#define VT8500_JPEGENC_BASE 0xd80ff000 /* 4k JPEG Encoder */
54#define VT8500_RTC_BASE 0xd8100000 /* 64k RTC */
55#define VT8500_GPIO_BASE 0xd8110000 /* 64k GPIO Configuration */
56#define VT8500_SCC_BASE 0xd8120000 /* 64k System Configuration*/
57#define VT8500_PMC_BASE 0xd8130000 /* 64k PMC Configuration */
58#define VT8500_IC_BASE 0xd8140000 /* 64k Interrupt Controller*/
59#define VT8500_UART0_BASE 0xd8200000 /* 64k UART 0 */
60#define VT8500_UART2_BASE 0xd8210000 /* 64k UART 2 */
61#define VT8500_PWM_BASE 0xd8220000 /* 64k PWM Configuration */
62#define VT8500_SPI0_BASE 0xd8240000 /* 64k SPI 0 */
63#define VT8500_SPI1_BASE 0xd8250000 /* 64k SPI 1 */
64#define VT8500_CIR_BASE 0xd8270000 /* 64k CIR */
65#define VT8500_I2C0_BASE 0xd8280000 /* 64k I2C 0 */
66#define VT8500_AC97_BASE 0xd8290000 /* 64k AC97 */
67#define VT8500_SPI2_BASE 0xd82a0000 /* 64k SPI 2 */
68#define VT8500_UART1_BASE 0xd82b0000 /* 64k UART 1 */
69#define VT8500_UART3_BASE 0xd82c0000 /* 64k UART 3 */
70#define VT8500_PCM_BASE 0xd82d0000 /* 64k PCM */
71#define VT8500_I2C1_BASE 0xd8320000 /* 64k I2C 1 */
72#define VT8500_I2S_BASE 0xd8330000 /* 64k I2S */
73#define VT8500_ADC_BASE 0xd8340000 /* 64k ADC */
74
75#define VT8500_REGS_END_PHYS 0xd834ffff /* End of MMIO registers */
76#define VT8500_REGS_LENGTH (VT8500_REGS_END_PHYS \
77 - VT8500_REGS_START_PHYS + 1)
78
79#endif
diff --git a/arch/arm/mach-vt8500/include/mach/vt8500fb.h b/arch/arm/mach-vt8500/include/mach/vt8500fb.h
new file mode 100644
index 000000000000..7f399c370fe0
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/vt8500fb.h
@@ -0,0 +1,31 @@
1/*
2 * VT8500/WM8505 Frame Buffer platform data definitions
3 *
4 * Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef _VT8500FB_H
17#define _VT8500FB_H
18
19#include <linux/fb.h>
20
21struct vt8500fb_platform_data {
22 struct fb_videomode mode;
23 u32 xres_virtual;
24 u32 yres_virtual;
25 u32 bpp;
26 unsigned long video_mem_phys;
27 void *video_mem_virt;
28 unsigned long video_mem_len;
29};
30
31#endif /* _VT8500FB_H */
diff --git a/arch/arm/mach-vt8500/include/mach/wm8505_irqs.h b/arch/arm/mach-vt8500/include/mach/wm8505_irqs.h
new file mode 100644
index 000000000000..6128627ac753
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/wm8505_irqs.h
@@ -0,0 +1,115 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/wm8505_irqs.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21/* WM8505 Interrupt Sources */
22
23#define IRQ_UHCI 0 /* UHC FS (UHCI?) */
24#define IRQ_EHCI 1 /* UHC HS */
25#define IRQ_UDCDMA 2 /* UDC DMA */
26 /* Reserved */
27#define IRQ_PS2MOUSE 4 /* PS/2 Mouse */
28#define IRQ_UDC 5 /* UDC */
29#define IRQ_EXT0 6 /* External Interrupt 0 */
30#define IRQ_EXT1 7 /* External Interrupt 1 */
31#define IRQ_KEYPAD 8 /* Keypad */
32#define IRQ_DMA 9 /* DMA Controller */
33#define IRQ_ETHER 10 /* Ethernet MAC */
34 /* Reserved */
35 /* Reserved */
36#define IRQ_EXT2 13 /* External Interrupt 2 */
37#define IRQ_EXT3 14 /* External Interrupt 3 */
38#define IRQ_EXT4 15 /* External Interrupt 4 */
39#define IRQ_APB 16 /* APB Bridge */
40#define IRQ_DMA0 17 /* DMA Channel 0 */
41#define IRQ_I2C1 18 /* I2C 1 */
42#define IRQ_I2C0 19 /* I2C 0 */
43#define IRQ_SDMMC 20 /* SD/MMC Controller */
44#define IRQ_SDMMC_DMA 21 /* SD/MMC Controller DMA */
45#define IRQ_PMC_WU 22 /* Power Management Controller Wakeup */
46#define IRQ_PS2KBD 23 /* PS/2 Keyboard */
47#define IRQ_SPI0 24 /* SPI 0 */
48#define IRQ_SPI1 25 /* SPI 1 */
49#define IRQ_SPI2 26 /* SPI 2 */
50#define IRQ_DMA1 27 /* DMA Channel 1 */
51#define IRQ_NAND 28 /* NAND Flash Controller */
52#define IRQ_NAND_DMA 29 /* NAND Flash Controller DMA */
53#define IRQ_UART5 30 /* UART 5 */
54#define IRQ_UART4 31 /* UART 4 */
55#define IRQ_UART0 32 /* UART 0 */
56#define IRQ_UART1 33 /* UART 1 */
57#define IRQ_DMA2 34 /* DMA Channel 2 */
58#define IRQ_I2S 35 /* I2S */
59#define IRQ_PMCOS0 36 /* PMC OS Timer 0 */
60#define IRQ_PMCOS1 37 /* PMC OS Timer 1 */
61#define IRQ_PMCOS2 38 /* PMC OS Timer 2 */
62#define IRQ_PMCOS3 39 /* PMC OS Timer 3 */
63#define IRQ_DMA3 40 /* DMA Channel 3 */
64#define IRQ_DMA4 41 /* DMA Channel 4 */
65#define IRQ_AC97 42 /* AC97 Interface */
66 /* Reserved */
67#define IRQ_NOR 44 /* NOR Flash Controller */
68#define IRQ_DMA5 45 /* DMA Channel 5 */
69#define IRQ_DMA6 46 /* DMA Channel 6 */
70#define IRQ_UART2 47 /* UART 2 */
71#define IRQ_RTC 48 /* RTC Interrupt */
72#define IRQ_RTCSM 49 /* RTC Second/Minute Update Interrupt */
73#define IRQ_UART3 50 /* UART 3 */
74#define IRQ_DMA7 51 /* DMA Channel 7 */
75#define IRQ_EXT5 52 /* External Interrupt 5 */
76#define IRQ_EXT6 53 /* External Interrupt 6 */
77#define IRQ_EXT7 54 /* External Interrupt 7 */
78#define IRQ_CIR 55 /* CIR */
79#define IRQ_SIC0 56 /* SIC IRQ0 */
80#define IRQ_SIC1 57 /* SIC IRQ1 */
81#define IRQ_SIC2 58 /* SIC IRQ2 */
82#define IRQ_SIC3 59 /* SIC IRQ3 */
83#define IRQ_SIC4 60 /* SIC IRQ4 */
84#define IRQ_SIC5 61 /* SIC IRQ5 */
85#define IRQ_SIC6 62 /* SIC IRQ6 */
86#define IRQ_SIC7 63 /* SIC IRQ7 */
87 /* Reserved */
88#define IRQ_JPEGDEC 65 /* JPEG Decoder */
89#define IRQ_SAE 66 /* SAE (?) */
90 /* Reserved */
91#define IRQ_VPU 79 /* Video Processing Unit */
92#define IRQ_VPP 80 /* Video Post-Processor */
93#define IRQ_VID 81 /* Video Digital Input Interface */
94#define IRQ_SPU 82 /* SPU (?) */
95#define IRQ_PIP 83 /* PIP Error */
96#define IRQ_GE 84 /* Graphic Engine */
97#define IRQ_GOV 85 /* Graphic Overlay Engine */
98#define IRQ_DVO 86 /* Digital Video Output */
99 /* Reserved */
100#define IRQ_DMA8 92 /* DMA Channel 8 */
101#define IRQ_DMA9 93 /* DMA Channel 9 */
102#define IRQ_DMA10 94 /* DMA Channel 10 */
103#define IRQ_DMA11 95 /* DMA Channel 11 */
104#define IRQ_DMA12 96 /* DMA Channel 12 */
105#define IRQ_DMA13 97 /* DMA Channel 13 */
106#define IRQ_DMA14 98 /* DMA Channel 14 */
107#define IRQ_DMA15 99 /* DMA Channel 15 */
108 /* Reserved */
109#define IRQ_GOVW 111 /* GOVW (?) */
110#define IRQ_GOVRSDSCD 112 /* GOVR SDSCD (?) */
111#define IRQ_GOVRSDMIF 113 /* GOVR SDMIF (?) */
112#define IRQ_GOVRHDSCD 114 /* GOVR HDSCD (?) */
113#define IRQ_GOVRHDMIF 115 /* GOVR HDMIF (?) */
114
115#define WM8505_NR_IRQS 116
diff --git a/arch/arm/mach-vt8500/include/mach/wm8505_regs.h b/arch/arm/mach-vt8500/include/mach/wm8505_regs.h
new file mode 100644
index 000000000000..df1550941efb
--- /dev/null
+++ b/arch/arm/mach-vt8500/include/mach/wm8505_regs.h
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/mach-vt8500/include/mach/wm8505_regs.h
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __ASM_ARM_ARCH_WM8505_REGS_H
21#define __ASM_ARM_ARCH_WM8505_REGS_H
22
23/* WM8505 Registers Map */
24
25#define WM8505_REGS_START_PHYS 0xd8000000 /* Start of MMIO registers */
26#define WM8505_REGS_START_VIRT 0xf8000000 /* Virtual mapping start */
27
28#define WM8505_DDR_BASE 0xd8000400 /* 1k DDR/DDR2 Memory
29 Controller */
30#define WM8505_DMA_BASE 0xd8001800 /* 1k DMA Controller */
31#define WM8505_VDMA_BASE 0xd8001c00 /* 1k VDMA */
32#define WM8505_SFLASH_BASE 0xd8002000 /* 1k Serial Flash Memory
33 Controller */
34#define WM8505_ETHER_BASE 0xd8004000 /* 1k Ethernet MAC 0 */
35#define WM8505_CIPHER_BASE 0xd8006000 /* 4k Cipher */
36#define WM8505_USB_BASE 0xd8007000 /* 2k USB 2.0 Host */
37# define WM8505_EHCI_BASE 0xd8007100 /* EHCI */
38# define WM8505_UHCI_BASE 0xd8007301 /* UHCI */
39#define WM8505_PS2_BASE 0xd8008800 /* 1k PS/2 */
40#define WM8505_NAND_BASE 0xd8009000 /* 1k NAND Controller */
41#define WM8505_NOR_BASE 0xd8009400 /* 1k NOR Controller */
42#define WM8505_SDMMC_BASE 0xd800a000 /* 1k SD/MMC Controller */
43#define WM8505_VPU_BASE 0xd8050000 /* 256 VPU */
44#define WM8505_GOV_BASE 0xd8050300 /* 256 GOV */
45#define WM8505_GEGEA_BASE 0xd8050400 /* 768 GE/GE Alpha Mixing */
46#define WM8505_GOVR_BASE 0xd8050800 /* 512 GOVR (frambuffer) */
47#define WM8505_VID_BASE 0xd8050a00 /* 256 VID */
48#define WM8505_SCL_BASE 0xd8050d00 /* 256 SCL */
49#define WM8505_VPP_BASE 0xd8050f00 /* 256 VPP */
50#define WM8505_JPEGDEC_BASE 0xd80fe000 /* 4k JPEG Decoder */
51#define WM8505_RTC_BASE 0xd8100000 /* 64k RTC */
52#define WM8505_GPIO_BASE 0xd8110000 /* 64k GPIO Configuration */
53#define WM8505_SCC_BASE 0xd8120000 /* 64k System Configuration*/
54#define WM8505_PMC_BASE 0xd8130000 /* 64k PMC Configuration */
55#define WM8505_IC_BASE 0xd8140000 /* 64k Interrupt Controller*/
56#define WM8505_SIC_BASE 0xd8150000 /* 64k Secondary IC */
57#define WM8505_UART0_BASE 0xd8200000 /* 64k UART 0 */
58#define WM8505_UART2_BASE 0xd8210000 /* 64k UART 2 */
59#define WM8505_PWM_BASE 0xd8220000 /* 64k PWM Configuration */
60#define WM8505_SPI0_BASE 0xd8240000 /* 64k SPI 0 */
61#define WM8505_SPI1_BASE 0xd8250000 /* 64k SPI 1 */
62#define WM8505_KEYPAD_BASE 0xd8260000 /* 64k Keypad control */
63#define WM8505_CIR_BASE 0xd8270000 /* 64k CIR */
64#define WM8505_I2C0_BASE 0xd8280000 /* 64k I2C 0 */
65#define WM8505_AC97_BASE 0xd8290000 /* 64k AC97 */
66#define WM8505_SPI2_BASE 0xd82a0000 /* 64k SPI 2 */
67#define WM8505_UART1_BASE 0xd82b0000 /* 64k UART 1 */
68#define WM8505_UART3_BASE 0xd82c0000 /* 64k UART 3 */
69#define WM8505_I2C1_BASE 0xd8320000 /* 64k I2C 1 */
70#define WM8505_I2S_BASE 0xd8330000 /* 64k I2S */
71#define WM8505_UART4_BASE 0xd8370000 /* 64k UART 4 */
72#define WM8505_UART5_BASE 0xd8380000 /* 64k UART 5 */
73
74#define WM8505_REGS_END_PHYS 0xd838ffff /* End of MMIO registers */
75#define WM8505_REGS_LENGTH (WM8505_REGS_END_PHYS \
76 - WM8505_REGS_START_PHYS + 1)
77
78#endif
diff --git a/arch/arm/mach-vt8500/irq.c b/arch/arm/mach-vt8500/irq.c
new file mode 100644
index 000000000000..5f4ddde4f02a
--- /dev/null
+++ b/arch/arm/mach-vt8500/irq.c
@@ -0,0 +1,177 @@
1/*
2 * arch/arm/mach-vt8500/irq.c
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/io.h>
22#include <linux/irq.h>
23#include <linux/interrupt.h>
24
25#include <asm/irq.h>
26
27#include "devices.h"
28
29#define VT8500_IC_DCTR 0x40 /* Destination control
30 register, 64*u8 */
31#define VT8500_INT_ENABLE (1 << 3)
32#define VT8500_TRIGGER_HIGH (0 << 4)
33#define VT8500_TRIGGER_RISING (1 << 4)
34#define VT8500_TRIGGER_FALLING (2 << 4)
35#define VT8500_EDGE ( VT8500_TRIGGER_RISING \
36 | VT8500_TRIGGER_FALLING)
37#define VT8500_IC_STATUS 0x80 /* Interrupt status, 2*u32 */
38
39static void __iomem *ic_regbase;
40static void __iomem *sic_regbase;
41
42static void vt8500_irq_mask(unsigned int irq)
43{
44 void __iomem *base = ic_regbase;
45 u8 edge;
46
47 if (irq >= 64) {
48 base = sic_regbase;
49 irq -= 64;
50 }
51 edge = readb(base + VT8500_IC_DCTR + irq) & VT8500_EDGE;
52 if (edge) {
53 void __iomem *stat_reg = base + VT8500_IC_STATUS
54 + (irq < 32 ? 0 : 4);
55 unsigned status = readl(stat_reg);
56
57 status |= (1 << (irq & 0x1f));
58 writel(status, stat_reg);
59 } else {
60 u8 dctr = readb(base + VT8500_IC_DCTR + irq);
61
62 dctr &= ~VT8500_INT_ENABLE;
63 writeb(dctr, base + VT8500_IC_DCTR + irq);
64 }
65}
66
67static void vt8500_irq_unmask(unsigned int irq)
68{
69 void __iomem *base = ic_regbase;
70 u8 dctr;
71
72 if (irq >= 64) {
73 base = sic_regbase;
74 irq -= 64;
75 }
76 dctr = readb(base + VT8500_IC_DCTR + irq);
77 dctr |= VT8500_INT_ENABLE;
78 writeb(dctr, base + VT8500_IC_DCTR + irq);
79}
80
81static int vt8500_irq_set_type(unsigned int irq, unsigned int flow_type)
82{
83 void __iomem *base = ic_regbase;
84 unsigned int orig_irq = irq;
85 u8 dctr;
86
87 if (irq >= 64) {
88 base = sic_regbase;
89 irq -= 64;
90 }
91
92 dctr = readb(base + VT8500_IC_DCTR + irq);
93 dctr &= ~VT8500_EDGE;
94
95 switch (flow_type) {
96 case IRQF_TRIGGER_LOW:
97 return -EINVAL;
98 case IRQF_TRIGGER_HIGH:
99 dctr |= VT8500_TRIGGER_HIGH;
100 irq_desc[orig_irq].handle_irq = handle_level_irq;
101 break;
102 case IRQF_TRIGGER_FALLING:
103 dctr |= VT8500_TRIGGER_FALLING;
104 irq_desc[orig_irq].handle_irq = handle_edge_irq;
105 break;
106 case IRQF_TRIGGER_RISING:
107 dctr |= VT8500_TRIGGER_RISING;
108 irq_desc[orig_irq].handle_irq = handle_edge_irq;
109 break;
110 }
111 writeb(dctr, base + VT8500_IC_DCTR + irq);
112
113 return 0;
114}
115
116static struct irq_chip vt8500_irq_chip = {
117 .name = "vt8500",
118 .ack = vt8500_irq_mask,
119 .mask = vt8500_irq_mask,
120 .unmask = vt8500_irq_unmask,
121 .set_type = vt8500_irq_set_type,
122};
123
124void __init vt8500_init_irq(void)
125{
126 unsigned int i;
127
128 ic_regbase = ioremap(wmt_ic_base, SZ_64K);
129
130 if (ic_regbase) {
131 /* Enable rotating priority for IRQ */
132 writel((1 << 6), ic_regbase + 0x20);
133 writel(0, ic_regbase + 0x24);
134
135 for (i = 0; i < wmt_nr_irqs; i++) {
136 /* Disable all interrupts and route them to IRQ */
137 writeb(0x00, ic_regbase + VT8500_IC_DCTR + i);
138
139 set_irq_chip(i, &vt8500_irq_chip);
140 set_irq_handler(i, handle_level_irq);
141 set_irq_flags(i, IRQF_VALID);
142 }
143 } else {
144 printk(KERN_ERR "Unable to remap the Interrupt Controller registers, not enabling IRQs!\n");
145 }
146}
147
148void __init wm8505_init_irq(void)
149{
150 unsigned int i;
151
152 ic_regbase = ioremap(wmt_ic_base, SZ_64K);
153 sic_regbase = ioremap(wmt_sic_base, SZ_64K);
154
155 if (ic_regbase && sic_regbase) {
156 /* Enable rotating priority for IRQ */
157 writel((1 << 6), ic_regbase + 0x20);
158 writel(0, ic_regbase + 0x24);
159 writel((1 << 6), sic_regbase + 0x20);
160 writel(0, sic_regbase + 0x24);
161
162 for (i = 0; i < wmt_nr_irqs; i++) {
163 /* Disable all interrupts and route them to IRQ */
164 if (i < 64)
165 writeb(0x00, ic_regbase + VT8500_IC_DCTR + i);
166 else
167 writeb(0x00, sic_regbase + VT8500_IC_DCTR
168 + i - 64);
169
170 set_irq_chip(i, &vt8500_irq_chip);
171 set_irq_handler(i, handle_level_irq);
172 set_irq_flags(i, IRQF_VALID);
173 }
174 } else {
175 printk(KERN_ERR "Unable to remap the Interrupt Controller registers, not enabling IRQs!\n");
176 }
177}
diff --git a/arch/arm/mach-vt8500/pwm.c b/arch/arm/mach-vt8500/pwm.c
new file mode 100644
index 000000000000..8ad825e93592
--- /dev/null
+++ b/arch/arm/mach-vt8500/pwm.c
@@ -0,0 +1,265 @@
1/*
2 * arch/arm/mach-vt8500/pwm.c
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/platform_device.h>
19#include <linux/slab.h>
20#include <linux/err.h>
21#include <linux/io.h>
22#include <linux/pwm.h>
23#include <linux/delay.h>
24
25#include <asm/div64.h>
26
27#define VT8500_NR_PWMS 4
28
29static DEFINE_MUTEX(pwm_lock);
30static LIST_HEAD(pwm_list);
31
32struct pwm_device {
33 struct list_head node;
34 struct platform_device *pdev;
35
36 const char *label;
37
38 void __iomem *regbase;
39
40 unsigned int use_count;
41 unsigned int pwm_id;
42};
43
44#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
45static inline void pwm_busy_wait(void __iomem *reg, u8 bitmask)
46{
47 int loops = msecs_to_loops(10);
48 while ((readb(reg) & bitmask) && --loops)
49 cpu_relax();
50
51 if (unlikely(!loops))
52 pr_warning("Waiting for status bits 0x%x to clear timed out\n",
53 bitmask);
54}
55
56int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
57{
58 unsigned long long c;
59 unsigned long period_cycles, prescale, pv, dc;
60
61 if (pwm == NULL || period_ns == 0 || duty_ns > period_ns)
62 return -EINVAL;
63
64 c = 25000000/2; /* wild guess --- need to implement clocks */
65 c = c * period_ns;
66 do_div(c, 1000000000);
67 period_cycles = c;
68
69 if (period_cycles < 1)
70 period_cycles = 1;
71 prescale = (period_cycles - 1) / 4096;
72 pv = period_cycles / (prescale + 1) - 1;
73 if (pv > 4095)
74 pv = 4095;
75
76 if (prescale > 1023)
77 return -EINVAL;
78
79 c = (unsigned long long)pv * duty_ns;
80 do_div(c, period_ns);
81 dc = c;
82
83 pwm_busy_wait(pwm->regbase + 0x40 + pwm->pwm_id, (1 << 1));
84 writel(prescale, pwm->regbase + 0x4 + (pwm->pwm_id << 4));
85
86 pwm_busy_wait(pwm->regbase + 0x40 + pwm->pwm_id, (1 << 2));
87 writel(pv, pwm->regbase + 0x8 + (pwm->pwm_id << 4));
88
89 pwm_busy_wait(pwm->regbase + 0x40 + pwm->pwm_id, (1 << 3));
90 writel(dc, pwm->regbase + 0xc + (pwm->pwm_id << 4));
91
92 return 0;
93}
94EXPORT_SYMBOL(pwm_config);
95
96int pwm_enable(struct pwm_device *pwm)
97{
98 pwm_busy_wait(pwm->regbase + 0x40 + pwm->pwm_id, (1 << 0));
99 writel(5, pwm->regbase + (pwm->pwm_id << 4));
100 return 0;
101}
102EXPORT_SYMBOL(pwm_enable);
103
104void pwm_disable(struct pwm_device *pwm)
105{
106 pwm_busy_wait(pwm->regbase + 0x40 + pwm->pwm_id, (1 << 0));
107 writel(0, pwm->regbase + (pwm->pwm_id << 4));
108}
109EXPORT_SYMBOL(pwm_disable);
110
111struct pwm_device *pwm_request(int pwm_id, const char *label)
112{
113 struct pwm_device *pwm;
114 int found = 0;
115
116 mutex_lock(&pwm_lock);
117
118 list_for_each_entry(pwm, &pwm_list, node) {
119 if (pwm->pwm_id == pwm_id) {
120 found = 1;
121 break;
122 }
123 }
124
125 if (found) {
126 if (pwm->use_count == 0) {
127 pwm->use_count++;
128 pwm->label = label;
129 } else {
130 pwm = ERR_PTR(-EBUSY);
131 }
132 } else {
133 pwm = ERR_PTR(-ENOENT);
134 }
135
136 mutex_unlock(&pwm_lock);
137 return pwm;
138}
139EXPORT_SYMBOL(pwm_request);
140
141void pwm_free(struct pwm_device *pwm)
142{
143 mutex_lock(&pwm_lock);
144
145 if (pwm->use_count) {
146 pwm->use_count--;
147 pwm->label = NULL;
148 } else {
149 pr_warning("PWM device already freed\n");
150 }
151
152 mutex_unlock(&pwm_lock);
153}
154EXPORT_SYMBOL(pwm_free);
155
156static inline void __add_pwm(struct pwm_device *pwm)
157{
158 mutex_lock(&pwm_lock);
159 list_add_tail(&pwm->node, &pwm_list);
160 mutex_unlock(&pwm_lock);
161}
162
163static int __devinit pwm_probe(struct platform_device *pdev)
164{
165 struct pwm_device *pwms;
166 struct resource *r;
167 int ret = 0;
168 int i;
169
170 pwms = kzalloc(sizeof(struct pwm_device) * VT8500_NR_PWMS, GFP_KERNEL);
171 if (pwms == NULL) {
172 dev_err(&pdev->dev, "failed to allocate memory\n");
173 return -ENOMEM;
174 }
175
176 for (i = 0; i < VT8500_NR_PWMS; i++) {
177 pwms[i].use_count = 0;
178 pwms[i].pwm_id = i;
179 pwms[i].pdev = pdev;
180 }
181
182 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
183 if (r == NULL) {
184 dev_err(&pdev->dev, "no memory resource defined\n");
185 ret = -ENODEV;
186 goto err_free;
187 }
188
189 r = request_mem_region(r->start, resource_size(r), pdev->name);
190 if (r == NULL) {
191 dev_err(&pdev->dev, "failed to request memory resource\n");
192 ret = -EBUSY;
193 goto err_free;
194 }
195
196 pwms[0].regbase = ioremap(r->start, resource_size(r));
197 if (pwms[0].regbase == NULL) {
198 dev_err(&pdev->dev, "failed to ioremap() registers\n");
199 ret = -ENODEV;
200 goto err_free_mem;
201 }
202
203 for (i = 1; i < VT8500_NR_PWMS; i++)
204 pwms[i].regbase = pwms[0].regbase;
205
206 for (i = 0; i < VT8500_NR_PWMS; i++)
207 __add_pwm(&pwms[i]);
208
209 platform_set_drvdata(pdev, pwms);
210 return 0;
211
212err_free_mem:
213 release_mem_region(r->start, resource_size(r));
214err_free:
215 kfree(pwms);
216 return ret;
217}
218
219static int __devexit pwm_remove(struct platform_device *pdev)
220{
221 struct pwm_device *pwms;
222 struct resource *r;
223 int i;
224
225 pwms = platform_get_drvdata(pdev);
226 if (pwms == NULL)
227 return -ENODEV;
228
229 mutex_lock(&pwm_lock);
230
231 for (i = 0; i < VT8500_NR_PWMS; i++)
232 list_del(&pwms[i].node);
233 mutex_unlock(&pwm_lock);
234
235 iounmap(pwms[0].regbase);
236
237 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
238 release_mem_region(r->start, resource_size(r));
239
240 kfree(pwms);
241 return 0;
242}
243
244static struct platform_driver pwm_driver = {
245 .driver = {
246 .name = "vt8500-pwm",
247 .owner = THIS_MODULE,
248 },
249 .probe = pwm_probe,
250 .remove = __devexit_p(pwm_remove),
251};
252
253static int __init pwm_init(void)
254{
255 return platform_driver_register(&pwm_driver);
256}
257arch_initcall(pwm_init);
258
259static void __exit pwm_exit(void)
260{
261 platform_driver_unregister(&pwm_driver);
262}
263module_exit(pwm_exit);
264
265MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-vt8500/timer.c b/arch/arm/mach-vt8500/timer.c
new file mode 100644
index 000000000000..d5376c592ab6
--- /dev/null
+++ b/arch/arm/mach-vt8500/timer.c
@@ -0,0 +1,155 @@
1/*
2 * arch/arm/mach-vt8500/timer.c
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/io.h>
22#include <linux/irq.h>
23#include <linux/interrupt.h>
24#include <linux/clocksource.h>
25#include <linux/clockchips.h>
26#include <linux/delay.h>
27
28#include <asm/mach/time.h>
29
30#include "devices.h"
31
32#define VT8500_TIMER_OFFSET 0x0100
33#define TIMER_MATCH_VAL 0x0000
34#define TIMER_COUNT_VAL 0x0010
35#define TIMER_STATUS_VAL 0x0014
36#define TIMER_IER_VAL 0x001c /* interrupt enable */
37#define TIMER_CTRL_VAL 0x0020
38#define TIMER_AS_VAL 0x0024 /* access status */
39#define TIMER_COUNT_R_ACTIVE (1 << 5) /* not ready for read */
40#define TIMER_COUNT_W_ACTIVE (1 << 4) /* not ready for write */
41#define TIMER_MATCH_W_ACTIVE (1 << 0) /* not ready for write */
42#define VT8500_TIMER_HZ 3000000
43
44#define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
45
46static void __iomem *regbase;
47
48static cycle_t vt8500_timer_read(struct clocksource *cs)
49{
50 int loops = msecs_to_loops(10);
51 writel(3, regbase + TIMER_CTRL_VAL);
52 while ((readl((regbase + TIMER_AS_VAL)) & TIMER_COUNT_R_ACTIVE)
53 && --loops)
54 cpu_relax();
55 return readl(regbase + TIMER_COUNT_VAL);
56}
57
58struct clocksource clocksource = {
59 .name = "vt8500_timer",
60 .rating = 200,
61 .read = vt8500_timer_read,
62 .mask = CLOCKSOURCE_MASK(32),
63 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
64};
65
66static int vt8500_timer_set_next_event(unsigned long cycles,
67 struct clock_event_device *evt)
68{
69 int loops = msecs_to_loops(10);
70 cycle_t alarm = clocksource.read(&clocksource) + cycles;
71 while ((readl(regbase + TIMER_AS_VAL) & TIMER_MATCH_W_ACTIVE)
72 && --loops)
73 cpu_relax();
74 writel((unsigned long)alarm, regbase + TIMER_MATCH_VAL);
75
76 if ((signed)(alarm - clocksource.read(&clocksource)) <= 16)
77 return -ETIME;
78
79 writel(1, regbase + TIMER_IER_VAL);
80
81 return 0;
82}
83
84static void vt8500_timer_set_mode(enum clock_event_mode mode,
85 struct clock_event_device *evt)
86{
87 switch (mode) {
88 case CLOCK_EVT_MODE_RESUME:
89 case CLOCK_EVT_MODE_PERIODIC:
90 break;
91 case CLOCK_EVT_MODE_ONESHOT:
92 case CLOCK_EVT_MODE_UNUSED:
93 case CLOCK_EVT_MODE_SHUTDOWN:
94 writel(readl(regbase + TIMER_CTRL_VAL) | 1,
95 regbase + TIMER_CTRL_VAL);
96 writel(0, regbase + TIMER_IER_VAL);
97 break;
98 }
99}
100
101struct clock_event_device clockevent = {
102 .name = "vt8500_timer",
103 .features = CLOCK_EVT_FEAT_ONESHOT,
104 .rating = 200,
105 .set_next_event = vt8500_timer_set_next_event,
106 .set_mode = vt8500_timer_set_mode,
107};
108
109static irqreturn_t vt8500_timer_interrupt(int irq, void *dev_id)
110{
111 struct clock_event_device *evt = dev_id;
112 writel(0xf, regbase + TIMER_STATUS_VAL);
113 evt->event_handler(evt);
114
115 return IRQ_HANDLED;
116}
117
118struct irqaction irq = {
119 .name = "vt8500_timer",
120 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
121 .handler = vt8500_timer_interrupt,
122 .dev_id = &clockevent,
123};
124
125static void __init vt8500_timer_init(void)
126{
127 regbase = ioremap(wmt_pmc_base + VT8500_TIMER_OFFSET, 0x28);
128 if (!regbase)
129 printk(KERN_ERR "vt8500_timer_init: failed to map MMIO registers\n");
130
131 writel(1, regbase + TIMER_CTRL_VAL);
132 writel(0xf, regbase + TIMER_STATUS_VAL);
133 writel(~0, regbase + TIMER_MATCH_VAL);
134
135 if (clocksource_register_hz(&clocksource, VT8500_TIMER_HZ))
136 printk(KERN_ERR "vt8500_timer_init: clocksource_register failed for %s\n",
137 clocksource.name);
138
139 clockevents_calc_mult_shift(&clockevent, VT8500_TIMER_HZ, 4);
140
141 /* copy-pasted from mach-msm; no idea */
142 clockevent.max_delta_ns =
143 clockevent_delta2ns(0xf0000000, &clockevent);
144 clockevent.min_delta_ns = clockevent_delta2ns(4, &clockevent);
145 clockevent.cpumask = cpumask_of(0);
146
147 if (setup_irq(wmt_timer_irq, &irq))
148 printk(KERN_ERR "vt8500_timer_init: setup_irq failed for %s\n",
149 clockevent.name);
150 clockevents_register_device(&clockevent);
151}
152
153struct sys_timer vt8500_timer = {
154 .init = vt8500_timer_init
155};
diff --git a/arch/arm/mach-vt8500/wm8505_7in.c b/arch/arm/mach-vt8500/wm8505_7in.c
new file mode 100644
index 000000000000..e73aadbcafd6
--- /dev/null
+++ b/arch/arm/mach-vt8500/wm8505_7in.c
@@ -0,0 +1,77 @@
1/*
2 * arch/arm/mach-vt8500/wm8505_7in.c
3 *
4 * Copyright (C) 2010 Alexey Charkov <alchark@gmail.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/io.h>
22#include <linux/pm.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include "devices.h"
28
29static void __iomem *pmc_hiber;
30
31static struct platform_device *devices[] __initdata = {
32 &vt8500_device_uart0,
33 &vt8500_device_ehci,
34 &vt8500_device_wm8505_fb,
35 &vt8500_device_ge_rops,
36 &vt8500_device_pwm,
37 &vt8500_device_pwmbl,
38 &vt8500_device_rtc,
39};
40
41static void vt8500_power_off(void)
42{
43 local_irq_disable();
44 writew(5, pmc_hiber);
45 asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0));
46}
47
48void __init wm8505_7in_init(void)
49{
50#ifdef CONFIG_FB_WM8505
51 void __iomem *gpio_mux_reg = ioremap(wmt_gpio_base + 0x200, 4);
52 if (gpio_mux_reg) {
53 writel(readl(gpio_mux_reg) | 0x80000000, gpio_mux_reg);
54 iounmap(gpio_mux_reg);
55 } else {
56 printk(KERN_ERR "Could not remap the GPIO mux register, display may not work properly!\n");
57 }
58#endif
59 pmc_hiber = ioremap(wmt_pmc_base + 0x12, 2);
60 if (pmc_hiber)
61 pm_power_off = &vt8500_power_off;
62 else
63 printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n");
64
65 wm8505_set_resources();
66 platform_add_devices(devices, ARRAY_SIZE(devices));
67 vt8500_gpio_init();
68}
69
70MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook")
71 .boot_params = 0x00000100,
72 .reserve = wm8505_reserve_mem,
73 .map_io = wm8505_map_io,
74 .init_irq = wm8505_init_irq,
75 .timer = &vt8500_timer,
76 .init_machine = wm8505_7in_init,
77MACHINE_END
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 9d30c6f804b9..89266382b536 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -390,7 +390,7 @@ config CPU_PJ4
390 390
391# ARMv6 391# ARMv6
392config CPU_V6 392config CPU_V6
393 bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX || ARCH_DOVE 393 bool "Support ARM V6 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
394 select CPU_32v6 394 select CPU_32v6
395 select CPU_ABRT_EV6 395 select CPU_ABRT_EV6
396 select CPU_PABRT_V6 396 select CPU_PABRT_V6
@@ -402,21 +402,23 @@ config CPU_V6
402 select CPU_TLB_V6 if MMU 402 select CPU_TLB_V6 if MMU
403 403
404# ARMv6k 404# ARMv6k
405config CPU_32v6K 405config CPU_V6K
406 bool "Support ARM V6K processor extensions" if !SMP 406 bool "Support ARM V6K processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
407 depends on CPU_V6 || CPU_V7 407 select CPU_32v6
408 default y if SMP && !(ARCH_MX3 || ARCH_OMAP2) 408 select CPU_32v6K
409 help 409 select CPU_ABRT_EV6
410 Say Y here if your ARMv6 processor supports the 'K' extension. 410 select CPU_PABRT_V6
411 This enables the kernel to use some instructions not present 411 select CPU_CACHE_V6
412 on previous processors, and as such a kernel build with this 412 select CPU_CACHE_VIPT
413 enabled will not boot on processors with do not support these 413 select CPU_CP15_MMU
414 instructions. 414 select CPU_HAS_ASID if MMU
415 select CPU_COPY_V6 if MMU
416 select CPU_TLB_V6 if MMU
415 417
416# ARMv7 418# ARMv7
417config CPU_V7 419config CPU_V7
418 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX 420 bool "Support ARM V7 processor" if ARCH_INTEGRATOR || MACH_REALVIEW_EB || MACH_REALVIEW_PBX
419 select CPU_32v6K if !ARCH_OMAP2 421 select CPU_32v6K
420 select CPU_32v7 422 select CPU_32v7
421 select CPU_ABRT_EV7 423 select CPU_ABRT_EV7
422 select CPU_PABRT_V7 424 select CPU_PABRT_V7
@@ -433,25 +435,33 @@ config CPU_32v3
433 bool 435 bool
434 select TLS_REG_EMUL if SMP || !MMU 436 select TLS_REG_EMUL if SMP || !MMU
435 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 437 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
438 select CPU_USE_DOMAINS if MMU
436 439
437config CPU_32v4 440config CPU_32v4
438 bool 441 bool
439 select TLS_REG_EMUL if SMP || !MMU 442 select TLS_REG_EMUL if SMP || !MMU
440 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 443 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
444 select CPU_USE_DOMAINS if MMU
441 445
442config CPU_32v4T 446config CPU_32v4T
443 bool 447 bool
444 select TLS_REG_EMUL if SMP || !MMU 448 select TLS_REG_EMUL if SMP || !MMU
445 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 449 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
450 select CPU_USE_DOMAINS if MMU
446 451
447config CPU_32v5 452config CPU_32v5
448 bool 453 bool
449 select TLS_REG_EMUL if SMP || !MMU 454 select TLS_REG_EMUL if SMP || !MMU
450 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP 455 select NEEDS_SYSCALL_FOR_CMPXCHG if SMP
456 select CPU_USE_DOMAINS if MMU
451 457
452config CPU_32v6 458config CPU_32v6
453 bool 459 bool
454 select TLS_REG_EMUL if !CPU_32v6K && !MMU 460 select TLS_REG_EMUL if !CPU_32v6K && !MMU
461 select CPU_USE_DOMAINS if CPU_V6 && MMU
462
463config CPU_32v6K
464 bool
455 465
456config CPU_32v7 466config CPU_32v7
457 bool 467 bool
@@ -607,8 +617,6 @@ config CPU_CP15_MPU
607 617
608config CPU_USE_DOMAINS 618config CPU_USE_DOMAINS
609 bool 619 bool
610 depends on MMU
611 default y if !CPU_32v6K
612 help 620 help
613 This option enables or disables the use of domain switching 621 This option enables or disables the use of domain switching
614 via the set_fs() function. 622 via the set_fs() function.
@@ -623,7 +631,7 @@ comment "Processor Features"
623 631
624config ARM_THUMB 632config ARM_THUMB
625 bool "Support Thumb user binaries" 633 bool "Support Thumb user binaries"
626 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V7 || CPU_FEROCEON 634 depends on CPU_ARM720T || CPU_ARM740T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM940T || CPU_ARM946E || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_V6 || CPU_V6K || CPU_V7 || CPU_FEROCEON
627 default y 635 default y
628 help 636 help
629 Say Y if you want to include kernel support for running user space 637 Say Y if you want to include kernel support for running user space
@@ -644,7 +652,7 @@ config ARM_THUMBEE
644 652
645config SWP_EMULATE 653config SWP_EMULATE
646 bool "Emulate SWP/SWPB instructions" 654 bool "Emulate SWP/SWPB instructions"
647 depends on CPU_V7 && !CPU_V6 655 depends on !CPU_USE_DOMAINS && CPU_V7
648 select HAVE_PROC_CPU if PROC_FS 656 select HAVE_PROC_CPU if PROC_FS
649 default y if SMP 657 default y if SMP
650 help 658 help
@@ -681,7 +689,7 @@ config CPU_BIG_ENDIAN
681config CPU_ENDIAN_BE8 689config CPU_ENDIAN_BE8
682 bool 690 bool
683 depends on CPU_BIG_ENDIAN 691 depends on CPU_BIG_ENDIAN
684 default CPU_V6 || CPU_V7 692 default CPU_V6 || CPU_V6K || CPU_V7
685 help 693 help
686 Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors. 694 Support for the BE-8 (big-endian) mode on ARMv6 and ARMv7 processors.
687 695
@@ -747,7 +755,7 @@ config CPU_CACHE_ROUND_ROBIN
747 755
748config CPU_BPREDICT_DISABLE 756config CPU_BPREDICT_DISABLE
749 bool "Disable branch prediction" 757 bool "Disable branch prediction"
750 depends on CPU_ARM1020 || CPU_V6 || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526 758 depends on CPU_ARM1020 || CPU_V6 || CPU_V6K || CPU_MOHAWK || CPU_XSC3 || CPU_V7 || CPU_FA526
751 help 759 help
752 Say Y here to disable branch prediction. If unsure, say N. 760 Say Y here to disable branch prediction. If unsure, say N.
753 761
@@ -767,7 +775,7 @@ config NEEDS_SYSCALL_FOR_CMPXCHG
767 775
768config DMA_CACHE_RWFO 776config DMA_CACHE_RWFO
769 bool "Enable read/write for ownership DMA cache maintenance" 777 bool "Enable read/write for ownership DMA cache maintenance"
770 depends on CPU_V6 && SMP 778 depends on CPU_V6K && SMP
771 default y 779 default y
772 help 780 help
773 The Snoop Control Unit on ARM11MPCore does not detect the 781 The Snoop Control Unit on ARM11MPCore does not detect the
@@ -823,7 +831,7 @@ config CACHE_L2X0
823config CACHE_PL310 831config CACHE_PL310
824 bool 832 bool
825 depends on CACHE_L2X0 833 depends on CACHE_L2X0
826 default y if CPU_V7 && !CPU_V6 834 default y if CPU_V7 && !(CPU_V6 || CPU_V6K)
827 help 835 help
828 This option enables optimisations for the PL310 cache 836 This option enables optimisations for the PL310 cache
829 controller. 837 controller.
@@ -845,16 +853,21 @@ config CACHE_XSC3L2
845 help 853 help
846 This option enables the L2 cache on XScale3. 854 This option enables the L2 cache on XScale3.
847 855
856config ARM_L1_CACHE_SHIFT_6
857 bool
858 help
859 Setting ARM L1 cache line size to 64 Bytes.
860
848config ARM_L1_CACHE_SHIFT 861config ARM_L1_CACHE_SHIFT
849 int 862 int
850 default 6 if ARM_L1_CACHE_SHIFT_6 863 default 6 if ARM_L1_CACHE_SHIFT_6
851 default 5 864 default 5
852 865
853config ARM_DMA_MEM_BUFFERABLE 866config ARM_DMA_MEM_BUFFERABLE
854 bool "Use non-cacheable memory for DMA" if CPU_V6 && !CPU_V7 867 bool "Use non-cacheable memory for DMA" if (CPU_V6 || CPU_V6K) && !CPU_V7
855 depends on !(MACH_REALVIEW_PB1176 || REALVIEW_EB_ARM11MP || \ 868 depends on !(MACH_REALVIEW_PB1176 || REALVIEW_EB_ARM11MP || \
856 MACH_REALVIEW_PB11MP) 869 MACH_REALVIEW_PB11MP)
857 default y if CPU_V6 || CPU_V7 870 default y if CPU_V6 || CPU_V6K || CPU_V7
858 help 871 help
859 Historically, the kernel has used strongly ordered mappings to 872 Historically, the kernel has used strongly ordered mappings to
860 provide DMA coherent memory. With the advent of ARMv7, mapping 873 provide DMA coherent memory. With the advent of ARMv7, mapping
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 00d74a04af3a..bca7e61928c7 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -90,6 +90,7 @@ obj-$(CONFIG_CPU_XSC3) += proc-xsc3.o
90obj-$(CONFIG_CPU_MOHAWK) += proc-mohawk.o 90obj-$(CONFIG_CPU_MOHAWK) += proc-mohawk.o
91obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o 91obj-$(CONFIG_CPU_FEROCEON) += proc-feroceon.o
92obj-$(CONFIG_CPU_V6) += proc-v6.o 92obj-$(CONFIG_CPU_V6) += proc-v6.o
93obj-$(CONFIG_CPU_V6K) += proc-v6.o
93obj-$(CONFIG_CPU_V7) += proc-v7.o 94obj-$(CONFIG_CPU_V7) += proc-v7.o
94 95
95AFLAGS_proc-v6.o :=-Wa,-march=armv6 96AFLAGS_proc-v6.o :=-Wa,-march=armv6
diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
index f332df7f0d37..1478aa522144 100644
--- a/arch/arm/mm/abort-ev6.S
+++ b/arch/arm/mm/abort-ev6.S
@@ -20,11 +20,11 @@
20 */ 20 */
21 .align 5 21 .align 5
22ENTRY(v6_early_abort) 22ENTRY(v6_early_abort)
23#ifdef CONFIG_CPU_32v6K 23#ifdef CONFIG_CPU_V6
24 clrex
25#else
26 sub r1, sp, #4 @ Get unused stack location 24 sub r1, sp, #4 @ Get unused stack location
27 strex r0, r1, [r1] @ Clear the exclusive monitor 25 strex r0, r1, [r1] @ Clear the exclusive monitor
26#elif defined(CONFIG_CPU_32v6K)
27 clrex
28#endif 28#endif
29 mrc p15, 0, r1, c5, c0, 0 @ get FSR 29 mrc p15, 0, r1, c5, c0, 0 @ get FSR
30 mrc p15, 0, r0, c6, c0, 0 @ get FAR 30 mrc p15, 0, r0, c6, c0, 0 @ get FAR
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 170c9bb95866..ef59099a5463 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -49,7 +49,13 @@ static inline void cache_wait(void __iomem *reg, unsigned long mask)
49static inline void cache_sync(void) 49static inline void cache_sync(void)
50{ 50{
51 void __iomem *base = l2x0_base; 51 void __iomem *base = l2x0_base;
52
53#ifdef CONFIG_ARM_ERRATA_753970
54 /* write to an unmmapped register */
55 writel_relaxed(0, base + L2X0_DUMMY_REG);
56#else
52 writel_relaxed(0, base + L2X0_CACHE_SYNC); 57 writel_relaxed(0, base + L2X0_CACHE_SYNC);
58#endif
53 cache_wait(base + L2X0_CACHE_SYNC, 1); 59 cache_wait(base + L2X0_CACHE_SYNC, 1);
54} 60}
55 61
@@ -67,18 +73,24 @@ static inline void l2x0_inv_line(unsigned long addr)
67 writel_relaxed(addr, base + L2X0_INV_LINE_PA); 73 writel_relaxed(addr, base + L2X0_INV_LINE_PA);
68} 74}
69 75
70#ifdef CONFIG_PL310_ERRATA_588369 76#if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915)
71static void debug_writel(unsigned long val)
72{
73 extern void omap_smc1(u32 fn, u32 arg);
74 77
75 /* 78#define debug_writel(val) outer_cache.set_debug(val)
76 * Texas Instrument secure monitor api to modify the 79
77 * PL310 Debug Control Register. 80static void l2x0_set_debug(unsigned long val)
78 */ 81{
79 omap_smc1(0x100, val); 82 writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL);
83}
84#else
85/* Optimised out for non-errata case */
86static inline void debug_writel(unsigned long val)
87{
80} 88}
81 89
90#define l2x0_set_debug NULL
91#endif
92
93#ifdef CONFIG_PL310_ERRATA_588369
82static inline void l2x0_flush_line(unsigned long addr) 94static inline void l2x0_flush_line(unsigned long addr)
83{ 95{
84 void __iomem *base = l2x0_base; 96 void __iomem *base = l2x0_base;
@@ -91,11 +103,6 @@ static inline void l2x0_flush_line(unsigned long addr)
91} 103}
92#else 104#else
93 105
94/* Optimised out for non-errata case */
95static inline void debug_writel(unsigned long val)
96{
97}
98
99static inline void l2x0_flush_line(unsigned long addr) 106static inline void l2x0_flush_line(unsigned long addr)
100{ 107{
101 void __iomem *base = l2x0_base; 108 void __iomem *base = l2x0_base;
@@ -119,9 +126,11 @@ static void l2x0_flush_all(void)
119 126
120 /* clean all ways */ 127 /* clean all ways */
121 spin_lock_irqsave(&l2x0_lock, flags); 128 spin_lock_irqsave(&l2x0_lock, flags);
129 debug_writel(0x03);
122 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY); 130 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY);
123 cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask); 131 cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask);
124 cache_sync(); 132 cache_sync();
133 debug_writel(0x00);
125 spin_unlock_irqrestore(&l2x0_lock, flags); 134 spin_unlock_irqrestore(&l2x0_lock, flags);
126} 135}
127 136
@@ -329,6 +338,7 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
329 outer_cache.flush_all = l2x0_flush_all; 338 outer_cache.flush_all = l2x0_flush_all;
330 outer_cache.inv_all = l2x0_inv_all; 339 outer_cache.inv_all = l2x0_inv_all;
331 outer_cache.disable = l2x0_disable; 340 outer_cache.disable = l2x0_disable;
341 outer_cache.set_debug = l2x0_set_debug;
332 342
333 printk(KERN_INFO "%s cache controller enabled\n", type); 343 printk(KERN_INFO "%s cache controller enabled\n", type);
334 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 344 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index b0a98305055c..afe209e1e1f8 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -31,7 +31,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
31 struct mm_struct *mm = current->mm; 31 struct mm_struct *mm = current->mm;
32 struct vm_area_struct *vma; 32 struct vm_area_struct *vma;
33 unsigned long start_addr; 33 unsigned long start_addr;
34#ifdef CONFIG_CPU_V6 34#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K)
35 unsigned int cache_type; 35 unsigned int cache_type;
36 int do_align = 0, aliasing = 0; 36 int do_align = 0, aliasing = 0;
37 37
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 3c67e92f7d59..ff7b43b5885a 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -827,16 +827,6 @@ static void __init sanity_check_meminfo(void)
827 * rather difficult. 827 * rather difficult.
828 */ 828 */
829 reason = "with VIPT aliasing cache"; 829 reason = "with VIPT aliasing cache";
830 } else if (is_smp() && tlb_ops_need_broadcast()) {
831 /*
832 * kmap_high needs to occasionally flush TLB entries,
833 * however, if the TLB entries need to be broadcast
834 * we may deadlock:
835 * kmap_high(irqs off)->flush_all_zero_pkmaps->
836 * flush_tlb_kernel_range->smp_call_function_many
837 * (must not be called with irqs off)
838 */
839 reason = "without hardware TLB ops broadcasting";
840 } 830 }
841 if (reason) { 831 if (reason) {
842 printk(KERN_CRIT "HIGHMEM is not supported %s, ignoring high memory\n", 832 printk(KERN_CRIT "HIGHMEM is not supported %s, ignoring high memory\n",
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index bcf748d9f4e2..226e3d8351c2 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -493,6 +493,9 @@ arm1020_processor_functions:
493 .word cpu_arm1020_dcache_clean_area 493 .word cpu_arm1020_dcache_clean_area
494 .word cpu_arm1020_switch_mm 494 .word cpu_arm1020_switch_mm
495 .word cpu_arm1020_set_pte_ext 495 .word cpu_arm1020_set_pte_ext
496 .word 0
497 .word 0
498 .word 0
496 .size arm1020_processor_functions, . - arm1020_processor_functions 499 .size arm1020_processor_functions, . - arm1020_processor_functions
497 500
498 .section ".rodata" 501 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index ab7ec26657ea..86d9c2cf0bce 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -474,6 +474,9 @@ arm1020e_processor_functions:
474 .word cpu_arm1020e_dcache_clean_area 474 .word cpu_arm1020e_dcache_clean_area
475 .word cpu_arm1020e_switch_mm 475 .word cpu_arm1020e_switch_mm
476 .word cpu_arm1020e_set_pte_ext 476 .word cpu_arm1020e_set_pte_ext
477 .word 0
478 .word 0
479 .word 0
477 .size arm1020e_processor_functions, . - arm1020e_processor_functions 480 .size arm1020e_processor_functions, . - arm1020e_processor_functions
478 481
479 .section ".rodata" 482 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 831c5e54e22f..83d3dd34f846 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -457,6 +457,9 @@ arm1022_processor_functions:
457 .word cpu_arm1022_dcache_clean_area 457 .word cpu_arm1022_dcache_clean_area
458 .word cpu_arm1022_switch_mm 458 .word cpu_arm1022_switch_mm
459 .word cpu_arm1022_set_pte_ext 459 .word cpu_arm1022_set_pte_ext
460 .word 0
461 .word 0
462 .word 0
460 .size arm1022_processor_functions, . - arm1022_processor_functions 463 .size arm1022_processor_functions, . - arm1022_processor_functions
461 464
462 .section ".rodata" 465 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index e3f7e9a166bf..686043ee7281 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -452,6 +452,9 @@ arm1026_processor_functions:
452 .word cpu_arm1026_dcache_clean_area 452 .word cpu_arm1026_dcache_clean_area
453 .word cpu_arm1026_switch_mm 453 .word cpu_arm1026_switch_mm
454 .word cpu_arm1026_set_pte_ext 454 .word cpu_arm1026_set_pte_ext
455 .word 0
456 .word 0
457 .word 0
455 .size arm1026_processor_functions, . - arm1026_processor_functions 458 .size arm1026_processor_functions, . - arm1026_processor_functions
456 459
457 .section .rodata 460 .section .rodata
diff --git a/arch/arm/mm/proc-arm6_7.S b/arch/arm/mm/proc-arm6_7.S
index 6a7be1863edd..5f79dc4ce3fb 100644
--- a/arch/arm/mm/proc-arm6_7.S
+++ b/arch/arm/mm/proc-arm6_7.S
@@ -284,6 +284,9 @@ ENTRY(arm6_processor_functions)
284 .word cpu_arm6_dcache_clean_area 284 .word cpu_arm6_dcache_clean_area
285 .word cpu_arm6_switch_mm 285 .word cpu_arm6_switch_mm
286 .word cpu_arm6_set_pte_ext 286 .word cpu_arm6_set_pte_ext
287 .word 0
288 .word 0
289 .word 0
287 .size arm6_processor_functions, . - arm6_processor_functions 290 .size arm6_processor_functions, . - arm6_processor_functions
288 291
289/* 292/*
@@ -301,6 +304,9 @@ ENTRY(arm7_processor_functions)
301 .word cpu_arm7_dcache_clean_area 304 .word cpu_arm7_dcache_clean_area
302 .word cpu_arm7_switch_mm 305 .word cpu_arm7_switch_mm
303 .word cpu_arm7_set_pte_ext 306 .word cpu_arm7_set_pte_ext
307 .word 0
308 .word 0
309 .word 0
304 .size arm7_processor_functions, . - arm7_processor_functions 310 .size arm7_processor_functions, . - arm7_processor_functions
305 311
306 .section ".rodata" 312 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index c285395f44b2..665266da143c 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -185,6 +185,9 @@ ENTRY(arm720_processor_functions)
185 .word cpu_arm720_dcache_clean_area 185 .word cpu_arm720_dcache_clean_area
186 .word cpu_arm720_switch_mm 186 .word cpu_arm720_switch_mm
187 .word cpu_arm720_set_pte_ext 187 .word cpu_arm720_set_pte_ext
188 .word 0
189 .word 0
190 .word 0
188 .size arm720_processor_functions, . - arm720_processor_functions 191 .size arm720_processor_functions, . - arm720_processor_functions
189 192
190 .section ".rodata" 193 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm740.S b/arch/arm/mm/proc-arm740.S
index 38b27dcba727..6f9d12effee1 100644
--- a/arch/arm/mm/proc-arm740.S
+++ b/arch/arm/mm/proc-arm740.S
@@ -130,6 +130,9 @@ ENTRY(arm740_processor_functions)
130 .word cpu_arm740_dcache_clean_area 130 .word cpu_arm740_dcache_clean_area
131 .word cpu_arm740_switch_mm 131 .word cpu_arm740_switch_mm
132 .word 0 @ cpu_*_set_pte 132 .word 0 @ cpu_*_set_pte
133 .word 0
134 .word 0
135 .word 0
133 .size arm740_processor_functions, . - arm740_processor_functions 136 .size arm740_processor_functions, . - arm740_processor_functions
134 137
135 .section ".rodata" 138 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm7tdmi.S b/arch/arm/mm/proc-arm7tdmi.S
index 0c9786de20af..e4c165ca6696 100644
--- a/arch/arm/mm/proc-arm7tdmi.S
+++ b/arch/arm/mm/proc-arm7tdmi.S
@@ -70,6 +70,9 @@ ENTRY(arm7tdmi_processor_functions)
70 .word cpu_arm7tdmi_dcache_clean_area 70 .word cpu_arm7tdmi_dcache_clean_area
71 .word cpu_arm7tdmi_switch_mm 71 .word cpu_arm7tdmi_switch_mm
72 .word 0 @ cpu_*_set_pte 72 .word 0 @ cpu_*_set_pte
73 .word 0
74 .word 0
75 .word 0
73 .size arm7tdmi_processor_functions, . - arm7tdmi_processor_functions 76 .size arm7tdmi_processor_functions, . - arm7tdmi_processor_functions
74 77
75 .section ".rodata" 78 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 6109f278a904..219980ec8b6e 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -387,6 +387,40 @@ ENTRY(cpu_arm920_set_pte_ext)
387#endif 387#endif
388 mov pc, lr 388 mov pc, lr
389 389
390/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
391.globl cpu_arm920_suspend_size
392.equ cpu_arm920_suspend_size, 4 * 3
393#ifdef CONFIG_PM
394ENTRY(cpu_arm920_do_suspend)
395 stmfd sp!, {r4 - r7, lr}
396 mrc p15, 0, r4, c13, c0, 0 @ PID
397 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
398 mrc p15, 0, r6, c2, c0, 0 @ TTB address
399 mrc p15, 0, r7, c1, c0, 0 @ Control register
400 stmia r0, {r4 - r7}
401 ldmfd sp!, {r4 - r7, pc}
402ENDPROC(cpu_arm920_do_suspend)
403
404ENTRY(cpu_arm920_do_resume)
405 mov ip, #0
406 mcr p15, 0, ip, c8, c7, 0 @ invalidate I+D TLBs
407 mcr p15, 0, ip, c7, c7, 0 @ invalidate I+D caches
408 ldmia r0, {r4 - r7}
409 mcr p15, 0, r4, c13, c0, 0 @ PID
410 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
411 mcr p15, 0, r6, c2, c0, 0 @ TTB address
412 mov r0, r7 @ control register
413 mov r2, r6, lsr #14 @ get TTB0 base
414 mov r2, r2, lsl #14
415 ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \
416 PMD_SECT_CACHEABLE | PMD_BIT4 | PMD_SECT_AP_WRITE
417 b cpu_resume_mmu
418ENDPROC(cpu_arm920_do_resume)
419#else
420#define cpu_arm920_do_suspend 0
421#define cpu_arm920_do_resume 0
422#endif
423
390 __CPUINIT 424 __CPUINIT
391 425
392 .type __arm920_setup, #function 426 .type __arm920_setup, #function
@@ -432,6 +466,9 @@ arm920_processor_functions:
432 .word cpu_arm920_dcache_clean_area 466 .word cpu_arm920_dcache_clean_area
433 .word cpu_arm920_switch_mm 467 .word cpu_arm920_switch_mm
434 .word cpu_arm920_set_pte_ext 468 .word cpu_arm920_set_pte_ext
469 .word cpu_arm920_suspend_size
470 .word cpu_arm920_do_suspend
471 .word cpu_arm920_do_resume
435 .size arm920_processor_functions, . - arm920_processor_functions 472 .size arm920_processor_functions, . - arm920_processor_functions
436 473
437 .section ".rodata" 474 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index bb2f0f46a5e6..36154b1e792a 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -436,6 +436,9 @@ arm922_processor_functions:
436 .word cpu_arm922_dcache_clean_area 436 .word cpu_arm922_dcache_clean_area
437 .word cpu_arm922_switch_mm 437 .word cpu_arm922_switch_mm
438 .word cpu_arm922_set_pte_ext 438 .word cpu_arm922_set_pte_ext
439 .word 0
440 .word 0
441 .word 0
439 .size arm922_processor_functions, . - arm922_processor_functions 442 .size arm922_processor_functions, . - arm922_processor_functions
440 443
441 .section ".rodata" 444 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index c13e01accfe2..89c5e0009c4c 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -503,6 +503,9 @@ arm925_processor_functions:
503 .word cpu_arm925_dcache_clean_area 503 .word cpu_arm925_dcache_clean_area
504 .word cpu_arm925_switch_mm 504 .word cpu_arm925_switch_mm
505 .word cpu_arm925_set_pte_ext 505 .word cpu_arm925_set_pte_ext
506 .word 0
507 .word 0
508 .word 0
506 .size arm925_processor_functions, . - arm925_processor_functions 509 .size arm925_processor_functions, . - arm925_processor_functions
507 510
508 .section ".rodata" 511 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 42eb4315740b..6a4bdb2c94a7 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -401,6 +401,40 @@ ENTRY(cpu_arm926_set_pte_ext)
401#endif 401#endif
402 mov pc, lr 402 mov pc, lr
403 403
404/* Suspend/resume support: taken from arch/arm/plat-s3c24xx/sleep.S */
405.globl cpu_arm926_suspend_size
406.equ cpu_arm926_suspend_size, 4 * 3
407#ifdef CONFIG_PM
408ENTRY(cpu_arm926_do_suspend)
409 stmfd sp!, {r4 - r7, lr}
410 mrc p15, 0, r4, c13, c0, 0 @ PID
411 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
412 mrc p15, 0, r6, c2, c0, 0 @ TTB address
413 mrc p15, 0, r7, c1, c0, 0 @ Control register
414 stmia r0, {r4 - r7}
415 ldmfd sp!, {r4 - r7, pc}
416ENDPROC(cpu_arm926_do_suspend)
417
418ENTRY(cpu_arm926_do_resume)
419 mov ip, #0
420 mcr p15, 0, ip, c8, c7, 0 @ invalidate I+D TLBs
421 mcr p15, 0, ip, c7, c7, 0 @ invalidate I+D caches
422 ldmia r0, {r4 - r7}
423 mcr p15, 0, r4, c13, c0, 0 @ PID
424 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
425 mcr p15, 0, r6, c2, c0, 0 @ TTB address
426 mov r0, r7 @ control register
427 mov r2, r6, lsr #14 @ get TTB0 base
428 mov r2, r2, lsl #14
429 ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \
430 PMD_SECT_CACHEABLE | PMD_BIT4 | PMD_SECT_AP_WRITE
431 b cpu_resume_mmu
432ENDPROC(cpu_arm926_do_resume)
433#else
434#define cpu_arm926_do_suspend 0
435#define cpu_arm926_do_resume 0
436#endif
437
404 __CPUINIT 438 __CPUINIT
405 439
406 .type __arm926_setup, #function 440 .type __arm926_setup, #function
@@ -456,6 +490,9 @@ arm926_processor_functions:
456 .word cpu_arm926_dcache_clean_area 490 .word cpu_arm926_dcache_clean_area
457 .word cpu_arm926_switch_mm 491 .word cpu_arm926_switch_mm
458 .word cpu_arm926_set_pte_ext 492 .word cpu_arm926_set_pte_ext
493 .word cpu_arm926_suspend_size
494 .word cpu_arm926_do_suspend
495 .word cpu_arm926_do_resume
459 .size arm926_processor_functions, . - arm926_processor_functions 496 .size arm926_processor_functions, . - arm926_processor_functions
460 497
461 .section ".rodata" 498 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 7b11cdb9935f..26aea3f71c26 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -363,6 +363,9 @@ ENTRY(arm940_processor_functions)
363 .word cpu_arm940_dcache_clean_area 363 .word cpu_arm940_dcache_clean_area
364 .word cpu_arm940_switch_mm 364 .word cpu_arm940_switch_mm
365 .word 0 @ cpu_*_set_pte 365 .word 0 @ cpu_*_set_pte
366 .word 0
367 .word 0
368 .word 0
366 .size arm940_processor_functions, . - arm940_processor_functions 369 .size arm940_processor_functions, . - arm940_processor_functions
367 370
368 .section ".rodata" 371 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index 1a5bbf080342..8063345406fe 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -419,6 +419,9 @@ ENTRY(arm946_processor_functions)
419 .word cpu_arm946_dcache_clean_area 419 .word cpu_arm946_dcache_clean_area
420 .word cpu_arm946_switch_mm 420 .word cpu_arm946_switch_mm
421 .word 0 @ cpu_*_set_pte 421 .word 0 @ cpu_*_set_pte
422 .word 0
423 .word 0
424 .word 0
422 .size arm946_processor_functions, . - arm946_processor_functions 425 .size arm946_processor_functions, . - arm946_processor_functions
423 426
424 .section ".rodata" 427 .section ".rodata"
diff --git a/arch/arm/mm/proc-arm9tdmi.S b/arch/arm/mm/proc-arm9tdmi.S
index db67e3134d7a..7b7ebd4d096d 100644
--- a/arch/arm/mm/proc-arm9tdmi.S
+++ b/arch/arm/mm/proc-arm9tdmi.S
@@ -70,6 +70,9 @@ ENTRY(arm9tdmi_processor_functions)
70 .word cpu_arm9tdmi_dcache_clean_area 70 .word cpu_arm9tdmi_dcache_clean_area
71 .word cpu_arm9tdmi_switch_mm 71 .word cpu_arm9tdmi_switch_mm
72 .word 0 @ cpu_*_set_pte 72 .word 0 @ cpu_*_set_pte
73 .word 0
74 .word 0
75 .word 0
73 .size arm9tdmi_processor_functions, . - arm9tdmi_processor_functions 76 .size arm9tdmi_processor_functions, . - arm9tdmi_processor_functions
74 77
75 .section ".rodata" 78 .section ".rodata"
diff --git a/arch/arm/mm/proc-fa526.S b/arch/arm/mm/proc-fa526.S
index 7c9ad621f0e6..fc2a4ae15cf4 100644
--- a/arch/arm/mm/proc-fa526.S
+++ b/arch/arm/mm/proc-fa526.S
@@ -195,6 +195,9 @@ fa526_processor_functions:
195 .word cpu_fa526_dcache_clean_area 195 .word cpu_fa526_dcache_clean_area
196 .word cpu_fa526_switch_mm 196 .word cpu_fa526_switch_mm
197 .word cpu_fa526_set_pte_ext 197 .word cpu_fa526_set_pte_ext
198 .word 0
199 .word 0
200 .word 0
198 .size fa526_processor_functions, . - fa526_processor_functions 201 .size fa526_processor_functions, . - fa526_processor_functions
199 202
200 .section ".rodata" 203 .section ".rodata"
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index b4597edbff97..d3883eed7a4a 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -554,6 +554,9 @@ feroceon_processor_functions:
554 .word cpu_feroceon_dcache_clean_area 554 .word cpu_feroceon_dcache_clean_area
555 .word cpu_feroceon_switch_mm 555 .word cpu_feroceon_switch_mm
556 .word cpu_feroceon_set_pte_ext 556 .word cpu_feroceon_set_pte_ext
557 .word 0
558 .word 0
559 .word 0
557 .size feroceon_processor_functions, . - feroceon_processor_functions 560 .size feroceon_processor_functions, . - feroceon_processor_functions
558 561
559 .section ".rodata" 562 .section ".rodata"
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S
index 4458ee6aa713..9d4f2ae63370 100644
--- a/arch/arm/mm/proc-mohawk.S
+++ b/arch/arm/mm/proc-mohawk.S
@@ -388,6 +388,9 @@ mohawk_processor_functions:
388 .word cpu_mohawk_dcache_clean_area 388 .word cpu_mohawk_dcache_clean_area
389 .word cpu_mohawk_switch_mm 389 .word cpu_mohawk_switch_mm
390 .word cpu_mohawk_set_pte_ext 390 .word cpu_mohawk_set_pte_ext
391 .word 0
392 .word 0
393 .word 0
391 .size mohawk_processor_functions, . - mohawk_processor_functions 394 .size mohawk_processor_functions, . - mohawk_processor_functions
392 395
393 .section ".rodata" 396 .section ".rodata"
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index 5aa8d59c2e85..46f09ed16b98 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -203,6 +203,9 @@ ENTRY(sa110_processor_functions)
203 .word cpu_sa110_dcache_clean_area 203 .word cpu_sa110_dcache_clean_area
204 .word cpu_sa110_switch_mm 204 .word cpu_sa110_switch_mm
205 .word cpu_sa110_set_pte_ext 205 .word cpu_sa110_set_pte_ext
206 .word 0
207 .word 0
208 .word 0
206 .size sa110_processor_functions, . - sa110_processor_functions 209 .size sa110_processor_functions, . - sa110_processor_functions
207 210
208 .section ".rodata" 211 .section ".rodata"
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 2ac4e6f10713..74483d1977fe 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -169,6 +169,42 @@ ENTRY(cpu_sa1100_set_pte_ext)
169#endif 169#endif
170 mov pc, lr 170 mov pc, lr
171 171
172.globl cpu_sa1100_suspend_size
173.equ cpu_sa1100_suspend_size, 4*4
174#ifdef CONFIG_PM
175ENTRY(cpu_sa1100_do_suspend)
176 stmfd sp!, {r4 - r7, lr}
177 mrc p15, 0, r4, c3, c0, 0 @ domain ID
178 mrc p15, 0, r5, c2, c0, 0 @ translation table base addr
179 mrc p15, 0, r6, c13, c0, 0 @ PID
180 mrc p15, 0, r7, c1, c0, 0 @ control reg
181 stmia r0, {r4 - r7} @ store cp regs
182 ldmfd sp!, {r4 - r7, pc}
183ENDPROC(cpu_sa1100_do_suspend)
184
185ENTRY(cpu_sa1100_do_resume)
186 ldmia r0, {r4 - r7} @ load cp regs
187 mov r1, #0
188 mcr p15, 0, r1, c8, c7, 0 @ flush I+D TLBs
189 mcr p15, 0, r1, c7, c7, 0 @ flush I&D cache
190 mcr p15, 0, r1, c9, c0, 0 @ invalidate RB
191 mcr p15, 0, r1, c9, c0, 5 @ allow user space to use RB
192
193 mcr p15, 0, r4, c3, c0, 0 @ domain ID
194 mcr p15, 0, r5, c2, c0, 0 @ translation table base addr
195 mcr p15, 0, r6, c13, c0, 0 @ PID
196 mov r0, r7 @ control register
197 mov r2, r5, lsr #14 @ get TTB0 base
198 mov r2, r2, lsl #14
199 ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \
200 PMD_SECT_CACHEABLE | PMD_SECT_AP_WRITE
201 b cpu_resume_mmu
202ENDPROC(cpu_sa1100_do_resume)
203#else
204#define cpu_sa1100_do_suspend 0
205#define cpu_sa1100_do_resume 0
206#endif
207
172 __CPUINIT 208 __CPUINIT
173 209
174 .type __sa1100_setup, #function 210 .type __sa1100_setup, #function
@@ -218,6 +254,9 @@ ENTRY(sa1100_processor_functions)
218 .word cpu_sa1100_dcache_clean_area 254 .word cpu_sa1100_dcache_clean_area
219 .word cpu_sa1100_switch_mm 255 .word cpu_sa1100_switch_mm
220 .word cpu_sa1100_set_pte_ext 256 .word cpu_sa1100_set_pte_ext
257 .word cpu_sa1100_suspend_size
258 .word cpu_sa1100_do_suspend
259 .word cpu_sa1100_do_resume
221 .size sa1100_processor_functions, . - sa1100_processor_functions 260 .size sa1100_processor_functions, . - sa1100_processor_functions
222 261
223 .section ".rodata" 262 .section ".rodata"
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 59a7e1ffe7bc..832b6bdc192c 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -121,6 +121,53 @@ ENTRY(cpu_v6_set_pte_ext)
121#endif 121#endif
122 mov pc, lr 122 mov pc, lr
123 123
124/* Suspend/resume support: taken from arch/arm/mach-s3c64xx/sleep.S */
125.globl cpu_v6_suspend_size
126.equ cpu_v6_suspend_size, 4 * 8
127#ifdef CONFIG_PM
128ENTRY(cpu_v6_do_suspend)
129 stmfd sp!, {r4 - r11, lr}
130 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
131 mrc p15, 0, r5, c13, c0, 1 @ Context ID
132 mrc p15, 0, r6, c3, c0, 0 @ Domain ID
133 mrc p15, 0, r7, c2, c0, 0 @ Translation table base 0
134 mrc p15, 0, r8, c2, c0, 1 @ Translation table base 1
135 mrc p15, 0, r9, c1, c0, 1 @ auxillary control register
136 mrc p15, 0, r10, c1, c0, 2 @ co-processor access control
137 mrc p15, 0, r11, c1, c0, 0 @ control register
138 stmia r0, {r4 - r11}
139 ldmfd sp!, {r4- r11, pc}
140ENDPROC(cpu_v6_do_suspend)
141
142ENTRY(cpu_v6_do_resume)
143 mov ip, #0
144 mcr p15, 0, ip, c7, c14, 0 @ clean+invalidate D cache
145 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
146 mcr p15, 0, ip, c7, c15, 0 @ clean+invalidate cache
147 mcr p15, 0, ip, c7, c10, 4 @ drain write buffer
148 ldmia r0, {r4 - r11}
149 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
150 mcr p15, 0, r5, c13, c0, 1 @ Context ID
151 mcr p15, 0, r6, c3, c0, 0 @ Domain ID
152 mcr p15, 0, r7, c2, c0, 0 @ Translation table base 0
153 mcr p15, 0, r8, c2, c0, 1 @ Translation table base 1
154 mcr p15, 0, r9, c1, c0, 1 @ auxillary control register
155 mcr p15, 0, r10, c1, c0, 2 @ co-processor access control
156 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
157 mcr p15, 0, ip, c7, c5, 4 @ ISB
158 mov r0, r11 @ control register
159 mov r2, r7, lsr #14 @ get TTB0 base
160 mov r2, r2, lsl #14
161 ldr r3, cpu_resume_l1_flags
162 b cpu_resume_mmu
163ENDPROC(cpu_v6_do_resume)
164cpu_resume_l1_flags:
165 ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_SMP)
166 ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_UP)
167#else
168#define cpu_v6_do_suspend 0
169#define cpu_v6_do_resume 0
170#endif
124 171
125 172
126 .type cpu_v6_name, #object 173 .type cpu_v6_name, #object
@@ -206,6 +253,9 @@ ENTRY(v6_processor_functions)
206 .word cpu_v6_dcache_clean_area 253 .word cpu_v6_dcache_clean_area
207 .word cpu_v6_switch_mm 254 .word cpu_v6_switch_mm
208 .word cpu_v6_set_pte_ext 255 .word cpu_v6_set_pte_ext
256 .word cpu_v6_suspend_size
257 .word cpu_v6_do_suspend
258 .word cpu_v6_do_resume
209 .size v6_processor_functions, . - v6_processor_functions 259 .size v6_processor_functions, . - v6_processor_functions
210 260
211 .section ".rodata" 261 .section ".rodata"
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 0c1172b56b4e..262fa88a7439 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -108,10 +108,16 @@ ENTRY(cpu_v7_switch_mm)
108#ifdef CONFIG_ARM_ERRATA_430973 108#ifdef CONFIG_ARM_ERRATA_430973
109 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB 109 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
110#endif 110#endif
111#ifdef CONFIG_ARM_ERRATA_754322
112 dsb
113#endif
111 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID 114 mcr p15, 0, r2, c13, c0, 1 @ set reserved context ID
112 isb 115 isb
1131: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0 1161: mcr p15, 0, r0, c2, c0, 0 @ set TTB 0
114 isb 117 isb
118#ifdef CONFIG_ARM_ERRATA_754322
119 dsb
120#endif
115 mcr p15, 0, r1, c13, c0, 1 @ set context ID 121 mcr p15, 0, r1, c13, c0, 1 @ set context ID
116 isb 122 isb
117#endif 123#endif
@@ -171,6 +177,87 @@ cpu_v7_name:
171 .ascii "ARMv7 Processor" 177 .ascii "ARMv7 Processor"
172 .align 178 .align
173 179
180 /*
181 * Memory region attributes with SCTLR.TRE=1
182 *
183 * n = TEX[0],C,B
184 * TR = PRRR[2n+1:2n] - memory type
185 * IR = NMRR[2n+1:2n] - inner cacheable property
186 * OR = NMRR[2n+17:2n+16] - outer cacheable property
187 *
188 * n TR IR OR
189 * UNCACHED 000 00
190 * BUFFERABLE 001 10 00 00
191 * WRITETHROUGH 010 10 10 10
192 * WRITEBACK 011 10 11 11
193 * reserved 110
194 * WRITEALLOC 111 10 01 01
195 * DEV_SHARED 100 01
196 * DEV_NONSHARED 100 01
197 * DEV_WC 001 10
198 * DEV_CACHED 011 10
199 *
200 * Other attributes:
201 *
202 * DS0 = PRRR[16] = 0 - device shareable property
203 * DS1 = PRRR[17] = 1 - device shareable property
204 * NS0 = PRRR[18] = 0 - normal shareable property
205 * NS1 = PRRR[19] = 1 - normal shareable property
206 * NOS = PRRR[24+n] = 1 - not outer shareable
207 */
208.equ PRRR, 0xff0a81a8
209.equ NMRR, 0x40e040e0
210
211/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
212.globl cpu_v7_suspend_size
213.equ cpu_v7_suspend_size, 4 * 8
214#ifdef CONFIG_PM
215ENTRY(cpu_v7_do_suspend)
216 stmfd sp!, {r4 - r11, lr}
217 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
218 mrc p15, 0, r5, c13, c0, 1 @ Context ID
219 mrc p15, 0, r6, c3, c0, 0 @ Domain ID
220 mrc p15, 0, r7, c2, c0, 0 @ TTB 0
221 mrc p15, 0, r8, c2, c0, 1 @ TTB 1
222 mrc p15, 0, r9, c1, c0, 0 @ Control register
223 mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register
224 mrc p15, 0, r11, c1, c0, 2 @ Co-processor access control
225 stmia r0, {r4 - r11}
226 ldmfd sp!, {r4 - r11, pc}
227ENDPROC(cpu_v7_do_suspend)
228
229ENTRY(cpu_v7_do_resume)
230 mov ip, #0
231 mcr p15, 0, ip, c8, c7, 0 @ invalidate TLBs
232 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
233 ldmia r0, {r4 - r11}
234 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
235 mcr p15, 0, r5, c13, c0, 1 @ Context ID
236 mcr p15, 0, r6, c3, c0, 0 @ Domain ID
237 mcr p15, 0, r7, c2, c0, 0 @ TTB 0
238 mcr p15, 0, r8, c2, c0, 1 @ TTB 1
239 mcr p15, 0, ip, c2, c0, 2 @ TTB control register
240 mcr p15, 0, r10, c1, c0, 1 @ Auxillary control register
241 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access control
242 ldr r4, =PRRR @ PRRR
243 ldr r5, =NMRR @ NMRR
244 mcr p15, 0, r4, c10, c2, 0 @ write PRRR
245 mcr p15, 0, r5, c10, c2, 1 @ write NMRR
246 isb
247 mov r0, r9 @ control register
248 mov r2, r7, lsr #14 @ get TTB0 base
249 mov r2, r2, lsl #14
250 ldr r3, cpu_resume_l1_flags
251 b cpu_resume_mmu
252ENDPROC(cpu_v7_do_resume)
253cpu_resume_l1_flags:
254 ALT_SMP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_SMP)
255 ALT_UP(.long PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_FLAGS_UP)
256#else
257#define cpu_v7_do_suspend 0
258#define cpu_v7_do_resume 0
259#endif
260
174 __CPUINIT 261 __CPUINIT
175 262
176/* 263/*
@@ -264,6 +351,12 @@ __v7_setup:
264 orreq r10, r10, #1 << 6 @ set bit #6 351 orreq r10, r10, #1 << 6 @ set bit #6
265 mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register 352 mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register
266#endif 353#endif
354#ifdef CONFIG_ARM_ERRATA_751472
355 cmp r6, #0x30 @ present prior to r3p0
356 mrclt p15, 0, r10, c15, c0, 1 @ read diagnostic register
357 orrlt r10, r10, #1 << 11 @ set bit #11
358 mcrlt p15, 0, r10, c15, c0, 1 @ write diagnostic register
359#endif
267 360
2683: mov r10, #0 3613: mov r10, #0
269#ifdef HARVARD_CACHE 362#ifdef HARVARD_CACHE
@@ -276,36 +369,8 @@ __v7_setup:
276 ALT_SMP(orr r4, r4, #TTB_FLAGS_SMP) 369 ALT_SMP(orr r4, r4, #TTB_FLAGS_SMP)
277 ALT_UP(orr r4, r4, #TTB_FLAGS_UP) 370 ALT_UP(orr r4, r4, #TTB_FLAGS_UP)
278 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 371 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
279 /* 372 ldr r5, =PRRR @ PRRR
280 * Memory region attributes with SCTLR.TRE=1 373 ldr r6, =NMRR @ NMRR
281 *
282 * n = TEX[0],C,B
283 * TR = PRRR[2n+1:2n] - memory type
284 * IR = NMRR[2n+1:2n] - inner cacheable property
285 * OR = NMRR[2n+17:2n+16] - outer cacheable property
286 *
287 * n TR IR OR
288 * UNCACHED 000 00
289 * BUFFERABLE 001 10 00 00
290 * WRITETHROUGH 010 10 10 10
291 * WRITEBACK 011 10 11 11
292 * reserved 110
293 * WRITEALLOC 111 10 01 01
294 * DEV_SHARED 100 01
295 * DEV_NONSHARED 100 01
296 * DEV_WC 001 10
297 * DEV_CACHED 011 10
298 *
299 * Other attributes:
300 *
301 * DS0 = PRRR[16] = 0 - device shareable property
302 * DS1 = PRRR[17] = 1 - device shareable property
303 * NS0 = PRRR[18] = 0 - normal shareable property
304 * NS1 = PRRR[19] = 1 - normal shareable property
305 * NOS = PRRR[24+n] = 1 - not outer shareable
306 */
307 ldr r5, =0xff0a81a8 @ PRRR
308 ldr r6, =0x40e040e0 @ NMRR
309 mcr p15, 0, r5, c10, c2, 0 @ write PRRR 374 mcr p15, 0, r5, c10, c2, 0 @ write PRRR
310 mcr p15, 0, r6, c10, c2, 1 @ write NMRR 375 mcr p15, 0, r6, c10, c2, 1 @ write NMRR
311#endif 376#endif
@@ -351,6 +416,9 @@ ENTRY(v7_processor_functions)
351 .word cpu_v7_dcache_clean_area 416 .word cpu_v7_dcache_clean_area
352 .word cpu_v7_switch_mm 417 .word cpu_v7_switch_mm
353 .word cpu_v7_set_pte_ext 418 .word cpu_v7_set_pte_ext
419 .word 0
420 .word 0
421 .word 0
354 .size v7_processor_functions, . - v7_processor_functions 422 .size v7_processor_functions, . - v7_processor_functions
355 423
356 .section ".rodata" 424 .section ".rodata"
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index ec26355cb7c2..63d8b2044e84 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -413,9 +413,52 @@ ENTRY(cpu_xsc3_set_pte_ext)
413 mov pc, lr 413 mov pc, lr
414 414
415 .ltorg 415 .ltorg
416
417 .align 416 .align
418 417
418.globl cpu_xsc3_suspend_size
419.equ cpu_xsc3_suspend_size, 4 * 8
420#ifdef CONFIG_PM
421ENTRY(cpu_xsc3_do_suspend)
422 stmfd sp!, {r4 - r10, lr}
423 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
424 mrc p15, 0, r5, c15, c1, 0 @ CP access reg
425 mrc p15, 0, r6, c13, c0, 0 @ PID
426 mrc p15, 0, r7, c3, c0, 0 @ domain ID
427 mrc p15, 0, r8, c2, c0, 0 @ translation table base addr
428 mrc p15, 0, r9, c1, c0, 1 @ auxiliary control reg
429 mrc p15, 0, r10, c1, c0, 0 @ control reg
430 bic r4, r4, #2 @ clear frequency change bit
431 stmia r0, {r1, r4 - r10} @ store v:p offset + cp regs
432 ldmia sp!, {r4 - r10, pc}
433ENDPROC(cpu_xsc3_do_suspend)
434
435ENTRY(cpu_xsc3_do_resume)
436 ldmia r0, {r1, r4 - r10} @ load v:p offset + cp regs
437 mov ip, #0
438 mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
439 mcr p15, 0, ip, c7, c10, 4 @ drain write (&fill) buffer
440 mcr p15, 0, ip, c7, c5, 4 @ flush prefetch buffer
441 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
442 mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
443 mcr p15, 0, r5, c15, c1, 0 @ CP access reg
444 mcr p15, 0, r6, c13, c0, 0 @ PID
445 mcr p15, 0, r7, c3, c0, 0 @ domain ID
446 mcr p15, 0, r8, c2, c0, 0 @ translation table base addr
447 mcr p15, 0, r9, c1, c0, 1 @ auxiliary control reg
448
449 @ temporarily map resume_turn_on_mmu into the page table,
450 @ otherwise prefetch abort occurs after MMU is turned on
451 mov r0, r10 @ control register
452 mov r2, r8, lsr #14 @ get TTB0 base
453 mov r2, r2, lsl #14
454 ldr r3, =0x542e @ section flags
455 b cpu_resume_mmu
456ENDPROC(cpu_xsc3_do_resume)
457#else
458#define cpu_xsc3_do_suspend 0
459#define cpu_xsc3_do_resume 0
460#endif
461
419 __CPUINIT 462 __CPUINIT
420 463
421 .type __xsc3_setup, #function 464 .type __xsc3_setup, #function
@@ -476,6 +519,9 @@ ENTRY(xsc3_processor_functions)
476 .word cpu_xsc3_dcache_clean_area 519 .word cpu_xsc3_dcache_clean_area
477 .word cpu_xsc3_switch_mm 520 .word cpu_xsc3_switch_mm
478 .word cpu_xsc3_set_pte_ext 521 .word cpu_xsc3_set_pte_ext
522 .word cpu_xsc3_suspend_size
523 .word cpu_xsc3_do_suspend
524 .word cpu_xsc3_do_resume
479 .size xsc3_processor_functions, . - xsc3_processor_functions 525 .size xsc3_processor_functions, . - xsc3_processor_functions
480 526
481 .section ".rodata" 527 .section ".rodata"
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index 5a37c5e45c41..086038cd86ab 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -513,11 +513,49 @@ ENTRY(cpu_xscale_set_pte_ext)
513 xscale_set_pte_ext_epilogue 513 xscale_set_pte_ext_epilogue
514 mov pc, lr 514 mov pc, lr
515 515
516
517 .ltorg 516 .ltorg
518
519 .align 517 .align
520 518
519.globl cpu_xscale_suspend_size
520.equ cpu_xscale_suspend_size, 4 * 7
521#ifdef CONFIG_PM
522ENTRY(cpu_xscale_do_suspend)
523 stmfd sp!, {r4 - r10, lr}
524 mrc p14, 0, r4, c6, c0, 0 @ clock configuration, for turbo mode
525 mrc p15, 0, r5, c15, c1, 0 @ CP access reg
526 mrc p15, 0, r6, c13, c0, 0 @ PID
527 mrc p15, 0, r7, c3, c0, 0 @ domain ID
528 mrc p15, 0, r8, c2, c0, 0 @ translation table base addr
529 mrc p15, 0, r9, c1, c1, 0 @ auxiliary control reg
530 mrc p15, 0, r10, c1, c0, 0 @ control reg
531 bic r4, r4, #2 @ clear frequency change bit
532 stmia r0, {r4 - r10} @ store cp regs
533 ldmfd sp!, {r4 - r10, pc}
534ENDPROC(cpu_xscale_do_suspend)
535
536ENTRY(cpu_xscale_do_resume)
537 ldmia r0, {r4 - r10} @ load cp regs
538 mov ip, #0
539 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
540 mcr p15, 0, ip, c7, c7, 0 @ invalidate I & D caches, BTB
541 mcr p14, 0, r4, c6, c0, 0 @ clock configuration, turbo mode.
542 mcr p15, 0, r5, c15, c1, 0 @ CP access reg
543 mcr p15, 0, r6, c13, c0, 0 @ PID
544 mcr p15, 0, r7, c3, c0, 0 @ domain ID
545 mcr p15, 0, r8, c2, c0, 0 @ translation table base addr
546 mcr p15, 0, r9, c1, c1, 0 @ auxiliary control reg
547 mov r0, r10 @ control register
548 mov r2, r8, lsr #14 @ get TTB0 base
549 mov r2, r2, lsl #14
550 ldr r3, =PMD_TYPE_SECT | PMD_SECT_BUFFERABLE | \
551 PMD_SECT_CACHEABLE | PMD_SECT_AP_WRITE
552 b cpu_resume_mmu
553ENDPROC(cpu_xscale_do_resume)
554#else
555#define cpu_xscale_do_suspend 0
556#define cpu_xscale_do_resume 0
557#endif
558
521 __CPUINIT 559 __CPUINIT
522 560
523 .type __xscale_setup, #function 561 .type __xscale_setup, #function
@@ -565,6 +603,9 @@ ENTRY(xscale_processor_functions)
565 .word cpu_xscale_dcache_clean_area 603 .word cpu_xscale_dcache_clean_area
566 .word cpu_xscale_switch_mm 604 .word cpu_xscale_switch_mm
567 .word cpu_xscale_set_pte_ext 605 .word cpu_xscale_set_pte_ext
606 .word cpu_xscale_suspend_size
607 .word cpu_xscale_do_suspend
608 .word cpu_xscale_do_resume
568 .size xscale_processor_functions, . - xscale_processor_functions 609 .size xscale_processor_functions, . - xscale_processor_functions
569 610
570 .section ".rodata" 611 .section ".rodata"
diff --git a/arch/arm/mm/vmregion.c b/arch/arm/mm/vmregion.c
index 935993e1b1ef..036fdbfdd62f 100644
--- a/arch/arm/mm/vmregion.c
+++ b/arch/arm/mm/vmregion.c
@@ -38,7 +38,7 @@ struct arm_vmregion *
38arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align, 38arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align,
39 size_t size, gfp_t gfp) 39 size_t size, gfp_t gfp)
40{ 40{
41 unsigned long addr = head->vm_start, end = head->vm_end - size; 41 unsigned long start = head->vm_start, addr = head->vm_end;
42 unsigned long flags; 42 unsigned long flags;
43 struct arm_vmregion *c, *new; 43 struct arm_vmregion *c, *new;
44 44
@@ -54,21 +54,20 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align,
54 54
55 spin_lock_irqsave(&head->vm_lock, flags); 55 spin_lock_irqsave(&head->vm_lock, flags);
56 56
57 list_for_each_entry(c, &head->vm_list, vm_list) { 57 addr = rounddown(addr - size, align);
58 if ((addr + size) < addr) 58 list_for_each_entry_reverse(c, &head->vm_list, vm_list) {
59 goto nospc; 59 if (addr >= c->vm_end)
60 if ((addr + size) <= c->vm_start)
61 goto found; 60 goto found;
62 addr = ALIGN(c->vm_end, align); 61 addr = rounddown(c->vm_start - size, align);
63 if (addr > end) 62 if (addr < start)
64 goto nospc; 63 goto nospc;
65 } 64 }
66 65
67 found: 66 found:
68 /* 67 /*
69 * Insert this entry _before_ the one we found. 68 * Insert this entry after the one we found.
70 */ 69 */
71 list_add_tail(&new->vm_list, &c->vm_list); 70 list_add(&new->vm_list, &c->vm_list);
72 new->vm_start = addr; 71 new->vm_start = addr;
73 new->vm_end = addr + size; 72 new->vm_end = addr + size;
74 new->vm_active = 1; 73 new->vm_active = 1;
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index 8aa974491dfc..c074e66ad224 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -10,8 +10,6 @@
10 */ 10 */
11 11
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <linux/err.h>
14#include <linux/errno.h>
15#include <linux/init.h> 13#include <linux/init.h>
16#include <linux/mutex.h> 14#include <linux/mutex.h>
17#include <linux/oprofile.h> 15#include <linux/oprofile.h>
@@ -46,6 +44,7 @@ char *op_name_from_perf_id(void)
46 return NULL; 44 return NULL;
47 } 45 }
48} 46}
47#endif
49 48
50static int report_trace(struct stackframe *frame, void *d) 49static int report_trace(struct stackframe *frame, void *d)
51{ 50{
@@ -85,7 +84,7 @@ static struct frame_tail* user_backtrace(struct frame_tail *tail)
85 84
86 /* frame pointers should strictly progress back up the stack 85 /* frame pointers should strictly progress back up the stack
87 * (towards higher addresses) */ 86 * (towards higher addresses) */
88 if (tail >= buftail[0].fp) 87 if (tail + 1 >= buftail[0].fp)
89 return NULL; 88 return NULL;
90 89
91 return buftail[0].fp-1; 90 return buftail[0].fp-1;
@@ -111,6 +110,7 @@ static void arm_backtrace(struct pt_regs * const regs, unsigned int depth)
111 110
112int __init oprofile_arch_init(struct oprofile_operations *ops) 111int __init oprofile_arch_init(struct oprofile_operations *ops)
113{ 112{
113 /* provide backtrace support also in timer mode: */
114 ops->backtrace = arm_backtrace; 114 ops->backtrace = arm_backtrace;
115 115
116 return oprofile_perf_init(ops); 116 return oprofile_perf_init(ops);
@@ -120,11 +120,3 @@ void __exit oprofile_arch_exit(void)
120{ 120{
121 oprofile_perf_exit(); 121 oprofile_perf_exit();
122} 122}
123#else
124int __init oprofile_arch_init(struct oprofile_operations *ops)
125{
126 pr_info("oprofile: hardware counters not available\n");
127 return -ENODEV;
128}
129void __exit oprofile_arch_exit(void) {}
130#endif /* CONFIG_HW_PERF_EVENTS */
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index 3a70ebf0477f..ff469c4f1d76 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -95,6 +95,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
95 case MACH_TYPE_MX35_3DS: 95 case MACH_TYPE_MX35_3DS:
96 case MACH_TYPE_PCM043: 96 case MACH_TYPE_PCM043:
97 case MACH_TYPE_LILLY1131: 97 case MACH_TYPE_LILLY1131:
98 case MACH_TYPE_VPR200:
98 uart_base = MX3X_UART1_BASE_ADDR; 99 uart_base = MX3X_UART1_BASE_ADDR;
99 break; 100 break;
100 case MACH_TYPE_MAGX_ZN5: 101 case MACH_TYPE_MAGX_ZN5:
@@ -102,6 +103,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
102 break; 103 break;
103 case MACH_TYPE_MX51_BABBAGE: 104 case MACH_TYPE_MX51_BABBAGE:
104 case MACH_TYPE_EUKREA_CPUIMX51SD: 105 case MACH_TYPE_EUKREA_CPUIMX51SD:
106 case MACH_TYPE_MX51_3DS:
105 uart_base = MX51_UART1_BASE_ADDR; 107 uart_base = MX51_UART1_BASE_ADDR;
106 break; 108 break;
107 case MACH_TYPE_MX50_RDP: 109 case MACH_TYPE_MX50_RDP:
diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h
index 9967d5e855c7..f500fc34d065 100644
--- a/arch/arm/plat-omap/include/plat/sram.h
+++ b/arch/arm/plat-omap/include/plat/sram.h
@@ -12,7 +12,19 @@
12#define __ARCH_ARM_OMAP_SRAM_H 12#define __ARCH_ARM_OMAP_SRAM_H
13 13
14#ifndef __ASSEMBLY__ 14#ifndef __ASSEMBLY__
15extern void * omap_sram_push(void * start, unsigned long size); 15#include <asm/fncpy.h>
16
17extern void *omap_sram_push_address(unsigned long size);
18
19/* Macro to push a function to the internal SRAM, using the fncpy API */
20#define omap_sram_push(funcp, size) ({ \
21 typeof(&(funcp)) _res = NULL; \
22 void *_sram_address = omap_sram_push_address(size); \
23 if (_sram_address) \
24 _res = fncpy(_sram_address, &(funcp), size); \
25 _res; \
26})
27
16extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl); 28extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
17 29
18extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, 30extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 459b319a9fad..49d3208793e5 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
322 322
323struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) 323struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb)
324{ 324{
325 struct omap_mbox *mbox; 325 struct omap_mbox *_mbox, *mbox = NULL;
326 int ret; 326 int i, ret;
327 327
328 if (!mboxes) 328 if (!mboxes)
329 return ERR_PTR(-EINVAL); 329 return ERR_PTR(-EINVAL);
330 330
331 for (mbox = *mboxes; mbox; mbox++) 331 for (i = 0; (_mbox = mboxes[i]); i++) {
332 if (!strcmp(mbox->name, name)) 332 if (!strcmp(_mbox->name, name)) {
333 mbox = _mbox;
333 break; 334 break;
335 }
336 }
334 337
335 if (!mbox) 338 if (!mbox)
336 return ERR_PTR(-ENOENT); 339 return ERR_PTR(-ENOENT);
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index e26e50487d60..68fcc7dc56e7 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -242,7 +242,14 @@ static void __init omap_map_sram(void)
242 omap_sram_size - SRAM_BOOTLOADER_SZ); 242 omap_sram_size - SRAM_BOOTLOADER_SZ);
243} 243}
244 244
245void * omap_sram_push(void * start, unsigned long size) 245/*
246 * Memory allocator for SRAM: calculates the new ceiling address
247 * for pushing a function using the fncpy API.
248 *
249 * Note that fncpy requires the returned address to be aligned
250 * to an 8-byte boundary.
251 */
252void *omap_sram_push_address(unsigned long size)
246{ 253{
247 if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) { 254 if (size > (omap_sram_ceil - (omap_sram_base + SRAM_BOOTLOADER_SZ))) {
248 printk(KERN_ERR "Not enough space in SRAM\n"); 255 printk(KERN_ERR "Not enough space in SRAM\n");
@@ -250,10 +257,7 @@ void * omap_sram_push(void * start, unsigned long size)
250 } 257 }
251 258
252 omap_sram_ceil -= size; 259 omap_sram_ceil -= size;
253 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, sizeof(void *)); 260 omap_sram_ceil = ROUND_DOWN(omap_sram_ceil, FNCPY_ALIGN);
254 memcpy((void *)omap_sram_ceil, start, size);
255 flush_icache_range((unsigned long)omap_sram_ceil,
256 (unsigned long)(omap_sram_ceil + size));
257 261
258 return (void *)omap_sram_ceil; 262 return (void *)omap_sram_ceil;
259} 263}
diff --git a/arch/arm/plat-pxa/mfp.c b/arch/arm/plat-pxa/mfp.c
index b77e018d36c1..a9aa5ad3f4eb 100644
--- a/arch/arm/plat-pxa/mfp.c
+++ b/arch/arm/plat-pxa/mfp.c
@@ -139,10 +139,11 @@ static const unsigned long mfpr_edge[] = {
139#define mfp_configured(p) ((p)->config != -1) 139#define mfp_configured(p) ((p)->config != -1)
140 140
141/* 141/*
142 * perform a read-back of any MFPR register to make sure the 142 * perform a read-back of any valid MFPR register to make sure the
143 * previous writings are finished 143 * previous writings are finished
144 */ 144 */
145#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + 0) 145static unsigned long mfpr_off_readback;
146#define mfpr_sync() (void)__raw_readl(mfpr_mmio_base + mfpr_off_readback)
146 147
147static inline void __mfp_config_run(struct mfp_pin *p) 148static inline void __mfp_config_run(struct mfp_pin *p)
148{ 149{
@@ -248,6 +249,9 @@ void __init mfp_init_addr(struct mfp_addr_map *map)
248 249
249 spin_lock_irqsave(&mfp_spin_lock, flags); 250 spin_lock_irqsave(&mfp_spin_lock, flags);
250 251
252 /* mfp offset for readback */
253 mfpr_off_readback = map[0].offset;
254
251 for (p = map; p->start != MFP_PIN_INVALID; p++) { 255 for (p = map; p->start != MFP_PIN_INVALID; p++) {
252 offset = p->offset; 256 offset = p->offset;
253 i = p->start; 257 i = p->start;
diff --git a/arch/arm/plat-s3c24xx/sleep.S b/arch/arm/plat-s3c24xx/sleep.S
index e73e3b6e88d2..fd7032f84ae7 100644
--- a/arch/arm/plat-s3c24xx/sleep.S
+++ b/arch/arm/plat-s3c24xx/sleep.S
@@ -44,23 +44,13 @@
44 /* s3c_cpu_save 44 /* s3c_cpu_save
45 * 45 *
46 * entry: 46 * entry:
47 * r0 = save address (virtual addr of s3c_sleep_save_phys) 47 * r1 = v:p offset
48 */ 48 */
49 49
50ENTRY(s3c_cpu_save) 50ENTRY(s3c_cpu_save)
51 stmfd sp!, { r4 - r12, lr } 51 stmfd sp!, { r4 - r12, lr }
52 52 ldr r3, =resume_with_mmu
53 @@ store co-processor registers 53 bl cpu_suspend
54
55 mrc p15, 0, r4, c13, c0, 0 @ PID
56 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
57 mrc p15, 0, r6, c2, c0, 0 @ translation table base address
58 mrc p15, 0, r7, c1, c0, 0 @ control register
59
60 stmia r0, { r4 - r13 }
61
62 @@ write our state back to RAM
63 bl s3c_pm_cb_flushcache
64 54
65 @@ jump to final code to send system to sleep 55 @@ jump to final code to send system to sleep
66 ldr r0, =pm_cpu_sleep 56 ldr r0, =pm_cpu_sleep
@@ -76,20 +66,6 @@ resume_with_mmu:
76 66
77 .ltorg 67 .ltorg
78 68
79 @@ the next bits sit in the .data segment, even though they
80 @@ happen to be code... the s3c_sleep_save_phys needs to be
81 @@ accessed by the resume code before it can restore the MMU.
82 @@ This means that the variable has to be close enough for the
83 @@ code to read it... since the .text segment needs to be RO,
84 @@ the data segment can be the only place to put this code.
85
86 .data
87
88 .global s3c_sleep_save_phys
89s3c_sleep_save_phys:
90 .word 0
91
92
93 /* sleep magic, to allow the bootloader to check for an valid 69 /* sleep magic, to allow the bootloader to check for an valid
94 * image to resume to. Must be the first word before the 70 * image to resume to. Must be the first word before the
95 * s3c_cpu_resume entry. 71 * s3c_cpu_resume entry.
@@ -100,10 +76,6 @@ s3c_sleep_save_phys:
100 /* s3c_cpu_resume 76 /* s3c_cpu_resume
101 * 77 *
102 * resume code entry for bootloader to call 78 * resume code entry for bootloader to call
103 *
104 * we must put this code here in the data segment as we have no
105 * other way of restoring the stack pointer after sleep, and we
106 * must not write to the code segment (code is read-only)
107 */ 79 */
108 80
109ENTRY(s3c_cpu_resume) 81ENTRY(s3c_cpu_resume)
@@ -134,25 +106,4 @@ ENTRY(s3c_cpu_resume)
134 beq 1001b 106 beq 1001b
135#endif /* CONFIG_DEBUG_RESUME */ 107#endif /* CONFIG_DEBUG_RESUME */
136 108
137 mov r1, #0 109 b cpu_resume
138 mcr p15, 0, r1, c8, c7, 0 @@ invalidate I & D TLBs
139 mcr p15, 0, r1, c7, c7, 0 @@ invalidate I & D caches
140
141 ldr r0, s3c_sleep_save_phys @ address of restore block
142 ldmia r0, { r4 - r13 }
143
144 mcr p15, 0, r4, c13, c0, 0 @ PID
145 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
146 mcr p15, 0, r6, c2, c0, 0 @ translation table base
147
148#ifdef CONFIG_DEBUG_RESUME
149 mov r3, #'R'
150 strb r3, [ r2, #S3C2410_UTXH ]
151#endif
152
153 ldr r2, =resume_with_mmu
154 mcr p15, 0, r7, c1, c0, 0 @ turn on MMU, etc
155 nop @ second-to-last before mmu
156 mov pc, r2 @ go back to virtual address
157
158 .ltorg
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index deb39951a22e..557f8c507f6d 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -37,6 +37,14 @@ config S5P_GPIO_INT
37 help 37 help
38 Common code for the GPIO interrupts (other than external interrupts.) 38 Common code for the GPIO interrupts (other than external interrupts.)
39 39
40comment "System MMU"
41
42config S5P_SYSTEM_MMU
43 bool "S5P SYSTEM MMU"
44 depends on ARCH_S5PV310
45 help
46 Say Y here if you want to enable System MMU
47
40config S5P_DEV_FIMC0 48config S5P_DEV_FIMC0
41 bool 49 bool
42 help 50 help
@@ -66,19 +74,3 @@ config S5P_DEV_CSIS1
66 bool 74 bool
67 help 75 help
68 Compile in platform device definitions for MIPI-CSIS channel 1 76 Compile in platform device definitions for MIPI-CSIS channel 1
69
70menuconfig S5P_SYSMMU
71 bool "SYSMMU support"
72 depends on ARCH_S5PV310
73 help
74 This is a System MMU driver for Samsung ARM based Soc.
75
76if S5P_SYSMMU
77
78config S5P_SYSMMU_DEBUG
79 bool "Enables debug messages"
80 depends on S5P_SYSMMU
81 help
82 This enables SYSMMU driver debug massages.
83
84endif
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index 92efe1adcfd6..4bd5cf908977 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -19,6 +19,7 @@ obj-y += clock.o
19obj-y += irq.o 19obj-y += irq.o
20obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o 20obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o
21obj-$(CONFIG_S5P_GPIO_INT) += irq-gpioint.o 21obj-$(CONFIG_S5P_GPIO_INT) += irq-gpioint.o
22obj-$(CONFIG_S5P_SYSTEM_MMU) += sysmmu.o
22obj-$(CONFIG_PM) += pm.o 23obj-$(CONFIG_PM) += pm.o
23obj-$(CONFIG_PM) += irq-pm.o 24obj-$(CONFIG_PM) += irq-pm.o
24 25
@@ -30,4 +31,3 @@ obj-$(CONFIG_S5P_DEV_FIMC2) += dev-fimc2.o
30obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o 31obj-$(CONFIG_S5P_DEV_ONENAND) += dev-onenand.o
31obj-$(CONFIG_S5P_DEV_CSIS0) += dev-csis0.o 32obj-$(CONFIG_S5P_DEV_CSIS0) += dev-csis0.o
32obj-$(CONFIG_S5P_DEV_CSIS1) += dev-csis1.o 33obj-$(CONFIG_S5P_DEV_CSIS1) += dev-csis1.o
33obj-$(CONFIG_S5P_SYSMMU) += sysmmu.o
diff --git a/arch/arm/plat-s5p/dev-uart.c b/arch/arm/plat-s5p/dev-uart.c
index 6a7342886171..afaf87fdb93e 100644
--- a/arch/arm/plat-s5p/dev-uart.c
+++ b/arch/arm/plat-s5p/dev-uart.c
@@ -28,7 +28,7 @@
28static struct resource s5p_uart0_resource[] = { 28static struct resource s5p_uart0_resource[] = {
29 [0] = { 29 [0] = {
30 .start = S5P_PA_UART0, 30 .start = S5P_PA_UART0,
31 .end = S5P_PA_UART0 + S5P_SZ_UART, 31 .end = S5P_PA_UART0 + S5P_SZ_UART - 1,
32 .flags = IORESOURCE_MEM, 32 .flags = IORESOURCE_MEM,
33 }, 33 },
34 [1] = { 34 [1] = {
@@ -51,7 +51,7 @@ static struct resource s5p_uart0_resource[] = {
51static struct resource s5p_uart1_resource[] = { 51static struct resource s5p_uart1_resource[] = {
52 [0] = { 52 [0] = {
53 .start = S5P_PA_UART1, 53 .start = S5P_PA_UART1,
54 .end = S5P_PA_UART1 + S5P_SZ_UART, 54 .end = S5P_PA_UART1 + S5P_SZ_UART - 1,
55 .flags = IORESOURCE_MEM, 55 .flags = IORESOURCE_MEM,
56 }, 56 },
57 [1] = { 57 [1] = {
@@ -74,7 +74,7 @@ static struct resource s5p_uart1_resource[] = {
74static struct resource s5p_uart2_resource[] = { 74static struct resource s5p_uart2_resource[] = {
75 [0] = { 75 [0] = {
76 .start = S5P_PA_UART2, 76 .start = S5P_PA_UART2,
77 .end = S5P_PA_UART2 + S5P_SZ_UART, 77 .end = S5P_PA_UART2 + S5P_SZ_UART - 1,
78 .flags = IORESOURCE_MEM, 78 .flags = IORESOURCE_MEM,
79 }, 79 },
80 [1] = { 80 [1] = {
@@ -98,7 +98,7 @@ static struct resource s5p_uart3_resource[] = {
98#if CONFIG_SERIAL_SAMSUNG_UARTS > 3 98#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
99 [0] = { 99 [0] = {
100 .start = S5P_PA_UART3, 100 .start = S5P_PA_UART3,
101 .end = S5P_PA_UART3 + S5P_SZ_UART, 101 .end = S5P_PA_UART3 + S5P_SZ_UART - 1,
102 .flags = IORESOURCE_MEM, 102 .flags = IORESOURCE_MEM,
103 }, 103 },
104 [1] = { 104 [1] = {
@@ -123,7 +123,7 @@ static struct resource s5p_uart4_resource[] = {
123#if CONFIG_SERIAL_SAMSUNG_UARTS > 4 123#if CONFIG_SERIAL_SAMSUNG_UARTS > 4
124 [0] = { 124 [0] = {
125 .start = S5P_PA_UART4, 125 .start = S5P_PA_UART4,
126 .end = S5P_PA_UART4 + S5P_SZ_UART, 126 .end = S5P_PA_UART4 + S5P_SZ_UART - 1,
127 .flags = IORESOURCE_MEM, 127 .flags = IORESOURCE_MEM,
128 }, 128 },
129 [1] = { 129 [1] = {
@@ -148,7 +148,7 @@ static struct resource s5p_uart5_resource[] = {
148#if CONFIG_SERIAL_SAMSUNG_UARTS > 5 148#if CONFIG_SERIAL_SAMSUNG_UARTS > 5
149 [0] = { 149 [0] = {
150 .start = S5P_PA_UART5, 150 .start = S5P_PA_UART5,
151 .end = S5P_PA_UART5 + S5P_SZ_UART, 151 .end = S5P_PA_UART5 + S5P_SZ_UART - 1,
152 .flags = IORESOURCE_MEM, 152 .flags = IORESOURCE_MEM,
153 }, 153 },
154 [1] = { 154 [1] = {
diff --git a/arch/arm/plat-s5p/include/plat/sysmmu.h b/arch/arm/plat-s5p/include/plat/sysmmu.h
deleted file mode 100644
index db298fc5438a..000000000000
--- a/arch/arm/plat-s5p/include/plat/sysmmu.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/* linux/arch/arm/plat-s5p/include/plat/sysmmu.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Samsung sysmmu driver
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_PLAT_S5P_SYSMMU_H
14#define __ASM_PLAT_S5P_SYSMMU_H __FILE__
15
16/* debug macro */
17#ifdef CONFIG_S5P_SYSMMU_DEBUG
18#define sysmmu_debug(fmt, arg...) printk(KERN_INFO "[%s] " fmt, __func__, ## arg)
19#else
20#define sysmmu_debug(fmt, arg...) do { } while (0)
21#endif
22
23#endif /* __ASM_PLAT_S5P_SYSMMU_H */
diff --git a/arch/arm/plat-s5p/sysmmu.c b/arch/arm/plat-s5p/sysmmu.c
index d804914dc2e2..ffe8a48bc3c1 100644
--- a/arch/arm/plat-s5p/sysmmu.c
+++ b/arch/arm/plat-s5p/sysmmu.c
@@ -16,8 +16,6 @@
16#include <mach/regs-sysmmu.h> 16#include <mach/regs-sysmmu.h>
17#include <mach/sysmmu.h> 17#include <mach/sysmmu.h>
18 18
19#include <plat/sysmmu.h>
20
21struct sysmmu_controller s5p_sysmmu_cntlrs[S5P_SYSMMU_TOTAL_IPNUM]; 19struct sysmmu_controller s5p_sysmmu_cntlrs[S5P_SYSMMU_TOTAL_IPNUM];
22 20
23void s5p_sysmmu_register(struct sysmmu_controller *sysmmuconp) 21void s5p_sysmmu_register(struct sysmmu_controller *sysmmuconp)
@@ -123,7 +121,7 @@ static int s5p_sysmmu_set_tablebase(sysmmu_ips ips)
123 : "=r" (pg) : : "cc"); \ 121 : "=r" (pg) : : "cc"); \
124 pg &= ~0x3fff; 122 pg &= ~0x3fff;
125 123
126 sysmmu_debug("CP15 TTBR0 : 0x%x\n", pg); 124 printk(KERN_INFO "%s: CP15 TTBR0 : 0x%x\n", __func__, pg);
127 125
128 /* Set sysmmu page table base address */ 126 /* Set sysmmu page table base address */
129 __raw_writel(pg, sysmmuconp->regs + S5P_PT_BASE_ADDR); 127 __raw_writel(pg, sysmmuconp->regs + S5P_PT_BASE_ADDR);
diff --git a/arch/arm/plat-samsung/dev-ts.c b/arch/arm/plat-samsung/dev-ts.c
index 236ef8427d7d..3e4bd8147bf4 100644
--- a/arch/arm/plat-samsung/dev-ts.c
+++ b/arch/arm/plat-samsung/dev-ts.c
@@ -58,4 +58,3 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd)
58 58
59 s3c_device_ts.dev.platform_data = npd; 59 s3c_device_ts.dev.platform_data = npd;
60} 60}
61EXPORT_SYMBOL(s3c24xx_ts_set_platdata);
diff --git a/arch/arm/plat-samsung/dev-uart.c b/arch/arm/plat-samsung/dev-uart.c
index 3776cd952450..5928105490fa 100644
--- a/arch/arm/plat-samsung/dev-uart.c
+++ b/arch/arm/plat-samsung/dev-uart.c
@@ -15,6 +15,8 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17 17
18#include <plat/devs.h>
19
18/* uart devices */ 20/* uart devices */
19 21
20static struct platform_device s3c24xx_uart_device0 = { 22static struct platform_device s3c24xx_uart_device0 = {
diff --git a/arch/arm/plat-samsung/include/plat/pm.h b/arch/arm/plat-samsung/include/plat/pm.h
index d9025e377675..937cc2ace517 100644
--- a/arch/arm/plat-samsung/include/plat/pm.h
+++ b/arch/arm/plat-samsung/include/plat/pm.h
@@ -17,6 +17,8 @@
17 17
18#include <linux/irq.h> 18#include <linux/irq.h>
19 19
20struct sys_device;
21
20#ifdef CONFIG_PM 22#ifdef CONFIG_PM
21 23
22extern __init int s3c_pm_init(void); 24extern __init int s3c_pm_init(void);
@@ -50,13 +52,11 @@ extern unsigned char pm_uart_udivslot; /* true to save UART UDIVSLOT */
50 52
51/* from sleep.S */ 53/* from sleep.S */
52 54
53extern int s3c_cpu_save(unsigned long *saveblk); 55extern int s3c_cpu_save(unsigned long *saveblk, long);
54extern void s3c_cpu_resume(void); 56extern void s3c_cpu_resume(void);
55 57
56extern void s3c2410_cpu_suspend(void); 58extern void s3c2410_cpu_suspend(void);
57 59
58extern unsigned long s3c_sleep_save_phys;
59
60/* sleep save info */ 60/* sleep save info */
61 61
62/** 62/**
@@ -179,13 +179,5 @@ extern void s3c_pm_restore_gpios(void);
179 */ 179 */
180extern void s3c_pm_save_gpios(void); 180extern void s3c_pm_save_gpios(void);
181 181
182/**
183 * s3c_pm_cb_flushcache - callback for assembly code
184 *
185 * Callback to issue flush_cache_all() as this call is
186 * not a directly callable object.
187 */
188extern void s3c_pm_cb_flushcache(void);
189
190extern void s3c_pm_save_core(void); 182extern void s3c_pm_save_core(void);
191extern void s3c_pm_restore_core(void); 183extern void s3c_pm_restore_core(void);
diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c
index 02d531fb3f81..d5b58d31903c 100644
--- a/arch/arm/plat-samsung/pm.c
+++ b/arch/arm/plat-samsung/pm.c
@@ -241,8 +241,6 @@ void (*pm_cpu_sleep)(void);
241 241
242static int s3c_pm_enter(suspend_state_t state) 242static int s3c_pm_enter(suspend_state_t state)
243{ 243{
244 static unsigned long regs_save[16];
245
246 /* ensure the debug is initialised (if enabled) */ 244 /* ensure the debug is initialised (if enabled) */
247 245
248 s3c_pm_debug_init(); 246 s3c_pm_debug_init();
@@ -266,12 +264,6 @@ static int s3c_pm_enter(suspend_state_t state)
266 return -EINVAL; 264 return -EINVAL;
267 } 265 }
268 266
269 /* store the physical address of the register recovery block */
270
271 s3c_sleep_save_phys = virt_to_phys(regs_save);
272
273 S3C_PMDBG("s3c_sleep_save_phys=0x%08lx\n", s3c_sleep_save_phys);
274
275 /* save all necessary core registers not covered by the drivers */ 267 /* save all necessary core registers not covered by the drivers */
276 268
277 s3c_pm_save_gpios(); 269 s3c_pm_save_gpios();
@@ -305,7 +297,7 @@ static int s3c_pm_enter(suspend_state_t state)
305 * we resume as it saves its own register state and restores it 297 * we resume as it saves its own register state and restores it
306 * during the resume. */ 298 * during the resume. */
307 299
308 s3c_cpu_save(regs_save); 300 s3c_cpu_save(0, PLAT_PHYS_OFFSET - PAGE_OFFSET);
309 301
310 /* restore the cpu state using the kernel's cpu init code. */ 302 /* restore the cpu state using the kernel's cpu init code. */
311 303
@@ -336,12 +328,6 @@ static int s3c_pm_enter(suspend_state_t state)
336 return 0; 328 return 0;
337} 329}
338 330
339/* callback from assembly code */
340void s3c_pm_cb_flushcache(void)
341{
342 flush_cache_all();
343}
344
345static int s3c_pm_prepare(void) 331static int s3c_pm_prepare(void)
346{ 332{
347 /* prepare check area if configured */ 333 /* prepare check area if configured */
diff --git a/arch/arm/plat-spear/Makefile b/arch/arm/plat-spear/Makefile
index eb89540aeda9..b4f340b8f1f1 100644
--- a/arch/arm/plat-spear/Makefile
+++ b/arch/arm/plat-spear/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o padmux.o time.o 6obj-y := clock.o time.o
7 7
8obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o 8obj-$(CONFIG_ARCH_SPEAR3XX) += shirq.o padmux.o
diff --git a/arch/arm/plat-spear/clock.c b/arch/arm/plat-spear/clock.c
index ee4f90e534d8..bdbd7ec9cb6b 100644
--- a/arch/arm/plat-spear/clock.c
+++ b/arch/arm/plat-spear/clock.c
@@ -12,18 +12,25 @@
12 */ 12 */
13 13
14#include <linux/bug.h> 14#include <linux/bug.h>
15#include <linux/clk.h>
16#include <linux/debugfs.h>
15#include <linux/err.h> 17#include <linux/err.h>
16#include <linux/io.h> 18#include <linux/io.h>
17#include <linux/list.h> 19#include <linux/list.h>
18#include <linux/module.h> 20#include <linux/module.h>
19#include <linux/spinlock.h> 21#include <linux/spinlock.h>
20#include <mach/misc_regs.h>
21#include <plat/clock.h> 22#include <plat/clock.h>
22 23
23static DEFINE_SPINLOCK(clocks_lock); 24static DEFINE_SPINLOCK(clocks_lock);
24static LIST_HEAD(root_clks); 25static LIST_HEAD(root_clks);
26#ifdef CONFIG_DEBUG_FS
27static LIST_HEAD(clocks);
28#endif
25 29
26static void propagate_rate(struct list_head *); 30static void propagate_rate(struct clk *, int on_init);
31#ifdef CONFIG_DEBUG_FS
32static int clk_debugfs_reparent(struct clk *);
33#endif
27 34
28static int generic_clk_enable(struct clk *clk) 35static int generic_clk_enable(struct clk *clk)
29{ 36{
@@ -65,6 +72,104 @@ static struct clkops generic_clkops = {
65 .disable = generic_clk_disable, 72 .disable = generic_clk_disable,
66}; 73};
67 74
75/* returns current programmed clocks clock info structure */
76static struct pclk_info *pclk_info_get(struct clk *clk)
77{
78 unsigned int val, i;
79 struct pclk_info *info = NULL;
80
81 val = (readl(clk->pclk_sel->pclk_sel_reg) >> clk->pclk_sel_shift)
82 & clk->pclk_sel->pclk_sel_mask;
83
84 for (i = 0; i < clk->pclk_sel->pclk_count; i++) {
85 if (clk->pclk_sel->pclk_info[i].pclk_val == val)
86 info = &clk->pclk_sel->pclk_info[i];
87 }
88
89 return info;
90}
91
92/*
93 * Set Update pclk, and pclk_info of clk and add clock sibling node to current
94 * parents children list
95 */
96static void clk_reparent(struct clk *clk, struct pclk_info *pclk_info)
97{
98 unsigned long flags;
99
100 spin_lock_irqsave(&clocks_lock, flags);
101 list_del(&clk->sibling);
102 list_add(&clk->sibling, &pclk_info->pclk->children);
103
104 clk->pclk = pclk_info->pclk;
105 spin_unlock_irqrestore(&clocks_lock, flags);
106
107#ifdef CONFIG_DEBUG_FS
108 clk_debugfs_reparent(clk);
109#endif
110}
111
112static void do_clk_disable(struct clk *clk)
113{
114 if (!clk)
115 return;
116
117 if (!clk->usage_count) {
118 WARN_ON(1);
119 return;
120 }
121
122 clk->usage_count--;
123
124 if (clk->usage_count == 0) {
125 /*
126 * Surely, there are no active childrens or direct users
127 * of this clock
128 */
129 if (clk->pclk)
130 do_clk_disable(clk->pclk);
131
132 if (clk->ops && clk->ops->disable)
133 clk->ops->disable(clk);
134 }
135}
136
137static int do_clk_enable(struct clk *clk)
138{
139 int ret = 0;
140
141 if (!clk)
142 return -EFAULT;
143
144 if (clk->usage_count == 0) {
145 if (clk->pclk) {
146 ret = do_clk_enable(clk->pclk);
147 if (ret)
148 goto err;
149 }
150 if (clk->ops && clk->ops->enable) {
151 ret = clk->ops->enable(clk);
152 if (ret) {
153 if (clk->pclk)
154 do_clk_disable(clk->pclk);
155 goto err;
156 }
157 }
158 /*
159 * Since the clock is going to be used for the first
160 * time please reclac
161 */
162 if (clk->recalc) {
163 ret = clk->recalc(clk);
164 if (ret)
165 goto err;
166 }
167 }
168 clk->usage_count++;
169err:
170 return ret;
171}
172
68/* 173/*
69 * clk_enable - inform the system when the clock source should be running. 174 * clk_enable - inform the system when the clock source should be running.
70 * @clk: clock source 175 * @clk: clock source
@@ -78,17 +183,9 @@ int clk_enable(struct clk *clk)
78 unsigned long flags; 183 unsigned long flags;
79 int ret = 0; 184 int ret = 0;
80 185
81 if (!clk || IS_ERR(clk))
82 return -EFAULT;
83
84 spin_lock_irqsave(&clocks_lock, flags); 186 spin_lock_irqsave(&clocks_lock, flags);
85 if (clk->usage_count == 0) { 187 ret = do_clk_enable(clk);
86 if (clk->ops && clk->ops->enable)
87 ret = clk->ops->enable(clk);
88 }
89 clk->usage_count++;
90 spin_unlock_irqrestore(&clocks_lock, flags); 188 spin_unlock_irqrestore(&clocks_lock, flags);
91
92 return ret; 189 return ret;
93} 190}
94EXPORT_SYMBOL(clk_enable); 191EXPORT_SYMBOL(clk_enable);
@@ -109,17 +206,8 @@ void clk_disable(struct clk *clk)
109{ 206{
110 unsigned long flags; 207 unsigned long flags;
111 208
112 if (!clk || IS_ERR(clk))
113 return;
114
115 WARN_ON(clk->usage_count == 0);
116
117 spin_lock_irqsave(&clocks_lock, flags); 209 spin_lock_irqsave(&clocks_lock, flags);
118 clk->usage_count--; 210 do_clk_disable(clk);
119 if (clk->usage_count == 0) {
120 if (clk->ops && clk->ops->disable)
121 clk->ops->disable(clk);
122 }
123 spin_unlock_irqrestore(&clocks_lock, flags); 211 spin_unlock_irqrestore(&clocks_lock, flags);
124} 212}
125EXPORT_SYMBOL(clk_disable); 213EXPORT_SYMBOL(clk_disable);
@@ -153,15 +241,14 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
153 int i, found = 0, val = 0; 241 int i, found = 0, val = 0;
154 unsigned long flags; 242 unsigned long flags;
155 243
156 if (!clk || IS_ERR(clk) || !parent || IS_ERR(parent)) 244 if (!clk || !parent)
157 return -EFAULT; 245 return -EFAULT;
158 if (clk->usage_count)
159 return -EBUSY;
160 if (!clk->pclk_sel)
161 return -EPERM;
162 if (clk->pclk == parent) 246 if (clk->pclk == parent)
163 return 0; 247 return 0;
248 if (!clk->pclk_sel)
249 return -EPERM;
164 250
251 /* check if requested parent is in clk parent list */
165 for (i = 0; i < clk->pclk_sel->pclk_count; i++) { 252 for (i = 0; i < clk->pclk_sel->pclk_count; i++) {
166 if (clk->pclk_sel->pclk_info[i].pclk == parent) { 253 if (clk->pclk_sel->pclk_info[i].pclk == parent) {
167 found = 1; 254 found = 1;
@@ -176,25 +263,58 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
176 /* reflect parent change in hardware */ 263 /* reflect parent change in hardware */
177 val = readl(clk->pclk_sel->pclk_sel_reg); 264 val = readl(clk->pclk_sel->pclk_sel_reg);
178 val &= ~(clk->pclk_sel->pclk_sel_mask << clk->pclk_sel_shift); 265 val &= ~(clk->pclk_sel->pclk_sel_mask << clk->pclk_sel_shift);
179 val |= clk->pclk_sel->pclk_info[i].pclk_mask << clk->pclk_sel_shift; 266 val |= clk->pclk_sel->pclk_info[i].pclk_val << clk->pclk_sel_shift;
180 writel(val, clk->pclk_sel->pclk_sel_reg); 267 writel(val, clk->pclk_sel->pclk_sel_reg);
181 spin_unlock_irqrestore(&clocks_lock, flags); 268 spin_unlock_irqrestore(&clocks_lock, flags);
182 269
183 /* reflect parent change in software */ 270 /* reflect parent change in software */
184 clk->recalc(clk); 271 clk_reparent(clk, &clk->pclk_sel->pclk_info[i]);
185 propagate_rate(&clk->children); 272
273 propagate_rate(clk, 0);
186 return 0; 274 return 0;
187} 275}
188EXPORT_SYMBOL(clk_set_parent); 276EXPORT_SYMBOL(clk_set_parent);
189 277
278/**
279 * clk_set_rate - set the clock rate for a clock source
280 * @clk: clock source
281 * @rate: desired clock rate in Hz
282 *
283 * Returns success (0) or negative errno.
284 */
285int clk_set_rate(struct clk *clk, unsigned long rate)
286{
287 unsigned long flags;
288 int ret = -EINVAL;
289
290 if (!clk || !rate)
291 return -EFAULT;
292
293 if (clk->set_rate) {
294 spin_lock_irqsave(&clocks_lock, flags);
295 ret = clk->set_rate(clk, rate);
296 if (!ret)
297 /* if successful -> propagate */
298 propagate_rate(clk, 0);
299 spin_unlock_irqrestore(&clocks_lock, flags);
300 } else if (clk->pclk) {
301 u32 mult = clk->div_factor ? clk->div_factor : 1;
302 ret = clk_set_rate(clk->pclk, mult * rate);
303 }
304
305 return ret;
306}
307EXPORT_SYMBOL(clk_set_rate);
308
190/* registers clock in platform clock framework */ 309/* registers clock in platform clock framework */
191void clk_register(struct clk_lookup *cl) 310void clk_register(struct clk_lookup *cl)
192{ 311{
193 struct clk *clk = cl->clk; 312 struct clk *clk;
194 unsigned long flags; 313 unsigned long flags;
195 314
196 if (!clk || IS_ERR(clk)) 315 if (!cl || !cl->clk)
197 return; 316 return;
317 clk = cl->clk;
198 318
199 spin_lock_irqsave(&clocks_lock, flags); 319 spin_lock_irqsave(&clocks_lock, flags);
200 320
@@ -207,71 +327,173 @@ void clk_register(struct clk_lookup *cl)
207 /* root clock don't have any parents */ 327 /* root clock don't have any parents */
208 if (!clk->pclk && !clk->pclk_sel) { 328 if (!clk->pclk && !clk->pclk_sel) {
209 list_add(&clk->sibling, &root_clks); 329 list_add(&clk->sibling, &root_clks);
210 /* add clocks with only one parent to parent's children list */
211 } else if (clk->pclk && !clk->pclk_sel) { 330 } else if (clk->pclk && !clk->pclk_sel) {
331 /* add clocks with only one parent to parent's children list */
212 list_add(&clk->sibling, &clk->pclk->children); 332 list_add(&clk->sibling, &clk->pclk->children);
213 } else { 333 } else {
214 /* add clocks with > 1 parent to 1st parent's children list */ 334 /* clocks with more than one parent */
215 list_add(&clk->sibling, 335 struct pclk_info *pclk_info;
216 &clk->pclk_sel->pclk_info[0].pclk->children); 336
337 pclk_info = pclk_info_get(clk);
338 if (!pclk_info) {
339 pr_err("CLKDEV: invalid pclk info of clk with"
340 " %s dev_id and %s con_id\n",
341 cl->dev_id, cl->con_id);
342 } else {
343 clk->pclk = pclk_info->pclk;
344 list_add(&clk->sibling, &pclk_info->pclk->children);
345 }
217 } 346 }
347
218 spin_unlock_irqrestore(&clocks_lock, flags); 348 spin_unlock_irqrestore(&clocks_lock, flags);
219 349
350 /* debugfs specific */
351#ifdef CONFIG_DEBUG_FS
352 list_add(&clk->node, &clocks);
353 clk->cl = cl;
354#endif
355
220 /* add clock to arm clockdev framework */ 356 /* add clock to arm clockdev framework */
221 clkdev_add(cl); 357 clkdev_add(cl);
222} 358}
223 359
224/** 360/**
225 * propagate_rate - recalculate and propagate all clocks in list head 361 * propagate_rate - recalculate and propagate all clocks to children
362 * @pclk: parent clock required to be propogated
363 * @on_init: flag for enabling clocks which are ENABLED_ON_INIT.
226 * 364 *
227 * Recalculates all root clocks in list head, which if the clock's .recalc is 365 * Recalculates all children clocks
228 * set correctly, should also propagate their rates.
229 */ 366 */
230static void propagate_rate(struct list_head *lhead) 367void propagate_rate(struct clk *pclk, int on_init)
231{ 368{
232 struct clk *clkp, *_temp; 369 struct clk *clk, *_temp;
370 int ret = 0;
233 371
234 list_for_each_entry_safe(clkp, _temp, lhead, sibling) { 372 list_for_each_entry_safe(clk, _temp, &pclk->children, sibling) {
235 if (clkp->recalc) 373 if (clk->recalc) {
236 clkp->recalc(clkp); 374 ret = clk->recalc(clk);
237 propagate_rate(&clkp->children); 375 /*
376 * recalc will return error if clk out is not programmed
377 * In this case configure default rate.
378 */
379 if (ret && clk->set_rate)
380 clk->set_rate(clk, 0);
381 }
382 propagate_rate(clk, on_init);
383
384 if (!on_init)
385 continue;
386
387 /* Enable clks enabled on init, in software view */
388 if (clk->flags & ENABLED_ON_INIT)
389 do_clk_enable(clk);
238 } 390 }
239} 391}
240 392
241/* returns current programmed clocks clock info structure */ 393/**
242static struct pclk_info *pclk_info_get(struct clk *clk) 394 * round_rate_index - return closest programmable rate index in rate_config tbl
395 * @clk: ptr to clock structure
396 * @drate: desired rate
397 * @rate: final rate will be returned in this variable only.
398 *
399 * Finds index in rate_config for highest clk rate which is less than
400 * requested rate. If there is no clk rate lesser than requested rate then
401 * -EINVAL is returned. This routine assumes that rate_config is written
402 * in incrementing order of clk rates.
403 * If drate passed is zero then default rate is programmed.
404 */
405static int
406round_rate_index(struct clk *clk, unsigned long drate, unsigned long *rate)
243{ 407{
244 unsigned int mask, i; 408 unsigned long tmp = 0, prev_rate = 0;
245 unsigned long flags; 409 int index;
246 struct pclk_info *info = NULL;
247 410
248 spin_lock_irqsave(&clocks_lock, flags); 411 if (!clk->calc_rate)
249 mask = (readl(clk->pclk_sel->pclk_sel_reg) >> clk->pclk_sel_shift) 412 return -EFAULT;
250 & clk->pclk_sel->pclk_sel_mask;
251 413
252 for (i = 0; i < clk->pclk_sel->pclk_count; i++) { 414 if (!drate)
253 if (clk->pclk_sel->pclk_info[i].pclk_mask == mask) 415 return -EINVAL;
254 info = &clk->pclk_sel->pclk_info[i]; 416
417 /*
418 * This loops ends on two conditions:
419 * - as soon as clk is found with rate greater than requested rate.
420 * - if all clks in rate_config are smaller than requested rate.
421 */
422 for (index = 0; index < clk->rate_config.count; index++) {
423 prev_rate = tmp;
424 tmp = clk->calc_rate(clk, index);
425 if (drate < tmp) {
426 index--;
427 break;
428 }
255 } 429 }
256 spin_unlock_irqrestore(&clocks_lock, flags); 430 /* return if can't find suitable clock */
431 if (index < 0) {
432 index = -EINVAL;
433 *rate = 0;
434 } else if (index == clk->rate_config.count) {
435 /* program with highest clk rate possible */
436 index = clk->rate_config.count - 1;
437 *rate = tmp;
438 } else
439 *rate = prev_rate;
257 440
258 return info; 441 return index;
259} 442}
260 443
261/* 444/**
262 * Set pclk as cclk's parent and add clock sibling node to current parents 445 * clk_round_rate - adjust a rate to the exact rate a clock can provide
263 * children list 446 * @clk: clock source
447 * @rate: desired clock rate in Hz
448 *
449 * Returns rounded clock rate in Hz, or negative errno.
264 */ 450 */
265static void change_parent(struct clk *cclk, struct clk *pclk) 451long clk_round_rate(struct clk *clk, unsigned long drate)
266{ 452{
267 unsigned long flags; 453 long rate = 0;
454 int index;
455
456 /*
457 * propagate call to parent who supports calc_rate. Similar approach is
458 * used in clk_set_rate.
459 */
460 if (!clk->calc_rate) {
461 u32 mult;
462 if (!clk->pclk)
463 return clk->rate;
464
465 mult = clk->div_factor ? clk->div_factor : 1;
466 return clk_round_rate(clk->pclk, mult * drate) / mult;
467 }
268 468
269 spin_lock_irqsave(&clocks_lock, flags); 469 index = round_rate_index(clk, drate, &rate);
270 list_del(&cclk->sibling); 470 if (index >= 0)
271 list_add(&cclk->sibling, &pclk->children); 471 return rate;
472 else
473 return index;
474}
475EXPORT_SYMBOL(clk_round_rate);
272 476
273 cclk->pclk = pclk; 477/*All below functions are called with lock held */
274 spin_unlock_irqrestore(&clocks_lock, flags); 478
479/*
480 * Calculates pll clk rate for specific value of mode, m, n and p
481 *
482 * In normal mode
483 * rate = (2 * M[15:8] * Fin)/(N * 2^P)
484 *
485 * In Dithered mode
486 * rate = (2 * M[15:0] * Fin)/(256 * N * 2^P)
487 */
488unsigned long pll_calc_rate(struct clk *clk, int index)
489{
490 unsigned long rate = clk->pclk->rate;
491 struct pll_rate_tbl *tbls = clk->rate_config.tbls;
492 unsigned int mode;
493
494 mode = tbls[index].mode ? 256 : 1;
495 return (((2 * rate / 10000) * tbls[index].m) /
496 (mode * tbls[index].n * (1 << tbls[index].p))) * 10000;
275} 497}
276 498
277/* 499/*
@@ -283,47 +505,146 @@ static void change_parent(struct clk *cclk, struct clk *pclk)
283 * In Dithered mode 505 * In Dithered mode
284 * rate = (2 * M[15:0] * Fin)/(256 * N * 2^P) 506 * rate = (2 * M[15:0] * Fin)/(256 * N * 2^P)
285 */ 507 */
286void pll1_clk_recalc(struct clk *clk) 508int pll_clk_recalc(struct clk *clk)
287{ 509{
288 struct pll_clk_config *config = clk->private_data; 510 struct pll_clk_config *config = clk->private_data;
289 unsigned int num = 2, den = 0, val, mode = 0; 511 unsigned int num = 2, den = 0, val, mode = 0;
290 unsigned long flags;
291 512
292 spin_lock_irqsave(&clocks_lock, flags); 513 mode = (readl(config->mode_reg) >> config->masks->mode_shift) &
293 mode = (readl(config->mode_reg) >> PLL_MODE_SHIFT) & 514 config->masks->mode_mask;
294 PLL_MODE_MASK;
295 515
296 val = readl(config->cfg_reg); 516 val = readl(config->cfg_reg);
297 /* calculate denominator */ 517 /* calculate denominator */
298 den = (val >> PLL_DIV_P_SHIFT) & PLL_DIV_P_MASK; 518 den = (val >> config->masks->div_p_shift) & config->masks->div_p_mask;
299 den = 1 << den; 519 den = 1 << den;
300 den *= (val >> PLL_DIV_N_SHIFT) & PLL_DIV_N_MASK; 520 den *= (val >> config->masks->div_n_shift) & config->masks->div_n_mask;
301 521
302 /* calculate numerator & denominator */ 522 /* calculate numerator & denominator */
303 if (!mode) { 523 if (!mode) {
304 /* Normal mode */ 524 /* Normal mode */
305 num *= (val >> PLL_NORM_FDBK_M_SHIFT) & PLL_NORM_FDBK_M_MASK; 525 num *= (val >> config->masks->norm_fdbk_m_shift) &
526 config->masks->norm_fdbk_m_mask;
306 } else { 527 } else {
307 /* Dithered mode */ 528 /* Dithered mode */
308 num *= (val >> PLL_DITH_FDBK_M_SHIFT) & PLL_DITH_FDBK_M_MASK; 529 num *= (val >> config->masks->dith_fdbk_m_shift) &
530 config->masks->dith_fdbk_m_mask;
309 den *= 256; 531 den *= 256;
310 } 532 }
311 533
534 if (!den)
535 return -EINVAL;
536
312 clk->rate = (((clk->pclk->rate/10000) * num) / den) * 10000; 537 clk->rate = (((clk->pclk->rate/10000) * num) / den) * 10000;
313 spin_unlock_irqrestore(&clocks_lock, flags); 538 return 0;
539}
540
541/*
542 * Configures new clock rate of pll
543 */
544int pll_clk_set_rate(struct clk *clk, unsigned long desired_rate)
545{
546 struct pll_rate_tbl *tbls = clk->rate_config.tbls;
547 struct pll_clk_config *config = clk->private_data;
548 unsigned long val, rate;
549 int i;
550
551 i = round_rate_index(clk, desired_rate, &rate);
552 if (i < 0)
553 return i;
554
555 val = readl(config->mode_reg) &
556 ~(config->masks->mode_mask << config->masks->mode_shift);
557 val |= (tbls[i].mode & config->masks->mode_mask) <<
558 config->masks->mode_shift;
559 writel(val, config->mode_reg);
560
561 val = readl(config->cfg_reg) &
562 ~(config->masks->div_p_mask << config->masks->div_p_shift);
563 val |= (tbls[i].p & config->masks->div_p_mask) <<
564 config->masks->div_p_shift;
565 val &= ~(config->masks->div_n_mask << config->masks->div_n_shift);
566 val |= (tbls[i].n & config->masks->div_n_mask) <<
567 config->masks->div_n_shift;
568 val &= ~(config->masks->dith_fdbk_m_mask <<
569 config->masks->dith_fdbk_m_shift);
570 if (tbls[i].mode)
571 val |= (tbls[i].m & config->masks->dith_fdbk_m_mask) <<
572 config->masks->dith_fdbk_m_shift;
573 else
574 val |= (tbls[i].m & config->masks->norm_fdbk_m_mask) <<
575 config->masks->norm_fdbk_m_shift;
576
577 writel(val, config->cfg_reg);
578
579 clk->rate = rate;
580
581 return 0;
582}
583
584/*
585 * Calculates ahb, apb clk rate for specific value of div
586 */
587unsigned long bus_calc_rate(struct clk *clk, int index)
588{
589 unsigned long rate = clk->pclk->rate;
590 struct bus_rate_tbl *tbls = clk->rate_config.tbls;
591
592 return rate / (tbls[index].div + 1);
314} 593}
315 594
316/* calculates current programmed rate of ahb or apb bus */ 595/* calculates current programmed rate of ahb or apb bus */
317void bus_clk_recalc(struct clk *clk) 596int bus_clk_recalc(struct clk *clk)
318{ 597{
319 struct bus_clk_config *config = clk->private_data; 598 struct bus_clk_config *config = clk->private_data;
320 unsigned int div; 599 unsigned int div;
321 unsigned long flags;
322 600
323 spin_lock_irqsave(&clocks_lock, flags); 601 div = ((readl(config->reg) >> config->masks->shift) &
324 div = ((readl(config->reg) >> config->shift) & config->mask) + 1; 602 config->masks->mask) + 1;
603
604 if (!div)
605 return -EINVAL;
606
325 clk->rate = (unsigned long)clk->pclk->rate / div; 607 clk->rate = (unsigned long)clk->pclk->rate / div;
326 spin_unlock_irqrestore(&clocks_lock, flags); 608 return 0;
609}
610
611/* Configures new clock rate of AHB OR APB bus */
612int bus_clk_set_rate(struct clk *clk, unsigned long desired_rate)
613{
614 struct bus_rate_tbl *tbls = clk->rate_config.tbls;
615 struct bus_clk_config *config = clk->private_data;
616 unsigned long val, rate;
617 int i;
618
619 i = round_rate_index(clk, desired_rate, &rate);
620 if (i < 0)
621 return i;
622
623 val = readl(config->reg) &
624 ~(config->masks->mask << config->masks->shift);
625 val |= (tbls[i].div & config->masks->mask) << config->masks->shift;
626 writel(val, config->reg);
627
628 clk->rate = rate;
629
630 return 0;
631}
632
633/*
634 * gives rate for different values of eq, x and y
635 *
636 * Fout from synthesizer can be given from two equations:
637 * Fout1 = (Fin * X/Y)/2 EQ1
638 * Fout2 = Fin * X/Y EQ2
639 */
640unsigned long aux_calc_rate(struct clk *clk, int index)
641{
642 unsigned long rate = clk->pclk->rate;
643 struct aux_rate_tbl *tbls = clk->rate_config.tbls;
644 u8 eq = tbls[index].eq ? 1 : 2;
645
646 return (((rate/10000) * tbls[index].xscale) /
647 (tbls[index].yscale * eq)) * 10000;
327} 648}
328 649
329/* 650/*
@@ -336,44 +657,76 @@ void bus_clk_recalc(struct clk *clk)
336 * 657 *
337 * Selection of eqn 1 or 2 is programmed in register 658 * Selection of eqn 1 or 2 is programmed in register
338 */ 659 */
339void aux_clk_recalc(struct clk *clk) 660int aux_clk_recalc(struct clk *clk)
340{ 661{
341 struct aux_clk_config *config = clk->private_data; 662 struct aux_clk_config *config = clk->private_data;
342 struct pclk_info *pclk_info = NULL;
343 unsigned int num = 1, den = 1, val, eqn; 663 unsigned int num = 1, den = 1, val, eqn;
344 unsigned long flags;
345 664
346 /* get current programmed parent */ 665 val = readl(config->synth_reg);
347 pclk_info = pclk_info_get(clk);
348 if (!pclk_info) {
349 spin_lock_irqsave(&clocks_lock, flags);
350 clk->pclk = NULL;
351 clk->rate = 0;
352 spin_unlock_irqrestore(&clocks_lock, flags);
353 return;
354 }
355 666
356 change_parent(clk, pclk_info->pclk); 667 eqn = (val >> config->masks->eq_sel_shift) &
668 config->masks->eq_sel_mask;
669 if (eqn == config->masks->eq1_mask)
670 den *= 2;
357 671
358 spin_lock_irqsave(&clocks_lock, flags); 672 /* calculate numerator */
359 if (pclk_info->scalable) { 673 num = (val >> config->masks->xscale_sel_shift) &
360 val = readl(config->synth_reg); 674 config->masks->xscale_sel_mask;
361 675
362 eqn = (val >> AUX_EQ_SEL_SHIFT) & AUX_EQ_SEL_MASK; 676 /* calculate denominator */
363 if (eqn == AUX_EQ1_SEL) 677 den *= (val >> config->masks->yscale_sel_shift) &
364 den *= 2; 678 config->masks->yscale_sel_mask;
365 679
366 /* calculate numerator */ 680 if (!den)
367 num = (val >> AUX_XSCALE_SHIFT) & AUX_XSCALE_MASK; 681 return -EINVAL;
368 682
369 /* calculate denominator */ 683 clk->rate = (((clk->pclk->rate/10000) * num) / den) * 10000;
370 den *= (val >> AUX_YSCALE_SHIFT) & AUX_YSCALE_MASK; 684 return 0;
371 val = (((clk->pclk->rate/10000) * num) / den) * 10000; 685}
372 } else
373 val = clk->pclk->rate;
374 686
375 clk->rate = val; 687/* Configures new clock rate of auxiliary synthesizers used by: UART, FIRDA*/
376 spin_unlock_irqrestore(&clocks_lock, flags); 688int aux_clk_set_rate(struct clk *clk, unsigned long desired_rate)
689{
690 struct aux_rate_tbl *tbls = clk->rate_config.tbls;
691 struct aux_clk_config *config = clk->private_data;
692 unsigned long val, rate;
693 int i;
694
695 i = round_rate_index(clk, desired_rate, &rate);
696 if (i < 0)
697 return i;
698
699 val = readl(config->synth_reg) &
700 ~(config->masks->eq_sel_mask << config->masks->eq_sel_shift);
701 val |= (tbls[i].eq & config->masks->eq_sel_mask) <<
702 config->masks->eq_sel_shift;
703 val &= ~(config->masks->xscale_sel_mask <<
704 config->masks->xscale_sel_shift);
705 val |= (tbls[i].xscale & config->masks->xscale_sel_mask) <<
706 config->masks->xscale_sel_shift;
707 val &= ~(config->masks->yscale_sel_mask <<
708 config->masks->yscale_sel_shift);
709 val |= (tbls[i].yscale & config->masks->yscale_sel_mask) <<
710 config->masks->yscale_sel_shift;
711 writel(val, config->synth_reg);
712
713 clk->rate = rate;
714
715 return 0;
716}
717
718/*
719 * Calculates gpt clk rate for different values of mscale and nscale
720 *
721 * Fout= Fin/((2 ^ (N+1)) * (M+1))
722 */
723unsigned long gpt_calc_rate(struct clk *clk, int index)
724{
725 unsigned long rate = clk->pclk->rate;
726 struct gpt_rate_tbl *tbls = clk->rate_config.tbls;
727
728 return rate / ((1 << (tbls[index].nscale + 1)) *
729 (tbls[index].mscale + 1));
377} 730}
378 731
379/* 732/*
@@ -381,46 +734,142 @@ void aux_clk_recalc(struct clk *clk)
381 * Fout from synthesizer can be given from below equations: 734 * Fout from synthesizer can be given from below equations:
382 * Fout= Fin/((2 ^ (N+1)) * (M+1)) 735 * Fout= Fin/((2 ^ (N+1)) * (M+1))
383 */ 736 */
384void gpt_clk_recalc(struct clk *clk) 737int gpt_clk_recalc(struct clk *clk)
385{ 738{
386 struct aux_clk_config *config = clk->private_data; 739 struct gpt_clk_config *config = clk->private_data;
387 struct pclk_info *pclk_info = NULL;
388 unsigned int div = 1, val; 740 unsigned int div = 1, val;
389 unsigned long flags;
390 741
391 pclk_info = pclk_info_get(clk); 742 val = readl(config->synth_reg);
392 if (!pclk_info) { 743 div += (val >> config->masks->mscale_sel_shift) &
393 spin_lock_irqsave(&clocks_lock, flags); 744 config->masks->mscale_sel_mask;
394 clk->pclk = NULL; 745 div *= 1 << (((val >> config->masks->nscale_sel_shift) &
395 clk->rate = 0; 746 config->masks->nscale_sel_mask) + 1);
396 spin_unlock_irqrestore(&clocks_lock, flags);
397 return;
398 }
399
400 change_parent(clk, pclk_info->pclk);
401 747
402 spin_lock_irqsave(&clocks_lock, flags); 748 if (!div)
403 if (pclk_info->scalable) { 749 return -EINVAL;
404 val = readl(config->synth_reg);
405 div += (val >> GPT_MSCALE_SHIFT) & GPT_MSCALE_MASK;
406 div *= 1 << (((val >> GPT_NSCALE_SHIFT) & GPT_NSCALE_MASK) + 1);
407 }
408 750
409 clk->rate = (unsigned long)clk->pclk->rate / div; 751 clk->rate = (unsigned long)clk->pclk->rate / div;
410 spin_unlock_irqrestore(&clocks_lock, flags); 752 return 0;
753}
754
755/* Configures new clock rate of gptiliary synthesizers used by: UART, FIRDA*/
756int gpt_clk_set_rate(struct clk *clk, unsigned long desired_rate)
757{
758 struct gpt_rate_tbl *tbls = clk->rate_config.tbls;
759 struct gpt_clk_config *config = clk->private_data;
760 unsigned long val, rate;
761 int i;
762
763 i = round_rate_index(clk, desired_rate, &rate);
764 if (i < 0)
765 return i;
766
767 val = readl(config->synth_reg) & ~(config->masks->mscale_sel_mask <<
768 config->masks->mscale_sel_shift);
769 val |= (tbls[i].mscale & config->masks->mscale_sel_mask) <<
770 config->masks->mscale_sel_shift;
771 val &= ~(config->masks->nscale_sel_mask <<
772 config->masks->nscale_sel_shift);
773 val |= (tbls[i].nscale & config->masks->nscale_sel_mask) <<
774 config->masks->nscale_sel_shift;
775 writel(val, config->synth_reg);
776
777 clk->rate = rate;
778
779 return 0;
411} 780}
412 781
413/* 782/*
414 * Used for clocks that always have same value as the parent clock divided by a 783 * Calculates clcd clk rate for different values of div
784 *
785 * Fout from synthesizer can be given from below equation:
786 * Fout= Fin/2*div (division factor)
787 * div is 17 bits:-
788 * 0-13 (fractional part)
789 * 14-16 (integer part)
790 * To calculate Fout we left shift val by 14 bits and divide Fin by
791 * complete div (including fractional part) and then right shift the
792 * result by 14 places.
793 */
794unsigned long clcd_calc_rate(struct clk *clk, int index)
795{
796 unsigned long rate = clk->pclk->rate;
797 struct clcd_rate_tbl *tbls = clk->rate_config.tbls;
798
799 rate /= 1000;
800 rate <<= 12;
801 rate /= (2 * tbls[index].div);
802 rate >>= 12;
803 rate *= 1000;
804
805 return rate;
806}
807
808/*
809 * calculates current programmed rate of clcd synthesizer
810 * Fout from synthesizer can be given from below equation:
811 * Fout= Fin/2*div (division factor)
812 * div is 17 bits:-
813 * 0-13 (fractional part)
814 * 14-16 (integer part)
815 * To calculate Fout we left shift val by 14 bits and divide Fin by
816 * complete div (including fractional part) and then right shift the
817 * result by 14 places.
818 */
819int clcd_clk_recalc(struct clk *clk)
820{
821 struct clcd_clk_config *config = clk->private_data;
822 unsigned int div = 1;
823 unsigned long prate;
824 unsigned int val;
825
826 val = readl(config->synth_reg);
827 div = (val >> config->masks->div_factor_shift) &
828 config->masks->div_factor_mask;
829
830 if (!div)
831 return -EINVAL;
832
833 prate = clk->pclk->rate / 1000; /* first level division, make it KHz */
834
835 clk->rate = (((unsigned long)prate << 12) / (2 * div)) >> 12;
836 clk->rate *= 1000;
837 return 0;
838}
839
840/* Configures new clock rate of auxiliary synthesizers used by: UART, FIRDA*/
841int clcd_clk_set_rate(struct clk *clk, unsigned long desired_rate)
842{
843 struct clcd_rate_tbl *tbls = clk->rate_config.tbls;
844 struct clcd_clk_config *config = clk->private_data;
845 unsigned long val, rate;
846 int i;
847
848 i = round_rate_index(clk, desired_rate, &rate);
849 if (i < 0)
850 return i;
851
852 val = readl(config->synth_reg) & ~(config->masks->div_factor_mask <<
853 config->masks->div_factor_shift);
854 val |= (tbls[i].div & config->masks->div_factor_mask) <<
855 config->masks->div_factor_shift;
856 writel(val, config->synth_reg);
857
858 clk->rate = rate;
859
860 return 0;
861}
862
863/*
864 * Used for clocks that always have value as the parent clock divided by a
415 * fixed divisor 865 * fixed divisor
416 */ 866 */
417void follow_parent(struct clk *clk) 867int follow_parent(struct clk *clk)
418{ 868{
419 unsigned long flags; 869 unsigned int div_factor = (clk->div_factor < 1) ? 1 : clk->div_factor;
420 870
421 spin_lock_irqsave(&clocks_lock, flags); 871 clk->rate = clk->pclk->rate/div_factor;
422 clk->rate = clk->pclk->rate; 872 return 0;
423 spin_unlock_irqrestore(&clocks_lock, flags);
424} 873}
425 874
426/** 875/**
@@ -431,5 +880,124 @@ void follow_parent(struct clk *clk)
431 */ 880 */
432void recalc_root_clocks(void) 881void recalc_root_clocks(void)
433{ 882{
434 propagate_rate(&root_clks); 883 struct clk *pclk;
884 unsigned long flags;
885 int ret = 0;
886
887 spin_lock_irqsave(&clocks_lock, flags);
888 list_for_each_entry(pclk, &root_clks, sibling) {
889 if (pclk->recalc) {
890 ret = pclk->recalc(pclk);
891 /*
892 * recalc will return error if clk out is not programmed
893 * In this case configure default clock.
894 */
895 if (ret && pclk->set_rate)
896 pclk->set_rate(pclk, 0);
897 }
898 propagate_rate(pclk, 1);
899 /* Enable clks enabled on init, in software view */
900 if (pclk->flags & ENABLED_ON_INIT)
901 do_clk_enable(pclk);
902 }
903 spin_unlock_irqrestore(&clocks_lock, flags);
904}
905
906#ifdef CONFIG_DEBUG_FS
907/*
908 * debugfs support to trace clock tree hierarchy and attributes
909 */
910static struct dentry *clk_debugfs_root;
911static int clk_debugfs_register_one(struct clk *c)
912{
913 int err;
914 struct dentry *d, *child;
915 struct clk *pa = c->pclk;
916 char s[255];
917 char *p = s;
918
919 if (c) {
920 if (c->cl->con_id)
921 p += sprintf(p, "%s", c->cl->con_id);
922 if (c->cl->dev_id)
923 p += sprintf(p, "%s", c->cl->dev_id);
924 }
925 d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
926 if (!d)
927 return -ENOMEM;
928 c->dent = d;
929
930 d = debugfs_create_u32("usage_count", S_IRUGO, c->dent,
931 (u32 *)&c->usage_count);
932 if (!d) {
933 err = -ENOMEM;
934 goto err_out;
935 }
936 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
937 if (!d) {
938 err = -ENOMEM;
939 goto err_out;
940 }
941 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
942 if (!d) {
943 err = -ENOMEM;
944 goto err_out;
945 }
946 return 0;
947
948err_out:
949 d = c->dent;
950 list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
951 debugfs_remove(child);
952 debugfs_remove(c->dent);
953 return err;
954}
955
956static int clk_debugfs_register(struct clk *c)
957{
958 int err;
959 struct clk *pa = c->pclk;
960
961 if (pa && !pa->dent) {
962 err = clk_debugfs_register(pa);
963 if (err)
964 return err;
965 }
966
967 if (!c->dent) {
968 err = clk_debugfs_register_one(c);
969 if (err)
970 return err;
971 }
972 return 0;
973}
974
975static int __init clk_debugfs_init(void)
976{
977 struct clk *c;
978 struct dentry *d;
979 int err;
980
981 d = debugfs_create_dir("clock", NULL);
982 if (!d)
983 return -ENOMEM;
984 clk_debugfs_root = d;
985
986 list_for_each_entry(c, &clocks, node) {
987 err = clk_debugfs_register(c);
988 if (err)
989 goto err_out;
990 }
991 return 0;
992err_out:
993 debugfs_remove_recursive(clk_debugfs_root);
994 return err;
995}
996late_initcall(clk_debugfs_init);
997
998static int clk_debugfs_reparent(struct clk *c)
999{
1000 debugfs_remove(c->dent);
1001 return clk_debugfs_register_one(c);
435} 1002}
1003#endif /* CONFIG_DEBUG_FS */
diff --git a/arch/arm/plat-spear/include/plat/clock.h b/arch/arm/plat-spear/include/plat/clock.h
index 2572260f990f..2ae6606930a6 100644
--- a/arch/arm/plat-spear/include/plat/clock.h
+++ b/arch/arm/plat-spear/include/plat/clock.h
@@ -21,6 +21,7 @@
21/* clk structure flags */ 21/* clk structure flags */
22#define ALWAYS_ENABLED (1 << 0) /* clock always enabled */ 22#define ALWAYS_ENABLED (1 << 0) /* clock always enabled */
23#define RESET_TO_ENABLE (1 << 1) /* reset register bit to enable clk */ 23#define RESET_TO_ENABLE (1 << 1) /* reset register bit to enable clk */
24#define ENABLED_ON_INIT (1 << 2) /* clocks enabled at init */
24 25
25/** 26/**
26 * struct clkops - clock operations 27 * struct clkops - clock operations
@@ -35,13 +36,11 @@ struct clkops {
35/** 36/**
36 * struct pclk_info - parents info 37 * struct pclk_info - parents info
37 * @pclk: pointer to parent clk 38 * @pclk: pointer to parent clk
38 * @pclk_mask: value to be written for selecting this parent 39 * @pclk_val: value to be written for selecting this parent
39 * @scalable: Is parent scalable (1 - YES, 0 - NO)
40 */ 40 */
41struct pclk_info { 41struct pclk_info {
42 struct clk *pclk; 42 struct clk *pclk;
43 u8 pclk_mask; 43 u8 pclk_val;
44 u8 scalable;
45}; 44};
46 45
47/** 46/**
@@ -54,11 +53,23 @@ struct pclk_info {
54struct pclk_sel { 53struct pclk_sel {
55 struct pclk_info *pclk_info; 54 struct pclk_info *pclk_info;
56 u8 pclk_count; 55 u8 pclk_count;
57 unsigned int *pclk_sel_reg; 56 void __iomem *pclk_sel_reg;
58 unsigned int pclk_sel_mask; 57 unsigned int pclk_sel_mask;
59}; 58};
60 59
61/** 60/**
61 * struct rate_config - clk rate configurations
62 * @tbls: array of device specific clk rate tables, in ascending order of rates
63 * @count: size of tbls array
64 * @default_index: default setting when originally disabled
65 */
66struct rate_config {
67 void *tbls;
68 u8 count;
69 u8 default_index;
70};
71
72/**
62 * struct clk - clock structure 73 * struct clk - clock structure
63 * @usage_count: num of users who enabled this clock 74 * @usage_count: num of users who enabled this clock
64 * @flags: flags for clock properties 75 * @flags: flags for clock properties
@@ -67,21 +78,32 @@ struct pclk_sel {
67 * @en_reg_bit: clk enable/disable bit 78 * @en_reg_bit: clk enable/disable bit
68 * @ops: clk enable/disable ops - generic_clkops selected if NULL 79 * @ops: clk enable/disable ops - generic_clkops selected if NULL
69 * @recalc: pointer to clock rate recalculate function 80 * @recalc: pointer to clock rate recalculate function
81 * @set_rate: pointer to clock set rate function
82 * @calc_rate: pointer to clock get rate function for index
83 * @rate_config: rate configuration information, used by set_rate
84 * @div_factor: division factor to parent clock.
70 * @pclk: current parent clk 85 * @pclk: current parent clk
71 * @pclk_sel: pointer to parent selection structure 86 * @pclk_sel: pointer to parent selection structure
72 * @pclk_sel_shift: register shift for selecting parent of this clock 87 * @pclk_sel_shift: register shift for selecting parent of this clock
73 * @children: list for childrens or this clock 88 * @children: list for childrens or this clock
74 * @sibling: node for list of clocks having same parents 89 * @sibling: node for list of clocks having same parents
75 * @private_data: clock specific private data 90 * @private_data: clock specific private data
91 * @node: list to maintain clocks linearly
92 * @cl: clocklook up assoicated with this clock
93 * @dent: object for debugfs
76 */ 94 */
77struct clk { 95struct clk {
78 unsigned int usage_count; 96 unsigned int usage_count;
79 unsigned int flags; 97 unsigned int flags;
80 unsigned long rate; 98 unsigned long rate;
81 unsigned int *en_reg; 99 void __iomem *en_reg;
82 u8 en_reg_bit; 100 u8 en_reg_bit;
83 const struct clkops *ops; 101 const struct clkops *ops;
84 void (*recalc) (struct clk *); 102 int (*recalc) (struct clk *);
103 int (*set_rate) (struct clk *, unsigned long rate);
104 unsigned long (*calc_rate)(struct clk *, int index);
105 struct rate_config rate_config;
106 unsigned int div_factor;
85 107
86 struct clk *pclk; 108 struct clk *pclk;
87 struct pclk_sel *pclk_sel; 109 struct pclk_sel *pclk_sel;
@@ -90,37 +112,137 @@ struct clk {
90 struct list_head children; 112 struct list_head children;
91 struct list_head sibling; 113 struct list_head sibling;
92 void *private_data; 114 void *private_data;
115#ifdef CONFIG_DEBUG_FS
116 struct list_head node;
117 struct clk_lookup *cl;
118 struct dentry *dent;
119#endif
93}; 120};
94 121
95/* pll configuration structure */ 122/* pll configuration structure */
123struct pll_clk_masks {
124 u32 mode_mask;
125 u32 mode_shift;
126
127 u32 norm_fdbk_m_mask;
128 u32 norm_fdbk_m_shift;
129 u32 dith_fdbk_m_mask;
130 u32 dith_fdbk_m_shift;
131 u32 div_p_mask;
132 u32 div_p_shift;
133 u32 div_n_mask;
134 u32 div_n_shift;
135};
136
96struct pll_clk_config { 137struct pll_clk_config {
97 unsigned int *mode_reg; 138 void __iomem *mode_reg;
98 unsigned int *cfg_reg; 139 void __iomem *cfg_reg;
140 struct pll_clk_masks *masks;
141};
142
143/* pll clk rate config structure */
144struct pll_rate_tbl {
145 u8 mode;
146 u16 m;
147 u8 n;
148 u8 p;
99}; 149};
100 150
101/* ahb and apb bus configuration structure */ 151/* ahb and apb bus configuration structure */
152struct bus_clk_masks {
153 u32 mask;
154 u32 shift;
155};
156
102struct bus_clk_config { 157struct bus_clk_config {
103 unsigned int *reg; 158 void __iomem *reg;
104 unsigned int mask; 159 struct bus_clk_masks *masks;
105 unsigned int shift; 160};
161
162/* ahb and apb clk bus rate config structure */
163struct bus_rate_tbl {
164 u8 div;
165};
166
167/* Aux clk configuration structure: applicable to UART and FIRDA */
168struct aux_clk_masks {
169 u32 eq_sel_mask;
170 u32 eq_sel_shift;
171 u32 eq1_mask;
172 u32 eq2_mask;
173 u32 xscale_sel_mask;
174 u32 xscale_sel_shift;
175 u32 yscale_sel_mask;
176 u32 yscale_sel_shift;
106}; 177};
107 178
108/*
109 * Aux clk configuration structure: applicable to GPT, UART and FIRDA
110 */
111struct aux_clk_config { 179struct aux_clk_config {
112 unsigned int *synth_reg; 180 void __iomem *synth_reg;
181 struct aux_clk_masks *masks;
182};
183
184/* aux clk rate config structure */
185struct aux_rate_tbl {
186 u16 xscale;
187 u16 yscale;
188 u8 eq;
189};
190
191/* GPT clk configuration structure */
192struct gpt_clk_masks {
193 u32 mscale_sel_mask;
194 u32 mscale_sel_shift;
195 u32 nscale_sel_mask;
196 u32 nscale_sel_shift;
197};
198
199struct gpt_clk_config {
200 void __iomem *synth_reg;
201 struct gpt_clk_masks *masks;
202};
203
204/* gpt clk rate config structure */
205struct gpt_rate_tbl {
206 u16 mscale;
207 u16 nscale;
208};
209
210/* clcd clk configuration structure */
211struct clcd_synth_masks {
212 u32 div_factor_mask;
213 u32 div_factor_shift;
214};
215
216struct clcd_clk_config {
217 void __iomem *synth_reg;
218 struct clcd_synth_masks *masks;
219};
220
221/* clcd clk rate config structure */
222struct clcd_rate_tbl {
223 u16 div;
113}; 224};
114 225
115/* platform specific clock functions */ 226/* platform specific clock functions */
116void clk_register(struct clk_lookup *cl); 227void clk_register(struct clk_lookup *cl);
117void recalc_root_clocks(void); 228void recalc_root_clocks(void);
118 229
119/* clock recalc functions */ 230/* clock recalc & set rate functions */
120void follow_parent(struct clk *clk); 231int follow_parent(struct clk *clk);
121void pll1_clk_recalc(struct clk *clk); 232unsigned long pll_calc_rate(struct clk *clk, int index);
122void bus_clk_recalc(struct clk *clk); 233int pll_clk_recalc(struct clk *clk);
123void gpt_clk_recalc(struct clk *clk); 234int pll_clk_set_rate(struct clk *clk, unsigned long desired_rate);
124void aux_clk_recalc(struct clk *clk); 235unsigned long bus_calc_rate(struct clk *clk, int index);
236int bus_clk_recalc(struct clk *clk);
237int bus_clk_set_rate(struct clk *clk, unsigned long desired_rate);
238unsigned long gpt_calc_rate(struct clk *clk, int index);
239int gpt_clk_recalc(struct clk *clk);
240int gpt_clk_set_rate(struct clk *clk, unsigned long desired_rate);
241unsigned long aux_calc_rate(struct clk *clk, int index);
242int aux_clk_recalc(struct clk *clk);
243int aux_clk_set_rate(struct clk *clk, unsigned long desired_rate);
244unsigned long clcd_calc_rate(struct clk *clk, int index);
245int clcd_clk_recalc(struct clk *clk);
246int clcd_clk_set_rate(struct clk *clk, unsigned long desired_rate);
125 247
126#endif /* __PLAT_CLOCK_H */ 248#endif /* __PLAT_CLOCK_H */
diff --git a/arch/arm/plat-spear/include/plat/debug-macro.S b/arch/arm/plat-spear/include/plat/debug-macro.S
index e91270e4f640..8501bbf2c092 100644
--- a/arch/arm/plat-spear/include/plat/debug-macro.S
+++ b/arch/arm/plat-spear/include/plat/debug-macro.S
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include <linux/amba/serial.h> 14#include <linux/amba/serial.h>
15#include <mach/spear.h> 15#include <mach/hardware.h>
16 16
17 .macro addruart, rp, rv 17 .macro addruart, rp, rv
18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base 18 mov \rp, #SPEAR_DBG_UART_BASE @ Physical base
diff --git a/arch/arm/plat-spear/include/plat/hardware.h b/arch/arm/plat-spear/include/plat/hardware.h
new file mode 100644
index 000000000000..66d677225d15
--- /dev/null
+++ b/arch/arm/plat-spear/include/plat/hardware.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/plat-spear/include/plat/hardware.h
3 *
4 * Hardware definitions for SPEAr
5 *
6 * Copyright (C) 2010 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_HARDWARE_H
15#define __PLAT_HARDWARE_H
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 */
diff --git a/arch/arm/plat-spear/include/plat/system.h b/arch/arm/plat-spear/include/plat/system.h
index 55a4e405d578..a235fa0ca777 100644
--- a/arch/arm/plat-spear/include/plat/system.h
+++ b/arch/arm/plat-spear/include/plat/system.h
@@ -14,9 +14,9 @@
14#ifndef __PLAT_SYSTEM_H 14#ifndef __PLAT_SYSTEM_H
15#define __PLAT_SYSTEM_H 15#define __PLAT_SYSTEM_H
16 16
17#include <asm/hardware/sp810.h>
18#include <linux/io.h> 17#include <linux/io.h>
19#include <mach/spear.h> 18#include <asm/hardware/sp810.h>
19#include <mach/hardware.h>
20 20
21static inline void arch_idle(void) 21static inline void arch_idle(void)
22{ 22{
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/plat-spear/include/plat/uncompress.h
index 99ba6789cc97..1bf84527aee4 100644
--- a/arch/arm/plat-spear/include/plat/uncompress.h
+++ b/arch/arm/plat-spear/include/plat/uncompress.h
@@ -13,7 +13,7 @@
13 13
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/amba/serial.h> 15#include <linux/amba/serial.h>
16#include <mach/spear.h> 16#include <mach/hardware.h>
17 17
18#ifndef __PLAT_UNCOMPRESS_H 18#ifndef __PLAT_UNCOMPRESS_H
19#define __PLAT_UNCOMPRESS_H 19#define __PLAT_UNCOMPRESS_H
@@ -24,10 +24,10 @@ static inline void putc(int c)
24{ 24{
25 void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE; 25 void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE;
26 26
27 while (readl(base + UART01x_FR) & UART01x_FR_TXFF) 27 while (readl_relaxed(base + UART01x_FR) & UART01x_FR_TXFF)
28 barrier(); 28 barrier();
29 29
30 writel(c, base + UART01x_DR); 30 writel_relaxed(c, base + UART01x_DR);
31} 31}
32 32
33static inline void flush(void) 33static inline void flush(void)
diff --git a/arch/arm/plat-spear/include/plat/vmalloc.h b/arch/arm/plat-spear/include/plat/vmalloc.h
index 09e9372aea21..8c8b24d07046 100644
--- a/arch/arm/plat-spear/include/plat/vmalloc.h
+++ b/arch/arm/plat-spear/include/plat/vmalloc.h
@@ -14,6 +14,6 @@
14#ifndef __PLAT_VMALLOC_H 14#ifndef __PLAT_VMALLOC_H
15#define __PLAT_VMALLOC_H 15#define __PLAT_VMALLOC_H
16 16
17#define VMALLOC_END 0xF0000000 17#define VMALLOC_END 0xF0000000UL
18 18
19#endif /* __PLAT_VMALLOC_H */ 19#endif /* __PLAT_VMALLOC_H */
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index 839c88df9994..dbb6e4fff79d 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/arm/plat-spear/time.c 2 * arch/arm/plat-spear/time.c
3 * 3 *
4 * Copyright (C) 2009 ST Microelectronics 4 * Copyright (C) 2010 ST Microelectronics
5 * Shiraz Hashim<shiraz.hashim@st.com> 5 * Shiraz Hashim<shiraz.hashim@st.com>
6 * 6 *
7 * This file is licensed under the terms of the GNU General Public 7 * This file is licensed under the terms of the GNU General Public
@@ -20,10 +20,9 @@
20#include <linux/time.h> 20#include <linux/time.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <asm/mach/time.h> 22#include <asm/mach/time.h>
23#include <mach/irqs.h>
24#include <mach/hardware.h>
25#include <mach/spear.h>
26#include <mach/generic.h> 23#include <mach/generic.h>
24#include <mach/hardware.h>
25#include <mach/irqs.h>
27 26
28/* 27/*
29 * We would use TIMER0 and TIMER1 as clockevent and clocksource. 28 * We would use TIMER0 and TIMER1 as clockevent and clocksource.
@@ -211,7 +210,7 @@ static void __init spear_clockevent_init(void)
211 210
212void __init spear_setup_timer(void) 211void __init spear_setup_timer(void)
213{ 212{
214 struct clk *pll3_clk; 213 int ret;
215 214
216 if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) { 215 if (!request_mem_region(SPEAR_GPT0_BASE, SZ_1K, "gpt0")) {
217 pr_err("%s:cannot get IO addr\n", __func__); 216 pr_err("%s:cannot get IO addr\n", __func__);
@@ -230,26 +229,21 @@ void __init spear_setup_timer(void)
230 goto err_iomap; 229 goto err_iomap;
231 } 230 }
232 231
233 pll3_clk = clk_get(NULL, "pll3_48m_clk"); 232 ret = clk_enable(gpt_clk);
234 if (!pll3_clk) { 233 if (ret < 0) {
235 pr_err("%s:couldn't get PLL3 as parent for gpt\n", __func__); 234 pr_err("%s:couldn't enable gpt clock\n", __func__);
236 goto err_iomap; 235 goto err_clk;
237 } 236 }
238 237
239 clk_set_parent(gpt_clk, pll3_clk);
240
241 spear_clockevent_init(); 238 spear_clockevent_init();
242 spear_clocksource_init(); 239 spear_clocksource_init();
243 240
244 return; 241 return;
245 242
243err_clk:
244 clk_put(gpt_clk);
246err_iomap: 245err_iomap:
247 iounmap(gpt_base); 246 iounmap(gpt_base);
248
249err_mem: 247err_mem:
250 release_mem_region(SPEAR_GPT0_BASE, SZ_1K); 248 release_mem_region(SPEAR_GPT0_BASE, SZ_1K);
251} 249}
252
253struct sys_timer spear_sys_timer = {
254 .init = spear_setup_timer,
255};
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 2fea897ebeb1..9d6feaabbe7d 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Sun Dec 12 23:24:27 2010 15# Last update: Mon Feb 7 08:59:27 2011
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -2240,7 +2240,7 @@ arm_ultimator2 MACH_ARM_ULTIMATOR2 ARM_ULTIMATOR2 2250
2240vs_v210 MACH_VS_V210 VS_V210 2252 2240vs_v210 MACH_VS_V210 VS_V210 2252
2241vs_v212 MACH_VS_V212 VS_V212 2253 2241vs_v212 MACH_VS_V212 VS_V212 2253
2242hmt MACH_HMT HMT 2254 2242hmt MACH_HMT HMT 2254
2243suen3 MACH_SUEN3 SUEN3 2255 2243km_kirkwood MACH_KM_KIRKWOOD KM_KIRKWOOD 2255
2244vesper MACH_VESPER VESPER 2256 2244vesper MACH_VESPER VESPER 2256
2245str9 MACH_STR9 STR9 2257 2245str9 MACH_STR9 STR9 2257
2246omap3_wl_ff MACH_OMAP3_WL_FF OMAP3_WL_FF 2258 2246omap3_wl_ff MACH_OMAP3_WL_FF OMAP3_WL_FF 2258
@@ -2987,7 +2987,7 @@ pxwnas_500_1000 MACH_PXWNAS_500_1000 PXWNAS_500_1000 3001
2987ea20 MACH_EA20 EA20 3002 2987ea20 MACH_EA20 EA20 3002
2988awm2 MACH_AWM2 AWM2 3003 2988awm2 MACH_AWM2 AWM2 3003
2989ti8148evm MACH_TI8148EVM TI8148EVM 3004 2989ti8148evm MACH_TI8148EVM TI8148EVM 3004
2990tegra_seaboard MACH_TEGRA_SEABOARD TEGRA_SEABOARD 3005 2990seaboard MACH_SEABOARD SEABOARD 3005
2991linkstation_chlv2 MACH_LINKSTATION_CHLV2 LINKSTATION_CHLV2 3006 2991linkstation_chlv2 MACH_LINKSTATION_CHLV2 LINKSTATION_CHLV2 3006
2992tera_pro2_rack MACH_TERA_PRO2_RACK TERA_PRO2_RACK 3007 2992tera_pro2_rack MACH_TERA_PRO2_RACK TERA_PRO2_RACK 3007
2993rubys MACH_RUBYS RUBYS 3008 2993rubys MACH_RUBYS RUBYS 3008
@@ -3190,7 +3190,7 @@ synergy MACH_SYNERGY SYNERGY 3205
3190ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206 3190ics_if_voip MACH_ICS_IF_VOIP ICS_IF_VOIP 3206
3191wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207 3191wlf_cragg_6410 MACH_WLF_CRAGG_6410 WLF_CRAGG_6410 3207
3192punica MACH_PUNICA PUNICA 3208 3192punica MACH_PUNICA PUNICA 3208
3193sbc_nt250 MACH_SBC_NT250 SBC_NT250 3209 3193trimslice MACH_TRIMSLICE TRIMSLICE 3209
3194mx27_wmultra MACH_MX27_WMULTRA MX27_WMULTRA 3210 3194mx27_wmultra MACH_MX27_WMULTRA MX27_WMULTRA 3210
3195mackerel MACH_MACKEREL MACKEREL 3211 3195mackerel MACH_MACKEREL MACKEREL 3211
3196fa9x27 MACH_FA9X27 FA9X27 3213 3196fa9x27 MACH_FA9X27 FA9X27 3213
@@ -3219,3 +3219,100 @@ pivicc MACH_PIVICC PIVICC 3235
3219pcm048 MACH_PCM048 PCM048 3236 3219pcm048 MACH_PCM048 PCM048 3236
3220dds MACH_DDS DDS 3237 3220dds MACH_DDS DDS 3237
3221chalten_xa1 MACH_CHALTEN_XA1 CHALTEN_XA1 3238 3221chalten_xa1 MACH_CHALTEN_XA1 CHALTEN_XA1 3238
3222ts48xx MACH_TS48XX TS48XX 3239
3223tonga2_tfttimer MACH_TONGA2_TFTTIMER TONGA2_TFTTIMER 3240
3224whistler MACH_WHISTLER WHISTLER 3241
3225asl_phoenix MACH_ASL_PHOENIX ASL_PHOENIX 3242
3226at91sam9263otlite MACH_AT91SAM9263OTLITE AT91SAM9263OTLITE 3243
3227ddplug MACH_DDPLUG DDPLUG 3244
3228d2plug MACH_D2PLUG D2PLUG 3245
3229kzm9d MACH_KZM9D KZM9D 3246
3230verdi_lte MACH_VERDI_LTE VERDI_LTE 3247
3231nanozoom MACH_NANOZOOM NANOZOOM 3248
3232dm3730_som_lv MACH_DM3730_SOM_LV DM3730_SOM_LV 3249
3233dm3730_torpedo MACH_DM3730_TORPEDO DM3730_TORPEDO 3250
3234anchovy MACH_ANCHOVY ANCHOVY 3251
3235re2rev20 MACH_RE2REV20 RE2REV20 3253
3236re2rev21 MACH_RE2REV21 RE2REV21 3254
3237cns21xx MACH_CNS21XX CNS21XX 3255
3238rider MACH_RIDER RIDER 3257
3239nsk330 MACH_NSK330 NSK330 3258
3240cns2133evb MACH_CNS2133EVB CNS2133EVB 3259
3241z3_816x_mod MACH_Z3_816X_MOD Z3_816X_MOD 3260
3242z3_814x_mod MACH_Z3_814X_MOD Z3_814X_MOD 3261
3243beect MACH_BEECT BEECT 3262
3244dma_thunderbug MACH_DMA_THUNDERBUG DMA_THUNDERBUG 3263
3245omn_at91sam9g20 MACH_OMN_AT91SAM9G20 OMN_AT91SAM9G20 3264
3246mx25_e2s_uc MACH_MX25_E2S_UC MX25_E2S_UC 3265
3247mione MACH_MIONE MIONE 3266
3248top9000_tcu MACH_TOP9000_TCU TOP9000_TCU 3267
3249top9000_bsl MACH_TOP9000_BSL TOP9000_BSL 3268
3250kingdom MACH_KINGDOM KINGDOM 3269
3251armadillo460 MACH_ARMADILLO460 ARMADILLO460 3270
3252lq2 MACH_LQ2 LQ2 3271
3253sweda_tms2 MACH_SWEDA_TMS2 SWEDA_TMS2 3272
3254mx53_loco MACH_MX53_LOCO MX53_LOCO 3273
3255acer_a8 MACH_ACER_A8 ACER_A8 3275
3256acer_gauguin MACH_ACER_GAUGUIN ACER_GAUGUIN 3276
3257guppy MACH_GUPPY GUPPY 3277
3258mx61_ard MACH_MX61_ARD MX61_ARD 3278
3259tx53 MACH_TX53 TX53 3279
3260omapl138_case_a3 MACH_OMAPL138_CASE_A3 OMAPL138_CASE_A3 3280
3261uemd MACH_UEMD UEMD 3281
3262ccwmx51mut MACH_CCWMX51MUT CCWMX51MUT 3282
3263rockhopper MACH_ROCKHOPPER ROCKHOPPER 3283
3264nookcolor MACH_NOOKCOLOR NOOKCOLOR 3284
3265hkdkc100 MACH_HKDKC100 HKDKC100 3285
3266ts42xx MACH_TS42XX TS42XX 3286
3267aebl MACH_AEBL AEBL 3287
3268wario MACH_WARIO WARIO 3288
3269gfs_spm MACH_GFS_SPM GFS_SPM 3289
3270cm_t3730 MACH_CM_T3730 CM_T3730 3290
3271isc3 MACH_ISC3 ISC3 3291
3272rascal MACH_RASCAL RASCAL 3292
3273hrefv60 MACH_HREFV60 HREFV60 3293
3274tpt_2_0 MACH_TPT_2_0 TPT_2_0 3294
3275pyramid_td MACH_PYRAMID_TD PYRAMID_TD 3295
3276splendor MACH_SPLENDOR SPLENDOR 3296
3277guf_planet MACH_GUF_PLANET GUF_PLANET 3297
3278msm8x60_qt MACH_MSM8X60_QT MSM8X60_QT 3298
3279htc_hd_mini MACH_HTC_HD_MINI HTC_HD_MINI 3299
3280athene MACH_ATHENE ATHENE 3300
3281deep_r_ek_1 MACH_DEEP_R_EK_1 DEEP_R_EK_1 3301
3282vivow_ct MACH_VIVOW_CT VIVOW_CT 3302
3283nery_1000 MACH_NERY_1000 NERY_1000 3303
3284rfl109145_ssrv MACH_RFL109145_SSRV RFL109145_SSRV 3304
3285nmh MACH_NMH NMH 3305
3286wn802t MACH_WN802T WN802T 3306
3287dragonet MACH_DRAGONET DRAGONET 3307
3288geneva_b MACH_GENEVA_B GENEVA_B 3308
3289at91sam9263desk16l MACH_AT91SAM9263DESK16L AT91SAM9263DESK16L 3309
3290bcmhana_sv MACH_BCMHANA_SV BCMHANA_SV 3310
3291bcmhana_tablet MACH_BCMHANA_TABLET BCMHANA_TABLET 3311
3292koi MACH_KOI KOI 3312
3293ts4800 MACH_TS4800 TS4800 3313
3294tqma9263 MACH_TQMA9263 TQMA9263 3314
3295holiday MACH_HOLIDAY HOLIDAY 3315
3296dma_6410 MACH_DMA6410 DMA6410 3316
3297pcats_overlay MACH_PCATS_OVERLAY PCATS_OVERLAY 3317
3298hwgw6410 MACH_HWGW6410 HWGW6410 3318
3299shenzhou MACH_SHENZHOU SHENZHOU 3319
3300cwme9210 MACH_CWME9210 CWME9210 3320
3301cwme9210js MACH_CWME9210JS CWME9210JS 3321
3302pgs_v1 MACH_PGS_SITARA PGS_SITARA 3322
3303colibri_tegra2 MACH_COLIBRI_TEGRA2 COLIBRI_TEGRA2 3323
3304w21 MACH_W21 W21 3324
3305polysat1 MACH_POLYSAT1 POLYSAT1 3325
3306dataway MACH_DATAWAY DATAWAY 3326
3307cobral138 MACH_COBRAL138 COBRAL138 3327
3308roverpcs8 MACH_ROVERPCS8 ROVERPCS8 3328
3309marvelc MACH_MARVELC MARVELC 3329
3310navefihid MACH_NAVEFIHID NAVEFIHID 3330
3311dm365_cv100 MACH_DM365_CV100 DM365_CV100 3331
3312able MACH_ABLE ABLE 3332
3313legacy MACH_LEGACY LEGACY 3333
3314icong MACH_ICONG ICONG 3334
3315rover_g8 MACH_ROVER_G8 ROVER_G8 3335
3316t5388p MACH_T5388P T5388P 3336
3317dingo MACH_DINGO DINGO 3337
3318goflexhome MACH_GOFLEXHOME GOFLEXHOME 3338
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 0797cb528b46..bbf3da012afd 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -153,7 +153,7 @@ static struct notifier_block vfp_notifier_block = {
153 * Raise a SIGFPE for the current process. 153 * Raise a SIGFPE for the current process.
154 * sicode describes the signal being raised. 154 * sicode describes the signal being raised.
155 */ 155 */
156void vfp_raise_sigfpe(unsigned int sicode, struct pt_regs *regs) 156static void vfp_raise_sigfpe(unsigned int sicode, struct pt_regs *regs)
157{ 157{
158 siginfo_t info; 158 siginfo_t info;
159 159
@@ -489,8 +489,11 @@ void vfp_flush_hwstate(struct thread_info *thread)
489 489
490/* 490/*
491 * VFP hardware can lose all context when a CPU goes offline. 491 * VFP hardware can lose all context when a CPU goes offline.
492 * Safely clear our held state when a CPU has been killed, and 492 * As we will be running in SMP mode with CPU hotplug, we will save the
493 * re-enable access to VFP when the CPU comes back online. 493 * hardware state at every thread switch. We clear our held state when
494 * a CPU has been killed, indicating that the VFP hardware doesn't contain
495 * a threads VFP state. When a CPU starts up, we re-enable access to the
496 * VFP hardware.
494 * 497 *
495 * Both CPU_DYING and CPU_STARTING are called on the CPU which 498 * Both CPU_DYING and CPU_STARTING are called on the CPU which
496 * is being offlined/onlined. 499 * is being offlined/onlined.
diff --git a/arch/blackfin/include/asm/bfin_serial.h b/arch/blackfin/include/asm/bfin_serial.h
index 1ff9f1468c02..7dbc664eab1e 100644
--- a/arch/blackfin/include/asm/bfin_serial.h
+++ b/arch/blackfin/include/asm/bfin_serial.h
@@ -10,6 +10,7 @@
10#define __BFIN_ASM_SERIAL_H__ 10#define __BFIN_ASM_SERIAL_H__
11 11
12#include <linux/serial_core.h> 12#include <linux/serial_core.h>
13#include <linux/spinlock.h>
13#include <mach/anomaly.h> 14#include <mach/anomaly.h>
14#include <mach/bfin_serial.h> 15#include <mach/bfin_serial.h>
15 16
@@ -41,6 +42,7 @@ struct bfin_serial_port {
41 struct circ_buf rx_dma_buf; 42 struct circ_buf rx_dma_buf;
42 struct timer_list rx_dma_timer; 43 struct timer_list rx_dma_timer;
43 int rx_dma_nrows; 44 int rx_dma_nrows;
45 spinlock_t rx_lock;
44 unsigned int tx_dma_channel; 46 unsigned int tx_dma_channel;
45 unsigned int rx_dma_channel; 47 unsigned int rx_dma_channel;
46 struct work_struct tx_dma_workqueue; 48 struct work_struct tx_dma_workqueue;
diff --git a/arch/blackfin/lib/outs.S b/arch/blackfin/lib/outs.S
index 250f4d4b9436..06a5e674401f 100644
--- a/arch/blackfin/lib/outs.S
+++ b/arch/blackfin/lib/outs.S
@@ -13,6 +13,8 @@
13.align 2 13.align 2
14 14
15ENTRY(_outsl) 15ENTRY(_outsl)
16 CC = R2 == 0;
17 IF CC JUMP 1f;
16 P0 = R0; /* P0 = port */ 18 P0 = R0; /* P0 = port */
17 P1 = R1; /* P1 = address */ 19 P1 = R1; /* P1 = address */
18 P2 = R2; /* P2 = count */ 20 P2 = R2; /* P2 = count */
@@ -20,10 +22,12 @@ ENTRY(_outsl)
20 LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2; 22 LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2;
21.Llong_loop_s: R0 = [P1++]; 23.Llong_loop_s: R0 = [P1++];
22.Llong_loop_e: [P0] = R0; 24.Llong_loop_e: [P0] = R0;
23 RTS; 251: RTS;
24ENDPROC(_outsl) 26ENDPROC(_outsl)
25 27
26ENTRY(_outsw) 28ENTRY(_outsw)
29 CC = R2 == 0;
30 IF CC JUMP 1f;
27 P0 = R0; /* P0 = port */ 31 P0 = R0; /* P0 = port */
28 P1 = R1; /* P1 = address */ 32 P1 = R1; /* P1 = address */
29 P2 = R2; /* P2 = count */ 33 P2 = R2; /* P2 = count */
@@ -31,10 +35,12 @@ ENTRY(_outsw)
31 LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2; 35 LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2;
32.Lword_loop_s: R0 = W[P1++]; 36.Lword_loop_s: R0 = W[P1++];
33.Lword_loop_e: W[P0] = R0; 37.Lword_loop_e: W[P0] = R0;
34 RTS; 381: RTS;
35ENDPROC(_outsw) 39ENDPROC(_outsw)
36 40
37ENTRY(_outsb) 41ENTRY(_outsb)
42 CC = R2 == 0;
43 IF CC JUMP 1f;
38 P0 = R0; /* P0 = port */ 44 P0 = R0; /* P0 = port */
39 P1 = R1; /* P1 = address */ 45 P1 = R1; /* P1 = address */
40 P2 = R2; /* P2 = count */ 46 P2 = R2; /* P2 = count */
@@ -42,10 +48,12 @@ ENTRY(_outsb)
42 LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2; 48 LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2;
43.Lbyte_loop_s: R0 = B[P1++]; 49.Lbyte_loop_s: R0 = B[P1++];
44.Lbyte_loop_e: B[P0] = R0; 50.Lbyte_loop_e: B[P0] = R0;
45 RTS; 511: RTS;
46ENDPROC(_outsb) 52ENDPROC(_outsb)
47 53
48ENTRY(_outsw_8) 54ENTRY(_outsw_8)
55 CC = R2 == 0;
56 IF CC JUMP 1f;
49 P0 = R0; /* P0 = port */ 57 P0 = R0; /* P0 = port */
50 P1 = R1; /* P1 = address */ 58 P1 = R1; /* P1 = address */
51 P2 = R2; /* P2 = count */ 59 P2 = R2; /* P2 = count */
@@ -56,5 +64,5 @@ ENTRY(_outsw_8)
56 R0 = R0 << 8; 64 R0 = R0 << 8;
57 R0 = R0 + R1; 65 R0 = R0 + R1;
58.Lword8_loop_e: W[P0] = R0; 66.Lword8_loop_e: W[P0] = R0;
59 RTS; 671: RTS;
60ENDPROC(_outsw_8) 68ENDPROC(_outsw_8)
diff --git a/arch/blackfin/mach-common/cache.S b/arch/blackfin/mach-common/cache.S
index 790c767ca95a..ab4a925a443e 100644
--- a/arch/blackfin/mach-common/cache.S
+++ b/arch/blackfin/mach-common/cache.S
@@ -58,6 +58,8 @@
581: 581:
59.ifeqs "\flushins", BROK_FLUSH_INST 59.ifeqs "\flushins", BROK_FLUSH_INST
60 \flushins [P0++]; 60 \flushins [P0++];
61 nop;
62 nop;
612: nop; 632: nop;
62.else 64.else
632: \flushins [P0++]; 652: \flushins [P0++];
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S
index 442218980db0..c49be845f96a 100644
--- a/arch/cris/kernel/vmlinux.lds.S
+++ b/arch/cris/kernel/vmlinux.lds.S
@@ -72,11 +72,6 @@ SECTIONS
72 INIT_TEXT_SECTION(PAGE_SIZE) 72 INIT_TEXT_SECTION(PAGE_SIZE)
73 .init.data : { INIT_DATA } 73 .init.data : { INIT_DATA }
74 .init.setup : { INIT_SETUP(16) } 74 .init.setup : { INIT_SETUP(16) }
75#ifdef CONFIG_ETRAX_ARCH_V32
76 __start___param = .;
77 __param : { *(__param) }
78 __stop___param = .;
79#endif
80 .initcall.init : { 75 .initcall.init : {
81 INIT_CALLS 76 INIT_CALLS
82 } 77 }
diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c
index f745c1287f3a..76eaf3883fbd 100644
--- a/arch/m32r/kernel/irq.c
+++ b/arch/m32r/kernel/irq.c
@@ -80,7 +80,7 @@ asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs)
80#ifdef CONFIG_DEBUG_STACKOVERFLOW 80#ifdef CONFIG_DEBUG_STACKOVERFLOW
81 /* FIXME M32R */ 81 /* FIXME M32R */
82#endif 82#endif
83 __do_IRQ(irq); 83 generic_handle_irq(irq);
84 irq_exit(); 84 irq_exit();
85 set_irq_regs(old_regs); 85 set_irq_regs(old_regs);
86 86
diff --git a/arch/m68k/include/asm/string.h b/arch/m68k/include/asm/string.h
index 65b131282837..32198454da70 100644
--- a/arch/m68k/include/asm/string.h
+++ b/arch/m68k/include/asm/string.h
@@ -99,14 +99,12 @@ static inline int strcmp(const char *cs, const char *ct)
99 : "+a" (cs), "+a" (ct), "=d" (res)); 99 : "+a" (cs), "+a" (ct), "=d" (res));
100 return res; 100 return res;
101} 101}
102#endif /* CONFIG_COLDFIRE */
102 103
103#define __HAVE_ARCH_MEMMOVE 104#define __HAVE_ARCH_MEMMOVE
104extern void *memmove(void *, const void *, __kernel_size_t); 105extern void *memmove(void *, const void *, __kernel_size_t);
105 106
106#define __HAVE_ARCH_MEMCMP
107extern int memcmp(const void *, const void *, __kernel_size_t);
108#define memcmp(d, s, n) __builtin_memcmp(d, s, n) 107#define memcmp(d, s, n) __builtin_memcmp(d, s, n)
109#endif /* CONFIG_COLDFIRE */
110 108
111#define __HAVE_ARCH_MEMSET 109#define __HAVE_ARCH_MEMSET
112extern void *memset(void *, int, __kernel_size_t); 110extern void *memset(void *, int, __kernel_size_t);
diff --git a/arch/m68k/lib/string.c b/arch/m68k/lib/string.c
index 4253f870e54f..d399c5f25636 100644
--- a/arch/m68k/lib/string.c
+++ b/arch/m68k/lib/string.c
@@ -243,14 +243,3 @@ void *memmove(void *dest, const void *src, size_t n)
243 return xdest; 243 return xdest;
244} 244}
245EXPORT_SYMBOL(memmove); 245EXPORT_SYMBOL(memmove);
246
247int memcmp(const void *cs, const void *ct, size_t count)
248{
249 const unsigned char *su1, *su2;
250
251 for (su1 = cs, su2 = ct; count > 0; ++su1, ++su2, count--)
252 if (*su1 != *su2)
253 return *su1 < *su2 ? -1 : +1;
254 return 0;
255}
256EXPORT_SYMBOL(memcmp);
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index ef332136f96d..47e15ebfd893 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -141,6 +141,12 @@ SECTIONS {
141 *(__param) 141 *(__param)
142 __stop___param = .; 142 __stop___param = .;
143 143
144 /* Built-in module versions */
145 . = ALIGN(4) ;
146 __start___modver = .;
147 *(__modver)
148 __stop___modver = .;
149
144 . = ALIGN(4) ; 150 . = ALIGN(4) ;
145 _etext = . ; 151 _etext = . ;
146 } > TEXT 152 } > TEXT
diff --git a/arch/m68knommu/lib/Makefile b/arch/m68knommu/lib/Makefile
index d94d709665aa..32d852e586d7 100644
--- a/arch/m68knommu/lib/Makefile
+++ b/arch/m68knommu/lib/Makefile
@@ -4,4 +4,4 @@
4 4
5lib-y := ashldi3.o ashrdi3.o lshrdi3.o \ 5lib-y := ashldi3.o ashrdi3.o lshrdi3.o \
6 muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \ 6 muldi3.o mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o \
7 checksum.o memcpy.o memset.o delay.o 7 checksum.o memcpy.o memmove.o memset.o delay.o
diff --git a/arch/m68knommu/lib/memmove.c b/arch/m68knommu/lib/memmove.c
new file mode 100644
index 000000000000..b3dcfe9dab7e
--- /dev/null
+++ b/arch/m68knommu/lib/memmove.c
@@ -0,0 +1,105 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
4 * for more details.
5 */
6
7#define __IN_STRING_C
8
9#include <linux/module.h>
10#include <linux/string.h>
11
12void *memmove(void *dest, const void *src, size_t n)
13{
14 void *xdest = dest;
15 size_t temp;
16
17 if (!n)
18 return xdest;
19
20 if (dest < src) {
21 if ((long)dest & 1) {
22 char *cdest = dest;
23 const char *csrc = src;
24 *cdest++ = *csrc++;
25 dest = cdest;
26 src = csrc;
27 n--;
28 }
29 if (n > 2 && (long)dest & 2) {
30 short *sdest = dest;
31 const short *ssrc = src;
32 *sdest++ = *ssrc++;
33 dest = sdest;
34 src = ssrc;
35 n -= 2;
36 }
37 temp = n >> 2;
38 if (temp) {
39 long *ldest = dest;
40 const long *lsrc = src;
41 temp--;
42 do
43 *ldest++ = *lsrc++;
44 while (temp--);
45 dest = ldest;
46 src = lsrc;
47 }
48 if (n & 2) {
49 short *sdest = dest;
50 const short *ssrc = src;
51 *sdest++ = *ssrc++;
52 dest = sdest;
53 src = ssrc;
54 }
55 if (n & 1) {
56 char *cdest = dest;
57 const char *csrc = src;
58 *cdest = *csrc;
59 }
60 } else {
61 dest = (char *)dest + n;
62 src = (const char *)src + n;
63 if ((long)dest & 1) {
64 char *cdest = dest;
65 const char *csrc = src;
66 *--cdest = *--csrc;
67 dest = cdest;
68 src = csrc;
69 n--;
70 }
71 if (n > 2 && (long)dest & 2) {
72 short *sdest = dest;
73 const short *ssrc = src;
74 *--sdest = *--ssrc;
75 dest = sdest;
76 src = ssrc;
77 n -= 2;
78 }
79 temp = n >> 2;
80 if (temp) {
81 long *ldest = dest;
82 const long *lsrc = src;
83 temp--;
84 do
85 *--ldest = *--lsrc;
86 while (temp--);
87 dest = ldest;
88 src = lsrc;
89 }
90 if (n & 2) {
91 short *sdest = dest;
92 const short *ssrc = src;
93 *--sdest = *--ssrc;
94 dest = sdest;
95 src = ssrc;
96 }
97 if (n & 1) {
98 char *cdest = dest;
99 const char *csrc = src;
100 *--cdest = *--csrc;
101 }
102 }
103 return xdest;
104}
105EXPORT_SYMBOL(memmove);
diff --git a/arch/m68knommu/platform/5249/intc2.c b/arch/m68knommu/platform/5249/intc2.c
index d09d9da04537..c5151f846591 100644
--- a/arch/m68knommu/platform/5249/intc2.c
+++ b/arch/m68knommu/platform/5249/intc2.c
@@ -50,8 +50,10 @@ static int __init mcf_intc2_init(void)
50 int irq; 50 int irq;
51 51
52 /* GPIO interrupt sources */ 52 /* GPIO interrupt sources */
53 for (irq = MCFINTC2_GPIOIRQ0; (irq <= MCFINTC2_GPIOIRQ7); irq++) 53 for (irq = MCFINTC2_GPIOIRQ0; (irq <= MCFINTC2_GPIOIRQ7); irq++) {
54 irq_desc[irq].chip = &intc2_irq_gpio_chip; 54 irq_desc[irq].chip = &intc2_irq_gpio_chip;
55 set_irq_handler(irq, handle_edge_irq);
56 }
55 57
56 return 0; 58 return 0;
57} 59}
diff --git a/arch/m68knommu/platform/68328/entry.S b/arch/m68knommu/platform/68328/entry.S
index 240a7a6e25c8..676960cf022a 100644
--- a/arch/m68knommu/platform/68328/entry.S
+++ b/arch/m68knommu/platform/68328/entry.S
@@ -108,7 +108,6 @@ Luser_return:
108 movel %d1,%a2 108 movel %d1,%a2
1091: 1091:
110 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */ 110 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
111 andl #_TIF_WORK_MASK,%d1
112 jne Lwork_to_do 111 jne Lwork_to_do
113 RESTORE_ALL 112 RESTORE_ALL
114 113
diff --git a/arch/m68knommu/platform/68360/commproc.c b/arch/m68knommu/platform/68360/commproc.c
index f27e688c404e..8e4e10cc0080 100644
--- a/arch/m68knommu/platform/68360/commproc.c
+++ b/arch/m68knommu/platform/68360/commproc.c
@@ -210,7 +210,7 @@ void
210cpm_install_handler(int vec, void (*handler)(), void *dev_id) 210cpm_install_handler(int vec, void (*handler)(), void *dev_id)
211{ 211{
212 212
213 request_irq(vec, handler, IRQ_FLG_LOCK, "timer", dev_id); 213 request_irq(vec, handler, 0, "timer", dev_id);
214 214
215/* if (cpm_vecs[vec].handler != 0) */ 215/* if (cpm_vecs[vec].handler != 0) */
216/* printk(KERN_INFO "CPM interrupt %x replacing %x\n", */ 216/* printk(KERN_INFO "CPM interrupt %x replacing %x\n", */
diff --git a/arch/m68knommu/platform/68360/config.c b/arch/m68knommu/platform/68360/config.c
index ac629fa30099..9dd5bca38749 100644
--- a/arch/m68knommu/platform/68360/config.c
+++ b/arch/m68knommu/platform/68360/config.c
@@ -75,7 +75,7 @@ void hw_timer_init(void)
75 /* Set compare register 32Khz / 32 / 10 = 100 */ 75 /* Set compare register 32Khz / 32 / 10 = 100 */
76 TCMP = 10; 76 TCMP = 10;
77 77
78 request_irq(IRQ_MACHSPEC | 1, timer_routine, IRQ_FLG_LOCK, "timer", NULL); 78 request_irq(IRQ_MACHSPEC | 1, timer_routine, 0, "timer", NULL);
79#endif 79#endif
80 80
81 /* General purpose quicc timers: MC68360UM p7-20 */ 81 /* General purpose quicc timers: MC68360UM p7-20 */
diff --git a/arch/m68knommu/platform/68360/entry.S b/arch/m68knommu/platform/68360/entry.S
index 8a28788c0eea..46c1b18c9dcb 100644
--- a/arch/m68knommu/platform/68360/entry.S
+++ b/arch/m68knommu/platform/68360/entry.S
@@ -104,7 +104,6 @@ Luser_return:
104 movel %d1,%a2 104 movel %d1,%a2
1051: 1051:
106 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */ 106 move %a2@(TI_FLAGS),%d1 /* thread_info->flags */
107 andl #_TIF_WORK_MASK,%d1
108 jne Lwork_to_do 107 jne Lwork_to_do
109 RESTORE_ALL 108 RESTORE_ALL
110 109
diff --git a/arch/m68knommu/platform/68360/ints.c b/arch/m68knommu/platform/68360/ints.c
index ad96ab1051f0..a29041c1a8a0 100644
--- a/arch/m68knommu/platform/68360/ints.c
+++ b/arch/m68knommu/platform/68360/ints.c
@@ -132,8 +132,8 @@ void init_IRQ(void)
132 pquicc->intr_cimr = 0x00000000; 132 pquicc->intr_cimr = 0x00000000;
133 133
134 for (i = 0; (i < NR_IRQS); i++) { 134 for (i = 0; (i < NR_IRQS); i++) {
135 set_irq_chip(irq, &intc_irq_chip); 135 set_irq_chip(i, &intc_irq_chip);
136 set_irq_handler(irq, handle_level_irq); 136 set_irq_handler(i, handle_level_irq);
137 } 137 }
138} 138}
139 139
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S
index 4ddfc3da70d8..5837cf080b6d 100644
--- a/arch/m68knommu/platform/coldfire/entry.S
+++ b/arch/m68knommu/platform/coldfire/entry.S
@@ -138,7 +138,6 @@ Luser_return:
138 andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ 138 andl #-THREAD_SIZE,%d1 /* at base of kernel stack */
139 movel %d1,%a0 139 movel %d1,%a0
140 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ 140 movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */
141 andl #0xefff,%d1
142 jne Lwork_to_do /* still work to do */ 141 jne Lwork_to_do /* still work to do */
143 142
144Lreturn: 143Lreturn:
diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h
index 5fd31905775d..c4532f032b3b 100644
--- a/arch/microblaze/include/asm/irqflags.h
+++ b/arch/microblaze/include/asm/irqflags.h
@@ -12,7 +12,7 @@
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/registers.h> 13#include <asm/registers.h>
14 14
15#ifdef CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 15#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
16 16
17static inline unsigned long arch_local_irq_save(void) 17static inline unsigned long arch_local_irq_save(void)
18{ 18{
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index b23f68075879..885574a73f01 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -411,20 +411,19 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
411static inline unsigned long pte_update(pte_t *p, unsigned long clr, 411static inline unsigned long pte_update(pte_t *p, unsigned long clr,
412 unsigned long set) 412 unsigned long set)
413{ 413{
414 unsigned long old, tmp, msr; 414 unsigned long flags, old, tmp;
415 415
416 __asm__ __volatile__("\ 416 raw_local_irq_save(flags);
417 msrclr %2, 0x2\n\ 417
418 nop\n\ 418 __asm__ __volatile__( "lw %0, %2, r0 \n"
419 lw %0, %4, r0\n\ 419 "andn %1, %0, %3 \n"
420 andn %1, %0, %5\n\ 420 "or %1, %1, %4 \n"
421 or %1, %1, %6\n\ 421 "sw %1, %2, r0 \n"
422 sw %1, %4, r0\n\ 422 : "=&r" (old), "=&r" (tmp)
423 mts rmsr, %2\n\ 423 : "r" ((unsigned long)(p + 1) - 4), "r" (clr), "r" (set)
424 nop" 424 : "cc");
425 : "=&r" (old), "=&r" (tmp), "=&r" (msr), "=m" (*p) 425
426 : "r" ((unsigned long)(p + 1) - 4), "r" (clr), "r" (set), "m" (*p) 426 raw_local_irq_restore(flags);
427 : "cc");
428 427
429 return old; 428 return old;
430} 429}
diff --git a/arch/microblaze/kernel/cpu/pvr.c b/arch/microblaze/kernel/cpu/pvr.c
index e01afa68273e..488c1ed24e38 100644
--- a/arch/microblaze/kernel/cpu/pvr.c
+++ b/arch/microblaze/kernel/cpu/pvr.c
@@ -27,7 +27,7 @@
27 register unsigned tmp __asm__("r3"); \ 27 register unsigned tmp __asm__("r3"); \
28 tmp = 0x0; /* Prevent warning about unused */ \ 28 tmp = 0x0; /* Prevent warning about unused */ \
29 __asm__ __volatile__ ( \ 29 __asm__ __volatile__ ( \
30 "mfs %0, rpvr" #pvrid ";" \ 30 "mfs %0, rpvr" #pvrid ";" \
31 : "=r" (tmp) : : "memory"); \ 31 : "=r" (tmp) : : "memory"); \
32 val = tmp; \ 32 val = tmp; \
33} 33}
@@ -54,7 +54,7 @@ int cpu_has_pvr(void)
54 if (!(flags & PVR_MSR_BIT)) 54 if (!(flags & PVR_MSR_BIT))
55 return 0; 55 return 0;
56 56
57 get_single_pvr(0x00, pvr0); 57 get_single_pvr(0, pvr0);
58 pr_debug("%s: pvr0 is 0x%08x\n", __func__, pvr0); 58 pr_debug("%s: pvr0 is 0x%08x\n", __func__, pvr0);
59 59
60 if (pvr0 & PVR0_PVR_FULL_MASK) 60 if (pvr0 & PVR0_PVR_FULL_MASK)
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 42434008209e..778a5ce2e4fc 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -62,23 +62,32 @@ real_start:
62 andi r1, r1, ~2 62 andi r1, r1, ~2
63 mts rmsr, r1 63 mts rmsr, r1
64/* 64/*
65 * Here is checking mechanism which check if Microblaze has msr instructions 65 * According to Xilinx, msrclr instruction behaves like 'mfs rX,rpc'
66 * We load msr and compare it with previous r1 value - if is the same, 66 * if the msrclr instruction is not enabled. We use this to detect
67 * msr instructions works if not - cpu don't have them. 67 * if the opcode is available, by issuing msrclr and then testing the result.
68 * r8 == 0 - msr instructions are implemented
69 * r8 != 0 - msr instructions are not implemented
68 */ 70 */
69 /* r8=0 - I have msr instr, 1 - I don't have them */ 71 msrclr r8, 0 /* clear nothing - just read msr for test */
70 rsubi r0, r0, 1 /* set the carry bit */ 72 cmpu r8, r8, r1 /* r1 must contain msr reg content */
71 msrclr r0, 0x4 /* try to clear it */
72 /* read the carry bit, r8 will be '0' if msrclr exists */
73 addik r8, r0, 0
74 73
75/* r7 may point to an FDT, or there may be one linked in. 74/* r7 may point to an FDT, or there may be one linked in.
76 if it's in r7, we've got to save it away ASAP. 75 if it's in r7, we've got to save it away ASAP.
77 We ensure r7 points to a valid FDT, just in case the bootloader 76 We ensure r7 points to a valid FDT, just in case the bootloader
78 is broken or non-existent */ 77 is broken or non-existent */
79 beqi r7, no_fdt_arg /* NULL pointer? don't copy */ 78 beqi r7, no_fdt_arg /* NULL pointer? don't copy */
80 lw r11, r0, r7 /* Does r7 point to a */ 79/* Does r7 point to a valid FDT? Load HEADER magic number */
81 rsubi r11, r11, OF_DT_HEADER /* valid FDT? */ 80 /* Run time Big/Little endian platform */
81 /* Save 1 as word and load byte - 0 - BIG, 1 - LITTLE */
82 addik r11, r0, 0x1 /* BIG/LITTLE checking value */
83 /* __bss_start will be zeroed later - it is just temp location */
84 swi r11, r0, TOPHYS(__bss_start)
85 lbui r11, r0, TOPHYS(__bss_start)
86 beqid r11, big_endian /* DO NOT break delay stop dependency */
87 lw r11, r0, r7 /* Big endian load in delay slot */
88 lwr r11, r0, r7 /* Little endian load */
89big_endian:
90 rsubi r11, r11, OF_DT_HEADER /* Check FDT header */
82 beqi r11, _prepare_copy_fdt 91 beqi r11, _prepare_copy_fdt
83 or r7, r0, r0 /* clear R7 when not valid DTB */ 92 or r7, r0, r0 /* clear R7 when not valid DTB */
84 bnei r11, no_fdt_arg /* No - get out of here */ 93 bnei r11, no_fdt_arg /* No - get out of here */
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index 25f6e07d8de8..782680de3121 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -147,10 +147,6 @@
147 #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0 147 #if CONFIG_XILINX_MICROBLAZE0_USE_BARREL > 0
148 #define BSRLI(rD, rA, imm) \ 148 #define BSRLI(rD, rA, imm) \
149 bsrli rD, rA, imm 149 bsrli rD, rA, imm
150 #elif CONFIG_XILINX_MICROBLAZE0_USE_DIV > 0
151 #define BSRLI(rD, rA, imm) \
152 ori rD, r0, (1 << imm); \
153 idivu rD, rD, rA
154 #else 150 #else
155 #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA) 151 #define BSRLI(rD, rA, imm) BSRLI ## imm (rD, rA)
156 /* Only the used shift constants defined here - add more if needed */ 152 /* Only the used shift constants defined here - add more if needed */
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index bb1558e4b283..9312fbb37efd 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -161,11 +161,11 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
161#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 161#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
162 if (msr) 162 if (msr)
163 eprintk("!!!Your kernel has setup MSR instruction but " 163 eprintk("!!!Your kernel has setup MSR instruction but "
164 "CPU don't have it %d\n", msr); 164 "CPU don't have it %x\n", msr);
165#else 165#else
166 if (!msr) 166 if (!msr)
167 eprintk("!!!Your kernel not setup MSR instruction but " 167 eprintk("!!!Your kernel not setup MSR instruction but "
168 "CPU have it %d\n", msr); 168 "CPU have it %x\n", msr);
169#endif 169#endif
170 170
171 for (src = __ivt_start; src < __ivt_end; src++, dst++) 171 for (src = __ivt_start; src < __ivt_end; src++, dst++)
diff --git a/arch/microblaze/lib/fastcopy.S b/arch/microblaze/lib/fastcopy.S
index fdc48bb065d8..62021d7e249e 100644
--- a/arch/microblaze/lib/fastcopy.S
+++ b/arch/microblaze/lib/fastcopy.S
@@ -29,6 +29,10 @@
29 * between mem locations with size of xfer spec'd in bytes 29 * between mem locations with size of xfer spec'd in bytes
30 */ 30 */
31 31
32#ifdef __MICROBLAZEEL__
33#error Microblaze LE not support ASM optimized lib func. Disable OPT_LIB_ASM.
34#endif
35
32#include <linux/linkage.h> 36#include <linux/linkage.h>
33 .text 37 .text
34 .globl memcpy 38 .globl memcpy
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 991d5998d6be..fe56a23e1ff0 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -240,6 +240,12 @@ struct machdep_calls {
240 * claims to support kexec. 240 * claims to support kexec.
241 */ 241 */
242 int (*machine_kexec_prepare)(struct kimage *image); 242 int (*machine_kexec_prepare)(struct kimage *image);
243
244 /* Called to perform the _real_ kexec.
245 * Do NOT allocate memory or fail here. We are past the point of
246 * no return.
247 */
248 void (*machine_kexec)(struct kimage *image);
243#endif /* CONFIG_KEXEC */ 249#endif /* CONFIG_KEXEC */
244 250
245#ifdef CONFIG_SUSPEND 251#ifdef CONFIG_SUSPEND
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index 8eaed81ea642..17194fcd4040 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -40,8 +40,8 @@
40 40
41/* MAS registers bit definitions */ 41/* MAS registers bit definitions */
42 42
43#define MAS0_TLBSEL(x) ((x << 28) & 0x30000000) 43#define MAS0_TLBSEL(x) (((x) << 28) & 0x30000000)
44#define MAS0_ESEL(x) ((x << 16) & 0x0FFF0000) 44#define MAS0_ESEL(x) (((x) << 16) & 0x0FFF0000)
45#define MAS0_NV(x) ((x) & 0x00000FFF) 45#define MAS0_NV(x) ((x) & 0x00000FFF)
46#define MAS0_HES 0x00004000 46#define MAS0_HES 0x00004000
47#define MAS0_WQ_ALLWAYS 0x00000000 47#define MAS0_WQ_ALLWAYS 0x00000000
@@ -50,12 +50,12 @@
50 50
51#define MAS1_VALID 0x80000000 51#define MAS1_VALID 0x80000000
52#define MAS1_IPROT 0x40000000 52#define MAS1_IPROT 0x40000000
53#define MAS1_TID(x) ((x << 16) & 0x3FFF0000) 53#define MAS1_TID(x) (((x) << 16) & 0x3FFF0000)
54#define MAS1_IND 0x00002000 54#define MAS1_IND 0x00002000
55#define MAS1_TS 0x00001000 55#define MAS1_TS 0x00001000
56#define MAS1_TSIZE_MASK 0x00000f80 56#define MAS1_TSIZE_MASK 0x00000f80
57#define MAS1_TSIZE_SHIFT 7 57#define MAS1_TSIZE_SHIFT 7
58#define MAS1_TSIZE(x) ((x << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK) 58#define MAS1_TSIZE(x) (((x) << MAS1_TSIZE_SHIFT) & MAS1_TSIZE_MASK)
59 59
60#define MAS2_EPN 0xFFFFF000 60#define MAS2_EPN 0xFFFFF000
61#define MAS2_X0 0x00000040 61#define MAS2_X0 0x00000040
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index 53b64be40eb2..da4b20008541 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -101,7 +101,7 @@ extern phys_addr_t kernstart_addr;
101 101
102#ifdef CONFIG_FLATMEM 102#ifdef CONFIG_FLATMEM
103#define ARCH_PFN_OFFSET (MEMORY_START >> PAGE_SHIFT) 103#define ARCH_PFN_OFFSET (MEMORY_START >> PAGE_SHIFT)
104#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < (ARCH_PFN_OFFSET + max_mapnr)) 104#define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)
105#endif 105#endif
106 106
107#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 107#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
diff --git a/arch/powerpc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 55cba4a8a959..f8cd9fba4d35 100644
--- a/arch/powerpc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
@@ -18,7 +18,7 @@
18#include <asm/mmu.h> 18#include <asm/mmu.h>
19 19
20_GLOBAL(__setup_cpu_603) 20_GLOBAL(__setup_cpu_603)
21 mflr r4 21 mflr r5
22BEGIN_MMU_FTR_SECTION 22BEGIN_MMU_FTR_SECTION
23 li r10,0 23 li r10,0
24 mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */ 24 mtspr SPRN_SPRG_603_LRU,r10 /* init SW LRU tracking */
@@ -27,60 +27,60 @@ BEGIN_FTR_SECTION
27 bl __init_fpu_registers 27 bl __init_fpu_registers
28END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE) 28END_FTR_SECTION_IFCLR(CPU_FTR_FPU_UNAVAILABLE)
29 bl setup_common_caches 29 bl setup_common_caches
30 mtlr r4 30 mtlr r5
31 blr 31 blr
32_GLOBAL(__setup_cpu_604) 32_GLOBAL(__setup_cpu_604)
33 mflr r4 33 mflr r5
34 bl setup_common_caches 34 bl setup_common_caches
35 bl setup_604_hid0 35 bl setup_604_hid0
36 mtlr r4 36 mtlr r5
37 blr 37 blr
38_GLOBAL(__setup_cpu_750) 38_GLOBAL(__setup_cpu_750)
39 mflr r4 39 mflr r5
40 bl __init_fpu_registers 40 bl __init_fpu_registers
41 bl setup_common_caches 41 bl setup_common_caches
42 bl setup_750_7400_hid0 42 bl setup_750_7400_hid0
43 mtlr r4 43 mtlr r5
44 blr 44 blr
45_GLOBAL(__setup_cpu_750cx) 45_GLOBAL(__setup_cpu_750cx)
46 mflr r4 46 mflr r5
47 bl __init_fpu_registers 47 bl __init_fpu_registers
48 bl setup_common_caches 48 bl setup_common_caches
49 bl setup_750_7400_hid0 49 bl setup_750_7400_hid0
50 bl setup_750cx 50 bl setup_750cx
51 mtlr r4 51 mtlr r5
52 blr 52 blr
53_GLOBAL(__setup_cpu_750fx) 53_GLOBAL(__setup_cpu_750fx)
54 mflr r4 54 mflr r5
55 bl __init_fpu_registers 55 bl __init_fpu_registers
56 bl setup_common_caches 56 bl setup_common_caches
57 bl setup_750_7400_hid0 57 bl setup_750_7400_hid0
58 bl setup_750fx 58 bl setup_750fx
59 mtlr r4 59 mtlr r5
60 blr 60 blr
61_GLOBAL(__setup_cpu_7400) 61_GLOBAL(__setup_cpu_7400)
62 mflr r4 62 mflr r5
63 bl __init_fpu_registers 63 bl __init_fpu_registers
64 bl setup_7400_workarounds 64 bl setup_7400_workarounds
65 bl setup_common_caches 65 bl setup_common_caches
66 bl setup_750_7400_hid0 66 bl setup_750_7400_hid0
67 mtlr r4 67 mtlr r5
68 blr 68 blr
69_GLOBAL(__setup_cpu_7410) 69_GLOBAL(__setup_cpu_7410)
70 mflr r4 70 mflr r5
71 bl __init_fpu_registers 71 bl __init_fpu_registers
72 bl setup_7410_workarounds 72 bl setup_7410_workarounds
73 bl setup_common_caches 73 bl setup_common_caches
74 bl setup_750_7400_hid0 74 bl setup_750_7400_hid0
75 li r3,0 75 li r3,0
76 mtspr SPRN_L2CR2,r3 76 mtspr SPRN_L2CR2,r3
77 mtlr r4 77 mtlr r5
78 blr 78 blr
79_GLOBAL(__setup_cpu_745x) 79_GLOBAL(__setup_cpu_745x)
80 mflr r4 80 mflr r5
81 bl setup_common_caches 81 bl setup_common_caches
82 bl setup_745x_specifics 82 bl setup_745x_specifics
83 mtlr r4 83 mtlr r5
84 blr 84 blr
85 85
86/* Enable caches for 603's, 604, 750 & 7400 */ 86/* Enable caches for 603's, 604, 750 & 7400 */
@@ -194,10 +194,10 @@ setup_750cx:
194 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq 194 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq
195 cror 4*cr0+eq,4*cr0+eq,4*cr2+eq 195 cror 4*cr0+eq,4*cr0+eq,4*cr2+eq
196 bnelr 196 bnelr
197 lwz r6,CPU_SPEC_FEATURES(r5) 197 lwz r6,CPU_SPEC_FEATURES(r4)
198 li r7,CPU_FTR_CAN_NAP 198 li r7,CPU_FTR_CAN_NAP
199 andc r6,r6,r7 199 andc r6,r6,r7
200 stw r6,CPU_SPEC_FEATURES(r5) 200 stw r6,CPU_SPEC_FEATURES(r4)
201 blr 201 blr
202 202
203/* 750fx specific 203/* 750fx specific
@@ -225,12 +225,12 @@ BEGIN_FTR_SECTION
225 andis. r11,r11,L3CR_L3E@h 225 andis. r11,r11,L3CR_L3E@h
226 beq 1f 226 beq 1f
227END_FTR_SECTION_IFSET(CPU_FTR_L3CR) 227END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
228 lwz r6,CPU_SPEC_FEATURES(r5) 228 lwz r6,CPU_SPEC_FEATURES(r4)
229 andi. r0,r6,CPU_FTR_L3_DISABLE_NAP 229 andi. r0,r6,CPU_FTR_L3_DISABLE_NAP
230 beq 1f 230 beq 1f
231 li r7,CPU_FTR_CAN_NAP 231 li r7,CPU_FTR_CAN_NAP
232 andc r6,r6,r7 232 andc r6,r6,r7
233 stw r6,CPU_SPEC_FEATURES(r5) 233 stw r6,CPU_SPEC_FEATURES(r4)
2341: 2341:
235 mfspr r11,SPRN_HID0 235 mfspr r11,SPRN_HID0
236 236
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 8d74a24c5502..e8e915ce3d8d 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2076,8 +2076,8 @@ static void __init setup_cpu_spec(unsigned long offset, struct cpu_spec *s)
2076 * pointer on ppc64 and booke as we are running at 0 in real mode 2076 * pointer on ppc64 and booke as we are running at 0 in real mode
2077 * on ppc64 and reloc_offset is always 0 on booke. 2077 * on ppc64 and reloc_offset is always 0 on booke.
2078 */ 2078 */
2079 if (s->cpu_setup) { 2079 if (t->cpu_setup) {
2080 s->cpu_setup(offset, s); 2080 t->cpu_setup(offset, t);
2081 } 2081 }
2082#endif /* CONFIG_PPC64 || CONFIG_BOOKE */ 2082#endif /* CONFIG_PPC64 || CONFIG_BOOKE */
2083} 2083}
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 49a170af8145..a5f8672eeff3 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -87,7 +87,10 @@ void machine_kexec(struct kimage *image)
87 87
88 save_ftrace_enabled = __ftrace_enabled_save(); 88 save_ftrace_enabled = __ftrace_enabled_save();
89 89
90 default_machine_kexec(image); 90 if (ppc_md.machine_kexec)
91 ppc_md.machine_kexec(image);
92 else
93 default_machine_kexec(image);
91 94
92 __ftrace_enabled_restore(save_ftrace_enabled); 95 __ftrace_enabled_restore(save_ftrace_enabled);
93 96
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 7a1d5cb76932..8303a6c65ef7 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -353,6 +353,7 @@ static void switch_booke_debug_regs(struct thread_struct *new_thread)
353 prime_debug_regs(new_thread); 353 prime_debug_regs(new_thread);
354} 354}
355#else /* !CONFIG_PPC_ADV_DEBUG_REGS */ 355#else /* !CONFIG_PPC_ADV_DEBUG_REGS */
356#ifndef CONFIG_HAVE_HW_BREAKPOINT
356static void set_debug_reg_defaults(struct thread_struct *thread) 357static void set_debug_reg_defaults(struct thread_struct *thread)
357{ 358{
358 if (thread->dabr) { 359 if (thread->dabr) {
@@ -360,6 +361,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread)
360 set_dabr(0); 361 set_dabr(0);
361 } 362 }
362} 363}
364#endif /* !CONFIG_HAVE_HW_BREAKPOINT */
363#endif /* CONFIG_PPC_ADV_DEBUG_REGS */ 365#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
364 366
365int set_dabr(unsigned long dabr) 367int set_dabr(unsigned long dabr)
@@ -670,11 +672,11 @@ void flush_thread(void)
670{ 672{
671 discard_lazy_cpu_state(); 673 discard_lazy_cpu_state();
672 674
673#ifdef CONFIG_HAVE_HW_BREAKPOINTS 675#ifdef CONFIG_HAVE_HW_BREAKPOINT
674 flush_ptrace_hw_breakpoint(current); 676 flush_ptrace_hw_breakpoint(current);
675#else /* CONFIG_HAVE_HW_BREAKPOINTS */ 677#else /* CONFIG_HAVE_HW_BREAKPOINT */
676 set_debug_reg_defaults(&current->thread); 678 set_debug_reg_defaults(&current->thread);
677#endif /* CONFIG_HAVE_HW_BREAKPOINTS */ 679#endif /* CONFIG_HAVE_HW_BREAKPOINT */
678} 680}
679 681
680void 682void
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index bf5cb91f07de..fd4812329570 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -186,7 +186,7 @@ static void unmap_cpu_from_node(unsigned long cpu)
186 dbg("removing cpu %lu from node %d\n", cpu, node); 186 dbg("removing cpu %lu from node %d\n", cpu, node);
187 187
188 if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) { 188 if (cpumask_test_cpu(cpu, node_to_cpumask_map[node])) {
189 cpumask_set_cpu(cpu, node_to_cpumask_map[node]); 189 cpumask_clear_cpu(cpu, node_to_cpumask_map[node]);
190 } else { 190 } else {
191 printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n", 191 printk(KERN_ERR "WARNING: cpu %lu not found in node %d\n",
192 cpu, node); 192 cpu, node);
@@ -1289,10 +1289,9 @@ u64 memory_hotplug_max(void)
1289} 1289}
1290#endif /* CONFIG_MEMORY_HOTPLUG */ 1290#endif /* CONFIG_MEMORY_HOTPLUG */
1291 1291
1292/* Vrtual Processor Home Node (VPHN) support */ 1292/* Virtual Processor Home Node (VPHN) support */
1293#ifdef CONFIG_PPC_SPLPAR 1293#ifdef CONFIG_PPC_SPLPAR
1294#define VPHN_NR_CHANGE_CTRS (8) 1294static u8 vphn_cpu_change_counts[NR_CPUS][MAX_DISTANCE_REF_POINTS];
1295static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
1296static cpumask_t cpu_associativity_changes_mask; 1295static cpumask_t cpu_associativity_changes_mask;
1297static int vphn_enabled; 1296static int vphn_enabled;
1298static void set_topology_timer(void); 1297static void set_topology_timer(void);
@@ -1303,16 +1302,18 @@ static void set_topology_timer(void);
1303 */ 1302 */
1304static void setup_cpu_associativity_change_counters(void) 1303static void setup_cpu_associativity_change_counters(void)
1305{ 1304{
1306 int cpu = 0; 1305 int cpu;
1306
1307 /* The VPHN feature supports a maximum of 8 reference points */
1308 BUILD_BUG_ON(MAX_DISTANCE_REF_POINTS > 8);
1307 1309
1308 for_each_possible_cpu(cpu) { 1310 for_each_possible_cpu(cpu) {
1309 int i = 0; 1311 int i;
1310 u8 *counts = vphn_cpu_change_counts[cpu]; 1312 u8 *counts = vphn_cpu_change_counts[cpu];
1311 volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; 1313 volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
1312 1314
1313 for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) { 1315 for (i = 0; i < distance_ref_points_depth; i++)
1314 counts[i] = hypervisor_counts[i]; 1316 counts[i] = hypervisor_counts[i];
1315 }
1316 } 1317 }
1317} 1318}
1318 1319
@@ -1329,7 +1330,7 @@ static void setup_cpu_associativity_change_counters(void)
1329 */ 1330 */
1330static int update_cpu_associativity_changes_mask(void) 1331static int update_cpu_associativity_changes_mask(void)
1331{ 1332{
1332 int cpu = 0, nr_cpus = 0; 1333 int cpu, nr_cpus = 0;
1333 cpumask_t *changes = &cpu_associativity_changes_mask; 1334 cpumask_t *changes = &cpu_associativity_changes_mask;
1334 1335
1335 cpumask_clear(changes); 1336 cpumask_clear(changes);
@@ -1339,8 +1340,8 @@ static int update_cpu_associativity_changes_mask(void)
1339 u8 *counts = vphn_cpu_change_counts[cpu]; 1340 u8 *counts = vphn_cpu_change_counts[cpu];
1340 volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts; 1341 volatile u8 *hypervisor_counts = lppaca[cpu].vphn_assoc_counts;
1341 1342
1342 for (i = 0; i < VPHN_NR_CHANGE_CTRS; i++) { 1343 for (i = 0; i < distance_ref_points_depth; i++) {
1343 if (hypervisor_counts[i] > counts[i]) { 1344 if (hypervisor_counts[i] != counts[i]) {
1344 counts[i] = hypervisor_counts[i]; 1345 counts[i] = hypervisor_counts[i];
1345 changed = 1; 1346 changed = 1;
1346 } 1347 }
@@ -1354,8 +1355,11 @@ static int update_cpu_associativity_changes_mask(void)
1354 return nr_cpus; 1355 return nr_cpus;
1355} 1356}
1356 1357
1357/* 6 64-bit registers unpacked into 12 32-bit associativity values */ 1358/*
1358#define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32)) 1359 * 6 64-bit registers unpacked into 12 32-bit associativity values. To form
1360 * the complete property we have to add the length in the first cell.
1361 */
1362#define VPHN_ASSOC_BUFSIZE (6*sizeof(u64)/sizeof(u32) + 1)
1359 1363
1360/* 1364/*
1361 * Convert the associativity domain numbers returned from the hypervisor 1365 * Convert the associativity domain numbers returned from the hypervisor
@@ -1363,15 +1367,14 @@ static int update_cpu_associativity_changes_mask(void)
1363 */ 1367 */
1364static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked) 1368static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
1365{ 1369{
1366 int i = 0; 1370 int i, nr_assoc_doms = 0;
1367 int nr_assoc_doms = 0;
1368 const u16 *field = (const u16*) packed; 1371 const u16 *field = (const u16*) packed;
1369 1372
1370#define VPHN_FIELD_UNUSED (0xffff) 1373#define VPHN_FIELD_UNUSED (0xffff)
1371#define VPHN_FIELD_MSB (0x8000) 1374#define VPHN_FIELD_MSB (0x8000)
1372#define VPHN_FIELD_MASK (~VPHN_FIELD_MSB) 1375#define VPHN_FIELD_MASK (~VPHN_FIELD_MSB)
1373 1376
1374 for (i = 0; i < VPHN_ASSOC_BUFSIZE; i++) { 1377 for (i = 1; i < VPHN_ASSOC_BUFSIZE; i++) {
1375 if (*field == VPHN_FIELD_UNUSED) { 1378 if (*field == VPHN_FIELD_UNUSED) {
1376 /* All significant fields processed, and remaining 1379 /* All significant fields processed, and remaining
1377 * fields contain the reserved value of all 1's. 1380 * fields contain the reserved value of all 1's.
@@ -1379,14 +1382,12 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
1379 */ 1382 */
1380 unpacked[i] = *((u32*)field); 1383 unpacked[i] = *((u32*)field);
1381 field += 2; 1384 field += 2;
1382 } 1385 } else if (*field & VPHN_FIELD_MSB) {
1383 else if (*field & VPHN_FIELD_MSB) {
1384 /* Data is in the lower 15 bits of this field */ 1386 /* Data is in the lower 15 bits of this field */
1385 unpacked[i] = *field & VPHN_FIELD_MASK; 1387 unpacked[i] = *field & VPHN_FIELD_MASK;
1386 field++; 1388 field++;
1387 nr_assoc_doms++; 1389 nr_assoc_doms++;
1388 } 1390 } else {
1389 else {
1390 /* Data is in the lower 15 bits of this field 1391 /* Data is in the lower 15 bits of this field
1391 * concatenated with the next 16 bit field 1392 * concatenated with the next 16 bit field
1392 */ 1393 */
@@ -1396,6 +1397,9 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
1396 } 1397 }
1397 } 1398 }
1398 1399
1400 /* The first cell contains the length of the property */
1401 unpacked[0] = nr_assoc_doms;
1402
1399 return nr_assoc_doms; 1403 return nr_assoc_doms;
1400} 1404}
1401 1405
@@ -1405,7 +1409,7 @@ static int vphn_unpack_associativity(const long *packed, unsigned int *unpacked)
1405 */ 1409 */
1406static long hcall_vphn(unsigned long cpu, unsigned int *associativity) 1410static long hcall_vphn(unsigned long cpu, unsigned int *associativity)
1407{ 1411{
1408 long rc = 0; 1412 long rc;
1409 long retbuf[PLPAR_HCALL9_BUFSIZE] = {0}; 1413 long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
1410 u64 flags = 1; 1414 u64 flags = 1;
1411 int hwcpu = get_hard_smp_processor_id(cpu); 1415 int hwcpu = get_hard_smp_processor_id(cpu);
@@ -1419,7 +1423,7 @@ static long hcall_vphn(unsigned long cpu, unsigned int *associativity)
1419static long vphn_get_associativity(unsigned long cpu, 1423static long vphn_get_associativity(unsigned long cpu,
1420 unsigned int *associativity) 1424 unsigned int *associativity)
1421{ 1425{
1422 long rc = 0; 1426 long rc;
1423 1427
1424 rc = hcall_vphn(cpu, associativity); 1428 rc = hcall_vphn(cpu, associativity);
1425 1429
@@ -1445,9 +1449,9 @@ static long vphn_get_associativity(unsigned long cpu,
1445 */ 1449 */
1446int arch_update_cpu_topology(void) 1450int arch_update_cpu_topology(void)
1447{ 1451{
1448 int cpu = 0, nid = 0, old_nid = 0; 1452 int cpu, nid, old_nid;
1449 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; 1453 unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
1450 struct sys_device *sysdev = NULL; 1454 struct sys_device *sysdev;
1451 1455
1452 for_each_cpu_mask(cpu, cpu_associativity_changes_mask) { 1456 for_each_cpu_mask(cpu, cpu_associativity_changes_mask) {
1453 vphn_get_associativity(cpu, associativity); 1457 vphn_get_associativity(cpu, associativity);
@@ -1512,7 +1516,8 @@ int start_topology_update(void)
1512{ 1516{
1513 int rc = 0; 1517 int rc = 0;
1514 1518
1515 if (firmware_has_feature(FW_FEATURE_VPHN)) { 1519 if (firmware_has_feature(FW_FEATURE_VPHN) &&
1520 get_lppaca()->shared_proc) {
1516 vphn_enabled = 1; 1521 vphn_enabled = 1;
1517 setup_cpu_associativity_change_counters(); 1522 setup_cpu_associativity_change_counters();
1518 init_timer_deferrable(&topology_timer); 1523 init_timer_deferrable(&topology_timer);
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 1ec06576f619..c14d09f614f3 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -38,13 +38,11 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch);
38 * neesd to be flushed. This function will either perform the flush 38 * neesd to be flushed. This function will either perform the flush
39 * immediately or will batch it up if the current CPU has an active 39 * immediately or will batch it up if the current CPU has an active
40 * batch on it. 40 * batch on it.
41 *
42 * Must be called from within some kind of spinlock/non-preempt region...
43 */ 41 */
44void hpte_need_flush(struct mm_struct *mm, unsigned long addr, 42void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
45 pte_t *ptep, unsigned long pte, int huge) 43 pte_t *ptep, unsigned long pte, int huge)
46{ 44{
47 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 45 struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch);
48 unsigned long vsid, vaddr; 46 unsigned long vsid, vaddr;
49 unsigned int psize; 47 unsigned int psize;
50 int ssize; 48 int ssize;
@@ -99,6 +97,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
99 */ 97 */
100 if (!batch->active) { 98 if (!batch->active) {
101 flush_hash_page(vaddr, rpte, psize, ssize, 0); 99 flush_hash_page(vaddr, rpte, psize, ssize, 0);
100 put_cpu_var(ppc64_tlb_batch);
102 return; 101 return;
103 } 102 }
104 103
@@ -127,6 +126,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
127 batch->index = ++i; 126 batch->index = ++i;
128 if (i >= PPC64_TLB_BATCH_NR) 127 if (i >= PPC64_TLB_BATCH_NR)
129 __flush_tlb_pending(batch); 128 __flush_tlb_pending(batch);
129 put_cpu_var(ppc64_tlb_batch);
130} 130}
131 131
132/* 132/*
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 5d3ea9f60dd7..ca5d5898d320 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -713,6 +713,13 @@ EXPORT_SYMBOL(arch_free_page);
713/* NB: reg/unreg are called while guarded with the tracepoints_mutex */ 713/* NB: reg/unreg are called while guarded with the tracepoints_mutex */
714extern long hcall_tracepoint_refcount; 714extern long hcall_tracepoint_refcount;
715 715
716/*
717 * Since the tracing code might execute hcalls we need to guard against
718 * recursion. One example of this are spinlocks calling H_YIELD on
719 * shared processor partitions.
720 */
721static DEFINE_PER_CPU(unsigned int, hcall_trace_depth);
722
716void hcall_tracepoint_regfunc(void) 723void hcall_tracepoint_regfunc(void)
717{ 724{
718 hcall_tracepoint_refcount++; 725 hcall_tracepoint_refcount++;
@@ -725,12 +732,42 @@ void hcall_tracepoint_unregfunc(void)
725 732
726void __trace_hcall_entry(unsigned long opcode, unsigned long *args) 733void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
727{ 734{
735 unsigned long flags;
736 unsigned int *depth;
737
738 local_irq_save(flags);
739
740 depth = &__get_cpu_var(hcall_trace_depth);
741
742 if (*depth)
743 goto out;
744
745 (*depth)++;
728 trace_hcall_entry(opcode, args); 746 trace_hcall_entry(opcode, args);
747 (*depth)--;
748
749out:
750 local_irq_restore(flags);
729} 751}
730 752
731void __trace_hcall_exit(long opcode, unsigned long retval, 753void __trace_hcall_exit(long opcode, unsigned long retval,
732 unsigned long *retbuf) 754 unsigned long *retbuf)
733{ 755{
756 unsigned long flags;
757 unsigned int *depth;
758
759 local_irq_save(flags);
760
761 depth = &__get_cpu_var(hcall_trace_depth);
762
763 if (*depth)
764 goto out;
765
766 (*depth)++;
734 trace_hcall_exit(opcode, retval, retbuf); 767 trace_hcall_exit(opcode, retval, retbuf);
768 (*depth)--;
769
770out:
771 local_irq_restore(flags);
735} 772}
736#endif 773#endif
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ff19efdf6fef..636bcb81d068 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -406,7 +406,7 @@ config QDIO
406 If unsure, say Y. 406 If unsure, say Y.
407 407
408config CHSC_SCH 408config CHSC_SCH
409 def_tristate y 409 def_tristate m
410 prompt "Support for CHSC subchannels" 410 prompt "Support for CHSC subchannels"
411 help 411 help
412 This driver allows usage of CHSC subchannels. A CHSC subchannel 412 This driver allows usage of CHSC subchannels. A CHSC subchannel
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c
index 0851eb1e919e..2751b3a8a66f 100644
--- a/arch/s390/boot/compressed/misc.c
+++ b/arch/s390/boot/compressed/misc.c
@@ -133,11 +133,12 @@ unsigned long decompress_kernel(void)
133 unsigned long output_addr; 133 unsigned long output_addr;
134 unsigned char *output; 134 unsigned char *output;
135 135
136 check_ipl_parmblock((void *) 0, (unsigned long) output + SZ__bss_start); 136 output_addr = ((unsigned long) &_end + HEAP_SIZE + 4095UL) & -4096UL;
137 check_ipl_parmblock((void *) 0, output_addr + SZ__bss_start);
137 memset(&_bss, 0, &_ebss - &_bss); 138 memset(&_bss, 0, &_ebss - &_bss);
138 free_mem_ptr = (unsigned long)&_end; 139 free_mem_ptr = (unsigned long)&_end;
139 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; 140 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
140 output = (unsigned char *) ((free_mem_end_ptr + 4095UL) & -4096UL); 141 output = (unsigned char *) output_addr;
141 142
142#ifdef CONFIG_BLK_DEV_INITRD 143#ifdef CONFIG_BLK_DEV_INITRD
143 /* 144 /*
diff --git a/arch/s390/crypto/sha_common.c b/arch/s390/crypto/sha_common.c
index f42dbabc0d30..48884f89ab92 100644
--- a/arch/s390/crypto/sha_common.c
+++ b/arch/s390/crypto/sha_common.c
@@ -38,6 +38,7 @@ int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len)
38 BUG_ON(ret != bsize); 38 BUG_ON(ret != bsize);
39 data += bsize - index; 39 data += bsize - index;
40 len -= bsize - index; 40 len -= bsize - index;
41 index = 0;
41 } 42 }
42 43
43 /* process as many blocks as possible */ 44 /* process as many blocks as possible */
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index 76daea117181..5c5ba10384c2 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -36,14 +36,19 @@
36 36
37static inline int atomic_read(const atomic_t *v) 37static inline int atomic_read(const atomic_t *v)
38{ 38{
39 barrier(); 39 int c;
40 return v->counter; 40
41 asm volatile(
42 " l %0,%1\n"
43 : "=d" (c) : "Q" (v->counter));
44 return c;
41} 45}
42 46
43static inline void atomic_set(atomic_t *v, int i) 47static inline void atomic_set(atomic_t *v, int i)
44{ 48{
45 v->counter = i; 49 asm volatile(
46 barrier(); 50 " st %1,%0\n"
51 : "=Q" (v->counter) : "d" (i));
47} 52}
48 53
49static inline int atomic_add_return(int i, atomic_t *v) 54static inline int atomic_add_return(int i, atomic_t *v)
@@ -128,14 +133,19 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
128 133
129static inline long long atomic64_read(const atomic64_t *v) 134static inline long long atomic64_read(const atomic64_t *v)
130{ 135{
131 barrier(); 136 long long c;
132 return v->counter; 137
138 asm volatile(
139 " lg %0,%1\n"
140 : "=d" (c) : "Q" (v->counter));
141 return c;
133} 142}
134 143
135static inline void atomic64_set(atomic64_t *v, long long i) 144static inline void atomic64_set(atomic64_t *v, long long i)
136{ 145{
137 v->counter = i; 146 asm volatile(
138 barrier(); 147 " stg %1,%0\n"
148 : "=Q" (v->counter) : "d" (i));
139} 149}
140 150
141static inline long long atomic64_add_return(long long i, atomic64_t *v) 151static inline long long atomic64_add_return(long long i, atomic64_t *v)
diff --git a/arch/s390/include/asm/cache.h b/arch/s390/include/asm/cache.h
index 24aafa68b643..2a30d5ac0667 100644
--- a/arch/s390/include/asm/cache.h
+++ b/arch/s390/include/asm/cache.h
@@ -13,6 +13,7 @@
13 13
14#define L1_CACHE_BYTES 256 14#define L1_CACHE_BYTES 256
15#define L1_CACHE_SHIFT 8 15#define L1_CACHE_SHIFT 8
16#define NET_SKB_PAD 32
16 17
17#define __read_mostly __attribute__((__section__(".data..read_mostly"))) 18#define __read_mostly __attribute__((__section__(".data..read_mostly")))
18 19
diff --git a/arch/s390/include/asm/cacheflush.h b/arch/s390/include/asm/cacheflush.h
index 405cc97c6249..7e1f77620624 100644
--- a/arch/s390/include/asm/cacheflush.h
+++ b/arch/s390/include/asm/cacheflush.h
@@ -1,29 +1,8 @@
1#ifndef _S390_CACHEFLUSH_H 1#ifndef _S390_CACHEFLUSH_H
2#define _S390_CACHEFLUSH_H 2#define _S390_CACHEFLUSH_H
3 3
4/* Keep includes the same across arches. */
5#include <linux/mm.h>
6
7/* Caches aren't brain-dead on the s390. */ 4/* Caches aren't brain-dead on the s390. */
8#define flush_cache_all() do { } while (0) 5#include <asm-generic/cacheflush.h>
9#define flush_cache_mm(mm) do { } while (0)
10#define flush_cache_dup_mm(mm) do { } while (0)
11#define flush_cache_range(vma, start, end) do { } while (0)
12#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
13#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
14#define flush_dcache_page(page) do { } while (0)
15#define flush_dcache_mmap_lock(mapping) do { } while (0)
16#define flush_dcache_mmap_unlock(mapping) do { } while (0)
17#define flush_icache_range(start, end) do { } while (0)
18#define flush_icache_page(vma,pg) do { } while (0)
19#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
20#define flush_cache_vmap(start, end) do { } while (0)
21#define flush_cache_vunmap(start, end) do { } while (0)
22
23#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
24 memcpy(dst, src, len)
25#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
26 memcpy(dst, src, len)
27 6
28#ifdef CONFIG_DEBUG_PAGEALLOC 7#ifdef CONFIG_DEBUG_PAGEALLOC
29void kernel_map_pages(struct page *page, int numpages, int enable); 8void kernel_map_pages(struct page *page, int numpages, int enable);
diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/processor.h
index bf3de04170a7..2c79b6416271 100644
--- a/arch/s390/include/asm/processor.h
+++ b/arch/s390/include/asm/processor.h
@@ -148,11 +148,6 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
148 */ 148 */
149extern unsigned long thread_saved_pc(struct task_struct *t); 149extern unsigned long thread_saved_pc(struct task_struct *t);
150 150
151/*
152 * Print register of task into buffer. Used in fs/proc/array.c.
153 */
154extern void task_show_regs(struct seq_file *m, struct task_struct *task);
155
156extern void show_code(struct pt_regs *regs); 151extern void show_code(struct pt_regs *regs);
157 152
158unsigned long get_wchan(struct task_struct *p); 153unsigned long get_wchan(struct task_struct *p);
diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h
index f1f644f2240a..9074a54c4d10 100644
--- a/arch/s390/include/asm/tlb.h
+++ b/arch/s390/include/asm/tlb.h
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/mm.h> 24#include <linux/mm.h>
25#include <linux/pagemap.h>
25#include <linux/swap.h> 26#include <linux/swap.h>
26#include <asm/processor.h> 27#include <asm/processor.h>
27#include <asm/pgalloc.h> 28#include <asm/pgalloc.h>
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index 5eb78dd584ce..b5a4a739b477 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -237,43 +237,6 @@ void show_regs(struct pt_regs *regs)
237 show_last_breaking_event(regs); 237 show_last_breaking_event(regs);
238} 238}
239 239
240/* This is called from fs/proc/array.c */
241void task_show_regs(struct seq_file *m, struct task_struct *task)
242{
243 struct pt_regs *regs;
244
245 regs = task_pt_regs(task);
246 seq_printf(m, "task: %p, ksp: %p\n",
247 task, (void *)task->thread.ksp);
248 seq_printf(m, "User PSW : %p %p\n",
249 (void *) regs->psw.mask, (void *)regs->psw.addr);
250
251 seq_printf(m, "User GPRS: " FOURLONG,
252 regs->gprs[0], regs->gprs[1],
253 regs->gprs[2], regs->gprs[3]);
254 seq_printf(m, " " FOURLONG,
255 regs->gprs[4], regs->gprs[5],
256 regs->gprs[6], regs->gprs[7]);
257 seq_printf(m, " " FOURLONG,
258 regs->gprs[8], regs->gprs[9],
259 regs->gprs[10], regs->gprs[11]);
260 seq_printf(m, " " FOURLONG,
261 regs->gprs[12], regs->gprs[13],
262 regs->gprs[14], regs->gprs[15]);
263 seq_printf(m, "User ACRS: %08x %08x %08x %08x\n",
264 task->thread.acrs[0], task->thread.acrs[1],
265 task->thread.acrs[2], task->thread.acrs[3]);
266 seq_printf(m, " %08x %08x %08x %08x\n",
267 task->thread.acrs[4], task->thread.acrs[5],
268 task->thread.acrs[6], task->thread.acrs[7]);
269 seq_printf(m, " %08x %08x %08x %08x\n",
270 task->thread.acrs[8], task->thread.acrs[9],
271 task->thread.acrs[10], task->thread.acrs[11]);
272 seq_printf(m, " %08x %08x %08x %08x\n",
273 task->thread.acrs[12], task->thread.acrs[13],
274 task->thread.acrs[14], task->thread.acrs[15]);
275}
276
277static DEFINE_SPINLOCK(die_lock); 240static DEFINE_SPINLOCK(die_lock);
278 241
279void die(const char * str, struct pt_regs * regs, long err) 242void die(const char * str, struct pt_regs * regs, long err)
diff --git a/arch/s390/lib/uaccess_std.c b/arch/s390/lib/uaccess_std.c
index 07deaeee14c8..a6c4f7ed24a4 100644
--- a/arch/s390/lib/uaccess_std.c
+++ b/arch/s390/lib/uaccess_std.c
@@ -125,9 +125,9 @@ static size_t copy_in_user_std(size_t size, void __user *to,
125 unsigned long tmp1; 125 unsigned long tmp1;
126 126
127 asm volatile( 127 asm volatile(
128 " sacf 256\n"
128 " "AHI" %0,-1\n" 129 " "AHI" %0,-1\n"
129 " jo 5f\n" 130 " jo 5f\n"
130 " sacf 256\n"
131 " bras %3,3f\n" 131 " bras %3,3f\n"
132 "0:"AHI" %0,257\n" 132 "0:"AHI" %0,257\n"
133 "1: mvc 0(1,%1),0(%2)\n" 133 "1: mvc 0(1,%1),0(%2)\n"
@@ -142,9 +142,8 @@ static size_t copy_in_user_std(size_t size, void __user *to,
142 "3:"AHI" %0,-256\n" 142 "3:"AHI" %0,-256\n"
143 " jnm 2b\n" 143 " jnm 2b\n"
144 "4: ex %0,1b-0b(%3)\n" 144 "4: ex %0,1b-0b(%3)\n"
145 " sacf 0\n"
146 "5: "SLR" %0,%0\n" 145 "5: "SLR" %0,%0\n"
147 "6:\n" 146 "6: sacf 0\n"
148 EX_TABLE(1b,6b) EX_TABLE(2b,0b) EX_TABLE(4b,0b) 147 EX_TABLE(1b,6b) EX_TABLE(2b,0b) EX_TABLE(4b,0b)
149 : "+a" (size), "+a" (to), "+a" (from), "=a" (tmp1) 148 : "+a" (size), "+a" (to), "+a" (from), "=a" (tmp1)
150 : : "cc", "memory"); 149 : : "cc", "memory");
@@ -156,9 +155,9 @@ static size_t clear_user_std(size_t size, void __user *to)
156 unsigned long tmp1, tmp2; 155 unsigned long tmp1, tmp2;
157 156
158 asm volatile( 157 asm volatile(
158 " sacf 256\n"
159 " "AHI" %0,-1\n" 159 " "AHI" %0,-1\n"
160 " jo 5f\n" 160 " jo 5f\n"
161 " sacf 256\n"
162 " bras %3,3f\n" 161 " bras %3,3f\n"
163 " xc 0(1,%1),0(%1)\n" 162 " xc 0(1,%1),0(%1)\n"
164 "0:"AHI" %0,257\n" 163 "0:"AHI" %0,257\n"
@@ -178,9 +177,8 @@ static size_t clear_user_std(size_t size, void __user *to)
178 "3:"AHI" %0,-256\n" 177 "3:"AHI" %0,-256\n"
179 " jnm 2b\n" 178 " jnm 2b\n"
180 "4: ex %0,0(%3)\n" 179 "4: ex %0,0(%3)\n"
181 " sacf 0\n"
182 "5: "SLR" %0,%0\n" 180 "5: "SLR" %0,%0\n"
183 "6:\n" 181 "6: sacf 0\n"
184 EX_TABLE(1b,6b) EX_TABLE(2b,0b) EX_TABLE(4b,0b) 182 EX_TABLE(1b,6b) EX_TABLE(2b,0b) EX_TABLE(4b,0b)
185 : "+a" (size), "+a" (to), "=a" (tmp1), "=a" (tmp2) 183 : "+a" (size), "+a" (to), "=a" (tmp1), "=a" (tmp2)
186 : : "cc", "memory"); 184 : : "cc", "memory");
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 0c719c61972e..e1850c28cd68 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -336,7 +336,8 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
336 page->flags ^= bits; 336 page->flags ^= bits;
337 if (page->flags & FRAG_MASK) { 337 if (page->flags & FRAG_MASK) {
338 /* Page now has some free pgtable fragments. */ 338 /* Page now has some free pgtable fragments. */
339 list_move(&page->lru, &mm->context.pgtable_list); 339 if (!list_empty(&page->lru))
340 list_move(&page->lru, &mm->context.pgtable_list);
340 page = NULL; 341 page = NULL;
341 } else 342 } else
342 /* All fragments of the 4K page have been freed. */ 343 /* All fragments of the 4K page have been freed. */
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h
index a78701da775b..4a5350037c8f 100644
--- a/arch/sh/include/asm/sections.h
+++ b/arch/sh/include/asm/sections.h
@@ -3,7 +3,7 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern void __nosave_begin, __nosave_end; 6extern long __nosave_begin, __nosave_end;
7extern long __machvec_start, __machvec_end; 7extern long __machvec_start, __machvec_end;
8extern char __uncached_start, __uncached_end; 8extern char __uncached_start, __uncached_end;
9extern char _ebss[]; 9extern char _ebss[];
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
index 672944f5b19c..e53b4b38bd11 100644
--- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c
+++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c
@@ -14,7 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/sh_timer.h> 15#include <linux/sh_timer.h>
16#include <linux/serial_sci.h> 16#include <linux/serial_sci.h>
17#include <asm/machtypes.h> 17#include <generated/machtypes.h>
18 18
19static struct resource rtc_resources[] = { 19static struct resource rtc_resources[] = {
20 [0] = { 20 [0] = {
@@ -255,12 +255,17 @@ static struct platform_device *sh7750_early_devices[] __initdata = {
255 255
256void __init plat_early_device_setup(void) 256void __init plat_early_device_setup(void)
257{ 257{
258 struct platform_device *dev[1];
259
258 if (mach_is_rts7751r2d()) { 260 if (mach_is_rts7751r2d()) {
259 scif_platform_data.scscr |= SCSCR_CKE1; 261 scif_platform_data.scscr |= SCSCR_CKE1;
260 early_platform_add_devices(&scif_device, 1); 262 dev[0] = &scif_device;
263 early_platform_add_devices(dev, 1);
261 } else { 264 } else {
262 early_platform_add_devices(&sci_device, 1); 265 dev[0] = &sci_device;
263 early_platform_add_devices(&scif_device, 1); 266 early_platform_add_devices(dev, 1);
267 dev[0] = &scif_device;
268 early_platform_add_devices(dev, 1);
264 } 269 }
265 270
266 early_platform_add_devices(sh7750_early_devices, 271 early_platform_add_devices(sh7750_early_devices,
diff --git a/arch/sh/lib/delay.c b/arch/sh/lib/delay.c
index faa8f86c0db4..0901b2f14e15 100644
--- a/arch/sh/lib/delay.c
+++ b/arch/sh/lib/delay.c
@@ -10,6 +10,16 @@
10void __delay(unsigned long loops) 10void __delay(unsigned long loops)
11{ 11{
12 __asm__ __volatile__( 12 __asm__ __volatile__(
13 /*
14 * ST40-300 appears to have an issue with this code,
15 * normally taking two cycles each loop, as with all
16 * other SH variants. If however the branch and the
17 * delay slot straddle an 8 byte boundary, this increases
18 * to 3 cycles.
19 * This align directive ensures this doesn't occur.
20 */
21 ".balign 8\n\t"
22
13 "tst %0, %0\n\t" 23 "tst %0, %0\n\t"
14 "1:\t" 24 "1:\t"
15 "bf/s 1b\n\t" 25 "bf/s 1b\n\t"
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 88d3dc3d30d5..5a580ea04429 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -108,7 +108,8 @@ void copy_user_highpage(struct page *to, struct page *from,
108 kunmap_atomic(vfrom, KM_USER0); 108 kunmap_atomic(vfrom, KM_USER0);
109 } 109 }
110 110
111 if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK)) 111 if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK) ||
112 (vma->vm_flags & VM_EXEC))
112 __flush_purge_region(vto, PAGE_SIZE); 113 __flush_purge_region(vto, PAGE_SIZE);
113 114
114 kunmap_atomic(vto, KM_USER1); 115 kunmap_atomic(vto, KM_USER1);
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h
index a2f5c61f924e..843e4faf6a50 100644
--- a/arch/sparc/include/asm/pcr.h
+++ b/arch/sparc/include/asm/pcr.h
@@ -43,4 +43,6 @@ static inline u64 picl_value(unsigned int nmi_hz)
43 43
44extern u64 pcr_enable; 44extern u64 pcr_enable;
45 45
46extern int pcr_arch_init(void);
47
46#endif /* __PCR_H */ 48#endif /* __PCR_H */
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 47977a77f6c6..72509d0e34be 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -255,10 +255,9 @@ static inline iopte_t *alloc_npages(struct device *dev, struct iommu *iommu,
255static int iommu_alloc_ctx(struct iommu *iommu) 255static int iommu_alloc_ctx(struct iommu *iommu)
256{ 256{
257 int lowest = iommu->ctx_lowest_free; 257 int lowest = iommu->ctx_lowest_free;
258 int sz = IOMMU_NUM_CTXS - lowest; 258 int n = find_next_zero_bit(iommu->ctx_bitmap, IOMMU_NUM_CTXS, lowest);
259 int n = find_next_zero_bit(iommu->ctx_bitmap, sz, lowest);
260 259
261 if (unlikely(n == sz)) { 260 if (unlikely(n == IOMMU_NUM_CTXS)) {
262 n = find_next_zero_bit(iommu->ctx_bitmap, lowest, 1); 261 n = find_next_zero_bit(iommu->ctx_bitmap, lowest, 1);
263 if (unlikely(n == lowest)) { 262 if (unlikely(n == lowest)) {
264 printk(KERN_WARNING "IOMMU: Ran out of contexts.\n"); 263 printk(KERN_WARNING "IOMMU: Ran out of contexts.\n");
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
index ae96cf52a955..7c2ced612b8f 100644
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -167,5 +167,3 @@ out_unregister:
167 unregister_perf_hsvc(); 167 unregister_perf_hsvc();
168 return err; 168 return err;
169} 169}
170
171early_initcall(pcr_arch_init);
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index b6a2b8f47040..555a76d1f4a1 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -49,6 +49,7 @@
49#include <asm/mdesc.h> 49#include <asm/mdesc.h>
50#include <asm/ldc.h> 50#include <asm/ldc.h>
51#include <asm/hypervisor.h> 51#include <asm/hypervisor.h>
52#include <asm/pcr.h>
52 53
53#include "cpumap.h" 54#include "cpumap.h"
54 55
@@ -1358,6 +1359,7 @@ void __cpu_die(unsigned int cpu)
1358 1359
1359void __init smp_cpus_done(unsigned int max_cpus) 1360void __init smp_cpus_done(unsigned int max_cpus)
1360{ 1361{
1362 pcr_arch_init();
1361} 1363}
1362 1364
1363void smp_send_reschedule(int cpu) 1365void smp_send_reschedule(int cpu)
diff --git a/arch/sparc/kernel/una_asm_32.S b/arch/sparc/kernel/una_asm_32.S
index 8cc03458eb7e..8f096e84a937 100644
--- a/arch/sparc/kernel/una_asm_32.S
+++ b/arch/sparc/kernel/una_asm_32.S
@@ -24,9 +24,9 @@ retl_efault:
24 .globl __do_int_store 24 .globl __do_int_store
25__do_int_store: 25__do_int_store:
26 ld [%o2], %g1 26 ld [%o2], %g1
27 cmp %1, 2 27 cmp %o1, 2
28 be 2f 28 be 2f
29 cmp %1, 4 29 cmp %o1, 4
30 be 1f 30 be 1f
31 srl %g1, 24, %g2 31 srl %g1, 24, %g2
32 srl %g1, 16, %g7 32 srl %g1, 16, %g7
diff --git a/arch/sparc/lib/bitext.c b/arch/sparc/lib/bitext.c
index 764b3eb7b604..48d00e72ce15 100644
--- a/arch/sparc/lib/bitext.c
+++ b/arch/sparc/lib/bitext.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/bitops.h> 13#include <linux/bitmap.h>
14 14
15#include <asm/bitext.h> 15#include <asm/bitext.h>
16 16
@@ -80,8 +80,7 @@ int bit_map_string_get(struct bit_map *t, int len, int align)
80 while (test_bit(offset + i, t->map) == 0) { 80 while (test_bit(offset + i, t->map) == 0) {
81 i++; 81 i++;
82 if (i == len) { 82 if (i == len) {
83 for (i = 0; i < len; i++) 83 bitmap_set(t->map, offset, len);
84 __set_bit(offset + i, t->map);
85 if (offset == t->first_free) 84 if (offset == t->first_free)
86 t->first_free = find_next_zero_bit 85 t->first_free = find_next_zero_bit
87 (t->map, t->size, 86 (t->map, t->size,
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 211ca3f7fd16..4ea15ca89b2b 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -88,6 +88,7 @@ extern int acpi_disabled;
88extern int acpi_pci_disabled; 88extern int acpi_pci_disabled;
89extern int acpi_skip_timer_override; 89extern int acpi_skip_timer_override;
90extern int acpi_use_timer_override; 90extern int acpi_use_timer_override;
91extern int acpi_fix_pin2_polarity;
91 92
92extern u8 acpi_sci_flags; 93extern u8 acpi_sci_flags;
93extern int acpi_sci_override_gsi; 94extern int acpi_sci_override_gsi;
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 5e3969c36d7f..3c896946f4cc 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -233,6 +233,7 @@ extern void sync_Arb_IDs(void);
233extern void init_bsp_APIC(void); 233extern void init_bsp_APIC(void);
234extern void setup_local_APIC(void); 234extern void setup_local_APIC(void);
235extern void end_local_APIC_setup(void); 235extern void end_local_APIC_setup(void);
236extern void bsp_end_local_APIC_setup(void);
236extern void init_apic_mappings(void); 237extern void init_apic_mappings(void);
237void register_lapic_address(unsigned long address); 238void register_lapic_address(unsigned long address);
238extern void setup_boot_APIC_clock(void); 239extern void setup_boot_APIC_clock(void);
diff --git a/arch/x86/include/asm/cpu.h b/arch/x86/include/asm/cpu.h
index 6e6e7558e702..4564c8e28a33 100644
--- a/arch/x86/include/asm/cpu.h
+++ b/arch/x86/include/asm/cpu.h
@@ -32,6 +32,6 @@ extern void arch_unregister_cpu(int);
32 32
33DECLARE_PER_CPU(int, cpu_state); 33DECLARE_PER_CPU(int, cpu_state);
34 34
35int __cpuinit mwait_usable(const struct cpuinfo_x86 *); 35int mwait_usable(const struct cpuinfo_x86 *);
36 36
37#endif /* _ASM_X86_CPU_H */ 37#endif /* _ASM_X86_CPU_H */
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
index 4a2d4e0c18d9..8b5393ec1080 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -36,8 +36,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
36 unsigned cpu = smp_processor_id(); 36 unsigned cpu = smp_processor_id();
37 37
38 if (likely(prev != next)) { 38 if (likely(prev != next)) {
39 /* stop flush ipis for the previous mm */
40 cpumask_clear_cpu(cpu, mm_cpumask(prev));
41#ifdef CONFIG_SMP 39#ifdef CONFIG_SMP
42 percpu_write(cpu_tlbstate.state, TLBSTATE_OK); 40 percpu_write(cpu_tlbstate.state, TLBSTATE_OK);
43 percpu_write(cpu_tlbstate.active_mm, next); 41 percpu_write(cpu_tlbstate.active_mm, next);
@@ -47,6 +45,9 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
47 /* Re-load page tables */ 45 /* Re-load page tables */
48 load_cr3(next->pgd); 46 load_cr3(next->pgd);
49 47
48 /* stop flush ipis for the previous mm */
49 cpumask_clear_cpu(cpu, mm_cpumask(prev));
50
50 /* 51 /*
51 * load the LDT, if the LDT is different: 52 * load the LDT, if the LDT is different:
52 */ 53 */
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 4d0dfa0d998e..43a18c77676d 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -36,6 +36,11 @@
36#define MSR_IA32_PERFCTR1 0x000000c2 36#define MSR_IA32_PERFCTR1 0x000000c2
37#define MSR_FSB_FREQ 0x000000cd 37#define MSR_FSB_FREQ 0x000000cd
38 38
39#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2
40#define NHM_C3_AUTO_DEMOTE (1UL << 25)
41#define NHM_C1_AUTO_DEMOTE (1UL << 26)
42#define ATM_LNC_C6_AUTO_DEMOTE (1UL << 25)
43
39#define MSR_MTRRcap 0x000000fe 44#define MSR_MTRRcap 0x000000fe
40#define MSR_IA32_BBL_CR_CTL 0x00000119 45#define MSR_IA32_BBL_CR_CTL 0x00000119
41 46
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h
index e2f6a99f14ab..cc29086e30cd 100644
--- a/arch/x86/include/asm/perf_event_p4.h
+++ b/arch/x86/include/asm/perf_event_p4.h
@@ -22,6 +22,7 @@
22 22
23#define ARCH_P4_CNTRVAL_BITS (40) 23#define ARCH_P4_CNTRVAL_BITS (40)
24#define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1) 24#define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1)
25#define ARCH_P4_UNFLAGGED_BIT ((1ULL) << (ARCH_P4_CNTRVAL_BITS - 1))
25 26
26#define P4_ESCR_EVENT_MASK 0x7e000000U 27#define P4_ESCR_EVENT_MASK 0x7e000000U
27#define P4_ESCR_EVENT_SHIFT 25 28#define P4_ESCR_EVENT_SHIFT 25
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 4c2f63c7fc1b..1f4695136776 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -40,10 +40,7 @@ DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid);
40DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); 40DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);
41 41
42/* Static state in head.S used to set up a CPU */ 42/* Static state in head.S used to set up a CPU */
43extern struct { 43extern unsigned long stack_start; /* Initial stack pointer address */
44 void *sp;
45 unsigned short ss;
46} stack_start;
47 44
48struct smp_ops { 45struct smp_ops {
49 void (*smp_prepare_boot_cpu)(void); 46 void (*smp_prepare_boot_cpu)(void);
diff --git a/arch/x86/include/asm/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h
index 6c22bf353f26..725b77831993 100644
--- a/arch/x86/include/asm/smpboot_hooks.h
+++ b/arch/x86/include/asm/smpboot_hooks.h
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void)
34 */ 34 */
35 CMOS_WRITE(0, 0xf); 35 CMOS_WRITE(0, 0xf);
36 36
37 *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0; 37 *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0;
38} 38}
39 39
40static inline void __init smpboot_setup_io_apic(void) 40static inline void __init smpboot_setup_io_apic(void)
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index b3a71137983a..3e6e2d68f761 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -72,6 +72,7 @@ u8 acpi_sci_flags __initdata;
72int acpi_sci_override_gsi __initdata; 72int acpi_sci_override_gsi __initdata;
73int acpi_skip_timer_override __initdata; 73int acpi_skip_timer_override __initdata;
74int acpi_use_timer_override __initdata; 74int acpi_use_timer_override __initdata;
75int acpi_fix_pin2_polarity __initdata;
75 76
76#ifdef CONFIG_X86_LOCAL_APIC 77#ifdef CONFIG_X86_LOCAL_APIC
77static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; 78static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
@@ -415,10 +416,15 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
415 return 0; 416 return 0;
416 } 417 }
417 418
418 if (acpi_skip_timer_override && 419 if (intsrc->source_irq == 0 && intsrc->global_irq == 2) {
419 intsrc->source_irq == 0 && intsrc->global_irq == 2) { 420 if (acpi_skip_timer_override) {
420 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); 421 printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
421 return 0; 422 return 0;
423 }
424 if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) {
425 intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK;
426 printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n");
427 }
422 } 428 }
423 429
424 mp_override_legacy_irq(intsrc->source_irq, 430 mp_override_legacy_irq(intsrc->source_irq,
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 69fd72aa5594..68d1537b8c81 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -12,10 +12,8 @@
12#include <linux/cpumask.h> 12#include <linux/cpumask.h>
13#include <asm/segment.h> 13#include <asm/segment.h>
14#include <asm/desc.h> 14#include <asm/desc.h>
15
16#ifdef CONFIG_X86_32
17#include <asm/pgtable.h> 15#include <asm/pgtable.h>
18#endif 16#include <asm/cacheflush.h>
19 17
20#include "realmode/wakeup.h" 18#include "realmode/wakeup.h"
21#include "sleep.h" 19#include "sleep.h"
@@ -100,7 +98,7 @@ int acpi_save_state_mem(void)
100#else /* CONFIG_64BIT */ 98#else /* CONFIG_64BIT */
101 header->trampoline_segment = setup_trampoline() >> 4; 99 header->trampoline_segment = setup_trampoline() >> 4;
102#ifdef CONFIG_SMP 100#ifdef CONFIG_SMP
103 stack_start.sp = temp_stack + sizeof(temp_stack); 101 stack_start = (unsigned long)temp_stack + sizeof(temp_stack);
104 early_gdt_descr.address = 102 early_gdt_descr.address =
105 (unsigned long)get_cpu_gdt_table(smp_processor_id()); 103 (unsigned long)get_cpu_gdt_table(smp_processor_id());
106 initial_gs = per_cpu_offset(smp_processor_id()); 104 initial_gs = per_cpu_offset(smp_processor_id());
@@ -149,6 +147,15 @@ void __init acpi_reserve_wakeup_memory(void)
149 memblock_x86_reserve_range(mem, mem + WAKEUP_SIZE, "ACPI WAKEUP"); 147 memblock_x86_reserve_range(mem, mem + WAKEUP_SIZE, "ACPI WAKEUP");
150} 148}
151 149
150int __init acpi_configure_wakeup_memory(void)
151{
152 if (acpi_realmode)
153 set_memory_x(acpi_realmode, WAKEUP_SIZE >> PAGE_SHIFT);
154
155 return 0;
156}
157arch_initcall(acpi_configure_wakeup_memory);
158
152 159
153static int __init acpi_sleep_setup(char *str) 160static int __init acpi_sleep_setup(char *str)
154{ 161{
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 123608531c8f..7038b95d363f 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -671,7 +671,7 @@ void __kprobes text_poke_smp_batch(struct text_poke_param *params, int n)
671 671
672 atomic_set(&stop_machine_first, 1); 672 atomic_set(&stop_machine_first, 1);
673 wrote_text = 0; 673 wrote_text = 0;
674 stop_machine(stop_machine_text_poke, (void *)&tpp, NULL); 674 __stop_machine(stop_machine_text_poke, (void *)&tpp, NULL);
675} 675}
676 676
677#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL) 677#if defined(CONFIG_DYNAMIC_FTRACE) || defined(HAVE_JUMP_LABEL)
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index 51ef31a89be9..51d4e1663066 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -284,7 +284,7 @@ static int __init apbt_clockevent_register(void)
284 memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); 284 memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device));
285 285
286 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { 286 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) {
287 apbt_clockevent.rating = APBT_CLOCKEVENT_RATING - 100; 287 adev->evt.rating = APBT_CLOCKEVENT_RATING - 100;
288 global_clock_event = &adev->evt; 288 global_clock_event = &adev->evt;
289 printk(KERN_DEBUG "%s clockevent registered as global\n", 289 printk(KERN_DEBUG "%s clockevent registered as global\n",
290 global_clock_event->name); 290 global_clock_event->name);
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 06c196d7e59c..76b96d74978a 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1381,12 +1381,17 @@ void __cpuinit end_local_APIC_setup(void)
1381#endif 1381#endif
1382 1382
1383 apic_pm_activate(); 1383 apic_pm_activate();
1384}
1385
1386void __init bsp_end_local_APIC_setup(void)
1387{
1388 end_local_APIC_setup();
1384 1389
1385 /* 1390 /*
1386 * Now that local APIC setup is completed for BP, configure the fault 1391 * Now that local APIC setup is completed for BP, configure the fault
1387 * handling for interrupt remapping. 1392 * handling for interrupt remapping.
1388 */ 1393 */
1389 if (!smp_processor_id() && intr_remapping_enabled) 1394 if (intr_remapping_enabled)
1390 enable_drhd_fault_handling(); 1395 enable_drhd_fault_handling();
1391 1396
1392} 1397}
@@ -1756,7 +1761,7 @@ int __init APIC_init_uniprocessor(void)
1756 enable_IO_APIC(); 1761 enable_IO_APIC();
1757#endif 1762#endif
1758 1763
1759 end_local_APIC_setup(); 1764 bsp_end_local_APIC_setup();
1760 1765
1761#ifdef CONFIG_X86_IO_APIC 1766#ifdef CONFIG_X86_IO_APIC
1762 if (smp_found_config && !skip_ioapic_setup && nr_ioapics) 1767 if (smp_found_config && !skip_ioapic_setup && nr_ioapics)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 697dc34b7b87..ca9e2a3545a9 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -4002,6 +4002,9 @@ int mp_find_ioapic(u32 gsi)
4002{ 4002{
4003 int i = 0; 4003 int i = 0;
4004 4004
4005 if (nr_ioapics == 0)
4006 return -1;
4007
4005 /* Find the IOAPIC that manages this GSI. */ 4008 /* Find the IOAPIC that manages this GSI. */
4006 for (i = 0; i < nr_ioapics; i++) { 4009 for (i = 0; i < nr_ioapics; i++) {
4007 if ((gsi >= mp_gsi_routing[i].gsi_base) 4010 if ((gsi >= mp_gsi_routing[i].gsi_base)
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index bd1cac747f67..52c93648e492 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -158,9 +158,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
158{ 158{
159 if (c->x86 == 0x06) { 159 if (c->x86 == 0x06) {
160 if (cpu_has(c, X86_FEATURE_EST)) 160 if (cpu_has(c, X86_FEATURE_EST))
161 printk(KERN_WARNING PFX "Warning: EST-capable CPU " 161 printk_once(KERN_WARNING PFX "Warning: EST-capable "
162 "detected. The acpi-cpufreq module offers " 162 "CPU detected. The acpi-cpufreq module offers "
163 "voltage scaling in addition of frequency " 163 "voltage scaling in addition to frequency "
164 "scaling. You should use that instead of " 164 "scaling. You should use that instead of "
165 "p4-clockmod, if possible.\n"); 165 "p4-clockmod, if possible.\n");
166 switch (c->x86_model) { 166 switch (c->x86_model) {
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 35c7e65e59be..c567dec854f6 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1537,6 +1537,7 @@ static struct notifier_block cpb_nb = {
1537static int __cpuinit powernowk8_init(void) 1537static int __cpuinit powernowk8_init(void)
1538{ 1538{
1539 unsigned int i, supported_cpus = 0, cpu; 1539 unsigned int i, supported_cpus = 0, cpu;
1540 int rv;
1540 1541
1541 for_each_online_cpu(i) { 1542 for_each_online_cpu(i) {
1542 int rc; 1543 int rc;
@@ -1555,14 +1556,14 @@ static int __cpuinit powernowk8_init(void)
1555 1556
1556 cpb_capable = true; 1557 cpb_capable = true;
1557 1558
1558 register_cpu_notifier(&cpb_nb);
1559
1560 msrs = msrs_alloc(); 1559 msrs = msrs_alloc();
1561 if (!msrs) { 1560 if (!msrs) {
1562 printk(KERN_ERR "%s: Error allocating msrs!\n", __func__); 1561 printk(KERN_ERR "%s: Error allocating msrs!\n", __func__);
1563 return -ENOMEM; 1562 return -ENOMEM;
1564 } 1563 }
1565 1564
1565 register_cpu_notifier(&cpb_nb);
1566
1566 rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); 1567 rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs);
1567 1568
1568 for_each_cpu(cpu, cpu_online_mask) { 1569 for_each_cpu(cpu, cpu_online_mask) {
@@ -1574,7 +1575,13 @@ static int __cpuinit powernowk8_init(void)
1574 (cpb_enabled ? "on" : "off")); 1575 (cpb_enabled ? "on" : "off"));
1575 } 1576 }
1576 1577
1577 return cpufreq_register_driver(&cpufreq_amd64_driver); 1578 rv = cpufreq_register_driver(&cpufreq_amd64_driver);
1579 if (rv < 0 && boot_cpu_has(X86_FEATURE_CPB)) {
1580 unregister_cpu_notifier(&cpb_nb);
1581 msrs_free(msrs);
1582 msrs = NULL;
1583 }
1584 return rv;
1578} 1585}
1579 1586
1580/* driver entry point for term */ 1587/* driver entry point for term */
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 01c0f3ee6cc3..bebabec5b448 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -793,13 +793,21 @@ void set_mtrr_aps_delayed_init(void)
793} 793}
794 794
795/* 795/*
796 * MTRR initialization for all AP's 796 * Delayed MTRR initialization for all AP's
797 */ 797 */
798void mtrr_aps_init(void) 798void mtrr_aps_init(void)
799{ 799{
800 if (!use_intel()) 800 if (!use_intel())
801 return; 801 return;
802 802
803 /*
804 * Check if someone has requested the delay of AP MTRR initialization,
805 * by doing set_mtrr_aps_delayed_init(), prior to this point. If not,
806 * then we are done.
807 */
808 if (!mtrr_aps_delayed_init)
809 return;
810
803 set_mtrr(~0U, 0, 0, 0); 811 set_mtrr(~0U, 0, 0, 0);
804 mtrr_aps_delayed_init = false; 812 mtrr_aps_delayed_init = false;
805} 813}
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index e56b9bfbabd1..ff751a9f182b 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -682,7 +682,7 @@ static int p4_validate_raw_event(struct perf_event *event)
682 * if an event is shared accross the logical threads 682 * if an event is shared accross the logical threads
683 * the user needs special permissions to be able to use it 683 * the user needs special permissions to be able to use it
684 */ 684 */
685 if (p4_event_bind_map[v].shared) { 685 if (p4_ht_active() && p4_event_bind_map[v].shared) {
686 if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN)) 686 if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
687 return -EACCES; 687 return -EACCES;
688 } 688 }
@@ -727,7 +727,8 @@ static int p4_hw_config(struct perf_event *event)
727 event->hw.config = p4_set_ht_bit(event->hw.config); 727 event->hw.config = p4_set_ht_bit(event->hw.config);
728 728
729 if (event->attr.type == PERF_TYPE_RAW) { 729 if (event->attr.type == PERF_TYPE_RAW) {
730 730 struct p4_event_bind *bind;
731 unsigned int esel;
731 /* 732 /*
732 * Clear bits we reserve to be managed by kernel itself 733 * Clear bits we reserve to be managed by kernel itself
733 * and never allowed from a user space 734 * and never allowed from a user space
@@ -743,6 +744,13 @@ static int p4_hw_config(struct perf_event *event)
743 * bits since we keep additional info here (for cache events and etc) 744 * bits since we keep additional info here (for cache events and etc)
744 */ 745 */
745 event->hw.config |= event->attr.config; 746 event->hw.config |= event->attr.config;
747 bind = p4_config_get_bind(event->attr.config);
748 if (!bind) {
749 rc = -EINVAL;
750 goto out;
751 }
752 esel = P4_OPCODE_ESEL(bind->opcode);
753 event->hw.config |= p4_config_pack_cccr(P4_CCCR_ESEL(esel));
746 } 754 }
747 755
748 rc = x86_setup_perfctr(event); 756 rc = x86_setup_perfctr(event);
@@ -762,9 +770,14 @@ static inline int p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc)
762 return 1; 770 return 1;
763 } 771 }
764 772
765 /* it might be unflagged overflow */ 773 /*
766 rdmsrl(hwc->event_base + hwc->idx, v); 774 * In some circumstances the overflow might issue an NMI but did
767 if (!(v & ARCH_P4_CNTRVAL_MASK)) 775 * not set P4_CCCR_OVF bit. Because a counter holds a negative value
776 * we simply check for high bit being set, if it's cleared it means
777 * the counter has reached zero value and continued counting before
778 * real NMI signal was received:
779 */
780 if (!(v & ARCH_P4_UNFLAGGED_BIT))
768 return 1; 781 return 1;
769 782
770 return 0; 783 return 0;
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 76b8cd953dee..9efbdcc56425 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -143,15 +143,10 @@ static void __init ati_bugs(int num, int slot, int func)
143 143
144static u32 __init ati_sbx00_rev(int num, int slot, int func) 144static u32 __init ati_sbx00_rev(int num, int slot, int func)
145{ 145{
146 u32 old, d; 146 u32 d;
147 147
148 d = read_pci_config(num, slot, func, 0x70);
149 old = d;
150 d &= ~(1<<8);
151 write_pci_config(num, slot, func, 0x70, d);
152 d = read_pci_config(num, slot, func, 0x8); 148 d = read_pci_config(num, slot, func, 0x8);
153 d &= 0xff; 149 d &= 0xff;
154 write_pci_config(num, slot, func, 0x70, old);
155 150
156 return d; 151 return d;
157} 152}
@@ -160,13 +155,16 @@ static void __init ati_bugs_contd(int num, int slot, int func)
160{ 155{
161 u32 d, rev; 156 u32 d, rev;
162 157
163 if (acpi_use_timer_override)
164 return;
165
166 rev = ati_sbx00_rev(num, slot, func); 158 rev = ati_sbx00_rev(num, slot, func);
159 if (rev >= 0x40)
160 acpi_fix_pin2_polarity = 1;
161
167 if (rev > 0x13) 162 if (rev > 0x13)
168 return; 163 return;
169 164
165 if (acpi_use_timer_override)
166 return;
167
170 /* check for IRQ0 interrupt swap */ 168 /* check for IRQ0 interrupt swap */
171 d = read_pci_config(num, slot, func, 0x64); 169 d = read_pci_config(num, slot, func, 0x64);
172 if (!(d & (1<<14))) 170 if (!(d & (1<<14)))
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index fc293dc8dc35..767d6c43de37 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -85,6 +85,8 @@ RESERVE_BRK(pagetables, INIT_MAP_SIZE)
85 */ 85 */
86__HEAD 86__HEAD
87ENTRY(startup_32) 87ENTRY(startup_32)
88 movl pa(stack_start),%ecx
89
88 /* test KEEP_SEGMENTS flag to see if the bootloader is asking 90 /* test KEEP_SEGMENTS flag to see if the bootloader is asking
89 us to not reload segments */ 91 us to not reload segments */
90 testb $(1<<6), BP_loadflags(%esi) 92 testb $(1<<6), BP_loadflags(%esi)
@@ -99,7 +101,9 @@ ENTRY(startup_32)
99 movl %eax,%es 101 movl %eax,%es
100 movl %eax,%fs 102 movl %eax,%fs
101 movl %eax,%gs 103 movl %eax,%gs
104 movl %eax,%ss
1022: 1052:
106 leal -__PAGE_OFFSET(%ecx),%esp
103 107
104/* 108/*
105 * Clear BSS first so that there are no surprises... 109 * Clear BSS first so that there are no surprises...
@@ -145,8 +149,6 @@ ENTRY(startup_32)
145 * _brk_end is set up to point to the first "safe" location. 149 * _brk_end is set up to point to the first "safe" location.
146 * Mappings are created both at virtual address 0 (identity mapping) 150 * Mappings are created both at virtual address 0 (identity mapping)
147 * and PAGE_OFFSET for up to _end. 151 * and PAGE_OFFSET for up to _end.
148 *
149 * Note that the stack is not yet set up!
150 */ 152 */
151#ifdef CONFIG_X86_PAE 153#ifdef CONFIG_X86_PAE
152 154
@@ -282,6 +284,9 @@ ENTRY(startup_32_smp)
282 movl %eax,%es 284 movl %eax,%es
283 movl %eax,%fs 285 movl %eax,%fs
284 movl %eax,%gs 286 movl %eax,%gs
287 movl pa(stack_start),%ecx
288 movl %eax,%ss
289 leal -__PAGE_OFFSET(%ecx),%esp
285#endif /* CONFIG_SMP */ 290#endif /* CONFIG_SMP */
286default_entry: 291default_entry:
287 292
@@ -347,8 +352,8 @@ default_entry:
347 movl %eax,%cr0 /* ..and set paging (PG) bit */ 352 movl %eax,%cr0 /* ..and set paging (PG) bit */
348 ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */ 353 ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
3491: 3541:
350 /* Set up the stack pointer */ 355 /* Shift the stack pointer to a virtual address */
351 lss stack_start,%esp 356 addl $__PAGE_OFFSET, %esp
352 357
353/* 358/*
354 * Initialize eflags. Some BIOS's leave bits like NT set. This would 359 * Initialize eflags. Some BIOS's leave bits like NT set. This would
@@ -360,9 +365,7 @@ default_entry:
360 365
361#ifdef CONFIG_SMP 366#ifdef CONFIG_SMP
362 cmpb $0, ready 367 cmpb $0, ready
363 jz 1f /* Initial CPU cleans BSS */ 368 jnz checkCPUtype
364 jmp checkCPUtype
3651:
366#endif /* CONFIG_SMP */ 369#endif /* CONFIG_SMP */
367 370
368/* 371/*
@@ -470,14 +473,7 @@ is386: movl $2,%ecx # set MP
470 473
471 cld # gcc2 wants the direction flag cleared at all times 474 cld # gcc2 wants the direction flag cleared at all times
472 pushl $0 # fake return address for unwinder 475 pushl $0 # fake return address for unwinder
473#ifdef CONFIG_SMP
474 movb ready, %cl
475 movb $1, ready 476 movb $1, ready
476 cmpb $0,%cl # the first CPU calls start_kernel
477 je 1f
478 movl (stack_start), %esp
4791:
480#endif /* CONFIG_SMP */
481 jmp *(initial_code) 477 jmp *(initial_code)
482 478
483/* 479/*
@@ -670,15 +666,15 @@ ENTRY(initial_page_table)
670#endif 666#endif
671 667
672.data 668.data
669.balign 4
673ENTRY(stack_start) 670ENTRY(stack_start)
674 .long init_thread_union+THREAD_SIZE 671 .long init_thread_union+THREAD_SIZE
675 .long __BOOT_DS
676
677ready: .byte 0
678 672
679early_recursion_flag: 673early_recursion_flag:
680 .long 0 674 .long 0
681 675
676ready: .byte 0
677
682int_msg: 678int_msg:
683 .asciz "Unknown interrupt or fault at: %p %p %p\n" 679 .asciz "Unknown interrupt or fault at: %p %p %p\n"
684 680
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 52945da52a94..387b6a0c9e81 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -367,7 +367,8 @@ void fixup_irqs(void)
367 if (irr & (1 << (vector % 32))) { 367 if (irr & (1 << (vector % 32))) {
368 irq = __this_cpu_read(vector_irq[vector]); 368 irq = __this_cpu_read(vector_irq[vector]);
369 369
370 data = irq_get_irq_data(irq); 370 desc = irq_to_desc(irq);
371 data = &desc->irq_data;
371 raw_spin_lock(&desc->lock); 372 raw_spin_lock(&desc->lock);
372 if (data->chip->irq_retrigger) 373 if (data->chip->irq_retrigger)
373 data->chip->irq_retrigger(data); 374 data->chip->irq_retrigger(data);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index e764fc05d700..ff4554198981 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -92,21 +92,31 @@ void show_regs(struct pt_regs *regs)
92 92
93void show_regs_common(void) 93void show_regs_common(void)
94{ 94{
95 const char *board, *product; 95 const char *vendor, *product, *board;
96 96
97 board = dmi_get_system_info(DMI_BOARD_NAME); 97 vendor = dmi_get_system_info(DMI_SYS_VENDOR);
98 if (!board) 98 if (!vendor)
99 board = ""; 99 vendor = "";
100 product = dmi_get_system_info(DMI_PRODUCT_NAME); 100 product = dmi_get_system_info(DMI_PRODUCT_NAME);
101 if (!product) 101 if (!product)
102 product = ""; 102 product = "";
103 103
104 /* Board Name is optional */
105 board = dmi_get_system_info(DMI_BOARD_NAME);
106
104 printk(KERN_CONT "\n"); 107 printk(KERN_CONT "\n");
105 printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n", 108 printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s",
106 current->pid, current->comm, print_tainted(), 109 current->pid, current->comm, print_tainted(),
107 init_utsname()->release, 110 init_utsname()->release,
108 (int)strcspn(init_utsname()->version, " "), 111 (int)strcspn(init_utsname()->version, " "),
109 init_utsname()->version, board, product); 112 init_utsname()->version);
113 printk(KERN_CONT " ");
114 printk(KERN_CONT "%s %s", vendor, product);
115 if (board) {
116 printk(KERN_CONT "/");
117 printk(KERN_CONT "%s", board);
118 }
119 printk(KERN_CONT "\n");
110} 120}
111 121
112void flush_thread(void) 122void flush_thread(void)
@@ -506,7 +516,7 @@ static void poll_idle(void)
506#define MWAIT_ECX_EXTENDED_INFO 0x01 516#define MWAIT_ECX_EXTENDED_INFO 0x01
507#define MWAIT_EDX_C1 0xf0 517#define MWAIT_EDX_C1 0xf0
508 518
509int __cpuinit mwait_usable(const struct cpuinfo_x86 *c) 519int mwait_usable(const struct cpuinfo_x86 *c)
510{ 520{
511 u32 eax, ebx, ecx, edx; 521 u32 eax, ebx, ecx, edx;
512 522
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index fc7aae1e2bc7..715037caeb43 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -285,6 +285,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
285 DMI_MATCH(DMI_BOARD_NAME, "P4S800"), 285 DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
286 }, 286 },
287 }, 287 },
288 { /* Handle problems with rebooting on VersaLogic Menlow boards */
289 .callback = set_bios_reboot,
290 .ident = "VersaLogic Menlow based board",
291 .matches = {
292 DMI_MATCH(DMI_BOARD_VENDOR, "VersaLogic Corporation"),
293 DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"),
294 },
295 },
288 { } 296 { }
289}; 297};
290 298
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 0cbe8c0b35ed..08776a953487 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -638,7 +638,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
638 * target processor state. 638 * target processor state.
639 */ 639 */
640 startup_ipi_hook(phys_apicid, (unsigned long) start_secondary, 640 startup_ipi_hook(phys_apicid, (unsigned long) start_secondary,
641 (unsigned long)stack_start.sp); 641 stack_start);
642 642
643 /* 643 /*
644 * Run STARTUP IPI loop. 644 * Run STARTUP IPI loop.
@@ -785,7 +785,7 @@ do_rest:
785#endif 785#endif
786 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu); 786 early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(cpu);
787 initial_code = (unsigned long)start_secondary; 787 initial_code = (unsigned long)start_secondary;
788 stack_start.sp = (void *) c_idle.idle->thread.sp; 788 stack_start = c_idle.idle->thread.sp;
789 789
790 /* start_ip had better be page-aligned! */ 790 /* start_ip had better be page-aligned! */
791 start_ip = setup_trampoline(); 791 start_ip = setup_trampoline();
@@ -1060,7 +1060,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
1060 1060
1061 connect_bsp_APIC(); 1061 connect_bsp_APIC();
1062 setup_local_APIC(); 1062 setup_local_APIC();
1063 end_local_APIC_setup(); 1063 bsp_end_local_APIC_setup();
1064 return -1; 1064 return -1;
1065 } 1065 }
1066 1066
@@ -1137,7 +1137,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1137 if (!skip_ioapic_setup && nr_ioapics) 1137 if (!skip_ioapic_setup && nr_ioapics)
1138 enable_IO_APIC(); 1138 enable_IO_APIC();
1139 1139
1140 end_local_APIC_setup(); 1140 bsp_end_local_APIC_setup();
1141 1141
1142 map_cpu_to_logical_apicid(); 1142 map_cpu_to_logical_apicid();
1143 1143
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 25bd1bc5aad2..63fec1531e89 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1150,8 +1150,8 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu)
1150 kvm_load_ldt(svm->host.ldt); 1150 kvm_load_ldt(svm->host.ldt);
1151#ifdef CONFIG_X86_64 1151#ifdef CONFIG_X86_64
1152 loadsegment(fs, svm->host.fs); 1152 loadsegment(fs, svm->host.fs);
1153 load_gs_index(svm->host.gs);
1154 wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); 1153 wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
1154 load_gs_index(svm->host.gs);
1155#else 1155#else
1156 loadsegment(gs, svm->host.gs); 1156 loadsegment(gs, svm->host.gs);
1157#endif 1157#endif
@@ -2777,6 +2777,8 @@ static int dr_interception(struct vcpu_svm *svm)
2777 kvm_register_write(&svm->vcpu, reg, val); 2777 kvm_register_write(&svm->vcpu, reg, val);
2778 } 2778 }
2779 2779
2780 skip_emulated_instruction(&svm->vcpu);
2781
2780 return 1; 2782 return 1;
2781} 2783}
2782 2784
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 8b830ca14ac4..d343b3c81f3c 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -256,7 +256,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
256 unsigned long pfn) 256 unsigned long pfn)
257{ 257{
258 pgprot_t forbidden = __pgprot(0); 258 pgprot_t forbidden = __pgprot(0);
259 pgprot_t required = __pgprot(0);
260 259
261 /* 260 /*
262 * The BIOS area between 640k and 1Mb needs to be executable for 261 * The BIOS area between 640k and 1Mb needs to be executable for
@@ -282,12 +281,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
282 if (within(pfn, __pa((unsigned long)__start_rodata) >> PAGE_SHIFT, 281 if (within(pfn, __pa((unsigned long)__start_rodata) >> PAGE_SHIFT,
283 __pa((unsigned long)__end_rodata) >> PAGE_SHIFT)) 282 __pa((unsigned long)__end_rodata) >> PAGE_SHIFT))
284 pgprot_val(forbidden) |= _PAGE_RW; 283 pgprot_val(forbidden) |= _PAGE_RW;
285 /*
286 * .data and .bss should always be writable.
287 */
288 if (within(address, (unsigned long)_sdata, (unsigned long)_edata) ||
289 within(address, (unsigned long)__bss_start, (unsigned long)__bss_stop))
290 pgprot_val(required) |= _PAGE_RW;
291 284
292#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA) 285#if defined(CONFIG_X86_64) && defined(CONFIG_DEBUG_RODATA)
293 /* 286 /*
@@ -327,7 +320,6 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
327#endif 320#endif
328 321
329 prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden)); 322 prot = __pgprot(pgprot_val(prot) & ~pgprot_val(forbidden));
330 prot = __pgprot(pgprot_val(prot) | pgprot_val(required));
331 323
332 return prot; 324 return prot;
333} 325}
diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index dab874647530..044bda5b3174 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -140,8 +140,7 @@ void * __init prom_early_alloc(unsigned long size)
140 * wasted bootmem) and hand off chunks of it to callers. 140 * wasted bootmem) and hand off chunks of it to callers.
141 */ 141 */
142 res = alloc_bootmem(chunk_size); 142 res = alloc_bootmem(chunk_size);
143 if (!res) 143 BUG_ON(!res);
144 return NULL;
145 prom_early_allocated += chunk_size; 144 prom_early_allocated += chunk_size;
146 memset(res, 0, chunk_size); 145 memset(res, 0, chunk_size);
147 free_mem = chunk_size; 146 free_mem = chunk_size;